/plugin/pdfjs/pdfjs/web/locale/hsb/ |
H A D | viewer.properties | 168 find_entire_word_label=Cyłe słowa
|
/plugin/fblogin/lib/ |
H A D | fb_ca_chain_bundle.crt | 2449 1eb4e/CX3CJrO5UUVg8RMKWaTzqwOuAGy2X17caXJ/4l8lfmXpWMPmRgFVp/Lw0BxbFg/UU1z/Cy
|
/plugin/bpmnio/vendor/bpmn-js/dist/ |
H A D | bpmn-modeler.production.min.js | 197 `,this._current.container)},Tc.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");this.isOpen()&&this.close();const{entries:r,headerEntries:o,emptyPlaceholder:a}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:o,emptyPlaceholder:a,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Tc.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()},Tc.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n);return{entries:i,headerEntries:r,emptyPlaceholder:this._getEmptyPlaceholder(n),empty:!(Object.keys(i).length||Object.keys(r).length)}},Tc.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Tc.prototype.reset=function(){const e=this._current.container;Ws(null,e),ve(e)},Tc.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Tc.prototype._onOpened=function(){this._emit("opened")},Tc.prototype._onClosed=function(){this._emit("closed")},Tc.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=he(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},Tc.prototype._bindAutoClose=function(){this._eventBus.once(Mc,this.close,this)},Tc.prototype._unbindAutoClose=function(){this._eventBus.off(Mc,this.close,this)},Tc.prototype._updateScale=function(){var e,t,n=this._canvas.zoom(),i=this._config.scale,r=n;return!0!==i&&(!1===i?(e=1,t=1):(e=i.min,t=i.max),s(e)&&n<e&&(r=e),s(t)&&n>t&&(r=t)),r},Tc.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,a=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,a=t.y-i.height):r.x?(o=t.x-i.width,a=t.y):r.y&&t.y<i.height?(o=t.x,a=10):r.y&&(o=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:o,y:a}},Tc.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length||this._getContext(e,t).empty},Tc.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},Tc.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Tc.prototype._getEntries=function(e,t){var n={};return g(t,(function(t){if(t.getPopupMenuEntries){var i=t.getPopupMenuEntries(e);h(i)?n=i(n):g(i,(function(e,t){n[t]=e}))}else g(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=I(e,["id"])}))})),n},Tc.prototype._getHeaderEntries=function(e,t){var n={};return g(t,(function(t){if(t.getPopupMenuHeaderEntries){var i=t.getPopupMenuHeaderEntries(e);h(i)?n=i(n):g(i,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;g(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=I(e,["id"])}))}})),n},Tc.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>h(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},Tc.prototype.isOpen=function(){return!!this._current},Tc.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=K(J(e.delegateTarget||e.target,".entry",!0),"data-id");t={id:n,...this._getEntry(n)}}const i=t.action;if(!1!==this._emit("trigger",{entry:t,event:e}))if(h(i)){if("click"===n)return i(e,t)}else if(i[n])return i[n](e,t)},Tc.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};var Oc={search:["value",function(e,t,n){const{keys:i}=n;if(!(t=t.trim().toLowerCase()))throw new Error("<pattern> must not be empty");const r=t.trim().toLowerCase().split(/\s+/);return e.flatMap((e=>{const t=function(e,t,n){const{matchedWords:i,tokens:r}=n.reduce(((n,i)=>{const r=e[i],{tokens:o,matchedWords:a}=function(e,t){if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(jc),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[r]=s,o=s.index,a=s.index+r.length,p=0===o,l=a===e.length,u=!!s.groups.all,h=p||/\s/.test(e.charAt(o-1)),d=l||/\s/.test(e.charAt(a+1));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:r,index:s.index,match:!0,wordStart:h,wordEnd:d,start:p,end:l,all:u});const f=u?t:[r];for(const e of f)i[e.toLowerCase()]=!0;c=s.index+r.length}c<e.length&&n.push({value:e.slice(c),index:c});return{tokens:n,matchedWords:i}}(r,t);return{tokens:{...n.tokens,[i]:o},matchedWords:{...n.matchedWords,...a}}}),{matchedWords:{},tokens:{}});if(Object.keys(i).length!==t.length)return null;return r}(e,r,i);return t?{item:e,tokens:t}:[]})).sort(function(e){return(t,n)=>{for(const i of e){const e=Dc(t.tokens[i],n.tokens[i]);if(0!==e)return e;const r=Nc(t.item[i],n.item[i]);if(0!==r)return r}return 0}}(i))}]},Lc={__depends__:[Oc],__init__:["popupMenu"],popupMenu:["type",Tc]},$c={align:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">\n <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="1650" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="350" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="850" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="900" y1="150" x2="900" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="250" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="500" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="100" y1="150" x2="100" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="100" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="100" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="1650" y1="150" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="350" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="850" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="150" x2="1650" y2="150" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="150" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="150" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',middle:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>'};function Ic(e,t,n,i){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ic.$inject=["contextPad","popupMenu","translate","canvas"],Ic.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},Ic.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ic.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${$c.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);L(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Ic.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var Fc=["left","center","right","top","middle","bottom"];function zc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}function Hc(e){Do.call(this,e),this.init()}function Vc(e){Hc.call(this,e)}zc.$inject=["popupMenu","alignElements","translate","rules"],zc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},zc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},zc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return g(Fc,(function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:$c[o],action:function(){t.trigger(e,o),i.close()}}})),r},Hc.$inject=["eventBus"],e(Hc,Do),Hc.prototype.addRule=function(e,t,n){var i=this;"string"==typeof e&&(e=[e]),e.forEach((function(e){i.canExecute(e,t,(function(e,t,i){return n(e)}),!0)}))},Hc.prototype.init=function(){},Vc.$inject=["eventBus"],e(Vc,Hc),Vc.prototype.init=function(){this.addRule("elements.align",(function(e){var t=y(e.elements,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));return!((t=st(t)).length<2)&&t}))};var Gc={__depends__:[is,vs,Lc],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ic],alignElementsMenuProvider:["type",zc],bpmnAlignElements:["type",Vc]};function Wc(e,t,n,i){for(var r;r=qc(e,n,t);)n=i(t,n,r);return n}function Uc(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach((function(o){var a=e[o];if(a){var s="x"===o?"width":"height",c=a.margin,p=a.minDistance;r[o]=c<0?Math.min(i[o]+c-t[s]/2,n[o]-p+c):Math.max(i[o]+i[s]+c+t[s]/2,n[o]+p+c)}})),r}}function qc(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=function(e){var t=Kc(e);e.host&&(t=t.concat(Kc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(Kc(t))}),[])));return t}(e);return m(r,(function(e){return e!==n&&"intersect"===mn(e,i,10)}))}function Kc(e){return(t=e,t.outgoing.map((function(e){return e.target}))).concat(function(e){return e.incoming.map((function(e){return e.source}))}(e));var t}function Yc(){return!0}function Xc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var i=n.defaultDistance||50,r=fn(e),o=un(e);return{x:o.right+i+t.width/2,y:r.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,i,r){e.fire("autoPlace.start",{source:n,shape:i});var o=e.fire("autoPlace",{source:n,shape:i}),a=t.appendShape(n,i,o,n.parent,r);return e.fire("autoPlace.end",{source:n,shape:a}),a}}function Zc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}Xc.$inject=["eventBus","modeling","canvas"],Zc.$inject=["eventBus","selection"];var Qc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Xc],autoPlaceSelectionBehavior:["type",Zc]};function Jc(e,t){for(d(t)&&(t=[t]);e=e.parent;)if(yr(e,t))return e;return null}function ep(e,t){var n=Jc(e,"bpmn:Process");if(n)return!0;var i,r=["bpmn:Participant","bpmn:Lane"];if(n=Jc(e,r))return Lr(n);if(yr(e,r))return Lr(e);for(i=gr(e);i&&!vr(i,"bpmn:Process");i=i.$parent);if(!t)return!0;var o=t.find((function(e){var t=gr(e);return t&&t.get("processRef")===i}));return!o||Lr(o)}function tp(e,t,n){var i=ep(e,n);return vr(t,"bpmn:TextAnnotation")?function(e,t,n){var i=un(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};sn(e)&&(r=fn(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return Wc(e,t,r,Uc(a))}(e,t,i):yr(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t,n){var i=un(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return Wc(e,t,r,Uc(a))}(e,t,i):vr(t,"bpmn:FlowNode")?function(e,t,n){var i=un(e),r=fn(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=function(e,t){t||(t={});var n=t.defaultDistance||50,i=t.direction||"e",r=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},a=t.maxDistance||250,s=t.reference||"start";function c(e,t){return"n"===i?"start"===s?un(e).top-un(t).bottom:"center"===s?un(e).top-fn(t).y:un(e).top-un(t).top:"w"===i?"start"===s?un(e).left-un(t).right:"center"===s?un(e).left-fn(t).x:un(e).left-un(t).left:"s"===i?"start"===s?un(t).top-un(e).bottom:"center"===s?fn(t).y-un(e).bottom:un(t).bottom-un(e).bottom:"start"===s?un(t).left-un(e).right:"center"===s?fn(t).x-un(e).right:un(t).right-un(e).right}r||(r=Yc);var p=e.incoming.filter(r).map((function(t){var n=o(t),i=n<0?c(t.source,e):c(e,t.source);return{id:t.source.id,distance:i,weight:n}})),l=e.outgoing.filter(r).map((function(t){var n=o(t),i=n>0?c(e,t.target):c(t.target,e);return{id:t.target.id,distance:i,weight:n}})),u=_(p.concat(l).reduce((function(e,t){return e[t.id+"__weight_"+t.weight]=t,e}),{}),(function(e,t){var n=t.distance,i=t.weight;return n<0||n>a||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*i,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{});return u.distance||n}(e,{filter:function(e){return vr(e,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,p=o.baseOrientation;vr(e,"bpmn:BoundaryEvent")&&-1!==(p=mn(e,e.host,-25)).indexOf(o.boundaryOrientation)&&(s*=-1);var l=n?{x:i.right+a+t.width/2,y:r.y+np(p,c,o)}:{x:r.x+np(p,c,o),y:i.bottom+a+t.height/2},u={margin:s,minDistance:c},h=n?{y:u}:{x:u};return Wc(e,t,l,Uc(h))}(e,t,i):void 0}function np(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function ip(e,t){e.on("autoPlace",(function(e){var n=e.shape;return tp(e.source,n,t)}))}ip.$inject=["eventBus","elementRegistry"];var rp={__depends__:[Qc],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",ip]};function op(e,t,n,r){Do.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=r;var o=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},i=t.shape,r=t.parent||t.newParent;!1!==n.autoResize&&o._expand([i],r)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=i(C(t.closure.topLevel)),r=t.hints,a=!r||r.autoResize;!1!==a&&g(k(n,(function(e){return e.parent.id})),(function(e,t){p(a)&&(e=e.filter((function(e){return m(a,M({id:e.id}))}))),o._expand(e,t)}))})),this.postExecuted(["shape.toggleCollapse"],(function(e){var t=e.context,n=t.hints,i=t.shape;n&&!1===n.autoResize||i.collapsed||o._expand(i.children||[],i)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,i=t.shape,r=i.parent;n&&!1===n.autoResize||r&&o._expand([i],r)}))}function ap(e){e.invoke(op,this)}function sp(e){Hc.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function cp(e,t){sp.call(this,e),this._modeling=t}op.$inject=["eventBus","elementRegistry","modeling","rules"],e(op,Do),op.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=un(ht(e)),o=un(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),hn(L({},o,a))},op.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){var i=function(e,t){var n="";e=un(e),t=un(t),e.top>t.top&&(n=n.concat("n"));e.right<t.right&&(n=n.concat("w"));e.bottom<t.bottom&&(n=n.concat("s"));e.left>t.left&&(n=n.concat("e"));return n}($(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:i});var r=t.parent;r&&this._expand([t],r)}}},op.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},op.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},op.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},ap.$inject=["injector"],e(ap,op),ap.prototype.resize=function(e,t,n){vr(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},sp.$inject=["eventBus"],e(sp,Hc),sp.prototype.canResize=function(e,t){return!1},e(cp,sp),cp.$inject=["eventBus","modeling"],cp.prototype.canResize=function(e,t){if(vr(t.di,"bpmndi:BPMNPlane"))return!1;if(!vr(t,"bpmn:Participant")&&!vr(t,"bpmn:Lane")&&!vr(t,"bpmn:SubProcess"))return!1;var n=!0;return g(e,(function(e){(vr(e,"bpmn:Lane")||cn(e))&&(n=!1)})),n};var pp={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",ap],bpmnAutoResizeProvider:["type",cp]};function lp(e,t,n){var i,r,o=this,a=n.get("dragging",!1);a&&t.on("drag.start",(function(n){t.once("drag.move",1500,(function(t){!function(t){if(!t.hover){var n=t.originalEvent,i=o._findTargetGfx(n),r=i&&e.get(i);i&&r&&(t.stopPropagation(),a.hover({element:r,gfx:i}),a.move(n))}}(t)}))})),t.on("element.hover",(function(e){i=e.gfx,r=e.element})),t.on("element.hover",1500,(function(e){r&&t.fire("element.out",{element:r,gfx:i})})),t.on("element.out",(function(){i=null,r=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=ra(e),function(e){return J(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}lp.$inject=["elementRegistry","eventBus","injector"];var up={__init__:["hoverFix"],hoverFix:["type",lp]},hp=Math.round,dp="djs-drag-active";function fp(e){e.preventDefault()}function mp(e,t,n,i){var r,o={threshold:5,trapClick:!0};function a(e){var n=t.viewbox(),i=t._container.getBoundingClientRect();return{x:n.x+(e.x-i.left)/n.scale,y:n.y+(e.y-i.top)/n.scale}}function s(t,n){n=n||r;var i=e.createEvent(L({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,i)&&e.fire(n.prefix+"."+t,i)}function c(e,i){var o,c=r.payload,p=r.displacement,l=r.globalStart,u=ra(e),h=Ha(u,l),d=r.localStart,f=a(u),v=Ha(f,d);if(!r.active&&(i||(o=h,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>r.threshold))){if(L(c,{x:hp(d.x+p.x),y:hp(d.y+p.y),dx:0,dy:0},{originalEvent:e}),!1===s("start"))return m();r.active=!0,r.keepSelection||(c.previousSelection=n.get(),n.select(null)),r.cursor&&$a(r.cursor),t.addMarker(t.getRootElement(),dp)}ia(e),r.active&&(L(c,{x:hp(f.x+p.x),y:hp(f.y+p.y),dx:hp(v.x),dy:hp(v.y)},{originalEvent:e}),s("move"))}function p(e){var t=!0;r.active&&(e&&(r.payload.originalEvent=e,ia(e)),t=s("end")),!1===t&&s("rejected"),s("ended",v(!0!==t))}function l(e){Ra("Escape",e)&&(fp(e),m())}function u(t){var n;r.active&&(n=Fa(e),setTimeout(n,400),fp(t)),p(t)}function h(e){c(e)}function d(e){var t=r.payload;t.hoverGfx=e.gfx,t.hover=e.element,s("hover")}function f(e){s("out");var t=r.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(r){var n=r.active;n&&s("cancel"),t=v(e),n&&s("canceled",t)}}function v(o){var a,v;s("cleanup"),Ia(),v=r.trapClick?u:p,oe.unbind(document,"mousemove",c),oe.unbind(document,"dragstart",fp),oe.unbind(document,"selectstart",fp),oe.unbind(document,"mousedown",v,!0),oe.unbind(document,"mouseup",v,!0),oe.unbind(document,"keyup",l),oe.unbind(document,"touchstart",h,!0),oe.unbind(document,"touchcancel",m,!0),oe.unbind(document,"touchmove",c,!0),oe.unbind(document,"touchend",p,!0),e.off("element.hover",d),e.off("element.out",f),t.removeMarker(t.getRootElement(),dp);var y=r.payload.previousSelection;return!1!==o&&y&&!n.get().length&&function(e){var t=e.filter((function(e){return i.get(e.id)}));t.length&&n.select(t)}(y),a=r,r=null,a}e.on("diagram.destroy",m),this.init=function(t,n,i,v){r&&m(!1),"string"==typeof n&&(v=i,i=n,n=null);var y,g,b,_,x,w=(v=L({},o,v||{})).data||{};_=v.trapClick?u:p,t?(y=na(t)||t,g=ra(t),ia(t),"dragstart"===y.type&&fp(y)):(y=null,g={x:0,y:0}),b=a(g),n||(n=b),x=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(y),r=L({prefix:i,data:w,payload:{},globalStart:g,displacement:Ha(n,b),localStart:b,isTouch:x},v),v.manual||(x?(oe.bind(document,"touchstart",h,!0),oe.bind(document,"touchcancel",m,!0),oe.bind(document,"touchmove",c,!0),oe.bind(document,"touchend",p,!0)):(oe.bind(document,"mousemove",c),oe.bind(document,"dragstart",fp),oe.bind(document,"selectstart",fp),oe.bind(document,"mousedown",_,!0),oe.bind(document,"mouseup",_,!0)),oe.bind(document,"keyup",l),e.on("element.hover",d),e.on("element.out",f)),s("init"),v.autoActivate&&c(t,!0)},this.move=c,this.hover=d,this.out=f,this.end=p,this.cancel=m,this.context=function(){return r},this.setOptions=function(e){L(o,e)}}mp.$inject=["eventBus","canvas","selection","elementRegistry"];var vp={__depends__:[up,_a],dragging:["type",mp]};function yp(e,t,n){this._canvas=n,this._opts=L({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",(function(e){var t=i._toBorderPoint(e);i.startScroll(t)})),t.on(["drag.cleanup"],(function(){i.stopScroll()}))}function gp(e,t,n){return t<e&&e<n}yp.$inject=["config.autoScroll","eventBus","canvas"],yp.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)gp(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(0===c?a=n.scrollStep:1==c?s=n.scrollStep:2==c?a=-n.scrollStep:3==c&&(s=-n.scrollStep));0===a&&0===s||(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout((function(){i.startScroll(e)}),n.scrollRepeatTimeout))},yp.prototype.stopScroll=function(){clearTimeout(this._scrolling)},yp.prototype.setOptions=function(e){this._opts=L({},this._opts,e)},yp.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ra(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var bp={__depends__:[vp],__init__:["autoScroll"],autoScroll:["type",yp]};function _p(e){this._commandStack=e.get("commandStack",!1)}_p.$inject=["injector"],_p.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var xp={__init__:["rules"],rules:["type",_p]},wp=Math.round,Ep=Math.max;function Sp(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(wt(i,t)<=10)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,r=Jt(function(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}(t,10),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=r[0],a=r[r.length-1];return o?o!==a?o.segment2!==a.segment2?{point:e[i=Ep(o.segment2,a.segment2)-1],bendpoint:!0,index:i}:{point:{x:wp(o.x+a.x)/2,y:wp(o.y+a.y)/2},index:o.segment2}:{point:{x:wp(o.x),y:wp(o.y)},index:o.segment2}:null}(e,t)}function Cp(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function kp(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Rp(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=function(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}];return-(i[0].n*t[0]+i[1].n*t[1])/(i[0].lambda*t[0]+i[1].lambda*t[1])}([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function Pp(e,t){var n=Rp(e,t);return Cp({x:n.x-e.x,y:n.y-e.y})}function Ap(e,t){return Cp({x:e.x-t.x,y:e.y-t.y})}var Mp="djs-bendpoint",Tp="djs-segment-dragger";function Dp(e,t,n){var i=function(e,t){var n,i=ra(t),r=e._container.getBoundingClientRect();n={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(i.x-n.x)/o.scale,y:o.y+(i.y-n.y)/o.scale}}(e,n);return Sp(t,i)}function Bp(e,t){var n=Ae("g");we(n).add(Mp),ye(e,n);var i=Ae("circle");_e(i,{cx:0,cy:0,r:4}),we(i).add("djs-visual"),ye(n,i);var r=Ae("circle");return _e(r,{cx:0,cy:0,r:10}),we(r).add("djs-hit"),ye(n,r),t&&we(n).add(t),n}function Np(e,t,n,i){var r=Ae("g");ye(e,r);var o=function(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Op("h"===n?i:r)}(t,n,i),a=Ae("rect");_e(a,{x:-9,y:-3,width:18,height:6}),we(a).add("djs-visual"),ye(r,a);var s=Ae("rect");return _e(s,{x:-o/2,y:-8.5,width:o,height:17}),we(s).add("djs-hit"),ye(r,s),Un(r,"v"===i?90:0),r}function jp(e,t,n){var i=Ae("g"),r=Rt(t,n),o=St(t,n);return ye(e,i),Np(i,t,n,o),we(i).add(Tp),we(i).add("h"===o?"horizontal":"vertical"),Wn(i,r.x,r.y),i}function Op(e){return Math.abs(Math.round(2*e/3))}function Lp(e,t){var n=function(e,t){for(var n,i=t.waypoints,r=1/0,o=0;o<i.length-1;o++){var a=Pp(e,[i[o],i[o+1]]);a<r&&(r=a,n=o)}return[i[n],i[n+1]]}(e,t);return Rp(e,n)}function $p(e,t,n,i,r){function o(e,n){var o,a=n.waypoints,s=Dp(t,a,e);if(s)return o=function(e,t){var n,i,r=e.waypoints;return t.index<=0||t.bendpoint?null:(i=St((n={start:r[t.index-1],end:r[t.index]}).start,n.end))?Op("h"===i?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,s),!function(e,t,n){var i,r,o,a,s,c,p=e.index,l=e.point;return!(p<=0||e.bendpoint)&&(o=Rt(i=t[p-1],r=t[p]),a=St(i,r),s=Math.abs(l.x-o.x),c=Math.abs(l.y-o.y),a&&s<=n&&c<=n)}(s,a,o)?i.start(e,n,s.index,!s.bendpoint):r.start(e,n,s.index),!0}function a(e,t,i){oe.bind(e,t,(function(e){n.triggerMouseEvent(t,e,i),e.stopPropagation()}))}function s(e,n){var i=t.getLayer("overlays"),r=fe('.djs-bendpoints[data-element-id="'+Oo(e.id)+'"]',i);return!r&&n&&(_e(r=Ae("g"),{"data-element-id":e.id}),we(r).add("djs-bendpoints"),ye(i,r),a(r,"mousedown",e),a(r,"click",e),a(r,"dblclick",e)),r}function c(e,t){return fe('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function p(e,t){t.waypoints.forEach((function(t,n){var i=Bp(e);ye(e,i),Wn(i,t.x,t.y)})),Bp(e,"floating")}function l(e,t){for(var n,i,r,o=t.waypoints,s=1;s<o.length;s++)St(n=o[s-1],i=o[s])&&(_e(r=jp(e,n,i),{"data-segment-idx":s}),a(r,"mousemove",t))}function u(e){var t=s(e);return t||(p(t=s(e,!0),e),l(t,e)),t}function h(e){var t=s(e);t&&(!function(e){g(me("."+Tp,e),(function(e){Fe(e)}))}(t),function(e){g(me("."+Mp,e),(function(e){Fe(e)}))}(t),l(t,e),p(t,e))}function d(e,t,n){var i,r,o=c(t.index,e),a=n[t.index-1],s=n[t.index],p=t.point,l=Rt(a,s),u=St(a,s);o&&(i=function(e){return fe(".djs-visual",e)}(o),r={x:p.x-l.x,y:p.y-l.y},"v"===u&&(r={x:r.y,y:r.x}),Wn(i,r.x,r.y))}e.on("connection.changed",(function(e){h(e.element)})),e.on("connection.remove",(function(e){var t=s(e.element);t&&Fe(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?we(t).add(e.marker):we(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,i,r=e.element,o=r.waypoints;if(o){if(n=s(r,!0),!(i=Dp(t,o,e.originalEvent)))return;!function(e,t){var n=fe(".floating",e),i=t.point;n&&Wn(n,i.x,i.y)}(n,i),i.bendpoint||d(n,i,o)}})),e.on("element.mousedown",(function(e){if(sa(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return o(t,n)}})),e.on("selection.changed",(function(e){var t=e.newSelection[0];t&&t.waypoints&&u(t)})),e.on("element.hover",(function(e){var t=e.element;t.waypoints&&(u(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))})),e.on("element.out",(function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")})),e.on("element.updateId",(function(e){var t=e.element,n=e.newId;if(t.waypoints){var i=s(t);i&&_e(i,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=h,this.getBendpointsContainer=s,this.getSegmentDragger=c}$p.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Ip=Math.round,Fp="reconnectStart",zp="reconnectEnd",Hp="updateWaypoints";function Vp(e,t,n,i,r,o){this._injector=e,this.start=function(e,t,o,a){var s,c=n.getGraphics(t),p=t.source,l=t.target,u=t.waypoints,h=(s=a||0!==o?a||o!==u.length-1?Hp:zp:Fp)===Hp?"connection.updateWaypoints":"connection.reconnect",d=r.allowed(h,{connection:t,source:p,target:l});!1===d&&(d=r.allowed(h,{connection:t,source:l,target:p})),!1!==d&&i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:c,context:{allowed:d,bendpointIndex:o,connection:t,source:p,target:l,insert:a,type:s}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,i=n.connection,o=i.source,a=i.target,s=e.hover,c=n.type;if(n.hover=s,s){var p=c===Hp?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=r.allowed(p,{connection:i,source:c===Fp?s:o,target:c===zp?s:a}))return n.source=c===Fp?s:o,void(n.target=c===zp?s:a);!1===t&&(t=n.allowed=r.allowed(p,{connection:i,source:c===zp?s:a,target:c===Fp?s:o})),t&&(n.source=c===zp?s:a,n.target=c===Fp?s:o)}})),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],(function(e){var t=e.context,n=t.type;t.hover=null,t.source=null,t.target=null,n!==Hp&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,i=t.bendpointIndex,r=t.connection,a=t.insert,s=r.waypoints.slice(),c=t.source,p=t.target,l=t.type,u=t.hints||{},h={x:Ip(e.x),y:Ip(e.y)};if(!n)return!1;l===Hp?(a?s.splice(i,0,h):s[i]=h,u.bendpointMove={insert:a,bendpointIndex:i},s=this.cropWaypoints(r,s),o.updateWaypoints(r,function(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],0===wt(t,i=e[r+1])||Et(n,i,t)?e.splice(r,1):r++;return e}(s),u)):(l===Fp?(u.docking="source",Gp(t)&&(u.docking="target",u.newWaypoints=s.reverse())):l===zp&&(u.docking="target",Gp(t)&&(u.docking="source",u.newWaypoints=s.reverse())),o.reconnect(r,c,p,h,u))}),this)}function Gp(e){var t=e.hover,n=e.source,i=e.target,r=e.type;return r===Fp?t&&i&&t===i&&n!==i:r===zp?t&&n&&t===n&&n!==i:void 0}Vp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Vp.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};var Wp="updateWaypoints",Up="connect-ok",qp="connect-not-ok",Kp="connect-hover",Yp="djs-updating",Xp="djs-dragging";function Zp(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,r=t.connection,o=t.insert,a=r.waypoints,s=a.slice();t.waypoints=a,o&&s.splice(n,0,{x:e.x,y:e.y}),r.waypoints=s,we(t.draggerGfx=Bp(i.getLayer("overlays"))).add("djs-dragging"),i.addMarker(r,Xp),i.addMarker(r,Yp)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,r=t.hover,o=t.type;if(r){if(i.addMarker(r,Kp),o===Wp)return;n?(i.removeMarker(r,qp),i.addMarker(r,Up)):!1===n&&(i.removeMarker(r,Up),i.addMarker(r,qp))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,r=t.target;n&&(i.removeMarker(n,Kp),i.removeMarker(n,r?Up:qp))})),n.on("bendpoint.move.move",(function(t){var n=t.context,i=n.allowed,o=n.bendpointIndex,a=n.draggerGfx,s=n.hover,c=n.type,p=n.connection,l=p.source,u=p.target,h=p.waypoints.slice(),d={x:t.x,y:t.y},f=n.hints||{},m={};r&&(f.connectionStart&&(m.connectionStart=f.connectionStart),f.connectionEnd&&(m.connectionEnd=f.connectionEnd),"reconnectStart"===c?Gp(n)?(m.connectionEnd=m.connectionEnd||d,m.source=u,m.target=s||l,h=h.reverse()):(m.connectionStart=m.connectionStart||d,m.source=s||l,m.target=u):"reconnectEnd"===c?Gp(n)?(m.connectionStart=m.connectionStart||d,m.source=s||u,m.target=l,h=h.reverse()):(m.connectionEnd=m.connectionEnd||d,m.source=l,m.target=s||u):(m.noCropping=!0,m.noLayout=!0,h[o]=d),c===Wp&&(h=e.cropWaypoints(p,h)),m.waypoints=h,r.drawPreview(n,i,m)),Wn(a,t.x,t.y)}),this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],1100,(function(e){var t=e.context,n=t.connection,o=t.draggerGfx,a=t.hover,s=t.target,c=t.waypoints;n.waypoints=c,Fe(o),i.removeMarker(n,Yp),i.removeMarker(n,Xp),a&&(i.removeMarker(a,Up),i.removeMarker(a,s?Up:qp)),r&&r.cleanUp(t)}))}Zp.$inject=["bendpointMove","injector","eventBus","canvas"];var Qp="connect-hover",Jp="djs-updating";function el(e,t,n){return tl(e,t,e[t]+n)}function tl(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function nl(e){return"x"===e?"y":"x"}function il(e,t,n){var i,r;return e.original?e.original:(i=fn(t),tl(e,r=nl(n),i[r]))}function rl(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);function s(e,t){if(!a)return t;var n,i=e.waypoints;return e.waypoints=t,n=a.getCroppedWaypoints(e),e.waypoints=i,n}function c(e){r.update("connection",e.connection,e.connectionGfx)}function p(e,t,n){var i=e.newWaypoints,r=function(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]);return tl(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],nl(e.axis));Wn(e.draggerGfx,r.x,r.y)}this.start=function(e,t,r){var o,a,s,c,p=n.getGraphics(t),l=r-1,u=r,h=t.waypoints,d=h[l],f=h[u],m=Dp(n,h,e);(a=St(d,f))&&(s="v"===a?"x":"y",0===l&&(d=il(d,t.source,s)),u===h.length-1&&(f=il(f,t.target,s)),o={connection:t,segmentStartIndex:l,segmentEndIndex:u,segmentStart:d,segmentEnd:f,axis:s,dragPosition:c=m?m.point:{x:(d.x+f.x)/2,y:(d.y+f.y)/2}},i.init(e,c,"connectionSegment.move",{cursor:"x"===s?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:p,context:o}}))},t.on("connectionSegment.move.start",(function(e){var t=e.context,i=e.connection,r=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=jp(r,t.segmentStart,t.segmentEnd),we(t.draggerGfx).add("djs-dragging"),n.addMarker(i,Jp)})),t.on("connectionSegment.move.move",(function(e){var t,n,i=e.context,r=i.connection,o=i.segmentStartIndex,a=i.segmentEndIndex,l=i.segmentStart,u=i.segmentEnd,h=i.axis,d=i.originalWaypoints.slice(),f=el(l,h,e["d"+h]),m=el(u,h,e["d"+h]),v=d.length,y=0;d[o]=f,d[a]=m,o<2&&(t=mn(r.source,f),1===o?"intersect"===t&&(d.shift(),d[0]=f,y--):"intersect"!==t&&(d.unshift(l),y++)),a>v-3&&(n=mn(r.target,m),a===v-2?"intersect"===n&&(d.pop(),d[d.length-1]=m):"intersect"!==n&&d.push(u)),i.newWaypoints=r.waypoints=s(r,d),p(i,y,e),i.newSegmentStartIndex=o+y,c(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,Qp)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,Qp)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,i=t.connection;t.draggerGfx&&Fe(t.draggerGfx),n.removeMarker(i,Jp)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,c(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,i=t.newWaypoints,r=t.newSegmentStartIndex;i=i.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var a=function(e,t){var n=0,i=e.filter((function(i,r){return!Et(e[r-1],e[r+1],i)||(n=r<=t?n-1:n,!1)}));return{waypoints:i,segmentOffset:n}}(i,r),c=s(n,a.waypoints),p=a.segmentOffset,l={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+p}};o.updateWaypoints(n,c,l)}))}rl.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var ol=Math.abs,al=Math.round;function sl(e){return{x:e.x,y:e.y}}function cl(e){return{x:e.x+e.width,y:e.y+e.height}}function pl(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:al(e.x+e.width/2),y:al(e.y+e.height/2)}}function ll(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function ul(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function hl(e){return e.children||[]}var dl=Math.abs,fl=Math.round;function ml(e){function t(e,t){if(p(e)){for(var n=e.length;n--;)if(dl(e[n]-t)<=10)return e[n]}else{var i=t%(e=+e);if(i<10)return t-i;if(i>e-10)return t-i+e}return t}function n(e,t){return e.waypoints?Lp(t,e):e.width?{x:fl(e.width/2+e.x),y:fl(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var i,r,o=function(e){var t=e.context,i=t.snapPoints,r=t.connection,o=r.waypoints,a=t.segmentStart,s=t.segmentStartIndex,c=t.segmentEnd,p=t.segmentEndIndex,l=t.axis;if(i)return i;var u=[o[s-1],a,c,o[p+1]];return s<2&&u.unshift(n(r.source,e)),p>o.length-3&&u.unshift(n(r.target,e)),t.snapPoints=i={horizontal:[],vertical:[]},g(u,(function(e){e&&(e=e.original||e,"y"===l&&i.horizontal.push(e.y),"x"===l&&i.vertical.push(e.x))})),i}(e),a=e.x,s=e.y;if(o){var c=a-(i=t(o.vertical,a)),p=s-(r=t(o.horizontal,s));L(e,{dx:e.dx-c,dy:e.dy-p,x:i,y:r}),(c||-1!==o.vertical.indexOf(a))&&ul(e,"x",i),(p||-1!==o.horizontal.indexOf(s))&&ul(e,"y",r)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,i=t&&n(t,e);sn(t)&&i&&i.x&&i.y&&(ul(e,"x",i.x),ul(e,"y",i.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var i,r,o=e.context,a=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var r=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},g(r,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(o),s=o.hover,c=s&&n(s,e),p=e.x,l=e.y;if(a){var u=p-(i=t(c?a.vertical.concat([c.x]):a.vertical,p)),h=l-(r=t(c?a.horizontal.concat([c.y]):a.horizontal,l));L(e,{dx:e.dx-u,dy:e.dy-h,x:e.x-u,y:e.y-h}),(u||-1!==a.vertical.indexOf(p))&&ul(e,"x",i),(h||-1!==a.horizontal.indexOf(l))&&ul(e,"y",r)}}))}ml.$inject=["eventBus"];var vl={__depends__:[vp,xp],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",$p],bendpointMove:["type",Vp],bendpointMovePreview:["type",Zp],connectionSegmentMove:["type",rl],bendpointSnapping:["type",ml]};function yl(e,t,n,i){function r(e,t){return i.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,i=n.start,o=e.hover;if(n.hover=o,!c(t=n.canExecute=r(i,o))){if(!1!==t)return n.source=i,void(n.target=o);c(t=n.canExecute=r(o,i))||!1!==t&&(n.source=o,n.target=i)}})),e.on(["connect.out","connect.cleanup"],(function(e){var t=e.context;t.hover=null,t.source=null,t.target=null,t.canExecute=!1})),e.on("connect.end",(function(e){var t=e.context,i=t.canExecute,r=t.connectionStart,o={x:e.x,y:e.y},a=t.source,s=t.target;if(!i)return!1;var c=null,p={connectionStart:gl(t)?o:r,connectionEnd:gl(t)?r:o};l(i)&&(c=i),t.connection=n.connect(a,s,c,p)})),this.start=function(e,n,i,r){l(i)||(r=i,i=fn(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{start:n,connectionStart:i}}})}}function gl(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}yl.$inject=["eventBus","dragging","modeling","rules"];var bl="connect-ok",_l="connect-not-ok";function xl(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,r=t.hover,o=t.source,a=t.start,s=t.startPosition,c=t.target,p=t.connectionStart||s,l=t.connectionEnd||{x:e.x,y:e.y},u=p,h=l;gl(t)&&(u=l,h=p),i.drawPreview(t,n,{source:o||a,target:c||r,connectionStart:u,connectionEnd:h})})),t.on("connect.hover",900,(function(e){var t=e.context,i=e.hover,r=t.canExecute;null!==r&&n.addMarker(i,r?bl:_l)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,bl),n.removeMarker(t,_l))})),i&&t.on("connect.cleanup",(function(e){i.cleanUp(e.context)}))}xl.$inject=["injector","eventBus","canvas"];var wl={__depends__:[_a,xp,vp],__init__:["connectPreview"],connect:["type",yl],connectPreview:["type",xl]};function El(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}El.$inject=["injector","canvas","graphicsFactory","elementFactory"],El.prototype.drawPreview=function(e,t,n){n=n||{};var i,r,o,a=e.connectionPreviewGfx,s=e.getConnection,c=n.source,p=n.target,l=n.waypoints,u=n.connectionStart,h=n.connectionEnd,d=n.noLayout,f=n.noCropping,m=n.noNoop,v=this;a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Se(a),s||(s=e.getConnection=(r=function(e,t,n){return v.getConnection(e,t,n)},o={},function(e){var t=JSON.stringify(e),n=o[t];return n||(n=o[t]=r.apply(null,arguments)),n})),t&&(i=s(t,c,p)),i?(i.waypoints=l||[],this._layouter&&!d&&(i.waypoints=this._layouter.layoutConnection(i,{source:c,target:p,connectionStart:u,connectionEnd:h,waypoints:n.waypoints||i.waypoints})),i.waypoints&&i.waypoints.length||(i.waypoints=[c?fn(c):u,p?fn(p):h]),this._connectionDocking&&(c||p)&&!f&&(i.waypoints=this._connectionDocking.getCroppedWaypoints(i,c,p)),this._graphicsFactory.drawConnection(a,i,{stroke:"var(--element-dragger-color)"})):!m&&this.drawNoopPreview(a,n)},El.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||fn(n),o=t.connectionEnd||fn(i),a=this.cropWaypoints(r,o,n,i);ye(e,this.createNoopConnection(a[0],a[1]))},El.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return[e=n&&vn(o,s,!0)||e,t=i&&vn(a,s,!1)||t]},El.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Fe(e.connectionPreviewGfx)},El.prototype.getConnection=function(e){var t=function(e){return l(e)?e:{}}(e);return this._elementFactory.createConnection(t)},El.prototype.createConnectionPreviewGfx=function(){var e=Ae("g");return _e(e,{pointerEvents:"none"}),we(e).add("djs-dragger"),ye(this._canvas.getActiveLayer(),e),e},El.prototype.createNoopConnection=function(e,t){return ot([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var Sl={__init__:["connectionPreview"],connectionPreview:["type",El]};const Cl=new Eo("ps");var kl=["marker-start","marker-mid","marker-end"],Rl=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Pl(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Pl.$inject=["elementRegistry","eventBus","canvas","styles"],Pl.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},Pl.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Pl.prototype.addDragger=function(e,t,n,i="djs-dragger"){var r=Ce(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(Vn(r),i),_e(r,this._styles.cls(i,[],{x:o.top,y:o.left})),ye(t,r),_e(r,"data-preview-support-element-id",e.id),r},Pl.prototype.addFrame=function(e,t){var n=Ae("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ye(t,n),_e(n,"data-preview-support-element-id",e.id),n},Pl.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach((e=>{i._cloneMarkers(e,t,n)})),function(e){return-1!==Rl.indexOf(e.nodeName)}(e)&&kl.forEach((function(r){if(_e(e,r)){var o=function(e,t,n){var i=(r=_e(e,t),r.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var r;return fe("marker#"+i,n||document)}(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}}))},Pl.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,Cl.next()].join("-"),a=fe("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Ce(n);s.id=o,we(s).add(r);var c=fe(":scope > defs",e);c||ye(e,c=Ae("defs")),ye(c,s),_e(t,i,"url(#"+s.id+")")};var Al={__init__:["previewSupport"],previewSupport:["type",Pl]};const Ml="complex-preview";class Tl{constructor(e,t,n){this._canvas=e,this._graphicsFactory=t,this._previewSupport=n,this._markers=[]}create(e){this.cleanUp();const{created:t=[],moved:n=[],removed:i=[],resized:r=[]}=e,o=this._canvas.getLayer(Ml);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;sn(e)?(t=this._graphicsFactory._createContainer("connection",Ae("g")),this._graphicsFactory.drawConnection(Vn(t),e)):(t=this._graphicsFactory._createContainer("shape",Ae("g")),this._graphicsFactory.drawShape(Vn(t),e),Wn(t,e.x,e.y)),this._previewSupport.addDragger(e,o,t)})),n.forEach((({element:e,delta:t})=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"]);const n=this._previewSupport.addDragger(e,o);sn(e)?Wn(n,t.x,t.y):Wn(n,e.x+t.x,e.y+t.y)})),i.forEach((e=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"])})),r.forEach((({shape:e,bounds:t})=>{this._canvas.addMarker(e,"djs-hidden"),this._markers.push([e,"djs-hidden"]),this._previewSupport.addDragger(e,o,void 0,"djs-dragging");const n=this._graphicsFactory._createContainer("shape",Ae("g"));this._graphicsFactory.drawShape(Vn(n),e,{width:t.width,height:t.height}),Wn(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Se(this._canvas.getLayer(Ml)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[]}show(){this._canvas.showLayer(Ml)}hide(){this._canvas.hideLayer(Ml)}}Tl.$inject=["canvas","graphicsFactory","previewSupport"];var Dl={__depends__:[Al],__init__:["complexPreview"],complexPreview:["type",Tl]},Bl=["top","bottom","left","right"],Nl=10;function jl(e,t){function n(e){if(Hr(e)&&!sn(e)){var n=function(e){var t=fn(e.label),n=fn(e),i=Ol(n,t);if(r=i,-1===Bl.indexOf(r))return;var r;var o=function(e){var t=fn(e),n=[].concat(e.incoming.map((function(e){return e.waypoints[e.waypoints.length-2]})),e.outgoing.map((function(e){return e.waypoints[1]}))).map((function(e){return Ol(t,e)}));return n}(e);if(e.host){var a=function(e){var t,n=e.host,i=fn(e),r=mn(i,n);t=r.indexOf("-")>=0?r.split("-"):[r];var o=Bl.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(a)}var s=Bl.filter((function(e){return-1===o.indexOf(e)}));if(-1!==s.indexOf(i))return;return s[0]}(e);n&&function(e,n){var i=fn(e),r=e.label,o=fn(r);if(!r.parent)return;var a,s=un(e);switch(n){case"top":a={x:i.x,y:s.top-Nl-r.height/2};break;case"left":a={x:s.left-Nl-r.width/2,y:i.y};break;case"bottom":a={x:i.x,y:s.bottom+Nl+r.height/2};break;case"right":a={x:s.right+Nl+r.width/2,y:i.y}}var c=Ha(a,o);t.moveShape(r,c)}(e,n)}}Do.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],(function(e){var t=e.context,i=t.connection,r=i.source,o=i.target;!1!==(t.hints||{}).createElementsBehavior&&(n(r),n(o))})),this.postExecuted(["label.create"],(function(e){var t=e.context,i=t.shape;!1!==(t.hints||{}).createElementsBehavior&&n(i.labelTarget)})),this.postExecuted(["elements.create"],(function(e){var t=e.context,i=t.elements;!1!==(t.hints||{}).createElementsBehavior&&i.forEach((function(e){n(e)}))}))}function Ol(e,t){return mn(t,e,5)}function Ll(e){Do.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(vr(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})}),!0)}function $l(e,t){e.invoke(Do,this),this.postExecute("shape.move",(function(e){var n=e.newParent,i=e.shape;g(y(i.incoming.concat(i.outgoing),(function(e){return vr(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(jl,Do),jl.$inject=["eventBus","modeling"],e(Ll,Do),Ll.$inject=["eventBus"],e($l,Do),$l.$inject=["injector","modeling"];function Il(e,t){t.invoke(Do,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;1===(t=t.filter((function(e){return Fl(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(i){var r=t[i];e.elements[i]=n._replaceShape(t[i],r)}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,i=e.newHost;if(1===t.length){var r=t[0];Fl(r,i)&&(e.shapes=[n._replaceShape(r,i)])}}),!0)}function Fl(e,t){return!cn(e)&&yr(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function zl(e,t){function n(e){return y(e.attachers,(function(e){return vr(e,"bpmn:BoundaryEvent")}))}Do.call(this,e),this.postExecute("connection.create",(function(e){var i=e.context.source,r=e.context.target,o=n(r);vr(i,"bpmn:EventBasedGateway")&&vr(r,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var i=e.context.oldSource,r=e.context.newSource;vr(i,"bpmn:Gateway")&&vr(r,"bpmn:EventBasedGateway")&&g(r.outgoing,(function(e){var i=e.target,r=n(i);vr(i,"bpmn:ReceiveTask")&&r.length>0&&t.removeElements(r)}))}))}function Hl(e,t,n){function i(e){t.updateProperties(e,{isForCompensation:!0})}function r(e){t.updateProperties(e,{isForCompensation:void 0})}Do.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:i}=e;if(Gl(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=i.outgoing.find((({target:e})=>Vl(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!Gl(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=i.outgoing.find((({target:e})=>Wl(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>vr(e,"bpmn:SequenceFlow")));t.removeElements(n)}(i)}}),!0),this.postExecuted("shape.replace",(function(e){const{_connectionTarget:n,newShape:i}=e;n&&t.connect(i,n)}),!0),this.preExecute("connection.create",(function(e){const n=e.connection,r=e.source,o=e.target;Gl(r)&&Wl(o)&&(i(o),function(e,n){const i=e.outgoing.filter((e=>vr(e,"bpmn:Association"))),r=i.filter((e=>Vl(e.target)&&!n.includes(e)));r.forEach((e=>t.removeConnection(e)))}(r,[n]))}),!0),this.postExecuted("connection.delete",(function(e){const t=e.source,n=e.target;Gl(t)&&Vl(n)&&r(n)}),!0),this.postExecuted("connection.reconnect",(function(e){const t=e.newTarget,n=e.oldSource,o=e.oldTarget;if(o!==t){const e=n;Vl(o)&&r(o),Gl(e)&&Wl(t)&&i(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:i}=e;Vl(i)?(function(e){for(const i of e.incoming)n.canConnect(i.source,e)||t.removeConnection(i);for(const i of e.outgoing)n.canConnect(e,i.target)||t.removeConnection(i)}(i),function(e){const n=e.attachers.slice();if(!n.length)return;t.removeElements(n)}(i)):Wl(i)&&function(e){const n=e.incoming.filter((e=>Gl(e.source)));t.removeElements(n)}(i)}),!0)}function Vl(e){const t=gr(e);return t&&t.get("isForCompensation")}function Gl(e){return e&&vr(e,"bpmn:BoundaryEvent")&&Ir(e,"bpmn:CompensateEventDefinition")}function Wl(e){return e&&vr(e,"bpmn:Activity")&&!$r(e)}function Ul(e){e.invoke(Do,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,i=t.shape;vr(n,"bpmn:Lane")&&!vr(i,"bpmn:Lane")&&(t.parent=Jc(n,"bpmn:Participant"))}))}function ql(e,t){Do.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(vr(n,"bpmn:DataObjectReference")&&"label"!==n.type){var i=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=i}}))}Il.$inject=["bpmnReplace","injector"],e(Il,Do),Il.prototype._replaceShape=function(e,t){var n,i=(n=gr(e).eventDefinitions)&&n[0],r={type:"bpmn:BoundaryEvent",host:t};return i&&(r.eventDefinitionType=i.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})},zl.$inject=["eventBus","modeling"],e(zl,Do),e(Hl,Do),Hl.$inject=["eventBus","modeling","bpmnRules"],Ul.$inject=["injector"],e(Ul,Do),ql.$inject=["eventBus","bpmnFactory"],e(ql,Do);var Kl=20,Yl=20,Xl=2e3;function Zl(e,t,n){function i(){var t=e.getRootElement();return vr(t,"bpmn:Collaboration")?t:n.makeCollaboration()}Do.call(this,t),t.on(["create.start","shape.move.start"],Xl,(function(t){var n=t.context,i=n.shape,r=e.getRootElement();if(vr(i,"bpmn:Participant")&&vr(r,"bpmn:Process")&&r.children.length){var o=r.children.filter((function(e){return!vr(e,"bpmn:Group")&&!cn(e)&&!sn(e)}));if(o.length){var a=ht(o),s=function(e,t){t={width:t.width+40+30,height:t.height+40};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}(i,a);L(i,s),n.createConstraints=function(e,t){return t=un(t),{bottom:t.top+e.height/2-Yl,left:t.right-e.width/2+Kl,top:t.bottom-e.height/2+Yl,right:t.left+e.width/2-Kl-30}}(i,a)}}})),t.on("create.start",Xl,(function(n){var i=n.context.shape,r=e.getRootElement(),o=e.getGraphics(r);function a(e){e.element=r,e.gfx=o}vr(i,"bpmn:Participant")&&vr(r,"bpmn:Process")&&(t.on("element.hover",Xl,a),t.once("create.cleanup",(function(){t.off("element.hover",a)})))})),this.preExecute("elements.create",Xl,(function(e){var t,n=e.elements,r=e.parent,o=function(e){return m(e,(function(e){return vr(e,"bpmn:Participant")}))}(n);o&&vr(r,"bpmn:Process")&&(e.parent=i(),(t=e.hints=e.hints||{}).participant=o,t.process=r,t.processRef=gr(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;vr(n,"bpmn:Participant")&&vr(t,"bpmn:Process")&&(e.parent=i(),e.process=t,e.processRef=gr(n).get("processRef"))}),!0),this.execute("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.shape,r=t.participant;!n||r&&i!==r||gr(i).set("processRef",gr(n))}),!0),this.revert("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.processRef||t.processRef,r=e.shape,o=t.participant;!n||o&&r!==o||gr(r).set("processRef",i)}),!0),this.postExecute("shape.create",(function(e){var t=e.hints||{},i=e.process||e.hints.process,r=e.shape,o=t.participant;if(i){var a=i.children.slice();o?r===o&&n.moveElements(a,{x:0,y:0},o):n.moveElements(a,{x:0,y:0},r)}}),!0)}Zl.$inject=["canvas","eventBus","modeling"],e(Zl,Do);var Ql="__targetRef_placeholder";function Jl(e,t){function n(e,n){var i=e.get("properties"),r=m(i,(function(e){return e.name===Ql}));return!r&&n&&_t(i,r=t.create("bpmn:Property",{name:Ql})),r}function i(e,t){var i=n(e);i&&(function(e,t,n){return m(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,i,t)||bt(e.get("properties"),i))}function r(e){var t,r=e.context,o=r.connection,a=o.businessObject,s=o.target,c=s&&s.businessObject,p=r.newTarget,l=p&&p.businessObject,u=r.oldTarget||r.target,h=u&&u.businessObject,d=o.businessObject;h&&h!==c&&i(h,a),l&&l!==c&&i(l,a),c?(t=n(c,!0),d.targetRef=t):d.targetRef=null}Do.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],eu(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],eu(r))}function eu(e){return function(t){if(vr(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function tu(e){this._bpmnUpdater=e}function nu(e,t,n,i){function r(e){return e.children.filter((function(e){return vr(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,i){var r=e.businessObject||e;if(i=i||n.filter((function(e){return vr(e,"bpmn:Participant")&&gr(e).processRef}))[0]){var o=i.businessObject||i;t.execute("dataStore.updateContainment",{dataStoreBo:r,dataStoreDi:br(e),newSemanticParent:o.processRef||o,newDiParent:br(i)})}}Do.call(this,i),t.registerHandler("dataStore.updateContainment",tu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;vr(n,"bpmn:DataStoreReference")&&"label"!==n.type&&(t.hints||(t.hints={}),t.hints.autoResize=!1)})),this.preExecute("elements.move",(function(e){var t=e.context,n=t.shapes;n.filter((function(e){return vr(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!vr(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;vr(t,"bpmn:DataStoreReference")&&"label"!==t.type&&vr(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;vr(i,"bpmn:Collaboration")||vr(n,"bpmn:DataStoreReference")&&"label"!==n.type&&vr(r,"bpmn:Collaboration")&&o(n,vr(i,"bpmn:Participant")?i:function(e,t){for(;e.parent;){if(vr(e.parent,t))return e.parent;e=e.parent}}(i,"bpmn:Participant"))})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,i=e.getRootElement();yr(n,["bpmn:Participant","bpmn:SubProcess"])&&vr(i,"bpmn:Collaboration")&&r(i).filter((function(e){return function(e,t){var n=e.businessObject||e,i=t.businessObject||t;for(;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}(e,n)})).forEach((function(e){o(e)}))})),this.postExecute("canvas.updateRoot",(function(e){var t=e.context,n=t.oldRoot,i=t.newRoot;r(n).forEach((function(e){vr(i,"bpmn:Process")&&o(e,i)}))}))}Jl.$inject=["eventBus","bpmnFactory"],e(Jl,Do),tu.$inject=["bpmnUpdater"],tu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},tu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},nu.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(nu,Do);var iu=Math.max,ru=Math.min;function ou(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function au(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return u(r)&&(i=(/top|left/.test(e)?ru:iu)(i,r)),u(o)&&(i=(/top|left/.test(e)?iu:ru)(i,o)),i}function su(e,t){return void 0!==e?e:20}function cu(e){return!e.waypoints&&"label"!==e.type}function pu(e,t){var n;if((n=void 0===e.length?y(e.children,cu):e).length)return function(e,t){var n,i,r,o;return"object"==typeof t?(n=su(t.left),i=su(t.right),r=su(t.top),o=su(t.bottom)):n=i=r=o=su(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}(ht(n),t)}var lu=Math.abs;var uu=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],hu=30;function du(e,t){return t=t||[],e.children.filter((function(e){vr(e,"bpmn:Lane")&&(du(e,t),t.push(e))})),t}function fu(e){return e.children.filter((function(e){return vr(e,"bpmn:Lane")}))}function mu(e){return Jc(e,uu)||e}function vu(e,t){var n=mu(e),i=du(n,vr(n,"bpmn:Process")?[]:[n]),r=un(e),o=un(t),a=function(e,t){return ou(un(t),un(e))}(e,t),s=[],c=Lr(e);return i.forEach((function(t){if(t!==e){var n,i,p=c?0:a.top,l=c?a.right:0,u=c?0:a.bottom,h=c?a.left:0,d=un(t);a.top&&(lu(d.bottom-r.top)<10&&(u=o.top-d.bottom),lu(d.top-r.top)<5&&(p=o.top-d.top)),a.left&&(lu(d.right-r.left)<10&&(l=o.left-d.right),lu(d.left-r.left)<5&&(h=o.left-d.left)),a.bottom&&(lu(d.top-r.bottom)<10&&(p=o.bottom-d.top),lu(d.bottom-r.bottom)<5&&(u=o.bottom-d.bottom)),a.right&&(lu(d.left-r.right)<10&&(h=o.right-d.left),lu(d.right-r.right)<5&&(l=o.right-d.right)),(p||l||u||h)&&s.push({shape:t,newBounds:(n=t,i={top:p,right:l,bottom:u,left:h},{x:n.x+(i.left||0),y:n.y+(i.top||0),width:n.width-(i.left||0)+(i.right||0),height:n.height-(i.top||0)+(i.bottom||0)})})}})),s}function yu(e,t){Do.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,i=n.hints,r=n.shape,o=n.oldParent;vr(r,"bpmn:Lane")&&(i&&i.nested||function(e,n){var i,r,o,a,s,c=Lr(e),p=fu(n),l=[],u=[],h=[],d=[];lt(p,(function(t){return c?t.y>e.y?u.push(t):l.push(t):t.x>e.x?d.push(t):h.push(t),t.children})),p.length&&(i=c?u.length&&l.length?e.height/2:e.height:d.length&&h.length?e.width/2:e.width,l.length&&(r=t.calculateAdjustments(l,"y",i,e.y-10),t.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:i},"s")),u.length&&(o=t.calculateAdjustments(u,"y",-i,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-i},"n")),h.length&&(a=t.calculateAdjustments(h,"x",i,e.x-10),t.makeSpace(a.movingShapes,a.resizingShapes,{x:i,y:0},"e")),d.length&&(s=t.calculateAdjustments(d,"x",-i,e.x+e.width+10),t.makeSpace(s.movingShapes,s.resizingShapes,{x:-i,y:0},"w")))}(r,o))}))}yu.$inject=["eventBus","spaceTool"],e(yu,Do);function gu(e,t){t.invoke(Do,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return bu(e,e.host)})).map((function(e){return t.indexOf(e)})).forEach((function(i){e.elements[i]=n._replaceShape(t[i])}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,i=e.newHost;t.forEach((function(e,r){var o,a=e.host;bu(e,(o=a,-1!==t.indexOf(o)?a:i))&&(t[r]=n._replaceShape(e))}))}),!0)}function bu(e,t){return!cn(e)&&vr(e,"bpmn:BoundaryEvent")&&!t}function _u(e,t,n){function i(e,i,r){var o,a,s,c,p,l,h,d,f=i.waypoints,m=e.outgoing.slice(),v=e.incoming.slice(),g=Sp(f,d=u(r.width)?fn(r):r);if(g){if(o=f.slice(0,g.index),a=f.slice(g.index+(g.bendpoint?1:0)),!o.length||!a.length)return;s=g.bendpoint?f[g.index]:d,1!==o.length&&xu(e,o[o.length-1])||o.push(wu(s)),1!==a.length&&xu(e,a[0])||a.unshift(wu(s))}c=i.source,p=i.target,t.canConnect(c,e,i)&&(n.reconnectEnd(i,e,o||d),l=i),t.canConnect(e,p,i)&&(l?h=n.connect(e,p,{type:i.type,waypoints:a}):(n.reconnectStart(i,e,a||d),h=i));var b=[].concat(l&&y(v,(function(e){return e.source===l.source}))||[],h&&y(m,(function(e){return e.target===h.target}))||[]);b.length&&n.removeElements(b)}Do.call(this,e),this.preExecute("elements.move",(function(e){var n=e.newParent,i=e.shapes,r=e.delta,o=i[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var a=fn(o),s={x:a.x+r.x,y:a.y+r.y},c=m(n.children,(function(e){return t.canInsert(i,e)&&Sp(e.waypoints,s)}));c&&(e.targetFlow=c,e.position=s)}}),!0),this.postExecuted("elements.move",(function(e){var t=e.shapes,n=e.targetFlow,r=e.position;n&&i(t[0],n,r)}),!0),this.preExecute("shape.create",(function(e){var n=e.parent,i=e.shape;t.canInsert(i,n)&&(e.targetFlow=n,e.parent=n.parent)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.targetFlow,r=e.position;n&&i(t,n,r)}),!0)}function xu(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function wu(e){return L({},e)}function Eu(e,t){Do.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,i=n.connection,r=n.source,o=n.target,a=n.hints;if((!a||!1!==a.createElementsBehavior)&&Su(i)){(vr(r,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==i&&Su(e))):o.incoming.filter((e=>e!==i&&Su(e)&&vr(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;vr(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(Su).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(Su).forEach((function(i){const r=e.incoming.filter(Su).filter((function(e){return e.source===n}));(i.source!==n||r.length>1)&&t.removeConnection(i)}))}))}))}function Su(e){return vr(e,"bpmn:SequenceFlow")}gu.$inject=["bpmnReplace","injector"],e(gu,Do),gu.prototype._replaceShape=function(e){var t,n,i=(n=gr(e).eventDefinitions)&&n[0];return t=i?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:i.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e(_u,Do),_u.$inject=["eventBus","bpmnRules","modeling"],Eu.$inject=["eventBus","modeling"],e(Eu,Do);var Cu=1500;function ku(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],Cu,(function(t){var i=t.context.shape||t.shape,r=t.hover;vr(r,"bpmn:Lane")&&!yr(i,["bpmn:Lane","bpmn:Participant"])&&(t.hover=mu(r),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();r!==o&&(i.labelTarget||yr(i,["bpmn:Group","bpmn:TextAnnotation"]))&&(t.hover=o,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Cu,(function(t){var n=t.hover;vr(n,"bpmn:Lane")&&(t.hover=mu(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],Cu,(function(t){var n=t.context,i=t.hover,r=n.type;vr(i,"bpmn:Lane")&&/reconnect/.test(r)&&(t.hover=mu(i)||i,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],Cu,(function(e){var t=e.context,n=t.start;vr(n,"bpmn:Lane")&&(t.start=mu(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;vr(t,"bpmn:Lane")&&(e.shape=mu(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&vr(t,"bpmn:Lane")&&(e.hover=mu(t))}))}ku.$inject=["elementRegistry","eventBus","canvas"];function Ru(e,t,n,i,r,o){function a(e,t,i){var r=n.filter((function(e){return vr(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==i}));t&&!function(e,t){return e.some((function(e){var n=gr(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(r,t)&&function(e){var t=e.$parent;t&&(bt(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return gr(e).categoryValueRef===t}))}(r,e)&&function(e){var t=e.$parent;t&&(bt(t.get("categoryValue"),e),e.$parent=null)}(e)}function s(e,n){return function(e,t,n){return _t(t.get("categoryValue"),e),e.$parent=t,_t(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function c(n,i){var r=gr(n),o=r.categoryValueRef;o||(o=r.categoryValueRef=i.categoryValue=i.categoryValue||function(e){return e.create("bpmn:CategoryValue")}(e));var a=o.$parent;a||(a=o.$parent=i.category=i.category||function(e){return e.create("bpmn:Category")}(e)),s(o,a,t.getDefinitions())}function p(e,t){var n=t.category,i=t.categoryValue,r=gr(e);i?(r.categoryValueRef=null,a(i,n,r)):a(null,r.categoryValueRef.$parent,r)}function l(t,n){var i=e.create(t.$type);return o.copyElement(t,i,null,n)}r.invoke(Do,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;vr(n,"bpmn:Group")&&c(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;vr(n,"bpmn:Group")&&p(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=gr(n);if(vr(n,"bpmn:Group")&&!n.labelTarget){var r=t.categoryValue=i.categoryValueRef;r&&(a(r,t.category=r.$parent,i),i.categoryValueRef=null)}})),this.reverted("shape.delete",(function(e){var t=e.context,n=t.shape;if(vr(n,"bpmn:Group")&&!n.labelTarget){var i=t.category,r=t.categoryValue,o=gr(n);r&&(o.categoryValueRef=r,s(r,i))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;vr(n,"bpmn:Group")&&!n.labelTarget&&gr(n).categoryValueRef&&c(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;vr(n,"bpmn:Group")&&!n.labelTarget&&gr(n).categoryValueRef&&p(n,t)})),i.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(vr(n,"bpmn:Group")&&!n.labelTarget){var i=gr(n);if(i.categoryValueRef){var r=i.categoryValueRef;t.categoryValue=l(r,!0),r.$parent&&(t.category=l(r.$parent,!0))}}})),i.on("copyPaste.pasteElement",770,(function(e){var t=e.descriptor,n=t.businessObject,i=t.categoryValue,r=t.category;i&&(i=n.categoryValueRef=l(i)),r&&(i.$parent=l(r)),delete t.category,delete t.categoryValue}))}function Pu(e,t,n,i){var r,o,a,s;return 0==(r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,a=e.x-n.x,s=((i.x-n.x)*o-(i.y-n.y)*a)/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Au(e){function t(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},a=Pu(e,t,n,r),s=Pu(e,t,n,o);i=a&&s?Mu(a,n)>Mu(s,n)?s:a:a||s,e.original=i}e.on("bpmnElement.added",(function(e){var n,i,r=e.element;r.waypoints&&(t((i=(n=r).waypoints)[0],i[1],fn(n.source)),t(i[i.length-1],i[i.length-2],fn(n.target)))}))}function Mu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Tu(e){Do.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],(function(e){var n=e.context.shape,i=gr(n),r=br(n);if(yr(i,t)){var o=r.get("isHorizontal");void 0===o&&(o=!0),r.set("isHorizontal",o)}}))}Ru.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(Ru,Do),Au.$inject=["eventBus"],Tu.$inject=["eventBus"],e(Tu,Do);var Du=Math.sqrt,Bu=Math.min,Nu=Math.max,ju=Math.abs;function Ou(e){return Math.pow(e,2)}function Lu(e,t){return Du(Ou(e.x-t.x)+Ou(e.y-t.y))}function $u(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,p=(r*a+o*s)/c,l=p*p-(a*a+s*s-i*i)/c;if(l<0&&l>-1e-6&&(l=0),l<0)return[];var u=Du(l),h=-p+u,d=-p-u,f={x:e.x-r*h,y:e.y-o*h};return 0===l?[f]:[f,{x:e.x-r*d,y:e.y-o*d}].filter((function(n){return function(e,t,n){return Iu(e.x,t.x,n.x)&&Iu(e.y,t.y,n.y)}(n,e,t)}))}function Iu(e,t,n){return e>=Bu(t,n)-Fu&&e<=Nu(t,n)+Fu}var Fu=.1;function zu(e,t){return ju(e.x-t.x)<=Fu&&ju(e.y-t.y)<=Fu}function Hu(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=function(e,t){var n,i,r,o,a,s,c,p,l,u,h,d,f=0;for(f=0;f<t.length-1;f++){if(zu(n=t[f],i=t[f+1])?s=[n]:(r=Lu(e,n),o=Lu(e,i),s=$u(n,i,e,Bu(r,o))),s.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===s.length&&(c={type:"bendpoint",position:s[0],segmentIndex:f,bendpointIndex:zu(n,s[0])?f:f+1}),2===s.length&&(h=s[0],d=s[1],c={type:"segment",position:a={x:(h.x+d.x)/2,y:(h.y+d.y)/2},segmentIndex:f,relativeLocation:Lu(n,a)/Lu(n,i)}),p=Lu(c.position,e),(!u||l>p)&&(u=c,l=p)}return u}(e,n),c=s.segmentIndex,p=function(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c,p=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex;return 0===o?r:(r>=l&&(c=p?r+1:r-1),r<l&&(c=r,p&&"bendpoint"!==n.type&&l-1===r&&Vu(t,l)<n.relativeLocation&&c++),c)}return 0===o?r:i.connectionStart&&0===r?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}(n,t,s,i);if(p<0||p>t.length-2||null===p)return a;var l,u,h=Gu(n,c),d=Gu(t,p),f=s.position,m=function(e,t){var n=Ap(e[0],e[1]),i=Ap(e[0],t);return 0===n?0:i/n}(h,f),v=(l=d,u=kp(h),kp(l)-u);if("bendpoint"===s.type){var y=t.length-n.length,g=s.bendpointIndex,b=n[g];if(-1!==t.indexOf(b))return a;if(0===y){var _=t[g];return{delta:{x:r=_.x-s.position.x,y:o=_.y-s.position.y},point:{x:e.x+r,y:e.y+o}}}y<0&&0!==g&&g<n.length-1&&(m=Vu(n,g))}var x,w,E={x:(d[1].x-d[0].x)*m+d[0].x,y:(d[1].y-d[0].y)*m+d[0].y},S=(x={x:e.x-f.x,y:e.y-f.y},(w=v)?{x:Math.cos(w)*x.x-Math.sin(w)*x.y,y:Math.sin(w)*x.x+Math.cos(w)*x.y}:x);return r=E.x+S.x-e.x,o=E.y+S.y-e.y,{point:ln(E),delta:ln({x:r,y:o})}}function Vu(e,t){var n=Ap(e[t-1],e[t]);return n/(n+Ap(e[t],e[t+1]))}function Gu(e,t){return[e[t],e[t+1]]}function Wu(e,t,n){var i=za(t),r=za(n),o=Ha(e,i),a=o.x*(n.width/t.width),s=o.y*(n.height/t.height);return ln({x:r.x+a,y:r.y+s})}function Uu(e,t,n){var i=za(e),r=za(t),o=za(n),a=Ha(e,i),s=Ha(i,r),c=function(e,t,n){var i=un(t),r=un(n);if(function(e,t){return function(e,t){return e.right!==t.right&&e.left!==t.left}(e,t)||function(e,t){return e.top!==t.top&&e.bottom!==t.bottom}(e,t)}(i,r))return null;var o,a,s,c=mn(t,e);if("top"===c)o={x:0,y:r.bottom-i.bottom};else if("bottom"===c)o={x:0,y:r.top-i.top};else if("right"===c)o={x:r.left-i.left,y:0};else{if("left"!==c)return null;o={x:r.right-i.right,y:0}}if(a={x:e.x+o.x,y:e.y+o.y},s=mn(n,a),s!==c)return null;return o}(i,t,n);if(c)return c;var p=s.x*(n.width/t.width),l=s.y*(n.height/t.height),u=o.x+p,h=o.y+l;return ln({x:u+a.x-e.x,y:h+a.y-e.y})}var qu="name",Ku="text";function Yu(e,t,n,i){function r(e){var n=e.context,r=n.element,o=n.properties;if(qu in o&&t.updateLabel(r,o[qu]),Ku in o&&vr(r,"bpmn:TextAnnotation")){var a=i.getTextAnnotationBounds({x:r.x,y:r.y,width:r.width,height:r.height},o[Ku]||"");t.updateLabel(r,o.text,a)}}function o(e){var t=e.context,n=t.connection,i=n.label,r=L({},t.hints),o=t.newWaypoints||n.waypoints,a=t.oldWaypoints;return void 0===r.startChanged&&(r.startChanged=!!r.connectionStart),void 0===r.endChanged&&(r.endChanged=!!r.connectionEnd),function(e,t,n,i){return Hu(fn(e),t,n,i).delta}(i,o,a,r)}Do.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",(e=>{gr(e.context.element)===e.context.moddleElement&&r(e)})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var i=n.shape||n.connection;!cn(i)&&zr(i)&&Ur(i)&&t.updateLabel(i,Ur(i))}})),this.postExecute("shape.delete",(function(e){var n=e.context,i=n.labelTarget,r=n.hints||{};i&&!1!==r.unsetLabel&&t.updateLabel(i,null,null,{removeShape:!1})})),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var n=e.context;if(!1!==(n.hints||{}).labelBehavior){var i,r=n.connection.label;r&&r.parent&&(i=o(e),t.moveShape(r,i))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=gr(n);r&&zr(r)&&i.label&&n.label&&(n.label.x=i.label.x,n.label.y=i.label.y)})),this.postExecute("shape.resize",(function(e){var n,i=e.context,r=i.shape,o=i.newBounds,a=i.oldBounds;if(Hr(r)){var s=r.label,c=function(e,t){if(!t.length)return;var n=function(e,t){var n=t.map((function(t){return{line:t,distance:Pp(e,t)}}));return A(n,"distance")[0].line}(e,t);return Rp(e,n)}(fn(s),[[{x:(n=a).x,y:n.y},{x:n.x+(n.width||0),y:n.y}],[{x:n.x+(n.width||0),y:n.y},{x:n.x+(n.width||0),y:n.y+(n.height||0)}],[{x:n.x,y:n.y+(n.height||0)},{x:n.x+(n.width||0),y:n.y+(n.height||0)}],[{x:n.x,y:n.y},{x:n.x,y:n.y+(n.height||0)}]]),p=Xu(c,a,o);t.moveShape(s,p)}}))}function Xu(e,t,n){return ln(Ha(Wu(e,t,n),e))}function Zu(e,t){function n(e,t){var n=e.context,i=n.connection,r=L({},n.hints),o=n.newWaypoints||i.waypoints,a=n.oldWaypoints;return void 0===r.startChanged&&(r.startChanged=!!r.connectionStart),void 0===r.endChanged&&(r.endChanged=!!r.connectionEnd),function(e,t,n,i){return Hu(e,t,n,i).point}(t,o,a,r)}Do.call(this,e),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var i=e.context.connection,r=i.outgoing;i.incoming.forEach((function(i){var r=i.waypoints[i.waypoints.length-1],o=n(e,r),a=[].concat(i.waypoints.slice(0,-1),[o]);t.updateWaypoints(i,a)})),r.forEach((function(i){var r=i.waypoints[0],o=n(e,r),a=[].concat([o],i.waypoints.slice(1));t.updateWaypoints(i,a)}))})),this.postExecute(["connection.move"],(function(e){var n=e.context,i=n.connection,r=i.outgoing,o=i.incoming,a=n.delta;o.forEach((function(e){var n=e.waypoints[e.waypoints.length-1],i={x:n.x+a.x,y:n.y+a.y},r=[].concat(e.waypoints.slice(0,-1),[i]);t.updateWaypoints(e,r)})),r.forEach((function(e){var n=e.waypoints[0],i={x:n.x+a.x,y:n.y+a.y},r=[].concat([i],e.waypoints.slice(1));t.updateWaypoints(e,r)}))}))}function Qu(e,t,n){var i=ih(e),r=rh(i,t),o=i[0];return r.length?r[r.length-1]:Wu(o.original||o,n,t)}function Ju(e,t,n){var i=ih(e),r=rh(i,t),o=i[i.length-1];return r.length?r[0]:Wu(o.original||o,n,t)}function eh(e,t,n){var i=ih(e),r=nh(t,n),o=i[0];return Wu(o.original||o,r,t)}function th(e,t,n){var i=ih(e),r=nh(t,n),o=i[i.length-1];return Wu(o.original||o,r,t)}function nh(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ih(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function rh(e,t){return y(E(e,oh),(function(e){return function(e,t){return"intersect"===mn(t,e,1)}(e,t)}))}function oh(e){return e.original||e}function ah(e,t){Do.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,i=e.newShape;if(function(e,t){return vr(e,"bpmn:Participant")&&Or(e)&&vr(t,"bpmn:Participant")&&!Or(t)}(n,i)){var r,o,a,s,c=(o=ut([r=n],!1),a=[],s=[],o.forEach((function(e){e!==r&&(e.incoming.forEach((function(e){vr(e,"bpmn:MessageFlow")&&a.push(e)})),e.outgoing.forEach((function(e){vr(e,"bpmn:MessageFlow")&&s.push(e)})))}),[]),{incoming:a,outgoing:s});c.incoming.forEach((function(e){var r=Ju(e,i,n);t.reconnectEnd(e,i,r)})),c.outgoing.forEach((function(e){var r=Qu(e,i,n);t.reconnectStart(e,i,r)}))}}),!0)}e(Yu,Do),Yu.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(Zu,Do),Zu.$inject=["eventBus","modeling"],ah.$inject=["eventBus","modeling"],e(ah,Do);const sh=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function ch(e){const t=gr(e);if(!(vr(t,"bpmn:BoundaryEvent")||vr(t,"bpmn:StartEvent")&&$r(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&sh.some((e=>vr(n[0],e)))}function ph(e){return vr(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function lh(e,t){e.invoke(Do,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,i=e.context.newShape,r=e.context.hints;if(!ch(i))return;const o=ph(i);if(r.targetElement&&void 0!==r.targetElement[o])return;const a=gr(n).get(o);a!==gr(i).get(o)&&t.updateProperties(i,{[o]:a})}))}function uh(e,t){Do.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,i=br(n),r=i&&i.get("label");r&&r.get("bounds")&&t.updateModdleProperties(n,r,{bounds:void 0})}),!0)}function hh(e,t,n){Do.call(this,e),this.preExecute("shape.delete",(function(e){var i=e.context.shape;if(1===i.incoming.length&&1===i.outgoing.length){var r=i.incoming[0],o=i.outgoing[0];if(vr(r,"bpmn:SequenceFlow")&&vr(o,"bpmn:SequenceFlow")&&t.canConnect(r.source,o.target,r)){var a=function(e,t){var n=Pu(dh(e[e.length-2]),dh(e[e.length-1]),dh(t[1]),dh(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[dh(e[0]),dh(t[t.length-1])]}(r.waypoints,o.waypoints);n.reconnectEnd(r,o.target,a)}}}))}function dh(e){return e.original||e}function fh(e,t){Do.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;vr(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;if(n&&!n.businessObject.participants.length){var i=t.makeProcess(),r=n.children.slice();t.moveElements(r,{x:0,y:0},i)}}),!0)}function mh(e,t,n,i){Do.call(this,e);var r=i.get("dragging",!1);function o(e){var i,r,o=e.source,a=e.target;e.parent&&(vr(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,a)||(r=!0),n.canConnectMessageFlow(o,a)&&(i="bpmn:MessageFlow")),vr(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,a)||(r=!0),n.canConnectSequenceFlow(o,a)&&(i="bpmn:SequenceFlow")),r&&t.removeConnection(e),i&&t.connect(o,a,{type:i,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){g(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var i,o,a=e.context,s=a.connection,c=a.newSource||s.source,p=a.newTarget||s.target;(i=n.canConnect(c,p))&&i.type!==s.type&&(o=t.connect(c,p,{type:i.type,associationDirection:i.associationDirection,waypoints:s.waypoints.slice()}),s.parent&&t.removeConnection(s),a.connection=o,r&&function(e,t){var n,i=r.context(),o=i&&i.payload.previousSelection;if(!o||!o.length)return;if(-1===(n=o.indexOf(e)))return;o.splice(n,1,t)}(s,o))})),this.postExecuted("element.updateProperties",(function(e){var n,i=e.context,r=i.properties,o=i.element,a=o.businessObject;r.default&&(n=m(o.outgoing,M({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),r.conditionExpression&&a.sourceRef.default===a&&t.updateProperties(o.source,{default:void 0})}))}function vh(e,t,n,i,r,o){i.invoke(Do,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,(function(e){var n=e.context,i=n.parent,r=n.elements,o=_(r,(function(e,n){var r=t.canReplace([n],n.host||n.parent||i);return r?e.concat(r.replacements):e}),[]);o.length&&this._replaceElements(r,o)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,i=n.newParent,r=n.newHost,o=[];g(n.closure.topLevel,(function(e){o=$r(e)?o.concat(e.children):o.concat(e)})),1===o.length&&r&&(i=r);var a=t.canReplace(o,i);a&&this._replaceElements(o,a.replacements,r)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,i=e.context,r=i.oldShape,o=i.newShape,a=r.attachers;a&&a.length&&(n=t.canReplace(a,o),this._replaceElements(a,n.replacements))}),this),this.postExecuted(["shape.replace"],1500,(function(e){var t=e.context,n=t.oldShape,i=t.newShape;r.unclaimId(n.businessObject.id,n.businessObject),r.updateProperties(i,{id:n.id})}))}lh.$inject=["injector","modeling"],e(lh,Do),e(uh,Do),uh.$inject=["eventBus","modeling"],e(hh,Do),hh.$inject=["eventBus","bpmnRules","modeling"],fh.$inject=["eventBus","modeling"],e(fh,Do),e(mh,Do),mh.$inject=["eventBus","modeling","bpmnRules","injector"],e(vh,Do),vh.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;g(t,(function(t){var r={type:t.newElementType},o=n.get(t.oldElementId),a=e.indexOf(o);e[a]=i.replaceElement(o,r,{select:!1})})),t&&r.select(e)},vh.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var yh={width:140,height:120},gh={width:300,height:60},bh={width:60,height:300},_h={width:300,height:150},xh={width:150,height:300},wh={width:140,height:120},Eh={width:50,height:30};function Sh(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,i=t.direction,r=t.balanced;(vr(n,"bpmn:Lane")||vr(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var i=mu(e),r=!0,o=!0,a=du(i,[i]),s=un(e),c={},p={},l=Lr(e),u=l?gh:bh;/n/.test(t)?p.top=s.bottom-u.height:/e/.test(t)?p.right=s.left+u.width:/s/.test(t)?p.bottom=s.top+u.height:/w/.test(t)&&(p.left=s.right-u.width);a.forEach((function(e){var i=un(e);l?(i.top<s.top-10&&(r=!1),i.bottom>s.bottom+10&&(o=!1)):(i.left<s.left-10&&(r=!1),i.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&Ch(s.top-i.bottom)<10&&Mh(c,"top",i.top+u.height),Ch(s.top-i.top)<5&&Ah(p,"top",i.bottom-u.height)),/e/.test(t)&&(n&&Ch(s.right-i.left)<10&&Ah(c,"right",i.right-u.width),Ch(s.right-i.right)<5&&Mh(p,"right",i.left+u.width)),/s/.test(t)&&(n&&Ch(s.bottom-i.top)<10&&Ah(c,"bottom",i.bottom-u.height),Ch(s.bottom-i.bottom)<5&&Mh(p,"bottom",i.top+u.height)),/w/.test(t)&&(n&&Ch(s.left-i.right)<10&&Mh(c,"left",i.left+u.width),Ch(s.left-i.left)<5&&Ah(p,"left",i.right-u.width))}));var h=i.children.filter((function(e){return!e.hidden&&!e.waypoints&&(vr(e,"bpmn:FlowElement")||vr(e,"bpmn:Artifact"))})),d=l?Th:Dh;return h.forEach((function(e){var n=un(e);!/n/.test(t)||l&&!r||Ah(p,"top",n.top-d.top),/e/.test(t)&&(l||o)&&Mh(p,"right",n.right+d.right),!/s/.test(t)||l&&!o||Mh(p,"bottom",n.bottom+d.bottom),/w/.test(t)&&(l||r)&&Ah(p,"left",n.left-d.left)})),{min:p,max:c}}(n,i,r)),vr(n,"bpmn:SubProcess")&&Or(n)&&(t.minDimensions=wh),vr(n,"bpmn:TextAnnotation")&&(t.minDimensions=Eh)}))}Sh.$inject=["eventBus"];var Ch=Math.abs,kh=Math.min,Rh=Math.max;function Ph(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function Ah(e,t,n){return Ph(e,t,n,kh)}function Mh(e,t,n){return Ph(e,t,n,Rh)}var Th={top:20,left:50,right:20,bottom:20},Dh={top:50,left:20,right:20,bottom:20};function Bh(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(vr(n,"bpmn:Lane")||vr(n,"bpmn:Participant"))&&(t.balanced=!ca(e))})),e.on("resize.end",1001,(function(e){var n=e.context,i=n.shape,r=n.canExecute,o=n.newBounds;if(vr(i,"bpmn:Lane")||vr(i,"bpmn:Participant"))return r&&(o=pn(o),t.resizeLane(i,o,n.balanced)),!1}))}Bh.$inject=["eventBus","modeling"];function Nh(e,t,n,i,r){function o(e){return yr(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){p(t)||(t=[t]);return w(t,(function(t){return Ir(e,t)}))}(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(t){return!!m(e.getDefinitions().get("rootElements"),M({id:t.id}))}function s(e){return vr(e,"bpmn:ErrorEventDefinition")?"errorRef":vr(e,"bpmn:EscalationEventDefinition")?"escalationRef":vr(e,"bpmn:MessageEventDefinition")?"messageRef":vr(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function c(e){if(yr(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(s(t))}n.invoke(Do,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var i=c(gr(n));i&&!a(i)&&(_t(e.getDefinitions().get("rootElements"),i),t.addedRootElement=i)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;n&&bt(e.getDefinitions().get("rootElements"),n)}),!0),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element;if(!n.labelTarget&&o(n)){var i=c(gr(n));i&&(t.referencedRootElement=i)}})),t.on("copyPaste.pasteElement",500,(function(e){var t=e.descriptor,n=t.businessObject,o=t.referencedRootElement;o&&(a(o)||(o=i.copyElement(o,r.create(o.$type))),function(e,t){if(yr(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.set("messageRef",t);var n=e.get("eventDefinitions")[0];n.set(s(n),t)}(n,o),delete t.referencedRootElement)}))}Nh.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(Nh,Do);var jh=Math.max;function Oh(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,i=e.start,r={};return g(t,(function(e){var t=e.id;vr(e,"bpmn:Participant")&&(r[t]=function(e,t,n){var i=Lr(e);if(r=e,!fu(r).length)return i?_h:xh;var r;var o=function(e){return"x"===e}(t),a={};a=o?i?_h:{width:$h(e,n,o),height:xh.height}:i?{width:_h.width,height:Lh(e,n,o)}:xh;return a}(e,n,i)),vr(e,"bpmn:Lane")&&(r[t]=Lr(e)?gh:bh),vr(e,"bpmn:SubProcess")&&Or(e)&&(r[t]=wh),vr(e,"bpmn:TextAnnotation")&&(r[t]=Eh),vr(e,"bpmn:Group")&&(r[t]=yh)})),r}))}function Lh(e,t,n){var i;return i=function(e,t,n){var i,r=fu(e);return i=Ih(r,t,n),e.height-i.height+gh.height}(e,t,n),jh(_h.height,i)}function $h(e,t,n){var i;return i=function(e,t,n){var i,r=fu(e);return i=Ih(r,t,n),e.width-i.width+bh.width}(e,t,n),jh(xh.width,i)}function Ih(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return(o=fu(r)).length?Ih(o,t,n):r}Oh.$inject=["eventBus"];var Fh=180,zh=160;function Hh(e,t,n,i,r,o,a){Do.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(e){return vr(e,"bpmn:SubProcess")&&!Or(e)}function p(t){var n=t.shape,i=t.newRootElement,r=gr(n);i=s._addDiagram(i||r),t.newRootElement=e.addRootElement(i)}function l(t){var n=gr(t.shape);s._removeDiagram(n);var i=t.newRootElement=a.get(zo(n));e.removeRootElement(i)}this.executed("shape.create",(function(e){c(e.shape)&&p(e)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.newRootElement;n&&t.children&&(s._showRecursively(t.children),s._moveChildrenToShape(t,n))}),!0),this.reverted("shape.create",(function(e){c(e.shape)&&l(e)}),!0),this.preExecuted("shape.delete",(function(e){var t=e.shape;if(c(t)){var i=a.get(zo(t));i&&n.removeElements(i.children.slice())}}),!0),this.executed("shape.delete",(function(e){c(e.shape)&&l(e)}),!0),this.reverted("shape.delete",(function(e){c(e.shape)&&p(e)}),!0),this.preExecuted("shape.replace",(function(t){var n=t.oldShape,i=t.newShape;c(n)&&c(i)&&(t.oldRoot=e.removeRootElement(zo(n)))}),!0),this.postExecuted("shape.replace",(function(t){var i=t.newShape,r=t.oldRoot,o=e.findRoot(zo(i));if(r&&o){var a=r.children;n.moveElements(a,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(vr(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(Vo(t))return a.updateId(t,Ho(r)),void a.updateId(i,r);a.get(Ho(i))&&a.updateId(Ho(i),Ho(r))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(vr(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(Vo(t))return a.updateId(t,Ho(i)),void a.updateId(r,i);var o=a.get(Ho(r));o&&a.updateId(o,Ho(i))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(Vo(n)){var i=n,r=a.get(Fo(i));r&&r!==i&&t.fire("element.changed",{element:r})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;vr(t,"bpmn:SubProcess")&&(Or(t)?l(e):(p(e),s._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;vr(t,"bpmn:SubProcess")&&(Or(t)?l(e):(p(e),s._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(vr(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Or(t)?s._moveChildrenToShape(n,t):s._moveChildrenToShape(t,n))}}),!0),t.on("copyPaste.createTree",(function(e){var t=e.element,n=e.children;if(c(t)){var i=zo(t),r=a.get(i);r&&n.push.apply(n,r.children)}})),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,i=e.elements,r=n.parent;if(vr(br(r),"bpmndi:BPMNPlane")){var o=Fo(r),a=m(i,(function(e){return e.id===o}));a&&(t.parent=a.id)}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor;t.parent&&(c(t.parent)||t.parent.hidden)&&(t.hidden=!0)}))}function Vh(e,t){e.invoke(Do,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,i=e.context.newShape;if(vr(i,"bpmn:SubProcess")&&(vr(n,"bpmn:Task")||vr(n,"bpmn:CallActivity"))&&Or(i)){var r,o={x:(r=i).x+r.width/6,y:r.y+r.height/2};t.createShape({type:"bpmn:StartEvent"},o,i)}}))}function Gh(e){Do.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;vr(t,"bpmn:TextAnnotation")&&(e.parent=t.parent)}),!0),this.preExecute(["shape.create","shape.resize","elements.move"],(function(e){const t=e.shapes||[e.shape];1===t.length&&vr(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function Wh(e,t){Do.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Or(n)){var i=ut(n);i.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();g(t,(function(e){r(e,!0)})),g(n,(function(e){r(e,!1)}))}))}function r(e,r){-1!==i.indexOf(e.source)&&-1!==i.indexOf(e.target)||(r?t.reconnectEnd(e,n,fn(n)):t.reconnectStart(e,n,fn(n)))}}),!0)}e(Hh,Do),Hh.prototype._moveChildrenToShape=function(e,t){var n,i=this._modeling,r=e.children;if(r){var o=(r=r.concat(r.reduce((function(t,n){return n.label&&n.label.parent!==e?t.concat(n.label):t}),[]))).filter((function(e){return!e.hidden}));if(o.length){var a=ht(o);if(t.x){var s=fn(t),c=fn(a);n={x:s.x-c.x,y:s.y-c.y}}else n={x:Fh-a.x,y:zh-a.y};i.moveElements(r,n,t,{autoResize:!1})}else i.moveElements(r,{x:0,y:0},t,{autoResize:!1})}},Hh.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach((function(e){e.hidden=!!t,i=i.concat(e),e.children&&(i=i.concat(n._showRecursively(e.children,e.collapsed||t)))})),i},Hh.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},Hh.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});return i.$parent=r,n.createRoot({id:zo(e),type:e.$type,di:i,businessObject:e,collapsed:!0})},Hh.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=m(t,(function(t){return t.plane.bpmnElement.id===e.id}));return t.splice(t.indexOf(n),1),n},Hh.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],Vh.$inject=["injector","modeling"],e(Vh,Do),e(Gh,Do),Gh.$inject=["eventBus"],e(Wh,Do),Wh.$inject=["eventBus","modeling"];function Uh(e,t,n){Do.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;vr(n,"bpmn:SubProcess")&&(n.collapsed?br(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),br(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?br(t).isExpanded=!1:br(t).isExpanded=!0})),this.postExecuted(["shape.toggleCollapse"],500,(function(e){var i,r=e.context.shape,o=t.getDefaultSize(r);i=r.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(r,o):function(e,t){var n,i,r,o=e.children,a=t;return n=(r=o,r.filter((function(e){return!e.hidden}))).concat([e]),(i=pu(n))?(a.width=Math.max(i.width,a.width),a.height=Math.max(i.height,a.height),a.x=i.x+(i.width-a.width)/2,a.y=i.y+(i.height-a.height)/2):(a.x=e.x+(e.width-a.width)/2,a.y=e.y+(e.height-a.height)/2),a}(r,o),n.resizeShape(r,i,null,{autoResize:!r.collapsed&&"nwse"})}))}function qh(e,t,n,i){t.invoke(Do,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,r=t.businessObject;cn(t)||(vr(t,"bpmn:Participant")&&Or(t)&&n.ids.unclaim(r.processRef.id),i.unclaimId(r.id,r))})),this.preExecute("connection.delete",(function(e){var t=e.context.connection.businessObject;i.unclaimId(t.id,t)})),this.preExecute("canvas.updateRoot",(function(){var t=e.getRootElement(),i=t.businessObject;vr(t,"bpmn:Collaboration")&&n.ids.unclaim(i.id)}))}function Kh(e,t){Do.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,i=n.source;(function(e,t){if(!vr(e,"bpmn:SequenceFlow"))return!1;var n=gr(t),i=gr(e);return n.get("default")===i})(n,i)&&t.updateProperties(i,{default:null})}))}e(Uh,Do),Uh.$inject=["eventBus","elementFactory","modeling"],e(qh,Do),qh.$inject=["canvas","injector","moddle","modeling"],e(Kh,Do),Kh.$inject=["eventBus","modeling"];function Yh(e,t){var n;function i(){if(!n)throw new Error("out of bounds release");return n}Do.call(this,e);var r=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(r,5e3,(function(e){(n=n||new Xh).enter()})),this.postExecuted(r,500,(function(e){!function(){if(!n)throw new Error("out of bounds release");var e=n.leave();e&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null)}()})),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],(function(e){var t=e.context.shape,n=i();t.labelTarget||(vr(t,"bpmn:Lane")&&n.addLane(t),vr(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function Xh(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function Zh(e,t){Do.call(this,e),this.postExecuted("elements.create",(function(e){const n=e.context.elements;for(const e of n)Qh(e)&&!Jh(e)&&t.updateProperties(e,{isForCompensation:void 0})}))}function Qh(e){const t=gr(e);return t&&t.isForCompensation}function Jh(e){return e.incoming.filter((e=>function(e){return e&&vr(e,"bpmn:BoundaryEvent")&&Ir(e,"bpmn:CompensateEventDefinition")}(e.source))).length>0}Yh.$inject=["eventBus","modeling"],e(Yh,Do),e(Zh,Do),Zh.$inject=["eventBus","modeling"];var ed={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",jl],appendBehavior:["type",Ll],associationBehavior:["type",$l],attachEventBehavior:["type",Il],boundaryEventBehavior:["type",zl],compensateBoundaryEventBehaviour:["type",Hl],createBehavior:["type",Ul],createDataObjectBehavior:["type",ql],createParticipantBehavior:["type",Zl],dataInputAssociationBehavior:["type",Jl],dataStoreBehavior:["type",nu],deleteLaneBehavior:["type",yu],detachEventBehavior:["type",gu],dropOnFlowBehavior:["type",_u],eventBasedGatewayBehavior:["type",Eu],fixHoverBehavior:["type",ku],groupBehavior:["type",Ru],importDockingFix:["type",Au],isHorizontalFix:["type",Tu],labelBehavior:["type",Yu],layoutConnectionBehavior:["type",Zu],messageFlowBehavior:["type",ah],nonInterruptingBehavior:["type",lh],removeElementBehavior:["type",hh],removeEmbeddedLabelBoundsBehavior:["type",uh],removeParticipantBehavior:["type",fh],replaceConnectionBehavior:["type",mh],replaceElementBehaviour:["type",vh],resizeBehavior:["type",Sh],resizeLaneBehavior:["type",Bh],rootElementReferenceBehavior:["type",Nh],spaceToolBehavior:["type",Oh],subProcessPlaneBehavior:["type",Hh],subProcessStartEventBehavior:["type",Vh],textAnnotationBehavior:["type",Gh],toggleCollapseConnectionBehaviour:["type",Wh],toggleElementCollapseBehaviour:["type",Uh],unclaimIdBehavior:["type",qh],unsetDefaultFlowBehavior:["type",Kh],updateFlowNodeRefsBehavior:["type",Yh],setCompensationActivityAfterPasteBehavior:["type",Zh]};function td(e,t){var n=mn(e,t,-15);return"intersect"!==n?n:null}function nd(e){Hc.call(this,e)}function id(e){return!e||cn(e)}function rd(e){do{if(vr(e,"bpmn:Process"))return gr(e);if(vr(e,"bpmn:Participant"))return gr(e).processRef||gr(e)}while(e=e.parent)}function od(e){return vr(e,"bpmn:TextAnnotation")}function ad(e){return vr(e,"bpmn:Group")&&!e.labelTarget}function sd(e){return vr(e,"bpmn:BoundaryEvent")&&ud(e,"bpmn:CompensateEventDefinition")}function cd(e){return gr(e).isForCompensation}function pd(e){for(var t=e;t=t.parent;){if(vr(t,"bpmn:FlowElementsContainer"))return gr(t);if(vr(t,"bpmn:Participant"))return gr(t).processRef}return null}function ld(e,t){return pd(e)===pd(t)}function ud(e,t){return!!m(gr(e).eventDefinitions||[],(function(e){return vr(e,t)}))}function hd(e,t){return(gr(e).eventDefinitions||[]).every((function(e){return vr(e,t)}))}function dd(e,t){var n=function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t);return-1!==n.indexOf(e)}function fd(e,t,n){if(id(e)||id(t))return null;if(!vr(n,"bpmn:DataAssociation")){if(Pd(e,t))return{type:"bpmn:MessageFlow"};if(Ad(e,t))return{type:"bpmn:SequenceFlow"}}var i=Md(e,t);return i||(Rd(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!kd(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function md(e,t){return!(!cn(e)&&!ad(e))||!(vr(t,"bpmn:Participant")&&!Or(t))&&(vr(e,"bpmn:Participant")?vr(t,"bpmn:Process")||vr(t,"bpmn:Collaboration"):yr(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:vr(e,"bpmn:Lane")?vr(t,"bpmn:Participant")||vr(t,"bpmn:Lane"):!(vr(e,"bpmn:BoundaryEvent")&&!function(e){return gr(e).cancelActivity&&(gd(e)||bd(e))}(e))&&(vr(e,"bpmn:FlowElement")&&!vr(e,"bpmn:DataStoreReference")?vr(t,"bpmn:FlowElementsContainer")?Or(t):yr(t,["bpmn:Participant","bpmn:Lane"]):vr(e,"bpmn:DataStoreReference")&&vr(t,"bpmn:Collaboration")?w(gr(t).get("participants"),(function(e){return!!e.get("processRef")})):yr(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?yr(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!vr(e,"bpmn:MessageFlow")&&(vr(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function vd(e){return vr(e,"bpmn:Lane")}function yd(e){return!!function(e){return!cn(e)&&vr(e,"bpmn:BoundaryEvent")}(e)||(!(!vr(e,"bpmn:IntermediateThrowEvent")||!gd(e))||vr(e,"bpmn:IntermediateCatchEvent")&&bd(e))}function gd(e){var t=gr(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function bd(e){return _d(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function _d(e,t){return t.some((function(t){return ud(e,t)}))}function xd(e,t,n,i){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var r=e[0];return!cn(r)&&(!!yd(r)&&(!$r(t)&&(!(!vr(t,"bpmn:Activity")||cd(t))&&(!(i&&!td(i,t))&&(!function(e){return vr(e,"bpmn:ReceiveTask")&&m(e.incoming,(function(e){return vr(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function wd(e,t,n){if(!t)return!1;var i={replacements:[]};return g(e,(function(e){$r(t)||vr(e,"bpmn:StartEvent")&&"label"!==e.type&&md(e,t)&&(function(e){return e&&!1!==gr(e).isInterrupting}(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Ir(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Ir(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Ir(e,"bpmn:CompensateEventDefinition")}(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),_d(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&vr(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),vr(t,"bpmn:Transaction")||ud(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(vr(e,"bpmn:EndEvent")&&md(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),vr(e,"bpmn:BoundaryEvent")&&xd(e,t,0,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!i.replacements.length&&i}function Ed(e,t){return!w(e,vd)&&(!t||e.every((function(e){return md(e,t)})))}function Sd(e,t,n,i){return!!t&&(!(!cn(e)&&!ad(e))||!function(e,t){return e===t}(n,t)&&((!n||!dd(n,t))&&(md(e,t)||Td(e,t))))}function Cd(e,t){return vr(e,"bpmn:SubProcess")?Or(e)&&(!t||t.width>=100&&t.height>=80):!!vr(e,"bpmn:Lane")||(!!vr(e,"bpmn:Participant")||(!!od(e)||!!ad(e)))}function kd(e,t){return!dd(t,e)&&!dd(e,t)&&(!!function(e,t){var n=od(e),i=od(t);return(n||i)&&n!==i}(e,t)||!!Md(e,t))}function Rd(e,t){return ld(e,t)&&sd(e)&&vr(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!$r(t);var n}function Pd(e,t){return!(Bd(e)&&!Bd(t))&&(vr(n=e,"bpmn:InteractionNode")&&!vr(n,"bpmn:BoundaryEvent")&&(!vr(n,"bpmn:Event")||vr(n,"bpmn:ThrowEvent")&&hd(n,"bpmn:MessageEventDefinition"))&&function(e){return vr(e,"bpmn:InteractionNode")&&!cd(e)&&(!vr(e,"bpmn:Event")||vr(e,"bpmn:CatchEvent")&&hd(e,"bpmn:MessageEventDefinition"))&&!(vr(e,"bpmn:BoundaryEvent")&&!ud(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return rd(e)===rd(t)}(e,t));var n}function Ad(e,t){return vr(n=e,"bpmn:FlowNode")&&!vr(n,"bpmn:EndEvent")&&!$r(n)&&!(vr(n,"bpmn:IntermediateThrowEvent")&&ud(n,"bpmn:LinkEventDefinition"))&&!sd(n)&&!cd(n)&&function(e){return vr(e,"bpmn:FlowNode")&&!vr(e,"bpmn:StartEvent")&&!vr(e,"bpmn:BoundaryEvent")&&!$r(e)&&!(vr(e,"bpmn:IntermediateCatchEvent")&&ud(e,"bpmn:LinkEventDefinition"))&&!cd(e)}(t)&&ld(e,t)&&!(vr(e,"bpmn:EventBasedGateway")&&!function(e){return vr(e,"bpmn:ReceiveTask")||vr(e,"bpmn:IntermediateCatchEvent")&&(ud(e,"bpmn:MessageEventDefinition")||ud(e,"bpmn:TimerEventDefinition")||ud(e,"bpmn:ConditionalEventDefinition")||ud(e,"bpmn:SignalEventDefinition"))}(t));var n}function Md(e,t){return yr(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&yr(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!yr(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!yr(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Td(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(1!==e.length)return!1;e=e[0]}return t.source!==e&&t.target!==e&&(yr(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!cn(t)&&vr(e,"bpmn:FlowNode")&&!vr(e,"bpmn:BoundaryEvent")&&md(e,t.parent))}function Dd(e,t){return!!cn(t)||!(vr(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function Bd(e){return Jc(e,"bpmn:Process")||Jc(e,"bpmn:Collaboration")}e(nd,Hc),nd.$inject=["eventBus"],nd.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(id(e))return null;return yr(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}(e.source)})),this.addRule("connection.create",(function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent;if(i.targetAttach)return!1;r&&(n.parent=r);try{return fd(t,n)}finally{r&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return fd(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Cd(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,i=e.target;return!(sn(i)&&!Td(t,i))&&x(t,(function(e){return sn(e)?fd(e.source,e.target,e):e.host?xd(e,e.host,null,n):Sd(e,i,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,i=e.position;return xd(n,t,null,i)||wd(n,t,i)||Ed(n,t)||Td(n,t)})),this.addRule("shape.create",(function(e){return Sd(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return xd(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Dd(e.elements,t)}))},nd.prototype.canConnectMessageFlow=Pd,nd.prototype.canConnectSequenceFlow=Ad,nd.prototype.canConnectDataAssociation=Md,nd.prototype.canConnectAssociation=kd,nd.prototype.canConnectCompensationAssociation=Rd,nd.prototype.canMove=Ed,nd.prototype.canAttach=xd,nd.prototype.canReplace=wd,nd.prototype.canDrop=md,nd.prototype.canInsert=Td,nd.prototype.canCreate=Sd,nd.prototype.canConnect=fd,nd.prototype.canResize=Cd,nd.prototype.canCopy=Dd;var Nd={__depends__:[xp],__init__:["bpmnRules"],bpmnRules:["type",nd]};function jd(e,t){e.on("saveXML.start",2e3,(function(){g(t.getRootElements(),(function(e){var t,n=br(e);t=E(y(ut([e],!1),(function(t){return t!==e&&!t.labelTarget})),br),n.set("planeElement",t)}))}))}jd.$inject=["eventBus","canvas"];var Od={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",jd]};function Ld(e){Do.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],(function(e){var n=e.context,i=n.shape||n.connection,r=n.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)})),this.preExecute(["shape.move","connection.move"],(function(e){var n=e.context,i=n.shape||n.connection,r=n.newParent||i.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)}))}function $d(e,t){Ld.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=m(n,(function(t){return yr(e,[t.type])}));return t&&t.order||{level:1}}(e)),!t)throw new Error(`no order for <${e.id}>`);return t}this.getOrdering=function(e,n){if(e.labelTarget||vr(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var r=i(e);r.containers&&(n=function(e,t,n){for(var i=t;i&&!yr(i,n);)i=i.parent;if(!i)throw new Error(`no parent for <${e.id}> in <${t&&t.id}>`);return i}(e,n,r.containers));var o=n.children.indexOf(e),a=v(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level}));return-1!==a&&-1!==o&&o<a&&(a-=1),{index:a,parent:n}}}Ld.prototype.getOrdering=function(e,t){return null},e(Ld,Do),$d.$inject=["eventBus","canvas"],e($d,Ld);var Id={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",$d]};function Fd(){}Fd.prototype.get=function(){return this._data},Fd.prototype.set=function(e){this._data=e},Fd.prototype.clear=function(){var e=this._data;return delete this._data,e},Fd.prototype.isEmpty=function(){return!this._data};var zd={clipboard:["type",Fd]},Hd="drop-ok",Vd="drop-not-ok",Gd="attach-ok",Wd="new-parent",Ud="create";function qd(e,t,n,i,r){function o(t,n){[Gd,Hd,Vd,Wd].forEach((function(i){i===n?e.addMarker(t,i):e.removeMarker(t,i)}))}function a(){var e=t.context();e&&e.prefix===Ud&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,i=e.hover,a=t.source,s=t.hints||{};if(!i)return t.canExecute=!1,void(t.target=null);Kd(e);var c={x:e.x,y:e.y},p=t.canExecute=i&&function(e,t,n,i,o){if(!t)return!1;var a=m(e=y(e,(function(t){var n=t.labelTarget;return!(t.parent||cn(t)&&-1!==e.indexOf(n))})),(function(e){return!sn(e)})),s=!1,c=!1,p=!1;Yd(e)&&(s=r.allowed("shape.attach",{position:n,shape:a,target:t})),s||(p=Yd(e)?r.allowed("shape.create",{position:n,shape:a,source:i,target:t}):r.allowed("elements.create",{elements:e,position:n,target:t}));var l=o.connectionTarget;return p||s?(a&&i&&(c=r.allowed("connection.create",{source:l===i?a:i,target:l===i?i:a,hints:{targetParent:t,targetAttach:s}})),{attach:s,connect:c}):(null===p||null===s)&&null}(n,i,c,a,s);i&&null!==p&&(t.target=i,p&&p.attach?o(i,Gd):o(i,p?Wd:Vd))})),n.on(["create.end","create.out","create.cleanup"],(function(e){var t=e.hover;t&&o(t,null)})),n.on("create.end",(function(e){var t=e.context,n=t.source,r=t.shape,o=t.elements,a=t.target,s=t.canExecute,c=s&&s.attach,p=s&&s.connect,l=t.hints||{};if(!1===s||!a)return!1;Kd(e);var u={x:e.x,y:e.y};r=p?i.appendShape(n,r,u,a,{attach:c,connection:!0===p?{}:p,connectionTarget:l.connectionTarget}):m(o=i.createElements(o,u,a,L({},l,{attach:c})),(function(e){return!sn(e)})),L(t,{elements:o,shape:r}),L(e,{elements:o,shape:r})})),n.on("create.init",(function(){n.on("elements.changed",a),n.once(["create.cancel","create.end"],2e3,(function(){n.off("elements.changed",a)}))})),this.start=function(e,n,i){p(n)||(n=[n]);var r=m(n,(function(e){return!sn(e)}));if(r){i=L({elements:n,hints:{},shape:r},i||{}),g(n,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var o=ht(y(n,(function(e){return!e.hidden})));g(n,(function(e){sn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}}))),L(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,Ud,{cursor:"grabbing",autoActivate:!0,data:{shape:r,elements:n,context:i}})}}}function Kd(e){var t=e.context.createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.top&&(e.y=Math.max(e.y,t.top)),t.bottom&&(e.y=Math.min(e.y,t.bottom)))}function Yd(e){return e&&1===e.length&&!sn(e[0])}qd.$inject=["canvas","dragging","eventBus","modeling","rules"];function Xd(e,t,n,i,r){t.on("create.move",750,(function(t){var o=t.hover,a=t.context,s=a.elements,c=a.dragGroup;c||(c=a.dragGroup=function(e){var t=Ae("g");_e(t,r.cls("djs-drag-group",["no-events"]));var o=Ae("g");return e.forEach((function(e){var r;e.hidden||(e.waypoints?(r=n._createContainer("connection",o),n.drawConnection(Vn(r),e)):(r=n._createContainer("shape",o),n.drawShape(Vn(r),e),Wn(r,e.x,e.y)),i.addDragger(e,t,r))})),t}(s)),o?(c.parentNode||ye(e.getActiveLayer(),c),Wn(c,t.x,t.y)):Fe(c)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&Fe(t)}))}Xd.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var Zd={__depends__:[vp,Al,xp,_a],__init__:["create","createPreview"],create:["type",qd],createPreview:["type",Xd]};function Qd(e){var t=this;function n(e){t._lastMoveEvent=e}this._lastMoveEvent=null,e.on("canvas.init",(function(e){(t._svg=e.svg).addEventListener("mousemove",n)})),e.on("canvas.destroy",(function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)}))}Qd.$inject=["eventBus"],Qd.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null);return n}(0,0)};var Jd={__init__:["mouse"],mouse:["type",Qd]};function ef(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,i=e.elements;t.priority=1,t.id=n.id;var r=m(i,(function(e){return e===n.parent}));r&&(t.parent=n.parent.id),function(e){return!!e.host}(n)&&(t.priority=2,t.host=n.host.id),sn(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=function(e){return E(e.waypoints,(function(e){return(e=tf(e)).original&&(e.original=tf(e.original)),e}))}(n)),cn(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),g(["x","y","width","height"],(function(e){u(n[e])&&(t[e]=n[e])})),t.hidden=n.hidden,t.collapsed=n.collapsed})),r.on("copyPaste.pasteElements",(function(e){L(e.hints,{createElementsBehavior:!1})}))}function tf(e){return L({},e)}function nf(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}ef.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ef.prototype.copy=function(e){var t,n;return p(e)||(e=e?[e]:[]),n=!1===(t=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}))?{}:this.createTree(p(t)?t:e),this._clipboard.set(n),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:n}),n},ef.prototype.paste=function(e){var t=this._clipboard.get();if(!this._clipboard.isEmpty()){var n=e&&e.hints||{};this._eventBus.fire("copyPaste.pasteElements",{hints:n});var i=this._createElements(t);if(e&&e.element&&e.point)return this._paste(i,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),i,{hints:n||{}})}},ef.prototype._paste=function(e,t,n,i){g(e,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var r=ht(e);return g(e,(function(e){sn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2}}))),L(e,{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2})})),this._modeling.createElements(e,n,t,L({},i))},ef.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return g(e,(function(e,o){g(e=A(e,"priority"),(function(e){var o,a=L({},I(e,["priority"]));return i[e.parent]?a.parent=i[e.parent]:delete a.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:a}),sn(a)?(a.source=i[e.source],a.target=i[e.target],o=i[e.id]=t.createConnection(a),void r.push(o)):cn(a)?(a.labelTarget=i[a.labelTarget],o=i[e.id]=t.createLabel(a),void r.push(o)):(a.host&&(a.host=i[a.host]),o=i[e.id]=t.createShape(a),void r.push(o))}))})),r},ef.prototype.createConnection=function(e){return this._elementFactory.createConnection(I(e,["id"]))},ef.prototype.createLabel=function(e){return this._elementFactory.createLabel(I(e,["id"]))},ef.prototype.createShape=function(e){return this._elementFactory.createShape(I(e,["id"]))},ef.prototype.hasRelations=function(e,t){var n,i;return!(sn(e)&&(n=m(t,M({id:e.source.id})),i=m(t,M({id:e.target.id})),!n||!i))&&!(cn(e)&&!m(t,M({id:e.labelTarget.id})))},ef.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[];function o(e,t){var n=m(r,(function(t){return e===t.element}));n?n.depth<t&&(r=function(e,t){var n=t.indexOf(e);-1!==n&&t.splice(n,1);return t}(n,r),r.push({element:n.element,depth:t})):r.push({element:e,depth:t})}return lt(st(e),(function(e,t,i){if(!cn(e)){g(e.labels,(function(e){o(e,i)})),g([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&g(e,(function(e){g(e.labels,(function(e){o(e,i)})),o(e,i)}))})),o(e,i);var r=[];return e.children&&(r=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:r}),r}})),e=E(r,(function(e){return e.element})),r=E(r,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),r=A(r,(function(e){return e.descriptor.priority})),e=E(r,(function(e){return e.element})),g(r,(function(r){var o=r.depth;n.hasRelations(r.element,e)?!function(e,n){return t.allowed("element.copy",{element:e,elements:n})}(r.element,e)?nf(r.element,e):(i[o]||(i[o]=[]),i[o].push(r.descriptor)):nf(r.element,e)})),i};var rf={__depends__:[zd,Zd,Jd,xp],__init__:["copyPaste"],copyPaste:["type",ef]};function of(e,t,n){p(n)||(n=[n]),g(n,(function(n){a(e[n])||(t[n]=e[n])}))}function af(e,t,n){function i(t,i){var r=e.create(t.$type);return n.copyElement(t,r,null,i)}t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element,r=gr(n);if(cn(n))return t;var o=t.businessObject=i(r,!0),a=t.di=i(br(n),!0);a.bpmnElement=o,of(o,t,"name"),of(a,t,"isExpanded"),r.default&&(t.default=r.default.id)}));var r="-bpmn-js-refs";t.on("copyPaste.pasteElement",(function(e){var t=e.cache,n=e.descriptor,r=n.businessObject,o=n.di;if(cn(n))return n.businessObject=gr(t[n.labelTarget]),void(n.di=br(t[n.labelTarget]));r=n.businessObject=i(r),(o=n.di=i(o)).bpmnElement=r,of(n,r,["isExpanded","name"]),n.type=r.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(vr(n,"bpmn:Participant")){var r=gr(n);r.processRef&&(t.processRef=i(r.processRef,!0))}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor,n=t.processRef;n&&(t.processRef=i(n))})),t.on("copyPaste.pasteElement",750,(function(e){var t=e.cache;!function(e,t){e[r]=t}(t,function(e,t,n){var i=gr(e);return e.default&&(n[e.default]={element:i,property:"default"}),e.host&&(gr(e).attachedToRef=gr(t[e.host])),I(n,_(n,(function(t,n,r){var o=n.element,a=n.property;return r===e.id&&(o.set(a,i),t.push(e.id)),t}),[]))}(e.descriptor,t,function(e){return e[r]=e[r]||{}}(t)))}))}af.$inject=["bpmnFactory","eventBus","moddleCopy"];var sf=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function cf(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",(function(e){var t=e.propertyNames;if(t&&t.length)return A(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=l(t)&&t.$descriptor,i=e.propertyName;return(!i||-1===sf.indexOf(i))&&(!(i&&n&&!m(n.properties,M({name:i})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t,n,i=e.property;if(n="bpmn:ExtensionElements",(t=i)&&h(t.$instanceOf)&&t.$instanceOf(n)&&(!i.values||!i.values.length))return!1}))}function pf(e,t){return _(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}cf.$inject=["eventBus","bpmnFactory","moddle"],cf.prototype.copyElement=function(e,t,n,i=!1){var r=this;n&&!p(n)&&(n=[n]),n=n||pf(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return!1===o||(p(o)&&(n=o),g(n,(function(n){var o;f(e,n)&&(o=e.get(n));var a=r.copyProperty(o,t,n,i);s(a)&&(!1!==r._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:a,propertyName:n})&&t.set(n,a))}))),t},cf.prototype.copyProperty=function(e,t,n,i=!1){var r=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(!1!==o){if(o)return l(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;var a=this._moddle.getPropertyDescriptor(t,n);if(!a.isReference){if(a.isId)return e&&this._copyId(e,t,i);if(p(e))return _(e,(function(e,a){return(o=r.copyProperty(a,t,n,i))?e.concat(o):e}),[]);if(l(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return(o=r._bpmnFactory.create(e.$type)).$parent=t,o=r.copyElement(e,o,null,i)}return e}}},cf.prototype._copyId=function(e,t,n=!1){return n?e:this._moddle.ids.assigned(e)?void 0:(this._moddle.ids.claim(e,t),e)};var lf={__depends__:[rf],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",af],moddleCopy:["type",cf]},uf=Math.round;function hf(e,t){this._modeling=e,this._eventBus=t}function df(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:i={}}=t;!1!==i.select&&e.select(n)}))}hf.$inject=["modeling","eventBus"],hf.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,p=uf(s+o/2),l=uf(c+a/2),u=i.replaceShape(e,L({},t,{x:p,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:u,hints:n}),u},df.$inject=["selection","eventBus"];var ff={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",df],replace:["type",hf]};var mf=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function vf(e,t,n,i,r,o){this.replaceElement=function(s,c,l){l=l||{};var u=c.type,h=s.businessObject;if(yf(h)&&("bpmn:SubProcess"===u||"bpmn:AdHocSubProcess"===u)&&function(e,t){var n=e&&f(e,"collapsed")?e.collapsed:!Or(e);return n!==(t&&(f(t,"collapsed")||f(t,"isExpanded"))?f(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(s,c))return i.toggleCollapse(s),s;var d=e.create(u),m={type:u,businessObject:d,di:{}};"bpmn:ExclusiveGateway"===u&&(m.di.isMarkerVisible=!0),function(e,t,n){p(n)||(n=[n]),g(n,(function(n){a(e[n])||(t[n]=e[n])}))}(s.di,m.di,["fill","stroke","background-color","border-color","color"]);var v=function(e,t){return e.filter((function(e){return t.includes(e)}))}(pf(h.$descriptor),pf(d.$descriptor,!0));L(d,$(c,mf));var b=y(v,(function(e){return"eventDefinitions"===e?gf(s,c.eventDefinitionType):"loopCharacteristics"===e?!$r(d):!f(d,e)&&(("processRef"!==e||!1!==c.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!$r(d))))}));if(d=n.copyElement(h,d,b),c.eventDefinitionType&&(gf(d,c.eventDefinitionType)||(m.eventDefinitionType=c.eventDefinitionType,m.eventDefinitionAttrs=c.eventDefinitionAttrs)),vr(h,"bpmn:Activity")){if(yf(h))m.isExpanded=Or(s);else if(c&&f(c,"isExpanded")){m.isExpanded=c.isExpanded;var _=t.getDefaultSize(d,{isExpanded:m.isExpanded});m.width=_.width,m.height=_.height,m.x=s.x-(m.width-s.width)/2,m.y=s.y-(m.height-s.height)/2}Or(s)&&!vr(h,"bpmn:Task")&&m.isExpanded&&(m.width=s.width,m.height=s.height)}if(yf(h)&&!yf(d)&&(l.moveChildren=!1),vr(h,"bpmn:Participant")){!0===c.isExpanded?d.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var x=Lr(s);br(s).isHorizontal||(br(m).isHorizontal=x),m.width=x?s.width:t.getDefaultSize(m).width,m.height=x?t.getDefaultSize(m).height:s.height}return o.allowed("shape.resize",{shape:d})||(m.height=t.getDefaultSize(m).height,m.width=t.getDefaultSize(m).width),d.name=h.name,yr(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&yr(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=h.default),c.host&&!vr(h,"bpmn:BoundaryEvent")&&vr(d,"bpmn:BoundaryEvent")&&(m.host=c.host),"bpmn:DataStoreReference"!==m.type&&"bpmn:DataObjectReference"!==m.type||(m.x=s.x+(s.width-m.width)/2),r.replaceElement(s,m,{...l,targetElement:c})}}function yf(e){return vr(e,"bpmn:SubProcess")}function gf(e,t){var n=gr(e);return t&&n.get("eventDefinitions").some((function(e){return vr(e,t)}))}vf.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var bf={__depends__:[lf,ff,_a],bpmnReplace:["type",vf]};function _f(e){this._eventBus=e,this._tools=[],this._active=null}_f.$inject=["eventBus"],_f.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error('A tool has to be registered with it\'s "events"');n.push(e),this.bindEvents(e,t)},_f.prototype.isActive=function(e){return e&&this._active===e},_f.prototype.length=function(e){return this._tools.length},_f.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},_f.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",(function(t){t.context.reactivate||!this.isActive(e)?this.setActive(e):this.setActive(null)}),this),g(t,(function(e){i.push(e+".ended"),i.push(e+".canceled")})),n.on(i,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&J(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var xf={__depends__:[vp],__init__:["toolManager"],toolManager:["type",_f]};function wf(e,t){return-1!==e.indexOf(t)}var Ef=Math.abs,Sf=Math.round,Cf={x:"width",y:"height"},kf="crosshair",Rf={n:"top",w:"left",s:"bottom",e:"right"},Pf={n:"s",w:"e",s:"n",e:"w"};function Af(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",(function(e){n.once("spaceTool.selection.ended",(function(){s.activateMakeSpace(e.originalEvent)}))})),n.on("spaceTool.move",1500,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=s.init(e,t)),n&&Tf(e)})),n.on("spaceTool.end",(function(e){var t=e.context,i=t.axis,r=t.direction,o=t.movingShapes,a=t.resizingShapes,c=t.start;if(t.initialized){Tf(e);var p={x:0,y:0};p[i]=Sf(e["d"+i]),s.makeSpace(o,a,p,r,c),n.once("spaceTool.ended",(function(e){s.activateSelection(e.originalEvent,!0,!0)}))}}))}function Mf(e){return{top:e.top-20,right:e.right+20,bottom:e.bottom+20,left:e.left-20}}function Tf(e){var t,n,i=e.context.spaceToolConstraints;i&&(u(i.left)&&(t=Math.max(e.x,i.left),e.dx=e.dx+t-e.x,e.x=t),u(i.right)&&(t=Math.min(e.x,i.right),e.dx=e.dx+t-e.x,e.x=t),u(i.top)&&(n=Math.max(e.y,i.top),e.dy=e.dy+n-e.y,e.y=n),u(i.bottom)&&(n=Math.min(e.y,i.bottom),e.dy=e.dy+n-e.y,e.y=n))}function Df(e,t){return-1!==e.indexOf(t)}Af.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Af.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:kf,data:{context:{reactivate:n}},trapClick:!1})},Af.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:kf,data:{context:{}}})},Af.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Af.prototype.init=function(e,t){var n=Ef(e.dx)>Ef(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Ef(i)<5)return!1;i<0&&(i*=-1),ca(e)&&(i*=-1);var o=function(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null}(n,i),a=this._canvas.getRootElement();!pa(e)&&e.hover&&(a=e.hover);var s=[...ut(a,!0),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),p=function(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(!a.length)return;var s,c,p={};return g(a,(function(e){var l,h,d,f,m,v,g=e.attachers,b=e.children,_=un(e),x=y(b,(function(e){return!(sn(e)||cn(e)||Df(o,e)||Df(a,e))})),w=y(b,(function(e){return!sn(e)&&!cn(e)&&Df(o,e)})),E=[],S=[];x.length&&(h=Mf(un(ht(x))),l=i-_[Rf[n]]+h[Rf[n]],"n"===n?p.bottom=c=u(c)?Math.min(c,l):l:"w"===n?p.right=c=u(c)?Math.min(c,l):l:"s"===n?p.top=s=u(s)?Math.max(s,l):l:"e"===n&&(p.left=s=u(s)?Math.max(s,l):l)),w.length&&(d=Mf(un(ht(w))),l=i-d[Rf[Pf[n]]]+_[Rf[Pf[n]]],"n"===n?p.bottom=c=u(c)?Math.min(c,l):l:"w"===n?p.right=c=u(c)?Math.min(c,l):l:"s"===n?p.top=s=u(s)?Math.max(s,l):l:"e"===n&&(p.left=s=u(s)?Math.max(s,l):l)),g&&g.length&&(g.forEach((function(e){Df(o,e)?E.push(e):S.push(e)})),E.length&&(f=un(ht(E.map(fn))),m=_[Rf[Pf[n]]]-(f[Rf[Pf[n]]]-i)),S.length&&(v=un(ht(S.map(fn)))[Rf[n]]-(_[Rf[n]]-i)),"n"===n?(l=Math.min(m||1/0,v||1/0),p.bottom=c=u(c)?Math.min(c,l):l):"w"===n?(l=Math.min(m||1/0,v||1/0),p.right=c=u(c)?Math.min(c,l):l):"s"===n?(l=Math.max(m||-1/0,v||-1/0),p.top=s=u(s)?Math.max(s,l):l):"e"===n&&(l=Math.max(m||-1/0,v||-1/0),p.left=s=u(s)?Math.max(s,l):l));var C=r&&r[e.id];C&&("n"===n?(l=i+e[Cf[t]]-C[Cf[t]],p.bottom=c=u(c)?Math.min(c,l):l):"w"===n?(l=i+e[Cf[t]]-C[Cf[t]],p.right=c=u(c)?Math.min(c,l):l):"s"===n?(l=i-e[Cf[t]]+C[Cf[t]],p.top=s=u(s)?Math.max(s,l):l):"e"===n&&(l=i-e[Cf[t]]+C[Cf[t]],p.left=s=u(s)?Math.max(s,l):l))})),p}(c,n,o,r,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}));return L(t,c,{axis:n,direction:o,spaceToolConstraints:p,start:r}),$a("resize-"+("x"===n?"ew":"ns")),!0},Af.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=[],c=[];function p(e){o.includes(e)||o.push(e);var t=e.label;t&&!o.includes(t)&&o.push(t)}g(e,(function(e){if(e.parent&&!cn(e))if(sn(e))c.push(e);else{var o=e[t],l=o+e[Cf[t]];if(function(e){return!!e.host}(e)&&(n>0&&fn(e)[t]>i||n<0&&fn(e)[t]<i))s.push(e);else{var u;if(!(n>0&&o>i||n<0&&l<i))return o<i&&l>i&&r.allowed("shape.resize",{shape:e})?(u=e,void(a.includes(u)||a.push(u))):void 0;p(e)}}})),g(o,(function(e){var t=e.attachers;t&&g(t,(function(e){p(e)}))}));var l=o.concat(a);return g(s,(function(e){var t=e.host;Df(l,t)&&p(e)})),l=o.concat(a),g(c,(function(e){var t=e.source,n=e.target,i=e.label;Df(l,t)&&Df(l,n)&&i&&p(i)})),{movingShapes:o,resizingShapes:a}},Af.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Af.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var Bf="djs-dragging",Nf="djs-resizing",jf=Math.max;function Of(e,t,n,i,r){function o(e,t){g(e,(function(e){r.addDragger(e,t),n.addMarker(e,Bf)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),r=e.context,o="M 0,-10000 L 0,10000",a="M -10000,0 L 10000,0",s=Ae("g");_e(s,i.cls("djs-crosshair-group",["no-events"])),ye(t,s);var c=Ae("path");_e(c,"d",o),we(c).add("djs-crosshair"),ye(s,c);var p=Ae("path");_e(p,"d",a),we(p).add("djs-crosshair"),ye(s,p),r.crosshairGroup=s})),e.on("spaceTool.selection.move",(function(e){Wn(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Fe(t)})),e.on("spaceTool.move",250,(function(e){var a=e.context,s=a.line,c=a.axis,p=a.movingShapes,l=a.resizingShapes;if(a.initialized){if(!a.dragGroup){var u=n.getLayer("space");_e(s=Ae("path"),"d","M0,0 L0,0"),we(s).add("djs-crosshair"),ye(u,s),a.line=s;var h=Ae("g");_e(h,i.cls("djs-drag-group",["no-events"])),ye(n.getActiveLayer(),h),o(p,h),o(a.movingConnections=t.filter((function(e){var t=!1;g(p,(function(n){g(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;g(p,(function(t){g(t.incoming,(function(t){e===t&&(n=!0)}))}));var i=!1;g(l,(function(t){g(t.outgoing,(function(t){e===t&&(i=!0)}))}));var r=!1;return g(l,(function(t){g(t.incoming,(function(t){e===t&&(r=!0)}))})),sn(e)&&(t||i)&&(n||r)})),h),a.dragGroup=h}if(!a.frameGroup){var d=Ae("g");_e(d,i.cls("djs-frame-group",["no-events"])),ye(n.getActiveLayer(),d);var f=[];g(l,(function(e){var t=r.addFrame(e,d),i=t.getBBox();f.push({element:t,initialBounds:i}),n.addMarker(e,Nf)})),a.frameGroup=d,a.frames=f}_e(s,{d:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[c]});var m={x:e.dx,y:e.dy};m[{x:"y",y:"x"}[a.axis]]=0,Wn(a.dragGroup,m.x,m.y),g(a.frames,(function(e){var t,n,i=e.element,r=e.initialBounds;"e"===a.direction?_e(i,{width:jf(r.width+m.x,5)}):_e(i,{width:t=jf(r.width-m.x,5),x:r.x+r.width-t}),"s"===a.direction?_e(i,{height:jf(r.height+m.y,5)}):_e(i,{height:n=jf(r.height-m.y,5),y:r.y+r.height-n})}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,i=t.movingShapes,r=t.movingConnections,o=t.resizingShapes,a=t.line,s=t.dragGroup,c=t.frameGroup;g(i,(function(e){n.removeMarker(e,Bf)})),g(r,(function(e){n.removeMarker(e,Bf)})),s&&(Fe(a),Fe(s)),g(o,(function(e){n.removeMarker(e,Nf)})),c&&Fe(c)}))}Of.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Lf={__init__:["spaceToolPreview"],__depends__:[vp,xp,xf,Al,Jd],spaceTool:["type",Af],spaceToolPreview:["type",Of]};function $f(e,t){e.invoke(Af,this),this._canvas=t}$f.$inject=["injector","canvas"],e($f,Af),$f.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=C(dt(r.children.filter((e=>vr(e,"bpmn:Artifact"))),ht(o))));const s=[...e,...a];var c=Af.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter((function(e){return!vr(e,"bpmn:TextAnnotation")&&(!function(e){return vr(e,"bpmn:Participant")&&!gr(e).processRef}(e)||!("y"===t&&Lr(e)||"x"===t&&!Lr(e)))})),c};var If={__depends__:[Lf],spaceTool:["type",$f]};function Ff(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],(function(){this.clear(!1)}),this)}Ff.$inject=["eventBus","injector"],Ff.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Ff.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(void 0===r){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Ff.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},Ff.prototype.undo=function(){let e,t=this._getUndoAction();if(t){for(this._currentExecution.trigger="undo",this._pushAction(t);t&&(this._internalUndo(t),e=this._getUndoAction(),e&&e.id===t.id);)t=e;this._popAction()}},Ff.prototype.redo=function(){let e,t=this._getRedoAction();if(t){for(this._currentExecution.trigger="redo",this._pushAction(t);t&&(this._internalExecute(t,!0),e=this._getRedoAction(),e&&e.id===t.id);)t=e;this._popAction()}},Ff.prototype.register=function(e,t){this._setHandler(e,t)},Ff.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Ff.prototype.canUndo=function(){return!!this._getUndoAction()},Ff.prototype.canRedo=function(){return!!this._getRedoAction()},Ff.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Ff.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Ff.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},Ff.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const e of i)if(r=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return r},Ff.prototype._createId=function(){return this._uid++},Ff.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Ff.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Ff.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Ff.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:R("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Ff.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=p(e)?e:[e],t.dirty=t.dirty.concat(e))},Ff.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Ff.prototype._revertedAction=function(e){this._stackIdx--},Ff.prototype._getHandler=function(e){return this._handlerMap[e]},Ff.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var zf={commandStack:["type",Ff]};function Hf(e,t){if("function"!=typeof t)throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}function Vf(e,t,n){Do.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",1400,(function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=Gf(n),t.validatedShapes=Gf(i)})),i&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,r=[];g(n,(function(e){g(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||r.push(n),e.labelTarget&&r.push(e)}))})),g(r,(function(e){i.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,i=[];g(n,(function(e){g(e.labels,(function(e){n[e.id]||i.push(e)}))})),t.addAll(i)})),this.preExecute(["connection.delete","shape.delete"],(function(e){var t=e.context;Hf((t.connection||t.shape).labels,(function(e){n.removeShape(e,{nested:!0})}))})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=n.labelTarget;i&&(t.labelTargetIndex=xt(i.labels,n),t.labelTarget=i,n.labelTarget=null)})),this.revert("shape.delete",(function(e){var t=e.context,n=t.shape,i=t.labelTarget,r=t.labelTargetIndex;i&&(_t(i.labels,n,r),n.labelTarget=i)}))}function Gf(e){return y(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(Vf,Do),Vf.$inject=["injector","eventBus","modeling"];var Wf={__init__:["labelSupport"],labelSupport:["type",Vf]},Uf="attach-ok";function qf(e,t,n,i,r){Do.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",1401,(function(e){var t,n,i=e.context,r=i.shapes,o=i.validatedShapes;i.shapes=(n=Kf(t=r),P("id",t,n)),i.validatedShapes=function(e){var t=k(e,"id");return y(e,(function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}(o)})),o&&t.on("shape.move.start",251,(function(e){var t=e.context;g(Kf(t.shapes),(function(e){o.makeDraggable(t,e,!0),g(e.labels,(function(e){o.makeDraggable(t,e,!0)}))}))})),o&&t.on("shape.move.start",(function(e){var i=e.context.shapes;if(1===i.length){var r=i[0].host;r&&(n.addMarker(r,Uf),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(r,Uf)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;g(Kf(t.shapes),(function(e){n.add(e,n.topLevel[e.host.id])}))})),this.postExecuted("elements.move",(function(e){var t=e.context,n=t.shapes,i=t.newHost;i&&1!==n.length||g(i?n:y(n,(function(e){var t,i=e.host;return function(e){return!!e.host}(e)&&(t=i,!(-1!==n.indexOf(t)))})),(function(e){r.updateAttachment(e,i)}))})),this.postExecuted("elements.move",(function(e){g(e.context.shapes,(function(e){g(e.attachers,(function(e){g(e.outgoing.slice(),(function(e){i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)})),g(e.incoming.slice(),(function(e){i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,i=t.host;i&&r.updateAttachment(n,i)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,o=t.newShape;Hf(n.attachers,(function(e){"attach"===i.allowed("elements.move",{target:o,shapes:[e]})?r.updateAttachment(e,o):r.removeShape(e)})),o.attachers.length&&g(o.attachers,(function(e){var t=Uu(e,n,o);r.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,i=t.oldBounds,o=t.newBounds,a=n.attachers;!1!==(t.hints||{}).attachSupport&&g(a,(function(e){var t=Uu(e,i,o);r.moveShape(e,t,e.parent),g(e.labels,(function(e){r.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;Hf(t.attachers,(function(e){r.removeShape(e)})),t.host&&r.updateAttachment(t,null)}))}function Kf(e){return i(E(e,(function(e){return e.attachers||[]})))}e(qf,Do),qf.$inject=["injector","eventBus","canvas","rules","modeling"];var Yf={__depends__:[xp],__init__:["attachSupport"],attachSupport:["type",qf]};function Xf(e){this._model=e}function Zf(e,t,n){Do.call(this,e),this._bpmnFactory=t;var i=this;function r(e){g(e.context.oldRoot.children,(function(e){vr(e,"bpmn:BaseElement")&&i.updateParent(e)}))}function o(e){var t=e.context.shape;vr(t,"bpmn:BaseElement")&&i.updateBounds(t)}function a(e){i.updateConnection(e.context)}function s(e){i.updateConnectionWaypoints(e.context.connection)}function c(e){i.updateAttachment(e.context)}function p(e){const{element:n}=e.context,i=Ur(n),r=br(n),o=r&&r.get("label");zr(n)||Vo(n)||(i&&!o?r.set("label",t.create("bpmndi:BPMNLabel")):!i&&o&&r.set("label",void 0))}this.executed(["connection.layout","connection.create"],(function(e){var t,i=e.context,r=i.hints||{};i.cropped||!1===r.createElementsBehavior||((t=i.connection).waypoints=n.getCroppedWaypoints(t),i.cropped=!0)})),this.reverted(["connection.layout"],(function(e){delete e.context.cropped})),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Qf((function(e){var t=e.context;i.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Qf((function(e){var t=e.context,n=t.shape||t.connection,r=t.parent||t.newParent;i.updateParent(n,r)}))),this.executed(["canvas.updateRoot"],r),this.reverted(["canvas.updateRoot"],r),this.executed(["shape.move","shape.create","shape.resize"],Qf((function(e){"label"!==e.context.shape.type&&o(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],Qf((function(e){"label"!==e.context.shape.type&&o(e)}))),e.on("shape.changed",(function(e){"label"===e.element.type&&o({context:{shape:e.element}})})),this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Qf(a)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Qf(a)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Qf(s)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Qf(s)),this.executed("connection.reconnect",Qf((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=gr(n),a=gr(i),s=gr(r);o.conditionExpression&&!yr(s,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),i!==r&&a.default===o&&(t.oldDefault=a.default,delete a.default)}))),this.reverted("connection.reconnect",Qf((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=gr(n),a=gr(i),s=gr(r);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(a.default=t.oldDefault,delete s.default)}))),this.executed(["element.updateAttachment"],Qf(c)),this.reverted(["element.updateAttachment"],Qf(c)),this.executed("element.updateLabel",Qf(p)),this.reverted("element.updateLabel",Qf(p))}function Qf(e){return function(t){var n=t.context;vr(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function Jf(e,t){$n.call(this),this._bpmnFactory=e,this._moddle=t}function em(e,t,n){return void 0===t[n]?t:(e[n]=t[n],I(t,[n]))}function tm(e,t){this._modeling=e,this._canvas=t}function nm(e){this._modeling=e}function im(e,t){this._canvas=e,this._layouter=t}Xf.$inject=["moddle"],Xf.prototype._needsId=function(e){return yr(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Xf.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=vr(e,"bpmn:Activity")?"Activity":vr(e,"bpmn:Event")?"Event":vr(e,"bpmn:Gateway")?"Gateway":yr(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},Xf.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Xf.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Xf.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",L({bpmnElement:e,bounds:this.createDiBounds()},t))},Xf.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Xf.prototype.createDiWaypoints=function(e){var t=this;return E(e,(function(e){return t.createDiWaypoint(e)}))},Xf.prototype.createDiWaypoint=function(e){return this.create("dc:Point",$(e,["x","y"]))},Xf.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",L({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Xf.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",L({bpmnElement:e},t))},e(Zf,Do),Zf.$inject=["eventBus","bpmnFactory","connectionDocking"],Zf.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Zf.prototype.updateParent=function(e,t){if(!(cn(e)||vr(e,"bpmn:DataStoreReference")&&e.parent&&vr(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=br(e),o=n&&n.businessObject,a=br(n);vr(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),vr(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),vr(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(i,o),vr(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Zf.prototype.updateBounds=function(e){var t=br(e),n=function(e){if(!vr(e,"bpmn:Activity"))return;var t=br(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var i=Ha(n,t.get("bounds"));L(n,{x:e.x+i.x,y:e.y+i.y})}var r=cn(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),L(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Zf.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(vr(n,"bpmn:Lane")&&bt(n.get("flowNodeRef"),e),vr(t,"bpmn:Lane")&&_t(t.get("flowNodeRef"),e))},Zf.prototype.updateDiConnection=function(e,t,n){var i=br(e),r=br(t),o=br(n);i.sourceElement&&i.sourceElement.bpmnElement!==gr(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==gr(n)&&(i.targetElement=n&&o)},Zf.prototype.updateDiParent=function(e,t){if(t&&!vr(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(bt(n,e),e.$parent=null)}},Zf.prototype.getLaneSet=function(e){var t,n;return vr(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(vr(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},Zf.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&(!vr(e,"bpmn:DataInput")&&!vr(e,"bpmn:DataOutput")||(vr(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(vr(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(vr(e,"bpmn:FlowElement")){if(t)if(vr(t,"bpmn:Participant"))t=t.processRef;else if(vr(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(vr(t,"bpmn:Lane"));i="flowElements"}else if(vr(e,"bpmn:Artifact")){for(;t&&!vr(t,"bpmn:Process")&&!vr(t,"bpmn:SubProcess")&&!vr(t,"bpmn:Collaboration");){if(vr(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(vr(e,"bpmn:MessageFlow"))i="messageFlows";else if(vr(e,"bpmn:Participant")){i="participants";var r,o=e.processRef;o&&(r=function(e){for(;e&&!vr(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(bt(r.get("rootElements"),o),o.$parent=null),t&&(_t(r.get("rootElements"),o),o.$parent=r))}else vr(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":vr(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&bt(a=e.$parent.get(i),e),t?((a=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);bt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Zf.prototype.updateConnectionWaypoints=function(e){br(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Zf.prototype.updateConnection=function(e){var t,n=e.connection,i=gr(n),r=n.source,o=gr(r),a=n.target,s=gr(n.target);if(vr(i,"bpmn:DataAssociation"))vr(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=o,t=e.parent||e.newParent||s,this.updateSemanticParent(i,s,t)):vr(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,t),i.targetRef=s);else{var c=vr(i,"bpmn:SequenceFlow");i.sourceRef!==o&&(c&&(bt(i.sourceRef&&i.sourceRef.get("outgoing"),i),o&&o.get("outgoing")&&o.get("outgoing").push(i)),i.sourceRef=o),i.targetRef!==s&&(c&&(bt(i.targetRef&&i.targetRef.get("incoming"),i),s&&s.get("incoming")&&s.get("incoming").push(i)),i.targetRef=s)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,r,a)},Zf.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(Jf,$n),Jf.$inject=["bpmnFactory","moddle"],Jf.prototype._baseCreate=$n.prototype.create,Jf.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,L({type:"label",di:n},Fr,t))}return this.createElement(e,t)},Jf.prototype.createElement=function(e,t){var n,i,r,o=(t=L({},t||{})).businessObject,a=t.di;if(!o){if(!t.type)throw new Error("no shape type specified");dr(o=this._bpmnFactory.create(t.type))}if(!yr(a,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var c=L({},a||{},{id:o.id+"_di"});a="root"===e?this._bpmnFactory.createDiPlane(o,c):"connection"===e?this._bpmnFactory.createDiEdge(o,c):this._bpmnFactory.createDiShape(o,c)}return vr(o,"bpmn:Group")&&(t=L({isFrame:!0},t)),t=function(e,t,n){return g(n,(function(n){t=em(e,t,n)})),t}(o,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=em(a,t,"isExpanded")),yr(o,["bpmn:Lane","bpmn:Participant"])&&(t=em(a,t,"isHorizontal")),vr(o,"bpmn:SubProcess")&&(t.collapsed=!Or(o,a)),vr(o,"bpmn:ExclusiveGateway")&&(f(a,"isMarkerVisible")?void 0===a.isMarkerVisible&&(a.isMarkerVisible=!1):a.isMarkerVisible=!0),s(t.triggeredByEvent)&&(o.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),s(t.cancelActivity)&&(o.cancelActivity=t.cancelActivity,delete t.cancelActivity),t.eventDefinitionType&&(i=o.get("eventDefinitions")||[],r=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(r.condition=this._bpmnFactory.create("bpmn:FormalExpression")),i.push(r),r.$parent=o,o.eventDefinitions=i,delete t.eventDefinitionType),n=this.getDefaultSize(o,a),t=L({id:o.id},n,t,{businessObject:o,di:a}),this._baseCreate(e,t)},Jf.prototype.getDefaultSize=function(e,t){var n=gr(e);if(t=t||br(e),vr(n,"bpmn:SubProcess"))return Or(n,t)?{width:350,height:200}:{width:100,height:80};if(vr(n,"bpmn:Task"))return{width:100,height:80};if(vr(n,"bpmn:Gateway"))return{width:50,height:50};if(vr(n,"bpmn:Event"))return{width:36,height:36};if(vr(n,"bpmn:Participant")){var i=void 0===t.isHorizontal||!0===t.isHorizontal;return Or(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return vr(n,"bpmn:Lane")?{width:400,height:100}:vr(n,"bpmn:DataObjectReference")?{width:36,height:50}:vr(n,"bpmn:DataStoreReference")?{width:50,height:50}:vr(n,"bpmn:TextAnnotation")?{width:100,height:30}:vr(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Jf.prototype.createParticipantShape=function(e){return l(e)||(e={isExpanded:e}),!1!==(e=L({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},tm.$inject=["modeling","canvas"],tm.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;g(n,(function(e){var n={x:0,y:0};s(i.left)?n.x=i.left-e.x:s(i.right)?n.x=i.right-e.width-e.x:s(i.center)?n.x=i.center-Math.round(e.width/2)-e.x:s(i.top)?n.y=i.top-e.y:s(i.bottom)?n.y=i.bottom-e.height-e.y:s(i.middle)&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},tm.prototype.postExecute=function(e){},nm.$inject=["modeling"],nm.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},nm.prototype.postExecute=function(e){var t,n,i=e.hints||{};t=e.source,n=e.shape,w(t.outgoing,(function(e){return e.target===n}))||(i.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},im.$inject=["canvas","layouter"],im.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},im.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var rm=Math.round;function om(e){this._modeling=e}om.$inject=["modeling"],om.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;g(t,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var s=ht(y(t,(function(e){return!e.hidden})));g(t,(function(e){sn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:rm(e.x-s.x-s.width/2+r.x),y:rm(e.y-s.y-s.height/2+r.y)}}))),L(e,{x:rm(e.x-s.x-s.width/2+r.x),y:rm(e.y-s.y-s.height/2+r.y)})}));var c=st(t),p={};g(t,(function(e){if(sn(e))p[e.id]=u(i)?a.createConnection(p[e.source.id],p[e.target.id],i,e,e.parent||n,o):a.createConnection(p[e.source.id],p[e.target.id],e,e.parent||n,o);else{var t=L({},o);-1===c.indexOf(e)&&(t.autoResize=!1),cn(e)&&(t=I(t,["attach"])),p[e.id]=u(i)?a.createShape(e,$(e,["x","y","width","height"]),e.parent||n,i,t):a.createShape(e,$(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=C(p)};var am=Math.round;function sm(e){this._canvas=e}function cm(e){sm.call(this,e)}sm.$inject=["canvas"],sm.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?L(t,n):L(t,{x:n.x-am(t.width/2),y:n.y-am(t.height/2)}),this._canvas.addShape(t,i,r),t},sm.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(cm,sm),cm.$inject=["canvas"];var pm=sm.prototype.execute;cm.prototype.execute=function(e){var t=e.shape;return function(e){["width","height"].forEach((function(t){void 0===e[t]&&(e[t]=0)}))}(t),t.labelTarget=e.labelTarget,pm.call(this,e)};var lm=sm.prototype.revert;function um(e,t){this._canvas=e,this._modeling=t}function hm(e,t){this._modeling=e,this._elementRegistry=t}function dm(e,t){this._canvas=e,this._modeling=t}function fm(e){this._modeling=e}cm.prototype.revert=function(e){return e.shape.labelTarget=null,lm.call(this,e)},um.$inject=["canvas","modeling"],um.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Hf(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),Hf(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},um.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=xt(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},um.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,_t(n.children,t,i),this._canvas.addConnection(t,n),t},hm.$inject=["modeling","elementRegistry"],hm.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;g(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},dm.$inject=["canvas","modeling"],dm.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Hf(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),Hf(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),Hf(n.children,(function(e){sn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},dm.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=xt(i.children,n),t.removeShape(n),n},dm.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return _t(i.children,n,r),t.addShape(n,i),n},fm.$inject=["modeling"];var mm={x:"y",y:"x"};function vm(e,t){this._layouter=e,this._canvas=t}function ym(){}function gm(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function bm(e){this._modeling=e}function _m(e){this._helper=new bm(e)}function xm(e){this._modeling=e,this._helper=new bm(e)}function wm(e){this._modeling=e}function Em(e){return e.original||e}function Sm(e,t){this._modeling=e,this._rules=t}function Cm(e){this._modeling=e}function km(e){this._modeling=e}function Rm(e){return L({},e)}function Pm(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function Am(e,t,n){var i=Pm(n);return/e|s/.test(n)?e[i]>t:/n|w/.test(n)?e[i]<t:void 0}function Mm(e,t){return-1!==e.indexOf(t)}function Tm(e){this._modeling=e}function Dm(e){var t={};return g(e,(function(e){t[e.id]=e.hidden,e.children&&(t=L({},t,Dm(e.children)))})),t}function Bm(e,t){var n=[];return g(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(Bm(e.children,e.collapsed||t)))})),n}function Nm(e,t){var n=[];return g(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Nm(e.children,t)))})),n}function jm(e){this._modeling=e}function Om(e,t){return bt(e&&e.attachers,t)}function Lm(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),_t(i,t,n)}}function $m(){}function Im(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",(function(){i.registerHandlers(n)}))}function Fm(e){this._elementRegistry=e}function zm(e,t){g(t,(function(t,n){e.set(n,t)}))}fm.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(e,t){e.range.min=Math.min(t[i],e.range.min),e.range.max=Math.max(t[i]+t[r],e.range.max)}function a(e){return e[i]+e[r]/2}function s(e){return e.length-1}function c(e){return e.max-e.min}var p,l,u=n[0],h=s(n),d=n[h],f=0;g(n,(function(e,p){var l,u,d;e.elements.length<2?p&&p!==n.length-1&&(o(e,e.elements[0]),f+=c(e.range)):(u=(l=A(e.elements,i))[0],p===h&&(u=l[s(l)]),d=a(u),e.range=null,g(l,(function(n){!function(e,n){var r={y:0};r[i]=e-a(n),r[i]&&(r[mm[i]]=0,t.moveElements([n],r,n.parent))}(d,n),null!==e.range?o(e,n):e.range={min:n[i],max:n[i]+n[r]}})),p&&p!==n.length-1&&(f+=c(e.range)))})),l=Math.abs(d.range.min-u.range.max),(p=Math.round((l-f)/(n.length-1)))<n.length-1||g(n,(function(e,o){var a,s={};e!==u&&e!==d&&(a=n[o-1],e.range.max=0,g(e.elements,(function(n,o){s[mm[i]]=0,s[i]=a.range.max-n[i]+p,e.range.min!==n[i]&&(s[i]+=n[i]-e.range.min),s[i]&&t.moveElements([n],s,n.parent),e.range.max=Math.max(n[i]+n[r],o?e.range.max:0)})))}))},fm.prototype.postExecute=function(e){},vm.$inject=["layouter","canvas"],vm.prototype.execute=function(e){var t=e.connection;return L(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},vm.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},ym.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=bt(o.children,t),_t(i.children,t,r),t.parent=i,g(t.waypoints,(function(e){e.x+=n.x,e.y+=n.y,e.original&&(e.original.x+=n.x,e.original.y+=n.y)})),t},ym.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return bt(n.children,t),_t(i.children,t,r),t.parent=i,g(t.waypoints,(function(e){e.x-=o.x,e.y-=o.y,e.original&&(e.original.x-=o.x,e.original.y-=o.y)})),t},gm.prototype.add=function(e,t){return this.addAll([e],t)},gm.prototype.addAll=function(e,t){var n=function(e,t,n){a(t)&&(t=!0),l(t)&&(n=t,t=!0);var i=vt((n=n||{}).allShapes),r=vt(n.allConnections),o=vt(n.enclosedElements),s=vt(n.enclosedConnections),c=vt(n.topLevel,t&&k(e,(function(e){return e.id})));function p(e){c[e.source.id]&&c[e.target.id]&&(c[e.id]=[e]),i[e.source.id]&&i[e.target.id]&&(s[e.id]=o[e.id]=e),r[e.id]=e}return lt(e,(function(e){if(o[e.id]=e,!e.waypoints)return i[e.id]=e,g(e.incoming,p),g(e.outgoing,p),e.children;s[e.id]=r[e.id]=e})),{allShapes:i,allConnections:r,topLevel:c,enclosedConnections:s,enclosedElements:o}}(e,!!t,this);return L(this,n),this},bm.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},bm.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,p=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),g(a,(function(e){o.moveShape(e,t,p[e.id]&&!l&&n,{recurse:!1,layout:!1})})),g(s,(function(e){var i=!!a[e.source.id],r=!!a[e.target.id];c[e.id]&&i&&r?o.moveConnection(e,t,p[e.id]&&!l&&n):o.layoutConnection(e,{connectionStart:i&&eh(e,e.source,t),connectionEnd:r&&th(e,e.target,t)})}))},bm.prototype.getClosure=function(e){return(new gm).addAll(e,!0)},_m.$inject=["modeling"],_m.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},_m.prototype.postExecute=function(e){var t,n=e.hints;n&&n.primaryShape&&(t=n.primaryShape,n.oldParent=t.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,t)},xm.$inject=["modeling"],xm.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=$(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=bt(o.children,t),_t(i.children,t,r),L(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},xm.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(g(t.incoming,(function(e){r.layoutConnection(e,{connectionEnd:th(e,t,n)})})),g(t.outgoing,(function(e){r.layoutConnection(e,{connectionStart:eh(e,t,n)})}))),!1!==i.recurse&&this.moveChildren(e)},xm.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return _t(n.children,t,i),L(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},xm.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},xm.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},wm.$inject=["modeling"],wm.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return p(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},wm.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||i&&"source"!==o.docking||(a.connectionStart=a.connectionStart||Em(p(r)?r[0]:r)),!i||n&&"target"!==o.docking||(a.connectionEnd=a.connectionEnd||Em(p(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},wm.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r},Sm.$inject=["modeling","rules"],Sm.prototype.preExecute=function(e){var t,n=this,i=this._modeling,r=this._rules,o=e.oldShape,a=e.newData,s=e.hints||{};function c(e,t,n){return r.allowed("connection.reconnect",{connection:n,source:e,target:t})}var p,l={x:a.x,y:a.y},u={x:o.x,y:o.y,width:o.width,height:o.height};t=e.newShape=e.newShape||n.createShape(a,l,o.parent,s),o.host&&i.updateAttachment(t,o.host),!1!==s.moveChildren&&(p=o.children.slice(),i.moveElements(p,{x:0,y:0},t,s));var h=o.incoming.slice(),d=o.outgoing.slice();g(h,(function(e){c(e.source,t,e)&&n.reconnectEnd(e,t,Ju(e,t,u),s)})),g(d,(function(e){var i=e.target;c(t,i,e)&&n.reconnectStart(e,t,Qu(e,t,u),s)}))},Sm.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Sm.prototype.execute=function(e){},Sm.prototype.revert=function(e){},Sm.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Sm.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Sm.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)},Cm.$inject=["modeling"],Cm.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},L(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Cm.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds;!1!==(e.hints||{}).layout&&(g(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:Ju(e,n,i)})})),g(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:Qu(e,n,i)})})))},Cm.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return L(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},km.$inject=["modeling"],km.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),g(r,(function(e){a[e.id]=function(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}(e)})),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(function(e,t){var n=[];return g(e.concat(t),(function(i){var r=i.incoming,o=i.outgoing;g(r.concat(o),(function(i){var r=i.source,o=i.target;(wf(e,r)||wf(e,o)||wf(t,r)||wf(t,o))&&(wf(n,i)||n.push(i))}))})),n}(i,r),t,n,o,i,r,a)},km.prototype.execute=function(){},km.prototype.revert=function(){},km.prototype.moveShapes=function(e,t){var n=this;g(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},km.prototype.resizeShapes=function(e,t,n){var i=this;g(e,(function(e){var r=function(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}(e,n,t);i._modeling.resizeShape(e,r,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},km.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=r.concat(o);g(e,(function(e){var p=e.source,l=e.target,u=function(e){return E(e.waypoints,(function(e){return(e=Rm(e)).original&&(e.original=Rm(e.original)),e}))}(e),h=Pm(n),d={};Mm(c,p)&&Mm(c,l)?(u=E(u,(function(e){return Am(e,i,n)&&(e[h]=e[h]+t[h]),e.original&&Am(e.original,i,n)&&(e.original[h]=e.original[h]+t[h]),e})),s._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(Mm(c,p)||Mm(c,l))&&(Mm(r,p)?d.connectionStart=eh(e,p,t):Mm(r,l)?d.connectionEnd=th(e,l,t):Mm(o,p)?d.connectionStart=Qu(e,p,a[p.id]):Mm(o,l)&&(d.connectionEnd=Ju(e,l,a[l.id])),s._modeling.layoutConnection(e,d))}))},Tm.$inject=["modeling"],Tm.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Dm(n),t.collapsed=!t.collapsed;var i=Bm(n,t.collapsed);return[t].concat(i)},Tm.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=Nm(t.children,n);return t.collapsed=!t.collapsed,[t].concat(i)},jm.$inject=["modeling"],jm.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Om(i,t),Lm(n,t),t.host=n,t},jm.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Om(n,t),Lm(i,t,r),t},$m.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},$m.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},Im.$inject=["eventBus","elementFactory","commandStack"],Im.prototype.getHandlers=function(){return{"shape.append":nm,"shape.create":sm,"shape.delete":dm,"shape.move":xm,"shape.resize":Cm,"shape.replace":Sm,"shape.toggleCollapse":Tm,spaceTool:km,"label.create":cm,"connection.create":im,"connection.delete":um,"connection.move":ym,"connection.layout":vm,"connection.updateWaypoints":$m,"connection.reconnect":wm,"elements.create":om,"elements.move":_m,"elements.delete":hm,"elements.distribute":fm,"elements.align":tm,"element.updateAttachment":jm}},Im.prototype.registerHandlers=function(e){g(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},Im.prototype.moveShape=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},Im.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Im.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,a=n;!0===o?(r=n,a=n.parent):!1===o&&(r=null);var s={shapes:e,delta:t,newParent:a,newHost:r,hints:i};this._commandStack.execute("elements.move",s)},Im.prototype.moveConnection=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},Im.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Im.prototype.createConnection=function(e,t,n,i,r,o){"object"==typeof n&&(o=r,r=i,i=n,n=void 0);var a={source:e,target:t,parent:r,parentIndex:n,connection:i=this._create("connection",i),hints:o};return this._commandStack.execute("connection.create",a),a.connection},Im.prototype.createShape=function(e,t,n,i,r){"number"!=typeof i&&(r=i,i=void 0);var o,a,s=(r=r||{}).attach;e=this._create("shape",e),s?(o=n.parent,a=n):o=n;var c={position:t,shape:e,parent:o,parentIndex:i,host:a,hints:r};return this._commandStack.execute("shape.create",c),c.shape},Im.prototype.createElements=function(e,t,n,i,r){p(e)||(e=[e]),"number"!=typeof i&&(r=i,i=void 0);var o={position:t,elements:e,parent:n,parentIndex:i,hints:r=r||{}};return this._commandStack.execute("elements.create",o),o.elements},Im.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},Im.prototype.appendShape=function(e,t,n,i,r){r=r||{};var o={source:e,position:n,target:i,shape:t=this._create("shape",t),connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},Im.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Im.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Im.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Im.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Im.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Im.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Im.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Im.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},Im.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Im.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},Im.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,L(i,{docking:"source"}))},Im.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,L(i,{docking:"target"}))},Im.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Im.prototype._create=function(e,t){return t instanceof Dn?t:this._elementFactory.create(e,t)},Im.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},Fm.$inject=["elementRegistry"],Fm.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||function(e,t){return _(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,S(i));return zm(n,i),e.oldProperties=o,e.changed=r,r},Fm.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return zm(n,t),i},Fm.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return vr(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return vr(t,"bpmn:DataObjectReference")&&gr(t).dataObjectRef===e}))}(e,t):[]};var Hm="default",Vm="id",Gm="di",Wm={width:0,height:0};function Um(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}function qm(e,t){return Vm in e&&e[Vm]!==t[Vm]}function Km(e,t){var n=e.businessObject,i=br(e);g(t,(function(e,t){t!==Gm?n.set(t,e):i&&function(e,t){g(t,(function(t,n){e.set(n,t)}))}(i,e)}))}Um.$inject=["elementRegistry","moddle","modeling","textRenderer"],Um.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=function(e){var t=L({},e);return Ym.forEach((function(n){n in e&&(t[n]=gr(t[n]))})),t}(e.properties),s=e.oldProperties||function(e,t){var n=S(t),i=e.businessObject,r=br(e);return _(n,(function(e,n){return e[n]=n!==Gm?i.get(n):function(e,t){return _(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(r,S(t.di)),e}),{})}(t,a);return qm(a,o)&&(r.unclaim(o[Vm]),i.updateId(t,a[Vm]),r.claim(a[Vm],o)),Hm in a&&(a[Hm]&&n.push(i.get(a[Hm].id)),o[Hm]&&n.push(i.get(o[Hm].id))),Km(t,a),e.oldProperties=s,e.changed=n,n},Um.prototype.postExecute=function(e){var t=e.element.label,n=t&&gr(t).name;if(n){var i=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,i,Wm)}},Um.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Km(t,i),qm(n,r)&&(a.unclaim(n[Vm]),o.updateId(t,i[Vm]),a.claim(i[Vm],r)),e.changed};var Ym=["default"];function Xm(e,t){this._canvas=e,this._modeling=t}function Zm(e,t){this._modeling=e,this._spaceTool=t}function Qm(e){this._modeling=e}function Jm(e,t){this._modeling=e,this._spaceTool=t}Xm.$inject=["canvas","modeling"],Xm.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=br(r);return t.setRootElement(n),t.removeRootElement(r),_t(a.rootElements,i),i.$parent=a,bt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Xm.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=br(n);return t.setRootElement(r),t.removeRootElement(n),bt(a.rootElements,i),i.$parent=null,_t(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]},Zm.$inject=["modeling","spaceTool"],Zm.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=mu(i),a=o===i,s=a?i:i.parent,c=fu(s),p=Lr(i);if(p?"left"===r?r="top":"right"===r&&(r="bottom"):"top"===r?r="left":"bottom"===r&&(r="right"),!c.length){var l=p?{x:i.x+hu,y:i.y,width:i.width-hu,height:i.height}:{x:i.x,y:i.y+hu,width:i.width,height:i.height-hu};n.createShape({type:"bpmn:Lane",isHorizontal:p},l,s)}var u,h,d,f,m,v=[];lt(o,(function(e){return v.push(e),e.label&&v.push(e.label),e===i?[]:y(e.children,(function(e){return e!==i}))})),"top"===r?(u=-120,d=(h=i.y)+10,f="n",m="y"):"left"===r?(u=-120,d=(h=i.x)+10,f="w",m="x"):"bottom"===r?(u=120,d=(h=i.y+i.height)-10,f="s",m="y"):"right"===r&&(u=120,d=(h=i.x+i.width)-10,f="e",m="x");var g=t.calculateAdjustments(v,m,u,d),b=p?{x:0,y:u}:{x:u,y:0};t.makeSpace(g.movingShapes,g.resizingShapes,b,f,d);var _=p?{x:i.x+(a?hu:0),y:h-("top"===r?120:0),width:i.width-(a?hu:0),height:120}:{x:h-("left"===r?120:0),y:i.y+(a?hu:0),width:120,height:i.height-(a?hu:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:p},_,s)},Qm.$inject=["modeling"],Qm.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=fu(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a,s,c,p,l=Lr(n),u=l?n.height:n.width,h=Math.round(u/i);for(p=0;p<i;p++)a=p===i-1?u-h*p:h,s=l?{x:n.x+hu,y:n.y+p*h,width:n.width-hu,height:a}:{x:n.x+p*h,y:n.y+hu,width:a,height:n.height-hu},p<o?t.resizeShape(r[p],s):(c={type:"bpmn:Lane",isHorizontal:l},t.createShape(c,s,n))},Jm.$inject=["modeling","spaceTool"],Jm.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Jm.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=vu(e,t);n.resizeShape(e,t),i.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},Jm.prototype.resizeSpace=function(e,t){var n,i,r,o,a,s=this._spaceTool,c=un(e),p=ou(un(t),c),l=mu(e),u=[],h=[];lt(l,(function(e){return u.push(e),(vr(e,"bpmn:Lane")||vr(e,"bpmn:Participant"))&&h.push(e),e.children})),(p.bottom||p.top)&&(n=p.bottom||p.top,i=e.y+(p.bottom?e.height:0)+(p.bottom?-10:10),r=p.bottom?"s":"n",o=p.top>0||p.bottom<0?-n:n,a=s.calculateAdjustments(u,"y",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:0,y:n},r)),(p.left||p.right)&&(n=p.right||p.left,i=e.x+(p.right?e.width:0)+(p.right?-10:100),r=p.right?"e":"w",o=p.left>0||p.right<0?-n:n,a=s.calculateAdjustments(h,"x",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:n,y:0},r))};var ev="flowNodeRef",tv="lanes";function nv(e){this._elementRegistry=e}function iv(e){this._moddle=e}nv.$inject=["elementRegistry"],nv.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(e){-1===n.indexOf(e)&&(o.push(e),n.push(e))}function s(e){if(!e.parent)return[];var t=function(e){var t=mu(e);return r[t.id]||(r[t.id]=du(t)),r[t.id]}(e);return t.filter((function(t){return n=e,i=un(t),r=n.x+n.width/2,o=n.y+n.height/2,r>i.left&&r<i.right&&o>i.top&&o<i.bottom;var n,i,r,o})).map((function(e){return e.businessObject}))}return t.forEach((function(e){var t=mu(e);if(t&&-1===n.indexOf(t)){var i=t.children.filter((function(e){return vr(e,"bpmn:FlowNode")}));i.forEach(a),n.push(t)}})),e.forEach(a),o.forEach((function(e){var t=e.businessObject,n=t.get(tv).slice(),r=s(e);i.push({flowNode:t,remove:n,add:r})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(ev).forEach((function(e){i.push({flowNode:e,remove:[t],add:[]})}))})),i},nv.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach((function(e){var t=e.flowNode,n=t.get(tv);e.remove.forEach((function(e){bt(n,e),bt(e.get(ev),t)})),e.add.forEach((function(e){_t(n,e),_t(e.get(ev),t)}))})),[]},nv.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(tv);e.add.forEach((function(e){bt(n,e),bt(e.get(ev),t)})),e.remove.forEach((function(e){_t(n,e),_t(e.get(ev),t)}))})),[]},iv.$inject=["moddle"],iv.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;return e.claiming?t.claim(n,i):t.unclaim(n),[]},iv.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element;return e.claiming?t.unclaim(n):t.claim(n,i),[]};var rv={fill:void 0,stroke:void 0};function ov(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(d(e)){var t=function(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="transparent",t.fillStyle=e,/^#[0-9a-fA-F]{6}$/.test(t.fillStyle)?t.fillStyle:null}(e);if(t)return t}throw new Error(`invalid color value: ${e}`)}}}ov.$inject=["commandStack"],ov.prototype.postExecute=function(e){var t=e.elements,n=e.colors||rv,i=this,r={};"fill"in n&&L(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&L(r,{"border-color":this._normalizeColor(n.stroke)}),g(t,(function(e){var t=sn(e)?$(r,["border-color"]):r,n=br(e);if(function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),cn(e))i._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:r["border-color"]}});else{if(!yr(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var av={width:0,height:0};function sv(e,t,n){function i(e,t){var n=e.label||e,i=e.labelTarget||e;return function(e,t){var n=e.businessObject,i=Wr(n);if(i)if("categoryValueRef"===i){if(!n[i])return e;n[i].value=t}else n[i]=t}(n,t),[n,i]}this.preExecute=function(t){var n=t.element,i=n.businessObject,r=t.newLabel;if(!cn(n)&&zr(n)&&!Hr(n)&&!cv(r)){var o=Gr(n);o={x:o.x,y:o.y+7},e.createLabel(n,o,{id:i.id+"_label",businessObject:i,di:n.di})}},this.execute=function(e){return e.oldLabel=Ur(e.element),i(e.element,e.newLabel)},this.revert=function(e){return i(e.element,e.oldLabel)},this.postExecute=function(n){var i=n.element,r=i.label||i,o=n.newLabel,a=n.newBounds,s=n.hints||{};if(cn(r)||vr(r,"bpmn:TextAnnotation"))if(cn(r)&&cv(o))!1!==s.removeShape&&e.removeShape(r,{unsetLabel:!1});else{var c=Ur(i);void 0===a&&(a=t.getExternalLabelBounds(r,c)),a&&e.resizeShape(r,a,av)}}}function cv(e){return!e||!e.trim()}function pv(e,t,n,i){Im.call(this,e,t,n),this._bpmnRules=i}function lv(){}sv.$inject=["modeling","textRenderer","bpmnFactory"],e(pv,Im),pv.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],pv.prototype.getHandlers=function(){var e=Im.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Fm,e["element.updateProperties"]=Um,e["canvas.updateRoot"]=Xm,e["lane.add"]=Zm,e["lane.resize"]=Jm,e["lane.split"]=Qm,e["lane.updateRefs"]=nv,e["id.updateClaim"]=iv,e["element.setColor"]=ov,e["element.updateLabel"]=sv,e},pv.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},pv.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,i)},pv.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},pv.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},pv.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},pv.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},pv.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},pv.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pv.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pv.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},pv.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},pv.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},pv.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},lv.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||fn(t.source||e.source),t.connectionEnd||fn(t.target||e.target)]};var uv=Math.round,hv={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function dv(e,t,n){var i,r,o,a=mn(t,e,5),s=n.split(":")[0],c=uv((t.x-e.x)/2+e.x),p=uv((t.y-e.y)/2+e.y),l=(o=a,{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[s].test(o)),u=/h|r|l/.test(s),h=!1,d=!1;return l?(i=u?{x:c,y:e.y}:{x:e.x,y:p},r=u?"h:h":"v:v"):(h=function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(a,s),r=u?"h:v":"v:h",h?u?(d=p===e.y,i={x:e.x+20*(/l/.test(s)?-1:1),y:d?p+20:p}):i={x:(d=c===e.x)?c+20:c,y:e.y+20*(/t/.test(s)?-1:1)}:i={x:c,y:p}),{waypoints:mv(e,i,r).concat(i),directions:r,turnNextDirections:d}}function fv(e){return e.split(":").reverse().join(":")}function mv(e,t,n){if(!function(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}(n=n||"h:h"))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(_v(n)){var i=function(e,t,n){return dv(e,t,n)}(e,t,n),r=function(e,t,n){var i=dv(t,e,fv(n));return{waypoints:i.waypoints.slice().reverse(),directions:fv(i.directions),turnNextDirections:i.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(i="h"==i?"v":"h");var r=n+":"+i;return{waypoints:mv(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return function(e,t,n){var i=uv((t.x-e.x)/2+e.x),r=uv((t.y-e.y)/2+e.y);if("h:v"===n)return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:i,y:e.y},{x:i,y:t.y}];if("v:v"===n)return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function vv(e,t,n,i,r){var o=b(r&&r.preferredLayouts||[],"straight")[0]||"h:h",a=mn(e,t,hv[o]||0),s=function(e,t){if(_v(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}(a,o);n=n||fn(e),i=i||fn(t);var c=s.split(":"),p=xv(n,e,c[0],function(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}(a));return function(e,t,n){var i=mv(e,t,n);return i.unshift(e),i.push(t),wv(i)}(p,xv(i,t,c[1],a),s)}function yv(e,t,n,i,r,o){var a;return p(n)&&(r=n,o=i,n=fn(e),i=fn(t)),r=r||[],a=-1!==(o=L({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,i,r){var o,a,s={};if(a=mn(e,t),!/^(top|bottom|left|right)$/.test(a))return null;/top|bottom/.test(a)&&(o="x");/left|right/.test(a)&&(o="y");return"target"===r.preserveDocking?gv(o,i,e)?(s[o]=i[o],[{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y,original:{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y}},{x:i.x,y:i.y}]):null:gv(o,n,t)?(s[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y,original:{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y}}]):null}(e,t,n,i,o),a||(a=o.connectionEnd&&function(e,t,n,i){var r=i.slice().reverse();return r=bv(e,t,n,r),r?r.reverse():null}(t,e,i,r),a||((a=o.connectionStart&&bv(e,t,n,r))||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:vv(e,t,n,i,o))))}function gv(e,t,n){return function(e,t,n){return e>=t&&e<=n}(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function bv(e,t,n,i){if(function(e){return e.length<3||!(e.length>4)&&!!m(e,(function(t,n){var i=e[n-1];return i&&wt(t,i)<3}))}(i))return null;var r,o=i[0],a=i.slice();return a[0]=n,a[1]=function(e,t,n){switch(St(t,e)){case"v":return{x:n.x,y:e.y};case"h":return{x:e.x,y:n.y}}return{x:e.x,y:e.y}}(a[1],o,n),r=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(kt(e[i],t,20)||kt(e[i],n,20))return e.slice(i);return e}(a,e,t),r!==a&&(a=bv(e,t,n,r)),a&&St(a)?null:a}function _v(e){return e&&/t|r|b|l/.test(e)}function xv(e,t,n,i){if("h"===n&&(n=/left/.test(i)?"l":"r"),"v"===n&&(n=/top/.test(i)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function wv(e){return e.reduce((function(t,n,i){return Et(t[t.length-1],e[i+1],n,0)||t.push(n),t}),[])}var Ev={default:["h:h"],fromGateway:["v:h"],toGateway:["h:v"],loop:{fromTop:["t:r"],fromRight:["r:b"],fromLeft:["l:t"],fromBottom:["b:l"]},boundaryLoop:{alternateHorizontalSide:"b",alternateVerticalSide:"l",default:"v"},messageFlow:["straight","v:v"],subProcess:["straight","h:h"],isHorizontal:!0},Sv={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},Cv={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},kv={top:"t",right:"r",bottom:"b",left:"l"};function Rv(e){this._elementRegistry=e}function Pv(e,t){return vr(t,"bpmn:Participant")?"source":vr(e,"bpmn:Participant")?"target":Dv(t)?"source":Dv(e)||vr(t,"bpmn:Event")?"target":vr(e,"bpmn:Event")?"source":null}function Av(e){return Dv(e)?"target":"source"}function Mv(e,t){return e?e.original||e:fn(t)}function Tv(e,t){return vr(t,"bpmn:Activity")&&vr(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Dv(e){return vr(e,"bpmn:SubProcess")&&Or(e)}function Bv(e,t){return e===t}function Nv(e){var t=/right|left/.exec(e);return t&&t[0]}function jv(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ov(e,t){return Cv[e]===t}function Lv(e){return"right"===e||"left"===e}function $v(e,t,n){var i=t.waypoints,r=i&&i.length&&mn(i[0],e);return"top"===r?n.loop.fromTop:"right"===r?n.loop.fromRight:"left"===r?n.loop.fromLeft:n.loop.fromBottom}function Iv(e,t,n,i){var r,o,a,s,c=fn(e),p=fn(t),l=(s=(a=e).host,mn(fn(a),s,-10)),u=Bv(e.host,t),h=-1!==["top","right","bottom","left"].indexOf(l),d=mn(p,c,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?function(e,t,n,i,r,o){var a,s=t?e:o.isHorizontal?jv(e):Nv(e),c=kv[s];a=t?Lv(e)?Fv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:Fv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:o.boundaryLoop.default;return[c+":"+a]}(l,h,e,t,n,i):(r=function(e,t,n,i){if(n)return kv[e];var r=jv(e),o=Nv(e),a=jv(t),s=Nv(t);if(i){if(Bv(r,a)||Ov(o,s))return kv[r]}else if(Bv(o,s)||Ov(r,a))return kv[o];return kv[i?o:r]}(l,d,h,i.isHorizontal),o=function(e,t,n,i){if(n)return Lv(e)?function(e,t){var n=Nv(e),i=Cv[n];return-1!==t.indexOf(i)}(e,t)||Bv(e,t)?"h":"v":function(e,t){var n=jv(e),i=Cv[n];return-1!==t.indexOf(i)}(e,t)||Bv(e,t)?"v":"h";return i?Bv(jv(e),jv(t))?"h":"v":Bv(Nv(e),Nv(t))?"v":"h"}(l,d,h,i.isHorizontal),[r+":"+o])}function Fv(e,t,n,i){return!(zv(e,i,n,40)||zv(e,i,{x:n.x+n.width,y:n.y+n.height},40)||zv(e,i,fn(t),40))}function zv(e,t,n,i){return Math.abs(t[e]-n[e])<i}function Hv(e){return L({original:e.point.original||e.point},e.actual)}function Vv(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(Rv,lv),Rv.prototype.layoutConnection=function(e,t){t||(t={});var n,i,r=t.source||e.source,o=t.target||e.target,a=t.waypoints||e.waypoints,s=t.connectionStart,c=t.connectionEnd,p=this._elementRegistry;if(s||(s=Mv(a&&a[0],r)),c||(c=Mv(a&&a[a.length-1],o)),(vr(e,"bpmn:Association")||vr(e,"bpmn:DataAssociation"))&&a&&!Tv(r,o))return[].concat([s],a.slice(1,-1),[c]);var l=ep(r,p)?Ev:Sv;return vr(e,"bpmn:MessageFlow")?n=function(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:Pv(e,t)}}(r,o,l):(vr(e,"bpmn:SequenceFlow")||Tv(r,o))&&(n=r===o?{preferredLayouts:$v(r,e,l)}:vr(r,"bpmn:BoundaryEvent")?{preferredLayouts:Iv(r,o,c,l)}:Dv(r)||Dv(o)?{preferredLayouts:l.subProcess,preserveDocking:Av(r)}:vr(r,"bpmn:Gateway")?{preferredLayouts:l.fromGateway}:vr(o,"bpmn:Gateway")?{preferredLayouts:l.toGateway}:{preferredLayouts:l.default}),n&&(i=wv(yv(r,o,s,c,a,n=L(n,t)))),i||[s,c]},Rv.$inject=["elementRegistry"],Vv.$inject=["elementRegistry","graphicsFactory"],Vv.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(Hv(i)),o.push(Hv(r)),o},Vv.prototype.getDockingPoint=function(e,t,n){var i,r,o=e.waypoints;return{point:r=o[i=n?0:o.length-1],actual:this._getIntersection(t,e,n)||r,idx:i}},Vv.prototype._getIntersection=function(e,t,n){return vn(this._getShapePath(e),this._getConnectionPath(t),n)},Vv.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Vv.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Vv.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Gv={__init__:["modeling","bpmnUpdater"],__depends__:[ed,Nd,Od,Id,bf,zf,Wf,Yf,_a,To,If],bpmnFactory:["type",Xf],bpmnUpdater:["type",Zf],elementFactory:["type",Jf],modeling:["type",pv],layouter:["type",Rv],connectionDocking:["type",Vv]};const Wv=Math.round;function Uv(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Uv.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,p=this._rules,l=o.createShape(L({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;L(l,{x:u.x-Wv(l.width/2),y:u.y-Wv(l.height/2)});const h=p.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let d=null;h&&(d=o.createConnection(h),d.waypoints=s.layoutConnection(d,{source:e,target:l}),d.waypoints=r.getCroppedWaypoints(d,e,l)),i.create({created:[l,d].filter((e=>!c(e)))})},Uv.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Uv.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var qv={__depends__:[rp,Dl,Gv],__init__:["appendPreview"],appendPreview:["type",Uv]},Kv=Math.min,Yv=Math.max;function Xv(e){e.preventDefault()}function Zv(e){e.stopPropagation()}function Qv(e){this.container=e.container,this.parent=he('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=fe("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=O(this.autoResize,this),this.handlePaste=O(this.handlePaste,this)}function Jv(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Qv({container:t.getContainer(),keyHandler:O(this._handleKey,this),resizeHandler:O(this._handleResize,this)})}Qv.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,a=this.container;i=this.options=i||{};var s=$(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);L(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},s);var c=$(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return L(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},c),i.centerVertically&&L(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},c),o.innerText=n,oe.bind(o,"keydown",this.keyHandler),oe.bind(o,"mousedown",Zv),oe.bind(o,"paste",this.handlePaste),i.autoResize&&oe.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),a.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},Qv.prototype.handlePaste=function(e){var t,n=this.options,i=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var r=this.autoResize(i);r&&this.resizeHandler(r)}},Qv.prototype.insertText=function(e){e=e.replace(/\r\n|\r|\n/g,"\n"),document.execCommand("insertText",!1,e)||this._insertTextIE(e)},Qv.prototype._insertTextIE=function(e){var t,n,i,r=this.getSelection(),o=r.startContainer,a=r.endContainer,s=r.startOffset,c=r.endOffset,p=r.commonAncestorContainer,l=(t=p.childNodes,[].slice.call(t));if(function(e){return e.nodeType===Node.TEXT_NODE}(p)){var u=o.textContent;o.textContent=u.substring(0,s)+e+u.substring(c),n=o,i=s+e.length}else if(o===this.content&&a===this.content){var h=document.createTextNode(e);this.content.insertBefore(h,l[s]),n=h,i=h.textContent.length}else{var d=l.indexOf(o),f=l.indexOf(a);l.forEach((function(t,n){n===d?t.textContent=o.textContent.substring(0,s)+e+a.textContent.substring(c):n>d&&n<=f&&ve(t)})),n=o,i=s+e.length}n&&void 0!==i&&setTimeout((function(){self.setSelection(n,i)}))},Qv.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},Qv.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){var s,c,p,l;n=this.resizeHandle=he('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){Xv(n),Zv(n);var u=Kv(Yv(p+n.clientX-s,i),o),h=Kv(Yv(l+n.clientY-c,r),a);t.style.width=u+"px",t.style.height=h+"px",e.resizeHandler({width:p,height:l,dx:n.clientX-s,dy:n.clientY-c})},h=function(e){Xv(e),Zv(e),oe.unbind(document,"mousemove",u,!1),oe.unbind(document,"mouseup",h,!1)};oe.bind(n,"mousedown",(function(e){Xv(e),Zv(e),s=e.clientX,c=e.clientY;var n=t.getBoundingClientRect();p=n.width,l=n.height,oe.bind(document,"mousemove",u),oe.bind(document,"mouseup",h)}))}L(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Qv.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),oe.unbind(t,"keydown",this.keyHandler),oe.unbind(t,"mousedown",Zv),oe.unbind(t,"input",this.autoResize),oe.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),ve(n)),ve(e)},Qv.prototype.getValue=function(){return this.content.innerText.trim()},Qv.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Qv.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)},Jv.$inject=["eventBus","canvas"],Jv.prototype.registerProvider=function(e){this._providers.push(e)},Jv.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},Jv.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Jv.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Jv.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0,this._canvas.restoreFocus&&this._canvas.restoreFocus()},Jv.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue();r===e.context.text&&i.height===n.height&&i.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},Jv.prototype.getValue=function(){return this._textbox.getValue()},Jv.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;return 27===t?(e.preventDefault(),this.cancel()):13!==t||e.shiftKey?void 0:(e.preventDefault(),this.complete())},Jv.prototype._handleResize=function(e){this._fire("resize",e)},Jv.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=m(this._providers,(function(n){return(t=n.activate(e))?n:null}));return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};var ey={__depends__:[da],__init__:["directEditing"],directEditing:["type",Jv]};var ty=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],ny=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}}],iy=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message intermediate catch event",actionName:"replace-with-message-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message intermediate throw event",actionName:"replace-with-message-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer intermediate catch event",actionName:"replace-with-timer-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation intermediate throw event",actionName:"replace-with-escalation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional intermediate catch event",actionName:"replace-with-conditional-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Link intermediate catch event",actionName:"replace-with-link-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},{label:"Link intermediate throw event",actionName:"replace-with-link-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},{label:"Compensation intermediate throw event",actionName:"replace-with-compensation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal intermediate catch event",actionName:"replace-with-signal-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal intermediate throw event",actionName:"replace-with-signal-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],ry=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message end event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Escalation end event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Error end event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel end event",actionName:"replace-with-cancel-end",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Compensation end event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal end event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Terminate end event",actionName:"replace-with-terminate-end",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}],oy=[{label:"Exclusive gateway",actionName:"replace-with-exclusive-gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},{label:"Parallel gateway",actionName:"replace-with-parallel-gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},{label:"Inclusive gateway",actionName:"replace-with-inclusive-gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},{label:"Complex gateway",actionName:"replace-with-complex-gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},{label:"Event-based gateway",actionName:"replace-with-event-based-gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}}],ay=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Ad-hoc sub-process",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],sy=[{label:"Sub-process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Ad-hoc sub-process (collapsed)",actionName:"replace-with-collapsed-ad-hoc-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}}],cy=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Sub-process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Ad-hoc sub-process",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}}],py=cy,ly=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"User task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Service task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{label:"Send task",actionName:"replace-with-send-task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},{label:"Receive task",actionName:"replace-with-receive-task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},{label:"Manual task",actionName:"replace-with-manual-task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},{label:"Business rule task",actionName:"replace-with-rule-task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},{label:"Script task",actionName:"replace-with-script-task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},{label:"Call activity",actionName:"replace-with-call-activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},{label:"Sub-process (expanded)",actionName:"replace-with-expanded-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Ad-hoc sub-process (collapsed)",actionName:"replace-with-collapsed-ad-hoc-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},{label:"Ad-hoc sub-process (expanded)",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}}],uy=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],hy=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],dy=[{label:"Message boundary event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},{label:"Timer boundary event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},{label:"Escalation boundary event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},{label:"Conditional boundary event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},{label:"Error boundary event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},{label:"Cancel boundary event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},{label:"Signal boundary event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},{label:"Compensation boundary event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},{label:"Message boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-message-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},{label:"Timer boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},{label:"Escalation boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},{label:"Conditional boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},{label:"Signal boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}}],fy=[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},{label:"Message start event (non-interrupting)",actionName:"replace-with-non-interrupting-message-start",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},{label:"Timer start event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-start",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},{label:"Conditional start event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-start",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},{label:"Signal start event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-start",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},{label:"Escalation start event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-start",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}}],my=[{label:"Sequence flow",actionName:"replace-with-sequence-flow",className:"bpmn-icon-connection"},{label:"Default flow",actionName:"replace-with-default-flow",className:"bpmn-icon-default-flow"},{label:"Conditional flow",actionName:"replace-with-conditional-flow",className:"bpmn-icon-conditional-flow"}],vy=[{label:"Expanded pool/participant",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t},actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}],yy={"bpmn:MessageEventDefinition":[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message intermediate catch event",actionName:"replace-with-message-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message intermediate throw event",actionName:"replace-with-message-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message end event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}}],"bpmn:TimerEventDefinition":[{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Timer intermediate catch event",actionName:"replace-with-timer-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}}],"bpmn:ConditionalEventDefinition":[{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Conditional intermediate catch event",actionName:"replace-with-conditional-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}}],"bpmn:SignalEventDefinition":[{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal intermediate catch event",actionName:"replace-with-signal-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal intermediate throw event",actionName:"replace-with-signal-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal end event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],"bpmn:ErrorEventDefinition":[{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Error end event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}}],"bpmn:EscalationEventDefinition":[{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Escalation intermediate throw event",actionName:"replace-with-escalation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Escalation end event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}}],"bpmn:CompensateEventDefinition":[{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Compensation intermediate throw event",actionName:"replace-with-compensation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Compensation end event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}}]},gy={"start-event-non-interrupting":'\n <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">\n <g transform="translate(0 995.64)">\n <path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>\n </g>\n </svg>',"intermediate-event-non-interrupting":'\n <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">\n <g transform="translate(0 995.64)" fill="none" stroke="currentColor" stroke-linecap="round">\n <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>\n <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>\n </g>\n </svg>'};function by(e,t,n,i,r,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}by.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],by.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},by.prototype.getPopupMenuEntries=function(e){var t,n=e.businessObject,i=this._rules,r=[],o=[];if(p(e)||!i.allowed("shape.replace",{element:e}))return{};var a,s=(a=e,function(e){var t=e.target,n=gr(a),i=n.eventDefinitions&&n.eventDefinitions[0],r=n.$type===t.type,o=(i&&i.$type)===t.eventDefinitionType,s=!!t.triggeredByEvent==!!n.triggeredByEvent,c=void 0===t.isExpanded||t.isExpanded===Or(a);return!(r&&o&&s&&c)});return vr(n,"bpmn:DataObjectReference")?this._createEntries(e,uy):vr(n,"bpmn:DataStoreReference")&&!vr(e.parent,"bpmn:Collaboration")?this._createEntries(e,hy):(vr(n,"bpmn:Event")&&!vr(n,"bpmn:BoundaryEvent")&&(t=n.get("eventDefinitions")[0]?.$type,r=yy[t]||[],!$r(n.$parent)&&vr(n.$parent,"bpmn:SubProcess")&&(r=y(r,(function(e){return"bpmn:StartEvent"!==e.target.type})))),vr(n,"bpmn:StartEvent")&&!vr(n.$parent,"bpmn:SubProcess")?(o=y(ty.concat(r),s),this._createEntries(e,o)):vr(n,"bpmn:Participant")?(o=y(vy,(function(t){return Or(e)!==t.target.isExpanded})),this._createEntries(e,o)):vr(n,"bpmn:StartEvent")&&$r(n.$parent)?(o=y(fy.concat(r),(function(e){var t=!1!==e.target.isInterrupting,i=n.isInterrupting===t;return s(e)||!s(e)&&!i})),this._createEntries(e,o)):vr(n,"bpmn:StartEvent")&&!$r(n.$parent)&&vr(n.$parent,"bpmn:SubProcess")?(o=y(ny.concat(r),s),this._createEntries(e,o)):vr(n,"bpmn:EndEvent")?(o=y(ry.concat(r),(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!vr(n.$parent,"bpmn:Transaction"))&&s(e)})),this._createEntries(e,o)):vr(n,"bpmn:BoundaryEvent")?(o=y(dy,(function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinitionType&&!vr(n.attachedToRef,"bpmn:Transaction"))return!1;var i=!1!==t.cancelActivity,r=n.cancelActivity==i;return s(e)||!s(e)&&!r})),this._createEntries(e,o)):vr(n,"bpmn:IntermediateCatchEvent")||vr(n,"bpmn:IntermediateThrowEvent")?(o=y(iy.concat(r),s),this._createEntries(e,o)):vr(n,"bpmn:Gateway")?(o=y(oy,s),this._createEntries(e,o)):vr(n,"bpmn:Transaction")?(o=y(cy,s),this._createEntries(e,o)):$r(n)&&Or(e)?(o=y(py,s),this._createEntries(e,o)):vr(n,"bpmn:AdHocSubProcess")&&Or(e)?(o=y(sy,s),this._createEntries(e,o)):vr(n,"bpmn:SubProcess")&&Or(e)?(o=y(ay,s),this._createEntries(e,o)):vr(n,"bpmn:SubProcess")&&!Or(e)?(o=y(ly,(function(t){return t.target.type===e.type===(!0===t.target.isExpanded)})),this._createEntries(e,o)):vr(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,my):vr(n,"bpmn:FlowNode")?(o=y(ly,s),this._createEntries(e,o)):{})},by.prototype.getPopupMenuHeaderEntries=function(e){var t={};return vr(e,"bpmn:Activity")&&!$r(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),vr(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),vr(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),ch(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},by.prototype._createEntries=function(e,t){var n={},i=this;return g(t,(function(t){n[t.actionName]=i._createEntry(t,e)})),n},by.prototype._createSequenceFlowEntries=function(e,t){var n=gr(e),i={},r=this._modeling,o=this._moddle,a=this;return g(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(vr(n.sourceRef,"bpmn:ExclusiveGateway")||vr(n.sourceRef,"bpmn:InclusiveGateway")||vr(n.sourceRef,"bpmn:ComplexGateway")||vr(n.sourceRef,"bpmn:Activity"))&&(i={...i,[t.actionName]:a._createEntry(t,e,(function(){r.updateProperties(e.source,{default:n})}))});break;case"replace-with-conditional-flow":!n.conditionExpression&&vr(n.sourceRef,"bpmn:Activity")&&(i={...i,[t.actionName]:a._createEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:t})}))});break;default:vr(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[t.actionName]:a._createEntry(t,e,(function(){r.updateProperties(e,{conditionExpression:void 0})}))}),(vr(n.sourceRef,"bpmn:ExclusiveGateway")||vr(n.sourceRef,"bpmn:InclusiveGateway")||vr(n.sourceRef,"bpmn:ComplexGateway")||vr(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[t.actionName]:a._createEntry(t,e,(function(){r.updateProperties(e.source,{default:void 0})}))})}})),i},by.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=e.label;return o&&"function"==typeof o&&(o=o(t)),n=n||function(){return r(t,e.target)},{label:i(o),className:e.className,action:n}},by.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(n,i){if(i.active)t._modeling.updateProperties(e,{loopCharacteristics:void 0});else{var r=e.businessObject.get("loopCharacteristics");r&&vr(r,i.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,r,{isSequential:i.options.isSequential}):(r=t._moddle.create(i.options.loopCharacteristics,{isSequential:i.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:r}))}}var r,o,a,s=gr(e).loopCharacteristics;return s&&(r=s.isSequential,o=void 0===s.isSequential,a=void 0!==s.isSequential&&!s.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:r,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},by.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:function(n,r){t._modeling.updateModdleProperties(e,i,{isCollection:!r.active})}}}},by.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:function(i,r){var o;r.active||(o=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:o})}}}},by.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=gr(e),i=this,r=ph(e),o=vr(e,"bpmn:BoundaryEvent")?gy["intermediate-event-non-interrupting"]:gy["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};var _y={__depends__:[Lc,bf,rp],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",by]};function xy(e,t,n,i,r,o,a,s,c,p,l,u,h){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=p,this._rules=l,this._translate=u,this._eventBus=n,this._appendPreview=h,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(ca(e)&&i.isOpen(t)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})),n.on("contextPad.close",(function(){h.cleanUp()}))}function wy(e,t,n){var i=e.$instanceOf(t),r=!1;return g(e.eventDefinitions||[],(function(e){e.$type===n&&(r=!0)})),i&&r}xy.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],xy.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&L(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},xy.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return p(t)?x(e,(e=>t.includes(e))):t},xy.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,p=this._appendPreview,l={};if("label"===e.type)return this._isDeleteAllowed([e])&&L(l,f()),l;var u=e.businessObject;function h(e,t){r.start(e,t)}function d(e,t){n.removeElements([t])}function f(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function m(e,t,n,r){function a(t,n){var a=i.createShape(L({type:e},r));o.start(t,a,{source:n})}var c=s?function(t,n){var o=i.createShape(L({type:e},r));s.append(n,o)}:a,l=s?function(t,n){return p.create(n,e,r),()=>{p.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:a,click:c,hover:l}}}function v(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(yr(u,["bpmn:Lane","bpmn:Participant"])&&Or(e)){var y=fu(e);L(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),y.length<2&&((Lr(e)?e.height>=120:e.width>=120)&&L(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:v(2)}}}),(Lr(e)?e.height>=180:e.width>=180)&&L(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:v(3)}}})),L(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}return vr(u,"bpmn:FlowNode")&&(vr(u,"bpmn:EventBasedGateway")?L(l,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):wy(u,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?L(l,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):vr(u,"bpmn:EndEvent")||u.isForCompensation||wy(u,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||$r(u)||L(l,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||L(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(e,n){var i=L(function(e){var n=t.getPad(e).html.getBoundingClientRect();return{x:n.left,y:n.bottom+5}}(n),{cursor:{x:e.x,y:e.y}});a.open(n,"bpmn-replace",i,{title:c("Change element"),width:300,search:!0})}}}}),vr(u,"bpmn:SequenceFlow")&&L(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),yr(u,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&L(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:h,dragstart:h}}}),vr(u,"bpmn:TextAnnotation")&&L(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:h,dragstart:h}}}),yr(u,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&L(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:h,dragstart:h}}}),vr(u,"bpmn:Group")&&L(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&L(l,f()),l};var Ey={__depends__:[qv,ey,vs,_a,wl,Zd,_y],__init__:["contextPadProvider"],contextPadProvider:["type",xy]},Sy={horizontal:["x","width"],vertical:["y","height"]};function Cy(e,t){this._modeling=e,this._filters=[],this.registerFilter((function(e){var n=t.allowed("elements.distribute",{elements:e});return p(n)?n:n?e:[]}))}Cy.$inject=["modeling","rules"],Cy.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Cy.prototype.trigger=function(e,t){var n,i,r=this._modeling;if(!(e.length<3||(this._setOrientation(t),i=this._filterElements(e),(n=this._createGroups(i)).length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},Cy.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(g(t,(function(e){r=e(r,n,i)})),r):e},Cy.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');return g(A(e,i),(function(e,o){var a,s=n._findRange(e,i,r),c=t[t.length-1];c&&n._hasIntersection(c.range,s)?t[t.length-1].elements.push(e):(a={range:s,elements:[e]},t.push(a))})),t},Cy.prototype._setOrientation=function(e){var t=Sy[e];this._axis=t[0],this._dimension=t[1]},Cy.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Cy.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var ky={__init__:["distributeElements"],distributeElements:["type",Cy]};functio 194 `,this._current.container)},jc.prototype.open=function(e,t,n,i){if(!e)throw new Error("Element is missing");if(!t)throw new Error("No registered providers for: "+t);if(!n)throw global() class [all...] |
/plugin/dirtylittlehelper/script/ |
H A D | mermaid.min.js | 1 …Cy(){var t=Ty(ry());return t.copy=function(){return ny(t,Cy()).exponent(t.exponent())},jp.apply(t,… function
|
/plugin/diagramsnet/lib/js/mermaid/ |
H A D | mermaid.min.js | 6 …Cy(){var t=Ty(ry());return t.copy=function(){return ny(t,Cy()).exponent(t.exponent())},jp.apply(t,… function
|
/plugin/flowcharts/ |
H A D | mermaid.min.js | 1 …Cy=new Date,Dy=new Date;function Ly(t,e,n,r){function i(e){return t(e=0===arguments.length?new Dat…
|
/plugin/aichat/vendor/mehrab-wj/tiktoken-php/data/ |
H A D | vocab.bpe |
|
/plugin/bpmnio/vendor/dmn-js/dist/ |
H A D | dmn-modeler.production.min.js | 192 /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */var hy=(ly||(ly=1,function(e,t){var n;n=void 0!==sy?sy:uy,e.exports=function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,n=String(e),i=n.length,o=-1,r="",s=n.charCodeAt(0);++o<i;)0!=(t=n.charCodeAt(o))?r+=t>=1&&t<=31||127==t||0==o&&t>=48&&t<=57||1==o&&t>=48&&t<=57&&45==s?"\\"+t.toString(16)+" ":0==o&&1==i&&45==t||!(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?"\\"+n.charAt(o):n.charAt(o):r+="�";return r};return e.CSS||(e.CSS={}),e.CSS.escape=t,t}(n)}(cy)),cy.exports),dy=ay(hy),py=function(e,t){return e^t};var fy=/\b(Array|Date|Object|Math|JSON)\b/g,gy=function(e,t){var n=function(e){for(var t=[],n=0;n<e.length;n++)~t.indexOf(e[n])||t.push(e[n]);return t}(function(e){return e.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(fy,"").match(/[a-zA-Z_]\w*/g)||[]}(e));return t&&"string"==typeof t&&(t=function(e){return function(t){return e+t}}(t)),t?function(e,t,n){var i=/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g;return e.replace(i,(function(e){return"("==e[e.length-1]||~t.indexOf(e)?n(e):e}))}(e,n,t):n};var my=vy;function vy(e,t){if(!(this instanceof vy))return new vy(e,t);if(this.node=this.start=this.peeked=e,this.root=t,this.closingTag=!1,this._revisit=!0,this._selects=[],this._rejects=[],e&&this.higher(e))throw new Error("root must be a parent or ancestor to node")}function yy(e,t){var n="nextSibling"==e;return function(i,o,r){i=this.compile(i),o=o&&o>0?o:1;for(var s=this.node,a=this.closingTag,l=this._revisit;s;){if(py(n,a)&&s[t])s=s[t],a=!n;else if(1==s.nodeType&&!s[t]&&py(n,a)){if(a=n,!l)continue}else if(s[e])s=s[e],a=!n;else if(s=s.parentNode,a=n,!l)continue;if(!s||this.higher(s,this.root))break;if(i(s)&&this.selects(s,r)&&this.rejects(s,r)){if(--o)continue;return r||(this.node=s),this.closingTag=a,s}}return null}}vy.prototype.reset=function(e){return this.node=e||this.start,this},vy.prototype.revisit=function(e){return this._revisit=null==e||e,this},vy.prototype.opening=function(){return 1==this.node.nodeType&&(this.closingTag=!1),this},vy.prototype.atOpening=function(){return!this.closingTag},vy.prototype.closing=function(){return 1==this.node.nodeType&&(this.closingTag=!0),this},vy.prototype.atClosing=function(){return this.closingTag},vy.prototype.next=yy("nextSibling","firstChild"),vy.prototype.previous=vy.prototype.prev=yy("previousSibling","lastChild"),vy.prototype.select=function(e){return e=this.compile(e),this._selects.push(e),this},vy.prototype.selects=function(e,t){var n=this._selects,i=n.length;if(!i)return!0;for(var o=0;o<i;o++)if(n[o].call(this,e,t))return!0;return!1},vy.prototype.reject=function(e){return e=this.compile(e),this._rejects.push(e),this},vy.prototype.rejects=function(e,t){var n=this._rejects,i=n.length;if(!i)return!0;for(var o=0;o<i;o++)if(n[o].call(this,e,t))return!1;return!0},vy.prototype.higher=function(e){var t=this.root;if(!t)return!1;for(e=e.parentNode;e&&e!=t;)e=e.parentNode;return e!=t},vy.prototype.compile=function(e){switch(typeof e){case"number":return function(t){return e==t.nodeType};case"string":return new Function("node","return "+gy(e,"node."));case"function":return e;default:return function(){return!0}}},vy.prototype.peak=vy.prototype.peek=function(e,t){return 1==arguments.length&&(t=e,e=!0),(t=null==t?1:t)?t>0?this.next(e,t,!0):this.prev(e,Math.abs(t),!0):this.node},vy.prototype.use=function(e){return e(this),this};var xy=window.getSelection();function by(e){xy.removeAllRanges(),xy.addRange(e)}function _y(e,t){var n=function(e,t){var n,i=t.start,o=t.end,r=document.createRange(),s=my(e.firstChild,e),a=s.node,l=!1,c=0;for(;a;){if(c===i&&(l?r.setStartAfter(a):r.setStartBefore(a)),c===o)return l?r.setEndAfter(a):r.setEndBefore(a),r;if(l||(Oy(a)||a.previousSibling&&(ky(a)||Ey(a)))&&c++,Cy(a)){if(n=a.textContent.length,c<=i&&c+n>i&&r.setStart(a,i-c),c+n>o)return r.setEnd(a,o-c),r;c+=n}a=s.next(),l=s.closingTag}c<=i&&(e.lastChild?r.setStartAfter(e.lastChild):r.setStart(e,0));e.lastChild?r.setEndAfter(e.lastChild):r.setEnd(e,0);return r}(e,t);by(n)}function wy(e){if(!function(e){if(!xy.rangeCount)return null;var t=xy.focusNode;return Cy(t)&&(t=t.parentNode),e==t||e.contains(t)}(e))return null;var t,n,i=xy.getRangeAt(0),o=i.startContainer,r=i.endContainer,s=i.startOffset,a=i.endOffset,l=my(e.firstChild,e),c=l.node,u=!1,h=0;function d(e,t){return 1===arguments.length&&(t=e),e.parentNode===r&&t==r.childNodes[a]}function p(e,t){return 1===arguments.length&&(t=e),e.parentNode===o&&t==o.childNodes[s]}for(;c&&(p(c)&&(n=h),!d(c));){if(u||(Oy(c)||t&&t.nextSibling==c&&(ky(c)||Ey(c)))&&h++,Cy(c)){if(o===c&&(n=h+s),r===c){h+=a;break}h+=c.textContent.length}if((Cy(c)||u)&&(p(c,c.nextSibling)&&(n=h),d(c,c.nextSibling)))break;t=c,c=l.next(),u=l.closingTag}return{start:void 0===n?h:n,end:h}}function Cy(e){return 3===e.nodeType}function Oy(e){return 1===e.nodeType&&"BR"===e.nodeName}function ky(e){return 1===e.nodeType&&"DIV"===e.nodeName}function Ey(e){return 1===e.nodeType&&"P"===e.nodeName}const Sy="[contenteditable]",Ry="[data-element-id]";function Ty(e){return e.getAttribute("data-element-id")}function My(e,t){return Zt(`[data-element-id="${dy(e)}"]`,t)}function Ay(e){return Bt(e,Ry,!0)}function Py(e){const t=Sy;return Yt(e,t)?e:Zt(t,e)}const Dy={above:!0,below:!0,right:!0,left:!0};function $y(e,t,n,i,o){const{container:r}=e;let s=null;function a(e,n){t.fire("selection."+e+".changed",n),t.fire("cellSelection.changed",{elementId:e,selection:n})}function l(e,t=!0){s!==e&&a(s,{selected:!1,focussed:!1}),s=e,e&&a(e,{selected:!0,focussed:t}),e?i.select(e):i.deselect()}t.on("cell.click",500,(function(e){const t=e.target;if(function(e){return Bt(e,".no-deselect",!0)}(t))return;const n=Ay(t);l(n&&Ty(n),!e.defaultPrevented)})),t.on("cell.focusin",500,(function(e){const t=Ty(e.target),n=!e.defaultPrevented;return e.stopPropagation(),l(t,n)})),t.on("cell.focusout",500,(function(e){a(Ty(e.target),{focussed:!1})})),t.on("cellSelection.changed",(function(e){const{elementId:t,selection:n}=e,i=My(t,r);n.focussed&&i&&function(e){const t=Py(e);if(!t)return;if(!document.body.contains(t))return;if(document.activeElement===t)return;t.focus();const n=wy(t);n&&0!==n.end||window.getSelection().setPosition(t.firstChild,t.firstChild.length)}(i)})),t.on("selection.changed",(function(e){const{selection:t,oldSelection:n}=e;var i=t&&t.id,o=n&&n.id;i&&i!==s?l(t.id):o&&o===s&&l()})),this.isCellSelected=function(){return!!s},this.getCellSelection=function(){return s},this.selectCell=function(e){if(!s)return;if(!(e in Dy))throw new Error("direction must be any of { above, below, left, right }");const t=function(e){const t=e.getAttribute("data-coords");if(!t)return null;const[n,i]=t.split(":");return{row:n,col:i}}(My(s,r));if(!t)return!1;const n=function(e,t){const{row:n,col:i}=e;if("above"===t||"below"===t){const o=parseInt(n,10);if(isNaN(o))return e;return{col:i,row:"above"===t?o-1:o+1}}if("left"===t||"right"===t){const o=parseInt(i,10);if(isNaN(o))return e;return{row:n,col:"left"===t?o-1:o+1}}throw new Error("invalid direction <"+t+">")}(t,e),i=function(e,t){const n=`${e.row}:${e.col}`;return Zt(`[data-coords="${dy(n)}"]`,t)}(n,r);if(!i)return!1;const o=Ty(i);return o&&l(o,{focussed:!0,selected:!0}),!0},t.on("contextMenu.close",(function(){if(s)return l(s)}))}$y.$inject=["config.renderer","eventBus","sheet","selection","elementRegistry"];var jy={__depends__:[ry,ny],__init__:["cellSelection"],cellSelection:["type",$y]};function Iy(){}Iy.prototype.get=function(){return this._data},Iy.prototype.set=function(e){this._data=e},Iy.prototype.clear=function(){var e=this._data;return delete this._data,e},Iy.prototype.isEmpty=function(){return!this._data};var By={clipboard:["type",Iy]};const Ly=2e3;class Ny extends zp{constructor(e,t){super(e),this._sheet=t}init(){this.addRule("col.move",Ly,(({col:e,index:t})=>{const{businessObject:n}=this._sheet.getRoot(),{input:i}=n;return dn(e)?t<i.length:t>=i.length})),this.addRule("col.remove",Ly,(({col:e})=>{const{cols:t}=this._sheet.getRoot();return!pn(e)||t.filter((e=>pn(e))).length>1})),this.addRule("paste",Ly,(({data:e,target:t})=>{if(!e||!t)return!1;const{root:n}=e;return t instanceof Nm?this.canPasteRows(n):t instanceof qm&&this.canPasteCols(n,t)}))}canPasteRows(e){const{cols:t}=this._sheet.getRoot();return g(e,(e=>"row"===e.type&&(e.cells.length===t.length&&g(e.cells,((e,n)=>dn(t[n])?"dmn:UnaryTests"===e.businessObject.$type:"dmn:LiteralExpression"===e.businessObject.$type)))))}canPasteCols(e,t){const{rows:n}=this._sheet.getRoot();return g(e,(e=>"col"===e.type&&(e.cells.length===n.length&&(dn(t)?"dmn:InputClause"===e.businessObject.$type:"dmn:OutputClause"===e.businessObject.$type))))}}Ny.$inject=["eventBus","sheet"];var qy={__depends__:[{__depends__:[gc]}],__init__:["decisionTableModelingRules"],decisionTableModelingRules:["type",Ny]};class Vy{constructor(e,t,n){this._clipboard=e,this._modeling=t,this._sheet=n}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((e=>{e instanceof Nm?this._modeling.removeRow(e):e instanceof qm&&this._modeling.removeCol(e)}))}revert(e){const{oldData:t}=e;return this._clipboard.set(t),this._sheet.getRoot()}}Vy.$inject=["clipboard","modeling","sheet"];const Fy=[function(e,t,n,i){var o=n,r={...t,type:Wy(e)};if(e instanceof Nm||e instanceof qm){let t=i(e.cells,o);r.cells=t.root,o=t.descriptorCache}return{root:r,descriptorCache:o}},function(e,t,n){var i=e.businessObject;if(!i)return{root:t,descriptorCache:n};var o=Uy(i,n);return{root:{...t,businessObject:o.root},descriptorCache:o.descriptorCache}}],zy=[function(e,t,n){var i=e.root.businessObject;if(!i)return{root:t,reviveCache:n};var o=Gy({root:i,descriptorCache:e.descriptorCache},n);return{root:{...t,businessObject:o.root},reviveCache:o.reviveCache}},function(e,t,n,i){var o=e.root,r=e.descriptorCache,s={...t};t.businessObject&&t.businessObject.id&&(s.id=t.businessObject.id);if("row"===o.type||"col"===o.type){let e=i({root:o.cells,descriptorCache:r},n);s.cells=e.root,n=e.reviveCache}var a=new(function(e){switch(e.type){case"row":return Nm;case"cell":return Vm;case"col":return qm;default:throw new Error("unknown element type: #"+e.type)}}(o))(s);a instanceof Nm?a.cells.forEach((e=>{e.row=a})):a instanceof qm&&a.cells.forEach((e=>{e.col=a}));return{root:a,reviveCache:n}}];function Qy(e,t,n){return n=n||Fy,t=t||{},r(e)?function(e,t,n){return f(e,((e,t)=>{var i=e.descriptorCache,o=e.root;let{root:r,descriptorCache:s}=Hy(t,i,n);return{root:[...o,r],descriptorCache:{...i,...s}}}),{root:[],descriptorCache:t})}(e,t,n):Hy(e,t,n)}function Hy(e,t,n){var i=e.id,o={id:i},r=t.elements||{},s=r[i];if(s)return{root:s,descriptorCache:t};let a=function(e,t,n,i){function o(e,t){return Qy(e,t,n)}return f(n,(function(t,n){return n(e,t.root,t.descriptorCache,o)}),{root:t,descriptorCache:i})}(e,o,n,{...t,elements:r});return{root:a.root,descriptorCache:{...a.descriptorCache,elements:{...a.descriptorCache.elements,[i]:a.root}}}}function Wy(e){if(e instanceof Nm)return"row";if(e instanceof qm)return"col";if(e instanceof Vm)return"cell";throw new Error("cannot deduce element type: #"+e.id)}function Uy(e,t){var n,i,o=e.id;if(o&&(i=(n=t.boCache||{})[o]))return{root:i,descriptorCache:t};var s={$type:e.$type};return o&&(s.id=o,n={...n,[o]:s},t={...t,boCache:n}),e.$descriptor.properties.forEach((function(n){var i=e[n.name];if(i){if(r(i)&&(i=i.map((e=>{var n=Uy(e,t);return t=n.descriptorCache,n.root}))),i.$type){let e=Uy(i,t);t=e.descriptorCache,i=e.root}s[n.name]=i}})),{root:s,descriptorCache:t}}function Xy(e,t,n){return n=n||zy,t=t||{},r(e.root)?function(e,t,n){let i=e.root,o=e.descriptorCache;return f(i,((e,t)=>{var i=e.reviveCache,r=e.root;let{root:s,reviveCache:a}=Ky({root:t,descriptorCache:o},i,n);return{root:[...r,s],reviveCache:a}}),{root:[],reviveCache:t})}(e,t,n):Ky(e,t,n)}function Ky(e,t,n){var i=e.root.id,o=t.elements||{},r=o[i];if(r)return{root:r,reviveCache:t};let s=function(e,t,n,i){function o(e,t){return Xy(e,t,n)}return f(n,(function(t,n){return n(e,t.root,t.reviveCache,o)}),{root:t,reviveCache:i})}(e,{id:i},n,{...t,elements:o});return{root:s.root,reviveCache:{...s.reviveCache,elements:{...s.reviveCache.elements,[i]:s.root}}}}function Gy(e,t){var n=e.root,i=n.id;let o,s;if(i&&(o=t.boCache||{},s=o[i],s))return{root:s,reviveCache:t};var a={};y(n).forEach((e=>{let i,s;n[e].$type?(s=Gy({root:n[e]},t),i=s.root,t=s.reviveCache,o=t.boCache||{}):i=r(n[e])?n[e].map((e=>(s=Gy({root:e},t),t=s.reviveCache,o=t.boCache||{},s.root))):n[e],a[e]=i}));const l=a.$type;delete a.$type,t._keepIds&&!t._model.ids.assigned(a.id)||delete a.id;var c=t._dmnFactory.create(l,a);return p(a,(e=>{e.$type&&(e.$parent=c),r(e)&&e.forEach((e=>e.$parent=c))})),i&&(o={...o,[i]:c},t={...t,boCache:o}),{root:c,reviveCache:t}}class Yy{constructor(e,t,n,i,o,r,s,a){this._clipboard=e,this._dmnFactory=t,this._elementFactory=n,this._elementRegistry=i,this._eventBus=o,this._model=r,this._modeling=s,this._sheet=a}postExecute(e){let{element:t,after:n}=e;const i=this._clipboard.get();if(!i)throw new Error("missing clipboard data");const o=this._sheet.getRoot(),r=Xy(i.elements,{_dmnFactory:this._dmnFactory,_keepIds:i.keepIds,_model:this._model}).root;if(t instanceof Nm){let e=o.rows.indexOf(t);if(-1===e)return;r.forEach((t=>{n&&e++,this._modeling.addRow(t,e)}))}else if(t instanceof qm){let e=o.cols.indexOf(t);if(-1===e)return;r.forEach((t=>{n&&e++,this._modeling.addCol(t,e)}))}return e.oldElements=this._clipboard.get(),this._sheet.getRoot()}revert(e){}}Yy.$inject=["clipboard","dmnFactory","elementFactory","elementRegistry","eventBus","moddle","modeling","sheet"];class Zy{constructor(e,t,n,i,o,r){this._clipboard=e,this._commandStack=t,this._eventBus=n,this._modeling=i,this._sheet=o,this._rules=r,t.registerHandler("cut",Vy),t.registerHandler("paste",Yy)}copy(e){r(e)||(e=[e]);const t={elements:Qy(e)};this._eventBus.fire("copyCutPaste.copy",{data:t}),this._clipboard.set(t)}cut(e){r(e)||(e=[e]);const t={elements:Qy(e),keepIds:!0},n={elements:e,data:t};this._eventBus.fire("copyCutPaste.cut",{data:t}),this._commandStack.execute("cut",n)}pasteBefore(e){return this._paste(e,{before:!0})}pasteAfter(e){return this._paste(e,{after:!0})}_paste(e,t){const n=this._clipboard.get();if(!n)return;return!!this._rules.allowed("paste",{data:n.elements,target:e})&&(this._commandStack.execute("paste",{element:e,...t}),this._clipboard.clear(),!0)}pasteAt(e){}}Zy.$inject=["clipboard","commandStack","eventBus","modeling","sheet","rules"];var Jy={__depends__:[By,qy],__init__:["copyCutPaste"],copyCutPaste:["type",Zy]};class ex{constructor(e,t,n,i,o,r){const s={addRule:()=>n.addRow({type:"dmn:DecisionRule"}),addRuleAbove(e){let t=e&&e.rule;if(!t&&!i.hasSelection())return;t=t||i.get().row;const o=r.getRoot().rows.indexOf(t);return-1!==o?n.addRow({type:"dmn:DecisionRule"},o):void 0},addRuleBelow(e){let t=e&&e.rule;if(!t&&!i.hasSelection())return;t=t||i.get().row;const o=r.getRoot().rows.indexOf(t);return-1!==o?n.addRow({type:"dmn:DecisionRule"},o+1):void 0},removeRule(e){let t=e&&e.rule;(t||i.hasSelection())&&(t=t||i.get().row,n.removeRow(t))},addInput(){const e=r.getRoot().businessObject,{input:t}=e;return n.addCol({type:"dmn:InputClause"},t?t.length:0)},addInputLeft(e){let t=e&&e.input;if(!t&&!i.hasSelection())return;t=t||i.get().col;const o=r.getRoot().cols.indexOf(t);return-1!==o?n.addCol({type:"dmn:InputClause"},o):void 0},addInputRight(e){let t=e&&e.input;if(!t&&!i.hasSelection())return;t=t||i.get().col;const o=r.getRoot().cols.indexOf(t);return-1!==o?n.addCol({type:"dmn:InputClause"},o+1):void 0},removeInput(e){let t=e&&e.input;(t||i.hasSelection())&&(t=t||i.get().col,n.removeCol(t))},addOutput(){const e=r.getRoot().businessObject,t=e.get("input"),i=e.get("output");return n.addCol({type:"dmn:OutputClause"},t.length+i.length)},addOutputLeft(e){let t=e&&e.output;if(!t&&!i.hasSelection())return;t=t||i.get().col;const o=r.getRoot().cols.indexOf(t);return-1!==o?n.addCol({type:"dmn:OutputClause"},o):void 0},addOutputRight(e){let t=e&&e.output;if(!t&&!i.hasSelection())return;t=t||i.get().col;const o=r.getRoot().cols.indexOf(t);return-1!==o?n.addCol({type:"dmn:OutputClause"},o+1):void 0},removeOutput(e){let t=e&&e.output;(t||i.hasSelection())&&(t=t||i.get().col,n.removeCol(t))},addClause(){if(!i.hasSelection())return;const e=i.get().col;return hn(e,"dmn:InputClause")?s.addInput({input:e}):hn(e,"dmn:OutputClause")?s.addOutput({output:e}):void 0},addClauseLeft(){if(!i.hasSelection())return;const e=i.get().col;return hn(e,"dmn:InputClause")?s.addInputLeft({input:e}):hn(e,"dmn:OutputClause")?s.addOutputLeft({output:e}):void 0},addClauseRight(){if(!i.hasSelection())return;const e=i.get().col;return hn(e,"dmn:InputClause")?s.addInputRight({input:e}):hn(e,"dmn:OutputClause")?s.addOutputRight({output:e}):void 0},removeClause(){if(!i.hasSelection())return;const e=i.get().col;return hn(e,"dmn:InputClause")?s.removeInput({input:e}):hn(e,"dmn:OutputClause")?s.removeOutput({output:e}):void 0},selectCellAbove:()=>o.selectCell("above"),selectCellBelow:()=>o.selectCell("below"),copy({element:t}){e.copy(t)},cut({element:t}){e.cut(t)},pasteBefore:({element:t})=>e.pasteBefore(t),pasteAfter:({element:t})=>e.pasteAfter(t)};t.register(s)}}ex.$inject=["copyCutPaste","editorActions","modeling","selection","cellSelection","sheet"];const tx="is not a registered action";let nx=class{constructor(e,t,n,i){this._actions={undo(){e.undo()},redo(){e.redo()},select({cell:e}){i.select(e)},deselect(){i.deselect()},addRow({attrs:e,index:t}){n.addRow(e,t)},removeRow({row:e}){n.removeRow(e)},moveRow({row:e,index:t}){n.moveRow(e,t)},addCol({attrs:e,index:t}){n.addCol(e,t)},removeCol({col:e}){n.removeCol(e)},moveCol({col:e,index:t}){n.moveCol(e,t)}}}trigger(e,t){if(!this._actions[e])throw ix(e,tx);return this._actions[e](t)}register(e,t){if("string"==typeof e)return this._registerAction(e,t);p(e,((e,t)=>{this._registerAction(t,e)}))}_registerAction(e,t){if(this.isRegistered(e))throw ix(e,"is already registered");this._actions[e]=t}unregister(e){if(!this.isRegistered(e))throw ix(e,tx);this._actions[e]=void 0}isRegistered(e){return!!this._actions[e]}};function ix(e,t){return new Error(e+" "+t)}nx.$inject=["commandStack","eventBus","modeling","selection"];var ox,rx,sx={__depends__:[ny],__init__:["editorActions"],editorActions:["type",nx]},ax={__depends__:[jy,Jy,sx,ny],__init__:["decisionTableEditorActions"],decisionTableEditorActions:["type",ex]},lx={__depends__:[ax],__init__:["addRule"],addRule:["type",Jv]};var cx,ux=function(){if(rx)return ox;rx=1;var e=/["'&<>]/;return ox=function(t){var n,i=""+t,o=e.exec(i);if(!o)return i;var r="",s=0,a=0;for(s=o.index;s<i.length;s++){switch(i.charCodeAt(s)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}a!==s&&(r+=i.substring(a,s)),a=s+1,r+=n}return a!==s?r+i.substring(a,s):r},ox}(),hx=ay(ux),dx={exports:{}};var px=function(){if(cx)return dx.exports;function e(e,t){return{start:e,end:void 0===t?e:t}}return cx=1,dx.exports=function(t,n,i){var o=t.start,r=o,s=(i.length,n.length);i.length,n.length;var a=n.substring(o);return i.lastIndexOf(a)===i.length-a.length&&(n=n.substring(0,n.length-a.length),i=i.substring(0,i.length-a.length)),s=function(e,t){var n,i,o,r=0,s=0;t.length>e.length?(i=t,o=e):(i=e,o=t);for(;r<i.length;)i.charAt(r)!==o.charAt(s)?(n||(n={l_start:r,s_start:s}),r++):(n&&!n.complete&&(n.l_end=r,n.s_end=s,n.complete=!0),s++,r++);n&&!n.complete&&(n.complete=!0,n.s_end=o.length,n.l_end=i.length);if(!n)return;return t.length>e.length?{newStart:n.l_start,newEnd:n.l_end,type:"add"}:{newStart:n.s_start,newEnd:n.s_end,type:t.length<e.length?"remove":"replace"}}(n,i),s&&(r="remove"===s.type?s.newStart:s.newEnd),e(r)},dx.exports.range=e,dx.exports}(),fx=ay(px);class gx extends Ds{constructor(e,t){var n;super(e,t),this.state={},((n=window.navigator.userAgent).indexOf("MSIE ")>0||n.indexOf("Trident/")>0)&&(this.onInputIEPolyfill=e=>{var t=this.node.innerHTML;setTimeout((()=>{var n=this.node.innerHTML;t!==n&&this.onInput(e)}),0)})}componentWillUpdate(e,t){var n=this.node,i=t.focussed&&wy(n);this.selected=i&&{range:i,text:mx(n)}}componentDidUpdate(){var e=this.selected;if(!e)return;const t=e.range,n=e.text,i=this.node,o=mx(i);_y(i,o!==n?fx(t,n,o):t)}onFocus=e=>{var t=this.props.onFocus;this.setState({focussed:!0}),"function"==typeof t&&t(e)};onBlur=e=>{const{onBlur:t,onChange:n,value:i}=this.props;if(this.setState({focussed:!1}),"function"==typeof n&&this.node){const e=mx(this.node);e!==i&&n(e)}"function"==typeof t&&t(e)};onkeydown=e=>{if(13===e.which){if(e.preventDefault(),this.props.ctrlForNewline&&!function(e){return e.metaKey||e.ctrlKey}(e))return;if(this.props.singleLine)return;e.stopPropagation(),function(){var e=xy,t=e.getRangeAt(0);if(!t)return;var n=t.cloneRange(),i=document.createElement("br");n.deleteContents(),n.insertNode(i),n.setStartAfter(i),n.setEndAfter(i),by(n)}(),this.onInput(e)}};onInput=e=>{var t=this.props.onInput;"function"==typeof t&&t(mx(this.node))};onkeypress=e=>{this.onInputIEPolyfill&&this.onInputIEPolyfill(e)};onPaste=e=>{if(this.onInputIEPolyfill&&this.onInputIEPolyfill(e),this.props.singleLine){const t=(e.clipboardData||window.clipboardData).getData("text");document.execCommand("insertText",!1,t.replace(/\n/g," ")),e.preventDefault()}};getClassName(){const{className:e,placeholder:t,value:n}=this.props;return[e||"","content-editable",!n&&t?"placeholder":""].join(" ")}render(e){var{label:t,value:n,placeholder:i}=e;return n=hx(n).replace(/\r?\n/g,"<br/>")+"<br/>",vr(1,"div",this.getClassName(),null,1,{"aria-label":t,role:"textbox","aria-multiline":!this.props.singleLine,tabIndex:"0",contentEditable:"true",spellCheck:"false","data-placeholder":i||"",onInput:this.onInput,onkeypress:this.onkeypress,onPaste:this.onPaste,onFocus:this.onFocus,onBlur:this.onBlur,onkeydown:this.onkeydown,dangerouslySetInnerHTML:{__html:n}},null,(e=>this.node=e))}}function mx(e){return e.innerText.replace(/\n$/,"")}class vx extends Ds{constructor(e,t){super(e,t),this.state={changing:!1,focussed:!1};const{injector:n}=t,i=n.get("debounceInput");this.inputChanged=i((e=>{const{onChange:t}=this.props;"function"==typeof t&&t(e);const n=this.state.changing;this.setState({changing:n!==e&&n})})),this.onInput=e=>{var t=(this.props.validate||function(){})(e);this.setState({changing:e,invalid:t}),t||this.inputChanged(e)}}onFocus=e=>{this.setState({focussed:!0});var{onFocus:t}=this.props;"function"==typeof t&&t(e)};onBlur=e=>{this.setState({focussed:!1});const{invalid:t}=this.state;t&&this.setState({changing:!1,invalid:!1});const{onBlur:n}=this.props;"function"==typeof n&&n(e)};getClassName(){var{className:e,value:t}=this.props,{changing:n,focussed:i,invalid:o}=this.state;return e+=" editable",i&&(e+=" focussed"),o&&(e+=" invalid"),t||n||(e+=" empty"),e}getDisplayValue(){var{value:e,placeholder:t}=this.props,{focussed:n,changing:i}=this.state;return"string"==typeof i&&(e=i),e||(e=n?"":t||""),e}getEditor(e={}){return yr(2,gx,{className:e.className,ctrlForNewline:this.props.ctrlForNewline,label:this.props.label,onFocus:this.onFocus,onBlur:this.onBlur,onInput:this.onInput,value:this.getDisplayValue()})}}class yx extends Ds{constructor(e,t){super(e,t),av(this)}componentWillMount(){const{row:e}=this.props;this.changeSupport.onElementsChanged(e.id,this.onElementsChanged)}componentWillUnmount(){const{row:e}=this.props;this.changeSupport.offElementsChanged(e.id,this.onElementsChanged)}onElementsChanged=()=>{this.forceUpdate()};setAnnotationValue=e=>{const{row:t}=this.props;this.modeling.editAnnotation(t.businessObject,e)};render(){const{row:e,rowIndex:t}=this.props,{description:n,id:i}=e.businessObject;return yr(2,dv,{className:"annotation",onChange:this.setAnnotationValue,coords:`${t}:annotation`,value:n,elementId:i,"data-row-id":e.id,children:yr(2,xx,{label:this.translate("Annotation"),ctrlForNewline:!0,className:"annotation-editor",onChange:this.setAnnotationValue,value:n})})}}yx.$inject=["changeSupport","modeling","translate"];class xx extends vx{render(){return vr(1,"div",this.getClassName(),this.getEditor(),0)}}function bx(e){e.onGetComponent("cell",(({cellType:e})=>"after-label-cells"===e?fv:"after-rule-cells"===e?yx:void 0))}bx.$inject=["components"];function _x(e){return function(t){return!1!==e?R(t,a(e)?e:300):t}}_x.$inject=["config.debounceInput"];var wx={debounceInput:["factory",_x]},Cx={__depends__:[wx],__init__:["annotationsProvider"],annotationsProvider:["type",bx]};function Ox(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kx=function(e,t){return e^t};var Ex=/\b(Array|Date|Object|Math|JSON)\b/g;var Sx=kx,Rx=function(e,t){var n=function(e){for(var t=[],n=0;n<e.length;n++)~t.indexOf(e[n])||t.push(e[n]);return t}(function(e){return e.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(Ex,"").match(/[a-zA-Z_]\w*/g)||[]}(e));return t&&"string"==typeof t&&(t=function(e){return function(t){return e+t}}(t)),t?function(e,t,n){var i=/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g;return e.replace(i,(function(e){return"("==e[e.length-1]||~t.indexOf(e)?n(e):e}))}(e,n,t):n},Tx=Mx;function Mx(e,t){if(!(this instanceof Mx))return new Mx(e,t);if(this.node=this.start=this.peeked=e,this.root=t,this.closingTag=!1,this._revisit=!0,this._selects=[],this._rejects=[],e&&this.higher(e))throw new Error("root must be a parent or ancestor to node")}function Ax(e,t){var n="nextSibling"==e;return function(i,o,r){i=this.compile(i),o=o&&o>0?o:1;for(var s=this.node,a=this.closingTag,l=this._revisit;s;){if(Sx(n,a)&&s[t])s=s[t],a=!n;else if(1==s.nodeType&&!s[t]&&Sx(n,a)){if(a=n,!l)continue}else if(s[e])s=s[e],a=!n;else if(s=s.parentNode,a=n,!l)continue;if(!s||this.higher(s,this.root))break;if(i(s)&&this.selects(s,r)&&this.rejects(s,r)){if(--o)continue;return r||(this.node=s),this.closingTag=a,s}}return null}}Mx.prototype.reset=function(e){return this.node=e||this.start,this},Mx.prototype.revisit=function(e){return this._revisit=null==e||e,this},Mx.prototype.opening=function(){return 1==this.node.nodeType&&(this.closingTag=!1),this},Mx.prototype.atOpening=function(){return!this.closingTag},Mx.prototype.closing=function(){return 1==this.node.nodeType&&(this.closingTag=!0),this},Mx.prototype.atClosing=function(){return this.closingTag},Mx.prototype.next=Ax("nextSibling","firstChild"),Mx.prototype.previous=Mx.prototype.prev=Ax("previousSibling","lastChild"),Mx.prototype.select=function(e){return e=this.compile(e),this._selects.push(e),this},Mx.prototype.selects=function(e,t){var n=this._selects,i=n.length;if(!i)return!0;for(var o=0;o<i;o++)if(n[o].call(this,e,t))return!0;return!1},Mx.prototype.reject=function(e){return e=this.compile(e),this._rejects.push(e),this},Mx.prototype.rejects=function(e,t){var n=this._rejects,i=n.length;if(!i)return!0;for(var o=0;o<i;o++)if(n[o].call(this,e,t))return!1;return!0},Mx.prototype.higher=function(e){var t=this.root;if(!t)return!1;for(e=e.parentNode;e&&e!=t;)e=e.parentNode;return e!=t},Mx.prototype.compile=function(e){switch(typeof e){case"number":return function(t){return e==t.nodeType};case"string":return new Function("node","return "+Rx(e,"node."));case"function":return e;default:return function(){return!0}}},Mx.prototype.peak=Mx.prototype.peek=function(e,t){return 1==arguments.length&&(t=e,e=!0),(t=null==t?1:t)?t>0?this.next(e,t,!0):this.prev(e,Math.abs(t),!0):this.node},Mx.prototype.use=function(e){return e(this),this};var Px=Ox(Tx),Dx=window.getSelection();function $x(e){Dx.removeAllRanges(),Dx.addRange(e)}function jx(e,t){var n=function(e,t){var n,i=t.start,o=t.end,r=document.createRange(),s=Px(e.firstChild,e),a=s.node,l=!1,c=0;for(;a;){if(c===i&&(l?r.setStartAfter(a):r.setStartBefore(a)),c===o)return l?r.setEndAfter(a):r.setEndBefore(a),r;if(l||(Bx(a)||a.previousSibling&&(Lx(a)||Nx(a)))&&c++,Ix(a)){if(n=a.textContent.length,c<=i&&c+n>i&&r.setStart(a,i-c),c+n>o)return r.setEnd(a,o-c),r;c+=n}a=s.next(),l=s.closingTag}c<=i&&(e.lastChild?r.setStartAfter(e.lastChild):r.setStart(e,0));e.lastChild?r.setEndAfter(e.lastChild):r.setEnd(e,0);return r}(e,t);$x(n)}function Ix(e){return 3===e.nodeType}function Bx(e){return 1===e.nodeType&&"BR"===e.nodeName}function Lx(e){return 1===e.nodeType&&"DIV"===e.nodeName}function Nx(e){return 1===e.nodeType&&"P"===e.nodeName}function qx(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Vx={position:"absolute"};class Fx extends Ds{constructor(e,t){super(e,t),qx(this,"open",(({position:e,context:t})=>{this.close(),this.setState({isOpen:!0,position:e||{x:0,y:0},context:t||{}})})),qx(this,"close",(()=>{this.state.isOpen&&this.setState({context:void 0,isOpen:!1,position:{x:0,y:0}})})),qx(this,"triggerClose",(()=>{this.eventBus.fire("contextMenu.close")})),this.state={isOpen:!1,position:{x:0,y:0}},av(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(){const{isOpen:e,context:t,position:n}=this.state;if(!e)return null;const i=this.components.getComponents("context-menu",t);return i.length?yr(2,zx,{className:"context-menu no-deselect",context:t,position:n,offset:t.offset||{x:0,y:0},autoFocus:!1!==t.autoFocus,autoClose:!1!==t.autoClose,components:i,onClose:this.triggerClose}):null}}Fx.$inject=["eventBus","components"];let zx=class extends Ds{constructor(e,t){super(e,t),qx(this,"onGlobalMouseDown",(e=>{this.checkClose(e.target)})),qx(this,"onGlobalKey",(e=>{var t=e.which;13!==t&&27!==t||(e.stopPropagation(),e.preventDefault(),this.close())})),qx(this,"onFocusChanged",(e=>{this.checkClose(e.target)})),qx(this,"setNode",(e=>{this.node=e;const{autoFocus:t}=this.props;var n;e&&(this.updatePosition(),t&&(n=Zt(Hx,e))&&(n.focus(),n.selectionStart&&"text"===n.type?n.selectionStart=1e5:"contentEditable"in n&&jx(n,{start:1e5,end:1e5})))})),av(this)}close(){const{onClose:e}=this.props;l(e)&&e()}checkClose(e){const{autoClose:t}=this.props;if(t){var n=this.node;n&&n!==e&&(n.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(){const{position:e,offset:t}=this.props,{node:n}=this,i=n.getBoundingClientRect();e.width||(e.width=0),e.height||(e.height=0);const o=this.renderer.getContainer().getBoundingClientRect();o.width>o.height?(this.node.classList.add("horizontal"),this.node.classList.remove("vertical")):(this.node.classList.add("vertical"),this.node.classList.remove("horizontal"));const{scrollLeft:r,scrollTop:s}=function(e){const t=Bt(e,".tjs-container");if(!t)return{scrollTop:0,scrollLeft:0};const{scrollLeft:n,scrollTop:i}=t;return{scrollTop:i,scrollLeft:n}}(n),a={};let l,c,u;e.align&&(l=e.align.split("-"));"left"===(l&&l[1]||(e.x+e.width/2>o.width/2?"left":"right"))?(c=e.x-o.left-i.width+t.x+r,n.classList.remove("right"),n.classList.add("left")):(c=-o.left+e.x+e.width-t.x+r,n.classList.remove("left"),n.classList.add("right")),c=l?c:Qx(c,0+r,o.width-i.width+r),a.left=c+"px";"top"===(l&&l[0]||(e.y+e.height/2>o.height/2?"top":"bottom"))?(u=e.y-o.top-i.height+t.y+s,n.classList.remove("bottom"),n.classList.add("top")):(u=-o.top+e.y-t.y+s,n.classList.remove("top"),n.classList.add("bottom")),u=l?u:Qx(u,0+s,o.height-i.height+s),a.top=u+"px",a.overflowY="auto",a.maxHeight=o.height-u+s+"px",M(this.node.style,Vx,a)}render(){const{context:e,components:t,className:n}=this.props;return vr(1,"div",n,t.map(((t,n)=>yr(2,t,{context:e},n))),0,{onContextMenu:e=>e.preventDefault()},null,this.setNode)}};function Qx(e,t,n){return Math.max(t,Math.min(n,e))}zx.$inject=["renderer"];const Hx="\n input[type=text],\n input[type=number],\n input[type=button],\n input[type=submit],\n [contenteditable],\n [tabindex],\n a[href],\n textarea,\n button\n";let Wx=class{constructor(e,t,n){this._eventBus=t,e.onGetComponent("table.before",(()=>Fx))}open(e,t){this._eventBus.fire("contextMenu.open",{position:e,context:t})}close(){this._eventBus.fire("contextMenu.close")}};Wx.$inject=["components","eventBus","renderer"];var Ux={__init__:["contextMenu"],contextMenu:["type",Wx]};function Xx(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Kx(e){return e.shiftKey}class Gx{constructor(e,t,n,i,o,r,s){this._clipboard=n,this._cellSelection=i,this._elementRegistry=o,this._editorActions=r,this._keyboard=e.get("keyboard",!1),this._renderer=s,this._keyboard&&(t.on("keyboard.init",this._registerBindings),t.on("keyboard.bind",(()=>{zt.bind(document,"copy",this._clearClipboard,!0),zt.bind(document,"cut",this._clearClipboard,!0)})),t.on("keyboard.unbind",(()=>{zt.unbind(document,"copy",this._clearClipboard,!0),zt.unbind(document,"cut",this._clearClipboard,!0)})))}_clearClipboard=()=>{this._clipboard.clear()};_getSelectedCell(){const e=this._cellSelection.getCellSelection();if(!e)return;const t=this._elementRegistry.get(e);if(!t)return;const n=My(e,this._renderer.getContainer()),i=Py(n);if(document.activeElement!==i)return;const o=wy(n);return o&&o.start!==o.end?void 0:t}_registerBindings=()=>{[(e,t)=>{if(Xx(t)&&67===e){const e=this._getSelectedCell();if(!e)return;return Kx(t)?this._editorActions.trigger("copy",{element:e.col}):this._editorActions.trigger("copy",{element:e.row}),!0}},(e,t)=>{if(Xx(t)&&88===e){const e=this._getSelectedCell();if(!e)return;return Kx(t)?this._editorActions.trigger("cut",{element:e.col}):this._editorActions.trigger("cut",{element:e.row}),!0}},(e,t)=>{let n;if(Xx(t)&&86===e){const e=this._getSelectedCell();if(!e)return;Kx(t)?(n=this._editorActions.trigger("pasteAfter",{element:e.col}),n&&this._cellSelection.selectCell("right")):(n=this._editorActions.trigger("pasteAfter",{element:e.row}),n&&this._cellSelection.selectCell("below"))}return void 0!==n}].forEach((e=>{this._keyboard.addListener(e)}))}}Gx.$inject=["injector","eventBus","clipboard","cellSelection","elementRegistry","editorActions","renderer"];var Yx={__depends__:[By,jy],__init__:["copyCutPasteKeyBindings"],copyCutPasteKeyBindings:["type",Gx]};class Zx extends Ds{constructor(e,t){super(e,t),av(this)}onClick=e=>{this.editorActions.trigger("addInput")};render(){return vr(1,"th","input-cell create-inputs header actionable",[this.translate("Input"),xr(" "),vr(1,"button","add-input dmn-icon-plus action-icon",null,1,{title:this.translate("Add input")})],0,{onClick:this.onClick,title:this.translate("Add input")})}}Zx.$inject=["editorActions","translate"];class Jx extends Ds{constructor(e,t){super(e,t),av(this)}onClick=e=>{this.editorActions.trigger("addInput")};render(){return vr(1,"td","input-cell create-inputs",xr("-"),2,{onClick:this.onClick,title:this.translate("Add input")})}}Jx.$inject=["editorActions","translate"];class eb{constructor(e,t){e.onGetComponent("cell",500,(({cellType:e})=>{const{businessObject:n}=t.getRoot();if(!n.input||!n.input.length)return"before-label-cells"===e?Zx:"before-rule-cells"===e?Jx:void 0}))}}eb.$inject=["components","sheet"];var tb={__depends__:[ax],__init__:["createInputsProvider"],createInputsProvider:["type",eb]};const nb=["string","boolean","number","date","time","dateTime","dayTimeDuration","yearMonthDuration","Any"];class ib{constructor(e){this._dataTypes=e||nb}getAll(){return this._dataTypes}}ib.$inject=["config.dataTypes"];var ob={__init__:["dataTypes"],dataTypes:["type",ib]};class rb{constructor(e,t,n,i,o,r,s,a,l,c,u){this._contextMenu=t,this._clipboard=n,this._editorActions=i,this._elementRegistry=r,this._eventBus=o,this._modeling=s,this._selection=a,this._sheet=l,this._rules=c,this._translate=u,this._getEntries=this._getEntries.bind(this),e.onGetComponent("context-menu",((t={})=>{if(t.contextMenuType&&"context-menu"===t.contextMenuType){const n=this._getEntries(t),i=function(e){return e instanceof Vm}(this._elementRegistry.get(t.id))&&e.getComponents("context-menu-cell-additional",t);if(i&&i.length){const e=vr(1,"div","context-menu-group context-menu-group-cell",i,0,{role:"presentation"});n.push(e)}return()=>vr(1,"div","context-menu-flex",n,0,{tabIndex:0,role:"menu","aria-label":"Decision table context menu"})}})),o.on("cell.contextmenu",(({event:e,id:n,node:i})=>{e.preventDefault(),t.open({x:e.pageX,y:e.pageY},{contextMenuType:"context-menu",event:e,id:n})}))}_getEntries(e){const t=t=>{const n=t.cells.map((e=>e.id)).indexOf(e.id),i=this._editorActions.trigger("addRuleAbove",{rule:t});i.cells[n]?this._selection.select(i.cells[n]):this._selection.select(i.cells[0]),this._contextMenu.close()},n=t=>{const n=t.cells.map((e=>e.id)).indexOf(e.id),i=this._editorActions.trigger("addRuleBelow",{rule:t});i.cells[n]?this._selection.select(i.cells[n]):this._selection.select(i.cells[0]),this._contextMenu.close()},i=e=>{this._editorActions.trigger("removeRule",{rule:e}),this._contextMenu.close()},o=e=>{this._editorActions.trigger("addInputLeft",{input:e}),this._contextMenu.close()},r=e=>{this._editorActions.trigger("addInputRight",{input:e}),this._contextMenu.close()},s=e=>{this._editorActions.trigger("removeInput",{input:e}),this._contextMenu.close()},a=e=>{this._editorActions.trigger("addOutputLeft",{output:e}),this._contextMenu.close()},l=e=>{this._editorActions.trigger("addOutputRight",{output:e}),this._contextMenu.close()},c=e=>{this._editorActions.trigger("removeOutput",{output:e}),this._contextMenu.close()},u=e=>{this._editorActions.trigger("copy",{element:e}),this._contextMenu.close()},h=e=>{this._editorActions.trigger("cut",{element:e}),this._contextMenu.close()},d=e=>{this._editorActions.trigger("pasteBefore",{element:e}),this._contextMenu.close()},p=e=>{this._editorActions.trigger("pasteAfter",{element:e}),this._contextMenu.close()},f=e&&e.id;if(!f)return null;const g=this._elementRegistry.get(f);if(!g)return null;const m=this._clipboard.get()||{},v=[],y=g.row||g;if(hn(y,"dmn:DecisionRule")){const e=this._rules.allowed("paste",{data:m.elements,target:y});v.push(vr(1,"div","context-menu-group",[vr(1,"div","context-menu-group-entry context-menu-entry-copy-rule",this._translate("Copy rule"),0,{onClick:()=>u(y),tabIndex:"-1",role:"menuitem"}),vr(1,"div","context-menu-group-entry context-menu-entry-cut-rule",this._translate("Cut rule"),0,{onClick:()=>h(y),tabIndex:"-1",role:"menuitem"}),vr(1,"div",`context-menu-group-entry ${e?"":"disabled"} context-menu-entry-paste-rule-above`,this._translate("Paste rule above"),0,{onClick:()=>d(y),tabIndex:"-1",role:"menuitem","aria-disabled":!e}),vr(1,"div",`context-menu-group-entry ${e?"":"disabled"} context-menu-entry-paste-rule-below`,this._translate("Paste rule below"),0,{onClick:()=>p(y),tabIndex:"-1",role:"menuitem","aria-disabled":!e})],4,{role:"presentation"}),vr(1,"div","context-menu-group",[vr(1,"div","context-menu-group-entry context-menu-entry-add-rule-above",this._translate("Add rule above"),0,{onClick:()=>t(y),tabIndex:"-1",role:"menuitem"}),vr(1,"div","context-menu-group-entry context-menu-entry-add-rule-below",this._translate("Add rule below"),0,{onClick:()=>n(y),tabIndex:"-1",role:"menuitem"}),vr(1,"div","context-menu-group-entry context-menu-entry-remove-rule",this._translate("Remove rule"),0,{onClick:()=>i(y),tabIndex:"-1",role:"menuitem"})],4,{role:"presentation"}))}else if(hn(g,"dmn:InputClause")){const e=hn(g,"dmn:InputClause")?g:g.col,t=this._rules.allowed("col.remove",{col:g.col||g}),n=this._rules.allowed("paste",{data:m.elements,target:g.col||g});v.push(vr(1,"div","context-menu-group",[vr(1,"div","context-menu-group-entry context-menu-entry-copy-input",this._translate("Copy input column"),0,{onClick:()=>u(e),tabIndex:"-1",role:"menuitem"}),vr(1,"div",`context-menu-group-entry ${t?"":"disabled"} context-menu-entry-cut-input`,this._translate("Cut input column"),0,{onClick:()=>h(e),tabIndex:"-1",role:"menuitem","aria-disabled":!t}),vr(1,"div",`context-menu-group-entry ${n?"":"disabled"} context-menu-entry-paste-input-left`,this._translate("Paste input column left"),0,{onClick:()=>d(e),tabIndex:"-1",role:"menuitem","aria-disabled":!n}),vr(1,"div",`context-menu-group-entry ${n?"":"disabled"} context-menu-entry-paste-input-right`,this._translate("Paste input column right"),0,{onClick:()=>p(e),tabIndex:"-1",role:"menuitem","aria-disabled":!n})],4,{role:"presentation"}),vr(1,"div","context-menu-group",[vr(1,"div","context-menu-group-entry context-menu-entry-add-input-left",this._translate("Add input column left"),0,{onClick:()=>o(e),tabIndex:"-1",role:"menuitem"}),vr(1,"div","context-menu-group-entry context-menu-entry-add-input-right",this._translate("Add input column right"),0,{onClick:()=>r(e),tabIndex:"-1",role:"menuitem"}),vr(1,"div",`context-menu-group-entry ${t?"":"disabled"} context-menu-entry-remove-input`,this._translate("Remove input column"),0,{onClick:()=>s(e),tabIndex:"-1",role:"menuitem","aria-disabled":!t})],4,{role:"presentation"}))}else if(hn(g,"dmn:OutputClause")||hn(g.col,"dmn:OutputClause")){const e=hn(g,"dmn:OutputClause")?g:g.col,t=this._rules.allowed("col.remove",{col:g.col||g}),n=this._rules.allowed("paste",{data:m.elements,target:g.col||g});v.push(vr(1,"div","context-menu-group",[vr(1,"div","context-menu-group-entry context-menu-entry-copy-output",this._translate("Copy output column"),0,{onClick:()=>u(e),tabIndex:"-1",role:"menuitem"}),vr(1,"div",`context-menu-group-entry ${t?"":"disabled"} context-menu-entry-cut-output`,this._translate("Cut output column"),0,{onClick:()=>h(e),tabIndex:"-1",role:"menuitem","aria-disabled":!t}),vr(1,"div",`context-menu-group-entry ${n?"":"disabled"} context-menu-entry-paste-output-left`,this._translate("Paste output column left"),0,{onClick:()=>d(e),tabIndex:"-1",role:"menuitem","aria-disabled":!n}),vr(1,"div",`context-menu-group-entry ${n?"":"disabled"} context-menu-entry-paste-output-right`,this._translate("Paste output column right"),0,{onClick:()=>p(e),tabIndex:"-1",role:"menuitem","aria-disabled":!n})],4,{role:"presentation"}),vr(1,"div","context-menu-group",[vr(1,"div","context-menu-group-entry context-menu-entry-add-output-left",this._translate("Add output column left"),0,{onClick:()=>a(e),tabIndex:"-1",role:"menuitem"}),vr(1,"div","context-menu-group-entry context-menu-entry-add-output-right",this._translate("Add output column right"),0,{onClick:()=>l(e),tabIndex:"-1",role:"menuitem"}),vr(1,"div",`context-menu-group-entry ${t?"":"disabled"} context-menu-entry-remove-output`,this._translate("Remove output column"),0,{onClick:()=>c(e),tabIndex:"-1",role:"menuitem","aria-disabled":!t})],4,{role:"presentation"}))}return v}}rb.$inject=["components","contextMenu","clipboard","editorActions","eventBus","elementRegistry","modeling","selection","sheet","rules","translate"];const sb=["row.add","row.remove","col.add","col.remove"];class ab{constructor(e,t){t.on("commandStack.executed",(({command:t})=>{-1!==sb.indexOf(t)&&e.close()})),t.on("commandStack.reverted",(()=>{e.close()}))}}ab.$inject=["contextMenu","eventBus"];class lb{constructor(e){e.on("contextMenu.open",(()=>this.addEventListeners())),e.on("contextMenu.close",(()=>this.removeEventListeners())),e.on("commandStack.executed",(()=>this.removeEventListeners()))}addEventListeners=()=>{document.addEventListener("keydown",this.handleKeyEvent),document.addEventListener("mouseover",this.handleMouseOver)};removeEventListeners=()=>{document.removeEventListener("keydown",this.handleKeyEvent),document.removeEventListener("mouseover",this.handleMouseOver)};handleKeyEvent=e=>{"ArrowUp"===e.key?(e.preventDefault(),this.move(e.target,-1)):"ArrowDown"===e.key?(e.preventDefault(),this.move(e.target,1)):"Enter"===e.key&&(e.preventDefault(),this.clickCurrentEntry())};handleMouseOver=()=>{this.getEntries().forEach((e=>{return(t=e).style.removeProperty("background-color"),void t.style.removeProperty("pointer-events");var t}));const{focused:e}=this.getActiveEntries(document);e&&$t(e).remove("focused")};getEntries=()=>Array.from(Jt(".context-menu-group-entry")).filter((e=>!$t(e).has("disabled")));getActiveEntries=e=>{const t=Zt(".context-menu-group-entry:hover",e),n=Zt(".context-menu-group-entry.focused",e);return{hover:t,focused:n,current:n||t}};move=(e,t)=>{const n=this.getEntries(),{current:i,hover:o}=this.getActiveEntries(e);if(!i){return void $t(n[0]).add("focused")}const r=n.indexOf(i)+t;let s=n[r];var a;r<0&&(s=n[n.length-1]),r>=n.length&&(s=n[0]),o&&((a=o).style.setProperty("pointer-events","none"),a.style.setProperty("background-color","transparent")),$t(i).remove("focused"),$t(s).add("focused"),s.style.removeProperty("background-color")};clickCurrentEntry=()=>{const{current:e}=this.getActiveEntries(document);e&&e.click()}}lb.$inject=["eventBus"];var cb={__depends__:[ax,Ux,qy],__init__:["decisionTableContextMenu","contextMenuCloseBehavior","contextMenuKeyboard"],decisionTableContextMenu:["type",rb],contextMenuCloseBehavior:["type",ab],contextMenuKeyboard:["type",lb]};class ub extends Ds{constructor(e,t){super(e,t),cv(this,pv),this._translate=t.injector.get("translate")}onClick=e=>{const{output:t}=this.props;this._eventBus.fire("output.edit",{event:e,output:t})};onContextmenu=e=>{const{id:t}=this.props.output;this._eventBus.fire("cell.contextmenu",{event:e,id:t})};onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){const{injector:e}=this.context;this._changeSupport=this.context.changeSupport,this._eventBus=e.get("eventBus"),this._elementRegistry=e.get("elementRegistry");const{output:t}=this.props;this._changeSupport.onElementsChanged(t.id,this.onElementsChanged)}componentWillUnmount(){const{output:e}=this.props;this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}render(){const{output:e,index:t,outputsLength:n}=this.props,{label:i,name:o,outputValues:r,typeRef:s}=e,a=e.width?e.width+"px":"192px";return vr(1,"th","output-cell output-editor",[this.slotFills({type:"cell-inner",context:{cellType:"output-cell",col:this._elementRegistry.get(e.id),index:t,outputsLength:n},col:e}),vr(1,"div","clause",0===t?this._translate("Then"):this._translate("And"),0),i?vr(1,"div","output-label",i,0,{title:this._translate("Output label: ")+i}):vr(1,"div","output-name",o,0,{title:this._translate("Output name: ")+o}),vr(1,"div","output-variable",r&&r.text||this._translate(s||""),0,{title:r&&r.text?this._translate("Output values"):this._translate("Output type")})],0,{"data-col-id":e.id,onDblClick:this.onClick,onContextMenu:this.onContextmenu,style:{width:a}})}}class hb extends Ds{constructor(e,t){super(e,t),this.state={value:e.value}}onInput=e=>{const{onInput:t}=this.props,n=e.target.value;this.setState({value:n},(()=>{"function"==typeof t&&t(n)}))};onChange=e=>{const{onChange:t}=this.props;"function"==typeof t&&t(e.target.value)};onKeyDown=e=>{const{onKeyDown:t}=this.props;"function"==typeof t&&t(e)};onKeyUp=e=>{const{onKeyUp:t}=this.props;"function"==typeof t&&t(e)};componentDidUpdate(e){const{value:t}=this.props;t!==e.value&&t!==this.state.value&&this.setState({value:t})}render(){const{className:e,label:t,id:n,placeholder:i,type:o}=this.props,{value:r}=this.state;return vr(64,"input",[e||"","dms-input"].join(" "),null,1,{"aria-label":t,placeholder:i||"",onChange:this.onChange,onInput:this.onInput,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,spellCheck:"false",type:o||"text",value:r,id:n})}}class db extends Ds{constructor(e,t){super(e,t),this.translate=t.injector?t.injector.get("translate"):pb,this.setName=e=>{e=e||void 0,this.handleChange({name:e})},this.setLabel=e=>{e=e||void 0,this.handleChange({label:e})}}handleChange(e){var{onChange:t}=this.props;"function"==typeof t&&t(e)}render(){const{name:e,label:t}=this.props;return vr(1,"div","context-menu-container ref-output-editor output-edit",[vr(1,"div","dms-form-control",yr(2,gx,{label:this.translate("Output label"),className:"dms-output-label",value:t||"",placeholder:this.translate("Output"),singleLine:!0,onInput:this.setLabel}),2),vr(1,"div","dms-form-control",[vr(1,"label","dms-label",this.translate("Output name"),0),yr(2,hb,{label:this.translate("Output name"),className:"ref-output-name",value:e||"",onInput:this.setName})],4)],4)}}function pb(e){return e}class fb extends Ds{constructor(e,t){super(e,t),this.state={},av(this),this.persistChanges=this.debounceInput(this.persistChanges)}persistChanges=()=>{const{output:e}=this.props.context,{unsaved:t}=this.state;t&&(this.modeling.updateProperties(e,t),this.setState({unsaved:!1}))};handleChange=e=>{this.setState({unsaved:{...this.state.unsaved,...e}},this.persistChanges)};getValue(e){const{output:t}=this.props.context,{unsaved:n}=this.state;return n&&e in n?n[e]:t.get(e)}render(){return yr(2,db,{name:this.getValue("name"),label:this.getValue("label"),onChange:this.handleChange})}}fb.$inject=["debounceInput","modeling"];class gb extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._eventBus=t.injector.get("eventBus")}onClick=e=>{const{col:t}=this.props;this._eventBus.fire("output.edit",{event:e,output:t})};render(){return vr(1,"button","edit-button dmn-icon-edit",null,1,{"aria-label":this._translate("Edit output"),type:"button",onClick:this.onClick})}}class mb{constructor(e,t,n,i){e.onGetComponent("cell",(({cellType:e})=>{if("output-header"===e)return ub})),e.onGetComponent("context-menu",((e={})=>{if("output-edit"===e.contextMenuType)return fb})),e.onGetComponent("cell-inner",((e={})=>{const{cellType:t}=e;if("output-cell"===t)return gb})),n.on("output.edit",(({event:e,output:n})=>{const{target:i}=e,o=Bt(i,"th",!0),{left:r,top:s}=o.getBoundingClientRect(),a=function(e){if(!Yt(e,".output-cell + .output-cell"))return{x:-1,y:0}}(o);t.open({x:r,y:s,align:"bottom-right"},{contextMenuType:"output-edit",output:n,offset:a})}))}}mb.$inject=["components","contextMenu","eventBus","renderer"];class vb extends Ds{constructor(e,t){super(e,t),cv(this,pv),this._translate=t.injector.get("translate")}onClick=e=>{const{input:t}=this.props;this._eventBus.fire("input.edit",{event:e,input:t})};onContextmenu=e=>{const{id:t}=this.props.input;this._eventBus.fire("cell.contextmenu",{event:e,id:t})};onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){const{injector:e}=this.context;this._changeSupport=this.context.changeSupport,this._sheet=e.get("sheet"),this._eventBus=e.get("eventBus"),this._elementRegistry=e.get("elementRegistry");const t=this._sheet.getRoot(),{input:n}=this.props;this._changeSupport.onElementsChanged(t.id,this.onElementsChanged),this._changeSupport.onElementsChanged(n.id,this.onElementsChanged)}componentWillUnmount(){const e=this._sheet.getRoot(),{input:t}=this.props;this._changeSupport.offElementsChanged(e.id,this.onElementsChanged),this._changeSupport.offElementsChanged(t.id,this.onElementsChanged)}render(){const{input:e,index:t,inputsLength:n}=this.props,{inputExpression:i,inputValues:o}=e,r=e.get("label"),s=e.width?e.width+"px":"192px";return vr(1,"th","input-cell input-editor",[this.slotFills({type:"cell-inner",context:{cellType:"input-cell",col:this._elementRegistry.get(e.id),index:t,inputsLength:n},col:e}),vr(1,"div","clause",0===t?this._translate("When"):this._translate("And"),0),r?vr(1,"div","input-label",r,0,{title:this._translate("Input label: ")+r}):vr(1,"div","input-expression",i.text,0,{title:this._translate("Input expression: ")+i.text}),vr(1,"div","input-variable",o&&o.text||this._translate(i.typeRef||""),0,{title:o&&o.text?this._translate("Input values"):this._translate("Input type")})],0,{"data-col-id":e.id,onDblClick:this.onClick,onContextMenu:this.onContextmenu,style:{width:s}})}}let yb=[],xb=[];function bb(e){if(e<768)return!1;for(let t=0,n=yb.length;;){let i=t+n>>1;if(e<yb[i])n=i;else{if(!(e>=xb[i]))return!0;t=i+1}if(t==n)return!1}}function _b(e){return e>=127462&&e<=127487}(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e=>e?parseInt(e,36):1));for(let t=0,n=0;t<e.length;t++)(t%2?xb:yb).push(n+=e[t])})();const wb=8205;function Cb(e,t,n=!0,i=!0){return(n?Ob:kb)(e,t,i)}function Ob(e,t,n){if(t==e.length)return t;t&&Sb(e.charCodeAt(t))&&Rb(e.charCodeAt(t-1))&&t--;let i=Eb(e,t);for(t+=Tb(i);t<e.length;){let o=Eb(e,t);if(i==wb||o==wb||n&&bb(o))t+=Tb(o),i=o;else{if(!_b(o))break;{let n=0,i=t-2;for(;i>=0&&_b(Eb(e,i));)n++,i-=2;if(n%2==0)break;t+=2}}}return t}function kb(e,t,n){for(;t>0;){let i=Ob(e,t-2,n);if(i<t)return i;t--}return 0}function Eb(e,t){let n=e.charCodeAt(t);if(!Rb(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return Sb(i)?i-56320+(n-55296<<10)+65536:n}function Sb(e){return e>=56320&&e<57344}function Rb(e){return e>=55296&&e<56320}function Tb(e){return e<65536?1:2}class Mb{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Nb(this,e,t);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),Pb.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Nb(this,e,t);let n=[];return this.decompose(e,t,n,0),Pb.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new jb(this),o=new jb(e);for(let e=t,r=t;;){if(i.next(e),o.next(e),e=0,i.lineBreak!=o.lineBreak||i.done!=o.done||i.value!=o.value)return!1;if(r+=i.value.length,i.done||r>=n)return!0}}iter(e=1){return new jb(this,e)}iterRange(e,t=this.length){return new Ib(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Bb(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new Ab(e):Pb.from(Ab.split(e,[])):Mb.empty}}class Ab extends Mb{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let o=0;;o++){let r=this.text[o],s=i+r.length;if((t?n:s)>=e)return new Lb(i,s,n,r);i=s+1,n++}}decompose(e,t,n,i){let o=e<=0&&t>=this.length?this:new Ab($b(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=Db(o.text,e.text.slice(),0,o.length);if(t.length<=32)n.push(new Ab(t,e.length+o.length));else{let e=t.length>>1;n.push(new Ab(t.slice(0,e)),new Ab(t.slice(e)))}}else n.push(o)}replace(e,t,n){if(!(n instanceof Ab))return super.replace(e,t,n);[e,t]=Nb(this,e,t);let i=Db(this.text,Db(n.text,$b(this.text,0,e)),t),o=this.length+n.length-(t-e);return i.length<=32?new Ab(i,o):Pb.from(Ab.split(i,[]),o)}sliceString(e,t=this.length,n="\n"){[e,t]=Nb(this,e,t);let i="";for(let o=0,r=0;o<=t&&r<this.text.length;r++){let s=this.text[r],a=o+s.length;o>e&&r&&(i+=n),e<a&&t>o&&(i+=s.slice(Math.max(0,e-o),t-o)),o=a+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let o of e)n.push(o),i+=o.length+1,32==n.length&&(t.push(new Ab(n,i)),n=[],i=-1);return i>-1&&t.push(new Ab(n,i)),t}}class Pb extends Mb{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,i){for(let o=0;;o++){let r=this.children[o],s=i+r.length,a=n+r.lines-1;if((t?a:s)>=e)return r.lineInner(e,t,n,i);i=s+1,n=a+1}}decompose(e,t,n,i){for(let o=0,r=0;r<=t&&o<this.children.length;o++){let s=this.children[o],a=r+s.length;if(e<=a&&t>=r){let o=i&((r<=e?1:0)|(a>=t?2:0));r>=e&&a<=t&&!o?n.push(s):s.decompose(e-r,t-r,n,o)}r=a+1}}replace(e,t,n){if([e,t]=Nb(this,e,t),n.lines<this.lines)for(let i=0,o=0;i<this.children.length;i++){let r=this.children[i],s=o+r.length;if(e>=o&&t<=s){let a=r.replace(e-o,t-o,n),l=this.lines-r.lines+a.lines;if(a.lines<l>>4&&a.lines>l>>6){let o=this.children.slice();return o[i]=a,new Pb(o,this.length-(t-e)+n.length)}return super.replace(o,s,a)}o=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=Nb(this,e,t);let i="";for(let o=0,r=0;o<this.children.length&&r<=t;o++){let s=this.children[o],a=r+s.length;r>e&&o&&(i+=n),e<a&&t>r&&(i+=s.sliceString(e-r,t-r,n)),r=a+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Pb))return 0;let n=0,[i,o,r,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,o+=t){if(i==r||o==s)return n;let a=this.children[i],l=e.children[o];if(a!=l)return n+a.scanIdentical(l,t);n+=a.length+1}}static from(e,t=e.reduce(((e,t)=>e+t.length+1),-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new Ab(n,t)}let i=Math.max(32,n>>5),o=i<<1,r=i>>1,s=[],a=0,l=-1,c=[];function u(e){let t;if(e.lines>o&&e instanceof Pb)for(let t of e.children)u(t);else e.lines>r&&(a>r||!a)?(h(),s.push(e)):e instanceof Ab&&a&&(t=c[c.length-1])instanceof Ab&&e.lines+t.lines<=32?(a+=e.lines,l+=e.length+1,c[c.length-1]=new Ab(t.text.concat(e.text),t.length+1+e.length)):(a+e.lines>i&&h(),a+=e.lines,l+=e.length+1,c.push(e))}function h(){0!=a&&(s.push(1==c.length?c[0]:Pb.from(c,l)),l=-1,a=c.length=0)}for(let t of e)u(t);return h(),1==s.length?s[0]:new Pb(s,t)}}function Db(e,t,n=0,i=1e9){for(let o=0,r=0,s=!0;r<e.length&&o<=i;r++){let a=e[r],l=o+a.length;l>=n&&(l>i&&(a=a.slice(0,i-o)),o<n&&(a=a.slice(n-o)),s?(t[t.length-1]+=a,s=!1):t.push(a)),o=l+1}return t}function $b(e,t,n){return Db(e,[""],t,n)}Mb.empty=new Ab([""],0);class jb{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Ab?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],o=this.offsets[n],r=o>>1,s=i instanceof Ab?i.text.length:i.children.length;if(r==(t>0?s:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&o)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof Ab){let o=i.text[r+(t<0?-1:0)];if(this.offsets[n]+=t,o.length>Math.max(0,e))return this.value=0==e?o:t>0?o.slice(e):o.slice(0,o.length-e),this;e-=o.length}else{let o=i.children[r+(t<0?-1:0)];e>o.length?(e-=o.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(o),this.offsets.push(t>0?1:(o instanceof Ab?o.text.length:o.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Ib{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new jb(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class Bb{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(Mb.prototype[Symbol.iterator]=function(){return this.iter()},jb.prototype[Symbol.iterator]=Ib.prototype[Symbol.iterator]=Bb.prototype[Symbol.iterator]=function(){return this});class Lb{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function Nb(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function qb(e,t,n=!0,i=!0){return Cb(e,t,n,i)}function Vb(e,t){let n=e.charCodeAt(t);if(!(i=n,i>=55296&&i<56320&&t+1!=e.length))return n;var i;let o=e.charCodeAt(t+1);return function(e){return e>=56320&&e<57344}(o)?o-56320+(n-55296<<10)+65536:n}function Fb(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function zb(e){return e<65536?1:2}const Qb=/\r\n?|\n/;var Hb=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Hb||(Hb={}));class Wb{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let o=this.sections[t++],r=this.sections[t++];r<0?(e(n,i,o),i+=o):i+=r,n+=o}}iterChangedRanges(e,t=!1){Gb(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new Wb(e)}composeDesc(e){return this.empty?e:e.empty?this:Zb(this,e)}mapDesc(e,t=!1){return e.empty?this:Yb(this,e,t)}mapPos(e,t=-1,n=Hb.Simple){let i=0,o=0;for(let r=0;r<this.sections.length;){let s=this.sections[r++],a=this.sections[r++],l=i+s;if(a<0){if(l>e)return o+(e-i);o+=s}else{if(n!=Hb.Simple&&l>=e&&(n==Hb.TrackDel&&i<e&&l>e||n==Hb.TrackBefore&&i<e||n==Hb.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!s)return e==i||t<0?o:o+a;o+=a}i=l}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return o}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let o=i+this.sections[n++];if(this.sections[n++]>=0&&i<=t&&o>=e)return!(i<e&&o>t)||"cover";i=o}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((e=>"number"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Wb(e)}static create(e){return new Wb(e)}}class Ub extends Wb{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Gb(this,((t,n,i,o,r)=>e=e.replace(i,i+(n-t),r)),!1),e}mapDesc(e,t=!1){return Yb(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,o=0;i<t.length;i+=2){let r=t[i],s=t[i+1];if(s>=0){t[i]=s,t[i+1]=r;let a=i>>1;for(;n.length<a;)n.push(Mb.empty);n.push(r?e.slice(o,o+r):Mb.empty)}o+=r}return new Ub(t,n)}compose(e){return this.empty?e:e.empty?this:Zb(this,e,!0)}map(e,t=!1){return e.empty?this:Yb(this,e,t,!0)}iterChanges(e,t=!1){Gb(this,e,t)}get desc(){return Wb.create(this.sections)}filter(e){let t=[],n=[],i=[],o=new Jb(this);e:for(let r=0,s=0;;){let a=r==e.length?1e9:e[r++];for(;s<a||s==a&&0==o.len;){if(o.done)break e;let e=Math.min(o.len,a-s);Xb(i,e,-1);let r=-1==o.ins?-1:0==o.off?o.ins:0;Xb(t,e,r),r>0&&Kb(n,t,o.text),o.forward(e),s+=e}let l=e[r++];for(;s<l;){if(o.done)break e;let e=Math.min(o.len,l-s);Xb(t,e,-1),Xb(i,e,-1==o.ins?-1:0==o.off?o.ins:0),o.forward(e),s+=e}}return{changes:new Ub(t,n),filtered:Wb.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];i<0?e.push(n):0==i?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],o=[],r=0,s=null;function a(e=!1){if(!e&&!i.length)return;r<t&&Xb(i,t-r,-1);let n=new Ub(i,o);s=s?s.compose(n.map(s)):n,i=[],o=[],r=0}return function e(l){if(Array.isArray(l))for(let t of l)e(t);else if(l instanceof Ub){if(l.length!=t)throw new RangeError(`Mismatched change set length (got ${l.length}, expected ${t})`);a(),s=s?s.compose(l.map(s)):l}else{let{from:e,to:s=e,insert:c}=l;if(e>s||e<0||s>t)throw new RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let u=c?"string"==typeof c?Mb.of(c.split(n||Qb)):c:Mb.empty,h=u.length;if(e==s&&0==h)return;e<r&&a(),e>r&&Xb(i,e-r,-1),Xb(i,s-e,h),Kb(o,i,u),r=s}}(e),a(!s),s}static empty(e){return new Ub(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let o=e[i];if("number"==typeof o)t.push(o,-1);else{if(!Array.isArray(o)||"number"!=typeof o[0]||o.some(((e,t)=>t&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==o.length)t.push(o[0],0);else{for(;n.length<i;)n.push(Mb.empty);n[i]=Mb.of(o.slice(1)),t.push(o[0],n[i].length)}}}return new Ub(t,n)}static createSet(e,t){return new Ub(e,t)}}function Xb(e,t,n,i=!1){if(0==t&&n<=0)return;let o=e.length-2;o>=0&&n<=0&&n==e[o+1]?e[o]+=t:o>=0&&0==t&&0==e[o]?e[o+1]+=n:i?(e[o]+=t,e[o+1]+=n):e.push(t,n)}function Kb(e,t,n){if(0==n.length)return;let i=t.length-2>>1;if(i<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<i;)e.push(Mb.empty);e.push(n)}}function Gb(e,t,n){let i=e.inserted;for(let o=0,r=0,s=0;s<e.sections.length;){let a=e.sections[s++],l=e.sections[s++];if(l<0)o+=a,r+=a;else{let c=o,u=r,h=Mb.empty;for(;c+=a,u+=l,l&&i&&(h=h.append(i[s-2>>1])),!(n||s==e.sections.length||e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(o,c,r,u,h),o=c,r=u}}}function Yb(e,t,n,i=!1){let o=[],r=i?[]:null,s=new Jb(e),a=new Jb(t);for(let e=-1;;){if(s.done&&a.len||a.done&&s.len)throw new Error("Mismatched change set lengths");if(-1==s.ins&&-1==a.ins){let e=Math.min(s.len,a.len);Xb(o,e,-1),s.forward(e),a.forward(e)}else if(a.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(a.len<s.len||a.len==s.len&&!n))){let t=a.len;for(Xb(o,a.ins,-1);t;){let n=Math.min(s.len,t);s.ins>=0&&e<s.i&&s.len<=n&&(Xb(o,0,s.ins),r&&Kb(r,o,s.text),e=s.i),s.forward(n),t-=n}a.next()}else{if(!(s.ins>=0)){if(s.done&&a.done)return r?Ub.createSet(o,r):Wb.create(o);throw new Error("Mismatched change set lengths")}{let t=0,n=s.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else{if(!(0==a.ins&&a.len<n))break;n-=a.len,a.next()}Xb(o,t,e<s.i?s.ins:0),r&&e<s.i&&Kb(r,o,s.text),e=s.i,s.forward(s.len-n)}}}}function Zb(e,t,n=!1){let i=[],o=n?[]:null,r=new Jb(e),s=new Jb(t);for(let e=!1;;){if(r.done&&s.done)return o?Ub.createSet(i,o):Wb.create(i);if(0==r.ins)Xb(i,r.len,0,e),r.next();else if(0!=s.len||s.done){if(r.done||s.done)throw new Error("Mismatched change set lengths");{let t=Math.min(r.len2,s.len),n=i.length;if(-1==r.ins){let n=-1==s.ins?-1:s.off?0:s.ins;Xb(i,t,n,e),o&&n&&Kb(o,i,s.text)}else-1==s.ins?(Xb(i,r.off?0:r.len,t,e),o&&Kb(o,i,r.textBit(t))):(Xb(i,r.off?0:r.len,s.off?0:s.ins,e),o&&!s.off&&Kb(o,i,s.text));e=(r.ins>t||s.ins>=0&&s.len>t)&&(e||i.length>n),r.forward2(t),s.forward(t)}}else Xb(i,0,s.ins,e),o&&Kb(o,i,s.text),s.next()}}class Jb{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Mb.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Mb.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class e_{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new e_(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return t_.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return t_.range(this.anchor,n)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return t_.range(e.anchor,e.head)}static create(e,t,n){return new e_(e,t,n)}}class t_{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:t_.create(this.ranges.map((n=>n.map(e,t))),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new t_([this.main],0)}addRange(e,t=!0){return t_.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,t_.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map((e=>e.toJSON())),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t_(e.ranges.map((e=>e_.fromJSON(e))),e.main)}static single(e,t=e){return new t_([t_.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let o=e[i];if(o.empty?o.from<=n:o.from<n)return t_.normalized(e.slice(),t);n=o.to}return new t_(e,t)}static cursor(e,t=0,n,i){return e_.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n))|(null!=i?i:16777215)<<6)}static range(e,t,n,i){let o=(null!=n?n:16777215)<<6|(null==i?7:Math.min(6,i));return t<e?e_.create(t,e,48|o):e_.create(e,t,(t>e?8:0)|o)}static normalized(e,t=0){let n=e[t];e.sort(((e,t)=>e.from-t.from)),t=e.indexOf(n);for(let n=1;n<e.length;n++){let i=e[n],o=e[n-1];if(i.empty?i.from<=o.to:i.from<o.to){let r=o.from,s=Math.max(i.to,o.to);n<=t&&t--,e.splice(--n,2,i.anchor>i.head?t_.range(s,r):t_.range(r,s))}}return new t_(e,t)}}function n_(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let i_=0;class o_{constructor(e,t,n,i,o){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=i_++,this.default=e([]),this.extensions="function"==typeof o?o(this):o}get reader(){return this}static define(e={}){return new o_(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:r_),!!e.static,e.enables)}of(e){return new s_([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new s_(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new s_(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],(n=>t(n.field(e))))}}function r_(e,t){return e==t||e.length==t.length&&e.every(((e,n)=>e===t[n]))}class s_{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=i_++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,o=this.id,r=e[o]>>1,s=2==this.type,a=!1,l=!1,c=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||c.push(e[n.id]);return{create:e=>(e.values[r]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||l_(e,c)){let t=n(e);if(s?!a_(t,e.values[r],i):!i(t,e.values[r]))return e.values[r]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[o];if(null!=l){let o=C_(t,l);if(this.dependencies.every((n=>n instanceof o_?t.facet(n)===e.facet(n):!(n instanceof h_)||t.field(n,!1)==e.field(n,!1)))||(s?a_(a=n(e),o,i):i(a=n(e),o)))return e.values[r]=o,0}else a=n(e);return e.values[r]=a,1}}}}function a_(e,t,n){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}function l_(e,t){let n=!1;for(let i of t)1&w_(e,i)&&(n=!0);return n}function c_(e,t,n){let i=n.map((t=>e[t.id])),o=n.map((e=>e.type)),r=i.filter((e=>!(1&e))),s=e[t.id]>>1;function a(e){let n=[];for(let t=0;t<i.length;t++){let r=C_(e,i[t]);if(2==o[t])for(let e of r)n.push(e);else n.push(r)}return t.combine(n)}return{create(e){for(let t of i)w_(e,t);return e.values[s]=a(e),1},update(e,n){if(!l_(e,r))return 0;let i=a(e);return t.compare(i,e.values[s])?0:(e.values[s]=i,1)},reconfigure(e,o){let r=l_(e,i),l=o.config.facets[t.id],c=o.facet(t);if(l&&!r&&r_(n,l))return e.values[s]=c,0;let u=a(e);return t.compare(u,c)?(e.values[s]=c,0):(e.values[s]=u,1)}}}const u_=o_.define({static:!0});class h_{constructor(e,t,n,i,o){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=o,this.provides=void 0}static define(e){let t=new h_(i_++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(u_).find((e=>e.field==this));return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let i=e.values[t],o=this.updateF(i,n);return this.compareF(i,o)?0:(e.values[t]=o,1)},reconfigure:(e,n)=>null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}init(e){return[this,u_.of({field:this,create:e})]}get extension(){return this}}const d_=4,p_=3,f_=2,g_=1;function m_(e){return t=>new y_(t,e)}const v_={highest:m_(0),high:m_(g_),default:m_(f_),low:m_(p_),lowest:m_(d_)};class y_{constructor(e,t){this.inner=e,this.prec=t}}class x_{of(e){return new b_(this,e)}reconfigure(e){return x_.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class b_{constructor(e,t){this.compartment=e,this.inner=t}}class __{constructor(e,t,n,i,o,r){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=o,this.facets=r,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let i=[],o=Object.create(null),r=new Map;for(let n of function(e,t,n){let i=[[],[],[],[],[]],o=new Map;function r(e,s){let a=o.get(e);if(null!=a){if(a<=s)return;let t=i[a].indexOf(e);t>-1&&i[a].splice(t,1),e instanceof b_&&n.delete(e.compartment)}if(o.set(e,s),Array.isArray(e))for(let t of e)r(t,s);else if(e instanceof b_){if(n.has(e.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=t.get(e.compartment)||e.inner;n.set(e.compartment,i),r(i,s)}else if(e instanceof y_)r(e.inner,e.prec);else if(e instanceof h_)i[s].push(e),e.provides&&r(e.provides,s);else if(e instanceof s_)i[s].push(e),e.facet.extensions&&r(e.facet.extensions,f_);else{let t=e.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(t,s)}}return r(e,f_),i.reduce(((e,t)=>e.concat(t)))}(e,t,r))n instanceof h_?i.push(n):(o[n.facet.id]||(o[n.facet.id]=[])).push(n);let s=Object.create(null),a=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push((t=>e.slot(t)));let c=null==n?void 0:n.config.facets;for(let e in o){let t=o[e],i=t[0].facet,r=c&&c[e]||[];if(t.every((e=>0==e.type)))if(s[i.id]=a.length<<1|1,r_(r,t))a.push(n.facet(i));else{let e=i.combine(t.map((e=>e.value)));a.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(s[e.id]=a.length<<1|1,a.push(e.value)):(s[e.id]=l.length<<1,l.push((t=>e.dynamicSlot(t))));s[i.id]=l.length<<1,l.push((e=>c_(e,i,t)))}}let u=l.map((e=>e(s)));return new __(e,r,u,s,a,o)}}function w_(e,t){if(1&t)return 2;let n=t>>1,i=e.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;e.status[n]=4;let o=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|o}function C_(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const O_=o_.define(),k_=o_.define({combine:e=>e.some((e=>e)),static:!0}),E_=o_.define({combine:e=>e.length?e[0]:void 0,static:!0}),S_=o_.define(),R_=o_.define(),T_=o_.define(),M_=o_.define({combine:e=>!!e.length&&e[0]});class A_{constructor(e,t){this.type=e,this.value=t}static define(){return new P_}}class P_{of(e){return new A_(this,e)}}class D_{constructor(e){this.map=e}of(e){return new $_(this,e)}}class $_{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new $_(this.type,t)}is(e){return this.type==e}static define(e={}){return new D_(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let e=i.map(t);e&&n.push(e)}return n}}$_.reconfigure=$_.define(),$_.appendConfig=$_.define();class j_{constructor(e,t,n,i,o,r){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=o,this.scrollIntoView=r,this._doc=null,this._state=null,n&&n_(n,t.newLength),o.some((e=>e.type==j_.time))||(this.annotations=o.concat(j_.time.of(Date.now())))}static create(e,t,n,i,o,r){return new j_(e,t,n,i,o,r)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(j_.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function I_(e,t){let n=[];for(let i=0,o=0;;){let r,s;if(i<e.length&&(o==t.length||t[o]>=e[i]))r=e[i++],s=e[i++];else{if(!(o<t.length))return n;r=t[o++],s=t[o++]}!n.length||n[n.length-1]<r?n.push(r,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function B_(e,t,n){var i;let o,r,s;return n?(o=t.changes,r=Ub.empty(t.changes.length),s=e.changes.compose(t.changes)):(o=t.changes.map(e.changes),r=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(o)),{changes:s,selection:t.selection?t.selection.map(r):null===(i=e.selection)||void 0===i?void 0:i.map(o),effects:$_.mapEffects(e.effects,o).concat($_.mapEffects(t.effects,r)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function L_(e,t,n){let i=t.selection,o=V_(t.annotations);return t.userEvent&&(o=o.concat(j_.userEvent.of(t.userEvent))),{changes:t.changes instanceof Ub?t.changes:Ub.of(t.changes||[],n,e.facet(E_)),selection:i&&(i instanceof t_?i:t_.single(i.anchor,i.head)),effects:V_(t.effects),annotations:o,scrollIntoView:!!t.scrollIntoView}}function N_(e,t,n){let i=L_(e,t.length?t[0]:{},e.doc.length);t.length&&!1===t[0].filter&&(n=!1);for(let o=1;o<t.length;o++){!1===t[o].filter&&(n=!1);let r=!!t[o].sequential;i=B_(i,L_(e,t[o],r?i.changes.newLength:e.doc.length),r)}let o=j_.create(e,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(e){let t=e.startState,n=t.facet(T_),i=e;for(let o=n.length-1;o>=0;o--){let r=n[o](e);r&&Object.keys(r).length&&(i=B_(i,L_(t,r,e.changes.newLength),!0))}return i==e?e:j_.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let i of t.facet(S_)){let t=i(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:I_(n,t))}if(!0!==n){let i,o;if(!1===n)o=e.changes.invertedDesc,i=Ub.empty(t.doc.length);else{let t=e.changes.filter(n);i=t.changes,o=t.filtered.mapDesc(t.changes).invertedDesc}e=j_.create(t,i,e.selection&&e.selection.map(o),$_.mapEffects(e.effects,o),e.annotations,e.scrollIntoView)}let i=t.facet(R_);for(let n=i.length-1;n>=0;n--){let o=i[n](e);e=o instanceof j_?o:Array.isArray(o)&&1==o.length&&o[0]instanceof j_?o[0]:N_(t,V_(o),!1)}return e}(o):o)}j_.time=A_.define(),j_.userEvent=A_.define(),j_.addToHistory=A_.define(),j_.remote=A_.define();const q_=[];function V_(e){return null==e?q_:Array.isArray(e)?e:[e]}var F_=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(F_||(F_={}));const z_=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Q_;try{Q_=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(Ih){}function H_(e){return t=>{if(!/\S/.test(t))return F_.Space;if(function(e){if(Q_)return Q_.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||z_.test(n)))return!0}return!1}(t))return F_.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return F_.Word;return F_.Other}}class W_{constructor(e,t,n,i,o,r){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=o,r&&(r._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)w_(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null!=n)return w_(this,n),C_(this,n);if(t)throw new RangeError("Field is not present in this state")}update(...e){return N_(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:i,compartments:o}=n;for(let t of e.effects)t.is(x_.reconfigure)?(n&&(o=new Map,n.compartments.forEach(((e,t)=>o.set(t,e))),n=null),o.set(t.value.compartment,t.value.extension)):t.is($_.reconfigure)?(n=null,i=t.value):t.is($_.appendConfig)&&(n=null,i=V_(i).concat(t.value));if(n)t=e.startState.values.slice();else{n=__.resolve(i,o,this),t=new W_(n,this.doc,this.selection,n.dynamicSlots.map((()=>null)),((e,t)=>t.reconfigure(e,this)),null).values}let r=e.startState.facet(k_)?e.newSelection:e.newSelection.asSingle();new W_(n,e.newDoc,r,t,((t,n)=>n.update(t,e)),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:e},range:t_.cursor(t.from+e.length)})))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),o=[n.range],r=V_(n.effects);for(let n=1;n<t.ranges.length;n++){let s=e(t.ranges[n]),a=this.changes(s.changes),l=a.map(i);for(let e=0;e<n;e++)o[e]=o[e].map(l);let c=i.mapDesc(a,!0);o.push(s.range.map(c)),i=i.compose(l),r=$_.mapEffects(r,l).concat($_.mapEffects(V_(s.effects),c))}return{changes:i,selection:t_.create(o,t.mainIndex),effects:r}}changes(e=[]){return e instanceof Ub?e:Ub.of(e,this.doc.length,this.facet(W_.lineSeparator))}toText(e){return Mb.of(e.split(this.facet(W_.lineSeparator)||Qb))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(w_(this,t),C_(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof h_&&null!=this.config.address[i.id]&&(t[n]=i.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n)for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)){let o=n[t],r=e[t];i.push(o.init((e=>o.spec.fromJSON(r,e))))}return W_.create({doc:e.doc,selection:t_.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=__.resolve(e.extensions||[],new Map),n=e.doc instanceof Mb?e.doc:Mb.of((e.doc||"").split(t.staticFacet(W_.lineSeparator)||Qb)),i=e.selection?e.selection instanceof t_?e.selection:t_.single(e.selection.anchor,e.selection.head):t_.single(0);return n_(i,n.length),t.staticFacet(k_)||(i=i.asSingle()),new W_(t,n,i,t.dynamicSlots.map((()=>null)),((e,t)=>t.create(e)),null)}get tabSize(){return this.facet(W_.tabSize)}get lineBreak(){return this.facet(W_.lineSeparator)||"\n"}get readOnly(){return this.facet(M_)}phrase(e,...t){for(let t of this.facet(W_.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,((e,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>t.length?e:t[i-1]}))),e}languageDataAt(e,t,n=-1){let i=[];for(let o of this.facet(O_))for(let r of o(this,t,n))Object.prototype.hasOwnProperty.call(r,e)&&i.push(r[e]);return i}charCategorizer(e){return H_(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),o=this.charCategorizer(e),r=e-n,s=e-n;for(;r>0;){let e=qb(t,r,!1);if(o(t.slice(e,r))!=F_.Word)break;r=e}for(;s<i;){let e=qb(t,s);if(o(t.slice(s,e))!=F_.Word)break;s=e}return r==s?null:t_.range(r+n,s+n)}}function U_(e,t,n={}){let i={};for(let t of e)for(let e of Object.keys(t)){let o=t[e],r=i[e];if(void 0===r)i[e]=o;else if(r===o||void 0===o);else{if(!Object.hasOwnProperty.call(n,e))throw new Error("Config merge conflict for field "+e);i[e]=n[e](r,o)}}for(let e in t)void 0===i[e]&&(i[e]=t[e]);return i}W_.allowMultipleSelections=k_,W_.tabSize=o_.define({combine:e=>e.length?e[0]:4}),W_.lineSeparator=E_,W_.readOnly=M_,W_.phrases=o_.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every((n=>e[n]==t[n]))}}),W_.languageData=O_,W_.changeFilter=S_,W_.transactionFilter=R_,W_.transactionExtender=T_,x_.reconfigure=$_.define();class X_{eq(e){return this==e}range(e,t=e){return K_.create(e,t,this)}}X_.prototype.startSide=X_.prototype.endSide=0,X_.prototype.point=!1,X_.prototype.mapMode=Hb.TrackDel;let K_=class e{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(t,n,i){return new e(t,n,i)}};function G_(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class Y_{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let o=n?this.to:this.from;for(let r=i,s=o.length;;){if(r==s)return r;let i=r+s>>1,a=o[i]-e||(n?this.value[i].endSide:this.value[i].startSide)-t;if(i==r)return a>=0?r:s;a>=0?s=i:r=i+1}}between(e,t,n,i){for(let o=this.findIndex(t,-1e9,!0),r=this.findIndex(n,1e9,!1,o);o<r;o++)if(!1===i(this.from[o]+e,this.to[o]+e,this.value[o]))return!1}map(e,t){let n=[],i=[],o=[],r=-1,s=-1;for(let a=0;a<this.value.length;a++){let l,c,u=this.value[a],h=this.from[a]+e,d=this.to[a]+e;if(h==d){let e=t.mapPos(h,u.startSide,u.mapMode);if(null==e)continue;if(l=c=e,u.startSide!=u.endSide&&(c=t.mapPos(h,u.endSide),c<l))continue}else if(l=t.mapPos(h,u.startSide),c=t.mapPos(d,u.endSide),l>c||l==c&&u.startSide>0&&u.endSide<=0)continue;(c-l||u.endSide-u.startSide)<0||(r<0&&(r=l),u.point&&(s=Math.max(s,c-l)),n.push(u),i.push(l-r),o.push(c-r))}return{mapped:n.length?new Y_(i,o,n,s):null,pos:r}}}class Z_{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new Z_(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:o=this.length}=e,r=e.filter;if(0==t.length&&!r)return this;if(n&&(t=t.slice().sort(G_)),this.isEmpty)return t.length?Z_.of(t):this;let s=new tw(this,null,-1).goto(0),a=0,l=[],c=new J_;for(;s.value||a<t.length;)if(a<t.length&&(s.from-t[a].from||s.startSide-t[a].value.startSide)>=0){let e=t[a++];c.addInner(e.from,e.to,e.value)||l.push(e)}else 1==s.rangeIndex&&s.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(s.chunkIndex)<t[a].from)&&(!r||i>this.chunkEnd(s.chunkIndex)||o<this.chunkPos[s.chunkIndex])&&c.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!r||i>s.to||o<s.from||r(s.from,s.to,s.value))&&(c.addInner(s.from,s.to,s.value)||l.push(K_.create(s.from,s.to,s.value))),s.next());return c.finishInner(this.nextLayer.isEmpty&&!l.length?Z_.empty:this.nextLayer.update({add:l,filter:r,filterFrom:i,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1;for(let o=0;o<this.chunk.length;o++){let r=this.chunkPos[o],s=this.chunk[o],a=e.touchesRange(r,r+s.length);if(!1===a)i=Math.max(i,s.maxPoint),t.push(s),n.push(e.mapPos(r));else if(!0===a){let{mapped:o,pos:a}=s.map(r,e);o&&(i=Math.max(i,o.maxPoint),t.push(o),n.push(a))}}let o=this.nextLayer.map(e);return 0==t.length?o:new Z_(n,t,o||Z_.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let o=this.chunkPos[i],r=this.chunk[i];if(t>=o&&e<=o+r.length&&!1===r.between(o,e-o,t-o,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return nw.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return nw.from(e).goto(t)}static compare(e,t,n,i,o=-1){let r=e.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=o)),s=t.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=o)),a=ew(r,s,n),l=new ow(r,a,o),c=new ow(s,a,o);n.iterGaps(((e,t,n)=>rw(l,e,c,t,n,i))),n.empty&&0==n.length&&rw(l,0,c,0,0,i)}static eq(e,t,n=0,i){null==i&&(i=999999999);let o=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0)),r=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0));if(o.length!=r.length)return!1;if(!o.length)return!0;let s=ew(o,r),a=new ow(o,s,0).goto(n),l=new ow(r,s,0).goto(n);for(;;){if(a.to!=l.to||!sw(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>i)return!0;a.next(),l.next()}}static spans(e,t,n,i,o=-1){let r=new ow(e,null,o).goto(t),s=t,a=r.openStart;for(;;){let e=Math.min(r.to,n);if(r.point){let n=r.activeForPoint(r.to),o=r.pointFrom<t?n.length+1:r.point.startSide<0?n.length:Math.min(n.length,a);i.point(s,e,r.point,n,o,r.pointRank),a=Math.min(r.openEnd(e),n.length)}else e>s&&(i.span(s,e,r.active,a),a=r.openEnd(e));if(r.to>n)return a+(r.point&&r.to>n?1:0);s=r.to,r.next()}}static of(e,t=!1){let n=new J_;for(let i of e instanceof K_?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let i=e[n];if(G_(t,i)>0)return e.slice().sort(G_);t=i}return e}(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return Z_.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=Z_.empty;i=i.nextLayer)t=new Z_(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}Z_.empty=new Z_([],[],null,-1),Z_.empty.nextLayer=Z_.empty;class J_{finishChunk(e){this.chunks.push(new Y_(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new J_)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Z_.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=Z_.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function ew(e,t,n){let i=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&i.set(t.chunk[e],t.chunkPos[e]);let o=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let r=i.get(e.chunk[t]);null==r||(n?n.mapPos(r):r)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(r,r+e.chunk[t].length))||o.add(e.chunk[t])}return o}class tw{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class nw{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let o=0;o<e.length;o++)for(let r=e[o];!r.isEmpty;r=r.nextLayer)r.maxPoint>=n&&i.push(new tw(r,t,n,o));return 1==i.length?i[0]:new nw(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)iw(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)iw(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),iw(this.heap,0)}}}function iw(e,t){for(let n=e[t];;){let i=1+(t<<1);if(i>=e.length)break;let o=e[i];if(i+1<e.length&&o.compare(e[i+1])>=0&&(o=e[i+1],i++),n.compare(o)<0)break;e[i]=n,e[t]=o,t=i}}class ow{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=nw.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){aw(this.active,e),aw(this.activeTo,e),aw(this.activeRank,e),this.minActive=cw(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:o}=this.cursor;for(;t<this.activeRank.length&&(o-this.activeRank[t]||i-this.activeTo[t])>0;)t++;lw(this.active,t,n),lw(this.activeTo,t,i),lw(this.activeRank,t,o),e&&lw(e,t,this.cursor.from),this.minActive=cw(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&aw(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function rw(e,t,n,i,o,r){e.goto(t),n.goto(i);let s=i+o,a=i,l=i-t;for(;;){let t=e.to+l-n.to,i=t||e.endSide-n.endSide,o=i<0?e.to+l:n.to,c=Math.min(o,s);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&sw(e.activeForPoint(e.to),n.activeForPoint(n.to))||r.comparePoint(a,c,e.point,n.point):c>a&&!sw(e.active,n.active)&&r.compareRange(a,c,e.active,n.active),o>s)break;(t||e.openEnd!=n.openEnd)&&r.boundChange&&r.boundChange(o),a=o,i<=0&&e.next(),i>=0&&n.next()}}function sw(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!e[n].eq(t[n]))return!1;return!0}function aw(e,t){for(let n=t,i=e.length-1;n<i;n++)e[n]=e[n+1];e.pop()}function lw(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function cw(e,t){let n=-1,i=1e9;for(let o=0;o<t.length;o++)(t[o]-i||e[o].endSide-e[n].endSide)<0&&(n=o,i=t[o]);return n}function uw(e,t,n=e.length){let i=0;for(let o=0;o<n&&o<e.length;)9==e.charCodeAt(o)?(i+=t-i%t,o++):(i++,o=qb(e,o));return i}const hw="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),dw="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),pw="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class fw{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function o(e,t,r,s){let a=[],l=/^@(\w+)\b/.exec(e[0]),c=l&&"keyframes"==l[1];if(l&&null==t)return r.push(e[0]+";");for(let n in t){let s=t[n];if(/&/.test(n))o(n.split(/,\s*/).map((t=>e.map((e=>t.replace(/&/,e))))).reduce(((e,t)=>e.concat(t))),s,r);else if(s&&"object"==typeof s){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");o(i(n),s,a,c)}else null!=s&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))+": "+s+";")}(a.length||c)&&r.push((!n||l||s?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)o(i(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=pw[hw]||1;return pw[hw]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[dw],o=n&&n.nonce;i?o&&i.setNonce(o):i=new mw(e,o),i.mount(Array.isArray(t)?t:[t],e)}}let gw=new Map;class mw{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let t=gw.get(n);if(t)return e[dw]=t;this.sheet=new i.CSSStyleSheet,gw.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[dw]=this}mount(e,t){let n=this.sheet,i=0,o=0;for(let t=0;t<e.length;t++){let r=e[t],s=this.modules.indexOf(r);if(s<o&&s>-1&&(this.modules.splice(s,1),o--,s=-1),-1==s){if(this.modules.splice(o++,0,r),n)for(let e=0;e<r.rules.length;e++)n.insertRule(r.rules[e],i++)}else{for(;o<s;)i+=this.modules[o++].rules.length;i+=r.rules.length,o++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var vw={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},yw={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},xw="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),bw="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),_w=0;_w<10;_w++)vw[48+_w]=vw[96+_w]=String(_w);for(_w=1;_w<=24;_w++)vw[_w+111]="F"+_w;for(_w=65;_w<=90;_w++)vw[_w]=String.fromCharCode(_w+32),yw[_w]=String.fromCharCode(_w);for(var ww in vw)yw.hasOwnProperty(ww)||(yw[ww]=vw[ww]);function Cw(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Ow(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function kw(e,t){if(!t.anchorNode)return!1;try{return Ow(e,t.anchorNode)}catch(e){return!1}}function Ew(e){return 3==e.nodeType?Nw(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function Sw(e,t,n,i){return!!n&&(Mw(e,t,n,i,-1)||Mw(e,t,n,i,1))}function Rw(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function Tw(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function Mw(e,t,n,i,o){for(;;){if(e==n&&t==i)return!0;if(t==(o<0?0:Aw(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=Rw(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(o<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=o<0?Aw(e):0}}}function Aw(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Pw(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function Dw(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function $w(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}class jw{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?Aw(t):0),n,Math.min(e.focusOffset,n?Aw(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let Iw,Bw=null;function Lw(e){if(e.setActive)return e.setActive();if(Bw)return e.focus(Bw);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==Bw?{get preventScroll(){return Bw={preventScroll:!0},!0}}:void 0),!Bw){Bw=!1;for(let e=0;e<t.length;){let n=t[e++],i=t[e++],o=t[e++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=o&&(n.scrollLeft=o)}}}function Nw(e,t,n=t){let i=Iw||(Iw=document.createRange());return i.setEnd(e,n),i.setStart(e,t),i}function qw(e,t,n,i){let o={key:t,code:t,keyCode:n,which:n,cancelable:!0};i&&({altKey:o.altKey,ctrlKey:o.ctrlKey,shiftKey:o.shiftKey,metaKey:o.metaKey}=i);let r=new KeyboardEvent("keydown",o);r.synthetic=!0,e.dispatchEvent(r);let s=new KeyboardEvent("keyup",o);return s.synthetic=!0,e.dispatchEvent(s),r.defaultPrevented||s.defaultPrevented}function Vw(e){for(;e.attributes.length;)e.removeAttributeNode(e.attributes[0])}function Fw(e){return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function zw(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i>0)return{node:n,offset:i};if(1==n.nodeType&&i>0){if("false"==n.contentEditable)return null;n=n.childNodes[i-1],i=Aw(n)}else{if(!n.parentNode||Tw(n))return null;i=Rw(n),n=n.parentNode}}}function Qw(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i<n.nodeValue.length)return{node:n,offset:i};if(1==n.nodeType&&i<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[i],i=0}else{if(!n.parentNode||Tw(n))return null;i=Rw(n)+1,n=n.parentNode}}}class Hw{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Hw(e.parentNode,Rw(e),t)}static after(e,t){return new Hw(e.parentNode,Rw(e)+1,t)}}const Ww=[];class Uw{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(2&this.flags){let n,i=this.dom,o=null;for(let r of this.children){if(7&r.flags){if(!r.dom&&(n=o?o.nextSibling:i.firstChild)){let e=Uw.get(n);(!e||!e.parent&&e.canReuseDOM(r))&&r.reuseDOM(n)}r.sync(e,t),r.flags&=-8}if(n=o?o.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&n!=r.dom&&(t.written=!0),r.dom.parentNode==i)for(;n&&n!=r.dom;)n=Xw(n);else i.insertBefore(r.dom,n);o=r.dom}for(n=o?o.nextSibling:i.firstChild,n&&t&&t.node==i&&(t.written=!0);n;)n=Xw(n)}else if(1&this.flags)for(let n of this.children)7&n.flags&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let i=0==Aw(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==this.dom)break;0==i&&t.firstChild!=t.lastChild&&(i=e==t.firstChild?-1:1),e=t}n=i<0?e:e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!Uw.get(n);)n=n.nextSibling;if(!n)return this.length;for(let e=0,t=0;;e++){let i=this.children[e];if(i.dom==n)return t;t+=i.length+i.breakAfter}}domBoundsAround(e,t,n=0){let i=-1,o=-1,r=-1,s=-1;for(let a=0,l=n,c=n;a<this.children.length;a++){let n=this.children[a],u=l+n.length;if(l<e&&u>t)return n.domBoundsAround(e,t,l);if(u>=e&&-1==i&&(i=a,o=l),l>t&&n.dom.parentNode==this.dom){r=a,s=c;break}c=u,l=u+n.breakAfter}return{from:o,to:s<0?n+this.length:s,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:r<this.children.length&&r>=0?this.children[r].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),1&t.flags)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,7&this.flags&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=Ww){this.markDirty();for(let i=e;i<t;i++){let e=this.children[i];e.parent==this&&n.indexOf(e)<0&&e.destroy()}n.length<250?this.children.splice(e,t-e,...n):this.children=[].concat(this.children.slice(0,e),n,this.children.slice(t));for(let e=0;e<n.length;e++)n[e].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Kw(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==e?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,n,i,o,r){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!(8&(this.flags|e.flags))}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}function Xw(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}Uw.prototype.breakAfter=0;class Kw{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Gw(e,t,n,i,o,r,s,a,l){let{children:c}=e,u=c.length?c[t]:null,h=r.length?r[r.length-1]:null,d=h?h.breakAfter:s;if(!(t==i&&u&&!s&&!d&&r.length<2&&u.merge(n,o,r.length?h:null,0==n,a,l))){if(i<c.length){let e=c[i];e&&(o<e.length||e.breakAfter&&(null==h?void 0:h.breakAfter))?(t==i&&(e=e.split(o),o=0),!d&&h&&e.merge(0,o,h,!0,0,l)?r[r.length-1]=e:((o||e.children.length&&!e.children[0].length)&&e.merge(0,o,null,!1,0,l),r.push(e))):(null==e?void 0:e.breakAfter)&&(h?h.breakAfter=1:s=1),i++}for(u&&(u.breakAfter=s,n>0&&(!s&&r.length&&u.merge(n,u.length,r[0],!1,a,0)?u.breakAfter=r.shift().breakAfter:(n<u.length||u.children.length&&0==u.children[u.children.length-1].length)&&u.merge(n,u.length,null,!1,a,0),t++));t<i&&r.length;)if(c[i-1].become(r[r.length-1]))i--,r.pop(),l=r.length?0:a;else{if(!c[t].become(r[0]))break;t++,r.shift(),a=r.length?0:l}!r.length&&t&&i<c.length&&!c[t-1].breakAfter&&c[i].merge(0,0,c[t-1],!1,a,l)&&t--,(t<i||r.length)&&e.replaceChildren(t,i,r)}}function Yw(e,t,n,i,o,r){let s=e.childCursor(),{i:a,off:l}=s.findPos(n,1),{i:c,off:u}=s.findPos(t,-1),h=t-n;for(let e of i)h+=e.length;e.length+=h,Gw(e,c,u,a,l,i,0,o,r)}let Zw="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},Jw="undefined"!=typeof document?document:{documentElement:{style:{}}};const eC=/Edge\/(\d+)/.exec(Zw.userAgent),tC=/MSIE \d/.test(Zw.userAgent),nC=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Zw.userAgent),iC=!!(tC||nC||eC),oC=!iC&&/gecko\/(\d+)/i.test(Zw.userAgent),rC=!iC&&/Chrome\/(\d+)/.exec(Zw.userAgent),sC="webkitFontSmoothing"in Jw.documentElement.style,aC=!iC&&/Apple Computer/.test(Zw.vendor),lC=aC&&(/Mobile\/\w+/.test(Zw.userAgent)||Zw.maxTouchPoints>2);var cC={mac:lC||/Mac/.test(Zw.platform),windows:/Win/.test(Zw.platform),linux:/Linux|X11/.test(Zw.platform),ie:iC,ie_version:tC?Jw.documentMode||6:nC?+nC[1]:eC?+eC[1]:0,gecko:oC,gecko_version:oC?+(/Firefox\/(\d+)/.exec(Zw.userAgent)||[0,0])[1]:0,chrome:!!rC,chrome_version:rC?+rC[1]:0,ios:lC,android:/Android\b/.test(Zw.userAgent),webkit:sC,safari:aC,webkit_version:sC?+(/\bAppleWebKit\/(\d+)/.exec(Zw.userAgent)||[0,0])[1]:0,tabSize:null!=Jw.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class uC extends Uw{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){3==e.nodeType&&this.createDOM(e)}merge(e,t,n){return!(8&this.flags||n&&(!(n instanceof uC)||this.length-(t-e)+n.length>256||8&n.flags))&&(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new uC(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=8&this.flags,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Hw(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return function(e,t,n){let i=e.nodeValue.length;t>i&&(t=i);let o=t,r=t,s=0;0==t&&n<0||t==i&&n>=0?cC.chrome||cC.gecko||(t?(o--,s=1):r<i&&(r++,s=-1)):n<0?o--:r<i&&r++;let a=Nw(e,o,r).getClientRects();if(!a.length)return null;let l=a[(s?s<0:n>=0)?0:a.length-1];cC.safari&&!s&&0==l.width&&(l=Array.prototype.find.call(a,(e=>e.width))||l);return s?Pw(l,s<0):l||null}(this.dom,e,t)}}class hC extends Uw{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let e of t)e.setParent(this)}setAttrs(e){if(Vw(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!(8&(this.flags|e.flags))}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,i,o,r){return(!n||!(!(n instanceof hC&&n.mark.eq(this.mark))||e&&o<=0||t<this.length&&r<=0))&&(Yw(this,e,t,n?n.children.slice():[],o-1,r-1),this.markDirty(),!0)}split(e){let t=[],n=0,i=-1,o=0;for(let r of this.children){let s=n+r.length;s>e&&t.push(n<e?r.split(e-n):r),i<0&&n>=e&&(i=o),n=s,o++}let r=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new hC(this.mark,t,r)}domAtPos(e){return fC(this,e)}coordsAt(e,t){return mC(this,e,t)}}class dC extends Uw{static create(e,t,n){return new dC(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=dC.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,i,o,r){return!(n&&(!(n instanceof dC&&this.widget.compare(n.widget))||e>0&&o<=0||t<this.length&&r<=0))&&(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof dC&&e.side==this.side&&this.widget.constructor==e.widget.constructor&&(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0)}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(0==this.length)return Mb.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,i=this.posAtStart;return n?n.slice(i,i+this.length):Mb.empty}domAtPos(e){return(this.length?0==e:this.side>0)?Hw.before(this.dom):Hw.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let i=this.dom.getClientRects(),o=null;if(!i.length)return null;let r=this.side?this.side<0:e>0;for(let t=r?i.length-1:0;o=i[t],!(e>0?0==t:t==i.length-1||o.top<o.bottom);t+=r?-1:1);return Pw(o,!r)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class pC extends Uw{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof pC&&e.side==this.side}split(){return new pC(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Hw.before(this.dom):Hw.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Mb.empty}get isHidden(){return!0}}function fC(e,t){let n=e.dom,{children:i}=e,o=0;for(let e=0;o<i.length;o++){let r=i[o],s=e+r.length;if(!(s==e&&r.getSide()<=0)){if(t>e&&t<s&&r.dom.parentNode==n)return r.domAtPos(t-e);if(t<=e)break;e=s}}for(let e=o;e>0;e--){let t=i[e-1];if(t.dom.parentNode==n)return t.domAtPos(t.length)}for(let e=o;e<i.length;e++){let t=i[e];if(t.dom.parentNode==n)return t.domAtPos(0)}return new Hw(n,0)}function gC(e,t,n){let i,{children:o}=e;n>0&&t instanceof hC&&o.length&&(i=o[o.length-1])instanceof hC&&i.mark.eq(t.mark)?gC(i,t.children[0],n-1):(o.push(t),t.setParent(e)),e.length+=t.length}function mC(e,t,n){let i=null,o=-1,r=null,s=-1;!function e(t,a){for(let l=0,c=0;l<t.children.length&&c<=a;l++){let u=t.children[l],h=c+u.length;h>=a&&(u.children.length?e(u,a-c):(!r||r.isHidden&&n>0)&&(h>a||c==h&&u.getSide()>0)?(r=u,s=a-c):(c<a||c==h&&u.getSide()<0&&!u.isHidden)&&(i=u,o=a-c)),c=h}}(e,t);let a=(n<0?i:r)||i||r;return a?a.coordsAt(Math.max(0,a==i?o:s),n):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Ew(t);return n[n.length-1]||null}(e)}function vC(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}uC.prototype.children=dC.prototype.children=pC.prototype.children=Ww;const yC=Object.create(null);function xC(e,t,n){if(e==t)return!0;e||(e=yC),t||(t=yC);let i=Object.keys(e),o=Object.keys(t);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=o.length-(n&&o.indexOf(n)>-1?1:0))return!1;for(let r of i)if(r!=n&&(-1==o.indexOf(r)||e[r]!==t[r]))return!1;return!0}function bC(e,t,n){let i=!1;if(t)for(let o in t)n&&o in n||(i=!0,"style"==o?e.style.cssText="":e.removeAttribute(o));if(n)for(let o in n)t&&t[o]==n[o]||(i=!0,"style"==o?e.style.cssText=n[o]:e.setAttribute(o,n[o]));return i}function _C(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let i=e.attributes[n];t[i.name]=i.value}return t}class wC{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var CC=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(CC||(CC={}));class OC extends X_{constructor(e,t,n,i){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new kC(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new SC(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,i=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:o,end:r}=RC(e,i);t=(o?i?-3e8:-1:5e8)-1,n=1+(r?i?2e8:1:-6e8)}return new SC(e,t,n,i,e.widget||null,!0)}static line(e){return new EC(e)}static set(e,t=!1){return Z_.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}OC.none=Z_.empty;class kC extends OC{constructor(e){let{start:t,end:n}=RC(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof kC&&this.tagName==e.tagName&&(this.class||(null===(t=this.attrs)||void 0===t?void 0:t.class))==(e.class||(null===(n=e.attrs)||void 0===n?void 0:n.class))&&xC(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}kC.prototype.point=!1;class EC extends OC{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof EC&&this.spec.class==e.spec.class&&xC(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}EC.prototype.mapMode=Hb.TrackBefore,EC.prototype.point=!0;class SC extends OC{constructor(e,t,n,i,o,r){super(t,n,o,e),this.block=i,this.isReplace=r,this.mapMode=i?t<=0?Hb.TrackBefore:Hb.TrackAfter:Hb.TrackDel}get type(){return this.startSide!=this.endSide?CC.WidgetRange:this.startSide<=0?CC.WidgetBefore:CC.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof SC&&function(e,t){return e==t||!!(e&&t&&e.compare(t))}(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function RC(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;return null==n&&(n=e.inclusive),null==i&&(i=e.inclusive),{start:null!=n?n:t,end:null!=i?i:t}}function TC(e,t,n,i=0){let o=n.length-1;o>=0&&n[o]+i>=e?n[o]=Math.max(n[o],t):n.push(e,t)}SC.prototype.point=!0;class MC extends Uw{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,i,o,r){if(n){if(!(n instanceof MC))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),Yw(this,e,t,n?n.children.slice():[],o,r),!0}split(e){let t=new MC;if(t.breakAfter=this.breakAfter,0==this.length)return t;let{i:n,off:i}=this.childPos(e);i&&(t.append(this.children[n].split(i),0),this.children[n].merge(i,this.children[n].length,null,!1,0,0),n++);for(let e=n;e<this.children.length;e++)t.append(this.children[e],0);for(;n>0&&0==this.children[n-1].length;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){xC(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){gC(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=vC(t,this.attrs||{})),n&&(this.attrs=vC({class:n},this.attrs||{}))}domAtPos(e){return fC(this,e)}reuseDOM(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?4&this.flags&&(Vw(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(bC(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let i=this.dom.lastChild;for(;i&&Uw.get(i)instanceof hC;)i=i.lastChild;if(!(i&&this.length&&("BR"==i.nodeName||0!=(null===(n=Uw.get(i))||void 0===n?void 0:n.isEditable)||cC.ios&&this.children.some((e=>e instanceof uC))))){let e=document.createElement("BR");e.cmIgnore=!0,this.dom.appendChild(e)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let e,t=0;for(let n of this.children){if(!(n instanceof uC)||/[^ -~]/.test(n.text))return null;let i=Ew(n.dom);if(1!=i.length)return null;t+=i[0].width,e=i[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(e,t){let n=mC(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:e}=this.parent.view.viewState,t=n.bottom-n.top;if(Math.abs(t-e.lineHeight)<2&&e.textHeight<t){let i=(t-e.textHeight)/2;return{top:n.top+i,bottom:n.bottom-i,left:n.left,right:n.left}}}return n}become(e){return e instanceof MC&&0==this.children.length&&0==e.children.length&&xC(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let n=0,i=0;n<e.children.length;n++){let o=e.children[n],r=i+o.length;if(r>=t){if(o instanceof MC)return o;if(r>t)break}i=r+o.breakAfter}return null}}class AC extends Uw{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,i,o,r){return!(n&&(!(n instanceof AC&&this.widget.compare(n.widget))||e>0&&o<=0||t<this.length&&r<=0))&&(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return 0==e?Hw.before(this.dom):Hw.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new AC(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return Ww}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Mb.empty}domBoundsAround(){return null}become(e){return e instanceof AC&&e.widget.constructor==this.widget.constructor&&(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0)}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);return n||(this.widget instanceof PC?null:Pw(this.dom.getBoundingClientRect(),this.length?0==e:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:n}=this.deco;return t!=n&&(e<0?t<0:n>0)}}class PC extends wC{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class DC{constructor(e,t,n,i){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof AC&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new MC),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append($C(new pC(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||e&&this.content.length&&this.content[this.content.length-1]instanceof AC||this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:i}=this.cursor.next(this.skip);if(this.skip=0,i)throw new Error("Ran out of text content when drawing inline views");if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}this.text=t,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append($C(new uC(this.text.slice(this.textOff,this.textOff+i)),t),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=0}}span(e,t,n,i){this.buildText(t-e,n,i),this.pos=t,this.openStart<0&&(this.openStart=i)}point(e,t,n,i,o,r){if(this.disallowBlockEffectsFor[r]&&n instanceof SC){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let s=t-e;if(n instanceof SC)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new AC(n.widget||jC.block,s,n));else{let r=dC.create(n.widget||jC.inline,s,s?0:n.startSide),a=this.atCursorPos&&!r.isEditable&&o<=i.length&&(e<t||n.startSide>0),l=!r.isEditable&&(e<t||o>i.length||n.startSide<=0),c=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),a&&(c.append($C(new pC(1),i),o),o=i.length+Math.max(0,o-i.length)),c.append($C(r,i),o),this.atCursorPos=l,this.pendingBuffer=l?e<t||o>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);s&&(this.textOff+s<=this.text.length?this.textOff+=s:(this.skip+=s-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=o)}static build(e,t,n,i,o){let r=new DC(e,t,n,o);return r.openEnd=Z_.spans(i,t,n,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function $C(e,t){for(let n of t)e=new hC(n,[e],e.length);return e}class jC extends wC{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}jC.inline=new jC("span"),jC.block=new jC("div");var IC=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(IC||(IC={}));const BC=IC.LTR,LC=IC.RTL;function NC(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const qC=NC("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),VC=NC("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),FC=Object.create(null),zC=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);FC[t]=n,FC[n]=-t}function QC(e){return e<=247?qC[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?VC[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const HC=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class WC{get dir(){return this.level%2?LC:BC}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,i){let o=-1;for(let r=0;r<e.length;r++){let s=e[r];if(s.from<=t&&s.to>=t){if(s.level==n)return r;(o<0||(0!=i?i<0?s.from<t:s.to>t:e[o].level>s.level))&&(o=r)}}if(o<0)throw new RangeError("Index out of range");return o}}function UC(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],o=t[n];if(i.from!=o.from||i.to!=o.to||i.direction!=o.direction||!UC(i.inner,o.inner))return!1}return!0}const XC=[];function KC(e,t,n,i,o,r,s){let a=i%2?2:1;if(i%2==o%2)for(let l=t,c=0;l<n;){let t=!0,u=!1;if(c==r.length||l<r[c].from){let e=XC[l];e!=a&&(t=!1,u=16==e)}let h=t||1!=a?null:[],d=t?i:i+1,p=l;e:for(;;)if(c<r.length&&p==r[c].from){if(u)break e;let f=r[c];if(!t)for(let e=f.to,t=c+1;;){if(e==n)break e;if(!(t<r.length&&r[t].from==e)){if(XC[e]==a)break e;break}e=r[t++].to}if(c++,h)h.push(f);else{f.from>l&&s.push(new WC(l,f.from,d)),GC(e,f.direction==BC!=!(d%2)?i+1:i,o,f.inner,f.from,f.to,s),l=f.to}p=f.to}else{if(p==n||(t?XC[p]!=a:XC[p]==a))break;p++}h?KC(e,l,p,i+1,o,h,s):l<p&&s.push(new WC(l,p,d)),l=p}else for(let l=n,c=r.length;l>t;){let n=!0,u=!1;if(!c||l>r[c-1].to){let e=XC[l-1];e!=a&&(n=!1,u=16==e)}let h=n||1!=a?null:[],d=n?i:i+1,p=l;e:for(;;)if(c&&p==r[c-1].to){if(u)break e;let f=r[--c];if(!n)for(let e=f.from,n=c;;){if(e==t)break e;if(!n||r[n-1].to!=e){if(XC[e-1]==a)break e;break}e=r[--n].from}if(h)h.push(f);else{f.to<l&&s.push(new WC(f.to,l,d)),GC(e,f.direction==BC!=!(d%2)?i+1:i,o,f.inner,f.from,f.to,s),l=f.from}p=f.from}else{if(p==t||(n?XC[p-1]!=a:XC[p-1]==a))break;p--}h?KC(e,p,l,i+1,o,h,s):p<l&&s.push(new WC(p,l,d)),l=p}}function GC(e,t,n,i,o,r,s){let a=t%2?2:1;!function(e,t,n,i,o){for(let r=0;r<=i.length;r++){let s=r?i[r-1].to:t,a=r<i.length?i[r].from:n,l=r?256:o;for(let t=s,n=l,i=l;t<a;t++){let o=QC(e.charCodeAt(t));512==o?o=n:8==o&&4==i&&(o=16),XC[t]=4==o?2:o,7&o&&(i=o),n=o}for(let e=s,t=l,i=l;e<a;e++){let o=XC[e];if(128==o)e<a-1&&t==XC[e+1]&&24&t?o=XC[e]=t:XC[e]=256;else if(64==o){let o=e+1;for(;o<a&&64==XC[o];)o++;let r=e&&8==t||o<n&&8==XC[o]?1==i?1:8:256;for(let t=e;t<o;t++)XC[t]=r;e=o-1}else 8==o&&1==i&&(XC[e]=1);t=o,7&o&&(i=o)}}}(e,o,r,i,a),function(e,t,n,i,o){let r=1==o?2:1;for(let s=0,a=0,l=0;s<=i.length;s++){let c=s?i[s-1].to:t,u=s<i.length?i[s].from:n;for(let t,n,i,s=c;s<u;s++)if(n=FC[t=e.charCodeAt(s)])if(n<0){for(let e=a-3;e>=0;e-=3)if(zC[e+1]==-n){let t=zC[e+2],n=2&t?o:4&t?1&t?r:o:0;n&&(XC[s]=XC[zC[e]]=n),a=e;break}}else{if(189==zC.length)break;zC[a++]=s,zC[a++]=t,zC[a++]=l}else if(2==(i=XC[s])||1==i){let e=i==o;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=zC[t+2];if(2&n)break;if(e)zC[t+2]|=2;else{if(4&n)break;zC[t+2]|=4}}}}}(e,o,r,i,a),function(e,t,n,i){for(let o=0,r=i;o<=n.length;o++){let s=o?n[o-1].to:e,a=o<n.length?n[o].from:t;for(let l=s;l<a;){let s=XC[l];if(256==s){let s=l+1;for(;;)if(s==a){if(o==n.length)break;s=n[o++].to,a=o<n.length?n[o].from:t}else{if(256!=XC[s])break;s++}let c=1==r,u=c==(1==(s<t?XC[s]:i))?c?1:2:i;for(let t=s,i=o,r=i?n[i-1].to:e;t>l;)t==r&&(t=n[--i].from,r=i?n[i-1].to:e),XC[--t]=u;l=s}else r=s,l++}}}(o,r,i,a),KC(e,o,r,t,n,i,s)}function YC(e){return[new WC(0,e,0)]}let ZC="";function JC(e,t,n,i,o){var r;let s=i.head-e.from,a=WC.find(t,s,null!==(r=i.bidiLevel)&&void 0!==r?r:-1,i.assoc),l=t[a],c=l.side(o,n);if(s==c){let e=a+=o?1:-1;if(e<0||e>=t.length)return null;l=t[a=e],s=l.side(!o,n),c=l.side(o,n)}let u=qb(e.text,s,l.forward(o,n));(u<l.from||u>l.to)&&(u=c),ZC=e.text.slice(Math.min(s,u),Math.max(s,u));let h=a==(o?t.length-1:0)?null:t[a+(o?1:-1)];return h&&u==c&&h.level+(o?0:1)<l.level?t_.cursor(h.side(!o,n)+e.from,h.forward(o,n)?1:-1,h.level):t_.cursor(u+e.from,l.forward(o,n)?-1:1,l.level)}function eO(e,t,n){for(let i=t;i<n;i++){let t=QC(e.charCodeAt(i));if(1==t)return BC;if(2==t||4==t)return LC}return BC}const tO=o_.define(),nO=o_.define(),iO=o_.define(),oO=o_.define(),rO=o_.define(),sO=o_.define(),aO=o_.define(),lO=o_.define(),cO=o_.define(),uO=o_.define({combine:e=>e.some((e=>e))}),hO=o_.define({combine:e=>e.some((e=>e))}),dO=o_.define();class pO{constructor(e,t="nearest",n="nearest",i=5,o=5,r=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=o,this.isSnapshot=r}map(e){return e.empty?this:new pO(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new pO(t_.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const fO=$_.define({map:(e,t)=>e.map(t)}),gO=$_.define();function mO(e,t,n){let i=e.facet(oO);i.length?i[0](t):window.onerror?window.onerror(String(t),n,void 0,void 0,t):n?console.error(n+":",t):console.error(t)}const vO=o_.define({combine:e=>!e.length||e[0]});let yO=0;const xO=o_.define();class bO{constructor(e,t,n,i,o){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.extension=o(this)}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:o,decorations:r}=t||{};return new bO(yO++,e,n,i,(e=>{let t=[xO.of(e)];return r&&t.push(OO.of((t=>{let n=t.plugin(e);return n?r(n):OC.none}))),o&&t.push(o(e)),t}))}static fromClass(e,t){return bO.define((t=>new e(t)),t)}}class _O{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(mO(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){mO(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){mO(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const wO=o_.define(),CO=o_.define(),OO=o_.define(),kO=o_.define(),EO=o_.define(),SO=o_.define();function RO(e,t){let n=e.state.facet(SO);if(!n.length)return n;let i=n.map((t=>t instanceof Function?t(e):t)),o=[];return Z_.spans(i,t.from,t.to,{point(){},span(e,n,i,r){let s=e-t.from,a=n-t.from,l=o;for(let e=i.length-1;e>=0;e--,r--){let n,o=i[e].spec.bidiIsolate;if(null==o&&(o=eO(t.text,s,a)),r>0&&l.length&&(n=l[l.length-1]).to==s&&n.direction==o)n.to=a,l=n.inner;else{let e={from:s,to:a,direction:o,inner:[]};l.push(e),l=e.inner}}}}),o}const TO=o_.define();function MO(e){let t=0,n=0,i=0,o=0;for(let r of e.state.facet(TO)){let s=r(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(i=Math.max(i,s.top)),null!=s.bottom&&(o=Math.max(o,s.bottom)))}return{left:t,right:n,top:i,bottom:o}}const AO=o_.define();class PO{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new PO(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let i=0,o=0,r=0,s=0;;i++){let a=i==e.length?null:e[i],l=r-s,c=a?a.fromB:1e9;for(;o<t.length&&t[o]<c;){let e=t[o],i=t[o+1],r=Math.max(s,e),a=Math.min(c,i);if(r<=a&&new PO(r+l,a+l,r,a).addToSet(n),i>c)break;o+=2}if(!a)return n;new PO(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),r=a.toA,s=a.toB}}}class DO{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Ub.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let i=[];this.changes.iterChangedRanges(((e,t,n,o)=>i.push(new PO(e,t,n,o)))),this.changedRanges=i}static create(e,t,n){return new DO(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((e=>e.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}class $O extends Uw{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=OC.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new MC],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new PO(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every((({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo))?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?i=this.domChanged.newSel.head:function(e,t){let n=!1;t&&e.iterChangedRanges(((e,i)=>{e<t.to&&i>t.from&&(n=!0)}));return n}(e.changes,this.hasComposition)||e.selectionSet||(i=e.state.selection.main.head));let o=i>-1?function(e,t,n){let i=jO(e,n);if(!i)return null;let{node:o,from:r,to:s}=i,a=o.nodeValue;if(/[\n\r]/.test(a))return null;if(e.state.doc.sliceString(i.from,i.to)!=a)return null;let l=t.invertedDesc,c=new PO(l.mapPos(r),l.mapPos(s),r,s),u=[];for(let t=o.parentNode;;t=t.parentNode){let n=Uw.get(t);if(n instanceof hC)u.push({node:t,deco:n.mark});else{if(n instanceof MC||"DIV"==t.nodeName&&t.parentNode==e.contentDOM)return{range:c,text:o,marks:u,line:t};if(t==e.contentDOM)return null;u.push({node:t,deco:new kC({inclusive:!0,attributes:_C(t),tagName:t.tagName.toLowerCase()})})}}}(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:t,to:i}=this.hasComposition;n=new PO(t,i,e.changes.mapPos(t,-1),e.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(cC.ie||cC.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let r=function(e,t,n){let i=new IO;return Z_.compare(e,t,n,i),i.changes}(this.decorations,this.updateDeco(),e.changes);return n=PO.extendWithRanges(n,r),!!(7&this.flags||0!=n.length)&&(this.updateInner(n,e.startState.doc.length,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:i}=this.view;i.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let e=cC.chrome||cC.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,e),this.flags&=-8,e&&(e.written||i.selectionRange.focusNode!=e.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((e=>e.flags&=-9));let o=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.children)e instanceof AC&&e.widget instanceof PC&&o.push(e.dom);i.updateGaps(o)}updateChildren(e,t,n){let i=n?n.range.addToSet(e.slice()):e,o=this.childCursor(t);for(let e=i.length-1;;e--){let t=e>=0?i[e]:null;if(!t)break;let r,s,a,l,{fromA:c,toA:u,fromB:h,toB:d}=t;if(n&&n.range.fromB<d&&n.range.toB>h){let e=DC.build(this.view.state.doc,h,n.range.fromB,this.decorations,this.dynamicDecorationMap),t=DC.build(this.view.state.doc,n.range.toB,d,this.decorations,this.dynamicDecorationMap);s=e.breakAtStart,a=e.openStart,l=t.openEnd;let i=this.compositionView(n);t.breakAtStart?i.breakAfter=1:t.content.length&&i.merge(i.length,i.length,t.content[0],!1,t.openStart,0)&&(i.breakAfter=t.content[0].breakAfter,t.content.shift()),e.content.length&&i.merge(0,0,e.content[e.content.length-1],!0,0,e.openEnd)&&e.content.pop(),r=e.content.concat(i).concat(t.content)}else({content:r,breakAtStart:s,openStart:a,openEnd:l}=DC.build(this.view.state.doc,h,d,this.decorations,this.dynamicDecorationMap));let{i:p,off:f}=o.findPos(u,1),{i:g,off:m}=o.findPos(c,-1);Gw(this,g,m,p,f,r,s,a,l)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(gO)&&(this.editContextFormatting=e.value)}compositionView(e){let t=new uC(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new hC(n,[t],t.length);let n=new MC;return n.append(t,0),n}fixCompositionDOM(e){let t=(e,t)=>{t.flags|=8|(t.children.some((e=>7&e.flags))?1:0),this.markedForComposition.add(t);let n=Uw.get(e);n&&n!=t&&(n.dom=null),t.setDOM(e)},n=this.childPos(e.range.fromB,1),i=this.children[n.i];t(e.line,i);for(let o=e.marks.length-1;o>=-1;o--)n=i.childPos(n.off,1),i=i.children[n.i],t(o>=0?e.marks[o].node:e.text,i)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,o=!i&&!(this.view.state.facet(vO)||this.dom.tabIndex>-1)&&kw(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||t||o))return;let r=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(s.anchor)),l=s.empty?a:this.moveToLine(this.domAtPos(s.head));if(cC.gecko&&s.empty&&!this.hasComposition&&(1==(c=a).node.nodeType&&c.node.firstChild&&(0==c.offset||"false"==c.node.childNodes[c.offset-1].contentEditable)&&(c.offset==c.node.childNodes.length||"false"==c.node.childNodes[c.offset].contentEditable))){let e=document.createTextNode("");this.view.observer.ignore((()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null))),a=l=new Hw(e,0),r=!0}var c;let u=this.view.observer.selectionRange;!r&&u.focusNode&&(Sw(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Sw(l.node,l.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,s))||(this.view.observer.ignore((()=>{cC.android&&cC.chrome&&this.dom.contains(u.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=Cw(this.view.root);if(e)if(s.empty){if(cC.gecko){let e=function(e,t){return 1!=e.nodeType?0:(t&&"false"==e.childNodes[t-1].contentEditable?1:0)|(t<e.childNodes.length&&"false"==e.childNodes[t].contentEditable?2:0)}(a.node,a.offset);if(e&&3!=e){let t=(1==e?zw:Qw)(a.node,a.offset);t&&(a=new Hw(t.node,t.offset))}}e.collapse(a.node,a.offset),null!=s.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=s.bidiLevel)}else if(e.extend){e.collapse(a.node,a.offset);try{e.extend(l.node,l.offset)}catch(e){}}else{let t=document.createRange();s.anchor>s.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}else;o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new Hw(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new Hw(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Sw(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Cw(e.root),{anchorNode:i,anchorOffset:o}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let r=MC.find(this,t.head);if(!r)return;let s=r.posAtStart;if(t.head==s||t.head==s+r.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(t.head+t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(i,o)}moveToLine(e){let t,n=this.dom;if(e.node!=n)return e;for(let i=e.offset;!t&&i<n.childNodes.length;i++){let e=Uw.get(n.childNodes[i]);e instanceof MC&&(t=e.domAtPos(0))}for(let i=e.offset-1;!t&&i>=0;i--){let e=Uw.get(n.childNodes[i]);e instanceof MC&&(t=e.domAtPos(e.length))}return t?new Hw(t.node,t.offset,!0):e}nearest(e){for(let t=e;t;){let e=Uw.get(t);if(e&&e.rootView==this)return e;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let e=this.children[t];if(n<e.length||e instanceof MC)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,i=0;for(let o=this.length,r=this.children.length-1;r>=0;r--){let s=this.children[r],a=o-s.breakAfter,l=a-s.length;if(a<e)break;if(l<=e&&(l<e||s.covers(-1))&&(a>e||s.covers(1))&&(!n||s instanceof MC&&!(n instanceof MC&&t>=0)))n=s,i=l;else if(n&&l==e&&a==e&&s instanceof AC&&Math.abs(t)<2){if(s.deco.startSide<0)break;r&&(n=null)}o=l}return n?n.coordsAt(e-i,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),i=this.children[t];if(!(i instanceof MC))return null;for(;i.children.length;){let{i:e,off:t}=i.childPos(n,1);for(;;e++){if(e==i.children.length)return null;if((i=i.children[e]).length)break}n=t}if(!(i instanceof uC))return null;let o=qb(i.text,n);if(o==n)return null;let r=Nw(i.dom,n,o).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}return null}measureVisibleLineHeights(e){let t=[],{from:n,to:i}=e,o=this.view.contentDOM.clientWidth,r=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==IC.LTR;for(let e=0,l=0;l<this.children.length;l++){let c=this.children[l],u=e+c.length;if(u>i)break;if(e>=n){let n=c.dom.getBoundingClientRect();if(t.push(n.height),r){let t=c.dom.lastChild,i=t?Ew(t):[];if(i.length){let t=i[i.length-1],r=a?t.right-n.left:n.right-t.left;r>s&&(s=r,this.minWidth=o,this.minWidthFrom=e,this.minWidthTo=u)}}}e=u+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return"rtl"==getComputedStyle(this.children[t].dom).direction?IC.RTL:IC.LTR}measureTextSize(){for(let e of this.children)if(e instanceof MC){let t=e.measureTextSize();if(t)return t}let e,t,n,i=document.createElement("div");return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(i);let o=Ew(i.firstChild)[0];e=i.getBoundingClientRect().height,t=o?o.width/27:7,n=o?o.height:e,i.remove()})),{lineHeight:e,charWidth:t,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Kw(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let o=i==t.viewports.length?null:t.viewports[i],r=o?o.from-1:this.length;if(r>n){let i=(t.lineBlockAt(r).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(OC.replace({widget:new PC(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,r))}if(!o)break;n=o.to+1}return OC.set(e)}updateDeco(){let e=1,t=this.view.state.facet(OO).map((t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t)),n=!1,i=this.view.state.facet(kO).map(((e,t)=>{let i="function"==typeof e;return i&&(n=!0),i?e(this.view):e}));for(i.length&&(this.dynamicDecorationMap[e++]=n,t.push(Z_.join(i))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);return this.view.scrollDOM.scrollTop=t.top-e.yMargin,void(this.view.scrollDOM.scrollLeft=e.xMargin)}for(let t of this.view.state.facet(dO))try{if(t(this.view,e.range,e))return!0}catch(e){mO(this.view.state,e,"scroll handler")}let t,{range:n}=e,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(!i)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,t.left),top:Math.min(i.top,t.top),right:Math.max(i.right,t.right),bottom:Math.max(i.bottom,t.bottom)});let o=MO(this.view),r={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:s,offsetHeight:a}=this.view.scrollDOM;!function(e,t,n,i,o,r,s,a){let l=e.ownerDocument,c=l.defaultView||window;for(let u=e,h=!1;u&&!h;)if(1==u.nodeType){let e,d=u==l.body,p=1,f=1;if(d)e=Dw(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let t=u.getBoundingClientRect();({scaleX:p,scaleY:f}=$w(u,t)),e={left:t.left,right:t.left+u.clientWidth*p,top:t.top,bottom:t.top+u.clientHeight*f}}let g=0,m=0;if("nearest"==o)t.top<e.top?(m=-(e.top-t.top+s),n>0&&t.bottom>e.bottom+m&&(m=t.bottom-e.bottom+m+s)):t.bottom>e.bottom&&(m=t.bottom-e.bottom+s,n<0&&t.top-m<e.top&&(m=-(e.top+m-t.top+s)));else{let i=t.bottom-t.top,r=e.bottom-e.top;m=("center"==o&&i<=r?t.top+i/2-r/2:"start"==o||"center"==o&&n<0?t.top-s:t.bottom-r+s)-e.top}if("nearest"==i?t.left<e.left?(g=-(e.left-t.left+r),n>0&&t.right>e.right+g&&(g=t.right-e.right+g+r)):t.right>e.right&&(g=t.right-e.right+r,n<0&&t.left<e.left+g&&(g=-(e.left+g-t.left+r))):g=("center"==i?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==i==a?t.left-r:t.right-(e.right-e.left)+r)-e.left,g||m)if(d)c.scrollBy(g,m);else{let e=0,n=0;if(m){let e=u.scrollTop;u.scrollTop+=m/f,n=(u.scrollTop-e)*f}if(g){let t=u.scrollLeft;u.scrollLeft+=g/p,e=(u.scrollLeft-t)*p}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-g)<1&&(i="nearest"),n&&Math.abs(n-m)<1&&(o="nearest")}if(d)break;u=u.assignedSlot||u.parentNode}else{if(11!=u.nodeType)break;u=u.host}}(this.view.scrollDOM,r,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==IC.LTR)}}function jO(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let i=zw(n.focusNode,n.focusOffset),o=Qw(n.focusNode,n.focusOffset),r=i||o;if(o&&i&&o.node!=i.node){let t=Uw.get(o.node);if(!t||t instanceof uC&&t.text!=o.node.nodeValue)r=o;else if(e.docView.lastCompositionAfterCursor){let e=Uw.get(i.node);!e||e instanceof uC&&e.text!=i.node.nodeValue||(r=o)}}if(e.docView.lastCompositionAfterCursor=r!=i,!r)return null;let s=t-r.offset;return{from:s,to:s+r.node.nodeValue.length,node:r.node}}let IO=class{constructor(){this.changes=[]}compareRange(e,t){TC(e,t,this.changes)}comparePoint(e,t){TC(e,t,this.changes)}boundChange(e){TC(e,e,this.changes)}};function BO(e,t){return t.left>e?t.left-e:Math.max(0,e-t.right)}function LO(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function NO(e,t){return e.top<t.bottom-1&&e.bottom>t.top+1}function qO(e,t){return t<e.top?{top:t,left:e.left,right:e.right,bottom:e.bottom}:e}function VO(e,t){return t>e.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function FO(e,t,n){let i,o,r,s,a,l,c,u,h=!1;for(let d=e.firstChild;d;d=d.nextSibling){let e=Ew(d);for(let p=0;p<e.length;p++){let f=e[p];o&&NO(o,f)&&(f=qO(VO(f,o.bottom),o.top));let g=BO(t,f),m=LO(n,f);if(0==g&&0==m)return 3==d.nodeType?zO(d,t,n):FO(d,t,n);if(!i||s>m||s==m&&r>g){i=d,o=f,r=g,s=m;let a=m?n<f.top?-1:1:g?t<f.left?-1:1:0;h=!a||(a>0?p<e.length-1:p>0)}0==g?n>f.bottom&&(!c||c.bottom<f.bottom)?(a=d,c=f):n<f.top&&(!u||u.top>f.top)&&(l=d,u=f):c&&NO(c,f)?c=VO(c,f.bottom):u&&NO(u,f)&&(u=qO(u,f.top))}}if(c&&c.bottom>=n?(i=a,o=c):u&&u.top<=n&&(i=l,o=u),!i)return{node:e,offset:0};let d=Math.max(o.left,Math.min(o.right,t));return 3==i.nodeType?zO(i,d,n):h&&"false"!=i.contentEditable?FO(i,d,n):{node:e,offset:Array.prototype.indexOf.call(e.childNodes,i)+(t>=(o.left+o.right)/2?1:0)}}function zO(e,t,n){let i=e.nodeValue.length,o=-1,r=1e9,s=0;for(let a=0;a<i;a++){let i=Nw(e,a,a+1).getClientRects();for(let l=0;l<i.length;l++){let c=i[l];if(c.top==c.bottom)continue;s||(s=t-c.left);let u=(c.top>n?c.top-n:n-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&u<r){let n=t>=(c.left+c.right)/2,i=n;if(cC.chrome||cC.gecko){Nw(e,a).getBoundingClientRect().left==c.right&&(i=!n)}if(u<=0)return{node:e,offset:a+(i?1:0)};o=a+(i?1:0),r=u}}}return{node:e,offset:o>-1?o:s>0?e.nodeValue.length:0}}function QO(e,t,n,i=-1){var o,r;let s,a=e.contentDOM.getBoundingClientRect(),l=a.top+e.viewState.paddingTop,{docHeight:c}=e.viewState,{x:u,y:h}=t,d=h-l;if(d<0)return 0;if(d>c)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,o=!1;s=e.elementAtHeight(d),s.type!=CC.Text;)for(;d=i>0?s.bottom+t:s.top-t,!(d>=0&&d<=c);){if(o)return n?null:0;o=!0,i=-i}h=l+d;let p=s.from;if(p<e.viewport.from)return 0==e.viewport.from?0:n?null:HO(e,a,s,u,h);if(p>e.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:HO(e,a,s,u,h);let f=e.dom.ownerDocument,g=e.root.elementFromPoint?e.root:f,m=g.elementFromPoint(u,h);m&&!e.contentDOM.contains(m)&&(m=null),m||(u=Math.max(a.left+1,Math.min(a.right-1,u)),m=g.elementFromPoint(u,h),m&&!e.contentDOM.contains(m)&&(m=null));let v,y=-1;if(m&&0!=(null===(o=e.docView.nearest(m))||void 0===o?void 0:o.isEditable)){if(f.caretPositionFromPoint){let e=f.caretPositionFromPoint(u,h);e&&({offsetNode:v,offset:y}=e)}else if(f.caretRangeFromPoint){let t=f.caretRangeFromPoint(u,h);t&&(({startContainer:v,startOffset:y}=t),(!e.contentDOM.contains(v)||cC.safari&&function(e,t,n){let i;if(3!=e.nodeType||t!=(i=e.nodeValue.length))return!1;for(let t=e.nextSibling;t;t=t.nextSibling)if(1!=t.nodeType||"BR"!=t.nodeName)return!1;return Nw(e,i-1,i).getBoundingClientRect().left>n}(v,y,u)||cC.chrome&&function(e,t,n){if(0!=t)return!1;for(let t=e;;){let e=t.parentNode;if(!e||1!=e.nodeType||e.firstChild!=t)return!1;if(e.classList.contains("cm-line"))break;t=e}let i=1==e.nodeType?e.getBoundingClientRect():Nw(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect();return n-i.left>5}(v,y,u))&&(v=void 0))}v&&(y=Math.min(Aw(v),y))}if(!v||!e.docView.dom.contains(v)){let t=MC.find(e.docView,p);if(!t)return d>s.top+s.height/2?s.to:s.from;({node:v,offset:y}=FO(t.dom,u,h))}let x=e.docView.nearest(v);if(!x)return null;if(x.isWidget&&1==(null===(r=x.dom)||void 0===r?void 0:r.nodeType)){let e=x.dom.getBoundingClientRect();return t.y<e.top||t.y<=e.bottom&&t.x<=(e.left+e.right)/2?x.posAtStart:x.posAtEnd}return x.localPosFromDOM(v,y)+x.posAtStart}function HO(e,t,n,i,o){let r=Math.round((i-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;r+=Math.floor((o-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+function(e,t,n,i){for(let i=0,o=0;;){if(o>=t)return i;if(i==e.length)break;o+=9==e.charCodeAt(i)?n-o%n:1,i=qb(e,i)}return!0===i?-1:e.length}(s,r,e.state.tabSize)}function WO(e,t,n,i){let o=function(e,t){let n=e.lineBlockAt(t);if(Array.isArray(n.type))for(let e of n.type)if(e.to>t||e.to==t&&(e.to==n.to||e.type==CC.Text))return e;return n}(e,t.head),r=i&&o.type==CC.Text&&(e.lineWrapping||o.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>o.from?t.head-1:t.head):null;if(r){let t=e.dom.getBoundingClientRect(),i=e.textDirectionAt(o.from),s=e.posAtCoords({x:n==(i==IC.LTR)?t.right-1:t.left+1,y:(r.top+r.bottom)/2});if(null!=s)return t_.cursor(s,n?-1:1)}return t_.cursor(n?o.to:o.from,n?-1:1)}function UO(e,t,n,i){let o=e.state.doc.lineAt(t.head),r=e.bidiSpans(o),s=e.textDirectionAt(o.from);for(let a=t,l=null;;){let t=JC(o,r,s,a,n),c=ZC;if(!t){if(o.number==(n?e.state.doc.lines:1))return a;c="\n",o=e.state.doc.line(o.number+(n?1:-1)),r=e.bidiSpans(o),t=e.visualLineSide(o,!n)}if(l){if(!l(c))return a}else{if(!i)return t;l=i(c)}a=t}}function XO(e,t,n){for(;;){let i=0;for(let o of e)o.between(t-1,t+1,((e,o,r)=>{if(t>e&&t<o){let r=i||n||(t-e<o-t?-1:1);t=r<0?e:o,i=r}}));if(!i)return t}}function KO(e,t,n){let i=XO(e.state.facet(EO).map((t=>t(e))),n.from,t.head>n.from?-1:1);return i==n.from?n:t_.cursor(i,i<n.from?1:-1)}const GO="";class YO{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(W_.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=GO}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let e=this.text.length;this.readNode(i);let o=i.nextSibling;if(o==t)break;let r=Uw.get(i),s=Uw.get(o);(r&&s?r.breakAfter:(r?r.breakAfter:Tw(i))||Tw(o)&&("BR"!=i.nodeName||i.cmIgnore)&&this.text.length>e)&&this.lineBreak(),i=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let o,r=-1,s=1;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(o=i.exec(t))&&(r=o.index,s=o[0].length),this.append(t.slice(n,r<0?t.length:r)),r<0)break;if(this.lineBreak(),s>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=s-1);n=r+s}}readNode(e){if(e.cmIgnore)return;let t=Uw.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(ZO(e,n.node,n.offset)?t:0))}}function ZO(e,t,n){for(;;){if(!t||n<Aw(t))return!1;if(t==e)return!0;n=Rw(t)+1,t=t.parentNode}}class JO{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class ek{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:o,impreciseAnchor:r}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let t=o||r?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:o,focusOffset:r}=e.observer.selectionRange;n&&(t.push(new JO(n,i)),o==n&&r==i||t.push(new JO(o,r)));return t}(e),n=new YO(t,e.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,i=2==e.length?e[1].pos:n;return n>-1&&i>-1?t_.single(n+t,i+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=o&&o.node==t.focusNode&&o.offset==t.focusOffset||!Ow(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),i=r&&r.node==t.anchorNode&&r.offset==t.anchorOffset||!Ow(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((cC.ios||cC.chrome)&&e.state.selection.main.empty&&n!=i&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,i),o=Math.max(n,i),r=s.from-t,a=s.to-o;0!=r&&1!=r&&0!=t||0!=a&&-1!=a&&o!=e.state.doc.length||(n=0,i=e.state.doc.length)}this.newSel=t_.single(i,n)}}}function tk(e,t){let n,{newSel:i}=t,o=e.state.selection.main,r=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:i,to:s}=t.bounds,a=o.from,l=null;(8===r||cC.android&&t.text.length<s-i)&&(a=o.to,l="end");let c=function(e,t,n,i){let o=Math.min(e.length,t.length),r=0;for(;r<o&&e.charCodeAt(r)==t.charCodeAt(r);)r++;if(r==o&&e.length==t.length)return null;let s=e.length,a=t.length;for(;s>0&&a>0&&e.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;if("end"==i){n-=s+Math.max(0,r-Math.min(s,a))-r}if(s<r&&e.length<t.length){r-=n<=r&&n>=s?r-n:0,a=r+(a-s),s=r}else if(a<r){r-=n<=r&&n>=a?r-n:0,s=r+(s-a),a=r}return{from:r,toA:s,toB:a}}(e.state.doc.sliceString(i,s,GO),t.text,a-i,l);c&&(cC.chrome&&13==r&&c.toB==c.from+2&&t.text.slice(c.from,c.toB)==GO+GO&&c.toB--,n={from:i+c.from,to:i+c.toA,insert:Mb.of(t.text.slice(c.from,c.toB).split(GO))})}else i&&(!e.hasFocus&&e.state.facet(vO)||i.main.eq(o))&&(i=null);if(!n&&!i)return!1;if(!n&&t.typeOver&&!o.empty&&i&&i.main.empty?n={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,o.to)}:(cC.mac||cC.android)&&n&&n.from==n.to&&n.from==o.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=t_.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:Mb.of([n.insert.toString().replace("."," ")])}):n&&n.from>=o.from&&n.to<=o.to&&(n.from!=o.from||n.to!=o.to)&&o.to-o.from-(n.to-n.from)<=4?n={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,o.to))}:cC.chrome&&n&&n.from==n.to&&n.from==o.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(i&&(i=t_.single(i.main.anchor-1,i.main.head-1)),n={from:o.from,to:o.to,insert:Mb.of([" "])}),n)return nk(e,n,i,r);if(i&&!i.main.eq(o)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin),e.dispatch({selection:i,scrollIntoView:t,userEvent:n}),!0}return!1}function nk(e,t,n,i=-1){if(cC.ios&&e.inputState.flushIOSKey(t))return!0;let o=e.state.selection.main;if(cC.android&&(t.to==o.to&&(t.from==o.from||t.from==o.from-1&&" "==e.state.sliceDoc(t.from,o.from))&&1==t.insert.length&&2==t.insert.lines&&qw(e.contentDOM,"Enter",13)||(t.from==o.from-1&&t.to==o.to&&0==t.insert.length||8==i&&t.insert.length<t.to-t.from&&t.to>o.head)&&qw(e.contentDOM,"Backspace",8)||t.from==o.from&&t.to==o.to+1&&0==t.insert.length&&qw(e.contentDOM,"Delete",46)))return!0;let r,s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>r||(r=function(e,t,n){let i,o=e.state,r=o.selection.main;if(t.from>=r.from&&t.to<=r.to&&t.to-t.from>=(r.to-r.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=r.from<t.from?o.sliceDoc(r.from,t.from):"",s=r.to>t.to?o.sliceDoc(t.to,r.to):"";i=o.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{let s=o.changes(t),a=n&&n.main.to<=s.newLength?n.main:void 0;if(o.selection.ranges.length>1&&e.inputState.composing>=0&&t.to<=r.to&&t.to>=r.to-10){let l,c=e.state.sliceDoc(t.from,t.to),u=n&&jO(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);l={from:u.from,to:u.to-e}}else l=e.state.doc.lineAt(r.head);let h=r.to-t.to,d=r.to-r.from;i=o.changeByRange((n=>{if(n.from==r.from&&n.to==r.to)return{changes:s,range:a||n.map(s)};let i=n.to-h,u=i-c.length;if(n.to-n.from!=d||e.state.sliceDoc(u,i)!=c||n.to>=l.from&&n.from<=l.to)return{range:n};let p=o.changes({from:u,to:i,insert:t.insert}),f=n.to-r.to;return{changes:p,range:a?t_.range(Math.max(0,a.anchor+f),Math.max(0,a.head+f)):n.map(p)}}))}else i={changes:s,selection:a&&o.selection.replaceRange(a)}}let s="input.type";(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,s+=".compose",e.inputState.compositionFirstChange&&(s+=".start",e.inputState.compositionFirstChange=!1));return o.update(i,{userEvent:s,scrollIntoView:!0})}(e,t,n));return e.state.facet(sO).some((n=>n(e,t.from,t.to,s,a)))||e.dispatch(a()),!0}class ik{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,cC.safari&&e.contentDOM.addEventListener("input",(()=>null)),cC.gecko&&function(e){Mk.has(e)||(Mk.add(e),e.addEventListener("copy",(()=>{})),e.addEventListener("cut",(()=>{})))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,i=t.target;i!=e.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=Uw.get(i))&&n.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=rk(e),n=this.handlers,i=this.view.contentDOM;for(let e in t)if("scroll"!=e){let o=!t[e].handlers.length,r=n[e];r&&o!=!r.handlers.length&&(i.removeEventListener(e,this.handleEvent),r=null),r||i.addEventListener(e,this.handleEvent,{passive:o})}for(let e in n)"scroll"==e||t[e]||i.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&lk.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),cC.android&&cC.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!cC.ios||e.synthetic||e.altKey||e.metaKey||!((t=sk.find((t=>t.keyCode==e.keyCode)))&&!e.ctrlKey||ak.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&(!("Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,qw(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0)))}ignoreDuringComposition(e){return!!/^key/.test(e.type)&&(this.composing>0||!!(cC.safari&&!cC.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function ok(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(e){mO(n.state,e)}}}function rk(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec;if(e&&e.domEventHandlers)for(let i in e.domEventHandlers){let o=e.domEventHandlers[i];o&&n(i).handlers.push(ok(t.value,o))}if(e&&e.domEventObservers)for(let i in e.domEventObservers){let o=e.domEventObservers[i];o&&n(i).observers.push(ok(t.value,o))}}for(let e in hk)n(e).handlers.push(hk[e]);for(let e in dk)n(e).observers.push(dk[e]);return t}const sk=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],ak="dthko",lk=[16,17,18,20,91,92,224,225];function ck(e){return.7*Math.max(0,e)+8}class uk{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=function(e){let t,n,i=e.ownerDocument;for(let o=e.parentNode;o&&!(o==i.body||t&&n);)if(1==o.nodeType)!n&&o.scrollHeight>o.clientHeight&&(n=o),!t&&o.scrollWidth>o.clientWidth&&(t=o),o=o.assignedSlot||o.parentNode;else{if(11!=o.nodeType)break;o=o.host}return{x:t,y:n}}(e.contentDOM),this.atoms=e.state.facet(EO).map((t=>t(e)));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(W_.allowMultipleSelections)&&function(e,t){let n=e.state.facet(tO);return n.length?n[0](t):cC.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=Cw(e.root);if(!i||0==i.rangeCount)return!0;let o=i.getRangeAt(0).getClientRects();for(let e=0;e<o.length;e++){let n=o[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=Ok(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&function(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,i=0,o=0,r=this.view.win.innerWidth,s=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:r}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:s}=this.scrollParents.y.getBoundingClientRect());let a=MO(this.view);e.clientX-a.left<=i+6?t=-ck(i-e.clientX):e.clientX+a.right>=r-6&&(t=ck(e.clientX-r)),e.clientY-a.top<=o+6?n=-ck(o-e.clientY):e.clientY+a.bottom>=s-6&&(n=ck(e.clientY-s)),this.setScrollSpeed(t,n)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let n=0;n<e.ranges.length;n++){let i=e.ranges[n],o=null;if(i.empty){let e=XO(this.atoms,i.from,0);e!=i.from&&(o=t_.cursor(e,-1))}else{let e=XO(this.atoms,i.from,-1),t=XO(this.atoms,i.to,1);e==i.from&&t==i.to||(o=t_.range(i.from==i.anchor?e:t,i.from==i.head?e:t))}o&&(t||(t=e.ranges.slice()),t[n]=o)}return t?t_.create(t,e.mainIndex):e}select(e){let{view:t}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));!this.mustSelect&&n.eq(t.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some((e=>e.isUserEvent("input.type")))?this.destroy():this.style.update(e)&&setTimeout((()=>this.select(this.lastEvent)),20)}}const hk=Object.create(null),dk=Object.create(null),pk=cC.ie&&cC.ie_version<15||cC.ios&&cC.webkit_version<604;function fk(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function gk(e,t){t=fk(e.state,lO,t);let n,{state:i}=e,o=1,r=i.toText(t),s=r.lines==i.selection.ranges.length,a=null!=Ek&&i.selection.ranges.every((e=>e.empty))&&Ek==r.toString();if(a){let e=-1;n=i.changeByRange((n=>{let a=i.doc.lineAt(n.from);if(a.from==e)return{range:n};e=a.from;let l=i.toText((s?r.line(o++).text:t)+i.lineBreak);return{changes:{from:a.from,insert:l},range:t_.cursor(n.from+l.length)}}))}else n=s?i.changeByRange((e=>{let t=r.line(o++);return{changes:{from:e.from,to:e.to,insert:t.text},range:t_.cursor(e.from+t.length)}})):i.replaceSelection(r);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function mk(e,t,n,i){if(1==i)return t_.cursor(t,n);if(2==i)return function(e,t,n=1){let i=e.charCategorizer(t),o=e.doc.lineAt(t),r=t-o.from;if(0==o.length)return t_.cursor(t);0==r?n=1:r==o.length&&(n=-1);let s=r,a=r;n<0?s=qb(o.text,r,!1):a=qb(o.text,r);let l=i(o.text.slice(s,a));for(;s>0;){let e=qb(o.text,s,!1);if(i(o.text.slice(e,s))!=l)break;s=e}for(;a<o.length;){let e=qb(o.text,a);if(i(o.text.slice(a,e))!=l)break;a=e}return t_.range(s+o.from,a+o.from)}(e.state,t,n);{let n=MC.find(e.docView,t),i=e.state.doc.lineAt(n?n.posAtEnd:t),o=n?n.posAtStart:i.from,r=n?n.posAtEnd:i.to;return r<e.state.doc.length&&r==i.to&&r++,t_.range(o,r)}}dk.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},hk.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),dk.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},dk.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},hk.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of e.state.facet(iO))if(n=i(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=xk(e,t),i=Ok(t),o=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),o=o.map(e.changes))},get(t,r,s){let a,l=xk(e,t),c=mk(e,l.pos,l.bias,i);if(n.pos!=l.pos&&!r){let t=mk(e,n.pos,n.bias,i),o=Math.min(t.from,c.from),r=Math.max(t.to,c.to);c=o<c.from?t_.range(o,r):t_.range(r,o)}return r?o.replaceRange(o.main.extend(c.from,c.to)):s&&1==i&&o.ranges.length>1&&(a=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:i,to:o}=e.ranges[n];if(i<=t&&o>=t)return t_.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(o,l.pos))?a:s?o.addRange(c):t_.create([c])}}}(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new uk(e,t,n,i)),i&&e.observer.ignore((()=>{Lw(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()}));let o=e.inputState.mouseSelection;if(o)return o.start(t),!1===o.dragging}return!1};let vk=(e,t,n)=>t>=n.top&&t<=n.bottom&&e>=n.left&&e<=n.right;function yk(e,t,n,i){let o=MC.find(e.docView,t);if(!o)return 1;let r=t-o.posAtStart;if(0==r)return 1;if(r==o.length)return-1;let s=o.coordsAt(r,-1);if(s&&vk(n,i,s))return-1;let a=o.coordsAt(r,1);return a&&vk(n,i,a)?1:s&&s.bottom>=i?-1:1}function xk(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:yk(e,n,t.clientX,t.clientY)}}const bk=cC.ie&&cC.ie_version<=11;let _k=null,wk=0,Ck=0;function Ok(e){if(!bk)return e.detail;let t=_k,n=Ck;return _k=e,Ck=Date.now(),wk=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(wk+1)%3:1}function kk(e,t,n,i){if(!(n=fk(e.state,lO,n)))return;let o=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:r}=e.inputState,s=i&&r&&function(e,t){let n=e.state.facet(nO);return n.length?n[0](t):cC.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:r.from,to:r.to}:null,a={from:o,insert:n},l=e.state.changes(s?[s,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(o,-1),head:l.mapPos(o,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}hk.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let i=e.docView.nearest(t.target);if(i&&i.isWidget){let e=i.posAtStart,t=e+i.length;(e>=n.to||t<=n.from)&&(n=t_.range(e,t))}}let{inputState:i}=e;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",fk(e.state,cO,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},hk.dragend=e=>(e.inputState.draggedContent=null,!1),hk.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),o=0,r=()=>{++o==n.length&&kk(e,t,i.filter((e=>null!=e)).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=r,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(i[e]=t.result),r()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return kk(e,t,n,!0),!0}return!1},hk.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=pk?null:t.clipboardData;return n?(gk(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((()=>{e.focus(),n.remove(),gk(e,n.value)}),50)}(e),!1)};let Ek=null;hk.copy=hk.cut=(e,t)=>{let{text:n,ranges:i,linewise:o}=function(e){let t=[],n=[],i=!1;for(let i of e.selection.ranges)i.empty||(t.push(e.sliceDoc(i.from,i.to)),n.push(i));if(!t.length){let o=-1;for(let{from:i}of e.selection.ranges){let r=e.doc.lineAt(i);r.number>o&&(t.push(r.text),n.push({from:r.from,to:Math.min(e.doc.length,r.to+1)})),o=r.number}i=!0}return{text:fk(e,cO,t.join(e.lineBreak)),ranges:n,linewise:i}}(e.state);if(!n&&!o)return!1;Ek=o?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=pk?null:t.clipboardData;return r?(r.clearData(),r.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout((()=>{i.remove(),e.focus()}),50)}(e,n),!1)};const Sk=A_.define();function Rk(e,t){let n=[];for(let i of e.facet(aO)){let o=i(e,t);o&&n.push(o)}return n?e.update({effects:n,annotations:Sk.of(!0)}):null}function Tk(e){setTimeout((()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Rk(e.state,t);n?e.dispatch(n):e.update([])}}),10)}dk.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),Tk(e)},dk.blur=e=>{e.observer.clearSelectionRange(),Tk(e)},dk.compositionstart=dk.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},dk.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,cC.chrome&&cC.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then((()=>e.observer.flush())):setTimeout((()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])}),50))},dk.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},hk.beforeinput=(e,t)=>{var n,i;if("insertReplacementText"==t.inputType&&e.observer.editContext){let i=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),o=t.getTargetRanges();if(i&&o.length){let t=o[0],n=e.posAtDOM(t.startContainer,t.startOffset),r=e.posAtDOM(t.endContainer,t.endOffset);return nk(e,{from:n,to:r,insert:e.state.toText(i)},null),!0}}let o;if(cC.chrome&&cC.android&&(o=sk.find((e=>e.inputType==t.inputType)))&&(e.observer.delayAndroidKey(o.key,o.keyCode),"Backspace"==o.key||"Delete"==o.key)){let t=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout((()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())}),100)}return cC.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),cC.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout((()=>dk.compositionend(e,t)),20),!1};const Mk=new Set;const Ak=["pre-wrap","normal","pre-line","break-spaces"];let Pk=!1;function Dk(){Pk=!1}class $k{constructor(e){this.lineWrapping=e,this.doc=Mb.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Ak.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(10*i)]||(t=!0,this.heightSamples[Math.floor(10*i)]=!0)}return t}refresh(e,t,n,i,o,r){let s=Ak.indexOf(e)>-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=o,a){this.heightSamples={};for(let e=0;e<r.length;e++){let t=r[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return a}}class jk{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Ik{constructor(e,t,n,i,o){this.from=e,this.length=t,this.top=n,this.height=i,this._content=o}get type(){return"number"==typeof this._content?CC.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof SC?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Ik(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Bk=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Bk||(Bk={}));const Lk=.001;class Nk{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Lk&&(Pk=!0),this.height=e)}replace(e,t,n){return Nk.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let o=this,r=n.doc;for(let s=i.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:c,toB:u}=i[s],h=o.lineAt(a,Bk.ByPosNoHeight,n.setDoc(t),0,0),d=h.to>=l?h:o.lineAt(l,Bk.ByPosNoHeight,n,0,0);for(u+=d.to-l,l=d.to;s>0&&h.from<=i[s-1].toA;)a=i[s-1].fromA,c=i[s-1].fromB,s--,a<h.from&&(h=o.lineAt(a,Bk.ByPosNoHeight,n,0,0));c+=h.from-a,a=h.from;let p=Wk.build(n.setDoc(r),e,c,u);o=qk(o,o.replace(a,l,p))}return o.updateHeight(n,0)}static empty(){return new Fk(0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,i=0,o=0;for(;;)if(t==n)if(i>2*o){let o=e[t-1];o.break?e.splice(--t,1,o.left,null,o.right):e.splice(--t,1,o.left,o.right),n+=1+o.break,i-=o.size}else{if(!(o>2*i))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,o-=t.size}}else if(i<o){let n=e[t++];n&&(i+=n.size)}else{let t=e[--n];t&&(o+=t.size)}let r=0;return null==e[t-1]?(r=1,t--):null==e[t]&&(r=1,n++),new Qk(Nk.of(e.slice(0,t)),r,Nk.of(e.slice(n)))}}function qk(e,t){return e==t?e:(e.constructor!=t.constructor&&(Pk=!0),t)}Nk.prototype.size=1;class Vk extends Nk{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,i){return new Ik(i,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,i,o){return this.blockAt(0,n,i,o)}forEachLine(e,t,n,i,o,r){e<=o+this.length&&t>=o&&r(this.blockAt(0,n,i,o))}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setHeight(i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Fk extends Vk{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,i){return new Ik(i,this.length,n,this.height,this.breaks)}replace(e,t,n){let i=n[0];return 1==n.length&&(i instanceof Fk||i instanceof zk&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof zk?i=new Fk(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Nk.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setHeight(i.heights[i.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class zk extends Nk{constructor(e){super(e,0)}heightMetrics(e,t){let n,i=e.doc.lineAt(t).number,o=e.doc.lineAt(t+this.length).number,r=o-i+1,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*r);n=t/r,this.length>r+1&&(s=(this.height-t)/(this.length-r-1))}else n=this.height/r;return{firstLine:i,lastLine:o,perLine:n,perChar:s}}blockAt(e,t,n,i){let{firstLine:o,lastLine:r,perLine:s,perChar:a}=this.heightMetrics(t,i);if(t.lineWrapping){let o=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),r=t.doc.lineAt(o),l=s+r.length*a,c=Math.max(n,e-l/2);return new Ik(r.from,r.length,c,l,0)}{let i=Math.max(0,Math.min(r-o,Math.floor((e-n)/s))),{from:a,length:l}=t.doc.line(o+i);return new Ik(a,l,n+s*i,s,0)}}lineAt(e,t,n,i,o){if(t==Bk.ByHeight)return this.blockAt(e,n,i,o);if(t==Bk.ByPosNoHeight){let{from:t,to:i}=n.doc.lineAt(e);return new Ik(t,i-t,0,0,0)}let{firstLine:r,perLine:s,perChar:a}=this.heightMetrics(n,o),l=n.doc.lineAt(e),c=s+l.length*a,u=l.number-r,h=i+s*u+a*(l.from-o-u);return new Ik(l.from,l.length,Math.max(i,Math.min(h,i+this.height-c)),c,0)}forEachLine(e,t,n,i,o,r){e=Math.max(e,o),t=Math.min(t,o+this.length);let{firstLine:s,perLine:a,perChar:l}=this.heightMetrics(n,o);for(let c=e,u=i;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-s;u+=a*n+l*(e-o-n)}let i=a+l*t.length;r(new Ik(t.from,t.length,u,i,0)),u+=i,c=t.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let e=n[n.length-1];e instanceof zk?n[n.length-1]=new zk(e.length+i):n.push(null,new zk(i-1))}if(e>0){let t=n[0];t instanceof zk?n[0]=new zk(e+t.length):n.unshift(new zk(e-1),null)}return Nk.of(n)}decomposeLeft(e,t){t.push(new zk(e-1),null)}decomposeRight(e,t){t.push(null,new zk(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let o=t+this.length;if(i&&i.from<=t+this.length&&i.more){let n=[],r=Math.max(t,i.from),s=-1;for(i.from>t&&n.push(new zk(i.from-t-1).updateHeight(e,t));r<=o&&i.more;){let t=e.doc.lineAt(r).length;n.length&&n.push(null);let o=i.heights[i.index++];-1==s?s=o:Math.abs(o-s)>=Lk&&(s=-2);let a=new Fk(t,o);a.outdated=!1,n.push(a),r+=t+1}r<=o&&n.push(null,new zk(o-r).updateHeight(e,r));let a=Nk.of(n);return(s<0||Math.abs(a.height-this.height)>=Lk||Math.abs(s-this.heightMetrics(e,t).perLine)>=Lk)&&(Pk=!0),qk(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Qk extends Nk{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,i){let o=n+this.left.height;return e<o?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,o,i+this.left.length+this.break)}lineAt(e,t,n,i,o){let r=i+this.left.height,s=o+this.left.length+this.break,a=t==Bk.ByHeight?e<r:e<s,l=a?this.left.lineAt(e,t,n,i,o):this.right.lineAt(e,t,n,r,s);if(this.break||(a?l.to<s:l.from>s))return l;let c=t==Bk.ByPosNoHeight?Bk.ByPosNoHeight:Bk.ByPos;return a?l.join(this.right.lineAt(s,c,n,r,s)):this.left.lineAt(s,c,n,i,o).join(l)}forEachLine(e,t,n,i,o,r){let s=i+this.left.height,a=o+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,n,i,o,r),t>=a&&this.right.forEachLine(e,t,n,s,a,r);else{let l=this.lineAt(a,Bk.ByPos,n,i,o);e<l.from&&this.left.forEachLine(e,l.from-1,n,i,o,r),l.to>=e&&l.from<=t&&r(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,s,a,r)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let o=[];e>0&&this.decomposeLeft(e,o);let r=o.length;for(let e of n)o.push(e);if(e>0&&Hk(o,r-1),t<this.length){let e=o.length;this.decomposeRight(t,o),Hk(o,e)}return Nk.of(o)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Nk.of(this.break?[e,null,t]:[e,t]):(this.left=qk(this.left,e),this.right=qk(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,i){let{left:o,right:r}=this,s=t+o.length+this.break,a=null;return i&&i.from<=t+o.length&&i.more?a=o=o.updateHeight(e,t,n,i):o.updateHeight(e,t,n),i&&i.from<=s+r.length&&i.more?a=r=r.updateHeight(e,s,n,i):r.updateHeight(e,s,n),a?this.balanced(o,r):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Hk(e,t){let n,i;null==e[t]&&(n=e[t-1])instanceof zk&&(i=e[t+1])instanceof zk&&e.splice(t-1,3,new zk(n.length+1+i.length))}class Wk{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Fk?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Fk(e-this.pos,-1)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,o=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let r=t-e;n.block?this.addBlock(new Vk(r,i,n)):(r||o||i>=5)&&this.addLineDeco(i,o,r)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Fk(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new zk(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Fk)return e;let t=new Fk(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof Fk||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Fk(0,-1));let n=e;for(let e of this.nodes)e instanceof Fk&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,i){let o=new Wk(n,e);return Z_.spans(t,n,i,o,0),o.finish(n)}}class Uk{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&TC(e,t,this.changes,5)}}function Xk(e,t){let n=e.getBoundingClientRect(),i=e.ownerDocument,o=i.defaultView||window,r=Math.max(0,n.left),s=Math.min(o.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(o.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=i.body;)if(1==t.nodeType){let n=t,i=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();r=Math.max(r,i.left),s=Math.min(s,i.right),a=Math.max(a,i.top),l=Math.min(t==e.parentNode?o.innerHeight:l,i.bottom)}t="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:r-n.left,right:Math.max(r,s)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function Kk(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class Gk{constructor(e,t,n,i){this.from=e,this.to=t,this.size=n,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],o=t[n];if(i.from!=o.from||i.to!=o.to||i.size!=o.size)return!1}return!0}draw(e,t){return OC.replace({widget:new Yk(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Yk extends wC{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Zk{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=nE,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=IC.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(CO).some((e=>"function"!=typeof e&&"cm-lineWrapping"==e.class));this.heightOracle=new $k(t),this.stateDeco=e.facet(OO).filter((e=>"function"!=typeof e)),this.heightMap=Nk.empty().applyChanges(this.stateDeco,Mb.empty,this.heightOracle.setDoc(e.doc),[new PO(0,0,0,e.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=OC.set(this.lineGaps.map((e=>e.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some((({from:e,to:t})=>i>=e&&i<=t))){let{from:t,to:n}=this.lineBlockAt(i);e.push(new Jk(t,n))}}return this.viewports=e.sort(((e,t)=>e.from-t.from)),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?nE:new iE(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(e=>{this.viewportLines.push(oE(e,this.scaler))}))}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(OO).filter((e=>"function"!=typeof e));let i=e.changedRanges,o=PO.extendWithRanges(i,function(e,t,n){let i=new Uk;return Z_.compare(e,t,n,i,0),i.changes}(n,this.stateDeco,e?e.changes:Ub.empty(this.state.doc.length))),r=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Dk(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=r||Pk)&&(e.flags|=2),s?(this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let l=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(l||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(hO)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?IC.RTL:IC.LTR;let r=this.heightOracle.mustRefreshForWrapping(o),s=t.getBoundingClientRect(),a=r||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let l=0,c=0;if(s.width&&s.height){let{scaleX:e,scaleY:n}=$w(t,s);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,l|=16,r=a=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,h=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==u&&this.paddingBottom==h||(this.paddingTop=u,this.paddingBottom=h,l|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Fw(e.scrollDOM);let p=(this.printing?Kk:Xk)(t,this.paddingTop),f=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(a=!0)),!this.inView&&!this.scrollTarget&&!function(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}(e.dom))return 0;let v=s.width;if(this.contentDOMWidth==v&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,l|=16),a){let t=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(t)&&(r=!0),r||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:n,charWidth:s,textHeight:a}=e.docView.measureTextSize();r=n>0&&i.refresh(o,n,s,a,v/s,t),r&&(e.docView.minWidth=0,l|=16)}f>0&&g>0?c=Math.max(f,g):f<0&&g<0&&(c=Math.min(f,g)),Dk();for(let n of this.viewports){let o=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(r?Nk.empty().applyChanges(this.stateDeco,Mb.empty,this.heightOracle,[new PO(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,r,new jk(n.from,o))}Pk&&(l|=2)}let y=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return y&&(2&l&&(l|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),l|=this.updateForViewport()),(2&l||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(r?[]:this.lineGaps,e)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,o=this.heightOracle,{visibleTop:r,visibleBottom:s}=this,a=new Jk(i.lineAt(r-1e3*n,Bk.ByHeight,o,0,0).from,i.lineAt(s+1e3*(1-n),Bk.ByHeight,o,0,0).to);if(t){let{head:e}=t.range;if(e<a.from||e>a.to){let n,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=i.lineAt(e,Bk.ByPos,o,0,0);n="center"==t.y?(s.top+s.bottom)/2-r/2:"start"==t.y||"nearest"==t.y&&e<a.from?s.top:s.bottom-r,a=new Jk(i.lineAt(n-500,Bk.ByHeight,o,0,0).from,i.lineAt(n+r+500,Bk.ByHeight,o,0,0).to)}}return a}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new Jk(this.heightMap.lineAt(n,Bk.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Bk.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Bk.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(t,Bk.ByPos,this.heightOracle,0,0),{visibleTop:r,visibleBottom:s}=this;return(0==e||i<=r-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||o>=s+Math.max(10,Math.min(n,250)))&&i>r-2e3&&o<s+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)t.touchesRange(i.from,i.to)||n.push(new Gk(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,o=i>>1,r=i<<1;if(this.defaultTextDirection!=IC.LTR&&!n)return[];let s=[],a=(i,r,l,c)=>{if(r-i<o)return;let u=this.state.selection.main,h=[u.from];u.empty||h.push(u.to);for(let e of h)if(e>i&&e<r)return a(i,e-10,l,c),void a(e+10,r,l,c);let d=function(e,t){for(let n of e)if(t(n))return n;return}(e,(e=>e.from>=l.from&&e.to<=l.to&&Math.abs(e.from-i)<o&&Math.abs(e.to-r)<o&&!h.some((t=>e.from<t&&e.to>t))));if(!d){if(r<l.to&&t&&n&&t.visibleRanges.some((e=>e.from<=r&&e.to>=r))){let e=t.moveToLineBoundary(t_.cursor(r),!1,!0).head;e>i&&(r=e)}let e=this.gapSize(l,i,r,c);d=new Gk(i,r,e,n||e<2e6?e:2e6)}s.push(d)},l=t=>{if(t.length<r||t.type!=CC.Text)return;let o=function(e,t,n){let i=[],o=e,r=0;Z_.spans(n,e,t,{span(){},point(e,t){e>o&&(i.push({from:o,to:e}),r+=e-o),o=t}},20),o<t&&(i.push({from:o,to:t}),r+=t-o);return{total:r,ranges:i}}(t.from,t.to,this.stateDeco);if(o.total<r)return;let s,l,c=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,r=i/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=c){let i=tE(o,c),s=((this.visibleBottom-this.visibleTop)/2+r)/t.height;e=i-s,n=i+s}else e=(this.visibleTop-t.top-r)/t.height,n=(this.visibleBottom-t.top+r)/t.height;s=eE(o,e),l=eE(o,n)}else{let n=o.total*this.heightOracle.charWidth,r=i*this.heightOracle.charWidth,a=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+a<this.pixelViewport.left&&(a=n.size-n.displaySize);let u,h,d=this.pixelViewport.left+a,p=this.pixelViewport.right+a;if(null!=c){let e=tE(o,c),t=((p-d)/2+r)/n;u=e-t,h=e+t}else u=(d-r)/n,h=(p+r)/n;s=eE(o,u),l=eE(o,h)}s>t.from&&a(t.from,s,t,o),l<t.to&&a(l,t.to,t,o)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(l):l(e);return s}gapSize(e,t,n,i){let o=tE(i,n)-tE(i,t);return this.heightOracle.lineWrapping?e.height*o:i.total*this.heightOracle.charWidth*o}updateLineGaps(e){Gk.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=OC.set(e.map((e=>e.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];Z_.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let i=0;if(n.length!=this.visibleRanges.length)i=12;else for(let t=0;t<n.length&&!(8&i);t++){let o=this.visibleRanges[t],r=n[t];o.from==r.from&&o.to==r.to||(i|=4,e&&e.mapPos(o.from,-1)==r.from&&e.mapPos(o.to,1)==r.to||(i|=8))}return this.visibleRanges=n,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((t=>t.from<=e&&t.to>=e))||oE(this.heightMap.lineAt(e,Bk.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find((t=>t.top<=e&&t.bottom>=e))||oE(this.heightMap.lineAt(this.scaler.fromDOM(e),Bk.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return oE(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Jk{constructor(e,t){this.from=e,this.to=t}}function eE({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:o}=t[e],r=o-n;if(i<=r)return n+i;i-=r}}function tE(e,t){let n=0;for(let{from:i,to:o}of e.ranges){if(t<=o){n+=t-i;break}n+=o-i}return n/e.total}const nE={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};class iE{constructor(e,t,n){let i=0,o=0,r=0;this.viewports=n.map((({from:n,to:o})=>{let r=t.lineAt(n,Bk.ByPos,e,0,0).top,s=t.lineAt(o,Bk.ByPos,e,0,0).bottom;return i+=s-r,{from:n,to:o,top:r,bottom:s,domTop:0,domBottom:0}})),this.scale=(7e6-i)/(t.height-i);for(let e of this.viewports)e.domTop=r+(e.top-o)*this.scale,r=e.domBottom=e.domTop+(e.bottom-e.top),o=e.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.top)return i+(e-n)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);n=o.bottom,i=o.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.domTop)return n+(e-i)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);n=o.bottom,i=o.domBottom}}eq(e){return e instanceof iE&&(this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every(((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to)))}}function oE(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new Ik(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map((e=>oE(e,t))):e._content)}const rE=o_.define({combine:e=>e.join(" ")}),sE=o_.define({combine:e=>e.indexOf(!0)>-1}),aE=fw.newName(),lE=fw.newName(),cE=fw.newName(),uE={"&light":"."+lE,"&dark":"."+cE};function hE(e,t,n){return new fw(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,(t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]})):e+" "+t})}const dE=hE("."+aE,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},uE),pE={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},fE=cC.ie&&cC.ie_version<=11;class gE{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new jw,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((t=>{for(let e of t)this.queue.push(e);(cC.ie&&cC.ie_version<=11||cC.ios&&e.composing)&&t.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),!window.EditContext||!1===e.constructor.EDIT_CONTEXT||cC.chrome&&cC.chrome_version<126||(this.editContext=new yE(e),e.state.facet(vO)&&(e.contentDOM.editContext=this.editContext.editContext)),fE&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()})),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout((()=>{this.view.viewState.printing=!1,this.view.requestMeasure()}),500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some(((t,n)=>t!=e[n])))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(vO)?n.root.activeElement!=this.dom:!kw(this.dom,i))return;let o=i.anchorNode&&n.docView.nearest(i.anchorNode);o&&o.ignoreEvent(e)?t||(this.selectionChanged=!1):(cC.ie&&cC.ie_version<=11||cC.android&&cC.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Sw(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Cw(e.root);if(!t)return!1;let n=cC.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return vE(e,n)}let n=null;function i(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),n?vE(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let i=kw(this.dom,n);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,i=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=i)return!1;for(i=Math.min(i,Aw(n));;)if(i){if(1!=n.nodeType)return!1;let e=n.childNodes[i-1];"false"==e.contentEditable?i--:(n=e,i=Aw(n))}else{if(n==e)return!0;i=Rw(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,pE),fE&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),fE&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;if(e){this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&qw(this.dom,e.key,e.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame((()=>{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,i=!1;for(let o of e){let e=this.readMutation(o);e&&(e.typeOver&&(i=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&kw(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new ek(this.view,e,t,n);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=tk(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty("attributes"==e.type),"attributes"==e.type&&(t.flags|=4),"childList"==e.type){let n=mE(t,e.previousSibling||e.target.previousSibling,-1),i=mE(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(vO)!=e.state.facet(vO)&&(e.view.contentDOM.editContext=e.state.facet(vO)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function mE(e,t,n){for(;t;){let i=Uw.get(t);if(i&&i.parent==e)return i;let o=t.parentNode;t=o!=e.dom?o:n>0?t.nextSibling:t.previousSibling}return null}function vE(e,t){let n=t.startContainer,i=t.startOffset,o=t.endContainer,r=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor);return Sw(s.node,s.offset,o,r)&&([n,i,o,r]=[o,r,n,i]),{anchorNode:n,anchorOffset:i,focusNode:o,focusOffset:r}}class yE{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=t=>{let n=e.state.selection.main,{anchor:i,head:o}=n,r=this.toEditorPos(t.updateRangeStart),s=this.toEditorPos(t.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:t.updateRangeStart,editorBase:r,drifted:!1});let a={from:r,to:s,insert:Mb.of(t.text.split("\n"))};if(a.from==this.from&&i<this.from?a.from=i:a.to==this.to&&i>this.to&&(a.to=i),a.from!=a.to||a.insert.length){if((cC.mac||cC.android)&&a.from==o-1&&/^\. ?$/.test(t.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(a={from:r,to:s,insert:Mb.of([t.text.replace("."," ")])}),this.pendingContextChange=a,!e.state.readOnly){let n=this.to-this.from+(a.to-a.from+a.insert.length);nk(e,a,t_.single(this.toEditorPos(t.selectionStart,n),this.toEditorPos(t.selectionEnd,n)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))}else{let i=t_.single(this.toEditorPos(t.selectionStart),this.toEditorPos(t.selectionEnd));i.main.eq(n)||e.dispatch({selection:i,userEvent:"select"})}},this.handlers.characterboundsupdate=n=>{let i=[],o=null;for(let t=this.toEditorPos(n.rangeStart),r=this.toEditorPos(n.rangeEnd);t<r;t++){let n=e.coordsForChar(t);o=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||o||new DOMRect,i.push(o)}t.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,i=e.underlineThickness;if("None"!=t&&"None"!=i){let o=this.toEditorPos(e.rangeStart),r=this.toEditorPos(e.rangeEnd);if(o<r){let e=`text-decoration: underline ${"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${"Thin"==i?1:2}px`;n.push(OC.mark({attributes:{style:e}}).range(o,r))}}}e.dispatch({effects:gO.of(OC.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=Cw(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;return e.changes.iterChanges(((o,r,s,a,l)=>{if(n)return;let c=l.length-(r-o);if(i&&r>=i.to){if(i.from==o&&i.to==r&&i.insert.eq(l))return i=this.pendingContextChange=null,t+=c,void(this.to+=c);i=null,this.revertPending(e.state)}if(o+=t,(r+=t)<=this.from)this.from+=c,this.to+=c;else if(o<this.to){if(o<this.from||r>this.to||this.to-this.from+l.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(o),this.toContextPos(r),l.toString()),this.to+=c}t+=c})),i&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange;this.composing&&(this.composing.drifted||e.transactions.some((e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to))))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==i||this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class xE{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach((e=>n(e,this))))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new Zk(e.state||W_.create(e)),e.scrollTo&&e.scrollTo.is(fO)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(xO).map((e=>new _O(e)));for(let e of this.plugins)e.update(this);this.observer=new gE(this),this.inputState=new ik(this),this.inputState.ensureHandlers(this.plugins),this.docView=new $O(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then((()=>this.requestMeasure()))}dispatch(...e){let t=1==e.length&&e[0]instanceof j_?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,i=!1,o=this.state;for(let t of e){if(t.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=t.state}if(this.destroyed)return void(this.viewState.state=o);let r=this.hasFocus,s=0,a=null;e.some((e=>e.annotation(Sk)))?(this.inputState.notifiedFocused=r,s=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=Rk(o,r),a||(s=1));let l=this.observer.delayedAndroidKey,c=null;if(l?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(c=null)):this.observer.clear(),o.facet(W_.phrases)!=this.state.facet(W_.phrases))return this.setState(o);t=DO.create(this,o,e),t.flags|=s;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(u&&(u=u.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;u=new pO(e.empty?e:t_.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(fO)&&(u=e.value.clip(this.state))}this.viewState.update(t,u),this.bidiCache=wE.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(AO)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some((e=>e.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(t.startState.facet(rE)!=t.state.facet(rE)&&(this.viewState.mustMeasureContent=!0),(n||i||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(rO))try{e(t)}catch(e){mO(this.state,e,"update listener")}(a||c)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!tk(this,c)&&l.force&&qw(this.contentDOM,l.key,l.keyCode)}))}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new Zk(e),this.plugins=e.facet(xO).map((e=>new _O(e))),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new $O(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(xO),n=e.state.facet(xO);if(t!=n){let i=[];for(let o of n){let n=t.indexOf(o);if(n<0)i.push(new _O(o));else{let t=this.plugins[n];t.mustUpdate=e,i.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){mO(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,i=n.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:r}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(r=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(r<0)if(Fw(n))o=-1,r=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(i);o=e.from,r=e.top}this.updateState=1;let s=this.viewState.measure(this);if(!s&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&s||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map((e=>{try{return e.read(this)}catch(e){return mO(this.state,e),_E}})),c=DO.create(this,this.state,[]),u=!1;c.flags|=s,t?t.flags|=s:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),u=this.docView.update(c),u&&this.docViewUpdate());for(let e=0;e<a.length;e++)if(l[e]!=_E)try{let t=a[e];t.write&&t.write(l[e],this)}catch(e){mO(this.state,e)}if(u&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,r=-1;continue}{let e=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-r;if(e>1||e<-1){i+=e,n.scrollTop=i/this.scaleY,r=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(rO))e(t)}get themeClasses(){return aE+" "+(this.state.facet(sE)?cE:lE)+" "+this.state.facet(rE)}updateAttrs(){let e=CE(this,wO,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(vO)?"true":"false",class:"cm-content",style:`${cC.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),CE(this,CO,t);let n=this.observer.ignore((()=>{let n=bC(this.contentDOM,this.contentAttrs,t),i=bC(this.dom,this.editorAttrs,e);return n||i}));return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)if(e.is(xE.announce)){t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value}}mountStyles(){this.styleModules=this.state.facet(AO);let e=this.state.facet(xE.cspNonce);fw.mount(this.root,this.styleModules.concat(dE).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key)return void(this.measureRequests[t]=e);this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find((t=>t.spec==e))||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return KO(this,e,UO(this,e,t,n))}moveByGroup(e,t){return KO(this,e,UO(this,e,t,(t=>function(e,t,n){let i=e.state.charCategorizer(t),o=i(n);return e=>{let t=i(e);return o==F_.Space&&(o=t),o==t}}(this,e.head,t))))}visualLineSide(e,t){let n=this.bidiSpans(e),i=this.textDirectionAt(e.from),o=n[t?n.length-1:0];return t_.cursor(o.side(t,i)+e.from,o.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,n=!0){return WO(this,e,t,n)}moveVertically(e,t,n){return KO(this,e,function(e,t,n,i){let o=t.head,r=n?1:-1;if(o==(n?e.state.doc.length:0))return t_.cursor(o,t.assoc);let s,a=t.goalColumn,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(o,t.assoc||-1),u=e.documentTop;if(c)null==a&&(a=c.left-l.left),s=r<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(o);null==a&&(a=Math.min(l.right-l.left,e.defaultCharacterWidth*(o-t.from))),s=(r<0?t.top:t.bottom)+u}let h=l.left+a,d=null!=i?i:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=s+(d+t)*r,i=QO(e,{x:h,y:n},!1,r);if(n<l.top||n>l.bottom||(r<0?i<o:i>o)){let t=e.docView.coordsForChar(i),o=!t||n<t.top?-1:1;return t_.cursor(i,o,void 0,a)}}}(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),QO(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(e),o=this.bidiSpans(i);return Pw(n,o[WC.find(o,e-i.from,-1,t)].dir==IC.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(uO)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>bE)return YC(e.length);let t,n=this.textDirectionAt(e.from);for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||UC(i.isolates,t=RO(this,e))))return i.order;t||(t=RO(this,e));let i=function(e,t,n){if(!e)return[new WC(0,0,t==LC?1:0)];if(t==BC&&!n.length&&!HC.test(e))return YC(e.length);if(n.length)for(;e.length>XC.length;)XC[XC.length]=256;let i=[],o=t==BC?0:1;return GC(e,o,o,n,0,e.length,i),i}(e.text,n,t);return this.bidiCache.push(new wE(e.from,e.to,n,t,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||cC.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{Lw(this.contentDOM),this.docView.updateSelection()}))}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return fO.of(new pO("number"==typeof e?t_.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return fO.of(new pO(t_.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return bO.define((()=>({})),{eventHandlers:e})}static domEventObservers(e){return bO.define((()=>({})),{eventObservers:e})}static theme(e,t){let n=fw.newName(),i=[rE.of(n),AO.of(hE(`.${n}`,e))];return t&&t.dark&&i.push(sE.of(!0)),i}static baseTheme(e){return v_.lowest(AO.of(hE("."+aE,e,uE)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&Uw.get(n)||Uw.get(e);return(null===(t=null==i?void 0:i.rootView)||void 0===t?void 0:t.view)||null}}xE.styleModule=AO,xE.inputHandler=sO,xE.clipboardInputFilter=lO,xE.clipboardOutputFilter=cO,xE.scrollHandler=dO,xE.focusChangeEffect=aO,xE.perLineTextDirection=uO,xE.exceptionSink=oO,xE.updateListener=rO,xE.editable=vO,xE.mouseSelectionStyle=iO,xE.dragMovesSelection=nO,xE.clickAddsSelectionRange=tO,xE.decorations=OO,xE.outerDecorations=kO,xE.atomicRanges=EO,xE.bidiIsolatedRanges=SO,xE.scrollMargins=TO,xE.darkTheme=sE,xE.cspNonce=o_.define({combine:e=>e.length?e[0]:""}),xE.contentAttributes=CO,xE.editorAttributes=wO,xE.lineWrapping=xE.contentAttributes.of({class:"cm-lineWrapping"}),xE.announce=$_.define();const bE=4096,_E={};class wE{constructor(e,t,n,i,o,r){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=o,this.order=r}static update(e,t){if(t.empty&&!e.some((e=>e.fresh)))return e;let n=[],i=e.length?e[e.length-1].dir:IC.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let r=e[o];r.dir!=i||t.touchesRange(r.from,r.to)||n.push(new wE(t.mapPos(r.from,1),t.mapPos(r.to,-1),r.dir,r.isolates,!1,r.order))}return n}}function CE(e,t,n){for(let i=e.state.facet(t),o=i.length-1;o>=0;o--){let t=i[o],r="function"==typeof t?t(e):t;r&&vC(r,n)}return n}const OE=cC.mac?"mac":cC.windows?"win":cC.linux?"linux":"key";function kE(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const EE=v_.default(xE.domEventHandlers({keydown:(e,t)=>function(e,t,n,i){AE=t;let o=function(e){var t=!(xw&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||bw&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?yw:vw)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),r=Vb(o,0),s=zb(r)==o.length&&" "!=o,a="",l=!1,c=!1,u=!1;TE&&TE.view==n&&TE.scope==i&&(a=TE.prefix+" ",lk.indexOf(t.keyCode)<0&&(c=!0,TE=null));let h,d,p=new Set,f=e=>{if(e){for(let t of e.run)if(!p.has(t)&&(p.add(t),t(n)))return e.stopPropagation&&(u=!0),!0;e.preventDefault&&(e.stopPropagation&&(u=!0),c=!0)}return!1},g=e[i];g&&(f(g[a+kE(o,t,!s)])?l=!0:s&&(t.altKey||t.metaKey||t.ctrlKey)&&!(cC.windows&&t.ctrlKey&&t.altKey)&&(h=vw[t.keyCode])&&h!=o?(f(g[a+kE(h,t,!0)])||t.shiftKey&&(d=yw[t.keyCode])!=o&&d!=h&&f(g[a+kE(d,t,!1)]))&&(l=!0):s&&t.shiftKey&&f(g[a+kE(o,t,!0)])&&(l=!0),!l&&f(g._any)&&(l=!0));c&&(l=!0);l&&u&&t.stopPropagation();return AE=null,l}(function(e){let t=e.facet(SE),n=RE.get(t);n||RE.set(t,n=function(e,t=OE){let n=Object.create(null),i=Object.create(null),o=(e,t)=>{let n=i[e];if(null==n)i[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},r=(e,i,r,s,a)=>{var l,c;let u=n[e]||(n[e]=Object.create(null)),h=i.split(/ (?!$)/).map((e=>function(e,t){const n=e.split(/-(?!$)/);let i,o,r,s,a=n[n.length-1];"Space"==a&&(a=" ");for(let e=0;e<n.length-1;++e){const a=n[e];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))i=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))r=!0;else{if(!/^mod$/i.test(a))throw new Error("Unrecognized modifier name: "+a);"mac"==t?s=!0:o=!0}}return i&&(a="Alt-"+a),o&&(a="Ctrl-"+a),s&&(a="Meta-"+a),r&&(a="Shift-"+a),a}(e,t)));for(let t=1;t<h.length;t++){let n=h.slice(0,t).join(" ");o(n,!0),u[n]||(u[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let i=TE={view:t,prefix:n,scope:e};return setTimeout((()=>{TE==i&&(TE=null)}),ME),!0}]})}let d=h.join(" ");o(d,!1);let p=u[d]||(u[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(l=u._any)||void 0===l?void 0:l.run)||void 0===c?void 0:c.slice())||[]});r&&p.run.push(r),s&&(p.preventDefault=!0),a&&(p.stopPropagation=!0)};for(let i of e){let e=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:o}=i;for(let t in e)e[t].run.push((e=>o(e,AE)))}let o=i[t]||i.key;if(o)for(let t of e)r(t,o,i.run,i.preventDefault,i.stopPropagation),i.shift&&r(t,"Shift-"+o,i.shift,i.preventDefault,i.stopPropagation)}return n}(t.reduce(((e,t)=>e.concat(t)),[])));return n}(t.state),e,t,"editor")})),SE=o_.define({enables:EE}),RE=new WeakMap;let TE=null;const ME=4e3;let AE=null;const PE={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};!(cC.ios&&cC.webkit&&cC.webkit_version<534)&&(PE[".cm-line"].caretColor=PE[".cm-content"].caretColor="transparent !important");class DE extends wC{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Ew(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=Pw(t[0],"rtl"!=n.direction),o=parseInt(n.lineHeight);return i.bottom-i.top>1.5*o?{left:i.left,right:i.right,top:i.top,bottom:i.top+o}:i}ignoreEvent(){return!1}}function $E(e){return bO.fromClass(class{constructor(t){this.view=t,this.placeholder=e?OC.set([OC.widget({widget:new DE(e),side:1}).range(0)]):OC.none}get decorations(){return this.view.state.doc.length?OC.none:this.placeholder}},{decorations:e=>e.decorations})}const jE="-10000px";class IE{constructor(e,t,n,i){this.facet=t,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter((e=>e));let o=null;this.tooltipViews=this.tooltips.map((e=>o=n(e,o)))}update(e,t){var n;let i=e.state.facet(this.facet),o=i.filter((e=>e));if(i===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let r=[],s=t?[]:null;for(let n=0;n<o.length;n++){let i=o[n],a=-1;if(i){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==i.create&&(a=e)}if(a<0)r[n]=this.createTooltipView(i,n?r[n-1]:null),s&&(s[n]=!!i.above);else{let i=r[n]=this.tooltipViews[a];s&&(s[n]=t[a]),i.update&&i.update(e)}}}for(let e of this.tooltipViews)r.indexOf(e)<0&&(this.removeTooltipView(e),null===(n=e.destroy)||void 0===n||n.call(e));return t&&(s.forEach(((e,n)=>t[n]=e)),t.length=s.length),this.input=i,this.tooltips=o,this.tooltipViews=r,!0}}function BE(e){let{win:t}=e;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}const LE=o_.define({combine:e=>{var t,n,i;return{position:cC.ios?"absolute":(null===(t=e.find((e=>e.position)))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find((e=>e.parent)))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=e.find((e=>e.tooltipSpace)))||void 0===i?void 0:i.tooltipSpace)||BE}}}),NE=new WeakMap,qE=bO.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(LE);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver((()=>this.measureSoon())):null,this.manager=new IE(e,QE,((e,t)=>this.createTooltip(e,t)),(e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()})),this.above=this.manager.tooltips.map((e=>!!e.above)),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(LE);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),i=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=jE,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(cC.gecko)n=e.offsetParent!=this.container.ownerDocument.body;else if(e.style.top==jE&&"0px"==e.style.left){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),o=MO(this.view);return{visible:{left:i.left+o.left,top:i.top+o.top,right:i.right-o.right,bottom:i.bottom-o.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map(((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)})),size:this.manager.tooltipViews.map((({dom:e})=>e.getBoundingClientRect())),space:this.view.state.facet(LE).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{visible:n,space:i,scaleX:o,scaleY:r}=e,s=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,h=e.pos[a],d=e.size[a];if(!h||!1!==l.clip&&(h.bottom<=Math.max(n.top,i.top)||h.top>=Math.min(n.bottom,i.bottom)||h.right<Math.max(n.left,i.left)-.1||h.left>Math.min(n.right,i.right)+.1)){u.style.top=jE;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,f=p?7:0,g=d.right-d.left,m=null!==(t=NE.get(c))&&void 0!==t?t:d.bottom-d.top,v=c.offset||zE,y=this.view.textDirection==IC.LTR,x=d.width>i.right-i.left?y?i.left:i.right-d.width:y?Math.max(i.left,Math.min(h.left-(p?14:0)+v.x,i.right-g)):Math.min(Math.max(i.left,h.left-g+(p?14:0)-v.x),i.right-g),b=this.above[a];!l.strictSide&&(b?h.top-m-f-v.y<i.top:h.bottom+m+f+v.y>i.bottom)&&b==i.bottom-h.bottom>h.top-i.top&&(b=this.above[a]=!b);let _=(b?h.top-i.top:i.bottom-h.bottom)-f;if(_<m&&!1!==c.resize){if(_<this.view.defaultLineHeight){u.style.top=jE;continue}NE.set(c,m),u.style.height=(m=_)/r+"px"}else u.style.height&&(u.style.height="");let w=b?h.top-m-f-v.y:h.bottom+f+v.y,C=x+g;if(!0!==c.overlap)for(let e of s)e.left<C&&e.right>x&&e.top<w+m&&e.bottom>w&&(w=b?e.top-m-2-f:e.bottom+f+2);if("absolute"==this.position?(u.style.top=(w-e.parent.top)/r+"px",VE(u,(x-e.parent.left)/o)):(u.style.top=w/r+"px",VE(u,x/o)),p){let e=h.left+(y?v.x:-v.x)-(x+14-7);p.style.left=e/o+"px"}!0!==c.overlap&&s.push({left:x,top:w,right:C,bottom:w+m}),u.classList.toggle("cm-tooltip-above",b),u.classList.toggle("cm-tooltip-below",!b),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=jE}},{eventObservers:{scroll(){this.maybeMeasure()}}});function VE(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const FE=xE.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),zE={x:0,y:0},QE=o_.define({enables:[qE,FE]}),HE=o_.define({combine:e=>e.reduce(((e,t)=>e.concat(t)),[])});class WE{static create(e){return new WE(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new IE(e,HE,((e,t)=>this.createHostedView(e,t)),(e=>e.dom.remove()))}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let i=n[e];if(void 0!==i)if(void 0===t)t=i;else if(t!==i)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const UE=QE.compute([HE],(e=>{let t=e.facet(HE);return 0===t.length?null:{pos:Math.min(...t.map((e=>e.pos))),end:Math.max(...t.map((e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos}))),create:WE.create,above:t[0].above,arrow:t.some((e=>e.arrow))}}));class XE{constructor(e,t,n,i,o){this.view=e,this.source=t,this.field=n,this.setHover=i,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((()=>this.startHover()),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.nearest(t.target);if(!n)return;let i,o=1;if(n instanceof dC)i=n.posAtStart;else{if(i=e.posAtCoords(t),null==i)return;let n=e.coordsAtPos(i);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let r=e.bidiSpans(e.state.doc.lineAt(i)).find((e=>e.from<=i&&e.to>=i)),s=r&&r.dir==IC.RTL?-1:1;o=t.x<n.left?-s:s}let r=this.source(e,i,o);if(null==r?void 0:r.then){let t=this.pending={pos:i};r.then((n=>{this.pending==t&&(this.pending=null,!n||Array.isArray(n)&&!n.length||e.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))}),(t=>mO(e.state,t,"hover tooltip")))}else!r||Array.isArray(r)&&!r.length||e.dispatch({effects:this.setHover.of(Array.isArray(r)?r:[r])})}get tooltip(){let e=this.view.plugin(qE),t=e?e.manager.tooltips.findIndex((e=>e.create==WE.create)):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:o}=this;if(i.length&&o&&!function(e,t){let n,{left:i,right:o,top:r,bottom:s}=e.getBoundingClientRect();if(n=e.querySelector(".cm-tooltip-arrow")){let e=n.getBoundingClientRect();r=Math.min(e.top,r),s=Math.max(e.bottom,s)}return t.clientX>=i-KE&&t.clientX<=o+KE&&t.clientY>=r-KE&&t.clientY<=s+KE}(o.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,r=null!==(n=null===(t=i[0])||void 0===t?void 0:t.end)&&void 0!==n?n:o;(o==r?this.view.posAtCoords(this.lastMove)==o:function(e,t,n,i,o,r){let s=e.scrollDOM.getBoundingClientRect(),a=e.documentTop+e.documentPadding.top+e.contentHeight;if(s.left>i||s.right<i||s.top>o||Math.min(s.bottom,a)<o)return!1;let l=e.posAtCoords({x:i,y:o},!1);return l>=t&&l<=n}(this.view,o,r,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const KE=4;function GE(e,t={}){let n=$_.define(),i=h_.define({create:()=>[],update(e,i){if(e.length&&(t.hideOnChange&&(i.docChanged||i.selection)?e=[]:t.hideOn&&(e=e.filter((e=>!t.hideOn(i,e)))),i.docChanged)){let t=[];for(let n of e){let e=i.changes.mapPos(n.pos,-1,Hb.TrackDel);if(null!=e){let o=Object.assign(Object.create(null),n);o.pos=e,null!=o.end&&(o.end=i.changes.mapPos(o.end)),t.push(o)}}e=t}for(let t of i.effects)t.is(n)&&(e=t.value),t.is(ZE)&&(e=[]);return e},provide:e=>HE.from(e)});return{active:i,extension:[i,bO.define((o=>new XE(o,e,i,n,t.hoverTime||300))),UE]}}function YE(e,t){let n=e.plugin(qE);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}const ZE=$_.define(),JE=o_.define({combine(e){let t,n;for(let i of e)t=t||i.topContainer,n=n||i.bottomContainer;return{topContainer:t,bottomContainer:n}}}),eS=bO.fromClass(class{constructor(e){this.input=e.state.facet(iS),this.specs=this.input.filter((e=>e)),this.panels=this.specs.map((t=>t(e)));let t=e.state.facet(JE);this.top=new tS(e,!0,t.topContainer),this.bottom=new tS(e,!1,t.bottomContainer),this.top.sync(this.panels.filter((e=>e.top))),this.bottom.sync(this.panels.filter((e=>!e.top)));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(JE);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new tS(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new tS(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(iS);if(n!=this.input){let t=n.filter((e=>e)),i=[],o=[],r=[],s=[];for(let n of t){let t,a=this.specs.indexOf(n);a<0?(t=n(e.view),s.push(t)):(t=this.panels[a],t.update&&t.update(e)),i.push(t),(t.top?o:r).push(t)}this.specs=t,this.panels=i,this.top.sync(o),this.bottom.sync(r);for(let e of s)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>xE.scrollMargins.of((t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}}))});class tS{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=nS(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=nS(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function nS(e){let t=e.nextSibling;return e.remove(),t}const iS=o_.define({enables:eS});class oS extends X_{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}oS.prototype.elementClass="",oS.prototype.toDOM=void 0,oS.prototype.mapMode=Hb.TrackBefore,oS.prototype.startSide=oS.prototype.endSide=-1,oS.prototype.point=!0;const rS=1024;let sS=0;class aS{constructor(e,t){this.from=e,this.to=t}}class lS{constructor(e={}){this.id=sS++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=hS.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}lS.closedBy=new lS({deserialize:e=>e.split(" ")}),lS.openedBy=new lS({deserialize:e=>e.split(" ")}),lS.group=new lS({deserialize:e=>e.split(" ")}),lS.isolate=new lS({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),lS.contextHash=new lS({perNode:!0}),lS.lookAhead=new lS({perNode:!0}),lS.mounted=new lS({perNode:!0});class cS{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[lS.mounted.id]}}const uS=Object.create(null);class hS{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):uS,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),i=new hS(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return i}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(lS.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return e=>{for(let n=e.prop(lS.group),i=-1;i<(n?n.length:0);i++){let o=t[i<0?e.name:n[i]];if(o)return o}}}}hS.none=new hS("",Object.create(null),0,8);class dS{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let i=null;for(let t of e){let e=t(n);e&&(i||(i=Object.assign({},n.props)),i[e[0].id]=e[1])}t.push(i?new hS(n.name,i,n.id,n.flags):n)}return new dS(t)}}const pS=new WeakMap,fS=new WeakMap;var gS;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"}(gS||(gS={}));class mS{constructor(e,t,n,i,o){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,o&&o.length){this.props=Object.create(null);for(let[e,t]of o)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=cS.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let n=e.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new TS(this.topNode,e)}cursorAt(e,t=0,n=0){let i=pS.get(this)||this.topNode,o=new TS(i);return o.moveTo(e,t),pS.set(this,o._tree),o}get topNode(){return new wS(this,0,0,null)}resolve(e,t=0){let n=bS(pS.get(this)||this.topNode,e,t,!1);return pS.set(this,n),n}resolveInner(e,t=0){let n=bS(fS.get(this)||this.topNode,e,t,!0);return fS.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let i=e.resolveInner(t,n),o=null;for(let e=i instanceof wS?i:i.context.parent;e;e=e.parent)if(e.index<0){let r=e.parent;(o||(o=[i])).push(r.resolve(t,n)),e=r}else{let r=cS.get(e.tree);if(r&&r.overlay&&r.overlay[0].from<=t&&r.overlay[r.overlay.length-1].to>=t){let s=new wS(r.tree,r.overlay[0].from+e.from,-1,e);(o||(o=[i])).push(bS(s,t,n,!1))}}return o?SS(o):i}(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:o=this.length}=e,r=e.mode||0,s=(r&gS.IncludeAnonymous)>0;for(let e=this.cursor(r|gS.IncludeAnonymous);;){let r=!1;if(e.from<=o&&e.to>=i&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;r=!0}for(;r&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;r=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:DS(hS.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,n)=>new mS(this.type,e,t,n,this.propValues)),e.makeTree||((e,t,n)=>new mS(hS.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:o=rS,reused:r=[],minRepeatType:s=i.types.length}=e,a=Array.isArray(n)?new vS(n,n.length):n,l=i.types,c=0,u=0;function h(e,t,n,y,x,b){let{id:_,start:w,end:C,size:O}=a,k=u,E=c;for(;O<0;){if(a.next(),-1==O){let t=r[_];return n.push(t),void y.push(w-e)}if(-3==O)return void(c=_);if(-4==O)return void(u=_);throw new RangeError(`Unrecognized record size: ${O}`)}let S,R,T=l[_],M=w-e;if(C-w<=o&&(R=m(a.pos-t,x))){let t=new Uint16Array(R.size-R.skip),n=a.pos-R.size,o=t.length;for(;a.pos>n;)o=v(R.start,t,o);S=new yS(t,C-R.start,i),M=R.start-e}else{let e=a.pos-O;a.next();let t=[],n=[],i=_>=s?_:-1,r=0,l=C;for(;a.pos>e;)i>=0&&a.id==i&&a.size>=0?(a.end<=l-o&&(f(t,n,w,r,a.end,l,i,k,E),r=t.length,l=a.end),a.next()):b>2500?d(w,e,t,n):h(w,e,t,n,i,b+1);if(i>=0&&r>0&&r<t.length&&f(t,n,w,r,w,l,i,k,E),t.reverse(),n.reverse(),i>-1&&r>0){let e=p(T,E);S=DS(T,t,n,0,t.length,0,C-w,e,e)}else S=g(T,t,n,C-w,k-C,E)}n.push(S),y.push(M)}function d(e,t,n,r){let s=[],l=0,c=-1;for(;a.pos>t;){let{id:e,start:t,end:n,size:i}=a;if(i>4)a.next();else{if(c>-1&&t<c)break;c<0&&(c=n-o),s.push(e,t,n),l++,a.next()}}if(l){let t=new Uint16Array(4*l),o=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-o,t[n++]=s[e+2]-o,t[n++]=n;n.push(new yS(t,s[2]-o,i)),r.push(o-e)}}function p(e,t){return(n,i,o)=>{let r,s,a=0,l=n.length-1;if(l>=0&&(r=n[l])instanceof mS){if(!l&&r.type==e&&r.length==o)return r;(s=r.prop(lS.lookAhead))&&(a=i[l]+r.length+s)}return g(e,n,i,o,a,t)}}function f(e,t,n,o,r,s,a,l,c){let u=[],h=[];for(;e.length>o;)u.push(e.pop()),h.push(t.pop()+n-r);e.push(g(i.types[a],u,h,s-r,l-s,c)),t.push(r-n)}function g(e,t,n,i,o,r,s){if(r){let e=[lS.contextHash,r];s=s?[e].concat(s):[e]}if(o>25){let e=[lS.lookAhead,o];s=s?[e].concat(s):[e]}return new mS(e,t,n,i,s)}function m(e,t){let n=a.fork(),i=0,r=0,l=0,c=n.end-o,u={size:0,start:0,skip:0};e:for(let o=n.pos-e;n.pos>o;){let e=n.size;if(n.id==t&&e>=0){u.size=i,u.start=r,u.skip=l,l+=4,i+=4,n.next();continue}let a=n.pos-e;if(e<0||a<o||n.start<c)break;let h=n.id>=s?4:0,d=n.start;for(n.next();n.pos>a;){if(n.size<0){if(-3!=n.size)break e;h+=4}else n.id>=s&&(h+=4);n.next()}r=d,i+=e,l+=h}return(t<0||i==e)&&(u.size=i,u.start=r,u.skip=l),u.size>4?u:void 0}function v(e,t,n){let{id:i,start:o,end:r,size:l}=a;if(a.next(),l>=0&&i<s){let s=n;if(l>4){let i=a.pos-(l-4);for(;a.pos>i;)n=v(e,t,n)}t[--n]=s,t[--n]=r-e,t[--n]=o-e,t[--n]=i}else-3==l?c=i:-4==l&&(u=i);return n}let y=[],x=[];for(;a.pos>0;)h(e.start||0,e.bufferStart||0,y,x,-1,0);let b=null!==(t=e.length)&&void 0!==t?t:y.length?x[0]+y[0].length:0;return new mS(l[e.topID],y.reverse(),x.reverse(),b)}(e)}}mS.empty=new mS(hS.none,[],[],0);class vS{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new vS(this.buffer,this.index)}}class yS{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return hS.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],o=i.name;if(/\W/.test(o)&&!i.isError&&(o=JSON.stringify(o)),n==(e+=4))return o;let r=[];for(;e<n;)r.push(this.childString(e)),e=this.buffer[e+3];return o+"("+r.join(",")+")"}findChild(e,t,n,i,o){let{buffer:r}=this,s=-1;for(let a=e;a!=t&&!(xS(o,i,r[a+1],r[a+2])&&(s=a,n>0));a=r[a+3]);return s}slice(e,t,n){let i=this.buffer,o=new Uint16Array(t-e),r=0;for(let s=e,a=0;s<t;){o[a++]=i[s++],o[a++]=i[s++]-n;let t=o[a++]=i[s++]-n;o[a++]=i[s++]-e,r=Math.max(r,t)}return new yS(o,r,this.set)}}function xS(e,t,n,i){switch(e){case-2:return n<t;case-1:return i>=t&&n<t;case 0:return n<t&&i>t;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function bS(e,t,n,i){for(var o;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!i&&e instanceof wS&&e.index<0?null:e.parent;if(!t)return e;e=t}let r=i?0:gS.IgnoreOverlays;if(i)for(let i=e,s=i.parent;s;i=s,s=i.parent)i instanceof wS&&i.index<0&&(null===(o=s.enter(t,n,r))||void 0===o?void 0:o.from)!=i.from&&(e=s);for(;;){let i=e.enter(t,n,r);if(!i)return e;e=i}}class _S{cursor(e=0){return new TS(this,e)}getChild(e,t=null,n=null){let i=CS(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return CS(this,e,t,n)}resolve(e,t=0){return bS(this,e,t,!1)}resolveInner(e,t=0){return bS(this,e,t,!0)}matchContext(e){return OS(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class wS extends _S{constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,o=0){for(let r=this;;){for(let{children:s,positions:a}=r._tree,l=t>0?s.length:-1;e!=l;e+=t){let l=s[e],c=a[e]+r.from;if(xS(i,n,c,c+l.length))if(l instanceof yS){if(o&gS.ExcludeBuffers)continue;let s=l.findChild(0,l.buffer.length,t,n-c,i);if(s>-1)return new ES(new kS(r,l,e,c),null,s)}else if(o&gS.IncludeAnonymous||!l.type.isAnonymous||MS(l)){let s;if(!(o&gS.IgnoreMounts)&&(s=cS.get(l))&&!s.overlay)return new wS(s.tree,c,e,r);let a=new wS(l,c,e,r);return o&gS.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?l.children.length-1:0,t,n,i)}}if(o&gS.IncludeAnonymous||!r.type.isAnonymous)return null;if(e=r.index>=0?r.index+t:t<0?-1:r._parent._tree.children.length,r=r._parent,!r)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let i;if(!(n&gS.IgnoreOverlays)&&(i=cS.get(this._tree))&&i.overlay){let n=e-this.from;for(let{from:e,to:o}of i.overlay)if((t>0?e<=n:e<n)&&(t<0?o>=n:o>n))return new wS(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function CS(e,t,n,i){let o=e.cursor(),r=[];if(!o.firstChild())return r;if(null!=n)for(let e=!1;!e;)if(e=o.type.is(n),!o.nextSibling())return r;for(;;){if(null!=i&&o.type.is(i))return r;if(o.type.is(t)&&r.push(o.node),!o.nextSibling())return null==i?r:[]}}function OS(e,t,n=t.length-1){for(let i=e;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class kS{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class ES extends _S{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return o<0?null:new ES(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&gS.ExcludeBuffers)return null;let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new ES(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ES(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new ES(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,o=n.buffer[this.index+3];if(o>i){let r=n.buffer[this.index+1];e.push(n.slice(i,o,r)),t.push(0)}return new mS(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function SS(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let o=e[i];(o.from>n.from||o.to<n.to)&&(n=o,t=i)}let i=n instanceof wS&&n.index<0?null:n.parent,o=e.slice();return i?o[t]=i:o.splice(t,1),new RS(o,n)}class RS{constructor(e,t){this.heads=e,this.node=t}get next(){return SS(this.heads)}}class TS{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof wS)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return!!e&&(e instanceof wS?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,o=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);return!(o<0)&&(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?!(n&gS.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&gS.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&gS.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(i.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;({index:t,_parent:n}=n))if(t>-1)for(let i=t+e,o=e<0?-1:n._tree.children.length;i!=o;i+=e){let e=n._tree.children[i];if(this.mode&gS.IncludeAnonymous||e instanceof yS||!e.type.isAnonymous||MS(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,o=this.stack.length;o>=0;){for(let r=e;r;r=r._parent)if(r.index==i){if(i==this.index)return r;t=r,n=o+1;break e}i=this.stack[--o]}for(let e=n;e<this.stack.length;e++)t=new ES(this.buffer,t,this.stack[e]);return this.bufferNode=new ES(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return OS(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,o=this.stack.length-1;i>=0;o--){if(o<0)return OS(this._tree,e,i);let r=n[t.buffer[this.stack[o]]];if(!r.isAnonymous){if(e[i]&&e[i]!=r.name)return!1;i--}}return!0}}function MS(e){return e.children.some((e=>e instanceof yS||!e.type.isAnonymous||MS(e)))}const AS=new WeakMap;function PS(e,t){if(!e.isAnonymous||t instanceof yS||t.type!=e)return 1;let n=AS.get(t);if(null==n){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof mS)){n=1;break}n+=PS(e,i)}AS.set(t,n)}return n}function DS(e,t,n,i,o,r,s,a,l){let c=0;for(let n=i;n<o;n++)c+=PS(e,t[n]);let u=Math.ceil(1.5*c/8),h=[],d=[];return function t(n,i,o,s,a){for(let c=o;c<s;){let o=c,p=i[c],f=PS(e,n[c]);for(c++;c<s;c++){let t=PS(e,n[c]);if(f+t>=u)break;f+=t}if(c==o+1){if(f>u){let e=n[o];t(e.children,e.positions,0,e.children.length,i[o]+a);continue}h.push(n[o])}else{let t=i[c-1]+n[c-1].length-p;h.push(DS(e,n,i,o,c,p,t,null,l))}d.push(p+a-r)}}(t,n,i,o,0),(a||l)(h,d,s)}class $S{constructor(e,t,n,i,o=!1,r=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(o?1:0)|(r?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let i=[new $S(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],o=1,r=e.length?e[0]:null;for(let s=0,a=0,l=0;;s++){let c=s<t.length?t[s]:null,u=c?c.fromA:1e9;if(u-a>=n)for(;r&&r.from<u;){let t=r;if(a>=t.from||u<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,u)-l;t=e>=n?null:new $S(e,n,t.tree,t.offset+l,s>0,!!c)}if(t&&i.push(t),r.to>u)break;r=o<e.length?e[o++]:null}if(!c)break;a=c.toA,l=c.toA-c.toB}return i}}class jS{startParse(e,t,n){return"string"==typeof e&&(e=new IS(e)),n=n?n.length?n.map((e=>new aS(e.from,e.to))):[new aS(0,0)]:[new aS(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let e=i.advance();if(e)return e}}}class IS{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new lS({perNode:!0});let BS=0;class LS{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=BS++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof LS&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let i=new LS(n,[],null,[]);if(i.set.push(i),t)for(let e of t.set)i.set.push(e);return i}static defineModifier(e){let t=new qS(e);return e=>e.modified.indexOf(t)>-1?e:qS.get(e.base||e,e.modified.concat(t).sort(((e,t)=>e.id-t.id)))}}let NS=0;class qS{constructor(e){this.name=e,this.instances=[],this.id=NS++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((n=>n.base==e&&function(e,t){return e.length==t.length&&e.every(((e,n)=>e==t[n]))}(t,n.modified)));if(n)return n;let i=[],o=new LS(e.name,i,e,t);for(let e of t)e.instances.push(o);let r=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let i=0,o=t.length;i<o;i++)t.push(t[i].concat(e[n]));return t.sort(((e,t)=>t.length-e.length))}(t);for(let t of e.set)if(!t.modified.length)for(let e of r)i.push(qS.get(t,e));return o}}function VS(e){let t=Object.create(null);for(let n in e){let i=e[n];Array.isArray(i)||(i=[i]);for(let e of n.split(" "))if(e){let n=[],o=2,r=e;for(let t=0;;){if("..."==r&&t>0&&t+3==e.length){o=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!i)throw new RangeError("Invalid path: "+e);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),t+=i[0].length,t==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){o=0;break}if("/"!=s)throw new RangeError("Invalid path: "+e);r=e.slice(t)}let s=n.length-1,a=n[s];if(!a)throw new RangeError("Invalid path: "+e);let l=new zS(i,o,s>0?n.slice(0,s):null);t[a]=l.sort(t[a])}}return FS.add(t)}const FS=new lS;class zS{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function QS(e,t){let n=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)n[e.id]=t.class;else n[t.tag.id]=t.class;let{scope:i,all:o=null}=t||{};return{style:e=>{let t=o;for(let i of e)for(let e of i.set){let i=n[e.id];if(i){t=t?t+" "+i:i;break}}return t},scope:i}}function HS(e,t,n,i=0,o=e.length){let r=new WS(i,Array.isArray(t)?t:[t],n);r.highlightRange(e.cursor(),i,o,"",r.highlighters),r.flush(o)}zS.empty=new zS([],2,null);class WS{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,i,o){let{type:r,from:s,to:a}=e;if(s>=n||a<=t)return;r.isTop&&(o=this.highlighters.filter((e=>!e.scope||e.scope(r))));let l=i,c=function(e){let t=e.type.prop(FS);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||zS.empty,u=function(e,t){let n=null;for(let i of e){let e=i.style(t);e&&(n=n?n+" "+e:e)}return n}(o,c.tags);if(u&&(l&&(l+=" "),l+=u,1==c.mode&&(i+=(i?" ":"")+u)),this.startSpan(Math.max(t,s),l),c.opaque)return;let h=e.tree&&e.tree.prop(lS.mounted);if(h&&h.overlay){let r=e.node.enter(h.overlay[0].from+s,1),c=this.highlighters.filter((e=>!e.scope||e.scope(h.tree.type))),u=e.firstChild();for(let d=0,p=s;;d++){let f=d<h.overlay.length?h.overlay[d]:null,g=f?f.from+s:a,m=Math.max(t,p),v=Math.min(n,g);if(m<v&&u)for(;e.from<v&&(this.highlightRange(e,m,v,i,o),this.startSpan(Math.min(v,e.to),l),!(e.to>=g)&&e.nextSibling()););if(!f||g>n)break;p=f.to+s,p>t&&(this.highlightRange(r.cursor(),Math.max(t,f.from+s),Math.min(n,p),"",c),this.startSpan(Math.min(n,p),l))}u&&e.parent()}else if(e.firstChild()){h&&(i="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,o),this.startSpan(Math.min(n,e.to),l)}}while(e.nextSibling());e.parent()}}}const US=LS.define,XS=US(),KS=US(),GS=US(KS),YS=US(KS),ZS=US(),JS=US(ZS),eR=US(ZS),tR=US(),nR=US(tR),iR=US(),oR=US(),rR=US(),sR=US(rR),aR=US(),lR={comment:XS,lineComment:US(XS),blockComment:US(XS),docComment:US(XS),name:KS,variableName:US(KS),typeName:GS,tagName:US(GS),propertyName:YS,attributeName:US(YS),className:US(KS),labelName:US(KS),namespace:US(KS),macroName:US(KS),literal:ZS,string:JS,docString:US(JS),character:US(JS),attributeValue:US(JS),number:eR,integer:US(eR),float:US(eR),bool:US(ZS),regexp:US(ZS),escape:US(ZS),color:US(ZS),url:US(ZS),keyword:iR,self:US(iR),null:US(iR),atom:US(iR),unit:US(iR),modifier:US(iR),operatorKeyword:US(iR),controlKeyword:US(iR),definitionKeyword:US(iR),moduleKeyword:US(iR),operator:oR,derefOperator:US(oR),arithmeticOperator:US(oR),logicOperator:US(oR),bitwiseOperator:US(oR),compareOperator:US(oR),updateOperator:US(oR),definitionOperator:US(oR),typeOperator:US(oR),controlOperator:US(oR),punctuation:rR,separator:US(rR),bracket:sR,angleBracket:US(sR),squareBracket:US(sR),paren:US(sR),brace:US(sR),content:tR,heading:nR,heading1:US(nR),heading2:US(nR),heading3:US(nR),heading4:US(nR),heading5:US(nR),heading6:US(nR),contentSeparator:US(tR),list:US(tR),quote:US(tR),emphasis:US(tR),strong:US(tR),link:US(tR),monospace:US(tR),strikethrough:US(tR),inserted:US(),deleted:US(),changed:US(),invalid:US(),meta:aR,documentMeta:US(aR),annotation:US(aR),processingInstruction:US(aR),definition:LS.defineModifier("definition"),constant:LS.defineModifier("constant"),function:LS.defineModifier("function"),standard:LS.defineModifier("standard"),local:LS.defineModifier("local"),special:LS.defineModifier("special")};for(let e in lR){let t=lR[e];t instanceof LS&&(t.name=e)}var cR;QS([{tag:lR.link,class:"tok-link"},{tag:lR.heading,class:"tok-heading"},{tag:lR.emphasis,class:"tok-emphasis"},{tag:lR.strong,class:"tok-strong"},{tag:lR.keyword,class:"tok-keyword"},{tag:lR.atom,class:"tok-atom"},{tag:lR.bool,class:"tok-bool"},{tag:lR.url,class:"tok-url"},{tag:lR.labelName,class:"tok-labelName"},{tag:lR.inserted,class:"tok-inserted"},{tag:lR.deleted,class:"tok-deleted"},{tag:lR.literal,class:"tok-literal"},{tag:lR.string,class:"tok-string"},{tag:lR.number,class:"tok-number"},{tag:[lR.regexp,lR.escape,lR.special(lR.string)],class:"tok-string2"},{tag:lR.variableName,class:"tok-variableName"},{tag:lR.local(lR.variableName),class:"tok-variableName tok-local"},{tag:lR.definition(lR.variableName),class:"tok-variableName tok-definition"},{tag:lR.special(lR.variableName),class:"tok-variableName2"},{tag:lR.definition(lR.propertyName),class:"tok-propertyName tok-definition"},{tag:lR.typeName,class:"tok-typeName"},{tag:lR.namespace,class:"tok-namespace"},{tag:lR.className,class:"tok-className"},{tag:lR.macroName,class:"tok-macroName"},{tag:lR.propertyName,class:"tok-propertyName"},{tag:lR.operator,class:"tok-operator"},{tag:lR.comment,class:"tok-comment"},{tag:lR.meta,class:"tok-meta"},{tag:lR.invalid,class:"tok-invalid"},{tag:lR.punctuation,class:"tok-punctuation"}]);const uR=new lS;const hR=new lS;class dR{constructor(e,t,n=[],i=""){this.data=e,this.name=i,W_.prototype.hasOwnProperty("tree")||Object.defineProperty(W_.prototype,"tree",{get(){return gR(this)}}),this.parser=t,this.extension=[OR.of(this),W_.languageData.of(((e,t,n)=>{let i=pR(e,t,n),o=i.type.prop(uR);if(!o)return[];let r=e.facet(o),s=i.type.prop(hR);if(s){let o=i.resolve(t-i.from,n);for(let t of s)if(t.test(o,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(r)}}return r}))].concat(n)}isActiveAt(e,t,n=-1){return pR(e,t,n).type.prop(uR)==this.data}findRegions(e){let t=e.facet(OR);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(e,t)=>{if(e.prop(uR)==this.data)return void n.push({from:t,to:t+e.length});let o=e.prop(lS.mounted);if(o){if(o.tree.prop(uR)==this.data){if(o.overlay)for(let e of o.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(o.overlay){let e=n.length;if(i(o.tree,o.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let o=e.children[n];o instanceof mS&&i(o,e.positions[n]+t)}};return i(gR(e),0),n}get allowsNesting(){return!0}}function pR(e,t,n){let i=e.facet(OR),o=gR(e).topNode;if(!i||i.allowsNesting)for(let e=o;e;e=e.enter(t,n,gS.ExcludeBuffers))e.type.isTop&&(o=e);return o}dR.setState=$_.define();class fR extends dR{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=(n=e.languageData,o_.define({combine:n?e=>e.concat(n):void 0}));var n;return new fR(t,e.parser.configure({props:[uR.add((e=>e.isTop?t:void 0))]}),e.name)}configure(e,t){return new fR(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function gR(e){let t=e.field(dR.state,!1);return t?t.tree:mS.empty}class mR{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let vR=null;class yR{constructor(e,t,n=[],i,o,r,s,a){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=o,this.viewport=r,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new yR(e,t,[],mS.empty,0,n,[],null)}startParse(){return this.parser.startParse(new mR(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=mS.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i){if(this.fragments=this.withoutTempSkipped($S.addTree(i,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=i,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}}))}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((()=>{for(;!(t=this.parse.advance()););})),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped($S.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=vR;vR=this;try{return e()}finally{vR=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=xR(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:o,viewport:r,skipped:s}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,n,i,o)=>t.push({fromA:e,toA:n,fromB:i,toB:o}))),n=$S.applyChanges(n,t),i=mS.empty,o=0,r={from:e.mapPos(r.from,-1),to:e.mapPos(r.to,1)},this.skipped.length){s=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);n<i&&s.push({from:n,to:i})}}}return new yR(this.parser,t,n,i,o,r,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:i}=this.skipped[t];n<e.to&&i>e.from&&(this.fragments=xR(this.fragments,n,i),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends jS{createParse(t,n,i){let o=i[0].from,r=i[i.length-1].to,s={parsedPos:o,advance(){let t=vR;if(t){for(let e of i)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=r,new mS(hS.none,[],[],r-o)},stoppedAt:null,stopAt(){}};return s}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return vR}}function xR(e,t,n){return $S.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class bR{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new bR(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=yR.create(e.facet(OR).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new bR(n)}}dR.state=h_.define({create:bR.init,update(e,t){for(let e of t.effects)if(e.is(dR.setState))return e.value;return t.startState.facet(OR)!=t.state.facet(OR)?bR.init(t.state):e.apply(t)}});let _R=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(_R=e=>{let t=-1,n=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const wR="undefined"!=typeof navigator&&(null===(cR=navigator.scheduling)||void 0===cR?void 0:cR.isInputPending)?()=>navigator.scheduling.isInputPending():null,CR=bO.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(dR.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(dR.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=_R(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,o=n.field(dR.state);if(o.tree==o.context.tree&&o.context.isDone(i+1e5))return;let r=Date.now()+Math.min(this.chunkBudget,100,e&&!wR?Math.max(25,e.timeRemaining()-5):1e9),s=o.context.treeLen<i&&n.doc.length>i+1e3,a=o.context.work((()=>wR&&wR()||Date.now()>r),i+(s?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:dR.setState.of(new bR(o.context))})),this.chunkBudget>0&&(!a||s)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((()=>this.scheduleWork())).catch((e=>mO(this.view.state,e))).then((()=>this.workScheduled--)),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),OR=o_.define({combine:e=>e.length?e[0]:null,enables:e=>[dR.state,CR,xE.contentAttributes.compute([e],(t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]});class kR{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const ER=o_.define(),SR=o_.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((e=>e!=t[0])))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function RR(e){let t=e.facet(SR);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function TR(e,t){let n="",i=e.tabSize,o=e.facet(SR)[0];if("\t"==o){for(;t>=i;)n+="\t",t-=i;o=" "}for(let e=0;e<t;e++)n+=o;return n}function MR(e,t){e instanceof W_&&(e=new AR(e));for(let n of e.state.facet(ER)){let i=n(e,t);if(void 0!==i)return i}let n=gR(e.state);return n.length>=t?function(e,t,n){let i=t.resolveStack(n),o=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(o!=i.node){let e=[];for(let t=o;t&&(t.from!=i.node.from||t.type!=i.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)i={node:e[t],next:i}}return DR(i,e,n)}(e,n,t):null}class AR{constructor(e,t={}){this.state=e,this.options=t,this.unit=RR(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:o}=this.options;return null!=i&&i>=n.from&&i<=n.to?o&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),o=this.countColumn(n,e-i),r=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return r>-1&&(o+=r-this.countColumn(n,n.search(/\S|$/))),o}countColumn(e,t=e.length){return uw(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),o=this.options.overrideIndentation;if(o){let e=o(i);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const PR=new lS;function DR(e,t,n){for(let i=e;i;i=i.next){let e=$R(i.node);if(e)return e(IR.create(t,n,i))}return 0}function $R(e){let t=e.type.prop(PR);if(t)return t;let n,i=e.firstChild;if(i&&(n=i.type.prop(lS.closedBy))){let t=e.lastChild,i=t&&n.indexOf(t.name)>-1;return e=>NR(e,!0,1,void 0,i&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?jR:null}function jR(){return 0}class IR extends AR{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new IR(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(BR(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return DR(this.context.next,this.base,this.pos)}}function BR(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function LR({closing:e,align:t=!0,units:n=1}){return i=>NR(i,t,n,e)}function NR(e,t,n,i,o){let r=e.textAfter,s=r.match(/^\s*/)[0].length,a=i&&r.slice(s,s+i.length)==i||o==e.pos+s,l=t?function(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let o=e.options.simulateBreak,r=e.state.doc.lineAt(n.from),s=null==o||o<=r.from?r.to:Math.min(r.to,o);for(let e=n.to;;){let o=t.childAfter(e);if(!o||o==i)return null;if(!o.type.isSkipped){if(o.from>=s)return null;let e=/^ */.exec(r.text.slice(n.to-r.from))[0].length;return{from:n.from,to:n.to+e}}e=o.to}}(e):null;return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}function qR({except:e,units:t=1}={}){return n=>{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}const VR=200;const FR=new lS;function zR(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}class QR{constructor(e,t){let n;function i(e){let t=fw.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const o="string"==typeof t.all?t.all:t.all?i(t.all):void 0,r=t.scope;this.scope=r instanceof dR?e=>e.prop(uR)==r.data:r?e=>e==r:void 0,this.style=QS(e.map((e=>({tag:e.tag,class:e.class||i(Object.assign({},e,{tag:null}))}))),{all:o}).style,this.module=n?new fw(n):null,this.themeType=t.themeType}static define(e,t){return new QR(e,t||{})}}const HR=o_.define(),WR=o_.define({combine:e=>e.length?[e[0]]:null});function UR(e){let t=e.facet(HR);return t.length?t:e.facet(WR)}class XR{constructor(e){this.markCache=Object.create(null),this.tree=gR(e.state),this.decorations=this.buildDeco(e,UR(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=gR(e.state),n=UR(e.state),i=n!=UR(e.startState),{viewport:o}=e.view,r=e.changes.mapPos(this.decoratedTo,1);t.length<o.to&&!i&&t.type==this.tree.type&&r>=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=r):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=o.to)}buildDeco(e,t){if(!t||!this.tree.length)return OC.none;let n=new J_;for(let{from:i,to:o}of e.visibleRanges)HS(this.tree,t,((e,t,i)=>{n.add(e,t,this.markCache[i]||(this.markCache[i]=OC.mark({class:i})))}),i,o);return n.finish()}}const KR=v_.high(bO.fromClass(XR,{decorations:e=>e.decorations}));lR.meta,lR.link,lR.heading,lR.emphasis,lR.strong,lR.strikethrough,lR.keyword,lR.atom,lR.bool,lR.url,lR.contentSeparator,lR.labelName,lR.literal,lR.inserted,lR.string,lR.deleted,lR.regexp,lR.escape,lR.string,lR.variableName,lR.variableName,lR.typeName,lR.namespace,lR.className,lR.variableName,lR.macroName,lR.propertyName,lR.comment,lR.invalid;const GR=xE.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),YR=1e4,ZR="()[]{}",JR=o_.define({combine:e=>U_(e,{afterCursor:!0,brackets:ZR,maxScanDistance:YR,renderMatch:nT})}),eT=OC.mark({class:"cm-matchingBracket"}),tT=OC.mark({class:"cm-nonmatchingBracket"});function nT(e){let t=[],n=e.matched?eT:tT;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const iT=h_.define({create:()=>OC.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],i=t.state.facet(JR);for(let e of t.state.selection.ranges){if(!e.empty)continue;let o=cT(t.state,e.head,-1,i)||e.head>0&&cT(t.state,e.head-1,1,i)||i.afterCursor&&(cT(t.state,e.head,1,i)||e.head<t.state.doc.length&&cT(t.state,e.head+1,-1,i));o&&(n=n.concat(i.renderMatch(o,t.state)))}return OC.set(n,!0)},provide:e=>xE.decorations.from(e)}),oT=[iT,GR];function rT(e={}){return[JR.of(e),oT]}const sT=new lS;function aT(e,t,n){let i=e.prop(t<0?lS.openedBy:lS.closedBy);if(i)return i;if(1==e.name.length){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function lT(e){let t=e.type.prop(sT);return t?t(e.node):e}function cT(e,t,n,i={}){let o=i.maxScanDistance||YR,r=i.brackets||ZR,s=gR(e),a=s.resolveInner(t,n);for(let i=a;i;i=i.parent){let o=aT(i.type,n,r);if(o&&i.from<i.to){let s=lT(i);if(s&&(n>0?t>=s.from&&t<s.to:t>s.from&&t<=s.to))return uT(e,t,n,i,s,o,r)}}return function(e,t,n,i,o,r,s){let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),h=0;for(let e=0;!u.next().done&&e<=r;){let r=u.value;n<0&&(e+=r.length);let a=t+e*n;for(let e=n>0?0:r.length-1,t=n>0?r.length:-1;e!=t;e+=n){let t=s.indexOf(r[e]);if(!(t<0||i.resolveInner(a+e,1).type!=o))if(t%2==0==n>0)h++;else{if(1==h)return{start:c,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};h--}}n>0&&(e+=r.length)}return u.done?{start:c,matched:!1}:null}(e,t,n,s,a.type,o,r)}function uT(e,t,n,i,o,r,s){let a=i.parent,l={from:o.from,to:o.to},c=0,u=null==a?void 0:a.cursor();if(u&&(n<0?u.childBefore(i.from):u.childAfter(i.to)))do{if(n<0?u.to<=i.from:u.from>=i.to){if(0==c&&r.indexOf(u.type.name)>-1&&u.from<u.to){let e=lT(u);return{start:l,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(aT(u.type,n,s))c++;else if(aT(u.type,-n,s)){if(0==c){let e=lT(u);return{start:l,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}const hT=Object.create(null),dT=[hS.none],pT=[],fT=Object.create(null),gT=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])gT[e]=vT(hT,t);function mT(e,t){pT.indexOf(e)>-1||(pT.push(e),console.warn(t))}function vT(e,t){let n=[];for(let i of t.split(" ")){let t=[];for(let n of i.split(".")){let i=e[n]||lR[n];i?"function"==typeof i?t.length?t=t.map(i):mT(n,`Modifier ${n} used at start of tag`):t.length?mT(n,`Tag ${n} used as modifier`):t=Array.isArray(i)?i:[i]:mT(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),o=i+" "+n.map((e=>e.id)),r=fT[o];if(r)return r.id;let s=fT[o]=hS.define({id:dT.length,name:i,props:[VS({[i]:n})]});return dT.push(s),s.id}IC.RTL,IC.LTR;class yT{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=gR(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),o=i.search(CT(e,!1));return o<0?null:{from:n+o,to:this.pos,text:i.slice(o)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function xT(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function bT(e){let t=e.map((e=>"string"==typeof e?{label:e}:e)),[n,i]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let e=1;e<i.length;e++)n[i[e]]=!0}let i=xT(t)+xT(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}(t);return e=>{let o=e.matchBefore(i);return o||e.explicit?{from:o?o.from:e.pos,options:t,validFor:n}:null}}class _T{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function wT(e){return e.selection.main.from}function CT(e,t){var n;let{source:i}=e,o=t&&"^"!=i[0],r="$"!=i[i.length-1];return o||r?new RegExp(`${o?"^":""}(?:${i})${r?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const OT=A_.define();const kT=new WeakMap;function ET(e){if(!Array.isArray(e))return e;let t=kT.get(e);return t||kT.set(e,t=bT(e)),t}const ST=$_.define(),RT=$_.define();class TT{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=Vb(e,t),i=zb(n);this.chars.push(n);let o=e.slice(t,t+i),r=o.toUpperCase();this.folded.push(Vb(r==o?o.toLowerCase():r,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:i,precise:o,byWord:r}=this;if(1==t.length){let i=Vb(e,0),o=zb(i),r=o==e.length?0:-100;if(i==t[0]);else{if(i!=n[0])return null;r+=-200}return this.ret(r,[0,o])}let s=e.indexOf(this.pattern);if(0==s)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,l=0;if(s<0){for(let o=0,r=Math.min(e.length,200);o<r&&l<a;){let r=Vb(e,o);r!=t[l]&&r!=n[l]||(i[l++]=o),o+=zb(r)}if(l<a)return null}let c=0,u=0,h=!1,d=0,p=-1,f=-1,g=/[a-z]/.test(e),m=!0;for(let i=0,l=Math.min(e.length,200),v=0;i<l&&u<a;){let l=Vb(e,i);s<0&&(c<a&&l==t[c]&&(o[c++]=i),d<a&&(l==t[d]||l==n[d]?(0==d&&(p=i),f=i+1,d++):d=0));let y,x=l<255?l>=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=Fb(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!i||1==x&&g||0==v&&0!=x)&&(t[u]==l||n[u]==l&&(h=!0)?r[u++]=i:r.length&&(m=!1)),v=x,i+=zb(l)}return u==a&&0==r[0]&&m?this.result((h?-200:0)-100,r,e):d==a&&0==p?this.ret(-200-e.length+(f==e.length?0:-100),[0,f]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):d==a?this.ret(-900-e.length,[p,f]):u==a?this.result((h?-200:0)-100-700+(m?0:-1100),r,e):2==t.length?null:this.result((i[0]?-700:0)-200-1100,i,e)}result(e,t,n){let i=[],o=0;for(let e of t){let t=e+(this.astral?zb(Vb(n,e)):1);o&&i[o-1]==e?i[o-1]=t:(i[o++]=e,i[o++]=t)}return this.ret(e-n.length,i)}}class MT{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const AT=o_.define({combine:e=>U_(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:DT,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>PT(e(n),t(n)),optionClass:(e,t)=>n=>PT(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function PT(e,t){return e?t?e+" "+t:e:t}function DT(e,t,n,i,o,r){let s,a,l=e.textDirection==IC.RTL,c=l,u=!1,h="top",d=t.left-o.left,p=o.right-t.right,f=i.right-i.left,g=i.bottom-i.top;if(c&&d<Math.min(f,p)?c=!1:!c&&p<Math.min(f,d)&&(c=!0),f<=(c?d:p))s=Math.max(o.top,Math.min(n.top,o.bottom-g))-t.top,a=Math.min(400,c?d:p);else{u=!0,a=Math.min(400,(l?t.right:o.right-t.left)-30);let e=o.bottom-t.bottom;e>=g||e>t.top?s=n.bottom-t.top:(h="bottom",s=t.bottom-n.top)}return{style:`${h}: ${s/((t.bottom-t.top)/r.offsetHeight)}px; max-width: ${a/((t.right-t.left)/r.offsetWidth)}px`,class:"cm-completionInfo-"+(u?l?"left-narrow":"right-narrow":c?"left":"right")}}function $T(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let i=Math.floor((e-t)/n);return{from:e-(i+1)*n,to:e-i*n}}class jT{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:o,selected:r}=i.open,s=e.state.facet(AT);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map((e=>"cm-completionIcon-"+e))),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,i){let o=document.createElement("span");o.className="cm-completionLabel";let r=e.displayLabel||e.label,s=0;for(let e=0;e<i.length;){let t=i[e++],n=i[e++];t>s&&o.appendChild(document.createTextNode(r.slice(s,t)));let a=o.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(r.slice(t,n))),a.className="cm-completionMatchedText",s=n}return s<r.length&&o.appendChild(document.createTextNode(r.slice(s))),o},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort(((e,t)=>e.position-t.position)).map((e=>e.render))}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=$T(o.length,r,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",(n=>{let{options:i}=e.state.field(t).open;for(let t,o=n.target;o&&o!=this.dom;o=o.parentNode)if("LI"==o.nodeName&&(t=/-(\d+)$/.exec(o.id))&&+t[1]<i.length)return this.applyCompletion(e,i[+t[1]]),void n.preventDefault()})),this.dom.addEventListener("focusout",(t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(AT).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:RT.of(null)})})),this.showOptions(o,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}update(e){var t;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:o,selected:r,disabled:s}=n.open;i.open&&i.open.options==o||(this.range=$T(o.length,r,e.state.facet(AT).maxRenderedOptions),this.showOptions(o,n.id)),this.updateSel(),s!=(null===(t=i.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=$T(t.options.length,t.selected,this.view.state.facet(AT).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:n}=t.options[t.selected],{info:i}=n;if(!i)return;let o="string"==typeof i?document.createTextNode(i):i(n);if(!o)return;"then"in o?o.then((t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,n)})).catch((e=>mO(this.view.state,e,"completion info"))):this.addInfoPane(o,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:i}=e;n.appendChild(t),this.infoDestroy=i||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)"LI"==n.nodeName&&n.id?i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected"):i--;return t&&function(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),o=n.height/e.offsetHeight;i.top<n.top?e.scrollTop-=(n.top-i.top)/o:i.bottom>n.bottom&&(e.scrollTop+=(i.bottom-n.bottom)/o)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),o=this.space;if(!o){let e=this.dom.ownerDocument.defaultView||window;o={left:0,top:0,right:e.innerWidth,bottom:e.innerHeight}}return i.top>Math.min(o.bottom,t.bottom)-10||i.bottom<Math.max(o.top,t.top)+10?null:this.view.state.facet(AT).positionInfo(this.view,t,i,n,o,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions"));let o=null;for(let r=n.from;r<n.to;r++){let{completion:s,match:a}=e[r],{section:l}=s;if(l){let e="string"==typeof l?l:l.name;if(e!=o&&(r>n.from||0==n.from))if(o=e,"string"!=typeof l&&l.header)i.appendChild(l.header(l));else{i.appendChild(document.createElement("completion-section")).textContent=e}}const c=i.appendChild(document.createElement("li"));c.id=t+"-"+r,c.setAttribute("role","option");let u=this.optionClass(s);u&&(c.className=u);for(let e of this.optionContent){let t=e(s,this.view.state,this.view,a);t&&c.appendChild(t)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function IT(e,t){return n=>new jT(n,e,t)}function BT(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class LT{constructor(e,t,n,i,o,r){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=o,this.disabled=r}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new LT(this.options,FT(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,o,r){if(i&&!r&&e.some((e=>e.isPending)))return i.setDisabled();let s=function(e,t){let n=[],i=null,o=e=>{n.push(e);let{section:t}=e.completion;if(t){i||(i=[]);let e="string"==typeof t?t:t.name;i.some((t=>t.name==e))||i.push("string"==typeof t?{name:e}:t)}},r=t.facet(AT);for(let i of e)if(i.hasResult()){let e=i.result.getMatch;if(!1===i.result.filter)for(let t of i.result.options)o(new _T(t,i.source,e?e(t):[],1e9-n.length));else{let n,s=t.sliceDoc(i.from,i.to),a=r.filterStrict?new MT(s):new TT(s);for(let t of i.result.options)if(n=a.match(t.label)){let r=t.displayLabel?e?e(t,n.matched):[]:n.matched;o(new _T(t,i.source,r,n.score+(t.boost||0)))}}}if(i){let e=Object.create(null),t=0,o=(e,t)=>{var n,i;return(null!==(n=e.rank)&&void 0!==n?n:1e9)-(null!==(i=t.rank)&&void 0!==i?i:1e9)||(e.name<t.name?-1:1)};for(let n of i.sort(o))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let s=[],a=null,l=r.compareCompletions;for(let e of n.sort(((e,t)=>t.score-e.score||l(e.completion,t.completion)))){let t=e.completion;!a||a.label!=t.label||a.detail!=t.detail||null!=a.type&&null!=t.type&&a.type!=t.type||a.apply!=t.apply||a.boost!=t.boost?s.push(e):BT(e.completion)>BT(a)&&(s[s.length-1]=e),a=e.completion}return s}(e,t);if(!s.length)return i&&e.some((e=>e.isPending))?i.setDisabled():null;let a=t.facet(AT).selectOnOpen?0:-1;if(i&&i.selected!=a&&-1!=i.selected){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){a=t;break}}return new LT(s,FT(n,a),{pos:e.reduce(((e,t)=>t.hasResult()?Math.min(e,t.from):e),1e8),create:YT,above:o.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new LT(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new LT(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class NT{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new NT(zT,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(AT),i=(n.override||t.languageDataAt("autocomplete",wT(t)).map(ET)).map((t=>{let i=this.active.find((e=>e.source==t))||new HT(t,this.active.some((e=>0!=e.state))?1:0);return i.update(e,n)}));i.length==this.active.length&&i.every(((e,t)=>e==this.active[t]))&&(i=this.active);let o=this.open,r=e.effects.some((e=>e.is(UT)));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some((t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to)))||!function(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;i<t.length&&!t[i].hasResult();)i++;let o=n==e.length,r=i==t.length;if(o||r)return o==r;if(e[n++].result!=t[i++].result)return!1}}(i,this.active)||r?o=LT.build(i,t,this.id,o,n,r):o&&o.disabled&&!i.some((e=>e.isPending))&&(o=null),!o&&i.every((e=>!e.isPending))&&i.some((e=>e.hasResult()))&&(i=i.map((e=>e.hasResult()?new HT(e.source,0):e)));for(let t of e.effects)t.is(XT)&&(o=o&&o.setSelected(t.value,this.id));return i==this.active&&o==this.open?this:new NT(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?qT:VT}}const qT={"aria-autocomplete":"list"},VT={};function FT(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const zT=[];function QT(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(OT);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class HT{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=QT(e,t),i=this;(8&n||16&n&&this.touches(e))&&(i=new HT(i.source,0)),4&n&&0==i.state&&(i=new HT(this.source,1)),i=i.updateFor(e,n);for(let t of e.effects)if(t.is(ST))i=new HT(i.source,1,t.value);else if(t.is(RT))i=new HT(i.source,0);else if(t.is(UT))for(let e of t.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(wT(e.state))}}class WT extends HT{constructor(e,t,n,i,o,r){super(e,3,t),this.limit=n,this.result=i,this.from=o,this.to=r}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let o=e.changes.mapPos(this.from),r=e.changes.mapPos(this.to,1),s=wT(e.state);if(s>r||!i||2&t&&(wT(e.startState)==this.from||s<this.limit))return new HT(this.source,4&t?1:0);let a=e.changes.mapPos(this.limit);return function(e,t,n,i){if(!e)return!1;let o=t.sliceDoc(n,i);return"function"==typeof e?e(o,n,i,t):CT(e,!0).test(o)}(i.validFor,e.state,o,r)?new WT(this.source,this.explicit,a,i,o,r):i.update&&(i=i.update(i,o,r,new yT(e.state,s,!1)))?new WT(this.source,this.explicit,a,i,i.from,null!==(n=i.to)&&void 0!==n?n:wT(e.state)):new HT(this.source,1,this.explicit)}map(e){if(e.empty)return this;return(this.result.map?this.result.map(this.result,e):this.result)?new WT(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new HT(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}const UT=$_.define({map:(e,t)=>e.map((e=>e.map(t)))}),XT=$_.define(),KT=h_.define({create:()=>NT.start(),update:(e,t)=>e.update(t),provide:e=>[QE.from(e,(e=>e.tooltip)),xE.contentAttributes.from(e,(e=>e.attrs))]});function GT(e,t){const n=t.completion.apply||t.completion.label;let i=e.state.field(KT).active.find((e=>e.source==t.source));return i instanceof WT&&("string"==typeof n?e.dispatch(Object.assign(Object.assign({},function(e,t,n,i){let{main:o}=e.selection,r=n-o.from,s=i-o.from;return Object.assign(Object.assign({},e.changeByRange((a=>{if(a!=o&&n!=i&&e.sliceDoc(a.from+r,a.from+s)!=e.sliceDoc(n,i))return{range:a};let l=e.toText(t);return{changes:{from:a.from+r,to:i==o.from?a.to:a.from+s,insert:l},range:t_.cursor(a.from+r+l.length)}}))),{scrollIntoView:!0,userEvent:"input.complete"})}(e.state,n,i.from,i.to)),{annotations:OT.of(t.completion)})):n(e,t.completion,i.from,i.to),!0)}const YT=IT(KT,GT);function ZT(e,t="option"){return n=>{let i=n.state.field(KT,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(AT).interactionDelay)return!1;let o,r=1;"page"==t&&(o=YE(n,i.open.tooltip))&&(r=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:s}=i.open.options,a=i.open.selected>-1?i.open.selected+r*(e?1:-1):e?0:s-1;return a<0?a="page"==t?0:s-1:a>=s&&(a="page"==t?s-1:0),n.dispatch({effects:XT.of(a)}),!0}}const JT=e=>!!e.state.field(KT,!1)&&(e.dispatch({effects:ST.of(!0)}),!0);class eM{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const tM=bO.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(KT).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(KT),n=e.state.facet(AT);if(!e.selectionSet&&!e.docChanged&&e.startState.field(KT)==t)return;let i=e.transactions.some((e=>{let t=QT(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)}));for(let t=0;t<this.running.length;t++){let n=this.running[t];if(i||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){mO(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some((e=>e.effects.some((e=>e.is(ST)))))&&(this.pendingStart=!0);let o=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some((e=>e.isPending&&!this.running.some((t=>t.active.source==e.source))))?setTimeout((()=>this.startUpdate()),o):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(KT);for(let e of t.active)e.isPending&&!this.running.some((t=>t.active.source==e.source))&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(AT).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=wT(t),i=new yT(t,n,e.explicit,this.view),o=new eM(e,i);this.running.push(o),Promise.resolve(e.source(i)).then((e=>{o.context.aborted||(o.done=e||null,this.scheduleAccept())}),(e=>{this.view.dispatch({effects:RT.of(null)}),mO(this.view.state,e)}))}scheduleAccept(){this.running.every((e=>void 0!==e.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(AT).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(AT),i=this.view.state.field(KT);for(let o=0;o<this.running.length;o++){let r=this.running[o];if(void 0===r.done)continue;if(this.running.splice(o--,1),r.done){let i=wT(r.updates.length?r.updates[0].startState:this.view.state),o=Math.min(i,r.done.from+(r.active.explicit?0:1)),s=new WT(r.active.source,r.active.explicit,o,r.done,r.done.from,null!==(e=r.done.to)&&void 0!==e?e:i);for(let e of r.updates)s=s.update(e,n);if(s.hasResult()){t.push(s);continue}}let s=i.active.find((e=>e.source==r.active.source));if(s&&s.isPending)if(null==r.done){let e=new HT(r.active.source,0);for(let t of r.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(s)}(t.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:UT.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(KT,!1);if(t&&t.tooltip&&this.view.state.facet(AT).closeOnBlur){let n=t.open&&YE(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout((()=>this.view.dispatch({effects:RT.of(null)})),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:ST.of(!1)})),20),this.composing=0}}}),nM="object"==typeof navigator&&/Win/.test(navigator.platform),iM=v_.highest(xE.domEventHandlers({keydown(e,t){let n=t.state.field(KT,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&(!nM||!e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],o=n.active.find((e=>e.source==i.source)),r=i.completion.commitCharacters||o.result.commitCharacters;return r&&r.indexOf(e.key)>-1&>(t,i),!1}})),oM=xE.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'?︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class rM{constructor(e,t,n,i){this.field=e,this.line=t,this.from=n,this.to=i}}class sM{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,Hb.TrackDel),n=e.mapPos(this.to,1,Hb.TrackDel);return null==t||null==n?null:new sM(this.field,t,n)}}class aM{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],i=[t],o=e.doc.lineAt(t),r=/^\s*/.exec(o.text)[0];for(let o of this.lines){if(n.length){let n=r,s=/^\t*/.exec(o)[0].length;for(let t=0;t<s;t++)n+=e.facet(SR);i.push(t+n.length-s),o=n+o.slice(s)}n.push(o),t+=o.length+1}let s=this.fieldPositions.map((e=>new sM(e.field,i[e.line]+e.from,i[e.line]+e.to)));return{text:n,ranges:s}}static parse(e){let t,n=[],i=[],o=[];for(let r of e.split(/\r\n?|\n/)){for(;t=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(r);){let e=t[1]?+t[1]:null,s=t[2]||t[3]||"",a=-1,l=s.replace(/\\[{}]/g,(e=>e[1]));for(let t=0;t<n.length;t++)(null!=e?n[t].seq==e:l&&n[t].name==l)&&(a=t);if(a<0){let t=0;for(;t<n.length&&(null==e||null!=n[t].seq&&n[t].seq<e);)t++;n.splice(t,0,{seq:e,name:l}),a=t;for(let e of o)e.field>=a&&e.field++}o.push(new rM(a,i.length,t.index,t.index+l.length)),r=r.slice(0,t.index)+s+r.slice(t.index+t[0].length)}r=r.replace(/\\([{}])/g,((e,t,n)=>{for(let e of o)e.line==i.length&&e.from>n&&(e.from--,e.to--);return t})),i.push(r)}return new aM(i,o)}}let lM=OC.widget({widget:new class extends wC{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),cM=OC.mark({class:"cm-snippetField"});class uM{constructor(e,t){this.ranges=e,this.active=t,this.deco=OC.set(e.map((e=>(e.from==e.to?lM:cM).range(e.from,e.to))))}map(e){let t=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;t.push(i)}return new uM(t,this.active)}selectionInsideField(e){return e.ranges.every((e=>this.ranges.some((t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))))}}const hM=$_.define({map:(e,t)=>e&&e.map(t)}),dM=$_.define(),pM=h_.define({create:()=>null,update(e,t){for(let n of t.effects){if(n.is(hM))return n.value;if(n.is(dM)&&e)return new uM(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>xE.decorations.from(e,(e=>e?e.deco:OC.none))});function fM(e,t){return t_.create(e.filter((e=>e.field==t)).map((e=>t_.range(e.from,e.to))))}function gM(e){let t=aM.parse(e);return(e,n,i,o)=>{let{text:r,ranges:s}=t.instantiate(e.state,i),{main:a}=e.state.selection,l={changes:{from:i,to:o==a.from?a.to:o,insert:Mb.of(r)},scrollIntoView:!0,annotations:n?[OT.of(n),j_.userEvent.of("input.complete")]:void 0};if(s.length&&(l.selection=fM(s,0)),s.some((e=>e.field>0))){let t=new uM(s,0),n=l.effects=[hM.of(t)];void 0===e.state.field(pM,!1)&&n.push($_.appendConfig.of([pM,xM,_M,oM]))}e.dispatch(e.state.update(l))}}function mM(e){return({state:t,dispatch:n})=>{let i=t.field(pM,!1);if(!i||e<0&&0==i.active)return!1;let o=i.active+e,r=e>0&&!i.ranges.some((t=>t.field==o+e));return n(t.update({selection:fM(i.ranges,o),effects:hM.of(r?null:new uM(i.ranges,o)),scrollIntoView:!0})),!0}}const vM=[{key:"Tab",run:mM(1),shift:mM(-1)},{key:"Escape",run:({state:e,dispatch:t})=>!!e.field(pM,!1)&&(t(e.update({effects:hM.of(null)})),!0)}],yM=o_.define({combine:e=>e.length?e[0]:vM}),xM=v_.highest(SE.compute([yM],(e=>e.facet(yM))));function bM(e,t){return Object.assign(Object.assign({},t),{apply:gM(e)})}const _M=xE.domEventHandlers({mousedown(e,t){let n,i=t.state.field(pM,!1);if(!i||null==(n=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;let o=i.ranges.find((e=>e.from<=n&&e.to>=n));return!(!o||o.field==i.active)&&(t.dispatch({selection:fM(i.ranges,o.field),effects:hM.of(i.ranges.some((e=>e.field>o.field))?new uM(i.ranges,o.field):null),scrollIntoView:!0}),!0)}}),wM={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},CM=$_.define({map(e,t){let n=t.mapPos(e,-1,Hb.TrackAfter);return null==n?void 0:n}}),OM=new class extends X_{};OM.startSide=1,OM.endSide=-1;const kM=h_.define({create:()=>Z_.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(CM)&&(e=e.update({add:[OM.range(n.value,n.value+1)]}));return e}});const EM="()[]{}<>";function SM(e){for(let t=0;t<EM.length;t+=2)if(EM.charCodeAt(t)==e)return EM.charAt(t+1);return Fb(e<128?e:e+1)}const RM="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),TM=xE.inputHandler.of(((e,t,n,i)=>{if((RM?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let o=e.state.selection.main;if(i.length>2||2==i.length&&1==zb(Vb(i,0))||t!=o.from||n!=o.to)return!1;let r=function(e,t){let n=function(e,t){return e.languageDataAt("closeBrackets",t)[0]||wM}(e,e.selection.main.head),i=n.brackets||wM.brackets;for(let o of i){let r=SM(Vb(o,0));if(t==o)return r==o?$M(e,o,i.indexOf(o+o+o)>-1,n):PM(e,o,r,n.before||wM.before);if(t==r&&MM(e,e.selection.main.from))return DM(e,o,r)}return null}(e.state,i);return!!r&&(e.dispatch(r),!0)}));function MM(e,t){let n=!1;return e.field(kM).between(0,e.doc.length,(e=>{e==t&&(n=!0)})),n}function AM(e,t){let n=e.sliceString(t,t+2);return n.slice(0,zb(Vb(n,0)))}function PM(e,t,n,i){let o=null,r=e.changeByRange((r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:n,from:r.to}],effects:CM.of(r.to+t.length),range:t_.range(r.anchor+t.length,r.head+t.length)};let s=AM(e.doc,r.head);return!s||/\s/.test(s)||i.indexOf(s)>-1?{changes:{insert:t+n,from:r.head},effects:CM.of(r.head+t.length),range:t_.cursor(r.head+t.length)}:{range:o=r}}));return o?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function DM(e,t,n){let i=null,o=e.changeByRange((t=>t.empty&&AM(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:t_.cursor(t.head+n.length)}:i={range:t}));return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function $M(e,t,n,i){let o=i.stringPrefixes||wM.stringPrefixes,r=null,s=e.changeByRange((i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:t,from:i.to}],effects:CM.of(i.to+t.length),range:t_.range(i.anchor+t.length,i.head+t.length)};let s,a=i.head,l=AM(e.doc,a);if(l==t){if(jM(e,a))return{changes:{insert:t+t,from:a},effects:CM.of(a+t.length),range:t_.cursor(a+t.length)};if(MM(e,a)){let i=n&&e.sliceDoc(a,a+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+i.length,insert:i},range:t_.cursor(a+i.length)}}}else{if(n&&e.sliceDoc(a-2*t.length,a)==t+t&&(s=IM(e,a-2*t.length,o))>-1&&jM(e,s))return{changes:{insert:t+t+t+t,from:a},effects:CM.of(a+t.length),range:t_.cursor(a+t.length)};if(e.charCategorizer(a)(l)!=F_.Word&&IM(e,a,o)>-1&&!function(e,t,n,i){let o=gR(e).resolveInner(t,-1),r=i.reduce(((e,t)=>Math.max(e,t.length)),0);for(let s=0;s<5;s++){let s=e.sliceDoc(o.from,Math.min(o.to,o.from+n.length+r)),a=s.indexOf(n);if(!a||a>-1&&i.indexOf(s.slice(0,a))>-1){let t=o.firstChild;for(;t&&t.from==o.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=o.to==t&&o.parent;if(!l)break;o=l}return!1}(e,a,t,o))return{changes:{insert:t+t,from:a},effects:CM.of(a+t.length),range:t_.cursor(a+t.length)}}return{range:r=i}}));return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function jM(e,t){let n=gR(e).resolveInner(t+1);return n.parent&&n.from==t}function IM(e,t,n){let i=e.charCategorizer(t);if(i(e.sliceDoc(t-1,t))!=F_.Word)return t;for(let o of n){let n=t-o.length;if(e.sliceDoc(n,t)==o&&i(e.sliceDoc(n-1,n))!=F_.Word)return n}return-1}function BM(e={}){return[iM,KT,AT.of(e),tM,NM,oM]}const LM=[{key:"Ctrl-Space",run:JT},{mac:"Alt-`",run:JT},{key:"Escape",run:e=>{let t=e.state.field(KT,!1);return!(!t||!t.active.some((e=>0!=e.state)))&&(e.dispatch({effects:RT.of(null)}),!0)}},{key:"ArrowDown",run:ZT(!0)},{key:"ArrowUp",run:ZT(!1)},{key:"PageDown",run:ZT(!0,"page")},{key:"PageUp",run:ZT(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(KT,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(AT).interactionDelay)&>(e,t.open.options[t.open.selected])}}],NM=v_.highest(SE.computeN([AT],(e=>e.facet(AT).defaultKeymap?[LM]:[])));function qM(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let o=e(t,n);return!!o&&(i(n.update(o)),!0)}}const VM=qM(UM,0),FM=qM(WM,0),zM=qM(((e,t)=>WM(e,t,function(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),o=n.to<=i.to?i:e.doc.lineAt(n.to);o.from>i.from&&o.from==n.to&&(o=n.to==i.to+1?i:e.doc.lineAt(n.to-1));let r=t.length-1;r>=0&&t[r].to>i.from?t[r].to=o.to:t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:o.to})}return t}(t))),0);function QM(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}const HM=50;function WM(e,t,n=t.selection.ranges){let i=n.map((e=>QM(t,e.from).block));if(!i.every((e=>e)))return null;let o=n.map(((e,n)=>function(e,{open:t,close:n},i,o){let r,s,a=e.sliceDoc(i-HM,i),l=e.sliceDoc(o,o+HM),c=/\s*$/.exec(a)[0].length,u=/^\s*/.exec(l)[0].length,h=a.length-c;if(a.slice(h-t.length,h)==t&&l.slice(u,u+n.length)==n)return{open:{pos:i-c,margin:c&&1},close:{pos:o+u,margin:u&&1}};o-i<=2*HM?r=s=e.sliceDoc(i,o):(r=e.sliceDoc(i,i+HM),s=e.sliceDoc(o-HM,o));let d=/^\s*/.exec(r)[0].length,p=/\s*$/.exec(s)[0].length,f=s.length-p-n.length;return r.slice(d,d+t.length)==t&&s.slice(f,f+n.length)==n?{open:{pos:i+d+t.length,margin:/\s/.test(r.charAt(d+t.length))?1:0},close:{pos:o-p-n.length,margin:/\s/.test(s.charAt(f-1))?1:0}}:null}(t,i[n],e.from,e.to)));if(2!=e&&!o.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>o[t]?[]:[{from:e.from,insert:i[t].open+" "},{from:e.to,insert:" "+i[t].close}])))};if(1!=e&&o.some((e=>e))){let e=[];for(let t,n=0;n<o.length;n++)if(t=o[n]){let o=i[n],{open:r,close:s}=t;e.push({from:r.pos-o.open.length,to:r.pos+r.margin},{from:s.pos-s.margin,to:s.pos+o.close.length})}return{changes:e}}return null}function UM(e,t,n=t.selection.ranges){let i=[],o=-1;for(let{from:e,to:r}of n){let n=i.length,s=1e9,a=QM(t,e).line;if(a){for(let n=e;n<=r;){let l=t.doc.lineAt(n);if(l.from>o&&(e==r||r>l.from)){o=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,n=l.text.slice(e,e+a.length)==a?e:-1;e<l.text.length&&e<s&&(s=e),i.push({line:l,comment:n,token:a,indent:e,empty:t,single:!1})}n=l.to+1}if(s<1e9)for(let e=n;e<i.length;e++)i[e].indent<i[e].line.text.length&&(i[e].indent=s);i.length==n+1&&(i[n].single=!0)}}if(2!=e&&i.some((e=>e.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:o,empty:r,single:s}of i)!s&&r||e.push({from:t.from+o,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&i.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:o}of i)if(n>=0){let i=t.from+n,r=i+o.length;" "==t.text[r-t.from]&&r++,e.push({from:i,to:r})}return{changes:e}}return null}function XM(e,t){return t_.create(e.ranges.map(t),e.mainIndex)}function KM(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function GM({state:e,dispatch:t},n){let i=XM(e.selection,n);return!i.eq(e.selection,!0)&&(t(KM(e,i)),!0)}function YM(e,t){return t_.cursor(t?e.to:e.from)}function ZM(e,t){return GM(e,(n=>n.empty?e.moveByChar(n,t):YM(n,t)))}function JM(e){return e.textDirectionAt(e.state.selection.main.head)==IC.LTR}const eA=e=>ZM(e,!JM(e)),tA=e=>ZM(e,JM(e));function nA(e,t){return GM(e,(n=>n.empty?e.moveByGroup(n,t):YM(n,t)))}function iA(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function oA(e,t,n){let i,o,r=gR(e).resolveInner(t.head),s=n?lS.closedBy:lS.openedBy;for(let i=t.head;;){let t=n?r.childAfter(i):r.childBefore(i);if(!t)break;iA(e,t,s)?r=t:i=n?t.to:t.from}return o=r.type.prop(s)&&(i=n?cT(e,r.from,1):cT(e,r.to,-1))&&i.matched?n?i.end.to:i.end.from:n?r.to:r.from,t_.cursor(o,n?-1:1)}function rA(e,t){return GM(e,(n=>{if(!n.empty)return YM(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)}))}const sA=e=>rA(e,!1),aA=e=>rA(e,!0);function lA(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,i=0,o=0;if(n){for(let t of e.state.facet(xE.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(i=Math.max(null==n?void 0:n.top,i)),(null==n?void 0:n.bottom)&&(o=Math.max(null==n?void 0:n.bottom,o))}t=e.scrollDOM.clientHeight-i-o}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:o,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function cA(e,t){let n,i=lA(e),{state:o}=e,r=XM(o.selection,(n=>n.empty?e.moveVertically(n,t,i.height):YM(n,t)));if(r.eq(o.selection))return!1;if(i.selfScroll){let t=e.coordsAtPos(o.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),a=s.top+i.marginTop,l=s.bottom-i.marginBottom;t&&t.top>a&&t.bottom<l&&(n=xE.scrollIntoView(r.main.head,{y:"start",yMargin:t.top-a}))}return e.dispatch(KM(o,r),{effects:n}),!0}const uA=e=>cA(e,!1),hA=e=>cA(e,!0);function dA(e,t,n){let i=e.lineBlockAt(t.head),o=e.moveToLineBoundary(t,n);if(o.head==t.head&&o.head!=(n?i.to:i.from)&&(o=e.moveToLineBoundary(t,n,!1)),!n&&o.head==i.from&&i.length){let n=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;n&&t.head!=i.from+n&&(o=t_.cursor(i.from+n))}return o}function pA(e,t){let n=XM(e.state.selection,(e=>{let n=t(e);return t_.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(e.state.selection)&&(e.dispatch(KM(e.state,n)),!0)}function fA(e,t){return pA(e,(n=>e.moveByChar(n,t)))}const gA=e=>fA(e,!JM(e)),mA=e=>fA(e,JM(e));function vA(e,t){return pA(e,(n=>e.moveByGroup(n,t)))}function yA(e,t){return pA(e,(n=>e.moveVertically(n,t)))}const xA=e=>yA(e,!1),bA=e=>yA(e,!0);function _A(e,t){return pA(e,(n=>e.moveVertically(n,t,lA(e).height)))}const wA=e=>_A(e,!1),CA=e=>_A(e,!0),OA=({state:e,dispatch:t})=>(t(KM(e,{anchor:0})),!0),kA=({state:e,dispatch:t})=>(t(KM(e,{anchor:e.doc.length})),!0),EA=({state:e,dispatch:t})=>(t(KM(e,{anchor:e.selection.main.anchor,head:0})),!0),SA=({state:e,dispatch:t})=>(t(KM(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function RA(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,o=i.changeByRange((i=>{let{from:o,to:r}=i;if(o==r){let s=t(i);s<o?(n="delete.backward",s=TA(e,s,!1)):s>o&&(n="delete.forward",s=TA(e,s,!0)),o=Math.min(o,s),r=Math.max(r,s)}else o=TA(e,o,!1),r=TA(e,r,!0);return o==r?{range:i}:{changes:{from:o,to:r},range:t_.cursor(o,o<i.head?-1:1)}}));return!o.changes.empty&&(e.dispatch(i.update(o,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?xE.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function TA(e,t,n){if(e instanceof xE)for(let i of e.state.facet(xE.atomicRanges).map((t=>t(e))))i.between(t,t,((e,i)=>{e<t&&i>t&&(t=n?i:e)}));return t}const MA=(e,t,n)=>RA(e,(i=>{let o,r,s=i.from,{state:a}=e,l=a.doc.lineAt(s);if(n&&!t&&s>l.from&&s<l.from+200&&!/[^ \t]/.test(o=l.text.slice(0,s-l.from))){if("\t"==o[o.length-1])return s-1;let e=uw(o,a.tabSize)%RR(a)||RR(a);for(let t=0;t<e&&" "==o[o.length-1-t];t++)s--;r=s}else r=qb(l.text,s-l.from,t,t)+l.from,r==s&&l.number!=(t?a.doc.lines:1)?r+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(l.text.slice(r-l.from,s-l.from))&&(r=qb(l.text,r-l.from,!1,!1)+l.from);return r})),AA=e=>MA(e,!1,!0),PA=e=>MA(e,!0,!1),DA=(e,t)=>RA(e,(n=>{let i=n.head,{state:o}=e,r=o.doc.lineAt(i),s=o.charCategorizer(i);for(let e=null;;){if(i==(t?r.to:r.from)){i==n.head&&r.number!=(t?o.doc.lines:1)&&(i+=t?1:-1);break}let a=qb(r.text,i-r.from,t)+r.from,l=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from),c=s(l);if(null!=e&&c!=e)break;" "==l&&i==n.head||(e=c),i=a}return i})),$A=e=>DA(e,!1);function jA(e){let t=[],n=-1;for(let i of e.selection.ranges){let o=e.doc.lineAt(i.from),r=e.doc.lineAt(i.to);if(i.empty||i.to!=r.from||(r=e.doc.lineAt(i.to-1)),n>=o.number){let e=t[t.length-1];e.to=r.to,e.ranges.push(i)}else t.push({from:o.from,to:r.to,ranges:[i]});n=r.number+1}return t}function IA(e,t,n){if(e.readOnly)return!1;let i=[],o=[];for(let t of jA(e)){if(n?t.to==e.doc.length:0==t.from)continue;let r=e.doc.lineAt(n?t.to+1:t.from-1),s=r.length+1;if(n){i.push({from:t.to,to:r.to},{from:t.from,insert:r.text+e.lineBreak});for(let n of t.ranges)o.push(t_.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)))}else{i.push({from:r.from,to:t.from},{from:t.to,insert:e.lineBreak+r.text});for(let e of t.ranges)o.push(t_.range(e.anchor-s,e.head-s))}}return!!i.length&&(t(e.update({changes:i,scrollIntoView:!0,selection:t_.create(o,e.selection.mainIndex),userEvent:"move.line"})),!0)}function BA(e,t,n){if(e.readOnly)return!1;let i=[];for(let t of jA(e))n?i.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):i.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const LA=qA(!1),NA=qA(!0);function qA(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange((n=>{let{from:i,to:o}=n,r=t.doc.lineAt(i),s=!e&&i==o&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,i=gR(e).resolveInner(t),o=i.childBefore(t),r=i.childAfter(t);return o&&r&&o.to<=t&&r.from>=t&&(n=o.type.prop(lS.closedBy))&&n.indexOf(r.name)>-1&&e.doc.lineAt(o.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(o.to,r.from))?{from:o.to,to:r.from}:null}(t,i);e&&(i=o=(o<=r.to?r:t.doc.lineAt(o)).to);let a=new AR(t,{simulateBreak:i,simulateDoubleBreak:!!s}),l=MR(a,i);for(null==l&&(l=uw(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<r.to&&/\s/.test(r.text[o-r.from]);)o++;s?({from:i,to:o}=s):i>r.from&&i<r.from+100&&!/\S/.test(r.text.slice(0,i))&&(i=r.from);let c=["",TR(t,l)];return s&&c.push(TR(t,a.lineIndent(r.from,-1))),{changes:{from:i,to:o,insert:Mb.of(c)},range:t_.cursor(i+1+c[1].length)}}));return n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function VA(e,t){let n=-1;return e.changeByRange((i=>{let o=[];for(let r=i.from;r<=i.to;){let s=e.doc.lineAt(r);s.number>n&&(i.empty||i.to>s.from)&&(t(s,o,i),n=s.number),r=s.to+1}let r=e.changes(o);return{changes:o,range:t_.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}}))}const FA=[{key:"ArrowLeft",run:eA,shift:gA,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>nA(e,!JM(e)),shift:e=>vA(e,!JM(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>GM(e,(t=>dA(e,t,!JM(e)))),shift:e=>pA(e,(t=>dA(e,t,!JM(e)))),preventDefault:!0},{key:"ArrowRight",run:tA,shift:mA,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>nA(e,JM(e)),shift:e=>vA(e,JM(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>GM(e,(t=>dA(e,t,JM(e)))),shift:e=>pA(e,(t=>dA(e,t,JM(e)))),preventDefault:!0},{key:"ArrowUp",run:sA,shift:xA,preventDefault:!0},{mac:"Cmd-ArrowUp",run:OA,shift:EA},{mac:"Ctrl-ArrowUp",run:uA,shift:wA},{key:"ArrowDown",run:aA,shift:bA,preventDefault:!0},{mac:"Cmd-ArrowDown",run:kA,shift:SA},{mac:"Ctrl-ArrowDown",run:hA,shift:CA},{key:"PageUp",run:uA,shift:wA},{key:"PageDown",run:hA,shift:CA},{key:"Home",run:e=>GM(e,(t=>dA(e,t,!1))),shift:e=>pA(e,(t=>dA(e,t,!1))),preventDefault:!0},{key:"Mod-Home",run:OA,shift:EA},{key:"End",run:e=>GM(e,(t=>dA(e,t,!0))),shift:e=>pA(e,(t=>dA(e,t,!0))),preventDefault:!0},{key:"Mod-End",run:kA,shift:SA},{key:"Enter",run:LA,shift:LA},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:AA,shift:AA},{key:"Delete",run:PA},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$A},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>DA(e,!0)},{mac:"Mod-Backspace",run:e=>RA(e,(t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}))},{mac:"Mod-Delete",run:e=>RA(e,(t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}))}].concat([{key:"Ctrl-b",run:eA,shift:gA,preventDefault:!0},{key:"Ctrl-f",run:tA,shift:mA},{key:"Ctrl-p",run:sA,shift:xA},{key:"Ctrl-n",run:aA,shift:bA},{key:"Ctrl-a",run:e=>GM(e,(t=>t_.cursor(e.lineBlockAt(t.head).from,1))),shift:e=>pA(e,(t=>t_.cursor(e.lineBlockAt(t.head).from)))},{key:"Ctrl-e",run:e=>GM(e,(t=>t_.cursor(e.lineBlockAt(t.head).to,-1))),shift:e=>pA(e,(t=>t_.cursor(e.lineBlockAt(t.head).to)))},{key:"Ctrl-d",run:PA},{key:"Ctrl-h",run:AA},{key:"Ctrl-k",run:e=>RA(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}))},{key:"Ctrl-Alt-h",run:$A},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:Mb.of(["",""])},range:t_.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,i=e.doc.lineAt(n),o=n==i.from?n-1:qb(i.text,n-i.from,!1)+i.from,r=n==i.to?n+1:qb(i.text,n-i.from,!0)+i.from;return{changes:{from:o,to:r,insert:e.doc.slice(n,r).append(e.doc.slice(o,n))},range:t_.cursor(r)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:hA}].map((e=>({mac:e.key,run:e.run,shift:e.shift})))),zA=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>GM(e,(t=>oA(e.state,t,!JM(e)))),shift:e=>pA(e,(t=>oA(e.state,t,!JM(e))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>GM(e,(t=>oA(e.state,t,JM(e)))),shift:e=>pA(e,(t=>oA(e.state,t,JM(e))))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>IA(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>BA(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>IA(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>BA(e,t,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,i=null;return n.ranges.length>1?i=t_.create([n.main]):n.main.empty||(i=t_.create([t_.cursor(n.main.head)])),!!i&&(t(KM(e,i)),!0)}},{key:"Mod-Enter",run:NA},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=jA(e).map((({from:t,to:n})=>t_.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:t_.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=XM(e.selection,(t=>{let n=gR(e),i=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=i.node.from&&e.node.to<=i.node.to&&(i=e)}for(let e=i;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return t_.range(n.to,n.from)}return t}));return!n.eq(e.selection)&&(t(KM(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(VA(e,((t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let o=uw(i,e.tabSize),r=0,s=TR(e,Math.max(0,o-RR(e)));for(;r<i.length&&r<s.length&&i.charCodeAt(r)==s.charCodeAt(r);)r++;n.push({from:t.from+r,to:t.from+i.length,insert:s.slice(r)})})),{userEvent:"delete.dedent"})),!0)},{key:"Mod-]",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(VA(e,((t,n)=>{n.push({from:t.from,insert:e.facet(SR)})})),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new AR(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),o=VA(e,((t,o,r)=>{let s=MR(i,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let a=/^\s*/.exec(t.text)[0],l=TR(e,s);(a!=l||r.from<t.from+a.length)&&(n[t.from]=s,o.push({from:t.from,to:t.from+a.length,insert:l}))}));return o.changes.empty||t(e.update(o,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(jA(t).map((({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n})))),i=XM(t.selection,(t=>{let n;if(e.lineWrapping){let i=e.lineBlockAt(t.head),o=e.coordsAtPos(t.head,t.assoc||1);o&&(n=i.bottom+e.documentTop-o.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)})).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let i=!1,o=XM(e.selection,(t=>{let n=cT(e,t.head,-1)||cT(e,t.head,1)||t.head>0&&cT(e,t.head-1,1)||t.head<e.doc.length&&cT(e,t.head+1,-1);if(!n||!n.end)return t;i=!0;let o=n.start.from==t.head?n.end.to:n.end.from;return t_.cursor(o)}));return!!i&&(t(KM(e,o)),!0)}(e,t)},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=QM(e.state,n.from);return i.line?VM(e):!!i.block&&zM(e)}},{key:"Alt-A",run:FM},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat(FA);function QA(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var o=n[i];"string"==typeof o?e.setAttribute(i,o):null!=o&&(e[i]=o)}t++}for(;t<arguments.length;t++)HA(e,arguments[t]);return e}function HA(e,t){if("string"==typeof t)e.appendChild(document.createTextNode(t));else if(null==t);else if(null!=t.nodeType)e.appendChild(t);else{if(!Array.isArray(t))throw new RangeError("Unsupported child node: "+t);for(var n=0;n<t.length;n++)HA(e,t[n])}}class WA{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class UA{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let i=e,o=n.facet(rP).markerFilter;o&&(i=o(i,n));let r=e.slice().sort(((e,t)=>e.from-t.from||e.to-t.to)),s=new J_,a=[],l=0;for(let e=0;;){let t,i,o=e==r.length?null:r[e];if(!o&&!a.length)break;for(a.length?(t=l,i=a.reduce(((e,t)=>Math.min(e,t.to)),o&&o.from>t?o.from:1e8)):(t=o.from,i=o.to,a.push(o),e++);e<r.length;){let n=r[e];if(n.from!=t||!(n.to>n.from||n.to==t)){i=Math.min(n.from,i);break}a.push(n),e++,i=Math.min(n.to,i)}let c=fP(a);if(a.some((e=>e.from==e.to||e.from==e.to-1&&n.doc.lineAt(e.from).to==e.from)))s.add(t,t,OC.widget({widget:new lP(c),diagnostics:a.slice()}));else{let e=a.reduce(((e,t)=>t.markClass?e+" "+t.markClass:e),"");s.add(t,i,OC.mark({class:"cm-lintRange cm-lintRange-"+c+e,diagnostics:a.slice(),inclusiveEnd:a.some((e=>e.to>i))}))}l=i;for(let e=0;e<a.length;e++)a[e].to<=l&&a.splice(e--,1)}let c=s.finish();return new UA(c,t,XA(c))}}function XA(e,t=null,n=0){let i=null;return e.between(n,1e9,((e,n,{spec:o})=>{if(!(t&&o.diagnostics.indexOf(t)<0))if(i){if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new WA(i.from,n,i.diagnostic)}else i=new WA(e,n,t||o.diagnostics[0])})),i}function KA(e,t){return e.field(JA,!1)?t:t.concat($_.appendConfig.of(gP))}const GA=$_.define(),YA=$_.define(),ZA=$_.define(),JA=h_.define({create:()=>new UA(OC.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),i=null,o=e.panel;if(e.selected){let o=t.changes.mapPos(e.selected.from,1);i=XA(n,e.selected.diagnostic,o)||XA(n,null,o)}!n.size&&o&&t.state.facet(rP).autoPanel&&(o=null),e=new UA(n,o,i)}for(let n of t.effects)if(n.is(GA)){let i=t.state.facet(rP).autoPanel?n.value.length?uP.open:null:e.panel;e=UA.init(n.value,i,t.state)}else n.is(YA)?e=new UA(e.diagnostics,n.value?uP.open:null,e.selected):n.is(ZA)&&(e=new UA(e.diagnostics,e.panel,n.value));return e},provide:e=>[iS.from(e,(e=>e.panel)),xE.decorations.from(e,(e=>e.diagnostics))]}),eP=OC.mark({class:"cm-lintRange cm-lintRange-active"});function tP(e,t,n){let i,{diagnostics:o}=e.state.field(JA),r=-1,s=-1;o.between(t-(n<0?1:0),t+(n>0?1:0),((e,o,{spec:a})=>{if(t>=e&&t<=o&&(e==o||(t>e||n>0)&&(t<o||n<0)))return i=a.diagnostics,r=e,s=o,!1}));let a=e.state.facet(rP).tooltipFilter;return i&&a&&(i=a(i,e.state)),i?{pos:r,end:s,above:e.state.doc.lineAt(r).to<s,create:()=>({dom:nP(e,i)})}:null}function nP(e,t){return QA("ul",{class:"cm-tooltip-lint"},t.map((t=>aP(e,t,!1))))}const iP=e=>{let t=e.state.field(JA,!1);return!(!t||!t.panel)&&(e.dispatch({effects:YA.of(!1)}),!0)},oP=bO.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(rP);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(rP);t.length&&function(e,t,n){let i=[],o=-1;for(let r of e)r.then((n=>{i.push(n),clearTimeout(o),i.length==e.length?t(i):o=setTimeout((()=>t(i)),200)}),n)}(t.map((e=>Promise.resolve(e(this.view)))),(t=>{this.view.state.doc==e.doc&&this.view.dispatch(function(e,t){return{effects:KA(e,[GA.of(t)])}}(this.view.state,t.reduce(((e,t)=>e.concat(t)))))}),(e=>{mO(this.view.state,e)}))}}update(e){let t=e.state.facet(rP);(e.docChanged||t!=e.startState.facet(rP)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});const rP=o_.define({combine:e=>Object.assign({sources:e.map((e=>e.source)).filter((e=>null!=e))},U_(e.map((e=>e.config)),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t}))});function sP(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;e<n.length;e++){let i=n[e];if(/[a-zA-Z]/.test(i)&&!t.some((e=>e.toLowerCase()==i.toLowerCase()))){t.push(i);continue e}}t.push("")}return t}function aP(e,t,n){var i;let o=n?sP(t.actions):[];return QA("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},QA("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(i=t.actions)||void 0===i?void 0:i.map(((n,i)=>{let r=!1,s=i=>{if(i.preventDefault(),r)return;r=!0;let o=XA(e.state.field(JA).diagnostics,t);o&&n.apply(e,o.from,o.to)},{name:a}=n,l=o[i]?a.indexOf(o[i]):-1,c=l<0?a:[a.slice(0,l),QA("u",a.slice(l,l+1)),a.slice(l+1)];return QA("button",{type:"button",class:"cm-diagnosticAction",onclick:s,onmousedown:s,"aria-label":` Action: ${a}${l<0?"":` (access key "${o[i]})"`}.`},c)})),t.source&&QA("div",{class:"cm-diagnosticSource"},t.source))}class lP extends wC{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return QA("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class cP{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=aP(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class uP{constructor(e){this.view=e,this.items=[];this.list=QA("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)iP(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],i=sP(n.actions);for(let o=0;o<i.length;o++)if(i[o].toUpperCase().charCodeAt(0)==t.keyCode){let t=XA(this.view.state.field(JA).diagnostics,n);t&&n.actions[o].apply(e,t.from,t.to)}}}t.preventDefault()},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=QA("div",{class:"cm-panel-lint"},this.list,QA("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>iP(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(JA).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(JA),n=0,i=!1,o=null,r=new Set;for(e.between(0,this.view.state.doc.length,((e,s,{spec:a})=>{for(let e of a.diagnostics){if(r.has(e))continue;r.add(e);let s,a=-1;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){a=t;break}a<0?(s=new cP(this.view,e),this.items.splice(n,0,s),i=!0):(s=this.items[a],a>n&&(this.items.splice(n,a-n),i=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute("aria-selected")||(s.dom.setAttribute("aria-selected","true"),o=s):s.dom.hasAttribute("aria-selected")&&s.dom.removeAttribute("aria-selected"),n++}}));n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();0==this.items.length&&(this.items.push(new cP(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=XA(this.view.state.field(JA).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:ZA.of(t)})}static open(e){return new uP(e)}}function hP(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const dP=xE.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:hP("#d11")},".cm-lintRange-warning":{backgroundImage:hP("orange")},".cm-lintRange-info":{backgroundImage:hP("#999")},".cm-lintRange-hint":{backgroundImage:hP("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function pP(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function fP(e){let t="hint",n=1;for(let i of e){let e=pP(i.severity);e>n&&(n=e,t=i.severity)}return t}const gP=[JA,xE.decorations.compute([JA],(e=>{let{selected:t,panel:n}=e.field(JA);return t&&n&&t.from!=t.to?OC.set([eP.range(t.from,t.to)]):OC.none})),GE(tP,{hideOn:function(e,t){let n=t.pos,i=t.end||n,o=e.state.facet(rP).hideOn(e,n,i);if(null!=o)return o;let r=e.startState.doc.lineAt(t.pos);return!(!e.effects.some((e=>e.is(GA)))&&!e.changes.touchesRange(r.from,Math.max(r.to,i)))}}),dP];class mP{constructor(e,t,n,i,o,r,s,a,l,c=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=o,this.score=r,this.buffer=s,this.bufferBase=a,this.curContext=l,this.lookAhead=c,this.parent=u}toString(){return`[${this.stack.filter(((e,t)=>t%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new mP(e,[],t,n,n,0,[],0,i?new vP(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=65535&e,{parser:o}=this.p,r=this.reducePos<this.pos-25;r&&this.setLookAhead(this.pos);let s=o.dynamicPrecedence(i);if(s&&(this.score+=s),0==n)return this.pushState(o.getGoto(this.state,i,!0),this.reducePos),i<o.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0),void this.reduceContext(i,this.reducePos);let a=this.stack.length-3*(n-1)-(262144&e?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from,c=this.reducePos-l;c>=2e3&&!(null===(t=this.p.parser.nodeSet.types[i])||void 0===t?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=c));let u=a?this.stack[a-1]:0,h=this.bufferBase+this.buffer.length-u;if(i<o.minRepeatTerm||131072&e){let e=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,l,e,h+4,!0)}if(262144&e)this.state=this.stack[a];else{let e=this.stack[a-3];this.state=o.getGoto(e,i,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(i,l)}storeNode(e,t,n,i=4,o=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,i=this.buffer.length;if(0==i&&e.parent&&(i=e.bufferBase-e.parent.bufferBase,e=e.parent),i>0&&0==e.buffer[i-4]&&e.buffer[i-1]>-1){if(t==n)return;if(e.buffer[i-2]>=t)return void(e.buffer[i-2]=n)}}if(o&&this.pos!=n){let o=this.buffer.length;if(o>0&&0!=this.buffer[o-4]){let e=!1;for(let t=o;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=i}else this.buffer.push(e,t,n,i)}shift(e,t,n,i){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4);else{let o=e,{parser:r}=this.p;(i>this.pos||t<=r.maxNode)&&(this.pos=i,r.stateFlag(o,1)||(this.reducePos=i)),this.pushState(o,n),this.shiftContext(t,n),t<=r.maxNode&&this.buffer.push(t,n,i,4)}}apply(e,t,n,i){65536&e?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new mP(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new yP(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(!(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let i,o=0;o<t.length;o+=2)(i=t[o+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[o],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let i=t[e+1];n.some(((e,t)=>1&t&&e==i))||n.push(t[e],i)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let i=t[e+1];if(i==this.state)continue;let o=this.split();o.pushState(i,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[e],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(65536&t))return!1;if(!e.validAction(this.state,t)){let n=t>>19,i=65535&t,o=this.stack.length-3*n;if(o<0||e.getGoto(this.stack[o],i,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,o)=>{if(!t.includes(i))return t.push(i),e.allActions(i,(t=>{if(393216&t);else if(65536&t){let n=(t>>19)-o;if(n>1){let i=65535&t,o=this.stack.length-3*n;if(o>=0&&e.getGoto(this.stack[o],i,!1)>=0)return n<<19|65536|i}}else{let e=n(t,o+1);if(null!=e)return e}}))};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new vP(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class vP{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class yP{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class xP{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new xP(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new xP(this.stack,this.pos,this.index)}}function bP(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let i=0,o=0;i<e.length;){let r=0;for(;;){let t=e.charCodeAt(i++),n=!1;if(126==t){r=65535;break}t>=92&&t--,t>=34&&t--;let o=t-32;if(o>=46&&(o-=46,n=!0),r+=o,n)break;r*=46}n?n[o++]=r:n=new t(r)}return n}class _P{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const wP=new _P;class CP{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=wP,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,o=this.pos+e;for(;o<n.from;){if(!i)return null;let e=this.ranges[--i];o-=n.from-e.to,n=e}for(;t<0?o>n.to:o>=n.to;){if(i==this.ranges.length-1)return null;let e=this.ranges[++i];o+=e.from-n.to,n=e}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t,n,i=this.chunkOff+e;if(i>=0&&i<this.chunk.length)t=this.pos+e,n=this.chunk.charCodeAt(i);else{let i=this.resolveOffset(e,1);if(null==i)return-1;if(t=i,t>=this.chunk2Pos&&t<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(t-this.chunk2Pos);else{let e=this.rangeIndex,i=this.range;for(;i.to<=t;)i=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=t),t+this.chunk2.length>i.to&&(this.chunk2=this.chunk2.slice(0,i.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=wP,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class OP{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;!function(e,t,n,i,o,r){let s=0,a=1<<i,{dialect:l}=n.p.parser;e:for(;a&e[s];){let n=e[s+1];for(let i=s+3;i<n;i+=2)if((e[i+1]&a)>0){let n=e[i];if(l.allows(n)&&(-1==t.token.value||t.token.value==n||SP(n,t.token.value,o,r))){t.acceptToken(n);break}}let i=t.next,c=0,u=e[s+2];if(!(t.next<0&&u>c&&65535==e[n+3*u-3])){for(;c<u;){let o=c+u>>1,r=n+o+(o<<1),a=e[r],l=e[r+1]||65536;if(i<a)u=o;else{if(!(i>=l)){s=e[r+2],t.advance();continue e}c=o+1}}break}s=e[n+3*u-1]}}(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}OP.prototype.contextual=OP.prototype.fallback=OP.prototype.extend=!1,OP.prototype.fallback=OP.prototype.extend=!1;class kP{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function EP(e,t,n){for(let i,o=t;65535!=(i=e[o]);o++)if(i==n)return o-t;return-1}function SP(e,t,n,i){let o=EP(n,i,t);return o<0||EP(n,i,e)<o}const RP="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let TP=null;function MP(e,t,n){let i=e.cursor(gS.IncludeAnonymous);for(i.moveTo(t);;)if(!(n<0?i.childBefore(t):i.childAfter(t)))for(;;){if((n<0?i.to<t:i.from>t)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(e.length,Math.max(i.from+1,t+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:e.length}}class AP{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?MP(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?MP(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[i],r=this.start[t]+n.positions[i];if(r>e)return this.nextStart=r,null;if(o instanceof mS){if(r==e){if(r<this.safeFrom)return null;let e=r+o.length;if(e<=this.safeTo){let t=o.prop(lS.lookAhead);if(!t||e+t<this.fragment.to)return o}}this.index[t]++,r+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(r),this.index.push(0))}else this.index[t]++,this.nextStart=r+o.length}}}class PP{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((e=>new _P))}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:o}=i,r=i.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,a=0;for(let i=0;i<o.length;i++){if(!(1<<i&r))continue;let l=o[i],c=this.tokens[i];if((!n||l.fallback)&&((l.contextual||c.start!=e.pos||c.mask!=r||c.context!=s)&&(this.updateCachedToken(c,l,e),c.mask=r,c.context=s),c.lookAhead>c.end+25&&(a=Math.max(c.lookAhead,a)),0!=c.value)){let i=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!l.extend&&(n=c,t>i))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),n||e.pos!=this.stream.end||(n=new _P,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new _P,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:t}=n.p;for(let i=0;i<t.specialized.length;i++)if(t.specialized[i]==e.value){let o=t.specializers[i](this.stream.read(e.start,e.end),n);if(o>=0&&n.p.parser.dialect.allows(o>>1)){1&o?e.extended=o>>1:e.value=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let t=0;t<i;t+=3)if(this.actions[t]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=n,i}addActions(e,t,n,i){let{state:o}=e,{parser:r}=e.p,{data:s}=r;for(let e=0;e<2;e++)for(let a=r.stateSlot(o,e?2:1);;a+=3){if(65535==s[a]){if(1!=s[a+1]){0==i&&2==s[a+1]&&(i=this.putAction(NP(s,a+2),t,n,i));break}a=NP(s,a+2)}s[a]==t&&(i=this.putAction(NP(s,a+1),t,n,i))}return i}}class DP{constructor(e,t,n,i){this.parser=e,this.input=t,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new CP(t,i),this.tokens=new PP(e,this.stream),this.topTerm=e.top[1];let{from:o}=i[0];this.stacks=[mP.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>4*e.bufferLength?new AP(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,i=this.minStackPos,o=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<n.length;r++){let s=n[r];for(;;){if(this.tokens.mainToken=null,s.pos>i)o.push(s);else{if(this.advanceStack(s,o,n))continue;{e||(e=[],t=[]),e.push(s);let n=this.tokens.getMainToken(s);t.push(n.value,n.end)}}break}}if(!o.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}(e);if(t)return RP&&console.log("Finish with "+this.stackID(t)),this.stackToTree(t);if(this.parser.strict)throw RP&&e&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&e){let n=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,o);if(n)return RP&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(o.length>e)for(o.sort(((e,t)=>t.score-e.score));o.length>e;)o.pop();o.some((e=>e.reducePos>i))&&this.recovering--}else if(o.length>1){e:for(let e=0;e<o.length-1;e++){let t=o[e];for(let n=e+1;n<o.length;n++){let i=o[n];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500){if(!((t.score-i.score||t.buffer.length-i.buffer.length)>0)){o.splice(e--,1);continue e}o.splice(n--,1)}}}o.length>12&&o.splice(12,o.length-12)}this.minStackPos=o[0].pos;for(let e=1;e<o.length;e++)o[e].pos<this.minStackPos&&(this.minStackPos=o[e].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let i=e.pos,{parser:o}=this,r=RP?this.stackID(e)+" -> ":"";if(null!=this.stoppedAt&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let s=this.fragments.nodeAt(i);s;){let i=this.parser.nodeSet.types[s.type.id]==s.type?o.getGoto(e.state,s.type.id):-1;if(i>-1&&s.length&&(!t||(s.prop(lS.contextHash)||0)==n))return e.useNode(s,i),RP&&console.log(r+this.stackID(e)+` (via reuse of ${o.getName(s.type.id)})`),!0;if(!(s instanceof mS)||0==s.children.length||s.positions[0]>0)break;let a=s.children[0];if(!(a instanceof mS&&0==s.positions[0]))break;s=a}}let s=o.stateSlot(e.state,4);if(s>0)return e.reduce(s),RP&&console.log(r+this.stackID(e)+` (via always-reduce ${o.getName(65535&s)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let s=0;s<a.length;){let l=a[s++],c=a[s++],u=a[s++],h=s==a.length||!n,d=h?e:e.split(),p=this.tokens.mainToken;if(d.apply(l,c,p?p.start:d.pos,u),RP&&console.log(r+this.stackID(d)+` (via ${65536&l?`reduce of ${o.getName(65535&l)}`:"shift"} for ${o.getName(c)} @ ${i}${d==e?"":", split"})`),h)return!0;d.pos>i?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return $P(e,t),!0}}runRecovery(e,t,n){let i=null,o=!1;for(let r=0;r<e.length;r++){let s=e[r],a=t[r<<1],l=t[1+(r<<1)],c=RP?this.stackID(s)+" -> ":"";if(s.deadEnd){if(o)continue;if(o=!0,s.restart(),RP&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))continue}let u=s.split(),h=c;for(let e=0;u.forceReduce()&&e<10;e++){if(RP&&console.log(h+this.stackID(u)+" (via force-reduce)"),this.advanceFully(u,n))break;RP&&(h=this.stackID(u)+" -> ")}for(let e of s.recoverByInsert(a))RP&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),RP&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(a)})`),$P(s,n)):(!i||i.score<s.score)&&(i=s)}return i}stackToTree(e){return e.close(),mS.build({buffer:xP.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(TP||(TP=new WeakMap)).get(e);return t||TP.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function $P(e,t){for(let n=0;n<t.length;n++){let i=t[n];if(i.pos==e.pos&&i.sameState(e))return void(t[n].score<e.score&&(t[n]=e))}t.push(e)}class jP{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||0==this.disabled[e]}}const IP=e=>e;class BP{constructor(e){this.start=e.start,this.shift=e.shift||IP,this.reduce=e.reduce||IP,this.reuse=e.reuse||IP,this.hash=e.hash||(()=>0),this.strict=!1!==e.strict}}class LP extends jS{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push("");let n=Object.keys(e.topRules).map((t=>e.topRules[t][1])),i=[];for(let e=0;e<t.length;e++)i.push([]);function o(e,t,n){i[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];"string"==typeof e&&(e=lS[e]);for(let n=1;n<t.length;){let i=t[n++];if(i>=0)o(i,e,t[n++]);else{let r=t[n+-i];for(let s=-i;s>0;s--)o(t[n++],e,r);n++}}}this.nodeSet=new dS(t.map(((t,o)=>hS.define({name:o>=this.minRepeatTerm?void 0:t,id:o,props:i[o],top:n.indexOf(o)>-1,error:0==o,skipped:e.skippedNodes&&e.skippedNodes.indexOf(o)>-1})))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=rS;let r=bP(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(qP),this.states=bP(e.states,Uint32Array),this.data=bP(e.stateData),this.goto=bP(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map((e=>"number"==typeof e?new OP(r,e):e)),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let i=new DP(this,e,t,n);for(let o of this.wrappers)i=o(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let o=i[t+1];;){let t=i[o++],r=1&t,s=i[o++];if(r&&n)return s;for(let n=o+(t>>1);o<n;o++)if(i[o]==e)return s;if(r)return-1}}hasAction(e,t){let n=this.data;for(let i=0;i<2;i++)for(let o,r=this.stateSlot(e,i?2:1);;r+=3){if(65535==(o=n[r])){if(1!=n[r+1]){if(2==n[r+1])return NP(n,r+2);break}o=n[r=NP(n,r+2)]}if(o==t||0==o)return NP(n,r+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,(e=>e==t||null))}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=NP(this.data,n+2)}i=t(NP(this.data,n+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=NP(this.data,n+2)}if(!(1&this.data[n+2])){let e=this.data[n+1];t.some(((t,n)=>1&n&&t==e))||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(LP.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map((t=>{let n=e.tokenizers.find((e=>e.from==t));return n?n.to:t}))),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map(((n,i)=>{let o=e.specializers.find((e=>e.from==n.external));if(!o)return n;let r=Object.assign(Object.assign({},n),{external:o.to});return t.specializers[i]=qP(r),r}))),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map((()=>!1));if(e)for(let i of e.split(" ")){let e=t.indexOf(i);e>=0&&(n[e]=!0)}let i=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n,o=this.dialects[t[e]];65535!=(n=this.data[o++]);)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new jP(e,n,i)}static deserialize(e){return new LP(e)}}function NP(e,t){return e[t]|e[t+1]<<16}function qP(e){if(e.external){let t=e.extend?1:0;return(n,i)=>e.external(n,i)<<1|t}return e.get}const VP=122,FP=123,zP=128,QP=4,HP=131,WP=7,UP=8,XP=9,KP=10,GP=139,YP=19,ZP=140,JP=23,eD=141,tD=27,nD=37,iD=41,oD=145,rD=146,sD=147,aD=148,lD=47,cD=68,uD=154,hD=70,dD=155,pD=72,fD=156,gD=76,mD=161,vD=79,yD=80,xD=81,bD=167,_D=89,wD=90,CD=169,OD=97,kD=171,ED=98,SD=100,RD=101,TD="undefined"!=typeof process&&process.env&&/\bfparse(:dbg)?\b/.test(process.env.LOG),MD="undefined"!=typeof process&&process.env&&/\bfparse:dbg\b/.test(process.env.LOG),AD="undefined"!=typeof process&&process.env&&/\bcontext\b/.test(process.env.LOG),PD=[9,11,12,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],DD=ID("\n\r"),$D="*".charCodeAt(0),jD=ID("'./-+*^");function ID(e){return Array.from(e).map((e=>e.charCodeAt(0)))}function BD(e){return e>=48&&e<=57||183===e||e>=768&&e<=879||e>=8255&&e<=8256}function LD(e,t){return t.concat(e.split(/\n/g).join("\n"+t))}function ND(e,t=0){const n=e.peek(t);return n===$D&&e.peek(t+1)===$D?{offset:2,token:"**"}:(i=n,jD.includes(i)?{offset:1,token:String.fromCharCode(n)}:null);var i}function qD(e,t=0,n=!1){for(let o=!1,r=[],s=0;;s++){const a=e.peek(t+s);if(!(63===(i=a)||i>=65&&i<=90||95===i||i>=97&&i<=122||i>=192&&i<=214||i>=216&&i<=246||i>=248&&i<=767||i>=880&&i<=893||i>=895&&i<=8191||i>=8204&&i<=8205||i>=8304&&i<=8591||i>=11264&&i<=12271||i>=12289&&i<=55295||i>=63744&&i<=64975||i>=65008&&i<=65533||i>=55296&&i<=56319||i>=56320&&i<=57343||(o||n)&&BD(a)))return r.length?{token:String.fromCharCode(...r),offset:s}:null;o||(o=!0),r.push(a)}var i}function VD(e,t){for(let i=!1,o=0;;o++){let r=e.peek(t+o);if(n=r,!PD.includes(n))return i?{token:" ",offset:o}:null;i||(i=!0)}var n}const FD={[VP]:"identifier",[FP]:"nameIdentifier"},zD=new kP(((e,t)=>{MD&&console.log("%s: T <identifier | nameIdentifier>",e.pos);const n=function(e,t){const n=t.contextKeys(),i=t.tokens;for(let t=0,o=[],r=null;;){const s=i.length+o.length>0,a=o.length>0,l=qD(e,t,s)||s&&ND(e,t)||a&&VD(e,t);if(!l)return r;const{token:c,offset:u}=l;if(t+=u," "===c)continue;o=[...o,c];const h=[...i,...o].join(" ");if(n.some((e=>e===h))){const e=o[0];r={token:e,offset:e.length,term:123}}if(!n.some((e=>e.startsWith(h)))){if(GD.some((e=>e===h))){const e=o[0];r={token:e,offset:e.length,term:122}}if(!GD.some((e=>e.startsWith(h))))return r}}}(e,t.context),i=t.context.tokens,o=n||qD(e,0,i.length>0);o&&(e.advance(o.offset),e.acceptToken(n?n.term:122),TD&&console.log("%s: MATCH <%s> <%s>",e.pos,n?FD[n.term]:"identifier",o.token))}),{contextual:!0}),QD=new kP(((e,t)=>{MD&&console.log("%s: T <propertyIdentifier>",e.pos);const n=qD(e,0,t.context.tokens.length>0);n&&(e.advance(n.offset),e.acceptToken(121),TD&&console.log("%s: MATCH <propertyIdentifier> <%s>",e.pos,n.token))})),HD=new kP(((e,t)=>{let n;MD&&console.log("%s: T <insertSemi>",e.pos);let i=!1;for(n=0;;n++){const t=e.peek(n);if(!PD.includes(t)){DD.includes(t)&&(i=!0);break}}if(i){const t=qD(e,n+1);if(VD(e,n+1)||t&&/^(then|else|return|satisfies)$/.test(t.token))return;TD&&console.log("%s: MATCH <insertSemi>",e.pos),e.acceptToken(124)}})),WD={[fD]:"FunctionInvocation",[dD]:"FilterExpression",[uD]:"PathExpression"},UD={[kD]:"Context",[CD]:"FunctionDefinition",[HP]:"ForExpression",[bD]:"List",[ZP]:"IfExpression",[eD]:"QuantifiedExpression"},XD={[OD]:"Context",[wD]:"FunctionDefinition",[QP]:"ForExpression",[_D]:"List",[YP]:"IfExpression",[JP]:"QuantifiedExpression",[cD]:"PathExpression",[pD]:"FunctionInvocation",[hD]:"FilterExpression",[iD]:"ArithmeticExpression"};class KD{constructor(e){this.fn=e}get(e){return this.fn(e)}static of(e){return new KD(e)}}const GD=Object.keys({"date and time":1,date:1,time:1,duration:1});class YD{constructor(e={}){this.value=e}getKeys(){return Object.keys(this.value)}get(e){const t=this.value[e],n=this.constructor;return n.isAtomic(t)?t:n.of(t)}set(e,t){return this.constructor.of({...this.value,[e]:t})}merge(e){const t=this.constructor;return new t(t.__merge(this.value,e))}static isAtomic(e){return!e||e instanceof this||e instanceof KD||"object"!=typeof e}static of(...e){return e.reduce(((e,t)=>e.merge(t)),new this({}))}static __unwrap(e){return e?e instanceof this?e.value:"object"!=typeof e?{}:{...e}:{}}static __merge(e,t){return f(this.__unwrap(t),((e,t,n)=>t instanceof KD?{...e,[n]:t}:(t=this.__unwrap(t),u(e,n)&&(t=this.__merge(this.__unwrap(e[n]),t)),{...e,[n]:t})),this.__unwrap(e))}}class ZD{constructor({name:e="Expressions",tokens:t=[],children:n=[],parent:i=null,context:o,value:r,raw:s}){this.name=e,this.tokens=t,this.children=n,this.parent=i,this.context=o,this.value=r,this.raw=s}enterScope(e){const t=this.of({name:e,parent:this});return AD&&console.log("[%s] enter",t.path,t.context),t}exitScope(e){return this.parent?(AD&&console.log("[%s] exit %o\n%s",this.path,this.context,LD(e," ")),this.parent.pushChild(this)):(AD&&console.log("[%s] NO exit %o\n%s",this.path,this.context,LD(e," ")),this)}token(e){return AD&&console.log("[%s] token <%s> + <%s>",this.path,this.tokens.join(" "),e),this.assign({tokens:[...this.tokens,e]})}literal(e){return AD&&console.log("[%s] literal %o",this.path,e),this.pushChild(this.of({name:"Literal",value:e}))}computedValue(){for(let e=this;;e=i$(e.children)){if(!e)return null;if(e.value)return e.value}}contextKeys(){return this.context.getKeys().map(JD)}get path(){return this.parent?.path?.concat(" > ",this.name)||this.name}get(e){const t=[e,e&&JD(e)],n=this.context.getKeys().find((e=>t.includes(JD(e))));if(void 0===n)return;const i=this.context.get(n);return i instanceof KD?i.get(this):i}resolveName(){const e=this.tokens.join(" "),t=this.assign({tokens:[]}),n=this.of({name:"VariableName",parent:t,value:this.get(e),raw:e});return AD&&console.log("[%s] resolve name <%s=%s>",n.path,e,this.get(e)),t.pushChild(n)}pushChild(e){if(!e)return this;const t=this.assign({children:[...this.children,e]});return e.parent=t,t}pushChildren(e){let t=this;for(const n of e)t=t.pushChild(n);return t}declareName(){if(0===this.tokens.length)throw Error("no tokens to declare name");const e=this.tokens.join(" ");return AD&&console.log("[%s] declareName <%s>",this.path,e),this.assign({tokens:[]}).pushChild(this.of({name:"Name",value:e}))}define(e,t){if("string"!=typeof e)return AD&&console.log("[%s] no define <%s=%s>",this.path,e,t),this;AD&&console.log("[%s] define <%s=%s>",this.path,e,t);const n=this.context.set(e,t);return this.assign({context:n})}assign(e={}){return ZD.of({...this,...e})}of(e={}){const t={context:this.context,parent:this.parent};return ZD.of({...t,...e})}static of(e){const{name:t,tokens:n=[],children:i=[],parent:o=null,context:r,value:s,raw:a}=e;if(!r)throw new Error("must provide <context>");return new ZD({name:t,tokens:[...n],children:[...i],context:r,parent:o,value:s,raw:a})}}function JD(e){return e.replace(/\s*([./\-'+]|\*\*?)\s*/g," $1 ").replace(/\s{2,}/g," ").trim()}function e$(e,t,n){const i=e.children.filter((e=>e.name!==t)),o=e.children.filter((e=>e.name===t)),r=i[0],s=i[Math.max(1,i.length-1)],a=r?.computedValue(),l=s?.computedValue()||null;return e.assign({children:o}).enterScope(t).pushChildren(i).exitScope(n).define(a,l)}function t$(e={},t=YD){const n=ZD.of({context:t.of(e)});return new BP({start:n,reduce(e,n,i,o){if(n===YP){const[n,i]=e.children.slice(-2);e=e.assign({value:t.of(n?.computedValue(),i?.computedValue())})}if(n===_D&&(e=e.assign({value:t.of(...e.children.map((e=>e?.computedValue())))})),n===hD){const[t,n]=e.children.slice(-2);e=e.assign({value:t?.computedValue()})}if(n===pD){const[t,...n]=e.children;"get value"===t?.raw&&(e=function(e,t){if(!t.length)return e.assign({value:null});"Name"===t[0].name&&(t=function(e,t){const n={};for(let t=0;t<e.length;t+=2){const[i,o]=e.slice(t,t+2);n[i.value]=o}return t.map((e=>n[e]))}(t,["m","key"]));if(2!==t.length)return e.assign({value:null});const[n,i]=t,o=i?.computedValue(),r=n?.computedValue();if(!r||"object"!=typeof r||"string"!=typeof o)return e.assign({value:null});return e.assign({value:[JD(o),o].reduce(((e,t)=>r.get(t)||e),null)})}(e,n))}const r=UD[n];if(r)return e.enterScope(r);const s=WD[n];if(s){const{children:i,context:o}=e,r=i.slice(0,-1),a=i$(i);let l=null;return n===uD&&(l=t.of(a?.computedValue())),n===dD&&(l=t.of(o,a?.computedValue()).set("item",a?.computedValue())),e.assign({children:r}).enterScope(s).pushChild(a).assign({context:l||o})}const a=o.read(o.pos,i.pos);if(XD[n])return e.exitScope(a);if(n===ED){const n=e.children.filter((e=>"ContextEntry"!==e.name)),i=n[0],o=i$(n);return e$(e,"ContextEntry",a).assign({value:t.of(e.value).set(i?.computedValue(),o?.computedValue())})}if(n===WP||n===tD)return e$(e,"InExpression",a);if(n===GP)return e.define("partial",KD.of((e=>i$(e.children)?.computedValue())));if(n===gD){const t=i$(e.children).computedValue();return e.define(t,1)}if(n===oD||n===rD||n===sD){const t=e.children.slice(0,-1),n=i$(e.children);return e.assign({children:t}).enterScope("ArithmeticExpression").pushChild(n)}if(n===aD)return e.enterScope("ArithmeticExpression");if(n===XP||n===KP||n===RD)return e.token(a);if(n===yD)return e.literal(a.replace(/^"|"$/g,""));if(n===xD)return e.literal("true"===a);if(n===vD)return e.literal(parseFloat(a));if(n===mD)return e.literal(null);if(n===lD)return e.resolveName();if(n===UP||n===SD)return e.declareName();if((n===zP||n===nD)&&e.tokens.length>0)throw new Error("uncleared name");if(n===zP){let t=e;for(;t.parent;)t=t.exitScope(a);return t}return e}})}const n$=t$({});function i$(e){return e[e.length-1]}const o$=VS({StringLiteral:lR.string,NumericLiteral:lR.number,BooleanLiteral:lR.bool,"AtLiteral!":lR.special(lR.string),CompareOp:lR.compareOperator,ArithOp:lR.arithmeticOperator,"for if then else some every satisfies between return":lR.controlKeyword,"in instance of and or":lR.operatorKeyword,function:lR.definitionKeyword,as:lR.keyword,"Type/...":lR.typeName,Wildcard:lR.special(lR.variableName),null:lR.null,LineComment:lR.lineComment,BlockComment:lR.blockComment,'VariableName! "?"':lR.variableName,"DateTimeConstructor! SpecialFunctionName!":lR.function(lR.special(lR.variableName)),"List Interval":lR.list,Context:lR.definition(lR.literal),"Name!":lR.definition(lR.variableName),"Key/Name! ContextEntryType/Name!":lR.definition(lR.propertyName),"PathExpression/VariableName!":lR.function(lR.propertyName),"FormalParameter/ParameterName!":lR.function(lR.definition(lR.variableName)),"( )":lR.paren,"[ ]":lR.squareBracket,"{ }":lR.brace,".":lR.derefOperator,", ;":lR.separator,"..":lR.punctuation}),r$={__proto__:null,for:10,in:32,return:36,if:40,then:42,else:44,some:48,every:50,satisfies:56,or:60,and:64,between:72,instance:86,of:89,days:101,time:103,duration:105,years:107,months:109,date:111,list:117,context:123,function:130,null:156,true:330,false:330,"?":170,external:186,not:211},s$=LP.deserialize({version:14,states:"C|O`QYOOO`QYOOO$sQYOOOOQU'#Ce'#CeO$}QYO'#C`O&WQYO'#FQOOQQ'#Ff'#FfO&bQYO'#FfO`QYO'#DVOOQU'#En'#EnO(UQ^O'#D]OOQU'#D^'#D^OOQU'#D]'#D]OOQO'#Fn'#FnO*RQWO'#DvOOQQ'#D}'#D}OOQQ'#EO'#EOOOQQ'#EP'#EPO*WOWO'#ESO*RQWO'#EQOOQQ'#EQ'#EQOOQQ'#Ft'#FtOOQQ'#Fr'#FrOOQQ'#Fy'#FyOOQQ'#EU'#EUO`QYO'#EWOOQQ'#FS'#FSO*]Q^O'#FSO,SQYO'#EXO,ZQWO'#EYOOQP'#F}'#F}O,`QXO'#EaOOQQ'#Fz'#FzOOQQ'#FR'#FRQOQWOOOOQQ'#FT'#FTOOQQ'#F^'#F^O`QYO'#CoOOQQ'#F_'#F_O$}QYO'#CsO,kQYO'#DwOOQQ'#Fs'#FsO,pQYO'#EROOQO'#ER'#ERO`QYO'#EVO`QYO'#EUOOQO'#F{'#F{Q,xQWOOO,}QYO'#DRO-tQWO'#FbOOQO'#DT'#DTO.PQYO'#FfO.WQWOOO.}QYO'#CdO/[QYO'#FVOOQQ'#Cc'#CcO/aQYO'#FUOOQQ'#Cb'#CbO/iQYO,58zO`QYO,59iOOQQ'#Fc'#FcOOQQ'#Fd'#FdOOQQ'#Fe'#FeO`QYO,59qO`QYO,59qO`QYO,59qOOQQ'#Fl'#FlO/nQYO,5:^OOQQ'#Fm'#FmO`QYO,5:`O`QYO,59eO`QYO,59gO`QYO,59iO1jQYO,59iO1qQYO,59rOOQQ,5:i,5:iO1vQYO,59qOOQU-E8l-E8lO3jQYO'#FoOOQQ,5:b,5:bOOQQ,5:n,5:nOOQQ,5:l,5:lO3qQYO,5:rOOQQ,5;n,5;nO3{QYO,5:qO4YQWO,5:sO4_QYO,5:tOOQP'#Ee'#EeO5UQXO'#EdOOQO'#Ec'#EcO5]QWO'#EbO5bQWO'#GOO5jQWO,5:{O5oQYO,59ZO/[QYO'#FaOOQQ'#Cw'#CwO5vQYO'#F`OOQQ'#Cv'#CvO6OQYO,59_O6TQYO,5:cO6YQYO,5:mO3tQYO,5:qO6_QYO,5:pO`QYO'#EwQ,xQWOOO`QYO'#EmO7UQWO,5;|O`QYOOOOQR'#Cf'#CfOOQQ'#Ej'#EjO8OQYO,59OO`QYO,5;qOOQQ'#FY'#FYO$}QYO'#EkO8`QYO,5;pO`QYO1G.fOOQQ'#F]'#F]O9VQYO1G/TO;|QYO1G/]O<WQYO1G/]O<bQYO1G/]OOQQ1G/x1G/xO>UQYO1G/zO>]QYO1G/PO?fQYO1G/RO@oQYO1G/TO`QYO1G/TOOQQ1G/T1G/TOAVQYO1G/^OAtQ^O'#CdOCWQYO'#FqOOQO'#Dz'#DzOCbQWO'#DyOCgQWO'#FpOOQO'#Dx'#DxOOQO'#D{'#D{OCoQWO,5<ZOOQQ1G0^1G0^O`QYO1G0]O`QYO'#EsOCtQWO,5<]OOQQ1G0_1G0_ODPQWO'#E[OD[QWO'#F|OOQO'#EZ'#EZODdQWO1G0`OOQP'#Eu'#EuODiQXO,5;OO`QYO,5:|ODpQXO'#EvODxQWO,5<jOOQQ1G0g1G0gO`QYO1G.uO`QYO,5;{O$}QYO'#ElOEQQYO,5;zO`QYO1G.yOEYQYO1G/}OOQO1G0X1G0XOOQO,5;c,5;cOOQO-E8u-E8uOOQO,5;X,5;XOOQO-E8k-E8kOE_QWOOOOQQ-E8h-E8hOEdQYO'#CmOOQQ1G1]1G1]OOQQ,5;V,5;VOOQQ-E8i-E8iOEqQYO7+$QOOQQ7+%f7+%fO`QYO7+$oOFhQYO,5:rOFuQWO7+$oOFzQYO'#D[OOQQ'#DZ'#DZOHnQYO'#D_OHsQYO'#D_OHxQYO'#D_OH}Q`O'#DgOISQ`O'#DjOIXQ`O'#DnOOQQ7+$x7+$xO`QYO,5:eO$}QYO'#ErOI^QWO,5<[OOQQ1G1u1G1uOJdQYO7+%wOJqQYO,5;_OOQO-E8q-E8qOAVQYO,5:vO$}QYO'#EtOKOQWO,5<hOKWQYO7+%zOOQP-E8s-E8sOK_QYO1G0hOOQO,5;b,5;bOOQO-E8t-E8tOKiQYO7+$aOKpQYO1G1gOOQQ,5;W,5;WOOQQ-E8j-E8jOKzQYO7+$eOOQO7+%i7+%iO`QYO,59XOLqQYO<<HZOOQQ<<HZ<<HZO/nQYO'#EoOMzQYO,59vO! nQYO,59yO! sQYO,59yO! xQYO,59yO! }QYO,5:RO$}QYO,5:UO!!lQbO,5:YO!!sQYO1G0POOQO,5;^,5;^OOQO-E8p-E8pO!!}QYO<<IcOOQQ<<Ic<<IcOOQO1G0b1G0bOOQO,5;`,5;`OOQO-E8r-E8rO!%|QYO'#E^OOQQ<<If<<IfO`QYO<<IfO`QYO<<G{O!&sQYO1G.sOOQQ,5;Z,5;ZOOQQ-E8m-E8mO!&}QYO1G/eOOQQ1G/e1G/eO!'SQbO'#D]O!'eQ`O'#D[O!'pQ`O1G/mO!'uQWO'#DmO!'zQ`O'#FhOOQO'#Dl'#DlO!(SQ`O1G/pOOQO'#Dq'#DqO!(XQ`O'#FjOOQO'#Dp'#DpO!(aQ`O1G/tOOQQAN?QAN?QO!(fQYOAN=gOOQQ7+%P7+%PO!)]Q`O,59vOOQQ7+%X7+%XO! }QYO,5:XO$}QYO'#EpO!)hQ`O,5<SOOQQ7+%[7+%[O! }QYO'#EqO!)pQ`O,5<UO!)xQ`O7+%`OOQO1G/s1G/sOOQO,5;[,5;[OOQO-E8n-E8nOOQO,5;],5;]OOQO-E8o-E8oOAVQYO<<HzOOQQAN>fAN>fO/nQYO'#EoO! }QYO<<HzO!)}Q`O7+%`O!*SQ`O1G/tO!!lQbO,5:YO!*XQ`O'#Dn",stateData:"!*h~O#rOS#sOSPOSQOS~OTsOZVO[UOdtOhvOivOr}Os}OviO!T{O!U{O!VxO!XzO!c!OO!g|O!igO!pyO!wjO#SnO#nRO#oRO$ZZO$i_O$j`O$kaO$lbO~OTsO[UOdtOhvOivOr}Os}OviO!T{O!U{O!VxO!XzO!c!OO!g|O!igO!pyO!wjO#SnO#nRO#oRO$ZZO$i_O$j`O$kaO$lbO~OZ!TO#]!UO~P#SO#nRO#oRO~OZ!^O[!^O]!_O^!_O_!`O`!kOn!hOp!iOr!]Os!]Ot!jO{!lO!i!fO#z!dOv$bX~O#l#tX$s#tX~P%VO$i!mOT$YXZ$YX[$YXd$YXh$YXi$YXr$YXs$YXv$YX!T$YX!U$YX!V$YX!X$YX!c$YX!g$YX!i$YX!p$YX!w$YX#S$YX#n$YX#o$YX$Z$YX$j$YX$k$YX$l$YX~O#nRO#oROZ!PX[!PX]!PX^!PX_!PX`!PXn!PXp!PXr!PXs!PXt!PXv!PX{!PX!i!PX#l!PX#p!PX#z!PX$s!PX$O!PXx!PX#}!PX!g!PXe!PXb!PX#R!PXf!PXl!PX~Ov!pO~O$j`O~O#p!uOZ#vX[#vX]#vX^#vX_#vX`#vXn#vXp#vXr#vXs#vXt#vXv#vX{#vX!i#vX#l#vX#z#vX$s#vX$O#vXx#vX#}#vX!g#vXe#vXb#vX#R#vXf#vXl#vX~O!g$eP~P`Ov!xO~O#m!yO$j`O#R$rP~Op#VO~Op#WOv!uX~O$s#ZO~O#luX$OuX$suXxuX#}uX!guXeuXbuX#RuXfuXluX~P%VO$O#]O#l$UXx$UX~O#l#[X~P&bOv#_O~OZ#`O[#`O]#`O^#`O_#`O#nRO#oRO#z#`O#{#`O$]WX~O`WXxWX$OWX~P.]O`#dO~O$O#eOb#xX~Ob#hO~O#nRO#oRO$ZZO~OTsOZVO[UOdtOhvOivOr}Os}O!T{O!U{O!VxO!XzO!c!OO!g|O!igO!pyO!wjO#SnO#nRO#oRO$ZZO$i_O$j`O$kaO$lbO~Ov#rO~P/yO|#tO~O{!lO!i!fO#z!dOZya[ya]ya^ya_ya`yanyapyaryasyatyav$bX#lya$sya$Oyaxya#}ya!gyaeyabya#Ryafyalya~Ox$eP~P`Ox#}O#}$OO~P%VO#}$OO$O$PO!g$eX~P%VO!g$RO~O#nRO#oROx$pP~OZ#`O[#`O]#`O^#`O_#`O#m!yO#z#`O#{#`O~O$]#WX~P4jO$]$YO~O$O$ZO#R$rX~O#R$]O~Oe$^O~P%VO$O$`Ol$SX~Ol$bO~O!W$cO~O!T$dO~O#l!xa$s!xa$O!xax!xa#}!xa!g!xae!xab!xa#R!xaf!xal!xa~P%VO$O#]O#l$Uax$Ua~OZ#`O[#`O]#`O^#`O_#`O#nRO#oRO#z#`O#{#`O~O`Wa$]WaxWa$OWa~P7aO$O#eOb#xa~OZ!^O[!^O]!_O^!_O_!`O{!lO!i!fO#z!dOv$bX~O`qinqipqirqisqitqi#lqi$sqi$Oqixqi#}qi!gqieqibqi#Rqifqilqi~P8hO_!`O{!lO!i!fO#z!dOZyi[yi`yinyipyiryisyityiv$bX#lyi$syi$Oyixyi#}yi!gyieyibyi#Ryifyilyi~O]!_O^!_O~P:`O]yi^yi~P:`O{!lO!i!fO#z!dOZyi[yi]yi^yi_yi`yinyipyiryisyityiv$bX#lyi$syi$Oyixyi#}yi!gyieyibyi#Ryifyilyi~O!g$pO~P%VO`!kOp!iOr!]Os!]Ot!jOnmi#lmi$smi$Omixmi#}mi!gmiemibmi#Rmifmilmi~P8hO`!kOr!]Os!]Ot!jOnoipoi#loi$soi$Ooixoi#}oi!goieoiboi#Roifoiloi~P8hO`!kOn!hOp$qOr!]Os!]Ot!jO~P8hO!S$vO!V$wO!X$xO![$yO!_$zO!c${O#nRO#oRO$ZZO~OZ#bX[#bX]#bX^#bX_#bX`#bXn#bXp#bXr#bXs#bXt#bXv#bXx#bX{#bX!i#bX#n#bX#o#bX#p#bX#z#bX$O#bX~P.]O$O$POx$eX~P%VO$]$}O~O$O%OOx$dX~Ox%QO~O$O$PO!g$eax$ea~O$]%UOx#OX$O#OX~O$O%VOx$pX~Ox%XO~O$]#Wa~P4jO#m!yO$j`O~O$O$ZO#R$ra~O$O$`Ol$Sa~O!U%cO~OxrO~O#}%dObaX$OaX~P%VO#lSq$sSq$OSqxSq#}Sq!gSqeSqbSq#RSqfSqlSq~P%VOx#}O#}$OO$OuX~P%VOx%fO~O#z%gOZ!OX[!OX]!OX^!OX_!OX`!OXn!OXp!OXr!OXs!OXt!OXv!OX{!OX!i!OX#l!OX$s!OX$O!OXx!OX#}!OX!g!OXe!OXb!OX#R!OXf!OXl!OX~Op%iO~Op%jO~Op%kO~O!]%lO~O!]%mO~O!]%nO~O$O%OOx$da~OZ!^O[!^O]!_O^!_O_!`O`!kOn!hOp!iOr!]Os!]Ot!jO{!lO#z!dOv$bX~Ox%sO!g%sO!i%rO~PIfO!g#ga$O#gax#ga~P%VO$O%VOx$pa~O#P%yO~P`O#R#Ui$O#Ui~P%VOf%zO~P%VOl$Ti$O$Ti~P%VO#lgq$sgq$Ogqxgq#}gq!ggqegqbgq#Rgqfgqlgq~P%VO`qynqypqyrqysqytqy#lqy$sqy$Oqyxqy#}qy!gqyeqybqy#Rqyfqylqy~P8hO#z%gOZ!Oa[!Oa]!Oa^!Oa_!Oa`!Oan!Oap!Oar!Oas!Oat!Oav!Oa{!Oa!i!Oa#l!Oa$s!Oa$O!Oax!Oa#}!Oa!g!Oae!Oab!Oa#R!Oaf!Oal!Oa~O!T&OO~O!W&OO~O!T&PO~O!S$vO!V$wO!X$xO![$yO!_$zO!c&uO#nRO#oRO$ZZO~O!Y$^P~P! }Ox!mi$O!mi~P%VOT$aXZ$aX[$aX]!yy^!yy_!yy`!yyd$aXh$aXi$aXn!yyp!yyr$aXs$aXt!yyv$aX{!yy!T$aX!U$aX!V$aX!X$aX!c$aX!g$aX!i$aX!p$aX!w$aX#S$aX#l!yy#n$aX#o$aX#z!yy$Z$aX$i$aX$j$aX$k$aX$l$aX$s!yy$O!yyx!yy#}!yye!yyb!yy#R!yyf!yyl!yy~O#l#QX$s#QX$O#QXx#QX#}#QX!g#QXe#QXb#QX#R#QXf#QXl#QX~P%VObai$Oai~P%VO!U&_O~O#nRO#oRO!Y!PX#z!PX$O!PX~O#z&pO!Y!OX$O!OX~O!Y&aO~O$]&bO~O$O&cO!Y$[X~O!Y&eO~O$O&fO!Y$^X~O!Y&hO~O#lc!R$sc!R$Oc!Rxc!R#}c!R!gc!Rec!Rbc!R#Rc!Rfc!Rlc!R~P%VO#z&pO!Y!Oa$O!Oa~O$O&cO!Y$[a~O$O&fO!Y$^a~O$_&nO~O$_&qO~O!Y&rO~O!]&tO~O$Z~QP_^$i]#z~",goto:"E|$sPPPP$tP%m%p%v&Y'sPPPPPP'|P$tPPP$tPP(P(SP$tP$tP$tPPP(YP(eP$t$tPP(n)T)`*m)TPPPPPPP)TPP)TP+r+u)TP+{,R$tP$tP$t,Y-R-U-[-RP-d.]-d-d/]0UP$t0}$t1v1v2o2rP2xPP1v3O3U/X3YPP3bP3e3l3r3x4O5Z5e5k5q5w6O6U6[6bPPPPPPPP6h6q8x9q:j:mPP:qPP:w:z;s<l<o<s<x=g>V>vP?oP?rP?v@iA[BTBZB^$tBdBdPPPPC]8xDUD}EQEy!mjOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR![SQ!YSR$m#eS!WS#eS#Qw$`W#w!p!x%O%VT&T%m&c#WXOPQWYilu|}!]!a!b!c!e!g!h!i!j!k#Z#]#_#c#g#r#t$O$P$Y$^$_$b$q$}%U%X%d%g%l%n%y%z&Q&b&f&n&p&q&tb!VSw!x#e$`%O%V%m&cU#a!V#b#uR#u!pU#a!V#b#uT$W!z$XR$l#cR#UwQ#SwR%`$`U!RQ#_#rQ#s!kR$g#]QrQQ$i#_R$s#rQ$|#tQ%t%UQ&S%lU&X%n&f&tQ&i&bT&o&n&qc$u#t%U%l%n&b&f&n&q&t!lkOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zQ#m!eU$t#t%U&nS%|%g&p]&R%l%n&b&f&q&t#V[OPQWilu|}!]!a!b!c!e!g!h!i!j!k!p#Z#]#_#c#g#r#t$O$P$Y$^$_$b$q$}%U%X%d%g%l%n%y%z&b&f&n&p&q&tR&W%mQ&U%mR&j&cQ&[%nR&s&tS&Y%n&tR&l&f!m]OPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#|!pQ#y!pR%p%OS#x!p%OT$S!x%V!meOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!leOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zQ!rbT!{o$Z!mcOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mdOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mhOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mpOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR$V!xQ$T!xR%u%VQ%x%XR&]%yQ!}oR%[$ZT!|o$ZS!zo$ZT$W!z$XRrQS#b!V#uR$j#bQ#f!YR$n#fQ$a#SR%a$aQ#^!RR$h#^!vYOPQWilu|}!]!a!b!c!e!g!h!i!j!k!p#Z#]#_#c#g#r#t$O$P$Y$^$_$b$q$}%U%X%d%g%y%z&nS!oY&Q_&Q%l%n&b&f&p&q&tQ%h$tS%}%h&`R&`&RQ&d&UR&k&dQ&g&YR&m&gQ%P#yR%q%PS$Q!v#vR%T$QQ%W$TR%v%WQ$X!zR%Y$XQ$[!}R%]$[Q#[!PR$f#[QrOQ!PPR$e#ZUTOP#ZW!QQ!k#]#_Q!nWQ!tiQ!vlQ#PuQ#X|Q#Y}Q#i!]Q#j!aQ#k!bQ#l!cQ#n!gQ#o!hQ#p!iQ#q!jQ#v!pQ$k#cQ$o#gQ$r#rQ%R$OQ%S$PQ%Z$YQ%^$^Q%_$_Q%b$bQ%e$qQ%o$}S%w%X%yQ%{%dR&^%z!mqOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mSOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR!ZST!XS#eQ#c!WR$_#QR#g![!muOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mwOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#TwT#Rw$`V!SQ#_#r!X!aT!Q!t!v#P#X#Y#i#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!Z!bT!Q!t!v#P#X#Y#i#j#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!]!cT!Q!t!v#P#X#Y#i#j#k#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!mWOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR&V%mT&Z%n&t!a!eT!Q!n!t!v#P#X#Y#i#j#k#l#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!a!gT!Q!n!t!v#P#X#Y#i#j#k#l#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!m^OPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zQ!q^R!scR#z!pQ!wlR#{!p!mfOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mlOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mmOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR$U!x!moOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#Oo",nodeNames:"⚠ LineComment BlockComment Expression ForExpression for InExpressions InExpression Name Identifier Identifier ArithOp ArithOp ArithOp ArithOp ArithOp in IterationContext return IfExpression if then else QuantifiedExpression some every InExpressions InExpression satisfies Disjunction or Conjunction and Comparison CompareOp CompareOp between PositiveUnaryTest ( PositiveUnaryTests ) ArithmeticExpression InstanceOfExpression instance of Type QualifiedName VariableName BacktickIdentifier SpecialType days time duration years months date > ListType list < ContextType context ContextEntryTypes ContextEntryType FunctionType function ArgumentTypes ArgumentType PathExpression ] FilterExpression [ FunctionInvocation SpecialFunctionName NamedParameters NamedParameter ParameterName PositionalParameters null NumericLiteral StringLiteral BooleanLiteral DateTimeLiteral DateTimeConstructor AtLiteral ? SimplePositiveUnaryTest Interval ParenthesizedExpression List FunctionDefinition FormalParameters FormalParameter external FunctionBody } { Context ContextEntry Key Name Identifier Expressions UnaryTests Wildcard not",maxTerm:173,context:n$,nodeProps:[["group",-17,4,19,23,29,31,33,41,42,68,70,72,85,86,88,89,90,97,"Expr",47,"Expr Expr",-5,78,79,80,81,82,"Expr Literal"],["closedBy",38,")",71,"]",96,"}"],["openedBy",40,"(",69,"[",95,"{"]],propSources:[o$],skippedNodes:[0,1,2],repeatNodeCount:14,tokenData:".Z~RvXY#iYZ$^Z[#i]^$^pq#iqr$crs$nwx&fxy&kyz&pz{&u{|'S|}'X}!O'^!O!P'k!P!Q(u!Q![*p![!]+X!]!^+^!^!_+c!_!`$i!`!a+r!b!c+|!}#O,R#P#Q,W#Q#R&}#S#T,]#o#p.P#q#r.U$f$g#i#BY#BZ#i$IS$I_#i$I|$I}$^$I}$JO$^$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~#nY#r~XY#iZ[#ipq#i$f$g#i#BY#BZ#i$IS$I_#i$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~$cO#s~~$fP!_!`$i~$nOr~~$sW$j~OY$nZr$nrs%]s#O$n#O#P%b#P;'S$n;'S;=`&`<%lO$n~%bO$j~~%eRO;'S$n;'S;=`%n;=`O$n~%sX$j~OY$nZr$nrs%]s#O$n#O#P%b#P;'S$n;'S;=`&`;=`<%l$n<%lO$n~&cP;=`<%l$n~&kO#{~~&pOv~~&uOx~~&zP^~z{&}~'SO_~~'XO[~~'^O$O~R'cPZP!`!a'fQ'kO$_Q~'pQ#z~!O!P'v!Q!['{~'{O#}~~(QR$i~!Q!['{!g!h(Z#X#Y(Z~(^R{|(g}!O(g!Q![(m~(jP!Q![(m~(rP$i~!Q![(m~(zQ]~z{)Q!P!Q*X~)TTOz)Qz{)d{;'S)Q;'S;=`*R<%lO)Q~)gVOz)Qz{)d{!P)Q!P!Q)|!Q;'S)Q;'S;=`*R<%lO)Q~*ROQ~~*UP;=`<%l)Q~*^SP~OY*XZ;'S*X;'S;=`*j<%lO*X~*mP;=`<%l*X~*uS$i~!O!P+R!Q![*p!g!h(Z#X#Y(Z~+UP!Q!['{~+^O$]~~+cO$s~R+jP!]QsP!_!`+mP+rOsPR+yP!YQsP!_!`+m~,RO$l~~,WO!i~~,]O!g~~,`WOY,]Z#O,]#O#P,x#P#S,]#S#T-t#T;'S,];'S;=`-y<%lO,]~,{RO;'S,];'S;=`-U;=`O,]~-XXOY,]Z#O,]#O#P,x#P#S,]#S#T-t#T;'S,];'S;=`-y;=`<%l,]<%lO,]~-yO$Z~~-|P;=`<%l,]~.UO#S~~.ZO#R~",tokenizers:[QD,zD,HD,0,1],topRules:{Expression:[0,3],Expressions:[1,102],UnaryTests:[2,103]},dialects:{camunda:2544},dynamicPrecedences:{31:-1,68:1,72:-1,74:-1},specialized:[{term:122,get:e=>r$[e]||-1}],tokenPrec:2546});function a$(e){const t=[];return e.iterate({enter:e=>{const n=e.node;if(!n.type.isError)return;const i=n.parent,o=l$(n),r={from:n.from,to:n.to,severity:"error",type:"Syntax Error"};if(n.from!==n.to)r.message=`Unrecognized token in <${i.name}>`;else if(o)r.message=`Unrecognized token <${o.name}> in <${i.name}>`,r.to=o.to;else{const e=i.enterUnfinishedNodesBefore(n.to);r.message=`Incomplete <${(e||i).name}>`}t.push(r)}}),t}function l$(e){return e?e.nextSibling||l$(e.parent):null}var c$={create:e=>({enter(t){if("FilterExpression"!==t.name)return;const n=e.readContent(t.from,t.to);if(/\[\s*0\s*\]$/.test(n)){const{from:i,to:o}=t;e.report({from:i,to:o,message:"First item is accessed via [1]",severity:"warning",type:"first-item",actions:[{name:"fix",apply(t,r=i,s=o){e.updateContent(r,s,n.replace(/\[\s*0\s*\]$/,"[1]"))}}]})}}})};const u$=[c$];function h$(e){const{readContent:t,syntaxTree:n,updateContent:i}=e,o=[],r={readContent:t,report:e=>{o.push(e)},updateContent:i},s=u$.map((e=>e.create(r)));return n.iterate({enter:e=>{for(const t of s)t.enter&&t.enter(e)},leave:e=>{for(const t of s)t.leave&&t.leave(e)}}),o}const d$=[bM("function(${params}) ${body}",{label:"function",detail:"definition",type:"keyword"}),bM("for ${var} in ${collection} return ${value}",{label:"for",detail:"expression",type:"keyword"}),bM("every ${var} in ${collection} satisfies ${condition}",{label:"every",detail:"quantified expression",type:"keyword"}),bM("some ${var} in ${collection} satisfies ${condition}",{label:"some",detail:"quantified expression",type:"keyword"}),bM("if ${condition} then ${value} else ${other value}",{label:"if",detail:"block",type:"keyword"}),bM("{ ${key}: ${value} }",{label:"context",detail:"block",type:"keyword"}),bM("null",{label:"null",detail:"literal",type:"keyword"}),bM("true",{label:"true",detail:"literal",type:"keyword"}),bM("false",{label:"false",detail:"literal",type:"keyword"})];function p$(){return p$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},p$.apply(this,arguments)}function f$(e){const{context:t,after:n,before:i,keyword:o}=e;return function(e,t){const{nodes:n,before:i,after:o,keyword:r}=e;return e=>{const{state:s,pos:a}=e,l=_$(gR(s).resolveInner(a,-1),n);if(!l)return null;const[c]=l;return x$(c,a,[r,i])||function(e,t,n){return b$(e,t,n,1)}(c,a,[r,o])||o&&!x$(c,a,[o])?null:t(e)}}({nodes:t,before:i,after:n,keyword:o},bT([{label:o,type:"keyword",boost:10}]))}const g$=[f$({context:"InExpression",keyword:"in"}),f$({context:"IfExpression",keyword:"then",after:"if",before:"else"}),f$({context:"IfExpression",keyword:"else",after:"then"}),f$({context:"QuantifiedExpression",keyword:"satisfies"}),f$({context:"ForExpression",after:"InExpressions",keyword:"return"})],m$=["StringLiteral","Identifier","LineComment","BlockComment","PathExpression","Context","Key","ParameterName"],v$=["Expr","ContextEntry"];function y$(e){return function(e){const t=[...m$,...v$];return n=>{const{state:i,pos:o}=n,r=_$(gR(i).resolveInner(o,-1),t);if(r){const[e,t]=r;if(m$.includes(t))return null}return e(n)}}(bT(e.map((e=>p$({},e,{type:"text"})))))}function x$(e,t,n){return b$(e,t,n,-1)}function b$(e,t,n,i){let o=e[i>0?"childAfter":"childBefore"](t);for(;o;){if(n.includes(o.name))return o;if(o.type.isError&&o.firstChild&&n.includes(o.firstChild.name))return o.firstChild;o=o[i>0?"nextSibling":"prevSibling"]}return null}function _$(e,t){for(Array.isArray(t)||(t=[t]);e;e=e.parent){const n=e.type,i=t.find((e=>e&&n.is(e)));if(i)return[e,i];if(n.isTop)break}return null}const w$=fR.define({parser:s$.configure({props:[PR.add({Context:LR({closing:"}"}),"List FilterExpression":LR({closing:"]"}),"ParenthesizedExpression FunctionInvocation":qR({except:/^\s*\)/}),"ForExpression QuantifiedExpression IfExpression":qR({except:/^\s*(then|else|return|satisfies)\b/}),FunctionDefinition:qR({except:/^\s*(\(|\))/})}),FR.add({Context:zR,List:zR,ParenthesizedExpression:zR,FunctionDefinition(e){const t=e.getChild(")");return t?{from:t.to,to:e.to}:null}})]}),languageData:{indentOnInput:/^\s*(\)|\}|\]|then|else|return|satisfies)$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}}}}),C$=w$.configure({top:"UnaryTests"},"FEEL unary tests"),O$=w$.configure({top:"Expression"},"FEEL expression");var k$=[function(e,t={}){return[rP.of({source:e,config:t}),oP,gP]}((e=>{if(0===e.state.doc.length)return[];const t=gR(e.state),n=(i={syntaxTree:t,readContent:(t,n)=>e.state.sliceDoc(t,n),updateContent:(t,n,i)=>e.dispatch({changes:{from:t,to:n,insert:i}})},[...a$(i.syntaxTree),...h$(i)]);var i;return n.map((e=>({...e,source:e.type})))}))];var E$=[xE.theme({"& .cm-content":{padding:"0px"},"& .cm-line":{padding:"0px"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-completionInfo":{whiteSpace:"pre-wrap",overflow:"hidden",textOverflow:"ellipsis"},"&.cm-editor":{height:"100%"},"& .cm-completionInfo > *":{whiteSpace:"normal"},"& .cm-completionInfo ul":{margin:0,paddingLeft:"15px"},"& .cm-completionInfo pre":{marginBottom:0,whiteSpace:"pre-wrap"},"& .cm-completionInfo p":{marginTop:0},"& .cm-completionInfo p:not(:last-of-type)":{marginBottom:0}}),xE.baseTheme({"& .variableName":{color:"#10f"},"& .number":{color:"#164"},"& .string":{color:"#a11"},"& .bool":{color:"#219"},"& .function":{color:"#aa3731",fontWeight:"bold"},"& .control":{color:"#708"}}),function(e,t){let n,i=[KR];return e instanceof QR&&(e.module&&i.push(xE.styleModule.of(e.module)),n=e.themeType),n?i.push(HR.computeN([xE.darkTheme],(t=>t.facet(xE.darkTheme)==("dark"==n)?[e]:[]))):i.push(HR.of(e)),i}(QR.define([{tag:lR.variableName,class:"variableName"},{tag:lR.name,class:"variableName"},{tag:lR.number,class:"number"},{tag:lR.string,class:"string"},{tag:lR.bool,class:"bool"},{tag:lR.function(lR.variableName),class:"function"},{tag:lR.function(lR.special(lR.variableName)),class:"function"},{tag:lR.controlKeyword,class:"control"},{tag:lR.operatorKeyword,class:"control"}]))];function S$(e){return e&&e.from===e.to}function R$(e){return!!e&&("PathExpression"===e.name||R$(e.parent))}function T$({variables:e}){return t=>{const n=gR(t.state).resolve(t.pos,-1);if(!R$(n))return;const i=function(e){for(;e;){if("PathExpression"===e.name)return e;e=e.parent}}(n),o=n===i?t.pos:n.from,r=M$(i,t);let s=e;for(var a=0;a<r.length-1;a++){var l=s.find((e=>e.name===r[a].name));if(!l)return null;if("optional"!==l.isList&&!!l.isList!==r[a].isList)return;s=l.entries}if(!s)return;s=s.map((e=>({label:e.name,type:"variable",info:e.info,detail:e.detail})));return{from:o,options:s}}}function M$(e,t){let n=[];for(let i=e.firstChild;i;i=i.nextSibling)"PathExpression"===i.name?n.push(...M$(i,t)):"FilterExpression"===i.name?n.push(...A$(i,t)):n.push({name:P$(i,t),isList:!1});return n}function A$(e,t){const n=e.firstChild;if("PathExpression"===n.name){const e=M$(n,t);return e[e.length-1].isList=!0,e}return[{name:P$(n,t),isList:!0}]}function P$(e,t){return t.state.sliceDoc(e.from,e.to)}function D$({variables:e=[],builtins:t=[]}){const n=function(e,t){return[].concat(e.map((e=>$$(e))),t.map((e=>$$(e))))}(e,t);return n.length?e=>{const{pos:t,state:i}=e,o=gR(i).resolve(t,-1);return function(e,t){const n=e.nextSibling;return S$(e)||n&&n.from===t&&S$(n)}(o,t)?e.explicit?{from:t,options:n}:null:!function(e){return e&&e.parent&&"VariableName"===e.parent.name}(o)||R$(o)?null:{from:o.from,options:n}}:e=>null}function $$(e,t){return"function"===e.type?function(e,t){const{name:n,info:i,detail:o,params:r=[]}=e,s=r.map((({name:e,type:t},n)=>({name:e||`param ${n+1}`,type:t}))),a=`${n}(${s.map((e=>"${"+e.name+"}")).join(", ")})`,l=s.map((({name:e,type:t})=>t?`${e}: ${t}`:e)).join(", "),c=`${n}(${l})`;return bM(a,{label:c,type:"function",info:i,detail:o,boost:t})}(e,t):{label:e.name,type:"variable",info:e.info,detail:e.detail,boost:t}}function j$({variables:e=[],builtins:t=[]}){return[T$({variables:e}),D$({variables:e,builtins:t}),y$(d$.map((e=>({...e,boost:-1})))),...g$]}function I$(e){return function(e={}){const t="unaryTests"===e.dialect?C$:O$,n=e.parserDialect,i=t$(e.context),o=t.configure({contextTracker:i,dialect:n}),r=e.completions||[y$(d$),g$].flat();return new kR(o,[...r.map((e=>o.data.of({autocomplete:e})))])}(e)}const B$=o_.define(),L$=o_.define(),N$=o_.define(),q$=o_.define();function V$({dialect:e="expression",parserDialect:t,variables:n=[],builtins:i=[],completions:o=j$({builtins:i,variables:n})}){const r=function(e){return e.slice().reverse().reduce(((e,t)=>(e[t.name]=()=>{},e)),{})}([...n,...i]);return[N$.of(e),B$.of(i),L$.of(n),q$.of(t),I$({dialect:e,parserDialect:t,context:r,completions:o})]}function F$(e){const{name:t,description:n}=e,i=t.match(/^([\w\s]+)\((.*)\)$/),o=i[1],r=i[2],s=r?r.split(", ").map((e=>({name:e}))):[];return{name:o,type:"function",params:s,info:()=>Gt(`<div class="description">${n}<div>`),boost:0}}const z$=[{name:"not(negand)",description:'<p>Returns the logical negation of the given value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">not(negand: boolean): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">not(true)\n// false\n\nnot(null)\n// null\n</code></pre>\n'},{name:"is defined(value)",description:'<p><em>Camunda Extension</em></p>\n<p>Checks if a given value is not <code>null</code>. If the value is <code>null</code> then the function returns <code>false</code>.\nOtherwise, the function returns <code>true</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">is defined(value: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">is defined(1)\n// true\n\nis defined(null)\n// false\n\nis defined(x)\n// false - if no variable "x" exists\n\nis defined(x.y)\n// false - if no variable "x" exists or it doesn't have a property "y"\n</code></pre>\n<p>:::caution Breaking change</p>\n<p>This function worked differently in previous versions. It returned <code>true</code> if the value was <code>null</code>.\nSince this version, the function returns <code>false</code> if the value is <code>null</code>.</p>\n<p>:::</p>\n'},{name:"get or else(value, default)",description:'<p><em>Camunda Extension</em></p>\n<p>Return the provided value parameter if not <code>null</code>, otherwise return the default parameter</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">get or else(value: Any, default: Any): Any\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">get or else("this", "default")\n// "this"\n\nget or else(null, "default")\n// "default"\n\nget or else(null, null)\n// null\n</code></pre>\n'},{name:"assert(value, condition)",description:'<p><em>Camunda Extension</em></p>\n<p>Verify that the given condition is met. If the condition is <code>true</code>, the function returns the value.\nOtherwise, the evaluation fails with an error.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">assert(value: Any, condition: Any)\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">assert(x, x != null)\n// "value" - if x is "value"\n// error - if x is null or doesn't exist\n\nassert(x, x >= 0)\n// 4 - if x is 4\n// error - if x is less than zero\n</code></pre>\n'},{name:"assert(value, condition, cause)",description:'<p><em>Camunda Extension</em></p>\n<p>Verify that the given condition is met. If the condition is <code>true</code>, the function returns the value.\nOtherwise, the evaluation fails with an error containing the given message.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">assert(value: Any, condition: Any, cause: String)\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">assert(x, x != null, "'x' should not be null")\n// "value" - if x is "value"\n// error('x' should not be null) - if x is null or doesn't exist\n\nassert(x, x >= 0, "'x' should be positive")\n// 4 - if x is 4\n// error('x' should be positive) - if x is less than zero\n</code></pre>\n'},{name:"get value(context, key)",description:'<p>Returns the value of the context entry with the given key.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">get value(context: context, key: string): Any\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">get value({foo: 123}, "foo")\n// 123\n\nget value({a: 1}, "b")\n// null\n</code></pre>\n'},{name:"get value(context, keys)",description:'<p><em>Camunda Extension</em></p>\n<p>Returns the value of the context entry for a context path defined by the given keys.</p>\n<p>If <code>keys</code> contains the keys <code>[k1, k2]</code> then it returns the value at the nested entry <code>k1.k2</code> of the context.</p>\n<p>If <code>keys</code> are empty or the nested entry defined by the keys doesn't exist in the context, it returns <code>null</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">get value(context: context, keys: list<string>): Any\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">get value({x:1, y: {z:0}}, ["y", "z"])\n// 0\n\nget value({x: {y: {z:0}}}, ["x", "y"])\n// {z:0}\n\nget value({a: {b: 3}}, ["b"])\n// null\n</code></pre>\n'},{name:"get entries(context)",description:'<p>Returns the entries of the context as a list of key-value-pairs.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">get entries(context: context): list<context>\n</code></pre>\n<p>The return value is a list of contexts. Each context contains two entries for "key" and "value".</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">get entries({foo: 123})\n// [{key: "foo", value: 123}]\n</code></pre>\n'},{name:"context put(context, key, value)",description:'<p>Adds a new entry with the given key and value to the context. Returns a new context that includes the entry.</p>\n<p>If an entry for the same key already exists in the context, it overrides the value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">context put(context: context, key: string, value: Any): context\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">context put({x:1}, "y", 2)\n// {x:1, y:2}\n</code></pre>\n<p>:::info\nThe function <code>context put()</code> replaced the previous function <code>put()</code> (Camunda Extension). The\nprevious function is deprecated and should not be used anymore.\n:::</p>\n'},{name:"context put(context, keys, value)",description:'<p>Adds a new entry with the given value to the context. The path of the entry is defined by the keys. Returns a new context that includes the entry.</p>\n<p>If <code>keys</code> contains the keys <code>[k1, k2]</code> then it adds the nested entry <code>k1.k2 = value</code> to the context.</p>\n<p>If an entry for the same keys already exists in the context, it overrides the value.</p>\n<p>If <code>keys</code> are empty, it returns <code>null</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">context put(context: context, keys: list<string>, value: Any): context\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">context put({x:1}, ["y"], 2)\n// {x:1, y:2}\n\ncontext put({x:1, y: {z:0}}, ["y", "z"], 2)\n// {x:1, y: {z:2}}\n\ncontext put({x:1}, ["y", "z"], 2)\n// {x:1, y: {z:2}}\n</code></pre>\n'},{name:"context merge(contexts)",description:'<p>Union the given contexts. Returns a new context that includes all entries of the given contexts.</p>\n<p>If an entry for the same key already exists in a context, it overrides the value. The entries are overridden in the same order as in the list of contexts.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">context merge(contexts: list<context>): context\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">context merge([{x:1}, {y:2}])\n// {x:1, y:2}\n\ncontext merge([{x:1, y: 0}, {y:2}])\n// {x:1, y:2}\n</code></pre>\n<p>:::info\nThe function <code>context merge()</code> replaced the previous function <code>put all()</code> (Camunda Extension). The\nprevious function is deprecated and should not be used anymore.\n:::</p>\n'},{name:"string(from)",description:'<p>Returns the given value as a string representation.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">string(from: Any): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">string(1.1)\n// "1.1"\n\nstring(date("2012-12-25"))\n// "2012-12-25"\n</code></pre>\n'},{name:"number(from)",description:'<p>Parses the given string to a number.</p>\n<p>Returns <code>null</code> if the string is not a number.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">number(from: string): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">number("1500.5")\n// 1500.5\n</code></pre>\n'},{name:"context(entries)",description:'<p>Constructs a context of the given list of key-value pairs. It is the reverse function to <a href="feel-built-in-functions-context.md#get-entriescontext">get entries()</a>.</p>\n<p>Each key-value pair must be a context with two entries: <code>key</code> and <code>value</code>. The entry with name <code>key</code> must have a value of the type <code>string</code>.</p>\n<p>It might override context entries if the keys are equal. The entries are overridden in the same order as the contexts in the given list.</p>\n<p>Returns <code>null</code> if one of the entries is not a context or if a context doesn't contain the required entries.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">context(entries: list<context>): context\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">context([{"key":"a", "value":1}, {"key":"b", "value":2}])\n// {a:1, b:2}\n</code></pre>\n'},{name:"date(from)",description:'<p>Returns a date from the given value.</p>\n<p>Returns <code>null</code> if the string is not a valid calendar date. For example, <code>"2024-06-31"</code> is invalid because June has\nonly 30 days.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">date(from: string): date\n</code></pre>\n<p>Parses the given string into a date.</p>\n<pre><code class="language-feel">date(from: date and time): date\n</code></pre>\n<p>Extracts the date component from the given date and time.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">date("2018-04-29")\n// date("2018-04-29")\n\ndate(date and time("2012-12-25T11:00:00"))\n// date("2012-12-25")\n</code></pre>\n'},{name:"date(year, month, day)",description:'<p>Returns a date from the given components.</p>\n<p>Returns <code>null</code> if the components don't represent a valid calendar date. For example, <code>2024,6,31</code> is invalid because\nJune has only 30 days.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">date(year: number, month: number, day: number): date\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">date(2012, 12, 25)\n// date("2012-12-25")\n</code></pre>\n'},{name:"time(from)",description:'<p>Returns a time from the given value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">time(from: string): time\n</code></pre>\n<p>Parses the given string into a time.</p>\n<pre><code class="language-feel">time(from: date and time): time\n</code></pre>\n<p>Extracts the time component from the given date and time.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">time("12:00:00")\n// time("12:00:00")\n\ntime(date and time("2012-12-25T11:00:00"))\n// time("11:00:00")\n</code></pre>\n'},{name:"time(hour, minute, second)",description:'<p>Returns a time from the given components.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">time(hour: number, minute: number, second: number): time\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">time(23, 59, 0)\n// time("23:59:00")\n</code></pre>\n'},{name:"time(hour, minute, second, offset)",description:'<p>Returns a time from the given components, including a timezone offset.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">time(hour: number, minute: number, second: number, offset: days and time duration): time\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">time(14, 30, 0, duration("PT1H"))\n// time("14:30:00+01:00")\n</code></pre>\n'},{name:"date and time(from)",description:'<p>Parses the given string into a date and time.</p>\n<p>Returns <code>null</code> if the string is not a valid calendar date. For example, <code>"2024-06-31T10:00:00"</code> is invalid because\nJune has only 30 days.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">date and time(from: string): date and time\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">date and time("2018-04-29T09:30:00")\n// date and time("2018-04-29T09:30:00")\n</code></pre>\n'},{name:"date and time(date, time)",description:'<p>Returns a date and time from the given components.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">date and time(date: date, time: time): date and time\n</code></pre>\n<pre><code class="language-feel">date and time(date: date and time, time: time): date and time\n</code></pre>\n<p>Returns a date and time value that consists of the date component of <code>date</code> combined with <code>time</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">date and time(date("2012-12-24"),time("T23:59:00"))\n// date and time("2012-12-24T23:59:00")\n\ndate and time(date and time("2012-12-25T11:00:00"),time("T23:59:00"))\n// date and time("2012-12-25T23:59:00")\n</code></pre>\n'},{name:"date and time(date, timezone)",description:'<p><em>Camunda Extension</em></p>\n<p>Returns the given date and time value at the given timezone.</p>\n<p>If <code>date</code> has a different timezone than <code>timezone</code> then it adjusts the time to match the local time of <code>timezone</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">date and time(date: date and time, timezone: string): date and time\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">date and time(@"2020-07-31T14:27:30@Europe/Berlin", "America/Los_Angeles")\n// date and time("2020-07-31T05:27:30@America/Los_Angeles")\n\ndate and time(@"2020-07-31T14:27:30", "Z")\n// date and time("2020-07-31T12:27:30Z")\n</code></pre>\n'},{name:"duration(from)",description:'<p>Parses the given string into a duration. The duration is either a days and time duration or a years and months duration.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">duration(from: string): days and time duration\n</code></pre>\n<pre><code class="language-feel">duration(from: string): years and months duration\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">duration("P5D")\n// duration("P5D")\n\nduration("P32Y")\n// duration("P32Y")\n</code></pre>\n'},{name:"years and months duration(from, to)",description:'<p>Returns the years and months duration between <code>from</code> and <code>to</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">years and months duration(from: date, to: date): years and months duration\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">years and months duration(date("2011-12-22"), date("2013-08-24"))\n// duration("P1Y8M")\n</code></pre>\n'},{name:"list contains(list, element)",description:'<p>Returns <code>true</code> if the given list contains the element. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">list contains(list: list, element: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">list contains([1,2,3], 2)\n// true\n</code></pre>\n'},{name:"count(list)",description:'<p>Returns the number of elements of the given list.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">count(list: list): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">count([1,2,3])\n// 3\n</code></pre>\n'},{name:"min(list)",description:'<p>Returns the minimum of the given list.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">min(list: list): Any\n</code></pre>\n<p>All elements in <code>list</code> should have the same type and be comparable.</p>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">min([1,2,3])\n// 1\n\nmin(1,2,3)\n// 1\n</code></pre>\n'},{name:"max(list)",description:'<p>Returns the maximum of the given list.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">max(list: list): Any\n</code></pre>\n<p>All elements in <code>list</code> should have the same type and be comparable.</p>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">max([1,2,3])\n// 3\n\nmax(1,2,3)\n// 3\n</code></pre>\n'},{name:"sum(list)",description:'<p>Returns the sum of the given list of numbers.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">sum(list: list<number>): number\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">sum([1,2,3])\n// 6\n\nsum(1,2,3)\n// 6\n</code></pre>\n'},{name:"product(list)",description:'<p>Returns the product of the given list of numbers.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">product(list: list<number>): number\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">product([2, 3, 4])\n// 24\n\nproduct(2, 3, 4)\n// 24\n</code></pre>\n'},{name:"mean(list)",description:'<p>Returns the arithmetic mean (i.e. average) of the given list of numbers.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">mean(list: list<number>): number\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">mean([1,2,3])\n// 2\n\nmean(1,2,3)\n// 2\n</code></pre>\n'},{name:"median(list)",description:'<p>Returns the median element of the given list of numbers.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">median(list: list<number>): number\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">median(8, 2, 5, 3, 4)\n// 4\n\nmedian([6, 1, 2, 3])\n// 2.5\n</code></pre>\n'},{name:"stddev(list)",description:'<p>Returns the standard deviation of the given list of numbers.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">stddev(list: list<number>): number\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">stddev(2, 4, 7, 5)\n// 2.0816659994661326\n\nstddev([2, 4, 7, 5])\n// 2.0816659994661326\n</code></pre>\n'},{name:"mode(list)",description:'<p>Returns the mode of the given list of numbers.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">mode(list: list<number>): number\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">mode(6, 3, 9, 6, 6)\n// [6]\n\nmode([6, 1, 9, 6, 1])\n// [1, 6]\n</code></pre>\n'},{name:"all(list)",description:'<p>Returns <code>false</code> if any element of the given list is <code>false</code>. Otherwise, returns <code>true</code>.</p>\n<p>If the given list is empty, it returns <code>true</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">all(list: list<boolean>): boolean\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">all([true,false])\n// false\n\nall(false,null,true)\n// false\n</code></pre>\n<p>:::info\nThe function <code>all()</code> replaced the previous function <code>and()</code>. The previous function is deprecated and\nshould not be used anymore.\n:::</p>\n'},{name:"any(list)",description:'<p>Returns <code>true</code> if any element of the given list is <code>true</code>. Otherwise, returns <code>false</code>.</p>\n<p>If the given list is empty, it returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">any(list: list<boolean>): boolean\n</code></pre>\n<p>The parameter <code>list</code> can be passed as a list or as a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">any([false,true])\n// true\n\nany(false,null,true)\n// true\n</code></pre>\n<p>:::info\nThe function <code>any()</code> replaced the previous function <code>or()</code>. The previous function is deprecated and\nshould not be used anymore.\n:::</p>\n'},{name:"sublist(list, start position)",description:'<p>Returns a partial list of the given value starting at <code>start position</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">sublist(list: list, start position: number): list\n</code></pre>\n<p>The <code>start position</code> starts at the index <code>1</code>. The last position is <code>-1</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">sublist([1,2,3], 2)\n// [2,3]\n</code></pre>\n'},{name:"sublist(list, start position, length)",description:'<p>Returns a partial list of the given value starting at <code>start position</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">sublist(list: list, start position: number, length: number): list\n</code></pre>\n<p>The <code>start position</code> starts at the index <code>1</code>. The last position is <code>-1</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">sublist([1,2,3], 1, 2)\n// [1,2]\n</code></pre>\n'},{name:"append(list, items)",description:'<p>Returns the given list with all <code>items</code> appended.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">append(list: list, items: Any): list\n</code></pre>\n<p>The parameter <code>items</code> can be a single element or a sequence of elements.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">append([1], 2, 3)\n// [1,2,3]\n</code></pre>\n'},{name:"concatenate(lists)",description:'<p>Returns a list that includes all elements of the given lists.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">concatenate(lists: list): list\n</code></pre>\n<p>The parameter <code>lists</code> is a sequence of lists.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">concatenate([1,2],[3])\n// [1,2,3]\n\nconcatenate([1],[2],[3])\n// [1,2,3]\n</code></pre>\n'},{name:"insert before(list, position, newItem)",description:'<p>Returns the given list with <code>newItem</code> inserted at <code>position</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">insert before(list: list, position: number, newItem: Any): list\n</code></pre>\n<p>The <code>position</code> starts at the index <code>1</code>. The last position is <code>-1</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">insert before([1,3],1,2)\n// [2,1,3]\n</code></pre>\n'},{name:"remove(list, position)",description:'<p>Returns the given list without the element at <code>position</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">remove(list: list, position: number): list\n</code></pre>\n<p>The <code>position</code> starts at the index <code>1</code>. The last position is <code>-1</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">remove([1,2,3], 2)\n// [1,3]\n</code></pre>\n'},{name:"reverse(list)",description:'<p>Returns the given list in revered order.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">reverse(list: list): list\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">reverse([1,2,3])\n// [3,2,1]\n</code></pre>\n'},{name:"index of(list, match)",description:'<p>Returns an ascending list of positions containing <code>match</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">index of(list: list, match: Any): list<number>\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">index of([1,2,3,2],2)\n// [2,4]\n</code></pre>\n'},{name:"union(list)",description:'<p>Returns a list that includes all elements of the given lists without duplicates.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">union(list: list): list\n</code></pre>\n<p>The parameter <code>list</code> is a sequence of lists.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">union([1,2],[2,3])\n// [1,2,3]\n</code></pre>\n'},{name:"distinct values(list)",description:'<p>Returns the given list without duplicates.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">distinct values(list: list): list\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">distinct values([1,2,3,2,1])\n// [1,2,3]\n</code></pre>\n'},{name:"duplicate values(list)",description:'<p><em>Camunda Extension</em></p>\n<p>Returns all duplicate values of the given list.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">duplicate values(list: list): list\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">duplicate values([1,2,3,2,1])\n// [1,2]\n</code></pre>\n'},{name:"flatten(list)",description:'<p>Returns a list that includes all elements of the given list without nested lists.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">flatten(list: list): list\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">flatten([[1,2],[[3]], 4])\n// [1,2,3,4]\n</code></pre>\n'},{name:"sort(list, precedes)",description:'<p>Returns the given list sorted by the <code>precedes</code> function.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">sort(list: list, precedes: function<(Any, Any) -> boolean>): list\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">sort(list: [3,1,4,5,2], precedes: function(x,y) x < y)\n// [1,2,3,4,5]\n</code></pre>\n'},{name:"string join(list)",description:'<p>Joins a list of strings into a single string. This is similar to\nJava's <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/Collectors.html#joining(java.lang.CharSequence,java.lang.CharSequence,java.lang.CharSequence)">joining</a>\nfunction.</p>\n<p>If an item of the list is <code>null</code>, the item is ignored for the result string. If an item is\nneither a string nor <code>null</code>, the function returns <code>null</code> instead of a string.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">string join(list: list<string>): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">string join(["a","b","c"])\n// "abc"\n\nstring join(["a",null,"c"])\n// "ac"\n\nstring join([])\n// ""\n</code></pre>\n'},{name:"string join(list, delimiter)",description:'<p>Joins a list of strings into a single string. This is similar to\nJava's <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/Collectors.html#joining(java.lang.CharSequence,java.lang.CharSequence,java.lang.CharSequence)">joining</a>\nfunction.</p>\n<p>If an item of the list is <code>null</code>, the item is ignored for the result string. If an item is\nneither a string nor <code>null</code>, the function returns <code>null</code> instead of a string.</p>\n<p>The resulting string contains a <code>delimiter</code> between each element.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">string join(list: list<string>, delimiter: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">string join(["a"], "X")\n// "a"\n\nstring join(["a","b","c"], ", ")\n// "a, b, c"\n</code></pre>\n'},{name:"string join(list, delimiter, prefix, suffix)",description:'<p><em>Camunda Extension</em></p>\n<p>Joins a list of strings into a single string. This is similar to\nJava's <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/Collectors.html#joining(java.lang.CharSequence,java.lang.CharSequence,java.lang.CharSequence)">joining</a>\nfunction.</p>\n<p>If an item of the list is <code>null</code>, the item is ignored for the result string. If an item is\nneither a string nor <code>null</code>, the function returns <code>null</code> instead of a string.</p>\n<p>The resulting string starts with <code>prefix</code>, contains a <code>delimiter</code> between each element, and ends\nwith <code>suffix</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">string join(list: list<string>, delimiter: string, prefix: string, suffix: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">string join(["a","b","c"], ", ", "[", "]")\n// "[a, b, c]"\n</code></pre>\n'},{name:"is empty(list)",description:'<p><em>Camunda Extension</em></p>\n<p>Returns <code>true</code> if the given list is empty. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">is empty(list: list): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">is empty([])\n// true\n\nis empty([1,2,3])\n// false\n</code></pre>\n'},{name:"partition(list, size)",description:'<p><em>Camunda Extension</em></p>\n<p>Returns consecutive sublists of a list, each of the same size (the final list may be smaller).</p>\n<p>If <code>size</code> is less than <code>0</code>, it returns <code>null</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">partition(list: list, size: number): list\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">partition([1,2,3,4,5], 2)\n// [[1,2], [3,4], [5]]\n\npartition([], 2)\n// []\n\npartition([1,2], 0)\n// null\n</code></pre>\n'},{name:"decimal(n, scale)",description:'<p>Rounds the given value at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">decimal(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">decimal(1/3, 2)\n// .33\n\ndecimal(1.5, 0)\n// 2\n</code></pre>\n'},{name:"floor(n)",description:'<p>Rounds the given value with rounding mode flooring.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">floor(n: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">floor(1.5)\n// 1\n\nfloor(-1.5)\n// -2\n</code></pre>\n'},{name:"floor(n, scale)",description:'<p>Rounds the given value with rounding mode flooring at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">floor(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">floor(-1.56, 1)\n// -1.6\n</code></pre>\n'},{name:"ceiling(n)",description:'<p>Rounds the given value with rounding mode ceiling.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">ceiling(n: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">ceiling(1.5)\n// 2\n\nceiling(-1.5)\n// -1\n</code></pre>\n'},{name:"ceiling(n, scale)",description:'<p>Rounds the given value with rounding mode ceiling at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">ceiling(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">ceiling(-1.56, 1)\n// -1.5\n</code></pre>\n'},{name:"round up(n, scale)",description:'<p>Rounds the given value with the rounding mode round-up at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">round up(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">round up(5.5)\n// 6\n\nround up(-5.5)\n// -6\n\nround up(1.121, 2)\n// 1.13\n\nround up(-1.126, 2)\n// -1.13\n</code></pre>\n'},{name:"round down(n, scale)",description:'<p>Rounds the given value with the rounding mode round-down at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">round down(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">round down(5.5, 0)\n// 5\n\nround down (-5.5, 0)\n// -5\n\nround down (1.121, 2)\n// 1.12\n\nround down (-1.126, 2)\n// -1.12\n</code></pre>\n'},{name:"round half up(n, scale)",description:'<p>Rounds the given value with the rounding mode round-half-up at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">round half up(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">round half up(5.5, 0)\n// 6\n\nround half up(-5.5, 0)\n// -6\n\nround half up(1.121, 2)\n// 1.12\n\nround half up(-1.126, 2)\n// -1.13\n</code></pre>\n'},{name:"round half down(n, scale)",description:'<p>Rounds the given value with the rounding mode round-half-down at the given scale.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">round half down(n: number, scale: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">round half down (5.5, 0)\n// 5\n\nround half down (-5.5, 0)\n// -5\n\nround half down (1.121, 2)\n// 1.12\n\nround half down (-1.126, 2)\n// -1.13\n</code></pre>\n'},{name:"abs(number)",description:'<p>Returns the absolute value of the given numeric value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">abs(number: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">abs(10)\n// 10\n\nabs(-10)\n// 10\n</code></pre>\n'},{name:"modulo(dividend, divisor)",description:'<p>Returns the remainder of the division of dividend by divisor.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">modulo(dividend: number, divisor: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">modulo(12, 5)\n// 2\n</code></pre>\n'},{name:"sqrt(number)",description:'<p>Returns the square root of the given value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">sqrt(number: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">sqrt(16)\n// 4\n</code></pre>\n'},{name:"log(number)",description:'<p>Returns the natural logarithm (base e) of the given value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">log(number: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">log(10)\n// 2.302585092994046\n</code></pre>\n'},{name:"exp(number)",description:'<p>Returns the Euler’s number e raised to the power of the given number .</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">exp(number: number): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">exp(5)\n// 148.4131591025766\n</code></pre>\n'},{name:"odd(number)",description:'<p>Returns <code>true</code> if the given value is odd. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">odd(number: number): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">odd(5)\n// true\n\nodd(2)\n// false\n</code></pre>\n'},{name:"even(number)",description:'<p>Returns <code>true</code> if the given is even. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">even(number: number): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">even(5)\n// false\n\neven(2)\n// true\n</code></pre>\n'},{name:"random number()",description:'<p><em>Camunda Extension</em></p>\n<p>Returns a random number between <code>0</code> and <code>1</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">random number(): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">random number()\n// 0.9701618132579795\n</code></pre>\n'},{name:"before(point1, point2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">before(point1: Any, point2: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">before(1, 10)\n// true\n\nbefore(10, 1)\n// false\n</code></pre>\n'},{name:"before(range, point)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">before(range: range, point: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">before([1..5], 10)\n// true\n</code></pre>\n'},{name:"before(point, range)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">before(point: Any, range: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">before(1, [2..5])\n// true\n</code></pre>\n'},{name:"before(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">before(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">before([1..5], [6..10])\n// true\n\nbefore([1..5),[5..10])\n// true\n</code></pre>\n'},{name:"after(point1, point2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">after(point1: Any, point2: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">after(10, 1)\n// true\n\nafter(1, 10)\n// false\n</code></pre>\n'},{name:"after(range, point)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">after(range: range, point: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">after([1..5], 10)\n// false\n</code></pre>\n'},{name:"after(point, range)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">after(point: Any, range: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">after(12, [2..5])\n// true\n</code></pre>\n'},{name:"after(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">after(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">after([6..10], [1..5])\n// true\n\nafter([5..10], [1..5))\n// true\n</code></pre>\n'},{name:"meets(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">meets(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">meets([1..5], [5..10])\n// true\n\nmeets([1..3], [4..6])\n// false\n\nmeets([1..3], [3..5])\n// true\n\nmeets([1..5], (5..8])\n// false\n</code></pre>\n'},{name:"met by(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">met by(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">met by([5..10], [1..5])\n// true\n\nmet by([3..4], [1..2])\n// false\n\nmet by([3..5], [1..3])\n// true\n\nmet by((5..8], [1..5))\n// false\n\nmet by([5..10], [1..5))\n// false\n</code></pre>\n'},{name:"overlaps(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">overlaps(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">overlaps([5..10], [1..6])\n// true\n\noverlaps((3..7], [1..4])\n// true\n\noverlaps([1..3], (3..6])\n// false\n\noverlaps((5..8], [1..5))\n// false\n\noverlaps([4..10], [1..5))\n// true\n</code></pre>\n'},{name:"overlaps before(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">overlaps before(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">overlaps before([1..5], [4..10])\n// true\n\noverlaps before([3..4], [1..2])\n// false\n\noverlaps before([1..3], (3..5])\n// false\n\noverlaps before([1..5), (3..8])\n// true\n\noverlaps before([1..5), [5..10])\n// false\n</code></pre>\n'},{name:"overlaps after(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">overlaps after(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">overlaps after([4..10], [1..5])\n// true\n\noverlaps after([3..4], [1..2])\n// false\n\noverlaps after([3..5], [1..3))\n// false\n\noverlaps after((5..8], [1..5))\n// false\n\noverlaps after([4..10], [1..5))\n// true\n</code></pre>\n'},{name:"finishes(point, range)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">finishes(point: Any, range: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">finishes(5, [1..5])\n// true\n\nfinishes(10, [1..7])\n// false\n</code></pre>\n'},{name:"finishes(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">finishes(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">finishes([3..5], [1..5])\n// true\n\nfinishes((1..5], [1..5))\n// false\n\nfinishes([5..10], [1..10))\n// false\n</code></pre>\n'},{name:"finished by(range, point)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">finished by(range: range, point: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">finished by([5..10], 10)\n// true\n\nfinished by([3..4], 2)\n// false\n</code></pre>\n'},{name:"finished by(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">finished by(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">finished by([1..5], [3..5])\n// true\n\nfinished by((5..8], [1..5))\n// false\n\nfinished by([5..10], (1..10))\n// false\n</code></pre>\n'},{name:"includes(range, point)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">includes(range: range, point: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">includes([5..10], 6)\n// true\n\nincludes([3..4], 5)\n// false\n</code></pre>\n'},{name:"includes(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">includes(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">includes([1..10], [4..6])\n// true\n\nincludes((5..8], [1..5))\n// false\n\nincludes([1..10], [1..5))\n// true\n</code></pre>\n'},{name:"during(point, range)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">during(point: Any, range: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">during(5, [1..10])\n// true\n\nduring(12, [1..10])\n// false\n\nduring(1, (1..10])\n// false\n</code></pre>\n'},{name:"during(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">during(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">during([4..6], [1..10))\n// true\n\nduring((1..5], (1..10])\n// true\n</code></pre>\n'},{name:"starts(point, range)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">starts(point: Any, range: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">starts(1, [1..5])\n// true\n\nstarts(1, (1..8])\n// false\n</code></pre>\n'},{name:"starts(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">starts(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">starts((1..5], [1..5])\n// false\n\nstarts([1..10], [1..5])\n// false\n\nstarts((1..5), (1..10))\n// true\n</code></pre>\n'},{name:"started by(range, point)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">started by(range: range, point: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">started by([1..10], 1)\n// true\n\nstarted by((1..10], 1)\n// false\n</code></pre>\n'},{name:"started by(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">started by(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">started by([1..10], [1..5])\n// true\n\nstarted by((1..10], [1..5))\n// false\n\nstarted by([1..10], [1..10))\n// true\n</code></pre>\n'},{name:"coincides(point1, point2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">coincides(point1: Any, point2: Any): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">coincides(5, 5)\n// true\n\ncoincides(3, 4)\n// false\n</code></pre>\n'},{name:"coincides(range1, range2)",description:'<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">coincides(range1: range, range2: range): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">coincides([1..5], [1..5])\n// true\n\ncoincides((1..5], [1..5))\n// false\n\ncoincides([1..5], [2..6])\n// false\n</code></pre>\n'},{name:"substring(string, start position)",description:'<p>Returns a substring of the given value starting at <code>start position</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">substring(string: string, start position: number): string\n</code></pre>\n<p>The <code>start position</code> starts at the index <code>1</code>. The last position is <code>-1</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">substring("foobar", 3)\n// "obar"\n\nsubstring("foobar", -2)\n// "ar"\n</code></pre>\n'},{name:"substring(string, start position, length)",description:'<p>Returns a substring of the given value, starting at <code>start position</code> with the given <code>length</code>. If <code>length</code> is greater than\nthe remaining characters of the value, it returns all characters from <code>start position</code> until the end.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">substring(string: string, start position: number, length: number): string\n</code></pre>\n<p>The <code>start position</code> starts at the index <code>1</code>. The last position is <code>-1</code>.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">substring("foobar", 3, 3)\n// "oba"\n\nsubstring("foobar", -3, 2)\n// "ba"\n\nsubstring("foobar", 3, 10)\n// "obar"\n</code></pre>\n'},{name:"string length(string)",description:'<p>Returns the number of characters in the given value.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">string length(string: string): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">string length("foo")\n// 3\n</code></pre>\n'},{name:"upper case(string)",description:'<p>Returns the given value with all characters are uppercase.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">upper case(string: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">upper case("aBc4")\n// "ABC4"\n</code></pre>\n'},{name:"lower case(string)",description:'<p>Returns the given value with all characters are lowercase.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">lower case(string: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">lower case("aBc4")\n// "abc4"\n</code></pre>\n'},{name:"substring before(string, match)",description:'<p>Returns a substring of the given value that contains all characters before <code>match</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">substring before(string: string, match: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">substring before("foobar", "bar")\n// "foo"\n</code></pre>\n'},{name:"substring after(string, match)",description:'<p>Returns a substring of the given value that contains all characters after <code>match</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">substring after(string: string, match: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">substring after("foobar", "ob")\n// "ar"\n</code></pre>\n'},{name:"contains(string, match)",description:'<p>Returns <code>true</code> if the given value contains the substring <code>match</code>. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">contains(string: string, match: string): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">contains("foobar", "of")\n// false\n</code></pre>\n'},{name:"starts with(string, match)",description:'<p>Returns <code>true</code> if the given value starts with the substring <code>match</code>. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">starts with(string: string, match: string): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">starts with("foobar", "fo")\n// true\n</code></pre>\n'},{name:"ends with(string, match)",description:'<p>Returns <code>true</code> if the given value ends with the substring <code>match</code>. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">ends with(string: string, match: string): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">ends with("foobar", "r")\n// true\n</code></pre>\n'},{name:"matches(input, pattern)",description:'<p>Returns <code>true</code> if the given value matches the <code>pattern</code>. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">matches(input: string, pattern: string): boolean\n</code></pre>\n<p>The <code>pattern</code> is a string that contains a regular expression.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">matches("foobar", "^fo*bar")\n// true\n</code></pre>\n'},{name:"matches(input, pattern, flags)",description:'<p>Returns <code>true</code> if the given value matches the <code>pattern</code>. Otherwise, returns <code>false</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">matches(input: string, pattern: string, flags: string): boolean\n</code></pre>\n<p>The <code>pattern</code> is a string that contains a regular expression.</p>\n<p>The <code>flags</code> can contain one or more of the following characters:</p>\n<ul>\n<li><code>s</code> (dot-all)</li>\n<li><code>m</code> (multi-line)</li>\n<li><code>i</code> (case insensitive)</li>\n<li><code>x</code> (comments)</li>\n</ul>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">matches("FooBar", "foo", "i")\n// true\n</code></pre>\n'},{name:"replace(input, pattern, replacement)",description:'<p>Returns the resulting string after replacing all occurrences of <code>pattern</code> with <code>replacement</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">replace(input: string, pattern: string, replacement: string): string\n</code></pre>\n<p>The <code>pattern</code> is a string that contains a regular expression.</p>\n<p>The <code>replacement</code> can access the match groups by using <code>$</code> and the number of the group, for example,\n<code>$1</code> to access the first group.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">replace("abcd", "(ab)|(a)", "[1=$1][2=$2]")\n// "[1=ab][2=]cd"\n\nreplace("0123456789", "(\\d{3})(\\d{3})(\\d{4})", "($1) $2-$3")\n// "(012) 345-6789"\n</code></pre>\n'},{name:"replace(input, pattern, replacement, flags)",description:'<p>Returns the resulting string after replacing all occurrences of <code>pattern</code> with <code>replacement</code>.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">replace(input: string, pattern: string, replacement: string, flags: string): string\n</code></pre>\n<p>The <code>pattern</code> is a string that contains a regular expression.</p>\n<p>The <code>replacement</code> can access the match groups by using <code>$</code> and the number of the group, for example,\n<code>$1</code> to access the first group.</p>\n<p>The <code>flags</code> can contain one or more of the following characters:</p>\n<ul>\n<li><code>s</code> (dot-all)</li>\n<li><code>m</code> (multi-line)</li>\n<li><code>i</code> (case insensitive)</li>\n<li><code>x</code> (comments)</li>\n</ul>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">replace("How do you feel?", "Feel", "FEEL", "i")\n// "How do you FEEL?"\n</code></pre>\n'},{name:"split(string, delimiter)",description:'<p>Splits the given value into a list of substrings, breaking at each occurrence of the <code>delimiter</code> pattern.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">split(string: string, delimiter: string): list<string>\n</code></pre>\n<p>The <code>delimiter</code> is a string that contains a regular expression.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">split("John Doe", "\\s" )\n// ["John", "Doe"]\n\nsplit("a;b;c;;", ";")\n// ["a", "b", "c", "", ""]\n</code></pre>\n'},{name:"extract(string, pattern)",description:'<p><em>Camunda Extension</em></p>\n<p>Returns all matches of the pattern in the given string. Returns an empty list if the pattern doesn't\nmatch.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">extract(string: string, pattern: string): list<string>\n</code></pre>\n<p>The <code>pattern</code> is a string that contains a regular expression.</p>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">extract("references are 1234, 1256, 1378", "12[0-9]*")\n// ["1234","1256"]\n</code></pre>\n'},{name:"trim(string)",description:'<p><em>Camunda Extension</em></p>\n<p>Returns the given string without leading and trailing spaces.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">trim(string: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">trim(" hello world ")\n// "hello world"\n\ntrim("hello world ")\n// "hello world"\n</code></pre>\n'},{name:"uuid()",description:'<p><em>Camunda Extension</em></p>\n<p>Returns a UUID (Universally Unique Identifier) with 36 characters.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">uuid(): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">uuid()\n// "7793aab1-d761-4d38-916b-b7270e309894"\n</code></pre>\n'},{name:"to base64(value)",description:'<p><em>Camunda Extension</em></p>\n<p>Returns the given string encoded in Base64 format.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">to base64(value: string): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">to base64("FEEL")\n// "RkVFTA=="\n</code></pre>\n'},{name:"is blank(string)",description:'<p><em>Camunda Extension</em></p>\n<p>Returns <code>true</code> if the given string is blank (empty or contains only whitespaces).</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">is blank(string: string): boolean\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">is blank("")\n// true\n\nis blank(" ")\n// true\n\nis blank("hello world")\n// false\n</code></pre>\n'},{name:"now()",description:'<p>Returns the current date and time including the timezone.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">now(): date and time\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">now()\n// date and time("2020-07-31T14:27:30@Europe/Berlin")\n</code></pre>\n'},{name:"today()",description:'<p>Returns the current date.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">today(): date\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">today()\n// date("2020-07-31")\n</code></pre>\n'},{name:"day of week(date)",description:'<p>Returns the day of the week according to the Gregorian calendar. Note that it always returns the English name of the day.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">day of week(date: date): string\n</code></pre>\n<pre><code class="language-feel">day of week(date: date and time): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">day of week(date("2019-09-17"))\n// "Tuesday"\n\nday of week(date and time("2019-09-17T12:00:00"))\n// "Tuesday"\n</code></pre>\n'},{name:"day of year(date)",description:'<p>Returns the Gregorian number of the day within the year.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">day of year(date: date): number\n</code></pre>\n<pre><code class="language-feel">day of year(date: date and time): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">day of year(date("2019-09-17"))\n// 260\n\nday of year(date and time("2019-09-17T12:00:00"))\n// 260\n</code></pre>\n'},{name:"week of year(date)",description:'<p>Returns the Gregorian number of the week within the year, according to ISO 8601.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">week of year(date: date): number\n</code></pre>\n<pre><code class="language-feel">week of year(date: date and time): number\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">week of year(date("2019-09-17"))\n// 38\n\nweek of year(date and time("2019-09-17T12:00:00"))\n// 38\n</code></pre>\n'},{name:"month of year(date)",description:'<p>Returns the month of the year according to the Gregorian calendar. Note that it always returns the English name of the month.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">month of year(date: date): string\n</code></pre>\n<pre><code class="language-feel">month of year(date: date and time): string\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">month of year(date("2019-09-17"))\n// "September"\n\nmonth of year(date and time("2019-09-17T12:00:00"))\n// "September"\n</code></pre>\n'},{name:"abs(n)",description:'<p>Returns the absolute value of a given duration.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">abs(n: days and time duration): days and time duration\n</code></pre>\n<pre><code class="language-feel">abs(n: years and months duration): years and months duration\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">abs(duration("-PT5H"))\n// "duration("PT5H")"\n\nabs(duration("PT5H"))\n// "duration("PT5H")"\n\nabs(duration("-P2M"))\n// duration("P2M")\n</code></pre>\n'},{name:"last day of month(date)",description:'<p><em>Camunda Extension</em></p>\n<p>Takes the month of the given date or date-time value and returns the last day of this month.</p>\n<p><strong>Function signature</strong></p>\n<pre><code class="language-feel">last day of month(date: date): date\n</code></pre>\n<pre><code class="language-feel">last day of month(date: date and time): date\n</code></pre>\n<p><strong>Examples</strong></p>\n<pre><code class="language-feel">last day of month(date("2022-10-01"))\n// date("2022-10-31"))\n\nlast day of month(date and time("2022-10-16T12:00:00"))\n// date("2022-10-31"))\n</code></pre>\n'}].map(F$);const Q$=new x_,H$=new x_;function W$({extensions:e=[],dialect:t="expression",parserDialect:n,container:i,contentAttributes:o={},tooltipContainer:r,onChange:s=(()=>{}),onKeyDown:a=(()=>{}),onLint:l=(()=>{}),placeholder:c="",readOnly:u=!1,value:h="",builtins:d=z$,variables:p=[]}){const f=xE.updateListener.of((e=>{e.docChanged&&s(e.state.doc.toString())})),g=xE.updateListener.of((e=>{const t=e.transactions.flatMap((e=>e.effects)).filter((e=>e.is(GA)));if(!t.length)return;const n=t.flatMap((e=>e.value));l(n)})),m=xE.domEventHandlers({keydown:a});"string"==typeof r&&(r=document.querySelector(r));const v=r?function(e={}){return LE.of(e)}({tooltipSpace:function(){return r.getBoundingClientRect()}}):[],y=[BM(),Q$.of(V$({dialect:t,builtins:d,variables:p,parserDialect:n})),rT(),W_.transactionFilter.of((e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:i}=e.newSelection.main,o=n.lineAt(i);if(i>o.from+VR)return e;let r=n.sliceString(o.from,i);if(!t.some((e=>e.test(r))))return e;let{state:s}=e,a=-1,l=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=MR(s,t.from);if(null==n)continue;let i=/^\s*/.exec(t.text)[0],o=TR(s,n);i!=o&&l.push({from:t.from,to:t.from+i.length,insert:o})}return l.length?[e,{changes:l,sequential:!0}]:e})),[TM,kM],xE.contentAttributes.of(o),f,m,SE.of([...zA]),k$,g,v,H$.of($E(c)),E$,...e];return u&&y.push(xE.editable.of(!1)),this._cmEditor=new xE({state:W_.create({doc:h,extensions:y}),parent:i}),this}W$.prototype.setValue=function(e){this._cmEditor.dispatch({changes:{from:0,to:this._cmEditor.state.doc.length,insert:e}})},W$.prototype.focus=function(e){const t=this._cmEditor;if(t.contentDOM.focus(),t.focus(),"number"==typeof e){const n=t.state.doc.length;t.dispatch({selection:{anchor:e<=n?e:n}})}},W$.prototype.getSelection=function(){return this._cmEditor.state.selection},W$.prototype.setVariables=function(e){const t={builtins:(n=this._cmEditor.state).facet(B$)[0],variables:n.facet(L$)[0],dialect:n.facet(N$)[0],parserDialect:n.facet(q$)[0]};var n;this._cmEditor.dispatch({effects:[Q$.reconfigure(V$({...t,variables:e}))]})},W$.prototype.setPlaceholder=function(e){this._cmEditor.dispatch({effects:H$.reconfigure($E(e))})};let U$=class extends Ds{constructor(e,t){super(e,t),this.node=null,this.editor=null,this.state={value:e.value}}componentDidMount(){this.editor=new W$({contentAttributes:{"aria-label":this.props.label},container:this.node,onChange:this.handleChange,value:this.state.value,variables:this.props.variables||[],extensions:[xE.lineWrapping]}),this.node.addEventListener("mousedown",this.handleMouseEvent),this.node.addEventListener("keydown",this.handleKeyDownCapture,!0),this.node.addEventListener("keydown",this.handleKeyDown),this.props.autoFocus&&this.editor.focus(this.state.value.length)}componentDidUpdate(e){const{value:t}=this.props;e.value!==t&&t!==this.state.value&&this.setState({value:t},(()=>{this.editor.setValue(t)})),function(e,t){return JSON.stringify(e)===JSON.stringify(t)}(e.variables,this.props.variables)||this.editor.setVariables(this.props.variables)}componentWillUnmount(){this.node.removeEventListener("mousedown",this.handleMouseEvent),this.node.removeEventListener("keydown",this.handleKeyDownCapture,!0),this.node.removeEventListener("keydown",this.handleKeyDown)}handleMouseEvent=e=>{e.stopPropagation()};handleKeyDownCapture=e=>{if("Enter"===e.key){if(function(e){return e.querySelector(".cm-tooltip-autocomplete")}(this.node))return void(e.triggeredFromAutocomplete=!0);this.props.ctrlForNewline&&!function(e){return e.metaKey||e.ctrlKey}(e)&&e.preventDefault(),this.props.singleLine&&e.preventDefault()}};handleKeyDown=e=>{["Enter","Escape"].includes(e.key)&&e.triggeredFromAutocomplete&&e.stopPropagation()};handleChange=e=>{const{onInput:t}=this.props;this.setState({value:e}),t&&t(e)};handleBlur=()=>{const{onBlur:e,onChange:t}=this.props;t&&this.state.value!==this.props.value&&t(this.state.value),e&&e()};setNode=e=>{this.node=e};render(){return vr(1,"div",["literal-expression",this.props.className||""].join(" "),null,1,{onClick:this.handleMouseEvent,onFocusIn:this.props.onFocus,onFocusOut:this.handleBlur},null,this.setNode)}};class X$ extends Ds{constructor(e,t){super(e,t),this.translate=t.injector.get("translate"),this.expressionLanguages=t.injector.get("expressionLanguages",!1),this.variableResolver=t.injector.get("variableResolver",!1),this.handleValue=e=>{let t={text:e};this.handleChange(t)},this.handleLabelChange=e=>{var t=e||void 0;this.handleChange({label:t})}}handleChange(e){var{onChange:t}=this.props;"function"==typeof t&&t(e)}getExpressionEditorComponent(){return this.expressionLanguages&&"feel"!==this.expressionLanguages.getDefault("inputCell").value?gx:U$}handleKeyDown=e=>{"Enter"===e.key&&e.stopPropagation()};_getVariables(){return this.variableResolver&&this.variableResolver.getVariables(this.props.element)}render(){const{label:e,text:t}=this.props,n=this.getExpressionEditorComponent(),i=this._getVariables();return vr(1,"div","context-menu-container ref-input-editor input-edit",[vr(1,"div","dms-form-control",yr(2,gx,{label:this.translate("Input label"),className:"dms-input-label",value:e||"",placeholder:this.translate("Input"),singleLine:!0,onInput:this.handleLabelChange}),2),vr(1,"div","dms-form-control",[vr(1,"label","dms-label",this.translate("Expression"),0),yr(2,n,{label:this.translate("Input expression"),placeholder:this.translate("Enter expression"),className:["ref-text","dms-input"].join(" "),onInput:this.handleValue,value:t||"",variables:i})],4)],4,{onKeyDown:this.handleKeyDown})}}class K$ extends Ds{constructor(e,t){super(e,t),this.state={},av(this),this.persistChanges=this.debounceInput(this.persistChanges)}persistChanges=()=>{const{input:e}=this.props.context,{unsaved:t}=this.state;if(!t)return;const{label:n,...i}=t;var o,r={};"label"in t&&(r.label=n),o=i,Object.keys(o).length&&(r.inputExpression=i),this.modeling.updateProperties(e,r),this.setState({unsaved:!1})};handleChange=e=>{this.setState({unsaved:{...this.state.unsaved,...e}},this.persistChanges)};getValue(e){let{input:t}=this.props.context;const{unsaved:n}=this.state;let i=t;return"text"===e&&(i=i.inputExpression),n&&e in n?n[e]:i.get(e)}render(){return yr(2,X$,{label:this.getValue("label"),text:this.getValue("text"),element:this.props.context.input,onChange:this.handleChange})}}K$.$inject=["debounceInput","modeling","injector"];class G$ extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._eventBus=t.injector.get("eventBus")}onClick=e=>{const{col:t}=this.props;this._eventBus.fire("input.edit",{event:e,input:t})};render(){return vr(1,"button","edit-button dmn-icon-edit",null,1,{"aria-label":this._translate("Edit input"),type:"button",onClick:this.onClick})}}class Y${constructor(e,t,n,i){e.onGetComponent("cell",(({cellType:e})=>{if("input-header"===e)return vb})),e.onGetComponent("context-menu",((e={})=>{if("input-edit"===e.contextMenuType)return K$})),e.onGetComponent("cell-inner",((e={})=>{const{cellType:t}=e;if("input-cell"===t)return G$})),n.on("input.edit",(({event:e,input:n})=>{const{target:i}=e,o=Bt(i,"th",!0),{left:r,top:s}=o.getBoundingClientRect();t.open({x:r,y:s,align:"bottom-right"},{contextMenuType:"input-edit",input:n})}))}}Y$.$inject=["components","contextMenu","eventBus","renderer"];class Z$ extends Ds{constructor(e,t){super(e,t),av(this);const{value:n}=e;this.state={value:n,optionsVisible:!1},this._portalEl=null}componentDidMount(){document.addEventListener("mousedown",this.onGlobalClick),document.addEventListener("focusin",this.onFocusChanged),this.keyboard.addListener(this.onKeyboard)}componentWillUnmount(){document.removeEventListener("focusin",this.onFocusChanged),document.removeEventListener("mousedown",this.onGlobalClick),this.keyboard.removeListener(this.onKeyboard),this.removePortalEl()}componentWillReceiveProps(e){const{value:t}=e;this.setState({value:t})}componentWillUpdate(e,t){const{optionsVisible:n}=t;n?this._portalEl||this.addPortalEl():this._portalEl&&this.removePortalEl()}componentDidUpdate(){const{optionsVisible:e}=this.state;if(!e||!this.inputNode)return;const t=this.getOptionsBounds();M(this._portalEl.style,t)}getOptionsBounds(){const e=this.renderer.getContainer(),{top:t,left:n,bottom:i}=e.getBoundingClientRect(),{top:o,left:r,width:s,height:a,bottom:l}=this.inputNode.getBoundingClientRect(),c=o+a-t+e.scrollTop,u={top:`${c}px`,left:`${r-n+e.scrollLeft}px`,width:`${s}px`,"max-height":`calc(100% - ${c}px)`};if(i-l<a){const e=i-o;u.bottom=`${e}px`,u["max-height"]=`calc(100% - ${e})`,delete u.top}return u}addPortalEl(){this._portalEl=Gt('<div class="dms-select-options"></div>');this.renderer.getContainer().appendChild(this._portalEl),this._portalEl.addEventListener("mousedown",J$)}removePortalEl(){this._portalEl&&(this._portalEl.removeEventListener("mousedown",J$),en(this._portalEl),this._portalEl=null)}onChange=e=>{this.setState({value:e});const{onChange:t}=this.props;"function"==typeof t&&t(e)};onInputClick=e=>{e.preventDefault(),e.stopPropagation(),this.setOptionsVisible(!this.state.optionsVisible),this.focusInput()};onInput=e=>{const{value:t}=e.target;this.onChange(t)};onOptionClick=(e,t)=>{t.preventDefault(),t.stopPropagation(),this.setOptionsVisible(!1),this.onChange(e),this.focusInput()};focusInput(){const e=this.inputNode;e.focus(),"selectionStart"in e&&(e.selectionStart=1e5)}checkClose(e){!this._portalEl||this._portalEl.contains(e)||this.parentNode.contains(e)||this.setOptionsVisible(!1)}onFocusChanged=e=>{this.checkClose(e.target)};onGlobalClick=e=>{this.checkClose(e.target)};select(e){const{options:t}=this.props,{value:n}=this.state;if(!t)return;const i=t.filter((e=>e.value===n))[0],o=i?t.indexOf(i):-1,r=-1===o?1===e?0:t.length-1:(o+e)%t.length,s=t[r<0?t.length+r:r];this.onChange(s.value)}setOptionsVisible(e){this.setState({optionsVisible:e})}onKeyDown=e=>{const{optionsVisible:t}=this.state;var n=e.which;40!==n&&38!==n||(e.stopPropagation(),e.preventDefault(),t?this.select(40===n?1:-1):this.setOptionsVisible(!0)),t&&(13!==n&&27!==n||(e.stopPropagation(),e.preventDefault(),this.setOptionsVisible(!1)))};onKeyboard=e=>{const{optionsVisible:t}=this.state;if(t)return 27===e?(this.setOptionsVisible(!1),!0):void 0};renderOptions(e,t){return vr(1,"div","options",e.map((e=>vr(1,"div",["option",t===e?"active":""].join(" "),e.label,0,{"data-value":e.value,onClick:t=>this.onOptionClick(e.value,t)}))),0)}render(){const{className:e,label:t,id:n,options:i,noInput:o,title:r}=this.props,{optionsVisible:s,value:a}=this.state,l=!!i&&i.filter((e=>e.value===a))[0],c=l?l.label:a;return vr(1,"div",[e||"","dms-input-select"].join(" "),[o?vr(1,"div","dms-input",c,0,{"aria-label":t,tabIndex:"0",onKeyDown:this.onKeyDown},null,(e=>this.inputNode=e)):vr(64,"input","dms-input",null,1,{"aria-label":t,onInput:this.onInput,onKeyDown:this.onKeyDown,spellCheck:"false",type:"text",value:a,id:n},null,(e=>this.inputNode=e)),vr(1,"span",["dms-input-select-icon",s?"dmn-icon-up":"dmn-icon-down"].join(" ")),s&&(u=this.renderOptions(i,l),h=this._portalEl,vr(1024,h,null,u,0,null,nr(u)?null:u.key,null))],0,{title:r,onClick:this.onInputClick},null,(e=>this.parentNode=e));var u,h}}function J$(e){e.stopPropagation()}Z$.$inject=["keyboard","renderer"];class ej extends Ds{constructor(e,t){super(e),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling"),this._dataTypes=t.injector.get("dataTypes")}onTypeChange=e=>{const t=this.getElement(),n=hn(t,"dmn:LiteralExpression")?t.$parent:t;let i;dn(n)?i={inputExpression:{typeRef:e}}:pn(n)&&(i={typeRef:e}),this._modeling.updateProperties(n,i)};getElement(){return this.props.context.input||this.props.context.output}render(){const e=this.getElement(),t=(hn(e,"dmn:InputClause")?e.inputExpression:e).typeRef,n=this._dataTypes.getAll().map((e=>({label:this._translate(e),value:e}))),i=this._translate("Type");return vr(1,"div","type-ref-edit context-menu-container",vr(1,"div","dms-form-control",[vr(1,"label","dms-label",[i,xr(":")],0),yr(2,Z$,{className:"type-ref-edit-select",label:i,onChange:this.onTypeChange,options:n,value:t})],4),2)}}class tj{constructor(e){e.onGetComponent("context-menu",750,((e={})=>{const{contextMenuType:t}=e;if("input-edit"===t||"output-edit"===t)return ej}))}}tj.$inject=["components"];var nj={__depends__:[Ux,ob],__init__:["typeRefEditingProvider"],typeRefEditingProvider:["type",tj]};class ij extends Gd{constructor(e,t){super(e),this.postExecuted("element.updateProperties",(e=>{const{element:n,properties:i}=e.context,o=dn(n)?i.inputExpression:i;if(o&&o.typeRef&&"string"!==o.typeRef){const e=hn(n,"dmn:LiteralExpression")?n.$parent:n;t.editAllowedValues(e,null)}}))}}ij.$inject=["eventBus","modeling"];class oj extends Ds{constructor(e,t){super(e,t);const{items:n}=e;this.state={items:n}}componentWillReceiveProps(e){const{items:t}=e;this.setState({items:t})}getRemoveClickHandler=e=>t=>{t.stopPropagation(),this.removeItem(e)};getToggleClickHandler=e=>t=>{t.stopPropagation(),this.toggleItem(e)};removeItem=e=>{const{onChange:t}=this.props,n=this.state.items.filter((t=>t!==e));this.setState({items:n}),t&&t(n)};toggleItem=e=>{const{onChange:t,type:n}=this.props,i=this.state.items.map((t=>(t===e?t.isChecked=!t.isChecked:"radio"===n&&(t.isChecked=!1),t)));this.setState({items:i}),t&&t(i)};render(){const{className:e,items:t,type:n,labelComponent:i}=this.props,o=["dms-list-component"];e&&o.push(e);const r=function(e){const t=[];for(let n in e)t.push([n,e[n]]);return t}(b(t,"group"));return vr(1,"div",o.join(" "),r.map((e=>{const t=e[0],o=e[1];return vr(1,"div","group",[i&&i(t)||vr(1,"h4","dms-heading",t,0),vr(1,"ul","items no-wrap",o.map((e=>vr(1,"li","item",[n&&vr(64,"input","item-toggle",null,1,{type:n,checked:e.isChecked,onClick:this.getToggleClickHandler(e)}),xr(" "),e.value,e.isRemovable&&vr(1,"span","remove dmn-icon-clear",null,1,{title:"Remove item",onClick:this.getRemoveClickHandler(e)})],0))),0)],0)})),0)}}class rj extends Ds{constructor(e,t){super(e,t);const{validate:n,value:i}=e,o=n?n(i||""):void 0;this.state={validationWarning:o,value:i},this.onInput=this.onInput.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this)}componentWillReceiveProps(e){const{validate:t,value:n}=e,i=t?t(n||""):void 0;this.setState({validationWarning:i,value:n})}onInput(e){const{onInput:t,validate:n}=this.props,i=n?n(e):void 0;this.setState({validationWarning:i,value:e}),"function"==typeof t&&t&&t({isValid:!i,value:e})}onKeyDown(e){const{target:t}=e,{value:n}=t,{onKeyDown:i,validate:o}=this.props,r=o?o(n):void 0;"function"==typeof i&&i({isValid:!r,value:n,event:e})}onKeyUp(e){const{target:t}=e,{value:n}=t,{onKeyUp:i,validate:o}=this.props,r=o?o(n):void 0;"function"==typeof i&&i({isValid:!r,value:n,event:e})}render(){const{placeholder:e,type:t,className:n,label:i}=this.props,{validationWarning:o,value:r}=this.state,s=["dms-validated-input",n].join(" "),a=[];return o&&a.push("invalid"),vr(1,"div",s,[yr(2,hb,{className:a,label:i,onInput:this.onInput,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,placeholder:e||"",type:t,value:r||""}),o&&vr(1,"p","dms-hint dms-validation-warning",o,0)],0)}}function sj(e){if(!e||function(e){return""===e}(e.trim()))return{values:[]};let t=e.split(",");const n={values:[]};let i="";return t.forEach((e=>{i+=e,/^"[^"]*"$/.test(i.trim())?(n.values.push(i.trim()),i=""):i+=","})),i?void 0:n}let aj=class extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling"),this._changeSupport=t.changeSupport;const n=this.getAllowedValuesTarget(),i=sj(n.inputValues&&n.inputValues.text||n.outputValues&&n.outputValues.text||"");this.state=i?{values:i.values.map((e=>({value:e,isCheckable:!1,isRemovable:!0,group:this._translate("Predefined values")}))),inputValue:""}:{values:null,inputValue:""}}onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){const e=this.getAllowedValuesTarget();this._changeSupport.onElementsChanged(e.id,this.onElementsChanged)}componentWillUnmount(){const e=this.getAllowedValuesTarget();this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}setPredefinedValues=e=>{const t=this.getAllowedValuesTarget();this.setState({values:e}),this._modeling.editAllowedValues(t,e&&function(e){return e.map((e=>e.value))}(e))};onListChange=e=>{this.setPredefinedValues(e)};getAllowedValuesTarget(){const e=this.getElement();return hn(e,"dmn:LiteralExpression")?e.$parent:e}onInput=({isValid:e,value:t})=>{this.setState({inputValue:t})};onKeyDown=({isValid:e,event:t})=>{if(13===t.keyCode&&(t.stopPropagation(),t.preventDefault(),e)){const{inputValue:e,values:t}=this.state,n=sj(e);this.onListChange((t||[]).concat(n.values.map((e=>({value:e,isCheckable:!1,isRemovable:!0,group:this._translate("Predefined values")}))))),this.setState({inputValue:""})}};handleRemovePredifinedValuesClick=e=>{e.stopPropagation(),this.removePredefinedValues()};removePredefinedValues=()=>{this.setPredefinedValues(null)};getElement(){return this.props.context.output||this.props.context.input.inputExpression}render(){const e=this.getElement(),{inputValue:t,values:n}=this.state;return"string"===e.typeRef?vr(1,"div","context-menu-container allowed-values-edit",vr(1,"div","dms-form-control",[!cj(n)&&n.length>0&&yr(2,oj,{labelComponent:lj,items:n,onChange:this.onListChange}),!cj(n)&&!n.length&&vr(1,"div",null,[vr(1,"label","dms-label",this._translate("Predefined values"),0),vr(1,"span","placeholder",this._translate("No values"),0)],4),!cj(n)&&vr(1,"p","dms-hint",vr(1,"button","del-values",this._translate("Clear predefined values"),0,{type:"button",onClick:this.handleRemovePredifinedValuesClick}),2),vr(1,"label","dms-label",this._translate("Add predefined values"),0),yr(2,rj,{onInput:this.onInput,onKeyDown:this.onKeyDown,placeholder:this._translate('"value", "value", ...'),type:"text",validate:e=>{if(!sj(e))return this._translate("Strings must be in double quotes")},value:t})],0),2):null}};function lj(e){return vr(1,"label","dms-label",e,0)}function cj(e){return null===e}class uj{constructor(e){e.onGetComponent("context-menu",500,((e={})=>{const{contextMenuType:t}=e;if("input-edit"===t||"output-edit"===t)return aj}))}}uj.$inject=["components"];var hj={__init__:["allowedValuesUpdateBehavior","allowedValuesEditingProvider"],allowedValuesUpdateBehavior:["type",ij],allowedValuesEditingProvider:["type",uj]};class dj extends Ds{constructor(e,t){super(e,t),this._sheet=t.injector.get("sheet"),this._eventBus=t.injector.get("eventBus"),this._changeSupport=t.changeSupport,this._translate=t.injector.get("translate")}onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){const e=this.getRoot();this._changeSupport.onElementsChanged(e.id,this.onElementsChanged)}componentWillUnmount(){const e=this.getRoot();this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}getRoot(){return this._sheet.getRoot()}handleClick=e=>{e.stopPropagation(),this.add()};add=()=>{this._eventBus.fire("addInput")};render(){return vr(1,"div","add-input actionable",vr(1,"button","dmn-icon-plus action-icon",null,1,{title:this._translate("Add input")}),2,{onClick:this.handleClick})}}class pj extends Ds{constructor(e,t){super(e,t),this._sheet=t.injector.get("sheet"),this._eventBus=t.injector.get("eventBus"),this._changeSupport=t.changeSupport,this._translate=t.injector.get("translate")}onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){const e=this.getRoot();this._changeSupport.onElementsChanged(e.id,this.onElementsChanged)}componentWillUnmount(){const e=this.getRoot();this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}getRoot(){return this._sheet.getRoot()}handleClick=e=>{e.stopPropagation(),this.add()};add=()=>{this._eventBus.fire("addOutput")};render(){return vr(1,"div","add-output actionable",vr(1,"button","dmn-icon-plus action-icon",null,1,{title:this._translate("Add output")}),2,{onClick:this.handleClick})}}function fj(e,t,n){e.onGetComponent("cell-inner",((e={})=>{const{cellType:t,index:n,inputsLength:i,outputsLength:o}=e;return"input-cell"===t&&n===i-1?dj:"output-cell"===t&&n===o-1?pj:void 0})),n.on("addInput",(()=>{t.trigger("addInput")})),n.on("addOutput",(()=>{t.trigger("addOutput")}))}fj.$inject=["components","editorActions","eventBus"];var gj={__depends__:[ax],__init__:["addInputOutputProvider"],addInputOutputProvider:["type",fj]},mj="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/pull/662";let vj=class{constructor(e,t,n,i,o){this._config=e||{},this._editorActions=n,this._eventBus=t,this._cellSelection=i,this._listeners=[],t.on("table.destroy",this._destroy),t.on("table.init",this._init),t.on("attach",(()=>{this._config.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(mj)),this._target=o.getContainer(),this._config&&!1!==this._config.bind&&this.bind()})),t.on("detach",this.unbind)}_init=()=>{this._registerDefaultBindings(),this._fire("init")};_destroy=()=>{this._fire("destroy"),this.unbind(),this._listeners=null};_keyHandler=e=>{var t,n,i=this._listeners,o=e.keyCode||e.charCode||-1;for(t=0;n=i[t];t++)if(n(o,e))return e.preventDefault(),void e.stopPropagation()};bind(e){e&&console.error("unsupported argument <node>",new Error(mj)),this.unbind(),e=this._node=this._target,zt.bind(e,"keydown",this._keyHandler),this._fire("bind")}getBinding(){return this._node}unbind=()=>{var e=this._node;e&&(this._fire("unbind"),zt.unbind(e,"keydown",this._keyHandler)),this._node=null};_fire(e){this._eventBus.fire("keyboard."+e,{node:this._node,listeners:this._listeners})}_registerDefaultBindings(){var e=this._listeners,t=this._editorActions,n=this._cellSelection;e.push((function(e,n){if(Xx(n)&&!Kx(n)&&90===e)return t.trigger("undo"),!0})),e.push((function(e,n){if(Xx(n)&&(89===e||90===e&&Kx(n)))return t.trigger("redo"),!0})),e.push((function(e,n){if(13===e&&!Xx(n)&&Kx(n)&&Ay(n.target))return t.trigger("selectCellAbove"),!0})),e.push((function(e,i){if(13!==e||Xx(i)||Kx(i))return;if(!Ay(i.target))return;const o=t.trigger("selectCellBelow"),r=n.getCellSelection();if(!o&&r&&"__decisionProperties_name"!==r){const e=t.trigger("addRule");return t.trigger("selectCellBelow"),e}return!0}))}addListener(e){this._listeners.unshift(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}};vj.$inject=["config.keyboard","eventBus","editorActions","cellSelection","renderer"];var yj={__depends__:[ax],__init__:["keyboard"],keyboard:["type",vj]},xj={__depends__:[gj,hj,Ux,wx,jv,yj,nj],__init__:["inputEditingProvider","outputEditingProvider"],inputEditingProvider:["type",Y$],outputEditingProvider:["type",mb]};function bj(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let _j=class{constructor(e,t,n,i){bj(this,"handleDragOver",(e=>{wj(e);const t=Bt(e.target,".dmn-decision-table-container td,\n .dmn-decision-table-container th",!0);let n=!!t;const{hoverEl:i}=this._dragContext;i&&i!==t&&(this._emit("dragAndDrop.dragLeave",e),this._dragContext.targetEl=null,this._dragContext.hoverEl=null),t&&(t!==i&&(this._dragContext.hoverEl=t,n=this._emit("dragAndDrop.dragEnter",e),!1!==n&&(this._dragContext.targetEl=t)),n=this._emit("dragAndDrop.dragOver",e)),e.dataTransfer.dropEffect=!1!==n?"move":"none"})),bj(this,"handleDrop",(e=>{wj(e);const t=this._emit("dragAndDrop.drop",e);if(t){const{draggedElement:e}=this._dragContext;if(e instanceof Nm){const{rows:n}=this._sheet.getRoot();let i=n.indexOf(t);this._modeling.moveRow(e,i)}else if(e instanceof qm){const{cols:n}=this._sheet.getRoot();let i=n.indexOf(t);this._modeling.moveCol(e,i)}}this.handleDragEnd(e)})),bj(this,"handleDragEnd",(e=>{wj(e),this._unbindListeners(),this._emit("dragAndDrop.dragEnd",e),this._dragContext=null})),this._eventBus=e,this._renderer=t,this._modeling=n,this._sheet=i,this._dragContext=null,e.on("table.destroy",(()=>{this._unbindListeners()}))}_bindListeners(){zt.bind(document,"dragover",this.handleDragOver),zt.bind(document,"drop",this.handleDrop),zt.bind(document,"dragend",this.handleDragEnd)}_unbindListeners(){zt.unbind(document,"dragover",this.handleDragOver),zt.unbind(document,"drop",this.handleDrop),zt.unbind(document,"dragend",this.handleDragEnd)}_emit(e,t){return this._eventBus.fire(e,{dragContext:this._dragContext,originalEvent:t})}startDrag(e,t){wj(t,!0),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData&&t.dataTransfer.setData("text","__DUMMY"),this._dragContext={draggedElement:e},this._bindListeners(),this._emit("dragAndDrop.dragStart",t)}};function wj(e,t){e.stopPropagation(),!0!==t&&e.preventDefault()}_j.$inject=["eventBus","renderer","modeling","sheet"];var Cj={__init__:["dragAndDrop"],dragAndDrop:["type",_j]};const Oj="top",kj="left";class Ej{constructor(e,t,n,i,o,r,s,a){this._elementRegistry=t,this._dragAndDrop=i,this._renderer=o,this._rules=r,this._sheet=s,this._translate=a,e.onGetComponent("cell-inner",(({cellType:e,col:t,row:n})=>{if("rule-index"===e)return()=>vr(1,"span","dmn-icon-drag vertical",xr(" "),2,{draggable:"true",onDragStart:e=>this.startDrag(n,e),title:this._translate("Move rule")});if("input-cell"===e||"output-cell"===e){let e="Move "+(dn(t)?"Input":"Output");return()=>vr(1,"span","dmn-icon-drag horizontal",null,1,{draggable:"true",onDragStart:e=>this.startDrag(t,e),title:e})}})),n.on("dragAndDrop.dragEnter",(e=>{const{dragContext:t}=e,{draggedElement:n,hoverEl:i}=t;if(n instanceof Nm)return!0;if(n instanceof qm){const e=function(e,t,n){const i=t.get(e.dataset.colId);if(!i)return-1;const{cols:o}=n.getRoot();return o.indexOf(i)}(i,this._elementRegistry,this._sheet);if(-1===e)return!1;return this._rules.allowed("col.move",{col:n,index:e})}return!1})),n.on("dragAndDrop.dragLeave",(e=>{const{dragContext:t}=e,{targetEl:n}=t;if(!n)return;Tj(this._renderer.getContainer())})),n.on("dragAndDrop.dragOver",(e=>{const{dragContext:t,originalEvent:n}=e,{draggedElement:i,lastPosition:o,targetEl:r}=t,s=this._renderer.getContainer();if(!r)return!1;let a;return i instanceof Nm&&(a=Aj(n,r)),i instanceof qm&&(a=Mj(n,r)),o===a||(Tj(s),i instanceof Nm&&Sj(r,s,a===Oj?"top":"bottom"),i instanceof qm&&Rj(r,s,a===kj?"left":"right"),t.lastPosition=a),!0})),n.on("dragAndDrop.drop",(e=>{const{dragContext:t,originalEvent:n}=e,{draggedElement:i,targetEl:o}=t;if(!o)return!1;if(i instanceof Nm){const e=Aj(n,o),t=o.dataset.rowId,r=this._elementRegistry.get(t);if(!r||r===i)return;const s=function(e,t,n,i){i.indexOf(e)>i.indexOf(t)&&(t=function(e,t){const n=t.indexOf(e);return t[Math.min(t.length-1,n+1)]}(t,i));return n===Oj?function(e,t){const n=t.indexOf(e);return t[Math.max(0,n-1)]}(t,i):t}(i,r,e,this._sheet.getRoot().rows);if(s===i)return;return s}if(i instanceof qm){const e=Mj(n,o),t=o.dataset.colId,r=this._elementRegistry.get(t);if(!r||r===i)return;const s=function(e,t,n,i){i.indexOf(e)>i.indexOf(t)&&(t=function(e,t){const n=t.indexOf(e);if(dn(e)){const e=t.filter((e=>dn(e))),i=e[e.length-1],o=t.indexOf(i);return t[Math.min(o,n+1)]}return t[Math.min(t.length-1,n+1)]}(t,i));return n===kj?function(e,t){const n=t.indexOf(e);if(pn(e)){const e=t.filter((e=>pn(e)))[0],i=t.indexOf(e);return t[Math.max(i,n-1)]}return t[Math.max(0,n-1)]}(t,i):t}(i,r,e,this._sheet.getRoot().cols);if(s===i)return;return s}})),n.on("dragAndDrop.dragEnd",this._cleanup)}startDrag(e,t){const n=this._renderer.getContainer();this._dragImage=Gt('<span style="\n visibility: hidden;\n position: fixed;\n top: -10000px\n "></span>'),document.body.appendChild(this._dragImage),t.dataTransfer.setDragImage&&t.dataTransfer.setDragImage(this._dragImage,0,0),e instanceof Nm?function(e,t){const n=Jt(`[data-row-id=${e.id}]`,t);p(n,(e=>{Pj(e)&&$t(e).add("dragged")}))}(e,n):e instanceof qm&&function(e,t){const n=Jt(`[data-col-id=${e.id}]`,t);p(n,(e=>{Pj(e)&&$t(e).add("dragged")}))}(e,n),this._dragAndDrop.startDrag(e,t)}_cleanup=()=>{const e=this._renderer.getContainer();Tj(e),function(e){const t=Jt(".dragged",e);p(t,(e=>{Pj(e)&&$t(e).remove("dragged")}))}(e),this._dragImage&&(en(this._dragImage),this._dragImage=null)}}function Sj(e,t,n){const i=e.dataset.rowId;if(!i)return;p(Jt(`[data-row-id=${i}]`,t),(e=>{Pj(e)&&($t(e).add("dragover"),$t(e).add(n))}))}function Rj(e,t,n){const i=e.dataset.colId;if(!i)return;p(Jt(`[data-col-id=${i}]`,t),(e=>{Pj(e)&&($t(e).add("dragover"),$t(e).add(n))}))}function Tj(e){p(Jt(".dragover",e),(e=>{Pj(e)&&($t(e).remove("dragover"),$t(e).remove("top"),$t(e).remove("right"),$t(e).remove("bottom"),$t(e).remove("left"))}))}function Mj(e,t){const n=t.getBoundingClientRect();return e.clientX<n.left+n.width/2?kj:"right"}function Aj(e,t){const n=t.getBoundingClientRect();return e.clientY<n.top+n.height/2?Oj:"bottom"}function Pj(e){return e&&(1===e.nodeType||11==e.nodeType)}Ej.$inject=["components","elementRegistry","eventBus","dragAndDrop","renderer","rules","sheet","translate"];var Dj={__depends__:[Cj,qy],__init__:["dmnDragAndDrop"],dmnDragAndDrop:["type",Ej]};class $j extends Ds{constructor(e,t){super(e,t),this._elementRegistry=t.injector.get("elementRegistry"),this._modeling=t.injector.get("modeling"),this._changeSupport=this.context.changeSupport;const{id:n}=this.props.context;this._element=this._elementRegistry.get(n)}onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){this._element&&this._changeSupport.onElementsChanged(this._element.id,this.onElementsChanged)}componentDidMount(){const{autoFocus:e}=this.props.context;if(e&&this.node){Zt(".content-editable",this.node).focus()}}componentWillUnmount(){if(this._element){this._changeSupport.offElementsChanged(this._element.id,this.onElementsChanged);const{businessObject:e}=this._element,{description:t}=e;c(t)&&!t.length&&this.changeDescription(null)}}changeDescription=e=>{this._modeling.updateProperties(this._element,{description:e})};render(){if(!this._element)return;const{businessObject:e}=this._element,{description:t}=e;return c(t)?vr(1,"div","context-menu-container description-editor",yr(2,jj,{className:"dms-input",onChange:this.changeDescription,value:t}),2,null,null,(e=>this.node=e)):void 0}}let jj=class extends vx{render(){return vr(1,"div",this.getClassName(),this.getEditor(),0)}};class Ij{constructor(e,t,n,i,o,r,s){this._contextMenu=t,this._modeling=o,this._renderer=r,this._translate=s,i.on("cell.click",750,(e=>{if(e.defaultPrevented)return;const{target:i,id:o}=e,s=n.get(o);if(!gn(s,["dmn:UnaryTests","dmn:LiteralExpression"]))return;Lj(s)||e.preventDefault();const a=Bj(r.getContainer(),i.getBoundingClientRect());t.open(a,{contextMenuType:"cell-description",autoFocus:!1,id:o,offset:{x:4,y:4}})})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"cell-description"===e.contextMenuType){if(c(Lj(n.get(e.id))))return $j}})),e.onGetComponent("context-menu-cell-additional",500,((e={})=>{if(e.contextMenuType&&"context-menu"===e.contextMenuType){const{id:t}=e;if(!t)return;const i=n.get(t);if(!i)return;const{businessObject:o}=i,{description:r}=o,s=c(r),a=s?()=>this.removeDescription(i):()=>this.addDescription(i);return vr(1,"div",`context-menu-group-entry ${s?"remove-description":"add-description"}`,c(r)?this._translate("Remove cell description"):this._translate("Add cell description"),0,{onClick:a})}}))}addDescription=e=>{this._modeling.updateProperties(e,{description:""});const t=this._renderer.getContainer(),n=Bj(t,My(e.id,t).getBoundingClientRect());this._contextMenu.open(n,{contextMenuType:"cell-description",id:e.id,autoFocus:!0,offset:{x:4,y:4}})};removeDescription=e=>{this._modeling.updateProperties(e,{description:null}),this._contextMenu.close()}}function Bj(e,t){const{top:n,left:i,width:o,height:r}=t;return{x:i+e.parentNode.scrollLeft-26,y:n+e.parentNode.scrollTop,width:o+52,height:r}}function Lj(e){return e&&e.businessObject&&e.businessObject.description}Ij.$inject=["components","contextMenu","elementRegistry","eventBus","modeling","renderer","translate"];var Nj={__depends__:[Ux,ry],__init__:["description"],description:["type",Ij]};let qj=class{constructor(e,t,n,i,o,r){this._modeling=n,this._translate=o,this._expressionLanguages=i,e.onGetComponent("context-menu-cell-additional",((e={})=>{if(e.contextMenuType&&"context-menu"===e.contextMenuType){const{event:n,id:i}=e;if(!i)return;const o=t.get(i);if(!o)return;if(!this._shouldDisplayContextMenuEntry(o))return;const s=e=>{r.open({x:(n||e).pageX,y:(n||e).pageY},{contextMenuType:"expression-language",id:i})};return vr(1,"div","context-menu-group-entry",this._translate("Change cell expression language"),0,{onClick:s})}})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"expression-language"===e.contextMenuType){const{id:n}=e;if(!n)return;const o=t.get(n);if(!o)return;const r=this._getElementExpressionLanguage(o),s=i.getAll(),a="context-menu-group-entry context-menu-entry-set-expression-language",l=this._translate("Expression language");return()=>vr(1,"div","context-menu-flex",vr(1,"div","context-menu-group",vr(1,"div",a,[vr(1,"div",null,l,0),yr(2,Z$,{label:l,className:"expression-language",onChange:e=>this.onChange(o,e),options:s,value:r})],4),2),2)}})),e.onGetComponent("context-menu",((e={})=>{if("input-edit"===e.contextMenuType)return()=>{const{inputExpression:t}=e.input;if(!this._shouldDisplayContextMenuEntry(t))return;const n=this._getElementExpressionLanguage(t),o=i.getAll(),r=this._translate("Expression language");return vr(1,"div","context-menu-container ref-language",vr(1,"div","dms-form-control",[vr(1,"label","dms-label",r,0),yr(2,Z$,{label:r,className:"ref-language",value:n||"",onChange:e=>this.onChange(t,e),options:o})],4),2)}}))}onChange(e,t){this._modeling.editExpressionLanguage(e,t)}_shouldDisplayContextMenuEntry(e){if(this._expressionLanguages.getAll().length>1)return!0;return this._getElementExpressionLanguage(e)!==this._getDefaultElementExpressionLanguage(e)}_getElementExpressionLanguage(e){return fn(e).expressionLanguage||this._getDefaultElementExpressionLanguage(e)}_getDefaultElementExpressionLanguage(e){return this._expressionLanguages.getDefault(dn(e.col)?"inputCell":"outputCell").value}};qj.$inject=["components","elementRegistry","modeling","expressionLanguages","translate","contextMenu"];var Vj={__depends__:[jv],__init__:["expressionLanguage"],expressionLanguage:["type",qj]};class Fj extends Ds{constructor(e,t){super(e,t),av(this)}componentWillMount(){this.setupChangeListeners({bind:this.getBusinessObject().id})}componentWillUnmount(){this.setupChangeListeners({unbind:this.getBusinessObject().id})}setupChangeListeners({bind:e,unbind:t}){"string"==typeof t&&this.changeSupport.offElementsChanged(t,this.onElementsChanged),"string"==typeof e&&this.changeSupport.onElementsChanged(e,this.onElementsChanged)}getBusinessObject(){return this.sheet.getRoot().businessObject.$parent}onElementsChanged=()=>{this.forceUpdate()};setDecisionTableName=e=>{this.modeling.editDecisionTableName(e)};render(){const e=this.getBusinessObject(),{name:t}=e,n=this.components.getComponent("hit-policy")||Qj;return vr(1,"div","decision-table-properties",[yr(2,zj,{label:this.translate("Decision name"),className:"decision-table-name",value:t,ctrlForNewline:!0,onBlur:Hj,onChange:this.setDecisionTableName,elementId:"__decisionProperties_name",coords:"0:__decisionProperties"}),vr(1,"div","decision-table-header-separator"),yr(2,n)],4)}}Fj.$inject=["sheet","modeling","changeSupport","components","translate"];class zj extends vx{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),cv(this,uv)}render(){const e=this.props.value;return vr(1,"div",sv(this.getSelectionClasses(),this.getClassName()),this.getEditor(),0,{"data-element-id":this.props.elementId,"data-coords":this.props.coords,title:this._translate("Decision name: ")+e})}}function Qj(){return null}function Hj(e){e.target.scroll(0,0)}class Wj{constructor(e){e.onGetComponent("table.before",500,(()=>Fj))}}Wj.$inject=["components"];var Uj={__depends__:[wx],__init__:["decisionTableProperties"],decisionTableProperties:["type",Wj]};class Xj extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),av(this)}onChange=({aggregation:e,hitPolicy:t})=>{this.modeling.editHitPolicy(t,e)};onElementsChanged=()=>{this.forceUpdate()};componentDidMount(){this.changeSupport.onElementsChanged(this.getRoot().id,this.onElementsChanged)}componentWillUnmount(){this.changeSupport.offElementsChanged(this.getRoot().id,this.onElementsChanged)}getRoot(){return this.sheet.getRoot()}render(){const e=this.getRoot().businessObject,{aggregation:t,hitPolicy:n}=e,i=h(Vv,(e=>function(e,t){return e.hitPolicy===t.hitPolicy&&e.aggregation===t.aggregation}(e.value,{aggregation:t,hitPolicy:n})));return vr(1,"div","hit-policy",[vr(1,"label","dms-label",this._translate("Hit policy:"),0),yr(2,Z$,{className:"hit-policy-edit-policy-select",label:this._translate("Hit policy"),onChange:this.onChange,options:Vv.map((e=>({...e,label:this._translate(e.label)}))),value:i.value,"data-hit-policy":"true",noInput:!0})],4,{title:this._translate(i.explanation)})}}function Kj(e){e.onGetComponent("hit-policy",(()=>Xj))}Xj.$inject=["changeSupport","sheet","modeling"],Kj.$inject=["components"];var Gj={__depends__:[Ux],__init__:["hitPolicyProvider"],hitPolicyProvider:["type",Kj]};class Yj extends Gd{constructor(e,t){super(e),this.executed(["row.add","row.remove","col.add","col.remove"],Zj((e=>{var t=e.context,n=t.row||t.col;this.updateRoot(n,t.oldRoot)}))),this.reverted(["row.add","row.remove","col.add","col.remove"],Zj((e=>{var t=e.context,n=t.row||t.col;this.updateRoot(n,t.newRoot)})))}updateRoot(e,t){var n=e.root,i=e.businessObject;if(hn(e,"dmn:DecisionRule")){if(t){let e=t.businessObject.get("rule"),n=e.indexOf(i);e.splice(n,1),i.$parent=null}if(n){let t=n.businessObject,o=n.rows.indexOf(e);t.get("rule").splice(o,0,i),i.$parent=t,e.cells.forEach(((t,n)=>{this.wireCell(t,e,n)}))}}if(hn(e,"dmn:InputClause")||hn(e,"dmn:OutputClause")){let o,r;if(t){let n=t.businessObject,s=n.get("input"),a=n.get("output");if(hn(e,"dmn:InputClause")&&(o=s,r=s.indexOf(i)),hn(e,"dmn:OutputClause")&&(o=a,r=a.indexOf(i)),-1===r)throw new Error("inconsistent model: clause not in table");o.splice(r,1),i.$parent=null,e.cells.forEach(((e,n)=>{this.unwireCell(e,t.rows[n])}))}if(n){let t,o,r=n.businessObject,s=r.get("input"),a=r.get("output"),l=n.cols.indexOf(e);hn(e,"dmn:InputClause")&&(o=s,t=l),hn(e,"dmn:OutputClause")&&(o=a,t=l-s.length),o.splice(t,0,i),i.$parent=r,e.cells.forEach(((e,t)=>{this.wireCell(e,n.rows[t],l)}))}}}unwireCell(e,t){var n=e.businessObject;let i,o,r=t.businessObject,s=r.get("inputEntry"),a=r.get("outputEntry");if(hn(e,"dmn:UnaryTests")&&(i=s),hn(e,"dmn:LiteralExpression")&&(i=a),o=i.indexOf(n),-1===o)throw new Error("cell not in row");i.splice(o,1),n.$parent=null}wireCell(e,t,n){var i=e.businessObject;let o,r,s=t.businessObject,a=s.get("inputEntry"),l=s.get("outputEntry");i.$parent!==s&&(hn(e,"dmn:UnaryTests")&&(o=a,r=n),hn(e,"dmn:LiteralExpression")&&(o=l,r=n-a.length),o.splice(r,0,i),i.$parent=s)}}function Zj(e){return function(t){var n=t.context;hn(n.row||n.col,"dmn:DMNElement")&&e(t)}}Yj.$inject=["eventBus","sheet"];let Jj=class{constructor(e){this._model=e}create(e,t={}){var n=this._model.create(e,t||{});return hn(n,"dmn:InputClause")&&(t.inputExpression?n.inputExpression=t.inputExpression:(n.inputExpression=this.create("dmn:LiteralExpression",{typeRef:"string"}),n.inputExpression.$parent=n)),hn(n,"dmn:OutputClause")&&(n.typeRef=t.typeRef||"string"),(hn(n,"dmn:UnaryTests")||hn(n,"dmn:LiteralExpression"))&&(n.text=t.text||""),this._ensureId(n),n}_needsId(e){return hn(e,"dmn:DMNElement")}_ensureId(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))}};Jj.$inject=["moddle"];class eI extends Qm{constructor(e){super(),this._dmnFactory=e}create(e,t){const n=this._dmnFactory;let{businessObject:i,type:o,...r}=t;if(!i){if(!o){if("root"===e)o="dmn:DecisionTable";else if("cell"===e){let{col:e}=r;hn(e,"dmn:OutputClause")&&(o="dmn:LiteralExpression"),hn(e,"dmn:InputClause")&&(o="dmn:UnaryTests")}if(!o)throw new Error("cannot guess <type>")}i=n.create(o)}return super.create(e,{businessObject:i,id:i.id,...r})}}eI.$inject=["dmnFactory"];class tI{constructor(e,t){this._sheet=e,this._elementFactory=t}execute(e){const t=this._sheet,n=this._elementFactory,i=t.getRoot();let{row:o,index:r}=e;return void 0===r&&(r=e.index=i.rows.length),e.newRoot=i,o.cells.length||i.cols.forEach(((e,t)=>{const i=n.create("cell",{row:o,col:e});o.cells[t]=i})),t.addRow(o,r),t.getRoot()}revert(e){const{row:t}=e,n=this._sheet;return n.removeRow(t),n.getRoot()}}tI.$inject=["sheet","elementFactory"];class nI{constructor(e){this._sheet=e}execute(e){const t=this._sheet,n=t.getRoot();let{row:i}=e;const o=e.oldIndex=n.rows.indexOf(i);if(e.oldRoot=i.root,-1===o)throw new Error(`row#${i.id} not in sheet`);return t.removeRow(i),t.getRoot()}revert(e){const{row:t,oldIndex:n}=e,i=this._sheet;return i.addRow(t,n),i.getRoot()}}nI.$inject=["sheet"];class iI{constructor(e){this._modeling=e}preExecute(e){let{row:t}=e;this._modeling.removeRow(t)}postExecute(e){let{row:t,index:n}=e;this._modeling.addRow(t,n)}}iI.$inject=["modeling"];class oI{constructor(e,t){this._sheet=e,this._elementFactory=t}execute(e){const t=this._sheet,n=this._elementFactory,i=t.getRoot();let{col:o,index:r}=e;return void 0===r&&(r=e.index=i.cols.length),e.newRoot=i,o.cells.length||i.rows.forEach(((e,t)=>{const i=n.create("cell",{row:e,col:o});o.cells[t]=i})),t.addCol(o,r),t.getRoot()}revert(e){const{col:t}=e,n=this._sheet;return n.removeCol(t),n.getRoot()}}oI.$inject=["sheet","elementFactory"];class rI{constructor(e,t){this._sheet=e,this._elementFactory=t}execute(e){const t=this._sheet;let{col:n}=e;const i=e.oldRoot=n.root;if(-1===(e.oldIndex=i.cols.indexOf(n)))throw new Error(`col#${n.id} not in sheet`);return t.removeCol(n),t.getRoot()}revert(e){const{col:t,oldIndex:n}=e,i=this._sheet;return i.addCol(t,n),i.getRoot()}}rI.$inject=["sheet","elementFactory"];class sI{constructor(e){this._modeling=e}preExecute(e){let{col:t}=e;this._modeling.removeCol(t)}postExecute(e){let{col:t,index:n}=e;this._modeling.addCol(t,n)}}sI.$inject=["modeling"];class aI{execute(e){let{cell:t}=e;return t}revert(e){const{cell:t}=e;return t}}let lI=class e{constructor(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n,e.on("table.init",(()=>{!function(e,t){p(e,(function(e,n){t.registerHandler(n,e)}))}(this.getHandlers(),n)}))}getHandlers(){return e._getHandlers()}static _getHandlers(){return{"row.add":tI,"row.remove":nI,"row.move":iI,"col.add":oI,"col.remove":rI,"col.move":sI,"cell.edit":aI}}_create(e,t){return t instanceof Lm?t:this._elementFactory.create(e,t)}addRow(e,t){const n=this._create("row",e),i={row:n,index:t};return this._commandStack.execute("row.add",i),n}removeRow(e){this._commandStack.execute("row.remove",{row:e})}moveRow(e,t){const n={row:e,index:t};this._commandStack.execute("row.move",n)}addCol(e,t){const n=this._create("col",e),i={col:n,index:t};return this._commandStack.execute("col.add",i),n}removeCol(e){this._commandStack.execute("col.remove",{col:e})}moveCol(e,t){const n={col:e,index:t};this._commandStack.execute("col.move",n)}editCell(e,t){const n={cell:e,...t};this._commandStack.execute("cell.edit",n)}};lI.$inject=["eventBus","elementFactory","commandStack"];class cI{constructor(e,t,n){this._dmnFactory=e,this._moddle=t,this._modeling=n}execute(e){const{element:t,allowedValues:n}=e;return hn(t,"dmn:InputClause")?(t.inputValues?e.oldAllowedValues=t.inputValues.text:uI(n)||(t.inputValues=this._dmnFactory.create("dmn:UnaryTests",{text:""})),uI(n)?t.inputValues&&delete t.inputValues:t.inputValues.text=n.join(",")):(t.outputValues&&t?e.oldAllowedValues=t.outputValues.text:uI(n)||(t.outputValues=this._dmnFactory.create("dmn:UnaryTests",{text:""})),uI(n)?t.outputValues&&delete t.outputValues:t.outputValues.text=n.join(",")),t}revert(e){const{element:t,oldAllowedValues:n}=e;return hn(t,"dmn:InputClause")?n?(t.inputValues||(t.inputValues=this._dmnFactory.create("dmn:UnaryTests",{text:""})),t.inputValues.text=n):delete t.inputValues:n?(t.outputValues||(t.outputValues=this._dmnFactory.create("dmn:UnaryTests",{text:""})),t.outputValues.text=n):delete t.outputValues,t}}function uI(e){return null===e}cI.$inject=["dmnFactory","moddle","modeling"];const hI="id";class dI{constructor(e,t){this._elementRegistry=e,this._moddle=t}execute(e){const{element:t,properties:n}=e,i=fn(t),{changed:o,oldProperties:r}=this.updateProperties(i,n);return e.oldProperties=r,[...o,t]}revert(e){const{element:t,oldProperties:n}=e;var i=fn(t),{changed:o}=this.updateProperties(i,n);return[...o,t]}updateProperties(e,t){const n=this._moddle.ids;return f(t,((t,i,o)=>{const r=e.get(o);if(pI(i)){if(!pI(r))throw new Error(`non-existing property <${o}>: cannot update values`);let{changed:e,oldProperties:n}=this.updateProperties(r,i);return{changed:[...t.changed,...e,r],oldProperties:{...t.oldProperties,[o]:n}}}var s;return o===hI&&(s=i,e[hI]!==s)&&(n.unclaim(e[hI]),this._elementRegistry.updateId(e,i),n.claim(i,e)),e.set(o,i),{changed:t.changed,oldProperties:{...t.oldProperties,[o]:r}}}),{changed:[],oldProperties:{}})}}function pI(e){return i(e)&&s(e)}dI.$inject=["elementRegistry","moddle"];class fI{constructor(e){this._moddle=e}execute(e){const t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)}revert(e){const t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.unclaim(n):t.claim(n,i)}}fI.$inject=["moddle"];let gI=class e extends lI{constructor(e,t,n,i){super(e,t,n),this._eventBus=e,this._elementFactory=t,this._commandStack=n,this._sheet=i}getHandlers(){return e._getHandlers()}static _getHandlers(){return M({},super._getHandlers(),{editAllowedValues:cI,"element.updateProperties":dI,"id.updateClaim":fI})}editDecisionTableName(e){const t={element:this._sheet.getRoot().businessObject.$parent,properties:{name:e}};this._commandStack.execute("element.updateProperties",t)}editDecisionTableId(e){const t={element:this._sheet.getRoot().businessObject.$parent,properties:{id:e}};this._commandStack.execute("element.updateProperties",t)}editHitPolicy(e,t){const n={element:this._sheet.getRoot().businessObject,properties:{hitPolicy:e,aggregation:t}};this._commandStack.execute("element.updateProperties",n)}updateProperties(e,t){const n={element:e,properties:t};this._commandStack.execute("element.updateProperties",n)}editInputExpression(e,t){const n={element:e,properties:t};this._commandStack.execute("element.updateProperties",n)}editOutputName(e,t){const n={element:e,properties:{name:t}};this._commandStack.execute("element.updateProperties",n)}editInputExpressionTypeRef(e,t){const n={element:e,properties:{typeRef:t}};this._commandStack.execute("element.updateProperties",n)}editOutputTypeRef(e,t){const n={element:e,properties:{typeRef:t}};this._commandStack.execute("element.updateProperties",n)}editCell(e,t){const n={element:e,properties:{text:t}};this._commandStack.execute("element.updateProperties",n)}editAnnotation(e,t){const n={element:e,properties:{description:t}};this._commandStack.execute("element.updateProperties",n)}editAllowedValues(e,t){const n={element:e,allowedValues:t};this._commandStack.execute("editAllowedValues",n)}editExpressionLanguage(e,t){const n={element:e,properties:{expressionLanguage:t}};this._commandStack.execute("element.updateProperties",n)}claimId(e,t){const n={id:e,element:t,claiming:!0};this._commandStack.execute("id.updateClaim",n)}unclaimId(e,t){const n={id:e,element:t};this._commandStack.execute("id.updateClaim",n)}};gI.$inject=["eventBus","elementFactory","commandStack","sheet"];class mI extends Gd{constructor(e,t,n){super(e),this._ids=t.ids,this._modeling=n,this.preExecute(["row.add","col.add"],(e=>{const t=e.context,n=t.row||t.col;this.claimId(n.businessObject),n.cells&&n.cells.forEach((e=>this.claimId(e.businessObject)))}))}claimId(e){e.id&&!this._ids.assigned(e.id)&&this._modeling.claimId(e.id,e),e.$descriptor.properties.forEach((t=>{const n=e[t.name];n&&(r(n)&&n.forEach((e=>this.claimId(e))),n.$type&&this.claimId(n))}))}}mI.$inject=["eventBus","moddle","modeling"];class vI extends Gd{constructor(e,t){super(e),this._modeling=t,this.preExecute(["row.remove","col.remove"],(e=>{const t=e.context,n=t.row||t.col;this.unclaimId(n.businessObject),n.cells&&n.cells.forEach((e=>this.unclaimId(e.businessObject)))}))}unclaimId(e){e.id&&this._modeling.unclaimId(e.id,e),e.$descriptor.properties.forEach((t=>{const n=e[t.name];n&&(r(n)&&n.forEach((e=>this.unclaimId(e))),n.$type&&this.unclaimId(n))}))}}vI.$inject=["eventBus","modeling"];var yI={__init__:["dmnUpdater","idChangeBehavior","nameChangeBehavior","modeling"],__depends__:[{__init__:["idClaimBehavior","idUnclaimBehavior"],idClaimBehavior:["type",mI],idUnclaimBehavior:["type",vI]},_p],dmnUpdater:["type",Yj],dmnFactory:["type",Jj],elementFactory:["type",eI],idChangeBehavior:["type",qp],nameChangeBehavior:["type",Vp],modeling:["type",gI]};class xI extends Ds{constructor(e,t){super(e,t),this.changeCellValue=this.changeCellValue.bind(this),this.onElementsChanged=this.onElementsChanged.bind(this)}onElementsChanged(){this.forceUpdate()}componentWillMount(){const{injector:e}=this.context,{cell:t}=this.props,n=this._changeSupport=this.context.changeSupport;this._modeling=e.get("modeling"),n.onElementsChanged(t.id,this.onElementsChanged)}componentWillUnmount(){const{cell:e}=this.props;this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}changeCellValue(e){const{cell:t}=this.props;this._modeling.editCell(t.businessObject,e)}render(){const{cell:e,rowIndex:t,row:n,col:i,colIndex:o}=this.props,r=hn(e,"dmn:UnaryTests"),s=e.businessObject;return yr(2,dv,{className:r?"input-cell":"output-cell",elementId:e.id,coords:`${t}:${o}`,"data-row-id":n.id,"data-col-id":i.id,children:yr(2,_I,{placeholder:r?"-":"",onChange:this.changeCellValue,value:s.text,businessObject:s})})}}let bI=class extends Ds{constructor(e,t){super(e,t),this.state={focussed:!1},this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}onFocus(){this.setState({focussed:!0})}onBlur(){this.setState({focussed:!1})}render(){const{focussed:e}=this.state;return vr(1,"div","feel-editor"+(e?" focussed":""),[e&&br(yr(2,U$,{...this.props,autoFocus:!0,onBlur:this.onBlur})),br(yr(2,gx,{...this.props,onInput:()=>{},onFocus:this.onFocus}))],0,{onClick:this.onFocus})}};class _I extends Ds{constructor(e,t){super(e,t),this._expressionLanguages=t.injector.get("expressionLanguages"),this._translate=t.injector.get("translate"),this._variableResolver=t.injector.get("variableResolver",!1)}isDefaultExpressionLanguage(e){const{expressionLanguage:t}=e,n=this.getDefaultExpressionLanguage().value;return!t||t===n}getDescription(e){return e.description}getExpressionLanguageLabel(e){const{expressionLanguage:t}=e,n=this.getDefaultExpressionLanguage();return this._expressionLanguages.getLabel(t)||n.label}isScript(){const{businessObject:e}=this.props,t=this.getDefaultExpressionLanguage();return!!this._isInputCell()&&(-1!==e.text.indexOf("\n")||e.expressionLanguage&&e.expressionLanguage!==t)}_isInputCell(){return hn(this.props.businessObject,"dmn:UnaryTests")}getDefaultExpressionLanguage(){const e=this._isInputCell()?"inputCell":"outputCell";return this._expressionLanguages.getDefault(e)}getEditor(){return this.isFEEL()?bI:gx}isFEEL(){return"feel"===this.getExpressionLanguage()}getExpressionLanguage(){const{businessObject:e}=this.props;return e.expressionLanguage||this.getDefaultExpressionLanguage().value}_getVariables(){const{businessObject:e}=this.props;return this._variableResolver&&this._variableResolver.getVariables(e)}_getLabel(){return this._isInputCell()?this._translate("Input"):this._translate("Output")}render(){const{businessObject:e,placeholder:t,value:n,onChange:i}=this.props,o=this.getDescription(e),r=this.isDefaultExpressionLanguage(e),s=this.getExpressionLanguageLabel(e),a=this.isScript(),l=this.getEditor(),u=this._getVariables();return vr(1,"div","cell-editor",[c(o)&&vr(1,"div","description-indicator"),yr(2,l,{label:this._getLabel(),className:a?"script-editor":"",ctrlForNewline:!0,onInput:i,value:n,placeholder:t,variables:u}),!r&&vr(1,"span","dms-badge dmn-expression-language",[vr(1,"span","dms-badge-icon dmn-icon-file-code"),vr(1,"span","dms-badge-label",s,0)],4,{title:this._translate("Expression language: {expressionLanguageLabel}",{expressionLanguageLabel:s})})],0)}}class wI{constructor(e){e.onGetComponent("cell",1500,(({cellType:e})=>{if("rule"===e)return xI}))}}wI.$inject=["components"];var CI={__depends__:[wx,qv],__init__:["decisionRulesEditor"],decisionRulesEditor:["type",wI]};class OI extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this.state={top:0,left:0,isVisible:!1,isDisabled:!1,selection:null},av(this);const{debounceInput:n}=this;this.onClick=this.onClick.bind(this),this.handleSelectionChanged=this.handleSelectionChanged.bind(this),this.hideAndShowDebounced=this.hideAndShowDebounced.bind(this),this.showDebounced=n(this.showDebounced.bind(this)),this.updatePosition=this.updatePosition.bind(this)}componentDidMount(){const{eventBus:e}=this;e.on("cellSelection.changed",this.handleSelectionChanged),e.on("commandStack.changed",this.updatePosition),e.on("sheet.scroll",this.hideAndShowDebounced)}componentWillUnmount(){const{eventBus:e}=this;e.off("cellSelection.changed",this.handleSelectionChanged),e.off("commandStack.changed",this.updatePosition),e.off("sheet.scroll",this.hideAndShowDebounced)}hideAndShowDebounced(){this.state.isVisible&&(this.hide(),this.showDebounced())}showDebounced(){this.show()}hide(e={}){this.setState({...e,isVisible:!1})}show(e={}){this.setState({...e,isVisible:!0}),this.updatePosition()}handleSelectionChanged({elementId:e}){const{elementRegistry:t,expressionLanguages:n,simpleMode:i}=this,o=t.get(e);if(!o||!i.canSimpleEdit(o))return void this.hide({isDisabled:!1,selection:null});const r=!function(e,t,n){return!t||t===function(e,t){if(dn(e.col))return t.getDefault("inputCell").value;if(pn(e.col))return t.getDefault("outputCell").value}(e,n)}(o,o.businessObject.expressionLanguage,n);this.show({isDisabled:r,selection:o})}updatePosition(){const{selection:e}=this.state,{node:t}=this;if(!e||!t)return;const{renderer:n}=this,i=n.getContainer(),o=i.getBoundingClientRect(),r=My(e.id,i).getBoundingClientRect(),s=this.node.getBoundingClientRect(),{scrollLeft:a,scrollTop:l}=function(e){const t=Bt(e,".tjs-table-container");if(!t)return{scrollTop:0,scrollLeft:0};const{scrollLeft:n,scrollTop:i}=t;return{scrollTop:i,scrollLeft:n}}(t),c={};r.left+r.width/2>o.width/2?c.left=-o.left+r.left-s.width+4+a+"px":c.left=-o.left+r.left+r.width-4+a+"px",r.top+r.height/2>o.height/2?c.top=-o.top+r.top-s.height+4+l+"px":c.top=-o.top+r.top-4+l+"px",M(this.node.style,c)}onClick(){const{eventBus:e}=this,{isDisabled:t}=this.state;if(t)return;const{selection:n}=this,i=n.get();i&&(e.fire("simpleMode.open",{element:i,node:My(i.id,this._container)}),this.hide())}render(){const{isDisabled:e,isVisible:t,top:n,left:i}=this.state,o=["simple-mode-button","no-deselect"];return e&&o.push("disabled"),t?vr(1,"div",o.join(" "),vr(1,"span","dmn-icon-edit"),2,{onClick:this.onClick,style:{top:n,left:i},title:e?this._translate("Editing not supported for set expression language"):this._translate("Edit")},null,(e=>this.node=e)):null}}OI.$inject=["debounceInput","elementRegistry","eventBus","expressionLanguages","renderer","selection","simpleMode"];class kI{constructor(e,t,n,i,o){this._providers=[],e.onGetComponent("table.before",(()=>OI)),i.on("simpleMode.open",(({element:e,node:n})=>{const{left:i,top:r,width:s,height:a}=n.getBoundingClientRect(),l=o.getContainer();t.open({x:i+l.parentNode.scrollLeft,y:r+l.parentNode.scrollTop,width:s,height:a},{contextMenuType:"simple-mode-edit",element:e,offset:{x:4,y:4}})})),i.on("cell.click",(e=>{const{event:t,node:o,id:r}=e;if(function(e){if(e.altKey)return!1;return e.ctrlKey||e.metaKey}(t)){const t=n.get(r);t&&i.fire("simpleMode.open",{node:o,element:t}),e.preventDefault()}}))}registerProvider(e){this._providers.push(e)}canSimpleEdit(e){return this._providers.reduce(((t,n)=>t||n(e)),!1)}}kI.$inject=["components","contextMenu","elementRegistry","eventBus","renderer"];var EI={__depends__:[Ux,jy,jv],__init__:["simpleMode"],simpleMode:["type",kI]};const SI="none";class RI extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=function(e){return!e||function(e){return""===e}(e)?"none":"true"===e.trim()?"true":"false"===e.trim()?"false":void 0}(n.businessObject.text);this.state={value:i||SI},this.editCell=this.editCell.bind(this),this.onChange=this.onChange.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onChange(e){const{element:t}=this.props.context;this.editCell(t.businessObject,e===SI?"":e),this.setState({value:e})}render(){const{value:e}=this.state,t=[{label:"-",value:SI},{label:this._translate("Yes"),value:"true"},{label:this._translate("No"),value:"false"}];return vr(1,"div","simple-boolean-edit context-menu-container",[vr(1,"h3","dms-heading",this._translate("Edit boolean"),0),vr(1,"h4","dms-heading",this._translate("Set value"),0),yr(2,Z$,{label:this._translate("Boolean value"),noInput:!0,className:"dms-block",onChange:this.onChange,options:t,value:e})],4)}}class TI{constructor(e,t){t.registerProvider((e=>(dn(e.col)||pn(e.col))&&"boolean"===MI(e))),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if("boolean"===MI(e.element))return RI}}))}}function MI(e){return dn(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}TI.$inject=["components","simpleMode"];var AI={__depends__:[yj,EI],__init__:["simpleBooleanEdit"],simpleBooleanEdit:["type",TI]};const PI=/^\d{4}(?:-\d\d){2}$/,DI=/^\[date\("([^"]*)"\)..date\("([^"]*)"\)\]$/,$I=/^(<|>)\s*date\("([^"]*)"\)$/,jI=/^date\("([^"]*)"\)$/;function II(e){if(!PI.test(e.trim()))return"Date must match pattern yyyy-MM-dd"}function BI(e,t){return"exact"===e?`date("${t[0]}")`:"before"===e?`< date("${t[0]}")`:"after"===e?`> date("${t[0]}")`:"between"===e?`[date("${t[0]}")..date("${t[1]}")]`:void 0}function LI(){const e=new Date;return e.setUTCHours(0,0,0,0),e.toISOString().slice(0,10)}function NI(e){if(!e||""===e.trim())return{type:"exact",date:""};let t=e.match(DI);return t?{type:"between",dates:[t[1],t[2]]}:(t=e.match($I),t?{type:"<"===t[1]?"before":"after",date:t[2]}:(t=e.match(jI),t?{type:"exact",date:t[1]}:void 0))}const qI="exact",VI="between";let FI=class extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=NI(n.businessObject.text);if(i){let e;e=i.date?[i.date,""]:i.dates?i.dates:["",""],this.state={type:i.type,dates:e}}else this.state={type:qI,dates:["",""]};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onTypeChange=this.onTypeChange.bind(this),this.onSetStartDateTodayClick=this.onSetStartDateTodayClick.bind(this),this.onSetEndDateTodayClick=this.onSetEndDateTodayClick.bind(this),this.onStartDateInput=this.onStartDateInput.bind(this),this.onEndDateInput=this.onEndDateInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onTypeChange(e){const{element:t}=this.props.context,{dates:n}=this.state;this.setState({type:e}),NI(BI(e,n))&&this.editCell(t.businessObject,BI(e,n))}onSetStartDateTodayClick(){const{element:e}=this.props.context,{dates:t,type:n}=this.state,i=LI();this.setState({dates:[i,t[1]]}),NI(BI(n,[i,t[1]]))&&this.editCell(e.businessObject,BI(n,[i,t[1]]))}onSetEndDateTodayClick(){const{element:e}=this.props.context,{dates:t,type:n}=this.state,i=LI();this.setState({dates:[t[0],i]}),NI(BI(n,[t[0],i]))&&this.editCell(e.businessObject,BI(n,[t[0],i]))}onStartDateInput({value:e}){const{element:t}=this.props.context,{dates:n,type:i}=this.state;this.setState({dates:[e,n[1]]}),this.debouncedEditCell(t.businessObject,BI(i,[e,n[1]]))}onEndDateInput({value:e}){const{element:t}=this.props.context,{dates:n,type:i}=this.state;this.setState({dates:[n[0],e]}),this.debouncedEditCell(t.businessObject,BI(i,[n[0],e]))}render(){const{dates:e,type:t}=this.state,n=[{label:this._translate("Exactly"),value:qI},{label:this._translate("Before"),value:"before"},{label:this._translate("After"),value:"after"},{label:this._translate("Between"),value:VI}];return vr(1,"div","context-menu-container simple-date-edit",[vr(1,"h3","dms-heading",this._translate("Edit date"),0),vr(1,"div","dms-fill-row",yr(2,Z$,{label:this._translate("Test type"),noInput:!0,onChange:this.onTypeChange,options:n,value:t}),2),vr(1,"h4","dms-heading",t===VI?this._translate("Edit start date"):this._translate("Set date"),0),vr(1,"div",null,[yr(2,rj,{label:t===VI?this._translate("Start date"):this._translate("Date"),className:"start-date-input dms-block",onInput:this.onStartDateInput,placeholder:this._translate("e.g. { sample }",{sample:LI()}),validate:e=>II(e)&&this._translate(II(e)),value:e[0]}),vr(1,"p","dms-hint",[vr(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onSetStartDateTodayClick}),xr(".")],4)],4),t===VI&&vr(1,"h4","dms-heading",this._translate("Edit end date"),0),t===VI&&vr(1,"div",null,[yr(2,rj,{label:this._translate("End date"),className:"end-date-input dms-block",onInput:this.onEndDateInput,placeholder:this._translate("e.g. { sample }",{sample:LI()}),validate:e=>II(e)&&this._translate(II(e)),value:e[1]}),vr(1,"p","dms-hint",[vr(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onSetEndDateTodayClick}),xr(".")],4)],4)],0)}},zI=class extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=NI(n.businessObject.text);this.state={date:i?i.date:""};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onClick=this.onClick.bind(this),this.onInput=this.onInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onClick(){const{element:e}=this.props.context,t=LI();this.setState({date:t}),this.editCell(e.businessObject,`date("${t}")`)}onInput({value:e}){const{element:t}=this.props.context;this.setState({date:e}),this.debouncedEditCell(t.businessObject,`date("${e}")`)}render(){const{date:e}=this.state;return vr(1,"div","context-menu-container simple-date-edit",[vr(1,"h3","dms-heading",this._translate("Edit date"),0),vr(1,"h4","dms-heading",this._translate("Set date"),0),vr(1,"div",null,[yr(2,rj,{label:this._translate("Date value"),onInput:this.onInput,placeholder:this._translate("e.g. { example } ",{example:LI()}),validate:e=>II(e)&&this._translate(II(e)),value:e,className:"dms-block"}),vr(1,"p","dms-hint",vr(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onClick}),2)],4)],4)}},QI=class{constructor(e,t){t.registerProvider((e=>{const t=HI(e);return(dn(e.col)||pn(e.col))&&WI(t)})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if(WI(HI(e.element))){if(dn(e.element.col))return FI;if(pn(e.element.col))return zI}}}))}};function HI(e){return dn(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}function WI(e){return"date"===e}QI.$inject=["components","simpleMode"];var UI={__depends__:[yj,EI],__init__:["simpleDateEdit"],simpleDateEdit:["type",QI]};const XI=/^\d{4}(?:-\d\d){2}T(?:\d\d:){2}\d\d(?:Z|(?:[@+-][^")]+))?$/,KI=/^\[date and time\("([^"]*)"\)..date and time\("([^"]*)"\)\]$/,GI=/^(<|>)\s*date and time\("([^"]*)"\)$/,YI=/^date and time\("([^"]*)"\)$/;function ZI(e){if(!XI.test(e.trim()))return"Date and time must match pattern yyyy-MM-ddTHH:mm:ss[time zone]"}function JI(e,t){return"exact"===e?`date and time("${t[0]}")`:"before"===e?`< date and time("${t[0]}")`:"after"===e?`> date and time("${t[0]}")`:"between"===e?`[date and time("${t[0]}")..date and time("${t[1]}")]`:void 0}function eB(){const e=new Date;return e.setUTCHours(0,0,0,0),e.toISOString().replace(".000Z","Z")}function tB(e){if(!e||""===e.trim())return{type:"exact",date:""};let t=e.match(KI);return t?{type:"between",dates:[t[1],t[2]]}:(t=e.match(GI),t?{type:"<"===t[1]?"before":"after",date:t[2]}:(t=e.match(YI),t?{type:"exact",date:t[1]}:void 0))}const nB="exact",iB="between";class oB extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=tB(n.businessObject.text);if(i){let e;e=i.date?[i.date,""]:i.dates?i.dates:["",""],this.state={type:i.type,dates:e}}else this.state={type:nB,dates:["",""]};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onTypeChange=this.onTypeChange.bind(this),this.onSetStartDateTodayClick=this.onSetStartDateTodayClick.bind(this),this.onSetEndDateTodayClick=this.onSetEndDateTodayClick.bind(this),this.onStartDateInput=this.onStartDateInput.bind(this),this.onEndDateInput=this.onEndDateInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onTypeChange(e){const{element:t}=this.props.context,{dates:n}=this.state;this.setState({type:e}),tB(JI(e,n))&&this.editCell(t.businessObject,JI(e,n))}onSetStartDateTodayClick(){const{element:e}=this.props.context,{dates:t,type:n}=this.state,i=eB();this.setState({dates:[i,t[1]]}),tB(JI(n,[i,t[1]]))&&this.editCell(e.businessObject,JI(n,[i,t[1]]))}onSetEndDateTodayClick(){const{element:e}=this.props.context,{dates:t,type:n}=this.state,i=eB();this.setState({dates:[t[0],i]}),tB(JI(n,[t[0],i]))&&this.editCell(e.businessObject,JI(n,[t[0],i]))}onStartDateInput({value:e}){const{element:t}=this.props.context,{dates:n,type:i}=this.state;this.setState({dates:[e,n[1]]}),this.debouncedEditCell(t.businessObject,JI(i,[e,n[1]]))}onEndDateInput({value:e}){const{element:t}=this.props.context,{dates:n,type:i}=this.state;this.setState({dates:[n[0],e]}),this.debouncedEditCell(t.businessObject,JI(i,[n[0],e]))}render(){const{dates:e,type:t}=this.state,n=[{label:this._translate("Exactly"),value:nB},{label:this._translate("Before"),value:"before"},{label:this._translate("After"),value:"after"},{label:this._translate("Between"),value:iB}];return vr(1,"div","context-menu-container simple-date-edit",[vr(1,"h3","dms-heading",this._translate("Edit date and time"),0),vr(1,"div","dms-fill-row",yr(2,Z$,{label:this._translate("Test type"),noInput:!0,onChange:this.onTypeChange,options:n,value:t}),2),vr(1,"h4","dms-heading",t===iB?this._translate("Edit start date and time"):this._translate("Set date and time"),0),vr(1,"div",null,[yr(2,rj,{label:t===iB?this._translate("Start date and time"):this._translate("Date and time"),className:"start-date-input dms-block",onInput:this.onStartDateInput,placeholder:this._translate("e.g. { sample }",{sample:eB()}),validate:e=>ZI(e)&&this._translate(ZI(e)),value:e[0]}),vr(1,"p","dms-hint",vr(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onSetStartDateTodayClick}),2)],4),t===iB&&vr(1,"h4","dms-heading",this._translate("Edit end date and time"),0),t===iB&&vr(1,"div",null,[yr(2,rj,{label:this._translate("End date and time"),className:"end-date-input dms-block",onInput:this.onEndDateInput,placeholder:this._translate("e.g. { sample }",{sample:eB()}),validate:e=>ZI(e)&&this._translate(ZI(e)),value:e[1]}),vr(1,"p","dms-hint",vr(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onSetEndDateTodayClick}),2)],4)],0)}}class rB extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=tB(n.businessObject.text);this.state={date:i?i.date:""};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onClick=this.onClick.bind(this),this.onInput=this.onInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onClick(){const{element:e}=this.props.context,t=eB();this.setState({date:t}),this.editCell(e.businessObject,`date and time("${t}")`)}onInput({value:e}){const{element:t}=this.props.context;this.setState({date:e}),this.debouncedEditCell(t.businessObject,`date and time("${e}")`)}render(){const{date:e}=this.state;return vr(1,"div","context-menu-container simple-date-edit",[vr(1,"h3","dms-heading",this._translate("Edit date and time"),0),vr(1,"h4","dms-heading",this._translate("Set date and time"),0),vr(1,"div",null,[yr(2,rj,{label:this._translate("Date and time value"),onInput:this.onInput,placeholder:this._translate("e.g. { sample }",{sample:eB()}),validate:e=>ZI(e)&&this._translate(ZI(e)),value:e,className:"dms-block"}),vr(1,"p","dms-hint",vr(1,"button","use-today",this._translate("Use today"),0,{type:"button",onClick:this.onClick}),2)],4)],4)}}let sB=class{constructor(e,t){t.registerProvider((e=>{const t=aB(e);return(dn(e.col)||pn(e.col))&&lB(t)})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if(lB(aB(e.element))){if(dn(e.element.col))return oB;if(pn(e.element.col))return rB}}}))}};function aB(e){return dn(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}function lB(e){return"dateTime"===e}sB.$inject=["components","simpleMode"];var cB={__depends__:[yj,EI],__init__:["simpleDateTimeEdit"],simpleDateTimeEdit:["type",sB]};const uB={equals:"=",less:"<",lessEquals:"<=",greater:">",greaterEquals:">="};function hB(e){return y(uB).filter((t=>e===uB[t]))[0]}function dB(e){if(!e||function(e){return""===e}(e.trim()))return{type:"comparison",values:[]};const t=function(e){const t=gB(e);if(t)return{type:"comparison",operator:"equals",values:[t]};const{operator:n,value:i}=mB(/^(?<operator>=|(:?<|>)=?)\s*duration\("(?<value>[^"]*)"\)$/,e);if(n&&i)return{type:"comparison",values:[i],operator:hB(n)}}(e);if(t)return t;const n=function(e){const{start:t,end:n,firstValue:i,secondValue:o}=mB(/^(?<start>[[\]])duration\("(?<firstValue>[^"]*)"\)\.\.duration\("(?<secondValue>[^"]*)"\)(?<end>[[\]])$/,e);if(t&&n)return{type:"range",values:[i,o],start:"]"===t?"exclude":"include",end:"["===n?"exclude":"include"}}(e);return n||void 0}function pB(e,t){return"equals"===e?`duration("${t}")`:`${uB[e]} duration("${t}")`}function fB(e,t,n,i){return`${"exclude"===n?"]":"["}duration("${e}")..duration("${t}")${"exclude"===i?"[":"]"}`}function gB(e){const t=/^duration\("([^"]*)"\)$/.exec(e);return t&&t[1]}function mB(e,t){const{groups:n}=e.exec(t)||{groups:{}};return n}const vB={yearMonthDuration:"Must match PnYnM",dayTimeDuration:"Must match PnDTnH"};class yB extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._type=e.type,this.onInput=this.onInput.bind(this),this.validate=this.validate.bind(this),this.state={value:e.value}}onInput({value:e}){this.setState({value:e}),this.props.onInput(e)}validate(e){if(!function(e,t){return"yearMonthDuration"===e?function(e){return/^P(\d+Y\d+M|\d+Y|\d+M)$/.test(e)}(t):"dayTimeDuration"===e?function(e){return/^P(\d+DT\d+H|\d+D|T\d+H)$/.test(e)}(t):void 0}(this._type,e))return this._translate(vB[this._type])}_getPlaceholder(){if("yearMonthDuration"===this._type)return this._translate("e.g. { sample }",{sample:"P1Y2M"});"dayTimeDuration"===this._type&&this._translate("e.g. { sample }",{sample:"P1DT2H"})}render(){return yr(2,rj,{label:this.props.label,type:"text",onInput:this.onInput,placeholder:this._getPlaceholder(),validate:this.validate,value:this.state.value,className:this.props.className})}}const xB="comparison",bB="range";class _B extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context;this._type=function(e){return e.col.businessObject.inputExpression.typeRef}(n);const i=dB(n.businessObject.text,this._type);this.state=i?{type:i.type,comparisonOperator:i.operator||"equals",startValue:i.values[0]||"",endValue:i.values[1]||"",rangeStartType:i.start||"include",rangeEndType:i.end||"include"}:{type:xB,comparisonOperator:"equals",startValue:"",endValue:"",rangeStartType:"include",rangeEndType:"include"};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onComparisonOperatorChange=this.onComparisonOperatorChange.bind(this),this.onComparisonValueChange=this.onComparisonValueChange.bind(this),this.onTypeChange=this.onTypeChange.bind(this),this.onRangeStartTypeChange=this.onRangeStartTypeChange.bind(this),this.onRangeStartValueChange=this.onRangeStartValueChange.bind(this),this.onRangeEndTypeChange=this.onRangeEndTypeChange.bind(this),this.onRangeEndValueChange=this.onRangeEndValueChange.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onTypeChange(e){const{element:t}=this.props.context,{comparisonOperator:n,startValue:i,endValue:o,rangeStartType:r,rangeEndType:s}=this.state;e===xB?this.editCell(t.businessObject,pB(n,i)):this.editCell(t.businessObject,fB(i,o,r,s)),this.setState({type:e})}onComparisonOperatorChange(e){const{element:t}=this.props.context,{type:n,startValue:i}=this.state;n===xB&&(this.editCell(t.businessObject,pB(e,i)),this.setState({comparisonOperator:e}))}onComparisonValueChange(e){const{element:t}=this.props.context,{type:n,comparisonOperator:i}=this.state;n===xB&&(this.debouncedEditCell(t.businessObject,pB(i,e)),this.setState({startValue:e}))}onRangeStartTypeChange(e){const{element:t}=this.props.context,{type:n,startValue:i,endValue:o,rangeEndType:r}=this.state;n===bB&&(this.editCell(t.businessObject,fB(i,o,e,r)),this.setState({rangeStartType:e}))}onRangeStartValueChange(e){const{element:t}=this.props.context,{type:n,endValue:i,rangeStartType:o,rangeEndType:r}=this.state;n===bB&&(this.editCell(t.businessObject,fB(e,i,o,r)),this.setState({startValue:e}))}onRangeEndTypeChange(e){const{element:t}=this.props.context,{type:n,startValue:i,endValue:o,rangeStartType:r}=this.state;n===bB&&(this.editCell(t.businessObject,fB(i,o,r,e)),this.setState({rangeEndType:e}))}onRangeEndValueChange(e){const{element:t}=this.props.context,{type:n,startValue:i,rangeStartType:o,rangeEndType:r}=this.state;n===bB&&(this.editCell(t.businessObject,fB(i,e,o,r)),this.setState({endValue:e}))}renderComparison(e,t){const n=[{label:this._translate("Equals"),value:"equals"},{label:this._translate("Less"),value:"less"},{label:this._translate("Less or equals"),value:"lessEquals"},{label:this._translate("Greater"),value:"greater"},{label:this._translate("Greater or equals"),value:"greaterEquals"}];return vr(1,"div","comparison",[vr(1,"h4","dms-heading",xr("Value"),2),vr(1,"div","dms-fill-row dms-input-duration-edit-row",[yr(2,Z$,{label:this._translate("Comparison operator"),noInput:!0,onChange:this.onComparisonOperatorChange,options:n,value:e}),xr(" "),yr(2,yB,{label:this._translate("Duration value"),type:this._type,className:"comparison-duration-input",onInput:this.onComparisonValueChange,value:t})],4)],4)}renderRange(e,t,n,i){const o=[{label:this._translate("Include"),value:"include"},{label:this._translate("Exclude"),value:"exclude"}];return vr(1,"div","range",[vr(1,"h4","dms-heading",this._translate("Start value"),0),vr(1,"div","dms-fill-row dms-input-duration-edit-row",[yr(2,Z$,{label:this._translate("Range start operator"),noInput:!0,onChange:this.onRangeStartTypeChange,options:o,value:n}),xr(" "),yr(2,yB,{label:this._translate("Range start value"),type:this._type,className:"range-start-duration-input",onInput:this.onRangeStartValueChange,value:e})],4),vr(1,"h4","dms-heading",this._translate("End value"),0),vr(1,"div","dms-fill-row dms-input-duration-edit-row",[yr(2,Z$,{label:this._translate("Range end operator"),noInput:!0,onChange:this.onRangeEndTypeChange,options:o,value:i}),xr(" "),yr(2,yB,{label:this._translate("Range end value"),type:this._type,className:"range-end-duration-input",onInput:this.onRangeEndValueChange,value:t})],4)],4)}render(){const{type:e,comparisonOperator:t,startValue:n,endValue:i,rangeStartType:o,rangeEndType:r}=this.state,s=[{label:this._translate("Comparison"),value:xB},{label:this._translate("Range"),value:bB}];return vr(1,"div","context-menu-container simple-duration-edit",[vr(1,"h3","dms-heading",this._translate("Edit duration"),0),vr(1,"div","dms-fill-row",yr(2,Z$,{label:this._translate("Test type"),noInput:!0,onChange:this.onTypeChange,options:s,value:e}),2),e===xB&&this.renderComparison(t,n),e===bB&&this.renderRange(n,i,o,r)],0)}}class wB extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context;this._type=function(e){return e.col.businessObject.typeRef}(n);const i=t.injector.get("debounceInput");this.debouncedEditCell=i(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onInput=this.onInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onInput(e){const{element:t}=this.props.context;this.debouncedEditCell(t.businessObject,`duration("${e}")`)}render(){const e=gB(this.props.context.element.businessObject.text,this._type);return vr(1,"div","context-menu-container simple-duration-edit",[vr(1,"h3","dms-heading",this._translate("Edit duration"),0),vr(1,"h4","dms-heading",this._translate("Set duration"),0),yr(2,yB,{label:this._translate("Duration value"),onInput:this.onInput,value:e,type:this._type,className:"dms-block"})],4)}}class CB{constructor(e,t){t.registerProvider((e=>{const t=OB(e);return(dn(e.col)||pn(e.col))&&EB(t)})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if(EB(OB(e.element))){if(dn(e.element.col))return _B;if(pn(e.element.col))return wB}}}))}}function OB(e){return dn(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}CB.$inject=["components","simpleMode"];const kB=["yearMonthDuration","dayTimeDuration"];function EB(e){return kB.includes(e)}var SB={__depends__:[yj,EI],__init__:["simpleDurationEdit"],simpleDurationEdit:["type",CB]};const RB=/^(-?(?:[0-9]|\.[0-9])+)$|^((?:<|>|=){0,2})\s*(-?(?:[0-9]|\.[0-9])+)$/,TB=/^(\[|\]){1}(-?(?:[0-9]|\.[0-9])+){1,}\.\.(-?(?:[0-9]|\.[0-9])+){1,}(\[|\]){1}$/,MB={equals:"=",less:"<",lessEquals:"<=",greater:">",greaterEquals:">="};function AB(e){return y(MB).filter((t=>e===MB[t]))[0]}function PB(e){if(!e||function(e){return""===e}(e.trim()))return{type:"comparison"};const t=e.match(RB),n=e.match(TB);if(t){if(function(e){return e[0]&&e[1]&&!e[2]&&!e[3]}(t))return{type:"comparison",value:parseFloat(t[1]),operator:"equals"};if(function(e){return e[0]&&!e[1]&&e[2]&&e[3]}(t))return{type:"comparison",value:parseFloat(t[3]),operator:AB(t[2])}}else if(n)return{type:"range",values:[n[2],n[3]].map((e=>parseFloat(e))),start:"]"===n[1]?"exclude":"include",end:"["===n[4]?"exclude":"include"}}function DB(e,t){return"equals"===e?`${t}`:`${MB[e]} ${t}`}function $B(e,t,n,i){return`${"exclude"===n?"]":"["}${e}..${t}${"exclude"===i?"[":"]"}`}const jB="comparison",IB="range";class BB extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=PB(n.businessObject.text);this.state=i?{type:i.type,comparisonOperator:i.operator||"equals",comparisonValue:i.value||0,rangeStartValue:i.values?i.values[0]:0,rangeEndValue:i.values?i.values[1]:0,rangeStartType:i.start||"include",rangeEndType:i.end||"include"}:{type:jB,comparisonOperator:"equals",comparisonValue:0,rangeStartValue:0,rangeEndValue:0,rangeStartType:"include",rangeEndType:"include"};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onComparisonOperatorChange=this.onComparisonOperatorChange.bind(this),this.onComparisonValueChange=this.onComparisonValueChange.bind(this),this.onTypeChange=this.onTypeChange.bind(this),this.onRangeStartTypeChange=this.onRangeStartTypeChange.bind(this),this.onRangeStartValueChange=this.onRangeStartValueChange.bind(this),this.onRangeEndTypeChange=this.onRangeEndTypeChange.bind(this),this.onRangeEndValueChange=this.onRangeEndValueChange.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onTypeChange(e){const{element:t}=this.props.context,{comparisonOperator:n,comparisonValue:i,rangeStartValue:o,rangeEndValue:r,rangeStartType:s,rangeEndType:a}=this.state;e===jB?this.editCell(t.businessObject,DB(n,i)):this.editCell(t.businessObject,$B(o,r,s,a)),this.setState({type:e})}onComparisonOperatorChange(e){const{element:t}=this.props.context,{type:n,comparisonValue:i}=this.state;n===jB&&(this.editCell(t.businessObject,DB(e,i)),this.setState({comparisonOperator:e}))}onComparisonValueChange(e){const{element:t}=this.props.context,{type:n,comparisonOperator:i}=this.state;n===jB&&(this.debouncedEditCell(t.businessObject,DB(i,e)),this.setState({comparisonValue:e}))}onRangeStartTypeChange(e){const{element:t}=this.props.context,{type:n,rangeStartValue:i,rangeEndValue:o,rangeEndType:r}=this.state;n===IB&&(this.editCell(t.businessObject,$B(i,o,e,r)),this.setState({rangeStartType:e}))}onRangeStartValueChange(e){const{element:t}=this.props.context,{type:n,rangeEndValue:i,rangeStartType:o,rangeEndType:r}=this.state;n===IB&&(this.editCell(t.businessObject,$B(e,i,o,r)),this.setState({rangeStartValue:e}))}onRangeEndTypeChange(e){const{element:t}=this.props.context,{type:n,rangeStartValue:i,rangeEndValue:o,rangeStartType:r}=this.state;n===IB&&(this.editCell(t.businessObject,$B(i,o,r,e)),this.setState({rangeEndType:e}))}onRangeEndValueChange(e){const{element:t}=this.props.context,{type:n,rangeStartValue:i,rangeStartType:o,rangeEndType:r}=this.state;n===IB&&(this.editCell(t.businessObject,$B(i,e,o,r)),this.setState({rangeEndValue:e}))}renderComparison(e,t){const n=[{label:this._translate("Equals"),value:"equals"},{label:this._translate("Less"),value:"less"},{label:this._translate("Less or equals"),value:"lessEquals"},{label:this._translate("Greater"),value:"greater"},{label:this._translate("Greater or equals"),value:"greaterEquals"}];return vr(1,"div","comparison",[vr(1,"h4","dms-heading",this._translate("Value"),0),vr(1,"div","dms-fill-row",[yr(2,Z$,{label:this._translate("Comparison operator"),noInput:!0,onChange:this.onComparisonOperatorChange,options:n,value:e}),xr(" "),yr(2,hb,{label:this._translate("Value"),className:"comparison-number-input",onInput:this.onComparisonValueChange,type:"number",value:t})],4)],4)}renderRange(e,t,n,i){const o=[{label:this._translate("Include"),value:"include"},{label:this._translate("Exclude"),value:"exclude"}];return vr(1,"div","range",[vr(1,"h4","dms-heading",this._translate("Start value"),0),vr(1,"div","dms-fill-row",[yr(2,Z$,{label:this._translate("Start value"),noInput:!0,onChange:this.onRangeStartTypeChange,options:o,value:n}),xr(" "),yr(2,hb,{className:"range-start-number-input",onInput:this.onRangeStartValueChange,type:"number",value:e})],4),vr(1,"h4","dms-heading",this._translate("End value"),0),vr(1,"div","dms-fill-row",[yr(2,Z$,{label:this._translate("End value"),noInput:!0,onChange:this.onRangeEndTypeChange,options:o,value:i}),xr(" "),yr(2,hb,{className:"range-end-number-input",onInput:this.onRangeEndValueChange,type:"number",value:t})],4)],4)}render(){const{type:e,comparisonOperator:t,comparisonValue:n,rangeStartValue:i,rangeEndValue:o,rangeStartType:r,rangeEndType:s}=this.state,a=[{label:this._translate("Comparison"),value:jB},{label:this._translate("Range"),value:IB}];return vr(1,"div","context-menu-container simple-number-edit",[vr(1,"h3","dms-heading",this._translate("Edit number"),0),vr(1,"div","dms-fill-row",yr(2,Z$,{label:this._translate("Test type"),noInput:!0,onChange:this.onTypeChange,options:a,value:e}),2),e===jB&&this.renderComparison(t,n),e===IB&&this.renderRange(i,o,r,s)],0)}}class LB extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=PB(n.businessObject.text);this.state=i?{value:i.value}:{value:""};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onInput=this.onInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onInput(e){const{element:t}=this.props.context;this.debouncedEditCell(t.businessObject,e),this.setState({value:e})}render(){const{value:e}=this.state;return vr(1,"div","context-menu-container simple-number-edit",[vr(1,"h3","dms-heading",this._translate("Edit number"),0),vr(1,"h4","dms-heading",this._translate("Set value"),0),yr(2,hb,{onInput:this.onInput,type:"number",value:e})],4)}}class NB{constructor(e,t){t.registerProvider((e=>{const t=qB(e);return(dn(e.col)||pn(e.col))&&FB(t)})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if(FB(qB(e.element))){if(dn(e.element.col))return BB;if(pn(e.element.col))return LB}}}))}}function qB(e){return dn(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}NB.$inject=["components","simpleMode"];const VB=["number","integer","long","double"];function FB(e){return VB.includes(e)}var zB={__depends__:[yj,EI],__init__:["simpleNumberEdit"],simpleNumberEdit:["type",NB]};function QB(e){if(!e||HB(e.trim()))return{type:"disjunction",values:[]};let t=e.split(",");const n={type:"disjunction",values:[]};let i="";if(t.forEach((e=>{i+=e,/^"[^"]*"$/.test(i.trim())?(n.values.push(i.trim()),i=""):i+=","})),!i)return n;n.type="negation",n.values=[],i="";const o=e.match(/^\s*not\((.*)\)\s*$/);return o&&(t=o[1].split(","),t.forEach((e=>{i+=e,/^"[^"]*"$/.test(i.trim())?(n.values.push(i.trim()),i=""):i+=","})),!i)?n:void 0}function HB(e){return""===e}const WB="disjunction",UB="negation";class XB extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");let n=QB(e.context.element.businessObject.text);n||(n={values:[],type:WB});const i=function(e){const t=dn(e)?e.inputValues:e.outputValues;return!t||HB(t.text)?[]:t.text.split(",").map((e=>e.trim()))}(e.context.element.col.businessObject),o=n.values.filter((e=>!GB(i,e))),r=dn(e.context.element.col);let s=i.map((e=>({value:e,isChecked:GB(n.values,e),isRemovable:!1,group:this._translate("Predefined values")})));r&&(s=s.concat(o.map((e=>({value:e,isChecked:!0,isRemovable:!0,group:this._translate("Custom values")})))));let a="";r||!n.values.length||GB(i,n.values[0])||(a=n.values[0]),this.state={items:s,unaryTestsType:n.type,inputValue:a,isOutputValueInputChecked:""!==a};const l=t.injector.get("debounceInput");this.debouncedEditCell=l(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.addUnaryTestsListItem=this.addUnaryTestsListItem.bind(this),this.onInput=this.onInput.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onOutputValueInputClick=this.onOutputValueInputClick.bind(this),this.onUnaryTestsListChanged=this.onUnaryTestsListChanged.bind(this),this.onUnaryTestsTypeChange=this.onUnaryTestsTypeChange.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onUnaryTestsTypeChange(e){const{items:t}=this.state,n=KB(t),{element:i}=this.props.context;e===WB?(this.editCell(i.businessObject,n.join(",")),this.setState({unaryTestsType:WB})):(this.editCell(i.businessObject,`not(${n.join(",")})`),this.setState({unaryTestsType:UB}))}onUnaryTestsListChanged(e){const t=KB(e),{element:n}=this.props.context,{unaryTestsType:i}=this.state;i===WB?this.editCell(n.businessObject,t.join(",")):this.editCell(n.businessObject,`not(${t.join(",")})`),this.setState({items:e,isOutputValueInputChecked:!1})}onOutputValueInputClick(){const{element:e}=this.props.context,{inputValue:t,items:n}=this.state,i=QB(t);!i||i.values.length>1||(this.editCell(e.businessObject,`${i.values.join("")}`),this.setState({items:n.map((e=>(e.isChecked=!1,e))),isOutputValueInputChecked:!0}))}onInput({isValid:e,value:t}){const{isOutputValueInputChecked:n}=this.state;this.setState({inputValue:t});const{element:i}=this.props.context;!dn(i)&&e&&n&&this.debouncedEditCell(i.businessObject,t)}onKeyDown({isValid:e,event:t}){if(13!==t.keyCode)return;const{element:n}=this.props.context,i=dn(n.col);!i&&e||(t.stopPropagation(),t.preventDefault()),e&&(i?this.addUnaryTestsListItem():this.onOutputValueInputClick())}addUnaryTestsListItem(){const{inputValue:e,items:t,unaryTestsType:n}=this.state,i=QB(e);if(!i)return;const{element:o}=this.props.context,r=KB(t),s=[].concat(r,i.values);n===WB?this.editCell(o.businessObject,s.join(",")):this.editCell(o.businessObject,`not(${s.join(",")})`);const a=t.concat(i.values.map((e=>({value:e,isChecked:!0,isRemovable:!0,group:this._translate("Custom values")}))));this.setState({items:a,inputValue:""})}render(){const{element:e}=this.props.context,{inputValue:t,isOutputValueInputChecked:n,items:i,unaryTestsType:o}=this.state,r=[{label:this._translate("Match one"),value:WB},{label:this._translate("Match none"),value:UB}],s=dn(e.col),a=o===UB,l=!s&&i.length>0;return vr(1,"div","simple-string-edit context-menu-container",[vr(1,"h3","dms-heading",this._translate("Edit string"),0),s&&vr(1,"p",null,yr(2,Z$,{label:this._translate("String value"),noInput:!0,onChange:this.onUnaryTestsTypeChange,options:r,value:a?UB:WB},null,(e=>this.selectNode=e)),2),yr(2,oj,{onChange:this.onUnaryTestsListChanged,items:i,type:s?"checkbox":"radio"}),vr(1,"h4","dms-heading",s?this._translate("Add values"):this._translate("Set value"),0),vr(1,"div","dms-fill-row",[l&&vr(64,"input","cursor-pointer",null,1,{checked:n,onClick:this.onOutputValueInputClick,type:"radio",style:{marginRight:"8px"}}),yr(2,rj,{label:s?this._translate("Values"):this._translate("Value"),className:"dms-block",onKeyDown:this.onKeyDown,onInput:this.onInput,placeholder:s?this._translate('"value", "value", ...'):this._translate('"value"'),type:"text",validate:e=>{if(!QB(e))return this._translate("Strings must be in double quotes")},value:t})],0)],0)}}function KB(e){return e.filter((e=>e.isChecked)).map((e=>e.value))}function GB(e,t){return-1!==e.indexOf(t)}class YB{constructor(e,t){t.registerProvider((e=>(dn(e.col)||pn(e.col))&&"string"===ZB(e))),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if("string"===ZB(e.element))return XB}}))}}function ZB(e){return dn(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}YB.$inject=["components","simpleMode"];var JB={__depends__:[yj,EI],__init__:["simpleStringEdit"],simpleStringEdit:["type",YB]};const eL=/^(?:\d\d:){2}\d\d(?:Z|(?:[@+-][^")]+))?$/,tL=/^\[time\("([^"]*)"\)..time\("([^"]*)"\)\]$/,nL=/^(<|>)\s*time\("([^"]*)"\)$/,iL=/^time\("([^"]*)"\)$/;function oL(e){if(!eL.test(e.trim()))return"Time must match pattern hh:mm:ss[time zone]"}function rL(e,t){return"exact"===e?`time("${t[0]}")`:"before"===e?`< time("${t[0]}")`:"after"===e?`> time("${t[0]}")`:"between"===e?`[time("${t[0]}")..time("${t[1]}")]`:void 0}function sL(){return(new Date).toISOString().slice(11,-5)+"Z"}function aL(e){if(!e||""===e.trim())return{type:"exact",time:""};let t=e.match(tL);return t?{type:"between",times:[t[1],t[2]]}:(t=e.match(nL),t?{type:"<"===t[1]?"before":"after",time:t[2]}:(t=e.match(iL),t?{type:"exact",time:t[1]}:void 0))}const lL="exact",cL="between";class uL extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=aL(n.businessObject.text);if(i){let e;e=i.time?[i.time,""]:i.times?i.times:["",""],this.state={type:i.type,times:e}}else this.state={type:lL,times:["",""]};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onTypeChange=this.onTypeChange.bind(this),this.onSetStartTimeNowClick=this.onSetStartTimeNowClick.bind(this),this.onSetEndTimeNowClick=this.onSetEndTimeNowClick.bind(this),this.onStartTimeInput=this.onStartTimeInput.bind(this),this.onEndTimeInput=this.onEndTimeInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onTypeChange(e){const{element:t}=this.props.context,{times:n}=this.state;this.setState({type:e}),aL(rL(e,n))&&this.editCell(t.businessObject,rL(e,n))}onSetStartTimeNowClick(){const{element:e}=this.props.context,{times:t,type:n}=this.state,i=sL();this.setState({times:[i,t[1]]}),aL(rL(n,[i,t[1]]))&&this.editCell(e.businessObject,rL(n,[i,t[1]]))}onSetEndTimeNowClick(){const{element:e}=this.props.context,{times:t,type:n}=this.state,i=sL();this.setState({times:[t[0],i]}),aL(rL(n,[t[0],i]))&&this.editCell(e.businessObject,rL(n,[t[0],i]))}onStartTimeInput({value:e}){const{element:t}=this.props.context,{times:n,type:i}=this.state;this.setState({times:[e,n[1]]}),this.debouncedEditCell(t.businessObject,rL(i,[e,n[1]]))}onEndTimeInput({value:e}){const{element:t}=this.props.context,{times:n,type:i}=this.state;this.setState({times:[n[0],e]}),this.debouncedEditCell(t.businessObject,rL(i,[n[0],e]))}render(){const{times:e,type:t}=this.state,n=[{label:this._translate("Exactly"),value:lL},{label:this._translate("Before"),value:"before"},{label:this._translate("After"),value:"after"},{label:this._translate("Between"),value:cL}];return vr(1,"div","context-menu-container simple-time-edit",[vr(1,"h3","dms-heading",this._translate("Edit time"),0),vr(1,"div","dms-fill-row",yr(2,Z$,{label:this._translate("Time"),noInput:!0,onChange:this.onTypeChange,options:n,value:t}),2),vr(1,"h4","dms-heading",t===cL?this._translate("Edit start time"):this._translate("Set time"),0),vr(1,"div",null,[yr(2,rj,{label:this._translate("Start time"),className:"start-time-input dms-block",onInput:this.onStartTimeInput,placeholder:this._translate("e.g. { example } ",{example:LI()}),validate:e=>oL(e)&&this._translate(oL(e)),value:e[0]}),vr(1,"p","dms-hint",[vr(1,"button","use-now",this._translate("Use now"),0,{type:"button",onClick:this.onSetStartTimeNowClick}),xr(".")],4)],4),t===cL&&vr(1,"h4","dms-heading",this._translate("Edit end time"),0),t===cL&&vr(1,"div",null,[yr(2,rj,{label:this._translate("End time"),className:"end-time-input dms-block",onInput:this.onEndTimeInput,placeholder:this._translate("e.g. { example } ",{example:LI()}),validate:e=>oL(e)&&this._translate(oL(e)),value:e[1]}),vr(1,"p","dms-hint",[vr(1,"button","use-now",this._translate("Use now"),0,{type:"button",onClick:this.onSetEndTimeNowClick}),xr(".")],4)],4)],0)}}class hL extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._modeling=t.injector.get("modeling");const{element:n}=this.props.context,i=aL(n.businessObject.text);this.state={date:i?i.date:""};const o=t.injector.get("debounceInput");this.debouncedEditCell=o(this.editCell.bind(this)),this.editCell=this.editCell.bind(this),this.onClick=this.onClick.bind(this),this.onInput=this.onInput.bind(this)}editCell(e,t){this._modeling.editCell(e,t)}onClick(){const{element:e}=this.props.context,t=sL();this.setState({date:t}),this.editCell(e.businessObject,`time("${t}")`)}onInput({value:e}){const{element:t}=this.props.context;this.setState({date:e}),this.debouncedEditCell(t.businessObject,`time("${e}")`)}render(){const{date:e}=this.state;return vr(1,"div","context-menu-container simple-time-edit",[vr(1,"h3","dms-heading",this._translate("Edit time"),0),vr(1,"h4","dms-heading",this._translate("Set time"),0),vr(1,"div",null,[yr(2,rj,{label:this._translate("Time value"),onInput:this.onInput,placeholder:this._translate("e.g. { example } ",{example:LI()}),validate:e=>oL(e)&&this._translate(oL(e)),value:e,className:"dms-block"}),vr(1,"p","dms-hint",[vr(1,"button","use-now",this._translate("Use now"),0,{type:"button",onClick:this.onClick}),xr(".")],4)],4)],4)}}class dL{constructor(e,t){t.registerProvider((e=>{const t=pL(e);return(dn(e.col)||pn(e.col))&&fL(t)})),e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"simple-mode-edit"===e.contextMenuType){if(!e.element)return;if(fL(pL(e.element))){if(dn(e.element.col))return uL;if(pn(e.element.col))return hL}}}))}}function pL(e){return dn(e.col)?e.col&&e.col.businessObject.inputExpression.typeRef:e.col&&e.col.businessObject.typeRef}function fL(e){return"time"===e}dL.$inject=["components","simpleMode"];var gL={__depends__:[yj,EI],__init__:["simpleTimeEdit"],simpleTimeEdit:["type",dL]};class mL extends Ds{constructor(e,t){super(e,t),av(this)}componentDidMount(){const e=this.getRoot();this.changeSupport.onElementsChanged(e,this.onElementsChanged)}componentWillUnmount(){const e=this.getRoot();this.changeSupport.offElementsChanged(e,this.onElementsChanged)}getRoot(){return this.sheet.getRoot()}onElementsChanged=()=>{this.forceUpdate()};handleMouseDown=e=>{!function({node:e,event:t,minWidth:n,onEnd:i=vL}){t.preventDefault();const o=e.getBoundingClientRect().width,r=t.clientX;let s;function a(t){t.preventDefault();const n=c(t.clientX);s&&cancelAnimationFrame(s),s=requestAnimationFrame((()=>{e.style.width=n+"px"}))}function l(e){e.preventDefault(),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l);const t=c(e.clientX);i(t)}function c(e){const t=e-r;return Math.max(o+t,n)}document.addEventListener("mousemove",a),document.addEventListener("mouseup",l)}({node:Bt(e.target,"th",!1),event:e,minWidth:this.props.minWidth||150,onEnd:this.saveWidth})};saveWidth=e=>{const{col:t}=this.props,n={};hn(t,"dmn:DecisionTable")?n.annotationsWidth=e:n.width=e,this.modeling.updateProperties(t,n)};isLastInputOrOutput(){const{col:e}=this.props,t=fn(this.getRoot());if(hn(e,"dmn:InputClause")){const n=t.get("input");return n.indexOf(e)===n.length-1}if(hn(e,"dmn:OutputClause")){const n=t.get("output");return n.indexOf(e)===n.length-1}}render(){const e=this.isLastInputOrOutput()?{right:"-7px",width:"27px"}:null;return vr(1,"div","resize-column-handle",null,1,{onMouseDown:this.handleMouseDown,title:this.translate("Resize"),style:e})}}function vL(){}function yL(e){e.onGetComponent("cell-inner",((e={})=>{const{cellType:t}=e;if("input-cell"===t||"output-cell"===t||"annotations"===t)return mL}))}mL.$inject=["sheet","changeSupport","translate","modeling"],yL.$inject=["components"];var xL={__init__:["columnResizeProvider"],columnResizeProvider:["type",yL]};let bL=class e extends Yv{getModules(){return[...Yv._getModules(),...e._getModules()]}static _getModules(){return[lx,Cx,jy,Ux,Jy,Yx,tb,ob,cb,ax,xj,xL,Dj,Nj,Vj,jv,yj,Uj,sx,Gj,ry,yI,CI,ny,EI,AI,UI,cB,SB,zB,JB,gL,Bm]}};class _L{constructor(e){this._listeners={},e.on("elements.changed",(({elements:e})=>{this.elementsChanged(e)})),e.on("element.updateId",(({element:e,newId:t})=>{this.updateId(e.id,t)}))}elementsChanged(e){const t={},n=e.length;for(let i=0;i<n;i++){const{id:n}=e[i];if(t[n])return;t[n]=!0;const o=this._listeners[n]&&this._listeners[n].length;if(o)for(let e=0;e<o;e++)this._listeners[n][e]&&this._listeners[n][e]()}}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){const n=this._listeners[e].indexOf(t);-1!==n&&this._listeners[e].splice(n,1)}else this._listeners[e].length=0}updateId(e,t){this._listeners[e]&&(this._listeners[t]=this._listeners[e],delete this._listeners[e])}}_L.$inject=["eventBus"];class wL extends Ds{constructor(e){super(e);const t=this._injector=e.injector;this._changeSupport=t.get("changeSupport"),this._components=t.get("components"),this._renderer=t.get("renderer")}getChildContext(){return{changeSupport:this._changeSupport,components:this._components,renderer:this._renderer,injector:this._injector}}render(){const e=this._components.getComponents("viewer");return vr(1,"div","viewer-container",e&&e.map(((e,t)=>yr(2,e,null,t))),0)}}class CL{constructor(e,t,n,i,o){const{container:r}=n;this._container=r,i.on("renderer.mount",(()=>{Rs(yr(2,wL,{injector:o}),r)})),i.on("renderer.unmount",(()=>{Rs(null,r)}))}getContainer(){return this._container}}CL.$inject=["changeSupport","components","config.renderer","eventBus","injector"];var OL={__init__:["changeSupport","components","renderer"],changeSupport:["type",_L],components:["type",class{constructor(){this._listeners={}}getComponent(e,t){const n=this._listeners[e];if(!n)return;let i;for(let e=0;e<n.length&&(i=n[e].callback(t),!i);e++);return i}getComponents(e,t){const n=this._listeners[e];if(!n)return;const i=[];for(let e=0;e<n.length;e++){const o=n[e].callback(t);o&&i.push(o)}return i.length?i:void 0}onGetComponent(e,t,n){if(l(t)&&(n=t,t=1e3),!a(t))throw new Error("priority must be a number");const i=this._getListeners(e);let o,r;const s={priority:t,callback:n};for(r=0;o=i[r];r++)if(o.priority<t)return void i.splice(r,0,s);i.push(s)}offGetComponent(e,t){const n=this._getListeners(e);let i,o,r;if(t)for(r=n.length-1;i=n[r];r--)o=i.callback,o===t&&n.splice(r,1);else n.length=0}_getListeners(e){let t=this._listeners[e];return t||(this._listeners[e]=t=[]),t}}],eventBus:["type",j],renderer:["type",CL]};let kL=class{constructor(e={}){let{injector:t}=e;if(!t){let{modules:n,config:i}=this._init(e);t=function(e,t){const n=[{config:["value",e]},OL].concat(t||[]),i=new Sn(n);return i.init(),i}(i,n)}this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("viewer.init")}_init(e){let{modules:t,...n}=e;return{modules:t,config:n}}destroy(){this.get("eventBus").fire("viewer.destroy")}clear(){this.get("eventBus").fire("viewer.clear")}};let EL=class{constructor(e,t){this._eventBus=t,this._viewer=e}getDecision(){return this._viewer.getDecision()}updateId(e,t){if(e!==this.getDecision())throw new Error("element !== decision");this._eventBus.fire("element.updateId",{element:e,newId:t}),e.id=t}};EL.$inject=["viewer","eventBus"];var SL={__init__:["elementRegistry"],elementRegistry:["type",EL]};class RL extends Ds{constructor(e,t){super(e,t),this._viewer=t.injector.get("viewer")}render(){const{name:e}=this._viewer.getDecision();return vr(1,"div","decision-properties",vr(1,"h3","decision-name",e,0),2)}}let TL=class{constructor(e){e.onGetComponent("viewer",1500,(()=>RL))}};TL.$inject=["components"];var ML={__init__:["decisionProperties"],decisionProperties:["type",TL]};let AL=class extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._viewer=t.injector.get("viewer")}render(){const{decisionLogic:e,variable:t}=this._viewer.getDecision();return vr(1,"div","literal-expression-properties",vr(1,"table",null,[vr(1,"tr",null,[vr(1,"td",null,this._translate("Variable name:"),0),vr(1,"td",null,vr(1,"span",null,t.name||"-",0),2)],4),vr(1,"tr",null,[vr(1,"td",null,this._translate("Variable type:"),0),vr(1,"td",null,vr(1,"span",null,this._translate(t.typeRef||"")||"-",0),2)],4),vr(1,"tr",null,[vr(1,"td",null,this._translate("Expression language:"),0),vr(1,"td",null,vr(1,"span",null,e.expressionLanguage||"-",0),2)],4)],4),2)}};class PL{constructor(e){e.onGetComponent("viewer",500,(()=>AL))}}PL.$inject=["components"];var DL={__depends__:[],__init__:["literalExpressionProperties"],literalExpressionProperties:["type",PL]};let $L=class{constructor(e){e.onGetComponent("viewer",2e3,(()=>Bs))}};$L.$inject=["components"];var jL={__init__:["poweredBy"],poweredBy:["type",$L]};class IL extends Ds{constructor(e,t){super(e,t),this._viewer=t.injector.get("viewer")}render(){const{text:e}=this._viewer.getDecision().decisionLogic;return vr(1,"div","textarea",vr(1,"div","content",e,0),2)}}let BL=class{constructor(e){e.onGetComponent("viewer",(()=>IL))}};BL.$inject=["components"];var LL={__init__:["textarea"],textarea:["type",BL]};let NL=class extends Ds{constructor(e,t){super(e,t);const{injector:n}=t;this._translate=n.get("translate"),this._eventBus=n.get("eventBus")}onClick=()=>{this._eventBus.fire("showDrd")};render(){return vr(1,"div","view-drd",vr(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,(e=>this.node=e))}};NL.$inject=["translate"];let qL=class{constructor(e,t,n,i){this._injector=i,this._viewer=t,e.onGetComponent("viewer",2e3,(()=>{if(this.canViewDrd())return NL})),n.on("showDrd",(()=>{const e=i.get("_parent",!1),t=this.getDefinitions(),n=e.getView(t);e.open(n)}))}canViewDrd(){const e=this._injector.get("_parent",!1);if(!e)return;const t=this.getDefinitions();return!!e.getView(t)}getDefinitions(){return this._viewer.getDecision().$parent}};qL.$inject=["components","viewer","eventBus","injector"];var VL={__init__:["viewDrd"],viewDrd:["type",qL]};let FL=class e extends kL{constructor(t={}){const n=e._createContainer();super(M(t,{renderer:{container:n}})),this._container=n}open(e){var t=this;return new Promise((function(n,i){var o;try{t._decision&&(t.clear(),t.get("eventBus").fire("renderer.unmount")),t._decision=e,t.get("eventBus").fire("import",e),t.get("eventBus").fire("renderer.mount")}catch(e){o=e}o?(o.warnings=o.warnings||[],i(o)):n({warnings:[]})}))}_init(e){let{modules:t,additionalModules:n,...i}=e;return{modules:[...t||this.getModules(),...n||[],...[{viewer:["value",this]}]],config:i}}on(e,t,n,i){return this.get("eventBus").on(e,t,n,i)}off(e,t){this.get("eventBus").off(e,t)}_emit(e,t){return this.get("eventBus").fire(e,t)}getDecision(){return this._decision}attachTo(e){if(!e)throw new Error("parentNode required");this.detach(),e.appendChild(this._container),this._emit("attach",{})}detach(){const e=this._container;e.parentNode&&(this._emit("detach",{}),en(e))}destroy(){super.destroy(),this.detach()}getModules(){return e._getModules()}static _getModules(){return[SL,ha,ML,DL,jL,LL,VL]}static _createContainer(){return Gt('<div class="dmn-literal-expression-container"></div>')}};class zL extends Ds{constructor(e,t){super(e,t),this._viewer=t.injector.get("viewer"),this._modeling=t.injector.get("modeling"),this._translate=t.injector.get("translate"),this.setupChangeListeners({bind:this.getDecision().id})}componentWillUnmount(){this.setupChangeListeners({unbind:this.getDecision().id})}getDecision(){return this._viewer.getDecision()}onElementsChanged=()=>{this.forceUpdate()};setupChangeListeners({bind:e,unbind:t}){const{changeSupport:n}=this.context;"string"==typeof t&&n.offElementsChanged(t,this.onElementsChanged),"string"==typeof e&&n.onElementsChanged(e,this.onElementsChanged)}setDecisionName=e=>{this._modeling.editDecisionName(e)};render(){const{name:e}=this.getDecision();return vr(1,"header","decision-properties",yr(2,QL,{label:this._translate("Decision name"),className:"decision-name editor",value:e,onBlur:HL,onChange:this.setDecisionName}),2)}}class QL extends vx{render(){return vr(1,"h3",this.getClassName(),this.getEditor(),0)}}function HL(e){e.target.scroll(0,0)}class WL{constructor(e){e.onGetComponent("viewer",1500,(()=>zL))}}WL.$inject=["components"];var UL={__depends__:[wx,ha],__init__:["decisionProperties"],decisionProperties:["type",WL]};const XL="is not a registered action";let KL=class{constructor(e,t){this._actions={undo(){e.undo()},redo(){e.redo()}}}trigger(e,t){if(!this._actions[e])throw GL(e,XL);return this._actions[e](t)}register(e,t){if("string"==typeof e)return this._registerAction(e,t);p(e,((e,t)=>{this._registerAction(t,e)}))}_registerAction(e,t){if(this.isRegistered(e))throw GL(e,"is already registered");this._actions[e]=t}unregister(e){if(!this.isRegistered(e))throw GL(e,XL);this._actions[e]=void 0}isRegistered(e){return!!this._actions[e]}};function GL(e,t){return new Error(e+" "+t)}KL.$inject=["commandStack","eventBus"];var YL={__init__:["editorActions"],editorActions:["type",KL]};function ZL(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function JL(e){return e.shiftKey}var eN="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/pull/662";class tN{constructor(e,t,n,i){this._config=e||{},this._eventBus=t,this._editorActions=n,this._listeners=[],t.on("viewer.destroy",this._destroy),t.on("viewer.init",this._init),t.on("attach",(()=>{this._config.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(eN)),this._target=i.getContainer(),this._config&&!1!==this._config.bind&&this.bind()})),t.on("detach",this.unbind)}_init=()=>{this._registerDefaultBindings(),this._fire("init")};_destroy=()=>{this._fire("destroy"),this.unbind(),this._listeners=null};_keyHandler=e=>{var t,n,i=this._listeners,o=e.keyCode||e.charCode||-1;for(t=0;n=i[t];t++)if(n(o,e))return e.preventDefault(),void e.stopPropagation()};bind(e){e&&console.error("unsupported argument <node>",new Error(eN)),this.unbind(),e=this._node=this._target,zt.bind(e,"keydown",this._keyHandler,!0),this._fire("bind")}getBinding(){return this._node}unbind=()=>{var e=this._node;e&&(this._fire("unbind"),zt.unbind(e,"keydown",this._keyHandler,!0)),this._node=null};_fire(e){this._eventBus.fire("keyboard."+e,{node:this._node,listeners:this._listeners})}_registerDefaultBindings(){var e=this._listeners,t=this._editorActions;e.push((function(e,n){if(ZL(n)&&!JL(n)&&90===e)return t.trigger("undo"),!0})),e.push((function(e,n){if(ZL(n)&&(89===e||90===e&&JL(n)))return t.trigger("redo"),!0}))}addListener(e){this._listeners.unshift(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}}tN.$inject=["config.keyboard","eventBus","editorActions","renderer"];var nN={__depends__:[YL],__init__:["keyboard"],keyboard:["type",tN]};class iN extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._viewer=t.injector.get("viewer"),this._modeling=t.injector.get("modeling"),this._dataTypes=t.injector.get("dataTypes"),this._eventBus=t.injector.get("eventBus");const n=this._viewer.getDecision();this.state={name:n.variable.name,typeRef:n.variable.typeRef},this.setVariableName=this.setVariableName.bind(this),this.setVariableType=this.setVariableType.bind(this)}setVariableName(e){this._modeling.editVariableName(e),this.setState({name:e})}componentWillMount(){this._eventBus.on("elements.changed",this.onChange)}componentWillUnmount(){this._eventBus.off("elements.changed",this.onChange)}onChange=()=>{const e=this._viewer.getDecision();e.variable&&this.setState({name:e.variable.name})};setVariableType(e){""===e?(this._modeling.editVariableType(void 0),this.setState({typeRef:void 0})):(this._modeling.editVariableType(e),this.setState({typeRef:e}))}render(){const{name:e,typeRef:t}=this.state,n=this._dataTypes.getAll().map((e=>({label:this._translate(e),value:e})));return vr(1,"div","literal-expression-properties",vr(1,"table","variables-table",[vr(1,"tr",null,[vr(1,"td",null,this._translate("Variable name:"),0),vr(1,"td",null,yr(2,hb,{label:this._translate("Variable name"),className:"variable-name-input",onInput:this.setVariableName,placeholder:this._translate("name"),value:e||""}),2)],4),vr(1,"tr",null,[vr(1,"td",null,this._translate("Variable type:"),0),vr(1,"td",null,vr(1,"div","dms-fill-row",yr(2,Z$,{label:this._translate("Variable type"),onChange:this.setVariableType,options:n,value:t,className:"variable-type-select dms-block"}),2),2)],4),yr(2,oN)],4),2)}}class oN extends Ds{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),this._viewer=t.injector.get("viewer"),this._modeling=t.injector.get("modeling"),this._expressionLanguages=t.injector.get("expressionLanguages"),this.setExpressionLanguage=this.setExpressionLanguage.bind(this)}setExpressionLanguage(e){""===e?this._modeling.editExpressionLanguage(void 0):this._modeling.editExpressionLanguage(e)}_getExpressionLanguage(){const e=this._viewer.getDecision().decisionLogic;return e&&e.expressionLanguage?e.expressionLanguage.toLowerCase():this._getDefaultExpressionLanguage()}_getDefaultExpressionLanguage(){return this._expressionLanguages.getDefault().value}_shouldRender(){if(this._expressionLanguages.getAll().length>1)return!0;return this._getExpressionLanguage()!==this._getDefaultExpressionLanguage()}render(){if(!this._shouldRender())return null;const e=this._getExpressionLanguage(),t=this._expressionLanguages.getAll();return vr(1,"tr",null,[vr(1,"td",null,this._translate("Expression language:"),0),vr(1,"td",null,vr(1,"div","dms-fill-row",yr(2,Z$,{label:this._translate("Expression language"),onChange:this.setExpressionLanguage,options:t,value:e,className:"expression-language-select dms-block"}),2),2)],4)}}class rN{constructor(e){e.onGetComponent("viewer",500,(()=>iN))}}rN.$inject=["components"];var sN={__depends__:[wx,nN,jv,ib],__init__:["literalExpressionProperties"],literalExpressionProperties:["type",rN]};let aN=class e{constructor(e,t,n){this._commandStack=e,this._viewer=t,this._eventBus=n,n.on("viewer.init",(()=>{!function(e,t){p(e,(function(e,n){t.registerHandler(n,e)}))}(this.getHandlers(),e)}))}getHandlers(){return e._getHandlers()}static _getHandlers(){return{"element.updateProperties":dI}}getDecision(){return this._viewer.getDecision()}editDecisionName(e){const t={element:this.getDecision(),properties:{name:e}};this._commandStack.execute("element.updateProperties",t)}editDecisionId(e){const t={element:this.getDecision(),properties:{id:e}};this._commandStack.execute("element.updateProperties",t)}editLiteralExpressionText(e){const t={element:this.getDecision().decisionLogic,properties:{text:e}};this._commandStack.execute("element.updateProperties",t)}editExpressionLanguage(e){const t={element:this.getDecision().decisionLogic,properties:{expressionLanguage:e}};this._commandStack.execute("element.updateProperties",t)}editVariableName(e){const t={element:this.getDecision().variable,properties:{name:e}};this._commandStack.execute("element.updateProperties",t)}editVariableType(e){const t={element:this.getDecision().variable,properties:{typeRef:e}};this._commandStack.execute("element.updateProperties",t)}updateProperties(e,t){const n={element:e,properties:t};this._commandStack.execute("element.updateProperties",n)}};aN.$inject=["commandStack","viewer","eventBus"];var lN={__init__:["idChangeBehavior","nameChangeBehavior","modeling"],commandStack:["type",bp],idChangeBehavior:["type",qp],nameChangeBehavior:["type",Vp],modeling:["type",aN]};let cN=class extends Ds{constructor(e,t){super(e,t),this._modeling=t.injector.get("modeling"),this._viewer=t.injector.get("viewer"),this._expressionLanguages=t.injector.get("expressionLanguages"),this._variableResolver=t.injector.get("variableResolver",!1),this._translate=t.injector.get("translate"),this.editLiteralExpressionText=this.editLiteralExpressionText.bind(this),this.onElementsChanged=this.onElementsChanged.bind(this);const{id:n}=this.getLiteralExpression();t.changeSupport.onElementsChanged(n,this.onElementsChanged)}getLiteralExpression(){return this._viewer.getDecision().decisionLogic}onElementsChanged(){this.forceUpdate()}editLiteralExpressionText(e){this._modeling.editLiteralExpressionText(e)}getEditor(){return this.isFeel()?uN:hN}isFeel(){return"feel"===this.getExpressionLanguage()}getExpressionLanguage(){return this.getLiteralExpression().expressionLanguage||this._expressionLanguages.getDefault().value}_getVariables(){const e=this.getLiteralExpression();return this._variableResolver&&this._variableResolver.getVariables(e)}render(){const{text:e}=this.getLiteralExpression(),t=this.getEditor(),n=this._getVariables();return yr(2,t,{label:this._translate("Literal expression editor"),className:"textarea editor",value:e,onChange:this.editLiteralExpressionText,variables:n})}},uN=class extends Ds{render(){return yr(2,U$,{label:this.props.label,className:this.props.className,value:this.props.value,onInput:this.props.onChange,variables:this.props.variables})}},hN=class extends vx{render(){return vr(1,"div",this.getClassName(),this.getEditor(),0)}};class dN{constructor(e){e.onGetComponent("viewer",(()=>cN))}}dN.$inject=["components"];var pN={__depends__:[wx,ha],__init__:["textarea"],textarea:["type",dN]};let fN=class e extends FL{getModules(){return[...FL._getModules(),...e._getModules()]}static _getModules(){return[UL,nN,sN,lN,jv,ob,pN,Bm]}};function gN(e,{injector:t}){const n=t.get("components").getComponents("header");return vr(1,"div","dmn-boxed-expression-section dmn-boxed-expression-header",n&&n.map(((e,t)=>yr(2,e,null,t))),0)}function mN(e,{injector:t}){const n=t.get("components").getComponents("body");return vr(1,"div","dmn-boxed-expression-section dmn-boxed-expression-body",n&&n.map(((e,t)=>yr(2,e,null,t))),0)}function vN(e,{injector:t}){const n=t.get("components").getComponents("footer");return vr(1,"div","dmn-boxed-expression-section dmn-boxed-expression-footer",n&&n.map(((e,t)=>yr(2,e,null,t))),0)}var yN={__init__:["viewRenderer","tableJsSupport"],viewRenderer:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("viewer",(()=>gN)),e.onGetComponent("viewer",(()=>mN)),e.onGetComponent("viewer",(()=>vN))}}],tableJsSupport:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("viewer",(()=>{const t=e.getComponents("table.before")||[];return()=>vr(1,"div",null,t.map(((e,t)=>yr(2,e,null,t))),0)}))}}]};class xN{constructor(e){e.onGetComponent("viewer",2e3,(()=>Bs))}}xN.$inject=["components"];var bN={__init__:["poweredBy"],poweredBy:["type",xN]};function _N({expression:e},t){return vr(1,"div","textarea",vr(1,"div","content",t.injector.get("literalExpression").getText(e),0),2)}class wN{getText(e){return e.get("text")}}var CN={__init__:["literalExpressionComponent"],literalExpressionComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("expression",(({expression:e})=>{if(hn(e,"dmn:LiteralExpression"))return _N}))}}],literalExpression:["type",wN]};class ON{getParameters(e){return e.get("formalParameter")}getBody(e){return e.get("body")}getKind(e){return e.get("kind")||"FEEL"}}function kN({expression:e},t){const n=t.injector.get("functionDefinition"),i=n.getKind(e),o=n.getParameters(e),r=n.getBody(e);return vr(1,"div","function-definition",[yr(2,SN,{kind:i}),yr(2,RN,{parameters:o}),yr(2,MN,{expression:r})],4)}const EN={FEEL:"F",Java:"J",PMML:"P"};function SN({kind:e},t){const n=t.injector.get("translate");return vr(1,"div","function-definition-kind",EN[e],0,{title:n("Function kind: {kind}",{kind:e})})}function RN({parameters:e}){return vr(1,"div","function-definition-parameters",vr(1,"div",null,[xr("("),e.reduce(((e,t)=>e.concat(yr(2,TN,{parameter:t}),", ")),[]).slice(0,-1),xr(")")],0),2)}function TN({parameter:e}){const{name:t,typeRef:n}=e,i=t||"<unnamed>";return vr(1,"span",null,n?`${i}: ${n}`:i,0)}function MN({expression:e},t){return vr(1,"div","function-definition-body",yr(2,t.components.getComponent("expression",{expression:e}),{expression:e}),2)}var AN={__init__:["functionDefinitionComponent"],functionDefinition:["type",ON],functionDefinitionComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("expression",(({expression:e})=>{if(hn(e,"dmn:FunctionDefinition"))return kN}))}}]};class PN extends Ds{constructor(e,t){super(e,t);const{injector:n}=t;this._translate=n.get("translate"),this._eventBus=n.get("eventBus")}onClick=()=>{this._eventBus.fire("showDrd")};render(){return vr(1,"div","view-drd",vr(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,(e=>this.node=e))}}PN.$inject=["translate"];class DN{constructor(e,t,n){this._injector=n,e.onGetComponent("viewer",2e3,(()=>{if(this.canViewDrd())return PN})),t.on("showDrd",(()=>{const e=n.get("_parent",!1),t=e.getDefinitions(),i=e.getView(t);e.open(i)}))}canViewDrd(){const e=this._injector.get("_parent",!1);if(!e)return;const t=e.getDefinitions();return!!e.getView(t)}}DN.$inject=["components","eventBus","injector"];var $N={__init__:["viewDrd"],viewDrd:["type",DN]};function jN(e,t){const n=t.injector.get("viewer"),{name:i}=n.getRootElement();return vr(1,"div","element-properties",vr(1,"h2","element-name",i,0),2)}class IN{constructor(e){e.onGetComponent("header",(()=>jN))}}IN.$inject=["components"];var BN={__init__:["elementProperties"],elementProperties:["type",IN]};function LN(e,{injector:t}){const n=t.get("components"),i=function(e){if(hn(e,"dmn:Decision"))return e.get("decisionLogic");if(hn(e,"dmn:BusinessKnowledgeModel"))return e.get("encapsulatedLogic")}(t.get("viewer").getRootElement());return yr(2,n.getComponent("expression",{expression:i}),{expression:i})}function NN({expression:e}){return vr(1,"div",null,vr(1,"span",null,[xr("Expression of type "),e.$type,xr(" is not supported.")],0,{style:"color:red;"}),2)}var qN={__init__:["elementLogic"],elementLogic:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("body",(()=>LN)),e.onGetComponent("expression",100,(()=>NN))}}]};class VN{static $inject=["viewer"];constructor(e){this._viewer=e}getName(){const e=this.getVariable(),t=this._getElement();return(e?e.get("name"):null)||t.get("name")}getType(){const e=this.getVariable();return e?e.get("typeRef"):"Any"}_getElement(){return this._viewer.getRootElement()}getVariable(){return this._getElement().get("variable")}}function FN(e,t){const n=t.injector.get("elementVariable"),i=t.injector.get("translate"),o=n.getName(),r=n.getType();return vr(1,"div","element-variable",[vr(1,"h2",null,xr("Result"),2),vr(1,"div","element-variable-name",[vr(1,"span","element-variable-name-label",i("Variable name"),0),vr(1,"span",null,o,0)],4),vr(1,"div","element-variable-type",[vr(1,"span","element-variable-type-label",i("Variable type"),0),vr(1,"span",null,r,0)],4)],4)}var zN={__init__:["elementVariableComponent"],elementVariable:["type",VN],elementVariableComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("footer",(()=>FN))}}]};class QN extends kL{constructor(e={}){const t=QN._createContainer();super(M(e,{renderer:{container:t}})),this._container=t}open(e){const t=this.get("eventBus");return new Promise(((n,i)=>{let o;try{this.getRootElement()&&(this.clear(),t.fire("renderer.unmount")),this._setRootElement(e),t.fire("import",e),t.fire("renderer.mount")}catch(e){o=e}o?(o.warnings=o.warnings||[],i(o)):n({warnings:[]})}))}_init(e){let{modules:t,additionalModules:n,...i}=e;return{modules:[...t||this.getModules(),...n||[],...[{viewer:["value",this]}]],config:i}}on(e,t,n,i){return this.get("eventBus").on(e,t,n,i)}off(e,t){this.get("eventBus").off(e,t)}_emit(e,t){return this.get("eventBus").fire(e,t)}getRootElement(){return this._root}_setRootElement(e){this._root=e}attachTo(e){if(!e)throw new Error("parentNode required");this.detach(),e.appendChild(this._container),this._emit("attach",{})}detach(){const e=this._container;e.parentNode&&(this._emit("detach",{}),en(e))}destroy(){super.destroy(),this.detach()}getModules(){return[yN,ha,bN,$N,BN,qN,AN,CN,zN]}static _createContainer(){return Gt('<div class="dmn-boxed-expression-container"></div>')}}var HN={__depends__:[sp],__init__:["keyboardBindings"],keyboardBindings:["type",class{static $inject=["editorActions","keyboard"];constructor(e,t){this.registerBindings(t,e)}registerBindings(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}n("undo",(function(e){if(ml(e.keyEvent))return t.trigger("undo"),!0})),n("redo",(function(e){if(vl(e.keyEvent))return t.trigger("redo"),!0}))}}]};function WN(e){return e.$parent}class UN{constructor(e,t,n){this._commandStack=e,this._viewer=t,this._eventBus=n,function(e,t){p(e,(function(e,n){t.registerHandler(n,e)}))}(this._getHandlers(),e)}_getHandlers(){return{"element.updateProperties":dI}}updateProperties(e,t){const n={element:e,properties:t};this._commandStack.execute("element.updateProperties",n)}}UN.$inject=["commandStack","viewer","eventBus"];var XN={__init__:["idChangeBehavior","modeling","nameChangeBehavior"],commandStack:["type",bp],idChangeBehavior:["type",qp],modeling:["type",UN],nameChangeBehavior:["type",class extends Gd{static $inject=["eventBus","modeling"];constructor(e,t){super(e),this._modeling=t,this.postExecuted("element.updateProperties",this.updateName)}updateName=({context:e})=>{const{element:t,properties:n}=e;this.isNameChanged(n)&&(this.isVariable(t)?this.handleVariableNameChange(t):this.isVariableContainer(t)&&this.handleVariableContainerNameChange(t))};isNameChanged(e){return"name"in e}isVariable(e){const t=WN(e);return hn(e,"dmn:InformationItem")&&t&&t.get("variable")===e}isVariableContainer(e){const t=e.get("variable");return t&&hn(t,"dmn:InformationItem")}handleVariableNameChange(e){const t=WN(e),n=e.get("name");n!==t.get("name")&&this._modeling.updateProperties(t,{name:n})}handleVariableContainerNameChange(e){const t=e.get("variable"),n=e.get("name");t&&n!==t.get("name")&&this._modeling.updateProperties(t,{name:n})}}]};function KN(e,t){return function(n){return br(yr(2,GN,{...n,_component:e,_selectDependencies:t}))}}class GN extends Ds{constructor(e,t){super(e,t),this._eventBus=t.injector.get("eventBus")}componentDidMount(){this._subscribe()}componentWillUnmount(){this._unsubscribe()}_subscribe(){this._eventBus.on("elements.changed",this.onChange)}_unsubscribe(){this._eventBus.off("elements.changed",this.onChange)}onChange=({elements:e})=>{this.props._selectDependencies(this.props).some((t=>e.includes(t)))&&this.forceUpdate()};render(){return br(yr(2,this.props._component,{...this.props}))}}function YN(e){return br(yr(2,U$,{...e,onChange:e.onChange}))}class ZN extends vx{render(){return vr(1,"div",this.getClassName(),this.getEditor(),0)}}const JN=KN(class extends Ds{constructor(e,t){super(e,t),this._literalExpression=t.injector.get("literalExpression"),this._translate=t.injector.get("translate"),this._expressionLanguages=t.injector.get("expressionLanguages"),this._variableResolver=t.injector.get("variableResolver",!1)}getLiteralExpression(){return this.props.expression}editLiteralExpressionText=e=>{const t=this.getLiteralExpression();this._literalExpression.setText(t,e)};getEditor(){return this.isFeel()?YN:ZN}isFeel(){return function(e){for(let t=e;t;t=t.$parent){const e=t.get("expressionLanguage");if(e)return!("https://www.omg.org/spec/DMN/20191111/FEEL/"!==e&&!/feel/i.test(e));if(hn(t,"dmn:FunctionDefinition"))return"FEEL"===(t.get("kind")||"FEEL")}return!0}(this.getLiteralExpression())}_getVariables(){const e=this.getLiteralExpression();return this._variableResolver&&this._variableResolver.getVariables(e)}render(){const{text:e}=this.getLiteralExpression(),t=this.getEditor(),n=this._getVariables();return yr(2,t,{label:this._translate("Literal expression"),className:"textarea editor",value:e,onChange:this.editLiteralExpressionText,variables:n})}},(e=>[e.expression]));class eq extends wN{constructor(e){super(),this._modeling=e}setText(e,t){this._modeling.updateProperties(e,{text:t})}}eq.$inject=["modeling"];var tq={__init__:["literalExpressionComponent"],literalExpressionComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("expression",(({expression:e})=>{if(hn(e,"dmn:LiteralExpression"))return JN}))}}],literalExpression:["type",eq]};function nq({label:e,onClick:t}){return vr(1,"button","edit-button dmn-icon-edit",null,1,{"aria-label":e,type:"button",onClick:t})}const iq=KN((function({expression:e},t){const n=t.injector.get("functionDefinition"),i=t.injector.get("contextMenu"),o=n.getKind(e),r=n.getParameters(e),s=n.getBody(e);return vr(1,"div","function-definition",[yr(2,rq,{kind:o,openEditor:t=>{const n=cq(t);i.open(n,{contextMenuType:"kind-editor",expression:e})}}),yr(2,sq,{parameters:r,openEditor:t=>{const n=cq(t);i.open(n,{contextMenuType:"formal-parameters-editor",expression:e})}}),yr(2,lq,{expression:s,parameters:r})],4)}),(e=>[e.expression]));const oq={FEEL:"F",Java:"J",PMML:"P"};function rq({kind:e,openEditor:t},n){const i=n.injector.get("translate");return vr(1,"div","function-definition-kind",[oq[e],yr(2,nq,{label:i("Edit function kind"),onClick:t})],0)}function sq({openEditor:e,parameters:t},n){const i=n.injector.get("translate");return vr(1,"div","function-definition-parameters",[vr(1,"div",null,[xr("("),t.reduce(((e,t)=>e.concat(yr(2,aq,{parameter:t}),", ")),[]).slice(0,-1),xr(")")],0),yr(2,nq,{label:i("Edit formal parameters"),onClick:e})],4)}const aq=KN((function({parameter:e}){const{name:t,typeRef:n}=e,i=t||"<unnamed>";return vr(1,"span",null,n?`${i}: ${n}`:i,0)}),(e=>[e.parameter]));const lq=KN((function({expression:e,parameters:t},n){return vr(1,"div","function-definition-body",yr(2,n.components.getComponent("expression",{expression:e}),{expression:e,parameters:t}),2)}),(e=>e.parameters));function cq(e){const t=e.target.parentElement.getBoundingClientRect();return{x:t.x,y:t.y}}const uq=[{value:"FEEL",label:"FEEL"},{value:"Java",label:"Java"},{value:"PMML",label:"PMML"}];function hq({context:{expression:e}},t){const n=t.injector.get("functionDefinition"),i=t.injector.get("translate"),o=n.getKind(e);return vr(1,"div","context-menu-container",[vr(1,"h3",null,i("Edit function kind"),0),yr(2,Z$,{label:i("Kind"),options:uq,value:o,onChange:t=>{n.setKind(e,t)},noInput:!0})],4)}const dq=KN((function({context:{expression:e}},t){const n=t.injector.get("functionDefinition"),i=t.injector.get("translate"),o=n.getParameters(e);return vr(1,"div","context-menu-container formal-parameters",[vr(1,"h3",null,i("Edit formal parameters"),0),o.length?vr(1,"table",null,[vr(1,"thead",null,vr(1,"tr",null,[vr(1,"th",null,xr("Name"),2),vr(1,"th",null,xr("Type"),2)],4),2),vr(1,"tbody",null,o.map(((t,i)=>yr(2,pq,{parameter:t,remove:()=>(t=>{n.removeParameter(e,t)})(t)},i))),0)],4):null,vr(1,"button","add-parameter",i("Add parameter"),0,{type:"button",onClick:()=>{n.addParameter(e)}})],0)}),(e=>[e.context.expression]));const pq=KN((function({parameter:e,remove:t},n){const i=n.injector.get("dataTypes"),o=n.injector.get("translate"),r=n.injector.get("functionDefinition"),{name:s,typeRef:a}=e,l=i.getAll().map((e=>({label:o(e),value:e})));return vr(1,"tr","function-definition-parameter",[vr(1,"td",null,yr(2,hb,{onChange:t=>{r.updateParameter(e,{name:t})},value:s}),2),vr(1,"td",null,yr(2,Z$,{onChange:t=>{r.updateParameter(e,{typeRef:t})},value:a,options:l}),2),vr(1,"td",null,vr(1,"button","dmn-icon-trash",null,1,{type:"button",onClick:t,"aria-label":o("Remove parameter")}),2)],4)}),(e=>[e.parameter]));var fq={__init__:["formalParametersEditorComponent","functionDefinitionComponent","kindEditorComponent"],__depends__:[Ux],formalParametersEditorComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"formal-parameters-editor"===e.contextMenuType)return dq}))}}],functionDefinition:["type",class extends ON{static $inject=["modeling","dmnFactory"];constructor(e,t){super(),this._modeling=e,this._dmnFactory=t}addParameter(e){this._modeling.updateProperties(e,{formalParameter:[...this.getParameters(e),this._dmnFactory.create("dmn:InformationItem",{name:"",typeRef:""})]})}removeParameter(e,t){this._modeling.updateProperties(e,{formalParameter:this.getParameters(e).filter((e=>e!==t))})}updateParameter(e,t){this._modeling.updateProperties(e,t)}setKind(e,t){this._modeling.updateProperties(e,{kind:t})}}],functionDefinitionComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("expression",(({expression:e})=>{if(hn(e,"dmn:FunctionDefinition"))return iq}))}}],kindEditorComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("context-menu",((e={})=>{if(e.contextMenuType&&"kind-editor"===e.contextMenuType)return hq}))}}]};const gq=KN((function(e,t){const{element:n}=e,i=t.injector.get("modeling"),o=t.injector.get("translate"),r=n.get("name");return yr(2,hb,{label:o("Element name"),className:"element-name editor",value:r,onChange:e=>{i.updateProperties(n,{name:e})}})}),(e=>[e.element]));function mq(e,t){const n=t.injector.get("viewer").getRootElement();return vr(1,"div","element-properties",yr(2,gq,{element:n}),2)}class vq{constructor(e){e.onGetComponent("header",(()=>mq))}}vq.$inject=["components"];var yq={__depends__:[wx],__init__:["elementProperties"],elementProperties:["type",vq]};class xq{constructor(e,t){this._eventBus=t,this._viewer=e}updateId(e,t){if(e!==this._viewer.getRootElement())throw new Error("element !== rootElement");this._eventBus.fire("element.updateId",{element:e,newId:t}),e.id=t}}xq.$inject=["viewer","eventBus"];var bq={__init__:["elementRegistry"],elementRegistry:["type",xq],dmnFactory:["type",class{static $inject=["moddle"];constructor(e){this._moddle=e}create(e,t={}){return this._moddle.create(e,t)}}]};const _q="dmn-boxed-expression-variable-type";function wq(e,t){const n=t.injector.get("elementVariable"),i=t.injector.get("translate"),o=n.getName();return vr(1,"div","element-variable",[vr(1,"h2",null,xr("Result"),2),vr(1,"div","element-variable-name",[vr(1,"span","element-variable-name-label",i("Variable name"),0),vr(1,"span",null,o,0)],4),vr(1,"div","element-variable-type",[vr(1,"label","element-variable-type-label",xr("Result type"),2,{for:_q}),yr(2,Cq)],4)],4)}function Cq(e,t){const n=t.injector.get("elementVariable"),i=t.injector.get("dataTypes"),o=t.injector.get("translate"),r=n.getType(),s=i.getAll().map((e=>({label:o(e),value:e})));return yr(2,Z$,{value:r,onChange:e=>n.setType(e),options:s,id:_q})}var Oq={__init__:["elementVariableComponent"],elementVariable:["type",class extends VN{static $inject=["viewer","modeling","dmnFactory"];constructor(e,t,n){super(e),this._modeling=t,this._dmnFactory=n}setType(e){const t=this.getVariable();if(t)this._modeling.updateProperties(t,{typeRef:e});else{const t=this._getElement();this._modeling.updateProperties(t,{variable:this._dmnFactory.create("dmn:InformationItem",{name:t.get("name"),typeRef:e})})}}}],elementVariableComponent:["type",class{static $inject=["components","elementVariable"];constructor(e,t){const n=KN(wq,(()=>[t.getVariable()]));e.onGetComponent("footer",(()=>n))}}]};const kq="is not a registered action";class Eq{constructor(e,t){this._actions={undo(){e.undo()},redo(){e.redo()}}}trigger(e,t){if(!this._actions[e])throw Sq(e,kq);return this._actions[e](t)}register(e,t){if("string"==typeof e)return this._registerAction(e,t);p(e,((e,t)=>{this._registerAction(t,e)}))}_registerAction(e,t){if(this.isRegistered(e))throw Sq(e,"is already registered");this._actions[e]=t}unregister(e){if(!this.isRegistered(e))throw Sq(e,kq);this._actions[e]=void 0}isRegistered(e){return!!this._actions[e]}}function Sq(e,t){return new Error(e+" "+t)}Eq.$inject=["commandStack","eventBus"];var Rq={__init__:["editorActions"],editorActions:["type",Eq]};class Tq extends QN{getModules(){return[...super.getModules(),bq,XN,Rq,yq,fq,jv,tq,HN,ob,Oq,Bm]}}return class extends vn{_getViewProviders(){return[{id:"drd",constructor:Sm,opens:"dmn:Definitions"},{id:"decisionTable",constructor:bL,opens:e=>hn(e,"dmn:Decision")&&hn(e.decisionLogic,"dmn:DecisionTable")},{id:"literalExpression",constructor:fN,opens:e=>hn(e,"dmn:Decision")&&hn(e.decisionLogic,"dmn:LiteralExpression")},{id:"boxedExpression",constructor:Tq,opens:e=>hn(e,"dmn:BusinessKnowledgeModel")&&mn(e)}]}_getInitialView(e,...t){let n=super._getInitialView(e,...t);if(!n)return;const i=n.element;return hn(i,"dmn:Definitions")&&!Fd(i)&&(n=h(e,(e=>!hn(e.element,"dmn:Definitions")))||n),n}}})); 21 var t,n;this._container=this._createContainer(),t=this._container,n=xn('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" style="position global() function
|
/plugin/ol3/ |
H A D | script.js | 8 …Cy=Ty;var Oy=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instance…
|
/plugin/mermaid/ |
H A D | mermaid.min.js | 329 `)},"setAccDescription"),Lr=o(()=>tS,"getAccDescription"),nn=o(t=>{eS=rS(t)},"setDiagramTitle"),Xr=o(()=>eS,"getDiagramTitle")});var R$,Gbe,de,iS,_4,$be,aS,Vbe,A4,Jf,cy,nS,_t=R(()=>{"use strict";Hf();ut();qs();rr();Yn();Z7();bi();R$=V,Gbe=$1,de=Or,iS=Zb,_4=uh,$be=o(t=>qr(t,de()),"sanitizeText"),aS=Lo,Vbe=o(()=>ly,"getCommonDb"),A4={},Jf=o((t,e,r)=>{A4[t]&&R$.warn(`Diagram with id ${t} already registered. Overwriting.`),A4[t]=e,r&&$C(t,r),L$(t,e.styles),e.injectUtils?.(R$,Gbe,de,$be,aS,Vbe(),()=>{})},"registerDiagram"),cy=o(t=>{if(t in A4)return A4[t];throw new nS(t)},"getDiagram"),nS=class extends Error{static{o(this,"DiagramNotFoundError")}constructor(e){super(`Diagram ${e} not found.`)}}});var ul,vh,ja,cl,nc,uy,sS,oS,L4,D4,N$,Ube,Hbe,Ybe,Wbe,qbe,Xbe,jbe,Kbe,Qbe,Zbe,Jbe,e4e,t4e,r4e,n4e,i4e,a4e,M$,s4e,o4e,I$,l4e,c4e,u4e,h4e,xh,f4e,d4e,p4e,m4e,g4e,hy,lS=R(()=>{"use strict";_t();rr();bi();ul=[],vh=[""],ja="global",cl="",nc=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],uy=[],sS="",oS=!1,L4=4,D4=2,Ube=o(function(){return N$},"getC4Type"),Hbe=o(function(t){N$=qr(t,de())},"setC4Type"),Ybe=o(function(t,e,r,n,i,a,s,l,u){if(t==null||e===void 0||e===null||r===void 0||r===null||n===void 0||n===null)return;let h={},f=uy.find(d=>d.from===e&&d.to===r);if(f?h=f:uy.push(h),h.type=t,h.from=e,h.to=r,h.label={text:n},i==null)h.techn={text:""};else if(typeof i=="object"){let[d,p]=Object.entries(i)[0];h[d]={text:p}}else h.techn={text:i};if(a==null)h.descr={text:""};else if(typeof a=="object"){let[d,p]=Object.entries(a)[0];h[d]={text:p}}else h.descr={text:a};if(typeof s=="object"){let[d,p]=Object.entries(s)[0];h[d]=p}else h.sprite=s;if(typeof l=="object"){let[d,p]=Object.entries(l)[0];h[d]=p}else h.tags=l;if(typeof u=="object"){let[d,p]=Object.entries(u)[0];h[d]=p}else h.link=u;h.wrap=xh()},"addRel"),Wbe=o(function(t,e,r,n,i,a,s){if(e===null||r===null)return;let l={},u=ul.find(h=>h.alias===e);if(u&&e===u.alias?l=u:(l.alias=e,ul.push(l)),r==null?l.label={text:""}:l.label={text:r},n==null)l.descr={text:""};else if(typeof n=="object"){let[h,f]=Object.entries(n)[0];l[h]={text:f}}else l.descr={text:n};if(typeof i=="object"){let[h,f]=Object.entries(i)[0];l[h]=f}else l.sprite=i;if(typeof a=="object"){let[h,f]=Object.entries(a)[0];l[h]=f}else l.tags=a;if(typeof s=="object"){let[h,f]=Object.entries(s)[0];l[h]=f}else l.link=s;l.typeC4Shape={text:t},l.parentBoundary=ja,l.wrap=xh()},"addPersonOrSystem"),qbe=o(function(t,e,r,n,i,a,s,l){if(e===null||r===null)return;let u={},h=ul.find(f=>f.alias===e);if(h&&e===h.alias?u=h:(u.alias=e,ul.push(u)),r==null?u.label={text:""}:u.label={text:r},n==null)u.techn={text:""};else if(typeof n=="object"){let[f,d]=Object.entries(n)[0];u[f]={text:d}}else u.techn={text:n};if(i==null)u.descr={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.descr={text:i};if(typeof a=="object"){let[f,d]=Object.entries(a)[0];u[f]=d}else u.sprite=a;if(typeof s=="object"){let[f,d]=Object.entries(s)[0];u[f]=d}else u.tags=s;if(typeof l=="object"){let[f,d]=Object.entries(l)[0];u[f]=d}else u.link=l;u.wrap=xh(),u.typeC4Shape={text:t},u.parentBoundary=ja},"addContainer"),Xbe=o(function(t,e,r,n,i,a,s,l){if(e===null||r===null)return;let u={},h=ul.find(f=>f.alias===e);if(h&&e===h.alias?u=h:(u.alias=e,ul.push(u)),r==null?u.label={text:""}:u.label={text:r},n==null)u.techn={text:""};else if(typeof n=="object"){let[f,d]=Object.entries(n)[0];u[f]={text:d}}else u.techn={text:n};if(i==null)u.descr={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.descr={text:i};if(typeof a=="object"){let[f,d]=Object.entries(a)[0];u[f]=d}else u.sprite=a;if(typeof s=="object"){let[f,d]=Object.entries(s)[0];u[f]=d}else u.tags=s;if(typeof l=="object"){let[f,d]=Object.entries(l)[0];u[f]=d}else u.link=l;u.wrap=xh(),u.typeC4Shape={text:t},u.parentBoundary=ja},"addComponent"),jbe=o(function(t,e,r,n,i){if(t===null||e===null)return;let a={},s=nc.find(l=>l.alias===t);if(s&&t===s.alias?a=s:(a.alias=t,nc.push(a)),e==null?a.label={text:""}:a.label={text:e},r==null)a.type={text:"system"};else if(typeof r=="object"){let[l,u]=Object.entries(r)[0];a[l]={text:u}}else a.type={text:r};if(typeof n=="object"){let[l,u]=Object.entries(n)[0];a[l]=u}else a.tags=n;if(typeof i=="object"){let[l,u]=Object.entries(i)[0];a[l]=u}else a.link=i;a.parentBoundary=ja,a.wrap=xh(),cl=ja,ja=t,vh.push(cl)},"addPersonOrSystemBoundary"),Kbe=o(function(t,e,r,n,i){if(t===null||e===null)return;let a={},s=nc.find(l=>l.alias===t);if(s&&t===s.alias?a=s:(a.alias=t,nc.push(a)),e==null?a.label={text:""}:a.label={text:e},r==null)a.type={text:"container"};else if(typeof r=="object"){let[l,u]=Object.entries(r)[0];a[l]={text:u}}else a.type={text:r};if(typeof n=="object"){let[l,u]=Object.entries(n)[0];a[l]=u}else a.tags=n;if(typeof i=="object"){let[l,u]=Object.entries(i)[0];a[l]=u}else a.link=i;a.parentBoundary=ja,a.wrap=xh(),cl=ja,ja=t,vh.push(cl)},"addContainerBoundary"),Qbe=o(function(t,e,r,n,i,a,s,l){if(e===null||r===null)return;let u={},h=nc.find(f=>f.alias===e);if(h&&e===h.alias?u=h:(u.alias=e,nc.push(u)),r==null?u.label={text:""}:u.label={text:r},n==null)u.type={text:"node"};else if(typeof n=="object"){let[f,d]=Object.entries(n)[0];u[f]={text:d}}else u.type={text:n};if(i==null)u.descr={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.descr={text:i};if(typeof s=="object"){let[f,d]=Object.entries(s)[0];u[f]=d}else u.tags=s;if(typeof l=="object"){let[f,d]=Object.entries(l)[0];u[f]=d}else u.link=l;u.nodeType=t,u.parentBoundary=ja,u.wrap=xh(),cl=ja,ja=e,vh.push(cl)},"addDeploymentNode"),Zbe=o(function(){ja=cl,vh.pop(),cl=vh.pop(),vh.push(cl)},"popBoundaryParseStack"),Jbe=o(function(t,e,r,n,i,a,s,l,u,h,f){let d=ul.find(p=>p.alias===e);if(!(d===void 0&&(d=nc.find(p=>p.alias===e),d===void 0))){if(r!=null)if(typeof r=="object"){let[p,m]=Object.entries(r)[0];d[p]=m}else d.bgColor=r;if(n!=null)if(typeof n=="object"){let[p,m]=Object.entries(n)[0];d[p]=m}else d.fontColor=n;if(i!=null)if(typeof i=="object"){let[p,m]=Object.entries(i)[0];d[p]=m}else d.borderColor=i;if(a!=null)if(typeof a=="object"){let[p,m]=Object.entries(a)[0];d[p]=m}else d.shadowing=a;if(s!=null)if(typeof s=="object"){let[p,m]=Object.entries(s)[0];d[p]=m}else d.shape=s;if(l!=null)if(typeof l=="object"){let[p,m]=Object.entries(l)[0];d[p]=m}else d.sprite=l;if(u!=null)if(typeof u=="object"){let[p,m]=Object.entries(u)[0];d[p]=m}else d.techn=u;if(h!=null)if(typeof h=="object"){let[p,m]=Object.entries(h)[0];d[p]=m}else d.legendText=h;if(f!=null)if(typeof f=="object"){let[p,m]=Object.entries(f)[0];d[p]=m}else d.legendSprite=f}},"updateElStyle"),e4e=o(function(t,e,r,n,i,a,s){let l=uy.find(u=>u.from===e&&u.to===r);if(l!==void 0){if(n!=null)if(typeof n=="object"){let[u,h]=Object.entries(n)[0];l[u]=h}else l.textColor=n;if(i!=null)if(typeof i=="object"){let[u,h]=Object.entries(i)[0];l[u]=h}else l.lineColor=i;if(a!=null)if(typeof a=="object"){let[u,h]=Object.entries(a)[0];l[u]=parseInt(h)}else l.offsetX=parseInt(a);if(s!=null)if(typeof s=="object"){let[u,h]=Object.entries(s)[0];l[u]=parseInt(h)}else l.offsetY=parseInt(s)}},"updateRelStyle"),t4e=o(function(t,e,r){let n=L4,i=D4;if(typeof e=="object"){let a=Object.values(e)[0];n=parseInt(a)}else n=parseInt(e);if(typeof r=="object"){let a=Object.values(r)[0];i=parseInt(a)}else i=parseInt(r);n>=1&&(L4=n),i>=1&&(D4=i)},"updateLayoutConfig"),r4e=o(function(){return L4},"getC4ShapeInRow"),n4e=o(function(){return D4},"getC4BoundaryInRow"),i4e=o(function(){return ja},"getCurrentBoundaryParse"),a4e=o(function(){return cl},"getParentBoundaryParse"),M$=o(function(t){return t==null?ul:ul.filter(e=>e.parentBoundary===t)},"getC4ShapeArray"),s4e=o(function(t){return ul.find(e=>e.alias===t)},"getC4Shape"),o4e=o(function(t){return Object.keys(M$(t))},"getC4ShapeKeys"),I$=o(function(t){return t==null?nc:nc.filter(e=>e.parentBoundary===t)},"getBoundaries"),l4e=I$,c4e=o(function(){return uy},"getRels"),u4e=o(function(){return sS},"getTitle"),h4e=o(function(t){oS=t},"setWrap"),xh=o(function(){return oS},"autoWrap"),f4e=o(function(){ul=[],nc=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],cl="",ja="global",vh=[""],uy=[],vh=[""],sS="",oS=!1,L4=4,D4=2},"clear"),d4e={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},p4e={FILLED:0,OPEN:1},m4e={LEFTOF:0,RIGHTOF:1,OVER:2},g4e=o(function(t){sS=qr(t,de())},"setTitle"),hy={addPersonOrSystem:Wbe,addPersonOrSystemBoundary:jbe,addContainer:qbe,addContainerBoundary:Kbe,addComponent:Xbe,addDeploymentNode:Qbe,popBoundaryParseStack:Zbe,addRel:Ybe,updateElStyle:Jbe,updateRelStyle:e4e,updateLayoutConfig:t4e,autoWrap:xh,setWrap:h4e,getC4ShapeArray:M$,getC4Shape:s4e,getC4ShapeKeys:o4e,getBoundaries:I$,getBoundarys:l4e,getCurrentBoundaryParse:i4e,getParentBoundaryParse:a4e,getRels:c4e,getTitle:u4e,getC4Type:Ube,getC4ShapeInRow:r4e,getC4BoundaryInRow:n4e,setAccTitle:kr,getAccTitle:Ar,getAccDescription:Lr,setAccDescription:_r,getConfig:o(()=>de().c4,"getConfig"),clear:f4e,LINETYPE:d4e,ARROWTYPE:p4e,PLACEMENT:m4e,setTitle:g4e,setC4Type:Hbe}});function ed(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}var cS=R(()=>{"use strict";o(ed,"ascending")});function uS(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}var O$=R(()=>{"use strict";o(uS,"descending")});function td(t){let e,r,n;t.length!==2?(e=ed,r=o((l,u)=>ed(t(l),u),"compare2"),n=o((l,u)=>t(l)-u,"delta")):(e=t===ed||t===uS?t:y4e,r=t,n=t);function i(l,u,h=0,f=l.length){if(h<f){if(e(u,u)!==0)return f;do{let d=h+f>>>1;r(l[d],u)<0?h=d+1:f=d}while(h<f)}return h}o(i,"left");function a(l,u,h=0,f=l.length){if(h<f){if(e(u,u)!==0)return f;do{let d=h+f>>>1;r(l[d],u)<=0?h=d+1:f=d}while(h<f)}return h}o(a,"right");function s(l,u,h=0,f=l.length){let d=i(l,u,h,f-1);return d>h&&n(l[d-1],u)>-n(l[d],u)?d-1:d}return o(s,"center"),{left:i,center:s,right:a}}function y4e(){return 0}var hS=R(()=>{"use strict";cS();O$();o(td,"bisector");o(y4e,"zero")});function fS(t){return t===null?NaN:+t}var P$=R(()=>{"use strict";o(fS,"number")});var B$,F$,v4e,x4e,dS,z$=R(()=>{"use strict";cS();hS();P$();B$=td(ed),F$=B$.right,v4e=B$.left,x4e=td(fS).center,dS=F$});function G$({_intern:t,_key:e},r){let n=e(r);return t.has(n)?t.get(n):r}function b4e({_intern:t,_key:e},r){let n=e(r);return t.has(n)?t.get(n):(t.set(n,r),r)}function w4e({_intern:t,_key:e},r){let n=e(r);return t.has(n)&&(r=t.get(n),t.delete(n)),r}function T4e(t){return t!==null&&typeof t=="object"?t.valueOf():t}var wp,$$=R(()=>{"use strict";wp=class extends Map{static{o(this,"InternMap")}constructor(e,r=T4e){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),e!=null)for(let[n,i]of e)this.set(n,i)}get(e){return super.get(G$(this,e))}has(e){return super.has(G$(this,e))}set(e,r){return super.set(b4e(this,e),r)}delete(e){return super.delete(w4e(this,e))}};o(G$,"intern_get");o(b4e,"intern_set");o(w4e,"intern_delete");o(T4e,"keyof")});function R4(t,e,r){let n=(e-t)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),s=a>=k4e?10:a>=E4e?5:a>=C4e?2:1,l,u,h;return i<0?(h=Math.pow(10,-i)/s,l=Math.round(t*h),u=Math.round(e*h),l/h<t&&++l,u/h>e&&--u,h=-h):(h=Math.pow(10,i)*s,l=Math.round(t/h),u=Math.round(e/h),l*h<t&&++l,u*h>e&&--u),u<l&&.5<=r&&r<2?R4(t,e,r*2):[l,u,h]}function N4(t,e,r){if(e=+e,t=+t,r=+r,!(r>0))return[];if(t===e)return[t];let n=e<t,[i,a,s]=n?R4(e,t,r):R4(t,e,r);if(!(a>=i))return[];let l=a-i+1,u=new Array(l);if(n)if(s<0)for(let h=0;h<l;++h)u[h]=(a-h)/-s;else for(let h=0;h<l;++h)u[h]=(a-h)*s;else if(s<0)for(let h=0;h<l;++h)u[h]=(i+h)/-s;else for(let h=0;h<l;++h)u[h]=(i+h)*s;return u}function fy(t,e,r){return e=+e,t=+t,r=+r,R4(t,e,r)[2]}function Tp(t,e,r){e=+e,t=+t,r=+r;let n=e<t,i=n?fy(e,t,r):fy(t,e,r);return(n?-1:1)*(i<0?1/-i:i)}var k4e,E4e,C4e,V$=R(()=>{"use strict";k4e=Math.sqrt(50),E4e=Math.sqrt(10),C4e=Math.sqrt(2);o(R4,"tickSpec");o(N4,"ticks");o(fy,"tickIncrement");o(Tp,"tickStep")});function M4(t,e){let r;if(e===void 0)for(let n of t)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of t)(i=e(i,++n,t))!=null&&(r<i||r===void 0&&i>=i)&&(r=i)}return r}var U$=R(()=>{"use strict";o(M4,"max")});function I4(t,e){let r;if(e===void 0)for(let n of t)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of t)(i=e(i,++n,t))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}var H$=R(()=>{"use strict";o(I4,"min")});function O4(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((e-t)/r))|0,a=new Array(i);++n<i;)a[n]=t+n*r;return a}var Y$=R(()=>{"use strict";o(O4,"range")});var bh=R(()=>{"use strict";z$();hS();U$();H$();Y$();V$();$$()});function pS(t){return t}var W$=R(()=>{"use strict";o(pS,"default")});function S4e(t){return"translate("+t+",0)"}function A4e(t){return"translate(0,"+t+")"}function _4e(t){return e=>+t(e)}function L4e(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),r=>+t(r)+e}function D4e(){return!this.__axis}function X$(t,e){var r=[],n=null,i=null,a=6,s=6,l=3,u=typeof window<"u"&&window.devicePixelRatio>1?0:.5,h=t===B4||t===P4?-1:1,f=t===P4||t===mS?"x":"y",d=t===B4||t===gS?S4e:A4e;function p(m){var g=n??(e.ticks?e.ticks.apply(e,r):e.domain()),y=i??(e.tickFormat?e.tickFormat.apply(e,r):pS),v=Math.max(a,0)+l,x=e.range(),b=+x[0]+u,w=+x[x.length-1]+u,S=(e.bandwidth?L4e:_4e)(e.copy(),u),T=m.selection?m.selection():m,E=T.selectAll(".domain").data([null]),_=T.selectAll(".tick").data(g,e).order(),A=_.exit(),L=_.enter().append("g").attr("class","tick"),M=_.select("line"),N=_.select("text");E=E.merge(E.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),_=_.merge(L),M=M.merge(L.append("line").attr("stroke","currentColor").attr(f+"2",h*a)),N=N.merge(L.append("text").attr("fill","currentColor").attr(f,h*v).attr("dy",t===B4?"0em":t===gS?"0.71em":"0.32em")),m!==T&&(E=E.transition(m),_=_.transition(m),M=M.transition(m),N=N.transition(m),A=A.transition(m).attr("opacity",q$).attr("transform",function(k){return isFinite(k=S(k))?d(k+u):this.getAttribute("transform")}),L.attr("opacity",q$).attr("transform",function(k){var I=this.parentNode.__axis;return d((I&&isFinite(I=I(k))?I:S(k))+u)})),A.remove(),E.attr("d",t===P4||t===mS?s?"M"+h*s+","+b+"H"+u+"V"+w+"H"+h*s:"M"+u+","+b+"V"+w:s?"M"+b+","+h*s+"V"+u+"H"+w+"V"+h*s:"M"+b+","+u+"H"+w),_.attr("opacity",1).attr("transform",function(k){return d(S(k)+u)}),M.attr(f+"2",h*a),N.attr(f,h*v).text(y),T.filter(D4e).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===mS?"start":t===P4?"end":"middle"),T.each(function(){this.__axis=S})}return o(p,"axis"),p.scale=function(m){return arguments.length?(e=m,p):e},p.ticks=function(){return r=Array.from(arguments),p},p.tickArguments=function(m){return arguments.length?(r=m==null?[]:Array.from(m),p):r.slice()},p.tickValues=function(m){return arguments.length?(n=m==null?null:Array.from(m),p):n&&n.slice()},p.tickFormat=function(m){return arguments.length?(i=m,p):i},p.tickSize=function(m){return arguments.length?(a=s=+m,p):a},p.tickSizeInner=function(m){return arguments.length?(a=+m,p):a},p.tickSizeOuter=function(m){return arguments.length?(s=+m,p):s},p.tickPadding=function(m){return arguments.length?(l=+m,p):l},p.offset=function(m){return arguments.length?(u=+m,p):u},p}function yS(t){return X$(B4,t)}function vS(t){return X$(gS,t)}var B4,mS,gS,P4,q$,j$=R(()=>{"use strict";W$();B4=1,mS=2,gS=3,P4=4,q$=1e-6;o(S4e,"translateX");o(A4e,"translateY");o(_4e,"number");o(L4e,"center");o(D4e,"entering");o(X$,"axis");o(yS,"axisTop");o(vS,"axisBottom")});var K$=R(()=>{"use strict";j$()});function Z$(){for(var t=0,e=arguments.length,r={},n;t<e;++t){if(!(n=arguments[t]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new F4(r)}function F4(t){this._=t}function N4e(t,e){return t.trim().split(/^|\s+/).map(function(r){var n="",i=r.indexOf(".");if(i>=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!e.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}function M4e(t,e){for(var r=0,n=t.length,i;r<n;++r)if((i=t[r]).name===e)return i.value}function Q$(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=R4e,t=t.slice(0,n).concat(t.slice(n+1));break}return r!=null&&t.push({name:e,value:r}),t}var R4e,xS,J$=R(()=>{"use strict";R4e={value:o(()=>{},"value")};o(Z$,"dispatch");o(F4,"Dispatch");o(N4e,"parseTypenames");F4.prototype=Z$.prototype={constructor:F4,on:o(function(t,e){var r=this._,n=N4e(t+"",r),i,a=-1,s=n.length;if(arguments.length<2){for(;++a<s;)if((i=(t=n[a]).type)&&(i=M4e(r[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<s;)if(i=(t=n[a]).type)r[i]=Q$(r[i],t.name,e);else if(e==null)for(i in r)r[i]=Q$(r[i],t.name,null);return this},"on"),copy:o(function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new F4(t)},"copy"),call:o(function(t,e){if((i=arguments.length-2)>0)for(var r=new Array(i),n=0,i,a;n<i;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=this._[t],n=0,i=a.length;n<i;++n)a[n].value.apply(e,r)},"call"),apply:o(function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,a=n.length;i<a;++i)n[i].value.apply(e,r)},"apply")};o(M4e,"get");o(Q$,"set");xS=Z$});var bS=R(()=>{"use strict";J$()});var z4,wS,TS=R(()=>{"use strict";z4="http://www.w3.org/1999/xhtml",wS={svg:"http://www.w3.org/2000/svg",xhtml:z4,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"}});function ic(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),wS.hasOwnProperty(e)?{space:wS[e],local:t}:t}var G4=R(()=>{"use strict";TS();o(ic,"default")});function I4e(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===z4&&e.documentElement.namespaceURI===z4?e.createElement(t):e.createElementNS(r,t)}}function O4e(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function dy(t){var e=ic(t);return(e.local?O4e:I4e)(e)}var kS=R(()=>{"use strict";G4();TS();o(I4e,"creatorInherit");o(O4e,"creatorFixed");o(dy,"default")});function P4e(){}function wh(t){return t==null?P4e:function(){return this.querySelector(t)}}var $4=R(()=>{"use strict";o(P4e,"none");o(wh,"default")});function ES(t){typeof t!="function"&&(t=wh(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var a=e[i],s=a.length,l=n[i]=new Array(s),u,h,f=0;f<s;++f)(u=a[f])&&(h=t.call(u,u.__data__,f,a))&&("__data__"in u&&(h.__data__=u.__data__),l[f]=h);return new Zn(n,this._parents)}var eV=R(()=>{"use strict";hl();$4();o(ES,"default")});function CS(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}var tV=R(()=>{"use strict";o(CS,"array")});function B4e(){return[]}function kp(t){return t==null?B4e:function(){return this.querySelectorAll(t)}}var SS=R(()=>{"use strict";o(B4e,"empty");o(kp,"default")});function F4e(t){return function(){return CS(t.apply(this,arguments))}}function AS(t){typeof t=="function"?t=F4e(t):t=kp(t);for(var e=this._groups,r=e.length,n=[],i=[],a=0;a<r;++a)for(var s=e[a],l=s.length,u,h=0;h<l;++h)(u=s[h])&&(n.push(t.call(u,u.__data__,h,s)),i.push(u));return new Zn(n,i)}var rV=R(()=>{"use strict";hl();tV();SS();o(F4e,"arrayAll");o(AS,"default")});function Ep(t){return function(){return this.matches(t)}}function V4(t){return function(e){return e.matches(t)}}var py=R(()=>{"use strict";o(Ep,"default");o(V4,"childMatcher")});function G4e(t){return function(){return z4e.call(this.children,t)}}function $4e(){return this.firstElementChild}function _S(t){return this.select(t==null?$4e:G4e(typeof t=="function"?t:V4(t)))}var z4e,nV=R(()=>{"use strict";py();z4e=Array.prototype.find;o(G4e,"childFind");o($4e,"childFirst");o(_S,"default")});function U4e(){return Array.from(this.children)}function H4e(t){return function(){return V4e.call(this.children,t)}}function LS(t){return this.selectAll(t==null?U4e:H4e(typeof t=="function"?t:V4(t)))}var V4e,iV=R(()=>{"use strict";py();V4e=Array.prototype.filter;o(U4e,"children");o(H4e,"childrenFilter");o(LS,"default")});function DS(t){typeof t!="function"&&(t=Ep(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var a=e[i],s=a.length,l=n[i]=[],u,h=0;h<s;++h)(u=a[h])&&t.call(u,u.__data__,h,a)&&l.push(u);return new Zn(n,this._parents)}var aV=R(()=>{"use strict";hl();py();o(DS,"default")});function my(t){return new Array(t.length)}var RS=R(()=>{"use strict";o(my,"default")});function NS(){return new Zn(this._enter||this._groups.map(my),this._parents)}function gy(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}var MS=R(()=>{"use strict";RS();hl();o(NS,"default");o(gy,"EnterNode");gy.prototype={constructor:gy,appendChild:o(function(t){return this._parent.insertBefore(t,this._next)},"appendChild"),insertBefore:o(function(t,e){return this._parent.insertBefore(t,e)},"insertBefore"),querySelector:o(function(t){return this._parent.querySelector(t)},"querySelector"),querySelectorAll:o(function(t){return this._parent.querySelectorAll(t)},"querySelectorAll")}});function IS(t){return function(){return t}}var sV=R(()=>{"use strict";o(IS,"default")});function Y4e(t,e,r,n,i,a){for(var s=0,l,u=e.length,h=a.length;s<h;++s)(l=e[s])?(l.__data__=a[s],n[s]=l):r[s]=new gy(t,a[s]);for(;s<u;++s)(l=e[s])&&(i[s]=l)}function W4e(t,e,r,n,i,a,s){var l,u,h=new Map,f=e.length,d=a.length,p=new Array(f),m;for(l=0;l<f;++l)(u=e[l])&&(p[l]=m=s.call(u,u.__data__,l,e)+"",h.has(m)?i[l]=u:h.set(m,u));for(l=0;l<d;++l)m=s.call(t,a[l],l,a)+"",(u=h.get(m))?(n[l]=u,u.__data__=a[l],h.delete(m)):r[l]=new gy(t,a[l]);for(l=0;l<f;++l)(u=e[l])&&h.get(p[l])===u&&(i[l]=u)}function q4e(t){return t.__data__}function OS(t,e){if(!arguments.length)return Array.from(this,q4e);var r=e?W4e:Y4e,n=this._parents,i=this._groups;typeof t!="function"&&(t=IS(t));for(var a=i.length,s=new Array(a),l=new Array(a),u=new Array(a),h=0;h<a;++h){var f=n[h],d=i[h],p=d.length,m=X4e(t.call(f,f&&f.__data__,h,n)),g=m.length,y=l[h]=new Array(g),v=s[h]=new Array(g),x=u[h]=new Array(p);r(f,d,y,v,x,m,e);for(var b=0,w=0,S,T;b<g;++b)if(S=y[b]){for(b>=w&&(w=b+1);!(T=v[w])&&++w<g;);S._next=T||null}}return s=new Zn(s,n),s._enter=l,s._exit=u,s}function X4e(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}var oV=R(()=>{"use strict";hl();MS();sV();o(Y4e,"bindIndex");o(W4e,"bindKey");o(q4e,"datum");o(OS,"default");o(X4e,"arraylike")});function PS(){return new Zn(this._exit||this._groups.map(my),this._parents)}var lV=R(()=>{"use strict";RS();hl();o(PS,"default")});function BS(t,e,r){var n=this.enter(),i=this,a=this.exit();return typeof t=="function"?(n=t(n),n&&(n=n.selection())):n=n.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),r==null?a.remove():r(a),n&&i?n.merge(i).order():i}var cV=R(()=>{"use strict";o(BS,"default")});function FS(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,i=r.length,a=n.length,s=Math.min(i,a),l=new Array(i),u=0;u<s;++u)for(var h=r[u],f=n[u],d=h.length,p=l[u]=new Array(d),m,g=0;g<d;++g)(m=h[g]||f[g])&&(p[g]=m);for(;u<i;++u)l[u]=r[u];return new Zn(l,this._parents)}var uV=R(()=>{"use strict";hl();o(FS,"default")});function zS(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var n=t[e],i=n.length-1,a=n[i],s;--i>=0;)(s=n[i])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}var hV=R(()=>{"use strict";o(zS,"default")});function GS(t){t||(t=j4e);function e(d,p){return d&&p?t(d.__data__,p.__data__):!d-!p}o(e,"compareNode");for(var r=this._groups,n=r.length,i=new Array(n),a=0;a<n;++a){for(var s=r[a],l=s.length,u=i[a]=new Array(l),h,f=0;f<l;++f)(h=s[f])&&(u[f]=h);u.sort(e)}return new Zn(i,this._parents).order()}function j4e(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}var fV=R(()=>{"use strict";hl();o(GS,"default");o(j4e,"ascending")});function $S(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}var dV=R(()=>{"use strict";o($S,"default")});function VS(){return Array.from(this)}var pV=R(()=>{"use strict";o(VS,"default")});function US(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,a=n.length;i<a;++i){var s=n[i];if(s)return s}return null}var mV=R(()=>{"use strict";o(US,"default")});function HS(){let t=0;for(let e of this)++t;return t}var gV=R(()=>{"use strict";o(HS,"default")});function YS(){return!this.node()}var yV=R(()=>{"use strict";o(YS,"default")});function WS(t){for(var e=this._groups,r=0,n=e.length;r<n;++r)for(var i=e[r],a=0,s=i.length,l;a<s;++a)(l=i[a])&&t.call(l,l.__data__,a,i);return this}var vV=R(()=>{"use strict";o(WS,"default")});function K4e(t){return function(){this.removeAttribute(t)}}function Q4e(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Z4e(t,e){return function(){this.setAttribute(t,e)}}function J4e(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function e3e(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function t3e(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function qS(t,e){var r=ic(t);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((e==null?r.local?Q4e:K4e:typeof e=="function"?r.local?t3e:e3e:r.local?J4e:Z4e)(r,e))}var xV=R(()=>{"use strict";G4();o(K4e,"attrRemove");o(Q4e,"attrRemoveNS");o(Z4e,"attrConstant");o(J4e,"attrConstantNS");o(e3e,"attrFunction");o(t3e,"attrFunctionNS");o(qS,"default")});function yy(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}var XS=R(()=>{"use strict";o(yy,"default")});function r3e(t){return function(){this.style.removeProperty(t)}}function n3e(t,e,r){return function(){this.style.setProperty(t,e,r)}}function i3e(t,e,r){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function jS(t,e,r){return arguments.length>1?this.each((e==null?r3e:typeof e=="function"?i3e:n3e)(t,e,r??"")):Th(this.node(),t)}function Th(t,e){return t.style.getPropertyValue(e)||yy(t).getComputedStyle(t,null).getPropertyValue(e)}var KS=R(()=>{"use strict";XS();o(r3e,"styleRemove");o(n3e,"styleConstant");o(i3e,"styleFunction");o(jS,"default");o(Th,"styleValue")});function a3e(t){return function(){delete this[t]}}function s3e(t,e){return function(){this[t]=e}}function o3e(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function QS(t,e){return arguments.length>1?this.each((e==null?a3e:typeof e=="function"?o3e:s3e)(t,e)):this.node()[t]}var bV=R(()=>{"use strict";o(a3e,"propertyRemove");o(s3e,"propertyConstant");o(o3e,"propertyFunction");o(QS,"default")});function wV(t){return t.trim().split(/^|\s+/)}function ZS(t){return t.classList||new TV(t)}function TV(t){this._node=t,this._names=wV(t.getAttribute("class")||"")}function kV(t,e){for(var r=ZS(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function EV(t,e){for(var r=ZS(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function l3e(t){return function(){kV(this,t)}}function c3e(t){return function(){EV(this,t)}}function u3e(t,e){return function(){(e.apply(this,arguments)?kV:EV)(this,t)}}function JS(t,e){var r=wV(t+"");if(arguments.length<2){for(var n=ZS(this.node()),i=-1,a=r.length;++i<a;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof e=="function"?u3e:e?l3e:c3e)(r,e))}var CV=R(()=>{"use strict";o(wV,"classArray");o(ZS,"classList");o(TV,"ClassList");TV.prototype={add:o(function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},"add"),remove:o(function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},"remove"),contains:o(function(t){return this._names.indexOf(t)>=0},"contains")};o(kV,"classedAdd");o(EV,"classedRemove");o(l3e,"classedTrue");o(c3e,"classedFalse");o(u3e,"classedFunction");o(JS,"default")});function h3e(){this.textContent=""}function f3e(t){return function(){this.textContent=t}}function d3e(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function eA(t){return arguments.length?this.each(t==null?h3e:(typeof t=="function"?d3e:f3e)(t)):this.node().textContent}var SV=R(()=>{"use strict";o(h3e,"textRemove");o(f3e,"textConstant");o(d3e,"textFunction");o(eA,"default")});function p3e(){this.innerHTML=""}function m3e(t){return function(){this.innerHTML=t}}function g3e(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function tA(t){return arguments.length?this.each(t==null?p3e:(typeof t=="function"?g3e:m3e)(t)):this.node().innerHTML}var AV=R(()=>{"use strict";o(p3e,"htmlRemove");o(m3e,"htmlConstant");o(g3e,"htmlFunction");o(tA,"default")});function y3e(){this.nextSibling&&this.parentNode.appendChild(this)}function rA(){return this.each(y3e)}var _V=R(()=>{"use strict";o(y3e,"raise");o(rA,"default")});function v3e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function nA(){return this.each(v3e)}var LV=R(()=>{"use strict";o(v3e,"lower");o(nA,"default")});function iA(t){var e=typeof t=="function"?t:dy(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}var DV=R(()=>{"use strict";kS();o(iA,"default")});function x3e(){return null}function aA(t,e){var r=typeof t=="function"?t:dy(t),n=e==null?x3e:typeof e=="function"?e:wh(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}var RV=R(()=>{"use strict";kS();$4();o(x3e,"constantNull");o(aA,"default")});function b3e(){var t=this.parentNode;t&&t.removeChild(this)}function sA(){return this.each(b3e)}var NV=R(()=>{"use strict";o(b3e,"remove");o(sA,"default")});function w3e(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function T3e(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function oA(t){return this.select(t?T3e:w3e)}var MV=R(()=>{"use strict";o(w3e,"selection_cloneShallow");o(T3e,"selection_cloneDeep");o(oA,"default")});function lA(t){return arguments.length?this.property("__data__",t):this.node().__data__}var IV=R(()=>{"use strict";o(lA,"default")});function k3e(t){return function(e){t.call(this,e,this.__data__)}}function E3e(t){return t.trim().split(/^|\s+/).map(function(e){var r="",n=e.indexOf(".");return n>=0&&(r=e.slice(n+1),e=e.slice(0,n)),{type:e,name:r}})}function C3e(t){return function(){var e=this.__on;if(e){for(var r=0,n=-1,i=e.length,a;r<i;++r)a=e[r],(!t.type||a.type===t.type)&&a.name===t.name?this.removeEventListener(a.type,a.listener,a.options):e[++n]=a;++n?e.length=n:delete this.__on}}}function S3e(t,e,r){return function(){var n=this.__on,i,a=k3e(e);if(n){for(var s=0,l=n.length;s<l;++s)if((i=n[s]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=r),i.value=e;return}}this.addEventListener(t.type,a,r),i={type:t.type,name:t.name,value:e,listener:a,options:r},n?n.push(i):this.__on=[i]}}function cA(t,e,r){var n=E3e(t+""),i,a=n.length,s;if(arguments.length<2){var l=this.node().__on;if(l){for(var u=0,h=l.length,f;u<h;++u)for(i=0,f=l[u];i<a;++i)if((s=n[i]).type===f.type&&s.name===f.name)return f.value}return}for(l=e?S3e:C3e,i=0;i<a;++i)this.each(l(n[i],e,r));return this}var OV=R(()=>{"use strict";o(k3e,"contextListener");o(E3e,"parseTypenames");o(C3e,"onRemove");o(S3e,"onAdd");o(cA,"default")});function PV(t,e,r){var n=yy(t),i=n.CustomEvent;typeof i=="function"?i=new i(e,r):(i=n.document.createEvent("Event"),r?(i.initEvent(e,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function A3e(t,e){return function(){return PV(this,t,e)}}function _3e(t,e){return function(){return PV(this,t,e.apply(this,arguments))}}function uA(t,e){return this.each((typeof e=="function"?_3e:A3e)(t,e))}var BV=R(()=>{"use strict";XS();o(PV,"dispatchEvent");o(A3e,"dispatchConstant");o(_3e,"dispatchFunction");o(uA,"default")});function*hA(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,a=n.length,s;i<a;++i)(s=n[i])&&(yield s)}var FV=R(()=>{"use strict";o(hA,"default")});function Zn(t,e){this._groups=t,this._parents=e}function zV(){return new Zn([[document.documentElement]],fA)}function L3e(){return this}var fA,cu,hl=R(()=>{"use strict";eV();rV();nV();iV();aV();oV();MS();lV();cV();uV();hV();fV();dV();pV();mV();gV();yV();vV();xV();KS();bV();CV();SV();AV();_V();LV();DV();RV();NV();MV();IV();OV();BV();FV();fA=[null];o(Zn,"Selection");o(zV,"selection");o(L3e,"selection_selection");Zn.prototype=zV.prototype={constructor:Zn,select:ES,selectAll:AS,selectChild:_S,selectChildren:LS,filter:DS,data:OS,enter:NS,exit:PS,join:BS,merge:FS,selection:L3e,order:zS,sort:GS,call:$S,nodes:VS,node:US,size:HS,empty:YS,each:WS,attr:qS,style:jS,property:QS,classed:JS,text:eA,html:tA,raise:rA,lower:nA,append:iA,insert:aA,remove:sA,clone:oA,datum:lA,on:cA,dispatch:uA,[Symbol.iterator]:hA};cu=zV});function $e(t){return typeof t=="string"?new Zn([[document.querySelector(t)]],[document.documentElement]):new Zn([[t]],fA)}var GV=R(()=>{"use strict";hl();o($e,"default")});var fl=R(()=>{"use strict";py();G4();GV();hl();$4();SS();KS()});var $V=R(()=>{"use strict"});function kh(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function Cp(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}var dA=R(()=>{"use strict";o(kh,"default");o(Cp,"extend")});function Eh(){}function UV(){return this.rgb().formatHex()}function B3e(){return this.rgb().formatHex8()}function F3e(){return KV(this).formatHsl()}function HV(){return this.rgb().formatRgb()}function pl(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=D3e.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?YV(e):r===3?new la(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?U4(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?U4(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=R3e.exec(t))?new la(e[1],e[2],e[3],1):(e=N3e.exec(t))?new la(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=M3e.exec(t))?U4(e[1],e[2],e[3],e[4]):(e=I3e.exec(t))?U4(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=O3e.exec(t))?XV(e[1],e[2]/100,e[3]/100,1):(e=P3e.exec(t))?XV(e[1],e[2]/100,e[3]/100,e[4]):VV.hasOwnProperty(t)?YV(VV[t]):t==="transparent"?new la(NaN,NaN,NaN,0):null}function YV(t){return new la(t>>16&255,t>>8&255,t&255,1)}function U4(t,e,r,n){return n<=0&&(t=e=r=NaN),new la(t,e,r,n)}function mA(t){return t instanceof Eh||(t=pl(t)),t?(t=t.rgb(),new la(t.r,t.g,t.b,t.opacity)):new la}function Ap(t,e,r,n){return arguments.length===1?mA(t):new la(t,e,r,n??1)}function la(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function WV(){return`#${rd(this.r)}${rd(this.g)}${rd(this.b)}`}function z3e(){return`#${rd(this.r)}${rd(this.g)}${rd(this.b)}${rd((isNaN(this.opacity)?1:this.opacity)*255)}`}function qV(){let t=W4(this.opacity);return`${t===1?"rgb(":"rgba("}${nd(this.r)}, ${nd(this.g)}, ${nd(this.b)}${t===1?")":`, ${t})`}`}function W4(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function nd(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function rd(t){return t=nd(t),(t<16?"0":"")+t.toString(16)}function XV(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new dl(t,e,r,n)}function KV(t){if(t instanceof dl)return new dl(t.h,t.s,t.l,t.opacity);if(t instanceof Eh||(t=pl(t)),!t)return new dl;if(t instanceof dl)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),a=Math.max(e,r,n),s=NaN,l=a-i,u=(a+i)/2;return l?(e===a?s=(r-n)/l+(r<n)*6:r===a?s=(n-e)/l+2:s=(e-r)/l+4,l/=u<.5?a+i:2-a-i,s*=60):l=u>0&&u<1?0:s,new dl(s,l,u,t.opacity)}function QV(t,e,r,n){return arguments.length===1?KV(t):new dl(t,e,r,n??1)}function dl(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function jV(t){return t=(t||0)%360,t<0?t+360:t}function H4(t){return Math.max(0,Math.min(1,t||0))}function pA(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}var vy,Y4,Sp,xy,ac,D3e,R3e,N3e,M3e,I3e,O3e,P3e,VV,gA=R(()=>{"use strict";dA();o(Eh,"Color");vy=.7,Y4=1/vy,Sp="\\s*([+-]?\\d+)\\s*",xy="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ac="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",D3e=/^#([0-9a-f]{3,8})$/,R3e=new RegExp(`^rgb\\(${Sp},${Sp},${Sp}\\)$`),N3e=new RegExp(`^rgb\\(${ac},${ac},${ac}\\)$`),M3e=new RegExp(`^rgba\\(${Sp},${Sp},${Sp},${xy}\\)$`),I3e=new RegExp(`^rgba\\(${ac},${ac},${ac},${xy}\\)$`),O3e=new RegExp(`^hsl\\(${xy},${ac},${ac}\\)$`),P3e=new RegExp(`^hsla\\(${xy},${ac},${ac},${xy}\\)$`),VV={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};kh(Eh,pl,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:UV,formatHex:UV,formatHex8:B3e,formatHsl:F3e,formatRgb:HV,toString:HV});o(UV,"color_formatHex");o(B3e,"color_formatHex8");o(F3e,"color_formatHsl");o(HV,"color_formatRgb");o(pl,"color");o(YV,"rgbn");o(U4,"rgba");o(mA,"rgbConvert");o(Ap,"rgb");o(la,"Rgb");kh(la,Ap,Cp(Eh,{brighter(t){return t=t==null?Y4:Math.pow(Y4,t),new la(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?vy:Math.pow(vy,t),new la(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new la(nd(this.r),nd(this.g),nd(this.b),W4(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:WV,formatHex:WV,formatHex8:z3e,formatRgb:qV,toString:qV}));o(WV,"rgb_formatHex");o(z3e,"rgb_formatHex8");o(qV,"rgb_formatRgb");o(W4,"clampa");o(nd,"clampi");o(rd,"hex");o(XV,"hsla");o(KV,"hslConvert");o(QV,"hsl");o(dl,"Hsl");kh(dl,QV,Cp(Eh,{brighter(t){return t=t==null?Y4:Math.pow(Y4,t),new dl(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?vy:Math.pow(vy,t),new dl(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new la(pA(t>=240?t-240:t+120,i,n),pA(t,i,n),pA(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new dl(jV(this.h),H4(this.s),H4(this.l),W4(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let t=W4(this.opacity);return`${t===1?"hsl(":"hsla("}${jV(this.h)}, ${H4(this.s)*100}%, ${H4(this.l)*100}%${t===1?")":`, ${t})`}`}}));o(jV,"clamph");o(H4,"clampt");o(pA,"hsl2rgb")});var ZV,JV,eU=R(()=>{"use strict";ZV=Math.PI/180,JV=180/Math.PI});function sU(t){if(t instanceof sc)return new sc(t.l,t.a,t.b,t.opacity);if(t instanceof uu)return oU(t);t instanceof la||(t=mA(t));var e=bA(t.r),r=bA(t.g),n=bA(t.b),i=yA((.2225045*e+.7168786*r+.0606169*n)/rU),a,s;return e===r&&r===n?a=s=i:(a=yA((.4360747*e+.3850649*r+.1430804*n)/tU),s=yA((.0139322*e+.0971045*r+.7141733*n)/nU)),new sc(116*i-16,500*(a-i),200*(i-s),t.opacity)}function wA(t,e,r,n){return arguments.length===1?sU(t):new sc(t,e,r,n??1)}function sc(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function yA(t){return t>G3e?Math.pow(t,1/3):t/aU+iU}function vA(t){return t>_p?t*t*t:aU*(t-iU)}function xA(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function bA(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function $3e(t){if(t instanceof uu)return new uu(t.h,t.c,t.l,t.opacity);if(t instanceof sc||(t=sU(t)),t.a===0&&t.b===0)return new uu(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*JV;return new uu(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function by(t,e,r,n){return arguments.length===1?$3e(t):new uu(t,e,r,n??1)}function uu(t,e,r,n){this.h=+t,this.c=+e,this.l=+r,this.opacity=+n}function oU(t){if(isNaN(t.h))return new sc(t.l,0,0,t.opacity);var e=t.h*ZV;return new sc(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}var q4,tU,rU,nU,iU,_p,aU,G3e,lU=R(()=>{"use strict";dA();gA();eU();q4=18,tU=.96422,rU=1,nU=.82521,iU=4/29,_p=6/29,aU=3*_p*_p,G3e=_p*_p*_p;o(sU,"labConvert");o(wA,"lab");o(sc,"Lab");kh(sc,wA,Cp(Eh,{brighter(t){return new sc(this.l+q4*(t??1),this.a,this.b,this.opacity)},darker(t){return new sc(this.l-q4*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;return e=tU*vA(e),t=rU*vA(t),r=nU*vA(r),new la(xA(3.1338561*e-1.6168667*t-.4906146*r),xA(-.9787684*e+1.9161415*t+.033454*r),xA(.0719453*e-.2289914*t+1.4052427*r),this.opacity)}}));o(yA,"xyz2lab");o(vA,"lab2xyz");o(xA,"lrgb2rgb");o(bA,"rgb2lrgb");o($3e,"hclConvert");o(by,"hcl");o(uu,"Hcl");o(oU,"hcl2lab");kh(uu,by,Cp(Eh,{brighter(t){return new uu(this.h,this.c,this.l+q4*(t??1),this.opacity)},darker(t){return new uu(this.h,this.c,this.l-q4*(t??1),this.opacity)},rgb(){return oU(this).rgb()}}))});var Lp=R(()=>{"use strict";gA();lU()});function TA(t,e,r,n,i){var a=t*t,s=a*t;return((1-3*t+3*a-s)*e+(4-6*a+3*s)*r+(1+3*t+3*a-3*s)*n+s*i)/6}function kA(t){var e=t.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,e-1):Math.floor(r*e),i=t[n],a=t[n+1],s=n>0?t[n-1]:2*i-a,l=n<e-1?t[n+2]:2*a-i;return TA((r-n/e)*e,s,i,a,l)}}var EA=R(()=>{"use strict";o(TA,"basis");o(kA,"default")});function CA(t){var e=t.length;return function(r){var n=Math.floor(((r%=1)<0?++r:r)*e),i=t[(n+e-1)%e],a=t[n%e],s=t[(n+1)%e],l=t[(n+2)%e];return TA((r-n/e)*e,i,a,s,l)}}var cU=R(()=>{"use strict";EA();o(CA,"default")});var Dp,SA=R(()=>{"use strict";Dp=o(t=>()=>t,"default")});function uU(t,e){return function(r){return t+r*e}}function V3e(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function hU(t,e){var r=e-t;return r?uU(t,r>180||r<-180?r-360*Math.round(r/360):r):Dp(isNaN(t)?e:t)}function fU(t){return(t=+t)==1?hu:function(e,r){return r-e?V3e(e,r,t):Dp(isNaN(e)?r:e)}}function hu(t,e){var r=e-t;return r?uU(t,r):Dp(isNaN(t)?e:t)}var AA=R(()=>{"use strict";SA();o(uU,"linear");o(V3e,"exponential");o(hU,"hue");o(fU,"gamma");o(hu,"nogamma")});function dU(t){return function(e){var r=e.length,n=new Array(r),i=new Array(r),a=new Array(r),s,l;for(s=0;s<r;++s)l=Ap(e[s]),n[s]=l.r||0,i[s]=l.g||0,a[s]=l.b||0;return n=t(n),i=t(i),a=t(a),l.opacity=1,function(u){return l.r=n(u),l.g=i(u),l.b=a(u),l+""}}}var id,U3e,H3e,_A=R(()=>{"use strict";Lp();EA();cU();AA();id=o(function t(e){var r=fU(e);function n(i,a){var s=r((i=Ap(i)).r,(a=Ap(a)).r),l=r(i.g,a.g),u=r(i.b,a.b),h=hu(i.opacity,a.opacity);return function(f){return i.r=s(f),i.g=l(f),i.b=u(f),i.opacity=h(f),i+""}}return o(n,"rgb"),n.gamma=t,n},"rgbGamma")(1);o(dU,"rgbSpline");U3e=dU(kA),H3e=dU(CA)});function LA(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),i;return function(a){for(i=0;i<r;++i)n[i]=t[i]*(1-a)+e[i]*a;return n}}function pU(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}var mU=R(()=>{"use strict";o(LA,"default");o(pU,"isNumberArray")});function gU(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,i=new Array(n),a=new Array(r),s;for(s=0;s<n;++s)i[s]=Ch(t[s],e[s]);for(;s<r;++s)a[s]=e[s];return function(l){for(s=0;s<n;++s)a[s]=i[s](l);return a}}var yU=R(()=>{"use strict";X4();o(gU,"genericArray")});function DA(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}var vU=R(()=>{"use strict";o(DA,"default")});function ji(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}var wy=R(()=>{"use strict";o(ji,"default")});function RA(t,e){var r={},n={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?r[i]=Ch(t[i],e[i]):n[i]=e[i];return function(a){for(i in r)n[i]=r[i](a);return n}}var xU=R(()=>{"use strict";X4();o(RA,"default")});function Y3e(t){return function(){return t}}function W3e(t){return function(e){return t(e)+""}}function Rp(t,e){var r=MA.lastIndex=NA.lastIndex=0,n,i,a,s=-1,l=[],u=[];for(t=t+"",e=e+"";(n=MA.exec(t))&&(i=NA.exec(e));)(a=i.index)>r&&(a=e.slice(r,a),l[s]?l[s]+=a:l[++s]=a),(n=n[0])===(i=i[0])?l[s]?l[s]+=i:l[++s]=i:(l[++s]=null,u.push({i:s,x:ji(n,i)})),r=NA.lastIndex;return r<e.length&&(a=e.slice(r),l[s]?l[s]+=a:l[++s]=a),l.length<2?u[0]?W3e(u[0].x):Y3e(e):(e=u.length,function(h){for(var f=0,d;f<e;++f)l[(d=u[f]).i]=d.x(h);return l.join("")})}var MA,NA,IA=R(()=>{"use strict";wy();MA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,NA=new RegExp(MA.source,"g");o(Y3e,"zero");o(W3e,"one");o(Rp,"default")});function Ch(t,e){var r=typeof e,n;return e==null||r==="boolean"?Dp(e):(r==="number"?ji:r==="string"?(n=pl(e))?(e=n,id):Rp:e instanceof pl?id:e instanceof Date?DA:pU(e)?LA:Array.isArray(e)?gU:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?RA:ji)(t,e)}var X4=R(()=>{"use strict";Lp();_A();yU();vU();wy();xU();IA();SA();mU();o(Ch,"default")});function j4(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}var bU=R(()=>{"use strict";o(j4,"default")});function Q4(t,e,r,n,i,a){var s,l,u;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(u=t*r+e*n)&&(r-=t*u,n-=e*u),(l=Math.sqrt(r*r+n*n))&&(r/=l,n/=l,u/=l),t*n<e*r&&(t=-t,e=-e,u=-u,s=-s),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*wU,skewX:Math.atan(u)*wU,scaleX:s,scaleY:l}}var wU,K4,TU=R(()=>{"use strict";wU=180/Math.PI,K4={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};o(Q4,"default")});function kU(t){let e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?K4:Q4(e.a,e.b,e.c,e.d,e.e,e.f)}function EU(t){return t==null?K4:(Z4||(Z4=document.createElementNS("http://www.w3.org/2000/svg","g")),Z4.setAttribute("transform",t),(t=Z4.transform.baseVal.consolidate())?(t=t.matrix,Q4(t.a,t.b,t.c,t.d,t.e,t.f)):K4)}var Z4,CU=R(()=>{"use strict";TU();o(kU,"parseCss");o(EU,"parseSvg")});function SU(t,e,r,n){function i(h){return h.length?h.pop()+" ":""}o(i,"pop");function a(h,f,d,p,m,g){if(h!==d||f!==p){var y=m.push("translate(",null,e,null,r);g.push({i:y-4,x:ji(h,d)},{i:y-2,x:ji(f,p)})}else(d||p)&&m.push("translate("+d+e+p+r)}o(a,"translate");function s(h,f,d,p){h!==f?(h-f>180?f+=360:f-h>180&&(h+=360),p.push({i:d.push(i(d)+"rotate(",null,n)-2,x:ji(h,f)})):f&&d.push(i(d)+"rotate("+f+n)}o(s,"rotate");function l(h,f,d,p){h!==f?p.push({i:d.push(i(d)+"skewX(",null,n)-2,x:ji(h,f)}):f&&d.push(i(d)+"skewX("+f+n)}o(l,"skewX");function u(h,f,d,p,m,g){if(h!==d||f!==p){var y=m.push(i(m)+"scale(",null,",",null,")");g.push({i:y-4,x:ji(h,d)},{i:y-2,x:ji(f,p)})}else(d!==1||p!==1)&&m.push(i(m)+"scale("+d+","+p+")")}return o(u,"scale"),function(h,f){var d=[],p=[];return h=t(h),f=t(f),a(h.translateX,h.translateY,f.translateX,f.translateY,d,p),s(h.rotate,f.rotate,d,p),l(h.skewX,f.skewX,d,p),u(h.scaleX,h.scaleY,f.scaleX,f.scaleY,d,p),h=f=null,function(m){for(var g=-1,y=p.length,v;++g<y;)d[(v=p[g]).i]=v.x(m);return d.join("")}}}var OA,PA,AU=R(()=>{"use strict";wy();CU();o(SU,"interpolateTransform");OA=SU(kU,"px, ","px)","deg)"),PA=SU(EU,", ",")",")")});function _U(t){return function(e,r){var n=t((e=by(e)).h,(r=by(r)).h),i=hu(e.c,r.c),a=hu(e.l,r.l),s=hu(e.opacity,r.opacity);return function(l){return e.h=n(l),e.c=i(l),e.l=a(l),e.opacity=s(l),e+""}}}var BA,q3e,LU=R(()=>{"use strict";Lp();AA();o(_U,"hcl");BA=_U(hU),q3e=_U(hu)});var Np=R(()=>{"use strict";X4();wy();bU();IA();AU();_A();LU()});function Ay(){return ad||(NU(X3e),ad=Cy.now()+t3)}function X3e(){ad=0}function Sy(){this._call=this._time=this._next=null}function r3(t,e,r){var n=new Sy;return n.restart(t,e,r),n}function MU(){Ay(),++Mp;for(var t=J4,e;t;)(e=ad-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Mp}function DU(){ad=(e3=Cy.now())+t3,Mp=ky=0;try{MU()}finally{Mp=0,K3e(),ad=0}}function j3e(){var t=Cy.now(),e=t-e3;e>RU&&(t3-=e,e3=t)}function K3e(){for(var t,e=J4,r,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:J4=r);Ey=t,FA(n)}function FA(t){if(!Mp){ky&&(ky=clearTimeout(ky));var e=t-ad;e>24?(t<1/0&&(ky=setTimeout(DU,t-Cy.now()-t3)),Ty&&(Ty=clearInterval(Ty))):(Ty||(e3=Cy.now(),Ty=setInterval(j3e,RU)),Mp=1,NU(DU))}}var Mp,ky,Ty,RU,J4,Ey,e3,ad,t3,Cy,NU,zA=R(()=>{"use strict";Mp=0,ky=0,Ty=0,RU=1e3,e3=0,ad=0,t3=0,Cy=typeof performance=="object"&&performance.now?performance:Date,NU=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};o(Ay,"now");o(X3e,"clearNow");o(Sy,"Timer");Sy.prototype=r3.prototype={constructor:Sy,restart:o(function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?Ay():+r)+(e==null?0:+e),!this._next&&Ey!==this&&(Ey?Ey._next=this:J4=this,Ey=this),this._call=t,this._time=r,FA()},"restart"),stop:o(function(){this._call&&(this._call=null,this._time=1/0,FA())},"stop")};o(r3,"timer");o(MU,"timerFlush");o(DU,"wake");o(j3e,"poke");o(K3e,"nap");o(FA,"sleep")});function _y(t,e,r){var n=new Sy;return e=e==null?0:+e,n.restart(i=>{n.stop(),t(i+e)},e,r),n}var IU=R(()=>{"use strict";zA();o(_y,"default")});var n3=R(()=>{"use strict";zA();IU()});function fu(t,e,r,n,i,a){var s=t.__transition;if(!s)t.__transition={};else if(r in s)return;J3e(t,r,{name:e,index:n,group:i,on:Q3e,tween:Z3e,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:BU})}function Dy(t,e){var r=Mi(t,e);if(r.state>BU)throw new Error("too late; already scheduled");return r}function ca(t,e){var r=Mi(t,e);if(r.state>i3)throw new Error("too late; already running");return r}function Mi(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function J3e(t,e,r){var n=t.__transition,i;n[e]=r,r.timer=r3(a,0,r.time);function a(h){r.state=OU,r.timer.restart(s,r.delay,r.time),r.delay<=h&&s(h-r.delay)}o(a,"schedule");function s(h){var f,d,p,m;if(r.state!==OU)return u();for(f in n)if(m=n[f],m.name===r.name){if(m.state===i3)return _y(s);m.state===PU?(m.state=Ly,m.timer.stop(),m.on.call("interrupt",t,t.__data__,m.index,m.group),delete n[f]):+f<e&&(m.state=Ly,m.timer.stop(),m.on.call("cancel",t,t.__data__,m.index,m.group),delete n[f])}if(_y(function(){r.state===i3&&(r.state=PU,r.timer.restart(l,r.delay,r.time),l(h))}),r.state=a3,r.on.call("start",t,t.__data__,r.index,r.group),r.state===a3){for(r.state=i3,i=new Array(p=r.tween.length),f=0,d=-1;f<p;++f)(m=r.tween[f].value.call(t,t.__data__,r.index,r.group))&&(i[++d]=m);i.length=d+1}}o(s,"start");function l(h){for(var f=h<r.duration?r.ease.call(null,h/r.duration):(r.timer.restart(u),r.state=s3,1),d=-1,p=i.length;++d<p;)i[d].call(t,f);r.state===s3&&(r.on.call("end",t,t.__data__,r.index,r.group),u())}o(l,"tick");function u(){r.state=Ly,r.timer.stop(),delete n[e];for(var h in n)return;delete t.__transition}o(u,"stop")}var Q3e,Z3e,BU,OU,a3,i3,PU,s3,Ly,ys=R(()=>{"use strict";bS();n3();Q3e=xS("start","end","cancel","interrupt"),Z3e=[],BU=0,OU=1,a3=2,i3=3,PU=4,s3=5,Ly=6;o(fu,"default");o(Dy,"init");o(ca,"set");o(Mi,"get");o(J3e,"create")});function Ry(t,e){var r=t.__transition,n,i,a=!0,s;if(r){e=e==null?null:e+"";for(s in r){if((n=r[s]).name!==e){a=!1;continue}i=n.state>a3&&n.state<s3,n.state=Ly,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[s]}a&&delete t.__transition}}var FU=R(()=>{"use strict";ys();o(Ry,"default")});function GA(t){return this.each(function(){Ry(this,t)})}var zU=R(()=>{"use strict";FU();o(GA,"default")});function e5e(t,e){var r,n;return function(){var i=ca(this,t),a=i.tween;if(a!==r){n=r=a;for(var s=0,l=n.length;s<l;++s)if(n[s].name===e){n=n.slice(),n.splice(s,1);break}}i.tween=n}}function t5e(t,e,r){var n,i;if(typeof r!="function")throw new Error;return function(){var a=ca(this,t),s=a.tween;if(s!==n){i=(n=s).slice();for(var l={name:e,value:r},u=0,h=i.length;u<h;++u)if(i[u].name===e){i[u]=l;break}u===h&&i.push(l)}a.tween=i}}function $A(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n=Mi(this.node(),r).tween,i=0,a=n.length,s;i<a;++i)if((s=n[i]).name===t)return s.value;return null}return this.each((e==null?e5e:t5e)(r,t,e))}function Ip(t,e,r){var n=t._id;return t.each(function(){var i=ca(this,n);(i.value||(i.value={}))[e]=r.apply(this,arguments)}),function(i){return Mi(i,n).value[e]}}var Ny=R(()=>{"use strict";ys();o(e5e,"tweenRemove");o(t5e,"tweenFunction");o($A,"default");o(Ip,"tweenValue")});function My(t,e){var r;return(typeof e=="number"?ji:e instanceof pl?id:(r=pl(e))?(e=r,id):Rp)(t,e)}var VA=R(()=>{"use strict";Lp();Np();o(My,"default")});function r5e(t){return function(){this.removeAttribute(t)}}function n5e(t){return function(){this.removeAttributeNS(t.space,t.local)}}function i5e(t,e,r){var n,i=r+"",a;return function(){var s=this.getAttribute(t);return s===i?null:s===n?a:a=e(n=s,r)}}function a5e(t,e,r){var n,i=r+"",a;return function(){var s=this.getAttributeNS(t.space,t.local);return s===i?null:s===n?a:a=e(n=s,r)}}function s5e(t,e,r){var n,i,a;return function(){var s,l=r(this),u;return l==null?void this.removeAttribute(t):(s=this.getAttribute(t),u=l+"",s===u?null:s===n&&u===i?a:(i=u,a=e(n=s,l)))}}function o5e(t,e,r){var n,i,a;return function(){var s,l=r(this),u;return l==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),u=l+"",s===u?null:s===n&&u===i?a:(i=u,a=e(n=s,l)))}}function UA(t,e){var r=ic(t),n=r==="transform"?PA:My;return this.attrTween(t,typeof e=="function"?(r.local?o5e:s5e)(r,n,Ip(this,"attr."+t,e)):e==null?(r.local?n5e:r5e)(r):(r.local?a5e:i5e)(r,n,e))}var GU=R(()=>{"use strict";Np();fl();Ny();VA();o(r5e,"attrRemove");o(n5e,"attrRemoveNS");o(i5e,"attrConstant");o(a5e,"attrConstantNS");o(s5e,"attrFunction");o(o5e,"attrFunctionNS");o(UA,"default")});function l5e(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function c5e(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function u5e(t,e){var r,n;function i(){var a=e.apply(this,arguments);return a!==n&&(r=(n=a)&&c5e(t,a)),r}return o(i,"tween"),i._value=e,i}function h5e(t,e){var r,n;function i(){var a=e.apply(this,arguments);return a!==n&&(r=(n=a)&&l5e(t,a)),r}return o(i,"tween"),i._value=e,i}function HA(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;var n=ic(t);return this.tween(r,(n.local?u5e:h5e)(n,e))}var $U=R(()=>{"use strict";fl();o(l5e,"attrInterpolate");o(c5e,"attrInterpolateNS");o(u5e,"attrTweenNS");o(h5e,"attrTween");o(HA,"default")});function f5e(t,e){return function(){Dy(this,t).delay=+e.apply(this,arguments)}}function d5e(t,e){return e=+e,function(){Dy(this,t).delay=e}}function YA(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?f5e:d5e)(e,t)):Mi(this.node(),e).delay}var VU=R(()=>{"use strict";ys();o(f5e,"delayFunction");o(d5e,"delayConstant");o(YA,"default")});function p5e(t,e){return function(){ca(this,t).duration=+e.apply(this,arguments)}}function m5e(t,e){return e=+e,function(){ca(this,t).duration=e}}function WA(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?p5e:m5e)(e,t)):Mi(this.node(),e).duration}var UU=R(()=>{"use strict";ys();o(p5e,"durationFunction");o(m5e,"durationConstant");o(WA,"default")});function g5e(t,e){if(typeof e!="function")throw new Error;return function(){ca(this,t).ease=e}}function qA(t){var e=this._id;return arguments.length?this.each(g5e(e,t)):Mi(this.node(),e).ease}var HU=R(()=>{"use strict";ys();o(g5e,"easeConstant");o(qA,"default")});function y5e(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;ca(this,t).ease=r}}function XA(t){if(typeof t!="function")throw new Error;return this.each(y5e(this._id,t))}var YU=R(()=>{"use strict";ys();o(y5e,"easeVarying");o(XA,"default")});function jA(t){typeof t!="function"&&(t=Ep(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var a=e[i],s=a.length,l=n[i]=[],u,h=0;h<s;++h)(u=a[h])&&t.call(u,u.__data__,h,a)&&l.push(u);return new Ka(n,this._parents,this._name,this._id)}var WU=R(()=>{"use strict";fl();sd();o(jA,"default")});function KA(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,r=t._groups,n=e.length,i=r.length,a=Math.min(n,i),s=new Array(n),l=0;l<a;++l)for(var u=e[l],h=r[l],f=u.length,d=s[l]=new Array(f),p,m=0;m<f;++m)(p=u[m]||h[m])&&(d[m]=p);for(;l<n;++l)s[l]=e[l];return new Ka(s,this._parents,this._name,this._id)}var qU=R(()=>{"use strict";sd();o(KA,"default")});function v5e(t){return(t+"").trim().split(/^|\s+/).every(function(e){var r=e.indexOf(".");return r>=0&&(e=e.slice(0,r)),!e||e==="start"})}function x5e(t,e,r){var n,i,a=v5e(e)?Dy:ca;return function(){var s=a(this,t),l=s.on;l!==n&&(i=(n=l).copy()).on(e,r),s.on=i}}function QA(t,e){var r=this._id;return arguments.length<2?Mi(this.node(),r).on.on(t):this.each(x5e(r,t,e))}var XU=R(()=>{"use strict";ys();o(v5e,"start");o(x5e,"onFunction");o(QA,"default")});function b5e(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function ZA(){return this.on("end.remove",b5e(this._id))}var jU=R(()=>{"use strict";o(b5e,"removeFunction");o(ZA,"default")});function JA(t){var e=this._name,r=this._id;typeof t!="function"&&(t=wh(t));for(var n=this._groups,i=n.length,a=new Array(i),s=0;s<i;++s)for(var l=n[s],u=l.length,h=a[s]=new Array(u),f,d,p=0;p<u;++p)(f=l[p])&&(d=t.call(f,f.__data__,p,l))&&("__data__"in f&&(d.__data__=f.__data__),h[p]=d,fu(h[p],e,r,p,h,Mi(f,r)));return new Ka(a,this._parents,e,r)}var KU=R(()=>{"use strict";fl();sd();ys();o(JA,"default")});function e8(t){var e=this._name,r=this._id;typeof t!="function"&&(t=kp(t));for(var n=this._groups,i=n.length,a=[],s=[],l=0;l<i;++l)for(var u=n[l],h=u.length,f,d=0;d<h;++d)if(f=u[d]){for(var p=t.call(f,f.__data__,d,u),m,g=Mi(f,r),y=0,v=p.length;y<v;++y)(m=p[y])&&fu(m,e,r,y,p,g);a.push(p),s.push(f)}return new Ka(a,s,e,r)}var QU=R(()=>{"use strict";fl();sd();ys();o(e8,"default")});function t8(){return new w5e(this._groups,this._parents)}var w5e,ZU=R(()=>{"use strict";fl();w5e=cu.prototype.constructor;o(t8,"default")});function T5e(t,e){var r,n,i;return function(){var a=Th(this,t),s=(this.style.removeProperty(t),Th(this,t));return a===s?null:a===r&&s===n?i:i=e(r=a,n=s)}}function JU(t){return function(){this.style.removeProperty(t)}}function k5e(t,e,r){var n,i=r+"",a;return function(){var s=Th(this,t);return s===i?null:s===n?a:a=e(n=s,r)}}function E5e(t,e,r){var n,i,a;return function(){var s=Th(this,t),l=r(this),u=l+"";return l==null&&(u=l=(this.style.removeProperty(t),Th(this,t))),s===u?null:s===n&&u===i?a:(i=u,a=e(n=s,l))}}function C5e(t,e){var r,n,i,a="style."+e,s="end."+a,l;return function(){var u=ca(this,t),h=u.on,f=u.value[a]==null?l||(l=JU(e)):void 0;(h!==r||i!==f)&&(n=(r=h).copy()).on(s,i=f),u.on=n}}function r8(t,e,r){var n=(t+="")=="transform"?OA:My;return e==null?this.styleTween(t,T5e(t,n)).on("end.style."+t,JU(t)):typeof e=="function"?this.styleTween(t,E5e(t,n,Ip(this,"style."+t,e))).each(C5e(this._id,t)):this.styleTween(t,k5e(t,n,e),r).on("end.style."+t,null)}var eH=R(()=>{"use strict";Np();fl();ys();Ny();VA();o(T5e,"styleNull");o(JU,"styleRemove");o(k5e,"styleConstant");o(E5e,"styleFunction");o(C5e,"styleMaybeRemove");o(r8,"default")});function S5e(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function A5e(t,e,r){var n,i;function a(){var s=e.apply(this,arguments);return s!==i&&(n=(i=s)&&S5e(t,s,r)),n}return o(a,"tween"),a._value=e,a}function n8(t,e,r){var n="style."+(t+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,A5e(t,e,r??""))}var tH=R(()=>{"use strict";o(S5e,"styleInterpolate");o(A5e,"styleTween");o(n8,"default")});function _5e(t){return function(){this.textContent=t}}function L5e(t){return function(){var e=t(this);this.textContent=e??""}}function i8(t){return this.tween("text",typeof t=="function"?L5e(Ip(this,"text",t)):_5e(t==null?"":t+""))}var rH=R(()=>{"use strict";Ny();o(_5e,"textConstant");o(L5e,"textFunction");o(i8,"default")});function D5e(t){return function(e){this.textContent=t.call(this,e)}}function R5e(t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&D5e(i)),e}return o(n,"tween"),n._value=t,n}function a8(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,R5e(t))}var nH=R(()=>{"use strict";o(D5e,"textInterpolate");o(R5e,"textTween");o(a8,"default")});function s8(){for(var t=this._name,e=this._id,r=o3(),n=this._groups,i=n.length,a=0;a<i;++a)for(var s=n[a],l=s.length,u,h=0;h<l;++h)if(u=s[h]){var f=Mi(u,e);fu(u,t,r,h,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Ka(n,this._parents,t,r)}var iH=R(()=>{"use strict";sd();ys();o(s8,"default")});function o8(){var t,e,r=this,n=r._id,i=r.size();return new Promise(function(a,s){var l={value:s},u={value:o(function(){--i===0&&a()},"value")};r.each(function(){var h=ca(this,n),f=h.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(u)),h.on=e}),i===0&&a()})}var aH=R(()=>{"use strict";ys();o(o8,"default")});function Ka(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function sH(t){return cu().transition(t)}function o3(){return++N5e}var N5e,du,sd=R(()=>{"use strict";fl();GU();$U();VU();UU();HU();YU();WU();qU();XU();jU();KU();QU();ZU();eH();tH();rH();nH();iH();Ny();aH();N5e=0;o(Ka,"Transition");o(sH,"transition");o(o3,"newId");du=cu.prototype;Ka.prototype=sH.prototype={constructor:Ka,select:JA,selectAll:e8,selectChild:du.selectChild,selectChildren:du.selectChildren,filter:jA,merge:KA,selection:t8,transition:s8,call:du.call,nodes:du.nodes,node:du.node,size:du.size,empty:du.empty,each:du.each,on:QA,attr:UA,attrTween:HA,style:r8,styleTween:n8,text:i8,textTween:a8,remove:ZA,tween:$A,delay:YA,duration:WA,ease:qA,easeVarying:XA,end:o8,[Symbol.iterator]:du[Symbol.iterator]}});function l3(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var oH=R(()=>{"use strict";o(l3,"cubicInOut")});var l8=R(()=>{"use strict";oH()});function I5e(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return r}function c8(t){var e,r;t instanceof Ka?(e=t._id,t=t._name):(e=o3(),(r=M5e).time=Ay(),t=t==null?null:t+"");for(var n=this._groups,i=n.length,a=0;a<i;++a)for(var s=n[a],l=s.length,u,h=0;h<l;++h)(u=s[h])&&fu(u,t,e,h,s,r||I5e(u,e));return new Ka(n,this._parents,t,e)}var M5e,lH=R(()=>{"use strict";sd();ys();l8();n3();M5e={time:null,delay:0,duration:250,ease:l3};o(I5e,"inherit");o(c8,"default")});var cH=R(()=>{"use strict";fl();zU();lH();cu.prototype.interrupt=GA;cu.prototype.transition=c8});var c3=R(()=>{"use strict";cH()});var uH=R(()=>{"use strict"});var hH=R(()=>{"use strict"});var fH=R(()=>{"use strict"});function dH(t){return[+t[0],+t[1]]}function O5e(t){return[dH(t[0]),dH(t[1])]}function u8(t){return{type:t}}var Kpt,Qpt,Zpt,Jpt,emt,tmt,pH=R(()=>{"use strict";c3();uH();hH();fH();({abs:Kpt,max:Qpt,min:Zpt}=Math);o(dH,"number1");o(O5e,"number2");Jpt={name:"x",handles:["w","e"].map(u8),input:o(function(t,e){return t==null?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},"input"),output:o(function(t){return t&&[t[0][0],t[1][0]]},"output")},emt={name:"y",handles:["n","s"].map(u8),input:o(function(t,e){return t==null?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},"input"),output:o(function(t){return t&&[t[0][1],t[1][1]]},"output")},tmt={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(u8),input:o(function(t){return t==null?null:O5e(t)},"input"),output:o(function(t){return t},"output")};o(u8,"type")});var mH=R(()=>{"use strict";pH()});function gH(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function B5e(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return gH;let r=10**e;return function(n){this._+=n[0];for(let i=1,a=n.length;i<a;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}function yH(){return new ld}var h8,f8,od,P5e,ld,vH=R(()=>{"use strict";h8=Math.PI,f8=2*h8,od=1e-6,P5e=f8-od;o(gH,"append");o(B5e,"appendRound");ld=class{static{o(this,"Path")}constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?gH:B5e(e)}moveTo(e,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,r){this._append`L${this._x1=+e},${this._y1=+r}`}quadraticCurveTo(e,r,n,i){this._append`Q${+e},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(e,r,n,i,a,s){this._append`C${+e},${+r},${+n},${+i},${this._x1=+a},${this._y1=+s}`}arcTo(e,r,n,i,a){if(e=+e,r=+r,n=+n,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,l=this._y1,u=n-e,h=i-r,f=s-e,d=l-r,p=f*f+d*d;if(this._x1===null)this._append`M${this._x1=e},${this._y1=r}`;else if(p>od)if(!(Math.abs(d*u-h*f)>od)||!a)this._append`L${this._x1=e},${this._y1=r}`;else{let m=n-s,g=i-l,y=u*u+h*h,v=m*m+g*g,x=Math.sqrt(y),b=Math.sqrt(p),w=a*Math.tan((h8-Math.acos((y+p-v)/(2*x*b)))/2),S=w/b,T=w/x;Math.abs(S-1)>od&&this._append`L${e+S*f},${r+S*d}`,this._append`A${a},${a},0,0,${+(d*m>f*g)},${this._x1=e+T*u},${this._y1=r+T*h}`}}arc(e,r,n,i,a,s){if(e=+e,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(i),u=n*Math.sin(i),h=e+l,f=r+u,d=1^s,p=s?i-a:a-i;this._x1===null?this._append`M${h},${f}`:(Math.abs(this._x1-h)>od||Math.abs(this._y1-f)>od)&&this._append`L${h},${f}`,n&&(p<0&&(p=p%f8+f8),p>P5e?this._append`A${n},${n},0,1,${d},${e-l},${r-u}A${n},${n},0,1,${d},${this._x1=h},${this._y1=f}`:p>od&&this._append`A${n},${n},0,${+(p>=h8)},${d},${this._x1=e+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(e,r,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}};o(yH,"path");yH.prototype=ld.prototype});var d8=R(()=>{"use strict";vH()});var xH=R(()=>{"use strict"});var bH=R(()=>{"use strict"});var wH=R(()=>{"use strict"});var TH=R(()=>{"use strict"});var kH=R(()=>{"use strict"});var EH=R(()=>{"use strict"});var CH=R(()=>{"use strict"});function p8(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function cd(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}var Iy=R(()=>{"use strict";o(p8,"default");o(cd,"formatDecimalParts")});function ml(t){return t=cd(Math.abs(t)),t?t[1]:NaN}var Oy=R(()=>{"use strict";Iy();o(ml,"default")});function m8(t,e){return function(r,n){for(var i=r.length,a=[],s=0,l=t[0],u=0;i>0&&l>0&&(u+l+1>n&&(l=Math.max(1,n-u)),a.push(r.substring(i-=l,i+l)),!((u+=l+1)>n));)l=t[s=(s+1)%t.length];return a.reverse().join(e)}}var SH=R(()=>{"use strict";o(m8,"default")});function g8(t){return function(e){return e.replace(/[0-9]/g,function(r){return t[+r]})}}var AH=R(()=>{"use strict";o(g8,"default")});function Sh(t){if(!(e=F5e.exec(t)))throw new Error("invalid format: "+t);var e;return new u3({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function u3(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}var F5e,y8=R(()=>{"use strict";F5e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;o(Sh,"formatSpecifier");Sh.prototype=u3.prototype;o(u3,"FormatSpecifier");u3.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type}});function v8(t){e:for(var e=t.length,r=1,n=-1,i;r<e;++r)switch(t[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+t[r])break e;n>0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(i+1):t}var _H=R(()=>{"use strict";o(v8,"default")});function b8(t,e){var r=cd(t,e);if(!r)return t+"";var n=r[0],i=r[1],a=i-(x8=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return a===s?n:a>s?n+new Array(a-s+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+cd(t,Math.max(0,e+a-1))[0]}var x8,w8=R(()=>{"use strict";Iy();o(b8,"default")});function h3(t,e){var r=cd(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}var LH=R(()=>{"use strict";Iy();o(h3,"default")});var T8,DH=R(()=>{"use strict";Iy();w8();LH();T8={"%":o((t,e)=>(t*100).toFixed(e),"%"),b:o(t=>Math.round(t).toString(2),"b"),c:o(t=>t+"","c"),d:p8,e:o((t,e)=>t.toExponential(e),"e"),f:o((t,e)=>t.toFixed(e),"f"),g:o((t,e)=>t.toPrecision(e),"g"),o:o(t=>Math.round(t).toString(8),"o"),p:o((t,e)=>h3(t*100,e),"p"),r:h3,s:b8,X:o(t=>Math.round(t).toString(16).toUpperCase(),"X"),x:o(t=>Math.round(t).toString(16),"x")}});function f3(t){return t}var RH=R(()=>{"use strict";o(f3,"default")});function k8(t){var e=t.grouping===void 0||t.thousands===void 0?f3:m8(NH.call(t.grouping,Number),t.thousands+""),r=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?f3:g8(NH.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"\u2212":t.minus+"",u=t.nan===void 0?"NaN":t.nan+"";function h(d){d=Sh(d);var p=d.fill,m=d.align,g=d.sign,y=d.symbol,v=d.zero,x=d.width,b=d.comma,w=d.precision,S=d.trim,T=d.type;T==="n"?(b=!0,T="g"):T8[T]||(w===void 0&&(w=12),S=!0,T="g"),(v||p==="0"&&m==="=")&&(v=!0,p="0",m="=");var E=y==="$"?r:y==="#"&&/[boxX]/.test(T)?"0"+T.toLowerCase():"",_=y==="$"?n:/[%p]/.test(T)?s:"",A=T8[T],L=/[defgprs%]/.test(T);w=w===void 0?6:/[gprs]/.test(T)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function M(N){var k=E,I=_,C,O,D;if(T==="c")I=A(N)+I,N="";else{N=+N;var P=N<0||1/N<0;if(N=isNaN(N)?u:A(Math.abs(N),w),S&&(N=v8(N)),P&&+N==0&&g!=="+"&&(P=!1),k=(P?g==="("?g:l:g==="-"||g==="("?"":g)+k,I=(T==="s"?MH[8+x8/3]:"")+I+(P&&g==="("?")":""),L){for(C=-1,O=N.length;++C<O;)if(D=N.charCodeAt(C),48>D||D>57){I=(D===46?i+N.slice(C+1):N.slice(C))+I,N=N.slice(0,C);break}}}b&&!v&&(N=e(N,1/0));var F=k.length+N.length+I.length,B=F<x?new Array(x-F+1).join(p):"";switch(b&&v&&(N=e(B+N,B.length?x-I.length:1/0),B=""),m){case"<":N=k+N+I+B;break;case"=":N=k+B+N+I;break;case"^":N=B.slice(0,F=B.length>>1)+k+N+I+B.slice(F);break;default:N=B+k+N+I;break}return a(N)}return o(M,"format"),M.toString=function(){return d+""},M}o(h,"newFormat");function f(d,p){var m=h((d=Sh(d),d.type="f",d)),g=Math.max(-8,Math.min(8,Math.floor(ml(p)/3)))*3,y=Math.pow(10,-g),v=MH[8+g/3];return function(x){return m(y*x)+v}}return o(f,"formatPrefix"),{format:h,formatPrefix:f}}var NH,MH,IH=R(()=>{"use strict";Oy();SH();AH();y8();_H();DH();w8();RH();NH=Array.prototype.map,MH=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];o(k8,"default")});function E8(t){return d3=k8(t),p3=d3.format,m3=d3.formatPrefix,d3}var d3,p3,m3,OH=R(()=>{"use strict";IH();E8({thousands:",",grouping:[3],currency:["$",""]});o(E8,"defaultLocale")});function g3(t){return Math.max(0,-ml(Math.abs(t)))}var PH=R(()=>{"use strict";Oy();o(g3,"default")});function y3(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ml(e)/3)))*3-ml(Math.abs(t)))}var BH=R(()=>{"use strict";Oy();o(y3,"default")});function v3(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,ml(e)-ml(t))+1}var FH=R(()=>{"use strict";Oy();o(v3,"default")});var C8=R(()=>{"use strict";OH();y8();PH();BH();FH()});var zH=R(()=>{"use strict"});var GH=R(()=>{"use strict"});var $H=R(()=>{"use strict"});var VH=R(()=>{"use strict"});function Ah(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}var Py=R(()=>{"use strict";o(Ah,"initRange")});function pu(){var t=new wp,e=[],r=[],n=S8;function i(a){let s=t.get(a);if(s===void 0){if(n!==S8)return n;t.set(a,s=e.push(a)-1)}return r[s%r.length]}return o(i,"scale"),i.domain=function(a){if(!arguments.length)return e.slice();e=[],t=new wp;for(let s of a)t.has(s)||t.set(s,e.push(s)-1);return i},i.range=function(a){return arguments.length?(r=Array.from(a),i):r.slice()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return pu(e,r).unknown(n)},Ah.apply(i,arguments),i}var S8,A8=R(()=>{"use strict";bh();Py();S8=Symbol("implicit");o(pu,"ordinal")});function Op(){var t=pu().unknown(void 0),e=t.domain,r=t.range,n=0,i=1,a,s,l=!1,u=0,h=0,f=.5;delete t.unknown;function d(){var p=e().length,m=i<n,g=m?i:n,y=m?n:i;a=(y-g)/Math.max(1,p-u+h*2),l&&(a=Math.floor(a)),g+=(y-g-a*(p-u))*f,s=a*(1-u),l&&(g=Math.round(g),s=Math.round(s));var v=O4(p).map(function(x){return g+a*x});return r(m?v.reverse():v)}return o(d,"rescale"),t.domain=function(p){return arguments.length?(e(p),d()):e()},t.range=function(p){return arguments.length?([n,i]=p,n=+n,i=+i,d()):[n,i]},t.rangeRound=function(p){return[n,i]=p,n=+n,i=+i,l=!0,d()},t.bandwidth=function(){return s},t.step=function(){return a},t.round=function(p){return arguments.length?(l=!!p,d()):l},t.padding=function(p){return arguments.length?(u=Math.min(1,h=+p),d()):u},t.paddingInner=function(p){return arguments.length?(u=Math.min(1,p),d()):u},t.paddingOuter=function(p){return arguments.length?(h=+p,d()):h},t.align=function(p){return arguments.length?(f=Math.max(0,Math.min(1,p)),d()):f},t.copy=function(){return Op(e(),[n,i]).round(l).paddingInner(u).paddingOuter(h).align(f)},Ah.apply(d(),arguments)}var UH=R(()=>{"use strict";bh();Py();A8();o(Op,"band")});function _8(t){return function(){return t}}var HH=R(()=>{"use strict";o(_8,"constants")});function L8(t){return+t}var YH=R(()=>{"use strict";o(L8,"number")});function Pp(t){return t}function D8(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:_8(isNaN(e)?NaN:.5)}function z5e(t,e){var r;return t>e&&(r=t,t=e,e=r),function(n){return Math.max(t,Math.min(e,n))}}function G5e(t,e,r){var n=t[0],i=t[1],a=e[0],s=e[1];return i<n?(n=D8(i,n),a=r(s,a)):(n=D8(n,i),a=r(a,s)),function(l){return a(n(l))}}function $5e(t,e,r){var n=Math.min(t.length,e.length)-1,i=new Array(n),a=new Array(n),s=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<n;)i[s]=D8(t[s],t[s+1]),a[s]=r(e[s],e[s+1]);return function(l){var u=dS(t,l,1,n)-1;return a[u](i[u](l))}}function x3(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function V5e(){var t=WH,e=WH,r=Ch,n,i,a,s=Pp,l,u,h;function f(){var p=Math.min(t.length,e.length);return s!==Pp&&(s=z5e(t[0],t[p-1])),l=p>2?$5e:G5e,u=h=null,d}o(f,"rescale");function d(p){return p==null||isNaN(p=+p)?a:(u||(u=l(t.map(n),e,r)))(n(s(p)))}return o(d,"scale"),d.invert=function(p){return s(i((h||(h=l(e,t.map(n),ji)))(p)))},d.domain=function(p){return arguments.length?(t=Array.from(p,L8),f()):t.slice()},d.range=function(p){return arguments.length?(e=Array.from(p),f()):e.slice()},d.rangeRound=function(p){return e=Array.from(p),r=j4,f()},d.clamp=function(p){return arguments.length?(s=p?!0:Pp,f()):s!==Pp},d.interpolate=function(p){return arguments.length?(r=p,f()):r},d.unknown=function(p){return arguments.length?(a=p,d):a},function(p,m){return n=p,i=m,f()}}function By(){return V5e()(Pp,Pp)}var WH,R8=R(()=>{"use strict";bh();Np();HH();YH();WH=[0,1];o(Pp,"identity");o(D8,"normalize");o(z5e,"clamper");o(G5e,"bimap");o($5e,"polymap");o(x3,"copy");o(V5e,"transformer");o(By,"continuous")});function N8(t,e,r,n){var i=Tp(t,e,r),a;switch(n=Sh(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return n.precision==null&&!isNaN(a=y3(i,s))&&(n.precision=a),m3(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=v3(i,Math.max(Math.abs(t),Math.abs(e))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=g3(i))&&(n.precision=a-(n.type==="%")*2);break}}return p3(n)}var qH=R(()=>{"use strict";bh();C8();o(N8,"tickFormat")});function U5e(t){var e=t.domain;return t.ticks=function(r){var n=e();return N4(n[0],n[n.length-1],r??10)},t.tickFormat=function(r,n){var i=e();return N8(i[0],i[i.length-1],r??10,n)},t.nice=function(r){r==null&&(r=10);var n=e(),i=0,a=n.length-1,s=n[i],l=n[a],u,h,f=10;for(l<s&&(h=s,s=l,l=h,h=i,i=a,a=h);f-- >0;){if(h=fy(s,l,r),h===u)return n[i]=s,n[a]=l,e(n);if(h>0)s=Math.floor(s/h)*h,l=Math.ceil(l/h)*h;else if(h<0)s=Math.ceil(s*h)/h,l=Math.floor(l*h)/h;else break;u=h}return t},t}function gl(){var t=By();return t.copy=function(){return x3(t,gl())},Ah.apply(t,arguments),U5e(t)}var XH=R(()=>{"use strict";bh();R8();Py();qH();o(U5e,"linearish");o(gl,"linear")});function M8(t,e){t=t.slice();var r=0,n=t.length-1,i=t[r],a=t[n],s;return a<i&&(s=r,r=n,n=s,s=i,i=a,a=s),t[r]=e.floor(i),t[n]=e.ceil(a),t}var jH=R(()=>{"use strict";o(M8,"nice")});function dn(t,e,r,n){function i(a){return t(a=arguments.length===0?new Date:new Date(+a)),a}return o(i,"interval"),i.floor=a=>(t(a=new Date(+a)),a),i.ceil=a=>(t(a=new Date(a-1)),e(a,1),t(a),a),i.round=a=>{let s=i(a),l=i.ceil(a);return a-s<l-a?s:l},i.offset=(a,s)=>(e(a=new Date(+a),s==null?1:Math.floor(s)),a),i.range=(a,s,l)=>{let u=[];if(a=i.ceil(a),l=l==null?1:Math.floor(l),!(a<s)||!(l>0))return u;let h;do u.push(h=new Date(+a)),e(a,l),t(a);while(h<a&&a<s);return u},i.filter=a=>dn(s=>{if(s>=s)for(;t(s),!a(s);)s.setTime(s-1)},(s,l)=>{if(s>=s)if(l<0)for(;++l<=0;)for(;e(s,-1),!a(s););else for(;--l>=0;)for(;e(s,1),!a(s););}),r&&(i.count=(a,s)=>(I8.setTime(+a),O8.setTime(+s),t(I8),t(O8),Math.floor(r(I8,O8))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?s=>n(s)%a===0:s=>i.count(0,s)%a===0):i)),i}var I8,O8,mu=R(()=>{"use strict";I8=new Date,O8=new Date;o(dn,"timeInterval")});var oc,KH,P8=R(()=>{"use strict";mu();oc=dn(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);oc.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?dn(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):oc);KH=oc.range});var Ks,QH,B8=R(()=>{"use strict";mu();Ks=dn(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*1e3)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds()),QH=Ks.range});var gu,H5e,b3,Y5e,F8=R(()=>{"use strict";mu();gu=dn(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getMinutes()),H5e=gu.range,b3=dn(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes()),Y5e=b3.range});var yu,W5e,w3,q5e,z8=R(()=>{"use strict";mu();yu=dn(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3-t.getMinutes()*6e4)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getHours()),W5e=yu.range,w3=dn(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours()),q5e=w3.range});var Do,X5e,zy,j5e,T3,K5e,G8=R(()=>{"use strict";mu();Do=dn(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5,t=>t.getDate()-1),X5e=Do.range,zy=dn(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1),j5e=zy.range,T3=dn(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5)),K5e=T3.range});function fd(t){return dn(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,r)=>{e.setDate(e.getDate()+r*7)},(e,r)=>(r-e-(r.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}function dd(t){return dn(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCDate(e.getUTCDate()+r*7)},(e,r)=>(r-e)/6048e5)}var yl,_h,k3,E3,cc,C3,S3,JH,Q5e,Z5e,J5e,ewe,twe,rwe,pd,Bp,eY,tY,Lh,rY,nY,iY,nwe,iwe,awe,swe,owe,lwe,$8=R(()=>{"use strict";mu();o(fd,"timeWeekday");yl=fd(0),_h=fd(1),k3=fd(2),E3=fd(3),cc=fd(4),C3=fd(5),S3=fd(6),JH=yl.range,Q5e=_h.range,Z5e=k3.range,J5e=E3.range,ewe=cc.range,twe=C3.range,rwe=S3.range;o(dd,"utcWeekday");pd=dd(0),Bp=dd(1),eY=dd(2),tY=dd(3),Lh=dd(4),rY=dd(5),nY=dd(6),iY=pd.range,nwe=Bp.range,iwe=eY.range,awe=tY.range,swe=Lh.range,owe=rY.range,lwe=nY.range});var vu,cwe,A3,uwe,V8=R(()=>{"use strict";mu();vu=dn(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth()),cwe=vu.range,A3=dn(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth()),uwe=A3.range});var Qs,hwe,vl,fwe,U8=R(()=>{"use strict";mu();Qs=dn(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Qs.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:dn(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)});hwe=Qs.range,vl=dn(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());vl.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:dn(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)});fwe=vl.range});function sY(t,e,r,n,i,a){let s=[[Ks,1,1e3],[Ks,5,5*1e3],[Ks,15,15*1e3],[Ks,30,30*1e3],[a,1,6e4],[a,5,5*6e4],[a,15,15*6e4],[a,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[e,1,2592e6],[e,3,3*2592e6],[t,1,31536e6]];function l(h,f,d){let p=f<h;p&&([h,f]=[f,h]);let m=d&&typeof d.range=="function"?d:u(h,f,d),g=m?m.range(h,+f+1):[];return p?g.reverse():g}o(l,"ticks");function u(h,f,d){let p=Math.abs(f-h)/d,m=td(([,,v])=>v).right(s,p);if(m===s.length)return t.every(Tp(h/31536e6,f/31536e6,d));if(m===0)return oc.every(Math.max(Tp(h,f,d),1));let[g,y]=s[p/s[m-1][2]<s[m][2]/p?m-1:m];return g.every(y)}return o(u,"tickInterval"),[l,u]}var pwe,mwe,H8,Y8,oY=R(()=>{"use strict";bh();P8();B8();F8();z8();G8();$8();V8();U8();o(sY,"ticker");[pwe,mwe]=sY(vl,A3,pd,T3,w3,b3),[H8,Y8]=sY(Qs,vu,yl,Do,yu,gu)});var _3=R(()=>{"use strict";P8();B8();F8();z8();G8();$8();V8();U8();oY()});function W8(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function q8(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Gy(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function X8(t){var e=t.dateTime,r=t.date,n=t.time,i=t.periods,a=t.days,s=t.shortDays,l=t.months,u=t.shortMonths,h=$y(i),f=Vy(i),d=$y(a),p=Vy(a),m=$y(s),g=Vy(s),y=$y(l),v=Vy(l),x=$y(u),b=Vy(u),w={a:P,A:F,b:B,B:$,c:null,d:dY,e:dY,f:Fwe,g:Xwe,G:Kwe,H:Owe,I:Pwe,j:Bwe,L:vY,m:zwe,M:Gwe,p:z,q:Y,Q:gY,s:yY,S:$we,u:Vwe,U:Uwe,V:Hwe,w:Ywe,W:Wwe,x:null,X:null,y:qwe,Y:jwe,Z:Qwe,"%":mY},S={a:Q,A:X,b:ie,B:j,c:null,d:pY,e:pY,f:tTe,g:hTe,G:dTe,H:Zwe,I:Jwe,j:eTe,L:bY,m:rTe,M:nTe,p:J,q:Z,Q:gY,s:yY,S:iTe,u:aTe,U:sTe,V:oTe,w:lTe,W:cTe,x:null,X:null,y:uTe,Y:fTe,Z:pTe,"%":mY},T={a:M,A:N,b:k,B:I,c:C,d:hY,e:hY,f:Rwe,g:uY,G:cY,H:fY,I:fY,j:Awe,L:Dwe,m:Swe,M:_we,p:L,q:Cwe,Q:Mwe,s:Iwe,S:Lwe,u:bwe,U:wwe,V:Twe,w:xwe,W:kwe,x:O,X:D,y:uY,Y:cY,Z:Ewe,"%":Nwe};w.x=E(r,w),w.X=E(n,w),w.c=E(e,w),S.x=E(r,S),S.X=E(n,S),S.c=E(e,S);function E(H,q){return function(K){var se=[],ce=-1,ue=0,te=H.length,De,oe,ke;for(K instanceof Date||(K=new Date(+K));++ce<te;)H.charCodeAt(ce)===37&&(se.push(H.slice(ue,ce)),(oe=lY[De=H.charAt(++ce)])!=null?De=H.charAt(++ce):oe=De==="e"?" ":"0",(ke=q[De])&&(De=ke(K,oe)),se.push(De),ue=ce+1);return se.push(H.slice(ue,ce)),se.join("")}}o(E,"newFormat");function _(H,q){return function(K){var se=Gy(1900,void 0,1),ce=A(se,H,K+="",0),ue,te;if(ce!=K.length)return null;if("Q"in se)return new Date(se.Q);if("s"in se)return new Date(se.s*1e3+("L"in se?se.L:0));if(q&&!("Z"in se)&&(se.Z=0),"p"in se&&(se.H=se.H%12+se.p*12),se.m===void 0&&(se.m="q"in se?se.q:0),"V"in se){if(se.V<1||se.V>53)return null;"w"in se||(se.w=1),"Z"in se?(ue=q8(Gy(se.y,0,1)),te=ue.getUTCDay(),ue=te>4||te===0?Bp.ceil(ue):Bp(ue),ue=zy.offset(ue,(se.V-1)*7),se.y=ue.getUTCFullYear(),se.m=ue.getUTCMonth(),se.d=ue.getUTCDate()+(se.w+6)%7):(ue=W8(Gy(se.y,0,1)),te=ue.getDay(),ue=te>4||te===0?_h.ceil(ue):_h(ue),ue=Do.offset(ue,(se.V-1)*7),se.y=ue.getFullYear(),se.m=ue.getMonth(),se.d=ue.getDate()+(se.w+6)%7)}else("W"in se||"U"in se)&&("w"in se||(se.w="u"in se?se.u%7:"W"in se?1:0),te="Z"in se?q8(Gy(se.y,0,1)).getUTCDay():W8(Gy(se.y,0,1)).getDay(),se.m=0,se.d="W"in se?(se.w+6)%7+se.W*7-(te+5)%7:se.w+se.U*7-(te+6)%7);return"Z"in se?(se.H+=se.Z/100|0,se.M+=se.Z%100,q8(se)):W8(se)}}o(_,"newParse");function A(H,q,K,se){for(var ce=0,ue=q.length,te=K.length,De,oe;ce<ue;){if(se>=te)return-1;if(De=q.charCodeAt(ce++),De===37){if(De=q.charAt(ce++),oe=T[De in lY?q.charAt(ce++):De],!oe||(se=oe(H,K,se))<0)return-1}else if(De!=K.charCodeAt(se++))return-1}return se}o(A,"parseSpecifier");function L(H,q,K){var se=h.exec(q.slice(K));return se?(H.p=f.get(se[0].toLowerCase()),K+se[0].length):-1}o(L,"parsePeriod");function M(H,q,K){var se=m.exec(q.slice(K));return se?(H.w=g.get(se[0].toLowerCase()),K+se[0].length):-1}o(M,"parseShortWeekday");function N(H,q,K){var se=d.exec(q.slice(K));return se?(H.w=p.get(se[0].toLowerCase()),K+se[0].length):-1}o(N,"parseWeekday");function k(H,q,K){var se=x.exec(q.slice(K));return se?(H.m=b.get(se[0].toLowerCase()),K+se[0].length):-1}o(k,"parseShortMonth");function I(H,q,K){var se=y.exec(q.slice(K));return se?(H.m=v.get(se[0].toLowerCase()),K+se[0].length):-1}o(I,"parseMonth");function C(H,q,K){return A(H,e,q,K)}o(C,"parseLocaleDateTime");function O(H,q,K){return A(H,r,q,K)}o(O,"parseLocaleDate");function D(H,q,K){return A(H,n,q,K)}o(D,"parseLocaleTime");function P(H){return s[H.getDay()]}o(P,"formatShortWeekday");function F(H){return a[H.getDay()]}o(F,"formatWeekday");function B(H){return u[H.getMonth()]}o(B,"formatShortMonth");function $(H){return l[H.getMonth()]}o($,"formatMonth");function z(H){return i[+(H.getHours()>=12)]}o(z,"formatPeriod");function Y(H){return 1+~~(H.getMonth()/3)}o(Y,"formatQuarter");function Q(H){return s[H.getUTCDay()]}o(Q,"formatUTCShortWeekday");function X(H){return a[H.getUTCDay()]}o(X,"formatUTCWeekday");function ie(H){return u[H.getUTCMonth()]}o(ie,"formatUTCShortMonth");function j(H){return l[H.getUTCMonth()]}o(j,"formatUTCMonth");function J(H){return i[+(H.getUTCHours()>=12)]}o(J,"formatUTCPeriod");function Z(H){return 1+~~(H.getUTCMonth()/3)}return o(Z,"formatUTCQuarter"),{format:o(function(H){var q=E(H+="",w);return q.toString=function(){return H},q},"format"),parse:o(function(H){var q=_(H+="",!1);return q.toString=function(){return H},q},"parse"),utcFormat:o(function(H){var q=E(H+="",S);return q.toString=function(){return H},q},"utcFormat"),utcParse:o(function(H){var q=_(H+="",!0);return q.toString=function(){return H},q},"utcParse")}}function Pr(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a<r?new Array(r-a+1).join(e)+i:i)}function vwe(t){return t.replace(ywe,"\\$&")}function $y(t){return new RegExp("^(?:"+t.map(vwe).join("|")+")","i")}function Vy(t){return new Map(t.map((e,r)=>[e.toLowerCase(),r]))}function xwe(t,e,r){var n=Ki.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function bwe(t,e,r){var n=Ki.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function wwe(t,e,r){var n=Ki.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function Twe(t,e,r){var n=Ki.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function kwe(t,e,r){var n=Ki.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function cY(t,e,r){var n=Ki.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function uY(t,e,r){var n=Ki.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function Ewe(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Cwe(t,e,r){var n=Ki.exec(e.slice(r,r+1));return n?(t.q=n[0]*3-3,r+n[0].length):-1}function Swe(t,e,r){var n=Ki.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function hY(t,e,r){var n=Ki.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function Awe(t,e,r){var n=Ki.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function fY(t,e,r){var n=Ki.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function _we(t,e,r){var n=Ki.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function Lwe(t,e,r){var n=Ki.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function Dwe(t,e,r){var n=Ki.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function Rwe(t,e,r){var n=Ki.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function Nwe(t,e,r){var n=gwe.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function Mwe(t,e,r){var n=Ki.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function Iwe(t,e,r){var n=Ki.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function dY(t,e){return Pr(t.getDate(),e,2)}function Owe(t,e){return Pr(t.getHours(),e,2)}function Pwe(t,e){return Pr(t.getHours()%12||12,e,2)}function Bwe(t,e){return Pr(1+Do.count(Qs(t),t),e,3)}function vY(t,e){return Pr(t.getMilliseconds(),e,3)}function Fwe(t,e){return vY(t,e)+"000"}function zwe(t,e){return Pr(t.getMonth()+1,e,2)}function Gwe(t,e){return Pr(t.getMinutes(),e,2)}function $we(t,e){return Pr(t.getSeconds(),e,2)}function Vwe(t){var e=t.getDay();return e===0?7:e}function Uwe(t,e){return Pr(yl.count(Qs(t)-1,t),e,2)}function xY(t){var e=t.getDay();return e>=4||e===0?cc(t):cc.ceil(t)}function Hwe(t,e){return t=xY(t),Pr(cc.count(Qs(t),t)+(Qs(t).getDay()===4),e,2)}function Ywe(t){return t.getDay()}function Wwe(t,e){return Pr(_h.count(Qs(t)-1,t),e,2)}function qwe(t,e){return Pr(t.getFullYear()%100,e,2)}function Xwe(t,e){return t=xY(t),Pr(t.getFullYear()%100,e,2)}function jwe(t,e){return Pr(t.getFullYear()%1e4,e,4)}function Kwe(t,e){var r=t.getDay();return t=r>=4||r===0?cc(t):cc.ceil(t),Pr(t.getFullYear()%1e4,e,4)}function Qwe(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Pr(e/60|0,"0",2)+Pr(e%60,"0",2)}function pY(t,e){return Pr(t.getUTCDate(),e,2)}function Zwe(t,e){return Pr(t.getUTCHours(),e,2)}function Jwe(t,e){return Pr(t.getUTCHours()%12||12,e,2)}function eTe(t,e){return Pr(1+zy.count(vl(t),t),e,3)}function bY(t,e){return Pr(t.getUTCMilliseconds(),e,3)}function tTe(t,e){return bY(t,e)+"000"}function rTe(t,e){return Pr(t.getUTCMonth()+1,e,2)}function nTe(t,e){return Pr(t.getUTCMinutes(),e,2)}function iTe(t,e){return Pr(t.getUTCSeconds(),e,2)}function aTe(t){var e=t.getUTCDay();return e===0?7:e}function sTe(t,e){return Pr(pd.count(vl(t)-1,t),e,2)}function wY(t){var e=t.getUTCDay();return e>=4||e===0?Lh(t):Lh.ceil(t)}function oTe(t,e){return t=wY(t),Pr(Lh.count(vl(t),t)+(vl(t).getUTCDay()===4),e,2)}function lTe(t){return t.getUTCDay()}function cTe(t,e){return Pr(Bp.count(vl(t)-1,t),e,2)}function uTe(t,e){return Pr(t.getUTCFullYear()%100,e,2)}function hTe(t,e){return t=wY(t),Pr(t.getUTCFullYear()%100,e,2)}function fTe(t,e){return Pr(t.getUTCFullYear()%1e4,e,4)}function dTe(t,e){var r=t.getUTCDay();return t=r>=4||r===0?Lh(t):Lh.ceil(t),Pr(t.getUTCFullYear()%1e4,e,4)}function pTe(){return"+0000"}function mY(){return"%"}function gY(t){return+t}function yY(t){return Math.floor(+t/1e3)}var lY,Ki,gwe,ywe,TY=R(()=>{"use strict";_3();o(W8,"localDate");o(q8,"utcDate");o(Gy,"newDate");o(X8,"formatLocale");lY={"-":"",_:" ",0:"0"},Ki=/^\s*\d+/,gwe=/^%/,ywe=/[\\^$*+?|[\]().{}]/g;o(Pr,"pad");o(vwe,"requote");o($y,"formatRe");o(Vy,"formatLookup");o(xwe,"parseWeekdayNumberSunday");o(bwe,"parseWeekdayNumberMonday");o(wwe,"parseWeekNumberSunday");o(Twe,"parseWeekNumberISO");o(kwe,"parseWeekNumberMonday");o(cY,"parseFullYear");o(uY,"parseYear");o(Ewe,"parseZone");o(Cwe,"parseQuarter");o(Swe,"parseMonthNumber");o(hY,"parseDayOfMonth");o(Awe,"parseDayOfYear");o(fY,"parseHour24");o(_we,"parseMinutes");o(Lwe,"parseSeconds");o(Dwe,"parseMilliseconds");o(Rwe,"parseMicroseconds");o(Nwe,"parseLiteralPercent");o(Mwe,"parseUnixTimestamp");o(Iwe,"parseUnixTimestampSeconds");o(dY,"formatDayOfMonth");o(Owe,"formatHour24");o(Pwe,"formatHour12");o(Bwe,"formatDayOfYear");o(vY,"formatMilliseconds");o(Fwe,"formatMicroseconds");o(zwe,"formatMonthNumber");o(Gwe,"formatMinutes");o($we,"formatSeconds");o(Vwe,"formatWeekdayNumberMonday");o(Uwe,"formatWeekNumberSunday");o(xY,"dISO");o(Hwe,"formatWeekNumberISO");o(Ywe,"formatWeekdayNumberSunday");o(Wwe,"formatWeekNumberMonday");o(qwe,"formatYear");o(Xwe,"formatYearISO");o(jwe,"formatFullYear");o(Kwe,"formatFullYearISO");o(Qwe,"formatZone");o(pY,"formatUTCDayOfMonth");o(Zwe,"formatUTCHour24");o(Jwe,"formatUTCHour12");o(eTe,"formatUTCDayOfYear");o(bY,"formatUTCMilliseconds");o(tTe,"formatUTCMicroseconds");o(rTe,"formatUTCMonthNumber");o(nTe,"formatUTCMinutes");o(iTe,"formatUTCSeconds");o(aTe,"formatUTCWeekdayNumberMonday");o(sTe,"formatUTCWeekNumberSunday");o(wY,"UTCdISO");o(oTe,"formatUTCWeekNumberISO");o(lTe,"formatUTCWeekdayNumberSunday");o(cTe,"formatUTCWeekNumberMonday");o(uTe,"formatUTCYear");o(hTe,"formatUTCYearISO");o(fTe,"formatUTCFullYear");o(dTe,"formatUTCFullYearISO");o(pTe,"formatUTCZone");o(mY,"formatLiteralPercent");o(gY,"formatUnixTimestamp");o(yY,"formatUnixTimestampSeconds")});function j8(t){return Fp=X8(t),md=Fp.format,kY=Fp.parse,EY=Fp.utcFormat,CY=Fp.utcParse,Fp}var Fp,md,kY,EY,CY,SY=R(()=>{"use strict";TY();j8({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});o(j8,"defaultLocale")});var K8=R(()=>{"use strict";SY()});function mTe(t){return new Date(t)}function gTe(t){return t instanceof Date?+t:+new Date(+t)}function AY(t,e,r,n,i,a,s,l,u,h){var f=By(),d=f.invert,p=f.domain,m=h(".%L"),g=h(":%S"),y=h("%I:%M"),v=h("%I %p"),x=h("%a %d"),b=h("%b %d"),w=h("%B"),S=h("%Y");function T(E){return(u(E)<E?m:l(E)<E?g:s(E)<E?y:a(E)<E?v:n(E)<E?i(E)<E?x:b:r(E)<E?w:S)(E)}return o(T,"tickFormat"),f.invert=function(E){return new Date(d(E))},f.domain=function(E){return arguments.length?p(Array.from(E,gTe)):p().map(mTe)},f.ticks=function(E){var _=p();return t(_[0],_[_.length-1],E??10)},f.tickFormat=function(E,_){return _==null?T:h(_)},f.nice=function(E){var _=p();return(!E||typeof E.range!="function")&&(E=e(_[0],_[_.length-1],E??10)),E?p(M8(_,E)):f},f.copy=function(){return x3(f,AY(t,e,r,n,i,a,s,l,u,h))},f}function L3(){return Ah.apply(AY(H8,Y8,Qs,vu,yl,Do,yu,gu,Ks,md).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}var _Y=R(()=>{"use strict";_3();K8();R8();Py();jH();o(mTe,"date");o(gTe,"number");o(AY,"calendar");o(L3,"time")});var LY=R(()=>{"use strict";UH();XH();A8();_Y()});function Q8(t){for(var e=t.length/6|0,r=new Array(e),n=0;n<e;)r[n]="#"+t.slice(n*6,++n*6);return r}var DY=R(()=>{"use strict";o(Q8,"default")});var Z8,RY=R(()=>{"use strict";DY();Z8=Q8("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab")});var NY=R(()=>{"use strict";RY()});function Nn(t){return o(function(){return t},"constant")}var D3=R(()=>{"use strict";o(Nn,"default")});function IY(t){return t>1?0:t<-1?zp:Math.acos(t)}function e_(t){return t>=1?Uy:t<=-1?-Uy:Math.asin(t)}var J8,ua,Dh,MY,R3,xl,gd,Qi,zp,Uy,Gp,N3=R(()=>{"use strict";J8=Math.abs,ua=Math.atan2,Dh=Math.cos,MY=Math.max,R3=Math.min,xl=Math.sin,gd=Math.sqrt,Qi=1e-12,zp=Math.PI,Uy=zp/2,Gp=2*zp;o(IY,"acos");o(e_,"asin")});function M3(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(r==null)e=null;else{let n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);e=n}return t},()=>new ld(e)}var t_=R(()=>{"use strict";d8();o(M3,"withPath")});function yTe(t){return t.innerRadius}function vTe(t){return t.outerRadius}function xTe(t){return t.startAngle}function bTe(t){return t.endAngle}function wTe(t){return t&&t.padAngle}function TTe(t,e,r,n,i,a,s,l){var u=r-t,h=n-e,f=s-i,d=l-a,p=d*u-f*h;if(!(p*p<Qi))return p=(f*(e-a)-d*(t-i))/p,[t+p*u,e+p*h]}function I3(t,e,r,n,i,a,s){var l=t-r,u=e-n,h=(s?a:-a)/gd(l*l+u*u),f=h*u,d=-h*l,p=t+f,m=e+d,g=r+f,y=n+d,v=(p+g)/2,x=(m+y)/2,b=g-p,w=y-m,S=b*b+w*w,T=i-a,E=p*y-g*m,_=(w<0?-1:1)*gd(MY(0,T*T*S-E*E)),A=(E*w-b*_)/S,L=(-E*b-w*_)/S,M=(E*w+b*_)/S,N=(-E*b+w*_)/S,k=A-v,I=L-x,C=M-v,O=N-x;return k*k+I*I>C*C+O*O&&(A=M,L=N),{cx:A,cy:L,x01:-f,y01:-d,x11:A*(i/T-1),y11:L*(i/T-1)}}function bl(){var t=yTe,e=vTe,r=Nn(0),n=null,i=xTe,a=bTe,s=wTe,l=null,u=M3(h);function h(){var f,d,p=+t.apply(this,arguments),m=+e.apply(this,arguments),g=i.apply(this,arguments)-Uy,y=a.apply(this,arguments)-Uy,v=J8(y-g),x=y>g;if(l||(l=f=u()),m<p&&(d=m,m=p,p=d),!(m>Qi))l.moveTo(0,0);else if(v>Gp-Qi)l.moveTo(m*Dh(g),m*xl(g)),l.arc(0,0,m,g,y,!x),p>Qi&&(l.moveTo(p*Dh(y),p*xl(y)),l.arc(0,0,p,y,g,x));else{var b=g,w=y,S=g,T=y,E=v,_=v,A=s.apply(this,arguments)/2,L=A>Qi&&(n?+n.apply(this,arguments):gd(p*p+m*m)),M=R3(J8(m-p)/2,+r.apply(this,arguments)),N=M,k=M,I,C;if(L>Qi){var O=e_(L/p*xl(A)),D=e_(L/m*xl(A));(E-=O*2)>Qi?(O*=x?1:-1,S+=O,T-=O):(E=0,S=T=(g+y)/2),(_-=D*2)>Qi?(D*=x?1:-1,b+=D,w-=D):(_=0,b=w=(g+y)/2)}var P=m*Dh(b),F=m*xl(b),B=p*Dh(T),$=p*xl(T);if(M>Qi){var z=m*Dh(w),Y=m*xl(w),Q=p*Dh(S),X=p*xl(S),ie;if(v<zp)if(ie=TTe(P,F,Q,X,z,Y,B,$)){var j=P-ie[0],J=F-ie[1],Z=z-ie[0],H=Y-ie[1],q=1/xl(IY((j*Z+J*H)/(gd(j*j+J*J)*gd(Z*Z+H*H)))/2),K=gd(ie[0]*ie[0]+ie[1]*ie[1]);N=R3(M,(p-K)/(q-1)),k=R3(M,(m-K)/(q+1))}else N=k=0}_>Qi?k>Qi?(I=I3(Q,X,P,F,m,k,x),C=I3(z,Y,B,$,m,k,x),l.moveTo(I.cx+I.x01,I.cy+I.y01),k<M?l.arc(I.cx,I.cy,k,ua(I.y01,I.x01),ua(C.y01,C.x01),!x):(l.arc(I.cx,I.cy,k,ua(I.y01,I.x01),ua(I.y11,I.x11),!x),l.arc(0,0,m,ua(I.cy+I.y11,I.cx+I.x11),ua(C.cy+C.y11,C.cx+C.x11),!x),l.arc(C.cx,C.cy,k,ua(C.y11,C.x11),ua(C.y01,C.x01),!x))):(l.moveTo(P,F),l.arc(0,0,m,b,w,!x)):l.moveTo(P,F),!(p>Qi)||!(E>Qi)?l.lineTo(B,$):N>Qi?(I=I3(B,$,z,Y,p,-N,x),C=I3(P,F,Q,X,p,-N,x),l.lineTo(I.cx+I.x01,I.cy+I.y01),N<M?l.arc(I.cx,I.cy,N,ua(I.y01,I.x01),ua(C.y01,C.x01),!x):(l.arc(I.cx,I.cy,N,ua(I.y01,I.x01),ua(I.y11,I.x11),!x),l.arc(0,0,p,ua(I.cy+I.y11,I.cx+I.x11),ua(C.cy+C.y11,C.cx+C.x11),x),l.arc(C.cx,C.cy,N,ua(C.y11,C.x11),ua(C.y01,C.x01),!x))):l.arc(0,0,p,T,S,x)}if(l.closePath(),f)return l=null,f+""||null}return o(h,"arc"),h.centroid=function(){var f=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,d=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-zp/2;return[Dh(d)*f,xl(d)*f]},h.innerRadius=function(f){return arguments.length?(t=typeof f=="function"?f:Nn(+f),h):t},h.outerRadius=function(f){return arguments.length?(e=typeof f=="function"?f:Nn(+f),h):e},h.cornerRadius=function(f){return arguments.length?(r=typeof f=="function"?f:Nn(+f),h):r},h.padRadius=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Nn(+f),h):n},h.startAngle=function(f){return arguments.length?(i=typeof f=="function"?f:Nn(+f),h):i},h.endAngle=function(f){return arguments.length?(a=typeof f=="function"?f:Nn(+f),h):a},h.padAngle=function(f){return arguments.length?(s=typeof f=="function"?f:Nn(+f),h):s},h.context=function(f){return arguments.length?(l=f??null,h):l},h}var OY=R(()=>{"use strict";D3();N3();t_();o(yTe,"arcInnerRadius");o(vTe,"arcOuterRadius");o(xTe,"arcStartAngle");o(bTe,"arcEndAngle");o(wTe,"arcPadAngle");o(TTe,"intersect");o(I3,"cornerTangents");o(bl,"default")});function Hy(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}var Dyt,r_=R(()=>{"use strict";Dyt=Array.prototype.slice;o(Hy,"default")});function PY(t){this._context=t}function xu(t){return new PY(t)}var n_=R(()=>{"use strict";o(PY,"Linear");PY.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._point=0},"lineStart"),lineEnd:o(function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}},"point")};o(xu,"default")});function BY(t){return t[0]}function FY(t){return t[1]}var zY=R(()=>{"use strict";o(BY,"x");o(FY,"y")});function ha(t,e){var r=Nn(!0),n=null,i=xu,a=null,s=M3(l);t=typeof t=="function"?t:t===void 0?BY:Nn(t),e=typeof e=="function"?e:e===void 0?FY:Nn(e);function l(u){var h,f=(u=Hy(u)).length,d,p=!1,m;for(n==null&&(a=i(m=s())),h=0;h<=f;++h)!(h<f&&r(d=u[h],h,u))===p&&((p=!p)?a.lineStart():a.lineEnd()),p&&a.point(+t(d,h,u),+e(d,h,u));if(m)return a=null,m+""||null}return o(l,"line"),l.x=function(u){return arguments.length?(t=typeof u=="function"?u:Nn(+u),l):t},l.y=function(u){return arguments.length?(e=typeof u=="function"?u:Nn(+u),l):e},l.defined=function(u){return arguments.length?(r=typeof u=="function"?u:Nn(!!u),l):r},l.curve=function(u){return arguments.length?(i=u,n!=null&&(a=i(n)),l):i},l.context=function(u){return arguments.length?(u==null?n=a=null:a=i(n=u),l):n},l}var GY=R(()=>{"use strict";r_();D3();n_();t_();zY();o(ha,"default")});function i_(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}var $Y=R(()=>{"use strict";o(i_,"default")});function a_(t){return t}var VY=R(()=>{"use strict";o(a_,"default")});function O3(){var t=a_,e=i_,r=null,n=Nn(0),i=Nn(Gp),a=Nn(0);function s(l){var u,h=(l=Hy(l)).length,f,d,p=0,m=new Array(h),g=new Array(h),y=+n.apply(this,arguments),v=Math.min(Gp,Math.max(-Gp,i.apply(this,arguments)-y)),x,b=Math.min(Math.abs(v)/h,a.apply(this,arguments)),w=b*(v<0?-1:1),S;for(u=0;u<h;++u)(S=g[m[u]=u]=+t(l[u],u,l))>0&&(p+=S);for(e!=null?m.sort(function(T,E){return e(g[T],g[E])}):r!=null&&m.sort(function(T,E){return r(l[T],l[E])}),u=0,d=p?(v-h*w)/p:0;u<h;++u,y=x)f=m[u],S=g[f],x=y+(S>0?S*d:0)+w,g[f]={data:l[f],index:u,value:S,startAngle:y,endAngle:x,padAngle:b};return g}return o(s,"pie"),s.value=function(l){return arguments.length?(t=typeof l=="function"?l:Nn(+l),s):t},s.sortValues=function(l){return arguments.length?(e=l,r=null,s):e},s.sort=function(l){return arguments.length?(r=l,e=null,s):r},s.startAngle=function(l){return arguments.length?(n=typeof l=="function"?l:Nn(+l),s):n},s.endAngle=function(l){return arguments.length?(i=typeof l=="function"?l:Nn(+l),s):i},s.padAngle=function(l){return arguments.length?(a=typeof l=="function"?l:Nn(+l),s):a},s}var UY=R(()=>{"use strict";r_();D3();$Y();VY();N3();o(O3,"default")});function s_(t){return new P3(t,!0)}function o_(t){return new P3(t,!1)}var P3,HY=R(()=>{"use strict";P3=class{static{o(this,"Bump")}constructor(e,r){this._context=e,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,r){switch(e=+e,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,r,e,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,e,this._y0,e,r);break}}this._x0=e,this._y0=r}};o(s_,"bumpX");o(o_,"bumpY")});function Zs(){}var Yy=R(()=>{"use strict";o(Zs,"default")});function $p(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function Wy(t){this._context=t}function vs(t){return new Wy(t)}var qy=R(()=>{"use strict";o($p,"point");o(Wy,"Basis");Wy.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 3:$p(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:$p(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e},"point")};o(vs,"default")});function YY(t){this._context=t}function B3(t){return new YY(t)}var WY=R(()=>{"use strict";Yy();qy();o(YY,"BasisClosed");YY.prototype={areaStart:Zs,areaEnd:Zs,lineStart:o(function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},"lineEnd"),point:o(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:$p(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e},"point")};o(B3,"default")});function qY(t){this._context=t}function F3(t){return new qY(t)}var XY=R(()=>{"use strict";qy();o(qY,"BasisOpen");qY.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},"lineStart"),lineEnd:o(function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:$p(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e},"point")};o(F3,"default")});function jY(t,e){this._basis=new Wy(t),this._beta=e}var l_,KY=R(()=>{"use strict";qy();o(jY,"Bundle");jY.prototype={lineStart:o(function(){this._x=[],this._y=[],this._basis.lineStart()},"lineStart"),lineEnd:o(function(){var t=this._x,e=this._y,r=t.length-1;if(r>0)for(var n=t[0],i=e[0],a=t[r]-n,s=e[r]-i,l=-1,u;++l<=r;)u=l/r,this._basis.point(this._beta*t[l]+(1-this._beta)*(n+u*a),this._beta*e[l]+(1-this._beta)*(i+u*s));this._x=this._y=null,this._basis.lineEnd()},"lineEnd"),point:o(function(t,e){this._x.push(+t),this._y.push(+e)},"point")};l_=o(function t(e){function r(n){return e===1?new Wy(n):new jY(n,e)}return o(r,"bundle"),r.beta=function(n){return t(+n)},r},"custom")(.85)});function Vp(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function z3(t,e){this._context=t,this._k=(1-e)/6}var c_,Xy=R(()=>{"use strict";o(Vp,"point");o(z3,"Cardinal");z3.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Vp(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Vp(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")};c_=o(function t(e){function r(n){return new z3(n,e)}return o(r,"cardinal"),r.tension=function(n){return t(+n)},r},"custom")(0)});function G3(t,e){this._context=t,this._k=(1-e)/6}var u_,h_=R(()=>{"use strict";Yy();Xy();o(G3,"CardinalClosed");G3.prototype={areaStart:Zs,areaEnd:Zs,lineStart:o(function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},"lineEnd"),point:o(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Vp(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")};u_=o(function t(e){function r(n){return new G3(n,e)}return o(r,"cardinal"),r.tension=function(n){return t(+n)},r},"custom")(0)});function $3(t,e){this._context=t,this._k=(1-e)/6}var f_,d_=R(()=>{"use strict";Xy();o($3,"CardinalOpen");$3.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},"lineStart"),lineEnd:o(function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Vp(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")};f_=o(function t(e){function r(n){return new $3(n,e)}return o(r,"cardinal"),r.tension=function(n){return t(+n)},r},"custom")(0)});function jy(t,e,r){var n=t._x1,i=t._y1,a=t._x2,s=t._y2;if(t._l01_a>Qi){var l=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,u=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*l-t._x0*t._l12_2a+t._x2*t._l01_2a)/u,i=(i*l-t._y0*t._l12_2a+t._y2*t._l01_2a)/u}if(t._l23_a>Qi){var h=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,f=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*h+t._x1*t._l23_2a-e*t._l12_2a)/f,s=(s*h+t._y1*t._l23_2a-r*t._l12_2a)/f}t._context.bezierCurveTo(n,i,a,s,t._x2,t._y2)}function QY(t,e){this._context=t,this._alpha=e}var p_,V3=R(()=>{"use strict";N3();Xy();o(jy,"point");o(QY,"CatmullRom");QY.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:jy(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")};p_=o(function t(e){function r(n){return e?new QY(n,e):new z3(n,0)}return o(r,"catmullRom"),r.alpha=function(n){return t(+n)},r},"custom")(.5)});function ZY(t,e){this._context=t,this._alpha=e}var m_,JY=R(()=>{"use strict";h_();Yy();V3();o(ZY,"CatmullRomClosed");ZY.prototype={areaStart:Zs,areaEnd:Zs,lineStart:o(function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},"lineEnd"),point:o(function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:jy(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")};m_=o(function t(e){function r(n){return e?new ZY(n,e):new G3(n,0)}return o(r,"catmullRom"),r.alpha=function(n){return t(+n)},r},"custom")(.5)});function eW(t,e){this._context=t,this._alpha=e}var g_,tW=R(()=>{"use strict";d_();V3();o(eW,"CatmullRomOpen");eW.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},"lineStart"),lineEnd:o(function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:jy(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")};g_=o(function t(e){function r(n){return e?new eW(n,e):new $3(n,0)}return o(r,"catmullRom"),r.alpha=function(n){return t(+n)},r},"custom")(.5)});function rW(t){this._context=t}function U3(t){return new rW(t)}var nW=R(()=>{"use strict";Yy();o(rW,"LinearClosed");rW.prototype={areaStart:Zs,areaEnd:Zs,lineStart:o(function(){this._point=0},"lineStart"),lineEnd:o(function(){this._point&&this._context.closePath()},"lineEnd"),point:o(function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))},"point")};o(U3,"default")});function iW(t){return t<0?-1:1}function aW(t,e,r){var n=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(n||i<0&&-0),s=(r-t._y1)/(i||n<0&&-0),l=(a*i+s*n)/(n+i);return(iW(a)+iW(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(l))||0}function sW(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function y_(t,e,r){var n=t._x0,i=t._y0,a=t._x1,s=t._y1,l=(a-n)/3;t._context.bezierCurveTo(n+l,i+l*e,a-l,s-l*r,a,s)}function H3(t){this._context=t}function oW(t){this._context=new lW(t)}function lW(t){this._context=t}function v_(t){return new H3(t)}function x_(t){return new oW(t)}var cW=R(()=>{"use strict";o(iW,"sign");o(aW,"slope3");o(sW,"slope2");o(y_,"point");o(H3,"MonotoneX");H3.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:y_(this,this._t0,sW(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(t,e){var r=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,y_(this,sW(this,r=aW(this,t,e)),r);break;default:y_(this,this._t0,r=aW(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}},"point")};o(oW,"MonotoneY");(oW.prototype=Object.create(H3.prototype)).point=function(t,e){H3.prototype.point.call(this,e,t)};o(lW,"ReflectContext");lW.prototype={moveTo:o(function(t,e){this._context.moveTo(e,t)},"moveTo"),closePath:o(function(){this._context.closePath()},"closePath"),lineTo:o(function(t,e){this._context.lineTo(e,t)},"lineTo"),bezierCurveTo:o(function(t,e,r,n,i,a){this._context.bezierCurveTo(e,t,n,r,a,i)},"bezierCurveTo")};o(v_,"monotoneX");o(x_,"monotoneY")});function hW(t){this._context=t}function uW(t){var e,r=t.length-1,n,i=new Array(r),a=new Array(r),s=new Array(r);for(i[0]=0,a[0]=2,s[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,a[e]=4,s[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,a[r-1]=7,s[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/a[e-1],a[e]-=n,s[e]-=n*s[e-1];for(i[r-1]=s[r-1]/a[r-1],e=r-2;e>=0;--e)i[e]=(s[e]-i[e+1])/a[e];for(a[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)a[e]=2*t[e+1]-i[e+1];return[i,a]}function Y3(t){return new hW(t)}var fW=R(()=>{"use strict";o(hW,"Natural");hW.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x=[],this._y=[]},"lineStart"),lineEnd:o(function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),r===2)this._context.lineTo(t[1],e[1]);else for(var n=uW(t),i=uW(e),a=0,s=1;s<r;++a,++s)this._context.bezierCurveTo(n[0][a],i[0][a],n[1][a],i[1][a],t[s],e[s]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},"lineEnd"),point:o(function(t,e){this._x.push(+t),this._y.push(+e)},"point")};o(uW,"controlPoints");o(Y3,"default")});function W3(t,e){this._context=t,this._t=e}function q3(t){return new W3(t,.5)}function b_(t){return new W3(t,0)}function w_(t){return new W3(t,1)}var dW=R(()=>{"use strict";o(W3,"Step");W3.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x=this._y=NaN,this._point=0},"lineStart"),lineEnd:o(function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},"lineEnd"),point:o(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}break}}this._x=t,this._y=e},"point")};o(q3,"default");o(b_,"stepBefore");o(w_,"stepAfter")});var pW=R(()=>{"use strict";OY();GY();UY();WY();XY();qy();HY();KY();h_();d_();Xy();JY();tW();V3();nW();n_();cW();fW();dW()});var mW=R(()=>{"use strict"});var gW=R(()=>{"use strict"});function Rh(t,e,r){this.k=t,this.x=e,this.y=r}function k_(t){for(;!t.__zoom;)if(!(t=t.parentNode))return T_;return t.__zoom}var T_,E_=R(()=>{"use strict";o(Rh,"Transform");Rh.prototype={constructor:Rh,scale:o(function(t){return t===1?this:new Rh(this.k*t,this.x,this.y)},"scale"),translate:o(function(t,e){return t===0&e===0?this:new Rh(this.k,this.x+this.k*t,this.y+this.k*e)},"translate"),apply:o(function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},"apply"),applyX:o(function(t){return t*this.k+this.x},"applyX"),applyY:o(function(t){return t*this.k+this.y},"applyY"),invert:o(function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},"invert"),invertX:o(function(t){return(t-this.x)/this.k},"invertX"),invertY:o(function(t){return(t-this.y)/this.k},"invertY"),rescaleX:o(function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},"rescaleX"),rescaleY:o(function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},"rescaleY"),toString:o(function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"},"toString")};T_=new Rh(1,0,0);k_.prototype=Rh.prototype;o(k_,"transform")});var yW=R(()=>{"use strict"});var vW=R(()=>{"use strict";c3();mW();gW();E_();yW()});var xW=R(()=>{"use strict";vW();E_()});var Zt=R(()=>{"use strict";bh();K$();mH();xH();Lp();bH();wH();bS();$V();TH();l8();kH();CH();C8();zH();GH();Np();d8();$H();EH();VH();LY();NY();fl();pW();_3();K8();n3();c3();xW()});var bW=gi(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.BLANK_URL=Zi.relativeFirstCharacters=Zi.whitespaceEscapeCharsRegex=Zi.urlSchemeRegex=Zi.ctrlCharactersRegex=Zi.htmlCtrlEntityRegex=Zi.htmlEntitiesRegex=Zi.invalidProtocolRegex=void 0;Zi.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im;Zi.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g;Zi.htmlCtrlEntityRegex=/&(newline|tab);/gi;Zi.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;Zi.urlSchemeRegex=/^.+(:|:)/gim;Zi.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;Zi.relativeFirstCharacters=[".","/"];Zi.BLANK_URL="about:blank"});var Up=gi(X3=>{"use strict";Object.defineProperty(X3,"__esModule",{value:!0});X3.sanitizeUrl=void 0;var Na=bW();function kTe(t){return Na.relativeFirstCharacters.indexOf(t[0])>-1}o(kTe,"isRelativeUrlWithoutProtocol");function ETe(t){var e=t.replace(Na.ctrlCharactersRegex,"");return e.replace(Na.htmlEntitiesRegex,function(r,n){return String.fromCharCode(n)})}o(ETe,"decodeHtmlCharacters");function CTe(t){return URL.canParse(t)}o(CTe,"isValidUrl");function wW(t){try{return decodeURIComponent(t)}catch{return t}}o(wW,"decodeURI");function STe(t){if(!t)return Na.BLANK_URL;var e,r=wW(t.trim());do r=ETe(r).replace(Na.htmlCtrlEntityRegex,"").replace(Na.ctrlCharactersRegex,"").replace(Na.whitespaceEscapeCharsRegex,"").trim(),r=wW(r),e=r.match(Na.ctrlCharactersRegex)||r.match(Na.htmlEntitiesRegex)||r.match(Na.htmlCtrlEntityRegex)||r.match(Na.whitespaceEscapeCharsRegex);while(e&&e.length>0);var n=r;if(!n)return Na.BLANK_URL;if(kTe(n))return n;var i=n.trimStart(),a=i.match(Na.urlSchemeRegex);if(!a)return n;var s=a[0].toLowerCase().trim();if(Na.invalidProtocolRegex.test(s))return Na.BLANK_URL;var l=i.replace(/\\/g,"/");if(s==="mailto:"||s.includes("://"))return l;if(s==="http:"||s==="https:"){if(!CTe(l))return Na.BLANK_URL;var u=new URL(l);return u.protocol=u.protocol.toLowerCase(),u.hostname=u.hostname.toLowerCase(),u.toString()}return l}o(STe,"sanitizeUrl");X3.sanitizeUrl=STe});var C_,yd,j3,TW,kW,EW,wl,Ky,Qy=R(()=>{"use strict";C_=Xi(Up(),1);rr();yd=o((t,e)=>{let r=t.append("rect");if(r.attr("x",e.x),r.attr("y",e.y),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("width",e.width),r.attr("height",e.height),e.name&&r.attr("name",e.name),e.rx&&r.attr("rx",e.rx),e.ry&&r.attr("ry",e.ry),e.attrs!==void 0)for(let n in e.attrs)r.attr(n,e.attrs[n]);return e.class&&r.attr("class",e.class),r},"drawRect"),j3=o((t,e)=>{let r={x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,stroke:e.stroke,class:"rect"};yd(t,r).lower()},"drawBackgroundRect"),TW=o((t,e)=>{let r=e.text.replace(Qf," "),n=t.append("text");n.attr("x",e.x),n.attr("y",e.y),n.attr("class","legend"),n.style("text-anchor",e.anchor),e.class&&n.attr("class",e.class);let i=n.append("tspan");return i.attr("x",e.x+e.textMargin*2),i.text(r),n},"drawText"),kW=o((t,e,r,n)=>{let i=t.append("image");i.attr("x",e),i.attr("y",r);let a=(0,C_.sanitizeUrl)(n);i.attr("xlink:href",a)},"drawImage"),EW=o((t,e,r,n)=>{let i=t.append("use");i.attr("x",e),i.attr("y",r);let a=(0,C_.sanitizeUrl)(n);i.attr("xlink:href",`#${a}`)},"drawEmbeddedImage"),wl=o(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),Ky=o(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj")});var CW,S_,SW,ATe,_Te,LTe,DTe,RTe,NTe,MTe,ITe,OTe,PTe,BTe,FTe,bu,Tl,AW=R(()=>{"use strict";rr();Qy();CW=Xi(Up(),1),S_=o(function(t,e){return yd(t,e)},"drawRect"),SW=o(function(t,e,r,n,i,a){let s=t.append("image");s.attr("width",e),s.attr("height",r),s.attr("x",n),s.attr("y",i);let l=a.startsWith("data:image/png;base64")?a:(0,CW.sanitizeUrl)(a);s.attr("xlink:href",l)},"drawImage"),ATe=o((t,e,r)=>{let n=t.append("g"),i=0;for(let a of e){let s=a.textColor?a.textColor:"#444444",l=a.lineColor?a.lineColor:"#444444",u=a.offsetX?parseInt(a.offsetX):0,h=a.offsetY?parseInt(a.offsetY):0,f="";if(i===0){let p=n.append("line");p.attr("x1",a.startPoint.x),p.attr("y1",a.startPoint.y),p.attr("x2",a.endPoint.x),p.attr("y2",a.endPoint.y),p.attr("stroke-width","1"),p.attr("stroke",l),p.style("fill","none"),a.type!=="rel_b"&&p.attr("marker-end","url("+f+"#arrowhead)"),(a.type==="birel"||a.type==="rel_b")&&p.attr("marker-start","url("+f+"#arrowend)"),i=-1}else{let p=n.append("path");p.attr("fill","none").attr("stroke-width","1").attr("stroke",l).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",a.startPoint.x).replaceAll("starty",a.startPoint.y).replaceAll("controlx",a.startPoint.x+(a.endPoint.x-a.startPoint.x)/2-(a.endPoint.x-a.startPoint.x)/4).replaceAll("controly",a.startPoint.y+(a.endPoint.y-a.startPoint.y)/2).replaceAll("stopx",a.endPoint.x).replaceAll("stopy",a.endPoint.y)),a.type!=="rel_b"&&p.attr("marker-end","url("+f+"#arrowhead)"),(a.type==="birel"||a.type==="rel_b")&&p.attr("marker-start","url("+f+"#arrowend)")}let d=r.messageFont();bu(r)(a.label.text,n,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+u,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+h,a.label.width,a.label.height,{fill:s},d),a.techn&&a.techn.text!==""&&(d=r.messageFont(),bu(r)("["+a.techn.text+"]",n,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+u,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+r.messageFontSize+5+h,Math.max(a.label.width,a.techn.width),a.techn.height,{fill:s,"font-style":"italic"},d))}},"drawRels"),_Te=o(function(t,e,r){let n=t.append("g"),i=e.bgColor?e.bgColor:"none",a=e.borderColor?e.borderColor:"#444444",s=e.fontColor?e.fontColor:"black",l={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};e.nodeType&&(l={"stroke-width":1});let u={x:e.x,y:e.y,fill:i,stroke:a,width:e.width,height:e.height,rx:2.5,ry:2.5,attrs:l};S_(n,u);let h=r.boundaryFont();h.fontWeight="bold",h.fontSize=h.fontSize+2,h.fontColor=s,bu(r)(e.label.text,n,e.x,e.y+e.label.Y,e.width,e.height,{fill:"#444444"},h),e.type&&e.type.text!==""&&(h=r.boundaryFont(),h.fontColor=s,bu(r)(e.type.text,n,e.x,e.y+e.type.Y,e.width,e.height,{fill:"#444444"},h)),e.descr&&e.descr.text!==""&&(h=r.boundaryFont(),h.fontSize=h.fontSize-2,h.fontColor=s,bu(r)(e.descr.text,n,e.x,e.y+e.descr.Y,e.width,e.height,{fill:"#444444"},h))},"drawBoundary"),LTe=o(function(t,e,r){let n=e.bgColor?e.bgColor:r[e.typeC4Shape.text+"_bg_color"],i=e.borderColor?e.borderColor:r[e.typeC4Shape.text+"_border_color"],a=e.fontColor?e.fontColor:"#FFFFFF",s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";switch(e.typeC4Shape.text){case"person":s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";break;case"external_person":s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=";break}let l=t.append("g");l.attr("class","person-man");let u=wl();switch(e.typeC4Shape.text){case"person":case"external_person":case"system":case"external_system":case"container":case"external_container":case"component":case"external_component":u.x=e.x,u.y=e.y,u.fill=n,u.width=e.width,u.height=e.height,u.stroke=i,u.rx=2.5,u.ry=2.5,u.attrs={"stroke-width":.5},S_(l,u);break;case"system_db":case"external_system_db":case"container_db":case"external_container_db":case"component_db":case"external_component_db":l.append("path").attr("fill",n).attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("half",e.width/2).replaceAll("height",e.height)),l.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("half",e.width/2));break;case"system_queue":case"external_system_queue":case"container_queue":case"external_container_queue":case"component_queue":case"external_component_queue":l.append("path").attr("fill",n).attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("width",e.width).replaceAll("half",e.height/2)),l.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx",e.x+e.width).replaceAll("starty",e.y).replaceAll("half",e.height/2));break}let h=FTe(r,e.typeC4Shape.text);switch(l.append("text").attr("fill",a).attr("font-family",h.fontFamily).attr("font-size",h.fontSize-2).attr("font-style","italic").attr("lengthAdjust","spacing").attr("textLength",e.typeC4Shape.width).attr("x",e.x+e.width/2-e.typeC4Shape.width/2).attr("y",e.y+e.typeC4Shape.Y).text("<<"+e.typeC4Shape.text+">>"),e.typeC4Shape.text){case"person":case"external_person":SW(l,48,48,e.x+e.width/2-24,e.y+e.image.Y,s);break}let f=r[e.typeC4Shape.text+"Font"]();return f.fontWeight="bold",f.fontSize=f.fontSize+2,f.fontColor=a,bu(r)(e.label.text,l,e.x,e.y+e.label.Y,e.width,e.height,{fill:a},f),f=r[e.typeC4Shape.text+"Font"](),f.fontColor=a,e.techn&&e.techn?.text!==""?bu(r)(e.techn.text,l,e.x,e.y+e.techn.Y,e.width,e.height,{fill:a,"font-style":"italic"},f):e.type&&e.type.text!==""&&bu(r)(e.type.text,l,e.x,e.y+e.type.Y,e.width,e.height,{fill:a,"font-style":"italic"},f),e.descr&&e.descr.text!==""&&(f=r.personFont(),f.fontColor=a,bu(r)(e.descr.text,l,e.x,e.y+e.descr.Y,e.width,e.height,{fill:a},f)),e.height},"drawC4Shape"),DTe=o(function(t){t.append("defs").append("symbol").attr("id","database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),RTe=o(function(t){t.append("defs").append("symbol").attr("id","computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),NTe=o(function(t){t.append("defs").append("symbol").attr("id","clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),MTe=o(function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},"insertArrowHead"),ITe=o(function(t){t.append("defs").append("marker").attr("id","arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")},"insertArrowEnd"),OTe=o(function(t){t.append("defs").append("marker").attr("id","filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),PTe=o(function(t){t.append("defs").append("marker").attr("id","sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)},"insertDynamicNumber"),BTe=o(function(t){let r=t.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);r.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),r.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")},"insertArrowCrossHead"),FTe=o((t,e)=>({fontFamily:t[e+"FontFamily"],fontSize:t[e+"FontSize"],fontWeight:t[e+"FontWeight"]}),"getC4ShapeFont"),bu=function(){function t(i,a,s,l,u,h,f){let d=a.append("text").attr("x",s+u/2).attr("y",l+h/2+5).style("text-anchor","middle").text(i);n(d,f)}o(t,"byText");function e(i,a,s,l,u,h,f,d){let{fontSize:p,fontFamily:m,fontWeight:g}=d,y=i.split(We.lineBreakRegex);for(let v=0;v<y.length;v++){let x=v*p-p*(y.length-1)/2,b=a.append("text").attr("x",s+u/2).attr("y",l).style("text-anchor","middle").attr("dominant-baseline","middle").style("font-size",p).style("font-weight",g).style("font-family",m);b.append("tspan").attr("dy",x).text(y[v]).attr("alignment-baseline","mathematical"),n(b,f)}}o(e,"byTspan");function r(i,a,s,l,u,h,f,d){let p=a.append("switch"),g=p.append("foreignObject").attr("x",s).attr("y",l).attr("width",u).attr("height",h).append("xhtml:div").style("display","table").style("height","100%").style("width","100%");g.append("div").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(i),e(i,p,s,l,u,h,f,d),n(g,f)}o(r,"byFo");function n(i,a){for(let s in a)a.hasOwnProperty(s)&&i.attr(s,a[s])}return o(n,"_setTextAttrs"),function(i){return i.textPlacement==="fo"?r:i.textPlacement==="old"?t:e}}(),Tl={drawRect:S_,drawBoundary:_Te,drawC4Shape:LTe,drawRels:ATe,drawImage:SW,insertArrowHead:MTe,insertArrowEnd:ITe,insertArrowFilledHead:OTe,insertDynamicNumber:PTe,insertArrowCrossHead:BTe,insertDatabaseIcon:DTe,insertComputerIcon:RTe,insertClockIcon:NTe}});var zTe,Q3,A_=R(()=>{"use strict";zTe=typeof global=="object"&&global&&global.Object===Object&&global,Q3=zTe});var GTe,$Te,Jn,Ro=R(()=>{"use strict";A_();GTe=typeof self=="object"&&self&&self.Object===Object&&self,$Te=Q3||GTe||Function("return this")(),Jn=$Te});var VTe,Ji,vd=R(()=>{"use strict";Ro();VTe=Jn.Symbol,Ji=VTe});function YTe(t){var e=UTe.call(t,Zy),r=t[Zy];try{t[Zy]=void 0;var n=!0}catch{}var i=HTe.call(t);return n&&(e?t[Zy]=r:delete t[Zy]),i}var _W,UTe,HTe,Zy,LW,DW=R(()=>{"use strict";vd();_W=Object.prototype,UTe=_W.hasOwnProperty,HTe=_W.toString,Zy=Ji?Ji.toStringTag:void 0;o(YTe,"getRawTag");LW=YTe});function XTe(t){return qTe.call(t)}var WTe,qTe,RW,NW=R(()=>{"use strict";WTe=Object.prototype,qTe=WTe.toString;o(XTe,"objectToString");RW=XTe});function QTe(t){return t==null?t===void 0?KTe:jTe:MW&&MW in Object(t)?LW(t):RW(t)}var jTe,KTe,MW,fa,wu=R(()=>{"use strict";vd();DW();NW();jTe="[object Null]",KTe="[object Undefined]",MW=Ji?Ji.toStringTag:void 0;o(QTe,"baseGetTag");fa=QTe});function ZTe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var pn,Js=R(()=>{"use strict";o(ZTe,"isObject");pn=ZTe});function nke(t){if(!pn(t))return!1;var e=fa(t);return e==eke||e==tke||e==JTe||e==rke}var JTe,eke,tke,rke,wi,Jy=R(()=>{"use strict";wu();Js();JTe="[object AsyncFunction]",eke="[object Function]",tke="[object GeneratorFunction]",rke="[object Proxy]";o(nke,"isFunction");wi=nke});var ike,Z3,IW=R(()=>{"use strict";Ro();ike=Jn["__core-js_shared__"],Z3=ike});function ake(t){return!!OW&&OW in t}var OW,PW,BW=R(()=>{"use strict";IW();OW=function(){var t=/[^.]+$/.exec(Z3&&Z3.keys&&Z3.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();o(ake,"isMasked");PW=ake});function lke(t){if(t!=null){try{return oke.call(t)}catch{}try{return t+""}catch{}}return""}var ske,oke,Tu,__=R(()=>{"use strict";ske=Function.prototype,oke=ske.toString;o(lke,"toSource");Tu=lke});function gke(t){if(!pn(t)||PW(t))return!1;var e=wi(t)?mke:uke;return e.test(Tu(t))}var cke,uke,hke,fke,dke,pke,mke,FW,zW=R(()=>{"use strict";Jy();BW();Js();__();cke=/[\\^$.*+?()[\]{}|]/g,uke=/^\[object .+?Constructor\]$/,hke=Function.prototype,fke=Object.prototype,dke=hke.toString,pke=fke.hasOwnProperty,mke=RegExp("^"+dke.call(pke).replace(cke,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");o(gke,"baseIsNative");FW=gke});function yke(t,e){return t?.[e]}var GW,$W=R(()=>{"use strict";o(yke,"getValue");GW=yke});function vke(t,e){var r=GW(t,e);return FW(r)?r:void 0}var xs,Nh=R(()=>{"use strict";zW();$W();o(vke,"getNative");xs=vke});var xke,ku,ev=R(()=>{"use strict";Nh();xke=xs(Object,"create"),ku=xke});function bke(){this.__data__=ku?ku(null):{},this.size=0}var VW,UW=R(()=>{"use strict";ev();o(bke,"hashClear");VW=bke});function wke(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var HW,YW=R(()=>{"use strict";o(wke,"hashDelete");HW=wke});function Cke(t){var e=this.__data__;if(ku){var r=e[t];return r===Tke?void 0:r}return Eke.call(e,t)?e[t]:void 0}var Tke,kke,Eke,WW,qW=R(()=>{"use strict";ev();Tke="__lodash_hash_undefined__",kke=Object.prototype,Eke=kke.hasOwnProperty;o(Cke,"hashGet");WW=Cke});function _ke(t){var e=this.__data__;return ku?e[t]!==void 0:Ake.call(e,t)}var Ske,Ake,XW,jW=R(()=>{"use strict";ev();Ske=Object.prototype,Ake=Ske.hasOwnProperty;o(_ke,"hashHas");XW=_ke});function Dke(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ku&&e===void 0?Lke:e,this}var Lke,KW,QW=R(()=>{"use strict";ev();Lke="__lodash_hash_undefined__";o(Dke,"hashSet");KW=Dke});function Hp(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}var L_,ZW=R(()=>{"use strict";UW();YW();qW();jW();QW();o(Hp,"Hash");Hp.prototype.clear=VW;Hp.prototype.delete=HW;Hp.prototype.get=WW;Hp.prototype.has=XW;Hp.prototype.set=KW;L_=Hp});function Rke(){this.__data__=[],this.size=0}var JW,eq=R(()=>{"use strict";o(Rke,"listCacheClear");JW=Rke});function Nke(t,e){return t===e||t!==t&&e!==e}var No,xd=R(()=>{"use strict";o(Nke,"eq");No=Nke});function Mke(t,e){for(var r=t.length;r--;)if(No(t[r][0],e))return r;return-1}var Mh,tv=R(()=>{"use strict";xd();o(Mke,"assocIndexOf");Mh=Mke});function Pke(t){var e=this.__data__,r=Mh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Oke.call(e,r,1),--this.size,!0}var Ike,Oke,tq,rq=R(()=>{"use strict";tv();Ike=Array.prototype,Oke=Ike.splice;o(Pke,"listCacheDelete");tq=Pke});function Bke(t){var e=this.__data__,r=Mh(e,t);return r<0?void 0:e[r][1]}var nq,iq=R(()=>{"use strict";tv();o(Bke,"listCacheGet");nq=Bke});function Fke(t){return Mh(this.__data__,t)>-1}var aq,sq=R(()=>{"use strict";tv();o(Fke,"listCacheHas");aq=Fke});function zke(t,e){var r=this.__data__,n=Mh(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var oq,lq=R(()=>{"use strict";tv();o(zke,"listCacheSet");oq=zke});function Yp(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}var Ih,rv=R(()=>{"use strict";eq();rq();iq();sq();lq();o(Yp,"ListCache");Yp.prototype.clear=JW;Yp.prototype.delete=tq;Yp.prototype.get=nq;Yp.prototype.has=aq;Yp.prototype.set=oq;Ih=Yp});var Gke,Oh,J3=R(()=>{"use strict";Nh();Ro();Gke=xs(Jn,"Map"),Oh=Gke});function $ke(){this.size=0,this.__data__={hash:new L_,map:new(Oh||Ih),string:new L_}}var cq,uq=R(()=>{"use strict";ZW();rv();J3();o($ke,"mapCacheClear");cq=$ke});function Vke(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var hq,fq=R(()=>{"use strict";o(Vke,"isKeyable");hq=Vke});function Uke(t,e){var r=t.__data__;return hq(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Ph,nv=R(()=>{"use strict";fq();o(Uke,"getMapData");Ph=Uke});function Hke(t){var e=Ph(this,t).delete(t);return this.size-=e?1:0,e}var dq,pq=R(()=>{"use strict";nv();o(Hke,"mapCacheDelete");dq=Hke});function Yke(t){return Ph(this,t).get(t)}var mq,gq=R(()=>{"use strict";nv();o(Yke,"mapCacheGet");mq=Yke});function Wke(t){return Ph(this,t).has(t)}var yq,vq=R(()=>{"use strict";nv();o(Wke,"mapCacheHas");yq=Wke});function qke(t,e){var r=Ph(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var xq,bq=R(()=>{"use strict";nv();o(qke,"mapCacheSet");xq=qke});function Wp(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}var bd,e5=R(()=>{"use strict";uq();pq();gq();vq();bq();o(Wp,"MapCache");Wp.prototype.clear=cq;Wp.prototype.delete=dq;Wp.prototype.get=mq;Wp.prototype.has=yq;Wp.prototype.set=xq;bd=Wp});function D_(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Xke);var r=o(function(){var n=arguments,i=e?e.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var s=t.apply(this,n);return r.cache=a.set(i,s)||a,s},"memoized");return r.cache=new(D_.Cache||bd),r}var Xke,qp,R_=R(()=>{"use strict";e5();Xke="Expected a function";o(D_,"memoize");D_.Cache=bd;qp=D_});function jke(){this.__data__=new Ih,this.size=0}var wq,Tq=R(()=>{"use strict";rv();o(jke,"stackClear");wq=jke});function Kke(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var kq,Eq=R(()=>{"use strict";o(Kke,"stackDelete");kq=Kke});function Qke(t){return this.__data__.get(t)}var Cq,Sq=R(()=>{"use strict";o(Qke,"stackGet");Cq=Qke});function Zke(t){return this.__data__.has(t)}var Aq,_q=R(()=>{"use strict";o(Zke,"stackHas");Aq=Zke});function eEe(t,e){var r=this.__data__;if(r instanceof Ih){var n=r.__data__;if(!Oh||n.length<Jke-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new bd(n)}return r.set(t,e),this.size=r.size,this}var Jke,Lq,Dq=R(()=>{"use strict";rv();J3();e5();Jke=200;o(eEe,"stackSet");Lq=eEe});function Xp(t){var e=this.__data__=new Ih(t);this.size=e.size}var uc,iv=R(()=>{"use strict";rv();Tq();Eq();Sq();_q();Dq();o(Xp,"Stack");Xp.prototype.clear=wq;Xp.prototype.delete=kq;Xp.prototype.get=Cq;Xp.prototype.has=Aq;Xp.prototype.set=Lq;uc=Xp});var tEe,jp,N_=R(()=>{"use strict";Nh();tEe=function(){try{var t=xs(Object,"defineProperty");return t({},"",{}),t}catch{}}(),jp=tEe});function rEe(t,e,r){e=="__proto__"&&jp?jp(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var hc,Kp=R(()=>{"use strict";N_();o(rEe,"baseAssignValue");hc=rEe});function nEe(t,e,r){(r!==void 0&&!No(t[e],r)||r===void 0&&!(e in t))&&hc(t,e,r)}var av,M_=R(()=>{"use strict";Kp();xd();o(nEe,"assignMergeValue");av=nEe});function iEe(t){return function(e,r,n){for(var i=-1,a=Object(e),s=n(e),l=s.length;l--;){var u=s[t?l:++i];if(r(a[u],u,a)===!1)break}return e}}var Rq,Nq=R(()=>{"use strict";o(iEe,"createBaseFor");Rq=iEe});var aEe,Qp,t5=R(()=>{"use strict";Nq();aEe=Rq(),Qp=aEe});function oEe(t,e){if(e)return t.slice();var r=t.length,n=Oq?Oq(r):new t.constructor(r);return t.copy(n),n}var Pq,Mq,sEe,Iq,Oq,r5,I_=R(()=>{"use strict";Ro();Pq=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Mq=Pq&&typeof module=="object"&&module&&!module.nodeType&&module,sEe=Mq&&Mq.exports===Pq,Iq=sEe?Jn.Buffer:void 0,Oq=Iq?Iq.allocUnsafe:void 0;o(oEe,"cloneBuffer");r5=oEe});var lEe,Zp,O_=R(()=>{"use strict";Ro();lEe=Jn.Uint8Array,Zp=lEe});function cEe(t){var e=new t.constructor(t.byteLength);return new Zp(e).set(new Zp(t)),e}var Jp,n5=R(()=>{"use strict";O_();o(cEe,"cloneArrayBuffer");Jp=cEe});function uEe(t,e){var r=e?Jp(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var i5,P_=R(()=>{"use strict";n5();o(uEe,"cloneTypedArray");i5=uEe});function hEe(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var a5,B_=R(()=>{"use strict";o(hEe,"copyArray");a5=hEe});var Bq,fEe,Fq,zq=R(()=>{"use strict";Js();Bq=Object.create,fEe=function(){function t(){}return o(t,"object"),function(e){if(!pn(e))return{};if(Bq)return Bq(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Fq=fEe});function dEe(t,e){return function(r){return t(e(r))}}var s5,F_=R(()=>{"use strict";o(dEe,"overArg");s5=dEe});var pEe,em,o5=R(()=>{"use strict";F_();pEe=s5(Object.getPrototypeOf,Object),em=pEe});function gEe(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||mEe;return t===r}var mEe,fc,tm=R(()=>{"use strict";mEe=Object.prototype;o(gEe,"isPrototype");fc=gEe});function yEe(t){return typeof t.constructor=="function"&&!fc(t)?Fq(em(t)):{}}var l5,z_=R(()=>{"use strict";zq();o5();tm();o(yEe,"initCloneObject");l5=yEe});function vEe(t){return t!=null&&typeof t=="object"}var Wn,Mo=R(()=>{"use strict";o(vEe,"isObjectLike");Wn=vEe});function bEe(t){return Wn(t)&&fa(t)==xEe}var xEe,G_,Gq=R(()=>{"use strict";wu();Mo();xEe="[object Arguments]";o(bEe,"baseIsArguments");G_=bEe});var $q,wEe,TEe,kEe,kl,rm=R(()=>{"use strict";Gq();Mo();$q=Object.prototype,wEe=$q.hasOwnProperty,TEe=$q.propertyIsEnumerable,kEe=G_(function(){return arguments}())?G_:function(t){return Wn(t)&&wEe.call(t,"callee")&&!TEe.call(t,"callee")},kl=kEe});var EEe,wt,Bn=R(()=>{"use strict";EEe=Array.isArray,wt=EEe});function SEe(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=CEe}var CEe,nm,c5=R(()=>{"use strict";CEe=9007199254740991;o(SEe,"isLength");nm=SEe});function AEe(t){return t!=null&&nm(t.length)&&!wi(t)}var ei,Io=R(()=>{"use strict";Jy();c5();o(AEe,"isArrayLike");ei=AEe});function _Ee(t){return Wn(t)&&ei(t)}var wd,u5=R(()=>{"use strict";Io();Mo();o(_Ee,"isArrayLikeObject");wd=_Ee});function LEe(){return!1}var Vq,Uq=R(()=>{"use strict";o(LEe,"stubFalse");Vq=LEe});var Wq,Hq,DEe,Yq,REe,NEe,El,im=R(()=>{"use strict";Ro();Uq();Wq=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Hq=Wq&&typeof module=="object"&&module&&!module.nodeType&&module,DEe=Hq&&Hq.exports===Wq,Yq=DEe?Jn.Buffer:void 0,REe=Yq?Yq.isBuffer:void 0,NEe=REe||Vq,El=NEe});function FEe(t){if(!Wn(t)||fa(t)!=MEe)return!1;var e=em(t);if(e===null)return!0;var r=PEe.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&qq.call(r)==BEe}var MEe,IEe,OEe,qq,PEe,BEe,Xq,jq=R(()=>{"use strict";wu();o5();Mo();MEe="[object Object]",IEe=Function.prototype,OEe=Object.prototype,qq=IEe.toString,PEe=OEe.hasOwnProperty,BEe=qq.call(Object);o(FEe,"isPlainObject");Xq=FEe});function c6e(t){return Wn(t)&&nm(t.length)&&!!Mn[fa(t)]}var zEe,GEe,$Ee,VEe,UEe,HEe,YEe,WEe,qEe,XEe,jEe,KEe,QEe,ZEe,JEe,e6e,t6e,r6e,n6e,i6e,a6e,s6e,o6e,l6e,Mn,Kq,Qq=R(()=>{"use strict";wu();c5();Mo();zEe="[object Arguments]",GEe="[object Array]",$Ee="[object Boolean]",VEe="[object Date]",UEe="[object Error]",HEe="[object Function]",YEe="[object Map]",WEe="[object Number]",qEe="[object Object]",XEe="[object RegExp]",jEe="[object Set]",KEe="[object String]",QEe="[object WeakMap]",ZEe="[object ArrayBuffer]",JEe="[object DataView]",e6e="[object Float32Array]",t6e="[object Float64Array]",r6e="[object Int8Array]",n6e="[object Int16Array]",i6e="[object Int32Array]",a6e="[object Uint8Array]",s6e="[object Uint8ClampedArray]",o6e="[object Uint16Array]",l6e="[object Uint32Array]",Mn={};Mn[e6e]=Mn[t6e]=Mn[r6e]=Mn[n6e]=Mn[i6e]=Mn[a6e]=Mn[s6e]=Mn[o6e]=Mn[l6e]=!0;Mn[zEe]=Mn[GEe]=Mn[ZEe]=Mn[$Ee]=Mn[JEe]=Mn[VEe]=Mn[UEe]=Mn[HEe]=Mn[YEe]=Mn[WEe]=Mn[qEe]=Mn[XEe]=Mn[jEe]=Mn[KEe]=Mn[QEe]=!1;o(c6e,"baseIsTypedArray");Kq=c6e});function u6e(t){return function(e){return t(e)}}var Oo,Td=R(()=>{"use strict";o(u6e,"baseUnary");Oo=u6e});var Zq,sv,h6e,$_,f6e,Po,ov=R(()=>{"use strict";A_();Zq=typeof exports=="object"&&exports&&!exports.nodeType&&exports,sv=Zq&&typeof module=="object"&&module&&!module.nodeType&&module,h6e=sv&&sv.exports===Zq,$_=h6e&&Q3.process,f6e=function(){try{var t=sv&&sv.require&&sv.require("util").types;return t||$_&&$_.binding&&$_.binding("util")}catch{}}(),Po=f6e});var Jq,d6e,Bh,lv=R(()=>{"use strict";Qq();Td();ov();Jq=Po&&Po.isTypedArray,d6e=Jq?Oo(Jq):Kq,Bh=d6e});function p6e(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var cv,V_=R(()=>{"use strict";o(p6e,"safeGet");cv=p6e});function y6e(t,e,r){var n=t[e];(!(g6e.call(t,e)&&No(n,r))||r===void 0&&!(e in t))&&hc(t,e,r)}var m6e,g6e,dc,am=R(()=>{"use strict";Kp();xd();m6e=Object.prototype,g6e=m6e.hasOwnProperty;o(y6e,"assignValue");dc=y6e});function v6e(t,e,r,n){var i=!r;r||(r={});for(var a=-1,s=e.length;++a<s;){var l=e[a],u=n?n(r[l],t[l],l,r,t):void 0;u===void 0&&(u=t[l]),i?hc(r,l,u):dc(r,l,u)}return r}var Bo,kd=R(()=>{"use strict";am();Kp();o(v6e,"copyObject");Bo=v6e});function x6e(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var eX,tX=R(()=>{"use strict";o(x6e,"baseTimes");eX=x6e});function T6e(t,e){var r=typeof t;return e=e??b6e,!!e&&(r=="number"||r!="symbol"&&w6e.test(t))&&t>-1&&t%1==0&&t<e}var b6e,w6e,Fh,uv=R(()=>{"use strict";b6e=9007199254740991,w6e=/^(?:0|[1-9]\d*)$/;o(T6e,"isIndex");Fh=T6e});function C6e(t,e){var r=wt(t),n=!r&&kl(t),i=!r&&!n&&El(t),a=!r&&!n&&!i&&Bh(t),s=r||n||i||a,l=s?eX(t.length,String):[],u=l.length;for(var h in t)(e||E6e.call(t,h))&&!(s&&(h=="length"||i&&(h=="offset"||h=="parent")||a&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||Fh(h,u)))&&l.push(h);return l}var k6e,E6e,h5,U_=R(()=>{"use strict";tX();rm();Bn();im();uv();lv();k6e=Object.prototype,E6e=k6e.hasOwnProperty;o(C6e,"arrayLikeKeys");h5=C6e});function S6e(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var rX,nX=R(()=>{"use strict";o(S6e,"nativeKeysIn");rX=S6e});function L6e(t){if(!pn(t))return rX(t);var e=fc(t),r=[];for(var n in t)n=="constructor"&&(e||!_6e.call(t,n))||r.push(n);return r}var A6e,_6e,iX,aX=R(()=>{"use strict";Js();tm();nX();A6e=Object.prototype,_6e=A6e.hasOwnProperty;o(L6e,"baseKeysIn");iX=L6e});function D6e(t){return ei(t)?h5(t,!0):iX(t)}var bs,zh=R(()=>{"use strict";U_();aX();Io();o(D6e,"keysIn");bs=D6e});function R6e(t){return Bo(t,bs(t))}var sX,oX=R(()=>{"use strict";kd();zh();o(R6e,"toPlainObject");sX=R6e});function N6e(t,e,r,n,i,a,s){var l=cv(t,r),u=cv(e,r),h=s.get(u);if(h){av(t,r,h);return}var f=a?a(l,u,r+"",t,e,s):void 0,d=f===void 0;if(d){var p=wt(u),m=!p&&El(u),g=!p&&!m&&Bh(u);f=u,p||m||g?wt(l)?f=l:wd(l)?f=a5(l):m?(d=!1,f=r5(u,!0)):g?(d=!1,f=i5(u,!0)):f=[]:Xq(u)||kl(u)?(f=l,kl(l)?f=sX(l):(!pn(l)||wi(l))&&(f=l5(u))):d=!1}d&&(s.set(u,f),i(f,u,n,a,s),s.delete(u)),av(t,r,f)}var lX,cX=R(()=>{"use strict";M_();I_();P_();B_();z_();rm();Bn();u5();im();Jy();Js();jq();lv();V_();oX();o(N6e,"baseMergeDeep");lX=N6e});function uX(t,e,r,n,i){t!==e&&Qp(e,function(a,s){if(i||(i=new uc),pn(a))lX(t,e,s,r,uX,n,i);else{var l=n?n(cv(t,s),a,s+"",t,e,i):void 0;l===void 0&&(l=a),av(t,s,l)}},bs)}var hX,fX=R(()=>{"use strict";iv();M_();t5();cX();Js();zh();V_();o(uX,"baseMerge");hX=uX});function M6e(t){return t}var ea,Eu=R(()=>{"use strict";o(M6e,"identity");ea=M6e});function I6e(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var dX,pX=R(()=>{"use strict";o(I6e,"apply");dX=I6e});function O6e(t,e,r){return e=mX(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,a=mX(n.length-e,0),s=Array(a);++i<a;)s[i]=n[e+i];i=-1;for(var l=Array(e+1);++i<e;)l[i]=n[i];return l[e]=r(s),dX(t,this,l)}}var mX,f5,H_=R(()=>{"use strict";pX();mX=Math.max;o(O6e,"overRest");f5=O6e});function P6e(t){return function(){return t}}var ws,Y_=R(()=>{"use strict";o(P6e,"constant");ws=P6e});var B6e,gX,yX=R(()=>{"use strict";Y_();N_();Eu();B6e=jp?function(t,e){return jp(t,"toString",{configurable:!0,enumerable:!1,value:ws(e),writable:!0})}:ea,gX=B6e});function $6e(t){var e=0,r=0;return function(){var n=G6e(),i=z6e-(n-r);if(r=n,i>0){if(++e>=F6e)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var F6e,z6e,G6e,vX,xX=R(()=>{"use strict";F6e=800,z6e=16,G6e=Date.now;o($6e,"shortOut");vX=$6e});var V6e,d5,W_=R(()=>{"use strict";yX();xX();V6e=vX(gX),d5=V6e});function U6e(t,e){return d5(f5(t,e,ea),t+"")}var pc,sm=R(()=>{"use strict";Eu();H_();W_();o(U6e,"baseRest");pc=U6e});function H6e(t,e,r){if(!pn(r))return!1;var n=typeof e;return(n=="number"?ei(r)&&Fh(e,r.length):n=="string"&&e in r)?No(r[e],t):!1}var eo,Ed=R(()=>{"use strict";xd();Io();uv();Js();o(H6e,"isIterateeCall");eo=H6e});function Y6e(t){return pc(function(e,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(a=t.length>3&&typeof a=="function"?(i--,a):void 0,s&&eo(r[0],r[1],s)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var l=r[n];l&&t(e,l,n,a)}return e})}var p5,q_=R(()=>{"use strict";sm();Ed();o(Y6e,"createAssigner");p5=Y6e});var W6e,Gh,X_=R(()=>{"use strict";fX();q_();W6e=p5(function(t,e,r){hX(t,e,r)}),Gh=W6e});function om(t,e){if(!t)return e;let r=`curve${t.charAt(0).toUpperCase()+t.slice(1)}`;return q6e[r]??e}function Q6e(t,e){let r=t.trim();if(r)return e.securityLevel!=="loose"?(0,TX.sanitizeUrl)(r):r}function CX(t,e){return!t||!e?0:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function J6e(t){let e,r=0;t.forEach(i=>{r+=CX(i,e),e=i});let n=r/2;return Q_(t,n)}function eCe(t){return t.length===1?t[0]:J6e(t)}function rCe(t,e,r){let n=structuredClone(r);V.info("our points",n),e!=="start_left"&&e!=="start_right"&&n.reverse();let i=25+t,a=Q_(n,i),s=10+t*.5,l=Math.atan2(n[0].y-a.y,n[0].x-a.x),u={x:0,y:0};return e==="start_left"?(u.x=Math.sin(l+Math.PI)*s+(n[0].x+a.x)/2,u.y=-Math.cos(l+Math.PI)*s+(n[0].y+a.y)/2):e==="end_right"?(u.x=Math.sin(l-Math.PI)*s+(n[0].x+a.x)/2-5,u.y=-Math.cos(l-Math.PI)*s+(n[0].y+a.y)/2-5):e==="end_left"?(u.x=Math.sin(l)*s+(n[0].x+a.x)/2-5,u.y=-Math.cos(l)*s+(n[0].y+a.y)/2-5):(u.x=Math.sin(l)*s+(n[0].x+a.x)/2,u.y=-Math.cos(l)*s+(n[0].y+a.y)/2),u}function lm(t){let e="",r="";for(let n of t)n!==void 0&&(n.startsWith("color:")||n.startsWith("text-align:")?r=r+n+";":e=e+n+";");return{style:e,labelStyle:r}}function nCe(t){let e="",r="0123456789abcdef",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}function g5(t,e){return t9(t,e).height}function Cl(t,e){return t9(t,e).width}function r9(t){return"str"in t}function Ts(t,e){return Gh({},t,e)}var TX,K_,q6e,X6e,j6e,kX,EX,K6e,Z6e,bX,Q_,tCe,wX,Z_,J_,iCe,aCe,e9,sCe,t9,j_,m5,oCe,lCe,mc,Lt,SX,to,y5,xr=R(()=>{"use strict";TX=Xi(Up(),1);Zt();rr();r7();ut();Hf();cp();R_();X_();Vb();K_="\u200B",q6e={curveBasis:vs,curveBasisClosed:B3,curveBasisOpen:F3,curveBumpX:s_,curveBumpY:o_,curveBundle:l_,curveCardinalClosed:u_,curveCardinalOpen:f_,curveCardinal:c_,curveCatmullRomClosed:m_,curveCatmullRomOpen:g_,curveCatmullRom:p_,curveLinear:xu,curveLinearClosed:U3,curveMonotoneX:v_,curveMonotoneY:x_,curveNatural:Y3,curveStep:q3,curveStepAfter:w_,curveStepBefore:b_},X6e=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,j6e=o(function(t,e){let r=kX(t,/(?:init\b)|(?:initialize\b)/),n={};if(Array.isArray(r)){let s=r.map(l=>l.args);fp(s),n=On(n,[...s])}else n=r.args;if(!n)return;let i=lp(t,e),a="config";return n[a]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[a],delete n[a]),n},"detectInit"),kX=o(function(t,e=null){try{let r=new RegExp(`[%]{2}(?![{]${X6e.source})(?=[}][%]{2}).* [all...] |
/plugin/diagramsnet/lib/js/ |
H A D | extensions.min.js | 1705 …Cy(){var t=Ty(ry());return t.copy=function(){return ny(t,Cy()).exponent(t.exponent())},jp.apply(t,… function
|
/plugin/subjectindex/plugins/ |
H A D | bible_verses.txt | 24162 As they were going out they found a native of Cy·re'ne named Simon. This man they impressed into se… 24848 Also, they impressed into service a passerby, a certain Simon of Cy·re'ne, coming from the country,… 25962 Now as they led him away, they laid hold of Simon, a certain native of Cy·re'ne, coming from the co… 26960 and Phryg'i·a and Pam·phyl'i·a, Egypt and the parts of Lib'y·a, which is toward Cy·re'ne, and sojou… 27059 …a·bas by the apostles, which means, when translated, Son of Comfort, a Levite, a native of Cy'prus, 27328 However, out of them there were some men of Cy'prus and Cy·re'ne that came to Antioch and began tal… 27367 …, sent out by the holy spirit, went down to Se·leu'cia, and from there they sailed away to Cy'prus. 27482 … so that they separated from each other; and Bar'na·bas took Mark along and sailed away to Cy'prus. 27668 After coming in sight of the island of Cy'prus we left it behind on the left side and sailed on to … 27681 …s to the man at whose home we were to be entertained, a certain Mna'son of Cy'prus, an early disci… [all …]
|