All Downloads are FREE. Search and download functionalities are using the official Maven repository.

static.saga-statemachine-designer.bundle.js Maven / Gradle / Ivy

The newest version!
/*! For license information please see bundle.js.LICENSE.txt */
(()=>{var e={235:(e,t,n)=>{e.exports=n(302),e.exports.Collection=n(48)},48:e=>{"use strict";e.exports.extend=function(e,t,n,o){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(e){var n=this.indexOf(e);return-1!==n&&(this.splice(n,1),t.unset(e,r,o)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,n){var i=this.indexOf(e);if(void 0===n){if(-1!==i)return;n=this.length}-1!==i&&this.splice(i,1),this.splice(n,0,e),-1===i&&t.set(e,r,o)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},e.exports.isExtended=function(e){return!0===e.__refs_collection}},302:(e,t,n)=>{"use strict";var o=n(48);function r(e,t,n){var r=o.extend(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:r}),r.length&&r.forEach((function(o){e.set(o,t.inverse,n)}))}function i(e,t){if(!(this instanceof i))return new i(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}i.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?r(this,t,e):function(e,t,n){var o=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(t){if(t!==r){var i=r;r=null,i&&e.unset(i,o,n),r=t,e.set(r,o,n)}}})}(this,t,e)},i.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return o.isExtended(n)||r(this,t,e),n},i.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},i.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},i.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)},e.exports=i},720:e=>{"use strict";var t=/,?([a-z]),?/gi,n=parseFloat,o=Math,r=o.PI,i=o.min,s=o.max,a=o.pow,l=o.abs,c=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,u=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,h=Array.isArray||function(e){return e instanceof Array};function p(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function f(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)p(e,n)&&(t[n]=f(e[n]));return t}function d(e){var t=d.ps=d.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout((function(){for(var n in t)p(t,n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])})),t[e]}function g(e,t,n,o){return 1===arguments.length&&(t=e.y,n=e.width,o=e.height,e=e.x),{x:e,y:t,width:n,height:o,x2:e+n,y2:t+o}}function m(){return this.join(",").replace(t,"$1")}function y(e){var t=f(e);return t.toString=m,t}function v(e,t,n,o,r,i,s,l,c){var u=1-c,h=a(u,3),p=a(u,2),f=c*c*c,d=h*t+3*p*c*o+3*u*c*c*i+f*l;return{x:k(h*e+3*p*c*n+3*u*c*c*r+f*s),y:k(d)}}function b(e){var t=M.apply(null,e);return g(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function x(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function w(e,t,n,o,r){return e*(e*(-3*t+9*n-9*o+3*r)+6*t-12*n+6*o)-3*t+3*n}function O(e,t,n,r,i,s,a,l,c){null==c&&(c=1);for(var u=(c=c>1?1:c<0?0:c)/2,h=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,d=0;d<12;d++){var g=u*h[d]+u,m=w(g,e,n,i,a),y=w(g,t,r,s,l),v=m*m+y*y;f+=p[d]*o.sqrt(v)}return u*f}function _(e,t,n,o,r,a,l,c){if(!(s(e,n)s(r,l)||s(t,o)s(a,c))){var u=(e*o-t*n)*(a-c)-(t-o)*(r*c-a*l),h=(e-n)*(a-c)-(t-o)*(r-l);if(h){var p=k(((e*o-t*n)*(r-l)-(e-n)*(r*c-a*l))/h),f=k(u/h),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+i(e,n).toFixed(2)||d>+s(e,n).toFixed(2)||d<+i(r,l).toFixed(2)||d>+s(r,l).toFixed(2)||g<+i(t,o).toFixed(2)||g>+s(t,o).toFixed(2)||g<+i(a,c).toFixed(2)||g>+s(a,c).toFixed(2)))return{x:p,y:f}}}}function k(e){return Math.round(1e11*e)/1e11}function S(e,t,n){if(o=b(e),r=b(t),o=g(o),!(x(r=g(r),o.x,o.y)||x(r,o.x2,o.y)||x(r,o.x,o.y2)||x(r,o.x2,o.y2)||x(o,r.x,r.y)||x(o,r.x2,r.y)||x(o,r.x,r.y2)||x(o,r.x2,r.y2)||(o.xr.x||r.xo.x)&&(o.yr.y||r.yo.y)))return n?0:[];for(var o,r,i=O.apply(0,e),s=O.apply(0,t),a=C(e)?1:~~(i/5)||1,c=C(t)?1:~~(s/5)||1,u=[],h=[],p={},f=n?0:[],d=0;d=0&&R<=1&&j>=0&&j<=1&&(n?f++:f.push({x:M.x,y:M.y,t1:R,t2:j}))}}return f}function E(e){var t=d(e);if(t.abs)return y(t.abs);if(h(e)&&h(e&&e[0])||(e=function(e){if(!e)return null;var t=d(e);if(t.arr)return f(t.arr);var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[];return h(e)&&h(e[0])&&(o=f(e)),o.length||String(e).replace(c,(function(e,t,r){var i=[],s=t.toLowerCase();for(r.replace(u,(function(e,t){t&&i.push(+t)})),"m"==s&&i.length>2&&(o.push([t].concat(i.splice(0,2))),s="l",t="m"==t?"l":"L");i.length>=n[s]&&(o.push([t].concat(i.splice(0,n[s]))),n[s]););})),o.toString=d.toString,t.arr=f(o),o}(e)),!e||!e.length)return[["M",0,0]];var n,o=[],r=0,i=0,s=0,a=0,l=0;"M"==e[0][0]&&(s=r=+e[0][1],a=i=+e[0][2],l++,o[0]=["M",r,i]);for(var p,g,v=l,b=e.length;v=1e3&&delete o[r.shift()],r.push(n),o[n]=g.apply(0,t),o[n])});if(f)P=f[0],A=f[1],E=f[2],C=f[3];else{e=(d=b(e,t,-y)).x,t=d.y;var x=(e-(u=(d=b(u,h,-y)).x))/2,w=(t-(h=d.y))/2,O=x*x/(n*n)+w*w/(i*i);O>1&&(n*=O=o.sqrt(O),i*=O);var _=n*n,k=i*i,S=(a==c?-1:1)*o.sqrt(l((_*k-_*w*w-k*x*x)/(_*w*w+k*x*x))),E=S*n*w/i+(e+u)/2,C=S*-i*x/n+(t+h)/2,P=o.asin(((t-C)/i).toFixed(9)),A=o.asin(((h-C)/i).toFixed(9));(P=eA&&(P-=2*r),!c&&A>P&&(A-=2*r)}var M=A-P;if(l(M)>m){var R=A,j=u,B=h;A=P+m*(c&&A>P?1:-1),v=T(u=E+n*o.cos(A),h=C+i*o.sin(A),n,i,s,0,c,j,B,[A,R,E,C])}M=A-P;var D=o.cos(P),L=o.sin(P),$=o.cos(A),I=o.sin(A),N=o.tan(M/4),q=4/3*n*N,F=4/3*i*N,Q=[e,t],H=[e+q*L,t-F*D],z=[u+q*I,h-F*$],V=[u,h];if(H[0]=2*Q[0]-H[0],H[1]=2*Q[1]-H[1],f)return[H,z,V].concat(v);for(var W=[],X=0,G=(v=[H,z,V].concat(v).join().split(",")).length;X7){e[t].shift();for(var n=e[t];n.length;)a[t]="A",e.splice(t++,0,["C"].concat(n.splice(0,6)));e.splice(t,1),h=o.length}},a=[],l="",c="",u=0,h=o.length;u{var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e="",t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e,t,o,r,i,s,a,l,c={},u=[],h=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,p=Array.isArray;function f(e,t){for(var n in t)e[n]=t[n];return e}function d(e){var t=e.parentNode;t&&t.removeChild(e)}function g(t,n,o){var r,i,s,a={};for(s in n)"key"==s?r=n[s]:"ref"==s?i=n[s]:a[s]=n[s];if(arguments.length>2&&(a.children=arguments.length>3?e.call(arguments,2):o),"function"==typeof t&&null!=t.defaultProps)for(s in t.defaultProps)void 0===a[s]&&(a[s]=t.defaultProps[s]);return m(t,a,r,i,null)}function m(e,n,r,i,s){var a={type:e,props:n,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==s?++o:s,__i:-1,__u:0};return null==s&&null!=t.vnode&&t.vnode(a),a}function y(e){return e.children}function v(e,t){this.props=e,this.context=t}function b(e,t){if(null==t)return e.__?b(e.__,e.__i+1):null;for(var n;tn&&r.sort(a));O.__r=0}function _(e,t,n,o,r,i,s,a,l,h,p){var f,d,g,m,y,v=o&&o.__k||u,b=t.length;for(n.__d=l,k(n,t,v),l=n.__d,f=0;f0?m(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,a=C(r,n,s=o+h,u),r.__i=a,i=null,-1!==a&&(u--,(i=n[a])&&(i.__u|=131072)),null==i||null===i.__v?(-1==a&&h--,"function"!=typeof r.type&&(r.__u|=65536)):a!==s&&(a===s+1?h++:a>s?u>l-s?h+=a-s:h--:h=a(null!=l&&0==(131072&l.__u)?1:0))for(;s>=0||a=0){if((l=t[s])&&0==(131072&l.__u)&&r==l.key&&i===l.type)return s;s--}if(a2&&(l.children=arguments.length>3?e.call(arguments,2):o),m(t.type,l,r||t.key,i||t.ref,null)}function F(e,t){var n={__c:t="__cC"+l++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,o;return this.getChildContext||(n=[],(o={})[t]=this,this.getChildContext=function(){return o},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,w(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}e=u.slice,t={__e:function(e,t,n,o){for(var r,i,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},o=0,v.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=f({},this.state),"function"==typeof e&&(e=e(f({},n),this.props)),e&&f(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),w(this))},v.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),w(this))},v.prototype.render=y,r=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(e,t){return e.__v.__b-t.__v.__b},O.__r=0,l=0;var Q,H,z,V,W=0,X=[],G=[],U=t.__b,Y=t.__r,Z=t.diffed,K=t.__c,J=t.unmount;function ee(e,n){t.__h&&t.__h(H,e,W||n),W=0;var o=H.__H||(H.__H={__:[],__h:[]});return e>=o.__.length&&o.__.push({__V:G}),o.__[e]}function te(e){return W=1,ne(ge,e)}function ne(e,t,n){var o=ee(Q++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):ge(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=H,!H.u)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=o.__c.__H.__.filter((function(e){return e.__c}));if(r.every((function(e){return!e.__N})))return!i||i.call(this,e,t,n);var s=!1;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&o.__c.props===e)&&(!i||i.call(this,e,t,n))};H.u=!0;var i=H.shouldComponentUpdate,s=H.componentWillUpdate;H.componentWillUpdate=function(e,t,n){if(this.__e){var o=i;i=void 0,r(e,t,n),i=o}s&&s.call(this,e,t,n)},H.shouldComponentUpdate=r}return o.__N||o.__}function oe(e,n){var o=ee(Q++,3);!t.__s&&de(o.__H,n)&&(o.__=e,o.i=n,H.__H.__h.push(o))}function re(e,n){var o=ee(Q++,4);!t.__s&&de(o.__H,n)&&(o.__=e,o.i=n,H.__h.push(o))}function ie(e){return W=5,se((function(){return{current:e}}),[])}function se(e,t){var n=ee(Q++,7);return de(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function ae(e,t){return W=8,se((function(){return e}),t)}function le(e){var t=H.context[e.__c],n=ee(Q++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(H)),t.props.value):e.__}function ce(){for(var e;e=X.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(pe),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(n){e.__H.__h=[],t.__e(n,e.__v)}}t.__b=function(e){H=null,U&&U(e)},t.__r=function(e){Y&&Y(e),Q=0;var t=(H=e.__c).__H;t&&(z===H?(t.__h=[],H.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=G,e.__N=e.i=void 0}))):(t.__h.forEach(pe),t.__h.forEach(fe),t.__h=[],Q=0)),z=H},t.diffed=function(e){Z&&Z(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(1!==X.push(n)&&V===t.requestAnimationFrame||((V=t.requestAnimationFrame)||he)(ce)),n.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==G&&(e.__=e.__V),e.i=void 0,e.__V=G}))),z=H=null},t.__c=function(e,n){n.some((function(e){try{e.__h.forEach(pe),e.__h=e.__h.filter((function(e){return!e.__||fe(e)}))}catch(o){n.some((function(e){e.__h&&(e.__h=[])})),n=[],t.__e(o,e.__v)}})),K&&K(e,n)},t.unmount=function(e){J&&J(e);var n,o=e.__c;o&&o.__H&&(o.__H.__.forEach((function(e){try{pe(e)}catch(e){n=e}})),o.__H=void 0,n&&t.__e(n,o.__v))};var ue="function"==typeof requestAnimationFrame;function he(e){var t,n=function(){clearTimeout(o),ue&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);ue&&(t=requestAnimationFrame(n))}function pe(e){var t=H,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),H=t}function fe(e){var t=H;e.__c=e.__(),H=t}function de(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function ge(e,t){return"function"==typeof t?t(e):t}function me(e){return Array.prototype.concat.apply([],e)}const ye=Object.prototype.toString,ve=Object.prototype.hasOwnProperty;function be(e){return void 0===e}function xe(e){return void 0!==e}function we(e){return null==e}function Oe(e){return"[object Array]"===ye.call(e)}function _e(e){return"[object Object]"===ye.call(e)}function ke(e){return"[object Number]"===ye.call(e)}function Se(e){const t=ye.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function Ee(e){return"[object String]"===ye.call(e)}function Ce(e,t){return ve.call(e,t)}function Pe(e,t){const n=He(t);let o;return Te(e,(function(e,t){if(n(e,t))return o=e,!1})),o}function Ae(e,t){const n=He(t);let o=[];return Te(e,(function(e,t){n(e,t)&&o.push(e)})),o}function Te(e,t){let n,o;if(be(e))return;const r=Oe(e)?Ve:ze;for(let i in e)if(Ce(e,i)&&(n=e[i],o=t(n,r(i)),!1===o))return n}function Me(e,t,n){return Te(e,(function(e,o){n=t(n,e,o)})),n}function Re(e,t){return!!Me(e,(function(e,n,o){return e&&t(n,o)}),!0)}function je(e,t){return!!Pe(e,t)}function Be(e,t){let n=[];return Te(e,(function(e,o){n.push(t(e,o))})),n}function De(e){return e&&Object.keys(e)||[]}function Le(e){return Be(e,(e=>e))}function $e(e,t,n={}){return t=Qe(t),Te(e,(function(e){let o=t(e)||"_",r=n[o];r||(r=n[o]=[]),r.push(e)})),n}function Ie(e,...t){e=Qe(e);let n={};return Te(t,(t=>$e(t,e,n))),Be(n,(function(e,t){return e[0]}))}const Ne=Ie;function qe(e,t){t=Qe(t);let n=[];return Te(e,(function(e,o){let r=t(e,o),i={d:r,v:e};for(var s=0;se.v))}function Fe(e){return function(t){return Re(e,(function(e,n){return t[n]===e}))}}function Qe(e){return Se(e)?e:t=>t[e]}function He(e){return Se(e)?e:t=>t===e}function ze(e){return e}function Ve(e){return Number(e)}function We(e,t){let n,o,r,i;function s(n){let s=Date.now(),c=n?0:i+t-s;if(c>0)return a(c);e.apply(r,o),l()}function a(e){n=setTimeout(s,e)}function l(){n&&clearTimeout(n),n=i=o=r=void 0}function c(...e){i=Date.now(),o=e,r=this,n||a(t)}return c.flush=function(){n&&s(!0),l()},c.cancel=l,c}function Xe(e,t){return e.bind(t)}function Ge(e,...t){return Object.assign(e,...t)}function Ue(e,t){let n={},o=Object(e);return Te(t,(function(t){t in o&&(n[t]=e[t])})),n}function Ye(e,t){for(var n in t)e[n]=t[n];return e}function Ze(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function Ke(e){this.props=e}(Ke.prototype=new v).isPureReactComponent=!0,Ke.prototype.shouldComponentUpdate=function(e,t){return Ze(this.props,e)||Ze(this.state,t)};var Je=t.__b;t.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Je&&Je(e)};var et="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function tt(e){function t(t){var n=Ye({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=et,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var nt=function(e,t){return null==e?null:E(E(e).map(t))},ot={map:nt,forEach:nt,count:function(e){return e?E(e).length:0},only:function(e){var t=E(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:E},rt=t.__e;t.__e=function(e,t,n,o){if(e.then)for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t);rt(e,t,n,o)};var it=t.unmount;function st(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=Ye({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return st(e,t,n)}))),e}function at(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return at(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function lt(){this.__u=0,this.t=null,this.__b=null}function ct(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function ut(){this.u=null,this.o=null}t.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),it&&it(e)},(lt.prototype=new v).__c=function(e,t){var n=t.__c,o=this;null==o.t&&(o.t=[]),o.t.push(n);var r=ct(o.__v),i=!1,s=function(){i||(i=!0,n.__R=null,r?r(a):a())};n.__R=s;var a=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=at(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.t.pop();)t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},lt.prototype.componentWillUnmount=function(){this.t=[]},lt.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=st(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&g(y,null,e.fallback);return r&&(r.__u&=-33),[g(y,null,t.__a?null:e.children),r]};var ht=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),t.i.removeChild(e)}}),I(g(pt,{context:t.context},e.__v),t.l)}function dt(e,t){var n=g(ft,{__v:e,i:t});return n.containerInfo=t,n}(ut.prototype=new v).__a=function(e){var t=this,n=ct(t.__v),o=t.o.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),ht(t,e,o)):r()};n?n(i):i()}},ut.prototype.render=function(e){this.u=null,this.o=new Map;var t=E(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},ut.prototype.componentDidUpdate=ut.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){ht(e,n,t)}))};var gt="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,mt=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,yt=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,vt=/[A-Z0-9]/g,bt="undefined"!=typeof document,xt=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};v.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(v.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var wt=t.event;function Ot(){}function _t(){return this.cancelBubble}function kt(){return this.defaultPrevented}t.event=function(e){return wt&&(e=wt(e)),e.persist=Ot,e.isPropagationStopped=_t,e.isDefaultPrevented=kt,e.nativeEvent=e};var St,Et={enumerable:!1,configurable:!0,get:function(){return this.class}},Ct=t.vnode;t.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={};for(var r in t){var i=t[r];if(!("value"===r&&"defaultValue"in t&&null==i||bt&&"children"===r&&"noscript"===n||"class"===r||"className"===r)){var s=r.toLowerCase();"defaultValue"===r&&"value"in t&&null==t.value?r="value":"download"===r&&!0===i?i="":"ondoubleclick"===s?r="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||xt(t.type)?"onfocus"===s?r="onfocusin":"onblur"===s?r="onfocusout":yt.test(r)?r=s:-1===n.indexOf("-")&&mt.test(r)?r=r.replace(vt,"-$&").toLowerCase():null===i&&(i=void 0):s=r="oninput","oninput"===s&&o[r=s]&&(r="oninputCapture"),o[r]=i}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=E(t.children).forEach((function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)}))),"select"==n&&null!=o.defaultValue&&(o.value=E(t.children).forEach((function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",Et)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=gt,Ct&&Ct(e)};var Pt=t.__r;t.__r=function(e){Pt&&Pt(e),St=e.__c};var At=t.diffed;t.diffed=function(e){At&&At(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),St=null};var Tt={ReactCurrentDispatcher:{current:{readContext:function(e){return St.__n[e.__c].props.value}}}};function Mt(e){return!!e&&e.$$typeof===gt}function Rt(e){e()}function jt(e){var t,n,o=e.v,r=e.__;try{var i=o();return!((t=r)===(n=i)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}var Bt={useState:te,useId:function(){var e=ee(Q++,11);if(!e.__){for(var t=H.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__},useReducer:ne,useEffect:oe,useLayoutEffect:re,useInsertionEffect:re,useTransition:function(){return[!1,Rt]},useDeferredValue:function(e){return e},useSyncExternalStore:function(e,t){var n=t(),o=te({h:{__:n,v:t}}),r=o[0].h,i=o[1];return re((function(){r.__=n,r.v=t,jt(r)&&i({h:r})}),[e,n,t]),oe((function(){return jt(r)&&i({h:r}),e((function(){jt(r)&&i({h:r})}))}),[e]),n},startTransition:Rt,useRef:ie,useImperativeHandle:function(e,t,n){W=6,re((function(){return"function"==typeof e?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0}),null==n?n:n.concat(e))},useMemo:se,useCallback:ae,useContext:le,useDebugValue:function(e,n){t.useDebugValue&&t.useDebugValue(n?n(e):e)},version:"17.0.2",Children:ot,render:function(e,t,n){return null==t.__k&&(t.textContent=""),I(e,t),"function"==typeof n&&n(),e?e.__c:null},hydrate:function(e,t,n){return N(e,t),"function"==typeof n&&n(),e?e.__c:null},unmountComponentAtNode:function(e){return!!e.__k&&(I(null,e),!0)},createPortal:dt,createElement:g,createContext:F,createFactory:function(e){return g.bind(null,e)},cloneElement:function(e){return Mt(e)?q.apply(null,arguments):e},createRef:function(){return{current:null}},Fragment:y,isValidElement:Mt,isElement:Mt,isFragment:function(e){return Mt(e)&&e.type===y},findDOMNode:function(e){return e&&(e.base||1===e.nodeType&&e)||null},Component:v,PureComponent:Ke,memo:function(e,t){function n(e){var n=this.props.ref,o=n==e.ref;return!o&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!o:Ze(this.props,e)}function o(t){return this.shouldComponentUpdate=n,g(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.prototype.isReactComponent=!0,o.__f=!0,o},forwardRef:tt,flushSync:function(e,t){return e(t)},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:y,Suspense:lt,SuspenseList:ut,lazy:function(e){var t,n,o;function r(r){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){o=e})),o)throw o;if(!n)throw t;return g(n,r)}return r.displayName="Lazy",r.__f=!0,r},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Tt},Dt=0;function Lt(e,n,o,r,i,s){var a,l,c={};for(l in n)"ref"==l?a=n[l]:c[l]=n[l];var u={type:e,props:c,key:o,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Dt,__i:-1,__u:0,__source:i,__self:s};if("function"==typeof e&&(a=e.defaultProps))for(l in a)void 0===c[l]&&(c[l]=a[l]);return t.vnode&&t.vnode(u),u}Array.isArray;var $t=n(967),It=n.n($t);function Nt(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}const qt=Object.prototype.toString,Ft=Object.prototype.hasOwnProperty;function Qt(e,t){return Ft.call(e,t)}function Ht(e,t){let n,o;if(void 0===e)return;const r=(i=e,"[object Array]"===qt.call(i)?Vt:zt);var i;for(let i in e)if(Qt(e,i)&&(n=e[i],o=t(n,r(i)),!1===o))return n}function zt(e){return e}function Vt(e){return Number(e)}function Wt(e,...t){const n=e.style;return Ht(t,(function(e){e&&Ht(e,(function(e,t){n[t]=e}))})),e}function Xt(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}const Gt=Object.prototype.toString;function Ut(e){return new Yt(e)}function Yt(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Zt(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}function Kt(e,t){return e&&"function"==typeof e.matches&&e.matches(t)}function Jt(e,t,n){for(var o=n?e:e.parentNode;o&&o.nodeType!==document.DOCUMENT_NODE&&o.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(Kt(o,t))return o;o=o.parentNode}return Kt(o,t)?o:null}Yt.prototype.add=function(e){return this.list.add(e),this},Yt.prototype.remove=function(e){return"[object RegExp]"==Gt.call(e)?this.removeMatching(e):(this.list.remove(e),this)},Yt.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n
a',fn=!sn.getElementsByTagName("link").length,sn=void 0);var dn={legend:[1,"
","
"],tr:[2,"","
"],col:[2,"","
"],_default:fn?[1,"X
","
"]:[0,"",""]};dn.td=dn.th=[3,"","
"],dn.option=dn.optgroup=[1,'"],dn.thead=dn.tbody=dn.colgroup=dn.caption=dn.tfoot=[1,"","
"],dn.polyline=dn.ellipse=dn.polygon=dn.circle=dn.text=dn.line=dn.path=dn.rect=dn.g=[1,'',""];var gn=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var o=n[1];if("body"==o)return(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild);var r=Object.prototype.hasOwnProperty.call(dn,o)?dn[o]:dn._default,i=r[0],s=r[1],a=r[2],l=t.createElement("div");for(l.innerHTML=s+e+a;i--;)l=l.lastChild;if(l.firstChild==l.lastChild)return l.removeChild(l.firstChild);for(var c=t.createDocumentFragment();l.firstChild;)c.appendChild(l.removeChild(l.firstChild));return c};function mn(e,t){return(t=t||document).querySelector(e)}function yn(e,t){return(t=t||document).querySelectorAll(e)}function vn(e){e.parentNode&&e.parentNode.removeChild(e)}const bn=1024;let xn=0;class wn{constructor(e,t){this.from=e,this.to=t}}class On{constructor(e={}){this.id=xn++,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=Sn.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}On.closedBy=new On({deserialize:e=>e.split(" ")}),On.openedBy=new On({deserialize:e=>e.split(" ")}),On.group=new On({deserialize:e=>e.split(" ")}),On.isolate=new On({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),On.contextHash=new On({perNode:!0}),On.lookAhead=new On({perNode:!0}),On.mounted=new On({perNode:!0});class _n{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[On.mounted.id]}}const kn=Object.create(null);class Sn{constructor(e,t,n,o=0){this.name=e,this.props=t,this.id=n,this.flags=o}static define(e){let t=e.props&&e.props.length?Object.create(null):kn,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),o=new Sn(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(o)),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 o}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(On.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 o of n.split(" "))t[o]=e[n];return e=>{for(let n=e.prop(On.group),o=-1;o<(n?n.length:0);o++){let r=t[o<0?e.name:n[o]];if(r)return r}}}}Sn.none=new Sn("",Object.create(null),0,8);class En{constructor(e){this.types=e;for(let t=0;t=t){let s=new Ln(i.tree,i.overlay[0].from+e.from,-1,e);(r||(r=[o])).push(Bn(s,t,n,!1))}}return r?Fn(r):o}(this,e,t)}iterate(e){let{enter:t,leave:n,from:o=0,to:r=this.length}=e,i=e.mode||0,s=(i&An.IncludeAnonymous)>0;for(let e=this.cursor(i|An.IncludeAnonymous);;){let i=!1;if(e.from<=r&&e.to>=o&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;i=!0}for(;i&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;i=!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:Xn(Sn.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,n)=>new Tn(this.type,e,t,n,this.propValues)),e.makeTree||((e,t,n)=>new Tn(Sn.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:o,maxBufferLength:r=bn,reused:i=[],minRepeatType:s=o.types.length}=e,a=Array.isArray(n)?new Mn(n,n.length):n,l=o.types,c=0,u=0;function h(e,t,n,m,y,v){let{id:b,start:x,end:w,size:O}=a,_=u;for(;O<0;){if(a.next(),-1==O){let t=i[b];return n.push(t),void m.push(x-e)}if(-3==O)return void(c=b);if(-4==O)return void(u=b);throw new RangeError(`Unrecognized record size: ${O}`)}let k,S,E=l[b],C=x-e;if(w-x<=r&&(S=function(e,t){let n=a.fork(),o=0,i=0,l=0,c=n.end-r,u={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){u.size=o,u.start=i,u.skip=l,l+=4,o+=4,n.next();continue}let a=n.pos-e;if(e<0||a=s?4:0,p=n.start;for(n.next();n.pos>a;){if(n.size<0){if(-3!=n.size)break e;h+=4}else n.id>=s&&(h+=4);n.next()}i=p,o+=e,l+=h}return(t<0||o==e)&&(u.size=o,u.start=i,u.skip=l),u.size>4?u:void 0}(a.pos-t,y))){let t=new Uint16Array(S.size-S.skip),n=a.pos-S.size,r=t.length;for(;a.pos>n;)r=g(S.start,t,r);k=new Rn(t,w-S.start,o),C=S.start-e}else{let e=a.pos-O;a.next();let t=[],n=[],o=b>=s?b:-1,i=0,l=w;for(;a.pos>e;)o>=0&&a.id==o&&a.size>=0?(a.end<=l-r&&(f(t,n,x,i,a.end,l,o,_),i=t.length,l=a.end),a.next()):v>2500?p(x,e,t,n):h(x,e,t,n,o,v+1);if(o>=0&&i>0&&i-1&&i>0){let e=function(e){return(t,n,o)=>{let r,i,s=0,a=t.length-1;if(a>=0&&(r=t[a])instanceof Tn){if(!a&&r.type==e&&r.length==o)return r;(i=r.prop(On.lookAhead))&&(s=n[a]+r.length+i)}return d(e,t,n,o,s)}}(E);k=Xn(E,t,n,0,t.length,0,w-x,e,e)}else k=d(E,t,n,w-x,_-w)}n.push(k),m.push(C)}function p(e,t,n,i){let s=[],l=0,c=-1;for(;a.pos>t;){let{id:e,start:t,end:n,size:o}=a;if(o>4)a.next();else{if(c>-1&&t=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 Rn(t,s[2]-r,o)),i.push(r-e)}}function f(e,t,n,r,i,s,a,l){let c=[],u=[];for(;e.length>r;)c.push(e.pop()),u.push(t.pop()+n-i);e.push(d(o.types[a],c,u,s-i,l-s)),t.push(i-n)}function d(e,t,n,o,r=0,i){if(c){let e=[On.contextHash,c];i=i?[e].concat(i):[e]}if(r>25){let e=[On.lookAhead,r];i=i?[e].concat(i):[e]}return new Tn(e,t,n,o,i)}function g(e,t,n){let{id:o,start:r,end:i,size:l}=a;if(a.next(),l>=0&&o4){let o=a.pos-(l-4);for(;a.pos>o;)n=g(e,t,n)}t[--n]=s,t[--n]=i-e,t[--n]=r-e,t[--n]=o}else-3==l?c=o:-4==l&&(u=o);return n}let m=[],y=[];for(;a.pos>0;)h(e.start||0,e.bufferStart||0,m,y,-1,0);let v=null!==(t=e.length)&&void 0!==t?t:m.length?y[0]+m[0].length:0;return new Tn(l[e.topID],m.reverse(),y.reverse(),v)}(e)}}Tn.empty=new Tn(Sn.none,[],[],0);class Mn{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 Mn(this.buffer,this.index)}}class Rn{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Sn.none}toString(){let e=[];for(let t=0;t0));a=i[a+3]);return s}slice(e,t,n){let o=this.buffer,r=new Uint16Array(t-e),i=0;for(let s=e,a=0;s=t&&nt;case 1:return n<=t&&o>t;case 2:return o>t;case 4:return!0}}function Bn(e,t,n,o){for(var r;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?s.length:-1;e!=l;e+=t){let l=s[e],c=a[e]+i.from;if(jn(o,n,c,c+l.length))if(l instanceof Rn){if(r&An.ExcludeBuffers)continue;let s=l.findChild(0,l.buffer.length,t,n-c,o);if(s>-1)return new qn(new Nn(i,l,e,c),null,s)}else if(r&An.IncludeAnonymous||!l.type.isAnonymous||zn(l)){let s;if(!(r&An.IgnoreMounts)&&(s=_n.get(l))&&!s.overlay)return new Ln(s.tree,c,e,i);let a=new Ln(l,c,e,i);return r&An.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?l.children.length-1:0,t,n,o)}}if(r&An.IncludeAnonymous||!i.type.isAnonymous)return null;if(e=i.index>=0?i.index+t:t<0?-1:i._parent._tree.children.length,i=i._parent,!i)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 o;if(!(n&An.IgnoreOverlays)&&(o=_n.get(this._tree))&&o.overlay){let n=e-this.from;for(let{from:e,to:r}of o.overlay)if((t>0?e<=n:e=n:r>n))return new Ln(o.tree,o.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 $n(e,t,n,o){let r=e.cursor(),i=[];if(!r.firstChild())return i;if(null!=n)for(let e=!1;!e;)if(e=r.type.is(n),!r.nextSibling())return i;for(;;){if(null!=o&&r.type.is(o))return i;if(r.type.is(t)&&i.push(r.node),!r.nextSibling())return null==o?i:[]}}function In(e,t,n=t.length-1){for(let o=e.parent;n>=0;o=o.parent){if(!o)return!1;if(!o.type.isAnonymous){if(t[n]&&t[n]!=o.name)return!1;n--}}return!0}class Nn{constructor(e,t,n,o){this.parent=e,this.buffer=t,this.index=n,this.start=o}}class qn extends Dn{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:o}=this.context,r=o.findChild(this.index+4,o.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new qn(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&An.ExcludeBuffers)return null;let{buffer:o}=this.context,r=o.findChild(this.index+4,o.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new qn(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 qn(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 qn(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,o=this.index+4,r=n.buffer[this.index+3];if(r>o){let i=n.buffer[this.index+1];e.push(n.slice(o,r,i)),t.push(0)}return new Tn(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Fn(e){if(!e.length)return null;let t=0,n=e[0];for(let o=1;on.from||r.to0){if(this.index-1)for(let o=t+e,r=e<0?-1:n._tree.children.length;o!=r;o+=e){let e=n._tree.children[o];if(this.mode&An.IncludeAnonymous||e instanceof Rn||!e.type.isAnonymous||zn(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=0;){for(let i=e;i;i=i._parent)if(i.index==o){if(o==this.index)return i;t=i,n=r+1;break e}o=this.stack[--r]}for(let e=n;e=0;r--){if(r<0)return In(this.node,e,o);let i=n[t.buffer[this.stack[r]]];if(!i.isAnonymous){if(e[o]&&e[o]!=i.name)return!1;o--}}return!0}}function zn(e){return e.children.some((e=>e instanceof Rn||!e.type.isAnonymous||zn(e)))}const Vn=new WeakMap;function Wn(e,t){if(!e.isAnonymous||t instanceof Rn||t.type!=e)return 1;let n=Vn.get(t);if(null==n){n=1;for(let o of t.children){if(o.type!=e||!(o instanceof Tn)){n=1;break}n+=Wn(e,o)}Vn.set(t,n)}return n}function Xn(e,t,n,o,r,i,s,a,l){let c=0;for(let n=o;n=u)break;d+=t}if(c==r+1){if(d>u){let e=n[r];t(e.children,e.positions,0,e.children.length,o[r]+a);continue}h.push(n[r])}else{let t=o[c-1]+n[c-1].length-f;h.push(Xn(e,n,o,r,c,f,t,null,l))}p.push(f+a-i)}}(t,n,o,r,0),(a||l)(h,p,s)}class Gn{constructor(e,t,n,o,r=!1,i=!1){this.from=e,this.to=t,this.tree=n,this.offset=o,this.open=(r?1:0)|(i?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let o=[new Gn(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&o.push(n);return o}static applyChanges(e,t,n=128){if(!t.length)return e;let o=[],r=1,i=e.length?e[0]:null;for(let s=0,a=0,l=0;;s++){let c=s=n)for(;i&&i.from=t.from||u<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,u)-l;t=e>=n?null:new Gn(e,n,t.tree,t.offset+l,s>0,!!c)}if(t&&o.push(t),i.to>u)break;i=rnew wn(e.from,e.to))):[new wn(0,0)]:[new wn(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let o=this.startParse(e,t,n);for(;;){let e=o.advance();if(e)return e}}}class Yn{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)}}class Zn{constructor(e,t,n,o,r){this.parser=e,this.parse=t,this.overlay=n,this.target=o,this.from=r}}function Kn(e){if(!e.length||e.some((e=>e.from>=e.to)))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class Jn{constructor(e,t,n,o,r,i,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=o,this.start=r,this.target=i,this.prev=s,this.depth=0,this.ranges=[]}}const eo=new On({perNode:!0});class to{constructor(e,t,n,o,r){this.nest=t,this.input=n,this.fragments=o,this.ranges=r,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),null!=this.stoppedAt)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return null!=this.stoppedAt&&(e=new Tn(e.type,e.children,e.positions,e.length,e.propValues.concat([[eo,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[On.mounted.id]=new _n(t,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)a=!1;else if(e.hasNode(o)){if(t){let e=t.mounts.find((e=>e.frag.from<=o.from&&e.frag.to>=o.to&&e.mount.overlay));if(e)for(let n of e.mount.overlay){let r=n.from+e.pos,i=n.to+e.pos;r>=o.from&&i<=o.to&&!t.ranges.some((e=>e.fromr))&&t.ranges.push({from:r,to:i})}}a=!1}else if(n&&(i=no(n.ranges,o.from,o.to)))a=2!=i;else if(!o.type.isAnonymous&&(r=this.nest(o,this.input))&&(o.fromnew wn(e.from-o.from,e.to-o.from))):null,o.tree,e.length?e[0].from:o.from)),r.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):a=!1}}else t&&(s=t.predicate(o))&&(!0===s&&(s=new wn(o.from,o.to)),s.fromnew wn(e.from-t.start,e.to-t.start))),t.target,e[0].from))),t=t.prev}n&&! --n.depth&&(n=n.prev)}}}}function no(e,t,n){for(let o of e){if(o.from>=n)break;if(o.to>t)return o.from<=t&&o.to>=n?2:1}return 0}function oo(e,t,n,o,r,i){if(t=e&&t.enter(n,1,An.IgnoreOverlays|An.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(!(t.children.length&&0==t.positions[0]&&t.children[0]instanceof Tn))break;t=t.children[0]}return!1}}class so{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=null!==(t=n.tree.prop(eo))&&void 0!==t?t:n.to,this.inner=new io(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(e=t.tree.prop(eo))&&void 0!==e?e:t.to,this.inner=new io(t.tree,-t.offset)}}findMounts(e,t){var n;let o=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let r=null===(n=e.tree)||void 0===n?void 0:n.prop(On.mounted);if(r&&r.parser==t)for(let t=this.fragI;t=e.to)break;n.tree==this.curFrag.tree&&o.push({frag:n,pos:e.from-n.offset,mount:r})}}}return o}}function ao(e,t){let n=null,o=t;for(let r=1,i=0;r=a)break;e.to<=s||(n||(o=n=t.slice()),e.froma&&n.splice(i+1,0,new wn(a,e.to))):e.to>a?n[i--]=new wn(a,e.to):n.splice(i--,1))}}return o}function lo(e,t,n,o){let r=0,i=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let u=r==e.length?1e9:s?e[r].to:e[r].from,h=i==t.length?1e9:a?t[i].to:t[i].from;if(s!=a){let e=Math.max(l,n),t=Math.min(u,h,o);enew wn(e.from+o,e.to+o))),a,l);for(let t=0,o=a;;t++){let a=t==s.length,c=a?l:s[t].from;if(c>o&&n.push(new Gn(o,c,r.tree,-e,i.from>=o||i.openStart,i.to<=c||i.openEnd)),a)break;o=s[t].to}}else n.push(new Gn(a,l,r.tree,-e,i.from>=e||i.openStart,i.to<=s||i.openEnd))}return n}class uo{constructor(e,t,n,o,r,i,s,a,l,c=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=o,this.pos=r,this.score=i,this.buffer=s,this.bufferBase=a,this.curContext=l,this.lookAhead=c,this.parent=u}toString(){return`[${this.stack.filter(((e,t)=>t%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let o=e.parser.context;return new uo(e,[],t,n,n,0,[],0,o?new ho(o,o.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,o=65535&e,{parser:r}=this.p,i=r.dynamicPrecedence(o);if(i&&(this.score+=i),0==n)return this.pushState(r.getGoto(this.state,o,!0),this.reducePos),o=2e3&&!(null===(t=this.p.parser.nodeSet.types[o])||void 0===t?void 0:t.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizes;)this.stack.pop();this.reduceContext(o,a)}storeNode(e,t,n,o=4,r=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==e.buffer[o-4]&&e.buffer[o-1]>-1){if(t==n)return;if(e.buffer[o-2]>=t)return void(e.buffer[o-2]=n)}}if(r&&this.pos!=n){let r=this.buffer.length;if(r>0&&0!=this.buffer[r-4])for(;r>0&&this.buffer[r-2]>n;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,o>4&&(o-=4);this.buffer[r]=e,this.buffer[r+1]=t,this.buffer[r+2]=n,this.buffer[r+3]=o}else this.buffer.push(e,t,n,o)}shift(e,t,n,o){if(131072&e)this.pushState(65535&e,this.pos);else if(0==(262144&e)){let r=e,{parser:i}=this.p;(o>this.pos||t<=i.maxNode)&&(this.pos=o,i.stateFlag(r,1)||(this.reducePos=o)),this.pushState(r,n),this.shiftContext(t,n),t<=i.maxNode&&this.buffer.push(t,n,o,4)}else this.pos=o,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,o,4)}apply(e,t,n,o){65536&e?this.reduce(e):this.shift(e,t,n,o)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let o=this.pos;this.reducePos=this.pos=o+e.length,this.pushState(t,o),this.buffer.push(n,o,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),o=e.bufferBase+t;for(;e&&o==e.bufferBase;)e=e.parent;return new uo(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,o,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new po(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(0==(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let o,r=0;r1&t&&e==o))||n.push(t[e],o)}t=n}let n=[];for(let e=0;e>19,o=65535&t,r=this.stack.length-3*n;if(r<0||e.getGoto(this.stack[r],o,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(o,r)=>{if(!t.includes(o))return t.push(o),e.allActions(o,(t=>{if(393216&t);else if(65536&t){let n=(t>>19)-r;if(n>1){let o=65535&t,r=this.stack.length-3*n;if(r>=0&&e.getGoto(this.stack[r],o,!1)>=0)return n<<19|65536|o}}else{let e=n(t,r+1);if(null!=e)return e}}))};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class ho{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class po{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let o=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=o}}class fo{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new fo(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new fo(this.stack,this.pos,this.index)}}function go(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let o=0,r=0;o=92&&t--,t>=34&&t--;let r=t-32;if(r>=46&&(r-=46,n=!0),i+=r,n)break;i*=46}n?n[r++]=i:n=new t(i)}return n}class mo{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const yo=new mo;class vo{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=yo,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,o=this.rangeIndex,r=this.pos+e;for(;rn.to:r>=n.to;){if(o==this.ranges.length-1)return null;let e=this.ranges[++o];r+=e.from-n.to,n=e}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t,n,o=this.chunkOff+e;if(o>=0&&o=this.chunk2Pos&&to.to&&(this.chunk2=this.chunk2.slice(0,o.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=yo,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let o of this.ranges){if(o.from>=t)break;o.to>e&&(n+=this.input.read(Math.max(o.from,e),Math.min(o.to,t)))}return n}}class bo{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;!function(e,t,n,o,r,i){let s=0,a=1<0){let n=e[o];if(l.allows(n)&&(-1==t.token.value||t.token.value==n||Oo(n,t.token.value,r,i))){t.acceptToken(n);break}}let o=t.next,c=0,u=e[s+2];if(!(t.next<0&&u>c&&65535==e[n+3*u-3])){for(;c>1,i=n+r+(r<<1),a=e[i],l=e[i+1]||65536;if(o=l)){s=e[i+2],t.advance();continue e}c=r+1}}break}s=e[n+3*u-1]}}(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}bo.prototype.contextual=bo.prototype.fallback=bo.prototype.extend=!1,bo.prototype.fallback=bo.prototype.extend=!1;class xo{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function wo(e,t,n){for(let o,r=t;65535!=(o=e[r]);r++)if(o==n)return r-t;return-1}function Oo(e,t,n,o){let r=wo(n,o,t);return r<0||wo(n,o,e)t)&&!o.type.isError)return n<0?Math.max(0,Math.min(o.to-1,t-25)):Math.min(e.length,Math.max(o.from+1,t+25));if(n<0?o.prevSibling():o.nextSibling())break;if(!o.parent())return n<0?0:e.length}}class Eo{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?So(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?So(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=i,null;if(r instanceof Tn){if(i==e){if(i=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(i),this.index.push(0))}else this.index[t]++,this.nextStart=i+r.length}}}class Co{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((e=>new mo))}getActions(e){let t=0,n=null,{parser:o}=e.p,{tokenizers:r}=o,i=o.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,a=0;for(let o=0;oc.end+25&&(a=Math.max(c.lookAhead,a)),0!=c.value)){let o=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!l.extend&&(n=c,t>o))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),n||e.pos!=this.stream.end||(n=new mo,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new mo,{pos:n,p:o}=e;return t.start=n,t.end=Math.min(n+1,o.stream.end),t.value=n==o.stream.end?o.parser.eofTerm:0,t}updateCachedToken(e,t,n){let o=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(o,e),n),e.value>-1){let{parser:t}=n.p;for(let o=0;o=0&&n.p.parser.dialect.allows(r>>1)){0==(1&r)?e.value=r>>1:e.extended=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(o+1)}putAction(e,t,n,o){for(let t=0;t4*e.bufferLength?new Eo(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,o=this.minStackPos,r=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let i=0;io)r.push(s);else{if(this.advanceStack(s,r,n))continue;{e||(e=[],t=[]),e.push(s);let n=this.tokens.getMainToken(s);t.push(n.value,n.end)}}break}}if(!r.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scorethis.stoppedAt?e[0]:this.runRecovery(e,t,r);if(n)return _o&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(r.length>e)for(r.sort(((e,t)=>t.score-e.score));r.length>e;)r.pop();r.some((e=>e.reducePos>o))&&this.recovering--}else if(r.length>1){e:for(let e=0;e500&&o.buffer.length>500){if(!((t.score-o.score||t.buffer.length-o.buffer.length)>0)){r.splice(e--,1);continue e}r.splice(n--,1)}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let e=1;e ":"";if(null!=this.stoppedAt&&o>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let s=this.fragments.nodeAt(o);s;){let o=this.parser.nodeSet.types[s.type.id]==s.type?r.getGoto(e.state,s.type.id):-1;if(o>-1&&s.length&&(!t||(s.prop(On.contextHash)||0)==n))return e.useNode(s,o),_o&&console.log(i+this.stackID(e)+` (via reuse of ${r.getName(s.type.id)})`),!0;if(!(s instanceof Tn)||0==s.children.length||s.positions[0]>0)break;let a=s.children[0];if(!(a instanceof Tn&&0==s.positions[0]))break;s=a}}let s=r.stateSlot(e.state,4);if(s>0)return e.reduce(s),_o&&console.log(i+this.stackID(e)+` (via always-reduce ${r.getName(65535&s)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let s=0;so?t.push(p):n.push(p)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Ao(e,t),!0}}runRecovery(e,t,n){let o=null,r=!1;for(let i=0;i ":"";if(s.deadEnd){if(r)continue;if(r=!0,s.restart(),_o&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))continue}let u=s.split(),h=c;for(let e=0;u.forceReduce()&&e<10&&(_o&&console.log(h+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,n));e++)_o&&(h=this.stackID(u)+" -> ");for(let e of s.recoverByInsert(a))_o&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),_o&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(a)})`),Ao(s,n)):(!o||o.scoree;class Ro{constructor(e){this.start=e.start,this.shift=e.shift||Mo,this.reduce=e.reduce||Mo,this.reuse=e.reuse||Mo,this.hash=e.hash||(()=>0),this.strict=!1!==e.strict}}class jo extends Un{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;ne.topRules[t][1])),o=[];for(let e=0;e=0)r(o,e,t[n++]);else{let i=t[n+-o];for(let s=-o;s>0;s--)r(t[n++],e,i);n++}}}this.nodeSet=new En(t.map(((t,r)=>Sn.define({name:r>=this.minRepeatTerm?void 0:t,id:r,props:o[r],top:n.indexOf(r)>-1,error:0==r,skipped:e.skippedNodes&&e.skippedNodes.indexOf(r)>-1})))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=bn;let i=go(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e"number"==typeof e?new bo(i,e):e)),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let o=new Po(this,e,t,n);for(let r of this.wrappers)o=r(o,e,t,n);return o}getGoto(e,t,n=!1){let o=this.goto;if(t>=o[0])return-1;for(let r=o[t+1];;){let t=o[r++],i=1&t,s=o[r++];if(i&&n)return s;for(let n=r+(t>>1);r0}validAction(e,t){return!!this.allActions(e,(e=>e==t||null))}allActions(e,t){let n=this.stateSlot(e,4),o=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==o;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Bo(this.data,n+2)}o=t(Bo(this.data,n+1))}return o}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Bo(this.data,n+2)}if(0==(1&this.data[n+2])){let e=this.data[n+1];t.some(((t,n)=>1&n&&t==e))||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(jo.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map((t=>{let n=e.tokenizers.find((e=>e.from==t));return n?n.to:t}))),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map(((n,o)=>{let r=e.specializers.find((e=>e.from==n.external));if(!r)return n;let i=Object.assign(Object.assign({},n),{external:r.to});return t.specializers[o]=Do(i),i}))),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map((()=>!1));if(e)for(let o of e.split(" ")){let e=t.indexOf(o);e>=0&&(n[e]=!0)}let o=null;for(let e=0;ee.external(n,o)<<1|t}return e.get}let Lo=0;class $o{constructor(e,t,n){this.set=e,this.base=t,this.modified=n,this.id=Lo++}static define(e){if(null==e?void 0:e.base)throw new Error("Can not derive from a modified tag");let t=new $o([],null,[]);if(t.set.push(t),e)for(let n of e.set)t.set.push(n);return t}static defineModifier(){let e=new No;return t=>t.modified.indexOf(e)>-1?t:No.get(t.base||t,t.modified.concat(e).sort(((e,t)=>e.id-t.id)))}}let Io=0;class No{constructor(){this.instances=[],this.id=Io++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((n=>n.base==e&&function(e,t){return e.length==t.length&&e.every(((e,n)=>e==t[n]))}(t,n.modified)));if(n)return n;let o=[],r=new $o(o,e,t);for(let e of t)e.instances.push(r);let i=function(e){let t=[[]];for(let n=0;nt.length-e.length))}(t);for(let t of e.set)if(!t.modified.length)for(let e of i)o.push(No.get(t,e));return r}}function qo(e){let t=Object.create(null);for(let n in e){let o=e[n];Array.isArray(o)||(o=[o]);for(let e of n.split(" "))if(e){let n=[],r=2,i=e;for(let t=0;;){if("..."==i&&t>0&&t+3==e.length){r=1;break}let o=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(i);if(!o)throw new RangeError("Invalid path: "+e);if(n.push("*"==o[0]?"":'"'==o[0][0]?JSON.parse(o[0]):o[0]),t+=o[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);i=e.slice(t)}let s=n.length-1,a=n[s];if(!a)throw new RangeError("Invalid path: "+e);let l=new Qo(o,r,s>0?n.slice(0,s):null);t[a]=l.sort(t[a])}}return Fo.add(t)}const Fo=new On;class Qo{constructor(e,t,n,o){this.tags=e,this.mode=t,this.context=n,this.next=o}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth{let t=r;for(let o of e)for(let e of o.set){let o=n[e.id];if(o){t=t?t+" "+o:o;break}}return t},scope:o}}function zo(e,t,n,o=0,r=e.length){let i=new Vo(o,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),o,r,"",i.highlighters),i.flush(r)}Qo.empty=new Qo([],2,null);class Vo{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,o,r){let{type:i,from:s,to:a}=e;if(s>=n||a<=t)return;i.isTop&&(r=this.highlighters.filter((e=>!e.scope||e.scope(i))));let l=o,c=function(e){let t=e.type.prop(Fo);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||Qo.empty,u=function(e,t){let n=null;for(let o of e){let e=o.style(t);e&&(n=n?n+" "+e:e)}return n}(r,c.tags);if(u&&(l&&(l+=" "),l+=u,1==c.mode&&(o+=(o?" ":"")+u)),this.startSpan(Math.max(t,s),l),c.opaque)return;let h=e.tree&&e.tree.prop(On.mounted);if(h&&h.overlay){let i=e.node.enter(h.overlay[0].from+s,1),c=this.highlighters.filter((e=>!e.scope||e.scope(h.tree.type))),u=e.firstChild();for(let p=0,f=s;;p++){let d=p=g)&&e.nextSibling()););if(!d||g>n)break;f=d.to+s,f>t&&(this.highlightRange(i.cursor(),Math.max(t,d.from+s),Math.min(n,f),"",c),this.startSpan(Math.min(n,f),l))}u&&e.parent()}else if(e.firstChild()){h&&(o="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,o,r),this.startSpan(Math.min(n,e.to),l)}}while(e.nextSibling());e.parent()}}}const Wo=$o.define,Xo=Wo(),Go=Wo(),Uo=Wo(Go),Yo=Wo(Go),Zo=Wo(),Ko=Wo(Zo),Jo=Wo(Zo),er=Wo(),tr=Wo(er),nr=Wo(),or=Wo(),rr=Wo(),ir=Wo(rr),sr=Wo(),ar={comment:Xo,lineComment:Wo(Xo),blockComment:Wo(Xo),docComment:Wo(Xo),name:Go,variableName:Wo(Go),typeName:Uo,tagName:Wo(Uo),propertyName:Yo,attributeName:Wo(Yo),className:Wo(Go),labelName:Wo(Go),namespace:Wo(Go),macroName:Wo(Go),literal:Zo,string:Ko,docString:Wo(Ko),character:Wo(Ko),attributeValue:Wo(Ko),number:Jo,integer:Wo(Jo),float:Wo(Jo),bool:Wo(Zo),regexp:Wo(Zo),escape:Wo(Zo),color:Wo(Zo),url:Wo(Zo),keyword:nr,self:Wo(nr),null:Wo(nr),atom:Wo(nr),unit:Wo(nr),modifier:Wo(nr),operatorKeyword:Wo(nr),controlKeyword:Wo(nr),definitionKeyword:Wo(nr),moduleKeyword:Wo(nr),operator:or,derefOperator:Wo(or),arithmeticOperator:Wo(or),logicOperator:Wo(or),bitwiseOperator:Wo(or),compareOperator:Wo(or),updateOperator:Wo(or),definitionOperator:Wo(or),typeOperator:Wo(or),controlOperator:Wo(or),punctuation:rr,separator:Wo(rr),bracket:ir,angleBracket:Wo(ir),squareBracket:Wo(ir),paren:Wo(ir),brace:Wo(ir),content:er,heading:tr,heading1:Wo(tr),heading2:Wo(tr),heading3:Wo(tr),heading4:Wo(tr),heading5:Wo(tr),heading6:Wo(tr),contentSeparator:Wo(er),list:Wo(er),quote:Wo(er),emphasis:Wo(er),strong:Wo(er),link:Wo(er),monospace:Wo(er),strikethrough:Wo(er),inserted:Wo(),deleted:Wo(),changed:Wo(),invalid:Wo(),meta:sr,documentMeta:Wo(sr),annotation:Wo(sr),processingInstruction:Wo(sr),definition:$o.defineModifier(),constant:$o.defineModifier(),function:$o.defineModifier(),standard:$o.defineModifier(),local:$o.defineModifier(),special:$o.defineModifier()};Ho([{tag:ar.link,class:"tok-link"},{tag:ar.heading,class:"tok-heading"},{tag:ar.emphasis,class:"tok-emphasis"},{tag:ar.strong,class:"tok-strong"},{tag:ar.keyword,class:"tok-keyword"},{tag:ar.atom,class:"tok-atom"},{tag:ar.bool,class:"tok-bool"},{tag:ar.url,class:"tok-url"},{tag:ar.labelName,class:"tok-labelName"},{tag:ar.inserted,class:"tok-inserted"},{tag:ar.deleted,class:"tok-deleted"},{tag:ar.literal,class:"tok-literal"},{tag:ar.string,class:"tok-string"},{tag:ar.number,class:"tok-number"},{tag:[ar.regexp,ar.escape,ar.special(ar.string)],class:"tok-string2"},{tag:ar.variableName,class:"tok-variableName"},{tag:ar.local(ar.variableName),class:"tok-variableName tok-local"},{tag:ar.definition(ar.variableName),class:"tok-variableName tok-definition"},{tag:ar.special(ar.variableName),class:"tok-variableName2"},{tag:ar.definition(ar.propertyName),class:"tok-propertyName tok-definition"},{tag:ar.typeName,class:"tok-typeName"},{tag:ar.namespace,class:"tok-namespace"},{tag:ar.className,class:"tok-className"},{tag:ar.macroName,class:"tok-macroName"},{tag:ar.propertyName,class:"tok-propertyName"},{tag:ar.operator,class:"tok-operator"},{tag:ar.comment,class:"tok-comment"},{tag:ar.meta,class:"tok-meta"},{tag:ar.invalid,class:"tok-invalid"},{tag:ar.punctuation,class:"tok-punctuation"}]);class lr{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]=yr(this,e,t);let o=[];return this.decompose(0,e,o,2),n.length&&n.decompose(0,n.length,o,3),this.decompose(t,this.length,o,1),ur.from(o,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=yr(this,e,t);let n=[];return this.decompose(e,t,n,0),ur.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),o=new fr(this),r=new fr(e);for(let e=t,i=t;;){if(o.next(e),r.next(e),e=0,o.lineBreak!=r.lineBreak||o.done!=r.done||o.value!=r.value)return!1;if(i+=o.value.length,o.done||i>=n)return!0}}iter(e=1){return new fr(this,e)}iterRange(e,t=this.length){return new dr(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let o=this.line(e).from;n=this.iterRange(o,Math.max(o,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new gr(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 cr(e):ur.from(cr.split(e,[])):lr.empty}}class cr extends lr{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,o){for(let r=0;;r++){let i=this.text[r],s=o+i.length;if((t?n:s)>=e)return new mr(o,s,n,i);o=s+1,n++}}decompose(e,t,n,o){let r=e<=0&&t>=this.length?this:new cr(pr(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&o){let e=n.pop(),t=hr(r.text,e.text.slice(),0,r.length);if(t.length<=32)n.push(new cr(t,e.length+r.length));else{let e=t.length>>1;n.push(new cr(t.slice(0,e)),new cr(t.slice(e)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof cr))return super.replace(e,t,n);[e,t]=yr(this,e,t);let o=hr(this.text,hr(n.text,pr(this.text,0,e)),t),r=this.length+n.length-(t-e);return o.length<=32?new cr(o,r):ur.from(cr.split(o,[]),r)}sliceString(e,t=this.length,n="\n"){[e,t]=yr(this,e,t);let o="";for(let r=0,i=0;r<=t&&ie&&i&&(o+=n),er&&(o+=s.slice(Math.max(0,e-r),t-r)),r=a+1}return o}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],o=-1;for(let r of e)n.push(r),o+=r.length+1,32==n.length&&(t.push(new cr(n,o)),n=[],o=-1);return o>-1&&t.push(new cr(n,o)),t}}class ur extends lr{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,o){for(let r=0;;r++){let i=this.children[r],s=o+i.length,a=n+i.lines-1;if((t?a:s)>=e)return i.lineInner(e,t,n,o);o=s+1,n=a+1}}decompose(e,t,n,o){for(let r=0,i=0;i<=t&&r=i){let r=o&((i<=e?1:0)|(a>=t?2:0));i>=e&&a<=t&&!r?n.push(s):s.decompose(e-i,t-i,n,r)}i=a+1}}replace(e,t,n){if([e,t]=yr(this,e,t),n.lines=r&&t<=s){let a=i.replace(e-r,t-r,n),l=this.lines-i.lines+a.lines;if(a.lines>4&&a.lines>l>>6){let r=this.children.slice();return r[o]=a,new ur(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]=yr(this,e,t);let o="";for(let r=0,i=0;re&&r&&(o+=n),ei&&(o+=s.sliceString(e-i,t-i,n)),i=a+1}return o}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ur))return 0;let n=0,[o,r,i,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;o+=t,r+=t){if(o==i||r==s)return n;let a=this.children[o],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 cr(n,t)}let o=Math.max(32,n>>5),r=o<<1,i=o>>1,s=[],a=0,l=-1,c=[];function u(e){let t;if(e.lines>r&&e instanceof ur)for(let t of e.children)u(t);else e.lines>i&&(a>i||!a)?(h(),s.push(e)):e instanceof cr&&a&&(t=c[c.length-1])instanceof cr&&e.lines+t.lines<=32?(a+=e.lines,l+=e.length+1,c[c.length-1]=new cr(t.text.concat(e.text),t.length+1+e.length)):(a+e.lines>o&&h(),a+=e.lines,l+=e.length+1,c.push(e))}function h(){0!=a&&(s.push(1==c.length?c[0]:ur.from(c,l)),l=-1,a=c.length=0)}for(let t of e)u(t);return h(),1==s.length?s[0]:new ur(s,t)}}function hr(e,t,n=0,o=1e9){for(let r=0,i=0,s=!0;i=n&&(l>o&&(a=a.slice(0,o-r)),r0?1:(e instanceof cr?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,o=this.nodes[n],r=this.offsets[n],i=r>>1,s=o instanceof cr?o.text.length:o.children.length;if(i==(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(o instanceof cr){let r=o.text[i+(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=o.children[i+(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 cr?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 dr{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new fr(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:o}=this.cursor.next(e);return this.pos+=(o.length+e)*t,this.value=o.length<=n?o:t<0?o.slice(o.length-n):o.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 gr{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:o}=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=o,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(lr.prototype[Symbol.iterator]=function(){return this.iter()},fr.prototype[Symbol.iterator]=dr.prototype[Symbol.iterator]=gr.prototype[Symbol.iterator]=function(){return this});class mr{constructor(e,t,n,o){this.from=e,this.to=t,this.number=n,this.text=o}get length(){return this.to-this.from}}function yr(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}let vr="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 e=1;ee)return vr[t-1]<=e;return!1}function xr(e){return e>=127462&&e<=127487}const wr=8205;function Or(e,t,n=!0,o=!0){return(n?_r:kr)(e,t,o)}function _r(e,t,n){if(t==e.length)return t;t&&Sr(e.charCodeAt(t))&&Er(e.charCodeAt(t-1))&&t--;let o=Cr(e,t);for(t+=Ar(o);t=0&&xr(Cr(e,o));)n++,o-=2;if(n%2==0)break;t+=2}}}return t}function kr(e,t,n){for(;t>0;){let o=_r(e,t-2,n);if(o=56320&&e<57344}function Er(e){return e>=55296&&e<56320}function Cr(e,t){let n=e.charCodeAt(t);if(!Er(n)||t+1==e.length)return n;let o=e.charCodeAt(t+1);return Sr(o)?o-56320+(n-55296<<10)+65536:n}function Pr(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function Ar(e){return e<65536?1:2}const Tr=/\r\n?|\n/;var Mr=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Mr||(Mr={}));class Rr{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-o);r+=s}else{if(n!=Mr.Simple&&l>=e&&(n==Mr.TrackDel&&oe||n==Mr.TrackBefore&&oe))return null;if(l>e||l==e&&t<0&&!s)return e==o||t<0?r:r+a;r+=a}o=l}if(e>o)throw new RangeError(`Position ${e} is out of range for changeset of length ${o}`);return r}touchesRange(e,t=e){for(let n=0,o=0;n=0&&o<=t&&r>=e)return!(ot)||"cover";o=r}return!1}toString(){let e="";for(let t=0;t=0?":"+o:"")}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 Rr(e)}static create(e){return new Rr(e)}}class jr extends Rr{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 Lr(this,((t,n,o,r,i)=>e=e.replace(o,o+(n-t),i)),!1),e}mapDesc(e,t=!1){return $r(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let o=0,r=0;o=0){t[o]=s,t[o+1]=i;let a=o>>1;for(;n.length0&&Dr(n,t,r.text),r.forward(e),s+=e}let l=e[i++];for(;s>1].toJSON()))}return e}static of(e,t,n){let o=[],r=[],i=0,s=null;function a(e=!1){if(!e&&!o.length)return;is||e<0||s>t)throw new RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let u=c?"string"==typeof c?lr.of(c.split(n||Tr)):c:lr.empty,h=u.length;if(e==s&&0==h)return;ei&&Br(o,e-i,-1),Br(o,s-e,h),Dr(r,o,u),i=s}}(e),a(!s),s}static empty(e){return new jr(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let o=0;ot&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)t.push(r[0],0);else{for(;n.length=0&&n<=0&&n==e[r+1]?e[r]+=t:0==t&&0==e[r]?e[r+1]+=n:o?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function Dr(e,t,n){if(0==n.length)return;let o=t.length-2>>1;if(o>1])),!(n||s==e.sections.length||e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(r,c,i,u,h),r=c,i=u}}}function $r(e,t,n,o=!1){let r=[],i=o?[]:null,s=new Nr(e),a=new Nr(t);for(let e=-1;;)if(-1==s.ins&&-1==a.ins){let e=Math.min(s.len,a.len);Br(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=0&&e=0)){if(s.done&&a.done)return i?jr.createSet(r,i):Rr.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.lent||s.ins>=0&&s.len>t)&&(e||o.length>n),i.forward2(t),s.forward(t)}}else Br(o,0,s.ins,e),r&&Dr(r,o,s.text),s.next()}}class Nr{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?lr.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?lr.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 qr{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,o;return this.empty?n=o=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),o=e.mapPos(this.to,-1)),n==this.from&&o==this.to?this:new qr(n,o,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Fr.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Fr.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 Fr.range(e.anchor,e.head)}static create(e,t,n){return new qr(e,t,n)}}class Fr{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Fr.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;ne.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 Fr(e.ranges.map((e=>qr.fromJSON(e))),e.main)}static single(e,t=e){return new Fr([Fr.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,o=0;oe?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;no.head?Fr.range(s,i):Fr.range(i,s))}}return new Fr(e,t)}}function Qr(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let Hr=0;class zr{constructor(e,t,n,o,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=o,this.id=Hr++,this.default=e([]),this.extensions="function"==typeof r?r(this):r}get reader(){return this}static define(e={}){return new zr(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:Vr),!!e.static,e.enables)}of(e){return new Wr([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Wr(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Wr(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],(n=>t(n.field(e))))}}function Vr(e,t){return e==t||e.length==t.length&&e.every(((e,n)=>e===t[n]))}class Wr{constructor(e,t,n,o){this.dependencies=e,this.facet=t,this.type=n,this.value=o,this.id=Hr++}dynamicSlot(e){var t;let n=this.value,o=this.facet.compareInput,r=this.id,i=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:0==(1&(null!==(t=e[n.id])&&void 0!==t?t:1))&&c.push(e[n.id]);return{create:e=>(e.values[i]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||Gr(e,c)){let t=n(e);if(s?!Xr(t,e.values[i],o):!o(t,e.values[i]))return e.values[i]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[r];if(null!=l){let r=ii(t,l);if(this.dependencies.every((n=>n instanceof zr?t.facet(n)===e.facet(n):!(n instanceof Zr)||t.field(n,!1)==e.field(n,!1)))||(s?Xr(a=n(e),r,o):o(a=n(e),r)))return e.values[i]=r,0}else a=n(e);return e.values[i]=a,1}}}}function Xr(e,t,n){if(e.length!=t.length)return!1;for(let o=0;oe[t.id])),r=n.map((e=>e.type)),i=o.filter((e=>!(1&e))),s=e[t.id]>>1;function a(e){let n=[];for(let t=0;te===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Yr).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 o=e.values[t],r=this.updateF(o,n);return this.compareF(o,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,Yr.of({field:this,create:e})]}get extension(){return this}}function Kr(e){return t=>new ei(t,e)}const Jr={highest:Kr(0),high:Kr(1),default:Kr(2),low:Kr(3),lowest:Kr(4)};class ei{constructor(e,t){this.inner=e,this.prec=t}}class ti{of(e){return new ni(this,e)}reconfigure(e){return ti.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ni{constructor(e,t){this.compartment=e,this.inner=t}}class oi{constructor(e,t,n,o,r,i){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=o,this.staticValues=r,this.facets=i,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let o=[],r=Object.create(null),i=new Map;for(let n of function(e,t,n){let o=[[],[],[],[],[]],r=new Map;return function e(i,s){let a=r.get(i);if(null!=a){if(a<=s)return;let e=o[a].indexOf(i);e>-1&&o[a].splice(e,1),i instanceof ni&&n.delete(i.compartment)}if(r.set(i,s),Array.isArray(i))for(let t of i)e(t,s);else if(i instanceof ni){if(n.has(i.compartment))throw new RangeError("Duplicate use of compartment in extensions");let o=t.get(i.compartment)||i.inner;n.set(i.compartment,o),e(o,s)}else if(i instanceof ei)e(i.inner,i.prec);else if(i instanceof Zr)o[s].push(i),i.provides&&e(i.provides,s);else if(i instanceof Wr)o[s].push(i),i.facet.extensions&&e(i.facet.extensions,2);else{let t=i.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${i}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(t,s)}}(e,2),o.reduce(((e,t)=>e.concat(t)))}(e,t,i))n instanceof Zr?o.push(n):(r[n.facet.id]||(r[n.facet.id]=[])).push(n);let s=Object.create(null),a=[],l=[];for(let e of o)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],o=t[0].facet,i=c&&c[e]||[];if(t.every((e=>0==e.type)))if(s[o.id]=a.length<<1|1,Vr(i,t))a.push(n.facet(o));else{let e=o.combine(t.map((e=>e.value)));a.push(n&&o.compare(e,n.facet(o))?n.facet(o):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[o.id]=l.length<<1,l.push((e=>Ur(e,o,t)))}}let u=l.map((e=>e(s)));return new oi(e,i,u,s,a,r)}}function ri(e,t){if(1&t)return 2;let n=t>>1,o=e.status[n];if(4==o)throw new Error("Cyclic dependency between fields and/or facets");if(2&o)return o;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function ii(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const si=zr.define(),ai=zr.define({combine:e=>e.some((e=>e)),static:!0}),li=zr.define({combine:e=>e.length?e[0]:void 0,static:!0}),ci=zr.define(),ui=zr.define(),hi=zr.define(),pi=zr.define({combine:e=>!!e.length&&e[0]});class fi{constructor(e,t){this.type=e,this.value=t}static define(){return new di}}class di{of(e){return new fi(this,e)}}class gi{constructor(e){this.map=e}of(e){return new mi(this,e)}}class mi{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 mi(this.type,t)}is(e){return this.type==e}static define(e={}){return new gi(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let o of e){let e=o.map(t);e&&n.push(e)}return n}}mi.reconfigure=mi.define(),mi.appendConfig=mi.define();class yi{constructor(e,t,n,o,r,i){this.startState=e,this.changes=t,this.selection=n,this.effects=o,this.annotations=r,this.scrollIntoView=i,this._doc=null,this._state=null,n&&Qr(n,t.newLength),r.some((e=>e.type==yi.time))||(this.annotations=r.concat(yi.time.of(Date.now())))}static create(e,t,n,o,r,i){return new yi(e,t,n,o,r,i)}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(yi.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function vi(e,t){let n=[];for(let o=0,r=0;;){let i,s;if(o=e[o]))i=e[o++],s=e[o++];else{if(!(r=0;r--){let i=n[r](e);i&&Object.keys(i).length&&(o=bi(o,xi(t,i,e.changes.newLength),!0))}return o==e?e:yi.create(t,e.changes,e.selection,o.effects,o.annotations,o.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let o of t.facet(ci)){let t=o(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:vi(n,t))}if(!0!==n){let o,r;if(!1===n)r=e.changes.invertedDesc,o=jr.empty(t.doc.length);else{let t=e.changes.filter(n);o=t.changes,r=t.filtered.mapDesc(t.changes).invertedDesc}e=yi.create(t,o,e.selection&&e.selection.map(r),mi.mapEffects(e.effects,r),e.annotations,e.scrollIntoView)}let o=t.facet(ui);for(let n=o.length-1;n>=0;n--){let r=o[n](e);e=r instanceof yi?r:Array.isArray(r)&&1==r.length&&r[0]instanceof yi?r[0]:wi(t,_i(r),!1)}return e}(r):r)}yi.time=fi.define(),yi.userEvent=fi.define(),yi.addToHistory=fi.define(),yi.remote=fi.define();const Oi=[];function _i(e){return null==e?Oi:Array.isArray(e)?e:[e]}var ki=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(ki||(ki={}));const Si=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Ei;try{Ei=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class Ci{constructor(e,t,n,o,r,i){this.config=e,this.doc=t,this.selection=n,this.values=o,this.status=e.statusTemplate.slice(),this.computeSlot=r,i&&(i._state=this);for(let e=0;er.set(t,e))),n=null),r.set(t.value.compartment,t.value.extension)):t.is(mi.reconfigure)?(n=null,o=t.value):t.is(mi.appendConfig)&&(n=null,o=_i(o).concat(t.value));n?t=e.startState.values.slice():(n=oi.resolve(o,r,this),t=new Ci(n,this.doc,this.selection,n.dynamicSlots.map((()=>null)),((e,t)=>t.reconfigure(e,this)),null).values);let i=e.startState.facet(ai)?e.newSelection:e.newSelection.asSingle();new Ci(n,e.newDoc,i,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:Fr.cursor(t.from+e.length)})))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),o=this.changes(n.changes),r=[n.range],i=_i(n.effects);for(let n=1;nr.spec.fromJSON(i,e))))}return Ci.create({doc:e.doc,selection:Fr.fromJSON(e.selection),extensions:t.extensions?o.concat([t.extensions]):o})}static create(e={}){let t=oi.resolve(e.extensions||[],new Map),n=e.doc instanceof lr?e.doc:lr.of((e.doc||"").split(t.staticFacet(Ci.lineSeparator)||Tr)),o=e.selection?e.selection instanceof Fr?e.selection:Fr.single(e.selection.anchor,e.selection.head):Fr.single(0);return Qr(o,n.length),t.staticFacet(ai)||(o=o.asSingle()),new Ci(t,n,o,t.dynamicSlots.map((()=>null)),((e,t)=>t.create(e)),null)}get tabSize(){return this.facet(Ci.tabSize)}get lineBreak(){return this.facet(Ci.lineSeparator)||"\n"}get readOnly(){return this.facet(pi)}phrase(e,...t){for(let t of this.facet(Ci.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 o=+(n||1);return!o||o>t.length?e:t[o-1]}))),e}languageDataAt(e,t,n=-1){let o=[];for(let r of this.facet(si))for(let i of r(this,t,n))Object.prototype.hasOwnProperty.call(i,e)&&o.push(i[e]);return o}charCategorizer(e){return t=this.languageDataAt("wordChars",e).join(""),e=>{if(!/\S/.test(e))return ki.Space;if(function(e){if(Ei)return Ei.test(e);for(let t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||Si.test(n)))return!0}return!1}(e))return ki.Word;for(let n=0;n-1)return ki.Word;return ki.Other};var t}wordAt(e){let{text:t,from:n,length:o}=this.doc.lineAt(e),r=this.charCategorizer(e),i=e-n,s=e-n;for(;i>0;){let e=Or(t,i,!1);if(r(t.slice(e,i))!=ki.Word)break;i=e}for(;se.length?e[0]:4}),Ci.lineSeparator=li,Ci.readOnly=pi,Ci.phrases=zr.define({compare(e,t){let n=Object.keys(e),o=Object.keys(t);return n.length==o.length&&n.every((n=>e[n]==t[n]))}}),Ci.languageData=si,Ci.changeFilter=ci,Ci.transactionFilter=ui,Ci.transactionExtender=hi,ti.reconfigure=mi.define();class Ai{eq(e){return this==e}range(e,t=e){return Ti.create(e,t,this)}}Ai.prototype.startSide=Ai.prototype.endSide=0,Ai.prototype.point=!1,Ai.prototype.mapMode=Mr.TrackDel;class Ti{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Ti(e,t,n)}}function Mi(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class Ri{constructor(e,t,n,o){this.from=e,this.to=t,this.value=n,this.maxPoint=o}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,o=0){let r=n?this.to:this.from;for(let i=o,s=r.length;;){if(i==s)return i;let o=i+s>>1,a=r[o]-e||(n?this.value[o].endSide:this.value[o].startSide)-t;if(o==i)return a>=0?i:s;a>=0?s=o:i=o+1}}between(e,t,n,o){for(let r=this.findIndex(t,-1e9,!0),i=this.findIndex(n,1e9,!1,r);rc||l==c&&u.startSide>0&&u.endSide<=0)continue;(c-l||u.endSide-u.startSide)<0||(i<0&&(i=l),u.point&&(s=Math.max(s,c-l)),n.push(u),o.push(l-i),r.push(c-i))}return{mapped:n.length?new Ri(o,r,n,s):null,pos:i}}}class ji{constructor(e,t,n,o){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=o}static create(e,t,n,o){return new ji(e,t,n,o)}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:o=0,filterTo:r=this.length}=e,i=e.filter;if(0==t.length&&!i)return this;if(n&&(t=t.slice().sort(Mi)),this.isEmpty)return t.length?ji.of(t):this;let s=new Li(this,null,-1).goto(0),a=0,l=[],c=new Bi;for(;s.value||a=0){let e=t[a++];c.addInner(e.from,e.to,e.value)||l.push(e)}else 1==s.rangeIndex&&s.chunkIndexthis.chunkEnd(s.chunkIndex)||rs.to||r=r&&e<=r+i.length&&!1===i.between(r,e-r,t-r,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return $i.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return $i.from(e).goto(t)}static compare(e,t,n,o,r=-1){let i=e.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r)),s=t.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r)),a=Di(i,s,n),l=new Ni(i,a,r),c=new Ni(s,a,r);n.iterGaps(((e,t,n)=>qi(l,e,c,t,n,o))),n.empty&&0==n.length&&qi(l,0,c,0,0,o)}static eq(e,t,n=0,o){null==o&&(o=999999999);let r=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0)),i=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0));if(r.length!=i.length)return!1;if(!r.length)return!0;let s=Di(r,i),a=new Ni(r,s,0).goto(n),l=new Ni(i,s,0).goto(n);for(;;){if(a.to!=l.to||!Fi(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>o)return!0;a.next(),l.next()}}static spans(e,t,n,o,r=-1){let i=new Ni(e,null,r).goto(t),s=t,a=i.openStart;for(;;){let e=Math.min(i.to,n);if(i.point){let n=i.activeForPoint(i.to),r=i.pointFroms&&(o.span(s,e,i.active,a),a=i.openEnd(e));if(i.to>n)return a+(i.point&&i.to>n?1:0);s=i.to,i.next()}}static of(e,t=!1){let n=new Bi;for(let o of e instanceof Ti?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(Mi);t=o}return e}(e):e)n.add(o.from,o.to,o.value);return n.finish()}static join(e){if(!e.length)return ji.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let o=e[n];o!=ji.empty;o=o.nextLayer)t=new ji(o.chunkPos,o.chunk,t,Math.max(o.maxPoint,t.maxPoint));return t}}ji.empty=new ji([],[],null,-1),ji.empty.nextLayer=ji.empty;class Bi{finishChunk(e){this.chunks.push(new Ri(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 Bi)).add(e,t,n)}addInner(e,t,n){let o=e-this.lastTo||n.startSide-this.last.endSide;if(o<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(o<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(ji.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=ji.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Di(e,t,n){let o=new Map;for(let t of e)for(let e=0;e=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&o.push(new Li(i,t,n,r));return 1==o.length?o[0]:new $i(o)}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--)Ii(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--)Ii(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(),Ii(this.heap,0)}}}function Ii(e,t){for(let n=e[t];;){let o=1+(t<<1);if(o>=e.length)break;let r=e[o];if(o+1=0&&(r=e[o+1],o++),n.compare(r)<0)break;e[o]=n,e[t]=r,t=o}}class Ni{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=$i.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){Qi(this.active,e),Qi(this.activeTo,e),Qi(this.activeRank,e),this.minActive=zi(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:o,rank:r}=this.cursor;for(;t0;)t++;Hi(this.active,t,n),Hi(this.activeTo,t,o),Hi(this.activeRank,t,r),e&&Hi(e,t,this.cursor.from),this.minActive=zi(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let o=this.minActive;if(o>-1&&(this.activeTo[o]-this.cursor.from||this.active[o].endSide-this.cursor.startSide)<0){if(this.activeTo[o]>e){this.to=this.activeTo[o],this.endSide=this.active[o].endSide;break}this.removeActive(o),n&&Qi(n,o)}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=0&&n[t]=0&&!(this.activeRank[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 qi(e,t,n,o,r,i){e.goto(t),n.goto(o);let s=o+r,a=o,l=o-t;for(;;){let t=e.to+l-n.to||e.endSide-n.endSide,o=t<0?e.to+l:n.to,r=Math.min(o,s);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&Fi(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,r,e.point,n.point):r>a&&!Fi(e.active,n.active)&&i.compareRange(a,r,e.active,n.active),o>s)break;a=o,t<=0&&e.next(),t>=0&&n.next()}}function Fi(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;n--)e[n+1]=e[n];e[t]=n}function zi(e,t){let n=-1,o=1e9;for(let r=0;re.map((e=>t.replace(/&/,e))))).reduce(((e,t)=>e.concat(t))),s,i);else if(s&&"object"==typeof s){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");r(o(n),s,a,c)}else null!=s&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))+": "+s+";")}(a.length||c)&&i.push((!n||l||s?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)r(o(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=Gi[Wi]||1;return Gi[Wi]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let o=e[Xi],r=n&&n.nonce;o?r&&o.setNonce(r):o=new Zi(e,r),o.mount(Array.isArray(t)?t:[t])}}let Yi=new Map;class Zi{constructor(e,t){let n=e.ownerDocument||e,o=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&o.CSSStyleSheet){let t=Yi.get(n);if(t)return e.adoptedStyleSheets=[t.sheet,...e.adoptedStyleSheets],e[Xi]=t;this.sheet=new o.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],Yi.set(n,this)}else{this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);let o=e.head||e;o.insertBefore(this.styleTag,o.firstChild)}this.modules=[],e[Xi]=this}mount(e){let t=this.sheet,n=0,o=0;for(let r=0;r-1&&(this.modules.splice(s,1),o--,s=-1),-1==s){if(this.modules.splice(o++,0,i),t)for(let e=0;e",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},es="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),ts="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ns=0;ns<10;ns++)Ki[48+ns]=Ki[96+ns]=String(ns);for(ns=1;ns<=24;ns++)Ki[ns+111]="F"+ns;for(ns=65;ns<=90;ns++)Ki[ns]=String.fromCharCode(ns+32),Ji[ns]=String.fromCharCode(ns);for(var os in Ki)Ji.hasOwnProperty(os)||(Ji[os]=Ki[os]);function rs(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function is(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function ss(e,t){if(!t.anchorNode)return!1;try{return is(e,t.anchorNode)}catch(e){return!1}}function as(e){return 3==e.nodeType?bs(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function ls(e,t,n,o){return!!n&&(us(e,t,n,o,-1)||us(e,t,n,o,1))}function cs(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function us(e,t,n,o,r){for(;;){if(e==n&&t==o)return!0;if(t==(r<0?0:hs(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=cs(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?hs(e):0}}}function hs(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function ps(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function fs(e){return{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function ds(e,t){let n=t.width/e.offsetWidth,o=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(o>.995&&o<1.005||!isFinite(o)||Math.abs(t.height-e.offsetHeight)<1)&&(o=1),{scaleX:n,scaleY:o}}class gs{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?hs(t):0),n,Math.min(e.focusOffset,n?hs(n):0))}set(e,t,n,o){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=o}}let ms,ys=null;function vs(e){if(e.setActive)return e.setActive();if(ys)return e.focus(ys);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==ys?{get preventScroll(){return ys={preventScroll:!0},!0}}:void 0),!ys){ys=!1;for(let e=0;eMath.max(1,e.scrollHeight-e.clientHeight-4)}class _s{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new _s(e.parentNode,cs(e),t)}static after(e,t){return new _s(e.parentNode,cs(e)+1,t)}}const ks=[];class Ss{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,o=this.dom,r=null;for(let i of this.children){if(7&i.flags){if(!i.dom&&(n=r?r.nextSibling:o.firstChild)){let e=Ss.get(n);(!e||!e.parent&&e.canReuseDOM(i))&&i.reuseDOM(n)}i.sync(e,t),i.flags&=-8}if(n=r?r.nextSibling:o.firstChild,t&&!t.written&&t.node==o&&n!=i.dom&&(t.written=!0),i.dom.parentNode==o)for(;n&&n!=i.dom;)n=Es(n);else o.insertBefore(i.dom,n);r=i.dom}for(n=r?r.nextSibling:o.firstChild,n&&t&&t.node==o&&(t.written=!0);n;)n=Es(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 o=0==hs(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==this.dom)break;0==o&&t.firstChild!=t.lastChild&&(o=e==t.firstChild?-1:1),e=t}n=o<0?e:e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!Ss.get(n);)n=n.nextSibling;if(!n)return this.length;for(let e=0,t=0;;e++){let o=this.children[e];if(o.dom==n)return t;t+=o.length+o.breakAfter}}domBoundsAround(e,t,n=0){let o=-1,r=-1,i=-1,s=-1;for(let a=0,l=n,c=n;at)return n.domBoundsAround(e,t,l);if(u>=e&&-1==o&&(o=a,r=l),l>t&&n.dom.parentNode==this.dom){i=a,s=c;break}c=u,l=u+n.breakAfter}return{from:r,to:s<0?n+this.length:s,startDOM:(o?this.children[o-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:i=0?this.children[i].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=ks){this.markDirty();for(let o=e;othis.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 Ps(e,t,n,o,r,i,s,a,l){let{children:c}=e,u=c.length?c[t]:null,h=i.length?i[i.length-1]:null,p=h?h.breakAfter:s;if(!(t==o&&u&&!s&&!p&&i.length<2&&u.merge(n,r,i.length?h:null,0==n,a,l))){if(o0&&(!s&&i.length&&u.merge(n,u.length,i[0],!1,a,0)?u.breakAfter=i.shift().breakAfter:(n2);var Fs={mac:qs||/Mac/.test(Ts.platform),windows:/Win/.test(Ts.platform),linux:/Linux|X11/.test(Ts.platform),ie:Ds,ie_version:js?Ms.documentMode||6:Bs?+Bs[1]:Rs?+Rs[1]:0,gecko:Ls,gecko_version:Ls?+(/Firefox\/(\d+)/.exec(Ts.userAgent)||[0,0])[1]:0,chrome:!!$s,chrome_version:$s?+$s[1]:0,ios:qs,android:/Android\b/.test(Ts.userAgent),webkit:Is,safari:Ns,webkit_version:Is?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ms.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Qs extends Ss{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 Qs)||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 Qs(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 _s(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 o=e.nodeValue.length;t>o&&(t=o);let r=t,i=t,s=0;0==t&&n<0||t==o&&n>=0?Fs.chrome||Fs.gecko||(t?(r--,s=1):i=0)?0:a.length-1];return Fs.safari&&!s&&0==l.width&&(l=Array.prototype.find.call(a,(e=>e.width))||l),s?ps(l,s<0):l||null}(this.dom,e,t)}}class Hs extends Ss{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(ws(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,o,r,i){return!(n&&(!(n instanceof Hs&&n.mark.eq(this.mark))||e&&r<=0||te&&t.push(n=e&&(o=r),n=s,r++}let i=this.length-e;return this.length=e,o>-1&&(this.children.length=o,this.markDirty()),new Hs(this.mark,t,i)}domAtPos(e){return Ws(this,e)}coordsAt(e,t){return Gs(this,e,t)}}class zs extends Ss{static create(e,t,n){return new zs(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=zs.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,o,r,i){return!(n&&(!(n instanceof zs&&this.widget.compare(n.widget))||e>0&&r<=0||t0)?_s.before(this.dom):_s.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 o=this.dom.getClientRects(),r=null;if(!o.length)return null;let i=this.side?this.side<0:e>0;for(let t=i?o.length-1:0;r=o[t],!(e>0?0==t:t==o.length-1||r.top0?_s.before(this.dom):_s.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return lr.empty}get isHidden(){return!0}}function Ws(e,t){let n=e.dom,{children:o}=e,r=0;for(let e=0;re&&t0;e--){let t=o[e-1];if(t.dom.parentNode==n)return t.domAtPos(t.length)}for(let e=r;e0&&t instanceof Hs&&r.length&&(o=r[r.length-1])instanceof Hs&&o.mark.eq(t.mark)?Xs(o,t.children[0],n-1):(r.push(t),t.setParent(e)),e.length+=t.length}function Gs(e,t,n){let o=null,r=-1,i=null,s=-1;!function e(t,a){for(let l=0,c=0;l=a&&(u.children.length?e(u,a-c):(!i||i.isHidden&&n>0)&&(h>a||c==h&&u.getSide()>0)?(i=u,s=a-c):(c-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let i of o)if(i!=n&&(-1==r.indexOf(i)||e[i]!==t[i]))return!1;return!0}function Ks(e,t,n){let o=!1;if(t)for(let r in t)n&&r in n||(o=!0,"style"==r?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(o=!0,"style"==r?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return o}function Js(e){let t=Object.create(null);for(let n=0;n0&&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){Zs(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Xs(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=Us(t,this.attrs||{})),n&&(this.attrs=Us({class:n},this.attrs||{}))}domAtPos(e){return Ws(this,e)}reuseDOM(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?4&this.flags&&(ws(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&&(Ks(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let o=this.dom.lastChild;for(;o&&Ss.get(o)instanceof Hs;)o=o.lastChild;if(!(o&&this.length&&("BR"==o.nodeName||0!=(null===(n=Ss.get(o))||void 0===n?void 0:n.isEditable)||Fs.ios&&this.children.some((e=>e instanceof Qs))))){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 Qs)||/[^ -~]/.test(n.text))return null;let o=as(n.dom);if(1!=o.length)return null;t+=o[0].width,e=o[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(e,t){let n=Gs(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){if(r instanceof ea)return r;if(i>t)break}o=i+r.breakAfter}return null}}class ta extends Ss{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,o,r,i){return!(n&&(!(n instanceof ta&&this.widget.compare(n.widget))||e>0&&r<=0||t0)}}class na{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 oa=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(oa||(oa={}));class ra extends Ai{constructor(e,t,n,o){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=o}get heightRelevant(){return!1}static mark(e){return new ia(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 aa(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,o=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:r,end:i}=la(e,o);t=(r?o?-3e8:-1:5e8)-1,n=1+(i?o?2e8:1:-6e8)}return new aa(e,t,n,o,e.widget||null,!0)}static line(e){return new sa(e)}static set(e,t=!1){return ji.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ra.none=ji.empty;class ia extends ra{constructor(e){let{start:t,end:n}=la(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 ia&&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))&&Zs(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)}}ia.prototype.point=!1;class sa extends ra{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof sa&&this.spec.class==e.spec.class&&Zs(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)}}sa.prototype.mapMode=Mr.TrackBefore,sa.prototype.point=!0;class aa extends ra{constructor(e,t,n,o,r,i){super(t,n,r,e),this.block=o,this.isReplace=i,this.mapMode=o?t<=0?Mr.TrackBefore:Mr.TrackAfter:Mr.TrackDel}get type(){return this.startSide!=this.endSide?oa.WidgetRange:this.startSide<=0?oa.WidgetBefore:oa.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof aa&&function(e,t){return e==t||!!(e&&t&&e.compare(t))}(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function la(e,t=!1){let{inclusiveStart:n,inclusiveEnd:o}=e;return null==n&&(n=e.inclusive),null==o&&(o=e.inclusive),{start:null!=n?n:t,end:null!=o?o:t}}function ca(e,t,n,o=0){let r=n.length-1;r>=0&&n[r]+o>=e?n[r]=Math.max(n[r],t):n.push(e,t)}aa.prototype.point=!0;class ua{constructor(e,t,n,o){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=o,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 ta&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ea),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(ha(new Vs(-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 ta||this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:o}=this.cursor.next(this.skip);if(this.skip=0,o)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 o=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(ha(new Qs(this.text.slice(this.textOff,this.textOff+o)),t),n),this.atCursorPos=!0,this.textOff+=o,e-=o,n=0}}span(e,t,n,o){this.buildText(t-e,n,o),this.pos=t,this.openStart<0&&(this.openStart=o)}point(e,t,n,o,r,i){if(this.disallowBlockEffectsFor[i]&&n instanceof aa){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 aa)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ta(n.widget||new pa("div"),s,n));else{let i=zs.create(n.widget||new pa("span"),s,s?0:n.startSide),a=this.atCursorPos&&!i.isEditable&&r<=o.length&&(e0),l=!i.isEditable&&(eo.length||n.startSide<=0),c=this.getLine();2!=this.pendingBuffer||a||i.isEditable||(this.pendingBuffer=0),this.flushBuffer(o),a&&(c.append(ha(new Vs(1),o),r),r=o.length+Math.max(0,r-o.length)),c.append(ha(i,o),r),this.atCursorPos=l,this.pendingBuffer=l?eo.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=o.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,o,r){let i=new ua(e,t,n,r);return i.openEnd=ji.spans(o,t,n,i),i.openStart<0&&(i.openStart=i.openEnd),i.finish(i.openEnd),i}}function ha(e,t){for(let n of t)e=new Hs(n,[e],e.length);return e}class pa extends na{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}}var fa=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(fa||(fa={}));const da=fa.LTR,ga=fa.RTL;function ma(e){let t=[];for(let n=0;n=t){if(s.level==n)return i;(r<0||(0!=o?o<0?s.fromt:e[r].level>s.level))&&(r=i)}}if(r<0)throw new RangeError("Index out of range");return r}}function ka(e,t){if(e.length!=t.length)return!1;for(let n=0;nl&&s.push(new _a(l,d.from,p)),Ca(e,d.direction==da!=!(p%2)?o+1:o,r,d.inner,d.from,d.to,s),l=d.to),f=d.to}else{if(f==n||(t?Sa[f]!=a:Sa[f]==a))break;f++}h?Ea(e,l,f,o+1,r,h,s):lt;){let n=!0,u=!1;if(!c||l>i[c-1].to){let e=Sa[l-1];e!=a&&(n=!1,u=16==e)}let h=n||1!=a?null:[],p=n?o:o+1,f=l;e:for(;;)if(c&&f==i[c-1].to){if(u)break e;let d=i[--c];if(!n)for(let e=d.from,n=c;;){if(e==t)break e;if(!n||i[n-1].to!=e){if(Sa[e-1]==a)break e;break}e=i[--n].from}h?h.push(d):(d.to=0;e-=3)if(xa[e+1]==-n){let t=xa[e+2],n=2&t?r:4&t?1&t?i:r:0;n&&(Sa[s]=Sa[xa[e]]=n),a=e;break}}else{if(189==xa.length)break;xa[a++]=s,xa[a++]=t,xa[a++]=l}else if(2==(o=Sa[s])||1==o){let e=o==r;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=xa[t+2];if(2&n)break;if(e)xa[t+2]|=2;else{if(4&n)break;xa[t+2]|=4}}}}}(e,r,i,o,a),function(e,t,n,o){for(let r=0,i=o;r<=n.length;r++){let s=r?n[r-1].to:e,a=rl;)t==i&&(t=n[--o].from,i=o?n[o-1].to:e),Sa[--t]=u;l=s}else i=s,l++}}}(r,i,o,a),Ea(e,r,i,t,n,o,s)}function Pa(e){return[new _a(0,e,0)]}let Aa="";function Ta(e,t,n,o,r){var i;let s=o.head-e.from,a=_a.find(t,s,null!==(i=o.bidiLevel)&&void 0!==i?i:-1,o.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 u=Or(e.text,s,l.forward(r,n));(ul.to)&&(u=c),Aa=e.text.slice(Math.min(s,u),Math.max(s,u));let h=a==(r?t.length-1:0)?null:t[a+(r?1:-1)];return h&&u==c&&h.level+(r?0:1)e.some((e=>e))}),qa=zr.define({combine:e=>e.some((e=>e))});class Fa{constructor(e,t="nearest",n="nearest",o=5,r=5,i=!1){this.range=e,this.y=t,this.x=n,this.yMargin=o,this.xMargin=r,this.isSnapshot=i}map(e){return e.empty?this:new Fa(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 Fa(Fr.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Qa=mi.define({map:(e,t)=>e.map(t)});function Ha(e,t,n){let o=e.facet(Da);o.length?o[0](t):window.onerror?window.onerror(String(t),n,void 0,void 0,t):n?console.error(n+":",t):console.error(t)}const za=zr.define({combine:e=>!e.length||e[0]});let Va=0;const Wa=zr.define();class Xa{constructor(e,t,n,o,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=o,this.extension=r(this)}static define(e,t){const{eventHandlers:n,eventObservers:o,provide:r,decorations:i}=t||{};return new Xa(Va++,e,n,o,(e=>{let t=[Wa.of(e)];return i&&t.push(Za.of((t=>{let n=t.plugin(e);return n?i(n):ra.none}))),r&&t.push(r(e)),t}))}static fromClass(e,t){return Xa.define((t=>new e(t)),t)}}class Ga{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(Ha(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){Ha(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){Ha(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Ua=zr.define(),Ya=zr.define(),Za=zr.define(),Ka=zr.define(),Ja=zr.define(),el=zr.define();function tl(e,t){let n=e.state.facet(el);if(!n.length)return n;let o=n.map((t=>t instanceof Function?t(e):t)),r=[];return ji.spans(o,t.from,t.to,{point(){},span(e,n,o,i){let s=e-t.from,a=n-t.from,l=r;for(let e=o.length-1;e>=0;e--,i--){let n,r=o[e].spec.bidiIsolate;if(null==r&&(r=Ma(t.text,s,a)),i>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 nl=zr.define();function ol(e){let t=0,n=0,o=0,r=0;for(let i of e.state.facet(nl)){let s=i(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(o=Math.max(o,s.top)),null!=s.bottom&&(r=Math.max(r,s.bottom)))}return{left:t,right:n,top:o,bottom:r}}const rl=zr.define();class il{constructor(e,t,n,o){this.fromA=e,this.toA=t,this.fromB=n,this.toB=o}join(e){return new il(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 o=e[t-1];if(!(o.fromA>n.toA)){if(o.toAc)break;r+=2}if(!a)return n;new il(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),i=a.toA,s=a.toB}}}class sl{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=jr.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let o=[];this.changes.iterChangedRanges(((e,t,n,r)=>o.push(new il(e,t,n,r)))),this.changedRanges=o}static create(e,t,n){return new sl(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&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 al extends Ss{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,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 ea],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new il(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})=>tthis.minWidthTo))?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let o=-1;this.view.inputState.composing>=0&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?o=this.domChanged.newSel.head:function(e,t){let n=!1;return t&&e.iterChangedRanges(((e,o)=>{et.from&&(n=!0)})),n}(e.changes,this.hasComposition)||e.selectionSet||(o=e.state.selection.main.head));let r=o>-1?function(e,t,n){let o=cl(e,n);if(!o)return null;let{node:r,from:i,to:s}=o,a=r.nodeValue;if(/[\n\r]/.test(a))return null;if(e.state.doc.sliceString(o.from,o.to)!=a)return null;let l=t.invertedDesc,c=new il(l.mapPos(i),l.mapPos(s),i,s),u=[];for(let t=r.parentNode;;t=t.parentNode){let n=Ss.get(t);if(n instanceof Hs)u.push({node:t,deco:n.mark});else{if(n instanceof ea||"DIV"==t.nodeName&&t.parentNode==e.contentDOM)return{range:c,text:r,marks:u,line:t};if(t==e.contentDOM)return null;u.push({node:t,deco:new ia({inclusive:!0,attributes:Js(t),tagName:t.tagName.toLowerCase()})})}}}(this.view,e.changes,o):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:t,to:o}=this.hasComposition;n=new il(t,o,e.changes.mapPos(t,-1),e.changes.mapPos(o,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Fs.ie||Fs.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=function(e,t,n){let o=new hl;return ji.compare(e,t,n,o),o.changes}(this.decorations,this.updateDeco(),e.changes);return n=il.extendWithRanges(n,i),!!(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:o}=this.view;o.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let e=Fs.chrome||Fs.ios?{node:o.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,e),this.flags&=-8,e&&(e.written||o.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=0?o[e]:null;if(!t)break;let i,s,a,l,{fromA:c,toA:u,fromB:h,toB:p}=t;if(n&&n.range.fromBh){let e=ua.build(this.view.state.doc,h,n.range.fromB,this.decorations,this.dynamicDecorationMap),t=ua.build(this.view.state.doc,n.range.toB,p,this.decorations,this.dynamicDecorationMap);s=e.breakAtStart,a=e.openStart,l=t.openEnd;let o=this.compositionView(n);t.breakAtStart?o.breakAfter=1:t.content.length&&o.merge(o.length,o.length,t.content[0],!1,t.openStart,0)&&(o.breakAfter=t.content[0].breakAfter,t.content.shift()),e.content.length&&o.merge(0,0,e.content[e.content.length-1],!0,0,e.openEnd)&&e.content.pop(),i=e.content.concat(o).concat(t.content)}else({content:i,breakAtStart:s,openStart:a,openEnd:l}=ua.build(this.view.state.doc,h,p,this.decorations,this.dynamicDecorationMap));let{i:f,off:d}=r.findPos(u,1),{i:g,off:m}=r.findPos(c,-1);Ps(this,g,m,f,d,i,s,a,l)}n&&this.fixCompositionDOM(n)}compositionView(e){let t=new Qs(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new Hs(n,[t],t.length);let n=new ea;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=Ss.get(e);n&&n!=t&&(n.dom=null),t.setDOM(e)},n=this.childPos(e.range.fromB,1),o=this.children[n.i];t(e.line,o);for(let r=e.marks.length-1;r>=-1;r--)n=o.childPos(n.off,1),o=o.children[n.i],t(r>=0?e.marks[r].node:e.text,o)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let n=this.view.root.activeElement,o=n==this.dom,r=!o&&ss(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(o||t||r))return;let i=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(Fs.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 _s(e,0),i=!0}var c;let u=this.view.observer.selectionRange;!i&&u.focusNode&&(ls(a.node,a.offset,u.anchorNode,u.anchorOffset)&&ls(l.node,l.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,s))||(this.view.observer.ignore((()=>{Fs.android&&Fs.chrome&&this.dom.contains(u.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=rs(this.view.root);if(e)if(s.empty){if(Fs.gecko){let e=function(e,t){return 1!=e.nodeType?0:(t&&"false"==e.childNodes[t-1].contentEditable?1:0)|(ts.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}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 _s(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new _s(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&ls(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=rs(e.root),{anchorNode:o,anchorOffset:r}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let i=ea.find(this,t.head);if(!i)return;let s=i.posAtStart;if(t.head==s||t.head==s+i.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(t.head+t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(o,r)}moveToLine(e){let t,n=this.dom;if(e.node!=n)return e;for(let o=e.offset;!t&&o=0;o--){let e=Ss.get(n.childNodes[o]);e instanceof ea&&(t=e.domAtPos(e.length))}return t?new _s(t.node,t.offset,!0):e}nearest(e){for(let t=e;t;){let e=Ss.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=0;i--){let s=this.children[i],a=r-s.breakAfter,l=a-s.length;if(ae||s.covers(1))&&(!n||s instanceof ea&&!(n instanceof ea&&t>=0))&&(n=s,o=l),r=l}return n?n.coordsAt(e-o,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),o=this.children[t];if(!(o instanceof ea))return null;for(;o.children.length;){let{i:e,off:t}=o.childPos(n,1);for(;;e++){if(e==o.children.length)return null;if((o=o.children[e]).length)break}n=t}if(!(o instanceof Qs))return null;let r=Or(o.text,n);if(r==n)return null;let i=bs(o.dom,n,r).getClientRects();for(let e=0;eMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==fa.LTR;for(let e=0,l=0;lo)break;if(e>=n){let n=c.dom.getBoundingClientRect();if(t.push(n.height),i){let t=c.dom.lastChild,o=t?as(t):[];if(o.length){let t=o[o.length-1],i=a?t.right-n.left:n.right-t.left;i>s&&(s=i,this.minWidth=r,this.minWidthFrom=e,this.minWidthTo=u)}}}e=u+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return"rtl"==getComputedStyle(this.children[t].dom).direction?fa.RTL:fa.LTR}measureTextSize(){for(let e of this.children)if(e instanceof ea){let t=e.measureTextSize();if(t)return t}let e,t,n,o=document.createElement("div");return o.className="cm-line",o.style.width="99999px",o.style.position="absolute",o.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(o);let r=as(o.firstChild)[0];e=o.getBoundingClientRect().height,t=r?r.width/27:7,n=r?r.height:e,o.remove()})),{lineHeight:e,charWidth:t,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Cs(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,o=0;;o++){let r=o==t.viewports.length?null:t.viewports[o],i=r?r.from-1:this.length;if(i>n){let o=(t.lineBlockAt(i).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(ra.replace({widget:new ll(o),block:!0,inclusive:!0,isBlockGap:!0}).range(n,i))}if(!r)break;n=r.to+1}return ra.set(e)}updateDeco(){let e=this.view.state.facet(Za).map(((e,t)=>(this.dynamicDecorationMap[t]="function"==typeof e)?e(this.view):e)),t=!1,n=this.view.state.facet(Ka).map(((e,n)=>{let o="function"==typeof e;return o&&(t=!0),o?e(this.view):e}));n.length&&(this.dynamicDecorationMap[e.length]=t,e.push(ji.join(n)));for(let t=e.length;tn.anchor?-1:1);if(!o)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(o={left:Math.min(o.left,t.left),top:Math.min(o.top,t.top),right:Math.max(o.right,t.right),bottom:Math.max(o.bottom,t.bottom)});let r=ol(this.view),i={left:o.left-r.left,top:o.top-r.top,right:o.right+r.right,bottom:o.bottom+r.bottom},{offsetWidth:s,offsetHeight:a}=this.view.scrollDOM;!function(e,t,n,o,r,i,s,a){let l=e.ownerDocument,c=l.defaultView||window;for(let u=e,h=!1;u&&!h;)if(1==u.nodeType){let e,p=u==l.body,f=1,d=1;if(p)e=fs(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let t=u.getBoundingClientRect();({scaleX:f,scaleY:d}=ds(u,t)),e={left:t.left,right:t.left+u.clientWidth*f,top:t.top,bottom:t.top+u.clientHeight*d}}let g=0,m=0;if("nearest"==r)t.top0&&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-m0&&t.right>e.right+g&&(g=t.right-e.right+g+i)):t.right>e.right&&(g=t.right-e.right+i,n<0&&t.left0))break;n=n.childNodes[o-1],o=hs(n)}if(n>=0)for(let o=e,r=t;;){if(3==o.nodeType)return{node:o,offset:r};if(!(1==o.nodeType&&r=0))break;o=o.childNodes[r],r=0}return null}let hl=class{constructor(){this.changes=[]}compareRange(e,t){ca(e,t,this.changes)}comparePoint(e,t){ca(e,t,this.changes)}};function pl(e,t){return t.left>e?t.left-e:Math.max(0,e-t.right)}function fl(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function dl(e,t){return e.topt.top+1}function gl(e,t){return te.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function yl(e,t,n){let o,r,i,s,a,l,c,u,h=!1;for(let p=e.firstChild;p;p=p.nextSibling){let e=as(p);for(let f=0;fm||s==m&&i>g){o=p,r=d,i=g,s=m;let a=m?n0?f0)}0==g?n>d.bottom&&(!c||c.bottomd.top)&&(l=p,u=d):c&&dl(c,d)?c=ml(c,d.bottom):u&&dl(u,d)&&(u=gl(u,d.top))}}if(c&&c.bottom>=n?(o=a,r=c):u&&u.top<=n&&(o=l,r=u),!o)return{node:e,offset:0};let p=Math.max(r.left,Math.min(r.right,t));return 3==o.nodeType?vl(o,p,n):h&&"false"!=o.contentEditable?yl(o,p,n):{node:e,offset:Array.prototype.indexOf.call(e.childNodes,o)+(t>=(r.left+r.right)/2?1:0)}}function vl(e,t,n){let o=e.nodeValue.length,r=-1,i=1e9,s=0;for(let a=0;an?c.top-n:n-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&u=(c.left+c.right)/2,o=n;if((Fs.chrome||Fs.gecko)&&bs(e,a).getBoundingClientRect().left==c.right&&(o=!n),u<=0)return{node:e,offset:a+(o?1:0)};r=a+(o?1:0),i=u}}}return{node:e,offset:r>-1?r:s>0?e.nodeValue.length:0}}function bl(e,t,n,o=-1){var r,i;let s,a=e.contentDOM.getBoundingClientRect(),l=a.top+e.viewState.paddingTop,{docHeight:c}=e.viewState,{x:u,y:h}=t,p=h-l;if(p<0)return 0;if(p>c)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,r=!1;s=e.elementAtHeight(p),s.type!=oa.Text;)for(;p=o>0?s.bottom+t:s.top-t,!(p>=0&&p<=c);){if(r)return n?null:0;r=!0,o=-o}h=l+p;let f=s.from;if(fe.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:xl(e,a,s,u,h);let d=e.dom.ownerDocument,g=e.root.elementFromPoint?e.root:d,m=g.elementFromPoint(u,h);m&&!e.contentDOM.contains(m)&&(m=null),m||(u=Math.max(a.left+1,Math.min(a.right-1,u)),m=g.elementFromPoint(u,h),m&&!e.contentDOM.contains(m)&&(m=null));let y,v=-1;if(m&&0!=(null===(r=e.docView.nearest(m))||void 0===r?void 0:r.isEditable))if(d.caretPositionFromPoint){let e=d.caretPositionFromPoint(u,h);e&&({offsetNode:y,offset:v}=e)}else if(d.caretRangeFromPoint){let t=d.caretRangeFromPoint(u,h);t&&(({startContainer:y,startOffset:v}=t),(!e.contentDOM.contains(y)||Fs.safari&&function(e,t,n){let o;if(3!=e.nodeType||t!=(o=e.nodeValue.length))return!1;for(let t=e.nextSibling;t;t=t.nextSibling)if(1!=t.nodeType||"BR"!=t.nodeName)return!1;return bs(e,o-1,o).getBoundingClientRect().left>n}(y,v,u)||Fs.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}return n-(1==e.nodeType?e.getBoundingClientRect():bs(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect()).left>5}(y,v,u))&&(y=void 0))}if(!y||!e.docView.dom.contains(y)){let t=ea.find(e.docView,f);if(!t)return p>s.top+s.height/2?s.to:s.from;({node:y,offset:v}=yl(t.dom,u,h))}let b=e.docView.nearest(y);if(!b)return null;if(b.isWidget&&1==(null===(i=b.dom)||void 0===i?void 0:i.nodeType)){let e=b.dom.getBoundingClientRect();return t.y1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;i+=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,o){for(let o=0,r=0;;){if(r>=t)return o;if(o==e.length)break;r+=9==e.charCodeAt(o)?n-r%n:1,o=Or(e,o)}return e.length}(s,i,e.state.tabSize)}function wl(e,t,n,o){let r=e.state.doc.lineAt(t.head),i=e.bidiSpans(r),s=e.textDirectionAt(r.from);for(let a=t,l=null;;){let t=Ta(r,i,s,a,n),c=Aa;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)),i=e.bidiSpans(r),t=e.visualLineSide(r,!n)}if(l){if(!l(c))return a}else{if(!o)return t;l=o(c)}a=t}}function Ol(e,t,n){for(;;){let o=0;for(let r of e)r.between(t-1,t+1,((e,r,i)=>{if(t>e&&tt(e))),n.from,t.head>n.from?-1:1);return o==n.from?n:Fr.cursor(o,onull)),Fs.gecko&&function(e){Zl.has(e)||(Zl.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,o=t.target;o!=e.contentDOM;o=o.parentNode)if(!o||11==o.nodeType||(n=Ss.get(o))&&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=El(e),n=this.handlers,o=this.view.contentDOM;for(let e in t)if("scroll"!=e){let r=!t[e].handlers.length,i=n[e];i&&r!=!i.handlers.length&&(o.removeEventListener(e,this.handleEvent),i=null),i||o.addEventListener(e,this.handleEvent,{passive:r})}for(let e in n)"scroll"==e||t[e]||o.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&Date.now()t.keyCode==e.keyCode)))&&!e.ctrlKey||Pl.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(){let e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,xs(this.view.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(e){return!!/^key/.test(e.type)&&(this.composing>0||!!(Fs.safari&&!Fs.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.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 Sl(e,t){return(n,o)=>{try{return t.call(e,o,n)}catch(e){Ha(n.state,e)}}}function El(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 o in e.domEventHandlers){let r=e.domEventHandlers[o];r&&n(o).handlers.push(Sl(t.value,r))}if(e&&e.domEventObservers)for(let o in e.domEventObservers){let r=e.domEventObservers[o];r&&n(o).observers.push(Sl(t.value,r))}}for(let e in Rl)n(e).handlers.push(Rl[e]);for(let e in jl)n(e).observers.push(jl[e]);return t}const Cl=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Pl="dthko",Al=[16,17,18,20,91,92,224,225];function Tl(e){return.7*Math.max(0,e)+8}class Ml{constructor(e,t,n,o){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=o,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=function(e){let t=e.ownerDocument;for(let n=e.parentNode;n&&n!=t.body;)if(1==n.nodeType){if(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else{if(11!=n.nodeType)break;n=n.host}return null}(e.contentDOM),this.atoms=e.state.facet(Ja).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(Ci.allowMultipleSelections)&&function(e,t){let n=e.state.facet(Ra);return n.length?n[0](t):Fs.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let o=rs(e.root);if(!o||0==o.rangeCount)return!0;let r=o.getRangeAt(0).getClientRects();for(let e=0;e=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=Vl(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){var t;if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&function(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,o=0,r=(null===(t=this.scrollParent)||void 0===t?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},i=ol(this.view);e.clientX-i.left<=r.left+6?n=-Tl(r.left-e.clientX):e.clientX+i.right>=r.right-6&&(n=Tl(e.clientX-r.right)),e.clientY-i.top<=r.top+6?o=-Tl(r.top-e.clientY):e.clientY+i.bottom>=r.bottom-6&&(o=Tl(e.clientY-r.bottom)),this.setScrollSpeed(n,o)}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(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let n=0;nthis.select(this.lastEvent)),20)}}const Rl=Object.create(null),jl=Object.create(null),Bl=Fs.ie&&Fs.ie_version<15||Fs.ios&&Fs.webkit_version<604;function Dl(e,t){let n,{state:o}=e,r=1,i=o.toText(t),s=i.lines==o.selection.ranges.length;if(null!=Xl&&o.selection.ranges.every((e=>e.empty))&&Xl==i.toString()){let e=-1;n=o.changeByRange((n=>{let a=o.doc.lineAt(n.from);if(a.from==e)return{range:n};e=a.from;let l=o.toText((s?i.line(r++).text:t)+o.lineBreak);return{changes:{from:a.from,insert:l},range:Fr.cursor(n.from+l.length)}}))}else n=s?o.changeByRange((e=>{let t=i.line(r++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Fr.cursor(e.from+t.length)}})):o.replaceSelection(i);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function Ll(e,t,n,o){if(1==o)return Fr.cursor(t,n);if(2==o)return function(e,t,n=1){let o=e.charCategorizer(t),r=e.doc.lineAt(t),i=t-r.from;if(0==r.length)return Fr.cursor(t);0==i?n=1:i==r.length&&(n=-1);let s=i,a=i;n<0?s=Or(r.text,i,!1):a=Or(r.text,i);let l=o(r.text.slice(s,a));for(;s>0;){let e=Or(r.text,s,!1);if(o(r.text.slice(e,s))!=l)break;s=e}for(;a{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},Rl.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&(e.inputState.lastEscPress=Date.now()),!1),jl.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},jl.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},Rl.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let o of e.state.facet(Ba))if(n=o(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=ql(e,t),o=Vl(t),r=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),r=r.map(e.changes))},get(t,i,s){let a,l=ql(e,t),c=Ll(e,l.pos,l.bias,o);if(n.pos!=l.pos&&!i){let t=Ll(e,n.pos,n.bias,o),r=Math.min(t.from,c.from),i=Math.max(t.to,c.to);c=r1&&(a=function(e,t){for(let n=0;n=t)return Fr.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):Fr.create([c])}}}(e,t)),n){let o=!e.hasFocus;e.inputState.startMouseSelection(new Ml(e,t,n,o)),o&&e.observer.ignore((()=>vs(e.contentDOM)));let r=e.inputState.mouseSelection;if(r)return r.start(t),!1===r.dragging}return!1};let $l=(e,t)=>e>=t.top&&e<=t.bottom,Il=(e,t,n)=>$l(t,n)&&e>=n.left&&e<=n.right;function Nl(e,t,n,o){let r=ea.find(e.docView,t);if(!r)return 1;let i=t-r.posAtStart;if(0==i)return 1;if(i==r.length)return-1;let s=r.coordsAt(i,-1);if(s&&Il(n,o,s))return-1;let a=r.coordsAt(i,1);return a&&Il(n,o,a)?1:s&&$l(o,s)?-1:1}function ql(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:Nl(e,n,t.clientX,t.clientY)}}const Fl=Fs.ie&&Fs.ie_version<=11;let Ql=null,Hl=0,zl=0;function Vl(e){if(!Fl)return e.detail;let t=Ql,n=zl;return Ql=e,zl=Date.now(),Hl=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Hl+1)%3:1}function Wl(e,t,n,o){if(!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,s=o&&i&&function(e,t){let n=e.state.facet(ja);return n.length?n[0](t):Fs.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:i.from,to:i.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}Rl.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let o=e.docView.nearest(t.target);if(o&&o.isWidget){let e=o.posAtStart,t=e+o.length;(e>=n.to||t<=n.from)&&(n=Fr.range(e,t))}}let{inputState:o}=e;return o.mouseSelection&&(o.mouseSelection.dragging=!0),o.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",e.state.sliceDoc(n.from,n.to)),t.dataTransfer.effectAllowed="copyMove"),!1},Rl.dragend=e=>(e.inputState.draggedContent=null,!1),Rl.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let o=Array(n.length),r=0,i=()=>{++r==n.length&&Wl(e,t,o.filter((e=>null!=e)).join(e.state.lineBreak),!1)};for(let e=0;e{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(o[e]=t.result),i()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return Wl(e,t,n,!0),!0}return!1},Rl.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Bl?null:t.clipboardData;return n?(Dl(e,n.getData("text/plain")||n.getData("text/uri-text")),!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(),Dl(e,n.value)}),50)}(e),!1)};let Xl=null;Rl.copy=Rl.cut=(e,t)=>{let{text:n,ranges:o,linewise:r}=function(e){let t=[],n=[],o=!1;for(let o of e.selection.ranges)o.empty||(t.push(e.sliceDoc(o.from,o.to)),n.push(o));if(!t.length){let r=-1;for(let{from:o}of e.selection.ranges){let i=e.doc.lineAt(o);i.number>r&&(t.push(i.text),n.push({from:i.from,to:Math.min(e.doc.length,i.to+1)})),r=i.number}o=!0}return{text:t.join(e.lineBreak),ranges:n,linewise:o}}(e.state);if(!n&&!r)return!1;Xl=r?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:o,scrollIntoView:!0,userEvent:"delete.cut"});let i=Bl?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let o=n.appendChild(document.createElement("textarea"));o.style.cssText="position: fixed; left: -10000px; top: 10px",o.value=t,o.focus(),o.selectionEnd=t.length,o.selectionStart=0,setTimeout((()=>{o.remove(),e.focus()}),50)}(e,n),!1)};const Gl=fi.define();function Ul(e,t){let n=[];for(let o of e.facet(Ia)){let r=o(e,t);r&&n.push(r)}return n?e.update({effects:n,annotations:Gl.of(!0)}):null}function Yl(e){setTimeout((()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Ul(e.state,t);n?e.dispatch(n):e.update([])}}),10)}jl.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),Yl(e)},jl.blur=e=>{e.observer.clearSelectionRange(),Yl(e)},jl.compositionstart=jl.compositionupdate=e=>{null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0)},jl.compositionend=e=>{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,Fs.chrome&&Fs.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then((()=>e.observer.flush())):setTimeout((()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])}),50)},jl.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},Rl.beforeinput=(e,t)=>{var n;let o;if(Fs.chrome&&Fs.android&&(o=Cl.find((e=>e.inputType==t.inputType)))&&(e.observer.delayAndroidKey(o.key,o.keyCode),"Backspace"==o.key||"Delete"==o.key)){let t=(null===(n=window.visualViewport)||void 0===n?void 0:n.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!1};const Zl=new Set,Kl=["pre-wrap","normal","pre-line","break-spaces"];class Jl{constructor(e){this.lineWrapping=e,this.doc=lr.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}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){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Kl.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=o,this.lineLength=r,a){this.heightSamples={};for(let e=0;e0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>oc&&(e.heightChanged=!0),this.height=t)}replace(e,t,n){return rc.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,o){let r=this,i=n.doc;for(let s=o.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:c,toB:u}=o[s],h=r.lineAt(a,nc.ByPosNoHeight,n.setDoc(t),0,0),p=h.to>=l?h:r.lineAt(l,nc.ByPosNoHeight,n,0,0);for(u+=p.to-l,l=p.to;s>0&&h.from<=o[s-1].toA;)a=o[s-1].fromA,c=o[s-1].fromB,s--,a2*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,o-=r.size}else{if(!(r>2*o))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(o=r&&i(this.blockAt(0,n,o,r))}updateHeight(e,t=0,n=!1,o){return o&&o.from<=t&&o.more&&this.setHeight(e,o.heights[o.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class sc extends ic{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,o){return new tc(o,this.length,n,this.height,this.breaks)}replace(e,t,n){let o=n[0];return 1==n.length&&(o instanceof sc||o instanceof ac&&4&o.flags)&&Math.abs(this.length-o.length)<10?(o instanceof ac?o=new sc(o.length,this.height):o.height=this.height,this.outdated||(o.outdated=!1),o):rc.of(n)}updateHeight(e,t=0,n=!1,o){return o&&o.from<=t&&o.more?this.setHeight(e,o.heights[o.index++]):(n||this.outdated)&&this.setHeight(e,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 ac extends rc{constructor(e){super(e,0)}heightMetrics(e,t){let n,o=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,i=r-o+1,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*i);n=t/i,this.length>i+1&&(s=(this.height-t)/(this.length-i-1))}else n=this.height/i;return{firstLine:o,lastLine:r,perLine:n,perChar:s}}blockAt(e,t,n,o){let{firstLine:r,lastLine:i,perLine:s,perChar:a}=this.heightMetrics(t,o);if(t.lineWrapping){let r=o+Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length),i=t.doc.lineAt(r),l=s+i.length*a,c=Math.max(n,e-l/2);return new tc(i.from,i.length,c,l,0)}{let o=Math.max(0,Math.min(i-r,Math.floor((e-n)/s))),{from:a,length:l}=t.doc.line(r+o);return new tc(a,l,n+s*o,s,0)}}lineAt(e,t,n,o,r){if(t==nc.ByHeight)return this.blockAt(e,n,o,r);if(t==nc.ByPosNoHeight){let{from:t,to:o}=n.doc.lineAt(e);return new tc(t,o-t,0,0,0)}let{firstLine:i,perLine:s,perChar:a}=this.heightMetrics(n,r),l=n.doc.lineAt(e),c=s+l.length*a,u=l.number-i,h=o+s*u+a*(l.from-r-u);return new tc(l.from,l.length,Math.max(o,Math.min(h,o+this.height-c)),c,0)}forEachLine(e,t,n,o,r,i){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,u=o;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-s;u+=a*n+l*(e-r-n)}let o=a+l*t.length;i(new tc(t.from,t.length,u,o,0)),u+=o,c=t.to+1}}replace(e,t,n){let o=this.length-t;if(o>0){let e=n[n.length-1];e instanceof ac?n[n.length-1]=new ac(e.length+o):n.push(null,new ac(o-1))}if(e>0){let t=n[0];t instanceof ac?n[0]=new ac(e+t.length):n.unshift(new ac(e-1),null)}return rc.of(n)}decomposeLeft(e,t){t.push(new ac(e-1),null)}decomposeRight(e,t){t.push(null,new ac(this.length-e-1))}updateHeight(e,t=0,n=!1,o){let r=t+this.length;if(o&&o.from<=t+this.length&&o.more){let n=[],i=Math.max(t,o.from),s=-1;for(o.from>t&&n.push(new ac(o.from-t-1).updateHeight(e,t));i<=r&&o.more;){let t=e.doc.lineAt(i).length;n.length&&n.push(null);let r=o.heights[o.index++];-1==s?s=r:Math.abs(r-s)>=oc&&(s=-2);let a=new sc(t,r);a.outdated=!1,n.push(a),i+=t+1}i<=r&&n.push(null,new ac(r-i).updateHeight(e,i));let a=rc.of(n);return(s<0||Math.abs(a.height-this.height)>=oc||Math.abs(s-this.heightMetrics(e,t).perLine)>=oc)&&(e.heightChanged=!0),a}return(n||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class lc extends rc{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,o){let r=n+this.left.height;return es))return l;let c=t==nc.ByPosNoHeight?nc.ByPosNoHeight:nc.ByPos;return a?l.join(this.right.lineAt(s,c,n,i,s)):this.left.lineAt(s,c,n,o,r).join(l)}forEachLine(e,t,n,o,r,i){let s=o+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,n,s,a,i);else{let l=this.lineAt(a,nc.ByPos,n,o,r);e=e&&l.from<=t&&i(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,s,a,i)}}replace(e,t,n){let o=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-o,t-o,n));let r=[];e>0&&this.decomposeLeft(e,r);let i=r.length;for(let e of n)r.push(e);if(e>0&&cc(r,i-1),t=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,o=n+this.break;if(e>=o)return this.right.decomposeRight(e-o,t);e2*t.size||t.size>2*e.size?rc.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=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,o){let{left:r,right:i}=this,s=t+r.length+this.break,a=null;return o&&o.from<=t+r.length&&o.more?a=r=r.updateHeight(e,t,n,o):r.updateHeight(e,t,n),o&&o.from<=s+i.length&&o.more?a=i=i.updateHeight(e,s,n,o):i.updateHeight(e,s,n),a?this.balanced(r,i):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function cc(e,t){let n,o;null==e[t]&&(n=e[t-1])instanceof ac&&(o=e[t+1])instanceof ac&&e.splice(t-1,3,new ac(n.length+1+o.length))}class uc{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 sc?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new sc(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=5)&&this.addLineDeco(o,r,i)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new sc(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new ac(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 sc)return e;let t=new sc(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 o=this.ensureLine();o.length+=n,o.collapsed+=n,o.widgetHeight=Math.max(o.widgetHeight,e),o.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 sc||this.isCovered?(this.writtenTon.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=o.overflow){let o=n.getBoundingClientRect();i=Math.max(i,o.left),s=Math.min(s,o.right),a=Math.max(a,o.top),l=t==e.parentNode?o.bottom:Math.min(l,o.bottom)}t="absolute"==o.position||"fixed"==o.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:i-n.left,right:Math.max(i,s)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function fc(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class dc{constructor(e,t,n){this.from=e,this.to=t,this.size=n}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n"function"!=typeof e&&"cm-lineWrapping"==e.class));this.heightOracle=new Jl(t),this.stateDeco=e.facet(Za).filter((e=>"function"!=typeof e)),this.heightMap=rc.empty().applyChanges(this.stateDeco,lr.empty,this.heightOracle.setDoc(e.doc),[new il(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ra.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 o=n?t.head:t.anchor;if(!e.some((({from:e,to:t})=>o>=e&&o<=t))){let{from:t,to:n}=this.lineBlockAt(o);e.push(new yc(t,n))}}this.viewports=e.sort(((e,t)=>e.from-t.from)),this.scaler=this.heightMap.height<=7e6?wc:new Oc(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(e=>{this.viewportLines.push(1==this.scaler.scale?e:_c(e,this.scaler))}))}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(Za).filter((e=>"function"!=typeof e));let o=e.changedRanges,r=il.extendWithRanges(o,function(e,t,n){let o=new hc;return ji.compare(e,t,n,o,0),o.changes}(n,this.stateDeco,e?e.changes:jr.empty(this.state.doc.length))),i=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=i&&(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.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let l=!e.changes.empty||2&e.flags||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),l&&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(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(qa)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),o=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?fa.RTL:fa.LTR;let i=this.heightOracle.mustRefreshForWrapping(r),s=t.getBoundingClientRect(),a=i||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}=ds(t,s);this.scaleX==e&&this.scaleY==n||(this.scaleX=e,this.scaleY=n,l|=8,i=a=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,h=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==u&&this.paddingBottom==h||(this.paddingTop=u,this.paddingBottom=h,l|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(o.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=8);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=Os(e.scrollDOM);let f=(this.printing?fc:pc)(t,this.paddingTop),d=f.top-this.pixelViewport.top,g=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;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)return 0;let y=s.width;if(this.contentDOMWidth==y&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,l|=8),a){let t=e.docView.measureVisibleLineHeights(this.viewport);if(o.mustRefreshForHeights(t)&&(i=!0),i||o.lineWrapping&&Math.abs(y-this.contentDOMWidth)>o.charWidth){let{lineHeight:n,charWidth:s,textHeight:a}=e.docView.measureTextSize();i=n>0&&o.refresh(r,n,s,a,y/s,t),i&&(e.docView.minWidth=0,l|=8)}d>0&&g>0?c=Math.max(d,g):d<0&&g<0&&(c=Math.min(d,g)),o.heightChanged=!1;for(let n of this.viewports){let r=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(i?rc.empty().applyChanges(this.stateDeco,lr.empty,this.heightOracle,[new il(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(o,0,i,new ec(n.from,r))}o.heightChanged&&(l|=2)}let v=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return v&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&l||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(i?[]: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)),o=this.heightMap,r=this.heightOracle,{visibleTop:i,visibleBottom:s}=this,a=new yc(o.lineAt(i-1e3*n,nc.ByHeight,r,0,0).from,o.lineAt(s+1e3*(1-n),nc.ByHeight,r,0,0).to);if(t){let{head:e}=t.range;if(ea.to){let n,i=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=o.lineAt(e,nc.ByPos,r,0,0);n="center"==t.y?(s.top+s.bottom)/2-i/2:"start"==t.y||"nearest"==t.y&&e=s+Math.max(10,Math.min(n,250)))&&o>i-2e3&&r>1,i=o<<1;if(this.defaultTextDirection!=fa.LTR&&!n)return[];let s=[],a=(o,i,l,c)=>{if(i-oo&&ee.from>=l.from&&e.to<=l.to&&Math.abs(e.from-o)e.fromt))));if(!p){if(ie.from<=i&&e.to>=i))){let e=t.moveToLineBoundary(Fr.cursor(i),!1,!0).head;e>o&&(i=e)}p=new dc(o,i,this.gapSize(l,o,i,c))}s.push(p)};for(let e of this.viewportLines){if(e.lengthe.from&&a(e.from,r,e,t),se.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];ji.spans(e,this.viewport.from,this.viewport.to,{span(e,n){t.push({from:e,to:n})},point(){}},20);let n=t.length!=this.visibleRanges.length||this.visibleRanges.some(((e,n)=>e.from!=t[n].from||e.to!=t[n].to));return this.visibleRanges=t,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((t=>t.from<=e&&t.to>=e))||_c(this.heightMap.lineAt(e,nc.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return _c(this.heightMap.lineAt(this.scaler.fromDOM(e),nc.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 _c(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 yc{constructor(e,t){this.from=e,this.to=t}}function vc(e,t,n){let o=[],r=e,i=0;return ji.spans(n,e,t,{span(){},point(e,t){e>r&&(o.push({from:r,to:e}),i+=e-r),r=t}},20),r=1)return t[t.length-1].to;let o=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:r}=t[e],i=r-n;if(o<=i)return n+o;o-=i}}function xc(e,t){let n=0;for(let{from:o,to:r}of e.ranges){if(t<=r){n+=t-o;break}n+=r-o}return n/e.total}const wc={toDOM:e=>e,fromDOM:e=>e,scale:1};class Oc{constructor(e,t,n){let o=0,r=0,i=0;this.viewports=n.map((({from:n,to:r})=>{let i=t.lineAt(n,nc.ByPos,e,0,0).top,s=t.lineAt(r,nc.ByPos,e,0,0).bottom;return o+=s-i,{from:n,to:r,top:i,bottom:s,domTop:0,domBottom:0}})),this.scale=(7e6-o)/(t.height-o);for(let e of this.viewports)e.domTop=i+(e.top-r)*this.scale,i=e.domBottom=e.domTop+(e.bottom-e.top),r=e.bottom}toDOM(e){for(let t=0,n=0,o=0;;t++){let r=t_c(e,t))):e._content)}const kc=zr.define({combine:e=>e.join(" ")}),Sc=zr.define({combine:e=>e.indexOf(!0)>-1}),Ec=Ui.newName(),Cc=Ui.newName(),Pc=Ui.newName(),Ac={"&light":"."+Cc,"&dark":"."+Pc};function Tc(e,t,n){return new Ui(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 Mc=Tc("."+Ec,{"&":{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},".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:"#444"},".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},"&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:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',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"}},Ac),Rc="￿";class jc{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(Ci.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Rc}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let o=e;;){this.findPointBefore(n,o);let e=this.text.length;this.readNode(o);let r=o.nextSibling;if(r==t)break;let i=Ss.get(o),s=Ss.get(r);(i&&s?i.breakAfter:(i?i.breakAfter:Dc(o))||Dc(r)&&("BR"!=o.nodeName||o.cmIgnore)&&this.text.length>e)&&this.lineBreak(),o=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,o=this.lineSeparator?null:/\r\n?|\n/g;;){let r,i=-1,s=1;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(r=o.exec(t))&&(i=r.index,s=r[0].length),this.append(t.slice(n,i<0?t.length:i)),i<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=i+s}}readNode(e){if(e.cmIgnore)return;let t=Ss.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+(Bc(e,n.node,n.offset)?t:0))}}function Bc(e,t,n){for(;;){if(!t||n-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let t=r||i?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}=e.observer.selectionRange;return n&&(t.push(new Lc(n,o)),r==n&&i==o||t.push(new Lc(r,i))),t}(e),n=new jc(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,o=2==e.length?e[1].pos:n;return n>-1&&o>-1?Fr.single(n+t,o+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=r&&r.node==t.focusNode&&r.offset==t.focusOffset||!is(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),o=i&&i.node==t.anchorNode&&i.offset==t.anchorOffset||!is(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if(Fs.ios&&e.state.selection.main.empty&&n!=o&&(s.from>0||s.toDate.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:o,to:s}=t.bounds,a=r.from,l=null;(8===i||Fs.android&&t.text.length0&&a>0&&e.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;return"end"==o&&(n-=s+Math.max(0,i-Math.min(s,a))-i),s=s?i-n:0,a=i+(a-s),s=i):a=a?i-n:0,s=i+(s-a),a=i),{from:i,toA:s,toB:a}}(e.state.doc.sliceString(o,s,Rc),t.text,a-o,l);c&&(Fs.chrome&&13==i&&c.toB==c.from+2&&t.text.slice(c.from,c.toB)==Rc+Rc&&c.toB--,n={from:o+c.from,to:o+c.toA,insert:lr.of(t.text.slice(c.from,c.toB).split(Rc))})}else o&&(!e.hasFocus&&e.state.facet(za)||o.main.eq(r))&&(o=null);if(!n&&!o)return!1;if(!n&&t.typeOver&&!r.empty&&o&&o.main.empty?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,r.to)}: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))}:(Fs.mac||Fs.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(o&&2==n.insert.length&&(o=Fr.single(o.main.anchor-1,o.main.head-1)),n={from:r.from,to:r.to,insert:lr.of([" "])}):Fs.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(o&&(o=Fr.single(o.main.anchor-1,o.main.head-1)),n={from:r.from,to:r.to,insert:lr.of([" "])}),n){if(Fs.ios&&e.inputState.flushIOSKey())return!0;if(Fs.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&xs(e.contentDOM,"Enter",13)||(n.from==r.from-1&&n.to==r.to&&0==n.insert.length||8==i&&n.insert.lengthr.head)&&xs(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&xs(e.contentDOM,"Delete",46)))return!0;let t,s=n.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>t||(t=function(e,t,n){let o,r=e.state,i=r.selection.main;if(t.from>=i.from&&t.to<=i.to&&t.to-t.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=i.fromt.to?r.sliceDoc(t.to,i.to):"";o=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<=i.to&&t.to>=i.to-10){let l,c=e.state.sliceDoc(t.from,t.to),u=n&&cl(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);l={from:u.from,to:u.to-e}}else l=e.state.doc.lineAt(i.head);let h=i.to-t.to,p=i.to-i.from;o=r.changeByRange((n=>{if(n.from==i.from&&n.to==i.to)return{changes:s,range:a||n.map(s)};let o=n.to-h,u=o-c.length;if(n.to-n.from!=p||e.state.sliceDoc(u,o)!=c||n.to>=l.from&&n.from<=l.to)return{range:n};let f=r.changes({from:u,to:o,insert:t.insert}),d=n.to-i.to;return{changes:f,range:a?Fr.range(Math.max(0,a.anchor+d),Math.max(0,a.head+d)):n.map(f)}}))}else o={changes:s,selection:a&&r.selection.replaceRange(a)}}let s="input.type";return(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)),r.update(o,{userEvent:s,scrollIntoView:!0})}(e,n,o));return e.state.facet($a).some((t=>t(e,n.from,n.to,s,a)))||e.dispatch(a()),!0}if(o&&!o.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:o,scrollIntoView:t,userEvent:n}),!0}return!1}const Nc={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},qc=Fs.ie&&Fs.ie_version<=11;class Fc{constructor(e){this.view=e,this.active=!1,this.selectionRange=new gs,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.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((t=>{for(let e of t)this.queue.push(e);(Fs.ie&&Fs.ie_version<=11||Fs.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()})),qc&&(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),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate){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.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(){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,o=this.selectionRange;if(n.state.facet(za)?n.root.activeElement!=this.dom:!ss(n.dom,o))return;let r=o.anchorNode&&n.docView.nearest(o.anchorNode);r&&r.ignoreEvent(e)?t||(this.selectionChanged=!1):(Fs.ie&&Fs.ie_version<=11||Fs.android&&Fs.chrome)&&!n.state.selection.main.empty&&o.focusNode&&ls(o.focusNode,o.focusOffset,o.anchorNode,o.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Fs.safari&&11==e.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e){let t=null;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}if(e.contentDOM.addEventListener("beforeinput",n,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",n,!0),!t)return null;let o=t.startContainer,r=t.startOffset,i=t.endContainer,s=t.endOffset,a=e.docView.domAtPos(e.state.selection.main.anchor);return ls(a.node,a.offset,i,s)&&([o,r,i,s]=[i,s,o,r]),{anchorNode:o,anchorOffset:r,focusNode:i,focusOffset:s}}(this.view)||rs(e.root);if(!t||this.selectionRange.eq(t))return!1;let n=ss(this.dom,t);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&xs(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{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,o=!1;for(let r of e){let e=this.readMutation(r);e&&(e.typeOver&&(o=!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:o}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),o=this.selectionChanged&&ss(this.dom,this.selectionRange);if(e<0&&!o)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new $c(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,o=Ic(this.view,t);return this.view.state==n&&this.view.update([]),o}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=Qc(t,e.previousSibling||e.target.previousSibling,-1),o=Qc(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:o?t.posBefore(o):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),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),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}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)}}function Qc(e,t,n){for(;t;){let o=Ss.get(t);if(o&&o.parent==e)return o;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}class Hc{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={}){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:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(e=>e.forEach((e=>t(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 mc(e.state||Ci.create(e)),e.scrollTo&&e.scrollTo.is(Qa)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Wa).map((e=>new Ga(e)));for(let e of this.plugins)e.update(this);this.observer=new Fc(this),this.inputState=new kl(this),this.inputState.ensureHandlers(this.plugins),this.docView=new al(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let t=1==e.length&&e[0]instanceof yi?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,o=!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 i=this.hasFocus,s=0,a=null;e.some((e=>e.annotation(Gl)))?(this.inputState.notifiedFocused=i,s=1):i!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=i,a=Ul(r,i),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(Ci.phrases)!=this.state.facet(Ci.phrases))return this.setState(r);t=sl.create(this,r,e),t.flags|=s;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(u&&(u=u.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;u=new Fa(e.empty?e:Fr.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(Qa)&&(u=e.value.clip(this.state))}this.viewState.update(t,u),this.bidiCache=Wc.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(rl)!=this.styleModules&&this.mountStyles(),o=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some((e=>e.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(t.startState.facet(kc)!=t.state.facet(kc)&&(this.viewState.mustMeasureContent=!0),(n||o||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!t.empty)for(let e of this.state.facet(La))try{e(t)}catch(e){Ha(this.state,e,"update listener")}(a||c)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Ic(this,c)&&l.force&&xs(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 mc(e),this.plugins=e.facet(Wa).map((e=>new Ga(e))),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new al(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(Wa),n=e.state.facet(Wa);if(t!=n){let o=[];for(let r of n){let n=t.indexOf(r);if(n<0)o.push(new Ga(r));else{let t=this.plugins[n];t.mustUpdate=e,o.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=o,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e-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,o=n.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:i}=this.viewState;Math.abs(o-this.viewState.scrollTop)>1&&(i=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(i<0)if(Os(n))r=-1,i=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(o);r=e.from,i=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 Ha(this.state,e),Vc}})),c=sl.create(this,this.state,[]),u=!1;c.flags|=s,t?t.flags|=s:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),u=this.docView.update(c));for(let e=0;e1||e<-1){o+=e,n.scrollTop=o/this.scaleY,i=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(La))e(t)}get themeClasses(){return Ec+" "+(this.state.facet(Sc)?Pc:Cc)+" "+this.state.facet(kc)}updateAttrs(){let e=Xc(this,Ua,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(za)?"true":"false",class:"cm-content",style:`${Fs.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Xc(this,Ya,t);let n=this.observer.ignore((()=>{let n=Ks(this.contentDOM,this.contentAttrs,t),o=Ks(this.dom,this.editorAttrs,e);return n||o}));return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)e.is(Hc.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(rl);let e=this.state.facet(Hc.cspNonce);Ui.mount(this.root,this.styleModules.concat(Mc).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;tt.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 _l(this,e,wl(this,e,t,n))}moveByGroup(e,t){return _l(this,e,wl(this,e,t,(t=>function(e,t,n){let o=e.state.charCategorizer(t),r=o(n);return e=>{let t=o(e);return r==ki.Space&&(r=t),r==t}}(this,e.head,t))))}visualLineSide(e,t){let n=this.bidiSpans(e),o=this.textDirectionAt(e.from),r=n[t?n.length-1:0];return Fr.cursor(r.side(t,o)+e.from,r.forward(!t,o)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,o){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==oa.Text))return e;return n}(e,t.head),i=o&&r.type==oa.Text&&(e.lineWrapping||r.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head):null;if(i){let t=e.dom.getBoundingClientRect(),o=e.textDirectionAt(r.from),s=e.posAtCoords({x:n==(o==fa.LTR)?t.right-1:t.left+1,y:(i.top+i.bottom)/2});if(null!=s)return Fr.cursor(s,n?-1:1)}return Fr.cursor(n?r.to:r.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return _l(this,e,function(e,t,n,o){let r=t.head,i=n?1:-1;if(r==(n?e.state.doc.length:0))return Fr.cursor(r,t.assoc);let s,a=t.goalColumn,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(r,t.assoc||-1),u=e.documentTop;if(c)null==a&&(a=c.left-l.left),s=i<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=(i<0?t.top:t.bottom)+u}let h=l.left+a,p=null!=o?o:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=s+(p+t)*i,o=bl(e,{x:h,y:n},!1,i);if(nl.bottom||(i<0?or)){let t=e.docView.coordsForChar(o),r=!t||n0)}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(Na)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>zc)return Pa(e.length);let t,n=this.textDirectionAt(e.from);for(let o of this.bidiCache)if(o.from==e.from&&o.dir==n&&(o.fresh||ka(o.isolates,t=tl(this,e))))return o.order;t||(t=tl(this,e));let o=function(e,t,n){if(!e)return[new _a(0,0,t==ga?1:0)];if(t==da&&!n.length&&!Oa.test(e))return Pa(e.length);if(n.length)for(;e.length>Sa.length;)Sa[Sa.length]=256;let o=[],r=t==da?0:1;return Ca(e,r,r,n,0,e.length,o),o}(e.text,n,t);return this.bidiCache.push(new Wc(e.from,e.to,n,t,!0,o)),o}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Fs.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{vs(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(){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 Qa.of(new Fa("number"==typeof e?Fr.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 Qa.of(new Fa(Fr.cursor(n.from),"start","start",n.top-e,t,!0))}static domEventHandlers(e){return Xa.define((()=>({})),{eventHandlers:e})}static domEventObservers(e){return Xa.define((()=>({})),{eventObservers:e})}static theme(e,t){let n=Ui.newName(),o=[kc.of(n),rl.of(Tc(`.${n}`,e))];return t&&t.dark&&o.push(Sc.of(!0)),o}static baseTheme(e){return Jr.lowest(rl.of(Tc("."+Ec,e,Ac)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),o=n&&Ss.get(n)||Ss.get(e);return(null===(t=null==o?void 0:o.rootView)||void 0===t?void 0:t.view)||null}}Hc.styleModule=rl,Hc.inputHandler=$a,Hc.focusChangeEffect=Ia,Hc.perLineTextDirection=Na,Hc.exceptionSink=Da,Hc.updateListener=La,Hc.editable=za,Hc.mouseSelectionStyle=Ba,Hc.dragMovesSelection=ja,Hc.clickAddsSelectionRange=Ra,Hc.decorations=Za,Hc.outerDecorations=Ka,Hc.atomicRanges=Ja,Hc.bidiIsolatedRanges=el,Hc.scrollMargins=nl,Hc.darkTheme=Sc,Hc.cspNonce=zr.define({combine:e=>e.length?e[0]:""}),Hc.contentAttributes=Ya,Hc.editorAttributes=Ua,Hc.lineWrapping=Hc.contentAttributes.of({class:"cm-lineWrapping"}),Hc.announce=mi.define();const zc=4096,Vc={};class Wc{constructor(e,t,n,o,r,i){this.from=e,this.to=t,this.dir=n,this.isolates=o,this.fresh=r,this.order=i}static update(e,t){if(t.empty&&!e.some((e=>e.fresh)))return e;let n=[],o=e.length?e[e.length-1].dir:fa.LTR;for(let r=Math.max(0,e.length-10);r=0;r--){let t=o[r],i="function"==typeof t?t(e):t;i&&Us(i,n)}return n}const Gc=Fs.mac?"mac":Fs.windows?"win":Fs.linux?"linux":"key";function Uc(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const Yc=Jr.default(Hc.domEventHandlers({keydown:(e,t)=>function(e,t,n,o){let r=function(e){var t=!(es&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||ts&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Ji:Ki)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),i=Ar(Cr(r,0))==r.length&&" "!=r,s="",a=!1,l=!1,c=!1;Jc&&Jc.view==n&&Jc.scope==o&&(s=Jc.prefix+" ",Al.indexOf(t.keyCode)<0&&(l=!0,Jc=null));let u,h,p=new Set,f=e=>{if(e){for(let o of e.run)if(!p.has(o)&&(p.add(o),o(n,t)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),l=!0)}return!1},d=e[o];return d&&(f(d[s+Uc(r,t,!i)])?a=!0:i&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Fs.windows&&t.ctrlKey&&t.altKey)&&(u=Ki[t.keyCode])&&u!=r?(f(d[s+Uc(u,t,!0)])||t.shiftKey&&(h=Ji[t.keyCode])!=r&&h!=u&&f(d[s+Uc(h,t,!1)]))&&(a=!0):i&&t.shiftKey&&f(d[s+Uc(r,t,!0)])&&(a=!0),!a&&f(d._any)&&(a=!0)),l&&(a=!0),a&&c&&t.stopPropagation(),a}(function(e){let t=e.facet(Zc),n=Kc.get(t);return n||Kc.set(t,n=function(e,t=Gc){let n=Object.create(null),o=Object.create(null),r=(e,t)=>{let n=o[e];if(null==n)o[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},i=(e,o,i,s,a)=>{var l,c;let u=n[e]||(n[e]=Object.create(null)),h=o.split(/ (?!$)/).map((e=>function(e,t){const n=e.split(/-(?!$)/);let o,r,i,s,a=n[n.length-1];"Space"==a&&(a=" ");for(let e=0;e{let o=Jc={view:t,prefix:n,scope:e};return setTimeout((()=>{Jc==o&&(Jc=null)}),eu),!0}]})}let p=h.join(" ");r(p,!1);let f=u[p]||(u[p]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(l=u._any)||void 0===l?void 0:l.run)||void 0===c?void 0:c.slice())||[]});i&&f.run.push(i),s&&(f.preventDefault=!0),a&&(f.stopPropagation=!0)};for(let o of e){let e=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let t in e)e[t].run.push(o.any)}let r=o[t]||o.key;if(r)for(let t of e)i(t,r,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(t,"Shift-"+r,o.shift,o.preventDefault,o.stopPropagation)}return n}(t.reduce(((e,t)=>e.concat(t)),[]))),n}(t.state),e,t,"editor")})),Zc=zr.define({enables:Yc}),Kc=new WeakMap;let Jc=null;const eu=4e3;const tu={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};!Fs.ios&&(tu[".cm-line"].caretColor="transparent !important",tu[".cm-content"]={caretColor:"transparent !important"});const nu="-10000px";class ou{constructor(e,t,n){this.facet=t,this.createTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter((e=>e)),this.tooltipViews=this.tooltips.map(n)}update(e,t){var n;let o=e.state.facet(this.facet),r=o.filter((e=>e));if(o===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let i=[],s=t?[]:null;for(let n=0;nt[n]=e)),t.length=s.length),this.input=o,this.tooltips=r,this.tooltipViews=i,!0}}function ru(e={}){return su.of(e)}function iu(e){let{win:t}=e;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}const su=zr.define({combine:e=>{var t,n,o;return{position:Fs.ios?"absolute":(null===(t=e.find((e=>e.position)))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find((e=>e.parent)))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(o=e.find((e=>e.tooltipSpace)))||void 0===o?void 0:o.tooltipSpace)||iu}}}),au=new WeakMap,lu=Xa.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(su);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new ou(e,hu,(e=>this.createTooltip(e))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,o=e.state.facet(su);if(o.position!=this.position&&!this.madeAbsolute){this.position=o.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(o.parent!=this.parent){this.parent&&this.container.remove(),this.parent=o.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e){let t=e.create(this.view);if(t.dom.classList.add("cm-tooltip"),e.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",t.dom.appendChild(e)}return t.dom.style.position=this.position,t.dom.style.top=nu,t.dom.style.left="0px",this.container.appendChild(t.dom),t.mount&&t.mount(this.view),t}destroy(){var e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.intersectionObserver)||void 0===t||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=this.view.dom.getBoundingClientRect(),t=1,n=1,o=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(Fs.gecko)o=e.offsetParent!=this.container.ownerDocument.body;else if(e.style.top==nu&&"0px"==e.style.left){let t=e.getBoundingClientRect();o=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}}if(o||"absolute"==this.position)if(this.parent){let e=this.parent.getBoundingClientRect();e.width&&e.height&&(t=e.width/this.parent.offsetWidth,n=e.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:n}=this.view.viewState);return{editor:e,parent:this.parent?this.container.getBoundingClientRect():e,pos:this.manager.tooltips.map(((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)})),size:this.manager.tooltipViews.map((({dom:e})=>e.getBoundingClientRect())),space:this.view.state.facet(su).tooltipSpace(this.view),scaleX:t,scaleY:n,makeAbsolute:o}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{editor:n,space:o,scaleX:r,scaleY:i}=e,s=[];for(let a=0;a=Math.min(n.bottom,o.bottom)||h.rightMath.min(n.right,o.right)+.1){u.style.top=nu;continue}let f=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,d=f?7:0,g=p.right-p.left,m=null!==(t=au.get(c))&&void 0!==t?t:p.bottom-p.top,y=c.offset||uu,v=this.view.textDirection==fa.LTR,b=p.width>o.right-o.left?v?o.left:o.right-p.width:v?Math.min(h.left-(f?14:0)+y.x,o.right-g):Math.max(o.left,h.left-g+(f?14:0)-y.x),x=this.above[a];!l.strictSide&&(x?h.top-(p.bottom-p.top)-y.yo.bottom)&&x==o.bottom-h.bottom>h.top-o.top&&(x=this.above[a]=!x);let w=(x?h.top-o.top:o.bottom-h.bottom)-d;if(wb&&e.topO&&(O=x?e.top-m-2-d:e.bottom+d+2);if("absolute"==this.position?(u.style.top=(O-e.parent.top)/i+"px",u.style.left=(b-e.parent.left)/r+"px"):(u.style.top=O/i+"px",u.style.left=b/r+"px"),f){let e=h.left+(v?y.x:-y.x)-(b+14-7);f.style.left=e/r+"px"}!0!==c.overlap&&s.push({left:b,top:O,right:_,bottom:O+m}),u.classList.toggle("cm-tooltip-above",x),u.classList.toggle("cm-tooltip-below",!x),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=nu}},{eventObservers:{scroll(){this.maybeMeasure()}}}),cu=Hc.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),uu={x:0,y:0},hu=zr.define({enables:[lu,cu]}),pu=zr.define();class fu{static create(e){return new fu(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new ou(e,pu,(e=>this.createHostedView(e)))}createHostedView(e){let t=e.create(this.view);return t.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(t.dom),this.mounted&&t.mount&&t.mount(this.view),t}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let o=n[e];if(void 0!==o)if(void 0===t)t=o;else if(t!==o)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const du=hu.compute([pu],(e=>{let t=e.facet(pu).filter((e=>e));return 0===t.length?null:{pos:Math.min(...t.map((e=>e.pos))),end:Math.max(...t.map((e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos}))),create:fu.create,above:t[0].above,arrow:t.some((e=>e.arrow))}}));class gu{constructor(e,t,n,o,r){this.view=e,this.source=t,this.field=n,this.setHover=o,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((()=>this.startHover()),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let e=Date.now()-this.lastMove.time;en.bottom||t.xn.right+e.defaultCharacterWidth)return;let i=e.bidiSpans(e.state.doc.lineAt(o)).find((e=>e.from<=o&&e.to>=o)),s=i&&i.dir==fa.RTL?-1:1;r=t.x{this.pending==t&&(this.pending=null,n&&e.dispatch({effects:this.setHover.of(n)}))}),(t=>Ha(e.state,t,"hover tooltip")))}else i&&e.dispatch({effects:this.setHover.of(i)})}get tooltip(){let e=this.view.plugin(lu),t=e?e.manager.tooltips.findIndex((e=>e.create==fu.create)):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:o}=this;if(n&&o&&!function(e,t){let n=e.getBoundingClientRect();return t.clientX>=n.left-mu&&t.clientX<=n.right+mu&&t.clientY>=n.top-mu&&t.clientY<=n.bottom+mu}(o.dom,e)||this.pending){let{pos:o}=n||this.pending,r=null!==(t=null==n?void 0:n.end)&&void 0!==t?t:o;(o==r?this.view.posAtCoords(this.lastMove)==o:function(e,t,n,o,r,i){let s=e.scrollDOM.getBoundingClientRect(),a=e.documentTop+e.documentPadding.top+e.contentHeight;if(s.left>o||s.rightr||Math.min(s.bottom,a)=t&&l<=n}(this.view,o,r,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of(null)})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const mu=4;function yu(e,t={}){let n=mi.define(),o=Zr.define({create:()=>null,update(e,o){if(e&&(t.hideOnChange&&(o.docChanged||o.selection)||t.hideOn&&t.hideOn(o,e)))return null;if(e&&o.docChanged){let t=o.changes.mapPos(e.pos,-1,Mr.TrackDel);if(null==t)return null;let n=Object.assign(Object.create(null),e);n.pos=t,null!=e.end&&(n.end=o.changes.mapPos(e.end)),e=n}for(let t of o.effects)t.is(n)&&(e=t.value),t.is(bu)&&(e=null);return e},provide:e=>pu.from(e)});return[o,Xa.define((r=>new gu(r,e,o,n,t.hoverTime||300))),du]}function vu(e,t){let n=e.plugin(lu);if(!n)return null;let o=n.manager.tooltips.indexOf(t);return o<0?null:n.manager.tooltipViews[o]}const bu=mi.define(),xu=zr.define({combine(e){let t,n;for(let o of e)t=t||o.topContainer,n=n||o.bottomContainer;return{topContainer:t,bottomContainer:n}}}),wu=Xa.fromClass(class{constructor(e){this.input=e.state.facet(ku),this.specs=this.input.filter((e=>e)),this.panels=this.specs.map((t=>t(e)));let t=e.state.facet(xu);this.top=new Ou(e,!0,t.topContainer),this.bottom=new Ou(e,!1,t.bottomContainer),this.top.sync(this.panels.filter((e=>e.top))),this.bottom.sync(this.panels.filter((e=>!e.top)));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(xu);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Ou(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ou(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(ku);if(n!=this.input){let t=n.filter((e=>e)),o=[],r=[],i=[],s=[];for(let n of t){let t,a=this.specs.indexOf(n);a<0?(t=n(e.view),s.push(t)):(t=this.panels[a],t.update&&t.update(e)),o.push(t),(t.top?r:i).push(t)}this.specs=t,this.panels=o,this.top.sync(r),this.bottom.sync(i);for(let e of s)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>Hc.scrollMargins.of((t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}}))});class Ou{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=_u(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=_u(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function _u(e){let t=e.nextSibling;return e.remove(),t}const ku=zr.define({enables:wu});class Su extends Ai{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Su.prototype.elementClass="",Su.prototype.toDOM=void 0,Su.prototype.mapMode=Mr.TrackBefore,Su.prototype.startSide=Su.prototype.endSide=-1,Su.prototype.point=!0;const Eu=zr.define(),Cu=zr.define(),Pu=zr.define({combine:e=>e.some((e=>e))});function Au(e){let t=[Tu];return e&&!1===e.fixed&&t.push(Pu.of(!0)),t}const Tu=Xa.fromClass(class{constructor(e){this.view=e,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(Cu).map((t=>new Bu(e,t)));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!e.state.facet(Pu),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,o=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(o<.8*(n.to-n.from))}e.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Pu)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&this.dom.remove();let n=ji.iter(this.view.state.facet(Eu),this.view.viewport.from),o=[],r=this.gutters.map((e=>new ju(e,this.view.viewport,-this.view.documentPadding.top)));for(let e of this.view.viewportLineBlocks)if(o.length&&(o=[]),Array.isArray(e.type)){let t=!0;for(let i of e.type)if(i.type==oa.Text&&t){Ru(n,o,i.from);for(let e of r)e.line(this.view,i,o);t=!1}else if(i.widget)for(let e of r)e.widget(this.view,i)}else if(e.type==oa.Text){Ru(n,o,e.from);for(let t of r)t.line(this.view,e,o)}else if(e.widget)for(let t of r)t.widget(this.view,e);for(let e of r)e.finish();e&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(e){let t=e.startState.facet(Cu),n=e.state.facet(Cu),o=e.docChanged||e.heightChanged||e.viewportChanged||!ji.eq(e.startState.facet(Eu),e.state.facet(Eu),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(o=!0);else{o=!0;let r=[];for(let o of n){let n=t.indexOf(o);n<0?r.push(new Bu(this.view,o)):(this.gutters[n].update(e),r.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),r.indexOf(e)<0&&e.destroy();for(let e of r)this.dom.appendChild(e.dom);this.gutters=r}return o}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove()}},{provide:e=>Hc.scrollMargins.of((t=>{let n=t.plugin(e);return n&&0!=n.gutters.length&&n.fixed?t.textDirection==fa.LTR?{left:n.dom.offsetWidth*t.scaleX}:{right:n.dom.offsetWidth*t.scaleX}:null}))});function Mu(e){return Array.isArray(e)?e:[e]}function Ru(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class ju{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=ji.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:o}=this,r=(t.top-this.height)/e.scaleY,i=t.height/e.scaleY;if(this.i==o.elements.length){let t=new Du(e,i,r,n);o.elements.push(t),o.dom.appendChild(t.dom)}else o.elements[this.i].update(e,i,r,n);this.height=t.bottom,this.i++}line(e,t,n){let o=[];Ru(this.cursor,o,t.from),n.length&&(o=o.concat(n));let r=this.gutter.config.lineMarker(e,t,o);r&&o.unshift(r);let i=this.gutter;(0!=o.length||i.config.renderEmptyElements)&&this.addElement(e,t,o)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t);n&&this.addElement(e,t,[n])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Bu{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,(o=>{let r,i=o.target;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let e=i.getBoundingClientRect();r=(e.top+e.bottom)/2}else r=o.clientY;let s=e.lineBlockAtHeight(r-e.documentTop);t.domEventHandlers[n](e,s,o)&&o.preventDefault()}));this.markers=Mu(t.markers(e)),t.initialSpacer&&(this.spacer=new Du(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Mu(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!ji.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class Du{constructor(e,t,n,o){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,o)}update(e,t,n,o){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;nPi(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let o=n[e],r=t[e];n[e]=o?(e,t,n)=>o(e,t,n)||r(e,t,n):r}return n}})});class Iu extends Su{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Nu(e,t){return e.state.facet($u).formatNumber(t,e.state)}const qu=Cu.compute([$u],(e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(Lu),lineMarker:(e,t,n)=>n.some((e=>e.toDOM))?null:new Iu(Nu(e,e.state.doc.lineAt(t.from).number)),widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet($u)!=e.state.facet($u),initialSpacer:e=>new Iu(Nu(e,Qu(e.state.doc.lines))),updateSpacer(e,t){let n=Nu(t.view,Qu(t.view.state.doc.lines));return n==e.number?e:new Iu(n)},domEventHandlers:e.facet($u).domEventHandlers})));function Fu(e={}){return[$u.of(e),Au(),qu]}function Qu(e){let t=9;for(;t{let o=Xu(e,t,n),r=o.type.prop(zu);if(!r)return[];let i=e.facet(r),s=o.type.prop(Vu);if(s){let r=o.resolve(t-o.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(i)}}return i}))].concat(n)}isActiveAt(e,t,n=-1){return Xu(e,t,n).type.prop(zu)==this.data}findRegions(e){let t=e.facet(rh);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],o=(e,t)=>{if(e.prop(zu)==this.data)return void n.push({from:t,to:t+e.length});let r=e.prop(On.mounted);if(r){if(r.tree.prop(zu)==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(o(r.tree,r.overlay[0].from+t),n.length>e)return}}for(let n=0;ne.concat(n):void 0}));var n;return new Gu(t,e.parser.configure({props:[zu.add((e=>e.isTop?t:void 0))]}),e.name)}configure(e,t){return new Gu(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Uu(e){let t=e.field(Wu.state,!1);return t?t.tree:Tn.empty}class Yu{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=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let Zu=null;class Ku{constructor(e,t,n=[],o,r,i,s,a){this.parser=e,this.state=t,this.fragments=n,this.tree=o,this.treeLen=r,this.viewport=i,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new Ku(e,t,[],Tn.empty,0,n,[],null)}startParse(){return this.parser.startParse(new Yu(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=Tn.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.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(Gn.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Zu;Zu=this;try{return e()}finally{Zu=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Ju(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:o,treeLen:r,viewport:i,skipped:s}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,n,o,r)=>t.push({fromA:e,toA:n,fromB:o,toB:r}))),n=Gn.applyChanges(n,t),o=Tn.empty,r=0,i={from:e.mapPos(i.from,-1),to:e.mapPos(i.to,1)},this.skipped.length){s=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),o=e.mapPos(t.to,-1);ne.from&&(this.fragments=Ju(this.fragments,n,o),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 Un{createParse(t,n,o){let r=o[0].from,i=o[o.length-1].to;return{parsedPos:r,advance(){let t=Zu;if(t){for(let e of o)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=i,new Tn(Sn.none,[],[],i-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 Zu}}function Ju(e,t,n){return Gn.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class eh{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 eh(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=Ku.create(e.facet(rh).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new eh(n)}}Wu.state=Zr.define({create:eh.init,update(e,t){for(let e of t.effects)if(e.is(Wu.setState))return e.value;return t.startState.facet(rh)!=t.state.facet(rh)?eh.init(t.state):e.apply(t)}});let th=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(th=e=>{let t=-1,n=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const nh="undefined"!=typeof navigator&&(null===(Hu=navigator.scheduling)||void 0===Hu?void 0:Hu.isInputPending)?()=>navigator.scheduling.isInputPending():null,oh=Xa.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(Wu.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(Wu.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=th(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndo+1e3,a=r.context.work((()=>nh&&nh()||Date.now()>i),o+(s?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Wu.setState.of(new eh(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=>Ha(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()}}}),rh=zr.define({combine:e=>e.length?e[0]:null,enables:e=>[Wu.state,oh,Hc.contentAttributes.compute([e],(t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]});class ih{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const sh=zr.define(),ah=zr.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((e=>e!=t[0])))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function lh(e){let t=e.facet(ah);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function ch(e,t){let n="",o=e.tabSize,r=e.facet(ah)[0];if("\t"==r){for(;t>=o;)n+="\t",t-=o;r=" "}for(let e=0;e=t?function(e,t,n){let o=t.resolveStack(n),r=o.node.enterUnfinishedNodesBefore(n);if(r!=o.node){let e=[];for(let t=r;t!=o.node;t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)o={node:e[t],next:o}}return fh(o,e,n)}(e,n,t):null}class hh{constructor(e,t={}){this.state=e,this.options=t,this.unit=lh(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:o,simulateDoubleBreak:r}=this.options;return null!=o&&o>=n.from&&o<=n.to?r&&o==e?{text:"",from:e}:(t<0?o-1&&(r+=i-this.countColumn(n,n.search(/\S|$/))),r}countColumn(e,t=e.length){return Vi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:o}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let e=r(o);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const ph=new On;function fh(e,t,n){for(let o=e;o;o=o.next){let e=dh(o.node);if(e)return e(mh.create(t,n,o))}return 0}function dh(e){let t=e.type.prop(ph);if(t)return t;let n,o=e.firstChild;if(o&&(n=o.type.prop(On.closedBy))){let t=e.lastChild,o=t&&n.indexOf(t.name)>-1;return e=>bh(e,!0,1,void 0,o&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?gh:null}function gh(){return 0}class mh extends hh{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new mh(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(yh(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return fh(this.context.next,this.base,this.pos)}}function yh(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function vh({closing:e,align:t=!0,units:n=1}){return o=>bh(o,t,n,e)}function bh(e,t,n,o,r){let i=e.textAfter,s=i.match(/^\s*/)[0].length,a=o&&i.slice(s,s+o.length)==o||r==e.pos+s,l=t?function(e){let t=e.node,n=t.childAfter(t.from),o=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),s=null==r||r<=i.from?i.to:Math.min(i.to,r);for(let e=n.to;;){let r=t.childAfter(e);if(!r||r==o)return null;if(!r.type.isSkipped)return r.from{let o=e&&e.test(n.textAfter);return n.baseIndent+(o?0:t*n.unit)}}const wh=200;function Oh(){return Ci.transactionFilter.of((e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:o}=e.newSelection.main,r=n.lineAt(o);if(o>r.from+wh)return e;let i=n.sliceString(r.from,o);if(!t.some((e=>e.test(i))))return e;let{state:s}=e,a=-1,l=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=uh(s,t.from);if(null==n)continue;let o=/^\s*/.exec(t.text)[0],r=ch(s,n);o!=r&&l.push({from:t.from,to:t.from+o.length,insert:r})}return l.length?[e,{changes:l,sequential:!0}]:e}))}const _h=new On;function kh(e){let t=e.firstChild,n=e.lastChild;return t&&t.toe.prop(zu)==i.data:i?e=>e==i:void 0,this.style=Ho(e.map((e=>({tag:e.tag,class:e.class||o(Object.assign({},e,{tag:null}))}))),{all:r}).style,this.module=n?new Ui(n):null,this.themeType=t.themeType}static define(e,t){return new Sh(e,t||{})}}const Eh=zr.define(),Ch=zr.define({combine:e=>e.length?[e[0]]:null});function Ph(e){let t=e.facet(Eh);return t.length?t:e.facet(Ch)}function Ah(e,t){let n,o=[Mh];return e instanceof Sh&&(e.module&&o.push(Hc.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?o.push(Ch.of(e)):n?o.push(Eh.computeN([Hc.darkTheme],(t=>t.facet(Hc.darkTheme)==("dark"==n)?[e]:[]))):o.push(Eh.of(e)),o}class Th{constructor(e){this.markCache=Object.create(null),this.tree=Uu(e.state),this.decorations=this.buildDeco(e,Ph(e.state))}update(e){let t=Uu(e.state),n=Ph(e.state),o=n!=Ph(e.startState);t.length{n.add(e,t,this.markCache[o]||(this.markCache[o]=ra.mark({class:o})))}),o,r);return n.finish()}}const Mh=Jr.high(Xa.fromClass(Th,{decorations:e=>e.decorations})),Rh=(ar.meta,ar.link,ar.heading,ar.emphasis,ar.strong,ar.strikethrough,ar.keyword,ar.atom,ar.bool,ar.url,ar.contentSeparator,ar.labelName,ar.literal,ar.inserted,ar.string,ar.deleted,ar.regexp,ar.escape,ar.string,ar.variableName,ar.variableName,ar.typeName,ar.namespace,ar.className,ar.variableName,ar.macroName,ar.propertyName,ar.comment,ar.invalid,Hc.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}})),jh=1e4,Bh="()[]{}",Dh=zr.define({combine:e=>Pi(e,{afterCursor:!0,brackets:Bh,maxScanDistance:jh,renderMatch:Ih})}),Lh=ra.mark({class:"cm-matchingBracket"}),$h=ra.mark({class:"cm-nonmatchingBracket"});function Ih(e){let t=[],n=e.matched?Lh:$h;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const Nh=Zr.define({create:()=>ra.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],o=t.state.facet(Dh);for(let e of t.state.selection.ranges){if(!e.empty)continue;let r=Vh(t.state,e.head,-1,o)||e.head>0&&Vh(t.state,e.head-1,1,o)||o.afterCursor&&(Vh(t.state,e.head,1,o)||e.headHc.decorations.from(e)}),qh=[Nh,Rh];function Fh(e={}){return[Dh.of(e),qh]}const Qh=new On;function Hh(e,t,n){let o=e.prop(t<0?On.openedBy:On.closedBy);if(o)return o;if(1==e.name.length){let o=n.indexOf(e.name);if(o>-1&&o%2==(t<0?1:0))return[n[o+t]]}return null}function zh(e){let t=e.type.prop(Qh);return t?t(e.node):e}function Vh(e,t,n,o={}){let r=o.maxScanDistance||jh,i=o.brackets||Bh,s=Uu(e),a=s.resolveInner(t,n);for(let e=a;e;e=e.parent){let o=Hh(e.type,n,i);if(o&&e.from0?t>=r.from&&tr.from&&t<=r.to))return Wh(0,0,n,e,r,o,i)}}return function(e,t,n,o,r,i,s){let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),h=0;for(let e=0;!u.next().done&&e<=i;){let i=u.value;n<0&&(e+=i.length);let a=t+e*n;for(let e=n>0?0:i.length-1,t=n>0?i.length:-1;e!=t;e+=n){let t=s.indexOf(i[e]);if(!(t<0||o.resolveInner(a+e,1).type!=r))if(t%2==0==n>0)h++;else{if(1==h)return{start:c,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};h--}}n>0&&(e+=i.length)}return u.done?{start:c,matched:!1}:null}(e,t,n,s,a.type,r,i)}function Wh(e,t,n,o,r,i,s){let a=o.parent,l={from:r.from,to:r.to},c=0,u=null==a?void 0:a.cursor();if(u&&(n<0?u.childBefore(o.from):u.childAfter(o.to)))do{if(n<0?u.to<=o.from:u.from>=o.to){if(0==c&&i.indexOf(u.type.name)>-1&&u.from-1||(Uh.push(e),console.warn(t))}function Jh(e,t){let n=[];for(let o of t.split(" ")){let t=[];for(let n of o.split(".")){let o=e[n]||ar[n];o?"function"==typeof o?t.length?t=t.map(o):Kh(n,`Modifier ${n} used at start of tag`):t.length?Kh(n,`Tag ${n} used as modifier`):t=Array.isArray(o)?o:[o]:Kh(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let o=t.replace(/ /g,"_"),r=o+" "+n.map((e=>e.id)),i=Yh[r];if(i)return i.id;let s=Yh[r]=Sn.define({id:Gh.length,name:o,props:[qo({[o]:n})]});return Gh.push(s),s.id}fa.RTL,fa.LTR;class ep{constructor(e,t,n){this.state=e,this.pos=t,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let t=Uu(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),o=t.text.slice(n-t.from,this.pos-t.from),r=o.search(ip(e,!1));return r<0?null:{from:n+r,to:this.pos,text:o.slice(r)}}get aborted(){return null==this.abortListeners}addEventListener(e,t){"abort"==e&&this.abortListeners&&this.abortListeners.push(t)}}function tp(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function np(e){let t=e.map((e=>"string"==typeof e?{label:e}:e)),[n,o]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:o}of e){t[o[0]]=!0;for(let e=1;e{let r=e.matchBefore(o);return r||e.explicit?{from:r?r.from:e.pos,options:t,validFor:n}:null}}class op{constructor(e,t,n,o){this.completion=e,this.source=t,this.match=n,this.score=o}}function rp(e){return e.selection.main.from}function ip(e,t){var n;let{source:o}=e,r=t&&"^"!=o[0],i="$"!=o[o.length-1];return r||i?new RegExp(`${r?"^":""}(?:${o})${i?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const sp=fi.define(),ap=new WeakMap;function lp(e){if(!Array.isArray(e))return e;let t=ap.get(e);return t||ap.set(e,t=np(e)),t}const cp=mi.define(),up=mi.define();class hp{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(v=Pr(l))!=v.toLowerCase()?1:v!=v.toUpperCase()?2:0;(!o||1==b&&g||0==y&&0!=b)&&(t[u]==l||n[u]==l&&(h=!0)?i[u++]=o:i.length&&(m=!1)),y=b,o+=Ar(l)}return u==a&&0==i[0]&&m?this.result((h?-200:0)-100,i,e):p==a&&0==f?this.ret(-200-e.length+(d==e.length?0:-100),[0,d]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):p==a?this.ret(-900-e.length,[f,d]):u==a?this.result((h?-200:0)-100-700+(m?0:-1100),i,e):2!=t.length&&this.result((o[0]?-700:0)-200-1100,o,e)}result(e,t,n){let o=[],r=0;for(let e of t){let t=e+(this.astral?Ar(Cr(n,e)):1);r&&o[r-1]==e?o[r-1]=t:(o[r++]=e,o[r++]=t)}return this.ret(e-n.length,o)}}const pp=zr.define({combine:e=>Pi(e,{activateOnTyping:!0,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:dp,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>fp(e(n),t(n)),optionClass:(e,t)=>n=>fp(e(n),t(n)),addToOptions:(e,t)=>e.concat(t)})});function fp(e,t){return e?t?e+" "+t:e:t}function dp(e,t,n,o,r,i){let s,a,l=e.textDirection==fa.RTL,c=l,u=!1,h="top",p=t.left-r.left,f=r.right-t.right,d=o.right-o.left,g=o.bottom-o.top;if(c&&p=g||e>t.top?s=n.bottom-t.top:(h="bottom",s=t.bottom-n.top)}return{style:`${h}: ${s/((t.bottom-t.top)/i.offsetHeight)}px; max-width: ${a/((t.right-t.left)/i.offsetWidth)}px`,class:"cm-completionInfo-"+(u?l?"left-narrow":"right-narrow":c?"left":"right")}}function gp(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let o=Math.floor((e-t)/n);return{from:e-(o+1)*n,to:e-o*n}}class mp{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let o=e.state.field(t),{options:r,selected:i}=o.open,s=e.state.facet(pp);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map((e=>"cm-completionIcon-"+e))),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,o){let r=document.createElement("span");r.className="cm-completionLabel";let i=e.displayLabel||e.label,s=0;for(let e=0;es&&r.appendChild(document.createTextNode(i.slice(s,t)));let a=r.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(i.slice(t,n))),a.className="cm-completionMatchedText",s=n}return se.position-t.position)).map((e=>e.render))}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=gp(r.length,i,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",(n=>{let{options:o}=e.state.field(t).open;for(let t,r=n.target;r&&r!=this.dom;r=r.parentNode)if("LI"==r.nodeName&&(t=/-(\d+)$/.exec(r.id))&&+t[1]{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(pp).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:up.of(null)})})),this.showOptions(r,o.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}update(e){var t;let n=e.state.field(this.stateField),o=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=o){let{options:r,selected:i,disabled:s}=n.open;o.open&&o.open.options==r||(this.range=gp(r.length,i,e.state.facet(pp).maxRenderedOptions),this.showOptions(r,n.id)),this.updateSel(),s!=(null===(t=o.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=gp(t.options.length,t.selected,this.view.state.facet(pp).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:n}=t.options[t.selected],{info:o}=n;if(!o)return;let r="string"==typeof o?document.createTextNode(o):o(n);if(!r)return;"then"in r?r.then((t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,n)})).catch((e=>Ha(this.view.state,e,"completion info"))):this.addInfoPane(r,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:o}=e;n.appendChild(t),this.infoDestroy=o||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,o=this.range.from;n;n=n.nextSibling,o++)"LI"==n.nodeName&&n.id?o==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected"):o--;return t&&function(e,t){let n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.height/e.offsetHeight;o.topn.bottom&&(e.scrollTop+=(o.bottom-n.bottom)/r)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),o=e.getBoundingClientRect(),r=this.space;if(!r){let e=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:e.innerWidth,bottom:e.innerHeight}}return o.top>Math.min(r.bottom,t.bottom)-10||o.bottomn.from||0==n.from)&&(r=e,"string"!=typeof l&&l.header?o.appendChild(l.header(l)):o.appendChild(document.createElement("completion-section")).textContent=e)}const c=o.appendChild(document.createElement("li"));c.id=t+"-"+i,c.setAttribute("role","option");let u=this.optionClass(s);u&&(c.className=u);for(let e of this.optionContent){let t=e(s,this.view.state,this.view,a);t&&c.appendChild(t)}}return n.from&&o.classList.add("cm-completionListIncompleteTop"),n.tonew mp(n,e,t)}function vp(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class bp{constructor(e,t,n,o,r,i){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=o,this.selected=r,this.disabled=i}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new bp(this.options,Op(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,o,r){let i=function(e,t){let n=[],o=null,r=e=>{n.push(e);let{section:t}=e.completion;if(t){o||(o=[]);let e="string"==typeof t?t:t.name;o.some((t=>t.name==e))||o.push("string"==typeof t?{name:e}:t)}};for(let o of e)if(o.hasResult()){let e=o.result.getMatch;if(!1===o.result.filter)for(let t of o.result.options)r(new op(t,o.source,e?e(t):[],1e9-n.length));else{let n=new hp(t.sliceDoc(o.from,o.to));for(let t of o.result.options)if(n.match(t.label)){let i=t.displayLabel?e?e(t,n.matched):[]:n.matched;r(new op(t,o.source,i,n.score+(t.boost||0)))}}}if(o){let e=Object.create(null),t=0,r=(e,t)=>{var n,o;return(null!==(n=e.rank)&&void 0!==n?n:1e9)-(null!==(o=t.rank)&&void 0!==o?o:1e9)||(e.namet.score-e.score||a(e.completion,t.completion)))){let t=e.completion;!s||s.label!=t.label||s.detail!=t.detail||null!=s.type&&null!=t.type&&s.type!=t.type||s.apply!=t.apply||s.boost!=t.boost?i.push(e):vp(e.completion)>vp(s)&&(i[i.length-1]=e),s=e.completion}return i}(e,t);if(!i.length)return o&&e.some((e=>1==e.state))?new bp(o.options,o.attrs,o.tooltip,o.timestamp,o.selected,!0):null;let s=t.facet(pp).selectOnOpen?0:-1;if(o&&o.selected!=s&&-1!=o.selected){let e=o.options[o.selected].completion;for(let t=0;tt.hasResult()?Math.min(e,t.from):e),1e8),create:Mp,above:r.aboveCursor},o?o.timestamp:Date.now(),s,!1)}map(e){return new bp(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class xp{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new xp(_p,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(pp),o=(n.override||t.languageDataAt("autocomplete",rp(t)).map(lp)).map((t=>{let o=this.active.find((e=>e.source==t))||new Sp(t,this.active.some((e=>0!=e.state))?1:0);return o.update(e,n)}));o.length==this.active.length&&o.every(((e,t)=>e==this.active[t]))&&(o=this.active);let r=this.open;r&&e.docChanged&&(r=r.map(e.changes)),e.selection||o.some((t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to)))||!function(e,t){if(e==t)return!0;for(let n=0,o=0;;){for(;n1==e.state))&&(r=null),!r&&o.every((e=>1!=e.state))&&o.some((e=>e.hasResult()))&&(o=o.map((e=>e.hasResult()?new Sp(e.source,0):e)));for(let t of e.effects)t.is(Pp)&&(r=r&&r.setSelected(t.value,this.id));return o==this.active&&r==this.open?this:new xp(o,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:wp}}const wp={"aria-autocomplete":"list"};function Op(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const _p=[];function kp(e){return e.isUserEvent("input.type")?"input":e.isUserEvent("delete.backward")?"delete":null}class Sp{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=kp(e),o=this;n?o=o.handleUserEvent(e,n,t):e.docChanged?o=o.handleChange(e):e.selection&&0!=o.state&&(o=new Sp(o.source,0));for(let t of e.effects)if(t.is(cp))o=new Sp(o.source,1,t.value?rp(e.state):-1);else if(t.is(up))o=new Sp(o.source,0);else if(t.is(Cp))for(let e of t.value)e.source==o.source&&(o=e);return o}handleUserEvent(e,t,n){return"delete"!=t&&n.activateOnTyping?new Sp(this.source,1):this.map(e.changes)}handleChange(e){return e.changes.touchesRange(rp(e.startState))?new Sp(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new Sp(this.source,this.state,e.mapPos(this.explicitPos))}}class Ep extends Sp{constructor(e,t,n,o,r){super(e,2,t),this.result=n,this.from=o,this.to=r}hasResult(){return!0}handleUserEvent(e,t,n){var o;let r=e.changes.mapPos(this.from),i=e.changes.mapPos(this.to,1),s=rp(e.state);if((this.explicitPos<0?s<=r:si||"delete"==t&&rp(e.startState)==this.from)return new Sp(this.source,"input"==t&&n.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return function(e,t,n,o){if(!e)return!1;let r=t.sliceDoc(n,o);return"function"==typeof e?e(r,n,o,t):ip(e,!0).test(r)}(this.result.validFor,e.state,r,i)?new Ep(this.source,l,this.result,r,i):this.result.update&&(a=this.result.update(this.result,r,i,new ep(e.state,s,l>=0)))?new Ep(this.source,l,a,a.from,null!==(o=a.to)&&void 0!==o?o:rp(e.state)):new Sp(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new Sp(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new Ep(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}const Cp=mi.define({map:(e,t)=>e.map((e=>e.map(t)))}),Pp=mi.define(),Ap=Zr.define({create:()=>xp.start(),update:(e,t)=>e.update(t),provide:e=>[hu.from(e,(e=>e.tooltip)),Hc.contentAttributes.from(e,(e=>e.attrs))]});function Tp(e,t){const n=t.completion.apply||t.completion.label;let o=e.state.field(Ap).active.find((e=>e.source==t.source));return o instanceof Ep&&("string"==typeof n?e.dispatch(Object.assign(Object.assign({},function(e,t,n,o){let{main:r}=e.selection,i=n-r.from,s=o-r.from;return Object.assign(Object.assign({},e.changeByRange((a=>a!=r&&n!=o&&e.sliceDoc(a.from+i,a.from+s)!=e.sliceDoc(n,o)?{range:a}:{changes:{from:a.from+i,to:o==r.from?a.to:a.from+s,insert:t},range:Fr.cursor(a.from+i+t.length)}))),{scrollIntoView:!0,userEvent:"input.complete"})}(e.state,n,o.from,o.to)),{annotations:sp.of(t.completion)})):n(e,t.completion,o.from,o.to),!0)}const Mp=yp(Ap,Tp);function Rp(e,t="option"){return n=>{let o=n.state.field(Ap,!1);if(!o||!o.open||o.open.disabled||Date.now()-o.open.timestamp-1?o.open.selected+i*(e?1:-1):e?0:s-1;return a<0?a="page"==t?0:s-1:a>=s&&(a="page"==t?s-1:0),n.dispatch({effects:Pp.of(a)}),!0}}class jp{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const Bp=Xa.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Ap).active)1==t.state&&this.startQuery(t)}update(e){let t=e.state.field(Ap);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Ap)==t)return;let n=e.transactions.some((e=>(e.selection||e.docChanged)&&!kp(e)));for(let t=0;t50&&Date.now()-o.time>1e3){for(let e of o.context.abortListeners)try{e()}catch(e){Ha(this.view.state,e)}o.context.abortListeners=null,this.running.splice(t--,1)}else o.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some((e=>e.effects.some((e=>e.is(cp)))))&&(this.pendingStart=!0);let o=this.pendingStart?50:e.state.facet(pp).activateOnTypingDelay;if(this.debounceUpdate=t.active.some((e=>1==e.state&&!this.running.some((t=>t.active.source==e.source))))?setTimeout((()=>this.startUpdate()),o):-1,0!=this.composing)for(let t of e.transactions)"input"==kp(t)?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Ap);for(let e of t.active)1!=e.state||this.running.some((t=>t.active.source==e.source))||this.startQuery(e)}startQuery(e){let{state:t}=this.view,n=rp(t),o=new ep(t,n,e.explicitPos==n),r=new jp(e,o);this.running.push(r),Promise.resolve(e.source(o)).then((e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())}),(e=>{this.view.dispatch({effects:up.of(null)}),Ha(this.view.state,e)}))}scheduleAccept(){this.running.every((e=>void 0!==e.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(pp).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(pp);for(let o=0;oe.source==r.active.source));if(i&&1==i.state)if(null==r.done){let e=new Sp(r.active.source,0);for(let t of r.updates)e=e.update(t,n);1!=e.state&&t.push(e)}else this.startQuery(i)}t.length&&this.view.dispatch({effects:Cp.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Ap,!1);if(t&&t.tooltip&&this.view.state.facet(pp).closeOnBlur){let n=t.open&&vu(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout((()=>this.view.dispatch({effects:up.of(null)})),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:cp.of(!1)})),20),this.composing=0}}}),Dp=Hc.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Lp{constructor(e,t,n,o){this.field=e,this.line=t,this.from=n,this.to=o}}class $p{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,Mr.TrackDel),n=e.mapPos(this.to,1,Mr.TrackDel);return null==t||null==n?null:new $p(this.field,t,n)}}class Ip{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],o=[t],r=e.doc.lineAt(t),i=/^\s*/.exec(r.text)[0];for(let r of this.lines){if(n.length){let n=i,s=/^\t*/.exec(r)[0].length;for(let t=0;tnew $p(e.field,o[e.line]+e.from,o[e.line]+e.to)));return{text:n,ranges:s}}static parse(e){let t,n=[],o=[],r=[];for(let i of e.split(/\r\n?|\n/)){for(;t=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(i);){let e=t[1]?+t[1]:null,s=t[2]||t[3]||"",a=-1;for(let t=0;t=a&&e.field++}r.push(new Lp(a,o.length,t.index,t.index+s.length)),i=i.slice(0,t.index)+s+i.slice(t.index+t[0].length)}for(let e;e=/\\([{}])/.exec(i);){i=i.slice(0,e.index)+e[1]+i.slice(e.index+e[0].length);for(let t of r)t.line==o.length&&t.from>e.index&&(t.from--,t.to--)}o.push(i)}return new Ip(o,r)}}let Np=ra.widget({widget:new class extends na{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),qp=ra.mark({class:"cm-snippetField"});class Fp{constructor(e,t){this.ranges=e,this.active=t,this.deco=ra.set(e.map((e=>(e.from==e.to?Np:qp).range(e.from,e.to))))}map(e){let t=[];for(let n of this.ranges){let o=n.map(e);if(!o)return null;t.push(o)}return new Fp(t,this.active)}selectionInsideField(e){return e.ranges.every((e=>this.ranges.some((t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))))}}const Qp=mi.define({map:(e,t)=>e&&e.map(t)}),Hp=mi.define(),zp=Zr.define({create:()=>null,update(e,t){for(let n of t.effects){if(n.is(Qp))return n.value;if(n.is(Hp)&&e)return new Fp(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>Hc.decorations.from(e,(e=>e?e.deco:ra.none))});function Vp(e,t){return Fr.create(e.filter((e=>e.field==t)).map((e=>Fr.range(e.from,e.to))))}function Wp(e){let t=Ip.parse(e);return(e,n,o,r)=>{let{text:i,ranges:s}=t.instantiate(e.state,o),a={changes:{from:o,to:r,insert:lr.of(i)},scrollIntoView:!0,annotations:n?[sp.of(n),yi.userEvent.of("input.complete")]:void 0};if(s.length&&(a.selection=Vp(s,0)),s.some((e=>e.field>0))){let t=new Fp(s,0),n=a.effects=[Qp.of(t)];void 0===e.state.field(zp,!1)&&n.push(mi.appendConfig.of([zp,Yp,Kp,Dp]))}e.dispatch(e.state.update(a))}}function Xp(e){return({state:t,dispatch:n})=>{let o=t.field(zp,!1);if(!o||e<0&&0==o.active)return!1;let r=o.active+e,i=e>0&&!o.ranges.some((t=>t.field==r+e));return n(t.update({selection:Vp(o.ranges,r),effects:Qp.of(i?null:new Fp(o.ranges,r)),scrollIntoView:!0})),!0}}const Gp=[{key:"Tab",run:Xp(1),shift:Xp(-1)},{key:"Escape",run:({state:e,dispatch:t})=>!!e.field(zp,!1)&&(t(e.update({effects:Qp.of(null)})),!0)}],Up=zr.define({combine:e=>e.length?e[0]:Gp}),Yp=Jr.highest(Zc.compute([Up],(e=>e.facet(Up))));function Zp(e,t){return Object.assign(Object.assign({},t),{apply:Wp(e)})}const Kp=Hc.domEventHandlers({mousedown(e,t){let n,o=t.state.field(zp,!1);if(!o||null==(n=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;let r=o.ranges.find((e=>e.from<=n&&e.to>=n));return!(!r||r.field==o.active||(t.dispatch({selection:Vp(o.ranges,r.field),effects:Qp.of(o.ranges.some((e=>e.field>r.field))?new Fp(o.ranges,r.field):null),scrollIntoView:!0}),0))}}),Jp={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ef=mi.define({map(e,t){let n=t.mapPos(e,-1,Mr.TrackAfter);return null==n?void 0:n}}),tf=new class extends Ai{};tf.startSide=1,tf.endSide=-1;const nf=Zr.define({create:()=>ji.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(ef)&&(e=e.update({add:[tf.range(n.value,n.value+1)]}));return e}});function of(){return[lf,nf]}const rf="()[]{}<>";function sf(e){for(let t=0;t<8;t+=2)if(rf.charCodeAt(t)==e)return rf.charAt(t+1);return Pr(e<128?e:e+1)}const af="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),lf=Hc.inputHandler.of(((e,t,n,o)=>{if((af?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(o.length>2||2==o.length&&1==Ar(Cr(o,0))||t!=r.from||n!=r.to)return!1;let i=function(e,t){let n=function(e,t){return e.languageDataAt("closeBrackets",t)[0]||Jp}(e,e.selection.main.head),o=n.brackets||Jp.brackets;for(let r of o){let i=sf(Cr(r,0));if(t==r)return i==r?ff(e,r,o.indexOf(r+r+r)>-1,n):hf(e,r,i,n.before||Jp.before);if(t==i&&cf(e,e.selection.main.from))return pf(e,0,i)}return null}(e.state,o);return!!i&&(e.dispatch(i),!0)}));function cf(e,t){let n=!1;return e.field(nf).between(0,e.doc.length,(e=>{e==t&&(n=!0)})),n}function uf(e,t){let n=e.sliceString(t,t+2);return n.slice(0,Ar(Cr(n,0)))}function hf(e,t,n,o){let r=null,i=e.changeByRange((i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:n,from:i.to}],effects:ef.of(i.to+t.length),range:Fr.range(i.anchor+t.length,i.head+t.length)};let s=uf(e.doc,i.head);return!s||/\s/.test(s)||o.indexOf(s)>-1?{changes:{insert:t+n,from:i.head},effects:ef.of(i.head+t.length),range:Fr.cursor(i.head+t.length)}:{range:r=i}}));return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function pf(e,t,n){let o=null,r=e.changeByRange((t=>t.empty&&uf(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:Fr.cursor(t.head+n.length)}:o={range:t}));return o?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function ff(e,t,n,o){let r=o.stringPrefixes||Jp.stringPrefixes,i=null,s=e.changeByRange((o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:t,from:o.to}],effects:ef.of(o.to+t.length),range:Fr.range(o.anchor+t.length,o.head+t.length)};let s,a=o.head,l=uf(e.doc,a);if(l==t){if(df(e,a))return{changes:{insert:t+t,from:a},effects:ef.of(a+t.length),range:Fr.cursor(a+t.length)};if(cf(e,a)){let o=n&&e.sliceDoc(a,a+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+o.length,insert:o},range:Fr.cursor(a+o.length)}}}else{if(n&&e.sliceDoc(a-2*t.length,a)==t+t&&(s=gf(e,a-2*t.length,r))>-1&&df(e,s))return{changes:{insert:t+t+t+t,from:a},effects:ef.of(a+t.length),range:Fr.cursor(a+t.length)};if(e.charCategorizer(a)(l)!=ki.Word&&gf(e,a,r)>-1&&!function(e,t,n,o){let r=Uu(e).resolveInner(t,-1),i=o.reduce(((e,t)=>Math.max(e,t.length)),0);for(let s=0;s<5;s++){let s=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+i)),a=s.indexOf(n);if(!a||a>-1&&o.indexOf(s.slice(0,a))>-1){let t=r.firstChild;for(;t&&t.from==r.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=r.to==t&&r.parent;if(!l)break;r=l}return!1}(e,a,t,r))return{changes:{insert:t+t,from:a},effects:ef.of(a+t.length),range:Fr.cursor(a+t.length)}}return{range:i=o}}));return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function df(e,t){let n=Uu(e).resolveInner(t+1);return n.parent&&n.from==t}function gf(e,t,n){let o=e.charCategorizer(t);if(o(e.sliceDoc(t-1,t))!=ki.Word)return t;for(let r of n){let n=t-r.length;if(e.sliceDoc(n,t)==r&&o(e.sliceDoc(n-1,n))!=ki.Word)return n}return-1}function mf(e={}){return[Ap,pp.of(e),Bp,vf,Dp]}const yf=[{key:"Ctrl-Space",run:e=>!!e.state.field(Ap,!1)&&(e.dispatch({effects:cp.of(!0)}),!0)},{key:"Escape",run:e=>{let t=e.state.field(Ap,!1);return!(!t||!t.active.some((e=>0!=e.state))||(e.dispatch({effects:up.of(null)}),0))}},{key:"ArrowDown",run:Rp(!0)},{key:"ArrowUp",run:Rp(!1)},{key:"PageDown",run:Rp(!0,"page")},{key:"PageUp",run:Rp(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(Ap,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.facet(pp).defaultKeymap?[yf]:[])));function bf(e,t){return({state:n,dispatch:o})=>{if(n.readOnly)return!1;let r=e(t,n);return!!r&&(o(n.update(r)),!0)}}const xf=bf(Ef,0),wf=bf(Sf,0),Of=bf(((e,t)=>Sf(e,t,function(e){let t=[];for(let n of e.selection.ranges){let o=e.doc.lineAt(n.from),r=n.to<=o.to?o:e.doc.lineAt(n.to),i=t.length-1;i>=0&&t[i].to>o.from?t[i].to=r.to:t.push({from:o.from+/^\s*/.exec(o.text)[0].length,to:r.to})}return t}(t))),0);function _f(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}const kf=50;function Sf(e,t,n=t.selection.ranges){let o=n.map((e=>_f(t,e.from).block));if(!o.every((e=>e)))return null;let r=n.map(((e,n)=>function(e,{open:t,close:n},o,r){let i,s,a=e.sliceDoc(o-kf,o),l=e.sliceDoc(r,r+kf),c=/\s*$/.exec(a)[0].length,u=/^\s*/.exec(l)[0].length,h=a.length-c;if(a.slice(h-t.length,h)==t&&l.slice(u,u+n.length)==n)return{open:{pos:o-c,margin:c&&1},close:{pos:r+u,margin:u&&1}};r-o<=2*kf?i=s=e.sliceDoc(o,r):(i=e.sliceDoc(o,o+kf),s=e.sliceDoc(r-kf,r));let p=/^\s*/.exec(i)[0].length,f=/\s*$/.exec(s)[0].length,d=s.length-f-n.length;return i.slice(p,p+t.length)==t&&s.slice(d,d+n.length)==n?{open:{pos:o+p+t.length,margin:/\s/.test(i.charAt(p+t.length))?1:0},close:{pos:r-f-n.length,margin:/\s/.test(s.charAt(d-1))?1:0}}:null}(t,o[n],e.from,e.to)));if(2!=e&&!r.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>r[t]?[]:[{from:e.from,insert:o[t].open+" "},{from:e.to,insert:" "+o[t].close}])))};if(1!=e&&r.some((e=>e))){let e=[];for(let t,n=0;nr&&(e==i||i>l.from)){r=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,n=l.text.slice(e,e+a.length)==a?e:-1;ee.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:r,empty:i,single:s}of o)!s&&i||e.push({from:t.from+r,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&o.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:r}of o)if(n>=0){let o=t.from+n,i=o+r.length;" "==t.text[i-t.from]&&i++,e.push({from:o,to:i})}return{changes:e}}return null}const Cf=fi.define(),Pf=zr.define();class Af{constructor(e,t,n,o,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=o,this.selectionsAfter=r}setSelAfter(e){return new Af(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new Af(e.changes&&jr.fromJSON(e.changes),[],e.mapped&&Rr.fromJSON(e.mapped),e.startSelection&&Fr.fromJSON(e.startSelection),e.selectionsAfter.map(Fr.fromJSON))}static fromTransaction(e,t){let n=Rf;for(let t of e.startState.facet(Pf)){let o=t(e);o.length&&(n=n.concat(o))}return!n.length&&e.changes.empty?null:new Af(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Rf)}static selection(e){return new Af(void 0,Rf,void 0,void 0,e)}}function Tf(e,t,n,o){let r=t+1>n+20?t-n-1:0,i=e.slice(r,t);return i.push(o),i}function Mf(e,t){return e.length?t.length?e.concat(t):e:t}const Rf=[];function jf(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Bf(e,t){if(!e.length)return e;let n=e.length,o=Rf;for(;n;){let r=Df(e[n-1],t,o);if(r.changes&&!r.changes.empty||r.effects.length){let t=e.slice(0,n);return t[n-1]=r,t}t=r.mapped,n--,o=r.selectionsAfter}return o.length?[Af.selection(o)]:Rf}function Df(e,t,n){let o=Mf(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):Rf,n);if(!e.changes)return Af.selection(o);let r=e.changes.map(t),i=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(i):i;return new Af(r,mi.mapEffects(e.effects,t),s,e.startSelection.map(i),o)}const Lf=/^(input\.type|delete)($|\.)/;class $f{constructor(e,t,n=0,o=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=o}isolate(){return this.prevTime?new $f(this.done,this.undone):this}addChanges(e,t,n,o,r){let i=this.done,s=i[i.length-1];return i=s&&s.changes&&!s.changes.empty&&e.changes&&(!n||Lf.test(n))&&(!s.selectionsAfter.length&&t-this.prevTimen.push(e,t))),t.iterChangedRanges(((e,t,r,i)=>{for(let e=0;e=t&&r<=s&&(o=!0)}})),o}(s.changes,e.changes))||"input.type.compose"==n)?Tf(i,i.length-1,o.minDepth,new Af(e.changes.compose(s.changes),Mf(e.effects,s.effects),s.mapped,s.startSelection,Rf)):Tf(i,i.length,o.minDepth,e),new $f(i,Rf,t,n)}addSelection(e,t,n,o){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Rf;return r.length>0&&t-this.prevTimee.empty!=t.ranges[n].empty)).length}(r[r.length-1],e)?this:new $f(function(e,t){if(e.length){let n=e[e.length-1],o=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return o.length&&o[o.length-1].eq(t)?e:(o.push(t),Tf(e,e.length-1,1e9,n.setSelAfter(o)))}return[Af.selection([t])]}(this.done,e),this.undone,t,n)}addMapping(e){return new $f(Bf(this.done,e),Bf(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let o=0==e?this.done:this.undone;if(0==o.length)return null;let r=o[o.length-1],i=r.selectionsAfter[0]||t.selection;if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Cf.of({side:e,rest:jf(o),selection:i}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=1==o.length?Rf:o.slice(0,o.length-1);return r.mapped&&(n=Bf(n,r.mapped)),t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Cf.of({side:e,rest:n,selection:i}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}function If(e,t){return Fr.create(e.ranges.map(t),e.mainIndex)}function Nf(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function qf({state:e,dispatch:t},n){let o=If(e.selection,n);return!o.eq(e.selection,!0)&&(t(Nf(e,o)),!0)}function Ff(e,t){return Fr.cursor(t?e.to:e.from)}function Qf(e,t){return qf(e,(n=>n.empty?e.moveByChar(n,t):Ff(n,t)))}function Hf(e){return e.textDirectionAt(e.state.selection.main.head)==fa.LTR}$f.empty=new $f(Rf,Rf);const zf=e=>Qf(e,!Hf(e)),Vf=e=>Qf(e,Hf(e));function Wf(e,t){return qf(e,(n=>n.empty?e.moveByGroup(n,t):Ff(n,t)))}function Xf(e,t,n){if(t.type.prop(n))return!0;let o=t.to-t.from;return o&&(o>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Gf(e,t,n){let o,r,i=Uu(e).resolveInner(t.head),s=n?On.closedBy:On.openedBy;for(let o=t.head;;){let t=n?i.childAfter(o):i.childBefore(o);if(!t)break;Xf(e,t,s)?i=t:o=n?t.to:t.from}return r=i.type.prop(s)&&(o=n?Vh(e,i.from,1):Vh(e,i.to,-1))&&o.matched?n?o.end.to:o.end.from:n?i.to:i.from,Fr.cursor(r,n?-1:1)}function Uf(e,t){return qf(e,(n=>{if(!n.empty)return Ff(n,t);let o=e.moveVertically(n,t);return o.head!=n.head?o:e.moveToLineBoundary(n,t)}))}"undefined"!=typeof Intl&&Intl.Segmenter;const Yf=e=>Uf(e,!1),Zf=e=>Uf(e,!0);function Kf(e){let t,n=e.scrollDOM.clientHeightn.empty?e.moveVertically(n,t,o.height):Ff(n,t)));if(i.eq(r.selection))return!1;if(o.selfScroll){let t=e.coordsAtPos(r.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),a=s.top+o.marginTop,l=s.bottom-o.marginBottom;t&&t.top>a&&t.bottomJf(e,!1),td=e=>Jf(e,!0);function nd(e,t,n){let o=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?o.to:o.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==o.from&&o.length){let n=/^\s*/.exec(e.state.sliceDoc(o.from,Math.min(o.from+100,o.to)))[0].length;n&&t.head!=o.from+n&&(r=Fr.cursor(o.from+n))}return r}function od(e,t){let n=If(e.state.selection,(e=>{let n=t(e);return Fr.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(e.state.selection)&&(e.dispatch(Nf(e.state,n)),!0)}function rd(e,t){return od(e,(n=>e.moveByChar(n,t)))}const id=e=>rd(e,!Hf(e)),sd=e=>rd(e,Hf(e));function ad(e,t){return od(e,(n=>e.moveByGroup(n,t)))}function ld(e,t){return od(e,(n=>e.moveVertically(n,t)))}const cd=e=>ld(e,!1),ud=e=>ld(e,!0);function hd(e,t){return od(e,(n=>e.moveVertically(n,t,Kf(e).height)))}const pd=e=>hd(e,!1),fd=e=>hd(e,!0),dd=({state:e,dispatch:t})=>(t(Nf(e,{anchor:0})),!0),gd=({state:e,dispatch:t})=>(t(Nf(e,{anchor:e.doc.length})),!0),md=({state:e,dispatch:t})=>(t(Nf(e,{anchor:e.selection.main.anchor,head:0})),!0),yd=({state:e,dispatch:t})=>(t(Nf(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function vd(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:o}=e,r=o.changeByRange((o=>{let{from:r,to:i}=o;if(r==i){let s=t(o);sr&&(n="delete.forward",s=bd(e,s,!0)),r=Math.min(r,s),i=Math.max(i,s)}else r=bd(e,r,!1),i=bd(e,i,!0);return r==i?{range:o}:{changes:{from:r,to:i},range:Fr.cursor(r,rt(e))))o.between(t,t,((e,o)=>{et&&(t=n?o:e)}));return t}const xd=(e,t)=>vd(e,(n=>{let o,r,i=n.from,{state:s}=e,a=s.doc.lineAt(i);if(!t&&i>a.from&&ixd(e,!1),Od=e=>xd(e,!0),_d=(e,t)=>vd(e,(n=>{let o=n.head,{state:r}=e,i=r.doc.lineAt(o),s=r.charCategorizer(o);for(let e=null;;){if(o==(t?i.to:i.from)){o==n.head&&i.number!=(t?r.doc.lines:1)&&(o+=t?1:-1);break}let a=Or(i.text,o-i.from,t)+i.from,l=i.text.slice(Math.min(o,a)-i.from,Math.max(o,a)-i.from),c=s(l);if(null!=e&&c!=e)break;" "==l&&o==n.head||(e=c),o=a}return o})),kd=e=>_d(e,!1);function Sd(e){let t=[],n=-1;for(let o of e.selection.ranges){let r=e.doc.lineAt(o.from),i=e.doc.lineAt(o.to);if(o.empty||o.to!=i.from||(i=e.doc.lineAt(o.to-1)),n>=r.number){let e=t[t.length-1];e.to=i.to,e.ranges.push(o)}else t.push({from:r.from,to:i.to,ranges:[o]});n=i.number+1}return t}function Ed(e,t,n){if(e.readOnly)return!1;let o=[],r=[];for(let t of Sd(e)){if(n?t.to==e.doc.length:0==t.from)continue;let i=e.doc.lineAt(n?t.to+1:t.from-1),s=i.length+1;if(n){o.push({from:t.to,to:i.to},{from:t.from,insert:i.text+e.lineBreak});for(let n of t.ranges)r.push(Fr.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)))}else{o.push({from:i.from,to:t.from},{from:t.to,insert:e.lineBreak+i.text});for(let e of t.ranges)r.push(Fr.range(e.anchor-s,e.head-s))}}return!!o.length&&(t(e.update({changes:o,scrollIntoView:!0,selection:Fr.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0)}function Cd(e,t,n){if(e.readOnly)return!1;let o=[];for(let t of Sd(e))n?o.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):o.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:o,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Pd=Td(!1),Ad=Td(!0);function Td(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let o=t.changeByRange((n=>{let{from:o,to:r}=n,i=t.doc.lineAt(o),s=!e&&o==r&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,o=Uu(e).resolveInner(t),r=o.childBefore(t),i=o.childAfter(t);return r&&i&&r.to<=t&&i.from>=t&&(n=r.type.prop(On.closedBy))&&n.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}(t,o);e&&(o=r=(r<=i.to?i:t.doc.lineAt(r)).to);let a=new hh(t,{simulateBreak:o,simulateDoubleBreak:!!s}),l=uh(a,o);for(null==l&&(l=Vi(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));ri.from&&o{let r=[];for(let i=o.from;i<=o.to;){let s=e.doc.lineAt(i);s.number>n&&(o.empty||o.to>s.from)&&(t(s,r,o),n=s.number),i=s.to+1}let i=e.changes(r);return{changes:r,range:Fr.range(i.mapPos(o.anchor,1),i.mapPos(o.head,1))}}))}const Rd=[{key:"Ctrl-b",run:zf,shift:id,preventDefault:!0},{key:"Ctrl-f",run:Vf,shift:sd},{key:"Ctrl-p",run:Yf,shift:cd},{key:"Ctrl-n",run:Zf,shift:ud},{key:"Ctrl-a",run:e=>qf(e,(t=>Fr.cursor(e.lineBlockAt(t.head).from,1))),shift:e=>od(e,(t=>Fr.cursor(e.lineBlockAt(t.head).from)))},{key:"Ctrl-e",run:e=>qf(e,(t=>Fr.cursor(e.lineBlockAt(t.head).to,-1))),shift:e=>od(e,(t=>Fr.cursor(e.lineBlockAt(t.head).to)))},{key:"Ctrl-d",run:Od},{key:"Ctrl-h",run:wd},{key:"Ctrl-k",run:e=>vd(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:lr.of(["",""])},range:Fr.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,o=e.doc.lineAt(n),r=n==o.from?n-1:Or(o.text,n-o.from,!1)+o.from,i=n==o.to?n+1:Or(o.text,n-o.from,!0)+o.from;return{changes:{from:r,to:i,insert:e.doc.slice(n,i).append(e.doc.slice(r,n))},range:Fr.cursor(i)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:td}],jd=[{key:"ArrowLeft",run:zf,shift:id,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>Wf(e,!Hf(e)),shift:e=>ad(e,!Hf(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>qf(e,(t=>nd(e,t,!Hf(e)))),shift:e=>od(e,(t=>nd(e,t,!Hf(e)))),preventDefault:!0},{key:"ArrowRight",run:Vf,shift:sd,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>Wf(e,Hf(e)),shift:e=>ad(e,Hf(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>qf(e,(t=>nd(e,t,Hf(e)))),shift:e=>od(e,(t=>nd(e,t,Hf(e)))),preventDefault:!0},{key:"ArrowUp",run:Yf,shift:cd,preventDefault:!0},{mac:"Cmd-ArrowUp",run:dd,shift:md},{mac:"Ctrl-ArrowUp",run:ed,shift:pd},{key:"ArrowDown",run:Zf,shift:ud,preventDefault:!0},{mac:"Cmd-ArrowDown",run:gd,shift:yd},{mac:"Ctrl-ArrowDown",run:td,shift:fd},{key:"PageUp",run:ed,shift:pd},{key:"PageDown",run:td,shift:fd},{key:"Home",run:e=>qf(e,(t=>nd(e,t,!1))),shift:e=>od(e,(t=>nd(e,t,!1))),preventDefault:!0},{key:"Mod-Home",run:dd,shift:md},{key:"End",run:e=>qf(e,(t=>nd(e,t,!0))),shift:e=>od(e,(t=>nd(e,t,!0))),preventDefault:!0},{key:"Mod-End",run:gd,shift:yd},{key:"Enter",run:Pd},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:wd,shift:wd},{key:"Delete",run:Od},{key:"Mod-Backspace",mac:"Alt-Backspace",run:kd},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>_d(e,!0)},{mac:"Mod-Backspace",run:e=>vd(e,(t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}))},{mac:"Mod-Delete",run:e=>vd(e,(t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head({mac:e.key,run:e.run,shift:e.shift})))),Bd=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>qf(e,(t=>Gf(e.state,t,!Hf(e)))),shift:e=>od(e,(t=>Gf(e.state,t,!Hf(e))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>qf(e,(t=>Gf(e.state,t,Hf(e)))),shift:e=>od(e,(t=>Gf(e.state,t,Hf(e))))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>Ed(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>Cd(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>Ed(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>Cd(e,t,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,o=null;return n.ranges.length>1?o=Fr.create([n.main]):n.main.empty||(o=Fr.create([Fr.cursor(n.main.head)])),!!o&&(t(Nf(e,o)),!0)}},{key:"Mod-Enter",run:Ad},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=Sd(e).map((({from:t,to:n})=>Fr.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:Fr.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=If(e.selection,(t=>{var n;for(let o=Uu(e).resolveStack(t.from,1);o;o=o.next){let{node:e}=o;if((e.from=t.to||e.to>t.to&&e.from<=t.from)&&(null===(n=e.parent)||void 0===n?void 0:n.parent))return Fr.range(e.to,e.from)}return t}));return t(Nf(e,n)),!0},preventDefault:!0},{key:"Mod-[",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Md(e,((t,n)=>{let o=/^\s*/.exec(t.text)[0];if(!o)return;let r=Vi(o,e.tabSize),i=0,s=ch(e,Math.max(0,r-lh(e)));for(;i!e.readOnly&&(t(e.update(Md(e,((t,n)=>{n.push({from:t.from,insert:e.facet(ah)})})),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),o=new hh(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),r=Md(e,((t,r,i)=>{let s=uh(o,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let a=/^\s*/.exec(t.text)[0],l=ch(e,s);(a!=l||i.from{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Sd(t).map((({from:e,to:n})=>(e>0?e--:ne.moveVertically(t,!0))).map(n);return e.dispatch({changes:n,selection:o,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let o=!1,r=If(e.selection,(t=>{let r=Vh(e,t.head,-1)||Vh(e,t.head,1)||t.head>0&&Vh(e,t.head-1,1)||t.head{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),o=_f(e.state,n.from);return o.line?xf(e):!!o.block&&Of(e)}},{key:"Alt-A",run:wf}].concat(jd);function Dd(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o)){var r=n[o];"string"==typeof r?e.setAttribute(o,r):null!=r&&(e[o]=r)}t++}for(;te.from==e.to||e.from==e.to-1&&n.doc.lineAt(e.from).to==e.from?ra.widget({widget:new eg(e),diagnostic:e}).range(e.from):ra.mark({attributes:{class:"cm-lintRange cm-lintRange-"+e.severity+(e.markClass?" "+e.markClass:"")},diagnostic:e}).range(e.from,e.to))),!0);return new Id(i,t,Nd(i))}}function Nd(e,t=null,n=0){let o=null;return e.between(n,1e9,((e,n,{spec:r})=>{if(!t||r.diagnostic==t)return o=new $d(e,n,r.diagnostic),!1})),o}function qd(e,t){return e.field(zd,!1)?t:t.concat(mi.appendConfig.of(ig))}const Fd=mi.define(),Qd=mi.define(),Hd=mi.define(),zd=Zr.define({create:()=>new Id(ra.none,null,null),update(e,t){if(t.docChanged){let n=e.diagnostics.map(t.changes),o=null;if(e.selected){let r=t.changes.mapPos(e.selected.from,1);o=Nd(n,e.selected.diagnostic,r)||Nd(n,null,r)}e=new Id(n,e.panel,o)}for(let n of t.effects)n.is(Fd)?e=Id.init(n.value,e.panel,t.state):n.is(Qd)?e=new Id(e.diagnostics,n.value?ng.open:null,e.selected):n.is(Hd)&&(e=new Id(e.diagnostics,e.panel,n.value));return e},provide:e=>[ku.from(e,(e=>e.panel)),Hc.decorations.from(e,(e=>e.diagnostics))]}),Vd=ra.mark({class:"cm-lintRange cm-lintRange-active"});function Wd(e,t,n){let{diagnostics:o}=e.state.field(zd),r=[],i=2e8,s=0;o.between(t-(n<0?1:0),t+(n>0?1:0),((e,o,{spec:a})=>{t>=e&&t<=o&&(e==o||(t>e||n>0)&&(t({dom:Xd(e,r)})}:null}function Xd(e,t){return Dd("ul",{class:"cm-tooltip-lint"},t.map((t=>Jd(e,t,!1))))}const Gd=e=>{let t=e.state.field(zd,!1);return!(!t||!t.panel||(e.dispatch({effects:Qd.of(!1)}),0))},Ud=Xa.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(Yd);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){let e=Date.now();if(ePromise.resolve(e(this.view))))).then((t=>{let n=t.reduce(((e,t)=>e.concat(t)));this.view.state.doc==e.doc&&this.view.dispatch(function(e,t){return{effects:qd(e,[Fd.of(t)])}}(this.view.state,n))}),(e=>{Ha(this.view.state,e)}))}}update(e){let t=e.state.facet(Yd);(e.docChanged||t!=e.startState.facet(Yd)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),Yd=zr.define({combine:e=>Object.assign({sources:e.map((e=>e.source))},Pi(e.map((e=>e.config)),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t}))});function Zd(e,t={}){return[Yd.of({source:e,config:t}),Ud,ig]}function Kd(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;ee.toLowerCase()==o.toLowerCase()))){t.push(o);continue e}}t.push("")}return t}function Jd(e,t,n){var o;let r=n?Kd(t.actions):[];return Dd("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Dd("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage():t.message),null===(o=t.actions)||void 0===o?void 0:o.map(((n,o)=>{let i=!1,s=o=>{if(o.preventDefault(),i)return;i=!0;let r=Nd(e.state.field(zd).diagnostics,t);r&&n.apply(e,r.from,r.to)},{name:a}=n,l=r[o]?a.indexOf(r[o]):-1,c=l<0?a:[a.slice(0,l),Dd("u",a.slice(l,l+1)),a.slice(l+1)];return Dd("button",{type:"button",class:"cm-diagnosticAction",onclick:s,onmousedown:s,"aria-label":` Action: ${a}${l<0?"":` (access key "${r[o]})"`}.`},c)})),t.source&&Dd("div",{class:"cm-diagnosticSource"},t.source))}class eg extends na{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return Dd("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class tg{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=Jd(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ng{constructor(e){this.view=e,this.items=[],this.list=Dd("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)Gd(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],o=Kd(n.actions);for(let r=0;r{for(let t=0;tGd(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(zd).selected;if(!e)return-1;for(let t=0;t{let a,l=-1;for(let e=n;en&&(this.items.splice(n,l-n),o=!0)),t&&a.diagnostic==t.diagnostic?a.dom.hasAttribute("aria-selected")||(a.dom.setAttribute("aria-selected","true"),r=a):a.dom.hasAttribute("aria-selected")&&a.dom.removeAttribute("aria-selected"),n++}));n({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.topt.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Nd(this.view.state.field(zd).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Hd.of(t)})}static open(e){return new ng(e)}}function og(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}(``,'width="6" height="3"')}const rg=Hc.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:og("#d11")},".cm-lintRange-warning":{backgroundImage:og("orange")},".cm-lintRange-info":{backgroundImage:og("#999")},".cm-lintRange-hint":{backgroundImage:og("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),ig=[zd,Hc.decorations.compute([zd],(e=>{let{selected:t,panel:n}=e.field(zd);return t&&n&&t.from!=t.to?ra.set([Vd.range(t.from,t.to)]):ra.none})),yu(Wd,{hideOn:function(e,t){let n=e.startState.doc.lineAt(t.pos);return!(!e.effects.some((e=>e.is(Fd)))&&!e.changes.touchesRange(n.from,n.to))}}),rg];class sg{static create(e,t,n,o,r){return new sg(e,t,n,o+(o<<8)+e+(t<<4)|0,r,[],[])}constructor(e,t,n,o,r,i,s){this.type=e,this.value=t,this.from=n,this.hash=o,this.end=r,this.children=i,this.positions=s,this.hashProp=[[On.contextHash,o]]}addChild(e,t){e.prop(On.contextHash)!=this.hash&&(e=new Tn(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new Tn(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new Tn(Sn.none,e,t,n,this.hashProp)})}}var ag;!function(e){e[e.Document=1]="Document",e[e.CodeBlock=2]="CodeBlock",e[e.FencedCode=3]="FencedCode",e[e.Blockquote=4]="Blockquote",e[e.HorizontalRule=5]="HorizontalRule",e[e.BulletList=6]="BulletList",e[e.OrderedList=7]="OrderedList",e[e.ListItem=8]="ListItem",e[e.ATXHeading1=9]="ATXHeading1",e[e.ATXHeading2=10]="ATXHeading2",e[e.ATXHeading3=11]="ATXHeading3",e[e.ATXHeading4=12]="ATXHeading4",e[e.ATXHeading5=13]="ATXHeading5",e[e.ATXHeading6=14]="ATXHeading6",e[e.SetextHeading1=15]="SetextHeading1",e[e.SetextHeading2=16]="SetextHeading2",e[e.HTMLBlock=17]="HTMLBlock",e[e.LinkReference=18]="LinkReference",e[e.Paragraph=19]="Paragraph",e[e.CommentBlock=20]="CommentBlock",e[e.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",e[e.Escape=22]="Escape",e[e.Entity=23]="Entity",e[e.HardBreak=24]="HardBreak",e[e.Emphasis=25]="Emphasis",e[e.StrongEmphasis=26]="StrongEmphasis",e[e.Link=27]="Link",e[e.Image=28]="Image",e[e.InlineCode=29]="InlineCode",e[e.HTMLTag=30]="HTMLTag",e[e.Comment=31]="Comment",e[e.ProcessingInstruction=32]="ProcessingInstruction",e[e.Autolink=33]="Autolink",e[e.HeaderMark=34]="HeaderMark",e[e.QuoteMark=35]="QuoteMark",e[e.ListMark=36]="ListMark",e[e.LinkMark=37]="LinkMark",e[e.EmphasisMark=38]="EmphasisMark",e[e.CodeMark=39]="CodeMark",e[e.CodeText=40]="CodeText",e[e.CodeInfo=41]="CodeInfo",e[e.LinkTitle=42]="LinkTitle",e[e.LinkLabel=43]="LinkLabel",e[e.URL=44]="URL"}(ag||(ag={}));class lg{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}}class cg{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return fg(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let o=t;o=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let o=(e.type==ag.OrderedList?xg:bg)(n,t,!1);return o>0&&(e.type!=ag.BulletList||yg(n,t,!1)<0)&&n.text.charCodeAt(n.pos+o-1)==e.value}const hg={[ag.Blockquote]:(e,t,n)=>62==n.next&&(n.markers.push(Gg(ag.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(pg(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0),[ag.ListItem]:(e,t,n)=>!(n.indent-1||(n.moveBaseColumn(n.baseIndent+e.value),0)),[ag.OrderedList]:ug,[ag.BulletList]:ug,[ag.Document]:()=>!0};function pg(e){return 32==e||9==e||10==e||13==e}function fg(e,t=0){for(;tn&&pg(e.charCodeAt(t-1));)t--;return t}function gg(e){if(96!=e.next&&126!=e.next)return-1;let t=e.pos+1;for(;t-1&&e.depth==t.stack.length||o<3?-1:1}function vg(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function bg(e,t,n){return 45!=e.next&&43!=e.next&&42!=e.next||e.pos!=e.text.length-1&&!pg(e.text.charCodeAt(e.pos+1))||!(!n||vg(t,ag.BulletList)||e.skipSpace(e.pos+2)=48&&r<=57;){if(o++,o==e.text.length)return-1;r=e.text.charCodeAt(o)}return o==e.pos||o>e.pos+9||46!=r&&41!=r||oe.pos+1||49!=e.next)?-1:o+1-e.pos}function wg(e){if(35!=e.next)return-1;let t=e.pos+1;for(;t6?-1:n}function Og(e){if(45!=e.next&&61!=e.next||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t/,Sg=/\?>/,Eg=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(o);if(i)return e.append(Gg(ag.Comment,n,n+1+i[0].length));let s=/^\?[^]*?\?>/.exec(o);if(s)return e.append(Gg(ag.ProcessingInstruction,n,n+1+s[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(o);return a?e.append(Gg(ag.HTMLTag,n,n+1+a[0].length)):-1},Emphasis(e,t,n){if(95!=t&&42!=t)return-1;let o=n+1;for(;e.char(o)==t;)o++;let r=e.slice(n-1,n),i=e.slice(o,o+1),s=em.test(r),a=em.test(i),l=/\s|^$/.test(r),c=/\s|^$/.test(i),u=!c&&(!a||l||s),h=!l&&(!s||c||a),p=u&&(42==t||!h||s),f=h&&(42==t||!u||a);return e.append(new Jg(95==t?Ug:Yg,n,o,(p?1:0)|(f?2:0)))},HardBreak(e,t,n){if(92==t&&10==e.char(n+1))return e.append(Gg(ag.HardBreak,n,n+2));if(32==t){let t=n+1;for(;32==e.char(t);)t++;if(10==e.char(t)&&t>=n+2)return e.append(Gg(ag.HardBreak,n,t+1))}return-1},Link:(e,t,n)=>91==t?e.append(new Jg(Zg,n,n+1,1)):-1,Image:(e,t,n)=>33==t&&91==e.char(n+1)?e.append(new Jg(Kg,n,n+2,1)):-1,LinkEnd(e,t,n){if(93!=t)return-1;for(let t=e.parts.length-1;t>=0;t--){let o=e.parts[t];if(o instanceof Jg&&(o.type==Zg||o.type==Kg)){if(!o.side||e.skipSpace(o.to)==n&&!/[(\[]/.test(e.slice(n+1,n+2)))return e.parts[t]=null,-1;let r=e.takeContent(t),i=e.parts[t]=nm(e,r,o.type==Zg?ag.Link:ag.Image,o.from,n+1);if(o.type==Zg)for(let n=0;nt?Gg(ag.URL,t+n,r+n):r==e.length&&null}}function rm(e,t,n){let o=e.charCodeAt(t);if(39!=o&&34!=o&&40!=o)return!1;let r=40==o?41:o;for(let o=t+1,i=!1;o=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,t,n,o,r){return this.append(new Jg(e,t,n,(o?1:0)|(r?2:0)))}addElement(e){return this.append(e)}resolveMarkers(e){for(let t=e;t=e;s--){let e=this.parts[s];if(e instanceof Jg&&1&e.side&&e.type==n.type&&!(r&&(1&n.side||2&e.side)&&(e.to-e.from+i)%3==0&&((e.to-e.from)%3||i%3))){o=e;break}}if(!o)continue;let a=n.type.resolve,l=[],c=o.from,u=n.to;if(r){let e=Math.min(2,o.to-o.from,i);c=o.to-e,u=n.from+e,a=1==e?"Emphasis":"StrongEmphasis"}o.type.mark&&l.push(this.elt(o.type.mark,c,o.to));for(let e=s+1;e=0;t--){let n=this.parts[t];if(n instanceof Jg&&n.type==e)return t}return null}takeContent(e){let t=this.resolveMarkers(e);return this.parts.length=e,t}skipSpace(e){return fg(this.text,e-this.offset)+this.offset}elt(e,t,n,o){return"string"==typeof e?Gg(this.parser.getNodeType(e),t,n,o):new Xg(e,t)}}function am(e,t){if(!t.length)return e;if(!e.length)return t;let n=e.slice(),o=0;for(let e of t){for(;o(e?e-1:0))return!1;if(this.fragmentEnd<0){let e=this.fragment.to;for(;e>0&&"\n"!=this.input.read(e-1,e);)e--;this.fragmentEnd=e?e-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let o=e+this.fragment.offset;for(;n.to<=o;)if(!n.parent())return!1;for(;;){if(n.from>=o)return this.fragment.from<=t;if(!n.childAfter(o))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(On.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,o=this.fragmentEnd-(this.fragment.openEnd?1:0),r=e.absoluteLineStart,i=r,s=e.block.children.length,a=i,l=s;for(;;){if(t.to-n>o){if(t.type.isAnonymous&&t.firstChild())continue;break}let r=um(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,r);else{let n=new Tn(e.parser.nodeSet.types[ag.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(n,t.tree),e.addNode(n,r)}if(t.type.is("Block")&&(lm.indexOf(t.type.id)<0?(i=t.to-n,s=e.block.children.length):(i=a,s=l,a=t.to-n,l=e.block.children.length)),!t.nextSibling())break}for(;e.block.children.length>s;)e.block.children.pop(),e.block.positions.pop();return i-r}}function um(e,t){let n=e;for(let o=1;oTg[e])),Object.keys(Tg).map((e=>Bg[e])),Object.keys(Tg),Dg,hg,Object.keys(tm).map((e=>tm[e])),Object.keys(tm),[]);ar.strikethrough,ar.processingInstruction;ar.heading,ar.content,ar.processingInstruction;function fm(e,t,n){return(o,r,i)=>{if(r!=e||o.char(i+1)==e)return-1;let s=[o.elt(n,i,i+1)];for(let r=i+1;re.charCodeAt(0)))}function Om(e){return e>=48&&e<=57||183===e||e>=768&&e<=879||e>=8255&&e<=8256}function _m(e,t){return t.concat(e.split(/\n/g).join("\n"+t))}function km(e,t=0){const n=e.peek(t);return n===bm&&e.peek(t+1)===bm?{offset:2,token:"**"}:(o=n,xm.includes(o)?{offset:1,token:String.fromCharCode(n)}:null);var o}function Sm(e,t=0,n=!1){for(let r=!1,i=[],s=0;;s++){const a=e.peek(t+s);if(!(63===(o=a)||o>=65&&o<=90||95===o||o>=97&&o<=122||o>=192&&o<=214||o>=216&&o<=246||o>=248&&o<=767||o>=880&&o<=893||o>=895&&o<=8191||o>=8204&&o<=8205||o>=8304&&o<=8591||o>=11264&&o<=12271||o>=12289&&o<=55295||o>=63744&&o<=64975||o>=65008&&o<=65533||o>=55296&&o<=56319||o>=56320&&o<=57343||(r||n)&&Om(a)))return i.length?{token:String.fromCharCode(...i),offset:s}:null;r||(r=!0),i.push(a)}var o}function Em(e,t){for(let o=!1,r=0;;r++){if(n=e.peek(t+r),!ym.includes(n))return o?{token:" ",offset:r}:null;o||(o=!0)}var n}const Cm={121:"identifier",122:"nameIdentifier"},Pm=new xo(((e,t)=>{gm&&console.log("%s: T ",e.pos);const n=function(e,t){const n=t.contextKeys(),o=t.tokens;for(let t=0,r=[],i=null;;){const s=o.length+r.length>0,a=r.length>0,l=Sm(e,t,s)||s&&km(e,t)||a&&Em(e,t);if(!l)return i;const{token:c,offset:u}=l;if(t+=u," "===c)continue;r=[...r,c];const h=[...o,...r].join(" ");if(n.some((e=>e===h))){const e=r[0];i={token:e,offset:e.length,term:122}}if(Dm.some((e=>e===h))){const e=r[0];i={token:e,offset:e.length,term:121}}if(!n.some((e=>e.startsWith(h)))&&!Dm.some((e=>e.startsWith(h))))return i}}(e,t.context),o=t.context.tokens,r=n||Sm(e,0,o.length>0);r&&(e.advance(r.offset),e.acceptToken(n?n.term:121),dm&&console.log("%s: MATCH <%s> <%s>",e.pos,n?Cm[n.term]:"identifier",r.token))}),{contextual:!0}),Am=new xo(((e,t)=>{gm&&console.log("%s: T ",e.pos);const n=Sm(e,0,t.context.tokens.length>0);n&&(e.advance(n.offset),e.acceptToken(120),dm&&console.log("%s: MATCH <%s>",e.pos,n.token))})),Tm=new xo(((e,t)=>{let n;gm&&console.log("%s: T ",e.pos);let o=!1;for(n=0;;n++){const t=e.peek(n);if(!ym.includes(t)){vm.includes(t)&&(o=!0);break}}if(o){const t=Sm(e,n+1);if(Em(e,n+1)||t&&/^(then|else|return|satisfies)$/.test(t.token))return;dm&&console.log("%s: MATCH ",e.pos),e.acceptToken(123)}})),Mm={154:"FunctionInvocation",153:"FilterExpression",152:"PathExpression"},Rm={169:"Context",167:"FunctionDefinition",130:"ForExpression",165:"List",139:"IfExpression",140:"QuantifiedExpression"},jm={96:"Context",89:"FunctionDefinition",4:"ForExpression",88:"List",19:"IfExpression",23:"QuantifiedExpression",67:"PathExpression",71:"FunctionInvocation",69:"FilterExpression",41:"ArithmeticExpression"};class Bm{constructor(e){this.fn=e}get(e){return this.fn(e)}static of(e){return new Bm(e)}}const Dm=Object.keys({"date and time":1,date:1,time:1,duration:1});class Lm{constructor(e={}){this.value=e}getKeys(){return Object.keys(this.value)}get(e){const t=this.value[e];return this.constructor.isAtomic(t)?t:this.constructor.of(t)}set(e,t){return this.constructor.of({...this.value,[e]:t})}static isAtomic(e){return!e||e instanceof this||e instanceof Bm||"object"!=typeof e}static of(...e){const t=e=>e&&"object"==typeof e?e instanceof this?e.value:{...e}:{};return new this(e.reduce(((e,n)=>({...e,...t(n)})),{}))}}class $m{constructor({name:e="Expressions",tokens:t=[],children:n=[],parent:o=null,context:r,value:i,raw:s}={}){this.name=e,this.tokens=t,this.children=n,this.parent=o,this.context=r,this.value=i,this.raw=s}enterScope(e){const t=this.of({name:e,parent:this});return mm&&console.log("[%s] enter",t.path,t.context),t}exitScope(e){return this.parent?(mm&&console.log("[%s] exit %o\n%s",this.path,this.context,_m(e," ")),this.parent.pushChild(this)):(mm&&console.log("[%s] NO exit %o\n%s",this.path,this.context,_m(e," ")),this)}token(e){return mm&&console.log("[%s] token <%s> + <%s>",this.path,this.tokens.join(" "),e),this.assign({tokens:[...this.tokens,e]})}literal(e){return mm&&console.log("[%s] literal %o",this.path,e),this.pushChild(this.of({name:"Literal",value:e}))}computedValue(){for(let e=this;;e=Fm(e.children)){if(!e)return null;if(e.value)return e.value}}contextKeys(){return this.context.getKeys().map(Im)}get path(){return this.parent?.path?.concat(" > ",this.name)||this.name}get(e){const t=[e,e&&Im(e)],n=this.context.getKeys().find((e=>t.includes(Im(e))));if(void 0===n)return;const o=this.context.get(n);return o instanceof Bm?o.get(this):o}resolveName(){const e=this.tokens.join(" "),t=this.assign({tokens:[]}),n=this.of({name:"VariableName",parent:t,value:this.get(e),raw:e});return mm&&console.log("[%s] resolve name <%s=%s>",n.path,e,this.get(e)),t.pushChild(n)}pushChild(e){if(!e)return this;const t=this.assign({children:[...this.children,e]});return e.parent=t,t}pushChildren(e){let t=this;for(const n of e)t=t.pushChild(n);return t}declareName(){if(0===this.tokens.length)throw Error("no tokens to declare name");const e=this.tokens.join(" ");return mm&&console.log("[%s] declareName <%s>",this.path,e),this.assign({tokens:[]}).pushChild(this.of({name:"Name",value:e}))}define(e,t){if("string"!=typeof e)return mm&&console.log("[%s] no define <%s=%s>",this.path,e,t),this;mm&&console.log("[%s] define <%s=%s>",this.path,e,t);const n=this.context.set(e,t);return this.assign({context:n})}assign(e={}){return $m.of({...this,...e})}of(e={}){const t={context:this.context,parent:this.parent};return $m.of({...t,...e})}static of(e){const{name:t,tokens:n=[],children:o=[],parent:r=null,context:i,value:s,raw:a}=e;if(!i)throw new Error("must provide ");return new $m({name:t,tokens:[...n],children:[...o],context:i,parent:r,value:s,raw:a})}}function Im(e){return e.replace(/\s*([./\-'+]|\*\*?)\s*/g," $1 ").replace(/\s{2,}/g," ").trim()}function Nm(e,t,n){const o=e.children.filter((e=>e.name!==t)),r=e.children.filter((e=>e.name===t)),i=o[0],s=o[Math.max(1,o.length-1)],a=i.computedValue(),l=s?.computedValue()||null;return e.assign({children:r}).enterScope(t).pushChildren(o).exitScope(n).define(a,l)}const qm=function(e={},t=Lm){const n=$m.of({context:t.of(e)});return new Ro({start:n,reduce(e,n,o,r){if(19===n){const[n,o]=e.children.slice(-2);e=e.assign({value:t.of(n?.computedValue(),o?.computedValue())})}if(88===n&&(e=e.assign({value:t.of(...e.children.map((e=>e?.computedValue())))})),69===n){const[t,n]=e.children.slice(-2);e=e.assign({value:t?.computedValue()})}if(71===n){const[t,...n]=e.children;"get value"===t?.raw&&(e=function(e,t){if(!t.length)return e.assign({value:null});if("Name"===t[0].name&&(t=function(e,t){const n={};for(let t=0;tn[e]))}(t)),2!==t.length)return e.assign({value:null});const[n,o]=t,r=o?.computedValue(),i=n?.computedValue();return i&&"object"==typeof i&&"string"==typeof r?e.assign({value:[Im(r),r].reduce(((e,t)=>i.get(t)||e),null)}):e.assign({value:null})}(e,n))}const i=Rm[n];if(i)return e.enterScope(i);const s=Mm[n];if(s){const{children:o,context:r}=e,i=o.slice(0,-1),a=Fm(o);let l=null;return 152===n&&(l=t.of(a?.computedValue())),153===n&&(l=t.of(r,a?.computedValue()).set("item",a?.computedValue())),e.assign({children:i}).enterScope(s).pushChild(a).assign({context:l||r})}const a=r.read(r.pos,o.pos);if(jm[n])return e.exitScope(a);if(97===n){const n=e.children.filter((e=>"ContextEntry"!==e.name)),o=n[0],r=Fm(n);return Nm(e,"ContextEntry",a).assign({value:t.of(e.value).set(o.computedValue(),r?.computedValue())})}if(7===n||27===n)return Nm(e,"InExpression",a);if(138===n)return e.define("partial",Bm.of((e=>Fm(e.children)?.computedValue())));if(75===n){const t=Fm(e.children).computedValue();return e.define(t,1)}if(144===n||145===n||146===n){const t=e.children.slice(0,-1),n=Fm(e.children);return e.assign({children:t}).enterScope("ArithmeticExpression").pushChild(n)}if(147===n)return e.enterScope("ArithmeticExpression");if(9===n||10===n||100===n)return e.token(a);if(79===n)return e.literal(a.replace(/^"|"$/g,""));if(80===n)return e.literal("true"===a);if(78===n)return e.literal(parseFloat(a));if(159===n)return e.literal(null);if(47===n)return e.resolveName();if(8===n||99===n)return e.declareName();if((127===n||37===n)&&e.tokens.length>0)throw new Error("uncleared name");if(127===n){let t=e;for(;t.parent;)t=t.exitScope(a);return t}return e}})}({});function Fm(e){return e[e.length-1]}const Qm=qo({StringLiteral:ar.string,NumericLiteral:ar.number,BooleanLiteral:ar.bool,"AtLiteral!":ar.special(ar.string),CompareOp:ar.compareOperator,ArithOp:ar.arithmeticOperator,"for if then else some every satisfies between return":ar.controlKeyword,"in instance of and or":ar.operatorKeyword,function:ar.definitionKeyword,as:ar.keyword,"Type/...":ar.typeName,Wildcard:ar.special,null:ar.null,LineComment:ar.lineComment,BlockComment:ar.blockComment,'VariableName! "?"':ar.variableName,"DateTimeConstructor! SpecialFunctionName!":ar.function(ar.special(ar.variableName)),"List Interval":ar.list,Context:ar.definition(ar.literal),"Name!":ar.definition(ar.variableName),"Key/Name! ContextEntryType/Name!":ar.definition(ar.propertyName),"PathExpression/VariableName!":ar.function(ar.propertyName),"FormalParameter/ParameterName!":ar.function(ar.definition(ar.variableName)),"( )":ar.paren,"[ ]":ar.squareBracket,"{ }":ar.brace,".":ar.derefOperator,", ;":ar.separator,"..":ar.punctuation}),Hm={__proto__:null,for:10,in:32,return:36,if:40,then:42,else:44,some:48,every:50,satisfies:56,or:60,and:64,between:72,instance:86,of:89,days:99,time:101,duration:103,years:105,months:107,date:109,list:115,context:121,function:128,null:154,true:326,false:326,"?":168,external:184,not:209},zm=jo.deserialize({version:14,states:"CpO`QYOOO`QYOOO$gQYOOOOQU'#Ce'#CeO$qQYO'#C`O%zQYO'#FPOOQQ'#Fe'#FeO&UQYO'#FeO`QYO'#DVOOQU'#Em'#EmO'rQ^O'#D]OOQO'#Fl'#FlO)oQWO'#DuOOQQ'#D|'#D|OOQQ'#D}'#D}OOQQ'#EO'#EOO)tOWO'#ERO)oQWO'#EPOOQQ'#EP'#EPOOQQ'#Fr'#FrOOQQ'#Fp'#FpOOQQ'#Fw'#FwOOQQ'#ET'#ETO`QYO'#EVOOQQ'#FR'#FRO)yQ^O'#FRO+pQYO'#EWO+wQWO'#EXOOQP'#F{'#F{O+|QXO'#E`OOQQ'#Fx'#FxOOQQ'#FQ'#FQQOQWOOOOQQ'#FS'#FSOOQQ'#F]'#F]O`QYO'#CoOOQQ'#F^'#F^O$qQYO'#CsO,XQYO'#DvOOQQ'#Fq'#FqO,^QYO'#EQOOQO'#EQ'#EQO`QYO'#EUO`QYO'#ETOOQO'#Fy'#FyQ,fQWOOO,kQYO'#DRO-bQWO'#FaOOQO'#DT'#DTO-mQYO'#FeO-tQWOOO.kQYO'#CdO.xQYO'#FUOOQQ'#Cc'#CcO.}QYO'#FTOOQQ'#Cb'#CbO/VQYO,58zO`QYO,59iOOQQ'#Fb'#FbOOQQ'#Fc'#FcOOQQ'#Fd'#FdO`QYO,59qO`QYO,59qO`QYO,59qOOQQ'#Fj'#FjO$qQYO,5:]OOQQ'#Fk'#FkO`QYO,5:_O`QYO,59eO`QYO,59gO`QYO,59iO0uQYO,59iO0|QYO,59rOOQQ,5:h,5:hO1RQYO,59qOOQU-E8k-E8kO2uQYO'#FmOOQQ,5:a,5:aOOQQ,5:m,5:mOOQQ,5:k,5:kO2|QYO,5:qOOQQ,5;m,5;mO3WQYO,5:pO3eQWO,5:rO3jQYO,5:sOOQP'#Ed'#EdO4aQXO'#EcOOQO'#Eb'#EbO4hQWO'#EaO4mQWO'#F|O4uQWO,5:zO4zQYO,59ZO.xQYO'#F`OOQQ'#Cw'#CwO5RQYO'#F_OOQQ'#Cv'#CvO5ZQYO,59_O5`QYO,5:bO5eQYO,5:lO3PQYO,5:pO5jQYO,5:oO`QYO'#EvQ,fQWOOO`QYO'#ElO6aQWO,5;{O`QYOOOOQR'#Cf'#CfOOQQ'#Ei'#EiO7ZQYO,59OO`QYO,5;pOOQQ'#FX'#FXO$qQYO'#EjO7kQYO,5;oO`QYO1G.fOOQQ'#F['#F[O8bQYO1G/TO;XQYO1G/]O;cQYO1G/]O;mQYO1G/]OOQQ1G/w1G/wO=aQYO1G/yO=hQYO1G/PO>qQYO1G/RO?zQYO1G/TO`QYO1G/TOOQQ1G/T1G/TO@bQYO1G/^O@|Q^O'#CdOB`QYO'#FoOOQO'#Dy'#DyOBjQWO'#DxOBoQWO'#FnOOQO'#Dw'#DwOOQO'#Dz'#DzOBwQWO,5eAN>eO$qQYO'#EnO! VQYO<hP>kP>o?b@T@|ASAV$rA]A]PPPPBU7qB}CvCyDr!mhOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%xR!YSQ!WSR$k#cS!US#cS#Ou$^W#u!n!v$|%TT&R%k&a#WXOPQWYgjsz{!Z!_!`!a!c!e!f!g!h!i#X#Z#]#a#e#p#r#|#}$W$[$]$`$o${%S%V%b%e%j%l%w%x&O&`&d&l&n&o&rb!TSu!v#c$^$|%T%k&aU#_!T#`#sR#s!nU#_!T#`#sT$U!x$VR$j#aR#SuQ#QuR%^$^U!PQ#]#pQ#q!iR$e#ZQpQQ$g#]R$q#pQ$z#rQ%r%SQ&Q%jU&V%l&d&rQ&g&`T&m&l&oc$s#r%S%j%l&`&d&l&o&r!liOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%xQ#k!cU$r#r%S&lS%z%e&n]&P%j%l&`&d&o&rR&U%kQ&S%kR&h&aQ&Y%lR&q&rS&W%l&rR&j&d!mZOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%xR#z!nQ#w!nR%n$|S#v!n$|T$Q!v%T!mcOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%x!lcOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%xQ!p`T!ym$X!maOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%x!mbOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%x!mfOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%x!mnOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%xR$T!vQ$R!vR%s%TQ%v%VR&Z%wQ!{mR%Y$XT!zm$XS!xm$XT$U!x$VRpQS#`!T#sR$h#`Q#d!WR$l#dQ$_#QR%_$_Q#[!PR$f#[!vYOPQWgjsz{!Z!_!`!a!c!e!f!g!h!i!n#X#Z#]#a#e#p#r#|#}$W$[$]$`$o${%S%V%b%e%w%x&lS!mY&O_&O%j%l&`&d&n&o&rQ%f$rS%{%f&^R&^&PQ&b&SR&i&bQ&e&WR&k&eQ$}#wR%o$}S$O!t#tR%R$OQ%U$RR%t%UQ$V!xR%W$VQ$Y!{R%Z$YQ#Y}R$d#YQpOQ}PR$c#XUTOP#XW!OQ!i#Z#]Q!lWQ!rgQ!tjQ!}sQ#VzQ#W{Q#g!ZQ#h!_Q#i!`Q#j!aQ#l!eQ#m!fQ#n!gQ#o!hQ#t!nQ$i#aQ$m#eQ$p#pQ%P#|Q%Q#}Q%X$WQ%[$[Q%]$]Q%`$`Q%c$oQ%m${S%u%V%wQ%y%bR&[%x!moOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%x!mSOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%xR!XST!VS#cQ#a!UR$]#OR#e!Y!msOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%x!muOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%xR#RuT#Pu$^V!QQ#]#p!X!_T!O!r!t!}#V#W#g#l#m#n#o#t$i$m$p%P%Q%X%[%]%`%c%m%u%y&[!Z!`T!O!r!t!}#V#W#g#h#l#m#n#o#t$i$m$p%P%Q%X%[%]%`%c%m%u%y&[!]!aT!O!r!t!}#V#W#g#h#i#l#m#n#o#t$i$m$p%P%Q%X%[%]%`%c%m%u%y&[!mWOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%xR&T%kT&X%l&r!a!cT!O!l!r!t!}#V#W#g#h#i#j#l#m#n#o#t$i$m$p%P%Q%X%[%]%`%c%m%u%y&[!a!eT!O!l!r!t!}#V#W#g#h#i#j#l#m#n#o#t$i$m$p%P%Q%X%[%]%`%c%m%u%y&[!m[OPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%xQ!o[R!qaR#x!nQ!ujR#y!n!mdOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%x!mjOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%x!mkOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%xR$S!v!mmOPQWgjsz{!Z!_!`!a!e!f!g!h!i!n#X#Z#]#a#e#p#|#}$W$[$]$`$o${%V%b%w%xR!|m",nodeNames:"⚠ LineComment BlockComment Expression ForExpression for InExpressions InExpression Name Identifier Identifier ArithOp ArithOp ArithOp ArithOp ArithOp in IterationContext return IfExpression if then else QuantifiedExpression some every InExpressions InExpression satisfies Disjunction or Conjunction and Comparison CompareOp CompareOp between PositiveUnaryTest ( PositiveUnaryTests ) ArithmeticExpression InstanceOfExpression instance of Type QualifiedName VariableName SpecialType days time duration years months date > ListType list < ContextType context ContextEntryTypes ContextEntryType FunctionType function ArgumentTypes ArgumentType PathExpression ] FilterExpression [ FunctionInvocation SpecialFunctionName NamedParameters NamedParameter ParameterName PositionalParameters null NumericLiteral StringLiteral BooleanLiteral DateTimeLiteral DateTimeConstructor AtLiteral ? SimplePositiveUnaryTest Interval ParenthesizedExpression List FunctionDefinition FormalParameters FormalParameter external FunctionBody } { Context ContextEntry Key Name Identifier Expressions UnaryTests Wildcard not",maxTerm:171,context:qm,nodeProps:[["closedBy",38,")",70,"]",95,"}"],["openedBy",40,"(",68,"[",94,"{"],["group",-5,77,78,79,80,81,"Literal"]],propSources:[Qm],skippedNodes:[0,1,2],repeatNodeCount:14,tokenData:"+l~RuXY#fYZ$ZZ[#f]^$Zpq#fqr$`rs$kwx&cxy&hyz&mz{&r{|'P|}'U}!O'Z!O!P'h!P!Q(Q!Q![){![!]*^!]!^*c!^!_*h!_!`$f!`!a*w!b!c+R!}#O+W#P#Q+]#Q#R&z#o#p+b#q#r+g$f$g#f#BY#BZ#f$IS$I_#f$I|$I}$Z$I}$JO$Z$JT$JU#f$KV$KW#f&FU&FV#f?HT?HU#f~#kY#q~XY#fZ[#fpq#f$f$g#f#BY#BZ#f$IS$I_#f$JT$JU#f$KV$KW#f&FU&FV#f?HT?HU#f~$`O#r~~$cP!_!`$f~$kOr~~$pW$h~OY$kZr$krs%Ys#O$k#O#P%_#P;'S$k;'S;=`&]<%lO$k~%_O$h~~%bRO;'S$k;'S;=`%k;=`O$k~%pX$h~OY$kZr$krs%Ys#O$k#O#P%_#P;'S$k;'S;=`&];=`<%l$k<%lO$k~&`P;=`<%l$k~&hO#z~~&mOv~~&rOx~~&wP^~z{&z~'PO_~~'UO[~~'ZO#}~R'`PZP!`!a'cQ'hO$]Q~'mQ#y~!O!P's!Q!['x~'xO#|~~'}P$g~!Q!['x~(VQ]~z{(]!P!Q)d~(`TOz(]z{(o{;'S(];'S;=`)^<%lO(]~(rVOz(]z{(o{!P(]!P!Q)X!Q;'S(];'S;=`)^<%lO(]~)^OQ~~)aP;=`<%l(]~)iSP~OY)dZ;'S)d;'S;=`)u<%lO)d~)xP;=`<%l)d~*QQ$g~!O!P*W!Q![){~*ZP!Q!['x~*cO$Z~~*hO$q~R*oP![QsP!_!`*rP*wOsPR+OP!XQsP!_!`*r~+WO$j~~+]O!h~~+bO!f~~+gO#R~~+lO#Q~",tokenizers:[Am,Pm,Tm,0,1],topRules:{Expression:[0,3],Expressions:[1,101],UnaryTests:[2,102]},dynamicPrecedences:{31:-1,71:-1,73:-1},specialized:[{term:121,get:e=>Hm[e]||-1}],tokenPrec:2500});function Vm(e){const t=[];return e.iterate({enter:e=>{const n=e.node;if(!n.type.isError)return;const o=n.parent,r=Wm(n),i={from:n.from,to:n.to,severity:"error",type:"Syntax Error"};if(n.from!==n.to)i.message=`Unrecognized token in <${o.name}>`;else if(r)i.message=`Unrecognized token <${r.name}> in <${o.name}>`,i.to=r.to;else{const e=o.enterUnfinishedNodesBefore(n.to);i.message=`Incomplete <${(e||o).name}>`}t.push(i)}}),t}function Wm(e){return e?e.nextSibling||Wm(e.parent):null}const Xm=()=>e=>{return 0===e.state.doc.length?[]:(t=Uu(e.state),[...Vm(t)]).map((e=>({...e,source:e.type})));var t},Gm=Ah(Sh.define([{tag:ar.strong,fontWeight:"bold"},{tag:ar.emphasis,fontStyle:"italic"}]));var Um=[Hc.theme({"& .cm-lintRange":{position:"relative"},"& .cm-lintRange::after":{content:'""',width:"100%",position:"absolute",left:"0px",bottom:"-2px",height:"3px",backgroundRepeat:"repeat-x"},"& .cm-lintRange.cm-lintRange-warning, & .cm-lintRange.cm-lintRange-error":{backgroundImage:"none"},"& .cm-lintPoint::after":{bottom:"-2px"}}),Gm];const Ym=e=>`%23${e.slice(1)}`,Zm={black:"#1f2b36",darkGrey:"#2f3d58",grey:"#404a5c",midGrey:"#576071",lightGrey:"#c5d1e5",offWhite:"#d9e0f5",snowWhite:"#eaf1ff",white:"#ffffff",mossGreen:"#7ab6aa",iceBlue:"#6cbfd8",waterBlue:"#065aaa",brightBlue:"#0a56b9",deepBlue:"#355472",red:"#9f1c15",orangeBrown:"#b4502f",yellow:"#debd71",lila:"#9a4890",purple:"#5b2c83"},Km={lightBackground:Zm.white,darkBackground:Zm.snowWhite,selection:Zm.snowWhite,tooltipBackground:Zm.offWhite,error:Zm.red,warning:Zm.yellow,invalid:"#b40000"};var Jm=[Hc.theme({"&":{color:Zm.black,backgroundColor:Km.lightBackground},".cm-content":{caretColor:Zm.darkGrey},".cm-cursor, .cm-dropCursor":{borderLeftColor:Zm.darkGrey},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Km.selection},".cm-panels":{backgroundColor:Km.darkBackground,color:Zm.grey},".cm-panels.cm-panels-top":{borderBottom:`2px solid ${Zm.black}`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid ${Zm.black}`},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:`1px solid ${Zm.midGrey}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:Zm.offWhite},".cm-activeLine":{backgroundColor:Km.selection},".cm-selectionMatch":{backgroundColor:Zm.offWhite},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${Zm.grey}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:Zm.snowWhite},".cm-gutters":{backgroundColor:"#f3f7fe",color:"#52668d",border:"none",padding:"0 5px"},".cm-activeLineGutter":{backgroundColor:Km.selection},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Km.tooltipBackground},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Km.tooltipBackground,borderBottomColor:Km.tooltipBackground},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Km.darkBackground,color:Zm.midGrey}},"& .cm-lintRange.cm-lintRange-warning::after":{backgroundImage:`url("data:image/svg+xml,")`},"& .cm-lintRange.cm-lintRange-error::after":{backgroundImage:`url("data:image/svg+xml,")`},"& .cm-diagnostic-warning":{border:`1px solid ${Km.warning}`,borderLeft:`5px solid ${Km.warning}`,background:Km.lightBackground},"& .cm-diagnostic-error":{border:`1px solid ${Km.error}`,borderLeft:`5px solid ${Km.error}`,background:Km.lightBackground},"& .cm-diagnostic":{padding:"3px 8px"}},{dark:!1}),Ah(Sh.define([{tag:[ar.macroName,ar.variableName],color:Zm.waterBlue},{tag:[ar.special(ar.bracket)],color:Zm.waterBlue,fontWeight:"bold"},{tag:[ar.color,ar.name,ar.definition(ar.name),ar.constant(ar.name),ar.standard(ar.name),ar.propertyName],color:Zm.deepBlue},{tag:[ar.definition(ar.variableName),ar.function(ar.variableName),ar.function(ar.propertyName)],color:Zm.brightBlue},{tag:[ar.labelName],color:Zm.orangeBrown},{tag:[ar.annotation],color:Km.invalid},{tag:[ar.number,ar.changed,ar.annotation,ar.modifier,ar.self,ar.namespace,ar.atom,ar.bool,ar.special(ar.variableName)],color:Zm.red},{tag:[ar.typeName,ar.className,ar.attributeName],color:Zm.lila},{tag:[ar.operator,ar.operatorKeyword,ar.tagName,ar.keyword],color:Zm.purple},{tag:[ar.angleBracket,ar.squareBracket,ar.brace,ar.separator,ar.punctuation],color:Zm.midGrey},{tag:[ar.regexp],color:Zm.deepBlue},{tag:[ar.quote],color:Zm.darkGrey},{tag:[ar.string,ar.character,ar.deleted],color:Zm.orangeBrown},{tag:ar.link,color:Zm.mossGreen,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[ar.url,ar.escape,ar.special(ar.string)],color:Zm.red},{tag:[ar.meta],color:Zm.iceBlue},{tag:[ar.comment],color:Zm.midGrey,fontStyle:"italic"},{tag:ar.strong,fontWeight:"bold",color:Zm.deepBlue},{tag:ar.emphasis,fontStyle:"italic",color:Zm.deepBlue},{tag:ar.strikethrough,textDecoration:"line-through"},{tag:ar.heading,fontWeight:"bold",color:Zm.midGray},{tag:ar.special(ar.heading1),fontWeight:"bold",color:Zm.darkGrey},{tag:[ar.heading1,ar.heading2,ar.heading3,ar.heading4],fontWeight:"bold",color:Zm.midGrey},{tag:[ar.heading5,ar.heading6,ar.processingInstruction,ar.inserted],color:Zm.grey},{tag:[ar.contentSeparator],color:Zm.yellow},{tag:ar.invalid,color:Zm.midGrey,borderBottom:`1px dotted ${Km.invalid}`}]))];const ey="#f07178",ty="#fffce1",ny="#ec9e6f",oy="rgba(0, 0, 0, 0.5)",ry="#353a42",iy="#ffcc00",sy="fff890";var ay=[Hc.theme({"&":{color:"#ffffff",backgroundColor:"#292d3e"},".cm-content":{caretColor:iy},"&.cm-focused .cm-cursor":{borderLeftColor:iy},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"rgba(128, 203, 196, 0.2)"},".cm-panels":{backgroundColor:"#21252b",color:"#ffffff"},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:oy},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847",outline:"1px solid #515a6b"},".cm-gutters":{background:"#292d3e",color:"#676e95",border:"none",padding:"0 5px"},".cm-activeLineGutter":{backgroundColor:oy},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:ry},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:ry,borderBottomColor:ry},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:oy,color:"#abb2bf"}},"& .cm-lintRange.cm-lintRange-warning::after":{backgroundImage:`url("data:image/svg+xml,")`},"& .cm-lintRange.cm-lintRange-error::after":{backgroundImage:"url(\"data:image/svg+xml,\")"},"& .cm-diagnostic-warning":{borderLeft:`5px solid #${sy}`,background:"#281e16"},"& .cm-diagnostic-error":{borderLeft:"5px solid red",background:"#281616"},"& .cm-diagnostic":{borderRadius:"2px",padding:"3px 8px"}},{dark:!0}),Ah(Sh.define([{tag:ar.heading1,color:ty},{tag:ar.heading2,color:ty},{tag:ar.heading3,color:ty},{tag:ar.heading4,color:ty},{tag:ar.heading5,color:ty},{tag:ar.heading6,color:ty},{tag:ar.special(ar.bracket),color:ny,fontWeight:"bold"},{tag:ar.keyword,color:"#c792ea"},{tag:ar.operator,color:"#89ddff"},{tag:ar.special(ar.variableName),color:"#eeffff"},{tag:ar.typeName,color:"#f07178"},{tag:ar.atom,color:"#f78c6c"},{tag:ar.number,color:"#ff5370"},{tag:ar.bool,color:"#ff5370"},{tag:ar.definition(ar.variableName),color:"#82aaff"},{tag:ar.string,color:"#c3e88d"},{tag:ar.comment,color:"#7d8799"},{tag:ar.tagName,color:"#ff5370"},{tag:ar.bracket,color:"#a2a1a4"},{tag:ar.meta,color:"#ffcb6b"},{tag:ar.special(ar.string),color:ey},{tag:ar.propertyName,color:ny},{tag:ar.variableName,color:ny},{tag:ar.attributeName,color:ey},{tag:ar.className,color:ey},{tag:ar.invalid,color:"#ffffff"}]))];const ly=[...Um,...Jm],cy=[...Um,...ay],uy=(e,t=0)=>{const n=125===e.peek(t),o=125===e.peek(t+1);return n&&o||-1===e.peek(t)},hy=new xo(((e,t)=>{let n=0;for(;!uy(e,n);)n++;n>0&&(e.advance(n),e.acceptToken(2))})),py=(e,t=0)=>{const n=123===e.peek(t),o=123===e.peek(t+1);return n&&o||-1===e.peek(t)},fy=new xo(((e,t)=>{let n=0;for(;!py(e,n);)n++;n>0&&(e.advance(n),e.acceptToken(3))})),dy=new xo(((e,t)=>{let n=0;for(;-1!==e.peek(n);)n++;n>0&&(e.advance(n),e.acceptToken(1))})),gy=qo({ConditionalSpanner:ar.special(ar.bracket),ConditionalSpannerClose:ar.special(ar.bracket),ConditionalSpannerCloseNl:ar.special(ar.bracket),LoopSpanner:ar.special(ar.bracket),LoopSpannerClose:ar.special(ar.bracket),LoopSpannerCloseNl:ar.special(ar.bracket),EmptyInsert:ar.special(ar.bracket),Insert:ar.special(ar.bracket)}),my=jo.deserialize({version:14,states:"$bOQOaOOOfOXO'#CbOOO`'#Cm'#CmOqOWO'#CcOvOWO'#CfOOO`'#Cp'#CpOOO`'#Ci'#CiO{OaO'#ClO!jOSOOQOOOOOO!oOPO,58{O!tOXO,58|OOO`,58|,58|O!|OQO,58}O#ROQO,59QOOO`-E6g-E6gOOO`1G.g1G.gO#WOPO1G.gOOO`1G.h1G.hO#]OaO1G.iO#qOaO1G.lOOO`7+$R7+$RO$VOPO7+$TO$_OPO7+$WOOO`<{"EmptyInsert"===e.type.name&&t.push({from:e.from,to:e.to,severity:"warning",message:"this insert is empty and will be ignored",type:"emptyInsert"})}}),t}var by=Zd(function(){const e=Xm();return t=>{const n=e(t);return 0===t.state.doc.length?[]:[...n,...(o=Uu(t.state),[...vy(o)]).map((e=>({...e,source:"feelers linter"})))];var o}}());function xy({container:e,tooltipContainer:t,hostLanguage:n,hostLanguageParser:o,onChange:r=(()=>{}),onKeyDown:i=(()=>{}),onLint:s=(()=>{}),contentAttributes:a={},readOnly:l=!1,value:c="",enableGutters:u=!1,singleLine:h=!1,darkMode:p=!1}){const f=Hc.updateListener.of((e=>{e.docChanged&&r(e.state.doc.toString())})),d=Hc.updateListener.of((e=>{const t=e.transactions.flatMap((e=>e.effects)).filter((e=>e.is(Fd)));if(!t.length)return;const n=t.flatMap((e=>e.value));s(n)})),g=Hc.contentAttributes.of(a),m=Hc.domEventHandlers({keydown:i});"string"==typeof t&&(t=document.querySelector(t));const y=t?ru({tooltipSpace:function(){return t.getBoundingClientRect()}}):[],v=(e=>new ih(function(e=null){const t=my.configure({wrap:(n=t=>"Feel"==t.name||"FeelBlock"==t.name?{parser:zm}:e&&"SimpleTextBlock"==t.name?{parser:e}:null,(e,t,o,r)=>new to(e,n,t,o,r)),props:[_h.add(yy)]});var n;return Gu.define({parser:t})}(e),[]))(o||n&&(e=>"markdown"===e?pm:null)(n)),b=[Fh(),f,g,of(),Oh(),m,Zc.of([...Bd]),v,by,d,y,p?cy:ly,...u?[Fu()]:[],...h?[Ci.transactionFilter.of((e=>e.newDoc.lines>1?[]:e))]:[]];return l&&b.push(Hc.editable.of(!1)),h&&c&&(c=c.toString().split("\n")[0]),this._cmEditor=new Hc({state:Ci.create({doc:c,extensions:b}),parent:e}),this}xy.prototype.setValue=function(e){this._cmEditor.dispatch({changes:{from:0,to:this._cmEditor.state.doc.length,insert:e}})},xy.prototype.focus=function(e){const t=this._cmEditor;if(t.contentDOM.focus(),t.focus(),"number"==typeof e){const n=t.state.doc.length;t.dispatch({selection:{anchor:e<=n?e:n}})}},xy.prototype.getSelection=function(){return this._cmEditor.state.selection};const wy=[Zp("function(${params}) ${body}",{label:"function",detail:"definition",type:"keyword"}),Zp("for ${var} in ${collection} return ${value}",{label:"for",detail:"expression",type:"keyword"}),Zp("every ${var} in ${collection} satisfies ${condition}",{label:"every",detail:"quantified expression",type:"keyword"}),Zp("some ${var} in ${collection} satisfies ${condition}",{label:"some",detail:"quantified expression",type:"keyword"}),Zp("if ${condition} then ${value} else ${other value}",{label:"if",detail:"block",type:"keyword"}),Zp("{ ${key}: ${value} }",{label:"context",detail:"block",type:"keyword"})];function Oy(e){const{context:t,after:n,before:o,keyword:r}=e;return function(e,t){const{nodes:n,before:o,after:r,keyword:i}=e;return e=>{const{state:s,pos:a}=e,l=function(e,t){for(Array.isArray(t)||(t=[t]);e;e=e.parent){if(t.includes(e.name))return e;if(e.type.isTop)break}return null}(Uu(s).resolveInner(a,-1),n);return l?ky(l,a,[i,o])||function(e,t,n){return Sy(e,t,n,1)}(l,a,[i,r])||r&&!ky(l,a,[r])?null:t(e):null}}({nodes:t,before:o,after:n,keyword:r},np([{label:r,type:"keyword",boost:10}]))}const _y=[Oy({context:"InExpression",keyword:"in"}),Oy({context:"IfExpression",keyword:"then",after:"if",before:"else"}),Oy({context:"IfExpression",keyword:"else",after:"then"}),Oy({context:"QuantifiedExpression",keyword:"satisfies"}),Oy({context:"ForExpression",after:"InExpressions",keyword:"return"})];function ky(e,t,n){return Sy(e,t,n,-1)}function Sy(e,t,n,o){let r=e[o>0?"childAfter":"childBefore"](t);for(;r;){if(n.includes(r.name))return r;if(r.type.isError&&r.firstChild&&n.includes(r.firstChild.name))return r.firstChild;r=r[o>0?"nextSibling":"prevSibling"]}return null}const Ey=Gu.define({parser:zm.configure({props:[ph.add({Context:vh({closing:"}"}),"List FilterExpression":vh({closing:"]"}),"ParenthesizedExpression FunctionInvocation":xh({except:/^\s*\)/}),"ForExpression QuantifiedExpression IfExpression":xh({except:/^\s*(then|else|return|satisfies)\b/}),FunctionDefinition:xh({except:/^\s*(\(|\))/})}),_h.add({Context:kh,List:kh,ParenthesizedExpression:kh,FunctionDefinition(e){const t=e.getChild(")");return t?{from:t.to,to:e.to}:null}})]}),languageData:{indentOnInput:/^\s*(\)|\}|\]|then|else|return|satisfies)$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}}}});function Cy(e){return e.from===e.to}function Py(e){return!!e&&("PathExpression"===e.name||Py(e.parent))}Ey.configure({top:"UnaryTests"}),Ey.configure({top:"Expression"});const Ay=[{name:"not(negand)",description:'

Returns the logical negation of the given value.

\n

Function signature

\n
not(negand: boolean): boolean\n
\n

Examples

\n
not(true)\n// false\n\nnot(null)\n// null\n
\n'},{name:"is defined(value)",description:'

Camunda Extension

\n

Checks if a given value is not null. If the value is null then the function returns false.\nOtherwise, the function returns true.

\n

Function signature

\n
is defined(value: Any): boolean\n
\n

Examples

\n
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
\n

:::caution Breaking change

\n

This function worked differently in previous versions. It returned true if the value was null.\nSince this version, the function returns false if the value is null.

\n

:::

\n'},{name:"get or else(value, default)",description:'

Camunda Extension

\n

Return the provided value parameter if not null, otherwise return the default parameter

\n

Function signature

\n
get or else(value: Any, default: Any): Any\n
\n

Examples

\n
get or else("this", "default")\n// "this"\n\nget or else(null, "default")\n// "default"\n\nget or else(null, null)\n// null\n
\n'},{name:"assert(value, condition)",description:'

Camunda Extension

\n

Verify that the given condition is met. If the condition is true, the function returns the value.\nOtherwise, the evaluation fails with an error.

\n

Function signature

\n
assert(value: Any, condition: Any)\n
\n

Examples

\n
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
\n'},{name:"assert(value, condition, cause)",description:'

Camunda Extension

\n

Verify that the given condition is met. If the condition is true, the function returns the value.\nOtherwise, the evaluation fails with an error containing the given message.

\n

Function signature

\n
assert(value: Any, condition: Any, cause: String)\n
\n

Examples

\n
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
\n'},{name:"get value(context, key)",description:'

Returns the value of the context entry with the given key.

\n

Function signature

\n
get value(context: context, key: string): Any\n
\n

Examples

\n
get value({foo: 123}, "foo")\n// 123\n\nget value({a: 1}, "b")\n// null\n
\n'},{name:"get value(context, keys)",description:'

Camunda Extension

\n

Returns the value of the context entry for a context path defined by the given keys.

\n

If keys contains the keys [k1, k2] then it returns the value at the nested entry k1.k2 of the context.

\n

If keys are empty or the nested entry defined by the keys doesn't exist in the context, it returns null.

\n

Function signature

\n
get value(context: context, keys: list<string>): Any\n
\n

Examples

\n
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
\n'},{name:"get entries(context)",description:'

Returns the entries of the context as a list of key-value-pairs.

\n

Function signature

\n
get entries(context: context): list<context>\n
\n

The return value is a list of contexts. Each context contains two entries for "key" and "value".

\n

Examples

\n
get entries({foo: 123})\n// [{key: "foo", value: 123}]\n
\n'},{name:"context put(context, key, value)",description:'

Adds a new entry with the given key and value to the context. Returns a new context that includes the entry.

\n

If an entry for the same key already exists in the context, it overrides the value.

\n

Function signature

\n
context put(context: context, key: string, value: Any): context\n
\n

Examples

\n
context put({x:1}, "y", 2)\n// {x:1, y:2}\n
\n

:::info\nThe function context put() replaced the previous function put() (Camunda Extension). The\nprevious function is deprecated and should not be used anymore.\n:::

\n'},{name:"context put(context, keys, value)",description:'

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.

\n

If keys contains the keys [k1, k2] then it adds the nested entry k1.k2 = value to the context.

\n

If an entry for the same keys already exists in the context, it overrides the value.

\n

If keys are empty, it returns null.

\n

Function signature

\n
context put(context: context, keys: list<string>, value: Any): context\n
\n

Examples

\n
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
\n'},{name:"context merge(contexts)",description:'

Union the given contexts. Returns a new context that includes all entries of the given contexts.

\n

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.

\n

Function signature

\n
context merge(contexts: list<context>): context\n
\n

Examples

\n
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
\n

:::info\nThe function context merge() replaced the previous function put all() (Camunda Extension). The\nprevious function is deprecated and should not be used anymore.\n:::

\n'},{name:"string(from)",description:'

Returns the given value as a string representation.

\n

Function signature

\n
string(from: Any): string\n
\n

Examples

\n
string(1.1)\n// "1.1"\n\nstring(date("2012-12-25"))\n// "2012-12-25"\n
\n'},{name:"number(from)",description:'

Parses the given string to a number.

\n

Function signature

\n
number(from: string): number\n
\n

Examples

\n
number("1500.5")\n// 1500.5\n
\n'},{name:"context(entries)",description:'

Constructs a context of the given list of key-value pairs. It is the reverse function to get entries().

\n

Each key-value pair must be a context with two entries: key and value. The entry with name key must have a value of the type string.

\n

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.

\n

Returns null if one of the entries is not a context or if a context doesn't contain the required entries.

\n

Function signature

\n
context(entries: list<context>): context\n
\n

Examples

\n
context([{"key":"a", "value":1}, {"key":"b", "value":2}])\n// {a:1, b:2}\n
\n'},{name:"date(from)",description:'

Returns a date from the given value.

\n

Function signature

\n
date(from: string): date\n
\n

Parses the given string into a date.

\n
date(from: date and time): date\n
\n

Extracts the date component from the given date and time.

\n

Examples

\n
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
\n'},{name:"date(year, month, day)",description:'

Returns a date from the given components.

\n

Function signature

\n
date(year: number, month: number, day: number): date\n
\n

Examples

\n
date(2012, 12, 25)\n// date("2012-12-25")\n
\n'},{name:"time(from)",description:'

Returns a time from the given value.

\n

Function signature

\n
time(from: string): time\n
\n

Parses the given string into a time.

\n
time(from: date and time): time\n
\n

Extracts the time component from the given date and time.

\n

Examples

\n
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
\n'},{name:"time(hour, minute, second)",description:'

Returns a time from the given components.

\n

Function signature

\n
time(hour: number, minute: number, second: number): time\n
\n

Examples

\n
time(23, 59, 0)\n// time("23:59:00")\n
\n'},{name:"time(hour, minute, second, offset)",description:'

Returns a time from the given components, including a timezone offset.

\n

Function signature

\n
time(hour: number, minute: number, second: number, offset: days and time duration): time\n
\n

Examples

\n
time(14, 30, 0, duration("PT1H"))\n// time("14:30:00+01:00")\n
\n'},{name:"date and time(from)",description:'

Parses the given string into a date and time.

\n

Function signature

\n
date and time(from: string): date and time\n
\n

Examples

\n
date and time("2018-04-29T009:30:00")\n// date and time("2018-04-29T009:30:00")\n
\n'},{name:"date and time(date, time)",description:'

Returns a date and time from the given components.

\n

Function signature

\n
date and time(date: date, time: time): date and time\n
\n
date and time(date: date and time, time: time): date and time\n
\n

Returns a date and time value that consists of the date component of date combined with time.

\n

Examples

\n
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
\n'},{name:"date and time(date, timezone)",description:'

Camunda Extension

\n

Returns the given date and time value at the given timezone.

\n

If date has a different timezone than timezone then it adjusts the time to match the local time of timezone.

\n

Function signature

\n
date and time(date: date and time, timezone: string): date and time\n
\n

Examples

\n
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
\n'},{name:"duration(from)",description:'

Parses the given string into a duration. The duration is either a days and time duration or a years and months duration.

\n

Function signature

\n
duration(from: string): days and time duration\n
\n
duration(from: string): years and months duration\n
\n

Examples

\n
duration("P5D")\n// duration("P5D")\n\nduration("P32Y")\n// duration("P32Y")\n
\n'},{name:"years and months duration(from, to)",description:'

Returns the years and months duration between from and to.

\n

Function signature

\n
years and months duration(from: date, to: date): years and months duration\n
\n

Examples

\n
years and months duration(date("2011-12-22"), date("2013-08-24"))\n// duration("P1Y8M")\n
\n'},{name:"list contains(list, element)",description:'

Returns true if the given list contains the element. Otherwise, returns false.

\n

Function signature

\n
list contains(list: list, element: Any): boolean\n
\n

Examples

\n
list contains([1,2,3], 2)\n// true\n
\n'},{name:"count(list)",description:'

Returns the number of elements of the given list.

\n

Function signature

\n
count(list: list): number\n
\n

Examples

\n
count([1,2,3])\n// 3\n
\n'},{name:"min(list)",description:'

Returns the minimum of the given list.

\n

Function signature

\n
min(list: list): Any\n
\n

All elements in list should have the same type and be comparable.

\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
min([1,2,3])\n// 1\n\nmin(1,2,3)\n// 1\n
\n'},{name:"max(list)",description:'

Returns the maximum of the given list.

\n

Function signature

\n
max(list: list): Any\n
\n

All elements in list should have the same type and be comparable.

\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
max([1,2,3])\n// 3\n\nmax(1,2,3)\n// 3\n
\n'},{name:"sum(list)",description:'

Returns the sum of the given list of numbers.

\n

Function signature

\n
sum(list: list<number>): number\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
sum([1,2,3])\n// 6\n\nsum(1,2,3)\n// 6\n
\n'},{name:"product(list)",description:'

Returns the product of the given list of numbers.

\n

Function signature

\n
product(list: list<number>): number\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
product([2, 3, 4])\n// 24\n\nproduct(2, 3, 4)\n// 24\n
\n'},{name:"mean(list)",description:'

Returns the arithmetic mean (i.e. average) of the given list of numbers.

\n

Function signature

\n
mean(list: list<number>): number\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
mean([1,2,3])\n// 2\n\nmean(1,2,3)\n// 2\n
\n'},{name:"median(list)",description:'

Returns the median element of the given list of numbers.

\n

Function signature

\n
median(list: list<number>): number\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
median(8, 2, 5, 3, 4)\n// 4\n\nmedian([6, 1, 2, 3])\n// 2.5\n
\n'},{name:"stddev(list)",description:'

Returns the standard deviation of the given list of numbers.

\n

Function signature

\n
stddev(list: list<number>): number\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
stddev(2, 4, 7, 5)\n// 2.0816659994661326\n\nstddev([2, 4, 7, 5])\n// 2.0816659994661326\n
\n'},{name:"mode(list)",description:'

Returns the mode of the given list of numbers.

\n

Function signature

\n
mode(list: list<number>): number\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
mode(6, 3, 9, 6, 6)\n// [6]\n\nmode([6, 1, 9, 6, 1])\n// [1, 6]\n
\n'},{name:"all(list)",description:'

Returns false if any element of the given list is false. Otherwise, returns true.

\n

If the given list is empty, it returns true.

\n

Function signature

\n
all(list: list<boolean>): boolean\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
all([true,false])\n// false\n\nall(false,null,true)\n// false\n
\n

:::info\nThe function all() replaced the previous function and(). The previous function is deprecated and\nshould not be used anymore.\n:::

\n'},{name:"any(list)",description:'

Returns true if any element of the given list is true. Otherwise, returns false.

\n

If the given list is empty, it returns false.

\n

Function signature

\n
any(list: list<boolean>): boolean\n
\n

The parameter list can be passed as a list or as a sequence of elements.

\n

Examples

\n
any([false,true])\n// true\n\nany(false,null,true)\n// true\n
\n

:::info\nThe function any() replaced the previous function or(). The previous function is deprecated and\nshould not be used anymore.\n:::

\n'},{name:"sublist(list, start position)",description:'

Returns a partial list of the given value starting at start position.

\n

Function signature

\n
sublist(list: list, start position: number): list\n
\n

The start position starts at the index 1. The last position is -1.

\n

Examples

\n
sublist([1,2,3], 2)\n// [2,3]\n
\n'},{name:"sublist(list, start position, length)",description:'

Returns a partial list of the given value starting at start position.

\n

Function signature

\n
sublist(list: list, start position: number, length: number): list\n
\n

The start position starts at the index 1. The last position is -1.

\n

Examples

\n
sublist([1,2,3], 1, 2)\n// [1,2]\n
\n'},{name:"append(list, items)",description:'

Returns the given list with all items appended.

\n

Function signature

\n
append(list: list, items: Any): list\n
\n

The parameter items can be a single element or a sequence of elements.

\n

Examples

\n
append([1], 2, 3)\n// [1,2,3]\n
\n'},{name:"concatenate(lists)",description:'

Returns a list that includes all elements of the given lists.

\n

Function signature

\n
concatenate(lists: list): list\n
\n

The parameter lists is a sequence of lists.

\n

Examples

\n
concatenate([1,2],[3])\n// [1,2,3]\n\nconcatenate([1],[2],[3])\n// [1,2,3]\n
\n'},{name:"insert before(list, position, newItem)",description:'

Returns the given list with newItem inserted at position.

\n

Function signature

\n
insert before(list: list, position: number, newItem: Any): list\n
\n

The position starts at the index 1. The last position is -1.

\n

Examples

\n
insert before([1,3],1,2)\n// [2,1,3]\n
\n'},{name:"remove(list, position)",description:'

Returns the given list without the element at position.

\n

Function signature

\n
remove(list: list, position: number): list\n
\n

The position starts at the index 1. The last position is -1.

\n

Examples

\n
remove([1,2,3], 2)\n// [1,3]\n
\n'},{name:"reverse(list)",description:'

Returns the given list in revered order.

\n

Function signature

\n
reverse(list: list): list\n
\n

Examples

\n
reverse([1,2,3])\n// [3,2,1]\n
\n'},{name:"index of(list, match)",description:'

Returns an ascending list of positions containing match.

\n

Function signature

\n
index of(list: list, match: Any): list<number>\n
\n

Examples

\n
index of([1,2,3,2],2)\n// [2,4]\n
\n'},{name:"union(list)",description:'

Returns a list that includes all elements of the given lists without duplicates.

\n

Function signature

\n
union(list: list): list\n
\n

The parameter list is a sequence of lists.

\n

Examples

\n
union([1,2],[2,3])\n// [1,2,3]\n
\n'},{name:"distinct values(list)",description:'

Returns the given list without duplicates.

\n

Function signature

\n
distinct values(list: list): list\n
\n

Examples

\n
distinct values([1,2,3,2,1])\n// [1,2,3]\n
\n'},{name:"duplicate values(list)",description:'

Camunda Extension

\n

Returns all duplicate values of the given list.

\n

Function signature

\n
duplicate values(list: list): list\n
\n

Examples

\n
duplicate values([1,2,3,2,1])\n// [1,2]\n
\n'},{name:"flatten(list)",description:'

Returns a list that includes all elements of the given list without nested lists.

\n

Function signature

\n
flatten(list: list): list\n
\n

Examples

\n
flatten([[1,2],[[3]], 4])\n// [1,2,3,4]\n
\n'},{name:"sort(list, precedes)",description:'

Returns the given list sorted by the precedes function.

\n

Function signature

\n
sort(list: list, precedes: function<(Any, Any) -> boolean>): list\n
\n

Examples

\n
sort(list: [3,1,4,5,2], precedes: function(x,y) x < y)\n// [1,2,3,4,5]\n
\n'},{name:"string join(list)",description:'

Joins a list of strings into a single string. This is similar to\nJava's joining\nfunction.

\n

If an item of the list is null, the item is ignored for the result string. If an item is\nneither a string nor null, the function returns null instead of a string.

\n

Function signature

\n
string join(list: list<string>): string\n
\n

Examples

\n
string join(["a","b","c"])\n// "abc"\n\nstring join(["a",null,"c"])\n// "ac"\n\nstring join([])\n// ""\n
\n'},{name:"string join(list, delimiter)",description:'

Joins a list of strings into a single string. This is similar to\nJava's joining\nfunction.

\n

If an item of the list is null, the item is ignored for the result string. If an item is\nneither a string nor null, the function returns null instead of a string.

\n

The resulting string contains a delimiter between each element.

\n

Function signature

\n
string join(list: list<string>, delimiter: string): string\n
\n

Examples

\n
string join(["a"], "X")\n// "a"\n\nstring join(["a","b","c"], ", ")\n// "a, b, c"\n
\n'},{name:"string join(list, delimiter, prefix, suffix)",description:'

Camunda Extension

\n

Joins a list of strings into a single string. This is similar to\nJava's joining\nfunction.

\n

If an item of the list is null, the item is ignored for the result string. If an item is\nneither a string nor null, the function returns null instead of a string.

\n

The resulting string starts with prefix, contains a delimiter between each element, and ends\nwith suffix.

\n

Function signature

\n
string join(list: list<string>, delimiter: string, prefix: string, suffix: string): string\n
\n

Examples

\n
string join(["a","b","c"], ", ", "[", "]")\n// "[a, b, c]"\n
\n'},{name:"decimal(n, scale)",description:'

Rounds the given value at the given scale.

\n

Function signature

\n
decimal(n: number, scale: number): number\n
\n

Examples

\n
decimal(1/3, 2)\n// .33\n\ndecimal(1.5, 0)\n// 2\n
\n'},{name:"floor(n)",description:'

Rounds the given value with rounding mode flooring.

\n

Function signature

\n
floor(n: number): number\n
\n

Examples

\n
floor(1.5)\n// 1\n\nfloor(-1.5)\n// -2\n
\n'},{name:"floor(n, scale)",description:'

Rounds the given value with rounding mode flooring at the given scale.

\n

Function signature

\n
floor(n: number, scale: number): number\n
\n

Examples

\n
floor(-1.56, 1)\n// -1.6\n
\n'},{name:"ceiling(n)",description:'

Rounds the given value with rounding mode ceiling.

\n

Function signature

\n
ceiling(n: number): number\n
\n

Examples

\n
ceiling(1.5)\n// 2\n\nceiling(-1.5)\n// -1\n
\n'},{name:"ceiling(n, scale)",description:'

Rounds the given value with rounding mode ceiling at the given scale.

\n

Function signature

\n
ceiling(n: number, scale: number): number\n
\n

Examples

\n
ceiling(-1.56, 1)\n// -1.5\n
\n'},{name:"round up(n, scale)",description:'

Rounds the given value with the rounding mode round-up at the given scale.

\n

Function signature

\n
round up(n: number, scale: number): number\n
\n

Examples

\n
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
\n'},{name:"round down(n, scale)",description:'

Rounds the given value with the rounding mode round-down at the given scale.

\n

Function signature

\n
round down(n: number, scale: number): number\n
\n

Examples

\n
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
\n'},{name:"round half up(n, scale)",description:'

Rounds the given value with the rounding mode round-half-up at the given scale.

\n

Function signature

\n
round half up(n: number, scale: number): number\n
\n

Examples

\n
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
\n'},{name:"round half down(n, scale)",description:'

Rounds the given value with the rounding mode round-half-down at the given scale.

\n

Function signature

\n
round half down(n: number, scale: number): number\n
\n

Examples

\n
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
\n'},{name:"abs(number)",description:'

Returns the absolute value of the given numeric value.

\n

Function signature

\n
abs(number: number): number\n
\n

Examples

\n
abs(10)\n// 10\n\nabs(-10)\n// 10\n
\n'},{name:"modulo(dividend, divisor)",description:'

Returns the remainder of the division of dividend by divisor.

\n

Function signature

\n
modulo(dividend: number, divisor: number): number\n
\n

Examples

\n
modulo(12, 5)\n// 2\n
\n'},{name:"sqrt(number)",description:'

Returns the square root of the given value.

\n

Function signature

\n
sqrt(number: number): number\n
\n

Examples

\n
sqrt(16)\n// 4\n
\n'},{name:"log(number)",description:'

Returns the natural logarithm (base e) of the given value.

\n

Function signature

\n
log(number: number): number\n
\n

Examples

\n
log(10)\n// 2.302585092994046\n
\n'},{name:"exp(number)",description:'

Returns the Euler’s number e raised to the power of the given number .

\n

Function signature

\n
exp(number: number): number\n
\n

Examples

\n
exp(5)\n// 148.4131591025766\n
\n'},{name:"odd(number)",description:'

Returns true if the given value is odd. Otherwise, returns false.

\n

Function signature

\n
odd(number: number): boolean\n
\n

Examples

\n
odd(5)\n// true\n\nodd(2)\n// false\n
\n'},{name:"even(number)",description:'

Returns true if the given is even. Otherwise, returns false.

\n

Function signature

\n
even(number: number): boolean\n
\n

Examples

\n
even(5)\n// false\n\neven(2)\n// true\n
\n'},{name:"random number()",description:'

Camunda Extension

\n

Returns a random number between 0 and 1.

\n

Function signature

\n
random number(): number\n
\n

Examples

\n
random number()\n// 0.9701618132579795\n
\n'},{name:"before(point1, point2)",description:'

Function signature

\n
before(point1: Any, point2: Any): boolean\n
\n

Examples

\n
before(1, 10)\n// true\n\nbefore(10, 1)\n// false\n
\n'},{name:"before(range, point)",description:'

Function signature

\n
before(range: range, point: Any): boolean\n
\n

Examples

\n
before([1..5], 10)\n// true\n
\n'},{name:"before(point, range)",description:'

Function signature

\n
before(point: Any, range: range): boolean\n
\n

Examples

\n
before(1, [2..5])\n// true\n
\n'},{name:"before(range1, range2)",description:'

Function signature

\n
before(range1: range, range2: range): boolean\n
\n

Examples

\n
before([1..5], [6..10])\n// true\n\nbefore([1..5),[5..10])\n// true\n
\n'},{name:"after(point1, point2)",description:'

Function signature

\n
after(point1: Any, point2: Any): boolean\n
\n

Examples

\n
after(10, 1)\n// true\n\nafter(1, 10)\n// false\n
\n'},{name:"after(range, point)",description:'

Function signature

\n
after(range: range, point: Any): boolean\n
\n

Examples

\n
after([1..5], 10)\n// false\n
\n'},{name:"after(point, range)",description:'

Function signature

\n
after(point: Any, range: range): boolean\n
\n

Examples

\n
after(12, [2..5])\n// true\n
\n'},{name:"after(range1, range2)",description:'

Function signature

\n
after(range1: range, range2: range): boolean\n
\n

Examples

\n
after([6..10], [1..5])\n// true\n\nafter([5..10], [1..5))\n// true\n
\n'},{name:"meets(range1, range2)",description:'

Function signature

\n
meets(range1: range, range2: range): boolean\n
\n

Examples

\n
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
\n'},{name:"met by(range1, range2)",description:'

Function signature

\n
met by(range1: range, range2: range): boolean\n
\n

Examples

\n
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
\n'},{name:"overlaps(range1, range2)",description:'

Function signature

\n
overlaps(range1: range, range2: range): boolean\n
\n

Examples

\n
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
\n'},{name:"overlaps before(range1, range2)",description:'

Function signature

\n
overlaps before(range1: range, range2: range): boolean\n
\n

Examples

\n
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
\n'},{name:"overlaps after(range1, range2)",description:'

Function signature

\n
overlaps after(range1: range, range2: range): boolean\n
\n

Examples

\n
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
\n'},{name:"finishes(point, range)",description:'

Function signature

\n
finishes(point: Any, range: range): boolean\n
\n

Examples

\n
finishes(5, [1..5])\n// true\n\nfinishes(10, [1..7])\n// false\n
\n'},{name:"finishes(range1, range2)",description:'

Function signature

\n
finishes(range1: range, range2: range): boolean\n
\n

Examples

\n
finishes([3..5], [1..5])\n// true\n\nfinishes((1..5], [1..5))\n// false\n\nfinishes([5..10], [1..10))\n// false\n
\n'},{name:"finished by(range, point)",description:'

Function signature

\n
finished by(range: range, point: Any): boolean\n
\n

Examples

\n
finished by([5..10], 10)\n// true\n\nfinished by([3..4], 2)\n// false\n
\n'},{name:"finished by(range1, range2)",description:'

Function signature

\n
finished by(range1: range, range2: range): boolean\n
\n

Examples

\n
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
\n'},{name:"includes(range, point)",description:'

Function signature

\n
includes(range: range, point: Any): boolean\n
\n

Examples

\n
includes([5..10], 6)\n// true\n\nincludes([3..4], 5)\n// false\n
\n'},{name:"includes(range1, range2)",description:'

Function signature

\n
includes(range1: range, range2: range): boolean\n
\n

Examples

\n
includes([1..10], [4..6])\n// true\n\nincludes((5..8], [1..5))\n// false\n\nincludes([1..10], [1..5))\n// true\n
\n'},{name:"during(point, range)",description:'

Function signature

\n
during(point: Any, range: range): boolean\n
\n

Examples

\n
during(5, [1..10])\n// true\n\nduring(12, [1..10])\n// false\n\nduring(1, (1..10])\n// false\n
\n'},{name:"during(range1, range2)",description:'

Function signature

\n
during(range1: range, range2: range): boolean\n
\n

Examples

\n
during([4..6], [1..10))\n// true\n\nduring((1..5], (1..10])\n// true\n
\n'},{name:"starts(point, range)",description:'

Function signature

\n
starts(point: Any, range: range): boolean\n
\n

Examples

\n
starts(1, [1..5])\n// true\n\nstarts(1, (1..8])\n// false\n
\n'},{name:"starts(range1, range2)",description:'

Function signature

\n
starts(range1: range, range2: range): boolean\n
\n

Examples

\n
starts((1..5], [1..5])\n// false\n\nstarts([1..10], [1..5])\n// false\n\nstarts((1..5), (1..10))\n// true\n
\n'},{name:"started by(range, point)",description:'

Function signature

\n
started by(range: range, point: Any): boolean\n
\n

Examples

\n
started by([1..10], 1)\n// true\n\nstarted by((1..10], 1)\n// false\n
\n'},{name:"started by(range1, range2)",description:'

Function signature

\n
started by(range1: range, range2: range): boolean\n
\n

Examples

\n
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
\n'},{name:"coincides(point1, point2)",description:'

Function signature

\n
coincides(point1: Any, point2: Any): boolean\n
\n

Examples

\n
coincides(5, 5)\n// true\n\ncoincides(3, 4)\n// false\n
\n'},{name:"coincides(range1, range2)",description:'

Function signature

\n
coincides(range1: range, range2: range): boolean\n
\n

Examples

\n
coincides([1..5], [1..5])\n// true\n\ncoincides((1..5], [1..5))\n// false\n\ncoincides([1..5], [2..6])\n// false\n
\n'},{name:"substring(string, start position)",description:'

Returns a substring of the given value starting at start position.

\n

Function signature

\n
substring(string: string, start position: number): string\n
\n

The start position starts at the index 1. The last position is -1.

\n

Examples

\n
substring("foobar", 3)\n// "obar"\n
\n'},{name:"substring(string, start position, length)",description:'

Returns a substring of the given value starting at start position.

\n

Function signature

\n
substring(string: string, start position: number, length: number): string\n
\n

The start position starts at the index 1. The last position is -1.

\n

Examples

\n
substring("foobar", 3, 3)\n// "oba"\n
\n'},{name:"string length(string)",description:'

Returns the number of characters in the given value.

\n

Function signature

\n
string length(string: string): number\n
\n

Examples

\n
string length("foo")\n// 3\n
\n'},{name:"upper case(string)",description:'

Returns the given value with all characters are uppercase.

\n

Function signature

\n
upper case(string: string): string\n
\n

Examples

\n
upper case("aBc4")\n// "ABC4"\n
\n'},{name:"lower case(string)",description:'

Returns the given value with all characters are lowercase.

\n

Function signature

\n
lower case(string: string): string\n
\n

Examples

\n
lower case("aBc4")\n// "abc4"\n
\n'},{name:"substring before(string, match)",description:'

Returns a substring of the given value that contains all characters before match.

\n

Function signature

\n
substring before(string: string, match: string): string\n
\n

Examples

\n
substring before("foobar", "bar")\n// "foo"\n
\n'},{name:"substring after(string, match)",description:'

Returns a substring of the given value that contains all characters after match.

\n

Function signature

\n
substring after(string: string, match: string): string\n
\n

Examples

\n
substring after("foobar", "ob")\n// "ar"\n
\n'},{name:"contains(string, match)",description:'

Returns true if the given value contains the substring match. Otherwise, returns false.

\n

Function signature

\n
contains(string: string, match: string): boolean\n
\n

Examples

\n
contains("foobar", "of")\n// false\n
\n'},{name:"starts with(string, match)",description:'

Returns true if the given value starts with the substring match. Otherwise, returns false.

\n

Function signature

\n
starts with(string: string, match: string): boolean\n
\n

Examples

\n
starts with("foobar", "fo")\n// true\n
\n'},{name:"ends with(string, match)",description:'

Returns true if the given value ends with the substring match. Otherwise, returns false.

\n

Function signature

\n
ends with(string: string, match: string): boolean\n
\n

Examples

\n
ends with("foobar", "r")\n// true\n
\n'},{name:"matches(input, pattern)",description:'

Returns true if the given value matches the pattern. Otherwise, returns false.

\n

Function signature

\n
matches(input: string, pattern: string): boolean\n
\n

The pattern is a string that contains a regular expression.

\n

Examples

\n
matches("foobar", "^fo*bar")\n// true\n
\n'},{name:"matches(input, pattern, flags)",description:'

Returns true if the given value matches the pattern. Otherwise, returns false.

\n

Function signature

\n
matches(input: string, pattern: string, flags: string): boolean\n
\n

The pattern is a string that contains a regular expression.

\n

The flags can contain one or more of the following characters:

\n
    \n
  • s (dot-all)
  • \n
  • m (multi-line)
  • \n
  • i (case insensitive)
  • \n
  • x (comments)
  • \n
\n

Examples

\n
matches("FooBar", "foo", "i")\n// true\n
\n'},{name:"replace(input, pattern, replacement)",description:'

Returns the resulting string after replacing all occurrences of pattern with replacement.

\n

Function signature

\n
replace(input: string, pattern: string, replacement: string): string\n
\n

The pattern is a string that contains a regular expression.

\n

The replacement can access the match groups by using $ and the number of the group, for example,\n$1 to access the first group.

\n

Examples

\n
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
\n'},{name:"replace(input, pattern, replacement, flags)",description:'

Returns the resulting string after replacing all occurrences of pattern with replacement.

\n

Function signature

\n
replace(input: string, pattern: string, replacement: string, flags: string): string\n
\n

The pattern is a string that contains a regular expression.

\n

The replacement can access the match groups by using $ and the number of the group, for example,\n$1 to access the first group.

\n

The flags can contain one or more of the following characters:

\n
    \n
  • s (dot-all)
  • \n
  • m (multi-line)
  • \n
  • i (case insensitive)
  • \n
  • x (comments)
  • \n
\n

Examples

\n
replace("How do you feel?", "Feel", "FEEL", "i")\n// "How do you FEEL?"\n
\n'},{name:"split(string, delimiter)",description:'

Splits the given value into a list of substrings, breaking at each occurrence of the delimiter pattern.

\n

Function signature

\n
split(string: string, delimiter: string): list<string>\n
\n

The delimiter is a string that contains a regular expression.

\n

Examples

\n
split("John Doe", "\\s" )\n// ["John", "Doe"]\n\nsplit("a;b;c;;", ";")\n// ["a", "b", "c", "", ""]\n
\n'},{name:"extract(string, pattern)",description:'

Camunda Extension

\n

Returns all matches of the pattern in the given string. Returns an empty list if the pattern doesn't\nmatch.

\n

Function signature

\n
extract(string: string, pattern: string): list<string>\n
\n

The pattern is a string that contains a regular expression.

\n

Examples

\n
extract("references are 1234, 1256, 1378", "12[0-9]*")\n// ["1234","1256"]\n
\n'},{name:"now()",description:'

Returns the current date and time including the timezone.

\n

Function signature

\n
now(): date and time\n
\n

Examples

\n
now()\n// date and time("2020-07-31T14:27:30@Europe/Berlin")\n
\n'},{name:"today()",description:'

Returns the current date.

\n

Function signature

\n
today(): date\n
\n

Examples

\n
today()\n// date("2020-07-31")\n
\n'},{name:"day of week(date)",description:'

Returns the day of the week according to the Gregorian calendar. Note that it always returns the English name of the day.

\n

Function signature

\n
day of week(date: date): string\n
\n
day of week(date: date and time): string\n
\n

Examples

\n
day of week(date("2019-09-17"))\n// "Tuesday"\n\nday of week(date and time("2019-09-17T12:00:00"))\n// "Tuesday"\n
\n'},{name:"day of year(date)",description:'

Returns the Gregorian number of the day within the year.

\n

Function signature

\n
day of year(date: date): number\n
\n
day of year(date: date and time): number\n
\n

Examples

\n
day of year(date("2019-09-17"))\n// 260\n\nday of year(date and time("2019-09-17T12:00:00"))\n// 260\n
\n'},{name:"week of year(date)",description:'

Returns the Gregorian number of the week within the year, according to ISO 8601.

\n

Function signature

\n
week of year(date: date): number\n
\n
week of year(date: date and time): number\n
\n

Examples

\n
week of year(date("2019-09-17"))\n// 38\n\nweek of year(date and time("2019-09-17T12:00:00"))\n// 38\n
\n'},{name:"month of year(date)",description:'

Returns the month of the year according to the Gregorian calendar. Note that it always returns the English name of the month.

\n

Function signature

\n
month of year(date: date): string\n
\n
month of year(date: date and time): string\n
\n

Examples

\n
month of year(date("2019-09-17"))\n// "September"\n\nmonth of year(date and time("2019-09-17T12:00:00"))\n// "September"\n
\n'},{name:"abs(n)",description:'

Returns the absolute value of a given duration.

\n

Function signature

\n
abs(n: days and time duration): days and time duration\n
\n
abs(n: years and months duration): years and months duration\n
\n

Examples

\n
abs(duration("-PT5H"))\n// "duration("PT5H")"\n\nabs(duration("PT5H"))\n// "duration("PT5H")"\n\nabs(duration("-P2M"))\n// duration("P2M")\n
\n'},{name:"last day of month(date)",description:'

Camunda Extension

\n

Takes the month of the given date or date-time value and returns the last day of this month.

\n

Function signature

\n
last day of month(date: date): date\n
\n
last day of month(date: date and time): date\n
\n

Examples

\n
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
\n'}].map((e=>{const t=e.name.match(/^([\w\s]+)\((.*)\)$/);return Zp(`${t[1]}(${t[2].split(", ").map((e=>`\${${e}}`)).join(", ")})`,{label:e.name,type:"function",info:()=>gn(`
${e.description}
`),boost:-1})}));var Ty=e=>{let t=Uu(e.state).resolve(e.pos,-1),n=t.nextSibling;return Cy(t)||n&&n.from===e.pos&&Cy(n)?e.explicit?{from:e.pos,options:Ay}:null:t.parent&&"VariableName"!==t.parent.name||Py(t)?null:{from:t.from,options:Ay}};const My=zr.define();var Ry=e=>{const t=e.state.facet(My)[0],n=Uu(e.state).resolve(e.pos,-1);if(!Py(n))return;const o=function(e){for(;e;){if("PathExpression"===e.name)return e;e=e.parent}}(n),r=n===o?e.pos:n.from,i=jy(o,e);let s=t;for(var a=0;ae.name===i[a].name));if(!l)return null;if("optional"!==l.isList&&!!l.isList!==i[a].isList)return;s=l.entries}return s?(s=s.map((e=>({label:e.name,type:"variable",info:e.info,detail:e.detail}))),{from:r,options:s}):void 0};function jy(e,t){let n=[];for(let o=e.firstChild;o;o=o.nextSibling)"PathExpression"===o.name?n.push(...jy(o,t)):"FilterExpression"===o.name?n.push(...By(o,t)):n.push({name:Dy(o,t),isList:!1});return n}function By(e,t){const n=e.firstChild;if("PathExpression"===n.name){const e=jy(n,t);return e[e.length-1].isList=!0,e}return[{name:Dy(n,t),isList:!0}]}function Dy(e,t){return t.state.sliceDoc(e.from,e.to)}var Ly=e=>{const t=e.state.facet(My)[0].map((e=>({label:e.name,type:"variable",info:e.info,detail:e.detail})));let n=Uu(e.state).resolve(e.pos,-1),o=n.nextSibling;if(Cy(n)||o&&o.from===e.pos&&Cy(o))return e.explicit?{from:e.pos,options:t}:null;const r={from:n.from,options:t};return n.parent&&"VariableName"!==n.parent.name||Py(n)?null:r};function $y(){return[mf({override:[Ly,Ty,np(wy.map((e=>({...e,boost:-1})))),Ry,..._y]})]}var Iy=[Zd(Xm())],Ny=[Hc.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-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}}),Hc.baseTheme({"& .variableName":{color:"#10f"},"& .number":{color:"#164"},"& .string":{color:"#a11"},"& .bool":{color:"#219"},"& .function":{color:"#aa3731",fontWeight:"bold"},"& .control":{color:"#708"}}),Ah(Sh.define([{tag:ar.variableName,class:"variableName"},{tag:ar.name,class:"variableName"},{tag:ar.number,class:"number"},{tag:ar.string,class:"string"},{tag:ar.bool,class:"bool"},{tag:ar.function(ar.variableName),class:"function"},{tag:ar.function(ar.special(ar.variableName)),class:"function"},{tag:ar.controlKeyword,class:"control"},{tag:ar.operatorKeyword,class:"control"}]))];const qy=new ti;function Fy({extensions:e=[],container:t,tooltipContainer:n,onChange:o=(()=>{}),onKeyDown:r=(()=>{}),onLint:i=(()=>{}),readOnly:s=!1,value:a="",variables:l=[]}){const c=Hc.updateListener.of((e=>{e.docChanged&&o(e.state.doc.toString())})),u=Hc.updateListener.of((e=>{const t=e.transactions.flatMap((e=>e.effects)).filter((e=>e.is(Fd)));if(!t.length)return;const n=t.flatMap((e=>e.value));i(n)})),h=Hc.domEventHandlers({keydown:r});"string"==typeof n&&(n=document.querySelector(n));const p=n?ru({tooltipSpace:function(){return n.getBoundingClientRect()}}):[],f=[qy.of(My.of(l)),$y(),Fh(),c,of(),Oh(),h,Zc.of([...Bd]),new ih(Ey,[]),Iy,u,p,Ny,...e];return s&&f.push(Hc.editable.of(!1)),this._cmEditor=new Hc({state:Ci.create({doc:a,extensions:f}),parent:t}),this}Fy.prototype.setValue=function(e){this._cmEditor.dispatch({changes:{from:0,to:this._cmEditor.state.doc.length,insert:e}})},Fy.prototype.focus=function(e){const t=this._cmEditor;if(t.contentDOM.focus(),t.focus(),"number"==typeof e){const n=t.state.doc.length;t.dispatch({selection:{anchor:e<=n?e:n}})}},Fy.prototype.getSelection=function(){return this._cmEditor.state.selection},Fy.prototype.setVariables=function(e){this._cmEditor.dispatch({effects:qy.reconfigure(My.of(e))})};var Qy=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Hy=Qy.join(","),zy="undefined"==typeof Element,Vy=zy?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Wy=!zy&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Xy=function e(t,n){var o;void 0===n&&(n=!0);var r=null==t||null===(o=t.getAttribute)||void 0===o?void 0:o.call(t,"inert");return""===r||"true"===r||n&&t&&e(t.parentNode)},Gy=function(e,t,n){if(Xy(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Hy));return t&&Vy.call(e,Hy)&&o.unshift(e),o.filter(n)},Uy=function e(t,n,o){for(var r=[],i=Array.from(t);i.length;){var s=i.shift();if(!Xy(s,!1))if("SLOT"===s.tagName){var a=s.assignedElements(),l=e(a.length?a:s.children,!0,o);o.flatten?r.push.apply(r,l):r.push({scopeParent:s,candidates:l})}else{Vy.call(s,Hy)&&o.filter(s)&&(n||!t.includes(s))&&r.push(s);var c=s.shadowRoot||"function"==typeof o.getShadowRoot&&o.getShadowRoot(s),u=!Xy(c,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(s));if(c&&u){var h=e(!0===c?s.children:c.children,!0,o);o.flatten?r.push.apply(r,h):r.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return r},Yy=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Zy=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!Yy(e)?0:e.tabIndex},Ky=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Jy=function(e){return"INPUT"===e.tagName},ev=function(e){var t=e.getBoundingClientRect(),n=t.width,o=t.height;return 0===n&&0===o},tv=function(e,t){return!(t.disabled||Xy(t)||function(e){return Jy(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,o=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var r=Vy.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Vy.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return ev(e)}else{if("function"==typeof o){for(var i=e;e;){var s=e.parentElement,a=Wy(e);if(s&&!s.shadowRoot&&!0===o(s))return ev(e);e=e.assignedSlot?e.assignedSlot:s||a===e.ownerDocument?s:a.host}e=i}if(function(e){var t,n,o,r,i=e&&Wy(e),s=null===(t=i)||void 0===t?void 0:t.host,a=!1;if(i&&i!==e)for(a=!!(null!==(n=s)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(s)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!a&&s;){var l,c,u;a=!(null===(c=s=null===(l=i=Wy(s))||void 0===l?void 0:l.host)||void 0===c||null===(u=c.ownerDocument)||void 0===u||!u.contains(s))}return a}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1}(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n=0)},rv=function e(t){var n=[],o=[];return t.forEach((function(t,r){var i=!!t.scopeParent,s=i?t.scopeParent:t,a=function(e,t){var n=Zy(e);return n<0&&t&&!Yy(e)?0:n}(s,i),l=i?e(t.candidates):s;0===a?i?n.push.apply(n,l):n.push(s):o.push({documentOrder:r,tabIndex:a,item:t,isScope:i,content:l})})),o.sort(Ky).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},iv=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Vy.call(e,Hy)&&nv(t,e)},sv=Qy.concat("iframe").join(","),av=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Vy.call(e,sv)&&tv(t,e)};function lv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function cv(e){for(var t=1;t1?t-1:0),o=1;o1?n-1:0),s=1;s=0)e=o.activeElement;else{var t=s.tabbableGroups[0];e=t&&t.firstTabbableNode||c("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},h=function(){if(s.containerGroups=s.containers.map((function(e){var t=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Uy([e],t.includeContainer,{filter:nv.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:ov}):Gy(e,t.includeContainer,nv.bind(null,t)),rv(n)}(e,i.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?Uy([e],t.includeContainer,{filter:tv.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Gy(e,t.includeContainer,tv.bind(null,t))}(e,i.tabbableOptions),o=t.length>0?t[0]:void 0,r=t.length>0?t[t.length-1]:void 0,s=n.find((function(e){return iv(e)})),a=n.slice().reverse().find((function(e){return iv(e)})),l=!!t.find((function(e){return Zy(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:l,firstTabbableNode:o,lastTabbableNode:r,firstDomTabbableNode:s,lastDomTabbableNode:a,nextTabbableNode:function(e){var o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=t.indexOf(e);return r<0?o?n.slice(n.indexOf(e)+1).find((function(e){return iv(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return iv(e)})):t[r+(o?1:-1)]}}})),s.tabbableGroups=s.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),s.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find((function(e){return e.posTabIndexesFound}))&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function e(t){var n=t.activeElement;if(n)return n.shadowRoot&&null!==n.shadowRoot.activeElement?e(n.shadowRoot):n},f=function e(t){!1!==t&&t!==p(document)&&(t&&t.focus?(t.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(u()))},d=function(e){var t=c("setReturnFocus",e);return t||!1!==t&&e},g=function(e){var t=e.target,n=e.event,o=e.isBackward,r=void 0!==o&&o;t=t||mv(n),h();var a=null;if(s.tabbableGroups.length>0){var u=l(t,n),p=u>=0?s.containerGroups[u]:void 0;if(u<0)a=r?s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:s.tabbableGroups[0].firstTabbableNode;else if(r){var f=dv(s.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(f<0&&(p.container===t||av(t,i.tabbableOptions)&&!iv(t,i.tabbableOptions)&&!p.nextTabbableNode(t,!1))&&(f=u),f>=0){var d=0===f?s.tabbableGroups.length-1:f-1,g=s.tabbableGroups[d];a=Zy(t)>=0?g.lastTabbableNode:g.lastDomTabbableNode}else uv(n)||(a=p.nextTabbableNode(t,!1))}else{var m=dv(s.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(m<0&&(p.container===t||av(t,i.tabbableOptions)&&!iv(t,i.tabbableOptions)&&!p.nextTabbableNode(t))&&(m=u),m>=0){var y=m===s.tabbableGroups.length-1?0:m+1,v=s.tabbableGroups[y];a=Zy(t)>=0?v.firstTabbableNode:v.firstDomTabbableNode}else uv(n)||(a=p.nextTabbableNode(t))}}else a=c("fallbackFocus");return a},m=function(e){var t=mv(e);l(t,e)>=0||(gv(i.clickOutsideDeactivates,e)?n.deactivate({returnFocus:i.returnFocusOnDeactivate}):gv(i.allowOutsideClick,e)||e.preventDefault())},y=function(e){var t=mv(e),n=l(t,e)>=0;if(n||t instanceof Document)n&&(s.mostRecentlyFocusedNode=t);else{var o;e.stopImmediatePropagation();var r=!0;if(s.mostRecentlyFocusedNode)if(Zy(s.mostRecentlyFocusedNode)>0){var a=l(s.mostRecentlyFocusedNode),c=s.containerGroups[a].tabbableNodes;if(c.length>0){var h=c.findIndex((function(e){return e===s.mostRecentlyFocusedNode}));h>=0&&(i.isKeyForward(s.recentNavEvent)?h+1=0&&(o=c[h-1],r=!1))}}else s.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return Zy(e)>0}))}))||(r=!1);else r=!1;r&&(o=g({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),f(o||s.mostRecentlyFocusedNode||u())}s.recentNavEvent=void 0},v=function(e){if(!(t=e,"Escape"!==(null==t?void 0:t.key)&&"Esc"!==(null==t?void 0:t.key)&&27!==(null==t?void 0:t.keyCode)||!1===gv(i.escapeDeactivates,e)))return e.preventDefault(),void n.deactivate();var t;(i.isKeyForward(e)||i.isKeyBackward(e))&&function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];s.recentNavEvent=e;var n=g({event:e,isBackward:t});n&&(uv(e)&&e.preventDefault(),f(n))}(e,i.isKeyBackward(e))},b=function(e){var t=mv(e);l(t,e)>=0||gv(i.clickOutsideDeactivates,e)||gv(i.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},x=function(){if(s.active)return function(e,t){if(e.length>0){var n=e[e.length-1];n!==t&&n.pause()}var o=e.indexOf(t);-1===o||e.splice(o,1),e.push(t)}(r,n),s.delayInitialFocusTimer=i.delayInitialFocus?fv((function(){f(u())})):f(u()),o.addEventListener("focusin",y,!0),o.addEventListener("mousedown",m,{capture:!0,passive:!1}),o.addEventListener("touchstart",m,{capture:!0,passive:!1}),o.addEventListener("click",b,{capture:!0,passive:!1}),o.addEventListener("keydown",v,{capture:!0,passive:!1}),n},w=function(){if(s.active)return o.removeEventListener("focusin",y,!0),o.removeEventListener("mousedown",m,!0),o.removeEventListener("touchstart",m,!0),o.removeEventListener("click",b,!0),o.removeEventListener("keydown",v,!0),n},O="undefined"!=typeof window&&"MutationObserver"in window?new MutationObserver((function(e){var t=e.some((function(e){return Array.from(e.removedNodes).some((function(e){return e===s.mostRecentlyFocusedNode}))}));t&&f(u())})):void 0,_=function(){O&&(O.disconnect(),s.active&&!s.paused&&s.containers.map((function(e){O.observe(e,{subtree:!0,childList:!0})})))};return n={get active(){return s.active},get paused(){return s.paused},activate:function(e){if(s.active)return this;var t=a(e,"onActivate"),n=a(e,"onPostActivate"),r=a(e,"checkCanFocusTrap");r||h(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=o.activeElement,null==t||t();var i=function(){r&&h(),x(),_(),null==n||n()};return r?(r(s.containers.concat()).then(i,i),this):(i(),this)},deactivate:function(e){if(!s.active)return this;var t=cv({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},e);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,w(),s.active=!1,s.paused=!1,_(),function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}(r,n);var o=a(t,"onDeactivate"),l=a(t,"onPostDeactivate"),c=a(t,"checkCanReturnFocus"),u=a(t,"returnFocus","returnFocusOnDeactivate");null==o||o();var h=function(){fv((function(){u&&f(d(s.nodeFocusedBeforeActivation)),null==l||l()}))};return u&&c?(c(d(s.nodeFocusedBeforeActivation)).then(h,h),this):(h(),this)},pause:function(e){if(s.paused||!s.active)return this;var t=a(e,"onPause"),n=a(e,"onPostPause");return s.paused=!0,null==t||t(),w(),_(),null==n||n(),this},unpause:function(e){if(!s.paused||!s.active)return this;var t=a(e,"onUnpause"),n=a(e,"onPostUnpause");return s.paused=!1,null==t||t(),h(),x(),_(),null==n||n(),this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return s.containers=t.map((function(e){return"string"==typeof e?o.querySelector(e):e})),s.active&&h(),_(),this}},n.updateContainerElements(e),n},bv=function(e){return Lt("svg",{...e,children:Lt("path",{fillRule:"evenodd",d:"m11.657 8-4.95 4.95a1 1 0 0 1-1.414-1.414L8.828 8 5.293 4.464A1 1 0 1 1 6.707 3.05L11.657 8Z"})})};bv.defaultProps={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16"};var xv=function(e){return Lt("svg",{...e,children:Lt("path",{fillRule:"evenodd",d:"M12 6v7c0 1.1-.4 1.55-1.5 1.55h-5C4.4 14.55 4 14.1 4 13V6h8Zm-1.5 1.5h-5v4.3c0 .66.5 1.2 1.111 1.2H9.39c.611 0 1.111-.54 1.111-1.2V7.5ZM13 3h-2l-1-1H6L5 3H3v1.5h10V3Z"})})};xv.defaultProps={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16"};var wv=function(e){return Lt("svg",{...e,children:[Lt("path",{fill:"#fff",style:{mixBlendMode:"multiply"},d:"M0 0h16v16H0z"}),Lt("path",{fill:"#fff",style:{mixBlendMode:"multiply"},d:"M0 0h16v16H0z"}),Lt("path",{d:"M7 3H5v2h2V3zm4 0H9v2h2V3zM7 7H5v2h2V7zm4 0H9v2h2V7zm-4 4H5v2h2v-2zm4 0H9v2h2v-2z",fill:"#161616"})]})};wv.defaultProps={width:"16",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};var Ov=function(e){return Lt("svg",{...e,children:Lt("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.637 12.637v-4.72h1.362v4.721c0 .36-.137.676-.411.95-.275.275-.591.412-.95.412H3.362c-.38 0-.703-.132-.967-.396A1.315 1.315 0 0 1 2 12.638V3.362c0-.38.132-.703.396-.967S2.982 2 3.363 2h4.553v1.363H3.363v9.274h9.274ZM14 2H9.28l-.001 1.362h2.408L5.065 9.984l.95.95 6.622-6.622v2.409H14V2Z",fill:"currentcolor"})})};Ov.defaultProps={width:"16",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};var _v=function(e){return Lt("svg",{...e,children:[Lt("path",{d:"M16 2a14 14 0 1 0 14 14A14 14 0 0 0 16 2Zm0 26a12 12 0 1 1 12-12 12 12 0 0 1-12 12Z"}),Lt("circle",{cx:"16",cy:"23.5",r:"1.5"}),Lt("path",{d:"M17 8h-1.5a4.49 4.49 0 0 0-4.5 4.5v.5h2v-.5a2.5 2.5 0 0 1 2.5-2.5H17a2.5 2.5 0 0 1 0 5h-2v4.5h2V17a4.5 4.5 0 0 0 0-9Z"}),Lt("path",{style:{fill:"none"},d:"M0 0h32v32H0z"})]})};_v.defaultProps={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"};var kv=function(e){return Lt("svg",{...e,children:[Lt("path",{fill:"currentColor",d:"M28 4H10a2.006 2.006 0 0 0-2 2v14a2.006 2.006 0 0 0 2 2h18a2.006 2.006 0 0 0 2-2V6a2.006 2.006 0 0 0-2-2Zm0 16H10V6h18Z"}),Lt("path",{fill:"currentColor",d:"M18 26H4V16h2v-2H4a2.006 2.006 0 0 0-2 2v10a2.006 2.006 0 0 0 2 2h14a2.006 2.006 0 0 0 2-2v-2h-2Z"})]})};function Sv(e){const{element:t,headerProvider:n}=e,{getElementIcon:o,getDocumentationRef:r,getElementLabel:i,getTypeLabel:s}=n,a=i(t),l=s(t),c=r&&r(t),u=o(t);return Lt("div",{class:"bio-properties-panel-header",children:[Lt("div",{class:"bio-properties-panel-header-icon",children:u&&Lt(u,{width:"32",height:"32",viewBox:"0 0 32 32"})}),Lt("div",{class:"bio-properties-panel-header-labels",children:[Lt("div",{title:l,class:"bio-properties-panel-header-type",children:l}),a?Lt("div",{title:a,class:"bio-properties-panel-header-label",children:a}):null]}),Lt("div",{class:"bio-properties-panel-header-actions",children:c?Lt("a",{rel:"noopener",class:"bio-properties-panel-header-link",href:c,title:"Open documentation",target:"_blank",children:Lt(Ov,{})}):null})]})}kv.defaultProps={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32"};const Ev=F({description:{},getDescriptionForId:()=>{}}),Cv=F({errors:{}}),Pv=F({eventBus:null}),Av=F({layout:{},setLayout:()=>{},getLayoutForKey:()=>{},setLayoutForKey:()=>{}}),Tv=F({tooltip:{},getTooltipForId:()=>{}});function Mv(e){const{forId:t,element:n}=e,o=function(e,t){const{getTooltipForId:n}=le(Tv);return n(e,t)}(t,n),r=e.value||o;return r?Lt(Rv,{...e,value:r,forId:Dv(t)}):e.children}function Rv(e){const{forId:t,value:n,parent:o,direction:r="right",position:i}=e,[s,a]=te(!1),[l,c]=te(!1);let u=null;const h=ie(null),p=ie(null),f=async e=>{const t=()=>a(!0);s||u||(e instanceof MouseEvent?u=setTimeout(t,200):(t(),c(!0)))},d=()=>{a(!1),c(!1)};oe((()=>{const{current:e}=h;if(!e)return;const t=e=>{const t=document.activeElement===h.current||document.activeElement.closest(".bio-properties-panel-tooltip");!s||(({x:e,y:t})=>{const n=p.current,o=h.current;return n&&(jv(e,t,o.getBoundingClientRect())||jv(e,t,n.getBoundingClientRect()))})({x:e.x,y:e.y})||t&&l||d()},n=e=>{const{relatedTarget:t}=e;s&&!h.current.matches(":hover")&&t&&!t.closest(".bio-properties-panel-tooltip")&&d()};return document.addEventListener("wheel",t),document.addEventListener("focusout",n),document.addEventListener("mousemove",t),()=>{document.removeEventListener("wheel",t),document.removeEventListener("mousemove",t),document.removeEventListener("focusout",n)}}),[h.current,s,l]);const g=()=>Lt("div",{class:`bio-properties-panel-tooltip ${r}`,role:"tooltip",id:"bio-properties-panel-tooltip","aria-labelledby":t,style:i||Bv(h.current),ref:p,onClick:e=>e.stopPropagation(),children:[Lt("div",{class:"bio-properties-panel-tooltip-content",children:n}),Lt("div",{class:"bio-properties-panel-tooltip-arrow"})]});return Lt("div",{class:"bio-properties-panel-tooltip-wrapper",tabIndex:"0",ref:h,onMouseEnter:f,onMouseLeave:()=>{clearTimeout(u),u=null},onFocus:f,onKeyDown:e=>{"Escape"===e.code&&d()},children:[e.children,s?o?dt(g(),o.current):g():null]})}function jv(e,t,n){const{top:o,right:r,bottom:i,left:s}=n;return e>=s&&e<=r&&t>=o&&t<=i}function Bv(e){const t=e.getBoundingClientRect();return`right: calc(100% - ${t.x}px); top: ${t.top-10+"px"};`}function Dv(e){return`bio-properties-panel-${e}`}function Lv(e){const{errors:t}=le(Cv);return t[e]}function $v(e,t,n){const o=le(Pv);n||({eventBus:n}=o);const r=ie(!1);n&&!r.current&&n.on(e,t),oe((()=>(n&&r.current&&n.on(e,t),r.current=!0,()=>{n&&n.off(e,t)})),[t,e,n])}function Iv(e){const{onShow:t}=le(Av),n=ie(),o=ie(!1),r=ae((n=>{n.id===e&&(t(),o.current||(o.current=!0))}),[e]);return oe((()=>{o.current&&n.current&&(Se(n.current.focus)&&n.current.focus(),Se(n.current.select)&&n.current.select(),o.current=!1)})),$v("propertiesPanel.showEntry",r),n}function Nv(e){const t=ie(e);return t.current=e,ae(((...e)=>t.current(...e)),[])}function qv(e){const{element:t,entries:n=[],id:o,label:r,shouldOpen:i=!1}=e,s=ie(null),[a,l]=function(e,t){const{getLayoutForKey:n,setLayoutForKey:o}=le(Av);return[n(e,t),ae((t=>{o(e,t)}),[o])]}(["groups",o,"open"],i),c=ae((()=>l(!0)),[l]),[u,h]=te(!1),[p,f]=te(!1);oe((()=>{const e=requestAnimationFrame((()=>{const e=n.find((e=>{const{id:t,isEdited:n}=e,o=mn(`[data-entry-id="${t}"]`);return!(!Se(n)||!o)&&n(mn(".bio-properties-panel-input",o))}));h(e)}));return()=>cancelAnimationFrame(e)}),[n,h]);const d=function(){const{errors:e}=le(Cv);return e}(),m=n.some((e=>d[e.id]));!function(e,t,n){const[o,r]=te(mn(t)),i=ae((()=>{const e=mn(t);e!==o&&r(e)}),[t,o]);oe((()=>{i()}),[i]),$v("propertiesPanel.attach",i),$v("propertiesPanel.detach",i),oe((()=>{const t=IntersectionObserver;if(!t)return;if(!e.current||!o)return;const r=new t((e=>{0!==o.scrollHeight&&e.forEach((e=>{e.intersectionRatio<1?n(!0):1===e.intersectionRatio&&n(!1)}))}),{root:o,rootMargin:"0px 0px 999999% 0px",threshold:[1]});return r.observe(e.current),()=>{r.unobserve(e.current)}}),[e.current,o,n])}(s,"div.bio-properties-panel-scroll-container",f);const y={...le(Av),onShow:c};return Lt("div",{class:"bio-properties-panel-group","data-group-id":"group-"+o,ref:s,children:[Lt("div",{class:It()("bio-properties-panel-group-header",u?"":"empty",a?"open":"",p&&a?"sticky":""),onClick:()=>l(!a),children:[Lt("div",{title:e.tooltip?null:r,"data-title":r,class:"bio-properties-panel-group-header-title",children:Lt(Mv,{value:e.tooltip,forId:"group-"+o,element:t,parent:s,children:r})}),Lt("div",{class:"bio-properties-panel-group-header-buttons",children:[Lt(Fv,{edited:u,hasErrors:m}),Lt("button",{type:"button",title:"Toggle section",class:"bio-properties-panel-group-header-button bio-properties-panel-arrow",children:Lt(bv,{class:a?"bio-properties-panel-arrow-down":"bio-properties-panel-arrow-right"})})]})]}),Lt("div",{class:It()("bio-properties-panel-group-entries",a?"open":""),children:Lt(Av.Provider,{value:y,children:n.map((e=>{const{component:n,id:o}=e;return g(n,{...e,element:t,key:o})}))})})]})}function Fv(e){const{edited:t,hasErrors:n}=e;return n?Lt("div",{title:"Section contains an error",class:"bio-properties-panel-dot bio-properties-panel-dot--error"}):t?Lt("div",{title:"Section contains data",class:"bio-properties-panel-dot"}):null}function Qv(e){const{text:t,icon:n}=e;return Lt("div",{class:"bio-properties-panel open",children:Lt("section",{class:"bio-properties-panel-placeholder",children:[n&&Lt(n,{class:"bio-properties-panel-placeholder-icon"}),Lt("p",{class:"bio-properties-panel-placeholder-text",children:t})]})})}function Hv(e){const{element:t,forId:n,value:o}=e,r=function(e,t){const{getDescriptionForId:n}=le(Ev);return n(e,t)}(n,t),i=o||r;if(i)return Lt("div",{class:"bio-properties-panel-description",children:i})}const zv=()=>{},Vv=tt(((e,t)=>{const{onInput:n,disabled:o,tooltipContainer:r,enableGutters:i,value:s,onLint:a=zv,onPopupOpen:l=zv,popupOpen:c,contentAttributes:u={},hostLanguage:h=null,singleLine:p=!1}=e,f=ie(),[d,g]=te(),[m,y]=te(s||"");!function(e,t){const[n,o]=te(void 0);t.current=se((()=>({focus:t=>{e?e.focus(t):(void 0===t&&(t=1/0),o(t))}})),[e]),oe((()=>{void 0!==n&&e&&(e.focus(n),o(!1))}),[e,n])}(d,t);const v=Nv((e=>{n(e),y(e)}));return oe((()=>{let e;return e=new xy({container:f.current,onChange:v,value:m,onLint:a,contentAttributes:u,tooltipContainer:r,enableGutters:i,hostLanguage:h,singleLine:p}),g(e),()=>{a([]),f.current.innerHTML="",g(null)}}),[]),oe((()=>{d&&s!==m&&(d.setValue(s),y(s))}),[s]),Lt("div",{class:It()("bio-properties-panel-feelers-editor-container",c?"popupOpen":null),children:[Lt("div",{class:"bio-properties-panel-feelers-editor__open-popup-placeholder",children:"Opened in editor"}),Lt("div",{name:e.name,class:It()("bio-properties-panel-feelers-editor bio-properties-panel-input",m?"edited":null,o?"disabled":null),ref:f,onClick:()=>{t.current.focus()}}),Lt("button",{type:"button",title:"Open pop-up editor",class:"bio-properties-panel-open-feel-popup",onClick:()=>l("feelers"),children:Lt(Ov,{})})]})})),Wv=()=>{},Xv=tt(((e,t)=>{const{enableGutters:n,value:o,onInput:r,onFeelToggle:i=Wv,onLint:s=Wv,onPopupOpen:a=Wv,popupOpen:l,disabled:c,tooltipContainer:u,variables:h}=e,p=ie(),[f,d]=te(),[g,m]=te(o||"");!function(e,t){const[n,o]=te(void 0);t.current=se((()=>({focus:t=>{e?e.focus(t):(void 0===t&&(t=1/0),o(t))}})),[e]),oe((()=>{void 0!==n&&e&&(e.focus(n),o(!1))}),[e,n])}(f,t);const y=Nv((e=>{r(e),m(e)}));return oe((()=>{let e;return e=new Fy({container:p.current,onChange:y,onKeyDown:t=>{if("Backspace"!==t.key||!e)return;const n=e.getSelection(),o=n.ranges[n.mainIndex];0===o.from&&0===o.to&&i()},onLint:s,tooltipContainer:u,value:g,variables:h,extensions:[...n?[Fu()]:[],Hc.lineWrapping]}),d(e),()=>{s([]),p.current.innerHTML="",d(null)}}),[]),oe((()=>{f&&o!==g&&(f.setValue(o),m(o))}),[o]),oe((()=>{f&&f.setVariables(h)}),[h]),Lt("div",{class:It()("bio-properties-panel-feel-editor-container",c?"disabled":null,l?"popupOpen":null),children:[Lt("div",{class:"bio-properties-panel-feel-editor__open-popup-placeholder",children:"Opened in editor"}),Lt("div",{name:e.name,class:It()("bio-properties-panel-input",g?"edited":null),ref:p,onClick:()=>{t.current.focus()}}),Lt("button",{type:"button",title:"Open pop-up editor",class:"bio-properties-panel-open-feel-popup",onClick:()=>a(),children:Lt(kv,{})})]})})),Gv=F({open:()=>{},close:()=>{},source:null});function Uv(e){e.preventDefault(),e.stopPropagation()}const Yv=()=>{},Zv=tt((function(e,t){const{container:n,className:o,delayInitialFocus:r,position:i,width:s,height:a,onClose:l,onPostActivate:c=Yv,onPostDeactivate:u=Yv,returnFocus:h=!0,closeOnEscape:p=!0,title:f}=e,d=ie(null),g=ie(null),m=t||g,y=se((()=>function(e){return"string"==typeof e?mn(e):e}(n)),[n]),v=()=>{d.current&&d.current.activate()};let b={};return i&&(b={...b,top:i.top+"px",left:i.left+"px"}),s&&(b.width=s+"px"),a&&(b.height=a+"px"),oe((()=>(m.current&&m.current.addEventListener("focusin",v),()=>{m.current.removeEventListener("focusin",v)})),[m]),oe((()=>(m.current&&(d.current=vv(m.current,{clickOutsideDeactivates:!0,delayInitialFocus:r,fallbackFocus:m.current,onPostActivate:c,onPostDeactivate:u,returnFocusOnDeactivate:h}),d.current.activate()),()=>d.current&&d.current.deactivate())),[m]),dt(Lt("div",{"aria-label":f,tabIndex:-1,ref:m,onKeyDown:e=>{e.stopPropagation(),p&&"Escape"===e.key&&l()},role:"dialog",class:It()("bio-properties-panel-popup",o),style:b,children:e.children}),y||document.body)}));function Kv(e){return e.closest(".bio-properties-panel-popup")}Zv.Title=function(e){const{children:t,className:n,draggable:o,emit:r=(()=>{}),title:i,...s}=e,a=ie({startPosition:null,newPosition:null}),l=ie(),c=ie(),u=(e,t)=>{!function(e){e.preventDefault(),e.stopPropagation()}(e);const{x:n,y:o}=t,i={x:a.current.startPosition.x+n,y:a.current.startPosition.y+o},s=Kv(c.current);s.style.top=i.y+"px",s.style.left=i.x+"px",r("dragover",{newPosition:i,delta:t})};return Lt("div",{class:It()("bio-properties-panel-popup__header",o&&"draggable",n),ref:c,draggable:o,onDragStart:e=>{(function(e,t){let n,o,r;function i(t){const i={x:t.clientX-o,y:t.clientY-r};return e.call(n,t,i)}function s(){document.removeEventListener("dragover",i,!0),document.removeEventListener("dragenter",Uv,!0),document.removeEventListener("dragend",s),document.removeEventListener("drop",Uv)}return function(e){n=this,o=e.clientX,r=e.clientY,e.dataTransfer&&e.dataTransfer.setDragImage(t||gn(''),0,0),document.addEventListener("dragover",i,!0),document.addEventListener("dragenter",Uv,!0),document.addEventListener("dragend",s),document.addEventListener("drop",Uv)}})(u,l.current)(e),e.stopPropagation();const t=Kv(c.current).getBoundingClientRect();a.current.startPosition={x:t.left,y:t.top},r("dragstart")},onDragEnd:()=>{a.current.newPosition=null,r("dragend")},...s,children:[o&&Lt(y,{children:[Lt("div",{ref:l,class:"bio-properties-panel-popup__drag-preview"}),Lt("div",{class:"bio-properties-panel-popup__drag-handle",children:Lt(wv,{})})]}),Lt("div",{class:"bio-properties-panel-popup__title",children:i}),t]})},Zv.Body=function(e){const{children:t,className:n,...o}=e;return Lt("div",{class:It()("bio-properties-panel-popup__body",n),...o,children:t})},Zv.Footer=function(e){const{children:t,className:n,...o}=e;return Lt("div",{class:It()("bio-properties-panel-popup__footer",n),...o,children:e.children})};const Jv=700,eb=250;function tb(e){const{element:t,eventBus:n={fire(){},on(){},off(){}},popupContainer:o}=e,r=function(e){const t=ie();return oe((()=>{t.current=e})),t.current}(t),[i,s]=te({}),[a,l]=te(!1),[c,u]=te(null),[h,p]=te(null),f=(e,t)=>{n.fire("feelPopup."+e,t)},d=ae((()=>!!a),[a]);!function(e,t){const n=ie(!1);oe((()=>{n.current?a||f("closed"):n.current=!0}),t)}(0,[a]);const g=(e,t,n)=>{u(e),s(t),l(!0),p(n),f("open")},m=()=>{l(!1),u(null)},y={open:g,close:m,source:c};return oe((()=>{t&&r&&t!==r&&m()}),[t]),oe((()=>{const e=()=>d();return n.on("feelPopup._close",m),n.on("feelPopup._open",(e=>{const{entryId:t,popupConfig:n,sourceElement:o}=e;g(t,n,o)})),n.on("feelPopup._isOpen",e),()=>{n.off("feelPopup._close",m),n.off("feelPopup._open",g),n.off("feelPopup._isOpen",e)}}),[n,d]),Lt(Gv.Provider,{value:y,children:[a&&Lt(nb,{onClose:m,container:o,sourceElement:h,emit:f,...i}),e.children]})}function nb(e){const{container:t,id:n,hostLanguage:o,onInput:r,onClose:i,position:s,singleLine:a,sourceElement:l,title:c,tooltipContainer:u,type:h,value:p,variables:f,emit:d}=e,g=ie(),m=ie(),y=ie(!1);return oe((()=>(d("opened",{domNode:m.current}),()=>d("close",{domNode:m.current}))),[]),oe((()=>{g.current&&g.current.focus()}),[g]),Lt(Zv,{container:t,className:"bio-properties-panel-feel-popup",emit:d,position:s,title:c,onClose:i,returnFocus:!1,closeOnEscape:!1,delayInitialFocus:!1,onPostDeactivate:()=>{l&&l.focus()},height:eb,width:Jv,ref:m,children:[Lt(Zv.Title,{title:c,emit:d,draggable:!0,children:["feel"===h&&Lt("a",{href:"https://docs.camunda.io/docs/components/modeler/feel/what-is-feel/",target:"_blank",class:"bio-properties-panel-feel-popup__title-link",children:["Learn FEEL expressions",Lt(_v,{})]}),"feelers"===h&&Lt("a",{href:"https://docs.camunda.io/docs/components/modeler/forms/configuration/forms-config-templating-syntax/",target:"_blank",class:"bio-properties-panel-feel-popup__title-link",children:["Learn templating",Lt(_v,{})]})]}),Lt(Zv.Body,{children:Lt("div",{onKeyDownCapture:e=>{"Escape"===e.key&&(y.current=e.target.closest(".cm-editor").querySelector(".cm-tooltip-autocomplete"))},onKeyDown:e=>{"Escape"===e.key&&(y.current||(i(),y.current=!1))},class:"bio-properties-panel-feel-popup__body",children:["feel"===h&&Lt(Xv,{enableGutters:!0,id:ob(n),name:n,onInput:r,value:p,variables:f,ref:g,tooltipContainer:u}),"feelers"===h&&Lt(Vv,{id:ob(n),contentAttributes:{"aria-label":c},enableGutters:!0,hostLanguage:o,name:n,onInput:r,value:p,ref:g,singleLine:a,tooltipContainer:u})]})}),Lt(Zv.Footer,{children:Lt("button",{type:"button",onClick:i,title:"Close pop-up editor",class:"bio-properties-panel-feel-popup__close-btn",children:"Close"})})]})}function ob(e){return`bio-properties-panel-${e}`}function rb(e){const{id:t,label:n,onInput:o,value:r,switcherLabel:i,inline:s,onFocus:a,onBlur:l,inputRef:c,tooltip:u}=e,[h,p]=te(r);return oe((()=>{r!==h&&p(r)}),[r]),Lt("div",{class:It()("bio-properties-panel-toggle-switch",{inline:s}),children:[Lt("label",{class:"bio-properties-panel-label",for:ib(t),children:Lt(Mv,{value:u,forId:t,element:e.element,children:n})}),Lt("div",{class:"bio-properties-panel-field-wrapper",children:[Lt("label",{class:"bio-properties-panel-toggle-switch__switcher",children:[Lt("input",{ref:c,id:ib(t),class:"bio-properties-panel-input",type:"checkbox",onFocus:a,onBlur:l,name:t,onInput:e=>{(async()=>{o(!r)})(),p(e.target.value)},checked:!!h}),Lt("span",{class:"bio-properties-panel-toggle-switch__slider"})]}),i&&Lt("p",{class:"bio-properties-panel-toggle-switch__label",children:i})]})]})}function ib(e){return`bio-properties-panel-${e}`}function sb(e){const{debounce:t,disabled:n,displayLabel:o=!0,id:r,inputRef:i,label:s,max:a,min:l,onInput:c,step:u,value:h="",onFocus:p,onBlur:f}=e,[d,g]=te(h),m=se((()=>t((e=>{e.validity.valid&&c(e.value?parseFloat(e.value):void 0)}))),[c,t]);return oe((()=>{h!==d&&g(h)}),[h]),Lt("div",{class:"bio-properties-panel-numberfield",children:[o&&Lt("label",{for:ab(r),class:"bio-properties-panel-label",children:s}),Lt("input",{id:ab(r),ref:i,type:"number",name:r,spellCheck:"false",autoComplete:"off",disabled:n,class:"bio-properties-panel-input",max:a,min:l,onInput:e=>{m(e.target),g(e.target.value)},onFocus:p,onBlur:f,step:u,value:d})]})}function ab(e){return`bio-properties-panel-${e}`}function lb(e){return`bio-properties-panel-${e}`}tt(((e,t)=>{const{id:n,disabled:o,onInput:r,value:i,onFocus:s,onBlur:a}=e,l=ie();return t.current={focus:e=>{const t=l.current;t&&(t.focus(),"number"==typeof e&&(e>i.length&&(e=i.length),t.setSelectionRange(e,e)))}},Lt("input",{id:lb(n),type:"text",ref:l,name:n,spellCheck:"false",autoComplete:"off",disabled:o,class:"bio-properties-panel-input",onInput:e=>r(e.target.value),onFocus:s,onBlur:a,value:i||""})})),tt(((e,t)=>{const{id:n,debounce:o,disabled:r,onInput:i,value:s,min:a,max:l,step:c,onFocus:u,onBlur:h}=e,p=ie();return t.current={focus:e=>{const t=p.current;t&&(t.focus(),"number"==typeof e&&e!==1/0&&(e>s.length&&(e=s.length),t.setSelectionRange(e,e)))}},Lt(sb,{id:n,debounce:o,disabled:r,displayLabel:!1,inputRef:p,max:l,min:a,onInput:i,step:c,value:s,onFocus:u,onBlur:h})})),tt(((e,t)=>{const{id:n,disabled:o,onInput:r,value:i,onFocus:s,onBlur:a}=e,l=ie();return t.current={focus:()=>{const e=l.current;e&&(e.focus(),e.setSelectionRange(0,0))}},Lt("textarea",{id:lb(n),type:"text",ref:l,name:n,spellCheck:"false",autoComplete:"off",disabled:o,class:"bio-properties-panel-input",onInput:e=>r(e.target.value),onFocus:s,onBlur:a,value:i||"","data-gramm":"false"})})),tt(((e,t)=>{const{id:n,onInput:o,value:r,onFocus:i,onBlur:s,switcherLabel:a}=e,l=ie();return t.current={focus:()=>{const e=l.current;e&&e.focus()}},Lt(rb,{id:n,value:r,inputRef:l,onInput:o,onFocus:i,onBlur:s,switcherLabel:a})})),tt(((e,t)=>{const{id:n,disabled:o,onInput:r,value:i,onFocus:s,onBlur:a}=e,l=ie();return t.current={focus:()=>{const e=l.current;e&&e.focus()}},Lt("input",{ref:l,id:lb(n),name:n,onFocus:s,onBlur:a,type:"checkbox",class:"bio-properties-panel-input",onChange:({target:e})=>{r(e.checked)},checked:i,disabled:o})}));const cb={},ub={},hb={};function pb(e){const{element:t,headerProvider:n,placeholderProvider:o,groups:r,layoutConfig:i,layoutChanged:s,descriptionConfig:a,descriptionLoaded:l,tooltipConfig:c,tooltipLoaded:u,feelPopupContainer:h,eventBus:p}=e,[f,d]=te(fb(i));!function(e,t){const n=ie(!1);re((()=>{if(n.current)return(()=>{const e=fb(i);d(e)})();n.current=!0}),t)}(0,[i]),oe((()=>{"function"==typeof s&&s(f)}),[f,s]);const m={layout:f,setLayout:d,getLayoutForKey:(e,t)=>function(e,t,n){let o=e;return Te(t,(function(e){if(we(o))return o=void 0,!1;o=o[e]})),be(o)?n:o}(f,e,t),setLayoutForKey:(e,t)=>{const n=Ge({},f);!function(e,t,n){let o=e;Te(t,(function(e,r){if("number"!=typeof e&&"string"!=typeof e)throw new Error("illegal key type: "+typeof e+". Key should be of type number or string.");if("constructor"===e)throw new Error("illegal key: constructor");if("__proto__"===e)throw new Error("illegal key: __proto__");let i=t[r+1],s=o[e];xe(i)&&we(s)&&(s=o[e]=isNaN(+i)?{}:[]),be(i)?be(n)?delete o[e]:o[e]=n:o=s}))}(n,e,t),d(n)}},y=se((()=>function(e={}){return{...ub,...e}}(a)),[a]);oe((()=>{"function"==typeof l&&l(y)}),[y,l]);const v={description:y,getDescriptionForId:(e,t)=>y[e]&&y[e](t)},b=se((()=>function(e={}){return{...hb,...e}}(c)),[c]);oe((()=>{"function"==typeof u&&u(b)}),[b,u]);const x={tooltip:b,getTooltipForId:(e,t)=>b[e]&&b[e](t)},[w,O]=te({});$v("propertiesPanel.setErrors",(({errors:e})=>O(e)),p);const _={errors:w},k={eventBus:p},S={element:t};return o&&!t?Lt(Qv,{...o.getEmpty()}):o&&Oe(t)?Lt(Qv,{...o.getMultiple()}):Lt(Av.Provider,{value:S,children:Lt(Cv.Provider,{value:_,children:Lt(Ev.Provider,{value:v,children:Lt(Tv.Provider,{value:x,children:Lt(Av.Provider,{value:m,children:Lt(Pv.Provider,{value:k,children:Lt(tb,{element:t,eventBus:p,popupContainer:h,children:Lt("div",{class:"bio-properties-panel",children:[Lt(Sv,{element:t,headerProvider:n}),Lt("div",{class:"bio-properties-panel-scroll-container",children:r.map((e=>{const{component:n=qv,id:o}=e;return g(n,{...e,key:o,element:t})}))})]})})})})})})})})}function fb(e={},t=cb){return{...t,...e}}function db(e){const{element:t,entries:n=[],id:o,label:r,open:i,remove:s}=e,[a,l]=te(i),{onShow:c}=le(Av),u={...le(Av),onShow:ae((()=>{l(!0),Se(c)&&c()}),[c,l])},h="";return Lt("div",{"data-entry-id":o,class:It()("bio-properties-panel-collapsible-entry",a?"open":""),children:[Lt("div",{class:"bio-properties-panel-collapsible-entry-header",onClick:()=>l(!a),children:[Lt("div",{title:r||h,class:It()("bio-properties-panel-collapsible-entry-header-title",!r&&"empty"),children:r||h}),Lt("button",{type:"button",title:"Toggle list item",class:"bio-properties-panel-arrow bio-properties-panel-collapsible-entry-arrow",children:Lt(bv,{class:a?"bio-properties-panel-arrow-down":"bio-properties-panel-arrow-right"})}),s?Lt("button",{type:"button",title:"Delete item",class:"bio-properties-panel-remove-entry",onClick:s,children:Lt(xv,{})}):null]}),Lt("div",{class:It()("bio-properties-panel-collapsible-entry-entries",a?"open":""),children:Lt(Av.Provider,{value:u,children:n.map((e=>{const{component:n,id:o}=e;return g(n,{...e,element:t,key:o})}))})})]})}function gb(e){e.style.height="auto",e.style.height=`${e.scrollHeight+2}px`}function mb(e){const{id:t,label:n,debounce:o,onInput:r,value:i="",disabled:s,monospace:a,onFocus:l,onBlur:c,autoResize:u,rows:h=(u?1:2),tooltip:p}=e,[f,d]=te(i),g=Iv(t),m=se((()=>o((e=>r(e.value.length?e.value:void 0)))),[r,o]);return re((()=>{u&&gb(g.current)}),[]),oe((()=>{i!==f&&d(i)}),[i]),Lt("div",{class:"bio-properties-panel-textarea",children:[Lt("label",{for:vb(t),class:"bio-properties-panel-label",children:Lt(Mv,{value:p,forId:t,element:e.element,children:n})}),Lt("textarea",{ref:g,id:vb(t),name:t,spellCheck:"false",class:It()("bio-properties-panel-input",a?"bio-properties-panel-input-monospace":"",u?"auto-resize":""),onInput:e=>{m(e.target),u&&gb(e.target),d(e.target.value)},onFocus:l,onBlur:c,rows:h,value:f,disabled:s,"data-gramm":"false"})]})}function yb(e){const{element:t,id:n,description:o,debounce:r,label:i,getValue:s,setValue:a,rows:l,monospace:c,disabled:u,validate:h,onFocus:p,onBlur:f,autoResize:d,tooltip:g}=e,m=Lv(n),[y,v]=te(null);let b=s(t);oe((()=>{if(Se(h)){const e=h(b)||null;v(e)}}),[b]);const x=m||y;return Lt("div",{class:It()("bio-properties-panel-entry",x?"has-error":""),"data-entry-id":n,children:[Lt(mb,{id:n,label:i,value:b,onInput:e=>{let t=null;Se(h)&&(t=h(e)||null),a(e,t),v(t)},onFocus:p,onBlur:f,rows:l,debounce:r,monospace:c,disabled:u,autoResize:d,tooltip:g,element:t},t),x&&Lt("div",{class:"bio-properties-panel-error",children:x}),Lt(Hv,{forId:n,element:t,value:o})]})}function vb(e){return`bio-properties-panel-${e}`}function bb(e){const{debounce:t,disabled:n=!1,id:o,label:r,onInput:i,onFocus:s,onBlur:a,value:l="",tooltip:c}=e,[u,h]=te(l||""),p=Iv(o),f=se((()=>t((e=>i(e.value.length?e.value:void 0)))),[i,t]);return oe((()=>{l!==u&&h(l)}),[l]),Lt("div",{class:"bio-properties-panel-textfield",children:[Lt("label",{for:wb(o),class:"bio-properties-panel-label",children:Lt(Mv,{value:c,forId:o,element:e.element,children:r})}),Lt("input",{ref:p,id:wb(o),type:"text",name:o,spellCheck:"false",autoComplete:"off",disabled:n,class:"bio-properties-panel-input",onInput:e=>{f(e.target),h(e.target.value)},onFocus:s,onBlur:a,value:u})]})}function xb(e){return e&&!!e.value}function wb(e){return`bio-properties-panel-${e}`}function Ob(e){return function(t){return!1!==e?We(t,ke(e)?e:300):t}}Ob.$inject=["config.debounceInput"];var _b={debounceInput:["factory",Ob]};class kb{constructor(e){this._eventBus=e}isOpen(){return this._eventBus.fire("feelPopup._isOpen")}open(e,t,n){return this._eventBus.fire("feelPopup._open",{entryId:e,popupConfig:t,sourceElement:n})}close(){return this._eventBus.fire("feelPopup._close")}}kb.$inject=["eventBus"];var Sb={feelPopup:["type",kb]},Eb=["c","C"],Cb=["v","V"],Pb=["y","Y"],Ab=["z","Z"];function Tb(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Mb(e,t){return-1!==(e=Oe(e)?e:[e]).indexOf(t.key)||-1!==e.indexOf(t.code)}function Rb(e){return e.shiftKey}function jb(e){return Tb(e)&&!Rb(e)&&Mb(Ab,e)}function Bb(e){return Tb(e)&&(Mb(Pb,e)||Mb(Ab,e)&&Rb(e))}const Db=F({selectedElement:null,injector:null,getService:function(){return null}}),Lb={getElementLabel:function(e){return e.name},getElementIcon:function(e){return function(){var t;return Lt("span",{className:null==e||null===(t=e.businessObject)||void 0===t?void 0:t.THUMBNAIL_CLASS})}},getTypeLabel:function(e){var t;return null==e||null===(t=e.type)||void 0===t?void 0:t.replace(/(\B[A-Z])/g," $1").replace(/(\bNon Interrupting)/g,"($1)")}},$b={getEmpty:function(){return{text:"Select an element to edit its properties.",icon:null}},getMultiple:function(){return{text:"Multiple elements are selected. Select a single element to edit its properties.",icon:null}}};function Ib(e){return Ib="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ib(e)}function Nb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function qb(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,o=new Array(t);n1)return f(n);var o=n[0],r=s.getRootElement();return Qb(r),f(o||r),null};return l.on("selection.changed",e),function(){l.off("selection.changed",e)}}),[]),oe((function(){var e=function(e){var t=function(e,t){return Pe(e,(function(e){return e===t}))}(e.elements,p);t&&function(e,t){return e&&t.get(e.id)}(t,a)&&f(t)};return l.on("elements.changed",e),function(){l.off("elements.changed",e)}}),[p]),oe((function(){var e=function(e){var t=e.element;Qb(t)||f(t)};return l.on("root.added",e),function(){l.off("root.added",e)}}),[p]),oe((function(){var e=function(){f(p)};return l.on("propertiesPanel.providersChanged",e),function(){l.off("propertiesPanel.providersChanged",e)}}),[p]);var d=se((function(){return{selectedElement:p,injector:n,getService:function(e,t){return n.get(e,t)}}}),[p,n]),g=o(p),m=se((function(){return Me(g,(function(e,t){return Oe(p)?[]:t.getGroups(p)(e)}),[])}),[g,p]);return Lt(Db.Provider,{value:d,children:Lt(pb,{element:p,headerProvider:Lb,placeholderProvider:$b,groups:m,layoutConfig:r,layoutChanged:function(e){l.fire("propertiesPanel.layoutChanged",{layout:e})},descriptionConfig:i,descriptionLoaded:function(e){l.fire("propertiesPanel.descriptionLoaded",{description:e})},eventBus:l})})}function zb(e){return zb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zb(e)}function Vb(e,t){for(var n=0;n
');var c=n.get("commandStack",!1);c&&function(e,t,n){function o(e){e.preventDefault(),e.stopPropagation()}function r(e){return jb(e)?(n.undo(),o(e)):Bb(e)?(n.redo(),o(e)):null}t.on("keyboard.bind",(function(){cn.bind(e,"keydown",r)})),t.on("keyboard.unbind",(function(){cn.unbind(e,"keydown",r)}))}(this.container,o,c),o.on("diagram.destroy",(function(){r.detach()})),o.on("import.done",(function(e){var t=e.element;s&&r.attachTo(s),r.render(t)})),o.on("detach",(function(){r.detach()}))}var t,n;return t=e,n=[{key:"attachTo",value:function(e){if(!e)throw new Error("container required");e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"==typeof e&&(e=mn(e)),this.detach(),e.appendChild(this.container),this.eventBus.fire("propertiesPanel.attach")}},{key:"detach",value:function(){var e=this.container.parentNode;e&&(e.removeChild(this.container),this.eventBus.fire("propertiesPanel.detach"))}},{key:"registerProvider",value:function(e,t){t||(t=e,e=1e3),"function"==typeof t.getGroups?(this.eventBus.on("propertiesPanel.getProviders",e,(function(e){e.providers.push(t)})),this.eventBus.fire("propertiesPanel.providersChanged")):console.error("Properties provider does not implement #getGroups(element) API")}},{key:"getProviders",value:function(){var e=this.eventBus.createEvent({type:"propertiesPanel.getProviders",providers:[]});return this.eventBus.fire(e),e.providers}},{key:"render",value:function(e){var t=this.injector.get("canvas");e||(e=t.getRootElement()),function(e){return e&&(e.isImplicit||"__implicitroot"===e.id)}(e)||(I(Lt(Hb,{element:e,injector:this.injector,getProviders:this.getProviders.bind(this),layoutConfig:this.layoutConfig,descriptionConfig:this.descriptionConfig}),this.container),this.eventBus.fire("propertiesPanel.rendered"))}},{key:"destroy",value:function(){this.container&&(I(null,this.container),this.eventBus.fire("propertiesPanel.destroyed"))}}],n&&Vb(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();Xb.$inject=["config.propertiesPanel","injector","eventBus"];const Gb={__depends__:[_b,Sb],__init__:["propertiesPanel"],propertiesPanel:["type",Xb]};function Ub(){for(var e="",t=0;t<7;t++)e+="abcdefghijklmnopqrstuvwxyz1234567890".charAt(Math.floor(36*Math.random()));return e}function Yb(e,t){return(0,le(Db).getService)(e,t)}function Zb(e,t,n){n&&Object.keys(e).filter((function(e){return"style"!==e})).forEach((function(t){return delete e[t]})),Te(t,(function(t,n){e[n]=t}))}function Kb(e,t){var n,o=(null==e||null===(n=e.businessObject)||void 0===n?void 0:n.Type)||(null==e?void 0:e.Type)||e;return"Event"===t?"StartState"===o||"CompensationTrigger"===o||"Catch"===o||"Fail"===o||"Succeed"===o:"End"===t?"Fail"===o||"Succeed"===o:"Task"===t?"ServiceTask"===o||"ScriptTask"===o||"SubStateMachine"===o:"Connection"===t?"Transition"===o||"ChoiceEntry"===o||"ExceptionMatch"===o||"Compensation"===o:o===t}function Jb(e){return Jb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jb(e)}var ex=["element","id","label","parameterKey"];function tx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function nx(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,ex),s=Yb("debounceInput"),a=Yb("modeling");return function(e){const{element:t,id:n,description:o,debounce:r,disabled:i,label:s,getValue:a,setValue:l,validate:c,onFocus:u,onBlur:h,tooltip:p}=e,f=Lv(n),[d,g]=te(null);let m=a(t);oe((()=>{if(Se(c)){const e=c(m)||null;g(e)}}),[m]);const y=f||d;return Lt("div",{class:It()("bio-properties-panel-entry",y?"has-error":""),"data-entry-id":n,children:[Lt(bb,{debounce:r,disabled:i,id:n,label:s,onInput:e=>{let t=null;Se(c)&&(t=c(e)||null),l(e,t),g(t)},onFocus:u,onBlur:h,value:m,tooltip:p,element:t},t),y&&Lt("div",{class:"bio-properties-panel-error",children:y}),Lt(Hv,{forId:n,element:t,value:o})]})}(nx(nx({element:t,id:n,label:o},i),{},{debounce:s,getValue:function(e){return e.businessObject?e.businessObject[r]:null},setValue:function(e){a.updateProperties(t,ox({},r,e))}}))}function ix(e){return ix="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ix(e)}var sx=["element","id","label","parameterKey"];function ax(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function lx(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,sx),s=Yb("debounceInput"),a=Yb("modeling");return yb(lx(lx({element:t,id:n,label:o},i),{},{debounce:s,getValue:function(e){return e.businessObject?e.businessObject[r]:null},setValue:function(e){a.updateProperties(t,cx({},r,e))}}))}function hx(e){var t=e.element,n=Yb("debounceInput"),o=Yb("modeling");return db({id:"collapsible-props",label:"Props",element:t,entries:[{component:yb,element:t,id:"props",debounce:n,autoResize:!0,getValue:function(e){var t=Ge({},e.businessObject);return delete t.style,delete t.Catch,JSON.stringify(t,null,2)},validate:function(e){try{JSON.parse(e)}catch(e){return e.message}return null},setValue:function(e,n){try{JSON.parse(e)}catch(e){n=e}if(!n){var r=JSON.parse(e);o.updateProperties(t,r,!0)}}}],open:!0})}function px(e){var t=e.element;return db({id:"collapsible-props",label:"Style",element:t,entries:[{component:yb,element:t,id:"style",debounce:Yb("debounceInput"),autoResize:!0,disabled:!0,getValue:function(e){return JSON.stringify(e.businessObject.style,null,2)}}]})}function fx(e){return fx="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fx(e)}function dx(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,o=new Array(t);n"+e+"",t=!0);var n=function(e){var t;return(t=new DOMParser).async=!1,t.parseFromString(e,"text/xml")}(e);if(!t)return n;for(var o=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)o.appendChild(r.firstChild);return o}function Ix(e,t){var n;return"<"===e.charAt(0)?(n=$x(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Dx.svg,e),t&&Px(n,t),n}var Nx=null;function qx(){return null===Nx&&(Nx=Ix("svg")),Nx}function Fx(e,t){var n,o,r=Object.keys(t);for(n=0;o=r[n];n++)e[o]=t[o];return e}function Qx(e){return e?qx().createSVGTransformFromMatrix(e):qx().createSVGTransform()}var Hx=/([&<>]{1})/g,zx=/([\n\r"]{1})/g,Vx={"&":"&","<":"<",">":">",'"':"'"};function Wx(e,t){return e.replace(t,(function(e,t){return Vx[t]||t}))}function Xx(e,t){var n,o,r,i,s;switch(e.nodeType){case 3:t.push(Wx(e.textContent,Hx));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,o=(r=e.attributes).length;n"),n=0,o=(s=e.childNodes).length;n")}else t.push("/>");break;case 8:t.push("\x3c!--",Wx(e.nodeValue,Hx),"--\x3e");break;case 4:t.push("");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function Gx(e,t){if(void 0!==t){try{!function(e,t){var n=$x(t);if(jx(e),t){(function(e){return"#document-fragment"===e.nodeName})(n)||(n=n.documentElement);for(var o,r=(o=n.childNodes,Array.prototype.slice.call(o)),i=0;i{const t=e.match(ow);return(t&&t[1]||e).trim()}))||[]}function iw(e,t){t=t||{get:function(e,t){if(n.push(e),!1===t)return null;throw s(`No provider for "${e}"!`)}};const n=[],o=this._providers=Object.create(t._providers||null),r=this._instances=Object.create(null),i=r.injector=this,s=function(e){const t=n.join(" -> ");return n.length=0,new Error(t?`${e} (Resolving: ${t})`:e)};function a(e,i){if(!o[e]&&-1!==e.indexOf(".")){const t=e.split(".");let n=a(t.shift());for(;t.length;)n=n[t.shift()];return n}if(Jx(r,e))return r[e];if(Jx(o,e)){if(-1!==n.indexOf(e))throw n.push(e),s("Cannot resolve circular dependency!");return n.push(e),r[e]=o[e][0](o[e][1]),n.pop(),r[e]}return t.get(e,i)}function l(e,t){if(void 0===t&&(t={}),"function"!=typeof e){if(!Kx(e))throw s(`Cannot invoke "${e}". Expected a function!`);e=ew(e.slice())}return{fn:e,dependencies:(e.$inject||rw(e)).map((e=>Jx(t,e)?t[e]:a(e)))}}function c(e){const{fn:t,dependencies:n}=l(e);return new(Function.prototype.bind.apply(t,[null].concat(n)))}function u(e,t,n){const{fn:o,dependencies:r}=l(e,n);return o.apply(t,r)}function h(e){return ew((t=>e.get(t)))}function p(e,t){if(t&&t.length){const n=Object.create(null),r=Object.create(null),i=[],s=[],a=[];let l,c,u,p;for(let e in o)l=o[e],-1!==t.indexOf(e)&&("private"===l[2]?(c=i.indexOf(l[3]),-1===c?(u=l[3].createChild([],t),p=h(u),i.push(l[3]),s.push(u),a.push(p),n[e]=[p,e,"private",u]):n[e]=[a[c],e,"private",s[c]]):n[e]=[l[2],l[1]],r[e]=!0),"factory"!==l[2]&&"type"!==l[2]||!l[1].$scope||t.forEach((t=>{-1!==l[1].$scope.indexOf(t)&&(n[e]=[l[2],l[1]],r[t]=!0)}));t.forEach((e=>{if(!r[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')})),e.unshift(n)}return new iw(e,i)}const f={factory:u,type:c,value:function(e){return e}};function d(e,t){const n=e.__init__||[];return function(){n.forEach((e=>{"string"==typeof e?t.get(e):t.invoke(e)}))}}function g(e){const t=e.__exports__;if(t){const n=e.__modules__,r=Object.keys(e).reduce(((t,n)=>("__exports__"!==n&&"__modules__"!==n&&"__init__"!==n&&"__depends__"!==n&&(t[n]=e[n]),t)),Object.create(null)),i=p((n||[]).concat(r)),s=ew((function(e){return i.get(e)}));t.forEach((function(e){o[e]=[s,e,"private",i]}));const a=(e.__init__||[]).slice();return a.unshift((function(){i.init()})),d(e=Object.assign({},e,{__init__:a}),i)}return Object.keys(e).forEach((function(t){if("__init__"===t||"__depends__"===t)return;if("private"===e[t][2])return void(o[t]=e[t]);const n=e[t][0],r=e[t][1];o[t]=[f[n],sw(n,r),n]})),d(e,i)}function m(e,t){return-1!==e.indexOf(t)||-1!==(e=(t.__depends__||[]).reduce(m,e)).indexOf(t)?e:e.concat(t)}this.get=a,this.invoke=u,this.instantiate=c,this.createChild=p,this.init=function(e){const t=e.reduce(m,[]).map(g);let n=!1;return function(){n||(n=!0,t.forEach((e=>e())))}}(e)}function sw(e,t){return"value"!==e&&Kx(t)&&(t=ew(t.slice())),t}var aw=1e3;function lw(e,t){var n=this;t=t||aw,e.on(["render.shape","render.connection"],t,(function(e,t){var o=e.type,r=t.element,i=t.gfx,s=t.attrs;if(n.canRender(r))return"render.shape"===o?n.drawShape(i,r,s):n.drawConnection(i,r,s)})),e.on(["render.getShapePath","render.getConnectionPath"],t,(function(e,t){if(n.canRender(t))return"render.getShapePath"===e.type?n.getShapePath(t):n.getConnectionPath(t)}))}function cw(e){return e.flat().join(",").replace(/,?([A-z]),?/g,"$1")}function uw(e){return["L",e.x,e.y]}function hw(e,t){const n=e.length,o=[(r=e[0],["M",r.x,r.y])];var r,i,s,a;for(let r=1;rr||void 0===r)&&(r=a+u),(l+c>i||void 0===i)&&(i=l+c)})),{x:n,y:o,height:i-o,width:r-n}}function ww(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Ow(e){return!(!e||!e.isFrame)}function _w(e,t){return Ge({},e||{},t||{})}function kw(e,t){lw.call(this,e,1),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}lw.prototype.canRender=function(e){},lw.prototype.drawShape=function(e,t){},lw.prototype.drawConnection=function(e,t){},lw.prototype.getShapePath=function(e){},lw.prototype.getConnectionPath=function(e){},Ox(kw,lw),kw.prototype.canRender=function(){return!0},kw.prototype.drawShape=function(e,t,n){var o=Ix("rect");return Px(o,{x:0,y:0,width:t.width||0,height:t.height||0}),Ow(t)?Px(o,Ge({},this.FRAME_STYLE,n||{})):Px(o,Ge({},this.SHAPE_STYLE,n||{})),kx(e,o),o},kw.prototype.drawConnection=function(e,t,n){var o=dw(t.waypoints,Ge({},this.CONNECTION_STYLE,n||{}));return kx(e,o),o},kw.prototype.getShapePath=function(e){var t=e.x,n=e.y,o=e.width;return cw([["M",t,n],["l",o,0],["l",0,e.height],["l",-o,0],["z"]])},kw.prototype.getConnectionPath=function(e){var t,n,o=e.waypoints,r=[];for(t=0;n=o[t];t++)n=n.original||n,r.push([0===t?"M":"L",n.x,n.y]);return cw(r)},kw.$inject=["eventBus","styles"];const Sw={__init__:["defaultRenderer"],defaultRenderer:["type",kw],styles:["type",function(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(e,t,n){return Ge(this.style(t,n),{class:e})},this.style=function(t,n){Oe(t)||n||(n=t,t=[]);var o=Me(t,(function(t,n){return Ge(t,e[n]||{})}),{});return n?Ge(o,n):o},this.computeStyle=function(e,n,o){return Oe(n)||(o=n,n=[]),t.style(n||[],Ge({},o,e||{}))}}]};function Ew(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function Cw(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var o=e.indexOf(t);if(-1!==o){if(o===n)return;if(-1===n)return;e.splice(o,1)}-1!==n?e.splice(n,0,t):e.push(t)}}function Pw(e,t){return e&&t?e.indexOf(t):-1}function Aw(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function Tw(e,t,n,o){if(void 0===o&&(o=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),i=Aw(e,t);return Math.abs(r/i)<=o}var Mw=2;function Rw(e,t){var n=Array.from(arguments).flat();const o={x:"v",y:"h"};for(const[e,t]of Object.entries(o))if(jw(e,n))return t;return!1}function jw(e,t){const n=t[0];return Re(t,(function(t){return Math.abs(n[e]-t[e])<=Mw}))}function Bw(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Dw=n(720),Lw=n.n(Dw);function $w(e){return _e(e)&&Ce(e,"waypoints")}function Iw(e){return _e(e)&&Ce(e,"labelTarget")}function Nw(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function qw(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Fw(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Qw(e){return $w(e)?function(e){for(var t=e.waypoints,n=t.reduce((function(e,n,o){var r=t[o-1];if(r){var i=e[e.length-1],s=i&&i.endLength||0,a=function(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}(r,n);e.push({start:r,end:n,startLength:s,endLength:s+a,length:a})}return e}),[]),o=n.reduce((function(e,t){return e+t.length}),0)/2,r=0,i=n[r];i.endLength=r.right,a=o.top-n.y>=r.bottom,l=i?"top":a?"bottom":null,c=o.right+n.x<=r.left?"left":s?"right":null;return c&&l?l+"-"+c:c||l||"intersect"}function zw(e,t,n){var o=function(e,t){return Lw()(e,t)}(e,t);return 1===o.length||2===o.length&&Aw(o[0],o[1])<1?Nw(o[0]):o.length>1?(o=qe(o,(function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t})),Nw(o[n?0:o.length-1])):null}function Vw(e,t){return Math.round(e*t)/t}function Ww(e){return ke(e)?e+"px":e}function Xw(e,t,n){const o=Ix("g");Tx(o).add(t);const r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(o,e.childNodes[r]||null),o}const Gw={shape:["x","y","width","height"],connection:["waypoints"]};function Uw(e,t,n,o){this._eventBus=t,this._elementRegistry=o,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._init(e||{})}function Yw(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Uw.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Uw.prototype._init=function(e){const t=this._eventBus,n=this._container=function(e){const t=(e=Ge({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Wt(n,{position:"relative",overflow:"hidden",width:Ww(e.width),height:Ww(e.height)}),t.appendChild(n),n}(e),o=this._svg=Ix("svg");Px(o,{width:"100%",height:"100%"}),kx(n,o);const r=this._viewport=Xw(o,"viewport");e.deferUpdate&&(this._viewboxChanged=We(Xe(this._viewboxChanged,this),300)),t.on("diagram.init",(()=>{t.fire("canvas.init",{svg:o,viewport:r})})),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],(()=>{delete this._cachedViewbox})),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Uw.prototype._destroy=function(){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Uw.prototype._clear=function(){this._elementRegistry.getAll().forEach((e=>{const t=ww(e);"root"===t?this.removeRootElement(e):this._removeElement(e,t)})),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Uw.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Uw.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),void 0!==t&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Uw.prototype._getChildIndex=function(e){return Me(this._layers,(function(t,n){return n.visible&&e>=n.index&&t++,t}),0)},Uw.prototype._createLayer=function(e,t){void 0===t&&(t=1);const n=this._getChildIndex(t);return{group:Xw(this._viewport,"layer-"+e,n),index:t,visible:!0}},Uw.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,o=t.group,r=t.index;if(t.visible)return o;const i=this._getChildIndex(r);return n.insertBefore(o,n.childNodes[i]||null),t.visible=!0,o},Uw.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible?(Rx(n),t.visible=!1,n):n},Uw.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Rx(t.group))},Uw.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Uw.prototype.findRoot=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),!e)return;const t=this._findPlaneForRoot(function(e){for(;e.parent;)e=e.parent;return e}(e))||{};return t.rootElement},Uw.prototype.getRootElements=function(){return this._planes.map((function(e){return e.rootElement}))},Uw.prototype._findPlaneForRoot=function(e){return Pe(this._planes,(function(t){return t.rootElement===e}))},Uw.prototype.getContainer=function(){return this._container},Uw.prototype._updateMarker=function(e,t,n){let o;e.id||(e=this._elementRegistry.get(e)),o=this._elementRegistry._elements[e.id],o&&(Te([o.gfx,o.secondaryGfx],(function(e){e&&(n?Tx(e).add(t):Tx(e).remove(t))})),this._eventBus.fire("element.marker.update",{element:e,gfx:o.gfx,marker:t,add:!!n}))},Uw.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Uw.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Uw.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),Tx(this.getGraphics(e)).has(t)},Uw.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Uw.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Uw.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const o=this.getLayer(n,0);return this.hideLayer(n),this._addRoot(e,o),this._planes.push({rootElement:e,layer:o}),e},Uw.prototype.removeRootElement=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter((function(t){return t.rootElement!==e})),this._rootElement===e&&(this._rootElement=null),e},Uw.prototype.setRootElement=function(e){if(e===this._rootElement)return;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},Uw.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Uw.prototype._addRoot=function(e,t){const n=this._elementRegistry,o=this._eventBus;o.fire("root.add",{element:e}),n.add(e,t),o.fire("root.added",{element:e,gfx:t})},Uw.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},Uw.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=Gw[e],o=Re(n,(function(e){return void 0!==t[e]}));if(!o)throw new Error("must supply { "+n.join(", ")+" } with "+e)},Uw.prototype._setParent=function(e,t,n){Cw(t.children,e,n),e.parent=t},Uw.prototype._addElement=function(e,t,n,o){n=n||this.getRootElement();const r=this._eventBus,i=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,o);const s=i.create(e,t,o);return this._elementRegistry.add(t,s),i.update(e,t,s),r.fire(e+".added",{element:t,gfx:s}),t},Uw.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Uw.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Uw.prototype._removeElement=function(e,t){const n=this._elementRegistry,o=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e))return r.fire(t+".remove",{element:e}),o.remove(e),Ew(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Uw.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Uw.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Uw.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Uw.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Uw.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Uw.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;const t=this._viewport,n=this.getSize();let o,r,i,s,a,l,c;return e?(this._changeViewbox((function(){a=Math.min(n.width/e.width,n.height/e.height);const o=this._svg.createSVGMatrix().scale(a).translate(-e.x,-e.y);Yx(t,o)})),e):(i=this._rootElement?this.getActiveLayer():null,o=i&&i.getBBox()||{},s=Yx(t),r=s?s.matrix:function(e,t,n,o,r,i){var s=qx().createSVGMatrix();switch(arguments.length){case 0:return s;case 1:return Fx(s,e);case 6:return Fx(s,{a:e,b:t,c:n,d:o,e:r,f:i})}}(),a=Vw(r.a,1e3),l=Vw(-r.e||0,1e3),c=Vw(-r.f||0,1e3),e=this._cachedViewbox={x:l?l/a:0,y:c?c/a:0,width:n.width/a,height:n.height/a,scale:a,inner:{width:o.width||0,height:o.height||0,x:o.x||0,y:o.y||0},outer:n})},Uw.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox((function(){e=Ge({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Yw(t,n)})),{x:n.e,y:n.f}},Uw.prototype.scrollToElement=function(e,t){let n=100;"string"==typeof e&&(e=this._elementRegistry.get(e));const o=this.findRoot(e);if(o!==this.getRootElement()&&this.setRootElement(o),o===e)return;t||(t={}),"number"==typeof t&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const r=xw(e),i=qw(r),s=this.viewbox(),a=this.zoom();let l,c;s.y+=t.top/a,s.x+=t.left/a,s.width-=(t.right+t.left)/a,s.height-=(t.bottom+t.top)/a;const u=qw(s);if(r.width=0&&o.y>=0&&o.x+o.width<=n.width&&o.y+o.height<=n.height&&!e?i={x:0,y:0,width:Math.max(o.width+o.x,n.width),height:Math.max(o.height+o.y,n.height)}:(r=Math.min(1,n.width/o.width,n.height/o.height),i={x:o.x+(e?o.width/2-n.width/r/2:0),y:o.y+(e?o.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(i),this.viewbox(!1).scale},Uw.prototype._setZoom=function(e,t){const n=this._svg,o=this._viewport,r=n.createSVGMatrix(),i=n.createSVGPoint();let s,a,l,c,u;l=o.getCTM();const h=l.a;return t?(s=Ge(i,t),a=s.matrixTransform(l.inverse()),c=r.translate(a.x,a.y).scale(1/h*e).translate(-a.x,-a.y),u=l.multiply(c)):u=r.scale(e),Yw(this._viewport,u),u},Uw.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Uw.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;return n=e.waypoints?this.getGraphics(e).getBBox():e,{x:n.x*t.scale-t.x*t.scale,y:n.y*t.scale-t.y*t.scale,width:n.width*t.scale,height:n.height*t.scale}},Uw.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Zw="data-element-id";function Kw(e){this._elements={},this._eventBus=e}Kw.$inject=["eventBus"],Kw.prototype.add=function(e,t,n){var o=e.id;this._validateId(o),Px(t,Zw,o),n&&Px(n,Zw,o),this._elements[o]={element:e,gfx:t,secondaryGfx:n}},Kw.prototype.remove=function(e){var t=this._elements,n=e.id||e,o=n&&t[n];o&&(Px(o.gfx,Zw,""),o.secondaryGfx&&Px(o.secondaryGfx,Zw,""),delete t[n])},Kw.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),o=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,o)},Kw.prototype.updateGraphics=function(e,t,n){var o=e.id||e,r=this._elements[o];return n?r.secondaryGfx=t:r.gfx=t,t&&Px(t,Zw,o),t},Kw.prototype.get=function(e){var t;t="string"==typeof e?e:e&&Px(e,Zw);var n=this._elements[t];return n&&n.element},Kw.prototype.filter=function(e){var t=[];return this.forEach((function(n,o){e(n,o)&&t.push(n)})),t},Kw.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),o=0;o");return Ge(new n,t)}(e,t)};var fO="__fn",dO=Array.prototype.slice;function gO(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function mO(){}function yO(e){return e.childNodes[0]}function vO(e,t,n){var o=Qx();o.setTranslate(t,n),Yx(e,o)}function bO(e,t){this._eventBus=e,this._elementRegistry=t}function xO(e,t,n){var o=n||t.firstChild;e!==o&&t.insertBefore(e,o)}gO.prototype.on=function(e,t,n,o){if(e=Oe(e)?e:[e],Se(t)&&(o=n,n=t,t=1e3),!ke(t))throw new Error("priority must be a number");var r=n;o&&((r=Xe(n,o))[fO]=n[fO]||n);var i=this;e.forEach((function(e){i._addListener(e,{priority:t,callback:r,next:null})}))},gO.prototype.once=function(e,t,n,o){var r=this;if(Se(t)&&(o=n,n=t,t=1e3),!ke(t))throw new Error("priority must be a number");function i(){i.__isTomb=!0;var t=n.apply(o,arguments);return r.off(e,i),t}i[fO]=n,this.on(e,t,i)},gO.prototype.off=function(e,t){e=Oe(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},gO.prototype.createEvent=function(e){var t=new mO;return t.init(e),t},gO.prototype.fire=function(e,t){var n,o,r,i;if(i=dO.call(arguments),"object"==typeof e&&(e=(t=e).type),!e)throw new Error("no event type specified");if(o=this._listeners[e]){n=t instanceof mO?t:this.createEvent(t),i[0]=n;var s=n.type;e!==s&&(n.type=e);try{r=this._invokeListeners(n,i,o)}finally{e!==s&&(n.type=s)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},gO.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},gO.prototype._destroy=function(){this._listeners={}},gO.prototype._invokeListeners=function(e,t,n){for(var o;n&&!e.cancelBubble;)o=this._invokeListener(e,t,n),n=n.next;return o},gO.prototype._invokeListener=function(e,t,n){var o;if(n.callback.__isTomb)return o;try{o=function(e,t){return e.apply(null,t)}(n.callback,t),void 0!==o&&(e.returnValue=o,e.stopPropagation()),!1===o&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener",e),e}return o},gO.prototype._addListener=function(e,t){var n,o=this._getListeners(e);if(o){for(;o;){if(o.priority1&&(u=!0),e.elements.length})),u)return l[e]=_O(n).center,l;o=t[0],r=_O(t=qe(t,(function(e){return e[s]+e[a]}))),l[e]=function(e,t){return Math.round((e[s]+t[s]+t[a])/2)}(o,r)}return l},CO.prototype.trigger=function(e,t){var n,o=this._modeling,r=Ae(e,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));if(Oe(n=this._rules.allowed("elements.align",{elements:r}))&&(r=n),!(r.length<2)&&n){var i=qe(r,EO[t]),s=this._alignmentPosition(t,i);o.alignElements(i,s)}};const PO={__init__:["alignElements"],alignElements:["type",CO]};function AO(e){this._commandStack=e.get("commandStack",!1)}AO.$inject=["injector"],AO.prototype.allowed=function(e,t){var n=!0,o=this._commandStack;return o&&(n=o.canExecute(e,t)),void 0===n||n};const TO={__init__:["rules"],rules:["type",AO]};function MO(e,t){if("function"!=typeof t)throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}function RO(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function jO(e,t){return{x:e.x-t.x,y:e.y-t.y}}function BO(e,t,n){var o=RO(t),r=RO(n),i=jO(e,o),s=i.x*(n.width/t.width),a=i.y*(n.height/t.height);return Nw({x:r.x+s,y:r.y+a})}function DO(e,t,n){var o=RO(e),r=RO(t),i=RO(n),s=jO(e,o),a=jO(o,r),l=function(e,t,n){var o=qw(t),r=qw(n);if(function(e,t){return function(e,t){return e.right!==t.right&&e.left!==t.left}(e,t)||function(e,t){return e.top!==t.top&&e.bottom!==t.bottom}(e,t)}(o,r))return null;var i,s=Hw(t,e);if("top"===s)i={x:0,y:r.bottom-o.bottom};else if("bottom"===s)i={x:0,y:r.top-o.top};else if("right"===s)i={x:r.left-o.left,y:0};else{if("left"!==s)return null;i={x:r.right-o.right,y:0}}return Hw(n,{x:e.x+i.x,y:e.y+i.y})!==s?null:i}(o,t,n);if(l)return l;var c=a.x*(n.width/t.width),u=a.y*(n.height/t.height),h=i.x+c,p=i.y+u;return Nw({x:h+s.x-e.x,y:p+s.y-e.y})}function LO(e){this._eventBus=e}function $O(e){return function(t,n,o,r,i){(Se(t)||ke(t))&&(i=r,r=o,o=n,n=t,t=null),this.on(t,e,n,o,r,i)}}LO.$inject=["eventBus"],LO.prototype.on=function(e,t,n,o,r,i){if((Se(t)||ke(t))&&(i=r,r=o,o=n,n=t,t=null),Se(n)&&(i=r,r=o,o=n,n=1e3),_e(r)&&(i=r,r=!1),!Se(o))throw new Error("handlerFn must be a function");Oe(e)||(e=[e]);var s=this._eventBus;Te(e,(function(e){var a=["commandStack",e,t].filter((function(e){return e})).join(".");s.on(a,n,r?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(o,i):o,i)}))},LO.prototype.canExecute=$O("canExecute"),LO.prototype.preExecute=$O("preExecute"),LO.prototype.preExecuted=$O("preExecuted"),LO.prototype.execute=$O("execute"),LO.prototype.executed=$O("executed"),LO.prototype.postExecute=$O("postExecute"),LO.prototype.postExecuted=$O("postExecuted"),LO.prototype.revert=$O("revert"),LO.prototype.reverted=$O("reverted");var IO="attach-ok";function NO(e,t,n,o,r){LO.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",1401,(function(e){var t,n,o=e.context,r=o.shapes,i=o.validatedShapes;o.shapes=(n=qO(t=r),Ne("id",t,n)),o.validatedShapes=function(e){var t=$e(e,"id");return Ae(e,(function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}(i)})),i&&t.on("shape.move.start",251,(function(e){var t=e.context;Te(qO(t.shapes),(function(e){i.makeDraggable(t,e,!0),Te(e.labels,(function(e){i.makeDraggable(t,e,!0)}))}))})),i&&t.on("shape.move.start",(function(e){var o=e.context.shapes;if(1===o.length){var r=o[0].host;r&&(n.addMarker(r,IO),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(r,IO)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;Te(qO(t.shapes),(function(e){n.add(e,n.topLevel[e.host.id])}))})),this.postExecuted("elements.move",(function(e){var t=e.context,n=t.shapes,o=t.newHost;o&&1!==n.length||Te(o?n:Ae(n,(function(e){var t,o=e.host;return function(e){return!!e.host}(e)&&(t=o,!(-1!==n.indexOf(t)))})),(function(e){r.updateAttachment(e,o)}))})),this.postExecuted("elements.move",(function(e){Te(e.context.shapes,(function(e){Te(e.attachers,(function(e){Te(e.outgoing.slice(),(function(e){o.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)})),Te(e.incoming.slice(),(function(e){o.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,o=t.host;o&&r.updateAttachment(n,o)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,i=t.newShape;MO(n.attachers,(function(e){"attach"===o.allowed("elements.move",{target:i,shapes:[e]})?r.updateAttachment(e,i):r.removeShape(e)})),i.attachers.length&&Te(i.attachers,(function(e){var t=DO(e,n,i);r.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,o=t.oldBounds,i=t.newBounds,s=n.attachers;!1!==(t.hints||{}).attachSupport&&Te(s,(function(e){var t=DO(e,o,i);r.moveShape(e,t,e.parent),Te(e.labels,(function(e){r.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;MO(t.attachers,(function(e){r.removeShape(e)})),t.host&&r.updateAttachment(t,null)}))}function qO(e){return me(Be(e,(function(e){return e.attachers||[]})))}Ox(NO,LO),NO.$inject=["injector","eventBus","canvas","rules","modeling"];const FO={__depends__:[TO],__init__:["attachSupport"],attachSupport:["type",NO]};function QO(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function HO(e){return e.originalEvent||e.srcEvent}function zO(e){QO(e),QO(HO(e))}function VO(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function WO(e,t,n){var o,r,i=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,o=i._findTargetGfx(n),r=o&&e.get(o);o&&r&&(t.stopPropagation(),s.hover({element:r,gfx:o}),s.move(n))}}(t)}))})),t.on("element.hover",(function(e){o=e.gfx,r=e.element})),t.on("element.hover",1500,(function(e){r&&t.fire("element.out",{element:r,gfx:o})})),t.on("element.out",(function(){o=null,r=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=VO(e),Jt(document.elementFromPoint(t.x,t.y),"svg, .djs-element",!0)}}WO.$inject=["elementRegistry","eventBus","injector"];const XO={__init__:["hoverFix"],hoverFix:["type",WO]};function GO(){return/mac/i.test(navigator.platform)}function UO(e,t){return(HO(e)||e).button===t}function YO(e){return UO(e,0)}function ZO(e){var t=HO(e)||e;return!!YO(e)&&(GO()?t.metaKey:t.ctrlKey)}function KO(e){var t=HO(e)||e;return YO(e)&&t.shiftKey}function JO(e){return!0}function e_(e){return YO(e)||function(e){return UO(e,1)}(e)}function t_(e,t,n){var o=this;function r(n,o,r){var i,s;(function(e,t){return!(l[e]||YO)(t)})(n,o)||(r?s=t.getGraphics(r):(i=o.delegateTarget||o.target)&&(s=i,r=t.get(s)),s&&r&&!1===e.fire(n,{element:r,gfx:s,originalEvent:o})&&(o.stopPropagation(),o.preventDefault()))}var i={};function s(e){return i[e]}var a={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":JO,"element.mousedown":e_,"element.mouseup":e_,"element.click":e_,"element.dblclick":e_};function c(e,t,n,o){var s=i[n]=function(e){r(n,e)};o&&(l[n]=o),s.$delegate=hn(e,"svg, .djs-element",t,s)}function u(e,t,n){var o=s(n);o&&pn(e,t,o.$delegate)}e.on("canvas.destroy",(function(e){!function(e){Te(a,(function(t,n){u(e,n,t)}))}(e.svg)})),e.on("canvas.init",(function(e){!function(e){Te(a,(function(t,n){c(e,n,t)}))}(e.svg)})),e.on(["shape.added","connection.added"],(function(t){var n=t.element,o=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:o})})),e.on(["shape.changed","connection.changed"],500,(function(t){var n=t.element,o=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:o})})),e.on("interactionEvents.createHit",500,(function(e){var t=e.element,n=e.gfx;o.createDefaultHit(t,n)})),e.on("interactionEvents.updateHit",(function(e){var t=e.element,n=e.gfx;o.updateDefaultHit(t,n)}));var h=d("djs-hit djs-hit-stroke"),p=d("djs-hit djs-hit-click-stroke"),f={all:d("djs-hit djs-hit-all"),"click-stroke":p,stroke:h,"no-move":d("djs-hit djs-hit-no-move")};function d(e,t){return t=Ge({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function g(e,t){var n=f[t];if(!n)throw new Error("invalid hit type <"+t+">");return Px(e,n),e}function m(e,t){kx(e,t)}this.removeHits=function(e){Te(yn(".djs-hit",e),Rx)},this.createDefaultHit=function(e,t){var n,o=e.waypoints,r=e.isFrame;return o?this.createWaypointsHit(t,o):(n=r?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n=dw(t);return g(n,"stroke"),m(e,n),n},this.createBoxHit=function(e,t,n){n=Ge({x:0,y:0},n);var o=Ix("rect");return g(o,t),Px(o,n),m(e,o),o},this.updateDefaultHit=function(e,t){var n=mn(".djs-hit",t);if(n)return e.waypoints?gw(n,e.waypoints):Px(n,{width:e.width,height:e.height}),n},this.fire=r,this.triggerMouseEvent=function(e,t,n){var o=a[e];if(!o)throw new Error("unmapped DOM event name <"+e+">");return r(o,t,n)},this.mouseHandler=s,this.registerEvent=c,this.unregisterEvent=u}t_.$inject=["eventBus","elementRegistry","styles"];const n_={__init__:["interactionEvents"],interactionEvents:["type",t_]};function o_(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),o=this;function r(e){var t=Ix("rect");return Px(t,Ge({x:0,y:0,rx:4,width:100,height:100},n)),t}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,i=mn(".djs-outline",n);i||kx(n,i=o.getOutline(t)||r()),o.updateShapeOutline(i,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,i=mn(".djs-outline",n);i||kx(n,i=r()),o.updateConnectionOutline(i,t)}))}o_.prototype.updateShapeOutline=function(e,t){var n=!1,o=this._getProviders();o.length&&Te(o,(function(o){n=n||o.updateOutline(t,e)})),n||Px(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},o_.prototype.updateConnectionOutline=function(e,t){var n=xw(t);Px(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},o_.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},o_.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},o_.prototype.getOutline=function(e){var t;return Te(this._getProviders(),(function(n){Se(n.getOutline)&&(t=t||n.getOutline(e))})),t},o_.$inject=["eventBus","styles","elementRegistry"];const r_={__init__:["outline"],outline:["type",o_]};function i_(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],(function(e){var t=e.element;n.deselect(t)})),e.on(["diagram.clear","root.set"],(function(e){n.select(null)}))}i_.$inject=["eventBus","canvas"],i_.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var o=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:o,newSelection:t})}},i_.prototype.get=function(){return this._selectedElements},i_.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},i_.prototype.select=function(e,t){var n=this._selectedElements,o=n.slice();Oe(e)||(e=e?[e]:[]);var r=this._canvas,i=r.getRootElement();e=e.filter((function(e){var t=r.findRoot(e);return i===t})),t?Te(e,(function(e){-1===n.indexOf(e)&&n.push(e)})):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:o,newSelection:n})};var s_="hover",a_="selected";function l_(e,t,n){this._canvas=e;var o=this;function r(t,n){e.addMarker(t,n)}function i(t,n){e.removeMarker(t,n)}this._multiSelectionBox=null,t.on("element.hover",(function(e){r(e.element,s_)})),t.on("element.out",(function(e){i(e.element,s_)})),t.on("selection.changed",(function(e){var t=e.oldSelection,n=e.newSelection;Te(t,(function(e){-1===n.indexOf(e)&&function(e){i(e,a_)}(e)})),Te(n,(function(e){-1===t.indexOf(e)&&function(e){r(e,a_)}(e)})),o._updateSelectionOutline(n)})),t.on("element.changed",(function(e){n.isSelected(e.element)&&o._updateSelectionOutline(n.get())}))}function c_(e,t,n,o){e.on("create.end",500,(function(e){var n=e.context,o=n.canExecute,r=n.elements,i=(n.hints||{}).autoSelect;if(o){if(!1===i)return;Oe(i)?t.select(i):t.select(r.filter(u_))}})),e.on("connect.end",500,(function(e){var n=e.context.connection;n&&t.select(n)})),e.on("shape.move.end",500,(function(e){var n=e.previousSelection||[],r=o.get(e.context.shape.id);Pe(n,(function(e){return r.id===e.id}))||t.select(r)})),e.on("element.click",(function(e){if(YO(e)){var o=e.element;o===n.getRootElement()&&(o=null);var r=t.isSelected(o),i=t.get().length>1,s=ZO(e)||KO(e);if(r&&i)return s?t.deselect(o):t.select(o);r?t.deselect(o):t.select(o,s)}}))}function u_(e){return!e.hidden}l_.$inject=["canvas","eventBus","selection"],l_.prototype._updateSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");jx(t);var n=e.length>1;if(Tx(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var o=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(xw(e)),r=Ix("rect");Px(r,Ge({rx:3},o)),Tx(r).add("djs-selection-outline"),kx(t,r)}},c_.$inject=["eventBus","selection","canvas","elementRegistry"];const h_={__init__:["selectionVisuals","selectionBehavior"],__depends__:[n_,r_],selection:["type",i_],selectionVisuals:["type",l_],selectionBehavior:["type",c_]};var p_=/^djs-cursor-.*$/;function f_(e){var t=Ut(document.body);t.removeMatching(p_),e&&t.add("djs-cursor-"+e)}function d_(){f_(null)}var g_=5e3;function m_(e,t){function n(){return!1}return t=t||"element.click",e.once(t,g_,n),function(){e.off(t,n)}}var y_=Math.round,v_="djs-drag-active";function b_(e){e.preventDefault()}function x_(e,t,n,o){var r,i={threshold:5,trapClick:!0};function s(e){var n=t.viewbox(),o=t._container.getBoundingClientRect();return{x:n.x+(e.x-o.left)/n.scale,y:n.y+(e.y-o.top)/n.scale}}function a(t,n){n=n||r;var o=e.createEvent(Ge({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,o)&&e.fire(n.prefix+"."+t,o)}function l(e,o){var i,l=r.payload,c=r.displacement,u=r.globalStart,h=VO(e),p=jO(h,u),f=r.localStart,d=s(h),m=jO(d,f);if(!r.active&&(o||(i=p,Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))>r.threshold))){if(Ge(l,{x:y_(f.x+c.x),y:y_(f.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return g();r.active=!0,r.keepSelection||(l.previousSelection=n.get(),n.select(null)),r.cursor&&f_(r.cursor),t.addMarker(t.getRootElement(),v_)}zO(e),r.active&&(Ge(l,{x:y_(d.x+c.x),y:y_(d.y+c.y),dx:y_(m.x),dy:y_(m.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;r.active&&(e&&(r.payload.originalEvent=e,zO(e)),t=a("end")),!1===t&&a("rejected"),a("ended",m(!0!==t))}function u(e){Mb("Escape",e)&&(b_(e),g())}function h(t){var n;r.active&&(n=m_(e),setTimeout(n,400),b_(t)),c(t)}function p(e){l(e)}function f(e){var t=r.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function d(e){a("out");var t=r.payload;t.hoverGfx=null,t.hover=null}function g(e){var t;if(r){var n=r.active;n&&a("cancel"),t=m(e),n&&a("canceled",t)}}function m(i){var s,m;a("cleanup"),d_(),m=r.trapClick?h:c,cn.unbind(document,"mousemove",l),cn.unbind(document,"dragstart",b_),cn.unbind(document,"selectstart",b_),cn.unbind(document,"mousedown",m,!0),cn.unbind(document,"mouseup",m,!0),cn.unbind(document,"keyup",u),cn.unbind(document,"touchstart",p,!0),cn.unbind(document,"touchcancel",g,!0),cn.unbind(document,"touchmove",l,!0),cn.unbind(document,"touchend",c,!0),e.off("element.hover",f),e.off("element.out",d),t.removeMarker(t.getRootElement(),v_);var y=r.payload.previousSelection;return!1!==i&&y&&!n.get().length&&function(e){var t=e.filter((function(e){return o.get(e.id)}));t.length&&n.select(t)}(y),s=r,r=null,s}e.on("diagram.destroy",g),this.init=function(t,n,o,m){r&&g(!1),"string"==typeof n&&(m=o,o=n,n=null);var y,v,b,x,w,O=(m=Ge({},i,m||{})).data||{};x=m.trapClick?h:c,t?(y=HO(t)||t,v=VO(t),zO(t),"dragstart"===y.type&&b_(y)):(y=null,v={x:0,y:0}),b=s(v),n||(n=b),w=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(y),r=Ge({prefix:o,data:O,payload:{},globalStart:v,displacement:jO(n,b),localStart:b,isTouch:w},m),m.manual||(w?(cn.bind(document,"touchstart",p,!0),cn.bind(document,"touchcancel",g,!0),cn.bind(document,"touchmove",l,!0),cn.bind(document,"touchend",c,!0)):(cn.bind(document,"mousemove",l),cn.bind(document,"dragstart",b_),cn.bind(document,"selectstart",b_),cn.bind(document,"mousedown",x,!0),cn.bind(document,"mouseup",x,!0)),cn.bind(document,"keyup",u),e.on("element.hover",f),e.on("element.out",d)),a("init"),m.autoActivate&&l(t,!0)},this.move=l,this.hover=f,this.out=d,this.end=c,this.cancel=g,this.context=function(){return r},this.setOptions=function(e){Ge(i,e)}}x_.$inject=["eventBus","canvas","selection","elementRegistry"];const w_={__depends__:[XO,h_],dragging:["type",x_]};function O_(e,t,n){this._canvas=n,this._opts=Ge({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var o=this;t.on("drag.move",(function(e){var t=o._toBorderPoint(e);o.startScroll(t)})),t.on(["drag.cleanup"],(function(){o.stopScroll()}))}O_.$inject=["config.autoScroll","eventBus","canvas"],O_.prototype.startScroll=function(e){var t,n,o,r=this._canvas,i=this._opts,s=this,a=r.getContainer().getBoundingClientRect(),l=[e.x,e.y,a.width-e.x,a.height-e.y];this.stopScroll();for(var c=0,u=0,h=0;h<4;h++)t=l[h],n=i.scrollThresholdOut[h],o=i.scrollThresholdIn[h],ng-3&&(n=Hw(r.target,d),s===g-2?"intersect"===n&&(p.pop(),p[p.length-1]=d):"intersect"!==n&&p.push(u)),o.newWaypoints=r.waypoints=a(r,p),function(e,t,n){var o,r,i,s,a,l,c=e.newWaypoints,u=(o=n,r=c[e.segmentStartIndex+t],i=c[e.segmentEndIndex+t],s=ek(e.axis),a=Math.max(r[s],i[s]),l=Math.min(r[s],i[s]),J_(r,s,Math.min(Math.max(l+20,o[s]),a-20)));vO(e.draggerGfx,u.x,u.y)}(o,m,e),o.newSegmentStartIndex=i+m,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,Y_)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,Y_)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,o=t.connection;t.draggerGfx&&Rx(t.draggerGfx),n.removeMarker(o,Z_)})),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,o=t.newWaypoints,r=t.newSegmentStartIndex;o=o.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;return{waypoints:e.filter((function(o,r){return!Tw(e[r-1],e[r+1],o)||(n=r<=t?n-1:n,!1)})),segmentOffset:n}}(o,r),l=a(n,s.waypoints),c=s.segmentOffset,u={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+c}};i.updateWaypoints(n,l,u)}))}nk.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var ok=Math.abs,rk=Math.round;function ik(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:rk(e.x+e.width/2),y:rk(e.y+e.height/2)}}function sk(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function ak(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 o,r=e[t],i=e.snapped=e.snapped||{};return!1===n?i[t]=!1:(i[t]=!0,o=n-r,e[t]+=o,e["d"+t]+=o),r}function lk(e){return e.children||[]}var ck=Math.abs,uk=Math.round;function hk(e){function t(e,t){if(Oe(e)){for(var n=e.length;n--;)if(ck(e[n]-t)<=10)return e[n]}else{var o=t%(e=+e);if(o<10)return t-o;if(o>e-10)return t-o+e}return t}function n(e,t){return e.waypoints?(o=function(e,t){for(var n,o=t.waypoints,r=1/0,i=0;ii.length-3&&h.unshift(n(r.target,e)),t.snapPoints=o={horizontal:[],vertical:[]},Te(h,(function(e){e&&(e=e.original||e,"y"===u&&o.horizontal.push(e.y),"x"===u&&o.vertical.push(e.x))})),o}(e),s=e.x,a=e.y;if(i){var l=s-(o=t(i.vertical,s)),c=a-(r=t(i.horizontal,a));Ge(e,{dx:e.dx-l,dy:e.dy-c,x:o,y:r}),(l||-1!==i.vertical.indexOf(s))&&ak(e,"x",o),(c||-1!==i.horizontal.indexOf(a))&&ak(e,"y",r)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,o=t&&n(t,e);$w(t)&&o&&o.x&&o.y&&(ak(e,"x",o.x),ak(e,"y",o.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var o,r,i=e.context,s=function(e){var t=e.snapPoints,n=e.connection.waypoints,o=e.bendpointIndex;if(t)return t;var r=[n[o-1],n[o+1]];return e.snapPoints=t={horizontal:[],vertical:[]},Te(r,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(i),a=i.hover,l=a&&n(a,e),c=e.x,u=e.y;if(s){var h=c-(o=t(l?s.vertical.concat([l.x]):s.vertical,c)),p=u-(r=t(l?s.horizontal.concat([l.y]):s.horizontal,u));Ge(e,{dx:e.dx-h,dy:e.dy-p,x:e.x-h,y:e.y-p}),(h||-1!==s.vertical.indexOf(c))&&ak(e,"x",o),(p||-1!==s.horizontal.indexOf(u))&&ak(e,"y",r)}}))}hk.$inject=["eventBus"];const pk={__depends__:[w_,TO],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",L_],bendpointMove:["type",F_],bendpointMovePreview:["type",U_],connectionSegmentMove:["type",nk],bendpointSnapping:["type",hk]};function fk(e,t,n,o){function r(e,t){return o.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,o=n.start,i=e.hover;if(n.hover=i,!we(t=n.canExecute=r(o,i))){if(!1!==t)return n.source=o,void(n.target=i);we(t=n.canExecute=r(i,o))||!1!==t&&(n.source=i,n.target=o)}})),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,o=t.canExecute,r=t.connectionStart,i={x:e.x,y:e.y},s=t.source,a=t.target;if(!o)return!1;var l=null,c={connectionStart:dk(t)?i:r,connectionEnd:dk(t)?r:i};_e(o)&&(l=o),t.connection=n.connect(s,a,l,c)})),this.start=function(e,n,o,r){_e(o)||(r=o,o=Qw(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{start:n,connectionStart:o}}})}}function dk(e){var t=e.hover,n=e.source,o=e.target;return t&&n&&t===n&&n!==o}fk.$inject=["eventBus","dragging","modeling","rules"];var gk="connect-ok",mk="connect-not-ok";function yk(e,t,n){var o=e.get("connectionPreview",!1);o&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,r=t.hover,i=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,p=u;dk(t)&&(h=u,p=c),o.drawPreview(t,n,{source:i||s,target:l||r,connectionStart:h,connectionEnd:p})})),t.on("connect.hover",900,(function(e){var t=e.context,o=e.hover,r=t.canExecute;null!==r&&n.addMarker(o,r?gk:mk)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,gk),n.removeMarker(t,mk))})),o&&t.on("connect.cleanup",(function(e){o.cleanUp(e.context)}))}yk.$inject=["injector","eventBus","canvas"];const vk={__depends__:[h_,TO,w_],__init__:["connectPreview"],connect:["type",fk],connectPreview:["type",yk]};function bk(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}bk.prototype.next=function(){return this._prefix+ ++this._counter};var xk=new bk("ov");function wk(e,t,n,o){var r,i;this._eventBus=t,this._canvas=n,this._elementRegistry=o,this._ids=xk,this._overlayDefaults=Ge({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(r=n.getContainer(),Wt(i=gn('
'),{position:"absolute",width:0,height:0}),r.insertBefore(i,r.firstChild),i),this._init()}function Ok(e,t,n){Wt(e,{left:t+"px",top:n+"px"})}function _k(e,t){e.style.display=!1===t?"none":""}function kk(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}wk.$inject=["config.overlays","eventBus","canvas","elementRegistry"],wk.prototype.get=function(e){if(Ee(e)&&(e={id:e}),Ee(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ae(t.overlays,Fe({type:e.type})):t.overlays.slice():[]}return e.type?Ae(this._overlays,Fe({type:e.type})):e.id?this._overlays[e.id]:null},wk.prototype.add=function(e,t,n){if(_e(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var o=this._ids.next();return n=Ge({},this._overlayDefaults,n,{id:o,type:t,element:e,html:n.html}),this._addOverlay(n),o},wk.prototype.remove=function(e){var t=this.get(e)||[];Oe(t)||(t=[t]);var n=this;Te(t,(function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(vn(e.html),vn(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var o=t.overlays.indexOf(e);-1!==o&&t.overlays.splice(o,1)}}))},wk.prototype.isShown=function(){return"none"!==this._overlayRoot.style.display},wk.prototype.show=function(){_k(this._overlayRoot)},wk.prototype.hide=function(){_k(this._overlayRoot,!1)},wk.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Zt(this._overlayRoot)},wk.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,o=t.x,r=t.y;if(t.waypoints){var i=xw(t);o=i.x,r=i.y}Ok(n,o,r),Xt(e.html,"data-container-id",t.id)},wk.prototype._updateOverlay=function(e){var t,n,o=e.position,r=e.htmlContainer,i=e.element,s=o.left,a=o.top;void 0!==o.right&&(t=i.waypoints?xw(i).width:i.width,s=-1*o.right+t),void 0!==o.bottom&&(n=i.waypoints?xw(i).height:i.height,a=-1*o.bottom+n),Ok(r,s||0,a||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},wk.prototype._createOverlayContainer=function(e){var t=gn('
');Wt(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},wk.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";kk(this._overlayRoot,n)},wk.prototype._getOverlayContainer=function(e,t){var n=Pe(this._overlayContainers,(function(t){return t.element===e}));return n||t?n:this._createOverlayContainer(e)},wk.prototype._addOverlay=function(e){var t,n,o=e.id,r=e.element,i=e.html;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Ee(i)&&(i=gn(i)),n=this._getOverlayContainer(r),Wt(t=gn('
'),{position:"absolute"}),t.appendChild(i),e.type&&Ut(t).add("djs-overlay-"+e.type),_k(t,this._canvas.findRoot(r)===this._canvas.getRootElement()),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[o]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},wk.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,o=this._canvas.findRoot(e.element),r=n&&n.minZoom,i=n&&n.maxZoom,s=e.htmlContainer,a=!0;(o!==this._canvas.getRootElement()||n&&(xe(r)&&r>t.scale||xe(i)&&io&&(r=(1/t.scale||1)*o)),xe(r)&&(a="scale("+r+","+r+")"),kk(s,a)},wk.prototype._updateOverlaysVisibilty=function(e){var t=this;Te(this._overlays,(function(n){t._updateOverlayVisibilty(n,e)}))},wk.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",(function(e){t.hide()})),e.on("canvas.viewbox.changed",(function(e){var n;n=e.viewbox,t._updateRoot(n),t._updateOverlaysVisibilty(n),t.show()})),e.on(["shape.remove","connection.remove"],(function(e){var n=e.element;Te(t.get({element:n}),(function(e){t.remove(e.id)}));var o=t._getOverlayContainer(n);if(o){vn(o.html);var r=t._overlayContainers.indexOf(o);-1!==r&&t._overlayContainers.splice(r,1)}})),e.on("element.changed",500,(function(e){var n=e.element,o=t._getOverlayContainer(n,!0);o&&(Te(o.overlays,(function(e){t._updateOverlay(e)})),t._updateOverlayContainer(o))})),e.on("element.marker.update",(function(e){var n=t._getOverlayContainer(e.element,!0);n&&Ut(n.html)[e.add?"add":"remove"](e.marker)})),e.on("root.set",(function(){t._updateOverlaysVisibilty(t._canvas.viewbox())})),e.on("diagram.clear",this.clear,this)};const Sk={__init__:["overlays"],overlays:["type",wk]};var Ek=".entry";function Ck(e,t,n,o){this._canvas=e,this._eventBus=n,this._overlays=o;var r=xe(t&&t.scale)?t.scale:{min:1,max:1.5};this._overlaysConfig={scale:r},this._current=null,this._init()}function Pk(e,t){return-1!==e.indexOf(t)}Ck.$inject=["canvas","config.contextPad","eventBus","overlays"],Ck.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",(function(t){var n=t.newSelection,o=n.length?1===n.length?n[0]:n:null;o?e.open(o,!0):e.close()})),this._eventBus.on("elements.changed",(function(t){var n=t.elements,o=e._current;if(o){var r=o.target;je(Oe(r)?r:[r],(function(e){return Pk(n,e)}))&&e.open(r,!0)}}))},Ck.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("contextPad.getProviders",e,(function(e){e.providers.push(t)}))},Ck.prototype.getEntries=function(e){var t=this._getProviders(),n=Oe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",o={};return Te(t,(function(t){if(Se(t[n])){var r=t[n](e);Se(r)?o=r(o):Te(r,(function(e,t){o[t]=e}))}})),o},Ck.prototype.trigger=function(e,t,n){var o,r,i=t.delegateTarget||t.target;return i?(o=Xt(i,"data-action"),r=t.originalEvent||t,"mouseover"===e?this._timeout=setTimeout((()=>{this._mouseout=this.triggerEntry(o,"hover",r,n)}),300):"mouseout"===e&&(clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null)),this.triggerEntry(o,e,r,n)):t.preventDefault()},Ck.prototype.triggerEntry=function(e,t,n,o){if(this.isShown()){var r=this._current.target,i=this._current.entries[e];if(i){var s=i.action;if(!1!==this._eventBus.fire("contextPad.trigger",{entry:i,event:n})){if(Se(s)){if("click"===t)return s(n,r,o)}else if(s[t])return s[t](n,r,o);n.preventDefault()}}}},Ck.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Ck.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ck.prototype._updateAndOpen=function(e){var t,n=this.getEntries(e),o=this.getPad(e),r=o.html;Te(n,(function(e,n){var o,i=e.group||"default",s=gn(e.html||'
');Xt(s,"data-action",n),(o=mn("[data-group="+D_(i)+"]",r))||(Xt(o=gn('
'),"data-group",i),r.appendChild(o)),o.appendChild(s),e.className&&function(e,t){var n=Ut(e);(t=Oe(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(s,e.className),e.title&&Xt(s,"title",e.title),e.imageUrl&&(Xt(t=gn(""),"src",e.imageUrl),t.style.width="100%",t.style.height="100%",s.appendChild(t))})),Ut(r).add("open"),this._current={target:e,entries:n,pad:o},this._eventBus.fire("contextPad.open",{current:this._current})},Ck.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,o=gn('
'),r=this._getPosition(e),i=Ge({html:o},this._overlaysConfig,r);hn(o,Ek,"click",(function(e){t.trigger("click",e)})),hn(o,Ek,"dragstart",(function(e){t.trigger("dragstart",e)})),hn(o,Ek,"mouseover",(function(e){t.trigger("mouseover",e)})),hn(o,Ek,"mouseout",(function(e){t.trigger("mouseout",e)})),cn.bind(o,"mousedown",(function(e){e.stopPropagation()}));var s=this._canvas.getRootElement();this._overlayId=n.add(s,"context-pad",i);var a=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{target:e,pad:a}),a},Ck.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ck.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Oe(e)===Oe(n)&&(Oe(e)?e.length===n.length&&Re(e,(function(e){return Pk(n,e)})):n===e)},Ck.prototype.isShown=function(){return this.isOpen()&&this._overlays.isShown()},Ck.prototype._getPosition=function(e){var t,n=xw(Oe(e=$w(e)?(t=e).waypoints[t.waypoints.length-1]:e)?e:[e]);return{position:{left:n.x+n.width+12,top:n.y-6}}};const Ak={__depends__:[n_,Sk],contextPad:["type",Ck]};function Tk(e,t,n,o){this._canvas=t,this._graphicsFactory=n,this._elementFactory=o,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Tk.$inject=["injector","canvas","graphicsFactory","elementFactory"],Tk.prototype.drawPreview=function(e,t,n){n=n||{};var o,r=e.connectionPreviewGfx,i=e.getConnection,s=n.source,a=n.target,l=n.waypoints,c=n.connectionStart,u=n.connectionEnd,h=n.noLayout,p=n.noCropping,f=n.noNoop,d=this;r||(r=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),jx(r),i||(i=e.getConnection=function(e){var t={};return function(n){var o=JSON.stringify(n),r=t[o];return r||(r=t[o]=e.apply(null,arguments)),r}}((function(e,t,n){return d.getConnection(e,t,n)}))),t&&(o=i(t,s,a)),o?(o.waypoints=l||[],this._layouter&&!h&&(o.waypoints=this._layouter.layoutConnection(o,{source:s,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||o.waypoints})),o.waypoints&&o.waypoints.length||(o.waypoints=[s?Qw(s):c,a?Qw(a):u]),this._connectionDocking&&(s||a)&&!p&&(o.waypoints=this._connectionDocking.getCroppedWaypoints(o,s,a)),this._graphicsFactory.drawConnection(r,o,{stroke:"var(--element-dragger-color)"})):!f&&this.drawNoopPreview(r,n)},Tk.prototype.drawNoopPreview=function(e,t){var n=t.source,o=t.target,r=t.connectionStart||Qw(n),i=t.connectionEnd||Qw(o),s=this.cropWaypoints(r,i,n,o);kx(e,this.createNoopConnection(s[0],s[1]))},Tk.prototype.cropWaypoints=function(e,t,n,o){var r=this._graphicsFactory,i=n&&r.getShapePath(n),s=o&&r.getShapePath(o),a=r.getConnectionPath({waypoints:[e,t]});return[e=n&&zw(i,a,!0)||e,t=o&&zw(s,a,!1)||t]},Tk.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Rx(e.connectionPreviewGfx)},Tk.prototype.getConnection=function(e){var t=function(e){return _e(e)?e:{}}(e);return this._elementFactory.createConnection(t)},Tk.prototype.createConnectionPreviewGfx=function(){var e=Ix("g");return Px(e,{pointerEvents:"none"}),Tx(e).add("djs-dragger"),kx(this._canvas.getActiveLayer(),e),e},Tk.prototype.createNoopConnection=function(e,t){return dw([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};const Mk={__init__:["connectionPreview"],connectionPreview:["type",Tk]};var Rk=["marker-start","marker-mid","marker-end"],jk=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Bk(e,t,n,o){this._elementRegistry=e,this._canvas=n,this._styles=o,this._clonedMarkers={};var r=this;t.on("drag.cleanup",(function(){r.cleanUp()}))}Bk.$inject=["elementRegistry","eventBus","canvas","styles"],Bk.prototype.cleanUp=function(){Te(this._clonedMarkers,(function(e){Rx(e)})),this._clonedMarkers={}},Bk.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Bk.prototype.addDragger=function(e,t,n,o="djs-dragger"){var r=Bx(n=n||this.getGfx(e)),i=n.getBoundingClientRect();return this._cloneMarkers(yO(r),o),Px(r,this._styles.cls(o,[],{x:i.top,y:i.left})),kx(t,r),Px(r,"data-preview-support-element-id",e.id),r},Bk.prototype.addFrame=function(e,t){var n=Ix("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return kx(t,n),Px(n,"data-preview-support-element-id",e.id),n},Bk.prototype._cloneMarkers=function(e,t="djs-dragger"){var n=this;if(e.childNodes)for(var o=0;o=n.x&&t.yn.x&&t.y<=n.y?{x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x=n.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?{x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:{x:n.x,y:n.y,width:0,height:0}}ES.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],ES.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:SS,data:{context:{}}})},ES.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:SS,data:{context:{}}})},ES.prototype.select=function(e,t){var n=function(e,t){var n={};return Te(e,(function(e){var o=e;o.waypoints&&(o=xw(o)),!ke(t.y)&&o.x>t.x&&(n[e.id]=e),!ke(t.x)&&o.y>t.y&&(n[e.id]=e),o.x>t.x&&o.y>t.y&&(ke(t.width)&&ke(t.height)&&o.width+o.x15)&&(n.dragging=!0,0===s&&m_(e),f_("grab")),n.dragging&&(l=jO(a,n.last||n.start),t.scroll({dx:l.x,dy:l.y}),n.last=a),o.preventDefault()}function r(e){cn.unbind(document,"mousemove",o),cn.unbind(document,"mouseup",r),n=null,d_()}e.on("element.mousedown",500,(function(e){return function(e){if(!Jt(e.target,".djs-draggable")){var t=e.button;if(!(t>=2||e.ctrlKey||e.shiftKey||e.altKey))return n={button:t,start:VO(e)},cn.bind(document,"mousemove",o),cn.bind(document,"mouseup",r),!0}}(e.originalEvent)})),this.isActive=function(){return!!n}}AS.$inject=["eventBus","canvas"];const TS={__init__:["moveCanvas"],moveCanvas:["type",AS]};var MS=Math.round;function RS(e,t,n,o,r){function i(e,t,n,o){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:o})}function s(e,n,o,r){if(_e(o)&&(r=o,o=!1),!n.waypoints&&n.parent&&!Tx(e.target).has("djs-hit-no-move")){var i=function(e){return{x:e.x+MS(e.width/2),y:e.y+MS(e.height/2)}}(n);return t.init(e,i,"shape.move",{cursor:"grabbing",autoActivate:o,data:{shape:n,context:r||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,r=o.get().slice();-1===r.indexOf(n)&&(r=[n]),r=function(e){var t=$e(e,"id");return Ae(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(r),Ge(t,{shapes:r,validatedShapes:r,shape:n})})),e.on("shape.move.start",1250,(function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=i(n)))return!1})),e.on("shape.move.move",500,(function(e){var t,n=e.context,o=n.validatedShapes,r=e.hover,s={x:e.dx,y:e.dy};t=i(o,s,{x:e.x,y:e.y},r),n.delta=s,n.canExecute=t,n.target=null!==t?r:null})),e.on("shape.move.end",(function(e){var t=e.context,o=t.delta,r=t.canExecute,i="attach"===r,s=t.shapes;if(!1===r)return!1;o.x=MS(o.x),o.y=MS(o.y),0===o.x&&0===o.y||n.moveElements(s,o,t.target,{primaryShape:t.shape,attach:i})})),e.on("element.mousedown",(function(e){if(YO(e)){var t=HO(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}RS.$inject=["eventBus","dragging","modeling","selection","rules"];var jS="djs-dragging",BS="drop-ok",DS="drop-not-ok",LS="new-parent",$S="attach-ok";function IS(e,t,n,o){function r(e){var t,n,o,r,i=(t=!1,n=-1,o=[],r=[],bw(e,(function(e,i,s){vw(o,e,t);var a=e.children;if((-1===n||s
'),"data-group",o),e.appendChild(r));var i=t.html||(t.separator?'
':'
'),s=gn(i);if(r.appendChild(s),!t.separator&&(Xt(s,"data-action",n),t.title&&Xt(s,"title",t.title),t.className&&function(e,t){var n=Ut(e);(Oe(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=gn("");Xt(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},WS.prototype.trigger=function(e,t,n){var o,r,i=t.delegateTarget||t.target;return i?(o=Xt(i,"data-action"),r=t.originalEvent||t,this.triggerEntry(o,e,r,n)):t.preventDefault()},WS.prototype.triggerEntry=function(e,t,n,o){var r,i;if((r=this._entries[e])&&(i=r.action,!1!==this._eventBus.fire("palette.trigger",{entry:r,event:n}))){if(Se(i)){if("click"===t)return i(n,o)}else if(i[t])return i[t](n,o);n.preventDefault()}},WS.prototype._layoutChanged=function(){this._toggleState({})},WS.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},WS.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},WS.prototype.open=function(){this._toggleState({open:!0})},WS.prototype.toggle=function(){this.isOpen()?this.close():this.open()},WS.prototype.isActiveTool=function(e){return e&&this._activeTool===e},WS.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=mn(".djs-palette-entries",this._container),this._toolsContainer=mn("[data-group=tools]",t)),Te(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var o=Ut(t);n=n.replace("-tool",""),o.contains("entry")&&n===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}}))},WS.prototype.isOpen=function(){return Ut(this._container).has(zS)},WS.prototype._getParentContainer=function(){return this._canvas.getContainer()},WS.HTML_MARKUP='
';const GS={__init__:["palette"],palette:["type",WS]};var US=Math.max,YS=Math.min,ZS=20;function KS(e,t,n){var o=t[e],r=n.min&&n.min[e],i=n.max&&n.max[e];return ke(r)&&(o=(/top|left/.test(e)?YS:US)(o,r)),ke(i)&&(o=(/top|left/.test(e)?US:YS)(o,i)),o}function JS(e,t){return void 0!==e?e:ZS}function eE(e){return!e.waypoints&&"label"!==e.type}function tE(e,t,n,o){this._dragging=o,this._rules=t;var r=this;e.on("resize.start",(function(e){var t,n,o;n=(t=e.context).resizeConstraints,o=t.minBounds,void 0===n&&(void 0===o&&(o=r.computeMinResizeBox(t)),t.resizeConstraints={min:qw(o)})})),e.on("resize.move",(function(e){var t={x:e.dx,y:e.dy};!function(e,t){var n,o=e.shape,i=e.direction,s=e.resizeConstraints;e.delta=t,n=function(e,t,n){var o=n.x,r=n.y,i={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(i.y=e.y+r,i.height=e.height-r):-1!==t.indexOf("s")&&(i.height=e.height+r),-1!==t.indexOf("e")?i.width=e.width+o:-1!==t.indexOf("w")&&(i.x=e.x+o,i.width=e.width-o),i}(o,i,t),e.newBounds=function(e,t){if(!t)return e;var n=qw(e);return Fw({top:KS("top",n,t),right:KS("right",n,t),bottom:KS("bottom",n,t),left:KS("left",n,t)})}(n,s),e.canExecute=r.canResize(e)}(e.context,t)})),e.on("resize.end",(function(e){!function(e){var t,o=e.shape,r=e.canExecute,i=e.newBounds;if(r){if(t=i,!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(o,i={x:Math.round(t.x),y:Math.round(t.y),width:Math.round(t.width),height:Math.round(t.height)}))return;n.resizeShape(o,i)}}(e.context)}))}function nE(e,t){var n=Qw(e),o=qw(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=o.top:-1!==t.indexOf("s")&&(r.y=o.bottom),-1!==t.indexOf("e")?r.x=o.right:-1!==t.indexOf("w")&&(r.x=o.left),r}function oE(e){var t="resize-";return"n"===e||"s"===e?t+"ns":"e"===e||"w"===e?t+"ew":"nw"===e||"se"===e?t+"nwse":t+"nesw"}tE.prototype.canResize=function(e){var t=this._rules,n=Ue(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},tE.prototype.activate=function(e,t,n){var o,r,i=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(o=Ge({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,nE(t,r),"resize",{autoActivate:!0,cursor:oE(r),data:{shape:t,context:o}})},tE.prototype.computeMinResizeBox=function(e){var t,n,o,r,i,s,a,l=e.shape;return t=e.direction,n=l,o=e.minDimensions||{width:10,height:10},r=function(e,t){var n;if((n=void 0===e.length?Ae(e.children,eE):e).length)return function(e,t){var n,o,r,i;return"object"==typeof t?(n=JS(t.left),o=JS(t.right),r=JS(t.top),i=JS(t.bottom)):n=o=r=i=JS(t),{x:e.x-n,y:e.y-r,width:e.width+n+o,height:e.height+r+i}}(xw(n),t)}(l,e.childrenBoxPadding),i=qw(n),s={top:/n/.test(t)?i.bottom-o.height:i.top,left:/w/.test(t)?i.right-o.width:i.left,bottom:/s/.test(t)?i.top+o.height:i.bottom,right:/e/.test(t)?i.left+o.width:i.right},a=r?qw(r):s,Fw({top:YS(s.top,a.top),left:YS(s.left,a.left),bottom:US(s.bottom,a.bottom),right:US(s.right,a.right)})},tE.$inject=["eventBus","rules","modeling","dragging"];var rE="djs-resizing",iE="resize-not-ok";function sE(e,t,n){e.on("resize.move",500,(function(e){var o,r,i,s;r=(o=e.context).shape,i=o.newBounds,(s=o.frame)||(s=o.frame=n.addFrame(r,t.getActiveLayer()),t.addMarker(r,rE)),i.width>5&&Px(s,{x:i.x,width:i.width}),i.height>5&&Px(s,{y:i.y,height:i.height}),o.canExecute?Tx(s).remove(iE):Tx(s).add(iE)})),e.on("resize.cleanup",(function(e){var n,o;o=(n=e.context).shape,n.frame&&Rx(n.frame),t.removeMarker(o,rE)}))}sE.$inject=["eventBus","canvas","previewSupport"];var aE="djs-resizer",lE=["n","w","s","e","nw","ne","se","sw"];function cE(e,t,n,o){this._resize=o,this._canvas=t;var r=this;e.on("selection.changed",(function(e){var t=e.newSelection;r.removeResizers(),1===t.length&&Te(t,Xe(r.addResizer,r))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))}))}cE.prototype.makeDraggable=function(e,t,n){var o=this._resize;function r(t){YO(t)&&o.activate(t,e,n)}cn.bind(t,"mousedown",r),cn.bind(t,"touchstart",r)},cE.prototype._createResizer=function(e,t,n,o){var r=this._getResizersParent(),i=function(e){var t={x:0,y:0};return-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=-6),-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=-6),t}(o),s=Ix("g");Tx(s).add(aE),Tx(s).add(aE+"-"+e.id),Tx(s).add(aE+"-"+o),kx(r,s);var a=Ix("rect");Px(a,{x:-4+i.x,y:-4+i.y,width:8,height:8}),Tx(a).add(aE+"-visual"),kx(s,a);var l=Ix("rect");return Px(l,{x:-10+i.x,y:-10+i.y,width:20,height:20}),Tx(l).add(aE+"-hit"),kx(s,l),function(e,t,n,o,r){var i=Qx();i.setTranslate(t,n);var s=Qx();s.setRotate(0,0,0);var a=Qx();a.setScale(1,1),Yx(e,[i,s,a])}(s,t,n),s},cE.prototype.createResizer=function(e,t){var n=nE(e,t),o=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,o,t)},cE.prototype.addResizer=function(e){var t=this;!$w(e)&&this._resize.canResize({shape:e})&&Te(lE,(function(n){t.createResizer(e,n)}))},cE.prototype.removeResizers=function(){jx(this._getResizersParent())},cE.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},cE.$inject=["eventBus","canvas","selection","resize"];const uE={__depends__:[TO,w_,Dk],__init__:["resize","resizePreview","resizeHandles"],resize:["type",tE],resizePreview:["type",sE],resizeHandles:["type",cE]};function hE(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function pE(){this._snapValues={}}function fE(e,t,n){var o=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],(function(e){o.initSnap(e)})),t.on(["create.move","create.end","shape.move.move","shape.move.end"],1250,(function(e){var t=e.context,r=t.shape,i=t.snapContext,s=t.target;if((!e.originalEvent||!Tb(e.originalEvent))&&!sk(e)&&s){var a=i.pointsForTarget(s);a.initialized||((a=o.addSnapTargetPoints(a,r,s)).initialized=!0),n.snap(e,a)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}function dE(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],1250,(function(e){var o=e.context,r=o.shape,i=r.parent,s=o.direction,a=o.snapContext;if(!(e.originalEvent&&Tb(e.originalEvent)||sk(e))){var l=a.pointsForTarget(i);l.initialized||((l=n.addSnapTargetPoints(l,r,i,s)).initialized=!0),function(e){return"n"===e||"s"===e}(s)&&ak(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&ak(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function gE(e,t){var n=Qw(e),o=qw(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=o.top:-1!==t.indexOf("s")&&(r.y=o.bottom),-1!==t.indexOf("e")?r.x=o.right:-1!==t.indexOf("w")&&(r.x=o.left),r}function mE(e){this._canvas=e,this._asyncHide=We(Xe(this.hide,this),1e3)}hE.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},hE.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},hE.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},hE.prototype.getSnapLocations=function(){return this._snapLocations},hE.prototype.setSnapLocations=function(e){this._snapLocations=e},hE.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new pE).initDefaults(this._defaultSnaps),n},pE.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),-1===n.x.indexOf(t.x)&&n.x.push(t.x),-1===n.y.indexOf(t.y)&&n.y.push(t.y)},pE.prototype.snap=function(e,t,n,o){var r=this._snapValues[t];return r&&function(e,t,n){var o,r;for(n=void 0===n?10:n,o=0;o=0?1:-1},wE={min:.2,max:4};function OE(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Xe(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||.75;var o=this;t.on("canvas.init",(function(t){o._init(!1!==e.enabled)}))}OE.$inject=["config.zoomScroll","eventBus","canvas"],OE.prototype.scroll=function(e){this._canvas.scroll(e)},OE.prototype.reset=function(){this._canvas.zoom("fit-viewport")},OE.prototype.zoom=function(e,t){var n=bE(wE,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},OE.prototype._handleWheel=function(e){if(!Jt(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,o=e.ctrlKey||GO()&&e.metaKey,r=e.shiftKey,i=-1*this._scale;if(i*=o?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,o){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))*xE(e.deltaY)*i,this.zoom(n,a)}else n=r?{dx:i*e.deltaY,dy:0}:{dx:i*e.deltaX,dy:i*e.deltaY},this.scroll(n)}},OE.prototype.stepZoom=function(e,t){var n=bE(wE,10);this._zoom(e,t,n)},OE.prototype._zoom=function(e,t,n){var o=this._canvas,r=e>0?1:-1,i=vE(o.zoom()),s=Math.round(i/n)*n;s+=n*r;var a,l,c=Math.pow(10,s);o.zoom((a=wE,l=c,Math.max(a.min,Math.min(a.max,l))),t)},OE.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,o=this._enabled;return void 0===e&&(e=!o),o!==e&&cn[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},OE.prototype._init=function(e){this.toggle(e)};const _E={__init__:["zoomScroll"],zoomScroll:["type",OE]};var kE=1e5,SE=1e5;function EE(e,t){this._canvas=e,this._visible=!1;var n=this;t.on("diagram.init",(function(){n._init()})),t.on("gridSnapping.toggle",(function(e){var t=e.active;n.toggle(t),n._centerGridAroundViewbox()})),t.on("canvas.viewbox.changed",(function(e){var t=e.viewbox;n._centerGridAroundViewbox(t)}))}EE.prototype._init=function(){var e=mn("defs",this._canvas._svg);e||(e=Ix("defs"),kx(this._canvas._svg,e));var t=this._pattern=Ix("pattern"),n="djs-grid-pattern-"+Math.trunc(1e6*Math.random());Px(t,{id:n,width:Yk,height:Yk,patternUnits:"userSpaceOnUse"});var o=this._circle=Ix("circle");Px(o,{cx:.5,cy:.5,r:.5,fill:"#ccc"}),kx(t,o),kx(e,t),Px(this._gfx=Ix("rect"),{x:-5e4,y:-5e4,width:kE,height:SE,fill:`url(#${n})`})},EE.prototype._centerGridAroundViewbox=function(e){e||(e=this._canvas.viewbox());var t=Qw(e);Px(this._gfx,{x:-5e4+Zk(t.x,Yk),y:-5e4+Zk(t.y,Yk)})},EE.prototype.isVisible=function(){return this._visible},EE.prototype.toggle=function(e){if(void 0===e&&(e=!this._visible),e!==this._visible){var t=this._getParent();e?kx(t,this._gfx):jx(t),this._visible=e}},EE.prototype._getParent=function(){return this._canvas.getLayer("djs-grid",-2)},EE.$inject=["canvas","eventBus"];var CE={__init__:["grid"],grid:["type",EE]};function PE(e){return Ge({original:e.point.original||e.point},e.actual)}function AE(e,t){this._elementRegistry=e,this._graphicsFactory=t}function TE(){}function ME(e){this.connectionDocking=e}function RE(e,t){return e?e.original||e:Qw(t)}function jE(e){e.invoke(LO,this),this.postExecuted("element.updateAttachment",500,(function(e){var t=e.context,n=t.shape,o=t.oldHost,r=t.newHost;(function(e,t){return Kb(e,"Catch")&&t})(n,r)&&(null==o||delete o.businessObject.Catch,r.businessObject.Catch=n.businessObject)}))}function BE(e,t){return e&&t&&e.split("-").shift()===t.split("-").shift()}function DE(e,t,n){function o(e,o,r){o||(o=e.incoming);var i={};r?i[r]=o:i=function(e,t){var n={};return t.forEach((function(t){var o=Hw(t.source,e).split("-").shift();n[o]||(n[o]=[]),n[o].push(t)})),n}(e,o),Te(i,(function(o,r){o=function(e,t){var n;return n=t.includes("top")||t.includes("bottom")?"x":"y",e.sort((function(e,t){return Qw(e.source)[n]-Qw(t.source)[n]}))}(o,r);var i=function(e,t,n){return e.map((function(o,r){var i=o.source,s=Qw(i),a=qw(i),l=qw(t),c=e.length;return n.includes("bottom")?{start:{x:s.x,y:a.top},end:{x:l.left+t.width/(c+1)*(r+1),y:l.bottom}}:n.includes("top")?{start:{x:s.x,y:a.bottom},end:{x:l.left+t.width/(c+1)*(r+1),y:l.top}}:n.includes("right")?{start:{x:a.left,y:s.y},end:{x:l.right,y:l.top+t.height/(c+1)*(r+1)}}:{start:{x:a.right,y:s.y},end:{x:l.left,y:l.top+t.height/(c+1)*(r+1)}}}))}(o,e,r);o.forEach((function(e,o){var r=i[o].start,s=i[o].end,a=t.layoutConnection(e,{connectionStart:r,connectionEnd:s});n.updateWaypoints(e,a)}))}))}e.invoke(LO,this),this.preExecute(["connection.create","connection.reconnect"],(function(e){var t=e.newSource||e.source,n=e.newTarget||e.target,o=Hw(t,n);e.hints||(e.hints={}),Ge(e.hints,function(e,t,n){var o=Qw(e),r=Qw(t);return n.includes("bottom")?(o.y=e.y,r.y=t.y+t.height):n.includes("top")?(o.y=e.y+e.height,r.y=t.y):n.includes("right")?(o.x=e.x,r.x=t.x+t.width):(o.x=e.x+e.width,r.x=t.x),{connectionStart:o,connectionEnd:r}}(t,n,o))}),!0),this.postExecuted(["connection.create","connection.delete","connection.reconnect"],(function(e){var t=e.connection,n=t.source||e.source,r=t.target||e.target,i=Hw(n,r),s=r.incoming.filter((function(e){return BE(Hw(e.source,e.target),i)}));s.length&&o(r,s,i)}),!0),this.preExecute("connection.reconnect",(function(e){var t=e.connection,n=t.source,r=t.target,i=Hw(n,r),s=r.incoming.filter((function(e){var n=Hw(e.source,e.target);return e!==t&&BE(n,i)}));s.length&&o(r,s,i)}),!0),this.postExecuted("elements.move",500,(function(e){var t=e.shapes,n=e.closure.enclosedConnections;t.forEach((function(e){var t=e.incoming.filter((function(e){return!n[e.id]}));t.length&&o(e,t),e.outgoing.forEach((function(e){n[e.id]||o(e.target)}))}))}),!0)}function LE(e,t,n){e.invoke(LO,this),this.preExecute("connection.reconnect",(function(e){var o=e.connection,r=e.newSource||o.source,i=e.newTarget||o.target,s=o.waypoints.slice(),a=n.allowed("connection.reconnect",{connection:o,source:r,target:i});a&&a.type!==o.type&&(e.connection=t.connect(r,i,{type:a.type,waypoints:s}),t.removeConnection(o))}),!0)}function $E(e){e.invoke(LO,this);var t=this;function n(e){var n=e.shape;t.updateBounds(n)}function o(e){t.updateConnectionWaypoints(e)}function r(e){t.updateConnectionSourceTarget(e)}this.executed(["shape.create","shape.move","shape.resize"],n,!0),this.reverted(["shape.create","shape.move","shape.resize"],n,!0),this.executed(["connection.create","connection.layout","connection.move","connection.updateWaypoints"],o,!0),this.reverted(["connection.create","connection.layout","connection.move","connection.updateWaypoints"],o,!0),this.executed(["connection.create","connection.reconnect"],r,!0),this.reverted(["connection.create","connection.reconnect"],r,!0)}AE.$inject=["elementRegistry","graphicsFactory"],AE.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var o=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),i=e.waypoints.slice(o.idx+1,r.idx);return i.unshift(PE(o)),i.push(PE(r)),i},AE.prototype.getDockingPoint=function(e,t,n){var o,r,i=e.waypoints;return{point:r=i[o=n?0:i.length-1],actual:this._getIntersection(t,e,n)||r,idx:o}},AE.prototype._getIntersection=function(e,t,n){return zw(this._getShapePath(e),this._getConnectionPath(t),n)},AE.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},AE.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},AE.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)},TE.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||Qw(t.source||e.source),t.connectionEnd||Qw(t.target||e.target)]},Ox(ME,TE),ME.$inject=["connectionDocking"],ME.prototype.layoutConnection=function(e,t){var n=this.connectionDocking;t||(t={});var o=t.source||e.source,r=t.target||e.target,i=t.waypoints||e.waypoints||[],s=t.connectionStart,a=t.connectionEnd,l=Hw(o,r);s||(s=RE(i[0],o)),a||(a=RE(i[i.length-1],r)),i=[s,a];var c=n.getCroppedWaypoints(Ge({},e,{waypoints:i}),o,r),u={x:(a=c.pop()).x,y:a.y};return l.includes("bottom")?u.y+=20:l.includes("top")?u.y-=20:l.includes("right")?u.x+=20:u.x-=20,c.concat([u,a])},Ox(jE,LO),jE.$inject=["injector"],DE.$inject=["injector","layouter","modeling","rules"],Ox(DE,LO),Ox(LE,LO),LE.$inject=["injector","modeling","rules"],Ox($E,LO),$E.$inject=["injector"],$E.prototype.updateBounds=function(e){Ge(e.businessObject.style.bounds,{x:e.x,y:e.y,width:e.width,height:e.height})},$E.prototype.updateConnectionWaypoints=function(e){var t=e.connection;Ge(t.businessObject.style.waypoints,t.waypoints)},$E.prototype.updateConnectionSourceTarget=function(e){var t=e.connection.businessObject,n=e.source,o=e.newSource,r=e.target,i=e.newTarget;t.style.source=o||n,t.style.target=i||r};const IE={__depends__:[{__init__:["attachCatchBehavior","layoutConnectionBehavior","replaceConnectionBehavior","layoutUpdateBehavior"],attachCatchBehavior:["type",jE],layoutConnectionBehavior:["type",DE],replaceConnectionBehavior:["type",LE],layoutUpdateBehavior:["type",$E]}],layouter:["type",ME],connectionDocking:["type",AE]};function NE(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],(function(){this.clear(!1)}),this)}NE.$inject=["eventBus","injector"],NE.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},NE.prototype.canExecute=function(e,t){const n={command:e,context:t},o=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(void 0===r){if(!o)return!1;o.canExecute&&(r=o.canExecute(t))}return r},NE.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},NE.prototype.undo=function(){let e,t=this._getUndoAction();if(t){for(this._currentExecution.trigger="undo",this._pushAction(t);t&&(this._internalUndo(t),e=this._getUndoAction(),e&&e.id===t.id);)t=e;this._popAction()}},NE.prototype.redo=function(){let e,t=this._getRedoAction();if(t){for(this._currentExecution.trigger="redo",this._pushAction(t);t&&(this._internalExecute(t,!0),e=this._getRedoAction(),e&&e.id===t.id);)t=e;this._popAction()}},NE.prototype.register=function(e,t){this._setHandler(e,t)},NE.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},NE.prototype.canUndo=function(){return!!this._getUndoAction()},NE.prototype.canRedo=function(){return!!this._getRedoAction()},NE.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},NE.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},NE.prototype._internalUndo=function(e){const t=e.command,n=e.context,o=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),o.revert&&this._markDirty(o.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},NE.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const o=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const e of o)if(r=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return r},NE.prototype._createId=function(){return this._uid++},NE.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},NE.prototype._internalExecute=function(e,t){const n=e.command,o=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(o),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(o)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(o),this._fire(n,"postExecuted",e)),this._popAction()},NE.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,o=n[0];if(t.atomic)throw new Error("illegal invocation in or phase (action: "+e.command+")");e.id||(e.id=o&&o.id||this._createId()),n.push(e)},NE.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,o=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Ie("id",o.reverse())}),o.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},NE.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Oe(e)?e:[e],t.dirty=t.dirty.concat(e))},NE.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},NE.prototype._revertedAction=function(e){this._stackIdx--},NE.prototype._getHandler=function(e){return this._handlerMap[e]},NE.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const qE={commandStack:["type",NE]};function FE(e,t,n,o){e.on("element.changed",(function(o){var r=o.element;(r.parent||r===t.getRootElement())&&(o.gfx=n.getGraphics(r)),o.gfx&&e.fire(ww(r)+".changed",o)})),e.on("elements.changed",(function(t){var n=t.elements;n.forEach((function(t){e.fire("element.changed",{element:t})})),o.updateContainments(n)})),e.on("shape.changed",(function(e){o.update("shape",e.element,e.gfx)})),e.on("connection.changed",(function(e){o.update("connection",e.element,e.gfx)}))}FE.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const QE={__init__:["changeSupport"],changeSupport:["type",FE]};function HE(e){pO.call(this),this.sagaFactory=e}function zE(e,t){this._modeling=e,this._canvas=t}function VE(e){this._modeling=e}function WE(e,t){this._canvas=e,this._layouter=t}Ox(HE,pO),HE.$inject=["sagaFactory"],HE.prototype.baseCreate=pO.prototype.create,HE.prototype.create=function(e,t){var n=this.sagaFactory,o=(t=t||{}).businessObject;if(!o){if(!t.type)throw new Error("no shape type specified");o=n.create(t.type)}return t=Ge({businessObject:o},n.getDefaultSize(o),t),this.baseCreate(e,t)},zE.$inject=["modeling","canvas"],zE.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,o=e.alignment;Te(n,(function(e){var n={x:0,y:0};xe(o.left)?n.x=o.left-e.x:xe(o.right)?n.x=o.right-e.width-e.x:xe(o.center)?n.x=o.center-Math.round(e.width/2)-e.x:xe(o.top)?n.y=o.top-e.y:xe(o.bottom)?n.y=o.bottom-e.height-e.y:xe(o.middle)&&(n.y=o.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},zE.prototype.postExecute=function(e){},VE.$inject=["modeling"],VE.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,o=e.shape,r=e.hints||{};o=e.shape=this._modeling.createShape(o,e.position,n,{attach:r.attach}),e.shape=o},VE.prototype.postExecute=function(e){var t,n,o=e.hints||{};t=e.source,n=e.shape,je(t.outgoing,(function(e){return e.target===n}))||(o.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},WE.$inject=["canvas","layouter"],WE.prototype.execute=function(e){var t=e.connection,n=e.source,o=e.target,r=e.parent,i=e.parentIndex,s=e.hints;if(!n||!o)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=o,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,s)),this._canvas.addConnection(t,r,i),t},WE.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var XE=Math.round;function GE(e){this._modeling=e}GE.$inject=["modeling"],GE.prototype.preExecute=function(e){var t=e.elements,n=e.parent,o=e.parentIndex,r=e.position,i=e.hints,s=this._modeling;Te(t,(function(e){ke(e.x)||(e.x=0),ke(e.y)||(e.y=0)}));var a=xw(Ae(t,(function(e){return!e.hidden})));Te(t,(function(e){$w(e)&&(e.waypoints=Be(e.waypoints,(function(e){return{x:XE(e.x-a.x-a.width/2+r.x),y:XE(e.y-a.y-a.height/2+r.y)}}))),Ge(e,{x:XE(e.x-a.x-a.width/2+r.x),y:XE(e.y-a.y-a.height/2+r.y)})}));var l=mw(t),c={};Te(t,(function(e){if($w(e))c[e.id]=ke(o)?s.createConnection(c[e.source.id],c[e.target.id],o,e,e.parent||n,i):s.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,i);else{var t=Ge({},i);-1===l.indexOf(e)&&(t.autoResize=!1),Iw(e)&&(t=function(e,t){let n={};return Te(Object(e),(function(e,o){-1===t.indexOf(o)&&(n[o]=e)})),n}(t,["attach"])),c[e.id]=ke(o)?s.createShape(e,Ue(e,["x","y","width","height"]),e.parent||n,o,t):s.createShape(e,Ue(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=Le(c)};var UE=Math.round;function YE(e){this._canvas=e}function ZE(e){YE.call(this,e)}YE.$inject=["canvas"],YE.prototype.execute=function(e){var t=e.shape,n=e.position,o=e.parent,r=e.parentIndex;if(!o)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?Ge(t,n):Ge(t,{x:n.x-UE(t.width/2),y:n.y-UE(t.height/2)}),this._canvas.addShape(t,o,r),t},YE.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},Ox(ZE,YE),ZE.$inject=["canvas"];var KE=YE.prototype.execute;ZE.prototype.execute=function(e){var t=e.shape;return function(e){["width","height"].forEach((function(t){void 0===e[t]&&(e[t]=0)}))}(t),t.labelTarget=e.labelTarget,KE.call(this,e)};var JE=YE.prototype.revert;function eC(e,t){this._canvas=e,this._modeling=t}function tC(e,t){this._modeling=e,this._elementRegistry=t}function nC(e,t){this._canvas=e,this._modeling=t}function oC(e){this._modeling=e}ZE.prototype.revert=function(e){return e.shape.labelTarget=null,JE.call(this,e)},eC.$inject=["canvas","modeling"],eC.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;MO(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),MO(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},eC.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Pw(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},eC.prototype.revert=function(e){var t=e.connection,n=e.parent,o=e.parentIndex;return t.source=e.source,t.target=e.target,Cw(n.children,t,o),this._canvas.addConnection(t,n),t},tC.$inject=["modeling","elementRegistry"],tC.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;Te(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},nC.$inject=["canvas","modeling"],nC.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;MO(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),MO(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),MO(n.children,(function(e){$w(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},nC.prototype.execute=function(e){var t=this._canvas,n=e.shape,o=n.parent;return e.oldParent=o,e.oldParentIndex=Pw(o.children,n),t.removeShape(n),n},nC.prototype.revert=function(e){var t=this._canvas,n=e.shape,o=e.oldParent,r=e.oldParentIndex;return Cw(o.children,n,r),t.addShape(n,o),n},oC.$inject=["modeling"];var rC={x:"y",y:"x"};function iC(e,t){this._layouter=e,this._canvas=t}function sC(){}function aC(e,t,n){var o=pC(e),r=fC(o,t),i=o[0];return r.length?r[r.length-1]:BO(i.original||i,n,t)}function lC(e,t,n){var o=pC(e),r=fC(o,t),i=o[o.length-1];return r.length?r[0]:BO(i.original||i,n,t)}function cC(e,t,n){var o=pC(e),r=hC(t,n),i=o[0];return BO(i.original||i,r,t)}function uC(e,t,n){var o=pC(e),r=hC(t,n),i=o[o.length-1];return BO(i.original||i,r,t)}function hC(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function pC(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function fC(e,t){return Ae(Be(e,dC),(function(e){return function(e,t){return"intersect"===Hw(t,e,1)}(e,t)}))}function dC(e){return e.original||e}function gC(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function mC(e){this._modeling=e}function yC(e){this._helper=new mC(e)}function vC(e){this._modeling=e,this._helper=new mC(e)}function bC(e){this._modeling=e}function xC(e){return e.original||e}function wC(e,t){this._modeling=e,this._rules=t}function OC(e){this._modeling=e}function _C(e,t){return-1!==e.indexOf(t)}function kC(e){this._modeling=e}function SC(e){return Ge({},e)}function EC(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function CC(e,t,n){var o=EC(n);return/e|s/.test(n)?e[o]>t:/n|w/.test(n)?e[o]=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,gP))}},{key:"exportJson",value:function(){return Ge({},this)}}])&&mP(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),t}(qC);function _P(e){return _P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_P(e)}function kP(e,t,n){return t=EP(t),function(e,t){if(t&&("object"===_P(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return CP(e)}(e,SP()?Reflect.construct(t,n||[],EP(e).constructor):t.apply(e,n))}function SP(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(SP=function(){return!!e})()}function EP(e){return EP=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},EP(e)}function CP(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function PP(e,t){return PP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},PP(e,t)}function AP(e){var t=function(e,t){if("object"!=_P(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!=_P(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_P(t)?t:String(t)}OP.prototype.THUMBNAIL_CLASS="bpmn-icon-transaction",OP.prototype.Type="StateMachine";var TP=function(e){function t(){var e,n,o,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,s=new Array(i),a=0;a=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw i}}}}function jP(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function YP(e,t){for(var n=0;n1)return!1;if(Kb(e[0]||e,"Catch")){if(n&&"intersect"===Hw(n,t,-15))return!1;if(Kb(t,"Task"))return"attach"}return!1}function WT(e){return WT="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},WT(e)}function XT(e,t,n){return t=function(e){var t=function(e,t){if("object"!=WT(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!=WT(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==WT(t)?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GT(e){this.elementRegistry=e}function UT(e){return function(e){if(Array.isArray(e))return YT(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return YT(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?YT(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function YT(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},l=this.elementFactory,c=this.canvas,u=e.style;if("Node"===u.Type)s=u.bounds,i=ZT(e,{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}),t=l.createShape(i),c.addShape(t);else{if("Edge"!==u.Type)throw new Error("unknown di for element ".concat(e.id));n=function(e){var t=e.waypoints;return t?Be(t,(function(e){var t={x:e.x,y:e.y};return Ge({original:t},t)})):null}(u),o=a.source||this.getSource(e),r=this.getTarget(e),e.style.source=o,e.style.target=r,o&&r&&(i=ZT(e,{source:o,target:r,waypoints:n}),t=l.createConnection(i),c.addConnection(t))}return t},KT.prototype.getSource=function(e){return this.getShape(e.style.source)},KT.prototype.getTarget=function(e){return this.getShape(e.style.target)},KT.prototype.getShape=function(e){return this.elementRegistry.find((function(t){return t.businessObject.Name===e}))};const JT={__init__:["modeling","sagaImporter","sagaExporter","sagaFactory","sagaRules"],__depends__:[qE,QE,TO,h_],elementFactory:["type",HE],modeling:["type",NC],sagaImporter:["type",KT],sagaExporter:["type",GT],sagaFactory:["type",qT],sagaRules:["type",QT]};function eM(e,t,n,o,r,i,s,a,l){a=a||{},t.registerProvider(this),this.contextPad=t,this.modeling=n,this.elementFactory=o,this.connect=r,this.canvas=s,!1!==a.autoPlace&&(this.autoPlace=l.get("autoPlace",!1)),e.on("create.end",250,(function(e){var n=e.context.shape;if(ZO(e)){var o=t.getEntries(n);o.replace&&o.replace.action.click(e,n)}}))}eM.$inject=["eventBus","contextPad","modeling","elementFactory","connect","create","canvas","config.contextPad","injector"],eM.prototype.getContextPadEntries=function(e){var t=this.modeling,n=this.connect,o={};if("label"===e.type)return o;var r=e.businessObject.type;function i(e,t,o){n.start(e,t,o)}return Ge(o,{delete:{group:"edit",className:"bpmn-icon-trash",title:"Remove",action:{click:function(){t.removeElements([e])}}}}),Kb(r,"Connection")||Ge(o,{connect:{group:"edit",className:"bpmn-icon-connection-multi",title:"Connect",action:{click:i,dragstart:i}}}),o};var tM=[kA,vA,TA,jT,NA,eT,sT,pT,CT];function nM(e,t,n,o){this.create=e,this.elementFactory=t,this.lassoTool=n,this.palette=o,o.registerProvider(this)}nM.$inject=["create","elementFactory","lassoTool","palette"],nM.prototype.getPaletteEntries=function(){var e=this.create,t=this.elementFactory,n=this.lassoTool,o={"lasso-tool":{group:"tools",className:"palette-icon-lasso-tool",title:"Activate Lasso Tool",action:{click:function(e){n.activateSelection(e)}}},"tool-separator":{group:"tools",separator:!0}};return tM.forEach((function(n){var r=n.prototype.Type;o["create-".concat(r)]=function(n,o,r,i,s){function a(o){var r=t.createShape(Ge({type:n},undefined));e.start(o,r)}return{group:"state",className:r,title:i,action:{dragstart:a,click:a}}}(r,0,n.prototype.THUMBNAIL_CLASS,"Create ".concat(r))})),o};const oM={__init__:["contextPadProvider","paletteProvider"],contextPadProvider:["type",eM],paletteProvider:["type",nM]};function rM(e){return rM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rM(e)}function iM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function sM(e){for(var t=1;t1)for(;n=o.shift();){if(!(n.length+ie?t.width:e}),0),g=s.top;"middle"===i.vertical&&(g+=(o.height-f)/2),g-=(l||u[0].height)/4;var m=Ix("text");return Px(m,r),Te(u,(function(e){var t;switch(g+=l||e.height,i.horizontal){case"left":t=s.left;break;case"right":t=(a?d:h)-s.right-e.width;break;default:t=Math.max(((a?d:h)-e.width)/2+s.left,0)}var n=Ix("tspan");Px(n,{x:t,y:g}),n.textContent=e.text,kx(m,n)})),Rx(p),{dimensions:{width:d,height:f},element:m}},OM.$inject=["config.textRenderer"];var _M=/\{([^{}]+)\}/g,kM=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;const SM={__init__:["renderer"],renderer:["type",fM],textRenderer:["type",OM],pathMap:["type",function(){this.pathMap={TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,o,r=this.pathMap[e];t.abspos?(n=t.abspos.x,o=t.abspos.y):(n=t.containerWidth*t.position.mx,o=t.containerHeight*t.position.my);var i,s,a={};if(t.position){for(var l=t.containerHeight/r.height*t.yScaleFactor,c=t.containerWidth/r.width*t.xScaleFactor,u=0;ue.length)&&(t=e.length);for(var n=0,o=new Array(t);n
')},RM.prototype.emit=function(e,t){return this.get("eventBus").fire(e,t)},RM.prototype.detach=function(){var e=this.container,t=e.parentNode;t&&(this.emit("detach",{}),t.removeChild(e))},RM.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.appendChild(this.container),this.emit("attach",{}),this.get("canvas").resized()},RM.prototype.init=function(e,t){var n=t.additionalModules,o=t.canvas,r=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(t,CM),i=t.modules||this.modules,s=[].concat(TM(i),TM(n||[])),a=AM(AM({},r),{},{canvas:AM(AM({},o),{},{container:e}),modules:s});OO.call(this,a),t&&t.container&&this.attachTo(t.container),this.get("eventBus").fire("editor.attached")},RM.prototype.clear=function(){OO.prototype.clear.call(this)},RM.prototype.import=function(e){this.clear(),this.get("sagaImporter").import(e)},RM.prototype.export=function(){return this.get("sagaExporter").export()},RM.prototype.exportSvg=function(){var e,t,n=this.get("eventBus");n.fire("saveSVG.start");try{var o=this.get("canvas"),r=o.getActiveLayer(),i=mn("defs",o._svg),s=Gx(r),a=i?"".concat(Gx(i),""):"",l=r.getBBox();e='\n\x3c!-- created with seata-saga-statemachine-designer / https://seata.io --\x3e\n\n').concat(a).concat(s,"")}catch(e){t=e}if(n.fire("saveSVG.done",{error:t,svg:e}),t)throw t;return e};var DM=new RM({container:document.querySelector("#canvas"),keyboard:{bindTo:document},propertiesPanel:{parent:"#properties"},additionalModules:[Gb,wx]});!function(e){var t=gn('
');e.get("canvas")._container.appendChild(t),Bt.render(Lt("div",{style:{position:"fixed",bottom:"10px",left:"20px"},children:[Lt(jM,{editor:e}),Lt(BM,{editor:e})]}),t)}(DM),DM.import({Name:"StateMachine-".concat(Ub()),Comment:"This state machine is modeled by designer tools.",Version:"0.0.1",style:{bounds:{x:200,y:200,width:36,height:36}}})})()})(); //# sourceMappingURL=bundle.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy