@logicflow/extension 2.0.0-beta.10 → 2.0.0-beta.11

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
@@ -22,7 +22,7 @@ var _f,Ef=4294967295,wf=Array.prototype,Sf=Object.prototype.hasOwnProperty,Cf=Ht
22
22
 
23
23
  See the Apache Version 2.0 License for specific language governing permissions
24
24
  and limitations under the License.
25
- ***************************************************************************** */var om=function(){return om=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},om.apply(this,arguments)};function im(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function rm(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a}function am(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(rm(arguments[e]));return t}var sm=Symbol("mobx did run lazy initializers"),lm=Symbol("mobx pending decorators"),um={},cm={};function dm(t){var e,n;if(!0!==t[sm]){var o=t[lm];if(o){Gy(t,sm,!0);var i=am(Object.getOwnPropertySymbols(o),Object.keys(o));try{for(var r=im(i),a=r.next();!a.done;a=r.next()){var s=o[a.value];s.propertyCreator(t,s.prop,s.descriptor,s.decoratorTarget,s.decoratorArguments)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}}}}function hm(t,e){return function(){var n,o,i=function(o,i,r,a){if(!0===a)return e(o,i,r,o,n),null;if(!Object.prototype.hasOwnProperty.call(o,lm)){var s=o[lm];Gy(o,lm,om({},s))}return o[lm][i]={prop:i,propertyCreator:e,descriptor:r,decoratorTarget:o,decoratorArguments:n},function(t,e){var n=e?um:cm;return n[t]||(n[t]={configurable:!0,enumerable:e,get:function(){return dm(this),this[t]},set:function(e){dm(this),this[t]=e}})}(i,t)};return(2===(o=arguments).length||3===o.length)&&("string"==typeof o[1]||"symbol"==typeof o[1])||4===o.length&&!0===o[3]?(n=Dy,i.apply(null,arguments)):(n=Array.prototype.slice.call(arguments),i)}}function pm(t,e,n){return Pb(t)?t:Array.isArray(t)?Sm.array(t,{name:n}):Wy(t)?Sm.object(t,void 0,{name:n}):Xy(t)?Sm.map(t,{name:n}):Vy(t)?Sm.set(t,{name:n}):t}function fm(t){return t}function gm(t){By(t);var e=hm(!0,(function(e,n,o,i,r){var a=o?o.initializer?o.initializer.call(e):o.value:void 0;sx(e).addObservableProp(n,a,t)})),n=("undefined"!=typeof process&&process.env,e);return n.enhancer=t,n}var vm={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function ym(t){return null==t?vm:"string"==typeof t?{name:t,deep:!0,proxy:!0}:t}Object.freeze(vm);var mm=gm(pm),bm=gm((function(t,e,n){return null==t||hx(t)||Jb(t)||nx(t)||rx(t)?t:Array.isArray(t)?Sm.array(t,{name:n,deep:!1}):Wy(t)?Sm.object(t,void 0,{name:n,deep:!1}):Xy(t)?Sm.map(t,{name:n,deep:!1}):Vy(t)?Sm.set(t,{name:n,deep:!1}):jy(!1)})),xm=gm(fm),_m=gm((function(t,e,n){return vx(t,e)?e:t}));function Em(t){return t.defaultDecorator?t.defaultDecorator.enhancer:!1===t.deep?fm:pm}var wm={box:function(t,e){arguments.length>2&&Cm("box");var n=ym(e);return new Km(t,Em(n),n.name,!0,n.equals)},array:function(t,e){arguments.length>2&&Cm("array");var n=ym(e);return function(t,e,n,o){void 0===n&&(n="ObservableArray@"+Iy());void 0===o&&(o=!1);var i=new qb(n,e,o);!function(t,e,n){Object.defineProperty(t,e,{enumerable:!1,writable:!1,configurable:!0,value:n})}(i.values,$y,i);var r=new Proxy(i.values,Yb);if(i.proxy=r,t&&t.length){var a=Ym(!0);i.spliceWithArray(0,0,t),qm(a)}return r}(t,Em(n),n.name)},map:function(t,e){arguments.length>2&&Cm("map");var n=ym(e);return new ex(t,Em(n),n.name)},set:function(t,e){arguments.length>2&&Cm("set");var n=ym(e);return new ix(t,Em(n),n.name)},object:function(t,e,n){"string"==typeof arguments[1]&&Cm("object");var o=ym(n);if(!1===o.proxy)return Tb({},t,e,o);var i=Ab(o),r=function(t){var e=new Proxy(t,Fb);return t[$y].proxy=e,e}(Tb({},void 0,void 0,o));return Mb(r,t,e,i),r},ref:xm,shallow:bm,deep:mm,struct:_m},Sm=function(t,e,n){if("string"==typeof arguments[1]||"symbol"==typeof arguments[1])return mm.apply(null,arguments);if(Pb(t))return t;var o=Wy(t)?Sm.object(t,e,n):Array.isArray(t)?Sm.array(t,e):Xy(t)?Sm.map(t,e):Vy(t)?Sm.set(t,e):t;if(o!==t)return o;jy(!1)};function Cm(t){jy("Expected one or two arguments to observable."+t+". Did you accidentally try to use observable."+t+" as decorator?")}Object.keys(wm).forEach((function(t){return Sm[t]=wm[t]}));var Nm,Tm,Am=hm(!1,(function(t,e,n,o,i){var r=n.get,a=n.set,s=i[0]||{};sx(t).addComputedProp(t,e,om({get:r,set:a,context:t},s))})),Mm=Am({equals:em.structural}),Om=function(t,e,n){if("string"==typeof e)return Am.apply(null,arguments);if(null!==t&&"object"==typeof t&&1===arguments.length)return Am.apply(null,arguments);var o="object"==typeof e?e:{};return o.get=t,o.set="function"==typeof e?e:o.set,o.name=o.name||t.name||"",new $m(o)};Om.struct=Mm,function(t){t[t.NOT_TRACKING=-1]="NOT_TRACKING",t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.POSSIBLY_STALE=1]="POSSIBLY_STALE",t[t.STALE=2]="STALE"}(Nm||(Nm={})),function(t){t[t.NONE=0]="NONE",t[t.LOG=1]="LOG",t[t.BREAK=2]="BREAK"}(Tm||(Tm={}));var Pm=function(t){this.cause=t};function km(t){return t instanceof Pm}function Rm(t){switch(t.dependenciesState){case Nm.UP_TO_DATE:return!1;case Nm.NOT_TRACKING:case Nm.STALE:return!0;case Nm.POSSIBLY_STALE:for(var e=Fm(!0),n=Bm(),o=t.observing,i=o.length,r=0;r<i;r++){var a=o[r];if(Jm(a)){if(ib.disableErrorBoundaries)a.get();else try{a.get()}catch(t){return Hm(n),zm(e),!0}if(t.dependenciesState===Nm.STALE)return Hm(n),zm(e),!0}}return Wm(t),Hm(n),zm(e),!1}}function Dm(t){var e=t.observers.size>0;ib.computationDepth>0&&e&&jy(!1),ib.allowStateChanges||!e&&"strict"!==ib.enforceActions||jy(!1)}function Lm(t,e,n){var o=Fm(!0);Wm(t),t.newObserving=new Array(t.observing.length+100),t.unboundDepsCount=0,t.runId=++ib.runId;var i,r=ib.trackingDerivation;if(ib.trackingDerivation=t,!0===ib.disableErrorBoundaries)i=e.call(n);else try{i=e.call(n)}catch(t){i=new Pm(t)}return ib.trackingDerivation=r,function(t){for(var e=t.observing,n=t.observing=t.newObserving,o=Nm.UP_TO_DATE,i=0,r=t.unboundDepsCount,a=0;a<r;a++){0===(s=n[a]).diffValue&&(s.diffValue=1,i!==a&&(n[i]=s),i++),s.dependenciesState>o&&(o=s.dependenciesState)}n.length=i,t.newObserving=null,r=e.length;for(;r--;){0===(s=e[r]).diffValue&&ab(s,t),s.diffValue=0}for(;i--;){var s;1===(s=n[i]).diffValue&&(s.diffValue=0,rb(s,t))}o!==Nm.UP_TO_DATE&&(t.dependenciesState=o,t.onBecomeStale())}(t),zm(o),i}function Im(t){var e=t.observing;t.observing=[];for(var n=e.length;n--;)ab(e[n],t);t.dependenciesState=Nm.NOT_TRACKING}function jm(t){var e=Bm();try{return t()}finally{Hm(e)}}function Bm(){var t=ib.trackingDerivation;return ib.trackingDerivation=null,t}function Hm(t){ib.trackingDerivation=t}function Fm(t){var e=ib.allowStateReads;return ib.allowStateReads=t,e}function zm(t){ib.allowStateReads=t}function Wm(t){if(t.dependenciesState!==Nm.UP_TO_DATE){t.dependenciesState=Nm.UP_TO_DATE;for(var e=t.observing,n=e.length;n--;)e[n].lowestObserverState=Nm.UP_TO_DATE}}var Gm=0,Um=1,Xm=Object.getOwnPropertyDescriptor((function(){}),"name");function Vm(t,e,n){var o=function(){return function(t,e,n,o){var i=function(){var t=!1,e=0,n=Bm();lb();var o=Ym(!0),i=Fm(!0),r={prevDerivation:n,prevAllowStateChanges:o,prevAllowStateReads:i,notifySpy:t,startTime:e,actionId:Um++,parentActionId:Gm};return Gm=r.actionId,r}();try{return e.apply(n,o)}catch(t){throw i.error=t,t}finally{!function(t){Gm!==t.actionId&&jy("invalid action stack. did you forget to finish an action?");Gm=t.parentActionId,void 0!==t.error&&(ib.suppressReactionErrors=!0);qm(t.prevAllowStateChanges),zm(t.prevAllowStateReads),ub(),Hm(t.prevDerivation),t.notifySpy&&!1;ib.suppressReactionErrors=!1}(i)}}(0,e,n||this,arguments)};return o.isMobxAction=!0,o}function Ym(t){var e=ib.allowStateChanges;return ib.allowStateChanges=t,e}function qm(t){ib.allowStateChanges=t}Xm&&Xm.configurable;var Km=function(t){function e(e,n,o,i,r){void 0===o&&(o="ObservableValue@"+Iy()),void 0===i&&(i=!0),void 0===r&&(r=em.default);var a=t.call(this,o)||this;return a.enhancer=n,a.name=o,a.equals=r,a.hasUnreportedChange=!1,a.value=n(e,void 0,o),a}return function(t,e){function n(){this.constructor=t}nm(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.dehanceValue=function(t){return void 0!==this.dehancer?this.dehancer(t):t},e.prototype.set=function(t){this.value;if((t=this.prepareNewValue(t))!==ib.UNCHANGED){false,this.setNewValue(t)}},e.prototype.prepareNewValue=function(t){if(Dm(this),zb(this)){var e=Gb(this,{object:this,type:"update",newValue:t});if(!e)return ib.UNCHANGED;t=e.newValue}return t=this.enhancer(t,this.value,this.name),this.equals(this.value,t)?ib.UNCHANGED:t},e.prototype.setNewValue=function(t){var e=this.value;this.value=t,this.reportChanged(),Ub(this)&&Vb(this,{type:"update",object:this,newValue:t,oldValue:e})},e.prototype.get=function(){return this.reportObserved(),this.dehanceValue(this.value)},e.prototype.intercept=function(t){return Wb(this,t)},e.prototype.observe=function(t,e){return e&&t({object:this,type:"update",newValue:this.value,oldValue:void 0}),Xb(this,t)},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.value+"]"},e.prototype.valueOf=function(){return Ky(this.get())},e.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},e}(Jy),Zm=Uy("ObservableValue",Km),$m=function(){function t(t){this.dependenciesState=Nm.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isBeingObserved=!1,this.isPendingUnobservation=!1,this.observers=new Set,this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=Nm.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+Iy(),this.value=new Pm(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=Tm.NONE,By(t.get,"missing option for computed: get"),this.derivation=t.get,this.name=t.name||"ComputedValue@"+Iy(),t.set&&(this.setter=Vm(this.name,t.set)),this.equals=t.equals||(t.compareStructural||t.struct?em.structural:em.default),this.scope=t.context,this.requiresReaction=!!t.requiresReaction,this.keepAlive=!!t.keepAlive}return t.prototype.onBecomeStale=function(){!function(t){if(t.lowestObserverState!==Nm.UP_TO_DATE)return;t.lowestObserverState=Nm.POSSIBLY_STALE,t.observers.forEach((function(e){e.dependenciesState===Nm.UP_TO_DATE&&(e.dependenciesState=Nm.POSSIBLY_STALE,e.isTracing!==Tm.NONE&&db(e,t),e.onBecomeStale())}))}(this)},t.prototype.onBecomeObserved=function(){this.onBecomeObservedListeners&&this.onBecomeObservedListeners.forEach((function(t){return t()}))},t.prototype.onBecomeUnobserved=function(){this.onBecomeUnobservedListeners&&this.onBecomeUnobservedListeners.forEach((function(t){return t()}))},t.prototype.get=function(){this.isComputing&&jy("Cycle detected in computation "+this.name+": "+this.derivation),0!==ib.inBatch||0!==this.observers.size||this.keepAlive?(cb(this),Rm(this)&&this.trackAndCompute()&&function(t){if(t.lowestObserverState===Nm.STALE)return;t.lowestObserverState=Nm.STALE,t.observers.forEach((function(e){e.dependenciesState===Nm.POSSIBLY_STALE?e.dependenciesState=Nm.STALE:e.dependenciesState===Nm.UP_TO_DATE&&(t.lowestObserverState=Nm.UP_TO_DATE)}))}(this)):Rm(this)&&(this.warnAboutUntrackedRead(),lb(),this.value=this.computeValue(!1),ub());var t=this.value;if(km(t))throw t.cause;return t},t.prototype.peek=function(){var t=this.computeValue(!1);if(km(t))throw t.cause;return t},t.prototype.set=function(t){if(this.setter){By(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,t)}finally{this.isRunningSetter=!1}}else By(!1,!1)},t.prototype.trackAndCompute=function(){var t=this.value,e=this.dependenciesState===Nm.NOT_TRACKING,n=this.computeValue(!0),o=e||km(t)||km(n)||!this.equals(t,n);return o&&(this.value=n),o},t.prototype.computeValue=function(t){var e;if(this.isComputing=!0,ib.computationDepth++,t)e=Lm(this,this.derivation,this.scope);else if(!0===ib.disableErrorBoundaries)e=this.derivation.call(this.scope);else try{e=this.derivation.call(this.scope)}catch(t){e=new Pm(t)}return ib.computationDepth--,this.isComputing=!1,e},t.prototype.suspend=function(){this.keepAlive||(Im(this),this.value=void 0)},t.prototype.observe=function(t,e){var n=this,o=!0,i=void 0;return function(t,e){void 0===e&&(e=Ly);var n,o=e&&e.name||t.name||"Autorun@"+Iy();if(e.scheduler||e.delay){var i=function(t){return t.scheduler?t.scheduler:t.delay?function(e){return setTimeout(e,t.delay)}:Sb}(e),r=!1;n=new pb(o,(function(){r||(r=!0,i((function(){r=!1,n.isDisposed||n.track(a)})))}),e.onError,e.requiresObservable)}else n=new pb(o,(function(){this.track(a)}),e.onError,e.requiresObservable);function a(){t(n)}return n.schedule(),n.getDisposer()}((function(){var r=n.get();if(!o||e){var a=Bm();t({type:"update",object:n,newValue:r,oldValue:i}),Hm(a)}o=!1,i=r}))},t.prototype.warnAboutUntrackedRead=function(){},t.prototype.toJSON=function(){return this.get()},t.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},t.prototype.valueOf=function(){return Ky(this.get())},t.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},t}(),Jm=Uy("ComputedValue",$m),Qm=function(){this.version=5,this.UNCHANGED={},this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.allowStateReads=!0,this.enforceActions=!1,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.computedConfigurable=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1},tb={};function eb(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:tb}var nb=!0,ob=!1,ib=function(){var t=eb();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(nb=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new Qm).version&&(nb=!1),nb?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new Qm):(setTimeout((function(){ob||jy("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")}),1),new Qm)}();function rb(t,e){t.observers.add(e),t.lowestObserverState>e.dependenciesState&&(t.lowestObserverState=e.dependenciesState)}function ab(t,e){t.observers.delete(e),0===t.observers.size&&sb(t)}function sb(t){!1===t.isPendingUnobservation&&(t.isPendingUnobservation=!0,ib.pendingUnobservations.push(t))}function lb(){ib.inBatch++}function ub(){if(0==--ib.inBatch){vb();for(var t=ib.pendingUnobservations,e=0;e<t.length;e++){var n=t[e];n.isPendingUnobservation=!1,0===n.observers.size&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBecomeUnobserved()),n instanceof $m&&n.suspend())}ib.pendingUnobservations=[]}}function cb(t){var e=ib.trackingDerivation;return null!==e?(e.runId!==t.lastAccessedBy&&(t.lastAccessedBy=e.runId,e.newObserving[e.unboundDepsCount++]=t,t.isBeingObserved||(t.isBeingObserved=!0,t.onBecomeObserved())),!0):(0===t.observers.size&&ib.inBatch>0&&sb(t),!1)}function db(t,e){if(console.log("[mobx.trace] '"+t.name+"' is invalidated due to a change in: '"+e.name+"'"),t.isTracing===Tm.BREAK){var n=[];hb(function(t,e){return Ob(px(t,e))}(t),n,1),new Function("debugger;\n/*\nTracing '"+t.name+"'\n\nYou are entering this break point because derivation '"+t.name+"' is being traced and '"+e.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(t instanceof $m?t.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}}function hb(t,e,n){e.length>=1e3?e.push("(and many more)"):(e.push(""+new Array(n).join("\t")+t.name),t.dependencies&&t.dependencies.forEach((function(t){return hb(t,e,n+1)})))}var pb=function(){function t(t,e,n,o){void 0===t&&(t="Reaction@"+Iy()),void 0===o&&(o=!1),this.name=t,this.onInvalidate=e,this.errorHandler=n,this.requiresObservable=o,this.observing=[],this.newObserving=[],this.dependenciesState=Nm.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+Iy(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=Tm.NONE}return t.prototype.onBecomeStale=function(){this.schedule()},t.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,ib.pendingReactions.push(this),vb())},t.prototype.isScheduled=function(){return this._isScheduled},t.prototype.runReaction=function(){if(!this.isDisposed){if(lb(),this._isScheduled=!1,Rm(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending}catch(t){this.reportExceptionInDerivation(t)}}ub()}},t.prototype.track=function(t){if(!this.isDisposed){lb(),this._isRunning=!0;var e=Lm(this,t,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&Im(this),km(e)&&this.reportExceptionInDerivation(e.cause),ub()}},t.prototype.reportExceptionInDerivation=function(t){var e=this;if(this.errorHandler)this.errorHandler(t,this);else{if(ib.disableErrorBoundaries)throw t;var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";ib.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name+"' suppressed, fix error of causing action below)"):console.error(n,t),ib.globalReactionErrorHandlers.forEach((function(n){return n(t,e)}))}},t.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(lb(),Im(this),ub()))},t.prototype.getDisposer=function(){var t=this.dispose.bind(this);return t[$y]=this,t},t.prototype.toString=function(){return"Reaction["+this.name+"]"},t.prototype.trace=function(t){void 0===t&&(t=!1),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=!1;"boolean"==typeof t[t.length-1]&&(n=t.pop());var o=function(t){switch(t.length){case 0:return ib.trackingDerivation;case 1:return px(t[0]);case 2:return px(t[0],t[1])}}(t);if(!o)return jy(!1);o.isTracing===Tm.NONE&&console.log("[mobx.trace] '"+o.name+"' tracing enabled");o.isTracing=n?Tm.BREAK:Tm.LOG}(this,t)},t}(),fb=100,gb=function(t){return t()};function vb(){ib.inBatch>0||ib.isRunningReactions||gb(yb)}function yb(){ib.isRunningReactions=!0;for(var t=ib.pendingReactions,e=0;t.length>0;){++e===fb&&(console.error("Reaction doesn't converge to a stable state after "+fb+" iterations. Probably there is a cycle in the reactive function: "+t[0]),t.splice(0));for(var n=t.splice(0),o=0,i=n.length;o<i;o++)n[o].runReaction()}ib.isRunningReactions=!1}var mb=Uy("Reaction",pb);function bb(t){var e=gb;gb=function(n){return t((function(){return e(n)}))}}function xb(){jy(!1)}function _b(t){return function(e,n,o){if(o){if(o.value)return{value:Vm(0,o.value),enumerable:!1,configurable:!0,writable:!0};var i=o.initializer;return{enumerable:!1,configurable:!0,writable:!0,initializer:function(){return Vm(0,i.call(this))}}}return function(t){return function(e,n,o){Object.defineProperty(e,n,{configurable:!0,enumerable:!1,get:function(){},set:function(e){Gy(this,n,Eb(t,e))}})}}(t).apply(this,arguments)}}var Eb=function(t,e,n,o){return 1===arguments.length&&"function"==typeof t?Vm(t.name,t):2===arguments.length&&"function"==typeof e?Vm(0,e):1===arguments.length&&"string"==typeof t?_b(t):!0!==o?_b(e).apply(null,arguments):void Gy(t,e,Vm(t.name,n.value,this))};function wb(t,e,n){Gy(t,e,Vm(0,n.bind(t)))}Eb.bound=function(t,e,n,o){return!0===o?(wb(t,e,n.value),null):n?{configurable:!0,enumerable:!1,get:function(){return wb(this,e,n.value||n.initializer.call(this)),this[e]},set:xb}:{enumerable:!1,configurable:!0,set:function(t){wb(this,e,t)},get:function(){}}};var Sb=function(t){return t()};function Cb(t,e,n){return Nb("onBecomeUnobserved",t,e,n)}function Nb(t,e,n,o){var i="function"==typeof o?px(e,n):px(e),r="function"==typeof o?o:n,a=t+"Listeners";return i[a]?i[a].add(r):i[a]=new Set([r]),"function"!=typeof i[t]?jy(!1):function(){var t=i[a];t&&(t.delete(r),0===t.size&&delete i[a])}}function Tb(t,e,n,o){var i=Ab(o=ym(o));return dm(t),sx(t,o.name,i.enhancer),e&&Mb(t,e,n,i),t}function Ab(t){return t.defaultDecorator||(!1===t.deep?xm:mm)}function Mb(t,e,n,o){var i,r;lb();try{var a=Zy(e);try{for(var s=im(a),l=s.next();!l.done;l=s.next()){var u=l.value,c=Object.getOwnPropertyDescriptor(e,u);0;var d=n&&u in n?n[u]:c.get?Am:o;0;var h=d(t,u,c,!0);h&&Object.defineProperty(t,u,h)}}catch(t){i={error:t}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}}finally{ub()}}function Ob(t){var e,n,o={name:t.name};return t.observing&&t.observing.length>0&&(o.dependencies=(e=t.observing,n=[],e.forEach((function(t){-1===n.indexOf(t)&&n.push(t)})),n).map(Ob)),o}function Pb(t){return 1!==arguments.length&&jy(!1),function(t,e){return null!=t&&(void 0!==e?!!hx(t)&&t[$y].values.has(e):hx(t)||!!t[$y]||Qy(t)||mb(t)||Jm(t))}(t)}function kb(t,e,n){if(2!==arguments.length||rx(t))if(hx(t)){var o=t[$y];o.values.get(e)?o.write(e,n):o.addObservableProp(e,n,o.defaultEnhancer)}else if(nx(t))t.set(e,n);else if(rx(t))t.add(e);else{if(!Jb(t))return jy(!1);"number"!=typeof e&&(e=parseInt(e,10)),By(e>=0,"Not a valid index: '"+e+"'"),lb(),e>=t.length&&(t.length=e+1),t[e]=n,ub()}else{lb();var i=e;try{for(var r in i)kb(t,r,i[r])}finally{ub()}}}var Rb={detectCycles:!0,exportMapsAsObjects:!0,recurseEverything:!1};function Db(t,e,n,o){return o.detectCycles&&t.set(e,n),n}function Lb(t,e,n){if(!e.recurseEverything&&!Pb(t))return t;if("object"!=typeof t)return t;if(null===t)return null;if(t instanceof Date)return t;if(Zm(t))return Lb(t.get(),e,n);var o;if(Pb(t)&&(hx(o=t)?o[$y].getKeys():nx(o)||rx(o)?Array.from(o.keys()):Jb(o)?o.map((function(t,e){return e})):jy(!1)),!0===e.detectCycles&&null!==t&&n.has(t))return n.get(t);if(Jb(t)||Array.isArray(t)){var i=Db(n,t,[],e),r=t.map((function(t){return Lb(t,e,n)}));i.length=r.length;for(var a=0,s=r.length;a<s;a++)i[a]=r[a];return i}if(rx(t)||Object.getPrototypeOf(t)===Set.prototype){if(!1===e.exportMapsAsObjects){var l=Db(n,t,new Set,e);return t.forEach((function(t){l.add(Lb(t,e,n))})),l}var u=Db(n,t,[],e);return t.forEach((function(t){u.push(Lb(t,e,n))})),u}if(nx(t)||Object.getPrototypeOf(t)===Map.prototype){if(!1===e.exportMapsAsObjects){var c=Db(n,t,new Map,e);return t.forEach((function(t,o){c.set(o,Lb(t,e,n))})),c}var d=Db(n,t,{},e);return t.forEach((function(t,o){d[o]=Lb(t,e,n)})),d}var h=Db(n,t,{},e);return Yy(t).forEach((function(o){h[o]=Lb(t[o],e,n)})),h}function Ib(t,e){var n;return"boolean"==typeof e&&(e={detectCycles:e}),e||(e=Rb),e.detectCycles=void 0===e.detectCycles?!0===e.recurseEverything:!0===e.detectCycles,e.detectCycles&&(n=new Map),Lb(t,e,n)}function jb(t,e){void 0===e&&(e=void 0),lb();try{return t.apply(e)}finally{ub()}}function Bb(t){return t[$y]}function Hb(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t}var Fb={has:function(t,e){if(e===$y||"constructor"===e||e===sm)return!0;var n=Bb(t);return Hb(e)?n.has(e):e in t},get:function(t,e){if(e===$y||"constructor"===e||e===sm)return t[e];var n=Bb(t),o=n.values.get(e);if(o instanceof Jy){var i=o.get();return void 0===i&&n.has(e),i}return Hb(e)&&n.has(e),t[e]},set:function(t,e,n){return!!Hb(e)&&(kb(t,e,n),!0)},deleteProperty:function(t,e){return!!Hb(e)&&(Bb(t).remove(e),!0)},ownKeys:function(t){return Bb(t).keysAtom.reportObserved(),Reflect.ownKeys(t)},preventExtensions:function(t){return jy("Dynamic observable objects cannot be frozen"),!1}};function zb(t){return void 0!==t.interceptors&&t.interceptors.length>0}function Wb(t,e){var n=t.interceptors||(t.interceptors=[]);return n.push(e),Hy((function(){var t=n.indexOf(e);-1!==t&&n.splice(t,1)}))}function Gb(t,e){var n=Bm();try{for(var o=am(t.interceptors||[]),i=0,r=o.length;i<r&&(By(!(e=o[i](e))||e.type,"Intercept handlers should return nothing or a change object"),e);i++);return e}finally{Hm(n)}}function Ub(t){return void 0!==t.changeListeners&&t.changeListeners.length>0}function Xb(t,e){var n=t.changeListeners||(t.changeListeners=[]);return n.push(e),Hy((function(){var t=n.indexOf(e);-1!==t&&n.splice(t,1)}))}function Vb(t,e){var n=Bm(),o=t.changeListeners;if(o){for(var i=0,r=(o=o.slice()).length;i<r;i++)o[i](e);Hm(n)}}var Yb={get:function(t,e){return e===$y?t[$y]:"length"===e?t[$y].getArrayLength():"number"==typeof e?Kb.get.call(t,e):"string"!=typeof e||isNaN(e)?Kb.hasOwnProperty(e)?Kb[e]:t[e]:Kb.get.call(t,parseInt(e))},set:function(t,e,n){return"length"===e&&t[$y].setArrayLength(n),"number"==typeof e&&Kb.set.call(t,e,n),"symbol"==typeof e||isNaN(e)?t[e]=n:Kb.set.call(t,parseInt(e),n),!0},preventExtensions:function(t){return jy("Observable arrays cannot be frozen"),!1}};var qb=function(){function t(t,e,n){this.owned=n,this.values=[],this.proxy=void 0,this.lastKnownLength=0,this.atom=new Jy(t||"ObservableArray@"+Iy()),this.enhancer=function(n,o){return e(n,o,t+"[..]")}}return t.prototype.dehanceValue=function(t){return void 0!==this.dehancer?this.dehancer(t):t},t.prototype.dehanceValues=function(t){return void 0!==this.dehancer&&t.length>0?t.map(this.dehancer):t},t.prototype.intercept=function(t){return Wb(this,t)},t.prototype.observe=function(t,e){return void 0===e&&(e=!1),e&&t({object:this.proxy,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),Xb(this,t)},t.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},t.prototype.setArrayLength=function(t){if("number"!=typeof t||t<0)throw new Error("[mobx.array] Out of range: "+t);var e=this.values.length;if(t!==e)if(t>e){for(var n=new Array(t-e),o=0;o<t-e;o++)n[o]=void 0;this.spliceWithArray(e,0,n)}else this.spliceWithArray(t,e-t)},t.prototype.updateArrayLength=function(t,e){if(t!==this.lastKnownLength)throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed.");this.lastKnownLength+=e},t.prototype.spliceWithArray=function(t,e,n){var o=this;Dm(this.atom);var i=this.values.length;if(void 0===t?t=0:t>i?t=i:t<0&&(t=Math.max(0,i+t)),e=1===arguments.length?i-t:null==e?0:Math.max(0,Math.min(e,i-t)),void 0===n&&(n=Dy),zb(this)){var r=Gb(this,{object:this.proxy,type:"splice",index:t,removedCount:e,added:n});if(!r)return Dy;e=r.removedCount,n=r.added}n=0===n.length?n:n.map((function(t){return o.enhancer(t,void 0)}));var a=this.spliceItemsIntoValues(t,e,n);return 0===e&&0===n.length||this.notifyArraySplice(t,n,a),this.dehanceValues(a)},t.prototype.spliceItemsIntoValues=function(t,e,n){var o;if(n.length<1e4)return(o=this.values).splice.apply(o,am([t,e],n));var i=this.values.slice(t,t+e);return this.values=this.values.slice(0,t).concat(n,this.values.slice(t+e)),i},t.prototype.notifyArrayChildUpdate=function(t,e,n){var o=!this.owned&&!1,i=Ub(this),r=i||o?{object:this.proxy,type:"update",index:t,newValue:e,oldValue:n}:null;this.atom.reportChanged(),i&&Vb(this,r)},t.prototype.notifyArraySplice=function(t,e,n){var o=!this.owned&&!1,i=Ub(this),r=i||o?{object:this.proxy,type:"splice",index:t,removed:n,added:e,removedCount:n.length,addedCount:e.length}:null;this.atom.reportChanged(),i&&Vb(this,r)},t}(),Kb={intercept:function(t){return this[$y].intercept(t)},observe:function(t,e){return void 0===e&&(e=!1),this[$y].observe(t,e)},clear:function(){return this.splice(0)},replace:function(t){var e=this[$y];return e.spliceWithArray(0,e.values.length,t)},toJS:function(){return this.slice()},toJSON:function(){return this.toJS()},splice:function(t,e){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];var i=this[$y];switch(arguments.length){case 0:return[];case 1:return i.spliceWithArray(t);case 2:return i.spliceWithArray(t,e)}return i.spliceWithArray(t,e,n)},spliceWithArray:function(t,e,n){return this[$y].spliceWithArray(t,e,n)},push:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this[$y];return n.spliceWithArray(n.values.length,0,t),n.values.length},pop:function(){return this.splice(Math.max(this[$y].values.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this[$y];return n.spliceWithArray(0,0,t),n.values.length},reverse:function(){var t=this.slice();return t.reverse.apply(t,arguments)},sort:function(t){var e=this.slice();return e.sort.apply(e,arguments)},remove:function(t){var e=this[$y],n=e.dehanceValues(e.values).indexOf(t);return n>-1&&(this.splice(n,1),!0)},get:function(t){var e=this[$y];if(e){if(t<e.values.length)return e.atom.reportObserved(),e.dehanceValue(e.values[t]);console.warn("[mobx.array] Attempt to read an array index ("+t+") that is out of bounds ("+e.values.length+"). Please check length first. Out of bound indices will not be tracked by MobX")}},set:function(t,e){var n=this[$y],o=n.values;if(t<o.length){Dm(n.atom);var i=o[t];if(zb(n)){var r=Gb(n,{type:"update",object:n.proxy,index:t,newValue:e});if(!r)return;e=r.newValue}(e=n.enhancer(e,i))!==i&&(o[t]=e,n.notifyArrayChildUpdate(t,e,i))}else{if(t!==o.length)throw new Error("[mobx.array] Index out of bounds, "+t+" is larger than "+o.length);n.spliceWithArray(t,0,[e])}}};["concat","flat","includes","indexOf","join","lastIndexOf","slice","toString","toLocaleString"].forEach((function(t){"function"==typeof Array.prototype[t]&&(Kb[t]=function(){var e=this[$y];e.atom.reportObserved();var n=e.dehanceValues(e.values);return n[t].apply(n,arguments)})})),["every","filter","find","findIndex","flatMap","forEach","map","some"].forEach((function(t){"function"==typeof Array.prototype[t]&&(Kb[t]=function(e,n){var o=this,i=this[$y];return i.atom.reportObserved(),i.dehanceValues(i.values)[t]((function(t,i){return e.call(n,t,i,o)}),n)})})),["reduce","reduceRight"].forEach((function(t){Kb[t]=function(){var e=this,n=this[$y];n.atom.reportObserved();var o=arguments[0];return arguments[0]=function(t,i,r){return i=n.dehanceValue(i),o(t,i,r,e)},n.values[t].apply(n.values,arguments)}}));var Zb,$b=Uy("ObservableArrayAdministration",qb);function Jb(t){return zy(t)&&$b(t[$y])}var Qb,tx={},ex=function(){function t(t,e,n){if(void 0===e&&(e=pm),void 0===n&&(n="ObservableMap@"+Iy()),this.enhancer=e,this.name=n,this[Zb]=tx,this._keysAtom=tm(this.name+".keys()"),this[Symbol.toStringTag]="Map","function"!=typeof Map)throw new Error("mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js");this._data=new Map,this._hasMap=new Map,this.merge(t)}return t.prototype._has=function(t){return this._data.has(t)},t.prototype.has=function(t){var e=this;if(!ib.trackingDerivation)return this._has(t);var n=this._hasMap.get(t);if(!n){var o=n=new Km(this._has(t),fm,this.name+"."+qy(t)+"?",!1);this._hasMap.set(t,o),Cb(o,(function(){return e._hasMap.delete(t)}))}return n.get()},t.prototype.set=function(t,e){var n=this._has(t);if(zb(this)){var o=Gb(this,{type:n?"update":"add",object:this,newValue:e,name:t});if(!o)return this;e=o.newValue}return n?this._updateValue(t,e):this._addValue(t,e),this},t.prototype.delete=function(t){var e=this;if((Dm(this._keysAtom),zb(this))&&!(o=Gb(this,{type:"delete",object:this,name:t})))return!1;if(this._has(t)){var n=Ub(this),o=n?{type:"delete",object:this,oldValue:this._data.get(t).value,name:t}:null;return jb((function(){e._keysAtom.reportChanged(),e._updateHasMapEntry(t,!1),e._data.get(t).setNewValue(void 0),e._data.delete(t)})),n&&Vb(this,o),!0}return!1},t.prototype._updateHasMapEntry=function(t,e){var n=this._hasMap.get(t);n&&n.setNewValue(e)},t.prototype._updateValue=function(t,e){var n=this._data.get(t);if((e=n.prepareNewValue(e))!==ib.UNCHANGED){var o=!1,i=Ub(this),r=i?{type:"update",object:this,oldValue:n.value,name:t,newValue:e}:null;o,n.setNewValue(e),i&&Vb(this,r)}},t.prototype._addValue=function(t,e){var n=this;Dm(this._keysAtom),jb((function(){var o=new Km(e,n.enhancer,n.name+"."+qy(t),!1);n._data.set(t,o),e=o.value,n._updateHasMapEntry(t,!0),n._keysAtom.reportChanged()}));var o=Ub(this);o&&Vb(this,o?{type:"add",object:this,name:t,newValue:e}:null)},t.prototype.get=function(t){return this.has(t)?this.dehanceValue(this._data.get(t).get()):this.dehanceValue(void 0)},t.prototype.dehanceValue=function(t){return void 0!==this.dehancer?this.dehancer(t):t},t.prototype.keys=function(){return this._keysAtom.reportObserved(),this._data.keys()},t.prototype.values=function(){var t=this,e=this.keys();return xx({next:function(){var n=e.next(),o=n.done,i=n.value;return{done:o,value:o?void 0:t.get(i)}}})},t.prototype.entries=function(){var t=this,e=this.keys();return xx({next:function(){var n=e.next(),o=n.done,i=n.value;return{done:o,value:o?void 0:[i,t.get(i)]}}})},t.prototype[(Zb=$y,Symbol.iterator)]=function(){return this.entries()},t.prototype.forEach=function(t,e){var n,o;try{for(var i=im(this),r=i.next();!r.done;r=i.next()){var a=rm(r.value,2),s=a[0],l=a[1];t.call(e,l,s,this)}}catch(t){n={error:t}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},t.prototype.merge=function(t){var e=this;return nx(t)&&(t=t.toJS()),jb((function(){var n=Ym(!0);try{Wy(t)?Yy(t).forEach((function(n){return e.set(n,t[n])})):Array.isArray(t)?t.forEach((function(t){var n=rm(t,2),o=n[0],i=n[1];return e.set(o,i)})):Xy(t)?(t.constructor!==Map&&jy("Cannot initialize from classes that inherit from Map: "+t.constructor.name),t.forEach((function(t,n){return e.set(n,t)}))):null!=t&&jy("Cannot initialize map from "+t)}finally{qm(n)}})),this},t.prototype.clear=function(){var t=this;jb((function(){jm((function(){var e,n;try{for(var o=im(t.keys()),i=o.next();!i.done;i=o.next()){var r=i.value;t.delete(r)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}))}))},t.prototype.replace=function(t){var e=this;return jb((function(){var n,o,i,r,a=function(t){if(Xy(t)||nx(t))return t;if(Array.isArray(t))return new Map(t);if(Wy(t)){var e=new Map;for(var n in t)e.set(n,t[n]);return e}return jy("Cannot convert to map from '"+t+"'")}(t),s=new Map,l=!1;try{for(var u=im(e._data.keys()),c=u.next();!c.done;c=u.next()){var d=c.value;if(!a.has(d))if(e.delete(d))l=!0;else{var h=e._data.get(d);s.set(d,h)}}}catch(t){n={error:t}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}try{for(var p=im(a.entries()),f=p.next();!f.done;f=p.next()){var g=rm(f.value,2),v=(d=g[0],h=g[1],e._data.has(d));if(e.set(d,h),e._data.has(d)){var y=e._data.get(d);s.set(d,y),v||(l=!0)}}}catch(t){i={error:t}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(i)throw i.error}}if(!l)if(e._data.size!==s.size)e._keysAtom.reportChanged();else for(var m=e._data.keys(),b=s.keys(),x=m.next(),_=b.next();!x.done;){if(x.value!==_.value){e._keysAtom.reportChanged();break}x=m.next(),_=b.next()}e._data=s})),this},Object.defineProperty(t.prototype,"size",{get:function(){return this._keysAtom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),t.prototype.toPOJO=function(){var t,e,n={};try{for(var o=im(this),i=o.next();!i.done;i=o.next()){var r=rm(i.value,2),a=r[0],s=r[1];n["symbol"==typeof a?a:qy(a)]=s}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return n},t.prototype.toJS=function(){return new Map(this)},t.prototype.toJSON=function(){return this.toPOJO()},t.prototype.toString=function(){var t=this;return this.name+"[{ "+Array.from(this.keys()).map((function(e){return qy(e)+": "+t.get(e)})).join(", ")+" }]"},t.prototype.observe=function(t,e){return Xb(this,t)},t.prototype.intercept=function(t){return Wb(this,t)},t}(),nx=Uy("ObservableMap",ex),ox={},ix=function(){function t(t,e,n){if(void 0===e&&(e=pm),void 0===n&&(n="ObservableSet@"+Iy()),this.name=n,this[Qb]=ox,this._data=new Set,this._atom=tm(this.name),this[Symbol.toStringTag]="Set","function"!=typeof Set)throw new Error("mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js");this.enhancer=function(t,o){return e(t,o,n)},t&&this.replace(t)}return t.prototype.dehanceValue=function(t){return void 0!==this.dehancer?this.dehancer(t):t},t.prototype.clear=function(){var t=this;jb((function(){jm((function(){var e,n;try{for(var o=im(t._data.values()),i=o.next();!i.done;i=o.next()){var r=i.value;t.delete(r)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}))}))},t.prototype.forEach=function(t,e){var n,o;try{for(var i=im(this),r=i.next();!r.done;r=i.next()){var a=r.value;t.call(e,a,a,this)}}catch(t){n={error:t}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._atom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),t.prototype.add=function(t){var e=this;if((Dm(this._atom),zb(this))&&!(o=Gb(this,{type:"add",object:this,newValue:t})))return this;if(!this.has(t)){jb((function(){e._data.add(e.enhancer(t,void 0)),e._atom.reportChanged()}));var n=Ub(this),o=n?{type:"add",object:this,newValue:t}:null;n&&Vb(this,o)}return this},t.prototype.delete=function(t){var e=this;if(zb(this)&&!(o=Gb(this,{type:"delete",object:this,oldValue:t})))return!1;if(this.has(t)){var n=Ub(this),o=n?{type:"delete",object:this,oldValue:t}:null;return jb((function(){e._atom.reportChanged(),e._data.delete(t)})),n&&Vb(this,o),!0}return!1},t.prototype.has=function(t){return this._atom.reportObserved(),this._data.has(this.dehanceValue(t))},t.prototype.entries=function(){var t=0,e=Array.from(this.keys()),n=Array.from(this.values());return xx({next:function(){var o=t;return t+=1,o<n.length?{value:[e[o],n[o]],done:!1}:{done:!0}}})},t.prototype.keys=function(){return this.values()},t.prototype.values=function(){this._atom.reportObserved();var t=this,e=0,n=Array.from(this._data.values());return xx({next:function(){return e<n.length?{value:t.dehanceValue(n[e++]),done:!1}:{done:!0}}})},t.prototype.replace=function(t){var e=this;return rx(t)&&(t=t.toJS()),jb((function(){var n=Ym(!0);try{Array.isArray(t)||Vy(t)?(e.clear(),t.forEach((function(t){return e.add(t)}))):null!=t&&jy("Cannot initialize set from "+t)}finally{qm(n)}})),this},t.prototype.observe=function(t,e){return Xb(this,t)},t.prototype.intercept=function(t){return Wb(this,t)},t.prototype.toJS=function(){return new Set(this)},t.prototype.toString=function(){return this.name+"[ "+Array.from(this).join(", ")+" ]"},t.prototype[(Qb=$y,Symbol.iterator)]=function(){return this.values()},t}(),rx=Uy("ObservableSet",ix),ax=function(){function t(t,e,n,o){void 0===e&&(e=new Map),this.target=t,this.values=e,this.name=n,this.defaultEnhancer=o,this.keysAtom=new Jy(n+".keys")}return t.prototype.read=function(t){return this.values.get(t).get()},t.prototype.write=function(t,e){var n=this.target,o=this.values.get(t);if(o instanceof $m)o.set(e);else{if(zb(this)){if(!(a=Gb(this,{type:"update",object:this.proxy||n,name:t,newValue:e})))return;e=a.newValue}if((e=o.prepareNewValue(e))!==ib.UNCHANGED){var i=Ub(this),r=!1,a=i?{type:"update",object:this.proxy||n,oldValue:o.value,name:t,newValue:e}:null;r,o.setNewValue(e),i&&Vb(this,a)}}},t.prototype.has=function(t){var e=this.pendingKeys||(this.pendingKeys=new Map),n=e.get(t);if(n)return n.get();var o=!!this.values.get(t);return n=new Km(o,fm,this.name+"."+qy(t)+"?",!1),e.set(t,n),n.get()},t.prototype.addObservableProp=function(t,e,n){void 0===n&&(n=this.defaultEnhancer);var o=this.target;if(zb(this)){var i=Gb(this,{object:this.proxy||o,name:t,type:"add",newValue:e});if(!i)return;e=i.newValue}var r=new Km(e,n,this.name+"."+qy(t),!1);this.values.set(t,r),e=r.value,Object.defineProperty(o,t,function(t){return lx[t]||(lx[t]={configurable:!0,enumerable:!0,get:function(){return this[$y].read(t)},set:function(e){this[$y].write(t,e)}})}(t)),this.notifyPropertyAddition(t,e)},t.prototype.addComputedProp=function(t,e,n){var o=this.target;n.name=n.name||this.name+"."+qy(e),this.values.set(e,new $m(n)),(t===o||function(t,e){var n=Object.getOwnPropertyDescriptor(t,e);return!n||!1!==n.configurable&&!1!==n.writable}(t,e))&&Object.defineProperty(t,e,function(t){return ux[t]||(ux[t]={configurable:ib.computedConfigurable,enumerable:!1,get:function(){return cx(this).read(t)},set:function(e){cx(this).write(t,e)}})}(e))},t.prototype.remove=function(t){if(this.values.has(t)){var e=this.target;if(zb(this))if(!(s=Gb(this,{object:this.proxy||e,name:t,type:"remove"})))return;try{lb();var n=Ub(this),o=!1,i=this.values.get(t),r=i&&i.get();if(i&&i.set(void 0),this.keysAtom.reportChanged(),this.values.delete(t),this.pendingKeys){var a=this.pendingKeys.get(t);a&&a.set(!1)}delete this.target[t];var s=n?{type:"remove",object:this.proxy||e,oldValue:r,name:t}:null;o,n&&Vb(this,s)}finally{ub()}}},t.prototype.illegalAccess=function(t,e){console.warn("Property '"+e+"' of '"+t+"' was accessed through the prototype chain. Use 'decorate' instead to declare the prop or access it statically through it's owner")},t.prototype.observe=function(t,e){return Xb(this,t)},t.prototype.intercept=function(t){return Wb(this,t)},t.prototype.notifyPropertyAddition=function(t,e){var n=Ub(this),o=n?{type:"add",object:this.proxy||this.target,name:t,newValue:e}:null;if(n&&Vb(this,o),this.pendingKeys){var i=this.pendingKeys.get(t);i&&i.set(!0)}this.keysAtom.reportChanged()},t.prototype.getKeys=function(){var t,e;this.keysAtom.reportObserved();var n=[];try{for(var o=im(this.values),i=o.next();!i.done;i=o.next()){var r=rm(i.value,2),a=r[0];r[1]instanceof Km&&n.push(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return n},t}();function sx(t,e,n){if(void 0===e&&(e=""),void 0===n&&(n=pm),Object.prototype.hasOwnProperty.call(t,$y))return t[$y];Wy(t)||(e=(t.constructor.name||"ObservableObject")+"@"+Iy()),e||(e="ObservableObject@"+Iy());var o=new ax(t,new Map,qy(e),n);return Gy(t,$y,o),o}var lx=Object.create(null),ux=Object.create(null);function cx(t){var e=t[$y];return e||(dm(t),t[$y])}var dx=Uy("ObservableObjectAdministration",ax);function hx(t){return!!zy(t)&&(dm(t),dx(t[$y]))}function px(t,e){if("object"==typeof t&&null!==t){if(Jb(t))return void 0!==e&&jy(!1),t[$y].atom;if(rx(t))return t[$y];if(nx(t)){var n=t;return void 0===e?n._keysAtom:((o=n._data.get(e)||n._hasMap.get(e))||jy(!1),o)}var o;if(dm(t),e&&!t[$y]&&t[e],hx(t))return e?((o=t[$y].values.get(e))||jy(!1),o):jy(!1);if(Qy(t)||Jm(t)||mb(t))return t}else if("function"==typeof t&&mb(t[$y]))return t[$y];return jy(!1)}function fx(t,e){return t||jy("Expecting some object"),void 0!==e?fx(px(t,e)):Qy(t)||Jm(t)||mb(t)||nx(t)||rx(t)?t:(dm(t),t[$y]?t[$y]:void jy(!1))}var gx=Object.prototype.toString;function vx(t,e,n){return void 0===n&&(n=-1),yx(t,e,n)}function yx(t,e,n,o,i){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return!1;if(t!=t)return e!=e;var r=typeof t;if("function"!==r&&"object"!==r&&"object"!=typeof e)return!1;var a=gx.call(t);if(a!==gx.call(e))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!=+t?+e!=+e:0==+t?1/+t==1/e:+t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(t)===Symbol.valueOf.call(e);case"[object Map]":case"[object Set]":n>=0&&n++}t=mx(t),e=mx(e);var s="[object Array]"===a;if(!s){if("object"!=typeof t||"object"!=typeof e)return!1;var l=t.constructor,u=e.constructor;if(l!==u&&!("function"==typeof l&&l instanceof l&&"function"==typeof u&&u instanceof u)&&"constructor"in t&&"constructor"in e)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(o=o||[]).length;c--;)if(o[c]===t)return i[c]===e;if(o.push(t),i.push(e),s){if((c=t.length)!==e.length)return!1;for(;c--;)if(!yx(t[c],e[c],n-1,o,i))return!1}else{var d=Object.keys(t),h=void 0;if(c=d.length,Object.keys(e).length!==c)return!1;for(;c--;)if(!bx(e,h=d[c])||!yx(t[h],e[h],n-1,o,i))return!1}return o.pop(),i.pop(),!0}function mx(t){return Jb(t)?t.slice():Xy(t)||nx(t)||Vy(t)||rx(t)?Array.from(t.entries()):t}function bx(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function xx(t){return t[Symbol.iterator]=_x,t}function _x(){return this}if("undefined"==typeof Proxy||"undefined"==typeof Symbol)throw new Error("[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore.");"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(t){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:function(t,e){return(void 0!==e?px(t,e):hx(t)||nx(t)||rx(t)?fx(t):px(t)).name}},$mobx:$y});var Ex=function(){return Ex=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ex.apply(this,arguments)},wx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},Sx=function(){function t(t,e){var n;this.BaseType=_y.EDGE,this.id="",this.type="",this.sourceNodeId="",this.targetNodeId="",this.textMode=Ny.TEXT,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this.points="",this.pointsList=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.isAnimation=!1,this.isShowAdjustPoint=!1,this.zIndex=0,this.state=xy.DEFAULT,this.modelType=Ey.EDGE,this.customTextPosition=!1,this.style={},this.arrowConfig={markerEnd:"url(#marker-end-".concat(this.id,")"),markerStart:"url(#marker-start-".concat(this.id,")")},this.graphModel=e,this.properties=null!==(n=t.properties)&&void 0!==n?n:{},this.initEdgeData(t),this.setAttributes()}return t.prototype.initEdgeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,n=e&&e(t.type),o=this.createId();t.id=o||n||JE()}this.arrowConfig.markerEnd="url(#marker-end-".concat(t.id,")"),this.arrowConfig.markerStart="url(#marker-start-".concat(t.id,")");var i=this.graphModel.editConfigModel.adjustEdgeStartAndEnd;this.isShowAdjustPoint=i,li(this,tE(t)),this.graphModel.overlapMode===Sy.INCREASE&&(this.zIndex=t.zIndex||iw()),this.setAnchors(),this.initPoints(),this.formatText(t)},t.prototype.setAttributes=function(){},t.prototype.createId=function(){return null},t.prototype.getEdgeStyle=function(){return Ex(Ex({},this.graphModel.theme.baseEdge),this.style)},t.prototype.getAdjustPointStyle=function(){return Ex({},this.graphModel.theme.edgeAdjust)},t.prototype.getTextStyle=function(){return Is(this.graphModel.theme.edgeText)},t.prototype.getEdgeAnimationStyle=function(){return Is(this.graphModel.theme.edgeAnimation)},t.prototype.getArrowStyle=function(){var t=this.getEdgeStyle(),e=this.getEdgeAnimationStyle(),n=this.graphModel.theme.arrow,o=this.isAnimation?e.stroke:t.stroke;return Ex(Ex(Ex({},t),{fill:o,stroke:o}),n)},t.prototype.getOutlineStyle=function(){return Is(this.graphModel.theme.outline)},t.prototype.getTextPosition=function(){return{x:0,y:0}},Object.defineProperty(t.prototype,"sourceNode",{get:function(){var t,e;return null===(e=null===(t=this.graphModel)||void 0===t?void 0:t.nodesMap[this.sourceNodeId])||void 0===e?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"targetNode",{get:function(){var t,e;return null===(e=null===(t=this.graphModel)||void 0===t?void 0:t.nodesMap[this.targetNodeId])||void 0===e?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textPosition",{get:function(){return this.getTextPosition()},enumerable:!1,configurable:!0}),t.prototype.getBeginAnchor=function(t,e,n){var o,i,r=xE(t);if(n){if(o=Uu(r,(function(t){return t.id===n})))return o;console.warn("未在节点上找到指定的起点锚点".concat(n,",已使用默认锚点作为起点"))}return r.forEach((function(t){var n=eE(t,e);(void 0===i||n<i)&&(i=n,o=t)})),o},t.prototype.getEndAnchor=function(t,e){var n,o,i=this,r=xE(t);if(e){if(n=Uu(r,(function(t){return t.id===e})))return n;console.warn("未在节点上找到指定的终点锚点".concat(e,",已使用默认锚点作为终点"))}return r.forEach((function(t){if(i.startPoint){var e=eE(t,i.startPoint);(void 0===o||e<o)&&(o=e,n=t)}})),n},t.prototype.getProperties=function(){return Ib(this.properties)},t.prototype.getData=function(){var t=this.properties;Pb(t)&&(t=Ib(t));var e={id:this.id,type:this.type,properties:t,sourceNodeId:this.sourceNode.id,targetNodeId:this.targetNode.id,startPoint:li({},this.startPoint),endPoint:li({},this.endPoint)};this.graphModel.overlapMode===Sy.INCREASE&&(e.zIndex=this.zIndex);var n=this.text,o=n.x,i=n.y,r=n.value;return r&&(e.text={x:o,y:i,value:r}),e},t.prototype.getHistoryData=function(){return this.getData()},t.prototype.setProperty=function(t,e){var n,o=Ib(this.properties);this.properties=Ex(Ex({},o),((n={})[t]=Oy(e),n)),this.setAttributes()},t.prototype.deleteProperty=function(t){delete this.properties[t],this.setAttributes()},t.prototype.setProperties=function(t){this.properties=Ex(Ex({},Ib(this.properties)),Oy(t)),this.setAttributes()},t.prototype.changeEdgeId=function(t){var e=this.arrowConfig,n=e.markerEnd,o=e.markerStart;o&&o==="url(#marker-start-".concat(this.id,")")&&(this.arrowConfig.markerStart="url(#marker-start-".concat(t,")")),n&&n==="url(#marker-end-".concat(this.id,")")&&(this.arrowConfig.markerEnd="url(#marker-end-".concat(t,")")),this.id=t},t.prototype.setStyle=function(t,e){var n;this.style=Ex(Ex({},this.style),((n={})[t]=Oy(e),n))},t.prototype.setStyles=function(t){this.style=Ex(Ex({},this.style),Oy(t))},t.prototype.updateStyles=function(t){this.style=Ex({},Oy(t))},t.prototype.setTextMode=function(t){this.textMode=t},t.prototype.formatText=function(t){var e,n,o,i=this.textPosition,r=i.x,a=i.y,s=t.text,l={value:"",x:r,y:a,draggable:!1,editable:!0};s&&("string"==typeof s?l=Ex(Ex({},l),{value:s}):(l=Ex(Ex({},l),{x:null!==(e=s.x)&&void 0!==e?e:r,y:null!==(n=s.y)&&void 0!==n?n:a,value:null!==(o=s.value)&&void 0!==o?o:""}),nd(s.draggable)||(l.draggable=s.draggable),nd(s.editable)||(l.editable=s.editable))),this.text=l},t.prototype.resetTextPosition=function(){var t=this.textPosition,e=t.x,n=t.y;this.text.x=e,this.text.y=n},t.prototype.moveText=function(t,e){var n=this.text,o=n.x,i=n.y,r=n.value,a=n.draggable,s=n.editable;this.text={value:r,editable:s,draggable:a,x:o+t,y:i+e}},t.prototype.setText=function(t){t&&li(this.text,t)},t.prototype.updateText=function(t){this.text=Ex(Ex({},Ib(this.text)),{value:t})},t.prototype.setAnchors=function(){if(!this.sourceAnchorId||!this.startPoint){if(!(t=this.getBeginAnchor(this.sourceNode,this.targetNode,this.sourceAnchorId)))throw new Error("无法获取beginAnchor,请检查anchors相关逻辑,anchors不能为空");this.startPoint||(this.startPoint={x:t.x,y:t.y}),this.sourceAnchorId||(this.sourceAnchorId=t.id)}if(!this.targetAnchorId||!this.endPoint){var t;if(!(t=this.getEndAnchor(this.targetNode,this.targetAnchorId)))throw new Error("无法获取endAnchor,请检查anchors相关逻辑,anchors不能为空");this.endPoint||(this.endPoint={x:t.x,y:t.y}),this.targetAnchorId||(this.targetAnchorId=t.id)}},t.prototype.setSelected=function(t){void 0===t&&(t=!0),this.isSelected=t},t.prototype.setHovered=function(t){void 0===t&&(t=!0),this.isHovered=t},t.prototype.setHitable=function(t){void 0===t&&(t=!0),this.isHitable=t},t.prototype.setHittable=function(t){void 0===t&&(t=!0),this.isHittable=t},t.prototype.openEdgeAnimation=function(){this.isAnimation=!0},t.prototype.closeEdgeAnimation=function(){this.isAnimation=!1},t.prototype.setElementState=function(t,e){this.state=t,this.additionStateData=e},t.prototype.updateStartPoint=function(t){this.startPoint=t},t.prototype.moveStartPoint=function(t,e){this.startPoint&&(this.startPoint.x+=t,this.startPoint.y+=e)},t.prototype.updateEndPoint=function(t){this.endPoint=t},t.prototype.moveEndPoint=function(t,e){this.endPoint&&(this.endPoint.x+=t,this.endPoint.y+=e)},t.prototype.setZIndex=function(t){void 0===t&&(t=0),this.zIndex=t},t.prototype.initPoints=function(){},t.prototype.updateAttributes=function(t){li(this,t)},t.prototype.getAdjustStart=function(){return this.startPoint},t.prototype.getAdjustEnd=function(){return this.endPoint},t.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,n=t.endPoint;this.updateStartPoint({x:e.x,y:e.y}),this.updateEndPoint({x:n.x,y:n.y})},t.BaseType=_y.EDGE,wx([Sm],t.prototype,"type",void 0),wx([Sm],t.prototype,"sourceNodeId",void 0),wx([Sm],t.prototype,"targetNodeId",void 0),wx([Sm],t.prototype,"startPoint",void 0),wx([Sm],t.prototype,"endPoint",void 0),wx([Sm],t.prototype,"textMode",void 0),wx([Sm],t.prototype,"text",void 0),wx([Sm],t.prototype,"properties",void 0),wx([Sm],t.prototype,"points",void 0),wx([Sm],t.prototype,"pointsList",void 0),wx([Sm],t.prototype,"isSelected",void 0),wx([Sm],t.prototype,"isHovered",void 0),wx([Sm],t.prototype,"isHitable",void 0),wx([Sm],t.prototype,"isHittable",void 0),wx([Sm],t.prototype,"draggable",void 0),wx([Sm],t.prototype,"visible",void 0),wx([Sm],t.prototype,"isAnimation",void 0),wx([Sm],t.prototype,"isShowAdjustPoint",void 0),wx([Sm],t.prototype,"zIndex",void 0),wx([Sm],t.prototype,"state",void 0),wx([Sm],t.prototype,"style",void 0),wx([Sm],t.prototype,"arrowConfig",void 0),wx([Om],t.prototype,"sourceNode",null),wx([Om],t.prototype,"targetNode",null),wx([Om],t.prototype,"textPosition",null),wx([Eb],t.prototype,"setProperty",null),wx([Eb],t.prototype,"deleteProperty",null),wx([Eb],t.prototype,"setProperties",null),wx([Eb],t.prototype,"changeEdgeId",null),wx([Eb],t.prototype,"setStyle",null),wx([Eb],t.prototype,"setStyles",null),wx([Eb],t.prototype,"updateStyles",null),wx([Eb],t.prototype,"setTextMode",null),wx([Eb],t.prototype,"formatText",null),wx([Eb],t.prototype,"resetTextPosition",null),wx([Eb],t.prototype,"moveText",null),wx([Eb],t.prototype,"setText",null),wx([Eb],t.prototype,"updateText",null),wx([Eb],t.prototype,"setAnchors",null),wx([Eb],t.prototype,"setSelected",null),wx([Eb],t.prototype,"setHovered",null),wx([Eb],t.prototype,"setHitable",null),wx([Eb],t.prototype,"setHittable",null),wx([Eb],t.prototype,"openEdgeAnimation",null),wx([Eb],t.prototype,"closeEdgeAnimation",null),wx([Eb],t.prototype,"setElementState",null),wx([Eb],t.prototype,"updateStartPoint",null),wx([Eb],t.prototype,"moveStartPoint",null),wx([Eb],t.prototype,"updateEndPoint",null),wx([Eb],t.prototype,"moveEndPoint",null),wx([Eb],t.prototype,"setZIndex",null),wx([Eb],t.prototype,"initPoints",null),wx([Eb],t.prototype,"updateAttributes",null),wx([Eb],t.prototype,"getAdjustStart",null),wx([Eb],t.prototype,"getAdjustEnd",null),wx([Eb],t.prototype,"updateAfterAdjustStartAndEnd",null),t}(),Cx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Nx=function(){return Nx=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Nx.apply(this,arguments)},Tx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},Ax=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a};!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.BEZIER_EDGE,o.path="",o.initEdgeData(e),o.setAttributes(),o}Cx(e,t),e.prototype.initEdgeData=function(e){this.offset=100,t.prototype.initEdgeData.call(this,e)},e.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.bezier,n=t.prototype.getEdgeStyle.call(this),o=this.properties.style,i=void 0===o?{}:o;return Nx(Nx(Nx({},n),Is(e)),Is(i))},e.prototype.getTextPosition=function(){if(this.pointsList&&this.pointsList.length>0){var t=0,e=0;return this.pointsList.forEach((function(n){var o=n.x,i=n.y;t+=o,e+=i})),{x:t/this.pointsList.length,y:e/this.pointsList.length}}return{x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2}},e.prototype.getData=function(){var e=t.prototype.getData.call(this),n=this.pointsList.map((function(t){return{x:t.x,y:t.y}}));return Nx(Nx({},e),{pointsList:n})},e.prototype.getControls=function(){var t=this.startPoint,e=this.endPoint;return J_({start:t,end:e,sourceNode:this.sourceNode,targetNode:this.targetNode,offset:this.offset})},e.prototype.getPath=function(t){var e=Ax(t,4),n=e[0],o=e[1],i=e[2],r=e[3];return"M ".concat(n.x," ").concat(n.y,"\n C ").concat(o.x," ").concat(o.y,",\n ").concat(i.x," ").concat(i.y,",\n ").concat(r.x," ").concat(r.y)},e.prototype.initPoints=function(){this.pointsList.length>0?this.path=this.getPath(this.pointsList):this.updatePoints()},e.prototype.updatePoints=function(){var t=this.getControls(),e=t.sNext,n=t.ePre;this.updatePath(e,n)},e.prototype.updatePath=function(t,e){t=Is(t),e=Is(e);var n={x:this.startPoint.x,y:this.startPoint.y},o={x:this.endPoint.x,y:this.endPoint.y};if(!t||!e){var i=this.getControls();t=i.sNext,e=i.ePre}this.pointsList=[n,t,e,o],this.path=this.getPath(this.pointsList)},e.prototype.updateStartPoint=function(t){this.startPoint=Object.assign({},t),this.updatePoints()},e.prototype.updateEndPoint=function(t){this.endPoint=Object.assign({},t),this.updatePoints()},e.prototype.moveStartPoint=function(t,e){this.startPoint.x+=t,this.startPoint.y+=e;var n=Ax(this.pointsList,3),o=n[1],i=n[2];o.x+=t,o.y+=e,this.updatePath(o,i)},e.prototype.moveEndPoint=function(t,e){this.endPoint.x+=t,this.endPoint.y+=e;var n=Ax(this.pointsList,3),o=n[1],i=n[2];i.x+=t,i.y+=e,this.updatePath(o,i)},e.prototype.updateAdjustAnchor=function(t,e){var n;"sNext"===e?this.pointsList[1]=t:"ePre"===e&&(this.pointsList[2]=t),this.path=this.getPath(this.pointsList),(null===(n=this.text)||void 0===n?void 0:n.value)&&this.setText(li({},this.text,this.textPosition))},e.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},e.prototype.getAdjustEnd=function(){var t=this.pointsList;return t[t.length-1]||this.endPoint},e.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,n=t.endPoint,o=t.sourceNode,i=t.targetNode,r=J_({start:e,end:n,sourceNode:o,targetNode:i,offset:this.offset}),a=r.sNext,s=r.ePre;this.pointsList=[e,a,s,n],this.initPoints()},Tx([Sm],e.prototype,"path",void 0),Tx([Eb],e.prototype,"initPoints",null),Tx([Eb],e.prototype,"updatePoints",null),Tx([Eb],e.prototype,"updateStartPoint",null),Tx([Eb],e.prototype,"updateEndPoint",null),Tx([Eb],e.prototype,"moveStartPoint",null),Tx([Eb],e.prototype,"moveEndPoint",null),Tx([Eb],e.prototype,"updateAdjustAnchor",null),Tx([Eb],e.prototype,"getAdjustStart",null),Tx([Eb],e.prototype,"getAdjustEnd",null),Tx([Eb],e.prototype,"updateAfterAdjustStartAndEnd",null)}(Sx);var Mx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ox=function(){return Ox=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ox.apply(this,arguments)},Px=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},kx=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))};!function(t){function e(){var e=t.apply(this,kx([],Px(arguments),!1))||this;return e.modelType=Ey.LINE_EDGE,e}Mx(e,t),e.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.line,n=t.prototype.getEdgeStyle.call(this),o=this.properties.style,i=void 0===o?{}:o;return Ox(Ox(Ox({},n),Is(e)),Is(i))},e.prototype.getTextPosition=function(){return{x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2}}}(Sx);var Rx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Dx=function(){return Dx=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Dx.apply(this,arguments)},Lx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},Ix=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},jx=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))};!function(t){function e(){var e=t.apply(this,jx([],Ix(arguments),!1))||this;return e.modelType=Ey.POLYLINE_EDGE,e.draggingPointList=[],e}Rx(e,t),e.prototype.initEdgeData=function(e){this.offset=30,t.prototype.initEdgeData.call(this,e)},e.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.polyline,n=t.prototype.getEdgeStyle.call(this),o=this.properties.style,i=void 0===o?{}:o;return Dx(Dx(Dx({},n),Is(e)),Is(i))},e.prototype.getTextPosition=function(){var t,e=null===(t=this.text)||void 0===t?void 0:t.value;if(this.dbClickPosition&&!e){var n=this.dbClickPosition;return{x:n.x,y:n.y}}var o=K_(this.points),i=Ix(U_(o),2),r=i[0],a=i[1];return{x:(r.x+a.x)/2,y:(r.y+a.y)/2}},e.prototype.getAfterAnchor=function(t,e,n){var o,i;return n.forEach((function(n){var r;t===Cy.HORIZONTAL?r=Math.abs(e.y-n.y):t===Cy.VERTICAL&&(r=Math.abs(e.x-n.x)),(!i||i>r)&&(i=r,o=n)})),o},e.prototype.getCrossPoint=function(t,e,n){var o;return t===Cy.HORIZONTAL?o={x:n.x,y:e.y}:t===Cy.VERTICAL&&(o={x:e.x,y:n.y}),o},e.prototype.removeCrossPoints=function(t,e,n){var o=n.map((function(t){return t}));if(1===t){var i=o[t],r=o[e],a=o[t-1];if(X_(a,i,this.sourceNode)){if(V_(i,r,this.sourceNode))(s=Y_(i,r,this.sourceNode))&&(o[t]=s,o.splice(t-1,1),t--,e--)}else this.sourceNode.anchors.forEach((function(e){(e.x===a.x&&e.x===i.x||e.y===a.y&&e.y===i.y)&&(EE(e.x,e.y,i.x,i.y)<EE(a.x,a.y,i.x,i.y)&&(o[t-1]=e))}))}if(e===n.length-2){var s,l=o[t],u=o[e],c=o[e+1];if(X_(u,c,this.targetNode)){if(V_(l,u,this.targetNode))(s=Y_(l,u,this.targetNode))&&(o[e]=s,o.splice(e+1,1))}else this.targetNode.anchors.forEach((function(t){(t.x===c.x&&t.x===u.x||t.y===c.y&&t.y===u.y)&&(EE(t.x,t.y,u.x,u.y)<EE(c.x,c.y,u.x,u.y)&&(o[e+1]=t))}))}return o},e.prototype.getDraggingPoints=function(t,e,n,o,i){var r=i.map((function(t){return t})),a=this.getAfterAnchor(t,n,o),s=this.getCrossPoint(t,n,a);return"start"===e?(r.unshift(s),r.unshift(a)):(r.push(s),r.push(a)),r},e.prototype.updateCrossPoints=function(t){var e=t.map((function(t){return t})),n=t[0],o=t[1],i=t[e.length-2],r=t[e.length-1],a=this.sourceNode,s=this.targetNode,l=a.modelType,u=s.modelType,c=q_(n,o),d=e[0];switch(l){case Ey.RECT_NODE:if(0!==a.radius)TE(n,a)||(d=CE(n,c,a));break;case Ey.CIRCLE_NODE:d=NE(n,c,a);break;case Ey.ELLIPSE_NODE:d=AE(n,c,a);break;case Ey.DIAMOND_NODE:case Ey.POLYGON_NODE:d=ME(n,c,a)}d&&(e[0]=d);var h=q_(i,r),p=e[e.length-1];switch(u){case Ey.RECT_NODE:if(0!==s.radius)TE(r,s)||(p=CE(r,h,s));break;case Ey.CIRCLE_NODE:p=NE(r,h,s);break;case Ey.ELLIPSE_NODE:p=AE(r,h,s);break;case Ey.DIAMOND_NODE:case Ey.POLYGON_NODE:p=ME(r,h,s)}return p&&(e[e.length-1]=p),e},e.prototype.getData=function(){var e=t.prototype.getData.call(this),n=this.pointsList.map((function(t){return{x:t.x,y:t.y}}));return Object.assign({},e,{pointsList:n})},e.prototype.initPoints=function(){this.pointsList.length>0?this.points=this.pointsList.map((function(t){return"".concat(t.x,",").concat(t.y)})).join(" "):this.updatePoints()},e.prototype.updatePoints=function(){var t=G_({x:this.startPoint.x,y:this.startPoint.y},{x:this.endPoint.x,y:this.endPoint.y},this.sourceNode,this.targetNode,this.offset||0);this.pointsList=t,this.points=t.map((function(t){return"".concat(t.x,",").concat(t.y)})).join(" ")},e.prototype.updateStartPoint=function(t){this.startPoint=Object.assign({},t),this.updatePoints()},e.prototype.moveStartPoint=function(t,e){this.startPoint.x+=t,this.startPoint.y+=e,this.updatePoints()},e.prototype.updateEndPoint=function(t){this.endPoint=Object.assign({},t),this.updatePoints()},e.prototype.moveEndPoint=function(t,e){this.endPoint.x+=t,this.endPoint.y+=e,this.updatePoints()},e.prototype.updatePointsList=function(t,e){this.pointsList.forEach((function(n){n.x+=t,n.y+=e}));var n=this.pointsList[0];this.startPoint=Object.assign({},n);var o=this.pointsList[this.pointsList.length-1];this.endPoint=Object.assign({},o),this.initPoints()},e.prototype.dragAppendStart=function(){this.draggingPointList=this.pointsList.map((function(t){return t}))},e.prototype.dragAppendSimple=function(t,e){var n;this.isDragging=!0;var o=t.start,i=t.end,r=t.startIndex,a=t.endIndex,s=t.direction,l=this.pointsList,u=l;return s===Cy.HORIZONTAL?(l[r]={x:o.x,y:o.y+e.y},l[a]={x:i.x,y:i.y+e.y},u=this.pointsList.map((function(t){return t}))):s===Cy.VERTICAL&&(l[r]={x:o.x+e.x,y:o.y},l[a]={x:i.x+e.x,y:i.y},u=this.pointsList.map((function(t){return t}))),this.updatePointsAfterDrag(u),this.draggingPointList=u,(null===(n=this.text)||void 0===n?void 0:n.value)&&this.setText(li({},this.text,this.textPosition)),{start:li({},l[r]),end:li({},l[a]),startIndex:r,endIndex:a,direction:s}},e.prototype.dragAppend=function(t,e){var n;this.isDragging=!0;var o=t.start,i=t.end,r=t.startIndex,a=t.endIndex,s=t.direction,l=this.pointsList;if(s===Cy.HORIZONTAL){l[r]={x:o.x,y:o.y+e.y},l[a]={x:i.x,y:i.y+e.y};var u=this.pointsList.map((function(t){return t}));if(0!==r&&a!==this.pointsList.length-1&&(u=this.removeCrossPoints(r,a,u)),0===r){var c={x:o.x,y:o.y+e.y};if(!wE(c,this.sourceNode)){var d=this.sourceNode.anchors;u=this.getDraggingPoints(s,"start",c,d,u)}}if(a===this.pointsList.length-1){var h={x:i.x,y:i.y+e.y};if(!wE(h,this.targetNode)){d=this.targetNode.anchors;u=this.getDraggingPoints(s,"end",h,d,u)}}this.updatePointsAfterDrag(u),this.draggingPointList=u}else if(s===Cy.VERTICAL){l[r]={x:o.x+e.x,y:o.y},l[a]={x:i.x+e.x,y:i.y};u=this.pointsList.map((function(t){return t}));if(0!==r&&a!==this.pointsList.length-1&&(u=this.removeCrossPoints(r,a,u)),0===r){c={x:o.x+e.x,y:o.y};if(!wE(c,this.sourceNode)){d=this.sourceNode.anchors;u=this.getDraggingPoints(s,"start",c,d,u)}}if(a===this.pointsList.length-1){h={x:i.x+e.x,y:i.y};if(!wE(h,this.targetNode)){d=this.targetNode.anchors;u=this.getDraggingPoints(s,"end",h,d,u)}}this.updatePointsAfterDrag(u),this.draggingPointList=u}return(null===(n=this.text)||void 0===n?void 0:n.value)&&this.setText(li({},this.text,this.textPosition)),{start:li({},l[r]),end:li({},l[a]),startIndex:r,endIndex:a,direction:s}},e.prototype.dragAppendEnd=function(){if(this.draggingPointList){var t=W_(K_(this.points));this.pointsList=t.map((function(t){return t})),this.draggingPointList=[];var e=t[0];this.startPoint=li({},e);var n=t[t.length-1];this.endPoint=li({},n)}this.isDragging=!1},e.prototype.updatePointsAfterDrag=function(t){var e=this.updateCrossPoints(t);this.points=e.map((function(t){return"".concat(t.x,",").concat(t.y)})).join(" ")},e.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},e.prototype.getAdjustEnd=function(){var t=this.pointsList;return t[t.length-1]||this.endPoint},e.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,n=t.endPoint,o=t.sourceNode,i=t.targetNode;this.pointsList=G_({x:e.x,y:e.y},{x:n.x,y:n.y},o,i,this.offset||0),this.initPoints()},Lx([Sm],e.prototype,"dbClickPosition",void 0),Lx([Eb],e.prototype,"initPoints",null),Lx([Eb],e.prototype,"updatePoints",null),Lx([Eb],e.prototype,"updateStartPoint",null),Lx([Eb],e.prototype,"moveStartPoint",null),Lx([Eb],e.prototype,"updateEndPoint",null),Lx([Eb],e.prototype,"moveEndPoint",null),Lx([Eb],e.prototype,"updatePointsList",null),Lx([Eb],e.prototype,"dragAppendStart",null),Lx([Eb],e.prototype,"dragAppendSimple",null),Lx([Eb],e.prototype,"dragAppend",null),Lx([Eb],e.prototype,"dragAppendEnd",null),Lx([Eb],e.prototype,"updatePointsAfterDrag",null),Lx([Eb],e.prototype,"getAdjustStart",null),Lx([Eb],e.prototype,"getAdjustEnd",null),Lx([Eb],e.prototype,"updateAfterAdjustStartAndEnd",null)}(Sx);var Bx=function(){return Bx=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Bx.apply(this,arguments)},Hx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},Fx=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],o=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},zx=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},Wx=function(){function t(t,e){var n;this.BaseType=_y.NODE,this.id="",this.type="",this.x=0,this.y=0,this.textMode=Ny.TEXT,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this._width=100,this._height=80,this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.anchorsOffset=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isShowAnchor=!1,this.isDragging=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.rotatable=!0,this.resizable=!0,this.zIndex=1,this.state=xy.DEFAULT,this.autoToFront=!0,this.style={},this._rotate=0,this.modelType=Ey.NODE,this.additionStateData={},this.targetRules=[],this.sourceRules=[],this.moveRules=[],this.hasSetTargetRules=!1,this.hasSetSourceRules=!1,this.graphModel=e,this.properties=null!==(n=t.properties)&&void 0!==n?n:{},this.initNodeData(t),this.setAttributes()}return Object.defineProperty(t.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t;var e=this.x,n=void 0===e?0:e,o=this.y,i=void 0===o?0:o;this.transform=new mE(-n,-i).rotate(t).translate(n,i).toString()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"incoming",{get:function(){return{nodes:this.graphModel.getNodeIncomingNode(this.id),edges:this.graphModel.getNodeIncomingEdge(this.id)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outgoing",{get:function(){return{nodes:this.graphModel.getNodeOutgoingNode(this.id),edges:this.graphModel.getNodeOutgoingEdge(this.id)}},enumerable:!1,configurable:!0}),t.prototype.initNodeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,n=e&&e(t.type),o=this.createId();t.id=o||n||JE()}this.formatText(t),li(this,OE(t)),this.graphModel.overlapMode===Sy.INCREASE&&(this.zIndex=t.zIndex||iw())},t.prototype.setAttributes=function(){},t.prototype.createId=function(){return null},t.prototype.setTextMode=function(t){this.textMode=t},t.prototype.formatText=function(t){var e,n,o,i=t.x,r=t.y,a=t.text,s={value:"",x:i,y:r,draggable:!1,editable:!0};a&&("string"==typeof a?s.value=a:(s=Bx(Bx({},s),{x:null!==(e=a.x)&&void 0!==e?e:i,y:null!==(n=a.y)&&void 0!==n?n:r,value:null!==(o=a.value)&&void 0!==o?o:""}),nd(a.draggable)||(s.draggable=a.draggable),nd(a.editable)||(s.draggable=a.draggable))),t.text=s},t.prototype.resize=function(t){var e=t.width,n=t.height,o=t.deltaX,i=t.deltaY;return this.move(o/2,i/2),this.width=e,this.height=n,this.setProperties({width:e,height:n}),this.getData()},t.prototype.proportionalResize=function(){},t.prototype.getData=function(){var t=this.text,e=t.x,n=t.y,o=t.value,i=this.properties;Pb(i)&&(i=Ib(i));var r={id:this.id,type:this.type,x:this.x,y:this.y,properties:i};return this.rotate&&(r.rotate=this.rotate),this.graphModel.overlapMode===Sy.INCREASE&&(r.zIndex=this.zIndex),o&&(r.text={x:e,y:n,value:o}),r},t.prototype.getHistoryData=function(){return this.getData()},t.prototype.getProperties=function(){return Ib(this.properties)},t.prototype.getOuterGAttributes=function(){return{className:""}},t.prototype.getNodeStyle=function(){return Bx(Bx({},this.graphModel.theme.baseNode),this.style)},t.prototype.getTextStyle=function(){var t=this.graphModel.theme.nodeText,e=this.properties.textStyle,n=void 0===e?{}:e;return Bx(Bx({},Is(t)),Is(n))},t.prototype.getRotateControlStyle=function(){return Is(this.graphModel.theme.rotateControl)},t.prototype.getResizeControlStyle=function(){return Is(this.graphModel.theme.resizeControl)},t.prototype.getResizeOutlineStyle=function(){return Is(this.graphModel.theme.resizeOutline)},t.prototype.getAnchorStyle=function(t){return Is(this.graphModel.theme.anchor)},t.prototype.getAnchorLineStyle=function(t){return Is(this.graphModel.theme.anchorLine)},t.prototype.getOutlineStyle=function(){return Is(this.graphModel.theme.outline)},t.prototype.isAllowConnectedAsSource=function(t,e,n,o){var i=this.hasSetSourceRules?this.sourceRules:this.getConnectedSourceRules();this.hasSetSourceRules=!0;for(var r=!0,a="",s=0;s<i.length;s++){var l=i[s];if(!l.validate.call(this,this,t,e,n,o)){r=!1,a=l.message;break}}return{isAllPass:r,msg:a}},t.prototype.getConnectedSourceRules=function(){return this.sourceRules},t.prototype.isAllowConnectedAsTarget=function(t,e,n,o){var i=this.hasSetTargetRules?this.targetRules:this.getConnectedTargetRules();this.hasSetTargetRules=!0;for(var r=!0,a="",s=0;s<i.length;s++){var l=i[s];if(!l.validate.call(this,t,this,e,n,o)){r=!1,a=l.message;break}}return{isAllPass:r,msg:a}},t.prototype.isAllowMoveNode=function(t,e){var n,o,i=!0,r=!0,a=this.moveRules.concat(this.graphModel.nodeMoveRules);try{for(var s=Fx(a),l=s.next();!l.done;l=s.next()){var u=(0,l.value)(this,t,e);if(!u)return!1;if("object"==typeof u){var c=u;if(!c.x&&!c.y)return!1;i=i&&c.x,r=r&&c.y}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return{x:i,y:r}},t.prototype.getConnectedTargetRules=function(){return this.targetRules},t.prototype.getAnchorsByOffset=function(){var t=this,e=t.anchorsOffset,n=t.id,o=t.x,i=t.y;return e&&e.length>0?e.map((function(t,e){return t.length?{id:"".concat(n,"_").concat(e),x:o+t[0],y:i+t[1]}:Bx(Bx({},t),{x:o+t.x,y:i+t.y,id:t.id||"".concat(n,"_").concat(e)})})):this.getDefaultAnchor()},t.prototype.getDefaultAnchor=function(){return[]},t.prototype.getTargetAnchor=function(t){return _E(t,this)},t.prototype.getBounds=function(){return{minX:this.x-this.width/2,minY:this.y-this.height/2,maxX:this.x+this.width/2,maxY:this.y+this.height/2}},Object.defineProperty(t.prototype,"anchors",{get:function(){var t=this.getAnchorsByOffset(),e=this,n=e.x,o=e.y,i=e.rotate;return t.forEach((function(t){var e=t.x,r=t.y,a=zx(new gE([e,r,1]).translate(-n,-o).rotate(i).translate(n,o)[0],2),s=a[0],l=a[1];t.x=s,t.y=l})),t},enumerable:!1,configurable:!0}),t.prototype.getAnchorInfo=function(t){if(!Jc(t))for(var e=0;e<this.anchors.length;e++){var n=this.anchors[e];if(n.id===t)return n}},t.prototype.addNodeMoveRules=function(t){this.moveRules.includes(t)||this.moveRules.push(t)},t.prototype.isAllowMoveByXORY=function(t,e,n){var o,i;if(n)o=!0,i=!0;else{var r=this.isAllowMoveNode(t,e);"boolean"==typeof r?(o=r,i=r):(o=r.x,i=r.y)}return{isAllowMoveX:o,isAllowMoveY:i}},t.prototype.move=function(t,e,n){void 0===n&&(n=!1);var o=this.isAllowMoveByXORY(t,e,n),i=o.isAllowMoveX,r=o.isAllowMoveY;return i&&(this.x=this.x+t,this.text&&this.moveText(t,0)),r&&(this.y=this.y+e,this.text&&this.moveText(0,e)),i||r},t.prototype.getMoveDistance=function(t,e,n){void 0===n&&(n=!1);var o=this.isAllowMoveByXORY(t,e,n),i=o.isAllowMoveX,r=o.isAllowMoveY,a=0,s=0;return i&&t&&(this.x=this.x+t,this.text&&this.moveText(t,0),a=t),r&&e&&(this.y=this.y+e,this.text&&this.moveText(0,e),s=e),[a,s]},t.prototype.moveTo=function(t,e,n){void 0===n&&(n=!1);var o=t-this.x,i=e-this.y;return!(!n&&!this.isAllowMoveNode(o,i))&&(this.text&&this.moveText(o,i),this.x=t,this.y=e,!0)},t.prototype.moveText=function(t,e){var n=this.text,o=n.x,i=n.y,r=n.value,a=n.draggable,s=n.editable;this.text={value:r,editable:s,draggable:a,x:o+t,y:i+e}},t.prototype.updateText=function(t){this.text=Bx(Bx({},Ib(this.text)),{value:t})},t.prototype.setSelected=function(t){void 0===t&&(t=!0),this.isSelected=t},t.prototype.setHovered=function(t){void 0===t&&(t=!0),this.isHovered=t,this.setIsShowAnchor(t)},t.prototype.setIsShowAnchor=function(t){void 0===t&&(t=!0),this.isShowAnchor=t},t.prototype.setRotatable=function(t){void 0===t&&(t=!0),this.rotatable=t},t.prototype.setResizable=function(t){void 0===t&&(t=!0),this.resizable=t},t.prototype.setHitable=function(t){void 0===t&&(t=!0),this.isHitable=t},t.prototype.setHittable=function(t){void 0===t&&(t=!0),this.isHittable=t},t.prototype.setElementState=function(t,e){this.state=t,this.additionStateData=e},t.prototype.setProperty=function(t,e){var n,o=Ib(this.properties),i=Bx(Bx({},o),((n={})[t]=Oy(e),n));this.properties=i,this.setAttributes(),this.graphModel.eventCenter.emit(wy.NODE_PROPERTIES_CHANGE,{id:this.id,keys:[t],preProperties:o,properties:i})},t.prototype.setProperties=function(t){var e=Ib(this.properties),n=Bx(Bx({},e),Oy(t));this.properties=n,this.setAttributes();var o=[];pd(t,(function(t,n){(fc(e,n)&&e[n]!==t||!fc(e,n))&&o.push(n)})),this.graphModel.eventCenter.emit(wy.NODE_PROPERTIES_CHANGE,{id:this.id,keys:o,preProperties:e,properties:n})},t.prototype.deleteProperty=function(t){delete this.properties[t],this.setAttributes()},t.prototype.setStyle=function(t,e){var n;this.style=Bx(Bx({},this.style),((n={})[t]=Oy(e),n))},t.prototype.setStyles=function(t){this.style=Bx(Bx({},this.style),Oy(t))},t.prototype.updateStyles=function(t){this.style=Bx({},Oy(t))},t.prototype.setZIndex=function(t){void 0===t&&(t=1),this.zIndex=t},t.prototype.updateAttributes=function(t){li(this,t)},t.BaseType=_y.NODE,Hx([Sm],t.prototype,"type",void 0),Hx([Sm],t.prototype,"x",void 0),Hx([Sm],t.prototype,"y",void 0),Hx([Sm],t.prototype,"textMode",void 0),Hx([Sm],t.prototype,"text",void 0),Hx([Sm],t.prototype,"properties",void 0),Hx([Sm],t.prototype,"_width",void 0),Hx([Sm],t.prototype,"_height",void 0),Hx([Sm],t.prototype,"anchorsOffset",void 0),Hx([Sm],t.prototype,"isSelected",void 0),Hx([Sm],t.prototype,"isHovered",void 0),Hx([Sm],t.prototype,"isShowAnchor",void 0),Hx([Sm],t.prototype,"isDragging",void 0),Hx([Sm],t.prototype,"isHitable",void 0),Hx([Sm],t.prototype,"isHittable",void 0),Hx([Sm],t.prototype,"draggable",void 0),Hx([Sm],t.prototype,"visible",void 0),Hx([Sm],t.prototype,"rotatable",void 0),Hx([Sm],t.prototype,"resizable",void 0),Hx([Sm],t.prototype,"zIndex",void 0),Hx([Sm],t.prototype,"state",void 0),Hx([Sm],t.prototype,"autoToFront",void 0),Hx([Sm],t.prototype,"style",void 0),Hx([Sm],t.prototype,"transform",void 0),Hx([Sm],t.prototype,"_rotate",void 0),Hx([Om],t.prototype,"incoming",null),Hx([Om],t.prototype,"outgoing",null),Hx([Eb],t.prototype,"setTextMode",null),Hx([Eb],t.prototype,"addNodeMoveRules",null),Hx([Eb],t.prototype,"move",null),Hx([Eb],t.prototype,"getMoveDistance",null),Hx([Eb],t.prototype,"moveTo",null),Hx([Eb],t.prototype,"moveText",null),Hx([Eb],t.prototype,"updateText",null),Hx([Eb],t.prototype,"setSelected",null),Hx([Eb],t.prototype,"setHovered",null),Hx([Eb],t.prototype,"setIsShowAnchor",null),Hx([Eb],t.prototype,"setRotatable",null),Hx([Eb],t.prototype,"setResizable",null),Hx([Eb],t.prototype,"setHitable",null),Hx([Eb],t.prototype,"setHittable",null),Hx([Eb],t.prototype,"setElementState",null),Hx([Eb],t.prototype,"setProperty",null),Hx([Eb],t.prototype,"setProperties",null),Hx([Eb],t.prototype,"deleteProperty",null),Hx([Eb],t.prototype,"setStyle",null),Hx([Eb],t.prototype,"setStyles",null),Hx([Eb],t.prototype,"updateStyles",null),Hx([Eb],t.prototype,"setZIndex",null),Hx([Eb],t.prototype,"updateAttributes",null),t}(),Gx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ux=function(){return Ux=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ux.apply(this,arguments)},Xx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a};!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.CIRCLE_NODE,o.r=50,o.setAttributes(),o}Gx(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return 2*this.r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return 2*this.r},enumerable:!1,configurable:!0}),e.prototype.setAttributes=function(){t.prototype.setAttributes.call(this);var e=this.properties.r;e&&(this.r=e)},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this),n=this.graphModel.theme.circle,o=this.properties.style,i=void 0===o?{}:o;return Ux(Ux(Ux({},e),Is(n)),Is(i))},e.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,o=t.r;return[{x:e,y:n-o,id:"".concat(this.id,"_0")},{x:e+o,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+o,id:"".concat(this.id,"_2")},{x:e-o,y:n,id:"".concat(this.id,"_3")}]},e.prototype.resize=function(t){var e=t.width,n=t.deltaX,o=t.deltaY;return this.move(n/2,o/2),this.r=e,this.setProperties({r:e}),this.getData()},Xx([Sm],e.prototype,"r",void 0),Xx([Om],e.prototype,"width",null),Xx([Om],e.prototype,"height",null)}(Wx);var Vx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Yx=function(){return Yx=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Yx.apply(this,arguments)},qx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},Kx=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a};!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.DIAMOND_NODE,o.rx=30,o.ry=50,o.setAttributes(),o}Vx(e,t),e.prototype.setAttributes=function(){t.prototype.setAttributes.call(this);var e=this.properties,n=e.rx,o=e.ry;n&&(this.rx=n),o&&(this.ry=o)},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this),n=this.graphModel.theme.diamond,o=this.properties.style,i=void 0===o?{}:o;return Yx(Yx(Yx({},e),Is(n)),Is(i))},Object.defineProperty(e.prototype,"points",{get:function(){var t=this,e=t.x,n=t.y,o=t.rx,i=t.ry;return[[e,n-i],[e+o,n],[e,n+i],[e-o,n]]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pointsPosition",{get:function(){return Ju(this.points,(function(t){var e=Kx(t,2);return{x:e[0],y:e[1]}}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return xu(this.points,(function(n){var o=Kx(n,1)[0];o<t&&(t=o),o>e&&(e=o)})),e-t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return xu(this.points,(function(n){var o=Kx(n,2)[1];o<t&&(t=o),o>e&&(e=o)})),e-t},enumerable:!1,configurable:!0}),e.prototype.getDefaultAnchor=function(){var t=this;return Ju(this.points,(function(e,n){var o=Kx(e,2);return{x:o[0],y:o[1],id:"".concat(t.id,"_").concat(n)}}))},e.prototype.resize=function(t){var e=t.width,n=t.height,o=t.deltaX,i=t.deltaY;return this.move(o/2,i/2),this.rx=e,this.ry=n,this.setProperties({rx:e,ry:n}),this.getData()},qx([Sm],e.prototype,"rx",void 0),qx([Sm],e.prototype,"ry",void 0),qx([Om],e.prototype,"points",null),qx([Om],e.prototype,"pointsPosition",null),qx([Om],e.prototype,"width",null),qx([Om],e.prototype,"height",null)}(Wx);var Zx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),$x=function(){return $x=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},$x.apply(this,arguments)},Jx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a};!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.ELLIPSE_NODE,o.rx=30,o.ry=45,o.setAttributes(),o}Zx(e,t),e.prototype.setAttributes=function(){t.prototype.setAttributes.call(this);var e=this.properties,n=e.rx,o=e.ry;n&&(this.rx=n),o&&(this.ry=o)},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this),n=this.graphModel.theme.ellipse,o=this.properties.style,i=void 0===o?{}:o;return $x($x($x({},e),Is(n)),Is(i))},Object.defineProperty(e.prototype,"width",{get:function(){return 2*this.rx},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return 2*this.ry},enumerable:!1,configurable:!0}),e.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,o=t.rx,i=t.ry;return[{x:e,y:n-i,id:"".concat(this.id,"_0")},{x:e+o,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+i,id:"".concat(this.id,"_2")},{x:e-o,y:n,id:"".concat(this.id,"_3")}]},e.prototype.resize=function(t){var e=t.width,n=t.height,o=t.deltaX,i=t.deltaY;return this.move(o/2,i/2),this.rx=e,this.ry=n,this.setProperties({rx:e,ry:n}),this.getData()},Jx([Sm],e.prototype,"rx",void 0),Jx([Sm],e.prototype,"ry",void 0),Jx([Om],e.prototype,"width",null),Jx([Om],e.prototype,"height",null)}(Wx);var Qx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),t_=function(){return t_=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t_.apply(this,arguments)},e_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},n_=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a};!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.POLYGON_NODE,o.points=[[50,0],[100,50],[50,100],[0,50]],o.setAttributes(),o}Qx(e,t),e.prototype.setAttributes=function(){t.prototype.setAttributes.call(this);var e=this.properties,n=e.points,o=e.width,i=e.height,r=n||this.points;this.points=function(t,e,n){if(!t)return[];var o=Math.min.apply(Math,oE([],nE(t.map((function(t){return t[0]}))),!1)),i=Math.max.apply(Math,oE([],nE(t.map((function(t){return t[0]}))),!1)),r=Math.min.apply(Math,oE([],nE(t.map((function(t){return t[1]}))),!1)),a=Math.max.apply(Math,oE([],nE(t.map((function(t){return t[1]}))),!1)),s=-o,l=-r,u=t.map((function(t){var e=nE(t,2),n=e[0],o=e[1];return[n+s,o+l]})),c=i-o,d=a-r,h=e?e/c:1,p=n?n/d:1,f=Math.min(h,p);return u.map((function(t){var e=nE(t,2),n=e[0],o=e[1];return[n*f,o*f]}))}(r,o,i)},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this),n=this.graphModel.theme.polygon,o=this.properties.style,i=void 0===o?{}:o;return t_(t_(t_({},e),Is(n)),Is(i))},Object.defineProperty(e.prototype,"pointsPosition",{get:function(){var t=this,e=t.x,n=t.y,o=t.width,i=t.height;return this.points.map((function(t){return{x:t[0]+e-o/2,y:t[1]+n-i/2}}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return this.points.forEach((function(n){var o=n_(n,1)[0];o<t&&(t=o),o>e&&(e=o)})),e-t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return this.points.forEach((function(n){var o=n_(n,2)[1];o<t&&(t=o),o>e&&(e=o)})),e-t},enumerable:!1,configurable:!0}),e.prototype.getDefaultAnchor=function(){var t=this,e=this,n=e.x,o=e.y,i=e.width,r=e.height;return e.points.map((function(e,a){var s=n_(e,2),l=s[0],u=s[1];return{x:n+l-i/2,y:o+u-r/2,id:"".concat(t.id,"_").concat(a)}}))},e.prototype.resize=function(t){var e=this,n=t.width,o=t.height,i=t.deltaX,r=t.deltaY;this.move(i/2,r/2);var a=Ju(this.points,(function(t){var i=n_(t,2),r=i[0],a=i[1];return[r*n/e.width,a*o/e.height]}));return this.points=a,this.properties.points=a,this.getData()},e_([Sm],e.prototype,"points",void 0),e_([Om],e.prototype,"pointsPosition",null),e_([Om],e.prototype,"width",null),e_([Om],e.prototype,"height",null)}(Wx);var o_=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),i_=function(){return i_=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},i_.apply(this,arguments)},r_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a};!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.RECT_NODE,o.radius=0,o.setAttributes(),o}o_(e,t),e.prototype.setAttributes=function(){t.prototype.setAttributes.call(this);var e=this.properties,n=e.width,o=e.height,i=e.radius;n&&(this.width=n),o&&(this.height=o),i&&(this.radius=i)},e.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,o=t.width,i=t.height;return[{x:e,y:n-i/2,id:"".concat(this.id,"_0")},{x:e+o/2,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+i/2,id:"".concat(this.id,"_2")},{x:e-o/2,y:n,id:"".concat(this.id,"_3")}]},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this),n=this.graphModel.theme.rect,o=this.properties.style,i=void 0===o?{}:o;return i_(i_(i_({},e),Is(n)),Is(i))},r_([Sm],e.prototype,"radius",void 0)}(Wx);var a_=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),s_=function(){return s_=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},s_.apply(this,arguments)},l_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},u_=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},c_=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))};!function(t){function e(){var e=t.apply(this,c_([],u_(arguments),!1))||this;return e.modelType=Ey.TEXT_NODE,e}a_(e,t),e.prototype.getTextStyle=function(){var e=t.prototype.getTextStyle.call(this),n=this.graphModel.theme.text,o=this.properties.textStyle;return s_(s_(s_({},e),Is(n)),Is(o))},Object.defineProperty(e.prototype,"width",{get:function(){var t=String(this.text.value).split(/[\r\n]/g),e=this.getTextStyle().fontSize;return kE({rows:t,fontSize:e,rowsLength:t.length}).width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){var t=String(this.text.value).split(/[\r\n]/g),e=this.getTextStyle().fontSize;return kE({rows:t,fontSize:e,rowsLength:t.length}).height},enumerable:!1,configurable:!0}),l_([Om],e.prototype,"width",null),l_([Om],e.prototype,"height",null)}(Wx);var d_=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.HTML_NODE,o.setAttributes(),o}d_(e,t),e.prototype.setAttributes=function(){t.prototype.setAttributes.call(this);var e=this.properties,n=e.width,o=e.height;n&&(this.width=n),o&&(this.height=o)},e.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,o=t.width,i=t.height;return[{x:e,y:n-i/2,id:"".concat(this.id,"_0")},{x:e+o/2,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+i/2,id:"".concat(this.id,"_2")},{x:e-o/2,y:n,id:"".concat(this.id,"_3")}]}}(Wx);var h_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},p_={stopZoomGraph:!1,stopScrollGraph:!1,stopMoveGraph:!1,adjustEdge:!1,adjustEdgeStartAndEnd:!1,adjustNodePosition:!1,hideAnchors:!0,allowRotate:!1,allowResize:!1,nodeSelectedOutline:!0,textEdit:!1,nodeTextEdit:!1,edgeTextEdit:!1,textDraggable:!1,nodeTextDraggable:!1,edgeTextDraggable:!1},f_=["isSilentMode","stopZoomGraph","stopScrollGraph","stopMoveGraph","adjustEdge","adjustEdgeMiddle","adjustEdgeStartAndEnd","adjustEdgeStart","adjustEdgeEnd","adjustNodePosition","hideAnchors","allowRotate","allowResize","autoExpand","hoverOutline","nodeSelectedOutline","edgeSelectedOutline","textEdit","nodeTextEdit","edgeTextEdit","textDraggable","nodeTextDraggable","edgeTextDraggable","multipleSelectKey","textMode","nodeTextMode","edgeTextMode","nodeTextMultiple","edgeTextMultiple","nodeTextVertical","edgeTextVertical"],g_=function(){function t(t){this.isSilentMode=!1,this.stopZoomGraph=!1,this.stopMoveGraph=!1,this.stopScrollGraph=!1,this.textMode=Ny.TEXT,this.textEdit=!0,this.textDraggable=!1,this.nodeTextEdit=!0,this.nodeTextDraggable=!1,this.nodeTextMultiple=!1,this.nodeTextVertical=!1,this.nodeTextMode=Ny.TEXT,this.edgeTextMode=Ny.TEXT,this.edgeTextEdit=!0,this.edgeTextDraggable=!1,this.edgeTextMultiple=!1,this.edgeTextVertical=!1,this.hideAnchors=!1,this.allowRotate=!1,this.allowResize=!1,this.hoverOutline=!0,this.nodeSelectedOutline=!0,this.adjustNodePosition=!0,this.autoExpand=!1,this.adjustEdge=!0,this.adjustEdgeMiddle=!1,this.adjustEdgeStartAndEnd=!1,this.adjustEdgeStart=!1,this.adjustEdgeEnd=!1,this.edgeSelectedOutline=!0,this.multipleSelectKey="",li(this,this.computeConfig(t))}return t.prototype.updateEditConfig=function(t){var e=this.computeConfig(t);li(this,e)},t.prototype.computeConfig=function(t){var e=t.isSilentMode,n=t.textDraggable,o=t.textMode,i=t.textEdit,r=t.adjustEdgeStartAndEnd,a={};if(!1===e&&li(a,this.stagedConfig),!0===e&&e!==this.isSilentMode){var s=yh(p_,f_);this.stagedConfig=yh(this,f_),li(a,s)}nd(i)||li(a,{nodeTextEdit:i,edgeTextEdit:i}),nd(n)||li(a,{nodeTextDraggable:n,edgeTextDraggable:n}),o&&li(a,{nodeTextMode:o,edgeTextMode:o}),Wc(r)&&li(a,{adjustEdgeStart:r,adjustEdgeEnd:r});var l=yh(t,f_);return li(a,l)},t.prototype.updateTextMode=function(t){this.textMode=t,this.edgeTextMode=t,this.nodeTextMode=t},t.prototype.getConfig=function(){return yh(this,f_)},h_([Sm],t.prototype,"isSilentMode",void 0),h_([Sm],t.prototype,"stopZoomGraph",void 0),h_([Sm],t.prototype,"stopMoveGraph",void 0),h_([Sm],t.prototype,"stopScrollGraph",void 0),h_([Sm],t.prototype,"textMode",void 0),h_([Sm],t.prototype,"textEdit",void 0),h_([Sm],t.prototype,"textDraggable",void 0),h_([Sm],t.prototype,"nodeTextEdit",void 0),h_([Sm],t.prototype,"nodeTextDraggable",void 0),h_([Sm],t.prototype,"nodeTextMultiple",void 0),h_([Sm],t.prototype,"nodeTextVertical",void 0),h_([Sm],t.prototype,"nodeTextMode",void 0),h_([Sm],t.prototype,"edgeTextMode",void 0),h_([Sm],t.prototype,"edgeTextEdit",void 0),h_([Sm],t.prototype,"edgeTextDraggable",void 0),h_([Sm],t.prototype,"edgeTextMultiple",void 0),h_([Sm],t.prototype,"edgeTextVertical",void 0),h_([Sm],t.prototype,"hideAnchors",void 0),h_([Sm],t.prototype,"allowRotate",void 0),h_([Sm],t.prototype,"allowResize",void 0),h_([Sm],t.prototype,"hoverOutline",void 0),h_([Sm],t.prototype,"nodeSelectedOutline",void 0),h_([Sm],t.prototype,"adjustNodePosition",void 0),h_([Sm],t.prototype,"autoExpand",void 0),h_([Sm],t.prototype,"adjustEdge",void 0),h_([Sm],t.prototype,"adjustEdgeMiddle",void 0),h_([Sm],t.prototype,"adjustEdgeStartAndEnd",void 0),h_([Sm],t.prototype,"adjustEdgeStart",void 0),h_([Sm],t.prototype,"adjustEdgeEnd",void 0),h_([Sm],t.prototype,"edgeSelectedOutline",void 0),h_([Eb],t.prototype,"updateEditConfig",null),h_([Eb],t.prototype,"updateTextMode",null),t}(),v_=function(){function t(){this._events={}}return t.prototype.on=function(t,e,n){var o=this;null==t||t.split(",").forEach((function(t){t=t.trim(),o._events[t]||(o._events[t]=[]),o._events[t].push({callback:e,once:!!n})}))},t.prototype.once=function(t,e){var n=this;null==t||t.split(",").forEach((function(t){t=t.trim(),n.on(t,e,!0)}))},t.prototype.emit=function(t,e){var n=this;null==t||t.split(",").forEach((function(t){var o=n._events[t]||[],i=n._events["*"]||[],r=function(o){for(var i=o.length,r=0;r<i;r++)if(o[r]){var a=o[r],s=a.callback;a.once&&(o.splice(r,1),0===o.length&&delete n._events[t],i--,r--),s.apply(n,[e])}};r(o),r(i)}))},t.prototype.off=function(t,e){var n=this;t||(this._events={}),t.split(",").forEach((function(t){if(e){for(var o=n._events[t]||[],i=o.length,r=0;r<i;r++)o[r].callback===e&&(o.splice(r,1),i--,r--);0===o.length&&delete n._events[t]}else delete n._events[t]}))},t.prototype.getEvents=function(){return this._events},t}(),y_=function(){return y_=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},y_.apply(this,arguments)},m_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},b_=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},x_=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))};!function(){function t(t){this.modelMap=new Map,this.nodeMoveRules=[],this.nodes=[],this.edges=[],this.overlapMode=Sy.DEFAULT,this.gridSize=1,this.partial=!1;var e,n=t.container,o=t.partial,i=t.background,r=void 0===i?{}:i,a=t.grid,s=t.idGenerator,l=t.edgeGenerator,u=t.animation,c=t.customTrajectory;this.rootEl=n,this.partial=!!o,this.background=r,"object"==typeof a&&(this.gridSize=a.size||1),this.theme=tw(t.style),this.edgeType=t.edgeType||"polyline",this.animation=(e=u)&&"boolean"!=typeof e?md(Is(Ay),e):Is(!0===e?My:Ay),this.overlapMode=t.overlapMode||Sy.DEFAULT,this.width=t.width||this.rootEl.getBoundingClientRect().width,this.height=t.height||this.rootEl.getBoundingClientRect().height,this.eventCenter=new v_,this.editConfigModel=new g_(t),this.transformModel=new N_(this.eventCenter,t),this.flowId=JE(),this.idGenerator=s,this.edgeGenerator=function(t,e){if("function"!=typeof e)return function(e,n,o){return Object.assign({type:t.edgeType},o)};return function(n,o,i){var r=e(n,o,i);return r?"string"==typeof r?Object.assign({},i,{type:r}):Object.assign({type:r},i):{type:t.edgeType}}}(this,l),this.customTrajectory=c}Object.defineProperty(t.prototype,"nodesMap",{get:function(){return this.nodes.reduce((function(t,e,n){return t[e.id]={index:n,model:e},t}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"edgesMap",{get:function(){return this.edges.reduce((function(t,e,n){return t[e.id]={index:n,model:e},t}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modelsMap",{get:function(){return x_(x_([],b_(this.nodes),!1),b_(this.edges),!1).reduce((function(t,e){return t[e.id]=e,t}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sortElements",{get:function(){for(var t=x_(x_([],b_(this.nodes),!1),b_(this.edges),!1).sort((function(t,e){return t.zIndex-e.zIndex})),e=[],n=[-200,-200],o=[this.width+Ty,this.height+Ty],i=0;i<t.length;i++){var r=t[i];r.visible&&(!this.partial||r.isSelected||this.isElementInArea(r,n,o,!1,!1))&&e.push(r)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textEditElement",{get:function(){var t=this.nodes.find((function(t){return t.state===xy.TEXT_EDIT})),e=this.edges.find((function(t){return t.state===xy.TEXT_EDIT}));return t||e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectElements",{get:function(){var t=new Map;return this.nodes.forEach((function(e){e.isSelected&&t.set(e.id,e)})),this.edges.forEach((function(e){e.isSelected&&t.set(e.id,e)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectNodes",{get:function(){var t=[];return this.nodes.forEach((function(e){e.isSelected&&t.push(e)})),t},enumerable:!1,configurable:!0}),t.prototype.getAreaElement=function(t,e,n,o,i){var r=this;void 0===n&&(n=!0),void 0===o&&(o=!0),void 0===i&&(i=!1);var a=[];return xu(x_(x_([],b_(this.nodes),!1),b_(this.edges),!1),(function(s){var l=r.isElementInArea(s,t,e,n,o);i&&!s.visible||!l||a.push(s)})),a},t.prototype.getModel=function(t){return this.modelMap.get(t)},t.prototype.getNodeModelById=function(t){var e;return this.fakeNode&&t===this.fakeNode.id?this.fakeNode:null===(e=this.nodesMap[t])||void 0===e?void 0:e.model},t.prototype.getPointByClient=function(t){var e=t.x,n=t.y,o=this.rootEl.getBoundingClientRect(),i={x:e-o.left,y:n-o.top},r=b_(this.transformModel.HtmlPointToCanvasPoint([i.x,i.y]),2);return{domOverlayPosition:i,canvasOverlayPosition:{x:r[0],y:r[1]}}},t.prototype.isElementInArea=function(t,e,n,o,i){var r;if(void 0===o&&(o=!0),void 0===i&&(i=!0),t.BaseType===_y.NODE){for(var a=SE(t),s=a.minX,l=a.minY,u=a.maxX,c=a.maxY,d=[{x:s,y:l},{x:u,y:l},{x:u,y:c},{x:s,y:c}],h=i,p=0;p<d.length;p++){var f=d[p],g=f.x,v=f.y;if(g=(r=b_(this.transformModel.CanvasPointToHtmlPoint([g,v]),2))[0],v=r[1],aE([g,v],e,n)!==i){h=!i;break}}return h}if(t.BaseType===_y.EDGE){var y=t.startPoint,m=t.endPoint,b=this.transformModel.CanvasPointToHtmlPoint([y.x,y.y]),x=this.transformModel.CanvasPointToHtmlPoint([m.x,m.y]),_=aE(b,e,n),E=aE(x,e,n);return o?_&&E:_||E}return!1},t.prototype.graphDataToModel=function(t){var e=this;if(this.width&&this.height||this.resize(),!t)return this.nodes=[],void(this.edges=[]);if(t.nodes?this.nodes=Ju(t.nodes,(function(t){return e.getModelAfterSnapToGrid(t)})):this.nodes=[],t.edges){var n=this.edgeType;this.edges=Ju(t.edges,(function(t){var o,i=e.getModel(null!==(o=t.type)&&void 0!==o?o:n);if(!i)throw new Error("找不到".concat(t.type,"对应的边。"));return new i(t,e)}))}else this.edges=[]},t.prototype.modelToGraphData=function(){var t=[];this.edges.forEach((function(e){var n=e.getData();n&&!e.virtual&&t.push(n)}));var e=[];return this.nodes.forEach((function(t){var n=t.getData();n&&!t.virtual&&e.push(n)})),{nodes:e,edges:t}},t.prototype.modelToHistoryData=function(){for(var t=!1,e=[],n=0;n<this.nodes.length;n++){var o=this.nodes[n];if(o.isDragging){t=!0;break}e.push(o.getHistoryData())}if(t)return!1;for(var i=!1,r=[],a=0;a<this.edges.length;a++){var s=this.edges[a];if(s.isDragging){i=!0;break}r.push(s.getHistoryData())}return!i&&{nodes:e,edges:r}},t.prototype.getEdgeModelById=function(t){var e;return null===(e=this.edgesMap[t])||void 0===e?void 0:e.model},t.prototype.getElement=function(t){return this.modelsMap[t]},t.prototype.getNodeEdges=function(t){for(var e=[],n=0;n<this.edges.length;n++){var o=this.edges[n],i=o.sourceNodeId===t,r=o.targetNodeId===t;(i||r)&&e.push(o)}return e},t.prototype.getSelectElements=function(t){void 0===t&&(t=!0);var e=this.selectElements,n={nodes:[],edges:[]};return e.forEach((function(o){if(o.BaseType===_y.NODE&&n.nodes.push(o.getData()),o.BaseType===_y.EDGE){var i=o.getData(),r=e.get(i.sourceNodeId)&&e.get(i.targetNodeId);(t||r)&&n.edges.push(i)}})),n},t.prototype.updateAttributes=function(t,e){var n=this.getElement(t);null==n||n.updateAttributes(e)},t.prototype.changeNodeId=function(t,e){return e||(e=JE()),this.nodesMap[e]?(console.warn("当前流程图已存在节点".concat(e,", 修改失败")),""):this.nodesMap[t]?(this.edges.forEach((function(n){n.sourceNodeId===t&&(n.sourceNodeId=e),n.targetNodeId===t&&(n.targetNodeId=e)})),this.nodesMap[t].model.id=e,this.nodesMap[e]=this.nodesMap[t],e):(console.warn("当前流程图找不到节点".concat(t,", 修改失败")),"")},t.prototype.changeEdgeId=function(t,e){return e||(e=JE()),this.edgesMap[e]?(console.warn("当前流程图已存在边: ".concat(e,", 修改失败")),""):this.edgesMap[t]?(this.edges.forEach((function(n){n.id===t&&n.changeEdgeId(e)})),e):(console.warn("当前流程图找不到边: ".concat(e,", 修改失败")),"")},t.prototype.getTextModel=function(t){var e=this.editConfigModel,n=e.textMode,o=e.nodeTextMode,i=e.edgeTextMode;return t.BaseType===_y.NODE?t.textMode||o||n||Ny.TEXT:t.BaseType===_y.EDGE?t.textMode||i||n||Ny.TEXT:void 0},t.prototype.setTextMode=function(t,e){this.editConfigModel.updateEditConfig({textMode:t})},t.prototype.setFakeNode=function(t){this.fakeNode=t},t.prototype.removeFakeNode=function(){this.fakeNode=null},t.prototype.setModel=function(t,e){return this.modelMap.set(t,e)},t.prototype.toFront=function(t){var e,n,o,i=(null===(e=this.nodesMap[t])||void 0===e?void 0:e.model)||(null===(n=this.edgesMap[t])||void 0===n?void 0:n.model);i&&(this.overlapMode===Sy.DEFAULT&&(null===(o=this.topElement)||void 0===o||o.setZIndex(),i.setZIndex(9999),this.topElement=i),this.overlapMode===Sy.INCREASE&&this.setElementZIndex(t,"top"))},t.prototype.setElementZIndex=function(t,e){var n,o,i=(null===(n=this.nodesMap[t])||void 0===n?void 0:n.model)||(null===(o=this.edgesMap[t])||void 0===o?void 0:o.model);if(i){var r=void 0;"number"==typeof e?r=e:("top"===e&&(r=iw()),"bottom"===e&&(r=rw())),i.setZIndex(r)}},t.prototype.deleteNode=function(t){var e=this.nodesMap[t].model.getData();this.deleteEdgeBySource(t),this.deleteEdgeByTarget(t),this.nodes.splice(this.nodesMap[t].index,1),this.eventCenter.emit(wy.NODE_DELETE,{data:e})},t.prototype.addNode=function(t,e,n){void 0===e&&(e=wy.NODE_ADD);var o=Oy(t),i=o.id;i&&this.nodesMap[i]&&delete o.id;var r=this.getModelAfterSnapToGrid(o);this.nodes.push(r);var a={data:r.getData()};return n&&(a.e=n),this.eventCenter.emit(e,a),r},t.prototype.getModelAfterSnapToGrid=function(t){var e=this.getModel(t.type);if(!e)throw new Error("找不到".concat(t.type,"对应的节点,请确认是否已注册此类型节点。"));var n=t.x,o=t.y;return n&&o&&(t.x=iE(n,this.gridSize),t.y=iE(o,this.gridSize),"object"==typeof t.text&&null!==t.text&&(t.text.x+=t.x-n,t.text.y+=t.y-o)),new e(t,this)},t.prototype.cloneNode=function(t){var e=this.getNodeModelById(t),n=null==e?void 0:e.getData();if(n){n.x+=30,n.y+=30,n.id="","object"==typeof n.text&&null!==n.text&&(n.text.x+=30,n.text.y+=30);var o=this.addNode(n);return o.setSelected(!0),null==e||e.setSelected(!1),o.getData()}},t.prototype.moveNode=function(t,e,n,o){var i;void 0===o&&(o=!1);var r=this.nodesMap[t];if(r){var a=r.model;e=(i=b_(a.getMoveDistance(e,n,o),2))[0],n=i[1],this.moveEdge(t,e,n)}else console.warn("不存在id为".concat(t,"的节点"))},t.prototype.moveNode2Coordinate=function(t,e,n,o){void 0===o&&(o=!1);var i=this.nodesMap[t];if(i){var r=i.model,a=e-r.x,s=n-r.y;this.moveNode(t,a,s,o)}else console.warn("不存在id为".concat(t,"的节点"))},t.prototype.editText=function(t){this.setElementStateById(t,xy.TEXT_EDIT)},t.prototype.addEdge=function(t){var e=Oy(t),n=e.type;n||(n=this.edgeType),e.id&&this.edgesMap[e.id]&&delete e.id;var o=this.getModel(n);if(!o)throw new Error("找不到".concat(n,"对应的边,请确认是否已注册此类型边。"));var i=new o(y_(y_({},e),{type:n}),this),r=i.getData();return this.edges.push(i),this.eventCenter.emit(wy.EDGE_ADD,{data:r}),i},t.prototype.moveEdge=function(t,e,n){for(var o=0;o<this.edges.length;o++){var i=this.edges[o],r=i.textPosition,a=r.x,s=r.y,l=this.edges[o].sourceNodeId===t,u=this.edges[o].targetNodeId===t;l&&i.moveStartPoint(e,n),u&&i.moveEndPoint(e,n),(l||u)&&this.handleEdgeTextMove(i,a,s)}},t.prototype.handleEdgeTextMove=function(t,e,n){var o;if(t.customTextPosition)t.resetTextPosition();else{if(t.modelType===Ey.POLYLINE_EDGE&&(null===(o=t.text)||void 0===o?void 0:o.value)){var i=t.text,r=Q_(i,t.points);t.moveText(r.x-i.x,r.y-i.y)}var a=t.textPosition,s=a.x,l=a.y;t.moveText(s-e,l-n)}},t.prototype.deleteEdgeBySourceAndTarget=function(t,e){for(var n=0;n<this.edges.length;n++)if(this.edges[n].sourceNodeId===t&&this.edges[n].targetNodeId===e){var o=this.edges[n].getData();this.edges.splice(n,1),n--,this.eventCenter.emit(wy.EDGE_DELETE,{data:o})}},t.prototype.deleteEdgeById=function(t){if(this.edgesMap[t]){var e=this.edgesMap[t].index,n=this.edgesMap[t].model.getData();this.edges.splice(e,1),this.eventCenter.emit(wy.EDGE_DELETE,{data:n})}},t.prototype.deleteEdgeBySource=function(t){for(var e=0;e<this.edges.length;e++)if(this.edges[e].sourceNodeId===t){var n=this.edges[e].getData();this.edges.splice(e,1),e--,this.eventCenter.emit(wy.EDGE_DELETE,{data:n})}},t.prototype.deleteEdgeByTarget=function(t){for(var e=0;e<this.edges.length;e++)if(this.edges[e].targetNodeId===t){var n=this.edges[e].getData();this.edges.splice(e,1),e--,this.eventCenter.emit(wy.EDGE_DELETE,{data:n})}},t.prototype.setElementStateById=function(t,e,n){this.nodes.forEach((function(o){o.id===t?o.setElementState(e,n):o.setElementState(xy.DEFAULT)})),this.edges.forEach((function(o){o.id===t?o.setElementState(e,n):o.setElementState(xy.DEFAULT)}))},t.prototype.updateText=function(t,e){var n=Uu(x_(x_([],b_(this.nodes),!1),b_(this.edges),!1),(function(e){return e.id===t}));null==n||n.updateText(e)},t.prototype.selectNodeById=function(t,e){var n;void 0===e&&(e=!1),e||this.clearSelectElements();var o=null===(n=this.nodesMap[t])||void 0===n?void 0:n.model;null==o||o.setSelected(!0)},t.prototype.selectEdgeById=function(t,e){var n;void 0===e&&(e=!1),e||this.clearSelectElements();var o=null===(n=this.edgesMap[t])||void 0===n?void 0:n.model;null==o||o.setSelected(!0)},t.prototype.selectElementById=function(t,e){void 0===e&&(e=!1),e||this.clearSelectElements();var n=this.getElement(t);null==n||n.setSelected(!0)},t.prototype.clearSelectElements=function(){var t;this.selectElements.forEach((function(t){null==t||t.setSelected(!1)})),this.selectElements.clear(),this.overlapMode===Sy.DEFAULT&&(null===(t=this.topElement)||void 0===t||t.setZIndex())},t.prototype.moveNodes=function(t,e,n,o){var i,r,a,s=this;void 0===o&&(o=!1);for(var l=t.reduce((function(t,i){var r=s.nodesMap[i].model;return t[i]=r.getMoveDistance(e,n,o),t}),{}),u=0;u<this.edges.length;u++){var c=this.edges[u],d=c.textPosition,h=d.x,p=d.y,f=l[c.sourceNodeId],g=l[c.targetNodeId],v=void 0,y=void 0;f&&g&&c.modelType===Ey.POLYLINE_EDGE?(v=(i=b_(f,2))[0],y=i[1],c.updatePointsList(v,y)):(f&&(v=(r=b_(f,2))[0],y=r[1],c.moveStartPoint(v,y)),g&&(v=(a=b_(g,2))[0],y=a[1],c.moveEndPoint(v,y))),(f||g)&&this.handleEdgeTextMove(c,h,p)}},t.prototype.addNodeMoveRules=function(t){this.nodeMoveRules.includes(t)||this.nodeMoveRules.push(t)},t.prototype.setDefaultEdgeType=function(t){this.edgeType=t},t.prototype.changeNodeType=function(t,e){var n=this.getNodeModelById(t);if(n){var o=n.getData();o.type=e;var i=this.getModel(e);if(!i)throw new Error("找不到".concat(e,"对应的节点,请确认是否已注册此类型节点。"));var r=new i(o,this);this.nodes.splice(this.nodesMap[t].index,1,r),this.getNodeEdges(t).forEach((function(e){if(e.sourceNodeId===t){var n=PE(r,e.startPoint,r.width,r.height);e.updateStartPoint(n)}if(e.targetNodeId===t){n=PE(r,e.endPoint,r.width,r.height);e.updateEndPoint(n)}}))}else console.warn("找不到id为".concat(t,"的节点"))},t.prototype.changeEdgeType=function(t,e){var n=this.getEdgeModelById(t);if(n){if(n.type!==e){var o=n.getData();o.type=e;var i=this.getModel(e);if(!i)throw new Error("找不到".concat(e,"对应的节点,请确认是否已注册此类型节点。"));delete o.pointsList;var r=new i(o,this);this.edges.splice(this.edgesMap[t].index,1,r)}}else console.warn("找不到id为".concat(t,"的边"))},t.prototype.getNodeIncomingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.targetNodeId===t&&e.push(n)})),e},t.prototype.getNodeOutgoingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.sourceNodeId===t&&e.push(n)})),e},t.prototype.getAnchorIncomingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.targetAnchorId===t&&e.push(n)})),e},t.prototype.getAnchorOutcomingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.sourceAnchorId===t&&e.push(n)})),e},t.prototype.getNodeIncomingNode=function(t){var e=this,n=[];return this.edges.forEach((function(o){var i;o.targetNodeId===t&&n.push(null===(i=e.nodesMap[o.sourceNodeId])||void 0===i?void 0:i.model)})),n},t.prototype.getNodeOutgoingNode=function(t){var e=this,n=[];return this.edges.forEach((function(o){o.sourceNodeId===t&&n.push(e.nodesMap[o.targetNodeId].model)})),n},t.prototype.setTheme=function(t){this.theme=ew(y_(y_({},this.theme),t))},t.prototype.resize=function(t,e){this.width=t||this.rootEl.getBoundingClientRect().width,this.height=e||this.rootEl.getBoundingClientRect().height,this.width&&this.height||console.warn("渲染画布的时候无法获取画布宽高,请确认在container已挂载到DOM。@see https://github.com/didi/LogicFlow/issues/675")},t.prototype.clearData=function(){this.nodes=[],this.edges=[]},t.prototype.getVirtualRectSize=function(){var t=this.nodes,e=[],n=[];t.forEach((function(t){var o=t.x,i=t.y,r=t.width,a=t.height,s=t.getNodeStyle().strokeWidth,l=void 0===s?0:s,u=o+r/2+l,c=o-r/2-l,d=i+a/2+l,h=i-a/2-l;e=e.concat([u,c].filter((function(t){return!Number.isNaN(t)}))),n=n.concat([d,h].filter((function(t){return!Number.isNaN(t)})))}));var o=Math.min.apply(Math,x_([],b_(e),!1)),i=Math.max.apply(Math,x_([],b_(e),!1)),r=Math.min.apply(Math,x_([],b_(n),!1)),a=i-o||0,s=Math.max.apply(Math,x_([],b_(n),!1))-r||0;return{width:a,height:s,x:o+a/2,y:r+s/2}},t.prototype.translateCenter=function(){var t=this,e=t.nodes,n=t.width,o=t.height,i=t.rootEl,r=t.transformModel;if(e.length){var a=n||i.clientWidth,s=o||i.clientHeight,l=this.getVirtualRectSize(),u=l.x,c=l.y;r.focusOn(u,c,a,s)}},t.prototype.fitView=function(t,e){void 0===t&&(t=20),void 0===e&&(e=20);var n=this,o=n.nodes,i=n.width,r=n.height,a=n.rootEl,s=n.transformModel;if(o.length){var l=i||a.clientWidth,u=r||a.clientHeight,c=this.getVirtualRectSize(),d=c.width,h=c.height,p=c.x,f=c.y,g=(d+e)/l,v=(h+t)/u,y=1/Math.max(g,v),m=[l/2,u/2];s.zoom(y,m),s.focusOn(p,f,l,u)}},t.prototype.openEdgeAnimation=function(t){var e=this.getEdgeModelById(t);null==e||e.openEdgeAnimation()},t.prototype.closeEdgeAnimation=function(t){var e=this.getEdgeModelById(t);null==e||e.closeEdgeAnimation()},t.prototype.getPartial=function(){return this.partial},t.prototype.setPartial=function(t){this.partial=t},m_([Sm],t.prototype,"width",void 0),m_([Sm],t.prototype,"height",void 0),m_([Sm],t.prototype,"edgeType",void 0),m_([Sm],t.prototype,"nodes",void 0),m_([Sm],t.prototype,"edges",void 0),m_([Sm],t.prototype,"fakeNode",void 0),m_([Sm],t.prototype,"overlapMode",void 0),m_([Sm],t.prototype,"background",void 0),m_([Sm],t.prototype,"gridSize",void 0),m_([Sm],t.prototype,"transformModel",void 0),m_([Sm],t.prototype,"editConfigModel",void 0),m_([Sm],t.prototype,"partial",void 0),m_([Om],t.prototype,"nodesMap",null),m_([Om],t.prototype,"edgesMap",null),m_([Om],t.prototype,"modelsMap",null),m_([Om],t.prototype,"sortElements",null),m_([Om],t.prototype,"textEditElement",null),m_([Om],t.prototype,"selectElements",null),m_([Om],t.prototype,"selectNodes",null),m_([Eb],t.prototype,"setTextMode",null),m_([Eb],t.prototype,"setFakeNode",null),m_([Eb],t.prototype,"removeFakeNode",null),m_([Eb],t.prototype,"setModel",null),m_([Eb],t.prototype,"toFront",null),m_([Eb],t.prototype,"setElementZIndex",null),m_([Eb],t.prototype,"deleteNode",null),m_([Eb],t.prototype,"addNode",null),m_([Eb],t.prototype,"cloneNode",null),m_([Eb],t.prototype,"moveNode",null),m_([Eb],t.prototype,"moveNode2Coordinate",null),m_([Eb],t.prototype,"editText",null),m_([Eb],t.prototype,"addEdge",null),m_([Eb],t.prototype,"moveEdge",null),m_([Eb],t.prototype,"deleteEdgeBySourceAndTarget",null),m_([Eb],t.prototype,"deleteEdgeById",null),m_([Eb],t.prototype,"deleteEdgeBySource",null),m_([Eb],t.prototype,"deleteEdgeByTarget",null),m_([Eb],t.prototype,"setElementStateById",null),m_([Eb],t.prototype,"updateText",null),m_([Eb],t.prototype,"selectNodeById",null),m_([Eb],t.prototype,"selectEdgeById",null),m_([Eb],t.prototype,"selectElementById",null),m_([Eb],t.prototype,"clearSelectElements",null),m_([Eb],t.prototype,"moveNodes",null),m_([Eb],t.prototype,"setDefaultEdgeType",null),m_([Eb],t.prototype,"changeNodeType",null),m_([Eb],t.prototype,"changeEdgeType",null),m_([Eb],t.prototype,"getNodeIncomingEdge",null),m_([Eb],t.prototype,"getNodeOutgoingEdge",null),m_([Eb],t.prototype,"getAnchorIncomingEdge",null),m_([Eb],t.prototype,"getAnchorOutcomingEdge",null),m_([Eb],t.prototype,"getNodeIncomingNode",null),m_([Eb],t.prototype,"getNodeOutgoingNode",null),m_([Eb],t.prototype,"setTheme",null),m_([Eb],t.prototype,"resize",null),m_([Eb],t.prototype,"clearData",null),m_([Eb],t.prototype,"translateCenter",null),m_([Eb],t.prototype,"fitView",null),m_([Eb],t.prototype,"openEdgeAnimation",null),m_([Eb],t.prototype,"closeEdgeAnimation",null),m_([Eb],t.prototype,"setPartial",null)}();var __=function(){return __=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},__.apply(this,arguments)},E_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a};!function(){function t(t){this.isShowHorizontal=!1,this.isShowVertical=!1,this.position={x:0,y:0},this.graphModel=t}t.prototype.getStyle=function(){return __({},this.graphModel.theme.snapline)},t.prototype.getCenterSnapLine=function(t,e){for(var n=t.x,o=t.y,i=!1,r=!1,a=0;a<e.length;a++){var s=e[a];if(s.id!==t.id&&(n===s.x&&(i=!0),o===s.y&&(r=!0),i&&r))break}return{isShowVertical:i,isShowHorizontal:r,position:{x:n,y:o}}},t.prototype.getHorizontalSnapline=function(t,e){var n,o=!1,i=0,r=t.id;if(r){var a=this.graphModel.fakeNode;if(a&&a.id===r)n=SE(a);else{var s=this.graphModel.getNodeModelById(r);s&&(n=SE(s))}}for(var l=0;l<e.length;l++){var u=e[l];if(u.id!==t.id){var c=SE(u);if(c.minY===(null==n?void 0:n.minY)||c.maxY===(null==n?void 0:n.minY)){o=!0,i=n.minY;break}if(c.minY===(null==n?void 0:n.maxY)||c.maxY===(null==n?void 0:n.maxY)){o=!0,i=n.maxY;break}}}return{isShowHorizontal:o,isShowVertical:this.isShowVertical,position:__(__({},this.position),{y:i})}},t.prototype.getVerticalSnapline=function(t,e){var n,o=!1,i=0,r=t.id;if(r){var a=this.graphModel.fakeNode;if(a&&a.id===r)n=SE(a);else{var s=this.graphModel.getNodeModelById(r);s&&(n=SE(s))}}for(var l=0;l<e.length;l++){var u=e[l];if(u.id!==t.id){var c=SE(u);if(c.minX===(null==n?void 0:n.minX)||c.maxX===(null==n?void 0:n.minX)){o=!0,i=n.minX;break}if(c.minX===(null==n?void 0:n.maxX)||c.maxX===(null==n?void 0:n.maxX)){o=!0,i=n.maxX;break}}}return{isShowHorizontal:this.isShowHorizontal,isShowVertical:o,position:__(__({},this.position),{x:i})}},t.prototype.getSnapLinePosition=function(t,e){var n=this.getCenterSnapLine(t,e),o=n.isShowHorizontal,i=n.isShowVertical;if(!o){var r=this.getHorizontalSnapline(t,e);r.isShowHorizontal&&(n.isShowHorizontal=r.isShowHorizontal,n.position.y=r.position.y)}if(!i){var a=this.getVerticalSnapline(t,e);a.isShowVertical&&(n.isShowVertical=a.isShowVertical,n.position.x=a.position.x)}return n},t.prototype.setSnaplineInfo=function(t){var e=t.isShowHorizontal,n=t.isShowVertical,o=t.position;this.position=o,this.isShowHorizontal=e,this.isShowVertical=n},t.prototype.clearSnapline=function(){this.position={x:0,y:0},this.isShowHorizontal=!1,this.isShowVertical=!1},t.prototype.setNodeSnapLine=function(t){var e=this.graphModel.nodes,n=this.getSnapLinePosition(t,e);this.setSnaplineInfo(n)},E_([Sm],t.prototype,"isShowHorizontal",void 0),E_([Sm],t.prototype,"isShowVertical",void 0),E_([Sm],t.prototype,"position",void 0),E_([Eb],t.prototype,"clearSnapline",null),E_([Eb],t.prototype,"setNodeSnapLine",null)}();var w_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},S_=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},C_={false:[-1/0,-1/0,1/0,1/0],true:[-1/0,-1/0,1/0,1/0],vertical:[-1/0,0,1/0,0],horizontal:[0,-1/0,0,1/0]},N_=function(){function t(t,e){this.MINI_SCALE_SIZE=.2,this.MAX_SCALE_SIZE=16,this.SCALE_X=1,this.SKEW_Y=0,this.SKEW_X=0,this.SCALE_Y=1,this.TRANSLATE_X=0,this.TRANSLATE_Y=0,this.ZOOM_SIZE=.04,this.translateLimitMinX=-1/0,this.translateLimitMinY=-1/0,this.translateLimitMaxX=1/0,this.translateLimitMaxY=1/0,this.eventCenter=t;var n=e.stopMoveGraph,o=void 0!==n&&n;this.updateTranslateLimits(o)}return t.prototype.setZoomMiniSize=function(t){this.MINI_SCALE_SIZE=t},t.prototype.setZoomMaxSize=function(t){this.MAX_SCALE_SIZE=t},t.prototype.HtmlPointToCanvasPoint=function(t){var e=S_(t,2),n=e[0],o=e[1];return[(n-this.TRANSLATE_X)/this.SCALE_X,(o-this.TRANSLATE_Y)/this.SCALE_Y]},t.prototype.CanvasPointToHtmlPoint=function(t){var e=S_(t,2),n=e[0],o=e[1];return[n*this.SCALE_X+this.TRANSLATE_X,o*this.SCALE_Y+this.TRANSLATE_Y]},t.prototype.moveCanvasPointByHtml=function(t,e,n){var o=S_(t,2),i=o[0],r=o[1];return[i+e/this.SCALE_X,r+n/this.SCALE_Y]},t.prototype.fixDeltaXY=function(t,e){return[t/this.SCALE_X,e/this.SCALE_Y]},t.prototype.getTransformStyle=function(){var t=[this.SCALE_X,this.SKEW_Y,this.SKEW_X,this.SCALE_Y,this.TRANSLATE_X,this.TRANSLATE_Y].join(",");return{transform:"matrix(".concat(t,")")}},t.prototype.zoom=function(t,e){void 0===t&&(t=!1);var n=this.SCALE_X,o=this.SCALE_Y;return"number"==typeof t?(n=t,o=t):t?(n+=this.ZOOM_SIZE,o+=this.ZOOM_SIZE):(n-=this.ZOOM_SIZE,o-=this.ZOOM_SIZE),n<this.MINI_SCALE_SIZE||n>this.MAX_SCALE_SIZE||(e&&(this.TRANSLATE_X-=(n-this.SCALE_X)*e[0],this.TRANSLATE_Y-=(o-this.SCALE_Y)*e[1]),this.SCALE_X=n,this.SCALE_Y=o,this.emitGraphTransform("zoom")),"".concat(100*this.SCALE_X,"%")},t.prototype.emitGraphTransform=function(t){this.eventCenter.emit(wy.GRAPH_TRANSFORM,{type:t,transform:{SCALE_X:this.SCALE_X,SKEW_Y:this.SKEW_Y,SKEW_X:this.SKEW_X,SCALE_Y:this.SCALE_Y,TRANSLATE_X:this.TRANSLATE_X,TRANSLATE_Y:this.TRANSLATE_Y}})},t.prototype.resetZoom=function(){this.SCALE_X=1,this.SCALE_Y=1,this.emitGraphTransform("resetZoom")},t.prototype.translate=function(t,e){this.TRANSLATE_X+t<=this.translateLimitMaxX&&this.TRANSLATE_X+t>=this.translateLimitMinX&&(this.TRANSLATE_X+=t),this.TRANSLATE_Y+e<=this.translateLimitMaxY&&this.TRANSLATE_Y+e>=this.translateLimitMinY&&(this.TRANSLATE_Y+=e),this.emitGraphTransform("translate")},t.prototype.focusOn=function(t,e,n,o){var i=S_(this.CanvasPointToHtmlPoint([t,e]),2),r=i[0],a=i[1],s=S_([n/2-r,o/2-a],2),l=s[0],u=s[1];this.TRANSLATE_X+=l,this.TRANSLATE_Y+=u,this.emitGraphTransform("focusOn")},t.prototype.updateTranslateLimits=function(t){var e;e=S_(Array.isArray(t)&&4===t.length?t:C_[t.toString()],4),this.translateLimitMinX=e[0],this.translateLimitMinY=e[1],this.translateLimitMaxX=e[2],this.translateLimitMaxY=e[3]},w_([Sm],t.prototype,"SCALE_X",void 0),w_([Sm],t.prototype,"SKEW_Y",void 0),w_([Sm],t.prototype,"SKEW_X",void 0),w_([Sm],t.prototype,"SCALE_Y",void 0),w_([Sm],t.prototype,"TRANSLATE_X",void 0),w_([Sm],t.prototype,"TRANSLATE_Y",void 0),w_([Sm],t.prototype,"ZOOM_SIZE",void 0),w_([Eb],t.prototype,"zoom",null),w_([Eb],t.prototype,"resetZoom",null),w_([Eb],t.prototype,"translate",null),w_([Eb],t.prototype,"focusOn",null),t}(),T_=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},A_=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))},M_=function(t){var e=[],n={};return t.forEach((function(t){var e="".concat(t.x,"-").concat(t.y);t.id=e,n[e]=t})),Object.keys(n).forEach((function(t){e.push(n[t])})),e},O_=function(t,e){return 0===t.width&&0===t.height?t:{x:t.x,y:t.y,centerX:t.centerX,centerY:t.centerY,minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e,height:t.height+2*e,width:t.width+2*e}},P_=function(t,e,n){var o=function(t,e){var n=Math.abs(t.x-e.centerX),o=Math.abs(t.y-e.centerY);return n/e.width>o/e.height?Cy.HORIZONTAL:Cy.VERTICAL}(n,e);return o===Cy.HORIZONTAL?{x:n.x>t.centerX?t.maxX:t.minX,y:n.y}:{x:n.x,y:n.y>t.centerY?t.maxY:t.minY}},k_=function(t,e){var n=Math.min(t.minX,e.minX),o=Math.min(t.minY,e.minY),i=Math.max(t.maxX,e.maxX),r=Math.max(t.maxY,e.maxY);return{x:(n+i)/2,y:(o+r)/2,centerX:(n+i)/2,centerY:(o+r)/2,minX:n,minY:o,maxX:i,maxY:r,height:r-o,width:i-n}},R_=function(t){var e=t.minX,n=t.minY,o=t.maxX,i=t.maxY;return[{x:e,y:n},{x:o,y:n},{x:o,y:i},{x:e,y:i}]},D_=function(t,e){var n=t.x,o=t.y;return n<e.minX||n>e.maxX||o<e.minY||o>e.maxY},L_=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},I_=function(t,e,n,o,i){return L_(t,e)+L_(t,n)+function(t,e){var n=0;return e.forEach((function(e){e&&(t.x===e.x&&(n+=-2),t.y===e.y&&(n+=-2))})),n}(t,[e,n,o,i])},j_=function(t,e,n,o,i){i||(i=0),t.unshift(e[o]),n[o]&&n[o]!==o&&i<=100&&j_(t,e,n,n[o],i+1)},B_=function(t,e,n,o){var i=e.x-t.x,r=e.y-t.y,a=o.x-n.x,s=o.y-n.y,l=(-r*(t.x-n.x)+i*(t.y-n.y))/(-a*r+i*s),u=(a*(t.y-n.y)-s*(t.x-n.x))/(-a*r+i*s);return l>=0&&l<=1&&u>=0&&u<=1},H_=function(t,e,n){if(0===n.width&&0===n.height)return!1;var o=T_(R_(n),4),i=o[0],r=o[1],a=o[2],s=o[3];return B_(t,e,i,r)||B_(t,e,i,s)||B_(t,e,r,a)||B_(t,e,a,s)},F_=function(t,e,n,o,i,r,a){var s=[],l=[e],u={},c={},d={};e.id&&(c[e.id]=0,d[e.id]=I_(e,n,e));var h={};t.forEach((function(t){t.id&&(h[t.id]=t)}));for(var p=function(){var p,f,g,v,y=1/0;if(l.forEach((function(t){t.id&&d[t.id]<y&&(y=d[t.id],p=t)})),p===n&&n.id){var m=[];return j_(m,h,u,n.id),{value:m}}if(!p)return{value:[e,n]};g=p,(v=(f=l).indexOf(g))>-1&&f.splice(v,1),s.push(p),function(t,e,n,o){var i=[];return t.forEach((function(t){t!==e&&(t.x!==e.x&&t.y!==e.y||H_(t,e,n)||H_(t,e,o)||i.push(t))})),M_(i)}(t,p,o,i).forEach((function(t){if(-1===s.indexOf(t)&&(-1===l.indexOf(t)&&l.push(t),(null==p?void 0:p.id)&&(null==t?void 0:t.id))){var o=d[p.id]+L_(p,t);if(c[t.id]&&o>=c[t.id])return;u[t.id]=p.id,c[t.id]=o,d[t.id]=c[t.id]+I_(t,n,e,r,a)}}))};l.length;){var f=p();if("object"==typeof f)return f.value}return[e,n]},z_=function(t){return SE(t)},W_=function(t){for(var e=1;e<t.length-1;){var n=t[e-1],o=t[e],i=t[e+1];n.x===o.x&&o.x===i.x||n.y===o.y&&o.y===i.y?t.splice(e,1):e++}return t},G_=function(t,e,n,o,i){var r,a,s=z_(n),l=z_(o),u=O_(s,i),c=O_(l,i),d=P_(u,s,t),h=P_(c,l,e);if(r=u,a=c,2*Math.abs(r.centerX-a.centerX)<r.width+a.width&&2*Math.abs(r.centerY-a.centerY)<r.height+a.height){var p=Z_(t,e,d,h);return A_(A_([t,d],T_(p),!1),[h,e],!1)}var f=function(t,e){void 0===t&&(t=[]);var n=[],o=[];t.forEach((function(t){n.push(t.x),o.push(t.y)}));var i=Math.min.apply(Math,A_([],T_(n),!1)),r=Math.max.apply(Math,A_([],T_(n),!1)),a=Math.min.apply(Math,A_([],T_(o),!1)),s=Math.max.apply(Math,A_([],T_(o),!1)),l=r-i,u=s-a;return e&&(l+=e,u+=e),{centerX:(i+r)/2,centerY:(a+s)/2,maxX:r,maxY:s,minX:i,minY:a,x:(i+r)/2,y:(a+s)/2,height:u,width:l}}([d,h]),g=k_(u,f),v=k_(c,f),y=[];y=(y=y.concat(R_(g))).concat(R_(v));var m={x:(t.x+e.x)/2,y:(t.y+e.y)/2};[f,g,v].forEach((function(t){y=y.concat(function(t,e){return A_(A_([],T_(function(t,e){return e<t.minX||e>t.maxX?[]:[{x:e,y:t.minY},{x:e,y:t.maxY}]}(t,e.x)),!1),T_(function(t,e){return e<t.minY||e>t.maxY?[]:[{x:t.minX,y:e},{x:t.maxX,y:e}]}(t,e.y)),!1)}(t,m).filter((function(t){return D_(t,u)&&D_(t,c)})))})),[{x:d.x,y:h.y},{x:h.x,y:d.y}].forEach((function(t){D_(t,u)&&D_(t,c)&&y.push(t)})),y.unshift(d),y.push(h),y=M_(y);var b=F_(y,d,h,s,l,t,e);return b.unshift(t),b.push(e),b.length>2&&(b=W_(b)),M_(b)},U_=function(t){if(1===t.length){var e=T_(t,1)[0];return[e,e]}for(var n=t[0],o=t[1],i=EE(n.x,n.y,o.x,o.y),r=1;r<t.length-1;r++){var a=t[r],s=t[r+1],l=EE(a.x,a.y,s.x,s.y);l>i&&(i=l,n=a,o=s)}return[n,o]},X_=function(t,e,n){var o=wE(t,n),i=wE(e,n);return o&&i},V_=function(t,e,n){var o=wE(t,n),i=wE(e,n);return!(o&&i)&&(o||i)},Y_=function(t,e,n){for(var o=void 0,i=SE(n),r=R_(i),a=0;a<r.length;a++){B_(t,e,r[a],r[(a+1)%r.length])&&(o=[r[a],r[(a+1)%r.length]])}if(o)return function(t,e,n,o){var i=(e.y-t.y)*(o.x-n.x)-(t.x-e.x)*(n.y-o.y);if(0===i)return!1;var r=((e.x-t.x)*(o.x-n.x)*(n.y-t.y)+(e.y-t.y)*(o.x-n.x)*t.x-(o.y-n.y)*(e.x-t.x)*n.x)/i,a=-((e.y-t.y)*(o.y-n.y)*(n.x-t.x)+(e.x-t.x)*(o.y-n.y)*t.y-(o.x-n.x)*(e.y-t.y)*n.y)/i;return(r-t.x)*(r-e.x)<=0&&(a-t.y)*(a-e.y)<=0&&(r-n.x)*(r-o.x)<=0&&(a-n.y)*(a-o.y)<=0&&{x:r,y:a}}(t,e,o[0],o[1])},q_=function(t,e){var n=void 0;return t.x===e.x?n=Cy.VERTICAL:t.y===e.y&&(n=Cy.HORIZONTAL),n},K_=function(t){var e=t.split(" "),n=[];return e&&e.forEach((function(t){var e=T_(t.split(","),2),o=e[0],i=e[1];n.push({x:Number(o),y:Number(i)})})),n},Z_=function(t,e,n,o){var i=[];if(q_(t,n)===q_(e,o))t.y===n.y?(i.push({x:n.x,y:(n.y+o.y)/2}),i.push({x:o.x,y:(n.y+o.y)/2})):(i.push({x:(n.x+o.x)/2,y:n.y}),i.push({x:(n.x+o.x)/2,y:o.y}));else{var r={x:n.x,y:o.y},a=ky(r,t,n),s=ky(r,e,o);if(a||s)r={x:o.x,y:n.y};else{var l=$_(r,t,n),u=$_(r,e,o);l&&u&&(r={x:o.x,y:n.y})}i.push(r)}return i},$_=function(t,e,n){return t.x===e.x&&t.x===n.x||t.y===e.y&&t.y===n.y},J_=function(t){var e=t.start,n=t.end,o=t.sourceNode,i=t.targetNode,r=t.offset,a=SE(o),s=SE(i),l=O_(a,r),u=O_(s,r);return{sNext:P_(l,a,e),ePre:P_(u,s,n)}},Q_=function(t,e){for(var n,o=t.x,i=t.y,r=K_(e),a=Number.MAX_SAFE_INTEGER,s=[],l=0;l<r.length;l++)s.push({start:r[l],end:r[(l+1)%r.length]});if(s.forEach((function(t){var e=t.start,r=t.end;if(e.x===r.x){var s={x:e.x,y:i};if(ky(s,e,r))(l=Math.abs(e.x-o))<a&&(a=l,n=s)}else if(e.y===r.y){var l;s={x:o,y:e.y};if(ky(s,e,r))(l=Math.abs(e.y-i))<a&&(a=l,n=s)}})),!n){var u=s[0],c=u.start,d=u.end;n={x:c.x+(d.x-c.x)/2,y:c.y+(d.y-c.y)/2}}return n},tE=function(t){return yh(t,["id","type","sourceNodeId","sourceAnchorId","targetNodeId","targetAnchorId","pointsList","startPoint","endPoint","properties"])},eE=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))};var nE=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},oE=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))};function iE(t,e){return e*Math.round(t/e)||t}var rE=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},aE=function(t,e,n){var o=rE(t,2),i=o[0],r=o[1],a=rE(e,2),s=a[0],l=a[1],u=rE(n,2),c=u[0],d=u[1];return i>s&&i<c&&r>l&&r<d},sE=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();function lE(t,e){return!!(t instanceof cE&&e instanceof cE)}var uE=function(t){function e(n,o,i){var r=t.call(this,3)||this;return r[0]=n,r[1]=o,r[2]=i,r.x=n,r.y=o,r.z=i,Object.setPrototypeOf(r,e.prototype),r}return sE(e,t),e.prototype.add=function(t){if(lE(this,t))return new cE(this.x+t.x,this.y+t.y);var e=this.z+t.z;return new dE((this.x+t.x)/e,(this.y+t.y)/e)},e.prototype.subtract=function(t){if(lE(this,t))return new cE(this.x-t.x,this.y-t.y);var e=this.z-t.z;return 0===e?new cE(this.x-t.x,this.y-t.y):new dE((this.x-t.x)/e,(this.y-t.y)/e)},e}(Array),cE=function(t){function e(n,o,i){var r=t.call(this,n,o,null!=i?i:0)||this;return Object.setPrototypeOf(r,e.prototype),r}return sE(e,t),e.prototype.toString=function(){return"Vector"},e.prototype.dot=function(t){var e=this;return t.reduce((function(t,n,o){return t+n*e[o]}))},e.prototype.cross=function(t){return new e(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)},e.prototype.getLength=function(){return Math.hypot(this.x,this.y)},e.prototype.normalize=function(){var t=this.getLength();return new e(this.x/t,this.y/t)},e.prototype.crossZ=function(t){return this.x*t.y-this.y*t.x},e.prototype.angle=function(t){var e=this.crossZ(t),n=Math.acos(this.normalize().dot(t.normalize()));return e>=0?n:-n},e}(uE),dE=function(t){function e(n,o){var i=t.call(this,n,o,1)||this;return Object.setPrototypeOf(i,e.prototype),i}return sE(e,t),e.prototype.toString=function(){return"Point"},e}(uE),hE=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),pE=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},fE=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))},gE=function(t){function e(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=t.call(this,n.length)||this;return i.fill(new Array(3)),n.forEach((function(t,e){i[e]=t})),i.columns=n[0].length,i.rows=n.length,Object.setPrototypeOf(i,e.prototype),i}return hE(e,t),e.prototype.getRow=function(t){return this[t]},e.prototype.getColumn=function(t){return fE([],pE(this.map((function(e){return e[t]}))),!1)},e.prototype.transpose=function(){for(var t=[],n=0;n<this.columns;n++)t.push(this.getColumn(n));return new(e.bind.apply(e,fE([void 0],pE(t),!1)))},e.prototype.cross=function(t){var n=new Array(this.rows).fill("").map((function(){return[]}));if(this.columns===t.rows)for(var o=0;o<this.rows;o++)for(var i=this.getRow(o),r=function(e){var r=t.getColumn(e);n[o][e]=i.reduce((function(t,e,n){return t+e*r[n]}),0)},a=0;a<t.columns;a++)r(a);return new(e.bind.apply(e,fE([void 0],pE(n),!1)))},e.prototype.to2D=function(){return this.map((function(t){return[t[0],t[1]]}))},e.prototype.toPoints=function(){return this.map((function(t){return new dE(t[0],t[1])}))},e.prototype.toString=function(){var t=pE(this[0],2),e=t[0],n=t[1],o=pE(this[1],2),i=o[0],r=o[1],a=pE(this[2],2),s=a[0],l=a[1];return"matrix(".concat(e," ").concat(n," ").concat(i," ").concat(r," ").concat(s," ").concat(l,")")},e.prototype.translate=function(t,e){return this.cross(new mE(t,e))},e.prototype.rotate=function(t){return this.cross(new vE(t))},e.prototype.scale=function(t,e){return this.cross(new yE(t,e))},e}(Array),vE=function(t){function e(n){var o=t.call(this,new cE(+Math.cos(n).toFixed(2),+Math.sin(n).toFixed(2),0),new cE(-Math.sin(n).toFixed(2),+Math.cos(n).toFixed(2),0),new cE(0,0,1))||this;return Object.setPrototypeOf(o,e.prototype),o}return hE(e,t),e.prototype.inverse=function(){return this.transpose()},e}(gE),yE=function(t){function e(n,o){var i=t.call(this,new cE(n,0,0),new cE(0,o,0),new cE(0,0,1))||this;return i.sx=n,i.sy=o,Object.setPrototypeOf(i,e.prototype),i}return hE(e,t),e.prototype.inverse=function(){return new e(1/this.sx,1/this.sy)},e}(gE),mE=function(t){function e(n,o){var i=t.call(this,new cE(1,0,0),new cE(0,1,0),new cE(n,o,1))||this;return i.tx=n,i.ty=o,Object.setPrototypeOf(i,e.prototype),i}return hE(e,t),e.prototype.inverse=function(){return new e(-this.tx,-this.ty)},e}(gE);!function(t){var e=t.enforceActions,n=t.computedRequiresReaction,o=t.computedConfigurable,i=t.disableErrorBoundaries,r=t.reactionScheduler,a=t.reactionRequiresObservable,s=t.observableRequiresReaction;if(!0===t.isolateGlobalState&&((ib.pendingReactions.length||ib.inBatch||ib.isRunningReactions)&&jy("isolateGlobalState should be called before MobX is running any reactions"),ob=!0,nb&&(0==--eb().__mobxInstanceCount&&(eb().__mobxGlobals=void 0),ib=new Qm)),void 0!==e){var l=void 0;switch(e){case!0:case"observed":l=!0;break;case!1:case"never":l=!1;break;case"strict":case"always":l="strict";break;default:jy("Invalid value for 'enforceActions': '"+e+"', expected 'never', 'always' or 'observed'")}ib.enforceActions=l,ib.allowStateChanges=!0!==l&&"strict"!==l}void 0!==n&&(ib.computedRequiresReaction=!!n),void 0!==a&&(ib.reactionRequiresObservable=!!a),void 0!==s&&(ib.observableRequiresReaction=!!s,ib.allowStateReads=!ib.observableRequiresReaction),void 0!==o&&(ib.computedConfigurable=!!o),void 0!==i&&(!0===i&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),ib.disableErrorBoundaries=!!i),r&&bb(r)}({isolateGlobalState:!0});var bE=function(){return bE=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},bE.apply(this,arguments)},xE=function(t){return t.anchors},_E=function(t,e){for(var n,o=xE(e),i=Number.MAX_SAFE_INTEGER,r=0;r<o.length;r++){var a=EE(t.x,t.y,o[r].x,o[r].y);a<i&&(i=a,n={index:r,anchor:bE(bE({},o[r]),{x:o[r].x,y:o[r].y,id:o[r].id})})}return n},EE=function(t,e,n,o){return Math.hypot(t-n,e-o)},wE=function(t,e){var n=!1,o=SE(e);return t.x>=o.minX-0&&t.x<=o.maxX+0&&t.y>=o.minY-0&&t.y<=o.maxY+0&&(n=!0),n},SE=function(t){var e=t.x,n=t.y,o=t.width,i=t.height;return{minX:e-o/2,minY:n-i/2,maxX:e+o/2,maxY:n+i/2,x:e,y:n,width:o,height:i,centerX:e,centerY:n}},CE=function(t,e,n){var o,i=function(t){var e=t,n=e.x,o=e.y,i=e.width,r=e.height,a=e.radius;return[{x:n-i/2+a,y:o-r/2+a,r:a},{x:n+i/2-a,y:o-r/2+a,r:a},{x:n-i/2+a,y:o+r/2-a,r:a},{x:n+i/2-a,y:o+r/2-a,r:a}]}(n),r=Number.MAX_SAFE_INTEGER;return i.forEach((function(e){var n=EE(t.x,t.y,e.x,e.y);n<r&&(r=n,o=e)})),NE(t,e,o)},NE=function(t,e,n){var o,i=n.x,r=n.y,a=n.r;if(e===Cy.HORIZONTAL){var s=i-Math.sqrt(a*a-(t.y-r)*(t.y-r)),l=i+Math.sqrt(a*a-(t.y-r)*(t.y-r));o={x:Math.abs(s-t.x)<Math.abs(l-t.x)?s:l,y:t.y}}else if(e===Cy.VERTICAL){var u=r-Math.sqrt(a*a-(t.x-i)*(t.x-i)),c=r+Math.sqrt(a*a-(t.x-i)*(t.x-i)),d=Math.abs(u-t.y)<Math.abs(c-t.y)?u:c;o={x:t.x,y:d}}return o},TE=function(t,e){var n=e,o=!1,i=n.x,r=n.y,a=n.width,s=n.height,l=n.radius,u=i-a/2+l,c=i+a/2-l,d=r-s/2+l,h=r+s/2-l;return t.y===r+s/2||t.y===r-s/2?o=t.x>u&&t.x<c:t.x!==i+a/2&&t.x!==i-a/2||(o=t.y>d&&t.y<h),o},AE=function(t,e,n){var o,i=n,r=i.x,a=i.y,s=i.rx,l=i.ry;if(e===Cy.HORIZONTAL){var u=r-Math.sqrt(s*s-(t.y-a)*(t.y-a)*s*s/(l*l)),c=r+Math.sqrt(s*s-(t.y-a)*(t.y-a)*s*s/(l*l));o={x:Math.abs(u-t.x)<Math.abs(c-t.x)?u:c,y:t.y}}else if(e===Cy.VERTICAL){var d=a-Math.sqrt(l*l-(t.x-r)*(t.x-r)*l*l/(s*s)),h=a+Math.sqrt(l*l-(t.x-r)*(t.x-r)*l*l/(s*s)),p=Math.abs(d-t.y)<Math.abs(h-t.y)?d:h;o={x:t.x,y:p}}return o},ME=function(t,e,n){for(var o,i=n.pointsPosition,r=Number.MAX_SAFE_INTEGER,a=[],s=0;s<i.length;s++)a.push({start:i[s],end:i[(s+1)%i.length]});return a.forEach((function(n){var i=n.start,a=n.end,s=i,l=a;i.x>a.x&&(s=a,l=i);var u={x:t.x,y:t.y};if(s.x===l.x&&e===Cy.HORIZONTAL&&(u={x:s.x,y:t.y}),s.y===l.y&&e===Cy.VERTICAL&&(u={x:t.x,y:s.y}),s.x!==l.x&&s.y!==l.y){var c=(l.y-s.y)/(l.x-s.x),d=(s.x*l.y-l.x*s.y)/(s.x-l.x);e===Cy.HORIZONTAL?u={x:(t.y-d)/c,y:t.y}:e===Cy.VERTICAL&&(u={x:t.x,y:c*t.x+d})}if(ky(u,i,a)){var h=EE(u.x,u.y,t.x,t.y);h<r&&(r=h,o=u)}})),o},OE=function(t){return yh(t,["id","type","x","y","text","label","properties","virtual","rotate","resizable","rotatable"])},PE=function(t,e,n,o){var i=t.x,r=t.y;return e.x>t.x?i=t.x+n/2:e.x<t.x&&(i=t.x-n/2),e.y>t.y?r=t.y+o/2:e.y<t.y&&(r=t.y-o/2),{x:i,y:r}},kE=function(t){var e=t.rows,n=t.rowsLength,o=t.fontSize,i=0;return e&&e.forEach((function(t){var e=function(t){if(!t)return 0;for(var e=0,n=0;n<t.length;n++){var o=t.charCodeAt(n);t.match(/[A-Z]/)?e+=1.5:e+=o>=1&&o<=126||o>=65376&&o<=65439?1:2}return e}(t);i=e>i?e:i})),{width:Math.ceil(i/2)*o+o/4,height:n*(o+2)+o/4}};let RE;const DE=new Uint8Array(16);function LE(){if(!RE&&(RE="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!RE))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return RE(DE)}var IE=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const jE=[];for(let t=0;t<256;++t)jE.push((t+256).toString(16).slice(1));function BE(t,e=0){return jE[t[e+0]]+jE[t[e+1]]+jE[t[e+2]]+jE[t[e+3]]+"-"+jE[t[e+4]]+jE[t[e+5]]+"-"+jE[t[e+6]]+jE[t[e+7]]+"-"+jE[t[e+8]]+jE[t[e+9]]+"-"+jE[t[e+10]]+jE[t[e+11]]+jE[t[e+12]]+jE[t[e+13]]+jE[t[e+14]]+jE[t[e+15]]}function HE(t){if(!function(t){return"string"==typeof t&&IE.test(t)}(t))throw TypeError("Invalid UUID");let e;const n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n}function FE(t,e,n){function o(t,o,i,r){var a;if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));const e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof o&&(o=HE(o)),16!==(null===(a=o)||void 0===a?void 0:a.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let s=new Uint8Array(16+t.length);if(s.set(o),s.set(t,o.length),s=n(s),s[6]=15&s[6]|e,s[8]=63&s[8]|128,i){r=r||0;for(let t=0;t<16;++t)i[r+t]=s[t];return i}return BE(s)}try{o.name=t}catch(t){}return o.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",o.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",o}function zE(t){return 14+(t+64>>>9<<4)+1}function WE(t,e){const n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function GE(t,e,n,o,i,r){return WE((a=WE(WE(e,t),WE(o,r)))<<(s=i)|a>>>32-s,n);var a,s}function UE(t,e,n,o,i,r,a){return GE(e&n|~e&o,t,e,i,r,a)}function XE(t,e,n,o,i,r,a){return GE(e&o|n&~o,t,e,i,r,a)}function VE(t,e,n,o,i,r,a){return GE(e^n^o,t,e,i,r,a)}function YE(t,e,n,o,i,r,a){return GE(n^(e|~o),t,e,i,r,a)}FE("v3",48,(function(t){if("string"==typeof t){const e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n)}return function(t){const e=[],n=32*t.length,o="0123456789abcdef";for(let i=0;i<n;i+=8){const n=t[i>>5]>>>i%32&255,r=parseInt(o.charAt(n>>>4&15)+o.charAt(15&n),16);e.push(r)}return e}(function(t,e){t[e>>5]|=128<<e%32,t[zE(e)-1]=e;let n=1732584193,o=-271733879,i=-1732584194,r=271733878;for(let e=0;e<t.length;e+=16){const a=n,s=o,l=i,u=r;n=UE(n,o,i,r,t[e],7,-680876936),r=UE(r,n,o,i,t[e+1],12,-389564586),i=UE(i,r,n,o,t[e+2],17,606105819),o=UE(o,i,r,n,t[e+3],22,-1044525330),n=UE(n,o,i,r,t[e+4],7,-176418897),r=UE(r,n,o,i,t[e+5],12,1200080426),i=UE(i,r,n,o,t[e+6],17,-1473231341),o=UE(o,i,r,n,t[e+7],22,-45705983),n=UE(n,o,i,r,t[e+8],7,1770035416),r=UE(r,n,o,i,t[e+9],12,-1958414417),i=UE(i,r,n,o,t[e+10],17,-42063),o=UE(o,i,r,n,t[e+11],22,-1990404162),n=UE(n,o,i,r,t[e+12],7,1804603682),r=UE(r,n,o,i,t[e+13],12,-40341101),i=UE(i,r,n,o,t[e+14],17,-1502002290),o=UE(o,i,r,n,t[e+15],22,1236535329),n=XE(n,o,i,r,t[e+1],5,-165796510),r=XE(r,n,o,i,t[e+6],9,-1069501632),i=XE(i,r,n,o,t[e+11],14,643717713),o=XE(o,i,r,n,t[e],20,-373897302),n=XE(n,o,i,r,t[e+5],5,-701558691),r=XE(r,n,o,i,t[e+10],9,38016083),i=XE(i,r,n,o,t[e+15],14,-660478335),o=XE(o,i,r,n,t[e+4],20,-405537848),n=XE(n,o,i,r,t[e+9],5,568446438),r=XE(r,n,o,i,t[e+14],9,-1019803690),i=XE(i,r,n,o,t[e+3],14,-187363961),o=XE(o,i,r,n,t[e+8],20,1163531501),n=XE(n,o,i,r,t[e+13],5,-1444681467),r=XE(r,n,o,i,t[e+2],9,-51403784),i=XE(i,r,n,o,t[e+7],14,1735328473),o=XE(o,i,r,n,t[e+12],20,-1926607734),n=VE(n,o,i,r,t[e+5],4,-378558),r=VE(r,n,o,i,t[e+8],11,-2022574463),i=VE(i,r,n,o,t[e+11],16,1839030562),o=VE(o,i,r,n,t[e+14],23,-35309556),n=VE(n,o,i,r,t[e+1],4,-1530992060),r=VE(r,n,o,i,t[e+4],11,1272893353),i=VE(i,r,n,o,t[e+7],16,-155497632),o=VE(o,i,r,n,t[e+10],23,-1094730640),n=VE(n,o,i,r,t[e+13],4,681279174),r=VE(r,n,o,i,t[e],11,-358537222),i=VE(i,r,n,o,t[e+3],16,-722521979),o=VE(o,i,r,n,t[e+6],23,76029189),n=VE(n,o,i,r,t[e+9],4,-640364487),r=VE(r,n,o,i,t[e+12],11,-421815835),i=VE(i,r,n,o,t[e+15],16,530742520),o=VE(o,i,r,n,t[e+2],23,-995338651),n=YE(n,o,i,r,t[e],6,-198630844),r=YE(r,n,o,i,t[e+7],10,1126891415),i=YE(i,r,n,o,t[e+14],15,-1416354905),o=YE(o,i,r,n,t[e+5],21,-57434055),n=YE(n,o,i,r,t[e+12],6,1700485571),r=YE(r,n,o,i,t[e+3],10,-1894986606),i=YE(i,r,n,o,t[e+10],15,-1051523),o=YE(o,i,r,n,t[e+1],21,-2054922799),n=YE(n,o,i,r,t[e+8],6,1873313359),r=YE(r,n,o,i,t[e+15],10,-30611744),i=YE(i,r,n,o,t[e+6],15,-1560198380),o=YE(o,i,r,n,t[e+13],21,1309151649),n=YE(n,o,i,r,t[e+4],6,-145523070),r=YE(r,n,o,i,t[e+11],10,-1120210379),i=YE(i,r,n,o,t[e+2],15,718787259),o=YE(o,i,r,n,t[e+9],21,-343485551),n=WE(n,a),o=WE(o,s),i=WE(i,l),r=WE(r,u)}return[n,o,i,r]}(function(t){if(0===t.length)return[];const e=8*t.length,n=new Uint32Array(zE(e));for(let o=0;o<e;o+=8)n[o>>5]|=(255&t[o/8])<<o%32;return n}(t),8*t.length))}));var qE={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function KE(t,e,n){if(qE.randomUUID&&!e&&!t)return qE.randomUUID();const o=(t=t||{}).random||(t.rng||LE)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e){n=n||0;for(let t=0;t<16;++t)e[n+t]=o[t];return e}return BE(o)}function ZE(t,e,n,o){switch(t){case 0:return e&n^~e&o;case 1:case 3:return e^n^o;case 2:return e&n^e&o^n&o}}function $E(t,e){return t<<e|t>>>32-e}FE("v5",80,(function(t){const e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){const e=unescape(encodeURIComponent(t));t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);const o=t.length/4+2,i=Math.ceil(o/16),r=new Array(i);for(let e=0;e<i;++e){const n=new Uint32Array(16);for(let o=0;o<16;++o)n[o]=t[64*e+4*o]<<24|t[64*e+4*o+1]<<16|t[64*e+4*o+2]<<8|t[64*e+4*o+3];r[e]=n}r[i-1][14]=8*(t.length-1)/Math.pow(2,32),r[i-1][14]=Math.floor(r[i-1][14]),r[i-1][15]=8*(t.length-1)&4294967295;for(let t=0;t<i;++t){const o=new Uint32Array(80);for(let e=0;e<16;++e)o[e]=r[t][e];for(let t=16;t<80;++t)o[t]=$E(o[t-3]^o[t-8]^o[t-14]^o[t-16],1);let i=n[0],a=n[1],s=n[2],l=n[3],u=n[4];for(let t=0;t<80;++t){const n=Math.floor(t/20),r=$E(i,5)+ZE(n,a,s,l)+u+e[n]+o[t]>>>0;u=l,l=s,s=$E(a,30)>>>0,a=i,i=r}n[0]=n[0]+i>>>0,n[1]=n[1]+a>>>0,n[2]=n[2]+s>>>0,n[3]=n[3]+l>>>0,n[4]=n[4]+u>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}));var JE=function(){return KE()},QE={baseNode:{fill:"#fff",stroke:"#000",strokeWidth:2},baseEdge:{stroke:"#000",strokeWidth:2},rect:{},circle:{},diamond:{},ellipse:{},polygon:{},text:{color:"#000",stroke:"none",fontSize:12,background:{fill:"transparent"}},anchor:{stroke:"#000",fill:"#fff",r:4,hover:{r:10,fill:"#949494",fillOpacity:.5,stroke:"#949494"}},anchorLine:{stroke:"#000",strokeWidth:2,strokeDasharray:"3,2"},nodeText:{color:"#000",overflowMode:"default",fontSize:12,lineHeight:1.2},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"#fff"}},line:{},polyline:{},bezier:{fill:"none",adjustLine:{stroke:"#949494"},adjustAnchor:{r:4,fill:"#949494",fillOpacity:1,stroke:"#949494"}},arrow:{offset:10,verticalLength:5},snapline:{stroke:"#949494",strokeWidth:1},edgeAdjust:{r:4,fill:"#fff",stroke:"#949494",strokeWidth:2},outline:{fill:"transparent",stroke:"#949494",strokeDasharray:"3,3",hover:{stroke:"#949494"}},edgeAnimation:{stroke:"red",strokeDasharray:"10,10",strokeDashoffset:"100%",animationName:"lf_animate_dash",animationDuration:"20s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"normal"},rotateControl:{stroke:"#000",fill:"#fff",strokeWidth:1.5},resizeControl:{width:7,height:7,fill:"#fff",stroke:"#000"},resizeOutline:{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},tw=function(t){var e=Is(QE);return t&&(e=md(e,t)),e},ew=tw,nw=1e3,ow=999,iw=function(){return++nw},rw=function(){return--ow},aw=function(){return aw=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},aw.apply(this,arguments)},sw=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a};function lw(t){var e=t.x,n=t.y,o=t.width,i=t.height,r=t.className,a=t.strokeWidth,s=t.radius,l=void 0===s?0:s,u=e-o/2,c=n-i/2,d={};return d["stroke-width"]=a,xu(Tu(t),(function(t){var e=sw(t,2),n=e[0],o=e[1];"object"!=typeof o&&(d[n]=o)})),d.className=r?"lf-basic-shape ".concat(r):"lf-basic-shape",l&&(d.rx=l,d.ry=l),d.x=u,d.y=c,fg("rect",aw({},d))}var uw,cw=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),dw=function(){return dw=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},dw.apply(this,arguments)},hw=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(t);i<o.length;i++)e.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(t,o[i])&&(n[o[i]]=t[o[i]])}return n},pw=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a};!function(t){t[t.LEFT_TOP=0]="LEFT_TOP",t[t.RIGHT_TOP=1]="RIGHT_TOP",t[t.RIGHT_BOTTOM=2]="RIGHT_BOTTOM",t[t.LEFT_BOTTOM=3]="LEFT_BOTTOM"}(uw||(uw={}));var fw=function(t){function e(e){var n=t.call(this)||this;n.updateEdgePointByAnchors=function(){var t=n.nodeModel,e=t.id,o=t.anchors;xu(n.graphModel.getNodeEdges(e),(function(t){if(t.sourceNodeId===e)(n=Uu(o,(function(e){return e.id===t.sourceAnchorId})))&&t.updateStartPoint({x:n.x,y:n.y});else if(t.targetNodeId===e){var n;(n=Uu(o,(function(e){return e.id===t.targetAnchorId})))&&t.updateEndPoint({x:n.x,y:n.y})}}))},n.triggerResizeEvent=function(t,e,o,i,r,a){n.graphModel.eventCenter.emit(wy.NODE_RESIZE,{preData:t,data:e,deltaX:o,deltaY:i,index:r,model:a})},n.recalcResizeInfo=function(t,e,n,o,i){void 0===n&&(n=1),void 0===o&&(o=!1),void 0===i&&(i=!1);var r=Is(e),a=r.deltaX,s=r.deltaY,l=r.width,u=r.height,c=r.PCTResizeInfo;if(c){var d=0,h=0;switch(t){case uw.LEFT_TOP:h=(-1*a-s)/4;break;case uw.RIGHT_TOP:h=(a-s)/4;break;case uw.RIGHT_BOTTOM:h=(a+s)/4;break;case uw.LEFT_BOTTOM:h=(-1*a+s)/4}0!==h&&(d=Math.round(h/c.ResizeBasis.basisHeight*1e5)/1e3),c.ResizePCT.widthPCT=Math.max(Math.min(c.ResizePCT.widthPCT+d,c.ScaleLimit.maxScaleLimit),c.ScaleLimit.minScaleLimit),c.ResizePCT.heightPCT=Math.max(Math.min(c.ResizePCT.heightPCT+d,c.ScaleLimit.maxScaleLimit),c.ScaleLimit.minScaleLimit);var p=Math.round(c.ResizePCT.widthPCT*c.ResizeBasis.basisWidth/100),f=Math.round(c.ResizePCT.heightPCT*c.ResizeBasis.basisHeight/100);switch(t){case uw.LEFT_TOP:a=l-p,s=u-f;break;case uw.RIGHT_TOP:a=p-l,s=u-f;break;case uw.RIGHT_BOTTOM:a=p-l,s=f-u;break;case uw.LEFT_BOTTOM:a=l-p,s=f-u}return r}switch(t){case uw.LEFT_TOP:r.width=o?l:l-a*n,r.height=i?u:u-s*n;break;case uw.RIGHT_TOP:r.width=o?l:l+a*n,r.height=i?u:u-s*n;break;case uw.RIGHT_BOTTOM:r.width=o?l:l+a*n,r.height=i?u:u+s*n;break;case uw.LEFT_BOTTOM:r.width=o?l:l-a*n,r.height=i?u:u+s*n}return r},n.resizeNode=function(t){var e=t.deltaX,o=t.deltaY,i=n.index,r=n.props,a=r.model,s=r.graphModel;gw({deltaX:e,deltaY:o,index:i,nodeModel:a,graphModel:s,cancelCallback:function(){n.dragHandler.cancelDrag()}})},n.onDragging=function(t){var e=t.deltaX,o=t.deltaY,i=n.graphModel.transformModel,r=pw(i.fixDeltaXY(e,o),2),a=r[0],s=r[1];n.resizeNode({deltaX:a,deltaY:s})},n.onDragEnd=function(){var t=n.nodeModel.x,e=n.nodeModel.y;n.nodeModel.moveTo(t,e),n.updateEdgePointByAnchors()};var o=e.index,i=e.model,r=e.graphModel;return n.index=o,n.nodeModel=i,n.graphModel=r,n.dragHandler=new Py({onDragging:n.onDragging,onDragEnd:n.onDragEnd,step:r.gridSize}),n}return cw(e,t),e.prototype.render=function(){var t=this.props,e=t.x,n=t.y,o=t.direction,i=t.model.getResizeControlStyle(),r=i.width,a=i.height,s=hw(i,["width","height"]);return fg("g",{className:"lf-resize-control lf-resize-control-".concat(o),children:[fg(lw,dw({className:"lf-resize-control-content",x:e,y:n,width:null!=r?r:7,height:null!=a?a:7},s)),fg(lw,{className:"lf-resize-control-content",x:e,y:n,width:25,height:25,fill:"transparent",stroke:"transparent",onMouseDown:this.dragHandler.handleMouseDown})]})},e}(qf);!function(t){function e(){return t.call(this)||this}cw(e,t),e.prototype.getResizeControl=function(){var t=this.props,e=t.model,n=t.graphModel,o=SE(e),i=o.minX,r=o.minY,a=o.maxX,s=o.maxY;return Ju([{index:uw.LEFT_TOP,direction:"nw",x:i,y:r},{index:uw.RIGHT_TOP,direction:"ne",x:a,y:r},{index:uw.RIGHT_BOTTOM,direction:"se",x:a,y:s},{index:uw.LEFT_BOTTOM,direction:"sw",x:i,y:s}],(function(t){return fg(fw,dw({},t,{model:e,graphModel:n}))}))},e.prototype.getResizeOutline=function(){var t=this.props.model,e=t.x,n=t.y,o=t.width,i=t.height,r=t.getResizeOutlineStyle();return fg(lw,dw({},r,{x:e,y:n,width:o,height:i}))},e.prototype.render=function(){return fg("g",{className:"lf-resize-control-group",children:[this.getResizeOutline(),this.getResizeControl()]})}}(qf);var gw=function(t){var e=t.deltaX,n=t.deltaY,o=t.index,i=t.nodeModel,r=t.graphModel,a=t.cancelCallback,s=i.r,l=i.rx,u=i.ry,c=i.width,d=i.height,h=i.PCTResizeInfo,p=i.minWidth,f=i.minHeight,g=i.maxWidth,v=i.maxHeight,y=p===g,m=function(t,e,n,o,i){void 0===n&&(n=1),void 0===o&&(o=!1),void 0===i&&(i=!1);var r=Is(e),a=r.deltaX,s=r.deltaY,l=r.width,u=r.height,c=r.PCTResizeInfo;if(c){var d=0,h=0;switch(t){case uw.LEFT_TOP:h=(-1*a-s)/4;break;case uw.RIGHT_TOP:h=(a-s)/4;break;case uw.RIGHT_BOTTOM:h=(a+s)/4;break;case uw.LEFT_BOTTOM:h=(-1*a+s)/4}0!==h&&(d=Math.round(h/c.ResizeBasis.basisHeight*1e5)/1e3),c.ResizePCT.widthPCT=Math.max(Math.min(c.ResizePCT.widthPCT+d,c.ScaleLimit.maxScaleLimit),c.ScaleLimit.minScaleLimit),c.ResizePCT.heightPCT=Math.max(Math.min(c.ResizePCT.heightPCT+d,c.ScaleLimit.maxScaleLimit),c.ScaleLimit.minScaleLimit);var p=Math.round(c.ResizePCT.widthPCT*c.ResizeBasis.basisWidth/100),f=Math.round(c.ResizePCT.heightPCT*c.ResizeBasis.basisHeight/100);switch(t){case uw.LEFT_TOP:a=l-p,s=u-f;break;case uw.RIGHT_TOP:a=p-l,s=u-f;break;case uw.RIGHT_BOTTOM:a=p-l,s=f-u;break;case uw.LEFT_BOTTOM:a=l-p,s=f-u}return r}switch(t){case uw.LEFT_TOP:r.width=o?l:l-a*n,r.height=i?u:u-s*n;break;case uw.RIGHT_TOP:r.width=o?l:l+a*n,r.height=i?u:u-s*n;break;case uw.RIGHT_BOTTOM:r.width=o?l:l+a*n,r.height=i?u:u+s*n;break;case uw.LEFT_BOTTOM:r.width=o?l:l-a*n,r.height=i?u:u+s*n}return r}(o,{width:s||l||c,height:s||u||d,deltaX:e,deltaY:n,PCTResizeInfo:h},s||l&&u?.5:1,y,f===v);if(m.width<p||m.width>g||m.height<f||m.height>v)null==a||a();else{m.deltaX=y?0:m.deltaX,m.deltaY=y?0:m.deltaY;var b=i.getData(),x=i.resize(m);!function(t,e){var n=t.id,o=t.anchors;xu(e.getNodeEdges(n),(function(t){if(t.sourceNodeId===n)(e=Uu(o,(function(e){return e.id===t.sourceAnchorId})))&&t.updateStartPoint({x:e.x,y:e.y});else if(t.targetNodeId===n){var e;(e=Uu(o,(function(e){return e.id===t.targetAnchorId})))&&t.updateEndPoint({x:e.x,y:e.y})}}))}(i,r),function(t,e,n,o,i,r,a){a.eventCenter.emit(wy.NODE_RESIZE,{preData:t,data:e,deltaX:n,deltaY:o,index:i,model:r})}(b,x,e,n,o,i,r)}},vw=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.componentDidMount=function(){t.prototype.componentDidMount.call(this);var e=this.props,n=e.model,o=e.graphModel,i=o.eventCenter;i.on("node:rotate",(function(t){var e=t.model;e.id===n.id&&xu(Array.from(n.children),(function(t){var n=o.getNodeModelById(t);n&&(n.rotate=e.rotate)}))})),i.on("node:resize",(function(t){var e=t.deltaX,i=t.deltaY,r=t.index;t.model.id===n.id&&xu(Array.from(n.children),(function(t){var n=o.getNodeModelById(t);n&&gw({deltaX:e,deltaY:i,index:r,nodeModel:n,graphModel:o,cancelCallback:function(){}})}))}))},n.prototype.getResizeControl=function(){var e=this.props.model,n=e.resizable,o=e.isCollapsed;return n&&!o?t.prototype.getResizeControl.call(this):null},n.prototype.getAppendAreaShape=function(){var t=this.props.model,n=t.width,o=t.height,i=t.x,r=t.y,a=t.radius;if(!t.groupAddable)return null;var s=t.getNodeStyle().strokeWidth,l=void 0===s?0:s,u=t.getAddableOutlineStyle(),c=n+l+8,d=o+l+8;return e.h("rect",g(g({},u),{width:c,height:d,x:i-c/2,y:r-d/2,rx:a,ry:a}))},n.prototype.getCollapseIcon=function(t,e){return"M ".concat(t+3,",").concat(e+6," ").concat(t+11,",").concat(e+6," M").concat(t+7,",").concat(e+2," ").concat(t+7,",").concat(e+10)},n.prototype.getExpandIcon=function(t,e){return"M ".concat(t+3,",").concat(e+6," ").concat(t+11,",").concat(e+6," ")},n.prototype.getOperateIcon=function(){var t=this.props.model,n=t.x,o=t.y,i=n-t.width/2+10,r=o-t.height/2+10;if(!t.collapsible)return null;var a=(null==t?void 0:t.isCollapsed)?this.getCollapseIcon(i,r):this.getExpandIcon(i,r),s=e.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:a});return e.h("g",{},[e.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#f4f5f6",stroke:"#cecece",cursor:"pointer",x:i,y:r,onClick:function(){t.toggleCollapse(!t.isCollapsed)}}),s])},n.prototype.getShape=function(){return e.h("g",{},[this.getAppendAreaShape(),t.prototype.getShape.call(this),this.getOperateIcon()])},n}(e.RectNode),yw=function(t){function n(e,n){var o=t.call(this,e,n)||this;return o.isGroup=!0,o.isRestrict=!1,o.collapsible=!0,o.isCollapsed=!1,o.groupAddable=!1,o.transformWidthContainer=!0,o.childrenLastCollapseStateDict={},o.initNodeData(e),o.setAttributes(),o}return f(n,t),n.prototype.initNodeData=function(e){var n;t.prototype.initNodeData.call(this,e);var o=null!==(n=e.properties)&&void 0!==n?n:{},i=o.children,r=o.width,a=o.height,s=o.collapsedWidth,l=o.collapsedHeight,u=o.collapsible,c=o.isCollapsed,d=o.zIndex,h=o.isRestrict,p=o.autoToFront;this.children=i?new Set(i):new Set,this.zIndex=null!=d?d:-1e4,this.isCollapsed=null!=c&&c;var f=null!=r?r:400,g=null!=a?a:230;this.width=f,this.height=g,this.expandWidth=f,this.expandHeight=g,this.collapsedWidth=null!=s?s:80,this.collapsedHeight=null!=l?l:60,this.isRestrict=null!=h&&h,this.collapsible=null==u||u,this.autoToFront=null!=p&&p,this.text.editable=!1,this.text.draggable=!1},n.prototype.setAttributes=function(){t.prototype.setAttributes.call(this),this.isCollapsed&&this.toggleCollapse(!0)},n.prototype.getData=function(){var e=this,n=t.prototype.getData.call(this),o=[];return xu(Array.from(this.children),(function(t){var n=e.graphModel.getNodeModelById(t);n&&!n.virtual&&o.push(t)})),n.children=o,n.properties&&(n.properties.children=o,n.properties.isCollapsed=this.isCollapsed),n},n.prototype.getHistoryData=function(){var e=t.prototype.getHistoryData.call(this);e.children=Array.from(this.children),e.isGroup=!0;var n=this,o=n.x,i=n.y,r=n.collapsedWidth,a=n.collapsedHeight,s=n.expandWidth,l=n.expandHeight;return n.isCollapsed&&(e.x=o+s/2-r/2,e.y=i+l/2-a/2),e},n.prototype.toggleCollapse=function(t){var n=this,o=!!t;this.isCollapsed=o,o?this.collapse():this.expand();var i=E(E([],_(this.incoming.edges),!1),_(this.outgoing.edges),!1);console.log("this --\x3e>",this),console.log("this.children --\x3e>",this.children),xu(Array.from(this.children),(function(o){var r=n.graphModel.getElement(o);if(r){var a=r.isCollapsed;if(r.isGroup){var s=r;if(s.isCollapsed||s.toggleCollapse(t),!t){var l=n.childrenLastCollapseStateDict[o];void 0!==l&&l!==r.isCollapsed&&s.toggleCollapse(l)}}if(n.childrenLastCollapseStateDict[o]=!!a,r.visible=!t,r.BaseType===e.ElementType.NODE){var u=r.incoming.edges,c=r.outgoing.edges;i=E(E(E([],_(i),!1),_(u),!1),_(c),!1)}}})),this.collapseEdge(o,i)},n.prototype.collapse=function(){var t=this,e=t.x,n=t.y,o=t.text,i=t.width,r=t.height,a=t.collapsedWidth,s=t.collapsedHeight;this.x=e-i/2+a/2,this.y=n-r/2+s/2,this.text.x=o.x-i/2+a/2,this.text.y=o.y-r/2+s/2,this.expandWidth=i,this.expandHeight=r,this.width=a,this.height=s},n.prototype.expand=function(){var t=this,e=t.x,n=t.y,o=t.text,i=t.expandWidth,r=t.expandHeight,a=t.collapsedWidth,s=t.collapsedHeight;this.width=i,this.height=r,this.x=e+this.width/2-a/2,this.y=n+this.height/2-s/2,this.text.x=o.x+this.width/2-a/2,this.text.y=o.y+this.height/2-s/2},n.prototype.createVirtualEdge=function(t){t.pointsList=void 0;var e=this.graphModel.addEdge(t);e.virtual=!0,e.text.editable=!1,e.isCollapsedEdge=!0},n.prototype.collapseEdge=function(t,e){var n=this,o=this.graphModel;xu(e,(function(e,i){var r,a=e.getData(),s=a.targetNodeId,l=a.sourceNodeId,u=g(g({},a),{id:"".concat(a.id,"__").concat(i),text:null===(r=a.text)||void 0===r?void 0:r.value});e.virtual&&o.deleteEdgeById(e.id);var c=o.group.getGroupByNodeId(s);c||(c=o.getNodeModelById(s));var d=o.group.getGroupByNodeId(l);d||(d=o.getNodeModelById(l)),t&&e.visible&&(n.children.has(l)||n.id===l?(u.startPoint=void 0,u.sourceNodeId=n.id):(u.endPoint=void 0,u.targetNodeId=n.id),c.id===n.id&&d.id===n.id||n.createVirtualEdge(u),e.visible=!1),t||e.visible||(c&&c.isGroup&&c.isCollapsed?(u.targetNodeId=c.id,u.endPoint=void 0,n.createVirtualEdge(u)):d&&d.isGroup&&d.isCollapsed?(u.sourceNodeId=d.id,u.startPoint=void 0,n.createVirtualEdge(u)):e.visible=!0)}))},n.prototype.isAllowAppendIn=function(t){return console.info("_nodeData",t),!0},n.prototype.setAllowAppendChild=function(t){this.groupAddable=t},n.prototype.addChild=function(t){this.children.add(t);var e=this.getData();this.graphModel.eventCenter.emit("group:add-node",{data:e})},n.prototype.removeChild=function(t){this.children.delete(t);var e=this.getData();this.graphModel.eventCenter.emit("group:remove-node",{data:e})},n.prototype.toBack=function(){this.zIndex--},n.prototype.getResizeOutlineStyle=function(){var e=t.prototype.getResizeOutlineStyle.call(this);return e.stroke="none",e},n.prototype.getAnchorStyle=function(){var e=t.prototype.getAnchorStyle.call(this);return e.stroke="transparent",e.fill="transparent",e.hover&&(e.hover.fill="transparent",e.hover.stroke="transparent"),e},n.prototype.getAddableOutlineStyle=function(){return{stroke:"#feb663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},y([e.observable],n.prototype,"isCollapsed",void 0),y([e.observable],n.prototype,"groupAddable",void 0),y([e.observable],n.prototype,"transformWidthContainer",void 0),n}(e.RectNodeModel);var mw,bw={type:"dynamic-group",view:vw,model:yw},xw=-1e4,_w=function(){function t(t){var e=t.lf,n=t.options,o=this;this.topGroupZIndex=xw,this.nodeGroupMap=new Map,this.addNodeToGroup=function(t){var e=t.data,n=o.nodeGroupMap.get(e.id);n&&((s=o.lf.getNodeModelById(n)).removeChild(e.id),o.nodeGroupMap.delete(e.id),s.setAllowAppendChild(!1));var i=o.lf.getNodeModelById(e.id),r=null==i?void 0:i.getBounds();if(i&&r){if(i.isGroup){var a=i;xu(Array.from(a.children),(function(t){o.nodeGroupMap.set(t,e.id)})),o.calibrateTopGroupZIndex([e]),o.onNodeSelect({data:e,isSelected:!1,isMultiple:!1})}var s;if(s=o.getGroupByBounds(r,e)){var l=s.isAllowAppendIn(e);console.log("isAllowAppendIn",l),l?(s.addChild(e.id),o.nodeGroupMap.set(e.id,s.id),s.setAllowAppendChild(!0)):o.lf.emit("group:not-allowed",{group:s.getData(),node:e})}}},this.removeNodeFromGroup=function(t){var e=t.data;e.isGroup&&e.children&&xu(Array.from(e.children),(function(t){o.nodeGroupMap.delete(t),o.lf.deleteNode(t)}));var n=o.nodeGroupMap.get(e.id);if(n){var i=o.lf.getNodeModelById(n);i&&i.removeChild(e.id),o.nodeGroupMap.delete(e.id)}},this.setActiveGroup=function(t){var e=t.data,n=o.lf.getNodeModelById(e.id),i=null==n?void 0:n.getBounds();if(n&&i){var r=o.getGroupByBounds(i,e);if(o.activeGroup&&o.activeGroup.setAllowAppendChild(!1),!r||n.isGroup&&r.id===e.id)return;if(!r.isAllowAppendIn(e))return;o.activeGroup=r,console.log("this.activeGroup",o.activeGroup),o.activeGroup.setAllowAppendChild(!0)}},this.onNodeSelect=function(t){var e=t.data,n=t.isMultiple,i=t.isSelected,r=o.lf.getNodeModelById(e.id);if(o.sendNodeToFront(r),o.topGroupZIndex>-1e3){var a=o.lf.graphModel.nodes;o.topGroupZIndex=xw;var s=Jh(Fu(a,(function(t){return!!t.isGroup})),"zIndex"),l=0;xu(s,(function(t){t.zIndex!==l&&(o.topGroupZIndex++,l=t.zIndex),t.setZIndex(o.topGroupZIndex)}))}if(n&&i)if(null==r?void 0:r.isGroup){var u=r.children;xu(Array.from(u),(function(t){var e=o.lf.getNodeModelById(t);null==e||e.setSelected(!1)}))}else{var c=o.nodeGroupMap.get(e.id);if(c){var d=o.lf.getNodeModelById(c);(null==d?void 0:d.isSelected)&&(null==r||r.setSelected(!1))}}},this.onGraphRendered=function(t){var e=t.data;console.log("data",e),xu(e.nodes,(function(t){t.children&&xu(t.children,(function(e){o.nodeGroupMap.set(e,t.id)}))})),o.calibrateTopGroupZIndex(e.nodes)},e.register(bw),this.lf=e,console.log("options",n),li(this,n),this.init()}return t.prototype.getNodesInGroup=function(t){var e=this,n=[];return t.isGroup&&xu(Array.from(t.children),(function(t){n.push(t);var o=e.lf.getNodeModelById(t);(null==o?void 0:o.isGroup)&&(n=n.concat(e.getNodesInGroup(o)))})),n},t.prototype.getGroupByNodeId=function(t){var e=this.nodeGroupMap.get(t);if(e)return this.lf.getNodeModelById(e)},t.prototype.getGroupByBounds=function(t,e){var n=Fu(this.lf.graphModel.nodes,(function(n){return!!n.isGroup&&function(t,e){var n=t.minX,o=t.minY,i=t.maxX,r=t.maxY,a=e.x,s=e.y,l=e.width,u=e.height;return n>=a-l/2&&i<=a+l/2&&o>=s-u/2&&r<=s+u/2}(t,n)&&n.id!==e.id})),o=n.length;if(o<=1)return n[0];for(var i=n[o-1],r=o-2;r>=0;r--)i=n[r];return i},t.prototype.sendNodeToFront=function(t){var e=this;if(t&&t.isGroup&&(this.topGroupZIndex++,t.setZIndex(this.topGroupZIndex),t.children)){var n=t.children;xu(Array.from(n),(function(t){var n=e.lf.getNodeModelById(t);e.sendNodeToFront(n)}))}},t.prototype.getMaxZIndex=function(t){var e=this,n=xw;if(t.isGroup&&(n=Math.max(n,t.zIndex)),t.children){var o=t.children;xu(Array.from(o),(function(t){var o=e.lf.getNodeModelById(t);if(null==o?void 0:o.isGroup){var i=e.getMaxZIndex(o);n=Math.max(n,i)}}))}return n},t.prototype.calibrateTopGroupZIndex=function(t){var e=this,n=xw;if(xu(t,(function(t){var o=e.lf.getNodeModelById(t.id);if(o){var i=e.getMaxZIndex(o);i>n&&(n=i)}})),!(this.topGroupZIndex>=n)){var o=Fu(this.lf.graphModel.nodes,(function(t){return!!t.isGroup})),i=this.topGroupZIndex;xu(o,(function(t){t.zIndex>i&&(i=t.zIndex)})),this.topGroupZIndex=i}},t.prototype.initGroupChildNodes=function(t,n,o,i){var r=this,a=[],s=[],l=[];xu(Array.from(n),(function(u){var c=r.lf.getNodeModelById(u);if(c){var d=c.getData(),h=e.EventType.NODE_GROUP_COPY||"node:group-copy-add",p=e.transformNodeData(d,i),f=r.lf.addNode(p,h);if(o.addChild(f.id),t[u]=f.id,a.push(f),l.push.apply(l,E([],_(E(E([],_(f.incoming.edges),!1),_(f.outgoing.edges),!1)),!1)),n instanceof Set){var g=r.initGroupChildNodes(t,n,f,i),v=g.childNodes,y=g.edgesData;a.push.apply(a,E([],_(v),!1)),s.push.apply(s,E([],_(y),!1))}}})),console.log("allRelatedEdges --\x3e>",l);var u=Ju(Fu(l,(function(e){return fc(t,e.sourceNodeId)&&fc(t,e.targetNodeId)})),(function(t){return t.getData()}));return{childNodes:a,edgesData:s.concat(u)}},t.prototype.createEdge=function(t,n,o){var i,r,a=t.sourceNodeId,s=t.targetNodeId,l=null!==(i=n[a])&&void 0!==i?i:a,u=null!==(r=n[s])&&void 0!==r?r:s,c=Is(t);return t.id&&"object"==typeof t.text&&null!==t.text&&(c=e.transformEdgeData(t,o)),this.lf.graphModel.addEdge(g(g({},c),{sourceNodeId:l,targetNodeId:u}))},t.prototype.init=function(){var t=this,e=this.lf,n=e.graphModel;n.addNodeMoveRules((function(e,o,i){if(e.isGroup){var r=t.getNodesInGroup(e);return n.moveNodes(r,o,i,!0),!0}var a=t.nodeGroupMap.get(e.id),s=t.lf.getNodeModelById(a);return!s||!s.isRestrict||function(t,e){var n=t.minX,o=t.minY,i=t.maxX,r=t.maxY,a=e.x,s=e.y,l=e.width,u=e.height;return{x:n>=a-l/2&&i<=a+l/2,y:o>=s-u/2&&r<=s+u/2}}(e.getBounds(),s)})),n.group=this,e.on("node:add,node:drop,node:dnd-add",this.addNodeToGroup),e.on("node:delete",this.removeNodeFromGroup),e.on("node:drag,node:dnd-drag",this.setActiveGroup),e.on("node:click",this.onNodeSelect),e.on("graph:rendered",this.onGraphRendered),e.on("graph:updated",(function(t){var e=t.data;return console.log("data",e)})),e.on("group:add-node",(function(t){var e=t.data;return console.log("group:add-node",e)})),e.addElements=function(n,o){var i=n.nodes,r=n.edges;void 0===o&&(o=40);var a={},s={nodes:[],edges:[]},l=[];return xu(i,(function(n){var i=n.id,r=n.children,u=v(n,["children"]),c=e.addNode(u);if(i&&(a[i]=c.id),s.nodes.push(c),c.isGroup){var d=t.initGroupChildNodes(a,r,c,o).edgesData;l.push.apply(l,E([],_(d),!1))}})),xu(l,(function(e){t.createEdge(e,a,o)})),console.log("selectedEdges ---\x3e>>",r),xu(r,(function(e){s.edges.push(t.createEdge(e,a,o))})),s},this.render()},t.prototype.render=function(){},t.prototype.destroy=function(){this.lf.off("node:add,node:drop,node:dnd-add",this.addNodeToGroup),this.lf.off("node:delete",this.removeNodeFromGroup),this.lf.off("node:drag,node:dnd-drag",this.setActiveGroup),this.lf.off("node:click",this.onNodeSelect),this.lf.off("graph:rendered",this.onGraphRendered)},t.pluginName="dynamicGroup",t}();!function(t){t.HORIZONTAL="horizontal",t.VERTICAL="vertical"}(mw||(mw={}));var Ew=function(t,e,n,o){return void 0===o&&(o=0),Cw(t,e,n)<=o};function ww(t){return t*t}function Sw(t,e){return ww(t.x-e.x)+ww(t.y-e.y)}var Cw=function(t,e,n){return Math.sqrt(function(t,e,n){var o=Sw(e,n);if(0===o)return Sw(t,e);var i=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/o;return i=Math.max(0,Math.min(1,i)),Sw(t,{x:e.x+i*(n.x-e.x),y:e.y+i*(n.y-e.y)})}(t,e,n))},Nw=function(t,e,n){var o=function(t){var e=t.x,n=t.y,o=t.width,i=t.height;return{minX:e-o/2,minY:n-i/2,maxX:e+o/2,maxY:n+i/2,x:e,y:n,width:o,height:i,centerX:e,centerY:n}}(t),i=function(t,e){var n;return t.x===e.x?n=mw.VERTICAL:t.y===e.y&&(n=mw.HORIZONTAL),n}(e,n),r=Math.max(e.x,n.x),a=Math.min(e.x,n.x),s=Math.max(e.y,n.y),l=Math.min(e.y,n.y),u=t.x,c=t.y,d=t.width,h=t.height;if(i===mw.HORIZONTAL){if(r>=o.maxX&&a<=o.minX)return{startCrossPoint:{x:e.x>n.x?u+d/2:u-d/2,y:e.y},endCrossPoint:{x:e.x>n.x?u-d/2:u+d/2,y:e.y}}}else if(i===mw.VERTICAL&&s>=o.maxY&&l<=o.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}}},Tw=function(t,e,n){void 0===n&&(n=0);for(var o=t.x,i=t.y,r=e.pointsList,a=0;a<r.length-1;a++)if(Ew({x:o,y:i},r[a],r[a+1],n)){var s=Nw(t,r[a],r[a+1]);if(s)return{crossIndex:a+1,crossPoints:s}}return{crossIndex:-1,crossPoints:{startCrossPoint:{x:0,y:0},endCrossPoint:{x:0,y:0}}}},Aw=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,o=t._lf.graphModel.edges,i=n.id,r=!0,a=0;a<o.length;a++)if(o[a].sourceNodeId===i||o[a].targetNodeId===i){r=!1;break}r&&t.insetNode(n)}))},t.prototype.checkRuleBeforeInsetNode=function(t,n,o,i,r){var a=this._lf.getNodeModelById(t),s=this._lf.getNodeModelById(n),l=a.getAnchorInfo(o),u=s.getAnchorInfo(i),c=a.isAllowConnectedAsSource(r,l,u),d=s.isAllowConnectedAsTarget(r,l,u),h=e.formatAnchorConnectValidateData(c),p=h.isAllPass,f=h.msg,g=e.formatAnchorConnectValidateData(d),v=g.isAllPass;return{isPass:p&&v,sourceMsg:f,targetMsg:g.msg}},t.prototype.insetNode=function(t){var n=this,o=this._lf.graphModel.edges,i=this._lf.getNodeModelById(t.id),r=null==i?void 0:i.getDefaultAnchor();if(!r||0===r.length)this._lf.graphModel.eventCenter.emit(e.EventType.CONNECTION_NOT_ALLOWED,{data:t,msg:"自定义类型节点不显示锚点,也不允许其他节点连接到此节点"});else if(i)for(var a=0;a<o.length;a++){var s=Tw(i,o[a],this.deviation),l=s.crossIndex,u=s.crossPoints;if(l>=0){var c=o[a],d=c.sourceNodeId,h=c.targetNodeId,p=c.id,f=c.type,g=c.pointsList,v=c.sourceAnchorId,y=c.targetAnchorId,m=Is(g[0]),b=Is(u.startCrossPoint);this._lf.deleteEdge(p);var x=this.checkRuleBeforeInsetNode(d,h,v,y,t);if(this._lf.addEdge({type:f,sourceNodeId:d,targetNodeId:t.id,startPoint:m,endPoint:b,pointsList:E(E([],_(g.slice(0,l)),!1),[u.startCrossPoint],!1)}),this._lf.addEdge({type:f,sourceNodeId:t.id,targetNodeId:h,startPoint:Is(u.endCrossPoint),endPoint:Is(g[g.length-1]),pointsList:E([u.endCrossPoint],_(g.slice(l)),!1)}),x.isPass)break;this._lf.graphModel.eventCenter.emit(e.EventType.CONNECTION_NOT_ALLOWED,{data:t,msg:x.targetMsg||x.sourceMsg}),setTimeout((function(){n._lf.undo()}),200);break}}},t.pluginName="insertNodeInPolyline",t}(),Mw="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ow={},Pw={get exports(){return Ow},set exports(t){Ow=t}};
25
+ ***************************************************************************** */var om=function(){return om=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},om.apply(this,arguments)};function im(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function rm(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a}function am(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(rm(arguments[e]));return t}var sm=Symbol("mobx did run lazy initializers"),lm=Symbol("mobx pending decorators"),um={},cm={};function dm(t){var e,n;if(!0!==t[sm]){var o=t[lm];if(o){Gy(t,sm,!0);var i=am(Object.getOwnPropertySymbols(o),Object.keys(o));try{for(var r=im(i),a=r.next();!a.done;a=r.next()){var s=o[a.value];s.propertyCreator(t,s.prop,s.descriptor,s.decoratorTarget,s.decoratorArguments)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}}}}function hm(t,e){return function(){var n,o,i=function(o,i,r,a){if(!0===a)return e(o,i,r,o,n),null;if(!Object.prototype.hasOwnProperty.call(o,lm)){var s=o[lm];Gy(o,lm,om({},s))}return o[lm][i]={prop:i,propertyCreator:e,descriptor:r,decoratorTarget:o,decoratorArguments:n},function(t,e){var n=e?um:cm;return n[t]||(n[t]={configurable:!0,enumerable:e,get:function(){return dm(this),this[t]},set:function(e){dm(this),this[t]=e}})}(i,t)};return(2===(o=arguments).length||3===o.length)&&("string"==typeof o[1]||"symbol"==typeof o[1])||4===o.length&&!0===o[3]?(n=Dy,i.apply(null,arguments)):(n=Array.prototype.slice.call(arguments),i)}}function pm(t,e,n){return Pb(t)?t:Array.isArray(t)?Sm.array(t,{name:n}):Wy(t)?Sm.object(t,void 0,{name:n}):Xy(t)?Sm.map(t,{name:n}):Vy(t)?Sm.set(t,{name:n}):t}function fm(t){return t}function gm(t){By(t);var e=hm(!0,(function(e,n,o,i,r){var a=o?o.initializer?o.initializer.call(e):o.value:void 0;sx(e).addObservableProp(n,a,t)})),n=("undefined"!=typeof process&&process.env,e);return n.enhancer=t,n}var vm={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function ym(t){return null==t?vm:"string"==typeof t?{name:t,deep:!0,proxy:!0}:t}Object.freeze(vm);var mm=gm(pm),bm=gm((function(t,e,n){return null==t||hx(t)||Jb(t)||nx(t)||rx(t)?t:Array.isArray(t)?Sm.array(t,{name:n,deep:!1}):Wy(t)?Sm.object(t,void 0,{name:n,deep:!1}):Xy(t)?Sm.map(t,{name:n,deep:!1}):Vy(t)?Sm.set(t,{name:n,deep:!1}):jy(!1)})),xm=gm(fm),_m=gm((function(t,e,n){return vx(t,e)?e:t}));function Em(t){return t.defaultDecorator?t.defaultDecorator.enhancer:!1===t.deep?fm:pm}var wm={box:function(t,e){arguments.length>2&&Cm("box");var n=ym(e);return new Km(t,Em(n),n.name,!0,n.equals)},array:function(t,e){arguments.length>2&&Cm("array");var n=ym(e);return function(t,e,n,o){void 0===n&&(n="ObservableArray@"+Iy());void 0===o&&(o=!1);var i=new qb(n,e,o);!function(t,e,n){Object.defineProperty(t,e,{enumerable:!1,writable:!1,configurable:!0,value:n})}(i.values,$y,i);var r=new Proxy(i.values,Yb);if(i.proxy=r,t&&t.length){var a=Ym(!0);i.spliceWithArray(0,0,t),qm(a)}return r}(t,Em(n),n.name)},map:function(t,e){arguments.length>2&&Cm("map");var n=ym(e);return new ex(t,Em(n),n.name)},set:function(t,e){arguments.length>2&&Cm("set");var n=ym(e);return new ix(t,Em(n),n.name)},object:function(t,e,n){"string"==typeof arguments[1]&&Cm("object");var o=ym(n);if(!1===o.proxy)return Tb({},t,e,o);var i=Ab(o),r=function(t){var e=new Proxy(t,Fb);return t[$y].proxy=e,e}(Tb({},void 0,void 0,o));return Mb(r,t,e,i),r},ref:xm,shallow:bm,deep:mm,struct:_m},Sm=function(t,e,n){if("string"==typeof arguments[1]||"symbol"==typeof arguments[1])return mm.apply(null,arguments);if(Pb(t))return t;var o=Wy(t)?Sm.object(t,e,n):Array.isArray(t)?Sm.array(t,e):Xy(t)?Sm.map(t,e):Vy(t)?Sm.set(t,e):t;if(o!==t)return o;jy(!1)};function Cm(t){jy("Expected one or two arguments to observable."+t+". Did you accidentally try to use observable."+t+" as decorator?")}Object.keys(wm).forEach((function(t){return Sm[t]=wm[t]}));var Nm,Tm,Am=hm(!1,(function(t,e,n,o,i){var r=n.get,a=n.set,s=i[0]||{};sx(t).addComputedProp(t,e,om({get:r,set:a,context:t},s))})),Mm=Am({equals:em.structural}),Om=function(t,e,n){if("string"==typeof e)return Am.apply(null,arguments);if(null!==t&&"object"==typeof t&&1===arguments.length)return Am.apply(null,arguments);var o="object"==typeof e?e:{};return o.get=t,o.set="function"==typeof e?e:o.set,o.name=o.name||t.name||"",new $m(o)};Om.struct=Mm,function(t){t[t.NOT_TRACKING=-1]="NOT_TRACKING",t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.POSSIBLY_STALE=1]="POSSIBLY_STALE",t[t.STALE=2]="STALE"}(Nm||(Nm={})),function(t){t[t.NONE=0]="NONE",t[t.LOG=1]="LOG",t[t.BREAK=2]="BREAK"}(Tm||(Tm={}));var Pm=function(t){this.cause=t};function km(t){return t instanceof Pm}function Rm(t){switch(t.dependenciesState){case Nm.UP_TO_DATE:return!1;case Nm.NOT_TRACKING:case Nm.STALE:return!0;case Nm.POSSIBLY_STALE:for(var e=Fm(!0),n=Bm(),o=t.observing,i=o.length,r=0;r<i;r++){var a=o[r];if(Jm(a)){if(ib.disableErrorBoundaries)a.get();else try{a.get()}catch(t){return Hm(n),zm(e),!0}if(t.dependenciesState===Nm.STALE)return Hm(n),zm(e),!0}}return Wm(t),Hm(n),zm(e),!1}}function Dm(t){var e=t.observers.size>0;ib.computationDepth>0&&e&&jy(!1),ib.allowStateChanges||!e&&"strict"!==ib.enforceActions||jy(!1)}function Lm(t,e,n){var o=Fm(!0);Wm(t),t.newObserving=new Array(t.observing.length+100),t.unboundDepsCount=0,t.runId=++ib.runId;var i,r=ib.trackingDerivation;if(ib.trackingDerivation=t,!0===ib.disableErrorBoundaries)i=e.call(n);else try{i=e.call(n)}catch(t){i=new Pm(t)}return ib.trackingDerivation=r,function(t){for(var e=t.observing,n=t.observing=t.newObserving,o=Nm.UP_TO_DATE,i=0,r=t.unboundDepsCount,a=0;a<r;a++){0===(s=n[a]).diffValue&&(s.diffValue=1,i!==a&&(n[i]=s),i++),s.dependenciesState>o&&(o=s.dependenciesState)}n.length=i,t.newObserving=null,r=e.length;for(;r--;){0===(s=e[r]).diffValue&&ab(s,t),s.diffValue=0}for(;i--;){var s;1===(s=n[i]).diffValue&&(s.diffValue=0,rb(s,t))}o!==Nm.UP_TO_DATE&&(t.dependenciesState=o,t.onBecomeStale())}(t),zm(o),i}function Im(t){var e=t.observing;t.observing=[];for(var n=e.length;n--;)ab(e[n],t);t.dependenciesState=Nm.NOT_TRACKING}function jm(t){var e=Bm();try{return t()}finally{Hm(e)}}function Bm(){var t=ib.trackingDerivation;return ib.trackingDerivation=null,t}function Hm(t){ib.trackingDerivation=t}function Fm(t){var e=ib.allowStateReads;return ib.allowStateReads=t,e}function zm(t){ib.allowStateReads=t}function Wm(t){if(t.dependenciesState!==Nm.UP_TO_DATE){t.dependenciesState=Nm.UP_TO_DATE;for(var e=t.observing,n=e.length;n--;)e[n].lowestObserverState=Nm.UP_TO_DATE}}var Gm=0,Um=1,Xm=Object.getOwnPropertyDescriptor((function(){}),"name");function Vm(t,e,n){var o=function(){return function(t,e,n,o){var i=function(){var t=!1,e=0,n=Bm();lb();var o=Ym(!0),i=Fm(!0),r={prevDerivation:n,prevAllowStateChanges:o,prevAllowStateReads:i,notifySpy:t,startTime:e,actionId:Um++,parentActionId:Gm};return Gm=r.actionId,r}();try{return e.apply(n,o)}catch(t){throw i.error=t,t}finally{!function(t){Gm!==t.actionId&&jy("invalid action stack. did you forget to finish an action?");Gm=t.parentActionId,void 0!==t.error&&(ib.suppressReactionErrors=!0);qm(t.prevAllowStateChanges),zm(t.prevAllowStateReads),ub(),Hm(t.prevDerivation),t.notifySpy&&!1;ib.suppressReactionErrors=!1}(i)}}(0,e,n||this,arguments)};return o.isMobxAction=!0,o}function Ym(t){var e=ib.allowStateChanges;return ib.allowStateChanges=t,e}function qm(t){ib.allowStateChanges=t}Xm&&Xm.configurable;var Km=function(t){function e(e,n,o,i,r){void 0===o&&(o="ObservableValue@"+Iy()),void 0===i&&(i=!0),void 0===r&&(r=em.default);var a=t.call(this,o)||this;return a.enhancer=n,a.name=o,a.equals=r,a.hasUnreportedChange=!1,a.value=n(e,void 0,o),a}return function(t,e){function n(){this.constructor=t}nm(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.dehanceValue=function(t){return void 0!==this.dehancer?this.dehancer(t):t},e.prototype.set=function(t){this.value;if((t=this.prepareNewValue(t))!==ib.UNCHANGED){false,this.setNewValue(t)}},e.prototype.prepareNewValue=function(t){if(Dm(this),zb(this)){var e=Gb(this,{object:this,type:"update",newValue:t});if(!e)return ib.UNCHANGED;t=e.newValue}return t=this.enhancer(t,this.value,this.name),this.equals(this.value,t)?ib.UNCHANGED:t},e.prototype.setNewValue=function(t){var e=this.value;this.value=t,this.reportChanged(),Ub(this)&&Vb(this,{type:"update",object:this,newValue:t,oldValue:e})},e.prototype.get=function(){return this.reportObserved(),this.dehanceValue(this.value)},e.prototype.intercept=function(t){return Wb(this,t)},e.prototype.observe=function(t,e){return e&&t({object:this,type:"update",newValue:this.value,oldValue:void 0}),Xb(this,t)},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.value+"]"},e.prototype.valueOf=function(){return Ky(this.get())},e.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},e}(Jy),Zm=Uy("ObservableValue",Km),$m=function(){function t(t){this.dependenciesState=Nm.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isBeingObserved=!1,this.isPendingUnobservation=!1,this.observers=new Set,this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=Nm.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+Iy(),this.value=new Pm(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=Tm.NONE,By(t.get,"missing option for computed: get"),this.derivation=t.get,this.name=t.name||"ComputedValue@"+Iy(),t.set&&(this.setter=Vm(this.name,t.set)),this.equals=t.equals||(t.compareStructural||t.struct?em.structural:em.default),this.scope=t.context,this.requiresReaction=!!t.requiresReaction,this.keepAlive=!!t.keepAlive}return t.prototype.onBecomeStale=function(){!function(t){if(t.lowestObserverState!==Nm.UP_TO_DATE)return;t.lowestObserverState=Nm.POSSIBLY_STALE,t.observers.forEach((function(e){e.dependenciesState===Nm.UP_TO_DATE&&(e.dependenciesState=Nm.POSSIBLY_STALE,e.isTracing!==Tm.NONE&&db(e,t),e.onBecomeStale())}))}(this)},t.prototype.onBecomeObserved=function(){this.onBecomeObservedListeners&&this.onBecomeObservedListeners.forEach((function(t){return t()}))},t.prototype.onBecomeUnobserved=function(){this.onBecomeUnobservedListeners&&this.onBecomeUnobservedListeners.forEach((function(t){return t()}))},t.prototype.get=function(){this.isComputing&&jy("Cycle detected in computation "+this.name+": "+this.derivation),0!==ib.inBatch||0!==this.observers.size||this.keepAlive?(cb(this),Rm(this)&&this.trackAndCompute()&&function(t){if(t.lowestObserverState===Nm.STALE)return;t.lowestObserverState=Nm.STALE,t.observers.forEach((function(e){e.dependenciesState===Nm.POSSIBLY_STALE?e.dependenciesState=Nm.STALE:e.dependenciesState===Nm.UP_TO_DATE&&(t.lowestObserverState=Nm.UP_TO_DATE)}))}(this)):Rm(this)&&(this.warnAboutUntrackedRead(),lb(),this.value=this.computeValue(!1),ub());var t=this.value;if(km(t))throw t.cause;return t},t.prototype.peek=function(){var t=this.computeValue(!1);if(km(t))throw t.cause;return t},t.prototype.set=function(t){if(this.setter){By(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,t)}finally{this.isRunningSetter=!1}}else By(!1,!1)},t.prototype.trackAndCompute=function(){var t=this.value,e=this.dependenciesState===Nm.NOT_TRACKING,n=this.computeValue(!0),o=e||km(t)||km(n)||!this.equals(t,n);return o&&(this.value=n),o},t.prototype.computeValue=function(t){var e;if(this.isComputing=!0,ib.computationDepth++,t)e=Lm(this,this.derivation,this.scope);else if(!0===ib.disableErrorBoundaries)e=this.derivation.call(this.scope);else try{e=this.derivation.call(this.scope)}catch(t){e=new Pm(t)}return ib.computationDepth--,this.isComputing=!1,e},t.prototype.suspend=function(){this.keepAlive||(Im(this),this.value=void 0)},t.prototype.observe=function(t,e){var n=this,o=!0,i=void 0;return function(t,e){void 0===e&&(e=Ly);var n,o=e&&e.name||t.name||"Autorun@"+Iy();if(e.scheduler||e.delay){var i=function(t){return t.scheduler?t.scheduler:t.delay?function(e){return setTimeout(e,t.delay)}:Sb}(e),r=!1;n=new pb(o,(function(){r||(r=!0,i((function(){r=!1,n.isDisposed||n.track(a)})))}),e.onError,e.requiresObservable)}else n=new pb(o,(function(){this.track(a)}),e.onError,e.requiresObservable);function a(){t(n)}return n.schedule(),n.getDisposer()}((function(){var r=n.get();if(!o||e){var a=Bm();t({type:"update",object:n,newValue:r,oldValue:i}),Hm(a)}o=!1,i=r}))},t.prototype.warnAboutUntrackedRead=function(){},t.prototype.toJSON=function(){return this.get()},t.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},t.prototype.valueOf=function(){return Ky(this.get())},t.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},t}(),Jm=Uy("ComputedValue",$m),Qm=function(){this.version=5,this.UNCHANGED={},this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.allowStateReads=!0,this.enforceActions=!1,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.computedConfigurable=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1},tb={};function eb(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:tb}var nb=!0,ob=!1,ib=function(){var t=eb();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(nb=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new Qm).version&&(nb=!1),nb?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new Qm):(setTimeout((function(){ob||jy("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")}),1),new Qm)}();function rb(t,e){t.observers.add(e),t.lowestObserverState>e.dependenciesState&&(t.lowestObserverState=e.dependenciesState)}function ab(t,e){t.observers.delete(e),0===t.observers.size&&sb(t)}function sb(t){!1===t.isPendingUnobservation&&(t.isPendingUnobservation=!0,ib.pendingUnobservations.push(t))}function lb(){ib.inBatch++}function ub(){if(0==--ib.inBatch){vb();for(var t=ib.pendingUnobservations,e=0;e<t.length;e++){var n=t[e];n.isPendingUnobservation=!1,0===n.observers.size&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBecomeUnobserved()),n instanceof $m&&n.suspend())}ib.pendingUnobservations=[]}}function cb(t){var e=ib.trackingDerivation;return null!==e?(e.runId!==t.lastAccessedBy&&(t.lastAccessedBy=e.runId,e.newObserving[e.unboundDepsCount++]=t,t.isBeingObserved||(t.isBeingObserved=!0,t.onBecomeObserved())),!0):(0===t.observers.size&&ib.inBatch>0&&sb(t),!1)}function db(t,e){if(console.log("[mobx.trace] '"+t.name+"' is invalidated due to a change in: '"+e.name+"'"),t.isTracing===Tm.BREAK){var n=[];hb(function(t,e){return Ob(px(t,e))}(t),n,1),new Function("debugger;\n/*\nTracing '"+t.name+"'\n\nYou are entering this break point because derivation '"+t.name+"' is being traced and '"+e.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(t instanceof $m?t.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}}function hb(t,e,n){e.length>=1e3?e.push("(and many more)"):(e.push(""+new Array(n).join("\t")+t.name),t.dependencies&&t.dependencies.forEach((function(t){return hb(t,e,n+1)})))}var pb=function(){function t(t,e,n,o){void 0===t&&(t="Reaction@"+Iy()),void 0===o&&(o=!1),this.name=t,this.onInvalidate=e,this.errorHandler=n,this.requiresObservable=o,this.observing=[],this.newObserving=[],this.dependenciesState=Nm.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+Iy(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=Tm.NONE}return t.prototype.onBecomeStale=function(){this.schedule()},t.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,ib.pendingReactions.push(this),vb())},t.prototype.isScheduled=function(){return this._isScheduled},t.prototype.runReaction=function(){if(!this.isDisposed){if(lb(),this._isScheduled=!1,Rm(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending}catch(t){this.reportExceptionInDerivation(t)}}ub()}},t.prototype.track=function(t){if(!this.isDisposed){lb(),this._isRunning=!0;var e=Lm(this,t,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&Im(this),km(e)&&this.reportExceptionInDerivation(e.cause),ub()}},t.prototype.reportExceptionInDerivation=function(t){var e=this;if(this.errorHandler)this.errorHandler(t,this);else{if(ib.disableErrorBoundaries)throw t;var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";ib.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name+"' suppressed, fix error of causing action below)"):console.error(n,t),ib.globalReactionErrorHandlers.forEach((function(n){return n(t,e)}))}},t.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(lb(),Im(this),ub()))},t.prototype.getDisposer=function(){var t=this.dispose.bind(this);return t[$y]=this,t},t.prototype.toString=function(){return"Reaction["+this.name+"]"},t.prototype.trace=function(t){void 0===t&&(t=!1),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=!1;"boolean"==typeof t[t.length-1]&&(n=t.pop());var o=function(t){switch(t.length){case 0:return ib.trackingDerivation;case 1:return px(t[0]);case 2:return px(t[0],t[1])}}(t);if(!o)return jy(!1);o.isTracing===Tm.NONE&&console.log("[mobx.trace] '"+o.name+"' tracing enabled");o.isTracing=n?Tm.BREAK:Tm.LOG}(this,t)},t}(),fb=100,gb=function(t){return t()};function vb(){ib.inBatch>0||ib.isRunningReactions||gb(yb)}function yb(){ib.isRunningReactions=!0;for(var t=ib.pendingReactions,e=0;t.length>0;){++e===fb&&(console.error("Reaction doesn't converge to a stable state after "+fb+" iterations. Probably there is a cycle in the reactive function: "+t[0]),t.splice(0));for(var n=t.splice(0),o=0,i=n.length;o<i;o++)n[o].runReaction()}ib.isRunningReactions=!1}var mb=Uy("Reaction",pb);function bb(t){var e=gb;gb=function(n){return t((function(){return e(n)}))}}function xb(){jy(!1)}function _b(t){return function(e,n,o){if(o){if(o.value)return{value:Vm(0,o.value),enumerable:!1,configurable:!0,writable:!0};var i=o.initializer;return{enumerable:!1,configurable:!0,writable:!0,initializer:function(){return Vm(0,i.call(this))}}}return function(t){return function(e,n,o){Object.defineProperty(e,n,{configurable:!0,enumerable:!1,get:function(){},set:function(e){Gy(this,n,Eb(t,e))}})}}(t).apply(this,arguments)}}var Eb=function(t,e,n,o){return 1===arguments.length&&"function"==typeof t?Vm(t.name,t):2===arguments.length&&"function"==typeof e?Vm(0,e):1===arguments.length&&"string"==typeof t?_b(t):!0!==o?_b(e).apply(null,arguments):void Gy(t,e,Vm(t.name,n.value,this))};function wb(t,e,n){Gy(t,e,Vm(0,n.bind(t)))}Eb.bound=function(t,e,n,o){return!0===o?(wb(t,e,n.value),null):n?{configurable:!0,enumerable:!1,get:function(){return wb(this,e,n.value||n.initializer.call(this)),this[e]},set:xb}:{enumerable:!1,configurable:!0,set:function(t){wb(this,e,t)},get:function(){}}};var Sb=function(t){return t()};function Cb(t,e,n){return Nb("onBecomeUnobserved",t,e,n)}function Nb(t,e,n,o){var i="function"==typeof o?px(e,n):px(e),r="function"==typeof o?o:n,a=t+"Listeners";return i[a]?i[a].add(r):i[a]=new Set([r]),"function"!=typeof i[t]?jy(!1):function(){var t=i[a];t&&(t.delete(r),0===t.size&&delete i[a])}}function Tb(t,e,n,o){var i=Ab(o=ym(o));return dm(t),sx(t,o.name,i.enhancer),e&&Mb(t,e,n,i),t}function Ab(t){return t.defaultDecorator||(!1===t.deep?xm:mm)}function Mb(t,e,n,o){var i,r;lb();try{var a=Zy(e);try{for(var s=im(a),l=s.next();!l.done;l=s.next()){var u=l.value,c=Object.getOwnPropertyDescriptor(e,u);0;var d=n&&u in n?n[u]:c.get?Am:o;0;var h=d(t,u,c,!0);h&&Object.defineProperty(t,u,h)}}catch(t){i={error:t}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}}finally{ub()}}function Ob(t){var e,n,o={name:t.name};return t.observing&&t.observing.length>0&&(o.dependencies=(e=t.observing,n=[],e.forEach((function(t){-1===n.indexOf(t)&&n.push(t)})),n).map(Ob)),o}function Pb(t){return 1!==arguments.length&&jy(!1),function(t,e){return null!=t&&(void 0!==e?!!hx(t)&&t[$y].values.has(e):hx(t)||!!t[$y]||Qy(t)||mb(t)||Jm(t))}(t)}function kb(t,e,n){if(2!==arguments.length||rx(t))if(hx(t)){var o=t[$y];o.values.get(e)?o.write(e,n):o.addObservableProp(e,n,o.defaultEnhancer)}else if(nx(t))t.set(e,n);else if(rx(t))t.add(e);else{if(!Jb(t))return jy(!1);"number"!=typeof e&&(e=parseInt(e,10)),By(e>=0,"Not a valid index: '"+e+"'"),lb(),e>=t.length&&(t.length=e+1),t[e]=n,ub()}else{lb();var i=e;try{for(var r in i)kb(t,r,i[r])}finally{ub()}}}var Rb={detectCycles:!0,exportMapsAsObjects:!0,recurseEverything:!1};function Db(t,e,n,o){return o.detectCycles&&t.set(e,n),n}function Lb(t,e,n){if(!e.recurseEverything&&!Pb(t))return t;if("object"!=typeof t)return t;if(null===t)return null;if(t instanceof Date)return t;if(Zm(t))return Lb(t.get(),e,n);var o;if(Pb(t)&&(hx(o=t)?o[$y].getKeys():nx(o)||rx(o)?Array.from(o.keys()):Jb(o)?o.map((function(t,e){return e})):jy(!1)),!0===e.detectCycles&&null!==t&&n.has(t))return n.get(t);if(Jb(t)||Array.isArray(t)){var i=Db(n,t,[],e),r=t.map((function(t){return Lb(t,e,n)}));i.length=r.length;for(var a=0,s=r.length;a<s;a++)i[a]=r[a];return i}if(rx(t)||Object.getPrototypeOf(t)===Set.prototype){if(!1===e.exportMapsAsObjects){var l=Db(n,t,new Set,e);return t.forEach((function(t){l.add(Lb(t,e,n))})),l}var u=Db(n,t,[],e);return t.forEach((function(t){u.push(Lb(t,e,n))})),u}if(nx(t)||Object.getPrototypeOf(t)===Map.prototype){if(!1===e.exportMapsAsObjects){var c=Db(n,t,new Map,e);return t.forEach((function(t,o){c.set(o,Lb(t,e,n))})),c}var d=Db(n,t,{},e);return t.forEach((function(t,o){d[o]=Lb(t,e,n)})),d}var h=Db(n,t,{},e);return Yy(t).forEach((function(o){h[o]=Lb(t[o],e,n)})),h}function Ib(t,e){var n;return"boolean"==typeof e&&(e={detectCycles:e}),e||(e=Rb),e.detectCycles=void 0===e.detectCycles?!0===e.recurseEverything:!0===e.detectCycles,e.detectCycles&&(n=new Map),Lb(t,e,n)}function jb(t,e){void 0===e&&(e=void 0),lb();try{return t.apply(e)}finally{ub()}}function Bb(t){return t[$y]}function Hb(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t}var Fb={has:function(t,e){if(e===$y||"constructor"===e||e===sm)return!0;var n=Bb(t);return Hb(e)?n.has(e):e in t},get:function(t,e){if(e===$y||"constructor"===e||e===sm)return t[e];var n=Bb(t),o=n.values.get(e);if(o instanceof Jy){var i=o.get();return void 0===i&&n.has(e),i}return Hb(e)&&n.has(e),t[e]},set:function(t,e,n){return!!Hb(e)&&(kb(t,e,n),!0)},deleteProperty:function(t,e){return!!Hb(e)&&(Bb(t).remove(e),!0)},ownKeys:function(t){return Bb(t).keysAtom.reportObserved(),Reflect.ownKeys(t)},preventExtensions:function(t){return jy("Dynamic observable objects cannot be frozen"),!1}};function zb(t){return void 0!==t.interceptors&&t.interceptors.length>0}function Wb(t,e){var n=t.interceptors||(t.interceptors=[]);return n.push(e),Hy((function(){var t=n.indexOf(e);-1!==t&&n.splice(t,1)}))}function Gb(t,e){var n=Bm();try{for(var o=am(t.interceptors||[]),i=0,r=o.length;i<r&&(By(!(e=o[i](e))||e.type,"Intercept handlers should return nothing or a change object"),e);i++);return e}finally{Hm(n)}}function Ub(t){return void 0!==t.changeListeners&&t.changeListeners.length>0}function Xb(t,e){var n=t.changeListeners||(t.changeListeners=[]);return n.push(e),Hy((function(){var t=n.indexOf(e);-1!==t&&n.splice(t,1)}))}function Vb(t,e){var n=Bm(),o=t.changeListeners;if(o){for(var i=0,r=(o=o.slice()).length;i<r;i++)o[i](e);Hm(n)}}var Yb={get:function(t,e){return e===$y?t[$y]:"length"===e?t[$y].getArrayLength():"number"==typeof e?Kb.get.call(t,e):"string"!=typeof e||isNaN(e)?Kb.hasOwnProperty(e)?Kb[e]:t[e]:Kb.get.call(t,parseInt(e))},set:function(t,e,n){return"length"===e&&t[$y].setArrayLength(n),"number"==typeof e&&Kb.set.call(t,e,n),"symbol"==typeof e||isNaN(e)?t[e]=n:Kb.set.call(t,parseInt(e),n),!0},preventExtensions:function(t){return jy("Observable arrays cannot be frozen"),!1}};var qb=function(){function t(t,e,n){this.owned=n,this.values=[],this.proxy=void 0,this.lastKnownLength=0,this.atom=new Jy(t||"ObservableArray@"+Iy()),this.enhancer=function(n,o){return e(n,o,t+"[..]")}}return t.prototype.dehanceValue=function(t){return void 0!==this.dehancer?this.dehancer(t):t},t.prototype.dehanceValues=function(t){return void 0!==this.dehancer&&t.length>0?t.map(this.dehancer):t},t.prototype.intercept=function(t){return Wb(this,t)},t.prototype.observe=function(t,e){return void 0===e&&(e=!1),e&&t({object:this.proxy,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),Xb(this,t)},t.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},t.prototype.setArrayLength=function(t){if("number"!=typeof t||t<0)throw new Error("[mobx.array] Out of range: "+t);var e=this.values.length;if(t!==e)if(t>e){for(var n=new Array(t-e),o=0;o<t-e;o++)n[o]=void 0;this.spliceWithArray(e,0,n)}else this.spliceWithArray(t,e-t)},t.prototype.updateArrayLength=function(t,e){if(t!==this.lastKnownLength)throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed.");this.lastKnownLength+=e},t.prototype.spliceWithArray=function(t,e,n){var o=this;Dm(this.atom);var i=this.values.length;if(void 0===t?t=0:t>i?t=i:t<0&&(t=Math.max(0,i+t)),e=1===arguments.length?i-t:null==e?0:Math.max(0,Math.min(e,i-t)),void 0===n&&(n=Dy),zb(this)){var r=Gb(this,{object:this.proxy,type:"splice",index:t,removedCount:e,added:n});if(!r)return Dy;e=r.removedCount,n=r.added}n=0===n.length?n:n.map((function(t){return o.enhancer(t,void 0)}));var a=this.spliceItemsIntoValues(t,e,n);return 0===e&&0===n.length||this.notifyArraySplice(t,n,a),this.dehanceValues(a)},t.prototype.spliceItemsIntoValues=function(t,e,n){var o;if(n.length<1e4)return(o=this.values).splice.apply(o,am([t,e],n));var i=this.values.slice(t,t+e);return this.values=this.values.slice(0,t).concat(n,this.values.slice(t+e)),i},t.prototype.notifyArrayChildUpdate=function(t,e,n){var o=!this.owned&&!1,i=Ub(this),r=i||o?{object:this.proxy,type:"update",index:t,newValue:e,oldValue:n}:null;this.atom.reportChanged(),i&&Vb(this,r)},t.prototype.notifyArraySplice=function(t,e,n){var o=!this.owned&&!1,i=Ub(this),r=i||o?{object:this.proxy,type:"splice",index:t,removed:n,added:e,removedCount:n.length,addedCount:e.length}:null;this.atom.reportChanged(),i&&Vb(this,r)},t}(),Kb={intercept:function(t){return this[$y].intercept(t)},observe:function(t,e){return void 0===e&&(e=!1),this[$y].observe(t,e)},clear:function(){return this.splice(0)},replace:function(t){var e=this[$y];return e.spliceWithArray(0,e.values.length,t)},toJS:function(){return this.slice()},toJSON:function(){return this.toJS()},splice:function(t,e){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];var i=this[$y];switch(arguments.length){case 0:return[];case 1:return i.spliceWithArray(t);case 2:return i.spliceWithArray(t,e)}return i.spliceWithArray(t,e,n)},spliceWithArray:function(t,e,n){return this[$y].spliceWithArray(t,e,n)},push:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this[$y];return n.spliceWithArray(n.values.length,0,t),n.values.length},pop:function(){return this.splice(Math.max(this[$y].values.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this[$y];return n.spliceWithArray(0,0,t),n.values.length},reverse:function(){var t=this.slice();return t.reverse.apply(t,arguments)},sort:function(t){var e=this.slice();return e.sort.apply(e,arguments)},remove:function(t){var e=this[$y],n=e.dehanceValues(e.values).indexOf(t);return n>-1&&(this.splice(n,1),!0)},get:function(t){var e=this[$y];if(e){if(t<e.values.length)return e.atom.reportObserved(),e.dehanceValue(e.values[t]);console.warn("[mobx.array] Attempt to read an array index ("+t+") that is out of bounds ("+e.values.length+"). Please check length first. Out of bound indices will not be tracked by MobX")}},set:function(t,e){var n=this[$y],o=n.values;if(t<o.length){Dm(n.atom);var i=o[t];if(zb(n)){var r=Gb(n,{type:"update",object:n.proxy,index:t,newValue:e});if(!r)return;e=r.newValue}(e=n.enhancer(e,i))!==i&&(o[t]=e,n.notifyArrayChildUpdate(t,e,i))}else{if(t!==o.length)throw new Error("[mobx.array] Index out of bounds, "+t+" is larger than "+o.length);n.spliceWithArray(t,0,[e])}}};["concat","flat","includes","indexOf","join","lastIndexOf","slice","toString","toLocaleString"].forEach((function(t){"function"==typeof Array.prototype[t]&&(Kb[t]=function(){var e=this[$y];e.atom.reportObserved();var n=e.dehanceValues(e.values);return n[t].apply(n,arguments)})})),["every","filter","find","findIndex","flatMap","forEach","map","some"].forEach((function(t){"function"==typeof Array.prototype[t]&&(Kb[t]=function(e,n){var o=this,i=this[$y];return i.atom.reportObserved(),i.dehanceValues(i.values)[t]((function(t,i){return e.call(n,t,i,o)}),n)})})),["reduce","reduceRight"].forEach((function(t){Kb[t]=function(){var e=this,n=this[$y];n.atom.reportObserved();var o=arguments[0];return arguments[0]=function(t,i,r){return i=n.dehanceValue(i),o(t,i,r,e)},n.values[t].apply(n.values,arguments)}}));var Zb,$b=Uy("ObservableArrayAdministration",qb);function Jb(t){return zy(t)&&$b(t[$y])}var Qb,tx={},ex=function(){function t(t,e,n){if(void 0===e&&(e=pm),void 0===n&&(n="ObservableMap@"+Iy()),this.enhancer=e,this.name=n,this[Zb]=tx,this._keysAtom=tm(this.name+".keys()"),this[Symbol.toStringTag]="Map","function"!=typeof Map)throw new Error("mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js");this._data=new Map,this._hasMap=new Map,this.merge(t)}return t.prototype._has=function(t){return this._data.has(t)},t.prototype.has=function(t){var e=this;if(!ib.trackingDerivation)return this._has(t);var n=this._hasMap.get(t);if(!n){var o=n=new Km(this._has(t),fm,this.name+"."+qy(t)+"?",!1);this._hasMap.set(t,o),Cb(o,(function(){return e._hasMap.delete(t)}))}return n.get()},t.prototype.set=function(t,e){var n=this._has(t);if(zb(this)){var o=Gb(this,{type:n?"update":"add",object:this,newValue:e,name:t});if(!o)return this;e=o.newValue}return n?this._updateValue(t,e):this._addValue(t,e),this},t.prototype.delete=function(t){var e=this;if((Dm(this._keysAtom),zb(this))&&!(o=Gb(this,{type:"delete",object:this,name:t})))return!1;if(this._has(t)){var n=Ub(this),o=n?{type:"delete",object:this,oldValue:this._data.get(t).value,name:t}:null;return jb((function(){e._keysAtom.reportChanged(),e._updateHasMapEntry(t,!1),e._data.get(t).setNewValue(void 0),e._data.delete(t)})),n&&Vb(this,o),!0}return!1},t.prototype._updateHasMapEntry=function(t,e){var n=this._hasMap.get(t);n&&n.setNewValue(e)},t.prototype._updateValue=function(t,e){var n=this._data.get(t);if((e=n.prepareNewValue(e))!==ib.UNCHANGED){var o=!1,i=Ub(this),r=i?{type:"update",object:this,oldValue:n.value,name:t,newValue:e}:null;o,n.setNewValue(e),i&&Vb(this,r)}},t.prototype._addValue=function(t,e){var n=this;Dm(this._keysAtom),jb((function(){var o=new Km(e,n.enhancer,n.name+"."+qy(t),!1);n._data.set(t,o),e=o.value,n._updateHasMapEntry(t,!0),n._keysAtom.reportChanged()}));var o=Ub(this);o&&Vb(this,o?{type:"add",object:this,name:t,newValue:e}:null)},t.prototype.get=function(t){return this.has(t)?this.dehanceValue(this._data.get(t).get()):this.dehanceValue(void 0)},t.prototype.dehanceValue=function(t){return void 0!==this.dehancer?this.dehancer(t):t},t.prototype.keys=function(){return this._keysAtom.reportObserved(),this._data.keys()},t.prototype.values=function(){var t=this,e=this.keys();return xx({next:function(){var n=e.next(),o=n.done,i=n.value;return{done:o,value:o?void 0:t.get(i)}}})},t.prototype.entries=function(){var t=this,e=this.keys();return xx({next:function(){var n=e.next(),o=n.done,i=n.value;return{done:o,value:o?void 0:[i,t.get(i)]}}})},t.prototype[(Zb=$y,Symbol.iterator)]=function(){return this.entries()},t.prototype.forEach=function(t,e){var n,o;try{for(var i=im(this),r=i.next();!r.done;r=i.next()){var a=rm(r.value,2),s=a[0],l=a[1];t.call(e,l,s,this)}}catch(t){n={error:t}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},t.prototype.merge=function(t){var e=this;return nx(t)&&(t=t.toJS()),jb((function(){var n=Ym(!0);try{Wy(t)?Yy(t).forEach((function(n){return e.set(n,t[n])})):Array.isArray(t)?t.forEach((function(t){var n=rm(t,2),o=n[0],i=n[1];return e.set(o,i)})):Xy(t)?(t.constructor!==Map&&jy("Cannot initialize from classes that inherit from Map: "+t.constructor.name),t.forEach((function(t,n){return e.set(n,t)}))):null!=t&&jy("Cannot initialize map from "+t)}finally{qm(n)}})),this},t.prototype.clear=function(){var t=this;jb((function(){jm((function(){var e,n;try{for(var o=im(t.keys()),i=o.next();!i.done;i=o.next()){var r=i.value;t.delete(r)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}))}))},t.prototype.replace=function(t){var e=this;return jb((function(){var n,o,i,r,a=function(t){if(Xy(t)||nx(t))return t;if(Array.isArray(t))return new Map(t);if(Wy(t)){var e=new Map;for(var n in t)e.set(n,t[n]);return e}return jy("Cannot convert to map from '"+t+"'")}(t),s=new Map,l=!1;try{for(var u=im(e._data.keys()),c=u.next();!c.done;c=u.next()){var d=c.value;if(!a.has(d))if(e.delete(d))l=!0;else{var h=e._data.get(d);s.set(d,h)}}}catch(t){n={error:t}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}try{for(var p=im(a.entries()),f=p.next();!f.done;f=p.next()){var g=rm(f.value,2),v=(d=g[0],h=g[1],e._data.has(d));if(e.set(d,h),e._data.has(d)){var y=e._data.get(d);s.set(d,y),v||(l=!0)}}}catch(t){i={error:t}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(i)throw i.error}}if(!l)if(e._data.size!==s.size)e._keysAtom.reportChanged();else for(var m=e._data.keys(),b=s.keys(),x=m.next(),_=b.next();!x.done;){if(x.value!==_.value){e._keysAtom.reportChanged();break}x=m.next(),_=b.next()}e._data=s})),this},Object.defineProperty(t.prototype,"size",{get:function(){return this._keysAtom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),t.prototype.toPOJO=function(){var t,e,n={};try{for(var o=im(this),i=o.next();!i.done;i=o.next()){var r=rm(i.value,2),a=r[0],s=r[1];n["symbol"==typeof a?a:qy(a)]=s}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return n},t.prototype.toJS=function(){return new Map(this)},t.prototype.toJSON=function(){return this.toPOJO()},t.prototype.toString=function(){var t=this;return this.name+"[{ "+Array.from(this.keys()).map((function(e){return qy(e)+": "+t.get(e)})).join(", ")+" }]"},t.prototype.observe=function(t,e){return Xb(this,t)},t.prototype.intercept=function(t){return Wb(this,t)},t}(),nx=Uy("ObservableMap",ex),ox={},ix=function(){function t(t,e,n){if(void 0===e&&(e=pm),void 0===n&&(n="ObservableSet@"+Iy()),this.name=n,this[Qb]=ox,this._data=new Set,this._atom=tm(this.name),this[Symbol.toStringTag]="Set","function"!=typeof Set)throw new Error("mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js");this.enhancer=function(t,o){return e(t,o,n)},t&&this.replace(t)}return t.prototype.dehanceValue=function(t){return void 0!==this.dehancer?this.dehancer(t):t},t.prototype.clear=function(){var t=this;jb((function(){jm((function(){var e,n;try{for(var o=im(t._data.values()),i=o.next();!i.done;i=o.next()){var r=i.value;t.delete(r)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}))}))},t.prototype.forEach=function(t,e){var n,o;try{for(var i=im(this),r=i.next();!r.done;r=i.next()){var a=r.value;t.call(e,a,a,this)}}catch(t){n={error:t}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._atom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),t.prototype.add=function(t){var e=this;if((Dm(this._atom),zb(this))&&!(o=Gb(this,{type:"add",object:this,newValue:t})))return this;if(!this.has(t)){jb((function(){e._data.add(e.enhancer(t,void 0)),e._atom.reportChanged()}));var n=Ub(this),o=n?{type:"add",object:this,newValue:t}:null;n&&Vb(this,o)}return this},t.prototype.delete=function(t){var e=this;if(zb(this)&&!(o=Gb(this,{type:"delete",object:this,oldValue:t})))return!1;if(this.has(t)){var n=Ub(this),o=n?{type:"delete",object:this,oldValue:t}:null;return jb((function(){e._atom.reportChanged(),e._data.delete(t)})),n&&Vb(this,o),!0}return!1},t.prototype.has=function(t){return this._atom.reportObserved(),this._data.has(this.dehanceValue(t))},t.prototype.entries=function(){var t=0,e=Array.from(this.keys()),n=Array.from(this.values());return xx({next:function(){var o=t;return t+=1,o<n.length?{value:[e[o],n[o]],done:!1}:{done:!0}}})},t.prototype.keys=function(){return this.values()},t.prototype.values=function(){this._atom.reportObserved();var t=this,e=0,n=Array.from(this._data.values());return xx({next:function(){return e<n.length?{value:t.dehanceValue(n[e++]),done:!1}:{done:!0}}})},t.prototype.replace=function(t){var e=this;return rx(t)&&(t=t.toJS()),jb((function(){var n=Ym(!0);try{Array.isArray(t)||Vy(t)?(e.clear(),t.forEach((function(t){return e.add(t)}))):null!=t&&jy("Cannot initialize set from "+t)}finally{qm(n)}})),this},t.prototype.observe=function(t,e){return Xb(this,t)},t.prototype.intercept=function(t){return Wb(this,t)},t.prototype.toJS=function(){return new Set(this)},t.prototype.toString=function(){return this.name+"[ "+Array.from(this).join(", ")+" ]"},t.prototype[(Qb=$y,Symbol.iterator)]=function(){return this.values()},t}(),rx=Uy("ObservableSet",ix),ax=function(){function t(t,e,n,o){void 0===e&&(e=new Map),this.target=t,this.values=e,this.name=n,this.defaultEnhancer=o,this.keysAtom=new Jy(n+".keys")}return t.prototype.read=function(t){return this.values.get(t).get()},t.prototype.write=function(t,e){var n=this.target,o=this.values.get(t);if(o instanceof $m)o.set(e);else{if(zb(this)){if(!(a=Gb(this,{type:"update",object:this.proxy||n,name:t,newValue:e})))return;e=a.newValue}if((e=o.prepareNewValue(e))!==ib.UNCHANGED){var i=Ub(this),r=!1,a=i?{type:"update",object:this.proxy||n,oldValue:o.value,name:t,newValue:e}:null;r,o.setNewValue(e),i&&Vb(this,a)}}},t.prototype.has=function(t){var e=this.pendingKeys||(this.pendingKeys=new Map),n=e.get(t);if(n)return n.get();var o=!!this.values.get(t);return n=new Km(o,fm,this.name+"."+qy(t)+"?",!1),e.set(t,n),n.get()},t.prototype.addObservableProp=function(t,e,n){void 0===n&&(n=this.defaultEnhancer);var o=this.target;if(zb(this)){var i=Gb(this,{object:this.proxy||o,name:t,type:"add",newValue:e});if(!i)return;e=i.newValue}var r=new Km(e,n,this.name+"."+qy(t),!1);this.values.set(t,r),e=r.value,Object.defineProperty(o,t,function(t){return lx[t]||(lx[t]={configurable:!0,enumerable:!0,get:function(){return this[$y].read(t)},set:function(e){this[$y].write(t,e)}})}(t)),this.notifyPropertyAddition(t,e)},t.prototype.addComputedProp=function(t,e,n){var o=this.target;n.name=n.name||this.name+"."+qy(e),this.values.set(e,new $m(n)),(t===o||function(t,e){var n=Object.getOwnPropertyDescriptor(t,e);return!n||!1!==n.configurable&&!1!==n.writable}(t,e))&&Object.defineProperty(t,e,function(t){return ux[t]||(ux[t]={configurable:ib.computedConfigurable,enumerable:!1,get:function(){return cx(this).read(t)},set:function(e){cx(this).write(t,e)}})}(e))},t.prototype.remove=function(t){if(this.values.has(t)){var e=this.target;if(zb(this))if(!(s=Gb(this,{object:this.proxy||e,name:t,type:"remove"})))return;try{lb();var n=Ub(this),o=!1,i=this.values.get(t),r=i&&i.get();if(i&&i.set(void 0),this.keysAtom.reportChanged(),this.values.delete(t),this.pendingKeys){var a=this.pendingKeys.get(t);a&&a.set(!1)}delete this.target[t];var s=n?{type:"remove",object:this.proxy||e,oldValue:r,name:t}:null;o,n&&Vb(this,s)}finally{ub()}}},t.prototype.illegalAccess=function(t,e){console.warn("Property '"+e+"' of '"+t+"' was accessed through the prototype chain. Use 'decorate' instead to declare the prop or access it statically through it's owner")},t.prototype.observe=function(t,e){return Xb(this,t)},t.prototype.intercept=function(t){return Wb(this,t)},t.prototype.notifyPropertyAddition=function(t,e){var n=Ub(this),o=n?{type:"add",object:this.proxy||this.target,name:t,newValue:e}:null;if(n&&Vb(this,o),this.pendingKeys){var i=this.pendingKeys.get(t);i&&i.set(!0)}this.keysAtom.reportChanged()},t.prototype.getKeys=function(){var t,e;this.keysAtom.reportObserved();var n=[];try{for(var o=im(this.values),i=o.next();!i.done;i=o.next()){var r=rm(i.value,2),a=r[0];r[1]instanceof Km&&n.push(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return n},t}();function sx(t,e,n){if(void 0===e&&(e=""),void 0===n&&(n=pm),Object.prototype.hasOwnProperty.call(t,$y))return t[$y];Wy(t)||(e=(t.constructor.name||"ObservableObject")+"@"+Iy()),e||(e="ObservableObject@"+Iy());var o=new ax(t,new Map,qy(e),n);return Gy(t,$y,o),o}var lx=Object.create(null),ux=Object.create(null);function cx(t){var e=t[$y];return e||(dm(t),t[$y])}var dx=Uy("ObservableObjectAdministration",ax);function hx(t){return!!zy(t)&&(dm(t),dx(t[$y]))}function px(t,e){if("object"==typeof t&&null!==t){if(Jb(t))return void 0!==e&&jy(!1),t[$y].atom;if(rx(t))return t[$y];if(nx(t)){var n=t;return void 0===e?n._keysAtom:((o=n._data.get(e)||n._hasMap.get(e))||jy(!1),o)}var o;if(dm(t),e&&!t[$y]&&t[e],hx(t))return e?((o=t[$y].values.get(e))||jy(!1),o):jy(!1);if(Qy(t)||Jm(t)||mb(t))return t}else if("function"==typeof t&&mb(t[$y]))return t[$y];return jy(!1)}function fx(t,e){return t||jy("Expecting some object"),void 0!==e?fx(px(t,e)):Qy(t)||Jm(t)||mb(t)||nx(t)||rx(t)?t:(dm(t),t[$y]?t[$y]:void jy(!1))}var gx=Object.prototype.toString;function vx(t,e,n){return void 0===n&&(n=-1),yx(t,e,n)}function yx(t,e,n,o,i){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return!1;if(t!=t)return e!=e;var r=typeof t;if("function"!==r&&"object"!==r&&"object"!=typeof e)return!1;var a=gx.call(t);if(a!==gx.call(e))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!=+t?+e!=+e:0==+t?1/+t==1/e:+t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(t)===Symbol.valueOf.call(e);case"[object Map]":case"[object Set]":n>=0&&n++}t=mx(t),e=mx(e);var s="[object Array]"===a;if(!s){if("object"!=typeof t||"object"!=typeof e)return!1;var l=t.constructor,u=e.constructor;if(l!==u&&!("function"==typeof l&&l instanceof l&&"function"==typeof u&&u instanceof u)&&"constructor"in t&&"constructor"in e)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(o=o||[]).length;c--;)if(o[c]===t)return i[c]===e;if(o.push(t),i.push(e),s){if((c=t.length)!==e.length)return!1;for(;c--;)if(!yx(t[c],e[c],n-1,o,i))return!1}else{var d=Object.keys(t),h=void 0;if(c=d.length,Object.keys(e).length!==c)return!1;for(;c--;)if(!bx(e,h=d[c])||!yx(t[h],e[h],n-1,o,i))return!1}return o.pop(),i.pop(),!0}function mx(t){return Jb(t)?t.slice():Xy(t)||nx(t)||Vy(t)||rx(t)?Array.from(t.entries()):t}function bx(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function xx(t){return t[Symbol.iterator]=_x,t}function _x(){return this}if("undefined"==typeof Proxy||"undefined"==typeof Symbol)throw new Error("[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore.");"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(t){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:function(t,e){return(void 0!==e?px(t,e):hx(t)||nx(t)||rx(t)?fx(t):px(t)).name}},$mobx:$y});var Ex=function(){return Ex=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ex.apply(this,arguments)},wx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},Sx=function(){function t(t,e){var n;this.BaseType=_y.EDGE,this.id="",this.type="",this.sourceNodeId="",this.targetNodeId="",this.textMode=Ny.TEXT,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this.points="",this.pointsList=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.isAnimation=!1,this.isShowAdjustPoint=!1,this.zIndex=0,this.state=xy.DEFAULT,this.modelType=Ey.EDGE,this.customTextPosition=!1,this.style={},this.arrowConfig={markerEnd:"url(#marker-end-".concat(this.id,")"),markerStart:"url(#marker-start-".concat(this.id,")")},this.graphModel=e,this.properties=null!==(n=t.properties)&&void 0!==n?n:{},this.initEdgeData(t),this.setAttributes()}return t.prototype.initEdgeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,n=e&&e(t.type),o=this.createId();t.id=o||n||JE()}this.arrowConfig.markerEnd="url(#marker-end-".concat(t.id,")"),this.arrowConfig.markerStart="url(#marker-start-".concat(t.id,")");var i=this.graphModel.editConfigModel.adjustEdgeStartAndEnd;this.isShowAdjustPoint=i,li(this,tE(t)),this.graphModel.overlapMode===Sy.INCREASE&&(this.zIndex=t.zIndex||iw()),this.setAnchors(),this.initPoints(),this.formatText(t)},t.prototype.setAttributes=function(){},t.prototype.createId=function(){return null},t.prototype.getEdgeStyle=function(){return Ex(Ex({},this.graphModel.theme.baseEdge),this.style)},t.prototype.getAdjustPointStyle=function(){return Ex({},this.graphModel.theme.edgeAdjust)},t.prototype.getTextStyle=function(){return Is(this.graphModel.theme.edgeText)},t.prototype.getEdgeAnimationStyle=function(){return Is(this.graphModel.theme.edgeAnimation)},t.prototype.getArrowStyle=function(){var t=this.getEdgeStyle(),e=this.getEdgeAnimationStyle(),n=this.graphModel.theme.arrow,o=this.isAnimation?e.stroke:t.stroke;return Ex(Ex(Ex({},t),{fill:o,stroke:o}),n)},t.prototype.getOutlineStyle=function(){return Is(this.graphModel.theme.outline)},t.prototype.getTextPosition=function(){return{x:0,y:0}},Object.defineProperty(t.prototype,"sourceNode",{get:function(){var t,e;return null===(e=null===(t=this.graphModel)||void 0===t?void 0:t.nodesMap[this.sourceNodeId])||void 0===e?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"targetNode",{get:function(){var t,e;return null===(e=null===(t=this.graphModel)||void 0===t?void 0:t.nodesMap[this.targetNodeId])||void 0===e?void 0:e.model},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textPosition",{get:function(){return this.getTextPosition()},enumerable:!1,configurable:!0}),t.prototype.getBeginAnchor=function(t,e,n){var o,i,r=xE(t);if(n){if(o=Uu(r,(function(t){return t.id===n})))return o;console.warn("未在节点上找到指定的起点锚点".concat(n,",已使用默认锚点作为起点"))}return r.forEach((function(t){var n=eE(t,e);(void 0===i||n<i)&&(i=n,o=t)})),o},t.prototype.getEndAnchor=function(t,e){var n,o,i=this,r=xE(t);if(e){if(n=Uu(r,(function(t){return t.id===e})))return n;console.warn("未在节点上找到指定的终点锚点".concat(e,",已使用默认锚点作为终点"))}return r.forEach((function(t){if(i.startPoint){var e=eE(t,i.startPoint);(void 0===o||e<o)&&(o=e,n=t)}})),n},t.prototype.getProperties=function(){return Ib(this.properties)},t.prototype.getData=function(){var t=this.properties;Pb(t)&&(t=Ib(t));var e={id:this.id,type:this.type,properties:t,sourceNodeId:this.sourceNode.id,targetNodeId:this.targetNode.id,startPoint:li({},this.startPoint),endPoint:li({},this.endPoint)};this.graphModel.overlapMode===Sy.INCREASE&&(e.zIndex=this.zIndex);var n=this.text,o=n.x,i=n.y,r=n.value;return r&&(e.text={x:o,y:i,value:r}),e},t.prototype.getHistoryData=function(){return this.getData()},t.prototype.setProperty=function(t,e){var n,o=Ib(this.properties);this.properties=Ex(Ex({},o),((n={})[t]=Oy(e),n)),this.setAttributes()},t.prototype.deleteProperty=function(t){delete this.properties[t],this.setAttributes()},t.prototype.setProperties=function(t){this.properties=Ex(Ex({},Ib(this.properties)),Oy(t)),this.setAttributes()},t.prototype.changeEdgeId=function(t){var e=this.arrowConfig,n=e.markerEnd,o=e.markerStart;o&&o==="url(#marker-start-".concat(this.id,")")&&(this.arrowConfig.markerStart="url(#marker-start-".concat(t,")")),n&&n==="url(#marker-end-".concat(this.id,")")&&(this.arrowConfig.markerEnd="url(#marker-end-".concat(t,")")),this.id=t},t.prototype.setStyle=function(t,e){var n;this.style=Ex(Ex({},this.style),((n={})[t]=Oy(e),n))},t.prototype.setStyles=function(t){this.style=Ex(Ex({},this.style),Oy(t))},t.prototype.updateStyles=function(t){this.style=Ex({},Oy(t))},t.prototype.setTextMode=function(t){this.textMode=t},t.prototype.formatText=function(t){var e,n,o,i=this.textPosition,r=i.x,a=i.y,s=t.text,l={value:"",x:r,y:a,draggable:!1,editable:!0};s&&("string"==typeof s?l=Ex(Ex({},l),{value:s}):(l=Ex(Ex({},l),{x:null!==(e=s.x)&&void 0!==e?e:r,y:null!==(n=s.y)&&void 0!==n?n:a,value:null!==(o=s.value)&&void 0!==o?o:""}),nd(s.draggable)||(l.draggable=s.draggable),nd(s.editable)||(l.editable=s.editable))),this.text=l},t.prototype.resetTextPosition=function(){var t=this.textPosition,e=t.x,n=t.y;this.text.x=e,this.text.y=n},t.prototype.moveText=function(t,e){var n=this.text,o=n.x,i=n.y,r=n.value,a=n.draggable,s=n.editable;this.text={value:r,editable:s,draggable:a,x:o+t,y:i+e}},t.prototype.setText=function(t){t&&li(this.text,t)},t.prototype.updateText=function(t){this.text=Ex(Ex({},Ib(this.text)),{value:t})},t.prototype.setAnchors=function(){if(!this.sourceAnchorId||!this.startPoint){if(!(t=this.getBeginAnchor(this.sourceNode,this.targetNode,this.sourceAnchorId)))throw new Error("无法获取beginAnchor,请检查anchors相关逻辑,anchors不能为空");this.startPoint||(this.startPoint={x:t.x,y:t.y}),this.sourceAnchorId||(this.sourceAnchorId=t.id)}if(!this.targetAnchorId||!this.endPoint){var t;if(!(t=this.getEndAnchor(this.targetNode,this.targetAnchorId)))throw new Error("无法获取endAnchor,请检查anchors相关逻辑,anchors不能为空");this.endPoint||(this.endPoint={x:t.x,y:t.y}),this.targetAnchorId||(this.targetAnchorId=t.id)}},t.prototype.setSelected=function(t){void 0===t&&(t=!0),this.isSelected=t},t.prototype.setHovered=function(t){void 0===t&&(t=!0),this.isHovered=t},t.prototype.setHitable=function(t){void 0===t&&(t=!0),this.isHitable=t},t.prototype.setHittable=function(t){void 0===t&&(t=!0),this.isHittable=t},t.prototype.openEdgeAnimation=function(){this.isAnimation=!0},t.prototype.closeEdgeAnimation=function(){this.isAnimation=!1},t.prototype.setElementState=function(t,e){this.state=t,this.additionStateData=e},t.prototype.updateStartPoint=function(t){this.startPoint=t},t.prototype.moveStartPoint=function(t,e){this.startPoint&&(this.startPoint.x+=t,this.startPoint.y+=e)},t.prototype.updateEndPoint=function(t){this.endPoint=t},t.prototype.moveEndPoint=function(t,e){this.endPoint&&(this.endPoint.x+=t,this.endPoint.y+=e)},t.prototype.setZIndex=function(t){void 0===t&&(t=0),this.zIndex=t},t.prototype.initPoints=function(){},t.prototype.updateAttributes=function(t){li(this,t)},t.prototype.getAdjustStart=function(){return this.startPoint},t.prototype.getAdjustEnd=function(){return this.endPoint},t.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,n=t.endPoint;this.updateStartPoint({x:e.x,y:e.y}),this.updateEndPoint({x:n.x,y:n.y})},t.BaseType=_y.EDGE,wx([Sm],t.prototype,"type",void 0),wx([Sm],t.prototype,"sourceNodeId",void 0),wx([Sm],t.prototype,"targetNodeId",void 0),wx([Sm],t.prototype,"startPoint",void 0),wx([Sm],t.prototype,"endPoint",void 0),wx([Sm],t.prototype,"textMode",void 0),wx([Sm],t.prototype,"text",void 0),wx([Sm],t.prototype,"properties",void 0),wx([Sm],t.prototype,"points",void 0),wx([Sm],t.prototype,"pointsList",void 0),wx([Sm],t.prototype,"isSelected",void 0),wx([Sm],t.prototype,"isHovered",void 0),wx([Sm],t.prototype,"isHitable",void 0),wx([Sm],t.prototype,"isHittable",void 0),wx([Sm],t.prototype,"draggable",void 0),wx([Sm],t.prototype,"visible",void 0),wx([Sm],t.prototype,"isAnimation",void 0),wx([Sm],t.prototype,"isShowAdjustPoint",void 0),wx([Sm],t.prototype,"zIndex",void 0),wx([Sm],t.prototype,"state",void 0),wx([Sm],t.prototype,"style",void 0),wx([Sm],t.prototype,"arrowConfig",void 0),wx([Om],t.prototype,"sourceNode",null),wx([Om],t.prototype,"targetNode",null),wx([Om],t.prototype,"textPosition",null),wx([Eb],t.prototype,"setProperty",null),wx([Eb],t.prototype,"deleteProperty",null),wx([Eb],t.prototype,"setProperties",null),wx([Eb],t.prototype,"changeEdgeId",null),wx([Eb],t.prototype,"setStyle",null),wx([Eb],t.prototype,"setStyles",null),wx([Eb],t.prototype,"updateStyles",null),wx([Eb],t.prototype,"setTextMode",null),wx([Eb],t.prototype,"formatText",null),wx([Eb],t.prototype,"resetTextPosition",null),wx([Eb],t.prototype,"moveText",null),wx([Eb],t.prototype,"setText",null),wx([Eb],t.prototype,"updateText",null),wx([Eb],t.prototype,"setAnchors",null),wx([Eb],t.prototype,"setSelected",null),wx([Eb],t.prototype,"setHovered",null),wx([Eb],t.prototype,"setHitable",null),wx([Eb],t.prototype,"setHittable",null),wx([Eb],t.prototype,"openEdgeAnimation",null),wx([Eb],t.prototype,"closeEdgeAnimation",null),wx([Eb],t.prototype,"setElementState",null),wx([Eb],t.prototype,"updateStartPoint",null),wx([Eb],t.prototype,"moveStartPoint",null),wx([Eb],t.prototype,"updateEndPoint",null),wx([Eb],t.prototype,"moveEndPoint",null),wx([Eb],t.prototype,"setZIndex",null),wx([Eb],t.prototype,"initPoints",null),wx([Eb],t.prototype,"updateAttributes",null),wx([Eb],t.prototype,"getAdjustStart",null),wx([Eb],t.prototype,"getAdjustEnd",null),wx([Eb],t.prototype,"updateAfterAdjustStartAndEnd",null),t}(),Cx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Nx=function(){return Nx=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Nx.apply(this,arguments)},Tx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},Ax=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a};!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.BEZIER_EDGE,o.path="",o.initEdgeData(e),o.setAttributes(),o}Cx(e,t),e.prototype.initEdgeData=function(e){this.offset=100,t.prototype.initEdgeData.call(this,e)},e.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.bezier,n=t.prototype.getEdgeStyle.call(this),o=this.properties.style,i=void 0===o?{}:o;return Nx(Nx(Nx({},n),Is(e)),Is(i))},e.prototype.getTextPosition=function(){if(this.pointsList&&this.pointsList.length>0){var t=0,e=0;return this.pointsList.forEach((function(n){var o=n.x,i=n.y;t+=o,e+=i})),{x:t/this.pointsList.length,y:e/this.pointsList.length}}return{x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2}},e.prototype.getData=function(){var e=t.prototype.getData.call(this),n=this.pointsList.map((function(t){return{x:t.x,y:t.y}}));return Nx(Nx({},e),{pointsList:n})},e.prototype.getControls=function(){var t=this.startPoint,e=this.endPoint;return J_({start:t,end:e,sourceNode:this.sourceNode,targetNode:this.targetNode,offset:this.offset})},e.prototype.getPath=function(t){var e=Ax(t,4),n=e[0],o=e[1],i=e[2],r=e[3];return"M ".concat(n.x," ").concat(n.y,"\n C ").concat(o.x," ").concat(o.y,",\n ").concat(i.x," ").concat(i.y,",\n ").concat(r.x," ").concat(r.y)},e.prototype.initPoints=function(){this.pointsList.length>0?this.path=this.getPath(this.pointsList):this.updatePoints()},e.prototype.updatePoints=function(){var t=this.getControls(),e=t.sNext,n=t.ePre;this.updatePath(e,n)},e.prototype.updatePath=function(t,e){t=Is(t),e=Is(e);var n={x:this.startPoint.x,y:this.startPoint.y},o={x:this.endPoint.x,y:this.endPoint.y};if(!t||!e){var i=this.getControls();t=i.sNext,e=i.ePre}this.pointsList=[n,t,e,o],this.path=this.getPath(this.pointsList)},e.prototype.updateStartPoint=function(t){this.startPoint=Object.assign({},t),this.updatePoints()},e.prototype.updateEndPoint=function(t){this.endPoint=Object.assign({},t),this.updatePoints()},e.prototype.moveStartPoint=function(t,e){this.startPoint.x+=t,this.startPoint.y+=e;var n=Ax(this.pointsList,3),o=n[1],i=n[2];o.x+=t,o.y+=e,this.updatePath(o,i)},e.prototype.moveEndPoint=function(t,e){this.endPoint.x+=t,this.endPoint.y+=e;var n=Ax(this.pointsList,3),o=n[1],i=n[2];i.x+=t,i.y+=e,this.updatePath(o,i)},e.prototype.updateAdjustAnchor=function(t,e){var n;"sNext"===e?this.pointsList[1]=t:"ePre"===e&&(this.pointsList[2]=t),this.path=this.getPath(this.pointsList),(null===(n=this.text)||void 0===n?void 0:n.value)&&this.setText(li({},this.text,this.textPosition))},e.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},e.prototype.getAdjustEnd=function(){var t=this.pointsList;return t[t.length-1]||this.endPoint},e.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,n=t.endPoint,o=t.sourceNode,i=t.targetNode,r=J_({start:e,end:n,sourceNode:o,targetNode:i,offset:this.offset}),a=r.sNext,s=r.ePre;this.pointsList=[e,a,s,n],this.initPoints()},Tx([Sm],e.prototype,"path",void 0),Tx([Eb],e.prototype,"initPoints",null),Tx([Eb],e.prototype,"updatePoints",null),Tx([Eb],e.prototype,"updateStartPoint",null),Tx([Eb],e.prototype,"updateEndPoint",null),Tx([Eb],e.prototype,"moveStartPoint",null),Tx([Eb],e.prototype,"moveEndPoint",null),Tx([Eb],e.prototype,"updateAdjustAnchor",null),Tx([Eb],e.prototype,"getAdjustStart",null),Tx([Eb],e.prototype,"getAdjustEnd",null),Tx([Eb],e.prototype,"updateAfterAdjustStartAndEnd",null)}(Sx);var Mx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ox=function(){return Ox=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ox.apply(this,arguments)},Px=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},kx=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))};!function(t){function e(){var e=t.apply(this,kx([],Px(arguments),!1))||this;return e.modelType=Ey.LINE_EDGE,e}Mx(e,t),e.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.line,n=t.prototype.getEdgeStyle.call(this),o=this.properties.style,i=void 0===o?{}:o;return Ox(Ox(Ox({},n),Is(e)),Is(i))},e.prototype.getTextPosition=function(){return{x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2}}}(Sx);var Rx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Dx=function(){return Dx=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Dx.apply(this,arguments)},Lx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},Ix=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},jx=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))};!function(t){function e(){var e=t.apply(this,jx([],Ix(arguments),!1))||this;return e.modelType=Ey.POLYLINE_EDGE,e.draggingPointList=[],e}Rx(e,t),e.prototype.initEdgeData=function(e){this.offset=30,t.prototype.initEdgeData.call(this,e)},e.prototype.getEdgeStyle=function(){var e=this.graphModel.theme.polyline,n=t.prototype.getEdgeStyle.call(this),o=this.properties.style,i=void 0===o?{}:o;return Dx(Dx(Dx({},n),Is(e)),Is(i))},e.prototype.getTextPosition=function(){var t,e=null===(t=this.text)||void 0===t?void 0:t.value;if(this.dbClickPosition&&!e){var n=this.dbClickPosition;return{x:n.x,y:n.y}}var o=K_(this.points),i=Ix(U_(o),2),r=i[0],a=i[1];return{x:(r.x+a.x)/2,y:(r.y+a.y)/2}},e.prototype.getAfterAnchor=function(t,e,n){var o,i;return n.forEach((function(n){var r;t===Cy.HORIZONTAL?r=Math.abs(e.y-n.y):t===Cy.VERTICAL&&(r=Math.abs(e.x-n.x)),(!i||i>r)&&(i=r,o=n)})),o},e.prototype.getCrossPoint=function(t,e,n){var o;return t===Cy.HORIZONTAL?o={x:n.x,y:e.y}:t===Cy.VERTICAL&&(o={x:e.x,y:n.y}),o},e.prototype.removeCrossPoints=function(t,e,n){var o=n.map((function(t){return t}));if(1===t){var i=o[t],r=o[e],a=o[t-1];if(X_(a,i,this.sourceNode)){if(V_(i,r,this.sourceNode))(s=Y_(i,r,this.sourceNode))&&(o[t]=s,o.splice(t-1,1),t--,e--)}else this.sourceNode.anchors.forEach((function(e){(e.x===a.x&&e.x===i.x||e.y===a.y&&e.y===i.y)&&(EE(e.x,e.y,i.x,i.y)<EE(a.x,a.y,i.x,i.y)&&(o[t-1]=e))}))}if(e===n.length-2){var s,l=o[t],u=o[e],c=o[e+1];if(X_(u,c,this.targetNode)){if(V_(l,u,this.targetNode))(s=Y_(l,u,this.targetNode))&&(o[e]=s,o.splice(e+1,1))}else this.targetNode.anchors.forEach((function(t){(t.x===c.x&&t.x===u.x||t.y===c.y&&t.y===u.y)&&(EE(t.x,t.y,u.x,u.y)<EE(c.x,c.y,u.x,u.y)&&(o[e+1]=t))}))}return o},e.prototype.getDraggingPoints=function(t,e,n,o,i){var r=i.map((function(t){return t})),a=this.getAfterAnchor(t,n,o),s=this.getCrossPoint(t,n,a);return"start"===e?(r.unshift(s),r.unshift(a)):(r.push(s),r.push(a)),r},e.prototype.updateCrossPoints=function(t){var e=t.map((function(t){return t})),n=t[0],o=t[1],i=t[e.length-2],r=t[e.length-1],a=this.sourceNode,s=this.targetNode,l=a.modelType,u=s.modelType,c=q_(n,o),d=e[0];switch(l){case Ey.RECT_NODE:if(0!==a.radius)TE(n,a)||(d=CE(n,c,a));break;case Ey.CIRCLE_NODE:d=NE(n,c,a);break;case Ey.ELLIPSE_NODE:d=AE(n,c,a);break;case Ey.DIAMOND_NODE:case Ey.POLYGON_NODE:d=ME(n,c,a)}d&&(e[0]=d);var h=q_(i,r),p=e[e.length-1];switch(u){case Ey.RECT_NODE:if(0!==s.radius)TE(r,s)||(p=CE(r,h,s));break;case Ey.CIRCLE_NODE:p=NE(r,h,s);break;case Ey.ELLIPSE_NODE:p=AE(r,h,s);break;case Ey.DIAMOND_NODE:case Ey.POLYGON_NODE:p=ME(r,h,s)}return p&&(e[e.length-1]=p),e},e.prototype.getData=function(){var e=t.prototype.getData.call(this),n=this.pointsList.map((function(t){return{x:t.x,y:t.y}}));return Object.assign({},e,{pointsList:n})},e.prototype.initPoints=function(){this.pointsList.length>0?this.points=this.pointsList.map((function(t){return"".concat(t.x,",").concat(t.y)})).join(" "):this.updatePoints()},e.prototype.updatePoints=function(){var t=G_({x:this.startPoint.x,y:this.startPoint.y},{x:this.endPoint.x,y:this.endPoint.y},this.sourceNode,this.targetNode,this.offset||0);this.pointsList=t,this.points=t.map((function(t){return"".concat(t.x,",").concat(t.y)})).join(" ")},e.prototype.updateStartPoint=function(t){this.startPoint=Object.assign({},t),this.updatePoints()},e.prototype.moveStartPoint=function(t,e){this.startPoint.x+=t,this.startPoint.y+=e,this.updatePoints()},e.prototype.updateEndPoint=function(t){this.endPoint=Object.assign({},t),this.updatePoints()},e.prototype.moveEndPoint=function(t,e){this.endPoint.x+=t,this.endPoint.y+=e,this.updatePoints()},e.prototype.updatePointsList=function(t,e){this.pointsList.forEach((function(n){n.x+=t,n.y+=e}));var n=this.pointsList[0];this.startPoint=Object.assign({},n);var o=this.pointsList[this.pointsList.length-1];this.endPoint=Object.assign({},o),this.initPoints()},e.prototype.dragAppendStart=function(){this.draggingPointList=this.pointsList.map((function(t){return t}))},e.prototype.dragAppendSimple=function(t,e){var n;this.isDragging=!0;var o=t.start,i=t.end,r=t.startIndex,a=t.endIndex,s=t.direction,l=this.pointsList,u=l;return s===Cy.HORIZONTAL?(l[r]={x:o.x,y:o.y+e.y},l[a]={x:i.x,y:i.y+e.y},u=this.pointsList.map((function(t){return t}))):s===Cy.VERTICAL&&(l[r]={x:o.x+e.x,y:o.y},l[a]={x:i.x+e.x,y:i.y},u=this.pointsList.map((function(t){return t}))),this.updatePointsAfterDrag(u),this.draggingPointList=u,(null===(n=this.text)||void 0===n?void 0:n.value)&&this.setText(li({},this.text,this.textPosition)),{start:li({},l[r]),end:li({},l[a]),startIndex:r,endIndex:a,direction:s}},e.prototype.dragAppend=function(t,e){var n;this.isDragging=!0;var o=t.start,i=t.end,r=t.startIndex,a=t.endIndex,s=t.direction,l=this.pointsList;if(s===Cy.HORIZONTAL){l[r]={x:o.x,y:o.y+e.y},l[a]={x:i.x,y:i.y+e.y};var u=this.pointsList.map((function(t){return t}));if(0!==r&&a!==this.pointsList.length-1&&(u=this.removeCrossPoints(r,a,u)),0===r){var c={x:o.x,y:o.y+e.y};if(!wE(c,this.sourceNode)){var d=this.sourceNode.anchors;u=this.getDraggingPoints(s,"start",c,d,u)}}if(a===this.pointsList.length-1){var h={x:i.x,y:i.y+e.y};if(!wE(h,this.targetNode)){d=this.targetNode.anchors;u=this.getDraggingPoints(s,"end",h,d,u)}}this.updatePointsAfterDrag(u),this.draggingPointList=u}else if(s===Cy.VERTICAL){l[r]={x:o.x+e.x,y:o.y},l[a]={x:i.x+e.x,y:i.y};u=this.pointsList.map((function(t){return t}));if(0!==r&&a!==this.pointsList.length-1&&(u=this.removeCrossPoints(r,a,u)),0===r){c={x:o.x+e.x,y:o.y};if(!wE(c,this.sourceNode)){d=this.sourceNode.anchors;u=this.getDraggingPoints(s,"start",c,d,u)}}if(a===this.pointsList.length-1){h={x:i.x+e.x,y:i.y};if(!wE(h,this.targetNode)){d=this.targetNode.anchors;u=this.getDraggingPoints(s,"end",h,d,u)}}this.updatePointsAfterDrag(u),this.draggingPointList=u}return(null===(n=this.text)||void 0===n?void 0:n.value)&&this.setText(li({},this.text,this.textPosition)),{start:li({},l[r]),end:li({},l[a]),startIndex:r,endIndex:a,direction:s}},e.prototype.dragAppendEnd=function(){if(this.draggingPointList){var t=W_(K_(this.points));this.pointsList=t.map((function(t){return t})),this.draggingPointList=[];var e=t[0];this.startPoint=li({},e);var n=t[t.length-1];this.endPoint=li({},n)}this.isDragging=!1},e.prototype.updatePointsAfterDrag=function(t){var e=this.updateCrossPoints(t);this.points=e.map((function(t){return"".concat(t.x,",").concat(t.y)})).join(" ")},e.prototype.getAdjustStart=function(){return this.pointsList[0]||this.startPoint},e.prototype.getAdjustEnd=function(){var t=this.pointsList;return t[t.length-1]||this.endPoint},e.prototype.updateAfterAdjustStartAndEnd=function(t){var e=t.startPoint,n=t.endPoint,o=t.sourceNode,i=t.targetNode;this.pointsList=G_({x:e.x,y:e.y},{x:n.x,y:n.y},o,i,this.offset||0),this.initPoints()},Lx([Sm],e.prototype,"dbClickPosition",void 0),Lx([Eb],e.prototype,"initPoints",null),Lx([Eb],e.prototype,"updatePoints",null),Lx([Eb],e.prototype,"updateStartPoint",null),Lx([Eb],e.prototype,"moveStartPoint",null),Lx([Eb],e.prototype,"updateEndPoint",null),Lx([Eb],e.prototype,"moveEndPoint",null),Lx([Eb],e.prototype,"updatePointsList",null),Lx([Eb],e.prototype,"dragAppendStart",null),Lx([Eb],e.prototype,"dragAppendSimple",null),Lx([Eb],e.prototype,"dragAppend",null),Lx([Eb],e.prototype,"dragAppendEnd",null),Lx([Eb],e.prototype,"updatePointsAfterDrag",null),Lx([Eb],e.prototype,"getAdjustStart",null),Lx([Eb],e.prototype,"getAdjustEnd",null),Lx([Eb],e.prototype,"updateAfterAdjustStartAndEnd",null)}(Sx);var Bx=function(){return Bx=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Bx.apply(this,arguments)},Hx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},Fx=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],o=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},zx=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},Wx=function(){function t(t,e){var n;this.BaseType=_y.NODE,this.id="",this.type="",this.x=0,this.y=0,this.textMode=Ny.TEXT,this.text={value:"",x:0,y:0,draggable:!1,editable:!0},this._width=100,this._height=80,this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.anchorsOffset=[],this.virtual=!1,this.isSelected=!1,this.isHovered=!1,this.isShowAnchor=!1,this.isDragging=!1,this.isHitable=!0,this.isHittable=!0,this.draggable=!0,this.visible=!0,this.rotatable=!0,this.resizable=!0,this.zIndex=1,this.state=xy.DEFAULT,this.autoToFront=!0,this.style={},this._rotate=0,this.modelType=Ey.NODE,this.additionStateData={},this.targetRules=[],this.sourceRules=[],this.moveRules=[],this.hasSetTargetRules=!1,this.hasSetSourceRules=!1,this.graphModel=e,this.properties=null!==(n=t.properties)&&void 0!==n?n:{},this.initNodeData(t),this.setAttributes()}return Object.defineProperty(t.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t;var e=this.x,n=void 0===e?0:e,o=this.y,i=void 0===o?0:o;this.transform=new mE(-n,-i).rotate(t).translate(n,i).toString()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"incoming",{get:function(){return{nodes:this.graphModel.getNodeIncomingNode(this.id),edges:this.graphModel.getNodeIncomingEdge(this.id)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outgoing",{get:function(){return{nodes:this.graphModel.getNodeOutgoingNode(this.id),edges:this.graphModel.getNodeOutgoingEdge(this.id)}},enumerable:!1,configurable:!0}),t.prototype.initNodeData=function(t){if(t.properties||(t.properties={}),!t.id){var e=this.graphModel.idGenerator,n=e&&e(t.type),o=this.createId();t.id=o||n||JE()}this.formatText(t),li(this,OE(t)),this.graphModel.overlapMode===Sy.INCREASE&&(this.zIndex=t.zIndex||iw())},t.prototype.setAttributes=function(){},t.prototype.createId=function(){return null},t.prototype.setTextMode=function(t){this.textMode=t},t.prototype.formatText=function(t){var e,n,o,i=t.x,r=t.y,a=t.text,s={value:"",x:i,y:r,draggable:!1,editable:!0};a&&("string"==typeof a?s.value=a:(s=Bx(Bx({},s),{x:null!==(e=a.x)&&void 0!==e?e:i,y:null!==(n=a.y)&&void 0!==n?n:r,value:null!==(o=a.value)&&void 0!==o?o:""}),nd(a.draggable)||(s.draggable=a.draggable),nd(a.editable)||(s.draggable=a.draggable))),t.text=s},t.prototype.resize=function(t){var e=t.width,n=t.height,o=t.deltaX,i=t.deltaY;return this.move(o/2,i/2),this.width=e,this.height=n,this.setProperties({width:e,height:n}),this.getData()},t.prototype.proportionalResize=function(){},t.prototype.getData=function(){var t=this.text,e=t.x,n=t.y,o=t.value,i=this.properties;Pb(i)&&(i=Ib(i));var r={id:this.id,type:this.type,x:this.x,y:this.y,properties:i};return this.rotate&&(r.rotate=this.rotate),this.graphModel.overlapMode===Sy.INCREASE&&(r.zIndex=this.zIndex),o&&(r.text={x:e,y:n,value:o}),r},t.prototype.getHistoryData=function(){return this.getData()},t.prototype.getProperties=function(){return Ib(this.properties)},t.prototype.getOuterGAttributes=function(){return{className:""}},t.prototype.getNodeStyle=function(){return Bx(Bx({},this.graphModel.theme.baseNode),this.style)},t.prototype.getTextStyle=function(){var t=this.graphModel.theme.nodeText,e=this.properties.textStyle,n=void 0===e?{}:e;return Bx(Bx({},Is(t)),Is(n))},t.prototype.getRotateControlStyle=function(){return Is(this.graphModel.theme.rotateControl)},t.prototype.getResizeControlStyle=function(){return Is(this.graphModel.theme.resizeControl)},t.prototype.getResizeOutlineStyle=function(){return Is(this.graphModel.theme.resizeOutline)},t.prototype.getAnchorStyle=function(t){return Is(this.graphModel.theme.anchor)},t.prototype.getAnchorLineStyle=function(t){return Is(this.graphModel.theme.anchorLine)},t.prototype.getOutlineStyle=function(){return Is(this.graphModel.theme.outline)},t.prototype.isAllowConnectedAsSource=function(t,e,n,o){var i=this.hasSetSourceRules?this.sourceRules:this.getConnectedSourceRules();this.hasSetSourceRules=!0;for(var r=!0,a="",s=0;s<i.length;s++){var l=i[s];if(!l.validate.call(this,this,t,e,n,o)){r=!1,a=l.message;break}}return{isAllPass:r,msg:a}},t.prototype.getConnectedSourceRules=function(){return this.sourceRules},t.prototype.isAllowConnectedAsTarget=function(t,e,n,o){var i=this.hasSetTargetRules?this.targetRules:this.getConnectedTargetRules();this.hasSetTargetRules=!0;for(var r=!0,a="",s=0;s<i.length;s++){var l=i[s];if(!l.validate.call(this,t,this,e,n,o)){r=!1,a=l.message;break}}return{isAllPass:r,msg:a}},t.prototype.isAllowMoveNode=function(t,e){var n,o,i=!0,r=!0,a=this.moveRules.concat(this.graphModel.nodeMoveRules);try{for(var s=Fx(a),l=s.next();!l.done;l=s.next()){var u=(0,l.value)(this,t,e);if(!u)return!1;if("object"==typeof u){var c=u;if(!c.x&&!c.y)return!1;i=i&&c.x,r=r&&c.y}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return{x:i,y:r}},t.prototype.getConnectedTargetRules=function(){return this.targetRules},t.prototype.getAnchorsByOffset=function(){var t=this,e=t.anchorsOffset,n=t.id,o=t.x,i=t.y;return e&&e.length>0?e.map((function(t,e){return t.length?{id:"".concat(n,"_").concat(e),x:o+t[0],y:i+t[1]}:Bx(Bx({},t),{x:o+t.x,y:i+t.y,id:t.id||"".concat(n,"_").concat(e)})})):this.getDefaultAnchor()},t.prototype.getDefaultAnchor=function(){return[]},t.prototype.getTargetAnchor=function(t){return _E(t,this)},t.prototype.getBounds=function(){return{minX:this.x-this.width/2,minY:this.y-this.height/2,maxX:this.x+this.width/2,maxY:this.y+this.height/2}},Object.defineProperty(t.prototype,"anchors",{get:function(){var t=this.getAnchorsByOffset(),e=this,n=e.x,o=e.y,i=e.rotate;return t.forEach((function(t){var e=t.x,r=t.y,a=zx(new gE([e,r,1]).translate(-n,-o).rotate(i).translate(n,o)[0],2),s=a[0],l=a[1];t.x=s,t.y=l})),t},enumerable:!1,configurable:!0}),t.prototype.getAnchorInfo=function(t){if(!Jc(t))for(var e=0;e<this.anchors.length;e++){var n=this.anchors[e];if(n.id===t)return n}},t.prototype.addNodeMoveRules=function(t){this.moveRules.includes(t)||this.moveRules.push(t)},t.prototype.isAllowMoveByXORY=function(t,e,n){var o,i;if(n)o=!0,i=!0;else{var r=this.isAllowMoveNode(t,e);"boolean"==typeof r?(o=r,i=r):(o=r.x,i=r.y)}return{isAllowMoveX:o,isAllowMoveY:i}},t.prototype.move=function(t,e,n){void 0===n&&(n=!1);var o=this.isAllowMoveByXORY(t,e,n),i=o.isAllowMoveX,r=o.isAllowMoveY;return i&&(this.x=this.x+t,this.text&&this.moveText(t,0)),r&&(this.y=this.y+e,this.text&&this.moveText(0,e)),i||r},t.prototype.getMoveDistance=function(t,e,n){void 0===n&&(n=!1);var o=this.isAllowMoveByXORY(t,e,n),i=o.isAllowMoveX,r=o.isAllowMoveY,a=0,s=0;return i&&t&&(this.x=this.x+t,this.text&&this.moveText(t,0),a=t),r&&e&&(this.y=this.y+e,this.text&&this.moveText(0,e),s=e),[a,s]},t.prototype.moveTo=function(t,e,n){void 0===n&&(n=!1);var o=t-this.x,i=e-this.y;return!(!n&&!this.isAllowMoveNode(o,i))&&(this.text&&this.moveText(o,i),this.x=t,this.y=e,!0)},t.prototype.moveText=function(t,e){var n=this.text,o=n.x,i=n.y,r=n.value,a=n.draggable,s=n.editable;this.text={value:r,editable:s,draggable:a,x:o+t,y:i+e}},t.prototype.updateText=function(t){this.text=Bx(Bx({},Ib(this.text)),{value:t})},t.prototype.setSelected=function(t){void 0===t&&(t=!0),this.isSelected=t},t.prototype.setHovered=function(t){void 0===t&&(t=!0),this.isHovered=t,this.setIsShowAnchor(t)},t.prototype.setIsShowAnchor=function(t){void 0===t&&(t=!0),this.isShowAnchor=t},t.prototype.setRotatable=function(t){void 0===t&&(t=!0),this.rotatable=t},t.prototype.setResizable=function(t){void 0===t&&(t=!0),this.resizable=t},t.prototype.setHitable=function(t){void 0===t&&(t=!0),this.isHitable=t},t.prototype.setHittable=function(t){void 0===t&&(t=!0),this.isHittable=t},t.prototype.setElementState=function(t,e){this.state=t,this.additionStateData=e},t.prototype.setProperty=function(t,e){var n,o=Ib(this.properties),i=Bx(Bx({},o),((n={})[t]=Oy(e),n));this.properties=i,this.setAttributes(),this.graphModel.eventCenter.emit(wy.NODE_PROPERTIES_CHANGE,{id:this.id,keys:[t],preProperties:o,properties:i})},t.prototype.setProperties=function(t){var e=Ib(this.properties),n=Bx(Bx({},e),Oy(t));this.properties=n,this.setAttributes();var o=[];pd(t,(function(t,n){(fc(e,n)&&e[n]!==t||!fc(e,n))&&o.push(n)})),this.graphModel.eventCenter.emit(wy.NODE_PROPERTIES_CHANGE,{id:this.id,keys:o,preProperties:e,properties:n})},t.prototype.deleteProperty=function(t){delete this.properties[t],this.setAttributes()},t.prototype.setStyle=function(t,e){var n;this.style=Bx(Bx({},this.style),((n={})[t]=Oy(e),n))},t.prototype.setStyles=function(t){this.style=Bx(Bx({},this.style),Oy(t))},t.prototype.updateStyles=function(t){this.style=Bx({},Oy(t))},t.prototype.setZIndex=function(t){void 0===t&&(t=1),this.zIndex=t},t.prototype.updateAttributes=function(t){li(this,t)},t.BaseType=_y.NODE,Hx([Sm],t.prototype,"type",void 0),Hx([Sm],t.prototype,"x",void 0),Hx([Sm],t.prototype,"y",void 0),Hx([Sm],t.prototype,"textMode",void 0),Hx([Sm],t.prototype,"text",void 0),Hx([Sm],t.prototype,"properties",void 0),Hx([Sm],t.prototype,"_width",void 0),Hx([Sm],t.prototype,"_height",void 0),Hx([Sm],t.prototype,"anchorsOffset",void 0),Hx([Sm],t.prototype,"isSelected",void 0),Hx([Sm],t.prototype,"isHovered",void 0),Hx([Sm],t.prototype,"isShowAnchor",void 0),Hx([Sm],t.prototype,"isDragging",void 0),Hx([Sm],t.prototype,"isHitable",void 0),Hx([Sm],t.prototype,"isHittable",void 0),Hx([Sm],t.prototype,"draggable",void 0),Hx([Sm],t.prototype,"visible",void 0),Hx([Sm],t.prototype,"rotatable",void 0),Hx([Sm],t.prototype,"resizable",void 0),Hx([Sm],t.prototype,"zIndex",void 0),Hx([Sm],t.prototype,"state",void 0),Hx([Sm],t.prototype,"autoToFront",void 0),Hx([Sm],t.prototype,"style",void 0),Hx([Sm],t.prototype,"transform",void 0),Hx([Sm],t.prototype,"_rotate",void 0),Hx([Om],t.prototype,"incoming",null),Hx([Om],t.prototype,"outgoing",null),Hx([Eb],t.prototype,"setTextMode",null),Hx([Eb],t.prototype,"addNodeMoveRules",null),Hx([Eb],t.prototype,"move",null),Hx([Eb],t.prototype,"getMoveDistance",null),Hx([Eb],t.prototype,"moveTo",null),Hx([Eb],t.prototype,"moveText",null),Hx([Eb],t.prototype,"updateText",null),Hx([Eb],t.prototype,"setSelected",null),Hx([Eb],t.prototype,"setHovered",null),Hx([Eb],t.prototype,"setIsShowAnchor",null),Hx([Eb],t.prototype,"setRotatable",null),Hx([Eb],t.prototype,"setResizable",null),Hx([Eb],t.prototype,"setHitable",null),Hx([Eb],t.prototype,"setHittable",null),Hx([Eb],t.prototype,"setElementState",null),Hx([Eb],t.prototype,"setProperty",null),Hx([Eb],t.prototype,"setProperties",null),Hx([Eb],t.prototype,"deleteProperty",null),Hx([Eb],t.prototype,"setStyle",null),Hx([Eb],t.prototype,"setStyles",null),Hx([Eb],t.prototype,"updateStyles",null),Hx([Eb],t.prototype,"setZIndex",null),Hx([Eb],t.prototype,"updateAttributes",null),t}(),Gx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ux=function(){return Ux=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ux.apply(this,arguments)},Xx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a};!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.CIRCLE_NODE,o.r=50,o.setAttributes(),o}Gx(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return 2*this.r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return 2*this.r},enumerable:!1,configurable:!0}),e.prototype.setAttributes=function(){t.prototype.setAttributes.call(this);var e=this.properties.r;e&&(this.r=e)},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this),n=this.graphModel.theme.circle,o=this.properties.style,i=void 0===o?{}:o;return Ux(Ux(Ux({},e),Is(n)),Is(i))},e.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,o=t.r;return[{x:e,y:n-o,id:"".concat(this.id,"_0")},{x:e+o,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+o,id:"".concat(this.id,"_2")},{x:e-o,y:n,id:"".concat(this.id,"_3")}]},e.prototype.resize=function(t){var e=t.width,n=t.deltaX,o=t.deltaY;return this.move(n/2,o/2),this.r=e,this.setProperties({r:e}),this.getData()},Xx([Sm],e.prototype,"r",void 0),Xx([Om],e.prototype,"width",null),Xx([Om],e.prototype,"height",null)}(Wx);var Vx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Yx=function(){return Yx=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Yx.apply(this,arguments)},qx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},Kx=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a};!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.DIAMOND_NODE,o.rx=30,o.ry=50,o.setAttributes(),o}Vx(e,t),e.prototype.setAttributes=function(){t.prototype.setAttributes.call(this);var e=this.properties,n=e.rx,o=e.ry;n&&(this.rx=n),o&&(this.ry=o)},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this),n=this.graphModel.theme.diamond,o=this.properties.style,i=void 0===o?{}:o;return Yx(Yx(Yx({},e),Is(n)),Is(i))},Object.defineProperty(e.prototype,"points",{get:function(){var t=this,e=t.x,n=t.y,o=t.rx,i=t.ry;return[[e,n-i],[e+o,n],[e,n+i],[e-o,n]]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pointsPosition",{get:function(){return Ju(this.points,(function(t){var e=Kx(t,2);return{x:e[0],y:e[1]}}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return xu(this.points,(function(n){var o=Kx(n,1)[0];o<t&&(t=o),o>e&&(e=o)})),e-t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return xu(this.points,(function(n){var o=Kx(n,2)[1];o<t&&(t=o),o>e&&(e=o)})),e-t},enumerable:!1,configurable:!0}),e.prototype.getDefaultAnchor=function(){var t=this;return Ju(this.points,(function(e,n){var o=Kx(e,2);return{x:o[0],y:o[1],id:"".concat(t.id,"_").concat(n)}}))},e.prototype.resize=function(t){var e=t.width,n=t.height,o=t.deltaX,i=t.deltaY;return this.move(o/2,i/2),this.rx=e,this.ry=n,this.setProperties({rx:e,ry:n}),this.getData()},qx([Sm],e.prototype,"rx",void 0),qx([Sm],e.prototype,"ry",void 0),qx([Om],e.prototype,"points",null),qx([Om],e.prototype,"pointsPosition",null),qx([Om],e.prototype,"width",null),qx([Om],e.prototype,"height",null)}(Wx);var Zx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),$x=function(){return $x=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},$x.apply(this,arguments)},Jx=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a};!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.ELLIPSE_NODE,o.rx=30,o.ry=45,o.setAttributes(),o}Zx(e,t),e.prototype.setAttributes=function(){t.prototype.setAttributes.call(this);var e=this.properties,n=e.rx,o=e.ry;n&&(this.rx=n),o&&(this.ry=o)},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this),n=this.graphModel.theme.ellipse,o=this.properties.style,i=void 0===o?{}:o;return $x($x($x({},e),Is(n)),Is(i))},Object.defineProperty(e.prototype,"width",{get:function(){return 2*this.rx},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return 2*this.ry},enumerable:!1,configurable:!0}),e.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,o=t.rx,i=t.ry;return[{x:e,y:n-i,id:"".concat(this.id,"_0")},{x:e+o,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+i,id:"".concat(this.id,"_2")},{x:e-o,y:n,id:"".concat(this.id,"_3")}]},e.prototype.resize=function(t){var e=t.width,n=t.height,o=t.deltaX,i=t.deltaY;return this.move(o/2,i/2),this.rx=e,this.ry=n,this.setProperties({rx:e,ry:n}),this.getData()},Jx([Sm],e.prototype,"rx",void 0),Jx([Sm],e.prototype,"ry",void 0),Jx([Om],e.prototype,"width",null),Jx([Om],e.prototype,"height",null)}(Wx);var Qx=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),t_=function(){return t_=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t_.apply(this,arguments)},e_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},n_=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a};!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.POLYGON_NODE,o.points=[[50,0],[100,50],[50,100],[0,50]],o.setAttributes(),o}Qx(e,t),e.prototype.setAttributes=function(){t.prototype.setAttributes.call(this);var e=this.properties,n=e.points,o=e.width,i=e.height,r=n||this.points;this.points=function(t,e,n){if(!t)return[];var o=Math.min.apply(Math,oE([],nE(t.map((function(t){return t[0]}))),!1)),i=Math.max.apply(Math,oE([],nE(t.map((function(t){return t[0]}))),!1)),r=Math.min.apply(Math,oE([],nE(t.map((function(t){return t[1]}))),!1)),a=Math.max.apply(Math,oE([],nE(t.map((function(t){return t[1]}))),!1)),s=-o,l=-r,u=t.map((function(t){var e=nE(t,2),n=e[0],o=e[1];return[n+s,o+l]})),c=i-o,d=a-r,h=e?e/c:1,p=n?n/d:1,f=Math.min(h,p);return u.map((function(t){var e=nE(t,2),n=e[0],o=e[1];return[n*f,o*f]}))}(r,o,i)},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this),n=this.graphModel.theme.polygon,o=this.properties.style,i=void 0===o?{}:o;return t_(t_(t_({},e),Is(n)),Is(i))},Object.defineProperty(e.prototype,"pointsPosition",{get:function(){var t=this,e=t.x,n=t.y,o=t.width,i=t.height;return this.points.map((function(t){return{x:t[0]+e-o/2,y:t[1]+n-i/2}}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return this.points.forEach((function(n){var o=n_(n,1)[0];o<t&&(t=o),o>e&&(e=o)})),e-t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MIN_SAFE_INTEGER;return this.points.forEach((function(n){var o=n_(n,2)[1];o<t&&(t=o),o>e&&(e=o)})),e-t},enumerable:!1,configurable:!0}),e.prototype.getDefaultAnchor=function(){var t=this,e=this,n=e.x,o=e.y,i=e.width,r=e.height;return e.points.map((function(e,a){var s=n_(e,2),l=s[0],u=s[1];return{x:n+l-i/2,y:o+u-r/2,id:"".concat(t.id,"_").concat(a)}}))},e.prototype.resize=function(t){var e=this,n=t.width,o=t.height,i=t.deltaX,r=t.deltaY;this.move(i/2,r/2);var a=Ju(this.points,(function(t){var i=n_(t,2),r=i[0],a=i[1];return[r*n/e.width,a*o/e.height]}));return this.points=a,this.properties.points=a,this.getData()},e_([Sm],e.prototype,"points",void 0),e_([Om],e.prototype,"pointsPosition",null),e_([Om],e.prototype,"width",null),e_([Om],e.prototype,"height",null)}(Wx);var o_=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),i_=function(){return i_=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},i_.apply(this,arguments)},r_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a};!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.RECT_NODE,o.radius=0,o.setAttributes(),o}o_(e,t),e.prototype.setAttributes=function(){t.prototype.setAttributes.call(this);var e=this.properties,n=e.width,o=e.height,i=e.radius;n&&(this.width=n),o&&(this.height=o),i&&(this.radius=i)},e.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,o=t.width,i=t.height;return[{x:e,y:n-i/2,id:"".concat(this.id,"_0")},{x:e+o/2,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+i/2,id:"".concat(this.id,"_2")},{x:e-o/2,y:n,id:"".concat(this.id,"_3")}]},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this),n=this.graphModel.theme.rect,o=this.properties.style,i=void 0===o?{}:o;return i_(i_(i_({},e),Is(n)),Is(i))},r_([Sm],e.prototype,"radius",void 0)}(Wx);var a_=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),s_=function(){return s_=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},s_.apply(this,arguments)},l_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},u_=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},c_=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))};!function(t){function e(){var e=t.apply(this,c_([],u_(arguments),!1))||this;return e.modelType=Ey.TEXT_NODE,e}a_(e,t),e.prototype.getTextStyle=function(){var e=t.prototype.getTextStyle.call(this),n=this.graphModel.theme.text,o=this.properties.textStyle;return s_(s_(s_({},e),Is(n)),Is(o))},Object.defineProperty(e.prototype,"width",{get:function(){var t=String(this.text.value).split(/[\r\n]/g),e=this.getTextStyle().fontSize;return kE({rows:t,fontSize:e,rowsLength:t.length}).width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){var t=String(this.text.value).split(/[\r\n]/g),e=this.getTextStyle().fontSize;return kE({rows:t,fontSize:e,rowsLength:t.length}).height},enumerable:!1,configurable:!0}),l_([Om],e.prototype,"width",null),l_([Om],e.prototype,"height",null)}(Wx);var d_=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();!function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.modelType=Ey.HTML_NODE,o.setAttributes(),o}d_(e,t),e.prototype.setAttributes=function(){t.prototype.setAttributes.call(this);var e=this.properties,n=e.width,o=e.height;n&&(this.width=n),o&&(this.height=o)},e.prototype.getDefaultAnchor=function(){var t=this,e=t.x,n=t.y,o=t.width,i=t.height;return[{x:e,y:n-i/2,id:"".concat(this.id,"_0")},{x:e+o/2,y:n,id:"".concat(this.id,"_1")},{x:e,y:n+i/2,id:"".concat(this.id,"_2")},{x:e-o/2,y:n,id:"".concat(this.id,"_3")}]}}(Wx);var h_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},p_={stopZoomGraph:!1,stopScrollGraph:!1,stopMoveGraph:!1,adjustEdge:!1,adjustEdgeStartAndEnd:!1,adjustNodePosition:!1,hideAnchors:!0,allowRotate:!1,allowResize:!1,nodeSelectedOutline:!0,textEdit:!1,nodeTextEdit:!1,edgeTextEdit:!1,textDraggable:!1,nodeTextDraggable:!1,edgeTextDraggable:!1},f_=["isSilentMode","stopZoomGraph","stopScrollGraph","stopMoveGraph","adjustEdge","adjustEdgeMiddle","adjustEdgeStartAndEnd","adjustEdgeStart","adjustEdgeEnd","adjustNodePosition","hideAnchors","allowRotate","allowResize","autoExpand","hoverOutline","nodeSelectedOutline","edgeSelectedOutline","textEdit","nodeTextEdit","edgeTextEdit","textDraggable","nodeTextDraggable","edgeTextDraggable","multipleSelectKey","textMode","nodeTextMode","edgeTextMode","nodeTextMultiple","edgeTextMultiple","nodeTextVertical","edgeTextVertical"],g_=function(){function t(t){this.isSilentMode=!1,this.stopZoomGraph=!1,this.stopMoveGraph=!1,this.stopScrollGraph=!1,this.textMode=Ny.TEXT,this.textEdit=!0,this.textDraggable=!1,this.nodeTextEdit=!0,this.nodeTextDraggable=!1,this.nodeTextMultiple=!1,this.nodeTextVertical=!1,this.nodeTextMode=Ny.TEXT,this.edgeTextMode=Ny.TEXT,this.edgeTextEdit=!0,this.edgeTextDraggable=!1,this.edgeTextMultiple=!1,this.edgeTextVertical=!1,this.hideAnchors=!1,this.allowRotate=!1,this.allowResize=!1,this.hoverOutline=!0,this.nodeSelectedOutline=!0,this.adjustNodePosition=!0,this.autoExpand=!1,this.adjustEdge=!0,this.adjustEdgeMiddle=!1,this.adjustEdgeStartAndEnd=!1,this.adjustEdgeStart=!1,this.adjustEdgeEnd=!1,this.edgeSelectedOutline=!0,this.multipleSelectKey="",li(this,this.computeConfig(t))}return t.prototype.updateEditConfig=function(t){var e=this.computeConfig(t);li(this,e)},t.prototype.computeConfig=function(t){var e=t.isSilentMode,n=t.textDraggable,o=t.textMode,i=t.textEdit,r=t.adjustEdgeStartAndEnd,a={};if(!1===e&&li(a,this.stagedConfig),!0===e&&e!==this.isSilentMode){var s=yh(p_,f_);this.stagedConfig=yh(this,f_),li(a,s)}nd(i)||li(a,{nodeTextEdit:i,edgeTextEdit:i}),nd(n)||li(a,{nodeTextDraggable:n,edgeTextDraggable:n}),o&&li(a,{nodeTextMode:o,edgeTextMode:o}),Wc(r)&&li(a,{adjustEdgeStart:r,adjustEdgeEnd:r});var l=yh(t,f_);return li(a,l)},t.prototype.updateTextMode=function(t){this.textMode=t,this.edgeTextMode=t,this.nodeTextMode=t},t.prototype.getConfig=function(){return yh(this,f_)},h_([Sm],t.prototype,"isSilentMode",void 0),h_([Sm],t.prototype,"stopZoomGraph",void 0),h_([Sm],t.prototype,"stopMoveGraph",void 0),h_([Sm],t.prototype,"stopScrollGraph",void 0),h_([Sm],t.prototype,"textMode",void 0),h_([Sm],t.prototype,"textEdit",void 0),h_([Sm],t.prototype,"textDraggable",void 0),h_([Sm],t.prototype,"nodeTextEdit",void 0),h_([Sm],t.prototype,"nodeTextDraggable",void 0),h_([Sm],t.prototype,"nodeTextMultiple",void 0),h_([Sm],t.prototype,"nodeTextVertical",void 0),h_([Sm],t.prototype,"nodeTextMode",void 0),h_([Sm],t.prototype,"edgeTextMode",void 0),h_([Sm],t.prototype,"edgeTextEdit",void 0),h_([Sm],t.prototype,"edgeTextDraggable",void 0),h_([Sm],t.prototype,"edgeTextMultiple",void 0),h_([Sm],t.prototype,"edgeTextVertical",void 0),h_([Sm],t.prototype,"hideAnchors",void 0),h_([Sm],t.prototype,"allowRotate",void 0),h_([Sm],t.prototype,"allowResize",void 0),h_([Sm],t.prototype,"hoverOutline",void 0),h_([Sm],t.prototype,"nodeSelectedOutline",void 0),h_([Sm],t.prototype,"adjustNodePosition",void 0),h_([Sm],t.prototype,"autoExpand",void 0),h_([Sm],t.prototype,"adjustEdge",void 0),h_([Sm],t.prototype,"adjustEdgeMiddle",void 0),h_([Sm],t.prototype,"adjustEdgeStartAndEnd",void 0),h_([Sm],t.prototype,"adjustEdgeStart",void 0),h_([Sm],t.prototype,"adjustEdgeEnd",void 0),h_([Sm],t.prototype,"edgeSelectedOutline",void 0),h_([Eb],t.prototype,"updateEditConfig",null),h_([Eb],t.prototype,"updateTextMode",null),t}(),v_=function(){function t(){this._events={}}return t.prototype.on=function(t,e,n){var o=this;null==t||t.split(",").forEach((function(t){t=t.trim(),o._events[t]||(o._events[t]=[]),o._events[t].push({callback:e,once:!!n})}))},t.prototype.once=function(t,e){var n=this;null==t||t.split(",").forEach((function(t){t=t.trim(),n.on(t,e,!0)}))},t.prototype.emit=function(t,e){var n=this;null==t||t.split(",").forEach((function(t){var o=n._events[t]||[],i=n._events["*"]||[],r=function(o){for(var i=o.length,r=0;r<i;r++)if(o[r]){var a=o[r],s=a.callback;a.once&&(o.splice(r,1),0===o.length&&delete n._events[t],i--,r--),s.apply(n,[e])}};r(o),r(i)}))},t.prototype.off=function(t,e){var n=this;t||(this._events={}),t.split(",").forEach((function(t){if(e){for(var o=n._events[t]||[],i=o.length,r=0;r<i;r++)o[r].callback===e&&(o.splice(r,1),i--,r--);0===o.length&&delete n._events[t]}else delete n._events[t]}))},t.prototype.getEvents=function(){return this._events},t}(),y_=function(){return y_=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},y_.apply(this,arguments)},m_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},b_=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},x_=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))};!function(){function t(t){this.modelMap=new Map,this.nodeMoveRules=[],this.nodes=[],this.edges=[],this.overlapMode=Sy.DEFAULT,this.gridSize=1,this.partial=!1;var e,n=t.container,o=t.partial,i=t.background,r=void 0===i?{}:i,a=t.grid,s=t.idGenerator,l=t.edgeGenerator,u=t.animation,c=t.customTrajectory;this.rootEl=n,this.partial=!!o,this.background=r,"object"==typeof a&&(this.gridSize=a.size||1),this.theme=tw(t.style),this.edgeType=t.edgeType||"polyline",this.animation=(e=u)&&"boolean"!=typeof e?md(Is(Ay),e):Is(!0===e?My:Ay),this.overlapMode=t.overlapMode||Sy.DEFAULT,this.width=t.width||this.rootEl.getBoundingClientRect().width,this.height=t.height||this.rootEl.getBoundingClientRect().height,this.eventCenter=new v_,this.editConfigModel=new g_(t),this.transformModel=new N_(this.eventCenter,t),this.flowId=JE(),this.idGenerator=s,this.edgeGenerator=function(t,e){if("function"!=typeof e)return function(e,n,o){return Object.assign({type:t.edgeType},o)};return function(n,o,i){var r=e(n,o,i);return r?"string"==typeof r?Object.assign({},i,{type:r}):Object.assign({type:r},i):{type:t.edgeType}}}(this,l),this.customTrajectory=c}Object.defineProperty(t.prototype,"nodesMap",{get:function(){return this.nodes.reduce((function(t,e,n){return t[e.id]={index:n,model:e},t}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"edgesMap",{get:function(){return this.edges.reduce((function(t,e,n){return t[e.id]={index:n,model:e},t}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modelsMap",{get:function(){return x_(x_([],b_(this.nodes),!1),b_(this.edges),!1).reduce((function(t,e){return t[e.id]=e,t}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sortElements",{get:function(){for(var t=x_(x_([],b_(this.nodes),!1),b_(this.edges),!1).sort((function(t,e){return t.zIndex-e.zIndex})),e=[],n=[-200,-200],o=[this.width+Ty,this.height+Ty],i=0;i<t.length;i++){var r=t[i];r.visible&&(!this.partial||r.isSelected||this.isElementInArea(r,n,o,!1,!1))&&e.push(r)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textEditElement",{get:function(){var t=this.nodes.find((function(t){return t.state===xy.TEXT_EDIT})),e=this.edges.find((function(t){return t.state===xy.TEXT_EDIT}));return t||e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectElements",{get:function(){var t=new Map;return this.nodes.forEach((function(e){e.isSelected&&t.set(e.id,e)})),this.edges.forEach((function(e){e.isSelected&&t.set(e.id,e)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectNodes",{get:function(){var t=[];return this.nodes.forEach((function(e){e.isSelected&&t.push(e)})),t},enumerable:!1,configurable:!0}),t.prototype.getAreaElement=function(t,e,n,o,i){var r=this;void 0===n&&(n=!0),void 0===o&&(o=!0),void 0===i&&(i=!1);var a=[];return xu(x_(x_([],b_(this.nodes),!1),b_(this.edges),!1),(function(s){var l=r.isElementInArea(s,t,e,n,o);i&&!s.visible||!l||a.push(s)})),a},t.prototype.getModel=function(t){return this.modelMap.get(t)},t.prototype.getNodeModelById=function(t){var e;return this.fakeNode&&t===this.fakeNode.id?this.fakeNode:null===(e=this.nodesMap[t])||void 0===e?void 0:e.model},t.prototype.getPointByClient=function(t){var e=t.x,n=t.y,o=this.rootEl.getBoundingClientRect(),i={x:e-o.left,y:n-o.top},r=b_(this.transformModel.HtmlPointToCanvasPoint([i.x,i.y]),2);return{domOverlayPosition:i,canvasOverlayPosition:{x:r[0],y:r[1]}}},t.prototype.isElementInArea=function(t,e,n,o,i){var r;if(void 0===o&&(o=!0),void 0===i&&(i=!0),t.BaseType===_y.NODE){for(var a=SE(t),s=a.minX,l=a.minY,u=a.maxX,c=a.maxY,d=[{x:s,y:l},{x:u,y:l},{x:u,y:c},{x:s,y:c}],h=i,p=0;p<d.length;p++){var f=d[p],g=f.x,v=f.y;if(g=(r=b_(this.transformModel.CanvasPointToHtmlPoint([g,v]),2))[0],v=r[1],aE([g,v],e,n)!==i){h=!i;break}}return h}if(t.BaseType===_y.EDGE){var y=t.startPoint,m=t.endPoint,b=this.transformModel.CanvasPointToHtmlPoint([y.x,y.y]),x=this.transformModel.CanvasPointToHtmlPoint([m.x,m.y]),_=aE(b,e,n),E=aE(x,e,n);return o?_&&E:_||E}return!1},t.prototype.graphDataToModel=function(t){var e=this;if(this.width&&this.height||this.resize(),!t)return this.nodes=[],void(this.edges=[]);if(t.nodes?this.nodes=Ju(t.nodes,(function(t){return e.getModelAfterSnapToGrid(t)})):this.nodes=[],t.edges){var n=this.edgeType;this.edges=Ju(t.edges,(function(t){var o,i=e.getModel(null!==(o=t.type)&&void 0!==o?o:n);if(!i)throw new Error("找不到".concat(t.type,"对应的边。"));return new i(t,e)}))}else this.edges=[]},t.prototype.modelToGraphData=function(){var t=[];this.edges.forEach((function(e){var n=e.getData();n&&!e.virtual&&t.push(n)}));var e=[];return this.nodes.forEach((function(t){var n=t.getData();n&&!t.virtual&&e.push(n)})),{nodes:e,edges:t}},t.prototype.modelToHistoryData=function(){for(var t=!1,e=[],n=0;n<this.nodes.length;n++){var o=this.nodes[n];if(o.isDragging){t=!0;break}e.push(o.getHistoryData())}if(t)return!1;for(var i=!1,r=[],a=0;a<this.edges.length;a++){var s=this.edges[a];if(s.isDragging){i=!0;break}r.push(s.getHistoryData())}return!i&&{nodes:e,edges:r}},t.prototype.getEdgeModelById=function(t){var e;return null===(e=this.edgesMap[t])||void 0===e?void 0:e.model},t.prototype.getElement=function(t){return this.modelsMap[t]},t.prototype.getNodeEdges=function(t){for(var e=[],n=0;n<this.edges.length;n++){var o=this.edges[n],i=o.sourceNodeId===t,r=o.targetNodeId===t;(i||r)&&e.push(o)}return e},t.prototype.getSelectElements=function(t){void 0===t&&(t=!0);var e=this.selectElements,n={nodes:[],edges:[]};return e.forEach((function(o){if(o.BaseType===_y.NODE&&n.nodes.push(o.getData()),o.BaseType===_y.EDGE){var i=o.getData(),r=e.get(i.sourceNodeId)&&e.get(i.targetNodeId);(t||r)&&n.edges.push(i)}})),n},t.prototype.updateAttributes=function(t,e){var n=this.getElement(t);null==n||n.updateAttributes(e)},t.prototype.changeNodeId=function(t,e){return e||(e=JE()),this.nodesMap[e]?(console.warn("当前流程图已存在节点".concat(e,", 修改失败")),""):this.nodesMap[t]?(this.edges.forEach((function(n){n.sourceNodeId===t&&(n.sourceNodeId=e),n.targetNodeId===t&&(n.targetNodeId=e)})),this.nodesMap[t].model.id=e,this.nodesMap[e]=this.nodesMap[t],e):(console.warn("当前流程图找不到节点".concat(t,", 修改失败")),"")},t.prototype.changeEdgeId=function(t,e){return e||(e=JE()),this.edgesMap[e]?(console.warn("当前流程图已存在边: ".concat(e,", 修改失败")),""):this.edgesMap[t]?(this.edges.forEach((function(n){n.id===t&&n.changeEdgeId(e)})),e):(console.warn("当前流程图找不到边: ".concat(e,", 修改失败")),"")},t.prototype.getTextModel=function(t){var e=this.editConfigModel,n=e.textMode,o=e.nodeTextMode,i=e.edgeTextMode;return t.BaseType===_y.NODE?t.textMode||o||n||Ny.TEXT:t.BaseType===_y.EDGE?t.textMode||i||n||Ny.TEXT:void 0},t.prototype.setTextMode=function(t,e){this.editConfigModel.updateEditConfig({textMode:t})},t.prototype.setFakeNode=function(t){this.fakeNode=t},t.prototype.removeFakeNode=function(){this.fakeNode=null},t.prototype.setModel=function(t,e){return this.modelMap.set(t,e)},t.prototype.toFront=function(t){var e,n,o,i=(null===(e=this.nodesMap[t])||void 0===e?void 0:e.model)||(null===(n=this.edgesMap[t])||void 0===n?void 0:n.model);i&&(this.overlapMode===Sy.DEFAULT&&(null===(o=this.topElement)||void 0===o||o.setZIndex(),i.setZIndex(9999),this.topElement=i),this.overlapMode===Sy.INCREASE&&this.setElementZIndex(t,"top"))},t.prototype.setElementZIndex=function(t,e){var n,o,i=(null===(n=this.nodesMap[t])||void 0===n?void 0:n.model)||(null===(o=this.edgesMap[t])||void 0===o?void 0:o.model);if(i){var r=void 0;"number"==typeof e?r=e:("top"===e&&(r=iw()),"bottom"===e&&(r=rw())),i.setZIndex(r)}},t.prototype.deleteNode=function(t){var e=this.nodesMap[t].model.getData();this.deleteEdgeBySource(t),this.deleteEdgeByTarget(t),this.nodes.splice(this.nodesMap[t].index,1),this.eventCenter.emit(wy.NODE_DELETE,{data:e})},t.prototype.addNode=function(t,e,n){void 0===e&&(e=wy.NODE_ADD);var o=Oy(t),i=o.id;i&&this.nodesMap[i]&&delete o.id;var r=this.getModelAfterSnapToGrid(o);this.nodes.push(r);var a={data:r.getData()};return n&&(a.e=n),this.eventCenter.emit(e,a),r},t.prototype.getModelAfterSnapToGrid=function(t){var e=this.getModel(t.type);if(!e)throw new Error("找不到".concat(t.type,"对应的节点,请确认是否已注册此类型节点。"));var n=t.x,o=t.y;return n&&o&&(t.x=iE(n,this.gridSize),t.y=iE(o,this.gridSize),"object"==typeof t.text&&null!==t.text&&(t.text.x+=t.x-n,t.text.y+=t.y-o)),new e(t,this)},t.prototype.cloneNode=function(t){var e=this.getNodeModelById(t),n=null==e?void 0:e.getData();if(n){n.x+=30,n.y+=30,n.id="","object"==typeof n.text&&null!==n.text&&(n.text.x+=30,n.text.y+=30);var o=this.addNode(n);return o.setSelected(!0),null==e||e.setSelected(!1),o.getData()}},t.prototype.moveNode=function(t,e,n,o){var i;void 0===o&&(o=!1);var r=this.nodesMap[t];if(r){var a=r.model;e=(i=b_(a.getMoveDistance(e,n,o),2))[0],n=i[1],this.moveEdge(t,e,n)}else console.warn("不存在id为".concat(t,"的节点"))},t.prototype.moveNode2Coordinate=function(t,e,n,o){void 0===o&&(o=!1);var i=this.nodesMap[t];if(i){var r=i.model,a=e-r.x,s=n-r.y;this.moveNode(t,a,s,o)}else console.warn("不存在id为".concat(t,"的节点"))},t.prototype.editText=function(t){this.setElementStateById(t,xy.TEXT_EDIT)},t.prototype.addEdge=function(t){var e=Oy(t),n=e.type;n||(n=this.edgeType),e.id&&this.edgesMap[e.id]&&delete e.id;var o=this.getModel(n);if(!o)throw new Error("找不到".concat(n,"对应的边,请确认是否已注册此类型边。"));var i=new o(y_(y_({},e),{type:n}),this),r=i.getData();return this.edges.push(i),this.eventCenter.emit(wy.EDGE_ADD,{data:r}),i},t.prototype.moveEdge=function(t,e,n){for(var o=0;o<this.edges.length;o++){var i=this.edges[o],r=i.textPosition,a=r.x,s=r.y,l=this.edges[o].sourceNodeId===t,u=this.edges[o].targetNodeId===t;l&&i.moveStartPoint(e,n),u&&i.moveEndPoint(e,n),(l||u)&&this.handleEdgeTextMove(i,a,s)}},t.prototype.handleEdgeTextMove=function(t,e,n){var o;if(t.customTextPosition)t.resetTextPosition();else{if(t.modelType===Ey.POLYLINE_EDGE&&(null===(o=t.text)||void 0===o?void 0:o.value)){var i=t.text,r=Q_(i,t.points);t.moveText(r.x-i.x,r.y-i.y)}var a=t.textPosition,s=a.x,l=a.y;t.moveText(s-e,l-n)}},t.prototype.deleteEdgeBySourceAndTarget=function(t,e){for(var n=0;n<this.edges.length;n++)if(this.edges[n].sourceNodeId===t&&this.edges[n].targetNodeId===e){var o=this.edges[n].getData();this.edges.splice(n,1),n--,this.eventCenter.emit(wy.EDGE_DELETE,{data:o})}},t.prototype.deleteEdgeById=function(t){if(this.edgesMap[t]){var e=this.edgesMap[t].index,n=this.edgesMap[t].model.getData();this.edges.splice(e,1),this.eventCenter.emit(wy.EDGE_DELETE,{data:n})}},t.prototype.deleteEdgeBySource=function(t){for(var e=0;e<this.edges.length;e++)if(this.edges[e].sourceNodeId===t){var n=this.edges[e].getData();this.edges.splice(e,1),e--,this.eventCenter.emit(wy.EDGE_DELETE,{data:n})}},t.prototype.deleteEdgeByTarget=function(t){for(var e=0;e<this.edges.length;e++)if(this.edges[e].targetNodeId===t){var n=this.edges[e].getData();this.edges.splice(e,1),e--,this.eventCenter.emit(wy.EDGE_DELETE,{data:n})}},t.prototype.setElementStateById=function(t,e,n){this.nodes.forEach((function(o){o.id===t?o.setElementState(e,n):o.setElementState(xy.DEFAULT)})),this.edges.forEach((function(o){o.id===t?o.setElementState(e,n):o.setElementState(xy.DEFAULT)}))},t.prototype.updateText=function(t,e){var n=Uu(x_(x_([],b_(this.nodes),!1),b_(this.edges),!1),(function(e){return e.id===t}));null==n||n.updateText(e)},t.prototype.selectNodeById=function(t,e){var n;void 0===e&&(e=!1),e||this.clearSelectElements();var o=null===(n=this.nodesMap[t])||void 0===n?void 0:n.model;null==o||o.setSelected(!0)},t.prototype.selectEdgeById=function(t,e){var n;void 0===e&&(e=!1),e||this.clearSelectElements();var o=null===(n=this.edgesMap[t])||void 0===n?void 0:n.model;null==o||o.setSelected(!0)},t.prototype.selectElementById=function(t,e){void 0===e&&(e=!1),e||this.clearSelectElements();var n=this.getElement(t);null==n||n.setSelected(!0)},t.prototype.clearSelectElements=function(){var t;this.selectElements.forEach((function(t){null==t||t.setSelected(!1)})),this.selectElements.clear(),this.overlapMode===Sy.DEFAULT&&(null===(t=this.topElement)||void 0===t||t.setZIndex())},t.prototype.moveNodes=function(t,e,n,o){var i,r,a,s=this;void 0===o&&(o=!1);for(var l=t.reduce((function(t,i){var r=s.nodesMap[i].model;return t[i]=r.getMoveDistance(e,n,o),t}),{}),u=0;u<this.edges.length;u++){var c=this.edges[u],d=c.textPosition,h=d.x,p=d.y,f=l[c.sourceNodeId],g=l[c.targetNodeId],v=void 0,y=void 0;f&&g&&c.modelType===Ey.POLYLINE_EDGE?(v=(i=b_(f,2))[0],y=i[1],c.updatePointsList(v,y)):(f&&(v=(r=b_(f,2))[0],y=r[1],c.moveStartPoint(v,y)),g&&(v=(a=b_(g,2))[0],y=a[1],c.moveEndPoint(v,y))),(f||g)&&this.handleEdgeTextMove(c,h,p)}},t.prototype.addNodeMoveRules=function(t){this.nodeMoveRules.includes(t)||this.nodeMoveRules.push(t)},t.prototype.setDefaultEdgeType=function(t){this.edgeType=t},t.prototype.changeNodeType=function(t,e){var n=this.getNodeModelById(t);if(n){var o=n.getData();o.type=e;var i=this.getModel(e);if(!i)throw new Error("找不到".concat(e,"对应的节点,请确认是否已注册此类型节点。"));var r=new i(o,this);this.nodes.splice(this.nodesMap[t].index,1,r),this.getNodeEdges(t).forEach((function(e){if(e.sourceNodeId===t){var n=PE(r,e.startPoint,r.width,r.height);e.updateStartPoint(n)}if(e.targetNodeId===t){n=PE(r,e.endPoint,r.width,r.height);e.updateEndPoint(n)}}))}else console.warn("找不到id为".concat(t,"的节点"))},t.prototype.changeEdgeType=function(t,e){var n=this.getEdgeModelById(t);if(n){if(n.type!==e){var o=n.getData();o.type=e;var i=this.getModel(e);if(!i)throw new Error("找不到".concat(e,"对应的节点,请确认是否已注册此类型节点。"));delete o.pointsList;var r=new i(o,this);this.edges.splice(this.edgesMap[t].index,1,r)}}else console.warn("找不到id为".concat(t,"的边"))},t.prototype.getNodeIncomingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.targetNodeId===t&&e.push(n)})),e},t.prototype.getNodeOutgoingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.sourceNodeId===t&&e.push(n)})),e},t.prototype.getAnchorIncomingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.targetAnchorId===t&&e.push(n)})),e},t.prototype.getAnchorOutcomingEdge=function(t){var e=[];return this.edges.forEach((function(n){n.sourceAnchorId===t&&e.push(n)})),e},t.prototype.getNodeIncomingNode=function(t){var e=this,n=[];return this.edges.forEach((function(o){var i;o.targetNodeId===t&&n.push(null===(i=e.nodesMap[o.sourceNodeId])||void 0===i?void 0:i.model)})),n},t.prototype.getNodeOutgoingNode=function(t){var e=this,n=[];return this.edges.forEach((function(o){o.sourceNodeId===t&&n.push(e.nodesMap[o.targetNodeId].model)})),n},t.prototype.setTheme=function(t){this.theme=ew(y_(y_({},this.theme),t))},t.prototype.resize=function(t,e){this.width=t||this.rootEl.getBoundingClientRect().width,this.height=e||this.rootEl.getBoundingClientRect().height,this.width&&this.height||console.warn("渲染画布的时候无法获取画布宽高,请确认在container已挂载到DOM。@see https://github.com/didi/LogicFlow/issues/675")},t.prototype.clearData=function(){this.nodes=[],this.edges=[]},t.prototype.getVirtualRectSize=function(){var t=this.nodes,e=[],n=[];t.forEach((function(t){var o=t.x,i=t.y,r=t.width,a=t.height,s=t.getNodeStyle().strokeWidth,l=void 0===s?0:s,u=o+r/2+l,c=o-r/2-l,d=i+a/2+l,h=i-a/2-l;e=e.concat([u,c].filter((function(t){return!Number.isNaN(t)}))),n=n.concat([d,h].filter((function(t){return!Number.isNaN(t)})))}));var o=Math.min.apply(Math,x_([],b_(e),!1)),i=Math.max.apply(Math,x_([],b_(e),!1)),r=Math.min.apply(Math,x_([],b_(n),!1)),a=i-o||0,s=Math.max.apply(Math,x_([],b_(n),!1))-r||0;return{width:a,height:s,x:o+a/2,y:r+s/2}},t.prototype.translateCenter=function(){var t=this,e=t.nodes,n=t.width,o=t.height,i=t.rootEl,r=t.transformModel;if(e.length){var a=n||i.clientWidth,s=o||i.clientHeight,l=this.getVirtualRectSize(),u=l.x,c=l.y;r.focusOn(u,c,a,s)}},t.prototype.fitView=function(t,e){void 0===t&&(t=20),void 0===e&&(e=20);var n=this,o=n.nodes,i=n.width,r=n.height,a=n.rootEl,s=n.transformModel;if(o.length){var l=i||a.clientWidth,u=r||a.clientHeight,c=this.getVirtualRectSize(),d=c.width,h=c.height,p=c.x,f=c.y,g=(d+e)/l,v=(h+t)/u,y=1/Math.max(g,v),m=[l/2,u/2];s.zoom(y,m),s.focusOn(p,f,l,u)}},t.prototype.openEdgeAnimation=function(t){var e=this.getEdgeModelById(t);null==e||e.openEdgeAnimation()},t.prototype.closeEdgeAnimation=function(t){var e=this.getEdgeModelById(t);null==e||e.closeEdgeAnimation()},t.prototype.getPartial=function(){return this.partial},t.prototype.setPartial=function(t){this.partial=t},m_([Sm],t.prototype,"width",void 0),m_([Sm],t.prototype,"height",void 0),m_([Sm],t.prototype,"edgeType",void 0),m_([Sm],t.prototype,"nodes",void 0),m_([Sm],t.prototype,"edges",void 0),m_([Sm],t.prototype,"fakeNode",void 0),m_([Sm],t.prototype,"overlapMode",void 0),m_([Sm],t.prototype,"background",void 0),m_([Sm],t.prototype,"gridSize",void 0),m_([Sm],t.prototype,"transformModel",void 0),m_([Sm],t.prototype,"editConfigModel",void 0),m_([Sm],t.prototype,"partial",void 0),m_([Om],t.prototype,"nodesMap",null),m_([Om],t.prototype,"edgesMap",null),m_([Om],t.prototype,"modelsMap",null),m_([Om],t.prototype,"sortElements",null),m_([Om],t.prototype,"textEditElement",null),m_([Om],t.prototype,"selectElements",null),m_([Om],t.prototype,"selectNodes",null),m_([Eb],t.prototype,"setTextMode",null),m_([Eb],t.prototype,"setFakeNode",null),m_([Eb],t.prototype,"removeFakeNode",null),m_([Eb],t.prototype,"setModel",null),m_([Eb],t.prototype,"toFront",null),m_([Eb],t.prototype,"setElementZIndex",null),m_([Eb],t.prototype,"deleteNode",null),m_([Eb],t.prototype,"addNode",null),m_([Eb],t.prototype,"cloneNode",null),m_([Eb],t.prototype,"moveNode",null),m_([Eb],t.prototype,"moveNode2Coordinate",null),m_([Eb],t.prototype,"editText",null),m_([Eb],t.prototype,"addEdge",null),m_([Eb],t.prototype,"moveEdge",null),m_([Eb],t.prototype,"deleteEdgeBySourceAndTarget",null),m_([Eb],t.prototype,"deleteEdgeById",null),m_([Eb],t.prototype,"deleteEdgeBySource",null),m_([Eb],t.prototype,"deleteEdgeByTarget",null),m_([Eb],t.prototype,"setElementStateById",null),m_([Eb],t.prototype,"updateText",null),m_([Eb],t.prototype,"selectNodeById",null),m_([Eb],t.prototype,"selectEdgeById",null),m_([Eb],t.prototype,"selectElementById",null),m_([Eb],t.prototype,"clearSelectElements",null),m_([Eb],t.prototype,"moveNodes",null),m_([Eb],t.prototype,"setDefaultEdgeType",null),m_([Eb],t.prototype,"changeNodeType",null),m_([Eb],t.prototype,"changeEdgeType",null),m_([Eb],t.prototype,"getNodeIncomingEdge",null),m_([Eb],t.prototype,"getNodeOutgoingEdge",null),m_([Eb],t.prototype,"getAnchorIncomingEdge",null),m_([Eb],t.prototype,"getAnchorOutcomingEdge",null),m_([Eb],t.prototype,"getNodeIncomingNode",null),m_([Eb],t.prototype,"getNodeOutgoingNode",null),m_([Eb],t.prototype,"setTheme",null),m_([Eb],t.prototype,"resize",null),m_([Eb],t.prototype,"clearData",null),m_([Eb],t.prototype,"translateCenter",null),m_([Eb],t.prototype,"fitView",null),m_([Eb],t.prototype,"openEdgeAnimation",null),m_([Eb],t.prototype,"closeEdgeAnimation",null),m_([Eb],t.prototype,"setPartial",null)}();var __=function(){return __=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},__.apply(this,arguments)},E_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a};!function(){function t(t){this.isShowHorizontal=!1,this.isShowVertical=!1,this.position={x:0,y:0},this.graphModel=t}t.prototype.getStyle=function(){return __({},this.graphModel.theme.snapline)},t.prototype.getCenterSnapLine=function(t,e){for(var n=t.x,o=t.y,i=!1,r=!1,a=0;a<e.length;a++){var s=e[a];if(s.id!==t.id&&(n===s.x&&(i=!0),o===s.y&&(r=!0),i&&r))break}return{isShowVertical:i,isShowHorizontal:r,position:{x:n,y:o}}},t.prototype.getHorizontalSnapline=function(t,e){var n,o=!1,i=0,r=t.id;if(r){var a=this.graphModel.fakeNode;if(a&&a.id===r)n=SE(a);else{var s=this.graphModel.getNodeModelById(r);s&&(n=SE(s))}}for(var l=0;l<e.length;l++){var u=e[l];if(u.id!==t.id){var c=SE(u);if(c.minY===(null==n?void 0:n.minY)||c.maxY===(null==n?void 0:n.minY)){o=!0,i=n.minY;break}if(c.minY===(null==n?void 0:n.maxY)||c.maxY===(null==n?void 0:n.maxY)){o=!0,i=n.maxY;break}}}return{isShowHorizontal:o,isShowVertical:this.isShowVertical,position:__(__({},this.position),{y:i})}},t.prototype.getVerticalSnapline=function(t,e){var n,o=!1,i=0,r=t.id;if(r){var a=this.graphModel.fakeNode;if(a&&a.id===r)n=SE(a);else{var s=this.graphModel.getNodeModelById(r);s&&(n=SE(s))}}for(var l=0;l<e.length;l++){var u=e[l];if(u.id!==t.id){var c=SE(u);if(c.minX===(null==n?void 0:n.minX)||c.maxX===(null==n?void 0:n.minX)){o=!0,i=n.minX;break}if(c.minX===(null==n?void 0:n.maxX)||c.maxX===(null==n?void 0:n.maxX)){o=!0,i=n.maxX;break}}}return{isShowHorizontal:this.isShowHorizontal,isShowVertical:o,position:__(__({},this.position),{x:i})}},t.prototype.getSnapLinePosition=function(t,e){var n=this.getCenterSnapLine(t,e),o=n.isShowHorizontal,i=n.isShowVertical;if(!o){var r=this.getHorizontalSnapline(t,e);r.isShowHorizontal&&(n.isShowHorizontal=r.isShowHorizontal,n.position.y=r.position.y)}if(!i){var a=this.getVerticalSnapline(t,e);a.isShowVertical&&(n.isShowVertical=a.isShowVertical,n.position.x=a.position.x)}return n},t.prototype.setSnaplineInfo=function(t){var e=t.isShowHorizontal,n=t.isShowVertical,o=t.position;this.position=o,this.isShowHorizontal=e,this.isShowVertical=n},t.prototype.clearSnapline=function(){this.position={x:0,y:0},this.isShowHorizontal=!1,this.isShowVertical=!1},t.prototype.setNodeSnapLine=function(t){var e=this.graphModel.nodes,n=this.getSnapLinePosition(t,e);this.setSnaplineInfo(n)},E_([Sm],t.prototype,"isShowHorizontal",void 0),E_([Sm],t.prototype,"isShowVertical",void 0),E_([Sm],t.prototype,"position",void 0),E_([Eb],t.prototype,"clearSnapline",null),E_([Eb],t.prototype,"setNodeSnapLine",null)}();var w_=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},S_=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},C_={false:[-1/0,-1/0,1/0,1/0],true:[-1/0,-1/0,1/0,1/0],vertical:[-1/0,0,1/0,0],horizontal:[0,-1/0,0,1/0]},N_=function(){function t(t,e){this.MINI_SCALE_SIZE=.2,this.MAX_SCALE_SIZE=16,this.SCALE_X=1,this.SKEW_Y=0,this.SKEW_X=0,this.SCALE_Y=1,this.TRANSLATE_X=0,this.TRANSLATE_Y=0,this.ZOOM_SIZE=.04,this.translateLimitMinX=-1/0,this.translateLimitMinY=-1/0,this.translateLimitMaxX=1/0,this.translateLimitMaxY=1/0,this.eventCenter=t;var n=e.stopMoveGraph,o=void 0!==n&&n;this.updateTranslateLimits(o)}return t.prototype.setZoomMiniSize=function(t){this.MINI_SCALE_SIZE=t},t.prototype.setZoomMaxSize=function(t){this.MAX_SCALE_SIZE=t},t.prototype.HtmlPointToCanvasPoint=function(t){var e=S_(t,2),n=e[0],o=e[1];return[(n-this.TRANSLATE_X)/this.SCALE_X,(o-this.TRANSLATE_Y)/this.SCALE_Y]},t.prototype.CanvasPointToHtmlPoint=function(t){var e=S_(t,2),n=e[0],o=e[1];return[n*this.SCALE_X+this.TRANSLATE_X,o*this.SCALE_Y+this.TRANSLATE_Y]},t.prototype.moveCanvasPointByHtml=function(t,e,n){var o=S_(t,2),i=o[0],r=o[1];return[i+e/this.SCALE_X,r+n/this.SCALE_Y]},t.prototype.fixDeltaXY=function(t,e){return[t/this.SCALE_X,e/this.SCALE_Y]},t.prototype.getTransformStyle=function(){var t=[this.SCALE_X,this.SKEW_Y,this.SKEW_X,this.SCALE_Y,this.TRANSLATE_X,this.TRANSLATE_Y].join(",");return{transform:"matrix(".concat(t,")")}},t.prototype.zoom=function(t,e){void 0===t&&(t=!1);var n=this.SCALE_X,o=this.SCALE_Y;return"number"==typeof t?(n=t,o=t):t?(n+=this.ZOOM_SIZE,o+=this.ZOOM_SIZE):(n-=this.ZOOM_SIZE,o-=this.ZOOM_SIZE),n<this.MINI_SCALE_SIZE||n>this.MAX_SCALE_SIZE||(e&&(this.TRANSLATE_X-=(n-this.SCALE_X)*e[0],this.TRANSLATE_Y-=(o-this.SCALE_Y)*e[1]),this.SCALE_X=n,this.SCALE_Y=o,this.emitGraphTransform("zoom")),"".concat(100*this.SCALE_X,"%")},t.prototype.emitGraphTransform=function(t){this.eventCenter.emit(wy.GRAPH_TRANSFORM,{type:t,transform:{SCALE_X:this.SCALE_X,SKEW_Y:this.SKEW_Y,SKEW_X:this.SKEW_X,SCALE_Y:this.SCALE_Y,TRANSLATE_X:this.TRANSLATE_X,TRANSLATE_Y:this.TRANSLATE_Y}})},t.prototype.resetZoom=function(){this.SCALE_X=1,this.SCALE_Y=1,this.emitGraphTransform("resetZoom")},t.prototype.translate=function(t,e){this.TRANSLATE_X+t<=this.translateLimitMaxX&&this.TRANSLATE_X+t>=this.translateLimitMinX&&(this.TRANSLATE_X+=t),this.TRANSLATE_Y+e<=this.translateLimitMaxY&&this.TRANSLATE_Y+e>=this.translateLimitMinY&&(this.TRANSLATE_Y+=e),this.emitGraphTransform("translate")},t.prototype.focusOn=function(t,e,n,o){var i=S_(this.CanvasPointToHtmlPoint([t,e]),2),r=i[0],a=i[1],s=S_([n/2-r,o/2-a],2),l=s[0],u=s[1];this.TRANSLATE_X+=l,this.TRANSLATE_Y+=u,this.emitGraphTransform("focusOn")},t.prototype.updateTranslateLimits=function(t){var e;e=S_(Array.isArray(t)&&4===t.length?t:C_[t.toString()],4),this.translateLimitMinX=e[0],this.translateLimitMinY=e[1],this.translateLimitMaxX=e[2],this.translateLimitMaxY=e[3]},w_([Sm],t.prototype,"SCALE_X",void 0),w_([Sm],t.prototype,"SKEW_Y",void 0),w_([Sm],t.prototype,"SKEW_X",void 0),w_([Sm],t.prototype,"SCALE_Y",void 0),w_([Sm],t.prototype,"TRANSLATE_X",void 0),w_([Sm],t.prototype,"TRANSLATE_Y",void 0),w_([Sm],t.prototype,"ZOOM_SIZE",void 0),w_([Eb],t.prototype,"zoom",null),w_([Eb],t.prototype,"resetZoom",null),w_([Eb],t.prototype,"translate",null),w_([Eb],t.prototype,"focusOn",null),t}(),T_=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},A_=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))},M_=function(t){var e=[],n={};return t.forEach((function(t){var e="".concat(t.x,"-").concat(t.y);t.id=e,n[e]=t})),Object.keys(n).forEach((function(t){e.push(n[t])})),e},O_=function(t,e){return 0===t.width&&0===t.height?t:{x:t.x,y:t.y,centerX:t.centerX,centerY:t.centerY,minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e,height:t.height+2*e,width:t.width+2*e}},P_=function(t,e,n){var o=function(t,e){var n=Math.abs(t.x-e.centerX),o=Math.abs(t.y-e.centerY);return n/e.width>o/e.height?Cy.HORIZONTAL:Cy.VERTICAL}(n,e);return o===Cy.HORIZONTAL?{x:n.x>t.centerX?t.maxX:t.minX,y:n.y}:{x:n.x,y:n.y>t.centerY?t.maxY:t.minY}},k_=function(t,e){var n=Math.min(t.minX,e.minX),o=Math.min(t.minY,e.minY),i=Math.max(t.maxX,e.maxX),r=Math.max(t.maxY,e.maxY);return{x:(n+i)/2,y:(o+r)/2,centerX:(n+i)/2,centerY:(o+r)/2,minX:n,minY:o,maxX:i,maxY:r,height:r-o,width:i-n}},R_=function(t){var e=t.minX,n=t.minY,o=t.maxX,i=t.maxY;return[{x:e,y:n},{x:o,y:n},{x:o,y:i},{x:e,y:i}]},D_=function(t,e){var n=t.x,o=t.y;return n<e.minX||n>e.maxX||o<e.minY||o>e.maxY},L_=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},I_=function(t,e,n,o,i){return L_(t,e)+L_(t,n)+function(t,e){var n=0;return e.forEach((function(e){e&&(t.x===e.x&&(n+=-2),t.y===e.y&&(n+=-2))})),n}(t,[e,n,o,i])},j_=function(t,e,n,o,i){i||(i=0),t.unshift(e[o]),n[o]&&n[o]!==o&&i<=100&&j_(t,e,n,n[o],i+1)},B_=function(t,e,n,o){var i=e.x-t.x,r=e.y-t.y,a=o.x-n.x,s=o.y-n.y,l=(-r*(t.x-n.x)+i*(t.y-n.y))/(-a*r+i*s),u=(a*(t.y-n.y)-s*(t.x-n.x))/(-a*r+i*s);return l>=0&&l<=1&&u>=0&&u<=1},H_=function(t,e,n){if(0===n.width&&0===n.height)return!1;var o=T_(R_(n),4),i=o[0],r=o[1],a=o[2],s=o[3];return B_(t,e,i,r)||B_(t,e,i,s)||B_(t,e,r,a)||B_(t,e,a,s)},F_=function(t,e,n,o,i,r,a){var s=[],l=[e],u={},c={},d={};e.id&&(c[e.id]=0,d[e.id]=I_(e,n,e));var h={};t.forEach((function(t){t.id&&(h[t.id]=t)}));for(var p=function(){var p,f,g,v,y=1/0;if(l.forEach((function(t){t.id&&d[t.id]<y&&(y=d[t.id],p=t)})),p===n&&n.id){var m=[];return j_(m,h,u,n.id),{value:m}}if(!p)return{value:[e,n]};g=p,(v=(f=l).indexOf(g))>-1&&f.splice(v,1),s.push(p),function(t,e,n,o){var i=[];return t.forEach((function(t){t!==e&&(t.x!==e.x&&t.y!==e.y||H_(t,e,n)||H_(t,e,o)||i.push(t))})),M_(i)}(t,p,o,i).forEach((function(t){if(-1===s.indexOf(t)&&(-1===l.indexOf(t)&&l.push(t),(null==p?void 0:p.id)&&(null==t?void 0:t.id))){var o=d[p.id]+L_(p,t);if(c[t.id]&&o>=c[t.id])return;u[t.id]=p.id,c[t.id]=o,d[t.id]=c[t.id]+I_(t,n,e,r,a)}}))};l.length;){var f=p();if("object"==typeof f)return f.value}return[e,n]},z_=function(t){return SE(t)},W_=function(t){for(var e=1;e<t.length-1;){var n=t[e-1],o=t[e],i=t[e+1];n.x===o.x&&o.x===i.x||n.y===o.y&&o.y===i.y?t.splice(e,1):e++}return t},G_=function(t,e,n,o,i){var r,a,s=z_(n),l=z_(o),u=O_(s,i),c=O_(l,i),d=P_(u,s,t),h=P_(c,l,e);if(r=u,a=c,2*Math.abs(r.centerX-a.centerX)<r.width+a.width&&2*Math.abs(r.centerY-a.centerY)<r.height+a.height){var p=Z_(t,e,d,h);return A_(A_([t,d],T_(p),!1),[h,e],!1)}var f=function(t,e){void 0===t&&(t=[]);var n=[],o=[];t.forEach((function(t){n.push(t.x),o.push(t.y)}));var i=Math.min.apply(Math,A_([],T_(n),!1)),r=Math.max.apply(Math,A_([],T_(n),!1)),a=Math.min.apply(Math,A_([],T_(o),!1)),s=Math.max.apply(Math,A_([],T_(o),!1)),l=r-i,u=s-a;return e&&(l+=e,u+=e),{centerX:(i+r)/2,centerY:(a+s)/2,maxX:r,maxY:s,minX:i,minY:a,x:(i+r)/2,y:(a+s)/2,height:u,width:l}}([d,h]),g=k_(u,f),v=k_(c,f),y=[];y=(y=y.concat(R_(g))).concat(R_(v));var m={x:(t.x+e.x)/2,y:(t.y+e.y)/2};[f,g,v].forEach((function(t){y=y.concat(function(t,e){return A_(A_([],T_(function(t,e){return e<t.minX||e>t.maxX?[]:[{x:e,y:t.minY},{x:e,y:t.maxY}]}(t,e.x)),!1),T_(function(t,e){return e<t.minY||e>t.maxY?[]:[{x:t.minX,y:e},{x:t.maxX,y:e}]}(t,e.y)),!1)}(t,m).filter((function(t){return D_(t,u)&&D_(t,c)})))})),[{x:d.x,y:h.y},{x:h.x,y:d.y}].forEach((function(t){D_(t,u)&&D_(t,c)&&y.push(t)})),y.unshift(d),y.push(h),y=M_(y);var b=F_(y,d,h,s,l,t,e);return b.unshift(t),b.push(e),b.length>2&&(b=W_(b)),M_(b)},U_=function(t){if(1===t.length){var e=T_(t,1)[0];return[e,e]}for(var n=t[0],o=t[1],i=EE(n.x,n.y,o.x,o.y),r=1;r<t.length-1;r++){var a=t[r],s=t[r+1],l=EE(a.x,a.y,s.x,s.y);l>i&&(i=l,n=a,o=s)}return[n,o]},X_=function(t,e,n){var o=wE(t,n),i=wE(e,n);return o&&i},V_=function(t,e,n){var o=wE(t,n),i=wE(e,n);return!(o&&i)&&(o||i)},Y_=function(t,e,n){for(var o=void 0,i=SE(n),r=R_(i),a=0;a<r.length;a++){B_(t,e,r[a],r[(a+1)%r.length])&&(o=[r[a],r[(a+1)%r.length]])}if(o)return function(t,e,n,o){var i=(e.y-t.y)*(o.x-n.x)-(t.x-e.x)*(n.y-o.y);if(0===i)return!1;var r=((e.x-t.x)*(o.x-n.x)*(n.y-t.y)+(e.y-t.y)*(o.x-n.x)*t.x-(o.y-n.y)*(e.x-t.x)*n.x)/i,a=-((e.y-t.y)*(o.y-n.y)*(n.x-t.x)+(e.x-t.x)*(o.y-n.y)*t.y-(o.x-n.x)*(e.y-t.y)*n.y)/i;return(r-t.x)*(r-e.x)<=0&&(a-t.y)*(a-e.y)<=0&&(r-n.x)*(r-o.x)<=0&&(a-n.y)*(a-o.y)<=0&&{x:r,y:a}}(t,e,o[0],o[1])},q_=function(t,e){var n=void 0;return t.x===e.x?n=Cy.VERTICAL:t.y===e.y&&(n=Cy.HORIZONTAL),n},K_=function(t){var e=t.split(" "),n=[];return e&&e.forEach((function(t){var e=T_(t.split(","),2),o=e[0],i=e[1];n.push({x:Number(o),y:Number(i)})})),n},Z_=function(t,e,n,o){var i=[];if(q_(t,n)===q_(e,o))t.y===n.y?(i.push({x:n.x,y:(n.y+o.y)/2}),i.push({x:o.x,y:(n.y+o.y)/2})):(i.push({x:(n.x+o.x)/2,y:n.y}),i.push({x:(n.x+o.x)/2,y:o.y}));else{var r={x:n.x,y:o.y},a=ky(r,t,n),s=ky(r,e,o);if(a||s)r={x:o.x,y:n.y};else{var l=$_(r,t,n),u=$_(r,e,o);l&&u&&(r={x:o.x,y:n.y})}i.push(r)}return i},$_=function(t,e,n){return t.x===e.x&&t.x===n.x||t.y===e.y&&t.y===n.y},J_=function(t){var e=t.start,n=t.end,o=t.sourceNode,i=t.targetNode,r=t.offset,a=SE(o),s=SE(i),l=O_(a,r),u=O_(s,r);return{sNext:P_(l,a,e),ePre:P_(u,s,n)}},Q_=function(t,e){for(var n,o=t.x,i=t.y,r=K_(e),a=Number.MAX_SAFE_INTEGER,s=[],l=0;l<r.length;l++)s.push({start:r[l],end:r[(l+1)%r.length]});if(s.forEach((function(t){var e=t.start,r=t.end;if(e.x===r.x){var s={x:e.x,y:i};if(ky(s,e,r))(l=Math.abs(e.x-o))<a&&(a=l,n=s)}else if(e.y===r.y){var l;s={x:o,y:e.y};if(ky(s,e,r))(l=Math.abs(e.y-i))<a&&(a=l,n=s)}})),!n){var u=s[0],c=u.start,d=u.end;n={x:c.x+(d.x-c.x)/2,y:c.y+(d.y-c.y)/2}}return n},tE=function(t){return yh(t,["id","type","sourceNodeId","sourceAnchorId","targetNodeId","targetAnchorId","pointsList","startPoint","endPoint","properties"])},eE=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))};var nE=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},oE=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))};function iE(t,e){return e*Math.round(t/e)||t}var rE=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},aE=function(t,e,n){var o=rE(t,2),i=o[0],r=o[1],a=rE(e,2),s=a[0],l=a[1],u=rE(n,2),c=u[0],d=u[1];return i>s&&i<c&&r>l&&r<d},sE=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();function lE(t,e){return!!(t instanceof cE&&e instanceof cE)}var uE=function(t){function e(n,o,i){var r=t.call(this,3)||this;return r[0]=n,r[1]=o,r[2]=i,r.x=n,r.y=o,r.z=i,Object.setPrototypeOf(r,e.prototype),r}return sE(e,t),e.prototype.add=function(t){if(lE(this,t))return new cE(this.x+t.x,this.y+t.y);var e=this.z+t.z;return new dE((this.x+t.x)/e,(this.y+t.y)/e)},e.prototype.subtract=function(t){if(lE(this,t))return new cE(this.x-t.x,this.y-t.y);var e=this.z-t.z;return 0===e?new cE(this.x-t.x,this.y-t.y):new dE((this.x-t.x)/e,(this.y-t.y)/e)},e}(Array),cE=function(t){function e(n,o,i){var r=t.call(this,n,o,null!=i?i:0)||this;return Object.setPrototypeOf(r,e.prototype),r}return sE(e,t),e.prototype.toString=function(){return"Vector"},e.prototype.dot=function(t){var e=this;return t.reduce((function(t,n,o){return t+n*e[o]}))},e.prototype.cross=function(t){return new e(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)},e.prototype.getLength=function(){return Math.hypot(this.x,this.y)},e.prototype.normalize=function(){var t=this.getLength();return new e(this.x/t,this.y/t)},e.prototype.crossZ=function(t){return this.x*t.y-this.y*t.x},e.prototype.angle=function(t){var e=this.crossZ(t),n=Math.acos(this.normalize().dot(t.normalize()));return e>=0?n:-n},e}(uE),dE=function(t){function e(n,o){var i=t.call(this,n,o,1)||this;return Object.setPrototypeOf(i,e.prototype),i}return sE(e,t),e.prototype.toString=function(){return"Point"},e}(uE),hE=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),pE=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a},fE=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))},gE=function(t){function e(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=t.call(this,n.length)||this;return i.fill(new Array(3)),n.forEach((function(t,e){i[e]=t})),i.columns=n[0].length,i.rows=n.length,Object.setPrototypeOf(i,e.prototype),i}return hE(e,t),e.prototype.getRow=function(t){return this[t]},e.prototype.getColumn=function(t){return fE([],pE(this.map((function(e){return e[t]}))),!1)},e.prototype.transpose=function(){for(var t=[],n=0;n<this.columns;n++)t.push(this.getColumn(n));return new(e.bind.apply(e,fE([void 0],pE(t),!1)))},e.prototype.cross=function(t){var n=new Array(this.rows).fill("").map((function(){return[]}));if(this.columns===t.rows)for(var o=0;o<this.rows;o++)for(var i=this.getRow(o),r=function(e){var r=t.getColumn(e);n[o][e]=i.reduce((function(t,e,n){return t+e*r[n]}),0)},a=0;a<t.columns;a++)r(a);return new(e.bind.apply(e,fE([void 0],pE(n),!1)))},e.prototype.to2D=function(){return this.map((function(t){return[t[0],t[1]]}))},e.prototype.toPoints=function(){return this.map((function(t){return new dE(t[0],t[1])}))},e.prototype.toString=function(){var t=pE(this[0],2),e=t[0],n=t[1],o=pE(this[1],2),i=o[0],r=o[1],a=pE(this[2],2),s=a[0],l=a[1];return"matrix(".concat(e," ").concat(n," ").concat(i," ").concat(r," ").concat(s," ").concat(l,")")},e.prototype.translate=function(t,e){return this.cross(new mE(t,e))},e.prototype.rotate=function(t){return this.cross(new vE(t))},e.prototype.scale=function(t,e){return this.cross(new yE(t,e))},e}(Array),vE=function(t){function e(n){var o=t.call(this,new cE(+Math.cos(n).toFixed(2),+Math.sin(n).toFixed(2),0),new cE(-Math.sin(n).toFixed(2),+Math.cos(n).toFixed(2),0),new cE(0,0,1))||this;return Object.setPrototypeOf(o,e.prototype),o}return hE(e,t),e.prototype.inverse=function(){return this.transpose()},e}(gE),yE=function(t){function e(n,o){var i=t.call(this,new cE(n,0,0),new cE(0,o,0),new cE(0,0,1))||this;return i.sx=n,i.sy=o,Object.setPrototypeOf(i,e.prototype),i}return hE(e,t),e.prototype.inverse=function(){return new e(1/this.sx,1/this.sy)},e}(gE),mE=function(t){function e(n,o){var i=t.call(this,new cE(1,0,0),new cE(0,1,0),new cE(n,o,1))||this;return i.tx=n,i.ty=o,Object.setPrototypeOf(i,e.prototype),i}return hE(e,t),e.prototype.inverse=function(){return new e(-this.tx,-this.ty)},e}(gE);!function(t){var e=t.enforceActions,n=t.computedRequiresReaction,o=t.computedConfigurable,i=t.disableErrorBoundaries,r=t.reactionScheduler,a=t.reactionRequiresObservable,s=t.observableRequiresReaction;if(!0===t.isolateGlobalState&&((ib.pendingReactions.length||ib.inBatch||ib.isRunningReactions)&&jy("isolateGlobalState should be called before MobX is running any reactions"),ob=!0,nb&&(0==--eb().__mobxInstanceCount&&(eb().__mobxGlobals=void 0),ib=new Qm)),void 0!==e){var l=void 0;switch(e){case!0:case"observed":l=!0;break;case!1:case"never":l=!1;break;case"strict":case"always":l="strict";break;default:jy("Invalid value for 'enforceActions': '"+e+"', expected 'never', 'always' or 'observed'")}ib.enforceActions=l,ib.allowStateChanges=!0!==l&&"strict"!==l}void 0!==n&&(ib.computedRequiresReaction=!!n),void 0!==a&&(ib.reactionRequiresObservable=!!a),void 0!==s&&(ib.observableRequiresReaction=!!s,ib.allowStateReads=!ib.observableRequiresReaction),void 0!==o&&(ib.computedConfigurable=!!o),void 0!==i&&(!0===i&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),ib.disableErrorBoundaries=!!i),r&&bb(r)}({isolateGlobalState:!0});var bE=function(){return bE=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},bE.apply(this,arguments)},xE=function(t){return t.anchors},_E=function(t,e){for(var n,o=xE(e),i=Number.MAX_SAFE_INTEGER,r=0;r<o.length;r++){var a=EE(t.x,t.y,o[r].x,o[r].y);a<i&&(i=a,n={index:r,anchor:bE(bE({},o[r]),{x:o[r].x,y:o[r].y,id:o[r].id})})}return n},EE=function(t,e,n,o){return Math.hypot(t-n,e-o)},wE=function(t,e){var n=!1,o=SE(e);return t.x>=o.minX-0&&t.x<=o.maxX+0&&t.y>=o.minY-0&&t.y<=o.maxY+0&&(n=!0),n},SE=function(t){var e=t.x,n=t.y,o=t.width,i=t.height;return{minX:e-o/2,minY:n-i/2,maxX:e+o/2,maxY:n+i/2,x:e,y:n,width:o,height:i,centerX:e,centerY:n}},CE=function(t,e,n){var o,i=function(t){var e=t,n=e.x,o=e.y,i=e.width,r=e.height,a=e.radius;return[{x:n-i/2+a,y:o-r/2+a,r:a},{x:n+i/2-a,y:o-r/2+a,r:a},{x:n-i/2+a,y:o+r/2-a,r:a},{x:n+i/2-a,y:o+r/2-a,r:a}]}(n),r=Number.MAX_SAFE_INTEGER;return i.forEach((function(e){var n=EE(t.x,t.y,e.x,e.y);n<r&&(r=n,o=e)})),NE(t,e,o)},NE=function(t,e,n){var o,i=n.x,r=n.y,a=n.r;if(e===Cy.HORIZONTAL){var s=i-Math.sqrt(a*a-(t.y-r)*(t.y-r)),l=i+Math.sqrt(a*a-(t.y-r)*(t.y-r));o={x:Math.abs(s-t.x)<Math.abs(l-t.x)?s:l,y:t.y}}else if(e===Cy.VERTICAL){var u=r-Math.sqrt(a*a-(t.x-i)*(t.x-i)),c=r+Math.sqrt(a*a-(t.x-i)*(t.x-i)),d=Math.abs(u-t.y)<Math.abs(c-t.y)?u:c;o={x:t.x,y:d}}return o},TE=function(t,e){var n=e,o=!1,i=n.x,r=n.y,a=n.width,s=n.height,l=n.radius,u=i-a/2+l,c=i+a/2-l,d=r-s/2+l,h=r+s/2-l;return t.y===r+s/2||t.y===r-s/2?o=t.x>u&&t.x<c:t.x!==i+a/2&&t.x!==i-a/2||(o=t.y>d&&t.y<h),o},AE=function(t,e,n){var o,i=n,r=i.x,a=i.y,s=i.rx,l=i.ry;if(e===Cy.HORIZONTAL){var u=r-Math.sqrt(s*s-(t.y-a)*(t.y-a)*s*s/(l*l)),c=r+Math.sqrt(s*s-(t.y-a)*(t.y-a)*s*s/(l*l));o={x:Math.abs(u-t.x)<Math.abs(c-t.x)?u:c,y:t.y}}else if(e===Cy.VERTICAL){var d=a-Math.sqrt(l*l-(t.x-r)*(t.x-r)*l*l/(s*s)),h=a+Math.sqrt(l*l-(t.x-r)*(t.x-r)*l*l/(s*s)),p=Math.abs(d-t.y)<Math.abs(h-t.y)?d:h;o={x:t.x,y:p}}return o},ME=function(t,e,n){for(var o,i=n.pointsPosition,r=Number.MAX_SAFE_INTEGER,a=[],s=0;s<i.length;s++)a.push({start:i[s],end:i[(s+1)%i.length]});return a.forEach((function(n){var i=n.start,a=n.end,s=i,l=a;i.x>a.x&&(s=a,l=i);var u={x:t.x,y:t.y};if(s.x===l.x&&e===Cy.HORIZONTAL&&(u={x:s.x,y:t.y}),s.y===l.y&&e===Cy.VERTICAL&&(u={x:t.x,y:s.y}),s.x!==l.x&&s.y!==l.y){var c=(l.y-s.y)/(l.x-s.x),d=(s.x*l.y-l.x*s.y)/(s.x-l.x);e===Cy.HORIZONTAL?u={x:(t.y-d)/c,y:t.y}:e===Cy.VERTICAL&&(u={x:t.x,y:c*t.x+d})}if(ky(u,i,a)){var h=EE(u.x,u.y,t.x,t.y);h<r&&(r=h,o=u)}})),o},OE=function(t){return yh(t,["id","type","x","y","text","label","properties","virtual","rotate","resizable","rotatable"])},PE=function(t,e,n,o){var i=t.x,r=t.y;return e.x>t.x?i=t.x+n/2:e.x<t.x&&(i=t.x-n/2),e.y>t.y?r=t.y+o/2:e.y<t.y&&(r=t.y-o/2),{x:i,y:r}},kE=function(t){var e=t.rows,n=t.rowsLength,o=t.fontSize,i=0;return e&&e.forEach((function(t){var e=function(t){if(!t)return 0;for(var e=0,n=0;n<t.length;n++){var o=t.charCodeAt(n);t.match(/[A-Z]/)?e+=1.5:e+=o>=1&&o<=126||o>=65376&&o<=65439?1:2}return e}(t);i=e>i?e:i})),{width:Math.ceil(i/2)*o+o/4,height:n*(o+2)+o/4}};let RE;const DE=new Uint8Array(16);function LE(){if(!RE&&(RE="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!RE))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return RE(DE)}var IE=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const jE=[];for(let t=0;t<256;++t)jE.push((t+256).toString(16).slice(1));function BE(t,e=0){return jE[t[e+0]]+jE[t[e+1]]+jE[t[e+2]]+jE[t[e+3]]+"-"+jE[t[e+4]]+jE[t[e+5]]+"-"+jE[t[e+6]]+jE[t[e+7]]+"-"+jE[t[e+8]]+jE[t[e+9]]+"-"+jE[t[e+10]]+jE[t[e+11]]+jE[t[e+12]]+jE[t[e+13]]+jE[t[e+14]]+jE[t[e+15]]}function HE(t){if(!function(t){return"string"==typeof t&&IE.test(t)}(t))throw TypeError("Invalid UUID");let e;const n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n}function FE(t,e,n){function o(t,o,i,r){var a;if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));const e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof o&&(o=HE(o)),16!==(null===(a=o)||void 0===a?void 0:a.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let s=new Uint8Array(16+t.length);if(s.set(o),s.set(t,o.length),s=n(s),s[6]=15&s[6]|e,s[8]=63&s[8]|128,i){r=r||0;for(let t=0;t<16;++t)i[r+t]=s[t];return i}return BE(s)}try{o.name=t}catch(t){}return o.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",o.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",o}function zE(t){return 14+(t+64>>>9<<4)+1}function WE(t,e){const n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function GE(t,e,n,o,i,r){return WE((a=WE(WE(e,t),WE(o,r)))<<(s=i)|a>>>32-s,n);var a,s}function UE(t,e,n,o,i,r,a){return GE(e&n|~e&o,t,e,i,r,a)}function XE(t,e,n,o,i,r,a){return GE(e&o|n&~o,t,e,i,r,a)}function VE(t,e,n,o,i,r,a){return GE(e^n^o,t,e,i,r,a)}function YE(t,e,n,o,i,r,a){return GE(n^(e|~o),t,e,i,r,a)}FE("v3",48,(function(t){if("string"==typeof t){const e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n)}return function(t){const e=[],n=32*t.length,o="0123456789abcdef";for(let i=0;i<n;i+=8){const n=t[i>>5]>>>i%32&255,r=parseInt(o.charAt(n>>>4&15)+o.charAt(15&n),16);e.push(r)}return e}(function(t,e){t[e>>5]|=128<<e%32,t[zE(e)-1]=e;let n=1732584193,o=-271733879,i=-1732584194,r=271733878;for(let e=0;e<t.length;e+=16){const a=n,s=o,l=i,u=r;n=UE(n,o,i,r,t[e],7,-680876936),r=UE(r,n,o,i,t[e+1],12,-389564586),i=UE(i,r,n,o,t[e+2],17,606105819),o=UE(o,i,r,n,t[e+3],22,-1044525330),n=UE(n,o,i,r,t[e+4],7,-176418897),r=UE(r,n,o,i,t[e+5],12,1200080426),i=UE(i,r,n,o,t[e+6],17,-1473231341),o=UE(o,i,r,n,t[e+7],22,-45705983),n=UE(n,o,i,r,t[e+8],7,1770035416),r=UE(r,n,o,i,t[e+9],12,-1958414417),i=UE(i,r,n,o,t[e+10],17,-42063),o=UE(o,i,r,n,t[e+11],22,-1990404162),n=UE(n,o,i,r,t[e+12],7,1804603682),r=UE(r,n,o,i,t[e+13],12,-40341101),i=UE(i,r,n,o,t[e+14],17,-1502002290),o=UE(o,i,r,n,t[e+15],22,1236535329),n=XE(n,o,i,r,t[e+1],5,-165796510),r=XE(r,n,o,i,t[e+6],9,-1069501632),i=XE(i,r,n,o,t[e+11],14,643717713),o=XE(o,i,r,n,t[e],20,-373897302),n=XE(n,o,i,r,t[e+5],5,-701558691),r=XE(r,n,o,i,t[e+10],9,38016083),i=XE(i,r,n,o,t[e+15],14,-660478335),o=XE(o,i,r,n,t[e+4],20,-405537848),n=XE(n,o,i,r,t[e+9],5,568446438),r=XE(r,n,o,i,t[e+14],9,-1019803690),i=XE(i,r,n,o,t[e+3],14,-187363961),o=XE(o,i,r,n,t[e+8],20,1163531501),n=XE(n,o,i,r,t[e+13],5,-1444681467),r=XE(r,n,o,i,t[e+2],9,-51403784),i=XE(i,r,n,o,t[e+7],14,1735328473),o=XE(o,i,r,n,t[e+12],20,-1926607734),n=VE(n,o,i,r,t[e+5],4,-378558),r=VE(r,n,o,i,t[e+8],11,-2022574463),i=VE(i,r,n,o,t[e+11],16,1839030562),o=VE(o,i,r,n,t[e+14],23,-35309556),n=VE(n,o,i,r,t[e+1],4,-1530992060),r=VE(r,n,o,i,t[e+4],11,1272893353),i=VE(i,r,n,o,t[e+7],16,-155497632),o=VE(o,i,r,n,t[e+10],23,-1094730640),n=VE(n,o,i,r,t[e+13],4,681279174),r=VE(r,n,o,i,t[e],11,-358537222),i=VE(i,r,n,o,t[e+3],16,-722521979),o=VE(o,i,r,n,t[e+6],23,76029189),n=VE(n,o,i,r,t[e+9],4,-640364487),r=VE(r,n,o,i,t[e+12],11,-421815835),i=VE(i,r,n,o,t[e+15],16,530742520),o=VE(o,i,r,n,t[e+2],23,-995338651),n=YE(n,o,i,r,t[e],6,-198630844),r=YE(r,n,o,i,t[e+7],10,1126891415),i=YE(i,r,n,o,t[e+14],15,-1416354905),o=YE(o,i,r,n,t[e+5],21,-57434055),n=YE(n,o,i,r,t[e+12],6,1700485571),r=YE(r,n,o,i,t[e+3],10,-1894986606),i=YE(i,r,n,o,t[e+10],15,-1051523),o=YE(o,i,r,n,t[e+1],21,-2054922799),n=YE(n,o,i,r,t[e+8],6,1873313359),r=YE(r,n,o,i,t[e+15],10,-30611744),i=YE(i,r,n,o,t[e+6],15,-1560198380),o=YE(o,i,r,n,t[e+13],21,1309151649),n=YE(n,o,i,r,t[e+4],6,-145523070),r=YE(r,n,o,i,t[e+11],10,-1120210379),i=YE(i,r,n,o,t[e+2],15,718787259),o=YE(o,i,r,n,t[e+9],21,-343485551),n=WE(n,a),o=WE(o,s),i=WE(i,l),r=WE(r,u)}return[n,o,i,r]}(function(t){if(0===t.length)return[];const e=8*t.length,n=new Uint32Array(zE(e));for(let o=0;o<e;o+=8)n[o>>5]|=(255&t[o/8])<<o%32;return n}(t),8*t.length))}));var qE={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function KE(t,e,n){if(qE.randomUUID&&!e&&!t)return qE.randomUUID();const o=(t=t||{}).random||(t.rng||LE)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e){n=n||0;for(let t=0;t<16;++t)e[n+t]=o[t];return e}return BE(o)}function ZE(t,e,n,o){switch(t){case 0:return e&n^~e&o;case 1:case 3:return e^n^o;case 2:return e&n^e&o^n&o}}function $E(t,e){return t<<e|t>>>32-e}FE("v5",80,(function(t){const e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){const e=unescape(encodeURIComponent(t));t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);const o=t.length/4+2,i=Math.ceil(o/16),r=new Array(i);for(let e=0;e<i;++e){const n=new Uint32Array(16);for(let o=0;o<16;++o)n[o]=t[64*e+4*o]<<24|t[64*e+4*o+1]<<16|t[64*e+4*o+2]<<8|t[64*e+4*o+3];r[e]=n}r[i-1][14]=8*(t.length-1)/Math.pow(2,32),r[i-1][14]=Math.floor(r[i-1][14]),r[i-1][15]=8*(t.length-1)&4294967295;for(let t=0;t<i;++t){const o=new Uint32Array(80);for(let e=0;e<16;++e)o[e]=r[t][e];for(let t=16;t<80;++t)o[t]=$E(o[t-3]^o[t-8]^o[t-14]^o[t-16],1);let i=n[0],a=n[1],s=n[2],l=n[3],u=n[4];for(let t=0;t<80;++t){const n=Math.floor(t/20),r=$E(i,5)+ZE(n,a,s,l)+u+e[n]+o[t]>>>0;u=l,l=s,s=$E(a,30)>>>0,a=i,i=r}n[0]=n[0]+i>>>0,n[1]=n[1]+a>>>0,n[2]=n[2]+s>>>0,n[3]=n[3]+l>>>0,n[4]=n[4]+u>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}));var JE=function(){return KE()},QE={baseNode:{fill:"#fff",stroke:"#000",strokeWidth:2},baseEdge:{stroke:"#000",strokeWidth:2},rect:{},circle:{},diamond:{},ellipse:{},polygon:{},text:{color:"#000",stroke:"none",fontSize:12,background:{fill:"transparent"}},anchor:{stroke:"#000",fill:"#fff",r:4,hover:{r:10,fill:"#949494",fillOpacity:.5,stroke:"#949494"}},anchorLine:{stroke:"#000",strokeWidth:2,strokeDasharray:"3,2"},nodeText:{color:"#000",overflowMode:"default",fontSize:12,lineHeight:1.2},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"#fff"}},line:{},polyline:{},bezier:{fill:"none",adjustLine:{stroke:"#949494"},adjustAnchor:{r:4,fill:"#949494",fillOpacity:1,stroke:"#949494"}},arrow:{offset:10,verticalLength:5},snapline:{stroke:"#949494",strokeWidth:1},edgeAdjust:{r:4,fill:"#fff",stroke:"#949494",strokeWidth:2},outline:{fill:"transparent",stroke:"#949494",strokeDasharray:"3,3",hover:{stroke:"#949494"}},edgeAnimation:{stroke:"red",strokeDasharray:"10,10",strokeDashoffset:"100%",animationName:"lf_animate_dash",animationDuration:"20s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"normal"},rotateControl:{stroke:"#000",fill:"#fff",strokeWidth:1.5},resizeControl:{width:7,height:7,fill:"#fff",stroke:"#000"},resizeOutline:{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},tw=function(t){var e=Is(QE);return t&&(e=md(e,t)),e},ew=tw,nw=1e3,ow=999,iw=function(){return++nw},rw=function(){return--ow},aw=function(){return aw=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},aw.apply(this,arguments)},sw=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a};function lw(t){var e=t.x,n=t.y,o=t.width,i=t.height,r=t.className,a=t.strokeWidth,s=t.radius,l=void 0===s?0:s,u=e-o/2,c=n-i/2,d={};return d["stroke-width"]=a,xu(Tu(t),(function(t){var e=sw(t,2),n=e[0],o=e[1];"object"!=typeof o&&(d[n]=o)})),d.className=r?"lf-basic-shape ".concat(r):"lf-basic-shape",l&&(d.rx=l,d.ry=l),d.x=u,d.y=c,fg("rect",aw({},d))}var uw,cw=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),dw=function(){return dw=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},dw.apply(this,arguments)},hw=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(t);i<o.length;i++)e.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(t,o[i])&&(n[o[i]]=t[o[i]])}return n},pw=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a};!function(t){t[t.LEFT_TOP=0]="LEFT_TOP",t[t.RIGHT_TOP=1]="RIGHT_TOP",t[t.RIGHT_BOTTOM=2]="RIGHT_BOTTOM",t[t.LEFT_BOTTOM=3]="LEFT_BOTTOM"}(uw||(uw={}));var fw=function(t){function e(e){var n=t.call(this)||this;n.updateEdgePointByAnchors=function(){var t=n.nodeModel,e=t.id,o=t.anchors;xu(n.graphModel.getNodeEdges(e),(function(t){if(t.sourceNodeId===e)(n=Uu(o,(function(e){return e.id===t.sourceAnchorId})))&&t.updateStartPoint({x:n.x,y:n.y});else if(t.targetNodeId===e){var n;(n=Uu(o,(function(e){return e.id===t.targetAnchorId})))&&t.updateEndPoint({x:n.x,y:n.y})}}))},n.triggerResizeEvent=function(t,e,o,i,r,a){n.graphModel.eventCenter.emit(wy.NODE_RESIZE,{preData:t,data:e,deltaX:o,deltaY:i,index:r,model:a})},n.recalcResizeInfo=function(t,e,n,o,i){void 0===n&&(n=1),void 0===o&&(o=!1),void 0===i&&(i=!1);var r=Is(e),a=r.deltaX,s=r.deltaY,l=r.width,u=r.height,c=r.PCTResizeInfo;if(c){var d=0,h=0;switch(t){case uw.LEFT_TOP:h=(-1*a-s)/4;break;case uw.RIGHT_TOP:h=(a-s)/4;break;case uw.RIGHT_BOTTOM:h=(a+s)/4;break;case uw.LEFT_BOTTOM:h=(-1*a+s)/4}0!==h&&(d=Math.round(h/c.ResizeBasis.basisHeight*1e5)/1e3),c.ResizePCT.widthPCT=Math.max(Math.min(c.ResizePCT.widthPCT+d,c.ScaleLimit.maxScaleLimit),c.ScaleLimit.minScaleLimit),c.ResizePCT.heightPCT=Math.max(Math.min(c.ResizePCT.heightPCT+d,c.ScaleLimit.maxScaleLimit),c.ScaleLimit.minScaleLimit);var p=Math.round(c.ResizePCT.widthPCT*c.ResizeBasis.basisWidth/100),f=Math.round(c.ResizePCT.heightPCT*c.ResizeBasis.basisHeight/100);switch(t){case uw.LEFT_TOP:a=l-p,s=u-f;break;case uw.RIGHT_TOP:a=p-l,s=u-f;break;case uw.RIGHT_BOTTOM:a=p-l,s=f-u;break;case uw.LEFT_BOTTOM:a=l-p,s=f-u}return r}switch(t){case uw.LEFT_TOP:r.width=o?l:l-a*n,r.height=i?u:u-s*n;break;case uw.RIGHT_TOP:r.width=o?l:l+a*n,r.height=i?u:u-s*n;break;case uw.RIGHT_BOTTOM:r.width=o?l:l+a*n,r.height=i?u:u+s*n;break;case uw.LEFT_BOTTOM:r.width=o?l:l-a*n,r.height=i?u:u+s*n}return r},n.resizeNode=function(t){var e=t.deltaX,o=t.deltaY,i=n.index,r=n.props,a=r.model,s=r.graphModel;gw({deltaX:e,deltaY:o,index:i,nodeModel:a,graphModel:s,cancelCallback:function(){n.dragHandler.cancelDrag()}})},n.onDragging=function(t){var e=t.deltaX,o=t.deltaY,i=n.graphModel.transformModel,r=pw(i.fixDeltaXY(e,o),2),a=r[0],s=r[1];n.resizeNode({deltaX:a,deltaY:s})},n.onDragEnd=function(){var t=n.nodeModel.x,e=n.nodeModel.y;n.nodeModel.moveTo(t,e),n.updateEdgePointByAnchors()};var o=e.index,i=e.model,r=e.graphModel;return n.index=o,n.nodeModel=i,n.graphModel=r,n.dragHandler=new Py({onDragging:n.onDragging,onDragEnd:n.onDragEnd,step:r.gridSize}),n}return cw(e,t),e.prototype.render=function(){var t=this.props,e=t.x,n=t.y,o=t.direction,i=t.model.getResizeControlStyle(),r=i.width,a=i.height,s=hw(i,["width","height"]);return fg("g",{className:"lf-resize-control lf-resize-control-".concat(o),children:[fg(lw,dw({className:"lf-resize-control-content",x:e,y:n,width:null!=r?r:7,height:null!=a?a:7},s)),fg(lw,{className:"lf-resize-control-content",x:e,y:n,width:25,height:25,fill:"transparent",stroke:"transparent",onMouseDown:this.dragHandler.handleMouseDown})]})},e}(qf);!function(t){function e(){return t.call(this)||this}cw(e,t),e.prototype.getResizeControl=function(){var t=this.props,e=t.model,n=t.graphModel,o=SE(e),i=o.minX,r=o.minY,a=o.maxX,s=o.maxY;return Ju([{index:uw.LEFT_TOP,direction:"nw",x:i,y:r},{index:uw.RIGHT_TOP,direction:"ne",x:a,y:r},{index:uw.RIGHT_BOTTOM,direction:"se",x:a,y:s},{index:uw.LEFT_BOTTOM,direction:"sw",x:i,y:s}],(function(t){return fg(fw,dw({},t,{model:e,graphModel:n}))}))},e.prototype.getResizeOutline=function(){var t=this.props.model,e=t.x,n=t.y,o=t.width,i=t.height,r=t.getResizeOutlineStyle();return fg(lw,dw({},r,{x:e,y:n,width:o,height:i}))},e.prototype.render=function(){return fg("g",{className:"lf-resize-control-group",children:[this.getResizeOutline(),this.getResizeControl()]})}}(qf);var gw=function(t){var e=t.deltaX,n=t.deltaY,o=t.index,i=t.nodeModel,r=t.graphModel,a=t.cancelCallback,s=i.r,l=i.rx,u=i.ry,c=i.width,d=i.height,h=i.PCTResizeInfo,p=i.minWidth,f=i.minHeight,g=i.maxWidth,v=i.maxHeight,y=p===g,m=function(t,e,n,o,i){void 0===n&&(n=1),void 0===o&&(o=!1),void 0===i&&(i=!1);var r=Is(e),a=r.deltaX,s=r.deltaY,l=r.width,u=r.height,c=r.PCTResizeInfo;if(c){var d=0,h=0;switch(t){case uw.LEFT_TOP:h=(-1*a-s)/4;break;case uw.RIGHT_TOP:h=(a-s)/4;break;case uw.RIGHT_BOTTOM:h=(a+s)/4;break;case uw.LEFT_BOTTOM:h=(-1*a+s)/4}0!==h&&(d=Math.round(h/c.ResizeBasis.basisHeight*1e5)/1e3),c.ResizePCT.widthPCT=Math.max(Math.min(c.ResizePCT.widthPCT+d,c.ScaleLimit.maxScaleLimit),c.ScaleLimit.minScaleLimit),c.ResizePCT.heightPCT=Math.max(Math.min(c.ResizePCT.heightPCT+d,c.ScaleLimit.maxScaleLimit),c.ScaleLimit.minScaleLimit);var p=Math.round(c.ResizePCT.widthPCT*c.ResizeBasis.basisWidth/100),f=Math.round(c.ResizePCT.heightPCT*c.ResizeBasis.basisHeight/100);switch(t){case uw.LEFT_TOP:a=l-p,s=u-f;break;case uw.RIGHT_TOP:a=p-l,s=u-f;break;case uw.RIGHT_BOTTOM:a=p-l,s=f-u;break;case uw.LEFT_BOTTOM:a=l-p,s=f-u}return r}switch(t){case uw.LEFT_TOP:r.width=o?l:l-a*n,r.height=i?u:u-s*n;break;case uw.RIGHT_TOP:r.width=o?l:l+a*n,r.height=i?u:u-s*n;break;case uw.RIGHT_BOTTOM:r.width=o?l:l+a*n,r.height=i?u:u+s*n;break;case uw.LEFT_BOTTOM:r.width=o?l:l-a*n,r.height=i?u:u+s*n}return r}(o,{width:s||l||c,height:s||u||d,deltaX:e,deltaY:n,PCTResizeInfo:h},s||l&&u?.5:1,y,f===v);if(m.width<p||m.width>g||m.height<f||m.height>v)null==a||a();else{m.deltaX=y?0:m.deltaX,m.deltaY=y?0:m.deltaY;var b=i.getData(),x=i.resize(m);!function(t,e){var n=t.id,o=t.anchors;xu(e.getNodeEdges(n),(function(t){if(t.sourceNodeId===n)(e=Uu(o,(function(e){return e.id===t.sourceAnchorId})))&&t.updateStartPoint({x:e.x,y:e.y});else if(t.targetNodeId===n){var e;(e=Uu(o,(function(e){return e.id===t.targetAnchorId})))&&t.updateEndPoint({x:e.x,y:e.y})}}))}(i,r),function(t,e,n,o,i,r,a){a.eventCenter.emit(wy.NODE_RESIZE,{preData:t,data:e,deltaX:n,deltaY:o,index:i,model:r})}(b,x,e,n,o,i,r)}},vw=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.componentDidMount=function(){t.prototype.componentDidMount.call(this);var e=this.props,n=e.model,o=e.graphModel,i=o.eventCenter;i.on("node:rotate",(function(t){var e=t.model;e.id===n.id&&xu(Array.from(n.children),(function(t){var n=o.getNodeModelById(t);n&&(n.rotate=e.rotate)}))})),i.on("node:resize",(function(t){var e=t.deltaX,i=t.deltaY,r=t.index;t.model.id===n.id&&xu(Array.from(n.children),(function(t){var n=o.getNodeModelById(t);n&&gw({deltaX:e,deltaY:i,index:r,nodeModel:n,graphModel:o,cancelCallback:function(){}})}))}))},n.prototype.getResizeControl=function(){var e=this.props.model,n=e.resizable,o=e.isCollapsed;return n&&!o?t.prototype.getResizeControl.call(this):null},n.prototype.getAppendAreaShape=function(){var t=this.props.model,n=t.width,o=t.height,i=t.x,r=t.y,a=t.radius;if(!t.groupAddable)return null;var s=t.getNodeStyle().strokeWidth,l=void 0===s?0:s,u=t.getAddableOutlineStyle(),c=n+l+8,d=o+l+8;return e.h("rect",g(g({},u),{width:c,height:d,x:i-c/2,y:r-d/2,rx:a,ry:a}))},n.prototype.getCollapseIcon=function(t,e){return"M ".concat(t+3,",").concat(e+6," ").concat(t+11,",").concat(e+6," M").concat(t+7,",").concat(e+2," ").concat(t+7,",").concat(e+10)},n.prototype.getExpandIcon=function(t,e){return"M ".concat(t+3,",").concat(e+6," ").concat(t+11,",").concat(e+6," ")},n.prototype.getOperateIcon=function(){var t=this.props.model,n=t.x,o=t.y,i=n-t.width/2+10,r=o-t.height/2+10;if(!t.collapsible)return null;var a=(null==t?void 0:t.isCollapsed)?this.getCollapseIcon(i,r):this.getExpandIcon(i,r),s=e.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:a});return e.h("g",{},[e.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#f4f5f6",stroke:"#cecece",cursor:"pointer",x:i,y:r,onClick:function(){t.toggleCollapse(!t.isCollapsed)}}),s])},n.prototype.getShape=function(){return e.h("g",{},[this.getAppendAreaShape(),t.prototype.getShape.call(this),this.getOperateIcon()])},n}(e.RectNode),yw=function(t){function n(e,n){var o=t.call(this,e,n)||this;return o.isGroup=!0,o.isRestrict=!1,o.collapsible=!0,o.isCollapsed=!1,o.groupAddable=!1,o.transformWidthContainer=!0,o.childrenLastCollapseStateDict={},o.initNodeData(e),o.setAttributes(),o}return f(n,t),n.prototype.initNodeData=function(e){var n;t.prototype.initNodeData.call(this,e);var o=null!==(n=e.properties)&&void 0!==n?n:{},i=o.children,r=o.width,a=o.height,s=o.collapsedWidth,l=o.collapsedHeight,u=o.collapsible,c=o.isCollapsed,d=o.zIndex,h=o.isRestrict,p=o.autoToFront;this.children=i?new Set(i):new Set,this.zIndex=null!=d?d:-1e4,this.isCollapsed=null!=c&&c;var f=null!=r?r:400,g=null!=a?a:230;this.width=f,this.height=g,this.expandWidth=f,this.expandHeight=g,this.collapsedWidth=null!=s?s:80,this.collapsedHeight=null!=l?l:60,this.isRestrict=null!=h&&h,this.collapsible=null==u||u,this.autoToFront=null!=p&&p,this.text.editable=!1,this.text.draggable=!1},n.prototype.setAttributes=function(){t.prototype.setAttributes.call(this),this.isCollapsed&&this.toggleCollapse(!0)},n.prototype.getData=function(){var e=this,n=t.prototype.getData.call(this),o=[];return xu(Array.from(this.children),(function(t){var n=e.graphModel.getNodeModelById(t);n&&!n.virtual&&o.push(t)})),n.children=o,n.properties&&(n.properties.children=o,n.properties.isCollapsed=this.isCollapsed),n},n.prototype.getHistoryData=function(){var e=t.prototype.getHistoryData.call(this);e.children=Array.from(this.children),e.isGroup=!0;var n=this,o=n.x,i=n.y,r=n.collapsedWidth,a=n.collapsedHeight,s=n.expandWidth,l=n.expandHeight;return n.isCollapsed&&(e.x=o+s/2-r/2,e.y=i+l/2-a/2),e},n.prototype.toggleCollapse=function(t){var n=this,o=!!t;this.isCollapsed=o,o?this.collapse():this.expand();var i=E(E([],_(this.incoming.edges),!1),_(this.outgoing.edges),!1);console.log("this --\x3e>",this),console.log("this.children --\x3e>",this.children),xu(Array.from(this.children),(function(o){var r=n.graphModel.getElement(o);if(r){var a=r.isCollapsed;if(r.isGroup){var s=r;if(s.isCollapsed||s.toggleCollapse(t),!t){var l=n.childrenLastCollapseStateDict[o];void 0!==l&&l!==r.isCollapsed&&s.toggleCollapse(l)}}if(n.childrenLastCollapseStateDict[o]=!!a,r.visible=!t,r.BaseType===e.ElementType.NODE){var u=r.incoming.edges,c=r.outgoing.edges;i=E(E(E([],_(i),!1),_(u),!1),_(c),!1)}}})),this.collapseEdge(o,i)},n.prototype.collapse=function(){var t=this,e=t.x,n=t.y,o=t.text,i=t.width,r=t.height,a=t.collapsedWidth,s=t.collapsedHeight;this.x=e-i/2+a/2,this.y=n-r/2+s/2,this.text.x=o.x-i/2+a/2,this.text.y=o.y-r/2+s/2,this.expandWidth=i,this.expandHeight=r,this.width=a,this.height=s},n.prototype.expand=function(){var t=this,e=t.x,n=t.y,o=t.text,i=t.expandWidth,r=t.expandHeight,a=t.collapsedWidth,s=t.collapsedHeight;this.width=i,this.height=r,this.x=e+this.width/2-a/2,this.y=n+this.height/2-s/2,this.text.x=o.x+this.width/2-a/2,this.text.y=o.y+this.height/2-s/2},n.prototype.createVirtualEdge=function(t){t.pointsList=void 0;var e=this.graphModel.addEdge(t);e.virtual=!0,e.text.editable=!1,e.isCollapsedEdge=!0},n.prototype.collapseEdge=function(t,e){var n=this,o=this.graphModel;xu(e,(function(e,i){var r,a=e.getData(),s=a.targetNodeId,l=a.sourceNodeId,u=g(g({},a),{id:"".concat(a.id,"__").concat(i),text:null===(r=a.text)||void 0===r?void 0:r.value});e.virtual&&o.deleteEdgeById(e.id);var c=o.group.getGroupByNodeId(s);c||(c=o.getNodeModelById(s));var d=o.group.getGroupByNodeId(l);d||(d=o.getNodeModelById(l)),t&&e.visible&&(n.children.has(l)||n.id===l?(u.startPoint=void 0,u.sourceNodeId=n.id):(u.endPoint=void 0,u.targetNodeId=n.id),c.id===n.id&&d.id===n.id||n.createVirtualEdge(u),e.visible=!1),t||e.visible||(c&&c.isGroup&&c.isCollapsed?(u.targetNodeId=c.id,u.endPoint=void 0,n.createVirtualEdge(u)):d&&d.isGroup&&d.isCollapsed?(u.sourceNodeId=d.id,u.startPoint=void 0,n.createVirtualEdge(u)):e.visible=!0)}))},n.prototype.isAllowAppendIn=function(t){return console.info("_nodeData",t),!0},n.prototype.setAllowAppendChild=function(t){this.groupAddable=t},n.prototype.addChild=function(t){this.children.add(t);var e=this.getData();this.graphModel.eventCenter.emit("group:add-node",{data:e})},n.prototype.removeChild=function(t){this.children.delete(t);var e=this.getData();this.graphModel.eventCenter.emit("group:remove-node",{data:e})},n.prototype.toBack=function(){this.zIndex--},n.prototype.getResizeOutlineStyle=function(){var e=t.prototype.getResizeOutlineStyle.call(this);return e.stroke="none",e},n.prototype.getAnchorStyle=function(){var e=t.prototype.getAnchorStyle.call(this);return e.stroke="transparent",e.fill="transparent",e.hover&&(e.hover.fill="transparent",e.hover.stroke="transparent"),e},n.prototype.getAddableOutlineStyle=function(){return{stroke:"#feb663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},y([e.observable],n.prototype,"isCollapsed",void 0),y([e.observable],n.prototype,"groupAddable",void 0),y([e.observable],n.prototype,"transformWidthContainer",void 0),n}(e.RectNodeModel);var mw,bw={type:"dynamic-group",view:vw,model:yw},xw=-1e4,_w=function(){function t(t){var e=t.lf,n=t.options,o=this;this.topGroupZIndex=xw,this.nodeGroupMap=new Map,this.addNodeToGroup=function(t){var e=t.data,n=o.nodeGroupMap.get(e.id);n&&((s=o.lf.getNodeModelById(n)).removeChild(e.id),o.nodeGroupMap.delete(e.id),s.setAllowAppendChild(!1));var i=o.lf.getNodeModelById(e.id),r=null==i?void 0:i.getBounds();if(i&&r){if(i.isGroup){var a=i;xu(Array.from(a.children),(function(t){o.nodeGroupMap.set(t,e.id)})),o.calibrateTopGroupZIndex([e]),o.onNodeSelect({data:e,isSelected:!1,isMultiple:!1})}var s;if(s=o.getGroupByBounds(r,e)){var l=s.isAllowAppendIn(e);console.log("isAllowAppendIn",l),l?(s.addChild(e.id),o.nodeGroupMap.set(e.id,s.id),s.setAllowAppendChild(!0)):o.lf.emit("group:not-allowed",{group:s.getData(),node:e})}}},this.removeNodeFromGroup=function(t){var e=t.data;e.isGroup&&e.children&&xu(Array.from(e.children),(function(t){o.nodeGroupMap.delete(t),o.lf.deleteNode(t)}));var n=o.nodeGroupMap.get(e.id);if(n){var i=o.lf.getNodeModelById(n);i&&i.removeChild(e.id),o.nodeGroupMap.delete(e.id)}},this.setActiveGroup=function(t){var e=t.data,n=o.lf.getNodeModelById(e.id),i=null==n?void 0:n.getBounds();if(n&&i){var r=o.getGroupByBounds(i,e);if(o.activeGroup&&o.activeGroup.setAllowAppendChild(!1),!r||n.isGroup&&r.id===e.id)return;if(!r.isAllowAppendIn(e))return;o.activeGroup=r,console.log("this.activeGroup",o.activeGroup),o.activeGroup.setAllowAppendChild(!0)}},this.onNodeSelect=function(t){var e=t.data,n=t.isMultiple,i=t.isSelected,r=o.lf.getNodeModelById(e.id);if(o.sendNodeToFront(r),o.topGroupZIndex>-1e3){var a=o.lf.graphModel.nodes;o.topGroupZIndex=xw;var s=Jh(Fu(a,(function(t){return!!t.isGroup})),"zIndex"),l=0;xu(s,(function(t){t.zIndex!==l&&(o.topGroupZIndex++,l=t.zIndex),t.setZIndex(o.topGroupZIndex)}))}if(n&&i)if(null==r?void 0:r.isGroup){var u=r.children;xu(Array.from(u),(function(t){var e=o.lf.getNodeModelById(t);null==e||e.setSelected(!1)}))}else{var c=o.nodeGroupMap.get(e.id);if(c){var d=o.lf.getNodeModelById(c);(null==d?void 0:d.isSelected)&&(null==r||r.setSelected(!1))}}},this.onGraphRendered=function(t){var e=t.data;console.log("data",e),xu(e.nodes,(function(t){t.children&&xu(t.children,(function(e){o.nodeGroupMap.set(e,t.id)}))})),o.calibrateTopGroupZIndex(e.nodes)},e.register(bw),this.lf=e,console.log("options",n),li(this,n),this.init()}return t.prototype.getNodesInGroup=function(t){var e=this,n=[];return t.isGroup&&xu(Array.from(t.children),(function(t){n.push(t);var o=e.lf.getNodeModelById(t);(null==o?void 0:o.isGroup)&&(n=n.concat(e.getNodesInGroup(o)))})),n},t.prototype.getGroupByNodeId=function(t){var e=this.nodeGroupMap.get(t);if(e)return this.lf.getNodeModelById(e)},t.prototype.getGroupByBounds=function(t,e){var n=Fu(this.lf.graphModel.nodes,(function(n){return!!n.isGroup&&function(t,e){var n=t.minX,o=t.minY,i=t.maxX,r=t.maxY,a=e.x,s=e.y,l=e.width,u=e.height;return n>=a-l/2&&i<=a+l/2&&o>=s-u/2&&r<=s+u/2}(t,n)&&n.id!==e.id})),o=n.length;if(o<=1)return n[0];for(var i=n[o-1],r=o-2;r>=0;r--)i=n[r];return i},t.prototype.sendNodeToFront=function(t){var e=this;if(t&&t.isGroup&&(this.topGroupZIndex++,t.setZIndex(this.topGroupZIndex),t.children)){var n=t.children;xu(Array.from(n),(function(t){var n=e.lf.getNodeModelById(t);e.sendNodeToFront(n)}))}},t.prototype.getMaxZIndex=function(t){var e=this,n=xw;if(t.isGroup&&(n=Math.max(n,t.zIndex)),t.children){var o=t.children;xu(Array.from(o),(function(t){var o=e.lf.getNodeModelById(t);if(null==o?void 0:o.isGroup){var i=e.getMaxZIndex(o);n=Math.max(n,i)}}))}return n},t.prototype.calibrateTopGroupZIndex=function(t){var e=this,n=xw;if(xu(t,(function(t){var o=e.lf.getNodeModelById(t.id);if(o){var i=e.getMaxZIndex(o);i>n&&(n=i)}})),!(this.topGroupZIndex>=n)){var o=Fu(this.lf.graphModel.nodes,(function(t){return!!t.isGroup})),i=this.topGroupZIndex;xu(o,(function(t){t.zIndex>i&&(i=t.zIndex)})),this.topGroupZIndex=i}},t.prototype.initGroupChildNodes=function(t,n,o,i){var r=this,a=[],s=[],l=[];xu(Array.from(n),(function(u){var c=r.lf.getNodeModelById(u);if(c){var d=c.getData(),h=e.EventType.NODE_GROUP_COPY||"node:group-copy-add",p=e.transformNodeData(d,i),f=r.lf.addNode(p,h);if(o.addChild(f.id),t[u]=f.id,a.push(f),l.push.apply(l,E([],_(E(E([],_(f.incoming.edges),!1),_(f.outgoing.edges),!1)),!1)),n instanceof Set){var g=r.initGroupChildNodes(t,n,f,i),v=g.childNodes,y=g.edgesData;a.push.apply(a,E([],_(v),!1)),s.push.apply(s,E([],_(y),!1))}}})),console.log("allRelatedEdges --\x3e>",l);var u=Ju(Fu(l,(function(e){return fc(t,e.sourceNodeId)&&fc(t,e.targetNodeId)})),(function(t){return t.getData()}));return{childNodes:a,edgesData:s.concat(u)}},t.prototype.createEdge=function(t,n,o){var i,r,a=t.sourceNodeId,s=t.targetNodeId,l=null!==(i=n[a])&&void 0!==i?i:a,u=null!==(r=n[s])&&void 0!==r?r:s,c=Is(t);return t.id&&"object"==typeof t.text&&null!==t.text&&(c=e.transformEdgeData(t,o)),this.lf.graphModel.addEdge(g(g({},c),{sourceNodeId:l,targetNodeId:u}))},t.prototype.init=function(){var t=this,e=this.lf,n=e.graphModel;n.addNodeMoveRules((function(e,o,i){if(e.isGroup){var r=t.getNodesInGroup(e);return n.moveNodes(r,o,i,!0),!0}var a=t.nodeGroupMap.get(e.id),s=t.lf.getNodeModelById(a);return!s||!s.isRestrict||function(t,e){var n=t.minX,o=t.minY,i=t.maxX,r=t.maxY,a=e.x,s=e.y,l=e.width,u=e.height;return{x:n>=a-l/2&&i<=a+l/2,y:o>=s-u/2&&r<=s+u/2}}(e.getBounds(),s)})),n.dynamicGroup=this,e.on("node:add,node:drop,node:dnd-add",this.addNodeToGroup),e.on("node:delete",this.removeNodeFromGroup),e.on("node:drag,node:dnd-drag",this.setActiveGroup),e.on("node:click",this.onNodeSelect),e.on("graph:rendered",this.onGraphRendered),e.on("graph:updated",(function(t){var e=t.data;return console.log("data",e)})),e.on("group:add-node",(function(t){var e=t.data;return console.log("group:add-node",e)})),e.addElements=function(n,o){var i=n.nodes,r=n.edges;void 0===o&&(o=40);var a={},s={nodes:[],edges:[]},l=[];return xu(i,(function(n){var i=n.id,r=n.children,u=v(n,["children"]),c=e.addNode(u);if(i&&(a[i]=c.id),s.nodes.push(c),c.isGroup){var d=t.initGroupChildNodes(a,r,c,o).edgesData;l.push.apply(l,E([],_(d),!1))}})),xu(l,(function(e){t.createEdge(e,a,o)})),console.log("selectedEdges ---\x3e>>",r),xu(r,(function(e){s.edges.push(t.createEdge(e,a,o))})),s},this.render()},t.prototype.render=function(){},t.prototype.destroy=function(){this.lf.off("node:add,node:drop,node:dnd-add",this.addNodeToGroup),this.lf.off("node:delete",this.removeNodeFromGroup),this.lf.off("node:drag,node:dnd-drag",this.setActiveGroup),this.lf.off("node:click",this.onNodeSelect),this.lf.off("graph:rendered",this.onGraphRendered)},t.pluginName="dynamicGroup",t}();!function(t){t.HORIZONTAL="horizontal",t.VERTICAL="vertical"}(mw||(mw={}));var Ew=function(t,e,n,o){return void 0===o&&(o=0),Cw(t,e,n)<=o};function ww(t){return t*t}function Sw(t,e){return ww(t.x-e.x)+ww(t.y-e.y)}var Cw=function(t,e,n){return Math.sqrt(function(t,e,n){var o=Sw(e,n);if(0===o)return Sw(t,e);var i=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/o;return i=Math.max(0,Math.min(1,i)),Sw(t,{x:e.x+i*(n.x-e.x),y:e.y+i*(n.y-e.y)})}(t,e,n))},Nw=function(t,e,n){var o=function(t){var e=t.x,n=t.y,o=t.width,i=t.height;return{minX:e-o/2,minY:n-i/2,maxX:e+o/2,maxY:n+i/2,x:e,y:n,width:o,height:i,centerX:e,centerY:n}}(t),i=function(t,e){var n;return t.x===e.x?n=mw.VERTICAL:t.y===e.y&&(n=mw.HORIZONTAL),n}(e,n),r=Math.max(e.x,n.x),a=Math.min(e.x,n.x),s=Math.max(e.y,n.y),l=Math.min(e.y,n.y),u=t.x,c=t.y,d=t.width,h=t.height;if(i===mw.HORIZONTAL){if(r>=o.maxX&&a<=o.minX)return{startCrossPoint:{x:e.x>n.x?u+d/2:u-d/2,y:e.y},endCrossPoint:{x:e.x>n.x?u-d/2:u+d/2,y:e.y}}}else if(i===mw.VERTICAL&&s>=o.maxY&&l<=o.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}}},Tw=function(t,e,n){void 0===n&&(n=0);for(var o=t.x,i=t.y,r=e.pointsList,a=0;a<r.length-1;a++)if(Ew({x:o,y:i},r[a],r[a+1],n)){var s=Nw(t,r[a],r[a+1]);if(s)return{crossIndex:a+1,crossPoints:s}}return{crossIndex:-1,crossPoints:{startCrossPoint:{x:0,y:0},endCrossPoint:{x:0,y:0}}}},Aw=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,o=t._lf.graphModel.edges,i=n.id,r=!0,a=0;a<o.length;a++)if(o[a].sourceNodeId===i||o[a].targetNodeId===i){r=!1;break}r&&t.insetNode(n)}))},t.prototype.checkRuleBeforeInsetNode=function(t,n,o,i,r){var a=this._lf.getNodeModelById(t),s=this._lf.getNodeModelById(n),l=a.getAnchorInfo(o),u=s.getAnchorInfo(i),c=a.isAllowConnectedAsSource(r,l,u),d=s.isAllowConnectedAsTarget(r,l,u),h=e.formatAnchorConnectValidateData(c),p=h.isAllPass,f=h.msg,g=e.formatAnchorConnectValidateData(d),v=g.isAllPass;return{isPass:p&&v,sourceMsg:f,targetMsg:g.msg}},t.prototype.insetNode=function(t){var n=this,o=this._lf.graphModel.edges,i=this._lf.getNodeModelById(t.id),r=null==i?void 0:i.getDefaultAnchor();if(!r||0===r.length)this._lf.graphModel.eventCenter.emit(e.EventType.CONNECTION_NOT_ALLOWED,{data:t,msg:"自定义类型节点不显示锚点,也不允许其他节点连接到此节点"});else if(i)for(var a=0;a<o.length;a++){var s=Tw(i,o[a],this.deviation),l=s.crossIndex,u=s.crossPoints;if(l>=0){var c=o[a],d=c.sourceNodeId,h=c.targetNodeId,p=c.id,f=c.type,g=c.pointsList,v=c.sourceAnchorId,y=c.targetAnchorId,m=Is(g[0]),b=Is(u.startCrossPoint);this._lf.deleteEdge(p);var x=this.checkRuleBeforeInsetNode(d,h,v,y,t);if(this._lf.addEdge({type:f,sourceNodeId:d,targetNodeId:t.id,startPoint:m,endPoint:b,pointsList:E(E([],_(g.slice(0,l)),!1),[u.startCrossPoint],!1)}),this._lf.addEdge({type:f,sourceNodeId:t.id,targetNodeId:h,startPoint:Is(u.endCrossPoint),endPoint:Is(g[g.length-1]),pointsList:E([u.endCrossPoint],_(g.slice(l)),!1)}),x.isPass)break;this._lf.graphModel.eventCenter.emit(e.EventType.CONNECTION_NOT_ALLOWED,{data:t,msg:x.targetMsg||x.sourceMsg}),setTimeout((function(){n._lf.undo()}),200);break}}},t.pluginName="insertNodeInPolyline",t}(),Mw="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ow={},Pw={get exports(){return Ow},set exports(t){Ow=t}};
26
26
  /*!
27
27
  Copyright (c) 2018 Jed Watson.
28
28
  Licensed under the MIT License (MIT), see
@@ -38,5 +38,5 @@ var _f,Ef=4294967295,wf=Array.prototype,Sf=Object.prototype.hasOwnProperty,Cf=Ht
38
38
  *
39
39
  * Copyright 2017-2024 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate)
40
40
  * Released under the ISC license.
41
- */String.prototype.startsWith=String.prototype.startsWith||function(t){return 0===this.indexOf(t)},String.prototype.padStart=String.prototype.padStart||function(t,e){for(var n=this;n.length<t;)n=e+n;return n};var Ww={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function Gw(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(e>0?t.toFixed(e).replace(/0+$/,"").replace(/\.$/,""):t.toString())||"0"}var Uw=function(){function t(e,n,o,i){Hw(this,t);var r=this;if(void 0===e);else if(Array.isArray(e))this.rgba=e;else if(void 0===o){var a=e&&""+e;a&&function(e){if(e.startsWith("hsl")){var n=e.match(/([\-\d\.e]+)/g).map(Number),o=zw(n,4),i=o[0],a=o[1],s=o[2],l=o[3];void 0===l&&(l=1),i/=360,a/=100,s/=100,r.hsla=[i,a,s,l]}else if(e.startsWith("rgb")){var u=e.match(/([\-\d\.e]+)/g).map(Number),c=zw(u,4),d=c[0],h=c[1],p=c[2],f=c[3];void 0===f&&(f=1),r.rgba=[d,h,p,f]}else e.startsWith("#")?r.rgba=t.hexToRgb(e):r.rgba=t.nameToRgb(e)||t.hexToRgb(e)}(a.toLowerCase())}else this.rgba=[e,n,o,void 0===i?1:i]}return Fw(t,[{key:"printRGB",value:function(t){var e=(t?this.rgba:this.rgba.slice(0,3)).map((function(t,e){return Gw(t,3===e?3:0)}));return t?"rgba("+e+")":"rgb("+e+")"}},{key:"printHSL",value:function(t){var e=[360,100,100,1],n=["","%","%",""],o=(t?this.hsla:this.hsla.slice(0,3)).map((function(t,o){return Gw(t*e[o],3===o?3:1)+n[o]}));return t?"hsla("+o+")":"hsl("+o+")"}},{key:"printHex",value:function(t){var e=this.hex;return t?e:e.substring(0,7)}},{key:"rgba",get:function(){if(this._rgba)return this._rgba;if(!this._hsla)throw new Error("No color is set");return this._rgba=t.hslToRgb(this._hsla)},set:function(t){3===t.length&&(t[3]=1),this._rgba=t,this._hsla=null}},{key:"rgbString",get:function(){return this.printRGB()}},{key:"rgbaString",get:function(){return this.printRGB(!0)}},{key:"hsla",get:function(){if(this._hsla)return this._hsla;if(!this._rgba)throw new Error("No color is set");return this._hsla=t.rgbToHsl(this._rgba)},set:function(t){3===t.length&&(t[3]=1),this._hsla=t,this._rgba=null}},{key:"hslString",get:function(){return this.printHSL()}},{key:"hslaString",get:function(){return this.printHSL(!0)}},{key:"hex",get:function(){var t=this.rgba.map((function(t,e){return e<3?t.toString(16):Math.round(255*t).toString(16)}));return"#"+t.map((function(t){return t.padStart(2,"0")})).join("")},set:function(e){this.rgba=t.hexToRgb(e)}}],[{key:"hexToRgb",value:function(t){var e=(t.startsWith("#")?t.slice(1):t).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!e.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+t);var n=e.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map((function(t){return parseInt(t,16)}));return n[3]=n[3]/255,n}},{key:"nameToRgb",value:function(e){var n=e.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),o=Ww[n];return void 0===o?o:t.hexToRgb(o.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(t){var e=zw(t,4),n=e[0],o=e[1],i=e[2],r=e[3];n/=255,o/=255,i/=255;var a=Math.max(n,o,i),s=Math.min(n,o,i),l=void 0,u=void 0,c=(a+s)/2;if(a===s)l=u=0;else{var d=a-s;switch(u=c>.5?d/(2-a-s):d/(a+s),a){case n:l=(o-i)/d+(o<i?6:0);break;case o:l=(i-n)/d+2;break;case i:l=(n-o)/d+4}l/=6}return[l,u,c,r]}},{key:"hslToRgb",value:function(t){var e=zw(t,4),n=e[0],o=e[1],i=e[2],r=e[3],a=void 0,s=void 0,l=void 0;if(0===o)a=s=l=i;else{var u=function(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t},c=i<.5?i*(1+o):i+o-i*o,d=2*i-c;a=u(d,c,n+1/3),s=u(d,c,n),l=u(d,c,n-1/3)}var h=[255*a,255*s,255*l].map(Math.round);return h[3]=r,h}}]),t}(),Xw=function(){function t(){Hw(this,t),this._events=[]}return Fw(t,[{key:"add",value:function(t,e,n){t.addEventListener(e,n,!1),this._events.push({target:t,type:e,handler:n})}},{key:"remove",value:function(e,n,o){this._events=this._events.filter((function(i){var r=!0;return e&&e!==i.target&&(r=!1),n&&n!==i.type&&(r=!1),o&&o!==i.handler&&(r=!1),r&&t._doRemove(i.target,i.type,i.handler),!r}))}},{key:"destroy",value:function(){this._events.forEach((function(e){return t._doRemove(e.target,e.type,e.handler)})),this._events=[]}}],[{key:"_doRemove",value:function(t,e,n){t.removeEventListener(e,n,!1)}}]),t}();function Vw(t,e,n){var o=!1;function i(t,e,n){return Math.max(e,Math.min(t,n))}function r(t,r,a){if(a&&(o=!0),o){t.preventDefault();var s=e.getBoundingClientRect(),l=s.width,u=s.height,c=r.clientX,d=r.clientY,h=i(c-s.left,0,l),p=i(d-s.top,0,u);n(h/l,p/u)}}function a(t,e){1===(void 0===t.buttons?t.which:t.buttons)?r(t,t,e):o=!1}function s(t,e){1===t.touches.length?r(t,t.touches[0],e):o=!1}t.add(e,"mousedown",(function(t){a(t,!0)})),t.add(e,"touchstart",(function(t){s(t,!0)})),t.add(window,"mousemove",a),t.add(e,"touchmove",s),t.add(window,"mouseup",(function(t){o=!1})),t.add(e,"touchend",(function(t){o=!1})),t.add(e,"touchcancel",(function(t){o=!1}))}var Yw="keydown",qw="mousedown",Kw="focusin";function Zw(t,e){return(e||document).querySelector(t)}function $w(t){t.preventDefault(),t.stopPropagation()}function Jw(t,e,n,o,i){t.add(e,Yw,(function(t){n.indexOf(t.key)>=0&&(i&&$w(t),o(t))}))}var Qw=function(){function t(e){Hw(this,t),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new Xw,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(e)}return Fw(t,[{key:"setOptions",value:function(t){var e=this;if(t){var n=this.settings;if(t instanceof HTMLElement)n.parent=t;else{n.parent&&t.parent&&n.parent!==t.parent&&(this._events.remove(n.parent),this._popupInited=!1),function(t,e,n){for(var o in t)n&&n.indexOf(o)>=0||(e[o]=t[o])}(t,n),t.onChange&&(this.onChange=t.onChange),t.onDone&&(this.onDone=t.onDone),t.onOpen&&(this.onOpen=t.onOpen),t.onClose&&(this.onClose=t.onClose);var o=t.color||t.colour;o&&this._setColor(o)}var i=n.parent;if(i&&n.popup&&!this._popupInited){var r=function(t){return e.openHandler(t)};this._events.add(i,"click",r),Jw(this._events,i,[" ","Spacebar","Enter"],r),this._popupInited=!0}else t.parent&&!n.popup&&this.show()}}},{key:"openHandler",value:function(t){if(this.show()){t&&t.preventDefault(),this.settings.parent.style.pointerEvents="none";var e=t&&t.type===Yw?this._domEdit:this.domElement;setTimeout((function(){return e.focus()}),100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(t){var e=t&&t.type,n=!1;if(t)if(e===qw||e===Kw){var o=(this.__containedEvent||0)+100;t.timeStamp>o&&(n=!0)}else $w(t),n=!0;else n=!0;n&&this.hide()&&(this.settings.parent.style.pointerEvents="",e!==qw&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(t,e){this.closeHandler(),this.setOptions(t),e&&this.openHandler()}},{key:"setColor",value:function(t,e){this._setColor(t,{silent:e})}},{key:"_setColor",value:function(t,e){if("string"==typeof t&&(t=t.trim()),t){e=e||{};var n=void 0;try{n=new Uw(t)}catch(t){if(e.failSilently)return;throw t}if(!this.settings.alpha){var o=n.hsla;o[3]=1,n.hsla=o}this.colour=this.color=n,this._setHSLA(null,null,null,null,e)}}},{key:"setColour",value:function(t,e){this.setColor(t,e)}},{key:"show",value:function(){if(!this.settings.parent)return!1;if(this.domElement){var t=this._toggleDOM(!0);return this._setPosition(),t}var e,n,o=this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>',i=(e=o,(n=document.createElement("div")).innerHTML=e,n.firstElementChild);return this.domElement=i,this._domH=Zw(".picker_hue",i),this._domSL=Zw(".picker_sl",i),this._domA=Zw(".picker_alpha",i),this._domEdit=Zw(".picker_editor input",i),this._domSample=Zw(".picker_sample",i),this._domOkay=Zw(".picker_done button",i),this._domCancel=Zw(".picker_cancel button",i),i.classList.add("layout_"+this.settings.layout),this.settings.alpha||i.classList.add("no_alpha"),this.settings.editor||i.classList.add("no_editor"),this.settings.cancelButton||i.classList.add("no_cancel"),this._ifPopup((function(){return i.classList.add("popup")})),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var t=this,e=this,n=this.domElement,o=this._events;function i(t,e,n){o.add(t,e,n)}i(n,"click",(function(t){return t.preventDefault()})),Vw(o,this._domH,(function(t,n){return e._setHSLA(t)})),Vw(o,this._domSL,(function(t,n){return e._setHSLA(null,t,1-n)})),this.settings.alpha&&Vw(o,this._domA,(function(t,n){return e._setHSLA(null,null,null,1-n)}));var r=this._domEdit;i(r,"input",(function(t){e._setColor(this.value,{fromEditor:!0,failSilently:!0})})),i(r,"focus",(function(t){var e=this;e.selectionStart===e.selectionEnd&&e.select()})),this._ifPopup((function(){var e=function(e){return t.closeHandler(e)};i(window,qw,e),i(window,Kw,e),Jw(o,n,["Esc","Escape"],e);var r=function(e){t.__containedEvent=e.timeStamp};i(n,qw,r),i(n,Kw,r),i(t._domCancel,"click",e)}));var a=function(e){t._ifPopup((function(){return t.closeHandler(e)})),t.onDone&&t.onDone(t.colour)};i(this._domOkay,"click",a),Jw(o,n,["Enter"],a)}},{key:"_setPosition",value:function(){var t=this.settings.parent,e=this.domElement;t!==e.parentNode&&t.appendChild(e),this._ifPopup((function(n){"static"===getComputedStyle(t).position&&(t.style.position="relative");var o=!0===n?"popup_right":"popup_"+n;["popup_top","popup_bottom","popup_left","popup_right"].forEach((function(t){t===o?e.classList.add(t):e.classList.remove(t)})),e.classList.add(o)}))}},{key:"_setHSLA",value:function(t,e,n,o,i){i=i||{};var r=this.colour,a=r.hsla;[t,e,n,o].forEach((function(t,e){(t||0===t)&&(a[e]=t)})),r.hsla=a,this._updateUI(i),this.onChange&&!i.silent&&this.onChange(r)}},{key:"_updateUI",value:function(t){if(this.domElement){t=t||{};var e=this.colour,n=e.hsla,o="hsl("+360*n[0]+", 100%, 50%)",i=e.hslString,r=e.hslaString,a=this._domH,s=this._domSL,l=this._domA,u=Zw(".picker_selector",a),c=Zw(".picker_selector",s),d=Zw(".picker_selector",l);m(0,u,n[0]),this._domSL.style.backgroundColor=this._domH.style.color=o,m(0,c,n[1]),b(0,c,1-n[2]),s.style.color=i,b(0,d,1-n[3]);var h=i,p=h.replace("hsl","hsla").replace(")",", 0)"),f="linear-gradient("+[h,p]+")";if(this._domA.style.background=f+", linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,\n linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em",!t.fromEditor){var g=this.settings.editorFormat,v=this.settings.alpha,y=void 0;switch(g){case"rgb":y=e.printRGB(v);break;case"hsl":y=e.printHSL(v);break;default:y=e.printHex(v)}this._domEdit.value=y}this._domSample.style.color=r}function m(t,e,n){e.style.left=100*n+"%"}function b(t,e,n){e.style.top=100*n+"%"}}},{key:"_ifPopup",value:function(t,e){this.settings.parent&&this.settings.popup?t&&t(this.settings.popup):e&&e()}},{key:"_toggleDOM",value:function(t){var e=this.domElement;if(!e)return!1;var n=t?"":"none",o=e.style.display!==n;return o&&(e.style.display=n),o}}]),t}(),tS=document.createElement("style");tS.textContent='.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}',document.documentElement.firstElementChild.appendChild(tS),Qw.StyleElement=tS;var eS={},nS={get exports(){return eS},set exports(t){eS=t}};!function(t){t.exports=function(){var t="object",e="function",n="undefined",o=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],i=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],r=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],a=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"];function s(n,o){var i=typeof n[o];return i==e||!(i!=t||!n[o])||"unknown"==i}function l(e,n){return!(typeof e[n]!=t||!e[n])}function u(t,e){return typeof t[e]!=n}function c(t){return function(e,n){for(var o=n.length;o--;)if(!t(e,n[o]))return!1;return!0}}var d=c(s),h=c(l),p=c(u);function f(t){return t&&d(t,a)&&p(t,r)}function g(t){return l(t,"body")?t.body:t.getElementsByTagName("body")[0]}var v,y,m=[].forEach?function(t,e){t.forEach(e)}:function(t,e){for(var n=0,o=t.length;n<o;++n)e(t[n],n)},b={},x=typeof window!=n&&typeof document!=n,_={isHostMethod:s,isHostObject:l,isHostProperty:u,areHostMethods:d,areHostObjects:h,areHostProperties:p,isTextRange:f,getBody:g,forEach:m},E={version:"1.3.1",initialized:!1,isBrowser:x,supported:!0,util:_,features:{},modules:b,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==n||rangyAutoInitialize}};function w(t){typeof console!=n&&s(console,"log")&&console.log(t)}function S(t,e){x&&e?alert(t):w(t)}function C(t){E.initialized=!0,E.supported=!1,S("Rangy is not supported in this environment. Reason: "+t,E.config.alertOnFail)}function N(t){S("Rangy warning: "+t,E.config.alertOnWarn)}E.fail=C,E.warn=N,{}.hasOwnProperty?(_.extend=v=function(t,e,n){var o,i;for(var r in e)e.hasOwnProperty(r)&&(o=t[r],i=e[r],n&&null!==o&&"object"==typeof o&&null!==i&&"object"==typeof i&&v(o,i,!0),t[r]=i);return e.hasOwnProperty("toString")&&(t.toString=e.toString),t},_.createOptions=function(t,e){var n={};return v(n,e),t&&v(n,t),n}):C("hasOwnProperty not supported"),x||C("Rangy can only run in a browser"),function(){var t;if(x){var e=document.createElement("div");e.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(e.childNodes,0)[0].nodeType&&(t=function(t){return n.call(t,0)})}catch(t){}}t||(t=function(t){for(var e=[],n=0,o=t.length;n<o;++n)e[n]=t[n];return e}),_.toArray=t}(),x&&(s(document,"addEventListener")?y=function(t,e,n){t.addEventListener(e,n,!1)}:s(document,"attachEvent")?y=function(t,e,n){t.attachEvent("on"+e,n)}:C("Document does not have required addEventListener or attachEvent method"),_.addListener=y);var T=[];function A(t){return t.message||t.description||String(t)}function M(){if(x&&!E.initialized){var t,e=!1,n=!1;s(document,"createRange")&&(t=document.createRange(),d(t,i)&&p(t,o)&&(e=!0));var r=g(document);if(r&&"body"==r.nodeName.toLowerCase())if(r&&s(r,"createTextRange")&&f(t=r.createTextRange())&&(n=!0),e||n){var a;for(var l in E.initialized=!0,E.features={implementsDomRange:e,implementsTextRange:n},b)(a=b[l])instanceof D&&a.init(a,E);for(var u=0,c=T.length;u<c;++u)try{T[u](E)}catch(t){w("Rangy init listener threw an exception. Continuing. Detail: "+A(t))}}else C("Neither Range nor TextRange are available");else C("No body element found")}}function O(t,e,n){n&&(t+=" in module "+n.name),E.warn("DEPRECATED: "+t+" is deprecated. Please use "+e+" instead.")}function P(t,e,n,o){t[e]=function(){return O(e,n,o),t[n].apply(t,_.toArray(arguments))}}_.deprecationNotice=O,_.createAliasForDeprecatedMethod=P,E.init=M,E.addInitListener=function(t){E.initialized?t(E):T.push(t)};var k=[];function R(t){t=t||window,M();for(var e=0,n=k.length;e<n;++e)k[e](t)}function D(t,e,n){this.name=t,this.dependencies=e,this.initialized=!1,this.supported=!1,this.initializer=n}function L(t,e,n){var o=new D(t,e,(function(e){if(!e.initialized){e.initialized=!0;try{n(E,e),e.supported=!0}catch(e){w("Module '"+t+"' failed to load: "+A(e)),e.stack&&w(e.stack)}}}));return b[t]=o,o}function I(){}function j(){}E.addShimListener=function(t){k.push(t)},x&&(E.shim=E.createMissingNativeApi=R,P(E,"createMissingNativeApi","shim")),D.prototype={init:function(){for(var t,e,n=this.dependencies||[],o=0,i=n.length;o<i;++o){if(e=n[o],!((t=b[e])&&t instanceof D))throw new Error("required module '"+e+"' not found");if(t.init(),!t.supported)throw new Error("required module '"+e+"' not supported")}this.initializer(this)},fail:function(t){throw this.initialized=!0,this.supported=!1,new Error(t)},warn:function(t){E.warn("Module "+this.name+": "+t)},deprecationNotice:function(t,e){E.warn("DEPRECATED: "+t+" in module "+this.name+" is deprecated. Please use "+e+" instead")},createError:function(t){return new Error("Error in Rangy "+this.name+" module: "+t)}},E.createModule=function(t){var e,n;2==arguments.length?(e=arguments[1],n=[]):(e=arguments[2],n=arguments[1]);var o=L(t,n,e);E.initialized&&E.supported&&o.init()},E.createCoreModule=function(t,e,n){L(t,e,n)},E.RangePrototype=I,E.rangePrototype=new I,E.selectionPrototype=new j,E.createCoreModule("DomUtil",[],(function(t,e){var n="undefined",o=t.util,i=o.getBody;o.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||e.fail("document missing a Node creation method"),o.isHostMethod(document,"getElementsByTagName")||e.fail("document missing getElementsByTagName method");var r=document.createElement("div");o.areHostMethods(r,["insertBefore","appendChild","cloneNode"]||!o.areHostObjects(r,["previousSibling","nextSibling","childNodes","parentNode"]))||e.fail("Incomplete Element implementation"),o.isHostProperty(r,"innerHTML")||e.fail("Element is missing innerHTML property");var a=document.createTextNode("test");o.areHostMethods(a,["splitText","deleteData","insertData","appendData","cloneNode"]||!o.areHostObjects(r,["previousSibling","nextSibling","childNodes","parentNode"])||!o.areHostProperties(a,["data"]))||e.fail("Incomplete Text Node implementation");var s=function(t,e){for(var n=t.length;n--;)if(t[n]===e)return!0;return!1};function l(t){var e;return typeof t.namespaceURI==n||null===(e=t.namespaceURI)||"http://www.w3.org/1999/xhtml"==e}function u(t){var e=t.parentNode;return 1==e.nodeType?e:null}function c(t){for(var e=0;t=t.previousSibling;)++e;return e}function d(t){switch(t.nodeType){case 7:case 10:return 0;case 3:case 8:return t.length;default:return t.childNodes.length}}function h(t,e){var n,o=[];for(n=t;n;n=n.parentNode)o.push(n);for(n=e;n;n=n.parentNode)if(s(o,n))return n;return null}function p(t,e,n){for(var o=n?e:e.parentNode;o;){if(o===t)return!0;o=o.parentNode}return!1}function f(t,e){return p(t,e,!0)}function g(t,e,n){for(var o,i=n?t:t.parentNode;i;){if((o=i.parentNode)===e)return i;i=o}return null}function v(t){var e=t.nodeType;return 3==e||4==e||8==e}function y(t){if(!t)return!1;var e=t.nodeType;return 3==e||8==e}function m(t,e){var n=e.nextSibling,o=e.parentNode;return n?o.insertBefore(t,n):o.appendChild(t),t}function b(t,e,n){var o=t.cloneNode(!1);if(o.deleteData(0,e),t.deleteData(e,t.length-e),m(o,t),n)for(var i,r=0;i=n[r++];)i.node==t&&i.offset>e?(i.node=o,i.offset-=e):i.node==t.parentNode&&i.offset>c(t)&&++i.offset;return o}function x(t){if(9==t.nodeType)return t;if(typeof t.ownerDocument!=n)return t.ownerDocument;if(typeof t.document!=n)return t.document;if(t.parentNode)return x(t.parentNode);throw e.createError("getDocument: no document found for node")}function _(t){var o=x(t);if(typeof o.defaultView!=n)return o.defaultView;if(typeof o.parentWindow!=n)return o.parentWindow;throw e.createError("Cannot get a window object for node")}function E(t){if(typeof t.contentDocument!=n)return t.contentDocument;if(typeof t.contentWindow!=n)return t.contentWindow.document;throw e.createError("getIframeDocument: No Document object found for iframe element")}function w(t){if(typeof t.contentWindow!=n)return t.contentWindow;if(typeof t.contentDocument!=n)return t.contentDocument.defaultView;throw e.createError("getIframeWindow: No Window object found for iframe element")}function S(t){return t&&o.isHostMethod(t,"setTimeout")&&o.isHostObject(t,"document")}function C(t,e,n){var i;if(t?o.isHostProperty(t,"nodeType")?i=1==t.nodeType&&"iframe"==t.tagName.toLowerCase()?E(t):x(t):S(t)&&(i=t.document):i=document,!i)throw e.createError(n+"(): Parameter must be a Window object or DOM node");return i}function N(t){for(var e;e=t.parentNode;)t=e;return t}function T(t,n,o,i){var r,a,s,l,u;if(t==o)return n===i?0:n<i?-1:1;if(r=g(o,t,!0))return n<=c(r)?-1:1;if(r=g(t,o,!0))return c(r)<i?-1:1;if(!(a=h(t,o)))throw new Error("comparePoints error: nodes have no common ancestor");if((s=t===a?a:g(t,a,!0))===(l=o===a?a:g(o,a,!0)))throw e.createError("comparePoints got to case 4 and childA and childB are the same!");for(u=a.firstChild;u;){if(u===s)return-1;if(u===l)return 1;u=u.nextSibling}}var A,M=!1;function O(t){try{return t.parentNode,!1}catch(t){return!0}}function P(t){if(!t)return"[No node]";if(M&&O(t))return"[Broken node]";if(v(t))return'"'+t.data+'"';if(1==t.nodeType){var e=t.id?' id="'+t.id+'"':"";return"<"+t.nodeName+e+">[index:"+c(t)+",length:"+t.childNodes.length+"]["+(t.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return t.nodeName}function k(t){for(var e,n=x(t).createDocumentFragment();e=t.firstChild;)n.appendChild(e);return n}function R(t,e,n){var o=i(t),r=t.createElement("div");r.contentEditable=""+!!n,e&&(r.innerHTML=e);var a=o.firstChild;return a?o.insertBefore(r,a):o.appendChild(r),r}function D(t){return t.parentNode.removeChild(t)}function L(t){this.root=t,this._next=t}function I(t){return new L(t)}function j(t,e){this.node=t,this.offset=e}function B(t){this.code=this[t],this.codeName=t,this.message="DOMException: "+this.codeName}!function(){var e=document.createElement("b");e.innerHTML="1";var n=e.firstChild;e.innerHTML="<br />",M=O(n),t.features.crashyTextNodes=M}(),typeof window.getComputedStyle!=n?A=function(t,e){return _(t).getComputedStyle(t,null)[e]}:typeof document.documentElement.currentStyle!=n?A=function(t,e){return t.currentStyle?t.currentStyle[e]:""}:e.fail("No means of obtaining computed style properties found"),L.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var t,e,n=this._current=this._next;if(this._current)if(t=n.firstChild)this._next=t;else{for(e=null;n!==this.root&&!(e=n.nextSibling);)n=n.parentNode;this._next=e}return this._current},detach:function(){this._current=this._next=this.root=null}},j.prototype={equals:function(t){return!!t&&this.node===t.node&&this.offset==t.offset},inspect:function(){return"[DomPosition("+P(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},B.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},B.prototype.toString=function(){return this.message},t.dom={arrayContains:s,isHtmlNamespace:l,parentElement:u,getNodeIndex:c,getNodeLength:d,getCommonAncestor:h,isAncestorOf:p,isOrIsAncestorOf:f,getClosestAncestorIn:g,isCharacterDataNode:v,isTextOrCommentNode:y,insertAfter:m,splitDataNode:b,getDocument:x,getWindow:_,getIframeWindow:w,getIframeDocument:E,getBody:i,isWindow:S,getContentDocument:C,getRootContainer:N,comparePoints:T,isBrokenNode:O,inspectNode:P,getComputedStyleProperty:A,createTestElement:R,removeNode:D,fragmentFromNodeChildren:k,createIterator:I,DomPosition:j},t.DOMException=B})),E.createCoreModule("DomRange",["DomUtil"],(function(t,e){var n=t.dom,o=t.util,i=n.DomPosition,r=t.DOMException,a=n.isCharacterDataNode,s=n.getNodeIndex,l=n.isOrIsAncestorOf,u=n.getDocument,c=n.comparePoints,d=n.splitDataNode,h=n.getClosestAncestorIn,p=n.getNodeLength,f=n.arrayContains,g=n.getRootContainer,v=t.features.crashyTextNodes,y=n.removeNode;function m(t,e){return 3!=t.nodeType&&(l(t,e.startContainer)||l(t,e.endContainer))}function b(t){return t.document||u(t.startContainer)}function x(t){return g(t.startContainer)}function _(t){return new i(t.parentNode,s(t))}function E(t){return new i(t.parentNode,s(t)+1)}function w(t,e,o){var i=11==t.nodeType?t.firstChild:t;return a(e)?o==e.length?n.insertAfter(t,e):e.parentNode.insertBefore(t,0==o?e:d(e,o)):o>=e.childNodes.length?e.appendChild(t):e.insertBefore(t,e.childNodes[o]),i}function S(t,e,n){if(Z(t),Z(e),b(e)!=b(t))throw new r("WRONG_DOCUMENT_ERR");var o=c(t.startContainer,t.startOffset,e.endContainer,e.endOffset),i=c(t.endContainer,t.endOffset,e.startContainer,e.startOffset);return n?o<=0&&i>=0:o<0&&i>0}function C(t){for(var e,n,o,i=b(t.range).createDocumentFragment();n=t.next();){if(e=t.isPartiallySelectedSubtree(),n=n.cloneNode(!e),e&&(o=t.getSubtreeIterator(),n.appendChild(C(o)),o.detach()),10==n.nodeType)throw new r("HIERARCHY_REQUEST_ERR");i.appendChild(n)}return i}function N(t,e,o){var i,r,a,s;for(o=o||{stop:!1};a=t.next();)if(t.isPartiallySelectedSubtree()){if(!1===e(a))return void(o.stop=!0);if(N(s=t.getSubtreeIterator(),e,o),s.detach(),o.stop)return}else for(i=n.createIterator(a);r=i.next();)if(!1===e(r))return void(o.stop=!0)}function T(t){for(var e;t.next();)t.isPartiallySelectedSubtree()?(T(e=t.getSubtreeIterator()),e.detach()):t.remove()}function A(t){for(var e,n,o=b(t.range).createDocumentFragment();e=t.next();){if(t.isPartiallySelectedSubtree()?(e=e.cloneNode(!1),n=t.getSubtreeIterator(),e.appendChild(A(n)),n.detach()):t.remove(),10==e.nodeType)throw new r("HIERARCHY_REQUEST_ERR");o.appendChild(e)}return o}function M(t,e,n){var o,i=!(!e||!e.length),r=!!n;i&&(o=new RegExp("^("+e.join("|")+")$"));var s=[];return N(new P(t,!1),(function(e){if((!i||o.test(e.nodeType))&&(!r||n(e))){var l=t.startContainer;if(e!=l||!a(l)||t.startOffset!=l.length){var u=t.endContainer;e==u&&a(u)&&0==t.endOffset||s.push(e)}}})),s}function O(t){return"["+(void 0===t.getName?"Range":t.getName())+"("+n.inspectNode(t.startContainer)+":"+t.startOffset+", "+n.inspectNode(t.endContainer)+":"+t.endOffset+")]"}function P(t,e){if(this.range=t,this.clonePartiallySelectedTextNodes=e,!t.collapsed){this.sc=t.startContainer,this.so=t.startOffset,this.ec=t.endContainer,this.eo=t.endOffset;var n=t.commonAncestorContainer;this.sc===this.ec&&a(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||a(this.sc)?h(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||a(this.ec)?h(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}P.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=null,this._next=this._first},hasNext:function(){return!!this._next},next:function(){var t=this._current=this._next;return t&&(this._next=t!==this._last?t.nextSibling:null,a(t)&&this.clonePartiallySelectedTextNodes&&(t===this.ec&&(t=t.cloneNode(!0)).deleteData(this.eo,t.length-this.eo),this._current===this.sc&&(t=t.cloneNode(!0)).deleteData(0,this.so))),t},remove:function(){var t,e,n=this._current;!a(n)||n!==this.sc&&n!==this.ec?n.parentNode&&y(n):(t=n===this.sc?this.so:0)!=(e=n===this.ec?this.eo:n.length)&&n.deleteData(t,e-t)},isPartiallySelectedSubtree:function(){return m(this._current,this.range)},getSubtreeIterator:function(){var t;if(this.isSingleCharacterDataNode)(t=this.range.cloneRange()).collapse(!1);else{t=new yt(b(this.range));var e=this._current,n=e,o=0,i=e,r=p(e);l(e,this.sc)&&(n=this.sc,o=this.so),l(e,this.ec)&&(i=this.ec,r=this.eo),vt(t,n,o,i,r)}return new P(t,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};var k=[1,3,4,5,7,8,10],R=[2,9,11],D=[5,6,10,12],L=[1,3,4,5,7,8,10,11],I=[1,3,4,5,7,8];function j(t){return function(e,n){for(var o,i=n?e:e.parentNode;i;){if(o=i.nodeType,f(t,o))return i;i=i.parentNode}return null}}var B=j([9,11]),H=j(D),F=j([6,10,12]),z=j([1]);function W(t,e){if(F(t,e))throw new r("INVALID_NODE_TYPE_ERR")}function G(t,e){if(!f(e,t.nodeType))throw new r("INVALID_NODE_TYPE_ERR")}function U(t,e){if(e<0||e>(a(t)?t.length:t.childNodes.length))throw new r("INDEX_SIZE_ERR")}function X(t,e){if(B(t,!0)!==B(e,!0))throw new r("WRONG_DOCUMENT_ERR")}function V(t){if(H(t,!0))throw new r("NO_MODIFICATION_ALLOWED_ERR")}function Y(t,e){if(!t)throw new r(e)}function q(t,e){return e<=(a(t)?t.length:t.childNodes.length)}function K(t){return!!t.startContainer&&!!t.endContainer&&!(v&&(n.isBrokenNode(t.startContainer)||n.isBrokenNode(t.endContainer)))&&g(t.startContainer)==g(t.endContainer)&&q(t.startContainer,t.startOffset)&&q(t.endContainer,t.endOffset)}function Z(t){if(!K(t))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+t.inspect()+")")}var $=document.createElement("style"),J=!1;try{$.innerHTML="<b>x</b>",J=3==$.firstChild.nodeType}catch(t){}t.features.htmlParsingConforms=J;var Q=J?function(t){var e=this.startContainer,o=u(e);if(!e)throw new r("INVALID_STATE_ERR");var i=null;return 1==e.nodeType?i=e:a(e)&&(i=n.parentElement(e)),(i=null===i||"HTML"==i.nodeName&&n.isHtmlNamespace(u(i).documentElement)&&n.isHtmlNamespace(i)?o.createElement("body"):i.cloneNode(!1)).innerHTML=t,n.fragmentFromNodeChildren(i)}:function(t){var e=b(this).createElement("body");return e.innerHTML=t,n.fragmentFromNodeChildren(e)};function tt(t,e){Z(t);var n=t.startContainer,o=t.startOffset,i=t.endContainer,r=t.endOffset,l=n===i;a(i)&&r>0&&r<i.length&&d(i,r,e),a(n)&&o>0&&o<n.length&&(n=d(n,o,e),l?(r-=o,i=n):i==n.parentNode&&r>=s(n)&&r++,o=0),t.setStartAndEnd(n,o,i,r)}function et(t){Z(t);var e=t.commonAncestorContainer.parentNode.cloneNode(!1);return e.appendChild(t.cloneContents()),e.innerHTML}var nt=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ot=0,it=1,rt=2,at=3,st=0,lt=1,ut=2,ct=3;function dt(t){t.START_TO_START=ot,t.START_TO_END=it,t.END_TO_END=rt,t.END_TO_START=at,t.NODE_BEFORE=st,t.NODE_AFTER=lt,t.NODE_BEFORE_AND_AFTER=ut,t.NODE_INSIDE=ct}function ht(t){dt(t),dt(t.prototype)}function pt(t,e){return function(){Z(this);var n,o=this.startContainer,i=this.startOffset,r=this.commonAncestorContainer,a=new P(this,!0);o!==r&&(o=(n=E(h(o,r,!0))).node,i=n.offset),N(a,V),a.reset();var s=t(a);return a.detach(),e(this,o,i,o,i),s}}function ft(e,n){function i(t,e){return function(n){G(n,k),G(g(n),R);var o=(t?_:E)(n);(e?r:l)(this,o.node,o.offset)}}function r(t,e,o){var i=t.endContainer,r=t.endOffset;e===t.startContainer&&o===t.startOffset||(g(e)==g(i)&&1!=c(e,o,i,r)||(i=e,r=o),n(t,e,o,i,r))}function l(t,e,o){var i=t.startContainer,r=t.startOffset;e===t.endContainer&&o===t.endOffset||(g(e)==g(i)&&-1!=c(e,o,i,r)||(i=e,r=o),n(t,i,r,e,o))}var u=function(){};u.prototype=t.rangePrototype,e.prototype=new u,o.extend(e.prototype,{setStart:function(t,e){W(t,!0),U(t,e),r(this,t,e)},setEnd:function(t,e){W(t,!0),U(t,e),l(this,t,e)},setStartAndEnd:function(){var t=arguments,e=t[0],o=t[1],i=e,r=o;switch(t.length){case 3:r=t[2];break;case 4:i=t[2],r=t[3]}W(e,!0),U(e,o),W(i,!0),U(i,r),n(this,e,o,i,r)},setBoundary:function(t,e,n){this["set"+(n?"Start":"End")](t,e)},setStartBefore:i(!0,!0),setStartAfter:i(!1,!0),setEndBefore:i(!0,!1),setEndAfter:i(!1,!1),collapse:function(t){Z(this),t?n(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):n(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(t){W(t,!0),n(this,t,0,t,p(t))},selectNode:function(t){W(t,!1),G(t,k);var e=_(t),o=E(t);n(this,e.node,e.offset,o.node,o.offset)},extractContents:pt(A,n),deleteContents:pt(T,n),canSurroundContents:function(){Z(this),V(this.startContainer),V(this.endContainer);var t=new P(this,!0),e=t._first&&m(t._first,this)||t._last&&m(t._last,this);return t.detach(),!e},splitBoundaries:function(){tt(this)},splitBoundariesPreservingPositions:function(t){tt(this,t)},normalizeBoundaries:function(){Z(this);var t,e=this.startContainer,o=this.startOffset,i=this.endContainer,r=this.endOffset,l=function(t){var e=t.nextSibling;e&&e.nodeType==t.nodeType&&(i=t,r=t.length,t.appendData(e.data),y(e))},u=function(t){var n=t.previousSibling;if(n&&n.nodeType==t.nodeType){e=t;var a=t.length;if(o=n.length,t.insertData(0,n.data),y(n),e==i)r+=o,i=e;else if(i==t.parentNode){var l=s(t);r==l?(i=t,r=a):r>l&&r--}}},c=!0;if(a(i))r==i.length?l(i):0==r&&(t=i.previousSibling)&&t.nodeType==i.nodeType&&(r=t.length,e==i&&(c=!1),t.appendData(i.data),y(i),i=t);else{if(r>0){var d=i.childNodes[r-1];d&&a(d)&&l(d)}c=!this.collapsed}if(c){if(a(e))0==o?u(e):o==e.length&&(t=e.nextSibling)&&t.nodeType==e.nodeType&&(i==t&&(i=e,r+=e.length),e.appendData(t.data),y(t));else if(o<e.childNodes.length){var h=e.childNodes[o];h&&a(h)&&u(h)}}else e=i,o=r;n(this,e,o,i,r)},collapseToPoint:function(t,e){W(t,!0),U(t,e),this.setStartAndEnd(t,e)},parentElement:function(){return Z(this),this.commonAncestorContainer?z(this.commonAncestorContainer,!0):null}}),ht(e)}function gt(t){t.collapsed=t.startContainer===t.endContainer&&t.startOffset===t.endOffset,t.commonAncestorContainer=t.collapsed?t.startContainer:n.getCommonAncestor(t.startContainer,t.endContainer)}function vt(t,e,o,i,r){t.startContainer=e,t.startOffset=o,t.endContainer=i,t.endOffset=r,t.document=n.getDocument(e),gt(t)}function yt(t){vt(this,t,0,t,0)}o.extend(t.rangePrototype,{compareBoundaryPoints:function(t,e){var n,o,i,r;Z(this),X(this.startContainer,e.startContainer);var a=t==at||t==ot?"start":"end",s=t==it||t==ot?"start":"end";return n=this[a+"Container"],o=this[a+"Offset"],i=e[s+"Container"],r=e[s+"Offset"],c(n,o,i,r)},insertNode:function(t){if(Z(this),G(t,L),V(this.startContainer),l(t,this.startContainer))throw new r("HIERARCHY_REQUEST_ERR");var e=w(t,this.startContainer,this.startOffset);this.setStartBefore(e)},cloneContents:function(){var t,e;if(Z(this),this.collapsed)return b(this).createDocumentFragment();if(this.startContainer===this.endContainer&&a(this.startContainer))return(t=this.startContainer.cloneNode(!0)).data=t.data.slice(this.startOffset,this.endOffset),(e=b(this).createDocumentFragment()).appendChild(t),e;var n=new P(this,!0);return t=C(n),n.detach(),t},canSurroundContents:function(){Z(this),V(this.startContainer),V(this.endContainer);var t=new P(this,!0),e=t._first&&m(t._first,this)||t._last&&m(t._last,this);return t.detach(),!e},surroundContents:function(t){if(G(t,I),!this.canSurroundContents())throw new r("INVALID_STATE_ERR");var e=this.extractContents();if(t.hasChildNodes())for(;t.lastChild;)t.removeChild(t.lastChild);w(t,this.startContainer,this.startOffset),t.appendChild(e),this.selectNode(t)},cloneRange:function(){Z(this);for(var t,e=new yt(b(this)),n=nt.length;n--;)e[t=nt[n]]=this[t];return e},toString:function(){Z(this);var t=this.startContainer;if(t===this.endContainer&&a(t))return 3==t.nodeType||4==t.nodeType?t.data.slice(this.startOffset,this.endOffset):"";var e=[],n=new P(this,!0);return N(n,(function(t){3!=t.nodeType&&4!=t.nodeType||e.push(t.data)})),n.detach(),e.join("")},compareNode:function(t){Z(this);var e=t.parentNode,n=s(t);if(!e)throw new r("NOT_FOUND_ERR");var o=this.comparePoint(e,n),i=this.comparePoint(e,n+1);return o<0?i>0?ut:st:i>0?lt:ct},comparePoint:function(t,e){return Z(this),Y(t,"HIERARCHY_REQUEST_ERR"),X(t,this.startContainer),c(t,e,this.startContainer,this.startOffset)<0?-1:c(t,e,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:Q,toHtml:function(){return et(this)},intersectsNode:function(t,e){if(Z(this),g(t)!=x(this))return!1;var n=t.parentNode,o=s(t);if(!n)return!0;var i=c(n,o,this.endContainer,this.endOffset),r=c(n,o+1,this.startContainer,this.startOffset);return e?i<=0&&r>=0:i<0&&r>0},isPointInRange:function(t,e){return Z(this),Y(t,"HIERARCHY_REQUEST_ERR"),X(t,this.startContainer),c(t,e,this.startContainer,this.startOffset)>=0&&c(t,e,this.endContainer,this.endOffset)<=0},intersectsRange:function(t){return S(this,t,!1)},intersectsOrTouchesRange:function(t){return S(this,t,!0)},intersection:function(t){if(this.intersectsRange(t)){var e=c(this.startContainer,this.startOffset,t.startContainer,t.startOffset),n=c(this.endContainer,this.endOffset,t.endContainer,t.endOffset),o=this.cloneRange();return-1==e&&o.setStart(t.startContainer,t.startOffset),1==n&&o.setEnd(t.endContainer,t.endOffset),o}return null},union:function(t){if(this.intersectsOrTouchesRange(t)){var e=this.cloneRange();return-1==c(t.startContainer,t.startOffset,this.startContainer,this.startOffset)&&e.setStart(t.startContainer,t.startOffset),1==c(t.endContainer,t.endOffset,this.endContainer,this.endOffset)&&e.setEnd(t.endContainer,t.endOffset),e}throw new r("Ranges do not intersect")},containsNode:function(t,e){return e?this.intersectsNode(t,!1):this.compareNode(t)==ct},containsNodeContents:function(t){return this.comparePoint(t,0)>=0&&this.comparePoint(t,p(t))<=0},containsRange:function(t){var e=this.intersection(t);return null!==e&&t.equals(e)},containsNodeText:function(t){var e=this.cloneRange();e.selectNode(t);var n=e.getNodes([3]);if(n.length>0){e.setStart(n[0],0);var o=n.pop();return e.setEnd(o,o.length),this.containsRange(e)}return this.containsNodeContents(t)},getNodes:function(t,e){return Z(this),M(this,t,e)},getDocument:function(){return b(this)},collapseBefore:function(t){this.setEndBefore(t),this.collapse(!1)},collapseAfter:function(t){this.setStartAfter(t),this.collapse(!0)},getBookmark:function(e){var o=b(this),i=t.createRange(o);e=e||n.getBody(o),i.selectNodeContents(e);var r=this.intersection(i),a=0,s=0;return r&&(i.setEnd(r.startContainer,r.startOffset),s=(a=i.toString().length)+r.toString().length),{start:a,end:s,containerNode:e}},moveToBookmark:function(t){var e=t.containerNode,n=0;this.setStart(e,0),this.collapse(!0);for(var o,i,r,a,s=[e],l=!1,u=!1;!u&&(o=s.pop());)if(3==o.nodeType)i=n+o.length,!l&&t.start>=n&&t.start<=i&&(this.setStart(o,t.start-n),l=!0),l&&t.end>=n&&t.end<=i&&(this.setEnd(o,t.end-n),u=!0),n=i;else for(r=(a=o.childNodes).length;r--;)s.push(a[r])},getName:function(){return"DomRange"},equals:function(t){return yt.rangesEqual(this,t)},isValid:function(){return K(this)},inspect:function(){return O(this)},detach:function(){}}),ft(yt,vt),o.extend(yt,{rangeProperties:nt,RangeIterator:P,copyComparisonConstants:ht,createPrototypeRange:ft,inspect:O,toHtml:et,getRangeDocument:b,rangesEqual:function(t,e){return t.startContainer===e.startContainer&&t.startOffset===e.startOffset&&t.endContainer===e.endContainer&&t.endOffset===e.endOffset}}),t.DomRange=yt})),E.createCoreModule("WrappedRange",["DomRange"],(function(t,e){var n,o,i=t.dom,r=t.util,a=i.DomPosition,s=t.DomRange,l=i.getBody,u=i.getContentDocument,c=i.isCharacterDataNode;if(t.features.implementsDomRange&&function(){var o,a,c=s.rangeProperties;function d(t){for(var e,n=c.length;n--;)t[e=c[n]]=t.nativeRange[e];t.collapsed=t.startContainer===t.endContainer&&t.startOffset===t.endOffset}function h(t,e,n,o,i){var r=t.startContainer!==e||t.startOffset!=n,a=t.endContainer!==o||t.endOffset!=i,s=!t.equals(t.nativeRange);(r||a||s)&&(t.setEnd(o,i),t.setStart(e,n))}n=function(t){if(!t)throw e.createError("WrappedRange: Range must be specified");this.nativeRange=t,d(this)},s.createPrototypeRange(n,h),(o=n.prototype).selectNode=function(t){this.nativeRange.selectNode(t),d(this)},o.cloneContents=function(){return this.nativeRange.cloneContents()},o.surroundContents=function(t){this.nativeRange.surroundContents(t),d(this)},o.collapse=function(t){this.nativeRange.collapse(t),d(this)},o.cloneRange=function(){return new n(this.nativeRange.cloneRange())},o.refresh=function(){d(this)},o.toString=function(){return this.nativeRange.toString()};var p=document.createTextNode("test");l(document).appendChild(p);var f=document.createRange();f.setStart(p,0),f.setEnd(p,0);try{f.setStart(p,1),o.setStart=function(t,e){this.nativeRange.setStart(t,e),d(this)},o.setEnd=function(t,e){this.nativeRange.setEnd(t,e),d(this)},a=function(t){return function(e){this.nativeRange[t](e),d(this)}}}catch(t){o.setStart=function(t,e){try{this.nativeRange.setStart(t,e)}catch(n){this.nativeRange.setEnd(t,e),this.nativeRange.setStart(t,e)}d(this)},o.setEnd=function(t,e){try{this.nativeRange.setEnd(t,e)}catch(n){this.nativeRange.setStart(t,e),this.nativeRange.setEnd(t,e)}d(this)},a=function(t,e){return function(n){try{this.nativeRange[t](n)}catch(o){this.nativeRange[e](n),this.nativeRange[t](n)}d(this)}}}o.setStartBefore=a("setStartBefore","setEndBefore"),o.setStartAfter=a("setStartAfter","setEndAfter"),o.setEndBefore=a("setEndBefore","setStartBefore"),o.setEndAfter=a("setEndAfter","setStartAfter"),o.selectNodeContents=function(t){this.setStartAndEnd(t,0,i.getNodeLength(t))},f.selectNodeContents(p),f.setEnd(p,3);var g=document.createRange();g.selectNodeContents(p),g.setEnd(p,4),g.setStart(p,2),-1==f.compareBoundaryPoints(f.START_TO_END,g)&&1==f.compareBoundaryPoints(f.END_TO_START,g)?o.compareBoundaryPoints=function(t,e){return t==(e=e.nativeRange||e).START_TO_END?t=e.END_TO_START:t==e.END_TO_START&&(t=e.START_TO_END),this.nativeRange.compareBoundaryPoints(t,e)}:o.compareBoundaryPoints=function(t,e){return this.nativeRange.compareBoundaryPoints(t,e.nativeRange||e)};var v=document.createElement("div");v.innerHTML="123";var y=v.firstChild,m=l(document);m.appendChild(v),f.setStart(y,1),f.setEnd(y,2),f.deleteContents(),"13"==y.data&&(o.deleteContents=function(){this.nativeRange.deleteContents(),d(this)},o.extractContents=function(){var t=this.nativeRange.extractContents();return d(this),t}),m.removeChild(v),m=null,r.isHostMethod(f,"createContextualFragment")&&(o.createContextualFragment=function(t){return this.nativeRange.createContextualFragment(t)}),l(document).removeChild(p),o.getName=function(){return"WrappedRange"},t.WrappedRange=n,t.createNativeRange=function(t){return(t=u(t,e,"createNativeRange")).createRange()}}(),t.features.implementsTextRange){var d=function(t){var e=t.parentElement(),n=t.duplicate();n.collapse(!0);var o=n.parentElement();(n=t.duplicate()).collapse(!1);var r=n.parentElement(),a=o==r?o:i.getCommonAncestor(o,r);return a==e?a:i.getCommonAncestor(e,a)},h=function(t){return 0==t.compareEndPoints("StartToEnd",t)},p=function(t,e,n,o,r){var s=t.duplicate();s.collapse(n);var l=s.parentElement();if(i.isOrIsAncestorOf(e,l)||(l=e),!l.canHaveHTML){var u=new a(l.parentNode,i.getNodeIndex(l));return{boundaryPosition:u,nodeInfo:{nodeIndex:u.offset,containerElement:u.node}}}var d=i.getDocument(l).createElement("span");d.parentNode&&i.removeNode(d);for(var h,p,f,g,v,y=n?"StartToStart":"StartToEnd",m=r&&r.containerElement==l?r.nodeIndex:0,b=l.childNodes.length,x=b,_=x;_==b?l.appendChild(d):l.insertBefore(d,l.childNodes[_]),s.moveToElementText(d),0!=(h=s.compareEndPoints(y,t))&&m!=x;){if(-1==h){if(x==m+1)break;m=_}else x=x==m+1?m:_;_=Math.floor((m+x)/2),l.removeChild(d)}if(v=d.nextSibling,-1==h&&v&&c(v)){var E;if(s.setEndPoint(n?"EndToStart":"EndToEnd",t),/[\r\n]/.test(v.data)){var w=s.duplicate(),S=w.text.replace(/\r\n/g,"\r").length;for(E=w.moveStart("character",S);-1==(h=w.compareEndPoints("StartToEnd",w));)E++,w.moveStart("character",1)}else E=s.text.length;g=new a(v,E)}else p=(o||!n)&&d.previousSibling,g=(f=(o||n)&&d.nextSibling)&&c(f)?new a(f,0):p&&c(p)?new a(p,p.data.length):new a(l,i.getNodeIndex(d));return i.removeNode(d),{boundaryPosition:g,nodeInfo:{nodeIndex:_,containerElement:l}}},f=function(t,e){var n,o,r,a,s=t.offset,u=i.getDocument(t.node),d=l(u).createTextRange(),h=c(t.node);return h?o=(n=t.node).parentNode:(n=s<(a=t.node.childNodes).length?a[s]:null,o=t.node),(r=u.createElement("span")).innerHTML="&#feff;",n?o.insertBefore(r,n):o.appendChild(r),d.moveToElementText(r),d.collapse(!e),o.removeChild(r),h&&d[e?"moveStart":"moveEnd"]("character",s),d};(o=function(t){this.textRange=t,this.refresh()}).prototype=new s(document),o.prototype.refresh=function(){var t,e,n,o=d(this.textRange);h(this.textRange)?e=t=p(this.textRange,o,!0,!0).boundaryPosition:(t=(n=p(this.textRange,o,!0,!1)).boundaryPosition,e=p(this.textRange,o,!1,!1,n.nodeInfo).boundaryPosition),this.setStart(t.node,t.offset),this.setEnd(e.node,e.offset)},o.prototype.getName=function(){return"WrappedTextRange"},s.copyComparisonConstants(o);var g=function(t){if(t.collapsed)return f(new a(t.startContainer,t.startOffset),!0);var e=f(new a(t.startContainer,t.startOffset),!0),n=f(new a(t.endContainer,t.endOffset),!1),o=l(s.getRangeDocument(t)).createTextRange();return o.setEndPoint("StartToStart",e),o.setEndPoint("EndToEnd",n),o};if(o.rangeToTextRange=g,o.prototype.toTextRange=function(){return g(this)},t.WrappedTextRange=o,!t.features.implementsDomRange||t.config.preferTextRange){var v=Function("return this;")();void 0===v.Range&&(v.Range=o),t.createNativeRange=function(t){return t=u(t,e,"createNativeRange"),l(t).createTextRange()},t.WrappedRange=o}}t.createRange=function(n){return n=u(n,e,"createRange"),new t.WrappedRange(t.createNativeRange(n))},t.createRangyRange=function(t){return t=u(t,e,"createRangyRange"),new s(t)},r.createAliasForDeprecatedMethod(t,"createIframeRange","createRange"),r.createAliasForDeprecatedMethod(t,"createIframeRangyRange","createRangyRange"),t.addShimListener((function(e){var n=e.document;void 0===n.createRange&&(n.createRange=function(){return t.createRange(n)}),n=e=null}))})),E.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],(function(t,e){t.config.checkSelectionRanges=!0;var n,o,i="boolean",r="number",a=t.dom,s=t.util,l=s.isHostMethod,u=t.DomRange,c=t.WrappedRange,d=t.DOMException,h=a.DomPosition,p=t.features,f="Control",g=a.getDocument,v=a.getBody,y=u.rangesEqual;function m(t){return"string"==typeof t?/^backward(s)?$/i.test(t):!!t}function b(t,n){if(t){if(a.isWindow(t))return t;if(t instanceof Z)return t.win;var o=a.getContentDocument(t,e,n);return a.getWindow(o)}return window}function x(t){return b(t,"getWinSelection").getSelection()}function _(t){return b(t,"getDocSelection").document.selection}function E(t){var e=!1;return t.anchorNode&&(e=1==a.comparePoints(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)),e}var w=l(window,"getSelection"),S=s.isHostObject(document,"selection");p.implementsWinGetSelection=w,p.implementsDocSelection=S;var C=S&&(!w||t.config.preferTextRange);if(C)n=_,t.isSelectionValid=function(t){var e=b(t,"isSelectionValid").document,n=e.selection;return"None"!=n.type||g(n.createRange().parentElement())==e};else{if(!w)return e.fail("Neither document.selection or window.getSelection() detected."),!1;n=x,t.isSelectionValid=function(){return!0}}t.getNativeSelection=n;var N=n();if(!N)return e.fail("Native selection was null (possibly issue 138?)"),!1;var T=t.createNativeRange(document),A=v(document),M=s.areHostProperties(N,["anchorNode","focusNode","anchorOffset","focusOffset"]);p.selectionHasAnchorAndFocus=M;var O=l(N,"extend");p.selectionHasExtend=O;var P=l(N,"setBaseAndExtent");p.selectionHasSetBaseAndExtent=P;var k=typeof N.rangeCount==r;p.selectionHasRangeCount=k;var R=!1,D=!0,L=O?function(e,n){var o=u.getRangeDocument(n),i=t.createRange(o);i.collapseToPoint(n.endContainer,n.endOffset),e.addRange(G(i)),e.extend(n.startContainer,n.startOffset)}:null;s.areHostMethods(N,["addRange","getRangeAt","removeAllRanges"])&&typeof N.rangeCount==r&&p.implementsDomRange&&function(){var e=window.getSelection();if(e){for(var n=e.rangeCount,o=n>1,i=[],r=E(e),s=0;s<n;++s)i[s]=e.getRangeAt(s);var l=a.createTestElement(document,"",!1),u=l.appendChild(document.createTextNode("   ")),c=document.createRange();if(c.setStart(u,1),c.collapse(!0),e.removeAllRanges(),e.addRange(c),D=1==e.rangeCount,e.removeAllRanges(),!o){var d=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(d&&parseInt(d[1])>=36)R=!1;else{var h=c.cloneRange();c.setStart(u,0),h.setEnd(u,3),h.setStart(u,2),e.addRange(c),e.addRange(h),R=2==e.rangeCount}}for(a.removeNode(l),e.removeAllRanges(),s=0;s<n;++s)0==s&&r?L?L(e,i[s]):(t.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),e.addRange(i[s])):e.addRange(i[s])}}(),p.selectionSupportsMultipleRanges=R,p.collapsedNonEditableSelectionsSupported=D;var I,j,B=!1;function H(t,e,n){var o=n?"end":"start",i=n?"start":"end";t.anchorNode=e[o+"Container"],t.anchorOffset=e[o+"Offset"],t.focusNode=e[i+"Container"],t.focusOffset=e[i+"Offset"]}function F(t){var e=t.nativeSelection;t.anchorNode=e.anchorNode,t.anchorOffset=e.anchorOffset,t.focusNode=e.focusNode,t.focusOffset=e.focusOffset}function z(t){t.anchorNode=t.focusNode=null,t.anchorOffset=t.focusOffset=0,t.rangeCount=0,t.isCollapsed=!0,t._ranges.length=0,W(t)}function W(t){t.type=0==t.rangeCount?"None":o(t)?"Caret":"Range"}function G(e){var n;return e instanceof u?((n=t.createNativeRange(e.getDocument())).setEnd(e.endContainer,e.endOffset),n.setStart(e.startContainer,e.startOffset)):e instanceof c?n=e.nativeRange:p.implementsDomRange&&e instanceof a.getWindow(e.startContainer).Range&&(n=e),n}function U(t){if(!t.length||1!=t[0].nodeType)return!1;for(var e=1,n=t.length;e<n;++e)if(!a.isAncestorOf(t[0],t[e]))return!1;return!0}function X(t){var n=t.getNodes();if(!U(n))throw e.createError("getSingleElementFromRange: range "+t.inspect()+" did not consist of a single element");return n[0]}function V(t){return!!t&&void 0!==t.text}function Y(t,e){var n=new c(e);t._ranges=[n],H(t,n,!1),t.rangeCount=1,t.isCollapsed=n.collapsed,W(t)}function q(e){if(e._ranges.length=0,"None"==e.docSelection.type)z(e);else{var n=e.docSelection.createRange();if(V(n))Y(e,n);else{e.rangeCount=n.length;for(var o,i=g(n.item(0)),r=0;r<e.rangeCount;++r)(o=t.createRange(i)).selectNode(n.item(r)),e._ranges.push(o);e.isCollapsed=1==e.rangeCount&&e._ranges[0].collapsed,H(e,e._ranges[e.rangeCount-1],!1),W(e)}}}function K(t,n){for(var o=t.docSelection.createRange(),i=X(n),r=g(o.item(0)),a=v(r).createControlRange(),s=0,l=o.length;s<l;++s)a.add(o.item(s));try{a.add(i)}catch(t){throw e.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}a.select(),q(t)}function Z(t,e,n){this.nativeSelection=t,this.docSelection=e,this._ranges=[],this.win=n,this.refresh()}function $(t){t.win=t.anchorNode=t.focusNode=t._ranges=null,t.rangeCount=t.anchorOffset=t.focusOffset=0,t.detached=!0,W(t)}A&&l(A,"createControlRange")&&(I=A.createControlRange(),s.areHostProperties(I,["item","add"])&&(B=!0)),p.implementsControlRange=B,o=M?function(t){return t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset}:function(t){return!!t.rangeCount&&t.getRangeAt(t.rangeCount-1).collapsed},l(N,"getRangeAt")?j=function(t,e){try{return t.getRangeAt(e)}catch(t){return null}}:M&&(j=function(e){var n=g(e.anchorNode),o=t.createRange(n);return o.setStartAndEnd(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset),o.collapsed!==this.isCollapsed&&o.setStartAndEnd(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset),o}),Z.prototype=t.selectionPrototype;var J=[];function Q(t,e){for(var n,o,i=J.length;i--;)if(o=(n=J[i]).selection,"deleteAll"==e)$(o);else if(n.win==t)return"delete"==e?(J.splice(i,1),!0):o;return"deleteAll"==e&&(J.length=0),null}var tt=function(t){if(t&&t instanceof Z)return t.refresh(),t;var e=Q(t=b(t,"getNativeSelection")),o=n(t),i=S?_(t):null;return e?(e.nativeSelection=o,e.docSelection=i,e.refresh()):(e=new Z(o,i,t),J.push({win:t,selection:e})),e};t.getSelection=tt,s.createAliasForDeprecatedMethod(t,"getIframeSelection","getSelection");var et,nt=Z.prototype;function ot(t,n){for(var o,i=g(n[0].startContainer),r=v(i).createControlRange(),a=0,s=n.length;a<s;++a){o=X(n[a]);try{r.add(o)}catch(t){throw e.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}r.select(),q(t)}if(!C&&M&&s.areHostMethods(N,["removeAllRanges","addRange"])){nt.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),z(this)};var it=function(t,e){L(t.nativeSelection,e),t.refresh()};nt.addRange=k?function(e,n){if(B&&S&&this.docSelection.type==f)K(this,e);else if(m(n)&&O)it(this,e);else{var i;R?i=this.rangeCount:(this.removeAllRanges(),i=0);var r=G(e).cloneRange();try{this.nativeSelection.addRange(r)}catch(t){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==i+1){if(t.config.checkSelectionRanges){var a=j(this.nativeSelection,this.rangeCount-1);a&&!y(a,e)&&(e=new c(a))}this._ranges[this.rangeCount-1]=e,H(this,e,rt(this.nativeSelection)),this.isCollapsed=o(this),W(this)}else this.refresh()}}:function(t,e){m(e)&&O?it(this,t):(this.nativeSelection.addRange(G(t)),this.refresh())},nt.setRanges=function(t){if(B&&S&&t.length>1)ot(this,t);else{this.removeAllRanges();for(var e=0,n=t.length;e<n;++e)this.addRange(t[e])}}}else{if(!(l(N,"empty")&&l(T,"select")&&B&&C))return e.fail("No means of selecting a Range or TextRange was found"),!1;nt.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var t;if(this.anchorNode)t=g(this.anchorNode);else if(this.docSelection.type==f){var e=this.docSelection.createRange();e.length&&(t=g(e.item(0)))}t&&(v(t).createTextRange().select(),this.docSelection.empty())}}catch(t){}z(this)},nt.addRange=function(e){this.docSelection.type==f?K(this,e):(t.WrappedTextRange.rangeToTextRange(e).select(),this._ranges[0]=e,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,H(this,e,!1),W(this))},nt.setRanges=function(t){this.removeAllRanges();var e=t.length;e>1?ot(this,t):e&&this.addRange(t[0])}}if(nt.getRangeAt=function(t){if(t<0||t>=this.rangeCount)throw new d("INDEX_SIZE_ERR");return this._ranges[t].cloneRange()},C)et=function(e){var n;t.isSelectionValid(e.win)?n=e.docSelection.createRange():(n=v(e.win.document).createTextRange()).collapse(!0),e.docSelection.type==f?q(e):V(n)?Y(e,n):z(e)};else if(l(N,"getRangeAt")&&typeof N.rangeCount==r)et=function(e){if(B&&S&&e.docSelection.type==f)q(e);else if(e._ranges.length=e.rangeCount=e.nativeSelection.rangeCount,e.rangeCount){for(var n=0,i=e.rangeCount;n<i;++n)e._ranges[n]=new t.WrappedRange(e.nativeSelection.getRangeAt(n));H(e,e._ranges[e.rangeCount-1],rt(e.nativeSelection)),e.isCollapsed=o(e),W(e)}else z(e)};else{if(!M||typeof N.isCollapsed!=i||typeof T.collapsed!=i||!p.implementsDomRange)return e.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;et=function(t){var e,n=t.nativeSelection;n.anchorNode?(e=j(n,0),t._ranges=[e],t.rangeCount=1,F(t),t.isCollapsed=o(t),W(t)):z(t)}}nt.refresh=function(t){var e=t?this._ranges.slice(0):null,n=this.anchorNode,o=this.anchorOffset;if(et(this),t){var i=e.length;if(i!=this._ranges.length)return!0;if(this.anchorNode!=n||this.anchorOffset!=o)return!0;for(;i--;)if(!y(e[i],this._ranges[i]))return!0;return!1}};var rt,at=function(t,e){var n=t.getAllRanges();t.removeAllRanges();for(var o=0,i=n.length;o<i;++o)y(e,n[o])||t.addRange(n[o]);t.rangeCount||z(t)};function st(t,e){if(t.win.document!=g(e))throw new d("WRONG_DOCUMENT_ERR")}function lt(t,e){if(e<0||e>(a.isCharacterDataNode(t)?t.length:t.childNodes.length))throw new d("INDEX_SIZE_ERR")}function ut(e){return function(n,o){var i;this.rangeCount?(i=this.getRangeAt(0))["set"+(e?"Start":"End")](n,o):(i=t.createRange(this.win.document)).setStartAndEnd(n,o),this.setSingleRange(i,this.isBackward())}}function ct(t){var e=[],n=new h(t.anchorNode,t.anchorOffset),o=new h(t.focusNode,t.focusOffset),i="function"==typeof t.getName?t.getName():"Selection";if(void 0!==t.rangeCount)for(var r=0,a=t.rangeCount;r<a;++r)e[r]=u.inspect(t.getRangeAt(r));return"["+i+"(Ranges: "+e.join(", ")+")(anchor: "+n.inspect()+", focus: "+o.inspect()+"]"}nt.removeRange=B&&S?function(t){if(this.docSelection.type==f){for(var e=this.docSelection.createRange(),n=X(t),o=g(e.item(0)),i=v(o).createControlRange(),r=!1,a=0,s=e.length;a<s;++a)e.item(a)!==n||r?i.add(e.item(a)):r=!0;i.select(),q(this)}else at(this,t)}:function(t){at(this,t)},!C&&M&&p.implementsDomRange?(rt=E,nt.isBackward=function(){return rt(this)}):rt=nt.isBackward=function(){return!1},nt.isBackwards=nt.isBackward,nt.toString=function(){for(var t=[],e=0,n=this.rangeCount;e<n;++e)t[e]=""+this._ranges[e];return t.join("")},nt.collapse=function(e,n){st(this,e);var o=t.createRange(e);o.collapseToPoint(e,n),this.setSingleRange(o),this.isCollapsed=!0},nt.collapseToStart=function(){if(!this.rangeCount)throw new d("INVALID_STATE_ERR");var t=this._ranges[0];this.collapse(t.startContainer,t.startOffset)},nt.collapseToEnd=function(){if(!this.rangeCount)throw new d("INVALID_STATE_ERR");var t=this._ranges[this.rangeCount-1];this.collapse(t.endContainer,t.endOffset)},nt.selectAllChildren=function(e){st(this,e);var n=t.createRange(e);n.selectNodeContents(e),this.setSingleRange(n)},P?nt.setBaseAndExtent=function(t,e,n,o){this.nativeSelection.setBaseAndExtent(t,e,n,o),this.refresh()}:O&&(nt.setBaseAndExtent=function(e,n,o,i){lt(e,n),lt(o,i),st(this,e),st(this,o);var r=t.createRange(node),s=-1==a.comparePoints(e,n,o,i);s?r.setStartAndEnd(o,i,e,n):r.setStartAndEnd(e,n,o,i),this.setSingleRange(r,s)}),nt.deleteFromDocument=function(){if(B&&S&&this.docSelection.type==f){for(var t,e=this.docSelection.createRange();e.length;)t=e.item(0),e.remove(t),a.removeNode(t);this.refresh()}else if(this.rangeCount){var n=this.getAllRanges();if(n.length){this.removeAllRanges();for(var o=0,i=n.length;o<i;++o)n[o].deleteContents();this.addRange(n[i-1])}}},nt.eachRange=function(t,e){for(var n=0,o=this._ranges.length;n<o;++n)if(t(this.getRangeAt(n)))return e},nt.getAllRanges=function(){var t=[];return this.eachRange((function(e){t.push(e)})),t},nt.setSingleRange=function(t,e){this.removeAllRanges(),this.addRange(t,e)},nt.callMethodOnEachRange=function(t,e){var n=[];return this.eachRange((function(o){n.push(o[t].apply(o,e||[]))})),n},nt.setStart=ut(!0),nt.setEnd=ut(!1),t.rangePrototype.select=function(t){tt(this.getDocument()).setSingleRange(this,t)},nt.changeEachRange=function(t){var e=[],n=this.isBackward();this.eachRange((function(n){t(n),e.push(n)})),this.removeAllRanges(),n&&1==e.length?this.addRange(e[0],"backward"):this.setRanges(e)},nt.containsNode=function(t,e){return this.eachRange((function(n){return n.containsNode(t,e)}),!0)||!1},nt.getBookmark=function(t){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[t])}},nt.moveToBookmark=function(e){for(var n,o,i=[],r=0;n=e.rangeBookmarks[r++];)(o=t.createRange(this.win)).moveToBookmark(n),i.push(o);e.backward?this.setSingleRange(i[0],"backward"):this.setRanges(i)},nt.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},nt.restoreRanges=function(t){this.removeAllRanges();for(var e,n=0;e=t.ranges[n];++n)this.addRange(e,t.backward&&0==n)},nt.toHtml=function(){var t=[];return this.eachRange((function(e){t.push(u.toHtml(e))})),t.join("")},p.implementsTextRange&&(nt.getNativeTextRange=function(){var n;if(n=this.docSelection){var o=n.createRange();if(V(o))return o;throw e.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return t.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw e.createError("getNativeTextRange: selection contains no range")}),nt.getName=function(){return"WrappedSelection"},nt.inspect=function(){return ct(this)},nt.detach=function(){Q(this.win,"delete"),$(this)},Z.detachAll=function(){Q(null,"deleteAll")},Z.inspect=ct,Z.isDirectionBackward=m,t.Selection=Z,t.selectionPrototype=nt,t.addShimListener((function(t){void 0===t.getSelection&&(t.getSelection=function(){return tt(t)}),t=null}))}));var B=!1,H=function(t){B||(B=!0,!E.initialized&&E.config.autoInitialize&&M())};return x&&("complete"==document.readyState?H():(s(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",H,!1),y(window,"load",H))),E}()}(nS);var oS=eS,iS={},rS={get exports(){return iS},set exports(t){iS=t}};!function(t){t.exports=function(t){return t.createModule("ClassApplier",["WrappedSelection"],(function(t,e){var n=t.dom,o=n.DomPosition,i=n.arrayContains,r=t.util,a=r.forEach,s="span",l=r.isHostMethod(document,"createElementNS");function u(t,e){for(var n in t)if(t.hasOwnProperty(n)&&!1===e(n,t[n]))return!1;return!0}function c(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function d(t,e){return!!t&&new RegExp("(?:^|\\s)"+e+"(?:\\s|$)").test(t)}function h(t,e){return"object"==typeof t.classList?t.classList.contains(e):d("string"==typeof t.className?t.className:t.getAttribute("class"),e)}function p(t,e){if("object"==typeof t.classList)t.classList.add(e);else{var n="string"==typeof t.className,o=n?t.className:t.getAttribute("class");o?d(o,e)||(o+=" "+e):o=e,n?t.className=o:t.setAttribute("class",o)}}var f=function(){function t(t,e,n){return e&&n?" ":""}return function(e,n){if("object"==typeof e.classList)e.classList.remove(n);else{var o="string"==typeof e.className,i=o?e.className:e.getAttribute("class");i=i.replace(new RegExp("(^|\\s)"+n+"(\\s|$)"),t),o?e.className=i:e.setAttribute("class",i)}}}();function g(t){return"string"==typeof t.className?t.className:t.getAttribute("class")}function v(t){return t&&t.split(/\s+/).sort().join(" ")}function y(t){return v(g(t))}function m(t,e){return y(t)==y(e)}function b(t,e){for(var n=e.split(/\s+/),o=0,i=n.length;o<i;++o)if(!h(t,c(n[o])))return!1;return!0}function x(t){var e=t.parentNode;return e&&1==e.nodeType&&!/^(textarea|style|script|select|iframe)$/i.test(e.nodeName)}function _(t,e,n,o,i){var r=t.node,a=t.offset,s=r,l=a;r==o&&a>i&&++l,r!=e||a!=n&&a!=n+1||(s=o,l+=i-n),r==e&&a>n+1&&--l,t.node=s,t.offset=l}function E(t,e,n){t.node==e&&t.offset>n&&--t.offset}function w(t,e,o,i){-1==o&&(o=e.childNodes.length);var r=t.parentNode,s=n.getNodeIndex(t);a(i,(function(t){_(t,r,s,e,o)})),e.childNodes.length==o?e.appendChild(t):e.insertBefore(t,e.childNodes[o])}function S(t,e){var o=t.parentNode,i=n.getNodeIndex(t);a(e,(function(t){E(t,o,i)})),n.removeNode(t)}function C(t,e,n,o,i){for(var r,a=[];r=t.firstChild;)w(r,e,n++,i),a.push(r);return o&&S(t,i),a}function N(t,e){return C(t,t.parentNode,n.getNodeIndex(t),!0,e)}function T(t,e){var n=t.cloneRange();n.selectNodeContents(e);var o=n.intersection(t);return""!=(o?o.toString():"")}function A(t){for(var e,n=t.getNodes([3]),o=0;(e=n[o])&&!T(t,e);)++o;for(var i=n.length-1;(e=n[i])&&!T(t,e);)--i;return n.slice(o,i+1)}function M(t,e){if(t.attributes.length!=e.attributes.length)return!1;for(var n,o,i,r=0,a=t.attributes.length;r<a;++r)if("class"!=(i=(n=t.attributes[r]).name)){if(null===n!=(null===(o=e.attributes.getNamedItem(i))))return!1;if(n.specified!=o.specified)return!1;if(n.specified&&n.nodeValue!==o.nodeValue)return!1}return!0}function O(t,e){for(var n,o=0,r=t.attributes.length;o<r;++o)if(n=t.attributes[o].name,(!e||!i(e,n))&&t.attributes[o].specified&&"class"!=n)return!0;return!1}var P=n.getComputedStyleProperty,k="boolean"==typeof document.createElement("div").isContentEditable?function(t){return t&&1==t.nodeType&&t.isContentEditable}:function(t){return!(!t||1!=t.nodeType||"false"==t.contentEditable)&&("true"==t.contentEditable||k(t.parentNode))};function R(t){var e;return t&&1==t.nodeType&&((e=t.parentNode)&&9==e.nodeType&&"on"==e.designMode||k(t)&&!k(t.parentNode))}function D(t){return(k(t)||1!=t.nodeType&&k(t.parentNode))&&!R(t)}var L=/^inline(-block|-table)?$/i;function I(t){return t&&1==t.nodeType&&!L.test(P(t,"display"))}var j=/[^\r\n\t\f \u200B]/;function B(t){if(0==t.data.length)return!0;if(j.test(t.data))return!1;switch(P(t.parentNode,"whiteSpace")){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(t.data))return!1}return I(t.previousSibling)||I(t.nextSibling)}function H(t){var e,n,i=[];for(e=0;n=t[e++];)i.push(new o(n.startContainer,n.startOffset),new o(n.endContainer,n.endOffset));return i}function F(t,e){for(var n,o,i,r=0,a=t.length;r<a;++r)n=t[r],o=e[2*r],i=e[2*r+1],n.setStartAndEnd(o.node,o.offset,i.node,i.offset)}function z(t,e){return n.isCharacterDataNode(t)?0==e?!!t.previousSibling:e!=t.length||!!t.nextSibling:e>0&&e<t.childNodes.length}function W(t,o,i,r){var a,s,l=0==i;if(n.isAncestorOf(o,t))return t;if(n.isCharacterDataNode(o)){var u=n.getNodeIndex(o);if(0==i)i=u;else{if(i!=o.length)throw e.createError("splitNodeAt() should not be called with offset in the middle of a data node ("+i+" in "+o.data);i=u+1}o=o.parentNode}if(z(o,i)){a=o.cloneNode(!1),s=o.parentNode,a.id&&a.removeAttribute("id");for(var c,d=0;c=o.childNodes[i];)w(c,a,d++,r);return w(a,s,n.getNodeIndex(o)+1,r),o==t?a:W(t,s,n.getNodeIndex(a),r)}if(t!=o){a=o.parentNode;var h=n.getNodeIndex(o);return l||h++,W(t,a,h,r)}return t}function G(t,e){return t.namespaceURI==e.namespaceURI&&t.tagName.toLowerCase()==e.tagName.toLowerCase()&&m(t,e)&&M(t,e)&&"inline"==P(t,"display")&&"inline"==P(e,"display")}function U(t){var e=t?"nextSibling":"previousSibling";return function(n,o){var i=n.parentNode,r=n[e];if(r){if(r&&3==r.nodeType)return r}else if(o&&(r=i[e])&&1==r.nodeType&&G(i,r)){var a=r[t?"firstChild":"lastChild"];if(a&&3==a.nodeType)return a}return null}}var X=U(!1),V=U(!0);function Y(t){this.isElementMerge=1==t.nodeType,this.textNodes=[];var e=this.isElementMerge?t.lastChild:t;e&&(this.textNodes[0]=e)}Y.prototype={doMerge:function(t){var e=this.textNodes,o=e[0];if(e.length>1){var i,r=n.getNodeIndex(o),s=[],l=0;a(e,(function(u,c){i=u.parentNode,c>0&&(i.removeChild(u),i.hasChildNodes()||n.removeNode(i),t&&a(t,(function(t){t.node==u&&(t.node=o,t.offset+=l),t.node==i&&t.offset>r&&(--t.offset,t.offset==r+1&&c<e.length-1&&(t.node=o,t.offset=l))}))),s[c]=u.data,l+=u.data.length})),o.data=s.join("")}return o.data},getLength:function(){for(var t=this.textNodes.length,e=0;t--;)e+=this.textNodes[t].length;return e},toString:function(){var t=[];return a(this.textNodes,(function(e,n){t[n]="'"+e.data+"'"})),"[Merge("+t.join(",")+")]"}};var q=["elementTagName","ignoreWhiteSpace","applyToEditableOnly","useExistingElements","removeEmptyElements","onElementCreate"],K={};function Z(t,e,n){var o,i,r,a,s=this;s.cssClass=s.className=t;var l=null,d={};if("object"==typeof e&&null!==e){for(void 0!==e.elementTagName&&(e.elementTagName=e.elementTagName.toLowerCase()),n=e.tagNames,l=e.elementProperties,d=e.elementAttributes,i=0;a=q[i++];)e.hasOwnProperty(a)&&(s[a]=e[a]);o=e.normalize}else o=e;s.normalize=void 0===o||o,s.attrExceptions=[];var h=document.createElement(s.elementTagName);s.elementProperties=s.copyPropertiesToElement(l,h,!0),u(d,(function(t,e){s.attrExceptions.push(t),d[t]=""+e})),s.elementAttributes=d,s.elementSortedClassName=s.elementProperties.hasOwnProperty("className")?v(s.elementProperties.className+" "+t):t,s.applyToAnyTagName=!1;var p=typeof n;if("string"==p)"*"==n?s.applyToAnyTagName=!0:s.tagNames=c(n.toLowerCase()).split(/\s*,\s*/);else if("object"==p&&"number"==typeof n.length)for(s.tagNames=[],i=0,r=n.length;i<r;++i)"*"==n[i]?s.applyToAnyTagName=!0:s.tagNames.push(n[i].toLowerCase());else s.tagNames=[s.elementTagName]}function $(t,e,n){return new Z(t,e,n)}Z.prototype={elementTagName:s,elementProperties:{},elementAttributes:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,useExistingElements:!0,removeEmptyElements:!0,onElementCreate:null,copyPropertiesToElement:function(t,e,n){var o,i,r,a,s,l,u={};for(var c in t)if(t.hasOwnProperty(c))if(a=t[c],s=e[c],"className"==c)p(e,a),p(e,this.className),e[c]=v(e[c]),n&&(u[c]=a);else if("style"==c){for(o in i=s,n&&(u[c]=r={}),t[c])t[c].hasOwnProperty(o)&&(i[o]=a[o],n&&(r[o]=i[o]));this.attrExceptions.push(c)}else e[c]=a,n&&(u[c]=e[c],l=K.hasOwnProperty(c)?K[c]:c,this.attrExceptions.push(l));return n?u:""},copyAttributesToElement:function(t,e){for(var n in t)t.hasOwnProperty(n)&&!/^class(?:Name)?$/i.test(n)&&e.setAttribute(n,t[n])},appliesToElement:function(t){return i(this.tagNames,t.tagName.toLowerCase())},getEmptyElements:function(t){var e=this;return t.getNodes([1],(function(t){return e.appliesToElement(t)&&!t.hasChildNodes()}))},hasClass:function(t){return 1==t.nodeType&&(this.applyToAnyTagName||this.appliesToElement(t))&&h(t,this.className)},getSelfOrAncestorWithClass:function(t){for(;t;){if(this.hasClass(t))return t;t=t.parentNode}return null},isModifiable:function(t){return!this.applyToEditableOnly||D(t)},isIgnorableWhiteSpaceNode:function(t){return this.ignoreWhiteSpace&&t&&3==t.nodeType&&B(t)},postApply:function(t,e,n,o){var i,r,s=t[0],l=t[t.length-1],u=[],c=s,d=l,h=0,p=l.length;a(t,(function(t){(r=X(t,!o))?(i||(i=new Y(r),u.push(i)),i.textNodes.push(t),t===s&&(c=i.textNodes[0],h=c.length),t===l&&(d=i.textNodes[0],p=i.getLength())):i=null}));var f=V(l,!o);if(f&&(i||(i=new Y(l),u.push(i)),i.textNodes.push(f)),u.length){for(var g=0,v=u.length;g<v;++g)u[g].doMerge(n);e.setStartAndEnd(c,h,d,p)}},createContainer:function(t){var e=n.getDocument(t),o=l&&!n.isHtmlNamespace(t)&&t.namespaceURI?e.createElementNS(t.namespaceURI,this.elementTagName):e.createElement(this.elementTagName);return this.copyPropertiesToElement(this.elementProperties,o,!1),this.copyAttributesToElement(this.elementAttributes,o),p(o,this.className),this.onElementCreate&&this.onElementCreate(o,this),o},elementHasProperties:function(t,e){var n=this;return u(e,(function(e,o){if("className"==e)return b(t,o);if("object"==typeof o){if(!n.elementHasProperties(t[e],o))return!1}else if(t[e]!==o)return!1}))},elementHasAttributes:function(t,e){return u(e,(function(e,n){if(t.getAttribute(e)!==n)return!1}))},applyToTextNode:function(t,e){if(x(t)){var n=t.parentNode;if(1==n.childNodes.length&&this.useExistingElements&&this.appliesToElement(n)&&this.elementHasProperties(n,this.elementProperties)&&this.elementHasAttributes(n,this.elementAttributes))p(n,this.className);else{var o=t.parentNode,i=this.createContainer(o);o.insertBefore(i,t),i.appendChild(t)}}},isRemovable:function(t){return t.tagName.toLowerCase()==this.elementTagName&&y(t)==this.elementSortedClassName&&this.elementHasProperties(t,this.elementProperties)&&!O(t,this.attrExceptions)&&this.elementHasAttributes(t,this.elementAttributes)&&this.isModifiable(t)},isEmptyContainer:function(t){var e=t.childNodes.length;return 1==t.nodeType&&this.isRemovable(t)&&(0==e||1==e&&this.isEmptyContainer(t.firstChild))},removeEmptyContainers:function(t){var e=this,n=t.getNodes([1],(function(t){return e.isEmptyContainer(t)})),o=[t],i=H(o);a(n,(function(t){S(t,i)})),F(o,i)},undoToTextNode:function(t,e,n,o){if(!e.containsNode(n)){var i=e.cloneRange();i.selectNode(n),i.isPointInRange(e.endContainer,e.endOffset)&&(W(n,e.endContainer,e.endOffset,o),e.setEndAfter(n)),i.isPointInRange(e.startContainer,e.startOffset)&&(n=W(n,e.startContainer,e.startOffset,o))}this.isRemovable(n)?N(n,o):f(n,this.className)},splitAncestorWithClass:function(t,e,n){var o=this.getSelfOrAncestorWithClass(t);o&&W(o,t,e,n)},undoToAncestor:function(t,e){this.isRemovable(t)?N(t,e):f(t,this.className)},applyToRange:function(t,e){var n=this,o=H((e=e||[])||[]);t.splitBoundariesPreservingPositions(o),n.removeEmptyElements&&n.removeEmptyContainers(t);var i=A(t);if(i.length){a(i,(function(t){n.isIgnorableWhiteSpaceNode(t)||n.getSelfOrAncestorWithClass(t)||!n.isModifiable(t)||n.applyToTextNode(t,o)}));var r=i[i.length-1];t.setStartAndEnd(i[0],0,r,r.length),n.normalize&&n.postApply(i,t,o,!1),F(e,o)}var s=n.getEmptyElements(t);a(s,(function(t){p(t,n.className)}))},applyToRanges:function(t){for(var e=t.length;e--;)this.applyToRange(t[e],t);return t},applyToSelection:function(e){var n=t.getSelection(e);n.setRanges(this.applyToRanges(n.getAllRanges()))},undoToRange:function(t,e){var n=this,o=H(e=e||[]);t.splitBoundariesPreservingPositions(o),n.removeEmptyElements&&n.removeEmptyContainers(t,o);var i,r,s=A(t),l=s[s.length-1];if(s.length){n.splitAncestorWithClass(t.endContainer,t.endOffset,o),n.splitAncestorWithClass(t.startContainer,t.startOffset,o);for(var u=0,c=s.length;u<c;++u)i=s[u],(r=n.getSelfOrAncestorWithClass(i))&&n.isModifiable(i)&&n.undoToAncestor(r,o);t.setStartAndEnd(s[0],0,l,l.length),n.normalize&&n.postApply(s,t,o,!0),F(e,o)}var d=n.getEmptyElements(t);a(d,(function(t){f(t,n.className)}))},undoToRanges:function(t){for(var e=t.length;e--;)this.undoToRange(t[e],t);return t},undoToSelection:function(e){var n=t.getSelection(e),o=t.getSelection(e).getAllRanges();this.undoToRanges(o),n.setRanges(o)},isAppliedToRange:function(t){if(t.collapsed||""==t.toString())return!!this.getSelfOrAncestorWithClass(t.commonAncestorContainer);var e=t.getNodes([3]);if(e.length)for(var n,o=0;n=e[o++];)if(!this.isIgnorableWhiteSpaceNode(n)&&T(t,n)&&this.isModifiable(n)&&!this.getSelfOrAncestorWithClass(n))return!1;return!0},isAppliedToRanges:function(t){var e=t.length;if(0==e)return!1;for(;e--;)if(!this.isAppliedToRange(t[e]))return!1;return!0},isAppliedToSelection:function(e){var n=t.getSelection(e);return this.isAppliedToRanges(n.getAllRanges())},toggleRange:function(t){this.isAppliedToRange(t)?this.undoToRange(t):this.applyToRange(t)},toggleSelection:function(t){this.isAppliedToSelection(t)?this.undoToSelection(t):this.applyToSelection(t)},getElementsWithClassIntersectingRange:function(t){var e=[],n=this;return t.getNodes([3],(function(t){var o=n.getSelfOrAncestorWithClass(t);o&&!i(e,o)&&e.push(o)})),e},detach:function(){}},Z.util={hasClass:h,addClass:p,removeClass:f,getClass:g,hasSameClasses:m,hasAllClasses:b,replaceWithOwnChildren:N,elementsHaveSameNonClassAttributes:M,elementHasNonClassAttributes:O,splitNodeAt:W,isEditableElement:k,isEditingHost:R,isEditable:D},t.CssClassApplier=t.ClassApplier=Z,t.createClassApplier=$,r.createAliasForDeprecatedMethod(t,"createCssClassApplier","createClassApplier",e)})),t}(eS)}(rS);var aS={toolbar:{allowMultiParagraphSelection:!0,buttons:["bold","colorpicker","italic","underline","strikethrough","quote","justifyLeft","justifyCenter","justifyRight","justifyFull","superscript","subscript","orderedlist","unorderedlist","pre","removeFormat","outdent","indent","h2","h3"],standardizeSelectionStart:!1,updateOnEmptySelection:!1},placeholder:{text:"请输入内容",hideOnClick:!0},disableEditing:!0},sS=Bw.extensions.button.extend({name:"colorpicker",tagNames:["mark"],contentDefault:"<b>Color</b>",aria:"Color Picker",action:"colorPicker",init:function(){var t=this;oS.init(),Bw.extensions.button.prototype.init.call(this),this.colorPicker=new Qw({parent:this.button,color:"#000",onDone:function(e){t.coloredText&&t.coloredText.isAppliedToSelection()&&t.coloredText.undoToSelection(),t.coloredText=oS.createClassApplier("colored",{elementTagName:"span",elementProperties:{style:{color:e.hex}},normalize:!0}),t.coloredText.toggleSelection(),t.base.checkContentChanged(),t.setInactive()}})},getButton:function(){return this.button},handleClick:function(){this.setActive(),this.colorPicker.show()},isAlreadyApplied:function(t){return"mark"===t.nodeName.toLowerCase()},isActive:function(){return this.button.classList.contains("medium-editor-button-active")},setInactive:function(){this.button.classList.remove("medium-editor-button-active")},setActive:function(){this.button.classList.add("medium-editor-button-active")}}),lS=function(t){function n(e){var n=t.call(this,e)||this;n.labelMap=new Map;var o=e.lf,i=e.graphModel;return n.lf=o,n.graphModel=i,n.state={tick:0},n}return f(n,t),n.prototype.componentDidMount=function(){var t=this,e=this.props.graphModel;this.editor=new Bw(".lf-label-editor",md(aS,{autoLink:!0,extensions:{colorPicker:new sS}})),e.eventCenter.on("text:update,node:mousemove,node:resize,node:rotate,node:drag,label:drop,node:drop",(function(){})),e.eventCenter.on("node:properties-change,node:properties-delete",(function(){t.setState({tick:t.state.tick+1})}))},n.prototype.componentDidUpdate=function(){var t;this.editor&&this.editor.elements.length>0?this.editor.addElements(".lf-label-editor"):(null===(t=this.editor)||void 0===t||t.destroy(),this.editor=new Bw(".lf-label-editor",md(aS,{autoLink:!0,extensions:{colorPicker:new sS}})))},n.prototype.componentWillUnmount=function(){var t;null===(t=this.editor)||void 0===t||t.destroy()},n.prototype.getLabels=function(){var t=this,e=this.props,n=e.lf.extension,o=e.graphModel,i=E(E([],_(o.nodes),!1),_(o.edges),!1);if(n.label){var r=[];return xu(i,(function(e){var n,i;xu(null!==(i=null===(n=e.getData().properties)||void 0===n?void 0:n._label)&&void 0!==i?i:[],(function(n){var i=t.labelMap,a=new Lw(n,e,o);i.set(a.id,a),r.push(fg(Rw,{label:a,element:e,graphModel:o},a.id))}))})),r}return null},n.prototype.render=function(){return fg("foreignObject",{id:"lf-label-overlay",class:"lf-label-overlay",children:this.getLabels()})},n.toolName="label-edit-tool",n=y([e.observer],n)}(e.Component);var uS=function(){function t(t){var n,o,i,r=t.lf,a=t.options;this.labelInitPositionMap=new Map,this.lf=r,this.options=null!=a?a:{},this.textOverflowMode=null!==(n=a.textOverflowMode)&&void 0!==n?n:"default",this.isMultiple=null===(o=a.isMultiple)||void 0===o||o,this.labelWidth=a.labelWidth,this.maxCount=null!==(i=a.maxCount)&&void 0!==i?i:1/0,r.graphModel.editConfigModel.updateTextMode(e.TextMode.LABEL),this.addEventListeners(),r.tool.registerTool(lS.toolName,lS),r.tool.disableTool("text-edit-tool")}return t.prototype.formatConfig=function(t,n){var o=t.editConfigModel,i=o.nodeTextEdit,r=o.edgeTextEdit,a=o.nodeTextDraggable,s=o.edgeTextDraggable,l=this,u=l.textOverflowMode,c=l.isMultiple,d=l.maxCount,h=l.labelWidth,p=n.text,f=n.zIndex,v=n.properties,y=v._label,m=v._labelOption,b=y,x=void 0===m?{}:m,_=x.isMultiple,E=x.maxCount,w=[];if(ee(b)){var S=null!=E?E:d;w=c&&_?b.length>S?b.slice(0,S):b:[b[0]]}else if(he(b))w=[b];else if("string"==typeof b||!b){var C=g(g({},p),{content:b||p.value,draggable:"edge"===n.BaseType?s:a});w=C.value?[C]:[]}return"edge"===n.BaseType&&(w=Ju(w,(function(t){var e=t.x,n=t.y;return console.log("x, y ---\x3e>>",e,n),t}))),Ju(w,(function(t){t.id||(t.id=e.createUuid());var o=t.value,l=t.content,c=t.vertical,d=t.editable,p=t.draggable,v=t.textOverflowMode,y="node"===n.BaseType?i:r,m="node"===n.BaseType?a:s;return g(g({},t),{zIndex:f,labelWidth:h,content:null!=l?l:o,vertical:null!=c&&c,editable:y&&d,draggable:m&&p,textOverflowMode:null!=v?v:u})}))},t.prototype.setupLabels=function(t){var e=this;xu(t.sortElements,(function(n){e.rewriteInnerMethods(n);var o=e.formatConfig(t,n);n.setProperty("_label",o)}))},t.prototype.addLabel=function(t,n){var o,i,r,a=this.maxCount,s=t.properties,l=null!==(o=s._label)&&void 0!==o?o:[],u=null!==(i=s._labelOption)&&void 0!==i?i:{},c=l.length,d={id:e.createUuid(),x:n.x,y:n.y,content:"Label".concat(c+1),value:"Label".concat(c+1),style:{},draggable:!0,editable:!0,vertical:!1};c>=(null!==(r=null==u?void 0:u.maxCount)&&void 0!==r?r:a)||(l.push(d),t.setProperty("_label",l))},t.prototype.addEventListeners=function(){var t=this,n=this.lf.graphModel,o=n.eventCenter,i=n.editConfigModel;o.on("graph:rendered",(function(e){var n=e.graphModel;t.setupLabels(n)})),o.on("node:dbclick,edge:dbclick",(function(o){var r=o.e,a=o.data,s=n.getElement(a.id),l=n.getPointByClient({x:r.clientX,y:r.clientY}).canvasOverlayPosition,u={x:l.x,y:l.y};s&&i.textMode===e.TextMode.LABEL&&t.addLabel(s,u)})),o.on("node:resize",(function(t){var e,n,o=t.preData,i=t.data,r=t.model,a=null!==(e=o.properties)&&void 0!==e?e:{},s=a.width,l=a.height,u=a._label,c=void 0===u?[]:u,d=null!==(n=i.properties)&&void 0!==n?n:{},h=d.width,p=d.height;if(s&&l&&h&&p){var f={x:o.x,y:o.y,width:s,height:l},v={x:i.x,y:i.y,width:h,height:p},y=Ju(c,(function(t){var e,n,o,i,r,a,s,l,u,c,d,h=t.x,p=t.y,y=(n=v,o={x:h,y:p},i=(e=f).x,r=e.y,a=e.width,s=e.height,l=n.x,u=n.y,c=n.width,d=n.height,{x:l+(o.x-i)/a*c,y:u+(o.y-r)/s*d});return g(g({},t),y)}));r.setProperty("_label",y)}})),o.on("node:rotate",(function(e){var n=e.model,o=n.x,i=n.y,r=n.rotate,a=n.properties._label,s={x:o,y:i},l=Ju(void 0===a?[]:a,(function(e){if(!e.id)return e;var n={x:e.x,y:e.y};t.labelInitPositionMap.has(e.id)?n=t.labelInitPositionMap.get(e.id):t.labelInitPositionMap.set(e.id,n);var o=r*(180/Math.PI);o<0&&(o+=360);var i=o*(Math.PI/180),a=function(t,e,n){var o=e.x,i=e.y,r=t.x-o,a=t.y-i;return{x:r*Math.cos(n)-a*Math.sin(n)+o,y:r*Math.sin(n)+a*Math.cos(n)+i}}(n,s,i);return g(g(g({},e),a),{rotate:o})}));n.setProperty("_label",l)}))},t.prototype.rewriteInnerMethods=function(t){t.moveText=function(e,n){if(t.text){var o=t.text,i=o.x,r=o.y,a=o.value,s=o.draggable,l=o.editable;t.text={value:a,editable:l,draggable:s,x:i+e,y:r+n};var u=Is(t.getProperties());if(ee(u._label)){var c=Ju(u._label,(function(t){return g(g({},t),{x:t.x+e,y:t.y+n})}));null==t||t.setProperty("_label",c)}}}},t.prototype.updateTextMode=function(t){var n=this.lf.graphModel.editConfigModel;t!==n.textMode&&(n.updateTextMode(t),t===e.TextMode.LABEL?(this.lf.tool.enableTool(lS.toolName),this.lf.tool.disableTool("text-edit-tool")):t===e.TextMode.TEXT&&(this.lf.tool.enableTool("text-edit-tool"),this.lf.tool.disableTool(lS.toolName)))},t.prototype.render=function(){},t.prototype.destroy=function(){},t.pluginName="label",t}(),cS={};function dS(t){return t.startsWith("data:text/plain")}function hS(t){return m(this,void 0,void 0,(function(){return b(this,(function(e){return cS[t]?[2,cS[t]]:[2,new Promise((function(e,n){try{fetch(t).then((function(t){return t.blob()})).then((function(o){var i=new FileReader;i.onloadend=function(){e(cS[t]=i.result)},i.onerror=n,i.readAsDataURL(o)})).catch((function(){e(cS[t]=t)}))}catch(e){return cS[t]=t}}))]}))}))}function pS(t,e){return m(this,void 0,void 0,(function(){var n,o,i;return b(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(n=t.getAttribute(e)||"").startsWith("data:")?[2]:[4,hS(n)];case 1:return dS(o=r.sent())?[2]:(t.setAttribute(e,o),[3,3]);case 2:return i=r.sent(),console.error(i),[3,3];case 3:return[2]}}))}))}function fS(t,e){return m(this,void 0,void 0,(function(){var n,o;return b(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),e.startsWith("data:")?[2]:[4,hS(e)];case 1:return dS(n=i.sent())?[2]:(t.style.backgroundImage="url(".concat(n,")"),[3,3]);case 2:return o=i.sent(),console.error(o),[3,3];case 3:return[2]}}))}))}function gS(t){return m(this,void 0,void 0,(function(){var e,n,o,i,r,a,s,l,u;return b(this,(function(c){switch(c.label){case 0:for(e=[t],o=[];e.length;)(n=e.shift()).children.length&&e.push.apply(e,E([],_(n.children),!1)),n instanceof HTMLElement&&(i=n.style,r=i.background,a=i.backgroundImage,(s=r.match(/url\(["']?(.*?)["']?\)/))&&s[1]&&(u=s[1],o.push(fS(n,u))),(l=a.match(/url\(["']?(.*?)["']?\)/))&&l[1]&&(u=l[1],o.push(fS(n,u)))),n instanceof HTMLImageElement?o.push(pS(n,"src")):n instanceof SVGImageElement&&o.push(pS(n,"href"));return[4,Promise.all(o)];case 1:return c.sent(),[2]}}))}))}function vS(t,e,n){var o=document.createElement("canvas");o.width=e,o.height=n;var i=o.getContext("2d");return i&&i.drawImage(t,0,0,t.width,t.height,0,0,e,n),o}var yS=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.customCssRules="",this.useGlobalRules=!0,e.getSnapshot=function(t,e){return m(n,void 0,void 0,(function(){return b(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 m(n,void 0,void 0,(function(){return b(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 m(n,void 0,void 0,(function(){return b(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,o=0;o<n;o++){var i=e[o];(i.classList&&Array.from(i.classList)||[]).indexOf("lf-anchor")>-1&&(t.removeChild(t.childNodes[o]),n--,o--)}},t.prototype.removeRotateControl=function(t){for(var e=t.childNodes,n=t.childNodes&&t.childNodes.length,o=0;o<n;o++){var i=e[o];(i.classList&&Array.from(i.classList)||[]).indexOf("lf-rotate-control")>-1&&(t.removeChild(t.childNodes[o]),n--,o--)}},t.prototype.getSnapshot=function(t,e){return m(this,void 0,void 0,(function(){var n,o,i,r,a=this;return b(this,(function(s){switch(s.label){case 0:return n=this.lf.graphModel.getPartial(),o=(null!=e?e:{}).partial,i=void 0===o?n:o,r=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 m(a,void 0,void 0,(function(){return b(this,(function(o){switch(o.label){case 0:return[4,this.snapshot(t,e)];case 1:return o.sent(),this.lf.graphModel.setPartial(n),[2]}}))}))})),[3,3]);case 1:return[4,this.snapshot(t,e)];case 2:s.sent(),s.label=3;case 3:return this.lf.updateEditConfig(r),[2]}}))}))},t.prototype.snapshot=function(t,e){return m(this,void 0,void 0,(function(){var n,o,i,r,a,s,l,u,c,d=this;return b(this,(function(h){switch(h.label){case 0:return o=(n=null!=e?e:{}).fileType,i=void 0===o?"png":o,r=n.quality,this.fileName="".concat(null!=t?t:"logic-flow.".concat(Date.now()),".").concat(i),[4,gS(a=this.getSvgRootElement(this.lf))];case 1:return h.sent(),"svg"===i?(s=this.cloneSvg(a),l=(new XMLSerializer).serializeToString(s),u=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(u),this.triggerDownload(c)):this.getCanvasData(a,null!=e?e:{}).then((function(t){var e=t.toDataURL("image/".concat(i),r).replace("image/".concat(i),"image/octet-stream");d.triggerDownload(e)})),[2]}}))}))},t.prototype.getSnapshotBase64=function(t,e){return m(this,void 0,void 0,(function(){var n,o=this;return b(this,(function(i){switch(i.label){case 0:return[4,gS(n=this.getSvgRootElement(this.lf))];case 1:return i.sent(),[2,new Promise((function(i){o.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 m(this,void 0,void 0,(function(){var n,o=this;return b(this,(function(i){switch(i.label){case 0:return[4,gS(n=this.getSvgRootElement(this.lf))];case 1:return i.sent(),[2,new Promise((function(i){o.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 o=e[n];try{for(var i=0;i<o.cssRules.length;i++)t+=o.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 m(this,void 0,void 0,(function(){var n,o,i,r,a,s,l,u,c,d,h,p,f,g,v,y,m,x,_,E,w,S,C,N,T,A;return b(this,(function(b){return n=e.width,o=e.height,i=e.backgroundColor,r=e.padding,a=void 0===r?40:r,s=this.cloneSvg(t,!1),(l=window.devicePixelRatio||1)<1&&(l=1),u=this.lf.graphModel.rootEl.querySelector(".lf-base"),c=u.getBoundingClientRect(),d=this.lf.container.querySelector(".lf-canvas-overlay"),h=d.getBoundingClientRect(),p=c.x-h.x,f=c.y-h.y,g=this.lf.graphModel,v=g.transformModel,y=v.SCALE_X,m=v.SCALE_Y,x=v.TRANSLATE_X,_=v.TRANSLATE_Y,s.lastChild.style.transform="matrix(1, 0, 0, 1, ".concat((-p+x)*(1/y),", ").concat((-f+_)*(1/m),")"),E=Math.ceil(c.width/y),w=Math.ceil(c.height/m),(S=document.createElement("canvas")).style.width="".concat(E,"px"),S.style.height="".concat(w,"px"),S.width=E*l+2*a,S.height=w*l+2*a,(C=S.getContext("2d"))&&(C.clearRect(0,0,S.width,S.height),C.scale(l,l),i?(C.fillStyle=i,C.fillRect(0,0,S.width,S.height)):C.clearRect(0,0,S.width,S.height)),N=new Image,(T=document.createElement("style")).innerHTML=this.getClassRules(),(A=document.createElement("foreignObject")).appendChild(T),s.appendChild(A),[2,new Promise((function(t){N.onload=function(){var e=navigator.userAgent.indexOf("Firefox")>-1;try{e?createImageBitmap(N,{resizeWidth:n&&o?vS(S,n,o).width:S.width,resizeHeight:n&&o?vS(S,n,o).height:S.height}).then((function(e){null==C||C.drawImage(e,a/l,a/l),t(n&&o?vS(S,n,o):S)})):(null==C||C.drawImage(N,a/l,a/l),t(n&&o?vS(S,n,o):S))}catch(e){null==C||C.drawImage(N,a/l,a/l),t(n&&o?vS(S,n,o):S)}};var e="data:image/svg+xml;charset=utf-8,".concat((new XMLSerializer).serializeToString(s)).replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23");N.src=e}))]}))}))},t.prototype.cloneSvg=function(t,e){var n,o=this;void 0===e&&(e=!0);var i=t.cloneNode(!0),r=i.lastChild,a=null===(n=null==r?void 0:r.childNodes)||void 0===n?void 0:n.length;if(a)for(var s=0;s<a;s++){var l=null==r?void 0:r.childNodes[s],u=l.classList&&Array.from(l.classList);if(u&&u.indexOf("lf-base")<0)null==r||r.removeChild(r.childNodes[s]),a--,s--;else{var c=null==r?void 0:r.childNodes[s];c&&c.childNodes.forEach((function(t){var e=t;o.removeAnchor(e.firstChild),o.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}(),mS=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,o=[];e.nodes.forEach((function(e){n.set(e.id,{id:e.id,data:e,nextNodes:[]}),e.type===t.startNodeType&&o.push(e.id)})),e.edges.forEach((function(t){var e=n.get(t.sourceNodeId);null==e||e.nextNodes.push(t.targetNodeId)}));var i=[];return o.forEach((function(e){var o=n.get(e);o&&(i=i.concat(t.findPathElements(o,n,[])))})),this.getNewPathes(i)},t.prototype.findPathElements=function(t,e,n){void 0===n&&(n=[]);var o=E([],_(n),!1);if(o.push(t.id),0===t.nextNodes.length)return[o];for(var i=[],r=0;r<t.nextNodes.length;r++){var a=e.get(t.nextNodes[r]),s=void 0;if(a){var l=o.indexOf(a.id);s=-1!==l?[E(E([],_(o.slice(l)),!1),[a.id],!1)]:this.findPathElements(a,e,E([],_(o),!1)),i=i.concat(s)}}return i},t.prototype.getNewPathes=function(t){var e=this,n=[],o=new Set;t.forEach((function(t){var i=e.getNewId("path"),r=e.getNewId("路径"),a=e.isLoopPath(t),s=t.join(",");o.has(s)||(o.add(s),n.push({routeId:i,name:r,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 o=i[n],r=e.similar2Path(E([],_(t.elements),!1),E([],_(o.elements),!1));r>t.weight&&o.weight<=r&&(t.weight=r,t.similarElement=o,r===o.weight&&o.similarElement?(o.similarElement.similarElement=null,o.similarElement.weight=0,o.similarElement=null,o.weight=0):(o.similarElement=t,o.weight=r))}})),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,o=t.length+e.length;t.sort(),e.sort();for(var i=t.shift(),r=e.shift();void 0!==i&&void 0!==r;)i===r?(n++,i=t.shift(),r=e.shift()):i<r?i=t.shift():i>r&&(r=e.shift());return n/o*200},t.prototype.getNewId=function(t){return"".concat(t,"_").concat(C())},t.prototype.isLoopPath=function(t){var e=t.length;return t.indexOf(t[e-1])!==e-1?1:0},t.pluginName="flowPath",t}(),bS=-1,xS=0,_S=1,ES=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 o=n.lf.getPathes();return n.levelHeight=[],n.newNodeMap=new Map,n.layout(e,o)}}return t.prototype.layout=function(t,e){var n=this,o=[];e.forEach((function(t){var e=t.elements;e.length>o.length?o=e:e.length===o.length&&JSON.stringify(e)===JSON.stringify(n.trunk)&&(o=n.trunk)})),this.trunk=o;for(var i=this.formatData(t),r={nodes:[],edges:[]},a=o.length-1;a>=0;a--)this.setNodePosition(o[a],i,r,a,1);this.lf.graphModel.graphDataToModel(r)},t.prototype.setNodePosition=function(t,e,n,o,i){var r=this,a=e[t],s=a.text,l=a.type,u=a.next,c=a.properties,d=160*o+40,h=120*i,p={id:t,x:d,text:s,y:h,type:l,properties:c};return s&&"object"==typeof s&&(p.text=g(g({},s),{x:d+s.x,y:h+s.y})),this.newNodeMap.set(p.id,{x:p.x,y:p.y,type:l}),n.nodes.push(p),a.isFixed=!0,this.addLevelHeight(o,1),u&&u.length>0&&u.forEach((function(i){if(!e[i.nodeId].isFixed){var a=r.getLevelHeight(o+1);r.addLevelHeight(o,1),r.setNodePosition(i.nodeId,e,n,o+1,a+1)}n.edges.push(g({id:i.edgeId,type:i.edgeType,sourceNodeId:t,targetNodeId:i.nodeId,properties:i.properties,text:i.text},r.getEdgeDataPoints(t,i.nodeId)))})),p},t.prototype.getEdgeDataPoints=function(t,e){var n=this.newNodeMap.get(t),o=this.newNodeMap.get(e),i=this.getShape(t),r=i.width,a=i.height,s=this.getShape(e),l=s.width,u=s.height,c=this.getRelativePosition(n,o),d={x:n.x,y:n.y},h={x:o.x,y:o.y};switch(c){case xS:d.x=n.x+r/2,h.x=o.x-l/2;break;case bS:d.y=n.y+a/2,h.x=o.x-l/2;break;case _S:d.x=n.x+r/2,h.y=o.y+u/2}return{startPoint:d,endPoint:h}},t.prototype.getRelativePosition=function(t,e){var n=t.y,o=e.y;return n<o?-1:n===o?0:1},t.prototype.getShape=function(t){var e,n,o=this.lf.getNodeModelById(t);return{height:null!==(e=null==o?void 0:o.height)&&void 0!==e?e:0,width:null!==(n=null==o?void 0:o.width)&&void 0!==n?n:0}},t.prototype.formatData=function(t){var e=t.nodes.reduce((function(t,e){var n=e.type,o=e.properties,i=e.text,r=e.x,a=e.y;return i&&"object"==typeof i&&(i.x=i.x-r,i.y=i.y-a),t[e.id]={type:n,properties:o,text:i,prev:[],next:[]},t}),{});return t.edges.forEach((function(t){var n=t.sourceNodeId,o=t.targetNodeId,i=t.id,r=t.properties,a=t.text,s=a;"object"==typeof a&&(s=a.value),e[n].next.push({edgeId:i,nodeId:o,edgeType:t.type,properties:r,text:s}),e[o].prev.push({edgeId:i,nodeId:n,properties:r,text:s})})),e},t.prototype.addLevelHeight=function(t,e,n){void 0===e&&(e=1),void 0===n&&(n=!1);var o=this.levelHeight[t];o||(o={positiveHeight:0,negativeHeight:0},this.levelHeight[t]=o),n?o.negativeHeight-=e:o.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}(),wS=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",o=document.createElement("div"),i=[];return o.className="lf-control",this.controlItems.forEach((function(o){var r=document.createElement("div"),a=document.createElement("i"),s=document.createElement("span");switch(r.className=n,o.onClick&&(r.onclick=o.onClick.bind(null,t.lf)),o.onMouseEnter&&(r.onmouseenter=o.onMouseEnter.bind(null,t.lf)),o.onMouseLeave&&(r.onmouseleave=o.onMouseLeave.bind(null,t.lf)),a.className=o.iconClass,s.className="lf-control-text",s.title=o.title,s.innerText=o.text,r.append(a,s),o.text){case"上一步":t.lf.on("history:change",(function(t){var o=t.data.undoAble;r.className=o?e:n}));break;case"下一步":t.lf.on("history:change",(function(t){var o=t.data.redoAble;r.className=o?e:n}));break;default:r.className=e}i.push(r)})),o.append.apply(o,E([],_(i),!1)),o},t.pluginName="control",t}(),SS="lf:defaultNodeMenu",CS="lf:defaultEdgeMenu",NS="lf:defaultGraphMenu",TS="lf:defaultSelectionMenu",AS=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,o,i=this,r=[{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(SS,r);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(CS,a),null===(n=this.menuTypeMap)||void 0===n||n.set(NS,[]);var s=[{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===(o=this.menuTypeMap)||void 0===o||o.set(TS,s)},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,o,i=t.data,r=t.position,a=t.e,s=r.domOverlayPosition,l=s.x,u=s.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===(o=n.menuTypeMap)||void 0===o?void 0:o.get(SS)),n.__currentData=i,n.showMenu(l,u,h,{width:d.width,height:d.height,clientX:a.clientX,clientY:a.clientY})}})),this.lf.on("edge:contextmenu",(function(t){var e,o,i,r=t.data,a=t.position,s=t.e,l=a.domOverlayPosition,u=l.x,c=l.y,d=r.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===(o=n.menuTypeMap)||void 0===o?void 0:o.get(CS))&&void 0!==i?i:[]),n.__currentData=r,n.showMenu(u,c,p,{width:h.width,height:h.height,clientX:s.clientX,clientY:s.clientY})}})),this.lf.on("blank:contextmenu",(function(t){var e,o,i=t.position,r=null!==(o=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(NS))&&void 0!==o?o:[],a=i.domOverlayPosition,s=a.x,l=a.y;n.showMenu(s,l,r)})),this.lf.on("selection:contextmenu",(function(t){var e,o=t.data,i=t.position,r=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(TS),a=i.domOverlayPosition,s=a.x,l=a.y;n.__currentData=o,n.showMenu(s,l,r)})),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,o){if(n&&n.length){var i=this.__menuDOM;if(i){if(i.innerHTML="",i.append.apply(i,E([],_(this.__getMenuDom(n)),!1)),!i.children.length)return;if(i.style.display="block",!o)return i.style.top="".concat(e,"px"),void(i.style.left="".concat(t,"px"));var r=o.width,a=o.height,s=o.clientX,l=o.clientY,u=this.lf.graphModel,c=i.offsetWidth,d=!0,h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,p=h-s,f=u.rootEl.getBoundingClientRect(),g=f.left+f.width;g<h&&(p=g-s),p<c&&(d=!1),i.style.left="".concat(d?t:t-r,"px");var v=i.offsetHeight,y=!0,m=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,b=m-l,x=f.top+f.height;x<m&&(b=x-l),b<v&&(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 o=document.createElement("span");o.className="lf-menu-item-icon",n.appendChild(o)}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,o;t&&(void 0!==t.nodeMenu&&(null===(e=this.menuTypeMap)||void 0===e||e.set(SS,t.nodeMenu?t.nodeMenu:[])),void 0!==t.edgeMenu&&(null===(n=this.menuTypeMap)||void 0===n||n.set(CS,t.edgeMenu?t.edgeMenu:[])),void 0!==t.graphMenu&&(null===(o=this.menuTypeMap)||void 0===o||o.set(NS,t.graphMenu?t.graphMenu:[])))},t.prototype.addMenuConfig=function(t){var e,n,o,i,r,a,s,l,u;if(t){if(Array.isArray(t.nodeMenu)){var c=null!==(n=null===(e=this.menuTypeMap)||void 0===e?void 0:e.get(SS))&&void 0!==n?n:[];null===(o=this.menuTypeMap)||void 0===o||o.set(SS,c.concat(t.nodeMenu))}if(Array.isArray(t.edgeMenu)){c=null!==(r=null===(i=this.menuTypeMap)||void 0===i?void 0:i.get(CS))&&void 0!==r?r:[];null===(a=this.menuTypeMap)||void 0===a||a.set(CS,c.concat(t.edgeMenu))}if(Array.isArray(t.graphMenu)){c=null!==(l=null===(s=this.menuTypeMap)||void 0===s?void 0:s.get(NS))&&void 0!==l?l:[];null===(u=this.menuTypeMap)||void 0===u||u.set(NS,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}(),MS="menu-common",OS=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(MS,[]),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(MS,t)},t.prototype.getContextMenuPosition=function(){var t=this._activeData,e=this.lf.graphModel.getElement(t.id);if(e){var n,o;if("edge"===e.BaseType){n=Number.MIN_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER;var i=e.getData();n=Math.max(i.startPoint.x,n),o=Math.min(i.startPoint.y,o),n=Math.max(i.endPoint.x,n),o=Math.min(i.endPoint.y,o),i.pointsList&&i.pointsList.forEach((function(t){n=Math.max(t.x,n),o=Math.min(t.y,o)}))}return"node"===e.BaseType&&(n=t.x+e.width/2,o=t.y-e.height/2),this.lf.graphModel.transformModel.CanvasPointToHtmlPoint([n,o])}},t.prototype.createContextMenu=function(){var t=this;if(!this.lf.options.isSilentMode){var e=E(E([],_(this.menuTypeMap.get(this._activeData.type)||[]),!1),_(this.menuTypeMap.get(MS)||[]),!1),n=document.createDocumentFragment();e.forEach((function(e){var o=document.createElement("div");o.className="lf-context-item";var i=document.createElement("img");i.src=e.icon,i.className="lf-context-img",e.className&&(o.className="".concat(o.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})})),o.appendChild(i),n.appendChild(o)})),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 o=this.lf.getNodeModelById(t.sourceId);if(o){var i=t.x-o.width+200,r=e-t.y/2-20,a=t.x+o.width+200,s=e+t.y/2+20;if(this.lf.getAreaElement([i,r],[a,s]).length)return e+=100,void this.addNode(t,e);if(t.type){var l=this.lf.addNode({type:t.type,x:t.x+200,y:e,properties:t.properties}),u=void 0,c=void 0;n&&(u={x:t.x,y:t.y+o.height/2},c={x:l.x-l.width/2,y:l.y}),this.lf.addEdge({sourceNodeId:t.sourceId,targetNodeId:l.id,startPoint:u,endPoint:c})}}},t.prototype.showMenu=function(){var t=this.getContextMenuPosition();if(t){var e=_(t,2),n=e[0],o=e[1];this.__menuDOM.style.display="flex",this.__menuDOM.style.top="".concat(o,"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}(),PS=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 o=document.createElement("div");if(o.className="lf-dnd-shape",t.icon&&(o.style.backgroundImage="url(".concat(t.icon,")")),n.appendChild(o),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}(),kS=function(){function t(t){var e=t.lf,n=t.LogicFlow,o=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,o=(e-i.startPosition.x)/i.scale,r=(n-i.startPosition.y)/i.scale,a=i.viewPortLeft+o+i.viewPortWidth/i.scale/2,s=i.viewPortTop+r+i.viewPortHeight/i.scale/2;i.startPosition={x:e,y:n},i.lf.focusOn({coordinate:{x:a,y:s}})},this.drop=function(){document.removeEventListener("mousemove",i.drag),document.removeEventListener("mouseup",i.drop)},this.mapClick=function(t){var e=t.offsetX,n=t.offsetY,o=i.translateX+e/i.scale,r=i.translateY+n/i.scale;i.lf.focusOn({coordinate:{x:o,y:r}})},this.lf=e,this.LFCtor=n,o&&this.setOption(o),this.viewPortWidth=e.graphModel.width,this.viewPortHeight=e.graphModel.height;var r={left:0,right:this.viewPortWidth,top:0,bottom:this.viewPortHeight};this.bounds=r,this.elementAreaBounds=r,this.viewPortBounds=r,this.initMiniMap()}return t.prototype.setOption=function(t){var e=t.width,n=void 0===e?150:e,o=t.height,i=void 0===o?220:o,r=t.showEdge,a=void 0!==r&&r,s=t.isShowHeader,l=void 0!==s&&s,u=t.isShowCloseIcon,c=void 0!==u&&u,d=t.leftPosition,h=t.topPosition,p=t.rightPosition,f=void 0===p?0:p,g=t.bottomPosition,v=void 0===g?0:g,y=t.headerTitle,m=void 0===y?"导航":y;this.width=n,this.height=i,this.showEdge=a,this.isShowHeader=l,this.isShowCloseIcon=c,this.leftPosition=d,this.rightPosition=void 0!==d?void 0:f,this.topPosition=h,this.bottomPosition=void 0!==h?void 0:v,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,o=document.createElement("div");this.miniMapContainer=o,o.appendChild(this.miniMapWrap),o.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(),o.className="lf-mini-map",this.isShowCloseIcon||o.classList.add("lf-mini-map-no-close-icon"),this.isShowHeader||o.classList.add("lf-mini-map-no-header"),null===(n=this.container)||void 0===n||n.appendChild(o),this.miniMapWrap.appendChild(this.viewport);var i=document.createElement("div");i.className="lf-mini-map-header",i.innerText=this.headerTitle,o.appendChild(i);var r=document.createElement("span");r.className="lf-mini-map-close",r.addEventListener("click",this.hide),o.appendChild(r)},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,o,i=t.x,r=t.y,a=null!==(n=t.width)&&void 0!==n?n:200,s=null!==(o=t.height)&&void 0!==o?o:200,l=i-a/2,u=i+a/2,c=r-s/2,d=r+s/2;e.left=Math.min(l,e.left),e.right=Math.max(u,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,o=t.SCALE_X,i=t.SCALE_Y,r=this.lf.graphModel,a=r.width,s=r.height;this.viewPortBounds={left:-e/o,right:(-e+a)/o,top:-n/i,bottom:(-n+s)/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 o=this.lf.getGraphRawData(),i=this.resetData(o),r=this.lf.viewMap,a=this.lf.graphModel.modelMap,s=this.lfMap.viewMap;try{for(var l=x(r.keys()),u=l.next();!u.done;u=l.next()){var c=u.value;s.has(c)||this.lfMap.register({type:c,view:r.get(c),model:a.get(c)})}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}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,g=d.bottom-p,v=this.width/f,y=this.height/g,m=Math.min(v,y);this.scale=m;var b=h-(this.width/m-f)/2,_=p-(this.height/m-g)/2;if(this.lfMap.graphModel.transformModel.translate(-b+this.translateX,-_+this.translateY),this.translateX=b,this.translateY=_,this.miniMapWrap.firstChild){var E=this.miniMapWrap.firstChild.style;E.pointerEvents="none",E.transform="matrix(".concat(m,", 0, 0, ").concat(m,", 0, 0)"),E.transformOrigin="left top",E.height="".concat(this.height/m,"px"),E.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,o=e.TRANSLATE_Y,i=e.SCALE_X,r=e.SCALE_Y,a=this.lf.graphModel,s=a.width,l=a.height;this.viewPortLeft=-n/i,this.viewPortTop=-o/r,this.viewPortWidth=s/i*this.scale,this.viewPortHeight=l/r*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}(),RS=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,o=e.x,i=e.y;if(n.endPoint={x:o,y:i},n.startPoint){var r=n.startPoint,a=r.x,s=r.y,l=a,u=s,c=o-a,d=i-s;o<a&&(l=o,c=a-o),i<s&&(u=i,d=s-i),n.wrapper&&(n.wrapper.style.left="".concat(l,"px"),n.wrapper.style.top="".concat(u,"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,o=e.x,i=e.y,r=n.endPoint,a=r.x,s=r.y,l=[Math.min(o,a),Math.min(i,s)],u=[Math.max(o,a),Math.max(i,s)];if(n.lf.emit("selection:selected-area",{topLeft:l,bottomRight:u}),Math.abs(a-o)<10&&Math.abs(s-i)<10)return;var c=n.lf.graphModel.getAreaElement(l,u,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 o=e.getEditConfig().stopMoveGraph;this.isDefaultStopMoveGraph=o,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(o){var i=o.e;if(t.getEditConfig().stopMoveGraph&&!n.disabled&&!(2===i.button)){var r=t.getPointByClient(i.clientX,i.clientY).domOverlayPosition,a=r.x,s=r.y;n.startPoint={x:a,y:s},n.endPoint={x:a,y:s};var l=document.createElement("div");l.className="lf-selection-select",l.oncontextmenu=function(t){t.preventDefault()},l.style.top="".concat(n.startPoint.y,"px"),l.style.left="".concat(n.startPoint.x,"px"),e.appendChild(l),n.wrapper=l,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}(),DS=function(t,e){var n=[],o=[],i=function(t,o,r){r&&o.unshift.apply(o,E([],_(e.getEdgeModels({sourceNodeId:t.id,targetNodeId:null==r?void 0:r.id}).map((function(t){return t.id}))),!1)),o.includes(t.id)?n.push(o):(o.unshift(t.id),t.incoming.nodes.length?t.incoming.nodes.forEach((function(e){i(e,o.slice(),t)})):n.push(o))},r=function(t,n,i){i&&n.push.apply(n,E([],_(e.getEdgeModels({sourceNodeId:null==i?void 0:i.id,targetNodeId:t.id}).map((function(t){return t.id}))),!1)),n.includes(t.id)?o.push(n):(n.push(t.id),t.outgoing.nodes.length?t.outgoing.nodes.forEach((function(e){r(e,n.slice(),t)})):o.push(n))};return i(t,[]),r(t,[]),E([],_(new Set(E(E([],_(n.flat()),!1),_(o.flat()),!1))),!1)},LS=function(){function t(t){var e=t.lf,n=t.options;this.mode="path",this.enable=!0,this.tempStyles={};var o=n.mode,i=void 0===o?"path":o,r=n.enable,a=void 0===r||r;this.lf=e,this.mode=i,this.enable=a}return t.prototype.setMode=function(t){this.mode=t},t.prototype.setEnable=function(t){this.enable=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.highlightNeighbours=function(t){var e=this,n=this.lf.getModelById(t);if("node"===(null==n?void 0:n.BaseType)){n.updateStyles(this.tempStyles[t]);var o=n.incoming,i=o.nodes,r=o.edges,a=n.outgoing,s=a.nodes,l=a.edges;js(i,s).forEach((function(t){t.updateStyles(e.tempStyles[t.id])})),js(r,l).forEach((function(t){t.updateStyles(e.tempStyles[t.id])}))}else"edge"===(null==n?void 0:n.BaseType)&&(n.updateStyles(this.tempStyles[t]),n.sourceNode.updateStyles(this.tempStyles[n.sourceNode.id]),n.targetNode.updateStyles(this.tempStyles[n.targetNode.id]))},t.prototype.highlightPath=function(t){var e=this,n=function(t,e){var n=e.getModelById(t);return DS("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.enable)&&(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]=g({},e),t.setStyles({opacity:.1})})),{single:this.highlightSingle.bind(this),neighbour:this.highlightNeighbours.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,o=null!==(n=t.tempStyles[e.id])&&void 0!==n?n:{};e.updateStyles(g({},o))})),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}(),IS={tr:"tl",lb:"tl",tl:"tr",rb:"tr",br:"bl",lt:"bl",bl:"br",rt:"br"};function jS(t,e,n,o){var i,r="",a="";t[0]===e[0]?r=t[1]>e[1]?"t":"b":t[1]===e[1]&&(r=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 s=Math.min(Math.hypot(e[0]-t[0],e[1]-t[1])/2,Math.hypot(n[0]-e[0],n[1]-e[1])/2,o)||.2*o,l="".concat(r).concat(a),u=IS[l]||"-",c="L ".concat(t[0]," ").concat(t[1]);if("-"===u)c+="L ".concat(e[0]," ").concat(e[1]," L ").concat(n[0]," ").concat(n[1]);else{var d=_(function(t,e,n,o){var i=[t[0],t[1]],r=[t[0],t[1]];switch(n){case"tl":return"tr"===e?(i[1]+=o,r[0]+=o):"lb"===e&&(i[0]+=o,r[1]+=o),[i,r];case"tr":return"tl"===e?(i[1]+=o,r[0]-=o):"rb"===e&&(i[0]-=o,r[1]+=o),[i,r];case"bl":return"br"===e?(i[1]-=o,r[0]+=o):"lt"===e&&(i[0]+=o,r[1]-=o),[i,r];case"br":return"bl"===e?(i[1]-=o,r[0]-=o):"rt"===e&&(i[0]-=o,r[1]-=o),[i,r];default:return[]}}(e,l,u,s),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=_(p,2),e[0]=i[0],e[1]=i[1])}return c}function BS(t,e){var n=0,o="";if(2===t.length)o+="M".concat(t[n][0]," ").concat(t[n++][1]," L ").concat(t[n][0]," ").concat(t[n][1]);else{for(o+="M".concat(t[n][0]," ").concat(t[n++][1]);n+1<t.length;){o+=jS(t[n-1],t[n],t[1+n++],e)}o+="L ".concat(t[n][0]," ").concat(t[n][1])}return o}var HS=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,o=t.isAnimation,i=t.arrowConfig,r=t.radius,a=void 0===r?5:r,s=t.getEdgeStyle(),l=t.getEdgeAnimationStyle(),u=function(t){for(var e=t,n=1;n<e.length-1;){var o=_(e[n-1],2),i=o[0],r=o[1],a=_(e[n],2),s=a[0],l=a[1],u=_(e[n+1],2),c=u[0],d=u[1];i===s&&s===c||r===l&&l===d?e.splice(n,1):n++}return e}(n.split(" ").map((function(t){return t.split(",").map((function(t){return+t}))}))),c=BS(u,a),d=g(g(g({style:o?l:{}},s),i),{fill:"none"});return e.h("path",g({d:c},d))},n}(e.PolylineEdge),FS=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e}(e.PolylineEdgeModel),zS=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,o=t.x,i=t.y,r=t.width,a=t.height,s=t.properties,l=this.props.model.getNodeStyle();return e.h("svg",{x:o-r/2,y:i-a/2,width:50,height:24,style:"z-index: 0; background: none; overflow: auto;"},[s.labelText?e.h("text",{x:0,y:-5,fontSize:"16px",fill:l.stroke},s.labelText):"",s.disabledDelete?"":e.h("text",{x:s.labelText?50:0,y:-5,fontSize:"24px",cursor:"pointer",fill:l.stroke,onclick:this.handleCustomDeleteIconClick.bind(this,n)},"x")])},n.prototype.getShape=function(){var t=this.props.model,n=t.x,o=t.y,i=t.width,r=t.height,a=t.id,s=this.props.model.getNodeStyle();return e.h("g",{},[e.h("rect",g(g({},s),{x:n-i/2,y:o-r/2,width:i,height:r,id:a})),this.getLabelShape()])},n.prototype.toFront=function(){},n.prototype.handleCustomDeleteIconClick=function(t){this.props.graphModel.deleteNode(t)},n}(e.PolygonNode),WS=function(t){function e(){var e=t.apply(this,E([],_(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=[],o=1/0,i=1/0,r=-1/0,a=-1/0;t.forEach((function(t){var n=e.graphModel.getNodeModelById(t);if(n){var s=n.width,l=n.height,u=n.x,c=n.y;o=Math.min(o,u-s/2-e.d),i=Math.min(i,c-l/2-e.d),r=Math.max(r,u+s/2+e.d),a=Math.max(a,c+l/2+e.d)}})),n.push([o,i],[r,i],[r,a],[o,a]),[o,i,r,a].some((function(t){return Math.abs(t)===1/0}))||(this.updatePoints(n),this.updateCoordinate({x:(r+o)/2,y:(a+i)/2}))},e}(e.PolygonNodeModel),GS=function(){function t(t){var e=t.lf;this.selectNodes=[],this.d=10,e.register({type:"node-selection",view:zS,model:WS})}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(),o=e.filter((function(e){return e!==t.currentClickNode.id}));return n.nodes.find((function(t){if("node-selection"===t.type){var e=Bi(t,"properties.node_selection_ids",[]);return o.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 o=!1;e.selectNodesIds.includes(n.data.id)&&(e.lf.getNodeModelById(n.data.id).setSelected(!1),o=!0);var i=t.getSelectElements(!0).nodes;e.selectNodes=i,1===e.selectNodes.length?o?e.updateNodeSelection():e.addNodeSelection():e.selectNodes.length>1&&e.updateNodeSelection()}})),t.graphModel.addNodeMoveRules((function(e,n,o){if("node-selection"===e.type){var i=e.properties.node_selection_ids;return t.graphModel.moveNodes(i,n,o,!0),!0}return!0}))},t.pluginName="node-selection",t}(),US=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.x,o=t.y,i=t.width,r=t.height,a=t.properties;return e.h("text",{x:n-i/2+5,y:o-r/2+16,fontSize:12,fill:"blue"},a.moreText)},n.prototype.getShape=function(){var t=this.props.model,n=t.x,o=t.y,i=t.width,r=t.height,a=this.props.model.getNodeStyle();return e.h("g",{},[e.h("rect",g(g({},a),{fill:"#FFFFFF",x:n-i/2,y:o-r/2})),this.getLabelShape()])},n}(e.RectNode),XS={pluginName:"rectLabelNode",install:function(t){t.register({type:"rect-label",model:e.RectNodeModel,view:US})}};t.AutoLayout=ES,t.BPMNAdapter=Mv,t.BPMNBaseAdapter=Av,t.BPMNElements=Wg,t.BoundaryEventFactory=xt,t.BpmnAdapter=ct,t.BpmnElement=U,t.BpmnXmlAdapter=dt,t.ContextMenu=OS,t.Control=wS,t.CurvedEdge=HS,t.CurvedEdgeModel=FS,t.DiamondResize=wg,t.DiamondResizeModel=_g,t.DiamondResizeView=Eg,t.DndPanel=PS,t.DynamicGroup=_w,t.DynamicGroupNode=vw,t.DynamicGroupNodeModel=yw,t.EllipseResize=xg,t.EllipseResizeModel=mg,t.EllipseResizeView=bg,t.EndEventFactory=yt,t.EndEventModel=M,t.EndEventView=O,t.ExclusiveGatewayModel=L,t.ExclusiveGatewayView=I,t.FlowPath=mS,t.GatewayNodeFactory=Rt,t.Group=Lg,t.GroupNode=kg,t.GroupNodeModel=Pg,t.Highlight=LS,t.HtmlResize=Ng,t.HtmlResizeModel=Sg,t.HtmlResizeView=Cg,t.InsertNodeInPolyline=Aw,t.IntermediateCatchEventFactory=mt,t.IntermediateThrowEventFactory=_t,t.Label=uS,t.Menu=AS,t.MiniMap=kS,t.NodeResize=Og,t.NodeSelection=GS,t.RectLabelNode=XS,t.RectResize=Mg,t.RectResizeModel=Tg,t.RectResizeView=Ag,t.SelectionSelect=RS,t.SequenceFlowModel=k,t.SequenceFlowView=R,t.ServiceTaskModel=B,t.ServiceTaskView=H,t.Snapshot=yS,t.StartEventFactory=bt,t.StartEventModel=N,t.StartEventView=T,t.SubProcessFactory=Ig,t.TaskNodeFactory=Lt,t.UserTaskModel=z,t.UserTaskView=W,t.bpmnUtils=vt,t.convertNormalToXml=_v,t.convertXmlToNormal=Ev,t.dynamicGroup=bw,t.gateway={exclusive:0,inclusive:1,parallel:2},t.gatewayComposable=[[1,1,0],[0,0,1],[0,1,1]],t.getCurvedEdgePath=BS,t.handleAttributes=K,t.icons=kt,t.lfJson2Xml=J,t.lfXml2Json=et,t.multiInstanceIcon=Dt,t.sequenceFlowFactory=Bg,t.toLogicflowData=function(t){var e={nodes:[],edges:[]},n=t.flowElementList;return n&&n.length>0&&n.forEach((function(t){if(t.type===Ov.SEQUENCE_FLOW){var n=function(t){var e=t.incoming,n=t.outgoing,o=t.properties,i=t.key,r=t.type,a=o.text,s=o.name,l=o.startPoint,u=o.endPoint,c=o.pointsList,d={id:i,type:Pv[r],sourceNodeId:e[0],targetNodeId:n[0],text:a||s,properties:{}};l&&(d.startPoint=JSON.parse(l)),u&&(d.endPoint=JSON.parse(u)),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 o=function(t){var e=t.properties,n=t.key,o=t.type,i=t.bounds,r=e.x,a=e.y,s=e.text;if(void 0===r){var l=_(i,2),u=l[0],c=u.x,d=u.y,h=l[1];r=(c+h.x)/2,a=(d+h.y)/2}var p={id:n,type:Pv[o],x:r,y:a,text:s,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(o)}})),e},t.toNormalJson=rt,t.toTurboData=function(t){var e=new Map,n={flowElementList:[]};return t.nodes.forEach((function(t){var o=function(t){var e=t.id,n=t.type,o=t.x,i=t.y,r=t.text,a=void 0===r?"":r,s=t.properties;return{incoming:[],outgoing:[],dockers:[],type:kv(n),properties:g(g({},s),{name:a&&a.value||"",x:o,y:i,text:a}),key:e}}(t);n.flowElementList.push(o),e.set(t.id,o)})),t.edges.forEach((function(t){var o=function(t){var e=t.id,n=t.type,o=t.sourceNodeId,i=t.targetNodeId,r=t.startPoint,a=t.endPoint,s=t.pointsList,l=t.text,u=void 0===l?"":l,c=t.properties;return{incoming:[o],outgoing:[i],type:kv(n),dockers:[],properties:g(g({},c),{name:u&&u.value||"",text:u,startPoint:JSON.stringify(r),endPoint:JSON.stringify(a),pointsList:JSON.stringify(s)}),key:e}}(t);e.get(t.sourceNodeId).outgoing.push(o.key),e.get(t.targetNodeId).incoming.push(o.key),n.flowElementList.push(o)})),n},t.toXmlJson=it,t.useDefinition=zg}));
41
+ */String.prototype.startsWith=String.prototype.startsWith||function(t){return 0===this.indexOf(t)},String.prototype.padStart=String.prototype.padStart||function(t,e){for(var n=this;n.length<t;)n=e+n;return n};var Ww={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function Gw(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(e>0?t.toFixed(e).replace(/0+$/,"").replace(/\.$/,""):t.toString())||"0"}var Uw=function(){function t(e,n,o,i){Hw(this,t);var r=this;if(void 0===e);else if(Array.isArray(e))this.rgba=e;else if(void 0===o){var a=e&&""+e;a&&function(e){if(e.startsWith("hsl")){var n=e.match(/([\-\d\.e]+)/g).map(Number),o=zw(n,4),i=o[0],a=o[1],s=o[2],l=o[3];void 0===l&&(l=1),i/=360,a/=100,s/=100,r.hsla=[i,a,s,l]}else if(e.startsWith("rgb")){var u=e.match(/([\-\d\.e]+)/g).map(Number),c=zw(u,4),d=c[0],h=c[1],p=c[2],f=c[3];void 0===f&&(f=1),r.rgba=[d,h,p,f]}else e.startsWith("#")?r.rgba=t.hexToRgb(e):r.rgba=t.nameToRgb(e)||t.hexToRgb(e)}(a.toLowerCase())}else this.rgba=[e,n,o,void 0===i?1:i]}return Fw(t,[{key:"printRGB",value:function(t){var e=(t?this.rgba:this.rgba.slice(0,3)).map((function(t,e){return Gw(t,3===e?3:0)}));return t?"rgba("+e+")":"rgb("+e+")"}},{key:"printHSL",value:function(t){var e=[360,100,100,1],n=["","%","%",""],o=(t?this.hsla:this.hsla.slice(0,3)).map((function(t,o){return Gw(t*e[o],3===o?3:1)+n[o]}));return t?"hsla("+o+")":"hsl("+o+")"}},{key:"printHex",value:function(t){var e=this.hex;return t?e:e.substring(0,7)}},{key:"rgba",get:function(){if(this._rgba)return this._rgba;if(!this._hsla)throw new Error("No color is set");return this._rgba=t.hslToRgb(this._hsla)},set:function(t){3===t.length&&(t[3]=1),this._rgba=t,this._hsla=null}},{key:"rgbString",get:function(){return this.printRGB()}},{key:"rgbaString",get:function(){return this.printRGB(!0)}},{key:"hsla",get:function(){if(this._hsla)return this._hsla;if(!this._rgba)throw new Error("No color is set");return this._hsla=t.rgbToHsl(this._rgba)},set:function(t){3===t.length&&(t[3]=1),this._hsla=t,this._rgba=null}},{key:"hslString",get:function(){return this.printHSL()}},{key:"hslaString",get:function(){return this.printHSL(!0)}},{key:"hex",get:function(){var t=this.rgba.map((function(t,e){return e<3?t.toString(16):Math.round(255*t).toString(16)}));return"#"+t.map((function(t){return t.padStart(2,"0")})).join("")},set:function(e){this.rgba=t.hexToRgb(e)}}],[{key:"hexToRgb",value:function(t){var e=(t.startsWith("#")?t.slice(1):t).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!e.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+t);var n=e.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map((function(t){return parseInt(t,16)}));return n[3]=n[3]/255,n}},{key:"nameToRgb",value:function(e){var n=e.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),o=Ww[n];return void 0===o?o:t.hexToRgb(o.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(t){var e=zw(t,4),n=e[0],o=e[1],i=e[2],r=e[3];n/=255,o/=255,i/=255;var a=Math.max(n,o,i),s=Math.min(n,o,i),l=void 0,u=void 0,c=(a+s)/2;if(a===s)l=u=0;else{var d=a-s;switch(u=c>.5?d/(2-a-s):d/(a+s),a){case n:l=(o-i)/d+(o<i?6:0);break;case o:l=(i-n)/d+2;break;case i:l=(n-o)/d+4}l/=6}return[l,u,c,r]}},{key:"hslToRgb",value:function(t){var e=zw(t,4),n=e[0],o=e[1],i=e[2],r=e[3],a=void 0,s=void 0,l=void 0;if(0===o)a=s=l=i;else{var u=function(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t},c=i<.5?i*(1+o):i+o-i*o,d=2*i-c;a=u(d,c,n+1/3),s=u(d,c,n),l=u(d,c,n-1/3)}var h=[255*a,255*s,255*l].map(Math.round);return h[3]=r,h}}]),t}(),Xw=function(){function t(){Hw(this,t),this._events=[]}return Fw(t,[{key:"add",value:function(t,e,n){t.addEventListener(e,n,!1),this._events.push({target:t,type:e,handler:n})}},{key:"remove",value:function(e,n,o){this._events=this._events.filter((function(i){var r=!0;return e&&e!==i.target&&(r=!1),n&&n!==i.type&&(r=!1),o&&o!==i.handler&&(r=!1),r&&t._doRemove(i.target,i.type,i.handler),!r}))}},{key:"destroy",value:function(){this._events.forEach((function(e){return t._doRemove(e.target,e.type,e.handler)})),this._events=[]}}],[{key:"_doRemove",value:function(t,e,n){t.removeEventListener(e,n,!1)}}]),t}();function Vw(t,e,n){var o=!1;function i(t,e,n){return Math.max(e,Math.min(t,n))}function r(t,r,a){if(a&&(o=!0),o){t.preventDefault();var s=e.getBoundingClientRect(),l=s.width,u=s.height,c=r.clientX,d=r.clientY,h=i(c-s.left,0,l),p=i(d-s.top,0,u);n(h/l,p/u)}}function a(t,e){1===(void 0===t.buttons?t.which:t.buttons)?r(t,t,e):o=!1}function s(t,e){1===t.touches.length?r(t,t.touches[0],e):o=!1}t.add(e,"mousedown",(function(t){a(t,!0)})),t.add(e,"touchstart",(function(t){s(t,!0)})),t.add(window,"mousemove",a),t.add(e,"touchmove",s),t.add(window,"mouseup",(function(t){o=!1})),t.add(e,"touchend",(function(t){o=!1})),t.add(e,"touchcancel",(function(t){o=!1}))}var Yw="keydown",qw="mousedown",Kw="focusin";function Zw(t,e){return(e||document).querySelector(t)}function $w(t){t.preventDefault(),t.stopPropagation()}function Jw(t,e,n,o,i){t.add(e,Yw,(function(t){n.indexOf(t.key)>=0&&(i&&$w(t),o(t))}))}var Qw=function(){function t(e){Hw(this,t),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new Xw,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(e)}return Fw(t,[{key:"setOptions",value:function(t){var e=this;if(t){var n=this.settings;if(t instanceof HTMLElement)n.parent=t;else{n.parent&&t.parent&&n.parent!==t.parent&&(this._events.remove(n.parent),this._popupInited=!1),function(t,e,n){for(var o in t)n&&n.indexOf(o)>=0||(e[o]=t[o])}(t,n),t.onChange&&(this.onChange=t.onChange),t.onDone&&(this.onDone=t.onDone),t.onOpen&&(this.onOpen=t.onOpen),t.onClose&&(this.onClose=t.onClose);var o=t.color||t.colour;o&&this._setColor(o)}var i=n.parent;if(i&&n.popup&&!this._popupInited){var r=function(t){return e.openHandler(t)};this._events.add(i,"click",r),Jw(this._events,i,[" ","Spacebar","Enter"],r),this._popupInited=!0}else t.parent&&!n.popup&&this.show()}}},{key:"openHandler",value:function(t){if(this.show()){t&&t.preventDefault(),this.settings.parent.style.pointerEvents="none";var e=t&&t.type===Yw?this._domEdit:this.domElement;setTimeout((function(){return e.focus()}),100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(t){var e=t&&t.type,n=!1;if(t)if(e===qw||e===Kw){var o=(this.__containedEvent||0)+100;t.timeStamp>o&&(n=!0)}else $w(t),n=!0;else n=!0;n&&this.hide()&&(this.settings.parent.style.pointerEvents="",e!==qw&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(t,e){this.closeHandler(),this.setOptions(t),e&&this.openHandler()}},{key:"setColor",value:function(t,e){this._setColor(t,{silent:e})}},{key:"_setColor",value:function(t,e){if("string"==typeof t&&(t=t.trim()),t){e=e||{};var n=void 0;try{n=new Uw(t)}catch(t){if(e.failSilently)return;throw t}if(!this.settings.alpha){var o=n.hsla;o[3]=1,n.hsla=o}this.colour=this.color=n,this._setHSLA(null,null,null,null,e)}}},{key:"setColour",value:function(t,e){this.setColor(t,e)}},{key:"show",value:function(){if(!this.settings.parent)return!1;if(this.domElement){var t=this._toggleDOM(!0);return this._setPosition(),t}var e,n,o=this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>',i=(e=o,(n=document.createElement("div")).innerHTML=e,n.firstElementChild);return this.domElement=i,this._domH=Zw(".picker_hue",i),this._domSL=Zw(".picker_sl",i),this._domA=Zw(".picker_alpha",i),this._domEdit=Zw(".picker_editor input",i),this._domSample=Zw(".picker_sample",i),this._domOkay=Zw(".picker_done button",i),this._domCancel=Zw(".picker_cancel button",i),i.classList.add("layout_"+this.settings.layout),this.settings.alpha||i.classList.add("no_alpha"),this.settings.editor||i.classList.add("no_editor"),this.settings.cancelButton||i.classList.add("no_cancel"),this._ifPopup((function(){return i.classList.add("popup")})),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var t=this,e=this,n=this.domElement,o=this._events;function i(t,e,n){o.add(t,e,n)}i(n,"click",(function(t){return t.preventDefault()})),Vw(o,this._domH,(function(t,n){return e._setHSLA(t)})),Vw(o,this._domSL,(function(t,n){return e._setHSLA(null,t,1-n)})),this.settings.alpha&&Vw(o,this._domA,(function(t,n){return e._setHSLA(null,null,null,1-n)}));var r=this._domEdit;i(r,"input",(function(t){e._setColor(this.value,{fromEditor:!0,failSilently:!0})})),i(r,"focus",(function(t){var e=this;e.selectionStart===e.selectionEnd&&e.select()})),this._ifPopup((function(){var e=function(e){return t.closeHandler(e)};i(window,qw,e),i(window,Kw,e),Jw(o,n,["Esc","Escape"],e);var r=function(e){t.__containedEvent=e.timeStamp};i(n,qw,r),i(n,Kw,r),i(t._domCancel,"click",e)}));var a=function(e){t._ifPopup((function(){return t.closeHandler(e)})),t.onDone&&t.onDone(t.colour)};i(this._domOkay,"click",a),Jw(o,n,["Enter"],a)}},{key:"_setPosition",value:function(){var t=this.settings.parent,e=this.domElement;t!==e.parentNode&&t.appendChild(e),this._ifPopup((function(n){"static"===getComputedStyle(t).position&&(t.style.position="relative");var o=!0===n?"popup_right":"popup_"+n;["popup_top","popup_bottom","popup_left","popup_right"].forEach((function(t){t===o?e.classList.add(t):e.classList.remove(t)})),e.classList.add(o)}))}},{key:"_setHSLA",value:function(t,e,n,o,i){i=i||{};var r=this.colour,a=r.hsla;[t,e,n,o].forEach((function(t,e){(t||0===t)&&(a[e]=t)})),r.hsla=a,this._updateUI(i),this.onChange&&!i.silent&&this.onChange(r)}},{key:"_updateUI",value:function(t){if(this.domElement){t=t||{};var e=this.colour,n=e.hsla,o="hsl("+360*n[0]+", 100%, 50%)",i=e.hslString,r=e.hslaString,a=this._domH,s=this._domSL,l=this._domA,u=Zw(".picker_selector",a),c=Zw(".picker_selector",s),d=Zw(".picker_selector",l);m(0,u,n[0]),this._domSL.style.backgroundColor=this._domH.style.color=o,m(0,c,n[1]),b(0,c,1-n[2]),s.style.color=i,b(0,d,1-n[3]);var h=i,p=h.replace("hsl","hsla").replace(")",", 0)"),f="linear-gradient("+[h,p]+")";if(this._domA.style.background=f+", linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,\n linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em",!t.fromEditor){var g=this.settings.editorFormat,v=this.settings.alpha,y=void 0;switch(g){case"rgb":y=e.printRGB(v);break;case"hsl":y=e.printHSL(v);break;default:y=e.printHex(v)}this._domEdit.value=y}this._domSample.style.color=r}function m(t,e,n){e.style.left=100*n+"%"}function b(t,e,n){e.style.top=100*n+"%"}}},{key:"_ifPopup",value:function(t,e){this.settings.parent&&this.settings.popup?t&&t(this.settings.popup):e&&e()}},{key:"_toggleDOM",value:function(t){var e=this.domElement;if(!e)return!1;var n=t?"":"none",o=e.style.display!==n;return o&&(e.style.display=n),o}}]),t}(),tS=document.createElement("style");tS.textContent='.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}',document.documentElement.firstElementChild.appendChild(tS),Qw.StyleElement=tS;var eS={},nS={get exports(){return eS},set exports(t){eS=t}};!function(t){t.exports=function(){var t="object",e="function",n="undefined",o=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],i=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],r=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],a=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"];function s(n,o){var i=typeof n[o];return i==e||!(i!=t||!n[o])||"unknown"==i}function l(e,n){return!(typeof e[n]!=t||!e[n])}function u(t,e){return typeof t[e]!=n}function c(t){return function(e,n){for(var o=n.length;o--;)if(!t(e,n[o]))return!1;return!0}}var d=c(s),h=c(l),p=c(u);function f(t){return t&&d(t,a)&&p(t,r)}function g(t){return l(t,"body")?t.body:t.getElementsByTagName("body")[0]}var v,y,m=[].forEach?function(t,e){t.forEach(e)}:function(t,e){for(var n=0,o=t.length;n<o;++n)e(t[n],n)},b={},x=typeof window!=n&&typeof document!=n,_={isHostMethod:s,isHostObject:l,isHostProperty:u,areHostMethods:d,areHostObjects:h,areHostProperties:p,isTextRange:f,getBody:g,forEach:m},E={version:"1.3.1",initialized:!1,isBrowser:x,supported:!0,util:_,features:{},modules:b,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==n||rangyAutoInitialize}};function w(t){typeof console!=n&&s(console,"log")&&console.log(t)}function S(t,e){x&&e?alert(t):w(t)}function C(t){E.initialized=!0,E.supported=!1,S("Rangy is not supported in this environment. Reason: "+t,E.config.alertOnFail)}function N(t){S("Rangy warning: "+t,E.config.alertOnWarn)}E.fail=C,E.warn=N,{}.hasOwnProperty?(_.extend=v=function(t,e,n){var o,i;for(var r in e)e.hasOwnProperty(r)&&(o=t[r],i=e[r],n&&null!==o&&"object"==typeof o&&null!==i&&"object"==typeof i&&v(o,i,!0),t[r]=i);return e.hasOwnProperty("toString")&&(t.toString=e.toString),t},_.createOptions=function(t,e){var n={};return v(n,e),t&&v(n,t),n}):C("hasOwnProperty not supported"),x||C("Rangy can only run in a browser"),function(){var t;if(x){var e=document.createElement("div");e.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(e.childNodes,0)[0].nodeType&&(t=function(t){return n.call(t,0)})}catch(t){}}t||(t=function(t){for(var e=[],n=0,o=t.length;n<o;++n)e[n]=t[n];return e}),_.toArray=t}(),x&&(s(document,"addEventListener")?y=function(t,e,n){t.addEventListener(e,n,!1)}:s(document,"attachEvent")?y=function(t,e,n){t.attachEvent("on"+e,n)}:C("Document does not have required addEventListener or attachEvent method"),_.addListener=y);var T=[];function A(t){return t.message||t.description||String(t)}function M(){if(x&&!E.initialized){var t,e=!1,n=!1;s(document,"createRange")&&(t=document.createRange(),d(t,i)&&p(t,o)&&(e=!0));var r=g(document);if(r&&"body"==r.nodeName.toLowerCase())if(r&&s(r,"createTextRange")&&f(t=r.createTextRange())&&(n=!0),e||n){var a;for(var l in E.initialized=!0,E.features={implementsDomRange:e,implementsTextRange:n},b)(a=b[l])instanceof D&&a.init(a,E);for(var u=0,c=T.length;u<c;++u)try{T[u](E)}catch(t){w("Rangy init listener threw an exception. Continuing. Detail: "+A(t))}}else C("Neither Range nor TextRange are available");else C("No body element found")}}function O(t,e,n){n&&(t+=" in module "+n.name),E.warn("DEPRECATED: "+t+" is deprecated. Please use "+e+" instead.")}function P(t,e,n,o){t[e]=function(){return O(e,n,o),t[n].apply(t,_.toArray(arguments))}}_.deprecationNotice=O,_.createAliasForDeprecatedMethod=P,E.init=M,E.addInitListener=function(t){E.initialized?t(E):T.push(t)};var k=[];function R(t){t=t||window,M();for(var e=0,n=k.length;e<n;++e)k[e](t)}function D(t,e,n){this.name=t,this.dependencies=e,this.initialized=!1,this.supported=!1,this.initializer=n}function L(t,e,n){var o=new D(t,e,(function(e){if(!e.initialized){e.initialized=!0;try{n(E,e),e.supported=!0}catch(e){w("Module '"+t+"' failed to load: "+A(e)),e.stack&&w(e.stack)}}}));return b[t]=o,o}function I(){}function j(){}E.addShimListener=function(t){k.push(t)},x&&(E.shim=E.createMissingNativeApi=R,P(E,"createMissingNativeApi","shim")),D.prototype={init:function(){for(var t,e,n=this.dependencies||[],o=0,i=n.length;o<i;++o){if(e=n[o],!((t=b[e])&&t instanceof D))throw new Error("required module '"+e+"' not found");if(t.init(),!t.supported)throw new Error("required module '"+e+"' not supported")}this.initializer(this)},fail:function(t){throw this.initialized=!0,this.supported=!1,new Error(t)},warn:function(t){E.warn("Module "+this.name+": "+t)},deprecationNotice:function(t,e){E.warn("DEPRECATED: "+t+" in module "+this.name+" is deprecated. Please use "+e+" instead")},createError:function(t){return new Error("Error in Rangy "+this.name+" module: "+t)}},E.createModule=function(t){var e,n;2==arguments.length?(e=arguments[1],n=[]):(e=arguments[2],n=arguments[1]);var o=L(t,n,e);E.initialized&&E.supported&&o.init()},E.createCoreModule=function(t,e,n){L(t,e,n)},E.RangePrototype=I,E.rangePrototype=new I,E.selectionPrototype=new j,E.createCoreModule("DomUtil",[],(function(t,e){var n="undefined",o=t.util,i=o.getBody;o.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||e.fail("document missing a Node creation method"),o.isHostMethod(document,"getElementsByTagName")||e.fail("document missing getElementsByTagName method");var r=document.createElement("div");o.areHostMethods(r,["insertBefore","appendChild","cloneNode"]||!o.areHostObjects(r,["previousSibling","nextSibling","childNodes","parentNode"]))||e.fail("Incomplete Element implementation"),o.isHostProperty(r,"innerHTML")||e.fail("Element is missing innerHTML property");var a=document.createTextNode("test");o.areHostMethods(a,["splitText","deleteData","insertData","appendData","cloneNode"]||!o.areHostObjects(r,["previousSibling","nextSibling","childNodes","parentNode"])||!o.areHostProperties(a,["data"]))||e.fail("Incomplete Text Node implementation");var s=function(t,e){for(var n=t.length;n--;)if(t[n]===e)return!0;return!1};function l(t){var e;return typeof t.namespaceURI==n||null===(e=t.namespaceURI)||"http://www.w3.org/1999/xhtml"==e}function u(t){var e=t.parentNode;return 1==e.nodeType?e:null}function c(t){for(var e=0;t=t.previousSibling;)++e;return e}function d(t){switch(t.nodeType){case 7:case 10:return 0;case 3:case 8:return t.length;default:return t.childNodes.length}}function h(t,e){var n,o=[];for(n=t;n;n=n.parentNode)o.push(n);for(n=e;n;n=n.parentNode)if(s(o,n))return n;return null}function p(t,e,n){for(var o=n?e:e.parentNode;o;){if(o===t)return!0;o=o.parentNode}return!1}function f(t,e){return p(t,e,!0)}function g(t,e,n){for(var o,i=n?t:t.parentNode;i;){if((o=i.parentNode)===e)return i;i=o}return null}function v(t){var e=t.nodeType;return 3==e||4==e||8==e}function y(t){if(!t)return!1;var e=t.nodeType;return 3==e||8==e}function m(t,e){var n=e.nextSibling,o=e.parentNode;return n?o.insertBefore(t,n):o.appendChild(t),t}function b(t,e,n){var o=t.cloneNode(!1);if(o.deleteData(0,e),t.deleteData(e,t.length-e),m(o,t),n)for(var i,r=0;i=n[r++];)i.node==t&&i.offset>e?(i.node=o,i.offset-=e):i.node==t.parentNode&&i.offset>c(t)&&++i.offset;return o}function x(t){if(9==t.nodeType)return t;if(typeof t.ownerDocument!=n)return t.ownerDocument;if(typeof t.document!=n)return t.document;if(t.parentNode)return x(t.parentNode);throw e.createError("getDocument: no document found for node")}function _(t){var o=x(t);if(typeof o.defaultView!=n)return o.defaultView;if(typeof o.parentWindow!=n)return o.parentWindow;throw e.createError("Cannot get a window object for node")}function E(t){if(typeof t.contentDocument!=n)return t.contentDocument;if(typeof t.contentWindow!=n)return t.contentWindow.document;throw e.createError("getIframeDocument: No Document object found for iframe element")}function w(t){if(typeof t.contentWindow!=n)return t.contentWindow;if(typeof t.contentDocument!=n)return t.contentDocument.defaultView;throw e.createError("getIframeWindow: No Window object found for iframe element")}function S(t){return t&&o.isHostMethod(t,"setTimeout")&&o.isHostObject(t,"document")}function C(t,e,n){var i;if(t?o.isHostProperty(t,"nodeType")?i=1==t.nodeType&&"iframe"==t.tagName.toLowerCase()?E(t):x(t):S(t)&&(i=t.document):i=document,!i)throw e.createError(n+"(): Parameter must be a Window object or DOM node");return i}function N(t){for(var e;e=t.parentNode;)t=e;return t}function T(t,n,o,i){var r,a,s,l,u;if(t==o)return n===i?0:n<i?-1:1;if(r=g(o,t,!0))return n<=c(r)?-1:1;if(r=g(t,o,!0))return c(r)<i?-1:1;if(!(a=h(t,o)))throw new Error("comparePoints error: nodes have no common ancestor");if((s=t===a?a:g(t,a,!0))===(l=o===a?a:g(o,a,!0)))throw e.createError("comparePoints got to case 4 and childA and childB are the same!");for(u=a.firstChild;u;){if(u===s)return-1;if(u===l)return 1;u=u.nextSibling}}var A,M=!1;function O(t){try{return t.parentNode,!1}catch(t){return!0}}function P(t){if(!t)return"[No node]";if(M&&O(t))return"[Broken node]";if(v(t))return'"'+t.data+'"';if(1==t.nodeType){var e=t.id?' id="'+t.id+'"':"";return"<"+t.nodeName+e+">[index:"+c(t)+",length:"+t.childNodes.length+"]["+(t.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return t.nodeName}function k(t){for(var e,n=x(t).createDocumentFragment();e=t.firstChild;)n.appendChild(e);return n}function R(t,e,n){var o=i(t),r=t.createElement("div");r.contentEditable=""+!!n,e&&(r.innerHTML=e);var a=o.firstChild;return a?o.insertBefore(r,a):o.appendChild(r),r}function D(t){return t.parentNode.removeChild(t)}function L(t){this.root=t,this._next=t}function I(t){return new L(t)}function j(t,e){this.node=t,this.offset=e}function B(t){this.code=this[t],this.codeName=t,this.message="DOMException: "+this.codeName}!function(){var e=document.createElement("b");e.innerHTML="1";var n=e.firstChild;e.innerHTML="<br />",M=O(n),t.features.crashyTextNodes=M}(),typeof window.getComputedStyle!=n?A=function(t,e){return _(t).getComputedStyle(t,null)[e]}:typeof document.documentElement.currentStyle!=n?A=function(t,e){return t.currentStyle?t.currentStyle[e]:""}:e.fail("No means of obtaining computed style properties found"),L.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var t,e,n=this._current=this._next;if(this._current)if(t=n.firstChild)this._next=t;else{for(e=null;n!==this.root&&!(e=n.nextSibling);)n=n.parentNode;this._next=e}return this._current},detach:function(){this._current=this._next=this.root=null}},j.prototype={equals:function(t){return!!t&&this.node===t.node&&this.offset==t.offset},inspect:function(){return"[DomPosition("+P(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},B.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},B.prototype.toString=function(){return this.message},t.dom={arrayContains:s,isHtmlNamespace:l,parentElement:u,getNodeIndex:c,getNodeLength:d,getCommonAncestor:h,isAncestorOf:p,isOrIsAncestorOf:f,getClosestAncestorIn:g,isCharacterDataNode:v,isTextOrCommentNode:y,insertAfter:m,splitDataNode:b,getDocument:x,getWindow:_,getIframeWindow:w,getIframeDocument:E,getBody:i,isWindow:S,getContentDocument:C,getRootContainer:N,comparePoints:T,isBrokenNode:O,inspectNode:P,getComputedStyleProperty:A,createTestElement:R,removeNode:D,fragmentFromNodeChildren:k,createIterator:I,DomPosition:j},t.DOMException=B})),E.createCoreModule("DomRange",["DomUtil"],(function(t,e){var n=t.dom,o=t.util,i=n.DomPosition,r=t.DOMException,a=n.isCharacterDataNode,s=n.getNodeIndex,l=n.isOrIsAncestorOf,u=n.getDocument,c=n.comparePoints,d=n.splitDataNode,h=n.getClosestAncestorIn,p=n.getNodeLength,f=n.arrayContains,g=n.getRootContainer,v=t.features.crashyTextNodes,y=n.removeNode;function m(t,e){return 3!=t.nodeType&&(l(t,e.startContainer)||l(t,e.endContainer))}function b(t){return t.document||u(t.startContainer)}function x(t){return g(t.startContainer)}function _(t){return new i(t.parentNode,s(t))}function E(t){return new i(t.parentNode,s(t)+1)}function w(t,e,o){var i=11==t.nodeType?t.firstChild:t;return a(e)?o==e.length?n.insertAfter(t,e):e.parentNode.insertBefore(t,0==o?e:d(e,o)):o>=e.childNodes.length?e.appendChild(t):e.insertBefore(t,e.childNodes[o]),i}function S(t,e,n){if(Z(t),Z(e),b(e)!=b(t))throw new r("WRONG_DOCUMENT_ERR");var o=c(t.startContainer,t.startOffset,e.endContainer,e.endOffset),i=c(t.endContainer,t.endOffset,e.startContainer,e.startOffset);return n?o<=0&&i>=0:o<0&&i>0}function C(t){for(var e,n,o,i=b(t.range).createDocumentFragment();n=t.next();){if(e=t.isPartiallySelectedSubtree(),n=n.cloneNode(!e),e&&(o=t.getSubtreeIterator(),n.appendChild(C(o)),o.detach()),10==n.nodeType)throw new r("HIERARCHY_REQUEST_ERR");i.appendChild(n)}return i}function N(t,e,o){var i,r,a,s;for(o=o||{stop:!1};a=t.next();)if(t.isPartiallySelectedSubtree()){if(!1===e(a))return void(o.stop=!0);if(N(s=t.getSubtreeIterator(),e,o),s.detach(),o.stop)return}else for(i=n.createIterator(a);r=i.next();)if(!1===e(r))return void(o.stop=!0)}function T(t){for(var e;t.next();)t.isPartiallySelectedSubtree()?(T(e=t.getSubtreeIterator()),e.detach()):t.remove()}function A(t){for(var e,n,o=b(t.range).createDocumentFragment();e=t.next();){if(t.isPartiallySelectedSubtree()?(e=e.cloneNode(!1),n=t.getSubtreeIterator(),e.appendChild(A(n)),n.detach()):t.remove(),10==e.nodeType)throw new r("HIERARCHY_REQUEST_ERR");o.appendChild(e)}return o}function M(t,e,n){var o,i=!(!e||!e.length),r=!!n;i&&(o=new RegExp("^("+e.join("|")+")$"));var s=[];return N(new P(t,!1),(function(e){if((!i||o.test(e.nodeType))&&(!r||n(e))){var l=t.startContainer;if(e!=l||!a(l)||t.startOffset!=l.length){var u=t.endContainer;e==u&&a(u)&&0==t.endOffset||s.push(e)}}})),s}function O(t){return"["+(void 0===t.getName?"Range":t.getName())+"("+n.inspectNode(t.startContainer)+":"+t.startOffset+", "+n.inspectNode(t.endContainer)+":"+t.endOffset+")]"}function P(t,e){if(this.range=t,this.clonePartiallySelectedTextNodes=e,!t.collapsed){this.sc=t.startContainer,this.so=t.startOffset,this.ec=t.endContainer,this.eo=t.endOffset;var n=t.commonAncestorContainer;this.sc===this.ec&&a(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||a(this.sc)?h(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||a(this.ec)?h(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}P.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=null,this._next=this._first},hasNext:function(){return!!this._next},next:function(){var t=this._current=this._next;return t&&(this._next=t!==this._last?t.nextSibling:null,a(t)&&this.clonePartiallySelectedTextNodes&&(t===this.ec&&(t=t.cloneNode(!0)).deleteData(this.eo,t.length-this.eo),this._current===this.sc&&(t=t.cloneNode(!0)).deleteData(0,this.so))),t},remove:function(){var t,e,n=this._current;!a(n)||n!==this.sc&&n!==this.ec?n.parentNode&&y(n):(t=n===this.sc?this.so:0)!=(e=n===this.ec?this.eo:n.length)&&n.deleteData(t,e-t)},isPartiallySelectedSubtree:function(){return m(this._current,this.range)},getSubtreeIterator:function(){var t;if(this.isSingleCharacterDataNode)(t=this.range.cloneRange()).collapse(!1);else{t=new yt(b(this.range));var e=this._current,n=e,o=0,i=e,r=p(e);l(e,this.sc)&&(n=this.sc,o=this.so),l(e,this.ec)&&(i=this.ec,r=this.eo),vt(t,n,o,i,r)}return new P(t,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};var k=[1,3,4,5,7,8,10],R=[2,9,11],D=[5,6,10,12],L=[1,3,4,5,7,8,10,11],I=[1,3,4,5,7,8];function j(t){return function(e,n){for(var o,i=n?e:e.parentNode;i;){if(o=i.nodeType,f(t,o))return i;i=i.parentNode}return null}}var B=j([9,11]),H=j(D),F=j([6,10,12]),z=j([1]);function W(t,e){if(F(t,e))throw new r("INVALID_NODE_TYPE_ERR")}function G(t,e){if(!f(e,t.nodeType))throw new r("INVALID_NODE_TYPE_ERR")}function U(t,e){if(e<0||e>(a(t)?t.length:t.childNodes.length))throw new r("INDEX_SIZE_ERR")}function X(t,e){if(B(t,!0)!==B(e,!0))throw new r("WRONG_DOCUMENT_ERR")}function V(t){if(H(t,!0))throw new r("NO_MODIFICATION_ALLOWED_ERR")}function Y(t,e){if(!t)throw new r(e)}function q(t,e){return e<=(a(t)?t.length:t.childNodes.length)}function K(t){return!!t.startContainer&&!!t.endContainer&&!(v&&(n.isBrokenNode(t.startContainer)||n.isBrokenNode(t.endContainer)))&&g(t.startContainer)==g(t.endContainer)&&q(t.startContainer,t.startOffset)&&q(t.endContainer,t.endOffset)}function Z(t){if(!K(t))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+t.inspect()+")")}var $=document.createElement("style"),J=!1;try{$.innerHTML="<b>x</b>",J=3==$.firstChild.nodeType}catch(t){}t.features.htmlParsingConforms=J;var Q=J?function(t){var e=this.startContainer,o=u(e);if(!e)throw new r("INVALID_STATE_ERR");var i=null;return 1==e.nodeType?i=e:a(e)&&(i=n.parentElement(e)),(i=null===i||"HTML"==i.nodeName&&n.isHtmlNamespace(u(i).documentElement)&&n.isHtmlNamespace(i)?o.createElement("body"):i.cloneNode(!1)).innerHTML=t,n.fragmentFromNodeChildren(i)}:function(t){var e=b(this).createElement("body");return e.innerHTML=t,n.fragmentFromNodeChildren(e)};function tt(t,e){Z(t);var n=t.startContainer,o=t.startOffset,i=t.endContainer,r=t.endOffset,l=n===i;a(i)&&r>0&&r<i.length&&d(i,r,e),a(n)&&o>0&&o<n.length&&(n=d(n,o,e),l?(r-=o,i=n):i==n.parentNode&&r>=s(n)&&r++,o=0),t.setStartAndEnd(n,o,i,r)}function et(t){Z(t);var e=t.commonAncestorContainer.parentNode.cloneNode(!1);return e.appendChild(t.cloneContents()),e.innerHTML}var nt=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ot=0,it=1,rt=2,at=3,st=0,lt=1,ut=2,ct=3;function dt(t){t.START_TO_START=ot,t.START_TO_END=it,t.END_TO_END=rt,t.END_TO_START=at,t.NODE_BEFORE=st,t.NODE_AFTER=lt,t.NODE_BEFORE_AND_AFTER=ut,t.NODE_INSIDE=ct}function ht(t){dt(t),dt(t.prototype)}function pt(t,e){return function(){Z(this);var n,o=this.startContainer,i=this.startOffset,r=this.commonAncestorContainer,a=new P(this,!0);o!==r&&(o=(n=E(h(o,r,!0))).node,i=n.offset),N(a,V),a.reset();var s=t(a);return a.detach(),e(this,o,i,o,i),s}}function ft(e,n){function i(t,e){return function(n){G(n,k),G(g(n),R);var o=(t?_:E)(n);(e?r:l)(this,o.node,o.offset)}}function r(t,e,o){var i=t.endContainer,r=t.endOffset;e===t.startContainer&&o===t.startOffset||(g(e)==g(i)&&1!=c(e,o,i,r)||(i=e,r=o),n(t,e,o,i,r))}function l(t,e,o){var i=t.startContainer,r=t.startOffset;e===t.endContainer&&o===t.endOffset||(g(e)==g(i)&&-1!=c(e,o,i,r)||(i=e,r=o),n(t,i,r,e,o))}var u=function(){};u.prototype=t.rangePrototype,e.prototype=new u,o.extend(e.prototype,{setStart:function(t,e){W(t,!0),U(t,e),r(this,t,e)},setEnd:function(t,e){W(t,!0),U(t,e),l(this,t,e)},setStartAndEnd:function(){var t=arguments,e=t[0],o=t[1],i=e,r=o;switch(t.length){case 3:r=t[2];break;case 4:i=t[2],r=t[3]}W(e,!0),U(e,o),W(i,!0),U(i,r),n(this,e,o,i,r)},setBoundary:function(t,e,n){this["set"+(n?"Start":"End")](t,e)},setStartBefore:i(!0,!0),setStartAfter:i(!1,!0),setEndBefore:i(!0,!1),setEndAfter:i(!1,!1),collapse:function(t){Z(this),t?n(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):n(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(t){W(t,!0),n(this,t,0,t,p(t))},selectNode:function(t){W(t,!1),G(t,k);var e=_(t),o=E(t);n(this,e.node,e.offset,o.node,o.offset)},extractContents:pt(A,n),deleteContents:pt(T,n),canSurroundContents:function(){Z(this),V(this.startContainer),V(this.endContainer);var t=new P(this,!0),e=t._first&&m(t._first,this)||t._last&&m(t._last,this);return t.detach(),!e},splitBoundaries:function(){tt(this)},splitBoundariesPreservingPositions:function(t){tt(this,t)},normalizeBoundaries:function(){Z(this);var t,e=this.startContainer,o=this.startOffset,i=this.endContainer,r=this.endOffset,l=function(t){var e=t.nextSibling;e&&e.nodeType==t.nodeType&&(i=t,r=t.length,t.appendData(e.data),y(e))},u=function(t){var n=t.previousSibling;if(n&&n.nodeType==t.nodeType){e=t;var a=t.length;if(o=n.length,t.insertData(0,n.data),y(n),e==i)r+=o,i=e;else if(i==t.parentNode){var l=s(t);r==l?(i=t,r=a):r>l&&r--}}},c=!0;if(a(i))r==i.length?l(i):0==r&&(t=i.previousSibling)&&t.nodeType==i.nodeType&&(r=t.length,e==i&&(c=!1),t.appendData(i.data),y(i),i=t);else{if(r>0){var d=i.childNodes[r-1];d&&a(d)&&l(d)}c=!this.collapsed}if(c){if(a(e))0==o?u(e):o==e.length&&(t=e.nextSibling)&&t.nodeType==e.nodeType&&(i==t&&(i=e,r+=e.length),e.appendData(t.data),y(t));else if(o<e.childNodes.length){var h=e.childNodes[o];h&&a(h)&&u(h)}}else e=i,o=r;n(this,e,o,i,r)},collapseToPoint:function(t,e){W(t,!0),U(t,e),this.setStartAndEnd(t,e)},parentElement:function(){return Z(this),this.commonAncestorContainer?z(this.commonAncestorContainer,!0):null}}),ht(e)}function gt(t){t.collapsed=t.startContainer===t.endContainer&&t.startOffset===t.endOffset,t.commonAncestorContainer=t.collapsed?t.startContainer:n.getCommonAncestor(t.startContainer,t.endContainer)}function vt(t,e,o,i,r){t.startContainer=e,t.startOffset=o,t.endContainer=i,t.endOffset=r,t.document=n.getDocument(e),gt(t)}function yt(t){vt(this,t,0,t,0)}o.extend(t.rangePrototype,{compareBoundaryPoints:function(t,e){var n,o,i,r;Z(this),X(this.startContainer,e.startContainer);var a=t==at||t==ot?"start":"end",s=t==it||t==ot?"start":"end";return n=this[a+"Container"],o=this[a+"Offset"],i=e[s+"Container"],r=e[s+"Offset"],c(n,o,i,r)},insertNode:function(t){if(Z(this),G(t,L),V(this.startContainer),l(t,this.startContainer))throw new r("HIERARCHY_REQUEST_ERR");var e=w(t,this.startContainer,this.startOffset);this.setStartBefore(e)},cloneContents:function(){var t,e;if(Z(this),this.collapsed)return b(this).createDocumentFragment();if(this.startContainer===this.endContainer&&a(this.startContainer))return(t=this.startContainer.cloneNode(!0)).data=t.data.slice(this.startOffset,this.endOffset),(e=b(this).createDocumentFragment()).appendChild(t),e;var n=new P(this,!0);return t=C(n),n.detach(),t},canSurroundContents:function(){Z(this),V(this.startContainer),V(this.endContainer);var t=new P(this,!0),e=t._first&&m(t._first,this)||t._last&&m(t._last,this);return t.detach(),!e},surroundContents:function(t){if(G(t,I),!this.canSurroundContents())throw new r("INVALID_STATE_ERR");var e=this.extractContents();if(t.hasChildNodes())for(;t.lastChild;)t.removeChild(t.lastChild);w(t,this.startContainer,this.startOffset),t.appendChild(e),this.selectNode(t)},cloneRange:function(){Z(this);for(var t,e=new yt(b(this)),n=nt.length;n--;)e[t=nt[n]]=this[t];return e},toString:function(){Z(this);var t=this.startContainer;if(t===this.endContainer&&a(t))return 3==t.nodeType||4==t.nodeType?t.data.slice(this.startOffset,this.endOffset):"";var e=[],n=new P(this,!0);return N(n,(function(t){3!=t.nodeType&&4!=t.nodeType||e.push(t.data)})),n.detach(),e.join("")},compareNode:function(t){Z(this);var e=t.parentNode,n=s(t);if(!e)throw new r("NOT_FOUND_ERR");var o=this.comparePoint(e,n),i=this.comparePoint(e,n+1);return o<0?i>0?ut:st:i>0?lt:ct},comparePoint:function(t,e){return Z(this),Y(t,"HIERARCHY_REQUEST_ERR"),X(t,this.startContainer),c(t,e,this.startContainer,this.startOffset)<0?-1:c(t,e,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:Q,toHtml:function(){return et(this)},intersectsNode:function(t,e){if(Z(this),g(t)!=x(this))return!1;var n=t.parentNode,o=s(t);if(!n)return!0;var i=c(n,o,this.endContainer,this.endOffset),r=c(n,o+1,this.startContainer,this.startOffset);return e?i<=0&&r>=0:i<0&&r>0},isPointInRange:function(t,e){return Z(this),Y(t,"HIERARCHY_REQUEST_ERR"),X(t,this.startContainer),c(t,e,this.startContainer,this.startOffset)>=0&&c(t,e,this.endContainer,this.endOffset)<=0},intersectsRange:function(t){return S(this,t,!1)},intersectsOrTouchesRange:function(t){return S(this,t,!0)},intersection:function(t){if(this.intersectsRange(t)){var e=c(this.startContainer,this.startOffset,t.startContainer,t.startOffset),n=c(this.endContainer,this.endOffset,t.endContainer,t.endOffset),o=this.cloneRange();return-1==e&&o.setStart(t.startContainer,t.startOffset),1==n&&o.setEnd(t.endContainer,t.endOffset),o}return null},union:function(t){if(this.intersectsOrTouchesRange(t)){var e=this.cloneRange();return-1==c(t.startContainer,t.startOffset,this.startContainer,this.startOffset)&&e.setStart(t.startContainer,t.startOffset),1==c(t.endContainer,t.endOffset,this.endContainer,this.endOffset)&&e.setEnd(t.endContainer,t.endOffset),e}throw new r("Ranges do not intersect")},containsNode:function(t,e){return e?this.intersectsNode(t,!1):this.compareNode(t)==ct},containsNodeContents:function(t){return this.comparePoint(t,0)>=0&&this.comparePoint(t,p(t))<=0},containsRange:function(t){var e=this.intersection(t);return null!==e&&t.equals(e)},containsNodeText:function(t){var e=this.cloneRange();e.selectNode(t);var n=e.getNodes([3]);if(n.length>0){e.setStart(n[0],0);var o=n.pop();return e.setEnd(o,o.length),this.containsRange(e)}return this.containsNodeContents(t)},getNodes:function(t,e){return Z(this),M(this,t,e)},getDocument:function(){return b(this)},collapseBefore:function(t){this.setEndBefore(t),this.collapse(!1)},collapseAfter:function(t){this.setStartAfter(t),this.collapse(!0)},getBookmark:function(e){var o=b(this),i=t.createRange(o);e=e||n.getBody(o),i.selectNodeContents(e);var r=this.intersection(i),a=0,s=0;return r&&(i.setEnd(r.startContainer,r.startOffset),s=(a=i.toString().length)+r.toString().length),{start:a,end:s,containerNode:e}},moveToBookmark:function(t){var e=t.containerNode,n=0;this.setStart(e,0),this.collapse(!0);for(var o,i,r,a,s=[e],l=!1,u=!1;!u&&(o=s.pop());)if(3==o.nodeType)i=n+o.length,!l&&t.start>=n&&t.start<=i&&(this.setStart(o,t.start-n),l=!0),l&&t.end>=n&&t.end<=i&&(this.setEnd(o,t.end-n),u=!0),n=i;else for(r=(a=o.childNodes).length;r--;)s.push(a[r])},getName:function(){return"DomRange"},equals:function(t){return yt.rangesEqual(this,t)},isValid:function(){return K(this)},inspect:function(){return O(this)},detach:function(){}}),ft(yt,vt),o.extend(yt,{rangeProperties:nt,RangeIterator:P,copyComparisonConstants:ht,createPrototypeRange:ft,inspect:O,toHtml:et,getRangeDocument:b,rangesEqual:function(t,e){return t.startContainer===e.startContainer&&t.startOffset===e.startOffset&&t.endContainer===e.endContainer&&t.endOffset===e.endOffset}}),t.DomRange=yt})),E.createCoreModule("WrappedRange",["DomRange"],(function(t,e){var n,o,i=t.dom,r=t.util,a=i.DomPosition,s=t.DomRange,l=i.getBody,u=i.getContentDocument,c=i.isCharacterDataNode;if(t.features.implementsDomRange&&function(){var o,a,c=s.rangeProperties;function d(t){for(var e,n=c.length;n--;)t[e=c[n]]=t.nativeRange[e];t.collapsed=t.startContainer===t.endContainer&&t.startOffset===t.endOffset}function h(t,e,n,o,i){var r=t.startContainer!==e||t.startOffset!=n,a=t.endContainer!==o||t.endOffset!=i,s=!t.equals(t.nativeRange);(r||a||s)&&(t.setEnd(o,i),t.setStart(e,n))}n=function(t){if(!t)throw e.createError("WrappedRange: Range must be specified");this.nativeRange=t,d(this)},s.createPrototypeRange(n,h),(o=n.prototype).selectNode=function(t){this.nativeRange.selectNode(t),d(this)},o.cloneContents=function(){return this.nativeRange.cloneContents()},o.surroundContents=function(t){this.nativeRange.surroundContents(t),d(this)},o.collapse=function(t){this.nativeRange.collapse(t),d(this)},o.cloneRange=function(){return new n(this.nativeRange.cloneRange())},o.refresh=function(){d(this)},o.toString=function(){return this.nativeRange.toString()};var p=document.createTextNode("test");l(document).appendChild(p);var f=document.createRange();f.setStart(p,0),f.setEnd(p,0);try{f.setStart(p,1),o.setStart=function(t,e){this.nativeRange.setStart(t,e),d(this)},o.setEnd=function(t,e){this.nativeRange.setEnd(t,e),d(this)},a=function(t){return function(e){this.nativeRange[t](e),d(this)}}}catch(t){o.setStart=function(t,e){try{this.nativeRange.setStart(t,e)}catch(n){this.nativeRange.setEnd(t,e),this.nativeRange.setStart(t,e)}d(this)},o.setEnd=function(t,e){try{this.nativeRange.setEnd(t,e)}catch(n){this.nativeRange.setStart(t,e),this.nativeRange.setEnd(t,e)}d(this)},a=function(t,e){return function(n){try{this.nativeRange[t](n)}catch(o){this.nativeRange[e](n),this.nativeRange[t](n)}d(this)}}}o.setStartBefore=a("setStartBefore","setEndBefore"),o.setStartAfter=a("setStartAfter","setEndAfter"),o.setEndBefore=a("setEndBefore","setStartBefore"),o.setEndAfter=a("setEndAfter","setStartAfter"),o.selectNodeContents=function(t){this.setStartAndEnd(t,0,i.getNodeLength(t))},f.selectNodeContents(p),f.setEnd(p,3);var g=document.createRange();g.selectNodeContents(p),g.setEnd(p,4),g.setStart(p,2),-1==f.compareBoundaryPoints(f.START_TO_END,g)&&1==f.compareBoundaryPoints(f.END_TO_START,g)?o.compareBoundaryPoints=function(t,e){return t==(e=e.nativeRange||e).START_TO_END?t=e.END_TO_START:t==e.END_TO_START&&(t=e.START_TO_END),this.nativeRange.compareBoundaryPoints(t,e)}:o.compareBoundaryPoints=function(t,e){return this.nativeRange.compareBoundaryPoints(t,e.nativeRange||e)};var v=document.createElement("div");v.innerHTML="123";var y=v.firstChild,m=l(document);m.appendChild(v),f.setStart(y,1),f.setEnd(y,2),f.deleteContents(),"13"==y.data&&(o.deleteContents=function(){this.nativeRange.deleteContents(),d(this)},o.extractContents=function(){var t=this.nativeRange.extractContents();return d(this),t}),m.removeChild(v),m=null,r.isHostMethod(f,"createContextualFragment")&&(o.createContextualFragment=function(t){return this.nativeRange.createContextualFragment(t)}),l(document).removeChild(p),o.getName=function(){return"WrappedRange"},t.WrappedRange=n,t.createNativeRange=function(t){return(t=u(t,e,"createNativeRange")).createRange()}}(),t.features.implementsTextRange){var d=function(t){var e=t.parentElement(),n=t.duplicate();n.collapse(!0);var o=n.parentElement();(n=t.duplicate()).collapse(!1);var r=n.parentElement(),a=o==r?o:i.getCommonAncestor(o,r);return a==e?a:i.getCommonAncestor(e,a)},h=function(t){return 0==t.compareEndPoints("StartToEnd",t)},p=function(t,e,n,o,r){var s=t.duplicate();s.collapse(n);var l=s.parentElement();if(i.isOrIsAncestorOf(e,l)||(l=e),!l.canHaveHTML){var u=new a(l.parentNode,i.getNodeIndex(l));return{boundaryPosition:u,nodeInfo:{nodeIndex:u.offset,containerElement:u.node}}}var d=i.getDocument(l).createElement("span");d.parentNode&&i.removeNode(d);for(var h,p,f,g,v,y=n?"StartToStart":"StartToEnd",m=r&&r.containerElement==l?r.nodeIndex:0,b=l.childNodes.length,x=b,_=x;_==b?l.appendChild(d):l.insertBefore(d,l.childNodes[_]),s.moveToElementText(d),0!=(h=s.compareEndPoints(y,t))&&m!=x;){if(-1==h){if(x==m+1)break;m=_}else x=x==m+1?m:_;_=Math.floor((m+x)/2),l.removeChild(d)}if(v=d.nextSibling,-1==h&&v&&c(v)){var E;if(s.setEndPoint(n?"EndToStart":"EndToEnd",t),/[\r\n]/.test(v.data)){var w=s.duplicate(),S=w.text.replace(/\r\n/g,"\r").length;for(E=w.moveStart("character",S);-1==(h=w.compareEndPoints("StartToEnd",w));)E++,w.moveStart("character",1)}else E=s.text.length;g=new a(v,E)}else p=(o||!n)&&d.previousSibling,g=(f=(o||n)&&d.nextSibling)&&c(f)?new a(f,0):p&&c(p)?new a(p,p.data.length):new a(l,i.getNodeIndex(d));return i.removeNode(d),{boundaryPosition:g,nodeInfo:{nodeIndex:_,containerElement:l}}},f=function(t,e){var n,o,r,a,s=t.offset,u=i.getDocument(t.node),d=l(u).createTextRange(),h=c(t.node);return h?o=(n=t.node).parentNode:(n=s<(a=t.node.childNodes).length?a[s]:null,o=t.node),(r=u.createElement("span")).innerHTML="&#feff;",n?o.insertBefore(r,n):o.appendChild(r),d.moveToElementText(r),d.collapse(!e),o.removeChild(r),h&&d[e?"moveStart":"moveEnd"]("character",s),d};(o=function(t){this.textRange=t,this.refresh()}).prototype=new s(document),o.prototype.refresh=function(){var t,e,n,o=d(this.textRange);h(this.textRange)?e=t=p(this.textRange,o,!0,!0).boundaryPosition:(t=(n=p(this.textRange,o,!0,!1)).boundaryPosition,e=p(this.textRange,o,!1,!1,n.nodeInfo).boundaryPosition),this.setStart(t.node,t.offset),this.setEnd(e.node,e.offset)},o.prototype.getName=function(){return"WrappedTextRange"},s.copyComparisonConstants(o);var g=function(t){if(t.collapsed)return f(new a(t.startContainer,t.startOffset),!0);var e=f(new a(t.startContainer,t.startOffset),!0),n=f(new a(t.endContainer,t.endOffset),!1),o=l(s.getRangeDocument(t)).createTextRange();return o.setEndPoint("StartToStart",e),o.setEndPoint("EndToEnd",n),o};if(o.rangeToTextRange=g,o.prototype.toTextRange=function(){return g(this)},t.WrappedTextRange=o,!t.features.implementsDomRange||t.config.preferTextRange){var v=Function("return this;")();void 0===v.Range&&(v.Range=o),t.createNativeRange=function(t){return t=u(t,e,"createNativeRange"),l(t).createTextRange()},t.WrappedRange=o}}t.createRange=function(n){return n=u(n,e,"createRange"),new t.WrappedRange(t.createNativeRange(n))},t.createRangyRange=function(t){return t=u(t,e,"createRangyRange"),new s(t)},r.createAliasForDeprecatedMethod(t,"createIframeRange","createRange"),r.createAliasForDeprecatedMethod(t,"createIframeRangyRange","createRangyRange"),t.addShimListener((function(e){var n=e.document;void 0===n.createRange&&(n.createRange=function(){return t.createRange(n)}),n=e=null}))})),E.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],(function(t,e){t.config.checkSelectionRanges=!0;var n,o,i="boolean",r="number",a=t.dom,s=t.util,l=s.isHostMethod,u=t.DomRange,c=t.WrappedRange,d=t.DOMException,h=a.DomPosition,p=t.features,f="Control",g=a.getDocument,v=a.getBody,y=u.rangesEqual;function m(t){return"string"==typeof t?/^backward(s)?$/i.test(t):!!t}function b(t,n){if(t){if(a.isWindow(t))return t;if(t instanceof Z)return t.win;var o=a.getContentDocument(t,e,n);return a.getWindow(o)}return window}function x(t){return b(t,"getWinSelection").getSelection()}function _(t){return b(t,"getDocSelection").document.selection}function E(t){var e=!1;return t.anchorNode&&(e=1==a.comparePoints(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)),e}var w=l(window,"getSelection"),S=s.isHostObject(document,"selection");p.implementsWinGetSelection=w,p.implementsDocSelection=S;var C=S&&(!w||t.config.preferTextRange);if(C)n=_,t.isSelectionValid=function(t){var e=b(t,"isSelectionValid").document,n=e.selection;return"None"!=n.type||g(n.createRange().parentElement())==e};else{if(!w)return e.fail("Neither document.selection or window.getSelection() detected."),!1;n=x,t.isSelectionValid=function(){return!0}}t.getNativeSelection=n;var N=n();if(!N)return e.fail("Native selection was null (possibly issue 138?)"),!1;var T=t.createNativeRange(document),A=v(document),M=s.areHostProperties(N,["anchorNode","focusNode","anchorOffset","focusOffset"]);p.selectionHasAnchorAndFocus=M;var O=l(N,"extend");p.selectionHasExtend=O;var P=l(N,"setBaseAndExtent");p.selectionHasSetBaseAndExtent=P;var k=typeof N.rangeCount==r;p.selectionHasRangeCount=k;var R=!1,D=!0,L=O?function(e,n){var o=u.getRangeDocument(n),i=t.createRange(o);i.collapseToPoint(n.endContainer,n.endOffset),e.addRange(G(i)),e.extend(n.startContainer,n.startOffset)}:null;s.areHostMethods(N,["addRange","getRangeAt","removeAllRanges"])&&typeof N.rangeCount==r&&p.implementsDomRange&&function(){var e=window.getSelection();if(e){for(var n=e.rangeCount,o=n>1,i=[],r=E(e),s=0;s<n;++s)i[s]=e.getRangeAt(s);var l=a.createTestElement(document,"",!1),u=l.appendChild(document.createTextNode("   ")),c=document.createRange();if(c.setStart(u,1),c.collapse(!0),e.removeAllRanges(),e.addRange(c),D=1==e.rangeCount,e.removeAllRanges(),!o){var d=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(d&&parseInt(d[1])>=36)R=!1;else{var h=c.cloneRange();c.setStart(u,0),h.setEnd(u,3),h.setStart(u,2),e.addRange(c),e.addRange(h),R=2==e.rangeCount}}for(a.removeNode(l),e.removeAllRanges(),s=0;s<n;++s)0==s&&r?L?L(e,i[s]):(t.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),e.addRange(i[s])):e.addRange(i[s])}}(),p.selectionSupportsMultipleRanges=R,p.collapsedNonEditableSelectionsSupported=D;var I,j,B=!1;function H(t,e,n){var o=n?"end":"start",i=n?"start":"end";t.anchorNode=e[o+"Container"],t.anchorOffset=e[o+"Offset"],t.focusNode=e[i+"Container"],t.focusOffset=e[i+"Offset"]}function F(t){var e=t.nativeSelection;t.anchorNode=e.anchorNode,t.anchorOffset=e.anchorOffset,t.focusNode=e.focusNode,t.focusOffset=e.focusOffset}function z(t){t.anchorNode=t.focusNode=null,t.anchorOffset=t.focusOffset=0,t.rangeCount=0,t.isCollapsed=!0,t._ranges.length=0,W(t)}function W(t){t.type=0==t.rangeCount?"None":o(t)?"Caret":"Range"}function G(e){var n;return e instanceof u?((n=t.createNativeRange(e.getDocument())).setEnd(e.endContainer,e.endOffset),n.setStart(e.startContainer,e.startOffset)):e instanceof c?n=e.nativeRange:p.implementsDomRange&&e instanceof a.getWindow(e.startContainer).Range&&(n=e),n}function U(t){if(!t.length||1!=t[0].nodeType)return!1;for(var e=1,n=t.length;e<n;++e)if(!a.isAncestorOf(t[0],t[e]))return!1;return!0}function X(t){var n=t.getNodes();if(!U(n))throw e.createError("getSingleElementFromRange: range "+t.inspect()+" did not consist of a single element");return n[0]}function V(t){return!!t&&void 0!==t.text}function Y(t,e){var n=new c(e);t._ranges=[n],H(t,n,!1),t.rangeCount=1,t.isCollapsed=n.collapsed,W(t)}function q(e){if(e._ranges.length=0,"None"==e.docSelection.type)z(e);else{var n=e.docSelection.createRange();if(V(n))Y(e,n);else{e.rangeCount=n.length;for(var o,i=g(n.item(0)),r=0;r<e.rangeCount;++r)(o=t.createRange(i)).selectNode(n.item(r)),e._ranges.push(o);e.isCollapsed=1==e.rangeCount&&e._ranges[0].collapsed,H(e,e._ranges[e.rangeCount-1],!1),W(e)}}}function K(t,n){for(var o=t.docSelection.createRange(),i=X(n),r=g(o.item(0)),a=v(r).createControlRange(),s=0,l=o.length;s<l;++s)a.add(o.item(s));try{a.add(i)}catch(t){throw e.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}a.select(),q(t)}function Z(t,e,n){this.nativeSelection=t,this.docSelection=e,this._ranges=[],this.win=n,this.refresh()}function $(t){t.win=t.anchorNode=t.focusNode=t._ranges=null,t.rangeCount=t.anchorOffset=t.focusOffset=0,t.detached=!0,W(t)}A&&l(A,"createControlRange")&&(I=A.createControlRange(),s.areHostProperties(I,["item","add"])&&(B=!0)),p.implementsControlRange=B,o=M?function(t){return t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset}:function(t){return!!t.rangeCount&&t.getRangeAt(t.rangeCount-1).collapsed},l(N,"getRangeAt")?j=function(t,e){try{return t.getRangeAt(e)}catch(t){return null}}:M&&(j=function(e){var n=g(e.anchorNode),o=t.createRange(n);return o.setStartAndEnd(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset),o.collapsed!==this.isCollapsed&&o.setStartAndEnd(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset),o}),Z.prototype=t.selectionPrototype;var J=[];function Q(t,e){for(var n,o,i=J.length;i--;)if(o=(n=J[i]).selection,"deleteAll"==e)$(o);else if(n.win==t)return"delete"==e?(J.splice(i,1),!0):o;return"deleteAll"==e&&(J.length=0),null}var tt=function(t){if(t&&t instanceof Z)return t.refresh(),t;var e=Q(t=b(t,"getNativeSelection")),o=n(t),i=S?_(t):null;return e?(e.nativeSelection=o,e.docSelection=i,e.refresh()):(e=new Z(o,i,t),J.push({win:t,selection:e})),e};t.getSelection=tt,s.createAliasForDeprecatedMethod(t,"getIframeSelection","getSelection");var et,nt=Z.prototype;function ot(t,n){for(var o,i=g(n[0].startContainer),r=v(i).createControlRange(),a=0,s=n.length;a<s;++a){o=X(n[a]);try{r.add(o)}catch(t){throw e.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}r.select(),q(t)}if(!C&&M&&s.areHostMethods(N,["removeAllRanges","addRange"])){nt.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),z(this)};var it=function(t,e){L(t.nativeSelection,e),t.refresh()};nt.addRange=k?function(e,n){if(B&&S&&this.docSelection.type==f)K(this,e);else if(m(n)&&O)it(this,e);else{var i;R?i=this.rangeCount:(this.removeAllRanges(),i=0);var r=G(e).cloneRange();try{this.nativeSelection.addRange(r)}catch(t){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==i+1){if(t.config.checkSelectionRanges){var a=j(this.nativeSelection,this.rangeCount-1);a&&!y(a,e)&&(e=new c(a))}this._ranges[this.rangeCount-1]=e,H(this,e,rt(this.nativeSelection)),this.isCollapsed=o(this),W(this)}else this.refresh()}}:function(t,e){m(e)&&O?it(this,t):(this.nativeSelection.addRange(G(t)),this.refresh())},nt.setRanges=function(t){if(B&&S&&t.length>1)ot(this,t);else{this.removeAllRanges();for(var e=0,n=t.length;e<n;++e)this.addRange(t[e])}}}else{if(!(l(N,"empty")&&l(T,"select")&&B&&C))return e.fail("No means of selecting a Range or TextRange was found"),!1;nt.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var t;if(this.anchorNode)t=g(this.anchorNode);else if(this.docSelection.type==f){var e=this.docSelection.createRange();e.length&&(t=g(e.item(0)))}t&&(v(t).createTextRange().select(),this.docSelection.empty())}}catch(t){}z(this)},nt.addRange=function(e){this.docSelection.type==f?K(this,e):(t.WrappedTextRange.rangeToTextRange(e).select(),this._ranges[0]=e,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,H(this,e,!1),W(this))},nt.setRanges=function(t){this.removeAllRanges();var e=t.length;e>1?ot(this,t):e&&this.addRange(t[0])}}if(nt.getRangeAt=function(t){if(t<0||t>=this.rangeCount)throw new d("INDEX_SIZE_ERR");return this._ranges[t].cloneRange()},C)et=function(e){var n;t.isSelectionValid(e.win)?n=e.docSelection.createRange():(n=v(e.win.document).createTextRange()).collapse(!0),e.docSelection.type==f?q(e):V(n)?Y(e,n):z(e)};else if(l(N,"getRangeAt")&&typeof N.rangeCount==r)et=function(e){if(B&&S&&e.docSelection.type==f)q(e);else if(e._ranges.length=e.rangeCount=e.nativeSelection.rangeCount,e.rangeCount){for(var n=0,i=e.rangeCount;n<i;++n)e._ranges[n]=new t.WrappedRange(e.nativeSelection.getRangeAt(n));H(e,e._ranges[e.rangeCount-1],rt(e.nativeSelection)),e.isCollapsed=o(e),W(e)}else z(e)};else{if(!M||typeof N.isCollapsed!=i||typeof T.collapsed!=i||!p.implementsDomRange)return e.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;et=function(t){var e,n=t.nativeSelection;n.anchorNode?(e=j(n,0),t._ranges=[e],t.rangeCount=1,F(t),t.isCollapsed=o(t),W(t)):z(t)}}nt.refresh=function(t){var e=t?this._ranges.slice(0):null,n=this.anchorNode,o=this.anchorOffset;if(et(this),t){var i=e.length;if(i!=this._ranges.length)return!0;if(this.anchorNode!=n||this.anchorOffset!=o)return!0;for(;i--;)if(!y(e[i],this._ranges[i]))return!0;return!1}};var rt,at=function(t,e){var n=t.getAllRanges();t.removeAllRanges();for(var o=0,i=n.length;o<i;++o)y(e,n[o])||t.addRange(n[o]);t.rangeCount||z(t)};function st(t,e){if(t.win.document!=g(e))throw new d("WRONG_DOCUMENT_ERR")}function lt(t,e){if(e<0||e>(a.isCharacterDataNode(t)?t.length:t.childNodes.length))throw new d("INDEX_SIZE_ERR")}function ut(e){return function(n,o){var i;this.rangeCount?(i=this.getRangeAt(0))["set"+(e?"Start":"End")](n,o):(i=t.createRange(this.win.document)).setStartAndEnd(n,o),this.setSingleRange(i,this.isBackward())}}function ct(t){var e=[],n=new h(t.anchorNode,t.anchorOffset),o=new h(t.focusNode,t.focusOffset),i="function"==typeof t.getName?t.getName():"Selection";if(void 0!==t.rangeCount)for(var r=0,a=t.rangeCount;r<a;++r)e[r]=u.inspect(t.getRangeAt(r));return"["+i+"(Ranges: "+e.join(", ")+")(anchor: "+n.inspect()+", focus: "+o.inspect()+"]"}nt.removeRange=B&&S?function(t){if(this.docSelection.type==f){for(var e=this.docSelection.createRange(),n=X(t),o=g(e.item(0)),i=v(o).createControlRange(),r=!1,a=0,s=e.length;a<s;++a)e.item(a)!==n||r?i.add(e.item(a)):r=!0;i.select(),q(this)}else at(this,t)}:function(t){at(this,t)},!C&&M&&p.implementsDomRange?(rt=E,nt.isBackward=function(){return rt(this)}):rt=nt.isBackward=function(){return!1},nt.isBackwards=nt.isBackward,nt.toString=function(){for(var t=[],e=0,n=this.rangeCount;e<n;++e)t[e]=""+this._ranges[e];return t.join("")},nt.collapse=function(e,n){st(this,e);var o=t.createRange(e);o.collapseToPoint(e,n),this.setSingleRange(o),this.isCollapsed=!0},nt.collapseToStart=function(){if(!this.rangeCount)throw new d("INVALID_STATE_ERR");var t=this._ranges[0];this.collapse(t.startContainer,t.startOffset)},nt.collapseToEnd=function(){if(!this.rangeCount)throw new d("INVALID_STATE_ERR");var t=this._ranges[this.rangeCount-1];this.collapse(t.endContainer,t.endOffset)},nt.selectAllChildren=function(e){st(this,e);var n=t.createRange(e);n.selectNodeContents(e),this.setSingleRange(n)},P?nt.setBaseAndExtent=function(t,e,n,o){this.nativeSelection.setBaseAndExtent(t,e,n,o),this.refresh()}:O&&(nt.setBaseAndExtent=function(e,n,o,i){lt(e,n),lt(o,i),st(this,e),st(this,o);var r=t.createRange(node),s=-1==a.comparePoints(e,n,o,i);s?r.setStartAndEnd(o,i,e,n):r.setStartAndEnd(e,n,o,i),this.setSingleRange(r,s)}),nt.deleteFromDocument=function(){if(B&&S&&this.docSelection.type==f){for(var t,e=this.docSelection.createRange();e.length;)t=e.item(0),e.remove(t),a.removeNode(t);this.refresh()}else if(this.rangeCount){var n=this.getAllRanges();if(n.length){this.removeAllRanges();for(var o=0,i=n.length;o<i;++o)n[o].deleteContents();this.addRange(n[i-1])}}},nt.eachRange=function(t,e){for(var n=0,o=this._ranges.length;n<o;++n)if(t(this.getRangeAt(n)))return e},nt.getAllRanges=function(){var t=[];return this.eachRange((function(e){t.push(e)})),t},nt.setSingleRange=function(t,e){this.removeAllRanges(),this.addRange(t,e)},nt.callMethodOnEachRange=function(t,e){var n=[];return this.eachRange((function(o){n.push(o[t].apply(o,e||[]))})),n},nt.setStart=ut(!0),nt.setEnd=ut(!1),t.rangePrototype.select=function(t){tt(this.getDocument()).setSingleRange(this,t)},nt.changeEachRange=function(t){var e=[],n=this.isBackward();this.eachRange((function(n){t(n),e.push(n)})),this.removeAllRanges(),n&&1==e.length?this.addRange(e[0],"backward"):this.setRanges(e)},nt.containsNode=function(t,e){return this.eachRange((function(n){return n.containsNode(t,e)}),!0)||!1},nt.getBookmark=function(t){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[t])}},nt.moveToBookmark=function(e){for(var n,o,i=[],r=0;n=e.rangeBookmarks[r++];)(o=t.createRange(this.win)).moveToBookmark(n),i.push(o);e.backward?this.setSingleRange(i[0],"backward"):this.setRanges(i)},nt.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},nt.restoreRanges=function(t){this.removeAllRanges();for(var e,n=0;e=t.ranges[n];++n)this.addRange(e,t.backward&&0==n)},nt.toHtml=function(){var t=[];return this.eachRange((function(e){t.push(u.toHtml(e))})),t.join("")},p.implementsTextRange&&(nt.getNativeTextRange=function(){var n;if(n=this.docSelection){var o=n.createRange();if(V(o))return o;throw e.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return t.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw e.createError("getNativeTextRange: selection contains no range")}),nt.getName=function(){return"WrappedSelection"},nt.inspect=function(){return ct(this)},nt.detach=function(){Q(this.win,"delete"),$(this)},Z.detachAll=function(){Q(null,"deleteAll")},Z.inspect=ct,Z.isDirectionBackward=m,t.Selection=Z,t.selectionPrototype=nt,t.addShimListener((function(t){void 0===t.getSelection&&(t.getSelection=function(){return tt(t)}),t=null}))}));var B=!1,H=function(t){B||(B=!0,!E.initialized&&E.config.autoInitialize&&M())};return x&&("complete"==document.readyState?H():(s(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",H,!1),y(window,"load",H))),E}()}(nS);var oS=eS,iS={},rS={get exports(){return iS},set exports(t){iS=t}};!function(t){t.exports=function(t){return t.createModule("ClassApplier",["WrappedSelection"],(function(t,e){var n=t.dom,o=n.DomPosition,i=n.arrayContains,r=t.util,a=r.forEach,s="span",l=r.isHostMethod(document,"createElementNS");function u(t,e){for(var n in t)if(t.hasOwnProperty(n)&&!1===e(n,t[n]))return!1;return!0}function c(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function d(t,e){return!!t&&new RegExp("(?:^|\\s)"+e+"(?:\\s|$)").test(t)}function h(t,e){return"object"==typeof t.classList?t.classList.contains(e):d("string"==typeof t.className?t.className:t.getAttribute("class"),e)}function p(t,e){if("object"==typeof t.classList)t.classList.add(e);else{var n="string"==typeof t.className,o=n?t.className:t.getAttribute("class");o?d(o,e)||(o+=" "+e):o=e,n?t.className=o:t.setAttribute("class",o)}}var f=function(){function t(t,e,n){return e&&n?" ":""}return function(e,n){if("object"==typeof e.classList)e.classList.remove(n);else{var o="string"==typeof e.className,i=o?e.className:e.getAttribute("class");i=i.replace(new RegExp("(^|\\s)"+n+"(\\s|$)"),t),o?e.className=i:e.setAttribute("class",i)}}}();function g(t){return"string"==typeof t.className?t.className:t.getAttribute("class")}function v(t){return t&&t.split(/\s+/).sort().join(" ")}function y(t){return v(g(t))}function m(t,e){return y(t)==y(e)}function b(t,e){for(var n=e.split(/\s+/),o=0,i=n.length;o<i;++o)if(!h(t,c(n[o])))return!1;return!0}function x(t){var e=t.parentNode;return e&&1==e.nodeType&&!/^(textarea|style|script|select|iframe)$/i.test(e.nodeName)}function _(t,e,n,o,i){var r=t.node,a=t.offset,s=r,l=a;r==o&&a>i&&++l,r!=e||a!=n&&a!=n+1||(s=o,l+=i-n),r==e&&a>n+1&&--l,t.node=s,t.offset=l}function E(t,e,n){t.node==e&&t.offset>n&&--t.offset}function w(t,e,o,i){-1==o&&(o=e.childNodes.length);var r=t.parentNode,s=n.getNodeIndex(t);a(i,(function(t){_(t,r,s,e,o)})),e.childNodes.length==o?e.appendChild(t):e.insertBefore(t,e.childNodes[o])}function S(t,e){var o=t.parentNode,i=n.getNodeIndex(t);a(e,(function(t){E(t,o,i)})),n.removeNode(t)}function C(t,e,n,o,i){for(var r,a=[];r=t.firstChild;)w(r,e,n++,i),a.push(r);return o&&S(t,i),a}function N(t,e){return C(t,t.parentNode,n.getNodeIndex(t),!0,e)}function T(t,e){var n=t.cloneRange();n.selectNodeContents(e);var o=n.intersection(t);return""!=(o?o.toString():"")}function A(t){for(var e,n=t.getNodes([3]),o=0;(e=n[o])&&!T(t,e);)++o;for(var i=n.length-1;(e=n[i])&&!T(t,e);)--i;return n.slice(o,i+1)}function M(t,e){if(t.attributes.length!=e.attributes.length)return!1;for(var n,o,i,r=0,a=t.attributes.length;r<a;++r)if("class"!=(i=(n=t.attributes[r]).name)){if(null===n!=(null===(o=e.attributes.getNamedItem(i))))return!1;if(n.specified!=o.specified)return!1;if(n.specified&&n.nodeValue!==o.nodeValue)return!1}return!0}function O(t,e){for(var n,o=0,r=t.attributes.length;o<r;++o)if(n=t.attributes[o].name,(!e||!i(e,n))&&t.attributes[o].specified&&"class"!=n)return!0;return!1}var P=n.getComputedStyleProperty,k="boolean"==typeof document.createElement("div").isContentEditable?function(t){return t&&1==t.nodeType&&t.isContentEditable}:function(t){return!(!t||1!=t.nodeType||"false"==t.contentEditable)&&("true"==t.contentEditable||k(t.parentNode))};function R(t){var e;return t&&1==t.nodeType&&((e=t.parentNode)&&9==e.nodeType&&"on"==e.designMode||k(t)&&!k(t.parentNode))}function D(t){return(k(t)||1!=t.nodeType&&k(t.parentNode))&&!R(t)}var L=/^inline(-block|-table)?$/i;function I(t){return t&&1==t.nodeType&&!L.test(P(t,"display"))}var j=/[^\r\n\t\f \u200B]/;function B(t){if(0==t.data.length)return!0;if(j.test(t.data))return!1;switch(P(t.parentNode,"whiteSpace")){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(t.data))return!1}return I(t.previousSibling)||I(t.nextSibling)}function H(t){var e,n,i=[];for(e=0;n=t[e++];)i.push(new o(n.startContainer,n.startOffset),new o(n.endContainer,n.endOffset));return i}function F(t,e){for(var n,o,i,r=0,a=t.length;r<a;++r)n=t[r],o=e[2*r],i=e[2*r+1],n.setStartAndEnd(o.node,o.offset,i.node,i.offset)}function z(t,e){return n.isCharacterDataNode(t)?0==e?!!t.previousSibling:e!=t.length||!!t.nextSibling:e>0&&e<t.childNodes.length}function W(t,o,i,r){var a,s,l=0==i;if(n.isAncestorOf(o,t))return t;if(n.isCharacterDataNode(o)){var u=n.getNodeIndex(o);if(0==i)i=u;else{if(i!=o.length)throw e.createError("splitNodeAt() should not be called with offset in the middle of a data node ("+i+" in "+o.data);i=u+1}o=o.parentNode}if(z(o,i)){a=o.cloneNode(!1),s=o.parentNode,a.id&&a.removeAttribute("id");for(var c,d=0;c=o.childNodes[i];)w(c,a,d++,r);return w(a,s,n.getNodeIndex(o)+1,r),o==t?a:W(t,s,n.getNodeIndex(a),r)}if(t!=o){a=o.parentNode;var h=n.getNodeIndex(o);return l||h++,W(t,a,h,r)}return t}function G(t,e){return t.namespaceURI==e.namespaceURI&&t.tagName.toLowerCase()==e.tagName.toLowerCase()&&m(t,e)&&M(t,e)&&"inline"==P(t,"display")&&"inline"==P(e,"display")}function U(t){var e=t?"nextSibling":"previousSibling";return function(n,o){var i=n.parentNode,r=n[e];if(r){if(r&&3==r.nodeType)return r}else if(o&&(r=i[e])&&1==r.nodeType&&G(i,r)){var a=r[t?"firstChild":"lastChild"];if(a&&3==a.nodeType)return a}return null}}var X=U(!1),V=U(!0);function Y(t){this.isElementMerge=1==t.nodeType,this.textNodes=[];var e=this.isElementMerge?t.lastChild:t;e&&(this.textNodes[0]=e)}Y.prototype={doMerge:function(t){var e=this.textNodes,o=e[0];if(e.length>1){var i,r=n.getNodeIndex(o),s=[],l=0;a(e,(function(u,c){i=u.parentNode,c>0&&(i.removeChild(u),i.hasChildNodes()||n.removeNode(i),t&&a(t,(function(t){t.node==u&&(t.node=o,t.offset+=l),t.node==i&&t.offset>r&&(--t.offset,t.offset==r+1&&c<e.length-1&&(t.node=o,t.offset=l))}))),s[c]=u.data,l+=u.data.length})),o.data=s.join("")}return o.data},getLength:function(){for(var t=this.textNodes.length,e=0;t--;)e+=this.textNodes[t].length;return e},toString:function(){var t=[];return a(this.textNodes,(function(e,n){t[n]="'"+e.data+"'"})),"[Merge("+t.join(",")+")]"}};var q=["elementTagName","ignoreWhiteSpace","applyToEditableOnly","useExistingElements","removeEmptyElements","onElementCreate"],K={};function Z(t,e,n){var o,i,r,a,s=this;s.cssClass=s.className=t;var l=null,d={};if("object"==typeof e&&null!==e){for(void 0!==e.elementTagName&&(e.elementTagName=e.elementTagName.toLowerCase()),n=e.tagNames,l=e.elementProperties,d=e.elementAttributes,i=0;a=q[i++];)e.hasOwnProperty(a)&&(s[a]=e[a]);o=e.normalize}else o=e;s.normalize=void 0===o||o,s.attrExceptions=[];var h=document.createElement(s.elementTagName);s.elementProperties=s.copyPropertiesToElement(l,h,!0),u(d,(function(t,e){s.attrExceptions.push(t),d[t]=""+e})),s.elementAttributes=d,s.elementSortedClassName=s.elementProperties.hasOwnProperty("className")?v(s.elementProperties.className+" "+t):t,s.applyToAnyTagName=!1;var p=typeof n;if("string"==p)"*"==n?s.applyToAnyTagName=!0:s.tagNames=c(n.toLowerCase()).split(/\s*,\s*/);else if("object"==p&&"number"==typeof n.length)for(s.tagNames=[],i=0,r=n.length;i<r;++i)"*"==n[i]?s.applyToAnyTagName=!0:s.tagNames.push(n[i].toLowerCase());else s.tagNames=[s.elementTagName]}function $(t,e,n){return new Z(t,e,n)}Z.prototype={elementTagName:s,elementProperties:{},elementAttributes:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,useExistingElements:!0,removeEmptyElements:!0,onElementCreate:null,copyPropertiesToElement:function(t,e,n){var o,i,r,a,s,l,u={};for(var c in t)if(t.hasOwnProperty(c))if(a=t[c],s=e[c],"className"==c)p(e,a),p(e,this.className),e[c]=v(e[c]),n&&(u[c]=a);else if("style"==c){for(o in i=s,n&&(u[c]=r={}),t[c])t[c].hasOwnProperty(o)&&(i[o]=a[o],n&&(r[o]=i[o]));this.attrExceptions.push(c)}else e[c]=a,n&&(u[c]=e[c],l=K.hasOwnProperty(c)?K[c]:c,this.attrExceptions.push(l));return n?u:""},copyAttributesToElement:function(t,e){for(var n in t)t.hasOwnProperty(n)&&!/^class(?:Name)?$/i.test(n)&&e.setAttribute(n,t[n])},appliesToElement:function(t){return i(this.tagNames,t.tagName.toLowerCase())},getEmptyElements:function(t){var e=this;return t.getNodes([1],(function(t){return e.appliesToElement(t)&&!t.hasChildNodes()}))},hasClass:function(t){return 1==t.nodeType&&(this.applyToAnyTagName||this.appliesToElement(t))&&h(t,this.className)},getSelfOrAncestorWithClass:function(t){for(;t;){if(this.hasClass(t))return t;t=t.parentNode}return null},isModifiable:function(t){return!this.applyToEditableOnly||D(t)},isIgnorableWhiteSpaceNode:function(t){return this.ignoreWhiteSpace&&t&&3==t.nodeType&&B(t)},postApply:function(t,e,n,o){var i,r,s=t[0],l=t[t.length-1],u=[],c=s,d=l,h=0,p=l.length;a(t,(function(t){(r=X(t,!o))?(i||(i=new Y(r),u.push(i)),i.textNodes.push(t),t===s&&(c=i.textNodes[0],h=c.length),t===l&&(d=i.textNodes[0],p=i.getLength())):i=null}));var f=V(l,!o);if(f&&(i||(i=new Y(l),u.push(i)),i.textNodes.push(f)),u.length){for(var g=0,v=u.length;g<v;++g)u[g].doMerge(n);e.setStartAndEnd(c,h,d,p)}},createContainer:function(t){var e=n.getDocument(t),o=l&&!n.isHtmlNamespace(t)&&t.namespaceURI?e.createElementNS(t.namespaceURI,this.elementTagName):e.createElement(this.elementTagName);return this.copyPropertiesToElement(this.elementProperties,o,!1),this.copyAttributesToElement(this.elementAttributes,o),p(o,this.className),this.onElementCreate&&this.onElementCreate(o,this),o},elementHasProperties:function(t,e){var n=this;return u(e,(function(e,o){if("className"==e)return b(t,o);if("object"==typeof o){if(!n.elementHasProperties(t[e],o))return!1}else if(t[e]!==o)return!1}))},elementHasAttributes:function(t,e){return u(e,(function(e,n){if(t.getAttribute(e)!==n)return!1}))},applyToTextNode:function(t,e){if(x(t)){var n=t.parentNode;if(1==n.childNodes.length&&this.useExistingElements&&this.appliesToElement(n)&&this.elementHasProperties(n,this.elementProperties)&&this.elementHasAttributes(n,this.elementAttributes))p(n,this.className);else{var o=t.parentNode,i=this.createContainer(o);o.insertBefore(i,t),i.appendChild(t)}}},isRemovable:function(t){return t.tagName.toLowerCase()==this.elementTagName&&y(t)==this.elementSortedClassName&&this.elementHasProperties(t,this.elementProperties)&&!O(t,this.attrExceptions)&&this.elementHasAttributes(t,this.elementAttributes)&&this.isModifiable(t)},isEmptyContainer:function(t){var e=t.childNodes.length;return 1==t.nodeType&&this.isRemovable(t)&&(0==e||1==e&&this.isEmptyContainer(t.firstChild))},removeEmptyContainers:function(t){var e=this,n=t.getNodes([1],(function(t){return e.isEmptyContainer(t)})),o=[t],i=H(o);a(n,(function(t){S(t,i)})),F(o,i)},undoToTextNode:function(t,e,n,o){if(!e.containsNode(n)){var i=e.cloneRange();i.selectNode(n),i.isPointInRange(e.endContainer,e.endOffset)&&(W(n,e.endContainer,e.endOffset,o),e.setEndAfter(n)),i.isPointInRange(e.startContainer,e.startOffset)&&(n=W(n,e.startContainer,e.startOffset,o))}this.isRemovable(n)?N(n,o):f(n,this.className)},splitAncestorWithClass:function(t,e,n){var o=this.getSelfOrAncestorWithClass(t);o&&W(o,t,e,n)},undoToAncestor:function(t,e){this.isRemovable(t)?N(t,e):f(t,this.className)},applyToRange:function(t,e){var n=this,o=H((e=e||[])||[]);t.splitBoundariesPreservingPositions(o),n.removeEmptyElements&&n.removeEmptyContainers(t);var i=A(t);if(i.length){a(i,(function(t){n.isIgnorableWhiteSpaceNode(t)||n.getSelfOrAncestorWithClass(t)||!n.isModifiable(t)||n.applyToTextNode(t,o)}));var r=i[i.length-1];t.setStartAndEnd(i[0],0,r,r.length),n.normalize&&n.postApply(i,t,o,!1),F(e,o)}var s=n.getEmptyElements(t);a(s,(function(t){p(t,n.className)}))},applyToRanges:function(t){for(var e=t.length;e--;)this.applyToRange(t[e],t);return t},applyToSelection:function(e){var n=t.getSelection(e);n.setRanges(this.applyToRanges(n.getAllRanges()))},undoToRange:function(t,e){var n=this,o=H(e=e||[]);t.splitBoundariesPreservingPositions(o),n.removeEmptyElements&&n.removeEmptyContainers(t,o);var i,r,s=A(t),l=s[s.length-1];if(s.length){n.splitAncestorWithClass(t.endContainer,t.endOffset,o),n.splitAncestorWithClass(t.startContainer,t.startOffset,o);for(var u=0,c=s.length;u<c;++u)i=s[u],(r=n.getSelfOrAncestorWithClass(i))&&n.isModifiable(i)&&n.undoToAncestor(r,o);t.setStartAndEnd(s[0],0,l,l.length),n.normalize&&n.postApply(s,t,o,!0),F(e,o)}var d=n.getEmptyElements(t);a(d,(function(t){f(t,n.className)}))},undoToRanges:function(t){for(var e=t.length;e--;)this.undoToRange(t[e],t);return t},undoToSelection:function(e){var n=t.getSelection(e),o=t.getSelection(e).getAllRanges();this.undoToRanges(o),n.setRanges(o)},isAppliedToRange:function(t){if(t.collapsed||""==t.toString())return!!this.getSelfOrAncestorWithClass(t.commonAncestorContainer);var e=t.getNodes([3]);if(e.length)for(var n,o=0;n=e[o++];)if(!this.isIgnorableWhiteSpaceNode(n)&&T(t,n)&&this.isModifiable(n)&&!this.getSelfOrAncestorWithClass(n))return!1;return!0},isAppliedToRanges:function(t){var e=t.length;if(0==e)return!1;for(;e--;)if(!this.isAppliedToRange(t[e]))return!1;return!0},isAppliedToSelection:function(e){var n=t.getSelection(e);return this.isAppliedToRanges(n.getAllRanges())},toggleRange:function(t){this.isAppliedToRange(t)?this.undoToRange(t):this.applyToRange(t)},toggleSelection:function(t){this.isAppliedToSelection(t)?this.undoToSelection(t):this.applyToSelection(t)},getElementsWithClassIntersectingRange:function(t){var e=[],n=this;return t.getNodes([3],(function(t){var o=n.getSelfOrAncestorWithClass(t);o&&!i(e,o)&&e.push(o)})),e},detach:function(){}},Z.util={hasClass:h,addClass:p,removeClass:f,getClass:g,hasSameClasses:m,hasAllClasses:b,replaceWithOwnChildren:N,elementsHaveSameNonClassAttributes:M,elementHasNonClassAttributes:O,splitNodeAt:W,isEditableElement:k,isEditingHost:R,isEditable:D},t.CssClassApplier=t.ClassApplier=Z,t.createClassApplier=$,r.createAliasForDeprecatedMethod(t,"createCssClassApplier","createClassApplier",e)})),t}(eS)}(rS);var aS={toolbar:{allowMultiParagraphSelection:!0,buttons:["bold","colorpicker","italic","underline","strikethrough","quote","justifyLeft","justifyCenter","justifyRight","justifyFull","superscript","subscript","orderedlist","unorderedlist","pre","removeFormat","outdent","indent","h2","h3"],standardizeSelectionStart:!1,updateOnEmptySelection:!1},placeholder:{text:"请输入内容",hideOnClick:!0},disableEditing:!0},sS=Bw.extensions.button.extend({name:"colorpicker",tagNames:["mark"],contentDefault:"<b>Color</b>",aria:"Color Picker",action:"colorPicker",init:function(){var t=this;oS.init(),Bw.extensions.button.prototype.init.call(this),this.colorPicker=new Qw({parent:this.button,color:"#000",onDone:function(e){t.coloredText&&t.coloredText.isAppliedToSelection()&&t.coloredText.undoToSelection(),t.coloredText=oS.createClassApplier("colored",{elementTagName:"span",elementProperties:{style:{color:e.hex}},normalize:!0}),t.coloredText.toggleSelection(),t.base.checkContentChanged(),t.setInactive()}})},getButton:function(){return this.button},handleClick:function(){this.setActive(),this.colorPicker.show()},isAlreadyApplied:function(t){return"mark"===t.nodeName.toLowerCase()},isActive:function(){return this.button.classList.contains("medium-editor-button-active")},setInactive:function(){this.button.classList.remove("medium-editor-button-active")},setActive:function(){this.button.classList.add("medium-editor-button-active")}}),lS=function(t){function n(e){var n=t.call(this,e)||this;n.labelMap=new Map;var o=e.lf,i=e.graphModel;return n.lf=o,n.graphModel=i,n.state={tick:0},n}return f(n,t),n.prototype.componentDidMount=function(){var t=this,e=this.props.graphModel;this.editor=new Bw(".lf-label-editor",md(aS,{autoLink:!0,extensions:{colorPicker:new sS}})),e.eventCenter.on("text:update,node:mousemove,node:resize,node:rotate,node:drag,label:drop,node:drop",(function(){})),e.eventCenter.on("node:properties-change,node:properties-delete",(function(){t.setState({tick:t.state.tick+1})}))},n.prototype.componentDidUpdate=function(){var t;this.editor&&this.editor.elements.length>0?this.editor.addElements(".lf-label-editor"):(null===(t=this.editor)||void 0===t||t.destroy(),this.editor=new Bw(".lf-label-editor",md(aS,{autoLink:!0,extensions:{colorPicker:new sS}})))},n.prototype.componentWillUnmount=function(){var t;null===(t=this.editor)||void 0===t||t.destroy()},n.prototype.getLabels=function(){var t=this,e=this.props,n=e.lf.extension,o=e.graphModel,i=E(E([],_(o.nodes),!1),_(o.edges),!1);if(n.label){var r=[];return xu(i,(function(e){var n,i;xu(null!==(i=null===(n=e.getData().properties)||void 0===n?void 0:n._label)&&void 0!==i?i:[],(function(n){var i=t.labelMap,a=new Lw(n,e,o);i.set(a.id,a),r.push(fg(Rw,{label:a,element:e,graphModel:o},a.id))}))})),r}return null},n.prototype.render=function(){return fg("foreignObject",{id:"lf-label-overlay",class:"lf-label-overlay",children:this.getLabels()})},n.toolName="label-edit-tool",n=y([e.observer],n)}(e.Component);var uS=function(){function t(t){var n,o,i,r=t.lf,a=t.options;this.labelInitPositionMap=new Map,this.lf=r,this.options=null!=a?a:{},this.textOverflowMode=null!==(n=a.textOverflowMode)&&void 0!==n?n:"default",this.isMultiple=null===(o=a.isMultiple)||void 0===o||o,this.labelWidth=a.labelWidth,this.maxCount=null!==(i=a.maxCount)&&void 0!==i?i:1/0,r.graphModel.editConfigModel.updateTextMode(e.TextMode.LABEL),this.addEventListeners(),r.tool.registerTool(lS.toolName,lS),r.tool.disableTool("text-edit-tool")}return t.prototype.formatConfig=function(t,n){var o=t.editConfigModel,i=o.nodeTextEdit,r=o.edgeTextEdit,a=o.nodeTextDraggable,s=o.edgeTextDraggable,l=this,u=l.textOverflowMode,c=l.isMultiple,d=l.maxCount,h=l.labelWidth,p=n.text,f=n.zIndex,v=n.properties,y=v._label,m=v._labelOption,b=y,x=void 0===m?{}:m,_=x.isMultiple,E=x.maxCount,w=[];if(ee(b)){var S=null!=E?E:d;w=c&&_?b.length>S?b.slice(0,S):b:[b[0]]}else if(he(b))w=[b];else if("string"==typeof b||!b){var C=g(g({},p),{content:b||p.value,draggable:"edge"===n.BaseType?s:a});w=C.value?[C]:[]}return"edge"===n.BaseType&&(w=Ju(w,(function(t){var e=t.x,n=t.y;return console.log("x, y ---\x3e>>",e,n),t}))),Ju(w,(function(t){t.id||(t.id=e.createUuid());var o=t.value,l=t.content,c=t.vertical,d=t.editable,p=t.draggable,v=t.textOverflowMode,y="node"===n.BaseType?i:r,m="node"===n.BaseType?a:s;return g(g({},t),{zIndex:f,labelWidth:h,content:null!=l?l:o,vertical:null!=c&&c,editable:y&&d,draggable:m&&p,textOverflowMode:null!=v?v:u})}))},t.prototype.setupLabels=function(t){var e=this;xu(t.sortElements,(function(n){e.rewriteInnerMethods(n);var o=e.formatConfig(t,n);n.setProperty("_label",o)}))},t.prototype.addLabel=function(t,n){var o,i,r,a=this.isMultiple,s=this.maxCount,l=t.properties,u=null!==(o=l._label)&&void 0!==o?o:[],c=null!==(i=l._labelOption)&&void 0!==i?i:{},d=u.length,h={id:e.createUuid(),x:n.x,y:n.y,content:"Label".concat(d+1),value:"Label".concat(d+1),style:{},draggable:!0,editable:!0,vertical:!1};!a||d>=(null!==(r=null==c?void 0:c.maxCount)&&void 0!==r?r:s)||(u.push(h),t.setProperty("_label",u))},t.prototype.addEventListeners=function(){var t=this,n=this.lf.graphModel,o=n.eventCenter,i=n.editConfigModel;o.on("graph:rendered",(function(e){var n=e.graphModel;t.setupLabels(n)})),o.on("node:dbclick,edge:dbclick",(function(o){var r=o.e,a=o.data,s=n.getElement(a.id),l=n.getPointByClient({x:r.clientX,y:r.clientY}).canvasOverlayPosition,u={x:l.x,y:l.y};s&&i.textMode===e.TextMode.LABEL&&t.addLabel(s,u)})),o.on("node:resize",(function(t){var e,n,o=t.preData,i=t.data,r=t.model,a=null!==(e=o.properties)&&void 0!==e?e:{},s=a.width,l=a.height,u=a._label,c=void 0===u?[]:u,d=null!==(n=i.properties)&&void 0!==n?n:{},h=d.width,p=d.height;if(s&&l&&h&&p){var f={x:o.x,y:o.y,width:s,height:l},v={x:i.x,y:i.y,width:h,height:p},y=Ju(c,(function(t){var e,n,o,i,r,a,s,l,u,c,d,h=t.x,p=t.y,y=(n=v,o={x:h,y:p},i=(e=f).x,r=e.y,a=e.width,s=e.height,l=n.x,u=n.y,c=n.width,d=n.height,{x:l+(o.x-i)/a*c,y:u+(o.y-r)/s*d});return g(g({},t),y)}));r.setProperty("_label",y)}})),o.on("node:rotate",(function(e){var n=e.model,o=n.x,i=n.y,r=n.rotate,a=n.properties._label,s={x:o,y:i},l=Ju(void 0===a?[]:a,(function(e){if(!e.id)return e;var n={x:e.x,y:e.y};t.labelInitPositionMap.has(e.id)?n=t.labelInitPositionMap.get(e.id):t.labelInitPositionMap.set(e.id,n);var o=r*(180/Math.PI);o<0&&(o+=360);var i=o*(Math.PI/180),a=function(t,e,n){var o=e.x,i=e.y,r=t.x-o,a=t.y-i;return{x:r*Math.cos(n)-a*Math.sin(n)+o,y:r*Math.sin(n)+a*Math.cos(n)+i}}(n,s,i);return g(g(g({},e),a),{rotate:o})}));n.setProperty("_label",l)}))},t.prototype.rewriteInnerMethods=function(t){t.moveText=function(e,n){if(t.text){var o=t.text,i=o.x,r=o.y,a=o.value,s=o.draggable,l=o.editable;t.text={value:a,editable:l,draggable:s,x:i+e,y:r+n};var u=Is(t.getProperties());if(ee(u._label)){var c=Ju(u._label,(function(t){return g(g({},t),{x:t.x+e,y:t.y+n})}));null==t||t.setProperty("_label",c)}}}},t.prototype.updateTextMode=function(t){var n=this.lf.graphModel.editConfigModel;t!==n.textMode&&(n.updateTextMode(t),t===e.TextMode.LABEL?(this.lf.tool.enableTool(lS.toolName),this.lf.tool.disableTool("text-edit-tool")):t===e.TextMode.TEXT&&(this.lf.tool.enableTool("text-edit-tool"),this.lf.tool.disableTool(lS.toolName)))},t.prototype.render=function(){},t.prototype.destroy=function(){},t.pluginName="label",t}(),cS={};function dS(t){return t.startsWith("data:text/plain")}function hS(t){return m(this,void 0,void 0,(function(){return b(this,(function(e){return cS[t]?[2,cS[t]]:[2,new Promise((function(e,n){try{fetch(t).then((function(t){return t.blob()})).then((function(o){var i=new FileReader;i.onloadend=function(){e(cS[t]=i.result)},i.onerror=n,i.readAsDataURL(o)})).catch((function(){e(cS[t]=t)}))}catch(e){return cS[t]=t}}))]}))}))}function pS(t,e){return m(this,void 0,void 0,(function(){var n,o,i;return b(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(n=t.getAttribute(e)||"").startsWith("data:")?[2]:[4,hS(n)];case 1:return dS(o=r.sent())?[2]:(t.setAttribute(e,o),[3,3]);case 2:return i=r.sent(),console.error(i),[3,3];case 3:return[2]}}))}))}function fS(t,e){return m(this,void 0,void 0,(function(){var n,o;return b(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),e.startsWith("data:")?[2]:[4,hS(e)];case 1:return dS(n=i.sent())?[2]:(t.style.backgroundImage="url(".concat(n,")"),[3,3]);case 2:return o=i.sent(),console.error(o),[3,3];case 3:return[2]}}))}))}function gS(t){return m(this,void 0,void 0,(function(){var e,n,o,i,r,a,s,l,u;return b(this,(function(c){switch(c.label){case 0:for(e=[t],o=[];e.length;)(n=e.shift()).children.length&&e.push.apply(e,E([],_(n.children),!1)),n instanceof HTMLElement&&(i=n.style,r=i.background,a=i.backgroundImage,(s=r.match(/url\(["']?(.*?)["']?\)/))&&s[1]&&(u=s[1],o.push(fS(n,u))),(l=a.match(/url\(["']?(.*?)["']?\)/))&&l[1]&&(u=l[1],o.push(fS(n,u)))),n instanceof HTMLImageElement?o.push(pS(n,"src")):n instanceof SVGImageElement&&o.push(pS(n,"href"));return[4,Promise.all(o)];case 1:return c.sent(),[2]}}))}))}function vS(t,e,n){var o=document.createElement("canvas");o.width=e,o.height=n;var i=o.getContext("2d");return i&&i.drawImage(t,0,0,t.width,t.height,0,0,e,n),o}var yS=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.customCssRules="",this.useGlobalRules=!0,e.getSnapshot=function(t,e){return m(n,void 0,void 0,(function(){return b(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 m(n,void 0,void 0,(function(){return b(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 m(n,void 0,void 0,(function(){return b(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,o=0;o<n;o++){var i=e[o];(i.classList&&Array.from(i.classList)||[]).indexOf("lf-anchor")>-1&&(t.removeChild(t.childNodes[o]),n--,o--)}},t.prototype.removeRotateControl=function(t){for(var e=t.childNodes,n=t.childNodes&&t.childNodes.length,o=0;o<n;o++){var i=e[o];(i.classList&&Array.from(i.classList)||[]).indexOf("lf-rotate-control")>-1&&(t.removeChild(t.childNodes[o]),n--,o--)}},t.prototype.getSnapshot=function(t,e){return m(this,void 0,void 0,(function(){var n,o,i,r,a=this;return b(this,(function(s){switch(s.label){case 0:return n=this.lf.graphModel.getPartial(),o=(null!=e?e:{}).partial,i=void 0===o?n:o,r=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 m(a,void 0,void 0,(function(){return b(this,(function(o){switch(o.label){case 0:return[4,this.snapshot(t,e)];case 1:return o.sent(),this.lf.graphModel.setPartial(n),[2]}}))}))})),[3,3]);case 1:return[4,this.snapshot(t,e)];case 2:s.sent(),s.label=3;case 3:return this.lf.updateEditConfig(r),[2]}}))}))},t.prototype.snapshot=function(t,e){return m(this,void 0,void 0,(function(){var n,o,i,r,a,s,l,u,c,d=this;return b(this,(function(h){switch(h.label){case 0:return o=(n=null!=e?e:{}).fileType,i=void 0===o?"png":o,r=n.quality,this.fileName="".concat(null!=t?t:"logic-flow.".concat(Date.now()),".").concat(i),[4,gS(a=this.getSvgRootElement(this.lf))];case 1:return h.sent(),"svg"===i?(s=this.cloneSvg(a),l=(new XMLSerializer).serializeToString(s),u=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(u),this.triggerDownload(c)):this.getCanvasData(a,null!=e?e:{}).then((function(t){var e=t.toDataURL("image/".concat(i),r).replace("image/".concat(i),"image/octet-stream");d.triggerDownload(e)})),[2]}}))}))},t.prototype.getSnapshotBase64=function(t,e){return m(this,void 0,void 0,(function(){var n,o=this;return b(this,(function(i){switch(i.label){case 0:return[4,gS(n=this.getSvgRootElement(this.lf))];case 1:return i.sent(),[2,new Promise((function(i){o.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 m(this,void 0,void 0,(function(){var n,o=this;return b(this,(function(i){switch(i.label){case 0:return[4,gS(n=this.getSvgRootElement(this.lf))];case 1:return i.sent(),[2,new Promise((function(i){o.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 o=e[n];try{for(var i=0;i<o.cssRules.length;i++)t+=o.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 m(this,void 0,void 0,(function(){var n,o,i,r,a,s,l,u,c,d,h,p,f,g,v,y,m,x,_,E,w,S,C,N,T,A;return b(this,(function(b){return n=e.width,o=e.height,i=e.backgroundColor,r=e.padding,a=void 0===r?40:r,s=this.cloneSvg(t,!1),(l=window.devicePixelRatio||1)<1&&(l=1),u=this.lf.graphModel.rootEl.querySelector(".lf-base"),c=u.getBoundingClientRect(),d=this.lf.container.querySelector(".lf-canvas-overlay"),h=d.getBoundingClientRect(),p=c.x-h.x,f=c.y-h.y,g=this.lf.graphModel,v=g.transformModel,y=v.SCALE_X,m=v.SCALE_Y,x=v.TRANSLATE_X,_=v.TRANSLATE_Y,s.lastChild.style.transform="matrix(1, 0, 0, 1, ".concat((-p+x)*(1/y),", ").concat((-f+_)*(1/m),")"),E=Math.ceil(c.width/y),w=Math.ceil(c.height/m),(S=document.createElement("canvas")).style.width="".concat(E,"px"),S.style.height="".concat(w,"px"),S.width=E*l+2*a,S.height=w*l+2*a,(C=S.getContext("2d"))&&(C.clearRect(0,0,S.width,S.height),C.scale(l,l),i?(C.fillStyle=i,C.fillRect(0,0,S.width,S.height)):C.clearRect(0,0,S.width,S.height)),N=new Image,(T=document.createElement("style")).innerHTML=this.getClassRules(),(A=document.createElement("foreignObject")).appendChild(T),s.appendChild(A),[2,new Promise((function(t){N.onload=function(){var e=navigator.userAgent.indexOf("Firefox")>-1;try{e?createImageBitmap(N,{resizeWidth:n&&o?vS(S,n,o).width:S.width,resizeHeight:n&&o?vS(S,n,o).height:S.height}).then((function(e){null==C||C.drawImage(e,a/l,a/l),t(n&&o?vS(S,n,o):S)})):(null==C||C.drawImage(N,a/l,a/l),t(n&&o?vS(S,n,o):S))}catch(e){null==C||C.drawImage(N,a/l,a/l),t(n&&o?vS(S,n,o):S)}};var e="data:image/svg+xml;charset=utf-8,".concat((new XMLSerializer).serializeToString(s)).replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23");N.src=e}))]}))}))},t.prototype.cloneSvg=function(t,e){var n,o=this;void 0===e&&(e=!0);var i=t.cloneNode(!0),r=i.lastChild,a=null===(n=null==r?void 0:r.childNodes)||void 0===n?void 0:n.length;if(a)for(var s=0;s<a;s++){var l=null==r?void 0:r.childNodes[s],u=l.classList&&Array.from(l.classList);if(u&&u.indexOf("lf-base")<0)null==r||r.removeChild(r.childNodes[s]),a--,s--;else{var c=null==r?void 0:r.childNodes[s];c&&c.childNodes.forEach((function(t){var e=t;o.removeAnchor(e.firstChild),o.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}(),mS=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,o=[];e.nodes.forEach((function(e){n.set(e.id,{id:e.id,data:e,nextNodes:[]}),e.type===t.startNodeType&&o.push(e.id)})),e.edges.forEach((function(t){var e=n.get(t.sourceNodeId);null==e||e.nextNodes.push(t.targetNodeId)}));var i=[];return o.forEach((function(e){var o=n.get(e);o&&(i=i.concat(t.findPathElements(o,n,[])))})),this.getNewPathes(i)},t.prototype.findPathElements=function(t,e,n){void 0===n&&(n=[]);var o=E([],_(n),!1);if(o.push(t.id),0===t.nextNodes.length)return[o];for(var i=[],r=0;r<t.nextNodes.length;r++){var a=e.get(t.nextNodes[r]),s=void 0;if(a){var l=o.indexOf(a.id);s=-1!==l?[E(E([],_(o.slice(l)),!1),[a.id],!1)]:this.findPathElements(a,e,E([],_(o),!1)),i=i.concat(s)}}return i},t.prototype.getNewPathes=function(t){var e=this,n=[],o=new Set;t.forEach((function(t){var i=e.getNewId("path"),r=e.getNewId("路径"),a=e.isLoopPath(t),s=t.join(",");o.has(s)||(o.add(s),n.push({routeId:i,name:r,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 o=i[n],r=e.similar2Path(E([],_(t.elements),!1),E([],_(o.elements),!1));r>t.weight&&o.weight<=r&&(t.weight=r,t.similarElement=o,r===o.weight&&o.similarElement?(o.similarElement.similarElement=null,o.similarElement.weight=0,o.similarElement=null,o.weight=0):(o.similarElement=t,o.weight=r))}})),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,o=t.length+e.length;t.sort(),e.sort();for(var i=t.shift(),r=e.shift();void 0!==i&&void 0!==r;)i===r?(n++,i=t.shift(),r=e.shift()):i<r?i=t.shift():i>r&&(r=e.shift());return n/o*200},t.prototype.getNewId=function(t){return"".concat(t,"_").concat(C())},t.prototype.isLoopPath=function(t){var e=t.length;return t.indexOf(t[e-1])!==e-1?1:0},t.pluginName="flowPath",t}(),bS=-1,xS=0,_S=1,ES=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 o=n.lf.getPathes();return n.levelHeight=[],n.newNodeMap=new Map,n.layout(e,o)}}return t.prototype.layout=function(t,e){var n=this,o=[];e.forEach((function(t){var e=t.elements;e.length>o.length?o=e:e.length===o.length&&JSON.stringify(e)===JSON.stringify(n.trunk)&&(o=n.trunk)})),this.trunk=o;for(var i=this.formatData(t),r={nodes:[],edges:[]},a=o.length-1;a>=0;a--)this.setNodePosition(o[a],i,r,a,1);this.lf.graphModel.graphDataToModel(r)},t.prototype.setNodePosition=function(t,e,n,o,i){var r=this,a=e[t],s=a.text,l=a.type,u=a.next,c=a.properties,d=160*o+40,h=120*i,p={id:t,x:d,text:s,y:h,type:l,properties:c};return s&&"object"==typeof s&&(p.text=g(g({},s),{x:d+s.x,y:h+s.y})),this.newNodeMap.set(p.id,{x:p.x,y:p.y,type:l}),n.nodes.push(p),a.isFixed=!0,this.addLevelHeight(o,1),u&&u.length>0&&u.forEach((function(i){if(!e[i.nodeId].isFixed){var a=r.getLevelHeight(o+1);r.addLevelHeight(o,1),r.setNodePosition(i.nodeId,e,n,o+1,a+1)}n.edges.push(g({id:i.edgeId,type:i.edgeType,sourceNodeId:t,targetNodeId:i.nodeId,properties:i.properties,text:i.text},r.getEdgeDataPoints(t,i.nodeId)))})),p},t.prototype.getEdgeDataPoints=function(t,e){var n=this.newNodeMap.get(t),o=this.newNodeMap.get(e),i=this.getShape(t),r=i.width,a=i.height,s=this.getShape(e),l=s.width,u=s.height,c=this.getRelativePosition(n,o),d={x:n.x,y:n.y},h={x:o.x,y:o.y};switch(c){case xS:d.x=n.x+r/2,h.x=o.x-l/2;break;case bS:d.y=n.y+a/2,h.x=o.x-l/2;break;case _S:d.x=n.x+r/2,h.y=o.y+u/2}return{startPoint:d,endPoint:h}},t.prototype.getRelativePosition=function(t,e){var n=t.y,o=e.y;return n<o?-1:n===o?0:1},t.prototype.getShape=function(t){var e,n,o=this.lf.getNodeModelById(t);return{height:null!==(e=null==o?void 0:o.height)&&void 0!==e?e:0,width:null!==(n=null==o?void 0:o.width)&&void 0!==n?n:0}},t.prototype.formatData=function(t){var e=t.nodes.reduce((function(t,e){var n=e.type,o=e.properties,i=e.text,r=e.x,a=e.y;return i&&"object"==typeof i&&(i.x=i.x-r,i.y=i.y-a),t[e.id]={type:n,properties:o,text:i,prev:[],next:[]},t}),{});return t.edges.forEach((function(t){var n=t.sourceNodeId,o=t.targetNodeId,i=t.id,r=t.properties,a=t.text,s=a;"object"==typeof a&&(s=a.value),e[n].next.push({edgeId:i,nodeId:o,edgeType:t.type,properties:r,text:s}),e[o].prev.push({edgeId:i,nodeId:n,properties:r,text:s})})),e},t.prototype.addLevelHeight=function(t,e,n){void 0===e&&(e=1),void 0===n&&(n=!1);var o=this.levelHeight[t];o||(o={positiveHeight:0,negativeHeight:0},this.levelHeight[t]=o),n?o.negativeHeight-=e:o.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}(),wS=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",o=document.createElement("div"),i=[];return o.className="lf-control",this.controlItems.forEach((function(o){var r=document.createElement("div"),a=document.createElement("i"),s=document.createElement("span");switch(r.className=n,o.onClick&&(r.onclick=o.onClick.bind(null,t.lf)),o.onMouseEnter&&(r.onmouseenter=o.onMouseEnter.bind(null,t.lf)),o.onMouseLeave&&(r.onmouseleave=o.onMouseLeave.bind(null,t.lf)),a.className=o.iconClass,s.className="lf-control-text",s.title=o.title,s.innerText=o.text,r.append(a,s),o.text){case"上一步":t.lf.on("history:change",(function(t){var o=t.data.undoAble;r.className=o?e:n}));break;case"下一步":t.lf.on("history:change",(function(t){var o=t.data.redoAble;r.className=o?e:n}));break;default:r.className=e}i.push(r)})),o.append.apply(o,E([],_(i),!1)),o},t.pluginName="control",t}(),SS="lf:defaultNodeMenu",CS="lf:defaultEdgeMenu",NS="lf:defaultGraphMenu",TS="lf:defaultSelectionMenu",AS=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,o,i=this,r=[{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(SS,r);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(CS,a),null===(n=this.menuTypeMap)||void 0===n||n.set(NS,[]);var s=[{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===(o=this.menuTypeMap)||void 0===o||o.set(TS,s)},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,o,i=t.data,r=t.position,a=t.e,s=r.domOverlayPosition,l=s.x,u=s.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===(o=n.menuTypeMap)||void 0===o?void 0:o.get(SS)),n.__currentData=i,n.showMenu(l,u,h,{width:d.width,height:d.height,clientX:a.clientX,clientY:a.clientY})}})),this.lf.on("edge:contextmenu",(function(t){var e,o,i,r=t.data,a=t.position,s=t.e,l=a.domOverlayPosition,u=l.x,c=l.y,d=r.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===(o=n.menuTypeMap)||void 0===o?void 0:o.get(CS))&&void 0!==i?i:[]),n.__currentData=r,n.showMenu(u,c,p,{width:h.width,height:h.height,clientX:s.clientX,clientY:s.clientY})}})),this.lf.on("blank:contextmenu",(function(t){var e,o,i=t.position,r=null!==(o=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(NS))&&void 0!==o?o:[],a=i.domOverlayPosition,s=a.x,l=a.y;n.showMenu(s,l,r)})),this.lf.on("selection:contextmenu",(function(t){var e,o=t.data,i=t.position,r=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(TS),a=i.domOverlayPosition,s=a.x,l=a.y;n.__currentData=o,n.showMenu(s,l,r)})),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,o){if(n&&n.length){var i=this.__menuDOM;if(i){if(i.innerHTML="",i.append.apply(i,E([],_(this.__getMenuDom(n)),!1)),!i.children.length)return;if(i.style.display="block",!o)return i.style.top="".concat(e,"px"),void(i.style.left="".concat(t,"px"));var r=o.width,a=o.height,s=o.clientX,l=o.clientY,u=this.lf.graphModel,c=i.offsetWidth,d=!0,h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,p=h-s,f=u.rootEl.getBoundingClientRect(),g=f.left+f.width;g<h&&(p=g-s),p<c&&(d=!1),i.style.left="".concat(d?t:t-r,"px");var v=i.offsetHeight,y=!0,m=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,b=m-l,x=f.top+f.height;x<m&&(b=x-l),b<v&&(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 o=document.createElement("span");o.className="lf-menu-item-icon",n.appendChild(o)}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,o;t&&(void 0!==t.nodeMenu&&(null===(e=this.menuTypeMap)||void 0===e||e.set(SS,t.nodeMenu?t.nodeMenu:[])),void 0!==t.edgeMenu&&(null===(n=this.menuTypeMap)||void 0===n||n.set(CS,t.edgeMenu?t.edgeMenu:[])),void 0!==t.graphMenu&&(null===(o=this.menuTypeMap)||void 0===o||o.set(NS,t.graphMenu?t.graphMenu:[])))},t.prototype.addMenuConfig=function(t){var e,n,o,i,r,a,s,l,u;if(t){if(Array.isArray(t.nodeMenu)){var c=null!==(n=null===(e=this.menuTypeMap)||void 0===e?void 0:e.get(SS))&&void 0!==n?n:[];null===(o=this.menuTypeMap)||void 0===o||o.set(SS,c.concat(t.nodeMenu))}if(Array.isArray(t.edgeMenu)){c=null!==(r=null===(i=this.menuTypeMap)||void 0===i?void 0:i.get(CS))&&void 0!==r?r:[];null===(a=this.menuTypeMap)||void 0===a||a.set(CS,c.concat(t.edgeMenu))}if(Array.isArray(t.graphMenu)){c=null!==(l=null===(s=this.menuTypeMap)||void 0===s?void 0:s.get(NS))&&void 0!==l?l:[];null===(u=this.menuTypeMap)||void 0===u||u.set(NS,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}(),MS="menu-common",OS=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(MS,[]),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(MS,t)},t.prototype.getContextMenuPosition=function(){var t=this._activeData,e=this.lf.graphModel.getElement(t.id);if(e){var n,o;if("edge"===e.BaseType){n=Number.MIN_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER;var i=e.getData();n=Math.max(i.startPoint.x,n),o=Math.min(i.startPoint.y,o),n=Math.max(i.endPoint.x,n),o=Math.min(i.endPoint.y,o),i.pointsList&&i.pointsList.forEach((function(t){n=Math.max(t.x,n),o=Math.min(t.y,o)}))}return"node"===e.BaseType&&(n=t.x+e.width/2,o=t.y-e.height/2),this.lf.graphModel.transformModel.CanvasPointToHtmlPoint([n,o])}},t.prototype.createContextMenu=function(){var t=this;if(!this.lf.options.isSilentMode){var e=E(E([],_(this.menuTypeMap.get(this._activeData.type)||[]),!1),_(this.menuTypeMap.get(MS)||[]),!1),n=document.createDocumentFragment();e.forEach((function(e){var o=document.createElement("div");o.className="lf-context-item";var i=document.createElement("img");i.src=e.icon,i.className="lf-context-img",e.className&&(o.className="".concat(o.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})})),o.appendChild(i),n.appendChild(o)})),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 o=this.lf.getNodeModelById(t.sourceId);if(o){var i=t.x-o.width+200,r=e-t.y/2-20,a=t.x+o.width+200,s=e+t.y/2+20;if(this.lf.getAreaElement([i,r],[a,s]).length)return e+=100,void this.addNode(t,e);if(t.type){var l=this.lf.addNode({type:t.type,x:t.x+200,y:e,properties:t.properties}),u=void 0,c=void 0;n&&(u={x:t.x,y:t.y+o.height/2},c={x:l.x-l.width/2,y:l.y}),this.lf.addEdge({sourceNodeId:t.sourceId,targetNodeId:l.id,startPoint:u,endPoint:c})}}},t.prototype.showMenu=function(){var t=this.getContextMenuPosition();if(t){var e=_(t,2),n=e[0],o=e[1];this.__menuDOM.style.display="flex",this.__menuDOM.style.top="".concat(o,"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}(),PS=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 o=document.createElement("div");if(o.className="lf-dnd-shape",t.icon&&(o.style.backgroundImage="url(".concat(t.icon,")")),n.appendChild(o),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}(),kS=function(){function t(t){var e=t.lf,n=t.LogicFlow,o=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,o=(e-i.startPosition.x)/i.scale,r=(n-i.startPosition.y)/i.scale,a=i.viewPortLeft+o+i.viewPortWidth/i.scale/2,s=i.viewPortTop+r+i.viewPortHeight/i.scale/2;i.startPosition={x:e,y:n},i.lf.focusOn({coordinate:{x:a,y:s}})},this.drop=function(){document.removeEventListener("mousemove",i.drag),document.removeEventListener("mouseup",i.drop)},this.mapClick=function(t){var e=t.offsetX,n=t.offsetY,o=i.translateX+e/i.scale,r=i.translateY+n/i.scale;i.lf.focusOn({coordinate:{x:o,y:r}})},this.lf=e,this.LFCtor=n,o&&this.setOption(o),this.viewPortWidth=e.graphModel.width,this.viewPortHeight=e.graphModel.height;var r={left:0,right:this.viewPortWidth,top:0,bottom:this.viewPortHeight};this.bounds=r,this.elementAreaBounds=r,this.viewPortBounds=r,this.initMiniMap()}return t.prototype.setOption=function(t){var e=t.width,n=void 0===e?150:e,o=t.height,i=void 0===o?220:o,r=t.showEdge,a=void 0!==r&&r,s=t.isShowHeader,l=void 0!==s&&s,u=t.isShowCloseIcon,c=void 0!==u&&u,d=t.leftPosition,h=t.topPosition,p=t.rightPosition,f=void 0===p?0:p,g=t.bottomPosition,v=void 0===g?0:g,y=t.headerTitle,m=void 0===y?"导航":y;this.width=n,this.height=i,this.showEdge=a,this.isShowHeader=l,this.isShowCloseIcon=c,this.leftPosition=d,this.rightPosition=void 0!==d?void 0:f,this.topPosition=h,this.bottomPosition=void 0!==h?void 0:v,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,o=document.createElement("div");this.miniMapContainer=o,o.appendChild(this.miniMapWrap),o.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(),o.className="lf-mini-map",this.isShowCloseIcon||o.classList.add("lf-mini-map-no-close-icon"),this.isShowHeader||o.classList.add("lf-mini-map-no-header"),null===(n=this.container)||void 0===n||n.appendChild(o),this.miniMapWrap.appendChild(this.viewport);var i=document.createElement("div");i.className="lf-mini-map-header",i.innerText=this.headerTitle,o.appendChild(i);var r=document.createElement("span");r.className="lf-mini-map-close",r.addEventListener("click",this.hide),o.appendChild(r)},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,o,i=t.x,r=t.y,a=null!==(n=t.width)&&void 0!==n?n:200,s=null!==(o=t.height)&&void 0!==o?o:200,l=i-a/2,u=i+a/2,c=r-s/2,d=r+s/2;e.left=Math.min(l,e.left),e.right=Math.max(u,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,o=t.SCALE_X,i=t.SCALE_Y,r=this.lf.graphModel,a=r.width,s=r.height;this.viewPortBounds={left:-e/o,right:(-e+a)/o,top:-n/i,bottom:(-n+s)/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 o=this.lf.getGraphRawData(),i=this.resetData(o),r=this.lf.viewMap,a=this.lf.graphModel.modelMap,s=this.lfMap.viewMap;try{for(var l=x(r.keys()),u=l.next();!u.done;u=l.next()){var c=u.value;s.has(c)||this.lfMap.register({type:c,view:r.get(c),model:a.get(c)})}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}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,g=d.bottom-p,v=this.width/f,y=this.height/g,m=Math.min(v,y);this.scale=m;var b=h-(this.width/m-f)/2,_=p-(this.height/m-g)/2;if(this.lfMap.graphModel.transformModel.translate(-b+this.translateX,-_+this.translateY),this.translateX=b,this.translateY=_,this.miniMapWrap.firstChild){var E=this.miniMapWrap.firstChild.style;E.pointerEvents="none",E.transform="matrix(".concat(m,", 0, 0, ").concat(m,", 0, 0)"),E.transformOrigin="left top",E.height="".concat(this.height/m,"px"),E.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,o=e.TRANSLATE_Y,i=e.SCALE_X,r=e.SCALE_Y,a=this.lf.graphModel,s=a.width,l=a.height;this.viewPortLeft=-n/i,this.viewPortTop=-o/r,this.viewPortWidth=s/i*this.scale,this.viewPortHeight=l/r*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}(),RS=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,o=e.x,i=e.y;if(n.endPoint={x:o,y:i},n.startPoint){var r=n.startPoint,a=r.x,s=r.y,l=a,u=s,c=o-a,d=i-s;o<a&&(l=o,c=a-o),i<s&&(u=i,d=s-i),n.wrapper&&(n.wrapper.style.left="".concat(l,"px"),n.wrapper.style.top="".concat(u,"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,o=e.x,i=e.y,r=n.endPoint,a=r.x,s=r.y,l=[Math.min(o,a),Math.min(i,s)],u=[Math.max(o,a),Math.max(i,s)];if(n.lf.emit("selection:selected-area",{topLeft:l,bottomRight:u}),Math.abs(a-o)<10&&Math.abs(s-i)<10)return;var c=n.lf.graphModel.getAreaElement(l,u,n.isWholeEdge,n.isWholeNode,!0),d=n.lf.graphModel.dynamicGroup;c.forEach((function(t){d&&d.getGroupByNodeId(t.id)||n.lf.selectElementById(t.id,!0)})),n.lf.emit("selection:selected",{elements:c,leftTopPoint:l,rightBottomPoint:u})}},this.lf=e;var o=e.getEditConfig().stopMoveGraph;this.isDefaultStopMoveGraph=o,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(o){var i=o.e;if(t.getEditConfig().stopMoveGraph&&!n.disabled&&!(2===i.button)){var r=t.getPointByClient(i.clientX,i.clientY).domOverlayPosition,a=r.x,s=r.y;n.startPoint={x:a,y:s},n.endPoint={x:a,y:s};var l=document.createElement("div");l.className="lf-selection-select",l.oncontextmenu=function(t){t.preventDefault()},l.style.top="".concat(n.startPoint.y,"px"),l.style.left="".concat(n.startPoint.x,"px"),e.appendChild(l),n.wrapper=l,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}(),DS=function(t,e){var n=[],o=[],i=function(t,o,r){r&&o.unshift.apply(o,E([],_(e.getEdgeModels({sourceNodeId:t.id,targetNodeId:null==r?void 0:r.id}).map((function(t){return t.id}))),!1)),o.includes(t.id)?n.push(o):(o.unshift(t.id),t.incoming.nodes.length?t.incoming.nodes.forEach((function(e){i(e,o.slice(),t)})):n.push(o))},r=function(t,n,i){i&&n.push.apply(n,E([],_(e.getEdgeModels({sourceNodeId:null==i?void 0:i.id,targetNodeId:t.id}).map((function(t){return t.id}))),!1)),n.includes(t.id)?o.push(n):(n.push(t.id),t.outgoing.nodes.length?t.outgoing.nodes.forEach((function(e){r(e,n.slice(),t)})):o.push(n))};return i(t,[]),r(t,[]),E([],_(new Set(E(E([],_(n.flat()),!1),_(o.flat()),!1))),!1)},LS=function(){function t(t){var e=t.lf,n=t.options;this.mode="path",this.enable=!0,this.tempStyles={};var o=n.mode,i=void 0===o?"path":o,r=n.enable,a=void 0===r||r;this.lf=e,this.mode=i,this.enable=a}return t.prototype.setMode=function(t){this.mode=t},t.prototype.setEnable=function(t){this.enable=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.highlightNeighbours=function(t){var e=this,n=this.lf.getModelById(t);if("node"===(null==n?void 0:n.BaseType)){n.updateStyles(this.tempStyles[t]);var o=n.incoming,i=o.nodes,r=o.edges,a=n.outgoing,s=a.nodes,l=a.edges;js(i,s).forEach((function(t){t.updateStyles(e.tempStyles[t.id])})),js(r,l).forEach((function(t){t.updateStyles(e.tempStyles[t.id])}))}else"edge"===(null==n?void 0:n.BaseType)&&(n.updateStyles(this.tempStyles[t]),n.sourceNode.updateStyles(this.tempStyles[n.sourceNode.id]),n.targetNode.updateStyles(this.tempStyles[n.targetNode.id]))},t.prototype.highlightPath=function(t){var e=this,n=function(t,e){var n=e.getModelById(t);return DS("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.enable)&&(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]=g({},e),t.setStyles({opacity:.1})})),{single:this.highlightSingle.bind(this),neighbour:this.highlightNeighbours.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,o=null!==(n=t.tempStyles[e.id])&&void 0!==n?n:{};e.updateStyles(g({},o))})),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}(),IS={tr:"tl",lb:"tl",tl:"tr",rb:"tr",br:"bl",lt:"bl",bl:"br",rt:"br"};function jS(t,e,n,o){var i,r="",a="";t[0]===e[0]?r=t[1]>e[1]?"t":"b":t[1]===e[1]&&(r=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 s=Math.min(Math.hypot(e[0]-t[0],e[1]-t[1])/2,Math.hypot(n[0]-e[0],n[1]-e[1])/2,o)||.2*o,l="".concat(r).concat(a),u=IS[l]||"-",c="L ".concat(t[0]," ").concat(t[1]);if("-"===u)c+="L ".concat(e[0]," ").concat(e[1]," L ").concat(n[0]," ").concat(n[1]);else{var d=_(function(t,e,n,o){var i=[t[0],t[1]],r=[t[0],t[1]];switch(n){case"tl":return"tr"===e?(i[1]+=o,r[0]+=o):"lb"===e&&(i[0]+=o,r[1]+=o),[i,r];case"tr":return"tl"===e?(i[1]+=o,r[0]-=o):"rb"===e&&(i[0]-=o,r[1]+=o),[i,r];case"bl":return"br"===e?(i[1]-=o,r[0]+=o):"lt"===e&&(i[0]+=o,r[1]-=o),[i,r];case"br":return"bl"===e?(i[1]-=o,r[0]-=o):"rt"===e&&(i[0]-=o,r[1]-=o),[i,r];default:return[]}}(e,l,u,s),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=_(p,2),e[0]=i[0],e[1]=i[1])}return c}function BS(t,e){var n=0,o="";if(2===t.length)o+="M".concat(t[n][0]," ").concat(t[n++][1]," L ").concat(t[n][0]," ").concat(t[n][1]);else{for(o+="M".concat(t[n][0]," ").concat(t[n++][1]);n+1<t.length;){o+=jS(t[n-1],t[n],t[1+n++],e)}o+="L ".concat(t[n][0]," ").concat(t[n][1])}return o}var HS=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,o=t.isAnimation,i=t.arrowConfig,r=t.radius,a=void 0===r?5:r,s=t.getEdgeStyle(),l=t.getEdgeAnimationStyle(),u=function(t){for(var e=t,n=1;n<e.length-1;){var o=_(e[n-1],2),i=o[0],r=o[1],a=_(e[n],2),s=a[0],l=a[1],u=_(e[n+1],2),c=u[0],d=u[1];i===s&&s===c||r===l&&l===d?e.splice(n,1):n++}return e}(n.split(" ").map((function(t){return t.split(",").map((function(t){return+t}))}))),c=BS(u,a),d=g(g(g({style:o?l:{}},s),i),{fill:"none"});return e.h("path",g({d:c},d))},n}(e.PolylineEdge),FS=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e}(e.PolylineEdgeModel),zS=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,o=t.x,i=t.y,r=t.width,a=t.height,s=t.properties,l=this.props.model.getNodeStyle();return e.h("svg",{x:o-r/2,y:i-a/2,width:50,height:24,style:"z-index: 0; background: none; overflow: auto;"},[s.labelText?e.h("text",{x:0,y:-5,fontSize:"16px",fill:l.stroke},s.labelText):"",s.disabledDelete?"":e.h("text",{x:s.labelText?50:0,y:-5,fontSize:"24px",cursor:"pointer",fill:l.stroke,onclick:this.handleCustomDeleteIconClick.bind(this,n)},"x")])},n.prototype.getShape=function(){var t=this.props.model,n=t.x,o=t.y,i=t.width,r=t.height,a=t.id,s=this.props.model.getNodeStyle();return e.h("g",{},[e.h("rect",g(g({},s),{x:n-i/2,y:o-r/2,width:i,height:r,id:a})),this.getLabelShape()])},n.prototype.toFront=function(){},n.prototype.handleCustomDeleteIconClick=function(t){this.props.graphModel.deleteNode(t)},n}(e.PolygonNode),WS=function(t){function e(){var e=t.apply(this,E([],_(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=[],o=1/0,i=1/0,r=-1/0,a=-1/0;t.forEach((function(t){var n=e.graphModel.getNodeModelById(t);if(n){var s=n.width,l=n.height,u=n.x,c=n.y;o=Math.min(o,u-s/2-e.d),i=Math.min(i,c-l/2-e.d),r=Math.max(r,u+s/2+e.d),a=Math.max(a,c+l/2+e.d)}})),n.push([o,i],[r,i],[r,a],[o,a]),[o,i,r,a].some((function(t){return Math.abs(t)===1/0}))||(this.updatePoints(n),this.updateCoordinate({x:(r+o)/2,y:(a+i)/2}))},e}(e.PolygonNodeModel),GS=function(){function t(t){var e=t.lf;this.selectNodes=[],this.d=10,e.register({type:"node-selection",view:zS,model:WS})}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(),o=e.filter((function(e){return e!==t.currentClickNode.id}));return n.nodes.find((function(t){if("node-selection"===t.type){var e=Bi(t,"properties.node_selection_ids",[]);return o.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 o=!1;e.selectNodesIds.includes(n.data.id)&&(e.lf.getNodeModelById(n.data.id).setSelected(!1),o=!0);var i=t.getSelectElements(!0).nodes;e.selectNodes=i,1===e.selectNodes.length?o?e.updateNodeSelection():e.addNodeSelection():e.selectNodes.length>1&&e.updateNodeSelection()}})),t.graphModel.addNodeMoveRules((function(e,n,o){if("node-selection"===e.type){var i=e.properties.node_selection_ids;return t.graphModel.moveNodes(i,n,o,!0),!0}return!0}))},t.pluginName="node-selection",t}(),US=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.x,o=t.y,i=t.width,r=t.height,a=t.properties;return e.h("text",{x:n-i/2+5,y:o-r/2+16,fontSize:12,fill:"blue"},a.moreText)},n.prototype.getShape=function(){var t=this.props.model,n=t.x,o=t.y,i=t.width,r=t.height,a=this.props.model.getNodeStyle();return e.h("g",{},[e.h("rect",g(g({},a),{fill:"#FFFFFF",x:n-i/2,y:o-r/2})),this.getLabelShape()])},n}(e.RectNode),XS={pluginName:"rectLabelNode",install:function(t){t.register({type:"rect-label",model:e.RectNodeModel,view:US})}};t.AutoLayout=ES,t.BPMNAdapter=Mv,t.BPMNBaseAdapter=Av,t.BPMNElements=Wg,t.BoundaryEventFactory=xt,t.BpmnAdapter=ct,t.BpmnElement=U,t.BpmnXmlAdapter=dt,t.ContextMenu=OS,t.Control=wS,t.CurvedEdge=HS,t.CurvedEdgeModel=FS,t.DiamondResize=wg,t.DiamondResizeModel=_g,t.DiamondResizeView=Eg,t.DndPanel=PS,t.DynamicGroup=_w,t.DynamicGroupNode=vw,t.DynamicGroupNodeModel=yw,t.EllipseResize=xg,t.EllipseResizeModel=mg,t.EllipseResizeView=bg,t.EndEventFactory=yt,t.EndEventModel=M,t.EndEventView=O,t.ExclusiveGatewayModel=L,t.ExclusiveGatewayView=I,t.FlowPath=mS,t.GatewayNodeFactory=Rt,t.Group=Lg,t.GroupNode=kg,t.GroupNodeModel=Pg,t.Highlight=LS,t.HtmlResize=Ng,t.HtmlResizeModel=Sg,t.HtmlResizeView=Cg,t.InsertNodeInPolyline=Aw,t.IntermediateCatchEventFactory=mt,t.IntermediateThrowEventFactory=_t,t.Label=uS,t.Menu=AS,t.MiniMap=kS,t.NodeResize=Og,t.NodeSelection=GS,t.RectLabelNode=XS,t.RectResize=Mg,t.RectResizeModel=Tg,t.RectResizeView=Ag,t.SelectionSelect=RS,t.SequenceFlowModel=k,t.SequenceFlowView=R,t.ServiceTaskModel=B,t.ServiceTaskView=H,t.Snapshot=yS,t.StartEventFactory=bt,t.StartEventModel=N,t.StartEventView=T,t.SubProcessFactory=Ig,t.TaskNodeFactory=Lt,t.UserTaskModel=z,t.UserTaskView=W,t.bpmnUtils=vt,t.convertNormalToXml=_v,t.convertXmlToNormal=Ev,t.dynamicGroup=bw,t.gateway={exclusive:0,inclusive:1,parallel:2},t.gatewayComposable=[[1,1,0],[0,0,1],[0,1,1]],t.getCurvedEdgePath=BS,t.handleAttributes=K,t.icons=kt,t.lfJson2Xml=J,t.lfXml2Json=et,t.multiInstanceIcon=Dt,t.sequenceFlowFactory=Bg,t.toLogicflowData=function(t){var e={nodes:[],edges:[]},n=t.flowElementList;return n&&n.length>0&&n.forEach((function(t){if(t.type===Ov.SEQUENCE_FLOW){var n=function(t){var e=t.incoming,n=t.outgoing,o=t.properties,i=t.key,r=t.type,a=o.text,s=o.name,l=o.startPoint,u=o.endPoint,c=o.pointsList,d={id:i,type:Pv[r],sourceNodeId:e[0],targetNodeId:n[0],text:a||s,properties:{}};l&&(d.startPoint=JSON.parse(l)),u&&(d.endPoint=JSON.parse(u)),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 o=function(t){var e=t.properties,n=t.key,o=t.type,i=t.bounds,r=e.x,a=e.y,s=e.text;if(void 0===r){var l=_(i,2),u=l[0],c=u.x,d=u.y,h=l[1];r=(c+h.x)/2,a=(d+h.y)/2}var p={id:n,type:Pv[o],x:r,y:a,text:s,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(o)}})),e},t.toNormalJson=rt,t.toTurboData=function(t){var e=new Map,n={flowElementList:[]};return t.nodes.forEach((function(t){var o=function(t){var e=t.id,n=t.type,o=t.x,i=t.y,r=t.text,a=void 0===r?"":r,s=t.properties;return{incoming:[],outgoing:[],dockers:[],type:kv(n),properties:g(g({},s),{name:a&&a.value||"",x:o,y:i,text:a}),key:e}}(t);n.flowElementList.push(o),e.set(t.id,o)})),t.edges.forEach((function(t){var o=function(t){var e=t.id,n=t.type,o=t.sourceNodeId,i=t.targetNodeId,r=t.startPoint,a=t.endPoint,s=t.pointsList,l=t.text,u=void 0===l?"":l,c=t.properties;return{incoming:[o],outgoing:[i],type:kv(n),dockers:[],properties:g(g({},c),{name:u&&u.value||"",text:u,startPoint:JSON.stringify(r),endPoint:JSON.stringify(a),pointsList:JSON.stringify(s)}),key:e}}(t);e.get(t.sourceNodeId).outgoing.push(o.key),e.get(t.targetNodeId).incoming.push(o.key),n.flowElementList.push(o)})),n},t.toXmlJson=it,t.useDefinition=zg}));
42
42
  //# sourceMappingURL=index.min.js.map