| H A D | dmn-modeler.production.min.js | 265 `,mk={width:135,height:46},gk={width:100,height:63};function Lx(n,e,t){return Q("path",{d:n,strokeWidth:2,transform:`translate(${e.x}, ${e.y})`,...t})}var Dm=5;function Ja(n,e){this._styles=e,n.registerProvider(this)}Ja.$inject=["outline","styles"];Ja.prototype.getOutline=function(n){let e=this._styles.cls("djs-outline",["no-fill"]);var t;return O(n,"dmn:InputData")?(t=Q("rect"),j(t,T({x:-Dm,y:-Dm,rx:27,width:n.width+Dm*2,height:n.height+Dm*2},e))):O(n,"dmn:BusinessKnowledgeModel")&&yk(n,"dmn:BusinessKnowledgeModel")?t=Lx(dk,{x:-6,y:-6},e):O(n,"dmn:KnowledgeSource")&&yk(n,"dmn:KnowledgeSource")&&(t=Lx(pk,{x:-6,y:-1.5},e)),t};Ja.prototype.updateOutline=function(n){return!!Ge(n,["dmn:InputData","dmn:BusinessKnowledgeModel","dmn:KnowledgeSource"])};function yk(n,e){var t;return e==="dmn:BusinessKnowledgeModel"?t=mk:e==="dmn:KnowledgeSource"&&(t=gk),n.width===t.width&&n.height===t.height}var vk={__depends__:[Tm],__init__:["outlineProvider"],outlineProvider:["type",Ja]};var bk=".djs-palette-toggle",_k=".entry",XF=bk+", "+_k,Bx="djs-palette-",YF="shown",Nx="open",xk="two-column",ZF=1e3;function nt(n,e){this._eventBus=n,this._canvas=e;var t=this;n.on("tool-manager.update",function(i){var r=i.tool;t.updateToolHighlight(r)}),n.on("i18n.changed",function(){t._update()}),n.on("diagram.init",function(){t._diagramInitialized=!0,t._rebuild()})}nt.$inject=["eventBus","canvas"];nt.prototype.registerProvider=function(n,e){e||(e=n,n=ZF),this._eventBus.on("palette.getProviders",n,function(t){t.providers.push(e)}),this._rebuild()};nt.prototype.getEntries=function(){var n=this._getProviders();return n.reduce(e3,{})};nt.prototype._rebuild=function(){if(this._diagramInitialized){var n=this._getProviders();n.length&&(this._container||this._init(),this._update())}};nt.prototype._init=function(){var n=this,e=this._eventBus,t=this._getParentContainer(),i=this._container=te(nt.HTML_MARKUP);t.appendChild(i),ee(t).add(Bx+YF),_t.bind(i,XF,"click",function(r){var o=r.delegateTarget;if(hr(o,bk))return n.toggle();n.trigger("click",r)}),q.bind(i,"mousedown",function(r){r.stopPropagation()}),_t.bind(i,_k,"dragstart",function(r){n.trigger("dragstart",r)}),e.on("canvas.resized",this._layoutChanged,this),e.fire("palette.create",{container:i})};nt.prototype._getProviders=function(n){var e=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(e),e.providers};nt.prototype._toggleState=function(n){n=n||{};var e=this._getParentContainer(),t=this._container,i=this._eventBus,r,o=ee(t),s=ee(e);"twoColumn"in n?r=n.twoColumn:r=this._needsCollapse(e.clientHeight,this._entries||{}),o.toggle(xk,r),s.toggle(Bx+xk,r),"open"in n&&(o.toggle(Nx,n.open),s.toggle(Bx+Nx,n.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})};nt.prototype._update=function(){var n=X(".djs-palette-entries",this._container),e=this._entries=this.getEntries();no(n),k(e,function(t,i){var r=t.group||"default",o=X("[data-group="+Sa(r)+"]",n);o||(o=te('<div class="group"></div>'),et(o,"data-group",r),n.appendChild(o));var s=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),a=te(s);if(o.appendChild(a),!t.separator&&(et(a,"data-action",i),t.title&&et(a,"title",t.title),t.className&&JF(a,t.className),t.imageUrl)){var l=te("<img>");et(l,"src",t.imageUrl),a.appendChild(l)}}),this.open()};nt.prototype.trigger=function(n,e,t){var i,r,o=e.delegateTarget||e.target;return o?(i=et(o,"data-action"),r=e.originalEvent||e,this.triggerEntry(i,n,r,t)):e.preventDefault()};nt.prototype.triggerEntry=function(n,e,t,i){var r=this._entries,o,s;if(o=r[n],!!o&&(s=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:t})!==!1)){if(ge(s)){if(e==="click")return s(t,i)}else if(s[e])return s[e](t,i);t.preventDefault()}};nt.prototype._layoutChanged=function(){this._toggleState({})};nt.prototype._needsCollapse=function(n,e){var t=50,i=Object.keys(e).length*46;return n<i+t};nt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})};nt.prototype.open=function(){this._toggleState({open:!0})};nt.prototype.toggle=function(){this.isOpen()?this.close():this.open()};nt.prototype.isActiveTool=function(n){return n&&this._activeTool===n};nt.prototype.updateToolHighlight=function(n){var e,t;this._toolsContainer||(e=X(".djs-palette-entries",this._container),this._toolsContainer=X("[data-group=tools]",e)),t=this._toolsContainer,k(t.children,function(i){var r=i.getAttribute("data-action");if(r){var o=ee(i);r=r.replace("-tool",""),o.contains("entry")&&r===n?o.add("highlighted-entry"):o.remove("highlighted-entry")}})};nt.prototype.isOpen=function(){return ee(this._container).has(Nx)};nt.prototype._getParentContainer=function(){return this._canvas.getContainer()};nt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function JF(n,e){var t=ee(n),i=F(e)?e:e.split(/\s+/g);i.forEach(function(r){t.add(r)})}function e3(n,e){var t=e.getPaletteEntries();return ge(t)?t(n):(k(t,function(i,r){n[r]=i}),n)}var wk={__init__:["palette"],palette:["type",nt]};var t3=250;function Pr(n){this._eventBus=n,this._tools=[],this._active=null}Pr.$inject=["eventBus"];Pr.prototype.registerTool=function(n,e){var t=this._tools;if(!e)throw new Error(`A tool has to be registered with it's "events"`);t.push(n),this.bindEvents(n,e)};Pr.prototype.isActive=function(n){return n&&this._active===n};Pr.prototype.length=function(n){return this._tools.length};Pr.prototype.setActive=function(n){var e=this._eventBus;this._active!==n&&(this._active=n,e.fire("tool-manager.update",{tool:n}))};Pr.prototype.bindEvents=function(n,e){var t=this._eventBus,i=[];t.on(e.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(n)){this.setActive(null);return}this.setActive(n)},this),k(e,function(r){i.push(r+".ended"),i.push(r+".canceled")}),t.on(i,t3,function(r){this._active&&(n3(r)||this.setActive(null))},this)};function n3(n){var e=n.originalEvent&&n.originalEvent.target;return e&&De(e,'.group[data-group="tools"]')}var Im={__depends__:[gn],__init__:["toolManager"],toolManager:["type",Pr]};function Hf(n){var e=this;this._lastMoveEvent=null;function t(i){e._lastMoveEvent=i}n.on("canvas.init",function(i){var r=e._svg=i.svg;r.addEventListener("mousemove",t)}),n.on("canvas.destroy",function(){e._lastMouseEvent=null,e._svg.removeEventListener("mousemove",t)})}Hf.$inject=["eventBus"];Hf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||i3(0,0)};function i3(n,e){var t=document.createEvent("MouseEvent"),i=n,r=e,o=n,s=e;return t.initMouseEvent&&t.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,s,!1,!1,!1,!1,0,null),t}var Lm={__init__:["mouse"],mouse:["type",Hf]};var Sk="crosshair",Ck="selected",r3="djs-dragging-active-lasso";function Ui(n,e,t,i,r,o,s){this._selection=r,this._dragging=t,this._mouse=s;var a=this,l={create:function(f){var h=e.getActiveLayer(),d=f.frame=Q("rect");j(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),K(h,d),c(!0),this.update(f)},update:function(f){var h=f.frame,d=f.bbox;h&&d&&j(h,{x:d.x,y:d.y,width:d.width,height:d.height});var p=f.marked,m=f.lastMarked;if(p&&m){for(let g of m)p.has(g)||e.removeMarker(g,Ck);for(let g of p)m.has(g)||e.addMarker(g,Ck)}},remove:function(f){this.update(f),f.frame&&Fe(f.frame),c(!1)}};function c(f){ne(e.getContainer()).toggle(r3,f)}function u(f){var h=i.getAll();return new Set(Wu(wv(h,f)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),n.on("lasso.selection.end",function(f){var h=f.originalEvent.target;!f.hover&&!(h instanceof SVGElement)||n.once("lasso.selection.ended",function(){a.activateLasso(f.originalEvent,!0)})}),n.on("lasso.end",0,function(f){var h=f.context;a._select(Array.from(h.marked))}),n.on("lasso.start",function(f){var h=f.context;h.bbox=Ek(f),h.add=df(f),h.lastMarked=new Set(r.get()),h.add?h.marked=h.lastMarked:h.marked=new Set,h.initialMarked=h.marked,l.create(h)}),n.on("lasso.move",function(f){var h=f.context,d=h.bbox=Ek(f),p=u(d),m=h.initialMarked.union(p);h.lastMarked=h.marked,h.marked=m,l.update(h)}),n.on("lasso.cleanup",function(f){var h=f.context;h.lastMarked=h.marked,h.marked=new Set(r.get()),l.remove(f.context)}),n.on("element.mousedown",1500,function(f){if(df(f))return a.activateLasso(f.originalEvent),!0})}Ui.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"];Ui.prototype.activateLasso=function(n,e){this._dragging.init(n,"lasso",{autoActivate:e,cursor:Sk,data:{context:{}},keepSelection:!0})};Ui.prototype.activateSelection=function(n,e){this._dragging.init(n,"lasso.selection",{trapClick:!1,autoActivate:e,cursor:Sk,data:{context:{}},keepSelection:!0})};Ui.prototype._select=function(n){this._selection.select(n)};Ui.prototype.select=function(n,e,t=[]){var i=Wu(wv(n,e));this._select([...t,...i])};Ui.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var n=this._mouse.getLastMoveEvent();this.activateSelection(n,!!n)};Ui.prototype.isActive=function(){var n=this._dragging.context();return n&&/^lasso/.test(n.prefix)};function Ek(n){var e={x:n.x-n.dx,y:n.y-n.dy},t={x:n.x,y:n.y},i;return e.x<=t.x&&e.y<t.y||e.x<t.x&&e.y<=t.y?i={x:e.x,y:e.y,width:t.x-e.x,height:t.y-e.y}:e.x>=t.x&&e.y<t.y||e.x>t.x&&e.y<=t.y?i={x:t.x,y:e.y,width:e.x-t.x,height:t.y-e.y}:e.x<=t.x&&e.y>t.y||e.x<t.x&&e.y>=t.y?i={x:e.x,y:t.y,width:t.x-e.x,height:e.y-t.y}:e.x>=t.x&&e.y>t.y||e.x>t.x&&e.y>=t.y?i={x:t.x,y:t.y,width:e.x-t.x,height:e.y-t.y}:i={x:t.x,y:t.y,width:0,height:0},i}var Ok={__depends__:[Im,Lm],__init__:["lassoTool"],lassoTool:["type",Ui]};var $x=1500,Rk="grab";function Eo(n,e,t,i,r,o){this._dragging=t,this._mouse=o;var s=this,a=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),n.on("element.mousedown",$x,function(l){if(hf(l))return s.activateMove(l.originalEvent,!0),!1}),a&&a.addListener($x,function(l){if(!(!kk(l.keyEvent)||s.isActive())){var c=s._mouse.getLastMoveEvent();s.activateMove(c,!!c)}},"keyboard.keydown"),a&&a.addListener($x,function(l){!kk(l.keyEvent)||!s.isActive()||s.toggle()},"keyboard.keyup"),n.on("hand.end",function(l){var c=l.originalEvent.target;if(!l.hover&&!(c instanceof SVGElement))return!1;n.once("hand.ended",function(){s.activateMove(l.originalEvent,{reactivate:!0})})}),n.on("hand.move.move",function(l){var c=e.viewbox().scale;e.scroll({dx:l.dx*c,dy:l.dy*c})}),n.on("hand.move.end",function(l){var c=l.context,u=c.reactivate;return!hf(l)&&u&&n.once("hand.move.ended",function(f){s.activateHand(f.originalEvent,!0,!0)}),!1})}Eo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"];Eo.prototype.activateMove=function(n,e,t){typeof e=="object"&&(t=e,e=!1),this._dragging.init(n,"hand.move",{autoActivate:e,cursor:Rk,data:{context:t||{}}})};Eo.prototype.activateHand=function(n,e,t){this._dragging.init(n,"hand",{trapClick:!1,autoActivate:e,cursor:Rk,data:{context:{reactivate:t}}})};Eo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var n=this._mouse.getLastMoveEvent();this.activateHand(n,!!n)};Eo.prototype.isActive=function(){var n=this._dragging.context();return n?/^(hand|hand\.move)$/.test(n.prefix):!1};function kk(n){return Ve("Space",n)}var Tk={__depends__:[Im,Lm],__init__:["handTool"],handTool:["type",Eo]};function zf(n,e,t,i,r,o){this._palette=n,this._create=e,this._elementFactory=t,this._handTool=i,this._lassoTool=r,this._translate=o,n.registerProvider(this)}zf.$inject=["palette","create","elementFactory","handTool","lassoTool","translate"];zf.prototype.getPaletteEntries=function(n){var e={},t=this._create,i=this._elementFactory,r=this._handTool,o=this._lassoTool,s=this._translate;function a(l,c,u,f,h){function d(p){var m=i.createShape(T({type:l},h));t.start(p,m)}return{group:c,className:u,title:f,action:{dragstart:d,click:d}}}return T(e,{"hand-tool":{group:"tools",className:"dmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(l){r.activateHand(l)}}},"lasso-tool":{group:"tools",className:"dmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(l){o.activateSelection(l)}}},"tool-separator":{group:"tools",separator:!0},"create.decision":a("dmn:Decision","drd","dmn-icon-decision",s("Create decision")),"create.input-data":a("dmn:InputData","drd","dmn-icon-input-data",s("Create input data")),"create.knowledge-source":a("dmn:KnowledgeSource","drd","dmn-icon-knowledge-source",s("Create knowledge source")),"create.business-knowledge-model":a("dmn:BusinessKnowledgeModel","drd","dmn-icon-business-knowledge",s("Create knowledge model"))}),e};var Ak={__depends__:[qe,wk,Zp,Ok,Tk],__init__:["paletteProvider"],paletteProvider:["type",zf]};var Nm=Math.max,$m=Math.min,o3=20;function Mk(n,e,t){var i=t.x,r=t.y,o={x:n.x,y:n.y,width:n.width,height:n.height};return e.indexOf("n")!==-1?(o.y=n.y+r,o.height=n.height-r):e.indexOf("s")!==-1&&(o.height=n.height+r),e.indexOf("e")!==-1?o.width=n.width+i:e.indexOf("w")!==-1&&(o.x=n.x+i,o.width=n.width-i),o}function Bm(n,e,t){var i=e[n],r=t.min&&t.min[n],o=t.max&&t.max[n];return se(r)&&(i=(/top|left/.test(n)?$m:Nm)(i,r)),se(o)&&(i=(/top|left/.test(n)?Nm:$m)(i,o)),i}function Pk(n,e){if(!e)return n;var t=G(n);return Ov({top:Bm("top",t,e),right:Bm("right",t,e),bottom:Bm("bottom",t,e),left:Bm("left",t,e)})}function Dk(n,e,t,i){var r=G(e),o={top:/n/.test(n)?r.bottom-t.height:r.top,left:/w/.test(n)?r.right-t.width:r.left,bottom:/s/.test(n)?r.top+t.height:r.bottom,right:/e/.test(n)?r.left+t.width:r.right},s=i?G(i):o,a={top:$m(o.top,s.top),left:$m(o.left,s.left),bottom:Nm(o.bottom,s.bottom),right:Nm(o.right,s.right)};return Ov(a)}function Wf(n,e){return typeof n!="undefined"?n:o3}function s3(n,e){var t,i,r,o;return typeof e=="object"?(t=Wf(e.left),i=Wf(e.right),r=Wf(e.top),o=Wf(e.bottom)):t=i=r=o=Wf(e),{x:n.x-t,y:n.y-r,width:n.width+t+i,height:n.height+r+o}}function a3(n){return!(n.waypoints||n.type==="label")}function Ik(n,e){var t;if(n.length===void 0?t=Ee(n.children,a3):t=n,t.length)return s3(Tt(t),e)}var Lk=10;function ks(n,e,t,i){this._dragging=i,this._rules=e;var r=this;function o(l,c){var u=l.shape,f=l.direction,h=l.resizeConstraints,d;l.delta=c,d=Mk(u,f,c),l.newBounds=Pk(d,h),l.canExecute=r.canResize(l)}function s(l){var c=l.resizeConstraints,u=l.minBounds;c===void 0&&(u===void 0&&(u=r.computeMinResizeBox(l)),l.resizeConstraints={min:G(u)})}function a(l){var c=l.shape,u=l.canExecute,f=l.newBounds;if(u){if(f=F1(f),!l3(c,f))return;t.resizeShape(c,f)}}n.on("resize.start",function(l){s(l.context)}),n.on("resize.move",function(l){var c={x:l.dx,y:l.dy};o(l.context,c)}),n.on("resize.end",function(l){a(l.context)})}ks.prototype.canResize=function(n){var e=this._rules,t=hn(n,["newBounds","shape","delta","direction"]);return e.allowed("shape.resize",t)};ks.prototype.activate=function(n,e,t){var i=this._dragging,r,o;if(typeof t=="string"&&(t={direction:t}),r=T({shape:e},t),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(n,jx(e,o),"resize",{autoActivate:!0,cursor:c3(o),data:{shape:e,context:r}})};ks.prototype.computeMinResizeBox=function(n){var e=n.shape,t=n.direction,i,r;return i=n.minDimensions||{width:Lk,height:Lk},r=Ik(e,n.childrenBoxPadding),Dk(t,e,i,r)};ks.$inject=["eventBus","rules","modeling","dragging"];function l3(n,e){return n.x!==e.x||n.y!==e.y||n.width!==e.width||n.height!==e.height}function jx(n,e){var t=le(n),i=G(n),r={x:t.x,y:t.y};return e.indexOf("n")!==-1?r.y=i.top:e.indexOf("s")!==-1&&(r.y=i.bottom),e.indexOf("e")!==-1?r.x=i.right:e.indexOf("w")!==-1&&(r.x=i.left),r}function c3(n){var e="resize-";return n==="n"||n==="s"?e+"ns":n==="e"||n==="w"?e+"ew":n==="nw"||n==="se"?e+"nwse":e+"nesw"}var Bk="djs-resizing",Nk="resize-not-ok",u3=500;function jm(n,e,t){function i(o){var s=o.shape,a=o.newBounds,l=o.frame;l||(l=o.frame=t.addFrame(s,e.getActiveLayer()),e.addMarker(s,Bk)),a.width>5&&j(l,{x:a.x,width:a.width}),a.height>5&&j(l,{y:a.y,height:a.height}),o.canExecute?ne(l).remove(Nk):ne(l).add(Nk)}function r(o){var s=o.shape,a=o.frame;a&&Fe(o.frame),e.removeMarker(s,Bk)}n.on("resize.move",u3,function(o){i(o.context)}),n.on("resize.cleanup",function(o){r(o.context)})}jm.$inject=["eventBus","canvas","previewSupport"];var Fm=-6,qm=8,Vm=20,Uf="djs-resizer",f3=["n","w","s","e","nw","ne","se","sw"];function Qi(n,e,t,i){this._resize=i,this._canvas=e;var r=this;n.on("selection.changed",function(o){var s=o.newSelection;r.removeResizers(),s.length===1&&k(s,at(r.addResizer,r))}),n.on("shape.changed",function(o){var s=o.element;t.isSelected(s)&&(r.removeResizers(),r.addResizer(s))})}Qi.prototype.makeDraggable=function(n,e,t){var i=this._resize;function r(o){Sn(o)&&i.activate(o,n,t)}q.bind(e,"mousedown",r),q.bind(e,"touchstart",r)};Qi.prototype._createResizer=function(n,e,t,i){var r=this._getResizersParent(),o=h3(i),s=Q("g");ne(s).add(Uf),ne(s).add(Uf+"-"+n.id),ne(s).add(Uf+"-"+i),K(r,s);var a=Q("rect");j(a,{x:-qm/2+o.x,y:-qm/2+o.y,width:qm,height:qm}),ne(a).add(Uf+"-visual"),K(s,a);var l=Q("rect");return j(l,{x:-Vm/2+o.x,y:-Vm/2+o.y,width:Vm,height:Vm}),ne(l).add(Uf+"-hit"),K(s,l),iC(s,e,t),s};Qi.prototype.createResizer=function(n,e){var t=jx(n,e),i=this._createResizer(n,t.x,t.y,e);this.makeDraggable(n,i,e)};Qi.prototype.addResizer=function(n){var e=this;Xe(n)||k(f3,function(t){e._resize.canResize({shape:n,direction:t})&&e.createResizer(n,t)})};Qi.prototype.removeResizers=function(){var n=this._getResizersParent();ss(n)};Qi.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")};Qi.$inject=["eventBus","canvas","selection","resize"];function h3(n){var e={x:0,y:0};return n.indexOf("e")!==-1?e.x=-Fm:n.indexOf("w")!==-1&&(e.x=Fm),n.indexOf("s")!==-1?e.y=-Fm:n.indexOf("n")!==-1&&(e.y=Fm),e}var $k={__depends__:[yn,gn,ka],__init__:["resize","resizePreview","resizeHandles"],resize:["type",ks],resizePreview:["type",jm],resizeHandles:["type",Qi]};var d3="reconnectStart",p3="reconnectEnd",m3=2e3;function Hm(n){n.on(["bendpoint.move.move","bendpoint.move.end"],m3,function(e){var t=e.context,i=t.allowed,r=t.hover,o=t.source,s=t.target,a=t.type;if(t.hints||(t.hints={}),delete t.hints.connectionStart,delete t.hints.connectionEnd,!(i&&i.type!=="dmn:InformationRequirement")&&!(!r||!Ge(r,["dmn:Decision","dmn:InputData"]))&&o!==s){var l=a===d3||a===p3,c=vt(o,s);l&&r===o?(g3(e,c),t.hints.connectionEnd=Fk(s,c)):l&&r===s&&(t.hints.connectionStart=jk(o,c),y3(e,c))}})}Hm.$inject=["eventBus"];function jk(n,e){var t=G(n),i=le(n);return e.includes("bottom")?i.y=t.top:e.includes("top")?i.y=t.bottom:e.includes("right")?i.x=t.left:i.x=t.right,i}function Fk(n,e){var t=G(n),i=le(n);return e.includes("bottom")?i.y=t.bottom:e.includes("top")?i.y=t.top:e.includes("right")?i.x=t.right:i.x=t.left,i}function g3(n,e){var t=n.context,i=t.source,r=jk(i,e),o=n.x-r.x,s=n.y-r.y;n.x-=o,n.y-=s,n.dx-=o,n.dy-=s}function y3(n,e){var t=n.context,i=t.target,r=Fk(i,e),o=0,s=0;e.includes("top")||e.includes("bottom")?s=n.y-r.y:o=n.x-r.x,n.x-=o,n.y-=s,n.dx-=o,n.dy-=s}var v3=250;function zm(n){n.on(["connect.hover","connect.move","connect.end"],v3,function(e){var t=e.context,i=t.canExecute,r=t.hover,o=t.source,s=t.target;if(i&&i.type==="dmn:InformationRequirement"){var a=vt(o,s);t.connectionStart=le(o),r===o?t.connectionEnd=le(s):t.connectionEnd={x:e.x,y:e.y},a.includes("bottom")?(t.connectionStart.y=G(o).top,t.connectionEnd.y=G(s).bottom):a.includes("top")?(t.connectionStart.y=G(o).bottom,t.connectionEnd.y=G(s).top):a.includes("right")?(t.connectionStart.x=G(o).left,t.connectionEnd.x=G(s).right):(t.connectionStart.x=G(o).right,t.connectionEnd.x=G(s).left)}else delete t.connectionStart,delete t.connectionEnd})}zm.$inject=["eventBus"];function vi(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}vi.prototype.getSnapOrigin=function(n){return this._snapOrigins[n]};vi.prototype.setSnapOrigin=function(n,e){this._snapOrigins[n]=e,this._snapLocations.indexOf(n)===-1&&this._snapLocations.push(n)};vi.prototype.addDefaultSnap=function(n,e){var t=this._defaultSnaps[n];t||(t=this._defaultSnaps[n]=[]),t.push(e)};vi.prototype.getSnapLocations=function(){return this._snapLocations};vi.prototype.setSnapLocations=function(n){this._snapLocations=n};vi.prototype.pointsForTarget=function(n){var e=n.id||n,t=this._targets[e];return t||(t=this._targets[e]=new Wm,t.initDefaults(this._defaultSnaps)),t};function Wm(){this._snapValues={}}Wm.prototype.add=function(n,e){var t=this._snapValues[n];t||(t=this._snapValues[n]={x:[],y:[]}),t.x.indexOf(e.x)===-1&&t.x.push(e.x),t.y.indexOf(e.y)===-1&&t.y.push(e.y)};Wm.prototype.snap=function(n,e,t,i){var r=this._snapValues[e];return r&&ZE(n[t],r[t],i)};Wm.prototype.initDefaults=function(n){var e=this;k(n||{},function(t,i){k(t,function(r){e.add(i,r)})})};var x3=1250;function Rs(n,e,t){var i=this;this._elementRegistry=n,e.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),e.on(["create.move","create.end","shape.move.move","shape.move.end"],x3,function(r){var o=r.context,s=o.shape,a=o.snapContext,l=o.target;if(!(r.originalEvent&&Mt(r.originalEvent))&&!(wr(r)||!l)){var c=a.pointsForTarget(l);c.initialized||(c=i.addSnapTargetPoints(c,s,l),c.initialized=!0),t.snap(r,c)}}),e.on(["create.cleanup","shape.move.cleanup"],function(){t.hide()})}Rs.$inject=["elementRegistry","eventBus","snapping"];Rs.prototype.initSnap=function(n){var e=this._elementRegistry,t=n.context,i=t.shape,r=t.snapContext;r||(r=t.snapContext=new vi);var o;e.get(i.id)?o=ms(i,n):o={x:n.x+ms(i).x,y:n.y+ms(i).y};var s={x:o.x-i.width/2,y:o.y-i.height/2},a={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-n.x,y:o.y-n.y}),Bi(i)||(r.setSnapOrigin("top-left",{x:s.x-n.x,y:s.y-n.y}),r.setSnapOrigin("bottom-right",{x:a.x-n.x,y:a.y-n.y})),r};Rs.prototype.addSnapTargetPoints=function(n,e,t){var i=this.getSnapTargets(e,t);return k(i,function(r){if(Bi(r)){Bi(e)&&n.add("mid",ms(r));return}if(Xe(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);k(o,function(s){n.add("mid",s)});return}n.add("mid",ms(r))}),!se(e.x)||!se(e.y)||this._elementRegistry.get(e.id)&&n.add("mid",ms(e)),n};Rs.prototype.getSnapTargets=function(n,e){return zp(e).filter(function(t){return!b3(t)})};function b3(n){return!!n.hidden}var _3=1250;function Ts(n,e){var t=this;n.on(["resize.start"],function(i){t.initSnap(i)}),n.on(["resize.move","resize.end"],_3,function(i){var r=i.context,o=r.shape,s=o.parent,a=r.direction,l=r.snapContext;if(!(i.originalEvent&&Mt(i.originalEvent))&&!wr(i)){var c=l.pointsForTarget(s);c.initialized||(c=t.addSnapTargetPoints(c,o,s,a),c.initialized=!0),E3(a)&&vn(i,"x",i.x),S3(a)&&vn(i,"y",i.y),e.snap(i,c)}}),n.on(["resize.cleanup"],function(){e.hide()})}Ts.prototype.initSnap=function(n){var e=n.context,t=e.shape,i=e.direction,r=e.snapContext;r||(r=e.snapContext=new vi);var o=qk(t,i);return r.setSnapOrigin("corner",{x:o.x-n.x,y:o.y-n.y}),r};Ts.prototype.addSnapTargetPoints=function(n,e,t,i){var r=this.getSnapTargets(e,t);return k(r,function(o){n.add("corner",eS(o)),n.add("corner",JE(o))}),n.add("corner",qk(e,i)),n};Ts.$inject=["eventBus","snapping"];Ts.prototype.getSnapTargets=function(n,e){return zp(e).filter(function(t){return!w3(t,n)&&!Xe(t)&&!C3(t)&&!Bi(t)})};function qk(n,e){var t=le(n),i=G(n),r={x:t.x,y:t.y};return e.indexOf("n")!==-1?r.y=i.top:e.indexOf("s")!==-1&&(r.y=i.bottom),e.indexOf("e")!==-1?r.x=i.right:e.indexOf("w")!==-1&&(r.x=i.left),r}function w3(n,e){return n.host===e}function C3(n){return!!n.hidden}function E3(n){return n==="n"||n==="s"}function S3(n){return n==="e"||n==="w"}var O3=7,k3=1e3;function Ki(n){this._canvas=n,this._asyncHide=Mi(at(this.hide,this),k3)}Ki.$inject=["canvas"];Ki.prototype.snap=function(n,e){var t=n.context,i=t.snapContext,r=i.getSnapLocations(),o={x:wr(n,"x"),y:wr(n,"y")};k(r,function(s){var a=i.getSnapOrigin(s),l={x:n.x+a.x,y:n.y+a.y};if(k(["x","y"],function(c){var u;o[c]||(u=e.snap(l,s,c,O3),u!==void 0&&(o[c]={value:u,originValue:u-a[c]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),k(["x","y"],function(s){var a=o[s];Pe(a)&&vn(n,s,a.originValue)})};Ki.prototype._createLine=function(n){var e=this._canvas.getLayer("snap"),t=Q("path");return j(t,{d:"M0,0 L0,0"}),ne(t).add("djs-snap-line"),K(e,t),{update:function(i){se(i)?n==="horizontal"?j(t,{d:"M-100000,"+i+" L+100000,"+i,display:""}):j(t,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):j(t,{display:"none"})}}};Ki.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}};Ki.prototype.showSnapLine=function(n,e){var t=this.getSnapLine(n);t&&t.update(e),this._asyncHide()};Ki.prototype.getSnapLine=function(n){return this._snapLines||this._createSnapLines(),this._snapLines[n]};Ki.prototype.hide=function(){k(this._snapLines,function(n){n.update()})};var Vk={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Rs],resizeSnapping:["type",Ts],snapping:["type",Ki]};var Hk={__depends__:[Vk],__init__:["bendpointSnapping","connectSnapping"],bendpointSnapping:["type",Hm],connectSnapping:["type",zm]};function So(n){br.call(this,n)}fe(So,br);So.prototype._modelingModules=[CE,ME,LE,nS,oO,sO,lO,fO,pO,mO,xO,_O,wO,kO,PO,sk,hk,vk,Ak,$k,Hk];So.prototype._modules=[].concat(So.prototype._modules,So.prototype._modelingModules);function Fx(n){let e={variables:[],rootElement:V3(n)};for(let t=n;t;t=t.$parent)R3(t,e);return e.variables}function R3(n,e){el(n,"dmn:Decision")?T3(n,e):el(n,"dmn:BusinessKnowledgeModel")?A3(n,e):el(n,"dmn:Expression")&&j3(n,e)}function T3(n,e){for(let t of n.get("informationRequirement"))M3(t,e);for(let t of n.get("knowledgeRequirement"))Wk(t,e)}function A3(n,e){for(let t of n.get("knowledgeRequirement"))Wk(t,e)}function M3(n,e){let t=n.get("requiredInput");t&&P3(t,e);let i=n.get("requiredDecision");i&&D3(i,e)}function P3(n,e){let t=qx(n,e.rootElement);if(!t)return;let i=t.get("name");i&&e.variables.push({name:i,origin:t})}function D3(n,e){let t=qx(n,e.rootElement);if(!t)return;let i=t.get("name");if(!i)return;let r={name:i,origin:t},o=t.get("decisionLogic");o&&I3(o,r,e),e.variables.push(r)}function I3(n,e,t){if(el(n,"dmn:DecisionTable")){let i=n.get("output");L3(i,e,t)}}function L3(n,e,t){if(n.length===1){let r={...zk(n[0]),name:e.name};Object.assign(e,r);return}let i=n.map(zk);e.entries=i.filter(r=>!!r.name)}function zk(n){let e={name:n.name};return n.typeRef&&(e.detail=n.typeRef),e}function Wk(n,e){let t=n.get("requiredKnowledge");t&&B3(t,e)}function B3(n,e){let t=qx(n,e.rootElement);t&&el(t,"dmn:BusinessKnowledgeModel")&&N3(t,e)}function N3(n,e){let t=n.get("name");if(!t)return;let i={name:t,origin:n},r=n.get("encapsulatedLogic");r&&$3(r,i),e.variables.push(i)}function $3(n,e,t){let r=n.get("formalParameter").map((o,s)=>{let a={name:o.get("name")||`param ${s+1}`,type:o.get("typeRef")};return a.type||delete a.type,a});Object.assign(e,{type:"function",params:r})}function j3(n,e){el(n,"dmn:FunctionDefinition")&&F3(n,e)}function F3(n,e){let t=n.get("formalParameter");for(let i of t)q3(i,e)}function q3(n,e){let t=n.get("name");if(!t)return;let i={name:t,origin:n};n.get("typeRef")&&(i.detail=n.get("typeRef")),e.variables.push(i)}function V3(n){let e=n;for(;e.$parent;)e=e.$parent;return e}function qx(n,e){let t=n.get("href");if(!t||!t.startsWith("#"))return;let i=t.slice(1);return e.get("drgElement").find(o=>o.get("id")===i)}function el(n,e){return n.$instanceOf(e)}var Qf=class{constructor(e){e.registerProvider(this)}getVariables(e,t){return e.concat(Fx(t))}};Qf.$inject=["variableResolver"];var Um=class{constructor(){this._providers=[]}registerProvider(e){this._providers.push(e)}getVariables(e){return this._providers.reduce((t,i)=>i.getVariables(t,e),[])}};var tl={__init__:["dmnVariableProvider"],dmnVariableProvider:["type",Qf],variableResolver:["type",Um]};var Oo=class{constructor(e){T(this,e),Dr(this,"businessObject",{writable:!0})}},Vx=class extends Oo{constructor(e){super(e),Dr(this,"rows",{enumerable:!0,value:this.rows||[]}),Dr(this,"cols",{enumerable:!0,value:this.cols||[]})}},pt=class extends Oo{constructor(e){super(e),Dr(this,"root",{writable:!0}),Dr(this,"cells",{enumerable:!0,value:this.cells||[]})}},mt=class extends Oo{constructor(e){super(e),Dr(this,"root",{writable:!0}),Dr(this,"cells",{enumerable:!0,value:this.cells||[]})}},ko=class extends Oo{constructor(e){super(e),Dr(this,"row",{writable:!0}),Dr(this,"col",{writable:!0})}},H3={root:Vx,row:pt,col:mt,cell:ko};function Uk(n,e){let t=H3[n];if(!t)throw new Error("unknown type "+n);return new t(e)}function Dr(n,e,t){Object.defineProperty(n,e,t)}var As=class{constructor(){this._uid=12}create(e,t={}){return t.id||(t.id=e+"_"+this._uid++),Uk(e,t)}createRoot(e){return this.create("root",e)}createRow(e){return this.create("row",e)}createCol(e){return this.create("col",e)}createCell(e){return this.create("cell",e)}};var nl=class{constructor(e){this._eventBus=e,this._elements={},e.on("table.clear",this.clear.bind(this))}add(e,t){let{id:i}=e;this._elements[i]=e}remove(e){let t=e.id||e;delete this._elements[t]}get(e){return this._elements[e]}getAll(){return Hx(this._elements)}forEach(e){Hx(this._elements).forEach(t=>e(t))}filter(e){return Hx(this._elements).filter(t=>e(t))}clear(){this._elements={}}updateId(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t}),this.remove(e),e.id=t,this.add(e)}_validateId(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")}};nl.$inject=["eventBus"];function Hx(n){return Object.keys(n).map(function(e){return n[e]})}var il=class{constructor(e){this._listeners={},e.on("elements.changed",({elements:t})=>{this.elementsChanged(t)}),e.on("root.remove",t=>{let i=t.root.id;this._listeners[i]&&e.once("root.add",r=>{let o=r.root.id;this.updateId(i,o)})}),e.on("element.updateId",({element:t,newId:i})=>{this.updateId(t.id,i)})}elementsChanged(e){let t={},i=e.length;for(let r=0;r<i;r++){let{id:o}=e[r];if(t[o])return;t[o]=!0;let s=this._listeners[o]&&this._listeners[o].length;if(s)for(let a=0;a<s;a++)this._listeners[o][a]&&this._listeners[o][a]()}}onElementsChanged(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e][this._listeners[e].length]=t}offElementsChanged(e,t){if(this._listeners[e])if(t){let i=this._listeners[e].indexOf(t);i!==-1&&this._listeners[e].splice(i,1)}else this._listeners[e].length=0}updateId(e,t){this._listeners[e]&&(this._listeners[t]=this._listeners[e],delete this._listeners[e])}};il.$inject=["eventBus"];var z3=1e3,Kf=class{constructor(){this._listeners={}}getComponent(e,t){let i=this._listeners[e];if(!i)return;let r;for(let o=0;o<i.length&&(r=i[o].callback(t),!r);o++);return r}getComponents(e,t){let i=this._listeners[e],r=[];if(!i)return r;for(let o=0;o<i.length;o++){let s=i[o].callback(t);s&&r.push(s)}return r.length,r}onGetComponent(e,t,i){if(ge(t)&&(i=t,t=z3),!se(t))throw new Error("priority must be a number");let r=this._getListeners(e),o,s,a={priority:t,callback:i};for(s=0;o=r[s];s++)if(o.priority<t){r.splice(s,0,a);return}r.push(a)}offGetComponent(e,t){let i=this._getListeners(e),r,o,s;if(t)for(s=i.length-1;r=i[s];s--)o=r.callback,o===t&&i.splice(s,1);else i.length=0}_getListeners(e){let t=this._listeners[e];return t||(this._listeners[e]=t=[]),t}};var Gf=class extends L{constructor(e){super(e);let t=this._injector=e.injector;this._sheet=t.get("sheet"),this._changeSupport=t.get("changeSupport"),this._components=t.get("components"),this._eventBus=t.get("eventBus");let i=t.get("throttle");this.onElementsChanged=this.onElementsChanged.bind(this),this.onScroll=i(this.onScroll.bind(this))}onElementsChanged(){this.forceUpdate()}onScroll(){this._eventBus.fire("sheet.scroll")}getChildContext(){return{changeSupport:this._changeSupport,components:this._components,injector:this._injector}}componentWillMount(){let{id:e}=this._sheet.getRoot();this._changeSupport.onElementsChanged(e,this.onElementsChanged)}componentWillUnmount(){let{id:e}=this._sheet.getRoot();this._changeSupport.offElementsChanged(e,this.onElementsChanged)}render(){let{rows:e,cols:t}=this._sheet.getRoot(),i=this._components.getComponents("table.before"),r=this._components.getComponents("table.after"),o=this._components.getComponent("table.head"),s=this._components.getComponent("table.body"),a=this._components.getComponent("table.foot");return y(1,"div","tjs-container",[i&&i.map((l,c)=>P(2,l,null,c)),y(1,"div","tjs-table-container",y(1,"table","tjs-table",[o&&P(2,o,{rows:e,cols:t}),s&&P(2,s,{rows:e,cols:t}),a&&P(2,a,{rows:e,cols:t})],0),2,{onScroll:this.onScroll}),r&&r.map((l,c)=>P(2,l,null,c))],0)}};var rl=class{constructor(e,t,i,r,o){let{container:s}=i;this._container=s,r.on("root.added",()=>{xa(P(2,Gf,{injector:o}),s)}),r.on("root.remove",()=>{xa(null,s)})}getContainer(){return this._container}};rl.$inject=["changeSupport","components","config.renderer","eventBus","injector"];var Qm={__init__:["changeSupport","components","renderer"],changeSupport:["type",il],components:["type",Kf],renderer:["type",rl]};var ol=class{constructor(e,t){this._elementRegistry=e,this._eventBus=t,this._root=null,t.on("table.clear",()=>{this.setRoot(null)})}setRoot(e){if(this._root){let t=this._root;this._eventBus.fire("root.remove",{root:t}),this._root=null,this._eventBus.fire("root.removed",{root:t})}e&&this._eventBus.fire("root.add",{root:e}),this._root=e,e&&this._eventBus.fire("root.added",{root:e})}getRoot(){return this._root||this.setRoot({id:"__implicitroot",rows:[],cols:[]}),this._root}addRow(e,t){let i=this.getRoot();if(i.cols.length!=e.cells.length)throw new Error("number of cells is not equal to number of cols");return typeof t=="undefined"&&(t=i.rows.length),Km(t,i.rows,e),e.root=i,this._elementRegistry.add(e),e.cells.forEach((r,o)=>{this._elementRegistry.add(r),r.row=e,r.col=i.cols[o],Km(t,i.cols[o].cells,r)}),this._eventBus.fire("row.add",{row:e}),e}removeRow(e){let t=this.getRoot();typeof e=="string"&&(e=this._elementRegistry.get(e));let i=t.rows.indexOf(e);i!==-1&&(Gm(i,t.rows),e.root=void 0,this._elementRegistry.remove(e),e.cells.forEach((r,o)=>{this._elementRegistry.remove(r),r.col=void 0,Gm(i,t.cols[o].cells)}),this._eventBus.fire("row.remove",{row:e}))}addCol(e,t){let i=this.getRoot();if(this._elementRegistry.add(e),i.rows.length!=e.cells.length)throw new Error("number of cells is not equal to number of rows");return typeof t=="undefined"&&(t=i.cols.length),Km(t,i.cols,e),e.root=i,e.cells.forEach((r,o)=>{this._elementRegistry.add(r),r.col=e,r.row=i.rows[o],Km(t,i.rows[o].cells,r)}),this._eventBus.fire("col.add",{col:e}),e}removeCol(e){let t=this.getRoot();typeof e=="string"&&(e=this._elementRegistry.get(e));let i=t.cols.indexOf(e);i!==-1&&(Gm(i,t.cols),e.root=void 0,this._elementRegistry.remove(e),e.cells.forEach((r,o)=>{this._elementRegistry.remove(r),r.row=void 0,Gm(i,t.rows[o].cells)}),this._eventBus.fire("col.remove",{col:e}))}resized(){this._eventBus.fire("sheet.resized")}};ol.$inject=["elementRegistry","eventBus"];function Km(n,e,t){return e.splice(n,0,t)}function Gm(n,e){return e.splice(n,1)}function Xm(n=!0){let e=typeof n=="number"?n:n?300:0;return e?t=>Nw(t,e):t=>t}Xm.$inject=["config.throttle"];var Qk={__depends__:[Qm],__init__:["elementFactory","sheet"],elementFactory:["type",As],elementRegistry:["type",nl],eventBus:["type",ut],sheet:["type",ol],throttle:["factory",Xm]};var Xf=class{constructor(e={}){let{injector:t}=e;if(!t){let{modules:i,config:r}=this._init(e);t=W3(r,i)}this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("table.init"),this.get("eventBus").fire("diagram.init")}_init(e){let{modules:t,...i}=e;return{modules:t,config:i}}destroy(){let e=this.get("eventBus");e.fire("table.destroy"),e.fire("diagram.destroy")}clear(){let e=this.get("eventBus");e.fire("table.clear"),e.fire("diagram.clear")}};function W3(n,e){let t=[{config:["value",n]},Qk].concat(e||[]),i=new os(t);return i.init(),i}var Kk=Xf;function Ym(n){if(!n)return"<null>";let e=n.id?` id="${n.id}"`:"";return`<${n.$type}${e} />`}function zx(n,e){function t(l,c,u){var f=l.gfx;if(f)throw new Error(`already rendered ${Ym(l)}`);return n.element(l,c,u)}function i(l){return n.table(l)}function r(l){l.id||(l.id="decision");let c=l.decisionLogic;if(c){if(!c.output)throw new Error(`missing output for ${Ym(c)}`);let u=i(c);c.input&&o(c.input,u,c),o(c.output,u,c),s(c.rule,u,c)}else throw new Error(`no table for ${Ym(l)}`)}function o(l,c,u){k(l,function(f){t(f,c,u)})}function s(l,c,u){k(l,function(f){t(f,c,u),a(f.inputEntry,f),a(f.outputEntry,f)})}function a(l,c,u){k(l,function(f){t(f,c,u)})}return{handleDecision:r}}function Gk(n,e,t){let i=n.get("tableImporter"),r=n.get("eventBus"),o=n.get("sheet"),s=n.get("modeling",!1),a,l=[];function c(u){let f={create(d,p,m,g){return i.create(d,p,m,g)},table(d){return i.add(d)},element(d,p,m){return i.add(d,p,m)},error(d,p){l.push({message:d,context:p})}};new zx(f,{canAddMissingEntries:s}).handleDecision(u)}r.fire("import.render.start",{decision:e});try{c(e)}catch(u){a=u}r.fire("import.render.complete",{error:a,warnings:l}),r.fire("elements.changed",{elements:[o.getRoot()]}),t(a,l)}function U3(){return{elements:[],index:{}}}function Xk(n,e){let{elements:t,index:i}=n;return i[e]?n:{elements:[...t,e],index:{...i,[e]:!0}}}function Q3(n,e){return n.elements.join(e)}function Ro(...n){let e=U3();return n.forEach(function(t){let i=typeof t;i==="string"&&t.length>0?e=Xk(e,t):i==="object"&&t!==null&&Object.keys(t).forEach(function(r){t[r]&&(e=Xk(e,r))})}),Q3(e," ")}function Ce(n){let e=n.constructor;return Zm(e,n)}function Zm(n,e){let t=n.$inject;if(!t)return;let{injector:i}=e.context,r=[...t,function(...o){for(let s in o){let a=t[s],l=o[s];e[a]=l}}];i.invoke(r)}function Wx(n,...e){return function(...t){let i;return e.forEach(function(r){if(i=r.call(n,...t),typeof i!="undefined")return!1}),i}.bind(n)}function Ut(n,e){Object.keys(e).forEach(function(t){if(t==="$inject"||t==="__init")return;let i=e[t];t==="constructor"&&i.call(n,n.props,n.context);let r=n[t];if(typeof r!="undefined"){if(typeof r!="function")throw new Error(`failed to mixin <${t}>: cannot combine with non-fn component value`);n[t]=Wx(n,r,i)}else n[t]=i.bind(n)}),"$inject"in e&&Zm(e,n),"__init"in e&&e.__init.call(n,n.props,n.context)}var Yk={getSelectionClasses(){let{selected:n,selectedSecondary:e,focussed:t}=this.state;return Ro({selected:n,"selected-secondary":e,focussed:t})},selectionChanged(n){this.setState(n)},componentWillUpdate(n){n.elementId!==this.props.elementId&&this.updateSelectionSubscription(!1)},componentDidUpdate(n){n.elementId!==this.props.elementId&&this.updateSelectionSubscription(!0)},componentDidMount(){this.updateSelectionSubscription(!0)},componentWillUnmount(){this.updateSelectionSubscription(!1)},updateSelectionSubscription(n){let{elementId:e}=this.props;e&&e&&this.eventBus[n?"on":"off"](`selection.${e}.changed`,this.selectionChanged)}},Yf=Yk;Yk.$inject=["eventBus"];var Zf=class extends L{constructor(e,t){super(e,t),Ut(this,Yf),Ce(this)}getRenderProps(...e){let{className:t,elementId:i,coords:r,...o}=this.props,s={className:Ro(...e,this.getSelectionClasses(),t)};return i&&(s["data-element-id"]=i),r&&(s["data-coords"]=r),{...s,...o}}};var Rn=class extends Zf{constructor(e,t){super(e,t),this.state={}}render(){let{children:e}=this.props,t=this.getRenderProps("cell");return En(y(1,"td",null,e,0,{...t}))}};var Zk={slotFill(n,e){let{type:t,context:i,...r}=n,o=this.components.getComponent(t,i)||e;return o?En(P(2,o,{...i,...r})):null},slotFills(n){let{type:e,context:t,...i}=n;return this.components.getComponents(e,t).map(o=>En(P(2,o,{...t,...i})))}},xi=Zk;Zk.$inject=["components"];var Jk=400,To=class extends L{constructor(t,i){super(t,i);M(this,"onElementsChanged",()=>{this.forceUpdate()});Ut(this,xi),Ce(this)}componentDidMount(){this.changeSupport.onElementsChanged(this.getRoot(),this.onElementsChanged)}componentWillUnmount(){this.changeSupport.offElementsChanged(this.getRoot(),this.onElementsChanged)}getRoot(){return this.sheet.getRoot()}render(){let r=(this.getRoot().businessObject.get("annotationsWidth")||Jk)+"px";return y(1,"th","annotation header",[this.slotFills({type:"cell-inner",context:{cellType:"annotations",col:this.sheet.getRoot(),minWidth:Jk}}),this.translate("Annotations")],0,{style:{width:r}})}};To.$inject=["changeSupport","sheet","translate"];function Ux(n){let{row:e}=n,{id:t,description:i}=e.businessObject;return P(2,Rn,{className:"annotation",elementId:t,children:i||"-"})}function Jm(n){n.onGetComponent("cell",({cellType:e})=>{if(e==="after-label-cells")return To;if(e==="after-rule-cells")return Ux})}Jm.$inject=["components"];var eR={__init__:["annotationsProvider"],annotationsProvider:["type",Jm]};function Jf(n,e){return T({id:n.id,type:n.$type,businessObject:n},e)}var sl=class{constructor(e,t,i){this._elementFactory=e,this._eventBus=t,this._sheet=i}add(e){let t;if(O(e,"dmn:DecisionTable"))t=this._elementFactory.createRoot(Jf(e)),this._sheet.setRoot(t);else if(O(e,"dmn:InputClause"))t=this._elementFactory.createCol(Jf(e)),this._sheet.addCol(t);else if(O(e,"dmn:OutputClause"))t=this._elementFactory.createCol(Jf(e)),this._sheet.addCol(t);else if(O(e,"dmn:DecisionRule")){e.inputEntry||(e.inputEntry=[]),e.outputEntry||(e.outputEntry=[]);let i=[...e.inputEntry,...e.outputEntry].map(r=>this._elementFactory.createCell(Jf(r)));t=this._elementFactory.createRow(T(Jf(e),{cells:i})),this._sheet.addRow(t)}return this._eventBus.fire("dmnElement.added",{element:t}),t}};sl.$inject=["elementFactory","eventBus","sheet"];var tR={__depends__:[qe],tableImporter:["type",sl]};var nR={__depends__:[tR,Qm]};var eh=class extends L{constructor(t,i){super(t,i);M(this,"onElementsChanged",()=>{this.forceUpdate()});Ut(this,xi),this._sheet=i.injector.get("sheet"),this._changeSupport=i.changeSupport}componentWillMount(){let t=this._sheet.getRoot();this._changeSupport.onElementsChanged(t.id,this.onElementsChanged)}componentWillUnmount(){let t=this._sheet.getRoot();this._changeSupport.offElementsChanged(t.id,this.onElementsChanged)}render(){let t=this._sheet.getRoot();if(!O(t,"dmn:DMNElement"))return null;let i=Ke(t),r=i.input,o=i.output;return y(1,"thead",null,y(1,"tr",null,[y(1,"th","index-column"),this.slotFills({type:"cell",context:{cellType:"before-label-cells"}}),r&&r.map((s,a)=>{let l=s.width||"192px";return this.slotFill({type:"cell",context:{cellType:"input-header",input:s,index:a,inputsLength:r.length,width:l},key:s.id},K3)}),o.map((s,a)=>this.slotFill({type:"cell",context:{cellType:"output-header",output:s,index:a,outputsLength:o.length},key:s.id},G3)),this.slotFills({type:"cell",context:{cellType:"after-label-cells"}})],0),2)}};function K3(n,e){let{input:t,className:i,index:r}=n,{label:o,inputExpression:s,inputValues:a}=t,l=e.injector.get("translate"),c=(i||"")+" input-cell";return y(1,"th",c,[y(1,"div","clause",l(r===0?"When":"And"),0),o?y(1,"div","input-label",o,0,{title:l("Input label: ")+o}):y(1,"div","input-expression",s.text,0,{title:l("Input expression: ")+s.text}),y(1,"div","input-variable",a&&a.text||s.typeRef,0,{title:a&&a.text?l("Input values"):l("Input type")})],0,{"data-col-id":t.id},t.id)}function G3(n,e){let{output:t,className:i,index:r}=n,{label:o,name:s,outputValues:a,typeRef:l}=t,c=e.injector.get("translate"),u=(i||"")+" output-cell";return y(1,"th",u,[y(1,"div","clause",c(r===0?"Then":"And"),0),o?y(1,"div","output-label",o,0,{title:c("Output label")}):y(1,"div","output-name",s,0,{title:c("Output name")}),y(1,"div","output-variable",a&&a.text||l,0,{title:a&&a.text?c("Output values"):c("Output type")})],0,null,t.id)}function eg(n){n.onGetComponent("table.head",()=>eh)}eg.$inject=["components"];var iR={__init__:["decisionTableHeadProvider"],decisionTableHeadProvider:["type",eg]};var al=class extends L{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),Ce(this)}render(){let e=this.sheet.getRoot();if(!O(e,"dmn:DMNElement"))return null;let{name:t}=e.businessObject.$parent,i=this.components.getComponent("hit-policy")||X3;return y(1,"div","decision-table-properties",[y(1,"div","decision-table-name",t,0,{title:this._translate("Decision name: ")+t}),y(1,"div","decision-table-header-separator"),P(2,i)],4)}};al.$inject=["sheet","components"];function X3(){return null}var Y3=500,ll=class{constructor(e){e.onGetComponent("table.before",Y3,()=>al)}};ll.$inject=["components"];var rR={__init__:["decisionTableProperties"],decisionTableProperties:["type",ll]};var th=class extends L{render(){let{row:e,rowIndex:t}=this.props,{components:i}=this.context,r=i.getComponents("cell-inner",{cellType:"rule-index",row:e,rowIndex:t});return y(1,"td","rule-index",[r&&r.map(o=>P(2,o,{row:e,rowIndex:t})),t+1],0,{"data-element-id":e.id,"data-row-id":e.id})}};var cl=class{constructor(e){e.onGetComponent("cell",({cellType:t})=>{if(t==="before-rule-cells")return th})}};cl.$inject=["components"];var oR={__init__:["decisionRuleIndices"],decisionRuleIndices:["type",cl]};var Z3=[{label:"FEEL",value:"feel"}],ul=class{constructor(e){this._injector=e;let t=e.get("config.expressionLanguages")||{};this._config={options:Z3,defaults:{editor:"feel"}},t.options&&(this._config.options=t.options);let i=this._getLegacyDefaults();T(this._config.defaults,i,t.defaults)}getDefault(e){let{defaults:t}=this._config,i=t[e]||t.editor;return this._getLanguageByValue(i)||this.getAll()[0]}getLabel(e){let t=this._getLanguageByValue(e);return t?t.label:e}getAll(){return this._config.options}_getLegacyDefaults(){let e={},t=this._injector,i=t.get("config.defaultInputExpressionLanguage"),r=t.get("config.defaultOutputExpressionLanguage");return i&&(e.inputCell=i),r&&(e.outputCell=r),e}_getLanguageByValue(e){return ye(this.getAll(),t=>e===t.value)}};ul.$inject=["injector"];var Qt={__init__:["expressionLanguages"],expressionLanguages:["type",ul]};var fl=class{constructor(e){this._feelLanguageContext=e}getConfig(){return this._feelLanguageContext}};fl.$inject=["config.feelLanguageContext"];var Yn={__init__:["feelLanguageContext"],feelLanguageContext:["type",fl]};var nh=class extends L{render({rows:e,cols:t}){let{components:i}=this.context;return y(1,"tbody",null,e.map((r,o)=>{let s=i.getComponent("row",{rowType:"rule"});return s&&P(2,s,{row:r,rowIndex:o,cols:t},r.id)}),0)}};var ih=class extends L{constructor(e,t){super(e,t),Ut(this,xi)}render(){let{row:e,rowIndex:t,cols:i}=this.props,{cells:r}=e;return y(1,"tr",null,[this.slotFills({type:"cell",context:{cellType:"before-rule-cells",row:e,rowIndex:t}}),r.map((o,s)=>this.slotFill({type:"cell",context:{cellType:"rule",cell:o,rowIndex:t,colIndex:s},key:o.id,row:e,col:i[s]})),this.slotFills({type:"cell",context:{cellType:"after-rule-cells",row:e,rowIndex:t}})],0)}};var rh=class extends L{render(){let{cell:e,row:t,col:i}=this.props;return O(e,"dmn:UnaryTests")?P(2,Rn,{className:"input-cell",elementId:e.id,"data-row-id":t.id,"data-col-id":i.id,children:e.businessObject.text}):P(2,Rn,{className:"output-cell",elementId:e.id,"data-row-id":t.id,"data-col-id":i.id,children:e.businessObject.text})}};var hl=class{constructor(e){e.onGetComponent("table.body",()=>nh),e.onGetComponent("row",({rowType:t})=>{if(t==="rule")return ih}),e.onGetComponent("cell",({cellType:t})=>{if(t==="rule")return rh})}};hl.$inject=["components"];var tg={__depends__:[Qt,Yn],__init__:["decisionRules"],decisionRules:["type",hl]};var oh=[{label:"Unique",value:{hitPolicy:"UNIQUE",aggregation:void 0},explanation:"No overlap is possible and all rules are disjoint. Only a single rule can be matched"},{label:"First",value:{hitPolicy:"FIRST",aggregation:void 0},explanation:"Rules may overlap. The first matching rule will be chosen"},{label:"Priority",value:{hitPolicy:"PRIORITY",aggregation:void 0},explanation:"Rules may overlap. The one with the highest priority will be chosen"},{label:"Any",value:{hitPolicy:"ANY",aggregation:void 0},explanation:"Rules may overlap. Their output have to match"},{label:"Collect",value:{hitPolicy:"COLLECT",aggregation:void 0},explanation:"Collects the values of all matching rules"},{label:"Collect (Sum)",value:{hitPolicy:"COLLECT",aggregation:"SUM"},explanation:"Collects the values of all matching rules and sums up to a single value"},{label:"Collect (Min)",value:{hitPolicy:"COLLECT",aggregation:"MIN"},explanation:"Collects the values of all matching rules and uses the lowest value"},{label:"Collect (Max)",value:{hitPolicy:"COLLECT",aggregation:"MAX"},explanation:"Collects the values of all matching rules and uses the highest value"},{label:"Collect (Count)",value:{hitPolicy:"COLLECT",aggregation:"COUNT"},explanation:"Collects the values of all matching rules and counts the number of them"},{label:"Rule order",value:{hitPolicy:"RULE ORDER",aggregation:void 0},explanation:"Collects the values of all matching rules in rule order"},{label:"Output order",value:{hitPolicy:"OUTPUT ORDER",aggregation:void 0},explanation:"Collects the values of all matching rules in decreasing output priority order"}];var dl=class extends L{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),Ce(this)}getRoot(){return this.sheet.getRoot()}render(){let e=this.getRoot(),t=e.businessObject,{aggregation:i,hitPolicy:r}=t,o=ye(oh,s=>J3(s.value,{aggregation:i,hitPolicy:r}));return y(1,"div","hit-policy header",[y(1,"label","dms-label",this._translate("Hit policy:"),0),y(1,"span","hit-policy-value",this._translate(o.label),0)],4,{title:this._translate(o.explanation)})}};dl.$inject=["sheet"];function J3(n,e){return n.hitPolicy===e.hitPolicy&&n.aggregation===e.aggregation}function ng(n){n.onGetComponent("hit-policy",()=>dl)}ng.$inject=["components"];var sR={__init__:["hitPolicyProvider"],hitPolicyProvider:["type",ng]};var sh=class extends L{constructor(t,i){super(t,i);M(this,"onClick",()=>{this._eventBus.fire("showDrd")});let{injector:r}=i;this._translate=r.get("translate"),this._eventBus=r.get("eventBus")}render(){return y(1,"div","view-drd",y(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,t=>this.node=t)}};var pl=class{constructor(e,t,i,r){this._injector=i,this._sheet=r,e.onGetComponent("table.before",()=>{if(this.canViewDrd())return sh}),t.on("showDrd",()=>{let o=i.get("_parent",!1),s=r.getRoot(),a=aR(s);if(!a)return;let l=o.getView(a);o.open(l)})}canViewDrd(){let e=this._injector.get("_parent",!1);if(!e)return!1;let t=this._sheet.getRoot(),i=aR(t);return!!e.getView(i)}};pl.$inject=["components","eventBus","injector","sheet"];function aR(n){let{businessObject:e}=n;return e?e.$parent.$parent:void 0}var lR={__init__:["viewDrd"],viewDrd:["type",pl]};var ml=class{constructor(e){e.onGetComponent("table.before",()=>co)}};ml.$inject=["components"];var cR={__init__:["poweredBy"],poweredBy:["type",ml]};var Ao=class n extends Kk{constructor(e={}){let t=n._createContainer();super(T(e,{renderer:{container:t}})),this._container=t}open(e){var t=this;return new Promise((i,r)=>{var o;try{return t._decision&&t.clear(),t._decision=e,Gk(t,e,function(s,a){s?(s.warnings=a||[],r(s)):i({warnings:a||[]})})}catch(s){o=s}o?(o.warnings=o.warnings||[],r(o)):i({warnings:[]})})}_init(e){let{modules:t,additionalModules:i,...r}=e,o=t||this.getModules(),s=i||[],a=[{decisionTable:["value",this]}];return{modules:[cR,...o,...s,...a],config:r}}on(e,t,i,r){return this.get("eventBus").on(e,t,i,r)}off(e,t){this.get("eventBus").off(e,t)}_emit(e,t){return this.get("eventBus").fire(e,t)}attachTo(e){if(!e)throw new Error("parentNode required");this.detach();let t=this._container;e.appendChild(t),this._emit("attach",{})}detach(){let e=this._container;e.parentNode&&(this._emit("detach",{}),Qe(e))}destroy(){super.destroy(),this.detach()}getModules(){return n._getModules()}static _getModules(){return[eR,nR,qe,iR,rR,oR,tg,sR,lR]}static _createContainer(){return te('<div class="dmn-decision-table-container"></div>')}};var gl=class extends L{constructor(t,i){super(t,i);M(this,"handleClick",t=>{t.stopPropagation(),this.addRule(t.target.dataset.colIndex)});Ce(this),this.addRule=this.addRule.bind(this)}componentWillMount(){this._eventBus=this.context.injector.get("eventBus")}addRule(t){this._eventBus.fire("addRule",{colIndex:t})}render(){let{cols:t}=this.props,i=[y(1,"td","add-rule-add",y(1,"button","dmn-icon-plus action-icon",null,1,{title:this.translate("Add rule")}),2)],{businessObject:r}=this.sheet.getRoot();(!r.input||!r.input.length)&&i.push(y(1,"td","input-cell",Z("-"),2));for(let o=0;o<t.length+1;o++){let s="add-rule",a=t[o]&&t[o].businessObject,l="";a?(a.$instanceOf("dmn:InputClause")&&(s+=" input-cell",l="-"),a.$instanceOf("dmn:OutputClause")&&(s+=" output-cell")):s+=" annotation",i.push(y(1,"td",s,l,0,{"data-col-index":o}))}return y(1,"tfoot","actionable add-rule",y(1,"tr",null,i,0),2,{onClick:this.handleClick})}};gl.$inject=["sheet","translate"];var yl=class{constructor(e,t,i,r){e.onGetComponent("table.foot",()=>gl),i.on("addRule",(o,s)=>{let a=t.trigger("addRule"),l=s.colIndex;a.cells[l]?r.select(a.cells[l]):r.select(a.cells[0])})}};yl.$inject=["components","editorActions","eventBus","selection"];var vl=class{constructor(e,t,i){this._elementRegistry=e,this._eventBus=t,this._renderer=i,this._selection=void 0,t.on("diagram.clear",()=>{this._selection=void 0})}select(e){Ie(e)&&(e=this._elementRegistry.get(e));let t=this._selection;t!==e&&(this._selection=e,this._eventBus.fire("selection.changed",{oldSelection:t,selection:e}))}deselect(){let e=this._selection;this._selection=void 0,this._eventBus.fire("selection.changed",{oldSelection:e,selection:this._selection})}get(){return this._selection}hasSelection(){return!!this._selection}};vl.$inject=["elementRegistry","eventBus","renderer"];var xl=class{constructor(e,t,i,r){this._elementRegistry=e,this._renderer=i,this._selection=r,t.on(["cell.click","cell.contextmenu"],({id:o})=>{let s=e.get(o);s&&r.select(s)}),t.on("row.remove",({row:o})=>{let s=r.get();s&&o===s.row&&r.deselect()}),t.on("col.remove",({col:o})=>{let s=r.get();s&&o===s.col&&r.deselect()})}};xl.$inject=["elementRegistry","eventBus","renderer","selection"];var Mo={__init__:["selection","selectionBehavior"],selection:["type",vl],selectionBehavior:["type",xl]};function e5(n,e,t){return(e=t5(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function t5(n){var e=n5(n,"string");return typeof e=="symbol"?e:e+""}function n5(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var uR=["click","dblclick","contextmenu","mousedown","mouseup","mouseenter","mouseleave","mouseout","mouseover","mousemove","focusin","focusout","drag","dragstart","dragend","dragover","dragenter","dragleave","drop"],bl=class{constructor(e,t){e5(this,"_handleEvent",i=>{let{target:r,type:o}=i,s=i5(r);if(!s)return;let a=s.getAttribute("data-element-id");if(a){let l=this._eventBus.createEvent({id:a,event:i,node:s,target:s});this._eventBus.fire(`cell.${o}`,l),l.defaultPrevented&&i.preventDefault(),l.cancelBubble&&i.stopPropagation()}}),this._eventBus=t,this._container=e.container,t.on("table.init",()=>{this._addEventListeners(uR)}),t.on("table.destroy",()=>{this._removeEventListeners(uR)})}_addEventListeners(e){let t=this._container;e.forEach(i=>{t.addEventListener(i,this._handleEvent)})}_removeEventListeners(e){let t=this._container;e.forEach(i=>{t.removeEventListener(i,this._handleEvent)})}};bl.$inject=["config.renderer","eventBus"];function i5(n){return De(n,"[data-element-id]",!0)}var _l={__init__:["interactionEvents"],interactionEvents:["type",bl]};var Jx=Pw(hR());function r5(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Kx,dR;function o5(){if(dR)return Kx;dR=1,Kx=n;function n(e,t){return e^t}return Kx}var Gx,pR;function s5(){if(pR)return Gx;pR=1;var n=/\b(Array|Date|Object|Math|JSON)\b/g;Gx=function(o,s){var a=i(e(o));return s&&typeof s=="string"&&(s=r(s)),s?t(o,a,s):a};function e(o){return o.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(n,"").match(/[a-zA-Z_]\w*/g)||[]}function t(o,s,a){var l=/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g;return o.replace(l,function(c){return c[c.length-1]=="("||~s.indexOf(c)?a(c):c})}function i(o){for(var s=[],a=0;a<o.length;a++)~s.indexOf(o[a])||s.push(o[a]);return s}function r(o){return function(s){return o+s}}return Gx}var Xx,mR;function a5(){if(mR)return Xx;mR=1;var n=o5(),e=s5();Xx=t;function t(r,o){if(!(this instanceof t))return new t(r,o);if(this.node=this.start=this.peeked=r,this.root=o,this.closingTag=!1,this._revisit=!0,this._selects=[],this._rejects=[],r&&this.higher(r))throw new Error("root must be a parent or ancestor to node")}t.prototype.reset=function(r){return this.node=r||this.start,this},t.prototype.revisit=function(r){return this._revisit=r==null?!0:r,this},t.prototype.opening=function(){return this.node.nodeType==1&&(this.closingTag=!1),this},t.prototype.atOpening=function(){return!this.closingTag},t.prototype.closing=function(){return this.node.nodeType==1&&(this.closingTag=!0),this},t.prototype.atClosing=function(){return this.closingTag},t.prototype.next=i("nextSibling","firstChild"),t.prototype.previous=t.prototype.prev=i("previousSibling","lastChild");function i(r,o){var s=r=="nextSibling";return function(l,c,u){l=this.compile(l),c=c&&c>0?c:1;for(var f=this.node,h=this.closingTag,d=this._revisit;f;){if(n(s,h)&&f[o])f=f[o],h=!s;else if(f.nodeType==1&&!f[o]&&n(s,h)){if(h=s,!d)continue}else if(f[r])f=f[r],h=!s;else if(f=f.parentNode,h=s,!d)continue;if(!f||this.higher(f,this.root))break;if(l(f)&&this.selects(f,u)&&this.rejects(f,u)){if(--c)continue;return u||(this.node=f),this.closingTag=h,f}}return null}}return t.prototype.select=function(r){return r=this.compile(r),this._selects.push(r),this},t.prototype.selects=function(r,o){var s=this._selects,a=s.length;if(!a)return!0;for(var l=0;l<a;l++)if(s[l].call(this,r,o))return!0;return!1},t.prototype.reject=function(r){return r=this.compile(r),this._rejects.push(r),this},t.prototype.rejects=function(r,o){var s=this._rejects,a=s.length;if(!a)return!0;for(var l=0;l<a;l++)if(s[l].call(this,r,o))return!1;return!0},t.prototype.higher=function(r){var o=this.root;if(!o)return!1;for(r=r.parentNode;r&&r!=o;)r=r.parentNode;return r!=o},t.prototype.compile=function(r){switch(typeof r){case"number":return function(o){return r==o.nodeType};case"string":return new Function("node","Object.freeze(node); return "+e(r,"node."));case"function":return r;default:return function(){return!0}}},t.prototype.peak=t.prototype.peek=function(r,o){return arguments.length==1&&(o=r,r=!0),o=o==null?1:o,o?o>0?this.next(r,o,!0):this.prev(r,Math.abs(o),!0):this.node},t.prototype.use=function(r){return r(this),this},Xx}var l5=a5(),gR=r5(l5),Zn=window.getSelection();function Zx(n){Zn==null||Zn.removeAllRanges(),Zn==null||Zn.addRange(n)}function yR(){return Zn}function c5(n){if(!(Zn!=null&&Zn.rangeCount))return null;var e=Zn.focusNode;return ig(e)&&(e=e.parentNode),n==e||n.contains(e)}function rg(n,e){var t=u5(n,e);Zx(t)}function wl(n){if(!c5(n))return null;var e=Zn.getRangeAt(0),t=e.startContainer,i=e.endContainer,r=e.startOffset,o=e.endOffset,s=gR(n.firstChild,n),a=s.node,l,c=!1,u,f=0;function h(p,m){return arguments.length===1&&(m=p),p.parentNode===i&&m==i.childNodes[o]}function d(p,m){return arguments.length===1&&(m=p),p.parentNode===t&&m==t.childNodes[r]}for(;a&&(d(a)&&!c&&(u=f),!(h(a)||Yx(a)&&i===a));){if(c||(Yx(a)||l&&l.nextSibling==a&&(vR(a)||xR(a)))&&f++,ig(a)){if(t===a&&(u=f+r),i===a){f+=o;break}f+=a.textContent.length}if((ig(a)||c)&&(d(a,a.nextSibling)&&(u=f),h(a,a.nextSibling)))break;l=a,a=s.next(),c=s.closingTag}return{start:typeof u=="undefined"?f:u,end:f}}function u5(n,e){for(var t=e.start,i=e.end,r=document.createRange(),o=gR(n.firstChild,n),s=o.node,a=!1,l=0,c;s;){if(l===t&&(a?r.setStartAfter(s):r.setStartBefore(s)),l===i)return a?r.setEndAfter(s):r.setEndBefore(s),r;if(a||(Yx(s)||s.previousSibling&&(vR(s)||xR(s)))&&l++,ig(s)){if(c=s.textContent.length,l<=t&&l+c>t&&r.setStart(s,t-l),l+c>i)return r.setEnd(s,i-l),r;l+=c}s=o.next(),a=o.closingTag}return l<=t&&(n.lastChild?r.setStartAfter(n.lastChild):r.setStart(n,0)),n.lastChild?r.setEndAfter(n.lastChild):r.setEnd(n,0),r}function ig(n){return n.nodeType===3}function Yx(n){return n.nodeType===1&&n.nodeName==="BR"}function vR(n){return n.nodeType===1&&n.nodeName==="DIV"}function xR(n){return n.nodeType===1&&n.nodeName==="P"}var f5="[contenteditable]",h5="[data-element-id]";function ah(n){return n.getAttribute("data-element-id")}function bR(n){let e=n.getAttribute("data-coords");if(!e)return null;let[t,i]=e.split(":");return{row:t,col:i}}function _R(n,e){let t=`${n.row}:${n.col}`;return X(`[data-coords="${(0,Jx.default)(t)}"]`,e)}function Gi(n,e){return X(`[data-element-id="${(0,Jx.default)(n)}"]`,e)}function wR(n){return De(n,".no-deselect",!0)}function lh(n){return De(n,h5,!0)}function e0(n){let e=f5;return hr(n,e)?n:X(e,n)}function CR(n){let e=e0(n);if(!e||!document.body.contains(e)||document.activeElement===e)return;e.focus();let t=wl(e);(!t||t.end===0)&&window.getSelection().setPosition(e.firstChild,e.firstChild.length)}var t0=500,d5={above:!0,below:!0,right:!0,left:!0};function og(n,e,t,i,r){let{container:o}=n,s=null;function a(h,d){e.fire("selection."+h+".changed",d),e.fire("cellSelection.changed",{elementId:h,selection:d})}function l(h){let d=h.target;if(wR(d))return;let p=lh(d),m=p&&ah(p),g=!h.defaultPrevented;f(m,g)}function c(h){let d=ah(h.target),p=!h.defaultPrevented;return h.stopPropagation(),f(d,p)}function u(h){let d=ah(h.target);a(d,{focussed:!1})}function f(h,d=!0){s!==h&&a(s,{selected:!1,focussed:!1}),s=h,h&&a(h,{selected:!0,focussed:d}),h?i.select(h):i.deselect()}e.on("cell.click",t0,l),e.on("cell.focusin",t0,c),e.on("cell.focusout",t0,u),e.on("cellSelection.changed",function(h){let{elementId:d,selection:p}=h,m=Gi(d,o);p.focussed&&m&&CR(m)}),e.on("selection.changed",function(h){let{selection:d,oldSelection:p}=h;var m=d&&d.id,g=p&&p.id;m&&m!==s?f(d.id):g&&g===s&&f()}),this.isCellSelected=function(){return!!s},this.getCellSelection=function(){return s},this.selectCell=function(h){if(!s)return;if(!(h in d5))throw new Error("direction must be any of { above, below, left, right }");var d=Gi(s,o);let p=bR(d);if(!p)return!1;let m=p5(p,h),g=_R(m,o);if(!g)return!1;let b=ah(g);return b&&f(b,{focussed:!0,selected:!0}),!0},e.on("contextMenu.close",function(){if(s)return f(s)})}og.$inject=["config.renderer","eventBus","sheet","selection","elementRegistry"];function p5(n,e){let{row:t,col:i}=n;if(e==="above"||e==="below"){let r=parseInt(t,10);if(isNaN(r))return n;let o=e==="above"?r-1:r+1;return{col:i,row:o}}if(e==="left"||e==="right"){let r=parseInt(i,10);if(isNaN(r))return n;let o=e==="left"?r-1:r+1;return{row:t,col:o}}throw new Error("invalid direction <"+e+">")}var Po={__depends__:[_l,Mo],__init__:["cellSelection"],cellSelection:["type",og]};function Ms(){}Ms.prototype.get=function(){return this._data};Ms.prototype.set=function(n){this._data=n};Ms.prototype.clear=function(){var n=this._data;return delete this._data,n};Ms.prototype.isEmpty=function(){return!this._data};var sg={clipboard:["type",Ms]};var n0=2e3,Cl=class extends Vi{constructor(e,t){super(e),this._sheet=t}init(){this.addRule("col.move",n0,({col:e,index:t})=>{let{businessObject:i}=this._sheet.getRoot(),{input:r}=i;return ie(e)?t<r.length:t>=r.length}),this.addRule("col.remove",n0,({col:e})=>{let{cols:t}=this._sheet.getRoot();return Te(e)?t.filter(i=>Te(i)).length>1:!0}),this.addRule("paste",n0,({data:e,target:t})=>{if(!e||!t)return!1;let{root:i}=e;return t instanceof pt?this.canPasteRows(i):t instanceof mt?this.canPasteCols(i,t):!1})}canPasteRows(e){let{cols:t}=this._sheet.getRoot();return kt(e,i=>i.type!=="row"||i.cells.length!==t.length?!1:kt(i.cells,(r,o)=>ie(t[o])?r.businessObject.$type==="dmn:UnaryTests":r.businessObject.$type==="dmn:LiteralExpression"))}canPasteCols(e,t){let{rows:i}=this._sheet.getRoot();return kt(e,r=>r.type!=="col"||r.cells.length!==i.length?!1:ie(t)?r.businessObject.$type==="dmn:InputClause":r.businessObject.$type==="dmn:OutputClause")}};Cl.$inject=["eventBus","sheet"];var ER={__depends__:[yn]};var El={__depends__:[ER],__init__:["decisionTableModelingRules"],decisionTableModelingRules:["type",Cl]};var Sl=class{constructor(e,t,i){this._clipboard=e,this._modeling=t,this._sheet=i}execute(e){let{data:t}=e;return e.oldData=this._clipboard.get(),this._clipboard.set(t),this._sheet.getRoot()}postExecute(e){let{elements:t}=e;t.forEach(i=>{i instanceof pt?this._modeling.removeRow(i):i instanceof mt&&this._modeling.removeCol(i)})}revert(e){let{oldData:t}=e;return this._clipboard.set(t),this._sheet.getRoot()}};Sl.$inject=["clipboard","modeling","sheet"];var m5=[x5,b5],g5=[S5,E5];function ag(n,e,t){return t=t||m5,e=e||{},F(n)?y5(n,e,t):SR(n,e,t)}function y5(n,e,t){return st(n,(i,r)=>{var o=i.descriptorCache,s=i.root;let{root:a,descriptorCache:l}=SR(r,o,t);return{root:[...s,a],descriptorCache:{...o,...l}}},{root:[],descriptorCache:e})}function SR(n,e,t){var i=n.id,r={id:i},o=e.elements||{},s=o[i];if(s)return{root:s,descriptorCache:e};let a=v5(n,r,t,{...e,elements:o});return{root:a.root,descriptorCache:{...a.descriptorCache,elements:{...a.descriptorCache.elements,[i]:a.root}}}}function v5(n,e,t,i){function r(o,s){return ag(o,s,t)}return st(t,function(o,s){return s(n,o.root,o.descriptorCache,r)},{root:e,descriptorCache:i})}function x5(n,e,t,i){var r=t,o={...e,type:_5(n)};if(n instanceof pt||n instanceof mt){let s=i(n.cells,r);o.cells=s.root,r=s.descriptorCache}return{root:o,descriptorCache:r}}function b5(n,e,t){var i=n.businessObject;if(!i)return{root:e,descriptorCache:t};var r=i0(i,t);return{root:{...e,businessObject:r.root},descriptorCache:r.descriptorCache}}function _5(n){if(n instanceof pt)return"row";if(n instanceof mt)return"col";if(n instanceof ko)return"cell";throw new Error("cannot deduce element type: #"+n.id)}function i0(n,e){var t,i,r=n.id;if(r&&(t=e.boCache||{},i=t[r],i))return{root:i,descriptorCache:e};var o={$type:n.$type};return r&&(o.id=r,t={...t,[r]:o},e={...e,boCache:t}),n.$descriptor.properties.forEach(function(s){var a=n[s.name];if(a){if(F(a)&&(a=a.map(l=>{var c=i0(l,e);return e=c.descriptorCache,c.root})),a.$type){let l=i0(a,e);e=l.descriptorCache,a=l.root}o[s.name]=a}}),{root:o,descriptorCache:e}}function o0(n,e,t){return t=t||g5,e=e||{},F(n.root)?w5(n,e,t):OR(n,e,t)}function w5(n,e,t){let i=n.root,r=n.descriptorCache;return st(i,(o,s)=>{var a=o.reviveCache,l=o.root;let{root:c,reviveCache:u}=OR({root:s,descriptorCache:r},a,t);return{root:[...l,c],reviveCache:u}},{root:[],reviveCache:e})}function OR(n,e,t){var i=n.root,r=i.id,o=e.elements||{},s=o[r];if(s)return{root:s,reviveCache:e};var a={id:r};let l=C5(n,a,t,{...e,elements:o});return{root:l.root,reviveCache:{...l.reviveCache,elements:{...l.reviveCache.elements,[r]:l.root}}}}function C5(n,e,t,i){function r(o,s){return o0(o,s,t)}return st(t,function(o,s){return s(n,o.root,o.reviveCache,r)},{root:e,reviveCache:i})}function E5(n,e,t,i){var r=n.root,o=n.descriptorCache,s={...e};if(e.businessObject&&e.businessObject.id&&(s.id=e.businessObject.id),r.type==="row"||r.type==="col"){let c=i({root:r.cells,descriptorCache:o},t);s.cells=c.root,t=c.reviveCache}var a=O5(r),l=new a(s);return l instanceof pt?l.cells.forEach(c=>{c.row=l}):l instanceof mt&&l.cells.forEach(c=>{c.col=l}),{root:l,reviveCache:t}}function S5(n,e,t){var i=n.root.businessObject;if(!i)return{root:e,reviveCache:t};var r=r0({root:i,descriptorCache:n.descriptorCache},t);return{root:{...e,businessObject:r.root},reviveCache:r.reviveCache}}function O5(n){switch(n.type){case"row":return pt;case"cell":return ko;case"col":return mt;default:throw new Error("unknown element type: #"+n.type)}}function r0(n,e){var t=n.root,i=t.id;let r,o;if(i&&(r=e.boCache||{},o=r[i],o))return{root:o,reviveCache:e};var s={};di(t).forEach(c=>{let u,f;t[c].$type?(f=r0({root:t[c]},e),u=f.root,e=f.reviveCache,r=e.boCache||{}):F(t[c])?u=t[c].map(h=>(f=r0({root:h},e),e=f.reviveCache,r=e.boCache||{},f.root)):u=t[c],s[c]=u});let a=s.$type;delete s.$type,(!e._keepIds||e._model.ids.assigned(s.id))&&delete s.id;var l=e._dmnFactory.create(a,s);return k(s,c=>{c.$type&&(c.$parent=l),F(c)&&c.forEach(u=>u.$parent=l)}),i&&(r={...r,[i]:l},e={...e,boCache:r}),{root:l,reviveCache:e}}var Ol=class{constructor(e,t,i,r,o,s,a,l){this._clipboard=e,this._dmnFactory=t,this._elementFactory=i,this._elementRegistry=r,this._eventBus=o,this._model=s,this._modeling=a,this._sheet=l}postExecute(e){let{element:t,after:i}=e,r=this._clipboard.get();if(!r)throw new Error("missing clipboard data");let o=this._sheet.getRoot(),s=o0(r.elements,{_dmnFactory:this._dmnFactory,_keepIds:r.keepIds,_model:this._model}).root;if(t instanceof pt){let a=o.rows.indexOf(t);if(a===-1)return;s.forEach(l=>{i&&a++,this._modeling.addRow(l,a)})}else if(t instanceof mt){let a=o.cols.indexOf(t);if(a===-1)return;s.forEach(l=>{i&&a++,this._modeling.addCol(l,a)})}return e.oldElements=this._clipboard.get(),this._sheet.getRoot()}revert(e){}};Ol.$inject=["clipboard","dmnFactory","elementFactory","elementRegistry","eventBus","moddle","modeling","sheet"];var kl=class{constructor(e,t,i,r,o,s){this._clipboard=e,this._commandStack=t,this._eventBus=i,this._modeling=r,this._sheet=o,this._rules=s,t.registerHandler("cut",Sl),t.registerHandler("paste",Ol)}copy(e){F(e)||(e=[e]);let t={elements:ag(e)};this._eventBus.fire("copyCutPaste.copy",{data:t}),this._clipboard.set(t)}cut(e){F(e)||(e=[e]);let t={elements:ag(e),keepIds:!0},i={elements:e,data:t};this._eventBus.fire("copyCutPaste.cut",{data:t}),this._commandStack.execute("cut",i)}pasteBefore(e){return this._paste(e,{before:!0})}pasteAfter(e){return this._paste(e,{after:!0})}_paste(e,t){let i=this._clipboard.get();return i?this._rules.allowed("paste",{data:i.elements,target:e})?(this._commandStack.execute("paste",{element:e,...t}),this._clipboard.clear(),!0):!1:void 0}pasteAt(e){}};kl.$inject=["clipboard","commandStack","eventBus","modeling","sheet","rules"];var lg={__depends__:[sg,El],__init__:["copyCutPaste"],copyCutPaste:["type",kl]};var Rl=class{constructor(e,t,i,r,o,s){let a={addRule(){return i.addRow({type:"dmn:DecisionRule"})},addRuleAbove(l){let c=l&&l.rule;if(!c&&!r.hasSelection())return;c=c||r.get().row;let u=s.getRoot(),f=u.rows.indexOf(c);if(f!==-1)return i.addRow({type:"dmn:DecisionRule"},f)},addRuleBelow(l){let c=l&&l.rule;if(!c&&!r.hasSelection())return;c=c||r.get().row;let u=s.getRoot(),f=u.rows.indexOf(c);if(f!==-1)return i.addRow({type:"dmn:DecisionRule"},f+1)},removeRule(l){let c=l&&l.rule;!c&&!r.hasSelection()||(c=c||r.get().row,i.removeRow(c))},addInput(){let l=s.getRoot(),c=l.businessObject,{input:u}=c;return i.addCol({type:"dmn:InputClause"},u?u.length:0)},addInputLeft(l){let c=l&&l.input;if(!c&&!r.hasSelection())return;c=c||r.get().col;let u=s.getRoot(),f=u.cols.indexOf(c);if(f!==-1)return i.addCol({type:"dmn:InputClause"},f)},addInputRight(l){let c=l&&l.input;if(!c&&!r.hasSelection())return;c=c||r.get().col;let u=s.getRoot(),f=u.cols.indexOf(c);if(f!==-1)return i.addCol({type:"dmn:InputClause"},f+1)},removeInput(l){let c=l&&l.input;!c&&!r.hasSelection()||(c=c||r.get().col,i.removeCol(c))},addOutput(){let l=s.getRoot(),c=l.businessObject,u=c.get("input"),f=c.get("output");return i.addCol({type:"dmn:OutputClause"},u.length+f.length)},addOutputLeft(l){let c=l&&l.output;if(!c&&!r.hasSelection())return;c=c||r.get().col;let u=s.getRoot(),f=u.cols.indexOf(c);if(f!==-1)return i.addCol({type:"dmn:OutputClause"},f)},addOutputRight(l){let c=l&&l.output;if(!c&&!r.hasSelection())return;c=c||r.get().col;let u=s.getRoot(),f=u.cols.indexOf(c);if(f!==-1)return i.addCol({type:"dmn:OutputClause"},f+1)},removeOutput(l){let c=l&&l.output;!c&&!r.hasSelection()||(c=c||r.get().col,i.removeCol(c))},addClause(){if(!r.hasSelection())return;let l=r.get().col;if(O(l,"dmn:InputClause"))return a.addInput({input:l});if(O(l,"dmn:OutputClause"))return a.addOutput({output:l})},addClauseLeft(){if(!r.hasSelection())return;let l=r.get().col;if(O(l,"dmn:InputClause"))return a.addInputLeft({input:l});if(O(l,"dmn:OutputClause"))return a.addOutputLeft({output:l})},addClauseRight(){if(!r.hasSelection())return;let l=r.get().col;if(O(l,"dmn:InputClause"))return a.addInputRight({input:l});if(O(l,"dmn:OutputClause"))return a.addOutputRight({output:l})},removeClause(){if(!r.hasSelection())return;let l=r.get().col;if(O(l,"dmn:InputClause"))return a.removeInput({input:l});if(O(l,"dmn:OutputClause"))return a.removeOutput({output:l})},selectCellAbove(){return o.selectCell("above")},selectCellBelow(){return o.selectCell("below")},copy({element:l}){e.copy(l)},cut({element:l}){e.cut(l)},pasteBefore({element:l}){return e.pasteBefore(l)},pasteAfter({element:l}){return e.pasteAfter(l)}};t.register(a)}};Rl.$inject=["copyCutPaste","editorActions","modeling","selection","cellSelection","sheet"];var kR="is not a registered action",k5="is already registered",Tl=class{constructor(e,t,i,r){this._actions={undo(){e.undo()},redo(){e.redo()},select({cell:o}){r.select(o)},deselect(){r.deselect()},addRow({attrs:o,index:s}){i.addRow(o,s)},removeRow({row:o}){i.removeRow(o)},moveRow({row:o,index:s}){i.moveRow(o,s)},addCol({attrs:o,index:s}){i.addCol(o,s)},removeCol({col:o}){i.removeCol(o)},moveCol({col:o,index:s}){i.moveCol(o,s)}}}trigger(e,t){if(!this._actions[e])throw s0(e,kR);return this._actions[e](t)}register(e,t){if(typeof e=="string")return this._registerAction(e,t);k(e,(i,r)=>{this._registerAction(r,i)},this)}_registerAction(e,t){if(this.isRegistered(e))throw s0(e,k5);this._actions[e]=t}unregister(e){if(!this.isRegistered(e))throw s0(e,kR);this._actions[e]=void 0}isRegistered(e){return!!this._actions[e]}};Tl.$inject=["commandStack","eventBus","modeling","selection"];function s0(n,e){return new Error(n+" "+e)}var cg={__depends__:[Mo],__init__:["editorActions"],editorActions:["type",Tl]};var Jn={__depends__:[Po,lg,cg,Mo],__init__:["decisionTableEditorActions"],decisionTableEditorActions:["type",Rl]};var RR={__depends__:[Jn],__init__:["addRule"],addRule:["type",yl]};var PR=Pw(AR());function MR(n,e,t){var i=n.start,r=i,o=e.substring(i);t.lastIndexOf(o)===t.length-o.length&&(e=e.substring(0,e.length-o.length),t=t.substring(0,t.length-o.length));var s=A5(e,t);return s&&(s.type==="remove"?r=s.newStart:r=s.newEnd),M5(r)}function A5(n,e){var t,i,r,o=0,s,a,l=0;for(e.length>n.length?(i=e,s=n):(i=n,s=e);o<i.length;)r=i.charAt(o),a=s.charAt(l),r!==a?(t||(t={l_start:o,s_start:l}),o++):(t&&!t.complete&&(t.l_end=o,t.s_end=l,t.complete=!0),l++,o++);if(t&&!t.complete&&(t.complete=!0,t.s_end=s.length,t.l_end=i.length),!!t)return e.length>n.length?{newStart:t.l_start,newEnd:t.l_end,type:"add"}:{newStart:t.s_start,newEnd:t.s_end,type:e.length<n.length?"remove":"replace"}}function M5(n,e){return{start:n,end:e===void 0?n:e}}var Tn=class extends L{constructor(t,i){super(t,i);M(this,"onFocus",t=>{var i=this.props.onFocus;this.setState({focussed:!0}),typeof i=="function"&&i(t)});M(this,"onBlur",t=>{let{onBlur:i,onChange:r,value:o}=this.props;if(this.setState({focussed:!1}),typeof r=="function"&&this.node){let s=ug(this.node);s!==o&&r(s)}typeof i=="function"&&i(t)});M(this,"onkeydown",t=>{if(t.which===13){if(t.preventDefault(),this.props.ctrlForNewline&&!I5(t)||this.props.singleLine)return;t.stopPropagation(),D5(),this.onInput(t)}});M(this,"onInput",t=>{var i=this.props.onInput;if(typeof i=="function"){var r=ug(this.node);i(r)}});M(this,"onPaste",t=>{if(this.props.singleLine){let i=(t.clipboardData||window.clipboardData).getData("text");document.execCommand("insertText",!1,i.replace(/\n/g," ")),t.preventDefault()}});this.state={}}componentWillUpdate(t,i){var r=this.node,o=i.focussed&&wl(r);this.selected=o&&{range:o,text:ug(r)}}componentDidUpdate(){var t=this.selected;if(!t)return;let i=t.range,r=t.text,o=this.node,s=ug(o),a=s!==r?MR(i,r,s):i;rg(o,a)}getClassName(){let{className:t,placeholder:i,value:r}=this.props;return[t||"","content-editable",!r&&i?"placeholder":""].join(" ")}render(t){var{label:i,value:r,placeholder:o}=t;return r=(0,PR.default)(r).replace(/\r?\n/g,"<br/>")+"<br/>",y(1,"div",this.getClassName(),null,1,{"aria-label":i,role:"textbox","aria-multiline":!this.props.singleLine,tabIndex:"0",contentEditable:"true",spellCheck:"false","data-placeholder":o||"",onInput:this.onInput,onkeypress:this.onkeypress,onPaste:this.onPaste,onFocus:this.onFocus,onBlur:this.onBlur,onkeydown:this.onkeydown,dangerouslySetInnerHTML:{__html:r}},null,s=>this.node=s)}};function P5(){return document.createElement("br")}function ug(n){return n.innerText.replace(/\n$/,"")}function D5(){var n=yR(),e=n.getRangeAt(0);if(e){var t=e.cloneRange(),i=P5();t.deleteContents(),t.insertNode(i),t.setStartAfter(i),t.setEndAfter(i),Zx(t)}}function I5(n){return n.metaKey||n.ctrlKey}var an=class extends L{constructor(t,i){super(t,i);M(this,"onFocus",t=>{this.setState({focussed:!0});var{onFocus:i}=this.props;typeof i=="function"&&i(t)});M(this,"onBlur",t=>{this.setState({focussed:!1});let{invalid:i}=this.state;i&&this.setState({changing:!1,invalid:!1});let{onBlur:r}=this.props;typeof r=="function"&&r(t)});this.state={changing:!1,focussed:!1};let{injector:r}=i,o=r.get("debounceInput");this.inputChanged=o(s=>{let{onChange:a}=this.props;typeof a=="function"&&a(s);let l=this.state.changing;this.setState({changing:l===s?!1:l})}),this.onInput=s=>{var a=this.props.validate||function(){},l=a(s);this.setState({changing:s,invalid:l}),l||this.inputChanged(s)}}getClassName(){var{className:t,value:i}=this.props,{changing:r,focussed:o,invalid:s}=this.state;return t+=" editable",o&&(t+=" focussed"),s&&(t+=" invalid"),!i&&!r&&(t+=" empty"),t}getDisplayValue(){var{value:t,placeholder:i}=this.props,{focussed:r,changing:o}=this.state;return typeof o=="string"&&(t=o),t||(t=r?"":i||""),t}getEditor(t={}){return P(2,Tn,{className:t.className,ctrlForNewline:this.props.ctrlForNewline,label:this.props.label,onFocus:this.onFocus,onBlur:this.onBlur,onInput:this.onInput,value:this.getDisplayValue()})}};var Al=class extends L{constructor(t,i){super(t,i);M(this,"onElementsChanged",()=>{this.forceUpdate()});M(this,"setAnnotationValue",t=>{let{row:i}=this.props;this.modeling.editAnnotation(i.businessObject,t)});Ce(this)}componentWillMount(){let{row:t}=this.props;this.changeSupport.onElementsChanged(t.id,this.onElementsChanged)}componentWillUnmount(){let{row:t}=this.props;this.changeSupport.offElementsChanged(t.id,this.onElementsChanged)}render(){let{row:t,rowIndex:i}=this.props,{description:r,id:o}=t.businessObject;return P(2,Rn,{className:"annotation",onChange:this.setAnnotationValue,coords:`${i}:annotation`,value:r,elementId:o,"data-row-id":t.id,children:P(2,a0,{label:this.translate("Annotation"),ctrlForNewline:!0,className:"annotation-editor",onChange:this.setAnnotationValue,value:r})})}};Al.$inject=["changeSupport","modeling","translate"];var a0=class extends an{render(){return y(1,"div",this.getClassName(),this.getEditor(),0)}};function fg(n){n.onGetComponent("cell",({cellType:e})=>{if(e==="after-label-cells")return To;if(e==="after-rule-cells")return Al})}fg.$inject=["components"];var L5=300;function hg(n){return function(t){if(n!==!1){var i=se(n)?n:L5;return Mi(t,i)}else return t}}hg.$inject=["config.debounceInput"];var Kt={debounceInput:["factory",hg]};var DR={__depends__:[Kt],__init__:["annotationsProvider"],annotationsProvider:["type",fg]};function Ps(n,e,t){return(e=B5(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function B5(n){var e=N5(n,"string");return typeof e=="symbol"?e:e+""}function N5(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var $5={position:"absolute"},Ml=class extends L{constructor(e,t){super(e,t),Ps(this,"open",({position:i,context:r})=>{this.close(),this.setState({isOpen:!0,position:i||{x:0,y:0},context:r||{}})}),Ps(this,"close",()=>{this.state.isOpen&&this.setState({context:void 0,isOpen:!1,position:{x:0,y:0}})}),Ps(this,"triggerClose",()=>{this.eventBus.fire("contextMenu.close")}),this.state={isOpen:!1,position:{x:0,y:0}},Ce(this)}componentDidMount(){this.eventBus.on("contextMenu.open",this.open),this.eventBus.on("contextMenu.close",this.close)}componentWillUnmount(){this.eventBus.off("contextMenu.open",this.open),this.eventBus.off("contextMenu.close",this.close)}render(){let{isOpen:e,context:t,position:i}=this.state;if(!e)return null;let r=this.components.getComponents("context-menu",t);return r.length?P(2,dg,{className:"context-menu no-deselect",context:t,position:i,offset:t.offset||{x:0,y:0},autoFocus:t.autoFocus!==!1,autoClose:t.autoClose!==!1,components:r,onClose:this.triggerClose}):null}};Ml.$inject=["eventBus","components"];var dg=class extends L{constructor(e,t){super(e,t),Ps(this,"onGlobalMouseDown",i=>{this.checkClose(i.target)}),Ps(this,"onGlobalKey",i=>{var r=i.which;(r===13||r===27)&&(i.stopPropagation(),i.preventDefault(),this.close())}),Ps(this,"onFocusChanged",i=>{this.checkClose(i.target)}),Ps(this,"setNode",i=>{this.node=i;let{autoFocus:r}=this.props;i&&(this.updatePosition(),r&&F5(i))}),Ce(this)}close(){let{onClose:e}=this.props;ge(e)&&e()}checkClose(e){let{autoClose:t}=this.props;if(t){var i=this.node;i&&i!==e&&(i.contains(e)||this.close())}}componentDidMount(){document.addEventListener("focusin",this.onFocusChanged),document.addEventListener("keydown",this.onGlobalKey),document.addEventListener("mousedown",this.onGlobalMouseDown)}componentWillUnmount(){document.removeEventListener("focusin",this.onFocusChanged),document.removeEventListener("keydown",this.onGlobalKey),document.removeEventListener("mousedown",this.onGlobalMouseDown)}updatePosition(){let{position:e,offset:t}=this.props,{node:i}=this,r=i.getBoundingClientRect();e.width||(e.width=0),e.height||(e.height=0);let o=this.renderer.getContainer(),s=o.getBoundingClientRect();s.width>s.height?(this.node.classList.add("horizontal"),this.node.classList.remove("vertical")):(this.node.classList.add("vertical"),this.node.classList.remove("horizontal"));let{scrollLeft:a,scrollTop:l}=q5(i),c={},u;e.align&&(u=e.align.split("-"));let f,h;(u&&u[1]||(e.x+e.width/2>s.width/2?"left":"right"))==="left"?(f=e.x-s.left-r.width+t.x+a,i.classList.remove("right"),i.classList.add("left")):(f=-s.left+e.x+e.width-t.x+a,i.classList.remove("left"),i.classList.add("right")),f=u?f:IR(f,0+a,s.width-r.width+a),c.left=f+"px",(u&&u[0]||(e.y+e.height/2>s.height/2?"top":"bottom"))==="top"?(h=e.y-s.top-r.height+t.y+l,i.classList.remove("bottom"),i.classList.add("top")):(h=-s.top+e.y-t.y+l,i.classList.remove("top"),i.classList.add("bottom")),h=u?h:IR(h,0+l,s.height-r.height+l),c.top=h+"px",c.overflowY="auto",c.maxHeight=s.height-h+l+"px",T(this.node.style,$5,c)}render(){let{context:e,components:t,className:i}=this.props;return y(1,"div",i,t.map((r,o)=>P(2,r,{context:e},o)),0,{onContextMenu:r=>r.preventDefault()},null,this.setNode)}};dg.$inject=["renderer"];function IR(n,e,t){return Math.max(e,Math.min(t,n))}var j5=` 214 `,pk={width:135,height:46},mk={width:100,height:63};function Dx(n,e,t){return Q("path",{d:n,strokeWidth:2,transform:`translate(${e.x}, ${e.y})`,...t})}var Dm=5;function Ya(n,e){thi global() property [all...] |