Searched defs:Yl (Results 1 – 8 of 8) sorted by relevance
5 …(i.area/f):0);i.z=!0,i.dx+=e.x+e.dx-a,e.y+=f,e.dy-=f}else{for((r||f>e.dx)&&(f=e.dx);++u<o;)i=n[u],…
472 function Yl(a){var b;b=0;while(0<=(b=a.indexOf('\\',b))){ws(b+1,a.length);a.charCodeAt(b+1)==36?(a=… function
16 */function fs(e){this._container=this._createContainer(),lo(this._container),this._init(this._container,e)}rn(fs,mi),fs.prototype.saveSVG=jt((function(e){var t=this;return new Promise((function(e){var n=t.get("canvas"),i=n.getActiveLayer(),r=It("defs",n._svg),o=Mn(i),s=r&&r.outerHTML||"",a=i.getBBox();e({svg:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- created with dmn-js / http://bpmn.io --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+a.width+'" height="'+a.height+'" viewBox="'+a.x+" "+a.y+" "+a.width+" "+a.height+'" version="1.1">'+s+o+"</svg>"})}))})),fs.prototype.getModules=function(){return this._modules},fs.prototype.destroy=function(){mi.prototype.destroy.call(this),Ft(this._container)},fs.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},fs.prototype.off=function(e,t){this.get("eventBus").off(e,t)},fs.prototype._init=function(e,t){var{additionalModules:n,canvas:i,...r}=t,o={...r,canvas:{...i,container:e},modules:[...[{drd:["value",this]}],...t.modules||this.getModules(),...n||[]]};mi.call(this,o),t&&t.container&&this.attachTo(t.container)},fs.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},fs.prototype._createContainer=function(){return Lt('<div class="dmn-drd-container"></div>')},fs.prototype.open=function(e){var t=this;return new Promise(((n,i)=>{var r;try{return t._definitions&&t.clear(),t._definitions=e,function(e,t,n){var i,r=e.get("drdImporter"),o=e.get("eventBus"),s=[];o.fire("import.start",{definitions:t});try{!function(e){new xi({root:function(e){return r.root(e)},element:function(e,t){return r.add(e,t)},error:function(e,t){s.push({message:e,context:t})}}).handleDefinitions(e)}(t)}catch(e){i=e}o.fire("import.done",{error:i,warnings:s}),n(i,s)}(t,e,(function(e,t){e?(e.warnings=t||[],i(e)):n({warnings:t||[]})}))}catch(e){r=e}r?(r.warnings=r.warnings||[],i(r)):n({warnings:[]})}))},fs.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach();var t=this._container;e.appendChild(t),this._emit("attach",{}),this.get("canvas").resized()},fs.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},fs.prototype._modules=[Fo,jo,es,as,hs,ps];class gs{constructor(e){b(this,e),ys(this,"businessObject",{writable:!0})}}const ms={root:class extends gs{constructor(e){super(e),ys(this,"rows",{enumerable:!0,value:this.rows||[]}),ys(this,"cols",{enumerable:!0,value:this.cols||[]})}},row:class extends gs{constructor(e){super(e),ys(this,"root",{writable:!0}),ys(this,"cells",{enumerable:!0,value:this.cells||[]})}},col:class extends gs{constructor(e){super(e),ys(this,"root",{writable:!0}),ys(this,"cells",{enumerable:!0,value:this.cells||[]})}},cell:class extends gs{constructor(e){super(e),ys(this,"row",{writable:!0}),ys(this,"col",{writable:!0})}}};function ys(e,t,n){Object.defineProperty(e,t,n)}let vs=class{constructor(e){this._eventBus=e,this._elements={},e.on("table.clear",this.clear.bind(this))}add(e,t){const{id:n}=e;this._elements[n]=e}remove(e){const t=e.id||e;delete this._elements[t]}get(e){return this._elements[e]}getAll(){return ws(this._elements)}forEach(e){ws(this._elements).forEach((t=>e(t)))}filter(e){return ws(this._elements).filter((t=>e(t)))}clear(){this._elements={}}updateId(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t}),this.remove(e),e.id=t,this.add(e)}_validateId(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")}};function ws(e){return Object.keys(e).map((function(t){return e[t]}))}vs.$inject=["eventBus"];let bs=class{constructor(e){this._listeners={},e.on("elements.changed",(({elements:e})=>{this.elementsChanged(e)})),e.on("root.remove",(t=>{const n=t.root.id;this._listeners[n]&&e.once("root.add",(e=>{const t=e.root.id;this.updateId(n,t)}))})),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 r=this._listeners[n]&&this._listeners[n].length;if(r)for(let e=0;e<r;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])}};bs.$inject=["eventBus"];class xs extends oo{constructor(e){super(e);const t=this._injector=e.injector;this._sheet=t.get("sheet"),this._changeSupport=t.get("changeSupport"),this._components=t.get("components"),this._eventBus=t.get("eventBus");const n=t.get("throttle");this.onElementsChanged=this.onElementsChanged.bind(this),this.onScroll=n(this.onScroll.bind(this))}onElementsChanged(){this.forceUpdate()}onScroll(){this._eventBus.fire("sheet.scroll")}getChildContext(){return{changeSupport:this._changeSupport,components:this._components,injector:this._injector}}componentWillMount(){const{id:e}=this._sheet.getRoot();this._changeSupport.onElementsChanged(e,this.onElementsChanged)}componentWillUnmount(){const{id:e}=this._sheet.getRoot();this._changeSupport.offElementsChanged(e,this.onElementsChanged)}render(){const{rows:e,cols:t}=this._sheet.getRoot(),n=this._components.getComponents("table.before"),i=this._components.getComponents("table.after"),r=this._components.getComponent("table.head"),o=this._components.getComponent("table.body"),s=this._components.getComponent("table.foot");return zi(1,"div","tjs-container",[n&&n.map(((e,t)=>Hi(2,e,null,t))),zi(1,"div","tjs-table-container",zi(1,"table","tjs-table",[r&&Hi(2,r,{rows:e,cols:t}),o&&Hi(2,o,{rows:e,cols:t}),s&&Hi(2,s,{rows:e,cols:t})],0),2,{onScroll:this.onScroll}),i&&i.map(((e,t)=>Hi(2,e,null,t)))],0)}}let ks=class{constructor(e,t,n,i,r){const{container:o}=n;this._container=o,i.on("root.added",(()=>{eo(Hi(2,xs,{injector:r}),o)})),i.on("root.remove",(()=>{eo(null,o)}))}getContainer(){return this._container}};ks.$inject=["changeSupport","components","config.renderer","eventBus","injector"];var _s={__init__:["changeSupport","components","renderer"],changeSupport:["type",bs],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],i=[];if(!n)return i;for(let e=0;e<n.length;e++){const r=n[e].callback(t);r&&i.push(r)}return i.length,i}onGetComponent(e,t,n){if(s(t)&&(n=t,t=1e3),!o(t))throw new Error("priority must be a number");const i=this._getListeners(e);let r,a;const l={priority:t,callback:n};for(a=0;r=i[a];a++)if(r.priority<t)return void i.splice(a,0,l);i.push(l)}offGetComponent(e,t){const n=this._getListeners(e);let i,r,o;if(t)for(o=n.length-1;i=n[o];o--)r=i.callback,r===t&&n.splice(o,1);else n.length=0}_getListeners(e){let t=this._listeners[e];return t||(this._listeners[e]=t=[]),t}}],renderer:["type",ks]};class Ss{constructor(e,t){this._elementRegistry=e,this._eventBus=t,this._root=null,t.on("table.clear",(()=>{this.setRoot(null)}))}setRoot(e){if(this._root){const e=this._root;this._eventBus.fire("root.remove",{root:e}),this._root=null,this._eventBus.fire("root.removed",{root:e})}e&&this._eventBus.fire("root.add",{root:e}),this._root=e,e&&this._eventBus.fire("root.added",{root:e})}getRoot(){return this._root||this.setRoot({id:"__implicitroot",rows:[],cols:[]}),this._root}addRow(e,t){const n=this.getRoot();if(n.cols.length!=e.cells.length)throw new Error("number of cells is not equal to number of cols");return void 0===t&&(t=n.rows.length),Cs(t,n.rows,e),e.root=n,this._elementRegistry.add(e),e.cells.forEach(((i,r)=>{this._elementRegistry.add(i),i.row=e,i.col=n.cols[r],Cs(t,n.cols[r].cells,i)})),this._eventBus.fire("row.add",{row:e}),e}removeRow(e){const t=this.getRoot();"string"==typeof e&&(e=this._elementRegistry.get(e));const n=t.rows.indexOf(e);-1!==n&&(Es(n,t.rows),e.root=void 0,this._elementRegistry.remove(e),e.cells.forEach(((e,i)=>{this._elementRegistry.remove(e),e.col=void 0,Es(n,t.cols[i].cells)})),this._eventBus.fire("row.remove",{row:e}))}addCol(e,t){const n=this.getRoot();if(this._elementRegistry.add(e),n.rows.length!=e.cells.length)throw new Error("number of cells is not equal to number of rows");return void 0===t&&(t=n.cols.length),Cs(t,n.cols,e),e.root=n,e.cells.forEach(((i,r)=>{this._elementRegistry.add(i),i.col=e,i.row=n.rows[r],Cs(t,n.rows[r].cells,i)})),this._eventBus.fire("col.add",{col:e}),e}removeCol(e){const t=this.getRoot();"string"==typeof e&&(e=this._elementRegistry.get(e));const n=t.cols.indexOf(e);-1!==n&&(Es(n,t.cols),e.root=void 0,this._elementRegistry.remove(e),e.cells.forEach(((e,i)=>{this._elementRegistry.remove(e),e.row=void 0,Es(n,t.rows[i].cells)})),this._eventBus.fire("col.remove",{col:e}))}resized(){this._eventBus.fire("sheet.resized")}}function Cs(e,t,n){return t.splice(e,0,n)}function Es(e,t){return t.splice(e,1)}function Ms(e=!0){const t="number"==typeof e?e:e?300:0;return t?e=>function(e,t){let n=!1;return function(...i){n||(e(...i),n=!0,setTimeout((()=>{n=!1}),t))}}(e,t):e=>e}Ss.$inject=["elementRegistry","eventBus"],Ms.$inject=["config.throttle"];var As={__depends__:[_s],__init__:["elementFactory","sheet"],elementFactory:["type",class{constructor(){this._uid=12}create(e,t={}){return t.id||(t.id=e+"_"+this._uid++),function(e,t){const n=ms[e];if(!n)throw new Error("unknown type "+e);return new n(t)}(e,t)}createRoot(e){return this.create("root",e)}createRow(e){return this.create("row",e)}createCol(e){return this.create("col",e)}createCell(e){return this.create("cell",e)}}],elementRegistry:["type",vs],eventBus:["type",_],sheet:["type",Ss],throttle:["factory",Ms]};class Ds{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]},As].concat(t||[]),i=new tn(n);return i.init(),i}(i,n)}this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("table.init"),this.get("eventBus").fire("diagram.init")}_init(e){let{modules:t,...n}=e;return{modules:t,config:n}}destroy(){const e=this.get("eventBus");e.fire("table.destroy"),e.fire("diagram.destroy")}clear(){const e=this.get("eventBus");e.fire("table.clear"),e.fire("diagram.clear")}}function Rs(e){if(!e)return"<null>";const t=e.id?` id="${e.id}"`:"";return`<${e.$type}${t} />`}function Os(e,t){function n(t,n,i){if(t.gfx)throw new Error(`already rendered ${Rs(t)}`);return e.element(t,n,i)}function i(e,t,i){u(e,(function(e){n(e,t,i)}))}function r(e,t,i){u(e,(function(e){n(e,t,i)}))}return{handleDecision:function(t){t.id||(t.id="decision");const o=t.decisionLogic;if(!o)throw new Error(`no table for ${Rs(t)}`);{if(!o.output)throw new Error(`missing output for ${Rs(o)}`);const t=(c=o,e.table(c));o.input&&i(o.input,t,o),i(o.output,t,o),s=o.rule,a=t,l=o,u(s,(function(e){n(e,a,l),r(e.inputEntry,e),r(e.outputEntry,e)}))}var s,a,l,c}}}function Ts(e,t){const{elements:n,index:i}=e;return i[t]?e:{elements:[...n,t],index:{...i,[t]:!0}}}function Ns(...e){let t={elements:[],index:{}};return e.forEach((function(e){const n=typeof e;"string"===n&&e.length>0?t=Ts(t,e):"object"===n&&null!==e&&Object.keys(e).forEach((function(n){e[n]&&(t=Ts(t,n))}))})),function(e,t){return e.elements.join(t)}(t," ")}function Ps(e){return qs(e.constructor,e)}function qs(e,t){const n=e.$inject;if(!n)return;const{injector:i}=t.context,r=[...n,function(...e){for(const i in e){const r=n[i],o=e[i];t[r]=o}}];i.invoke(r)}function Bs(e,t){Object.keys(t).forEach((function(n){if("$inject"===n||"__init"===n)return;const i=t[n];"constructor"===n&&i.call(e,e.props,e.context);const r=e[n];if(void 0!==r){if("function"!=typeof r)throw new Error(`failed to mixin <${n}>: cannot combine with non-fn component value`);e[n]=function(e,...t){return function(...n){let i;return t.forEach((function(t){if(i=t.call(e,...n),void 0!==i)return!1})),i}.bind(e)}(e,r,i)}else e[n]=i.bind(e)})),"$inject"in t&&qs(t,e),"__init"in t&&t.__init.call(e,e.props,e.context)}const Ls={getSelectionClasses(){const{selected:e,selectedSecondary:t,focussed:n}=this.state;return Ns({selected:e,"selected-secondary":t,focussed:n})},selectionChanged(e){this.setState(e)},componentWillUpdate(e){e.elementId!==this.props.elementId&&this.updateSelectionSubscription(!1)},componentDidUpdate(e){e.elementId!==this.props.elementId&&this.updateSelectionSubscription(!0)},componentDidMount(){this.updateSelectionSubscription(!0)},componentWillUnmount(){this.updateSelectionSubscription(!1)},updateSelectionSubscription(e){const{elementId:t}=this.props;t&&t&&this.eventBus[e?"on":"off"](`selection.${t}.changed`,this.selectionChanged)},$inject:["eventBus"]};class Is extends oo{constructor(e,t){super(e,t),Bs(this,Ls),Ps(this)}getRenderProps(...e){const{className:t,elementId:n,coords:i,...r}=this.props,o={className:Ns(...e,this.getSelectionClasses(),t)};return n&&(o["data-element-id"]=n),i&&(o["data-coords"]=i),{...o,...r}}}class Fs extends Is{constructor(e,t){super(e,t),this.state={}}render(){const{children:e}=this.props;return Ui(zi(1,"td",null,e,0,{...this.getRenderProps("cell")}))}}const js={slotFill(e,t){const{type:n,context:i,...r}=e,o=this.components.getComponent(n,i)||t;return o?Ui(Hi(2,o,{...i,...r})):null},slotFills(e){const{type:t,context:n,...i}=e;return this.components.getComponents(t,n).map((e=>Ui(Hi(2,e,{...n,...i}))))},$inject:["components"]};class Vs extends oo{constructor(e,t){super(e,t),Bs(this,js),Ps(this)}componentDidMount(){this.changeSupport.onElementsChanged(this.getRoot(),this.onElementsChanged)}componentWillUnmount(){this.changeSupport.offElementsChanged(this.getRoot(),this.onElementsChanged)}onElementsChanged=()=>{this.forceUpdate()};getRoot(){return this.sheet.getRoot()}render(){const e=(this.getRoot().businessObject.get("annotationsWidth")||400)+"px";return zi(1,"th","annotation header",[this.slotFills({type:"cell-inner",context:{cellType:"annotations",col:this.sheet.getRoot(),minWidth:400}}),this.translate("Annotations")],0,{style:{width:e}})}}function $s(e){const{row:t}=e,{id:n,description:i}=t.businessObject;return Hi(2,Fs,{className:"annotation",elementId:n,children:i||"-"})}function zs(e){e.onGetComponent("cell",(({cellType:e})=>"after-label-cells"===e?Vs:"after-rule-cells"===e?$s:void 0))}Vs.$inject=["changeSupport","sheet","translate"],zs.$inject=["components"];var Hs={__init__:["annotationsProvider"],annotationsProvider:["type",zs]};function Ws(e,t){return b({id:e.id,type:e.$type,businessObject:e},t)}class Us{constructor(e,t,n){this._elementFactory=e,this._eventBus=t,this._sheet=n}add(e){let t;if(yi(e,"dmn:DecisionTable"))t=this._elementFactory.createRoot(Ws(e)),this._sheet.setRoot(t);else if(yi(e,"dmn:InputClause"))t=this._elementFactory.createCol(Ws(e)),this._sheet.addCol(t);else if(yi(e,"dmn:OutputClause"))t=this._elementFactory.createCol(Ws(e)),this._sheet.addCol(t);else if(yi(e,"dmn:DecisionRule")){e.inputEntry||(e.inputEntry=[]),e.outputEntry||(e.outputEntry=[]);const n=[...e.inputEntry,...e.outputEntry].map((e=>this._elementFactory.createCell(Ws(e))));t=this._elementFactory.createRow(b(Ws(e),{cells:n})),this._sheet.addRow(t)}return this._eventBus.fire("dmnElement.added",{element:t}),t}}Us.$inject=["elementFactory","eventBus","sheet"];var Gs={__depends__:[{__depends__:[jo],tableImporter:["type",Us]},_s]};class Ks extends oo{constructor(e,t){super(e,t),Bs(this,js),this._sheet=t.injector.get("sheet"),this._changeSupport=t.changeSupport}onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){const e=this._sheet.getRoot();this._changeSupport.onElementsChanged(e.id,this.onElementsChanged)}componentWillUnmount(){const e=this._sheet.getRoot();this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}render(){const e=this._sheet.getRoot();if(!yi(e,"dmn:DMNElement"))return null;const t=vi(e),n=t.input,i=t.output;return zi(1,"thead",null,zi(1,"tr",null,[zi(1,"th","index-column"),this.slotFills({type:"cell",context:{cellType:"before-label-cells"}}),n&&n.map(((e,t)=>{const i=e.width||"192px";return this.slotFill({type:"cell",context:{cellType:"input-header",input:e,index:t,inputsLength:n.length,width:i},key:e.id},Xs)})),i.map(((e,t)=>this.slotFill({type:"cell",context:{cellType:"output-header",output:e,index:t,outputsLength:i.length},key:e.id},Ys))),this.slotFills({type:"cell",context:{cellType:"after-label-cells"}})],0),2)}}function Xs(e,t){const{input:n,className:i,index:r}=e,{label:o,inputExpression:s,inputValues:a}=n,l=t.injector.get("translate");return zi(1,"th",(i||"")+" input-cell",[zi(1,"div","clause",l(0===r?"When":"And"),0),o?zi(1,"div","input-label",o,0,{title:l("Input label: ")+o}):zi(1,"div","input-expression",s.text,0,{title:l("Input expression: ")+s.text}),zi(1,"div","input-variable",a&&a.text||s.typeRef,0,{title:a&&a.text?l("Input values"):l("Input type")})],0,{"data-col-id":n.id},n.id)}function Ys(e,t){const{output:n,className:i,index:r}=e,{label:o,name:s,outputValues:a,typeRef:l}=n,c=t.injector.get("translate");return zi(1,"th",(i||"")+" output-cell",[zi(1,"div","clause",c(0===r?"Then":"And"),0),o?zi(1,"div","output-label",o,0,{title:c("Output label")}):zi(1,"div","output-name",s,0,{title:c("Output name")}),zi(1,"div","output-variable",a&&a.text||l,0,{title:a&&a.text?c("Output values"):c("Output type")})],0,null,n.id)}function Js(e){e.onGetComponent("table.head",(()=>Ks))}Js.$inject=["components"];var Qs={__init__:["decisionTableHeadProvider"],decisionTableHeadProvider:["type",Js]};class Zs extends oo{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),Ps(this)}render(){const e=this.sheet.getRoot();if(!yi(e,"dmn:DMNElement"))return null;const{name:t}=e.businessObject.$parent,n=this.components.getComponent("hit-policy")||ea;return zi(1,"div","decision-table-properties",[zi(1,"div","decision-table-name",t,0,{title:this._translate("Decision name: ")+t}),zi(1,"div","decision-table-header-separator"),Hi(2,n)],4)}}function ea(){return null}Zs.$inject=["sheet","components"];class ta{constructor(e){e.onGetComponent("table.before",500,(()=>Zs))}}ta.$inject=["components"];var na={__init__:["decisionTableProperties"],decisionTableProperties:["type",ta]};class ia extends oo{render(){const{row:e,rowIndex:t}=this.props,{components:n}=this.context,i=n.getComponents("cell-inner",{cellType:"rule-index",row:e,rowIndex:t});return zi(1,"td","rule-index",[i&&i.map((n=>Hi(2,n,{row:e,rowIndex:t}))),t+1],0,{"data-element-id":e.id,"data-row-id":e.id})}}class ra{constructor(e){e.onGetComponent("cell",(({cellType:e})=>{if("before-rule-cells"===e)return ia}))}}ra.$inject=["components"];var oa={__init__:["decisionRuleIndices"],decisionRuleIndices:["type",ra]};const sa=[{label:"FEEL",value:"feel"}];class aa{constructor(e){this._injector=e;const t=e.get("config.expressionLanguages")||{};this._config={options:sa,defaults:{editor:"feel"}},t.options&&(this._config.options=t.options);const n=this._getLegacyDefaults();b(this._config.defaults,n,t.defaults)}getDefault(e){const{defaults:t}=this._config,n=t[e]||t.editor;return this._getLanguageByValue(n)||this.getAll()[0]}getLabel(e){const t=this._getLanguageByValue(e);return t?t.label:e}getAll(){return this._config.options}_getLegacyDefaults(){const e={},t=this._injector,n=t.get("config.defaultInputExpressionLanguage"),i=t.get("config.defaultOutputExpressionLanguage");return n&&(e.inputCell=n),i&&(e.outputCell=i),e}_getLanguageByValue(e){return c(this.getAll(),(t=>e===t.value))}}aa.$inject=["injector"];var la={__init__:["expressionLanguages"],expressionLanguages:["type",aa]};class ca extends oo{render({rows:e,cols:t}){const{components:n}=this.context;return zi(1,"tbody",null,e.map(((e,i)=>{const r=n.getComponent("row",{rowType:"rule"});return r&&Hi(2,r,{row:e,rowIndex:i,cols:t},e.id)})),0)}}class ha extends oo{constructor(e,t){super(e,t),Bs(this,js)}render(){const{row:e,rowIndex:t,cols:n}=this.props,{cells:i}=e;return zi(1,"tr",null,[this.slotFills({type:"cell",context:{cellType:"before-rule-cells",row:e,rowIndex:t}}),i.map(((i,r)=>this.slotFill({type:"cell",context:{cellType:"rule",cell:i,rowIndex:t,colIndex:r},key:i.id,row:e,col:n[r]}))),this.slotFills({type:"cell",context:{cellType:"after-rule-cells",row:e,rowIndex:t}})],0)}}class ua extends oo{render(){const{cell:e,row:t,col:n}=this.props;return yi(e,"dmn:UnaryTests")?Hi(2,Fs,{className:"input-cell",elementId:e.id,"data-row-id":t.id,"data-col-id":n.id,children:e.businessObject.text}):Hi(2,Fs,{className:"output-cell",elementId:e.id,"data-row-id":t.id,"data-col-id":n.id,children:e.businessObject.text})}}class da{constructor(e){e.onGetComponent("table.body",(()=>ca)),e.onGetComponent("row",(({rowType:e})=>{if("rule"===e)return ha})),e.onGetComponent("cell",(({cellType:e})=>{if("rule"===e)return ua}))}}da.$inject=["components"];var pa={__depends__:[la],__init__:["decisionRules"],decisionRules:["type",da]};const fa=[{label:"Unique",value:{hitPolicy:"UNIQUE",aggregation:void 0},explanation:"No overlap is possible and all rules are disjoint. Only a single rule can be matched"},{label:"First",value:{hitPolicy:"FIRST",aggregation:void 0},explanation:"Rules may overlap. The first matching rule will be chosen"},{label:"Priority",value:{hitPolicy:"PRIORITY",aggregation:void 0},explanation:"Rules may overlap. The one with the highest priority will be chosen"},{label:"Any",value:{hitPolicy:"ANY",aggregation:void 0},explanation:"Rules may overlap. Their output have to match"},{label:"Collect",value:{hitPolicy:"COLLECT",aggregation:void 0},explanation:"Collects the values of all matching rules"},{label:"Collect (Sum)",value:{hitPolicy:"COLLECT",aggregation:"SUM"},explanation:"Collects the values of all matching rules and sums up to a single value"},{label:"Collect (Min)",value:{hitPolicy:"COLLECT",aggregation:"MIN"},explanation:"Collects the values of all matching rules and uses the lowest value"},{label:"Collect (Max)",value:{hitPolicy:"COLLECT",aggregation:"MAX"},explanation:"Collects the values of all matching rules and uses the highest value"},{label:"Collect (Count)",value:{hitPolicy:"COLLECT",aggregation:"COUNT"},explanation:"Collects the values of all matching rules and counts the number of them"},{label:"Rule order",value:{hitPolicy:"RULE ORDER",aggregation:void 0},explanation:"Collects the values of all matching rules in rule order"},{label:"Output order",value:{hitPolicy:"OUTPUT ORDER",aggregation:void 0},explanation:"Collects the values of all matching rules in decreasing output priority order"}];class ga extends oo{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),Ps(this)}getRoot(){return this.sheet.getRoot()}render(){const e=this.getRoot().businessObject,{aggregation:t,hitPolicy:n}=e,i=c(fa,(e=>{return i=e.value,r={aggregation:t,hitPolicy:n},i.hitPolicy===r.hitPolicy&&i.aggregation===r.aggregation;var i,r}));return zi(1,"div","hit-policy header",[zi(1,"label","dms-label",this._translate("Hit policy:"),0),zi(1,"span","hit-policy-value",this._translate(i.label),0)],4,{title:this._translate(i.explanation)})}}function ma(e){e.onGetComponent("hit-policy",(()=>ga))}ga.$inject=["sheet"],ma.$inject=["components"];var ya={__init__:["hitPolicyProvider"],hitPolicyProvider:["type",ma]};let va=class extends oo{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 zi(1,"div","view-drd",zi(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,(e=>this.node=e))}},wa=class{constructor(e,t,n,i){this._injector=n,this._sheet=i,e.onGetComponent("table.before",(()=>{if(this.canViewDrd())return va})),t.on("showDrd",(()=>{const e=n.get("_parent",!1),t=ba(i.getRoot());if(!t)return;const r=e.getView(t);e.open(r)}))}canViewDrd(){const e=this._injector.get("_parent",!1);if(!e)return!1;const t=ba(this._sheet.getRoot());return!!e.getView(t)}};function ba(e){const{businessObject:t}=e;if(!t)return;return t.$parent.$parent}wa.$inject=["components","eventBus","injector","sheet"];var xa={__init__:["viewDrd"],viewDrd:["type",wa]};let ka=class{constructor(e){e.onGetComponent("table.before",(()=>co))}};ka.$inject=["components"];var _a={__init__:["poweredBy"],poweredBy:["type",ka]};let Sa=class e extends Ds{constructor(t={}){const n=e._createContainer();super(b(t,{renderer:{container:n}})),this._container=n}open(e){var t=this;return new Promise(((n,i)=>{var r;try{return t._decision&&t.clear(),t._decision=e,function(e,t,n){const i=e.get("tableImporter"),r=e.get("eventBus"),o=e.get("sheet");e.get("modeling",!1);let s,a=[];r.fire("import.render.start",{decision:t});try{!function(e){new Os({create:(e,t,n,r)=>i.create(e,t,n,r),table:e=>i.add(e),element:(e,t,n)=>i.add(e,t,n),error(e,t){a.push({message:e,context:t})}}).handleDecision(e)}(t)}catch(e){s=e}r.fire("import.render.complete",{error:s,warnings:a}),r.fire("elements.changed",{elements:[o.getRoot()]}),n(s,a)}(t,e,(function(e,t){e?(e.warnings=t||[],i(e)):n({warnings:t||[]})}))}catch(e){r=e}r?(r.warnings=r.warnings||[],i(r)):n({warnings:[]})}))}_init(e){let{modules:t,additionalModules:n,...i}=e,r=t||this.getModules();return{modules:[_a,...r,...n||[],...[{decisionTable:["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)}attachTo(e){if(!e)throw new Error("parentNode required");this.detach();const t=this._container;e.appendChild(t),this._emit("attach",{})}detach(){const e=this._container;e.parentNode&&(this._emit("detach",{}),Ft(e))}destroy(){super.destroy(),this.detach()}getModules(){return e._getModules()}static _getModules(){return[Hs,Gs,jo,Qs,na,oa,pa,ya,xa]}static _createContainer(){return Lt('<div class="dmn-decision-table-container"></div>')}};class Ca{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 r=this._listeners[n]&&this._listeners[n].length;if(r)for(let e=0;e<r;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])}}Ca.$inject=["eventBus"];class Ea extends oo{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 zi(1,"div","viewer-container",e&&e.map(((e,t)=>Hi(2,e,null,t))),0)}}class Ma{constructor(e,t,n,i,r){const{container:o}=n;this._container=o,i.on("renderer.mount",(()=>{eo(Hi(2,Ea,{injector:r}),o)})),i.on("renderer.unmount",(()=>{eo(null,o)}))}getContainer(){return this._container}}Ma.$inject=["changeSupport","components","config.renderer","eventBus","injector"];var Aa={__init__:["changeSupport","components","renderer"],changeSupport:["type",Ca],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 r=n[e].callback(t);r&&i.push(r)}return i.length?i:void 0}onGetComponent(e,t,n){if(s(t)&&(n=t,t=1e3),!o(t))throw new Error("priority must be a number");const i=this._getListeners(e);let r,a;const l={priority:t,callback:n};for(a=0;r=i[a];a++)if(r.priority<t)return void i.splice(a,0,l);i.push(l)}offGetComponent(e,t){const n=this._getListeners(e);let i,r,o;if(t)for(o=n.length-1;i=n[o];o--)r=i.callback,r===t&&n.splice(o,1);else n.length=0}_getListeners(e){let t=this._listeners[e];return t||(this._listeners[e]=t=[]),t}}],eventBus:["type",_],renderer:["type",Ma]};let Da=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]},Aa].concat(t||[]),i=new tn(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")}};class Ra{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}}Ra.$inject=["viewer","eventBus"];var Oa={__init__:["elementRegistry"],elementRegistry:["type",Ra]};class Ta extends oo{constructor(e,t){super(e,t),this._viewer=t.injector.get("viewer")}render(){const{name:e}=this._viewer.getDecision();return zi(1,"div","decision-properties",zi(1,"h3","decision-name",e,0),2)}}let Na=class{constructor(e){e.onGetComponent("viewer",1500,(()=>Ta))}};Na.$inject=["components"];var Pa={__init__:["decisionProperties"],decisionProperties:["type",Na]};class qa extends oo{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 zi(1,"div","literal-expression-properties",zi(1,"table",null,[zi(1,"tr",null,[zi(1,"td",null,this._translate("Variable name:"),0),zi(1,"td",null,zi(1,"span",null,t.name||"-",0),2)],4),zi(1,"tr",null,[zi(1,"td",null,this._translate("Variable type:"),0),zi(1,"td",null,zi(1,"span",null,this._translate(t.typeRef||"")||"-",0),2)],4),zi(1,"tr",null,[zi(1,"td",null,this._translate("Expression language:"),0),zi(1,"td",null,zi(1,"span",null,e.expressionLanguage||"-",0),2)],4)],4),2)}}class Ba{constructor(e){e.onGetComponent("viewer",500,(()=>qa))}}Ba.$inject=["components"];var La={__depends__:[],__init__:["literalExpressionProperties"],literalExpressionProperties:["type",Ba]};let Ia=class{constructor(e){e.onGetComponent("viewer",2e3,(()=>co))}};Ia.$inject=["components"];var Fa={__init__:["poweredBy"],poweredBy:["type",Ia]};class ja extends oo{constructor(e,t){super(e,t),this._viewer=t.injector.get("viewer")}render(){const{text:e}=this._viewer.getDecision().decisionLogic;return zi(1,"div","textarea",zi(1,"div","content",e,0),2)}}class Va{constructor(e){e.onGetComponent("viewer",(()=>ja))}}Va.$inject=["components"];var $a={__init__:["textarea"],textarea:["type",Va]};let za=class extends oo{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 zi(1,"div","view-drd",zi(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,(e=>this.node=e))}};za.$inject=["translate"];let Ha=class{constructor(e,t,n,i){this._injector=i,this._viewer=t,e.onGetComponent("viewer",2e3,(()=>{if(this.canViewDrd())return za})),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}};Ha.$inject=["components","viewer","eventBus","injector"];var Wa={__init__:["viewDrd"],viewDrd:["type",Ha]};let Ua=class e extends Da{constructor(t={}){const n=e._createContainer();super(b(t,{renderer:{container:n}})),this._container=n}open(e){var t=this;return new Promise((function(n,i){var r;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){r=e}r?(r.warnings=r.warnings||[],i(r)):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",{}),Ft(e))}destroy(){super.destroy(),this.detach()}getModules(){return e._getModules()}static _getModules(){return[Oa,jo,Pa,La,Fa,$a,Wa]}static _createContainer(){return Lt('<div class="dmn-literal-expression-container"></div>')}};function Ga(e,{injector:t}){const n=t.get("components").getComponents("header");return zi(1,"div","dmn-boxed-expression-section dmn-boxed-expression-header",n&&n.map(((e,t)=>Hi(2,e,null,t))),0)}function Ka(e,{injector:t}){const n=t.get("components").getComponents("body");return zi(1,"div","dmn-boxed-expression-section dmn-boxed-expression-body",n&&n.map(((e,t)=>Hi(2,e,null,t))),0)}function Xa(e,{injector:t}){const n=t.get("components").getComponents("footer");return zi(1,"div","dmn-boxed-expression-section dmn-boxed-expression-footer",n&&n.map(((e,t)=>Hi(2,e,null,t))),0)}var Ya={__init__:["viewRenderer","tableJsSupport"],viewRenderer:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("viewer",(()=>Ga)),e.onGetComponent("viewer",(()=>Ka)),e.onGetComponent("viewer",(()=>Xa))}}],tableJsSupport:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("viewer",(()=>{const t=e.getComponents("table.before")||[];return()=>zi(1,"div",null,t.map(((e,t)=>Hi(2,e,null,t))),0)}))}}]};class Ja{constructor(e){e.onGetComponent("viewer",2e3,(()=>co))}}Ja.$inject=["components"];var Qa={__init__:["poweredBy"],poweredBy:["type",Ja]};function Za({expression:e},t){return zi(1,"div","textarea",zi(1,"div","content",t.injector.get("literalExpression").getText(e),0),2)}class el{getText(e){return e.get("text")}}var tl={__init__:["literalExpressionComponent"],literalExpressionComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("expression",(({expression:e})=>{if(yi(e,"dmn:LiteralExpression"))return Za}))}}],literalExpression:["type",el]};function nl({expression:e},t){const n=t.injector.get("functionDefinition"),i=n.getKind(e),r=n.getParameters(e),o=n.getBody(e);return zi(1,"div","function-definition",[Hi(2,rl,{kind:i}),Hi(2,ol,{parameters:r}),Hi(2,al,{expression:o})],4)}const il={FEEL:"F",Java:"J",PMML:"P"};function rl({kind:e},t){const n=t.injector.get("translate");return zi(1,"div","function-definition-kind",il[e],0,{title:n("Function kind: {kind}",{kind:e})})}function ol({parameters:e}){return zi(1,"div","function-definition-parameters",zi(1,"div",null,[Wi("("),e.reduce(((e,t)=>e.concat(Hi(2,sl,{parameter:t}),", ")),[]).slice(0,-1),Wi(")")],0),2)}function sl({parameter:e}){const{name:t,typeRef:n}=e,i=t||"<unnamed>";return zi(1,"span",null,n?`${i}: ${n}`:i,0)}function al({expression:e},t){return zi(1,"div","function-definition-body",Hi(2,t.components.getComponent("expression",{expression:e}),{expression:e}),2)}var ll={__init__:["functionDefinitionComponent"],functionDefinition:["type",class{getParameters(e){return e.get("formalParameter")}getBody(e){return e.get("body")}getKind(e){return e.get("kind")||"FEEL"}}],functionDefinitionComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("expression",(({expression:e})=>{if(yi(e,"dmn:FunctionDefinition"))return nl}))}}]};class cl extends oo{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 zi(1,"div","view-drd",zi(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,(e=>this.node=e))}}cl.$inject=["translate"];class hl{constructor(e,t,n){this._injector=n,e.onGetComponent("viewer",2e3,(()=>{if(this.canViewDrd())return cl})),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)}}hl.$inject=["components","eventBus","injector"];var ul={__init__:["viewDrd"],viewDrd:["type",hl]};function dl(e,t){const n=t.injector.get("viewer"),{name:i}=n.getRootElement();return zi(1,"div","element-properties",zi(1,"h2","element-name",i,0),2)}class pl{constructor(e){e.onGetComponent("header",(()=>dl))}}pl.$inject=["components"];var fl={__init__:["elementProperties"],elementProperties:["type",pl]};function gl(e,{injector:t}){const n=t.get("components"),i=function(e){if(yi(e,"dmn:Decision"))return e.get("decisionLogic");if(yi(e,"dmn:BusinessKnowledgeModel"))return e.get("encapsulatedLogic")}(t.get("viewer").getRootElement());return Hi(2,n.getComponent("expression",{expression:i}),{expression:i})}function ml({expression:e}){return zi(1,"div",null,zi(1,"span",null,[Wi("Expression of type "),e.$type,Wi(" is not supported.")],0,{style:"color:red;"}),2)}var yl={__init__:["elementLogic"],elementLogic:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("body",(()=>gl)),e.onGetComponent("expression",100,(()=>ml))}}]};function vl(e,t){const n=t.injector.get("elementVariable"),i=t.injector.get("translate"),r=n.getName(),o=n.getType();return zi(1,"div","element-variable",[zi(1,"h2",null,Wi("Result"),2),zi(1,"div","element-variable-name",[zi(1,"span","element-variable-name-label",i("Variable name"),0),zi(1,"span",null,r,0)],4),zi(1,"div","element-variable-type",[zi(1,"span","element-variable-type-label",i("Variable type"),0),zi(1,"span",null,o,0)],4)],4)}var wl={__init__:["elementVariableComponent"],elementVariable:["type",class{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")}}],elementVariableComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("footer",(()=>vl))}}]};let bl=class e extends Da{constructor(t={}){const n=e._createContainer();super(b(t,{renderer:{container:n}})),this._container=n}open(e){const t=this.get("eventBus");return new Promise(((n,i)=>{let r;try{this.getRootElement()&&(this.clear(),t.fire("renderer.unmount")),this._setRootElement(e),t.fire("import",e),t.fire("renderer.mount")}catch(e){r=e}r?(r.warnings=r.warnings||[],i(r)):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",{}),Ft(e))}destroy(){super.destroy(),this.detach()}getModules(){return[Ya,jo,Qa,ul,fl,yl,ll,tl,wl]}static _createContainer(){return Lt('<div class="dmn-boxed-expression-container"></div>')}};window.getSelection();var xl,kl={exports:{}};!function(){if(xl)return kl.exports;function e(e,t){return{start:e,end:void 0===t?e:t}}xl=1,kl.exports=function(t,n,i){var r=t.start,o=r,s=(i.length,n.length);i.length,n.length;var a=n.substring(r);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,r,o=0,s=0;t.length>e.length?(i=t,r=e):(i=e,r=t);for(;o<i.length;)i.charAt(o)!==r.charAt(s)?(n||(n={l_start:o,s_start:s}),o++):(n&&!n.complete&&(n.l_end=o,n.s_end=s,n.complete=!0),s++,o++);n&&!n.complete&&(n.complete=!0,n.s_end=r.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&&(o="remove"===s.type?s.newStart:s.newEnd),e(o)},kl.exports.range=e,kl.exports}();let _l=[],Sl=[];function Cl(e){if(e<768)return!1;for(let t=0,n=_l.length;;){let i=t+n>>1;if(e<_l[i])n=i;else{if(!(e>=Sl[i]))return!0;t=i+1}if(t==n)return!1}}function El(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?Sl:_l).push(n+=e[t])})();const Ml=8205;function Al(e,t,n=!0,i=!0){return(n?Dl:Rl)(e,t,i)}function Dl(e,t,n){if(t==e.length)return t;t&&Tl(e.charCodeAt(t))&&Nl(e.charCodeAt(t-1))&&t--;let i=Ol(e,t);for(t+=Pl(i);t<e.length;){let r=Ol(e,t);if(i==Ml||r==Ml||n&&Cl(r))t+=Pl(r),i=r;else{if(!El(r))break;{let n=0,i=t-2;for(;i>=0&&El(Ol(e,i));)n++,i-=2;if(n%2==0)break;t+=2}}}return t}function Rl(e,t,n){for(;t>0;){let i=Dl(e,t-2,n);if(i<t)return i;t--}return 0}function Ol(e,t){let n=e.charCodeAt(t);if(!Nl(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return Tl(i)?i-56320+(n-55296<<10)+65536:n}function Tl(e){return e>=56320&&e<57344}function Nl(e){return e>=55296&&e<56320}function Pl(e){return e<65536?1:2}class ql{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]=Hl(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),Ll.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]=Hl(this,e,t);let n=[];return this.decompose(e,t,n,0),Ll.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 jl(this),r=new jl(e);for(let e=t,o=t;;){if(i.next(e),r.next(e),e=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(o+=i.value.length,i.done||o>=n)return!0}}iter(e=1){return new jl(this,e)}iterRange(e,t=this.length){return new Vl(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 $l(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 Bl(e):Ll.from(Bl.split(e,[])):ql.empty}}class Bl extends ql{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 r=0;;r++){let o=this.text[r],s=i+o.length;if((t?n:s)>=e)return new zl(i,s,n,o);i=s+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new Bl(Fl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=Il(r.text,e.text.slice(),0,r.length);if(t.length<=32)n.push(new Bl(t,e.length+r.length));else{let e=t.length>>1;n.push(new Bl(t.slice(0,e)),new Bl(t.slice(e)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof Bl))return super.replace(e,t,n);[e,t]=Hl(this,e,t);let i=Il(this.text,Il(n.text,Fl(this.text,0,e)),t),r=this.length+n.length-(t-e);return i.length<=32?new Bl(i,r):Ll.from(Bl.split(i,[]),r)}sliceString(e,t=this.length,n="\n"){[e,t]=Hl(this,e,t);let i="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let s=this.text[o],a=r+s.length;r>e&&o&&(i+=n),e<a&&t>r&&(i+=s.slice(Math.max(0,e-r),t-r)),r=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 r of e)n.push(r),i+=r.length+1,32==n.length&&(t.push(new Bl(n,i)),n=[],i=-1);return i>-1&&t.push(new Bl(n,i)),t}}class Ll extends ql{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 r=0;;r++){let o=this.children[r],s=i+o.length,a=n+o.lines-1;if((t?a:s)>=e)return o.lineInner(e,t,n,i);i=s+1,n=a+1}}decompose(e,t,n,i){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let s=this.children[r],a=o+s.length;if(e<=a&&t>=o){let r=i&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!r?n.push(s):s.decompose(e-o,t-o,n,r)}o=a+1}}replace(e,t,n){if([e,t]=Hl(this,e,t),n.lines<this.lines)for(let i=0,r=0;i<this.children.length;i++){let o=this.children[i],s=r+o.length;if(e>=r&&t<=s){let a=o.replace(e-r,t-r,n),l=this.lines-o.lines+a.lines;if(a.lines<l>>4&&a.lines>l>>6){let r=this.children.slice();return r[i]=a,new Ll(r,this.length-(t-e)+n.length)}return super.replace(r,s,a)}r=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=Hl(this,e,t);let i="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let s=this.children[r],a=o+s.length;o>e&&r&&(i+=n),e<a&&t>o&&(i+=s.sliceString(e-o,t-o,n)),o=a+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ll))return 0;let n=0,[i,r,o,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,r+=t){if(i==o||r==s)return n;let a=this.children[i],l=e.children[r];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 Bl(n,t)}let i=Math.max(32,n>>5),r=i<<1,o=i>>1,s=[],a=0,l=-1,c=[];function h(e){let t;if(e.lines>r&&e instanceof Ll)for(let t of e.children)h(t);else e.lines>o&&(a>o||!a)?(u(),s.push(e)):e instanceof Bl&&a&&(t=c[c.length-1])instanceof Bl&&e.lines+t.lines<=32?(a+=e.lines,l+=e.length+1,c[c.length-1]=new Bl(t.text.concat(e.text),t.length+1+e.length)):(a+e.lines>i&&u(),a+=e.lines,l+=e.length+1,c.push(e))}function u(){0!=a&&(s.push(1==c.length?c[0]:Ll.from(c,l)),l=-1,a=c.length=0)}for(let t of e)h(t);return u(),1==s.length?s[0]:new Ll(s,t)}}function Il(e,t,n=0,i=1e9){for(let r=0,o=0,s=!0;o<e.length&&r<=i;o++){let a=e[o],l=r+a.length;l>=n&&(l>i&&(a=a.slice(0,i-r)),r<n&&(a=a.slice(n-r)),s?(t[t.length-1]+=a,s=!1):t.push(a)),r=l+1}return t}function Fl(e,t,n){return Il(e,[""],t,n)}ql.empty=new Bl([""],0);class jl{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 Bl?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],r=this.offsets[n],o=r>>1,s=i instanceof Bl?i.text.length:i.children.length;if(o==(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&r)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof Bl){let r=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,r.length>Math.max(0,e))return this.value=0==e?r:t>0?r.slice(e):r.slice(0,r.length-e),this;e-=r.length}else{let r=i.children[o+(t<0?-1:0)];e>r.length?(e-=r.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(t>0?1:(r instanceof Bl?r.text.length:r.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Vl{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new jl(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 $l{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&&(ql.prototype[Symbol.iterator]=function(){return this.iter()},jl.prototype[Symbol.iterator]=Vl.prototype[Symbol.iterator]=$l.prototype[Symbol.iterator]=function(){return this});class zl{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 Hl(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function Wl(e,t,n=!0,i=!0){return Al(e,t,n,i)}const Ul=/\r\n?|\n/;var Gl=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Gl||(Gl={}));class Kl{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 r=this.sections[t++],o=this.sections[t++];o<0?(e(n,i,r),i+=r):i+=o,n+=r}}iterChangedRanges(e,t=!1){Ql(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 Kl(e)}composeDesc(e){return this.empty?e:e.empty?this:ec(this,e)}mapDesc(e,t=!1){return e.empty?this:Zl(this,e,t)}mapPos(e,t=-1,n=Gl.Simple){let i=0,r=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],a=this.sections[o++],l=i+s;if(a<0){if(l>e)return r+(e-i);r+=s}else{if(n!=Gl.Simple&&l>=e&&(n==Gl.TrackDel&&i<e&&l>e||n==Gl.TrackBefore&&i<e||n==Gl.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!s)return e==i||t<0?r:r+a;r+=a}i=l}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return r}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let r=i+this.sections[n++];if(this.sections[n++]>=0&&i<=t&&r>=e)return!(i<e&&r>t)||"cover";i=r}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 Kl(e)}static create(e){return new Kl(e)}}class Xl extends Kl{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 Ql(this,((t,n,i,r,o)=>e=e.replace(i,i+(n-t),o)),!1),e}mapDesc(e,t=!1){return Zl(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,r=0;i<t.length;i+=2){let o=t[i],s=t[i+1];if(s>=0){t[i]=s,t[i+1]=o;let a=i>>1;for(;n.length<a;)n.push(ql.empty);n.push(o?e.slice(r,r+o):ql.empty)}r+=o}return new Xl(t,n)}compose(e){return this.empty?e:e.empty?this:ec(this,e,!0)}map(e,t=!1){return e.empty?this:Zl(this,e,t,!0)}iterChanges(e,t=!1){Ql(this,e,t)}get desc(){return Kl.create(this.sections)}filter(e){let t=[],n=[],i=[],r=new tc(this);e:for(let o=0,s=0;;){let a=o==e.length?1e9:e[o++];for(;s<a||s==a&&0==r.len;){if(r.done)break e;let e=Math.min(r.len,a-s);Yl(i,e,-1);let o=-1==r.ins?-1:0==r.off?r.ins:0;Yl(t,e,o),o>0&&Jl(n,t,r.text),r.forward(e),s+=e}let l=e[o++];for(;s<l;){if(r.done)break e;let e=Math.min(r.len,l-s);Yl(t,e,-1),Yl(i,e,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(e),s+=e}}return{changes:new Xl(t,n),filtered:Kl.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=[],r=[],o=0,s=null;function a(e=!1){if(!e&&!i.length)return;o<t&&Yl(i,t-o,-1);let n=new Xl(i,r);s=s?s.compose(n.map(s)):n,i=[],r=[],o=0}return function e(l){if(Array.isArray(l))for(let t of l)e(t);else if(l instanceof Xl){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 h=c?"string"==typeof c?ql.of(c.split(n||Ul)):c:ql.empty,u=h.length;if(e==s&&0==u)return;e<o&&a(),e>o&&Yl(i,e-o,-1),Yl(i,s-e,u),Jl(r,i,h),o=s}}(e),a(!s),s}static empty(e){return new Xl(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 r=e[i];if("number"==typeof r)t.push(r,-1);else{if(!Array.isArray(r)||"number"!=typeof r[0]||r.some(((e,t)=>t&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)t.push(r[0],0);else{for(;n.length<i;)n.push(ql.empty);n[i]=ql.of(r.slice(1)),t.push(r[0],n[i].length)}}}return new Xl(t,n)}static createSet(e,t){return new Xl(e,t)}}function Yl(e,t,n,i=!1){if(0==t&&n<=0)return;let r=e.length-2;r>=0&&n<=0&&n==e[r+1]?e[r]+=t:r>=0&&0==t&&0==e[r]?e[r+1]+=n:i?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function Jl(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(ql.empty);e.push(n)}}function Ql(e,t,n){let i=e.inserted;for(let r=0,o=0,s=0;s<e.sections.length;){let a=e.sections[s++],l=e.sections[s++];if(l<0)r+=a,o+=a;else{let c=r,h=o,u=ql.empty;for(;c+=a,h+=l,l&&i&&(u=u.append(i[s-2>>1])),!(n||s==e.sections.length||e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(r,c,o,h,u),r=c,o=h}}}function Zl(e,t,n,i=!1){let r=[],o=i?[]:null,s=new tc(e),a=new tc(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);Yl(r,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(Yl( function [all...]
16 */function ys(e){this._container=this._createContainer(),uo(this._container),this._init(this._container,e)}function ws(e,t){return{x:e.x-t.x,y:e.y-t.y}}function bs(e){return Math.log(e)/Math.log(10)}function xs(e,t){var n=bs(e.min),i=bs(e.max);return(Math.abs(n)+Math.abs(i))/t}Yt(ys,wi),ys.prototype.saveSVG=zt((function(e){var t=this;return new Promise((function(e){var n=t.get("canvas"),i=n.getActiveLayer(),r=Vt("defs",n._svg),o=Tn(i),s=r&&r.outerHTML||"",a=i.getBBox();e({svg:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- created with dmn-js / http://bpmn.io --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+a.width+'" height="'+a.height+'" viewBox="'+a.x+" "+a.y+" "+a.width+" "+a.height+'" version="1.1">'+s+o+"</svg>"})}))})),ys.prototype.getModules=function(){return this._modules},ys.prototype.destroy=function(){wi.prototype.destroy.call(this),$t(this._container)},ys.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},ys.prototype.off=function(e,t){this.get("eventBus").off(e,t)},ys.prototype._init=function(e,t){var{additionalModules:n,canvas:i,...r}=t,o={...r,canvas:{...i,container:e},modules:[...[{drd:["value",this]}],...t.modules||this.getModules(),...n||[]]};wi.call(this,o),t&&t.container&&this.attachTo(t.container)},ys.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},ys.prototype._createContainer=function(){return Ft('<div class="dmn-drd-container"></div>')},ys.prototype.open=function(e){var t=this;return new Promise(((n,i)=>{var r;try{return t._definitions&&t.clear(),t._definitions=e,function(e,t,n){var i,r=e.get("drdImporter"),o=e.get("eventBus"),s=[];o.fire("import.start",{definitions:t});try{!function(e){new ki({root:function(e){return r.root(e)},element:function(e,t){return r.add(e,t)},error:function(e,t){s.push({message:e,context:t})}}).handleDefinitions(e)}(t)}catch(e){i=e}o.fire("import.done",{error:i,warnings:s}),n(i,s)}(t,e,(function(e,t){e?(e.warnings=t||[],i(e)):n({warnings:t||[]})}))}catch(e){r=e}r?(r.warnings=r.warnings||[],i(r)):n({warnings:[]})}))},ys.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach();var t=this._container;e.appendChild(t),this._emit("attach",{}),this.get("canvas").resized()},ys.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},ys.prototype._modules=[$o,zo,rs,us,fs,vs];var _s=Math.sign||function(e){return e>=0?1:-1},Ss={min:.2,max:4};function ks(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=x(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||.75;var i=this;t.on("canvas.init",(function(t){i._init(!1!==e.enabled)}))}ks.$inject=["config.zoomScroll","eventBus","canvas"],ks.prototype.scroll=function(e){this._canvas.scroll(e)},ks.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ks.prototype.zoom=function(e,t){var n=xs(Ss,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},ks.prototype._handleWheel=function(e){if(!Mt(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey||/mac/i.test(navigator.platform)&&e.metaKey,r=e.shiftKey,o=-1*this._scale;if(o*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){var s=t.getBoundingClientRect(),a={x:e.clientX-s.left,y:e.clientY-s.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*_s(e.deltaY)*o,this.zoom(n,a)}else n=r?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},ks.prototype.stepZoom=function(e,t){var n=xs(Ss,10);this._zoom(e,t,n)},ks.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=bs(i.zoom()),s=Math.round(o/n)*n;s+=n*r;var a,l,c=Math.pow(10,s);i.zoom((a=Ss,l=c,Math.max(a.min,Math.min(a.max,l))),t)},ks.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&Nt[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},ks.prototype._init=function(e){this.toggle(e)};var Cs={__init__:["zoomScroll"],zoomScroll:["type",ks]},Es=/^djs-cursor-.*$/;function Ms(e){var t=kt(document.body);t.removeMatching(Es),e&&t.add("djs-cursor-"+e)}var As=5e3;function Rs(e,t){var n;function i(i){var r,o=n.start,s=n.button,a=Wo(i),l=ws(a,o);(!n.dragging&&(r=l,Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))>15)&&(n.dragging=!0,0===s&&function(e,t){function n(){return!1}t=t||"element.click",e.once(t,As,n)}(e),Ms("grab")),n.dragging)&&(l=ws(a,n.last||n.start),t.scroll({dx:l.x,dy:l.y}),n.last=a);i.preventDefault()}function r(e){Nt.unbind(document,"mousemove",i),Nt.unbind(document,"mouseup",r),n=null,Ms(null)}e.on("element.mousedown",500,(function(e){return function(e){if(Mt(e.target,".djs-draggable"))return;var t=e.button;if(t>=2||e.ctrlKey||e.shiftKey||e.altKey)return;return n={button:t,start:Wo(e)},Nt.bind(document,"mousemove",i),Nt.bind(document,"mouseup",r),!0}(e.originalEvent)})),this.isActive=function(){return!!n}}Rs.$inject=["eventBus","canvas"];var Ts={__init__:["moveCanvas"],moveCanvas:["type",Rs]},Ds={"&":"&","<":"<",">":">",'"':""","'":"'"};function Os(e,t){return-1!==(e=i(e)?e:[e]).indexOf(t.key)||-1!==e.indexOf(t.code)}function Ns(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=Vt(Ns.INPUT_SELECTOR,this._container),this._resultsContainer=Vt(Ns.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}function Ps(e,t,n){var i=function(e){var t="";return e.forEach((function(e){var n,i=(n=""+(n=e.value||e.matched||e.normal))&&n.replace(/[&<>"']/g,(function(e){return Ds[e]})),r=e.match||e.matched;t+=r?'<b class="'+Ns.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":i})),""!==t?t:null}(t),r=Ft(n);r.innerHTML=i,e.appendChild(r)}Ns.$inject=["canvas","eventBus","selection","translate"],Ns.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:Bt.bind(t,n,i,r)})}t(document,"html","click",(function(t){e.close(!1)})),t(this._container,Ns.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,Ns.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,Ns.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,Ns.INPUT_SELECTOR,"keydown",(function(e){Os("ArrowUp",e)&&e.preventDefault(),Os("ArrowDown",e)&&e.preventDefault()})),t(this._container,Ns.INPUT_SELECTOR,"keyup",(function(t){if(Os("Escape",t))return e.close();if(Os("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close(!1)}return Os("ArrowUp",t)?e._scrollToDirection(!0):Os("ArrowDown",t)?e._scrollToDirection():void(Os(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},Ns.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){Bt.unbind(e.el,e.type,e.listener)}))},Ns.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if((n=n.filter((function(e){return!t._canvas.getRootElements().includes(e.element)}))).length){n.forEach((function(e){var n=e.element.id,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}}));var i=Vt(Ns.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}else this._selection.select(null)}},Ns.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ns.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},Ns.prototype._clearResults=function(){Et(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ns.prototype._getCurrentResult=function(){return Vt(Ns.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ns.prototype._createResultNode=function(e,t){var n=Ft(Ns.RESULT_HTML);return e.primaryTokens.length>0&&Ps(n,e.primaryTokens,Ns.RESULT_PRIMARY_HTML),Ps(n,e.secondaryTokens,Ns.RESULT_SECONDARY_HTML),_t(n,Ns.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ns.prototype.registerProvider=function(e){this._searchProvider=e},Ns.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,kt(this._canvas.getContainer()).add("djs-search-open"),kt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ns.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,kt(this._canvas.getContainer()).remove("djs-search-open"),kt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ns.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ns.prototype.isOpen=function(){return this._open},Ns.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&kt(t).remove(Ns.RESULT_SELECTED_CLASS);var n=_t(e,Ns.RESULT_ID_ATTRIBUTE),i=this._results[n].element;kt(e).add(Ns.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:300}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ns.prototype._select=function(e){var t=_t(e,Ns.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:300}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ns.prototype._getBoxHtml=function(){const e=Ft(Ns.BOX_HTML),t=Vt(Ns.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e},Ns.CONTAINER_SELECTOR=".djs-search-container",Ns.INPUT_SELECTOR=".djs-search-input input",Ns.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ns.RESULT_SELECTOR=".djs-search-result",Ns.RESULT_SELECTED_CLASS="djs-search-result-selected",Ns.RESULT_SELECTED_SELECTOR="."+Ns.RESULT_SELECTED_CLASS,Ns.RESULT_ID_ATTRIBUTE="data-result-id",Ns.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ns.BOX_HTML='<div class="djs-search-container djs-scrollable">\n <div class="djs-search-input">\n <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>\n </svg>\n <input type="text" spellcheck="false" />\n </div>\n <div class="djs-search-results" />\n</div>',Ns.RESULT_HTML='<div class="djs-search-result"></div>',Ns.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ns.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var qs={__depends__:[zo,us,rs],searchPad:["type",Ns]};function Bs(e){var t=e.businessObject,n=function(e){return bi(e,"dmn:Decision")||bi(e,"dmn:BusinessKnowledgeModel")||bi(e,"dmn:InputData")||bi(e,"dmn:KnowledgeSource")?"name":bi(e,"dmn:TextAnnotation")?"text":void 0}(t);if(n)return t[n]||""}function Ls(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function Is(e){return h(e,(function(e){return!!e.matched})).length>0}function js(e,t){const n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();const r=e.indexOf(t);return r>-1?(0!==r&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r<e.length&&n.push({normal:i.substr(t.length+r,e.length)})):n.push({normal:i}),n}Ls.$inject=["elementRegistry","searchPad","canvas"],Ls.prototype.find=function(e){const t=this._canvas.getRootElement();let n=this._elementRegistry.filter((function(e){return!e.labelTarget}));return n=h(n,(function(e){return e!==t})),n=f(n,(function(t){return{primaryTokens:js(Bs(t),e),secondaryTokens:js(t.id,e),element:t}})),n=h(n,(function(e){return Is(e.primaryTokens)||Is(e.secondaryTokens)})),n=g(n,(function(e){return Bs(e.element)+e.element.id})),n};var Fs={__depends__:[qs],__init__:["dmnSearch"],dmnSearch:["type",Ls]};function Vs(e){ys.call(this,e)}Yt(Vs,ys),Vs.prototype._navigationModules=[Cs,Ts,Fs],Vs.prototype._modules=[].concat(Vs.prototype._modules,Vs.prototype._navigationModules);class $s{constructor(e){_(this,e),Hs(this,"businessObject",{writable:!0})}}const zs={root:class extends $s{constructor(e){super(e),Hs(this,"rows",{enumerable:!0,value:this.rows||[]}),Hs(this,"cols",{enumerable:!0,value:this.cols||[]})}},row:class extends $s{constructor(e){super(e),Hs(this,"root",{writable:!0}),Hs(this,"cells",{enumerable:!0,value:this.cells||[]})}},col:class extends $s{constructor(e){super(e),Hs(this,"root",{writable:!0}),Hs(this,"cells",{enumerable:!0,value:this.cells||[]})}},cell:class extends $s{constructor(e){super(e),Hs(this,"row",{writable:!0}),Hs(this,"col",{writable:!0})}}};function Hs(e,t,n){Object.defineProperty(e,t,n)}let Ws=class{constructor(e){this._eventBus=e,this._elements={},e.on("table.clear",this.clear.bind(this))}add(e,t){const{id:n}=e;this._elements[n]=e}remove(e){const t=e.id||e;delete this._elements[t]}get(e){return this._elements[e]}getAll(){return Us(this._elements)}forEach(e){Us(this._elements).forEach((t=>e(t)))}filter(e){return Us(this._elements).filter((t=>e(t)))}clear(){this._elements={}}updateId(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t}),this.remove(e),e.id=t,this.add(e)}_validateId(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")}};function Us(e){return Object.keys(e).map((function(t){return e[t]}))}Ws.$inject=["eventBus"];let Gs=class{constructor(e){this._listeners={},e.on("elements.changed",(({elements:e})=>{this.elementsChanged(e)})),e.on("root.remove",(t=>{const n=t.root.id;this._listeners[n]&&e.once("root.add",(e=>{const t=e.root.id;this.updateId(n,t)}))})),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 r=this._listeners[n]&&this._listeners[n].length;if(r)for(let e=0;e<r;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])}};Gs.$inject=["eventBus"];class Ks extends lo{constructor(e){super(e);const t=this._injector=e.injector;this._sheet=t.get("sheet"),this._changeSupport=t.get("changeSupport"),this._components=t.get("components"),this._eventBus=t.get("eventBus");const n=t.get("throttle");this.onElementsChanged=this.onElementsChanged.bind(this),this.onScroll=n(this.onScroll.bind(this))}onElementsChanged(){this.forceUpdate()}onScroll(){this._eventBus.fire("sheet.scroll")}getChildContext(){return{changeSupport:this._changeSupport,components:this._components,injector:this._injector}}componentWillMount(){const{id:e}=this._sheet.getRoot();this._changeSupport.onElementsChanged(e,this.onElementsChanged)}componentWillUnmount(){const{id:e}=this._sheet.getRoot();this._changeSupport.offElementsChanged(e,this.onElementsChanged)}render(){const{rows:e,cols:t}=this._sheet.getRoot(),n=this._components.getComponents("table.before"),i=this._components.getComponents("table.after"),r=this._components.getComponent("table.head"),o=this._components.getComponent("table.body"),s=this._components.getComponent("table.foot");return Ui(1,"div","tjs-container",[n&&n.map(((e,t)=>Gi(2,e,null,t))),Ui(1,"div","tjs-table-container",Ui(1,"table","tjs-table",[r&&Gi(2,r,{rows:e,cols:t}),o&&Gi(2,o,{rows:e,cols:t}),s&&Gi(2,s,{rows:e,cols:t})],0),2,{onScroll:this.onScroll}),i&&i.map(((e,t)=>Gi(2,e,null,t)))],0)}}let Xs=class{constructor(e,t,n,i,r){const{container:o}=n;this._container=o,i.on("root.added",(()=>{io(Gi(2,Ks,{injector:r}),o)})),i.on("root.remove",(()=>{io(null,o)}))}getContainer(){return this._container}};Xs.$inject=["changeSupport","components","config.renderer","eventBus","injector"];var Ys={__init__:["changeSupport","components","renderer"],changeSupport:["type",Gs],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],i=[];if(!n)return i;for(let e=0;e<n.length;e++){const r=n[e].callback(t);r&&i.push(r)}return i.length,i}onGetComponent(e,t,n){if(s(t)&&(n=t,t=1e3),!o(t))throw new Error("priority must be a number");const i=this._getListeners(e);let r,a;const l={priority:t,callback:n};for(a=0;r=i[a];a++)if(r.priority<t)return void i.splice(a,0,l);i.push(l)}offGetComponent(e,t){const n=this._getListeners(e);let i,r,o;if(t)for(o=n.length-1;i=n[o];o--)r=i.callback,r===t&&n.splice(o,1);else n.length=0}_getListeners(e){let t=this._listeners[e];return t||(this._listeners[e]=t=[]),t}}],renderer:["type",Xs]};class Js{constructor(e,t){this._elementRegistry=e,this._eventBus=t,this._root=null,t.on("table.clear",(()=>{this.setRoot(null)}))}setRoot(e){if(this._root){const e=this._root;this._eventBus.fire("root.remove",{root:e}),this._root=null,this._eventBus.fire("root.removed",{root:e})}e&&this._eventBus.fire("root.add",{root:e}),this._root=e,e&&this._eventBus.fire("root.added",{root:e})}getRoot(){return this._root||this.setRoot({id:"__implicitroot",rows:[],cols:[]}),this._root}addRow(e,t){const n=this.getRoot();if(n.cols.length!=e.cells.length)throw new Error("number of cells is not equal to number of cols");return void 0===t&&(t=n.rows.length),Qs(t,n.rows,e),e.root=n,this._elementRegistry.add(e),e.cells.forEach(((i,r)=>{this._elementRegistry.add(i),i.row=e,i.col=n.cols[r],Qs(t,n.cols[r].cells,i)})),this._eventBus.fire("row.add",{row:e}),e}removeRow(e){const t=this.getRoot();"string"==typeof e&&(e=this._elementRegistry.get(e));const n=t.rows.indexOf(e);-1!==n&&(Zs(n,t.rows),e.root=void 0,this._elementRegistry.remove(e),e.cells.forEach(((e,i)=>{this._elementRegistry.remove(e),e.col=void 0,Zs(n,t.cols[i].cells)})),this._eventBus.fire("row.remove",{row:e}))}addCol(e,t){const n=this.getRoot();if(this._elementRegistry.add(e),n.rows.length!=e.cells.length)throw new Error("number of cells is not equal to number of rows");return void 0===t&&(t=n.cols.length),Qs(t,n.cols,e),e.root=n,e.cells.forEach(((i,r)=>{this._elementRegistry.add(i),i.col=e,i.row=n.rows[r],Qs(t,n.rows[r].cells,i)})),this._eventBus.fire("col.add",{col:e}),e}removeCol(e){const t=this.getRoot();"string"==typeof e&&(e=this._elementRegistry.get(e));const n=t.cols.indexOf(e);-1!==n&&(Zs(n,t.cols),e.root=void 0,this._elementRegistry.remove(e),e.cells.forEach(((e,i)=>{this._elementRegistry.remove(e),e.row=void 0,Zs(n,t.rows[i].cells)})),this._eventBus.fire("col.remove",{col:e}))}resized(){this._eventBus.fire("sheet.resized")}}function Qs(e,t,n){return t.splice(e,0,n)}function Zs(e,t){return t.splice(e,1)}function ea(e=!0){const t="number"==typeof e?e:e?300:0;return t?e=>function(e,t){let n=!1;return function(...i){n||(e(...i),n=!0,setTimeout((()=>{n=!1}),t))}}(e,t):e=>e}Js.$inject=["elementRegistry","eventBus"],ea.$inject=["config.throttle"];var ta={__depends__:[Ys],__init__:["elementFactory","sheet"],elementFactory:["type",class{constructor(){this._uid=12}create(e,t={}){return t.id||(t.id=e+"_"+this._uid++),function(e,t){const n=zs[e];if(!n)throw new Error("unknown type "+e);return new n(t)}(e,t)}createRoot(e){return this.create("root",e)}createRow(e){return this.create("row",e)}createCol(e){return this.create("col",e)}createCell(e){return this.create("cell",e)}}],elementRegistry:["type",Ws],eventBus:["type",C],sheet:["type",Js],throttle:["factory",ea]};class na{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]},ta].concat(t||[]),i=new sn(n);return i.init(),i}(i,n)}this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("table.init"),this.get("eventBus").fire("diagram.init")}_init(e){let{modules:t,...n}=e;return{modules:t,config:n}}destroy(){const e=this.get("eventBus");e.fire("table.destroy"),e.fire("diagram.destroy")}clear(){const e=this.get("eventBus");e.fire("table.clear"),e.fire("diagram.clear")}}function ia(e){if(!e)return"<null>";const t=e.id?` id="${e.id}"`:"";return`<${e.$type}${t} />`}function ra(e,t){function n(t,n,i){if(t.gfx)throw new Error(`already rendered ${ia(t)}`);return e.element(t,n,i)}function i(e,t,i){u(e,(function(e){n(e,t,i)}))}function r(e,t,i){u(e,(function(e){n(e,t,i)}))}return{handleDecision:function(t){t.id||(t.id="decision");const o=t.decisionLogic;if(!o)throw new Error(`no table for ${ia(t)}`);{if(!o.output)throw new Error(`missing output for ${ia(o)}`);const t=(c=o,e.table(c));o.input&&i(o.input,t,o),i(o.output,t,o),s=o.rule,a=t,l=o,u(s,(function(e){n(e,a,l),r(e.inputEntry,e),r(e.outputEntry,e)}))}var s,a,l,c}}}function oa(e,t){const{elements:n,index:i}=e;return i[t]?e:{elements:[...n,t],index:{...i,[t]:!0}}}function sa(...e){let t={elements:[],index:{}};return e.forEach((function(e){const n=typeof e;"string"===n&&e.length>0?t=oa(t,e):"object"===n&&null!==e&&Object.keys(e).forEach((function(n){e[n]&&(t=oa(t,n))}))})),function(e,t){return e.elements.join(t)}(t," ")}function aa(e){return la(e.constructor,e)}function la(e,t){const n=e.$inject;if(!n)return;const{injector:i}=t.context,r=[...n,function(...e){for(const i in e){const r=n[i],o=e[i];t[r]=o}}];i.invoke(r)}function ca(e,t){Object.keys(t).forEach((function(n){if("$inject"===n||"__init"===n)return;const i=t[n];"constructor"===n&&i.call(e,e.props,e.context);const r=e[n];if(void 0!==r){if("function"!=typeof r)throw new Error(`failed to mixin <${n}>: cannot combine with non-fn component value`);e[n]=function(e,...t){return function(...n){let i;return t.forEach((function(t){if(i=t.call(e,...n),void 0!==i)return!1})),i}.bind(e)}(e,r,i)}else e[n]=i.bind(e)})),"$inject"in t&&la(t,e),"__init"in t&&t.__init.call(e,e.props,e.context)}const ha={getSelectionClasses(){const{selected:e,selectedSecondary:t,focussed:n}=this.state;return sa({selected:e,"selected-secondary":t,focussed:n})},selectionChanged(e){this.setState(e)},componentWillUpdate(e){e.elementId!==this.props.elementId&&this.updateSelectionSubscription(!1)},componentDidUpdate(e){e.elementId!==this.props.elementId&&this.updateSelectionSubscription(!0)},componentDidMount(){this.updateSelectionSubscription(!0)},componentWillUnmount(){this.updateSelectionSubscription(!1)},updateSelectionSubscription(e){const{elementId:t}=this.props;t&&t&&this.eventBus[e?"on":"off"](`selection.${t}.changed`,this.selectionChanged)},$inject:["eventBus"]};class ua extends lo{constructor(e,t){super(e,t),ca(this,ha),aa(this)}getRenderProps(...e){const{className:t,elementId:n,coords:i,...r}=this.props,o={className:sa(...e,this.getSelectionClasses(),t)};return n&&(o["data-element-id"]=n),i&&(o["data-coords"]=i),{...o,...r}}}class da extends ua{constructor(e,t){super(e,t),this.state={}}render(){const{children:e}=this.props;return Xi(Ui(1,"td",null,e,0,{...this.getRenderProps("cell")}))}}const pa={slotFill(e,t){const{type:n,context:i,...r}=e,o=this.components.getComponent(n,i)||t;return o?Xi(Gi(2,o,{...i,...r})):null},slotFills(e){const{type:t,context:n,...i}=e;return this.components.getComponents(t,n).map((e=>Xi(Gi(2,e,{...n,...i}))))},$inject:["components"]};class fa extends lo{constructor(e,t){super(e,t),ca(this,pa),aa(this)}componentDidMount(){this.changeSupport.onElementsChanged(this.getRoot(),this.onElementsChanged)}componentWillUnmount(){this.changeSupport.offElementsChanged(this.getRoot(),this.onElementsChanged)}onElementsChanged=()=>{this.forceUpdate()};getRoot(){return this.sheet.getRoot()}render(){const e=(this.getRoot().businessObject.get("annotationsWidth")||400)+"px";return Ui(1,"th","annotation header",[this.slotFills({type:"cell-inner",context:{cellType:"annotations",col:this.sheet.getRoot(),minWidth:400}}),this.translate("Annotations")],0,{style:{width:e}})}}function ga(e){const{row:t}=e,{id:n,description:i}=t.businessObject;return Gi(2,da,{className:"annotation",elementId:n,children:i||"-"})}function ma(e){e.onGetComponent("cell",(({cellType:e})=>"after-label-cells"===e?fa:"after-rule-cells"===e?ga:void 0))}fa.$inject=["changeSupport","sheet","translate"],ma.$inject=["components"];var va={__init__:["annotationsProvider"],annotationsProvider:["type",ma]};function ya(e,t){return _({id:e.id,type:e.$type,businessObject:e},t)}class wa{constructor(e,t,n){this._elementFactory=e,this._eventBus=t,this._sheet=n}add(e){let t;if(bi(e,"dmn:DecisionTable"))t=this._elementFactory.createRoot(ya(e)),this._sheet.setRoot(t);else if(bi(e,"dmn:InputClause"))t=this._elementFactory.createCol(ya(e)),this._sheet.addCol(t);else if(bi(e,"dmn:OutputClause"))t=this._elementFactory.createCol(ya(e)),this._sheet.addCol(t);else if(bi(e,"dmn:DecisionRule")){e.inputEntry||(e.inputEntry=[]),e.outputEntry||(e.outputEntry=[]);const n=[...e.inputEntry,...e.outputEntry].map((e=>this._elementFactory.createCell(ya(e))));t=this._elementFactory.createRow(_(ya(e),{cells:n})),this._sheet.addRow(t)}return this._eventBus.fire("dmnElement.added",{element:t}),t}}wa.$inject=["elementFactory","eventBus","sheet"];var ba={__depends__:[{__depends__:[zo],tableImporter:["type",wa]},Ys]};class xa extends lo{constructor(e,t){super(e,t),ca(this,pa),this._sheet=t.injector.get("sheet"),this._changeSupport=t.changeSupport}onElementsChanged=()=>{this.forceUpdate()};componentWillMount(){const e=this._sheet.getRoot();this._changeSupport.onElementsChanged(e.id,this.onElementsChanged)}componentWillUnmount(){const e=this._sheet.getRoot();this._changeSupport.offElementsChanged(e.id,this.onElementsChanged)}render(){const e=this._sheet.getRoot();if(!bi(e,"dmn:DMNElement"))return null;const t=xi(e),n=t.input,i=t.output;return Ui(1,"thead",null,Ui(1,"tr",null,[Ui(1,"th","index-column"),this.slotFills({type:"cell",context:{cellType:"before-label-cells"}}),n&&n.map(((e,t)=>{const i=e.width||"192px";return this.slotFill({type:"cell",context:{cellType:"input-header",input:e,index:t,inputsLength:n.length,width:i},key:e.id},_a)})),i.map(((e,t)=>this.slotFill({type:"cell",context:{cellType:"output-header",output:e,index:t,outputsLength:i.length},key:e.id},Sa))),this.slotFills({type:"cell",context:{cellType:"after-label-cells"}})],0),2)}}function _a(e,t){const{input:n,className:i,index:r}=e,{label:o,inputExpression:s,inputValues:a}=n,l=t.injector.get("translate");return Ui(1,"th",(i||"")+" input-cell",[Ui(1,"div","clause",l(0===r?"When":"And"),0),o?Ui(1,"div","input-label",o,0,{title:l("Input label: ")+o}):Ui(1,"div","input-expression",s.text,0,{title:l("Input expression: ")+s.text}),Ui(1,"div","input-variable",a&&a.text||s.typeRef,0,{title:a&&a.text?l("Input values"):l("Input type")})],0,{"data-col-id":n.id},n.id)}function Sa(e,t){const{output:n,className:i,index:r}=e,{label:o,name:s,outputValues:a,typeRef:l}=n,c=t.injector.get("translate");return Ui(1,"th",(i||"")+" output-cell",[Ui(1,"div","clause",c(0===r?"Then":"And"),0),o?Ui(1,"div","output-label",o,0,{title:c("Output label")}):Ui(1,"div","output-name",s,0,{title:c("Output name")}),Ui(1,"div","output-variable",a&&a.text||l,0,{title:a&&a.text?c("Output values"):c("Output type")})],0,null,n.id)}function ka(e){e.onGetComponent("table.head",(()=>xa))}ka.$inject=["components"];var Ca={__init__:["decisionTableHeadProvider"],decisionTableHeadProvider:["type",ka]};class Ea extends lo{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),aa(this)}render(){const e=this.sheet.getRoot();if(!bi(e,"dmn:DMNElement"))return null;const{name:t}=e.businessObject.$parent,n=this.components.getComponent("hit-policy")||Ma;return Ui(1,"div","decision-table-properties",[Ui(1,"div","decision-table-name",t,0,{title:this._translate("Decision name: ")+t}),Ui(1,"div","decision-table-header-separator"),Gi(2,n)],4)}}function Ma(){return null}Ea.$inject=["sheet","components"];class Aa{constructor(e){e.onGetComponent("table.before",500,(()=>Ea))}}Aa.$inject=["components"];var Ra={__init__:["decisionTableProperties"],decisionTableProperties:["type",Aa]};class Ta extends lo{render(){const{row:e,rowIndex:t}=this.props,{components:n}=this.context,i=n.getComponents("cell-inner",{cellType:"rule-index",row:e,rowIndex:t});return Ui(1,"td","rule-index",[i&&i.map((n=>Gi(2,n,{row:e,rowIndex:t}))),t+1],0,{"data-element-id":e.id,"data-row-id":e.id})}}class Da{constructor(e){e.onGetComponent("cell",(({cellType:e})=>{if("before-rule-cells"===e)return Ta}))}}Da.$inject=["components"];var Oa={__init__:["decisionRuleIndices"],decisionRuleIndices:["type",Da]};const Na=[{label:"FEEL",value:"feel"}];class Pa{constructor(e){this._injector=e;const t=e.get("config.expressionLanguages")||{};this._config={options:Na,defaults:{editor:"feel"}},t.options&&(this._config.options=t.options);const n=this._getLegacyDefaults();_(this._config.defaults,n,t.defaults)}getDefault(e){const{defaults:t}=this._config,n=t[e]||t.editor;return this._getLanguageByValue(n)||this.getAll()[0]}getLabel(e){const t=this._getLanguageByValue(e);return t?t.label:e}getAll(){return this._config.options}_getLegacyDefaults(){const e={},t=this._injector,n=t.get("config.defaultInputExpressionLanguage"),i=t.get("config.defaultOutputExpressionLanguage");return n&&(e.inputCell=n),i&&(e.outputCell=i),e}_getLanguageByValue(e){return c(this.getAll(),(t=>e===t.value))}}Pa.$inject=["injector"];var qa={__init__:["expressionLanguages"],expressionLanguages:["type",Pa]};class Ba extends lo{render({rows:e,cols:t}){const{components:n}=this.context;return Ui(1,"tbody",null,e.map(((e,i)=>{const r=n.getComponent("row",{rowType:"rule"});return r&&Gi(2,r,{row:e,rowIndex:i,cols:t},e.id)})),0)}}class La extends lo{constructor(e,t){super(e,t),ca(this,pa)}render(){const{row:e,rowIndex:t,cols:n}=this.props,{cells:i}=e;return Ui(1,"tr",null,[this.slotFills({type:"cell",context:{cellType:"before-rule-cells",row:e,rowIndex:t}}),i.map(((i,r)=>this.slotFill({type:"cell",context:{cellType:"rule",cell:i,rowIndex:t,colIndex:r},key:i.id,row:e,col:n[r]}))),this.slotFills({type:"cell",context:{cellType:"after-rule-cells",row:e,rowIndex:t}})],0)}}class Ia extends lo{render(){const{cell:e,row:t,col:n}=this.props;return bi(e,"dmn:UnaryTests")?Gi(2,da,{className:"input-cell",elementId:e.id,"data-row-id":t.id,"data-col-id":n.id,children:e.businessObject.text}):Gi(2,da,{className:"output-cell",elementId:e.id,"data-row-id":t.id,"data-col-id":n.id,children:e.businessObject.text})}}class ja{constructor(e){e.onGetComponent("table.body",(()=>Ba)),e.onGetComponent("row",(({rowType:e})=>{if("rule"===e)return La})),e.onGetComponent("cell",(({cellType:e})=>{if("rule"===e)return Ia}))}}ja.$inject=["components"];var Fa={__depends__:[qa],__init__:["decisionRules"],decisionRules:["type",ja]};const Va=[{label:"Unique",value:{hitPolicy:"UNIQUE",aggregation:void 0},explanation:"No overlap is possible and all rules are disjoint. Only a single rule can be matched"},{label:"First",value:{hitPolicy:"FIRST",aggregation:void 0},explanation:"Rules may overlap. The first matching rule will be chosen"},{label:"Priority",value:{hitPolicy:"PRIORITY",aggregation:void 0},explanation:"Rules may overlap. The one with the highest priority will be chosen"},{label:"Any",value:{hitPolicy:"ANY",aggregation:void 0},explanation:"Rules may overlap. Their output have to match"},{label:"Collect",value:{hitPolicy:"COLLECT",aggregation:void 0},explanation:"Collects the values of all matching rules"},{label:"Collect (Sum)",value:{hitPolicy:"COLLECT",aggregation:"SUM"},explanation:"Collects the values of all matching rules and sums up to a single value"},{label:"Collect (Min)",value:{hitPolicy:"COLLECT",aggregation:"MIN"},explanation:"Collects the values of all matching rules and uses the lowest value"},{label:"Collect (Max)",value:{hitPolicy:"COLLECT",aggregation:"MAX"},explanation:"Collects the values of all matching rules and uses the highest value"},{label:"Collect (Count)",value:{hitPolicy:"COLLECT",aggregation:"COUNT"},explanation:"Collects the values of all matching rules and counts the number of them"},{label:"Rule order",value:{hitPolicy:"RULE ORDER",aggregation:void 0},explanation:"Collects the values of all matching rules in rule order"},{label:"Output order",value:{hitPolicy:"OUTPUT ORDER",aggregation:void 0},explanation:"Collects the values of all matching rules in decreasing output priority order"}];class $a extends lo{constructor(e,t){super(e,t),this._translate=t.injector.get("translate"),aa(this)}getRoot(){return this.sheet.getRoot()}render(){const e=this.getRoot().businessObject,{aggregation:t,hitPolicy:n}=e,i=c(Va,(e=>{return i=e.value,r={aggregation:t,hitPolicy:n},i.hitPolicy===r.hitPolicy&&i.aggregation===r.aggregation;var i,r}));return Ui(1,"div","hit-policy header",[Ui(1,"label","dms-label",this._translate("Hit policy:"),0),Ui(1,"span","hit-policy-value",this._translate(i.label),0)],4,{title:this._translate(i.explanation)})}}function za(e){e.onGetComponent("hit-policy",(()=>$a))}$a.$inject=["sheet"],za.$inject=["components"];var Ha={__init__:["hitPolicyProvider"],hitPolicyProvider:["type",za]};let Wa=class extends lo{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 Ui(1,"div","view-drd",Ui(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,(e=>this.node=e))}},Ua=class{constructor(e,t,n,i){this._injector=n,this._sheet=i,e.onGetComponent("table.before",(()=>{if(this.canViewDrd())return Wa})),t.on("showDrd",(()=>{const e=n.get("_parent",!1),t=Ga(i.getRoot());if(!t)return;const r=e.getView(t);e.open(r)}))}canViewDrd(){const e=this._injector.get("_parent",!1);if(!e)return!1;const t=Ga(this._sheet.getRoot());return!!e.getView(t)}};function Ga(e){const{businessObject:t}=e;if(!t)return;return t.$parent.$parent}Ua.$inject=["components","eventBus","injector","sheet"];var Ka={__init__:["viewDrd"],viewDrd:["type",Ua]};let Xa=class{constructor(e){e.onGetComponent("table.before",(()=>po))}};Xa.$inject=["components"];var Ya={__init__:["poweredBy"],poweredBy:["type",Xa]};let Ja=class e extends na{constructor(t={}){const n=e._createContainer();super(_(t,{renderer:{container:n}})),this._container=n}open(e){var t=this;return new Promise(((n,i)=>{var r;try{return t._decision&&t.clear(),t._decision=e,function(e,t,n){const i=e.get("tableImporter"),r=e.get("eventBus"),o=e.get("sheet");e.get("modeling",!1);let s,a=[];r.fire("import.render.start",{decision:t});try{!function(e){new ra({create:(e,t,n,r)=>i.create(e,t,n,r),table:e=>i.add(e),element:(e,t,n)=>i.add(e,t,n),error(e,t){a.push({message:e,context:t})}}).handleDecision(e)}(t)}catch(e){s=e}r.fire("import.render.complete",{error:s,warnings:a}),r.fire("elements.changed",{elements:[o.getRoot()]}),n(s,a)}(t,e,(function(e,t){e?(e.warnings=t||[],i(e)):n({warnings:t||[]})}))}catch(e){r=e}r?(r.warnings=r.warnings||[],i(r)):n({warnings:[]})}))}_init(e){let{modules:t,additionalModules:n,...i}=e,r=t||this.getModules();return{modules:[Ya,...r,...n||[],...[{decisionTable:["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)}attachTo(e){if(!e)throw new Error("parentNode required");this.detach();const t=this._container;e.appendChild(t),this._emit("attach",{})}detach(){const e=this._container;e.parentNode&&(this._emit("detach",{}),$t(e))}destroy(){super.destroy(),this.detach()}getModules(){return e._getModules()}static _getModules(){return[va,ba,zo,Ca,Ra,Oa,Fa,Ha,Ka]}static _createContainer(){return Ft('<div class="dmn-decision-table-container"></div>')}};class Qa{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 r=this._listeners[n]&&this._listeners[n].length;if(r)for(let e=0;e<r;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])}}Qa.$inject=["eventBus"];class Za extends lo{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 Ui(1,"div","viewer-container",e&&e.map(((e,t)=>Gi(2,e,null,t))),0)}}class el{constructor(e,t,n,i,r){const{container:o}=n;this._container=o,i.on("renderer.mount",(()=>{io(Gi(2,Za,{injector:r}),o)})),i.on("renderer.unmount",(()=>{io(null,o)}))}getContainer(){return this._container}}el.$inject=["changeSupport","components","config.renderer","eventBus","injector"];var tl={__init__:["changeSupport","components","renderer"],changeSupport:["type",Qa],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 r=n[e].callback(t);r&&i.push(r)}return i.length?i:void 0}onGetComponent(e,t,n){if(s(t)&&(n=t,t=1e3),!o(t))throw new Error("priority must be a number");const i=this._getListeners(e);let r,a;const l={priority:t,callback:n};for(a=0;r=i[a];a++)if(r.priority<t)return void i.splice(a,0,l);i.push(l)}offGetComponent(e,t){const n=this._getListeners(e);let i,r,o;if(t)for(o=n.length-1;i=n[o];o--)r=i.callback,r===t&&n.splice(o,1);else n.length=0}_getListeners(e){let t=this._listeners[e];return t||(this._listeners[e]=t=[]),t}}],eventBus:["type",C],renderer:["type",el]};let nl=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]},tl].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")}};class il{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}}il.$inject=["viewer","eventBus"];var rl={__init__:["elementRegistry"],elementRegistry:["type",il]};class ol extends lo{constructor(e,t){super(e,t),this._viewer=t.injector.get("viewer")}render(){const{name:e}=this._viewer.getDecision();return Ui(1,"div","decision-properties",Ui(1,"h3","decision-name",e,0),2)}}let sl=class{constructor(e){e.onGetComponent("viewer",1500,(()=>ol))}};sl.$inject=["components"];var al={__init__:["decisionProperties"],decisionProperties:["type",sl]};class ll extends lo{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 Ui(1,"div","literal-expression-properties",Ui(1,"table",null,[Ui(1,"tr",null,[Ui(1,"td",null,this._translate("Variable name:"),0),Ui(1,"td",null,Ui(1,"span",null,t.name||"-",0),2)],4),Ui(1,"tr",null,[Ui(1,"td",null,this._translate("Variable type:"),0),Ui(1,"td",null,Ui(1,"span",null,this._translate(t.typeRef||"")||"-",0),2)],4),Ui(1,"tr",null,[Ui(1,"td",null,this._translate("Expression language:"),0),Ui(1,"td",null,Ui(1,"span",null,e.expressionLanguage||"-",0),2)],4)],4),2)}}class cl{constructor(e){e.onGetComponent("viewer",500,(()=>ll))}}cl.$inject=["components"];var hl={__depends__:[],__init__:["literalExpressionProperties"],literalExpressionProperties:["type",cl]};let ul=class{constructor(e){e.onGetComponent("viewer",2e3,(()=>po))}};ul.$inject=["components"];var dl={__init__:["poweredBy"],poweredBy:["type",ul]};class pl extends lo{constructor(e,t){super(e,t),this._viewer=t.injector.get("viewer")}render(){const{text:e}=this._viewer.getDecision().decisionLogic;return Ui(1,"div","textarea",Ui(1,"div","content",e,0),2)}}class fl{constructor(e){e.onGetComponent("viewer",(()=>pl))}}fl.$inject=["components"];var gl={__init__:["textarea"],textarea:["type",fl]};let ml=class extends lo{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 Ui(1,"div","view-drd",Ui(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,(e=>this.node=e))}};ml.$inject=["translate"];let vl=class{constructor(e,t,n,i){this._injector=i,this._viewer=t,e.onGetComponent("viewer",2e3,(()=>{if(this.canViewDrd())return ml})),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}};vl.$inject=["components","viewer","eventBus","injector"];var yl={__init__:["viewDrd"],viewDrd:["type",vl]};let wl=class e extends nl{constructor(t={}){const n=e._createContainer();super(_(t,{renderer:{container:n}})),this._container=n}open(e){var t=this;return new Promise((function(n,i){var r;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){r=e}r?(r.warnings=r.warnings||[],i(r)):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",{}),$t(e))}destroy(){super.destroy(),this.detach()}getModules(){return e._getModules()}static _getModules(){return[rl,zo,al,hl,dl,gl,yl]}static _createContainer(){return Ft('<div class="dmn-literal-expression-container"></div>')}};function bl(e,{injector:t}){const n=t.get("components").getComponents("header");return Ui(1,"div","dmn-boxed-expression-section dmn-boxed-expression-header",n&&n.map(((e,t)=>Gi(2,e,null,t))),0)}function xl(e,{injector:t}){const n=t.get("components").getComponents("body");return Ui(1,"div","dmn-boxed-expression-section dmn-boxed-expression-body",n&&n.map(((e,t)=>Gi(2,e,null,t))),0)}function _l(e,{injector:t}){const n=t.get("components").getComponents("footer");return Ui(1,"div","dmn-boxed-expression-section dmn-boxed-expression-footer",n&&n.map(((e,t)=>Gi(2,e,null,t))),0)}var Sl={__init__:["viewRenderer","tableJsSupport"],viewRenderer:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("viewer",(()=>bl)),e.onGetComponent("viewer",(()=>xl)),e.onGetComponent("viewer",(()=>_l))}}],tableJsSupport:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("viewer",(()=>{const t=e.getComponents("table.before")||[];return()=>Ui(1,"div",null,t.map(((e,t)=>Gi(2,e,null,t))),0)}))}}]};class kl{constructor(e){e.onGetComponent("viewer",2e3,(()=>po))}}kl.$inject=["components"];var Cl={__init__:["poweredBy"],poweredBy:["type",kl]};function El({expression:e},t){return Ui(1,"div","textarea",Ui(1,"div","content",t.injector.get("literalExpression").getText(e),0),2)}class Ml{getText(e){return e.get("text")}}var Al={__init__:["literalExpressionComponent"],literalExpressionComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("expression",(({expression:e})=>{if(bi(e,"dmn:LiteralExpression"))return El}))}}],literalExpression:["type",Ml]};function Rl({expression:e},t){const n=t.injector.get("functionDefinition"),i=n.getKind(e),r=n.getParameters(e),o=n.getBody(e);return Ui(1,"div","function-definition",[Gi(2,Dl,{kind:i}),Gi(2,Ol,{parameters:r}),Gi(2,Pl,{expression:o})],4)}const Tl={FEEL:"F",Java:"J",PMML:"P"};function Dl({kind:e},t){const n=t.injector.get("translate");return Ui(1,"div","function-definition-kind",Tl[e],0,{title:n("Function kind: {kind}",{kind:e})})}function Ol({parameters:e}){return Ui(1,"div","function-definition-parameters",Ui(1,"div",null,[Ki("("),e.reduce(((e,t)=>e.concat(Gi(2,Nl,{parameter:t}),", ")),[]).slice(0,-1),Ki(")")],0),2)}function Nl({parameter:e}){const{name:t,typeRef:n}=e,i=t||"<unnamed>";return Ui(1,"span",null,n?`${i}: ${n}`:i,0)}function Pl({expression:e},t){return Ui(1,"div","function-definition-body",Gi(2,t.components.getComponent("expression",{expression:e}),{expression:e}),2)}var ql={__init__:["functionDefinitionComponent"],functionDefinition:["type",class{getParameters(e){return e.get("formalParameter")}getBody(e){return e.get("body")}getKind(e){return e.get("kind")||"FEEL"}}],functionDefinitionComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("expression",(({expression:e})=>{if(bi(e,"dmn:FunctionDefinition"))return Rl}))}}]};class Bl extends lo{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 Ui(1,"div","view-drd",Ui(1,"button","view-drd-button",this._translate("View DRD"),0,{type:"button",onClick:this.onClick}),2,null,null,(e=>this.node=e))}}Bl.$inject=["translate"];class Ll{constructor(e,t,n){this._injector=n,e.onGetComponent("viewer",2e3,(()=>{if(this.canViewDrd())return Bl})),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)}}Ll.$inject=["components","eventBus","injector"];var Il={__init__:["viewDrd"],viewDrd:["type",Ll]};function jl(e,t){const n=t.injector.get("viewer"),{name:i}=n.getRootElement();return Ui(1,"div","element-properties",Ui(1,"h2","element-name",i,0),2)}class Fl{constructor(e){e.onGetComponent("header",(()=>jl))}}Fl.$inject=["components"];var Vl={__init__:["elementProperties"],elementProperties:["type",Fl]};function $l(e,{injector:t}){const n=t.get("components"),i=function(e){if(bi(e,"dmn:Decision"))return e.get("decisionLogic");if(bi(e,"dmn:BusinessKnowledgeModel"))return e.get("encapsulatedLogic")}(t.get("viewer").getRootElement());return Gi(2,n.getComponent("expression",{expression:i}),{expression:i})}function zl({expression:e}){return Ui(1,"div",null,Ui(1,"span",null,[Ki("Expression of type "),e.$type,Ki(" is not supported.")],0,{style:"color:red;"}),2)}var Hl={__init__:["elementLogic"],elementLogic:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("body",(()=>$l)),e.onGetComponent("expression",100,(()=>zl))}}]};function Wl(e,t){const n=t.injector.get("elementVariable"),i=t.injector.get("translate"),r=n.getName(),o=n.getType();return Ui(1,"div","element-variable",[Ui(1,"h2",null,Ki("Result"),2),Ui(1,"div","element-variable-name",[Ui(1,"span","element-variable-name-label",i("Variable name"),0),Ui(1,"span",null,r,0)],4),Ui(1,"div","element-variable-type",[Ui(1,"span","element-variable-type-label",i("Variable type"),0),Ui(1,"span",null,o,0)],4)],4)}var Ul={__init__:["elementVariableComponent"],elementVariable:["type",class{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")}}],elementVariableComponent:["type",class{static $inject=["components"];constructor(e){e.onGetComponent("footer",(()=>Wl))}}]};let Gl=class e extends nl{constructor(t={}){const n=e._createContainer();super(_(t,{renderer:{container:n}})),this._container=n}open(e){const t=this.get("eventBus");return new Promise(((n,i)=>{let r;try{this.getRootElement()&&(this.clear(),t.fire("renderer.unmount")),this._setRootElement(e),t.fire("import",e),t.fire("renderer.mount")}catch(e){r=e}r?(r.warnings=r.warnings||[],i(r)):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",{}),$t(e))}destroy(){super.destroy(),this.detach()}getModules(){return[Sl,zo,Cl,Il,Vl,Hl,ql,Al,Ul]}static _createContainer(){return Ft('<div class="dmn-boxed-expression-container"></div>')}};window.getSelection();var Kl,Xl={exports:{}};!function(){if(Kl)return Xl.exports;function e(e,t){return{start:e,end:void 0===t?e:t}}Kl=1,Xl.exports=function(t,n,i){var r=t.start,o=r,s=(i.length,n.length);i.length,n.length;var a=n.substring(r);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,r,o=0,s=0;t.length>e.length?(i=t,r=e):(i=e,r=t);for(;o<i.length;)i.charAt(o)!==r.charAt(s)?(n||(n={l_start:o,s_start:s}),o++):(n&&!n.complete&&(n.l_end=o,n.s_end=s,n.complete=!0),s++,o++);n&&!n.complete&&(n.complete=!0,n.s_end=r.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&&(o="remove"===s.type?s.newStart:s.newEnd),e(o)},Xl.exports.range=e,Xl.exports}();let Yl=[],Jl=[];function Ql(e){if(e<768)return!1;for(let t=0,n=Yl.length;;){let i=t+n>>1;if(e<Yl[i])n=i;else{if(!(e>=Jl[i]))return!0;t=i+1}if(t==n)return!1}}function Zl(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?Jl:Yl).push(n+=e[t])})();const ec=8205;function tc(e,t,n=!0,i=!0){return(n?nc:ic)(e,t,i)}function nc(e,t,n){if(t==e.length)return t;t&&oc(e.charCodeAt(t))&&sc(e.charCodeAt(t-1))&&t--;let i=rc(e,t);for(t+=ac(i);t<e.length;){let r=rc(e,t);if(i==ec||r==ec||n&&Ql(r))t+=ac(r),i=r;else{if(!Zl(r))break;{let n=0,i=t-2;for(;i>=0&&Zl(rc(e,i));)n++,i-=2;if(n%2==0)break;t+=2}}}return t}function ic(e,t,n){for(;t>0;){let i=nc(e,t-2,n);if(i<t)return i;t--}return 0}function rc(e,t){let n=e.charCodeAt(t);if(!sc(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return oc(i)?i-56320+(n-55296<<10)+65536:n}function oc(e){return e>=56320&&e<57344}function sc(e){return e>=55296&&e<56320}function ac(e){return e<65536?1:2}class lc{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]=vc(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),hc.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]=vc(this,e,t);let n=[];return this.decompose(e,t,n,0),hc.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 pc(this),r=new pc(e);for(let e=t,o=t;;){if(i.next(e),r.next(e),e=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(o+=i.value.length,i.done||o>=n)return!0}}iter(e=1){return new pc(this,e)}iterRange(e,t=this.length){return new fc(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 gc(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 cc(e):hc.from(cc.split(e,[])):lc.empty}}class cc extends lc{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 r=0;;r++){let o=this.text[r],s=i+o.length;if((t?n:s)>=e)return new mc(i,s,n,o);i=s+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new cc(dc(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=uc(r.text,e.text.slice(),0,r.length);if(t.length<=32)n.push(new cc(t,e.length+r.length));else{let e=t.length>>1;n.push(new cc(t.slice(0,e)),new cc(t.slice(e)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof cc))return super.replace(e,t,n);[e,t]=vc(this,e,t);let i=uc(this.text,uc(n.text,dc(this.text,0,e)),t),r=this.length+n.length-(t-e);return i.length<=32?new cc(i,r):hc.from(cc.split(i,[]),r)}sliceString(e,t=this.length,n="\n"){[e,t]=vc(this,e,t);let i="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let s=this.text[o],a=r+s.length;r>e&&o&&(i+=n),e<a&&t>r&&(i+=s.slice(Math.max(0,e-r),t-r)),r=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 r of e)n.push(r),i+=r.length+1,32==n.length&&(t.push(new cc(n,i)),n=[],i=-1);return i>-1&&t.push(new cc(n,i)),t}}class hc extends lc{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 r=0;;r++){let o=this.children[r],s=i+o.length,a=n+o.lines-1;if((t?a:s)>=e)return o.lineInner(e,t,n,i);i=s+1,n=a+1}}decompose(e,t,n,i){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let s=this.children[r],a=o+s.length;if(e<=a&&t>=o){let r=i&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!r?n.push(s):s.decompose(e-o,t-o,n,r)}o=a+1}}replace(e,t,n){if([e,t]=vc(this,e,t),n.lines<this.lines)for(let i=0,r=0;i<this.children.length;i++){let o=this.children[i],s=r+o.length;if(e>=r&&t<=s){let a=o.replace(e-r,t-r,n),l=this.lines-o.lines+a.lines;if(a.lines<l>>4&&a.lines>l>>6){let r=this.children.slice();return r[i]=a,new hc(r,this.length-(t-e)+n.length)}return super.replace(r,s,a)}r=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=vc(this,e,t);let i="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let s=this.children[r],a=o+s.length;o>e&&r&&(i+=n),e<a&&t>o&&(i+=s.sliceString(e-o,t-o,n)),o=a+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof hc))return 0;let n=0,[i,r,o,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,r+=t){if(i==o||r==s)return n;let a=this.children[i],l=e.children[r];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 cc(n,t)}let i=Math.max(32,n>>5),r=i<<1,o=i>>1,s=[],a=0,l=-1,c=[];function h(e){let t;if(e.lines>r&&e instanceof hc)for(let t of e.children)h(t);else e.lines>o&&(a>o||!a)?(u(),s.push(e)):e instanceof cc&&a&&(t=c[c.length-1])instanceof cc&&e.lines+t.lines<=32?(a+=e.lines,l+=e.length+1,c[c.length-1]=new cc(t.text.concat(e.text),t.length+1+e.length)):(a+e.lines>i&&u(),a+=e.lines,l+=e.length+1,c.push(e))}function u(){0!=a&&(s.push(1==c.length?c[0]:hc.from(c,l)),l=-1,a=c.length=0)}for(let t of e)h(t);return u(),1==s.length?s[0]:new hc(s,t)}}function uc(e,t,n=0,i=1e9){for(let r=0,o=0,s=!0;o<e.length&&r<=i;o++){let a=e[o],l=r+a.length;l>=n&&(l>i&&(a=a.slice(0,i-r)),r<n&&(a=a.slice(n-r)),s?(t[t.length-1]+=a,s=!1):t.push(a)),r=l+1}return t}function dc(e,t,n){return uc(e,[""],t,n)}lc.empty=new cc([""],0);class pc{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 cc?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],r=this.offsets[n],o=r>>1,s=i instanceof cc?i.text.length:i.children.length;if(o==(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&r)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof cc){let r=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,r.length>Math.max(0,e))return this.value=0==e?r:t>0?r.slice(e):r.slice(0,r.length-e),this;e-=r.length}else{let r=i.children[o+(t<0?-1:0)];e>r.length?(e-=r.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(t>0?1:(r instanceof cc?r.text.length:r.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class fc{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new pc(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 gc{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&&(lc.prototype[Symbol.iterator]=function(){return this.iter()},pc.prototype[Symbol.iterator]=fc.prototype[Symbol.iterator]=gc.prototype[Symbol.iterator]=function(){return this});class mc{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 vc(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function yc(e,t,n=!0,i=!0){return tc(e,t,n,i)}const wc=/\r\n?|\n/;var bc=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(bc||(bc={}));class xc{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 r=this.sections[t++],o=this.sections[t++];o<0?(e(n,i,r),i+=r):i+=o,n+=r}}iterChangedRanges(e,t=!1){Cc(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 xc(e)}composeDesc(e){return this.empty?e:e.empty?this:Mc(this,e)}mapDesc(e,t=!1){return e.empty?this:Ec(this,e,t)}mapPos(e,t=-1,n=bc.Simple){let i=0,r=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],a=this.sections[o++],l=i+s;if(a<0){if(l>e)return r+(e-i);r+=s}else{if(n!=bc.Simple&&l>=e&&(n==bc.TrackDel&&i<e&&l>e||n==bc.TrackBefore&&i<e||n==bc.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!s)return e==i||t<0?r:r+a;r+=a}i=l}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return r}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let r=i+this.sections[n++];if(this.sections[n++]>=0&&i<=t&&r>=e)return!(i<e&&r>t)||"cover";i=r}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 xc(e)}static create(e){return new xc(e)}}class _c extends xc{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 Cc(this,((t,n,i,r,o)=>e=e.replace(i,i+(n-t),o)),!1),e}mapDesc(e,t=!1){return Ec(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,r=0;i<t.length;i+=2){let o=t[i],s=t[i+1];if(s>=0){t[i]=s,t[i+1]=o;let a=i>>1;for(;n.length<a;)n.push(lc.empty);n.push(o?e.slice(r,r+o):lc.empty)}r+=o}return new _c(t,n)}compose(e){return this.empty?e:e.empty?this:Mc(this,e,!0)}map(e,t=!1){return e.empty?this:Ec(this,e,t,!0)}iterChanges(e,t=!1){Cc(this,e,t)}get desc(){return xc.create(this.sections)}filter(e){let t=[],n=[],i=[],r=new Ac(this);e:for(let o=0,s=0;;){let a=o==e.length?1e9:e[o++];for(;s<a||s==a&&0==r.len;){if(r.done)break e;let e=Math.min(r.len,a-s);Sc(i,e,-1);let o=-1==r.ins?-1:0==r.off?r.ins:0;Sc(t,e,o),o>0&&kc(n,t,r.text),r.forward(e),s+=e}let l=e[o++];for(;s<l;){if(r.done)break e;let e=Math.min(r.len,l-s);Sc(t,e,-1),Sc(i,e,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(e),s+=e}}return{changes:new _c(t,n),filtered:xc.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=[],r=[],o=0,s=null;function a(e=!1){if(!e&&!i.length)return;o<t&&Sc(i,t-o,-1);let n=new _c(i,r);s=s?s.compose(n.map(s)):n,i=[],r=[],o=0}return function e(l){if(Array.isArray(l))for(let t of l)e(t);else if(l instanceof _c){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 h=c?"string"==typeof c?lc.of(c.split(n||wc)):c:lc.empty,u=h.length;if(e==s&&0==u)return;e<o&&a(),e>o&&Sc(i,e-o,-1),Sc(i,s-e,u),kc(r,i,h),o=s}}(e),a(!s),s}static empty(e){return new _c(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 r=e[i];if("number"==typeof r)t.push(r,-1);else{if(!Array.isArray(r)||"number"!=typeof r[0]||r.some(((e,t)=>t&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)t.push(r[0],0);else{for(;n.length<i;)n.push(lc.empty);n[i]=lc.of(r.slice(1)),t.push(r[0],n[i].length)}}}return new _c(t,n)}static createSet(e,t){return new _c(e,t)}}function Sc(e,t,n,i=!1){if(0==t&&n<=0)return;let r=e.length-2;r>=0&&n<=0&&n==e[r+1]?e[r]+=t:r>=0&&0==t&&0==e[r]?e[r+1]+=n:i?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function kc(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(lc.empty);e.push(n)}}function Cc(e,t,n){let i=e.inserted;for(let r=0,o=0,s=0;s<e.sections.length;){let a=e.sections[s++],l=e.sections[s++];if(l<0)r+=a,o+=a;else{let c=r,h=o,u=lc.empty;for(;c+=a,h+=l,l&&i&&(u=u.append(i[s-2>>1])),!(n||s==e.sections.length||e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(r,c,o,h,u),r=c,o=h}}}function Ec(e,t,n,i=!1){let r=[],o=i?[]:null,s=new Ac(e),a=new Ac(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);Sc(r,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(Sc(r,a.ins,-1);t;){let n=Math.min(s.len,t);s.ins>=0&&e<s.i&&s.len<=n&&(Sc(r,0,s.ins),o&&kc(o,r,s.text),e=s.i),s.forward(n),t-=n}a.next()}else{if(!(s.ins>=0)){if(s.done&&a.done)return o?_c.createSet(r,o):xc.create(r);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()}Sc(r,t,e<s.i?s.ins:0),o&&e<s.i&&kc(o,r,s.text),e=s.i,s.forward(s.len-n)}}}}function Mc(e,t,n=!1){let i=[],r=n?[]:null,o=new Ac(e),s=new Ac(t);for(let e=!1;;){if(o.done&&s.done)return r?_c.createSet(i,r):xc.create(i);if(0==o.ins)Sc(i,o.len,0,e),o.next();else if(0!=s.len||s.done){if(o.done||s.done)throw new Error("Mismatched change set lengths");{let t=Math.min(o.len2,s.len),n=i.length;if(-1==o.ins){let n=-1==s.ins?-1:s.off?0:s.ins;Sc(i,t,n,e),r&&n&&kc(r,i,s.text)}else-1==s.ins?(Sc(i,o.off?0:o.len,t,e),r&&kc(r,i,o.textBit(t))):(Sc(i,o.off?0:o.len,s.off?0:s.ins,e),r&&!s.off&&kc(r,i,s.text));e=(o.ins>t||s.ins>=0&&s.len>t)&&(e||i.length>n),o.forward2(t),s.forward(t)}}else Sc(i,0,s.ins,e),r&&kc(r,i,s.text),s.next()}}class Ac{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?lc.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?lc.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 Rc{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 Rc(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Tc.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Tc.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 Tc.range(e.anchor,e.head)}static create(e,t,n){return new Rc(e,t,n)}}class Tc{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Tc.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 Tc([this.main],0)}addRange(e,t=!0){return Tc.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,Tc.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 Tc(e.ranges.map((e=>Rc.fromJSON(e))),e.main)}static single(e,t=e){return new Tc([Tc.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 r=e[i];if(r.empty?r.from<=n:r.from<n)return Tc.normalized(e.slice(),t);n=r.to}return new Tc(e,t)}static cursor(e,t=0,n,i){return Rc.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 r=(null!=n?n:16777215)<<6|(null==i?7:Math.min(6,i));return t<e?Rc.create(t,e,48|r):Rc.create(e,t,(t>e?8:0)|r)}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],r=e[n-1];if(i.empty?i.from<=r.to:i.from<r.to){let o=r.from,s=Math.max(i.to,r.to);n<=t&&t--,e.splice(--n,2,i.anchor>i.head?Tc.range(s,o):Tc.range(o,s))}}return new Tc(e,t)}}function Dc(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let Oc=0;class Nc{constructor(e,t,n,i,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=Oc++,this.default=e([]),this.extensions="function"==typeof r?r(this):r}get reader(){return this}static define(e={}){return new Nc(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:Pc),!!e.static,e.enables)}of(e){return new qc([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new qc(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new qc(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],(n=>t(n.field(e))))}}function Pc(e,t){return e==t||e.length==t.length&&e.every(((e,n)=>e===t[n]))}class qc{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=Oc++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,r=this.id,o=e[r]>>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[o]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||Lc(e,c)){let t=n(e);if(s?!Bc(t,e.values[o],i):!i(t,e.values[o]))return e.values[o]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[r];if(null!=l){let r=Qc(t,l);if(this.dependencies.every((n=>n instanceof Nc?t.facet(n)===e.facet(n):!(n instanceof Fc)||t.field(n,!1)==e.field(n,!1)))||(s?Bc(a=n(e),r,i):i(a=n(e),r)))return e.values[o]=r,0}else a=n(e);return e.values[o]=a,1}}}}function Bc(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 Lc(e,t){let n=!1;for(let i of t)1&Jc(e,i)&&(n=!0);return n}function Ic(e,t,n){let i=n.map((t=>e[t.id])),r=n.map((e=>e.type)),o=i.filter((e=>!(1&e))),s=e[t.id]>>1;function a(e){let n=[];for(let t=0;t<i.length;t++){let o=Qc(e,i[t]);if(2==r[t])for(let e of o)n.push(e);else n.push(o)}return t.combine(n)}return{create(e){for(let t of i)Jc(e,t);return e.values[s]=a(e),1},update(e,n){if(!Lc(e,o))return 0;let i=a(e);return t.compare(i,e.values[s])?0:(e.values[s]=i,1)},reconfigure(e,r){let o=Lc(e,i),l=r.config.facets[t.id],c=r.facet(t);if(l&&!o&&Pc(n,l))return e.values[s]=c,0;let h=a(e);return t.compare(h,c)?(e.values[s]=c,0):(e.values[s]=h,1)}}}const jc=Nc.define({static:!0});class Fc{constructor(e,t,n,i,r){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=r,this.provides=void 0}static define(e){let t=new Fc(Oc++,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(jc).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],r=this.updateF(i,n);return this.compareF(i,r)?0:(e.values[t]=r,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,jc.of({field:this,create:e})]}get extension(){return this}}const Vc=4,$c=3,zc=2,Hc=1;function Wc(e){return t=>new Gc(t,e)}const Uc={highest:Wc(0),high:Wc(Hc),default:Wc(zc),low:Wc($c),lowest:Wc(Vc)};class Gc{constructor(e,t){this.inner=e,this.prec=t}}class Kc{of(e){return new Xc(this,e)}reconfigure(e){return Kc.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Xc{constructor(e,t){this.compartment=e,this.inner=t}}class Yc{constructor(e,t,n,i,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=o,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=[],r=Object.create(null),o=new Map;for(let n of function(e,t,n){let i=[[],[],[],[],[]],r=new Map;function o(e,s){let a=r.get(e);if(null!=a){if(a<=s)return;let t=i[a].indexOf(e);t>-1&&i[a].splice(t,1),e instanceof Xc&&n.delete(e.compartment)}if(r.set(e,s),Array.isArray(e))for(let t of e)o(t,s);else if(e instanceof Xc){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),o(i,s)}else if(e instanceof Gc)o(e.inner,e.prec);else if(e instanceof Fc)i[s].push(e),e.provides&&o(e.provides,s);else if(e instanceof qc)i[s].push(e),e.facet.extensions&&o(e.facet.extensions,zc);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.`);o(t,s)}}return o(e,zc),i.reduce(((e,t)=>e.concat(t)))}(e,t,o))n instanceof Fc?i.push(n):(r[n.facet.id]||(r[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 r){let t=r[e],i=t[0].facet,o=c&&c[e]||[];if(t.every((e=>0==e.type)))if(s[i.id]=a.length<<1|1,Pc(o,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=>Ic(e,i,t)))}}let h=l.map((e=>e(s)));return new Yc(e,o,h,s,a,r)}}function Jc(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 r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function Qc(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const Zc=Nc.define(),eh=Nc.define({combine:e=>e.some((e=>e)),static:!0}),th=Nc.define({combine:e=>e.length?e[0]:void 0,static:!0}),nh=Nc.define(),ih=Nc.define(),rh=Nc.define(),oh=Nc.define({combine:e=>!!e.length&&e[0]});class sh{constructor(e,t){this.type=e,this.value=t}static define(){return new ah}}class ah{of(e){return new sh(this,e)}}class lh{constructor(e){this.map=e}of(e){return new ch(this,e)}}class ch{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 ch(this.type,t)}is(e){return this.type==e}static define(e={}){return new lh(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}}ch.reconfigure=ch.define(),ch.appendConfig=ch.define();class hh{constructor(e,t,n,i,r,o){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,n&&Dc(n,t.newLength),r.some((e=>e.type==hh.time))||(this.annotations=r.concat(hh.time.of(Date.now())))}static create(e,t,n,i,r,o){return new hh(e,t,n,i,r,o)}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(hh.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function uh(e,t){let n=[];for(let i=0,r=0;;){let o,s;if(i<e.length&&(r==t.length||t[r]>=e[i]))o=e[i++],s=e[i++];else{if(!(r<t.length))return n;o=t[r++],s=t[r++]}!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function dh(e,t,n){var i;let r,o,s;return n?(r=t.changes,o=_c.empty(t.changes.length),s=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),o=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(r)),{changes:s,selection:t.selection?t.selection.map(o):null===(i=e.selection)||void 0===i?void 0:i.map(r),effects:ch.mapEffects(e.effects,r).concat(ch.mapEffects(t.effects,o)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function ph(e,t,n){let i=t.selection,r=mh(t.annotations);return t.userEvent&&(r=r.concat(hh.userEvent.of(t.userEvent))),{changes:t.changes instanceof _c?t.changes:_c.of(t.changes||[],n,e.facet(th)),selection:i&&(i instanceof Tc?i:Tc.single(i.anchor,i.head)),effects:mh(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function fh(e,t,n){let i=ph(e,t.length?t[0]:{},e.doc.length);t.length&&!1===t[0].filter&&(n=!1);for(let r=1;r<t.length;r++){!1===t[r].filter&&(n=!1);let o=!!t[r].sequential;i=dh(i,ph(e,t[r],o?i.changes.newLength:e.doc.length),o)}let r=hh.create(e,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(e){let t=e.startState,n=t.facet(rh),i=e;for(let r=n.length-1;r>=0;r--){let o=n[r](e);o&&Object.keys(o).length&&(i=dh(i,ph(t,o,e.changes.newLength),!0))}return i==e?e:hh.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(nh)){let t=i(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:uh(n,t))}if(!0!==n){let i,r;if(!1===n)r=e.changes.invertedDesc,i=_c.empty(t.doc.length);else{let t=e.changes.filter(n);i=t.changes,r=t.filtered.mapDesc(t.changes).invertedDesc}e=hh.create(t,i,e.selection&&e.selection.map(r),ch.mapEffects(e.effects,r),e.annotations,e.scrollIntoView)}let i=t.facet(ih);for(let n=i.length-1;n>=0;n--){let r=i[n](e);e=r instanceof hh?r:Array.isArray(r)&&1==r.length&&r[0]instanceof hh?r[0]:fh(t,mh(r),!1)}return e}(r):r)}hh.time=sh.define(),hh.userEvent=sh.define(),hh.addToHistory=sh.define(),hh.remote=sh.define();const gh=[];function mh(e){return null==e?gh:Array.isArray(e)?e:[e]}var vh=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(vh||(vh={}));const yh=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let wh;try{wh=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}function bh(e){return t=>{if(!/\S/.test(t))return vh.Space;if(function(e){if(wh)return wh.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||yh.test(n)))return!0}return!1}(t))return vh.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return vh.Word;return vh.Other}}class xh{constructor(e,t,n,i,r,o){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)Jc(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null!=n)return Jc(this,n),Qc(this,n);if(t)throw new RangeError("Field is not present in this state")}update(...e){return fh(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:i,compartments:r}=n;for(let t of e.effects)t.is(Kc.reconfigure)?(n&&(r=new Map,n.compartments.forEach(((e,t)=>r.set(t,e))),n=null),r.set(t.value.compartment,t.value.extension)):t.is(ch.reconfigure)?(n=null,i=t.value):t.is(ch.appendConfig)&&(n=null,i=mh(i).concat(t.value));if(n)t=e.startState.values.slice();else{n=Yc.resolve(i,r,this),t=new xh(n,this.doc,this.selection,n.dynamicSlots.map((()=>null)),((e,t)=>t.reconfigure(e,this)),null).values}let o=e.startState.facet(eh)?e.newSelection:e.newSelection.asSingle();new xh(n,e.newDoc,o,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:Tc.cursor(t.from+e.length)})))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),r=[n.range],o=mh(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++)r[e]=r[e].map(l);let c=i.mapDesc(a,!0);r.push(s.range.map(c)),i=i.compose(l),o=ch.mapEffects(o,l).concat(ch.mapEffects(mh(s.effects),c))}return{changes:i,selection:Tc.create(r,t.mainIndex),effects:o}}changes(e=[]){return e instanceof _c?e:_c.of(e,this.doc.length,this.facet(xh.lineSeparator))}toText(e){return lc.of(e.split(this.facet(xh.lineSeparator)||wc))}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:(Jc(this,t),Qc(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 Fc&&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 r=n[t],o=e[t];i.push(r.init((e=>r.spec.fromJSON(o,e))))}return xh.create({doc:e.doc,selection:Tc.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=Yc.resolve(e.extensions||[],new Map),n=e.doc instanceof lc?e.doc:lc.of((e.doc||"").split(t.staticFacet(xh.lineSeparator)||wc)),i=e.selection?e.selection instanceof Tc?e.selection:Tc.single(e.selection.anchor,e.selection.head):Tc.single(0);return Dc(i,n.length),t.staticFacet(eh)||(i=i.asSingle()),new xh(t,n,i,t.dynamicSlots.map((()=>null)),((e,t)=>t.create(e)),null)}get tabSize(){return this.facet(xh.tabSize)}get lineBreak(){return this.facet(xh.lineSeparator)||"\n"}get readOnly(){return this.facet(oh)}phrase(e,...t){for(let t of this.facet(xh.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 r of this.facet(Zc))for(let o of r(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return bh(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-n,s=e-n;for(;o>0;){let e=yc(t,o,!1);if(r(t.slice(e,o))!=vh.Word)break;o=e}for(;s<i;){let e=yc(t,s);if(r(t.slice(s,e))!=vh.Word)break;s=e}return o==s?null:Tc.range(o+n,s+n)}}xh.allowMultipleSelections=eh,xh.tabSize=Nc.define({combine:e=>e.length?e[0]:4}),xh.lineSeparator=th,xh.readOnly=oh,xh.phrases=Nc.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]))}}),xh.languageData=Zc,xh.changeFilter=nh,xh.transactionFilter=ih,xh.transactionExtender=rh,Kc.reconfigure=ch.define();class _h{eq(e){return this==e}range(e,t=e){return Sh.create(e,t,this)}}_h.prototype.startSide=_h.prototype.endSide=0,_h.prototype.point=!1,_h.prototype.mapMode=bc.TrackDel;let Sh=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 kh(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class Ch{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 r=n?this.to:this.from;for(let o=i,s=r.length;;){if(o==s)return o;let i=o+s>>1,a=r[i]-e||(n?this.value[i].endSide:this.value[i].startSide)-t;if(i==o)return a>=0?o:s;a>=0?s=i:o=i+1}}between(e,t,n,i){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,r);r<o;r++)if(!1===i(this.from[r]+e,this.to[r]+e,this.value[r]))return!1}map(e,t){let n=[],i=[],r=[],o=-1,s=-1;for(let a=0;a<this.value.length;a++){let l,c,h=this.value[a],u=this.from[a]+e,d=this.to[a]+e;if(u==d){let e=t.mapPos(u,h.startSide,h.mapMode);if(null==e)continue;if(l=c=e,h.startSide!=h.endSide&&(c=t.mapPos(u,h.endSide),c<l))continue}else if(l=t.mapPos(u,h.startSide),c=t.mapPos(d,h.endSide),l>c||l==c&&h.startSide>0&&h.endSide<=0)continue;(c-l||h.endSide-h.startSide)<0||(o<0&&(o=l),h.point&&(s=Math.max(s,c-l)),n.push(h),i.push(l-o),r.push(c-o))}return{mapped:n.length?new Ch(i,r,n,s):null,pos:o}}}class Eh{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 Eh(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:r=this.length}=e,o=e.filter;if(0==t.length&&!o)return this;if(n&&(t=t.slice().sort(kh)),this.isEmpty)return t.length?Eh.of(t):this;let s=new Rh(this,null,-1).goto(0),a=0,l=[],c=new Mh;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)&&(!o||i>this.chunkEnd(s.chunkIndex)||r<this.chunkPos[s.chunkIndex])&&c.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||i>s.to||r<s.from||o(s.from,s.to,s.value))&&(c.addInner(s.from,s.to,s.value)||l.push(Sh.create(s.from,s.to,s.value))),s.next());return c.finishInner(this.nextLayer.isEmpty&&!l.length?Eh.empty:this.nextLayer.update({add:l,filter:o,filterFrom:i,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1;for(let r=0;r<this.chunk.length;r++){let o=this.chunkPos[r],s=this.chunk[r],a=e.touchesRange(o,o+s.length);if(!1===a)i=Math.max(i,s.maxPoint),t.push(s),n.push(e.mapPos(o));else if(!0===a){let{mapped:r,pos:a}=s.map(o,e);r&&(i=Math.max(i,r.maxPoint),t.push(r),n.push(a))}}let r=this.nextLayer.map(e);return 0==t.length?r:new Eh(n,t,r||Eh.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let r=this.chunkPos[i],o=this.chunk[i];if(t>=r&&e<=r+o.length&&!1===o.between(r,e-r,t-r,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return Th.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Th.from(e).goto(t)}static compare(e,t,n,i,r=-1){let o=e.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r)),s=t.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r)),a=Ah(o,s,n),l=new Oh(o,a,r),c=new Oh(s,a,r);n.iterGaps(((e,t,n)=>Nh(l,e,c,t,n,i))),n.empty&&0==n.length&&Nh(l,0,c,0,0,i)}static eq(e,t,n=0,i){null==i&&(i=999999999);let r=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0)),o=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0));if(r.length!=o.length)return!1;if(!r.length)return!0;let s=Ah(r,o),a=new Oh(r,s,0).goto(n),l=new Oh(o,s,0).goto(n);for(;;){if(a.to!=l.to||!Ph(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,r=-1){let o=new Oh(e,null,r).goto(t),s=t,a=o.openStart;for(;;){let e=Math.min(o.to,n);if(o.point){let n=o.activeForPoint(o.to),r=o.pointFrom<t?n.length+1:o.point.startSide<0?n.length:Math.min(n.length,a);i.point(s,e,o.point,n,r,o.pointRank),a=Math.min(o.openEnd(e),n.length)}else e>s&&(i.span(s,e,o.active,a),a=o.openEnd(e));if(o.to>n)return a+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new Mh;for(let i of e instanceof Sh?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let i=e[n];if(kh(t,i)>0)return e.slice().sort(kh);t=i}return e}(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return Eh.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=Eh.empty;i=i.nextLayer)t=new Eh(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}Eh.empty=new Eh([],[],null,-1),Eh.empty.nextLayer=Eh.empty;class Mh{finishChunk(e){this.chunks.push(new Ch(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 Mh)).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(Eh.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=Eh.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Ah(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 r=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let o=i.get(e.chunk[t]);null==o||(n?n.mapPos(o):o)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(o,o+e.chunk[t].length))||r.add(e.chunk[t])}return r}class Rh{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 Th{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let r=0;r<e.length;r++)for(let o=e[r];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&i.push(new Rh(o,t,n,r));return 1==i.length?i[0]:new Th(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--)Dh(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--)Dh(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(),Dh(this.heap,0)}}}function Dh(e,t){for(let n=e[t];;){let i=1+(t<<1);if(i>=e.length)break;let r=e[i];if(i+1<e.length&&r.compare(e[i+1])>=0&&(r=e[i+1],i++),n.compare(r)<0)break;e[i]=n,e[t]=r,t=i}}class Oh{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=Th.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){qh(this.active,e),qh(this.activeTo,e),qh(this.activeRank,e),this.minActive=Lh(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:r}=this.cursor;for(;t<this.activeRank.length&&(r-this.activeRank[t]||i-this.activeTo[t])>0;)t++;Bh(this.active,t,n),Bh(this.activeTo,t,i),Bh(this.activeRank,t,r),e&&Bh(e,t,this.cursor.from),this.minActive=Lh(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&&qh(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 Nh(e,t,n,i,r,o){e.goto(t),n.goto(i);let s=i+r,a=i,l=i-t;for(;;){let t=e.to+l-n.to,i=t||e.endSide-n.endSide,r=i<0?e.to+l:n.to,c=Math.min(r,s);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&Ph(e.activeForPoint(e.to),n.activeForPoint(n.to))||o.comparePoint(a,c,e.point,n.point):c>a&&!Ph(e.active,n.active)&&o.compareRange(a,c,e.active,n.active),r>s)break;(t||e.openEnd!=n.openEnd)&&o.boundChange&&o.boundChange(r),a=r,i<=0&&e.next(),i>=0&&n.next()}}function Ph(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 qh(e,t){for(let n=t,i=e.length-1;n<i;n++)e[n]=e[n+1];e.pop()}function Bh(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function Lh(e,t){let n=-1,i=1e9;for(let r=0;r<t.length;r++)(t[r]-i||e[r].endSide-e[n].endSide)<0&&(n=r,i=t[r]);return n}const Ih="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),jh="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),Fh="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class Vh{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function r(e,t,o,s){let a=[],l=/^@(\w+)\b/.exec(e[0]),c=l&&"keyframes"==l[1];if(l&&null==t)return o.push(e[0]+";");for(let n in t){let s=t[n];if(/&/.test(n))r(n.split(/,\s*/).map((t=>e.map((e=>t.replace(/&/,e))))).reduce(((e,t)=>e.concat(t))),s,o);else if(s&&"object"==typeof s){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");r(i(n),s,a,c)}else null!=s&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))+": "+s+";")}(a.length||c)&&o.push((!n||l||s?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)r(i(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=Fh[Ih]||1;return Fh[Ih]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[jh],r=n&&n.nonce;i?r&&i.setNonce(r):i=new zh(e,r),i.mount(Array.isArray(t)?t:[t],e)}}let $h=new Map;class zh{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let t=$h.get(n);if(t)return e[jh]=t;this.sheet=new i.CSSStyleSheet,$h.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[jh]=this}mount(e,t){let n=this.sheet,i=0,r=0;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<r&&s>-1&&(this.modules.splice(s,1),r--,s=-1),-1==s){if(this.modules.splice(r++,0,o),n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],i++)}else{for(;r<s;)i+=this.modules[r++].rules.length;i+=o.rules.length,r++}}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 Hh={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:"'"},Wh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Uh=0;Uh<10;Uh++)Hh[48+Uh]=Hh[96+Uh]=String(Uh);for(Uh=1;Uh<=24;Uh++)Hh[Uh+111]="F"+Uh;for(Uh=65;Uh<=90;Uh++)Hh[Uh]=String.fromCharCode(Uh+32),Wh[Uh]=String.fromCharCode(Uh);for(var Gh in Hh)Wh.hasOwnProperty(Gh)||(Wh[Gh]=Hh[Gh]);function Kh(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Xh(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function Yh(e,t){if(!t.anchorNode)return!1;try{return Xh(e,t.anchorNode)}catch(e){return!1}}function Jh(e){return 3==e.nodeType?hu(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function Qh(e,t,n,i){return!!n&&(tu(e,t,n,i,-1)||tu(e,t,n,i,1))}function Zh(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function eu(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function tu(e,t,n,i,r){for(;;){if(e==n&&t==i)return!0;if(t==(r<0?0:nu(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=Zh(e)+(r<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(r<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=r<0?nu(e):0}}}function nu(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function iu(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function ru(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 ou(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 su{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?nu(t):0),n,Math.min(e.focusOffset,n?nu(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let au,lu=null;function cu(e){if(e.setActive)return e.setActive();if(lu)return e.focus(lu);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==lu?{get preventScroll(){return lu={preventScroll:!0},!0}}:void 0),!lu){lu=!1;for(let e=0;e<t.length;){let n=t[e++],i=t[e++],r=t[e++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}}}function hu(e,t,n=t){let i=au||(au=document.createRange());return i.setEnd(e,n),i.setStart(e,t),i}function uu(e,t,n,i){let r={key:t,code:t,keyCode:n,which:n,cancelable:!0};i&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let o=new KeyboardEvent("keydown",r);o.synthetic=!0,e.dispatchEvent(o);let s=new KeyboardEvent("keyup",r);return s.synthetic=!0,e.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function du(e){for(;e.attributes.length;)e.removeAttributeNode(e.attributes[0])}function pu(e){return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function fu(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=nu(n)}else{if(!n.parentNode||eu(n))return null;i=Zh(n),n=n.parentNode}}}function gu(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||eu(n))return null;i=Zh(n)+1,n=n.parentNode}}}class mu{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new mu(e.parentNode,Zh(e),t)}static after(e,t){return new mu(e.parentNode,Zh(e)+1,t)}}const vu=[];class yu{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,r=null;for(let o of this.children){if(7&o.flags){if(!o.dom&&(n=r?r.nextSibling:i.firstChild)){let e=yu.get(n);(!e||!e.parent&&e.canReuseDOM(o))&&o.reuseDOM(n)}o.sync(e,t),o.flags&=-8}if(n=r?r.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&n!=o.dom&&(t.written=!0),o.dom.parentNode==i)for(;n&&n!=o.dom;)n=wu(n);else i.insertBefore(o.dom,n);r=o.dom}for(n=r?r.nextSibling:i.firstChild,n&&t&&t.node==i&&(t.written=!0);n;)n=wu(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==nu(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&&!yu.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,r=-1,o=-1,s=-1;for(let a=0,l=n,c=n;a<this.children.length;a++){let n=this.children[a],h=l+n.length;if(l<e&&h>t)return n.domBoundsAround(e,t,l);if(h>=e&&-1==i&&(i=a,r=l),l>t&&n.dom.parentNode==this.dom){o=a,s=c;break}c=h,l=h+n.breakAfter}return{from:r,to:s<0?n+this.length:s,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].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=vu){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 bu(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,r,o){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 wu(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}yu.prototype.breakAfter=0;class bu{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 xu(e,t,n,i,r,o,s,a,l){let{children:c}=e,h=c.length?c[t]:null,u=o.length?o[o.length-1]:null,d=u?u.breakAfter:s;if(!(t==i&&h&&!s&&!d&&o.length<2&&h.merge(n,r,o.length?u:null,0==n,a,l))){if(i<c.length){let e=c[i];e&&(r<e.length||e.breakAfter&&(null==u?void 0:u.breakAfter))?(t==i&&(e=e.split(r),r=0),!d&&u&&e.merge(0,r,u,!0,0,l)?o[o.length-1]=e:((r||e.children.length&&!e.children[0].length)&&e.merge(0,r,null,!1,0,l),o.push(e))):(null==e?void 0:e.breakAfter)&&(u?u.breakAfter=1:s=1),i++}for(h&&(h.breakAfter=s,n>0&&(!s&&o.length&&h.merge(n,h.length,o[0],!1,a,0)?h.breakAfter=o.shift().breakAfter:(n<h.length||h.children.length&&0==h.children[h.children.length-1].length)&&h.merge(n,h.length,null,!1,a,0),t++));t<i&&o.length;)if(c[i-1].become(o[o.length-1]))i--,o.pop(),l=o.length?0:a;else{if(!c[t].become(o[0]))break;t++,o.shift(),a=o.length?0:l}!o.length&&t&&i<c.length&&!c[t-1].breakAfter&&c[i].merge(0,0,c[t-1],!1,a,l)&&t--,(t<i||o.length)&&e.replaceChildren(t,i,o)}}function _u(e,t,n,i,r,o){let s=e.childCursor(),{i:a,off:l}=s.findPos(n,1),{i:c,off:h}=s.findPos(t,-1),u=t-n;for(let e of i)u+=e.length;e.length+=u,xu(e,c,h,a,l,i,0,r,o)}let Su="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},ku="undefined"!=typeof document?document:{documentElement:{style:{}}};const Cu=/Edge\/(\d+)/.exec(Su.userAgent),Eu=/MSIE \d/.test(Su.userAgent),Mu=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Su.userAgent),Au=!!(Eu||Mu||Cu),Ru=!Au&&/gecko\/(\d+)/i.test(Su.userAgent),Tu=!Au&&/Chrome\/(\d+)/.exec(Su.userAgent),Du="webkitFontSmoothing"in ku.documentElement.style,Ou=!Au&&/Apple Computer/.test(Su.vendor),Nu=Ou&&(/Mobile\/\w+/.test(Su.userAgent)||Su.maxTouchPoints>2);var Pu={mac:Nu||/Mac/.test(Su.platform),windows:/Win/.test(Su.platform),linux:/Linux|X11/.test(Su.platform),ie:Au,ie_version:Eu?ku.documentMode||6:Mu?+Mu[1]:Cu?+Cu[1]:0,gecko:Ru,gecko_version:Ru?+(/Firefox\/(\d+)/.exec(Su.userAgent)||[0,0])[1]:0,chrome:!!Tu,chrome_version:Tu?+Tu[1]:0,ios:Nu,android:/Android\b/.test(Su.userAgent),webkit:Du,safari:Ou,webkit_version:Du?+(/\bAppleWebKit\/(\d+)/.exec(Su.userAgent)||[0,0])[1]:0,tabSize:null!=ku.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class qu extends yu{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 qu)||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 qu(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 mu(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 r=t,o=t,s=0;0==t&&n<0||t==i&&n>=0?Pu.chrome||Pu.gecko||(t?(r--,s=1):o<i&&(o++,s=-1)):n<0?r--:o<i&&o++;let a=hu(e,r,o).getClientRects();if(!a.length)return null;let l=a[(s?s<0:n>=0)?0:a.length-1];Pu.safari&&!s&&0==l.width&&(l=Array.prototype.find.call(a,(e=>e.width))||l);return s?iu(l,s<0):l||null}(this.dom,e,t)}}class Bu extends yu{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(du(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,r,o){return(!n||!(!(n instanceof Bu&&n.mark.eq(this.mark))||e&&r<=0||t<this.length&&o<=0))&&(_u(this,e,t,n?n.children.slice():[],r-1,o-1),this.markDirty(),!0)}split(e){let t=[],n=0,i=-1,r=0;for(let o of this.children){let s=n+o.length;s>e&&t.push(n<e?o.split(e-n):o),i<0&&n>=e&&(i=r),n=s,r++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new Bu(this.mark,t,o)}domAtPos(e){return ju(this,e)}coordsAt(e,t){return Vu(this,e,t)}}class Lu extends yu{static create(e,t,n){return new Lu(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Lu.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,r,o){return!(n&&(!(n instanceof Lu&&this.widget.compare(n.widget))||e>0&&r<=0||t<this.length&&o<=0))&&(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof Lu&&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 lc.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):lc.empty}domAtPos(e){return(this.length?0==e:this.side>0)?mu.before(this.dom):mu.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(),r=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let t=o?i.length-1:0;r=i[t],!(e>0?0==t:t==i.length-1||r.top<r.bottom);t+=o?-1:1);return iu(r,!o)}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 Iu extends yu{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Iu&&e.side==this.side}split(){return new Iu(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?mu.before(this.dom):mu.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return lc.empty}get isHidden(){return!0}}function ju(e,t){let n=e.dom,{children:i}=e,r=0;for(let e=0;r<i.length;r++){let o=i[r],s=e+o.length;if(!(s==e&&o.getSide()<=0)){if(t>e&&t<s&&o.dom.parentNode==n)return o.domAtPos(t-e);if(t<=e)break;e=s}}for(let e=r;e>0;e--){let t=i[e-1];if(t.dom.parentNode==n)return t.domAtPos(t.length)}for(let e=r;e<i.length;e++){let t=i[e];if(t.dom.parentNode==n)return t.domAtPos(0)}return new mu(n,0)}function Fu(e,t,n){let i,{children:r}=e;n>0&&t instanceof Bu&&r.length&&(i=r[r.length-1])instanceof Bu&&i.mark.eq(t.mark)?Fu(i,t.children[0],n-1):(r.push(t),t.setParent(e)),e.length+=t.length}function Vu(e,t,n){let i=null,r=-1,o=null,s=-1;!function e(t,a){for(let l=0,c=0;l<t.children.length&&c<=a;l++){let h=t.children[l],u=c+h.length;u>=a&&(h.children.length?e(h,a-c):(!o||o.isHidden&&n>0)&&(u>a||c==u&&h.getSide()>0)?(o=h,s=a-c):(c<a||c==u&&h.getSide()<0&&!h.isHidden)&&(i=h,r=a-c)),c=u}}(e,t);let a=(n<0?i:o)||i||o;return a?a.coordsAt(Math.max(0,a==i?r:s),n):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Jh(t);return n[n.length-1]||null}(e)}function $u(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}qu.prototype.children=Lu.prototype.children=Iu.prototype.children=vu;const zu=Object.create(null);function Hu(e,t,n){if(e==t)return!0;e||(e=zu),t||(t=zu);let i=Object.keys(e),r=Object.keys(t);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let o of i)if(o!=n&&(-1==r.indexOf(o)||e[o]!==t[o]))return!1;return!0}function Wu(e,t,n){let i=!1;if(t)for(let r in t)n&&r in n||(i=!0,"style"==r?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(i=!0,"style"==r?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return i}function Uu(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 Gu{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 Ku=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(Ku||(Ku={}));class Xu extends _h{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 Yu(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 Qu(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:r,end:o}=Zu(e,i);t=(r?i?-3e8:-1:5e8)-1,n=1+(o?i?2e8:1:-6e8)}return new Qu(e,t,n,i,e.widget||null,!0)}static line(e){return new Ju(e)}static set(e,t=!1){return Eh.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Xu.none=Eh.empty;class Yu extends Xu{constructor(e){let{start:t,end:n}=Zu(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 Yu&&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))&&Hu(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)}}Yu.prototype.point=!1;class Ju extends Xu{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Ju&&this.spec.class==e.spec.class&&Hu(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)}}Ju.prototype.mapMode=bc.TrackBefore,Ju.prototype.point=!0;class Qu extends Xu{constructor(e,t,n,i,r,o){super(t,n,r,e),this.block=i,this.isReplace=o,this.mapMode=i?t<=0?bc.TrackBefore:bc.TrackAfter:bc.TrackDel}get type(){return this.startSide!=this.endSide?Ku.WidgetRange:this.startSide<=0?Ku.WidgetBefore:Ku.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Qu&&(t=this.widget,n=e.widget,t==n||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}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 Zu(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 ed(e,t,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=e?n[r]=Math.max(n[r],t):n.push(e,t)}Qu.prototype.point=!0;class td extends yu{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,i,r,o){if(n){if(!(n instanceof td))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),_u(this,e,t,n?n.children.slice():[],r,o),!0}split(e){let t=new td;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){Hu(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Fu(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=$u(t,this.attrs||{})),n&&(this.attrs=$u({class:n},this.attrs||{}))}domAtPos(e){return ju(this,e)}reuseDOM(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?4&this.flags&&(du(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&&(Wu(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&&yu.get(i)instanceof Bu;)i=i.lastChild;if(!(i&&this.length&&("BR"==i.nodeName||0!=(null===(n=yu.get(i))||void 0===n?void 0:n.isEditable)||Pu.ios&&this.children.some((e=>e instanceof qu))))){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 qu)||/[^ -~]/.test(n.text))return null;let i=Jh(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=Vu(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 td&&0==this.children.length&&0==e.children.length&&Hu(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 r=e.children[n],o=i+r.length;if(o>=t){if(r instanceof td)return r;if(o>t)break}i=o+r.breakAfter}return null}}class nd extends yu{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,r,o){return!(n&&(!(n instanceof nd&&this.widget.compare(n.widget))||e>0&&r<=0||t<this.length&&o<=0))&&(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return 0==e?mu.before(this.dom):mu.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new nd(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return vu}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):lc.empty}domBoundsAround(){return null}become(e){return e instanceof nd&&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 id?null:iu(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 id extends Gu{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 rd{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 nd&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new td),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(od(new Iu(-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 nd||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(od(new qu(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,r,o){if(this.disallowBlockEffectsFor[o]&&n instanceof Qu){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 Qu)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new nd(n.widget||sd.block,s,n));else{let o=Lu.create(n.widget||sd.inline,s,s?0:n.startSide),a=this.atCursorPos&&!o.isEditable&&r<=i.length&&(e<t||n.startSide>0),l=!o.isEditable&&(e<t||r>i.length||n.startSide<=0),c=this.getLine();2!=this.pendingBuffer||a||o.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),a&&(c.append(od(new Iu(1),i),r),r=i.length+Math.max(0,r-i.length)),c.append(od(o,i),r),this.atCursorPos=l,this.pendingBuffer=l?e<t||r>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=r)}static build(e,t,n,i,r){let o=new rd(e,t,n,r);return o.openEnd=Eh.spans(i,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function od(e,t){for(let n of t)e=new Bu(n,[e],e.length);return e}class sd extends Gu{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}}sd.inline=new sd("span"),sd.block=new sd("div");var ad=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(ad||(ad={}));const ld=ad.LTR,cd=ad.RTL;function hd(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const ud=hd("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),dd=hd("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),pd=Object.create(null),fd=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);pd[t]=n,pd[n]=-t}function gd(e){return e<=247?ud[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?dd[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const md=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class vd{get dir(){return this.level%2?cd:ld}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 r=-1;for(let o=0;o<e.length;o++){let s=e[o];if(s.from<=t&&s.to>=t){if(s.level==n)return o;(r<0||(0!=i?i<0?s.from<t:s.to>t:e[r].level>s.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function yd(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!yd(i.inner,r.inner))return!1}return!0}const wd=[];function bd(e,t,n,i,r,o,s){let a=i%2?2:1;if(i%2==r%2)for(let l=t,c=0;l<n;){let t=!0,h=!1;if(c==o.length||l<o[c].from){let e=wd[l];e!=a&&(t=!1,h=16==e)}let u=t||1!=a?null:[],d=t?i:i+1,p=l;e:for(;;)if(c<o.length&&p==o[c].from){if(h)break e;let f=o[c];if(!t)for(let e=f.to,t=c+1;;){if(e==n)break e;if(!(t<o.length&&o[t].from==e)){if(wd[e]==a)break e;break}e=o[t++].to}if(c++,u)u.push(f);else{f.from>l&&s.push(new vd(l,f.from,d)),xd(e,f.direction==ld!=!(d%2)?i+1:i,r,f.inner,f.from,f.to,s),l=f.to}p=f.to}else{if(p==n||(t?wd[p]!=a:wd[p]==a))break;p++}u?bd(e,l,p,i+1,r,u,s):l<p&&s.push(new vd(l,p,d)),l=p}else for(let l=n,c=o.length;l>t;){let n=!0,h=!1;if(!c||l>o[c-1].to){let e=wd[l-1];e!=a&&(n=!1,h=16==e)}let u=n||1!=a?null:[],d=n?i:i+1,p=l;e:for(;;)if(c&&p==o[c-1].to){if(h)break e;let f=o[--c];if(!n)for(let e=f.from,n=c;;){if(e==t)break e;if(!n||o[n-1].to!=e){if(wd[e-1]==a)break e;break}e=o[--n].from}if(u)u.push(f);else{f.to<l&&s.push(new vd(f.to,l,d)),xd(e,f.direction==ld!=!(d%2)?i+1:i,r,f.inner,f.from,f.to,s),l=f.from}p=f.from}else{if(p==t||(n?wd[p-1]!=a:wd[p-1]==a))break;p--}u?bd(e,p,l,i+1,r,u,s):p<l&&s.push(new vd(p,l,d)),l=p}}function xd(e,t,n,i,r,o,s){let a=t%2?2:1;!function(e,t,n,i,r){for(let o=0;o<=i.length;o++){let s=o?i[o-1].to:t,a=o<i.length?i[o].from:n,l=o?256:r;for(let t=s,n=l,i=l;t<a;t++){let r=gd(e.charCodeAt(t));512==r?r=n:8==r&&4==i&&(r=16),wd[t]=4==r?2:r,7&r&&(i=r),n=r}for(let e=s,t=l,i=l;e<a;e++){let r=wd[e];if(128==r)e<a-1&&t==wd[e+1]&&24&t?r=wd[e]=t:wd[e]=256;else if(64==r){let r=e+1;for(;r<a&&64==wd[r];)r++;let o=e&&8==t||r<n&&8==wd[r]?1==i?1:8:256;for(let t=e;t<r;t++)wd[t]=o;e=r-1}else 8==r&&1==i&&(wd[e]=1);t=r,7&r&&(i=r)}}}(e,r,o,i,a),function(e,t,n,i,r){let o=1==r?2:1;for(let s=0,a=0,l=0;s<=i.length;s++){let c=s?i[s-1].to:t,h=s<i.length?i[s].from:n;for(let t,n,i,s=c;s<h;s++)if(n=pd[t=e.charCodeAt(s)])if(n<0){for(let e=a-3;e>=0;e-=3)if(fd[e+1]==-n){let t=fd[e+2],n=2&t?r:4&t?1&t?o:r:0;n&&(wd[s]=wd[fd[e]]=n),a=e;break}}else{if(189==fd.length)break;fd[a++]=s,fd[a++]=t,fd[a++]=l}else if(2==(i=wd[s])||1==i){let e=i==r;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=fd[t+2];if(2&n)break;if(e)fd[t+2]|=2;else{if(4&n)break;fd[t+2]|=4}}}}}(e,r,o,i,a),function(e,t,n,i){for(let r=0,o=i;r<=n.length;r++){let s=r?n[r-1].to:e,a=r<n.length?n[r].from:t;for(let l=s;l<a;){let s=wd[l];if(256==s){let s=l+1;for(;;)if(s==a){if(r==n.length)break;s=n[r++].to,a=r<n.length?n[r].from:t}else{if(256!=wd[s])break;s++}let c=1==o,h=c==(1==(s<t?wd[s]:i))?c?1:2:i;for(let t=s,i=r,o=i?n[i-1].to:e;t>l;)t==o&&(t=n[--i].from,o=i?n[i-1].to:e),wd[--t]=h;l=s}else o=s,l++}}}(r,o,i,a),bd(e,r,o,t,n,i,s)}function _d(e){return[new vd(0,e,0)]}let Sd="";function kd(e,t,n,i,r){var o;let s=i.head-e.from,a=vd.find(t,s,null!==(o=i.bidiLevel)&&void 0!==o?o:-1,i.assoc),l=t[a],c=l.side(r,n);if(s==c){let e=a+=r?1:-1;if(e<0||e>=t.length)return null;l=t[a=e],s=l.side(!r,n),c=l.side(r,n)}let h=yc(e.text,s,l.forward(r,n));(h<l.from||h>l.to)&&(h=c),Sd=e.text.slice(Math.min(s,h),Math.max(s,h));let u=a==(r?t.length-1:0)?null:t[a+(r?1:-1)];return u&&h==c&&u.level+(r?0:1)<l.level?Tc.cursor(u.side(!r,n)+e.from,u.forward(r,n)?1:-1,u.level):Tc.cursor(h+e.from,l.forward(r,n)?-1:1,l.level)}function Cd(e,t,n){for(let i=t;i<n;i++){let t=gd(e.charCodeAt(i));if(1==t)return ld;if(2==t||4==t)return cd}return ld}const Ed=Nc.define(),Md=Nc.define(),Ad=Nc.define(),Rd=Nc.define(),Td=Nc.define(),Dd=Nc.define(),Od=Nc.define(),Nd=Nc.define(),Pd=Nc.define(),qd=Nc.define({combine:e=>e.some((e=>e))}),Bd=Nc.define({combine:e=>e.some((e=>e))}),Ld=Nc.define();class Id{constructor(e,t="nearest",n="nearest",i=5,r=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new Id(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 Id(Tc.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const jd=ch.define({map:(e,t)=>e.map(t)}),Fd=ch.define();function Vd(e,t,n){let i=e.facet(Rd);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 $d=Nc.define({combine:e=>!e.length||e[0]});let zd=0;const Hd=Nc.define();class Wd{constructor(e,t,n,i,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.extension=r(this)}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:r,decorations:o}=t||{};return new Wd(zd++,e,n,i,(e=>{let t=[Hd.of(e)];return o&&t.push(Xd.of((t=>{let n=t.plugin(e);return n?o(n):Xu.none}))),r&&t.push(r(e)),t}))}static fromClass(e,t){return Wd.define((t=>new e(t)),t)}}class Ud{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(Vd(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){Vd(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){Vd(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Gd=Nc.define(),Kd=Nc.define(),Xd=Nc.define(),Yd=Nc.define(),Jd=Nc.define(),Qd=Nc.define();function Zd(e,t){let n=e.state.facet(Qd);if(!n.length)return n;let i=n.map((t=>t instanceof Function?t(e):t)),r=[];return Eh.spans(i,t.from,t.to,{point(){},span(e,n,i,o){let s=e-t.from,a=n-t.from,l=r;for(let e=i.length-1;e>=0;e--,o--){let n,r=i[e].spec.bidiIsolate;if(null==r&&(r=Cd(t.text,s,a)),o>0&&l.length&&(n=l[l.length-1]).to==s&&n.direction==r)n.to=a,l=n.inner;else{let e={from:s,to:a,direction:r,inner:[]};l.push(e),l=e.inner}}}}),r}const ep=Nc.define();function tp(e){let t=0,n=0,i=0,r=0;for(let o of e.state.facet(ep)){let s=o(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&&(r=Math.max(r,s.bottom)))}return{left:t,right:n,top:i,bottom:r}}const np=Nc.define();class ip{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new ip(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,r=0,o=0,s=0;;i++){let a=i==e.length?null:e[i],l=o-s,c=a?a.fromB:1e9;for(;r<t.length&&t[r]<c;){let e=t[r],i=t[r+1],o=Math.max(s,e),a=Math.min(c,i);if(o<=a&&new ip(o+l,a+l,o,a).addToSet(n),i>c)break;r+=2}if(!a)return n;new ip(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),o=a.toA,s=a.toB}}}class rp{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=_c.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,r)=>i.push(new ip(e,t,n,r)))),this.changedRanges=i}static create(e,t,n){return new rp(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 op extends yu{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=Xu.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 td],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ip(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 r=i>-1?function(e,t,n){let i=sp(e,n);if(!i)return null;let{node:r,from:o,to:s}=i,a=r.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 ip(l.mapPos(o),l.mapPos(s),o,s),h=[];for(let t=r.parentNode;;t=t.parentNode){let n=yu.get(t);if(n instanceof Bu)h.push({node:t,deco:n.mark});else{if(n instanceof td||"DIV"==t.nodeName&&t.parentNode==e.contentDOM)return{range:c,text:r,marks:h,line:t};if(t==e.contentDOM)return null;h.push({node:t,deco:new Yu({inclusive:!0,attributes:Uu(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 ip(t,i,e.changes.mapPos(t,-1),e.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Pu.ie||Pu.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=function(e,t,n){let i=new ap;return Eh.compare(e,t,n,i),i.changes}(this.decorations,this.updateDeco(),e.changes);return n=ip.extendWithRanges(n,o),!!(7&this.flags||0!=n.length)&&(this.updateInner(n,e.startState.doc.length,r),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=Pu.chrome||Pu.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 r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.children)e instanceof nd&&e.widget instanceof id&&r.push(e.dom);i.updateGaps(r)}updateChildren(e,t,n){let i=n?n.range.addToSet(e.slice()):e,r=this.childCursor(t);for(let e=i.length-1;;e--){let t=e>=0?i[e]:null;if(!t)break;let o,s,a,l,{fromA:c,toA:h,fromB:u,toB:d}=t;if(n&&n.range.fromB<d&&n.range.toB>u){let e=rd.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),t=rd.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(),o=e.content.concat(i).concat(t.content)}else({content:o,breakAtStart:s,openStart:a,openEnd:l}=rd.build(this.view.state.doc,u,d,this.decorations,this.dynamicDecorationMap));let{i:p,off:f}=r.findPos(h,1),{i:g,off:m}=r.findPos(c,-1);xu(this,g,m,p,f,o,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(Fd)&&(this.editContextFormatting=e.value)}compositionView(e){let t=new qu(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new Bu(n,[t],t.length);let n=new td;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=yu.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 r=e.marks.length-1;r>=-1;r--)n=i.childPos(n.off,1),i=i.children[n.i],t(r>=0?e.marks[r].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,r=!i&&!(this.view.state.facet($d)||this.dom.tabIndex>-1)&&Yh(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||t||r))return;let o=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(Pu.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 mu(e,0),o=!0}var c;let h=this.view.observer.selectionRange;!o&&h.focusNode&&(Qh(a.node,a.offset,h.anchorNode,h.anchorOffset)&&Qh(l.node,l.offset,h.focusNode,h.focusOffset)||this.suppressWidgetCursorChange(h,s))||(this.view.observer.ignore((()=>{Pu.android&&Pu.chrome&&this.dom.contains(h.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}(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=Kh(this.view.root);if(e)if(s.empty){if(Pu.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?fu:gu)(a.node,a.offset);t&&(a=new mu(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;r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new mu(h.anchorNode,h.anchorOffset),this.impreciseHead=l.precise?null:new mu(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Qh(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=Kh(e.root),{anchorNode:i,anchorOffset:r}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let o=td.find(this,t.head);if(!o)return;let s=o.posAtStart;if(t.head==s||t.head==s+o.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 h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(i,r)}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=yu.get(n.childNodes[i]);e instanceof td&&(t=e.domAtPos(0))}for(let i=e.offset-1;!t&&i>=0;i--){let e=yu.get(n.childNodes[i]);e instanceof td&&(t=e.domAtPos(e.length))}return t?new mu(t.node,t.offset,!0):e}nearest(e){for(let t=e;t;){let e=yu.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 td)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,i=0;for(let r=this.length,o=this.children.length-1;o>=0;o--){let s=this.children[o],a=r-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 td&&!(n instanceof td&&t>=0)))n=s,i=l;else if(n&&l==e&&a==e&&s instanceof nd&&Math.abs(t)<2){if(s.deco.startSide<0)break;o&&(n=null)}r=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 td))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 qu))return null;let r=yc(i.text,n);if(r==n)return null;let o=hu(i.dom,n,r).getClientRects();for(let e=0;e<o.length;e++){let t=o[e];if(e==o.length-1||t.top<t.bottom&&t.left<t.right)return t}return null}measureVisibleLineHeights(e){let t=[],{from:n,to:i}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==ad.LTR;for(let e=0,l=0;l<this.children.length;l++){let c=this.children[l],h=e+c.length;if(h>i)break;if(e>=n){let n=c.dom.getBoundingClientRect();if(t.push(n.height),o){let t=c.dom.lastChild,i=t?Jh(t):[];if(i.length){let t=i[i.length-1],o=a?t.right-n.left:n.right-t.left;o>s&&(s=o,this.minWidth=r,this.minWidthFrom=e,this.minWidthTo=h)}}}e=h+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return"rtl"==getComputedStyle(this.children[t].dom).direction?ad.RTL:ad.LTR}measureTextSize(){for(let e of this.children)if(e instanceof td){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 r=Jh(i.firstChild)[0];e=i.getBoundingClientRect().height,t=r?r.width/27:7,n=r?r.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 bu(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let r=i==t.viewports.length?null:t.viewports[i],o=r?r.from-1:this.length;if(o>n){let i=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(Xu.replace({widget:new id(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return Xu.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Xd).map((t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t)),n=!1,i=this.view.state.facet(Yd).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(Eh.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(Ld))try{if(t(this.view,e.range,e))return!0}catch(e){Vd(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 r=tp(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:s,offsetHeight:a}=this.view.scrollDOM;!function(e,t,n,i,r,o,s,a){let l=e.ownerDocument,c=l.defaultView||window;for(let h=e,u=!1;h&&!u;)if(1==h.nodeType){let e,d=h==l.body,p=1,f=1;if(d)e=ru(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let t=h.getBoundingClientRect();({scaleX:p,scaleY:f}=ou(h,t)),e={left:t.left,right:t.left+h.clientWidth*p,top:t.top,bottom:t.top+h.clientHeight*f}}let g=0,m=0;if("nearest"==r)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,o=e.bottom-e.top;m=("center"==r&&i<=o?t.top+i/2-o/2:"start"==r||"center"==r&&n<0?t.top-s:t.bottom-o+s)-e.top}if("nearest"==i?t.left<e.left?(g=-(e.left-t.left+o),n>0&&t.right>e.right+g&&(g=t.right-e.right+g+o)):t.right>e.right&&(g=t.right-e.right+o,n<0&&t.left<e.left+g&&(g=-(e.left+g-t.left+o))):g=("center"==i?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==i==a?t.left-o:t.right-(e.right-e.left)+o)-e.left,g||m)if(d)c.scrollBy(g,m);else{let e=0,n=0;if(m){let e=h.scrollTop;h.scrollTop+=m/f,n=(h.scrollTop-e)*f}if(g){let t=h.scrollLeft;h.scrollLeft+=g/p,e=(h.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&&(r="nearest")}if(d)break;h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}(this.view.scrollDOM,o,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==ad.LTR)}}function sp(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let i=fu(n.focusNode,n.focusOffset),r=gu(n.focusNode,n.focusOffset),o=i||r;if(r&&i&&r.node!=i.node){let t=yu.get(r.node);if(!t||t instanceof qu&&t.text!=r.node.nodeValue)o=r;else if(e.docView.lastCompositionAfterCursor){let e=yu.get(i.node);!e||e instanceof qu&&e.text!=i.node.nodeValue||(o=r)}}if(e.docView.lastCompositionAfterCursor=o!=i,!o)return null;let s=t-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}let ap=class{constructor(){this.changes=[]}compareRange(e,t){ed(e,t,this.changes)}comparePoint(e,t){ed(e,t,this.changes)}boundChange(e){ed(e,e,this.changes)}};function lp(e,t){return t.left>e?t.left-e:Math.max(0,e-t.right)}function cp(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function hp(e,t){return e.top<t.bottom-1&&e.bottom>t.top+1}function up(e,t){return t<e.top?{top:t,left:e.left,right:e.right,bottom:e.bottom}:e}function dp(e,t){return t>e.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function pp(e,t,n){let i,r,o,s,a,l,c,h,u=!1;for(let d=e.firstChild;d;d=d.nextSibling){let e=Jh(d);for(let p=0;p<e.length;p++){let f=e[p];r&&hp(r,f)&&(f=up(dp(f,r.bottom),r.top));let g=lp(t,f),m=cp(n,f);if(0==g&&0==m)return 3==d.nodeType?fp(d,t,n):pp(d,t,n);if(!i||s>m||s==m&&o>g){i=d,r=f,o=g,s=m;let a=m?n<f.top?-1:1:g?t<f.left?-1:1:0;u=!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&&(!h||h.top>f.top)&&(l=d,h=f):c&&hp(c,f)?c=dp(c,f.bottom):h&&hp(h,f)&&(h=up(h,f.top))}}if(c&&c.bottom>=n?(i=a,r=c):h&&h.top<=n&&(i=l,r=h),!i)return{node:e,offset:0};let d=Math.max(r.left,Math.min(r.right,t));return 3==i.nodeType?fp(i,d,n):u&&"false"!=i.contentEditable?pp(i,d,n):{node:e,offset:Array.prototype.indexOf.call(e.childNodes,i)+(t>=(r.left+r.right)/2?1:0)}}function fp(e,t,n){let i=e.nodeValue.length,r=-1,o=1e9,s=0;for(let a=0;a<i;a++){let i=hu(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 h=(c.top>n?c.top-n:n-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&h<o){let n=t>=(c.left+c.right)/2,i=n;if(Pu.chrome||Pu.gecko){hu(e,a).getBoundingClientRect().left==c.right&&(i=!n)}if(h<=0)return{node:e,offset:a+(i?1:0)};r=a+(i?1:0),o=h}}}return{node:e,offset:r>-1?r:s>0?e.nodeValue.length:0}}function gp(e,t,n,i=-1){var r,o;let s,a=e.contentDOM.getBoundingClientRect(),l=a.top+e.viewState.paddingTop,{docHeight:c}=e.viewState,{x:h,y:u}=t,d=u-l;if(d<0)return 0;if(d>c)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,r=!1;s=e.elementAtHeight(d),s.type!=Ku.Text;)for(;d=i>0?s.bottom+t:s.top-t,!(d>=0&&d<=c);){if(r)return n?null:0;r=!0,i=-i}u=l+d;let p=s.from;if(p<e.viewport.from)return 0==e.viewport.from?0:n?null:mp(e,a,s,h,u);if(p>e.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:mp(e,a,s,h,u);let f=e.dom.ownerDocument,g=e.root.elementFromPoint?e.root:f,m=g.elementFromPoint(h,u);m&&!e.contentDOM.contains(m)&&(m=null),m||(h=Math.max(a.left+1,Math.min(a.right-1,h)),m=g.elementFromPoint(h,u),m&&!e.contentDOM.contains(m)&&(m=null));let v,y=-1;if(m&&0!=(null===(r=e.docView.nearest(m))||void 0===r?void 0:r.isEditable)){if(f.caretPositionFromPoint){let e=f.caretPositionFromPoint(h,u);e&&({offsetNode:v,offset:y}=e)}else if(f.caretRangeFromPoint){let t=f.caretRangeFromPoint(h,u);t&&(({startContainer:v,startOffset:y}=t),(!e.contentDOM.contains(v)||Pu.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 hu(e,i-1,i).getBoundingClientRect().left>n}(v,y,h)||Pu.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():hu(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect();return n-i.left>5}(v,y,h))&&(v=void 0))}v&&(y=Math.min(nu(v),y))}if(!v||!e.docView.dom.contains(v)){let t=td.find(e.docView,p);if(!t)return d>s.top+s.height/2?s.to:s.from;({node:v,offset:y}=pp(t.dom,h,u))}let w=e.docView.nearest(v);if(!w)return null;if(w.isWidget&&1==(null===(o=w.dom)||void 0===o?void 0:o.nodeType)){let e=w.dom.getBoundingClientRect();return t.y<e.top||t.y<=e.bottom&&t.x<=(e.left+e.right)/2?w.posAtStart:w.posAtEnd}return w.localPosFromDOM(v,y)+w.posAtStart}function mp(e,t,n,i,r){let o=Math.round((i-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;o+=Math.floor((r-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,r=0;;){if(r>=t)return i;if(i==e.length)break;r+=9==e.charCodeAt(i)?n-r%n:1,i=yc(e,i)}return!0===i?-1:e.length}(s,o,e.state.tabSize)}function vp(e,t,n,i){let r=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==Ku.Text))return e;return n}(e,t.head),o=i&&r.type==Ku.Text&&(e.lineWrapping||r.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head):null;if(o){let t=e.dom.getBoundingClientRect(),i=e.textDirectionAt(r.from),s=e.posAtCoords({x:n==(i==ad.LTR)?t.right-1:t.left+1,y:(o.top+o.bottom)/2});if(null!=s)return Tc.cursor(s,n?-1:1)}return Tc.cursor(n?r.to:r.from,n?-1:1)}function yp(e,t,n,i){let r=e.state.doc.lineAt(t.head),o=e.bidiSpans(r),s=e.textDirectionAt(r.from);for(let a=t,l=null;;){let t=kd(r,o,s,a,n),c=Sd;if(!t){if(r.number==(n?e.state.doc.lines:1))return a;c="\n",r=e.state.doc.line(r.number+(n?1:-1)),o=e.bidiSpans(r),t=e.visualLineSide(r,!n)}if(l){if(!l(c))return a}else{if(!i)return t;l=i(c)}a=t}}function wp(e,t,n){for(;;){let i=0;for(let r of e)r.between(t-1,t+1,((e,r,o)=>{if(t>e&&t<r){let o=i||n||(t-e<r-t?-1:1);t=o<0?e:r,i=o}}));if(!i)return t}}function bp(e,t,n){let i=wp(e.state.facet(Jd).map((t=>t(e))),n.from,t.head>n.from?-1:1);return i==n.from?n:Tc.cursor(i,i<n.from?1:-1)}const xp="";class _p{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(xh.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=xp}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 r=i.nextSibling;if(r==t)break;let o=yu.get(i),s=yu.get(r);(o&&s?o.breakAfter:(o?o.breakAfter:eu(i))||eu(r)&&("BR"!=i.nodeName||i.cmIgnore)&&this.text.length>e)&&this.lineBreak(),i=r}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 r,o=-1,s=1;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(r=i.exec(t))&&(o=r.index,s=r[0].length),this.append(t.slice(n,o<0?t.length:o)),o<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=o+s}}readNode(e){if(e.cmIgnore)return;let t=yu.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+(Sp(e,n.node,n.offset)?t:0))}}function Sp(e,t,n){for(;;){if(!t||n<nu(t))return!1;if(t==e)return!0;n=Zh(t)+1,t=t.parentNode}}class kp{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Cp{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:r,impreciseAnchor:o}=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=r||o?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}=e.observer.selectionRange;n&&(t.push(new kp(n,i)),r==n&&o==i||t.push(new kp(r,o)));return t}(e),n=new _p(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?Tc.single(n+t,i+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=r&&r.node==t.focusNode&&r.offset==t.focusOffset||!Xh(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),i=o&&o.node==t.anchorNode&&o.offset==t.anchorOffset||!Xh(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((Pu.ios||Pu.chrome)&&e.state.selection.main.empty&&n!=i&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,i),r=Math.max(n,i),o=s.from-t,a=s.to-r;0!=o&&1!=o&&0!=t||0!=a&&-1!=a&&r!=e.state.doc.length||(n=0,i=e.state.doc.length)}this.newSel=Tc.single(i,n)}}}function Ep(e,t){let n,{newSel:i}=t,r=e.state.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:i,to:s}=t.bounds,a=r.from,l=null;(8===o||Pu.android&&t.text.length<s-i)&&(a=r.to,l="end");let c=function(e,t,n,i){let r=Math.min(e.length,t.length),o=0;for(;o<r&&e.charCodeAt(o)==t.charCodeAt(o);)o++;if(o==r&&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,o-Math.min(s,a))-o}if(s<o&&e.length<t.length){o-=n<=o&&n>=s?o-n:0,a=o+(a-s),s=o}else if(a<o){o-=n<=o&&n>=a?o-n:0,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}(e.state.doc.sliceString(i,s,xp),t.text,a-i,l);c&&(Pu.chrome&&13==o&&c.toB==c.from+2&&t.text.slice(c.from,c.toB)==xp+xp&&c.toB--,n={from:i+c.from,to:i+c.toA,insert:lc.of(t.text.slice(c.from,c.toB).split(xp))})}else i&&(!e.hasFocus&&e.state.facet($d)||i.main.eq(r))&&(i=null);if(!n&&!i)return!1;if(!n&&t.typeOver&&!r.empty&&i&&i.main.empty?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,r.to)}:(Pu.mac||Pu.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=Tc.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:lc.of([n.insert.toString().replace("."," ")])}):n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,r.to))}:Pu.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(i&&(i=Tc.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:lc.of([" "])}),n)return Mp(e,n,i,o);if(i&&!i.main.eq(r)){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 Mp(e,t,n,i=-1){if(Pu.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(Pu.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&" "==e.state.sliceDoc(t.from,r.from))&&1==t.insert.length&&2==t.insert.lines&&uu(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&0==t.insert.length||8==i&&t.insert.length<t.to-t.from&&t.to>r.head)&&uu(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&0==t.insert.length&&uu(e.contentDOM,"Delete",46)))return!0;let o,s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>o||(o=function(e,t,n){let i,r=e.state,o=r.selection.main;if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=o.from<t.from?r.sliceDoc(o.from,t.from):"",s=o.to>t.to?r.sliceDoc(t.to,o.to):"";i=r.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{let s=r.changes(t),a=n&&n.main.to<=s.newLength?n.main:void 0;if(r.selection.ranges.length>1&&e.inputState.composing>=0&&t.to<=o.to&&t.to>=o.to-10){let l,c=e.state.sliceDoc(t.from,t.to),h=n&&sp(e,n.main.head);if(h){let e=t.insert.length-(t.to-t.from);l={from:h.from,to:h.to-e}}else l=e.state.doc.lineAt(o.head);let u=o.to-t.to,d=o.to-o.from;i=r.changeByRange((n=>{if(n.from==o.from&&n.to==o.to)return{changes:s,range:a||n.map(s)};let i=n.to-u,h=i-c.length;if(n.to-n.from!=d||e.state.sliceDoc(h,i)!=c||n.to>=l.from&&n.from<=l.to)return{range:n};let p=r.changes({from:h,to:i,insert:t.insert}),f=n.to-o.to;return{changes:p,range:a?Tc.range(Math.max(0,a.anchor+f),Math.max(0,a.head+f)):n.map(p)}}))}else i={changes:s,selection:a&&r.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 r.update(i,{userEvent:s,scrollIntoView:!0})}(e,t,n));return e.state.facet(Dd).some((n=>n(e,t.from,t.to,s,a)))||e.dispatch(a()),!0}class Ap{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,Pu.safari&&e.contentDOM.addEventListener("input",(()=>null)),Pu.gecko&&function(e){tf.has(e)||(tf.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=yu.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=Tp(e),n=this.handlers,i=this.view.contentDOM;for(let e in t)if("scroll"!=e){let r=!t[e].handlers.length,o=n[e];o&&r!=!o.handlers.length&&(i.removeEventListener(e,this.handleEvent),o=null),o||i.addEventListener(e,this.handleEvent,{passive:r})}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&&Np.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Pu.android&&Pu.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!Pu.ios||e.synthetic||e.altKey||e.metaKey||!((t=Dp.find((t=>t.keyCode==e.keyCode)))&&!e.ctrlKey||Op.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,uu(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0)))}ignoreDuringComposition(e){return!!/^key/.test(e.type)&&(this.composing>0||!!(Pu.safari&&!Pu.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 Rp(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(e){Vd(n.state,e)}}}function Tp(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 r=e.domEventHandlers[i];r&&n(i).handlers.push(Rp(t.value,r))}if(e&&e.domEventObservers)for(let i in e.domEventObservers){let r=e.domEventObservers[i];r&&n(i).observers.push(Rp(t.value,r))}}for(let e in Bp)n(e).handlers.push(Bp[e]);for(let e in Lp)n(e).observers.push(Lp[e]);return t}const Dp=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Op="dthko",Np=[16,17,18,20,91,92,224,225];function Pp(e){return.7*Math.max(0,e)+8}class qp{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 r=e.parentNode;r&&!(r==i.body||t&&n);)if(1==r.nodeType)!n&&r.scrollHeight>r.clientHeight&&(n=r),!t&&r.scrollWidth>r.clientWidth&&(t=r),r=r.assignedSlot||r.parentNode;else{if(11!=r.nodeType)break;r=r.host}return{x:t,y:n}}(e.contentDOM),this.atoms=e.state.facet(Jd).map((t=>t(e)));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(xh.allowMultipleSelections)&&function(e,t){let n=e.state.facet(Ed);return n.length?n[0](t):Pu.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=Kh(e.root);if(!i||0==i.rangeCount)return!0;let r=i.getRangeAt(0).getClientRects();for(let e=0;e<r.length;e++){let n=r[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!=Xp(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&&(t=this.startEvent,n=e,Math.max(Math.abs(t.clientX-n.clientX),Math.abs(t.clientY-n.clientY))<10))return;var t,n;this.select(this.lastEvent=e);let i=0,r=0,o=0,s=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:o,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=tp(this.view);e.clientX-c.left<=o+6?i=-Pp(o-e.clientX):e.clientX+c.right>=a-6&&(i=Pp(e.clientX-a)),e.clientY-c.top<=s+6?r=-Pp(s-e.clientY):e.clientY+c.bottom>=l-6&&(r=Pp(e.clientY-l)),this.setScrollSpeed(i,r)}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],r=null;if(i.empty){let e=wp(this.atoms,i.from,0);e!=i.from&&(r=Tc.cursor(e,-1))}else{let e=wp(this.atoms,i.from,-1),t=wp(this.atoms,i.to,1);e==i.from&&t==i.to||(r=Tc.range(i.from==i.anchor?e:t,i.from==i.head?e:t))}r&&(t||(t=e.ranges.slice()),t[n]=r)}return t?Tc.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 Bp=Object.create(null),Lp=Object.create(null),Ip=Pu.ie&&Pu.ie_version<15||Pu.ios&&Pu.webkit_version<604;function jp(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function Fp(e,t){t=jp(e.state,Nd,t);let n,{state:i}=e,r=1,o=i.toText(t),s=o.lines==i.selection.ranges.length;if(null!=Jp&&i.selection.ranges.every((e=>e.empty))&&Jp==o.toString()){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?o.line(r++).text:t)+i.lineBreak);return{changes:{from:a.from,insert:l},range:Tc.cursor(n.from+l.length)}}))}else n=s?i.changeByRange((e=>{let t=o.line(r++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Tc.cursor(e.from+t.length)}})):i.replaceSelection(o);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function Vp(e,t,n,i){if(1==i)return Tc.cursor(t,n);if(2==i)return function(e,t,n=1){let i=e.charCategorizer(t),r=e.doc.lineAt(t),o=t-r.from;if(0==r.length)return Tc.cursor(t);0==o?n=1:o==r.length&&(n=-1);let s=o,a=o;n<0?s=yc(r.text,o,!1):a=yc(r.text,o);let l=i(r.text.slice(s,a));for(;s>0;){let e=yc(r.text,s,!1);if(i(r.text.slice(e,s))!=l)break;s=e}for(;a<r.length;){let e=yc(r.text,a);if(i(r.text.slice(a,e))!=l)break;a=e}return Tc.range(s+r.from,a+r.from)}(e.state,t,n);{let n=td.find(e.docView,t),i=e.state.doc.lineAt(n?n.posAtEnd:t),r=n?n.posAtStart:i.from,o=n?n.posAtEnd:i.to;return o<e.state.doc.length&&o==i.to&&o++,Tc.range(r,o)}}Lp.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},Bp.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),Lp.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},Lp.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},Bp.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(Ad))if(n=i(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=Hp(e,t),i=Xp(t),r=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),r=r.map(e.changes))},get(t,o,s){let a,l=Hp(e,t),c=Vp(e,l.pos,l.bias,i);if(n.pos!=l.pos&&!o){let t=Vp(e,n.pos,n.bias,i),r=Math.min(t.from,c.from),o=Math.max(t.to,c.to);c=r<c.from?Tc.range(r,o):Tc.range(o,r)}return o?r.replaceRange(r.main.extend(c.from,c.to)):s&&1==i&&r.ranges.length>1&&(a=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:i,to:r}=e.ranges[n];if(i<=t&&r>=t)return Tc.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}(r,l.pos))?a:s?r.addRange(c):Tc.create([c])}}}(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new qp(e,t,n,i)),i&&e.observer.ignore((()=>{cu(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()}));let r=e.inputState.mouseSelection;if(r)return r.start(t),!1===r.dragging}return!1};let $p=(e,t,n)=>t>=n.top&&t<=n.bottom&&e>=n.left&&e<=n.right;function zp(e,t,n,i){let r=td.find(e.docView,t);if(!r)return 1;let o=t-r.posAtStart;if(0==o)return 1;if(o==r.length)return-1;let s=r.coordsAt(o,-1);if(s&&$p(n,i,s))return-1;let a=r.coordsAt(o,1);return a&&$p(n,i,a)?1:s&&s.bottom>=i?-1:1}function Hp(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:zp(e,n,t.clientX,t.clientY)}}const Wp=Pu.ie&&Pu.ie_version<=11;let Up=null,Gp=0,Kp=0;function Xp(e){if(!Wp)return e.detail;let t=Up,n=Kp;return Up=e,Kp=Date.now(),Gp=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Gp+1)%3:1}function Yp(e,t,n,i){if(!(n=jp(e.state,Nd,n)))return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:o}=e.inputState,s=i&&o&&function(e,t){let n=e.state.facet(Md);return n.length?n[0](t):Pu.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:o.from,to:o.to}:null,a={from:r,insert:n},l=e.state.changes(s?[s,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Bp.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=Tc.range(e,t))}}let{inputState:i}=e;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",jp(e.state,Pd,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},Bp.dragend=e=>(e.inputState.draggedContent=null,!1),Bp.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),r=0,o=()=>{++r==n.length&&Yp(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=o,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(i[e]=t.result),o()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return Yp(e,t,n,!0),!0}return!1},Bp.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Ip?null:t.clipboardData;return n?(Fp(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(),Fp(e,n.value)}),50)}(e),!1)};let Jp=null;Bp.copy=Bp.cut=(e,t)=>{let{text:n,ranges:i,linewise:r}=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 r=-1;for(let{from:i}of e.selection.ranges){let o=e.doc.lineAt(i);o.number>r&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),r=o.number}i=!0}return{text:jp(e,Pd,t.join(e.lineBreak)),ranges:n,linewise:i}}(e.state);if(!n&&!r)return!1;Jp=r?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=Ip?null:t.clipboardData;return o?(o.clearData(),o.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 Qp=sh.define();function Zp(e,t){let n=[];for(let i of e.facet(Od)){let r=i(e,t);r&&n.push(r)}return n?e.update({effects:n,annotations:Qp.of(!0)}):null}function ef(e){setTimeout((()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Zp(e.state,t);n?e.dispatch(n):e.update([])}}),10)}Lp.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),ef(e)},Lp.blur=e=>{e.observer.clearSelectionRange(),ef(e)},Lp.compositionstart=Lp.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},Lp.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,Pu.chrome&&Pu.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then((()=>e.observer.flush())):setTimeout((()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])}),50))},Lp.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},Bp.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"),r=t.getTargetRanges();if(i&&r.length){let t=r[0],n=e.posAtDOM(t.startContainer,t.startOffset),o=e.posAtDOM(t.endContainer,t.endOffset);return Mp(e,{from:n,to:o,insert:e.state.toText(i)},null),!0}}let r;if(Pu.chrome&&Pu.android&&(r=Dp.find((e=>e.inputType==t.inputType)))&&(e.observer.delayAndroidKey(r.key,r.keyCode),"Backspace"==r.key||"Delete"==r.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 Pu.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),Pu.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout((()=>Lp.compositionend(e,t)),20),!1};const tf=new Set;const nf=["pre-wrap","normal","pre-line","break-spaces"];let rf=!1;function of(){rf=!1}class sf{constructor(e){this.lineWrapping=e,this.doc=lc.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 nf.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,r,o){let s=nf.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=r,a){this.heightSamples={};for(let e=0;e<o.length;e++){let t=o[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return a}}class af{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class lf{constructor(e,t,n,i,r){this.from=e,this.length=t,this.top=n,this.height=i,this._content=r}get type(){return"number"==typeof this._content?Ku.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 Qu?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 lf(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var cf=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(cf||(cf={}));const hf=.001;class uf{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)>hf&&(rf=!0),this.height=e)}replace(e,t,n){return uf.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let r=this,o=n.doc;for(let s=i.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:c,toB:h}=i[s],u=r.lineAt(a,cf.ByPosNoHeight,n.setDoc(t),0,0),d=u.to>=l?u:r.lineAt(l,cf.ByPosNoHeight,n,0,0);for(h+=d.to-l,l=d.to;s>0&&u.from<=i[s-1].toA;)a=i[s-1].fromA,c=i[s-1].fromB,s--,a<u.from&&(u=r.lineAt(a,cf.ByPosNoHeight,n,0,0));c+=u.from-a,a=u.from;let p=yf.build(n.setDoc(o),e,c,h);r=df(r,r.replace(a,l,p))}return r.updateHeight(n,0)}static empty(){return new ff(0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,i=0,r=0;for(;;)if(t==n)if(i>2*r){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,1,r.left,r.right),n+=1+r.break,i-=r.size}else{if(!(r>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,r-=t.size}}else if(i<r){let n=e[t++];n&&(i+=n.size)}else{let t=e[--n];t&&(r+=t.size)}let o=0;return null==e[t-1]?(o=1,t--):null==e[t]&&(o=1,n++),new mf(uf.of(e.slice(0,t)),o,uf.of(e.slice(n)))}}function df(e,t){return e==t?e:(e.constructor!=t.constructor&&(rf=!0),t)}uf.prototype.size=1;class pf extends uf{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,i){return new lf(i,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,i,r){return this.blockAt(0,n,i,r)}forEachLine(e,t,n,i,r,o){e<=r+this.length&&t>=r&&o(this.blockAt(0,n,i,r))}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 ff extends pf{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,i){return new lf(i,this.length,n,this.height,this.breaks)}replace(e,t,n){let i=n[0];return 1==n.length&&(i instanceof ff||i instanceof gf&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof gf?i=new ff(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):uf.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 gf extends uf{constructor(e){super(e,0)}heightMetrics(e,t){let n,i=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,o=r-i+1,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*o);n=t/o,this.length>o+1&&(s=(this.height-t)/(this.length-o-1))}else n=this.height/o;return{firstLine:i,lastLine:r,perLine:n,perChar:s}}blockAt(e,t,n,i){let{firstLine:r,lastLine:o,perLine:s,perChar:a}=this.heightMetrics(t,i);if(t.lineWrapping){let r=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),o=t.doc.lineAt(r),l=s+o.length*a,c=Math.max(n,e-l/2);return new lf(o.from,o.length,c,l,0)}{let i=Math.max(0,Math.min(o-r,Math.floor((e-n)/s))),{from:a,length:l}=t.doc.line(r+i);return new lf(a,l,n+s*i,s,0)}}lineAt(e,t,n,i,r){if(t==cf.ByHeight)return this.blockAt(e,n,i,r);if(t==cf.ByPosNoHeight){let{from:t,to:i}=n.doc.lineAt(e);return new lf(t,i-t,0,0,0)}let{firstLine:o,perLine:s,perChar:a}=this.heightMetrics(n,r),l=n.doc.lineAt(e),c=s+l.length*a,h=l.number-o,u=i+s*h+a*(l.from-r-h);return new lf(l.from,l.length,Math.max(i,Math.min(u,i+this.height-c)),c,0)}forEachLine(e,t,n,i,r,o){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:s,perLine:a,perChar:l}=this.heightMetrics(n,r);for(let c=e,h=i;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-s;h+=a*n+l*(e-r-n)}let i=a+l*t.length;o(new lf(t.from,t.length,h,i,0)),h+=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 gf?n[n.length-1]=new gf(e.length+i):n.push(null,new gf(i-1))}if(e>0){let t=n[0];t instanceof gf?n[0]=new gf(e+t.length):n.unshift(new gf(e-1),null)}return uf.of(n)}decomposeLeft(e,t){t.push(new gf(e-1),null)}decomposeRight(e,t){t.push(null,new gf(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let r=t+this.length;if(i&&i.from<=t+this.length&&i.more){let n=[],o=Math.max(t,i.from),s=-1;for(i.from>t&&n.push(new gf(i.from-t-1).updateHeight(e,t));o<=r&&i.more;){let t=e.doc.lineAt(o).length;n.length&&n.push(null);let r=i.heights[i.index++];-1==s?s=r:Math.abs(r-s)>=hf&&(s=-2);let a=new ff(t,r);a.outdated=!1,n.push(a),o+=t+1}o<=r&&n.push(null,new gf(r-o).updateHeight(e,o));let a=uf.of(n);return(s<0||Math.abs(a.height-this.height)>=hf||Math.abs(s-this.heightMetrics(e,t).perLine)>=hf)&&(rf=!0),df(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class mf extends uf{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 r=n+this.left.height;return e<r?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,r,i+this.left.length+this.break)}lineAt(e,t,n,i,r){let o=i+this.left.height,s=r+this.left.length+this.break,a=t==cf.ByHeight?e<o:e<s,l=a?this.left.lineAt(e,t,n,i,r):this.right.lineAt(e,t,n,o,s);if(this.break||(a?l.to<s:l.from>s))return l;let c=t==cf.ByPosNoHeight?cf.ByPosNoHeight:cf.ByPos;return a?l.join(this.right.lineAt(s,c,n,o,s)):this.left.lineAt(s,c,n,i,r).join(l)}forEachLine(e,t,n,i,r,o){let s=i+this.left.height,a=r+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,n,i,r,o),t>=a&&this.right.forEachLine(e,t,n,s,a,o);else{let l=this.lineAt(a,cf.ByPos,n,i,r);e<l.from&&this.left.forEachLine(e,l.from-1,n,i,r,o),l.to>=e&&l.from<=t&&o(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,s,a,o)}}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 r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let e of n)r.push(e);if(e>0&&vf(r,o-1),t<this.length){let e=r.length;this.decomposeRight(t,r),vf(r,e)}return uf.of(r)}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?uf.of(this.break?[e,null,t]:[e,t]):(this.left=df(this.left,e),this.right=df(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:r,right:o}=this,s=t+r.length+this.break,a=null;return i&&i.from<=t+r.length&&i.more?a=r=r.updateHeight(e,t,n,i):r.updateHeight(e,t,n),i&&i.from<=s+o.length&&i.more?a=o=o.updateHeight(e,s,n,i):o.updateHeight(e,s,n),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function vf(e,t){let n,i;null==e[t]&&(n=e[t-1])instanceof gf&&(i=e[t+1])instanceof gf&&e.splice(t-1,3,new gf(n.length+1+i.length))}class yf{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 ff?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new ff(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,r=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new pf(o,i,n)):(o||r||i>=5)&&this.addLineDeco(i,r,o)}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 ff(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new gf(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 ff)return e;let t=new ff(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 ff||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new ff(0,-1));let n=e;for(let e of this.nodes)e instanceof ff&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,i){let r=new yf(n,e);return Eh.spans(t,n,i,r,0),r.finish(n)}}class wf{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&ed(e,t,this.changes,5)}}function bf(e,t){let n=e.getBoundingClientRect(),i=e.ownerDocument,r=i.defaultView||window,o=Math.max(0,n.left),s=Math.min(r.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(r.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();o=Math.max(o,i.left),s=Math.min(s,i.right),a=Math.max(a,i.top),l=Math.min(t==e.parentNode?r.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:o-n.left,right:Math.max(o,s)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function xf(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class _f{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],r=t[n];if(i.from!=r.from||i.to!=r.to||i.size!=r.size)return!1}return!0}draw(e,t){return Xu.replace({widget:new Sf(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Sf extends Gu{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 kf{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=Af,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ad.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Kd).some((e=>"function"!=typeof e&&"cm-lineWrapping"==e.class));this.heightOracle=new sf(t),this.stateDeco=e.facet(Xd).filter((e=>"function"!=typeof e)),this.heightMap=uf.empty().applyChanges(this.stateDeco,lc.empty,this.heightOracle.setDoc(e.doc),[new ip(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=Xu.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 Cf(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?Af:new Rf(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(Tf(e,this.scaler))}))}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(Xd).filter((e=>"function"!=typeof e));let i=e.changedRanges,r=ip.extendWithRanges(i,function(e,t,n){let i=new wf;return Eh.compare(e,t,n,i,0),i.changes}(n,this.stateDeco,e?e.changes:_c.empty(this.state.doc.length))),o=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);of(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||rf)&&(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=r.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(Bd)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?ad.RTL:ad.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),s=t.getBoundingClientRect(),a=o||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}=ou(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,o=a=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==h&&this.paddingBottom==u||(this.paddingTop=h,this.paddingBottom=u,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=pu(e.scrollDOM);let p=(this.printing?xf:bf)(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)&&(o=!0),o||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:n,charWidth:s,textHeight:a}=e.docView.measureTextSize();o=n>0&&i.refresh(r,n,s,a,v/s,t),o&&(e.docView.minWidth=0,l|=16)}f>0&&g>0?c=Math.max(f,g):f<0&&g<0&&(c=Math.min(f,g)),of();for(let n of this.viewports){let r=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(o?uf.empty().applyChanges(this.stateDeco,lc.empty,this.heightOracle,[new ip(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new af(n.from,r))}rf&&(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(o?[]: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,r=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,a=new Cf(i.lineAt(o-1e3*n,cf.ByHeight,r,0,0).from,i.lineAt(s+1e3*(1-n),cf.ByHeight,r,0,0).to);if(t){let{head:e}=t.range;if(e<a.from||e>a.to){let n,o=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=i.lineAt(e,cf.ByPos,r,0,0);n="center"==t.y?(s.top+s.bottom)/2-o/2:"start"==t.y||"nearest"==t.y&&e<a.from?s.top:s.bottom-o,a=new Cf(i.lineAt(n-500,cf.ByHeight,r,0,0).from,i.lineAt(n+o+500,cf.ByHeight,r,0,0).to)}}return a}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new Cf(this.heightMap.lineAt(n,cf.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,cf.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,cf.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,cf.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:s}=this;return(0==e||i<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||r>=s+Math.max(10,Math.min(n,250)))&&i>o-2e3&&r<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 _f(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,r=i>>1,o=i<<1;if(this.defaultTextDirection!=ad.LTR&&!n)return[];let s=[],a=(i,o,l,c)=>{if(o-i<r)return;let h=this.state.selection.main,u=[h.from];h.empty||u.push(h.to);for(let e of u)if(e>i&&e<o)return a(i,e-10,l,c),void a(e+10,o,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)<r&&Math.abs(e.to-o)<r&&!u.some((t=>e.from<t&&e.to>t))));if(!d){if(o<l.to&&t&&n&&t.visibleRanges.some((e=>e.from<=o&&e.to>=o))){let e=t.moveToLineBoundary(Tc.cursor(o),!1,!0).head;e>i&&(o=e)}let e=this.gapSize(l,i,o,c);d=new _f(i,o,e,n||e<2e6?e:2e6)}s.push(d)},l=t=>{if(t.length<o||t.type!=Ku.Text)return;let r=function(e,t,n){let i=[],r=e,o=0;Eh.spans(n,e,t,{span(){},point(e,t){e>r&&(i.push({from:r,to:e}),o+=e-r),r=t}},20),r<t&&(i.push({from:r,to:t}),o+=t-r);return{total:o,ranges:i}}(t.from,t.to,this.stateDeco);if(r.total<o)return;let s,l,c=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,o=i/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=c){let i=Mf(r,c),s=((this.visibleBottom-this.visibleTop)/2+o)/t.height;e=i-s,n=i+s}else e=(this.visibleTop-t.top-o)/t.height,n=(this.visibleBottom-t.top+o)/t.height;s=Ef(r,e),l=Ef(r,n)}else{let n=r.total*this.heightOracle.charWidth,o=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 h,u,d=this.pixelViewport.left+a,p=this.pixelViewport.right+a;if(null!=c){let e=Mf(r,c),t=((p-d)/2+o)/n;h=e-t,u=e+t}else h=(d-o)/n,u=(p+o)/n;s=Ef(r,h),l=Ef(r,u)}s>t.from&&a(t.from,s,t,r),l<t.to&&a(l,t.to,t,r)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(l):l(e);return s}gapSize(e,t,n,i){let r=Mf(i,n)-Mf(i,t);return this.heightOracle.lineWrapping?e.height*r:i.total*this.heightOracle.charWidth*r}updateLineGaps(e){_f.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Xu.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=[];Eh.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 r=this.visibleRanges[t],o=n[t];r.from==o.from&&r.to==o.to||(i|=4,e&&e.mapPos(r.from,-1)==o.from&&e.mapPos(r.to,1)==o.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))||Tf(this.heightMap.lineAt(e,cf.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))||Tf(this.heightMap.lineAt(this.scaler.fromDOM(e),cf.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 Tf(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 Cf{constructor(e,t){this.from=e,this.to=t}}function Ef({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:r}=t[e],o=r-n;if(i<=o)return n+i;i-=o}}function Mf(e,t){let n=0;for(let{from:i,to:r}of e.ranges){if(t<=r){n+=t-i;break}n+=r-i}return n/e.total}const Af={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};class Rf{constructor(e,t,n){let i=0,r=0,o=0;this.viewports=n.map((({from:n,to:r})=>{let o=t.lineAt(n,cf.ByPos,e,0,0).top,s=t.lineAt(r,cf.ByPos,e,0,0).bottom;return i+=s-o,{from:n,to:r,top:o,bottom:s,domTop:0,domBottom:0}})),this.scale=(7e6-i)/(t.height-i);for(let e of this.viewports)e.domTop=o+(e.top-r)*this.scale,o=e.domBottom=e.domTop+(e.bottom-e.top),r=e.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return i+(e-n)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);n=r.bottom,i=r.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return n+(e-i)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);n=r.bottom,i=r.domBottom}}eq(e){return e instanceof Rf&&(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 Tf(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new lf(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map((e=>Tf(e,t))):e._content)}const Df=Nc.define({combine:e=>e.join(" ")}),Of=Nc.define({combine:e=>e.indexOf(!0)>-1}),Nf=Vh.newName(),Pf=Vh.newName(),qf=Vh.newName(),Bf={"&light":"."+Pf,"&dark":"."+qf};function Lf(e,t,n){return new Vh(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 If=Lf("."+Nf,{"&":{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"}},Bf),jf={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Ff=Pu.ie&&Pu.ie_version<=11;class Vf{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new su,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);(Pu.ie&&Pu.ie_version<=11||Pu.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||Pu.chrome&&Pu.chrome_version<126||(this.editContext=new Hf(e),e.state.facet($d)&&(e.contentDOM.editContext=this.editContext.editContext)),Ff&&(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($d)?n.root.activeElement!=this.dom:!Yh(this.dom,i))return;let r=i.anchorNode&&n.docView.nearest(i.anchorNode);r&&r.ignoreEvent(e)?t||(this.selectionChanged=!1):(Pu.ie&&Pu.ie_version<=11||Pu.android&&Pu.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Qh(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Kh(e.root);if(!t)return!1;let n=Pu.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 zf(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?zf(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let i=Yh(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,nu(n));;)if(i){if(1!=n.nodeType)return!1;let e=n.childNodes[i-1];"false"==e.contentEditable?i--:(n=e,i=nu(n))}else{if(n==e)return!0;i=Zh(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,jf),Ff&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Ff&&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&&uu(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 r of e){let e=this.readMutation(r);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&&Yh(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 r=new Cp(this.view,e,t,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}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=Ep(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=$f(t,e.previousSibling||e.target.previousSibling,-1),i=$f(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($d)!=e.state.facet($d)&&(e.view.contentDOM.editContext=e.state.facet($d)?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 $f(e,t,n){for(;t;){let i=yu.get(t);if(i&&i.parent==e)return i;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function zf(e,t){let n=t.startContainer,i=t.startOffset,r=t.endContainer,o=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor);return Qh(s.node,s.offset,r,o)&&([n,i,r,o]=[r,o,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}}class Hf{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:r}=n,o=this.toEditorPos(t.updateRangeStart),s=this.toEditorPos(t.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:t.updateRangeStart,editorBase:o,drifted:!1});let a={from:o,to:s,insert:lc.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((Pu.mac||Pu.android)&&a.from==r-1&&/^\. ?$/.test(t.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(a={from:o,to:s,insert:lc.of([t.text.replace("."," ")])}),this.pendingContextChange=a,!e.state.readOnly){let n=this.to-this.from+(a.to-a.from+a.insert.length);Mp(e,a,Tc.single(this.toEditorPos(t.selectionStart,n),this.toEditorPos(t.selectionEnd,n)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))}else{let i=Tc.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=[],r=null;for(let t=this.toEditorPos(n.rangeStart),o=this.toEditorPos(n.rangeEnd);t<o;t++){let n=e.coordsForChar(t);r=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||r||new DOMRect,i.push(r)}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 r=this.toEditorPos(e.rangeStart),o=this.toEditorPos(e.rangeEnd);if(r<o){let e=`text-decoration: underline ${"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${"Thin"==i?1:2}px`;n.push(Xu.mark({attributes:{style:e}}).range(r,o))}}}e.dispatch({effects:Fd.of(Xu.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=Kh(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(((r,o,s,a,l)=>{if(n)return;let c=l.length-(o-r);if(i&&o>=i.to){if(i.from==r&&i.to==o&&i.insert.eq(l))return i=this.pendingContextChange=null,t+=c,void(this.to+=c);i=null,this.revertPending(e.state)}if(r+=t,(o+=t)<=this.from)this.from+=c,this.to+=c;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+l.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),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 Wf{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 kf(e.state||xh.create(e)),e.scrollTo&&e.scrollTo.is(jd)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Hd).map((e=>new Ud(e)));for(let e of this.plugins)e.update(this);this.observer=new Vf(this),this.inputState=new Ap(this),this.inputState.ensureHandlers(this.plugins),this.docView=new op(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 hh?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,r=this.state;for(let t of e){if(t.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=t.state}if(this.destroyed)return void(this.viewState.state=r);let o=this.hasFocus,s=0,a=null;e.some((e=>e.annotation(Qp)))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Zp(r,o),a||(s=1));let l=this.observer.delayedAndroidKey,c=null;if(l?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(xh.phrases)!=this.state.facet(xh.phrases))return this.setState(r);t=rp.create(this,r,e),t.flags|=s;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(h&&(h=h.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;h=new Id(e.empty?e:Tc.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(jd)&&(h=e.value.clip(this.state))}this.viewState.update(t,h),this.bidiCache=Kf.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(np)!=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(Df)!=t.state.facet(Df)&&(this.viewState.mustMeasureContent=!0),(n||i||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(Td))try{e(t)}catch(e){Vd(this.state,e,"update listener")}(a||c)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Ep(this,c)&&l.force&&uu(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 kf(e),this.plugins=e.facet(Hd).map((e=>new Ud(e))),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new op(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(Hd),n=e.state.facet(Hd);if(t!=n){let i=[];for(let r of n){let n=t.indexOf(r);if(n<0)i.push(new Ud(r));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){Vd(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:r,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(o<0)if(pu(n))r=-1,o=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(i);r=e.from,o=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 Vd(this.state,e),Gf}})),c=rp.create(this,this.state,[]),h=!1;c.flags|=s,t?t.flags|=s:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),h=this.docView.update(c),h&&this.docViewUpdate());for(let e=0;e<a.length;e++)if(l[e]!=Gf)try{let t=a[e];t.write&&t.write(l[e],this)}catch(e){Vd(this.state,e)}if(h&&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,o=-1;continue}{let e=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-o;if(e>1||e<-1){i+=e,n.scrollTop=i/this.scaleY,o=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(Td))e(t)}get themeClasses(){return Nf+" "+(this.state.facet(Of)?qf:Pf)+" "+this.state.facet(Df)}updateAttrs(){let e=Xf(this,Gd,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet($d)?"true":"false",class:"cm-content",style:`${Pu.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Xf(this,Kd,t);let n=this.observer.ignore((()=>{let n=Wu(this.contentDOM,this.contentAttrs,t),i=Wu(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(Wf.announce)){t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value}}mountStyles(){this.styleModules=this.state.facet(np);let e=this.state.facet(Wf.cspNonce);Vh.mount(this.root,this.styleModules.concat(If).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 bp(this,e,yp(this,e,t,n))}moveByGroup(e,t){return bp(this,e,yp(this,e,t,(t=>function(e,t,n){let i=e.state.charCategorizer(t),r=i(n);return e=>{let t=i(e);return r==vh.Space&&(r=t),r==t}}(this,e.head,t))))}visualLineSide(e,t){let n=this.bidiSpans(e),i=this.textDirectionAt(e.from),r=n[t?n.length-1:0];return Tc.cursor(r.side(t,i)+e.from,r.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,n=!0){return vp(this,e,t,n)}moveVertically(e,t,n){return bp(this,e,function(e,t,n,i){let r=t.head,o=n?1:-1;if(r==(n?e.state.doc.length:0))return Tc.cursor(r,t.assoc);let s,a=t.goalColumn,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(r,t.assoc||-1),h=e.documentTop;if(c)null==a&&(a=c.left-l.left),s=o<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(r);null==a&&(a=Math.min(l.right-l.left,e.defaultCharacterWidth*(r-t.from))),s=(o<0?t.top:t.bottom)+h}let u=l.left+a,d=null!=i?i:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=s+(d+t)*o,i=gp(e,{x:u,y:n},!1,o);if(n<l.top||n>l.bottom||(o<0?i<r:i>r)){let t=e.docView.coordsForChar(i),r=!t||n<t.top?-1:1;return Tc.cursor(i,r,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(),gp(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),r=this.bidiSpans(i);return iu(n,r[vd.find(r,e-i.from,-1,t)].dir==ad.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(qd)||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>Uf)return _d(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||yd(i.isolates,t=Zd(this,e))))return i.order;t||(t=Zd(this,e));let i=function(e,t,n){if(!e)return[new vd(0,0,t==cd?1:0)];if(t==ld&&!n.length&&!md.test(e))return _d(e.length);if(n.length)for(;e.length>wd.length;)wd[wd.length]=256;let i=[],r=t==ld?0:1;return xd(e,r,r,n,0,e.length,i),i}(e.text,n,t);return this.bidiCache.push(new Kf(e.from,e.to,n,t,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Pu.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{cu(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 jd.of(new Id("number"==typeof e?Tc.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 jd.of(new Id(Tc.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 Wd.define((()=>({})),{eventHandlers:e})}static domEventObservers(e){return Wd.define((()=>({})),{eventObservers:e})}static theme(e,t){let n=Vh.newName(),i=[Df.of(n),np.of(Lf(`.${n}`,e))];return t&&t.dark&&i.push(Of.of(!0)),i}static baseTheme(e){return Uc.lowest(np.of(Lf("."+Nf,e,Bf)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&yu.get(n)||yu.get(e);return(null===(t=null==i?void 0:i.rootView)||void 0===t?void 0:t.view)||null}}Wf.styleModule=np,Wf.inputHandler=Dd,Wf.clipboardInputFilter=Nd,Wf.clipboardOutputFilter=Pd,Wf.scrollHandler=Ld,Wf.focusChangeEffect=Od,Wf.perLineTextDirection=qd,Wf.exceptionSink=Rd,Wf.updateListener=Td,Wf.editable=$d,Wf.mouseSelectionStyle=Ad,Wf.dragMovesSelection=Md,Wf.clickAddsSelectionRange=Ed,Wf.decorations=Xd,Wf.outerDecorations=Yd,Wf.atomicRanges=Jd,Wf.bidiIsolatedRanges=Qd,Wf.scrollMargins=ep,Wf.darkTheme=Of,Wf.cspNonce=Nc.define({combine:e=>e.length?e[0]:""}),Wf.contentAttributes=Kd,Wf.editorAttributes=Gd,Wf.lineWrapping=Wf.contentAttributes.of({class:"cm-lineWrapping"}),Wf.announce=ch.define();const Uf=4096,Gf={};class Kf{constructor(e,t,n,i,r,o){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some((e=>e.fresh)))return e;let n=[],i=e.length?e[e.length-1].dir:ad.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let o=e[r];o.dir!=i||t.touchesRange(o.from,o.to)||n.push(new Kf(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function Xf(e,t,n){for(let i=e.state.facet(t),r=i.length-1;r>=0;r--){let t=i[r],o="function"==typeof t?t(e):t;o&&$u(o,n)}return n}const Yf={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};!(Pu.ios&&Pu.webkit&&Pu.webkit_version<534)&&(Yf[".cm-line"].caretColor=Yf[".cm-content"].caretColor="transparent !important");class Jf extends _h{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Jf.prototype.elementClass="",Jf.prototype.toDOM=void 0,Jf.prototype.mapMode=bc.TrackBefore,Jf.prototype.startSide=Jf.prototype.endSide=-1,Jf.prototype.point=!0;const Qf=1024;let Zf=0;class eg{constructor(e,t){this.from=e,this.to=t}}class tg{constructor(e={}){this.id=Zf++,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=rg.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}tg.closedBy=new tg({deserialize:e=>e.split(" ")}),tg.openedBy=new tg({deserialize:e=>e.split(" ")}),tg.group=new tg({deserialize:e=>e.split(" ")}),tg.isolate=new tg({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),tg.contextHash=new tg({perNode:!0}),tg.lookAhead=new tg({perNode:!0}),tg.mounted=new tg({perNode:!0});class ng{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[tg.mounted.id]}}const ig=Object.create(null);class rg{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):ig,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),i=new rg(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(tg.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(tg.group),i=-1;i<(n?n.length:0);i++){let r=t[i<0?e.name:n[i]];if(r)return r}}}}rg.none=new rg("",Object.create(null),0,8);const og=new WeakMap,sg=new WeakMap;var ag;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"}(ag||(ag={}));class lg{constructor(e,t,n,i,r){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,r&&r.length){this.props=Object.create(null);for(let[e,t]of r)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=ng.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 xg(this.topNode,e)}cursorAt(e,t=0,n=0){let i=og.get(this)||this.topNode,r=new xg(i);return r.moveTo(e,t),og.set(this,r._tree),r}get topNode(){return new fg(this,0,0,null)}resolve(e,t=0){let n=dg(og.get(this)||this.topNode,e,t,!1);return og.set(this,n),n}resolveInner(e,t=0){let n=dg(sg.get(this)||this.topNode,e,t,!0);return sg.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let i=e.resolveInner(t,n),r=null;for(let e=i instanceof fg?i:i.context.parent;e;e=e.parent)if(e.index<0){let o=e.parent;(r||(r=[i])).push(o.resolve(t,n)),e=o}else{let o=ng.get(e.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let s=new fg(o.tree,o.overlay[0].from+e.from,-1,e);(r||(r=[i])).push(dg(s,t,n,!1))}}return r?wg(r):i}(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:r=this.length}=e,o=e.mode||0,s=(o&ag.IncludeAnonymous)>0;for(let e=this.cursor(o|ag.IncludeAnonymous);;){let o=!1;if(e.from<=r&&e.to>=i&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;o=!0}for(;o&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;o=!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:Cg(rg.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,n)=>new lg(this.type,e,t,n,this.propValues)),e.makeTree||((e,t,n)=>new lg(rg.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=Qf,reused:o=[],minRepeatType:s=i.types.length}=e,a=Array.isArray(n)?new cg(n,n.length):n,l=i.types,c=0,h=0;function u(e,t,n,y,w,b){let{id:x,start:_,end:S,size:k}=a,C=h,E=c;for(;k<0;){if(a.next(),-1==k){let t=o[x];return n.push(t),void y.push(_-e)}if(-3==k)return void(c=x);if(-4==k)return void(h=x);throw new RangeError(`Unrecognized record size: ${k}`)}let M,A,R=l[x],T=_-e;if(S-_<=r&&(A=m(a.pos-t,w))){let t=new Uint16Array(A.size-A.skip),n=a.pos-A.size,r=t.length;for(;a.pos>n;)r=v(A.start,t,r);M=new hg(t,S-A.start,i),T=A.start-e}else{let e=a.pos-k;a.next();let t=[],n=[],i=x>=s?x:-1,o=0,l=S;for(;a.pos>e;)i>=0&&a.id==i&&a.size>=0?(a.end<=l-r&&(f(t,n,_,o,a.end,l,i,C,E),o=t.length,l=a.end),a.next()):b>2500?d(_,e,t,n):u(_,e,t,n,i,b+1);if(i>=0&&o>0&&o<t.length&&f(t,n,_,o,_,l,i,C,E),t.reverse(),n.reverse(),i>-1&&o>0){let e=p(R,E);M=Cg(R,t,n,0,t.length,0,S-_,e,e)}else M=g(R,t,n,S-_,C-S,E)}n.push(M),y.push(T)}function d(e,t,n,o){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-r),s.push(e,t,n),l++,a.next()}}if(l){let t=new Uint16Array(4*l),r=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]-r,t[n++]=s[e+2]-r,t[n++]=n;n.push(new hg(t,s[2]-r,i)),o.push(r-e)}}function p(e,t){return(n,i,r)=>{let o,s,a=0,l=n.length-1;if(l>=0&&(o=n[l])instanceof lg){if(!l&&o.type==e&&o.length==r)return o;(s=o.prop(tg.lookAhead))&&(a=i[l]+o.length+s)}return g(e,n,i,r,a,t)}}function f(e,t,n,r,o,s,a,l,c){let h=[],u=[];for(;e.length>r;)h.push(e.pop()),u.push(t.pop()+n-o);e.push(g(i.types[a],h,u,s-o,l-s,c)),t.push(o-n)}function g(e,t,n,i,r,o,s){if(o){let e=[tg.contextHash,o];s=s?[e].concat(s):[e]}if(r>25){let e=[tg.lookAhead,r];s=s?[e].concat(s):[e]}return new lg(e,t,n,i,s)}function m(e,t){let n=a.fork(),i=0,o=0,l=0,c=n.end-r,h={size:0,start:0,skip:0};e:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){h.size=i,h.start=o,h.skip=l,l+=4,i+=4,n.next();continue}let a=n.pos-e;if(e<0||a<r||n.start<c)break;let u=n.id>=s?4:0,d=n.start;for(n.next();n.pos>a;){if(n.size<0){if(-3!=n.size)break e;u+=4}else n.id>=s&&(u+=4);n.next()}o=d,i+=e,l+=u}return(t<0||i==e)&&(h.size=i,h.start=o,h.skip=l),h.size>4?h:void 0}function v(e,t,n){let{id:i,start:r,end:o,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]=o-e,t[--n]=r-e,t[--n]=i}else-3==l?c=i:-4==l&&(h=i);return n}let y=[],w=[];for(;a.pos>0;)u(e.start||0,e.bufferStart||0,y,w,-1,0);let b=null!==(t=e.length)&&void 0!==t?t:y.length?w[0]+y[0].length:0;return new lg(l[e.topID],y.reverse(),w.reverse(),b)}(e)}}lg.empty=new lg(rg.none,[],[],0);class cg{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 cg(this.buffer,this.index)}}class hg{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return rg.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],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),n==(e+=4))return r;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return r+"("+o.join(",")+")"}findChild(e,t,n,i,r){let{buffer:o}=this,s=-1;for(let a=e;a!=t&&!(ug(r,i,o[a+1],o[a+2])&&(s=a,n>0));a=o[a+3]);return s}slice(e,t,n){let i=this.buffer,r=new Uint16Array(t-e),o=0;for(let s=e,a=0;s<t;){r[a++]=i[s++],r[a++]=i[s++]-n;let t=r[a++]=i[s++]-n;r[a++]=i[s++]-e,o=Math.max(o,t)}return new hg(r,o,this.set)}}function ug(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 dg(e,t,n,i){for(var r;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 fg&&e.index<0?null:e.parent;if(!t)return e;e=t}let o=i?0:ag.IgnoreOverlays;if(i)for(let i=e,s=i.parent;s;i=s,s=i.parent)i instanceof fg&&i.index<0&&(null===(r=s.enter(t,n,o))||void 0===r?void 0:r.from)!=i.from&&(e=s);for(;;){let i=e.enter(t,n,o);if(!i)return e;e=i}}class pg{cursor(e=0){return new xg(this,e)}getChild(e,t=null,n=null){let i=gg(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return gg(this,e,t,n)}resolve(e,t=0){return dg(this,e,t,!1)}resolveInner(e,t=0){return dg(this,e,t,!0)}matchContext(e){return mg(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 fg extends pg{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,r=0){for(let o=this;;){for(let{children:s,positions:a}=o._tree,l=t>0?s.length:-1;e!=l;e+=t){let l=s[e],c=a[e]+o.from;if(ug(i,n,c,c+l.length))if(l instanceof hg){if(r&ag.ExcludeBuffers)continue;let s=l.findChild(0,l.buffer.length,t,n-c,i);if(s>-1)return new yg(new vg(o,l,e,c),null,s)}else if(r&ag.IncludeAnonymous||!l.type.isAnonymous||_g(l)){let s;if(!(r&ag.IgnoreMounts)&&(s=ng.get(l))&&!s.overlay)return new fg(s.tree,c,e,o);let a=new fg(l,c,e,o);return r&ag.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?l.children.length-1:0,t,n,i)}}if(r&ag.IncludeAnonymous||!o.type.isAnonymous)return null;if(e=o.index>=0?o.index+t:t<0?-1:o._parent._tree.children.length,o=o._parent,!o)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&ag.IgnoreOverlays)&&(i=ng.get(this._tree))&&i.overlay){let n=e-this.from;for(let{from:e,to:r}of i.overlay)if((t>0?e<=n:e<n)&&(t<0?r>=n:r>n))return new fg(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 gg(e,t,n,i){let r=e.cursor(),o=[];if(!r.firstChild())return o;if(null!=n)for(let e=!1;!e;)if(e=r.type.is(n),!r.nextSibling())return o;for(;;){if(null!=i&&r.type.is(i))return o;if(r.type.is(t)&&o.push(r.node),!r.nextSibling())return null==i?o:[]}}function mg(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 vg{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class yg extends pg{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,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new yg(this.context,this,r)}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&ag.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new yg(this.context,this,r)}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 yg(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 yg(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,r=n.buffer[this.index+3];if(r>i){let o=n.buffer[this.index+1];e.push(n.slice(i,r,o)),t.push(0)}return new lg(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function wg(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let r=e[i];(r.from>n.from||r.to<n.to)&&(n=r,t=i)}let i=n instanceof fg&&n.index<0?null:n.parent,r=e.slice();return i?r[t]=i:r.splice(t,1),new bg(r,n)}class bg{constructor(e,t){this.heads=e,this.node=t}get next(){return wg(this.heads)}}class xg{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 fg)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 fg?(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,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}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&ag.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ag.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ag.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,r=e<0?-1:n._tree.children.length;i!=r;i+=e){let e=n._tree.children[i];if(this.mode&ag.IncludeAnonymous||e instanceof hg||!e.type.isAnonymous||_g(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,r=this.stack.length;r>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,n=r+1;break e}i=this.stack[--r]}for(let e=n;e<this.stack.length;e++)t=new yg(this.buffer,t,this.stack[e]);return this.bufferNode=new yg(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 mg(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return mg(this._tree,e,i);let o=n[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function _g(e){return e.children.some((e=>e instanceof hg||!e.type.isAnonymous||_g(e)))}const Sg=new WeakMap;function kg(e,t){if(!e.isAnonymous||t instanceof hg||t.type!=e)return 1;let n=Sg.get(t);if(null==n){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof lg)){n=1;break}n+=kg(e,i)}Sg.set(t,n)}return n}function Cg(e,t,n,i,r,o,s,a,l){let c=0;for(let n=i;n<r;n++)c+=kg(e,t[n]);let h=Math.ceil(1.5*c/8),u=[],d=[];return function t(n,i,r,s,a){for(let c=r;c<s;){let r=c,p=i[c],f=kg(e,n[c]);for(c++;c<s;c++){let t=kg(e,n[c]);if(f+t>=h)break;f+=t}if(c==r+1){if(f>h){let e=n[r];t(e.children,e.positions,0,e.children.length,i[r]+a);continue}u.push(n[r])}else{let t=i[c-1]+n[c-1].length-p;u.push(Cg(e,n,i,r,c,p,t,null,l))}d.push(p+a-o)}}(t,n,i,r,0),(a||l)(u,d,s)}class Eg{constructor(e,t,n,i,r=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(r?1:0)|(o?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 Eg(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=[],r=1,o=e.length?e[0]:null;for(let s=0,a=0,l=0;;s++){let c=s<t.length?t[s]:null,h=c?c.fromA:1e9;if(h-a>=n)for(;o&&o.from<h;){let t=o;if(a>=t.from||h<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,h)-l;t=e>=n?null:new Eg(e,n,t.tree,t.offset+l,s>0,!!c)}if(t&&i.push(t),o.to>h)break;o=r<e.length?e[r++]:null}if(!c)break;a=c.toA,l=c.toA-c.toB}return i}}class Mg{startParse(e,t,n){return"string"==typeof e&&(e=new Ag(e)),n=n?n.length?n.map((e=>new eg(e.from,e.to))):[new eg(0,0)]:[new eg(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 Ag{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 tg({perNode:!0});let Rg=0;class Tg{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=Rg++}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 Tg&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let i=new Tg(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 Og(e);return e=>e.modified.indexOf(t)>-1?e:Og.get(e.base||e,e.modified.concat(t).sort(((e,t)=>e.id-t.id)))}}let Dg=0;class Og{constructor(e){this.name=e,this.instances=[],this.id=Dg++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((n=>{return n.base==e&&(i=t,r=n.modified,i.length==r.length&&i.every(((e,t)=>e==r[t])));var i,r}));if(n)return n;let i=[],r=new Tg(e.name,i,e,t);for(let e of t)e.instances.push(r);let o=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let i=0,r=t.length;i<r;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 o)i.push(Og.get(t,e));return r}}function Ng(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=[],r=2,o=e;for(let t=0;;){if("..."==o&&t>0&&t+3==e.length){r=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);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){r=0;break}if("/"!=s)throw new RangeError("Invalid path: "+e);o=e.slice(t)}let s=n.length-1,a=n[s];if(!a)throw new RangeError("Invalid path: "+e);let l=new qg(i,r,s>0?n.slice(0,s):null);t[a]=l.sort(t[a])}}return Pg.add(t)}const Pg=new tg;class qg{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 Bg(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:r=null}=t||{};return{style:e=>{let t=r;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 Lg(e,t,n,i=0,r=e.length){let o=new Ig(i,Array.isArray(t)?t:[t],n);o.highlightRange(e.cursor(),i,r,"",o.highlighters),o.flush(r)}qg.empty=new qg([],2,null);class Ig{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,r){let{type:o,from:s,to:a}=e;if(s>=n||a<=t)return;o.isTop&&(r=this.highlighters.filter((e=>!e.scope||e.scope(o))));let l=i,c=function(e){let t=e.type.prop(Pg);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||qg.empty,h=function(e,t){let n=null;for(let i of e){let e=i.style(t);e&&(n=n?n+" "+e:e)}return n}(r,c.tags);if(h&&(l&&(l+=" "),l+=h,1==c.mode&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(t,s),l),c.opaque)return;let u=e.tree&&e.tree.prop(tg.mounted);if(u&&u.overlay){let o=e.node.enter(u.overlay[0].from+s,1),c=this.highlighters.filter((e=>!e.scope||e.scope(u.tree.type))),h=e.firstChild();for(let d=0,p=s;;d++){let f=d<u.overlay.length?u.overlay[d]:null,g=f?f.from+s:a,m=Math.max(t,p),v=Math.min(n,g);if(m<v&&h)for(;e.from<v&&(this.highlightRange(e,m,v,i,r),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(o.cursor(),Math.max(t,f.from+s),Math.min(n,p),"",c),this.startSpan(Math.min(n,p),l))}h&&e.parent()}else if(e.firstChild()){u&&(i="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,r),this.startSpan(Math.min(n,e.to),l)}}while(e.nextSibling());e.parent()}}}const jg=Tg.define,Fg=jg(),Vg=jg(),$g=jg(Vg),zg=jg(Vg),Hg=jg(),Wg=jg(Hg),Ug=jg(Hg),Gg=jg(),Kg=jg(Gg),Xg=jg(),Yg=jg(),Jg=jg(),Qg=jg(Jg),Zg=jg(),em={comment:Fg,lineComment:jg(Fg),blockComment:jg(Fg),docComment:jg(Fg),name:Vg,variableName:jg(Vg),typeName:$g,tagName:jg($g),propertyName:zg,attributeName:jg(zg),className:jg(Vg),labelName:jg(Vg),namespace:jg(Vg),macroName:jg(Vg),literal:Hg,string:Wg,docString:jg(Wg),character:jg(Wg),attributeValue:jg(Wg),number:Ug,integer:jg(Ug),float:jg(Ug),bool:jg(Hg),regexp:jg(Hg),escape:jg(Hg),color:jg(Hg),url:jg(Hg),keyword:Xg,self:jg(Xg),null:jg(Xg),atom:jg(Xg),unit:jg(Xg),modifier:jg(Xg),operatorKeyword:jg(Xg),controlKeyword:jg(Xg),definitionKeyword:jg(Xg),moduleKeyword:jg(Xg),operator:Yg,derefOperator:jg(Yg),arithmeticOperator:jg(Yg),logicOperator:jg(Yg),bitwiseOperator:jg(Yg),compareOperator:jg(Yg),updateOperator:jg(Yg),definitionOperator:jg(Yg),typeOperator:jg(Yg),controlOperator:jg(Yg),punctuation:Jg,separator:jg(Jg),bracket:Qg,angleBracket:jg(Qg),squareBracket:jg(Qg),paren:jg(Qg),brace:jg(Qg),content:Gg,heading:Kg,heading1:jg(Kg),heading2:jg(Kg),heading3:jg(Kg),heading4:jg(Kg),heading5:jg(Kg),heading6:jg(Kg),contentSeparator:jg(Gg),list:jg(Gg),quote:jg(Gg),emphasis:jg(Gg),strong:jg(Gg),link:jg(Gg),monospace:jg(Gg),strikethrough:jg(Gg),inserted:jg(),deleted:jg(),changed:jg(),invalid:jg(),meta:Zg,documentMeta:jg(Zg),annotation:jg(Zg),processingInstruction:jg(Zg),definition:Tg.defineModifier("definition"),constant:Tg.defineModifier("constant"),function:Tg.defineModifier("function"),standard:Tg.defineModifier("standard"),local:Tg.defineModifier("local"),special:Tg.defineModifier("special")};for(let e in em){let t=em[e];t instanceof Tg&&(t.name=e)}var tm;Bg([{tag:em.link,class:"tok-link"},{tag:em.heading,class:"tok-heading"},{tag:em.emphasis,class:"tok-emphasis"},{tag:em.strong,class:"tok-strong"},{tag:em.keyword,class:"tok-keyword"},{tag:em.atom,class:"tok-atom"},{tag:em.bool,class:"tok-bool"},{tag:em.url,class:"tok-url"},{tag:em.labelName,class:"tok-labelName"},{tag:em.inserted,class:"tok-inserted"},{tag:em.deleted,class:"tok-deleted"},{tag:em.literal,class:"tok-literal"},{tag:em.string,class:"tok-string"},{tag:em.number,class:"tok-number"},{tag:[em.regexp,em.escape,em.special(em.string)],class:"tok-string2"},{tag:em.variableName,class:"tok-variableName"},{tag:em.local(em.variableName),class:"tok-variableName tok-local"},{tag:em.definition(em.variableName),class:"tok-variableName tok-definition"},{tag:em.special(em.variableName),class:"tok-variableName2"},{tag:em.definition(em.propertyName),class:"tok-propertyName tok-definition"},{tag:em.typeName,class:"tok-typeName"},{tag:em.namespace,class:"tok-namespace"},{tag:em.className,class:"tok-className"},{tag:em.macroName,class:"tok-macroName"},{tag:em.propertyName,class:"tok-propertyName"},{tag:em.operator,class:"tok-operator"},{tag:em.comment,class:"tok-comment"},{tag:em.meta,class:"tok-meta"},{tag:em.invalid,class:"tok-invalid"},{tag:em.punctuation,class:"tok-punctuation"}]);const nm=new tg,im=new tg;class rm{constructor(e,t,n=[],i=""){this.data=e,this.name=i,xh.prototype.hasOwnProperty("tree")||Object.defineProperty(xh.prototype,"tree",{get(){return sm(this)}}),this.parser=t,this.extension=[gm.of(this),xh.languageData.of(((e,t,n)=>{let i=om(e,t,n),r=i.type.prop(nm);if(!r)return[];let o=e.facet(r),s=i.type.prop(im);if(s){let r=i.resolve(t-i.from,n);for(let t of s)if(t.test(r,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(o)}}return o}))].concat(n)}isActiveAt(e,t,n=-1){return om(e,t,n).type.prop(nm)==this.data}findRegions(e){let t=e.facet(gm);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(nm)==this.data)return void n.push({from:t,to:t+e.length});let r=e.prop(tg.mounted);if(r){if(r.tree.prop(nm)==this.data){if(r.overlay)for(let e of r.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(r.overlay){let e=n.length;if(i(r.tree,r.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let r=e.children[n];r instanceof lg&&i(r,e.positions[n]+t)}};return i(sm(e),0),n}get allowsNesting(){return!0}}function om(e,t,n){let i=e.facet(gm),r=sm(e).topNode;if(!i||i.allowsNesting)for(let e=r;e;e=e.enter(t,n,ag.ExcludeBuffers))e.type.isTop&&(r=e);return r}function sm(e){let t=e.field(rm.state,!1);return t?t.tree:lg.empty}rm.setState=ch.define();class am{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 lm=null;class cm{constructor(e,t,n=[],i,r,o,s,a){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=r,this.viewport=o,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new cm(e,t,[],lg.empty,0,n,[],null)}startParse(){return this.parser.startParse(new am(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=lg.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(Eg.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(Eg.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=lm;lm=this;try{return e()}finally{lm=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=hm(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:r,viewport:o,skipped:s}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,n,i,r)=>t.push({fromA:e,toA:n,fromB:i,toB:r}))),n=Eg.applyChanges(n,t),i=lg.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.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 cm(this.parser,t,n,i,r,o,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=hm(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 Mg{createParse(t,n,i){let r=i[0].from,o=i[i.length-1].to;return{parsedPos:r,advance(){let t=lm;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=o,new lg(rg.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}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 lm}}function hm(e,t,n){return Eg.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class um{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 um(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=cm.create(e.facet(gm).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new um(n)}}rm.state=Fc.define({create:um.init,update(e,t){for(let e of t.effects)if(e.is(rm.setState))return e.value;return t.startState.facet(gm)!=t.state.facet(gm)?um.init(t.state):e.apply(t)}});let dm=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(dm=e=>{let t=-1,n=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const pm="undefined"!=typeof navigator&&(null===(tm=navigator.scheduling)||void 0===tm?void 0:tm.isInputPending)?()=>navigator.scheduling.isInputPending():null,fm=Wd.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(rm.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(rm.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=dm(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,r=n.field(rm.state);if(r.tree==r.context.tree&&r.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!pm?Math.max(25,e.timeRemaining()-5):1e9),s=r.context.treeLen<i&&n.doc.length>i+1e3,a=r.context.work((()=>pm&&pm()||Date.now()>o),i+(s?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:rm.setState.of(new um(r.context))})),this.chunkBudget>0&&(!a||s)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((()=>this.scheduleWork())).catch((e=>Vd(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()}}}),gm=Nc.define({combine:e=>e.length?e[0]:null,enables:e=>[rm.state,fm,Wf.contentAttributes.compute([e],(t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]});class mm{constructor(e,t){let n;function i(e){let t=Vh.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const r="string"==typeof t.all?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof rm?e=>e.prop(nm)==o.data:o?e=>e==o:void 0,this.style=Bg(e.map((e=>({tag:e.tag,class:e.class||i(Object.assign({},e,{tag:null}))}))),{all:r}).style,this.module=n?new Vh(n):null,this.themeType=t.themeType}static define(e,t){return new mm(e,t||{})}}const vm=Nc.define(),ym=Nc.define({combine:e=>e.length?[e[0]]:null});function wm(e){let t=e.facet(vm);return t.length?t:e.facet(ym)}class bm{constructor(e){this.markCache=Object.create(null),this.tree=sm(e.state),this.decorations=this.buildDeco(e,wm(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=sm(e.state),n=wm(e.state),i=n!=wm(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<r.to&&!i&&t.type==this.tree.type&&o>=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return Xu.none;let n=new Mh;for(let{from:i,to:r}of e.visibleRanges)Lg(this.tree,t,((e,t,i)=>{n.add(e,t,this.markCache[i]||(this.markCache[i]=Xu.mark({class:i})))}),i,r);return n.finish()}}const xm=Uc.high(Wd.fromClass(bm,{decorations:e=>e.decorations}));em.meta,em.link,em.heading,em.emphasis,em.strong,em.strikethrough,em.keyword,em.atom,em.bool,em.url,em.contentSeparator,em.labelName,em.literal,em.inserted,em.string,em.deleted,em.regexp,em.escape,em.string,em.variableName,em.variableName,em.typeName,em.namespace,em.className,em.variableName,em.macroName,em.propertyName,em.comment,em.invalid;const _m=Object.create(null),Sm=[rg.none],km=[],Cm=Object.create(null),Em=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"]])Em[e]=Am(_m,t);function Mm(e,t){km.indexOf(e)>-1||(km.push(e),console.warn(t))}function Am(e,t){let n=[];for(let i of t.split(" ")){let t=[];for(let n of i.split(".")){let i=e[n]||em[n];i?"function"==typeof i?t.length?t=t.map(i):Mm(n,`Modifier ${n} used at start of tag`):t.length?Mm(n,`Tag ${n} used as modifier`):t=Array.isArray(i)?i:[i]:Mm(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),r=i+" "+n.map((e=>e.id)),o=Cm[r];if(o)return o.id;let s=Cm[r]=rg.define({id:Sm.length,name:i,props:[Ng({[i]:n})]});return Sm.push(s),s.id}ad.RTL,ad.LTR;const Rm=Nc.define({combine:e=>Object.assign({sources:e.map((e=>e.source)).filter((e=>null!=e))},function(e,t,n={}){let i={};for(let t of e)for(let e of Object.keys(t)){let r=t[e],o=i[e];if(void 0===o)i[e]=r;else if(o===r||void 0===r);else{if(!Object.hasOwnProperty.call(n,e))throw new Error("Config merge conflict for field "+e);i[e]=n[e](o,r)}}for(let e in t)void 0===i[e]&&(i[e]=t[e]);return i}(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 Tm(e){const t=[];return e.iterate({enter:e=>{const n=e.node;if(!n.type.isError)return;const i=n.parent,r=Dm(n),o={from:n.from,to:n.to,severity:"error",type:"Syntax Error"};if(n.from!==n.to)o.message=`Unrecognized token in <${i.name}>`;else if(r)o.message=`Unrecognized token <${r.name}> in <${i.name}>`,o.to=r.to;else{const e=i.enterUnfinishedNodesBefore(n.to);o.message=`Incomplete <${(e||i).name}>`}t.push(o)}}),t}function Dm(e){return e?e.nextSibling||Dm(e.parent):null}var Om={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:r}=t;e.report({from:i,to:r,message:"First item is accessed via [1]",severity:"warning",type:"first-item",actions:[{name:"fix",apply(t,o=i,s=r){e.updateContent(o,s,n.replace(/\[\s*0\s*\]$/,"[1]"))}}]})}}})};const Nm=[Om];function Pm(e){const{readContent:t,syntaxTree:n,updateContent:i}=e,r=[],o={readContent:t,report:e=>{r.push(e)},updateContent:i},s=Nm.map((e=>e.create(o)));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)}}),r}!function(e,t={}){Rm.of({source:e,config:t})}((e=>{if(0===e.state.doc.length)return[];const t=sm(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}})},[...Tm(i.syntaxTree),...Pm(i)]);var i;return n.map((e=>({...e,source:e.type})))})),Wf.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}}),Wf.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=[xm];e instanceof mm&&(e.module&&i.push(Wf.styleModule.of(e.module)),n=e.themeType),n?i.push(vm.computeN([Wf.darkTheme],(t=>t.facet(Wf.darkTheme)==("dark"==n)?[e]:[]))):i.push(vm.of(e))}(mm.define([{tag:em.variableName,class:"variableName"},{tag:em.name,class:"variableName"},{tag:em.number,class:"number"},{tag:em.string,class:"string"},{tag:em.bool,class:"bool"},{tag:em.function(em.variableName),class:"function"},{tag:em.function(em.special(em.variableName)),class:"function"},{tag:em.controlKeyword,class:"control"},{tag:em.operatorKeyword,class:"control"}])),Nc.define(),Nc.define(),Nc.define(),Nc.define();function qm(e){const{name:t,description:n}=e,i=t.match(/^([\w\s]+)\((.*)\)$/),r=i[1],o=i[2],s=o?o.split(", ").map((e=>({name:e}))):[];return{name:r,type:"function",params:s,info:()=>Ft(`<div class="description">${n}<div>`),boost:0}}[{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(qm);(class extends Ml{constructor(e){super(),this._modeling=e}setText(e,t){this._modeling.updateProperties(e,{text:t})}}).$inject=["modeling"];function Bm(e){e.stopPropagation()}(class extends lo{constructor(e,t){super(e,t),aa(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();_(this._portalEl.style,t)}getOptionsBounds(){const e=this.renderer.getContainer(),{top:t,left:n,bottom:i}=e.getBoundingClientRect(),{top:r,left:o,width:s,height:a,bottom:l}=this.inputNode.getBoundingClientRect(),c=r+a-t+e.scrollTop,h={top:`${c}px`,left:`${o-n+e.scrollLeft}px`,width:`${s}px`,"max-height":`calc(100% - ${c}px)`};if(i-l<a){const e=i-r;h.bottom=`${e}px`,h["max-height"]=`calc(100% - ${e})`,delete h.top}return h}addPortalEl(){this._portalEl=Ft('<div class="dms-select-options"></div>');this.renderer.getContainer().appendChild(this._portalEl),this._portalEl.addEventListener("mousedown",Bm)}removePortalEl(){this._portalEl&&(this._portalEl.removeEventListener("mousedown",Bm),$t(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],r=i?t.indexOf(i):-1,o=-1===r?1===e?0:t.length-1:(r+e)%t.length,s=t[o<0?t.length+o:o];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 Ui(1,"div","options",e.map((e=>Ui(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:r,title:o}=this.props,{optionsVisible:s,value:a}=this.state,l=!!i&&i.filter((e=>e.value===a))[0],c=l?l.label:a;return Ui(1,"div",[e||"","dms-input-select"].join(" "),[r?Ui(1,"div","dms-input",c,0,{"aria-label":t,tabIndex:"0",onKeyDown:this.onKeyDown},null,(e=>this.inputNode=e)):Ui(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)),Ui(1,"span",["dms-input-select-icon",s?"dmn-icon-up":"dmn-icon-down"].join(" ")),s&&(h=this.renderOptions(i,l),u=this._portalEl,Ui(1024,u,null,h,0,null,Di(h)?null:h.key,null))],0,{title:o,onClick:this.onInputClick},null,(e=>this.parentNode=e));var h,u}}).$inject=["keyboard","renderer"];return class extends Wt{_getViewProviders(){return[{id:"drd",constructor:Vs,opens(e){return bi(e,"dmn:Definitions")&&((t=e).dmnDI&&t.dmnDI.diagrams&&t.dmnDI.diagrams[0]);var t}},{id:"decisionTable",constructor:Ja,opens:e=>bi(e,"dmn:Decision")&&bi(e.decisionLogic,"dmn:DecisionTable")},{id:"literalExpression",constructor:wl,opens:e=>bi(e,"dmn:Decision")&&bi(e.decisionLogic,"dmn:LiteralExpression")},{id:"boxedExpression",constructor:Gl,opens:e=>bi(e,"dmn:BusinessKnowledgeModel")&&_i(e)}]}}})); function
21 */function Ha(e){this._container=this._createContainer(),Is(this._container),this._init(this._container,e)}function Wa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ua(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Xa(e){return Math.log(e)/Math.log(10)}function Ka(e,t){var n=Xa(e.min),i=Xa(e.max);return(Math.abs(n)+Math.abs(i))/t}yn(Ha,Uo),Ha.prototype.saveSVG=tn((function(e){var t=this;return new Promise((function(e){var n=t.get("canvas"),i=n.getActiveLayer(),o=Zt("defs",n._svg),r=ei(i),s=o&&o.outerHTML||"",a=i.getBBox();e({svg:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- created with dmn-js / http://bpmn.io --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+a.width+'" height="'+a.height+'" viewBox="'+a.x+" "+a.y+" "+a.width+" "+a.height+'" version="1.1">'+s+r+"</svg>"})}))})),Ha.prototype.getModules=function(){return this._modules},Ha.prototype.destroy=function(){Uo.prototype.destroy.call(this),en(this._container)},Ha.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Ha.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Ha.prototype._init=function(e,t){var{additionalModules:n,canvas:i,...o}=t,r={...o,canvas:{...i,container:e},modules:[...[{drd:["value",this]}],...t.modules||this.getModules(),...n||[]]};Uo.call(this,r),t&&t.container&&this.attachTo(t.container)},Ha.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Ha.prototype._createContainer=function(){return Gt('<div class="dmn-drd-container"></div>')},Ha.prototype.open=function(e){var t=this;return new Promise(((n,i)=>{var o;try{return t._definitions&&t.clear(),t._definitions=e,function(e,t,n){var i,o=e.get("drdImporter"),r=e.get("eventBus"),s=[];r.fire("import.start",{definitions:t});try{!function(e){new Ko({root:function(e){return o.root(e)},element:function(e,t){return o.add(e,t)},error:function(e,t){s.push({message:e,context:t})}}).handleDefinitions(e)}(t)}catch(e){i=e}r.fire("import.done",{error:i,warnings:s}),n(i,s)}(t,e,(function(e,t){e?(e.warnings=t||[],i(e)):n({warnings:t||[]})}))}catch(e){o=e}o?(o.warnings=o.warnings||[],i(o)):n({warnings:[]})}))},Ha.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach();var t=this._container;e.appendChild(t),this._emit("attach",{}),this.get("canvas").resized()},Ha.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Ha.prototype._modules=[ua,ha,Aa,La,Va,Qa];var Ga=Math.sign||function(e){return e>=0?1:-1},Ya={min:.2,max:4};function Za(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=T(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||.75;var i=this;t.on("canvas.init",(function(t){i._init(!1!==e.enabled)}))}Za.$inject=["config.zoomScroll","eventBus","canvas"],Za.prototype.scroll=function(e){this._canvas.scroll(e)},Za.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Za.prototype.zoom=function(e,t){var n=Ka(Ya,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},Za.prototype._handleWheel=function(e){if(!Bt(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey||ma()&&e.metaKey,o=e.shiftKey,r=-1*this._scale;if(r*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){var s=t.getBoundingClientRect(),a={x:e.clientX-s.left,y:e.clientY-s.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Ga(e.deltaY)*r,this.zoom(n,a)}else n=o?{dx:r*e.deltaY,dy:0}:{dx:r*e.deltaX,dy:r*e.deltaY},this.scroll(n)}},Za.prototype.stepZoom=function(e,t){var n=Ka(Ya,10);this._zoom(e,t,n)},Za.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=Xa(i.zoom()),s=Math.round(r/n)*n;s+=n*o;var a,l,c=Math.pow(10,s);i.zoom((a=Ya,l=c,Math.max(a.min,Math.min(a.max,l))),t)},Za.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&zt[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},Za.prototype._init=function(e){this.toggle(e)};var Ja={__init__:["zoomScroll"],zoomScroll:["type",Za]},el=/^djs-cursor-.*$/;function tl(e){var t=$t(document.body);t.removeMatching(el),e&&t.add("djs-cursor-"+e)}function nl(){tl(null)}var il=5e3;function ol(e,t){function n(){return!1}return t=t||"element.click",e.once(t,il,n),function(){e.off(t,n)}}function rl(e,t){var n;function i(i){var o,r=n.start,s=n.button,a=ga(i),l=Ua(a,r);(!n.dragging&&(o=l,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>15)&&(n.dragging=!0,0===s&&ol(e),tl("grab")),n.dragging)&&(l=Ua(a,n.last||n.start),t.scroll({dx:l.x,dy:l.y}),n.last=a);i.preventDefault()}function o(e){zt.unbind(document,"mousemove",i),zt.unbind(document,"mouseup",o),n=null,nl()}e.on("element.mousedown",500,(function(e){return function(e){if(Bt(e.target,".djs-draggable"))return;var t=e.button;if(t>=2||e.ctrlKey||e.shiftKey||e.altKey)return;return n={button:t,start:ga(e)},zt.bind(document,"mousemove",i),zt.bind(document,"mouseup",o),!0}(e.originalEvent)})),this.isActive=function(){return!!n}}rl.$inject=["eventBus","canvas"];var sl={__init__:["moveCanvas"],moveCanvas:["type",rl]};function al(e){return CSS.escape(e)}var ll={"&":"&","<":"<",">":">",'"':""","'":"'"};var cl=["c","C"],ul=["v","V"],hl=["y","Y"],dl=["z","Z"];function pl(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function fl(e,t){return-1!==(e=r(e)?e:[e]).indexOf(t.key)||-1!==e.indexOf(t.code)}function gl(e){return e.shiftKey}function ml(e){return pl(e)&&!gl(e)&&fl(dl,e)}function vl(e){return pl(e)&&(fl(hl,e)||fl(dl,e)&&gl(e))}function yl(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=Zt(yl.INPUT_SELECTOR,this._container),this._resultsContainer=Zt(yl.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}function xl(e,t,n){var i=function(e){var t="";return e.forEach((function(e){var n,i=(n=""+(n=e.value||e.matched||e.normal))&&n.replace(/[&<>"']/g,(function(e){return ll[e]})),o=e.match||e.matched;t+=o?'<b class="'+yl.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":i})),""!==t?t:null}(t),o=Gt(n);o.innerHTML=i,e.appendChild(o)}yl.$inject=["canvas","eventBus","selection","translate"],yl.prototype._bindEvents=function(){var e=this;function t(t,n,i,o){e._eventMaps.push({el:t,type:i,listener:Wt.bind(t,n,i,o)})}t(document,"html","click",(function(t){e.close(!1)})),t(this._container,yl.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,yl.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,yl.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,yl.INPUT_SELECTOR,"keydown",(function(e){fl("ArrowUp",e)&&e.preventDefault(),fl("ArrowDown",e)&&e.preventDefault()})),t(this._container,yl.INPUT_SELECTOR,"keyup",(function(t){if(fl("Escape",t))return e.close();if(fl("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close(!1)}return fl("ArrowUp",t)?e._scrollToDirection(!0):fl("ArrowDown",t)?e._scrollToDirection():void(fl(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},yl.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){Wt.unbind(e.el,e.type,e.listener)}))},yl.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if((n=n.filter((function(e){return!t._canvas.getRootElements().includes(e.element)}))).length){n.forEach((function(e){var n=e.element.id,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}}));var i=Zt(yl.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}else this._selection.select(null)}},yl.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},yl.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},yl.prototype._clearResults=function(){It(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},yl.prototype._getCurrentResult=function(){return Zt(yl.RESULT_SELECTED_SELECTOR,this._resultsContainer)},yl.prototype._createResultNode=function(e,t){var n=Gt(yl.RESULT_HTML);return e.primaryTokens.length>0&&xl(n,e.primaryTokens,yl.RESULT_PRIMARY_HTML),xl(n,e.secondaryTokens,yl.RESULT_SECONDARY_HTML),Pt(n,yl.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},yl.prototype.registerProvider=function(e){this._searchProvider=e},yl.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,$t(this._canvas.getContainer()).add("djs-search-open"),$t(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},yl.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,$t(this._canvas.getContainer()).remove("djs-search-open"),$t(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},yl.prototype.toggle=function(){this.isOpen()?this.close():this.open()},yl.prototype.isOpen=function(){return this._open},yl.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&$t(t).remove(yl.RESULT_SELECTED_CLASS);var n=Pt(e,yl.RESULT_ID_ATTRIBUTE),i=this._results[n].element;$t(e).add(yl.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:300}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},yl.prototype._select=function(e){var t=Pt(e,yl.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:300}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},yl.prototype._getBoxHtml=function(){const e=Gt(yl.BOX_HTML),t=Zt(yl.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e},yl.CONTAINER_SELECTOR=".djs-search-container",yl.INPUT_SELECTOR=".djs-search-input input",yl.RESULTS_CONTAINER_SELECTOR=".djs-search-results",yl.RESULT_SELECTOR=".djs-search-result",yl.RESULT_SELECTED_CLASS="djs-search-result-selected",yl.RESULT_SELECTED_SELECTOR="."+yl.RESULT_SELECTED_CLASS,yl.RESULT_ID_ATTRIBUTE="data-result-id",yl.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",yl.BOX_HTML='<div class="djs-search-container djs-scrollable">\n <div class="djs-search-input">\n <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>\n </svg>\n <input type="text" spellcheck="false" />\n </div>\n <div class="djs-search-results" />\n</div>',yl.RESULT_HTML='<div class="djs-search-result"></div>',yl.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',yl.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var bl={__depends__:[ha,La,Aa],searchPad:["type",yl]};function _l(e){return hn(e,"dmn:Decision")||hn(e,"dmn:BusinessKnowledgeModel")||hn(e,"dmn:InputData")||hn(e,"dmn:KnowledgeSource")?"name":hn(e,"dmn:TextAnnotation")?"text":void 0}function wl(e){var t=e.businessObject,n=_l(t);if(n)return t[n]||""}function Cl(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function Ol(e){return d(e,(function(e){return!!e.matched})).length>0}function kl(e,t){const n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();const o=e.indexOf(t);return o>-1?(0!==o&&n.push({normal:i.substr(0,o)}),n.push({matched:i.substr(o,t.length)}),t.length+o<e.length&&n.push({normal:i.substr(t.length+o,e.length)})):n.push({normal:i}),n}Cl.$inject=["elementRegistry","searchPad","canvas"],Cl.prototype.find=function(e){const t=this._canvas.getRootElement();let n=this._elementRegistry.filter((function(e){return!e.labelTarget}));return n=d(n,(function(e){return e!==t})),n=v(n,(function(t){return{primaryTokens:kl(wl(t),e),secondaryTokens:kl(t.id,e),element:t}})),n=d(n,(function(e){return Ol(e.primaryTokens)||Ol(e.secondaryTokens)})),n=w(n,(function(e){return wl(e.element)+e.element.id})),n};var El={__depends__:[bl],__init__:["dmnSearch"],dmnSearch:["type",Cl]};function Sl(e){Ha.call(this,e)}function Rl(e){return e&&e[e.length-1]}function Tl(e){return e.y}function Ml(e){return e.x}yn(Sl,Ha),Sl.prototype._navigationModules=[Ja,sl,El],Sl.prototype._modules=[].concat(Sl.prototype._modules,Sl.prototype._navigationModules);var Al={left:Ml,center:Ml,right:function(e){return e.x+e.width},top:Tl,middle:Tl,bottom:function(e){return e.y+e.height}};function Pl(e,t){this._modeling=e,this._rules=t}Pl.$inject=["modeling","rules"],Pl.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},Pl.prototype._isType=function(e,t){return-1!==t.indexOf(e)},Pl.prototype._alignmentPosition=function(e,t){var n,i,o,r=this._getOrientationDetails(e),s=r.axis,a=r.dimension,l={},c={},u=!1;if(this._isType(e,["left","top"]))l[e]=t[0][s];else if(this._isType(e,["right","bottom"]))o=Rl(t),l[e]=o[s]+o[a];else if(this._isType(e,["center","middle"])){if(p(t,(function(e){var t=e[s]+Math.round(e[a]/2);c[t]?c[t].elements.push(e):c[t]={elements:[e],center:t}})),n=w(c,(function(e){return e.elements.length>1&&(u=!0),e.elements.length})),u)return l[e]=Rl(n).center,l;i=t[0],o=Rl(t=w(t,(function(e){return e[s]+e[a]}))),l[e]=function(e,t){return Math.round((e[s]+t[s]+t[a])/2)}(i,o)}return l},Pl.prototype.trigger=function(e,t){var n,i=this._modeling,o=d(e,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));if(r(n=this._rules.allowed("elements.align",{elements:o}))&&(o=n),!(o.length<2)&&n){var s=w(o,Al[t]),a=this._alignmentPosition(t,s);i.alignElements(s,a)}};var Dl={__init__:["alignElements"],alignElements:["type",Pl]},$l=10,jl=50,Il=250;function Bl(e,t,n,i){for(var o;o=Ll(e,n,t);)n=i(t,n,o);return n}function Ll(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=function(e){var t=Nl(e);e.host&&(t=t.concat(Nl(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(Nl(t))}),[])));return t}(e);return h(o,(function(e){return e!==n&&"intersect"===vo(e,i,$l)}))}function Nl(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 ql(){return!0}function Vl(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var i=n.defaultDistance||jl,o=mo(e),r=po(e);return{x:r.right+i+t.width/2,y:o.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,i,o){e.fire("autoPlace.start",{source:n,shape:i});var r=e.fire("autoPlace",{source:n,shape:i}),s=t.appendShape(n,i,r,n.parent,o);return e.fire("autoPlace.end",{source:n,shape:s}),s}}function Fl(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}Vl.$inject=["eventBus","modeling","canvas"],Fl.$inject=["eventBus","selection"];var zl={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Vl],autoPlaceSelectionBehavior:["type",Fl]},Ql={width:135,height:46},Hl={width:180,height:80},Wl={width:125,height:45},Ul={width:100,height:63};function Xl(e){qo.call(this),this._drdFactory=e}yn(Xl,qo),Xl.$inject=["drdFactory"],Xl.prototype.baseCreate=qo.prototype.create,Xl.prototype.create=function(e,t){return this.createDrdElement(e,t)},Xl.prototype.createDrdElement=function(e,t){var n,i=this._drdFactory,o=(t=t||{}).businessObject;if(!o){if(!t.type)throw new Error("no shape type specified");o=i.create(t.type)}return o.di||("connection"===e?o.di=i.createDiEdge(o,[]):"shape"===e&&(o.di=i.createDiShape(o,{}))),n=this._getDefaultSize(o),t=M({businessObject:o,id:o.id},n,t),this.baseCreate(e,t)},Xl.prototype._getDefaultSize=function(e){return hn(e,"dmn:BusinessKnowledgeModel")?Ql:hn(e,"dmn:Decision")?Hl:hn(e,"dmn:InputData")?Wl:hn(e,"dmn:KnowledgeSource")?Ul:{width:100,height:80}};var Kl="left",Gl="right",Yl=60,Zl=Hl.width;function Jl(e,t){return hn(t,"dmn:TextAnnotation")?function(e,t){var n=po(e),i={x:n.right+t.width/2,y:n.top-50-t.height/2};return Bl(e,t,i,function(e){return function(t,n,i){var o={x:n.x,y:n.y};return["x","y"].forEach((function(r){var s=e[r];if(s){var a="x"===r?"width":"height",l=s.margin,c=s.minDistance;o[r]=l<0?Math.min(i[r]+l-t[a]/2,n[r]-c+l):Math.max(i[r]+i[a]+l+t[a]/2,n[r]+c+l)}})),o}}({y:{margin:-30,minDistance:20}}))}(e,t):hn(t,"dmn:DRGElement")?function(e,t){var n=po(e),i=mo(e);function o(t){return t.target===e?1:-1}var r=function(e,t){t||(t={});var n=t.defaultDistance||jl,i=t.direction||"e",o=t.filter,r=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||Il,a=t.reference||"start";function l(e,t){return"n"===i?"start"===a?po(e).top-po(t).bottom:"center"===a?po(e).top-mo(t).y:po(e).top-po(t).top:"w"===i?"start"===a?po(e).left-po(t).right:"center"===a?po(e).left-mo(t).x:po(e).left-po(t).left:"s"===i?"start"===a?po(t).top-po(e).bottom:"center"===a?mo(t).y-po(e).bottom:po(t).bottom-po(e).bottom:"start"===a?po(t).left-po(e).right:"center"===a?mo(t).x-po(e).right:po(t).right-po(e).right}o||(o=ql);var c=e.incoming.filter(o).map((function(t){var n=r(t),i=n<0?l(t.source,e):l(e,t.source);return{id:t.source.id,distance:i,weight:n}})),u=e.outgoing.filter(o).map((function(t){var n=r(t),i=n>0?l(e,t.target):l(t.target,e);return{id:t.target.id,distance:i,weight:n}})),h=f(c.concat(u).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>s||(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 h.distance||n}(e,{defaultDistance:180,direction:"s",getWeight:o,filter:ec,reference:"center"}),s={x:i.x,y:n.bottom+r};return Bl(e,t,s,function(e){var t,n,i=mo(e);return function(e,o,r){var s;return t?(o.x<i.x?t=r:n=r,s=tc(i,mo(t))<tc(i,mo(n))?Kl:Gl):(t=r,n=r,s=mo(r).x-i.x>0?Kl:Gl),s===Kl?{x:Math.min(mo(t).x-Zl-Yl,po(t).left-Yl-e.width/2),y:o.y}:{x:Math.max(mo(n).x+Zl+Yl,po(n).right+Yl+e.width/2),y:o.y}}}(e))}(e,t):void 0}function ec(e){return!hn(e,"dmn:Association")}function tc(e,t){return Math.abs(t.x-e.x)}function nc(e){e.on("autoPlace",(function(e){var t=e.shape;return Jl(e.source,t)}))}nc.$inject=["eventBus"];var ic={__depends__:[zl],__init__:["dmnAutoPlace"],dmnAutoPlace:["type",nc]};function oc(e,t,n){var i,o,r=this,s=n.get("dragging",!1);s&&t.on("drag.start",(function(n){t.once("drag.move",1500,(function(t){!function(t){if(!t.hover){var n=t.originalEvent,i=r._findTargetGfx(n),o=i&&e.get(i);i&&o&&(t.stopPropagation(),s.hover({element:o,gfx:i}),s.move(n))}}(t)}))})),t.on("element.hover",(function(e){i=e.gfx,o=e.element})),t.on("element.hover",1500,(function(e){o&&t.fire("element.out",{element:o,gfx:i})})),t.on("element.out",(function(){i=null,o=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=ga(e),function(e){return Bt(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}oc.$inject=["elementRegistry","eventBus","injector"];var rc={__init__:["hoverFix"],hoverFix:["type",oc]},sc=Math.round,ac="djs-drag-active";function lc(e){e.preventDefault()}function cc(e,t,n,i){var o,r={threshold:5,trapClick:!0};function s(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 a(t,n){n=n||o;var i=e.createEvent(M({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,i)&&e.fire(n.prefix+"."+t,i)}function l(e,i){var r,l=o.payload,c=o.displacement,u=o.globalStart,h=ga(e),d=Ua(h,u),p=o.localStart,f=s(h),m=Ua(f,p);if(!o.active&&(i||(r=d,Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))>o.threshold))){if(M(l,{x:sc(p.x+c.x),y:sc(p.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return g();o.active=!0,o.keepSelection||(l.previousSelection=n.get(),n.select(null)),o.cursor&&tl(o.cursor),t.addMarker(t.getRootElement(),ac)}fa(e),o.active&&(M(l,{x:sc(f.x+c.x),y:sc(f.y+c.y),dx:sc(m.x),dy:sc(m.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;o.active&&(e&&(o.payload.originalEvent=e,fa(e)),t=a("end")),!1===t&&a("rejected"),a("ended",m(!0!==t))}function u(e){fl("Escape",e)&&(lc(e),g())}function h(t){var n;o.active&&(n=ol(e),setTimeout(n,400),lc(t)),c(t)}function d(e){l(e)}function p(e){var t=o.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function f(e){a("out");var t=o.payload;t.hoverGfx=null,t.hover=null}function g(e){var t;if(o){var n=o.active;n&&a("cancel"),t=m(e),n&&a("canceled",t)}}function m(r){var s,m;a("cleanup"),nl(),m=o.trapClick?h:c,zt.unbind(document,"mousemove",l),zt.unbind(document,"dragstart",lc),zt.unbind(document,"selectstart",lc),zt.unbind(document,"mousedown",m,!0),zt.unbind(document,"mouseup",m,!0),zt.unbind(document,"keyup",u),zt.unbind(document,"touchstart",d,!0),zt.unbind(document,"touchcancel",g,!0),zt.unbind(document,"touchmove",l,!0),zt.unbind(document,"touchend",c,!0),e.off("element.hover",p),e.off("element.out",f),t.removeMarker(t.getRootElement(),ac);var v=o.payload.previousSelection;return!1!==r&&v&&!n.get().length&&function(e){var t=e.filter((function(e){return i.get(e.id)}));t.length&&n.select(t)}(v),s=o,o=null,s}e.on("diagram.destroy",g),this.init=function(t,n,i,m){o&&g(!1),"string"==typeof n&&(m=i,i=n,n=null);var v,y,x,b,_,w=(m=M({},r,m||{})).data||{};b=m.trapClick?h:c,t?(v=pa(t)||t,y=ga(t),fa(t),"dragstart"===v.type&&lc(v)):(v=null,y={x:0,y:0}),x=s(y),n||(n=x),_=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(v),o=M({prefix:i,data:w,payload:{},globalStart:y,displacement:Ua(n,x),localStart:x,isTouch:_},m),m.manual||(_?(zt.bind(document,"touchstart",d,!0),zt.bind(document,"touchcancel",g,!0),zt.bind(document,"touchmove",l,!0),zt.bind(document,"touchend",c,!0)):(zt.bind(document,"mousemove",l),zt.bind(document,"dragstart",lc),zt.bind(document,"selectstart",lc),zt.bind(document,"mousedown",b,!0),zt.bind(document,"mouseup",b,!0)),zt.bind(document,"keyup",u),e.on("element.hover",p),e.on("element.out",f)),a("init"),m.autoActivate&&l(t,!0)},this.move=l,this.hover=p,this.out=f,this.end=c,this.cancel=g,this.context=function(){return o},this.setOptions=function(e){M(r,e)}}cc.$inject=["eventBus","canvas","selection","elementRegistry"];var uc={__depends__:[rc,Aa],dragging:["type",cc]};function hc(e,t,n){this._canvas=n,this._opts=M({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 dc(e,t,n){return t<e&&e<n}hc.$inject=["config.autoScroll","eventBus","canvas"],hc.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,o=t.getContainer().getBoundingClientRect(),r=[e.x,e.y,o.width-e.x,o.height-e.y];this.stopScroll();for(var s=0,a=0,l=0;l<4;l++)dc(r[l],n.scrollThresholdOut[l],n.scrollThresholdIn[l])&&(0===l?s=n.scrollStep:1==l?a=n.scrollStep:2==l?s=-n.scrollStep:3==l&&(a=-n.scrollStep));0===s&&0===a||(t.scroll({dx:s,dy:a}),this._scrolling=setTimeout((function(){i.startScroll(e)}),n.scrollRepeatTimeout))},hc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},hc.prototype.setOptions=function(e){this._opts=M({},this._opts,e)},hc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ga(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var pc={__depends__:[uc],__init__:["autoScroll"],autoScroll:["type",hc]};function fc(e){this._commandStack=e.get("commandStack",!1)}fc.$inject=["injector"],fc.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var gc={__init__:["rules"],rules:["type",fc]},mc=Math.round,vc=Math.max;var yc=10;function xc(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(ki(i,t)<=yc)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,o=no(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,yc),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),r=o[0],s=o[o.length-1];return r?r!==s?r.segment2!==s.segment2?{point:e[i=vc(r.segment2,s.segment2)-1],bendpoint:!0,index:i}:{point:{x:mc(r.x+s.x)/2,y:mc(r.y+s.y)/2},index:r.segment2}:{point:{x:mc(r.x),y:mc(r.y)},index:r.segment2}:null}(e,t)}function bc(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=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],[o.x,o.y],[e.x,e.y]);return{x:n.x+r*o.x,y:n.y+r*o.y}}function _c(e,t){var n,i=bc(e,t),o={x:i.x-e.x,y:i.y-e.y};return n=o,Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))}var wc="djs-bendpoint",Cc="djs-segment-dragger";function Oc(e,t,n){var i=function(e,t){var n,i=ga(t),o=e._container.getBoundingClientRect();n={x:o.left,y:o.top};var r=e.viewbox();return{x:r.x+(i.x-n.x)/r.scale,y:r.y+(i.y-n.y)/r.scale}}(e,n);return xc(t,i)}function kc(e,t){var n=Qn("g");Bn(n).add(wc),An(e,n);var i=Qn("circle");jn(i,{cx:0,cy:0,r:4}),Bn(i).add("djs-visual"),An(n,i);var o=Qn("circle");return jn(o,{cx:0,cy:0,r:10}),Bn(o).add("djs-hit"),An(n,o),t&&Bn(n).add(t),n}function Ec(e,t,n,i){var o=Qn("g");An(e,o);var r=function(e,t,n){var i=t.x-e.x,o=t.y-e.y;return Rc("h"===n?i:o)}(t,n,i),s=Qn("rect");jn(s,{x:-9,y:-3,width:18,height:6}),Bn(s).add("djs-visual"),An(o,s);var a=Qn("rect");return jn(a,{x:-r/2,y:-8.5,width:r,height:17}),Bn(a).add("djs-hit"),An(o,a),function(e,t){var n=Xn();n.setRotate(t,0,0),ii(e,n)}(o,"v"===i?90:0),o}function Sc(e,t,n){var i=Qn("g"),o=Mi(t,n),r=Ri(t,n);return An(e,i),Ec(i,t,n,r),Bn(i).add(Cc),Bn(i).add("h"===r?"horizontal":"vertical"),Fo(i,o.x,o.y),i}function Rc(e){return Math.abs(Math.round(2*e/3))}function Tc(e,t){var n=function(e,t){for(var n,i=t.waypoints,o=1/0,r=0;r<i.length-1;r++){var s=_c(e,[i[r],i[r+1]]);s<o&&(o=s,n=r)}return[i[n],i[n+1]]}(e,t);return bc(e,n)}function Mc(e,t,n,i,o){function r(e,n){var r,s=n.waypoints,a=Oc(t,s,e);if(a)return r=function(e,t){var n,i,o=e.waypoints;return t.index<=0||t.bendpoint?null:(i=Ri((n={start:o[t.index-1],end:o[t.index]}).start,n.end))?Rc("h"===i?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a),!function(e,t,n){var i,o,r,s,a,l,c=e.index,u=e.point;return!(c<=0||e.bendpoint)&&(r=Mi(i=t[c-1],o=t[c]),s=Ri(i,o),a=Math.abs(u.x-r.x),l=Math.abs(u.y-r.y),s&&a<=n&&l<=n)}(a,s,r)?i.start(e,n,a.index,!a.bendpoint):o.start(e,n,a.index),!0}function s(e,t,i){zt.bind(e,t,(function(e){n.triggerMouseEvent(t,e,i),e.stopPropagation()}))}function a(e,n){var i=t.getLayer("overlays"),o=Zt('.djs-bendpoints[data-element-id="'+al(e.id)+'"]',i);return!o&&n&&(jn(o=Qn("g"),{"data-element-id":e.id}),Bn(o).add("djs-bendpoints"),An(i,o),s(o,"mousedown",e),s(o,"click",e),s(o,"dblclick",e)),o}function l(e,t){return Zt('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function c(e,t){t.waypoints.forEach((function(t,n){var i=kc(e);An(e,i),Fo(i,t.x,t.y)})),kc(e,"floating")}function u(e,t){for(var n,i,o,r=t.waypoints,a=1;a<r.length;a++)Ri(n=r[a-1],i=r[a])&&(jn(o=Sc(e,n,i),{"data-segment-idx":a}),s(o,"mousemove",t))}function h(e){var t=a(e);return t||(c(t=a(e,!0),e),u(t,e)),t}function d(e){var t=a(e);t&&(!function(e){p(Jt("."+Cc,e),(function(e){ti(e)}))}(t),function(e){p(Jt("."+wc,e),(function(e){ti(e)}))}(t),u(t,e),c(t,e))}function f(e,t,n){var i,o,r=l(t.index,e),s=n[t.index-1],a=n[t.index],c=t.point,u=Mi(s,a),h=Ri(s,a);r&&(i=function(e){return Zt(".djs-visual",e)}(r),o={x:c.x-u.x,y:c.y-u.y},"v"===h&&(o={x:o.y,y:o.x}),Fo(i,o.x,o.y))}e.on("connection.changed",(function(e){d(e.element)})),e.on("connection.remove",(function(e){var t=a(e.element);t&&ti(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=h(n),e.add?Bn(t).add(e.marker):Bn(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,i,o=e.element,r=o.waypoints;if(r){if(n=a(o,!0),!(i=Oc(t,r,e.originalEvent)))return;!function(e,t){var n=Zt(".floating",e),i=t.point;n&&Fo(n,i.x,i.y)}(n,i),i.bendpoint||f(n,i,r)}})),e.on("element.mousedown",(function(e){if(ya(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return r(t,n)}})),e.on("selection.changed",(function(e){var t=e.newSelection[0];t&&t.waypoints&&h(t)})),e.on("element.hover",(function(e){var t=e.element;t.waypoints&&(h(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=a(t);i&&jn(i,{"data-element-id":n})}})),this.addHandles=h,this.updateHandles=d,this.getBendpointsContainer=a,this.getSegmentDragger=l}Mc.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Ac=Math.round,Pc="reconnectStart",Dc="reconnectEnd",$c="updateWaypoints";function jc(e,t,n,i,o,r){this._injector=e,this.start=function(e,t,r,s){var a,l=n.getGraphics(t),c=t.source,u=t.target,h=t.waypoints,d=(a=s||0!==r?s||r!==h.length-1?$c:Dc:Pc)===$c?"connection.updateWaypoints":"connection.reconnect",p=o.allowed(d,{connection:t,source:c,target:u});!1===p&&(p=o.allowed(d,{connection:t,source:u,target:c})),!1!==p&&i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:l,context:{allowed:p,bendpointIndex:r,connection:t,source:c,target:u,insert:s,type:a}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,i=n.connection,r=i.source,s=i.target,a=e.hover,l=n.type;if(n.hover=a,a){var c=l===$c?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=o.allowed(c,{connection:i,source:l===Pc?a:r,target:l===Dc?a:s}))return n.source=l===Pc?a:r,void(n.target=l===Dc?a:s);!1===t&&(t=n.allowed=o.allowed(c,{connection:i,source:l===Dc?a:s,target:l===Pc?a:r})),t&&(n.source=l===Dc?a:s,n.target=l===Pc?a:r)}})),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!==$c&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,i=t.bendpointIndex,o=t.connection,s=t.insert,a=o.waypoints.slice(),l=t.source,c=t.target,u=t.type,h=t.hints||{},d={x:Ac(e.x),y:Ac(e.y)};if(!n)return!1;u===$c?(s?a.splice(i,0,d):a[i]=d,h.bendpointMove={insert:s,bendpointIndex:i},a=this.cropWaypoints(o,a),r.updateWaypoints(o,function(e){e=e.slice();for(var t,n,i,o=0;e[o];)t=e[o],n=e[o-1],0===ki(t,i=e[o+1])||Ei(n,i,t)?e.splice(o,1):o++;return e}(a),h)):(u===Pc?(h.docking="source",Ic(t)&&(h.docking="target",h.newWaypoints=a.reverse())):u===Dc&&(h.docking="target",Ic(t)&&(h.docking="source",h.newWaypoints=a.reverse())),r.reconnect(o,l,c,d,h))}),this)}function Ic(e){var t=e.hover,n=e.source,i=e.target,o=e.type;return o===Pc?t&&i&&t===i&&n!==i:o===Dc?t&&n&&t===n&&n!==i:void 0}jc.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],jc.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 Bc="updateWaypoints",Lc="connect-ok",Nc="connect-not-ok",qc="connect-hover",Vc="djs-updating",Fc="djs-dragging";function zc(e,t,n,i){this._injector=t;var o=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,o=t.connection,r=t.insert,s=o.waypoints,a=s.slice();t.waypoints=s,r&&a.splice(n,0,{x:e.x,y:e.y}),o.waypoints=a,Bn(t.draggerGfx=kc(i.getLayer("overlays"))).add("djs-dragging"),i.addMarker(o,Fc),i.addMarker(o,Vc)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,o=t.hover,r=t.type;if(o){if(i.addMarker(o,qc),r===Bc)return;n?(i.removeMarker(o,Nc),i.addMarker(o,Lc)):!1===n&&(i.removeMarker(o,Lc),i.addMarker(o,Nc))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,o=t.target;n&&(i.removeMarker(n,qc),i.removeMarker(n,o?Lc:Nc))})),n.on("bendpoint.move.move",(function(t){var n=t.context,i=n.allowed,r=n.bendpointIndex,s=n.draggerGfx,a=n.hover,l=n.type,c=n.connection,u=c.source,h=c.target,d=c.waypoints.slice(),p={x:t.x,y:t.y},f=n.hints||{},g={};o&&(f.connectionStart&&(g.connectionStart=f.connectionStart),f.connectionEnd&&(g.connectionEnd=f.connectionEnd),"reconnectStart"===l?Ic(n)?(g.connectionEnd=g.connectionEnd||p,g.source=h,g.target=a||u,d=d.reverse()):(g.connectionStart=g.connectionStart||p,g.source=a||u,g.target=h):"reconnectEnd"===l?Ic(n)?(g.connectionStart=g.connectionStart||p,g.source=a||h,g.target=u,d=d.reverse()):(g.connectionEnd=g.connectionEnd||p,g.source=u,g.target=a||h):(g.noCropping=!0,g.noLayout=!0,d[r]=p),l===Bc&&(d=e.cropWaypoints(c,d)),g.waypoints=d,o.drawPreview(n,i,g)),Fo(s,t.x,t.y)}),this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],1100,(function(e){var t=e.context,n=t.connection,r=t.draggerGfx,s=t.hover,a=t.target,l=t.waypoints;n.waypoints=l,ti(r),i.removeMarker(n,Vc),i.removeMarker(n,Fc),s&&(i.removeMarker(s,Lc),i.removeMarker(s,a?Lc:Nc)),o&&o.cleanUp(t)}))}zc.$inject=["bendpointMove","injector","eventBus","canvas"];var Qc="connect-hover",Hc="djs-updating";function Wc(e,t,n){return Uc(e,t,e[t]+n)}function Uc(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function Xc(e){return"x"===e?"y":"x"}function Kc(e,t,n){var i,o;return e.original?e.original:(i=mo(t),Uc(e,o=Xc(n),i[o]))}function Gc(e,t,n,i,o,r){var s=e.get("connectionDocking",!1);function a(e,t){if(!s)return t;var n,i=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=i,n}function l(e){o.update("connection",e.connection,e.connectionGfx)}function c(e,t,n){var i=e.newWaypoints,o=function(e,t,n,i){var o=Math.max(t[i],n[i]),r=Math.min(t[i],n[i]);return Uc(t,i,Math.min(Math.max(r+20,e[i]),o-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],Xc(e.axis));Fo(e.draggerGfx,o.x,o.y)}this.start=function(e,t,o){var r,s,a,l,c=n.getGraphics(t),u=o-1,h=o,d=t.waypoints,p=d[u],f=d[h],g=Oc(n,d,e);(s=Ri(p,f))&&(a="v"===s?"x":"y",0===u&&(p=Kc(p,t.source,a)),h===d.length-1&&(f=Kc(f,t.target,a)),r={connection:t,segmentStartIndex:u,segmentEndIndex:h,segmentStart:p,segmentEnd:f,axis:a,dragPosition:l=g?g.point:{x:(p.x+f.x)/2,y:(p.y+f.y)/2}},i.init(e,l,"connectionSegment.move",{cursor:"x"===a?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:c,context:r}}))},t.on("connectionSegment.move.start",(function(e){var t=e.context,i=e.connection,o=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=Sc(o,t.segmentStart,t.segmentEnd),Bn(t.draggerGfx).add("djs-dragging"),n.addMarker(i,Hc)})),t.on("connectionSegment.move.move",(function(e){var t,n,i=e.context,o=i.connection,r=i.segmentStartIndex,s=i.segmentEndIndex,u=i.segmentStart,h=i.segmentEnd,d=i.axis,p=i.originalWaypoints.slice(),f=Wc(u,d,e["d"+d]),g=Wc(h,d,e["d"+d]),m=p.length,v=0;p[r]=f,p[s]=g,r<2&&(t=vo(o.source,f),1===r?"intersect"===t&&(p.shift(),p[0]=f,v--):"intersect"!==t&&(p.unshift(u),v++)),s>m-3&&(n=vo(o.target,g),s===m-2?"intersect"===n&&(p.pop(),p[p.length-1]=g):"intersect"!==n&&p.push(h)),i.newWaypoints=o.waypoints=a(o,p),c(i,v,e),i.newSegmentStartIndex=r+v,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,Qc)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,Qc)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,i=t.connection;t.draggerGfx&&ti(t.draggerGfx),n.removeMarker(i,Hc)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,l(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,i=t.newWaypoints,o=t.newSegmentStartIndex;i=i.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var s=function(e,t){var n=0,i=e.filter((function(i,o){return!Ei(e[o-1],e[o+1],i)||(n=o<=t?n-1:n,!1)}));return{waypoints:i,segmentOffset:n}}(i,o),l=a(n,s.waypoints),c=s.segmentOffset,u={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:o+c}};r.updateWaypoints(n,l,u)}))}Gc.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Yc=Math.abs,Zc=Math.round;function Jc(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Zc(e.x+e.width/2),y:Zc(e.y+e.height/2)}}function eu(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function tu(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,o=e[t],r=e.snapped=e.snapped||{};return!1===n?r[t]=!1:(r[t]=!0,i=n-o,e[t]+=i,e["d"+t]+=i),o}function nu(e){return e.children||[]}var iu=Math.abs,ou=Math.round;function ru(e){function t(e,t){if(r(e)){for(var n=e.length;n--;)if(iu(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?Tc(t,e):e.width?{x:ou(e.width/2+e.x),y:ou(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var i,o,r=function(e){var t=e.context,i=t.snapPoints,o=t.connection,r=o.waypoints,s=t.segmentStart,a=t.segmentStartIndex,l=t.segmentEnd,c=t.segmentEndIndex,u=t.axis;if(i)return i;var h=[r[a-1],s,l,r[c+1]];return a<2&&h.unshift(n(o.source,e)),c>r.length-3&&h.unshift(n(o.target,e)),t.snapPoints=i={horizontal:[],vertical:[]},p(h,(function(e){e&&(e=e.original||e,"y"===u&&i.horizontal.push(e.y),"x"===u&&i.vertical.push(e.x))})),i}(e),s=e.x,a=e.y;if(r){var l=s-(i=t(r.vertical,s)),c=a-(o=t(r.horizontal,a));M(e,{dx:e.dx-l,dy:e.dy-c,x:i,y:o}),(l||-1!==r.vertical.indexOf(s))&&tu(e,"x",i),(c||-1!==r.horizontal.indexOf(a))&&tu(e,"y",o)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,i=t&&n(t,e);co(t)&&i&&i.x&&i.y&&(tu(e,"x",i.x),tu(e,"y",i.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var i,o,r=e.context,s=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var o=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},p(o,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(r),a=r.hover,l=a&&n(a,e),c=e.x,u=e.y;if(s){var h=c-(i=t(l?s.vertical.concat([l.x]):s.vertical,c)),d=u-(o=t(l?s.horizontal.concat([l.y]):s.horizontal,u));M(e,{dx:e.dx-h,dy:e.dy-d,x:e.x-h,y:e.y-d}),(h||-1!==s.vertical.indexOf(c))&&tu(e,"x",i),(d||-1!==s.horizontal.indexOf(u))&&tu(e,"y",o)}}))}ru.$inject=["eventBus"];var su={__depends__:[uc,gc],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Mc],bendpointMove:["type",jc],bendpointMovePreview:["type",zc],connectionSegmentMove:["type",Gc],bendpointSnapping:["type",ru]};const au=new Pa;function lu(e){this._scheduled={},e.on("diagram.destroy",(()=>{Object.keys(this._scheduled).forEach((e=>{this.cancel(e)}))}))}lu.$inject=["eventBus"],lu.prototype.schedule=function(e,t=au.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},lu.prototype._schedule=function(e,t){const n=function(){const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e}(),i=setTimeout((()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(e){n.reject(e)}}catch(e){console.error("Scheduler#_schedule execution failed",e)}}));return{executionId:i,promise:n.promise}},lu.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},lu.prototype._cancel=function(e){clearTimeout(e.executionId)};var cu={scheduler:["type",lu]},uu=".entry";function hu(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}hu.$inject=["canvas","elementRegistry","eventBus","scheduler"],hu.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",(function(t){var n=t.newSelection,i=n.length?1===n.length?n[0]:n:null;i?e.open(i,!0):e.close()})),this._eventBus.on("elements.changed",(function(t){var n=t.elements,i=e._current;if(i){var o=i.target,s=r(o)?o:[o];if(s.filter((function(e){return n.includes(e)})).length){e.close();var a=s.filter((function(t){return e._elementRegistry.get(t.id)}));a.length&&e._updateAndOpen(a.length>1?a:a[0])}}})),this._eventBus.on("canvas.viewbox.changed",(function(){e._updatePosition()})),this._eventBus.on("element.marker.update",(function(t){if(e.isOpen()){var n=t.element,i=e._current;(r(i.target)?i.target:[i.target]).includes(n)&&e._updateVisibility()}})),this._container=this._createContainer()},hu.prototype._createContainer=function(){var e=Gt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},hu.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("contextPad.getProviders",e,(function(e){e.providers.push(t)}))},hu.prototype.getEntries=function(e){var t=this._getProviders(),n=r(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return p(t,(function(t){if(l(t[n])){var o=t[n](e);l(o)?i=o(i):p(o,(function(e,t){i[t]=e}))}})),i},hu.prototype.trigger=function(e,t,n){var i,o,r=this,s=t.delegateTarget||t.target;return s?(i=Pt(s,"data-action"),o=t.originalEvent||t,"mouseover"!==e?"mouseout"===e?(clearTimeout(this._timeout),void(this._mouseout&&(this._mouseout(),this._mouseout=null))):this.triggerEntry(i,e,o,n):void(this._timeout=setTimeout((function(){r._mouseout=r.triggerEntry(i,"hover",o,n)}),300))):t.preventDefault()},hu.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var o=this._current.target,r=this._current.entries[e];if(r){var s=r.action;if(!1!==this._eventBus.fire("contextPad.trigger",{entry:r,event:n})){if(l(s)){if("click"===t)return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},hu.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},hu.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},hu.prototype._updateAndOpen=function(e){var t,n=this.getEntries(e),i=this._createHtml(e);p(n,(function(e,n){var o,s=e.group||"default",a=Gt(e.html||'<div class="entry" draggable="true"></div>');Pt(a,"data-action",n),(o=Zt("[data-group="+al(s)+"]",i))||(Pt(o=Gt('<div class="group"></div>'),"data-group",s),i.appendChild(o)),o.appendChild(a),e.className&&function(e,t){var n=$t(e);t=r(t)?t:t.split(/\s+/g),t.forEach((function(e){n.add(e)}))}(a,e.className),e.title&&Pt(a,"title",e.title),e.imageUrl&&(Pt(t=Gt("<img>"),"src",e.imageUrl),t.style.width="100%",t.style.height="100%",a.appendChild(t))})),$t(i).add("open"),this._current={entries:n,html:i,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},hu.prototype._createHtml=function(e){var t=this,n=Gt('<div class="djs-context-pad"></div>');return Wt.bind(n,uu,"click",(function(e){t.trigger("click",e)})),Wt.bind(n,uu,"dragstart",(function(e){t.trigger("dragstart",e)})),Wt.bind(n,uu,"mouseover",(function(e){t.trigger("mouseover",e)})),Wt.bind(n,uu,"mouseout",(function(e){t.trigger("mouseout",e)})),zt.bind(n,"mousedown",(function(e){e.stopPropagation()})),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},hu.prototype.getPad=function(e){let t;return console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888")),t=this.isOpen()&&function(e,t){return e=r(e)?e:[e],t=r(t)?t:[t],e.length===t.length&&g(e,(function(e){return t.includes(e)}))}(this._current.target,e)?this._current.html:this._createHtml(e),{html:t}},hu.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},hu.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return r(e)===r(n)&&(r(e)?e.length===n.length&&g(e,(function(e){return n.includes(e)})):n===e)},hu.prototype.isShown=function(){return this.isOpen()&&$t(this._current.html).has("open")},hu.prototype.show=function(){this.isOpen()&&($t(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},hu.prototype.hide=function(){this.isOpen()&&($t(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},hu.prototype._getPosition=function(e){if(!r(e)&&co(e)){var t=this._canvas.viewbox(),n=(s=e).waypoints[s.waypoints.length-1],i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+8*this._canvas.zoom(),top:o}}var s,a=this._canvas.getContainer().getBoundingClientRect(),l=this._getTargetBounds(e);return{left:l.right-a.left+8*this._canvas.zoom(),top:l.top-a.top}},hu.prototype._updatePosition=function(){this._scheduler.schedule((()=>{if(this.isOpen()){var e=this._current.html,t=this._getPosition(this._current.target);"x"in t&&"y"in t?(e.style.left=t.x+"px",e.style.top=t.y+"px"):["top","right","bottom","left"].forEach((function(n){n in t&&(e.style[n]=t[n]+"px")}))}}),"ContextPad#_updatePosition")},hu.prototype._updateVisibility=function(){this._scheduler.schedule((()=>{if(this.isOpen()){var e=this,t=this._current.target;(r(t)?t:[t]).some((function(t){return e._canvas.hasMarker(t,"djs-element-hidden")}))?e.hide():e.show()}}),"ContextPad#_updateVisibility")},hu.prototype._getTargetBounds=function(e){var t=this;return(r(e)?e:[e]).map((function(e){return t._canvas.getGraphics(e)})).reduce((function(e,t){const n=t.getBoundingClientRect();return e.top=Math.min(e.top,n.top),e.right=Math.max(e.right,n.right),e.bottom=Math.max(e.bottom,n.bottom),e.left=Math.min(e.left,n.left),e.x=e.left,e.y=e.top,e.width=e.right-e.left,e.height=e.bottom-e.top,e}),{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};var du={__depends__:[Oa,cu,La],contextPad:["type",hu]};function pu(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,s=e.hover;if(n.hover=s,!o(t=n.canExecute=r(i,s))){if(!1!==t)return n.source=i,void(n.target=s);o(t=n.canExecute=r(s,i))||!1!==t&&(n.source=s,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,o=t.connectionStart,r={x:e.x,y:e.y},a=t.source,l=t.target;if(!i)return!1;var c=null,u={connectionStart:fu(t)?r:o,connectionEnd:fu(t)?o:r};s(i)&&(c=i),t.connection=n.connect(a,l,c,u)})),this.start=function(e,n,i,o){s(i)||(o=i,i=mo(n)),t.init(e,"connect",{autoActivate:o,data:{shape:n,context:{start:n,connectionStart:i}}})}}function fu(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}pu.$inject=["eventBus","dragging","modeling","rules"];var gu="connect-ok",mu="connect-not-ok";function vu(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,o=t.hover,r=t.source,s=t.start,a=t.startPosition,l=t.target,c=t.connectionStart||a,u=t.connectionEnd||{x:e.x,y:e.y},h=c,d=u;fu(t)&&(h=u,d=c),i.drawPreview(t,n,{source:r||s,target:l||o,connectionStart:h,connectionEnd:d})})),t.on("connect.hover",900,(function(e){var t=e.context,i=e.hover,o=t.canExecute;null!==o&&n.addMarker(i,o?gu:mu)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,gu),n.removeMarker(t,mu))})),i&&t.on("connect.cleanup",(function(e){i.cleanUp(e.context)}))}vu.$inject=["injector","eventBus","canvas"];var yu={__depends__:[Aa,gc,uc],__init__:["connectPreview"],connect:["type",pu],connectPreview:["type",vu]};const xu=new Pa("ps");var bu=["marker-start","marker-mid","marker-end"],_u=["circle","ellipse","line","path","polygon","polyline","path","rect"];function wu(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}wu.$inject=["elementRegistry","eventBus","canvas","styles"],wu.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")},wu.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},wu.prototype.addDragger=function(e,t,n,i="djs-dragger"){var o=qn(n=n||this.getGfx(e)),r=n.getBoundingClientRect();return this._cloneMarkers(Vo(o),i),jn(o,this._styles.cls(i,[],{x:r.top,y:r.left})),An(t,o),jn(o,"data-preview-support-element-id",e.id),o},wu.prototype.addFrame=function(e,t){var n=Qn("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return An(t,n),jn(n,"data-preview-support-element-id",e.id),n},wu.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!==_u.indexOf(e.nodeName)}(e)&&bu.forEach((function(o){if(jn(e,o)){var r=function(e,t,n){var i=(o=jn(e,t),o.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var o;return Zt("marker#"+i,n||document)}(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}}))},wu.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,xu.next()].join("-"),s=Zt("marker#"+n.id,e);e=e||this._canvas._svg;var a=s||qn(n);a.id=r,Bn(a).add(o);var l=Zt(":scope > defs",e);l||An(e,l=Qn("defs")),An(l,a);var c=function(e){return"url(#"+e+")"}(a.id);jn(t,i,c)};var Cu={__init__:["previewSupport"],previewSupport:["type",wu]},Ou="drop-ok",ku="drop-not-ok",Eu="attach-ok",Su="new-parent",Ru="create";function Tu(e,t,n,i,o){function s(t,n){[Eu,Ou,ku,Su].forEach((function(i){i===n?e.addMarker(t,i):e.removeMarker(t,i)}))}function l(){var e=t.context();e&&e.prefix===Ru&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,i=e.hover,r=t.source,a=t.hints||{};if(!i)return t.canExecute=!1,void(t.target=null);Mu(e);var l={x:e.x,y:e.y},c=t.canExecute=i&&function(e,t,n,i,r){if(!t)return!1;var s=h(e=d(e,(function(t){var n=t.labelTarget;return!(t.parent||uo(t)&&-1!==e.indexOf(n))})),(function(e){return!co(e)})),a=!1,l=!1,c=!1;Au(e)&&(a=o.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=Au(e)?o.allowed("shape.create",{position:n,shape:s,source:i,target:t}):o.allowed("elements.create",{elements:e,position:n,target:t}));var u=r.connectionTarget;return c||a?(s&&i&&(l=o.allowed("connection.create",{source:u===i?s:i,target:u===i?i:s,hints:{targetParent:t,targetAttach:a}})),{attach:a,connect:l}):(null===c||null===a)&&null}(n,i,l,r,a);i&&null!==c&&(t.target=i,c&&c.attach?s(i,Eu):s(i,c?Su:ku))})),n.on(["create.end","create.out","create.cleanup"],(function(e){var t=e.hover;t&&s(t,null)})),n.on("create.end",(function(e){var t=e.context,n=t.source,o=t.shape,r=t.elements,s=t.target,a=t.canExecute,l=a&&a.attach,c=a&&a.connect,u=t.hints||{};if(!1===a||!s)return!1;Mu(e);var d={x:e.x,y:e.y};o=c?i.appendShape(n,o,d,s,{attach:l,connection:!0===c?{}:c,connectionTarget:u.connectionTarget}):h(r=i.createElements(r,d,s,M({},u,{attach:l})),(function(e){return!co(e)})),M(t,{elements:r,shape:o}),M(e,{elements:r,shape:o})})),n.on("create.init",(function(){n.on("elements.changed",l),n.once(["create.cancel","create.end"],2e3,(function(){n.off("elements.changed",l)}))})),this.start=function(e,n,i){r(n)||(n=[n]);var o=h(n,(function(e){return!co(e)}));if(o){i=M({elements:n,hints:{},shape:o},i||{}),p(n,(function(e){a(e.x)||(e.x=0),a(e.y)||(e.y=0)}));var s=mi(d(n,(function(e){return!e.hidden})));p(n,(function(e){co(e)&&(e.waypoints=v(e.waypoints,(function(e){return{x:e.x-s.x-s.width/2,y:e.y-s.y-s.height/2}}))),M(e,{x:e.x-s.x-s.width/2,y:e.y-s.y-s.height/2})})),t.init(e,Ru,{cursor:"grabbing",autoActivate:!0,data:{shape:o,elements:n,context:i}})}}}function Mu(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 Au(e){return e&&1===e.length&&!co(e[0])}Tu.$inject=["canvas","dragging","eventBus","modeling","rules"];function Pu(e,t,n,i,o){t.on("create.move",750,(function(t){var r=t.hover,s=t.context,a=s.elements,l=s.dragGroup;l||(l=s.dragGroup=function(e){var t=Qn("g");jn(t,o.cls("djs-drag-group",["no-events"]));var r=Qn("g");return e.forEach((function(e){var o;e.hidden||(e.waypoints?(o=n._createContainer("connection",r),n.drawConnection(Vo(o),e)):(o=n._createContainer("shape",r),n.drawShape(Vo(o),e),Fo(o,e.x,e.y)),i.addDragger(e,t,o))})),t}(a)),r?(l.parentNode||An(e.getActiveLayer(),l),Fo(l,t.x,t.y)):ti(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&ti(t)}))}Pu.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var Du,$u,ju,Iu,Bu,Lu,Nu,qu,Vu,Fu,zu={__depends__:[uc,Cu,gc,Aa],__init__:["create","createPreview"],create:["type",Tu],createPreview:["type",Pu]},Qu={},Hu=[],Wu=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Uu=Array.isArray;function Xu(e,t){for(var n in t)e[n]=t[n];return e}function Ku(e){var t=e.parentNode;t&&t.removeChild(e)}function Gu(e,t,n){var i,o,r,s={};for(r in t)"key"==r?i=t[r]:"ref"==r?o=t[r]:s[r]=t[r];if(arguments.length>2&&(s.children=arguments.length>3?Du.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===s[r]&&(s[r]=e.defaultProps[r]);return Yu(e,s,i,o,null)}function Yu(e,t,n,i,o){var r={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==o?++ju:o,__i:-1,__u:0};return null==o&&null!=$u.vnode&&$u.vnode(r),r}function Zu(e){return e.children}function Ju(e,t){this.props=e,this.context=t}function eh(e,t){if(null==t)return e.__?eh(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?eh(e):null}function th(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return th(e)}}function nh(e){(!e.__d&&(e.__d=!0)&&Iu.push(e)&&!ih.__r++||Bu!==$u.debounceRendering)&&((Bu=$u.debounceRendering)||Lu)(ih)}function ih(){var e,t,n,i,o,r,s,a;for(Iu.sort(Nu);e=Iu.shift();)e.__d&&(t=Iu.length,i=void 0,r=(o=(n=e).__v).__e,s=[],a=[],n.__P&&((i=Xu({},o)).__v=o.__v+1,$u.vnode&&$u.vnode(i),hh(n.__P,i,o,n.__n,void 0!==n.__P.ownerSVGElement,32&o.__u?[r]:null,s,null==r?eh(o):r,!!(32&o.__u),a),i.__v=o.__v,i.__.__k[i.__i]=i,dh(s,i,a),i.__e!=r&&th(i)),Iu.length>t&&Iu.sort(Nu));ih.__r=0}function oh(e,t,n,i,o,r,s,a,l,c,u){var h,d,p,f,g,m=i&&i.__k||Hu,v=t.length;for(n.__d=l,rh(n,t,m),l=n.__d,h=0;h<v;h++)null!=(p=n.__k[h])&&"boolean"!=typeof p&&"function"!=typeof p&&(d=-1===p.__i?Qu:m[p.__i]||Qu,p.__i=h,hh(e,p,d,o,r,s,a,l,c,u),f=p.__e,p.ref&&d.ref!=p.ref&&(d.ref&&ph(d.ref,null,p),u.push(p.ref,p.__c||f,p)),null==g&&null!=f&&(g=f),65536&p.__u||d.__k===p.__k?(l&&!l.isConnected&&(l=eh(d)),l=sh(p,l,e)):"function"==typeof p.type&&void 0!==p.__d?l=p.__d:f&&(l=f.nextSibling),p.__d=void 0,p.__u&=-196609);n.__d=l,n.__e=g}function rh(e,t,n){var i,o,r,s,a,l=t.length,c=n.length,u=c,h=0;for(e.__k=[],i=0;i<l;i++)s=i+h,null!=(o=e.__k[i]=null==(o=t[i])||"boolean"==typeof o||"function"==typeof o?null:"string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?Yu(null,o,null,null,null):Uu(o)?Yu(Zu,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?Yu(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)?(o.__=e,o.__b=e.__b+1,a=ah(o,n,s,u),o.__i=a,r=null,-1!==a&&(u--,(r=n[a])&&(r.__u|=131072)),null==r||null===r.__v?(-1==a&&h--,"function"!=typeof o.type&&(o.__u|=65536)):a!==s&&(a===s+1?h++:a>s?u>l-s?h+=a-s:h--:a<s?a==s-1&&(h=a-s):h=0,a!==i+h&&(o.__u|=65536))):(r=n[s])&&null==r.key&&r.__e&&!(131072&r.__u)&&(r.__e==e.__d&&(e.__d=eh(r)),fh(r,r,!1),n[s]=null,u--);if(u)for(i=0;i<c;i++)null!=(r=n[i])&&!(131072&r.__u)&&(r.__e==e.__d&&(e.__d=eh(r)),fh(r,r))}function sh(e,t,n){var i,o;if("function"==typeof e.type){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=sh(i[o],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8===t.nodeType);return t}function ah(e,t,n,i){var o=e.key,r=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&o==l.key&&r===l.type&&!(131072&l.__u))return n;if(i>(null==l||131072&l.__u?0:1))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&o==l.key&&r===l.type)return s;s--}if(a<t.length){if((l=t[a])&&!(131072&l.__u)&&o==l.key&&r===l.type)return a;a++}}return-1}function lh(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||Wu.test(t)?n:n+"px"}function ch(e,t,n,i,o){var r;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||lh(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||lh(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])r=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||"onFocusOut"===t||"onFocusIn"===t?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?i?n.u=i.u:(n.u=qu,e.addEventListener(t,r?Fu:Vu,r)):e.removeEventListener(t,r?Fu:Vu,r);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function uh(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=qu++;else if(t.t<n.u)return;return n($u.event?$u.event(t):t)}}}function hh(e,t,n,i,o,r,s,a,l,c){var u,h,d,p,f,g,m,v,y,x,b,_,w,C,O,k=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),r=[a=t.__e=n.__e]),(u=$u.__b)&&u(t);e:if("function"==typeof k)try{if(v=t.props,y=(u=k.contextType)&&i[u.__c],x=u?y?y.props.value:u.__:i,n.__c?m=(h=t.__c=n.__c).__=h.__E:("prototype"in k&&k.prototype.render?t.__c=h=new k(v,x):(t.__c=h=new Ju(v,x),h.constructor=k,h.render=gh),y&&y.sub(h),h.props=v,h.state||(h.state={}),h.context=x,h.__n=i,d=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=k.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Xu({},h.__s)),Xu(h.__s,k.getDerivedStateFromProps(v,h.__s))),p=h.props,f=h.state,h.__v=t,d)null==k.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==k.getDerivedStateFromProps&&v!==p&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(v,x),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(v,h.__s,x)||t.__v===n.__v)){for(t.__v!==n.__v&&(h.props=v,h.state=h.__s,h.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),b=0;b<h._sb.length;b++)h.__h.push(h._sb[b]);h._sb=[],h.__h.length&&s.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(v,h.__s,x),null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(p,f,g)}))}if(h.context=x,h.props=v,h.__P=e,h.__e=!1,_=$u.__r,w=0,"prototype"in k&&k.prototype.render){for(h.state=h.__s,h.__d=!1,_&&_(t),u=h.render(h.props,h.state,h.context),C=0;C<h._sb.length;C++)h.__h.push(h._sb[C]);h._sb=[]}else do{h.__d=!1,_&&_(t),u=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++w<25);h.state=h.__s,null!=h.getChildContext&&(i=Xu(Xu({},i),h.getChildContext())),d||null==h.getSnapshotBeforeUpdate||(g=h.getSnapshotBeforeUpdate(p,f)),oh(e,Uu(O=null!=u&&u.type===Zu&&null==u.key?u.props.children:u)?O:[O],t,n,i,o,r,s,a,l,c),h.base=t.__e,t.__u&=-161,h.__h.length&&s.push(h),m&&(h.__E=h.__=null)}catch(e){t.__v=null,l||null!=r?(t.__e=a,t.__u|=l?160:32,r[r.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),$u.__e(e,t,n)}else null==r&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,i,o,r,s,a,l){var c,u,h,d,p,f,g,m=n.props,v=t.props,y=t.type;if("svg"===y&&(o=!0),null!=r)for(c=0;c<r.length;c++)if((p=r[c])&&"setAttribute"in p==!!y&&(y?p.localName===y:3===p.nodeType)){e=p,r[c]=null;break}if(null==e){if(null===y)return document.createTextNode(v);e=o?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,v.is&&v),r=null,a=!1}if(null===y)m===v||a&&e.data===v||(e.data=v);else{if(r=r&&Du.call(e.childNodes),m=n.props||Qu,!a&&null!=r)for(m={},c=0;c<e.attributes.length;c++)m[(p=e.attributes[c]).name]=p.value;for(c in m)p=m[c],"children"==c||("dangerouslySetInnerHTML"==c?h=p:"key"===c||c in v||ch(e,c,null,p,o));for(c in v)p=v[c],"children"==c?d=p:"dangerouslySetInnerHTML"==c?u=p:"value"==c?f=p:"checked"==c?g=p:"key"===c||a&&"function"!=typeof p||m[c]===p||ch(e,c,p,m[c],o);if(u)a||h&&(u.__html===h.__html||u.__html===e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(h&&(e.innerHTML=""),oh(e,Uu(d)?d:[d],t,n,i,o&&"foreignObject"!==y,r,s,r?r[0]:n.__k&&eh(n,0),a,l),null!=r)for(c=r.length;c--;)null!=r[c]&&Ku(r[c]);a||(c="value",void 0!==f&&(f!==e[c]||"progress"===y&&!f||"option"===y&&f!==m[c])&&ch(e,c,f,m[c],!1),c="checked",void 0!==g&&g!==e[c]&&ch(e,c,g,m[c],!1))}return e}(n.__e,t,n,i,o,r,s,l,c);(u=$u.diffed)&&u(t)}function dh(e,t,n){t.__d=void 0;for(var i=0;i<n.length;i++)ph(n[i],n[++i],n[++i]);$u.__c&&$u.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){$u.__e(e,t.__v)}}))}function ph(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){$u.__e(e,n)}}function fh(e,t,n){var i,o;if($u.unmount&&$u.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||ph(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){$u.__e(e,t)}i.base=i.__P=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&fh(i[o],t,n||"function"!=typeof e.type);n||null==e.__e||Ku(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function gh(e,t,n){return this.constructor(e,n)}function mh(e,t,n){var i,o,r,s;$u.__&&$u.__(e,t),o=(i="function"==typeof n)?null:t.__k,r=[],s=[],hh(t,e=(!i&&n||t).__k=Gu(Zu,null,[e]),o||Qu,Qu,void 0!==t.ownerSVGElement,!i&&n?[n]:o?null:t.firstChild?Du.call(t.childNodes):null,r,!i&&n?n:o?o.__e:t.firstChild,i,s),dh(r,e,s)}Du=Hu.slice,$u={__e:function(e,t,n,i){for(var o,r,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,i||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},ju=0,Ju.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Xu({},this.state),"function"==typeof e&&(e=e(Xu({},n),this.props)),e&&Xu(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),nh(this))},Ju.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),nh(this))},Ju.prototype.render=Zu,Iu=[],Lu="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Nu=function(e,t){return e.__v.__b-t.__v.__b},ih.__r=0,qu=0,Vu=uh(!1),Fu=uh(!0);var vh=function(e,t,n,i){var o;t[0]=0;for(var r=1;r<t.length;r++){var s=t[r++],a=t[r]?(t[0]|=s?1:2,n[t[r++]]):t[++r];3===s?i[0]=a:4===s?i[1]=Object.assign(i[1]||{},a):5===s?(i[1]=i[1]||{})[t[++r]]=a:6===s?i[1][t[++r]]+=a+"":s?(o=e.apply(a,vh(e,a,n,["",null])),i.push(o),a[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(a)}return i},yh=new Map;var xh,bh,_h,wh,Ch=function(e){var t=yh.get(this);return t||(t=new Map,yh.set(this,t)),(t=vh(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,i=1,o="",r="",s=[0],a=function(e){1===i&&(e||(o=o.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?s.push(0,e,o):3===i&&(e||o)?(s.push(3,e,o),i=2):2===i&&"..."===o&&e?s.push(4,e,0):2===i&&o&&!e?s.push(5,0,!0,o):i>=5&&((o||!e&&5===i)&&(s.push(i,0,o,n),i=6),e&&(s.push(i,e,0,n),i=6)),o=""},l=0;l<e.length;l++){l&&(1===i&&a(),a(l));for(var c=0;c<e[l].length;c++)t=e[l][c],1===i?"<"===t?(a(),s=[s],i=3):o+=t:4===i?"--"===o&&">"===t?(i=1,o=""):o=t+o[0]:r?t===r?r="":o+=t:'"'===t||"'"===t?r=t:">"===t?(a(),i=1):i&&("="===t?(i=5,n=o,o=""):"/"===t&&(i<5||">"===e[l][c+1])?(a(),3===i&&(s=s[0]),i=s,(s=s[0]).push(2,0,i),i=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(a(),i=2):o+=t),3===i&&"!--"===o&&(i=4,s=s[0])}return a(),s}(e)),t),arguments,[])).length>1?t:t[0]}.bind(Gu),Oh=0,kh=[],Eh=[],Sh=$u,Rh=Sh.__b,Th=Sh.__r,Mh=Sh.diffed,Ah=Sh.__c,Ph=Sh.unmount,Dh=Sh.__;function $h(e,t){Sh.__h&&Sh.__h(bh,e,Oh||t),Oh=0;var n=bh.__H||(bh.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Eh}),n.__[e]}function jh(e){return Oh=1,function(e,t,n){var i=$h(xh++,2);if(i.t=e,!i.__c&&(i.__=[Uh(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=bh,!bh.u)){var o=function(e,t,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter((function(e){return!!e.__c}));if(o.every((function(e){return!e.__N})))return!r||r.call(this,e,t,n);var s=!1;return o.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&i.__c.props===e)&&(!r||r.call(this,e,t,n))};bh.u=!0;var r=bh.shouldComponentUpdate,s=bh.componentWillUpdate;bh.componentWillUpdate=function(e,t,n){if(this.__e){var i=r;r=void 0,o(e,t,n),r=i}s&&s.call(this,e,t,n)},bh.shouldComponentUpdate=o}return i.__N||i.__}(Uh,e)}function Ih(e,t){var n=$h(xh++,3);!Sh.__s&&Wh(n.__H,t)&&(n.__=e,n.i=t,bh.__H.__h.push(n))}function Bh(e,t){var n=$h(xh++,4);!Sh.__s&&Wh(n.__H,t)&&(n.__=e,n.i=t,bh.__h.push(n))}function Lh(e){return Oh=5,Nh((function(){return{current:e}}),[])}function Nh(e,t){var n=$h(xh++,7);return Wh(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function qh(e,t){return Oh=8,Nh((function(){return e}),t)}function Vh(){for(var e;e=kh.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Qh),e.__H.__h.forEach(Hh),e.__H.__h=[]}catch(t){e.__H.__h=[],Sh.__e(t,e.__v)}}Sh.__b=function(e){bh=null,Rh&&Rh(e)},Sh.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Dh&&Dh(e,t)},Sh.__r=function(e){Th&&Th(e),xh=0;var t=(bh=e.__c).__H;t&&(_h===bh?(t.__h=[],bh.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Eh,e.__N=e.i=void 0}))):(t.__h.forEach(Qh),t.__h.forEach(Hh),t.__h=[],xh=0)),_h=bh},Sh.diffed=function(e){Mh&&Mh(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==kh.push(t)&&wh===Sh.requestAnimationFrame||((wh=Sh.requestAnimationFrame)||zh)(Vh)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Eh&&(e.__=e.__V),e.i=void 0,e.__V=Eh}))),_h=bh=null},Sh.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Qh),e.__h=e.__h.filter((function(e){return!e.__||Hh(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Sh.__e(n,e.__v)}})),Ah&&Ah(e,t)},Sh.unmount=function(e){Ph&&Ph(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{Qh(e)}catch(e){t=e}})),n.__H=void 0,t&&Sh.__e(t,n.__v))};var Fh="function"==typeof requestAnimationFrame;function zh(e){var t,n=function(){clearTimeout(i),Fh&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);Fh&&(t=requestAnimationFrame(n))}function Qh(e){var t=bh,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),bh=t}function Hh(e){var t=bh;e.__c=e.__(),bh=t}function Wh(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Uh(e,t){return"function"==typeof t?t(e):t}function Xh(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Xh(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Kh(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Xh(e))&&(i&&(i+=" "),i+=t);return i}function Gh(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,s=Nh((()=>t.reduce(((e,t)=>{const n=t.group||"default",i=e.find((e=>e.id===n));return i?i.entries.push(t):e.push({id:n,entries:[t]}),e}),[])),[t]);return Ch` variable
2 …e&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})})(this,function(t){"use strict";function n(t,…
27 …ffset:t.byteOffset,byteLength:t.byteLength}:n[e]=t}),n),[t.buffer])})}}))),Yl={AUDIO:function(s,o)… class in AnonymousFunctionc9f82cd75d800
1327 `)}return[]}function ohn(t){var e;return e=(Qte(),D0e),e[t>>>28]|e[t>>24&15]<<4|e[t>>20&15]<<8|e[t>>16&15]<<12|e[t>>12&15]<<16|e[t>>8&15]<<20|e[t>>4&15]<<24|e[t&15]<<28}function Bi global() function [all...]