@logicflow/extension 2.0.0-beta.4 → 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/dist/index.min.js CHANGED
@@ -8,5 +8,5 @@
8
8
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
9
9
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
10
10
  */
11
- var df,hf,pf=4294967295,ff=Array.prototype,vf=Object.prototype.hasOwnProperty,gf=Bt?Bt.iterator:void 0,yf=Math.max,mf=Math.min,bf=function(t){return function(e,n,r){if(null==r){var i=de(n),o=i&&ii(n),a=o&&o.length&&tc(n,o);(a?a.length:i)||(r=n,n=e,e=this)}return t(e,n,r)}}(dd);hn.after=$p.after,hn.ary=$p.ary,hn.assign=rf.assign,hn.assignIn=rf.assignIn,hn.assignInWith=rf.assignInWith,hn.assignWith=rf.assignWith,hn.at=rf.at,hn.before=$p.before,hn.bind=$p.bind,hn.bindAll=uf.bindAll,hn.bindKey=$p.bindKey,hn.castArray=Jp.castArray,hn.chain=of.chain,hn.chunk=Yp.chunk,hn.compact=Yp.compact,hn.concat=Yp.concat,hn.cond=uf.cond,hn.conforms=uf.conforms,hn.constant=uf.constant,hn.countBy=Zp.countBy,hn.create=rf.create,hn.curry=$p.curry,hn.curryRight=$p.curryRight,hn.debounce=$p.debounce,hn.defaults=rf.defaults,hn.defaultsDeep=rf.defaultsDeep,hn.defer=$p.defer,hn.delay=$p.delay,hn.difference=Yp.difference,hn.differenceBy=Yp.differenceBy,hn.differenceWith=Yp.differenceWith,hn.drop=Yp.drop,hn.dropRight=Yp.dropRight,hn.dropRightWhile=Yp.dropRightWhile,hn.dropWhile=Yp.dropWhile,hn.fill=Yp.fill,hn.filter=Zp.filter,hn.flatMap=Zp.flatMap,hn.flatMapDeep=Zp.flatMapDeep,hn.flatMapDepth=Zp.flatMapDepth,hn.flatten=Yp.flatten,hn.flattenDeep=Yp.flattenDeep,hn.flattenDepth=Yp.flattenDepth,hn.flip=$p.flip,hn.flow=uf.flow,hn.flowRight=uf.flowRight,hn.fromPairs=Yp.fromPairs,hn.functions=rf.functions,hn.functionsIn=rf.functionsIn,hn.groupBy=Zp.groupBy,hn.initial=Yp.initial,hn.intersection=Yp.intersection,hn.intersectionBy=Yp.intersectionBy,hn.intersectionWith=Yp.intersectionWith,hn.invert=rf.invert,hn.invertBy=rf.invertBy,hn.invokeMap=Zp.invokeMap,hn.iteratee=uf.iteratee,hn.keyBy=Zp.keyBy,hn.keys=ii,hn.keysIn=rf.keysIn,hn.map=Zp.map,hn.mapKeys=rf.mapKeys,hn.mapValues=rf.mapValues,hn.matches=uf.matches,hn.matchesProperty=uf.matchesProperty,hn.memoize=$p.memoize,hn.merge=rf.merge,hn.mergeWith=rf.mergeWith,hn.method=uf.method,hn.methodOf=uf.methodOf,hn.mixin=bf,hn.negate=fd,hn.nthArg=uf.nthArg,hn.omit=rf.omit,hn.omitBy=rf.omitBy,hn.once=$p.once,hn.orderBy=Zp.orderBy,hn.over=uf.over,hn.overArgs=$p.overArgs,hn.overEvery=uf.overEvery,hn.overSome=uf.overSome,hn.partial=$p.partial,hn.partialRight=$p.partialRight,hn.partition=Zp.partition,hn.pick=rf.pick,hn.pickBy=rf.pickBy,hn.property=uf.property,hn.propertyOf=uf.propertyOf,hn.pull=Yp.pull,hn.pullAll=Yp.pullAll,hn.pullAllBy=Yp.pullAllBy,hn.pullAllWith=Yp.pullAllWith,hn.pullAt=Yp.pullAt,hn.range=uf.range,hn.rangeRight=uf.rangeRight,hn.rearg=$p.rearg,hn.reject=Zp.reject,hn.remove=Yp.remove,hn.rest=$p.rest,hn.reverse=Yp.reverse,hn.sampleSize=Zp.sampleSize,hn.set=rf.set,hn.setWith=rf.setWith,hn.shuffle=Zp.shuffle,hn.slice=Yp.slice,hn.sortBy=Zp.sortBy,hn.sortedUniq=Yp.sortedUniq,hn.sortedUniqBy=Yp.sortedUniqBy,hn.split=af.split,hn.spread=$p.spread,hn.tail=Yp.tail,hn.take=Yp.take,hn.takeRight=Yp.takeRight,hn.takeRightWhile=Yp.takeRightWhile,hn.takeWhile=Yp.takeWhile,hn.tap=of.tap,hn.throttle=$p.throttle,hn.thru=fp,hn.toArray=Jp.toArray,hn.toPairs=rf.toPairs,hn.toPairsIn=rf.toPairsIn,hn.toPath=uf.toPath,hn.toPlainObject=Jp.toPlainObject,hn.transform=rf.transform,hn.unary=$p.unary,hn.union=Yp.union,hn.unionBy=Yp.unionBy,hn.unionWith=Yp.unionWith,hn.uniq=Yp.uniq,hn.uniqBy=Yp.uniqBy,hn.uniqWith=Yp.uniqWith,hn.unset=rf.unset,hn.unzip=Yp.unzip,hn.unzipWith=Yp.unzipWith,hn.update=rf.update,hn.updateWith=rf.updateWith,hn.values=rf.values,hn.valuesIn=rf.valuesIn,hn.without=Yp.without,hn.words=af.words,hn.wrap=$p.wrap,hn.xor=Yp.xor,hn.xorBy=Yp.xorBy,hn.xorWith=Yp.xorWith,hn.zip=Yp.zip,hn.zipObject=Yp.zipObject,hn.zipObjectDeep=Yp.zipObjectDeep,hn.zipWith=Yp.zipWith,hn.entries=rf.toPairs,hn.entriesIn=rf.toPairsIn,hn.extend=rf.assignIn,hn.extendWith=rf.assignInWith,bf(hn,hn),hn.add=Qp.add,hn.attempt=uf.attempt,hn.camelCase=af.camelCase,hn.capitalize=af.capitalize,hn.ceil=Qp.ceil,hn.clamp=tf,hn.clone=Jp.clone,hn.cloneDeep=Jp.cloneDeep,hn.cloneDeepWith=Jp.cloneDeepWith,hn.cloneWith=Jp.cloneWith,hn.conformsTo=Jp.conformsTo,hn.deburr=af.deburr,hn.defaultTo=uf.defaultTo,hn.divide=Qp.divide,hn.endsWith=af.endsWith,hn.eq=Jp.eq,hn.escape=af.escape,hn.escapeRegExp=af.escapeRegExp,hn.every=Zp.every,hn.find=Zp.find,hn.findIndex=Yp.findIndex,hn.findKey=rf.findKey,hn.findLast=Zp.findLast,hn.findLastIndex=Yp.findLastIndex,hn.findLastKey=rf.findLastKey,hn.floor=Qp.floor,hn.forEach=Zp.forEach,hn.forEachRight=Zp.forEachRight,hn.forIn=rf.forIn,hn.forInRight=rf.forInRight,hn.forOwn=rf.forOwn,hn.forOwnRight=rf.forOwnRight,hn.get=rf.get,hn.gt=Jp.gt,hn.gte=Jp.gte,hn.has=rf.has,hn.hasIn=rf.hasIn,hn.head=Yp.head,hn.identity=we,hn.includes=Zp.includes,hn.indexOf=Yp.indexOf,hn.inRange=ef,hn.invoke=rf.invoke,hn.isArguments=Jp.isArguments,hn.isArray=te,hn.isArrayBuffer=Jp.isArrayBuffer,hn.isArrayLike=Jp.isArrayLike,hn.isArrayLikeObject=Jp.isArrayLikeObject,hn.isBoolean=Jp.isBoolean,hn.isBuffer=Jp.isBuffer,hn.isDate=Jp.isDate,hn.isElement=Jp.isElement,hn.isEmpty=Jp.isEmpty,hn.isEqual=Jp.isEqual,hn.isEqualWith=Jp.isEqualWith,hn.isError=Jp.isError,hn.isFinite=Jp.isFinite,hn.isFunction=Jp.isFunction,hn.isInteger=Jp.isInteger,hn.isLength=Jp.isLength,hn.isMap=Jp.isMap,hn.isMatch=Jp.isMatch,hn.isMatchWith=Jp.isMatchWith,hn.isNaN=Jp.isNaN,hn.isNative=Jp.isNative,hn.isNil=Jp.isNil,hn.isNull=Jp.isNull,hn.isNumber=Jp.isNumber,hn.isObject=de,hn.isObjectLike=Jp.isObjectLike,hn.isPlainObject=Jp.isPlainObject,hn.isRegExp=Jp.isRegExp,hn.isSafeInteger=Jp.isSafeInteger,hn.isSet=Jp.isSet,hn.isString=Jp.isString,hn.isSymbol=Jp.isSymbol,hn.isTypedArray=Jp.isTypedArray,hn.isUndefined=Jp.isUndefined,hn.isWeakMap=Jp.isWeakMap,hn.isWeakSet=Jp.isWeakSet,hn.join=Yp.join,hn.kebabCase=af.kebabCase,hn.last=hl,hn.lastIndexOf=Yp.lastIndexOf,hn.lowerCase=af.lowerCase,hn.lowerFirst=af.lowerFirst,hn.lt=Jp.lt,hn.lte=Jp.lte,hn.max=Qp.max,hn.maxBy=Qp.maxBy,hn.mean=Qp.mean,hn.meanBy=Qp.meanBy,hn.min=Qp.min,hn.minBy=Qp.minBy,hn.stubArray=uf.stubArray,hn.stubFalse=uf.stubFalse,hn.stubObject=uf.stubObject,hn.stubString=uf.stubString,hn.stubTrue=uf.stubTrue,hn.multiply=Qp.multiply,hn.nth=Yp.nth,hn.noop=uf.noop,hn.now=Kp,hn.pad=af.pad,hn.padEnd=af.padEnd,hn.padStart=af.padStart,hn.parseInt=af.parseInt,hn.random=nf,hn.reduce=Zp.reduce,hn.reduceRight=Zp.reduceRight,hn.repeat=af.repeat,hn.replace=af.replace,hn.result=rf.result,hn.round=Qp.round,hn.sample=Zp.sample,hn.size=Zp.size,hn.snakeCase=af.snakeCase,hn.some=Zp.some,hn.sortedIndex=Yp.sortedIndex,hn.sortedIndexBy=Yp.sortedIndexBy,hn.sortedIndexOf=Yp.sortedIndexOf,hn.sortedLastIndex=Yp.sortedLastIndex,hn.sortedLastIndexBy=Yp.sortedLastIndexBy,hn.sortedLastIndexOf=Yp.sortedLastIndexOf,hn.startCase=af.startCase,hn.startsWith=af.startsWith,hn.subtract=Qp.subtract,hn.sum=Qp.sum,hn.sumBy=Qp.sumBy,hn.template=af.template,hn.times=uf.times,hn.toFinite=Jp.toFinite,hn.toInteger=_e,hn.toLength=Jp.toLength,hn.toLower=af.toLower,hn.toNumber=Jp.toNumber,hn.toSafeInteger=Jp.toSafeInteger,hn.toString=Jp.toString,hn.toUpper=af.toUpper,hn.trim=af.trim,hn.trimEnd=af.trimEnd,hn.trimStart=af.trimStart,hn.truncate=af.truncate,hn.unescape=af.unescape,hn.uniqueId=uf.uniqueId,hn.upperCase=af.upperCase,hn.upperFirst=af.upperFirst,hn.each=Zp.forEach,hn.eachRight=Zp.forEachRight,hn.first=Yp.head,bf(hn,(df={},js(hn,(function(t,e){vf.call(hn.prototype,e)||(df[e]=t)})),df),{chain:!1}),hn.VERSION="4.17.21",(hn.templateSettings=af.templateSettings).imports._=hn,En(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){hn[t].placeholder=hn})),En(["drop","take"],(function(t,e){en.prototype[t]=function(n){n=void 0===n?1:yf(_e(n),0);var r=this.__filtered__&&!e?new en(this):this.clone();return r.__filtered__?r.__takeCount__=mf(n,r.__takeCount__):r.__views__.push({size:mf(n,pf),type:t+(r.__dir__<0?"Right":"")}),r},en.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),En(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;en.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Ts(t),type:n}),e.__filtered__=e.__filtered__||r,e}})),En(["head","last"],(function(t,e){var n="take"+(e?"Right":"");en.prototype[t]=function(){return this[n](1).value()[0]}})),En(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");en.prototype[t]=function(){return this.__filtered__?new en(this):this[n](1)}})),en.prototype.compact=function(){return this.filter(we)},en.prototype.find=function(t){return this.filter(t).head()},en.prototype.findLast=function(t){return this.reverse().find(t)},en.prototype.invokeMap=Nr((function(t,e){return"function"==typeof t?new en(this):this.map((function(n){return Oc(n,t,e)}))})),en.prototype.reject=function(t){return this.filter(fd(Ts(t)))},en.prototype.slice=function(t,e){t=_e(t);var n=this;return n.__filtered__&&(t>0||e<0)?new en(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=_e(e))<0?n.dropRight(-e):n.take(e-t)),n)},en.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},en.prototype.toArray=function(){return this.take(pf)},js(en.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),i=hn[r?"take"+("last"==e?"Right":""):e],o=r||/^find/.test(e);i&&(hn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,u=e instanceof en,s=a[0],l=u||te(e),c=function(t){var e=i.apply(hn,Bi([t],a));return r&&d?e[0]:e};l&&n&&"function"==typeof s&&1!=s.length&&(u=l=!1);var d=this.__chain__,h=!!this.__actions__.length,p=o&&!d,f=u&&!h;if(!o&&l){e=f?e:new en(this);var v=t.apply(e,a);return v.__actions__.push({func:fp,args:[c],thisArg:void 0}),new sn(v,d)}return p&&f?t.apply(this,a):(v=this.thru(c),p?r?v.value()[0]:v.value():v)})})),En(["pop","push","shift","sort","splice","unshift"],(function(t){var e=ff[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);hn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(te(i)?i:[],t)}return this[n]((function(n){return e.apply(te(n)?n:[],t)}))}})),js(en.prototype,(function(t,e){var n=hn[e];if(n){var r=n.name+"";vf.call(on,r)||(on[r]=[]),on[r].push({name:e,func:n})}})),on[$n(void 0,2).name]=[{name:"wrapper",func:void 0}],en.prototype.clone=function(){var t=new en(this.__wrapped__);return t.__actions__=ln(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=ln(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=ln(this.__views__),t},en.prototype.reverse=function(){if(this.__filtered__){var t=new en(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},en.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=te(t),r=e<0,i=n?t.length:0,o=function(t,e,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=lf(e,t+a);break;case"takeRight":t=sf(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,u=o.end,s=u-a,l=r?u:a-1,c=this.__iteratees__,d=c.length,h=0,p=cf(s,this.__takeCount__);if(!n||!r&&i==s&&p==s)return yp(t,this.__actions__);var f=[];t:for(;s--&&h<p;){for(var v=-1,g=t[l+=e];++v<d;){var y=c[v],m=y.iteratee,b=y.type,x=m(g);if(2==b)g=x;else if(!x){if(1==b)continue t;break t}}f[h++]=g}return f},hn.prototype.at=of.at,hn.prototype.chain=of.wrapperChain,hn.prototype.commit=of.commit,hn.prototype.next=of.next,hn.prototype.plant=of.plant,hn.prototype.reverse=of.reverse,hn.prototype.toJSON=hn.prototype.valueOf=hn.prototype.value=of.value,hn.prototype.first=hn.prototype.head,gf&&(hn.prototype[gf]=of.toIterator),hf={__e:function(t,e,n,r){for(var i,o,a;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(t)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(t,r||{}),a=i.__d),a)return i.__E=i}catch(e){t=e}throw t}},"function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout;var xf=0;function _f(t,e,n,r,i,o){e||(e={});var a,u,s=e;if("ref"in s)for(u in s={},e)"ref"==u?a=e[u]:s[u]=e[u];var l={type:t,props:s,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--xf,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof t&&(a=t.defaultProps))for(u in a)void 0===s[u]&&(s[u]=a[u]);return hf.vnode&&hf.vnode(l),l}var wf=e.LogicFlowUtil.StepDrag,Mf=function(t){function n(n){var r=t.call(this)||this;return r.updatePosition=function(t){var e=t.deltaX,n=t.deltaY,i=r.nodeModel,o=i.x,a=i.y;r.nodeModel.x=o+e/2,r.nodeModel.y=a+n/2,r.nodeModel.moveText(e/2,n/2)},r.getResize=function(t){var e=t.index,n=t.deltaX,r=t.deltaY,i=t.width,o=t.height,a=t.PCTResizeInfo,u=t.pct,s=void 0===u?1:u,l=t.freezeWidth,c=void 0!==l&&l,d=t.freezeHeight,h=void 0!==d&&d,p={width:i,height:o,deltaX:n,deltaY:r};if(a){var f=0,v=0;switch(e){case 0:v=(-1*n-r)/4;break;case 1:v=(n-r)/4;break;case 2:v=(n+r)/4;break;case 3:v=(-1*n+r)/4}0!==v&&(f=Math.round(v/a.ResizeBasis.basisHeight*1e5)/1e3),a.ResizePCT.widthPCT=Math.max(Math.min(a.ResizePCT.widthPCT+f,a.ScaleLimit.maxScaleLimit),a.ScaleLimit.minScaleLimit),a.ResizePCT.heightPCT=Math.max(Math.min(a.ResizePCT.heightPCT+f,a.ScaleLimit.maxScaleLimit),a.ScaleLimit.minScaleLimit);var g=Math.round(a.ResizePCT.widthPCT*a.ResizeBasis.basisWidth/100),y=Math.round(a.ResizePCT.heightPCT*a.ResizeBasis.basisHeight/100);switch(e){case 0:n=i-g,r=o-y;break;case 1:n=g-i,r=o-y;break;case 2:n=g-i,r=y-o;break;case 3:n=i-g,r=y-o}return p.width=g,p.height=y,p.deltaX=n/s,p.deltaY=r/s,p}switch(e){case 0:p.width=c?i:i-n*s,p.height=h?o:o-r*s;break;case 1:p.width=c?i:i+n*s,p.height=h?o:o-r*s;break;case 2:p.width=c?i:i+n*s,p.height=h?o:o+r*s;break;case 3:p.width=c?i:i-n*s,p.height=h?o:o+r*s}return p},r.updateEdgePointByAnchors=function(){var t=r.nodeModel,e=t.id,n=t.anchors,i=r.getNodeEdges(e);i.sourceEdges.forEach((function(t){var e=n.find((function(e){return e.id===t.sourceAnchorId}));e&&t.updateStartPoint({x:e.x,y:e.y})})),i.targetEdges.forEach((function(t){var e=n.find((function(e){return e.id===t.targetAnchorId}));e&&t.updateEndPoint({x:e.x,y:e.y})}))},r.updateRect=function(t){var e=t.deltaX,n=t.deltaY,i=r.nodeModel,o=i.x,a=i.y,u=i.width,s=i.height,l=i.radius,c=i.PCTResizeInfo,d=r.nodeModel,h=d.minWidth,p=d.minHeight,f=d.maxWidth,v=d.maxHeight,g=r.index,y=h===f,m=p===v,b=r.getResize({index:g,deltaX:e,deltaY:n,width:u,height:s,PCTResizeInfo:c,pct:1,freezeWidth:y,freezeHeight:m});if(b.width<h||b.width>f||b.height<p||b.height>v)r.dragHandler.cancelDrag();else{r.updatePosition({deltaX:y?0:b.deltaX,deltaY:m?0:b.deltaY}),r.nodeModel.width=b.width,r.nodeModel.height=b.height,r.nodeModel.setProperties({nodeSize:{width:b.width,height:b.height}});var x={x:o,y:a,width:u,height:s,radius:l},_={x:r.nodeModel.x,y:r.nodeModel.y,width:r.nodeModel.width,height:r.nodeModel.height,radius:l};r.updateEdgePointByAnchors(),r.eventEmit({beforeNode:x,afterNode:_})}},r.updateEllipse=function(t){var e=t.deltaX,n=t.deltaY,i=r.nodeModel,o=i.rx,a=i.ry,u=i.x,s=i.y,l=i.PCTResizeInfo,c=r.index,d=r.nodeModel,h=d.minWidth,p=d.minHeight,f=d.maxWidth,g=d.maxHeight,y=h===f,m=p===g,b=o,x=a,_=r.getResize({index:c,deltaX:e,deltaY:n,width:b,height:x,PCTResizeInfo:l,pct:.5,freezeWidth:y,freezeHeight:m});if(_.width<h/2||_.width>f/2||_.height<p/2||_.height>g/2)r.dragHandler.cancelDrag();else{r.updatePosition({deltaX:y?0:_.deltaX,deltaY:m?0:_.deltaY}),r.nodeModel.rx=_.width,r.nodeModel.ry=_.height,r.nodeModel.setProperties({nodeSize:{rx:_.width,ry:_.height}});var w={x:u,y:s},M={rx:_.width,ry:_.height,x:r.nodeModel.x,y:r.nodeModel.y};r.updateEdgePointByAnchors(),r.eventEmit({beforeNode:v(v({},w),{rx:o,ry:a}),afterNode:M})}},r.updateDiamond=function(t){var e=t.deltaX,n=t.deltaY,i=r.nodeModel,o=i.rx,a=i.ry,u=i.x,s=i.y,l=i.PCTResizeInfo,c=r.index,d=r.nodeModel,h=d.minWidth,p=d.minHeight,f=d.maxWidth,v=d.maxHeight,g=h===f,y=p===v,m=o,b=a,x=r.getResize({index:c,deltaX:e,deltaY:n,width:m,height:b,PCTResizeInfo:l,pct:.5,freezeWidth:g,freezeHeight:y});if(x.width<h/2||x.width>f/2||x.height<p/2||x.height>v/2)r.dragHandler.cancelDrag();else{r.updatePosition({deltaX:g?0:x.deltaX,deltaY:y?0:x.deltaY}),r.nodeModel.rx=x.width,r.nodeModel.ry=x.height,r.nodeModel.setProperties({nodeSize:{rx:x.width,ry:x.height}});var _={x:u,y:s,rx:o,ry:a},w={rx:x.width,ry:x.height,x:r.nodeModel.x,y:r.nodeModel.y};r.updateEdgePointByAnchors(),r.eventEmit({beforeNode:_,afterNode:w})}},r.eventEmit=function(t){var e=t.beforeNode,n=t.afterNode,i=r.nodeModel,o=i.id,a=i.modelType,u=i.type,s=v({id:o,modelType:a,type:u},e),l=v({id:o,modelType:a,type:u},n);r.graphModel.eventCenter.emit("node:resize",{oldNodeSize:s,newNodeSize:l})},r.onDragging=function(t){var n,i=t.deltaX,o=t.deltaY,a=r.graphModel.transformModel,u=r.nodeModel.modelType;i=(n=x(a.fixDeltaXY(i,o),2))[0],o=n[1],u===e.ModelType.RECT_NODE||u===e.ModelType.HTML_NODE?r.updateRect({deltaX:i,deltaY:o}):u===e.ModelType.ELLIPSE_NODE?r.updateEllipse({deltaX:i,deltaY:o}):u===e.ModelType.DIAMOND_NODE&&r.updateDiamond({deltaX:i,deltaY:o})},r.onDragEnd=function(){var t=r.graphModel.gridSize,e=void 0===t?1:t,n=e*Math.round(r.nodeModel.x/e),i=e*Math.round(r.nodeModel.y/e);r.nodeModel.moveTo(n,i),r.updateEdgePointByAnchors()},r.index=n.index,r.nodeModel=n.model,r.graphModel=n.graphModel,r.dragHandler=new wf({onDragging:r.onDragging,onDragEnd:r.onDragEnd,step:1}),r}return f(n,t),n.prototype.getNodeEdges=function(t){for(var e=this.graphModel.edges,n=[],r=[],i=0;i<e.length;i++){var o=e[i];o.sourceNodeId===t?n.push(o):e[i].targetNodeId===t&&r.push(o)}return{sourceEdges:n,targetEdges:r}},n.prototype.render=function(){var t=this.props,n=t.x,r=t.y,i=t.index,o=t.model.getControlPointStyle();return _f("g",{className:"lf-resize-control-".concat(i),children:_f(e.Rect,v({className:"lf-node-control",x:n,y:r},o,{onMouseDown:this.dragHandler.handleMouseDown}))})},n}(e.Component),Ef=function(t){function n(){var e=t.call(this)||this;return e.state={},e}return f(n,t),n.prototype.getResizeControl=function(){var t=this.props,e=t.model,n=t.graphModel,r=e.x,i=e.y,o=e.width,a=e.height,u={minX:r-o/2,minY:i-a/2,maxX:r+o/2,maxY:i+a/2},s=u.minX,l=u.minY,c=u.maxX,d=u.maxY;return[{x:s,y:l},{x:c,y:l},{x:c,y:d},{x:s,y:d}].map((function(t,r){return _f(Mf,v({index:r},t,{model:e,graphModel:n}))}))},n.prototype.getGroupSolid=function(){var t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.getResizeOutlineStyle();return _f(e.Rect,v({},a,{x:n,y:r,width:i,height:o}))},n.prototype.render=function(){return _f("g",{className:"lf-resize-control",children:[this.getGroupSolid(),this.getResizeControl()]})},n}(e.Component),Nf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=e.properties.nodeSize;return i&&(r.rx=i.rx,r.ry=i.ry),r}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={basisWidth:this.rx,basisHeight:this.ry},n={maxScaleLimit:Math.min(this.maxWidth/(2*this.rx)*100,this.maxHeight/(2*this.ry)*100),minScaleLimit:Math.max(this.minWidth/(2*this.rx)*100,this.minHeight/(2*this.ry)*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.EllipseNodeModel),Sf=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return _f(Ef,{model:e,graphModel:n})},e.prototype.getResizeShape=function(){return t.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,e=t.model,n=t.graphModel.editConfigModel.isSilentMode;return _f("g",{children:[this.getResizeShape(),e.isSelected&&!n?this.getControlGroup():""]})},e}(e.EllipseNode),Af={type:"ellipse",view:Sf,model:Nf},Pf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=e.properties.nodeSize;return i&&(r.rx=i.rx,r.ry=i.ry),r}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.gridSize=1},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={basisWidth:this.rx,basisHeight:this.ry},n={maxScaleLimit:Math.min(this.maxWidth/(2*this.rx)*100,this.maxHeight/(2*this.ry)*100),minScaleLimit:Math.max(this.minWidth/(2*this.rx)*100,this.minHeight/(2*this.ry)*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.DiamondNodeModel),Tf=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return _f(Ef,{model:e,graphModel:n})},n.prototype.getResizeShape=function(){var t=this.props.model,n=t.points,r=t.getNodeStyle();return _f("g",{children:_f(e.Polygon,v({},r,{points:n}))})},n.prototype.getShape=function(){var t=this.props,e=t.model.isSelected,n=t.graphModel.editConfigModel.isSilentMode;return _f("g",{children:[this.getResizeShape(),e&&!n?this.getControlGroup():""]})},n}(e.DiamondNode),kf={type:"diamond",view:Tf,model:Pf},Cf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=e.properties.nodeSize;return i&&(r.width=i.width,r.height=i.height),r}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={basisWidth:this.width,basisHeight:this.height},n={maxScaleLimit:Math.min(this.maxWidth/this.width*100,this.maxHeight/this.height*100),minScaleLimit:Math.max(this.minWidth/this.width*100,this.minHeight/this.height*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.HtmlNodeModel),Of=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return _f(Ef,{model:e,graphModel:n})},e.prototype.getResizeShape=function(){return t.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,e=t.model.isSelected,n=t.graphModel.editConfigModel.isSilentMode;return _f("g",{children:[this.getResizeShape(),e&&!n?this.getControlGroup():""]})},e}(e.HtmlNode),If={type:"html",view:Of,model:Cf},jf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=e.properties.nodeSize;return i&&(r.width=i.width,r.height=i.height),r}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={basisWidth:this.width,basisHeight:this.height},n={maxScaleLimit:Math.min(this.maxWidth/this.width*100,this.maxHeight/this.height*100),minScaleLimit:Math.max(this.minWidth/this.width*100,this.minHeight/this.height*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.RectNodeModel),Rf=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return _f(Ef,{model:e,graphModel:n})},e.prototype.getResizeShape=function(){return t.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,e=t.model.isSelected,n=t.graphModel.editConfigModel.isSilentMode;return _f("g",{children:[this.getResizeShape(),e&&!n?this.getControlGroup():""]})},e}(e.RectNode),Df={type:"rect",view:Rf,model:jf},Lf={pluginName:"nodeResize",step:0,install:function(t){t.register(Af),t.register(kf),t.register(If),t.register(Df)}},Bf=function(t){function e(){var e=t.apply(this,_([],x(arguments),!1))||this;return e.isGroup=!0,e.isFolded=!1,e.unfoldedWidth=500,e.unfoldedHeight=300,e.childrenLastFoldStatus={},e}return f(e,t),e.prototype.initNodeData=function(e){var n=this;t.prototype.initNodeData.call(this,e);var r=[];Array.isArray(e.children)&&(r=e.children),this.children=new Set(r),this.width=500,this.height=300,this.foldedWidth=80,this.foldedHeight=60,this.zIndex=-1e4,this.radius=0,this.text.editable=!1,this.text.draggable=!1,this.isRestrict=!1,this.resizable=!1,this.autoToFront=!1,this.foldable=!1,void 0===this.properties.isFolded&&(this.properties.isFolded=!1),this.isFolded=!!this.properties.isFolded,setTimeout((function(){n.isFolded&&n.foldGroup(n.isFolded)}))},e.prototype.getResizeOutlineStyle=function(){var e=t.prototype.getResizeOutlineStyle.call(this);return e.stroke="none",e},e.prototype.foldGroup=function(t){var e=this;if(t!==this.isFolded){this.setProperty("isFolded",t),this.isFolded=t,t?(this.x=this.x-this.width/2+this.foldedWidth/2,this.y=this.y-this.height/2+this.foldedHeight/2,this.unfoldedWidth=this.width,this.unfoldedHeight=this.height,this.width=this.foldedWidth,this.height=this.foldedHeight):(this.width=this.unfoldedWidth,this.height=this.unfoldedHeight,this.x=this.x+this.width/2-this.foldedWidth/2,this.y=this.y+this.height/2-this.foldedHeight/2);var n=_(_([],x(this.incoming.edges),!1),x(this.outgoing.edges),!1);this.children.forEach((function(r){var i=e.graphModel.getElement(r);if(i){var o=i.isFolded;if(i.isGroup&&!i.isFolded&&i.foldGroup(t),i.isGroup&&!t){var a=e.childrenLastFoldStatus[r];void 0!==a&&a!==i.isFolded&&i.foldGroup(a)}e.childrenLastFoldStatus[r]=!!o,i.visible=!t;var u=i.incoming.edges,s=i.outgoing.edges;n=_(_(_([],x(n),!1),x(u),!1),x(s),!1)}})),this.foldEdge(t,n)}},e.prototype.getAnchorStyle=function(e){var n=t.prototype.getAnchorStyle.call(this,e);return n.stroke="transparent",n.fill="transparent",n.hover.fill="transparent",n.hover.stroke="transparent",n},e.prototype.foldEdge=function(t,e){var n=this;e.forEach((function(e,r){var i=e.id,o=e.sourceNodeId,a=e.targetNodeId,u=e.startPoint,s=e.endPoint,l=e.type,c=e.text,d=e.getProperties(),h={id:"".concat(i,"__").concat(r),sourceNodeId:o,targetNodeId:a,startPoint:u,endPoint:s,type:l,properties:d,text:null==c?void 0:c.value};e.virtual&&n.graphModel.deleteEdgeById(e.id);var p=n.graphModel.group.getNodeGroup(a);p||(p=n.graphModel.getNodeModelById(a));var f=n.graphModel.group.getNodeGroup(o);f||(f=n.graphModel.getNodeModelById(o)),t&&!1!==e.visible&&(n.children.has(o)||n.id===o?(h.startPoint=void 0,h.sourceNodeId=n.id):(h.endPoint=void 0,h.targetNodeId=n.id),p.id===n.id&&f.id===n.id||n.createVirtualEdge(h),e.visible=!1),t||!1!==e.visible||(p&&p.isGroup&&p.isFolded?(h.targetNodeId=p.id,h.endPoint=void 0,n.createVirtualEdge(h)):f&&f.isGroup&&f.isFolded?(h.sourceNodeId=f.id,h.startPoint=void 0,n.createVirtualEdge(h)):e.visible=!0)}))},e.prototype.createVirtualEdge=function(t){t.pointsList=void 0;var e=this.graphModel.addEdge(t);e.virtual=!0,e.text.editable=!1,e.isFoldedEdge=!0},e.prototype.isInRange=function(t){var e=t.x1,n=t.y1,r=t.x2,i=t.y2;return e>=this.x-this.width/2&&r<=this.x+this.width/2&&n>=this.y-this.height/2&&i<=this.y+this.height/2},e.prototype.isAllowMoveTo=function(t){var e=t.x1,n=t.y1,r=t.x2,i=t.y2;return{x:e>=this.x-this.width/2&&r<=this.x+this.width/2,y:n>=this.y-this.height/2&&i<=this.y+this.height/2}},e.prototype.setAllowAppendChild=function(t){this.setProperty("groupAddable",t)},e.prototype.addChild=function(t){this.children.add(t),this.graphModel.eventCenter.emit("group:add-node",{data:this.getData()})},e.prototype.removeChild=function(t){this.children.delete(t),this.graphModel.eventCenter.emit("group:remove-node",{data:this.getData()})},e.prototype.getAddableOutlineStyle=function(){return{stroke:"#FEB663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},e.prototype.getData=function(){var e=this,n=t.prototype.getData.call(this);n.children=[],this.children.forEach((function(t){var r=e.graphModel.getNodeModelById(t);r&&!r.virtual&&n.children.push(t)}));var r=n.properties;return null==r||delete r.groupAddable,null==r||delete r.isFolded,n},e.prototype.getHistoryData=function(){var e=t.prototype.getData.call(this);e.children=_([],x(this.children),!1),e.isGroup=!0;var n=e.properties;return null==n||delete n.groupAddable,(null==n?void 0:n.isFolded)&&(e.x=e.x+this.unfoldedWidth/2-this.foldedWidth/2,e.y=e.y+this.unfoldedHeight/2-this.foldedHeight/2),e},e.prototype.isAllowAppendIn=function(t){return console.info("_nodeData",t),!0},e.prototype.toBack=function(){this.zIndex--},e}(jf),zf=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getControlGroup=function(){var e=this.props.model,n=e.resizable,r=e.properties;return n&&!r.isFolded?t.prototype.getControlGroup.call(this):null},n.prototype.getAddableShape=function(){var t=this.props.model,n=t.width,r=t.height,i=t.x,o=t.y,a=t.radius,u=t.properties,s=t.getAddableOutlineStyle;if(!u.groupAddable)return null;var l=this.props.model.getNodeStyle().strokeWidth,c=void 0===l?0:l,d=s(),h=n+c+8,p=r+c+8;return e.h("rect",v(v({},d),{width:h,height:p,x:i-h/2,y:o-p/2,rx:a,ry:a}))},n.prototype.getFoldIcon=function(){var t=this.props.model,n=t.x-t.width/2+5,r=t.y-t.height/2+5;if(!t.foldable)return null;var i=e.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:t.properties.isFolded?"M ".concat(n+3,",").concat(r+6," ").concat(n+11,",").concat(r+6," M").concat(n+7,",").concat(r+2," ").concat(n+7,",").concat(r+10):"M ".concat(n+3,",").concat(r+6," ").concat(n+11,",").concat(r+6," ")});return e.h("g",{},[e.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#F4F5F6",stroke:"#CECECE",cursor:"pointer",x:t.x-t.width/2+5,y:t.y-t.height/2+5,onClick:function(){t.foldGroup(!t.properties.isFolded)}}),i])},n.prototype.getResizeShape=function(){return e.h("g",{},[this.getAddableShape(),t.prototype.getResizeShape.call(this),this.getFoldIcon()])},n}(Rf),Wf={type:"group",view:zf,model:Bf},Ff=-1e4,Gf=function(){function t(t){var e=t.lf,n=this;this.topGroupZIndex=Ff,this.nodeGroupMap=new Map,this.graphRendered=function(t){var e=t.data;e&&e.nodes&&(e.nodes.forEach((function(t){t.children&&t.children.forEach((function(e){n.nodeGroupMap.set(e,t.id)}))})),n.checkAndCorrectTopGroupZIndex(e.nodes))},this.appendNodeToGroup=function(t){var e=t.data,r=n.nodeGroupMap.get(e.id);if(r){var i=n.lf.getNodeModelById(r);i.removeChild(e.id),n.nodeGroupMap.delete(e.id),i.setAllowAppendChild(!1)}var o=n.lf.getNodeModelById(e.id),a=null==o?void 0:o.getBounds();if(a&&o){var u=n.getGroup(a,e);if(o.isGroup&&(e.children.forEach((function(t){n.nodeGroupMap.set(t,e.id)})),n.checkAndCorrectTopGroupZIndex([e]),n.nodeSelected({data:e,isSelected:!1,isMultiple:!1})),!u)return;if(!u.isAllowAppendIn(e))return void n.lf.emit("group:not-allowed",{group:u.getData(),node:e});u.addChild(e.id),n.nodeGroupMap.set(e.id,u.id),u.setAllowAppendChild(!1)}},this.deleteGroupChild=function(t){var e=t.data;e.children&&e.children.forEach((function(t){n.nodeGroupMap.delete(t),n.lf.deleteNode(t)}));var r=n.nodeGroupMap.get(e.id);r&&(n.lf.getNodeModelById(r).removeChild(e.id),n.nodeGroupMap.delete(e.id))},this.setActiveGroup=function(t){var e=t.data,r=n.lf.getNodeModelById(e.id),i=null==r?void 0:r.getBounds();if(r&&i){var o=n.getGroup(i,e);if(n.activeGroup&&n.activeGroup.setAllowAppendChild(!1),!o||r.isGroup&&o.id===e.id)return;if(!o.isAllowAppendIn(e))return;n.activeGroup=o,n.activeGroup.setAllowAppendChild(!0)}},this.findNodeAndChildMaxZIndex=function(t){var e=Ff;return t.isGroup&&(e=Math.max(e,t.zIndex)),t.children&&t.children.forEach((function(t){"object"==typeof t&&(t=t.id);var r=n.lf.getNodeModelById(t);if(null==r?void 0:r.isGroup){var i=n.findNodeAndChildMaxZIndex(r);e=Math.max(i,e)}})),e},this.checkAndCorrectTopGroupZIndex=function(t){var e=Ff;if(t.forEach((function(t){var r=n.lf.getNodeModelById(t.id);if(r){var i=n.findNodeAndChildMaxZIndex(r);i>e&&(e=i)}})),!(n.topGroupZIndex>=e)){for(var r=n.lf.graphModel.nodes.filter((function(t){return t.isGroup})),i=n.topGroupZIndex,o=0;o<r.length;o++){var a=r[o];a.zIndex>i&&(i=a.zIndex)}n.topGroupZIndex=i}},this.nodeSelected=function(t){var e=t.data,r=t.isMultiple,i=t.isSelected,o=n.lf.getNodeModelById(e.id);if(n.toFrontGroup(o),n.topGroupZIndex>-1e3){n.topGroupZIndex=Ff;for(var a=n.lf.graphModel.nodes.filter((function(t){return t.isGroup})).sort((function(t,e){return t.zIndex-e.zIndex})),u=0,s=0;s<a.length;s++){var l=a[s];l.zIndex!==u&&(n.topGroupZIndex++,u=l.zIndex),l.setZIndex(n.topGroupZIndex)}}if(r&&i)if(null==o?void 0:o.isGroup)o.children.forEach((function(t){var e=n.lf.graphModel.getElement(t);null==e||e.setSelected(!1)}));else{var c=n.nodeGroupMap.get(e.id);if(c){var d=n.lf.getNodeModelById(c);(null==d?void 0:d.isSelected)&&(null==o||o.setSelected(!1))}}},this.toFrontGroup=function(t){t&&t.isGroup&&(n.topGroupZIndex++,t.setZIndex(n.topGroupZIndex),t.children&&t.children.forEach((function(t){var e=n.lf.getNodeModelById(t);n.toFrontGroup(e)})))},e.register(Wf),this.lf=e,e.graphModel.addNodeMoveRules((function(t,r,i){if(t.isGroup){var o=n.getNodeAllChild(t);return e.graphModel.moveNodes(o,r,i,!0),!0}var a=e.getNodeModelById(n.nodeGroupMap.get(t.id));if(a&&a.isRestrict){var u=t.getBounds(),s=u.x1,l=u.y1,c=u.x2,d=u.y2;return a.isAllowMoveTo({x1:s+r,y1:l+i,x2:c+r,y2:d+i})}return!0})),e.graphModel.group=this,e.on("node:add,node:drop,node:dnd-add",this.appendNodeToGroup),e.on("node:delete",this.deleteGroupChild),e.on("node:dnd-drag,node:drag",this.setActiveGroup),e.on("node:click",this.nodeSelected),e.on("graph:rendered",this.graphRendered),e.addElements=function(t,r){var i=t.nodes,o=t.edges,a={},u={nodes:[],edges:[]},s=[];return ml(i,(function(t){var i=t.id,o=t.children,l=g(t,["children"]),c=e.addNode(l);if(!c)return{nodes:[],edges:[]};i&&(a[i]=c.id),u.nodes.push(c);var d=n.createAllChildNodes(a,o,c,r).edgesArray;s.push.apply(s,_([],x(d),!1))})),s.forEach((function(t){n.createEdgeModel(t,a,r)})),ml(o,(function(t){var e=n.createEdgeModel(t,a,0);u.edges.push(e)})),u}}return t.prototype.createAllChildNodes=function(t,n,r,i){var o=this,a=this.lf,u=[],s=[],l=[];null==n||n.forEach((function(n){var c=a.getNodeModelById(n);if(c){var d=c.x,h=c.y,p=c.properties,f=c.type,g=c.text,y=c.rotate,m=c.children,b=e.EventType.NODE_GROUP_COPY||"node:group-copy-add",w=a.addNode({x:d+i,y:h+i,properties:p,type:f,text:v(v({},g),{x:g.x+i,y:g.y+i}),rotate:y},b);if(r.addChild(w.id),t[n]=w.id,l.push(w),c.incoming.edges.forEach((function(t){s.push(t)})),c.outgoing.edges.forEach((function(t){s.push(t)})),m instanceof Set){var M=o.createAllChildNodes(t,m,w,i),E=M.nodesArray,N=M.edgesArray;l.push.apply(l,_([],x(E),!1)),u.push.apply(u,_([],x(N),!1))}}}));var c=s.filter((function(e){return t[e.sourceNodeId]&&t[e.targetNodeId]})).map((function(t){return t.getData()}));return{nodesArray:l,edgesArray:u.concat(c)}},t.prototype.createEdgeModel=function(t,e,n){var r=this.lf,i=t.sourceNodeId,o=t.targetNodeId;e[i]&&(i=e[i]),e[o]&&(o=e[o]);var a=t.type,u=t.startPoint,s=t.endPoint,l=t.pointsList,c=t.text,d={x:((null==u?void 0:u.x)||0)+n,y:((null==u?void 0:u.y)||0)+n},h={x:((null==s?void 0:s.x)||0)+n,y:((null==s?void 0:s.y)||0)+n},p=[];l&&l.length>0&&(p=l.map((function(t){return t.x+=n,t.y+=n,t})));var f=c;return c&&"string"!=typeof c&&(f.x=c.x+n,f.y=c.y+n),r.graphModel.addEdge({type:a,startPoint:d,endPoint:h,sourceNodeId:i,targetNodeId:o,pointsList:p,text:f})},t.prototype.getNodeAllChild=function(t){var e=this,n=[];return t.children&&t.children.forEach((function(t){n.push(t);var r=e.lf.getNodeModelById(t);(null==r?void 0:r.isGroup)&&(n=n.concat(e.getNodeAllChild(r)))})),n},t.prototype.getGroup=function(t,e){var n=this.lf.graphModel.nodes.filter((function(n){return n.isGroup&&n.isInRange(t)&&n.id!==e.id}));if(0!==n.length){if(1===n.length)return n[0];for(var r=n[n.length-1],i=n.length-2;i>=0;i--)n[i].zIndex>r.zIndex&&(r=n[i]);return r}},t.prototype.getNodeGroup=function(t){var e=this.nodeGroupMap.get(t);if(e)return this.lf.getNodeModelById(e)},t.prototype.render=function(){},t.prototype.destroy=function(){},t.pluginName="group",t}();function Hf(){var t=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getFoldIcon=function(){var t=this.props.model,n=t,r=n.x,i=n.y,o=n.width,a=n.height,u=n.properties,s=n.foldable,l=t.x-t.width/2+5,c=t.y-t.height/2+5;if(!s)return null;var d=e.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:u.isFolded?"M ".concat(l+3,",").concat(c+6," ").concat(l+11,",").concat(c+6," M").concat(l+7,",").concat(c+2," ").concat(l+7,",").concat(c+10):"M ".concat(l+3,",").concat(c+6," ").concat(l+11,",").concat(c+6," ")});return e.h("g",{},[e.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#F4F5F6",stroke:"#CECECE",cursor:"pointer",x:r-o/2+5,y:i-a/2+5,onClick:function(e){var n,r;null===(r=(n=e.stopPropagation()(t)).foldGroup)||void 0===r||r.call(n,!u.isFolded)}}),d])},n.prototype.getResizeShape=function(){var t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.getNodeStyle(),u=v(v({},a),{x:n-i/2,y:r-o/2,width:i,height:o,stroke:"black",strokeWidth:2,strokeDasharray:"0 0"});return e.h("g",{},[e.h("rect",v({},u)),this.getFoldIcon()])},n}(zf),n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.foldable=!0,this.resizable=!0,this.width=400,this.height=200,this.resetWidthHeight(),this.isTaskNode=!0,this.boundaryEvents=[]},e.prototype.resetWidthHeight=function(){var t,e,n=null===(t=this.properties.iniProp)||void 0===t?void 0:t.width,r=null===(e=this.properties.iniProp)||void 0===e?void 0:e.height;n&&(this.width=n),r&&(this.height=r)},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this);return e.stroke="#989891",e.strokeWidth=1,e.strokeDasharray="3 3",this.isSelected&&(e.stroke="rgb(124, 15, 255)"),this.properties.isBoundaryEventTouchingTask&&(e.stroke="#00acff",e.strokeWidth=2),e},e.prototype.addChild=function(e){var n=this.graphModel.getElement(e);null==n||n.setProperties({parent:this.id}),t.prototype.addChild.call(this,e)},e.prototype.getAnchorStyle=function(){var e=t.prototype.getAnchorStyle.call(this);return e.stroke="#000",e.fill="#fff",e.hover||(e.hover={}),e.hover.stroke="transparent",e},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return e.stroke="transparent",e.hover||(e.hover={}),e.hover.stroke="transparent",e},e.prototype.setTouching=function(t){this.setProperty("isBoundaryEventTouchingTask",t)},e.prototype.addBoundaryEvent=function(t){if(this.setTouching(!1),this.boundaryEvents.find((function(e){return e===t})))return!1;var e=this.graphModel.getNodeModelById(t);return null==e||e.setProperties({attachedToRef:this.id}),this.boundaryEvents.push(t),!0},e.prototype.deleteBoundaryEvent=function(t){this.boundaryEvents=this.boundaryEvents.filter((function(e){return e!==t}))},e}(Bf);return{type:"bpmn:subProcess",view:t,model:n}}function Xf(t){var e=jt("bpmn:serviceTask",St),n=jt("bpmn:userTask",At);t.register(e),t.register(n),t.register(Hf()),function(t){function e(t,e){var n=t.x,r=t.y,i=t.width,o=t.height,a=t.id,u=n-i/2,s=n+i/2,l=r-o/2,c=r+o/2,d=e.x,h=e.y;return d>u-5&&d<s+5&&h>l-5&&h<c+5&&!(d>u+5&&d<s-5&&h>l+5&&h<c-5)?a:null}t.on("node:drag,node:dnd-drag",(function(n){var r,i,o=n.data;if("bpmn:boundaryEvent"===o.type){var a=t.graphModel.nodes;try{for(var u=b(a),s=u.next();!s.done;s=u.next()){var l=s.value;l.isTaskNode&&(e(l,o)?l.setTouching(!0):l.setTouching(!1))}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}})),t.on("node:drop,node:dnd-add",(function(n){var r,i,o=n.data,a=o.type,u=o.id;if("bpmn:boundaryEvent"===a){var s=t.graphModel.nodes;try{for(var l=b(s),c=l.next();!c.done;c=l.next()){var d,h=c.value;if(h.isTaskNode)if(null!==(d=e(h,o))){var p=t.graphModel.getNodeModelById(u),f=t.graphModel.getNodeModelById(d),v=p.properties.attachedToRef;return v&&v!==d&&t.graphModel.getNodeModelById(v).deleteBoundaryEvent(u),void f.addBoundaryEvent(u)}}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}})),t.graphModel.addNodeMoveRules((function(e,n,r){if(e.isTaskNode){var i=e.boundaryEvents;return t.graphModel.moveNodes(i,n,r,!0),!0}return!0}))}(t)}function Uf(t){var n=function(e){function n(n,r){n.id||(n.id="Flow_".concat(ft()));var i=v(v(v({},t||{}),n.properties),{isDefaultFlow:!1});return n.properties=i,e.call(this,n,r)||this}return f(n,e),n.extendKey="SequenceFlowModel",n}(e.PolylineEdgeModel),r=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getStartArrow=function(){return this.props.model.properties.isDefaultFlow?e.h("path",{refX:15,stroke:"#000000",strokeWidth:2,d:"M 20 5 10 -5 z"}):e.h("path",{d:""})},n.extendKey="SequenceFlowEdge",n}(e.PolylineEdge);return{type:"bpmn:sequenceFlow",view:r,model:n}}var Vf=Uf();var qf=[{nodes:["startEvent","intermediateCatchEvent","boundaryEvent"],definition:[{type:"bpmn:timerEventDefinition",icon:_t,properties:{definitionType:"bpmn:timerEventDefinition",timerValue:"",timerType:""}}]}];function Yf(t){function e(e){e.forEach((function(e){var n,r;n=e.nodes,r=e.definition,n.forEach((function(e){(null==t?void 0:t[e])||(t[e]=new Map);var n=null==t?void 0:t[e];r.forEach((function(t){n.set(t.type,t)}))}))}))}return function(){return[t,e]}}var Zf=function(){function t(t){var e=t.lf;e.definition={},e.useDefinition=Yf(e.definition);var n=x(e.useDefinition(),2),r=n[0],i=n[1];console.log("_definition",r),i(qf),function(t){t.register(mt(t)),t.register(gt(t)),t.register(yt(t)),t.register(xt(t)),t.register(bt(t))}(e),function(t){var e=Ot("bpmn:exclusiveGateway",Mt),n=Ot("bpmn:parallelGateway",Et),r=Ot("bpmn:inclusiveGateway",Nt);t.register(e),t.register(r),t.register(n)}(e),function(t){t.register(Vf)}(e),Xf(e),e.setDefaultEdgeType("bpmn:sequenceFlow")}return t.pluginName="BpmnElementsPlugin",t}(),Kf=40,$f=40,Jf=40,Qf=40,tv=100,ev=80,nv=100,rv=80,iv=100,ov=80,av=100,uv=80,sv=100,lv=80,cv=100,dv=80,hv=100,pv=80,fv=100,vv=80,gv=function(){};(gv.ObjTree=function(){return this}).VERSION="0.23",gv.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',gv.ObjTree.prototype.attr_prefix="-",gv.ObjTree.prototype.parseXML=function(t){var e;if(window.DOMParser){var n=new DOMParser,r=n.parseFromString(t,"application/xml");if(!r)return;e=r.documentElement}else window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async=!1,n.loadXML(t),e=n.documentElement);if(e)return this.parseDOM(e)},gv.ObjTree.prototype.parseHTTP=function(t,e,n){var r,i={};for(var o in e)i[o]=e[o];if(i.method||(void 0===i.postBody&&void 0===i.postbody&&void 0===i.parameters?i.method="get":i.method="post"),n){i.asynchronous=!0;var a=this,u=n,s=i.onComplete;i.onComplete=function(t){var e;t&&t.responseXML&&t.responseXML.documentElement&&(e=a.parseDOM(t.responseXML.documentElement)),u(e,t),s&&s(t)}}else i.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)i.uri=t,(l=new HTTP.Request(i))&&(r=l.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var l;(l=new Ajax.Request(t,i))&&(r=l.transport)}return n?r:r&&r.responseXML&&r.responseXML.documentElement?this.parseDOM(r.responseXML.documentElement):void 0},gv.ObjTree.prototype.parseDOM=function(t){if(t){if(this.__force_array={},this.force_array)for(var e=0;e<this.force_array.length;e++)this.__force_array[this.force_array[e]]=1;var n=this.parseElement(t);if(this.__force_array[t.nodeName]&&(n=[n]),11!==t.nodeType){var r={};r[t.nodeName]=n,n=r}return n}},gv.ObjTree.prototype.parseElement=function(t){if(7!==t.nodeType){if(3===t.nodeType||4===t.nodeType||8===t.nodeType){if(null==t.nodeValue.match(/[^\x00-\x20]/))return;return t.nodeValue}var e=null,n={};if(t.attributes&&t.attributes.length){e={};for(var r=0;r<t.attributes.length;r++){if("string"==typeof(u=t.attributes[r].nodeName)){var i=t.attributes[r].nodeValue;try{i=JSON.parse(t.attributes[r].nodeValue.replace(/'/g,'"'))}catch(e){i=t.attributes[r].nodeValue}null!=i&&(void 0===n[u=this.attr_prefix+u]&&(n[u]=0),n[u]++,this.addNode(e,u,n[u],i))}}}if(t.childNodes&&t.childNodes.length){var o=!0;e&&(o=!1);for(r=0;r<t.childNodes.length&&o;r++){var a=t.childNodes[r].nodeType;3!==a&&4!==a&&8!==a&&(o=!1)}if(o){e||(e="");for(r=0;r<t.childNodes.length;r++)e+=t.childNodes[r].nodeValue}else{e||(e={});for(r=0;r<t.childNodes.length;r++){var u;if("string"==typeof(u=t.childNodes[r].nodeName))(i=this.parseElement(t.childNodes[r]))&&(void 0===n[u]&&(n[u]=0),n[u]++,this.addNode(e,u,n[u],i))}}}else null===e&&(e={});return e}},gv.ObjTree.prototype.addNode=function(t,e,n,r){this.__force_array[e]?(1===n&&(t[e]=[]),t[e][t[e].length]=r):1===n?t[e]=r:2===n?t[e]=[t[e],r]:t[e][t[e].length]=r},gv.ObjTree.prototype.writeXML=function(t){var e=this.hash_to_xml(null,t);return this.xmlDecl+e},gv.ObjTree.prototype.hash_to_xml=function(t,e){var n=[],r=[];for(var i in e)if(lc(e,i)){var o=e[i];i.charAt(0)!==this.attr_prefix?void 0===o||null==o?n[n.length]="<".concat(i," />"):"object"==typeof o&&o.constructor===Array?n[n.length]=this.array_to_xml(i,o):n[n.length]="object"==typeof o?this.hash_to_xml(i,o):this.scalar_to_xml(i,o):r[r.length]=" ".concat(i.substring(1),'="').concat(this.xml_escape(o),'"')}var a=r.join(""),u=n.join("");return void 0===t||null==t||(u=n.length>0?u.match(/\n/)?"<".concat(t).concat(a,">\n").concat(u,"</").concat(t,">\n"):"<".concat(t).concat(a,">").concat(u,"</").concat(t,">\n"):"<".concat(t).concat(a," />\n")),u},gv.ObjTree.prototype.array_to_xml=function(t,e){for(var n=[],r=0;r<e.length;r++){var i=e[r];void 0===i||null==i?n[n.length]="<".concat(t," />"):"object"==typeof i&&i.constructor===Array?n[n.length]=this.array_to_xml(t,i):n[n.length]="object"==typeof i?this.hash_to_xml(t,i):this.scalar_to_xml(t,i)}return n.join("")},gv.ObjTree.prototype.scalar_to_xml=function(t,e){return"#text"===t?this.xml_escape(e):"<".concat(t,">").concat(this.xml_escape(e),"</").concat(t,">\n")},gv.ObjTree.prototype.xml_escape=function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')};function yv(t){return Object.prototype.toString.call(t)}function mv(t){return" ".repeat(t)}function bv(t){return"[object Object]"===yv(t)?Object.keys(t).reduce((function(e,n){var r=n;return"-"===n.charAt(0)&&(r=n.substring(1)),e[r]=bv(t[n]),e}),{}):Array.isArray(t)?t.map((function(t){return bv(t)})):t}var xv,_v="\t\n";function wv(t,e,n){var r=mv(n),i="",o=_v+r;if("-json"===e)return"";if("#text"===e)return o+t;if("#cdata-section"===e)return"".concat(o,"<![CDATA[").concat(t,"]]>");if("#comment"===e)return"".concat(o,"\x3c!--").concat(t,"--\x3e");if("-"==="".concat(e).charAt(0))return" ".concat(e.substring(1),'="').concat(function(t){var e=t;try{"string"!=typeof e&&(e=JSON.parse(t))}catch(n){e=JSON.stringify(bv(t)).replace(/"/g,"'")}return e}(t),'"');if(Array.isArray(t))i+=t.map((function(t){return wv(t,e,n+1)})).join("");else if("[object Object]"===yv(t)){var a=Object.keys(t),u="",s=t["-json"]?_v+mv(n+1)+t["-json"]:"";i+="".concat(0===n?"":o,"<").concat(e),a.forEach((function(e){"-"===e.charAt(0)?u+=wv(t[e],e,n+1):s+=wv(t[e],e,n+1)})),i+=u+(""!==s?">".concat(s).concat(o,"</").concat(e,">"):" />")}else i+="".concat(o,"<").concat(e,">").concat(t.toString(),"</").concat(e,">");return i}!function(t){t.START="bpmn:startEvent",t.END="bpmn:endEvent",t.INTERMEDIATE_CATCH="bpmn:intermediateCatchEvent",t.INTERMEDIATE_THROW="bpmn:intermediateThrowEvent",t.BOUNDARY="bpmn:boundaryEvent",t.PARALLEL_GATEWAY="bpmn:parallelGateway",t.INCLUSIVE_GATEWAY="bpmn:inclusiveGateway",t.EXCLUSIVE_GATEWAY="bpmn:exclusiveGateway",t.USER="bpmn:userTask",t.SYSTEM="bpmn:serviceTask",t.FLOW="bpmn:sequenceFlow",t.SUBPROCESS="bpmn:subProcess"}(xv||(xv={}));var Mv=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef","-children"],Ev=["properties","startPoint","endPoint","pointsList"],Nv={in:[],out:["properties.panels","properties.nodeSize","properties.definitionId","properties.timerValue","properties.timerType","properties.definitionType","properties.parent","properties.isBoundaryEventTouchingTask"]},Sv=function(t,e){return Object.keys(e||{}).forEach((function(n){if(t[n]){var r=e[n],i=r.in,o=r.out;i&&(t[n].in=i),o&&(t[n].out=o)}else t[n]=e[n]})),t},Av={"bpmn:startEvent":{out:function(t){var e,n,r=t.properties;return(null===(n=null===(e=Av[r.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:intermediateCatchEvent":{out:function(t){var e,n,r=t.properties;return(null===(n=null===(e=Av[r.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:intermediateThrowEvent":{out:function(t){var e,n,r=t.properties;return(null===(n=null===(e=Av[r.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:boundaryEvent":{out:function(t){var e,n,r=t.properties;return(null===(n=null===(e=Av[r.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:sequenceFlow":{out:function(t){var e=t.properties,n=e.expressionType,r=e.condition;return r?"cdata"===n?{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[${'.concat(r,"}]]></bpmn:conditionExpression>")}:{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression">'.concat(r,"</bpmn:conditionExpression>")}:{json:""}}},"bpmn:timerEventDefinition":{out:function(t){var e=t.properties,n=e.timerType,r=e.timerValue,i=e.definitionId;return{json:'<bpmn:timerEventDefinition id="'.concat(i,'"').concat(n&&r?">".concat("<bpmn:".concat(n,' xsi:type="bpmn:tFormalExpression">').concat(r,"</bpmn:").concat(n,">"),"</bpmn:timerEventDefinition>"):"/>")}},in:function(t,e){var n,r,i,o=t,a=e["-id"],u="",s="";try{for(var l=b(Object.keys(e)),c=l.next();!c.done;c=l.next()){var d=c.value;d.includes("bpmn:")&&(u=x(d.split(":"),2)[1],s=null===(i=e[d])||void 0===i?void 0:i["#text"])}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return{"-definitionId":a,"-definitionType":o,"-timerType":u,"-timerValue":s}}},"bpmn:conditionExpression":{in:function(t,e){var n,r="",i="";return e["#cdata-section"]?(i="cdata",r=(null===(n=/^\$\{(.*)\}$/g.exec(e["#cdata-section"]))||void 0===n?void 0:n[1])||""):e["#text"]&&(i="normal",r=e["#text"]),{"-condition":r,"-expressionType":i}}}};function Pv(t){var e=null!=t?t:{},n=e.retainedAttrsFields,r=e.excludeFields,i=e.transformer,o=new Set(_(_([],x(Ev),!1),x(n||[]),!1)),a={in:new Set(_(_([],x(Nv.in),!1),x((null==r?void 0:r.in)||[]),!1)),out:new Set(_(_([],x(Nv.out),!1),x((null==r?void 0:r.out)||[]),!1))};return Av=Sv(Av,i),function(t){var e=t.nodes,n=t.edges;return function t(r,i){var u,s;if(1!==(null==r?void 0:r.flag)){var l;if((l=Av[r.type])&&l.out){var c=l.out(r),d=Object.keys(c);d.length>0&&d.forEach((function(t){r[t]=c[t]}))}(null==r?void 0:r.children)&&(r.children=r.children.map((function(t){return e.find((function(e){return e.id===t}))||n.find((function(e){return e.id===t}))||{}})));var h={};if("string"==typeof r)return r;if(Array.isArray(r))return r.map((function(e){return t(e,"")})).filter((function(t){return null!=t}));try{for(var p=b(Object.entries(r)),f=p.next();!f.done;f=p.next()){var v=x(f.value,2),g=v[0],y=v[1];if(1===(null==y?void 0:y.flag))return;var m=[i,g].filter((function(t){return t})).join(".");a.out.has(m)||("object"!=typeof y?0===g.indexOf("-")||["#text","#cdata-section","#comment"].includes(g)?h[g]=y:h["-".concat(g)]=y:o.has(m)?h["-".concat(g)]=t(y,m):h[g]=t(y,m))}}catch(t){u={error:t}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(u)throw u.error}}return h}}(t,"")}}function Tv(t){var e,n,r={};try{for(var i=b(Object.entries(t)),o=i.next();!o.done;o=i.next()){var a=x(o.value,2),u=a[0],s=a[1];0===u.indexOf("-")?r[u.substring(1)]=bv(s):"string"==typeof s?r[u]=s:"[object Object]"===Object.prototype.toString.call(s)?r[u]=Tv(s):Array.isArray(s)?r[u]=s.map((function(t){return Tv(t)})):r[u]=s}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function kv(t,e){t["bpmndi:BPMNEdge"]=e.edges.map((function(t){var e,n=t.id,r=t.pointsList.map((function(t){return{"-x":t.x,"-y":t.y}})),i={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":r};return(null===(e=t.text)||void 0===e?void 0:e.value)&&(i["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-10*t.text.value.length/2,"-y":t.text.y-7,"-width":10*t.text.value.length,"-height":14}}),i})),t["bpmndi:BPMNShape"]=e.nodes.map((function(t){var e,n=t.id,r=100,i=80,o=t.x,a=t.y,u=Rv.shapeConfigMap.get(t.type);u&&(r=u.width,i=u.height),o-=r/2,a-=i/2;var s={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":o,"-y":a,"-width":r,"-height":i}};return(null===(e=t.text)||void 0===e?void 0:e.value)&&(s["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-10*t.text.value.length/2,"-y":t.text.y-7,"-width":10*t.text.value.length,"-height":14}}),s}))}var Cv=["bpmn:incoming","bpmn:outgoing"];function Ov(t,e){var n=[],r=[],i=new Map,o=null!=e?e:{},a=o.transformer,u=o.excludeFields,s={in:new Set(_(_([],x(Nv.in),!1),x((null==u?void 0:u.in)||[]),!1)),out:new Set(_(_([],x(Nv.out),!1),x((null==u?void 0:u.out)||[]),!1))};Av=Sv(Av,a);var l,c,d=t["bpmn:definitions"];if(d){var h=d["bpmn:process"];l=h,c=[function(t){function e(t){t["-children"]||(t["-children"]=[]),Object.keys(t).forEach((function(e){var n;0!==e.indexOf("bpmn:")||Cv.includes(e)||(h[e]||(h[e]=[]),!Array.isArray(h[e])&&(h[e]=[h[e]]),Array.isArray(t[e])?(n=h[e]).push.apply(n,_([],x(t[e]),!1)):h[e].push(t[e]),Array.isArray(t[e])?t[e].forEach((function(n){!e.includes("Flow")&&t["-children"].push(n["-id"])})):!e.includes("Flow")&&t["-children"].push(t[e]["-id"]),delete t[e])}))}if("bpmn:subProcess"===t){var n=h[t];Array.isArray(n)?n.forEach((function(n){"bpmn:subProcess"===t&&e(n)})):e(n)}},function(t){function e(t){var n;i.set(t["-id"],t),Array.isArray(t)?t.forEach((function(t){e(t)})):"object"==typeof t&&(n=t,Object.keys(n).forEach((function(t){var r,i;if(t.includes("bpmn:")){var o={};Av[t]&&Av[t].in?(o=null===(i=(r=Av[t]).in)||void 0===i?void 0:i.call(r,t,hn.cloneDeep(n[t])),delete n[t]):e(n[t]);var a=void 0;(a=Reflect.ownKeys(o)).length>0&&a.forEach((function(t){Reflect.set(n,t,o[t])}))}})))}e(h[t])},function(t){if(0===t.indexOf("bpmn:")){var e=h[t];if("bpmn:sequenceFlow"===t){var o=d["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNEdge"];r=function(t,e){var n=[];if(Array.isArray(t))t.forEach((function(t){var r;r=Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n.push(jv(r,t))}));else{var r=void 0;r=Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n.push(jv(r,t))}return n}(e,o)}else{var a=d["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNShape"];if("bpmn:boundaryEvent"===t){var u=h[t],s=function(t){var e=t["-attachedToRef"],n=i.get(e);n["-boundaryEvents"]||(n["-boundaryEvents"]=[]),n["-boundaryEvents"].push(t["-id"])};Array.isArray(u)?u.forEach((function(t){s(t)})):s(u)}n=n.concat(function(t,e,n){var r=[];if(Array.isArray(t))t.forEach((function(t){var i=Iv(Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n,t);r.push(i)}));else{var i=Iv(Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n,t);r.push(i)}return r}(e,a,t))}}}],c.forEach((function(t){try{Object.keys(l).forEach((function(e){try{t(e)}catch(t){console.error(t)}}))}catch(t){console.error(t)}}))}var p=function(t,e,n){Object.keys(t).forEach((function(r){var i=n?"".concat(n,".").concat(r):r;e.has(i)?delete t[r]:"object"==typeof t[r]&&p(t[r],e,i)}))};return n.forEach((function(t){var n,r;if(null===(n=null==e?void 0:e.mapping)||void 0===n?void 0:n.in){var i=null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.in,o=t.type;i[o]&&(t.type=i[o])}p(t,s.in,"")})),r.forEach((function(t){var n,r;if(null===(n=null==e?void 0:e.mapping)||void 0===n?void 0:n.in){var i=null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.in,o=t.type;i[o]&&(t.type=i[o])}p(t,s.in,"")})),{nodes:n,edges:r}}function Iv(t,e,n){var r=Number(t["dc:Bounds"]["-x"]),i=Number(t["dc:Bounds"]["-y"]),o=n["-children"],a=n["-name"],u=Rv.shapeConfigMap.get(e);u&&(r+=u.width/2,i+=u.height/2);var s,l={};if(Object.entries(n).forEach((function(t){var e=x(t,2),n=e[0],r=e[1];Mv.includes(n)||(l[n]=r)})),l=Tv(l),a&&(s={x:r,y:i,value:a},t["bpmndi:BPMNLabel"]&&t["bpmndi:BPMNLabel"]["dc:Bounds"])){var c=t["bpmndi:BPMNLabel"]["dc:Bounds"];s.x=Number(c["-x"])+Number(c["-width"])/2,s.y=Number(c["-y"])+Number(c["-height"])/2}var d={id:t["-bpmnElement"],type:e,x:r,y:i,properties:l};return o&&(d.children=o),s&&(d.text=s),d}function jv(t,e){var n,r=e["-name"];if(r){var i=t["bpmndi:BPMNLabel"]["dc:Bounds"],o=0;r.split("\n").forEach((function(t){o<t.length&&(o=t.length)})),n={value:r,x:Number(i["-x"])+10*o/2,y:Number(i["-y"])+7}}var a={};Object.entries(e).forEach((function(t){var e=x(t,2),n=e[0],r=e[1];Mv.includes(n)||(a[n]=r)})),a=Tv(a);var u=t["di:waypoint"].map((function(t){return{x:Number(t["-x"]),y:Number(t["-y"])}})),s={id:e["-id"],type:xv.FLOW,pointsList:u,sourceNodeId:e["-sourceRef"],targetNodeId:e["-targetRef"],properties:a};return n&&(s.text=n),s}var Rv=function(){function t(t){var e=t.lf,n=this;this.adapterOut=function(t,e){var r,i,o=v({},n.processAttributes);!function(t,e,n){var r,i=new Map,o=Pv(n)(e);o.nodes.forEach((function(e){var n=e["-id"],r=e["-type"],o=e.text,a=e.children,u=g(e,["-id","-type","text","children"]),s={"-id":n};(null==o?void 0:o["-value"])&&(s["-name"]=o["-value"]),u["-json"]&&(s["-json"]=u["-json"]),u["-properties"]&&Object.assign(s,u["-properties"]),a&&(s.children=a),t[r]||(t[r]=[]),t[r].push(s),i.set(n,s)}));var a=o.edges.map((function(t){var e=t["-id"],n=t["-sourceNodeId"],r=t["-targetNodeId"],o=t.text,a=g(t,["-id","-sourceNodeId","-targetNodeId","text"]),u=i.get(r);u["bpmn:incoming"]||(u["bpmn:incoming"]=[]),u["bpmn:incoming"].push(e);var s={"-id":e,"-sourceRef":n,"-targetRef":r};return(null==o?void 0:o["-value"])&&(s["-name"]=o["-value"]),a["-json"]&&(s["-json"]=a["-json"]),a["-properties"]&&Object.assign(s,a["-properties"]),s}));e.edges.forEach((function(t){var e=t.sourceNodeId,n=t.id,r=i.get(e);r["bpmn:outgoing"]||(r["bpmn:outgoing"]=[]),r["bpmn:outgoing"].push(n)})),null===(r=t["bpmn:subProcess"])||void 0===r||r.forEach((function(e){var n={"bpmn:incoming":new Set,"bpmn:outgoing":new Set},r=[];e.children.forEach((function(r){var o,a=i.get(r["-id"]);["bpmn:incoming","bpmn:outgoing"].forEach((function(t){a[t]&&a[t].forEach((function(e){n[t].add(e)}))}));var u=null===(o=t[r["-type"]])||void 0===o?void 0:o.findIndex((function(t){return t["-id"]===r["-id"]}));u>=0&&t[r["-type"]].splice(u,1),i.delete(r["-id"]),e[r["-type"]]||(e[r["-type"]]=[]),e[r["-type"]].push(a)}));var o=n["bpmn:incoming"];n["bpmn:outgoing"].forEach((function(t){o.has(t)&&r.push(t)}));for(var u,s=function(t){var n=a.findIndex((function(e){return e["-id"]===r[t]}));n>=0?(e["bpmn:sequenceFlow"]||(e["bpmn:sequenceFlow"]=[]),e["bpmn:sequenceFlow"].push(a[n]),a.splice(n,1)):t++,u=t},l=0;l<r.length;)s(l),l=u;delete e.children})),t[xv.FLOW]=a}(o,t,e);var a={"-id":"BPMNPlane_1","-bpmnElement":o["-id"]};kv(a,t);var u=n.definitionAttributes;u["bpmn:process"]=o,u["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":a};var s={"bpmn:definitions":u};if(null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.out){var l=null===(i=null==e?void 0:e.mapping)||void 0===i?void 0:i.out,c=function(t){Array.isArray(t)&&t.forEach((function(t){return c(t)})),"object"==typeof t&&Object.keys(t).forEach((function(e){var n;(n=l[e])?(t[n]=hn.cloneDeep(t[e]),delete t[e],c(t[n])):c(t[e])}))};c(s)}return s},this.adapterIn=function(t,e){if(t)return Ov(t,e)},e.adapterIn=this.adapterIn,e.adapterOut=this.adapterOut,this.processAttributes={"-isExecutable":"true","-id":"Process"},this.definitionAttributes={"-id":"Definitions","-xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","-xmlns:bpmn":"http://www.omg.org/spec/BPMN/20100524/MODEL","-xmlns:bpmndi":"http://www.omg.org/spec/BPMN/20100524/DI","-xmlns:dc":"http://www.omg.org/spec/DD/20100524/DC","-xmlns:di":"http://www.omg.org/spec/DD/20100524/DI","-targetNamespace":"http://logic-flow.org","-exporter":"logicflow","-exporterVersion":"1.2.10"}}return t.prototype.setCustomShape=function(e,n){t.shapeConfigMap.set(e,n)},t.pluginName="bpmn-adapter",t.shapeConfigMap=new Map,t}();Rv.shapeConfigMap.set(xv.START,{width:Kf,height:$f}),Rv.shapeConfigMap.set(xv.END,{width:Jf,height:Qf}),Rv.shapeConfigMap.set(xv.INTERMEDIATE_CATCH,{width:nv,height:rv}),Rv.shapeConfigMap.set(xv.INTERMEDIATE_THROW,{width:nv,height:rv}),Rv.shapeConfigMap.set(xv.BOUNDARY,{width:tv,height:ev}),Rv.shapeConfigMap.set(xv.PARALLEL_GATEWAY,{width:iv,height:ov}),Rv.shapeConfigMap.set(xv.INCLUSIVE_GATEWAY,{width:av,height:uv}),Rv.shapeConfigMap.set(xv.EXCLUSIVE_GATEWAY,{width:sv,height:lv}),Rv.shapeConfigMap.set(xv.SYSTEM,{width:cv,height:dv}),Rv.shapeConfigMap.set(xv.USER,{width:hv,height:pv}),Rv.shapeConfigMap.set(xv.SUBPROCESS,{width:fv,height:vv});var Dv=function(t){function e(e){var n=t.call(this,e)||this;n.adapterXmlIn=function(t){var e,r=(e=t,(new gv.ObjTree).parseXML(e));return n.adapterIn(r,n.props)},n.adapterXmlOut=function(t){return function(t){var e="";for(var n in t)e+=wv(t[n],n,0);return e}(n.adapterOut(t,n.props))};var r=e.lf,i=e.props;return r.adapterIn=n.adapterXmlIn,r.adapterOut=n.adapterXmlOut,n.props=i,n}return f(e,t),e.pluginName="BPMNAdapter",e}(Rv),Lv={};function Bv(t){return t.startsWith("data:text/plain")}function zv(t){return y(this,void 0,void 0,(function(){return m(this,(function(e){return Lv[t]?[2,Lv[t]]:[2,new Promise((function(e,n){try{fetch(t).then((function(t){return t.blob()})).then((function(r){var i=new FileReader;i.onloadend=function(){e(Lv[t]=i.result)},i.onerror=n,i.readAsDataURL(r)})).catch((function(){e(Lv[t]=t)}))}catch(e){return Lv[t]=t}}))]}))}))}function Wv(t,e){return y(this,void 0,void 0,(function(){var n,r,i;return m(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),(n=t.getAttribute(e)||"").startsWith("data:")?[2]:[4,zv(n)];case 1:return Bv(r=o.sent())?[2]:(t.setAttribute(e,r),[3,3]);case 2:return i=o.sent(),console.error(i),[3,3];case 3:return[2]}}))}))}function Fv(t,e){return y(this,void 0,void 0,(function(){var n,r;return m(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),e.startsWith("data:")?[2]:[4,zv(e)];case 1:return Bv(n=i.sent())?[2]:(t.style.backgroundImage="url(".concat(n,")"),[3,3]);case 2:return r=i.sent(),console.error(r),[3,3];case 3:return[2]}}))}))}function Gv(t){return y(this,void 0,void 0,(function(){var e,n,r,i,o,a,u,s,l;return m(this,(function(c){switch(c.label){case 0:for(e=[t],r=[];e.length;)(n=e.shift()).children.length&&e.push.apply(e,_([],x(n.children),!1)),n instanceof HTMLElement&&(i=n.style,o=i.background,a=i.backgroundImage,(u=o.match(/url\(["']?(.*?)["']?\)/))&&u[1]&&(l=u[1],r.push(Fv(n,l))),(s=a.match(/url\(["']?(.*?)["']?\)/))&&s[1]&&(l=s[1],r.push(Fv(n,l)))),n instanceof HTMLImageElement?r.push(Wv(n,"src")):n instanceof SVGImageElement&&r.push(Wv(n,"href"));return[4,Promise.all(r)];case 1:return c.sent(),[2]}}))}))}function Hv(t,e,n){var r=document.createElement("canvas");r.width=e,r.height=n;var i=r.getContext("2d");return i&&i.drawImage(t,0,0,t.width,t.height,0,0,e,n),r}var Xv,Uv=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.customCssRules="",this.useGlobalRules=!0,e.getSnapshot=function(t,e){return y(n,void 0,void 0,(function(){var n,r,i,o=this;return m(this,(function(a){switch(a.label){case 0:return n=this.lf.graphModel.getPartial(),r=(null!=e?e:{}).partial,n===(i=void 0===r?n:r)?[3,1]:(this.lf.graphModel.setPartial(i),this.lf.graphModel.eventCenter.once("graph:updated",(function(){return y(o,void 0,void 0,(function(){return m(this,(function(r){switch(r.label){case 0:return[4,this.getSnapshot(t,e)];case 1:return r.sent(),this.lf.graphModel.setPartial(n),[2]}}))}))})),[3,3]);case 1:return[4,this.getSnapshot(t,e)];case 2:a.sent(),a.label=3;case 3:return[2]}}))}))},e.getSnapshotBlob=function(t,e){return y(n,void 0,void 0,(function(){return m(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBlob(t,e)];case 1:return[2,n.sent()]}}))}))},e.getSnapshotBase64=function(t,e){return y(n,void 0,void 0,(function(){return m(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBase64(t,e)];case 1:return[2,n.sent()]}}))}))}}return t.prototype.getSvgRootElement=function(t){return t.container.querySelector(".lf-canvas-overlay")},t.prototype.triggerDownload=function(t){var e=new MouseEvent("click",{view:document.defaultView,bubbles:!1,cancelable:!0}),n=document.createElement("a");n.setAttribute("download",this.fileName),n.setAttribute("href",t),n.setAttribute("target","_blank"),n.dispatchEvent(e)},t.prototype.removeAnchor=function(t){for(var e=t.childNodes,n=t.childNodes&&t.childNodes.length,r=0;r<n;r++){var i=e[r];(i.classList&&Array.from(i.classList)||[]).indexOf("lf-anchor")>-1&&(t.removeChild(t.childNodes[r]),n--,r--)}},t.prototype.removeRotateControl=function(t){for(var e=t.childNodes,n=t.childNodes&&t.childNodes.length,r=0;r<n;r++){var i=e[r];(i.classList&&Array.from(i.classList)||[]).indexOf("lf-rotate-control")>-1&&(t.removeChild(t.childNodes[r]),n--,r--)}},t.prototype.getSnapshot=function(t,e){return y(this,void 0,void 0,(function(){var n,r,i,o,a,u,s,l,c,d=this;return m(this,(function(h){switch(h.label){case 0:return r=(n=null!=e?e:{}).fileType,i=void 0===r?"png":r,o=n.quality,this.fileName="".concat(null!=t?t:"logic-flow.".concat(Date.now()),".").concat(i),[4,Gv(a=this.getSvgRootElement(this.lf))];case 1:return h.sent(),"svg"===i?(u=this.cloneSvg(a),s=(new XMLSerializer).serializeToString(u),l=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(l),this.triggerDownload(c)):this.getCanvasData(a,null!=e?e:{}).then((function(t){var e=t.toDataURL("image/".concat(i),o).replace("image/".concat(i),"image/octet-stream");d.triggerDownload(e)})),[2]}}))}))},t.prototype.getSnapshotBase64=function(t,e){return y(this,void 0,void 0,(function(){var n,r=this;return m(this,(function(i){switch(i.label){case 0:return[4,Gv(n=this.getSvgRootElement(this.lf))];case 1:return i.sent(),[2,new Promise((function(i){r.getCanvasData(n,{backgroundColor:t}).then((function(t){var n=t.toDataURL("image/".concat(null!=e?e:"png"));i({data:n,width:t.width,height:t.height})}))}))]}}))}))},t.prototype.getSnapshotBlob=function(t,e){return y(this,void 0,void 0,(function(){var n,r=this;return m(this,(function(i){switch(i.label){case 0:return[4,Gv(n=this.getSvgRootElement(this.lf))];case 1:return i.sent(),[2,new Promise((function(i){r.getCanvasData(n,{backgroundColor:t}).then((function(t){t.toBlob((function(e){i({data:e,width:t.width,height:t.height})}),"image/".concat(null!=e?e:"png"))}))}))]}}))}))},t.prototype.getClassRules=function(){var t="";if(this.useGlobalRules)for(var e=document.styleSheets,n=0;n<e.length;n++)for(var r=e[n],i=0;i<r.cssRules.length;i++)t+=r.cssRules[i].cssText;return this.customCssRules&&(t+=this.customCssRules),t},t.prototype.getCanvasData=function(t,e){return y(this,void 0,void 0,(function(){var n,r,i,o,a,u,s,l,c,d,h,p,f,v,g,y,b,x,_,w,M,E,N,S,A,P;return m(this,(function(m){return n=e.width,r=e.height,i=e.backgroundColor,o=e.padding,a=void 0===o?40:o,u=this.cloneSvg(t,!1),(s=window.devicePixelRatio||1)<1&&(s=1),l=this.lf.graphModel.rootEl.querySelector(".lf-base"),c=l.getBoundingClientRect(),d=this.lf.container.querySelector(".lf-canvas-overlay"),h=d.getBoundingClientRect(),p=c.x-h.x,f=c.y-h.y,v=this.lf.graphModel,g=v.transformModel,y=g.SCALE_X,b=g.SCALE_Y,x=g.TRANSLATE_X,_=g.TRANSLATE_Y,u.lastChild.style.transform="matrix(1, 0, 0, 1, ".concat((-p+x)*(1/y),", ").concat((-f+_)*(1/b),")"),w=Math.ceil(c.width/y),M=Math.ceil(c.height/b),(E=document.createElement("canvas")).style.width="".concat(w,"px"),E.style.height="".concat(M,"px"),E.width=w*s+2*a,E.height=M*s+2*a,(N=E.getContext("2d"))&&(N.clearRect(0,0,E.width,E.height),N.scale(s,s),i?(N.fillStyle=i,N.fillRect(0,0,E.width,E.height)):N.clearRect(0,0,E.width,E.height)),S=new Image,(A=document.createElement("style")).innerHTML=this.getClassRules(),(P=document.createElement("foreignObject")).appendChild(A),u.appendChild(P),[2,new Promise((function(t){S.onload=function(){var e=navigator.userAgent.indexOf("Firefox")>-1;try{e?createImageBitmap(S,{resizeWidth:n&&r?Hv(E,n,r).width:E.width,resizeHeight:n&&r?Hv(E,n,r).height:E.height}).then((function(e){null==N||N.drawImage(e,a/s,a/s),t(n&&r?Hv(E,n,r):E)})):(null==N||N.drawImage(S,a/s,a/s),t(n&&r?Hv(E,n,r):E))}catch(e){null==N||N.drawImage(S,a/s,a/s),t(n&&r?Hv(E,n,r):E)}};var e="data:image/svg+xml;charset=utf-8,".concat((new XMLSerializer).serializeToString(u)).replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23");S.src=e}))]}))}))},t.prototype.cloneSvg=function(t,e){var n,r=this;void 0===e&&(e=!0);var i=t.cloneNode(!0),o=i.lastChild,a=null===(n=null==o?void 0:o.childNodes)||void 0===n?void 0:n.length;if(a)for(var u=0;u<a;u++){var s=null==o?void 0:o.childNodes[u],l=s.classList&&Array.from(s.classList);if(l&&l.indexOf("lf-base")<0)null==o||o.removeChild(o.childNodes[u]),a--,u--;else{var c=null==o?void 0:o.childNodes[u];c&&c.childNodes.forEach((function(t){var e=t;r.removeAnchor(e.firstChild),r.removeRotateControl(e.firstChild)}))}}if(e){var d=document.createElement("style");d.innerHTML=this.getClassRules();var h=document.createElement("foreignObject");h.appendChild(d),i.appendChild(h)}return i},t.pluginName="snapshot",t}(),Vv={SEQUENCE_FLOW:1,START_EVENT:2,END_EVENT:3,USER_TASK:4,EXCLUSIVE_GATEWAY:6},qv={1:"bpmn:sequenceFlow",2:"bpmn:startEvent",3:"bpmn:endEvent",4:"bpmn:userTask",6:"bpmn:exclusiveGateway"};function Yv(t){switch(t){case"bpmn:sequenceFlow":return Vv.SEQUENCE_FLOW;case"bpmn:startEvent":return Vv.START_EVENT;case"bpmn:endEvent":return Vv.END_EVENT;case"bpmn:userTask":return Vv.USER_TASK;case"bpmn:exclusiveGateway":return Vv.EXCLUSIVE_GATEWAY;default:return t}}!function(t){t.HORIZONTAL="horizontal",t.VERTICAL="vertical"}(Xv||(Xv={}));var Zv=function(t,e,n,r){return void 0===r&&(r=0),Jv(t,e,n)<=r};function Kv(t){return t*t}function $v(t,e){return Kv(t.x-e.x)+Kv(t.y-e.y)}var Jv=function(t,e,n){return Math.sqrt(function(t,e,n){var r=$v(e,n);if(0===r)return $v(t,e);var i=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/r;return i=Math.max(0,Math.min(1,i)),$v(t,{x:e.x+i*(n.x-e.x),y:e.y+i*(n.y-e.y)})}(t,e,n))},Qv=function(t,e,n){var r=function(t){var e=t.x,n=t.y,r=t.width,i=t.height;return{minX:e-r/2,minY:n-i/2,maxX:e+r/2,maxY:n+i/2,x:e,y:n,width:r,height:i,centerX:e,centerY:n}}(t),i=function(t,e){var n;return t.x===e.x?n=Xv.VERTICAL:t.y===e.y&&(n=Xv.HORIZONTAL),n}(e,n),o=Math.max(e.x,n.x),a=Math.min(e.x,n.x),u=Math.max(e.y,n.y),s=Math.min(e.y,n.y),l=t.x,c=t.y,d=t.width,h=t.height;if(i===Xv.HORIZONTAL){if(o>=r.maxX&&a<=r.minX)return{startCrossPoint:{x:e.x>n.x?l+d/2:l-d/2,y:e.y},endCrossPoint:{x:e.x>n.x?l-d/2:l+d/2,y:e.y}}}else if(i===Xv.VERTICAL&&u>=r.maxY&&s<=r.minY)return{startCrossPoint:{x:e.x,y:e.y>n.y?c+h/2:c-h/2},endCrossPoint:{x:e.x,y:e.y>n.y?c-h/2:c+h/2}}},tg=function(t,e,n){void 0===n&&(n=0);for(var r=t.x,i=t.y,o=e.pointsList,a=0;a<o.length-1;a++)if(Zv({x:r,y:i},o[a],o[a+1],n)){var u=Qv(t,o[a],o[a+1]);if(u)return{crossIndex:a+1,crossPoints:u}}return{crossIndex:-1,crossPoints:{startCrossPoint:{x:0,y:0},endCrossPoint:{x:0,y:0}}}},eg=function(){function t(t){var e=t.lf;this._lf=e,this.deviation=20,this.dndAdd=!0,this.dropAdd=!0,this.eventHandler()}return t.prototype.eventHandler=function(){var t=this;this.dndAdd&&this._lf.on("node:dnd-add",(function(e){var n=e.data;t.insetNode(n)})),this.dropAdd&&this._lf.on("node:drop",(function(e){for(var n=e.data,r=t._lf.graphModel.edges,i=n.id,o=!0,a=0;a<r.length;a++)if(r[a].sourceNodeId===i||r[a].targetNodeId===i){o=!1;break}o&&t.insetNode(n)}))},t.prototype.checkRuleBeforeInsetNode=function(t,n,r,i,o){var a=this._lf.getNodeModelById(t),u=this._lf.getNodeModelById(n),s=a.getAnchorInfo(r),l=u.getAnchorInfo(i),c=a.isAllowConnectedAsSource(o,s,l),d=u.isAllowConnectedAsTarget(o,s,l),h=e.formatAnchorConnectValidateData(c),p=h.isAllPass,f=h.msg,v=e.formatAnchorConnectValidateData(d),g=v.isAllPass;return{isPass:p&&g,sourceMsg:f,targetMsg:v.msg}},t.prototype.insetNode=function(t){var n=this,r=this._lf.graphModel.edges,i=this._lf.getNodeModelById(t.id),o=null==i?void 0:i.getDefaultAnchor();if(!o||0===o.length)this._lf.graphModel.eventCenter.emit(e.EventType.CONNECTION_NOT_ALLOWED,{data:t,msg:"自定义类型节点不显示锚点,也不允许其他节点连接到此节点"});else if(i)for(var a=0;a<r.length;a++){var u=tg(i,r[a],this.deviation),s=u.crossIndex,l=u.crossPoints;if(s>=0){var c=r[a],d=c.sourceNodeId,h=c.targetNodeId,p=c.id,f=c.type,v=c.pointsList,g=c.sourceAnchorId,y=c.targetAnchorId,m=Ru(v[0]),b=Ru(l.startCrossPoint);this._lf.deleteEdge(p);var w=this.checkRuleBeforeInsetNode(d,h,g,y,t);if(this._lf.addEdge({type:f,sourceNodeId:d,targetNodeId:t.id,startPoint:m,endPoint:b,pointsList:_(_([],x(v.slice(0,s)),!1),[l.startCrossPoint],!1)}),this._lf.addEdge({type:f,sourceNodeId:t.id,targetNodeId:h,startPoint:Ru(l.endCrossPoint),endPoint:Ru(v[v.length-1]),pointsList:_([l.endCrossPoint],x(v.slice(s)),!1)}),w.isPass)break;this._lf.graphModel.eventCenter.emit(e.EventType.CONNECTION_NOT_ALLOWED,{data:t,msg:w.targetMsg||w.sourceMsg}),setTimeout((function(){n._lf.undo()}),200);break}}},t.pluginName="insertNodeInPolyline",t}(),ng=function(){function t(t){var e=t.lf,n=this;this.controlItems=[{key:"zoom-out",iconClass:"lf-control-zoomOut",title:"缩小流程图",text:"缩小",onClick:function(){n.lf.zoom(!1)}},{key:"zoom-in",iconClass:"lf-control-zoomIn",title:"放大流程图",text:"放大",onClick:function(){n.lf.zoom(!0)}},{key:"reset",iconClass:"lf-control-fit",title:"恢复流程原有尺寸",text:"适应",onClick:function(){n.lf.resetZoom()}},{key:"undo",iconClass:"lf-control-undo",title:"回到上一步",text:"上一步",onClick:function(){n.lf.undo()}},{key:"redo",iconClass:"lf-control-redo",title:"移到下一步",text:"下一步",onClick:function(){n.lf.redo()}}],this.lf=e}return t.prototype.render=function(t,e){this.destroy();var n=this.getControlTool();this.toolEl=n,e.appendChild(n),this.domContainer=e},t.prototype.destroy=function(){this.domContainer&&this.toolEl&&this.domContainer.contains(this.toolEl)&&this.domContainer.removeChild(this.toolEl)},t.prototype.addItem=function(t){this.controlItems.push(t)},t.prototype.removeItem=function(t){var e=this.controlItems.findIndex((function(e){return e.key===t}));return-1==e?null:this.controlItems.splice(e,1)[0]},t.prototype.getControlTool=function(){var t=this,e="lf-control-item",n="lf-control-item disabled",r=document.createElement("div"),i=[];return r.className="lf-control",this.controlItems.forEach((function(r){var o=document.createElement("div"),a=document.createElement("i"),u=document.createElement("span");switch(o.className=n,r.onClick&&(o.onclick=r.onClick.bind(null,t.lf)),r.onMouseEnter&&(o.onmouseenter=r.onMouseEnter.bind(null,t.lf)),r.onMouseLeave&&(o.onmouseleave=r.onMouseLeave.bind(null,t.lf)),a.className=r.iconClass,u.className="lf-control-text",u.title=r.title,u.innerText=r.text,o.append(a,u),r.text){case"上一步":t.lf.on("history:change",(function(t){var r=t.data.undoAble;o.className=r?e:n}));break;case"下一步":t.lf.on("history:change",(function(t){var r=t.data.redoAble;o.className=r?e:n}));break;default:o.className=e}i.push(o)})),r.append.apply(r,_([],x(i),!1)),r},t.pluginName="control",t}(),rg="lf:defaultNodeMenu",ig="lf:defaultEdgeMenu",og="lf:defaultGraphMenu",ag="lf:defaultSelectionMenu",ug=function(){function t(t){var e=t.lf,n=this;this.__currentData=null,this.lf=e,e.options.isSilentMode||(this.__menuDOM=document.createElement("ul"),this.menuTypeMap=new Map,this.init(),this.lf.setMenuConfig=function(t){n.setMenuConfig(t)},this.lf.addMenuConfig=function(t){n.addMenuConfig(t)},this.lf.setMenuByType=function(t){n.setMenuByType(t)})}return t.prototype.init=function(){var t,e,n,r,i=this,o=[{text:"删除",callback:function(t){i.lf.deleteNode(t.id)}},{text:"编辑文本",callback:function(t){i.lf.graphModel.editText(t.id)}},{text:"复制",callback:function(t){i.lf.cloneNode(t.id)}}];null===(t=this.menuTypeMap)||void 0===t||t.set(rg,o);var a=[{text:"删除",callback:function(t){i.lf.deleteEdge(t.id)}},{text:"编辑文本",callback:function(t){i.lf.graphModel.editText(t.id)}}];null===(e=this.menuTypeMap)||void 0===e||e.set(ig,a),null===(n=this.menuTypeMap)||void 0===n||n.set(og,[]);var u=[{text:"删除",callback:function(t){i.lf.clearSelectElements(),t.edges.forEach((function(t){return i.lf.deleteEdge(t.id)})),t.nodes.forEach((function(t){return i.lf.deleteNode(t.id)}))}}];null===(r=this.menuTypeMap)||void 0===r||r.set(ag,u)},t.prototype.render=function(t,e){var n=this;t.options.isSilentMode||(this.__container=e,this.__currentData=null,this.__menuDOM&&(this.__menuDOM.className="lf-menu",e.appendChild(this.__menuDOM),this.__menuDOM.addEventListener("click",(function(t){t.stopPropagation();for(var e=t.target;-1===Array.from(e.classList).indexOf("lf-menu-item")&&-1===Array.from(e.classList).indexOf("lf-menu");)e=null==e?void 0:e.parentElement;Array.from(e.classList).indexOf("lf-menu-item")>-1?(e.onclickCallback(n.__currentData),n.__menuDOM&&(n.__menuDOM.style.display="none"),n.__currentData=null):console.warn("点击区域不在菜单项内,请检查代码!")}),!0)),this.lf.on("node:contextmenu",(function(t){var e,r,i=t.data,o=t.position,a=t.e,u=o.domOverlayPosition,s=u.x,l=u.y,c=i.id,d=n.lf.graphModel.getNodeModelById(c);if(d){var h=[],p=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(d.type);h=d&&d.menu&&Array.isArray(d.menu)?d.menu:p||(null===(r=n.menuTypeMap)||void 0===r?void 0:r.get(rg)),n.__currentData=i,n.showMenu(s,l,h,{width:d.width,height:d.height,clientX:a.clientX,clientY:a.clientY})}})),this.lf.on("edge:contextmenu",(function(t){var e,r,i,o=t.data,a=t.position,u=t.e,s=a.domOverlayPosition,l=s.x,c=s.y,d=o.id,h=n.lf.graphModel.getEdgeModelById(d);if(h){var p=[],f=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(h.type);p=h&&h.menu&&Array.isArray(h.menu)?h.menu:f||(null!==(i=null===(r=n.menuTypeMap)||void 0===r?void 0:r.get(ig))&&void 0!==i?i:[]),n.__currentData=o,n.showMenu(l,c,p,{width:h.width,height:h.height,clientX:u.clientX,clientY:u.clientY})}})),this.lf.on("blank:contextmenu",(function(t){var e,r,i=t.position,o=null!==(r=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(og))&&void 0!==r?r:[],a=i.domOverlayPosition,u=a.x,s=a.y;n.showMenu(u,s,o)})),this.lf.on("selection:contextmenu",(function(t){var e,r=t.data,i=t.position,o=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(ag),a=i.domOverlayPosition,u=a.x,s=a.y;n.__currentData=r,n.showMenu(u,s,o)})),this.lf.on("node:mousedown",(function(){n.__menuDOM.style.display="none"})),this.lf.on("edge:click",(function(){n.__menuDOM.style.display="none"})),this.lf.on("blank:click",(function(){n.__menuDOM.style.display="none"})))},t.prototype.destroy=function(){var t;this.__menuDOM&&(null===(t=null==this?void 0:this.__container)||void 0===t||t.removeChild(this.__menuDOM),this.__menuDOM=void 0)},t.prototype.showMenu=function(t,e,n,r){if(n&&n.length){var i=this.__menuDOM;if(i){if(i.innerHTML="",i.append.apply(i,_([],x(this.__getMenuDom(n)),!1)),!i.children.length)return;if(i.style.display="block",!r)return i.style.top="".concat(e,"px"),void(i.style.left="".concat(t,"px"));var o=r.width,a=r.height,u=r.clientX,s=r.clientY,l=this.lf.graphModel,c=i.offsetWidth,d=!0,h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,p=h-u,f=l.rootEl.getBoundingClientRect(),v=f.left+f.width;v<h&&(p=v-u),p<c&&(d=!1),i.style.left="".concat(d?t:t-o,"px");var g=i.offsetHeight,y=!0,m=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,b=m-s,w=f.top+f.height;w<m&&(b=w-s),b<g&&(y=!1),i.style.top="".concat(y?e:e-a,"px")}}},t.prototype.setMenuByType=function(t){var e;t.type&&t.menu&&(null===(e=this.menuTypeMap)||void 0===e||e.set(t.type,t.menu))},t.prototype.__getMenuDom=function(t){var e=[];return t&&t.length>0&&t.forEach((function(t){var n=document.createElement("li");if(t.className?n.className="lf-menu-item ".concat(t.className):n.className="lf-menu-item",!0===t.icon){var r=document.createElement("span");r.className="lf-menu-item-icon",n.appendChild(r)}var i=document.createElement("span");i.className="lf-menu-item-text",t.text&&(i.innerText=t.text),n.appendChild(i),n.onclickCallback=t.callback,e.push(n)})),e},t.prototype.setMenuConfig=function(t){var e,n,r;t&&(void 0!==t.nodeMenu&&(null===(e=this.menuTypeMap)||void 0===e||e.set(rg,t.nodeMenu?t.nodeMenu:[])),void 0!==t.edgeMenu&&(null===(n=this.menuTypeMap)||void 0===n||n.set(ig,t.edgeMenu?t.edgeMenu:[])),void 0!==t.graphMenu&&(null===(r=this.menuTypeMap)||void 0===r||r.set(og,t.graphMenu?t.graphMenu:[])))},t.prototype.addMenuConfig=function(t){var e,n,r,i,o,a,u,s,l;if(t){if(Array.isArray(t.nodeMenu)){var c=null!==(n=null===(e=this.menuTypeMap)||void 0===e?void 0:e.get(rg))&&void 0!==n?n:[];null===(r=this.menuTypeMap)||void 0===r||r.set(rg,c.concat(t.nodeMenu))}if(Array.isArray(t.edgeMenu)){c=null!==(o=null===(i=this.menuTypeMap)||void 0===i?void 0:i.get(ig))&&void 0!==o?o:[];null===(a=this.menuTypeMap)||void 0===a||a.set(ig,c.concat(t.edgeMenu))}if(Array.isArray(t.graphMenu)){c=null!==(s=null===(u=this.menuTypeMap)||void 0===u?void 0:u.get(og))&&void 0!==s?s:[];null===(l=this.menuTypeMap)||void 0===l||l.set(og,c.concat(t.graphMenu))}}},t.prototype.changeMenuItem=function(t,e){if("add"===t)this.addMenuConfig(e);else{if("reset"!==t)throw new Error("The first parameter of changeMenuConfig should be 'add' or 'reset'");this.setMenuConfig(e)}},t.pluginName="menu",t}(),sg="menu-common",lg=function(){function t(t){var e=t.lf,n=this;this.menuTypeMap=new Map,this.listenDelete=function(){n.hideContextMenu()},this.lf=e,this.__menuDOM=document.createElement("div"),this.__menuDOM.className="lf-inner-context",this.menuTypeMap.set(sg,[]),this.lf.setContextMenuByType=function(t,e){n.setContextMenuByType(t,e)},this.lf.setContextMenuItems=function(t){n.setContextMenuItems(t)},this.lf.showContextMenu=function(t){n.showContextMenu(t)},this.lf.hideContextMenu=function(){n.hideContextMenu()}}return t.prototype.render=function(t,e){var n=this;this.container=e,t.on("node:click",(function(t){var e=t.data;n._activeData=e,n.createContextMenu()})),t.on("edge:click",(function(t){var e=t.data;n._activeData=e,n.createContextMenu()})),t.on("blank:click",(function(){n.hideContextMenu()}))},t.prototype.setContextMenuByType=function(t,e){this.menuTypeMap.set(t,e)},t.prototype.hideContextMenu=function(){this.__menuDOM.innerHTML="",this.__menuDOM.style.display="none",this.isShow&&this.container.removeChild(this.__menuDOM),this.lf.off("node:delete,edge:delete,node:drag,graph:transform",this.listenDelete),this.isShow=!1},t.prototype.showContextMenu=function(t){t&&t.id?(this._activeData=t,this.createContextMenu()):console.warn("请检查传入的参数")},t.prototype.setContextMenuItems=function(t){this.menuTypeMap.set(sg,t)},t.prototype.getContextMenuPosition=function(){var t=this._activeData,e=this.lf.graphModel.getElement(t.id);if(e){var n,r;if("edge"===e.BaseType){n=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER;var i=e.getData();n=Math.max(i.startPoint.x,n),r=Math.min(i.startPoint.y,r),n=Math.max(i.endPoint.x,n),r=Math.min(i.endPoint.y,r),i.pointsList&&i.pointsList.forEach((function(t){n=Math.max(t.x,n),r=Math.min(t.y,r)}))}return"node"===e.BaseType&&(n=t.x+e.width/2,r=t.y-e.height/2),this.lf.graphModel.transformModel.CanvasPointToHtmlPoint([n,r])}},t.prototype.createContextMenu=function(){var t=this;if(!this.lf.options.isSilentMode){var e=_(_([],x(this.menuTypeMap.get(this._activeData.type)||[]),!1),x(this.menuTypeMap.get(sg)||[]),!1),n=document.createDocumentFragment();e.forEach((function(e){var r=document.createElement("div");r.className="lf-context-item";var i=document.createElement("img");i.src=e.icon,i.className="lf-context-img",e.className&&(r.className="".concat(r.className," ").concat(e.className)),i.addEventListener("click",(function(){t.hideContextMenu(),e.callback?e.callback(t._activeData):t.addNode({sourceId:t._activeData.id,x:t._activeData.x,y:t._activeData.y,properties:e.properties,type:e.type})})),r.appendChild(i),n.appendChild(r)})),this.__menuDOM.innerHTML="",this.__menuDOM.appendChild(n),this.showMenu()}},t.prototype.addNode=function(t,e){var n=void 0!==e;void 0===e&&(e=t.y);var r=this.lf.getNodeModelById(t.sourceId);if(r){var i=t.x-r.width+200,o=e-t.y/2-20,a=t.x+r.width+200,u=e+t.y/2+20;if(this.lf.getAreaElement([i,o],[a,u]).length)return e+=100,void this.addNode(t,e);if(t.type){var s=this.lf.addNode({type:t.type,x:t.x+200,y:e,properties:t.properties}),l=void 0,c=void 0;n&&(l={x:t.x,y:t.y+r.height/2},c={x:s.x-s.width/2,y:s.y}),this.lf.addEdge({sourceNodeId:t.sourceId,targetNodeId:s.id,startPoint:l,endPoint:c})}}},t.prototype.showMenu=function(){var t=this.getContextMenuPosition();if(t){var e=x(t,2),n=e[0],r=e[1];this.__menuDOM.style.display="flex",this.__menuDOM.style.top="".concat(r,"px"),this.__menuDOM.style.left="".concat(n+10,"px"),this.container.appendChild(this.__menuDOM),!this.isShow&&this.lf.on("node:delete,edge:delete,node:drag,graph:transform",this.listenDelete),this.isShow=!0}},t.pluginName="contextMenu",t}(),cg=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.lf.setPatternItems=function(t){n.setPatternItems(t)}}return t.prototype.render=function(t,e){var n=this;this.destroy(),this.shapeList&&0!==this.shapeList.length?(this.panelEl=document.createElement("div"),this.panelEl.className="lf-dndpanel",this.shapeList.forEach((function(t){var e;null===(e=n.panelEl)||void 0===e||e.appendChild(n.createDndItem(t))})),e.appendChild(this.panelEl),this.domContainer=e):this.domContainer=e},t.prototype.destroy=function(){this.domContainer&&this.panelEl&&this.domContainer.contains(this.panelEl)&&this.domContainer.removeChild(this.panelEl)},t.prototype.setPatternItems=function(t){this.shapeList=t,this.domContainer&&this.render(this.lf,this.domContainer)},t.prototype.createDndItem=function(t){var e=this,n=document.createElement("div");n.className=t.className?"lf-dnd-item ".concat(t.className):"lf-dnd-item";var r=document.createElement("div");if(r.className="lf-dnd-shape",t.icon&&(r.style.backgroundImage="url(".concat(t.icon,")")),n.appendChild(r),t.label){var i=document.createElement("div");i.innerText=t.label,i.className="lf-dnd-text",n.appendChild(i)}return t.disabled?(n.classList.add("disabled"),n.onmousedown=function(){t.callback&&t.callback(e.lf,e.domContainer)},n):(n.onmousedown=function(){t.type&&e.lf.dnd.startDrag({type:t.type,properties:t.properties,text:t.text}),t.callback&&t.callback(e.lf,e.domContainer)},n.ondblclick=function(n){e.lf.graphModel.eventCenter.emit("dnd:panel-dbclick",{e:n,data:t})},n.onclick=function(n){e.lf.graphModel.eventCenter.emit("dnd:panel-click",{e:n,data:t})},n.oncontextmenu=function(n){e.lf.graphModel.eventCenter.emit("dnd:panel-contextmenu",{e:n,data:t})},n)},t.pluginName="dndPanel",t}(),dg=function(){function t(t){var e=t.lf,n=this;this.disabled=!0,this.isDefaultStopMoveGraph=!1,this.isWholeNode=!0,this.isWholeEdge=!0,this.draw=function(t){var e=n.lf.getPointByClient(t.clientX,t.clientY).domOverlayPosition,r=e.x,i=e.y;if(n.endPoint={x:r,y:i},n.startPoint){var o=n.startPoint,a=o.x,u=o.y,s=a,l=u,c=r-a,d=i-u;r<a&&(s=r,c=a-r),i<u&&(l=i,d=u-i),n.wrapper&&(n.wrapper.style.left="".concat(s,"px"),n.wrapper.style.top="".concat(l,"px"),n.wrapper.style.width="".concat(c,"px"),n.wrapper.style.height="".concat(d,"px"))}},this.drawOff=function(){var t;if(document.removeEventListener("mousemove",n.draw),document.removeEventListener("mouseup",n.drawOff),n.wrapper&&(n.wrapper.oncontextmenu=null,null===(t=n.container)||void 0===t||t.removeChild(n.wrapper)),n.startPoint&&n.endPoint){var e=n.startPoint,r=e.x,i=e.y,o=n.endPoint,a=o.x,u=o.y,s=[Math.min(r,a),Math.min(i,u)],l=[Math.max(r,a),Math.max(i,u)];if(n.lf.emit("selection:selected-area",{topLeft:s,bottomRight:l}),Math.abs(a-r)<10&&Math.abs(u-i)<10)return;var c=n.lf.graphModel.getAreaElement(s,l,n.isWholeEdge,n.isWholeNode,!0),d=n.lf.graphModel.group;c.forEach((function(t){d&&d.getNodeGroup(t.id)||n.lf.selectElementById(t.id,!0)})),n.lf.emit("selection:selected",c)}},this.lf=e;var r=e.getEditConfig().stopMoveGraph;this.isDefaultStopMoveGraph=r,e.openSelectionSelect=function(){n.openSelectionSelect()},e.closeSelectionSelect=function(){n.closeSelectionSelect()}}return t.prototype.render=function(t,e){var n=this;this.container=e,t.on("blank:mousedown",(function(r){var i=r.e;if(t.getEditConfig().stopMoveGraph&&!n.disabled&&!(2===i.button)){var o=t.getPointByClient(i.clientX,i.clientY).domOverlayPosition,a=o.x,u=o.y;n.startPoint={x:a,y:u},n.endPoint={x:a,y:u};var s=document.createElement("div");s.className="lf-selection-select",s.oncontextmenu=function(t){t.preventDefault()},s.style.top="".concat(n.startPoint.y,"px"),s.style.left="".concat(n.startPoint.x,"px"),e.appendChild(s),n.wrapper=s,document.addEventListener("mousemove",n.draw),document.addEventListener("mouseup",n.drawOff)}}))},t.prototype.setSelectionSense=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!0),this.isWholeEdge=t,this.isWholeNode=e},t.prototype.openSelectionSelect=function(){this.lf.getEditConfig().stopMoveGraph||(this.isDefaultStopMoveGraph=!1,this.lf.updateEditConfig({stopMoveGraph:!0})),this.open()},t.prototype.closeSelectionSelect=function(){this.isDefaultStopMoveGraph||this.lf.updateEditConfig({stopMoveGraph:!1}),this.close()},t.prototype.open=function(){this.disabled=!1},t.prototype.close=function(){this.disabled=!0},t.pluginName="selectionSelect",t}(),hg=function(){function t(t){var e=t.lf,n=t.LogicFlow,r=t.options,i=this;this.width=200,this.height=150,this.scale=1,this.translateX=0,this.translateY=0,this.showEdge=!1,this.viewPortTop=0,this.viewPortLeft=0,this.viewPortWidth=150,this.viewPortHeight=75,this.isShow=!1,this.isShowHeader=!1,this.isShowCloseIcon=!1,this.headerTitle="导航",this.disabledPlugins=["miniMap","control","selectionSelect"],this.render=function(t,e){i.container=e,i.lf.on("history:change",(function(){i.isShow&&i.setView()})),i.lf.on("graph:transform",(function(){i.isShow&&i.setView(!1)}))},this.show=function(t,e){i.isShow||(i.createMiniMap(t,e),i.setView()),i.isShow=!0},this.hide=function(){i.isShow&&(i.removeMiniMap(),i.lf.emit("miniMap:close",{})),i.isShow=!1},this.updatePosition=function(t){if("object"==typeof t)void 0===t.left&&void 0===t.right||(i.leftPosition=t.left,i.rightPosition=t.right),void 0===t.top&&void 0===t.bottom||(i.topPosition=t.top,i.bottomPosition=t.bottom);else switch(t){case"left-top":i.leftPosition=0,i.rightPosition=void 0,i.topPosition=0,i.bottomPosition=void 0;break;case"right-top":i.leftPosition=void 0,i.rightPosition=0,i.topPosition=0,i.bottomPosition=void 0;break;case"left-bottom":i.leftPosition=0,i.rightPosition=void 0,i.topPosition=void 0,i.bottomPosition=0;break;case"right-bottom":i.leftPosition=void 0,i.rightPosition=0,i.topPosition=void 0,i.bottomPosition=0}i.updateMiniMapPosition()},this.reset=function(){i.lf.resetTranslate(),i.lf.resetZoom()},this.setShowEdge=function(t){i.showEdge!==t&&(i.showEdge=t,i.setView())},this.startDrag=function(t){document.addEventListener("mousemove",i.drag),document.addEventListener("mouseup",i.drop);var e=t.x,n=t.y;i.startPosition={x:e,y:n}},this.drag=function(t){var e=t.x,n=t.y,r=(e-i.startPosition.x)/i.scale,o=(n-i.startPosition.y)/i.scale,a=i.viewPortLeft+r+i.viewPortWidth/i.scale/2,u=i.viewPortTop+o+i.viewPortHeight/i.scale/2;i.startPosition={x:e,y:n},i.lf.focusOn({coordinate:{x:a,y:u}})},this.drop=function(){document.removeEventListener("mousemove",i.drag),document.removeEventListener("mouseup",i.drop)},this.mapClick=function(t){var e=t.offsetX,n=t.offsetY,r=i.translateX+e/i.scale,o=i.translateY+n/i.scale;i.lf.focusOn({coordinate:{x:r,y:o}})},this.lf=e,this.LFCtor=n,r&&r.MiniMap&&this.setOption(r.MiniMap),this.viewPortWidth=e.graphModel.width,this.viewPortHeight=e.graphModel.height;var o={left:0,right:this.viewPortWidth,top:0,bottom:this.viewPortHeight};this.bounds=o,this.elementAreaBounds=o,this.viewPortBounds=o,this.initMiniMap()}return t.prototype.setOption=function(t){var e=t.width,n=void 0===e?150:e,r=t.height,i=void 0===r?220:r,o=t.showEdge,a=void 0!==o&&o,u=t.isShowHeader,s=void 0!==u&&u,l=t.isShowCloseIcon,c=void 0!==l&&l,d=t.leftPosition,h=t.topPosition,p=t.rightPosition,f=void 0===p?0:p,v=t.bottomPosition,g=void 0===v?0:v,y=t.headerTitle,m=void 0===y?"导航":y;this.width=n,this.height=i,this.showEdge=a,this.isShowHeader=s,this.isShowCloseIcon=c,this.leftPosition=d,this.rightPosition=void 0!==d?void 0:f,this.topPosition=h,this.bottomPosition=void 0!==h?void 0:g,this.headerTitle=m},t.prototype.initMiniMap=function(){var t=document.createElement("div");t.className="lf-mini-map-graph",t.style.width="".concat(this.width,"px"),t.style.height="".concat(this.height,"px"),this.lfMap=new this.LFCtor({container:t,grid:!1,isSilentMode:!0,stopZoomGraph:!0,stopScrollGraph:!0,stopMoveGraph:!1,history:!1,snapline:!1,disabledPlugins:this.disabledPlugins}),this.miniMapWrap=t,this.createViewPort(),t.addEventListener("click",this.mapClick)},t.prototype.createMiniMap=function(t,e){var n,r=document.createElement("div");this.miniMapContainer=r,r.appendChild(this.miniMapWrap),r.style.position="absolute",void 0===t&&void 0===e||(this.leftPosition=t||0,this.topPosition=e||0,this.rightPosition=void 0,this.bottomPosition=void 0),this.updateMiniMapPosition(),r.className="lf-mini-map",this.isShowCloseIcon||r.classList.add("lf-mini-map-no-close-icon"),this.isShowHeader||r.classList.add("lf-mini-map-no-header"),null===(n=this.container)||void 0===n||n.appendChild(r),this.miniMapWrap.appendChild(this.viewport);var i=document.createElement("div");i.className="lf-mini-map-header",i.innerText=this.headerTitle,r.appendChild(i);var o=document.createElement("span");o.className="lf-mini-map-close",o.addEventListener("click",this.hide),r.appendChild(o)},t.prototype.updateMiniMapPosition=function(){if(this.miniMapContainer){var t=this.miniMapContainer.style;void 0!==this.rightPosition?(t.right="".concat(this.rightPosition,"px"),t.left=""):(t.left="".concat(this.leftPosition,"px"),t.right=""),void 0!==this.bottomPosition?(t.bottom="".concat(this.bottomPosition,"px"),t.top=""):(t.top="".concat(this.topPosition,"px"),t.bottom="")}},t.prototype.removeMiniMap=function(){var t;this.miniMapContainer&&(null===(t=this.container)||void 0===t||t.removeChild(this.miniMapContainer))},t.prototype.updateBounds=function(t){t&&this.updateElementAreaBounds(t),this.updateViewPortBounds(),this.bounds={left:Math.min(this.elementAreaBounds.left,this.viewPortBounds.left),right:Math.max(this.elementAreaBounds.right,this.viewPortBounds.right),top:Math.min(this.elementAreaBounds.top,this.viewPortBounds.top),bottom:Math.max(this.elementAreaBounds.bottom,this.viewPortBounds.bottom)}},t.prototype.updateElementAreaBounds=function(t){var e={left:0,right:0,top:0,bottom:0},n=t.nodes;n&&n.length>0&&n.forEach((function(t){var n,r,i=t.x,o=t.y,a=null!==(n=t.width)&&void 0!==n?n:200,u=null!==(r=t.height)&&void 0!==r?r:200,s=i-a/2,l=i+a/2,c=o-u/2,d=o+u/2;e.left=Math.min(s,e.left),e.right=Math.max(l,e.right),e.top=Math.min(c,e.top),e.bottom=Math.max(d,e.bottom)})),this.elementAreaBounds=e},t.prototype.updateViewPortBounds=function(){var t=this.lf.getTransform(),e=t.TRANSLATE_X,n=t.TRANSLATE_Y,r=t.SCALE_X,i=t.SCALE_Y,o=this.lf.graphModel,a=o.width,u=o.height;this.viewPortBounds={left:-e/r,right:(-e+a)/r,top:-n/i,bottom:(-n+u)/i}},t.prototype.resetData=function(t){var e=t.nodes,n=t.edges;return e.forEach((function(t){t.text=void 0})),this.showEdge&&n.forEach((function(t){t.text=void 0})),{nodes:e,edges:this.showEdge?n:[]}},t.prototype.setView=function(t){var e,n;if(void 0===t&&(t=!0),t){var r=this.lf.getGraphRawData(),i=this.resetData(r),o=this.lf.viewMap,a=this.lf.graphModel.modelMap,u=this.lfMap.viewMap;try{for(var s=b(o.keys()),l=s.next();!l.done;l=s.next()){var c=l.value;u.has(c)||this.lfMap.register({type:c,view:o.get(c),model:a.get(c)})}}catch(t){e={error:t}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}this.lfMap.render(i),this.updateBounds(i)}else this.updateBounds();var d=this.bounds,h=d.left,p=d.top,f=d.right-h,v=d.bottom-p,g=this.width/f,y=this.height/v,m=Math.min(g,y);this.scale=m;var x=h-(this.width/m-f)/2,_=p-(this.height/m-v)/2;if(this.lfMap.graphModel.transformModel.translate(-x+this.translateX,-_+this.translateY),this.translateX=x,this.translateY=_,this.miniMapWrap.firstChild){var w=this.miniMapWrap.firstChild.style;w.pointerEvents="none",w.transform="matrix(".concat(m,", 0, 0, ").concat(m,", 0, 0)"),w.transformOrigin="left top",w.height="".concat(this.height/m,"px"),w.width="".concat(this.width/m,"px"),this.updateViewPort()}},t.prototype.updateViewPort=function(){var t=this.viewport.style,e=this.lf.getTransform(),n=e.TRANSLATE_X,r=e.TRANSLATE_Y,i=e.SCALE_X,o=e.SCALE_Y,a=this.lf.graphModel,u=a.width,s=a.height;this.viewPortLeft=-n/i,this.viewPortTop=-r/o,this.viewPortWidth=u/i*this.scale,this.viewPortHeight=s/o*this.scale,t.width="".concat(this.viewPortWidth,"px"),t.height="".concat(this.viewPortHeight,"px"),t.left="".concat((this.viewPortLeft-this.translateX)*this.scale,"px"),t.top="".concat((this.viewPortTop-this.translateY)*this.scale,"px")},t.prototype.createViewPort=function(){var t=document.createElement("div");t.className="lf-minimap-viewport",t.addEventListener("mousedown",this.startDrag),t.addEventListener("click",(function(t){t.stopPropagation()})),this.viewport=t},t.pluginName="miniMap",t}(),pg={tr:"tl",lb:"tl",tl:"tr",rb:"tr",br:"bl",lt:"bl",bl:"br",rt:"br"};function fg(t,e,n,r){var i,o="",a="";t[0]===e[0]?o=t[1]>e[1]?"t":"b":t[1]===e[1]&&(o=t[0]>e[0]?"l":"r"),e[0]===n[0]?a=e[1]>n[1]?"t":"b":e[1]===n[1]&&(a=e[0]>n[0]?"l":"r");var u=Math.min(Math.hypot(e[0]-t[0],e[1]-t[1])/2,Math.hypot(n[0]-e[0],n[1]-e[1])/2,r)||.2*r,s="".concat(o).concat(a),l=pg[s]||"-",c="L ".concat(t[0]," ").concat(t[1]);if("-"===l)c+="L ".concat(e[0]," ").concat(e[1]," L ").concat(n[0]," ").concat(n[1]);else{var d=x(function(t,e,n,r){var i=[t[0],t[1]],o=[t[0],t[1]];switch(n){case"tl":return"tr"===e?(i[1]+=r,o[0]+=r):"lb"===e&&(i[0]+=r,o[1]+=r),[i,o];case"tr":return"tl"===e?(i[1]+=r,o[0]-=r):"rb"===e&&(i[0]-=r,o[1]+=r),[i,o];case"bl":return"br"===e?(i[1]-=r,o[0]+=r):"lt"===e&&(i[0]+=r,o[1]-=r),[i,o];case"br":return"bl"===e?(i[1]-=r,o[0]-=r):"rt"===e&&(i[0]-=r,o[1]-=r),[i,o];default:return[]}}(e,s,l,u),2),h=d[0],p=d[1];h&&p&&(c+="L ".concat(h[0]," ").concat(h[1]," Q ").concat(e[0]," ").concat(e[1]," ").concat(p[0]," ").concat(p[1]),i=x(p,2),e[0]=i[0],e[1]=i[1])}return c}function vg(t,e){var n=0,r="";if(2===t.length)r+="M".concat(t[n][0]," ").concat(t[n++][1]," L ").concat(t[n][0]," ").concat(t[n][1]);else{for(r+="M".concat(t[n][0]," ").concat(t[n++][1]);n+1<t.length;){r+=fg(t[n-1],t[n],t[1+n++],e)}r+="L ".concat(t[n][0]," ").concat(t[n][1])}return r}var gg=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getEdge=function(){var t=this.props.model,n=t.points,r=t.isAnimation,i=t.arrowConfig,o=t.radius,a=void 0===o?5:o,u=t.getEdgeStyle(),s=t.getEdgeAnimationStyle(),l=function(t){for(var e=t,n=1;n<e.length-1;){var r=x(e[n-1],2),i=r[0],o=r[1],a=x(e[n],2),u=a[0],s=a[1],l=x(e[n+1],2),c=l[0],d=l[1];i===u&&u===c||o===s&&s===d?e.splice(n,1):n++}return e}(n.split(" ").map((function(t){return t.split(",").map((function(t){return+t}))}))),c=vg(l,a),d=v(v(v({style:r?s:{}},u),i),{fill:"none"});return e.h("path",v({d:c},d))},n}(e.PolylineEdge),yg=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e}(e.PolylineEdgeModel),mg=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getLabelShape=function(){var t=this.props.model,n=t.id,r=t.x,i=t.y,o=t.width,a=t.height,u=t.properties,s=this.props.model.getNodeStyle();return e.h("svg",{x:r-o/2,y:i-a/2,width:50,height:24,style:"z-index: 0; background: none; overflow: auto;"},[u.labelText?e.h("text",{x:0,y:-5,fontSize:"16px",fill:s.stroke},u.labelText):"",u.disabledDelete?"":e.h("text",{x:u.labelText?50:0,y:-5,fontSize:"24px",cursor:"pointer",fill:s.stroke,onclick:this.handleCustomDeleteIconClick.bind(this,n)},"x")])},n.prototype.getShape=function(){var t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.id,u=this.props.model.getNodeStyle();return e.h("g",{},[e.h("rect",v(v({},u),{x:n-i/2,y:r-o/2,width:i,height:o,id:a})),this.getLabelShape()])},n.prototype.toFront=function(){},n.prototype.handleCustomDeleteIconClick=function(t){this.props.graphModel.deleteNode(t)},n}(e.PolygonNode),bg=function(t){function e(){var e=t.apply(this,_([],x(arguments),!1))||this;return e.d=10,e}return f(e,t),e.prototype.initNodeData=function(e){e.text={value:"",x:e.x,y:e.y,draggable:!1,editable:!1},t.prototype.initNodeData.call(this,e),this.zIndex=0,this.draggable=!0},e.prototype.setAttributes=function(){var t,e=this;this.points=[],(null===(t=this.properties)||void 0===t?void 0:t.node_selection_ids).length>1&&setTimeout((function(){var t;e.updatePointsByNodes((null===(t=e.properties)||void 0===t?void 0:t.node_selection_ids)||[])}))},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this);return e.stroke=this.properties.strokeColor||"#008000",e.strokeDasharray="10 5",e},e.prototype.getDefaultAnchor=function(){return[]},e.prototype.updatePoints=function(t){this.points=t},e.prototype.updateCoordinate=function(t){var e=t.x,n=t.y;this.x=e,this.y=n},e.prototype.updatePointsByNodes=function(t){var e=this,n=[],r=1/0,i=1/0,o=-1/0,a=-1/0;t.forEach((function(t){var n=e.graphModel.getNodeModelById(t);if(n){var u=n.width,s=n.height,l=n.x,c=n.y;r=Math.min(r,l-u/2-e.d),i=Math.min(i,c-s/2-e.d),o=Math.max(o,l+u/2+e.d),a=Math.max(a,c+s/2+e.d)}})),n.push([r,i],[o,i],[o,a],[r,a]),[r,i,o,a].some((function(t){return Math.abs(t)===1/0}))||(this.updatePoints(n),this.updateCoordinate({x:(o+r)/2,y:(a+i)/2}))},e}(e.PolygonNodeModel),xg=function(){function t(t){var e=t.lf;this.selectNodes=[],this.d=10,e.register({type:"node-selection",view:mg,model:bg})}return Object.defineProperty(t.prototype,"selectNodesIds",{get:function(){return this.selectNodes.map((function(t){return t.id}))},enumerable:!1,configurable:!0}),t.prototype.addNodeSelection=function(){this.lf.addNode({type:"node-selection",text:"",properties:{node_selection_ids:this.selectNodesIds}}).updatePointsByNodes(this.selectNodesIds)},t.prototype.updateNodeSelection=function(){var t=this.getNodeSelection();t&&(this.lf.setProperties(t.id,{node_selection_ids:this.selectNodesIds}),this.lf.getNodeModelById(t.id).updatePointsByNodes(this.selectNodesIds))},t.prototype.getNodeSelection=function(){var t=this,e=this.selectNodesIds,n=this.lf.getGraphRawData(),r=e.filter((function(e){return e!==t.currentClickNode.id}));return n.nodes.find((function(t){if("node-selection"===t.type){var e=Di(t,"properties.node_selection_ids",[]);return r.every((function(t){return e.includes(t)}))}return!1}))},t.prototype.render=function(t){var e=this;this.lf=t,t.on("node:click",(function(n){if(n.e.shiftKey&&"node-selection"!==n.data.type){e.currentClickNode=n.data;var r=!1;e.selectNodesIds.includes(n.data.id)&&(e.lf.getNodeModelById(n.data.id).setSelected(!1),r=!0);var i=t.getSelectElements(!0).nodes;e.selectNodes=i,1===e.selectNodes.length?r?e.updateNodeSelection():e.addNodeSelection():e.selectNodes.length>1&&e.updateNodeSelection()}})),t.graphModel.addNodeMoveRules((function(e,n,r){if("node-selection"===e.type){var i=e.properties.node_selection_ids;return t.graphModel.moveNodes(i,n,r,!0),!0}return!0}))},t.pluginName="node-selection",t}(),_g=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.paths=[],e.getPathes=function(){if(!n.startNodeType)throw new Error("需要预先指定开始节点类型");return n.getPathes()},e.setRawPaths=function(t){n.setPathes(t)},e.getRawPathes=function(){return n.paths},e.setStartNodeType=function(t){n.startNodeType=t}}return t.prototype.setPathes=function(t){this.paths=t.map((function(t){return{routeId:t.routeId,name:t.name,elements:t.elements,type:t.type,similarElement:null,weight:0}}))},t.prototype.getPathes=function(){var t=this,e=this.lf.getGraphRawData(),n=new Map,r=[];e.nodes.forEach((function(e){n.set(e.id,{id:e.id,data:e,nextNodes:[]}),e.type===t.startNodeType&&r.push(e.id)})),e.edges.forEach((function(t){var e=n.get(t.sourceNodeId);null==e||e.nextNodes.push(t.targetNodeId)}));var i=[];return r.forEach((function(e){var r=n.get(e);r&&(i=i.concat(t.findPathElements(r,n,[])))})),this.getNewPathes(i)},t.prototype.findPathElements=function(t,e,n){void 0===n&&(n=[]);var r=_([],x(n),!1);if(r.push(t.id),0===t.nextNodes.length)return[r];for(var i=[],o=0;o<t.nextNodes.length;o++){var a=e.get(t.nextNodes[o]),u=void 0;if(a){var s=r.indexOf(a.id);u=-1!==s?[_(_([],x(r.slice(s)),!1),[a.id],!1)]:this.findPathElements(a,e,_([],x(r),!1)),i=i.concat(u)}}return i},t.prototype.getNewPathes=function(t){var e=this,n=[],r=new Set;t.forEach((function(t){console.log("elements",t);var i=e.getNewId("path"),o=e.getNewId("路径"),a=e.isLoopPath(t),u=t.join(",");r.has(u)||(r.add(u),n.push({routeId:i,name:o,elements:t,type:a,weight:0,similarElement:""}))}));var i=JSON.parse(JSON.stringify(this.paths));return n.forEach((function(t){for(var n=0;n<i.length;n++){var r=i[n],o=e.similar2Path(_([],x(t.elements),!1),_([],x(r.elements),!1));o>t.weight&&r.weight<=o&&(t.weight=o,t.similarElement=r,o===r.weight&&r.similarElement?(r.similarElement.similarElement=null,r.similarElement.weight=0,r.similarElement=null,r.weight=0):(r.similarElement=t,r.weight=o))}})),n.forEach((function(t){t.similarElement&&t.similarElement.similarElement===t&&(t.routeId=t.similarElement.routeId,t.name=t.similarElement.name),delete t.similarElement,delete t.weight})),this.setPathes(n),n},t.prototype.similar2Path=function(t,e){var n=0,r=t.length+e.length;t.sort(),e.sort();for(var i=t.shift(),o=e.shift();void 0!==i&&void 0!==o;)i===o?(n++,i=t.shift(),o=e.shift()):i<o?i=t.shift():i>o&&(o=e.shift());return n/r*200},t.prototype.getNewId=function(t){return"".concat(t,"_").concat(E())},t.prototype.isLoopPath=function(t){var e=t.length;return t.indexOf(t[e-1])!==e-1?1:0},t.pluginName="flowPath",t}(),wg=-1,Mg=0,Eg=1,Ng=function(){function t(t){var e=t.lf,n=this;this.levelHeight=[],this.newNodeMap=new Map,this.lf=e,this.trunk=[],e.layout=function(t){var e=n.lf.getGraphRawData();n.lf.setStartNodeType(t);var r=n.lf.getPathes();return n.levelHeight=[],n.newNodeMap=new Map,n.layout(e,r)}}return t.prototype.layout=function(t,e){var n=this,r=[];e.forEach((function(t){var e=t.elements;e.length>r.length?r=e:e.length===r.length&&JSON.stringify(e)===JSON.stringify(n.trunk)&&(r=n.trunk)})),this.trunk=r;for(var i=this.formatData(t),o={nodes:[],edges:[]},a=r.length-1;a>=0;a--)this.setNodePosition(r[a],i,o,a,1);this.lf.graphModel.graphDataToModel(o)},t.prototype.setNodePosition=function(t,e,n,r,i){var o=this,a=e[t],u=a.text,s=a.type,l=a.next,c=a.properties,d=160*r+40,h=120*i,p={id:t,x:d,text:u,y:h,type:s,properties:c};return u&&"object"==typeof u&&(p.text=v(v({},u),{x:d+u.x,y:h+u.y})),this.newNodeMap.set(p.id,{x:p.x,y:p.y,type:s}),n.nodes.push(p),a.isFixed=!0,this.addLevelHeight(r,1),l&&l.length>0&&l.forEach((function(i){if(!e[i.nodeId].isFixed){var a=o.getLevelHeight(r+1);o.addLevelHeight(r,1),o.setNodePosition(i.nodeId,e,n,r+1,a+1)}n.edges.push(v({id:i.edgeId,type:i.edgeType,sourceNodeId:t,targetNodeId:i.nodeId,properties:i.properties,text:i.text},o.getEdgeDataPoints(t,i.nodeId)))})),p},t.prototype.getEdgeDataPoints=function(t,e){var n=this.newNodeMap.get(t),r=this.newNodeMap.get(e),i=this.getShape(t),o=i.width,a=i.height,u=this.getShape(e),s=u.width,l=u.height,c=this.getRelativePosition(n,r),d={x:n.x,y:n.y},h={x:r.x,y:r.y};switch(c){case Mg:d.x=n.x+o/2,h.x=r.x-s/2;break;case wg:d.y=n.y+a/2,h.x=r.x-s/2;break;case Eg:d.x=n.x+o/2,h.y=r.y+l/2}return{startPoint:d,endPoint:h}},t.prototype.getRelativePosition=function(t,e){var n=t.y,r=e.y;return n<r?-1:n===r?0:1},t.prototype.getShape=function(t){var e,n,r=this.lf.getNodeModelById(t);return{height:null!==(e=null==r?void 0:r.height)&&void 0!==e?e:0,width:null!==(n=null==r?void 0:r.width)&&void 0!==n?n:0}},t.prototype.formatData=function(t){var e=t.nodes.reduce((function(t,e){var n=e.type,r=e.properties,i=e.text,o=e.x,a=e.y;return i&&"object"==typeof i&&(i.x=i.x-o,i.y=i.y-a),t[e.id]={type:n,properties:r,text:i,prev:[],next:[]},t}),{});return t.edges.forEach((function(t){var n=t.sourceNodeId,r=t.targetNodeId,i=t.id,o=t.properties,a=t.text,u=a;"object"==typeof a&&(u=a.value),e[n].next.push({edgeId:i,nodeId:r,edgeType:t.type,properties:o,text:u}),e[r].prev.push({edgeId:i,nodeId:n,properties:o,text:u})})),e},t.prototype.addLevelHeight=function(t,e,n){void 0===e&&(e=1),void 0===n&&(n=!1);var r=this.levelHeight[t];r||(r={positiveHeight:0,negativeHeight:0},this.levelHeight[t]=r),n?r.negativeHeight-=e:r.positiveHeight+=e},t.prototype.getLevelHeight=function(t,e){void 0===e&&(e=!1);var n=this.levelHeight[t];return n?e?n.negativeHeight:n.positiveHeight:0},t.pluginName="AutoLayout",t}(),Sg=function(t,e){var n=[],r=[],i=function(t,r,o){o&&r.unshift.apply(r,_([],x(e.getEdgeModels({sourceNodeId:t.id,targetNodeId:null==o?void 0:o.id}).map((function(t){return t.id}))),!1)),r.includes(t.id)?n.push(r):(r.unshift(t.id),t.incoming.nodes.length?t.incoming.nodes.forEach((function(e){i(e,r.slice(),t)})):n.push(r))},o=function(t,n,i){i&&n.push.apply(n,_([],x(e.getEdgeModels({sourceNodeId:null==i?void 0:i.id,targetNodeId:t.id}).map((function(t){return t.id}))),!1)),n.includes(t.id)?r.push(n):(n.push(t.id),t.outgoing.nodes.length?t.outgoing.nodes.forEach((function(e){o(e,n.slice(),t)})):r.push(n))};return i(t,[]),o(t,[]),_([],x(new Set(_(_([],x(n.flat()),!1),x(r.flat()),!1))),!1)},Ag=function(){function t(t){var e=t.lf;this.mode="path",this.manual=!1,this.tempStyles={},this.lf=e}return t.prototype.setMode=function(t){this.mode=t},t.prototype.setManual=function(t){this.manual=t},t.prototype.highlightSingle=function(t){var e=this.lf.getModelById(t);"node"===(null==e?void 0:e.BaseType)?e.updateStyles(this.tempStyles[t]):"edge"===(null==e?void 0:e.BaseType)&&(e.updateStyles(this.tempStyles[t]),e.sourceNode.updateStyles(this.tempStyles[e.sourceNode.id]),e.targetNode.updateStyles(this.tempStyles[e.targetNode.id]))},t.prototype.highlightPath=function(t){var e=this,n=function(t,e){var n=e.getModelById(t);return Sg("node"===(null==n?void 0:n.BaseType)?n:null==n?void 0:n.targetNode,e)}(t,this.lf);n.forEach((function(t){var n;null===(n=e.lf.getModelById(t))||void 0===n||n.updateStyles(e.tempStyles[t])}))},t.prototype.highlight=function(t,e){var n=this;(void 0===e&&(e=this.mode),this.manual)||(Object.keys(this.tempStyles).length&&this.restoreHighlight(),Object.values(this.lf.graphModel.modelsMap).forEach((function(t){var e="node"===t.BaseType?t.getNodeStyle():t.getEdgeStyle();n.tempStyles[t.id]=v({},e),t.setStyles({opacity:.1})})),{single:this.highlightSingle.bind(this),path:this.highlightPath.bind(this)}[e](t))},t.prototype.restoreHighlight=function(){var t=this;Object.keys(this.tempStyles).length&&(Object.values(this.lf.graphModel.modelsMap).forEach((function(e){var n,r=null!==(n=t.tempStyles[e.id])&&void 0!==n?n:{};e.updateStyles(v({},r))})),this.tempStyles={})},t.prototype.render=function(){var t=this;this.lf.on("node:mouseenter",(function(e){var n=e.data;return t.highlight(n.id)})),this.lf.on("edge:mouseenter",(function(e){var n=e.data;return t.highlight(n.id)})),this.lf.on("node:mouseleave",this.restoreHighlight.bind(this)),this.lf.on("edge:mouseleave",this.restoreHighlight.bind(this)),this.lf.on("history:change",this.restoreHighlight.bind(this))},t.prototype.destroy=function(){},t.pluginName="highlight",t}();t.AutoLayout=Ng,t.BPMNAdapter=Dv,t.BPMNBaseAdapter=Rv,t.BPMNElements=Zf,t.BoundaryEventFactory=bt,t.BpmnAdapter=lt,t.BpmnElement=H,t.BpmnXmlAdapter=ct,t.ContextMenu=lg,t.Control=ng,t.CurvedEdge=gg,t.CurvedEdgeModel=yg,t.DiamondResize=kf,t.DiamondResizeModel=Pf,t.DiamondResizeView=Tf,t.DndPanel=cg,t.EllipseResize=Af,t.EllipseResizeModel=Nf,t.EllipseResizeView=Sf,t.EndEventFactory=gt,t.EndEventModel=P,t.EndEventView=T,t.ExclusiveGatewayModel=j,t.ExclusiveGatewayView=R,t.FlowPath=_g,t.GatewayNodeFactory=Ot,t.Group=Gf,t.GroupNode=zf,t.GroupNodeModel=Bf,t.Highlight=Ag,t.HtmlResize=If,t.HtmlResizeModel=Cf,t.HtmlResizeView=Of,t.InsertNodeInPolyline=eg,t.IntermediateCatchEventFactory=yt,t.IntermediateThrowEventFactory=xt,t.Menu=ug,t.MiniMap=hg,t.NodeResize=Lf,t.NodeSelection=xg,t.RectResize=Df,t.RectResizeModel=jf,t.RectResizeView=Rf,t.SelectionSelect=dg,t.SequenceFlowModel=C,t.SequenceFlowView=O,t.ServiceTaskModel=L,t.ServiceTaskView=B,t.Snapshot=Uv,t.StartEventFactory=mt,t.StartEventModel=N,t.StartEventView=S,t.SubProcessFactory=Hf,t.TaskNodeFactory=jt,t.UserTaskModel=W,t.UserTaskView=F,t.bpmnUtils=vt,t.convertNormalToXml=Pv,t.convertXmlToNormal=Tv,t.gateway={exclusive:0,inclusive:1,parallel:2},t.gatewayComposable=[[1,1,0],[0,0,1],[0,1,1]],t.getCurvedEdgePath=vg,t.handleAttributes=Y,t.icons=Ct,t.lfJson2Xml=$,t.lfXml2Json=tt,t.multiInstanceIcon=It,t.sequenceFlowFactory=Uf,t.toLogicflowData=function(t){var e={nodes:[],edges:[]},n=t.flowElementList;return n&&n.length>0&&n.forEach((function(t){if(t.type===Vv.SEQUENCE_FLOW){var n=function(t){var e=t.incoming,n=t.outgoing,r=t.properties,i=t.key,o=t.type,a=r.text,u=r.name,s=r.startPoint,l=r.endPoint,c=r.pointsList,d={id:i,type:qv[o],sourceNodeId:e[0],targetNodeId:n[0],text:a||u,properties:{}};s&&(d.startPoint=JSON.parse(s)),l&&(d.endPoint=JSON.parse(l)),c&&(d.pointsList=JSON.parse(c));var h=["startPoint","endPoint","pointsList","text"];return Object.keys(t.properties).forEach((function(e){-1===h.indexOf(e)&&(d.properties[e]=t.properties[e])})),d}(t);e.edges.push(n)}else{var r=function(t){var e=t.properties,n=t.key,r=t.type,i=t.bounds,o=e.x,a=e.y,u=e.text;if(void 0===o){var s=x(i,2),l=s[0],c=l.x,d=l.y,h=s[1];o=(c+h.x)/2,a=(d+h.y)/2}var p={id:n,type:qv[r],x:o,y:a,text:u,properties:{}},f=["x","y","text"];return Object.keys(t.properties).forEach((function(e){-1===f.indexOf(e)&&(p.properties[e]=t.properties[e])})),p}(t);e.nodes.push(r)}})),e},t.toNormalJson=it,t.toTurboData=function(t){var e=new Map,n={flowElementList:[]};return t.nodes.forEach((function(t){var r=function(t){var e=t.id,n=t.type,r=t.x,i=t.y,o=t.text,a=void 0===o?"":o,u=t.properties;return{incoming:[],outgoing:[],dockers:[],type:Yv(n),properties:v(v({},u),{name:a&&a.value||"",x:r,y:i,text:a}),key:e}}(t);n.flowElementList.push(r),e.set(t.id,r)})),t.edges.forEach((function(t){var r=function(t){var e=t.id,n=t.type,r=t.sourceNodeId,i=t.targetNodeId,o=t.startPoint,a=t.endPoint,u=t.pointsList,s=t.text,l=void 0===s?"":s,c=t.properties;return{incoming:[r],outgoing:[i],type:Yv(n),dockers:[],properties:v(v({},c),{name:l&&l.value||"",text:l,startPoint:JSON.stringify(o),endPoint:JSON.stringify(a),pointsList:JSON.stringify(u)}),key:e}}(t);e.get(t.sourceNodeId).outgoing.push(r.key),e.get(t.targetNodeId).incoming.push(r.key),n.flowElementList.push(r)})),n},t.toXmlJson=rt,t.useDefinition=Yf}));
11
+ var df,hf,pf=4294967295,ff=Array.prototype,vf=Object.prototype.hasOwnProperty,gf=Bt?Bt.iterator:void 0,yf=Math.max,mf=Math.min,bf=function(t){return function(e,n,r){if(null==r){var i=de(n),o=i&&ii(n),a=o&&o.length&&tc(n,o);(a?a.length:i)||(r=n,n=e,e=this)}return t(e,n,r)}}(dd);hn.after=$p.after,hn.ary=$p.ary,hn.assign=rf.assign,hn.assignIn=rf.assignIn,hn.assignInWith=rf.assignInWith,hn.assignWith=rf.assignWith,hn.at=rf.at,hn.before=$p.before,hn.bind=$p.bind,hn.bindAll=uf.bindAll,hn.bindKey=$p.bindKey,hn.castArray=Jp.castArray,hn.chain=of.chain,hn.chunk=Yp.chunk,hn.compact=Yp.compact,hn.concat=Yp.concat,hn.cond=uf.cond,hn.conforms=uf.conforms,hn.constant=uf.constant,hn.countBy=Zp.countBy,hn.create=rf.create,hn.curry=$p.curry,hn.curryRight=$p.curryRight,hn.debounce=$p.debounce,hn.defaults=rf.defaults,hn.defaultsDeep=rf.defaultsDeep,hn.defer=$p.defer,hn.delay=$p.delay,hn.difference=Yp.difference,hn.differenceBy=Yp.differenceBy,hn.differenceWith=Yp.differenceWith,hn.drop=Yp.drop,hn.dropRight=Yp.dropRight,hn.dropRightWhile=Yp.dropRightWhile,hn.dropWhile=Yp.dropWhile,hn.fill=Yp.fill,hn.filter=Zp.filter,hn.flatMap=Zp.flatMap,hn.flatMapDeep=Zp.flatMapDeep,hn.flatMapDepth=Zp.flatMapDepth,hn.flatten=Yp.flatten,hn.flattenDeep=Yp.flattenDeep,hn.flattenDepth=Yp.flattenDepth,hn.flip=$p.flip,hn.flow=uf.flow,hn.flowRight=uf.flowRight,hn.fromPairs=Yp.fromPairs,hn.functions=rf.functions,hn.functionsIn=rf.functionsIn,hn.groupBy=Zp.groupBy,hn.initial=Yp.initial,hn.intersection=Yp.intersection,hn.intersectionBy=Yp.intersectionBy,hn.intersectionWith=Yp.intersectionWith,hn.invert=rf.invert,hn.invertBy=rf.invertBy,hn.invokeMap=Zp.invokeMap,hn.iteratee=uf.iteratee,hn.keyBy=Zp.keyBy,hn.keys=ii,hn.keysIn=rf.keysIn,hn.map=Zp.map,hn.mapKeys=rf.mapKeys,hn.mapValues=rf.mapValues,hn.matches=uf.matches,hn.matchesProperty=uf.matchesProperty,hn.memoize=$p.memoize,hn.merge=rf.merge,hn.mergeWith=rf.mergeWith,hn.method=uf.method,hn.methodOf=uf.methodOf,hn.mixin=bf,hn.negate=fd,hn.nthArg=uf.nthArg,hn.omit=rf.omit,hn.omitBy=rf.omitBy,hn.once=$p.once,hn.orderBy=Zp.orderBy,hn.over=uf.over,hn.overArgs=$p.overArgs,hn.overEvery=uf.overEvery,hn.overSome=uf.overSome,hn.partial=$p.partial,hn.partialRight=$p.partialRight,hn.partition=Zp.partition,hn.pick=rf.pick,hn.pickBy=rf.pickBy,hn.property=uf.property,hn.propertyOf=uf.propertyOf,hn.pull=Yp.pull,hn.pullAll=Yp.pullAll,hn.pullAllBy=Yp.pullAllBy,hn.pullAllWith=Yp.pullAllWith,hn.pullAt=Yp.pullAt,hn.range=uf.range,hn.rangeRight=uf.rangeRight,hn.rearg=$p.rearg,hn.reject=Zp.reject,hn.remove=Yp.remove,hn.rest=$p.rest,hn.reverse=Yp.reverse,hn.sampleSize=Zp.sampleSize,hn.set=rf.set,hn.setWith=rf.setWith,hn.shuffle=Zp.shuffle,hn.slice=Yp.slice,hn.sortBy=Zp.sortBy,hn.sortedUniq=Yp.sortedUniq,hn.sortedUniqBy=Yp.sortedUniqBy,hn.split=af.split,hn.spread=$p.spread,hn.tail=Yp.tail,hn.take=Yp.take,hn.takeRight=Yp.takeRight,hn.takeRightWhile=Yp.takeRightWhile,hn.takeWhile=Yp.takeWhile,hn.tap=of.tap,hn.throttle=$p.throttle,hn.thru=fp,hn.toArray=Jp.toArray,hn.toPairs=rf.toPairs,hn.toPairsIn=rf.toPairsIn,hn.toPath=uf.toPath,hn.toPlainObject=Jp.toPlainObject,hn.transform=rf.transform,hn.unary=$p.unary,hn.union=Yp.union,hn.unionBy=Yp.unionBy,hn.unionWith=Yp.unionWith,hn.uniq=Yp.uniq,hn.uniqBy=Yp.uniqBy,hn.uniqWith=Yp.uniqWith,hn.unset=rf.unset,hn.unzip=Yp.unzip,hn.unzipWith=Yp.unzipWith,hn.update=rf.update,hn.updateWith=rf.updateWith,hn.values=rf.values,hn.valuesIn=rf.valuesIn,hn.without=Yp.without,hn.words=af.words,hn.wrap=$p.wrap,hn.xor=Yp.xor,hn.xorBy=Yp.xorBy,hn.xorWith=Yp.xorWith,hn.zip=Yp.zip,hn.zipObject=Yp.zipObject,hn.zipObjectDeep=Yp.zipObjectDeep,hn.zipWith=Yp.zipWith,hn.entries=rf.toPairs,hn.entriesIn=rf.toPairsIn,hn.extend=rf.assignIn,hn.extendWith=rf.assignInWith,bf(hn,hn),hn.add=Qp.add,hn.attempt=uf.attempt,hn.camelCase=af.camelCase,hn.capitalize=af.capitalize,hn.ceil=Qp.ceil,hn.clamp=tf,hn.clone=Jp.clone,hn.cloneDeep=Jp.cloneDeep,hn.cloneDeepWith=Jp.cloneDeepWith,hn.cloneWith=Jp.cloneWith,hn.conformsTo=Jp.conformsTo,hn.deburr=af.deburr,hn.defaultTo=uf.defaultTo,hn.divide=Qp.divide,hn.endsWith=af.endsWith,hn.eq=Jp.eq,hn.escape=af.escape,hn.escapeRegExp=af.escapeRegExp,hn.every=Zp.every,hn.find=Zp.find,hn.findIndex=Yp.findIndex,hn.findKey=rf.findKey,hn.findLast=Zp.findLast,hn.findLastIndex=Yp.findLastIndex,hn.findLastKey=rf.findLastKey,hn.floor=Qp.floor,hn.forEach=Zp.forEach,hn.forEachRight=Zp.forEachRight,hn.forIn=rf.forIn,hn.forInRight=rf.forInRight,hn.forOwn=rf.forOwn,hn.forOwnRight=rf.forOwnRight,hn.get=rf.get,hn.gt=Jp.gt,hn.gte=Jp.gte,hn.has=rf.has,hn.hasIn=rf.hasIn,hn.head=Yp.head,hn.identity=we,hn.includes=Zp.includes,hn.indexOf=Yp.indexOf,hn.inRange=ef,hn.invoke=rf.invoke,hn.isArguments=Jp.isArguments,hn.isArray=te,hn.isArrayBuffer=Jp.isArrayBuffer,hn.isArrayLike=Jp.isArrayLike,hn.isArrayLikeObject=Jp.isArrayLikeObject,hn.isBoolean=Jp.isBoolean,hn.isBuffer=Jp.isBuffer,hn.isDate=Jp.isDate,hn.isElement=Jp.isElement,hn.isEmpty=Jp.isEmpty,hn.isEqual=Jp.isEqual,hn.isEqualWith=Jp.isEqualWith,hn.isError=Jp.isError,hn.isFinite=Jp.isFinite,hn.isFunction=Jp.isFunction,hn.isInteger=Jp.isInteger,hn.isLength=Jp.isLength,hn.isMap=Jp.isMap,hn.isMatch=Jp.isMatch,hn.isMatchWith=Jp.isMatchWith,hn.isNaN=Jp.isNaN,hn.isNative=Jp.isNative,hn.isNil=Jp.isNil,hn.isNull=Jp.isNull,hn.isNumber=Jp.isNumber,hn.isObject=de,hn.isObjectLike=Jp.isObjectLike,hn.isPlainObject=Jp.isPlainObject,hn.isRegExp=Jp.isRegExp,hn.isSafeInteger=Jp.isSafeInteger,hn.isSet=Jp.isSet,hn.isString=Jp.isString,hn.isSymbol=Jp.isSymbol,hn.isTypedArray=Jp.isTypedArray,hn.isUndefined=Jp.isUndefined,hn.isWeakMap=Jp.isWeakMap,hn.isWeakSet=Jp.isWeakSet,hn.join=Yp.join,hn.kebabCase=af.kebabCase,hn.last=hl,hn.lastIndexOf=Yp.lastIndexOf,hn.lowerCase=af.lowerCase,hn.lowerFirst=af.lowerFirst,hn.lt=Jp.lt,hn.lte=Jp.lte,hn.max=Qp.max,hn.maxBy=Qp.maxBy,hn.mean=Qp.mean,hn.meanBy=Qp.meanBy,hn.min=Qp.min,hn.minBy=Qp.minBy,hn.stubArray=uf.stubArray,hn.stubFalse=uf.stubFalse,hn.stubObject=uf.stubObject,hn.stubString=uf.stubString,hn.stubTrue=uf.stubTrue,hn.multiply=Qp.multiply,hn.nth=Yp.nth,hn.noop=uf.noop,hn.now=Kp,hn.pad=af.pad,hn.padEnd=af.padEnd,hn.padStart=af.padStart,hn.parseInt=af.parseInt,hn.random=nf,hn.reduce=Zp.reduce,hn.reduceRight=Zp.reduceRight,hn.repeat=af.repeat,hn.replace=af.replace,hn.result=rf.result,hn.round=Qp.round,hn.sample=Zp.sample,hn.size=Zp.size,hn.snakeCase=af.snakeCase,hn.some=Zp.some,hn.sortedIndex=Yp.sortedIndex,hn.sortedIndexBy=Yp.sortedIndexBy,hn.sortedIndexOf=Yp.sortedIndexOf,hn.sortedLastIndex=Yp.sortedLastIndex,hn.sortedLastIndexBy=Yp.sortedLastIndexBy,hn.sortedLastIndexOf=Yp.sortedLastIndexOf,hn.startCase=af.startCase,hn.startsWith=af.startsWith,hn.subtract=Qp.subtract,hn.sum=Qp.sum,hn.sumBy=Qp.sumBy,hn.template=af.template,hn.times=uf.times,hn.toFinite=Jp.toFinite,hn.toInteger=_e,hn.toLength=Jp.toLength,hn.toLower=af.toLower,hn.toNumber=Jp.toNumber,hn.toSafeInteger=Jp.toSafeInteger,hn.toString=Jp.toString,hn.toUpper=af.toUpper,hn.trim=af.trim,hn.trimEnd=af.trimEnd,hn.trimStart=af.trimStart,hn.truncate=af.truncate,hn.unescape=af.unescape,hn.uniqueId=uf.uniqueId,hn.upperCase=af.upperCase,hn.upperFirst=af.upperFirst,hn.each=Zp.forEach,hn.eachRight=Zp.forEachRight,hn.first=Yp.head,bf(hn,(df={},js(hn,(function(t,e){vf.call(hn.prototype,e)||(df[e]=t)})),df),{chain:!1}),hn.VERSION="4.17.21",(hn.templateSettings=af.templateSettings).imports._=hn,En(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){hn[t].placeholder=hn})),En(["drop","take"],(function(t,e){en.prototype[t]=function(n){n=void 0===n?1:yf(_e(n),0);var r=this.__filtered__&&!e?new en(this):this.clone();return r.__filtered__?r.__takeCount__=mf(n,r.__takeCount__):r.__views__.push({size:mf(n,pf),type:t+(r.__dir__<0?"Right":"")}),r},en.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),En(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;en.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Ts(t),type:n}),e.__filtered__=e.__filtered__||r,e}})),En(["head","last"],(function(t,e){var n="take"+(e?"Right":"");en.prototype[t]=function(){return this[n](1).value()[0]}})),En(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");en.prototype[t]=function(){return this.__filtered__?new en(this):this[n](1)}})),en.prototype.compact=function(){return this.filter(we)},en.prototype.find=function(t){return this.filter(t).head()},en.prototype.findLast=function(t){return this.reverse().find(t)},en.prototype.invokeMap=Nr((function(t,e){return"function"==typeof t?new en(this):this.map((function(n){return Oc(n,t,e)}))})),en.prototype.reject=function(t){return this.filter(fd(Ts(t)))},en.prototype.slice=function(t,e){t=_e(t);var n=this;return n.__filtered__&&(t>0||e<0)?new en(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=_e(e))<0?n.dropRight(-e):n.take(e-t)),n)},en.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},en.prototype.toArray=function(){return this.take(pf)},js(en.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),i=hn[r?"take"+("last"==e?"Right":""):e],o=r||/^find/.test(e);i&&(hn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,u=e instanceof en,s=a[0],l=u||te(e),c=function(t){var e=i.apply(hn,Bi([t],a));return r&&d?e[0]:e};l&&n&&"function"==typeof s&&1!=s.length&&(u=l=!1);var d=this.__chain__,h=!!this.__actions__.length,p=o&&!d,f=u&&!h;if(!o&&l){e=f?e:new en(this);var v=t.apply(e,a);return v.__actions__.push({func:fp,args:[c],thisArg:void 0}),new sn(v,d)}return p&&f?t.apply(this,a):(v=this.thru(c),p?r?v.value()[0]:v.value():v)})})),En(["pop","push","shift","sort","splice","unshift"],(function(t){var e=ff[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);hn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(te(i)?i:[],t)}return this[n]((function(n){return e.apply(te(n)?n:[],t)}))}})),js(en.prototype,(function(t,e){var n=hn[e];if(n){var r=n.name+"";vf.call(on,r)||(on[r]=[]),on[r].push({name:e,func:n})}})),on[$n(void 0,2).name]=[{name:"wrapper",func:void 0}],en.prototype.clone=function(){var t=new en(this.__wrapped__);return t.__actions__=ln(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=ln(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=ln(this.__views__),t},en.prototype.reverse=function(){if(this.__filtered__){var t=new en(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},en.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=te(t),r=e<0,i=n?t.length:0,o=function(t,e,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=lf(e,t+a);break;case"takeRight":t=sf(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,u=o.end,s=u-a,l=r?u:a-1,c=this.__iteratees__,d=c.length,h=0,p=cf(s,this.__takeCount__);if(!n||!r&&i==s&&p==s)return yp(t,this.__actions__);var f=[];t:for(;s--&&h<p;){for(var v=-1,g=t[l+=e];++v<d;){var y=c[v],m=y.iteratee,b=y.type,x=m(g);if(2==b)g=x;else if(!x){if(1==b)continue t;break t}}f[h++]=g}return f},hn.prototype.at=of.at,hn.prototype.chain=of.wrapperChain,hn.prototype.commit=of.commit,hn.prototype.next=of.next,hn.prototype.plant=of.plant,hn.prototype.reverse=of.reverse,hn.prototype.toJSON=hn.prototype.valueOf=hn.prototype.value=of.value,hn.prototype.first=hn.prototype.head,gf&&(hn.prototype[gf]=of.toIterator),hf={__e:function(t,e,n,r){for(var i,o,a;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(t)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(t,r||{}),a=i.__d),a)return i.__E=i}catch(e){t=e}throw t}},"function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout;var xf=0;function _f(t,e,n,r,i,o){e||(e={});var a,u,s=e;if("ref"in s)for(u in s={},e)"ref"==u?a=e[u]:s[u]=e[u];var l={type:t,props:s,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--xf,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof t&&(a=t.defaultProps))for(u in a)void 0===s[u]&&(s[u]=a[u]);return hf.vnode&&hf.vnode(l),l}var wf=e.LogicFlowUtil.StepDrag,Mf=function(t){function n(n){var r=t.call(this)||this;return r.updatePosition=function(t){var e=t.deltaX,n=t.deltaY,i=r.nodeModel,o=i.x,a=i.y;r.nodeModel.x=o+e/2,r.nodeModel.y=a+n/2,r.nodeModel.moveText(e/2,n/2)},r.getResize=function(t){var e=t.index,n=t.deltaX,r=t.deltaY,i=t.width,o=t.height,a=t.PCTResizeInfo,u=t.pct,s=void 0===u?1:u,l=t.freezeWidth,c=void 0!==l&&l,d=t.freezeHeight,h=void 0!==d&&d,p={width:i,height:o,deltaX:n,deltaY:r};if(a){var f=0,v=0;switch(e){case 0:v=(-1*n-r)/4;break;case 1:v=(n-r)/4;break;case 2:v=(n+r)/4;break;case 3:v=(-1*n+r)/4}0!==v&&(f=Math.round(v/a.ResizeBasis.basisHeight*1e5)/1e3),a.ResizePCT.widthPCT=Math.max(Math.min(a.ResizePCT.widthPCT+f,a.ScaleLimit.maxScaleLimit),a.ScaleLimit.minScaleLimit),a.ResizePCT.heightPCT=Math.max(Math.min(a.ResizePCT.heightPCT+f,a.ScaleLimit.maxScaleLimit),a.ScaleLimit.minScaleLimit);var g=Math.round(a.ResizePCT.widthPCT*a.ResizeBasis.basisWidth/100),y=Math.round(a.ResizePCT.heightPCT*a.ResizeBasis.basisHeight/100);switch(e){case 0:n=i-g,r=o-y;break;case 1:n=g-i,r=o-y;break;case 2:n=g-i,r=y-o;break;case 3:n=i-g,r=y-o}return p.width=g,p.height=y,p.deltaX=n/s,p.deltaY=r/s,p}switch(e){case 0:p.width=c?i:i-n*s,p.height=h?o:o-r*s;break;case 1:p.width=c?i:i+n*s,p.height=h?o:o-r*s;break;case 2:p.width=c?i:i+n*s,p.height=h?o:o+r*s;break;case 3:p.width=c?i:i-n*s,p.height=h?o:o+r*s}return p},r.updateEdgePointByAnchors=function(){var t=r.nodeModel,e=t.id,n=t.anchors,i=r.getNodeEdges(e);i.sourceEdges.forEach((function(t){var e=n.find((function(e){return e.id===t.sourceAnchorId}));e&&t.updateStartPoint({x:e.x,y:e.y})})),i.targetEdges.forEach((function(t){var e=n.find((function(e){return e.id===t.targetAnchorId}));e&&t.updateEndPoint({x:e.x,y:e.y})}))},r.updateRect=function(t){var e=t.deltaX,n=t.deltaY,i=r.nodeModel,o=i.x,a=i.y,u=i.width,s=i.height,l=i.radius,c=i.PCTResizeInfo,d=r.nodeModel,h=d.minWidth,p=d.minHeight,f=d.maxWidth,v=d.maxHeight,g=r.index,y=h===f,m=p===v,b=r.getResize({index:g,deltaX:e,deltaY:n,width:u,height:s,PCTResizeInfo:c,pct:1,freezeWidth:y,freezeHeight:m});if(b.width<h||b.width>f||b.height<p||b.height>v)r.dragHandler.cancelDrag();else{r.updatePosition({deltaX:y?0:b.deltaX,deltaY:m?0:b.deltaY}),r.nodeModel.width=b.width,r.nodeModel.height=b.height,r.nodeModel.setProperties({nodeSize:{width:b.width,height:b.height}});var x={x:o,y:a,width:u,height:s,radius:l},_={x:r.nodeModel.x,y:r.nodeModel.y,width:r.nodeModel.width,height:r.nodeModel.height,radius:l};r.updateEdgePointByAnchors(),r.eventEmit({beforeNode:x,afterNode:_})}},r.updateEllipse=function(t){var e=t.deltaX,n=t.deltaY,i=r.nodeModel,o=i.rx,a=i.ry,u=i.x,s=i.y,l=i.PCTResizeInfo,c=r.index,d=r.nodeModel,h=d.minWidth,p=d.minHeight,f=d.maxWidth,g=d.maxHeight,y=h===f,m=p===g,b=o,x=a,_=r.getResize({index:c,deltaX:e,deltaY:n,width:b,height:x,PCTResizeInfo:l,pct:.5,freezeWidth:y,freezeHeight:m});if(_.width<h/2||_.width>f/2||_.height<p/2||_.height>g/2)r.dragHandler.cancelDrag();else{r.updatePosition({deltaX:y?0:_.deltaX,deltaY:m?0:_.deltaY}),r.nodeModel.rx=_.width,r.nodeModel.ry=_.height,r.nodeModel.setProperties({nodeSize:{rx:_.width,ry:_.height}});var w={x:u,y:s},M={rx:_.width,ry:_.height,x:r.nodeModel.x,y:r.nodeModel.y};r.updateEdgePointByAnchors(),r.eventEmit({beforeNode:v(v({},w),{rx:o,ry:a}),afterNode:M})}},r.updateDiamond=function(t){var e=t.deltaX,n=t.deltaY,i=r.nodeModel,o=i.rx,a=i.ry,u=i.x,s=i.y,l=i.PCTResizeInfo,c=r.index,d=r.nodeModel,h=d.minWidth,p=d.minHeight,f=d.maxWidth,v=d.maxHeight,g=h===f,y=p===v,m=o,b=a,x=r.getResize({index:c,deltaX:e,deltaY:n,width:m,height:b,PCTResizeInfo:l,pct:.5,freezeWidth:g,freezeHeight:y});if(x.width<h/2||x.width>f/2||x.height<p/2||x.height>v/2)r.dragHandler.cancelDrag();else{r.updatePosition({deltaX:g?0:x.deltaX,deltaY:y?0:x.deltaY}),r.nodeModel.rx=x.width,r.nodeModel.ry=x.height,r.nodeModel.setProperties({nodeSize:{rx:x.width,ry:x.height}});var _={x:u,y:s,rx:o,ry:a},w={rx:x.width,ry:x.height,x:r.nodeModel.x,y:r.nodeModel.y};r.updateEdgePointByAnchors(),r.eventEmit({beforeNode:_,afterNode:w})}},r.eventEmit=function(t){var e=t.beforeNode,n=t.afterNode,i=r.nodeModel,o=i.id,a=i.modelType,u=i.type,s=v({id:o,modelType:a,type:u},e),l=v({id:o,modelType:a,type:u},n);r.graphModel.eventCenter.emit("node:resize",{oldNodeSize:s,newNodeSize:l})},r.onDragging=function(t){var n,i=t.deltaX,o=t.deltaY,a=r.graphModel.transformModel,u=r.nodeModel.modelType;i=(n=x(a.fixDeltaXY(i,o),2))[0],o=n[1],u===e.ModelType.RECT_NODE||u===e.ModelType.HTML_NODE?r.updateRect({deltaX:i,deltaY:o}):u===e.ModelType.ELLIPSE_NODE?r.updateEllipse({deltaX:i,deltaY:o}):u===e.ModelType.DIAMOND_NODE&&r.updateDiamond({deltaX:i,deltaY:o})},r.onDragEnd=function(){var t=r.graphModel.gridSize,e=void 0===t?1:t,n=e*Math.round(r.nodeModel.x/e),i=e*Math.round(r.nodeModel.y/e);r.nodeModel.moveTo(n,i),r.updateEdgePointByAnchors()},r.index=n.index,r.nodeModel=n.model,r.graphModel=n.graphModel,r.dragHandler=new wf({onDragging:r.onDragging,onDragEnd:r.onDragEnd,step:1}),r}return f(n,t),n.prototype.getNodeEdges=function(t){for(var e=this.graphModel.edges,n=[],r=[],i=0;i<e.length;i++){var o=e[i];o.sourceNodeId===t?n.push(o):e[i].targetNodeId===t&&r.push(o)}return{sourceEdges:n,targetEdges:r}},n.prototype.render=function(){var t=this.props,n=t.x,r=t.y,i=t.index,o=t.model.getControlPointStyle();return _f("g",{className:"lf-resize-control-".concat(i),children:_f(e.Rect,v({className:"lf-node-control",x:n,y:r},o,{onMouseDown:this.dragHandler.handleMouseDown}))})},n}(e.Component),Ef=function(t){function n(){var e=t.call(this)||this;return e.state={},e}return f(n,t),n.prototype.getResizeControl=function(){var t=this.props,e=t.model,n=t.graphModel,r=e.x,i=e.y,o=e.width,a=e.height,u={minX:r-o/2,minY:i-a/2,maxX:r+o/2,maxY:i+a/2},s=u.minX,l=u.minY,c=u.maxX,d=u.maxY;return[{x:s,y:l},{x:c,y:l},{x:c,y:d},{x:s,y:d}].map((function(t,r){return _f(Mf,v({index:r},t,{model:e,graphModel:n}))}))},n.prototype.getGroupSolid=function(){var t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.getResizeOutlineStyle();return _f(e.Rect,v({},a,{x:n,y:r,width:i,height:o}))},n.prototype.render=function(){return _f("g",{className:"lf-resize-control",children:[this.getGroupSolid(),this.getResizeControl()]})},n}(e.Component),Nf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=e.properties.nodeSize;return i&&(r.rx=i.rx,r.ry=i.ry),r}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={basisWidth:this.rx,basisHeight:this.ry},n={maxScaleLimit:Math.min(this.maxWidth/(2*this.rx)*100,this.maxHeight/(2*this.ry)*100),minScaleLimit:Math.max(this.minWidth/(2*this.rx)*100,this.minHeight/(2*this.ry)*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.EllipseNodeModel),Sf=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return _f(Ef,{model:e,graphModel:n})},e.prototype.getResizeShape=function(){return t.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,e=t.model,n=t.graphModel.editConfigModel.isSilentMode;return _f("g",{children:[this.getResizeShape(),e.isSelected&&!n?this.getControlGroup():""]})},e}(e.EllipseNode),Af={type:"ellipse",view:Sf,model:Nf},Pf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=e.properties.nodeSize;return i&&(r.rx=i.rx,r.ry=i.ry),r}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.gridSize=1},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={basisWidth:this.rx,basisHeight:this.ry},n={maxScaleLimit:Math.min(this.maxWidth/(2*this.rx)*100,this.maxHeight/(2*this.ry)*100),minScaleLimit:Math.max(this.minWidth/(2*this.rx)*100,this.minHeight/(2*this.ry)*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.DiamondNodeModel),Tf=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return _f(Ef,{model:e,graphModel:n})},n.prototype.getResizeShape=function(){var t=this.props.model,n=t.points,r=t.getNodeStyle();return _f("g",{children:_f(e.Polygon,v({},r,{points:n}))})},n.prototype.getShape=function(){var t=this.props,e=t.model.isSelected,n=t.graphModel.editConfigModel.isSilentMode;return _f("g",{children:[this.getResizeShape(),e&&!n?this.getControlGroup():""]})},n}(e.DiamondNode),kf={type:"diamond",view:Tf,model:Pf},Cf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=e.properties.nodeSize;return i&&(r.width=i.width,r.height=i.height),r}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={basisWidth:this.width,basisHeight:this.height},n={maxScaleLimit:Math.min(this.maxWidth/this.width*100,this.maxHeight/this.height*100),minScaleLimit:Math.max(this.minWidth/this.width*100,this.minHeight/this.height*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.HtmlNodeModel),Of=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return _f(Ef,{model:e,graphModel:n})},e.prototype.getResizeShape=function(){return t.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,e=t.model.isSelected,n=t.graphModel.editConfigModel.isSilentMode;return _f("g",{children:[this.getResizeShape(),e&&!n?this.getControlGroup():""]})},e}(e.HtmlNode),If={type:"html",view:Of,model:Cf},jf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=e.properties.nodeSize;return i&&(r.width=i.width,r.height=i.height),r}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={basisWidth:this.width,basisHeight:this.height},n={maxScaleLimit:Math.min(this.maxWidth/this.width*100,this.maxHeight/this.height*100),minScaleLimit:Math.max(this.minWidth/this.width*100,this.minHeight/this.height*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.RectNodeModel),Rf=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return _f(Ef,{model:e,graphModel:n})},e.prototype.getResizeShape=function(){return t.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,e=t.model.isSelected,n=t.graphModel.editConfigModel.isSilentMode;return _f("g",{children:[this.getResizeShape(),e&&!n?this.getControlGroup():""]})},e}(e.RectNode),Df={type:"rect",view:Rf,model:jf},Lf={pluginName:"nodeResize",step:0,install:function(t){t.register(Af),t.register(kf),t.register(If),t.register(Df)}},Bf=function(t){function e(){var e=t.apply(this,_([],x(arguments),!1))||this;return e.isGroup=!0,e.isFolded=!1,e.unfoldedWidth=500,e.unfoldedHeight=300,e.childrenLastFoldStatus={},e}return f(e,t),e.prototype.initNodeData=function(e){var n=this;t.prototype.initNodeData.call(this,e);var r=[];Array.isArray(e.children)&&(r=e.children),this.children=new Set(r),this.width=500,this.height=300,this.foldedWidth=80,this.foldedHeight=60,this.zIndex=-1e4,this.radius=0,this.text.editable=!1,this.text.draggable=!1,this.isRestrict=!1,this.resizable=!1,this.autoToFront=!1,this.foldable=!1,void 0===this.properties.isFolded&&(this.properties.isFolded=!1),this.isFolded=!!this.properties.isFolded,setTimeout((function(){n.isFolded&&n.foldGroup(n.isFolded)}))},e.prototype.getResizeOutlineStyle=function(){var e=t.prototype.getResizeOutlineStyle.call(this);return e.stroke="none",e},e.prototype.foldGroup=function(t){var e=this;if(t!==this.isFolded){this.setProperty("isFolded",t),this.isFolded=t,t?(this.x=this.x-this.width/2+this.foldedWidth/2,this.y=this.y-this.height/2+this.foldedHeight/2,this.unfoldedWidth=this.width,this.unfoldedHeight=this.height,this.width=this.foldedWidth,this.height=this.foldedHeight):(this.width=this.unfoldedWidth,this.height=this.unfoldedHeight,this.x=this.x+this.width/2-this.foldedWidth/2,this.y=this.y+this.height/2-this.foldedHeight/2);var n=_(_([],x(this.incoming.edges),!1),x(this.outgoing.edges),!1);this.children.forEach((function(r){var i=e.graphModel.getElement(r);if(i){var o=i.isFolded;if(i.isGroup&&!i.isFolded&&i.foldGroup(t),i.isGroup&&!t){var a=e.childrenLastFoldStatus[r];void 0!==a&&a!==i.isFolded&&i.foldGroup(a)}e.childrenLastFoldStatus[r]=!!o,i.visible=!t;var u=i.incoming.edges,s=i.outgoing.edges;n=_(_(_([],x(n),!1),x(u),!1),x(s),!1)}})),this.foldEdge(t,n)}},e.prototype.getAnchorStyle=function(e){var n=t.prototype.getAnchorStyle.call(this,e);return n.stroke="transparent",n.fill="transparent",n.hover.fill="transparent",n.hover.stroke="transparent",n},e.prototype.foldEdge=function(t,e){var n=this;e.forEach((function(e,r){var i=e.id,o=e.sourceNodeId,a=e.targetNodeId,u=e.startPoint,s=e.endPoint,l=e.type,c=e.text,d=e.getProperties(),h={id:"".concat(i,"__").concat(r),sourceNodeId:o,targetNodeId:a,startPoint:u,endPoint:s,type:l,properties:d,text:null==c?void 0:c.value};e.virtual&&n.graphModel.deleteEdgeById(e.id);var p=n.graphModel.group.getNodeGroup(a);p||(p=n.graphModel.getNodeModelById(a));var f=n.graphModel.group.getNodeGroup(o);f||(f=n.graphModel.getNodeModelById(o)),t&&!1!==e.visible&&(n.children.has(o)||n.id===o?(h.startPoint=void 0,h.sourceNodeId=n.id):(h.endPoint=void 0,h.targetNodeId=n.id),p.id===n.id&&f.id===n.id||n.createVirtualEdge(h),e.visible=!1),t||!1!==e.visible||(p&&p.isGroup&&p.isFolded?(h.targetNodeId=p.id,h.endPoint=void 0,n.createVirtualEdge(h)):f&&f.isGroup&&f.isFolded?(h.sourceNodeId=f.id,h.startPoint=void 0,n.createVirtualEdge(h)):e.visible=!0)}))},e.prototype.createVirtualEdge=function(t){t.pointsList=void 0;var e=this.graphModel.addEdge(t);e.virtual=!0,e.text.editable=!1,e.isFoldedEdge=!0},e.prototype.isInRange=function(t){var e=t.x1,n=t.y1,r=t.x2,i=t.y2;return e>=this.x-this.width/2&&r<=this.x+this.width/2&&n>=this.y-this.height/2&&i<=this.y+this.height/2},e.prototype.isAllowMoveTo=function(t){var e=t.x1,n=t.y1,r=t.x2,i=t.y2;return{x:e>=this.x-this.width/2&&r<=this.x+this.width/2,y:n>=this.y-this.height/2&&i<=this.y+this.height/2}},e.prototype.setAllowAppendChild=function(t){this.setProperty("groupAddable",t)},e.prototype.addChild=function(t){this.children.add(t),this.graphModel.eventCenter.emit("group:add-node",{data:this.getData()})},e.prototype.removeChild=function(t){this.children.delete(t),this.graphModel.eventCenter.emit("group:remove-node",{data:this.getData()})},e.prototype.getAddableOutlineStyle=function(){return{stroke:"#FEB663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},e.prototype.getData=function(){var e=this,n=t.prototype.getData.call(this);n.children=[],this.children.forEach((function(t){var r=e.graphModel.getNodeModelById(t);r&&!r.virtual&&n.children.push(t)}));var r=n.properties;return null==r||delete r.groupAddable,null==r||delete r.isFolded,n},e.prototype.getHistoryData=function(){var e=t.prototype.getData.call(this);e.children=_([],x(this.children),!1),e.isGroup=!0;var n=e.properties;return null==n||delete n.groupAddable,(null==n?void 0:n.isFolded)&&(e.x=e.x+this.unfoldedWidth/2-this.foldedWidth/2,e.y=e.y+this.unfoldedHeight/2-this.foldedHeight/2),e},e.prototype.isAllowAppendIn=function(t){return console.info("_nodeData",t),!0},e.prototype.toBack=function(){this.zIndex--},e}(jf),zf=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getControlGroup=function(){var e=this.props.model,n=e.resizable,r=e.properties;return n&&!r.isFolded?t.prototype.getControlGroup.call(this):null},n.prototype.getAddableShape=function(){var t=this.props.model,n=t.width,r=t.height,i=t.x,o=t.y,a=t.radius,u=t.properties,s=t.getAddableOutlineStyle;if(!u.groupAddable)return null;var l=this.props.model.getNodeStyle().strokeWidth,c=void 0===l?0:l,d=s(),h=n+c+8,p=r+c+8;return e.h("rect",v(v({},d),{width:h,height:p,x:i-h/2,y:o-p/2,rx:a,ry:a}))},n.prototype.getFoldIcon=function(){var t=this.props.model,n=t.x-t.width/2+5,r=t.y-t.height/2+5;if(!t.foldable)return null;var i=e.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:t.properties.isFolded?"M ".concat(n+3,",").concat(r+6," ").concat(n+11,",").concat(r+6," M").concat(n+7,",").concat(r+2," ").concat(n+7,",").concat(r+10):"M ".concat(n+3,",").concat(r+6," ").concat(n+11,",").concat(r+6," ")});return e.h("g",{},[e.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#F4F5F6",stroke:"#CECECE",cursor:"pointer",x:t.x-t.width/2+5,y:t.y-t.height/2+5,onClick:function(){t.foldGroup(!t.properties.isFolded)}}),i])},n.prototype.getResizeShape=function(){return e.h("g",{},[this.getAddableShape(),t.prototype.getResizeShape.call(this),this.getFoldIcon()])},n}(Rf),Wf={type:"group",view:zf,model:Bf},Ff=-1e4,Gf=function(){function t(t){var e=t.lf,n=this;this.topGroupZIndex=Ff,this.nodeGroupMap=new Map,this.graphRendered=function(t){var e=t.data;e&&e.nodes&&(e.nodes.forEach((function(t){t.children&&t.children.forEach((function(e){n.nodeGroupMap.set(e,t.id)}))})),n.checkAndCorrectTopGroupZIndex(e.nodes))},this.appendNodeToGroup=function(t){var e=t.data,r=n.nodeGroupMap.get(e.id);if(r){var i=n.lf.getNodeModelById(r);i.removeChild(e.id),n.nodeGroupMap.delete(e.id),i.setAllowAppendChild(!1)}var o=n.lf.getNodeModelById(e.id),a=null==o?void 0:o.getBounds();if(a&&o){var u=n.getGroup(a,e);if(o.isGroup&&(e.children.forEach((function(t){n.nodeGroupMap.set(t,e.id)})),n.checkAndCorrectTopGroupZIndex([e]),n.nodeSelected({data:e,isSelected:!1,isMultiple:!1})),!u)return;if(!u.isAllowAppendIn(e))return void n.lf.emit("group:not-allowed",{group:u.getData(),node:e});u.addChild(e.id),n.nodeGroupMap.set(e.id,u.id),u.setAllowAppendChild(!1)}},this.deleteGroupChild=function(t){var e=t.data;e.children&&e.children.forEach((function(t){n.nodeGroupMap.delete(t),n.lf.deleteNode(t)}));var r=n.nodeGroupMap.get(e.id);r&&(n.lf.getNodeModelById(r).removeChild(e.id),n.nodeGroupMap.delete(e.id))},this.setActiveGroup=function(t){var e=t.data,r=n.lf.getNodeModelById(e.id),i=null==r?void 0:r.getBounds();if(r&&i){var o=n.getGroup(i,e);if(n.activeGroup&&n.activeGroup.setAllowAppendChild(!1),!o||r.isGroup&&o.id===e.id)return;if(!o.isAllowAppendIn(e))return;n.activeGroup=o,n.activeGroup.setAllowAppendChild(!0)}},this.findNodeAndChildMaxZIndex=function(t){var e=Ff;return t.isGroup&&(e=Math.max(e,t.zIndex)),t.children&&t.children.forEach((function(t){"object"==typeof t&&(t=t.id);var r=n.lf.getNodeModelById(t);if(null==r?void 0:r.isGroup){var i=n.findNodeAndChildMaxZIndex(r);e=Math.max(i,e)}})),e},this.checkAndCorrectTopGroupZIndex=function(t){var e=Ff;if(t.forEach((function(t){var r=n.lf.getNodeModelById(t.id);if(r){var i=n.findNodeAndChildMaxZIndex(r);i>e&&(e=i)}})),!(n.topGroupZIndex>=e)){for(var r=n.lf.graphModel.nodes.filter((function(t){return t.isGroup})),i=n.topGroupZIndex,o=0;o<r.length;o++){var a=r[o];a.zIndex>i&&(i=a.zIndex)}n.topGroupZIndex=i}},this.nodeSelected=function(t){var e=t.data,r=t.isMultiple,i=t.isSelected,o=n.lf.getNodeModelById(e.id);if(n.toFrontGroup(o),n.topGroupZIndex>-1e3){n.topGroupZIndex=Ff;for(var a=n.lf.graphModel.nodes.filter((function(t){return t.isGroup})).sort((function(t,e){return t.zIndex-e.zIndex})),u=0,s=0;s<a.length;s++){var l=a[s];l.zIndex!==u&&(n.topGroupZIndex++,u=l.zIndex),l.setZIndex(n.topGroupZIndex)}}if(r&&i)if(null==o?void 0:o.isGroup)o.children.forEach((function(t){var e=n.lf.graphModel.getElement(t);null==e||e.setSelected(!1)}));else{var c=n.nodeGroupMap.get(e.id);if(c){var d=n.lf.getNodeModelById(c);(null==d?void 0:d.isSelected)&&(null==o||o.setSelected(!1))}}},this.toFrontGroup=function(t){t&&t.isGroup&&(n.topGroupZIndex++,t.setZIndex(n.topGroupZIndex),t.children&&t.children.forEach((function(t){var e=n.lf.getNodeModelById(t);n.toFrontGroup(e)})))},e.register(Wf),this.lf=e,e.graphModel.addNodeMoveRules((function(t,r,i){if(t.isGroup){var o=n.getNodeAllChild(t);return e.graphModel.moveNodes(o,r,i,!0),!0}var a=e.getNodeModelById(n.nodeGroupMap.get(t.id));if(a&&a.isRestrict){var u=t.getBounds(),s=u.x1,l=u.y1,c=u.x2,d=u.y2;return a.isAllowMoveTo({x1:s+r,y1:l+i,x2:c+r,y2:d+i})}return!0})),e.graphModel.group=this,e.on("node:add,node:drop,node:dnd-add",this.appendNodeToGroup),e.on("node:delete",this.deleteGroupChild),e.on("node:dnd-drag,node:drag",this.setActiveGroup),e.on("node:click",this.nodeSelected),e.on("graph:rendered",this.graphRendered),e.addElements=function(t,r){var i=t.nodes,o=t.edges,a={},u={nodes:[],edges:[]},s=[];return ml(i,(function(t){var i=t.id,o=t.children,l=g(t,["children"]),c=e.addNode(l);if(!c)return{nodes:[],edges:[]};i&&(a[i]=c.id),u.nodes.push(c);var d=n.createAllChildNodes(a,o,c,r).edgesArray;s.push.apply(s,_([],x(d),!1))})),s.forEach((function(t){n.createEdgeModel(t,a,r)})),ml(o,(function(t){var e=n.createEdgeModel(t,a,0);u.edges.push(e)})),u}}return t.prototype.createAllChildNodes=function(t,n,r,i){var o=this,a=this.lf,u=[],s=[],l=[];null==n||n.forEach((function(n){var c=a.getNodeModelById(n);if(c){var d=c.x,h=c.y,p=c.properties,f=c.type,g=c.text,y=c.rotate,m=c.children,b=e.EventType.NODE_GROUP_COPY||"node:group-copy-add",w=a.addNode({x:d+i,y:h+i,properties:p,type:f,text:v(v({},g),{x:g.x+i,y:g.y+i}),rotate:y},b);if(r.addChild(w.id),t[n]=w.id,l.push(w),c.incoming.edges.forEach((function(t){s.push(t)})),c.outgoing.edges.forEach((function(t){s.push(t)})),m instanceof Set){var M=o.createAllChildNodes(t,m,w,i),E=M.nodesArray,N=M.edgesArray;l.push.apply(l,_([],x(E),!1)),u.push.apply(u,_([],x(N),!1))}}}));var c=s.filter((function(e){return t[e.sourceNodeId]&&t[e.targetNodeId]})).map((function(t){return t.getData()}));return{nodesArray:l,edgesArray:u.concat(c)}},t.prototype.createEdgeModel=function(t,e,n){var r=this.lf,i=t.sourceNodeId,o=t.targetNodeId;e[i]&&(i=e[i]),e[o]&&(o=e[o]);var a=t.type,u=t.startPoint,s=t.endPoint,l=t.pointsList,c=t.text,d={x:((null==u?void 0:u.x)||0)+n,y:((null==u?void 0:u.y)||0)+n},h={x:((null==s?void 0:s.x)||0)+n,y:((null==s?void 0:s.y)||0)+n},p=[];l&&l.length>0&&(p=l.map((function(t){return t.x+=n,t.y+=n,t})));var f=c;return c&&"string"!=typeof c&&(f.x=c.x+n,f.y=c.y+n),r.graphModel.addEdge({type:a,startPoint:d,endPoint:h,sourceNodeId:i,targetNodeId:o,pointsList:p,text:f})},t.prototype.getNodeAllChild=function(t){var e=this,n=[];return t.children&&t.children.forEach((function(t){n.push(t);var r=e.lf.getNodeModelById(t);(null==r?void 0:r.isGroup)&&(n=n.concat(e.getNodeAllChild(r)))})),n},t.prototype.getGroup=function(t,e){var n=this.lf.graphModel.nodes.filter((function(n){return n.isGroup&&n.isInRange(t)&&n.id!==e.id}));if(0!==n.length){if(1===n.length)return n[0];for(var r=n[n.length-1],i=n.length-2;i>=0;i--)n[i].zIndex>r.zIndex&&(r=n[i]);return r}},t.prototype.getNodeGroup=function(t){var e=this.nodeGroupMap.get(t);if(e)return this.lf.getNodeModelById(e)},t.prototype.render=function(){},t.prototype.destroy=function(){},t.pluginName="group",t}();function Hf(){var t=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getFoldIcon=function(){var t=this.props.model,n=t,r=n.x,i=n.y,o=n.width,a=n.height,u=n.properties,s=n.foldable,l=t.x-t.width/2+5,c=t.y-t.height/2+5;if(!s)return null;var d=e.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:u.isFolded?"M ".concat(l+3,",").concat(c+6," ").concat(l+11,",").concat(c+6," M").concat(l+7,",").concat(c+2," ").concat(l+7,",").concat(c+10):"M ".concat(l+3,",").concat(c+6," ").concat(l+11,",").concat(c+6," ")});return e.h("g",{},[e.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#F4F5F6",stroke:"#CECECE",cursor:"pointer",x:r-o/2+5,y:i-a/2+5,onClick:function(e){var n,r;null===(r=(n=e.stopPropagation()(t)).foldGroup)||void 0===r||r.call(n,!u.isFolded)}}),d])},n.prototype.getResizeShape=function(){var t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.getNodeStyle(),u=v(v({},a),{x:n-i/2,y:r-o/2,width:i,height:o,stroke:"black",strokeWidth:2,strokeDasharray:"0 0"});return e.h("g",{},[e.h("rect",v({},u)),this.getFoldIcon()])},n}(zf),n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.foldable=!0,this.resizable=!0,this.width=400,this.height=200,this.resetWidthHeight(),this.isTaskNode=!0,this.boundaryEvents=[]},e.prototype.resetWidthHeight=function(){var t,e,n=null===(t=this.properties.iniProp)||void 0===t?void 0:t.width,r=null===(e=this.properties.iniProp)||void 0===e?void 0:e.height;n&&(this.width=n),r&&(this.height=r)},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this);return e.stroke="#989891",e.strokeWidth=1,e.strokeDasharray="3 3",this.isSelected&&(e.stroke="rgb(124, 15, 255)"),this.properties.isBoundaryEventTouchingTask&&(e.stroke="#00acff",e.strokeWidth=2),e},e.prototype.addChild=function(e){var n=this.graphModel.getElement(e);null==n||n.setProperties({parent:this.id}),t.prototype.addChild.call(this,e)},e.prototype.getAnchorStyle=function(){var e=t.prototype.getAnchorStyle.call(this);return e.stroke="#000",e.fill="#fff",e.hover||(e.hover={}),e.hover.stroke="transparent",e},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return e.stroke="transparent",e.hover||(e.hover={}),e.hover.stroke="transparent",e},e.prototype.setTouching=function(t){this.setProperty("isBoundaryEventTouchingTask",t)},e.prototype.addBoundaryEvent=function(t){if(this.setTouching(!1),this.boundaryEvents.find((function(e){return e===t})))return!1;var e=this.graphModel.getNodeModelById(t);return null==e||e.setProperties({attachedToRef:this.id}),this.boundaryEvents.push(t),!0},e.prototype.deleteBoundaryEvent=function(t){this.boundaryEvents=this.boundaryEvents.filter((function(e){return e!==t}))},e}(Bf);return{type:"bpmn:subProcess",view:t,model:n}}function Xf(t){var e=jt("bpmn:serviceTask",St),n=jt("bpmn:userTask",At);t.register(e),t.register(n),t.register(Hf()),function(t){function e(t,e){var n=t.x,r=t.y,i=t.width,o=t.height,a=t.id,u=n-i/2,s=n+i/2,l=r-o/2,c=r+o/2,d=e.x,h=e.y;return d>u-5&&d<s+5&&h>l-5&&h<c+5&&!(d>u+5&&d<s-5&&h>l+5&&h<c-5)?a:null}t.on("node:drag,node:dnd-drag",(function(n){var r,i,o=n.data;if("bpmn:boundaryEvent"===o.type){var a=t.graphModel.nodes;try{for(var u=b(a),s=u.next();!s.done;s=u.next()){var l=s.value;l.isTaskNode&&(e(l,o)?l.setTouching(!0):l.setTouching(!1))}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}})),t.on("node:drop,node:dnd-add",(function(n){var r,i,o=n.data,a=o.type,u=o.id;if("bpmn:boundaryEvent"===a){var s=t.graphModel.nodes;try{for(var l=b(s),c=l.next();!c.done;c=l.next()){var d,h=c.value;if(h.isTaskNode)if(null!==(d=e(h,o))){var p=t.graphModel.getNodeModelById(u),f=t.graphModel.getNodeModelById(d),v=p.properties.attachedToRef;return v&&v!==d&&t.graphModel.getNodeModelById(v).deleteBoundaryEvent(u),void f.addBoundaryEvent(u)}}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}})),t.graphModel.addNodeMoveRules((function(e,n,r){if(e.isTaskNode){var i=e.boundaryEvents;return t.graphModel.moveNodes(i,n,r,!0),!0}return!0}))}(t)}function Uf(t){var n=function(e){function n(n,r){n.id||(n.id="Flow_".concat(ft()));var i=v(v(v({},t||{}),n.properties),{isDefaultFlow:!1});return n.properties=i,e.call(this,n,r)||this}return f(n,e),n.extendKey="SequenceFlowModel",n}(e.PolylineEdgeModel),r=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getStartArrow=function(){return this.props.model.properties.isDefaultFlow?e.h("path",{refX:15,stroke:"#000000",strokeWidth:2,d:"M 20 5 10 -5 z"}):e.h("path",{d:""})},n.extendKey="SequenceFlowEdge",n}(e.PolylineEdge);return{type:"bpmn:sequenceFlow",view:r,model:n}}var Vf=Uf();var qf=[{nodes:["startEvent","intermediateCatchEvent","boundaryEvent"],definition:[{type:"bpmn:timerEventDefinition",icon:_t,properties:{definitionType:"bpmn:timerEventDefinition",timerValue:"",timerType:""}}]}];function Yf(t){function e(e){e.forEach((function(e){var n,r;n=e.nodes,r=e.definition,n.forEach((function(e){(null==t?void 0:t[e])||(t[e]=new Map);var n=null==t?void 0:t[e];r.forEach((function(t){n.set(t.type,t)}))}))}))}return function(){return[t,e]}}var Zf=function(){function t(t){var e=t.lf;e.definition={},e.useDefinition=Yf(e.definition);var n=x(e.useDefinition(),2),r=n[0],i=n[1];console.log("_definition",r),i(qf),function(t){t.register(mt(t)),t.register(gt(t)),t.register(yt(t)),t.register(xt(t)),t.register(bt(t))}(e),function(t){var e=Ot("bpmn:exclusiveGateway",Mt),n=Ot("bpmn:parallelGateway",Et),r=Ot("bpmn:inclusiveGateway",Nt);t.register(e),t.register(r),t.register(n)}(e),function(t){t.register(Vf)}(e),Xf(e),e.setDefaultEdgeType("bpmn:sequenceFlow")}return t.pluginName="BpmnElementsPlugin",t}(),Kf=40,$f=40,Jf=40,Qf=40,tv=100,ev=80,nv=100,rv=80,iv=100,ov=80,av=100,uv=80,sv=100,lv=80,cv=100,dv=80,hv=100,pv=80,fv=100,vv=80,gv=function(){};(gv.ObjTree=function(){return this}).VERSION="0.23",gv.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',gv.ObjTree.prototype.attr_prefix="-",gv.ObjTree.prototype.parseXML=function(t){var e;if(window.DOMParser){var n=new DOMParser,r=n.parseFromString(t,"application/xml");if(!r)return;e=r.documentElement}else window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async=!1,n.loadXML(t),e=n.documentElement);if(e)return this.parseDOM(e)},gv.ObjTree.prototype.parseHTTP=function(t,e,n){var r,i={};for(var o in e)i[o]=e[o];if(i.method||(void 0===i.postBody&&void 0===i.postbody&&void 0===i.parameters?i.method="get":i.method="post"),n){i.asynchronous=!0;var a=this,u=n,s=i.onComplete;i.onComplete=function(t){var e;t&&t.responseXML&&t.responseXML.documentElement&&(e=a.parseDOM(t.responseXML.documentElement)),u(e,t),s&&s(t)}}else i.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)i.uri=t,(l=new HTTP.Request(i))&&(r=l.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var l;(l=new Ajax.Request(t,i))&&(r=l.transport)}return n?r:r&&r.responseXML&&r.responseXML.documentElement?this.parseDOM(r.responseXML.documentElement):void 0},gv.ObjTree.prototype.parseDOM=function(t){if(t){if(this.__force_array={},this.force_array)for(var e=0;e<this.force_array.length;e++)this.__force_array[this.force_array[e]]=1;var n=this.parseElement(t);if(this.__force_array[t.nodeName]&&(n=[n]),11!==t.nodeType){var r={};r[t.nodeName]=n,n=r}return n}},gv.ObjTree.prototype.parseElement=function(t){if(7!==t.nodeType){if(3===t.nodeType||4===t.nodeType||8===t.nodeType){if(null==t.nodeValue.match(/[^\x00-\x20]/))return;return t.nodeValue}var e=null,n={};if(t.attributes&&t.attributes.length){e={};for(var r=0;r<t.attributes.length;r++){if("string"==typeof(u=t.attributes[r].nodeName)){var i=t.attributes[r].nodeValue;try{i=JSON.parse(t.attributes[r].nodeValue.replace(/'/g,'"'))}catch(e){i=t.attributes[r].nodeValue}null!=i&&(void 0===n[u=this.attr_prefix+u]&&(n[u]=0),n[u]++,this.addNode(e,u,n[u],i))}}}if(t.childNodes&&t.childNodes.length){var o=!0;e&&(o=!1);for(r=0;r<t.childNodes.length&&o;r++){var a=t.childNodes[r].nodeType;3!==a&&4!==a&&8!==a&&(o=!1)}if(o){e||(e="");for(r=0;r<t.childNodes.length;r++)e+=t.childNodes[r].nodeValue}else{e||(e={});for(r=0;r<t.childNodes.length;r++){var u;if("string"==typeof(u=t.childNodes[r].nodeName))(i=this.parseElement(t.childNodes[r]))&&(void 0===n[u]&&(n[u]=0),n[u]++,this.addNode(e,u,n[u],i))}}}else null===e&&(e={});return e}},gv.ObjTree.prototype.addNode=function(t,e,n,r){this.__force_array[e]?(1===n&&(t[e]=[]),t[e][t[e].length]=r):1===n?t[e]=r:2===n?t[e]=[t[e],r]:t[e][t[e].length]=r},gv.ObjTree.prototype.writeXML=function(t){var e=this.hash_to_xml(null,t);return this.xmlDecl+e},gv.ObjTree.prototype.hash_to_xml=function(t,e){var n=[],r=[];for(var i in e)if(lc(e,i)){var o=e[i];i.charAt(0)!==this.attr_prefix?void 0===o||null==o?n[n.length]="<".concat(i," />"):"object"==typeof o&&o.constructor===Array?n[n.length]=this.array_to_xml(i,o):n[n.length]="object"==typeof o?this.hash_to_xml(i,o):this.scalar_to_xml(i,o):r[r.length]=" ".concat(i.substring(1),'="').concat(this.xml_escape(o),'"')}var a=r.join(""),u=n.join("");return void 0===t||null==t||(u=n.length>0?u.match(/\n/)?"<".concat(t).concat(a,">\n").concat(u,"</").concat(t,">\n"):"<".concat(t).concat(a,">").concat(u,"</").concat(t,">\n"):"<".concat(t).concat(a," />\n")),u},gv.ObjTree.prototype.array_to_xml=function(t,e){for(var n=[],r=0;r<e.length;r++){var i=e[r];void 0===i||null==i?n[n.length]="<".concat(t," />"):"object"==typeof i&&i.constructor===Array?n[n.length]=this.array_to_xml(t,i):n[n.length]="object"==typeof i?this.hash_to_xml(t,i):this.scalar_to_xml(t,i)}return n.join("")},gv.ObjTree.prototype.scalar_to_xml=function(t,e){return"#text"===t?this.xml_escape(e):"<".concat(t,">").concat(this.xml_escape(e),"</").concat(t,">\n")},gv.ObjTree.prototype.xml_escape=function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')};function yv(t){return Object.prototype.toString.call(t)}function mv(t){return" ".repeat(t)}function bv(t){return"[object Object]"===yv(t)?Object.keys(t).reduce((function(e,n){var r=n;return"-"===n.charAt(0)&&(r=n.substring(1)),e[r]=bv(t[n]),e}),{}):Array.isArray(t)?t.map((function(t){return bv(t)})):t}var xv,_v="\t\n";function wv(t,e,n){var r=mv(n),i="",o=_v+r;if("-json"===e)return"";if("#text"===e)return o+t;if("#cdata-section"===e)return"".concat(o,"<![CDATA[").concat(t,"]]>");if("#comment"===e)return"".concat(o,"\x3c!--").concat(t,"--\x3e");if("-"==="".concat(e).charAt(0))return" ".concat(e.substring(1),'="').concat(function(t){var e=t;try{"string"!=typeof e&&(e=JSON.parse(t))}catch(n){e=JSON.stringify(bv(t)).replace(/"/g,"'")}return e}(t),'"');if(Array.isArray(t))i+=t.map((function(t){return wv(t,e,n+1)})).join("");else if("[object Object]"===yv(t)){var a=Object.keys(t),u="",s=t["-json"]?_v+mv(n+1)+t["-json"]:"";i+="".concat(0===n?"":o,"<").concat(e),a.forEach((function(e){"-"===e.charAt(0)?u+=wv(t[e],e,n+1):s+=wv(t[e],e,n+1)})),i+=u+(""!==s?">".concat(s).concat(o,"</").concat(e,">"):" />")}else i+="".concat(o,"<").concat(e,">").concat(t.toString(),"</").concat(e,">");return i}!function(t){t.START="bpmn:startEvent",t.END="bpmn:endEvent",t.INTERMEDIATE_CATCH="bpmn:intermediateCatchEvent",t.INTERMEDIATE_THROW="bpmn:intermediateThrowEvent",t.BOUNDARY="bpmn:boundaryEvent",t.PARALLEL_GATEWAY="bpmn:parallelGateway",t.INCLUSIVE_GATEWAY="bpmn:inclusiveGateway",t.EXCLUSIVE_GATEWAY="bpmn:exclusiveGateway",t.USER="bpmn:userTask",t.SYSTEM="bpmn:serviceTask",t.FLOW="bpmn:sequenceFlow",t.SUBPROCESS="bpmn:subProcess"}(xv||(xv={}));var Mv=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef","-children"],Ev=["properties","startPoint","endPoint","pointsList"],Nv={in:[],out:["properties.panels","properties.nodeSize","properties.definitionId","properties.timerValue","properties.timerType","properties.definitionType","properties.parent","properties.isBoundaryEventTouchingTask"]},Sv=function(t,e){return Object.keys(e||{}).forEach((function(n){if(t[n]){var r=e[n],i=r.in,o=r.out;i&&(t[n].in=i),o&&(t[n].out=o)}else t[n]=e[n]})),t},Av={"bpmn:startEvent":{out:function(t){var e,n,r=t.properties;return(null===(n=null===(e=Av[r.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:intermediateCatchEvent":{out:function(t){var e,n,r=t.properties;return(null===(n=null===(e=Av[r.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:intermediateThrowEvent":{out:function(t){var e,n,r=t.properties;return(null===(n=null===(e=Av[r.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:boundaryEvent":{out:function(t){var e,n,r=t.properties;return(null===(n=null===(e=Av[r.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:sequenceFlow":{out:function(t){var e=t.properties,n=e.expressionType,r=e.condition;return r?"cdata"===n?{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[${'.concat(r,"}]]></bpmn:conditionExpression>")}:{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression">'.concat(r,"</bpmn:conditionExpression>")}:{json:""}}},"bpmn:timerEventDefinition":{out:function(t){var e=t.properties,n=e.timerType,r=e.timerValue,i=e.definitionId;return{json:'<bpmn:timerEventDefinition id="'.concat(i,'"').concat(n&&r?">".concat("<bpmn:".concat(n,' xsi:type="bpmn:tFormalExpression">').concat(r,"</bpmn:").concat(n,">"),"</bpmn:timerEventDefinition>"):"/>")}},in:function(t,e){var n,r,i,o=t,a=e["-id"],u="",s="";try{for(var l=b(Object.keys(e)),c=l.next();!c.done;c=l.next()){var d=c.value;d.includes("bpmn:")&&(u=x(d.split(":"),2)[1],s=null===(i=e[d])||void 0===i?void 0:i["#text"])}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return{"-definitionId":a,"-definitionType":o,"-timerType":u,"-timerValue":s}}},"bpmn:conditionExpression":{in:function(t,e){var n,r="",i="";return e["#cdata-section"]?(i="cdata",r=(null===(n=/^\$\{(.*)\}$/g.exec(e["#cdata-section"]))||void 0===n?void 0:n[1])||""):e["#text"]&&(i="normal",r=e["#text"]),{"-condition":r,"-expressionType":i}}}};function Pv(t){var e=null!=t?t:{},n=e.retainedAttrsFields,r=e.excludeFields,i=e.transformer,o=new Set(_(_([],x(Ev),!1),x(n||[]),!1)),a={in:new Set(_(_([],x(Nv.in),!1),x((null==r?void 0:r.in)||[]),!1)),out:new Set(_(_([],x(Nv.out),!1),x((null==r?void 0:r.out)||[]),!1))};return Av=Sv(Av,i),function(t){var e=t.nodes,n=t.edges;return function t(r,i){var u,s;if(1!==(null==r?void 0:r.flag)){var l;if((l=Av[r.type])&&l.out){var c=l.out(r),d=Object.keys(c);d.length>0&&d.forEach((function(t){r[t]=c[t]}))}(null==r?void 0:r.children)&&(r.children=r.children.map((function(t){return e.find((function(e){return e.id===t}))||n.find((function(e){return e.id===t}))||{}})));var h={};if("string"==typeof r)return r;if(Array.isArray(r))return r.map((function(e){return t(e,"")})).filter((function(t){return null!=t}));try{for(var p=b(Object.entries(r)),f=p.next();!f.done;f=p.next()){var v=x(f.value,2),g=v[0],y=v[1];if(1===(null==y?void 0:y.flag))return;var m=[i,g].filter((function(t){return t})).join(".");a.out.has(m)||("object"!=typeof y?0===g.indexOf("-")||["#text","#cdata-section","#comment"].includes(g)?h[g]=y:h["-".concat(g)]=y:o.has(m)?h["-".concat(g)]=t(y,m):h[g]=t(y,m))}}catch(t){u={error:t}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(u)throw u.error}}return h}}(t,"")}}function Tv(t){var e,n,r={};try{for(var i=b(Object.entries(t)),o=i.next();!o.done;o=i.next()){var a=x(o.value,2),u=a[0],s=a[1];0===u.indexOf("-")?r[u.substring(1)]=bv(s):"string"==typeof s?r[u]=s:"[object Object]"===Object.prototype.toString.call(s)?r[u]=Tv(s):Array.isArray(s)?r[u]=s.map((function(t){return Tv(t)})):r[u]=s}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function kv(t,e){t["bpmndi:BPMNEdge"]=e.edges.map((function(t){var e,n=t.id,r=t.pointsList.map((function(t){return{"-x":t.x,"-y":t.y}})),i={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":r};return(null===(e=t.text)||void 0===e?void 0:e.value)&&(i["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-10*t.text.value.length/2,"-y":t.text.y-7,"-width":10*t.text.value.length,"-height":14}}),i})),t["bpmndi:BPMNShape"]=e.nodes.map((function(t){var e,n=t.id,r=100,i=80,o=t.x,a=t.y,u=Rv.shapeConfigMap.get(t.type);u&&(r=u.width,i=u.height),o-=r/2,a-=i/2;var s={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":o,"-y":a,"-width":r,"-height":i}};return(null===(e=t.text)||void 0===e?void 0:e.value)&&(s["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-10*t.text.value.length/2,"-y":t.text.y-7,"-width":10*t.text.value.length,"-height":14}}),s}))}var Cv=["bpmn:incoming","bpmn:outgoing"];function Ov(t,e){var n=[],r=[],i=new Map,o=null!=e?e:{},a=o.transformer,u=o.excludeFields,s={in:new Set(_(_([],x(Nv.in),!1),x((null==u?void 0:u.in)||[]),!1)),out:new Set(_(_([],x(Nv.out),!1),x((null==u?void 0:u.out)||[]),!1))};Av=Sv(Av,a);var l,c,d=t["bpmn:definitions"];if(d){var h=d["bpmn:process"];l=h,c=[function(t){function e(t){t["-children"]||(t["-children"]=[]),Object.keys(t).forEach((function(e){var n;0!==e.indexOf("bpmn:")||Cv.includes(e)||(h[e]||(h[e]=[]),!Array.isArray(h[e])&&(h[e]=[h[e]]),Array.isArray(t[e])?(n=h[e]).push.apply(n,_([],x(t[e]),!1)):h[e].push(t[e]),Array.isArray(t[e])?t[e].forEach((function(n){!e.includes("Flow")&&t["-children"].push(n["-id"])})):!e.includes("Flow")&&t["-children"].push(t[e]["-id"]),delete t[e])}))}if("bpmn:subProcess"===t){var n=h[t];Array.isArray(n)?n.forEach((function(n){"bpmn:subProcess"===t&&e(n)})):e(n)}},function(t){function e(t){var n;i.set(t["-id"],t),Array.isArray(t)?t.forEach((function(t){e(t)})):"object"==typeof t&&(n=t,Object.keys(n).forEach((function(t){var r,i;if(t.includes("bpmn:")){var o={};Av[t]&&Av[t].in?(o=null===(i=(r=Av[t]).in)||void 0===i?void 0:i.call(r,t,hn.cloneDeep(n[t])),delete n[t]):e(n[t]);var a=void 0;(a=Reflect.ownKeys(o)).length>0&&a.forEach((function(t){Reflect.set(n,t,o[t])}))}})))}e(h[t])},function(t){if(0===t.indexOf("bpmn:")){var e=h[t];if("bpmn:sequenceFlow"===t){var o=d["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNEdge"];r=function(t,e){var n=[];if(Array.isArray(t))t.forEach((function(t){var r;r=Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n.push(jv(r,t))}));else{var r=void 0;r=Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n.push(jv(r,t))}return n}(e,o)}else{var a=d["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNShape"];if("bpmn:boundaryEvent"===t){var u=h[t],s=function(t){var e=t["-attachedToRef"],n=i.get(e);n["-boundaryEvents"]||(n["-boundaryEvents"]=[]),n["-boundaryEvents"].push(t["-id"])};Array.isArray(u)?u.forEach((function(t){s(t)})):s(u)}n=n.concat(function(t,e,n){var r=[];if(Array.isArray(t))t.forEach((function(t){var i=Iv(Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n,t);r.push(i)}));else{var i=Iv(Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n,t);r.push(i)}return r}(e,a,t))}}}],c.forEach((function(t){try{Object.keys(l).forEach((function(e){try{t(e)}catch(t){console.error(t)}}))}catch(t){console.error(t)}}))}var p=function(t,e,n){Object.keys(t).forEach((function(r){var i=n?"".concat(n,".").concat(r):r;e.has(i)?delete t[r]:"object"==typeof t[r]&&p(t[r],e,i)}))};return n.forEach((function(t){var n,r;if(null===(n=null==e?void 0:e.mapping)||void 0===n?void 0:n.in){var i=null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.in,o=t.type;i[o]&&(t.type=i[o])}p(t,s.in,"")})),r.forEach((function(t){var n,r;if(null===(n=null==e?void 0:e.mapping)||void 0===n?void 0:n.in){var i=null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.in,o=t.type;i[o]&&(t.type=i[o])}p(t,s.in,"")})),{nodes:n,edges:r}}function Iv(t,e,n){var r=Number(t["dc:Bounds"]["-x"]),i=Number(t["dc:Bounds"]["-y"]),o=n["-children"],a=n["-name"],u=Rv.shapeConfigMap.get(e);u&&(r+=u.width/2,i+=u.height/2);var s,l={};if(Object.entries(n).forEach((function(t){var e=x(t,2),n=e[0],r=e[1];Mv.includes(n)||(l[n]=r)})),l=Tv(l),a&&(s={x:r,y:i,value:a},t["bpmndi:BPMNLabel"]&&t["bpmndi:BPMNLabel"]["dc:Bounds"])){var c=t["bpmndi:BPMNLabel"]["dc:Bounds"];s.x=Number(c["-x"])+Number(c["-width"])/2,s.y=Number(c["-y"])+Number(c["-height"])/2}var d={id:t["-bpmnElement"],type:e,x:r,y:i,properties:l};return o&&(d.children=o),s&&(d.text=s),d}function jv(t,e){var n,r=e["-name"];if(r){var i=t["bpmndi:BPMNLabel"]["dc:Bounds"],o=0;r.split("\n").forEach((function(t){o<t.length&&(o=t.length)})),n={value:r,x:Number(i["-x"])+10*o/2,y:Number(i["-y"])+7}}var a={};Object.entries(e).forEach((function(t){var e=x(t,2),n=e[0],r=e[1];Mv.includes(n)||(a[n]=r)})),a=Tv(a);var u=t["di:waypoint"].map((function(t){return{x:Number(t["-x"]),y:Number(t["-y"])}})),s={id:e["-id"],type:xv.FLOW,pointsList:u,sourceNodeId:e["-sourceRef"],targetNodeId:e["-targetRef"],properties:a};return n&&(s.text=n),s}var Rv=function(){function t(t){var e=t.lf,n=this;this.adapterOut=function(t,e){var r,i,o=v({},n.processAttributes);!function(t,e,n){var r,i=new Map,o=Pv(n)(e);o.nodes.forEach((function(e){var n=e["-id"],r=e["-type"],o=e.text,a=e.children,u=g(e,["-id","-type","text","children"]),s={"-id":n};(null==o?void 0:o["-value"])&&(s["-name"]=o["-value"]),u["-json"]&&(s["-json"]=u["-json"]),u["-properties"]&&Object.assign(s,u["-properties"]),a&&(s.children=a),t[r]||(t[r]=[]),t[r].push(s),i.set(n,s)}));var a=o.edges.map((function(t){var e=t["-id"],n=t["-sourceNodeId"],r=t["-targetNodeId"],o=t.text,a=g(t,["-id","-sourceNodeId","-targetNodeId","text"]),u=i.get(r);u["bpmn:incoming"]||(u["bpmn:incoming"]=[]),u["bpmn:incoming"].push(e);var s={"-id":e,"-sourceRef":n,"-targetRef":r};return(null==o?void 0:o["-value"])&&(s["-name"]=o["-value"]),a["-json"]&&(s["-json"]=a["-json"]),a["-properties"]&&Object.assign(s,a["-properties"]),s}));e.edges.forEach((function(t){var e=t.sourceNodeId,n=t.id,r=i.get(e);r["bpmn:outgoing"]||(r["bpmn:outgoing"]=[]),r["bpmn:outgoing"].push(n)})),null===(r=t["bpmn:subProcess"])||void 0===r||r.forEach((function(e){var n={"bpmn:incoming":new Set,"bpmn:outgoing":new Set},r=[];e.children.forEach((function(r){var o,a=i.get(r["-id"]);["bpmn:incoming","bpmn:outgoing"].forEach((function(t){a[t]&&a[t].forEach((function(e){n[t].add(e)}))}));var u=null===(o=t[r["-type"]])||void 0===o?void 0:o.findIndex((function(t){return t["-id"]===r["-id"]}));u>=0&&t[r["-type"]].splice(u,1),i.delete(r["-id"]),e[r["-type"]]||(e[r["-type"]]=[]),e[r["-type"]].push(a)}));var o=n["bpmn:incoming"];n["bpmn:outgoing"].forEach((function(t){o.has(t)&&r.push(t)}));for(var u,s=function(t){var n=a.findIndex((function(e){return e["-id"]===r[t]}));n>=0?(e["bpmn:sequenceFlow"]||(e["bpmn:sequenceFlow"]=[]),e["bpmn:sequenceFlow"].push(a[n]),a.splice(n,1)):t++,u=t},l=0;l<r.length;)s(l),l=u;delete e.children})),t[xv.FLOW]=a}(o,t,e);var a={"-id":"BPMNPlane_1","-bpmnElement":o["-id"]};kv(a,t);var u=n.definitionAttributes;u["bpmn:process"]=o,u["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":a};var s={"bpmn:definitions":u};if(null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.out){var l=null===(i=null==e?void 0:e.mapping)||void 0===i?void 0:i.out,c=function(t){Array.isArray(t)&&t.forEach((function(t){return c(t)})),"object"==typeof t&&Object.keys(t).forEach((function(e){var n;(n=l[e])?(t[n]=hn.cloneDeep(t[e]),delete t[e],c(t[n])):c(t[e])}))};c(s)}return s},this.adapterIn=function(t,e){if(t)return Ov(t,e)},e.adapterIn=this.adapterIn,e.adapterOut=this.adapterOut,this.processAttributes={"-isExecutable":"true","-id":"Process"},this.definitionAttributes={"-id":"Definitions","-xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","-xmlns:bpmn":"http://www.omg.org/spec/BPMN/20100524/MODEL","-xmlns:bpmndi":"http://www.omg.org/spec/BPMN/20100524/DI","-xmlns:dc":"http://www.omg.org/spec/DD/20100524/DC","-xmlns:di":"http://www.omg.org/spec/DD/20100524/DI","-targetNamespace":"http://logic-flow.org","-exporter":"logicflow","-exporterVersion":"1.2.10"}}return t.prototype.setCustomShape=function(e,n){t.shapeConfigMap.set(e,n)},t.pluginName="bpmn-adapter",t.shapeConfigMap=new Map,t}();Rv.shapeConfigMap.set(xv.START,{width:Kf,height:$f}),Rv.shapeConfigMap.set(xv.END,{width:Jf,height:Qf}),Rv.shapeConfigMap.set(xv.INTERMEDIATE_CATCH,{width:nv,height:rv}),Rv.shapeConfigMap.set(xv.INTERMEDIATE_THROW,{width:nv,height:rv}),Rv.shapeConfigMap.set(xv.BOUNDARY,{width:tv,height:ev}),Rv.shapeConfigMap.set(xv.PARALLEL_GATEWAY,{width:iv,height:ov}),Rv.shapeConfigMap.set(xv.INCLUSIVE_GATEWAY,{width:av,height:uv}),Rv.shapeConfigMap.set(xv.EXCLUSIVE_GATEWAY,{width:sv,height:lv}),Rv.shapeConfigMap.set(xv.SYSTEM,{width:cv,height:dv}),Rv.shapeConfigMap.set(xv.USER,{width:hv,height:pv}),Rv.shapeConfigMap.set(xv.SUBPROCESS,{width:fv,height:vv});var Dv=function(t){function e(e){var n=t.call(this,e)||this;n.adapterXmlIn=function(t){var e,r=(e=t,(new gv.ObjTree).parseXML(e));return n.adapterIn(r,n.props)},n.adapterXmlOut=function(t){return function(t){var e="";for(var n in t)e+=wv(t[n],n,0);return e}(n.adapterOut(t,n.props))};var r=e.lf,i=e.props;return r.adapterIn=n.adapterXmlIn,r.adapterOut=n.adapterXmlOut,n.props=i,n}return f(e,t),e.pluginName="BPMNAdapter",e}(Rv),Lv={};function Bv(t){return t.startsWith("data:text/plain")}function zv(t){return y(this,void 0,void 0,(function(){return m(this,(function(e){return Lv[t]?[2,Lv[t]]:[2,new Promise((function(e,n){try{fetch(t).then((function(t){return t.blob()})).then((function(r){var i=new FileReader;i.onloadend=function(){e(Lv[t]=i.result)},i.onerror=n,i.readAsDataURL(r)})).catch((function(){e(Lv[t]=t)}))}catch(e){return Lv[t]=t}}))]}))}))}function Wv(t,e){return y(this,void 0,void 0,(function(){var n,r,i;return m(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),(n=t.getAttribute(e)||"").startsWith("data:")?[2]:[4,zv(n)];case 1:return Bv(r=o.sent())?[2]:(t.setAttribute(e,r),[3,3]);case 2:return i=o.sent(),console.error(i),[3,3];case 3:return[2]}}))}))}function Fv(t,e){return y(this,void 0,void 0,(function(){var n,r;return m(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),e.startsWith("data:")?[2]:[4,zv(e)];case 1:return Bv(n=i.sent())?[2]:(t.style.backgroundImage="url(".concat(n,")"),[3,3]);case 2:return r=i.sent(),console.error(r),[3,3];case 3:return[2]}}))}))}function Gv(t){return y(this,void 0,void 0,(function(){var e,n,r,i,o,a,u,s,l;return m(this,(function(c){switch(c.label){case 0:for(e=[t],r=[];e.length;)(n=e.shift()).children.length&&e.push.apply(e,_([],x(n.children),!1)),n instanceof HTMLElement&&(i=n.style,o=i.background,a=i.backgroundImage,(u=o.match(/url\(["']?(.*?)["']?\)/))&&u[1]&&(l=u[1],r.push(Fv(n,l))),(s=a.match(/url\(["']?(.*?)["']?\)/))&&s[1]&&(l=s[1],r.push(Fv(n,l)))),n instanceof HTMLImageElement?r.push(Wv(n,"src")):n instanceof SVGImageElement&&r.push(Wv(n,"href"));return[4,Promise.all(r)];case 1:return c.sent(),[2]}}))}))}function Hv(t,e,n){var r=document.createElement("canvas");r.width=e,r.height=n;var i=r.getContext("2d");return i&&i.drawImage(t,0,0,t.width,t.height,0,0,e,n),r}var Xv,Uv=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.customCssRules="",this.useGlobalRules=!0,e.getSnapshot=function(t,e){return y(n,void 0,void 0,(function(){return m(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshot(t,e)];case 1:return[2,n.sent()]}}))}))},e.getSnapshotBlob=function(t,e){return y(n,void 0,void 0,(function(){return m(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBlob(t,e)];case 1:return[2,n.sent()]}}))}))},e.getSnapshotBase64=function(t,e){return y(n,void 0,void 0,(function(){return m(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBase64(t,e)];case 1:return[2,n.sent()]}}))}))}}return t.prototype.getSvgRootElement=function(t){return t.container.querySelector(".lf-canvas-overlay")},t.prototype.triggerDownload=function(t){var e=new MouseEvent("click",{view:document.defaultView,bubbles:!1,cancelable:!0}),n=document.createElement("a");n.setAttribute("download",this.fileName),n.setAttribute("href",t),n.setAttribute("target","_blank"),n.dispatchEvent(e)},t.prototype.removeAnchor=function(t){for(var e=t.childNodes,n=t.childNodes&&t.childNodes.length,r=0;r<n;r++){var i=e[r];(i.classList&&Array.from(i.classList)||[]).indexOf("lf-anchor")>-1&&(t.removeChild(t.childNodes[r]),n--,r--)}},t.prototype.removeRotateControl=function(t){for(var e=t.childNodes,n=t.childNodes&&t.childNodes.length,r=0;r<n;r++){var i=e[r];(i.classList&&Array.from(i.classList)||[]).indexOf("lf-rotate-control")>-1&&(t.removeChild(t.childNodes[r]),n--,r--)}},t.prototype.getSnapshot=function(t,e){return y(this,void 0,void 0,(function(){var n,r,i,o,a=this;return m(this,(function(u){switch(u.label){case 0:return n=this.lf.graphModel.getPartial(),r=(null!=e?e:{}).partial,i=void 0===r?n:r,o=this.lf.getEditConfig(),this.lf.updateEditConfig({isSilentMode:!0,stopScrollGraph:!0,stopMoveGraph:!0}),n===i?[3,1]:(this.lf.graphModel.setPartial(i),this.lf.graphModel.eventCenter.once("graph:updated",(function(){return y(a,void 0,void 0,(function(){return m(this,(function(r){switch(r.label){case 0:return[4,this.snapshot(t,e)];case 1:return r.sent(),this.lf.graphModel.setPartial(n),[2]}}))}))})),[3,3]);case 1:return[4,this.snapshot(t,e)];case 2:u.sent(),u.label=3;case 3:return this.lf.updateEditConfig(o),[2]}}))}))},t.prototype.snapshot=function(t,e){return y(this,void 0,void 0,(function(){var n,r,i,o,a,u,s,l,c,d=this;return m(this,(function(h){switch(h.label){case 0:return r=(n=null!=e?e:{}).fileType,i=void 0===r?"png":r,o=n.quality,this.fileName="".concat(null!=t?t:"logic-flow.".concat(Date.now()),".").concat(i),[4,Gv(a=this.getSvgRootElement(this.lf))];case 1:return h.sent(),"svg"===i?(u=this.cloneSvg(a),s=(new XMLSerializer).serializeToString(u),l=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(l),this.triggerDownload(c)):this.getCanvasData(a,null!=e?e:{}).then((function(t){var e=t.toDataURL("image/".concat(i),o).replace("image/".concat(i),"image/octet-stream");d.triggerDownload(e)})),[2]}}))}))},t.prototype.getSnapshotBase64=function(t,e){return y(this,void 0,void 0,(function(){var n,r=this;return m(this,(function(i){switch(i.label){case 0:return[4,Gv(n=this.getSvgRootElement(this.lf))];case 1:return i.sent(),[2,new Promise((function(i){r.getCanvasData(n,{backgroundColor:t}).then((function(t){var n=t.toDataURL("image/".concat(null!=e?e:"png"));i({data:n,width:t.width,height:t.height})}))}))]}}))}))},t.prototype.getSnapshotBlob=function(t,e){return y(this,void 0,void 0,(function(){var n,r=this;return m(this,(function(i){switch(i.label){case 0:return[4,Gv(n=this.getSvgRootElement(this.lf))];case 1:return i.sent(),[2,new Promise((function(i){r.getCanvasData(n,{backgroundColor:t}).then((function(t){t.toBlob((function(e){i({data:e,width:t.width,height:t.height})}),"image/".concat(null!=e?e:"png"))}))}))]}}))}))},t.prototype.getClassRules=function(){var t="";if(this.useGlobalRules)for(var e=document.styleSheets,n=0;n<e.length;n++){var r=e[n];try{for(var i=0;i<r.cssRules.length;i++)t+=r.cssRules[i].cssText}catch(t){console.log("CSS scripts from different sources have been filtered out")}}return this.customCssRules&&(t+=this.customCssRules),t},t.prototype.getCanvasData=function(t,e){return y(this,void 0,void 0,(function(){var n,r,i,o,a,u,s,l,c,d,h,p,f,v,g,y,b,x,_,w,M,E,N,S,A,P;return m(this,(function(m){return n=e.width,r=e.height,i=e.backgroundColor,o=e.padding,a=void 0===o?40:o,u=this.cloneSvg(t,!1),(s=window.devicePixelRatio||1)<1&&(s=1),l=this.lf.graphModel.rootEl.querySelector(".lf-base"),c=l.getBoundingClientRect(),d=this.lf.container.querySelector(".lf-canvas-overlay"),h=d.getBoundingClientRect(),p=c.x-h.x,f=c.y-h.y,v=this.lf.graphModel,g=v.transformModel,y=g.SCALE_X,b=g.SCALE_Y,x=g.TRANSLATE_X,_=g.TRANSLATE_Y,u.lastChild.style.transform="matrix(1, 0, 0, 1, ".concat((-p+x)*(1/y),", ").concat((-f+_)*(1/b),")"),w=Math.ceil(c.width/y),M=Math.ceil(c.height/b),(E=document.createElement("canvas")).style.width="".concat(w,"px"),E.style.height="".concat(M,"px"),E.width=w*s+2*a,E.height=M*s+2*a,(N=E.getContext("2d"))&&(N.clearRect(0,0,E.width,E.height),N.scale(s,s),i?(N.fillStyle=i,N.fillRect(0,0,E.width,E.height)):N.clearRect(0,0,E.width,E.height)),S=new Image,(A=document.createElement("style")).innerHTML=this.getClassRules(),(P=document.createElement("foreignObject")).appendChild(A),u.appendChild(P),[2,new Promise((function(t){S.onload=function(){var e=navigator.userAgent.indexOf("Firefox")>-1;try{e?createImageBitmap(S,{resizeWidth:n&&r?Hv(E,n,r).width:E.width,resizeHeight:n&&r?Hv(E,n,r).height:E.height}).then((function(e){null==N||N.drawImage(e,a/s,a/s),t(n&&r?Hv(E,n,r):E)})):(null==N||N.drawImage(S,a/s,a/s),t(n&&r?Hv(E,n,r):E))}catch(e){null==N||N.drawImage(S,a/s,a/s),t(n&&r?Hv(E,n,r):E)}};var e="data:image/svg+xml;charset=utf-8,".concat((new XMLSerializer).serializeToString(u)).replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23");S.src=e}))]}))}))},t.prototype.cloneSvg=function(t,e){var n,r=this;void 0===e&&(e=!0);var i=t.cloneNode(!0),o=i.lastChild,a=null===(n=null==o?void 0:o.childNodes)||void 0===n?void 0:n.length;if(a)for(var u=0;u<a;u++){var s=null==o?void 0:o.childNodes[u],l=s.classList&&Array.from(s.classList);if(l&&l.indexOf("lf-base")<0)null==o||o.removeChild(o.childNodes[u]),a--,u--;else{var c=null==o?void 0:o.childNodes[u];c&&c.childNodes.forEach((function(t){var e=t;r.removeAnchor(e.firstChild),r.removeRotateControl(e.firstChild)}))}}if(e){var d=document.createElement("style");d.innerHTML=this.getClassRules();var h=document.createElement("foreignObject");h.appendChild(d),i.appendChild(h)}return i},t.pluginName="snapshot",t}(),Vv={SEQUENCE_FLOW:1,START_EVENT:2,END_EVENT:3,USER_TASK:4,EXCLUSIVE_GATEWAY:6},qv={1:"bpmn:sequenceFlow",2:"bpmn:startEvent",3:"bpmn:endEvent",4:"bpmn:userTask",6:"bpmn:exclusiveGateway"};function Yv(t){switch(t){case"bpmn:sequenceFlow":return Vv.SEQUENCE_FLOW;case"bpmn:startEvent":return Vv.START_EVENT;case"bpmn:endEvent":return Vv.END_EVENT;case"bpmn:userTask":return Vv.USER_TASK;case"bpmn:exclusiveGateway":return Vv.EXCLUSIVE_GATEWAY;default:return t}}!function(t){t.HORIZONTAL="horizontal",t.VERTICAL="vertical"}(Xv||(Xv={}));var Zv=function(t,e,n,r){return void 0===r&&(r=0),Jv(t,e,n)<=r};function Kv(t){return t*t}function $v(t,e){return Kv(t.x-e.x)+Kv(t.y-e.y)}var Jv=function(t,e,n){return Math.sqrt(function(t,e,n){var r=$v(e,n);if(0===r)return $v(t,e);var i=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/r;return i=Math.max(0,Math.min(1,i)),$v(t,{x:e.x+i*(n.x-e.x),y:e.y+i*(n.y-e.y)})}(t,e,n))},Qv=function(t,e,n){var r=function(t){var e=t.x,n=t.y,r=t.width,i=t.height;return{minX:e-r/2,minY:n-i/2,maxX:e+r/2,maxY:n+i/2,x:e,y:n,width:r,height:i,centerX:e,centerY:n}}(t),i=function(t,e){var n;return t.x===e.x?n=Xv.VERTICAL:t.y===e.y&&(n=Xv.HORIZONTAL),n}(e,n),o=Math.max(e.x,n.x),a=Math.min(e.x,n.x),u=Math.max(e.y,n.y),s=Math.min(e.y,n.y),l=t.x,c=t.y,d=t.width,h=t.height;if(i===Xv.HORIZONTAL){if(o>=r.maxX&&a<=r.minX)return{startCrossPoint:{x:e.x>n.x?l+d/2:l-d/2,y:e.y},endCrossPoint:{x:e.x>n.x?l-d/2:l+d/2,y:e.y}}}else if(i===Xv.VERTICAL&&u>=r.maxY&&s<=r.minY)return{startCrossPoint:{x:e.x,y:e.y>n.y?c+h/2:c-h/2},endCrossPoint:{x:e.x,y:e.y>n.y?c-h/2:c+h/2}}},tg=function(t,e,n){void 0===n&&(n=0);for(var r=t.x,i=t.y,o=e.pointsList,a=0;a<o.length-1;a++)if(Zv({x:r,y:i},o[a],o[a+1],n)){var u=Qv(t,o[a],o[a+1]);if(u)return{crossIndex:a+1,crossPoints:u}}return{crossIndex:-1,crossPoints:{startCrossPoint:{x:0,y:0},endCrossPoint:{x:0,y:0}}}},eg=function(){function t(t){var e=t.lf;this._lf=e,this.deviation=20,this.dndAdd=!0,this.dropAdd=!0,this.eventHandler()}return t.prototype.eventHandler=function(){var t=this;this.dndAdd&&this._lf.on("node:dnd-add",(function(e){var n=e.data;t.insetNode(n)})),this.dropAdd&&this._lf.on("node:drop",(function(e){for(var n=e.data,r=t._lf.graphModel.edges,i=n.id,o=!0,a=0;a<r.length;a++)if(r[a].sourceNodeId===i||r[a].targetNodeId===i){o=!1;break}o&&t.insetNode(n)}))},t.prototype.checkRuleBeforeInsetNode=function(t,n,r,i,o){var a=this._lf.getNodeModelById(t),u=this._lf.getNodeModelById(n),s=a.getAnchorInfo(r),l=u.getAnchorInfo(i),c=a.isAllowConnectedAsSource(o,s,l),d=u.isAllowConnectedAsTarget(o,s,l),h=e.formatAnchorConnectValidateData(c),p=h.isAllPass,f=h.msg,v=e.formatAnchorConnectValidateData(d),g=v.isAllPass;return{isPass:p&&g,sourceMsg:f,targetMsg:v.msg}},t.prototype.insetNode=function(t){var n=this,r=this._lf.graphModel.edges,i=this._lf.getNodeModelById(t.id),o=null==i?void 0:i.getDefaultAnchor();if(!o||0===o.length)this._lf.graphModel.eventCenter.emit(e.EventType.CONNECTION_NOT_ALLOWED,{data:t,msg:"自定义类型节点不显示锚点,也不允许其他节点连接到此节点"});else if(i)for(var a=0;a<r.length;a++){var u=tg(i,r[a],this.deviation),s=u.crossIndex,l=u.crossPoints;if(s>=0){var c=r[a],d=c.sourceNodeId,h=c.targetNodeId,p=c.id,f=c.type,v=c.pointsList,g=c.sourceAnchorId,y=c.targetAnchorId,m=Ru(v[0]),b=Ru(l.startCrossPoint);this._lf.deleteEdge(p);var w=this.checkRuleBeforeInsetNode(d,h,g,y,t);if(this._lf.addEdge({type:f,sourceNodeId:d,targetNodeId:t.id,startPoint:m,endPoint:b,pointsList:_(_([],x(v.slice(0,s)),!1),[l.startCrossPoint],!1)}),this._lf.addEdge({type:f,sourceNodeId:t.id,targetNodeId:h,startPoint:Ru(l.endCrossPoint),endPoint:Ru(v[v.length-1]),pointsList:_([l.endCrossPoint],x(v.slice(s)),!1)}),w.isPass)break;this._lf.graphModel.eventCenter.emit(e.EventType.CONNECTION_NOT_ALLOWED,{data:t,msg:w.targetMsg||w.sourceMsg}),setTimeout((function(){n._lf.undo()}),200);break}}},t.pluginName="insertNodeInPolyline",t}(),ng=function(){function t(t){var e=t.lf,n=this;this.controlItems=[{key:"zoom-out",iconClass:"lf-control-zoomOut",title:"缩小流程图",text:"缩小",onClick:function(){n.lf.zoom(!1)}},{key:"zoom-in",iconClass:"lf-control-zoomIn",title:"放大流程图",text:"放大",onClick:function(){n.lf.zoom(!0)}},{key:"reset",iconClass:"lf-control-fit",title:"恢复流程原有尺寸",text:"适应",onClick:function(){n.lf.resetZoom()}},{key:"undo",iconClass:"lf-control-undo",title:"回到上一步",text:"上一步",onClick:function(){n.lf.undo()}},{key:"redo",iconClass:"lf-control-redo",title:"移到下一步",text:"下一步",onClick:function(){n.lf.redo()}}],this.lf=e}return t.prototype.render=function(t,e){this.destroy();var n=this.getControlTool();this.toolEl=n,e.appendChild(n),this.domContainer=e},t.prototype.destroy=function(){this.domContainer&&this.toolEl&&this.domContainer.contains(this.toolEl)&&this.domContainer.removeChild(this.toolEl)},t.prototype.addItem=function(t){this.controlItems.push(t)},t.prototype.removeItem=function(t){var e=this.controlItems.findIndex((function(e){return e.key===t}));return-1==e?null:this.controlItems.splice(e,1)[0]},t.prototype.getControlTool=function(){var t=this,e="lf-control-item",n="lf-control-item disabled",r=document.createElement("div"),i=[];return r.className="lf-control",this.controlItems.forEach((function(r){var o=document.createElement("div"),a=document.createElement("i"),u=document.createElement("span");switch(o.className=n,r.onClick&&(o.onclick=r.onClick.bind(null,t.lf)),r.onMouseEnter&&(o.onmouseenter=r.onMouseEnter.bind(null,t.lf)),r.onMouseLeave&&(o.onmouseleave=r.onMouseLeave.bind(null,t.lf)),a.className=r.iconClass,u.className="lf-control-text",u.title=r.title,u.innerText=r.text,o.append(a,u),r.text){case"上一步":t.lf.on("history:change",(function(t){var r=t.data.undoAble;o.className=r?e:n}));break;case"下一步":t.lf.on("history:change",(function(t){var r=t.data.redoAble;o.className=r?e:n}));break;default:o.className=e}i.push(o)})),r.append.apply(r,_([],x(i),!1)),r},t.pluginName="control",t}(),rg="lf:defaultNodeMenu",ig="lf:defaultEdgeMenu",og="lf:defaultGraphMenu",ag="lf:defaultSelectionMenu",ug=function(){function t(t){var e=t.lf,n=this;this.__currentData=null,this.lf=e,e.options.isSilentMode||(this.__menuDOM=document.createElement("ul"),this.menuTypeMap=new Map,this.init(),this.lf.setMenuConfig=function(t){n.setMenuConfig(t)},this.lf.addMenuConfig=function(t){n.addMenuConfig(t)},this.lf.setMenuByType=function(t){n.setMenuByType(t)})}return t.prototype.init=function(){var t,e,n,r,i=this,o=[{text:"删除",callback:function(t){i.lf.deleteNode(t.id)}},{text:"编辑文本",callback:function(t){i.lf.graphModel.editText(t.id)}},{text:"复制",callback:function(t){i.lf.cloneNode(t.id)}}];null===(t=this.menuTypeMap)||void 0===t||t.set(rg,o);var a=[{text:"删除",callback:function(t){i.lf.deleteEdge(t.id)}},{text:"编辑文本",callback:function(t){i.lf.graphModel.editText(t.id)}}];null===(e=this.menuTypeMap)||void 0===e||e.set(ig,a),null===(n=this.menuTypeMap)||void 0===n||n.set(og,[]);var u=[{text:"删除",callback:function(t){i.lf.clearSelectElements(),t.edges.forEach((function(t){return i.lf.deleteEdge(t.id)})),t.nodes.forEach((function(t){return i.lf.deleteNode(t.id)}))}}];null===(r=this.menuTypeMap)||void 0===r||r.set(ag,u)},t.prototype.render=function(t,e){var n=this;t.options.isSilentMode||(this.__container=e,this.__currentData=null,this.__menuDOM&&(this.__menuDOM.className="lf-menu",e.appendChild(this.__menuDOM),this.__menuDOM.addEventListener("click",(function(t){t.stopPropagation();for(var e=t.target;-1===Array.from(e.classList).indexOf("lf-menu-item")&&-1===Array.from(e.classList).indexOf("lf-menu");)e=null==e?void 0:e.parentElement;Array.from(e.classList).indexOf("lf-menu-item")>-1?(e.onclickCallback(n.__currentData),n.__menuDOM&&(n.__menuDOM.style.display="none"),n.__currentData=null):console.warn("点击区域不在菜单项内,请检查代码!")}),!0)),this.lf.on("node:contextmenu",(function(t){var e,r,i=t.data,o=t.position,a=t.e,u=o.domOverlayPosition,s=u.x,l=u.y,c=i.id,d=n.lf.graphModel.getNodeModelById(c);if(d){var h=[],p=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(d.type);h=d&&d.menu&&Array.isArray(d.menu)?d.menu:p||(null===(r=n.menuTypeMap)||void 0===r?void 0:r.get(rg)),n.__currentData=i,n.showMenu(s,l,h,{width:d.width,height:d.height,clientX:a.clientX,clientY:a.clientY})}})),this.lf.on("edge:contextmenu",(function(t){var e,r,i,o=t.data,a=t.position,u=t.e,s=a.domOverlayPosition,l=s.x,c=s.y,d=o.id,h=n.lf.graphModel.getEdgeModelById(d);if(h){var p=[],f=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(h.type);p=h&&h.menu&&Array.isArray(h.menu)?h.menu:f||(null!==(i=null===(r=n.menuTypeMap)||void 0===r?void 0:r.get(ig))&&void 0!==i?i:[]),n.__currentData=o,n.showMenu(l,c,p,{width:h.width,height:h.height,clientX:u.clientX,clientY:u.clientY})}})),this.lf.on("blank:contextmenu",(function(t){var e,r,i=t.position,o=null!==(r=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(og))&&void 0!==r?r:[],a=i.domOverlayPosition,u=a.x,s=a.y;n.showMenu(u,s,o)})),this.lf.on("selection:contextmenu",(function(t){var e,r=t.data,i=t.position,o=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(ag),a=i.domOverlayPosition,u=a.x,s=a.y;n.__currentData=r,n.showMenu(u,s,o)})),this.lf.on("node:mousedown",(function(){n.__menuDOM.style.display="none"})),this.lf.on("edge:click",(function(){n.__menuDOM.style.display="none"})),this.lf.on("blank:click",(function(){n.__menuDOM.style.display="none"})))},t.prototype.destroy=function(){var t;this.__menuDOM&&(null===(t=null==this?void 0:this.__container)||void 0===t||t.removeChild(this.__menuDOM),this.__menuDOM=void 0)},t.prototype.showMenu=function(t,e,n,r){if(n&&n.length){var i=this.__menuDOM;if(i){if(i.innerHTML="",i.append.apply(i,_([],x(this.__getMenuDom(n)),!1)),!i.children.length)return;if(i.style.display="block",!r)return i.style.top="".concat(e,"px"),void(i.style.left="".concat(t,"px"));var o=r.width,a=r.height,u=r.clientX,s=r.clientY,l=this.lf.graphModel,c=i.offsetWidth,d=!0,h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,p=h-u,f=l.rootEl.getBoundingClientRect(),v=f.left+f.width;v<h&&(p=v-u),p<c&&(d=!1),i.style.left="".concat(d?t:t-o,"px");var g=i.offsetHeight,y=!0,m=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,b=m-s,w=f.top+f.height;w<m&&(b=w-s),b<g&&(y=!1),i.style.top="".concat(y?e:e-a,"px")}}},t.prototype.setMenuByType=function(t){var e;t.type&&t.menu&&(null===(e=this.menuTypeMap)||void 0===e||e.set(t.type,t.menu))},t.prototype.__getMenuDom=function(t){var e=[];return t&&t.length>0&&t.forEach((function(t){var n=document.createElement("li");if(t.className?n.className="lf-menu-item ".concat(t.className):n.className="lf-menu-item",!0===t.icon){var r=document.createElement("span");r.className="lf-menu-item-icon",n.appendChild(r)}var i=document.createElement("span");i.className="lf-menu-item-text",t.text&&(i.innerText=t.text),n.appendChild(i),n.onclickCallback=t.callback,e.push(n)})),e},t.prototype.setMenuConfig=function(t){var e,n,r;t&&(void 0!==t.nodeMenu&&(null===(e=this.menuTypeMap)||void 0===e||e.set(rg,t.nodeMenu?t.nodeMenu:[])),void 0!==t.edgeMenu&&(null===(n=this.menuTypeMap)||void 0===n||n.set(ig,t.edgeMenu?t.edgeMenu:[])),void 0!==t.graphMenu&&(null===(r=this.menuTypeMap)||void 0===r||r.set(og,t.graphMenu?t.graphMenu:[])))},t.prototype.addMenuConfig=function(t){var e,n,r,i,o,a,u,s,l;if(t){if(Array.isArray(t.nodeMenu)){var c=null!==(n=null===(e=this.menuTypeMap)||void 0===e?void 0:e.get(rg))&&void 0!==n?n:[];null===(r=this.menuTypeMap)||void 0===r||r.set(rg,c.concat(t.nodeMenu))}if(Array.isArray(t.edgeMenu)){c=null!==(o=null===(i=this.menuTypeMap)||void 0===i?void 0:i.get(ig))&&void 0!==o?o:[];null===(a=this.menuTypeMap)||void 0===a||a.set(ig,c.concat(t.edgeMenu))}if(Array.isArray(t.graphMenu)){c=null!==(s=null===(u=this.menuTypeMap)||void 0===u?void 0:u.get(og))&&void 0!==s?s:[];null===(l=this.menuTypeMap)||void 0===l||l.set(og,c.concat(t.graphMenu))}}},t.prototype.changeMenuItem=function(t,e){if("add"===t)this.addMenuConfig(e);else{if("reset"!==t)throw new Error("The first parameter of changeMenuConfig should be 'add' or 'reset'");this.setMenuConfig(e)}},t.pluginName="menu",t}(),sg="menu-common",lg=function(){function t(t){var e=t.lf,n=this;this.menuTypeMap=new Map,this.listenDelete=function(){n.hideContextMenu()},this.lf=e,this.__menuDOM=document.createElement("div"),this.__menuDOM.className="lf-inner-context",this.menuTypeMap.set(sg,[]),this.lf.setContextMenuByType=function(t,e){n.setContextMenuByType(t,e)},this.lf.setContextMenuItems=function(t){n.setContextMenuItems(t)},this.lf.showContextMenu=function(t){n.showContextMenu(t)},this.lf.hideContextMenu=function(){n.hideContextMenu()}}return t.prototype.render=function(t,e){var n=this;this.container=e,t.on("node:click",(function(t){var e=t.data;n._activeData=e,n.createContextMenu()})),t.on("edge:click",(function(t){var e=t.data;n._activeData=e,n.createContextMenu()})),t.on("blank:click",(function(){n.hideContextMenu()}))},t.prototype.setContextMenuByType=function(t,e){this.menuTypeMap.set(t,e)},t.prototype.hideContextMenu=function(){this.__menuDOM.innerHTML="",this.__menuDOM.style.display="none",this.isShow&&this.container.removeChild(this.__menuDOM),this.lf.off("node:delete,edge:delete,node:drag,graph:transform",this.listenDelete),this.isShow=!1},t.prototype.showContextMenu=function(t){t&&t.id?(this._activeData=t,this.createContextMenu()):console.warn("请检查传入的参数")},t.prototype.setContextMenuItems=function(t){this.menuTypeMap.set(sg,t)},t.prototype.getContextMenuPosition=function(){var t=this._activeData,e=this.lf.graphModel.getElement(t.id);if(e){var n,r;if("edge"===e.BaseType){n=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER;var i=e.getData();n=Math.max(i.startPoint.x,n),r=Math.min(i.startPoint.y,r),n=Math.max(i.endPoint.x,n),r=Math.min(i.endPoint.y,r),i.pointsList&&i.pointsList.forEach((function(t){n=Math.max(t.x,n),r=Math.min(t.y,r)}))}return"node"===e.BaseType&&(n=t.x+e.width/2,r=t.y-e.height/2),this.lf.graphModel.transformModel.CanvasPointToHtmlPoint([n,r])}},t.prototype.createContextMenu=function(){var t=this;if(!this.lf.options.isSilentMode){var e=_(_([],x(this.menuTypeMap.get(this._activeData.type)||[]),!1),x(this.menuTypeMap.get(sg)||[]),!1),n=document.createDocumentFragment();e.forEach((function(e){var r=document.createElement("div");r.className="lf-context-item";var i=document.createElement("img");i.src=e.icon,i.className="lf-context-img",e.className&&(r.className="".concat(r.className," ").concat(e.className)),i.addEventListener("click",(function(){t.hideContextMenu(),e.callback?e.callback(t._activeData):t.addNode({sourceId:t._activeData.id,x:t._activeData.x,y:t._activeData.y,properties:e.properties,type:e.type})})),r.appendChild(i),n.appendChild(r)})),this.__menuDOM.innerHTML="",this.__menuDOM.appendChild(n),this.showMenu()}},t.prototype.addNode=function(t,e){var n=void 0!==e;void 0===e&&(e=t.y);var r=this.lf.getNodeModelById(t.sourceId);if(r){var i=t.x-r.width+200,o=e-t.y/2-20,a=t.x+r.width+200,u=e+t.y/2+20;if(this.lf.getAreaElement([i,o],[a,u]).length)return e+=100,void this.addNode(t,e);if(t.type){var s=this.lf.addNode({type:t.type,x:t.x+200,y:e,properties:t.properties}),l=void 0,c=void 0;n&&(l={x:t.x,y:t.y+r.height/2},c={x:s.x-s.width/2,y:s.y}),this.lf.addEdge({sourceNodeId:t.sourceId,targetNodeId:s.id,startPoint:l,endPoint:c})}}},t.prototype.showMenu=function(){var t=this.getContextMenuPosition();if(t){var e=x(t,2),n=e[0],r=e[1];this.__menuDOM.style.display="flex",this.__menuDOM.style.top="".concat(r,"px"),this.__menuDOM.style.left="".concat(n+10,"px"),this.container.appendChild(this.__menuDOM),!this.isShow&&this.lf.on("node:delete,edge:delete,node:drag,graph:transform",this.listenDelete),this.isShow=!0}},t.pluginName="contextMenu",t}(),cg=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.lf.setPatternItems=function(t){n.setPatternItems(t)}}return t.prototype.render=function(t,e){var n=this;this.destroy(),this.shapeList&&0!==this.shapeList.length?(this.panelEl=document.createElement("div"),this.panelEl.className="lf-dndpanel",this.shapeList.forEach((function(t){var e;null===(e=n.panelEl)||void 0===e||e.appendChild(n.createDndItem(t))})),e.appendChild(this.panelEl),this.domContainer=e):this.domContainer=e},t.prototype.destroy=function(){this.domContainer&&this.panelEl&&this.domContainer.contains(this.panelEl)&&this.domContainer.removeChild(this.panelEl)},t.prototype.setPatternItems=function(t){this.shapeList=t,this.domContainer&&this.render(this.lf,this.domContainer)},t.prototype.createDndItem=function(t){var e=this,n=document.createElement("div");n.className=t.className?"lf-dnd-item ".concat(t.className):"lf-dnd-item";var r=document.createElement("div");if(r.className="lf-dnd-shape",t.icon&&(r.style.backgroundImage="url(".concat(t.icon,")")),n.appendChild(r),t.label){var i=document.createElement("div");i.innerText=t.label,i.className="lf-dnd-text",n.appendChild(i)}return t.disabled?(n.classList.add("disabled"),n.onmousedown=function(){t.callback&&t.callback(e.lf,e.domContainer)},n):(n.onmousedown=function(){t.type&&e.lf.dnd.startDrag({type:t.type,properties:t.properties,text:t.text}),t.callback&&t.callback(e.lf,e.domContainer)},n.ondblclick=function(n){e.lf.graphModel.eventCenter.emit("dnd:panel-dbclick",{e:n,data:t})},n.onclick=function(n){e.lf.graphModel.eventCenter.emit("dnd:panel-click",{e:n,data:t})},n.oncontextmenu=function(n){e.lf.graphModel.eventCenter.emit("dnd:panel-contextmenu",{e:n,data:t})},n)},t.pluginName="dndPanel",t}(),dg=function(){function t(t){var e=t.lf,n=this;this.disabled=!0,this.isDefaultStopMoveGraph=!1,this.isWholeNode=!0,this.isWholeEdge=!0,this.draw=function(t){var e=n.lf.getPointByClient(t.clientX,t.clientY).domOverlayPosition,r=e.x,i=e.y;if(n.endPoint={x:r,y:i},n.startPoint){var o=n.startPoint,a=o.x,u=o.y,s=a,l=u,c=r-a,d=i-u;r<a&&(s=r,c=a-r),i<u&&(l=i,d=u-i),n.wrapper&&(n.wrapper.style.left="".concat(s,"px"),n.wrapper.style.top="".concat(l,"px"),n.wrapper.style.width="".concat(c,"px"),n.wrapper.style.height="".concat(d,"px"))}},this.drawOff=function(){var t;if(document.removeEventListener("mousemove",n.draw),document.removeEventListener("mouseup",n.drawOff),n.wrapper&&(n.wrapper.oncontextmenu=null,null===(t=n.container)||void 0===t||t.removeChild(n.wrapper)),n.startPoint&&n.endPoint){var e=n.startPoint,r=e.x,i=e.y,o=n.endPoint,a=o.x,u=o.y,s=[Math.min(r,a),Math.min(i,u)],l=[Math.max(r,a),Math.max(i,u)];if(n.lf.emit("selection:selected-area",{topLeft:s,bottomRight:l}),Math.abs(a-r)<10&&Math.abs(u-i)<10)return;var c=n.lf.graphModel.getAreaElement(s,l,n.isWholeEdge,n.isWholeNode,!0),d=n.lf.graphModel.group;c.forEach((function(t){d&&d.getNodeGroup(t.id)||n.lf.selectElementById(t.id,!0)})),n.lf.emit("selection:selected",c)}},this.lf=e;var r=e.getEditConfig().stopMoveGraph;this.isDefaultStopMoveGraph=r,e.openSelectionSelect=function(){n.openSelectionSelect()},e.closeSelectionSelect=function(){n.closeSelectionSelect()}}return t.prototype.render=function(t,e){var n=this;this.container=e,t.on("blank:mousedown",(function(r){var i=r.e;if(t.getEditConfig().stopMoveGraph&&!n.disabled&&!(2===i.button)){var o=t.getPointByClient(i.clientX,i.clientY).domOverlayPosition,a=o.x,u=o.y;n.startPoint={x:a,y:u},n.endPoint={x:a,y:u};var s=document.createElement("div");s.className="lf-selection-select",s.oncontextmenu=function(t){t.preventDefault()},s.style.top="".concat(n.startPoint.y,"px"),s.style.left="".concat(n.startPoint.x,"px"),e.appendChild(s),n.wrapper=s,document.addEventListener("mousemove",n.draw),document.addEventListener("mouseup",n.drawOff)}}))},t.prototype.setSelectionSense=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!0),this.isWholeEdge=t,this.isWholeNode=e},t.prototype.openSelectionSelect=function(){this.lf.getEditConfig().stopMoveGraph||(this.isDefaultStopMoveGraph=!1,this.lf.updateEditConfig({stopMoveGraph:!0})),this.open()},t.prototype.closeSelectionSelect=function(){this.isDefaultStopMoveGraph||this.lf.updateEditConfig({stopMoveGraph:!1}),this.close()},t.prototype.open=function(){this.disabled=!1},t.prototype.close=function(){this.disabled=!0},t.pluginName="selectionSelect",t}(),hg=function(){function t(t){var e=t.lf,n=t.LogicFlow,r=t.options,i=this;this.width=200,this.height=150,this.scale=1,this.translateX=0,this.translateY=0,this.showEdge=!1,this.viewPortTop=0,this.viewPortLeft=0,this.viewPortWidth=150,this.viewPortHeight=75,this.isShow=!1,this.isShowHeader=!1,this.isShowCloseIcon=!1,this.headerTitle="导航",this.disabledPlugins=["miniMap","control","selectionSelect"],this.render=function(t,e){i.container=e,i.lf.on("history:change",(function(){i.isShow&&i.setView()})),i.lf.on("graph:transform",(function(){i.isShow&&i.setView(!1)}))},this.show=function(t,e){i.isShow||(i.createMiniMap(t,e),i.setView()),i.isShow=!0},this.hide=function(){i.isShow&&(i.removeMiniMap(),i.lf.emit("miniMap:close",{})),i.isShow=!1},this.updatePosition=function(t){if("object"==typeof t)void 0===t.left&&void 0===t.right||(i.leftPosition=t.left,i.rightPosition=t.right),void 0===t.top&&void 0===t.bottom||(i.topPosition=t.top,i.bottomPosition=t.bottom);else switch(t){case"left-top":i.leftPosition=0,i.rightPosition=void 0,i.topPosition=0,i.bottomPosition=void 0;break;case"right-top":i.leftPosition=void 0,i.rightPosition=0,i.topPosition=0,i.bottomPosition=void 0;break;case"left-bottom":i.leftPosition=0,i.rightPosition=void 0,i.topPosition=void 0,i.bottomPosition=0;break;case"right-bottom":i.leftPosition=void 0,i.rightPosition=0,i.topPosition=void 0,i.bottomPosition=0}i.updateMiniMapPosition()},this.reset=function(){i.lf.resetTranslate(),i.lf.resetZoom()},this.setShowEdge=function(t){i.showEdge!==t&&(i.showEdge=t,i.setView())},this.startDrag=function(t){document.addEventListener("mousemove",i.drag),document.addEventListener("mouseup",i.drop);var e=t.x,n=t.y;i.startPosition={x:e,y:n}},this.drag=function(t){var e=t.x,n=t.y,r=(e-i.startPosition.x)/i.scale,o=(n-i.startPosition.y)/i.scale,a=i.viewPortLeft+r+i.viewPortWidth/i.scale/2,u=i.viewPortTop+o+i.viewPortHeight/i.scale/2;i.startPosition={x:e,y:n},i.lf.focusOn({coordinate:{x:a,y:u}})},this.drop=function(){document.removeEventListener("mousemove",i.drag),document.removeEventListener("mouseup",i.drop)},this.mapClick=function(t){var e=t.offsetX,n=t.offsetY,r=i.translateX+e/i.scale,o=i.translateY+n/i.scale;i.lf.focusOn({coordinate:{x:r,y:o}})},this.lf=e,this.LFCtor=n,r&&r.MiniMap&&this.setOption(r.MiniMap),this.viewPortWidth=e.graphModel.width,this.viewPortHeight=e.graphModel.height;var o={left:0,right:this.viewPortWidth,top:0,bottom:this.viewPortHeight};this.bounds=o,this.elementAreaBounds=o,this.viewPortBounds=o,this.initMiniMap()}return t.prototype.setOption=function(t){var e=t.width,n=void 0===e?150:e,r=t.height,i=void 0===r?220:r,o=t.showEdge,a=void 0!==o&&o,u=t.isShowHeader,s=void 0!==u&&u,l=t.isShowCloseIcon,c=void 0!==l&&l,d=t.leftPosition,h=t.topPosition,p=t.rightPosition,f=void 0===p?0:p,v=t.bottomPosition,g=void 0===v?0:v,y=t.headerTitle,m=void 0===y?"导航":y;this.width=n,this.height=i,this.showEdge=a,this.isShowHeader=s,this.isShowCloseIcon=c,this.leftPosition=d,this.rightPosition=void 0!==d?void 0:f,this.topPosition=h,this.bottomPosition=void 0!==h?void 0:g,this.headerTitle=m},t.prototype.initMiniMap=function(){var t=document.createElement("div");t.className="lf-mini-map-graph",t.style.width="".concat(this.width,"px"),t.style.height="".concat(this.height,"px"),this.lfMap=new this.LFCtor({container:t,grid:!1,isSilentMode:!0,stopZoomGraph:!0,stopScrollGraph:!0,stopMoveGraph:!1,history:!1,snapline:!1,disabledPlugins:this.disabledPlugins}),this.miniMapWrap=t,this.createViewPort(),t.addEventListener("click",this.mapClick)},t.prototype.createMiniMap=function(t,e){var n,r=document.createElement("div");this.miniMapContainer=r,r.appendChild(this.miniMapWrap),r.style.position="absolute",void 0===t&&void 0===e||(this.leftPosition=t||0,this.topPosition=e||0,this.rightPosition=void 0,this.bottomPosition=void 0),this.updateMiniMapPosition(),r.className="lf-mini-map",this.isShowCloseIcon||r.classList.add("lf-mini-map-no-close-icon"),this.isShowHeader||r.classList.add("lf-mini-map-no-header"),null===(n=this.container)||void 0===n||n.appendChild(r),this.miniMapWrap.appendChild(this.viewport);var i=document.createElement("div");i.className="lf-mini-map-header",i.innerText=this.headerTitle,r.appendChild(i);var o=document.createElement("span");o.className="lf-mini-map-close",o.addEventListener("click",this.hide),r.appendChild(o)},t.prototype.updateMiniMapPosition=function(){if(this.miniMapContainer){var t=this.miniMapContainer.style;void 0!==this.rightPosition?(t.right="".concat(this.rightPosition,"px"),t.left=""):(t.left="".concat(this.leftPosition,"px"),t.right=""),void 0!==this.bottomPosition?(t.bottom="".concat(this.bottomPosition,"px"),t.top=""):(t.top="".concat(this.topPosition,"px"),t.bottom="")}},t.prototype.removeMiniMap=function(){var t;this.miniMapContainer&&(null===(t=this.container)||void 0===t||t.removeChild(this.miniMapContainer))},t.prototype.updateBounds=function(t){t&&this.updateElementAreaBounds(t),this.updateViewPortBounds(),this.bounds={left:Math.min(this.elementAreaBounds.left,this.viewPortBounds.left),right:Math.max(this.elementAreaBounds.right,this.viewPortBounds.right),top:Math.min(this.elementAreaBounds.top,this.viewPortBounds.top),bottom:Math.max(this.elementAreaBounds.bottom,this.viewPortBounds.bottom)}},t.prototype.updateElementAreaBounds=function(t){var e={left:0,right:0,top:0,bottom:0},n=t.nodes;n&&n.length>0&&n.forEach((function(t){var n,r,i=t.x,o=t.y,a=null!==(n=t.width)&&void 0!==n?n:200,u=null!==(r=t.height)&&void 0!==r?r:200,s=i-a/2,l=i+a/2,c=o-u/2,d=o+u/2;e.left=Math.min(s,e.left),e.right=Math.max(l,e.right),e.top=Math.min(c,e.top),e.bottom=Math.max(d,e.bottom)})),this.elementAreaBounds=e},t.prototype.updateViewPortBounds=function(){var t=this.lf.getTransform(),e=t.TRANSLATE_X,n=t.TRANSLATE_Y,r=t.SCALE_X,i=t.SCALE_Y,o=this.lf.graphModel,a=o.width,u=o.height;this.viewPortBounds={left:-e/r,right:(-e+a)/r,top:-n/i,bottom:(-n+u)/i}},t.prototype.resetData=function(t){var e=t.nodes,n=t.edges;return e.forEach((function(t){t.text=void 0})),this.showEdge&&n.forEach((function(t){t.text=void 0})),{nodes:e,edges:this.showEdge?n:[]}},t.prototype.setView=function(t){var e,n;if(void 0===t&&(t=!0),t){var r=this.lf.getGraphRawData(),i=this.resetData(r),o=this.lf.viewMap,a=this.lf.graphModel.modelMap,u=this.lfMap.viewMap;try{for(var s=b(o.keys()),l=s.next();!l.done;l=s.next()){var c=l.value;u.has(c)||this.lfMap.register({type:c,view:o.get(c),model:a.get(c)})}}catch(t){e={error:t}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}this.lfMap.render(i),this.updateBounds(i)}else this.updateBounds();var d=this.bounds,h=d.left,p=d.top,f=d.right-h,v=d.bottom-p,g=this.width/f,y=this.height/v,m=Math.min(g,y);this.scale=m;var x=h-(this.width/m-f)/2,_=p-(this.height/m-v)/2;if(this.lfMap.graphModel.transformModel.translate(-x+this.translateX,-_+this.translateY),this.translateX=x,this.translateY=_,this.miniMapWrap.firstChild){var w=this.miniMapWrap.firstChild.style;w.pointerEvents="none",w.transform="matrix(".concat(m,", 0, 0, ").concat(m,", 0, 0)"),w.transformOrigin="left top",w.height="".concat(this.height/m,"px"),w.width="".concat(this.width/m,"px"),this.updateViewPort()}},t.prototype.updateViewPort=function(){var t=this.viewport.style,e=this.lf.getTransform(),n=e.TRANSLATE_X,r=e.TRANSLATE_Y,i=e.SCALE_X,o=e.SCALE_Y,a=this.lf.graphModel,u=a.width,s=a.height;this.viewPortLeft=-n/i,this.viewPortTop=-r/o,this.viewPortWidth=u/i*this.scale,this.viewPortHeight=s/o*this.scale,t.width="".concat(this.viewPortWidth,"px"),t.height="".concat(this.viewPortHeight,"px"),t.left="".concat((this.viewPortLeft-this.translateX)*this.scale,"px"),t.top="".concat((this.viewPortTop-this.translateY)*this.scale,"px")},t.prototype.createViewPort=function(){var t=document.createElement("div");t.className="lf-minimap-viewport",t.addEventListener("mousedown",this.startDrag),t.addEventListener("click",(function(t){t.stopPropagation()})),this.viewport=t},t.pluginName="miniMap",t}(),pg={tr:"tl",lb:"tl",tl:"tr",rb:"tr",br:"bl",lt:"bl",bl:"br",rt:"br"};function fg(t,e,n,r){var i,o="",a="";t[0]===e[0]?o=t[1]>e[1]?"t":"b":t[1]===e[1]&&(o=t[0]>e[0]?"l":"r"),e[0]===n[0]?a=e[1]>n[1]?"t":"b":e[1]===n[1]&&(a=e[0]>n[0]?"l":"r");var u=Math.min(Math.hypot(e[0]-t[0],e[1]-t[1])/2,Math.hypot(n[0]-e[0],n[1]-e[1])/2,r)||.2*r,s="".concat(o).concat(a),l=pg[s]||"-",c="L ".concat(t[0]," ").concat(t[1]);if("-"===l)c+="L ".concat(e[0]," ").concat(e[1]," L ").concat(n[0]," ").concat(n[1]);else{var d=x(function(t,e,n,r){var i=[t[0],t[1]],o=[t[0],t[1]];switch(n){case"tl":return"tr"===e?(i[1]+=r,o[0]+=r):"lb"===e&&(i[0]+=r,o[1]+=r),[i,o];case"tr":return"tl"===e?(i[1]+=r,o[0]-=r):"rb"===e&&(i[0]-=r,o[1]+=r),[i,o];case"bl":return"br"===e?(i[1]-=r,o[0]+=r):"lt"===e&&(i[0]+=r,o[1]-=r),[i,o];case"br":return"bl"===e?(i[1]-=r,o[0]-=r):"rt"===e&&(i[0]-=r,o[1]-=r),[i,o];default:return[]}}(e,s,l,u),2),h=d[0],p=d[1];h&&p&&(c+="L ".concat(h[0]," ").concat(h[1]," Q ").concat(e[0]," ").concat(e[1]," ").concat(p[0]," ").concat(p[1]),i=x(p,2),e[0]=i[0],e[1]=i[1])}return c}function vg(t,e){var n=0,r="";if(2===t.length)r+="M".concat(t[n][0]," ").concat(t[n++][1]," L ").concat(t[n][0]," ").concat(t[n][1]);else{for(r+="M".concat(t[n][0]," ").concat(t[n++][1]);n+1<t.length;){r+=fg(t[n-1],t[n],t[1+n++],e)}r+="L ".concat(t[n][0]," ").concat(t[n][1])}return r}var gg=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getEdge=function(){var t=this.props.model,n=t.points,r=t.isAnimation,i=t.arrowConfig,o=t.radius,a=void 0===o?5:o,u=t.getEdgeStyle(),s=t.getEdgeAnimationStyle(),l=function(t){for(var e=t,n=1;n<e.length-1;){var r=x(e[n-1],2),i=r[0],o=r[1],a=x(e[n],2),u=a[0],s=a[1],l=x(e[n+1],2),c=l[0],d=l[1];i===u&&u===c||o===s&&s===d?e.splice(n,1):n++}return e}(n.split(" ").map((function(t){return t.split(",").map((function(t){return+t}))}))),c=vg(l,a),d=v(v(v({style:r?s:{}},u),i),{fill:"none"});return e.h("path",v({d:c},d))},n}(e.PolylineEdge),yg=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e}(e.PolylineEdgeModel),mg=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getLabelShape=function(){var t=this.props.model,n=t.id,r=t.x,i=t.y,o=t.width,a=t.height,u=t.properties,s=this.props.model.getNodeStyle();return e.h("svg",{x:r-o/2,y:i-a/2,width:50,height:24,style:"z-index: 0; background: none; overflow: auto;"},[u.labelText?e.h("text",{x:0,y:-5,fontSize:"16px",fill:s.stroke},u.labelText):"",u.disabledDelete?"":e.h("text",{x:u.labelText?50:0,y:-5,fontSize:"24px",cursor:"pointer",fill:s.stroke,onclick:this.handleCustomDeleteIconClick.bind(this,n)},"x")])},n.prototype.getShape=function(){var t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.id,u=this.props.model.getNodeStyle();return e.h("g",{},[e.h("rect",v(v({},u),{x:n-i/2,y:r-o/2,width:i,height:o,id:a})),this.getLabelShape()])},n.prototype.toFront=function(){},n.prototype.handleCustomDeleteIconClick=function(t){this.props.graphModel.deleteNode(t)},n}(e.PolygonNode),bg=function(t){function e(){var e=t.apply(this,_([],x(arguments),!1))||this;return e.d=10,e}return f(e,t),e.prototype.initNodeData=function(e){e.text={value:"",x:e.x,y:e.y,draggable:!1,editable:!1},t.prototype.initNodeData.call(this,e),this.zIndex=0,this.draggable=!0},e.prototype.setAttributes=function(){var t,e=this;this.points=[],(null===(t=this.properties)||void 0===t?void 0:t.node_selection_ids).length>1&&setTimeout((function(){var t;e.updatePointsByNodes((null===(t=e.properties)||void 0===t?void 0:t.node_selection_ids)||[])}))},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this);return e.stroke=this.properties.strokeColor||"#008000",e.strokeDasharray="10 5",e},e.prototype.getDefaultAnchor=function(){return[]},e.prototype.updatePoints=function(t){this.points=t},e.prototype.updateCoordinate=function(t){var e=t.x,n=t.y;this.x=e,this.y=n},e.prototype.updatePointsByNodes=function(t){var e=this,n=[],r=1/0,i=1/0,o=-1/0,a=-1/0;t.forEach((function(t){var n=e.graphModel.getNodeModelById(t);if(n){var u=n.width,s=n.height,l=n.x,c=n.y;r=Math.min(r,l-u/2-e.d),i=Math.min(i,c-s/2-e.d),o=Math.max(o,l+u/2+e.d),a=Math.max(a,c+s/2+e.d)}})),n.push([r,i],[o,i],[o,a],[r,a]),[r,i,o,a].some((function(t){return Math.abs(t)===1/0}))||(this.updatePoints(n),this.updateCoordinate({x:(o+r)/2,y:(a+i)/2}))},e}(e.PolygonNodeModel),xg=function(){function t(t){var e=t.lf;this.selectNodes=[],this.d=10,e.register({type:"node-selection",view:mg,model:bg})}return Object.defineProperty(t.prototype,"selectNodesIds",{get:function(){return this.selectNodes.map((function(t){return t.id}))},enumerable:!1,configurable:!0}),t.prototype.addNodeSelection=function(){this.lf.addNode({type:"node-selection",text:"",properties:{node_selection_ids:this.selectNodesIds}}).updatePointsByNodes(this.selectNodesIds)},t.prototype.updateNodeSelection=function(){var t=this.getNodeSelection();t&&(this.lf.setProperties(t.id,{node_selection_ids:this.selectNodesIds}),this.lf.getNodeModelById(t.id).updatePointsByNodes(this.selectNodesIds))},t.prototype.getNodeSelection=function(){var t=this,e=this.selectNodesIds,n=this.lf.getGraphRawData(),r=e.filter((function(e){return e!==t.currentClickNode.id}));return n.nodes.find((function(t){if("node-selection"===t.type){var e=Di(t,"properties.node_selection_ids",[]);return r.every((function(t){return e.includes(t)}))}return!1}))},t.prototype.render=function(t){var e=this;this.lf=t,t.on("node:click",(function(n){if(n.e.shiftKey&&"node-selection"!==n.data.type){e.currentClickNode=n.data;var r=!1;e.selectNodesIds.includes(n.data.id)&&(e.lf.getNodeModelById(n.data.id).setSelected(!1),r=!0);var i=t.getSelectElements(!0).nodes;e.selectNodes=i,1===e.selectNodes.length?r?e.updateNodeSelection():e.addNodeSelection():e.selectNodes.length>1&&e.updateNodeSelection()}})),t.graphModel.addNodeMoveRules((function(e,n,r){if("node-selection"===e.type){var i=e.properties.node_selection_ids;return t.graphModel.moveNodes(i,n,r,!0),!0}return!0}))},t.pluginName="node-selection",t}(),_g=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.paths=[],e.getPathes=function(){if(!n.startNodeType)throw new Error("需要预先指定开始节点类型");return n.getPathes()},e.setRawPaths=function(t){n.setPathes(t)},e.getRawPathes=function(){return n.paths},e.setStartNodeType=function(t){n.startNodeType=t}}return t.prototype.setPathes=function(t){this.paths=t.map((function(t){return{routeId:t.routeId,name:t.name,elements:t.elements,type:t.type,similarElement:null,weight:0}}))},t.prototype.getPathes=function(){var t=this,e=this.lf.getGraphRawData(),n=new Map,r=[];e.nodes.forEach((function(e){n.set(e.id,{id:e.id,data:e,nextNodes:[]}),e.type===t.startNodeType&&r.push(e.id)})),e.edges.forEach((function(t){var e=n.get(t.sourceNodeId);null==e||e.nextNodes.push(t.targetNodeId)}));var i=[];return r.forEach((function(e){var r=n.get(e);r&&(i=i.concat(t.findPathElements(r,n,[])))})),this.getNewPathes(i)},t.prototype.findPathElements=function(t,e,n){void 0===n&&(n=[]);var r=_([],x(n),!1);if(r.push(t.id),0===t.nextNodes.length)return[r];for(var i=[],o=0;o<t.nextNodes.length;o++){var a=e.get(t.nextNodes[o]),u=void 0;if(a){var s=r.indexOf(a.id);u=-1!==s?[_(_([],x(r.slice(s)),!1),[a.id],!1)]:this.findPathElements(a,e,_([],x(r),!1)),i=i.concat(u)}}return i},t.prototype.getNewPathes=function(t){var e=this,n=[],r=new Set;t.forEach((function(t){console.log("elements",t);var i=e.getNewId("path"),o=e.getNewId("路径"),a=e.isLoopPath(t),u=t.join(",");r.has(u)||(r.add(u),n.push({routeId:i,name:o,elements:t,type:a,weight:0,similarElement:""}))}));var i=JSON.parse(JSON.stringify(this.paths));return n.forEach((function(t){for(var n=0;n<i.length;n++){var r=i[n],o=e.similar2Path(_([],x(t.elements),!1),_([],x(r.elements),!1));o>t.weight&&r.weight<=o&&(t.weight=o,t.similarElement=r,o===r.weight&&r.similarElement?(r.similarElement.similarElement=null,r.similarElement.weight=0,r.similarElement=null,r.weight=0):(r.similarElement=t,r.weight=o))}})),n.forEach((function(t){t.similarElement&&t.similarElement.similarElement===t&&(t.routeId=t.similarElement.routeId,t.name=t.similarElement.name),delete t.similarElement,delete t.weight})),this.setPathes(n),n},t.prototype.similar2Path=function(t,e){var n=0,r=t.length+e.length;t.sort(),e.sort();for(var i=t.shift(),o=e.shift();void 0!==i&&void 0!==o;)i===o?(n++,i=t.shift(),o=e.shift()):i<o?i=t.shift():i>o&&(o=e.shift());return n/r*200},t.prototype.getNewId=function(t){return"".concat(t,"_").concat(E())},t.prototype.isLoopPath=function(t){var e=t.length;return t.indexOf(t[e-1])!==e-1?1:0},t.pluginName="flowPath",t}(),wg=-1,Mg=0,Eg=1,Ng=function(){function t(t){var e=t.lf,n=this;this.levelHeight=[],this.newNodeMap=new Map,this.lf=e,this.trunk=[],e.layout=function(t){var e=n.lf.getGraphRawData();n.lf.setStartNodeType(t);var r=n.lf.getPathes();return n.levelHeight=[],n.newNodeMap=new Map,n.layout(e,r)}}return t.prototype.layout=function(t,e){var n=this,r=[];e.forEach((function(t){var e=t.elements;e.length>r.length?r=e:e.length===r.length&&JSON.stringify(e)===JSON.stringify(n.trunk)&&(r=n.trunk)})),this.trunk=r;for(var i=this.formatData(t),o={nodes:[],edges:[]},a=r.length-1;a>=0;a--)this.setNodePosition(r[a],i,o,a,1);this.lf.graphModel.graphDataToModel(o)},t.prototype.setNodePosition=function(t,e,n,r,i){var o=this,a=e[t],u=a.text,s=a.type,l=a.next,c=a.properties,d=160*r+40,h=120*i,p={id:t,x:d,text:u,y:h,type:s,properties:c};return u&&"object"==typeof u&&(p.text=v(v({},u),{x:d+u.x,y:h+u.y})),this.newNodeMap.set(p.id,{x:p.x,y:p.y,type:s}),n.nodes.push(p),a.isFixed=!0,this.addLevelHeight(r,1),l&&l.length>0&&l.forEach((function(i){if(!e[i.nodeId].isFixed){var a=o.getLevelHeight(r+1);o.addLevelHeight(r,1),o.setNodePosition(i.nodeId,e,n,r+1,a+1)}n.edges.push(v({id:i.edgeId,type:i.edgeType,sourceNodeId:t,targetNodeId:i.nodeId,properties:i.properties,text:i.text},o.getEdgeDataPoints(t,i.nodeId)))})),p},t.prototype.getEdgeDataPoints=function(t,e){var n=this.newNodeMap.get(t),r=this.newNodeMap.get(e),i=this.getShape(t),o=i.width,a=i.height,u=this.getShape(e),s=u.width,l=u.height,c=this.getRelativePosition(n,r),d={x:n.x,y:n.y},h={x:r.x,y:r.y};switch(c){case Mg:d.x=n.x+o/2,h.x=r.x-s/2;break;case wg:d.y=n.y+a/2,h.x=r.x-s/2;break;case Eg:d.x=n.x+o/2,h.y=r.y+l/2}return{startPoint:d,endPoint:h}},t.prototype.getRelativePosition=function(t,e){var n=t.y,r=e.y;return n<r?-1:n===r?0:1},t.prototype.getShape=function(t){var e,n,r=this.lf.getNodeModelById(t);return{height:null!==(e=null==r?void 0:r.height)&&void 0!==e?e:0,width:null!==(n=null==r?void 0:r.width)&&void 0!==n?n:0}},t.prototype.formatData=function(t){var e=t.nodes.reduce((function(t,e){var n=e.type,r=e.properties,i=e.text,o=e.x,a=e.y;return i&&"object"==typeof i&&(i.x=i.x-o,i.y=i.y-a),t[e.id]={type:n,properties:r,text:i,prev:[],next:[]},t}),{});return t.edges.forEach((function(t){var n=t.sourceNodeId,r=t.targetNodeId,i=t.id,o=t.properties,a=t.text,u=a;"object"==typeof a&&(u=a.value),e[n].next.push({edgeId:i,nodeId:r,edgeType:t.type,properties:o,text:u}),e[r].prev.push({edgeId:i,nodeId:n,properties:o,text:u})})),e},t.prototype.addLevelHeight=function(t,e,n){void 0===e&&(e=1),void 0===n&&(n=!1);var r=this.levelHeight[t];r||(r={positiveHeight:0,negativeHeight:0},this.levelHeight[t]=r),n?r.negativeHeight-=e:r.positiveHeight+=e},t.prototype.getLevelHeight=function(t,e){void 0===e&&(e=!1);var n=this.levelHeight[t];return n?e?n.negativeHeight:n.positiveHeight:0},t.pluginName="AutoLayout",t}(),Sg=function(t,e){var n=[],r=[],i=function(t,r,o){o&&r.unshift.apply(r,_([],x(e.getEdgeModels({sourceNodeId:t.id,targetNodeId:null==o?void 0:o.id}).map((function(t){return t.id}))),!1)),r.includes(t.id)?n.push(r):(r.unshift(t.id),t.incoming.nodes.length?t.incoming.nodes.forEach((function(e){i(e,r.slice(),t)})):n.push(r))},o=function(t,n,i){i&&n.push.apply(n,_([],x(e.getEdgeModels({sourceNodeId:null==i?void 0:i.id,targetNodeId:t.id}).map((function(t){return t.id}))),!1)),n.includes(t.id)?r.push(n):(n.push(t.id),t.outgoing.nodes.length?t.outgoing.nodes.forEach((function(e){o(e,n.slice(),t)})):r.push(n))};return i(t,[]),o(t,[]),_([],x(new Set(_(_([],x(n.flat()),!1),x(r.flat()),!1))),!1)},Ag=function(){function t(t){var e=t.lf;this.mode="path",this.manual=!1,this.tempStyles={},this.lf=e}return t.prototype.setMode=function(t){this.mode=t},t.prototype.setManual=function(t){this.manual=t},t.prototype.highlightSingle=function(t){var e=this.lf.getModelById(t);"node"===(null==e?void 0:e.BaseType)?e.updateStyles(this.tempStyles[t]):"edge"===(null==e?void 0:e.BaseType)&&(e.updateStyles(this.tempStyles[t]),e.sourceNode.updateStyles(this.tempStyles[e.sourceNode.id]),e.targetNode.updateStyles(this.tempStyles[e.targetNode.id]))},t.prototype.highlightPath=function(t){var e=this,n=function(t,e){var n=e.getModelById(t);return Sg("node"===(null==n?void 0:n.BaseType)?n:null==n?void 0:n.targetNode,e)}(t,this.lf);n.forEach((function(t){var n;null===(n=e.lf.getModelById(t))||void 0===n||n.updateStyles(e.tempStyles[t])}))},t.prototype.highlight=function(t,e){var n=this;(void 0===e&&(e=this.mode),this.manual)||(Object.keys(this.tempStyles).length&&this.restoreHighlight(),Object.values(this.lf.graphModel.modelsMap).forEach((function(t){var e="node"===t.BaseType?t.getNodeStyle():t.getEdgeStyle();n.tempStyles[t.id]=v({},e),t.setStyles({opacity:.1})})),{single:this.highlightSingle.bind(this),path:this.highlightPath.bind(this)}[e](t))},t.prototype.restoreHighlight=function(){var t=this;Object.keys(this.tempStyles).length&&(Object.values(this.lf.graphModel.modelsMap).forEach((function(e){var n,r=null!==(n=t.tempStyles[e.id])&&void 0!==n?n:{};e.updateStyles(v({},r))})),this.tempStyles={})},t.prototype.render=function(){var t=this;this.lf.on("node:mouseenter",(function(e){var n=e.data;return t.highlight(n.id)})),this.lf.on("edge:mouseenter",(function(e){var n=e.data;return t.highlight(n.id)})),this.lf.on("node:mouseleave",this.restoreHighlight.bind(this)),this.lf.on("edge:mouseleave",this.restoreHighlight.bind(this)),this.lf.on("history:change",this.restoreHighlight.bind(this))},t.prototype.destroy=function(){},t.pluginName="highlight",t}();t.AutoLayout=Ng,t.BPMNAdapter=Dv,t.BPMNBaseAdapter=Rv,t.BPMNElements=Zf,t.BoundaryEventFactory=bt,t.BpmnAdapter=lt,t.BpmnElement=H,t.BpmnXmlAdapter=ct,t.ContextMenu=lg,t.Control=ng,t.CurvedEdge=gg,t.CurvedEdgeModel=yg,t.DiamondResize=kf,t.DiamondResizeModel=Pf,t.DiamondResizeView=Tf,t.DndPanel=cg,t.EllipseResize=Af,t.EllipseResizeModel=Nf,t.EllipseResizeView=Sf,t.EndEventFactory=gt,t.EndEventModel=P,t.EndEventView=T,t.ExclusiveGatewayModel=j,t.ExclusiveGatewayView=R,t.FlowPath=_g,t.GatewayNodeFactory=Ot,t.Group=Gf,t.GroupNode=zf,t.GroupNodeModel=Bf,t.Highlight=Ag,t.HtmlResize=If,t.HtmlResizeModel=Cf,t.HtmlResizeView=Of,t.InsertNodeInPolyline=eg,t.IntermediateCatchEventFactory=yt,t.IntermediateThrowEventFactory=xt,t.Menu=ug,t.MiniMap=hg,t.NodeResize=Lf,t.NodeSelection=xg,t.RectResize=Df,t.RectResizeModel=jf,t.RectResizeView=Rf,t.SelectionSelect=dg,t.SequenceFlowModel=C,t.SequenceFlowView=O,t.ServiceTaskModel=L,t.ServiceTaskView=B,t.Snapshot=Uv,t.StartEventFactory=mt,t.StartEventModel=N,t.StartEventView=S,t.SubProcessFactory=Hf,t.TaskNodeFactory=jt,t.UserTaskModel=W,t.UserTaskView=F,t.bpmnUtils=vt,t.convertNormalToXml=Pv,t.convertXmlToNormal=Tv,t.gateway={exclusive:0,inclusive:1,parallel:2},t.gatewayComposable=[[1,1,0],[0,0,1],[0,1,1]],t.getCurvedEdgePath=vg,t.handleAttributes=Y,t.icons=Ct,t.lfJson2Xml=$,t.lfXml2Json=tt,t.multiInstanceIcon=It,t.sequenceFlowFactory=Uf,t.toLogicflowData=function(t){var e={nodes:[],edges:[]},n=t.flowElementList;return n&&n.length>0&&n.forEach((function(t){if(t.type===Vv.SEQUENCE_FLOW){var n=function(t){var e=t.incoming,n=t.outgoing,r=t.properties,i=t.key,o=t.type,a=r.text,u=r.name,s=r.startPoint,l=r.endPoint,c=r.pointsList,d={id:i,type:qv[o],sourceNodeId:e[0],targetNodeId:n[0],text:a||u,properties:{}};s&&(d.startPoint=JSON.parse(s)),l&&(d.endPoint=JSON.parse(l)),c&&(d.pointsList=JSON.parse(c));var h=["startPoint","endPoint","pointsList","text"];return Object.keys(t.properties).forEach((function(e){-1===h.indexOf(e)&&(d.properties[e]=t.properties[e])})),d}(t);e.edges.push(n)}else{var r=function(t){var e=t.properties,n=t.key,r=t.type,i=t.bounds,o=e.x,a=e.y,u=e.text;if(void 0===o){var s=x(i,2),l=s[0],c=l.x,d=l.y,h=s[1];o=(c+h.x)/2,a=(d+h.y)/2}var p={id:n,type:qv[r],x:o,y:a,text:u,properties:{}},f=["x","y","text"];return Object.keys(t.properties).forEach((function(e){-1===f.indexOf(e)&&(p.properties[e]=t.properties[e])})),p}(t);e.nodes.push(r)}})),e},t.toNormalJson=it,t.toTurboData=function(t){var e=new Map,n={flowElementList:[]};return t.nodes.forEach((function(t){var r=function(t){var e=t.id,n=t.type,r=t.x,i=t.y,o=t.text,a=void 0===o?"":o,u=t.properties;return{incoming:[],outgoing:[],dockers:[],type:Yv(n),properties:v(v({},u),{name:a&&a.value||"",x:r,y:i,text:a}),key:e}}(t);n.flowElementList.push(r),e.set(t.id,r)})),t.edges.forEach((function(t){var r=function(t){var e=t.id,n=t.type,r=t.sourceNodeId,i=t.targetNodeId,o=t.startPoint,a=t.endPoint,u=t.pointsList,s=t.text,l=void 0===s?"":s,c=t.properties;return{incoming:[r],outgoing:[i],type:Yv(n),dockers:[],properties:v(v({},c),{name:l&&l.value||"",text:l,startPoint:JSON.stringify(o),endPoint:JSON.stringify(a),pointsList:JSON.stringify(u)}),key:e}}(t);e.get(t.sourceNodeId).outgoing.push(r.key),e.get(t.targetNodeId).incoming.push(r.key),n.flowElementList.push(r)})),n},t.toXmlJson=rt,t.useDefinition=Yf}));
12
12
  //# sourceMappingURL=index.min.js.map