ice-render 0.0.14 → 0.0.15
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.cjs.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
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(t){"use strict";function z(e,t){var i,n=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)),n}function l(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?z(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):z(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function T(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function e(t,e,i){return e&&T(t.prototype,e),i&&T(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(t,e,i){e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i}function i(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&&L(t,e)}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function L(t,e){return(L=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function a(i){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=r(i),e=(t=n?(t=r(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return o(e)}}function h(){return(h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t}(t,e);if(n)return(n=Object.getOwnPropertyDescriptor(n,e)).get?n.get.call(arguments.length<3?t:i):n.value}).apply(this,arguments)}function u(t){return function(t){if(Array.isArray(t))return R(t)}(t)||function(){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}()||function(t){if(t){if("string"==typeof t)return R(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(e="Object"===e&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?R(t,void 0):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function H(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Q&&Q in Object(t)?Z(t):K.call(t)}function V(t){return null!=t&&"object"==typeof t}function q(t){return"string"==typeof t||!Y(t)&&$(t)&&"[object String]"==G(t)}function X(t){return void 0===t}var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},c="object"==typeof c&&c&&c.Object===Object&&c,d="object"==typeof self&&self&&self.Object===Object&&self,d=c||d||Function("return this")(),W=d.Symbol,f=Object.prototype,J=f.hasOwnProperty,U=f.toString,F=W?W.toStringTag:void 0,K=Object.prototype.toString,Z=function(t){var e=J.call(t,F),i=t[F];try{var n=!(t[F]=void 0)}catch(t){}var s=U.call(t);return n&&(e?t[F]=i:delete t[F]),s},Q=W?W.toStringTag:void 0,f=Array.isArray,G=H,Y=f,$=V,tt="ICE_FRAME_EVENT",et="BEFORE_RENDER",it="AFTER_RENDER",nt="BEFORE_ADD",st="AFTER_ADD",ot="BEFORE_REMOVE",rt="ROUND_FINISH",at="HOOK_MOUSEDOWN",ht="HOOK_MOUSEMOVE",lt="HOOK_MOUSEUP",ut="BEFORE_RESIZE",p="AFTER_RESIZE",ct="AFTER_ROTATE",v="AFTER_MOVE",dt={linear:function(t,e,i,n){return t+(e-t)/i*(Date.now()-n)},easeInQuad:function(t,e,i,n){n=Date.now()-n;return t+(e-t)/i*(n/i)*n},easeOutQuad:function(t,e,i,n){n=Date.now()-n;return-(e-t)*(n/=i)*(n-2)+t},easeInOutQuad:function(t,e,i,n){n=Date.now()-n,e-=t;return(n/=i/2)<1?e/2*n*n+t:-e/2*(--n*(n-2)-1)+t},easeInQuart:function(t,e,i,n){n=Date.now()-n;return(e-t)*(n/=i)*n*n*n+t},easeOutQuart:function(t,e,i,n){return-(e-t)*((e=(Date.now()-n)/i-1)*e*e*e-1)+t},easeInOutQuart:function(t,e,i,n){n=Date.now()-n,e-=t;return(n/=i/2)<1?e/2*n*n*n*n+t:-e/2*((n-=2)*n*n*n-2)+t},easeInCubic:function(t,e,i,n){n=Date.now()-n;return(e-t)*(n/=i)*n*n+t},easeOutCubic:function(t,e,i,n){return(e-t)*((e=(Date.now()-n)/i-1)*e*e+1)+t},easeInOutCubic:function(t,e,i,n){n=Date.now()-n,e-=t;return(n/=i/2)<1?e/2*n*n*n+t:e/2*((n-=2)*n*n+2)+t}},ft=(e(yt,[{key:"start",value:function(){return this.ice.evtBus.on(tt,this.frameEventHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off(tt,this.frameEventHandler,this),this}},{key:"frameEventHandler",value:function(t){for(var e=u(this.animationMap.values()),i=0;i<e.length;i++){var n=e[i];n.state.interactive=!1,this.tween(n),n.state.interactive=!0}}},{key:"tween",value:function(t){var e,i={},n=t.props.animations,s=1;for(e in n){var o=n[e];if(o.finished){if(++s===Object.keys(n).length){this.remove(t);break}}else{var r=o.from,a=o.to,h=o.duration,r=(X(o.startTime)&&(o.startTime=Date.now()),X(o.easing)&&(o.easing="linear"),dt[o.easing](r,a,h,o.startTime));a<r&&(r=a,o.finished=!0),i[e]=Math.floor(r)}}return t.setState(l({},i)),t}},{key:"add",value:function(t){this.animationMap.set(t.props.id,t)}},{key:"remove",value:function(t){q(t)?this.animationMap.delete(t):this.animationMap.delete(t.props.id)}}]),yt),pt="undefined"!=typeof Float32Array?Float32Array:Array,vt=Math.PI/180;function yt(t){s(this,yt),n(this,"animationMap",new Map),this.ice=t}function gt(t){return t*vt}function mt(t,e){var i=e[0],n=e[1],s=e[2],o=e[3],r=e[4],e=e[5],a=i*o-n*s;return a?(t[0]=o*(a=1/a),t[1]=-n*a,t[2]=-s*a,t[3]=i*a,t[4]=(s*e-o*r)*a,t[5]=(n*r-i*e)*a,t):null}function bt(t,e,i){var n=e[0],s=e[1],o=e[2],r=e[3],a=e[4],e=e[5],h=i[0],l=i[1],u=i[2],c=i[3],d=i[4],i=i[5];return t[0]=n*h+o*l,t[1]=s*h+r*l,t[2]=n*u+o*c,t[3]=s*u+r*c,t[4]=n*d+o*i+a,t[5]=s*d+r*i+e,t}function y(t,e,i){var n=e[0],e=e[1];return t[0]=i[0]*n+i[2]*e+i[4],t[1]=i[1]*n+i[3]*e+i[5],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),g=new pt(2),pt!=Float32Array&&(g[0]=0,g[1]=0);function kt(t,e){return t===e||t!=t&&e!=e}function wt(t,e){for(var i=t.length;i--;)if(xt(t[i][0],e))return i;return-1}var xt=kt,Ct=wt,Pt=Array.prototype.splice,St=wt,Mt=wt,Ot=wt;function Et(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Et.prototype.clear=function(){this.__data__=[],this.size=0},Et.prototype.delete=function(t){var e=this.__data__,t=Ct(e,t);return!(t<0||(t==e.length-1?e.pop():Pt.call(e,t,1),--this.size,0))},Et.prototype.get=function(t){var e=this.__data__,t=St(e,t);return t<0?void 0:e[t][1]},Et.prototype.has=function(t){return-1<Mt(this.__data__,t)},Et.prototype.set=function(t,e){var i=this.__data__,n=Ot(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this};function _t(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Bt(t){return!!Tt(t)&&("[object Function]"==(t=zt(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function It(t){if(null!=t){try{return Rt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function At(t,e){return e=e,t=null==(t=t)?void 0:t[e],!qt(e=t)||Vt(e)||!(Ht(e)?Jt:Wt).test(Xt(e))?void 0:t}function Nt(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t}function jt(t){var e,i=this.__data__;return Ft?"__lodash_hash_undefined__"===(e=i[t])?void 0:e:Kt.call(i,t)?i[t]:void 0}var g=Et,Dt=g,zt=H,Tt=_t,m=d["__core-js_shared__"],Lt=(m=/[^.]+$/.exec(m&&m.keys&&m.keys.IE_PROTO||""))?"Symbol(src)_1."+m:"",Rt=Function.prototype.toString,Ht=Bt,Vt=function(t){return!!Lt&&Lt in t},qt=_t,Xt=It,Wt=/^\[object .+?Constructor\]$/,m=Function.prototype,b=Object.prototype,m=m.toString,b=b.hasOwnProperty,Jt=RegExp("^"+m.call(b).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),m=At(d,"Map"),b=At(Object,"create"),Ut=b,Ft=b,Kt=Object.prototype.hasOwnProperty,Zt=b,Qt=Object.prototype.hasOwnProperty,Gt=b;function Yt(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Yt.prototype.clear=function(){this.__data__=Ut?Ut(null):{},this.size=0},Yt.prototype.delete=Nt,Yt.prototype.get=jt,Yt.prototype.has=function(t){var e=this.__data__;return Zt?void 0!==e[t]:Qt.call(e,t)},Yt.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Gt&&void 0===e?"__lodash_hash_undefined__":e,this};function $t(t,e){var i,n,t=t.__data__;return("string"==(n=typeof(i=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==i:null===i)?t["string"==typeof e?"string":"hash"]:t.map}var te=Yt,ee=g,ie=m,ne=$t,se=$t,oe=$t,re=$t;function ae(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}ae.prototype.clear=function(){this.size=0,this.__data__={hash:new te,map:new(ie||ee),string:new te}},ae.prototype.delete=function(t){t=ne(this,t).delete(t);return this.size-=t?1:0,t},ae.prototype.get=function(t){return se(this,t).get(t)},ae.prototype.has=function(t){return oe(this,t).has(t)},ae.prototype.set=function(t,e){var i=re(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this};function he(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t}function le(t){return this.__data__.get(t)}function ue(t){return this.__data__.has(t)}var ce=g,de=m,fe=ae,pe=g;function ve(t){t=this.__data__=new pe(t);this.size=t.size}ve.prototype.clear=function(){this.__data__=new Dt,this.size=0},ve.prototype.delete=he,ve.prototype.get=le,ve.prototype.has=ue,ve.prototype.set=function(t,e){var i=this.__data__;if(i instanceof ce){var n=i.__data__;if(!de||n.length<199)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new fe(n)}return i.set(t,e),this.size=i.size,this};function ye(t,e,i){"__proto__"==e&&we?we(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}function ge(t,e,i){(void 0===i||Ce(t[e],i))&&(void 0!==i||e in t)||xe(t,e,i)}function me(t,e,i){for(var n=-1,s=Object(t),o=i(t),r=o.length;r--;){var a=o[++n];if(!1===e(s[a],a,s))break}return t}var be,b=ve,ke=At,g=function(){try{var t=ke(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),we=g,xe=ye,Ce=kt,Pe={exports:{}},Se=(k=(k=(x=Pe).exports)&&!k.nodeType&&k,w=(w=k&&x&&!x.nodeType&&x)&&w.exports===k?d.Buffer:void 0,be=w?w.allocUnsafe:void 0,x.exports=function(t,e){if(e)return t.slice();e=t.length,e=be?be(e):new t.constructor(e);return t.copy(e),e},d.Uint8Array),Me=_t,Oe=Object.create;function Ee(){}function _e(e,i){return function(t){return e(i(t))}}function Be(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ve)}function Ie(t){return Ue(t)&&"[object Arguments]"==Je(t)}function Ae(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991}function Ne(t){return null!=t&&Ge(t.length)&&!Qe(t)}function je(t){return hi(t)&&ai(t.length)&&!!S[ri(t)]}function De(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function ze(t,e){var i=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==i||"symbol"!=i&&fi.test(t))&&-1<t&&t%1==0&&t<e}function Te(t){if(Si(t))return Pi(t,!0);var e=t;if(!ki(e))return xi(e);var i,n=wi(e),s=[];for(i in e)("constructor"!=i||!n&&Ci.call(e,i))&&s.push(i);return s}function Le(t){return t}var Re,He,k=_e(Object.getPrototypeOf,Object),Ve=Object.prototype,qe=function(t){if(!Me(t))return{};if(Oe)return Oe(t);Ee.prototype=t;t=new Ee;return Ee.prototype=void 0,t},Xe=k,We=Be,Je=H,Ue=V,Fe=V,w=Object.prototype,Ke=w.hasOwnProperty,Ze=w.propertyIsEnumerable,x=Ie(function(){return arguments}())?Ie:function(t){return Fe(t)&&Ke.call(t,"callee")&&!Ze.call(t,"callee")},Qe=Bt,Ge=Ae,Ye=Ne,$e=V,w={exports:{}},ti=(M=(M=(P=w).exports)&&!M.nodeType&&M,C=(C=M&&P&&!P.nodeType&&P)&&C.exports===M?d.Buffer:void 0,M=(C?C.isBuffer:void 0)||function(){return!1},P.exports=M,H),ei=k,ii=V,C=Function.prototype,P=Object.prototype,ni=C.toString,si=P.hasOwnProperty,oi=ni.call(Object),ri=H,ai=Ae,hi=V,S={},M=(S["[object Float32Array]"]=S["[object Float64Array]"]=S["[object Int8Array]"]=S["[object Int16Array]"]=S["[object Int32Array]"]=S["[object Uint8Array]"]=S["[object Uint8ClampedArray]"]=S["[object Uint16Array]"]=S["[object Uint32Array]"]=!0,S["[object Arguments]"]=S["[object Array]"]=S["[object ArrayBuffer]"]=S["[object Boolean]"]=S["[object DataView]"]=S["[object Date]"]=S["[object Error]"]=S["[object Function]"]=S["[object Map]"]=S["[object Number]"]=S["[object Object]"]=S["[object RegExp]"]=S["[object Set]"]=S["[object String]"]=S["[object WeakMap]"]=!1,{exports:{}}),P=(C=(C=(k=M).exports)&&!C.nodeType&&C,Re=C&&k&&!k.nodeType&&k,He=Re&&Re.exports===C&&c.process,C=function(){try{return Re&&Re.require&&Re.require("util").types||He&&He.binding&&He.binding("util")}catch(t){}}(),k.exports=C,function(e){return function(t){return e(t)}}),c=M.exports,k=c&&c.isTypedArray,C=k?P(k):je,li=ye,ui=kt,ci=Object.prototype.hasOwnProperty,di=ye,fi=/^(?:0|[1-9]\d*)$/,pi=x,vi=f,yi=w.exports,gi=ze,mi=C,bi=Object.prototype.hasOwnProperty,ki=_t,wi=Be,xi=function(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e},Ci=Object.prototype.hasOwnProperty,Pi=function(t,e){var i,n=vi(t),s=!n&&pi(t),o=!n&&!s&&yi(t),r=!n&&!s&&!o&&mi(t),a=n||s||o||r,h=a?function(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n}(t.length,String):[],l=h.length;for(i in t)!e&&!bi.call(t,i)||a&&("length"==i||o&&("offset"==i||"parent"==i)||r&&("buffer"==i||"byteLength"==i||"byteOffset"==i)||gi(i,l))||h.push(i);return h},Si=Ne,Mi=function(t,e,i,n){var s=!i;i=i||{};for(var o,r,a=-1,h=e.length;++a<h;){var l=e[a],u=n?n(i[l],t[l],l,i,t):void 0;void 0===u&&(u=t[l]),s?di(i,l,u):(u=u,r=void 0,r=(o=i)[l=l],ci.call(o,l)&&ui(r,u)&&(void 0!==u||l in o)||li(o,l,u))}return i},Oi=Te,Ei=ge,_i=Pe.exports,Bi=function(t,e){var i,e=e?(e=t.buffer,i=new e.constructor(e.byteLength),new Se(i).set(new Se(e)),i):t.buffer;return new t.constructor(e,t.byteOffset,t.length)},Ii=function(t,e){var i=-1,n=t.length;for(e=e||Array(n);++i<n;)e[i]=t[i];return e},Ai=function(t){return"function"!=typeof t.constructor||We(t)?{}:qe(Xe(t))},Ni=x,ji=f,Di=function(t){return $e(t)&&Ye(t)},zi=w.exports,Ti=Bt,Li=_t,Ri=function(t){if(!ii(t)||"[object Object]"!=ti(t))return!1;t=ei(t);if(null===t)return!0;t=si.call(t,"constructor")&&t.constructor;return"function"==typeof t&&t instanceof t&&ni.call(t)==oi},Hi=C,Vi=De,qi=function(t){return Mi(t,Oi(t))},Xi=b,Wi=ge,Ji=me,Ui=_t,Fi=Te,Ki=De,Zi=Math.max,Qi=g,Gi=Date.now;Yi=Qi?function(t,e){return Qi(t,"toString",{configurable:!0,enumerable:!1,value:(i=e,function(){return i}),writable:!0});var i}:Le,tn=$i=0;var Yi,$i,tn,en,nn=kt,sn=Ne,on=ze,rn=_t,an=function v(y,g,m,b,k){y!==g&&Ji(g,function(t,e){var i,n,s,o,r,a,h,l,u,c,d,f,p;k=k||new Xi,Ui(t)?(n=g,o=m,r=v,a=b,h=k,d=Vi(i=y,s=e),f=Vi(n,s),(p=h.get(f))?Ei(i,s,p):((n=void 0===(p=a?a(d,f,s+"",i,n,h):void 0))&&(u=!(l=ji(f))&&zi(f),c=!l&&!u&&Hi(f),p=f,l||u||c?p=ji(d)?d:Di(d)?Ii(d):u?_i(f,!(n=!1)):c?Bi(f,!(n=!1)):[]:Ri(f)||Ni(f)?Ni(p=d)?p=qi(d):Li(d)&&!Ti(d)||(p=Ai(f)):n=!1),n&&(h.set(f,p),r(p,f,o,a,h),h.delete(f)),Ei(i,s,p))):(l=b?b(Ki(y,e),t,e+"",y,g,k):void 0,Wi(y,e,l=void 0===l?t:l))},Fi)},hn=(en=function(t,e,i){an(t,e,i)},function(){var t=Gi(),e=16-(t-tn);if(tn=t,0<e){if(800<=++$i)return arguments[0]}else $i=0;return Yi.apply(void 0,arguments)}(function(h,l,u){return l=Zi(void 0===l?h.length-1:l,0),function(){for(var t=arguments,e=-1,i=Zi(t.length-l,0),n=Array(i);++e<i;)n[e]=t[l+e];for(var e=-1,s=Array(l+1);++e<l;)s[e]=t[e];s[l]=u(n);var o=h,r=this,a=s;switch(a.length){case 0:return o.call(r);case 1:return o.call(r,a[0]);case 2:return o.call(r,a[0],a[1]);case 3:return o.call(r,a[0],a[1],a[2])}return o.apply(r,a)}}(M=function(t,e){var i=-1,n=e.length,s=1<n?e[n-1]:void 0,o=2<n?e[2]:void 0,s=3<en.length&&"function"==typeof s?(n--,s):void 0;for(o&&function(t,e,i){if(!rn(i))return!1;var n=typeof e;return!!("number"==n?sn(i)&&on(e,i.length):"string"==n&&e in i)&&nn(i[e],t)}(e[0],e[1],o)&&(s=n<3?void 0:s,n=1),t=Object(t);++i<n;){var r=e[i];r&&en(t,r,i)}return t},E,Le),M+"")),O=(e(dn,[{key:"composedPath",value:function(){throw new Error("Method not implemented.")}},{key:"initEvent",value:function(t,e,i){throw new Error("Method not implemented.")}},{key:"preventDefault",value:function(){throw new Error("Method not implemented.")}},{key:"stopImmediatePropagation",value:function(){throw new Error("Method not implemented.")}},{key:"stopPropagation",value:function(){throw new Error("Method not implemented.")}}]),dn),c=_e(Object.keys,Object),ln=Be,un=c,cn=Object.prototype.hasOwnProperty;function dn(){var t,e,i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};for(t in s(this,dn),i)this[t]=i[t];for(e in n)this[e]=n[e]}var P=At(d,"DataView"),k=m,Pe=At(d,"Promise"),b=At(d,"Set"),g=At(d,"WeakMap"),fn=H,pn=It,vn=pn(P),yn=pn(k),gn=pn(Pe),mn=pn(b),bn=pn(g),E=fn,kn=((P&&"[object DataView]"!=E(new P(new ArrayBuffer(1)))||k&&"[object Map]"!=E(new k)||Pe&&"[object Promise]"!=E(Pe.resolve())||b&&"[object Set]"!=E(new b)||g&&"[object WeakMap]"!=E(new g))&&(E=function(t){var e=fn(t),t="[object Object]"==e?t.constructor:void 0,t=t?pn(t):"";if(t)switch(t){case vn:return"[object DataView]";case yn:return"[object Map]";case gn:return"[object Promise]";case mn:return"[object Set]";case bn:return"[object WeakMap]"}return e}),function(t){if(!ln(t))return un(t);var e,i=[];for(e in Object(t))cn.call(t,e)&&"constructor"!=e&&i.push(e);return i}),wn=E,xn=x,Cn=f,Pn=Ne,Sn=w.exports,Mn=Be,On=C,En=Object.prototype.hasOwnProperty,M=null,_=((M=window||global||{}).requestFrame=M.requestAnimationFrame||M.webkitRequestAnimationFrame||M.mozRequestAnimationFrame||M.oRequestAnimationFrame||M.msRequestAnimationFrame,M),c=(e(_n,[{key:"on",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:_;this.listeners[t]||(this.listeners[t]=[]),this.off(t,e,i),this.listeners[t].push({callback:e,scope:i})}},{key:"off",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:_;if(n=this.listeners[t])for(var n=u(n),s=0;s<n.length;s++){var o=n[s];if(o.callback===e&&o.scope===i)return void this.listeners[t].splice(s,1)}}},{key:"once",value:function(i,n){var s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:_,o=this;o.on(i,function t(e){o.off(i,t,s),n.call(s,e)},s)}},{key:"trigger",value:function(t){var e,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(function(t){if(null==t)return!0;if(Pn(t)&&(Cn(t)||"string"==typeof t||"function"==typeof t.splice||Sn(t)||On(t)||xn(t)))return!t.length;var e,i=wn(t);if("[object Map]"==i||"[object Set]"==i)return!t.size;if(Mn(t))return!kn(t).length;for(e in t)if(En.call(t,e))return!1;return!0}(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;i?((e=new O(i)).originalEvent=i.originalEvent||i,e.param=l({},n)):e=new O({type:t,timeStamp:Date.now(),param:l({},n)});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(t){t&&!this.suspendedEventNames.includes(t)&&this.suspendedEventNames.push(t)}},{key:"resume",value:function(e){this.suspendedEventNames.splice(this.suspendedEventNames.findIndex(function(t){return t===e}),1)}},{key:"purgeEvents",value:function(){this.listeners={},this.suspendedEventNames=[]}},{key:"hasListener",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:_;if(!this.listeners[t])return!1;var n=this.listeners[t];if(!n)return!1;for(var s=0;s<n.length;s++){var o=n[s];if(o.callback===e&&o.scope===i)return!0}return!1}}]),_n);function _n(){s(this,_n),n(this,"listeners",{}),n(this,"suspendedEventNames",[])}c.prototype.addEventListener=c.prototype.on,c.prototype.removeEventListener=c.prototype.off,c.prototype.dispatchEvent=c.prototype.trigger;e(Nn,[{key:"containsPoint",value:function(t){var e=this.getMinAndMaxPoint(),i=e.minX,n=e.minY,s=e.maxX,e=e.maxY;if(t[0]<i||t[0]>s||t[1]<n||t[1]>e)return!1;for(var o=0,r=this.getBoundingLines(),a=0;a<r.length;a++){var h,l=r[a];t[1]>l.o[1]&&t[1]>l.d[1]||t[1]<l.o[1]&&t[1]<l.d[1]||(l.o[0]===l.d[0]&&l.o[0]>=t[0]?l.o[0]:(h=(l.d[1]-l.o[1])/(l.d[0]-l.o[0]),l.o[0]+(t[1]-l.o[1])/h))>t[0]&&o++}return 0!==o&&o%2==1}},{key:"getBoundingLines",value:function(){return[{o:u(this.tl),d:u(this.tr)},{o:u(this.tr),d:u(this.br)},{o:u(this.br),d:u(this.bl)},{o:u(this.bl),d:u(this.tl)}]}},{key:"getMinAndMaxPoint",value:function(){for(var t=this.tl[0],e=this.tl[1],i=this.tl[0],n=this.tl[1],s=[this.tr,this.bl,this.br],o=0;o<s.length;o++){var r=s[o];r[0]<t&&(t=r[0]),r[0]>i&&(i=r[0]),r[1]<e&&(e=r[1]),r[1]>n&&(n=r[1])}return{minX:t,minY:e,maxX:i,maxY:n}}},{key:"containsBox",value:function(t){return!1}},{key:"isIntersect",value:function(t){var e=this.tl[0],i=this.br[0],n=this.tl[1],s=this.br[1],o=t.tl[0],r=t.br[0],a=t.tl[1],t=t.br[1];return!(r<e||t<n||i<o||s<a)}},{key:"transform",value:function(t){var e=y([],this.tl,t),i=y([],this.tr,t),n=y([],this.bl,t),s=y([],this.br,t),t=y([],this.center,t);return new Nn([].concat(u(e),u(i),u(n),u(s),u(t)))}},{key:"union",value:function(t){return null}},{key:"width",get:function(){var t=this.br[0]-this.bl[0],e=this.br[1]-this.bl[1];return Math.hypot(t,e)}},{key:"height",get:function(){var t=this.br[0]-this.tr[0],e=this.br[1]-this.tr[1];return Math.hypot(t,e)}},{key:"left",get:function(){return this.tl[0]},set:function(t){throw new Error("Can not set left to ICEBoundingBox directly.")}},{key:"top",get:function(){return this.tl[1]},set:function(t){throw new Error("Can not set top to ICEBoundingBox directly.")}},{key:"centerX",get:function(){return this.center[0]}},{key:"centerY",get:function(){return this.center[1]}},{key:"centerPoint",get:function(){return this.center}}],[{key:"fromDimension",value:function(t,e,i,n){return new Nn([].concat([t,e],[t+i,e],[t,e+n],[t+i,e+n],[t+i/2,e+n/2]))}}]);var Bn=Nn,In=(e(An,null,[{key:"calcRotateAngleFromMatrix",value:function(t){var e=0,i=t[0],t=t[1],n=Math.hypot(i,t),t=t/n,e=Math.acos(i/n);return t<0&&(e+=Math.PI/2),e*(180/Math.PI)}},{key:"calcScaleFromMatrix",value:function(t){var e=t[0],i=t[1],n=t[2],t=t[3];return[Math.hypot(e,i)/e,Math.hypot(n,t)/t]}}]),An);function An(){s(this,An)}function Nn(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[0,0,0,0,0,0,0,0,0,0];s(this,Nn),n(this,"tl",[0,0]),n(this,"tr",[0,0]),n(this,"bl",[0,0]),n(this,"br",[0,0]),n(this,"tc",[0,0]),n(this,"rc",[0,0]),n(this,"bc",[0,0]),n(this,"lc",[0,0]),n(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 jn(t,e){return e.split(".").reduce(function(t,e){return t[e]},t)}function Dn(t,e,i,n){for(var s=0<arguments.length&&void 0!==t?t:[],o=1<arguments.length&&void 0!==e?e:[],r=2<arguments.length&&void 0!==i?i:1,a=3<arguments.length&&void 0!==n?n:null,h=0;h<o.length;h++){var l=o[h];l._level=r,l._pid=a,s.push(l),Dn(s,l.childNodes||[],r+1,l.id)}return s}i(Tn,c),zn=a(Tn),e(Tn,[{key:"initEvents",value:function(){}},{key:"render",value:function(){this.trigger(et),this.state.display&&(this.calcComponentParams(),this.applyStyleToCtx(),this.applyTransformToCtx(),this.doRender(),this.trigger(it),this.dirty=!1)}},{key:"applyStyleToCtx",value:function(){var t,e=l(l({},this.props.style),this.state.style);for(t in e)this.ctx[t]=e[t]}},{key:"calcComponentParams",value:function(){return{width:this.state.width,height:this.state.height}}},{key:"calcLocalOrigin",value:function(){var t=[0,0],e=this.state.origin;return e&&"localCenter"!==e||(t[0]=this.state.width/2,t[1]=this.state.height/2),this.state.localOrigin=t}},{key:"calcAbsoluteOrigin",value:function(){var t=jn(this,"state.transform.translate.0")+this.state.left,e=jn(this,"state.transform.translate.1")+this.state.top,i=u(this.calcLocalOrigin());return i[0]+=t,i[1]+=e,this.parentNode&&(i=y([],i,[1,0,0,1,-this.parentNode.state.localOrigin[0],-this.parentNode.state.localOrigin[1]]),i=y([],i,this.parentNode.state.composedMatrix)),this.state.absoluteOrigin=i}},{key:"calcLinearMatrix",value:function(){h=new pt(6),pt!=Float32Array&&(h[1]=0,h[2]=0,h[4]=0,h[5]=0),h[0]=1,h[3]=1;var t,e,i,n,s,o,r,a,h,l=jn(this,"state.transform.skew.0"),u=jn(this,"state.transform.skew.1");return t=[],e=[],l=h=function(t,e,i,n){i=Math.tan(i),n=Math.tan(n);return t[0]=e[0],t[1]=e[1]+i,t[2]=e[2]+n,t[3]=e[3],t[4]=e[4],t[5]=e[5],t}([],h,l*vt,u*vt),u=gt(jn(this,"state.transform.rotate")),i=l[0],n=l[1],s=l[2],o=l[3],r=l[4],l=l[5],a=Math.sin(u),u=Math.cos(u),e[0]=i*u+s*a,e[1]=n*u+o*a,e[2]=i*-a+s*u,e[3]=n*-a+o*u,e[4]=r,e[5]=l,i=h=e,s=[jn(this,"state.transform.scale.0"),jn(this,"state.transform.scale.1")],n=i[0],a=i[1],o=i[2],u=i[3],r=i[4],i=i[5],l=s[0],s=s[1],t[0]=n*l,t[1]=a*l,t[2]=o*s,t[3]=u*s,t[4]=r,t[5]=i,h=t,this.state.linearMatrix=h}},{key:"calcAbsoluteLinearMatrix",value:function(){for(var t=this,e=t.calcLinearMatrix();t.parentNode;)e=bt([],t.parentNode.state.linearMatrix,e),t=t.parentNode;return this.state.absoluteLinearMatrix=e}},{key:"composeMatrix",value:function(){var t=this.calcAbsoluteOrigin(),t=bt([],[1,0,0,1,t[0],t[1]],this.calcAbsoluteLinearMatrix());return this.state.composedMatrix=t}},{key:"applyTransformToCtx",value:function(){var t,e=this.dirty?this.composeMatrix():this.state.composedMatrix;(t=this.ctx).setTransform.apply(t,u(e))}},{key:"doRender",value:function(){var t;this.ctx.setTransform(1,0,0,1,0,0),this.ctx.lineWidth=1,this.state.showMinBoundingBox&&(t=this.getMinBoundingBox(),this.ctx.strokeStyle="#ff0000",this.ctx.fillStyle="rgba(0,0,0,0)",this.ctx.beginPath(),this.ctx.moveTo(t.tl[0],t.tl[1]),this.ctx.lineTo(t.tr[0],t.tr[1]),this.ctx.lineTo(t.br[0],t.br[1]),this.ctx.lineTo(t.bl[0],t.bl[1]),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fill()),this.state.showMaxBoundingBox&&(t=this.getMaxBoundingBox(),this.ctx.strokeStyle="#0000ff",this.ctx.fillStyle="rgba(0,0,0,0)",this.ctx.beginPath(),this.ctx.moveTo(t.tl[0],t.tl[1]),this.ctx.lineTo(t.tr[0],t.tr[1]),this.ctx.lineTo(t.br[0],t.br[1]),this.ctx.lineTo(t.bl[0],t.bl[1]),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fill())}},{key:"getMinBoundingBox",value:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=this.state.localOrigin[0],i=this.state.localOrigin[1],n=this.state.width,s=this.state.height,e=new Bn([0-e,0-i,0-e+n,0-i,0-e,0-i+s,0-e+n,0-i+s,0,0]),n=t?this.composeMatrix():this.state.composedMatrix;return e.transform(n)}},{key:"getMaxBoundingBox",value:function(){var t=this.getMinBoundingBox(0<arguments.length&&void 0!==arguments[0]&&arguments[0]),e=t.getMinAndMaxPoint(),i=e.minX,n=e.minY,s=e.maxX,e=e.maxY,t=t.centerPoint;return new Bn([i,n,s,n,i,e,s,e,t[0],t[1]])}},{key:"setState",value:function(t){hn(this.state,t),this.dirty=!0,this.ice&&(this.ice.dirty=!0)}},{key:"dirty",get:function(){return this.__dirty},set:function(t){this.__dirty=t}},{key:"setPosition",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new O;this.trigger("BEFORE_MOVE",l(l({},i),{},{left:t,top:e})),this.setState({left:t,top:e}),this.trigger(v,l(l({},i),{},{left:t,top:e}))}},{key:"moveGlobalPosition",value:function(t,e){var i,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new O;this.parentNode&&(t=(i=y([],[t,e],mt([],this.parentNode.state.absoluteLinearMatrix)))[0],e=i[1]),this.setPosition(this.state.left+t,this.state.top+e,l(l({},n),{},{tx:t,ty:e}))}},{key:"setGlobalPosition",value:function(t,e){var i,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new O;this.parentNode&&(t=(i=y([],[t,e],mt([],this.parentNode.state.absoluteLinearMatrix)))[0],e=i[1]),this.setPosition(t,e,l(l({},n),{},{left:t,top:e}))}},{key:"setGlobalRotate",value:function(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteLinearMatrix,t-=In.calcRotateAngleFromMatrix(e)),this.setState({transform:{rotate:t}})}},{key:"localToGlobal",value:function(t,e){t=[t,e];return y([],t,this.state.composedMatrix)}},{key:"globalToLocal",value:function(t,e){t=[t,e];return y([],t,mt([],this.state.composedMatrix))}},{key:"getRotateAngle",value:function(){return this.state.transform.rotate}},{key:"getLocalLeftTop",value:function(){var t=this.getMinBoundingBox(!0),e=t.width,i=t.height;return{left:t.centerX-t.width/2,top:t.centerY-t.height/2,width:e,height:i}}},{key:"containsPoint",value:function(t,e){return this.getMinBoundingBox().containsPoint([t,e])}},{key:"destory",value:function(){this.trigger(ot,null,{component:this}),this.purgeEvents(),this.ice=null,this.ctx=null,this.root=null,this.evtBus=null,this.parentNode=null}}]);var zn,m=Tn;function Tn(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,Tn),n(o(t=zn.call(this)),"__typeName","ICEComponent"),n(o(t),"__dirty",!0),n(o(t),"props",{id:"ICE_"+function(){if(_.crypto)return _.crypto.randomUUID();var i=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(i+16*Math.random())%16|0;return i=Math.floor(i/16),("x"==t?e:3&e|8).toString(16)})}(),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:Tn.instanceCounter++,display:!0,draggable:!0,transformable:!0,interactive:!0,linkable:!0,showMinBoundingBox:!1,showMaxBoundingBox:!1}),n(o(t),"state",l({},t.props)),t.props=hn(t.props,e),t.state=JSON.parse(JSON.stringify(t.props)),t.initEvents(),t}n(m,"instanceCounter",0);i(Jn,m),Vn=a(Jn),e(Jn,[{key:"doRender",value:function(){this.dirty&&(this.ctx.beginPath(),this.createPathObject()),this.state.closePath&&this.path2D.closePath(),this.state.fill&&this.ctx.fill(this.path2D),this.state.stroke&&this.ctx.stroke(this.path2D),h(r(Jn.prototype),"doRender",this).call(this)}}]);var Ln,Rn,Hn,Vn,P=Jn,k=(i(Wn,P),Hn=a(Wn),e(Wn,[{key:"createPathObject",value:function(){return this.path2D=new Path2D,this.path2D.rect(0-this.state.localOrigin[0],0-this.state.localOrigin[1],this.state.width,this.state.height),this.path2D}}]),Wn),Pe=(i(Xn,k),Rn=a(Xn),e(Xn,[{key:"addChild",value:function(t){t.trigger(nt),(t.parentNode=this).childNodes.push(t),t.trigger(st)}},{key:"addChildren",value:function(t){for(var e=0;e<t.length;e++){var i=t[e];this.addChild(i)}}},{key:"removeChild",value:function(t){t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1)}},{key:"removeChildren",value:function(t){for(var e=0;e<t.length;e++){var i=t[e];this.removeChild(i)}}},{key:"destory",value:function(){this.removeChildren(this.childNodes),h(r(Xn.prototype),"destory",this).call(this)}}]),Xn),b=(i(qn,Pe),Ln=a(qn),e(qn,[{key:"doRender",value:function(){h(r(qn.prototype),"doRender",this).call(this),this.setControlPositions()}},{key:"moveGlobalPosition",value:function(t,e,i){h(r(qn.prototype),"moveGlobalPosition",this).call(this,t,e,i),this._targetComponent&&this._targetComponent.moveGlobalPosition(t,e,i)}}]),qn);function qn(t){return s(this,qn),n(o(t=Ln.call(this,l(l({},t),{},{linkable:!1}))),"__typeName","ICEControlPanel"),t}function Xn(t){return s(this,Xn),n(o(t=Rn.call(this,t)),"parentNode",null),n(o(t),"childNodes",[]),t}function Wn(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,Wn),Hn.call(this,l({width:10,height:10},t))}function Jn(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,Jn),n(o(t=Vn.call(this,l({closePath:!0},t))),"path2D",new Path2D),t}function B(t){return null==t}i(is,P),Zn=a(is),e(is,[{key:"createPathObject",value:function(){return this.path2D=new Path2D,this.path2D.ellipse(this.state.radiusX-this.state.localOrigin[0],this.state.radiusY-this.state.localOrigin[1],this.state.radiusX,this.state.radiusY,this.state.rotation,this.state.startAngle,this.state.endAngle,this.state.counterclockwise),this.path2D.closePath(),this.path2D}},{key:"setState",value:function(t){B(t.radiusX)?B(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,B(t.radiusY)?B(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,h(r(is.prototype),"setState",this).call(this,t)}}]);var Un,Fn,Kn,Zn,g=is,E=(i(es,g),Kn=a(es),e(es)),Qn=(i(ts,E),Fn=a(ts),e(ts,[{key:"initEvents",value:function(){h(r(ts.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(v,this.resizeEvtHandler,this)}},{key:"mosueDownHandler",value:function(t){this.evtBus.trigger(at,new O({target:this}))}},{key:"mosueMoveHandler",value:function(t){this.evtBus.trigger(ht,new O({target:this}))}},{key:"mosueUpHandler",value:function(t){this.evtBus.trigger(lt,new O({target:this}))}},{key:"resizeEvtHandler",value:function(t){var e;this.parentNode&&(e=this.props.position,this.parentNode.trigger(ut,new O(t,{position:e})),this.parentNode.trigger(p,new O(t,{position:e})))}}]),ts),Gn=(i($n,b),Un=a($n),e($n,[{key:"initControls",value:function(){var t=this.state.width,e=this.state.height,i=this.controlSize/2;this.startControl=new Qn({zIndex:10000011,display:!1,left:-i,top:-i,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"start"}),this.addChild(this.startControl),this.endControl=new Qn({zIndex:10000012,display:!1,left:t-i,top:e-i,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"end"}),this.addChild(this.endControl)}},{key:"initEvents",value:function(){this.on(p,this.resizeEvtHandler,this)}},{key:"enable",value:function(){this.setState({display:!0}),this.resume(p),this.showHooks()}},{key:"disable",value:function(){this.setState({display:!1}),this.suspend(p),this.hideHooks()}},{key:"setControlPositions",value:function(){}},{key:"resizeEvtHandler",value:function(t){if(this.targetComponent){var e=t.position,i=t.movementX,n=t.movementY,t=this.targetComponent.state,s=t.points.length,o=t.points[0][0],r=t.points[0][1],a=t.points[s-1][0],h=t.points[s-1][1],s=y([],[i,n],mt([],t.absoluteLinearMatrix)),i=s[0],n=s[1];switch(e){case"start":o+=i,r+=n;break;case"end":a+=i,h+=n}this.targetComponent.setState({startPoint:[o,r],endPoint:[a,h]})}}},{key:"updatePosition",value:function(){var t,e,i;this.targetComponent&&(this.setState({left:0,top:-5,width:3,height:3,transform:{translate:[0,0],scale:[1,1],skew:[0,0],rotate:0}}),t=this.controlSize/2,i=this.targetComponent.state.points.length,e=this.targetComponent.state.points[0],i=this.targetComponent.state.points[i-1],e=[e[0],e[1]],i=[i[0],i[1]],this.startControl.setState({left:e[0]-t,top:e[1]-t}),this.endControl.setState({left:i[0]-t,top:i[1]-t}))}},{key:"targetComponent",get:function(){return this._targetComponent},set:function(t){var e=this;this._targetComponent&&this._targetComponent.off(v,this.updatePosition,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(v,this.updatePosition,this),this._targetComponent&&this._targetComponent.once(ot,function(){e.targetComponent=null,e.disable()},this),this.updatePosition()}},{key:"showHooks",value:function(){this.startControl.setState({display:!0}),this.endControl.setState({display:!0})}},{key:"hideHooks",value:function(){this.startControl.setState({display:!1}),this.endControl.setState({display:!1})}}]),$n),Yn=/\s/;function $n(t){return s(this,$n),n(o(t=Un.call(this,l(l({},t),{},{zIndex:10000010,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"controlSize",16),t.initControls(),t}function ts(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,ts),Fn.call(this,l({linkable:!1},t))}function es(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,es),l({radius:10},t));return t.radiusX=t.radius,t.radiusY=t.radius,Kn.call(this,t)}function is(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,is),l({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,Zn.call(this,t)}function ns(t){return"symbol"==typeof t||Ss(t)&&"[object Symbol]"==Ps(t)}function ss(t){if("number"==typeof t)return t;if(Os(t))return NaN;var e;if(Ms(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=Ms(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=(e=t)&&e.slice(0,xs(e)+1).replace(Cs,"");var i=_s.test(t);return i||Bs.test(t)?Is(t.slice(2),i?2:8):Es.test(t)?NaN:+t}function os(t){if("string"==typeof t)return t;if(js(t))return Ns(t,os)+"";if(Ds(t))return zs?zs.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function rs(t){return null==t?"":os(t)}var as,hs,ls,us,cs,ds,fs,ps,vs,ys,gs,ms,bs,ks,ws,xs=function(t){for(var e=t.length;e--&&Yn.test(t.charAt(e)););return e},Cs=/^\s+/,Ps=H,Ss=V,Ms=_t,Os=ns,Es=/^[-+]0x[0-9a-f]+$/i,_s=/^0b[01]+$/i,Bs=/^0o[0-7]+$/i,Is=parseInt,As=ss,Ns=function(t,e){for(var i=-1,n=null==t?0:t.length,s=Array(n);++i<n;)s[i]=e(t[i],i,t);return s},js=f,Ds=ns,x=W?W.prototype:void 0,zs=x?x.toString:void 0,Ts=function(t){var t=(t=t)?(t=As(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0,e=t%1;return t==t?e?t-e:t:0},Ls=ss,Rs=d.isFinite,Hs=Math.min,I=(ws=Math.round,function(t,e){var i,n;return t=Ls(t),(e=null==e?0:Hs(Ts(e),292))&&Rs(t)?(i=(rs(t)+"e").split("e"),n=ws(i[0]+"e"+(+i[1]+e)),+((i=(rs(n)+"e").split("e"))[0]+"e"+(+i[1]-e))):ws(t)}),Vs=(i(_o,k),ks=a(_o),e(_o,[{key:"initEvents",value:function(){h(r(_o.prototype),"initEvents",this).call(this),this.on(v,this.resizeEvtHandler,this)}},{key:"resizeEvtHandler",value:function(t){if(this.parentNode){var e=t.quadrant,i=t.movementX,n=t.movementY,s=this.parentNode.state,o=s.left,r=s.top,a=s.width,h=s.height,s=y([],[i,n],mt([],s.absoluteLinearMatrix)),i=s[0],n=s[1];switch(e){case 1:o-=i,r+=n,a+=2*i,h-=2*n;break;case 2:o+=i,r+=n,a-=2*i,h-=2*n;break;case 3:o+=i,r-=n,a-=2*i,h+=2*n;break;case 4:o-=i,r-=n,a+=2*i,h+=2*n;break;case 5:r+=n,h-=2*n;break;case 6:r-=n,h+=2*n;break;case 7:o+=i,a-=2*i;break;case 8:o-=i,a+=2*i}s={top:r,left:o,width:Math.abs(a),height:Math.abs(h)};this.parentNode.trigger(ut,new O(t,{quadrant:e})),this.parentNode.setState(s),this.parentNode.trigger(p,new O(t,{quadrant:e}))}}},{key:"moveGlobalPosition",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new O,n=0<t?1:-1,s=0<e?1:-1,o=this.parentNode.state,r=o.localOrigin,a=o.width,h=o.height,o=y([],[t,e],mt([],o.absoluteLinearMatrix)),o=(t=o[0],e=o[1],this.state),l=o.left,u=o.top,o=o.quadrant,c=this.state.width/2,d=0;"x"===this.state.direction?d=0<(l=0===I(l+=t)?.5*n:l)+c-r[0]?8:7:"y"===this.state.direction?d=0<(u=0===I(u+=e)?.5*s:u)+c-r[1]?6:5:"xy"===this.state.direction&&(s=-h/2/(s=0===I(s=-a/2)?.5*n:s),0===I(a=a/2)&&(a=.5*n),u+=e=2===o||4==o?s*(l+c-r[0]+t)-(u+c-r[1]):-h/2/a*(l+c-r[0]+t)-(u+c-r[1]),d=0<(l+=t)+c-r[0]?0<u+c-r[1]?4:1:0<u+c-r[1]?3:2),o!==d&&this.parentNode.toggleControlQuadrant(this,d),this.setPosition(l,u,new O(i,{left:l,top:u,tx:t,ty:e,quadrant:d}))}}]),_o),qs=(e(Eo,null,[{key:"calcRotateAngle",value:function(t,e,i,n){t-=i,i=e-n,e=Math.hypot(t,i);return((i/e<0?-1:1)*Math.acos(t/e)*180/Math.PI+360)%360}}]),Eo),Xs=(i(Oo,E),bs=a(Oo),e(Oo,[{key:"initEvents",value:function(){h(r(Oo.prototype),"initEvents",this).call(this),this.on(v,this.rotateEvtHandler,this)}},{key:"rotateEvtHandler",value:function(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteOrigin,t={transform:{rotate:qs.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90}},this.parentNode.trigger("BEFORE_ROTATE",new O(t)),this.parentNode.setState(t),this.parentNode.trigger(ct,new O(t)))}}]),Oo),Ws=(i(Mo,b),ms=a(Mo),e(Mo,[{key:"initControls",value:function(){var t=this.state.width,e=this.state.height,i=t/2,n=e/2,s=this.resizeControlSize/2,o=[{direction:"xy",quadrant:2,position:[-s,-s]},{direction:"y",quadrant:5,position:[i-s,-s]},{direction:"xy",quadrant:1,position:[t-s,-s]},{direction:"x",quadrant:8,position:[t-s,n-s]},{direction:"xy",quadrant:4,position:[t-s,e-s]},{direction:"y",quadrant:6,position:[i-s,e-s]},{direction:"xy",quadrant:3,position:[-s,e-s]},{direction:"x",quadrant:7,position:[-s,n-s]}];this.resizeControlInstanceCache=[];for(var r=0;r<o.length;r++){var a=o[r],a=new Vs({zIndex:10000002,display:!1,left:a.position[0],top:a.position[1],width:this.resizeControlSize,height:this.resizeControlSize,style:{strokeStyle:"#8b0000",fillStyle:"#CC3300",lineWidth:1},direction:a.direction,quadrant:a.quadrant});this.addChild(a),this.resizeControlInstanceCache.push(a)}t=this.state.width/2-this.rotateControlSize,i=-this.rotateControlffsetY;this.rotateControlInstance=new Xs({zIndex:10000003,display:!1,left:t,top:i,radius:this.rotateControlSize,style:{strokeStyle:"#8b0000",fillStyle:"#CC3300",lineWidth:1}}),this.addChild(this.rotateControlInstance)}},{key:"initEvents",value:function(){h(r(Mo.prototype),"initEvents",this).call(this),this.on(p,this.resizeEvtHandler,this),this.on(ct,this.rotateEvtHandler,this)}},{key:"enable",value:function(){this.rotateControlInstance.setState({display:!0});for(var t=0;t<this.resizeControlInstanceCache.length;t++)this.resizeControlInstanceCache[t].setState({display:!0});this.setState({display:!0}),this.resume(p),this.resume(ct)}},{key:"disable",value:function(){this.rotateControlInstance.setState({display:!1});for(var t=0;t<this.resizeControlInstanceCache.length;t++)this.resizeControlInstanceCache[t].setState({display:!1});this.setState({display:!1}),this.suspend(p),this.suspend(ct)}},{key:"setControlPositions",value:function(){for(var t=this.state.width,e=this.state.height,i=t/2,n=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=[i-s,-s];break;case 6:a=[i-s,e-s];break;case 7:a=[-s,n-s];break;case 8:a=[t-s,n-s]}r.setState({left:a[0],top:a[1]})}var h=this.state.width/2-this.rotateControlSize,l=-this.rotateControlffsetY;this.rotateControlInstance.setState({left:h,top:l})}},{key:"rotateEvtHandler",value:function(t){var e;this.targetComponent&&(e=this.state.transform.rotate,this.targetComponent.setGlobalRotate(e),this.targetComponent.trigger(ct))}},{key:"resizeEvtHandler",value:function(t){if(this.targetComponent){var e=t.quadrant,i=t.movementX,n=t.movementY,t=this.targetComponent.state,s=t.left,o=t.top,r=t.width,a=t.height,t=y([],[i,n],mt([],t.absoluteLinearMatrix)),i=t[0],n=t[1];switch(e){case 1:s-=i,o+=n,r+=2*i,a-=2*n;break;case 2:s+=i,o+=n,r-=2*i,a-=2*n;break;case 3:s+=i,o-=n,r-=2*i,a+=2*n;break;case 4:s-=i,o-=n,r+=2*i,a+=2*n;break;case 5:o+=n,a-=2*n;break;case 6:o-=n,a+=2*n;break;case 7:s+=i,r-=2*i;break;case 8:s-=i,r+=2*i}this.targetComponent.setState({left:s,top:o,width:Math.abs(r),height:Math.abs(a)}),this.targetComponent.trigger(p)}}},{key:"updatePanel",value:function(){var t,e,i,n,s;this.targetComponent&&(t=this.targetComponent.getRotateAngle(),e=(s=this.targetComponent.getLocalLeftTop()).left,i=s.top,n=s.width,s=s.height,this.setState({left:e,top:i,width:n,height:s,transform:{rotate:t}}))}},{key:"targetComponent",get:function(){return this._targetComponent},set:function(t){var e=this;this._targetComponent&&this._targetComponent.off(v,this.updatePanel,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(v,this.updatePanel,this),this._targetComponent&&this._targetComponent.once(ot,function(){e.targetComponent=null,e.disable()},this),this.updatePanel()}},{key:"toggleControlQuadrant",value:function(t,e){for(var i=0;i<this.resizeControlInstanceCache.length;i++){var n=this.resizeControlInstanceCache[i];if(n.state.quadrant===e){var s=0;switch(e){case 1:s=3;break;case 2:s=4;break;case 3:s=1;break;case 4:s=2;break;case 5:s=6;break;case 6:s=5;break;case 7:s=8;break;case 8:s=7}n.setState({quadrant:s})}}t.setState({quadrant:e})}}]),Mo),Js=(e(So,[{key:"start",value:function(){return this.ice.evtBus.on("mousedown",this.mouseDownHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off("mousedown",this.mouseDownHandler,this),this}},{key:"mouseDownHandler",value:function(t){t=t.target;if(!t.ice||!t.state.interactive||!t.state.transformable)return this.lineControlPanel.disable(),void this.transformControlPanel.disable();t&&("ICEControlPanel"===t.__typeName||"ICEControlPanel"===t.parentNode.__typeName)||(this.ice.selectionList=[t],this.lineControlPanel.disable(),this.transformControlPanel.disable(),"ICEPolyline"===t.__typeName?(this.lineControlPanel.targetComponent=t,this.lineControlPanel.enable()):(this.transformControlPanel.targetComponent=t,this.transformControlPanel.enable()))}}]),So),Us=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dbclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],Fs=(e(Po,[{key:"start",value:function(){for(var n=this,s=null,t=0;t<Us.length;t++)!function(t){var t=Us[t],e=t[1],i=t[0];n.ice.evtBus.on(e,function(t){n._stopped||((s="ICE_MOUSEMOVE"!==e?n.findTargetComponent(t):s)&&(t.target=s).trigger(i,t),n.ice.evtBus.trigger(i,t))})}(t);return this}},{key:"stopped",get:function(){return this._stopped},set:function(t){this._stopped=t}},{key:"findTargetComponent",value:function(t){if(this._stopped)return null;var e=t.offsetX,i=t.offsetY,t=Dn([],this.ice.toolNodes),n=Dn([],this.ice.childNodes),s=[].concat(u(t),u(n));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,h=a.interactive,a=a.display;r.containsPoint(e,i)&&h&&a&&this.selectionCandidates.push(r)}t=this.selectionCandidates.pop();return this.selectionCandidates=[],t}}]),Po),Ks=(i(Co,c),gs=a(Co),e(Co)),Zs=(e(xo,[{key:"contains",value:function(t,e){var i=Math.hypot(this.endPoint.x-this.startPoint.x,this.endPoint.y-this.startPoint.y),n=Math.hypot(t-this.startPoint.x,e-this.startPoint.y),t=Math.hypot(t-this.endPoint.x,e-this.endPoint.y);return i-3<=n+t&&n+t<=i+3}}]),xo),A=(e(wo,[{key:"equals",value:function(t){return this.x==t.x&&this.y==t.y}},{key:"clone",value:function(){return new wo(this.x,this.y)}}],[{key:"load",value:function(t){return new wo(Number(t.x),Number(t.y))}},{key:"cloneArray",value:function(t){for(var e=[],i=0;i<t.length;i++)e.push(t[i].clone());return e}}]),wo),w=(i(ko,P),ys=a(ko),e(ko,[{key:"calcComponentParams",value:function(){if(!this.dirty)return{width:this.state.width,height:this.state.height};this.calcDots();var t=this.calc4VertexPoints(),e=Math.abs(t[1][0]-t[0][0]),t=Math.abs(t[2][1]-t[0][1]);return this.state.width=e,this.state.height=t,{width:this.state.width,height:this.state.height}}},{key:"calcLocalOrigin",value:function(){for(var t=h(r(ko.prototype),"calcLocalOrigin",this).call(this),e=0;e<this.state.dots.length;e++){var i=y([],this.state.dots[e],[1,0,0,1,-t[0],-t[1]]);this.state.dots[e]=i}return t}},{key:"createPathObject",value:function(){this.path2D=new Path2D,this.path2D.moveTo(this.state.dots[0][0],this.state.dots[0][1]);for(var t=1;t<this.state.dots.length;t++){var e=this.state.dots[t];this.path2D.lineTo(e[0],e[1])}return this.path2D}},{key:"calcDots",value:function(){return this.state.dots=[],this.state.dots}},{key:"calc4VertexPoints",value:function(){for(var t=this.state.dots[0][0],e=this.state.dots[0][1],i=this.state.dots[0][0],n=this.state.dots[0][1],s=1;s<this.state.dots.length;s++){var o=this.state.dots[s];o[0]<t&&(t=o[0]),o[0]>i&&(i=o[0]),o[1]<e&&(e=o[1]),o[1]>n&&(n=o[1])}return[[t,e],[i,e],[t,n],[i,n]]}},{key:"getTransformedDots",value:function(){for(var t=this.state.composedMatrix,e=this.state.dots,i=[],n=0;n<e.length;n++){var s=y([],e[n],t);i.push(s)}return i}}]),ko),C=(i(bo,m),vs=a(bo),e(bo,[{key:"doRender",value:function(){var t,e;this.state.src&&(t=(e=this.ice.imageCache.setImage(this.state.src)).loaded,e=e.image,t&&this.ctx.drawImage(e,0-this.state.localOrigin[0],0-this.state.localOrigin[1],this.state.width,this.state.height)),h(r(bo.prototype),"doRender",this).call(this)}}]),bo),M=e(function t(){s(this,t)}),f=(i(D,w),ps=a(D),e(D,[{key:"initEvents",value:function(){h(r(D.prototype),"initEvents",this).call(this),this.once(st,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function(t){this.evtBus.once(rt,this.makeConnection,this)}},{key:"makeConnection",value:function(){var t,e,i=this.props.links;i&&(i.start&&(t=i.start.id,e=i.start.position,t&&e&&(t=this.ice.findComponent(t),this.setLink("start",t,e))),i.end&&(t=i.end.id,e=i.end.position,t&&e&&(i=this.ice.findComponent(t),this.setLink("end",i,e)))),this.ice.dirty=!0}},{key:"setLink",value:function(t,e,i){this.removeLink(t,e,i),this.links[t]={component:e,position:i},e.on(v,this.followComponent,this),e.on(p,this.followComponent,this),e.on(ct,this.followComponent,this),e.once(it,this.followComponent,this),this.followComponent();var n,s={};for(n in this.links){var o=this.links[n];o.component&&o.position&&(s[n]={id:o.component.props.id,position:o.position})}this.setState({links:l({},s),draggable:!1})}},{key:"removeLink",value:function(t,e,i){var n=this.links[t].component,s=this.links[t].position;n===e&&s===i&&(n&&n.off(v,this.followComponent,this),n&&n.off(p,this.followComponent,this),n&&n.off(ct,this.followComponent,this),this.links[t]={},this.state.links[t]={}),this.links.start.component||this.links.end.component||this.setState({draggable:!0})}},{key:"followComponent",value:function(t){for(var e in this.links){var i=this.links[e].position,n=this.links[e].component;if(i&&n){var s=n.getMinBoundingBox(),o=[0,0];switch(i){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:u(o)});break;case"end":this.setState({endPoint:u(o)})}}}}},{key:"calcLocalOrigin",value:function(){var t=[0,0];return this.state.localOrigin=t}},{key:"calcDots",value:function(){var t=this.state.left,e=this.state.top;this.state.dots=[];for(var i=0;i<this.state.points.length;i++){var n=this.state.points[i],s=n[0]-t,n=n[1]-e;this.state.dots.push([s,n])}return this.calcArrowPoints(),this.state.dots}},{key:"calcArrowPoints",value:function(){var t,e,i;"start"!==this.state.arrowPosition&&"both"!==this.state.arrowPosition||(i=u(this.state.dots[0]),e=[u(this.state.dots[0]),u(this.state.dots[1])],e=this.doCalcArrowPoints(e),(t=this.state.dots).unshift.apply(t,u(e)),this.state.dots.unshift(u(i))),"end"!==this.state.arrowPosition&&"both"!==this.state.arrowPosition||(t=this.state.dots.length,e=u(this.state.dots[t-1]),i=[u(this.state.dots[t-1]),u(this.state.dots[t-2])],i=this.doCalcArrowPoints(i),(t=this.state.dots).push.apply(t,u(i)),this.state.dots.push(u(e)))}},{key:"doCalcArrowPoints",value:function(t){var e=t[0],t=t[1],i=(t[0]=t[0]-e[0],t[1]=t[1]-e[1],t[0]/Math.hypot.apply(Math,u(t))),t=t[1]/Math.hypot.apply(Math,u(t)),n=Math.cos(this.state.arrowAngel),s=Math.sin(this.state.arrowAngel),o=this.state.arrowLength*(i*n-t*s),r=this.state.arrowLength*(t*n+i*s),a=this.state.arrowLength*(i*n+t*s),t=this.state.arrowLength*(t*n-i*s);return[[o+=e[0],r+=e[1]],[a+=e[0],t+=e[1]]]}},{key:"addDot",value:function(t,e){this.state.points.splice(e,0,t),this.state.dots.splice(e,0,[t[0],t[1]])}},{key:"rmDot",value:function(t){return!(this.state.points.length<3||(this.state.points.splice(t,1),this.state.dots.splice(t,1),0))}},{key:"calcComponentParams",value:function(){if(!this.dirty)return{width:this.state.width,height:this.state.height};this.calcDots();var t=this.calc4VertexPoints(),e=Math.abs(t[1][0]-t[0][0]),i=this.state.style.lineWidth;return this.isDotsOnSameLine()||(i=Math.abs(t[2][1]-t[0][1])),this.state.width=e,this.state.height=i,{width:this.state.width,height:this.state.height}}},{key:"isDotsOnSameLine",value:function(){for(var t,e,i=this.state.points.length,n=I(this.state.points[0][0],2),s=I(this.state.points[0][1],2),o=0,r=[I(this.state.points[i-1][0],2)-n,I(this.state.points[i-1][1],2)-s],a=0;a<i;a++){var h=this.state.points[a];0===(t=[],e=r,h=[h[0]-n,h[1]-s],e=r[0]*h[1]-r[1]*h[0],t[0]=t[1]=0,t[2]=e,t[2])&&o++}return o===i}},{key:"calc4VertexPoints",value:function(){return this.isDotsOnSameLine()?this.splitEndpointsTo4Points():h(r(D.prototype),"calc4VertexPoints",this).call(this)}},{key:"splitEndpointsTo4Points",value:function(){var t=this.state.points.length,e=this.state.points[t-1][0]-this.state.points[0][0],t=this.state.points[t-1][1]-this.state.points[0][1],i=this.getRotateAngle(),n=this.state.height,s=Math.cos(i*Math.PI/180)*n/2,i=Math.sin(i*Math.PI/180)*n/2;return[[0+(s=I(s,3)),0+(i=I(i,3))],[0-s,0-i],[e+s,t+i],[e-s,t-i]]}},{key:"getMinBoundingBox",value:function(){var t=this.state.localOrigin[0],e=this.state.localOrigin[1],i=this.calc4VertexPoints(),t=new Bn([i[0][0]-t,i[0][1]-e,i[1][0]-t,i[1][1]-e,i[2][0]-t,i[2][1]-e,i[3][0]-t,i[3][1]-e,0,0]);return t.transform(this.state.composedMatrix)}},{key:"setState",value:function(t){if(B(t.width)||delete t.width,B(t.height)||delete t.height,B(t.transform)||delete t.transform,!B(t.left))for(var e=t.left-this.state.points[0][0],i=0;i<this.state.points.length;i++)this.state.points[i][0]+=e;if(!B(t.top))for(var n=t.top-this.state.points[0][1],s=0;s<this.state.points.length;s++)this.state.points[s][1]+=n;var o;B(t.startPoint)||(this.state.points[0]=u(t.startPoint),this.state.left=this.state.points[0][0],this.state.top=this.state.points[0][1]),B(t.endPoint)||(o=this.state.points.length,this.state.points[o-1]=u(t.endPoint)),h(r(D.prototype),"setState",this).call(this,t)}},{key:"getRotateAngle",value:function(){var t,e;return this.isDotsOnSameLine()?(e=this.state.points.length,t=this.state.points[e-1][0]-this.state.points[0][0],e=this.state.points[e-1][1]-this.state.points[0][1],qs.calcRotateAngle(t,e,0,0)+90):h(r(D.prototype),"getRotateAngle",this).call(this)}},{key:"containsPoint",value:function(t,e){for(var i=this.getLines(),n=0;n<i.length;n++){var s=i[n],o=s.o[0],r=s.o[1],a=s.d[0],s=s.d[1],h=Math.hypot(a-o,s-r),o=Math.hypot(o-t,r-e),r=Math.hypot(a-t,s-e);if(h-3<=o+r&&o+r<=h+3)return!0}return!1}},{key:"getLines",value:function(){var t=[],e=this.getTransformedDots();if(!e||e.length<2)return t;for(var i=0;i<e.length-1;i++){var n={o:[e[i][0],e[i][1]],d:[e[i+1][0],e[i+1][1]]};t.push(n)}return t}}],[{key:"arrangeParam",value:function(t){var e=hn({},{lineType:"solid",lineWidth:1,arrowPosition:"both",arrowLength:15,arrowAngel:30*vt,points:[],showMinBoundingBox:!1,showMaxBoundingBox:!1,links:{},style:{lineJoin:"round"}},t,{linkable:!1,closePath:!1,fill:!1}),i=e.points.length;return i<2&&(0===i?(e.points.push([0,0]),e.points.push([10,10])):1===i&&e.points.push([10,10])),(e=l(l({},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}}]),D),Qs=(i(mo,E),fs=a(mo),e(mo,[{key:"initEvents",value:function(){h(r(mo.prototype),"initEvents",this).call(this),this.once(et,this.beforeRenderHandler,this),this.once(ot,this.beforeRemoveHandler,this)}},{key:"beforeRenderHandler",value:function(t){this.evtBus.on(at,this.hookMouseDownHandler,this),this.evtBus.on(ht,this.hookMouseMoveHandler,this),this.evtBus.on(lt,this.hookMouseUpHandler,this),this.evtBus.on("mouseup",this.globalMouseUpHandler,this)}},{key:"beforeRemoveHandler",value:function(t){this.evtBus.off(at,this.hookMouseDownHandler,this),this.evtBus.off(ht,this.hookMouseMoveHandler,this),this.evtBus.off(lt,this.hookMouseUpHandler,this),this.evtBus.off("mouseup",this.globalMouseUpHandler,this),this._hostComponent=null}},{key:"globalMouseUpHandler",value:function(){this.setState({display:!1})}},{key:"hookMouseDownHandler",value:function(t){console.log("linkslot, hook mousedown event..."),this._hostComponent&&this.setState({display:!0})}},{key:"hookMouseMoveHandler",value:function(t){t=t.target;this.isIntersectWithHook(t)?(this.setState({style:{fillStyle:"#fffb00"}}),t._currentAboveSlot=this,t.setState({style:{fillStyle:"#fffb00"}})):(this.setState({style:{fillStyle:"#3ce92c"}}),t._currentAboveSlot===this&&t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"hookMouseUpHandler",value:function(t){var e,i;this._hostComponent&&(e=(t=t.target).parentNode.targetComponent,i=t.state.position,this.isIntersectWithHook(t)?e&&e.setLink(i,this._hostComponent,this.props.position):e&&e.removeLink(i,this._hostComponent,this.props.position),this.setState({display:!1,style:{fillStyle:"#3ce92c"}}),t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"isIntersectWithHook",value:function(t){var e=this.getMaxBoundingBox(),t=t.getMaxBoundingBox();return!!e.isIntersect(t)}},{key:"updatePosition",value:function(){console.log("link slot update position ...");var t=this._hostComponent.getMinBoundingBox(),e=0,i=0;switch(this.state.position){case"T":e=t.tc[0]-this.state.radius,i=t.tc[1]-this.state.radius;break;case"R":e=t.rc[0]-this.state.radius,i=t.rc[1]-this.state.radius;break;case"B":e=t.bc[0]-this.state.radius,i=t.bc[1]-this.state.radius;break;case"L":e=t.lc[0]-this.state.radius,i=t.lc[1]-this.state.radius}this.setState({left:e,top:i})}},{key:"hostComponent",get:function(){return this._hostComponent},set:function(t){var e=this;this._hostComponent&&this._hostComponent.off(it,this.updatePosition,this),this._hostComponent=t,this._hostComponent&&this._hostComponent.on(it,this.updatePosition,this),this._hostComponent&&this._hostComponent.once(ot,function(){e._hostComponent=null,e.setState({display:!1})},this),this._hostComponent&&this.setState({display:!0})}}]),mo),W=(i(go,f),ds=a(go),e(go,[{key:"calcDots",value:function(){var t=this.interpolate(),e=this.state,i=e.left,n=e.top,s=t[0][2];this.state.points=[],this.state.dots=[];for(var o=0;o<s.length;o++){var r=s[o];this.state.points.push([r.x,r.y]),this.state.dots.push([r.x-i,r.y-n])}return this.calcArrowPoints(),this.state.dots}},{key:"interpolate",value:function(){var t=this.state.points.length,e=this.state.points[0][0],i=this.state.points[0][1],n=this.state.points[t-1][0],t=this.state.points[t-1][1],s=new A(e,i),o=new A(n,t),r=[],a=null,h=null,l=[],u=new Bn,c=new Bn,e=this.links.start.component;if(e){u=e.getMinBoundingBox(),r[0]=new A(s.x,u.tl[1]-this.state.escapeDistance),r[1]=new A(u.tr[0]+this.state.escapeDistance,s.y),r[2]=new A(s.x,u.br[1]+this.state.escapeDistance),r[3]=new A(u.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])}i=this.links.end.component;if(i){c=i.getMinBoundingBox(),r[0]=new A(o.x,c.tl[1]-this.state.escapeDistance),r[1]=new A(c.tr[0]+this.state.escapeDistance,o.y),r[2]=new A(o.x,c.br[1]+this.state.escapeDistance),r[3]=new A(c.tl[0]-this.state.escapeDistance,o.y);for(var h=r[0],f=1;f<r.length;f++)this.distance(o,r[f])<this.distance(o,h)&&(h=r[f])}var n=0,t=[s],e=(a&&(t.push(a),n=1),h&&t.push(h),t.push(o),A.cloneArray(t)),i=(l.push(["s0","s0",e]),A.cloneArray(t)),e=A.cloneArray(i),t=(e.splice(n+1,0,new A(e[n].x,e[n+1].y)),l.push(["s1","s1_1",e]),A.cloneArray(i)),e=(t.splice(n+1,0,new A(t[n+1].x,t[n].y)),l.push(["s1","s1_2",t]),A.cloneArray(i)),t=new A((e[n].x+e[n+1].x)/2,e[n].y),p=new A((e[n].x+e[n+1].x)/2,e[n+1].y),t=(e.splice(n+1,0,t,p),l.push(["s2","s2_1",e]),A.cloneArray(i)),p=new A(t[n].x,(t[n].y+t[n+1].y)/2),e=new A(t[n+1].x,(t[n].y+t[n+1].y)/2),p=(t.splice(n+1,0,p,e),l.push(["s2","s2_2",t]),A.cloneArray(i)),e=[p[n].x+20,p[n+1].x+20],t=(u&&e.push(u.br[0]+20),c&&e.push(c.br[0]+20),this.max(e)),e=new A(t,p[n].y),t=new A(t,p[n+1].y),e=(p.splice(n+1,0,e,t),l.push(["s2","s2_3",p]),A.cloneArray(i)),t=[e[n].y-20,e[n+1].y-20],p=(u&&t.push(u.tl[1]-20),c&&t.push(c.tl[1]-20),this.min(t)),t=new A(e[n].x,p),p=new A(e[n+1].x,p),t=(e.splice(n+1,0,t,p),l.push(["s2","s2_4",e]),A.cloneArray(i)),p=[t[n].x-20,t[n+1].x-20],e=(u&&p.push(u.tl[0]-20),c&&p.push(c.tl[0]-20),this.min(p)),p=new A(e,t[n].y),e=new A(e,t[n+1].y),p=(t.splice(n+1,0,p,e),l.push(["s2","s2_5",t]),A.cloneArray(i)),e=[p[n].y+20,p[n+1].y+20],t=(u&&e.push(u.tl[1]+u.height+20),c&&e.push(c.tl[1]+c.height+20),this.max(e)),i=new A(p[n].x,t),e=new A(p[n+1].x,t);p.splice(n+1,0,i,e),l.push(["s2","s2_6",p]);for(var v=[],y=0;y<l.length;y++){var g=l[y][2];this.orthogonalPath(g)&&v.push(l[y])}if(l=v,!s.equals(o)){for(var m=[],b=0;b<l.length;b++){var k=l[b][2];this.forwardPath(k)&&m.push(l[b])}(l=m).length}for(var w=[],x=0;x<l.length;x++){var C=!1,P=l[x][2].slice();(c||u)&&(P=P.slice(1,P.length-1)),u&&(C=C||this.polylineIntersectsRectangle(P,u)),(C=c?C||this.polylineIntersectsRectangle(P,c):C)||w.push(l[x])}(l=0!=w.length?w:l).length;for(var S=l[0][2].length,M=[],O=0;O<l.length;O++)l[O][2].length==S&&M.push(l[O]);for(var l=M,E=0,_=0;_<l.length;_++)this.scorePath(l[E][2])<this.scorePath(l[_][2])&&(E=_);return[l[E]]}},{key:"orthogonalPath",value:function(t){if(t.length<=1)return!0;for(var e=0;e<t.length-1;e++)if(t[e].x!=t[e+1].x&&t[e].y!=t[e+1].y)return!1;return!0}},{key:"lineIntersectsLine",value:function(t,e){if(t.startPoint.x==t.endPoint.x&&e.startPoint.x==e.endPoint.x)return t.startPoint.x==e.startPoint.x&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));if(t.startPoint.x==t.endPoint.x||e.startPoint.x==e.endPoint.x)return t.startPoint.x==t.endPoint.x&&(s=t,t=e,e=s),s=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),i=t.startPoint.y-s*t.startPoint.x,n=e.startPoint.x,t.contains(n,s=s*n+i)&&e.contains(n,s);var i=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),n=t.startPoint.y-i*t.startPoint.x,s=(e.endPoint.y-e.startPoint.y)/(e.endPoint.x-e.startPoint.x),o=e.startPoint.y-s*e.startPoint.x;if(i==s)return n==o&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));o=(o-n)/(i-s),s=i*o+n;return t.contains(o,s)&&e.contains(o,s)}},{key:"polylineIntersectsRectangle",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]&&arguments[2],n=[];n.push(new Zs(new A(e.x1,e.y1),new A(e.x2,e.y1))),n.push(new Zs(new A(e.x2,e.y1),new A(e.x2,e.y2))),n.push(new Zs(new A(e.x2,e.y2),new A(e.x1,e.y2))),n.push(new Zs(new A(e.x1,e.y2),new A(e.x1,e.y1)));for(var s=0;s<t.length-1;s++)for(var o=new Zs(t[s],t[s+1]),r=0;r<n.length;r++)if(this.lineIntersectsLine(o,n[r]))return!0;if(i)for(var a=new Zs(t[t.length-1],t[0]),h=0;h<n.length;h++)if(this.lineIntersectsLine(a,n[h]))return!0;return!1}},{key:"scorePath",value:function(t){if(t.length<=2)return-1;for(var e=0,i=1;i<t.length-1;i++)if(t[i-1].x==t[i].x&&t[i].x==t[i+1].x){if(this.signum(t[i+1].y-t[i].y)!=this.signum(t[i].y-t[i-1].y))return-1;e++}else if(t[i-1].y==t[i].y&&t[i].y==t[i+1].y){if(this.signum(t[i+1].x-t[i].x)!=this.signum(t[i].x-t[i-1].x))return-1;e++}else e--;return e}},{key:"signum",value:function(t){return 0<t?1:t<0?-1:0}},{key:"forwardPath",value:function(t){if(t.length<=2)return!0;for(var e=0;e<t.length-2;e++)if(t[e].x==t[e+1].x&&t[e+1].x==t[e+2].x){if(0!=this.signum(t[e+1].y-t[e].y)&&this.signum(t[e+1].y-t[e].y)==-1*this.signum(t[e+2].y-t[e+1].y))return!1}else if(t[e].y==t[e+1].y&&t[e+1].y==t[e+2].y&&0!=this.signum(t[e+1].x-t[e].x)&&this.signum(t[e+1].x-t[e].x)==-1*this.signum(t[e+2].x-t[e+1].x))return!1;return!0}},{key:"distance",value:function(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}},{key:"max",value:function(t){if(0==t.lenght)return NaN;for(var e=t[0],i=0;i<t.length;i++)e<t[i]&&(e=t[i]);return e}},{key:"min",value:function(t){if(0==t.lenght)return NaN;for(var e=t[0],i=0;i<t.length;i++)e>t[i]&&(e=t[i]);return e}},{key:"addDot",value:function(t,e){throw new Error("Can NOT add dot to ICEVisioLink mannually.")}},{key:"rmDot",value:function(t){throw new Error("Can NOT remove dot from ICEVisioLink mannually.")}}],[{key:"arrangeParam",value:function(t){return B(t.startPoint)&&(t.startPoint=[0,0]),B(t.endPoint)&&(t.endPoint=[10,10]),t.points=[u(t.startPoint),u(t.endPoint)],l({escapeDistance:30},t)}}]),go),x=(i(yo,w),cs=a(yo),e(yo,[{key:"calcDots",value:function(){this.state.dots=[];for(var t=2*Math.PI/this.state.edges,e=this.state.radius,i=0;i<this.state.edges;i++){var n=t*i-gt(this.state.startAngle),s=Math.floor(e*Math.cos(n)+e),n=Math.floor(e*Math.sin(n)+e);this.state.dots.push([s,n])}return this.state.dots}},{key:"calcComponentParams",value:function(){return this.dirty&&(this.calcDots(),this.state.width=2*this.state.radius,this.state.height=2*this.state.radius),{width:this.state.width,height:this.state.height}}},{key:"setState",value:function(t){B(t.radius)?B(t.width)?B(t.height)||(t.radius=t.height/2):t.radius=t.width/2:(t.width=2*t.radius,t.height=2*t.radius),h(r(yo.prototype),"setState",this).call(this,t)}}]),yo),d=(i(vo,w),us=a(vo),e(vo,[{key:"calcDots",value:function(){var t=this.state.radius,e=this.state.leafNum;this.state.dots=[];for(var i,n,s=Math.PI/this.state.pointNumber,o=0;i=t+t*Math.sin(e*o)*Math.cos(o),n=t+t*Math.sin(e*o)*Math.sin(o),this.state.dots.push([i,n]),!((o+=s)>=2*Math.PI););return this.state.dots}},{key:"calcComponentParams",value:function(){return this.dirty&&(this.calcDots(),this.state.width=2*this.state.radius,this.state.height=2*this.state.radius),{width:this.state.width,height:this.state.height}}},{key:"setState",value:function(t){B(t.radius)?B(t.width)?B(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),h(r(vo.prototype),"setState",this).call(this,t)}}]),vo),Gs=(i(po,w),ls=a(po),e(po,[{key:"calcDots",value:function(){this.state.dots=[];for(var t,e,i=gt(this.state.startAngle),n=Math.PI/this.state.spikes,s=this.state.outerRadius,o=this.state.innerRadius,r=0;r<this.state.spikes;r++)t=Math.cos(i)*s+s,e=Math.sin(i)*s+s,this.state.dots.push([t,e]),i+=n,t=Math.cos(i)*o+s,e=Math.sin(i)*o+s,this.state.dots.push([t,e]),i+=n;return this.state.dots}},{key:"calcComponentParams",value:function(){return this.dirty&&(this.calcDots(),this.state.width=2*this.state.outerRadius,this.state.height=2*this.state.outerRadius),{width:this.state.width,height:this.state.height}}},{key:"setState",value:function(t){B(t.outerRadius)?B(t.width)?B(t.height)||(t.outerRadius=t.height/2):t.outerRadius=t.width/2:(t.width=2*t.outerRadius,t.height=2*t.outerRadius),h(r(po.prototype),"setState",this).call(this,t)}}]),po),Ys=(i(fo,m),hs=a(fo),e(fo,[{key:"initEvents",value:function(){this.on(st,this.measureText,this)}},{key:"measureText",value:function(t){try{var e,i=this.root.document.createElement("div"),n={padding:"0",margin:"0",border:"none",position:"absolute",top:"0",left:"0",fontFamily:this.state.style.fontFamily,fontWeight:this.state.style.fontWeight,fontSize:this.state.style.fontSize+"px"};for(e in n)i.style[e]=n[e];i.contenteditable=!1,i.innerHTML=this.state.text,this.root.document.body.appendChild(i);var s={width:i.offsetWidth,height:i.offsetHeight};this.props.width=s.width,this.props.height=s.height,this.state.width=s.width,this.state.height=s.height}finally{this.root.document.body.removeChild(i)}}},{key:"doRender",value:function(){this.state.stroke&&this.ctx.strokeText(this.state.text,0-this.state.localOrigin[0],0-this.state.localOrigin[1]+this.state.height,this.state.width),this.state.fill&&this.ctx.fillText(this.state.text,0-this.state.localOrigin[0],0-this.state.localOrigin[1]+this.state.height,this.state.width),h(r(fo.prototype),"doRender",this).call(this)}}]),fo),$s=(e(co,[{key:"start",value:function(){return this.ice.evtBus.on("mousedown",this.mouseDownHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off("mousedown",this.mouseDownHandler,this),this.ice.evtBus.off("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.off("mouseup",this.mouseUpHandler,this),this}},{key:"mouseDownHandler",value:function(t){t=t.target;t.ice?t.state.interactive&&t.state.draggable&&(this.currentObj=t,this.ice.evtBus.on("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.on("mouseup",this.mouseUpHandler,this)):console.warn("DDManager: 点击在 canvas 画布上,没有点击任何图形。")}},{key:"mouseMoveHandler",value:function(t){var e=t.movementX,i=t.movementY;return this.currentObj.moveGlobalPosition(e,i,t),!0}},{key:"mouseUpHandler",value:function(t){this.ice.evtBus.off("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.off("mouseup",this.mouseUpHandler,this)}}]),co),N={evtBuses:[],start:function(){if(_&&_.addEventListener)for(var t=0;t<N.evtBuses.length;t++)!function(t){for(var i=N.evtBuses[t],e=0;e<Us.length;e++)!function(t){var e=Us[t];_.addEventListener(e[0],function(t){i.trigger(e[1],t)})}(e)}(t)},regitserEvtBus:function(t){N.evtBuses.includes(t)||N.evtBuses.push(t)},delEvtBus:function(t){N.evtBuses.includes(t)&&N.evtBuses.splice(N.evtBuses.indexOf(t),1)}},j={evtBuses:[],stopped:!1,frameCallback:function(){for(var t=0;t<j.evtBuses.length;t++){if(j.stopped)return;j.evtBuses[t].trigger(tt)}j.stopped||_.requestFrame(j.frameCallback)},start:function(){j.stopped=!1,_.requestFrame(j.frameCallback)},stop:function(){j.stopped=!0},pause:function(){},resume:function(){},regitserEvtBus:function(t){j.evtBuses.includes(t)||j.evtBuses.push(t)},delEvtBus:function(t){j.evtBuses.includes(t)&&j.evtBuses.splice(j.evtBuses.indexOf(t),1)}},to=(e(uo,[{key:"start",value:function(){return this.createLinkSlots(),this.ice.evtBus.on(ht,this.hookMouseMoveHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off(ht,this.hookMouseMoveHandler,this),this}},{key:"hookMouseMoveHandler",value:function(t){for(var e=t.target.getMaxBoundingBox(),i=u(this.ice.childNodes),n=0;n<i.length;n++){var s=i[n];if(s&&s.state.linkable&&s.getMaxBoundingBox().isIntersect(e)){for(var o=0;o<this.ice._linkSlots.length;o++)this.ice._linkSlots[o].hostComponent=s;return}}}},{key:"createLinkSlots",value:function(){var t,e,i,n;this.ice._linkSlots&&this.ice._linkSlots.length||(t=new Qs({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"T",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(t),e=new Qs({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"R",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(e),i=new Qs({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"B",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(i),n=new Qs({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"L",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(n),this.ice._linkSlots=[t,e,i,n])}}]),uo),eo={ICERect:k,ICECircle:E,ICEEllipse:g,ICEStar:Gs,ICEIsogon:x,ICEText:Ys,ICEImage:C,ICEGroup:Pe,ICEVisioLink:W,ICEPolyLine:f},io=(e(lo,[{key:"fromJSON",value:function(t){for(var e=JSON.parse(t).childNodes,i=0;i<e.length;i++)this.decodeRecursively(this.ice,e[i])}},{key:"decodeRecursively",value:function(t,e){var i=new eo[e.type](e.state),n=(t.addChild(i),e.childNodes);if(n&&n.length)for(var s=0;s<n.length;s++)this.decodeRecursively(i,n[s])}}]),lo),no=(e(ho,[{key:"toJSON",value:function(){for(var t={createTime:(new Date).toLocaleString(),lastModifyTime:(new Date).toLocaleString(),childNodes:[]},e=0;e<this.ice.childNodes.length;e++){var i=this.ice.childNodes[e];this.encodeRecursively(i,t)}return console.log(t),JSON.stringify(t)}},{key:"encodeRecursively",value:function(t,e){var i={state:t.state,type:t.constructor.name,childNodes:[]};if(e.childNodes.push(i),t.childNodes&&t.childNodes.length)for(var n=0;n<t.childNodes.length;n++)this.encodeRecursively(t.childNodes[n],i)}}]),ho),so=(i(ao,c),as=a(ao),e(ao,[{key:"start",value:function(){return this.stopped=!1,this.ice.evtBus.on(tt,this.frameEvtHandler,this),this}},{key:"stop",value:function(){return this.stopped=!0,this.ice.evtBus.off(tt,this.frameEvtHandler,this),this}},{key:"frameEvtHandler",value:function(t){this.ice.dirty?this.doRender():console.log("没有需要渲染的组件...")}},{key:"refreshQueue",value:function(){this.componentQueue=Dn([],this.ice.childNodes),this.componentQueue.sort(function(t,e){return t.state.zIndex-e.state.zIndex}),console.log("Component Queue length> ".concat(this.componentQueue.length)),this.toolsQueue=Dn([],this.ice.toolNodes),console.log("Tool Queue length> ".concat(this.ice.toolNodes.length))}},{key:"doRender",value:function(){var t=Date.now();this.refreshQueue(),this.ice.ctx.clearRect(0,0,this.ice.canvasWidth,this.ice.canvasHeight);for(var e=0;e<this.componentQueue.length;e++){var i=this.componentQueue[e];i.root=this.ice.root,i.ctx=this.ice.ctx,i.evtBus=this.ice.evtBus,i.ice=this.ice,i.render()}for(var n=0;n<this.toolsQueue.length;n++){var s=this.toolsQueue[n];s.root=this.ice.root,s.ctx=this.ice.ctx,s.evtBus=this.ice.evtBus,s.ice=this.ice,s.render()}console.log("Render time ".concat(Date.now()-t," ms.")),this.ice.dirty=!1,this.ice.evtBus.trigger(rt)}}]),ao),oo=(e(ro,[{key:"setImage",value:function(t){var e=this,i=this.imageCache.get(t);return i||((i=new Image).onload=function(){e.ice.dirty=!0},i.onerror=function(){console.error("ImageCache: 图片加载失败:",t)},i.src=t,this.imageCache.size>ro.CACHE_SIZE&&this.imageCache.delete(this.imageCache.keys().next().value),this.imageCache.set(t,i)),{loaded:this.loaded(i),image:i}}},{key:"loaded",value:function(t){return t.complete&&0<t.naturalWidth}}]),ro);function ro(t){s(this,ro),n(this,"imageCache",new Map),this.ice=t}function ao(t){var e;return s(this,ao),n(o(e=as.call(this)),"stopped",!1),n(o(e),"componentQueue",[]),n(o(e),"toolsQueue",[]),e.ice=t,e}function ho(t){s(this,ho),this.ice=t}function lo(t){s(this,lo),this.ice=t}function uo(t){s(this,uo),n(this,"slotRadius",10),this.ice=t}function co(t){s(this,co),this.ice=t}function fo(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,fo),hn({text:"",left:0,top:0,width:10,height:10,style:{fontWeight:"bold",fontSize:32,fontFamily:"Arial",lineWidth:1}},t));return t.style=l(l({},t.style),{},{font:"".concat(t.style.fontWeight," ").concat(t.style.fontSize,"px ").concat(t.style.fontFamily),textBaseline:"bottom"}),hs.call(this,t)}function po(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,po),l({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,ls.call(this,t)}function vo(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,vo),l({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,us.call(this,t)}function yo(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,yo),l({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,cs.call(this,t)}function go(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,go),t=go.arrangeParam(t),ds.call(this,t)}function mo(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,mo),fs.call(this,l({linkable:!1,draggable:!1,position:"T"},t))}function D(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,D),D.arrangeParam(t));return n(o(t=ps.call(this,t)),"__typeName","ICEPolyLine"),n(o(t),"links",{start:{},end:{}}),t}function bo(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,bo),vs.call(this,l({width:100,height:100,src:"data:image/png;base64,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"},t))}function ko(t){return s(this,ko),ys.call(this,l({dots:[],closePath:!0},t))}function wo(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;s(this,wo),this.x=t,this.y=e}function xo(t,e){s(this,xo),this.startPoint=t,this.endPoint=e}function Co(){return s(this,Co),gs.call(this)}function Po(t){s(this,Po),n(this,"selectionCandidates",[]),n(this,"_stopped",!1),this.ice=t}function So(t){s(this,So),this.ice=t,this.transformControlPanel=new Ws({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 Gn({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 Mo(t){return s(this,Mo),n(o(t=ms.call(this,l(l({},t),{},{zIndex:10000001,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"rotateControlSize",8),n(o(t),"rotateControlffsetY",60),n(o(t),"resizeControlInstanceCache",[]),n(o(t),"resizeControlSize",16),t.initControls(),t}function Oo(t){return s(this,Oo),bs.call(this,l(l({},t),{},{linkable:!1}))}function Eo(){throw s(this,Eo),new Error("GeoUtil is a static util class.")}function _o(t){return s(this,_o),ks.call(this,l(l({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}n(oo,"CACHE_SIZE",100);e(Io,[{key:"init",value:function(t){if(!t)throw new Error("ICE.init() failed...");if(this.ctx===t)throw new Error("同一个 canvas 实例只能 init 一次...");return this.root=_,q(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 Ks,j.regitserEvtBus(this.evtBus),j.start(),N.regitserEvtBus(this.evtBus),N.start(),this.eventBridge=new Fs(this).start(),this.animationManager=new ft(this).start(),this.ddManager=new $s(this).start(),this.controlPanelManager=new Js(this).start(),this.renderer=new so(this).start(),this.linkSlotManager=new to(this).start(),this.serializer=new no(this),this.deserializer=new io(this),this.imageCache=new oo(this),this}},{key:"addTool",value:function(t){-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(nt,null,{component:t}),t.trigger(nt),t.ice=this,t.root=this.root,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.dirty=!0,this.evtBus.trigger(st,null,{component:t}),t.trigger(st))}},{key:"removeTool",value:function(t){this.evtBus.trigger(ot,null,{component:t}),t.destory(),this.toolNodes.splice(this.toolNodes.indexOf(t),1),this.dirty=!0}},{key:"addChild",value:function(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(nt,null,{component:t}),t.trigger(nt),t.ice=this,t.root=this.root,t.ctx=this.ctx,t.evtBus=this.evtBus,t.parentNode=null,this.childNodes.push(t),Object.keys(t.props.animations).length&&this.animationManager.add(t),this.dirty=e,this.evtBus.trigger(st,null,{component:t}),t.trigger(st))}},{key:"addChildren",value:function(t){for(var e=0;e<t.length;e++)this.addChild(t[e],!1);this.dirty=!0}},{key:"removeChild",value:function(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];this.evtBus.trigger(ot,null,{component:t}),t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1),this.dirty=e}},{key:"removeChildren",value:function(t){for(var e=0;e<t.length;e++)this.removeChild(t[e],!1);this.dirty=!0}},{key:"clearAll",value:function(){this.removeChildren(u(this.childNodes))}},{key:"findComponent",value:function(e){return this.childNodes.filter(function(t){return t.props.id===e})[0]}},{key:"dirty",get:function(){return this.__dirty},set:function(t){this.__dirty=t}},{key:"toJSON",value:function(){return this.serializer.toJSON()}},{key:"fromJSON",value:function(t){var e=this,i=Date.now(),t=(j.stop(),this.renderer.stop(),this.eventBridge.stopped=!0,this.animationManager.stop(),this.ddManager.stop(),this.controlPanelManager.stop(),this.linkSlotManager.stop(),this.clearAll(),this.deserializer.fromJSON(t),j.start(),this.renderer.start(),this.animationManager.start(),this.ddManager.start(),this.controlPanelManager.start(),this.linkSlotManager.start(),setTimeout(function(){e.eventBridge.stopped=!1},300),Date.now());console.log("fromJSON> ".concat(t-i," ms"))}}]);var Bo=Io;function Io(){s(this,Io),n(this,"childNodes",[]),n(this,"toolNodes",[]),n(this,"canvasWidth",0),n(this,"canvasHeight",0),n(this,"selectionList",[]),n(this,"__dirty",!0),n(this,"_lastUpdateTime",Date.now())}t.AnimationManager=ft,t.CanvasRenderer=so,t.DOMEventBridge=Fs,t.EventBus=Ks,t.GeoLine=Zs,t.GeoPoint=A,t.GeoUtil=qs,t.ICE=Bo,t.ICEBezier=M,t.ICEBoundingBox=Bn,t.ICECircle=E,t.ICEComponent=m,t.ICEControlPanel=b,t.ICEControlPanelManager=Js,t.ICEDotPath=w,t.ICEEllipse=g,t.ICEEventTarget=c,t.ICEGroup=Pe,t.ICEImage=C,t.ICEIsogon=x,t.ICELinkHook=Qn,t.ICELinkSlot=Qs,t.ICEMatrix=In,t.ICEPath=P,t.ICEPolyLine=f,t.ICERect=k,t.ICERose=d,t.ICEStar=Gs,t.ICEText=Ys,t.ICEVisioLink=W,t.LineControlPanel=Gn,t.ResizeControl=Vs,t.RotateControl=Xs,t.TransformControlPanel=Ws,Object.defineProperty(t,"__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(t){"use strict";function z(e,t){var i,n=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)),n}function l(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?z(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):z(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function T(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function e(t,e,i){return e&&T(t.prototype,e),i&&T(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(t,e,i){e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i}function i(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&&L(t,e)}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function L(t,e){return(L=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function a(i){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=r(i),e=(t=n?(t=r(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return o(e)}}function h(){return(h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t}(t,e);if(n)return(n=Object.getOwnPropertyDescriptor(n,e)).get?n.get.call(arguments.length<3?t:i):n.value}).apply(this,arguments)}function u(t){return function(t){if(Array.isArray(t))return R(t)}(t)||function(){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}()||function(t){if(t){if("string"==typeof t)return R(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(e="Object"===e&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?R(t,void 0):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function H(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Q&&Q in Object(t)?Z(t):K.call(t)}function V(t){return null!=t&&"object"==typeof t}function q(t){return"string"==typeof t||!Y(t)&&$(t)&&"[object String]"==G(t)}function X(t){return void 0===t}var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},c="object"==typeof c&&c&&c.Object===Object&&c,d="object"==typeof self&&self&&self.Object===Object&&self,d=c||d||Function("return this")(),W=d.Symbol,f=Object.prototype,J=f.hasOwnProperty,U=f.toString,F=W?W.toStringTag:void 0,K=Object.prototype.toString,Z=function(t){var e=J.call(t,F),i=t[F];try{var n=!(t[F]=void 0)}catch(t){}var s=U.call(t);return n&&(e?t[F]=i:delete t[F]),s},Q=W?W.toStringTag:void 0,f=Array.isArray,G=H,Y=f,$=V,tt="ICE_FRAME_EVENT",et="BEFORE_RENDER",it="AFTER_RENDER",nt="BEFORE_ADD",st="AFTER_ADD",ot="BEFORE_REMOVE",rt="ROUND_FINISH",at="HOOK_MOUSEDOWN",ht="HOOK_MOUSEMOVE",lt="HOOK_MOUSEUP",ut="BEFORE_RESIZE",p="AFTER_RESIZE",ct="AFTER_ROTATE",v="AFTER_MOVE",dt={linear:function(t,e,i,n){return t+(e-t)/i*(Date.now()-n)},easeInQuad:function(t,e,i,n){n=Date.now()-n;return t+(e-t)/i*(n/i)*n},easeOutQuad:function(t,e,i,n){n=Date.now()-n;return-(e-t)*(n/=i)*(n-2)+t},easeInOutQuad:function(t,e,i,n){n=Date.now()-n,e-=t;return(n/=i/2)<1?e/2*n*n+t:-e/2*(--n*(n-2)-1)+t},easeInQuart:function(t,e,i,n){n=Date.now()-n;return(e-t)*(n/=i)*n*n*n+t},easeOutQuart:function(t,e,i,n){return-(e-t)*((e=(Date.now()-n)/i-1)*e*e*e-1)+t},easeInOutQuart:function(t,e,i,n){n=Date.now()-n,e-=t;return(n/=i/2)<1?e/2*n*n*n*n+t:-e/2*((n-=2)*n*n*n-2)+t},easeInCubic:function(t,e,i,n){n=Date.now()-n;return(e-t)*(n/=i)*n*n+t},easeOutCubic:function(t,e,i,n){return(e-t)*((e=(Date.now()-n)/i-1)*e*e+1)+t},easeInOutCubic:function(t,e,i,n){n=Date.now()-n,e-=t;return(n/=i/2)<1?e/2*n*n*n+t:e/2*((n-=2)*n*n+2)+t}},ft=(e(yt,[{key:"start",value:function(){return this.ice.evtBus.on(tt,this.frameEventHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off(tt,this.frameEventHandler,this),this}},{key:"frameEventHandler",value:function(t){for(var e=u(this.animationMap.values()),i=0;i<e.length;i++){var n=e[i];n.state.interactive=!1,this.tween(n),n.state.interactive=!0}}},{key:"tween",value:function(t){var e,i={},n=t.props.animations,s=1;for(e in n){var o=n[e];if(o.finished){if(++s===Object.keys(n).length){this.remove(t);break}}else{var r=o.from,a=o.to,h=o.duration,r=(X(o.startTime)&&(o.startTime=Date.now()),X(o.easing)&&(o.easing="linear"),dt[o.easing](r,a,h,o.startTime));a<r&&(r=a,o.finished=!0),i[e]=Math.floor(r)}}return t.setState(l({},i)),t}},{key:"add",value:function(t){this.animationMap.set(t.props.id,t)}},{key:"remove",value:function(t){q(t)?this.animationMap.delete(t):this.animationMap.delete(t.props.id)}}]),yt),pt="undefined"!=typeof Float32Array?Float32Array:Array,vt=Math.PI/180;function yt(t){s(this,yt),n(this,"animationMap",new Map),this.ice=t}function gt(t){return t*vt}function mt(t,e){var i=e[0],n=e[1],s=e[2],o=e[3],r=e[4],e=e[5],a=i*o-n*s;return a?(t[0]=o*(a=1/a),t[1]=-n*a,t[2]=-s*a,t[3]=i*a,t[4]=(s*e-o*r)*a,t[5]=(n*r-i*e)*a,t):null}function bt(t,e,i){var n=e[0],s=e[1],o=e[2],r=e[3],a=e[4],e=e[5],h=i[0],l=i[1],u=i[2],c=i[3],d=i[4],i=i[5];return t[0]=n*h+o*l,t[1]=s*h+r*l,t[2]=n*u+o*c,t[3]=s*u+r*c,t[4]=n*d+o*i+a,t[5]=s*d+r*i+e,t}function y(t,e,i){var n=e[0],e=e[1];return t[0]=i[0]*n+i[2]*e+i[4],t[1]=i[1]*n+i[3]*e+i[5],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),g=new pt(2),pt!=Float32Array&&(g[0]=0,g[1]=0);function kt(t,e){return t===e||t!=t&&e!=e}function wt(t,e){for(var i=t.length;i--;)if(xt(t[i][0],e))return i;return-1}var xt=kt,Ct=wt,Pt=Array.prototype.splice,St=wt,Mt=wt,Ot=wt;function Et(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Et.prototype.clear=function(){this.__data__=[],this.size=0},Et.prototype.delete=function(t){var e=this.__data__,t=Ct(e,t);return!(t<0||(t==e.length-1?e.pop():Pt.call(e,t,1),--this.size,0))},Et.prototype.get=function(t){var e=this.__data__,t=St(e,t);return t<0?void 0:e[t][1]},Et.prototype.has=function(t){return-1<Mt(this.__data__,t)},Et.prototype.set=function(t,e){var i=this.__data__,n=Ot(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this};function _t(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Bt(t){return!!Tt(t)&&("[object Function]"==(t=zt(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function It(t){if(null!=t){try{return Rt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function At(t,e){return e=e,t=null==(t=t)?void 0:t[e],!qt(e=t)||Vt(e)||!(Ht(e)?Jt:Wt).test(Xt(e))?void 0:t}function Nt(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t}function jt(t){var e,i=this.__data__;return Ft?"__lodash_hash_undefined__"===(e=i[t])?void 0:e:Kt.call(i,t)?i[t]:void 0}var g=Et,Dt=g,zt=H,Tt=_t,m=d["__core-js_shared__"],Lt=(m=/[^.]+$/.exec(m&&m.keys&&m.keys.IE_PROTO||""))?"Symbol(src)_1."+m:"",Rt=Function.prototype.toString,Ht=Bt,Vt=function(t){return!!Lt&&Lt in t},qt=_t,Xt=It,Wt=/^\[object .+?Constructor\]$/,m=Function.prototype,b=Object.prototype,m=m.toString,b=b.hasOwnProperty,Jt=RegExp("^"+m.call(b).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),m=At(d,"Map"),b=At(Object,"create"),Ut=b,Ft=b,Kt=Object.prototype.hasOwnProperty,Zt=b,Qt=Object.prototype.hasOwnProperty,Gt=b;function Yt(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Yt.prototype.clear=function(){this.__data__=Ut?Ut(null):{},this.size=0},Yt.prototype.delete=Nt,Yt.prototype.get=jt,Yt.prototype.has=function(t){var e=this.__data__;return Zt?void 0!==e[t]:Qt.call(e,t)},Yt.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Gt&&void 0===e?"__lodash_hash_undefined__":e,this};function $t(t,e){var i,n,t=t.__data__;return("string"==(n=typeof(i=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==i:null===i)?t["string"==typeof e?"string":"hash"]:t.map}var te=Yt,ee=g,ie=m,ne=$t,se=$t,oe=$t,re=$t;function ae(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}ae.prototype.clear=function(){this.size=0,this.__data__={hash:new te,map:new(ie||ee),string:new te}},ae.prototype.delete=function(t){t=ne(this,t).delete(t);return this.size-=t?1:0,t},ae.prototype.get=function(t){return se(this,t).get(t)},ae.prototype.has=function(t){return oe(this,t).has(t)},ae.prototype.set=function(t,e){var i=re(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this};function he(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t}function le(t){return this.__data__.get(t)}function ue(t){return this.__data__.has(t)}var ce=g,de=m,fe=ae,pe=g;function ve(t){t=this.__data__=new pe(t);this.size=t.size}ve.prototype.clear=function(){this.__data__=new Dt,this.size=0},ve.prototype.delete=he,ve.prototype.get=le,ve.prototype.has=ue,ve.prototype.set=function(t,e){var i=this.__data__;if(i instanceof ce){var n=i.__data__;if(!de||n.length<199)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new fe(n)}return i.set(t,e),this.size=i.size,this};function ye(t,e,i){"__proto__"==e&&we?we(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}function ge(t,e,i){(void 0===i||Ce(t[e],i))&&(void 0!==i||e in t)||xe(t,e,i)}function me(t,e,i){for(var n=-1,s=Object(t),o=i(t),r=o.length;r--;){var a=o[++n];if(!1===e(s[a],a,s))break}return t}var be,b=ve,ke=At,g=function(){try{var t=ke(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),we=g,xe=ye,Ce=kt,Pe={exports:{}},Se=(k=(k=(x=Pe).exports)&&!k.nodeType&&k,w=(w=k&&x&&!x.nodeType&&x)&&w.exports===k?d.Buffer:void 0,be=w?w.allocUnsafe:void 0,x.exports=function(t,e){if(e)return t.slice();e=t.length,e=be?be(e):new t.constructor(e);return t.copy(e),e},d.Uint8Array),Me=_t,Oe=Object.create;function Ee(){}function _e(e,i){return function(t){return e(i(t))}}function Be(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ve)}function Ie(t){return Ue(t)&&"[object Arguments]"==Je(t)}function Ae(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991}function Ne(t){return null!=t&&Ge(t.length)&&!Qe(t)}function je(t){return hi(t)&&ai(t.length)&&!!S[ri(t)]}function De(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function ze(t,e){var i=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==i||"symbol"!=i&&fi.test(t))&&-1<t&&t%1==0&&t<e}function Te(t){if(Si(t))return Pi(t,!0);var e=t;if(!ki(e))return xi(e);var i,n=wi(e),s=[];for(i in e)("constructor"!=i||!n&&Ci.call(e,i))&&s.push(i);return s}function Le(t){return t}var Re,He,k=_e(Object.getPrototypeOf,Object),Ve=Object.prototype,qe=function(t){if(!Me(t))return{};if(Oe)return Oe(t);Ee.prototype=t;t=new Ee;return Ee.prototype=void 0,t},Xe=k,We=Be,Je=H,Ue=V,Fe=V,w=Object.prototype,Ke=w.hasOwnProperty,Ze=w.propertyIsEnumerable,x=Ie(function(){return arguments}())?Ie:function(t){return Fe(t)&&Ke.call(t,"callee")&&!Ze.call(t,"callee")},Qe=Bt,Ge=Ae,Ye=Ne,$e=V,w={exports:{}},ti=(M=(M=(P=w).exports)&&!M.nodeType&&M,C=(C=M&&P&&!P.nodeType&&P)&&C.exports===M?d.Buffer:void 0,M=(C?C.isBuffer:void 0)||function(){return!1},P.exports=M,H),ei=k,ii=V,C=Function.prototype,P=Object.prototype,ni=C.toString,si=P.hasOwnProperty,oi=ni.call(Object),ri=H,ai=Ae,hi=V,S={},M=(S["[object Float32Array]"]=S["[object Float64Array]"]=S["[object Int8Array]"]=S["[object Int16Array]"]=S["[object Int32Array]"]=S["[object Uint8Array]"]=S["[object Uint8ClampedArray]"]=S["[object Uint16Array]"]=S["[object Uint32Array]"]=!0,S["[object Arguments]"]=S["[object Array]"]=S["[object ArrayBuffer]"]=S["[object Boolean]"]=S["[object DataView]"]=S["[object Date]"]=S["[object Error]"]=S["[object Function]"]=S["[object Map]"]=S["[object Number]"]=S["[object Object]"]=S["[object RegExp]"]=S["[object Set]"]=S["[object String]"]=S["[object WeakMap]"]=!1,{exports:{}}),P=(C=(C=(k=M).exports)&&!C.nodeType&&C,Re=C&&k&&!k.nodeType&&k,He=Re&&Re.exports===C&&c.process,C=function(){try{return Re&&Re.require&&Re.require("util").types||He&&He.binding&&He.binding("util")}catch(t){}}(),k.exports=C,function(e){return function(t){return e(t)}}),c=M.exports,k=c&&c.isTypedArray,C=k?P(k):je,li=ye,ui=kt,ci=Object.prototype.hasOwnProperty,di=ye,fi=/^(?:0|[1-9]\d*)$/,pi=x,vi=f,yi=w.exports,gi=ze,mi=C,bi=Object.prototype.hasOwnProperty,ki=_t,wi=Be,xi=function(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e},Ci=Object.prototype.hasOwnProperty,Pi=function(t,e){var i,n=vi(t),s=!n&&pi(t),o=!n&&!s&&yi(t),r=!n&&!s&&!o&&mi(t),a=n||s||o||r,h=a?function(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n}(t.length,String):[],l=h.length;for(i in t)!e&&!bi.call(t,i)||a&&("length"==i||o&&("offset"==i||"parent"==i)||r&&("buffer"==i||"byteLength"==i||"byteOffset"==i)||gi(i,l))||h.push(i);return h},Si=Ne,Mi=function(t,e,i,n){var s=!i;i=i||{};for(var o,r,a=-1,h=e.length;++a<h;){var l=e[a],u=n?n(i[l],t[l],l,i,t):void 0;void 0===u&&(u=t[l]),s?di(i,l,u):(u=u,r=void 0,r=(o=i)[l=l],ci.call(o,l)&&ui(r,u)&&(void 0!==u||l in o)||li(o,l,u))}return i},Oi=Te,Ei=ge,_i=Pe.exports,Bi=function(t,e){var i,e=e?(e=t.buffer,i=new e.constructor(e.byteLength),new Se(i).set(new Se(e)),i):t.buffer;return new t.constructor(e,t.byteOffset,t.length)},Ii=function(t,e){var i=-1,n=t.length;for(e=e||Array(n);++i<n;)e[i]=t[i];return e},Ai=function(t){return"function"!=typeof t.constructor||We(t)?{}:qe(Xe(t))},Ni=x,ji=f,Di=function(t){return $e(t)&&Ye(t)},zi=w.exports,Ti=Bt,Li=_t,Ri=function(t){if(!ii(t)||"[object Object]"!=ti(t))return!1;t=ei(t);if(null===t)return!0;t=si.call(t,"constructor")&&t.constructor;return"function"==typeof t&&t instanceof t&&ni.call(t)==oi},Hi=C,Vi=De,qi=function(t){return Mi(t,Oi(t))},Xi=b,Wi=ge,Ji=me,Ui=_t,Fi=Te,Ki=De,Zi=Math.max,Qi=g,Gi=Date.now;Yi=Qi?function(t,e){return Qi(t,"toString",{configurable:!0,enumerable:!1,value:(i=e,function(){return i}),writable:!0});var i}:Le,tn=$i=0;var Yi,$i,tn,en,nn=kt,sn=Ne,on=ze,rn=_t,an=function v(y,g,m,b,k){y!==g&&Ji(g,function(t,e){var i,n,s,o,r,a,h,l,u,c,d,f,p;k=k||new Xi,Ui(t)?(n=g,o=m,r=v,a=b,h=k,d=Vi(i=y,s=e),f=Vi(n,s),(p=h.get(f))?Ei(i,s,p):((n=void 0===(p=a?a(d,f,s+"",i,n,h):void 0))&&(u=!(l=ji(f))&&zi(f),c=!l&&!u&&Hi(f),p=f,l||u||c?p=ji(d)?d:Di(d)?Ii(d):u?_i(f,!(n=!1)):c?Bi(f,!(n=!1)):[]:Ri(f)||Ni(f)?Ni(p=d)?p=qi(d):Li(d)&&!Ti(d)||(p=Ai(f)):n=!1),n&&(h.set(f,p),r(p,f,o,a,h),h.delete(f)),Ei(i,s,p))):(l=b?b(Ki(y,e),t,e+"",y,g,k):void 0,Wi(y,e,l=void 0===l?t:l))},Fi)},hn=(en=function(t,e,i){an(t,e,i)},function(){var t=Gi(),e=16-(t-tn);if(tn=t,0<e){if(800<=++$i)return arguments[0]}else $i=0;return Yi.apply(void 0,arguments)}(function(h,l,u){return l=Zi(void 0===l?h.length-1:l,0),function(){for(var t=arguments,e=-1,i=Zi(t.length-l,0),n=Array(i);++e<i;)n[e]=t[l+e];for(var e=-1,s=Array(l+1);++e<l;)s[e]=t[e];s[l]=u(n);var o=h,r=this,a=s;switch(a.length){case 0:return o.call(r);case 1:return o.call(r,a[0]);case 2:return o.call(r,a[0],a[1]);case 3:return o.call(r,a[0],a[1],a[2])}return o.apply(r,a)}}(M=function(t,e){var i=-1,n=e.length,s=1<n?e[n-1]:void 0,o=2<n?e[2]:void 0,s=3<en.length&&"function"==typeof s?(n--,s):void 0;for(o&&function(t,e,i){if(!rn(i))return!1;var n=typeof e;return!!("number"==n?sn(i)&&on(e,i.length):"string"==n&&e in i)&&nn(i[e],t)}(e[0],e[1],o)&&(s=n<3?void 0:s,n=1),t=Object(t);++i<n;){var r=e[i];r&&en(t,r,i)}return t},E,Le),M+"")),O=(e(dn,[{key:"composedPath",value:function(){throw new Error("Method not implemented.")}},{key:"initEvent",value:function(t,e,i){throw new Error("Method not implemented.")}},{key:"preventDefault",value:function(){throw new Error("Method not implemented.")}},{key:"stopImmediatePropagation",value:function(){throw new Error("Method not implemented.")}},{key:"stopPropagation",value:function(){throw new Error("Method not implemented.")}}]),dn),c=_e(Object.keys,Object),ln=Be,un=c,cn=Object.prototype.hasOwnProperty;function dn(){var t,e,i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};for(t in s(this,dn),i)this[t]=i[t];for(e in n)this[e]=n[e]}var P=At(d,"DataView"),k=m,Pe=At(d,"Promise"),b=At(d,"Set"),g=At(d,"WeakMap"),fn=H,pn=It,vn=pn(P),yn=pn(k),gn=pn(Pe),mn=pn(b),bn=pn(g),E=fn,kn=((P&&"[object DataView]"!=E(new P(new ArrayBuffer(1)))||k&&"[object Map]"!=E(new k)||Pe&&"[object Promise]"!=E(Pe.resolve())||b&&"[object Set]"!=E(new b)||g&&"[object WeakMap]"!=E(new g))&&(E=function(t){var e=fn(t),t="[object Object]"==e?t.constructor:void 0,t=t?pn(t):"";if(t)switch(t){case vn:return"[object DataView]";case yn:return"[object Map]";case gn:return"[object Promise]";case mn:return"[object Set]";case bn:return"[object WeakMap]"}return e}),function(t){if(!ln(t))return un(t);var e,i=[];for(e in Object(t))cn.call(t,e)&&"constructor"!=e&&i.push(e);return i}),wn=E,xn=x,Cn=f,Pn=Ne,Sn=w.exports,Mn=Be,On=C,En=Object.prototype.hasOwnProperty,M=null,_=((M=window||global||{}).requestFrame=M.requestAnimationFrame||M.webkitRequestAnimationFrame||M.mozRequestAnimationFrame||M.oRequestAnimationFrame||M.msRequestAnimationFrame,M),c=(e(_n,[{key:"on",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:_;this.listeners[t]||(this.listeners[t]=[]),this.off(t,e,i),this.listeners[t].push({callback:e,scope:i})}},{key:"off",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:_;if(n=this.listeners[t])for(var n=u(n),s=0;s<n.length;s++){var o=n[s];if(o.callback===e&&o.scope===i)return void this.listeners[t].splice(s,1)}}},{key:"once",value:function(i,n){var s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:_,o=this;o.on(i,function t(e){o.off(i,t,s),n.call(s,e)},s)}},{key:"trigger",value:function(t){var e,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(function(t){if(null==t)return!0;if(Pn(t)&&(Cn(t)||"string"==typeof t||"function"==typeof t.splice||Sn(t)||On(t)||xn(t)))return!t.length;var e,i=wn(t);if("[object Map]"==i||"[object Set]"==i)return!t.size;if(Mn(t))return!kn(t).length;for(e in t)if(En.call(t,e))return!1;return!0}(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;i?((e=new O(i)).originalEvent=i.originalEvent||i,e.param=l({},n)):e=new O({type:t,timeStamp:Date.now(),param:l({},n)});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(t){t&&!this.suspendedEventNames.includes(t)&&this.suspendedEventNames.push(t)}},{key:"resume",value:function(e){this.suspendedEventNames.splice(this.suspendedEventNames.findIndex(function(t){return t===e}),1)}},{key:"purgeEvents",value:function(){this.listeners={},this.suspendedEventNames=[]}},{key:"hasListener",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:_;if(!this.listeners[t])return!1;var n=this.listeners[t];if(!n)return!1;for(var s=0;s<n.length;s++){var o=n[s];if(o.callback===e&&o.scope===i)return!0}return!1}}]),_n);function _n(){s(this,_n),n(this,"listeners",{}),n(this,"suspendedEventNames",[])}c.prototype.addEventListener=c.prototype.on,c.prototype.removeEventListener=c.prototype.off,c.prototype.dispatchEvent=c.prototype.trigger;e(Nn,[{key:"containsPoint",value:function(t){var e=this.getMinAndMaxPoint(),i=e.minX,n=e.minY,s=e.maxX,e=e.maxY;if(t[0]<i||t[0]>s||t[1]<n||t[1]>e)return!1;for(var o=0,r=this.getBoundingLines(),a=0;a<r.length;a++){var h,l=r[a];t[1]>l.o[1]&&t[1]>l.d[1]||t[1]<l.o[1]&&t[1]<l.d[1]||(l.o[0]===l.d[0]&&l.o[0]>=t[0]?l.o[0]:(h=(l.d[1]-l.o[1])/(l.d[0]-l.o[0]),l.o[0]+(t[1]-l.o[1])/h))>t[0]&&o++}return 0!==o&&o%2==1}},{key:"getBoundingLines",value:function(){return[{o:u(this.tl),d:u(this.tr)},{o:u(this.tr),d:u(this.br)},{o:u(this.br),d:u(this.bl)},{o:u(this.bl),d:u(this.tl)}]}},{key:"getMinAndMaxPoint",value:function(){for(var t=this.tl[0],e=this.tl[1],i=this.tl[0],n=this.tl[1],s=[this.tr,this.bl,this.br],o=0;o<s.length;o++){var r=s[o];r[0]<t&&(t=r[0]),r[0]>i&&(i=r[0]),r[1]<e&&(e=r[1]),r[1]>n&&(n=r[1])}return{minX:t,minY:e,maxX:i,maxY:n}}},{key:"containsBox",value:function(t){return!1}},{key:"isIntersect",value:function(t){var e=this.tl[0],i=this.br[0],n=this.tl[1],s=this.br[1],o=t.tl[0],r=t.br[0],a=t.tl[1],t=t.br[1];return!(r<e||t<n||i<o||s<a)}},{key:"transform",value:function(t){var e=y([],this.tl,t),i=y([],this.tr,t),n=y([],this.bl,t),s=y([],this.br,t),t=y([],this.center,t);return new Nn([].concat(u(e),u(i),u(n),u(s),u(t)))}},{key:"union",value:function(t){return null}},{key:"width",get:function(){var t=this.br[0]-this.bl[0],e=this.br[1]-this.bl[1];return Math.hypot(t,e)}},{key:"height",get:function(){var t=this.br[0]-this.tr[0],e=this.br[1]-this.tr[1];return Math.hypot(t,e)}},{key:"left",get:function(){return this.tl[0]},set:function(t){throw new Error("Can not set left to ICEBoundingBox directly.")}},{key:"top",get:function(){return this.tl[1]},set:function(t){throw new Error("Can not set top to ICEBoundingBox directly.")}},{key:"centerX",get:function(){return this.center[0]}},{key:"centerY",get:function(){return this.center[1]}},{key:"centerPoint",get:function(){return this.center}}],[{key:"fromDimension",value:function(t,e,i,n){return new Nn([].concat([t,e],[t+i,e],[t,e+n],[t+i,e+n],[t+i/2,e+n/2]))}}]);var Bn=Nn,In=(e(An,null,[{key:"calcRotateAngleFromMatrix",value:function(t){var e=0,i=t[0],t=t[1],n=Math.hypot(i,t),t=t/n,e=Math.acos(i/n);return t<0&&(e+=Math.PI/2),e*(180/Math.PI)}},{key:"calcScaleFromMatrix",value:function(t){var e=t[0],i=t[1],n=t[2],t=t[3];return[Math.hypot(e,i)/e,Math.hypot(n,t)/t]}}]),An);function An(){s(this,An)}function Nn(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[0,0,0,0,0,0,0,0,0,0];s(this,Nn),n(this,"tl",[0,0]),n(this,"tr",[0,0]),n(this,"bl",[0,0]),n(this,"br",[0,0]),n(this,"tc",[0,0]),n(this,"rc",[0,0]),n(this,"bc",[0,0]),n(this,"lc",[0,0]),n(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 jn(t,e){return e.split(".").reduce(function(t,e){return t[e]},t)}function Dn(t,e,i,n){for(var s=0<arguments.length&&void 0!==t?t:[],o=1<arguments.length&&void 0!==e?e:[],r=2<arguments.length&&void 0!==i?i:1,a=3<arguments.length&&void 0!==n?n:null,h=0;h<o.length;h++){var l=o[h];l._level=r,l._pid=a,s.push(l),Dn(s,l.childNodes||[],r+1,l.id)}return s}i(Tn,c),zn=a(Tn),e(Tn,[{key:"initEvents",value:function(){}},{key:"render",value:function(){this.trigger(et),this.state.display&&(this.calcComponentParams(),this.applyStyleToCtx(),this.applyTransformToCtx(),this.doRender(),this.trigger(it),this.dirty=!1)}},{key:"applyStyleToCtx",value:function(){var t,e=l(l({},this.props.style),this.state.style);for(t in e)this.ctx[t]=e[t]}},{key:"calcComponentParams",value:function(){return{width:this.state.width,height:this.state.height}}},{key:"calcLocalOrigin",value:function(){var t=[0,0],e=this.state.origin;return e&&"localCenter"!==e||(t[0]=this.state.width/2,t[1]=this.state.height/2),this.state.localOrigin=t}},{key:"calcAbsoluteOrigin",value:function(){var t=jn(this,"state.transform.translate.0")+this.state.left,e=jn(this,"state.transform.translate.1")+this.state.top,i=u(this.calcLocalOrigin());return i[0]+=t,i[1]+=e,this.parentNode&&(i=y([],i,[1,0,0,1,-this.parentNode.state.localOrigin[0],-this.parentNode.state.localOrigin[1]]),i=y([],i,this.parentNode.state.composedMatrix)),this.state.absoluteOrigin=i}},{key:"calcLinearMatrix",value:function(){h=new pt(6),pt!=Float32Array&&(h[1]=0,h[2]=0,h[4]=0,h[5]=0),h[0]=1,h[3]=1;var t,e,i,n,s,o,r,a,h,l=jn(this,"state.transform.skew.0"),u=jn(this,"state.transform.skew.1");return t=[],e=[],l=h=function(t,e,i,n){i=Math.tan(i),n=Math.tan(n);return t[0]=e[0],t[1]=e[1]+i,t[2]=e[2]+n,t[3]=e[3],t[4]=e[4],t[5]=e[5],t}([],h,l*vt,u*vt),u=gt(jn(this,"state.transform.rotate")),i=l[0],n=l[1],s=l[2],o=l[3],r=l[4],l=l[5],a=Math.sin(u),u=Math.cos(u),e[0]=i*u+s*a,e[1]=n*u+o*a,e[2]=i*-a+s*u,e[3]=n*-a+o*u,e[4]=r,e[5]=l,i=h=e,s=[jn(this,"state.transform.scale.0"),jn(this,"state.transform.scale.1")],n=i[0],a=i[1],o=i[2],u=i[3],r=i[4],i=i[5],l=s[0],s=s[1],t[0]=n*l,t[1]=a*l,t[2]=o*s,t[3]=u*s,t[4]=r,t[5]=i,h=t,this.state.linearMatrix=h}},{key:"calcAbsoluteLinearMatrix",value:function(){for(var t=this,e=t.calcLinearMatrix();t.parentNode;)e=bt([],t.parentNode.state.linearMatrix,e),t=t.parentNode;return this.state.absoluteLinearMatrix=e}},{key:"composeMatrix",value:function(){var t=this.calcAbsoluteOrigin(),t=bt([],[1,0,0,1,t[0],t[1]],this.calcAbsoluteLinearMatrix());return this.state.composedMatrix=t}},{key:"applyTransformToCtx",value:function(){var t,e=this.dirty?this.composeMatrix():this.state.composedMatrix;(t=this.ctx).setTransform.apply(t,u(e))}},{key:"doRender",value:function(){var t;this.ctx.setTransform(1,0,0,1,0,0),this.ctx.lineWidth=1,this.state.showMinBoundingBox&&(t=this.getMinBoundingBox(),this.ctx.strokeStyle="#ff0000",this.ctx.fillStyle="rgba(0,0,0,0)",this.ctx.beginPath(),this.ctx.moveTo(t.tl[0],t.tl[1]),this.ctx.lineTo(t.tr[0],t.tr[1]),this.ctx.lineTo(t.br[0],t.br[1]),this.ctx.lineTo(t.bl[0],t.bl[1]),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fill()),this.state.showMaxBoundingBox&&(t=this.getMaxBoundingBox(),this.ctx.strokeStyle="#0000ff",this.ctx.fillStyle="rgba(0,0,0,0)",this.ctx.beginPath(),this.ctx.moveTo(t.tl[0],t.tl[1]),this.ctx.lineTo(t.tr[0],t.tr[1]),this.ctx.lineTo(t.br[0],t.br[1]),this.ctx.lineTo(t.bl[0],t.bl[1]),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fill())}},{key:"getMinBoundingBox",value:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=this.state.localOrigin[0],i=this.state.localOrigin[1],n=this.state.width,s=this.state.height,e=new Bn([0-e,0-i,0-e+n,0-i,0-e,0-i+s,0-e+n,0-i+s,0,0]),n=t?this.composeMatrix():this.state.composedMatrix;return e.transform(n)}},{key:"getMaxBoundingBox",value:function(){var t=this.getMinBoundingBox(0<arguments.length&&void 0!==arguments[0]&&arguments[0]),e=t.getMinAndMaxPoint(),i=e.minX,n=e.minY,s=e.maxX,e=e.maxY,t=t.centerPoint;return new Bn([i,n,s,n,i,e,s,e,t[0],t[1]])}},{key:"setState",value:function(t){hn(this.state,t),this.dirty=!0,this.ice&&(this.ice.dirty=!0)}},{key:"dirty",get:function(){return this.__dirty},set:function(t){this.__dirty=t}},{key:"setPosition",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new O;this.trigger("BEFORE_MOVE",l(l({},i),{},{left:t,top:e})),this.setState({left:t,top:e}),this.trigger(v,l(l({},i),{},{left:t,top:e}))}},{key:"moveGlobalPosition",value:function(t,e){var i,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new O;this.parentNode&&(t=(i=y([],[t,e],mt([],this.parentNode.state.absoluteLinearMatrix)))[0],e=i[1]),this.setPosition(this.state.left+t,this.state.top+e,l(l({},n),{},{tx:t,ty:e}))}},{key:"setGlobalPosition",value:function(t,e){var i,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new O;this.parentNode&&(t=(i=y([],[t,e],mt([],this.parentNode.state.absoluteLinearMatrix)))[0],e=i[1]),this.setPosition(t,e,l(l({},n),{},{left:t,top:e}))}},{key:"setGlobalRotate",value:function(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteLinearMatrix,t-=In.calcRotateAngleFromMatrix(e)),this.setState({transform:{rotate:t}})}},{key:"localToGlobal",value:function(t,e){t=[t,e];return y([],t,this.state.composedMatrix)}},{key:"globalToLocal",value:function(t,e){t=[t,e];return y([],t,mt([],this.state.composedMatrix))}},{key:"getRotateAngle",value:function(){return this.state.transform.rotate}},{key:"getLocalLeftTop",value:function(){var t=this.getMinBoundingBox(!0),e=t.width,i=t.height;return{left:t.centerX-t.width/2,top:t.centerY-t.height/2,width:e,height:i}}},{key:"containsPoint",value:function(t,e){return this.getMinBoundingBox().containsPoint([t,e])}},{key:"destory",value:function(){this.trigger(ot,null,{component:this}),this.purgeEvents(),this.ice=null,this.ctx=null,this.root=null,this.evtBus=null,this.parentNode=null}}]);var zn,m=Tn;function Tn(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,Tn),n(o(t=zn.call(this)),"__typeName","ICEComponent"),n(o(t),"__dirty",!0),n(o(t),"props",{id:"ICE_"+function(){if(_.crypto)return _.crypto.randomUUID();var i=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(i+16*Math.random())%16|0;return i=Math.floor(i/16),("x"==t?e:3&e|8).toString(16)})}(),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:Tn.instanceCounter++,display:!0,draggable:!0,transformable:!0,interactive:!0,linkable:!0,showMinBoundingBox:!1,showMaxBoundingBox:!1}),n(o(t),"state",l({},t.props)),t.props=hn(t.props,e),t.state=JSON.parse(JSON.stringify(t.props)),t.initEvents(),t}n(m,"instanceCounter",0);i(Jn,m),Vn=a(Jn),e(Jn,[{key:"doRender",value:function(){this.dirty&&(this.ctx.beginPath(),this.createPathObject()),this.state.closePath&&this.path2D.closePath(),this.state.fill&&this.ctx.fill(this.path2D),this.state.stroke&&this.ctx.stroke(this.path2D),h(r(Jn.prototype),"doRender",this).call(this)}}]);var Ln,Rn,Hn,Vn,P=Jn,k=(i(Wn,P),Hn=a(Wn),e(Wn,[{key:"createPathObject",value:function(){return this.path2D=new Path2D,this.path2D.rect(0-this.state.localOrigin[0],0-this.state.localOrigin[1],this.state.width,this.state.height),this.path2D}}]),Wn),Pe=(i(Xn,k),Rn=a(Xn),e(Xn,[{key:"addChild",value:function(t){t.trigger(nt),(t.parentNode=this).childNodes.push(t),t.trigger(st)}},{key:"addChildren",value:function(t){for(var e=0;e<t.length;e++){var i=t[e];this.addChild(i)}}},{key:"removeChild",value:function(t){t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1)}},{key:"removeChildren",value:function(t){for(var e=0;e<t.length;e++){var i=t[e];this.removeChild(i)}}},{key:"destory",value:function(){this.removeChildren(this.childNodes),h(r(Xn.prototype),"destory",this).call(this)}}]),Xn),b=(i(qn,Pe),Ln=a(qn),e(qn,[{key:"doRender",value:function(){h(r(qn.prototype),"doRender",this).call(this),this.setControlPositions()}},{key:"moveGlobalPosition",value:function(t,e,i){h(r(qn.prototype),"moveGlobalPosition",this).call(this,t,e,i),this._targetComponent&&this._targetComponent.moveGlobalPosition(t,e,i)}}]),qn);function qn(t){return s(this,qn),n(o(t=Ln.call(this,l(l({},t),{},{linkable:!1}))),"__typeName","ICEControlPanel"),t}function Xn(t){return s(this,Xn),n(o(t=Rn.call(this,t)),"parentNode",null),n(o(t),"childNodes",[]),t}function Wn(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,Wn),Hn.call(this,l({width:10,height:10},t))}function Jn(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,Jn),n(o(t=Vn.call(this,l({closePath:!0},t))),"path2D",new Path2D),t}function B(t){return null==t}i(is,P),Zn=a(is),e(is,[{key:"createPathObject",value:function(){return this.path2D=new Path2D,this.path2D.ellipse(this.state.radiusX-this.state.localOrigin[0],this.state.radiusY-this.state.localOrigin[1],this.state.radiusX,this.state.radiusY,this.state.rotation,this.state.startAngle,this.state.endAngle,this.state.counterclockwise),this.path2D.closePath(),this.path2D}},{key:"setState",value:function(t){B(t.radiusX)?B(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,B(t.radiusY)?B(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,h(r(is.prototype),"setState",this).call(this,t)}}]);var Un,Fn,Kn,Zn,g=is,E=(i(es,g),Kn=a(es),e(es)),Qn=(i(ts,E),Fn=a(ts),e(ts,[{key:"initEvents",value:function(){h(r(ts.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(v,this.resizeEvtHandler,this)}},{key:"mosueDownHandler",value:function(t){this.evtBus.trigger(at,new O({target:this}))}},{key:"mosueMoveHandler",value:function(t){this.evtBus.trigger(ht,new O({target:this}))}},{key:"mosueUpHandler",value:function(t){this.evtBus.trigger(lt,new O({target:this}))}},{key:"resizeEvtHandler",value:function(t){var e;this.parentNode&&(e=this.props.position,this.parentNode.trigger(ut,new O(t,{position:e})),this.parentNode.trigger(p,new O(t,{position:e})))}}]),ts),Gn=(i($n,b),Un=a($n),e($n,[{key:"initControls",value:function(){var t=this.state.width,e=this.state.height,i=this.controlSize/2;this.startControl=new Qn({zIndex:10000011,display:!1,left:-i,top:-i,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"start"}),this.addChild(this.startControl),this.endControl=new Qn({zIndex:10000012,display:!1,left:t-i,top:e-i,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"end"}),this.addChild(this.endControl)}},{key:"initEvents",value:function(){this.on(p,this.resizeEvtHandler,this)}},{key:"enable",value:function(){this.setState({display:!0}),this.resume(p),this.showHooks()}},{key:"disable",value:function(){this.setState({display:!1}),this.suspend(p),this.hideHooks()}},{key:"setControlPositions",value:function(){}},{key:"resizeEvtHandler",value:function(t){if(this.targetComponent){var e=t.position,i=t.movementX,n=t.movementY,t=this.targetComponent.state,s=t.points.length,o=t.points[0][0],r=t.points[0][1],a=t.points[s-1][0],h=t.points[s-1][1],s=y([],[i,n],mt([],t.absoluteLinearMatrix)),i=s[0],n=s[1];switch(e){case"start":o+=i,r+=n;break;case"end":a+=i,h+=n}this.targetComponent.setState({startPoint:[o,r],endPoint:[a,h]})}}},{key:"updatePosition",value:function(){var t,e,i;this.targetComponent&&(this.setState({left:0,top:-5,width:3,height:3,transform:{translate:[0,0],scale:[1,1],skew:[0,0],rotate:0}}),t=this.controlSize/2,i=this.targetComponent.state.points.length,e=this.targetComponent.state.points[0],i=this.targetComponent.state.points[i-1],e=[e[0],e[1]],i=[i[0],i[1]],this.startControl.setState({left:e[0]-t,top:e[1]-t}),this.endControl.setState({left:i[0]-t,top:i[1]-t}))}},{key:"targetComponent",get:function(){return this._targetComponent},set:function(t){var e=this;this._targetComponent&&this._targetComponent.off(v,this.updatePosition,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(v,this.updatePosition,this),this._targetComponent&&this._targetComponent.once(ot,function(){e.targetComponent=null,e.disable()},this),this.updatePosition()}},{key:"showHooks",value:function(){this.startControl.setState({display:!0}),this.endControl.setState({display:!0})}},{key:"hideHooks",value:function(){this.startControl.setState({display:!1}),this.endControl.setState({display:!1})}}]),$n),Yn=/\s/;function $n(t){return s(this,$n),n(o(t=Un.call(this,l(l({},t),{},{zIndex:10000010,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"controlSize",16),t.initControls(),t}function ts(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,ts),Fn.call(this,l({linkable:!1},t))}function es(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,es),l({radius:10},t));return t.radiusX=t.radius,t.radiusY=t.radius,Kn.call(this,t)}function is(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,is),l({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,Zn.call(this,t)}function ns(t){return"symbol"==typeof t||Ss(t)&&"[object Symbol]"==Ps(t)}function ss(t){if("number"==typeof t)return t;if(Os(t))return NaN;var e;if(Ms(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=Ms(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=(e=t)&&e.slice(0,xs(e)+1).replace(Cs,"");var i=_s.test(t);return i||Bs.test(t)?Is(t.slice(2),i?2:8):Es.test(t)?NaN:+t}function os(t){if("string"==typeof t)return t;if(js(t))return Ns(t,os)+"";if(Ds(t))return zs?zs.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function rs(t){return null==t?"":os(t)}var as,hs,ls,us,cs,ds,fs,ps,vs,ys,gs,ms,bs,ks,ws,xs=function(t){for(var e=t.length;e--&&Yn.test(t.charAt(e)););return e},Cs=/^\s+/,Ps=H,Ss=V,Ms=_t,Os=ns,Es=/^[-+]0x[0-9a-f]+$/i,_s=/^0b[01]+$/i,Bs=/^0o[0-7]+$/i,Is=parseInt,As=ss,Ns=function(t,e){for(var i=-1,n=null==t?0:t.length,s=Array(n);++i<n;)s[i]=e(t[i],i,t);return s},js=f,Ds=ns,x=W?W.prototype:void 0,zs=x?x.toString:void 0,Ts=function(t){var t=(t=t)?(t=As(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0,e=t%1;return t==t?e?t-e:t:0},Ls=ss,Rs=d.isFinite,Hs=Math.min,I=(ws=Math.round,function(t,e){var i,n;return t=Ls(t),(e=null==e?0:Hs(Ts(e),292))&&Rs(t)?(i=(rs(t)+"e").split("e"),n=ws(i[0]+"e"+(+i[1]+e)),+((i=(rs(n)+"e").split("e"))[0]+"e"+(+i[1]-e))):ws(t)}),Vs=(i(_o,k),ks=a(_o),e(_o,[{key:"initEvents",value:function(){h(r(_o.prototype),"initEvents",this).call(this),this.on(v,this.resizeEvtHandler,this)}},{key:"resizeEvtHandler",value:function(t){if(this.parentNode){var e=t.quadrant,i=t.movementX,n=t.movementY,s=this.parentNode.state,o=s.left,r=s.top,a=s.width,h=s.height,s=y([],[i,n],mt([],s.absoluteLinearMatrix)),i=s[0],n=s[1];switch(e){case 1:o-=i,r+=n,a+=2*i,h-=2*n;break;case 2:o+=i,r+=n,a-=2*i,h-=2*n;break;case 3:o+=i,r-=n,a-=2*i,h+=2*n;break;case 4:o-=i,r-=n,a+=2*i,h+=2*n;break;case 5:r+=n,h-=2*n;break;case 6:r-=n,h+=2*n;break;case 7:o+=i,a-=2*i;break;case 8:o-=i,a+=2*i}s={top:r,left:o,width:Math.abs(a),height:Math.abs(h)};this.parentNode.trigger(ut,new O(t,{quadrant:e})),this.parentNode.setState(s),this.parentNode.trigger(p,new O(t,{quadrant:e}))}}},{key:"moveGlobalPosition",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new O,n=0<t?1:-1,s=0<e?1:-1,o=this.parentNode.state,r=o.localOrigin,a=o.width,h=o.height,o=y([],[t,e],mt([],o.absoluteLinearMatrix)),o=(t=o[0],e=o[1],this.state),l=o.left,u=o.top,o=o.quadrant,c=this.state.width/2,d=0;"x"===this.state.direction?d=0<(l=0===I(l+=t)?.5*n:l)+c-r[0]?8:7:"y"===this.state.direction?d=0<(u=0===I(u+=e)?.5*s:u)+c-r[1]?6:5:"xy"===this.state.direction&&(s=-h/2/(s=0===I(s=-a/2)?.5*n:s),0===I(a=a/2)&&(a=.5*n),u+=e=2===o||4==o?s*(l+c-r[0]+t)-(u+c-r[1]):-h/2/a*(l+c-r[0]+t)-(u+c-r[1]),d=0<(l+=t)+c-r[0]?0<u+c-r[1]?4:1:0<u+c-r[1]?3:2),o!==d&&this.parentNode.toggleControlQuadrant(this,d),this.setPosition(l,u,new O(i,{left:l,top:u,tx:t,ty:e,quadrant:d}))}}]),_o),qs=(e(Eo,null,[{key:"calcRotateAngle",value:function(t,e,i,n){t-=i,i=e-n,e=Math.hypot(t,i);return((i/e<0?-1:1)*Math.acos(t/e)*180/Math.PI+360)%360}}]),Eo),Xs=(i(Oo,E),bs=a(Oo),e(Oo,[{key:"initEvents",value:function(){h(r(Oo.prototype),"initEvents",this).call(this),this.on(v,this.rotateEvtHandler,this)}},{key:"rotateEvtHandler",value:function(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteOrigin,t={transform:{rotate:qs.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90}},this.parentNode.trigger("BEFORE_ROTATE",new O(t)),this.parentNode.setState(t),this.parentNode.trigger(ct,new O(t)))}}]),Oo),Ws=(i(Mo,b),ms=a(Mo),e(Mo,[{key:"initControls",value:function(){var t=this.state.width,e=this.state.height,i=t/2,n=e/2,s=this.resizeControlSize/2,o=[{direction:"xy",quadrant:2,position:[-s,-s]},{direction:"y",quadrant:5,position:[i-s,-s]},{direction:"xy",quadrant:1,position:[t-s,-s]},{direction:"x",quadrant:8,position:[t-s,n-s]},{direction:"xy",quadrant:4,position:[t-s,e-s]},{direction:"y",quadrant:6,position:[i-s,e-s]},{direction:"xy",quadrant:3,position:[-s,e-s]},{direction:"x",quadrant:7,position:[-s,n-s]}];this.resizeControlInstanceCache=[];for(var r=0;r<o.length;r++){var a=o[r],a=new Vs({zIndex:10000002,display:!1,left:a.position[0],top:a.position[1],width:this.resizeControlSize,height:this.resizeControlSize,style:{strokeStyle:"#8b0000",fillStyle:"#CC3300",lineWidth:1},direction:a.direction,quadrant:a.quadrant});this.addChild(a),this.resizeControlInstanceCache.push(a)}t=this.state.width/2-this.rotateControlSize,i=-this.rotateControlffsetY;this.rotateControlInstance=new Xs({zIndex:10000003,display:!1,left:t,top:i,radius:this.rotateControlSize,style:{strokeStyle:"#8b0000",fillStyle:"#CC3300",lineWidth:1}}),this.addChild(this.rotateControlInstance)}},{key:"initEvents",value:function(){h(r(Mo.prototype),"initEvents",this).call(this),this.on(p,this.resizeEvtHandler,this),this.on(ct,this.rotateEvtHandler,this)}},{key:"enable",value:function(){this.rotateControlInstance.setState({display:!0});for(var t=0;t<this.resizeControlInstanceCache.length;t++)this.resizeControlInstanceCache[t].setState({display:!0});this.setState({display:!0}),this.resume(p),this.resume(ct)}},{key:"disable",value:function(){this.rotateControlInstance.setState({display:!1});for(var t=0;t<this.resizeControlInstanceCache.length;t++)this.resizeControlInstanceCache[t].setState({display:!1});this.setState({display:!1}),this.suspend(p),this.suspend(ct)}},{key:"setControlPositions",value:function(){for(var t=this.state.width,e=this.state.height,i=t/2,n=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=[i-s,-s];break;case 6:a=[i-s,e-s];break;case 7:a=[-s,n-s];break;case 8:a=[t-s,n-s]}r.setState({left:a[0],top:a[1]})}var h=this.state.width/2-this.rotateControlSize,l=-this.rotateControlffsetY;this.rotateControlInstance.setState({left:h,top:l})}},{key:"rotateEvtHandler",value:function(t){var e;this.targetComponent&&(e=this.state.transform.rotate,this.targetComponent.setGlobalRotate(e),this.targetComponent.trigger(ct))}},{key:"resizeEvtHandler",value:function(t){if(this.targetComponent){var e=t.quadrant,i=t.movementX,n=t.movementY,t=this.targetComponent.state,s=t.left,o=t.top,r=t.width,a=t.height,t=y([],[i,n],mt([],t.absoluteLinearMatrix)),i=t[0],n=t[1];switch(e){case 1:s-=i,o+=n,r+=2*i,a-=2*n;break;case 2:s+=i,o+=n,r-=2*i,a-=2*n;break;case 3:s+=i,o-=n,r-=2*i,a+=2*n;break;case 4:s-=i,o-=n,r+=2*i,a+=2*n;break;case 5:o+=n,a-=2*n;break;case 6:o-=n,a+=2*n;break;case 7:s+=i,r-=2*i;break;case 8:s-=i,r+=2*i}this.targetComponent.setState({left:s,top:o,width:Math.abs(r),height:Math.abs(a)}),this.targetComponent.trigger(p)}}},{key:"updatePanel",value:function(){var t,e,i,n,s;this.targetComponent&&(t=this.targetComponent.getRotateAngle(),e=(s=this.targetComponent.getLocalLeftTop()).left,i=s.top,n=s.width,s=s.height,this.setState({left:e,top:i,width:n,height:s,transform:{rotate:t}}))}},{key:"targetComponent",get:function(){return this._targetComponent},set:function(t){var e=this;this._targetComponent&&this._targetComponent.off(v,this.updatePanel,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(v,this.updatePanel,this),this._targetComponent&&this._targetComponent.once(ot,function(){e.targetComponent=null,e.disable()},this),this.updatePanel()}},{key:"toggleControlQuadrant",value:function(t,e){for(var i=0;i<this.resizeControlInstanceCache.length;i++){var n=this.resizeControlInstanceCache[i];if(n.state.quadrant===e){var s=0;switch(e){case 1:s=3;break;case 2:s=4;break;case 3:s=1;break;case 4:s=2;break;case 5:s=6;break;case 6:s=5;break;case 7:s=8;break;case 8:s=7}n.setState({quadrant:s})}}t.setState({quadrant:e})}}]),Mo),Js=(e(So,[{key:"start",value:function(){return this.ice.evtBus.on("mousedown",this.mouseDownHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off("mousedown",this.mouseDownHandler,this),this}},{key:"mouseDownHandler",value:function(t){t=t.target;if(!t.ice||!t.state.interactive||!t.state.transformable)return this.lineControlPanel.disable(),void this.transformControlPanel.disable();t&&("ICEControlPanel"===t.__typeName||t.parentNode&&"ICEControlPanel"===t.parentNode.__typeName)||(this.ice.selectionList=[t],this.lineControlPanel.disable(),this.transformControlPanel.disable(),"ICEPolyline"===t.__typeName?(this.lineControlPanel.targetComponent=t,this.lineControlPanel.enable()):(this.transformControlPanel.targetComponent=t,this.transformControlPanel.enable()))}}]),So),Us=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dbclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],Fs=(e(Po,[{key:"start",value:function(){for(var n=this,s=null,t=0;t<Us.length;t++)!function(t){var t=Us[t],e=t[1],i=t[0];n.ice.evtBus.on(e,function(t){n._stopped||((s="ICE_MOUSEMOVE"!==e?n.findTargetComponent(t):s)&&(t.target=s).trigger(i,t),n.ice.evtBus.trigger(i,t))})}(t);return this}},{key:"stopped",get:function(){return this._stopped},set:function(t){this._stopped=t}},{key:"findTargetComponent",value:function(t){if(this._stopped)return null;var e=t.offsetX,i=t.offsetY,t=Dn([],this.ice.toolNodes),n=Dn([],this.ice.childNodes),s=[].concat(u(t),u(n));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,h=a.interactive,a=a.display;r.containsPoint(e,i)&&h&&a&&this.selectionCandidates.push(r)}t=this.selectionCandidates.pop();return this.selectionCandidates=[],t}}]),Po),Ks=(i(Co,c),gs=a(Co),e(Co)),Zs=(e(xo,[{key:"contains",value:function(t,e){var i=Math.hypot(this.endPoint.x-this.startPoint.x,this.endPoint.y-this.startPoint.y),n=Math.hypot(t-this.startPoint.x,e-this.startPoint.y),t=Math.hypot(t-this.endPoint.x,e-this.endPoint.y);return i-3<=n+t&&n+t<=i+3}}]),xo),A=(e(wo,[{key:"equals",value:function(t){return this.x==t.x&&this.y==t.y}},{key:"clone",value:function(){return new wo(this.x,this.y)}}],[{key:"load",value:function(t){return new wo(Number(t.x),Number(t.y))}},{key:"cloneArray",value:function(t){for(var e=[],i=0;i<t.length;i++)e.push(t[i].clone());return e}}]),wo),w=(i(ko,P),ys=a(ko),e(ko,[{key:"calcComponentParams",value:function(){if(!this.dirty)return{width:this.state.width,height:this.state.height};this.calcDots();var t=this.calc4VertexPoints(),e=Math.abs(t[1][0]-t[0][0]),t=Math.abs(t[2][1]-t[0][1]);return this.state.width=e,this.state.height=t,{width:this.state.width,height:this.state.height}}},{key:"calcLocalOrigin",value:function(){for(var t=h(r(ko.prototype),"calcLocalOrigin",this).call(this),e=0;e<this.state.dots.length;e++){var i=y([],this.state.dots[e],[1,0,0,1,-t[0],-t[1]]);this.state.dots[e]=i}return t}},{key:"createPathObject",value:function(){this.path2D=new Path2D,this.path2D.moveTo(this.state.dots[0][0],this.state.dots[0][1]);for(var t=1;t<this.state.dots.length;t++){var e=this.state.dots[t];this.path2D.lineTo(e[0],e[1])}return this.path2D}},{key:"calcDots",value:function(){return this.state.dots=[],this.state.dots}},{key:"calc4VertexPoints",value:function(){for(var t=this.state.dots[0][0],e=this.state.dots[0][1],i=this.state.dots[0][0],n=this.state.dots[0][1],s=1;s<this.state.dots.length;s++){var o=this.state.dots[s];o[0]<t&&(t=o[0]),o[0]>i&&(i=o[0]),o[1]<e&&(e=o[1]),o[1]>n&&(n=o[1])}return[[t,e],[i,e],[t,n],[i,n]]}},{key:"getTransformedDots",value:function(){for(var t=this.state.composedMatrix,e=this.state.dots,i=[],n=0;n<e.length;n++){var s=y([],e[n],t);i.push(s)}return i}}]),ko),C=(i(bo,m),vs=a(bo),e(bo,[{key:"doRender",value:function(){var t,e;this.state.src&&(t=(e=this.ice.imageCache.setImage(this.state.src)).loaded,e=e.image,t&&this.ctx.drawImage(e,0-this.state.localOrigin[0],0-this.state.localOrigin[1],this.state.width,this.state.height)),h(r(bo.prototype),"doRender",this).call(this)}}]),bo),M=e(function t(){s(this,t)}),f=(i(D,w),ps=a(D),e(D,[{key:"initEvents",value:function(){h(r(D.prototype),"initEvents",this).call(this),this.once(st,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function(t){this.evtBus.once(rt,this.makeConnection,this)}},{key:"makeConnection",value:function(){var t,e,i=this.props.links;i&&(i.start&&(t=i.start.id,e=i.start.position,t&&e&&(t=this.ice.findComponent(t),this.setLink("start",t,e))),i.end&&(t=i.end.id,e=i.end.position,t&&e&&(i=this.ice.findComponent(t),this.setLink("end",i,e)))),this.ice.dirty=!0}},{key:"setLink",value:function(t,e,i){this.removeLink(t,e,i),this.links[t]={component:e,position:i},e.on(v,this.followComponent,this),e.on(p,this.followComponent,this),e.on(ct,this.followComponent,this),e.once(it,this.followComponent,this),this.followComponent();var n,s={};for(n in this.links){var o=this.links[n];o.component&&o.position&&(s[n]={id:o.component.props.id,position:o.position})}this.setState({links:l({},s),draggable:!1})}},{key:"removeLink",value:function(t,e,i){var n=this.links[t].component,s=this.links[t].position;n===e&&s===i&&(n&&n.off(v,this.followComponent,this),n&&n.off(p,this.followComponent,this),n&&n.off(ct,this.followComponent,this),this.links[t]={},this.state.links[t]={}),this.links.start.component||this.links.end.component||this.setState({draggable:!0})}},{key:"followComponent",value:function(t){for(var e in this.links){var i=this.links[e].position,n=this.links[e].component;if(i&&n){var s=n.getMinBoundingBox(),o=[0,0];switch(i){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:u(o)});break;case"end":this.setState({endPoint:u(o)})}}}}},{key:"calcLocalOrigin",value:function(){var t=[0,0];return this.state.localOrigin=t}},{key:"calcDots",value:function(){var t=this.state.left,e=this.state.top;this.state.dots=[];for(var i=0;i<this.state.points.length;i++){var n=this.state.points[i],s=n[0]-t,n=n[1]-e;this.state.dots.push([s,n])}return this.calcArrowPoints(),this.state.dots}},{key:"calcArrowPoints",value:function(){var t,e,i;"start"!==this.state.arrowPosition&&"both"!==this.state.arrowPosition||(i=u(this.state.dots[0]),e=[u(this.state.dots[0]),u(this.state.dots[1])],e=this.doCalcArrowPoints(e),(t=this.state.dots).unshift.apply(t,u(e)),this.state.dots.unshift(u(i))),"end"!==this.state.arrowPosition&&"both"!==this.state.arrowPosition||(t=this.state.dots.length,e=u(this.state.dots[t-1]),i=[u(this.state.dots[t-1]),u(this.state.dots[t-2])],i=this.doCalcArrowPoints(i),(t=this.state.dots).push.apply(t,u(i)),this.state.dots.push(u(e)))}},{key:"doCalcArrowPoints",value:function(t){var e=t[0],t=t[1],i=(t[0]=t[0]-e[0],t[1]=t[1]-e[1],t[0]/Math.hypot.apply(Math,u(t))),t=t[1]/Math.hypot.apply(Math,u(t)),n=Math.cos(this.state.arrowAngel),s=Math.sin(this.state.arrowAngel),o=this.state.arrowLength*(i*n-t*s),r=this.state.arrowLength*(t*n+i*s),a=this.state.arrowLength*(i*n+t*s),t=this.state.arrowLength*(t*n-i*s);return[[o+=e[0],r+=e[1]],[a+=e[0],t+=e[1]]]}},{key:"addDot",value:function(t,e){this.state.points.splice(e,0,t),this.state.dots.splice(e,0,[t[0],t[1]])}},{key:"rmDot",value:function(t){return!(this.state.points.length<3||(this.state.points.splice(t,1),this.state.dots.splice(t,1),0))}},{key:"calcComponentParams",value:function(){if(!this.dirty)return{width:this.state.width,height:this.state.height};this.calcDots();var t=this.calc4VertexPoints(),e=Math.abs(t[1][0]-t[0][0]),i=this.state.style.lineWidth;return this.isDotsOnSameLine()||(i=Math.abs(t[2][1]-t[0][1])),this.state.width=e,this.state.height=i,{width:this.state.width,height:this.state.height}}},{key:"isDotsOnSameLine",value:function(){for(var t,e,i=this.state.points.length,n=I(this.state.points[0][0],2),s=I(this.state.points[0][1],2),o=0,r=[I(this.state.points[i-1][0],2)-n,I(this.state.points[i-1][1],2)-s],a=0;a<i;a++){var h=this.state.points[a];0===(t=[],e=r,h=[h[0]-n,h[1]-s],e=r[0]*h[1]-r[1]*h[0],t[0]=t[1]=0,t[2]=e,t[2])&&o++}return o===i}},{key:"calc4VertexPoints",value:function(){return this.isDotsOnSameLine()?this.splitEndpointsTo4Points():h(r(D.prototype),"calc4VertexPoints",this).call(this)}},{key:"splitEndpointsTo4Points",value:function(){var t=this.state.points.length,e=this.state.points[t-1][0]-this.state.points[0][0],t=this.state.points[t-1][1]-this.state.points[0][1],i=this.getRotateAngle(),n=this.state.height,s=Math.cos(i*Math.PI/180)*n/2,i=Math.sin(i*Math.PI/180)*n/2;return[[0+(s=I(s,3)),0+(i=I(i,3))],[0-s,0-i],[e+s,t+i],[e-s,t-i]]}},{key:"getMinBoundingBox",value:function(){var t=this.state.localOrigin[0],e=this.state.localOrigin[1],i=this.calc4VertexPoints(),t=new Bn([i[0][0]-t,i[0][1]-e,i[1][0]-t,i[1][1]-e,i[2][0]-t,i[2][1]-e,i[3][0]-t,i[3][1]-e,0,0]);return t.transform(this.state.composedMatrix)}},{key:"setState",value:function(t){if(B(t.width)||delete t.width,B(t.height)||delete t.height,B(t.transform)||delete t.transform,!B(t.left))for(var e=t.left-this.state.points[0][0],i=0;i<this.state.points.length;i++)this.state.points[i][0]+=e;if(!B(t.top))for(var n=t.top-this.state.points[0][1],s=0;s<this.state.points.length;s++)this.state.points[s][1]+=n;var o;B(t.startPoint)||(this.state.points[0]=u(t.startPoint),this.state.left=this.state.points[0][0],this.state.top=this.state.points[0][1]),B(t.endPoint)||(o=this.state.points.length,this.state.points[o-1]=u(t.endPoint)),h(r(D.prototype),"setState",this).call(this,t)}},{key:"getRotateAngle",value:function(){var t,e;return this.isDotsOnSameLine()?(e=this.state.points.length,t=this.state.points[e-1][0]-this.state.points[0][0],e=this.state.points[e-1][1]-this.state.points[0][1],qs.calcRotateAngle(t,e,0,0)+90):h(r(D.prototype),"getRotateAngle",this).call(this)}},{key:"containsPoint",value:function(t,e){for(var i=this.getLines(),n=0;n<i.length;n++){var s=i[n],o=s.o[0],r=s.o[1],a=s.d[0],s=s.d[1],h=Math.hypot(a-o,s-r),o=Math.hypot(o-t,r-e),r=Math.hypot(a-t,s-e);if(h-3<=o+r&&o+r<=h+3)return!0}return!1}},{key:"getLines",value:function(){var t=[],e=this.getTransformedDots();if(!e||e.length<2)return t;for(var i=0;i<e.length-1;i++){var n={o:[e[i][0],e[i][1]],d:[e[i+1][0],e[i+1][1]]};t.push(n)}return t}}],[{key:"arrangeParam",value:function(t){var e=hn({},{lineType:"solid",lineWidth:1,arrowPosition:"both",arrowLength:15,arrowAngel:30*vt,points:[],showMinBoundingBox:!1,showMaxBoundingBox:!1,links:{},style:{lineJoin:"round"}},t,{linkable:!1,closePath:!1,fill:!1}),i=e.points.length;return i<2&&(0===i?(e.points.push([0,0]),e.points.push([10,10])):1===i&&e.points.push([10,10])),(e=l(l({},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}}]),D),Qs=(i(mo,E),fs=a(mo),e(mo,[{key:"initEvents",value:function(){h(r(mo.prototype),"initEvents",this).call(this),this.once(et,this.beforeRenderHandler,this),this.once(ot,this.beforeRemoveHandler,this)}},{key:"beforeRenderHandler",value:function(t){this.evtBus.on(at,this.hookMouseDownHandler,this),this.evtBus.on(ht,this.hookMouseMoveHandler,this),this.evtBus.on(lt,this.hookMouseUpHandler,this),this.evtBus.on("mouseup",this.globalMouseUpHandler,this)}},{key:"beforeRemoveHandler",value:function(t){this.evtBus.off(at,this.hookMouseDownHandler,this),this.evtBus.off(ht,this.hookMouseMoveHandler,this),this.evtBus.off(lt,this.hookMouseUpHandler,this),this.evtBus.off("mouseup",this.globalMouseUpHandler,this),this._hostComponent=null}},{key:"globalMouseUpHandler",value:function(){this.setState({display:!1})}},{key:"hookMouseDownHandler",value:function(t){console.log("linkslot, hook mousedown event..."),this._hostComponent&&this.setState({display:!0})}},{key:"hookMouseMoveHandler",value:function(t){t=t.target;this.isIntersectWithHook(t)?(this.setState({style:{fillStyle:"#fffb00"}}),t._currentAboveSlot=this,t.setState({style:{fillStyle:"#fffb00"}})):(this.setState({style:{fillStyle:"#3ce92c"}}),t._currentAboveSlot===this&&t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"hookMouseUpHandler",value:function(t){var e,i;this._hostComponent&&(e=(t=t.target).parentNode.targetComponent,i=t.state.position,this.isIntersectWithHook(t)?e&&e.setLink(i,this._hostComponent,this.props.position):e&&e.removeLink(i,this._hostComponent,this.props.position),this.setState({display:!1,style:{fillStyle:"#3ce92c"}}),t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"isIntersectWithHook",value:function(t){var e=this.getMaxBoundingBox(),t=t.getMaxBoundingBox();return!!e.isIntersect(t)}},{key:"updatePosition",value:function(){console.log("link slot update position ...");var t=this._hostComponent.getMinBoundingBox(),e=0,i=0;switch(this.state.position){case"T":e=t.tc[0]-this.state.radius,i=t.tc[1]-this.state.radius;break;case"R":e=t.rc[0]-this.state.radius,i=t.rc[1]-this.state.radius;break;case"B":e=t.bc[0]-this.state.radius,i=t.bc[1]-this.state.radius;break;case"L":e=t.lc[0]-this.state.radius,i=t.lc[1]-this.state.radius}this.setState({left:e,top:i})}},{key:"hostComponent",get:function(){return this._hostComponent},set:function(t){var e=this;this._hostComponent&&this._hostComponent.off(it,this.updatePosition,this),this._hostComponent=t,this._hostComponent&&this._hostComponent.on(it,this.updatePosition,this),this._hostComponent&&this._hostComponent.once(ot,function(){e._hostComponent=null,e.setState({display:!1})},this),this._hostComponent&&this.setState({display:!0})}}]),mo),W=(i(go,f),ds=a(go),e(go,[{key:"calcDots",value:function(){var t=this.interpolate(),e=this.state,i=e.left,n=e.top,s=t[0][2];this.state.points=[],this.state.dots=[];for(var o=0;o<s.length;o++){var r=s[o];this.state.points.push([r.x,r.y]),this.state.dots.push([r.x-i,r.y-n])}return this.calcArrowPoints(),this.state.dots}},{key:"interpolate",value:function(){var t=this.state.points.length,e=this.state.points[0][0],i=this.state.points[0][1],n=this.state.points[t-1][0],t=this.state.points[t-1][1],s=new A(e,i),o=new A(n,t),r=[],a=null,h=null,l=[],u=new Bn,c=new Bn,e=this.links.start.component;if(e){u=e.getMinBoundingBox(),r[0]=new A(s.x,u.tl[1]-this.state.escapeDistance),r[1]=new A(u.tr[0]+this.state.escapeDistance,s.y),r[2]=new A(s.x,u.br[1]+this.state.escapeDistance),r[3]=new A(u.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])}i=this.links.end.component;if(i){c=i.getMinBoundingBox(),r[0]=new A(o.x,c.tl[1]-this.state.escapeDistance),r[1]=new A(c.tr[0]+this.state.escapeDistance,o.y),r[2]=new A(o.x,c.br[1]+this.state.escapeDistance),r[3]=new A(c.tl[0]-this.state.escapeDistance,o.y);for(var h=r[0],f=1;f<r.length;f++)this.distance(o,r[f])<this.distance(o,h)&&(h=r[f])}var n=0,t=[s],e=(a&&(t.push(a),n=1),h&&t.push(h),t.push(o),A.cloneArray(t)),i=(l.push(["s0","s0",e]),A.cloneArray(t)),e=A.cloneArray(i),t=(e.splice(n+1,0,new A(e[n].x,e[n+1].y)),l.push(["s1","s1_1",e]),A.cloneArray(i)),e=(t.splice(n+1,0,new A(t[n+1].x,t[n].y)),l.push(["s1","s1_2",t]),A.cloneArray(i)),t=new A((e[n].x+e[n+1].x)/2,e[n].y),p=new A((e[n].x+e[n+1].x)/2,e[n+1].y),t=(e.splice(n+1,0,t,p),l.push(["s2","s2_1",e]),A.cloneArray(i)),p=new A(t[n].x,(t[n].y+t[n+1].y)/2),e=new A(t[n+1].x,(t[n].y+t[n+1].y)/2),p=(t.splice(n+1,0,p,e),l.push(["s2","s2_2",t]),A.cloneArray(i)),e=[p[n].x+20,p[n+1].x+20],t=(u&&e.push(u.br[0]+20),c&&e.push(c.br[0]+20),this.max(e)),e=new A(t,p[n].y),t=new A(t,p[n+1].y),e=(p.splice(n+1,0,e,t),l.push(["s2","s2_3",p]),A.cloneArray(i)),t=[e[n].y-20,e[n+1].y-20],p=(u&&t.push(u.tl[1]-20),c&&t.push(c.tl[1]-20),this.min(t)),t=new A(e[n].x,p),p=new A(e[n+1].x,p),t=(e.splice(n+1,0,t,p),l.push(["s2","s2_4",e]),A.cloneArray(i)),p=[t[n].x-20,t[n+1].x-20],e=(u&&p.push(u.tl[0]-20),c&&p.push(c.tl[0]-20),this.min(p)),p=new A(e,t[n].y),e=new A(e,t[n+1].y),p=(t.splice(n+1,0,p,e),l.push(["s2","s2_5",t]),A.cloneArray(i)),e=[p[n].y+20,p[n+1].y+20],t=(u&&e.push(u.tl[1]+u.height+20),c&&e.push(c.tl[1]+c.height+20),this.max(e)),i=new A(p[n].x,t),e=new A(p[n+1].x,t);p.splice(n+1,0,i,e),l.push(["s2","s2_6",p]);for(var v=[],y=0;y<l.length;y++){var g=l[y][2];this.orthogonalPath(g)&&v.push(l[y])}if(l=v,!s.equals(o)){for(var m=[],b=0;b<l.length;b++){var k=l[b][2];this.forwardPath(k)&&m.push(l[b])}(l=m).length}for(var w=[],x=0;x<l.length;x++){var C=!1,P=l[x][2].slice();(c||u)&&(P=P.slice(1,P.length-1)),u&&(C=C||this.polylineIntersectsRectangle(P,u)),(C=c?C||this.polylineIntersectsRectangle(P,c):C)||w.push(l[x])}(l=0!=w.length?w:l).length;for(var S=l[0][2].length,M=[],O=0;O<l.length;O++)l[O][2].length==S&&M.push(l[O]);for(var l=M,E=0,_=0;_<l.length;_++)this.scorePath(l[E][2])<this.scorePath(l[_][2])&&(E=_);return[l[E]]}},{key:"orthogonalPath",value:function(t){if(t.length<=1)return!0;for(var e=0;e<t.length-1;e++)if(t[e].x!=t[e+1].x&&t[e].y!=t[e+1].y)return!1;return!0}},{key:"lineIntersectsLine",value:function(t,e){if(t.startPoint.x==t.endPoint.x&&e.startPoint.x==e.endPoint.x)return t.startPoint.x==e.startPoint.x&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));if(t.startPoint.x==t.endPoint.x||e.startPoint.x==e.endPoint.x)return t.startPoint.x==t.endPoint.x&&(s=t,t=e,e=s),s=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),i=t.startPoint.y-s*t.startPoint.x,n=e.startPoint.x,t.contains(n,s=s*n+i)&&e.contains(n,s);var i=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),n=t.startPoint.y-i*t.startPoint.x,s=(e.endPoint.y-e.startPoint.y)/(e.endPoint.x-e.startPoint.x),o=e.startPoint.y-s*e.startPoint.x;if(i==s)return n==o&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));o=(o-n)/(i-s),s=i*o+n;return t.contains(o,s)&&e.contains(o,s)}},{key:"polylineIntersectsRectangle",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]&&arguments[2],n=[];n.push(new Zs(new A(e.x1,e.y1),new A(e.x2,e.y1))),n.push(new Zs(new A(e.x2,e.y1),new A(e.x2,e.y2))),n.push(new Zs(new A(e.x2,e.y2),new A(e.x1,e.y2))),n.push(new Zs(new A(e.x1,e.y2),new A(e.x1,e.y1)));for(var s=0;s<t.length-1;s++)for(var o=new Zs(t[s],t[s+1]),r=0;r<n.length;r++)if(this.lineIntersectsLine(o,n[r]))return!0;if(i)for(var a=new Zs(t[t.length-1],t[0]),h=0;h<n.length;h++)if(this.lineIntersectsLine(a,n[h]))return!0;return!1}},{key:"scorePath",value:function(t){if(t.length<=2)return-1;for(var e=0,i=1;i<t.length-1;i++)if(t[i-1].x==t[i].x&&t[i].x==t[i+1].x){if(this.signum(t[i+1].y-t[i].y)!=this.signum(t[i].y-t[i-1].y))return-1;e++}else if(t[i-1].y==t[i].y&&t[i].y==t[i+1].y){if(this.signum(t[i+1].x-t[i].x)!=this.signum(t[i].x-t[i-1].x))return-1;e++}else e--;return e}},{key:"signum",value:function(t){return 0<t?1:t<0?-1:0}},{key:"forwardPath",value:function(t){if(t.length<=2)return!0;for(var e=0;e<t.length-2;e++)if(t[e].x==t[e+1].x&&t[e+1].x==t[e+2].x){if(0!=this.signum(t[e+1].y-t[e].y)&&this.signum(t[e+1].y-t[e].y)==-1*this.signum(t[e+2].y-t[e+1].y))return!1}else if(t[e].y==t[e+1].y&&t[e+1].y==t[e+2].y&&0!=this.signum(t[e+1].x-t[e].x)&&this.signum(t[e+1].x-t[e].x)==-1*this.signum(t[e+2].x-t[e+1].x))return!1;return!0}},{key:"distance",value:function(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}},{key:"max",value:function(t){if(0==t.lenght)return NaN;for(var e=t[0],i=0;i<t.length;i++)e<t[i]&&(e=t[i]);return e}},{key:"min",value:function(t){if(0==t.lenght)return NaN;for(var e=t[0],i=0;i<t.length;i++)e>t[i]&&(e=t[i]);return e}},{key:"addDot",value:function(t,e){throw new Error("Can NOT add dot to ICEVisioLink mannually.")}},{key:"rmDot",value:function(t){throw new Error("Can NOT remove dot from ICEVisioLink mannually.")}}],[{key:"arrangeParam",value:function(t){return B(t.startPoint)&&(t.startPoint=[0,0]),B(t.endPoint)&&(t.endPoint=[10,10]),t.points=[u(t.startPoint),u(t.endPoint)],l({escapeDistance:30},t)}}]),go),x=(i(yo,w),cs=a(yo),e(yo,[{key:"calcDots",value:function(){this.state.dots=[];for(var t=2*Math.PI/this.state.edges,e=this.state.radius,i=0;i<this.state.edges;i++){var n=t*i-gt(this.state.startAngle),s=Math.floor(e*Math.cos(n)+e),n=Math.floor(e*Math.sin(n)+e);this.state.dots.push([s,n])}return this.state.dots}},{key:"calcComponentParams",value:function(){return this.dirty&&(this.calcDots(),this.state.width=2*this.state.radius,this.state.height=2*this.state.radius),{width:this.state.width,height:this.state.height}}},{key:"setState",value:function(t){B(t.radius)?B(t.width)?B(t.height)||(t.radius=t.height/2):t.radius=t.width/2:(t.width=2*t.radius,t.height=2*t.radius),h(r(yo.prototype),"setState",this).call(this,t)}}]),yo),d=(i(vo,w),us=a(vo),e(vo,[{key:"calcDots",value:function(){var t=this.state.radius,e=this.state.leafNum;this.state.dots=[];for(var i,n,s=Math.PI/this.state.pointNumber,o=0;i=t+t*Math.sin(e*o)*Math.cos(o),n=t+t*Math.sin(e*o)*Math.sin(o),this.state.dots.push([i,n]),!((o+=s)>=2*Math.PI););return this.state.dots}},{key:"calcComponentParams",value:function(){return this.dirty&&(this.calcDots(),this.state.width=2*this.state.radius,this.state.height=2*this.state.radius),{width:this.state.width,height:this.state.height}}},{key:"setState",value:function(t){B(t.radius)?B(t.width)?B(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),h(r(vo.prototype),"setState",this).call(this,t)}}]),vo),Gs=(i(po,w),ls=a(po),e(po,[{key:"calcDots",value:function(){this.state.dots=[];for(var t,e,i=gt(this.state.startAngle),n=Math.PI/this.state.spikes,s=this.state.outerRadius,o=this.state.innerRadius,r=0;r<this.state.spikes;r++)t=Math.cos(i)*s+s,e=Math.sin(i)*s+s,this.state.dots.push([t,e]),i+=n,t=Math.cos(i)*o+s,e=Math.sin(i)*o+s,this.state.dots.push([t,e]),i+=n;return this.state.dots}},{key:"calcComponentParams",value:function(){return this.dirty&&(this.calcDots(),this.state.width=2*this.state.outerRadius,this.state.height=2*this.state.outerRadius),{width:this.state.width,height:this.state.height}}},{key:"setState",value:function(t){B(t.outerRadius)?B(t.width)?B(t.height)||(t.outerRadius=t.height/2):t.outerRadius=t.width/2:(t.width=2*t.outerRadius,t.height=2*t.outerRadius),h(r(po.prototype),"setState",this).call(this,t)}}]),po),Ys=(i(fo,m),hs=a(fo),e(fo,[{key:"initEvents",value:function(){this.on(st,this.measureText,this)}},{key:"measureText",value:function(t){try{var e,i=this.root.document.createElement("div"),n={padding:"0",margin:"0",border:"none",position:"absolute",top:"0",left:"0",fontFamily:this.state.style.fontFamily,fontWeight:this.state.style.fontWeight,fontSize:this.state.style.fontSize+"px"};for(e in n)i.style[e]=n[e];i.contenteditable=!1,i.innerHTML=this.state.text,this.root.document.body.appendChild(i);var s={width:i.offsetWidth,height:i.offsetHeight};this.props.width=s.width,this.props.height=s.height,this.state.width=s.width,this.state.height=s.height}finally{this.root.document.body.removeChild(i)}}},{key:"doRender",value:function(){this.state.stroke&&this.ctx.strokeText(this.state.text,0-this.state.localOrigin[0],0-this.state.localOrigin[1]+this.state.height,this.state.width),this.state.fill&&this.ctx.fillText(this.state.text,0-this.state.localOrigin[0],0-this.state.localOrigin[1]+this.state.height,this.state.width),h(r(fo.prototype),"doRender",this).call(this)}}]),fo),$s=(e(co,[{key:"start",value:function(){return this.ice.evtBus.on("mousedown",this.mouseDownHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off("mousedown",this.mouseDownHandler,this),this.ice.evtBus.off("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.off("mouseup",this.mouseUpHandler,this),this}},{key:"mouseDownHandler",value:function(t){t=t.target;t.ice?t.state.interactive&&t.state.draggable&&(this.currentObj=t,this.ice.evtBus.on("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.on("mouseup",this.mouseUpHandler,this)):console.warn("DDManager: 点击在 canvas 画布上,没有点击任何图形。")}},{key:"mouseMoveHandler",value:function(t){var e=t.movementX,i=t.movementY;return this.currentObj.moveGlobalPosition(e,i,t),!0}},{key:"mouseUpHandler",value:function(t){this.ice.evtBus.off("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.off("mouseup",this.mouseUpHandler,this)}}]),co),N={evtBuses:[],start:function(){if(_&&_.addEventListener)for(var t=0;t<N.evtBuses.length;t++)!function(t){for(var i=N.evtBuses[t],e=0;e<Us.length;e++)!function(t){var e=Us[t];_.addEventListener(e[0],function(t){i.trigger(e[1],t)})}(e)}(t)},regitserEvtBus:function(t){N.evtBuses.includes(t)||N.evtBuses.push(t)},delEvtBus:function(t){N.evtBuses.includes(t)&&N.evtBuses.splice(N.evtBuses.indexOf(t),1)}},j={evtBuses:[],stopped:!1,frameCallback:function(){for(var t=0;t<j.evtBuses.length;t++){if(j.stopped)return;j.evtBuses[t].trigger(tt)}j.stopped||_.requestFrame(j.frameCallback)},start:function(){j.stopped=!1,_.requestFrame(j.frameCallback)},stop:function(){j.stopped=!0},pause:function(){},resume:function(){},regitserEvtBus:function(t){j.evtBuses.includes(t)||j.evtBuses.push(t)},delEvtBus:function(t){j.evtBuses.includes(t)&&j.evtBuses.splice(j.evtBuses.indexOf(t),1)}},to=(e(uo,[{key:"start",value:function(){return this.createLinkSlots(),this.ice.evtBus.on(ht,this.hookMouseMoveHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off(ht,this.hookMouseMoveHandler,this),this}},{key:"hookMouseMoveHandler",value:function(t){for(var e=t.target.getMaxBoundingBox(),i=u(this.ice.childNodes),n=0;n<i.length;n++){var s=i[n];if(s&&s.state.linkable&&s.getMaxBoundingBox().isIntersect(e)){for(var o=0;o<this.ice._linkSlots.length;o++)this.ice._linkSlots[o].hostComponent=s;return}}}},{key:"createLinkSlots",value:function(){var t,e,i,n;this.ice._linkSlots&&this.ice._linkSlots.length||(t=new Qs({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"T",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(t),e=new Qs({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"R",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(e),i=new Qs({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"B",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(i),n=new Qs({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"L",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(n),this.ice._linkSlots=[t,e,i,n])}}]),uo),eo={ICERect:k,ICECircle:E,ICEEllipse:g,ICEStar:Gs,ICEIsogon:x,ICEText:Ys,ICEImage:C,ICEGroup:Pe,ICEVisioLink:W,ICEPolyLine:f},io=(e(lo,[{key:"fromJSON",value:function(t){for(var e=JSON.parse(t).childNodes,i=0;i<e.length;i++)this.decodeRecursively(this.ice,e[i])}},{key:"decodeRecursively",value:function(t,e){var i=new eo[e.type](e.state),n=(t.addChild(i),e.childNodes);if(n&&n.length)for(var s=0;s<n.length;s++)this.decodeRecursively(i,n[s])}}]),lo),no=(e(ho,[{key:"toJSON",value:function(){for(var t={createTime:(new Date).toLocaleString(),lastModifyTime:(new Date).toLocaleString(),childNodes:[]},e=0;e<this.ice.childNodes.length;e++){var i=this.ice.childNodes[e];this.encodeRecursively(i,t)}return console.log(t),JSON.stringify(t)}},{key:"encodeRecursively",value:function(t,e){var i={state:t.state,type:t.constructor.name,childNodes:[]};if(e.childNodes.push(i),t.childNodes&&t.childNodes.length)for(var n=0;n<t.childNodes.length;n++)this.encodeRecursively(t.childNodes[n],i)}}]),ho),so=(i(ao,c),as=a(ao),e(ao,[{key:"start",value:function(){return this.stopped=!1,this.ice.evtBus.on(tt,this.frameEvtHandler,this),this}},{key:"stop",value:function(){return this.stopped=!0,this.ice.evtBus.off(tt,this.frameEvtHandler,this),this}},{key:"frameEvtHandler",value:function(t){this.ice.dirty?this.doRender():console.log("没有需要渲染的组件...")}},{key:"refreshQueue",value:function(){this.componentQueue=Dn([],this.ice.childNodes),this.componentQueue.sort(function(t,e){return t.state.zIndex-e.state.zIndex}),console.log("Component Queue length> ".concat(this.componentQueue.length)),this.toolsQueue=Dn([],this.ice.toolNodes),console.log("Tool Queue length> ".concat(this.ice.toolNodes.length))}},{key:"doRender",value:function(){var t=Date.now();this.refreshQueue(),this.ice.ctx.clearRect(0,0,this.ice.canvasWidth,this.ice.canvasHeight);for(var e=0;e<this.componentQueue.length;e++){var i=this.componentQueue[e];i.root=this.ice.root,i.ctx=this.ice.ctx,i.evtBus=this.ice.evtBus,i.ice=this.ice,i.render()}for(var n=0;n<this.toolsQueue.length;n++){var s=this.toolsQueue[n];s.root=this.ice.root,s.ctx=this.ice.ctx,s.evtBus=this.ice.evtBus,s.ice=this.ice,s.render()}console.log("Render time ".concat(Date.now()-t," ms.")),this.ice.dirty=!1,this.ice.evtBus.trigger(rt)}}]),ao),oo=(e(ro,[{key:"setImage",value:function(t){var e=this,i=this.imageCache.get(t);return i||((i=new Image).onload=function(){e.ice.dirty=!0},i.onerror=function(){console.error("ImageCache: 图片加载失败:",t)},i.src=t,this.imageCache.size>ro.CACHE_SIZE&&this.imageCache.delete(this.imageCache.keys().next().value),this.imageCache.set(t,i)),{loaded:this.loaded(i),image:i}}},{key:"loaded",value:function(t){return t.complete&&0<t.naturalWidth}}]),ro);function ro(t){s(this,ro),n(this,"imageCache",new Map),this.ice=t}function ao(t){var e;return s(this,ao),n(o(e=as.call(this)),"stopped",!1),n(o(e),"componentQueue",[]),n(o(e),"toolsQueue",[]),e.ice=t,e}function ho(t){s(this,ho),this.ice=t}function lo(t){s(this,lo),this.ice=t}function uo(t){s(this,uo),n(this,"slotRadius",10),this.ice=t}function co(t){s(this,co),this.ice=t}function fo(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,fo),hn({text:"",left:0,top:0,width:10,height:10,style:{fontWeight:"bold",fontSize:32,fontFamily:"Arial",lineWidth:1}},t));return t.style=l(l({},t.style),{},{font:"".concat(t.style.fontWeight," ").concat(t.style.fontSize,"px ").concat(t.style.fontFamily),textBaseline:"bottom"}),hs.call(this,t)}function po(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,po),l({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,ls.call(this,t)}function vo(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,vo),l({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,us.call(this,t)}function yo(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,yo),l({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,cs.call(this,t)}function go(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,go),t=go.arrangeParam(t),ds.call(this,t)}function mo(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,mo),fs.call(this,l({linkable:!1,draggable:!1,position:"T"},t))}function D(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s(this,D),D.arrangeParam(t));return n(o(t=ps.call(this,t)),"__typeName","ICEPolyLine"),n(o(t),"links",{start:{},end:{}}),t}function bo(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return s(this,bo),vs.call(this,l({width:100,height:100,src:"data:image/png;base64,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"},t))}function ko(t){return s(this,ko),ys.call(this,l({dots:[],closePath:!0},t))}function wo(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;s(this,wo),this.x=t,this.y=e}function xo(t,e){s(this,xo),this.startPoint=t,this.endPoint=e}function Co(){return s(this,Co),gs.call(this)}function Po(t){s(this,Po),n(this,"selectionCandidates",[]),n(this,"_stopped",!1),this.ice=t}function So(t){s(this,So),this.ice=t,this.transformControlPanel=new Ws({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 Gn({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 Mo(t){return s(this,Mo),n(o(t=ms.call(this,l(l({},t),{},{zIndex:10000001,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"rotateControlSize",8),n(o(t),"rotateControlffsetY",60),n(o(t),"resizeControlInstanceCache",[]),n(o(t),"resizeControlSize",16),t.initControls(),t}function Oo(t){return s(this,Oo),bs.call(this,l(l({},t),{},{linkable:!1}))}function Eo(){throw s(this,Eo),new Error("GeoUtil is a static util class.")}function _o(t){return s(this,_o),ks.call(this,l(l({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}n(oo,"CACHE_SIZE",100);e(Io,[{key:"init",value:function(t){if(!t)throw new Error("ICE.init() failed...");if(this.ctx===t)throw new Error("同一个 canvas 实例只能 init 一次...");return this.root=_,q(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 Ks,j.regitserEvtBus(this.evtBus),j.start(),N.regitserEvtBus(this.evtBus),N.start(),this.eventBridge=new Fs(this).start(),this.animationManager=new ft(this).start(),this.ddManager=new $s(this).start(),this.controlPanelManager=new Js(this).start(),this.renderer=new so(this).start(),this.linkSlotManager=new to(this).start(),this.serializer=new no(this),this.deserializer=new io(this),this.imageCache=new oo(this),this}},{key:"addTool",value:function(t){-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(nt,null,{component:t}),t.trigger(nt),t.ice=this,t.root=this.root,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.dirty=!0,this.evtBus.trigger(st,null,{component:t}),t.trigger(st))}},{key:"removeTool",value:function(t){this.evtBus.trigger(ot,null,{component:t}),t.destory(),this.toolNodes.splice(this.toolNodes.indexOf(t),1),this.dirty=!0}},{key:"addChild",value:function(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(nt,null,{component:t}),t.trigger(nt),t.ice=this,t.root=this.root,t.ctx=this.ctx,t.evtBus=this.evtBus,t.parentNode=null,this.childNodes.push(t),Object.keys(t.props.animations).length&&this.animationManager.add(t),this.dirty=e,this.evtBus.trigger(st,null,{component:t}),t.trigger(st))}},{key:"addChildren",value:function(t){for(var e=0;e<t.length;e++)this.addChild(t[e],!1);this.dirty=!0}},{key:"removeChild",value:function(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];this.evtBus.trigger(ot,null,{component:t}),t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1),this.dirty=e}},{key:"removeChildren",value:function(t){for(var e=0;e<t.length;e++)this.removeChild(t[e],!1);this.dirty=!0}},{key:"clearAll",value:function(){this.removeChildren(u(this.childNodes))}},{key:"findComponent",value:function(e){return this.childNodes.filter(function(t){return t.props.id===e})[0]}},{key:"dirty",get:function(){return this.__dirty},set:function(t){this.__dirty=t}},{key:"toJSON",value:function(){return this.serializer.toJSON()}},{key:"fromJSON",value:function(t){var e=this,i=Date.now(),t=(j.stop(),this.renderer.stop(),this.eventBridge.stopped=!0,this.animationManager.stop(),this.ddManager.stop(),this.controlPanelManager.stop(),this.linkSlotManager.stop(),this.clearAll(),this.deserializer.fromJSON(t),j.start(),this.renderer.start(),this.animationManager.start(),this.ddManager.start(),this.controlPanelManager.start(),this.linkSlotManager.start(),setTimeout(function(){e.eventBridge.stopped=!1},300),Date.now());console.log("fromJSON> ".concat(t-i," ms"))}}]);var Bo=Io;function Io(){s(this,Io),n(this,"childNodes",[]),n(this,"toolNodes",[]),n(this,"canvasWidth",0),n(this,"canvasHeight",0),n(this,"selectionList",[]),n(this,"__dirty",!0),n(this,"_lastUpdateTime",Date.now())}t.AnimationManager=ft,t.CanvasRenderer=so,t.DOMEventBridge=Fs,t.EventBus=Ks,t.GeoLine=Zs,t.GeoPoint=A,t.GeoUtil=qs,t.ICE=Bo,t.ICEBezier=M,t.ICEBoundingBox=Bn,t.ICECircle=E,t.ICEComponent=m,t.ICEControlPanel=b,t.ICEControlPanelManager=Js,t.ICEDotPath=w,t.ICEEllipse=g,t.ICEEventTarget=c,t.ICEGroup=Pe,t.ICEImage=C,t.ICEIsogon=x,t.ICELinkHook=Qn,t.ICELinkSlot=Qs,t.ICEMatrix=In,t.ICEPath=P,t.ICEPolyLine=f,t.ICERect=k,t.ICERose=d,t.ICEStar=Gs,t.ICEText=Ys,t.ICEVisioLink=W,t.LineControlPanel=Gn,t.ResizeControl=Vs,t.RotateControl=Xs,t.TransformControlPanel=Ws,Object.defineProperty(t,"__esModule",{value:!0})});
|
package/package.json
CHANGED