@logicflow/core 2.0.0-beta.3 → 2.0.0-beta.5
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/.turbo/turbo-build$colon$dev.log +2 -2
- package/.turbo/turbo-build.log +6 -6
- package/__tests__/bugs/1545-spec.test.ts +19 -15
- package/__tests__/util/edge.test.ts +57 -57
- package/dist/index.min.js +1 -1
- package/es/constant/index.d.ts +2 -1
- package/es/constant/index.js +1 -0
- package/es/constant/index.js.map +1 -1
- package/es/event/eventArgs.d.ts +6 -0
- package/es/event/eventEmitter.js +0 -1
- package/es/event/eventEmitter.js.map +1 -1
- package/es/model/GraphModel.d.ts +12 -1
- package/es/model/GraphModel.js +21 -2
- package/es/model/GraphModel.js.map +1 -1
- package/es/model/edge/BaseEdgeModel.d.ts +2 -2
- package/es/model/edge/BaseEdgeModel.js.map +1 -1
- package/es/view/Graph.d.ts +1 -0
- package/es/view/Graph.js +4 -0
- package/es/view/Graph.js.map +1 -1
- package/lib/constant/index.d.ts +2 -1
- package/lib/constant/index.js +1 -0
- package/lib/constant/index.js.map +1 -1
- package/lib/event/eventArgs.d.ts +6 -0
- package/lib/event/eventEmitter.js +0 -1
- package/lib/event/eventEmitter.js.map +1 -1
- package/lib/model/GraphModel.d.ts +12 -1
- package/lib/model/GraphModel.js +21 -2
- package/lib/model/GraphModel.js.map +1 -1
- package/lib/model/edge/BaseEdgeModel.d.ts +2 -2
- package/lib/model/edge/BaseEdgeModel.js.map +1 -1
- package/lib/view/Graph.d.ts +1 -0
- package/lib/view/Graph.js +4 -0
- package/lib/view/Graph.js.map +1 -1
- package/package.json +1 -1
- package/src/constant/index.ts +1 -0
- package/src/event/eventArgs.ts +6 -0
- package/src/event/eventEmitter.ts +1 -2
- package/src/model/GraphModel.ts +22 -2
- package/src/model/edge/BaseEdgeModel.ts +1 -1
- package/src/options.ts +1 -1
- package/src/view/Graph.tsx +5 -1
- package/tsconfig.json +1 -1
package/dist/index.min.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
23
23
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
24
24
|
*/
|
|
25
|
-
var Yg,Vg,Fg=4294967295,Kg=Array.prototype,qg=Object.prototype.hasOwnProperty,Zg=fo?fo.iterator:void 0,$g=Math.max,Jg=Math.min,Qg=function(t){return function(e,n,r){if(null==r){var o=Ho(n),i=o&&Cs(n),a=i&&i.length&&Of(n,i);(a?a.length:o)||(r=n,n=e,e=this)}return t(e,n,r)}}(Wh);Hi.after=Cg.after,Hi.ary=Cg.ary,Hi.assign=Bg.assign,Hi.assignIn=Bg.assignIn,Hi.assignInWith=Bg.assignInWith,Hi.assignWith=Bg.assignWith,Hi.at=Bg.at,Hi.before=Cg.before,Hi.bind=Cg.bind,Hi.bindAll=Ug.bindAll,Hi.bindKey=Cg.bindKey,Hi.castArray=Ig.castArray,Hi.chain=zg.chain,Hi.chunk=Ng.chunk,Hi.compact=Ng.compact,Hi.concat=Ng.concat,Hi.cond=Ug.cond,Hi.conforms=Ug.conforms,Hi.constant=Ug.constant,Hi.countBy=Dg.countBy,Hi.create=Bg.create,Hi.curry=Cg.curry,Hi.curryRight=Cg.curryRight,Hi.debounce=Cg.debounce,Hi.defaults=Bg.defaults,Hi.defaultsDeep=Bg.defaultsDeep,Hi.defer=Cg.defer,Hi.delay=Cg.delay,Hi.difference=Ng.difference,Hi.differenceBy=Ng.differenceBy,Hi.differenceWith=Ng.differenceWith,Hi.drop=Ng.drop,Hi.dropRight=Ng.dropRight,Hi.dropRightWhile=Ng.dropRightWhile,Hi.dropWhile=Ng.dropWhile,Hi.fill=Ng.fill,Hi.filter=Dg.filter,Hi.flatMap=Dg.flatMap,Hi.flatMapDeep=Dg.flatMapDeep,Hi.flatMapDepth=Dg.flatMapDepth,Hi.flatten=Ng.flatten,Hi.flattenDeep=Ng.flattenDeep,Hi.flattenDepth=Ng.flattenDepth,Hi.flip=Cg.flip,Hi.flow=Ug.flow,Hi.flowRight=Ug.flowRight,Hi.fromPairs=Ng.fromPairs,Hi.functions=Bg.functions,Hi.functionsIn=Bg.functionsIn,Hi.groupBy=Dg.groupBy,Hi.initial=Ng.initial,Hi.intersection=Ng.intersection,Hi.intersectionBy=Ng.intersectionBy,Hi.intersectionWith=Ng.intersectionWith,Hi.invert=Bg.invert,Hi.invertBy=Bg.invertBy,Hi.invokeMap=Dg.invokeMap,Hi.iteratee=Ug.iteratee,Hi.keyBy=Dg.keyBy,Hi.keys=Cs,Hi.keysIn=Bg.keysIn,Hi.map=Dg.map,Hi.mapKeys=Bg.mapKeys,Hi.mapValues=Bg.mapValues,Hi.matches=Ug.matches,Hi.matchesProperty=Ug.matchesProperty,Hi.memoize=Cg.memoize,Hi.merge=Bg.merge,Hi.mergeWith=Bg.mergeWith,Hi.method=Ug.method,Hi.methodOf=Ug.methodOf,Hi.mixin=Qg,Hi.negate=Fh,Hi.nthArg=Ug.nthArg,Hi.omit=Bg.omit,Hi.omitBy=Bg.omitBy,Hi.once=Cg.once,Hi.orderBy=Dg.orderBy,Hi.over=Ug.over,Hi.overArgs=Cg.overArgs,Hi.overEvery=Ug.overEvery,Hi.overSome=Ug.overSome,Hi.partial=Cg.partial,Hi.partialRight=Cg.partialRight,Hi.partition=Dg.partition,Hi.pick=Bg.pick,Hi.pickBy=Bg.pickBy,Hi.property=Ug.property,Hi.propertyOf=Ug.propertyOf,Hi.pull=Ng.pull,Hi.pullAll=Ng.pullAll,Hi.pullAllBy=Ng.pullAllBy,Hi.pullAllWith=Ng.pullAllWith,Hi.pullAt=Ng.pullAt,Hi.range=Ug.range,Hi.rangeRight=Ug.rangeRight,Hi.rearg=Cg.rearg,Hi.reject=Dg.reject,Hi.remove=Ng.remove,Hi.rest=Cg.rest,Hi.reverse=Ng.reverse,Hi.sampleSize=Dg.sampleSize,Hi.set=Bg.set,Hi.setWith=Bg.setWith,Hi.shuffle=Dg.shuffle,Hi.slice=Ng.slice,Hi.sortBy=Dg.sortBy,Hi.sortedUniq=Ng.sortedUniq,Hi.sortedUniqBy=Ng.sortedUniqBy,Hi.split=Hg.split,Hi.spread=Cg.spread,Hi.tail=Ng.tail,Hi.take=Ng.take,Hi.takeRight=Ng.takeRight,Hi.takeRightWhile=Ng.takeRightWhile,Hi.takeWhile=Ng.takeWhile,Hi.tap=zg.tap,Hi.throttle=Cg.throttle,Hi.thru=qv,Hi.toArray=Ig.toArray,Hi.toPairs=Bg.toPairs,Hi.toPairsIn=Bg.toPairsIn,Hi.toPath=Ug.toPath,Hi.toPlainObject=Ig.toPlainObject,Hi.transform=Bg.transform,Hi.unary=Cg.unary,Hi.union=Ng.union,Hi.unionBy=Ng.unionBy,Hi.unionWith=Ng.unionWith,Hi.uniq=Ng.uniq,Hi.uniqBy=Ng.uniqBy,Hi.uniqWith=Ng.uniqWith,Hi.unset=Bg.unset,Hi.unzip=Ng.unzip,Hi.unzipWith=Ng.unzipWith,Hi.update=Bg.update,Hi.updateWith=Bg.updateWith,Hi.values=Bg.values,Hi.valuesIn=Bg.valuesIn,Hi.without=Ng.without,Hi.words=Hg.words,Hi.wrap=Cg.wrap,Hi.xor=Ng.xor,Hi.xorBy=Ng.xorBy,Hi.xorWith=Ng.xorWith,Hi.zip=Ng.zip,Hi.zipObject=Ng.zipObject,Hi.zipObjectDeep=Ng.zipObjectDeep,Hi.zipWith=Ng.zipWith,Hi.entries=Bg.toPairs,Hi.entriesIn=Bg.toPairsIn,Hi.extend=Bg.assignIn,Hi.extendWith=Bg.assignInWith,Qg(Hi,Hi),Hi.add=jg.add,Hi.attempt=Ug.attempt,Hi.camelCase=Hg.camelCase,Hi.capitalize=Hg.capitalize,Hi.ceil=jg.ceil,Hi.clamp=kg,Hi.clone=Ig.clone,Hi.cloneDeep=Ig.cloneDeep,Hi.cloneDeepWith=Ig.cloneDeepWith,Hi.cloneWith=Ig.cloneWith,Hi.conformsTo=Ig.conformsTo,Hi.deburr=Hg.deburr,Hi.defaultTo=Ug.defaultTo,Hi.divide=jg.divide,Hi.endsWith=Hg.endsWith,Hi.eq=Ig.eq,Hi.escape=Hg.escape,Hi.escapeRegExp=Hg.escapeRegExp,Hi.every=Dg.every,Hi.find=Dg.find,Hi.findIndex=Ng.findIndex,Hi.findKey=Bg.findKey,Hi.findLast=Dg.findLast,Hi.findLastIndex=Ng.findLastIndex,Hi.findLastKey=Bg.findLastKey,Hi.floor=jg.floor,Hi.forEach=Dg.forEach,Hi.forEachRight=Dg.forEachRight,Hi.forIn=Bg.forIn,Hi.forInRight=Bg.forInRight,Hi.forOwn=Bg.forOwn,Hi.forOwnRight=Bg.forOwnRight,Hi.get=Bg.get,Hi.gt=Ig.gt,Hi.gte=Ig.gte,Hi.has=Bg.has,Hi.hasIn=Bg.hasIn,Hi.head=Ng.head,Hi.identity=$o,Hi.includes=Dg.includes,Hi.indexOf=Ng.indexOf,Hi.inRange=Rg,Hi.invoke=Bg.invoke,Hi.isArguments=Ig.isArguments,Hi.isArray=No,Hi.isArrayBuffer=Ig.isArrayBuffer,Hi.isArrayLike=Ig.isArrayLike,Hi.isArrayLikeObject=Ig.isArrayLikeObject,Hi.isBoolean=Ig.isBoolean,Hi.isBuffer=Ig.isBuffer,Hi.isDate=Ig.isDate,Hi.isElement=Ig.isElement,Hi.isEmpty=Ig.isEmpty,Hi.isEqual=Ig.isEqual,Hi.isEqualWith=Ig.isEqualWith,Hi.isError=Ig.isError,Hi.isFinite=Ig.isFinite,Hi.isFunction=Ig.isFunction,Hi.isInteger=Ig.isInteger,Hi.isLength=Ig.isLength,Hi.isMap=Ig.isMap,Hi.isMatch=Ig.isMatch,Hi.isMatchWith=Ig.isMatchWith,Hi.isNaN=Ig.isNaN,Hi.isNative=Ig.isNative,Hi.isNil=Ig.isNil,Hi.isNull=Ig.isNull,Hi.isNumber=Ig.isNumber,Hi.isObject=Ho,Hi.isObjectLike=Ig.isObjectLike,Hi.isPlainObject=Ig.isPlainObject,Hi.isRegExp=Ig.isRegExp,Hi.isSafeInteger=Ig.isSafeInteger,Hi.isSet=Ig.isSet,Hi.isString=Ig.isString,Hi.isSymbol=Ig.isSymbol,Hi.isTypedArray=Ig.isTypedArray,Hi.isUndefined=Ig.isUndefined,Hi.isWeakMap=Ig.isWeakMap,Hi.isWeakSet=Ig.isWeakSet,Hi.join=Ng.join,Hi.kebabCase=Hg.kebabCase,Hi.last=zd,Hi.lastIndexOf=Ng.lastIndexOf,Hi.lowerCase=Hg.lowerCase,Hi.lowerFirst=Hg.lowerFirst,Hi.lt=Ig.lt,Hi.lte=Ig.lte,Hi.max=jg.max,Hi.maxBy=jg.maxBy,Hi.mean=jg.mean,Hi.meanBy=jg.meanBy,Hi.min=jg.min,Hi.minBy=jg.minBy,Hi.stubArray=Ug.stubArray,Hi.stubFalse=Ug.stubFalse,Hi.stubObject=Ug.stubObject,Hi.stubString=Ug.stubString,Hi.stubTrue=Ug.stubTrue,Hi.multiply=jg.multiply,Hi.nth=Ng.nth,Hi.noop=Ug.noop,Hi.now=Pg,Hi.pad=Hg.pad,Hi.padEnd=Hg.padEnd,Hi.padStart=Hg.padStart,Hi.parseInt=Hg.parseInt,Hi.random=Lg,Hi.reduce=Dg.reduce,Hi.reduceRight=Dg.reduceRight,Hi.repeat=Hg.repeat,Hi.replace=Hg.replace,Hi.result=Bg.result,Hi.round=jg.round,Hi.sample=Dg.sample,Hi.size=Dg.size,Hi.snakeCase=Hg.snakeCase,Hi.some=Dg.some,Hi.sortedIndex=Ng.sortedIndex,Hi.sortedIndexBy=Ng.sortedIndexBy,Hi.sortedIndexOf=Ng.sortedIndexOf,Hi.sortedLastIndex=Ng.sortedLastIndex,Hi.sortedLastIndexBy=Ng.sortedLastIndexBy,Hi.sortedLastIndexOf=Ng.sortedLastIndexOf,Hi.startCase=Hg.startCase,Hi.startsWith=Hg.startsWith,Hi.subtract=jg.subtract,Hi.sum=jg.sum,Hi.sumBy=jg.sumBy,Hi.template=Hg.template,Hi.times=Ug.times,Hi.toFinite=Ig.toFinite,Hi.toInteger=Zo,Hi.toLength=Ig.toLength,Hi.toLower=Hg.toLower,Hi.toNumber=Ig.toNumber,Hi.toSafeInteger=Ig.toSafeInteger,Hi.toString=Ig.toString,Hi.toUpper=Hg.toUpper,Hi.trim=Hg.trim,Hi.trimEnd=Hg.trimEnd,Hi.trimStart=Hg.trimStart,Hi.truncate=Hg.truncate,Hi.unescape=Hg.unescape,Hi.uniqueId=Ug.uniqueId,Hi.upperCase=Hg.upperCase,Hi.upperFirst=Hg.upperFirst,Hi.each=Dg.forEach,Hi.eachRight=Dg.forEachRight,Hi.first=Ng.head,Qg(Hi,(Yg={},sd(Hi,(function(t,e){qg.call(Hi.prototype,e)||(Yg[e]=t)})),Yg),{chain:!1}),Hi.VERSION="4.17.21",(Hi.templateSettings=Hg.templateSettings).imports._=Hi,Ji(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Hi[t].placeholder=Hi})),Ji(["drop","take"],(function(t,e){Di.prototype[t]=function(n){n=void 0===n?1:$g(Zo(n),0);var r=this.__filtered__&&!e?new Di(this):this.clone();return r.__filtered__?r.__takeCount__=Jg(n,r.__takeCount__):r.__views__.push({size:Jg(n,Fg),type:t+(r.__dir__<0?"Right":"")}),r},Di.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Ji(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;Di.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:nd(t),type:n}),e.__filtered__=e.__filtered__||r,e}})),Ji(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Di.prototype[t]=function(){return this[n](1).value()[0]}})),Ji(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Di.prototype[t]=function(){return this.__filtered__?new Di(this):this[n](1)}})),Di.prototype.compact=function(){return this.filter($o)},Di.prototype.find=function(t){return this.filter(t).head()},Di.prototype.findLast=function(t){return this.reverse().find(t)},Di.prototype.invokeMap=Qa((function(t,e){return"function"==typeof t?new Di(this):this.map((function(n){return sh(n,t,e)}))})),Di.prototype.reject=function(t){return this.filter(Fh(nd(t)))},Di.prototype.slice=function(t,e){t=Zo(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Di(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=Zo(e))<0?n.dropRight(-e):n.take(e-t)),n)},Di.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Di.prototype.toArray=function(){return this.take(Fg)},sd(Di.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),o=Hi[r?"take"+("last"==e?"Right":""):e],i=r||/^find/.test(e);o&&(Hi.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,s=e instanceof Di,u=a[0],l=s||No(e),c=function(t){var e=o.apply(Hi,du([t],a));return r&&p?e[0]:e};l&&n&&"function"==typeof u&&1!=u.length&&(s=l=!1);var p=this.__chain__,d=!!this.__actions__.length,f=i&&!p,h=s&&!d;if(!i&&l){e=h?e:new Di(this);var y=t.apply(e,a);return y.__actions__.push({func:qv,args:[c],thisArg:void 0}),new Ri(y,p)}return f&&h?t.apply(this,a):(y=this.thru(c),f?r?y.value()[0]:y.value():y)})})),Ji(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Kg[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Hi.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var o=this.value();return e.apply(No(o)?o:[],t)}return this[n]((function(n){return e.apply(No(n)?n:[],t)}))}})),sd(Di.prototype,(function(t,e){var n=Hi[e];if(n){var r=n.name+"";qg.call(Ii,r)||(Ii[r]=[]),Ii[r].push({name:e,func:n})}})),Ii[Ma(void 0,2).name]=[{name:"wrapper",func:void 0}],Di.prototype.clone=function(){var t=new Di(this.__wrapped__);return t.__actions__=Li(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Li(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Li(this.__views__),t},Di.prototype.reverse=function(){if(this.__filtered__){var t=new Di(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Di.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=No(t),r=e<0,o=n?t.length:0,i=function(t,e,n){for(var r=-1,o=n.length;++r<o;){var i=n[r],a=i.size;switch(i.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=Gg(e,t+a);break;case"takeRight":t=Xg(t,e-a)}}return{start:t,end:e}}(0,o,this.__views__),a=i.start,s=i.end,u=s-a,l=r?s:a-1,c=this.__iteratees__,p=c.length,d=0,f=Wg(u,this.__takeCount__);if(!n||!r&&o==u&&f==u)return Jv(t,this.__actions__);var h=[];t:for(;u--&&d<f;){for(var y=-1,v=t[l+=e];++y<p;){var g=c[y],_=g.iteratee,m=g.type,b=_(v);if(2==m)v=b;else if(!b){if(1==m)continue t;break t}}h[d++]=v}return h},Hi.prototype.at=zg.at,Hi.prototype.chain=zg.wrapperChain,Hi.prototype.commit=zg.commit,Hi.prototype.next=zg.next,Hi.prototype.plant=zg.plant,Hi.prototype.reverse=zg.reverse,Hi.prototype.toJSON=Hi.prototype.valueOf=Hi.prototype.value=zg.value,Hi.prototype.first=Hi.prototype.head,Zg&&(Hi.prototype[Zg]=zg.toIterator),t.Options=void 0,(Vg=t.Options||(t.Options={})).get=function(t){var e=ro(t,[]);if(!t.container)throw new Error("Ensure the container of LogicFlow is specified and valid.");return js({},Vg.defaults,e)},function(t){t.defaults={background:!1,grid:!1,textEdit:!0,snapline:!0,outline:!1,disabledTools:[]}}(t.Options||(t.Options={}));var t_={node:!1,edge:!1},e_={node:!0,edge:!0},n_=function(t){return t&&"boolean"!=typeof t?Uh(up(t_),t):up(!0===t?e_:t_)},r_=n_,o_=null!==cu(window,"navigator.userAgent","").match(/MSIE|Trident/);function i_(t){try{return JSON.parse(JSON.stringify(t))}catch(e){return t}}var a_,s_,u_,l_,c_,p_,d_=200;t.ElementState=void 0,(a_=t.ElementState||(t.ElementState={}))[a_.DEFAULT=1]="DEFAULT",a_[a_.TEXT_EDIT=2]="TEXT_EDIT",a_[a_.SHOW_MENU=3]="SHOW_MENU",a_[a_.ALLOW_CONNECT=4]="ALLOW_CONNECT",a_[a_.NOT_ALLOW_CONNECT=5]="NOT_ALLOW_CONNECT",t.ElementType=void 0,(s_=t.ElementType||(t.ElementType={})).NODE="node",s_.EDGE="edge",s_.GRAPH="graph",t.ModelType=void 0,(u_=t.ModelType||(t.ModelType={})).NODE="node",u_.CIRCLE_NODE="circle-node",u_.POLYGON_NODE="polygon-node",u_.RECT_NODE="rect-node",u_.TEXT_NODE="text-node",u_.ELLIPSE_NODE="ellipse-node",u_.DIAMOND_NODE="diamond-node",u_.HTML_NODE="html-node",u_.CUSTOM_HTML_NODE="custom-html-node",u_.EDGE="edge",u_.LINE_EDGE="line-edge",u_.POLYLINE_EDGE="polyline-edge",u_.BEZIER_EDGE="bezier-edge",u_.GRAPH="graph",t.EventType=void 0,(l_=t.EventType||(t.EventType={})).ELEMENT_CLICK="element:click",l_.NODE_ADD="node:add",l_.NODE_DELETE="node:delete",l_.NODE_CLICK="node:click",l_.NODE_DBCLICK="node:dbclick",l_.NODE_GROUP_COPY="node:group-copy-add",l_.NODE_DND_ADD="node:dnd-add",l_.NODE_DND_DRAG="node:dnd-drag",l_.NODE_MOUSEDOWN="node:mousedown",l_.NODE_DRAGSTART="node:dragstart",l_.NODE_DRAG="node:drag",l_.NODE_DROP="node:drop",l_.NODE_MOUSEUP="node:mouseup",l_.NODE_MOUSEMOVE="node:mousemove",l_.NODE_MOUSEENTER="node:mouseenter",l_.NODE_MOUSELEAVE="node:mouseleave",l_.NODE_CONTEXTMENU="node:contextmenu",l_.NODE_ROTATE="node:rotate",l_.NODE_RESIZE="node:resize",l_.NODE_PROPERTIES_CHANGE="node:properties-change",l_.NODE_PROPERTIES_DELETE="node:properties-delete",l_.EDGE_ADD="edge:add",l_.EDGE_DELETE="edge:delete",l_.EDGE_CLICK="edge:click",l_.EDGE_DBCLICK="edge:dbclick",l_.EDGE_MOUSEENTER="edge:mouseenter",l_.EDGE_MOUSELEAVE="edge:mouseleave",l_.EDGE_CONTEXTMENU="edge:contextmenu",l_.EDGE_ADJUST="edge:adjust",l_.EDGE_EXCHANGE_NODE="edge:exchange-node",l_.ANCHOR_DRAGSTART="anchor:dragstart",l_.ANCHOR_DRAG="anchor:drag",l_.ANCHOR_DROP="anchor:drop",l_.ANCHOR_DRAGEND="anchor:dragend",l_.ADJUST_POINT_MOUSEDOWN="adjustPoint:mousedown",l_.ADJUST_POINT_MOUSEUP="adjustPoint:mouseup",l_.ADJUST_POINT_MOUSEMOVE="adjustPoint:mousemove",l_.ADJUST_POINT_DRAGSTART="adjustPoint:dragstart",l_.ADJUST_POINT_DRAG="adjustPoint:drag",l_.ADJUST_POINT_DROP="adjustPoint:drop",l_.ADJUST_POINT_DRAGEND="adjustPoint:dragend",l_.BLANK_MOUSEDOWN="blank:mousedown",l_.BLANK_DRAGSTART="blank:dragstart",l_.BLANK_DRAG="blank:drag",l_.BLANK_DROP="blank:drop",l_.BLANK_MOUSEMOVE="blank:mousemove",l_.BLANK_MOUSEUP="blank:mouseup",l_.BLANK_CLICK="blank:click",l_.BLANK_CONTEXTMENU="blank:contextmenu",l_.SELECTION_MOUSEDOWN="selection:mousedown",l_.SELECTION_DRAGSTART="selection:dragstart",l_.SELECTION_DRAG="selection:drag",l_.SELECTION_DROP="selection:drop",l_.SELECTION_MOUSEMOVE="selection:mousemove",l_.SELECTION_MOUSEUP="selection:mouseup",l_.SELECTION_CONTEXTMENU="selection:contextmenu",l_.CONNECTION_NOT_ALLOWED="connection:not-allowed",l_.HISTORY_CHANGE="history:change",l_.TEXT_UPDATE="text:update",l_.GRAPH_TRANSFORM="graph:transform",l_.GRAPH_RENDERED="graph:rendered",function(t){t[t.DEFAULT=0]="DEFAULT",t[t.INCREASE=1]="INCREASE"}(c_||(c_={})),function(t){t.HORIZONTAL="horizontal",t.VERTICAL="vertical"}(p_||(p_={}));var f_=function(){function e(e){var n=e.onDragStart,r=void 0===n?Pi:n,o=e.onDragging,i=void 0===o?Pi:o,a=e.onDragEnd,s=void 0===a?Pi:a,u=e.eventType,l=void 0===u?"":u,c=e.eventCenter,p=e.step,d=void 0===p?1:p,f=e.isStopPropagation,h=void 0===f||f,y=e.model,v=e.data,g=this;this.isDragging=!1,this.isStartDragging=!1,this.startX=0,this.startY=0,this.sumDeltaX=0,this.sumDeltaY=0,this.handleMouseDown=function(e){var n,r,o=null===window||void 0===window?void 0:window.document;if(0===e.button){g.isStopPropagation&&e.stopPropagation(),g.isStartDragging=!0,g.startX=e.clientX,g.startY=e.clientY,o.addEventListener("mousemove",g.handleMouseMove,!1),o.addEventListener("mouseup",g.handleMouseUp,!1);var i=null===(n=g.model)||void 0===n?void 0:n.getData();null===(r=g.eventCenter)||void 0===r||r.emit(t.EventType["".concat(g.eventType,"_MOUSEDOWN")],{e:e,data:g.data||i}),g.startTime=(new Date).getTime()}},this.handleMouseMove=function(e){var n,r;if(g.isStopPropagation&&e.stopPropagation(),g.isStartDragging&&(g.sumDeltaX+=e.clientX-g.startX,g.sumDeltaY+=e.clientY-g.startY,g.startX=e.clientX,g.startY=e.clientY,g.step<=1||Math.abs(g.sumDeltaX)>g.step||Math.abs(g.sumDeltaY)>g.step)){var o=g.sumDeltaX%g.step,i=g.sumDeltaY%g.step,a=g.sumDeltaX-o,s=g.sumDeltaY-i;g.sumDeltaX=o,g.sumDeltaY=i;var u=null===(n=g.model)||void 0===n?void 0:n.getData();g.isDragging||(null===(r=g.eventCenter)||void 0===r||r.emit(t.EventType["".concat(g.eventType,"_DRAGSTART")],{e:e,data:g.data||u}),g.onDragStart({event:e})),g.isDragging=!0,Promise.resolve().then((function(){var n,r;g.onDragging({deltaX:a,deltaY:s,event:e}),null===(n=g.eventCenter)||void 0===n||n.emit(t.EventType["".concat(g.eventType,"_MOUSEMOVE")],{e:e,data:g.data||u}),null===(r=g.eventCenter)||void 0===r||r.emit(t.EventType["".concat(g.eventType,"_DRAG")],{e:e,data:g.data||u})}))}},this.handleMouseUp=function(e){var n=window.document;g.isStartDragging=!1,g.isStopPropagation&&e.stopPropagation(),Promise.resolve().then((function(){var r,o,i;n.removeEventListener("mousemove",g.handleMouseMove,!1),n.removeEventListener("mouseup",g.handleMouseUp,!1);var a=null===(r=g.model)||void 0===r?void 0:r.getData();null===(o=g.eventCenter)||void 0===o||o.emit(t.EventType["".concat(g.eventType,"_MOUSEUP")],{e:e,data:g.data||a}),g.isDragging&&(g.isDragging=!1,g.onDragEnd({event:e}),null===(i=g.eventCenter)||void 0===i||i.emit(t.EventType["".concat(g.eventType,"_DROP")],{e:e,data:g.data||a}))}))},this.cancelDrag=function(){var t=null===window||void 0===window?void 0:window.document;t.removeEventListener("mousemove",g.handleMouseMove,!1),t.removeEventListener("mouseup",g.handleMouseUp,!1),g.onDragEnd({event:null}),g.isDragging=!1},this.onDragStart=r,this.onDragging=i,this.onDragEnd=s,this.step=d,this.isStopPropagation=h,this.eventType=l,this.eventCenter=c,this.model=y,this.data=v}return e.prototype.setStep=function(t){this.step=t},e.prototype.setModel=function(t){this.model=t},e}(),h_=function(t){var e=t.start,n=t.end,r=t.offset,o=t.verticalLength,i=t.type,a={leftX:0,leftY:0,rightX:0,rightY:0},s=Math.atan((n.y-e.y)/(n.x-e.x)),u=Math.atan(r/o),l=Math.sqrt(o*o+r*r);return"start"===i?n.x>=e.x?(a.leftX=e.x+l*Math.sin(s+u),a.leftY=e.y-l*Math.cos(s+u),a.rightX=e.x-l*Math.sin(s-u),a.rightY=e.y+l*Math.cos(s-u)):(a.leftX=e.x-l*Math.sin(s+u),a.leftY=e.y+l*Math.cos(s+u),a.rightX=e.x+l*Math.sin(s-u),a.rightY=e.y-l*Math.cos(s-u)):"end"===i&&(n.x>=e.x?(a.leftX=n.x+l*Math.sin(s-u),a.leftY=n.y-l*Math.cos(s-u),a.rightX=n.x-l*Math.sin(s+u),a.rightY=n.y+l*Math.cos(s+u)):(a.leftX=n.x-l*Math.sin(s-u),a.leftY=n.y+l*Math.cos(s-u),a.rightX=n.x+l*Math.sin(s+u),a.rightY=n.y-l*Math.cos(s+u))),a},y_=function(t,e,n){var r=t.x,o=t.y,i=e.x,a=e.y,s=n.x,u=n.y,l=(u-a)/(s-i),c=a-l*i;return r>=i&&r<=s&&o>=a&&o<=u&&Math.abs(o-l*r+c)<Number.EPSILON},v_=function(t,e){return 2*Math.abs(t.centerX-e.centerX)<t.width+e.width&&2*Math.abs(t.centerY-e.centerY)<t.height+e.height},g_=function(t){var e=[],n={};return t.forEach((function(t){var e="".concat(t.x,"-").concat(t.y);t.id=e,n[e]=t})),Object.keys(n).forEach((function(t){e.push(n[t])})),e},__=function(t,e){return 0===t.width&&0===t.height?t:{x:t.x,y:t.y,centerX:t.centerX,centerY:t.centerY,minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e,height:t.height+2*e,width:t.width+2*e}},m_=function(t,e){var n=Math.abs(t.x-e.centerX),r=Math.abs(t.y-e.centerY);return n/e.width>r/e.height?p_.HORIZONTAL:p_.VERTICAL},b_=function(t,e,n){return m_(n,e)===p_.HORIZONTAL?{x:n.x>t.centerX?t.maxX:t.minX,y:n.y}:{x:n.x,y:n.y>t.centerY?t.maxY:t.minY}},E_=function(t,e){var n=Math.min(t.minX,e.minX),r=Math.min(t.minY,e.minY),o=Math.max(t.maxX,e.maxX),i=Math.max(t.maxY,e.maxY);return{x:(n+o)/2,y:(r+i)/2,centerX:(n+o)/2,centerY:(r+i)/2,minX:n,minY:r,maxX:o,maxY:i,height:i-r,width:o-n}},x_=function(t,e){void 0===t&&(t=[]);var n=[],r=[];t.forEach((function(t){n.push(t.x),r.push(t.y)}));var o=Math.min.apply(Math,ao([],io(n),!1)),i=Math.max.apply(Math,ao([],io(n),!1)),a=Math.min.apply(Math,ao([],io(r),!1)),s=Math.max.apply(Math,ao([],io(r),!1)),u=i-o,l=s-a;return e&&(u+=e,l+=e),{centerX:(o+i)/2,centerY:(a+s)/2,maxX:i,maxY:s,minX:o,minY:a,x:(o+i)/2,y:(a+s)/2,height:l,width:u}},w_=function(t){var e=t.minX,n=t.minY,r=t.maxX,o=t.maxY;return[{x:e,y:n},{x:r,y:n},{x:r,y:o},{x:e,y:o}]},S_=function(t,e){var n=t.x,r=t.y;return n<e.minX||n>e.maxX||r<e.minY||r>e.maxY},M_=function(t,e){return e<t.minX||e>t.maxX?[]:[{x:e,y:t.minY},{x:e,y:t.maxY}]},A_=function(t,e){return e<t.minY||e>t.maxY?[]:[{x:t.minX,y:e},{x:t.maxX,y:e}]},T_=function(t,e){return ao(ao([],io(M_(t,e.x)),!1),io(A_(t,e.y)),!1)},O_=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},N_=function(t,e){var n=0;return e.forEach((function(e){e&&(t.x===e.x&&(n+=-2),t.y===e.y&&(n+=-2))})),n},D_=function(t,e,n,r,o){return O_(t,e)+O_(t,n)+N_(t,[e,n,r,o])},P_=function(t,e,n,r,o){o||(o=0),t.unshift(e[r]),n[r]&&n[r]!==r&&o<=100&&P_(t,e,n,n[r],o+1)},C_=function(t,e){var n=t.indexOf(e);n>-1&&t.splice(n,1)},I_=function(t,e,n,r){var o=e.x-t.x,i=e.y-t.y,a=r.x-n.x,s=r.y-n.y,u=(-i*(t.x-n.x)+o*(t.y-n.y))/(-a*i+o*s),l=(a*(t.y-n.y)-s*(t.x-n.x))/(-a*i+o*s);return u>=0&&u<=1&&l>=0&&l<=1},j_=function(t,e,n){if(0===n.width&&0===n.height)return!1;var r=io(w_(n),4),o=r[0],i=r[1],a=r[2],s=r[3];return I_(t,e,o,i)||I_(t,e,o,s)||I_(t,e,i,a)||I_(t,e,a,s)},k_=function(t,e,n,r){var o=[];return t.forEach((function(t){t!==e&&(t.x!==e.x&&t.y!==e.y||j_(t,e,n)||j_(t,e,r)||o.push(t))})),g_(o)},R_=function(t,e,n,r,o,i,a){var s=[],u=[e],l={},c={},p={};e.id&&(c[e.id]=0,p[e.id]=D_(e,n,e));var d={};t.forEach((function(t){t.id&&(d[t.id]=t)}));for(var f=function(){var f,h=1/0;if(u.forEach((function(t){t.id&&p[t.id]<h&&(h=p[t.id],f=t)})),f===n&&n.id){var y=[];return P_(y,d,l,n.id),{value:y}}if(!f)return{value:[e,n]};C_(u,f),s.push(f),k_(t,f,r,o).forEach((function(t){if(-1===s.indexOf(t)&&(-1===u.indexOf(t)&&u.push(t),(null==f?void 0:f.id)&&(null==t?void 0:t.id))){var r=p[f.id]+O_(f,t);if(c[t.id]&&r>=c[t.id])return;l[t.id]=f.id,c[t.id]=r,p[t.id]=c[t.id]+D_(t,n,e,i,a)}}))};u.length;){var h=f();if("object"==typeof h)return h.value}return[e,n]},L_=function(t){return Mm(t)},B_=function(t){for(var e=1;e<t.length-1;){var n=t[e-1],r=t[e],o=t[e+1];n.x===r.x&&r.x===o.x||n.y===r.y&&r.y===o.y?t.splice(e,1):e++}return t},z_=function(t,e,n,r,o){var i=L_(n),a=L_(r),s=__(i,o),u=__(a,o),l=b_(s,i,t),c=b_(u,a,e);if(v_(s,u))return ao(ao([t,l],io(V_(t,e,l,c)),!1),[c,e],!1);var p=x_([l,c]),d=E_(s,p),f=E_(u,p),h=[];h=(h=h.concat(w_(d))).concat(w_(f));var y={x:(t.x+e.x)/2,y:(t.y+e.y)/2};[p,d,f].forEach((function(t){h=h.concat(T_(t,y).filter((function(t){return S_(t,s)&&S_(t,u)})))})),[{x:l.x,y:c.y},{x:c.x,y:l.y}].forEach((function(t){S_(t,s)&&S_(t,u)&&h.push(t)})),h.unshift(l),h.push(c),h=g_(h);var v=R_(h,l,c,i,a,t,e);return v.unshift(t),v.push(e),v.length>2&&(v=B_(v)),g_(v)},H_=function(t){var e;if(1===t.length)e=[t[0],t[0]];else if(t.length>=2){for(var n=t[0],r=t[1],o=xm(n.x,n.y,r.x,r.y),i=1;i<t.length-1;i++){var a=t[i],s=t[i+1],u=xm(a.x,a.y,s.x,s.y);u>o&&(o=u,n=a,r=s)}e=[n,r]}return e},U_=function(t,e,n){var r=wm(t,n),o=wm(e,n);return r&&o},X_=function(t,e,n){var r=wm(t,n),o=wm(e,n);return!(r&&o)&&(r||o)},G_=function(t,e,n){for(var r,o=void 0,i=Mm(n),a=w_(i),s=0;s<a.length;s++){I_(t,e,a[s],a[(s+1)%a.length])&&(o=[a[s],a[(s+1)%a.length]])}return o&&(r=function(t,e,n,r){var o=(e.y-t.y)*(r.x-n.x)-(t.x-e.x)*(n.y-r.y);if(0===o)return!1;var i=((e.x-t.x)*(r.x-n.x)*(n.y-t.y)+(e.y-t.y)*(r.x-n.x)*t.x-(r.y-n.y)*(e.x-t.x)*n.x)/o,a=-((e.y-t.y)*(r.y-n.y)*(n.x-t.x)+(e.x-t.x)*(r.y-n.y)*t.y-(r.x-n.x)*(e.y-t.y)*n.y)/o;return(i-t.x)*(i-e.x)<=0&&(a-t.y)*(a-e.y)<=0&&(i-n.x)*(i-r.x)<=0&&(a-n.y)*(a-r.y)<=0&&{x:i,y:a}}(t,e,o[0],o[1])),r},W_=function(t,e){var n=void 0;return t.x===e.x?n=p_.VERTICAL:t.y===e.y&&(n=p_.HORIZONTAL),n},Y_=function(t){var e=t.split(" "),n=[];return e&&e.forEach((function(t){var e=io(t.split(","),2),r=e[0],o=e[1];n.push({x:Number(r),y:Number(o)})})),n},V_=function(t,e,n,r){var o=[];if(W_(t,n)===W_(e,r))t.y===n.y?(o.push({x:n.x,y:(n.y+r.y)/2}),o.push({x:r.x,y:(n.y+r.y)/2})):(o.push({x:(n.x+r.x)/2,y:n.y}),o.push({x:(n.x+r.x)/2,y:r.y}));else{var i={x:n.x,y:r.y},a=y_(i,t,n),s=y_(i,e,r);if(a||s)i={x:r.x,y:n.y};else{var u=F_(i,t,n),l=F_(i,e,r);u&&l&&(i={x:r.x,y:n.y})}o.push(i)}return o},F_=function(t,e,n){return t.x===e.x&&t.x===n.x||t.y===e.y&&t.y===n.y},K_=function(t){if(!t)return 0;for(var e=0,n=0;n<t.length;n++){var r=t.charCodeAt(n);t.match(/[A-Z]/)?e+=1.5:e+=r>=1&&r<=126||r>=65376&&r<=65439?1:2}return e},q_=void 0,Z_=function(t){var e,n=t.start,r=t.end;if(n.x===r.x&&n.y===r.y)e="";else{var o={start:n,end:r,offset:10,verticalLength:5},i=h_(no(no({},o),{type:"start"})),a=h_(no(no({},o),{type:"end"}));e="M".concat(i.leftX," ").concat(i.leftY,"\n L").concat(i.rightX," ").concat(i.rightY,"\n L").concat(a.rightX," ").concat(a.rightY,"\n L").concat(a.leftX," ").concat(a.leftY," z")}return{d:e,fill:"transparent",stroke:"transparent",strokeWidth:1,strokeDasharray:"4, 4"}},$_=function(t){var e=t.start,n=t.end,r=t.sourceNode,o=t.targetNode,i=t.offset,a=Mm(r),s=Mm(o),u=__(a,i),l=__(s,i);return{sNext:b_(u,a,e),ePre:b_(l,s,n)}},J_=function(t){var e=t.replace(/M/g,"").replace(/C/g,",").split(",");return[Q_(e[0]),Q_(e[1]),Q_(e[2]),Q_(e[3])]},Q_=function(t){var e=io(t.replace(/(^\s*)/g,"").split(" "),2);return{x:+e[0],y:+e[1]}},tm=function(t,e){var n=io(t,4);return[ub(n[0],n[1],n[2],n[3],e),t[3]]},em=function(t,e){for(var n,r=t.x,o=t.y,i=Y_(e),a=Number.MAX_SAFE_INTEGER,s=[],u=0;u<i.length;u++)s.push({start:i[u],end:i[(u+1)%i.length]});if(s.forEach((function(t){var e=t.start,i=t.end;if(e.x===i.x){var s={x:e.x,y:o};if(y_(s,e,i))(u=Math.abs(e.x-r))<a&&(a=u,n=s)}else if(e.y===i.y){var u;s={x:r,y:e.y};if(y_(s,e,i))(u=Math.abs(e.y-o))<a&&(a=u,n=s)}})),!n){var l=s[0],c=l.start,p=l.end;n={x:c.x+(p.x-c.x)/2,y:c.y+(p.y-c.y)/2}}return n},nm=function(t){return Hy(t,["id","type","sourceNodeId","sourceAnchorId","targetNodeId","targetAnchorId","pointsList","startPoint","endPoint","properties"])},rm=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))};function om(t,e){return"function"!=typeof e?function(e,n,r){return Object.assign({type:t.edgeType},r)}:function(n,r,o){var i=e(n,r,o);return i?"string"==typeof i?Object.assign({},o,{type:i}):Object.assign({type:i},o):{type:t.edgeType}}}var im=function(t){var e=t.rows,n=t.rowsLength,r=t.fontSize,o=0;return Yd(e,(function(t){var e=K_(t);o=e>o?e:o})),{width:Math.ceil(o/2)*r+r/4,height:n*(r+2)+r/4}};function am(t,e){return e*Math.round(t/e)||t}function sm(t,e,n){if(!t)return[];var r=Math.min.apply(Math,ao([],io(t.map((function(t){return t[0]}))),!1)),o=Math.max.apply(Math,ao([],io(t.map((function(t){return t[0]}))),!1)),i=Math.min.apply(Math,ao([],io(t.map((function(t){return t[1]}))),!1)),a=Math.max.apply(Math,ao([],io(t.map((function(t){return t[1]}))),!1)),s=-r,u=-i,l=t.map((function(t){var e=io(t,2),n=e[0],r=e[1];return[n+s,r+u]})),c=e?e/(o-r):1,p=n?n/(a-i):1,d=Math.min(c,p);return l.map((function(t){var e=io(t,2),n=e[0],r=e[1];return[n*d,r*d]}))}var um=function(t,e,n){var r=io(t,2),o=r[0],i=r[1],a=io(e,2),s=a[0],u=a[1],l=io(n,2),c=l[0],p=l[1];return o>s&&o<c&&i>u&&i<p},lm=function(t,e){var n=!1;switch(e.multipleSelectKey){case"meta":n=t.metaKey;break;case"alt":n=t.altKey;break;case"shift":n=t.shiftKey;break;case"ctrl":n=t.ctrlKey;break;default:n=!1}return n};function cm(t,e){return!!(t instanceof dm&&e instanceof dm)}var pm=function(t){function e(n,r,o){var i=t.call(this,3)||this;return i[0]=n,i[1]=r,i[2]=o,i.x=n,i.y=r,i.z=o,Object.setPrototypeOf(i,e.prototype),i}return eo(e,t),e.prototype.add=function(t){if(cm(this,t))return new dm(this.x+t.x,this.y+t.y);var e=this.z+t.z;return new fm((this.x+t.x)/e,(this.y+t.y)/e)},e.prototype.subtract=function(t){if(cm(this,t))return new dm(this.x-t.x,this.y-t.y);var e=this.z-t.z;return 0===e?new dm(this.x-t.x,this.y-t.y):new fm((this.x-t.x)/e,(this.y-t.y)/e)},e}(Array),dm=function(t){function e(n,r,o){var i=t.call(this,n,r,null!=o?o:0)||this;return Object.setPrototypeOf(i,e.prototype),i}return eo(e,t),e.prototype.toString=function(){return"Vector"},e.prototype.dot=function(t){var e=this;return t.reduce((function(t,n,r){return t+n*e[r]}))},e.prototype.cross=function(t){return new e(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)},e.prototype.getLength=function(){return Math.hypot(this.x,this.y)},e.prototype.normalize=function(){var t=this.getLength();return new e(this.x/t,this.y/t)},e.prototype.crossZ=function(t){return this.x*t.y-this.y*t.x},e.prototype.angle=function(t){var e=this.crossZ(t),n=Math.acos(this.normalize().dot(t.normalize()));return e>=0?n:-n},e}(pm),fm=function(t){function e(n,r){var o=t.call(this,n,r,1)||this;return Object.setPrototypeOf(o,e.prototype),o}return eo(e,t),e.prototype.toString=function(){return"Point"},e}(pm),hm=function(t){function e(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=t.call(this,n.length)||this;return o.fill(new Array(3)),n.forEach((function(t,e){o[e]=t})),o.columns=n[0].length,o.rows=n.length,Object.setPrototypeOf(o,e.prototype),o}return eo(e,t),e.prototype.getRow=function(t){return this[t]},e.prototype.getColumn=function(t){return ao([],io(this.map((function(e){return e[t]}))),!1)},e.prototype.transpose=function(){for(var t=[],n=0;n<this.columns;n++)t.push(this.getColumn(n));return new(e.bind.apply(e,ao([void 0],io(t),!1)))},e.prototype.cross=function(t){var n=new Array(this.rows).fill("").map((function(){return[]}));if(this.columns===t.rows)for(var r=0;r<this.rows;r++)for(var o=this.getRow(r),i=function(e){var i=t.getColumn(e);n[r][e]=o.reduce((function(t,e,n){return t+e*i[n]}),0)},a=0;a<t.columns;a++)i(a);return new(e.bind.apply(e,ao([void 0],io(n),!1)))},e.prototype.to2D=function(){return this.map((function(t){return[t[0],t[1]]}))},e.prototype.toPoints=function(){return this.map((function(t){return new fm(t[0],t[1])}))},e.prototype.toString=function(){var t=io(this[0],2),e=t[0],n=t[1],r=io(this[1],2),o=r[0],i=r[1],a=io(this[2],2),s=a[0],u=a[1];return"matrix(".concat(e," ").concat(n," ").concat(o," ").concat(i," ").concat(s," ").concat(u,")")},e.prototype.translate=function(t,e){return this.cross(new gm(t,e))},e.prototype.rotate=function(t){return this.cross(new ym(t))},e.prototype.scale=function(t,e){return this.cross(new vm(t,e))},e}(Array),ym=function(t){function e(n){var r=t.call(this,new dm(+Math.cos(n).toFixed(2),+Math.sin(n).toFixed(2),0),new dm(-Math.sin(n).toFixed(2),+Math.cos(n).toFixed(2),0),new dm(0,0,1))||this;return Object.setPrototypeOf(r,e.prototype),r}return eo(e,t),e.prototype.inverse=function(){return this.transpose()},e}(hm),vm=function(t){function e(n,r){var o=t.call(this,new dm(n,0,0),new dm(0,r,0),new dm(0,0,1))||this;return o.sx=n,o.sy=r,Object.setPrototypeOf(o,e.prototype),o}return eo(e,t),e.prototype.inverse=function(){return new e(1/this.sx,1/this.sy)},e}(hm),gm=function(t){function e(n,r){var o=t.call(this,new dm(1,0,0),new dm(0,1,0),new dm(n,r,1))||this;return o.tx=n,o.ty=r,Object.setPrototypeOf(o,e.prototype),o}return eo(e,t),e.prototype.inverse=function(){return new e(-this.tx,-this.ty)},e}(hm);ce({isolateGlobalState:!0});var _m=function(t){return t.anchors},mm=function(t,e){for(var n,r=e.nodes,o=r.length-1;o>=0;o--){var i=r[o];if(Sm(t,i)){var a=i.getTargetAnchor(t);if(a){var s={node:i,anchorIndex:a.index,anchor:a.anchor};n&&!bm(i,n.node,e)||(n=s)}}}return n},bm=function(t,e,n){return t.zIndex>e.zIndex||n.nodesMap[t.id].index>n.nodesMap[e.id].index},Em=function(t,e){for(var n,r=_m(e),o=Number.MAX_SAFE_INTEGER,i=0;i<r.length;i++){var a=xm(t.x,t.y,r[i].x,r[i].y);a<o&&(o=a,n={index:i,anchor:no(no({},r[i]),{x:r[i].x,y:r[i].y,id:r[i].id})})}return n},xm=function(t,e,n,r){return Math.hypot(t-n,e-r)},wm=function(t,e){var n=!1,r=Mm(e);return t.x>=r.minX-0&&t.x<=r.maxX+0&&t.y>=r.minY-0&&t.y<=r.maxY+0&&(n=!0),n},Sm=function(t,e){var n=!1,r=Mm(e);return t.x>=r.minX-5&&t.x<=r.maxX+5&&t.y>=r.minY-5&&t.y<=r.maxY+5&&(n=!0),n},Mm=function(t){var e=t.x,n=t.y,r=t.width,o=t.height;return{minX:e-r/2,minY:n-o/2,maxX:e+r/2,maxY:n+o/2,x:e,y:n,width:r,height:o,centerX:e,centerY:n}},Am=function(t){var e=t,n=e.x,r=e.y,o=e.width,i=e.height,a=e.radius;return[{x:n-o/2+a,y:r-i/2+a,r:a},{x:n+o/2-a,y:r-i/2+a,r:a},{x:n-o/2+a,y:r+i/2-a,r:a},{x:n+o/2-a,y:r+i/2-a,r:a}]},Tm=function(t,e,n){var r,o=Am(n),i=Number.MAX_SAFE_INTEGER;return o.forEach((function(e){var n=xm(t.x,t.y,e.x,e.y);n<i&&(i=n,r=e)})),Om(t,e,r)},Om=function(t,e,n){var r,o=n.x,i=n.y,a=n.r;if(e===p_.HORIZONTAL){var s=o-Math.sqrt(a*a-(t.y-i)*(t.y-i)),u=o+Math.sqrt(a*a-(t.y-i)*(t.y-i));r={x:Math.abs(s-t.x)<Math.abs(u-t.x)?s:u,y:t.y}}else if(e===p_.VERTICAL){var l=i-Math.sqrt(a*a-(t.x-o)*(t.x-o)),c=i+Math.sqrt(a*a-(t.x-o)*(t.x-o)),p=Math.abs(l-t.y)<Math.abs(c-t.y)?l:c;r={x:t.x,y:p}}return r},Nm=function(t,e){var n=e,r=!1,o=n.x,i=n.y,a=n.width,s=n.height,u=n.radius,l=o-a/2+u,c=o+a/2-u,p=i-s/2+u,d=i+s/2-u;return t.y===i+s/2||t.y===i-s/2?r=t.x>l&&t.x<c:t.x!==o+a/2&&t.x!==o-a/2||(r=t.y>p&&t.y<d),r},Dm=function(t,e,n){var r,o=n,i=o.x,a=o.y,s=o.rx,u=o.ry;if(e===p_.HORIZONTAL){var l=i-Math.sqrt(s*s-(t.y-a)*(t.y-a)*s*s/(u*u)),c=i+Math.sqrt(s*s-(t.y-a)*(t.y-a)*s*s/(u*u));r={x:Math.abs(l-t.x)<Math.abs(c-t.x)?l:c,y:t.y}}else if(e===p_.VERTICAL){var p=a-Math.sqrt(u*u-(t.x-i)*(t.x-i)*u*u/(s*s)),d=a+Math.sqrt(u*u-(t.x-i)*(t.x-i)*u*u/(s*s)),f=Math.abs(p-t.y)<Math.abs(d-t.y)?p:d;r={x:t.x,y:f}}return r},Pm=function(t,e,n){for(var r,o=n.pointsPosition,i=Number.MAX_SAFE_INTEGER,a=[],s=0;s<o.length;s++)a.push({start:o[s],end:o[(s+1)%o.length]});return a.forEach((function(n){var o=n.start,a=n.end,s=o,u=a;o.x>a.x&&(s=a,u=o);var l={x:t.x,y:t.y};if(s.x===u.x&&e===p_.HORIZONTAL&&(l={x:s.x,y:t.y}),s.y===u.y&&e===p_.VERTICAL&&(l={x:t.x,y:s.y}),s.x!==u.x&&s.y!==u.y){var c=(u.y-s.y)/(u.x-s.x),p=(s.x*u.y-u.x*s.y)/(s.x-u.x);e===p_.HORIZONTAL?l={x:(t.y-p)/c,y:t.y}:e===p_.VERTICAL&&(l={x:t.x,y:c*t.x+p})}if(y_(l,o,a)){var d=xm(l.x,l.y,t.x,t.y);d<i&&(i=d,r=l)}})),r},Cm=function(t){return Hy(t,["id","type","x","y","text","properties","virtual","rotate"])},Im=function(t,e,n,r){var o=t.x,i=t.y;return e.x>t.x?o=t.x+n/2:e.x<t.x&&(o=t.x-n/2),e.y>t.y?i=t.y+r/2:e.y<t.y&&(i=t.y-r/2),{x:o,y:i}},jm=function(t){var e=t.rows,n=t.style,r=t.rowsLength,o=t.className,i=document.createElement("div");i.className=o,i.style.fontSize="".concat(n.fontSize),i.style.width="".concat(n.width),i.style.lineHeight="".concat(n.lineHeight),i.style.padding="".concat(n.padding),n.fontFamily&&(i.style.fontFamily="".concat(n.fontFamily)),r>1?e.forEach((function(t){var e=document.createElement("div");e.textContent=t,i.appendChild(e)})):i.textContent=e[0],document.body.appendChild(i);var a=i.clientHeight;return document.body.removeChild(i),a},km=function(t){var e=t.rows,n=t.rowsLength,r=t.fontSize,o=0;return e&&e.forEach((function(t){var e=K_(t);o=e>o?e:o})),{width:Math.ceil(o/2)*r+r/4,height:n*(r+2)+r/4}},Rm=function(t){return"object"!=typeof t?{isAllPass:!!t,msg:t?"":"不允许连接"}:t};let Lm;const Bm=new Uint8Array(16);function zm(){if(!Lm&&(Lm="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Lm))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Lm(Bm)}var Hm=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const Um=[];for(let t=0;t<256;++t)Um.push((t+256).toString(16).slice(1));function Xm(t,e=0){return Um[t[e+0]]+Um[t[e+1]]+Um[t[e+2]]+Um[t[e+3]]+"-"+Um[t[e+4]]+Um[t[e+5]]+"-"+Um[t[e+6]]+Um[t[e+7]]+"-"+Um[t[e+8]]+Um[t[e+9]]+"-"+Um[t[e+10]]+Um[t[e+11]]+Um[t[e+12]]+Um[t[e+13]]+Um[t[e+14]]+Um[t[e+15]]}function Gm(t){if(!function(t){return"string"==typeof t&&Hm.test(t)}(t))throw TypeError("Invalid UUID");let e;const n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n}function Wm(t,e,n){function r(t,r,o,i){var a;if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));const e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof r&&(r=Gm(r)),16!==(null===(a=r)||void 0===a?void 0:a.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let s=new Uint8Array(16+t.length);if(s.set(r),s.set(t,r.length),s=n(s),s[6]=15&s[6]|e,s[8]=63&s[8]|128,o){i=i||0;for(let t=0;t<16;++t)o[i+t]=s[t];return o}return Xm(s)}try{r.name=t}catch(t){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}function Ym(t){return 14+(t+64>>>9<<4)+1}function Vm(t,e){const n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function Fm(t,e,n,r,o,i){return Vm((a=Vm(Vm(e,t),Vm(r,i)))<<(s=o)|a>>>32-s,n);var a,s}function Km(t,e,n,r,o,i,a){return Fm(e&n|~e&r,t,e,o,i,a)}function qm(t,e,n,r,o,i,a){return Fm(e&r|n&~r,t,e,o,i,a)}function Zm(t,e,n,r,o,i,a){return Fm(e^n^r,t,e,o,i,a)}function $m(t,e,n,r,o,i,a){return Fm(n^(e|~r),t,e,o,i,a)}Wm("v3",48,(function(t){if("string"==typeof t){const e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n)}return function(t){const e=[],n=32*t.length,r="0123456789abcdef";for(let o=0;o<n;o+=8){const n=t[o>>5]>>>o%32&255,i=parseInt(r.charAt(n>>>4&15)+r.charAt(15&n),16);e.push(i)}return e}(function(t,e){t[e>>5]|=128<<e%32,t[Ym(e)-1]=e;let n=1732584193,r=-271733879,o=-1732584194,i=271733878;for(let e=0;e<t.length;e+=16){const a=n,s=r,u=o,l=i;n=Km(n,r,o,i,t[e],7,-680876936),i=Km(i,n,r,o,t[e+1],12,-389564586),o=Km(o,i,n,r,t[e+2],17,606105819),r=Km(r,o,i,n,t[e+3],22,-1044525330),n=Km(n,r,o,i,t[e+4],7,-176418897),i=Km(i,n,r,o,t[e+5],12,1200080426),o=Km(o,i,n,r,t[e+6],17,-1473231341),r=Km(r,o,i,n,t[e+7],22,-45705983),n=Km(n,r,o,i,t[e+8],7,1770035416),i=Km(i,n,r,o,t[e+9],12,-1958414417),o=Km(o,i,n,r,t[e+10],17,-42063),r=Km(r,o,i,n,t[e+11],22,-1990404162),n=Km(n,r,o,i,t[e+12],7,1804603682),i=Km(i,n,r,o,t[e+13],12,-40341101),o=Km(o,i,n,r,t[e+14],17,-1502002290),r=Km(r,o,i,n,t[e+15],22,1236535329),n=qm(n,r,o,i,t[e+1],5,-165796510),i=qm(i,n,r,o,t[e+6],9,-1069501632),o=qm(o,i,n,r,t[e+11],14,643717713),r=qm(r,o,i,n,t[e],20,-373897302),n=qm(n,r,o,i,t[e+5],5,-701558691),i=qm(i,n,r,o,t[e+10],9,38016083),o=qm(o,i,n,r,t[e+15],14,-660478335),r=qm(r,o,i,n,t[e+4],20,-405537848),n=qm(n,r,o,i,t[e+9],5,568446438),i=qm(i,n,r,o,t[e+14],9,-1019803690),o=qm(o,i,n,r,t[e+3],14,-187363961),r=qm(r,o,i,n,t[e+8],20,1163531501),n=qm(n,r,o,i,t[e+13],5,-1444681467),i=qm(i,n,r,o,t[e+2],9,-51403784),o=qm(o,i,n,r,t[e+7],14,1735328473),r=qm(r,o,i,n,t[e+12],20,-1926607734),n=Zm(n,r,o,i,t[e+5],4,-378558),i=Zm(i,n,r,o,t[e+8],11,-2022574463),o=Zm(o,i,n,r,t[e+11],16,1839030562),r=Zm(r,o,i,n,t[e+14],23,-35309556),n=Zm(n,r,o,i,t[e+1],4,-1530992060),i=Zm(i,n,r,o,t[e+4],11,1272893353),o=Zm(o,i,n,r,t[e+7],16,-155497632),r=Zm(r,o,i,n,t[e+10],23,-1094730640),n=Zm(n,r,o,i,t[e+13],4,681279174),i=Zm(i,n,r,o,t[e],11,-358537222),o=Zm(o,i,n,r,t[e+3],16,-722521979),r=Zm(r,o,i,n,t[e+6],23,76029189),n=Zm(n,r,o,i,t[e+9],4,-640364487),i=Zm(i,n,r,o,t[e+12],11,-421815835),o=Zm(o,i,n,r,t[e+15],16,530742520),r=Zm(r,o,i,n,t[e+2],23,-995338651),n=$m(n,r,o,i,t[e],6,-198630844),i=$m(i,n,r,o,t[e+7],10,1126891415),o=$m(o,i,n,r,t[e+14],15,-1416354905),r=$m(r,o,i,n,t[e+5],21,-57434055),n=$m(n,r,o,i,t[e+12],6,1700485571),i=$m(i,n,r,o,t[e+3],10,-1894986606),o=$m(o,i,n,r,t[e+10],15,-1051523),r=$m(r,o,i,n,t[e+1],21,-2054922799),n=$m(n,r,o,i,t[e+8],6,1873313359),i=$m(i,n,r,o,t[e+15],10,-30611744),o=$m(o,i,n,r,t[e+6],15,-1560198380),r=$m(r,o,i,n,t[e+13],21,1309151649),n=$m(n,r,o,i,t[e+4],6,-145523070),i=$m(i,n,r,o,t[e+11],10,-1120210379),o=$m(o,i,n,r,t[e+2],15,718787259),r=$m(r,o,i,n,t[e+9],21,-343485551),n=Vm(n,a),r=Vm(r,s),o=Vm(o,u),i=Vm(i,l)}return[n,r,o,i]}(function(t){if(0===t.length)return[];const e=8*t.length,n=new Uint32Array(Ym(e));for(let r=0;r<e;r+=8)n[r>>5]|=(255&t[r/8])<<r%32;return n}(t),8*t.length))}));var Jm={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Qm(t,e,n){if(Jm.randomUUID&&!e&&!t)return Jm.randomUUID();const r=(t=t||{}).random||(t.rng||zm)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(let t=0;t<16;++t)e[n+t]=r[t];return e}return Xm(r)}function tb(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function eb(t,e){return t<<e|t>>>32-e}Wm("v5",80,(function(t){const e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){const e=unescape(encodeURIComponent(t));t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);const r=t.length/4+2,o=Math.ceil(r/16),i=new Array(o);for(let e=0;e<o;++e){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=t[64*e+4*r]<<24|t[64*e+4*r+1]<<16|t[64*e+4*r+2]<<8|t[64*e+4*r+3];i[e]=n}i[o-1][14]=8*(t.length-1)/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=8*(t.length-1)&4294967295;for(let t=0;t<o;++t){const r=new Uint32Array(80);for(let e=0;e<16;++e)r[e]=i[t][e];for(let t=16;t<80;++t)r[t]=eb(r[t-3]^r[t-8]^r[t-14]^r[t-16],1);let o=n[0],a=n[1],s=n[2],u=n[3],l=n[4];for(let t=0;t<80;++t){const n=Math.floor(t/20),i=eb(o,5)+tb(n,a,s,u)+l+e[n]+r[t]>>>0;l=u,u=s,s=eb(a,30)>>>0,a=o,o=i}n[0]=n[0]+o>>>0,n[1]=n[1]+a>>>0,n[2]=n[2]+s>>>0,n[3]=n[3]+u>>>0,n[4]=n[4]+l>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}));var nb=function(){return Qm()},rb=new Map,ob=function(t){var e=nb();var n=window.requestAnimationFrame((function n(){if(t(),rb.get(e)){var r=window.requestAnimationFrame(n);rb.set(e,r)}}));return rb.set(e,n),e},ib=function(t){var e=rb.get(t);e&&(window.cancelAnimationFrame(e),rb.delete(t))},ab=100,sb={x:1,y:0,z:0};function ub(t,e,n,r,o){for(var i=function(o){if(o<0||o>1)throw new RangeError('The value range of parameter "t" is [0,1]');return{x:t.x*Math.pow(1-o,3)+3*e.x*o*Math.pow(1-o,2)+3*n.x*Math.pow(o,2)*(1-o)+r.x*Math.pow(o,3),y:t.y*Math.pow(1-o,3)+3*e.y*o*Math.pow(1-o,2)+3*n.y*Math.pow(o,2)*(1-o)+r.y*Math.pow(o,3)}},a=0,s=2,u=r.x,l=r.y,c=r;a<o&&s<50;){var p=(c=i(1-s/ab)).x,d=c.y;a=xm(u,l,p,d),s++}return c}function lb(t){var e=Math.hypot(t.x,t.y);return{x:t.x/e,y:t.y/e,z:0}}function cb(t){return function(t,e){var n=function(t,e){return t.x*e.y-t.y*e.x}(t,e),r=Math.acos(function(t,e){var n=[t.x,t.y,t.z];return[e.x,e.y,e.z].reduce((function(t,e,r){return t+e*n[r]}))}(lb(t),lb(e)));return n>=0?r:-r}(sb,t)}function pb(t){return t*(180/Math.PI)}var db={baseNode:{fill:"#fff",stroke:"#000",strokeWidth:2},baseEdge:{stroke:"#000",strokeWidth:2},rect:{},circle:{},diamond:{},ellipse:{},polygon:{},text:{color:"#000",stroke:"none",fontSize:12,background:{fill:"transparent"}},anchor:{stroke:"#000",fill:"#fff",r:4,hover:{r:10,fill:"#949494",fillOpacity:.5,stroke:"#949494"}},anchorLine:{stroke:"#000",strokeWidth:2,strokeDasharray:"3,2"},nodeText:{color:"#000",overflowMode:"default",fontSize:12,lineHeight:1.2},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"#fff"}},line:{},polyline:{},bezier:{fill:"none",adjustLine:{stroke:"#949494"},adjustAnchor:{r:4,fill:"#949494",fillOpacity:1,stroke:"#949494"}},arrow:{offset:10,verticalLength:5},snapline:{stroke:"#949494",strokeWidth:1},edgeAdjust:{r:4,fill:"#fff",stroke:"#949494",strokeWidth:2},outline:{fill:"transparent",stroke:"#949494",strokeDasharray:"3,3",hover:{stroke:"#949494"}},edgeAnimation:{stroke:"red",strokeDasharray:"10,10",strokeDashoffset:"100%",animationName:"lf_animate_dash",animationDuration:"20s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"normal"},rotateControl:{stroke:"#000",fill:"#fff",strokeWidth:1.5},resizeControl:{width:7,height:7,fill:"#fff",stroke:"#000"},resizeOutline:{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},fb=function(t){var e=up(db);return t&&(e=Uh(e,t)),e},hb=fb,yb=1e3,vb=999,gb=function(){return++yb},_b=function(){return--vb},mb=Object.freeze({__proto__:null,Matrix:hm,Point:fm,RotateMatrix:ym,ScaleMatrix:vm,StepDrag:f_,TranslateMatrix:gm,Vector:dm,action:te,cancelRaf:ib,computed:rt,configure:ce,costByPoints:N_,createEdgeGenerator:om,createRaf:ob,createUuid:nb,defaultAnimationOffConfig:t_,defaultAnimationOnConfig:e_,defaultTheme:db,degrees:pb,distance:xm,estimateDistance:O_,filterRepeatPoints:g_,formatAnchorConnectValidateData:Rm,formatData:i_,getAnchors:_m,getAppendAttributes:Z_,getBBoxCrossPointsByPoint:T_,getBBoxOfPoints:x_,getBBoxXCrossPoints:M_,getBBoxYCrossPoints:A_,getBezierControlPoints:$_,getBezierPoints:J_,getBoxByOriginNode:L_,getBytesLength:K_,getClosestAnchor:Em,getClosestPointOfPolyline:em,getClosestRadiusCenter:Tm,getCrossPointInRect:G_,getCrossPointWithCircle:Om,getCrossPointWithEllipse:Dm,getCrossPointWithPolygon:Pm,getEndTangent:tm,getExpandedBBox:__,getExpandedBBoxPoint:b_,getGridOffset:function(t,e){return t%e},getHtmlTextHeight:jm,getLongestEdge:H_,getMinIndex:_b,getNextNeighborPoints:k_,getNodeAnchorPosition:Im,getNodeBBox:Mm,getPointsFromBBox:w_,getPolylinePoints:z_,getRectRadiusCircle:Am,getSimplePoints:V_,getSimplePolyline:function(t,e){var n=[t,{x:t.x,y:e.y},e];return g_(n)},getSvgTextSize:im,getSvgTextWidthHeight:km,getTextWidth:function(t,e){q_||(q_=document.createElement("canvas"));var n=q_.getContext("2d");return n.font=e,n.measureText(t).width},getThetaOfVector:cb,getZIndex:gb,heuristicCostEstimate:D_,inStraightLineOfRect:Nm,isBboxOverLapping:v_,isIe:o_,isInNode:wm,isInNodeBbox:Sm,isMultipleSelect:lm,isObservable:Se,isPointInArea:um,isPointOutsideBBox:S_,isSegmentCrossingBBox:j_,isSegmentsCrossNode:X_,isSegmentsInNode:U_,isSegmentsIntersected:I_,mergeBBox:E_,normalizePolygon:sm,observable:$,pathFinder:R_,pickEdgeConfig:nm,pickNodeConfig:Cm,pointDirection:m_,pointEdgeDirection:function(t,e){var n=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y);return n/e.width>r/e.height?p_.VERTICAL:p_.HORIZONTAL},pointFilter:B_,points2PointsList:Y_,reaction:ae,rebuildPath:P_,refreshGraphId:function(t,e){void 0===e&&(e="");var n=t.nodes.reduce((function(t,n){return t[n.id]=e+Qm(),n.id=t[n.id],t}),{});return t.edges.forEach((function(t){t.id=e+Qm(),t.sourceNodeId=n[t.sourceNodeId],t.targetNodeId=n[t.targetNodeId]})),t},removeClosePointFromOpenList:C_,sampleCubic:ub,segmentDirection:W_,setupAnimation:n_,setupEdgeModel:function(t,e){var n;switch(t.type){case"line":default:n=new xb(t,e);break;case"polyline":n=new wb(t,e)}return n},setupTheme:fb,snapToGrid:am,targetNodeInfo:mm,toJS:je,twoPointDistance:rm,updateAnimation:r_,updateTheme:hb}),bb=function(){function e(e,n){this.BaseType=t.ElementType.EDGE,this.id="",this.type="",this.sourceNodeId="",this.targetNodeId="",this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this.properties={},this.points="",this.pointsList=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.isAnimation=!1,this.isShowAdjustPoint=!1,this.zIndex=0,this.state=t.ElementState.DEFAULT,this.modelType=t.ModelType.EDGE,this.customTextPosition=!1,this.style={},this.arrowConfig={markerEnd:"url(#marker-end-".concat(this.id,")"),markerStart:"url(#marker-start-".concat(this.id,")")},this.graphModel=n,this.initEdgeData(e),this.setAttributes()}return e.prototype.initEdgeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,n=e&&e(t.type),r=this.createId();t.id=r||n||nb()}this.arrowConfig.markerEnd="url(#marker-end-".concat(t.id,")"),this.arrowConfig.markerStart="url(#marker-start-".concat(t.id,")");var o=this.graphModel.editConfigModel.adjustEdgeStartAndEnd;this.isShowAdjustPoint=o,js(this,nm(t)),this.graphModel.overlapMode===c_.INCREASE&&(this.zIndex=t.zIndex||gb()),this.setAnchors(),this.initPoints(),this.formatText(t)},e.prototype.setAttributes=function(){},e.prototype.createId=function(){return null},e.prototype.getEdgeStyle=function(){return no(no({},this.graphModel.theme.baseEdge),this.style)},e.prototype.getAdjustPointStyle=function(){return no({},this.graphModel.theme.edgeAdjust)},e.prototype.getTextStyle=function(){return up(this.graphModel.theme.edgeText)},e.prototype.getEdgeAnimationStyle=function(){return up(this.graphModel.theme.edgeAnimation)},e.prototype.getArrowStyle=function(){var t=this.getEdgeStyle(),e=this.getEdgeAnimationStyle(),n=this.graphModel.theme.arrow,r=this.isAnimation?e.stroke:t.stroke;return no(no(no({},t),{fill:r,stroke:r}),n)},e.prototype.getOutlineStyle=function(){return up(this.graphModel.theme.outline)},e.prototype.getTextPosition=function(){return{x:0,y:0}},Object.defineProperty(e.prototype,"sourceNode",{get:function(){var t,e;return null===(e=null===(t=this.graphModel)||void 0===t?void 0:t.nodesMap[this.sourceNodeId])||void 0===e?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"targetNode",{get:function(){var t,e;return null===(e=null===(t=this.graphModel)||void 0===t?void 0:t.nodesMap[this.targetNodeId])||void 0===e?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textPosition",{get:function(){return this.getTextPosition()},enumerable:!1,configurable:!0}),e.prototype.getBeginAnchor=function(t,e,n){var r,o,i=_m(t);if(n){if(r=yf(i,(function(t){return t.id===n})))return r;console.warn("未在节点上找到指定的起点锚点".concat(n,",已使用默认锚点作为起点"))}return i.forEach((function(t){var n=rm(t,e);(void 0===o||n<o)&&(o=n,r=t)})),r},e.prototype.getEndAnchor=function(t,e){var n,r,o=this,i=_m(t);if(e){if(n=yf(i,(function(t){return t.id===e})))return n;console.warn("未在节点上找到指定的终点锚点".concat(e,",已使用默认锚点作为终点"))}return i.forEach((function(t){if(o.startPoint){var e=rm(t,o.startPoint);(void 0===r||e<r)&&(r=e,n=t)}})),n},e.prototype.getProperties=function(){return je(this.properties)},e.prototype.getData=function(){var t=this.text,e=t.x,n=t.y,r=t.value,o={id:this.id,type:this.type,sourceNodeId:this.sourceNode.id,targetNodeId:this.targetNode.id,startPoint:js({},this.startPoint),endPoint:js({},this.endPoint),properties:je(this.properties)};return r&&(o.text={x:e,y:n,value:r}),this.graphModel.overlapMode===c_.INCREASE&&(o.zIndex=this.zIndex),o},e.prototype.getHistoryData=function(){return this.getData()},e.prototype.setProperty=function(t,e){this.properties[t]=i_(e),this.setAttributes()},e.prototype.deleteProperty=function(t){delete this.properties[t],this.setAttributes()},e.prototype.setProperties=function(t){this.properties=no(no({},je(this.properties)),i_(t)),this.setAttributes()},e.prototype.changeEdgeId=function(t){var e=this.arrowConfig,n=e.markerEnd,r=e.markerStart;r&&r==="url(#marker-start-".concat(this.id,")")&&(this.arrowConfig.markerStart="url(#marker-start-".concat(t,")")),n&&n==="url(#marker-end-".concat(this.id,")")&&(this.arrowConfig.markerEnd="url(#marker-end-".concat(t,")")),this.id=t},e.prototype.setStyle=function(t,e){var n;this.style=no(no({},this.style),((n={})[t]=i_(e),n))},e.prototype.setStyles=function(t){this.style=no(no({},this.style),i_(t))},e.prototype.updateStyles=function(t){this.style=no({},i_(t))},e.prototype.formatText=function(t){var e,n,r,o=this.textPosition,i=o.x,a=o.y,s=t.text,u={value:"",x:i,y:a,draggable:!1,editable:!0};s&&("string"==typeof s?u=no(no({},u),{value:s}):(u=no(no({},u),{x:null!==(e=s.x)&&void 0!==e?e:i,y:null!==(n=s.y)&&void 0!==n?n:a,value:null!==(r=s.value)&&void 0!==r?r:""}),Mh(s.draggable)||(u.draggable=s.draggable),Mh(s.editable)||(u.editable=s.editable))),this.text=u},e.prototype.resetTextPosition=function(){var t=this.textPosition,e=t.x,n=t.y;this.text.x=e,this.text.y=n},e.prototype.moveText=function(t,e){if(this.text){var n=this.text,r=n.x,o=n.y,i=n.value,a=n.draggable,s=n.editable;this.text={value:i,draggable:a,x:r+t,y:o+e,editable:s}}},e.prototype.setText=function(t){t&&js(this.text,t)},e.prototype.updateText=function(t){this.text=no(no({},je(this.text)),{value:t})},e.prototype.setAnchors=function(){if(!this.sourceAnchorId||!this.startPoint){if(!(t=this.getBeginAnchor(this.sourceNode,this.targetNode,this.sourceAnchorId)))throw new Error("无法获取beginAnchor,请检查anchors相关逻辑,anchors不能为空");this.startPoint||(this.startPoint={x:t.x,y:t.y}),this.sourceAnchorId||(this.sourceAnchorId=t.id)}if(!this.targetAnchorId||!this.endPoint){var t;if(!(t=this.getEndAnchor(this.targetNode,this.targetAnchorId)))throw new Error("无法获取endAnchor,请检查anchors相关逻辑,anchors不能为空");this.endPoint||(this.endPoint={x:t.x,y:t.y}),this.targetAnchorId||(this.targetAnchorId=t.id)}},e.prototype.setSelected=function(t){void 0===t&&(t=!0),this.isSelected=t},e.prototype.setHovered=function(t){void 0===t&&(t=!0),this.isHovered=t},e.prototype.setHitable=function(t){void 0===t&&(t=!0),this.isHitable=t},e.prototype.setHittable=function(t){void 0===t&&(t=!0),this.isHittable=t},e.prototype.openEdgeAnimation=function(){this.isAnimation=!0},e.prototype.closeEdgeAnimation=function(){this.isAnimation=!1},e.prototype.setElementState=function(t,e){this.state=t,this.additionStateData=e},e.prototype.updateStartPoint=function(t){this.startPoint=t},e.prototype.moveStartPoint=function(t,e){this.startPoint&&(this.startPoint.x+=t,this.startPoint.y+=e)},e.prototype.updateEndPoint=function(t){this.endPoint=t},e.prototype.moveEndPoint=function(t,e){this.endPoint&&(this.endPoint.x+=t,this.endPoint.y+=e)},e.prototype.setZIndex=function(t){void 0===t&&(t=0),this.zIndex=t},e.prototype.initPoints=function(){},e.prototype.updateAttributes=function(t){js(this,t)},e.prototype.getAdjustStart=function(){return this.startPoint},e.prototype.getAdjustEnd=function(){return this.endPoint},e.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,n=t.endPoint;this.updateStartPoint({x:e.x,y:e.y}),this.updateEndPoint({x:n.x,y:n.y})},e.BaseType=t.ElementType.EDGE,oo([$],e.prototype,"type",void 0),oo([$],e.prototype,"sourceNodeId",void 0),oo([$],e.prototype,"targetNodeId",void 0),oo([$],e.prototype,"startPoint",void 0),oo([$],e.prototype,"endPoint",void 0),oo([$],e.prototype,"text",void 0),oo([$],e.prototype,"properties",void 0),oo([$],e.prototype,"points",void 0),oo([$],e.prototype,"pointsList",void 0),oo([$],e.prototype,"isSelected",void 0),oo([$],e.prototype,"isHovered",void 0),oo([$],e.prototype,"isHitable",void 0),oo([$],e.prototype,"isHittable",void 0),oo([$],e.prototype,"draggable",void 0),oo([$],e.prototype,"visible",void 0),oo([$],e.prototype,"isAnimation",void 0),oo([$],e.prototype,"isShowAdjustPoint",void 0),oo([$],e.prototype,"zIndex",void 0),oo([$],e.prototype,"state",void 0),oo([$],e.prototype,"style",void 0),oo([$],e.prototype,"arrowConfig",void 0),oo([rt],e.prototype,"sourceNode",null),oo([rt],e.prototype,"targetNode",null),oo([rt],e.prototype,"textPosition",null),oo([te],e.prototype,"setProperty",null),oo([te],e.prototype,"deleteProperty",null),oo([te],e.prototype,"setProperties",null),oo([te],e.prototype,"changeEdgeId",null),oo([te],e.prototype,"setStyle",null),oo([te],e.prototype,"setStyles",null),oo([te],e.prototype,"updateStyles",null),oo([te],e.prototype,"formatText",null),oo([te],e.prototype,"resetTextPosition",null),oo([te],e.prototype,"moveText",null),oo([te],e.prototype,"setText",null),oo([te],e.prototype,"updateText",null),oo([te],e.prototype,"setAnchors",null),oo([te],e.prototype,"setSelected",null),oo([te],e.prototype,"setHovered",null),oo([te],e.prototype,"setHitable",null),oo([te],e.prototype,"setHittable",null),oo([te],e.prototype,"openEdgeAnimation",null),oo([te],e.prototype,"closeEdgeAnimation",null),oo([te],e.prototype,"setElementState",null),oo([te],e.prototype,"updateStartPoint",null),oo([te],e.prototype,"moveStartPoint",null),oo([te],e.prototype,"updateEndPoint",null),oo([te],e.prototype,"moveEndPoint",null),oo([te],e.prototype,"setZIndex",null),oo([te],e.prototype,"initPoints",null),oo([te],e.prototype,"updateAttributes",null),oo([te],e.prototype,"getAdjustStart",null),oo([te],e.prototype,"getAdjustEnd",null),oo([te],e.prototype,"updateAfterAdjustStartAndEnd",null),e}(),Eb=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.BEZIER_EDGE,o.path="",o.initEdgeData(n),o.setAttributes(),o}return eo(n,e),n.prototype.initEdgeData=function(t){this.offset=100,e.prototype.initEdgeData.call(this,t)},n.prototype.getEdgeStyle=function(){var t=this.graphModel.theme.bezier,n=e.prototype.getEdgeStyle.call(this);return no(no({},n),up(t))},n.prototype.getTextPosition=function(){if(this.pointsList&&this.pointsList.length>0){var t=0,e=0;return this.pointsList.forEach((function(n){var r=n.x,o=n.y;t+=r,e+=o})),{x:t/this.pointsList.length,y:e/this.pointsList.length}}return{x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2}},n.prototype.getData=function(){var t=e.prototype.getData.call(this),n=this.pointsList.map((function(t){return{x:t.x,y:t.y}}));return no(no({},t),{pointsList:n})},n.prototype.getControls=function(){var t=this.startPoint,e=this.endPoint;return $_({start:t,end:e,sourceNode:this.sourceNode,targetNode:this.targetNode,offset:this.offset})},n.prototype.getPath=function(t){var e=io(t,4),n=e[0],r=e[1],o=e[2],i=e[3];return"M ".concat(n.x," ").concat(n.y,"\n C ").concat(r.x," ").concat(r.y,",\n ").concat(o.x," ").concat(o.y,",\n ").concat(i.x," ").concat(i.y)},n.prototype.initPoints=function(){this.pointsList.length>0?this.path=this.getPath(this.pointsList):this.updatePoints()},n.prototype.updatePoints=function(){var t=this.getControls(),e=t.sNext,n=t.ePre;this.updatePath(e,n)},n.prototype.updatePath=function(t,e){t=up(t),e=up(e);var n={x:this.startPoint.x,y:this.startPoint.y},r={x:this.endPoint.x,y:this.endPoint.y};if(!t||!e){var o=this.getControls();t=o.sNext,e=o.ePre}this.pointsList=[n,t,e,r],this.path=this.getPath(this.pointsList)},n.prototype.updateStartPoint=function(t){this.startPoint=Object.assign({},t),this.updatePoints()},n.prototype.updateEndPoint=function(t){this.endPoint=Object.assign({},t),this.updatePoints()},n.prototype.moveStartPoint=function(t,e){this.startPoint.x+=t,this.startPoint.y+=e;var n=io(this.pointsList,3),r=n[1],o=n[2];r.x+=t,r.y+=e,this.updatePath(r,o)},n.prototype.moveEndPoint=function(t,e){this.endPoint.x+=t,this.endPoint.y+=e;var n=io(this.pointsList,3),r=n[1],o=n[2];o.x+=t,o.y+=e,this.updatePath(r,o)},n.prototype.updateAdjustAnchor=function(t,e){"sNext"===e?this.pointsList[1]=t:"ePre"===e&&(this.pointsList[2]=t),this.path=this.getPath(this.pointsList),this.setText(Object.assign({},this.text,this.textPosition))},n.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},n.prototype.getAdjustEnd=function(){var t=this.pointsList;return t[t.length-1]||this.endPoint},n.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,n=t.endPoint,r=t.sourceNode,o=t.targetNode,i=$_({start:e,end:n,sourceNode:r,targetNode:o,offset:this.offset}),a=i.sNext,s=i.ePre;this.pointsList=[e,a,s,n],this.initPoints()},oo([$],n.prototype,"path",void 0),oo([te],n.prototype,"initPoints",null),oo([te],n.prototype,"updatePoints",null),oo([te],n.prototype,"updateStartPoint",null),oo([te],n.prototype,"updateEndPoint",null),oo([te],n.prototype,"moveStartPoint",null),oo([te],n.prototype,"moveEndPoint",null),oo([te],n.prototype,"updateAdjustAnchor",null),oo([te],n.prototype,"getAdjustStart",null),oo([te],n.prototype,"getAdjustEnd",null),oo([te],n.prototype,"updateAfterAdjustStartAndEnd",null),n}(bb),xb=function(e){function n(){var n=e.apply(this,ao([],io(arguments),!1))||this;return n.modelType=t.ModelType.LINE_EDGE,n}return eo(n,e),n.prototype.getEdgeStyle=function(){var t=this.graphModel.theme.line,n=e.prototype.getEdgeStyle.call(this);return no(no({},n),up(t))},n.prototype.getTextPosition=function(){return{x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2}},n}(bb),wb=function(e){function n(){var n=e.apply(this,ao([],io(arguments),!1))||this;return n.modelType=t.ModelType.POLYLINE_EDGE,n.draggingPointList=[],n}return eo(n,e),n.prototype.initEdgeData=function(t){this.offset=30,e.prototype.initEdgeData.call(this,t)},n.prototype.getEdgeStyle=function(){var t=this.graphModel.theme.polyline,n=e.prototype.getEdgeStyle.call(this);return no(no({},n),up(t))},n.prototype.getTextPosition=function(){var t,e=null===(t=this.text)||void 0===t?void 0:t.value;if(this.dbClickPosition&&!e){var n=this.dbClickPosition;return{x:n.x,y:n.y}}var r=Y_(this.points),o=io(H_(r),2),i=o[0],a=o[1];return{x:(i.x+a.x)/2,y:(i.y+a.y)/2}},n.prototype.getAfterAnchor=function(t,e,n){var r,o;return n.forEach((function(n){var i;t===p_.HORIZONTAL?i=Math.abs(e.y-n.y):t===p_.VERTICAL&&(i=Math.abs(e.x-n.x)),(!o||o>i)&&(o=i,r=n)})),r},n.prototype.getCrossPoint=function(t,e,n){var r;return t===p_.HORIZONTAL?r={x:n.x,y:e.y}:t===p_.VERTICAL&&(r={x:e.x,y:n.y}),r},n.prototype.removeCrossPoints=function(t,e,n){var r=n.map((function(t){return t}));if(1===t){var o=r[t],i=r[e],a=r[t-1];if(U_(a,o,this.sourceNode)){if(X_(o,i,this.sourceNode))(s=G_(o,i,this.sourceNode))&&(r[t]=s,r.splice(t-1,1),t--,e--)}else this.sourceNode.anchors.forEach((function(e){(e.x===a.x&&e.x===o.x||e.y===a.y&&e.y===o.y)&&(xm(e.x,e.y,o.x,o.y)<xm(a.x,a.y,o.x,o.y)&&(r[t-1]=e))}))}if(e===n.length-2){var s,u=r[t],l=r[e],c=r[e+1];if(U_(l,c,this.targetNode)){if(X_(u,l,this.targetNode))(s=G_(u,l,this.targetNode))&&(r[e]=s,r.splice(e+1,1))}else this.targetNode.anchors.forEach((function(t){(t.x===c.x&&t.x===l.x||t.y===c.y&&t.y===l.y)&&(xm(t.x,t.y,l.x,l.y)<xm(c.x,c.y,l.x,l.y)&&(r[e+1]=t))}))}return r},n.prototype.getDraggingPoints=function(t,e,n,r,o){var i=o.map((function(t){return t})),a=this.getAfterAnchor(t,n,r),s=this.getCrossPoint(t,n,a);return"start"===e?(i.unshift(s),i.unshift(a)):(i.push(s),i.push(a)),i},n.prototype.updateCrossPoints=function(e){var n=e.map((function(t){return t})),r=e[0],o=e[1],i=e[n.length-2],a=e[n.length-1],s=this.sourceNode,u=this.targetNode,l=s.modelType,c=u.modelType,p=W_(r,o),d=n[0];switch(l){case t.ModelType.RECT_NODE:if(0!==s.radius)Nm(r,s)||(d=Tm(r,p,s));break;case t.ModelType.CIRCLE_NODE:d=Om(r,p,s);break;case t.ModelType.ELLIPSE_NODE:d=Dm(r,p,s);break;case t.ModelType.DIAMOND_NODE:case t.ModelType.POLYGON_NODE:d=Pm(r,p,s)}d&&(n[0]=d);var f=W_(i,a),h=n[n.length-1];switch(c){case t.ModelType.RECT_NODE:if(0!==u.radius)Nm(a,u)||(h=Tm(a,f,u));break;case t.ModelType.CIRCLE_NODE:h=Om(a,f,u);break;case t.ModelType.ELLIPSE_NODE:h=Dm(a,f,u);break;case t.ModelType.DIAMOND_NODE:case t.ModelType.POLYGON_NODE:h=Pm(a,f,u)}return h&&(n[n.length-1]=h),n},n.prototype.getData=function(){var t=e.prototype.getData.call(this),n=this.pointsList.map((function(t){return{x:t.x,y:t.y}}));return Object.assign({},t,{pointsList:n})},n.prototype.initPoints=function(){this.pointsList.length>0?this.points=this.pointsList.map((function(t){return"".concat(t.x,",").concat(t.y)})).join(" "):this.updatePoints()},n.prototype.updatePoints=function(){var t=z_({x:this.startPoint.x,y:this.startPoint.y},{x:this.endPoint.x,y:this.endPoint.y},this.sourceNode,this.targetNode,this.offset||0);this.pointsList=t,this.points=t.map((function(t){return"".concat(t.x,",").concat(t.y)})).join(" ")},n.prototype.updateStartPoint=function(t){this.startPoint=Object.assign({},t),this.updatePoints()},n.prototype.moveStartPoint=function(t,e){this.startPoint.x+=t,this.startPoint.y+=e,this.updatePoints()},n.prototype.updateEndPoint=function(t){this.endPoint=Object.assign({},t),this.updatePoints()},n.prototype.moveEndPoint=function(t,e){this.endPoint.x+=t,this.endPoint.y+=e,this.updatePoints()},n.prototype.updatePointsList=function(t,e){this.pointsList.forEach((function(n){n.x+=t,n.y+=e}));var n=this.pointsList[0];this.startPoint=Object.assign({},n);var r=this.pointsList[this.pointsList.length-1];this.endPoint=Object.assign({},r),this.initPoints()},n.prototype.dragAppendStart=function(){this.draggingPointList=this.pointsList.map((function(t){return t}))},n.prototype.dragAppendSimple=function(t,e){this.isDragging=!0;var n=t.start,r=t.end,o=t.startIndex,i=t.endIndex,a=t.direction,s=this.pointsList,u=s;return a===p_.HORIZONTAL?(s[o]={x:n.x,y:n.y+e.y},s[i]={x:r.x,y:r.y+e.y},u=this.pointsList.map((function(t){return t}))):a===p_.VERTICAL&&(s[o]={x:n.x+e.x,y:n.y},s[i]={x:r.x+e.x,y:r.y},u=this.pointsList.map((function(t){return t}))),this.updatePointsAfterDrag(u),this.draggingPointList=u,this.setText(Object.assign({},this.text,this.textPosition)),{start:Object.assign({},s[o]),end:Object.assign({},s[i]),startIndex:o,endIndex:i,direction:a}},n.prototype.dragAppend=function(t,e){this.isDragging=!0;var n=t.start,r=t.end,o=t.startIndex,i=t.endIndex,a=t.direction,s=this.pointsList;if(a===p_.HORIZONTAL){s[o]={x:n.x,y:n.y+e.y},s[i]={x:r.x,y:r.y+e.y};var u=this.pointsList.map((function(t){return t}));if(0!==o&&i!==this.pointsList.length-1&&(u=this.removeCrossPoints(o,i,u)),0===o){var l={x:n.x,y:n.y+e.y};if(!wm(l,this.sourceNode)){var c=this.sourceNode.anchors;u=this.getDraggingPoints(a,"start",l,c,u)}}if(i===this.pointsList.length-1){var p={x:r.x,y:r.y+e.y};if(!wm(p,this.targetNode)){c=this.targetNode.anchors;u=this.getDraggingPoints(a,"end",p,c,u)}}this.updatePointsAfterDrag(u),this.draggingPointList=u}else if(a===p_.VERTICAL){s[o]={x:n.x+e.x,y:n.y},s[i]={x:r.x+e.x,y:r.y};u=this.pointsList.map((function(t){return t}));if(0!==o&&i!==this.pointsList.length-1&&(u=this.removeCrossPoints(o,i,u)),0===o){l={x:n.x+e.x,y:n.y};if(!wm(l,this.sourceNode)){c=this.sourceNode.anchors;u=this.getDraggingPoints(a,"start",l,c,u)}}if(i===this.pointsList.length-1){p={x:r.x+e.x,y:r.y};if(!wm(p,this.targetNode)){c=this.targetNode.anchors;u=this.getDraggingPoints(a,"end",p,c,u)}}this.updatePointsAfterDrag(u),this.draggingPointList=u}return this.setText(Object.assign({},this.text,this.textPosition)),{start:Object.assign({},s[o]),end:Object.assign({},s[i]),startIndex:o,endIndex:i,direction:a}},n.prototype.dragAppendEnd=function(){if(this.draggingPointList){var t=B_(Y_(this.points));this.pointsList=t.map((function(t){return t})),this.draggingPointList=[];var e=t[0];this.startPoint=Object.assign({},e);var n=t[t.length-1];this.endPoint=Object.assign({},n)}this.isDragging=!1},n.prototype.updatePointsAfterDrag=function(t){var e=this.updateCrossPoints(t);this.points=e.map((function(t){return"".concat(t.x,",").concat(t.y)})).join(" ")},n.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},n.prototype.getAdjustEnd=function(){var t=this.pointsList;return t[t.length-1]||this.endPoint},n.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,n=t.endPoint,r=t.sourceNode,o=t.targetNode;this.pointsList=z_({x:e.x,y:e.y},{x:n.x,y:n.y},r,o,this.offset||0),this.initPoints()},oo([$],n.prototype,"dbClickPosition",void 0),oo([te],n.prototype,"initPoints",null),oo([te],n.prototype,"updatePoints",null),oo([te],n.prototype,"updateStartPoint",null),oo([te],n.prototype,"moveStartPoint",null),oo([te],n.prototype,"updateEndPoint",null),oo([te],n.prototype,"moveEndPoint",null),oo([te],n.prototype,"updatePointsList",null),oo([te],n.prototype,"dragAppendStart",null),oo([te],n.prototype,"dragAppendSimple",null),oo([te],n.prototype,"dragAppend",null),oo([te],n.prototype,"dragAppendEnd",null),oo([te],n.prototype,"updatePointsAfterDrag",null),oo([te],n.prototype,"getAdjustStart",null),oo([te],n.prototype,"getAdjustEnd",null),oo([te],n.prototype,"updateAfterAdjustStartAndEnd",null),n}(bb),Sb=function(){function e(e,n){this.BaseType=t.ElementType.NODE,this.id="",this.type="",this.x=0,this.y=0,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this.properties={},this._width=100,this._height=80,this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.anchorsOffset=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isShowAnchor=!1,this.isDragging=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.enableRotate=!0,this.enableResize=!0,this.zIndex=1,this.state=t.ElementState.DEFAULT,this.autoToFront=!0,this.style={},this._rotate=0,this.modelType=t.ModelType.NODE,this.additionStateData={},this.targetRules=[],this.sourceRules=[],this.moveRules=[],this.hasSetTargetRules=!1,this.hasSetSourceRules=!1,this.graphModel=n,this.properties=e.properties||{},this.initNodeData(e),this.setAttributes()}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t;var e=this.x,n=void 0===e?0:e,r=this.y,o=void 0===r?0:r;this.transform=new gm(-n,-o).rotate(t).translate(n,o).toString()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"incoming",{get:function(){return{nodes:this.graphModel.getNodeIncomingNode(this.id),edges:this.graphModel.getNodeIncomingEdge(this.id)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outgoing",{get:function(){return{nodes:this.graphModel.getNodeOutgoingNode(this.id),edges:this.graphModel.getNodeOutgoingEdge(this.id)}},enumerable:!1,configurable:!0}),e.prototype.initNodeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,n=e&&e(t.type),r=this.createId();t.id=r||n||nb()}this.formatText(t),js(this,Cm(t)),this.graphModel.overlapMode===c_.INCREASE&&(this.zIndex=t.zIndex||gb())},e.prototype.setAttributes=function(){},e.prototype.createId=function(){return null},e.prototype.formatText=function(t){var e,n,r,o=t.x,i=t.y,a=t.text,s={value:"",x:o,y:i,draggable:!1,editable:!0};a&&("string"==typeof a?s.value=a:(s=no(no({},s),{x:null!==(e=a.x)&&void 0!==e?e:o,y:null!==(n=a.y)&&void 0!==n?n:i,value:null!==(r=a.value)&&void 0!==r?r:""}),Mh(a.draggable)||(s.draggable=a.draggable),Mh(a.editable)||(s.draggable=a.draggable))),t.text=s},e.prototype.resize=function(t){var e=t.width,n=t.height,r=t.deltaX,o=t.deltaY;return this.move(r/2,o/2),this.width=e,this.height=n,this.setProperties({width:e,height:n}),this.getData()},e.prototype.proportionalResize=function(){},e.prototype.getData=function(){var t=this.text,e=t.x,n=t.y,r=t.value,o=this.properties;Se(o)&&(o=je(o));var i={id:this.id,type:this.type,x:this.x,y:this.y,properties:o};return this.rotate&&(i.rotate=this.rotate),this.graphModel.overlapMode===c_.INCREASE&&(i.zIndex=this.zIndex),r&&(i.text={x:e,y:n,value:r}),i},e.prototype.getHistoryData=function(){return this.getData()},e.prototype.getProperties=function(){return je(this.properties)},e.prototype.getOuterGAttributes=function(){return{className:""}},e.prototype.getNodeStyle=function(){return no(no({},this.graphModel.theme.baseNode),this.style)},e.prototype.getTextStyle=function(){return up(this.graphModel.theme.nodeText)},e.prototype.getRotateControlStyle=function(){return up(this.graphModel.theme.rotateControl)},e.prototype.getResizeControlStyle=function(){return up(this.graphModel.theme.resizeControl)},e.prototype.getResizeOutlineStyle=function(){return up(this.graphModel.theme.resizeOutline)},e.prototype.getAnchorStyle=function(t){return up(this.graphModel.theme.anchor)},e.prototype.getAnchorLineStyle=function(t){return up(this.graphModel.theme.anchorLine)},e.prototype.getOutlineStyle=function(){return up(this.graphModel.theme.outline)},e.prototype.isAllowConnectedAsSource=function(t,e,n,r){var o=this.hasSetSourceRules?this.sourceRules:this.getConnectedSourceRules();this.hasSetSourceRules=!0;for(var i=!0,a="",s=0;s<o.length;s++){var u=o[s];if(!u.validate.call(this,this,t,e,n,r)){i=!1,a=u.message;break}}return{isAllPass:i,msg:a}},e.prototype.getConnectedSourceRules=function(){return this.sourceRules},e.prototype.isAllowConnectedAsTarget=function(t,e,n,r){var o=this.hasSetTargetRules?this.targetRules:this.getConnectedTargetRules();this.hasSetTargetRules=!0;for(var i=!0,a="",s=0;s<o.length;s++){var u=o[s];if(!u.validate.call(this,t,this,e,n,r)){i=!1,a=u.message;break}}return{isAllPass:i,msg:a}},e.prototype.isAllowMoveNode=function(t,e){var n,r,o=!0,i=!0,a=this.moveRules.concat(this.graphModel.nodeMoveRules);try{for(var s=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(a),u=s.next();!u.done;u=s.next()){var l=(0,u.value)(this,t,e);if(!l)return!1;if("object"==typeof l){var c=l;if(!c.x&&!c.y)return!1;o=o&&c.x,i=i&&c.y}}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return{x:o,y:i}},e.prototype.getConnectedTargetRules=function(){return this.targetRules},e.prototype.getAnchorsByOffset=function(){var t=this,e=t.anchorsOffset,n=t.id,r=t.x,o=t.y;return e&&e.length>0?e.map((function(t,e){return t.length?{id:"".concat(n,"_").concat(e),x:r+t[0],y:o+t[1]}:no(no({},t),{x:r+t.x,y:o+t.y,id:t.id||"".concat(n,"_").concat(e)})})):this.getDefaultAnchor()},e.prototype.getDefaultAnchor=function(){return[]},e.prototype.getTargetAnchor=function(t){return Em(t,this)},e.prototype.getBounds=function(){return{x1:this.x-this.width/2,y1:this.y-this.height/2,x2:this.x+this.width/2,y2:this.y+this.height/2}},Object.defineProperty(e.prototype,"anchors",{get:function(){var t=this.getAnchorsByOffset(),e=this,n=e.x,r=e.y,o=e.rotate;return t.forEach((function(t){var e=t.x,i=t.y,a=io(new hm([e,i,1]).translate(-n,-r).rotate(o).translate(n,r)[0],2),s=a[0],u=a[1];t.x=s,t.y=u})),t},enumerable:!1,configurable:!0}),e.prototype.getAnchorInfo=function(t){if(!Eh(t))for(var e=0;e<this.anchors.length;e++){var n=this.anchors[e];if(n.id===t)return n}},e.prototype.addNodeMoveRules=function(t){this.moveRules.includes(t)||this.moveRules.push(t)},e.prototype.isAllowMoveByXORY=function(t,e,n){var r,o;if(n)r=!0,o=!0;else{var i=this.isAllowMoveNode(t,e);"boolean"==typeof i?(r=i,o=i):(r=i.x,o=i.y)}return{isAllowMoveX:r,isAllowMoveY:o}},e.prototype.move=function(t,e,n){void 0===n&&(n=!1);var r=this.isAllowMoveByXORY(t,e,n),o=r.isAllowMoveX,i=r.isAllowMoveY;return o&&(this.x=this.x+t,this.text&&this.moveText(t,0)),i&&(this.y=this.y+e,this.text&&this.moveText(0,e)),o||i},e.prototype.getMoveDistance=function(t,e,n){void 0===n&&(n=!1);var r=this.isAllowMoveByXORY(t,e,n),o=r.isAllowMoveX,i=r.isAllowMoveY,a=0,s=0;return o&&t&&(this.x=this.x+t,this.text&&this.moveText(t,0),a=t),i&&e&&(this.y=this.y+e,this.text&&this.moveText(0,e),s=e),[a,s]},e.prototype.moveTo=function(t,e,n){void 0===n&&(n=!1);var r=t-this.x,o=e-this.y;return!(!n&&!this.isAllowMoveNode(r,o))&&(this.text&&this.text&&this.moveText(r,o),this.x=t,this.y=e,!0)},e.prototype.moveText=function(t,e){var n=this.text,r=n.x,o=n.y,i=n.value,a=n.draggable,s=n.editable;this.text={value:i,editable:s,draggable:a,x:r+t,y:o+e}},e.prototype.updateText=function(t){this.text=no(no({},je(this.text)),{value:t})},e.prototype.setSelected=function(t){void 0===t&&(t=!0),this.isSelected=t},e.prototype.setHovered=function(t){void 0===t&&(t=!0),this.isHovered=t,this.setIsShowAnchor(t)},e.prototype.setIsShowAnchor=function(t){void 0===t&&(t=!0),this.isShowAnchor=t},e.prototype.setEnableRotate=function(t){void 0===t&&(t=!0),this.enableRotate=t},e.prototype.setEnableResize=function(t){void 0===t&&(t=!0),this.enableResize=t},e.prototype.setHitable=function(t){void 0===t&&(t=!0),this.isHitable=t},e.prototype.setHittable=function(t){void 0===t&&(t=!0),this.isHittable=t},e.prototype.setElementState=function(t,e){this.state=t,this.additionStateData=e},e.prototype.setProperty=function(e,n){var r,o=je(this.properties),i=no(no({},o),((r={})[e]=i_(n),r));this.properties=i,this.setAttributes(),this.graphModel.eventCenter.emit(t.EventType.NODE_PROPERTIES_CHANGE,{id:this.id,keys:[e],preProperties:o,properties:i})},e.prototype.setProperties=function(e){var n=je(this.properties),r=no(no({},n),i_(e));this.properties=r,this.setAttributes();var o=[];Rh(e,(function(t,e){(Lf(n,e)&&n[e]!==t||!Lf(n,e))&&o.push(e)})),this.graphModel.eventCenter.emit(t.EventType.NODE_PROPERTIES_CHANGE,{id:this.id,keys:o,preProperties:n,properties:r})},e.prototype.deleteProperty=function(t){delete this.properties[t],this.setAttributes()},e.prototype.setStyle=function(t,e){var n;this.style=no(no({},this.style),((n={})[t]=i_(e),n))},e.prototype.setStyles=function(t){this.style=no(no({},this.style),i_(t))},e.prototype.updateStyles=function(t){this.style=no({},i_(t))},e.prototype.setZIndex=function(t){void 0===t&&(t=1),this.zIndex=t},e.prototype.updateAttributes=function(t){js(this,t)},e.BaseType=t.ElementType.NODE,oo([$],e.prototype,"type",void 0),oo([$],e.prototype,"x",void 0),oo([$],e.prototype,"y",void 0),oo([$],e.prototype,"text",void 0),oo([$],e.prototype,"properties",void 0),oo([$],e.prototype,"_width",void 0),oo([$],e.prototype,"_height",void 0),oo([$],e.prototype,"anchorsOffset",void 0),oo([$],e.prototype,"isSelected",void 0),oo([$],e.prototype,"isHovered",void 0),oo([$],e.prototype,"isShowAnchor",void 0),oo([$],e.prototype,"isDragging",void 0),oo([$],e.prototype,"isHitable",void 0),oo([$],e.prototype,"isHittable",void 0),oo([$],e.prototype,"draggable",void 0),oo([$],e.prototype,"visible",void 0),oo([$],e.prototype,"enableRotate",void 0),oo([$],e.prototype,"enableResize",void 0),oo([$],e.prototype,"zIndex",void 0),oo([$],e.prototype,"state",void 0),oo([$],e.prototype,"autoToFront",void 0),oo([$],e.prototype,"style",void 0),oo([$],e.prototype,"transform",void 0),oo([$],e.prototype,"_rotate",void 0),oo([rt],e.prototype,"incoming",null),oo([rt],e.prototype,"outgoing",null),oo([te],e.prototype,"addNodeMoveRules",null),oo([te],e.prototype,"move",null),oo([te],e.prototype,"getMoveDistance",null),oo([te],e.prototype,"moveTo",null),oo([te],e.prototype,"moveText",null),oo([te],e.prototype,"updateText",null),oo([te],e.prototype,"setSelected",null),oo([te],e.prototype,"setHovered",null),oo([te],e.prototype,"setIsShowAnchor",null),oo([te],e.prototype,"setEnableRotate",null),oo([te],e.prototype,"setEnableResize",null),oo([te],e.prototype,"setHitable",null),oo([te],e.prototype,"setHittable",null),oo([te],e.prototype,"setElementState",null),oo([te],e.prototype,"setProperty",null),oo([te],e.prototype,"setProperties",null),oo([te],e.prototype,"deleteProperty",null),oo([te],e.prototype,"setStyle",null),oo([te],e.prototype,"setStyles",null),oo([te],e.prototype,"updateStyles",null),oo([te],e.prototype,"setZIndex",null),oo([te],e.prototype,"updateAttributes",null),e}(),Mb=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.CIRCLE_NODE,o.properties={},o.r=50,o.properties=n.properties||{},o.setAttributes(),o}return eo(n,e),Object.defineProperty(n.prototype,"width",{get:function(){return 2*this.r},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return 2*this.r},enumerable:!1,configurable:!0}),n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this);var t=this.properties.r;t&&(this.r=t)},n.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this),n=this.graphModel.theme.circle,r=this.properties.style,o=void 0===r?{}:r;return no(no(no({},t),up(n)),up(o))},n.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,r=t.r;return[{x:e,y:n-r,id:"".concat(this.id,"_0")},{x:e+r,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+r,id:"".concat(this.id,"_2")},{x:e-r,y:n,id:"".concat(this.id,"_3")}]},n.prototype.resize=function(t){var e=t.width,n=t.deltaX,r=t.deltaY;return this.move(n/2,r/2),this.r=e,this.setProperties({r:e}),this.getData()},oo([$],n.prototype,"properties",void 0),oo([$],n.prototype,"r",void 0),oo([rt],n.prototype,"width",null),oo([rt],n.prototype,"height",null),n}(Sb),Ab=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.DIAMOND_NODE,o.rx=30,o.ry=50,o.properties={},o.properties=n.properties||{},o.setAttributes(),o}return eo(n,e),n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this);var t=this.properties,n=t.rx,r=t.ry;n&&(this.rx=n),r&&(this.ry=r)},n.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this),n=this.graphModel.theme.diamond,r=this.properties.style,o=void 0===r?{}:r;return no(no(no({},t),up(n)),up(o))},Object.defineProperty(n.prototype,"points",{get:function(){var t=this,e=t.x,n=t.y,r=t.rx,o=t.ry;return[[e,n-o],[e+r,n],[e,n+o],[e-r,n]]},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pointsPosition",{get:function(){return wf(this.points,(function(t){var e=io(t,2);return{x:e[0],y:e[1]}}))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"width",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return Yd(this.points,(function(n){var r=io(n,1)[0];r<t&&(t=r),r>e&&(e=r)})),e-t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return Yd(this.points,(function(n){var r=io(n,2)[1];r<t&&(t=r),r>e&&(e=r)})),e-t},enumerable:!1,configurable:!0}),n.prototype.getDefaultAnchor=function(){var t=this;return wf(this.points,(function(e,n){var r=io(e,2);return{x:r[0],y:r[1],id:"".concat(t.id,"_").concat(n)}}))},n.prototype.resize=function(t){var e=t.width,n=t.height,r=t.deltaX,o=t.deltaY;return this.move(r/2,o/2),this.rx=e,this.ry=n,this.setProperties({rx:e,ry:n}),this.getData()},oo([$],n.prototype,"rx",void 0),oo([$],n.prototype,"ry",void 0),oo([$],n.prototype,"properties",void 0),oo([rt],n.prototype,"points",null),oo([rt],n.prototype,"pointsPosition",null),oo([rt],n.prototype,"width",null),oo([rt],n.prototype,"height",null),n}(Sb),Tb=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.ELLIPSE_NODE,o.rx=30,o.ry=45,o.properties={},o.properties=n.properties||{},o.setAttributes(),o}return eo(n,e),n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this);var t=this.properties,n=t.rx,r=t.ry;n&&(this.rx=n),r&&(this.ry=r)},n.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this),n=this.graphModel.theme.ellipse,r=this.properties.style,o=void 0===r?{}:r;return no(no(no({},t),up(n)),up(o))},Object.defineProperty(n.prototype,"width",{get:function(){return 2*this.rx},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return 2*this.ry},enumerable:!1,configurable:!0}),n.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,r=t.rx,o=t.ry;return[{x:e,y:n-o,id:"".concat(this.id,"_0")},{x:e+r,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+o,id:"".concat(this.id,"_2")},{x:e-r,y:n,id:"".concat(this.id,"_3")}]},n.prototype.resize=function(t){var e=t.width,n=t.height,r=t.deltaX,o=t.deltaY;return this.move(r/2,o/2),this.rx=e,this.ry=n,this.setProperties({rx:e,ry:n}),this.getData()},oo([$],n.prototype,"rx",void 0),oo([$],n.prototype,"ry",void 0),oo([$],n.prototype,"properties",void 0),oo([rt],n.prototype,"width",null),oo([rt],n.prototype,"height",null),n}(Sb),Ob=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.POLYGON_NODE,o.points=[[50,0],[100,50],[50,100],[0,50]],o.properties={},o.properties=n.properties||{},o.setAttributes(),o}return eo(n,e),n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this);var t=this.properties,n=t.points,r=t.width,o=t.height,i=n||this.points;this.points=sm(i,r,o)},n.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this),n=this.graphModel.theme.polygon,r=this.properties.style,o=void 0===r?{}:r;return no(no(no({},t),up(n)),up(o))},Object.defineProperty(n.prototype,"pointsPosition",{get:function(){var t=this,e=t.x,n=t.y,r=t.width,o=t.height;return this.points.map((function(t){return{x:t[0]+e-r/2,y:t[1]+n-o/2}}))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"width",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return this.points.forEach((function(n){var r=io(n,1)[0];r<t&&(t=r),r>e&&(e=r)})),e-t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return this.points.forEach((function(n){var r=io(n,2)[1];r<t&&(t=r),r>e&&(e=r)})),e-t},enumerable:!1,configurable:!0}),n.prototype.getDefaultAnchor=function(){var t=this,e=this,n=e.x,r=e.y,o=e.width,i=e.height;return e.points.map((function(e,a){var s=io(e,2),u=s[0],l=s[1];return{x:n+u-o/2,y:r+l-i/2,id:"".concat(t.id,"_").concat(a)}}))},n.prototype.resize=function(t){var e=this,n=t.width,r=t.height,o=t.deltaX,i=t.deltaY;this.move(o/2,i/2);var a=wf(this.points,(function(t){var o=io(t,2),i=o[0],a=o[1];return[i*n/e.width,a*r/e.height]}));return this.points=a,this.properties.points=a,this.getData()},oo([$],n.prototype,"points",void 0),oo([$],n.prototype,"properties",void 0),oo([rt],n.prototype,"pointsPosition",null),oo([rt],n.prototype,"width",null),oo([rt],n.prototype,"height",null),n}(Sb),Nb=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.RECT_NODE,o.radius=0,o.properties={},o.properties=n.properties||{},o.setAttributes(),o}return eo(n,e),n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this);var t=this.properties,n=t.width,r=t.height,o=t.radius;n&&(this.width=n),r&&(this.height=r),o&&(this.radius=o)},n.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,r=t.width,o=t.height;return[{x:e,y:n-o/2,id:"".concat(this.id,"_0")},{x:e+r/2,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+o/2,id:"".concat(this.id,"_2")},{x:e-r/2,y:n,id:"".concat(this.id,"_3")}]},n.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this),n=this.graphModel.theme.rect,r=this.properties.style,o=void 0===r?{}:r;return no(no(no({},t),up(n)),up(o))},oo([$],n.prototype,"radius",void 0),oo([$],n.prototype,"properties",void 0),n}(Sb),Db=function(e){function n(){var n=e.apply(this,ao([],io(arguments),!1))||this;return n.modelType=t.ModelType.TEXT_NODE,n}return eo(n,e),n.prototype.getTextStyle=function(){var t=e.prototype.getTextStyle.call(this),n=this.graphModel.theme.text;return no(no({},t),up(n))},Object.defineProperty(n.prototype,"width",{get:function(){var t=String(this.text.value).split(/[\r\n]/g),e=this.getTextStyle().fontSize;return km({rows:t,fontSize:e,rowsLength:t.length}).width},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){var t=String(this.text.value).split(/[\r\n]/g),e=this.getTextStyle().fontSize;return km({rows:t,fontSize:e,rowsLength:t.length}).height},enumerable:!1,configurable:!0}),oo([rt],n.prototype,"width",null),oo([rt],n.prototype,"height",null),n}(Sb),Pb=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.HTML_NODE,o.properties={},o.properties=n.properties||{},o.setAttributes(),o}return eo(n,e),n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this);var t=this.properties,n=t.width,r=t.height;n&&(this.width=n),r&&(this.height=r)},n.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,r=t.width,o=t.height;return[{x:e,y:n-o/2,id:"".concat(this.id,"_0")},{x:e+r/2,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+o/2,id:"".concat(this.id,"_2")},{x:e-r/2,y:n,id:"".concat(this.id,"_3")}]},oo([$],n.prototype,"properties",void 0),n}(Sb),Cb={stopZoomGraph:!1,stopScrollGraph:!1,stopMoveGraph:!1,adjustEdge:!1,adjustEdgeStartAndEnd:!1,adjustNodePosition:!1,hideAnchors:!0,allowRotate:!1,allowResize:!1,nodeSelectedOutline:!0,nodeTextEdit:!1,edgeTextEdit:!1,nodeTextDraggable:!1,edgeTextDraggable:!1},Ib=["isSilentMode","stopZoomGraph","stopScrollGraph","stopMoveGraph","adjustEdge","adjustEdgeMiddle","adjustEdgeStartAndEnd","adjustNodePosition","hideAnchors","allowRotate","allowResize","hoverOutline","nodeSelectedOutline","edgeSelectedOutline","nodeTextEdit","edgeTextEdit","nodeTextDraggable","edgeTextDraggable","multipleSelectKey","autoExpand"],jb=function(){function t(t){this.isSilentMode=!1,this.stopZoomGraph=!1,this.stopScrollGraph=!1,this.stopMoveGraph=!1,this.adjustEdge=!0,this.adjustEdgeMiddle=!1,this.adjustEdgeStartAndEnd=!1,this.adjustNodePosition=!0,this.hideAnchors=!1,this.allowRotate=!1,this.allowResize=!1,this.hoverOutline=!0,this.nodeSelectedOutline=!0,this.edgeSelectedOutline=!0,this.nodeTextEdit=!0,this.edgeTextEdit=!0,this.nodeTextDraggable=!1,this.edgeTextDraggable=!1,this.autoExpand=!1,this.multipleSelectKey="",this.defaultConfig={},js(this,this.getConfigDetail(t))}return t.prototype.updateEditConfig=function(t){var e=this.getConfigDetail(t);js(this,e)},t.prototype.getConfigDetail=function(t){var e=t.isSilentMode,n=t.textEdit,r={};if(!1===e&&js(r,this.defaultConfig),!0===e&&e!==this.isSilentMode){var o=Hy(Cb,Ib);this.defaultConfig={stopZoomGraph:this.stopZoomGraph,stopScrollGraph:this.stopScrollGraph,stopMoveGraph:this.stopMoveGraph,adjustEdge:this.adjustEdge,adjustEdgeMiddle:this.adjustEdgeMiddle,adjustEdgeStartAndEnd:this.adjustEdgeStartAndEnd,adjustNodePosition:this.adjustNodePosition,hideAnchors:this.hideAnchors,allowRotate:this.allowRotate,allowResize:this.allowResize,hoverOutline:this.hoverOutline,nodeSelectedOutline:this.nodeSelectedOutline,edgeSelectedOutline:this.edgeSelectedOutline,nodeTextEdit:this.nodeTextEdit,edgeTextEdit:this.edgeTextEdit,nodeTextDraggable:this.nodeTextDraggable,edgeTextDraggable:this.edgeTextDraggable,autoExpand:this.autoExpand},js(r,o)}!1===n&&js(r,{nodeTextEdit:!1,edgeTextEdit:!1});var i=Hy(t,Ib);return js(r,i)},t.prototype.getConfig=function(){return Hy(this,Ib)},oo([$],t.prototype,"isSilentMode",void 0),oo([$],t.prototype,"stopZoomGraph",void 0),oo([$],t.prototype,"stopScrollGraph",void 0),oo([$],t.prototype,"stopMoveGraph",void 0),oo([$],t.prototype,"adjustEdge",void 0),oo([$],t.prototype,"adjustEdgeMiddle",void 0),oo([$],t.prototype,"adjustEdgeStartAndEnd",void 0),oo([$],t.prototype,"adjustNodePosition",void 0),oo([$],t.prototype,"hideAnchors",void 0),oo([$],t.prototype,"allowRotate",void 0),oo([$],t.prototype,"allowResize",void 0),oo([$],t.prototype,"hoverOutline",void 0),oo([$],t.prototype,"nodeSelectedOutline",void 0),oo([$],t.prototype,"edgeSelectedOutline",void 0),oo([$],t.prototype,"nodeTextEdit",void 0),oo([$],t.prototype,"edgeTextEdit",void 0),oo([$],t.prototype,"nodeTextDraggable",void 0),oo([$],t.prototype,"edgeTextDraggable",void 0),oo([$],t.prototype,"autoExpand",void 0),oo([te],t.prototype,"updateEditConfig",null),t}(),kb=function(){function t(){this._events={}}return t.prototype.on=function(t,e,n){var r=this;null==t||t.split(",").forEach((function(t){t=t.trim(),r._events[t]||(r._events[t]=[]),r._events[t].push({callback:e,once:!!n})}))},t.prototype.once=function(t,e){var n=this;null==t||t.split(",").forEach((function(t){t=t.trim(),n.on(t,e,!0)}))},t.prototype.emit=function(t,e){var n=this;null==t||t.split(",").forEach((function(t){var r=n._events[t]||[],o=n._events["*"]||[],i=function(r){for(var o=r.length,i=0;i<o;i++)if(r[i]){var a=r[i],s=a.callback;a.once&&(r.splice(i,1),0===r.length&&delete n._events[t],o--,i--),s.apply(n,[e])}};i(r),i(o)}))},t.prototype.off=function(t,e){var n=this;t||(this._events={}),t.split(",").forEach((function(t){if(e){for(var r=n._events[t]||[],o=r.length,i=0;i<o;i++)r[i].callback===e&&(r.splice(i,1),o--,i--);0===r.length&&delete n._events[t]}else delete n._events[t]}))},t.prototype.getEvents=function(){return this._events},t}(),Rb=function(){function e(t){this.modelMap=new Map,this.nodeMoveRules=[],this.nodes=[],this.edges=[],this.overlapMode=c_.DEFAULT,this.gridSize=1,this.partial=!1;var e=t.container,n=t.partial,r=t.background,o=void 0===r?{}:r,i=t.grid,a=t.idGenerator,s=t.edgeGenerator,u=t.animation,l=t.customTrajectory;this.rootEl=e,this.partial=!!n,this.background=o,"object"==typeof i&&(this.gridSize=i.size||1),this.theme=fb(t.style),this.edgeType=t.edgeType||"polyline",this.animation=n_(u),this.overlapMode=t.overlapMode||c_.DEFAULT,this.width=t.width||this.rootEl.getBoundingClientRect().width,this.height=t.height||this.rootEl.getBoundingClientRect().height,this.eventCenter=new kb,this.editConfigModel=new jb(t),this.transformModel=new zb(this.eventCenter,t),this.flowId=nb(),this.idGenerator=a,this.edgeGenerator=om(this,s),this.customTrajectory=l}return Object.defineProperty(e.prototype,"nodesMap",{get:function(){return this.nodes.reduce((function(t,e,n){return t[e.id]={index:n,model:e},t}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"edgesMap",{get:function(){return this.edges.reduce((function(t,e,n){return t[e.id]={index:n,model:e},t}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"modelsMap",{get:function(){return ao(ao([],io(this.nodes),!1),io(this.edges),!1).reduce((function(t,e){return t[e.id]=e,t}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sortElements",{get:function(){for(var t=ao(ao([],io(this.nodes),!1),io(this.edges),!1).sort((function(t,e){return t.zIndex-e.zIndex})),e=[],n=[-200,-200],r=[this.width+d_,this.height+d_],o=0;o<t.length;o++){var i=t[o];i.visible&&(!this.partial||i.isSelected||this.isElementInArea(i,n,r,!1,!1))&&e.push(i)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textEditElement",{get:function(){var e=this.nodes.find((function(e){return e.state===t.ElementState.TEXT_EDIT})),n=this.edges.find((function(e){return e.state===t.ElementState.TEXT_EDIT}));return e||n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selectElements",{get:function(){var t=new Map;return this.nodes.forEach((function(e){e.isSelected&&t.set(e.id,e)})),this.edges.forEach((function(e){e.isSelected&&t.set(e.id,e)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selectNodes",{get:function(){var t=[];return this.nodes.forEach((function(e){e.isSelected&&t.push(e)})),t},enumerable:!1,configurable:!0}),e.prototype.getAreaElement=function(t,e,n,r,o){var i=this;void 0===n&&(n=!0),void 0===r&&(r=!0),void 0===o&&(o=!1);var a=[];return Yd(ao(ao([],io(this.nodes),!1),io(this.edges),!1),(function(s){var u=i.isElementInArea(s,t,e,n,r);o&&!s.visible||!u||a.push(s)})),a},e.prototype.getModel=function(t){return this.modelMap.get(t)},e.prototype.getNodeModelById=function(t){var e;return this.fakeNode&&t===this.fakeNode.id?this.fakeNode:null===(e=this.nodesMap[t])||void 0===e?void 0:e.model},e.prototype.getPointByClient=function(t){var e=t.x,n=t.y,r=this.rootEl.getBoundingClientRect(),o={x:e-r.left,y:n-r.top},i=io(this.transformModel.HtmlPointToCanvasPoint([o.x,o.y]),2);return{domOverlayPosition:o,canvasOverlayPosition:{x:i[0],y:i[1]}}},e.prototype.isElementInArea=function(e,n,r,o,i){var a;if(void 0===o&&(o=!0),void 0===i&&(i=!0),e.BaseType===t.ElementType.NODE){for(var s=Mm(e),u=s.minX,l=s.minY,c=s.maxX,p=s.maxY,d=[{x:u,y:l},{x:c,y:l},{x:c,y:p},{x:u,y:p}],f=i,h=0;h<d.length;h++){var y=d[h],v=y.x,g=y.y;if(v=(a=io(this.transformModel.CanvasPointToHtmlPoint([v,g]),2))[0],g=a[1],um([v,g],n,r)!==i){f=!i;break}}return f}if(e.BaseType===t.ElementType.EDGE){var _=e.startPoint,m=e.endPoint,b=this.transformModel.CanvasPointToHtmlPoint([_.x,_.y]),E=this.transformModel.CanvasPointToHtmlPoint([m.x,m.y]),x=um(b,n,r),w=um(E,n,r);return o?x&&w:x||w}return!1},e.prototype.graphDataToModel=function(t){var e=this;if(this.width&&this.height||this.resize(),!t)return this.nodes=[],void(this.edges=[]);t.nodes?this.nodes=wf(t.nodes,(function(t){return e.getModelAfterSnapToGrid(t)})):this.nodes=[],t.edges?this.edges=wf(t.edges,(function(t){var n,r=e.getModel(null!==(n=t.type)&&void 0!==n?n:"");if(!r)throw new Error("找不到".concat(t.type,"对应的边。"));return new r(t,e)})):this.edges=[]},e.prototype.modelToGraphData=function(){var t=[];this.edges.forEach((function(e){var n=e.getData();n&&!e.virtual&&t.push(n)}));var e=[];return this.nodes.forEach((function(t){var n=t.getData();n&&!t.virtual&&e.push(n)})),{nodes:e,edges:t}},e.prototype.modelToHistoryData=function(){for(var t=!1,e=[],n=0;n<this.nodes.length;n++){var r=this.nodes[n];if(r.isDragging){t=!0;break}e.push(r.getHistoryData())}if(t)return!1;for(var o=!1,i=[],a=0;a<this.edges.length;a++){var s=this.edges[a];if(s.isDragging){o=!0;break}i.push(s.getHistoryData())}return!o&&{nodes:e,edges:i}},e.prototype.getEdgeModelById=function(t){var e;return null===(e=this.edgesMap[t])||void 0===e?void 0:e.model},e.prototype.getElement=function(t){return this.modelsMap[t]},e.prototype.getNodeEdges=function(t){for(var e=[],n=0;n<this.edges.length;n++){var r=this.edges[n],o=r.sourceNodeId===t,i=r.targetNodeId===t;(o||i)&&e.push(r)}return e},e.prototype.getSelectElements=function(e){void 0===e&&(e=!0);var n=this.selectElements,r={nodes:[],edges:[]};return n.forEach((function(o){if(o.BaseType===t.ElementType.NODE&&r.nodes.push(o.getData()),o.BaseType===t.ElementType.EDGE){var i=o.getData(),a=n.get(i.sourceNodeId)&&n.get(i.targetNodeId);(e||a)&&r.edges.push(i)}})),r},e.prototype.updateAttributes=function(t,e){var n=this.getElement(t);null==n||n.updateAttributes(e)},e.prototype.changeNodeId=function(t,e){return e||(e=nb()),this.nodesMap[e]?(console.warn("当前流程图已存在节点".concat(e,", 修改失败")),""):this.nodesMap[t]?(this.edges.forEach((function(n){n.sourceNodeId===t&&(n.sourceNodeId=e),n.targetNodeId===t&&(n.targetNodeId=e)})),this.nodesMap[t].model.id=e,this.nodesMap[e]=this.nodesMap[t],e):(console.warn("当前流程图找不到节点".concat(t,", 修改失败")),"")},e.prototype.changeEdgeId=function(t,e){return e||(e=nb()),this.edgesMap[e]?(console.warn("当前流程图已存在边: ".concat(e,", 修改失败")),""):this.edgesMap[t]?(this.edges.forEach((function(n){n.id===t&&n.changeEdgeId(e)})),e):(console.warn("当前流程图找不到边: ".concat(e,", 修改失败")),"")},e.prototype.setFakeNode=function(t){this.fakeNode=t},e.prototype.removeFakeNode=function(){this.fakeNode=null},e.prototype.setModel=function(t,e){return this.modelMap.set(t,e)},e.prototype.toFront=function(t){var e,n,r,o=(null===(e=this.nodesMap[t])||void 0===e?void 0:e.model)||(null===(n=this.edgesMap[t])||void 0===n?void 0:n.model);o&&(this.overlapMode===c_.DEFAULT&&(null===(r=this.topElement)||void 0===r||r.setZIndex(),o.setZIndex(9999),this.topElement=o),this.overlapMode===c_.INCREASE&&this.setElementZIndex(t,"top"))},e.prototype.setElementZIndex=function(t,e){var n,r,o=(null===(n=this.nodesMap[t])||void 0===n?void 0:n.model)||(null===(r=this.edgesMap[t])||void 0===r?void 0:r.model);if(o){var i=void 0;"number"==typeof e?i=e:("top"===e&&(i=gb()),"bottom"===e&&(i=_b())),o.setZIndex(i)}},e.prototype.deleteNode=function(e){var n=this.nodesMap[e].model.getData();this.deleteEdgeBySource(e),this.deleteEdgeByTarget(e),this.nodes.splice(this.nodesMap[e].index,1),this.eventCenter.emit(t.EventType.NODE_DELETE,{data:n})},e.prototype.addNode=function(e,n,r){void 0===n&&(n=t.EventType.NODE_ADD);var o=i_(e),i=o.id;i&&this.nodesMap[i]&&delete o.id;var a=this.getModelAfterSnapToGrid(o);this.nodes.push(a);var s={data:a.getData()};return r&&(s.e=r),this.eventCenter.emit(n,s),a},e.prototype.getModelAfterSnapToGrid=function(t){var e=this.getModel(t.type);if(!e)throw new Error("找不到".concat(t.type,"对应的节点,请确认是否已注册此类型节点。"));var n=t.x,r=t.y;return n&&r&&(t.x=am(n,this.gridSize),t.y=am(r,this.gridSize),"object"==typeof t.text&&(t.text.x+=t.x-n,t.text.y+=t.y-r)),new e(t,this)},e.prototype.cloneNode=function(t){var e=this.getNodeModelById(t),n=null==e?void 0:e.getData();if(n){n.x+=30,n.y+=30,n.id="",n.text&&(n.text.x+=30,n.text.y+=30);var r=this.addNode(n);return r.setSelected(!0),null==e||e.setSelected(!1),r.getData()}},e.prototype.moveNode=function(t,e,n,r){var o;void 0===r&&(r=!1);var i=this.nodesMap[t];i?(e=(o=io(i.model.getMoveDistance(e,n,r),2))[0],n=o[1],this.moveEdge(t,e,n)):console.warn("不存在id为".concat(t,"的节点"))},e.prototype.moveNode2Coordinate=function(t,e,n,r){void 0===r&&(r=!1);var o=this.nodesMap[t];if(o){var i=o.model,a=e-i.x,s=n-i.y;this.moveNode(t,a,s,r)}else console.warn("不存在id为".concat(t,"的节点"))},e.prototype.editText=function(e){this.setElementStateById(e,t.ElementState.TEXT_EDIT)},e.prototype.addEdge=function(e){var n=i_(e),r=n.type;r||(r=this.edgeType),n.id&&this.edgesMap[n.id]&&delete n.id;var o=this.getModel(r);if(!o)throw new Error("找不到".concat(r,"对应的边,请确认是否已注册此类型边。"));var i=new o(no(no({},n),{type:r}),this),a=i.getData();return this.edges.push(i),this.eventCenter.emit(t.EventType.EDGE_ADD,{data:a}),i},e.prototype.moveEdge=function(t,e,n){for(var r=0;r<this.edges.length;r++){var o=this.edges[r],i=o.textPosition,a=i.x,s=i.y,u=this.edges[r].sourceNodeId===t,l=this.edges[r].targetNodeId===t;u&&o.moveStartPoint(e,n),l&&o.moveEndPoint(e,n),(u||l)&&this.handleEdgeTextMove(o,a,s)}},e.prototype.handleEdgeTextMove=function(e,n,r){var o;if(e.customTextPosition)e.resetTextPosition();else if(e.modelType===t.ModelType.POLYLINE_EDGE&&(null===(o=e.text)||void 0===o?void 0:o.value)){var i=e.text,a=em(i,e.points);e.moveText(a.x-i.x,a.y-i.y)}else{var s=e.textPosition,u=s.x,l=s.y;e.moveText(u-n,l-r)}},e.prototype.deleteEdgeBySourceAndTarget=function(e,n){for(var r=0;r<this.edges.length;r++)if(this.edges[r].sourceNodeId===e&&this.edges[r].targetNodeId===n){var o=this.edges[r].getData();this.edges.splice(r,1),r--,this.eventCenter.emit(t.EventType.EDGE_DELETE,{data:o})}},e.prototype.deleteEdgeById=function(e){if(this.edgesMap[e]){var n=this.edgesMap[e].index,r=this.edgesMap[e].model.getData();this.edges.splice(n,1),this.eventCenter.emit(t.EventType.EDGE_DELETE,{data:r})}},e.prototype.deleteEdgeBySource=function(e){for(var n=0;n<this.edges.length;n++)if(this.edges[n].sourceNodeId===e){var r=this.edges[n].getData();this.edges.splice(n,1),n--,this.eventCenter.emit(t.EventType.EDGE_DELETE,{data:r})}},e.prototype.deleteEdgeByTarget=function(e){for(var n=0;n<this.edges.length;n++)if(this.edges[n].targetNodeId===e){var r=this.edges[n].getData();this.edges.splice(n,1),n--,this.eventCenter.emit(t.EventType.EDGE_DELETE,{data:r})}},e.prototype.setElementStateById=function(e,n,r){this.nodes.forEach((function(o){o.id===e?o.setElementState(n,r):o.setElementState(t.ElementState.DEFAULT)})),this.edges.forEach((function(o){o.id===e?o.setElementState(n,r):o.setElementState(t.ElementState.DEFAULT)}))},e.prototype.updateText=function(t,e){var n=yf(ao(ao([],io(this.nodes),!1),io(this.edges),!1),(function(e){return e.id===t}));null==n||n.updateText(e)},e.prototype.selectNodeById=function(t,e){var n;void 0===e&&(e=!1),e||this.clearSelectElements();var r=null===(n=this.nodesMap[t])||void 0===n?void 0:n.model;null==r||r.setSelected(!0)},e.prototype.selectEdgeById=function(t,e){var n;void 0===e&&(e=!1),e||this.clearSelectElements();var r=null===(n=this.edgesMap[t])||void 0===n?void 0:n.model;null==r||r.setSelected(!0)},e.prototype.selectElementById=function(t,e){void 0===e&&(e=!1),e||this.clearSelectElements();var n=this.getElement(t);null==n||n.setSelected(!0)},e.prototype.clearSelectElements=function(){var t;this.selectElements.forEach((function(t){null==t||t.setSelected(!1)})),this.selectElements.clear(),this.overlapMode===c_.DEFAULT&&(null===(t=this.topElement)||void 0===t||t.setZIndex())},e.prototype.moveNodes=function(e,n,r,o){var i,a,s,u=this;void 0===o&&(o=!1);for(var l=e.reduce((function(t,e){var i=u.nodesMap[e].model;return t[e]=i.getMoveDistance(n,r,o),t}),{}),c=0;c<this.edges.length;c++){var p=this.edges[c],d=p.textPosition,f=d.x,h=d.y,y=l[p.sourceNodeId],v=l[p.targetNodeId],g=void 0,_=void 0;y&&v&&p.modelType===t.ModelType.POLYLINE_EDGE?(g=(i=io(y,2))[0],_=i[1],p.updatePointsList(g,_)):(y&&(g=(a=io(y,2))[0],_=a[1],p.moveStartPoint(g,_)),v&&(g=(s=io(v,2))[0],_=s[1],p.moveEndPoint(g,_))),(y||v)&&this.handleEdgeTextMove(p,f,h)}},e.prototype.addNodeMoveRules=function(t){this.nodeMoveRules.includes(t)||this.nodeMoveRules.push(t)},e.prototype.setDefaultEdgeType=function(t){this.edgeType=t},e.prototype.changeNodeType=function(t,e){var n=this.getNodeModelById(t);if(n){var r=n.getData();r.type=e;var o=this.getModel(e);if(!o)throw new Error("找不到".concat(e,"对应的节点,请确认是否已注册此类型节点。"));var i=new o(r,this);this.nodes.splice(this.nodesMap[t].index,1,i),this.getNodeEdges(t).forEach((function(e){if(e.sourceNodeId===t){var n=Im(i,e.startPoint,i.width,i.height);e.updateStartPoint(n)}if(e.targetNodeId===t){n=Im(i,e.endPoint,i.width,i.height);e.updateEndPoint(n)}}))}else console.warn("找不到id为".concat(t,"的节点"))},e.prototype.changeEdgeType=function(t,e){var n=this.getEdgeModelById(t);if(n){if(n.type!==e){var r=n.getData();r.type=e;var o=this.getModel(e);if(!o)throw new Error("找不到".concat(e,"对应的节点,请确认是否已注册此类型节点。"));delete r.pointsList;var i=new o(r,this);this.edges.splice(this.edgesMap[t].index,1,i)}}else console.warn("找不到id为".concat(t,"的边"))},e.prototype.getNodeIncomingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.targetNodeId===t&&e.push(n)})),e},e.prototype.getNodeOutgoingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.sourceNodeId===t&&e.push(n)})),e},e.prototype.getAnchorIncomingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.targetAnchorId===t&&e.push(n)})),e},e.prototype.getAnchorOutcomingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.sourceAnchorId===t&&e.push(n)})),e},e.prototype.getNodeIncomingNode=function(t){var e=this,n=[];return this.edges.forEach((function(r){var o;r.targetNodeId===t&&n.push(null===(o=e.nodesMap[r.sourceNodeId])||void 0===o?void 0:o.model)})),n},e.prototype.getNodeOutgoingNode=function(t){var e=this,n=[];return this.edges.forEach((function(r){r.sourceNodeId===t&&n.push(e.nodesMap[r.targetNodeId].model)})),n},e.prototype.setTheme=function(t){this.theme=hb(no(no({},this.theme),t))},e.prototype.resize=function(t,e){this.width=t||this.rootEl.getBoundingClientRect().width,this.height=e||this.rootEl.getBoundingClientRect().height,this.width&&this.height||console.warn("渲染画布的时候无法获取画布宽高,请确认在container已挂载到DOM。@see https://github.com/didi/LogicFlow/issues/675")},e.prototype.clearData=function(){this.nodes=[],this.edges=[]},e.prototype.getVirtualRectSize=function(){var t=this.nodes,e=[],n=[];t.forEach((function(t){var r=t.x,o=t.y,i=t.width,a=t.height,s=t.getNodeStyle().strokeWidth,u=void 0===s?0:s,l=r+i/2+u,c=r-i/2-u,p=o+a/2+u,d=o-a/2-u;e=e.concat([l,c].filter((function(t){return!Number.isNaN(t)}))),n=n.concat([p,d].filter((function(t){return!Number.isNaN(t)})))}));var r=Math.min.apply(Math,ao([],io(e),!1)),o=Math.max.apply(Math,ao([],io(e),!1)),i=Math.min.apply(Math,ao([],io(n),!1)),a=o-r||0,s=Math.max.apply(Math,ao([],io(n),!1))-i||0;return{width:a,height:s,x:r+a/2,y:i+s/2}},e.prototype.translateCenter=function(){var t=this,e=t.nodes,n=t.width,r=t.height,o=t.rootEl,i=t.transformModel;if(e.length){var a=n||o.clientWidth,s=r||o.clientHeight,u=this.getVirtualRectSize(),l=u.x,c=u.y;i.focusOn(l,c,a,s)}},e.prototype.fitView=function(t,e){void 0===t&&(t=20),void 0===e&&(e=20);var n=this,r=n.nodes,o=n.width,i=n.height,a=n.rootEl,s=n.transformModel;if(r.length){var u=o||a.clientWidth,l=i||a.clientHeight,c=this.getVirtualRectSize(),p=c.width,d=c.height,f=c.x,h=c.y,y=(p+e)/u,v=(d+t)/l,g=1/Math.max(y,v),_=[u/2,l/2];s.zoom(g,_),s.focusOn(f,h,u,l)}},e.prototype.openEdgeAnimation=function(t){var e=this.getEdgeModelById(t);null==e||e.openEdgeAnimation()},e.prototype.closeEdgeAnimation=function(t){var e=this.getEdgeModelById(t);null==e||e.closeEdgeAnimation()},oo([$],e.prototype,"width",void 0),oo([$],e.prototype,"height",void 0),oo([$],e.prototype,"edgeType",void 0),oo([$],e.prototype,"nodes",void 0),oo([$],e.prototype,"edges",void 0),oo([$],e.prototype,"fakeNode",void 0),oo([$],e.prototype,"overlapMode",void 0),oo([$],e.prototype,"background",void 0),oo([$],e.prototype,"gridSize",void 0),oo([$],e.prototype,"transformModel",void 0),oo([$],e.prototype,"editConfigModel",void 0),oo([$],e.prototype,"partial",void 0),oo([rt],e.prototype,"nodesMap",null),oo([rt],e.prototype,"edgesMap",null),oo([rt],e.prototype,"modelsMap",null),oo([rt],e.prototype,"sortElements",null),oo([rt],e.prototype,"textEditElement",null),oo([rt],e.prototype,"selectElements",null),oo([rt],e.prototype,"selectNodes",null),oo([te],e.prototype,"setFakeNode",null),oo([te],e.prototype,"removeFakeNode",null),oo([te],e.prototype,"setModel",null),oo([te],e.prototype,"toFront",null),oo([te],e.prototype,"setElementZIndex",null),oo([te],e.prototype,"deleteNode",null),oo([te],e.prototype,"addNode",null),oo([te],e.prototype,"cloneNode",null),oo([te],e.prototype,"moveNode",null),oo([te],e.prototype,"moveNode2Coordinate",null),oo([te],e.prototype,"editText",null),oo([te],e.prototype,"addEdge",null),oo([te],e.prototype,"moveEdge",null),oo([te],e.prototype,"deleteEdgeBySourceAndTarget",null),oo([te],e.prototype,"deleteEdgeById",null),oo([te],e.prototype,"deleteEdgeBySource",null),oo([te],e.prototype,"deleteEdgeByTarget",null),oo([te],e.prototype,"setElementStateById",null),oo([te],e.prototype,"updateText",null),oo([te],e.prototype,"selectNodeById",null),oo([te],e.prototype,"selectEdgeById",null),oo([te],e.prototype,"selectElementById",null),oo([te],e.prototype,"clearSelectElements",null),oo([te],e.prototype,"moveNodes",null),oo([te],e.prototype,"setDefaultEdgeType",null),oo([te],e.prototype,"changeNodeType",null),oo([te],e.prototype,"changeEdgeType",null),oo([te],e.prototype,"getNodeIncomingEdge",null),oo([te],e.prototype,"getNodeOutgoingEdge",null),oo([te],e.prototype,"getAnchorIncomingEdge",null),oo([te],e.prototype,"getAnchorOutcomingEdge",null),oo([te],e.prototype,"getNodeIncomingNode",null),oo([te],e.prototype,"getNodeOutgoingNode",null),oo([te],e.prototype,"setTheme",null),oo([te],e.prototype,"resize",null),oo([te],e.prototype,"clearData",null),oo([te],e.prototype,"translateCenter",null),oo([te],e.prototype,"fitView",null),oo([te],e.prototype,"openEdgeAnimation",null),oo([te],e.prototype,"closeEdgeAnimation",null),e}(),Lb=function(){function t(t){this.isShowHorizontal=!1,this.isShowVertical=!1,this.position={x:0,y:0},this.graphModel=t}return t.prototype.getStyle=function(){return no({},this.graphModel.theme.snapline)},t.prototype.getCenterSnapLine=function(t,e){for(var n=t.x,r=t.y,o=!1,i=!1,a=0;a<e.length;a++){var s=e[a];if(s.id!==t.id&&(n===s.x&&(o=!0),r===s.y&&(i=!0),o&&i))break}return{isShowVertical:o,isShowHorizontal:i,position:{x:n,y:r}}},t.prototype.getHorizontalSnapline=function(t,e){var n,r=!1,o=0,i=t.id;if(i){var a=this.graphModel.fakeNode;if(a&&a.id===i)n=Mm(a);else{var s=this.graphModel.getNodeModelById(i);s&&(n=Mm(s))}}for(var u=0;u<e.length;u++){var l=e[u];if(l.id!==t.id){var c=Mm(l);if(c.minY===(null==n?void 0:n.minY)||c.maxY===(null==n?void 0:n.minY)){r=!0,o=n.minY;break}if(c.minY===(null==n?void 0:n.maxY)||c.maxY===(null==n?void 0:n.maxY)){r=!0,o=n.maxY;break}}}return{isShowHorizontal:r,isShowVertical:this.isShowVertical,position:no(no({},this.position),{y:o})}},t.prototype.getVerticalSnapline=function(t,e){var n,r=!1,o=0,i=t.id;if(i){var a=this.graphModel.fakeNode;if(a&&a.id===i)n=Mm(a);else{var s=this.graphModel.getNodeModelById(i);s&&(n=Mm(s))}}for(var u=0;u<e.length;u++){var l=e[u];if(l.id!==t.id){var c=Mm(l);if(c.minX===(null==n?void 0:n.minX)||c.maxX===(null==n?void 0:n.minX)){r=!0,o=n.minX;break}if(c.minX===(null==n?void 0:n.maxX)||c.maxX===(null==n?void 0:n.maxX)){r=!0,o=n.maxX;break}}}return{isShowHorizontal:this.isShowHorizontal,isShowVertical:r,position:no(no({},this.position),{x:o})}},t.prototype.getSnapLinePosition=function(t,e){var n=this.getCenterSnapLine(t,e),r=n.isShowHorizontal,o=n.isShowVertical;if(!r){var i=this.getHorizontalSnapline(t,e);i.isShowHorizontal&&(n.isShowHorizontal=i.isShowHorizontal,n.position.y=i.position.y)}if(!o){var a=this.getVerticalSnapline(t,e);a.isShowVertical&&(n.isShowVertical=a.isShowVertical,n.position.x=a.position.x)}return n},t.prototype.setSnaplineInfo=function(t){var e=t.isShowHorizontal,n=t.isShowVertical,r=t.position;this.position=r,this.isShowHorizontal=e,this.isShowVertical=n},t.prototype.clearSnapline=function(){this.position={x:0,y:0},this.isShowHorizontal=!1,this.isShowVertical=!1},t.prototype.setNodeSnapLine=function(t){var e=this.graphModel.nodes,n=this.getSnapLinePosition(t,e);this.setSnaplineInfo(n)},oo([$],t.prototype,"isShowHorizontal",void 0),oo([$],t.prototype,"isShowVertical",void 0),oo([$],t.prototype,"position",void 0),oo([te],t.prototype,"clearSnapline",null),oo([te],t.prototype,"setNodeSnapLine",null),t}(),Bb={false:[-1/0,-1/0,1/0,1/0],true:[0,0,0,0],vertical:[-1/0,0,1/0,0],horizontal:[0,-1/0,0,1/0]},zb=function(){function e(t,e){this.MINI_SCALE_SIZE=.2,this.MAX_SCALE_SIZE=16,this.SCALE_X=1,this.SKEW_Y=0,this.SKEW_X=0,this.SCALE_Y=1,this.TRANSLATE_X=0,this.TRANSLATE_Y=0,this.ZOOM_SIZE=.04,this.translateLimitMinX=-1/0,this.translateLimitMinY=-1/0,this.translateLimitMaxX=1/0,this.translateLimitMaxY=1/0,this.eventCenter=t;var n=e.stopMoveGraph,r=void 0!==n&&n;this.updateTranslateLimits(r)}return e.prototype.setZoomMiniSize=function(t){this.MINI_SCALE_SIZE=t},e.prototype.setZoomMaxSize=function(t){this.MAX_SCALE_SIZE=t},e.prototype.HtmlPointToCanvasPoint=function(t){var e=io(t,2),n=e[0],r=e[1];return[(n-this.TRANSLATE_X)/this.SCALE_X,(r-this.TRANSLATE_Y)/this.SCALE_Y]},e.prototype.CanvasPointToHtmlPoint=function(t){var e=io(t,2),n=e[0],r=e[1];return[n*this.SCALE_X+this.TRANSLATE_X,r*this.SCALE_Y+this.TRANSLATE_Y]},e.prototype.moveCanvasPointByHtml=function(t,e,n){var r=io(t,2),o=r[0],i=r[1];return[o+e/this.SCALE_X,i+n/this.SCALE_Y]},e.prototype.fixDeltaXY=function(t,e){return[t/this.SCALE_X,e/this.SCALE_Y]},e.prototype.getTransformStyle=function(){var t=[this.SCALE_X,this.SKEW_Y,this.SKEW_X,this.SCALE_Y,this.TRANSLATE_X,this.TRANSLATE_Y].join(",");return{transform:"matrix(".concat(t,")")}},e.prototype.zoom=function(t,e){void 0===t&&(t=!1);var n=this.SCALE_X,r=this.SCALE_Y;return"number"==typeof t?(n=t,r=t):t?(n+=this.ZOOM_SIZE,r+=this.ZOOM_SIZE):(n-=this.ZOOM_SIZE,r-=this.ZOOM_SIZE),n<this.MINI_SCALE_SIZE||n>this.MAX_SCALE_SIZE||(e&&(this.TRANSLATE_X-=(n-this.SCALE_X)*e[0],this.TRANSLATE_Y-=(r-this.SCALE_Y)*e[1]),this.SCALE_X=n,this.SCALE_Y=r,this.emitGraphTransform("zoom")),"".concat(100*this.SCALE_X,"%")},e.prototype.emitGraphTransform=function(e){this.eventCenter.emit(t.EventType.GRAPH_TRANSFORM,{type:e,transform:{SCALE_X:this.SCALE_X,SKEW_Y:this.SKEW_Y,SKEW_X:this.SKEW_X,SCALE_Y:this.SCALE_Y,TRANSLATE_X:this.TRANSLATE_X,TRANSLATE_Y:this.TRANSLATE_Y}})},e.prototype.resetZoom=function(){this.SCALE_X=1,this.SCALE_Y=1,this.emitGraphTransform("resetZoom")},e.prototype.translate=function(t,e){this.TRANSLATE_X+t<=this.translateLimitMaxX&&this.TRANSLATE_X+t>=this.translateLimitMinX&&(this.TRANSLATE_X+=t),this.TRANSLATE_Y+e<=this.translateLimitMaxY&&this.TRANSLATE_Y+e>=this.translateLimitMinY&&(this.TRANSLATE_Y+=e),this.emitGraphTransform("translate")},e.prototype.focusOn=function(t,e,n,r){var o=io(this.CanvasPointToHtmlPoint([t,e]),2),i=io([n/2-o[0],r/2-o[1]],2),a=i[0],s=i[1];this.TRANSLATE_X+=a,this.TRANSLATE_Y+=s,this.emitGraphTransform("focusOn")},e.prototype.updateTranslateLimits=function(t){var e;e=io(Array.isArray(t)&&4===t.length?t:Bb[t.toString()],4),this.translateLimitMinX=e[0],this.translateLimitMinY=e[1],this.translateLimitMaxX=e[2],this.translateLimitMaxY=e[3]},oo([$],e.prototype,"SCALE_X",void 0),oo([$],e.prototype,"SKEW_Y",void 0),oo([$],e.prototype,"SKEW_X",void 0),oo([$],e.prototype,"SCALE_Y",void 0),oo([$],e.prototype,"TRANSLATE_X",void 0),oo([$],e.prototype,"TRANSLATE_Y",void 0),oo([$],e.prototype,"ZOOM_SIZE",void 0),oo([te],e.prototype,"zoom",null),oo([te],e.prototype,"resetZoom",null),oo([te],e.prototype,"translate",null),oo([te],e.prototype,"focusOn",null),e}(),Hb=function(e){function n(n){var r=e.call(this)||this;r.stepScrollX=0,r.stepScrollY=0,r.onDragging=function(t){var e=t.deltaX,n=t.deltaY;r.setState({isDragging:!0});var o=r.props.graphModel,i=o.transformModel;!0!==o.editConfigModel.stopMoveGraph&&i.translate(e,n)},r.onDragEnd=function(){r.setState({isDragging:!1})},r.zoomHandler=function(t){var e=r.props,n=e.graphModel,o=n.editConfigModel,i=n.transformModel,a=n.gridSize,s=e.graphModel,u=t.deltaX,l=t.deltaY;if(o.stopScrollGraph||!0===t.ctrlKey){if(!o.stopZoomGraph){t.preventDefault();var c=s.getPointByClient({x:t.clientX,y:t.clientY}).canvasOverlayPosition,p=c.x,d=c.y;i.zoom(t.deltaY<0,[p,d])}}else{if(t.preventDefault(),r.stepScrollX+=u,r.stepScrollY+=l,Math.abs(r.stepScrollX)>=a){var f=r.stepScrollX%a,h=r.stepScrollX-f;i.translate(-h*i.SCALE_X,0),r.stepScrollX=f}if(Math.abs(r.stepScrollY)>=a){var y=r.stepScrollY%a,v=r.stepScrollY-y;i.translate(0,-v*i.SCALE_Y),r.stepScrollY=y}}},r.clickHandler=function(e){if("canvas-overlay"===e.target.getAttribute("name")){var n=r.props.graphModel;n.selectElements.size>0&&n.clearSelectElements(),n.eventCenter.emit(t.EventType.BLANK_CLICK,{e:e})}},r.handleContextMenu=function(e){if("canvas-overlay"===e.target.getAttribute("name")){e.preventDefault();var n=r.props.graphModel,o=n.getPointByClient({x:e.clientX,y:e.clientY});n.eventCenter.emit(t.EventType.BLANK_CONTEXTMENU,{e:e,position:o})}},r.mouseDownHandler=function(e){var n=r.props.graphModel,o=n.eventCenter,i=n.editConfigModel,a=n.transformModel.SCALE_X,s=n.gridSize,u=e.target,l=!i.adjustEdge&&!i.adjustNodePosition;("canvas-overlay"===u.getAttribute("name")||l)&&(!0!==i.stopMoveGraph?(r.stepDrag.setStep(s*a),r.stepDrag.handleMouseDown(e)):o.emit(t.EventType.BLANK_MOUSEDOWN,{e:e}),r.clickHandler(e))};var o=n.graphModel,i=o.gridSize,a=o.eventCenter;return r.stepDrag=new f_({onDragging:r.onDragging,onDragEnd:r.onDragEnd,step:i,eventType:"BLANK",isStopPropagation:!1,eventCenter:a,model:void 0}),r.state={isDragging:!1},r}return eo(n,e),n.prototype.render=function(){var t=this.props.graphModel.transformModel.getTransformStyle().transform,e=this.props,n=e.children,r=e.dnd,o=this.state.isDragging;return uo("svg",no({xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",name:"canvas-overlay",onWheel:this.zoomHandler,onMouseDown:this.mouseDownHandler,onContextMenu:this.handleContextMenu,className:o?"lf-canvas-overlay lf-dragging":"lf-canvas-overlay lf-drag-able"},r.eventMap(),{children:uo("g",{transform:t,children:n})}))},n=oo([cx],n)}(Vn);function Ub(e){var n=e.x,r=void 0===n?0:n,o=e.y,i=void 0===o?0:o,a=e.value,s=e.fontSize,u=void 0===s?12:s,l=e.fill,c=void 0===l?"currentColor":l,p=e.overflowMode,d=void 0===p?"default":p,f=e.textWidth,h=void 0===f?void 0:f,y=e.model,v={x:r,y:i,fill:c,fontSize:u,textAnchor:"middle",dominantBaseline:"central"};if(Yd(Jd(e),(function(t){var e=io(t,2),n=e[0],r=e[1];"object"!=typeof r&&(v[n]=r)})),a){var g=String(a).split(/[\r\n]/g),_=g.length;if("default"!==d){var m=y.BaseType,b=y.modelType;if(m===t.ElementType.NODE&&b!==t.ModelType.TEXT_NODE||m===t.ElementType.EDGE&&h)return Xb(e)}if(_>1){var E=g.map((function(t,e){return uo("tspan",{className:"lf-text-tspan",x:r,y:i+(e-(_-1)/2)*(u+2),children:t})}));return uo("text",no({},v,{children:E}))}return uo("text",no({},v,{children:a}))}return null}function Xb(t){var e=t.x,n=t.y,r=t.value,o=t.model,i=t.textWidth,a=t.fontSize,s=void 0===a?12:a,u=t.lineHeight,l=t.fontFamily,c=void 0===l?"":l,p=t.wrapPadding,d=void 0===p?"0, 0":p,f=t.overflowMode,h=o.width,y=o.height,v=o.textHeight,g=i||h,_=String(r).split(/[\r\n]/g),m=_.length,b=jm({rows:_,style:{fontSize:"".concat(s,"px"),width:"".concat(g,"px"),fontFamily:c,lineHeight:u,padding:d},rowsLength:m,className:"lf-get-text-height"}),E=y>b?y:b;v&&(E=v);var x="ellipsis"===f;return x&&(E=s+2),uo("g",{children:uo("foreignObject",{width:g,height:E,x:e-g/2,y:n-E/2,style:{overflow:"visible",textAlign:"left"},children:uo("div",{className:"lf-node-text-auto-wrap",style:{minHeight:E,width:g,padding:d},children:uo("div",{className:x?"lf-node-text-ellipsis-content":"lf-node-text-auto-wrap-content",title:x?_.join(""):"",style:no({},t),children:_.map((function(t){return uo("div",{className:"lf-node-text--auto-wrap-inner",children:t})}))})})})})}function Gb(t){var e={x1:10,y1:10,x2:20,y2:20,stroke:"black"};return Yd(Jd(t),(function(t){var n=io(t,2),r=n[0],o=n[1];("style"===r||"object"!=typeof o)&&(e[r]=o)})),uo("line",no({},e))}function Wb(t){var e=t.x,n=t.y,r=t.width,o=t.height,i=t.className,a=t.strokeWidth,s=t.radius,u=void 0===s?0:s,l=e-r/2,c=n-o/2,p={};return p["stroke-width"]=a,Yd(Jd(t),(function(t){var e=io(t,2),n=e[0],r=e[1];"object"!=typeof r&&(p[n]=r)})),p.className=i?"lf-basic-shape ".concat(i):"lf-basic-shape",u&&(p.rx=u,p.ry=u),p.x=l,p.y=c,uo("rect",no({},p))}function Yb(t){var e={d:""};return Yd(Jd(t),(function(t){var n=io(t,2),r=n[0],o=n[1];"style"!==r&&"object"==typeof o||(e[r]=o)})),uo("path",no({},e))}function Vb(t){var e=t.x,n=void 0===e?0:e,r=t.y,o=void 0===r?0:r,i=t.r,a=void 0===i?4:i,s=t.className,u={cx:n,cy:o,r:a,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return Yd(Jd(t),(function(t){var e=io(t,2),n=e[0],r=e[1];"object"!=typeof r&&(u[n]=r)})),u.className=s?"lf-basic-shape ".concat(s):"lf-basic-shape",uo("circle",no({},u))}function Fb(t){var e=t.x,n=void 0===e?0:e,r=t.y,o=void 0===r?0:r,i=t.rx,a=void 0===i?4:i,s=t.ry,u=void 0===s?4:s,l=t.className,c={cx:n,cy:o,rx:a,ry:u,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return Yd(Jd(t),(function(t){var e=io(t,2),n=e[0],r=e[1];"object"!=typeof r&&(c[n]=r)})),c.className=l?"lf-basic-shape ".concat(l):"lf-basic-shape",uo("ellipse",no({},c))}function Kb(t){var e=t.points,n=void 0===e?[]:e,r=t.className,o={fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1,points:""};return Yd(Jd(t),(function(t){var e=io(t,2),n=e[0],r=e[1];"object"!=typeof r&&(o[n]=r)})),r?o.classNmae="lf-basic-shape ".concat(r):o.className="lf-basic-shape",o.points=n.map((function(t){return t.join(",")})).join(" "),uo("polygon",no({},o))}function qb(t){var e=t.className,n={points:"",fill:"none"};return Yd(Jd(t),(function(t){var e=io(t,2),r=e[0],o=e[1];("style"===r||"object"!=typeof o)&&(n[r]=o)})),e&&(n.className="".concat(e)),uo("polyline",no({},n))}var Zb=function(e){function n(){var n=e.call(this)||this;return n.onDragging=function(e){var r=e.event,o=n.props,i=o.graphModel,a=o.bezierModel,s=o.type,u=i.getPointByClient({x:r.clientX,y:r.clientY}).canvasOverlayPosition,l=u.x,c=u.y;a.updateAdjustAnchor({x:l,y:c},s),i.eventCenter.emit(t.EventType.EDGE_ADJUST,{data:a.getData()})},n.onDragEnd=function(){n.props.bezierModel.isDragging=!1},n.dragHandler=new f_({onDragging:n.onDragging,onDragEnd:n.onDragEnd}),n}return eo(n,e),n.prototype.render=function(){var t=this,e=this.props.position,n=e.x,r=e.y,o=this.props.bezierModel.getEdgeStyle().adjustAnchor;return uo(Vb,no({className:"lf-bezier-adjust-anchor",x:n,y:r},o,{onMouseDown:function(e){t.dragHandler.handleMouseDown(e)}}))},n}(Vn),$b=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return eo(n,e),n.prototype.getBezierAdjust=function(t,e){var n=t.path,r=t.id,o=io(J_(n),4),i=o[0],a=o[1],s=o[2],u=o[3],l=t.getEdgeStyle().adjustLine,c=[];return c.push(uo(Gb,no({x1:i.x,y1:i.y,x2:a.x,y2:a.y},l))),c.push(uo(Zb,{position:a,bezierModel:t,graphModel:e,type:"sNext"},"".concat(r,"_ePre"))),c.push(uo(Gb,no({x1:u.x,y1:u.y,x2:s.x,y2:s.y},l))),c.push(uo(Zb,{position:s,bezierModel:t,graphModel:e,type:"ePre"},"".concat(r,"_sNext"))),c},n.prototype.selectedBezierEdge=function(){for(var e=this.props.graphModel,n=e.edges,r=[],o=0;o<n.length;o++){var i=n[o];i.isSelected&&i.modelType===t.ModelType.BEZIER_EDGE&&i.draggable&&r.push(this.getBezierAdjust(i,e))}return r},n.prototype.render=function(){return uo("g",{className:"lf-bezier-adjust",children:this.selectedBezierEdge()})},n=oo([cx],n)}(Vn),Jb=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eo(e,t),e.prototype.render=function(){return uo("div",{className:"lf-background",children:uo("div",{style:this.props.background,className:"lf-background-area"})})},e}(Vn),Qb=function(t){function e(){var e=t.apply(this,ao([],io(arguments),!1))||this;return e.id=nb(),e}return eo(e,t),e.prototype.renderDot=function(){var t=this.props,e=t.config,n=t.size,r=void 0===n?1:n,o=t.visible,i=null!=e?e:{},a=i.color,s=i.thickness,u=void 0===s?2:s,l=Math.min(Math.max(2,u),r/4);return uo("g",{fill:a,opacity:o?1:0,children:[uo("circle",{cx:0,cy:0,r:l/2}),uo("circle",{cx:0,cy:r,r:l/2}),uo("circle",{cx:r,cy:0,r:l/2}),uo("circle",{cx:r,cy:r,r:l/2})]})},e.prototype.renderMesh=function(){var t=this.props,e=t.config,n=t.size,r=void 0===n?1:n,o=t.visible,i=null!=e?e:{},a=i.color,s=i.thickness,u=void 0===s?1:s,l=Math.min(Math.max(1,u),r/2);return uo("path",{d:"M 0 0 H ".concat(r," V ").concat(r," H 0 Z"),stroke:a,strokeWidth:l,opacity:o?1:0,fill:"transparent"})},e.prototype.render=function(){var t=this.props,e=t.type,n=t.size,r=void 0===n?1:n,o=t.graphModel.transformModel,i=[o.SCALE_X,o.SKEW_Y,o.SKEW_X,o.SCALE_Y,o.TRANSLATE_X,o.TRANSLATE_Y].join(","),a="matrix(".concat(i,")");return uo("div",{className:"lf-grid",children:uo("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",children:[uo("defs",{children:uo("pattern",{id:this.id,patternUnits:"userSpaceOnUse",patternTransform:a,x:"0",y:"0",width:r,height:r,children:["dot"===e&&this.renderDot(),"mesh"===e&&this.renderMesh()]})}),uo("rect",{width:"100%",height:"100%",fill:"url(#".concat(this.id,")")})]})})},e=oo([cx],e)}(Vn);!function(t){t.defaultProps={size:10,visible:!0,type:"dot",config:{color:"#ababab",thickness:1}},t.getGridOptions=function(e){var n=up(t.defaultProps);return js(n,"number"==typeof e?{size:e}:"boolean"==typeof e?{visible:e}:e)}}(Qb||(Qb={}));var tE=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eo(e,t),e.prototype.render=function(){return uo("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",className:"modification-overlay",children:uo("g",{transform:this.props.graphModel.transformModel.getTransformStyle().transform,children:this.props.children})})},e=oo([cx],e)}(Vn),eE=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return eo(n,e),n.prototype.getNodesOutline=function(){var t=this.props.graphModel,e=t.nodes,n=t.editConfigModel,r=n.hoverOutline,o=n.nodeSelectedOutline,i=[];return e.forEach((function(t){if(t.isHovered||t.isSelected){var e=t.isHovered,n=t.isSelected,a=t.x,s=t.y,u=t.width,l=t.height;if(o&&n||r&&e){var c=t.getOutlineStyle(),p={};if(Object.keys(c).forEach((function(t){"hover"!==t&&(p[t]=c[t])})),e){var d=c.hover;p=no(no({},p),d)}i.push(uo(Wb,no({transform:t.transform,className:"lf-outline-node",x:a,y:s,width:u+10,height:l+10},p)))}}})),i},n.prototype.getEdgeOutline=function(){for(var e=this.props.graphModel,n=e.edges,r=e.editConfigModel,o=r.edgeSelectedOutline,i=r.hoverOutline,a=[],s=0;s<n.length;s++){var u=n[s];(o&&u.isSelected||i&&u.isHovered)&&(u.modelType===t.ModelType.LINE_EDGE?a.push(this.getLineOutline(u)):u.modelType===t.ModelType.POLYLINE_EDGE?a.push(this.getPolylineOutline(u)):u.modelType===t.ModelType.BEZIER_EDGE&&a.push(this.getBezierOutline(u)))}return a},n.prototype.getLineOutline=function(t){var e=t.startPoint,n=t.endPoint,r=(e.x+n.x)/2,o=(e.y+n.y)/2,i=Math.abs(e.x-n.x)+10,a=Math.abs(e.y-n.y)+10,s=t.getOutlineStyle();return uo(Wb,no({className:"lf-outline-edge",x:r,y:o,width:i,height:a},s))},n.prototype.getPolylineOutline=function(t){var e=t.points,n=Y_(e),r=x_(n,8),o=r.x,i=r.y,a=r.width,s=r.height,u=t.getOutlineStyle();return uo(Wb,no({className:"lf-outline",x:o,y:i,width:a,height:s},u))},n.prototype.getBezierOutline=function(t){var e=t.path,n=J_(e),r=x_(n,8),o=r.x,i=r.y,a=r.width,s=r.height,u=t.getOutlineStyle();return uo(Wb,no({className:"lf-outline",x:o,y:i,width:a,height:s},u))},n.prototype.render=function(){return uo("g",{className:"lf-outline",children:[this.getNodesOutline(),this.getEdgeOutline()]})},n=oo([cx],n)}(Vn),nE=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eo(e,t),e.prototype.render=function(){var t=this.props.snaplineModel,e=null!=t?t:{},n=e.position,r=e.isShowHorizontal,o=e.isShowVertical,i=null==t?void 0:t.getStyle(),a=null!=n?n:{},s=a.x,u=void 0===s?0:s,l=a.y,c=void 0===l?0:l,p=no(no({x1:-1e5,y1:c,x2:1e5,y2:c},i),{stroke:r?null==i?void 0:i.stroke:"none"}),d=no(no({x1:u,y1:-1e5,x2:u,y2:1e5},i),{stroke:o?null==i?void 0:i.stroke:"none"});return uo("g",{className:"lf-snapline",children:[uo(Gb,no({},p)),uo(Gb,no({},d))]})},e=oo([cx],e)}(Vn),rE=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eo(e,t),e.prototype.componentDidMount=function(){this.triggerToolRender()},e.prototype.componentDidUpdate=function(){this.triggerToolRender()},e.prototype.getTools=function(){var t=this.props,e=t.tool,n=t.graphModel,r=n.textEditElement,o=e.getTools().map((function(t){return Xn(t,{textEditElement:r,graphModel:n,logicFlow:e.instance})}));return e.components=o,o},e.prototype.triggerToolRender=function(){var t=this.props,e=t.tool,n=t.graphModel,r=document.querySelector("#ToolOverlay_".concat(n.flowId)),o=e.getInstance();o.components.forEach((function(t){return t(o,r)})),o.components=[]},e.prototype.render=function(){var t=this.props.graphModel;return uo("div",{className:"lf-tool-overlay",id:"ToolOverlay_".concat(t.flowId),children:this.getTools()})},e=oo([cx],e)}(Vn),oE=function(t){function e(){var e=t.apply(this,ao([],io(arguments),!1))||this;return e.handleResize=function(){e.props.graphModel.resize()},e}return eo(e,t),e.prototype.componentDidMount=function(){window.addEventListener("resize",Kv(this.handleResize,200))},e.prototype.componentWillUnmount=function(){window.removeEventListener("resize",Kv(this.handleResize,200))},e.prototype.getComponent=function(t,e,n){void 0===n&&(n="canvas-overlay");var r=(0,this.props.getView)(t.type);return r?uo(r,{model:t,graphModel:e,overlay:n},t.id):null},e.prototype.render=function(){var t=this,e=this.props,n=e.graphModel,r=e.tool,o=e.options,i=e.dnd,a=e.snaplineModel;o.width&&"".concat(n.width,"px"),o.height&&"".concat(n.height,"px");var s=o.grid&&Qb.getGridOptions(o.grid),u=n.fakeNode,l=n.editConfigModel.adjustEdge;return uo("div",{className:"lf-graph","flow-id":n.flowId,children:[uo(Hb,{graphModel:n,dnd:i,children:[uo("g",{className:"lf-base",children:wf(n.sortElements,(function(e){return t.getComponent(e,n)}))}),u?this.getComponent(u,n):""]}),uo(tE,{graphModel:n,children:[uo(eE,{graphModel:n}),l?uo($b,{graphModel:n}):"",!1!==o.snapline?uo(nE,{snaplineModel:a}):""]}),uo(rE,{graphModel:n,tool:r}),o.background&&uo(Jb,{background:o.background}),s&&uo(Qb,no({},s,{graphModel:n}))]})},e=oo([cx],e)}(Vn),iE=function(e){function n(){var n=e.call(this)||this;return n.onDragStart=function(e){var r=e.event,o=n.props,i=o.anchorData,a=o.nodeModel,s=o.graphModel;s.selectNodeById(a.id),a.autoToFront&&s.toFront(a.id),s.eventCenter.emit(t.EventType.ANCHOR_DRAGSTART,{data:i,e:r,nodeModel:a}),n.setState({startX:i.x,startY:i.y,endX:i.x,endY:i.y})},n.onDragging=function(e){var r=e.event,o=n.props,i=o.graphModel,a=o.nodeModel,s=o.anchorData,u=i.transformModel,l=i.eventCenter,c=i.width,p=i.height,d=i.editConfigModel,f=d.autoExpand,h=d.stopMoveGraph,y=r.clientX,v=r.clientY,g=i.getPointByClient({x:y,y:v}),_=g.domOverlayPosition,m=_.x,b=_.y,E=g.canvasOverlayPosition,x=E.x,w=E.y;n.t&&ib(n.t);var S=[];m<10?S=[10,0]:m+10>c?S=[-10,0]:b<10?S=[0,10]:b+10>p&&(S=[0,-10]),n.setState({endX:x,endY:w,dragging:!0}),n.moveAnchorEnd(x,w),S.length>0&&!h&&f&&(n.t=ob((function(){var t=io(S,2),e=t[0],r=t[1];u.translate(e,r);var o=n.state,i=o.endX,a=o.endY;n.setState({endX:i-e,endY:a-r}),n.moveAnchorEnd(i-e,a-r)}))),l.emit(t.EventType.ANCHOR_DRAG,{data:s,e:r,nodeModel:a})},n.onDragEnd=function(e){var r=e.event;n.t&&ib(n.t);var o=n.checkEnd(r);n.setState({startX:0,startY:0,endX:0,endY:0,dragging:!1}),n.sourceRuleResults.clear(),n.targetRuleResults.clear();var i=n.props,a=i.graphModel,s=i.nodeModel,u=i.anchorData;o&&a.eventCenter.emit(t.EventType.ANCHOR_DRAGEND,{data:u,e:r,nodeModel:s,edgeModel:o})},n.checkEnd=function(e){var r,o=n.props,i=o.graphModel,a=o.nodeModel,s=o.anchorData,u=s.x,l=s.y,c=s.id,p=n.state,d=p.endX,f=p.endY,h=p.dragging,y=mm({x:d,y:f},i);if(n.preTargetNode&&n.preTargetNode.state!==t.ElementState.DEFAULT&&n.preTargetNode.setElementState(t.ElementState.DEFAULT),h&&y&&y.node){var v=y.node,g=y.anchor.id,_="".concat(a.id,"_").concat(v.id,"_").concat(g,"_").concat(c),m=n.sourceRuleResults.get(_)||{},b=m.isAllPass,E=m.msg,x=n.targetRuleResults.get(_)||{},w=x.isAllPass,S=x.msg;if(b&&w){v.setElementState(t.ElementState.DEFAULT);var M=i.getNodeModelById(y.node.id),A=null===(r=i.edgeGenerator)||void 0===r?void 0:r.call(i,a.getData(),null==M?void 0:M.getData()),T=i.addEdge(no(no({},A),{sourceNodeId:a.id,sourceAnchorId:c,startPoint:{x:u,y:l},targetNodeId:y.node.id,targetAnchorId:y.anchor.id,endPoint:{x:y.anchor.x,y:y.anchor.y}})),O=n.props.anchorData;return i.eventCenter.emit(t.EventType.ANCHOR_DROP,{data:O,e:e,nodeModel:a,edgeModel:T}),T}var N=v.getData();return i.eventCenter.emit(t.EventType.CONNECTION_NOT_ALLOWED,{data:N,msg:S||E||"不允许添加连线"}),null}},n.sourceRuleResults=new Map,n.targetRuleResults=new Map,n.state={startX:0,startY:0,endX:0,endY:0,dragging:!1},n.dragHandler=new f_({onDragStart:n.onDragStart,onDragging:n.onDragging,onDragEnd:n.onDragEnd}),n}return eo(n,e),n.prototype.getAnchorShape=function(){var t=this.props,e=t.anchorData,n=t.style,r=t.node.getAnchorShape(e);if(r)return r;var o=e.x,i=e.y,a=no(no({},n),null==n?void 0:n.hover);return uo("g",{children:[uo(Vb,no({className:"lf-node-anchor-hover"},a,{x:o,y:i})),uo(Vb,no({className:"lf-node-anchor"},n,{x:o,y:i}))]})},Object.defineProperty(n.prototype,"customTrajectory",{get:function(){return this.props.graphModel.customTrajectory},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"relateEdges",{get:function(){var t=this.props,e=t.graphModel,n=e.getAnchorIncomingEdge,r=e.getAnchorOutcomingEdge,o=t.anchorData.id;return{incomingEdgeList:n(o),outcomingEdgeList:r(o)}},enumerable:!1,configurable:!0}),n.prototype.moveAnchorEnd=function(e,n){var r,o,i=this.props,a=i.graphModel,s=i.nodeModel,u=i.anchorData,l=mm({x:e,y:n},a);if(l){var c=l.node,p=l.anchor.id;if(this.preTargetNode&&this.preTargetNode!==l.node&&this.preTargetNode.setElementState(t.ElementState.DEFAULT),u.id===p)return;this.preTargetNode=c;var d="".concat(s.id,"_").concat(c.id,"_").concat(p,"_").concat(u.id);if(!this.targetRuleResults.has(d)){var f=l.anchor,h=s.isAllowConnectedAsSource(c,u,f),y=c.isAllowConnectedAsTarget(s,u,f);this.sourceRuleResults.set(d,Rm(h)),this.targetRuleResults.set(d,Rm(y))}var v=(null!==(r=this.sourceRuleResults.get(d))&&void 0!==r?r:{}).isAllPass,g=(null!==(o=this.targetRuleResults.get(d))&&void 0!==o?o:{}).isAllPass;v&&g?c.setElementState(t.ElementState.ALLOW_CONNECT):c.setElementState(t.ElementState.NOT_ALLOW_CONNECT)}else this.preTargetNode&&this.preTargetNode.state!==t.ElementState.DEFAULT&&this.preTargetNode.setElementState(t.ElementState.DEFAULT)},n.prototype.isShowLine=function(){var t=this.state,e=t.startX,n=t.startY,r=t.endX,o=t.endY;return xm(e,n,r,o)>10},n.prototype.render=function(){var t=this,e=this.state,n=e.startX,r=e.startY,o=e.endX,i=e.endY,a=this.props,s=a.anchorData.edgeAddable,u=a.edgeStyle;return uo("g",{className:"lf-anchor",children:[uo("g",{onMouseDown:function(e){!1!==s&&t.dragHandler.handleMouseDown(e)},children:this.getAnchorShape()}),this.isShowLine()&&(this.customTrajectory?this.customTrajectory(no({sourcePoint:{x:n,y:r},targetPoint:{x:o,y:i}},u)):uo(Gb,no({x1:n,y1:r,x2:o,y2:i},u,{"pointer-events":"none"})))]})},n}(Vn),aE=function(e){function n(n){var r=e.call(this,n)||this;return r.style={},r.onDragging=function(e){var n,o=e.event,i=r.props,a=i.graphModel,s=i.nodeModel,u=i.eventCenter,l=a.selectNodes,c=s.x,p=s.y,d=o.clientX,f=o.clientY,h=a.getPointByClient({x:d,y:f}).canvasOverlayPosition,y=h.x,v=h.y,g=new dm(y-c,v-p),_=(null===(n=r.normal)||void 0===n?void 0:n.angle(g))-r.defaultAngle,m=new gm(-c,-p).rotate(_).translate(c,p).toString();s.transform=m,s.rotate=_;var b=wf(l,(function(t){return t.id}));-1===b.indexOf(s.id)&&(b=[s.id]);var E=uv(b,(function(t,e){var n=a.getNodeModelById(e);return t[e]=null==n?void 0:n.getMoveDistance(0,0,!1),t}),{});b.forEach((function(t){a.getNodeEdges(t).forEach((function(t){if(E[t.sourceNodeId]){var e=a.getNodeModelById(t.sourceNodeId).anchors.find((function(e){return e.id===t.sourceAnchorId}));t.updateStartPoint(e)}if(E[t.targetNodeId]){e=a.getNodeModelById(t.targetNodeId).anchors.find((function(e){return e.id===t.targetAnchorId}));t.updateEndPoint(e)}}))})),u.emit(t.EventType.NODE_ROTATE,{e:o,nodeModel:s})},r.style=n.style,r.stepperDrag=new f_({onDragging:r.onDragging}),r}return eo(n,e),n.prototype.render=function(){var t=this,e=this.props.nodeModel,n=e.x,r=e.y,o=n+e.width/2+20,i=r-e.height/2-20;return this.normal=new dm(1,0),this.defaultAngle=this.normal.angle(new dm(o-n,i-r)),e.defaultAngle=this.defaultAngle,uo("g",{className:"lf-rotate-control",children:uo("g",{onMouseDown:function(e){t.stepperDrag.handleMouseDown(e)},children:uo(Vb,no({},this.style,{cx:o,cy:i}))})})},n}(Vn),sE={},uE={get exports(){return sE},set exports(t){sE=t}};
|
|
25
|
+
var Yg,Vg,Fg=4294967295,Kg=Array.prototype,qg=Object.prototype.hasOwnProperty,Zg=fo?fo.iterator:void 0,$g=Math.max,Jg=Math.min,Qg=function(t){return function(e,n,r){if(null==r){var o=Ho(n),i=o&&Cs(n),a=i&&i.length&&Of(n,i);(a?a.length:o)||(r=n,n=e,e=this)}return t(e,n,r)}}(Wh);Hi.after=Cg.after,Hi.ary=Cg.ary,Hi.assign=Bg.assign,Hi.assignIn=Bg.assignIn,Hi.assignInWith=Bg.assignInWith,Hi.assignWith=Bg.assignWith,Hi.at=Bg.at,Hi.before=Cg.before,Hi.bind=Cg.bind,Hi.bindAll=Ug.bindAll,Hi.bindKey=Cg.bindKey,Hi.castArray=Ig.castArray,Hi.chain=zg.chain,Hi.chunk=Ng.chunk,Hi.compact=Ng.compact,Hi.concat=Ng.concat,Hi.cond=Ug.cond,Hi.conforms=Ug.conforms,Hi.constant=Ug.constant,Hi.countBy=Dg.countBy,Hi.create=Bg.create,Hi.curry=Cg.curry,Hi.curryRight=Cg.curryRight,Hi.debounce=Cg.debounce,Hi.defaults=Bg.defaults,Hi.defaultsDeep=Bg.defaultsDeep,Hi.defer=Cg.defer,Hi.delay=Cg.delay,Hi.difference=Ng.difference,Hi.differenceBy=Ng.differenceBy,Hi.differenceWith=Ng.differenceWith,Hi.drop=Ng.drop,Hi.dropRight=Ng.dropRight,Hi.dropRightWhile=Ng.dropRightWhile,Hi.dropWhile=Ng.dropWhile,Hi.fill=Ng.fill,Hi.filter=Dg.filter,Hi.flatMap=Dg.flatMap,Hi.flatMapDeep=Dg.flatMapDeep,Hi.flatMapDepth=Dg.flatMapDepth,Hi.flatten=Ng.flatten,Hi.flattenDeep=Ng.flattenDeep,Hi.flattenDepth=Ng.flattenDepth,Hi.flip=Cg.flip,Hi.flow=Ug.flow,Hi.flowRight=Ug.flowRight,Hi.fromPairs=Ng.fromPairs,Hi.functions=Bg.functions,Hi.functionsIn=Bg.functionsIn,Hi.groupBy=Dg.groupBy,Hi.initial=Ng.initial,Hi.intersection=Ng.intersection,Hi.intersectionBy=Ng.intersectionBy,Hi.intersectionWith=Ng.intersectionWith,Hi.invert=Bg.invert,Hi.invertBy=Bg.invertBy,Hi.invokeMap=Dg.invokeMap,Hi.iteratee=Ug.iteratee,Hi.keyBy=Dg.keyBy,Hi.keys=Cs,Hi.keysIn=Bg.keysIn,Hi.map=Dg.map,Hi.mapKeys=Bg.mapKeys,Hi.mapValues=Bg.mapValues,Hi.matches=Ug.matches,Hi.matchesProperty=Ug.matchesProperty,Hi.memoize=Cg.memoize,Hi.merge=Bg.merge,Hi.mergeWith=Bg.mergeWith,Hi.method=Ug.method,Hi.methodOf=Ug.methodOf,Hi.mixin=Qg,Hi.negate=Fh,Hi.nthArg=Ug.nthArg,Hi.omit=Bg.omit,Hi.omitBy=Bg.omitBy,Hi.once=Cg.once,Hi.orderBy=Dg.orderBy,Hi.over=Ug.over,Hi.overArgs=Cg.overArgs,Hi.overEvery=Ug.overEvery,Hi.overSome=Ug.overSome,Hi.partial=Cg.partial,Hi.partialRight=Cg.partialRight,Hi.partition=Dg.partition,Hi.pick=Bg.pick,Hi.pickBy=Bg.pickBy,Hi.property=Ug.property,Hi.propertyOf=Ug.propertyOf,Hi.pull=Ng.pull,Hi.pullAll=Ng.pullAll,Hi.pullAllBy=Ng.pullAllBy,Hi.pullAllWith=Ng.pullAllWith,Hi.pullAt=Ng.pullAt,Hi.range=Ug.range,Hi.rangeRight=Ug.rangeRight,Hi.rearg=Cg.rearg,Hi.reject=Dg.reject,Hi.remove=Ng.remove,Hi.rest=Cg.rest,Hi.reverse=Ng.reverse,Hi.sampleSize=Dg.sampleSize,Hi.set=Bg.set,Hi.setWith=Bg.setWith,Hi.shuffle=Dg.shuffle,Hi.slice=Ng.slice,Hi.sortBy=Dg.sortBy,Hi.sortedUniq=Ng.sortedUniq,Hi.sortedUniqBy=Ng.sortedUniqBy,Hi.split=Hg.split,Hi.spread=Cg.spread,Hi.tail=Ng.tail,Hi.take=Ng.take,Hi.takeRight=Ng.takeRight,Hi.takeRightWhile=Ng.takeRightWhile,Hi.takeWhile=Ng.takeWhile,Hi.tap=zg.tap,Hi.throttle=Cg.throttle,Hi.thru=qv,Hi.toArray=Ig.toArray,Hi.toPairs=Bg.toPairs,Hi.toPairsIn=Bg.toPairsIn,Hi.toPath=Ug.toPath,Hi.toPlainObject=Ig.toPlainObject,Hi.transform=Bg.transform,Hi.unary=Cg.unary,Hi.union=Ng.union,Hi.unionBy=Ng.unionBy,Hi.unionWith=Ng.unionWith,Hi.uniq=Ng.uniq,Hi.uniqBy=Ng.uniqBy,Hi.uniqWith=Ng.uniqWith,Hi.unset=Bg.unset,Hi.unzip=Ng.unzip,Hi.unzipWith=Ng.unzipWith,Hi.update=Bg.update,Hi.updateWith=Bg.updateWith,Hi.values=Bg.values,Hi.valuesIn=Bg.valuesIn,Hi.without=Ng.without,Hi.words=Hg.words,Hi.wrap=Cg.wrap,Hi.xor=Ng.xor,Hi.xorBy=Ng.xorBy,Hi.xorWith=Ng.xorWith,Hi.zip=Ng.zip,Hi.zipObject=Ng.zipObject,Hi.zipObjectDeep=Ng.zipObjectDeep,Hi.zipWith=Ng.zipWith,Hi.entries=Bg.toPairs,Hi.entriesIn=Bg.toPairsIn,Hi.extend=Bg.assignIn,Hi.extendWith=Bg.assignInWith,Qg(Hi,Hi),Hi.add=jg.add,Hi.attempt=Ug.attempt,Hi.camelCase=Hg.camelCase,Hi.capitalize=Hg.capitalize,Hi.ceil=jg.ceil,Hi.clamp=kg,Hi.clone=Ig.clone,Hi.cloneDeep=Ig.cloneDeep,Hi.cloneDeepWith=Ig.cloneDeepWith,Hi.cloneWith=Ig.cloneWith,Hi.conformsTo=Ig.conformsTo,Hi.deburr=Hg.deburr,Hi.defaultTo=Ug.defaultTo,Hi.divide=jg.divide,Hi.endsWith=Hg.endsWith,Hi.eq=Ig.eq,Hi.escape=Hg.escape,Hi.escapeRegExp=Hg.escapeRegExp,Hi.every=Dg.every,Hi.find=Dg.find,Hi.findIndex=Ng.findIndex,Hi.findKey=Bg.findKey,Hi.findLast=Dg.findLast,Hi.findLastIndex=Ng.findLastIndex,Hi.findLastKey=Bg.findLastKey,Hi.floor=jg.floor,Hi.forEach=Dg.forEach,Hi.forEachRight=Dg.forEachRight,Hi.forIn=Bg.forIn,Hi.forInRight=Bg.forInRight,Hi.forOwn=Bg.forOwn,Hi.forOwnRight=Bg.forOwnRight,Hi.get=Bg.get,Hi.gt=Ig.gt,Hi.gte=Ig.gte,Hi.has=Bg.has,Hi.hasIn=Bg.hasIn,Hi.head=Ng.head,Hi.identity=$o,Hi.includes=Dg.includes,Hi.indexOf=Ng.indexOf,Hi.inRange=Rg,Hi.invoke=Bg.invoke,Hi.isArguments=Ig.isArguments,Hi.isArray=No,Hi.isArrayBuffer=Ig.isArrayBuffer,Hi.isArrayLike=Ig.isArrayLike,Hi.isArrayLikeObject=Ig.isArrayLikeObject,Hi.isBoolean=Ig.isBoolean,Hi.isBuffer=Ig.isBuffer,Hi.isDate=Ig.isDate,Hi.isElement=Ig.isElement,Hi.isEmpty=Ig.isEmpty,Hi.isEqual=Ig.isEqual,Hi.isEqualWith=Ig.isEqualWith,Hi.isError=Ig.isError,Hi.isFinite=Ig.isFinite,Hi.isFunction=Ig.isFunction,Hi.isInteger=Ig.isInteger,Hi.isLength=Ig.isLength,Hi.isMap=Ig.isMap,Hi.isMatch=Ig.isMatch,Hi.isMatchWith=Ig.isMatchWith,Hi.isNaN=Ig.isNaN,Hi.isNative=Ig.isNative,Hi.isNil=Ig.isNil,Hi.isNull=Ig.isNull,Hi.isNumber=Ig.isNumber,Hi.isObject=Ho,Hi.isObjectLike=Ig.isObjectLike,Hi.isPlainObject=Ig.isPlainObject,Hi.isRegExp=Ig.isRegExp,Hi.isSafeInteger=Ig.isSafeInteger,Hi.isSet=Ig.isSet,Hi.isString=Ig.isString,Hi.isSymbol=Ig.isSymbol,Hi.isTypedArray=Ig.isTypedArray,Hi.isUndefined=Ig.isUndefined,Hi.isWeakMap=Ig.isWeakMap,Hi.isWeakSet=Ig.isWeakSet,Hi.join=Ng.join,Hi.kebabCase=Hg.kebabCase,Hi.last=zd,Hi.lastIndexOf=Ng.lastIndexOf,Hi.lowerCase=Hg.lowerCase,Hi.lowerFirst=Hg.lowerFirst,Hi.lt=Ig.lt,Hi.lte=Ig.lte,Hi.max=jg.max,Hi.maxBy=jg.maxBy,Hi.mean=jg.mean,Hi.meanBy=jg.meanBy,Hi.min=jg.min,Hi.minBy=jg.minBy,Hi.stubArray=Ug.stubArray,Hi.stubFalse=Ug.stubFalse,Hi.stubObject=Ug.stubObject,Hi.stubString=Ug.stubString,Hi.stubTrue=Ug.stubTrue,Hi.multiply=jg.multiply,Hi.nth=Ng.nth,Hi.noop=Ug.noop,Hi.now=Pg,Hi.pad=Hg.pad,Hi.padEnd=Hg.padEnd,Hi.padStart=Hg.padStart,Hi.parseInt=Hg.parseInt,Hi.random=Lg,Hi.reduce=Dg.reduce,Hi.reduceRight=Dg.reduceRight,Hi.repeat=Hg.repeat,Hi.replace=Hg.replace,Hi.result=Bg.result,Hi.round=jg.round,Hi.sample=Dg.sample,Hi.size=Dg.size,Hi.snakeCase=Hg.snakeCase,Hi.some=Dg.some,Hi.sortedIndex=Ng.sortedIndex,Hi.sortedIndexBy=Ng.sortedIndexBy,Hi.sortedIndexOf=Ng.sortedIndexOf,Hi.sortedLastIndex=Ng.sortedLastIndex,Hi.sortedLastIndexBy=Ng.sortedLastIndexBy,Hi.sortedLastIndexOf=Ng.sortedLastIndexOf,Hi.startCase=Hg.startCase,Hi.startsWith=Hg.startsWith,Hi.subtract=jg.subtract,Hi.sum=jg.sum,Hi.sumBy=jg.sumBy,Hi.template=Hg.template,Hi.times=Ug.times,Hi.toFinite=Ig.toFinite,Hi.toInteger=Zo,Hi.toLength=Ig.toLength,Hi.toLower=Hg.toLower,Hi.toNumber=Ig.toNumber,Hi.toSafeInteger=Ig.toSafeInteger,Hi.toString=Ig.toString,Hi.toUpper=Hg.toUpper,Hi.trim=Hg.trim,Hi.trimEnd=Hg.trimEnd,Hi.trimStart=Hg.trimStart,Hi.truncate=Hg.truncate,Hi.unescape=Hg.unescape,Hi.uniqueId=Ug.uniqueId,Hi.upperCase=Hg.upperCase,Hi.upperFirst=Hg.upperFirst,Hi.each=Dg.forEach,Hi.eachRight=Dg.forEachRight,Hi.first=Ng.head,Qg(Hi,(Yg={},sd(Hi,(function(t,e){qg.call(Hi.prototype,e)||(Yg[e]=t)})),Yg),{chain:!1}),Hi.VERSION="4.17.21",(Hi.templateSettings=Hg.templateSettings).imports._=Hi,Ji(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Hi[t].placeholder=Hi})),Ji(["drop","take"],(function(t,e){Di.prototype[t]=function(n){n=void 0===n?1:$g(Zo(n),0);var r=this.__filtered__&&!e?new Di(this):this.clone();return r.__filtered__?r.__takeCount__=Jg(n,r.__takeCount__):r.__views__.push({size:Jg(n,Fg),type:t+(r.__dir__<0?"Right":"")}),r},Di.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Ji(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;Di.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:nd(t),type:n}),e.__filtered__=e.__filtered__||r,e}})),Ji(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Di.prototype[t]=function(){return this[n](1).value()[0]}})),Ji(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Di.prototype[t]=function(){return this.__filtered__?new Di(this):this[n](1)}})),Di.prototype.compact=function(){return this.filter($o)},Di.prototype.find=function(t){return this.filter(t).head()},Di.prototype.findLast=function(t){return this.reverse().find(t)},Di.prototype.invokeMap=Qa((function(t,e){return"function"==typeof t?new Di(this):this.map((function(n){return sh(n,t,e)}))})),Di.prototype.reject=function(t){return this.filter(Fh(nd(t)))},Di.prototype.slice=function(t,e){t=Zo(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Di(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=Zo(e))<0?n.dropRight(-e):n.take(e-t)),n)},Di.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Di.prototype.toArray=function(){return this.take(Fg)},sd(Di.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),o=Hi[r?"take"+("last"==e?"Right":""):e],i=r||/^find/.test(e);o&&(Hi.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,s=e instanceof Di,u=a[0],l=s||No(e),c=function(t){var e=o.apply(Hi,du([t],a));return r&&p?e[0]:e};l&&n&&"function"==typeof u&&1!=u.length&&(s=l=!1);var p=this.__chain__,d=!!this.__actions__.length,f=i&&!p,h=s&&!d;if(!i&&l){e=h?e:new Di(this);var y=t.apply(e,a);return y.__actions__.push({func:qv,args:[c],thisArg:void 0}),new Ri(y,p)}return f&&h?t.apply(this,a):(y=this.thru(c),f?r?y.value()[0]:y.value():y)})})),Ji(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Kg[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Hi.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var o=this.value();return e.apply(No(o)?o:[],t)}return this[n]((function(n){return e.apply(No(n)?n:[],t)}))}})),sd(Di.prototype,(function(t,e){var n=Hi[e];if(n){var r=n.name+"";qg.call(Ii,r)||(Ii[r]=[]),Ii[r].push({name:e,func:n})}})),Ii[Ma(void 0,2).name]=[{name:"wrapper",func:void 0}],Di.prototype.clone=function(){var t=new Di(this.__wrapped__);return t.__actions__=Li(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Li(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Li(this.__views__),t},Di.prototype.reverse=function(){if(this.__filtered__){var t=new Di(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Di.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=No(t),r=e<0,o=n?t.length:0,i=function(t,e,n){for(var r=-1,o=n.length;++r<o;){var i=n[r],a=i.size;switch(i.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=Gg(e,t+a);break;case"takeRight":t=Xg(t,e-a)}}return{start:t,end:e}}(0,o,this.__views__),a=i.start,s=i.end,u=s-a,l=r?s:a-1,c=this.__iteratees__,p=c.length,d=0,f=Wg(u,this.__takeCount__);if(!n||!r&&o==u&&f==u)return Jv(t,this.__actions__);var h=[];t:for(;u--&&d<f;){for(var y=-1,v=t[l+=e];++y<p;){var g=c[y],_=g.iteratee,m=g.type,b=_(v);if(2==m)v=b;else if(!b){if(1==m)continue t;break t}}h[d++]=v}return h},Hi.prototype.at=zg.at,Hi.prototype.chain=zg.wrapperChain,Hi.prototype.commit=zg.commit,Hi.prototype.next=zg.next,Hi.prototype.plant=zg.plant,Hi.prototype.reverse=zg.reverse,Hi.prototype.toJSON=Hi.prototype.valueOf=Hi.prototype.value=zg.value,Hi.prototype.first=Hi.prototype.head,Zg&&(Hi.prototype[Zg]=zg.toIterator),t.Options=void 0,(Vg=t.Options||(t.Options={})).get=function(t){var e=ro(t,[]);if(!t.container)throw new Error("Ensure the container of LogicFlow is specified and valid.");return js({},Vg.defaults,e)},function(t){t.defaults={background:!1,grid:!1,textEdit:!0,snapline:!0,outline:!1,disabledTools:[]}}(t.Options||(t.Options={}));var t_={node:!1,edge:!1},e_={node:!0,edge:!0},n_=function(t){return t&&"boolean"!=typeof t?Uh(up(t_),t):up(!0===t?e_:t_)},r_=n_,o_=null!==cu(window,"navigator.userAgent","").match(/MSIE|Trident/);function i_(t){try{return JSON.parse(JSON.stringify(t))}catch(e){return t}}var a_,s_,u_,l_,c_,p_,d_=200;t.ElementState=void 0,(a_=t.ElementState||(t.ElementState={}))[a_.DEFAULT=1]="DEFAULT",a_[a_.TEXT_EDIT=2]="TEXT_EDIT",a_[a_.SHOW_MENU=3]="SHOW_MENU",a_[a_.ALLOW_CONNECT=4]="ALLOW_CONNECT",a_[a_.NOT_ALLOW_CONNECT=5]="NOT_ALLOW_CONNECT",t.ElementType=void 0,(s_=t.ElementType||(t.ElementType={})).NODE="node",s_.EDGE="edge",s_.GRAPH="graph",t.ModelType=void 0,(u_=t.ModelType||(t.ModelType={})).NODE="node",u_.CIRCLE_NODE="circle-node",u_.POLYGON_NODE="polygon-node",u_.RECT_NODE="rect-node",u_.TEXT_NODE="text-node",u_.ELLIPSE_NODE="ellipse-node",u_.DIAMOND_NODE="diamond-node",u_.HTML_NODE="html-node",u_.CUSTOM_HTML_NODE="custom-html-node",u_.EDGE="edge",u_.LINE_EDGE="line-edge",u_.POLYLINE_EDGE="polyline-edge",u_.BEZIER_EDGE="bezier-edge",u_.GRAPH="graph",t.EventType=void 0,(l_=t.EventType||(t.EventType={})).ELEMENT_CLICK="element:click",l_.NODE_ADD="node:add",l_.NODE_DELETE="node:delete",l_.NODE_CLICK="node:click",l_.NODE_DBCLICK="node:dbclick",l_.NODE_GROUP_COPY="node:group-copy-add",l_.NODE_DND_ADD="node:dnd-add",l_.NODE_DND_DRAG="node:dnd-drag",l_.NODE_MOUSEDOWN="node:mousedown",l_.NODE_DRAGSTART="node:dragstart",l_.NODE_DRAG="node:drag",l_.NODE_DROP="node:drop",l_.NODE_MOUSEUP="node:mouseup",l_.NODE_MOUSEMOVE="node:mousemove",l_.NODE_MOUSEENTER="node:mouseenter",l_.NODE_MOUSELEAVE="node:mouseleave",l_.NODE_CONTEXTMENU="node:contextmenu",l_.NODE_ROTATE="node:rotate",l_.NODE_RESIZE="node:resize",l_.NODE_PROPERTIES_CHANGE="node:properties-change",l_.NODE_PROPERTIES_DELETE="node:properties-delete",l_.EDGE_ADD="edge:add",l_.EDGE_DELETE="edge:delete",l_.EDGE_CLICK="edge:click",l_.EDGE_DBCLICK="edge:dbclick",l_.EDGE_MOUSEENTER="edge:mouseenter",l_.EDGE_MOUSELEAVE="edge:mouseleave",l_.EDGE_CONTEXTMENU="edge:contextmenu",l_.EDGE_ADJUST="edge:adjust",l_.EDGE_EXCHANGE_NODE="edge:exchange-node",l_.ANCHOR_DRAGSTART="anchor:dragstart",l_.ANCHOR_DRAG="anchor:drag",l_.ANCHOR_DROP="anchor:drop",l_.ANCHOR_DRAGEND="anchor:dragend",l_.ADJUST_POINT_MOUSEDOWN="adjustPoint:mousedown",l_.ADJUST_POINT_MOUSEUP="adjustPoint:mouseup",l_.ADJUST_POINT_MOUSEMOVE="adjustPoint:mousemove",l_.ADJUST_POINT_DRAGSTART="adjustPoint:dragstart",l_.ADJUST_POINT_DRAG="adjustPoint:drag",l_.ADJUST_POINT_DROP="adjustPoint:drop",l_.ADJUST_POINT_DRAGEND="adjustPoint:dragend",l_.BLANK_MOUSEDOWN="blank:mousedown",l_.BLANK_DRAGSTART="blank:dragstart",l_.BLANK_DRAG="blank:drag",l_.BLANK_DROP="blank:drop",l_.BLANK_MOUSEMOVE="blank:mousemove",l_.BLANK_MOUSEUP="blank:mouseup",l_.BLANK_CLICK="blank:click",l_.BLANK_CONTEXTMENU="blank:contextmenu",l_.SELECTION_MOUSEDOWN="selection:mousedown",l_.SELECTION_DRAGSTART="selection:dragstart",l_.SELECTION_DRAG="selection:drag",l_.SELECTION_DROP="selection:drop",l_.SELECTION_MOUSEMOVE="selection:mousemove",l_.SELECTION_MOUSEUP="selection:mouseup",l_.SELECTION_CONTEXTMENU="selection:contextmenu",l_.CONNECTION_NOT_ALLOWED="connection:not-allowed",l_.HISTORY_CHANGE="history:change",l_.TEXT_UPDATE="text:update",l_.GRAPH_TRANSFORM="graph:transform",l_.GRAPH_RENDERED="graph:rendered",l_.GRAPH_UPDATED="graph:updated",function(t){t[t.DEFAULT=0]="DEFAULT",t[t.INCREASE=1]="INCREASE"}(c_||(c_={})),function(t){t.HORIZONTAL="horizontal",t.VERTICAL="vertical"}(p_||(p_={}));var f_=function(){function e(e){var n=e.onDragStart,r=void 0===n?Pi:n,o=e.onDragging,i=void 0===o?Pi:o,a=e.onDragEnd,s=void 0===a?Pi:a,u=e.eventType,l=void 0===u?"":u,c=e.eventCenter,p=e.step,d=void 0===p?1:p,f=e.isStopPropagation,h=void 0===f||f,y=e.model,v=e.data,g=this;this.isDragging=!1,this.isStartDragging=!1,this.startX=0,this.startY=0,this.sumDeltaX=0,this.sumDeltaY=0,this.handleMouseDown=function(e){var n,r,o=null===window||void 0===window?void 0:window.document;if(0===e.button){g.isStopPropagation&&e.stopPropagation(),g.isStartDragging=!0,g.startX=e.clientX,g.startY=e.clientY,o.addEventListener("mousemove",g.handleMouseMove,!1),o.addEventListener("mouseup",g.handleMouseUp,!1);var i=null===(n=g.model)||void 0===n?void 0:n.getData();null===(r=g.eventCenter)||void 0===r||r.emit(t.EventType["".concat(g.eventType,"_MOUSEDOWN")],{e:e,data:g.data||i}),g.startTime=(new Date).getTime()}},this.handleMouseMove=function(e){var n,r;if(g.isStopPropagation&&e.stopPropagation(),g.isStartDragging&&(g.sumDeltaX+=e.clientX-g.startX,g.sumDeltaY+=e.clientY-g.startY,g.startX=e.clientX,g.startY=e.clientY,g.step<=1||Math.abs(g.sumDeltaX)>g.step||Math.abs(g.sumDeltaY)>g.step)){var o=g.sumDeltaX%g.step,i=g.sumDeltaY%g.step,a=g.sumDeltaX-o,s=g.sumDeltaY-i;g.sumDeltaX=o,g.sumDeltaY=i;var u=null===(n=g.model)||void 0===n?void 0:n.getData();g.isDragging||(null===(r=g.eventCenter)||void 0===r||r.emit(t.EventType["".concat(g.eventType,"_DRAGSTART")],{e:e,data:g.data||u}),g.onDragStart({event:e})),g.isDragging=!0,Promise.resolve().then((function(){var n,r;g.onDragging({deltaX:a,deltaY:s,event:e}),null===(n=g.eventCenter)||void 0===n||n.emit(t.EventType["".concat(g.eventType,"_MOUSEMOVE")],{e:e,data:g.data||u}),null===(r=g.eventCenter)||void 0===r||r.emit(t.EventType["".concat(g.eventType,"_DRAG")],{e:e,data:g.data||u})}))}},this.handleMouseUp=function(e){var n=window.document;g.isStartDragging=!1,g.isStopPropagation&&e.stopPropagation(),Promise.resolve().then((function(){var r,o,i;n.removeEventListener("mousemove",g.handleMouseMove,!1),n.removeEventListener("mouseup",g.handleMouseUp,!1);var a=null===(r=g.model)||void 0===r?void 0:r.getData();null===(o=g.eventCenter)||void 0===o||o.emit(t.EventType["".concat(g.eventType,"_MOUSEUP")],{e:e,data:g.data||a}),g.isDragging&&(g.isDragging=!1,g.onDragEnd({event:e}),null===(i=g.eventCenter)||void 0===i||i.emit(t.EventType["".concat(g.eventType,"_DROP")],{e:e,data:g.data||a}))}))},this.cancelDrag=function(){var t=null===window||void 0===window?void 0:window.document;t.removeEventListener("mousemove",g.handleMouseMove,!1),t.removeEventListener("mouseup",g.handleMouseUp,!1),g.onDragEnd({event:null}),g.isDragging=!1},this.onDragStart=r,this.onDragging=i,this.onDragEnd=s,this.step=d,this.isStopPropagation=h,this.eventType=l,this.eventCenter=c,this.model=y,this.data=v}return e.prototype.setStep=function(t){this.step=t},e.prototype.setModel=function(t){this.model=t},e}(),h_=function(t){var e=t.start,n=t.end,r=t.offset,o=t.verticalLength,i=t.type,a={leftX:0,leftY:0,rightX:0,rightY:0},s=Math.atan((n.y-e.y)/(n.x-e.x)),u=Math.atan(r/o),l=Math.sqrt(o*o+r*r);return"start"===i?n.x>=e.x?(a.leftX=e.x+l*Math.sin(s+u),a.leftY=e.y-l*Math.cos(s+u),a.rightX=e.x-l*Math.sin(s-u),a.rightY=e.y+l*Math.cos(s-u)):(a.leftX=e.x-l*Math.sin(s+u),a.leftY=e.y+l*Math.cos(s+u),a.rightX=e.x+l*Math.sin(s-u),a.rightY=e.y-l*Math.cos(s-u)):"end"===i&&(n.x>=e.x?(a.leftX=n.x+l*Math.sin(s-u),a.leftY=n.y-l*Math.cos(s-u),a.rightX=n.x-l*Math.sin(s+u),a.rightY=n.y+l*Math.cos(s+u)):(a.leftX=n.x-l*Math.sin(s-u),a.leftY=n.y+l*Math.cos(s-u),a.rightX=n.x+l*Math.sin(s+u),a.rightY=n.y-l*Math.cos(s+u))),a},y_=function(t,e,n){var r=t.x,o=t.y,i=e.x,a=e.y,s=n.x,u=n.y,l=(u-a)/(s-i),c=a-l*i;return r>=i&&r<=s&&o>=a&&o<=u&&Math.abs(o-l*r+c)<Number.EPSILON},v_=function(t,e){return 2*Math.abs(t.centerX-e.centerX)<t.width+e.width&&2*Math.abs(t.centerY-e.centerY)<t.height+e.height},g_=function(t){var e=[],n={};return t.forEach((function(t){var e="".concat(t.x,"-").concat(t.y);t.id=e,n[e]=t})),Object.keys(n).forEach((function(t){e.push(n[t])})),e},__=function(t,e){return 0===t.width&&0===t.height?t:{x:t.x,y:t.y,centerX:t.centerX,centerY:t.centerY,minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e,height:t.height+2*e,width:t.width+2*e}},m_=function(t,e){var n=Math.abs(t.x-e.centerX),r=Math.abs(t.y-e.centerY);return n/e.width>r/e.height?p_.HORIZONTAL:p_.VERTICAL},b_=function(t,e,n){return m_(n,e)===p_.HORIZONTAL?{x:n.x>t.centerX?t.maxX:t.minX,y:n.y}:{x:n.x,y:n.y>t.centerY?t.maxY:t.minY}},E_=function(t,e){var n=Math.min(t.minX,e.minX),r=Math.min(t.minY,e.minY),o=Math.max(t.maxX,e.maxX),i=Math.max(t.maxY,e.maxY);return{x:(n+o)/2,y:(r+i)/2,centerX:(n+o)/2,centerY:(r+i)/2,minX:n,minY:r,maxX:o,maxY:i,height:i-r,width:o-n}},x_=function(t,e){void 0===t&&(t=[]);var n=[],r=[];t.forEach((function(t){n.push(t.x),r.push(t.y)}));var o=Math.min.apply(Math,ao([],io(n),!1)),i=Math.max.apply(Math,ao([],io(n),!1)),a=Math.min.apply(Math,ao([],io(r),!1)),s=Math.max.apply(Math,ao([],io(r),!1)),u=i-o,l=s-a;return e&&(u+=e,l+=e),{centerX:(o+i)/2,centerY:(a+s)/2,maxX:i,maxY:s,minX:o,minY:a,x:(o+i)/2,y:(a+s)/2,height:l,width:u}},w_=function(t){var e=t.minX,n=t.minY,r=t.maxX,o=t.maxY;return[{x:e,y:n},{x:r,y:n},{x:r,y:o},{x:e,y:o}]},S_=function(t,e){var n=t.x,r=t.y;return n<e.minX||n>e.maxX||r<e.minY||r>e.maxY},M_=function(t,e){return e<t.minX||e>t.maxX?[]:[{x:e,y:t.minY},{x:e,y:t.maxY}]},A_=function(t,e){return e<t.minY||e>t.maxY?[]:[{x:t.minX,y:e},{x:t.maxX,y:e}]},T_=function(t,e){return ao(ao([],io(M_(t,e.x)),!1),io(A_(t,e.y)),!1)},O_=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},N_=function(t,e){var n=0;return e.forEach((function(e){e&&(t.x===e.x&&(n+=-2),t.y===e.y&&(n+=-2))})),n},D_=function(t,e,n,r,o){return O_(t,e)+O_(t,n)+N_(t,[e,n,r,o])},P_=function(t,e,n,r,o){o||(o=0),t.unshift(e[r]),n[r]&&n[r]!==r&&o<=100&&P_(t,e,n,n[r],o+1)},C_=function(t,e){var n=t.indexOf(e);n>-1&&t.splice(n,1)},I_=function(t,e,n,r){var o=e.x-t.x,i=e.y-t.y,a=r.x-n.x,s=r.y-n.y,u=(-i*(t.x-n.x)+o*(t.y-n.y))/(-a*i+o*s),l=(a*(t.y-n.y)-s*(t.x-n.x))/(-a*i+o*s);return u>=0&&u<=1&&l>=0&&l<=1},j_=function(t,e,n){if(0===n.width&&0===n.height)return!1;var r=io(w_(n),4),o=r[0],i=r[1],a=r[2],s=r[3];return I_(t,e,o,i)||I_(t,e,o,s)||I_(t,e,i,a)||I_(t,e,a,s)},k_=function(t,e,n,r){var o=[];return t.forEach((function(t){t!==e&&(t.x!==e.x&&t.y!==e.y||j_(t,e,n)||j_(t,e,r)||o.push(t))})),g_(o)},R_=function(t,e,n,r,o,i,a){var s=[],u=[e],l={},c={},p={};e.id&&(c[e.id]=0,p[e.id]=D_(e,n,e));var d={};t.forEach((function(t){t.id&&(d[t.id]=t)}));for(var f=function(){var f,h=1/0;if(u.forEach((function(t){t.id&&p[t.id]<h&&(h=p[t.id],f=t)})),f===n&&n.id){var y=[];return P_(y,d,l,n.id),{value:y}}if(!f)return{value:[e,n]};C_(u,f),s.push(f),k_(t,f,r,o).forEach((function(t){if(-1===s.indexOf(t)&&(-1===u.indexOf(t)&&u.push(t),(null==f?void 0:f.id)&&(null==t?void 0:t.id))){var r=p[f.id]+O_(f,t);if(c[t.id]&&r>=c[t.id])return;l[t.id]=f.id,c[t.id]=r,p[t.id]=c[t.id]+D_(t,n,e,i,a)}}))};u.length;){var h=f();if("object"==typeof h)return h.value}return[e,n]},L_=function(t){return Mm(t)},B_=function(t){for(var e=1;e<t.length-1;){var n=t[e-1],r=t[e],o=t[e+1];n.x===r.x&&r.x===o.x||n.y===r.y&&r.y===o.y?t.splice(e,1):e++}return t},z_=function(t,e,n,r,o){var i=L_(n),a=L_(r),s=__(i,o),u=__(a,o),l=b_(s,i,t),c=b_(u,a,e);if(v_(s,u))return ao(ao([t,l],io(V_(t,e,l,c)),!1),[c,e],!1);var p=x_([l,c]),d=E_(s,p),f=E_(u,p),h=[];h=(h=h.concat(w_(d))).concat(w_(f));var y={x:(t.x+e.x)/2,y:(t.y+e.y)/2};[p,d,f].forEach((function(t){h=h.concat(T_(t,y).filter((function(t){return S_(t,s)&&S_(t,u)})))})),[{x:l.x,y:c.y},{x:c.x,y:l.y}].forEach((function(t){S_(t,s)&&S_(t,u)&&h.push(t)})),h.unshift(l),h.push(c),h=g_(h);var v=R_(h,l,c,i,a,t,e);return v.unshift(t),v.push(e),v.length>2&&(v=B_(v)),g_(v)},H_=function(t){var e;if(1===t.length)e=[t[0],t[0]];else if(t.length>=2){for(var n=t[0],r=t[1],o=xm(n.x,n.y,r.x,r.y),i=1;i<t.length-1;i++){var a=t[i],s=t[i+1],u=xm(a.x,a.y,s.x,s.y);u>o&&(o=u,n=a,r=s)}e=[n,r]}return e},U_=function(t,e,n){var r=wm(t,n),o=wm(e,n);return r&&o},X_=function(t,e,n){var r=wm(t,n),o=wm(e,n);return!(r&&o)&&(r||o)},G_=function(t,e,n){for(var r,o=void 0,i=Mm(n),a=w_(i),s=0;s<a.length;s++){I_(t,e,a[s],a[(s+1)%a.length])&&(o=[a[s],a[(s+1)%a.length]])}return o&&(r=function(t,e,n,r){var o=(e.y-t.y)*(r.x-n.x)-(t.x-e.x)*(n.y-r.y);if(0===o)return!1;var i=((e.x-t.x)*(r.x-n.x)*(n.y-t.y)+(e.y-t.y)*(r.x-n.x)*t.x-(r.y-n.y)*(e.x-t.x)*n.x)/o,a=-((e.y-t.y)*(r.y-n.y)*(n.x-t.x)+(e.x-t.x)*(r.y-n.y)*t.y-(r.x-n.x)*(e.y-t.y)*n.y)/o;return(i-t.x)*(i-e.x)<=0&&(a-t.y)*(a-e.y)<=0&&(i-n.x)*(i-r.x)<=0&&(a-n.y)*(a-r.y)<=0&&{x:i,y:a}}(t,e,o[0],o[1])),r},W_=function(t,e){var n=void 0;return t.x===e.x?n=p_.VERTICAL:t.y===e.y&&(n=p_.HORIZONTAL),n},Y_=function(t){var e=t.split(" "),n=[];return e&&e.forEach((function(t){var e=io(t.split(","),2),r=e[0],o=e[1];n.push({x:Number(r),y:Number(o)})})),n},V_=function(t,e,n,r){var o=[];if(W_(t,n)===W_(e,r))t.y===n.y?(o.push({x:n.x,y:(n.y+r.y)/2}),o.push({x:r.x,y:(n.y+r.y)/2})):(o.push({x:(n.x+r.x)/2,y:n.y}),o.push({x:(n.x+r.x)/2,y:r.y}));else{var i={x:n.x,y:r.y},a=y_(i,t,n),s=y_(i,e,r);if(a||s)i={x:r.x,y:n.y};else{var u=F_(i,t,n),l=F_(i,e,r);u&&l&&(i={x:r.x,y:n.y})}o.push(i)}return o},F_=function(t,e,n){return t.x===e.x&&t.x===n.x||t.y===e.y&&t.y===n.y},K_=function(t){if(!t)return 0;for(var e=0,n=0;n<t.length;n++){var r=t.charCodeAt(n);t.match(/[A-Z]/)?e+=1.5:e+=r>=1&&r<=126||r>=65376&&r<=65439?1:2}return e},q_=void 0,Z_=function(t){var e,n=t.start,r=t.end;if(n.x===r.x&&n.y===r.y)e="";else{var o={start:n,end:r,offset:10,verticalLength:5},i=h_(no(no({},o),{type:"start"})),a=h_(no(no({},o),{type:"end"}));e="M".concat(i.leftX," ").concat(i.leftY,"\n L").concat(i.rightX," ").concat(i.rightY,"\n L").concat(a.rightX," ").concat(a.rightY,"\n L").concat(a.leftX," ").concat(a.leftY," z")}return{d:e,fill:"transparent",stroke:"transparent",strokeWidth:1,strokeDasharray:"4, 4"}},$_=function(t){var e=t.start,n=t.end,r=t.sourceNode,o=t.targetNode,i=t.offset,a=Mm(r),s=Mm(o),u=__(a,i),l=__(s,i);return{sNext:b_(u,a,e),ePre:b_(l,s,n)}},J_=function(t){var e=t.replace(/M/g,"").replace(/C/g,",").split(",");return[Q_(e[0]),Q_(e[1]),Q_(e[2]),Q_(e[3])]},Q_=function(t){var e=io(t.replace(/(^\s*)/g,"").split(" "),2);return{x:+e[0],y:+e[1]}},tm=function(t,e){var n=io(t,4);return[ub(n[0],n[1],n[2],n[3],e),t[3]]},em=function(t,e){for(var n,r=t.x,o=t.y,i=Y_(e),a=Number.MAX_SAFE_INTEGER,s=[],u=0;u<i.length;u++)s.push({start:i[u],end:i[(u+1)%i.length]});if(s.forEach((function(t){var e=t.start,i=t.end;if(e.x===i.x){var s={x:e.x,y:o};if(y_(s,e,i))(u=Math.abs(e.x-r))<a&&(a=u,n=s)}else if(e.y===i.y){var u;s={x:r,y:e.y};if(y_(s,e,i))(u=Math.abs(e.y-o))<a&&(a=u,n=s)}})),!n){var l=s[0],c=l.start,p=l.end;n={x:c.x+(p.x-c.x)/2,y:c.y+(p.y-c.y)/2}}return n},nm=function(t){return Hy(t,["id","type","sourceNodeId","sourceAnchorId","targetNodeId","targetAnchorId","pointsList","startPoint","endPoint","properties"])},rm=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))};function om(t,e){return"function"!=typeof e?function(e,n,r){return Object.assign({type:t.edgeType},r)}:function(n,r,o){var i=e(n,r,o);return i?"string"==typeof i?Object.assign({},o,{type:i}):Object.assign({type:i},o):{type:t.edgeType}}}var im=function(t){var e=t.rows,n=t.rowsLength,r=t.fontSize,o=0;return Yd(e,(function(t){var e=K_(t);o=e>o?e:o})),{width:Math.ceil(o/2)*r+r/4,height:n*(r+2)+r/4}};function am(t,e){return e*Math.round(t/e)||t}function sm(t,e,n){if(!t)return[];var r=Math.min.apply(Math,ao([],io(t.map((function(t){return t[0]}))),!1)),o=Math.max.apply(Math,ao([],io(t.map((function(t){return t[0]}))),!1)),i=Math.min.apply(Math,ao([],io(t.map((function(t){return t[1]}))),!1)),a=Math.max.apply(Math,ao([],io(t.map((function(t){return t[1]}))),!1)),s=-r,u=-i,l=t.map((function(t){var e=io(t,2),n=e[0],r=e[1];return[n+s,r+u]})),c=e?e/(o-r):1,p=n?n/(a-i):1,d=Math.min(c,p);return l.map((function(t){var e=io(t,2),n=e[0],r=e[1];return[n*d,r*d]}))}var um=function(t,e,n){var r=io(t,2),o=r[0],i=r[1],a=io(e,2),s=a[0],u=a[1],l=io(n,2),c=l[0],p=l[1];return o>s&&o<c&&i>u&&i<p},lm=function(t,e){var n=!1;switch(e.multipleSelectKey){case"meta":n=t.metaKey;break;case"alt":n=t.altKey;break;case"shift":n=t.shiftKey;break;case"ctrl":n=t.ctrlKey;break;default:n=!1}return n};function cm(t,e){return!!(t instanceof dm&&e instanceof dm)}var pm=function(t){function e(n,r,o){var i=t.call(this,3)||this;return i[0]=n,i[1]=r,i[2]=o,i.x=n,i.y=r,i.z=o,Object.setPrototypeOf(i,e.prototype),i}return eo(e,t),e.prototype.add=function(t){if(cm(this,t))return new dm(this.x+t.x,this.y+t.y);var e=this.z+t.z;return new fm((this.x+t.x)/e,(this.y+t.y)/e)},e.prototype.subtract=function(t){if(cm(this,t))return new dm(this.x-t.x,this.y-t.y);var e=this.z-t.z;return 0===e?new dm(this.x-t.x,this.y-t.y):new fm((this.x-t.x)/e,(this.y-t.y)/e)},e}(Array),dm=function(t){function e(n,r,o){var i=t.call(this,n,r,null!=o?o:0)||this;return Object.setPrototypeOf(i,e.prototype),i}return eo(e,t),e.prototype.toString=function(){return"Vector"},e.prototype.dot=function(t){var e=this;return t.reduce((function(t,n,r){return t+n*e[r]}))},e.prototype.cross=function(t){return new e(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)},e.prototype.getLength=function(){return Math.hypot(this.x,this.y)},e.prototype.normalize=function(){var t=this.getLength();return new e(this.x/t,this.y/t)},e.prototype.crossZ=function(t){return this.x*t.y-this.y*t.x},e.prototype.angle=function(t){var e=this.crossZ(t),n=Math.acos(this.normalize().dot(t.normalize()));return e>=0?n:-n},e}(pm),fm=function(t){function e(n,r){var o=t.call(this,n,r,1)||this;return Object.setPrototypeOf(o,e.prototype),o}return eo(e,t),e.prototype.toString=function(){return"Point"},e}(pm),hm=function(t){function e(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=t.call(this,n.length)||this;return o.fill(new Array(3)),n.forEach((function(t,e){o[e]=t})),o.columns=n[0].length,o.rows=n.length,Object.setPrototypeOf(o,e.prototype),o}return eo(e,t),e.prototype.getRow=function(t){return this[t]},e.prototype.getColumn=function(t){return ao([],io(this.map((function(e){return e[t]}))),!1)},e.prototype.transpose=function(){for(var t=[],n=0;n<this.columns;n++)t.push(this.getColumn(n));return new(e.bind.apply(e,ao([void 0],io(t),!1)))},e.prototype.cross=function(t){var n=new Array(this.rows).fill("").map((function(){return[]}));if(this.columns===t.rows)for(var r=0;r<this.rows;r++)for(var o=this.getRow(r),i=function(e){var i=t.getColumn(e);n[r][e]=o.reduce((function(t,e,n){return t+e*i[n]}),0)},a=0;a<t.columns;a++)i(a);return new(e.bind.apply(e,ao([void 0],io(n),!1)))},e.prototype.to2D=function(){return this.map((function(t){return[t[0],t[1]]}))},e.prototype.toPoints=function(){return this.map((function(t){return new fm(t[0],t[1])}))},e.prototype.toString=function(){var t=io(this[0],2),e=t[0],n=t[1],r=io(this[1],2),o=r[0],i=r[1],a=io(this[2],2),s=a[0],u=a[1];return"matrix(".concat(e," ").concat(n," ").concat(o," ").concat(i," ").concat(s," ").concat(u,")")},e.prototype.translate=function(t,e){return this.cross(new gm(t,e))},e.prototype.rotate=function(t){return this.cross(new ym(t))},e.prototype.scale=function(t,e){return this.cross(new vm(t,e))},e}(Array),ym=function(t){function e(n){var r=t.call(this,new dm(+Math.cos(n).toFixed(2),+Math.sin(n).toFixed(2),0),new dm(-Math.sin(n).toFixed(2),+Math.cos(n).toFixed(2),0),new dm(0,0,1))||this;return Object.setPrototypeOf(r,e.prototype),r}return eo(e,t),e.prototype.inverse=function(){return this.transpose()},e}(hm),vm=function(t){function e(n,r){var o=t.call(this,new dm(n,0,0),new dm(0,r,0),new dm(0,0,1))||this;return o.sx=n,o.sy=r,Object.setPrototypeOf(o,e.prototype),o}return eo(e,t),e.prototype.inverse=function(){return new e(1/this.sx,1/this.sy)},e}(hm),gm=function(t){function e(n,r){var o=t.call(this,new dm(1,0,0),new dm(0,1,0),new dm(n,r,1))||this;return o.tx=n,o.ty=r,Object.setPrototypeOf(o,e.prototype),o}return eo(e,t),e.prototype.inverse=function(){return new e(-this.tx,-this.ty)},e}(hm);ce({isolateGlobalState:!0});var _m=function(t){return t.anchors},mm=function(t,e){for(var n,r=e.nodes,o=r.length-1;o>=0;o--){var i=r[o];if(Sm(t,i)){var a=i.getTargetAnchor(t);if(a){var s={node:i,anchorIndex:a.index,anchor:a.anchor};n&&!bm(i,n.node,e)||(n=s)}}}return n},bm=function(t,e,n){return t.zIndex>e.zIndex||n.nodesMap[t.id].index>n.nodesMap[e.id].index},Em=function(t,e){for(var n,r=_m(e),o=Number.MAX_SAFE_INTEGER,i=0;i<r.length;i++){var a=xm(t.x,t.y,r[i].x,r[i].y);a<o&&(o=a,n={index:i,anchor:no(no({},r[i]),{x:r[i].x,y:r[i].y,id:r[i].id})})}return n},xm=function(t,e,n,r){return Math.hypot(t-n,e-r)},wm=function(t,e){var n=!1,r=Mm(e);return t.x>=r.minX-0&&t.x<=r.maxX+0&&t.y>=r.minY-0&&t.y<=r.maxY+0&&(n=!0),n},Sm=function(t,e){var n=!1,r=Mm(e);return t.x>=r.minX-5&&t.x<=r.maxX+5&&t.y>=r.minY-5&&t.y<=r.maxY+5&&(n=!0),n},Mm=function(t){var e=t.x,n=t.y,r=t.width,o=t.height;return{minX:e-r/2,minY:n-o/2,maxX:e+r/2,maxY:n+o/2,x:e,y:n,width:r,height:o,centerX:e,centerY:n}},Am=function(t){var e=t,n=e.x,r=e.y,o=e.width,i=e.height,a=e.radius;return[{x:n-o/2+a,y:r-i/2+a,r:a},{x:n+o/2-a,y:r-i/2+a,r:a},{x:n-o/2+a,y:r+i/2-a,r:a},{x:n+o/2-a,y:r+i/2-a,r:a}]},Tm=function(t,e,n){var r,o=Am(n),i=Number.MAX_SAFE_INTEGER;return o.forEach((function(e){var n=xm(t.x,t.y,e.x,e.y);n<i&&(i=n,r=e)})),Om(t,e,r)},Om=function(t,e,n){var r,o=n.x,i=n.y,a=n.r;if(e===p_.HORIZONTAL){var s=o-Math.sqrt(a*a-(t.y-i)*(t.y-i)),u=o+Math.sqrt(a*a-(t.y-i)*(t.y-i));r={x:Math.abs(s-t.x)<Math.abs(u-t.x)?s:u,y:t.y}}else if(e===p_.VERTICAL){var l=i-Math.sqrt(a*a-(t.x-o)*(t.x-o)),c=i+Math.sqrt(a*a-(t.x-o)*(t.x-o)),p=Math.abs(l-t.y)<Math.abs(c-t.y)?l:c;r={x:t.x,y:p}}return r},Nm=function(t,e){var n=e,r=!1,o=n.x,i=n.y,a=n.width,s=n.height,u=n.radius,l=o-a/2+u,c=o+a/2-u,p=i-s/2+u,d=i+s/2-u;return t.y===i+s/2||t.y===i-s/2?r=t.x>l&&t.x<c:t.x!==o+a/2&&t.x!==o-a/2||(r=t.y>p&&t.y<d),r},Dm=function(t,e,n){var r,o=n,i=o.x,a=o.y,s=o.rx,u=o.ry;if(e===p_.HORIZONTAL){var l=i-Math.sqrt(s*s-(t.y-a)*(t.y-a)*s*s/(u*u)),c=i+Math.sqrt(s*s-(t.y-a)*(t.y-a)*s*s/(u*u));r={x:Math.abs(l-t.x)<Math.abs(c-t.x)?l:c,y:t.y}}else if(e===p_.VERTICAL){var p=a-Math.sqrt(u*u-(t.x-i)*(t.x-i)*u*u/(s*s)),d=a+Math.sqrt(u*u-(t.x-i)*(t.x-i)*u*u/(s*s)),f=Math.abs(p-t.y)<Math.abs(d-t.y)?p:d;r={x:t.x,y:f}}return r},Pm=function(t,e,n){for(var r,o=n.pointsPosition,i=Number.MAX_SAFE_INTEGER,a=[],s=0;s<o.length;s++)a.push({start:o[s],end:o[(s+1)%o.length]});return a.forEach((function(n){var o=n.start,a=n.end,s=o,u=a;o.x>a.x&&(s=a,u=o);var l={x:t.x,y:t.y};if(s.x===u.x&&e===p_.HORIZONTAL&&(l={x:s.x,y:t.y}),s.y===u.y&&e===p_.VERTICAL&&(l={x:t.x,y:s.y}),s.x!==u.x&&s.y!==u.y){var c=(u.y-s.y)/(u.x-s.x),p=(s.x*u.y-u.x*s.y)/(s.x-u.x);e===p_.HORIZONTAL?l={x:(t.y-p)/c,y:t.y}:e===p_.VERTICAL&&(l={x:t.x,y:c*t.x+p})}if(y_(l,o,a)){var d=xm(l.x,l.y,t.x,t.y);d<i&&(i=d,r=l)}})),r},Cm=function(t){return Hy(t,["id","type","x","y","text","properties","virtual","rotate"])},Im=function(t,e,n,r){var o=t.x,i=t.y;return e.x>t.x?o=t.x+n/2:e.x<t.x&&(o=t.x-n/2),e.y>t.y?i=t.y+r/2:e.y<t.y&&(i=t.y-r/2),{x:o,y:i}},jm=function(t){var e=t.rows,n=t.style,r=t.rowsLength,o=t.className,i=document.createElement("div");i.className=o,i.style.fontSize="".concat(n.fontSize),i.style.width="".concat(n.width),i.style.lineHeight="".concat(n.lineHeight),i.style.padding="".concat(n.padding),n.fontFamily&&(i.style.fontFamily="".concat(n.fontFamily)),r>1?e.forEach((function(t){var e=document.createElement("div");e.textContent=t,i.appendChild(e)})):i.textContent=e[0],document.body.appendChild(i);var a=i.clientHeight;return document.body.removeChild(i),a},km=function(t){var e=t.rows,n=t.rowsLength,r=t.fontSize,o=0;return e&&e.forEach((function(t){var e=K_(t);o=e>o?e:o})),{width:Math.ceil(o/2)*r+r/4,height:n*(r+2)+r/4}},Rm=function(t){return"object"!=typeof t?{isAllPass:!!t,msg:t?"":"不允许连接"}:t};let Lm;const Bm=new Uint8Array(16);function zm(){if(!Lm&&(Lm="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Lm))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Lm(Bm)}var Hm=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const Um=[];for(let t=0;t<256;++t)Um.push((t+256).toString(16).slice(1));function Xm(t,e=0){return Um[t[e+0]]+Um[t[e+1]]+Um[t[e+2]]+Um[t[e+3]]+"-"+Um[t[e+4]]+Um[t[e+5]]+"-"+Um[t[e+6]]+Um[t[e+7]]+"-"+Um[t[e+8]]+Um[t[e+9]]+"-"+Um[t[e+10]]+Um[t[e+11]]+Um[t[e+12]]+Um[t[e+13]]+Um[t[e+14]]+Um[t[e+15]]}function Gm(t){if(!function(t){return"string"==typeof t&&Hm.test(t)}(t))throw TypeError("Invalid UUID");let e;const n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n}function Wm(t,e,n){function r(t,r,o,i){var a;if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));const e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof r&&(r=Gm(r)),16!==(null===(a=r)||void 0===a?void 0:a.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let s=new Uint8Array(16+t.length);if(s.set(r),s.set(t,r.length),s=n(s),s[6]=15&s[6]|e,s[8]=63&s[8]|128,o){i=i||0;for(let t=0;t<16;++t)o[i+t]=s[t];return o}return Xm(s)}try{r.name=t}catch(t){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}function Ym(t){return 14+(t+64>>>9<<4)+1}function Vm(t,e){const n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function Fm(t,e,n,r,o,i){return Vm((a=Vm(Vm(e,t),Vm(r,i)))<<(s=o)|a>>>32-s,n);var a,s}function Km(t,e,n,r,o,i,a){return Fm(e&n|~e&r,t,e,o,i,a)}function qm(t,e,n,r,o,i,a){return Fm(e&r|n&~r,t,e,o,i,a)}function Zm(t,e,n,r,o,i,a){return Fm(e^n^r,t,e,o,i,a)}function $m(t,e,n,r,o,i,a){return Fm(n^(e|~r),t,e,o,i,a)}Wm("v3",48,(function(t){if("string"==typeof t){const e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n)}return function(t){const e=[],n=32*t.length,r="0123456789abcdef";for(let o=0;o<n;o+=8){const n=t[o>>5]>>>o%32&255,i=parseInt(r.charAt(n>>>4&15)+r.charAt(15&n),16);e.push(i)}return e}(function(t,e){t[e>>5]|=128<<e%32,t[Ym(e)-1]=e;let n=1732584193,r=-271733879,o=-1732584194,i=271733878;for(let e=0;e<t.length;e+=16){const a=n,s=r,u=o,l=i;n=Km(n,r,o,i,t[e],7,-680876936),i=Km(i,n,r,o,t[e+1],12,-389564586),o=Km(o,i,n,r,t[e+2],17,606105819),r=Km(r,o,i,n,t[e+3],22,-1044525330),n=Km(n,r,o,i,t[e+4],7,-176418897),i=Km(i,n,r,o,t[e+5],12,1200080426),o=Km(o,i,n,r,t[e+6],17,-1473231341),r=Km(r,o,i,n,t[e+7],22,-45705983),n=Km(n,r,o,i,t[e+8],7,1770035416),i=Km(i,n,r,o,t[e+9],12,-1958414417),o=Km(o,i,n,r,t[e+10],17,-42063),r=Km(r,o,i,n,t[e+11],22,-1990404162),n=Km(n,r,o,i,t[e+12],7,1804603682),i=Km(i,n,r,o,t[e+13],12,-40341101),o=Km(o,i,n,r,t[e+14],17,-1502002290),r=Km(r,o,i,n,t[e+15],22,1236535329),n=qm(n,r,o,i,t[e+1],5,-165796510),i=qm(i,n,r,o,t[e+6],9,-1069501632),o=qm(o,i,n,r,t[e+11],14,643717713),r=qm(r,o,i,n,t[e],20,-373897302),n=qm(n,r,o,i,t[e+5],5,-701558691),i=qm(i,n,r,o,t[e+10],9,38016083),o=qm(o,i,n,r,t[e+15],14,-660478335),r=qm(r,o,i,n,t[e+4],20,-405537848),n=qm(n,r,o,i,t[e+9],5,568446438),i=qm(i,n,r,o,t[e+14],9,-1019803690),o=qm(o,i,n,r,t[e+3],14,-187363961),r=qm(r,o,i,n,t[e+8],20,1163531501),n=qm(n,r,o,i,t[e+13],5,-1444681467),i=qm(i,n,r,o,t[e+2],9,-51403784),o=qm(o,i,n,r,t[e+7],14,1735328473),r=qm(r,o,i,n,t[e+12],20,-1926607734),n=Zm(n,r,o,i,t[e+5],4,-378558),i=Zm(i,n,r,o,t[e+8],11,-2022574463),o=Zm(o,i,n,r,t[e+11],16,1839030562),r=Zm(r,o,i,n,t[e+14],23,-35309556),n=Zm(n,r,o,i,t[e+1],4,-1530992060),i=Zm(i,n,r,o,t[e+4],11,1272893353),o=Zm(o,i,n,r,t[e+7],16,-155497632),r=Zm(r,o,i,n,t[e+10],23,-1094730640),n=Zm(n,r,o,i,t[e+13],4,681279174),i=Zm(i,n,r,o,t[e],11,-358537222),o=Zm(o,i,n,r,t[e+3],16,-722521979),r=Zm(r,o,i,n,t[e+6],23,76029189),n=Zm(n,r,o,i,t[e+9],4,-640364487),i=Zm(i,n,r,o,t[e+12],11,-421815835),o=Zm(o,i,n,r,t[e+15],16,530742520),r=Zm(r,o,i,n,t[e+2],23,-995338651),n=$m(n,r,o,i,t[e],6,-198630844),i=$m(i,n,r,o,t[e+7],10,1126891415),o=$m(o,i,n,r,t[e+14],15,-1416354905),r=$m(r,o,i,n,t[e+5],21,-57434055),n=$m(n,r,o,i,t[e+12],6,1700485571),i=$m(i,n,r,o,t[e+3],10,-1894986606),o=$m(o,i,n,r,t[e+10],15,-1051523),r=$m(r,o,i,n,t[e+1],21,-2054922799),n=$m(n,r,o,i,t[e+8],6,1873313359),i=$m(i,n,r,o,t[e+15],10,-30611744),o=$m(o,i,n,r,t[e+6],15,-1560198380),r=$m(r,o,i,n,t[e+13],21,1309151649),n=$m(n,r,o,i,t[e+4],6,-145523070),i=$m(i,n,r,o,t[e+11],10,-1120210379),o=$m(o,i,n,r,t[e+2],15,718787259),r=$m(r,o,i,n,t[e+9],21,-343485551),n=Vm(n,a),r=Vm(r,s),o=Vm(o,u),i=Vm(i,l)}return[n,r,o,i]}(function(t){if(0===t.length)return[];const e=8*t.length,n=new Uint32Array(Ym(e));for(let r=0;r<e;r+=8)n[r>>5]|=(255&t[r/8])<<r%32;return n}(t),8*t.length))}));var Jm={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Qm(t,e,n){if(Jm.randomUUID&&!e&&!t)return Jm.randomUUID();const r=(t=t||{}).random||(t.rng||zm)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(let t=0;t<16;++t)e[n+t]=r[t];return e}return Xm(r)}function tb(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function eb(t,e){return t<<e|t>>>32-e}Wm("v5",80,(function(t){const e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){const e=unescape(encodeURIComponent(t));t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);const r=t.length/4+2,o=Math.ceil(r/16),i=new Array(o);for(let e=0;e<o;++e){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=t[64*e+4*r]<<24|t[64*e+4*r+1]<<16|t[64*e+4*r+2]<<8|t[64*e+4*r+3];i[e]=n}i[o-1][14]=8*(t.length-1)/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=8*(t.length-1)&4294967295;for(let t=0;t<o;++t){const r=new Uint32Array(80);for(let e=0;e<16;++e)r[e]=i[t][e];for(let t=16;t<80;++t)r[t]=eb(r[t-3]^r[t-8]^r[t-14]^r[t-16],1);let o=n[0],a=n[1],s=n[2],u=n[3],l=n[4];for(let t=0;t<80;++t){const n=Math.floor(t/20),i=eb(o,5)+tb(n,a,s,u)+l+e[n]+r[t]>>>0;l=u,u=s,s=eb(a,30)>>>0,a=o,o=i}n[0]=n[0]+o>>>0,n[1]=n[1]+a>>>0,n[2]=n[2]+s>>>0,n[3]=n[3]+u>>>0,n[4]=n[4]+l>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}));var nb=function(){return Qm()},rb=new Map,ob=function(t){var e=nb();var n=window.requestAnimationFrame((function n(){if(t(),rb.get(e)){var r=window.requestAnimationFrame(n);rb.set(e,r)}}));return rb.set(e,n),e},ib=function(t){var e=rb.get(t);e&&(window.cancelAnimationFrame(e),rb.delete(t))},ab=100,sb={x:1,y:0,z:0};function ub(t,e,n,r,o){for(var i=function(o){if(o<0||o>1)throw new RangeError('The value range of parameter "t" is [0,1]');return{x:t.x*Math.pow(1-o,3)+3*e.x*o*Math.pow(1-o,2)+3*n.x*Math.pow(o,2)*(1-o)+r.x*Math.pow(o,3),y:t.y*Math.pow(1-o,3)+3*e.y*o*Math.pow(1-o,2)+3*n.y*Math.pow(o,2)*(1-o)+r.y*Math.pow(o,3)}},a=0,s=2,u=r.x,l=r.y,c=r;a<o&&s<50;){var p=(c=i(1-s/ab)).x,d=c.y;a=xm(u,l,p,d),s++}return c}function lb(t){var e=Math.hypot(t.x,t.y);return{x:t.x/e,y:t.y/e,z:0}}function cb(t){return function(t,e){var n=function(t,e){return t.x*e.y-t.y*e.x}(t,e),r=Math.acos(function(t,e){var n=[t.x,t.y,t.z];return[e.x,e.y,e.z].reduce((function(t,e,r){return t+e*n[r]}))}(lb(t),lb(e)));return n>=0?r:-r}(sb,t)}function pb(t){return t*(180/Math.PI)}var db={baseNode:{fill:"#fff",stroke:"#000",strokeWidth:2},baseEdge:{stroke:"#000",strokeWidth:2},rect:{},circle:{},diamond:{},ellipse:{},polygon:{},text:{color:"#000",stroke:"none",fontSize:12,background:{fill:"transparent"}},anchor:{stroke:"#000",fill:"#fff",r:4,hover:{r:10,fill:"#949494",fillOpacity:.5,stroke:"#949494"}},anchorLine:{stroke:"#000",strokeWidth:2,strokeDasharray:"3,2"},nodeText:{color:"#000",overflowMode:"default",fontSize:12,lineHeight:1.2},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"#fff"}},line:{},polyline:{},bezier:{fill:"none",adjustLine:{stroke:"#949494"},adjustAnchor:{r:4,fill:"#949494",fillOpacity:1,stroke:"#949494"}},arrow:{offset:10,verticalLength:5},snapline:{stroke:"#949494",strokeWidth:1},edgeAdjust:{r:4,fill:"#fff",stroke:"#949494",strokeWidth:2},outline:{fill:"transparent",stroke:"#949494",strokeDasharray:"3,3",hover:{stroke:"#949494"}},edgeAnimation:{stroke:"red",strokeDasharray:"10,10",strokeDashoffset:"100%",animationName:"lf_animate_dash",animationDuration:"20s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"normal"},rotateControl:{stroke:"#000",fill:"#fff",strokeWidth:1.5},resizeControl:{width:7,height:7,fill:"#fff",stroke:"#000"},resizeOutline:{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},fb=function(t){var e=up(db);return t&&(e=Uh(e,t)),e},hb=fb,yb=1e3,vb=999,gb=function(){return++yb},_b=function(){return--vb},mb=Object.freeze({__proto__:null,Matrix:hm,Point:fm,RotateMatrix:ym,ScaleMatrix:vm,StepDrag:f_,TranslateMatrix:gm,Vector:dm,action:te,cancelRaf:ib,computed:rt,configure:ce,costByPoints:N_,createEdgeGenerator:om,createRaf:ob,createUuid:nb,defaultAnimationOffConfig:t_,defaultAnimationOnConfig:e_,defaultTheme:db,degrees:pb,distance:xm,estimateDistance:O_,filterRepeatPoints:g_,formatAnchorConnectValidateData:Rm,formatData:i_,getAnchors:_m,getAppendAttributes:Z_,getBBoxCrossPointsByPoint:T_,getBBoxOfPoints:x_,getBBoxXCrossPoints:M_,getBBoxYCrossPoints:A_,getBezierControlPoints:$_,getBezierPoints:J_,getBoxByOriginNode:L_,getBytesLength:K_,getClosestAnchor:Em,getClosestPointOfPolyline:em,getClosestRadiusCenter:Tm,getCrossPointInRect:G_,getCrossPointWithCircle:Om,getCrossPointWithEllipse:Dm,getCrossPointWithPolygon:Pm,getEndTangent:tm,getExpandedBBox:__,getExpandedBBoxPoint:b_,getGridOffset:function(t,e){return t%e},getHtmlTextHeight:jm,getLongestEdge:H_,getMinIndex:_b,getNextNeighborPoints:k_,getNodeAnchorPosition:Im,getNodeBBox:Mm,getPointsFromBBox:w_,getPolylinePoints:z_,getRectRadiusCircle:Am,getSimplePoints:V_,getSimplePolyline:function(t,e){var n=[t,{x:t.x,y:e.y},e];return g_(n)},getSvgTextSize:im,getSvgTextWidthHeight:km,getTextWidth:function(t,e){q_||(q_=document.createElement("canvas"));var n=q_.getContext("2d");return n.font=e,n.measureText(t).width},getThetaOfVector:cb,getZIndex:gb,heuristicCostEstimate:D_,inStraightLineOfRect:Nm,isBboxOverLapping:v_,isIe:o_,isInNode:wm,isInNodeBbox:Sm,isMultipleSelect:lm,isObservable:Se,isPointInArea:um,isPointOutsideBBox:S_,isSegmentCrossingBBox:j_,isSegmentsCrossNode:X_,isSegmentsInNode:U_,isSegmentsIntersected:I_,mergeBBox:E_,normalizePolygon:sm,observable:$,pathFinder:R_,pickEdgeConfig:nm,pickNodeConfig:Cm,pointDirection:m_,pointEdgeDirection:function(t,e){var n=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y);return n/e.width>r/e.height?p_.VERTICAL:p_.HORIZONTAL},pointFilter:B_,points2PointsList:Y_,reaction:ae,rebuildPath:P_,refreshGraphId:function(t,e){void 0===e&&(e="");var n=t.nodes.reduce((function(t,n){return t[n.id]=e+Qm(),n.id=t[n.id],t}),{});return t.edges.forEach((function(t){t.id=e+Qm(),t.sourceNodeId=n[t.sourceNodeId],t.targetNodeId=n[t.targetNodeId]})),t},removeClosePointFromOpenList:C_,sampleCubic:ub,segmentDirection:W_,setupAnimation:n_,setupEdgeModel:function(t,e){var n;switch(t.type){case"line":default:n=new xb(t,e);break;case"polyline":n=new wb(t,e)}return n},setupTheme:fb,snapToGrid:am,targetNodeInfo:mm,toJS:je,twoPointDistance:rm,updateAnimation:r_,updateTheme:hb}),bb=function(){function e(e,n){this.BaseType=t.ElementType.EDGE,this.id="",this.type="",this.sourceNodeId="",this.targetNodeId="",this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this.properties={},this.points="",this.pointsList=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.isAnimation=!1,this.isShowAdjustPoint=!1,this.zIndex=0,this.state=t.ElementState.DEFAULT,this.modelType=t.ModelType.EDGE,this.customTextPosition=!1,this.style={},this.arrowConfig={markerEnd:"url(#marker-end-".concat(this.id,")"),markerStart:"url(#marker-start-".concat(this.id,")")},this.graphModel=n,this.initEdgeData(e),this.setAttributes()}return e.prototype.initEdgeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,n=e&&e(t.type),r=this.createId();t.id=r||n||nb()}this.arrowConfig.markerEnd="url(#marker-end-".concat(t.id,")"),this.arrowConfig.markerStart="url(#marker-start-".concat(t.id,")");var o=this.graphModel.editConfigModel.adjustEdgeStartAndEnd;this.isShowAdjustPoint=o,js(this,nm(t)),this.graphModel.overlapMode===c_.INCREASE&&(this.zIndex=t.zIndex||gb()),this.setAnchors(),this.initPoints(),this.formatText(t)},e.prototype.setAttributes=function(){},e.prototype.createId=function(){return null},e.prototype.getEdgeStyle=function(){return no(no({},this.graphModel.theme.baseEdge),this.style)},e.prototype.getAdjustPointStyle=function(){return no({},this.graphModel.theme.edgeAdjust)},e.prototype.getTextStyle=function(){return up(this.graphModel.theme.edgeText)},e.prototype.getEdgeAnimationStyle=function(){return up(this.graphModel.theme.edgeAnimation)},e.prototype.getArrowStyle=function(){var t=this.getEdgeStyle(),e=this.getEdgeAnimationStyle(),n=this.graphModel.theme.arrow,r=this.isAnimation?e.stroke:t.stroke;return no(no(no({},t),{fill:r,stroke:r}),n)},e.prototype.getOutlineStyle=function(){return up(this.graphModel.theme.outline)},e.prototype.getTextPosition=function(){return{x:0,y:0}},Object.defineProperty(e.prototype,"sourceNode",{get:function(){var t,e;return null===(e=null===(t=this.graphModel)||void 0===t?void 0:t.nodesMap[this.sourceNodeId])||void 0===e?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"targetNode",{get:function(){var t,e;return null===(e=null===(t=this.graphModel)||void 0===t?void 0:t.nodesMap[this.targetNodeId])||void 0===e?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textPosition",{get:function(){return this.getTextPosition()},enumerable:!1,configurable:!0}),e.prototype.getBeginAnchor=function(t,e,n){var r,o,i=_m(t);if(n){if(r=yf(i,(function(t){return t.id===n})))return r;console.warn("未在节点上找到指定的起点锚点".concat(n,",已使用默认锚点作为起点"))}return i.forEach((function(t){var n=rm(t,e);(void 0===o||n<o)&&(o=n,r=t)})),r},e.prototype.getEndAnchor=function(t,e){var n,r,o=this,i=_m(t);if(e){if(n=yf(i,(function(t){return t.id===e})))return n;console.warn("未在节点上找到指定的终点锚点".concat(e,",已使用默认锚点作为终点"))}return i.forEach((function(t){if(o.startPoint){var e=rm(t,o.startPoint);(void 0===r||e<r)&&(r=e,n=t)}})),n},e.prototype.getProperties=function(){return je(this.properties)},e.prototype.getData=function(){var t=this.text,e=t.x,n=t.y,r=t.value,o={id:this.id,type:this.type,sourceNodeId:this.sourceNode.id,targetNodeId:this.targetNode.id,startPoint:js({},this.startPoint),endPoint:js({},this.endPoint),properties:je(this.properties)};return r&&(o.text={x:e,y:n,value:r}),this.graphModel.overlapMode===c_.INCREASE&&(o.zIndex=this.zIndex),o},e.prototype.getHistoryData=function(){return this.getData()},e.prototype.setProperty=function(t,e){this.properties[t]=i_(e),this.setAttributes()},e.prototype.deleteProperty=function(t){delete this.properties[t],this.setAttributes()},e.prototype.setProperties=function(t){this.properties=no(no({},je(this.properties)),i_(t)),this.setAttributes()},e.prototype.changeEdgeId=function(t){var e=this.arrowConfig,n=e.markerEnd,r=e.markerStart;r&&r==="url(#marker-start-".concat(this.id,")")&&(this.arrowConfig.markerStart="url(#marker-start-".concat(t,")")),n&&n==="url(#marker-end-".concat(this.id,")")&&(this.arrowConfig.markerEnd="url(#marker-end-".concat(t,")")),this.id=t},e.prototype.setStyle=function(t,e){var n;this.style=no(no({},this.style),((n={})[t]=i_(e),n))},e.prototype.setStyles=function(t){this.style=no(no({},this.style),i_(t))},e.prototype.updateStyles=function(t){this.style=no({},i_(t))},e.prototype.formatText=function(t){var e,n,r,o=this.textPosition,i=o.x,a=o.y,s=t.text,u={value:"",x:i,y:a,draggable:!1,editable:!0};s&&("string"==typeof s?u=no(no({},u),{value:s}):(u=no(no({},u),{x:null!==(e=s.x)&&void 0!==e?e:i,y:null!==(n=s.y)&&void 0!==n?n:a,value:null!==(r=s.value)&&void 0!==r?r:""}),Mh(s.draggable)||(u.draggable=s.draggable),Mh(s.editable)||(u.editable=s.editable))),this.text=u},e.prototype.resetTextPosition=function(){var t=this.textPosition,e=t.x,n=t.y;this.text.x=e,this.text.y=n},e.prototype.moveText=function(t,e){if(this.text){var n=this.text,r=n.x,o=n.y,i=n.value,a=n.draggable,s=n.editable;this.text={value:i,draggable:a,x:r+t,y:o+e,editable:s}}},e.prototype.setText=function(t){t&&js(this.text,t)},e.prototype.updateText=function(t){this.text=no(no({},je(this.text)),{value:t})},e.prototype.setAnchors=function(){if(!this.sourceAnchorId||!this.startPoint){if(!(t=this.getBeginAnchor(this.sourceNode,this.targetNode,this.sourceAnchorId)))throw new Error("无法获取beginAnchor,请检查anchors相关逻辑,anchors不能为空");this.startPoint||(this.startPoint={x:t.x,y:t.y}),this.sourceAnchorId||(this.sourceAnchorId=t.id)}if(!this.targetAnchorId||!this.endPoint){var t;if(!(t=this.getEndAnchor(this.targetNode,this.targetAnchorId)))throw new Error("无法获取endAnchor,请检查anchors相关逻辑,anchors不能为空");this.endPoint||(this.endPoint={x:t.x,y:t.y}),this.targetAnchorId||(this.targetAnchorId=t.id)}},e.prototype.setSelected=function(t){void 0===t&&(t=!0),this.isSelected=t},e.prototype.setHovered=function(t){void 0===t&&(t=!0),this.isHovered=t},e.prototype.setHitable=function(t){void 0===t&&(t=!0),this.isHitable=t},e.prototype.setHittable=function(t){void 0===t&&(t=!0),this.isHittable=t},e.prototype.openEdgeAnimation=function(){this.isAnimation=!0},e.prototype.closeEdgeAnimation=function(){this.isAnimation=!1},e.prototype.setElementState=function(t,e){this.state=t,this.additionStateData=e},e.prototype.updateStartPoint=function(t){this.startPoint=t},e.prototype.moveStartPoint=function(t,e){this.startPoint&&(this.startPoint.x+=t,this.startPoint.y+=e)},e.prototype.updateEndPoint=function(t){this.endPoint=t},e.prototype.moveEndPoint=function(t,e){this.endPoint&&(this.endPoint.x+=t,this.endPoint.y+=e)},e.prototype.setZIndex=function(t){void 0===t&&(t=0),this.zIndex=t},e.prototype.initPoints=function(){},e.prototype.updateAttributes=function(t){js(this,t)},e.prototype.getAdjustStart=function(){return this.startPoint},e.prototype.getAdjustEnd=function(){return this.endPoint},e.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,n=t.endPoint;this.updateStartPoint({x:e.x,y:e.y}),this.updateEndPoint({x:n.x,y:n.y})},e.BaseType=t.ElementType.EDGE,oo([$],e.prototype,"type",void 0),oo([$],e.prototype,"sourceNodeId",void 0),oo([$],e.prototype,"targetNodeId",void 0),oo([$],e.prototype,"startPoint",void 0),oo([$],e.prototype,"endPoint",void 0),oo([$],e.prototype,"text",void 0),oo([$],e.prototype,"properties",void 0),oo([$],e.prototype,"points",void 0),oo([$],e.prototype,"pointsList",void 0),oo([$],e.prototype,"isSelected",void 0),oo([$],e.prototype,"isHovered",void 0),oo([$],e.prototype,"isHitable",void 0),oo([$],e.prototype,"isHittable",void 0),oo([$],e.prototype,"draggable",void 0),oo([$],e.prototype,"visible",void 0),oo([$],e.prototype,"isAnimation",void 0),oo([$],e.prototype,"isShowAdjustPoint",void 0),oo([$],e.prototype,"zIndex",void 0),oo([$],e.prototype,"state",void 0),oo([$],e.prototype,"style",void 0),oo([$],e.prototype,"arrowConfig",void 0),oo([rt],e.prototype,"sourceNode",null),oo([rt],e.prototype,"targetNode",null),oo([rt],e.prototype,"textPosition",null),oo([te],e.prototype,"setProperty",null),oo([te],e.prototype,"deleteProperty",null),oo([te],e.prototype,"setProperties",null),oo([te],e.prototype,"changeEdgeId",null),oo([te],e.prototype,"setStyle",null),oo([te],e.prototype,"setStyles",null),oo([te],e.prototype,"updateStyles",null),oo([te],e.prototype,"formatText",null),oo([te],e.prototype,"resetTextPosition",null),oo([te],e.prototype,"moveText",null),oo([te],e.prototype,"setText",null),oo([te],e.prototype,"updateText",null),oo([te],e.prototype,"setAnchors",null),oo([te],e.prototype,"setSelected",null),oo([te],e.prototype,"setHovered",null),oo([te],e.prototype,"setHitable",null),oo([te],e.prototype,"setHittable",null),oo([te],e.prototype,"openEdgeAnimation",null),oo([te],e.prototype,"closeEdgeAnimation",null),oo([te],e.prototype,"setElementState",null),oo([te],e.prototype,"updateStartPoint",null),oo([te],e.prototype,"moveStartPoint",null),oo([te],e.prototype,"updateEndPoint",null),oo([te],e.prototype,"moveEndPoint",null),oo([te],e.prototype,"setZIndex",null),oo([te],e.prototype,"initPoints",null),oo([te],e.prototype,"updateAttributes",null),oo([te],e.prototype,"getAdjustStart",null),oo([te],e.prototype,"getAdjustEnd",null),oo([te],e.prototype,"updateAfterAdjustStartAndEnd",null),e}(),Eb=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.BEZIER_EDGE,o.path="",o.initEdgeData(n),o.setAttributes(),o}return eo(n,e),n.prototype.initEdgeData=function(t){this.offset=100,e.prototype.initEdgeData.call(this,t)},n.prototype.getEdgeStyle=function(){var t=this.graphModel.theme.bezier,n=e.prototype.getEdgeStyle.call(this);return no(no({},n),up(t))},n.prototype.getTextPosition=function(){if(this.pointsList&&this.pointsList.length>0){var t=0,e=0;return this.pointsList.forEach((function(n){var r=n.x,o=n.y;t+=r,e+=o})),{x:t/this.pointsList.length,y:e/this.pointsList.length}}return{x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2}},n.prototype.getData=function(){var t=e.prototype.getData.call(this),n=this.pointsList.map((function(t){return{x:t.x,y:t.y}}));return no(no({},t),{pointsList:n})},n.prototype.getControls=function(){var t=this.startPoint,e=this.endPoint;return $_({start:t,end:e,sourceNode:this.sourceNode,targetNode:this.targetNode,offset:this.offset})},n.prototype.getPath=function(t){var e=io(t,4),n=e[0],r=e[1],o=e[2],i=e[3];return"M ".concat(n.x," ").concat(n.y,"\n C ").concat(r.x," ").concat(r.y,",\n ").concat(o.x," ").concat(o.y,",\n ").concat(i.x," ").concat(i.y)},n.prototype.initPoints=function(){this.pointsList.length>0?this.path=this.getPath(this.pointsList):this.updatePoints()},n.prototype.updatePoints=function(){var t=this.getControls(),e=t.sNext,n=t.ePre;this.updatePath(e,n)},n.prototype.updatePath=function(t,e){t=up(t),e=up(e);var n={x:this.startPoint.x,y:this.startPoint.y},r={x:this.endPoint.x,y:this.endPoint.y};if(!t||!e){var o=this.getControls();t=o.sNext,e=o.ePre}this.pointsList=[n,t,e,r],this.path=this.getPath(this.pointsList)},n.prototype.updateStartPoint=function(t){this.startPoint=Object.assign({},t),this.updatePoints()},n.prototype.updateEndPoint=function(t){this.endPoint=Object.assign({},t),this.updatePoints()},n.prototype.moveStartPoint=function(t,e){this.startPoint.x+=t,this.startPoint.y+=e;var n=io(this.pointsList,3),r=n[1],o=n[2];r.x+=t,r.y+=e,this.updatePath(r,o)},n.prototype.moveEndPoint=function(t,e){this.endPoint.x+=t,this.endPoint.y+=e;var n=io(this.pointsList,3),r=n[1],o=n[2];o.x+=t,o.y+=e,this.updatePath(r,o)},n.prototype.updateAdjustAnchor=function(t,e){"sNext"===e?this.pointsList[1]=t:"ePre"===e&&(this.pointsList[2]=t),this.path=this.getPath(this.pointsList),this.setText(Object.assign({},this.text,this.textPosition))},n.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},n.prototype.getAdjustEnd=function(){var t=this.pointsList;return t[t.length-1]||this.endPoint},n.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,n=t.endPoint,r=t.sourceNode,o=t.targetNode,i=$_({start:e,end:n,sourceNode:r,targetNode:o,offset:this.offset}),a=i.sNext,s=i.ePre;this.pointsList=[e,a,s,n],this.initPoints()},oo([$],n.prototype,"path",void 0),oo([te],n.prototype,"initPoints",null),oo([te],n.prototype,"updatePoints",null),oo([te],n.prototype,"updateStartPoint",null),oo([te],n.prototype,"updateEndPoint",null),oo([te],n.prototype,"moveStartPoint",null),oo([te],n.prototype,"moveEndPoint",null),oo([te],n.prototype,"updateAdjustAnchor",null),oo([te],n.prototype,"getAdjustStart",null),oo([te],n.prototype,"getAdjustEnd",null),oo([te],n.prototype,"updateAfterAdjustStartAndEnd",null),n}(bb),xb=function(e){function n(){var n=e.apply(this,ao([],io(arguments),!1))||this;return n.modelType=t.ModelType.LINE_EDGE,n}return eo(n,e),n.prototype.getEdgeStyle=function(){var t=this.graphModel.theme.line,n=e.prototype.getEdgeStyle.call(this);return no(no({},n),up(t))},n.prototype.getTextPosition=function(){return{x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2}},n}(bb),wb=function(e){function n(){var n=e.apply(this,ao([],io(arguments),!1))||this;return n.modelType=t.ModelType.POLYLINE_EDGE,n.draggingPointList=[],n}return eo(n,e),n.prototype.initEdgeData=function(t){this.offset=30,e.prototype.initEdgeData.call(this,t)},n.prototype.getEdgeStyle=function(){var t=this.graphModel.theme.polyline,n=e.prototype.getEdgeStyle.call(this);return no(no({},n),up(t))},n.prototype.getTextPosition=function(){var t,e=null===(t=this.text)||void 0===t?void 0:t.value;if(this.dbClickPosition&&!e){var n=this.dbClickPosition;return{x:n.x,y:n.y}}var r=Y_(this.points),o=io(H_(r),2),i=o[0],a=o[1];return{x:(i.x+a.x)/2,y:(i.y+a.y)/2}},n.prototype.getAfterAnchor=function(t,e,n){var r,o;return n.forEach((function(n){var i;t===p_.HORIZONTAL?i=Math.abs(e.y-n.y):t===p_.VERTICAL&&(i=Math.abs(e.x-n.x)),(!o||o>i)&&(o=i,r=n)})),r},n.prototype.getCrossPoint=function(t,e,n){var r;return t===p_.HORIZONTAL?r={x:n.x,y:e.y}:t===p_.VERTICAL&&(r={x:e.x,y:n.y}),r},n.prototype.removeCrossPoints=function(t,e,n){var r=n.map((function(t){return t}));if(1===t){var o=r[t],i=r[e],a=r[t-1];if(U_(a,o,this.sourceNode)){if(X_(o,i,this.sourceNode))(s=G_(o,i,this.sourceNode))&&(r[t]=s,r.splice(t-1,1),t--,e--)}else this.sourceNode.anchors.forEach((function(e){(e.x===a.x&&e.x===o.x||e.y===a.y&&e.y===o.y)&&(xm(e.x,e.y,o.x,o.y)<xm(a.x,a.y,o.x,o.y)&&(r[t-1]=e))}))}if(e===n.length-2){var s,u=r[t],l=r[e],c=r[e+1];if(U_(l,c,this.targetNode)){if(X_(u,l,this.targetNode))(s=G_(u,l,this.targetNode))&&(r[e]=s,r.splice(e+1,1))}else this.targetNode.anchors.forEach((function(t){(t.x===c.x&&t.x===l.x||t.y===c.y&&t.y===l.y)&&(xm(t.x,t.y,l.x,l.y)<xm(c.x,c.y,l.x,l.y)&&(r[e+1]=t))}))}return r},n.prototype.getDraggingPoints=function(t,e,n,r,o){var i=o.map((function(t){return t})),a=this.getAfterAnchor(t,n,r),s=this.getCrossPoint(t,n,a);return"start"===e?(i.unshift(s),i.unshift(a)):(i.push(s),i.push(a)),i},n.prototype.updateCrossPoints=function(e){var n=e.map((function(t){return t})),r=e[0],o=e[1],i=e[n.length-2],a=e[n.length-1],s=this.sourceNode,u=this.targetNode,l=s.modelType,c=u.modelType,p=W_(r,o),d=n[0];switch(l){case t.ModelType.RECT_NODE:if(0!==s.radius)Nm(r,s)||(d=Tm(r,p,s));break;case t.ModelType.CIRCLE_NODE:d=Om(r,p,s);break;case t.ModelType.ELLIPSE_NODE:d=Dm(r,p,s);break;case t.ModelType.DIAMOND_NODE:case t.ModelType.POLYGON_NODE:d=Pm(r,p,s)}d&&(n[0]=d);var f=W_(i,a),h=n[n.length-1];switch(c){case t.ModelType.RECT_NODE:if(0!==u.radius)Nm(a,u)||(h=Tm(a,f,u));break;case t.ModelType.CIRCLE_NODE:h=Om(a,f,u);break;case t.ModelType.ELLIPSE_NODE:h=Dm(a,f,u);break;case t.ModelType.DIAMOND_NODE:case t.ModelType.POLYGON_NODE:h=Pm(a,f,u)}return h&&(n[n.length-1]=h),n},n.prototype.getData=function(){var t=e.prototype.getData.call(this),n=this.pointsList.map((function(t){return{x:t.x,y:t.y}}));return Object.assign({},t,{pointsList:n})},n.prototype.initPoints=function(){this.pointsList.length>0?this.points=this.pointsList.map((function(t){return"".concat(t.x,",").concat(t.y)})).join(" "):this.updatePoints()},n.prototype.updatePoints=function(){var t=z_({x:this.startPoint.x,y:this.startPoint.y},{x:this.endPoint.x,y:this.endPoint.y},this.sourceNode,this.targetNode,this.offset||0);this.pointsList=t,this.points=t.map((function(t){return"".concat(t.x,",").concat(t.y)})).join(" ")},n.prototype.updateStartPoint=function(t){this.startPoint=Object.assign({},t),this.updatePoints()},n.prototype.moveStartPoint=function(t,e){this.startPoint.x+=t,this.startPoint.y+=e,this.updatePoints()},n.prototype.updateEndPoint=function(t){this.endPoint=Object.assign({},t),this.updatePoints()},n.prototype.moveEndPoint=function(t,e){this.endPoint.x+=t,this.endPoint.y+=e,this.updatePoints()},n.prototype.updatePointsList=function(t,e){this.pointsList.forEach((function(n){n.x+=t,n.y+=e}));var n=this.pointsList[0];this.startPoint=Object.assign({},n);var r=this.pointsList[this.pointsList.length-1];this.endPoint=Object.assign({},r),this.initPoints()},n.prototype.dragAppendStart=function(){this.draggingPointList=this.pointsList.map((function(t){return t}))},n.prototype.dragAppendSimple=function(t,e){this.isDragging=!0;var n=t.start,r=t.end,o=t.startIndex,i=t.endIndex,a=t.direction,s=this.pointsList,u=s;return a===p_.HORIZONTAL?(s[o]={x:n.x,y:n.y+e.y},s[i]={x:r.x,y:r.y+e.y},u=this.pointsList.map((function(t){return t}))):a===p_.VERTICAL&&(s[o]={x:n.x+e.x,y:n.y},s[i]={x:r.x+e.x,y:r.y},u=this.pointsList.map((function(t){return t}))),this.updatePointsAfterDrag(u),this.draggingPointList=u,this.setText(Object.assign({},this.text,this.textPosition)),{start:Object.assign({},s[o]),end:Object.assign({},s[i]),startIndex:o,endIndex:i,direction:a}},n.prototype.dragAppend=function(t,e){this.isDragging=!0;var n=t.start,r=t.end,o=t.startIndex,i=t.endIndex,a=t.direction,s=this.pointsList;if(a===p_.HORIZONTAL){s[o]={x:n.x,y:n.y+e.y},s[i]={x:r.x,y:r.y+e.y};var u=this.pointsList.map((function(t){return t}));if(0!==o&&i!==this.pointsList.length-1&&(u=this.removeCrossPoints(o,i,u)),0===o){var l={x:n.x,y:n.y+e.y};if(!wm(l,this.sourceNode)){var c=this.sourceNode.anchors;u=this.getDraggingPoints(a,"start",l,c,u)}}if(i===this.pointsList.length-1){var p={x:r.x,y:r.y+e.y};if(!wm(p,this.targetNode)){c=this.targetNode.anchors;u=this.getDraggingPoints(a,"end",p,c,u)}}this.updatePointsAfterDrag(u),this.draggingPointList=u}else if(a===p_.VERTICAL){s[o]={x:n.x+e.x,y:n.y},s[i]={x:r.x+e.x,y:r.y};u=this.pointsList.map((function(t){return t}));if(0!==o&&i!==this.pointsList.length-1&&(u=this.removeCrossPoints(o,i,u)),0===o){l={x:n.x+e.x,y:n.y};if(!wm(l,this.sourceNode)){c=this.sourceNode.anchors;u=this.getDraggingPoints(a,"start",l,c,u)}}if(i===this.pointsList.length-1){p={x:r.x+e.x,y:r.y};if(!wm(p,this.targetNode)){c=this.targetNode.anchors;u=this.getDraggingPoints(a,"end",p,c,u)}}this.updatePointsAfterDrag(u),this.draggingPointList=u}return this.setText(Object.assign({},this.text,this.textPosition)),{start:Object.assign({},s[o]),end:Object.assign({},s[i]),startIndex:o,endIndex:i,direction:a}},n.prototype.dragAppendEnd=function(){if(this.draggingPointList){var t=B_(Y_(this.points));this.pointsList=t.map((function(t){return t})),this.draggingPointList=[];var e=t[0];this.startPoint=Object.assign({},e);var n=t[t.length-1];this.endPoint=Object.assign({},n)}this.isDragging=!1},n.prototype.updatePointsAfterDrag=function(t){var e=this.updateCrossPoints(t);this.points=e.map((function(t){return"".concat(t.x,",").concat(t.y)})).join(" ")},n.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},n.prototype.getAdjustEnd=function(){var t=this.pointsList;return t[t.length-1]||this.endPoint},n.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,n=t.endPoint,r=t.sourceNode,o=t.targetNode;this.pointsList=z_({x:e.x,y:e.y},{x:n.x,y:n.y},r,o,this.offset||0),this.initPoints()},oo([$],n.prototype,"dbClickPosition",void 0),oo([te],n.prototype,"initPoints",null),oo([te],n.prototype,"updatePoints",null),oo([te],n.prototype,"updateStartPoint",null),oo([te],n.prototype,"moveStartPoint",null),oo([te],n.prototype,"updateEndPoint",null),oo([te],n.prototype,"moveEndPoint",null),oo([te],n.prototype,"updatePointsList",null),oo([te],n.prototype,"dragAppendStart",null),oo([te],n.prototype,"dragAppendSimple",null),oo([te],n.prototype,"dragAppend",null),oo([te],n.prototype,"dragAppendEnd",null),oo([te],n.prototype,"updatePointsAfterDrag",null),oo([te],n.prototype,"getAdjustStart",null),oo([te],n.prototype,"getAdjustEnd",null),oo([te],n.prototype,"updateAfterAdjustStartAndEnd",null),n}(bb),Sb=function(){function e(e,n){this.BaseType=t.ElementType.NODE,this.id="",this.type="",this.x=0,this.y=0,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this.properties={},this._width=100,this._height=80,this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.anchorsOffset=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isShowAnchor=!1,this.isDragging=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.enableRotate=!0,this.enableResize=!0,this.zIndex=1,this.state=t.ElementState.DEFAULT,this.autoToFront=!0,this.style={},this._rotate=0,this.modelType=t.ModelType.NODE,this.additionStateData={},this.targetRules=[],this.sourceRules=[],this.moveRules=[],this.hasSetTargetRules=!1,this.hasSetSourceRules=!1,this.graphModel=n,this.properties=e.properties||{},this.initNodeData(e),this.setAttributes()}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t;var e=this.x,n=void 0===e?0:e,r=this.y,o=void 0===r?0:r;this.transform=new gm(-n,-o).rotate(t).translate(n,o).toString()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"incoming",{get:function(){return{nodes:this.graphModel.getNodeIncomingNode(this.id),edges:this.graphModel.getNodeIncomingEdge(this.id)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outgoing",{get:function(){return{nodes:this.graphModel.getNodeOutgoingNode(this.id),edges:this.graphModel.getNodeOutgoingEdge(this.id)}},enumerable:!1,configurable:!0}),e.prototype.initNodeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,n=e&&e(t.type),r=this.createId();t.id=r||n||nb()}this.formatText(t),js(this,Cm(t)),this.graphModel.overlapMode===c_.INCREASE&&(this.zIndex=t.zIndex||gb())},e.prototype.setAttributes=function(){},e.prototype.createId=function(){return null},e.prototype.formatText=function(t){var e,n,r,o=t.x,i=t.y,a=t.text,s={value:"",x:o,y:i,draggable:!1,editable:!0};a&&("string"==typeof a?s.value=a:(s=no(no({},s),{x:null!==(e=a.x)&&void 0!==e?e:o,y:null!==(n=a.y)&&void 0!==n?n:i,value:null!==(r=a.value)&&void 0!==r?r:""}),Mh(a.draggable)||(s.draggable=a.draggable),Mh(a.editable)||(s.draggable=a.draggable))),t.text=s},e.prototype.resize=function(t){var e=t.width,n=t.height,r=t.deltaX,o=t.deltaY;return this.move(r/2,o/2),this.width=e,this.height=n,this.setProperties({width:e,height:n}),this.getData()},e.prototype.proportionalResize=function(){},e.prototype.getData=function(){var t=this.text,e=t.x,n=t.y,r=t.value,o=this.properties;Se(o)&&(o=je(o));var i={id:this.id,type:this.type,x:this.x,y:this.y,properties:o};return this.rotate&&(i.rotate=this.rotate),this.graphModel.overlapMode===c_.INCREASE&&(i.zIndex=this.zIndex),r&&(i.text={x:e,y:n,value:r}),i},e.prototype.getHistoryData=function(){return this.getData()},e.prototype.getProperties=function(){return je(this.properties)},e.prototype.getOuterGAttributes=function(){return{className:""}},e.prototype.getNodeStyle=function(){return no(no({},this.graphModel.theme.baseNode),this.style)},e.prototype.getTextStyle=function(){return up(this.graphModel.theme.nodeText)},e.prototype.getRotateControlStyle=function(){return up(this.graphModel.theme.rotateControl)},e.prototype.getResizeControlStyle=function(){return up(this.graphModel.theme.resizeControl)},e.prototype.getResizeOutlineStyle=function(){return up(this.graphModel.theme.resizeOutline)},e.prototype.getAnchorStyle=function(t){return up(this.graphModel.theme.anchor)},e.prototype.getAnchorLineStyle=function(t){return up(this.graphModel.theme.anchorLine)},e.prototype.getOutlineStyle=function(){return up(this.graphModel.theme.outline)},e.prototype.isAllowConnectedAsSource=function(t,e,n,r){var o=this.hasSetSourceRules?this.sourceRules:this.getConnectedSourceRules();this.hasSetSourceRules=!0;for(var i=!0,a="",s=0;s<o.length;s++){var u=o[s];if(!u.validate.call(this,this,t,e,n,r)){i=!1,a=u.message;break}}return{isAllPass:i,msg:a}},e.prototype.getConnectedSourceRules=function(){return this.sourceRules},e.prototype.isAllowConnectedAsTarget=function(t,e,n,r){var o=this.hasSetTargetRules?this.targetRules:this.getConnectedTargetRules();this.hasSetTargetRules=!0;for(var i=!0,a="",s=0;s<o.length;s++){var u=o[s];if(!u.validate.call(this,t,this,e,n,r)){i=!1,a=u.message;break}}return{isAllPass:i,msg:a}},e.prototype.isAllowMoveNode=function(t,e){var n,r,o=!0,i=!0,a=this.moveRules.concat(this.graphModel.nodeMoveRules);try{for(var s=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(a),u=s.next();!u.done;u=s.next()){var l=(0,u.value)(this,t,e);if(!l)return!1;if("object"==typeof l){var c=l;if(!c.x&&!c.y)return!1;o=o&&c.x,i=i&&c.y}}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return{x:o,y:i}},e.prototype.getConnectedTargetRules=function(){return this.targetRules},e.prototype.getAnchorsByOffset=function(){var t=this,e=t.anchorsOffset,n=t.id,r=t.x,o=t.y;return e&&e.length>0?e.map((function(t,e){return t.length?{id:"".concat(n,"_").concat(e),x:r+t[0],y:o+t[1]}:no(no({},t),{x:r+t.x,y:o+t.y,id:t.id||"".concat(n,"_").concat(e)})})):this.getDefaultAnchor()},e.prototype.getDefaultAnchor=function(){return[]},e.prototype.getTargetAnchor=function(t){return Em(t,this)},e.prototype.getBounds=function(){return{x1:this.x-this.width/2,y1:this.y-this.height/2,x2:this.x+this.width/2,y2:this.y+this.height/2}},Object.defineProperty(e.prototype,"anchors",{get:function(){var t=this.getAnchorsByOffset(),e=this,n=e.x,r=e.y,o=e.rotate;return t.forEach((function(t){var e=t.x,i=t.y,a=io(new hm([e,i,1]).translate(-n,-r).rotate(o).translate(n,r)[0],2),s=a[0],u=a[1];t.x=s,t.y=u})),t},enumerable:!1,configurable:!0}),e.prototype.getAnchorInfo=function(t){if(!Eh(t))for(var e=0;e<this.anchors.length;e++){var n=this.anchors[e];if(n.id===t)return n}},e.prototype.addNodeMoveRules=function(t){this.moveRules.includes(t)||this.moveRules.push(t)},e.prototype.isAllowMoveByXORY=function(t,e,n){var r,o;if(n)r=!0,o=!0;else{var i=this.isAllowMoveNode(t,e);"boolean"==typeof i?(r=i,o=i):(r=i.x,o=i.y)}return{isAllowMoveX:r,isAllowMoveY:o}},e.prototype.move=function(t,e,n){void 0===n&&(n=!1);var r=this.isAllowMoveByXORY(t,e,n),o=r.isAllowMoveX,i=r.isAllowMoveY;return o&&(this.x=this.x+t,this.text&&this.moveText(t,0)),i&&(this.y=this.y+e,this.text&&this.moveText(0,e)),o||i},e.prototype.getMoveDistance=function(t,e,n){void 0===n&&(n=!1);var r=this.isAllowMoveByXORY(t,e,n),o=r.isAllowMoveX,i=r.isAllowMoveY,a=0,s=0;return o&&t&&(this.x=this.x+t,this.text&&this.moveText(t,0),a=t),i&&e&&(this.y=this.y+e,this.text&&this.moveText(0,e),s=e),[a,s]},e.prototype.moveTo=function(t,e,n){void 0===n&&(n=!1);var r=t-this.x,o=e-this.y;return!(!n&&!this.isAllowMoveNode(r,o))&&(this.text&&this.text&&this.moveText(r,o),this.x=t,this.y=e,!0)},e.prototype.moveText=function(t,e){var n=this.text,r=n.x,o=n.y,i=n.value,a=n.draggable,s=n.editable;this.text={value:i,editable:s,draggable:a,x:r+t,y:o+e}},e.prototype.updateText=function(t){this.text=no(no({},je(this.text)),{value:t})},e.prototype.setSelected=function(t){void 0===t&&(t=!0),this.isSelected=t},e.prototype.setHovered=function(t){void 0===t&&(t=!0),this.isHovered=t,this.setIsShowAnchor(t)},e.prototype.setIsShowAnchor=function(t){void 0===t&&(t=!0),this.isShowAnchor=t},e.prototype.setEnableRotate=function(t){void 0===t&&(t=!0),this.enableRotate=t},e.prototype.setEnableResize=function(t){void 0===t&&(t=!0),this.enableResize=t},e.prototype.setHitable=function(t){void 0===t&&(t=!0),this.isHitable=t},e.prototype.setHittable=function(t){void 0===t&&(t=!0),this.isHittable=t},e.prototype.setElementState=function(t,e){this.state=t,this.additionStateData=e},e.prototype.setProperty=function(e,n){var r,o=je(this.properties),i=no(no({},o),((r={})[e]=i_(n),r));this.properties=i,this.setAttributes(),this.graphModel.eventCenter.emit(t.EventType.NODE_PROPERTIES_CHANGE,{id:this.id,keys:[e],preProperties:o,properties:i})},e.prototype.setProperties=function(e){var n=je(this.properties),r=no(no({},n),i_(e));this.properties=r,this.setAttributes();var o=[];Rh(e,(function(t,e){(Lf(n,e)&&n[e]!==t||!Lf(n,e))&&o.push(e)})),this.graphModel.eventCenter.emit(t.EventType.NODE_PROPERTIES_CHANGE,{id:this.id,keys:o,preProperties:n,properties:r})},e.prototype.deleteProperty=function(t){delete this.properties[t],this.setAttributes()},e.prototype.setStyle=function(t,e){var n;this.style=no(no({},this.style),((n={})[t]=i_(e),n))},e.prototype.setStyles=function(t){this.style=no(no({},this.style),i_(t))},e.prototype.updateStyles=function(t){this.style=no({},i_(t))},e.prototype.setZIndex=function(t){void 0===t&&(t=1),this.zIndex=t},e.prototype.updateAttributes=function(t){js(this,t)},e.BaseType=t.ElementType.NODE,oo([$],e.prototype,"type",void 0),oo([$],e.prototype,"x",void 0),oo([$],e.prototype,"y",void 0),oo([$],e.prototype,"text",void 0),oo([$],e.prototype,"properties",void 0),oo([$],e.prototype,"_width",void 0),oo([$],e.prototype,"_height",void 0),oo([$],e.prototype,"anchorsOffset",void 0),oo([$],e.prototype,"isSelected",void 0),oo([$],e.prototype,"isHovered",void 0),oo([$],e.prototype,"isShowAnchor",void 0),oo([$],e.prototype,"isDragging",void 0),oo([$],e.prototype,"isHitable",void 0),oo([$],e.prototype,"isHittable",void 0),oo([$],e.prototype,"draggable",void 0),oo([$],e.prototype,"visible",void 0),oo([$],e.prototype,"enableRotate",void 0),oo([$],e.prototype,"enableResize",void 0),oo([$],e.prototype,"zIndex",void 0),oo([$],e.prototype,"state",void 0),oo([$],e.prototype,"autoToFront",void 0),oo([$],e.prototype,"style",void 0),oo([$],e.prototype,"transform",void 0),oo([$],e.prototype,"_rotate",void 0),oo([rt],e.prototype,"incoming",null),oo([rt],e.prototype,"outgoing",null),oo([te],e.prototype,"addNodeMoveRules",null),oo([te],e.prototype,"move",null),oo([te],e.prototype,"getMoveDistance",null),oo([te],e.prototype,"moveTo",null),oo([te],e.prototype,"moveText",null),oo([te],e.prototype,"updateText",null),oo([te],e.prototype,"setSelected",null),oo([te],e.prototype,"setHovered",null),oo([te],e.prototype,"setIsShowAnchor",null),oo([te],e.prototype,"setEnableRotate",null),oo([te],e.prototype,"setEnableResize",null),oo([te],e.prototype,"setHitable",null),oo([te],e.prototype,"setHittable",null),oo([te],e.prototype,"setElementState",null),oo([te],e.prototype,"setProperty",null),oo([te],e.prototype,"setProperties",null),oo([te],e.prototype,"deleteProperty",null),oo([te],e.prototype,"setStyle",null),oo([te],e.prototype,"setStyles",null),oo([te],e.prototype,"updateStyles",null),oo([te],e.prototype,"setZIndex",null),oo([te],e.prototype,"updateAttributes",null),e}(),Mb=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.CIRCLE_NODE,o.properties={},o.r=50,o.properties=n.properties||{},o.setAttributes(),o}return eo(n,e),Object.defineProperty(n.prototype,"width",{get:function(){return 2*this.r},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return 2*this.r},enumerable:!1,configurable:!0}),n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this);var t=this.properties.r;t&&(this.r=t)},n.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this),n=this.graphModel.theme.circle,r=this.properties.style,o=void 0===r?{}:r;return no(no(no({},t),up(n)),up(o))},n.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,r=t.r;return[{x:e,y:n-r,id:"".concat(this.id,"_0")},{x:e+r,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+r,id:"".concat(this.id,"_2")},{x:e-r,y:n,id:"".concat(this.id,"_3")}]},n.prototype.resize=function(t){var e=t.width,n=t.deltaX,r=t.deltaY;return this.move(n/2,r/2),this.r=e,this.setProperties({r:e}),this.getData()},oo([$],n.prototype,"properties",void 0),oo([$],n.prototype,"r",void 0),oo([rt],n.prototype,"width",null),oo([rt],n.prototype,"height",null),n}(Sb),Ab=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.DIAMOND_NODE,o.rx=30,o.ry=50,o.properties={},o.properties=n.properties||{},o.setAttributes(),o}return eo(n,e),n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this);var t=this.properties,n=t.rx,r=t.ry;n&&(this.rx=n),r&&(this.ry=r)},n.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this),n=this.graphModel.theme.diamond,r=this.properties.style,o=void 0===r?{}:r;return no(no(no({},t),up(n)),up(o))},Object.defineProperty(n.prototype,"points",{get:function(){var t=this,e=t.x,n=t.y,r=t.rx,o=t.ry;return[[e,n-o],[e+r,n],[e,n+o],[e-r,n]]},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pointsPosition",{get:function(){return wf(this.points,(function(t){var e=io(t,2);return{x:e[0],y:e[1]}}))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"width",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return Yd(this.points,(function(n){var r=io(n,1)[0];r<t&&(t=r),r>e&&(e=r)})),e-t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return Yd(this.points,(function(n){var r=io(n,2)[1];r<t&&(t=r),r>e&&(e=r)})),e-t},enumerable:!1,configurable:!0}),n.prototype.getDefaultAnchor=function(){var t=this;return wf(this.points,(function(e,n){var r=io(e,2);return{x:r[0],y:r[1],id:"".concat(t.id,"_").concat(n)}}))},n.prototype.resize=function(t){var e=t.width,n=t.height,r=t.deltaX,o=t.deltaY;return this.move(r/2,o/2),this.rx=e,this.ry=n,this.setProperties({rx:e,ry:n}),this.getData()},oo([$],n.prototype,"rx",void 0),oo([$],n.prototype,"ry",void 0),oo([$],n.prototype,"properties",void 0),oo([rt],n.prototype,"points",null),oo([rt],n.prototype,"pointsPosition",null),oo([rt],n.prototype,"width",null),oo([rt],n.prototype,"height",null),n}(Sb),Tb=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.ELLIPSE_NODE,o.rx=30,o.ry=45,o.properties={},o.properties=n.properties||{},o.setAttributes(),o}return eo(n,e),n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this);var t=this.properties,n=t.rx,r=t.ry;n&&(this.rx=n),r&&(this.ry=r)},n.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this),n=this.graphModel.theme.ellipse,r=this.properties.style,o=void 0===r?{}:r;return no(no(no({},t),up(n)),up(o))},Object.defineProperty(n.prototype,"width",{get:function(){return 2*this.rx},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return 2*this.ry},enumerable:!1,configurable:!0}),n.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,r=t.rx,o=t.ry;return[{x:e,y:n-o,id:"".concat(this.id,"_0")},{x:e+r,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+o,id:"".concat(this.id,"_2")},{x:e-r,y:n,id:"".concat(this.id,"_3")}]},n.prototype.resize=function(t){var e=t.width,n=t.height,r=t.deltaX,o=t.deltaY;return this.move(r/2,o/2),this.rx=e,this.ry=n,this.setProperties({rx:e,ry:n}),this.getData()},oo([$],n.prototype,"rx",void 0),oo([$],n.prototype,"ry",void 0),oo([$],n.prototype,"properties",void 0),oo([rt],n.prototype,"width",null),oo([rt],n.prototype,"height",null),n}(Sb),Ob=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.POLYGON_NODE,o.points=[[50,0],[100,50],[50,100],[0,50]],o.properties={},o.properties=n.properties||{},o.setAttributes(),o}return eo(n,e),n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this);var t=this.properties,n=t.points,r=t.width,o=t.height,i=n||this.points;this.points=sm(i,r,o)},n.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this),n=this.graphModel.theme.polygon,r=this.properties.style,o=void 0===r?{}:r;return no(no(no({},t),up(n)),up(o))},Object.defineProperty(n.prototype,"pointsPosition",{get:function(){var t=this,e=t.x,n=t.y,r=t.width,o=t.height;return this.points.map((function(t){return{x:t[0]+e-r/2,y:t[1]+n-o/2}}))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"width",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return this.points.forEach((function(n){var r=io(n,1)[0];r<t&&(t=r),r>e&&(e=r)})),e-t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return this.points.forEach((function(n){var r=io(n,2)[1];r<t&&(t=r),r>e&&(e=r)})),e-t},enumerable:!1,configurable:!0}),n.prototype.getDefaultAnchor=function(){var t=this,e=this,n=e.x,r=e.y,o=e.width,i=e.height;return e.points.map((function(e,a){var s=io(e,2),u=s[0],l=s[1];return{x:n+u-o/2,y:r+l-i/2,id:"".concat(t.id,"_").concat(a)}}))},n.prototype.resize=function(t){var e=this,n=t.width,r=t.height,o=t.deltaX,i=t.deltaY;this.move(o/2,i/2);var a=wf(this.points,(function(t){var o=io(t,2),i=o[0],a=o[1];return[i*n/e.width,a*r/e.height]}));return this.points=a,this.properties.points=a,this.getData()},oo([$],n.prototype,"points",void 0),oo([$],n.prototype,"properties",void 0),oo([rt],n.prototype,"pointsPosition",null),oo([rt],n.prototype,"width",null),oo([rt],n.prototype,"height",null),n}(Sb),Nb=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.RECT_NODE,o.radius=0,o.properties={},o.properties=n.properties||{},o.setAttributes(),o}return eo(n,e),n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this);var t=this.properties,n=t.width,r=t.height,o=t.radius;n&&(this.width=n),r&&(this.height=r),o&&(this.radius=o)},n.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,r=t.width,o=t.height;return[{x:e,y:n-o/2,id:"".concat(this.id,"_0")},{x:e+r/2,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+o/2,id:"".concat(this.id,"_2")},{x:e-r/2,y:n,id:"".concat(this.id,"_3")}]},n.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this),n=this.graphModel.theme.rect,r=this.properties.style,o=void 0===r?{}:r;return no(no(no({},t),up(n)),up(o))},oo([$],n.prototype,"radius",void 0),oo([$],n.prototype,"properties",void 0),n}(Sb),Db=function(e){function n(){var n=e.apply(this,ao([],io(arguments),!1))||this;return n.modelType=t.ModelType.TEXT_NODE,n}return eo(n,e),n.prototype.getTextStyle=function(){var t=e.prototype.getTextStyle.call(this),n=this.graphModel.theme.text;return no(no({},t),up(n))},Object.defineProperty(n.prototype,"width",{get:function(){var t=String(this.text.value).split(/[\r\n]/g),e=this.getTextStyle().fontSize;return km({rows:t,fontSize:e,rowsLength:t.length}).width},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){var t=String(this.text.value).split(/[\r\n]/g),e=this.getTextStyle().fontSize;return km({rows:t,fontSize:e,rowsLength:t.length}).height},enumerable:!1,configurable:!0}),oo([rt],n.prototype,"width",null),oo([rt],n.prototype,"height",null),n}(Sb),Pb=function(e){function n(n,r){var o=e.call(this,n,r)||this;return o.modelType=t.ModelType.HTML_NODE,o.properties={},o.properties=n.properties||{},o.setAttributes(),o}return eo(n,e),n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this);var t=this.properties,n=t.width,r=t.height;n&&(this.width=n),r&&(this.height=r)},n.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,r=t.width,o=t.height;return[{x:e,y:n-o/2,id:"".concat(this.id,"_0")},{x:e+r/2,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+o/2,id:"".concat(this.id,"_2")},{x:e-r/2,y:n,id:"".concat(this.id,"_3")}]},oo([$],n.prototype,"properties",void 0),n}(Sb),Cb={stopZoomGraph:!1,stopScrollGraph:!1,stopMoveGraph:!1,adjustEdge:!1,adjustEdgeStartAndEnd:!1,adjustNodePosition:!1,hideAnchors:!0,allowRotate:!1,allowResize:!1,nodeSelectedOutline:!0,nodeTextEdit:!1,edgeTextEdit:!1,nodeTextDraggable:!1,edgeTextDraggable:!1},Ib=["isSilentMode","stopZoomGraph","stopScrollGraph","stopMoveGraph","adjustEdge","adjustEdgeMiddle","adjustEdgeStartAndEnd","adjustNodePosition","hideAnchors","allowRotate","allowResize","hoverOutline","nodeSelectedOutline","edgeSelectedOutline","nodeTextEdit","edgeTextEdit","nodeTextDraggable","edgeTextDraggable","multipleSelectKey","autoExpand"],jb=function(){function t(t){this.isSilentMode=!1,this.stopZoomGraph=!1,this.stopScrollGraph=!1,this.stopMoveGraph=!1,this.adjustEdge=!0,this.adjustEdgeMiddle=!1,this.adjustEdgeStartAndEnd=!1,this.adjustNodePosition=!0,this.hideAnchors=!1,this.allowRotate=!1,this.allowResize=!1,this.hoverOutline=!0,this.nodeSelectedOutline=!0,this.edgeSelectedOutline=!0,this.nodeTextEdit=!0,this.edgeTextEdit=!0,this.nodeTextDraggable=!1,this.edgeTextDraggable=!1,this.autoExpand=!1,this.multipleSelectKey="",this.defaultConfig={},js(this,this.getConfigDetail(t))}return t.prototype.updateEditConfig=function(t){var e=this.getConfigDetail(t);js(this,e)},t.prototype.getConfigDetail=function(t){var e=t.isSilentMode,n=t.textEdit,r={};if(!1===e&&js(r,this.defaultConfig),!0===e&&e!==this.isSilentMode){var o=Hy(Cb,Ib);this.defaultConfig={stopZoomGraph:this.stopZoomGraph,stopScrollGraph:this.stopScrollGraph,stopMoveGraph:this.stopMoveGraph,adjustEdge:this.adjustEdge,adjustEdgeMiddle:this.adjustEdgeMiddle,adjustEdgeStartAndEnd:this.adjustEdgeStartAndEnd,adjustNodePosition:this.adjustNodePosition,hideAnchors:this.hideAnchors,allowRotate:this.allowRotate,allowResize:this.allowResize,hoverOutline:this.hoverOutline,nodeSelectedOutline:this.nodeSelectedOutline,edgeSelectedOutline:this.edgeSelectedOutline,nodeTextEdit:this.nodeTextEdit,edgeTextEdit:this.edgeTextEdit,nodeTextDraggable:this.nodeTextDraggable,edgeTextDraggable:this.edgeTextDraggable,autoExpand:this.autoExpand},js(r,o)}!1===n&&js(r,{nodeTextEdit:!1,edgeTextEdit:!1});var i=Hy(t,Ib);return js(r,i)},t.prototype.getConfig=function(){return Hy(this,Ib)},oo([$],t.prototype,"isSilentMode",void 0),oo([$],t.prototype,"stopZoomGraph",void 0),oo([$],t.prototype,"stopScrollGraph",void 0),oo([$],t.prototype,"stopMoveGraph",void 0),oo([$],t.prototype,"adjustEdge",void 0),oo([$],t.prototype,"adjustEdgeMiddle",void 0),oo([$],t.prototype,"adjustEdgeStartAndEnd",void 0),oo([$],t.prototype,"adjustNodePosition",void 0),oo([$],t.prototype,"hideAnchors",void 0),oo([$],t.prototype,"allowRotate",void 0),oo([$],t.prototype,"allowResize",void 0),oo([$],t.prototype,"hoverOutline",void 0),oo([$],t.prototype,"nodeSelectedOutline",void 0),oo([$],t.prototype,"edgeSelectedOutline",void 0),oo([$],t.prototype,"nodeTextEdit",void 0),oo([$],t.prototype,"edgeTextEdit",void 0),oo([$],t.prototype,"nodeTextDraggable",void 0),oo([$],t.prototype,"edgeTextDraggable",void 0),oo([$],t.prototype,"autoExpand",void 0),oo([te],t.prototype,"updateEditConfig",null),t}(),kb=function(){function t(){this._events={}}return t.prototype.on=function(t,e,n){var r=this;null==t||t.split(",").forEach((function(t){t=t.trim(),r._events[t]||(r._events[t]=[]),r._events[t].push({callback:e,once:!!n})}))},t.prototype.once=function(t,e){var n=this;null==t||t.split(",").forEach((function(t){t=t.trim(),n.on(t,e,!0)}))},t.prototype.emit=function(t,e){var n=this;null==t||t.split(",").forEach((function(t){var r=n._events[t]||[],o=n._events["*"]||[],i=function(r){for(var o=r.length,i=0;i<o;i++)if(r[i]){var a=r[i],s=a.callback;a.once&&(r.splice(i,1),0===r.length&&delete n._events[t],o--,i--),s.apply(n,[e])}};i(r),i(o)}))},t.prototype.off=function(t,e){var n=this;t||(this._events={}),t.split(",").forEach((function(t){if(e){for(var r=n._events[t]||[],o=r.length,i=0;i<o;i++)r[i].callback===e&&(r.splice(i,1),o--,i--);0===r.length&&delete n._events[t]}else delete n._events[t]}))},t.prototype.getEvents=function(){return this._events},t}(),Rb=function(){function e(t){this.modelMap=new Map,this.nodeMoveRules=[],this.nodes=[],this.edges=[],this.overlapMode=c_.DEFAULT,this.gridSize=1,this.partial=!1;var e=t.container,n=t.partial,r=t.background,o=void 0===r?{}:r,i=t.grid,a=t.idGenerator,s=t.edgeGenerator,u=t.animation,l=t.customTrajectory;this.rootEl=e,this.partial=!!n,this.background=o,"object"==typeof i&&(this.gridSize=i.size||1),this.theme=fb(t.style),this.edgeType=t.edgeType||"polyline",this.animation=n_(u),this.overlapMode=t.overlapMode||c_.DEFAULT,this.width=t.width||this.rootEl.getBoundingClientRect().width,this.height=t.height||this.rootEl.getBoundingClientRect().height,this.eventCenter=new kb,this.editConfigModel=new jb(t),this.transformModel=new zb(this.eventCenter,t),this.flowId=nb(),this.idGenerator=a,this.edgeGenerator=om(this,s),this.customTrajectory=l}return Object.defineProperty(e.prototype,"nodesMap",{get:function(){return this.nodes.reduce((function(t,e,n){return t[e.id]={index:n,model:e},t}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"edgesMap",{get:function(){return this.edges.reduce((function(t,e,n){return t[e.id]={index:n,model:e},t}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"modelsMap",{get:function(){return ao(ao([],io(this.nodes),!1),io(this.edges),!1).reduce((function(t,e){return t[e.id]=e,t}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sortElements",{get:function(){for(var t=ao(ao([],io(this.nodes),!1),io(this.edges),!1).sort((function(t,e){return t.zIndex-e.zIndex})),e=[],n=[-200,-200],r=[this.width+d_,this.height+d_],o=0;o<t.length;o++){var i=t[o];i.visible&&(!this.partial||i.isSelected||this.isElementInArea(i,n,r,!1,!1))&&e.push(i)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textEditElement",{get:function(){var e=this.nodes.find((function(e){return e.state===t.ElementState.TEXT_EDIT})),n=this.edges.find((function(e){return e.state===t.ElementState.TEXT_EDIT}));return e||n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selectElements",{get:function(){var t=new Map;return this.nodes.forEach((function(e){e.isSelected&&t.set(e.id,e)})),this.edges.forEach((function(e){e.isSelected&&t.set(e.id,e)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selectNodes",{get:function(){var t=[];return this.nodes.forEach((function(e){e.isSelected&&t.push(e)})),t},enumerable:!1,configurable:!0}),e.prototype.getAreaElement=function(t,e,n,r,o){var i=this;void 0===n&&(n=!0),void 0===r&&(r=!0),void 0===o&&(o=!1);var a=[];return Yd(ao(ao([],io(this.nodes),!1),io(this.edges),!1),(function(s){var u=i.isElementInArea(s,t,e,n,r);o&&!s.visible||!u||a.push(s)})),a},e.prototype.getModel=function(t){return this.modelMap.get(t)},e.prototype.getNodeModelById=function(t){var e;return this.fakeNode&&t===this.fakeNode.id?this.fakeNode:null===(e=this.nodesMap[t])||void 0===e?void 0:e.model},e.prototype.getPointByClient=function(t){var e=t.x,n=t.y,r=this.rootEl.getBoundingClientRect(),o={x:e-r.left,y:n-r.top},i=io(this.transformModel.HtmlPointToCanvasPoint([o.x,o.y]),2);return{domOverlayPosition:o,canvasOverlayPosition:{x:i[0],y:i[1]}}},e.prototype.isElementInArea=function(e,n,r,o,i){var a;if(void 0===o&&(o=!0),void 0===i&&(i=!0),e.BaseType===t.ElementType.NODE){for(var s=Mm(e),u=s.minX,l=s.minY,c=s.maxX,p=s.maxY,d=[{x:u,y:l},{x:c,y:l},{x:c,y:p},{x:u,y:p}],f=i,h=0;h<d.length;h++){var y=d[h],v=y.x,g=y.y;if(v=(a=io(this.transformModel.CanvasPointToHtmlPoint([v,g]),2))[0],g=a[1],um([v,g],n,r)!==i){f=!i;break}}return f}if(e.BaseType===t.ElementType.EDGE){var _=e.startPoint,m=e.endPoint,b=this.transformModel.CanvasPointToHtmlPoint([_.x,_.y]),E=this.transformModel.CanvasPointToHtmlPoint([m.x,m.y]),x=um(b,n,r),w=um(E,n,r);return o?x&&w:x||w}return!1},e.prototype.graphDataToModel=function(t){var e=this;if(this.width&&this.height||this.resize(),!t)return this.nodes=[],void(this.edges=[]);if(t.nodes?this.nodes=wf(t.nodes,(function(t){return e.getModelAfterSnapToGrid(t)})):this.nodes=[],t.edges){var n=this.edgeType;this.edges=wf(t.edges,(function(t){var r,o=e.getModel(null!==(r=t.type)&&void 0!==r?r:n);if(!o)throw new Error("找不到".concat(t.type,"对应的边。"));return new o(t,e)}))}else this.edges=[]},e.prototype.modelToGraphData=function(){var t=[];this.edges.forEach((function(e){var n=e.getData();n&&!e.virtual&&t.push(n)}));var e=[];return this.nodes.forEach((function(t){var n=t.getData();n&&!t.virtual&&e.push(n)})),{nodes:e,edges:t}},e.prototype.modelToHistoryData=function(){for(var t=!1,e=[],n=0;n<this.nodes.length;n++){var r=this.nodes[n];if(r.isDragging){t=!0;break}e.push(r.getHistoryData())}if(t)return!1;for(var o=!1,i=[],a=0;a<this.edges.length;a++){var s=this.edges[a];if(s.isDragging){o=!0;break}i.push(s.getHistoryData())}return!o&&{nodes:e,edges:i}},e.prototype.getEdgeModelById=function(t){var e;return null===(e=this.edgesMap[t])||void 0===e?void 0:e.model},e.prototype.getElement=function(t){return this.modelsMap[t]},e.prototype.getNodeEdges=function(t){for(var e=[],n=0;n<this.edges.length;n++){var r=this.edges[n],o=r.sourceNodeId===t,i=r.targetNodeId===t;(o||i)&&e.push(r)}return e},e.prototype.getSelectElements=function(e){void 0===e&&(e=!0);var n=this.selectElements,r={nodes:[],edges:[]};return n.forEach((function(o){if(o.BaseType===t.ElementType.NODE&&r.nodes.push(o.getData()),o.BaseType===t.ElementType.EDGE){var i=o.getData(),a=n.get(i.sourceNodeId)&&n.get(i.targetNodeId);(e||a)&&r.edges.push(i)}})),r},e.prototype.updateAttributes=function(t,e){var n=this.getElement(t);null==n||n.updateAttributes(e)},e.prototype.changeNodeId=function(t,e){return e||(e=nb()),this.nodesMap[e]?(console.warn("当前流程图已存在节点".concat(e,", 修改失败")),""):this.nodesMap[t]?(this.edges.forEach((function(n){n.sourceNodeId===t&&(n.sourceNodeId=e),n.targetNodeId===t&&(n.targetNodeId=e)})),this.nodesMap[t].model.id=e,this.nodesMap[e]=this.nodesMap[t],e):(console.warn("当前流程图找不到节点".concat(t,", 修改失败")),"")},e.prototype.changeEdgeId=function(t,e){return e||(e=nb()),this.edgesMap[e]?(console.warn("当前流程图已存在边: ".concat(e,", 修改失败")),""):this.edgesMap[t]?(this.edges.forEach((function(n){n.id===t&&n.changeEdgeId(e)})),e):(console.warn("当前流程图找不到边: ".concat(e,", 修改失败")),"")},e.prototype.setFakeNode=function(t){this.fakeNode=t},e.prototype.removeFakeNode=function(){this.fakeNode=null},e.prototype.setModel=function(t,e){return this.modelMap.set(t,e)},e.prototype.toFront=function(t){var e,n,r,o=(null===(e=this.nodesMap[t])||void 0===e?void 0:e.model)||(null===(n=this.edgesMap[t])||void 0===n?void 0:n.model);o&&(this.overlapMode===c_.DEFAULT&&(null===(r=this.topElement)||void 0===r||r.setZIndex(),o.setZIndex(9999),this.topElement=o),this.overlapMode===c_.INCREASE&&this.setElementZIndex(t,"top"))},e.prototype.setElementZIndex=function(t,e){var n,r,o=(null===(n=this.nodesMap[t])||void 0===n?void 0:n.model)||(null===(r=this.edgesMap[t])||void 0===r?void 0:r.model);if(o){var i=void 0;"number"==typeof e?i=e:("top"===e&&(i=gb()),"bottom"===e&&(i=_b())),o.setZIndex(i)}},e.prototype.deleteNode=function(e){var n=this.nodesMap[e].model.getData();this.deleteEdgeBySource(e),this.deleteEdgeByTarget(e),this.nodes.splice(this.nodesMap[e].index,1),this.eventCenter.emit(t.EventType.NODE_DELETE,{data:n})},e.prototype.addNode=function(e,n,r){void 0===n&&(n=t.EventType.NODE_ADD);var o=i_(e),i=o.id;i&&this.nodesMap[i]&&delete o.id;var a=this.getModelAfterSnapToGrid(o);this.nodes.push(a);var s={data:a.getData()};return r&&(s.e=r),this.eventCenter.emit(n,s),a},e.prototype.getModelAfterSnapToGrid=function(t){var e=this.getModel(t.type);if(!e)throw new Error("找不到".concat(t.type,"对应的节点,请确认是否已注册此类型节点。"));var n=t.x,r=t.y;return n&&r&&(t.x=am(n,this.gridSize),t.y=am(r,this.gridSize),"object"==typeof t.text&&(t.text.x+=t.x-n,t.text.y+=t.y-r)),new e(t,this)},e.prototype.cloneNode=function(t){var e=this.getNodeModelById(t),n=null==e?void 0:e.getData();if(n){n.x+=30,n.y+=30,n.id="",n.text&&(n.text.x+=30,n.text.y+=30);var r=this.addNode(n);return r.setSelected(!0),null==e||e.setSelected(!1),r.getData()}},e.prototype.moveNode=function(t,e,n,r){var o;void 0===r&&(r=!1);var i=this.nodesMap[t];i?(e=(o=io(i.model.getMoveDistance(e,n,r),2))[0],n=o[1],this.moveEdge(t,e,n)):console.warn("不存在id为".concat(t,"的节点"))},e.prototype.moveNode2Coordinate=function(t,e,n,r){void 0===r&&(r=!1);var o=this.nodesMap[t];if(o){var i=o.model,a=e-i.x,s=n-i.y;this.moveNode(t,a,s,r)}else console.warn("不存在id为".concat(t,"的节点"))},e.prototype.editText=function(e){this.setElementStateById(e,t.ElementState.TEXT_EDIT)},e.prototype.addEdge=function(e){var n=i_(e),r=n.type;r||(r=this.edgeType),n.id&&this.edgesMap[n.id]&&delete n.id;var o=this.getModel(r);if(!o)throw new Error("找不到".concat(r,"对应的边,请确认是否已注册此类型边。"));var i=new o(no(no({},n),{type:r}),this),a=i.getData();return this.edges.push(i),this.eventCenter.emit(t.EventType.EDGE_ADD,{data:a}),i},e.prototype.moveEdge=function(t,e,n){for(var r=0;r<this.edges.length;r++){var o=this.edges[r],i=o.textPosition,a=i.x,s=i.y,u=this.edges[r].sourceNodeId===t,l=this.edges[r].targetNodeId===t;u&&o.moveStartPoint(e,n),l&&o.moveEndPoint(e,n),(u||l)&&this.handleEdgeTextMove(o,a,s)}},e.prototype.handleEdgeTextMove=function(e,n,r){var o;if(e.customTextPosition)e.resetTextPosition();else if(e.modelType===t.ModelType.POLYLINE_EDGE&&(null===(o=e.text)||void 0===o?void 0:o.value)){var i=e.text,a=em(i,e.points);e.moveText(a.x-i.x,a.y-i.y)}else{var s=e.textPosition,u=s.x,l=s.y;e.moveText(u-n,l-r)}},e.prototype.deleteEdgeBySourceAndTarget=function(e,n){for(var r=0;r<this.edges.length;r++)if(this.edges[r].sourceNodeId===e&&this.edges[r].targetNodeId===n){var o=this.edges[r].getData();this.edges.splice(r,1),r--,this.eventCenter.emit(t.EventType.EDGE_DELETE,{data:o})}},e.prototype.deleteEdgeById=function(e){if(this.edgesMap[e]){var n=this.edgesMap[e].index,r=this.edgesMap[e].model.getData();this.edges.splice(n,1),this.eventCenter.emit(t.EventType.EDGE_DELETE,{data:r})}},e.prototype.deleteEdgeBySource=function(e){for(var n=0;n<this.edges.length;n++)if(this.edges[n].sourceNodeId===e){var r=this.edges[n].getData();this.edges.splice(n,1),n--,this.eventCenter.emit(t.EventType.EDGE_DELETE,{data:r})}},e.prototype.deleteEdgeByTarget=function(e){for(var n=0;n<this.edges.length;n++)if(this.edges[n].targetNodeId===e){var r=this.edges[n].getData();this.edges.splice(n,1),n--,this.eventCenter.emit(t.EventType.EDGE_DELETE,{data:r})}},e.prototype.setElementStateById=function(e,n,r){this.nodes.forEach((function(o){o.id===e?o.setElementState(n,r):o.setElementState(t.ElementState.DEFAULT)})),this.edges.forEach((function(o){o.id===e?o.setElementState(n,r):o.setElementState(t.ElementState.DEFAULT)}))},e.prototype.updateText=function(t,e){var n=yf(ao(ao([],io(this.nodes),!1),io(this.edges),!1),(function(e){return e.id===t}));null==n||n.updateText(e)},e.prototype.selectNodeById=function(t,e){var n;void 0===e&&(e=!1),e||this.clearSelectElements();var r=null===(n=this.nodesMap[t])||void 0===n?void 0:n.model;null==r||r.setSelected(!0)},e.prototype.selectEdgeById=function(t,e){var n;void 0===e&&(e=!1),e||this.clearSelectElements();var r=null===(n=this.edgesMap[t])||void 0===n?void 0:n.model;null==r||r.setSelected(!0)},e.prototype.selectElementById=function(t,e){void 0===e&&(e=!1),e||this.clearSelectElements();var n=this.getElement(t);null==n||n.setSelected(!0)},e.prototype.clearSelectElements=function(){var t;this.selectElements.forEach((function(t){null==t||t.setSelected(!1)})),this.selectElements.clear(),this.overlapMode===c_.DEFAULT&&(null===(t=this.topElement)||void 0===t||t.setZIndex())},e.prototype.moveNodes=function(e,n,r,o){var i,a,s,u=this;void 0===o&&(o=!1);for(var l=e.reduce((function(t,e){var i=u.nodesMap[e].model;return t[e]=i.getMoveDistance(n,r,o),t}),{}),c=0;c<this.edges.length;c++){var p=this.edges[c],d=p.textPosition,f=d.x,h=d.y,y=l[p.sourceNodeId],v=l[p.targetNodeId],g=void 0,_=void 0;y&&v&&p.modelType===t.ModelType.POLYLINE_EDGE?(g=(i=io(y,2))[0],_=i[1],p.updatePointsList(g,_)):(y&&(g=(a=io(y,2))[0],_=a[1],p.moveStartPoint(g,_)),v&&(g=(s=io(v,2))[0],_=s[1],p.moveEndPoint(g,_))),(y||v)&&this.handleEdgeTextMove(p,f,h)}},e.prototype.addNodeMoveRules=function(t){this.nodeMoveRules.includes(t)||this.nodeMoveRules.push(t)},e.prototype.setDefaultEdgeType=function(t){this.edgeType=t},e.prototype.changeNodeType=function(t,e){var n=this.getNodeModelById(t);if(n){var r=n.getData();r.type=e;var o=this.getModel(e);if(!o)throw new Error("找不到".concat(e,"对应的节点,请确认是否已注册此类型节点。"));var i=new o(r,this);this.nodes.splice(this.nodesMap[t].index,1,i),this.getNodeEdges(t).forEach((function(e){if(e.sourceNodeId===t){var n=Im(i,e.startPoint,i.width,i.height);e.updateStartPoint(n)}if(e.targetNodeId===t){n=Im(i,e.endPoint,i.width,i.height);e.updateEndPoint(n)}}))}else console.warn("找不到id为".concat(t,"的节点"))},e.prototype.changeEdgeType=function(t,e){var n=this.getEdgeModelById(t);if(n){if(n.type!==e){var r=n.getData();r.type=e;var o=this.getModel(e);if(!o)throw new Error("找不到".concat(e,"对应的节点,请确认是否已注册此类型节点。"));delete r.pointsList;var i=new o(r,this);this.edges.splice(this.edgesMap[t].index,1,i)}}else console.warn("找不到id为".concat(t,"的边"))},e.prototype.getNodeIncomingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.targetNodeId===t&&e.push(n)})),e},e.prototype.getNodeOutgoingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.sourceNodeId===t&&e.push(n)})),e},e.prototype.getAnchorIncomingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.targetAnchorId===t&&e.push(n)})),e},e.prototype.getAnchorOutcomingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.sourceAnchorId===t&&e.push(n)})),e},e.prototype.getNodeIncomingNode=function(t){var e=this,n=[];return this.edges.forEach((function(r){var o;r.targetNodeId===t&&n.push(null===(o=e.nodesMap[r.sourceNodeId])||void 0===o?void 0:o.model)})),n},e.prototype.getNodeOutgoingNode=function(t){var e=this,n=[];return this.edges.forEach((function(r){r.sourceNodeId===t&&n.push(e.nodesMap[r.targetNodeId].model)})),n},e.prototype.setTheme=function(t){this.theme=hb(no(no({},this.theme),t))},e.prototype.resize=function(t,e){this.width=t||this.rootEl.getBoundingClientRect().width,this.height=e||this.rootEl.getBoundingClientRect().height,this.width&&this.height||console.warn("渲染画布的时候无法获取画布宽高,请确认在container已挂载到DOM。@see https://github.com/didi/LogicFlow/issues/675")},e.prototype.clearData=function(){this.nodes=[],this.edges=[]},e.prototype.getVirtualRectSize=function(){var t=this.nodes,e=[],n=[];t.forEach((function(t){var r=t.x,o=t.y,i=t.width,a=t.height,s=t.getNodeStyle().strokeWidth,u=void 0===s?0:s,l=r+i/2+u,c=r-i/2-u,p=o+a/2+u,d=o-a/2-u;e=e.concat([l,c].filter((function(t){return!Number.isNaN(t)}))),n=n.concat([p,d].filter((function(t){return!Number.isNaN(t)})))}));var r=Math.min.apply(Math,ao([],io(e),!1)),o=Math.max.apply(Math,ao([],io(e),!1)),i=Math.min.apply(Math,ao([],io(n),!1)),a=o-r||0,s=Math.max.apply(Math,ao([],io(n),!1))-i||0;return{width:a,height:s,x:r+a/2,y:i+s/2}},e.prototype.translateCenter=function(){var t=this,e=t.nodes,n=t.width,r=t.height,o=t.rootEl,i=t.transformModel;if(e.length){var a=n||o.clientWidth,s=r||o.clientHeight,u=this.getVirtualRectSize(),l=u.x,c=u.y;i.focusOn(l,c,a,s)}},e.prototype.fitView=function(t,e){void 0===t&&(t=20),void 0===e&&(e=20);var n=this,r=n.nodes,o=n.width,i=n.height,a=n.rootEl,s=n.transformModel;if(r.length){var u=o||a.clientWidth,l=i||a.clientHeight,c=this.getVirtualRectSize(),p=c.width,d=c.height,f=c.x,h=c.y,y=(p+e)/u,v=(d+t)/l,g=1/Math.max(y,v),_=[u/2,l/2];s.zoom(g,_),s.focusOn(f,h,u,l)}},e.prototype.openEdgeAnimation=function(t){var e=this.getEdgeModelById(t);null==e||e.openEdgeAnimation()},e.prototype.closeEdgeAnimation=function(t){var e=this.getEdgeModelById(t);null==e||e.closeEdgeAnimation()},e.prototype.getPartial=function(){return this.partial},e.prototype.setPartial=function(t){this.partial=t},oo([$],e.prototype,"width",void 0),oo([$],e.prototype,"height",void 0),oo([$],e.prototype,"edgeType",void 0),oo([$],e.prototype,"nodes",void 0),oo([$],e.prototype,"edges",void 0),oo([$],e.prototype,"fakeNode",void 0),oo([$],e.prototype,"overlapMode",void 0),oo([$],e.prototype,"background",void 0),oo([$],e.prototype,"gridSize",void 0),oo([$],e.prototype,"transformModel",void 0),oo([$],e.prototype,"editConfigModel",void 0),oo([$],e.prototype,"partial",void 0),oo([rt],e.prototype,"nodesMap",null),oo([rt],e.prototype,"edgesMap",null),oo([rt],e.prototype,"modelsMap",null),oo([rt],e.prototype,"sortElements",null),oo([rt],e.prototype,"textEditElement",null),oo([rt],e.prototype,"selectElements",null),oo([rt],e.prototype,"selectNodes",null),oo([te],e.prototype,"setFakeNode",null),oo([te],e.prototype,"removeFakeNode",null),oo([te],e.prototype,"setModel",null),oo([te],e.prototype,"toFront",null),oo([te],e.prototype,"setElementZIndex",null),oo([te],e.prototype,"deleteNode",null),oo([te],e.prototype,"addNode",null),oo([te],e.prototype,"cloneNode",null),oo([te],e.prototype,"moveNode",null),oo([te],e.prototype,"moveNode2Coordinate",null),oo([te],e.prototype,"editText",null),oo([te],e.prototype,"addEdge",null),oo([te],e.prototype,"moveEdge",null),oo([te],e.prototype,"deleteEdgeBySourceAndTarget",null),oo([te],e.prototype,"deleteEdgeById",null),oo([te],e.prototype,"deleteEdgeBySource",null),oo([te],e.prototype,"deleteEdgeByTarget",null),oo([te],e.prototype,"setElementStateById",null),oo([te],e.prototype,"updateText",null),oo([te],e.prototype,"selectNodeById",null),oo([te],e.prototype,"selectEdgeById",null),oo([te],e.prototype,"selectElementById",null),oo([te],e.prototype,"clearSelectElements",null),oo([te],e.prototype,"moveNodes",null),oo([te],e.prototype,"setDefaultEdgeType",null),oo([te],e.prototype,"changeNodeType",null),oo([te],e.prototype,"changeEdgeType",null),oo([te],e.prototype,"getNodeIncomingEdge",null),oo([te],e.prototype,"getNodeOutgoingEdge",null),oo([te],e.prototype,"getAnchorIncomingEdge",null),oo([te],e.prototype,"getAnchorOutcomingEdge",null),oo([te],e.prototype,"getNodeIncomingNode",null),oo([te],e.prototype,"getNodeOutgoingNode",null),oo([te],e.prototype,"setTheme",null),oo([te],e.prototype,"resize",null),oo([te],e.prototype,"clearData",null),oo([te],e.prototype,"translateCenter",null),oo([te],e.prototype,"fitView",null),oo([te],e.prototype,"openEdgeAnimation",null),oo([te],e.prototype,"closeEdgeAnimation",null),oo([te],e.prototype,"setPartial",null),e}(),Lb=function(){function t(t){this.isShowHorizontal=!1,this.isShowVertical=!1,this.position={x:0,y:0},this.graphModel=t}return t.prototype.getStyle=function(){return no({},this.graphModel.theme.snapline)},t.prototype.getCenterSnapLine=function(t,e){for(var n=t.x,r=t.y,o=!1,i=!1,a=0;a<e.length;a++){var s=e[a];if(s.id!==t.id&&(n===s.x&&(o=!0),r===s.y&&(i=!0),o&&i))break}return{isShowVertical:o,isShowHorizontal:i,position:{x:n,y:r}}},t.prototype.getHorizontalSnapline=function(t,e){var n,r=!1,o=0,i=t.id;if(i){var a=this.graphModel.fakeNode;if(a&&a.id===i)n=Mm(a);else{var s=this.graphModel.getNodeModelById(i);s&&(n=Mm(s))}}for(var u=0;u<e.length;u++){var l=e[u];if(l.id!==t.id){var c=Mm(l);if(c.minY===(null==n?void 0:n.minY)||c.maxY===(null==n?void 0:n.minY)){r=!0,o=n.minY;break}if(c.minY===(null==n?void 0:n.maxY)||c.maxY===(null==n?void 0:n.maxY)){r=!0,o=n.maxY;break}}}return{isShowHorizontal:r,isShowVertical:this.isShowVertical,position:no(no({},this.position),{y:o})}},t.prototype.getVerticalSnapline=function(t,e){var n,r=!1,o=0,i=t.id;if(i){var a=this.graphModel.fakeNode;if(a&&a.id===i)n=Mm(a);else{var s=this.graphModel.getNodeModelById(i);s&&(n=Mm(s))}}for(var u=0;u<e.length;u++){var l=e[u];if(l.id!==t.id){var c=Mm(l);if(c.minX===(null==n?void 0:n.minX)||c.maxX===(null==n?void 0:n.minX)){r=!0,o=n.minX;break}if(c.minX===(null==n?void 0:n.maxX)||c.maxX===(null==n?void 0:n.maxX)){r=!0,o=n.maxX;break}}}return{isShowHorizontal:this.isShowHorizontal,isShowVertical:r,position:no(no({},this.position),{x:o})}},t.prototype.getSnapLinePosition=function(t,e){var n=this.getCenterSnapLine(t,e),r=n.isShowHorizontal,o=n.isShowVertical;if(!r){var i=this.getHorizontalSnapline(t,e);i.isShowHorizontal&&(n.isShowHorizontal=i.isShowHorizontal,n.position.y=i.position.y)}if(!o){var a=this.getVerticalSnapline(t,e);a.isShowVertical&&(n.isShowVertical=a.isShowVertical,n.position.x=a.position.x)}return n},t.prototype.setSnaplineInfo=function(t){var e=t.isShowHorizontal,n=t.isShowVertical,r=t.position;this.position=r,this.isShowHorizontal=e,this.isShowVertical=n},t.prototype.clearSnapline=function(){this.position={x:0,y:0},this.isShowHorizontal=!1,this.isShowVertical=!1},t.prototype.setNodeSnapLine=function(t){var e=this.graphModel.nodes,n=this.getSnapLinePosition(t,e);this.setSnaplineInfo(n)},oo([$],t.prototype,"isShowHorizontal",void 0),oo([$],t.prototype,"isShowVertical",void 0),oo([$],t.prototype,"position",void 0),oo([te],t.prototype,"clearSnapline",null),oo([te],t.prototype,"setNodeSnapLine",null),t}(),Bb={false:[-1/0,-1/0,1/0,1/0],true:[0,0,0,0],vertical:[-1/0,0,1/0,0],horizontal:[0,-1/0,0,1/0]},zb=function(){function e(t,e){this.MINI_SCALE_SIZE=.2,this.MAX_SCALE_SIZE=16,this.SCALE_X=1,this.SKEW_Y=0,this.SKEW_X=0,this.SCALE_Y=1,this.TRANSLATE_X=0,this.TRANSLATE_Y=0,this.ZOOM_SIZE=.04,this.translateLimitMinX=-1/0,this.translateLimitMinY=-1/0,this.translateLimitMaxX=1/0,this.translateLimitMaxY=1/0,this.eventCenter=t;var n=e.stopMoveGraph,r=void 0!==n&&n;this.updateTranslateLimits(r)}return e.prototype.setZoomMiniSize=function(t){this.MINI_SCALE_SIZE=t},e.prototype.setZoomMaxSize=function(t){this.MAX_SCALE_SIZE=t},e.prototype.HtmlPointToCanvasPoint=function(t){var e=io(t,2),n=e[0],r=e[1];return[(n-this.TRANSLATE_X)/this.SCALE_X,(r-this.TRANSLATE_Y)/this.SCALE_Y]},e.prototype.CanvasPointToHtmlPoint=function(t){var e=io(t,2),n=e[0],r=e[1];return[n*this.SCALE_X+this.TRANSLATE_X,r*this.SCALE_Y+this.TRANSLATE_Y]},e.prototype.moveCanvasPointByHtml=function(t,e,n){var r=io(t,2),o=r[0],i=r[1];return[o+e/this.SCALE_X,i+n/this.SCALE_Y]},e.prototype.fixDeltaXY=function(t,e){return[t/this.SCALE_X,e/this.SCALE_Y]},e.prototype.getTransformStyle=function(){var t=[this.SCALE_X,this.SKEW_Y,this.SKEW_X,this.SCALE_Y,this.TRANSLATE_X,this.TRANSLATE_Y].join(",");return{transform:"matrix(".concat(t,")")}},e.prototype.zoom=function(t,e){void 0===t&&(t=!1);var n=this.SCALE_X,r=this.SCALE_Y;return"number"==typeof t?(n=t,r=t):t?(n+=this.ZOOM_SIZE,r+=this.ZOOM_SIZE):(n-=this.ZOOM_SIZE,r-=this.ZOOM_SIZE),n<this.MINI_SCALE_SIZE||n>this.MAX_SCALE_SIZE||(e&&(this.TRANSLATE_X-=(n-this.SCALE_X)*e[0],this.TRANSLATE_Y-=(r-this.SCALE_Y)*e[1]),this.SCALE_X=n,this.SCALE_Y=r,this.emitGraphTransform("zoom")),"".concat(100*this.SCALE_X,"%")},e.prototype.emitGraphTransform=function(e){this.eventCenter.emit(t.EventType.GRAPH_TRANSFORM,{type:e,transform:{SCALE_X:this.SCALE_X,SKEW_Y:this.SKEW_Y,SKEW_X:this.SKEW_X,SCALE_Y:this.SCALE_Y,TRANSLATE_X:this.TRANSLATE_X,TRANSLATE_Y:this.TRANSLATE_Y}})},e.prototype.resetZoom=function(){this.SCALE_X=1,this.SCALE_Y=1,this.emitGraphTransform("resetZoom")},e.prototype.translate=function(t,e){this.TRANSLATE_X+t<=this.translateLimitMaxX&&this.TRANSLATE_X+t>=this.translateLimitMinX&&(this.TRANSLATE_X+=t),this.TRANSLATE_Y+e<=this.translateLimitMaxY&&this.TRANSLATE_Y+e>=this.translateLimitMinY&&(this.TRANSLATE_Y+=e),this.emitGraphTransform("translate")},e.prototype.focusOn=function(t,e,n,r){var o=io(this.CanvasPointToHtmlPoint([t,e]),2),i=io([n/2-o[0],r/2-o[1]],2),a=i[0],s=i[1];this.TRANSLATE_X+=a,this.TRANSLATE_Y+=s,this.emitGraphTransform("focusOn")},e.prototype.updateTranslateLimits=function(t){var e;e=io(Array.isArray(t)&&4===t.length?t:Bb[t.toString()],4),this.translateLimitMinX=e[0],this.translateLimitMinY=e[1],this.translateLimitMaxX=e[2],this.translateLimitMaxY=e[3]},oo([$],e.prototype,"SCALE_X",void 0),oo([$],e.prototype,"SKEW_Y",void 0),oo([$],e.prototype,"SKEW_X",void 0),oo([$],e.prototype,"SCALE_Y",void 0),oo([$],e.prototype,"TRANSLATE_X",void 0),oo([$],e.prototype,"TRANSLATE_Y",void 0),oo([$],e.prototype,"ZOOM_SIZE",void 0),oo([te],e.prototype,"zoom",null),oo([te],e.prototype,"resetZoom",null),oo([te],e.prototype,"translate",null),oo([te],e.prototype,"focusOn",null),e}(),Hb=function(e){function n(n){var r=e.call(this)||this;r.stepScrollX=0,r.stepScrollY=0,r.onDragging=function(t){var e=t.deltaX,n=t.deltaY;r.setState({isDragging:!0});var o=r.props.graphModel,i=o.transformModel;!0!==o.editConfigModel.stopMoveGraph&&i.translate(e,n)},r.onDragEnd=function(){r.setState({isDragging:!1})},r.zoomHandler=function(t){var e=r.props,n=e.graphModel,o=n.editConfigModel,i=n.transformModel,a=n.gridSize,s=e.graphModel,u=t.deltaX,l=t.deltaY;if(o.stopScrollGraph||!0===t.ctrlKey){if(!o.stopZoomGraph){t.preventDefault();var c=s.getPointByClient({x:t.clientX,y:t.clientY}).canvasOverlayPosition,p=c.x,d=c.y;i.zoom(t.deltaY<0,[p,d])}}else{if(t.preventDefault(),r.stepScrollX+=u,r.stepScrollY+=l,Math.abs(r.stepScrollX)>=a){var f=r.stepScrollX%a,h=r.stepScrollX-f;i.translate(-h*i.SCALE_X,0),r.stepScrollX=f}if(Math.abs(r.stepScrollY)>=a){var y=r.stepScrollY%a,v=r.stepScrollY-y;i.translate(0,-v*i.SCALE_Y),r.stepScrollY=y}}},r.clickHandler=function(e){if("canvas-overlay"===e.target.getAttribute("name")){var n=r.props.graphModel;n.selectElements.size>0&&n.clearSelectElements(),n.eventCenter.emit(t.EventType.BLANK_CLICK,{e:e})}},r.handleContextMenu=function(e){if("canvas-overlay"===e.target.getAttribute("name")){e.preventDefault();var n=r.props.graphModel,o=n.getPointByClient({x:e.clientX,y:e.clientY});n.eventCenter.emit(t.EventType.BLANK_CONTEXTMENU,{e:e,position:o})}},r.mouseDownHandler=function(e){var n=r.props.graphModel,o=n.eventCenter,i=n.editConfigModel,a=n.transformModel.SCALE_X,s=n.gridSize,u=e.target,l=!i.adjustEdge&&!i.adjustNodePosition;("canvas-overlay"===u.getAttribute("name")||l)&&(!0!==i.stopMoveGraph?(r.stepDrag.setStep(s*a),r.stepDrag.handleMouseDown(e)):o.emit(t.EventType.BLANK_MOUSEDOWN,{e:e}),r.clickHandler(e))};var o=n.graphModel,i=o.gridSize,a=o.eventCenter;return r.stepDrag=new f_({onDragging:r.onDragging,onDragEnd:r.onDragEnd,step:i,eventType:"BLANK",isStopPropagation:!1,eventCenter:a,model:void 0}),r.state={isDragging:!1},r}return eo(n,e),n.prototype.render=function(){var t=this.props.graphModel.transformModel.getTransformStyle().transform,e=this.props,n=e.children,r=e.dnd,o=this.state.isDragging;return uo("svg",no({xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",name:"canvas-overlay",onWheel:this.zoomHandler,onMouseDown:this.mouseDownHandler,onContextMenu:this.handleContextMenu,className:o?"lf-canvas-overlay lf-dragging":"lf-canvas-overlay lf-drag-able"},r.eventMap(),{children:uo("g",{transform:t,children:n})}))},n=oo([cx],n)}(Vn);function Ub(e){var n=e.x,r=void 0===n?0:n,o=e.y,i=void 0===o?0:o,a=e.value,s=e.fontSize,u=void 0===s?12:s,l=e.fill,c=void 0===l?"currentColor":l,p=e.overflowMode,d=void 0===p?"default":p,f=e.textWidth,h=void 0===f?void 0:f,y=e.model,v={x:r,y:i,fill:c,fontSize:u,textAnchor:"middle",dominantBaseline:"central"};if(Yd(Jd(e),(function(t){var e=io(t,2),n=e[0],r=e[1];"object"!=typeof r&&(v[n]=r)})),a){var g=String(a).split(/[\r\n]/g),_=g.length;if("default"!==d){var m=y.BaseType,b=y.modelType;if(m===t.ElementType.NODE&&b!==t.ModelType.TEXT_NODE||m===t.ElementType.EDGE&&h)return Xb(e)}if(_>1){var E=g.map((function(t,e){return uo("tspan",{className:"lf-text-tspan",x:r,y:i+(e-(_-1)/2)*(u+2),children:t})}));return uo("text",no({},v,{children:E}))}return uo("text",no({},v,{children:a}))}return null}function Xb(t){var e=t.x,n=t.y,r=t.value,o=t.model,i=t.textWidth,a=t.fontSize,s=void 0===a?12:a,u=t.lineHeight,l=t.fontFamily,c=void 0===l?"":l,p=t.wrapPadding,d=void 0===p?"0, 0":p,f=t.overflowMode,h=o.width,y=o.height,v=o.textHeight,g=i||h,_=String(r).split(/[\r\n]/g),m=_.length,b=jm({rows:_,style:{fontSize:"".concat(s,"px"),width:"".concat(g,"px"),fontFamily:c,lineHeight:u,padding:d},rowsLength:m,className:"lf-get-text-height"}),E=y>b?y:b;v&&(E=v);var x="ellipsis"===f;return x&&(E=s+2),uo("g",{children:uo("foreignObject",{width:g,height:E,x:e-g/2,y:n-E/2,style:{overflow:"visible",textAlign:"left"},children:uo("div",{className:"lf-node-text-auto-wrap",style:{minHeight:E,width:g,padding:d},children:uo("div",{className:x?"lf-node-text-ellipsis-content":"lf-node-text-auto-wrap-content",title:x?_.join(""):"",style:no({},t),children:_.map((function(t){return uo("div",{className:"lf-node-text--auto-wrap-inner",children:t})}))})})})})}function Gb(t){var e={x1:10,y1:10,x2:20,y2:20,stroke:"black"};return Yd(Jd(t),(function(t){var n=io(t,2),r=n[0],o=n[1];("style"===r||"object"!=typeof o)&&(e[r]=o)})),uo("line",no({},e))}function Wb(t){var e=t.x,n=t.y,r=t.width,o=t.height,i=t.className,a=t.strokeWidth,s=t.radius,u=void 0===s?0:s,l=e-r/2,c=n-o/2,p={};return p["stroke-width"]=a,Yd(Jd(t),(function(t){var e=io(t,2),n=e[0],r=e[1];"object"!=typeof r&&(p[n]=r)})),p.className=i?"lf-basic-shape ".concat(i):"lf-basic-shape",u&&(p.rx=u,p.ry=u),p.x=l,p.y=c,uo("rect",no({},p))}function Yb(t){var e={d:""};return Yd(Jd(t),(function(t){var n=io(t,2),r=n[0],o=n[1];"style"!==r&&"object"==typeof o||(e[r]=o)})),uo("path",no({},e))}function Vb(t){var e=t.x,n=void 0===e?0:e,r=t.y,o=void 0===r?0:r,i=t.r,a=void 0===i?4:i,s=t.className,u={cx:n,cy:o,r:a,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return Yd(Jd(t),(function(t){var e=io(t,2),n=e[0],r=e[1];"object"!=typeof r&&(u[n]=r)})),u.className=s?"lf-basic-shape ".concat(s):"lf-basic-shape",uo("circle",no({},u))}function Fb(t){var e=t.x,n=void 0===e?0:e,r=t.y,o=void 0===r?0:r,i=t.rx,a=void 0===i?4:i,s=t.ry,u=void 0===s?4:s,l=t.className,c={cx:n,cy:o,rx:a,ry:u,fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1};return Yd(Jd(t),(function(t){var e=io(t,2),n=e[0],r=e[1];"object"!=typeof r&&(c[n]=r)})),c.className=l?"lf-basic-shape ".concat(l):"lf-basic-shape",uo("ellipse",no({},c))}function Kb(t){var e=t.points,n=void 0===e?[]:e,r=t.className,o={fill:"transparent",fillOpacity:1,strokeWidth:1,stroke:"#000",strokeOpacity:1,points:""};return Yd(Jd(t),(function(t){var e=io(t,2),n=e[0],r=e[1];"object"!=typeof r&&(o[n]=r)})),r?o.classNmae="lf-basic-shape ".concat(r):o.className="lf-basic-shape",o.points=n.map((function(t){return t.join(",")})).join(" "),uo("polygon",no({},o))}function qb(t){var e=t.className,n={points:"",fill:"none"};return Yd(Jd(t),(function(t){var e=io(t,2),r=e[0],o=e[1];("style"===r||"object"!=typeof o)&&(n[r]=o)})),e&&(n.className="".concat(e)),uo("polyline",no({},n))}var Zb=function(e){function n(){var n=e.call(this)||this;return n.onDragging=function(e){var r=e.event,o=n.props,i=o.graphModel,a=o.bezierModel,s=o.type,u=i.getPointByClient({x:r.clientX,y:r.clientY}).canvasOverlayPosition,l=u.x,c=u.y;a.updateAdjustAnchor({x:l,y:c},s),i.eventCenter.emit(t.EventType.EDGE_ADJUST,{data:a.getData()})},n.onDragEnd=function(){n.props.bezierModel.isDragging=!1},n.dragHandler=new f_({onDragging:n.onDragging,onDragEnd:n.onDragEnd}),n}return eo(n,e),n.prototype.render=function(){var t=this,e=this.props.position,n=e.x,r=e.y,o=this.props.bezierModel.getEdgeStyle().adjustAnchor;return uo(Vb,no({className:"lf-bezier-adjust-anchor",x:n,y:r},o,{onMouseDown:function(e){t.dragHandler.handleMouseDown(e)}}))},n}(Vn),$b=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return eo(n,e),n.prototype.getBezierAdjust=function(t,e){var n=t.path,r=t.id,o=io(J_(n),4),i=o[0],a=o[1],s=o[2],u=o[3],l=t.getEdgeStyle().adjustLine,c=[];return c.push(uo(Gb,no({x1:i.x,y1:i.y,x2:a.x,y2:a.y},l))),c.push(uo(Zb,{position:a,bezierModel:t,graphModel:e,type:"sNext"},"".concat(r,"_ePre"))),c.push(uo(Gb,no({x1:u.x,y1:u.y,x2:s.x,y2:s.y},l))),c.push(uo(Zb,{position:s,bezierModel:t,graphModel:e,type:"ePre"},"".concat(r,"_sNext"))),c},n.prototype.selectedBezierEdge=function(){for(var e=this.props.graphModel,n=e.edges,r=[],o=0;o<n.length;o++){var i=n[o];i.isSelected&&i.modelType===t.ModelType.BEZIER_EDGE&&i.draggable&&r.push(this.getBezierAdjust(i,e))}return r},n.prototype.render=function(){return uo("g",{className:"lf-bezier-adjust",children:this.selectedBezierEdge()})},n=oo([cx],n)}(Vn),Jb=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eo(e,t),e.prototype.render=function(){return uo("div",{className:"lf-background",children:uo("div",{style:this.props.background,className:"lf-background-area"})})},e}(Vn),Qb=function(t){function e(){var e=t.apply(this,ao([],io(arguments),!1))||this;return e.id=nb(),e}return eo(e,t),e.prototype.renderDot=function(){var t=this.props,e=t.config,n=t.size,r=void 0===n?1:n,o=t.visible,i=null!=e?e:{},a=i.color,s=i.thickness,u=void 0===s?2:s,l=Math.min(Math.max(2,u),r/4);return uo("g",{fill:a,opacity:o?1:0,children:[uo("circle",{cx:0,cy:0,r:l/2}),uo("circle",{cx:0,cy:r,r:l/2}),uo("circle",{cx:r,cy:0,r:l/2}),uo("circle",{cx:r,cy:r,r:l/2})]})},e.prototype.renderMesh=function(){var t=this.props,e=t.config,n=t.size,r=void 0===n?1:n,o=t.visible,i=null!=e?e:{},a=i.color,s=i.thickness,u=void 0===s?1:s,l=Math.min(Math.max(1,u),r/2);return uo("path",{d:"M 0 0 H ".concat(r," V ").concat(r," H 0 Z"),stroke:a,strokeWidth:l,opacity:o?1:0,fill:"transparent"})},e.prototype.render=function(){var t=this.props,e=t.type,n=t.size,r=void 0===n?1:n,o=t.graphModel.transformModel,i=[o.SCALE_X,o.SKEW_Y,o.SKEW_X,o.SCALE_Y,o.TRANSLATE_X,o.TRANSLATE_Y].join(","),a="matrix(".concat(i,")");return uo("div",{className:"lf-grid",children:uo("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",children:[uo("defs",{children:uo("pattern",{id:this.id,patternUnits:"userSpaceOnUse",patternTransform:a,x:"0",y:"0",width:r,height:r,children:["dot"===e&&this.renderDot(),"mesh"===e&&this.renderMesh()]})}),uo("rect",{width:"100%",height:"100%",fill:"url(#".concat(this.id,")")})]})})},e=oo([cx],e)}(Vn);!function(t){t.defaultProps={size:10,visible:!0,type:"dot",config:{color:"#ababab",thickness:1}},t.getGridOptions=function(e){var n=up(t.defaultProps);return js(n,"number"==typeof e?{size:e}:"boolean"==typeof e?{visible:e}:e)}}(Qb||(Qb={}));var tE=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eo(e,t),e.prototype.render=function(){return uo("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"100%",height:"100%",className:"modification-overlay",children:uo("g",{transform:this.props.graphModel.transformModel.getTransformStyle().transform,children:this.props.children})})},e=oo([cx],e)}(Vn),eE=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return eo(n,e),n.prototype.getNodesOutline=function(){var t=this.props.graphModel,e=t.nodes,n=t.editConfigModel,r=n.hoverOutline,o=n.nodeSelectedOutline,i=[];return e.forEach((function(t){if(t.isHovered||t.isSelected){var e=t.isHovered,n=t.isSelected,a=t.x,s=t.y,u=t.width,l=t.height;if(o&&n||r&&e){var c=t.getOutlineStyle(),p={};if(Object.keys(c).forEach((function(t){"hover"!==t&&(p[t]=c[t])})),e){var d=c.hover;p=no(no({},p),d)}i.push(uo(Wb,no({transform:t.transform,className:"lf-outline-node",x:a,y:s,width:u+10,height:l+10},p)))}}})),i},n.prototype.getEdgeOutline=function(){for(var e=this.props.graphModel,n=e.edges,r=e.editConfigModel,o=r.edgeSelectedOutline,i=r.hoverOutline,a=[],s=0;s<n.length;s++){var u=n[s];(o&&u.isSelected||i&&u.isHovered)&&(u.modelType===t.ModelType.LINE_EDGE?a.push(this.getLineOutline(u)):u.modelType===t.ModelType.POLYLINE_EDGE?a.push(this.getPolylineOutline(u)):u.modelType===t.ModelType.BEZIER_EDGE&&a.push(this.getBezierOutline(u)))}return a},n.prototype.getLineOutline=function(t){var e=t.startPoint,n=t.endPoint,r=(e.x+n.x)/2,o=(e.y+n.y)/2,i=Math.abs(e.x-n.x)+10,a=Math.abs(e.y-n.y)+10,s=t.getOutlineStyle();return uo(Wb,no({className:"lf-outline-edge",x:r,y:o,width:i,height:a},s))},n.prototype.getPolylineOutline=function(t){var e=t.points,n=Y_(e),r=x_(n,8),o=r.x,i=r.y,a=r.width,s=r.height,u=t.getOutlineStyle();return uo(Wb,no({className:"lf-outline",x:o,y:i,width:a,height:s},u))},n.prototype.getBezierOutline=function(t){var e=t.path,n=J_(e),r=x_(n,8),o=r.x,i=r.y,a=r.width,s=r.height,u=t.getOutlineStyle();return uo(Wb,no({className:"lf-outline",x:o,y:i,width:a,height:s},u))},n.prototype.render=function(){return uo("g",{className:"lf-outline",children:[this.getNodesOutline(),this.getEdgeOutline()]})},n=oo([cx],n)}(Vn),nE=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eo(e,t),e.prototype.render=function(){var t=this.props.snaplineModel,e=null!=t?t:{},n=e.position,r=e.isShowHorizontal,o=e.isShowVertical,i=null==t?void 0:t.getStyle(),a=null!=n?n:{},s=a.x,u=void 0===s?0:s,l=a.y,c=void 0===l?0:l,p=no(no({x1:-1e5,y1:c,x2:1e5,y2:c},i),{stroke:r?null==i?void 0:i.stroke:"none"}),d=no(no({x1:u,y1:-1e5,x2:u,y2:1e5},i),{stroke:o?null==i?void 0:i.stroke:"none"});return uo("g",{className:"lf-snapline",children:[uo(Gb,no({},p)),uo(Gb,no({},d))]})},e=oo([cx],e)}(Vn),rE=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eo(e,t),e.prototype.componentDidMount=function(){this.triggerToolRender()},e.prototype.componentDidUpdate=function(){this.triggerToolRender()},e.prototype.getTools=function(){var t=this.props,e=t.tool,n=t.graphModel,r=n.textEditElement,o=e.getTools().map((function(t){return Xn(t,{textEditElement:r,graphModel:n,logicFlow:e.instance})}));return e.components=o,o},e.prototype.triggerToolRender=function(){var t=this.props,e=t.tool,n=t.graphModel,r=document.querySelector("#ToolOverlay_".concat(n.flowId)),o=e.getInstance();o.components.forEach((function(t){return t(o,r)})),o.components=[]},e.prototype.render=function(){var t=this.props.graphModel;return uo("div",{className:"lf-tool-overlay",id:"ToolOverlay_".concat(t.flowId),children:this.getTools()})},e=oo([cx],e)}(Vn),oE=function(e){function n(){var t=e.apply(this,ao([],io(arguments),!1))||this;return t.handleResize=function(){t.props.graphModel.resize()},t}return eo(n,e),n.prototype.componentDidMount=function(){window.addEventListener("resize",Kv(this.handleResize,200))},n.prototype.componentDidUpdate=function(){this.props.graphModel.eventCenter.emit(t.EventType.GRAPH_UPDATED,{})},n.prototype.componentWillUnmount=function(){window.removeEventListener("resize",Kv(this.handleResize,200))},n.prototype.getComponent=function(t,e,n){void 0===n&&(n="canvas-overlay");var r=(0,this.props.getView)(t.type);return r?uo(r,{model:t,graphModel:e,overlay:n},t.id):null},n.prototype.render=function(){var t=this,e=this.props,n=e.graphModel,r=e.tool,o=e.options,i=e.dnd,a=e.snaplineModel;o.width&&"".concat(n.width,"px"),o.height&&"".concat(n.height,"px");var s=o.grid&&Qb.getGridOptions(o.grid),u=n.fakeNode,l=n.editConfigModel.adjustEdge;return uo("div",{className:"lf-graph","flow-id":n.flowId,children:[uo(Hb,{graphModel:n,dnd:i,children:[uo("g",{className:"lf-base",children:wf(n.sortElements,(function(e){return t.getComponent(e,n)}))}),u?this.getComponent(u,n):""]}),uo(tE,{graphModel:n,children:[uo(eE,{graphModel:n}),l?uo($b,{graphModel:n}):"",!1!==o.snapline?uo(nE,{snaplineModel:a}):""]}),uo(rE,{graphModel:n,tool:r}),o.background&&uo(Jb,{background:o.background}),s&&uo(Qb,no({},s,{graphModel:n}))]})},n=oo([cx],n)}(Vn),iE=function(e){function n(){var n=e.call(this)||this;return n.onDragStart=function(e){var r=e.event,o=n.props,i=o.anchorData,a=o.nodeModel,s=o.graphModel;s.selectNodeById(a.id),a.autoToFront&&s.toFront(a.id),s.eventCenter.emit(t.EventType.ANCHOR_DRAGSTART,{data:i,e:r,nodeModel:a}),n.setState({startX:i.x,startY:i.y,endX:i.x,endY:i.y})},n.onDragging=function(e){var r=e.event,o=n.props,i=o.graphModel,a=o.nodeModel,s=o.anchorData,u=i.transformModel,l=i.eventCenter,c=i.width,p=i.height,d=i.editConfigModel,f=d.autoExpand,h=d.stopMoveGraph,y=r.clientX,v=r.clientY,g=i.getPointByClient({x:y,y:v}),_=g.domOverlayPosition,m=_.x,b=_.y,E=g.canvasOverlayPosition,x=E.x,w=E.y;n.t&&ib(n.t);var S=[];m<10?S=[10,0]:m+10>c?S=[-10,0]:b<10?S=[0,10]:b+10>p&&(S=[0,-10]),n.setState({endX:x,endY:w,dragging:!0}),n.moveAnchorEnd(x,w),S.length>0&&!h&&f&&(n.t=ob((function(){var t=io(S,2),e=t[0],r=t[1];u.translate(e,r);var o=n.state,i=o.endX,a=o.endY;n.setState({endX:i-e,endY:a-r}),n.moveAnchorEnd(i-e,a-r)}))),l.emit(t.EventType.ANCHOR_DRAG,{data:s,e:r,nodeModel:a})},n.onDragEnd=function(e){var r=e.event;n.t&&ib(n.t);var o=n.checkEnd(r);n.setState({startX:0,startY:0,endX:0,endY:0,dragging:!1}),n.sourceRuleResults.clear(),n.targetRuleResults.clear();var i=n.props,a=i.graphModel,s=i.nodeModel,u=i.anchorData;o&&a.eventCenter.emit(t.EventType.ANCHOR_DRAGEND,{data:u,e:r,nodeModel:s,edgeModel:o})},n.checkEnd=function(e){var r,o=n.props,i=o.graphModel,a=o.nodeModel,s=o.anchorData,u=s.x,l=s.y,c=s.id,p=n.state,d=p.endX,f=p.endY,h=p.dragging,y=mm({x:d,y:f},i);if(n.preTargetNode&&n.preTargetNode.state!==t.ElementState.DEFAULT&&n.preTargetNode.setElementState(t.ElementState.DEFAULT),h&&y&&y.node){var v=y.node,g=y.anchor.id,_="".concat(a.id,"_").concat(v.id,"_").concat(g,"_").concat(c),m=n.sourceRuleResults.get(_)||{},b=m.isAllPass,E=m.msg,x=n.targetRuleResults.get(_)||{},w=x.isAllPass,S=x.msg;if(b&&w){v.setElementState(t.ElementState.DEFAULT);var M=i.getNodeModelById(y.node.id),A=null===(r=i.edgeGenerator)||void 0===r?void 0:r.call(i,a.getData(),null==M?void 0:M.getData()),T=i.addEdge(no(no({},A),{sourceNodeId:a.id,sourceAnchorId:c,startPoint:{x:u,y:l},targetNodeId:y.node.id,targetAnchorId:y.anchor.id,endPoint:{x:y.anchor.x,y:y.anchor.y}})),O=n.props.anchorData;return i.eventCenter.emit(t.EventType.ANCHOR_DROP,{data:O,e:e,nodeModel:a,edgeModel:T}),T}var N=v.getData();return i.eventCenter.emit(t.EventType.CONNECTION_NOT_ALLOWED,{data:N,msg:S||E||"不允许添加连线"}),null}},n.sourceRuleResults=new Map,n.targetRuleResults=new Map,n.state={startX:0,startY:0,endX:0,endY:0,dragging:!1},n.dragHandler=new f_({onDragStart:n.onDragStart,onDragging:n.onDragging,onDragEnd:n.onDragEnd}),n}return eo(n,e),n.prototype.getAnchorShape=function(){var t=this.props,e=t.anchorData,n=t.style,r=t.node.getAnchorShape(e);if(r)return r;var o=e.x,i=e.y,a=no(no({},n),null==n?void 0:n.hover);return uo("g",{children:[uo(Vb,no({className:"lf-node-anchor-hover"},a,{x:o,y:i})),uo(Vb,no({className:"lf-node-anchor"},n,{x:o,y:i}))]})},Object.defineProperty(n.prototype,"customTrajectory",{get:function(){return this.props.graphModel.customTrajectory},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"relateEdges",{get:function(){var t=this.props,e=t.graphModel,n=e.getAnchorIncomingEdge,r=e.getAnchorOutcomingEdge,o=t.anchorData.id;return{incomingEdgeList:n(o),outcomingEdgeList:r(o)}},enumerable:!1,configurable:!0}),n.prototype.moveAnchorEnd=function(e,n){var r,o,i=this.props,a=i.graphModel,s=i.nodeModel,u=i.anchorData,l=mm({x:e,y:n},a);if(l){var c=l.node,p=l.anchor.id;if(this.preTargetNode&&this.preTargetNode!==l.node&&this.preTargetNode.setElementState(t.ElementState.DEFAULT),u.id===p)return;this.preTargetNode=c;var d="".concat(s.id,"_").concat(c.id,"_").concat(p,"_").concat(u.id);if(!this.targetRuleResults.has(d)){var f=l.anchor,h=s.isAllowConnectedAsSource(c,u,f),y=c.isAllowConnectedAsTarget(s,u,f);this.sourceRuleResults.set(d,Rm(h)),this.targetRuleResults.set(d,Rm(y))}var v=(null!==(r=this.sourceRuleResults.get(d))&&void 0!==r?r:{}).isAllPass,g=(null!==(o=this.targetRuleResults.get(d))&&void 0!==o?o:{}).isAllPass;v&&g?c.setElementState(t.ElementState.ALLOW_CONNECT):c.setElementState(t.ElementState.NOT_ALLOW_CONNECT)}else this.preTargetNode&&this.preTargetNode.state!==t.ElementState.DEFAULT&&this.preTargetNode.setElementState(t.ElementState.DEFAULT)},n.prototype.isShowLine=function(){var t=this.state,e=t.startX,n=t.startY,r=t.endX,o=t.endY;return xm(e,n,r,o)>10},n.prototype.render=function(){var t=this,e=this.state,n=e.startX,r=e.startY,o=e.endX,i=e.endY,a=this.props,s=a.anchorData.edgeAddable,u=a.edgeStyle;return uo("g",{className:"lf-anchor",children:[uo("g",{onMouseDown:function(e){!1!==s&&t.dragHandler.handleMouseDown(e)},children:this.getAnchorShape()}),this.isShowLine()&&(this.customTrajectory?this.customTrajectory(no({sourcePoint:{x:n,y:r},targetPoint:{x:o,y:i}},u)):uo(Gb,no({x1:n,y1:r,x2:o,y2:i},u,{"pointer-events":"none"})))]})},n}(Vn),aE=function(e){function n(n){var r=e.call(this,n)||this;return r.style={},r.onDragging=function(e){var n,o=e.event,i=r.props,a=i.graphModel,s=i.nodeModel,u=i.eventCenter,l=a.selectNodes,c=s.x,p=s.y,d=o.clientX,f=o.clientY,h=a.getPointByClient({x:d,y:f}).canvasOverlayPosition,y=h.x,v=h.y,g=new dm(y-c,v-p),_=(null===(n=r.normal)||void 0===n?void 0:n.angle(g))-r.defaultAngle,m=new gm(-c,-p).rotate(_).translate(c,p).toString();s.transform=m,s.rotate=_;var b=wf(l,(function(t){return t.id}));-1===b.indexOf(s.id)&&(b=[s.id]);var E=uv(b,(function(t,e){var n=a.getNodeModelById(e);return t[e]=null==n?void 0:n.getMoveDistance(0,0,!1),t}),{});b.forEach((function(t){a.getNodeEdges(t).forEach((function(t){if(E[t.sourceNodeId]){var e=a.getNodeModelById(t.sourceNodeId).anchors.find((function(e){return e.id===t.sourceAnchorId}));t.updateStartPoint(e)}if(E[t.targetNodeId]){e=a.getNodeModelById(t.targetNodeId).anchors.find((function(e){return e.id===t.targetAnchorId}));t.updateEndPoint(e)}}))})),u.emit(t.EventType.NODE_ROTATE,{e:o,nodeModel:s})},r.style=n.style,r.stepperDrag=new f_({onDragging:r.onDragging}),r}return eo(n,e),n.prototype.render=function(){var t=this,e=this.props.nodeModel,n=e.x,r=e.y,o=n+e.width/2+20,i=r-e.height/2-20;return this.normal=new dm(1,0),this.defaultAngle=this.normal.angle(new dm(o-n,i-r)),e.defaultAngle=this.defaultAngle,uo("g",{className:"lf-rotate-control",children:uo("g",{onMouseDown:function(e){t.stepperDrag.handleMouseDown(e)},children:uo(Vb,no({},this.style,{cx:o,cy:i}))})})},n}(Vn),sE={},uE={get exports(){return sE},set exports(t){sE=t}};
|
|
26
26
|
/*!
|
|
27
27
|
Copyright (c) 2018 Jed Watson.
|
|
28
28
|
Licensed under the MIT License (MIT), see
|