@camunda/task-testing 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +34 -34
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +94 -94
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
import*as t from"react";import*as e from"@carbon/react";import*as n from"@carbon/icons-react";var i={7:t=>{var e,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var r=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise(function(n,i){function r(n){t.removeListener(e,s),i(n)}function s(){"function"==typeof t.removeListener&&t.removeListener("error",r),n([].slice.call(arguments))}g(t,e,s,{once:!0}),"error"!==e&&function(t,e){"function"==typeof t.on&&g(t,"error",e,{once:!0})}(t,r)})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function l(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function a(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function h(t,e,n,i){var r,s,o,h;if(l(n),void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),s=t._events),o=s[e]),void 0===o)o=s[e]=n,++t._eventsCount;else if("function"==typeof o?o=s[e]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(r=a(t))>0&&o.length>r&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=o.length,h=c,console&&console.warn&&console.warn(h)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},r=c.bind(i);return r.listener=n,i.wrapFn=r,r}function d(t,e,n){var i=t._events;if(void 0===i)return[];var r=i[e];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(r):p(r,r.length)}function f(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(t,e){for(var n=new Array(e),i=0;i<e;++i)n[i]=t[i];return n}function g(t,e,n,i){if("function"==typeof t.on)i.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,function r(s){i.once&&t.removeEventListener(e,r),n(s)})}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(t){if("number"!=typeof t||t<0||r(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");o=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||r(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return a(this)},s.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,s=this._events;if(void 0!==s)r=r&&void 0===s.error;else if(!r)return!1;if(r){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var l=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw l.context=o,l}var a=s[t];if(void 0===a)return!1;if("function"==typeof a)i(a,this,e);else{var h=a.length,c=p(a,h);for(n=0;n<h;++n)i(c[n],this,e)}return!0},s.prototype.addListener=function(t,e){return h(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return h(this,t,e,!0)},s.prototype.once=function(t,e){return l(e),this.on(t,u(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return l(e),this.prependListener(t,u(this,t,e)),this},s.prototype.removeListener=function(t,e){var n,i,r,s,o;if(l(e),void 0===(i=this._events))return this;if(void 0===(n=i[t]))return this;if(n===e||n.listener===e)0===--this._eventsCount?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===e||n[s].listener===e){o=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,r),1===n.length&&(i[t]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",t,o||e)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(t){var e,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var r,s=Object.keys(n);for(i=0;i<s.length;++i)"removeListener"!==(r=s[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):f.call(t,e)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},20:(t,e,n)=>{var i=n(649),r=Symbol.for("react.element"),s=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),o=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function a(t,e,n){var i,a={},h=null,c=null;for(i in void 0!==n&&(h=""+n),void 0!==e.key&&(h=""+e.key),void 0!==e.ref&&(c=e.ref),e)s.call(e,i)&&!l.hasOwnProperty(i)&&(a[i]=e[i]);if(t&&t.defaultProps)for(i in e=t.defaultProps)void 0===a[i]&&(a[i]=e[i]);return{$$typeof:r,type:t,key:h,ref:c,props:a,_owner:o.current}}e.jsx=a,e.jsxs=a},56:(t,e,n)=>{t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},72:t=>{var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var s={},o=[],l=0;l<t.length;l++){var a=t[l],h=i.base?a[0]+i.base:a[0],c=s[h]||0,u="".concat(h," ").concat(c);s[h]=c+1;var d=n(u),f={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==d)e[d].references++,e[d].updater(f);else{var p=r(f,i);i.byIndex=l,e.splice(l,0,{identifier:u,updater:p,references:1})}o.push(u)}return o}function r(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,r){var s=i(t=t||[],r=r||{});return function(t){t=t||[];for(var o=0;o<s.length;o++){var l=n(s[o]);e[l].references--}for(var a=i(t,r),h=0;h<s.length;h++){var c=n(s[h]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}s=a}}},113:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n}).join("")},e.i=function(t,n,i,r,s){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(i)for(var l=0;l<this.length;l++){var a=this[l][0];null!=a&&(o[a]=!0)}for(var h=0;h<t.length;h++){var c=[].concat(t[h]);i&&o[c[0]]||(void 0!==s&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=s),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),e.push(c))}},e}},354:t=>{t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(r," */");return[e].concat([s]).join("\n")}return[e].join("\n")}},467:(t,e,n)=>{t.exports=n(20)},520:(t,e,n)=>{n.d(e,{A:()=>l});var i=n(354),r=n.n(i),s=n(314),o=n.n(s)()(r());o.push([t.id,".task-testing__container{display:flex;flex-direction:row;height:100%;width:100%;padding:10px;font-size:14px}.task-testing__container.task-testing__container--empty .task-testing__container-no-config,.task-testing__container.task-testing__container--empty .task-testing__container-no-element{display:flex;align-items:center;gap:5px;height:32px}.task-testing__container.task-testing__container--empty .task-testing__container-no-config .cds--inline-loading,.task-testing__container.task-testing__container--empty .task-testing__container-no-element .cds--inline-loading{inline-size:initial;min-block-size:initial}.task-testing__container .task-testing__container--left{width:50%;display:flex;flex-direction:column;border-right:1px solid #e0e0e0;padding-right:6px}.task-testing__container .task-testing__container--right{width:50%;display:flex;flex-direction:column;padding-left:6px}.task-testing__container .task-testing__container--header{display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:12px;width:100%}.task-testing__container .task-testing__container--header .task-header{display:flex;gap:6px;min-width:0}.task-testing__container .task-testing__container--header .task-header .task-type{font-weight:bold}.task-testing__container .task-testing__container--header .task-header .task-type,.task-testing__container .task-testing__container--header .task-header .task-name{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex-shrink:1;flex-grow:1}.task-testing__container .task-testing__container--header .btn-execute{width:138px}.task-testing__container .task-testing__container--header .cds--tooltip-content{padding:12px}.task-testing__container .task-testing__container--header .cds--btn .cds--inline-loading{inline-size:initial;min-block-size:initial}.task-testing__container .input{flex-grow:1;display:flex;flex-direction:column;gap:5px;margin-top:6px}.task-testing__container .input .input__header{display:flex;align-items:center;gap:5px;width:100%;padding-top:5px}.task-testing__container .input .input__header--title{color:#525252}.task-testing__container .input .input__header--button-reset{margin-left:auto}.task-testing__container .output{flex-grow:1;display:flex;flex-direction:column;gap:5px}.task-testing__container .output .output__header{display:flex;align-items:center;justify-content:flex-end;height:32px;width:100%;gap:10px}.task-testing__container .output .output__header .cds--link{cursor:pointer}.task-testing__container .output .output__header .link--disabled,.task-testing__container .output .output__header .link--disabled:hover{color:#8d8d8d;text-decoration:none;cursor:default}.task-testing__container .output .output__header--title{color:#525252;display:flex;align-items:center;gap:6px;margin-right:auto}.task-testing__container .output .output__header--title svg.output__status-icon--ready{fill:#0043ce}.task-testing__container .output .output__header--title svg.output__status-icon--success{fill:#24a148}.task-testing__container .output .output__header--title svg.output__status-icon--error{fill:#da1e28}.task-testing__container .output .output__header--title .cds--inline-loading{inline-size:16px;min-block-size:initial}.task-testing__container .output .output__body{display:flex;flex-direction:column;flex-grow:1;position:relative}.task-testing__container .output .output__body .cds--tabs{--cds-layout-size-height-local: 32px}.task-testing__container .output .output__body .cds--tab-content{padding:0;height:calc(100% - 20px)}.task-testing__container .output .output__body .cds--tab-content:not([hidden]){display:flex}.task-testing__container .output .output__body .cds--popover{display:none}.task-testing__container .output .output__error{display:flex;flex-direction:column;gap:12px;padding:12px;margin-bottom:12px;border:1px solid #da1e28;border-left-width:3px;background-color:#fff1f1}.task-testing__container .output .output__error .output__error--title{display:flex;flex-direction:row;align-items:center;font-weight:bold}.task-testing__container .output .output__error .output__error--title svg{fill:#da1e28}.task-testing__container .output .output__error .output__error--title .output__error--action{margin-left:auto}.task-testing__container .output .output__variables--empty{height:32px;display:flex;align-items:center;color:#525252}.task-testing__container .output .output__variables--empty-action{font-weight:bold}.task-testing__container .output code{font-size:14px}.task-testing__container .cds--popover-container:not(.show-tooltip) .cds--popover{display:none !important}.task-testing__container .cds--link[role=button]{cursor:pointer}.code__editor{position:relative;flex-grow:1;display:flex;flex-direction:column}.code__editor.code__editor--error .code__editor-codemirror .code__editor-codemirror-inner .cm-editor{outline:1px solid #da1e28;outline-offset:-1px}.code__editor .code__editor-codemirror{position:relative;flex-grow:1}.code__editor .code__editor-codemirror .code__editor-codemirror-inner{position:absolute;top:0;left:0;right:0;bottom:0}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .cm-editor{height:100%;background-color:var(--cds-layer, #f4f4f4)}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .cm-scroller{overflow-y:auto !important}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .cm-content{padding:15px}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .cm-focused{outline:none}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .cm-tooltip{font-size:14px}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .info{padding:5px;font-family:monospace;font-size:12px;max-width:300px;word-wrap:break-word}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .info span{font-style:italic}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .info pre{margin-top:5px}.code__editor .code__editor-error{color:#da1e28;font-size:13px;margin-top:5px}.code__editor .code__editor-copy-button{position:absolute;top:10px;right:10px;z-index:10}.code__editor .code__editor-copy-button svg{fill:#525252}","",{version:3,sources:["webpack://./lib/style/style.scss"],names:[],mappings:"AAAA,yBACE,YAAA,CACA,kBAAA,CACA,WAAA,CACA,UAAA,CACA,YAAA,CACA,cAAA,CAGE,uLAEE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,WAAA,CAEA,iOACE,mBAAA,CACA,sBAAA,CAKN,wDACE,SAAA,CACA,YAAA,CACA,qBAAA,CACA,8BAAA,CACA,iBAAA,CAGF,yDACE,SAAA,CACA,YAAA,CACA,qBAAA,CACA,gBAAA,CAGF,0DACE,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,6BAAA,CACA,QAAA,CACA,UAAA,CAEA,uEACE,YAAA,CACA,OAAA,CACA,WAAA,CAEA,kFACE,gBAAA,CAGF,oKAEE,WAAA,CACA,eAAA,CACA,kBAAA,CACA,sBAAA,CACA,aAAA,CACA,WAAA,CAIJ,uEACE,WAAA,CAIF,gFACE,YAAA,CAGF,yFACE,mBAAA,CACA,sBAAA,CAIJ,gCACE,WAAA,CACA,YAAA,CACA,qBAAA,CACA,OAAA,CACA,cAAA,CAEA,+CACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,UAAA,CACA,eAAA,CAGF,sDACE,aAAA,CAGF,6DACE,gBAAA,CAIJ,iCACE,WAAA,CACA,YAAA,CACA,qBAAA,CACA,OAAA,CAEA,iDACE,YAAA,CACA,kBAAA,CACA,wBAAA,CACA,WAAA,CACA,UAAA,CACA,QAAA,CAEA,4DACE,cAAA,CAGF,wIACE,aAAA,CACA,oBAAA,CACA,cAAA,CAIJ,wDACE,aAAA,CACA,YAAA,CACA,kBAAA,CACA,OAAA,CACA,iBAAA,CAEA,uFACE,YAAA,CAGF,yFACE,YAAA,CAGF,uFACE,YAAA,CAGF,6EACE,gBAAA,CACA,sBAAA,CAIJ,+CACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,iBAAA,CAEA,0DACE,oCAAA,CAGF,iEACE,SAAA,CACA,wBAAA,CAGF,+EACE,YAAA,CAIF,6DACE,YAAA,CAIJ,gDACE,YAAA,CACA,qBAAA,CACA,QAAA,CACA,YAAA,CACA,kBAAA,CACA,wBAAA,CACA,qBAAA,CACA,wBAAA,CAEA,sEACE,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,gBAAA,CAEA,0EACE,YAAA,CAGF,6FACE,gBAAA,CAKN,2DACE,WAAA,CACA,YAAA,CACA,kBAAA,CACA,aAAA,CAGF,kEACE,gBAAA,CAGF,sCACE,cAAA,CAIJ,kFACE,uBAAA,CAGF,iDACE,cAAA,CAIJ,cACE,iBAAA,CACA,WAAA,CACA,YAAA,CACA,qBAAA,CAEA,qGACE,yBAAA,CACA,mBAAA,CAGF,uCACE,iBAAA,CACA,WAAA,CAEA,sEACE,iBAAA,CACA,KAAA,CACA,MAAA,CACA,OAAA,CACA,QAAA,CAEA,iFACE,WAAA,CACA,0CAAA,CAGF,mFACE,0BAAA,CAGF,kFACE,YAAA,CAGF,kFACE,YAAA,CAGF,kFACE,cAAA,CAGF,4EACE,WAAA,CACA,qBAAA,CACA,cAAA,CACA,eAAA,CACA,oBAAA,CAEA,iFACE,iBAAA,CAGF,gFACE,cAAA,CAMR,kCACE,aAAA,CACA,cAAA,CACA,cAAA,CAGF,wCACE,iBAAA,CACA,QAAA,CACA,UAAA,CACA,UAAA,CAEA,4CACE,YAAA",sourcesContent:['.task-testing__container {\r\n display: flex;\r\n flex-direction: row;\r\n height: 100%;\r\n width: 100%;\r\n padding: 10px;\r\n font-size: 14px;\r\n\r\n &.task-testing__container--empty {\r\n .task-testing__container-no-config,\r\n .task-testing__container-no-element {\r\n display: flex;\r\n align-items: center;\r\n gap: 5px;\r\n height: 32px;\r\n\r\n .cds--inline-loading {\r\n inline-size: initial;\r\n min-block-size: initial;\r\n }\r\n }\r\n }\r\n\r\n .task-testing__container--left {\r\n width: 50%;\r\n display: flex;\r\n flex-direction: column;\r\n border-right: 1px solid #E0E0E0;\r\n padding-right: 6px;\r\n }\r\n\r\n .task-testing__container--right {\r\n width: 50%;\r\n display: flex;\r\n flex-direction: column;\r\n padding-left: 6px;\r\n }\r\n\r\n .task-testing__container--header {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: space-between;\r\n gap: 12px;\r\n width: 100%;\r\n\r\n .task-header {\r\n display: flex;\r\n gap: 6px;\r\n min-width: 0;\r\n \r\n .task-type {\r\n font-weight: bold;\r\n }\r\n\r\n .task-type,\r\n .task-name {\r\n min-width: 0;\r\n overflow: hidden;\r\n white-space: nowrap;\r\n text-overflow: ellipsis;\r\n flex-shrink: 1;\r\n flex-grow: 1;\r\n }\r\n }\r\n\r\n .btn-execute {\r\n width: 138px;\r\n }\r\n\r\n\r\n .cds--tooltip-content {\r\n padding: 12px;\r\n }\r\n\r\n .cds--btn .cds--inline-loading {\r\n inline-size: initial;\r\n min-block-size: initial;\r\n }\r\n }\r\n\r\n .input {\r\n flex-grow: 1;\r\n display: flex;\r\n flex-direction: column;\r\n gap: 5px;\r\n margin-top: 6px;\r\n\r\n .input__header {\r\n display: flex;\r\n align-items: center;\r\n gap: 5px;\r\n width: 100%;\r\n padding-top: 5px;\r\n }\r\n\r\n .input__header--title {\r\n color: #525252;\r\n }\r\n\r\n .input__header--button-reset {\r\n margin-left: auto;\r\n }\r\n }\r\n\r\n .output {\r\n flex-grow: 1;\r\n display: flex;\r\n flex-direction: column;\r\n gap: 5px;\r\n\r\n .output__header {\r\n display: flex;\r\n align-items: center;\r\n justify-content: flex-end;\r\n height: 32px;\r\n width: 100%;\r\n gap: 10px;\r\n\r\n .cds--link {\r\n cursor: pointer;\r\n }\r\n\r\n .link--disabled, .link--disabled:hover {\r\n color: #8d8d8d;\r\n text-decoration: none;\r\n cursor: default;\r\n }\r\n }\r\n\r\n .output__header--title {\r\n color: #525252;\r\n display: flex;\r\n align-items: center;\r\n gap: 6px;\r\n margin-right: auto;\r\n\r\n svg.output__status-icon--ready {\r\n fill: #0043ce;\r\n }\r\n\r\n svg.output__status-icon--success {\r\n fill: #24a148;\r\n }\r\n\r\n svg.output__status-icon--error {\r\n fill: #da1e28;\r\n }\r\n\r\n .cds--inline-loading {\r\n inline-size: 16px;\r\n min-block-size: initial;\r\n }\r\n }\r\n\r\n .output__body {\r\n display: flex;\r\n flex-direction: column;\r\n flex-grow: 1;\r\n position: relative;\r\n\r\n .cds--tabs {\r\n --cds-layout-size-height-local: 32px;\r\n }\r\n \r\n .cds--tab-content {\r\n padding: 0;\r\n height: calc(100% - 20px);\r\n }\r\n\r\n .cds--tab-content:not([hidden]) {\r\n display: flex;\r\n }\r\n\r\n // Tooltip on Carbon Button with absolute position is broken.\r\n .cds--popover {\r\n display: none;\r\n }\r\n }\r\n\r\n .output__error {\r\n display: flex;\r\n flex-direction: column;\r\n gap: 12px;\r\n padding: 12px;\r\n margin-bottom: 12px;\r\n border: 1px solid #da1e28;\r\n border-left-width: 3px;\r\n background-color: #fff1f1;\r\n\r\n .output__error--title {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n font-weight: bold;\r\n\r\n svg {\r\n fill: #da1e28;\r\n }\r\n\r\n .output__error--action {\r\n margin-left: auto;\r\n }\r\n }\r\n }\r\n\r\n .output__variables--empty {\r\n height: 32px;\r\n display: flex;\r\n align-items: center;\r\n color: #525252;\r\n }\r\n\r\n .output__variables--empty-action {\r\n font-weight: bold;\r\n }\r\n\r\n code {\r\n font-size: 14px;\r\n }\r\n }\r\n\r\n .cds--popover-container:not(.show-tooltip) .cds--popover {\r\n display: none !important;\r\n }\r\n\r\n .cds--link[role="button"] {\r\n cursor: pointer;\r\n }\r\n}\r\n\r\n.code__editor {\r\n position: relative;\r\n flex-grow: 1;\r\n display: flex;\r\n flex-direction: column;\r\n\r\n &.code__editor--error .code__editor-codemirror .code__editor-codemirror-inner .cm-editor {\r\n outline: 1px solid #da1e28;\r\n outline-offset: -1px;\r\n }\r\n\r\n .code__editor-codemirror {\r\n position: relative;\r\n flex-grow: 1;\r\n\r\n .code__editor-codemirror-inner {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n\r\n .cm-editor {\r\n height: 100%;\r\n background-color: var(--cds-layer, #f4f4f4);\r\n }\r\n\r\n .cm-scroller {\r\n overflow-y: auto !important;\r\n }\r\n\r\n .cm-content {\r\n padding: 15px;\r\n }\r\n\r\n .cm-focused {\r\n outline: none;\r\n }\r\n\r\n .cm-tooltip {\r\n font-size: 14px;\r\n }\r\n\r\n .info {\r\n padding: 5px;\r\n font-family: monospace;\r\n font-size: 12px;\r\n max-width: 300px;\r\n word-wrap: break-word;\r\n\r\n span {\r\n font-style: italic;\r\n }\r\n\r\n pre {\r\n margin-top: 5px;\r\n }\r\n }\r\n }\r\n }\r\n\r\n .code__editor-error {\r\n color: #da1e28;\r\n font-size: 13px;\r\n margin-top: 5px;\r\n }\r\n\r\n .code__editor-copy-button {\r\n position: absolute;\r\n top: 10px;\r\n right: 10px;\r\n z-index: 10;\r\n\r\n svg {\r\n fill: #525252;\r\n }\r\n }\r\n}'],sourceRoot:""}]);const l=o},540:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},633:(t,e,n)=>{var i=n(649);function r(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=Object.prototype.hasOwnProperty,o=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,l={},a={};function h(t){return!!s.call(a,t)||!s.call(l,t)&&(o.test(t)?a[t]=!0:(l[t]=!0,!1))}function c(t,e,n,i,r,s,o){this.acceptsBooleans=2===e||3===e||4===e,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var u={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){u[t]=new c(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];u[e]=new c(e,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){u[t]=new c(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){u[t]=new c(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){u[t]=new c(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){u[t]=new c(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){u[t]=new c(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){u[t]=new c(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){u[t]=new c(t,5,!1,t.toLowerCase(),null,!1,!1)});var d=/[\-:]([a-z])/g;function f(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(d,f);u[e]=new c(e,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(d,f);u[e]=new c(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(d,f);u[e]=new c(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){u[t]=new c(t,1,!1,t.toLowerCase(),null,!1,!1)}),u.xlinkHref=new c("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){u[t]=new c(t,1,!1,t.toLowerCase(),null,!0,!0)});var p={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},g=["Webkit","ms","Moz","O"];Object.keys(p).forEach(function(t){g.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),p[e]=p[t]})});var m=/["'&<>]/;function v(t){if("boolean"==typeof t||"number"==typeof t)return""+t;t=""+t;var e=m.exec(t);if(e){var n,i="",r=0;for(n=e.index;n<t.length;n++){switch(t.charCodeAt(n)){case 34:e=""";break;case 38:e="&";break;case 39:e="'";break;case 60:e="<";break;case 62:e=">";break;default:continue}r!==n&&(i+=t.substring(r,n)),r=n+1,i+=e}t=r!==n?i+t.substring(r,n):i}return t}var b=/([A-Z])/g,y=/^ms-/,w=Array.isArray;function x(t,e){return{insertionMode:t,selectedValue:e}}var k=new Map;function A(t,e,n){if("object"!=typeof n)throw Error(r(62));for(var i in e=!0,n)if(s.call(n,i)){var o=n[i];if(null!=o&&"boolean"!=typeof o&&""!==o){if(0===i.indexOf("--")){var l=v(i);o=v((""+o).trim())}else{l=i;var a=k.get(l);void 0!==a||(a=v(l.replace(b,"-$1").toLowerCase().replace(y,"-ms-")),k.set(l,a)),l=a,o="number"==typeof o?0===o||s.call(p,i)?""+o:o+"px":v((""+o).trim())}e?(e=!1,t.push(' style="',l,":",o)):t.push(";",l,":",o)}}e||t.push('"')}function S(t,e,n,i){switch(n){case"style":return void A(t,e,i);case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":return}if(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])if(null!==(e=u.hasOwnProperty(n)?u[n]:null)){switch(typeof i){case"function":case"symbol":return;case"boolean":if(!e.acceptsBooleans)return}switch(n=e.attributeName,e.type){case 3:i&&t.push(" ",n,'=""');break;case 4:!0===i?t.push(" ",n,'=""'):!1!==i&&t.push(" ",n,'="',v(i),'"');break;case 5:isNaN(i)||t.push(" ",n,'="',v(i),'"');break;case 6:!isNaN(i)&&1<=i&&t.push(" ",n,'="',v(i),'"');break;default:e.sanitizeURL&&(i=""+i),t.push(" ",n,'="',v(i),'"')}}else if(h(n)){switch(typeof i){case"function":case"symbol":return;case"boolean":if("data-"!==(e=n.toLowerCase().slice(0,5))&&"aria-"!==e)return}t.push(" ",n,'="',v(i),'"')}}function C(t,e,n){if(null!=e){if(null!=n)throw Error(r(60));if("object"!=typeof e||!("__html"in e))throw Error(r(61));null!=(e=e.__html)&&t.push(""+e)}}function E(t,e,n,i){t.push(M(n));var r,o=n=null;for(r in e)if(s.call(e,r)){var l=e[r];if(null!=l)switch(r){case"children":n=l;break;case"dangerouslySetInnerHTML":o=l;break;default:S(t,i,r,l)}}return t.push(">"),C(t,o,n),"string"==typeof n?(t.push(v(n)),null):n}var O=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,T=new Map;function M(t){var e=T.get(t);if(void 0===e){if(!O.test(t))throw Error(r(65,t));e="<"+t,T.set(t,e)}return e}function _(t,e,n){if(t.push('\x3c!--$?--\x3e<template id="'),null===n)throw Error(r(395));return t.push(n),t.push('"></template>')}var P=/[<\u2028\u2029]/g;function D(t){return JSON.stringify(t).replace(P,function(t){switch(t){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}function R(t,e,n,i){return n.generateStaticMarkup?(t.push(v(e)),!1):(""===e?t=i:(i&&t.push("\x3c!-- --\x3e"),t.push(v(e)),t=!0),t)}var B=Object.assign,I=Symbol.for("react.element"),N=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),j=Symbol.for("react.provider"),z=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),K=Symbol.for("react.scope"),G=Symbol.for("react.debug_trace_mode"),Y=Symbol.for("react.legacy_hidden"),Q=Symbol.for("react.default_value"),J=Symbol.iterator;function X(t){if(null==t)return null;if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case L:return"Fragment";case N:return"Portal";case V:return"Profiler";case F:return"StrictMode";case W:return"Suspense";case $:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case z:return(t.displayName||"Context")+".Consumer";case j:return(t._context.displayName||"Context")+".Provider";case H:var e=t.render;return(t=t.displayName)||(t=""!==(t=e.displayName||e.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case q:return null!==(e=t.displayName||null)?e:X(t.type)||"Memo";case U:e=t._payload,t=t._init;try{return X(t(e))}catch(t){}}return null}var Z={};function tt(t,e){if(!(t=t.contextTypes))return Z;var n,i={};for(n in t)i[n]=e[n];return i}var et=null;function nt(t,e){if(t!==e){t.context._currentValue2=t.parentValue,t=t.parent;var n=e.parent;if(null===t){if(null!==n)throw Error(r(401))}else{if(null===n)throw Error(r(401));nt(t,n)}e.context._currentValue2=e.value}}function it(t){t.context._currentValue2=t.parentValue,null!==(t=t.parent)&&it(t)}function rt(t){var e=t.parent;null!==e&&rt(e),t.context._currentValue2=t.value}function st(t,e){if(t.context._currentValue2=t.parentValue,null===(t=t.parent))throw Error(r(402));t.depth===e.depth?nt(t,e):st(t,e)}function ot(t,e){var n=e.parent;if(null===n)throw Error(r(402));t.depth===n.depth?nt(t,n):ot(t,n),e.context._currentValue2=e.value}function lt(t){var e=et;e!==t&&(null===e?rt(t):null===t?it(e):e.depth===t.depth?nt(e,t):e.depth>t.depth?st(e,t):ot(e,t),et=t)}var at={isMounted:function(){return!1},enqueueSetState:function(t,e){null!==(t=t._reactInternals).queue&&t.queue.push(e)},enqueueReplaceState:function(t,e){(t=t._reactInternals).replace=!0,t.queue=[e]},enqueueForceUpdate:function(){}};function ht(t,e,n,i){var r=void 0!==t.state?t.state:null;t.updater=at,t.props=n,t.state=r;var s={queue:[],replace:!1};t._reactInternals=s;var o=e.contextType;if(t.context="object"==typeof o&&null!==o?o._currentValue2:i,"function"==typeof(o=e.getDerivedStateFromProps)&&(r=null==(o=o(n,r))?r:B({},r,o),t.state=r),"function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate&&("function"==typeof t.UNSAFE_componentWillMount||"function"==typeof t.componentWillMount))if(e=t.state,"function"==typeof t.componentWillMount&&t.componentWillMount(),"function"==typeof t.UNSAFE_componentWillMount&&t.UNSAFE_componentWillMount(),e!==t.state&&at.enqueueReplaceState(t,t.state,null),null!==s.queue&&0<s.queue.length)if(e=s.queue,o=s.replace,s.queue=null,s.replace=!1,o&&1===e.length)t.state=e[0];else{for(s=o?e[0]:t.state,r=!0,o=o?1:0;o<e.length;o++){var l=e[o];null!=(l="function"==typeof l?l.call(t,s,n,i):l)&&(r?(r=!1,s=B({},s,l)):B(s,l))}t.state=s}else s.queue=null}var ct={id:1,overflow:""};function ut(t,e,n){var i=t.id;t=t.overflow;var r=32-dt(i)-1;i&=~(1<<r),n+=1;var s=32-dt(e)+r;if(30<s){var o=r-r%5;return s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,{id:1<<32-dt(e)+r|n<<r|i,overflow:s+t}}return{id:1<<s|n<<r|i,overflow:t}}var dt=Math.clz32?Math.clz32:function(t){return 0==(t>>>=0)?32:31-(ft(t)/pt|0)|0},ft=Math.log,pt=Math.LN2,gt="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},mt=null,vt=null,bt=null,yt=null,wt=!1,xt=!1,kt=0,At=null,St=0;function Ct(){if(null===mt)throw Error(r(321));return mt}function Et(){if(0<St)throw Error(r(312));return{memoizedState:null,queue:null,next:null}}function Ot(){return null===yt?null===bt?(wt=!1,bt=yt=Et()):(wt=!0,yt=bt):null===yt.next?(wt=!1,yt=yt.next=Et()):(wt=!0,yt=yt.next),yt}function Tt(){vt=mt=null,xt=!1,bt=null,St=0,yt=At=null}function Mt(t,e){return"function"==typeof e?e(t):e}function _t(t,e,n){if(mt=Ct(),yt=Ot(),wt){var i=yt.queue;if(e=i.dispatch,null!==At&&void 0!==(n=At.get(i))){At.delete(i),i=yt.memoizedState;do{i=t(i,n.action),n=n.next}while(null!==n);return yt.memoizedState=i,[i,e]}return[yt.memoizedState,e]}return t=t===Mt?"function"==typeof e?e():e:void 0!==n?n(e):e,yt.memoizedState=t,t=(t=yt.queue={last:null,dispatch:null}).dispatch=Dt.bind(null,mt,t),[yt.memoizedState,t]}function Pt(t,e){if(mt=Ct(),e=void 0===e?null:e,null!==(yt=Ot())){var n=yt.memoizedState;if(null!==n&&null!==e){var i=n[1];t:if(null===i)i=!1;else{for(var r=0;r<i.length&&r<e.length;r++)if(!gt(e[r],i[r])){i=!1;break t}i=!0}if(i)return n[0]}}return t=t(),yt.memoizedState=[t,e],t}function Dt(t,e,n){if(25<=St)throw Error(r(301));if(t===mt)if(xt=!0,t={action:n,next:null},null===At&&(At=new Map),void 0===(n=At.get(e)))At.set(e,t);else{for(e=n;null!==e.next;)e=e.next;e.next=t}}function Rt(){throw Error(r(394))}function Bt(){}var It={readContext:function(t){return t._currentValue2},useContext:function(t){return Ct(),t._currentValue2},useMemo:Pt,useReducer:_t,useRef:function(t){mt=Ct();var e=(yt=Ot()).memoizedState;return null===e?(t={current:t},yt.memoizedState=t):e},useState:function(t){return _t(Mt,t)},useInsertionEffect:Bt,useLayoutEffect:function(){},useCallback:function(t,e){return Pt(function(){return t},e)},useImperativeHandle:Bt,useEffect:Bt,useDebugValue:Bt,useDeferredValue:function(t){return Ct(),t},useTransition:function(){return Ct(),[!1,Rt]},useId:function(){var t=vt.treeContext,e=t.overflow;t=((t=t.id)&~(1<<32-dt(t)-1)).toString(32)+e;var n=Nt;if(null===n)throw Error(r(404));return e=kt++,t=":"+n.idPrefix+"R"+t,0<e&&(t+="H"+e.toString(32)),t+":"},useMutableSource:function(t,e){return Ct(),e(t._source)},useSyncExternalStore:function(t,e,n){if(void 0===n)throw Error(r(407));return n()}},Nt=null,Lt=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;function Ft(t){return console.error(t),null}function Vt(){}function jt(t,e,n,i,r,s,o,l){t.allPendingTasks++,null===n?t.pendingRootTasks++:n.pendingTasks++;var a={node:e,ping:function(){var e=t.pingedTasks;e.push(a),1===e.length&&ee(t)},blockedBoundary:n,blockedSegment:i,abortSet:r,legacyContext:s,context:o,treeContext:l};return r.add(a),a}function zt(t,e,n,i,r,s){return{status:0,id:-1,index:e,parentFlushed:!1,chunks:[],children:[],formatContext:i,boundary:n,lastPushedText:r,textEmbedded:s}}function Ht(t,e){if(null!=(t=t.onError(e))&&"string"!=typeof t)throw Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "'+typeof t+'" instead');return t}function Wt(t,e){var n=t.onShellError;n(e),(n=t.onFatalError)(e),null!==t.destination?(t.status=2,t.destination.destroy(e)):(t.status=1,t.fatalError=e)}function $t(t,e,n,i,r){for(mt={},vt=e,kt=0,t=n(i,r);xt;)xt=!1,kt=0,St+=1,yt=null,t=n(i,r);return Tt(),t}function qt(t,e,n,i){var s=n.render(),o=i.childContextTypes;if(null!=o){var l=e.legacyContext;if("function"!=typeof n.getChildContext)i=l;else{for(var a in n=n.getChildContext())if(!(a in o))throw Error(r(108,X(i)||"Unknown",a));i=B({},l,n)}e.legacyContext=i,Gt(t,e,s),e.legacyContext=l}else Gt(t,e,s)}function Ut(t,e){if(t&&t.defaultProps){for(var n in e=B({},e),t=t.defaultProps)void 0===e[n]&&(e[n]=t[n]);return e}return e}function Kt(t,e,n,o,l){if("function"==typeof n)if(n.prototype&&n.prototype.isReactComponent){l=tt(n,e.legacyContext);var a=n.contextType;ht(a=new n(o,"object"==typeof a&&null!==a?a._currentValue2:l),n,o,l),qt(t,e,a,n)}else{l=$t(t,e,n,o,a=tt(n,e.legacyContext));var c=0!==kt;if("object"==typeof l&&null!==l&&"function"==typeof l.render&&void 0===l.$$typeof)ht(l,n,o,a),qt(t,e,l,n);else if(c){o=e.treeContext,e.treeContext=ut(o,1,0);try{Gt(t,e,l)}finally{e.treeContext=o}}else Gt(t,e,l)}else{if("string"!=typeof n){switch(n){case Y:case G:case F:case V:case L:case $:return void Gt(t,e,o.children);case K:throw Error(r(343));case W:t:{n=e.blockedBoundary,l=e.blockedSegment,a=o.fallback,o=o.children;var u={id:null,rootSegmentID:-1,parentFlushed:!1,pendingTasks:0,forceClientRender:!1,completedSegments:[],byteSize:0,fallbackAbortableTasks:c=new Set,errorDigest:null},d=zt(0,l.chunks.length,u,l.formatContext,!1,!1);l.children.push(d),l.lastPushedText=!1;var f=zt(0,0,null,l.formatContext,!1,!1);f.parentFlushed=!0,e.blockedBoundary=u,e.blockedSegment=f;try{if(Qt(t,e,o),t.responseState.generateStaticMarkup||f.lastPushedText&&f.textEmbedded&&f.chunks.push("\x3c!-- --\x3e"),f.status=1,Zt(u,f),0===u.pendingTasks)break t}catch(e){f.status=4,u.forceClientRender=!0,u.errorDigest=Ht(t,e)}finally{e.blockedBoundary=n,e.blockedSegment=l}e=jt(t,a,n,d,c,e.legacyContext,e.context,e.treeContext),t.pingedTasks.push(e)}return}if("object"==typeof n&&null!==n)switch(n.$$typeof){case H:if(o=$t(t,e,n.render,o,l),0!==kt){n=e.treeContext,e.treeContext=ut(n,1,0);try{Gt(t,e,o)}finally{e.treeContext=n}}else Gt(t,e,o);return;case q:return void Kt(t,e,n=n.type,o=Ut(n,o),l);case j:if(l=o.children,n=n._context,o=o.value,a=n._currentValue2,n._currentValue2=o,et=o={parent:c=et,depth:null===c?0:c.depth+1,context:n,parentValue:a,value:o},e.context=o,Gt(t,e,l),null===(t=et))throw Error(r(403));return o=t.parentValue,t.context._currentValue2=o===Q?t.context._defaultValue:o,t=et=t.parent,void(e.context=t);case z:return void Gt(t,e,o=(o=o.children)(n._currentValue2));case U:return void Kt(t,e,n=(l=n._init)(n._payload),o=Ut(n,o),void 0)}throw Error(r(130,null==n?n:typeof n,""))}switch(a=function(t,e,n,o,l){switch(e){case"select":t.push(M("select"));var a=null,c=null;for(p in n)if(s.call(n,p)){var u=n[p];if(null!=u)switch(p){case"children":a=u;break;case"dangerouslySetInnerHTML":c=u;break;case"defaultValue":case"value":break;default:S(t,o,p,u)}}return t.push(">"),C(t,c,a),a;case"option":c=l.selectedValue,t.push(M("option"));var d=u=null,f=null,p=null;for(a in n)if(s.call(n,a)){var g=n[a];if(null!=g)switch(a){case"children":u=g;break;case"selected":f=g;break;case"dangerouslySetInnerHTML":p=g;break;case"value":d=g;default:S(t,o,a,g)}}if(null!=c)if(n=null!==d?""+d:function(t){var e="";return i.Children.forEach(t,function(t){null!=t&&(e+=t)}),e}(u),w(c)){for(o=0;o<c.length;o++)if(""+c[o]===n){t.push(' selected=""');break}}else""+c===n&&t.push(' selected=""');else f&&t.push(' selected=""');return t.push(">"),C(t,p,u),u;case"textarea":for(u in t.push(M("textarea")),p=c=a=null,n)if(s.call(n,u)&&null!=(d=n[u]))switch(u){case"children":p=d;break;case"value":a=d;break;case"defaultValue":c=d;break;case"dangerouslySetInnerHTML":throw Error(r(91));default:S(t,o,u,d)}if(null===a&&null!==c&&(a=c),t.push(">"),null!=p){if(null!=a)throw Error(r(92));if(w(p)&&1<p.length)throw Error(r(93));a=""+p}return"string"==typeof a&&"\n"===a[0]&&t.push("\n"),null!==a&&t.push(v(""+a)),null;case"input":for(c in t.push(M("input")),d=p=u=a=null,n)if(s.call(n,c)&&null!=(f=n[c]))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,"input"));case"defaultChecked":d=f;break;case"defaultValue":u=f;break;case"checked":p=f;break;case"value":a=f;break;default:S(t,o,c,f)}return null!==p?S(t,o,"checked",p):null!==d&&S(t,o,"checked",d),null!==a?S(t,o,"value",a):null!==u&&S(t,o,"value",u),t.push("/>"),null;case"menuitem":for(var m in t.push(M("menuitem")),n)if(s.call(n,m)&&null!=(a=n[m]))switch(m){case"children":case"dangerouslySetInnerHTML":throw Error(r(400));default:S(t,o,m,a)}return t.push(">"),null;case"title":for(g in t.push(M("title")),a=null,n)if(s.call(n,g)&&null!=(c=n[g]))switch(g){case"children":a=c;break;case"dangerouslySetInnerHTML":throw Error(r(434));default:S(t,o,g,c)}return t.push(">"),a;case"listing":case"pre":for(d in t.push(M(e)),c=a=null,n)if(s.call(n,d)&&null!=(u=n[d]))switch(d){case"children":a=u;break;case"dangerouslySetInnerHTML":c=u;break;default:S(t,o,d,u)}if(t.push(">"),null!=c){if(null!=a)throw Error(r(60));if("object"!=typeof c||!("__html"in c))throw Error(r(61));null!=(n=c.__html)&&("string"==typeof n&&0<n.length&&"\n"===n[0]?t.push("\n",n):t.push(""+n))}return"string"==typeof a&&"\n"===a[0]&&t.push("\n"),a;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":for(var b in t.push(M(e)),n)if(s.call(n,b)&&null!=(a=n[b]))switch(b){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,e));default:S(t,o,b,a)}return t.push("/>"),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return E(t,n,e,o);case"html":return 0===l.insertionMode&&t.push("<!DOCTYPE html>"),E(t,n,e,o);default:if(-1===e.indexOf("-")&&"string"!=typeof n.is)return E(t,n,e,o);for(f in t.push(M(e)),c=a=null,n)if(s.call(n,f)&&null!=(u=n[f]))switch(f){case"children":a=u;break;case"dangerouslySetInnerHTML":c=u;break;case"style":A(t,o,u);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:h(f)&&"function"!=typeof u&&"symbol"!=typeof u&&t.push(" ",f,'="',v(u),'"')}return t.push(">"),C(t,c,a),a}}((l=e.blockedSegment).chunks,n,o,t.responseState,l.formatContext),l.lastPushedText=!1,c=l.formatContext,l.formatContext=function(t,e,n){switch(e){case"select":return x(1,null!=n.value?n.value:n.defaultValue);case"svg":return x(2,null);case"math":return x(3,null);case"foreignObject":return x(1,null);case"table":return x(4,null);case"thead":case"tbody":case"tfoot":return x(5,null);case"colgroup":return x(7,null);case"tr":return x(6,null)}return 4<=t.insertionMode||0===t.insertionMode?x(1,null):t}(c,n,o),Qt(t,e,a),l.formatContext=c,n){case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"input":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":break;default:l.chunks.push("</",n,">")}l.lastPushedText=!1}}function Gt(t,e,n){if(e.node=n,"object"==typeof n&&null!==n){switch(n.$$typeof){case I:return void Kt(t,e,n.type,n.props,n.ref);case N:throw Error(r(257));case U:var i=n._init;return void Gt(t,e,n=i(n._payload))}if(w(n))return void Yt(t,e,n);if((i=null===n||"object"!=typeof n?null:"function"==typeof(i=J&&n[J]||n["@@iterator"])?i:null)&&(i=i.call(n))){if(!(n=i.next()).done){var s=[];do{s.push(n.value),n=i.next()}while(!n.done);Yt(t,e,s)}return}throw t=Object.prototype.toString.call(n),Error(r(31,"[object Object]"===t?"object with keys {"+Object.keys(n).join(", ")+"}":t))}"string"==typeof n?(i=e.blockedSegment).lastPushedText=R(e.blockedSegment.chunks,n,t.responseState,i.lastPushedText):"number"==typeof n&&((i=e.blockedSegment).lastPushedText=R(e.blockedSegment.chunks,""+n,t.responseState,i.lastPushedText))}function Yt(t,e,n){for(var i=n.length,r=0;r<i;r++){var s=e.treeContext;e.treeContext=ut(s,i,r);try{Qt(t,e,n[r])}finally{e.treeContext=s}}}function Qt(t,e,n){var i=e.blockedSegment.formatContext,r=e.legacyContext,s=e.context;try{return Gt(t,e,n)}catch(a){if(Tt(),"object"!=typeof a||null===a||"function"!=typeof a.then)throw e.blockedSegment.formatContext=i,e.legacyContext=r,e.context=s,lt(s),a;n=a;var o=e.blockedSegment,l=zt(0,o.chunks.length,null,o.formatContext,o.lastPushedText,!0);o.children.push(l),o.lastPushedText=!1,t=jt(t,e.node,e.blockedBoundary,l,e.abortSet,e.legacyContext,e.context,e.treeContext).ping,n.then(t,t),e.blockedSegment.formatContext=i,e.legacyContext=r,e.context=s,lt(s)}}function Jt(t){var e=t.blockedBoundary;(t=t.blockedSegment).status=3,te(this,e,t)}function Xt(t,e,n){var i=t.blockedBoundary;t.blockedSegment.status=3,null===i?(e.allPendingTasks--,2!==e.status&&(e.status=2,null!==e.destination&&e.destination.push(null))):(i.pendingTasks--,i.forceClientRender||(i.forceClientRender=!0,t=void 0===n?Error(r(432)):n,i.errorDigest=e.onError(t),i.parentFlushed&&e.clientRenderedBoundaries.push(i)),i.fallbackAbortableTasks.forEach(function(t){return Xt(t,e,n)}),i.fallbackAbortableTasks.clear(),e.allPendingTasks--,0===e.allPendingTasks&&(i=e.onAllReady)())}function Zt(t,e){if(0===e.chunks.length&&1===e.children.length&&null===e.children[0].boundary){var n=e.children[0];n.id=e.id,n.parentFlushed=!0,1===n.status&&Zt(t,n)}else t.completedSegments.push(e)}function te(t,e,n){if(null===e){if(n.parentFlushed){if(null!==t.completedRootSegment)throw Error(r(389));t.completedRootSegment=n}t.pendingRootTasks--,0===t.pendingRootTasks&&(t.onShellError=Vt,(e=t.onShellReady)())}else e.pendingTasks--,e.forceClientRender||(0===e.pendingTasks?(n.parentFlushed&&1===n.status&&Zt(e,n),e.parentFlushed&&t.completedBoundaries.push(e),e.fallbackAbortableTasks.forEach(Jt,t),e.fallbackAbortableTasks.clear()):n.parentFlushed&&1===n.status&&(Zt(e,n),1===e.completedSegments.length&&e.parentFlushed&&t.partialBoundaries.push(e)));t.allPendingTasks--,0===t.allPendingTasks&&(t=t.onAllReady)()}function ee(t){if(2!==t.status){var e=et,n=Lt.current;Lt.current=It;var i=Nt;Nt=t.responseState;try{var r,s=t.pingedTasks;for(r=0;r<s.length;r++){var o=s[r],l=t,a=o.blockedSegment;if(0===a.status){lt(o.context);try{Gt(l,o,o.node),l.responseState.generateStaticMarkup||a.lastPushedText&&a.textEmbedded&&a.chunks.push("\x3c!-- --\x3e"),o.abortSet.delete(o),a.status=1,te(l,o.blockedBoundary,a)}catch(t){if(Tt(),"object"==typeof t&&null!==t&&"function"==typeof t.then){var h=o.ping;t.then(h,h)}else{o.abortSet.delete(o),a.status=4;var c=o.blockedBoundary,u=t,d=Ht(l,u);null===c?Wt(l,u):(c.pendingTasks--,c.forceClientRender||(c.forceClientRender=!0,c.errorDigest=d,c.parentFlushed&&l.clientRenderedBoundaries.push(c))),l.allPendingTasks--,0===l.allPendingTasks&&(0,l.onAllReady)()}}}}s.splice(0,r),null!==t.destination&&le(t,t.destination)}catch(e){Ht(t,e),Wt(t,e)}finally{Nt=i,Lt.current=n,n===It&<(e)}}}function ne(t,e,n){switch(n.parentFlushed=!0,n.status){case 0:var i=n.id=t.nextSegmentId++;return n.lastPushedText=!1,n.textEmbedded=!1,t=t.responseState,e.push('<template id="'),e.push(t.placeholderPrefix),t=i.toString(16),e.push(t),e.push('"></template>');case 1:n.status=2;var s=!0;i=n.chunks;var o=0;n=n.children;for(var l=0;l<n.length;l++){for(s=n[l];o<s.index;o++)e.push(i[o]);s=ie(t,e,s)}for(;o<i.length-1;o++)e.push(i[o]);return o<i.length&&(s=e.push(i[o])),s;default:throw Error(r(390))}}function ie(t,e,n){var i=n.boundary;if(null===i)return ne(t,e,n);if(i.parentFlushed=!0,i.forceClientRender)return t.responseState.generateStaticMarkup||(i=i.errorDigest,e.push("\x3c!--$!--\x3e"),e.push("<template"),i&&(e.push(' data-dgst="'),i=v(i),e.push(i),e.push('"')),e.push("></template>")),ne(t,e,n),!!t.responseState.generateStaticMarkup||e.push("\x3c!--/$--\x3e");if(0<i.pendingTasks){i.rootSegmentID=t.nextSegmentId++,0<i.completedSegments.length&&t.partialBoundaries.push(i);var s=t.responseState,o=s.nextSuspenseID++;return s=s.boundaryPrefix+o.toString(16),i=i.id=s,_(e,t.responseState,i),ne(t,e,n),e.push("\x3c!--/$--\x3e")}if(i.byteSize>t.progressiveChunkSize)return i.rootSegmentID=t.nextSegmentId++,t.completedBoundaries.push(i),_(e,t.responseState,i.id),ne(t,e,n),e.push("\x3c!--/$--\x3e");if(t.responseState.generateStaticMarkup||e.push("\x3c!--$--\x3e"),1!==(n=i.completedSegments).length)throw Error(r(391));return ie(t,e,n[0]),!!t.responseState.generateStaticMarkup||e.push("\x3c!--/$--\x3e")}function re(t,e,n){return function(t,e,n,i){switch(n.insertionMode){case 0:case 1:return t.push('<div hidden id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');case 2:return t.push('<svg aria-hidden="true" style="display:none" id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');case 3:return t.push('<math aria-hidden="true" style="display:none" id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');case 4:return t.push('<table hidden id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');case 5:return t.push('<table hidden><tbody id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');case 6:return t.push('<table hidden><tr id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');case 7:return t.push('<table hidden><colgroup id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');default:throw Error(r(397))}}(e,t.responseState,n.formatContext,n.id),ie(t,e,n),function(t,e){switch(e.insertionMode){case 0:case 1:return t.push("</div>");case 2:return t.push("</svg>");case 3:return t.push("</math>");case 4:return t.push("</table>");case 5:return t.push("</tbody></table>");case 6:return t.push("</tr></table>");case 7:return t.push("</colgroup></table>");default:throw Error(r(397))}}(e,n.formatContext)}function se(t,e,n){for(var i=n.completedSegments,s=0;s<i.length;s++)oe(t,e,n,i[s]);if(i.length=0,t=t.responseState,i=n.id,n=n.rootSegmentID,e.push(t.startInlineScript),t.sentCompleteBoundaryFunction?e.push('$RC("'):(t.sentCompleteBoundaryFunction=!0,e.push('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("')),null===i)throw Error(r(395));return n=n.toString(16),e.push(i),e.push('","'),e.push(t.segmentPrefix),e.push(n),e.push('")<\/script>')}function oe(t,e,n,i){if(2===i.status)return!0;var s=i.id;if(-1===s){if(-1===(i.id=n.rootSegmentID))throw Error(r(392));return re(t,e,i)}return re(t,e,i),t=t.responseState,e.push(t.startInlineScript),t.sentCompleteSegmentFunction?e.push('$RS("'):(t.sentCompleteSegmentFunction=!0,e.push('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("')),e.push(t.segmentPrefix),s=s.toString(16),e.push(s),e.push('","'),e.push(t.placeholderPrefix),e.push(s),e.push('")<\/script>')}function le(t,e){try{var n=t.completedRootSegment;if(null!==n&&0===t.pendingRootTasks){ie(t,e,n),t.completedRootSegment=null;var i=t.responseState.bootstrapChunks;for(n=0;n<i.length-1;n++)e.push(i[n]);n<i.length&&e.push(i[n])}var s,o=t.clientRenderedBoundaries;for(s=0;s<o.length;s++){var l=o[s];i=e;var a=t.responseState,h=l.id,c=l.errorDigest,u=l.errorMessage,d=l.errorComponentStack;if(i.push(a.startInlineScript),a.sentClientRenderFunction?i.push('$RX("'):(a.sentClientRenderFunction=!0,i.push('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("')),null===h)throw Error(r(395));if(i.push(h),i.push('"'),c||u||d){i.push(",");var f=D(c||"");i.push(f)}if(u||d){i.push(",");var p=D(u||"");i.push(p)}if(d){i.push(",");var g=D(d);i.push(g)}if(!i.push(")<\/script>"))return t.destination=null,s++,void o.splice(0,s)}o.splice(0,s);var m=t.completedBoundaries;for(s=0;s<m.length;s++)if(!se(t,e,m[s]))return t.destination=null,s++,void m.splice(0,s);m.splice(0,s);var v=t.partialBoundaries;for(s=0;s<v.length;s++){var b=v[s];t:{o=t,l=e;var y=b.completedSegments;for(a=0;a<y.length;a++)if(!oe(o,l,b,y[a])){a++,y.splice(0,a);var w=!1;break t}y.splice(0,a),w=!0}if(!w)return t.destination=null,s++,void v.splice(0,s)}v.splice(0,s);var x=t.completedBoundaries;for(s=0;s<x.length;s++)if(!se(t,e,x[s]))return t.destination=null,s++,void x.splice(0,s);x.splice(0,s)}finally{0===t.allPendingTasks&&0===t.pingedTasks.length&&0===t.clientRenderedBoundaries.length&&0===t.completedBoundaries.length&&e.push(null)}}function ae(t,e){try{var n=t.abortableTasks;n.forEach(function(n){return Xt(n,t,e)}),n.clear(),null!==t.destination&&le(t,t.destination)}catch(e){Ht(t,e),Wt(t,e)}}function he(){}function ce(t,e,n,i){var s=!1,o=null,l="",a={push:function(t){return null!==t&&(l+=t),!0},destroy:function(t){s=!0,o=t}},h=!1;if(t=function(t,e,n,i,r,s,o){var l=[],a=new Set;return(n=zt(e={destination:null,responseState:e,progressiveChunkSize:i,status:0,fatalError:null,nextSegmentId:0,allPendingTasks:0,pendingRootTasks:0,completedRootSegment:null,abortableTasks:a,pingedTasks:l,clientRenderedBoundaries:[],completedBoundaries:[],partialBoundaries:[],onError:void 0===r?Ft:r,onAllReady:Vt,onShellReady:void 0===o?Vt:o,onShellError:Vt,onFatalError:Vt},0,null,n,!1,!1)).parentFlushed=!0,t=jt(e,t,null,n,a,Z,null,ct),l.push(t),e}(t,function(t,e){return{bootstrapChunks:[],startInlineScript:"<script>",placeholderPrefix:(e=void 0===e?"":e)+"P:",segmentPrefix:e+"S:",boundaryPrefix:e+"B:",idPrefix:e,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1,generateStaticMarkup:t}}(n,e?e.identifierPrefix:void 0),{insertionMode:1,selectedValue:null},1/0,he,0,function(){h=!0}),ee(t),ae(t,i),1===t.status)t.status=2,a.destroy(t.fatalError);else if(2!==t.status&&null===t.destination){t.destination=a;try{le(t,a)}catch(e){Ht(t,e),Wt(t,e)}}if(s)throw o;if(!h)throw Error(r(426));return l}e.renderToNodeStream=function(){throw Error(r(207))},e.renderToStaticMarkup=function(t,e){return ce(t,e,!0,'The server used "renderToStaticMarkup" which does not support Suspense. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server')},e.renderToStaticNodeStream=function(){throw Error(r(208))},e.renderToString=function(t,e){return ce(t,e,!1,'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server')},e.version="18.3.1"},649:e=>{e.exports=t},659:t=>{var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},825:t=>{t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},848:(t,e,n)=>{var i,r;i=n(633),r=n(911),i.version,i.renderToString,e.qV=i.renderToStaticMarkup,i.renderToNodeStream,i.renderToStaticNodeStream,r.renderToReadableStream},911:(t,e,n)=>{var i=n(649);function r(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=null,o=0;function l(t,e){if(0!==e.length)if(512<e.length)0<o&&(t.enqueue(new Uint8Array(s.buffer,0,o)),s=new Uint8Array(512),o=0),t.enqueue(e);else{var n=s.length-o;n<e.length&&(0===n?t.enqueue(s):(s.set(e.subarray(0,n),o),t.enqueue(s),e=e.subarray(n)),s=new Uint8Array(512),o=0),s.set(e,o),o+=e.length}}function a(t,e){return l(t,e),!0}function h(t){s&&0<o&&(t.enqueue(new Uint8Array(s.buffer,0,o)),s=null,o=0)}var c=new TextEncoder;function u(t){return c.encode(t)}function d(t){return c.encode(t)}function f(t,e){"function"==typeof t.error?t.error(e):t.close()}var p=Object.prototype.hasOwnProperty,g=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,m={},v={};function b(t){return!!p.call(v,t)||!p.call(m,t)&&(g.test(t)?v[t]=!0:(m[t]=!0,!1))}function y(t,e,n,i,r,s,o){this.acceptsBooleans=2===e||3===e||4===e,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){w[t]=new y(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];w[e]=new y(e,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){w[t]=new y(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){w[t]=new y(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){w[t]=new y(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){w[t]=new y(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){w[t]=new y(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){w[t]=new y(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){w[t]=new y(t,5,!1,t.toLowerCase(),null,!1,!1)});var x=/[\-:]([a-z])/g;function k(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(x,k);w[e]=new y(e,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(x,k);w[e]=new y(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(x,k);w[e]=new y(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){w[t]=new y(t,1,!1,t.toLowerCase(),null,!1,!1)}),w.xlinkHref=new y("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){w[t]=new y(t,1,!1,t.toLowerCase(),null,!0,!0)});var A={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},S=["Webkit","ms","Moz","O"];Object.keys(A).forEach(function(t){S.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),A[e]=A[t]})});var C=/["'&<>]/;function E(t){if("boolean"==typeof t||"number"==typeof t)return""+t;t=""+t;var e=C.exec(t);if(e){var n,i="",r=0;for(n=e.index;n<t.length;n++){switch(t.charCodeAt(n)){case 34:e=""";break;case 38:e="&";break;case 39:e="'";break;case 60:e="<";break;case 62:e=">";break;default:continue}r!==n&&(i+=t.substring(r,n)),r=n+1,i+=e}t=r!==n?i+t.substring(r,n):i}return t}var O=/([A-Z])/g,T=/^ms-/,M=Array.isArray,_=d("<script>"),P=d("<\/script>"),D=d('<script src="'),R=d('<script type="module" src="'),B=d('" async=""><\/script>'),I=/(<\/|<)(s)(cript)/gi;function N(t,e,n,i){return e+("s"===n?"\\u0073":"\\u0053")+i}function L(t,e){return{insertionMode:t,selectedValue:e}}var F=d("\x3c!-- --\x3e");function V(t,e,n,i){return""===e?i:(i&&t.push(F),t.push(u(E(e))),!0)}var j=new Map,z=d(' style="'),H=d(":"),W=d(";");function $(t,e,n){if("object"!=typeof n)throw Error(r(62));for(var i in e=!0,n)if(p.call(n,i)){var s=n[i];if(null!=s&&"boolean"!=typeof s&&""!==s){if(0===i.indexOf("--")){var o=u(E(i));s=u(E((""+s).trim()))}else{o=i;var l=j.get(o);void 0!==l||(l=d(E(o.replace(O,"-$1").toLowerCase().replace(T,"-ms-"))),j.set(o,l)),o=l,s="number"==typeof s?0===s||p.call(A,i)?u(""+s):u(s+"px"):u(E((""+s).trim()))}e?(e=!1,t.push(z,o,H,s)):t.push(W,o,H,s)}}e||t.push(K)}var q=d(" "),U=d('="'),K=d('"'),G=d('=""');function Y(t,e,n,i){switch(n){case"style":return void $(t,e,i);case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":return}if(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])if(null!==(e=w.hasOwnProperty(n)?w[n]:null)){switch(typeof i){case"function":case"symbol":return;case"boolean":if(!e.acceptsBooleans)return}switch(n=u(e.attributeName),e.type){case 3:i&&t.push(q,n,G);break;case 4:!0===i?t.push(q,n,G):!1!==i&&t.push(q,n,U,u(E(i)),K);break;case 5:isNaN(i)||t.push(q,n,U,u(E(i)),K);break;case 6:!isNaN(i)&&1<=i&&t.push(q,n,U,u(E(i)),K);break;default:e.sanitizeURL&&(i=""+i),t.push(q,n,U,u(E(i)),K)}}else if(b(n)){switch(typeof i){case"function":case"symbol":return;case"boolean":if("data-"!==(e=n.toLowerCase().slice(0,5))&&"aria-"!==e)return}t.push(q,u(n),U,u(E(i)),K)}}var Q=d(">"),J=d("/>");function X(t,e,n){if(null!=e){if(null!=n)throw Error(r(60));if("object"!=typeof e||!("__html"in e))throw Error(r(61));null!=(e=e.__html)&&t.push(u(""+e))}}var Z=d(' selected=""');function tt(t,e,n,i){t.push(rt(n));var r,s=n=null;for(r in e)if(p.call(e,r)){var o=e[r];if(null!=o)switch(r){case"children":n=o;break;case"dangerouslySetInnerHTML":s=o;break;default:Y(t,i,r,o)}}return t.push(Q),X(t,s,n),"string"==typeof n?(t.push(u(E(n))),null):n}var et=d("\n"),nt=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,it=new Map;function rt(t){var e=it.get(t);if(void 0===e){if(!nt.test(t))throw Error(r(65,t));e=d("<"+t),it.set(t,e)}return e}var st=d("<!DOCTYPE html>");var ot=d("</"),lt=d(">"),at=d('<template id="'),ht=d('"></template>'),ct=d("\x3c!--$--\x3e"),ut=d('\x3c!--$?--\x3e<template id="'),dt=d('"></template>'),ft=d("\x3c!--$!--\x3e"),pt=d("\x3c!--/$--\x3e"),gt=d("<template"),mt=d('"'),vt=d(' data-dgst="');d(' data-msg="'),d(' data-stck="');var bt=d("></template>");function yt(t,e,n){if(l(t,ut),null===n)throw Error(r(395));return l(t,n),a(t,dt)}var wt=d('<div hidden id="'),xt=d('">'),kt=d("</div>"),At=d('<svg aria-hidden="true" style="display:none" id="'),St=d('">'),Ct=d("</svg>"),Et=d('<math aria-hidden="true" style="display:none" id="'),Ot=d('">'),Tt=d("</math>"),Mt=d('<table hidden id="'),_t=d('">'),Pt=d("</table>"),Dt=d('<table hidden><tbody id="'),Rt=d('">'),Bt=d("</tbody></table>"),It=d('<table hidden><tr id="'),Nt=d('">'),Lt=d("</tr></table>"),Ft=d('<table hidden><colgroup id="'),Vt=d('">'),jt=d("</colgroup></table>"),zt=d('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("'),Ht=d('$RS("'),Wt=d('","'),$t=d('")<\/script>'),qt=d('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("'),Ut=d('$RC("'),Kt=d('","'),Gt=d('")<\/script>'),Yt=d('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("'),Qt=d('$RX("'),Jt=d('"'),Xt=d(")<\/script>"),Zt=d(","),te=/[<\u2028\u2029]/g;function ee(t){return JSON.stringify(t).replace(te,function(t){switch(t){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}var ne=Object.assign,ie=Symbol.for("react.element"),re=Symbol.for("react.portal"),se=Symbol.for("react.fragment"),oe=Symbol.for("react.strict_mode"),le=Symbol.for("react.profiler"),ae=Symbol.for("react.provider"),he=Symbol.for("react.context"),ce=Symbol.for("react.forward_ref"),ue=Symbol.for("react.suspense"),de=Symbol.for("react.suspense_list"),fe=Symbol.for("react.memo"),pe=Symbol.for("react.lazy"),ge=Symbol.for("react.scope"),me=Symbol.for("react.debug_trace_mode"),ve=Symbol.for("react.legacy_hidden"),be=Symbol.for("react.default_value"),ye=Symbol.iterator;function we(t){if(null==t)return null;if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case se:return"Fragment";case re:return"Portal";case le:return"Profiler";case oe:return"StrictMode";case ue:return"Suspense";case de:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case he:return(t.displayName||"Context")+".Consumer";case ae:return(t._context.displayName||"Context")+".Provider";case ce:var e=t.render;return(t=t.displayName)||(t=""!==(t=e.displayName||e.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case fe:return null!==(e=t.displayName||null)?e:we(t.type)||"Memo";case pe:e=t._payload,t=t._init;try{return we(t(e))}catch(t){}}return null}var xe={};function ke(t,e){if(!(t=t.contextTypes))return xe;var n,i={};for(n in t)i[n]=e[n];return i}var Ae=null;function Se(t,e){if(t!==e){t.context._currentValue=t.parentValue,t=t.parent;var n=e.parent;if(null===t){if(null!==n)throw Error(r(401))}else{if(null===n)throw Error(r(401));Se(t,n)}e.context._currentValue=e.value}}function Ce(t){t.context._currentValue=t.parentValue,null!==(t=t.parent)&&Ce(t)}function Ee(t){var e=t.parent;null!==e&&Ee(e),t.context._currentValue=t.value}function Oe(t,e){if(t.context._currentValue=t.parentValue,null===(t=t.parent))throw Error(r(402));t.depth===e.depth?Se(t,e):Oe(t,e)}function Te(t,e){var n=e.parent;if(null===n)throw Error(r(402));t.depth===n.depth?Se(t,n):Te(t,n),e.context._currentValue=e.value}function Me(t){var e=Ae;e!==t&&(null===e?Ee(t):null===t?Ce(e):e.depth===t.depth?Se(e,t):e.depth>t.depth?Oe(e,t):Te(e,t),Ae=t)}var _e={isMounted:function(){return!1},enqueueSetState:function(t,e){null!==(t=t._reactInternals).queue&&t.queue.push(e)},enqueueReplaceState:function(t,e){(t=t._reactInternals).replace=!0,t.queue=[e]},enqueueForceUpdate:function(){}};function Pe(t,e,n,i){var r=void 0!==t.state?t.state:null;t.updater=_e,t.props=n,t.state=r;var s={queue:[],replace:!1};t._reactInternals=s;var o=e.contextType;if(t.context="object"==typeof o&&null!==o?o._currentValue:i,"function"==typeof(o=e.getDerivedStateFromProps)&&(r=null==(o=o(n,r))?r:ne({},r,o),t.state=r),"function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate&&("function"==typeof t.UNSAFE_componentWillMount||"function"==typeof t.componentWillMount))if(e=t.state,"function"==typeof t.componentWillMount&&t.componentWillMount(),"function"==typeof t.UNSAFE_componentWillMount&&t.UNSAFE_componentWillMount(),e!==t.state&&_e.enqueueReplaceState(t,t.state,null),null!==s.queue&&0<s.queue.length)if(e=s.queue,o=s.replace,s.queue=null,s.replace=!1,o&&1===e.length)t.state=e[0];else{for(s=o?e[0]:t.state,r=!0,o=o?1:0;o<e.length;o++){var l=e[o];null!=(l="function"==typeof l?l.call(t,s,n,i):l)&&(r?(r=!1,s=ne({},s,l)):ne(s,l))}t.state=s}else s.queue=null}var De={id:1,overflow:""};function Re(t,e,n){var i=t.id;t=t.overflow;var r=32-Be(i)-1;i&=~(1<<r),n+=1;var s=32-Be(e)+r;if(30<s){var o=r-r%5;return s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,{id:1<<32-Be(e)+r|n<<r|i,overflow:s+t}}return{id:1<<s|n<<r|i,overflow:t}}var Be=Math.clz32?Math.clz32:function(t){return 0==(t>>>=0)?32:31-(Ie(t)/Ne|0)|0},Ie=Math.log,Ne=Math.LN2,Le="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},Fe=null,Ve=null,je=null,ze=null,He=!1,We=!1,$e=0,qe=null,Ue=0;function Ke(){if(null===Fe)throw Error(r(321));return Fe}function Ge(){if(0<Ue)throw Error(r(312));return{memoizedState:null,queue:null,next:null}}function Ye(){return null===ze?null===je?(He=!1,je=ze=Ge()):(He=!0,ze=je):null===ze.next?(He=!1,ze=ze.next=Ge()):(He=!0,ze=ze.next),ze}function Qe(){Ve=Fe=null,We=!1,je=null,Ue=0,ze=qe=null}function Je(t,e){return"function"==typeof e?e(t):e}function Xe(t,e,n){if(Fe=Ke(),ze=Ye(),He){var i=ze.queue;if(e=i.dispatch,null!==qe&&void 0!==(n=qe.get(i))){qe.delete(i),i=ze.memoizedState;do{i=t(i,n.action),n=n.next}while(null!==n);return ze.memoizedState=i,[i,e]}return[ze.memoizedState,e]}return t=t===Je?"function"==typeof e?e():e:void 0!==n?n(e):e,ze.memoizedState=t,t=(t=ze.queue={last:null,dispatch:null}).dispatch=tn.bind(null,Fe,t),[ze.memoizedState,t]}function Ze(t,e){if(Fe=Ke(),e=void 0===e?null:e,null!==(ze=Ye())){var n=ze.memoizedState;if(null!==n&&null!==e){var i=n[1];t:if(null===i)i=!1;else{for(var r=0;r<i.length&&r<e.length;r++)if(!Le(e[r],i[r])){i=!1;break t}i=!0}if(i)return n[0]}}return t=t(),ze.memoizedState=[t,e],t}function tn(t,e,n){if(25<=Ue)throw Error(r(301));if(t===Fe)if(We=!0,t={action:n,next:null},null===qe&&(qe=new Map),void 0===(n=qe.get(e)))qe.set(e,t);else{for(e=n;null!==e.next;)e=e.next;e.next=t}}function en(){throw Error(r(394))}function nn(){}var rn={readContext:function(t){return t._currentValue},useContext:function(t){return Ke(),t._currentValue},useMemo:Ze,useReducer:Xe,useRef:function(t){Fe=Ke();var e=(ze=Ye()).memoizedState;return null===e?(t={current:t},ze.memoizedState=t):e},useState:function(t){return Xe(Je,t)},useInsertionEffect:nn,useLayoutEffect:function(){},useCallback:function(t,e){return Ze(function(){return t},e)},useImperativeHandle:nn,useEffect:nn,useDebugValue:nn,useDeferredValue:function(t){return Ke(),t},useTransition:function(){return Ke(),[!1,en]},useId:function(){var t=Ve.treeContext,e=t.overflow;t=((t=t.id)&~(1<<32-Be(t)-1)).toString(32)+e;var n=sn;if(null===n)throw Error(r(404));return e=$e++,t=":"+n.idPrefix+"R"+t,0<e&&(t+="H"+e.toString(32)),t+":"},useMutableSource:function(t,e){return Ke(),e(t._source)},useSyncExternalStore:function(t,e,n){if(void 0===n)throw Error(r(407));return n()}},sn=null,on=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;function ln(t){return console.error(t),null}function an(){}function hn(t,e,n,i,r,s,o,l){t.allPendingTasks++,null===n?t.pendingRootTasks++:n.pendingTasks++;var a={node:e,ping:function(){var e=t.pingedTasks;e.push(a),1===e.length&&Sn(t)},blockedBoundary:n,blockedSegment:i,abortSet:r,legacyContext:s,context:o,treeContext:l};return r.add(a),a}function cn(t,e,n,i,r,s){return{status:0,id:-1,index:e,parentFlushed:!1,chunks:[],children:[],formatContext:i,boundary:n,lastPushedText:r,textEmbedded:s}}function un(t,e){if(null!=(t=t.onError(e))&&"string"!=typeof t)throw Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "'+typeof t+'" instead');return t}function dn(t,e){var n=t.onShellError;n(e),(n=t.onFatalError)(e),null!==t.destination?(t.status=2,f(t.destination,e)):(t.status=1,t.fatalError=e)}function fn(t,e,n,i,r){for(Fe={},Ve=e,$e=0,t=n(i,r);We;)We=!1,$e=0,Ue+=1,ze=null,t=n(i,r);return Qe(),t}function pn(t,e,n,i){var s=n.render(),o=i.childContextTypes;if(null!=o){var l=e.legacyContext;if("function"!=typeof n.getChildContext)i=l;else{for(var a in n=n.getChildContext())if(!(a in o))throw Error(r(108,we(i)||"Unknown",a));i=ne({},l,n)}e.legacyContext=i,vn(t,e,s),e.legacyContext=l}else vn(t,e,s)}function gn(t,e){if(t&&t.defaultProps){for(var n in e=ne({},e),t=t.defaultProps)void 0===e[n]&&(e[n]=t[n]);return e}return e}function mn(t,e,n,s,o){if("function"==typeof n)if(n.prototype&&n.prototype.isReactComponent){o=ke(n,e.legacyContext);var l=n.contextType;Pe(l=new n(s,"object"==typeof l&&null!==l?l._currentValue:o),n,s,o),pn(t,e,l,n)}else{o=fn(t,e,n,s,l=ke(n,e.legacyContext));var a=0!==$e;if("object"==typeof o&&null!==o&&"function"==typeof o.render&&void 0===o.$$typeof)Pe(o,n,s,l),pn(t,e,o,n);else if(a){s=e.treeContext,e.treeContext=Re(s,1,0);try{vn(t,e,o)}finally{e.treeContext=s}}else vn(t,e,o)}else{if("string"!=typeof n){switch(n){case ve:case me:case oe:case le:case se:case de:return void vn(t,e,s.children);case ge:throw Error(r(343));case ue:t:{n=e.blockedBoundary,o=e.blockedSegment,l=s.fallback,s=s.children;var h={id:null,rootSegmentID:-1,parentFlushed:!1,pendingTasks:0,forceClientRender:!1,completedSegments:[],byteSize:0,fallbackAbortableTasks:a=new Set,errorDigest:null},c=cn(0,o.chunks.length,h,o.formatContext,!1,!1);o.children.push(c),o.lastPushedText=!1;var d=cn(0,0,null,o.formatContext,!1,!1);d.parentFlushed=!0,e.blockedBoundary=h,e.blockedSegment=d;try{if(yn(t,e,s),d.lastPushedText&&d.textEmbedded&&d.chunks.push(F),d.status=1,kn(h,d),0===h.pendingTasks)break t}catch(e){d.status=4,h.forceClientRender=!0,h.errorDigest=un(t,e)}finally{e.blockedBoundary=n,e.blockedSegment=o}e=hn(t,l,n,c,a,e.legacyContext,e.context,e.treeContext),t.pingedTasks.push(e)}return}if("object"==typeof n&&null!==n)switch(n.$$typeof){case ce:if(s=fn(t,e,n.render,s,o),0!==$e){n=e.treeContext,e.treeContext=Re(n,1,0);try{vn(t,e,s)}finally{e.treeContext=n}}else vn(t,e,s);return;case fe:return void mn(t,e,n=n.type,s=gn(n,s),o);case ae:if(o=s.children,n=n._context,s=s.value,l=n._currentValue,n._currentValue=s,Ae=s={parent:a=Ae,depth:null===a?0:a.depth+1,context:n,parentValue:l,value:s},e.context=s,vn(t,e,o),null===(t=Ae))throw Error(r(403));return s=t.parentValue,t.context._currentValue=s===be?t.context._defaultValue:s,t=Ae=t.parent,void(e.context=t);case he:return void vn(t,e,s=(s=s.children)(n._currentValue));case pe:return void mn(t,e,n=(o=n._init)(n._payload),s=gn(n,s),void 0)}throw Error(r(130,null==n?n:typeof n,""))}switch(l=function(t,e,n,s,o){switch(e){case"select":t.push(rt("select"));var l=null,a=null;for(f in n)if(p.call(n,f)){var h=n[f];if(null!=h)switch(f){case"children":l=h;break;case"dangerouslySetInnerHTML":a=h;break;case"defaultValue":case"value":break;default:Y(t,s,f,h)}}return t.push(Q),X(t,a,l),l;case"option":a=o.selectedValue,t.push(rt("option"));var c=h=null,d=null,f=null;for(l in n)if(p.call(n,l)){var g=n[l];if(null!=g)switch(l){case"children":h=g;break;case"selected":d=g;break;case"dangerouslySetInnerHTML":f=g;break;case"value":c=g;default:Y(t,s,l,g)}}if(null!=a)if(n=null!==c?""+c:function(t){var e="";return i.Children.forEach(t,function(t){null!=t&&(e+=t)}),e}(h),M(a)){for(s=0;s<a.length;s++)if(""+a[s]===n){t.push(Z);break}}else""+a===n&&t.push(Z);else d&&t.push(Z);return t.push(Q),X(t,f,h),h;case"textarea":for(h in t.push(rt("textarea")),f=a=l=null,n)if(p.call(n,h)&&null!=(c=n[h]))switch(h){case"children":f=c;break;case"value":l=c;break;case"defaultValue":a=c;break;case"dangerouslySetInnerHTML":throw Error(r(91));default:Y(t,s,h,c)}if(null===l&&null!==a&&(l=a),t.push(Q),null!=f){if(null!=l)throw Error(r(92));if(M(f)&&1<f.length)throw Error(r(93));l=""+f}return"string"==typeof l&&"\n"===l[0]&&t.push(et),null!==l&&t.push(u(E(""+l))),null;case"input":for(a in t.push(rt("input")),c=f=h=l=null,n)if(p.call(n,a)&&null!=(d=n[a]))switch(a){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,"input"));case"defaultChecked":c=d;break;case"defaultValue":h=d;break;case"checked":f=d;break;case"value":l=d;break;default:Y(t,s,a,d)}return null!==f?Y(t,s,"checked",f):null!==c&&Y(t,s,"checked",c),null!==l?Y(t,s,"value",l):null!==h&&Y(t,s,"value",h),t.push(J),null;case"menuitem":for(var m in t.push(rt("menuitem")),n)if(p.call(n,m)&&null!=(l=n[m]))switch(m){case"children":case"dangerouslySetInnerHTML":throw Error(r(400));default:Y(t,s,m,l)}return t.push(Q),null;case"title":for(g in t.push(rt("title")),l=null,n)if(p.call(n,g)&&null!=(a=n[g]))switch(g){case"children":l=a;break;case"dangerouslySetInnerHTML":throw Error(r(434));default:Y(t,s,g,a)}return t.push(Q),l;case"listing":case"pre":for(c in t.push(rt(e)),a=l=null,n)if(p.call(n,c)&&null!=(h=n[c]))switch(c){case"children":l=h;break;case"dangerouslySetInnerHTML":a=h;break;default:Y(t,s,c,h)}if(t.push(Q),null!=a){if(null!=l)throw Error(r(60));if("object"!=typeof a||!("__html"in a))throw Error(r(61));null!=(n=a.__html)&&("string"==typeof n&&0<n.length&&"\n"===n[0]?t.push(et,u(n)):t.push(u(""+n)))}return"string"==typeof l&&"\n"===l[0]&&t.push(et),l;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":for(var v in t.push(rt(e)),n)if(p.call(n,v)&&null!=(l=n[v]))switch(v){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,e));default:Y(t,s,v,l)}return t.push(J),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return tt(t,n,e,s);case"html":return 0===o.insertionMode&&t.push(st),tt(t,n,e,s);default:if(-1===e.indexOf("-")&&"string"!=typeof n.is)return tt(t,n,e,s);for(d in t.push(rt(e)),a=l=null,n)if(p.call(n,d)&&null!=(h=n[d]))switch(d){case"children":l=h;break;case"dangerouslySetInnerHTML":a=h;break;case"style":$(t,s,h);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:b(d)&&"function"!=typeof h&&"symbol"!=typeof h&&t.push(q,u(d),U,u(E(h)),K)}return t.push(Q),X(t,a,l),l}}((o=e.blockedSegment).chunks,n,s,t.responseState,o.formatContext),o.lastPushedText=!1,a=o.formatContext,o.formatContext=function(t,e,n){switch(e){case"select":return L(1,null!=n.value?n.value:n.defaultValue);case"svg":return L(2,null);case"math":return L(3,null);case"foreignObject":return L(1,null);case"table":return L(4,null);case"thead":case"tbody":case"tfoot":return L(5,null);case"colgroup":return L(7,null);case"tr":return L(6,null)}return 4<=t.insertionMode||0===t.insertionMode?L(1,null):t}(a,n,s),yn(t,e,l),o.formatContext=a,n){case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"input":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":break;default:o.chunks.push(ot,u(n),lt)}o.lastPushedText=!1}}function vn(t,e,n){if(e.node=n,"object"==typeof n&&null!==n){switch(n.$$typeof){case ie:return void mn(t,e,n.type,n.props,n.ref);case re:throw Error(r(257));case pe:var i=n._init;return void vn(t,e,n=i(n._payload))}if(M(n))return void bn(t,e,n);if((i=null===n||"object"!=typeof n?null:"function"==typeof(i=ye&&n[ye]||n["@@iterator"])?i:null)&&(i=i.call(n))){if(!(n=i.next()).done){var s=[];do{s.push(n.value),n=i.next()}while(!n.done);bn(t,e,s)}return}throw t=Object.prototype.toString.call(n),Error(r(31,"[object Object]"===t?"object with keys {"+Object.keys(n).join(", ")+"}":t))}"string"==typeof n?(i=e.blockedSegment).lastPushedText=V(e.blockedSegment.chunks,n,t.responseState,i.lastPushedText):"number"==typeof n&&((i=e.blockedSegment).lastPushedText=V(e.blockedSegment.chunks,""+n,t.responseState,i.lastPushedText))}function bn(t,e,n){for(var i=n.length,r=0;r<i;r++){var s=e.treeContext;e.treeContext=Re(s,i,r);try{yn(t,e,n[r])}finally{e.treeContext=s}}}function yn(t,e,n){var i=e.blockedSegment.formatContext,r=e.legacyContext,s=e.context;try{return vn(t,e,n)}catch(a){if(Qe(),"object"!=typeof a||null===a||"function"!=typeof a.then)throw e.blockedSegment.formatContext=i,e.legacyContext=r,e.context=s,Me(s),a;n=a;var o=e.blockedSegment,l=cn(0,o.chunks.length,null,o.formatContext,o.lastPushedText,!0);o.children.push(l),o.lastPushedText=!1,t=hn(t,e.node,e.blockedBoundary,l,e.abortSet,e.legacyContext,e.context,e.treeContext).ping,n.then(t,t),e.blockedSegment.formatContext=i,e.legacyContext=r,e.context=s,Me(s)}}function wn(t){var e=t.blockedBoundary;(t=t.blockedSegment).status=3,An(this,e,t)}function xn(t,e,n){var i=t.blockedBoundary;t.blockedSegment.status=3,null===i?(e.allPendingTasks--,2!==e.status&&(e.status=2,null!==e.destination&&e.destination.close())):(i.pendingTasks--,i.forceClientRender||(i.forceClientRender=!0,t=void 0===n?Error(r(432)):n,i.errorDigest=e.onError(t),i.parentFlushed&&e.clientRenderedBoundaries.push(i)),i.fallbackAbortableTasks.forEach(function(t){return xn(t,e,n)}),i.fallbackAbortableTasks.clear(),e.allPendingTasks--,0===e.allPendingTasks&&(i=e.onAllReady)())}function kn(t,e){if(0===e.chunks.length&&1===e.children.length&&null===e.children[0].boundary){var n=e.children[0];n.id=e.id,n.parentFlushed=!0,1===n.status&&kn(t,n)}else t.completedSegments.push(e)}function An(t,e,n){if(null===e){if(n.parentFlushed){if(null!==t.completedRootSegment)throw Error(r(389));t.completedRootSegment=n}t.pendingRootTasks--,0===t.pendingRootTasks&&(t.onShellError=an,(e=t.onShellReady)())}else e.pendingTasks--,e.forceClientRender||(0===e.pendingTasks?(n.parentFlushed&&1===n.status&&kn(e,n),e.parentFlushed&&t.completedBoundaries.push(e),e.fallbackAbortableTasks.forEach(wn,t),e.fallbackAbortableTasks.clear()):n.parentFlushed&&1===n.status&&(kn(e,n),1===e.completedSegments.length&&e.parentFlushed&&t.partialBoundaries.push(e)));t.allPendingTasks--,0===t.allPendingTasks&&(t=t.onAllReady)()}function Sn(t){if(2!==t.status){var e=Ae,n=on.current;on.current=rn;var i=sn;sn=t.responseState;try{var r,s=t.pingedTasks;for(r=0;r<s.length;r++){var o=s[r],l=t,a=o.blockedSegment;if(0===a.status){Me(o.context);try{vn(l,o,o.node),a.lastPushedText&&a.textEmbedded&&a.chunks.push(F),o.abortSet.delete(o),a.status=1,An(l,o.blockedBoundary,a)}catch(t){if(Qe(),"object"==typeof t&&null!==t&&"function"==typeof t.then){var h=o.ping;t.then(h,h)}else{o.abortSet.delete(o),a.status=4;var c=o.blockedBoundary,u=t,d=un(l,u);null===c?dn(l,u):(c.pendingTasks--,c.forceClientRender||(c.forceClientRender=!0,c.errorDigest=d,c.parentFlushed&&l.clientRenderedBoundaries.push(c))),l.allPendingTasks--,0===l.allPendingTasks&&(0,l.onAllReady)()}}}}s.splice(0,r),null!==t.destination&&_n(t,t.destination)}catch(e){un(t,e),dn(t,e)}finally{sn=i,on.current=n,n===rn&&Me(e)}}}function Cn(t,e,n){switch(n.parentFlushed=!0,n.status){case 0:var i=n.id=t.nextSegmentId++;return n.lastPushedText=!1,n.textEmbedded=!1,t=t.responseState,l(e,at),l(e,t.placeholderPrefix),l(e,t=u(i.toString(16))),a(e,ht);case 1:n.status=2;var s=!0;i=n.chunks;var o=0;n=n.children;for(var h=0;h<n.length;h++){for(s=n[h];o<s.index;o++)l(e,i[o]);s=En(t,e,s)}for(;o<i.length-1;o++)l(e,i[o]);return o<i.length&&(s=a(e,i[o])),s;default:throw Error(r(390))}}function En(t,e,n){var i=n.boundary;if(null===i)return Cn(t,e,n);if(i.parentFlushed=!0,i.forceClientRender)i=i.errorDigest,a(e,ft),l(e,gt),i&&(l(e,vt),l(e,u(E(i))),l(e,mt)),a(e,bt),Cn(t,e,n);else if(0<i.pendingTasks){i.rootSegmentID=t.nextSegmentId++,0<i.completedSegments.length&&t.partialBoundaries.push(i);var s=t.responseState,o=s.nextSuspenseID++;s=d(s.boundaryPrefix+o.toString(16)),i=i.id=s,yt(e,t.responseState,i),Cn(t,e,n)}else if(i.byteSize>t.progressiveChunkSize)i.rootSegmentID=t.nextSegmentId++,t.completedBoundaries.push(i),yt(e,t.responseState,i.id),Cn(t,e,n);else{if(a(e,ct),1!==(n=i.completedSegments).length)throw Error(r(391));En(t,e,n[0])}return a(e,pt)}function On(t,e,n){return function(t,e,n,i){switch(n.insertionMode){case 0:case 1:return l(t,wt),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,xt);case 2:return l(t,At),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,St);case 3:return l(t,Et),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,Ot);case 4:return l(t,Mt),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,_t);case 5:return l(t,Dt),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,Rt);case 6:return l(t,It),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,Nt);case 7:return l(t,Ft),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,Vt);default:throw Error(r(397))}}(e,t.responseState,n.formatContext,n.id),En(t,e,n),function(t,e){switch(e.insertionMode){case 0:case 1:return a(t,kt);case 2:return a(t,Ct);case 3:return a(t,Tt);case 4:return a(t,Pt);case 5:return a(t,Bt);case 6:return a(t,Lt);case 7:return a(t,jt);default:throw Error(r(397))}}(e,n.formatContext)}function Tn(t,e,n){for(var i=n.completedSegments,s=0;s<i.length;s++)Mn(t,e,n,i[s]);if(i.length=0,t=t.responseState,i=n.id,n=n.rootSegmentID,l(e,t.startInlineScript),t.sentCompleteBoundaryFunction?l(e,Ut):(t.sentCompleteBoundaryFunction=!0,l(e,qt)),null===i)throw Error(r(395));return n=u(n.toString(16)),l(e,i),l(e,Kt),l(e,t.segmentPrefix),l(e,n),a(e,Gt)}function Mn(t,e,n,i){if(2===i.status)return!0;var s=i.id;if(-1===s){if(-1===(i.id=n.rootSegmentID))throw Error(r(392));return On(t,e,i)}return On(t,e,i),l(e,(t=t.responseState).startInlineScript),t.sentCompleteSegmentFunction?l(e,Ht):(t.sentCompleteSegmentFunction=!0,l(e,zt)),l(e,t.segmentPrefix),l(e,s=u(s.toString(16))),l(e,Wt),l(e,t.placeholderPrefix),l(e,s),a(e,$t)}function _n(t,e){s=new Uint8Array(512),o=0;try{var n=t.completedRootSegment;if(null!==n&&0===t.pendingRootTasks){En(t,e,n),t.completedRootSegment=null;var i=t.responseState.bootstrapChunks;for(n=0;n<i.length-1;n++)l(e,i[n]);n<i.length&&a(e,i[n])}var c,d=t.clientRenderedBoundaries;for(c=0;c<d.length;c++){var f=d[c];i=e;var p=t.responseState,g=f.id,m=f.errorDigest,v=f.errorMessage,b=f.errorComponentStack;if(l(i,p.startInlineScript),p.sentClientRenderFunction?l(i,Qt):(p.sentClientRenderFunction=!0,l(i,Yt)),null===g)throw Error(r(395));if(l(i,g),l(i,Jt),(m||v||b)&&(l(i,Zt),l(i,u(ee(m||"")))),(v||b)&&(l(i,Zt),l(i,u(ee(v||"")))),b&&(l(i,Zt),l(i,u(ee(b)))),!a(i,Xt))return t.destination=null,c++,void d.splice(0,c)}d.splice(0,c);var y=t.completedBoundaries;for(c=0;c<y.length;c++)if(!Tn(t,e,y[c]))return t.destination=null,c++,void y.splice(0,c);y.splice(0,c),h(e),s=new Uint8Array(512),o=0;var w=t.partialBoundaries;for(c=0;c<w.length;c++){var x=w[c];t:{d=t,f=e;var k=x.completedSegments;for(p=0;p<k.length;p++)if(!Mn(d,f,x,k[p])){p++,k.splice(0,p);var A=!1;break t}k.splice(0,p),A=!0}if(!A)return t.destination=null,c++,void w.splice(0,c)}w.splice(0,c);var S=t.completedBoundaries;for(c=0;c<S.length;c++)if(!Tn(t,e,S[c]))return t.destination=null,c++,void S.splice(0,c);S.splice(0,c)}finally{h(e),0===t.allPendingTasks&&0===t.pingedTasks.length&&0===t.clientRenderedBoundaries.length&&0===t.completedBoundaries.length&&e.close()}}function Pn(t,e){try{var n=t.abortableTasks;n.forEach(function(n){return xn(n,t,e)}),n.clear(),null!==t.destination&&_n(t,t.destination)}catch(e){un(t,e),dn(t,e)}}e.renderToReadableStream=function(t,e){return new Promise(function(n,i){var r,s,o=new Promise(function(t,e){s=t,r=e}),l=function(t,e,n,i,r,s,o,l,a){var h=[],c=new Set;return(n=cn(e={destination:null,responseState:e,progressiveChunkSize:void 0===i?12800:i,status:0,fatalError:null,nextSegmentId:0,allPendingTasks:0,pendingRootTasks:0,completedRootSegment:null,abortableTasks:c,pingedTasks:h,clientRenderedBoundaries:[],completedBoundaries:[],partialBoundaries:[],onError:void 0===r?ln:r,onAllReady:void 0===s?an:s,onShellReady:void 0===o?an:o,onShellError:void 0===l?an:l,onFatalError:void 0===a?an:a},0,null,n,!1,!1)).parentFlushed=!0,t=hn(e,t,null,n,c,xe,null,De),h.push(t),e}(t,function(t,e,n,i,r){t=void 0===t?"":t,e=void 0===e?_:d('<script nonce="'+E(e)+'">');var s=[];if(void 0!==n&&s.push(e,u((""+n).replace(I,N)),P),void 0!==i)for(n=0;n<i.length;n++)s.push(D,u(E(i[n])),B);if(void 0!==r)for(i=0;i<r.length;i++)s.push(R,u(E(r[i])),B);return{bootstrapChunks:s,startInlineScript:e,placeholderPrefix:d(t+"P:"),segmentPrefix:d(t+"S:"),boundaryPrefix:t+"B:",idPrefix:t,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1}}(e?e.identifierPrefix:void 0,e?e.nonce:void 0,e?e.bootstrapScriptContent:void 0,e?e.bootstrapScripts:void 0,e?e.bootstrapModules:void 0),function(t){return L("http://www.w3.org/2000/svg"===t?2:"http://www.w3.org/1998/Math/MathML"===t?3:0,null)}(e?e.namespaceURI:void 0),e?e.progressiveChunkSize:void 0,e?e.onError:void 0,s,function(){var t=new ReadableStream({type:"bytes",pull:function(t){if(1===l.status)l.status=2,f(t,l.fatalError);else if(2!==l.status&&null===l.destination){l.destination=t;try{_n(l,t)}catch(t){un(l,t),dn(l,t)}}},cancel:function(){Pn(l)}},{highWaterMark:0});t.allReady=o,n(t)},function(t){o.catch(function(){}),i(t)},r);if(e&&e.signal){var a=e.signal,h=function(){Pn(l,a.reason),a.removeEventListener("abort",h)};a.addEventListener("abort",h)}Sn(l)})},e.version="18.3.1"},942:(t,e)=>{var n;!function(){var i={}.hasOwnProperty;function r(){for(var t="",e=0;e<arguments.length;e++){var n=arguments[e];n&&(t=o(t,s(n)))}return t}function s(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return r.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var e="";for(var n in t)i.call(t,n)&&t[n]&&(e=o(e,n));return e}function o(t,e){return e?t?t+" "+e:t+e:t}t.exports?(r.default=r,t.exports=r):void 0===(n=function(){return r}.apply(e,[]))||(t.exports=n)}()}},r={};function s(t){var e=r[t];if(void 0!==e)return e.exports;var n=r[t]={id:t,exports:{}};return i[t](n,n.exports,s),n.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.nc=void 0;var o=s(649);const l=(a={Button:()=>e.Button,CodeSnippetSkeleton:()=>e.CodeSnippetSkeleton,InlineLoading:()=>e.InlineLoading,Link:()=>e.Link,Tab:()=>e.Tab,TabList:()=>e.TabList,TabPanel:()=>e.TabPanel,TabPanels:()=>e.TabPanels,Tabs:()=>e.Tabs,Tooltip:()=>e.Tooltip},h={},s.d(h,a),h);var a,h;const c=(t=>{var e={};return s.d(e,t),e})({CheckmarkFilled:()=>n.CheckmarkFilled,Copy:()=>n.Copy,Cursor_1:()=>n.Cursor_1,ErrorFilled:()=>n.ErrorFilled,InProgress:()=>n.InProgress,Launch:()=>n.Launch,PlayFilledAlt:()=>n.PlayFilledAlt,StopFilledAlt:()=>n.StopFilledAlt});var u=s(942),d=s.n(u);const f=Object.prototype.toString,p=Object.prototype.hasOwnProperty;function g(t,e){return!(null==t)&&p.call(t,e)}function m(t,e){let n,i;if(void 0===t)return;const r=function(t){return"[object Array]"===f.call(t)}(t)?y:b;for(let s in t)if(g(t,s)&&(n=t[s],i=e(n,r(s)),!1===i))return n}function v(t,e){return!!function(t,e){const n=function(t){return function(t){const e=f.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e||"[object GeneratorFunction]"===e||"[object AsyncGeneratorFunction]"===e||"[object Proxy]"===e}(t)?t:e=>e===t}(e);let i;return m(t,function(t,e){if(n(t,e))return i=t,!1}),i}(t,e)}function b(t){return t}function y(t){return Number(t)}function w(t,e){let n={};return m(Object(t),function(t,i){-1===e.indexOf(i)&&(n[i]=t)}),n}function x(t,e){var n=function(t){return t&&t.businessObject||t}(t);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(e)}function k(t,e){return v(e,function(e){return x(t,e)})}const A=["bpmn:Task"],S="Select a task to start testing.";var C=s(7),E=s.n(C);const O={input:{},output:{}},T=["bpmn:Task"];class M extends(E()){constructor(t,e,n=O){super(),this._injector=t,this._elementVariables=e,this._config={...O,...n},this._selectedElement=null,this._variablesForElements=new Map}setConfig(t){this._config=t,this.emit("config.changed")}getConfig(){return this._config}setInputConfigForElement(t,e){if(!k(t,T))throw new Error(`Unsupported element type: ${t.type}`);this._config={...this._config,input:{...this._config.input,[t.id]:e}},this.emit("config.changed",{config:this._config})}resetInputConfigForElement(t){if(!k(t,T))throw new Error(`Unsupported element type: ${t.type}`);this._config={...this._config,input:w(this._config.input,t.id)},this.emit("config.changed")}setOutputConfigForElement(t,e){if(!k(t,T))throw new Error(`Unsupported element type: ${t.type}`);this._config={...this._config,output:{...this._config.output,[t.id]:e}},this.emit("config.changed")}resetOutputConfigForElement(t){if(!k(t,T))throw new Error(`Unsupported element type: ${t.type}`);this._config={...this._config,output:w(this._config.output,t.id)},this.emit("config.changed")}getInputConfigForElement(t){if(!k(t,T))throw new Error(`Unsupported element type: ${t.type}`);return e=this._config.input[t.id],"[object String]"!==f.call(e)?this._getDefaultInputConfig():this._config.input[t.id];var e}getOutputConfigForElement(t){if(!k(t,T))throw new Error(`Unsupported element type: ${t.type}`);if(this._config.output[t.id])return this._config.output[t.id]}_getDefaultInputConfig(){return"{}"}}class _ extends(E()){constructor(t){super(),this._injector=t,this._variables={},this._variableResolver=t.get("variableResolver"),this._injector.get("eventBus").on("commandStack.changed",()=>{this._variables={},this.emit("variables.changed")})}async getVariablesForElement(t){if(this._variables[t.id])return this._variables[t.id];const e=await this._variableResolver.getVariablesForElement(t).catch(()=>[]);return this._variables[t.id]=e,e}}var P=s(848);let D=[],R=[];function B(t){if(t<768)return!1;for(let e=0,n=D.length;;){let i=e+n>>1;if(t<D[i])n=i;else{if(!(t>=R[i]))return!0;e=i+1}if(e==n)return!1}}function I(t){return t>=127462&&t<=127487}function N(t,e,n=!0,i=!0){return(n?L:F)(t,e,i)}function L(t,e,n){if(e==t.length)return e;e&&j(t.charCodeAt(e))&&z(t.charCodeAt(e-1))&&e--;let i=V(t,e);for(e+=H(i);e<t.length;){let r=V(t,e);if(8205==i||8205==r||n&&B(r))e+=H(r),i=r;else{if(!I(r))break;{let n=0,i=e-2;for(;i>=0&&I(V(t,i));)n++,i-=2;if(n%2==0)break;e+=2}}}return e}function F(t,e,n){for(;e>0;){let i=L(t,e-2,n);if(i<e)return i;e--}return 0}function V(t,e){let n=t.charCodeAt(e);if(!z(n)||e+1==t.length)return n;let i=t.charCodeAt(e+1);return j(i)?i-56320+(n-55296<<10)+65536:n}function j(t){return t>=56320&&t<57344}function z(t){return t>=55296&&t<56320}function H(t){return t<65536?1:2}(()=>{let t="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(t=>t?parseInt(t,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?R:D).push(n+=t[e])})();class W{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,n){[t,e]=X(this,t,e);let i=[];return this.decompose(0,t,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(e,this.length,i,1),q.from(i,this.length-(e-t)+n.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=X(this,t,e);let n=[];return this.decompose(t,e,n,0),q.from(n,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),n=this.length-this.scanIdentical(t,-1),i=new G(this),r=new G(t);for(let t=e,s=e;;){if(i.next(t),r.next(t),t=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}iter(t=1){return new G(this,t)}iterRange(t,e=this.length){return new Y(this,t,e)}iterLines(t,e){let n;if(null==t)n=this.iter();else{null==e&&(e=this.lines+1);let i=this.line(t).from;n=this.iterRange(i,Math.max(i,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new Q(n)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(0==t.length)throw new RangeError("A document must have at least one line");return 1!=t.length||t[0]?t.length<=32?new $(t):q.from($.split(t,[])):W.empty}}class $ extends W{constructor(t,e=function(t){let e=-1;for(let n of t)e+=n.length+1;return e}(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,n,i){for(let r=0;;r++){let s=this.text[r],o=i+s.length;if((e?n:o)>=t)return new J(i,o,n,s);i=o+1,n++}}decompose(t,e,n,i){let r=t<=0&&e>=this.length?this:new $(K(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(1&i){let t=n.pop(),e=U(r.text,t.text.slice(),0,r.length);if(e.length<=32)n.push(new $(e,t.length+r.length));else{let t=e.length>>1;n.push(new $(e.slice(0,t)),new $(e.slice(t)))}}else n.push(r)}replace(t,e,n){if(!(n instanceof $))return super.replace(t,e,n);[t,e]=X(this,t,e);let i=U(this.text,U(n.text,K(this.text,0,t)),e),r=this.length+n.length-(e-t);return i.length<=32?new $(i,r):q.from($.split(i,[]),r)}sliceString(t,e=this.length,n="\n"){[t,e]=X(this,t,e);let i="";for(let r=0,s=0;r<=e&&s<this.text.length;s++){let o=this.text[s],l=r+o.length;r>t&&s&&(i+=n),t<l&&e>r&&(i+=o.slice(Math.max(0,t-r),e-r)),r=l+1}return i}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let n=[],i=-1;for(let r of t)n.push(r),i+=r.length+1,32==n.length&&(e.push(new $(n,i)),n=[],i=-1);return i>-1&&e.push(new $(n,i)),e}}class q extends W{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let e of t)this.lines+=e.lines}lineInner(t,e,n,i){for(let r=0;;r++){let s=this.children[r],o=i+s.length,l=n+s.lines-1;if((e?l:o)>=t)return s.lineInner(t,e,n,i);i=o+1,n=l+1}}decompose(t,e,n,i){for(let r=0,s=0;s<=e&&r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(t<=l&&e>=s){let r=i&((s<=t?1:0)|(l>=e?2:0));s>=t&&l<=e&&!r?n.push(o):o.decompose(t-s,e-s,n,r)}s=l+1}}replace(t,e,n){if([t,e]=X(this,t,e),n.lines<this.lines)for(let i=0,r=0;i<this.children.length;i++){let s=this.children[i],o=r+s.length;if(t>=r&&e<=o){let l=s.replace(t-r,e-r,n),a=this.lines-s.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let r=this.children.slice();return r[i]=l,new q(r,this.length-(e-t)+n.length)}return super.replace(r,o,l)}r=o+1}return super.replace(t,e,n)}sliceString(t,e=this.length,n="\n"){[t,e]=X(this,t,e);let i="";for(let r=0,s=0;r<this.children.length&&s<=e;r++){let o=this.children[r],l=s+o.length;s>t&&r&&(i+=n),t<l&&e>s&&(i+=o.sliceString(t-s,e-s,n)),s=l+1}return i}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof q))return 0;let n=0,[i,r,s,o]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=e,r+=e){if(i==s||r==o)return n;let l=this.children[i],a=t.children[r];if(l!=a)return n+l.scanIdentical(a,e);n+=l.length+1}}static from(t,e=t.reduce((t,e)=>t+e.length+1,-1)){let n=0;for(let e of t)n+=e.lines;if(n<32){let n=[];for(let e of t)e.flatten(n);return new $(n,e)}let i=Math.max(32,n>>5),r=i<<1,s=i>>1,o=[],l=0,a=-1,h=[];function c(t){let e;if(t.lines>r&&t instanceof q)for(let e of t.children)c(e);else t.lines>s&&(l>s||!l)?(u(),o.push(t)):t instanceof $&&l&&(e=h[h.length-1])instanceof $&&t.lines+e.lines<=32?(l+=t.lines,a+=t.length+1,h[h.length-1]=new $(e.text.concat(t.text),e.length+1+t.length)):(l+t.lines>i&&u(),l+=t.lines,a+=t.length+1,h.push(t))}function u(){0!=l&&(o.push(1==h.length?h[0]:q.from(h,a)),a=-1,l=h.length=0)}for(let e of t)c(e);return u(),1==o.length?o[0]:new q(o,e)}}function U(t,e,n=0,i=1e9){for(let r=0,s=0,o=!0;s<t.length&&r<=i;s++){let l=t[s],a=r+l.length;a>=n&&(a>i&&(l=l.slice(0,i-r)),r<n&&(l=l.slice(n-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function K(t,e,n){return U(t,[""],e,n)}W.empty=new $([""],0);class G{constructor(t,e=1){this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[e>0?1:(t instanceof $?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],s=r>>1,o=i instanceof $?i.text.length:i.children.length;if(s==(e>0?o:0)){if(0==n)return this.done=!0,this.value="",this;e>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(e>0?0:1)){if(this.offsets[n]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(i instanceof $){let r=i.text[s+(e<0?-1:0)];if(this.offsets[n]+=e,r.length>Math.max(0,t))return this.value=0==t?r:e>0?r.slice(t):r.slice(0,r.length-t),this;t-=r.length}else{let r=i.children[s+(e<0?-1:0)];t>r.length?(t-=r.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(e>0?1:(r instanceof $?r.text.length:r.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class Y{constructor(t,e,n){this.value="",this.done=!1,this.cursor=new G(t,e>n?-1:1),this.pos=e>n?t.length:0,this.from=Math.min(e,n),this.to=Math.max(e,n)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let n=e<0?this.pos-this.from:this.to-this.pos;t>n&&(t=n),n-=t;let{value:i}=this.cursor.next(t);return this.pos+=(i.length+t)*e,this.value=i.length<=n?i:e<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class Q{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:n,value:i}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(W.prototype[Symbol.iterator]=function(){return this.iter()},G.prototype[Symbol.iterator]=Y.prototype[Symbol.iterator]=Q.prototype[Symbol.iterator]=function(){return this});class J{constructor(t,e,n,i){this.from=t,this.to=e,this.number=n,this.text=i}get length(){return this.to-this.from}}function X(t,e,n){return[e=Math.max(0,Math.min(t.length,e)),Math.max(e,Math.min(t.length,n))]}function Z(t,e,n=!0,i=!0){return N(t,e,n,i)}function tt(t,e){let n=t.charCodeAt(e);if(!((i=n)>=55296&&i<56320&&e+1!=t.length))return n;var i;let r=t.charCodeAt(e+1);return function(t){return t>=56320&&t<57344}(r)?r-56320+(n-55296<<10)+65536:n}function et(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function nt(t){return t<65536?1:2}const it=/\r\n?|\n/;var rt=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(rt||(rt={}));class st{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}get newLength(){let t=0;for(let e=0;e<this.sections.length;e+=2){let n=this.sections[e+1];t+=n<0?this.sections[e]:n}return t}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(t){for(let e=0,n=0,i=0;e<this.sections.length;){let r=this.sections[e++],s=this.sections[e++];s<0?(t(n,i,r),i+=r):i+=s,n+=r}}iterChangedRanges(t,e=!1){ht(this,t,e)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],i=this.sections[e++];i<0?t.push(n,i):t.push(i,n)}return new st(t)}composeDesc(t){return this.empty?t:t.empty?this:ut(this,t)}mapDesc(t,e=!1){return t.empty?this:ct(this,t,e)}mapPos(t,e=-1,n=rt.Simple){let i=0,r=0;for(let s=0;s<this.sections.length;){let o=this.sections[s++],l=this.sections[s++],a=i+o;if(l<0){if(a>t)return r+(t-i);r+=o}else{if(n!=rt.Simple&&a>=t&&(n==rt.TrackDel&&i<t&&a>t||n==rt.TrackBefore&&i<t||n==rt.TrackAfter&&a>t))return null;if(a>t||a==t&&e<0&&!o)return t==i||e<0?r:r+l;r+=l}i=a}if(t>i)throw new RangeError(`Position ${t} is out of range for changeset of length ${i}`);return r}touchesRange(t,e=t){for(let n=0,i=0;n<this.sections.length&&i<=e;){let r=i+this.sections[n++];if(this.sections[n++]>=0&&i<=e&&r>=t)return!(i<t&&r>e)||"cover";i=r}return!1}toString(){let t="";for(let e=0;e<this.sections.length;){let n=this.sections[e++],i=this.sections[e++];t+=(t?" ":"")+n+(i>=0?":"+i:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(t=>"number"!=typeof t))throw new RangeError("Invalid JSON representation of ChangeDesc");return new st(t)}static create(t){return new st(t)}}class ot extends st{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return ht(this,(e,n,i,r,s)=>t=t.replace(i,i+(n-e),s),!1),t}mapDesc(t,e=!1){return ct(this,t,e,!0)}invert(t){let e=this.sections.slice(),n=[];for(let i=0,r=0;i<e.length;i+=2){let s=e[i],o=e[i+1];if(o>=0){e[i]=o,e[i+1]=s;let l=i>>1;for(;n.length<l;)n.push(W.empty);n.push(s?t.slice(r,r+s):W.empty)}r+=s}return new ot(e,n)}compose(t){return this.empty?t:t.empty?this:ut(this,t,!0)}map(t,e=!1){return t.empty?this:ct(this,t,e,!0)}iterChanges(t,e=!1){ht(this,t,e)}get desc(){return st.create(this.sections)}filter(t){let e=[],n=[],i=[],r=new dt(this);t:for(let s=0,o=0;;){let l=s==t.length?1e9:t[s++];for(;o<l||o==l&&0==r.len;){if(r.done)break t;let t=Math.min(r.len,l-o);lt(i,t,-1);let s=-1==r.ins?-1:0==r.off?r.ins:0;lt(e,t,s),s>0&&at(n,e,r.text),r.forward(t),o+=t}let a=t[s++];for(;o<a;){if(r.done)break t;let t=Math.min(r.len,a-o);lt(e,t,-1),lt(i,t,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(t),o+=t}}return{changes:new ot(e,n),filtered:st.create(i)}}toJSON(){let t=[];for(let e=0;e<this.sections.length;e+=2){let n=this.sections[e],i=this.sections[e+1];i<0?t.push(n):0==i?t.push([n]):t.push([n].concat(this.inserted[e>>1].toJSON()))}return t}static of(t,e,n){let i=[],r=[],s=0,o=null;function l(t=!1){if(!t&&!i.length)return;s<e&<(i,e-s,-1);let n=new ot(i,r);o=o?o.compose(n.map(o)):n,i=[],r=[],s=0}return function t(a){if(Array.isArray(a))for(let e of a)t(e);else if(a instanceof ot){if(a.length!=e)throw new RangeError(`Mismatched change set length (got ${a.length}, expected ${e})`);l(),o=o?o.compose(a.map(o)):a}else{let{from:t,to:o=t,insert:h}=a;if(t>o||t<0||o>e)throw new RangeError(`Invalid change range ${t} to ${o} (in doc of length ${e})`);let c=h?"string"==typeof h?W.of(h.split(n||it)):h:W.empty,u=c.length;if(t==o&&0==u)return;t<s&&l(),t>s&<(i,t-s,-1),lt(i,o-t,u),at(r,i,c),s=o}}(t),l(!o),o}static empty(t){return new ot(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],n=[];for(let i=0;i<t.length;i++){let r=t[i];if("number"==typeof r)e.push(r,-1);else{if(!Array.isArray(r)||"number"!=typeof r[0]||r.some((t,e)=>e&&"string"!=typeof t))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)e.push(r[0],0);else{for(;n.length<i;)n.push(W.empty);n[i]=W.of(r.slice(1)),e.push(r[0],n[i].length)}}}return new ot(e,n)}static createSet(t,e){return new ot(t,e)}}function lt(t,e,n,i=!1){if(0==e&&n<=0)return;let r=t.length-2;r>=0&&n<=0&&n==t[r+1]?t[r]+=e:r>=0&&0==e&&0==t[r]?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}function at(t,e,n){if(0==n.length)return;let i=e.length-2>>1;if(i<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<i;)t.push(W.empty);t.push(n)}}function ht(t,e,n){let i=t.inserted;for(let r=0,s=0,o=0;o<t.sections.length;){let l=t.sections[o++],a=t.sections[o++];if(a<0)r+=l,s+=l;else{let h=r,c=s,u=W.empty;for(;h+=l,c+=a,a&&i&&(u=u.append(i[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)l=t.sections[o++],a=t.sections[o++];e(r,h,s,c,u),r=h,s=c}}}function ct(t,e,n,i=!1){let r=[],s=i?[]:null,o=new dt(t),l=new dt(e);for(let t=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(-1==o.ins&&-1==l.ins){let t=Math.min(o.len,l.len);lt(r,t,-1),o.forward(t),l.forward(t)}else if(l.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(l.len<o.len||l.len==o.len&&!n))){let e=l.len;for(lt(r,l.ins,-1);e;){let n=Math.min(o.len,e);o.ins>=0&&t<o.i&&o.len<=n&&(lt(r,0,o.ins),s&&at(s,r,o.text),t=o.i),o.forward(n),e-=n}l.next()}else{if(!(o.ins>=0)){if(o.done&&l.done)return s?ot.createSet(r,s):st.create(r);throw new Error("Mismatched change set lengths")}{let e=0,n=o.len;for(;n;)if(-1==l.ins){let t=Math.min(n,l.len);e+=t,n-=t,l.forward(t)}else{if(!(0==l.ins&&l.len<n))break;n-=l.len,l.next()}lt(r,e,t<o.i?o.ins:0),s&&t<o.i&&at(s,r,o.text),t=o.i,o.forward(o.len-n)}}}}function ut(t,e,n=!1){let i=[],r=n?[]:null,s=new dt(t),o=new dt(e);for(let t=!1;;){if(s.done&&o.done)return r?ot.createSet(i,r):st.create(i);if(0==s.ins)lt(i,s.len,0,t),s.next();else if(0!=o.len||o.done){if(s.done||o.done)throw new Error("Mismatched change set lengths");{let e=Math.min(s.len2,o.len),n=i.length;if(-1==s.ins){let n=-1==o.ins?-1:o.off?0:o.ins;lt(i,e,n,t),r&&n&&at(r,i,o.text)}else-1==o.ins?(lt(i,s.off?0:s.len,e,t),r&&at(r,i,s.textBit(e))):(lt(i,s.off?0:s.len,o.off?0:o.ins,t),r&&!o.off&&at(r,i,o.text));t=(s.ins>e||o.ins>=0&&o.len>e)&&(t||i.length>n),s.forward2(e),o.forward(e)}}else lt(i,0,o.ins,t),r&&at(r,i,o.text),o.next()}}class dt{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:t}=this.set,e=this.i-2>>1;return e>=t.length?W.empty:t[e]}textBit(t){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length&&!t?W.empty:e[n].slice(this.off,null==t?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class ft{constructor(t,e,n){this.from=t,this.to=e,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 t=7&this.flags;return 7==t?null:t}get goalColumn(){let t=this.flags>>6;return 16777215==t?void 0:t}map(t,e=-1){let n,i;return this.empty?n=i=t.mapPos(this.from,e):(n=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new ft(n,i,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return pt.range(t,e);let n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return pt.range(this.anchor,n)}eq(t,e=!1){return!(this.anchor!=t.anchor||this.head!=t.head||e&&this.empty&&this.assoc!=t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return pt.range(t.anchor,t.head)}static create(t,e,n){return new ft(t,e,n)}}class pt{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:pt.create(this.ranges.map(n=>n.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(t.ranges[n],e))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new pt([this.main],0)}addRange(t,e=!0){return pt.create([t].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(t,e=this.mainIndex){let n=this.ranges.slice();return n[e]=t,pt.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new pt(t.ranges.map(t=>ft.fromJSON(t)),t.main)}static single(t,e=t){return new pt([pt.range(t,e)],0)}static create(t,e=0){if(0==t.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;i<t.length;i++){let r=t[i];if(r.empty?r.from<=n:r.from<n)return pt.normalized(t.slice(),e);n=r.to}return new pt(t,e)}static cursor(t,e=0,n,i){return ft.create(t,t,(0==e?0:e<0?8:16)|(null==n?7:Math.min(6,n))|(null!=i?i:16777215)<<6)}static range(t,e,n,i){let r=(null!=n?n:16777215)<<6|(null==i?7:Math.min(6,i));return e<t?ft.create(e,t,48|r):ft.create(t,e,(e>t?8:0)|r)}static normalized(t,e=0){let n=t[e];t.sort((t,e)=>t.from-e.from),e=t.indexOf(n);for(let n=1;n<t.length;n++){let i=t[n],r=t[n-1];if(i.empty?i.from<=r.to:i.from<r.to){let s=r.from,o=Math.max(i.to,r.to);n<=e&&e--,t.splice(--n,2,i.anchor>i.head?pt.range(o,s):pt.range(s,o))}}return new pt(t,e)}}function gt(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let mt=0;class vt{constructor(t,e,n,i,r){this.combine=t,this.compareInput=e,this.compare=n,this.isStatic=i,this.id=mt++,this.default=t([]),this.extensions="function"==typeof r?r(this):r}get reader(){return this}static define(t={}){return new vt(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:bt),!!t.static,t.enables)}of(t){return new yt([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new yt(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new yt(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],n=>e(n.field(t)))}}function bt(t,e){return t==e||t.length==e.length&&t.every((t,n)=>t===e[n])}class yt{constructor(t,e,n,i){this.dependencies=t,this.facet=e,this.type=n,this.value=i,this.id=mt++}dynamicSlot(t){var e;let n=this.value,i=this.facet.compareInput,r=this.id,s=t[r]>>1,o=2==this.type,l=!1,a=!1,h=[];for(let n of this.dependencies)"doc"==n?l=!0:"selection"==n?a=!0:1&(null!==(e=t[n.id])&&void 0!==e?e:1)||h.push(t[n.id]);return{create:t=>(t.values[s]=n(t),1),update(t,e){if(l&&e.docChanged||a&&(e.docChanged||e.selection)||xt(t,h)){let e=n(t);if(o?!wt(e,t.values[s],i):!i(e,t.values[s]))return t.values[s]=e,1}return 0},reconfigure:(t,e)=>{let l,a=e.config.address[r];if(null!=a){let r=Dt(e,a);if(this.dependencies.every(n=>n instanceof vt?e.facet(n)===t.facet(n):!(n instanceof St)||e.field(n,!1)==t.field(n,!1))||(o?wt(l=n(t),r,i):i(l=n(t),r)))return t.values[s]=r,0}else l=n(t);return t.values[s]=l,1}}}}function wt(t,e,n){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!n(t[i],e[i]))return!1;return!0}function xt(t,e){let n=!1;for(let i of e)1&Pt(t,i)&&(n=!0);return n}function kt(t,e,n){let i=n.map(e=>t[e.id]),r=n.map(t=>t.type),s=i.filter(t=>!(1&t)),o=t[e.id]>>1;function l(t){let n=[];for(let e=0;e<i.length;e++){let s=Dt(t,i[e]);if(2==r[e])for(let t of s)n.push(t);else n.push(s)}return e.combine(n)}return{create(t){for(let e of i)Pt(t,e);return t.values[o]=l(t),1},update(t,n){if(!xt(t,s))return 0;let i=l(t);return e.compare(i,t.values[o])?0:(t.values[o]=i,1)},reconfigure(t,r){let s=xt(t,i),a=r.config.facets[e.id],h=r.facet(e);if(a&&!s&&bt(n,a))return t.values[o]=h,0;let c=l(t);return e.compare(c,h)?(t.values[o]=h,0):(t.values[o]=c,1)}}}const At=vt.define({static:!0});class St{constructor(t,e,n,i,r){this.id=t,this.createF=e,this.updateF=n,this.compareF=i,this.spec=r,this.provides=void 0}static define(t){let e=new St(mt++,t.create,t.update,t.compare||((t,e)=>t===e),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(At).find(t=>t.field==this);return((null==e?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:t=>(t.values[e]=this.create(t),1),update:(t,n)=>{let i=t.values[e],r=this.updateF(i,n);return this.compareF(i,r)?0:(t.values[e]=r,1)},reconfigure:(t,n)=>{let i,r=t.facet(At),s=n.facet(At);return(i=r.find(t=>t.field==this))&&i!=s.find(t=>t.field==this)?(t.values[e]=i.create(t),1):null!=n.config.address[this.id]?(t.values[e]=n.field(this),0):(t.values[e]=this.create(t),1)}}}init(t){return[this,At.of({field:this,create:t})]}get extension(){return this}}function Ct(t){return e=>new Ot(e,t)}const Et={highest:Ct(0),high:Ct(1),default:Ct(2),low:Ct(3),lowest:Ct(4)};class Ot{constructor(t,e){this.inner=t,this.prec=e}}class Tt{of(t){return new Mt(this,t)}reconfigure(t){return Tt.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class Mt{constructor(t,e){this.compartment=t,this.inner=e}}class _t{constructor(t,e,n,i,r,s){for(this.base=t,this.compartments=e,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(t){let e=this.address[t.id];return null==e?t.default:this.staticValues[e>>1]}static resolve(t,e,n){let i=[],r=Object.create(null),s=new Map;for(let n of function(t,e,n){let i=[[],[],[],[],[]],r=new Map;return function t(s,o){let l=r.get(s);if(null!=l){if(l<=o)return;let t=i[l].indexOf(s);t>-1&&i[l].splice(t,1),s instanceof Mt&&n.delete(s.compartment)}if(r.set(s,o),Array.isArray(s))for(let e of s)t(e,o);else if(s instanceof Mt){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=e.get(s.compartment)||s.inner;n.set(s.compartment,i),t(i,o)}else if(s instanceof Ot)t(s.inner,s.prec);else if(s instanceof St)i[o].push(s),s.provides&&t(s.provides,o);else if(s instanceof yt)i[o].push(s),s.facet.extensions&&t(s.facet.extensions,2);else{let e=s.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);t(e,o)}}(t,2),i.reduce((t,e)=>t.concat(e))}(t,e,s))n instanceof St?i.push(n):(r[n.facet.id]||(r[n.facet.id]=[])).push(n);let o=Object.create(null),l=[],a=[];for(let t of i)o[t.id]=a.length<<1,a.push(e=>t.slot(e));let h=null==n?void 0:n.config.facets;for(let t in r){let e=r[t],i=e[0].facet,s=h&&h[t]||[];if(e.every(t=>0==t.type))if(o[i.id]=l.length<<1|1,bt(s,e))l.push(n.facet(i));else{let t=i.combine(e.map(t=>t.value));l.push(n&&i.compare(t,n.facet(i))?n.facet(i):t)}else{for(let t of e)0==t.type?(o[t.id]=l.length<<1|1,l.push(t.value)):(o[t.id]=a.length<<1,a.push(e=>t.dynamicSlot(e)));o[i.id]=a.length<<1,a.push(t=>kt(t,i,e))}}let c=a.map(t=>t(o));return new _t(t,s,c,o,l,r)}}function Pt(t,e){if(1&e)return 2;let n=e>>1,i=t.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;t.status[n]=4;let r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function Dt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const Rt=vt.define(),Bt=vt.define({combine:t=>t.some(t=>t),static:!0}),It=vt.define({combine:t=>t.length?t[0]:void 0,static:!0}),Nt=vt.define(),Lt=vt.define(),Ft=vt.define(),Vt=vt.define({combine:t=>!!t.length&&t[0]});class jt{constructor(t,e){this.type=t,this.value=e}static define(){return new zt}}class zt{of(t){return new jt(this,t)}}class Ht{constructor(t){this.map=t}of(t){return new Wt(this,t)}}class Wt{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return void 0===e?void 0:e==this.value?this:new Wt(this.type,e)}is(t){return this.type==t}static define(t={}){return new Ht(t.map||(t=>t))}static mapEffects(t,e){if(!t.length)return t;let n=[];for(let i of t){let t=i.map(e);t&&n.push(t)}return n}}Wt.reconfigure=Wt.define(),Wt.appendConfig=Wt.define();class $t{constructor(t,e,n,i,r,s){this.startState=t,this.changes=e,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=s,this._doc=null,this._state=null,n&>(n,e.newLength),r.some(t=>t.type==$t.time)||(this.annotations=r.concat($t.time.of(Date.now())))}static create(t,e,n,i,r,s){return new $t(t,e,n,i,r,s)}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(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation($t.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function qt(t,e){let n=[];for(let i=0,r=0;;){let s,o;if(i<t.length&&(r==e.length||e[r]>=t[i]))s=t[i++],o=t[i++];else{if(!(r<e.length))return n;s=e[r++],o=e[r++]}!n.length||n[n.length-1]<s?n.push(s,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function Ut(t,e,n){var i;let r,s,o;return n?(r=e.changes,s=ot.empty(e.changes.length),o=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(s):null===(i=t.selection)||void 0===i?void 0:i.map(r),effects:Wt.mapEffects(t.effects,r).concat(Wt.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Kt(t,e,n){let i=e.selection,r=Qt(e.annotations);return e.userEvent&&(r=r.concat($t.userEvent.of(e.userEvent))),{changes:e.changes instanceof ot?e.changes:ot.of(e.changes||[],n,t.facet(It)),selection:i&&(i instanceof pt?i:pt.single(i.anchor,i.head)),effects:Qt(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Gt(t,e,n){let i=Kt(t,e.length?e[0]:{},t.doc.length);e.length&&!1===e[0].filter&&(n=!1);for(let r=1;r<e.length;r++){!1===e[r].filter&&(n=!1);let s=!!e[r].sequential;i=Ut(i,Kt(t,e[r],s?i.changes.newLength:t.doc.length),s)}let r=$t.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(t){let e=t.startState,n=e.facet(Ft),i=t;for(let r=n.length-1;r>=0;r--){let s=n[r](t);s&&Object.keys(s).length&&(i=Ut(i,Kt(e,s,t.changes.newLength),!0))}return i==t?t:$t.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(t){let e=t.startState,n=!0;for(let i of e.facet(Nt)){let e=i(t);if(!1===e){n=!1;break}Array.isArray(e)&&(n=!0===n?e:qt(n,e))}if(!0!==n){let i,r;if(!1===n)r=t.changes.invertedDesc,i=ot.empty(e.doc.length);else{let e=t.changes.filter(n);i=e.changes,r=e.filtered.mapDesc(e.changes).invertedDesc}t=$t.create(e,i,t.selection&&t.selection.map(r),Wt.mapEffects(t.effects,r),t.annotations,t.scrollIntoView)}let i=e.facet(Lt);for(let n=i.length-1;n>=0;n--){let r=i[n](t);t=r instanceof $t?r:Array.isArray(r)&&1==r.length&&r[0]instanceof $t?r[0]:Gt(e,Qt(r),!1)}return t}(r):r)}$t.time=jt.define(),$t.userEvent=jt.define(),$t.addToHistory=jt.define(),$t.remote=jt.define();const Yt=[];function Qt(t){return null==t?Yt:Array.isArray(t)?t:[t]}var Jt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Jt||(Jt={}));const Xt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Zt;try{Zt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}class te{constructor(t,e,n,i,r,s){this.config=t,this.doc=e,this.selection=n,this.values=i,this.status=t.statusTemplate.slice(),this.computeSlot=r,s&&(s._state=this);for(let t=0;t<this.config.dynamicSlots.length;t++)Pt(this,t<<1);this.computeSlot=null}field(t,e=!0){let n=this.config.address[t.id];if(null!=n)return Pt(this,n),Dt(this,n);if(e)throw new RangeError("Field is not present in this state")}update(...t){return Gt(this,t,!0)}applyTransaction(t){let e,n=this.config,{base:i,compartments:r}=n;for(let e of t.effects)e.is(Tt.reconfigure)?(n&&(r=new Map,n.compartments.forEach((t,e)=>r.set(e,t)),n=null),r.set(e.value.compartment,e.value.extension)):e.is(Wt.reconfigure)?(n=null,i=e.value):e.is(Wt.appendConfig)&&(n=null,i=Qt(i).concat(e.value));n?e=t.startState.values.slice():(n=_t.resolve(i,r,this),e=new te(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(t,e)=>e.reconfigure(t,this),null).values);let s=t.startState.facet(Bt)?t.newSelection:t.newSelection.asSingle();new te(n,t.newDoc,s,e,(e,n)=>n.update(e,t),t)}replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:pt.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,n=t(e.ranges[0]),i=this.changes(n.changes),r=[n.range],s=Qt(n.effects);for(let n=1;n<e.ranges.length;n++){let o=t(e.ranges[n]),l=this.changes(o.changes),a=l.map(i);for(let t=0;t<n;t++)r[t]=r[t].map(a);let h=i.mapDesc(l,!0);r.push(o.range.map(h)),i=i.compose(a),s=Wt.mapEffects(s,a).concat(Wt.mapEffects(Qt(o.effects),h))}return{changes:i,selection:pt.create(r,e.mainIndex),effects:s}}changes(t=[]){return t instanceof ot?t:ot.of(t,this.doc.length,this.facet(te.lineSeparator))}toText(t){return W.of(t.split(this.facet(te.lineSeparator)||it))}sliceDoc(t=0,e=this.doc.length){return this.doc.sliceString(t,e,this.lineBreak)}facet(t){let e=this.config.address[t.id];return null==e?t.default:(Pt(this,e),Dt(this,e))}toJSON(t){let e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let n in t){let i=t[n];i instanceof St&&null!=this.config.address[i.id]&&(e[n]=i.spec.toJSON(this.field(t[n]),this))}return e}static fromJSON(t,e={},n){if(!t||"string"!=typeof t.doc)throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n)for(let e in n)if(Object.prototype.hasOwnProperty.call(t,e)){let r=n[e],s=t[e];i.push(r.init(t=>r.spec.fromJSON(s,t)))}return te.create({doc:t.doc,selection:pt.fromJSON(t.selection),extensions:e.extensions?i.concat([e.extensions]):i})}static create(t={}){let e=_t.resolve(t.extensions||[],new Map),n=t.doc instanceof W?t.doc:W.of((t.doc||"").split(e.staticFacet(te.lineSeparator)||it)),i=t.selection?t.selection instanceof pt?t.selection:pt.single(t.selection.anchor,t.selection.head):pt.single(0);return gt(i,n.length),e.staticFacet(Bt)||(i=i.asSingle()),new te(e,n,i,e.dynamicSlots.map(()=>null),(t,e)=>e.create(t),null)}get tabSize(){return this.facet(te.tabSize)}get lineBreak(){return this.facet(te.lineSeparator)||"\n"}get readOnly(){return this.facet(Vt)}phrase(t,...e){for(let e of this.facet(te.phrases))if(Object.prototype.hasOwnProperty.call(e,t)){t=e[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,(t,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>e.length?t:e[i-1]})),t}languageDataAt(t,e,n=-1){let i=[];for(let r of this.facet(Rt))for(let s of r(this,e,n))Object.prototype.hasOwnProperty.call(s,t)&&i.push(s[t]);return i}charCategorizer(t){return e=this.languageDataAt("wordChars",t).join(""),t=>{if(!/\S/.test(t))return Jt.Space;if(function(t){if(Zt)return Zt.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||Xt.test(n)))return!0}return!1}(t))return Jt.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return Jt.Word;return Jt.Other};var e}wordAt(t){let{text:e,from:n,length:i}=this.doc.lineAt(t),r=this.charCategorizer(t),s=t-n,o=t-n;for(;s>0;){let t=Z(e,s,!1);if(r(e.slice(t,s))!=Jt.Word)break;s=t}for(;o<i;){let t=Z(e,o);if(r(e.slice(o,t))!=Jt.Word)break;o=t}return s==o?null:pt.range(s+n,o+n)}}function ee(t,e,n={}){let i={};for(let e of t)for(let t of Object.keys(e)){let r=e[t],s=i[t];if(void 0===s)i[t]=r;else if(s===r||void 0===r);else{if(!Object.hasOwnProperty.call(n,t))throw new Error("Config merge conflict for field "+t);i[t]=n[t](s,r)}}for(let t in e)void 0===i[t]&&(i[t]=e[t]);return i}te.allowMultipleSelections=Bt,te.tabSize=vt.define({combine:t=>t.length?t[0]:4}),te.lineSeparator=It,te.readOnly=Vt,te.phrases=vt.define({compare(t,e){let n=Object.keys(t),i=Object.keys(e);return n.length==i.length&&n.every(n=>t[n]==e[n])}}),te.languageData=Rt,te.changeFilter=Nt,te.transactionFilter=Lt,te.transactionExtender=Ft,Tt.reconfigure=Wt.define();class ne{eq(t){return this==t}range(t,e=t){return ie.create(t,e,this)}}ne.prototype.startSide=ne.prototype.endSide=0,ne.prototype.point=!1,ne.prototype.mapMode=rt.TrackDel;class ie{constructor(t,e,n){this.from=t,this.to=e,this.value=n}static create(t,e,n){return new ie(t,e,n)}}function re(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class se{constructor(t,e,n,i){this.from=t,this.to=e,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(t,e,n,i=0){let r=n?this.to:this.from;for(let s=i,o=r.length;;){if(s==o)return s;let i=s+o>>1,l=r[i]-t||(n?this.value[i].endSide:this.value[i].startSide)-e;if(i==s)return l>=0?s:o;l>=0?o=i:s=i+1}}between(t,e,n,i){for(let r=this.findIndex(e,-1e9,!0),s=this.findIndex(n,1e9,!1,r);r<s;r++)if(!1===i(this.from[r]+t,this.to[r]+t,this.value[r]))return!1}map(t,e){let n=[],i=[],r=[],s=-1,o=-1;for(let l=0;l<this.value.length;l++){let a,h,c=this.value[l],u=this.from[l]+t,d=this.to[l]+t;if(u==d){let t=e.mapPos(u,c.startSide,c.mapMode);if(null==t)continue;if(a=h=t,c.startSide!=c.endSide&&(h=e.mapPos(u,c.endSide),h<a))continue}else if(a=e.mapPos(u,c.startSide),h=e.mapPos(d,c.endSide),a>h||a==h&&c.startSide>0&&c.endSide<=0)continue;(h-a||c.endSide-c.startSide)<0||(s<0&&(s=a),c.point&&(o=Math.max(o,h-a)),n.push(c),i.push(a-s),r.push(h-s))}return{mapped:n.length?new se(i,r,n,o):null,pos:s}}}class oe{constructor(t,e,n,i){this.chunkPos=t,this.chunk=e,this.nextLayer=n,this.maxPoint=i}static create(t,e,n,i){return new oe(t,e,n,i)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:n=!1,filterFrom:i=0,filterTo:r=this.length}=t,s=t.filter;if(0==e.length&&!s)return this;if(n&&(e=e.slice().sort(re)),this.isEmpty)return e.length?oe.of(e):this;let o=new he(this,null,-1).goto(0),l=0,a=[],h=new le;for(;o.value||l<e.length;)if(l<e.length&&(o.from-e[l].from||o.startSide-e[l].value.startSide)>=0){let t=e[l++];h.addInner(t.from,t.to,t.value)||a.push(t)}else 1==o.rangeIndex&&o.chunkIndex<this.chunk.length&&(l==e.length||this.chunkEnd(o.chunkIndex)<e[l].from)&&(!s||i>this.chunkEnd(o.chunkIndex)||r<this.chunkPos[o.chunkIndex])&&h.addChunk(this.chunkPos[o.chunkIndex],this.chunk[o.chunkIndex])?o.nextChunk():((!s||i>o.to||r<o.from||s(o.from,o.to,o.value))&&(h.addInner(o.from,o.to,o.value)||a.push(ie.create(o.from,o.to,o.value))),o.next());return h.finishInner(this.nextLayer.isEmpty&&!a.length?oe.empty:this.nextLayer.update({add:a,filter:s,filterFrom:i,filterTo:r}))}map(t){if(t.empty||this.isEmpty)return this;let e=[],n=[],i=-1;for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r],l=t.touchesRange(s,s+o.length);if(!1===l)i=Math.max(i,o.maxPoint),e.push(o),n.push(t.mapPos(s));else if(!0===l){let{mapped:r,pos:l}=o.map(s,t);r&&(i=Math.max(i,r.maxPoint),e.push(r),n.push(l))}}let r=this.nextLayer.map(t);return 0==e.length?r:new oe(n,e,r||oe.empty,i)}between(t,e,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let r=this.chunkPos[i],s=this.chunk[i];if(e>=r&&t<=r+s.length&&!1===s.between(r,t-r,e-r,n))return}this.nextLayer.between(t,e,n)}}iter(t=0){return ce.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return ce.from(t).goto(e)}static compare(t,e,n,i,r=-1){let s=t.filter(t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r),o=e.filter(t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r),l=ae(s,o,n),a=new de(s,l,r),h=new de(o,l,r);n.iterGaps((t,e,n)=>fe(a,t,h,e,n,i)),n.empty&&0==n.length&&fe(a,0,h,0,0,i)}static eq(t,e,n=0,i){null==i&&(i=999999999);let r=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0),s=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0);if(r.length!=s.length)return!1;if(!r.length)return!0;let o=ae(r,s),l=new de(r,o,0).goto(n),a=new de(s,o,0).goto(n);for(;;){if(l.to!=a.to||!pe(l.active,a.active)||l.point&&(!a.point||!l.point.eq(a.point)))return!1;if(l.to>i)return!0;l.next(),a.next()}}static spans(t,e,n,i,r=-1){let s=new de(t,null,r).goto(e),o=e,l=s.openStart;for(;;){let t=Math.min(s.to,n);if(s.point){let n=s.activeForPoint(s.to),r=s.pointFrom<e?n.length+1:s.point.startSide<0?n.length:Math.min(n.length,l);i.point(o,t,s.point,n,r,s.pointRank),l=Math.min(s.openEnd(t),n.length)}else t>o&&(i.span(o,t,s.active,l),l=s.openEnd(t));if(s.to>n)return l+(s.point&&s.to>n?1:0);o=s.to,s.next()}}static of(t,e=!1){let n=new le;for(let i of t instanceof ie?[t]:e?function(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let i=t[n];if(re(e,i)>0)return t.slice().sort(re);e=i}return t}(t):t)n.add(i.from,i.to,i.value);return n.finish()}static join(t){if(!t.length)return oe.empty;let e=t[t.length-1];for(let n=t.length-2;n>=0;n--)for(let i=t[n];i!=oe.empty;i=i.nextLayer)e=new oe(i.chunkPos,i.chunk,e,Math.max(i.maxPoint,e.maxPoint));return e}}oe.empty=new oe([],[],null,-1),oe.empty.nextLayer=oe.empty;class le{finishChunk(t){this.chunks.push(new se(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,t&&(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(t,e,n){this.addInner(t,e,n)||(this.nextLayer||(this.nextLayer=new le)).add(t,e,n)}addInner(t,e,n){let i=t-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(t-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=n,this.lastFrom=t,this.lastTo=e,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),0))}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let n=e.value.length-1;return this.last=e.value[n],this.lastFrom=e.from[n]+t,this.lastTo=e.to[n]+t,!0}finish(){return this.finishInner(oe.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=oe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function ae(t,e,n){let i=new Map;for(let e of t)for(let t=0;t<e.chunk.length;t++)e.chunk[t].maxPoint<=0&&i.set(e.chunk[t],e.chunkPos[t]);let r=new Set;for(let t of e)for(let e=0;e<t.chunk.length;e++){let s=i.get(t.chunk[e]);null==s||(n?n.mapPos(s):s)!=t.chunkPos[e]||(null==n?void 0:n.touchesRange(s,s+t.chunk[e].length))||r.add(t.chunk[e])}return r}class he{constructor(t,e,n,i=0){this.layer=t,this.skip=e,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,e=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}gotoInner(t,e,n){for(;this.chunkIndex<this.layer.chunk.length;){let e=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(e)||this.layer.chunkEnd(this.chunkIndex)<t||e.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],n=t+e.from[this.rangeIndex];if(this.from=n,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}class ce{constructor(t){this.heap=t}static from(t,e=null,n=-1){let i=[];for(let r=0;r<t.length;r++)for(let s=t[r];!s.isEmpty;s=s.nextLayer)s.maxPoint>=n&&i.push(new he(s,e,n,r));return 1==i.length?i[0]:new ce(i)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let n of this.heap)n.goto(t,e);for(let t=this.heap.length>>1;t>=0;t--)ue(this.heap,t);return this.next(),this}forward(t,e){for(let n of this.heap)n.forward(t,e);for(let t=this.heap.length>>1;t>=0;t--)ue(this.heap,t);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),ue(this.heap,0)}}}function ue(t,e){for(let n=t[e];;){let i=1+(e<<1);if(i>=t.length)break;let r=t[i];if(i+1<t.length&&r.compare(t[i+1])>=0&&(r=t[i+1],i++),n.compare(r)<0)break;t[i]=n,t[e]=r,e=i}}class de{constructor(t,e,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=ce.from(t,e,n)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){ge(this.active,t),ge(this.activeTo,t),ge(this.activeRank,t),this.minActive=ve(this.active,this.activeTo)}addActive(t){let e=0,{value:n,to:i,rank:r}=this.cursor;for(;e<this.activeRank.length&&(r-this.activeRank[e]||i-this.activeTo[e])>0;)e++;me(this.active,e,n),me(this.activeTo,e,i),me(this.activeRank,e,r),t&&me(t,e,this.cursor.from),this.minActive=ve(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>t){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&ge(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let t=this.cursor.value;if(t.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=t,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=t.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}}if(n){this.openStart=0;for(let e=n.length-1;e>=0&&n[e]<t;e--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let e=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>t||this.activeTo[n]==t&&this.active[n].endSide>=this.point.endSide)&&e.push(this.active[n]);return e.reverse()}openEnd(t){let e=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>t;n--)e++;return e}}function fe(t,e,n,i,r,s){t.goto(e),n.goto(i);let o=i+r,l=i,a=i-e;for(;;){let e=t.to+a-n.to,i=e||t.endSide-n.endSide,r=i<0?t.to+a:n.to,h=Math.min(r,o);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&pe(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(l,h,t.point,n.point):h>l&&!pe(t.active,n.active)&&s.compareRange(l,h,t.active,n.active),r>o)break;(e||t.openEnd!=n.openEnd)&&s.boundChange&&s.boundChange(r),l=r,i<=0&&t.next(),i>=0&&n.next()}}function pe(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].eq(e[n]))return!1;return!0}function ge(t,e){for(let n=e,i=t.length-1;n<i;n++)t[n]=t[n+1];t.pop()}function me(t,e,n){for(let n=t.length-1;n>=e;n--)t[n+1]=t[n];t[e]=n}function ve(t,e){let n=-1,i=1e9;for(let r=0;r<e.length;r++)(e[r]-i||t[r].endSide-t[n].endSide)<0&&(n=r,i=e[r]);return n}function be(t,e,n=t.length){let i=0;for(let r=0;r<n&&r<t.length;)9==t.charCodeAt(r)?(i+=e-i%e,r++):(i++,r=Z(t,r));return i}const ye="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),we="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),xe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class ke{constructor(t,e){this.rules=[];let{finish:n}=e||{};function i(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function r(t,e,s,o){let l=[],a=/^@(\w+)\b/.exec(t[0]),h=a&&"keyframes"==a[1];if(a&&null==e)return s.push(t[0]+";");for(let n in e){let o=e[n];if(/&/.test(n))r(n.split(/,\s*/).map(e=>t.map(t=>e.replace(/&/,t))).reduce((t,e)=>t.concat(e)),o,s);else if(o&&"object"==typeof o){if(!a)throw new RangeError("The value of a property ("+n+") should be a primitive value.");r(i(n),o,l,h)}else null!=o&&l.push(n.replace(/_.*/,"").replace(/[A-Z]/g,t=>"-"+t.toLowerCase())+": "+o+";")}(l.length||h)&&s.push((!n||a||o?t:t.map(n)).join(", ")+" {"+l.join(" ")+"}")}for(let e in t)r(i(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=xe[ye]||1;return xe[ye]=t+1,"ͼ"+t.toString(36)}static mount(t,e,n){let i=t[we],r=n&&n.nonce;i?r&&i.setNonce(r):i=new Se(t,r),i.mount(Array.isArray(e)?e:[e],t)}}let Ae=new Map;class Se{constructor(t,e){let n=t.ownerDocument||t,i=n.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let e=Ae.get(n);if(e)return t[we]=e;this.sheet=new i.CSSStyleSheet,Ae.set(n,this)}else this.styleTag=n.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[we]=this}mount(t,e){let n=this.sheet,i=0,r=0;for(let e=0;e<t.length;e++){let s=t[e],o=this.modules.indexOf(s);if(o<r&&o>-1&&(this.modules.splice(o,1),r--,o=-1),-1==o){if(this.modules.splice(r++,0,s),n)for(let t=0;t<s.rules.length;t++)n.insertRule(s.rules[t],i++)}else{for(;r<o;)i+=this.modules[r++].rules.length;i+=s.rules.length,r++}}if(n)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets]);else{let t="";for(let e=0;e<this.modules.length;e++)t+=this.modules[e].getRules()+"\n";this.styleTag.textContent=t;let n=e.head||e;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}for(var Ce={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Ee={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Oe="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Te="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Me=0;Me<10;Me++)Ce[48+Me]=Ce[96+Me]=String(Me);for(Me=1;Me<=24;Me++)Ce[Me+111]="F"+Me;for(Me=65;Me<=90;Me++)Ce[Me]=String.fromCharCode(Me+32),Ee[Me]=String.fromCharCode(Me);for(var _e in Ce)Ee.hasOwnProperty(_e)||(Ee[_e]=Ce[_e]);function Pe(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function De(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function Re(t,e){if(!e.anchorNode)return!1;try{return De(t,e.anchorNode)}catch(t){return!1}}function Be(t){return 3==t.nodeType?Ke(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function Ie(t,e,n,i){return!!n&&(Fe(t,e,n,i,-1)||Fe(t,e,n,i,1))}function Ne(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function Le(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Fe(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:Ve(t))){if("DIV"==t.nodeName)return!1;let n=t.parentNode;if(!n||1!=n.nodeType)return!1;e=Ne(t)+(r<0?0:1),t=n}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=r<0?Ve(t):0}}}function Ve(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function je(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function ze(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function He(t,e){let n=e.width/t.offsetWidth,i=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-t.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}class We{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:n}=t;this.set(e,Math.min(t.anchorOffset,e?Ve(e):0),n,Math.min(t.focusOffset,n?Ve(n):0))}set(t,e,n,i){this.anchorNode=t,this.anchorOffset=e,this.focusNode=n,this.focusOffset=i}}let $e,qe=null;function Ue(t){if(t.setActive)return t.setActive();if(qe)return t.focus(qe);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(null==qe?{get preventScroll(){return qe={preventScroll:!0},!0}}:void 0),!qe){qe=!1;for(let t=0;t<e.length;){let n=e[t++],i=e[t++],r=e[t++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}}}function Ke(t,e,n=e){let i=$e||($e=document.createRange());return i.setEnd(t,n),i.setStart(t,e),i}function Ge(t,e,n,i){let r={key:e,code:e,keyCode:n,which:n,cancelable:!0};i&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let s=new KeyboardEvent("keydown",r);s.synthetic=!0,t.dispatchEvent(s);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,t.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function Ye(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function Qe(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function Je(t,e){for(let n=t,i=e;;){if(3==n.nodeType&&i>0)return{node:n,offset:i};if(1==n.nodeType&&i>0){if("false"==n.contentEditable)return null;n=n.childNodes[i-1],i=Ve(n)}else{if(!n.parentNode||Le(n))return null;i=Ne(n),n=n.parentNode}}}function Xe(t,e){for(let n=t,i=e;;){if(3==n.nodeType&&i<n.nodeValue.length)return{node:n,offset:i};if(1==n.nodeType&&i<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[i],i=0}else{if(!n.parentNode||Le(n))return null;i=Ne(n)+1,n=n.parentNode}}}class Ze{constructor(t,e,n=!0){this.node=t,this.offset=e,this.precise=n}static before(t,e){return new Ze(t.parentNode,Ne(t),e)}static after(t,e){return new Ze(t.parentNode,Ne(t)+1,e)}}const tn=[];class en{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(t){let e=this.posAtStart;for(let n of this.children){if(n==t)return e;e+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(2&this.flags){let n,i=this.dom,r=null;for(let s of this.children){if(7&s.flags){if(!s.dom&&(n=r?r.nextSibling:i.firstChild)){let t=en.get(n);(!t||!t.parent&&t.canReuseDOM(s))&&s.reuseDOM(n)}s.sync(t,e),s.flags&=-8}if(n=r?r.nextSibling:i.firstChild,e&&!e.written&&e.node==i&&n!=s.dom&&(e.written=!0),s.dom.parentNode==i)for(;n&&n!=s.dom;)n=nn(n);else i.insertBefore(s.dom,n);r=s.dom}for(n=r?r.nextSibling:i.firstChild,n&&e&&e.node==i&&(e.written=!0);n;)n=nn(n)}else if(1&this.flags)for(let n of this.children)7&n.flags&&(n.sync(t,e),n.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let n;if(t==this.dom)n=this.dom.childNodes[e];else{let i=0==Ve(t)?0:0==e?-1:1;for(;;){let e=t.parentNode;if(e==this.dom)break;0==i&&e.firstChild!=e.lastChild&&(i=t==e.firstChild?-1:1),t=e}n=i<0?t:t.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!en.get(n);)n=n.nextSibling;if(!n)return this.length;for(let t=0,e=0;;t++){let i=this.children[t];if(i.dom==n)return e;e+=i.length+i.breakAfter}}domBoundsAround(t,e,n=0){let i=-1,r=-1,s=-1,o=-1;for(let l=0,a=n,h=n;l<this.children.length;l++){let n=this.children[l],c=a+n.length;if(a<t&&c>e)return n.domBoundsAround(t,e,a);if(c>=t&&-1==i&&(i=l,r=a),a>e&&n.dom.parentNode==this.dom){s=l,o=h;break}h=c,a=c+n.breakAfter}return{from:r,to:o<0?n+this.length:o,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s<this.children.length&&s>=0?this.children[s].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),1&e.flags)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,n=tn){this.markDirty();for(let i=t;i<e;i++){let t=this.children[i];t.parent==this&&n.indexOf(t)<0&&t.destroy()}n.length<250?this.children.splice(t,e-t,...n):this.children=[].concat(this.children.slice(0,t),n,this.children.slice(e));for(let t=0;t<n.length;t++)n[t].setParent(this)}ignoreMutation(t){return!1}ignoreEvent(t){return!1}childCursor(t=this.length){return new rn(this.children,t,this.children.length)}childPos(t,e=1){return this.childCursor().findPos(t,e)}toString(){let t=this.constructor.name.replace("View","");return t+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==t?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(t){return t.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(t,e,n,i,r,s){return!1}become(t){return!1}canReuseDOM(t){return t.constructor==this.constructor&&!(8&(this.flags|t.flags))}getSide(){return 0}destroy(){for(let t of this.children)t.parent==this&&t.destroy();this.parent=null}}function nn(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}en.prototype.breakAfter=0;class rn{constructor(t,e,n){this.children=t,this.pos=e,this.i=n,this.off=0}findPos(t,e=1){for(;;){if(t>this.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function sn(t,e,n,i,r,s,o,l,a){let{children:h}=t,c=h.length?h[e]:null,u=s.length?s[s.length-1]:null,d=u?u.breakAfter:o;if(!(e==i&&c&&!o&&!d&&s.length<2&&c.merge(n,r,s.length?u:null,0==n,l,a))){if(i<h.length){let t=h[i];t&&(r<t.length||t.breakAfter&&(null==u?void 0:u.breakAfter))?(e==i&&(t=t.split(r),r=0),!d&&u&&t.merge(0,r,u,!0,0,a)?s[s.length-1]=t:((r||t.children.length&&!t.children[0].length)&&t.merge(0,r,null,!1,0,a),s.push(t))):(null==t?void 0:t.breakAfter)&&(u?u.breakAfter=1:o=1),i++}for(c&&(c.breakAfter=o,n>0&&(!o&&s.length&&c.merge(n,c.length,s[0],!1,l,0)?c.breakAfter=s.shift().breakAfter:(n<c.length||c.children.length&&0==c.children[c.children.length-1].length)&&c.merge(n,c.length,null,!1,l,0),e++));e<i&&s.length;)if(h[i-1].become(s[s.length-1]))i--,s.pop(),a=s.length?0:l;else{if(!h[e].become(s[0]))break;e++,s.shift(),l=s.length?0:a}!s.length&&e&&i<h.length&&!h[e-1].breakAfter&&h[i].merge(0,0,h[e-1],!1,l,a)&&e--,(e<i||s.length)&&t.replaceChildren(e,i,s)}}function on(t,e,n,i,r,s){let o=t.childCursor(),{i:l,off:a}=o.findPos(n,1),{i:h,off:c}=o.findPos(e,-1),u=e-n;for(let t of i)u+=t.length;t.length+=u,sn(t,h,c,l,a,i,0,r,s)}let ln="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},an="undefined"!=typeof document?document:{documentElement:{style:{}}};const hn=/Edge\/(\d+)/.exec(ln.userAgent),cn=/MSIE \d/.test(ln.userAgent),un=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ln.userAgent),dn=!!(cn||un||hn),fn=!dn&&/gecko\/(\d+)/i.test(ln.userAgent),pn=!dn&&/Chrome\/(\d+)/.exec(ln.userAgent),gn="webkitFontSmoothing"in an.documentElement.style,mn=!dn&&/Apple Computer/.test(ln.vendor),vn=mn&&(/Mobile\/\w+/.test(ln.userAgent)||ln.maxTouchPoints>2);var bn={mac:vn||/Mac/.test(ln.platform),windows:/Win/.test(ln.platform),linux:/Linux|X11/.test(ln.platform),ie:dn,ie_version:cn?an.documentMode||6:un?+un[1]:hn?+hn[1]:0,gecko:fn,gecko_version:fn?+(/Firefox\/(\d+)/.exec(ln.userAgent)||[0,0])[1]:0,chrome:!!pn,chrome_version:pn?+pn[1]:0,ios:vn,android:/Android\b/.test(ln.userAgent),webkit:gn,safari:mn,webkit_version:gn?+(/\bAppleWebKit\/(\d+)/.exec(ln.userAgent)||[0,0])[1]:0,tabSize:null!=an.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class yn extends en{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){3==t.nodeType&&this.createDOM(t)}merge(t,e,n){return!(8&this.flags||n&&(!(n instanceof yn)||this.length-(e-t)+n.length>256||8&n.flags)||(this.text=this.text.slice(0,t)+(n?n.text:"")+this.text.slice(e),this.markDirty(),0))}split(t){let e=new yn(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new Ze(this.dom,t)}domBoundsAround(t,e,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return function(t,e,n){let i=t.nodeValue.length;e>i&&(e=i);let r=e,s=e,o=0;0==e&&n<0||e==i&&n>=0?bn.chrome||bn.gecko||(e?(r--,o=1):s<i&&(s++,o=-1)):n<0?r--:s<i&&s++;let l=Ke(t,r,s).getClientRects();if(!l.length)return null;let a=l[(o?o<0:n>=0)?0:l.length-1];return bn.safari&&!o&&0==a.width&&(a=Array.prototype.find.call(l,t=>t.width)||a),o?je(a,o<0):a||null}(this.dom,t,e)}}class wn extends en{constructor(t,e=[],n=0){super(),this.mark=t,this.children=e,this.length=n;for(let t of e)t.setParent(this)}setAttrs(t){if(Ye(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!(8&(this.flags|t.flags))}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,n,i,r,s){return!(n&&(!(n instanceof wn&&n.mark.eq(this.mark))||t&&r<=0||e<this.length&&s<=0)||(on(this,t,e,n?n.children.slice():[],r-1,s-1),this.markDirty(),0))}split(t){let e=[],n=0,i=-1,r=0;for(let s of this.children){let o=n+s.length;o>t&&e.push(n<t?s.split(t-n):s),i<0&&n>=t&&(i=r),n=o,r++}let s=this.length-t;return this.length=t,i>-1&&(this.children.length=i,this.markDirty()),new wn(this.mark,e,s)}domAtPos(t){return An(this,t)}coordsAt(t,e){return Cn(this,t,e)}}class xn extends en{static create(t,e,n){return new xn(t,e,n)}constructor(t,e,n){super(),this.widget=t,this.length=e,this.side=n,this.prevWidget=null}split(t){let e=xn.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(t,e,n,i,r,s){return!(n&&(!(n instanceof xn&&this.widget.compare(n.widget))||t>0&&r<=0||e<this.length&&s<=0)||(this.length=t+(n?n.length:0)+(this.length-e),0))}become(t){return t instanceof xn&&t.side==this.side&&this.widget.constructor==t.widget.constructor&&(this.widget.compare(t.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,!0)}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get overrideDOMText(){if(0==this.length)return W.empty;let t=this;for(;t.parent;)t=t.parent;let{view:e}=t,n=e&&e.state.doc,i=this.posAtStart;return n?n.slice(i,i+this.length):W.empty}domAtPos(t){return(this.length?0==t:this.side>0)?Ze.before(this.dom):Ze.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let n=this.widget.coordsAt(this.dom,t,e);if(n)return n;let i=this.dom.getClientRects(),r=null;if(!i.length)return null;let s=this.side?this.side<0:t>0;for(let e=s?i.length-1:0;r=i[e],!(t>0?0==e:e==i.length-1||r.top<r.bottom);e+=s?-1:1);return je(r,!s)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class kn extends en{constructor(t){super(),this.side=t}get length(){return 0}merge(){return!1}become(t){return t instanceof kn&&t.side==this.side}split(){return new kn(this.side)}sync(){if(!this.dom){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),this.setDOM(t)}}getSide(){return this.side}domAtPos(t){return this.side>0?Ze.before(this.dom):Ze.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return W.empty}get isHidden(){return!0}}function An(t,e){let n=t.dom,{children:i}=t,r=0;for(let t=0;r<i.length;r++){let s=i[r],o=t+s.length;if(!(o==t&&s.getSide()<=0)){if(e>t&&e<o&&s.dom.parentNode==n)return s.domAtPos(e-t);if(e<=t)break;t=o}}for(let t=r;t>0;t--){let e=i[t-1];if(e.dom.parentNode==n)return e.domAtPos(e.length)}for(let t=r;t<i.length;t++){let e=i[t];if(e.dom.parentNode==n)return e.domAtPos(0)}return new Ze(n,0)}function Sn(t,e,n){let i,{children:r}=t;n>0&&e instanceof wn&&r.length&&(i=r[r.length-1])instanceof wn&&i.mark.eq(e.mark)?Sn(i,e.children[0],n-1):(r.push(e),e.setParent(t)),t.length+=e.length}function Cn(t,e,n){let i=null,r=-1,s=null,o=-1;!function t(e,l){for(let a=0,h=0;a<e.children.length&&h<=l;a++){let c=e.children[a],u=h+c.length;u>=l&&(c.children.length?t(c,l-h):(!s||s.isHidden&&(n>0||En(s,c)))&&(u>l||h==u&&c.getSide()>0)?(s=c,o=l-h):(h<l||h==u&&c.getSide()<0&&!c.isHidden)&&(i=c,r=l-h)),h=u}}(t,e);let l=(n<0?i:s)||i||s;return l?l.coordsAt(Math.max(0,l==i?r:o),n):function(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=Be(e);return n[n.length-1]||null}(t)}function En(t,e){let n=t.coordsAt(0,1),i=e.coordsAt(0,1);return n&&i&&i.top<n.bottom}function On(t,e){for(let n in t)"class"==n&&e.class?e.class+=" "+t.class:"style"==n&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}yn.prototype.children=xn.prototype.children=kn.prototype.children=tn;const Tn=Object.create(null);function Mn(t,e,n){if(t==e)return!0;t||(t=Tn),e||(e=Tn);let i=Object.keys(t),r=Object.keys(e);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let s of i)if(s!=n&&(-1==r.indexOf(s)||t[s]!==e[s]))return!1;return!0}function _n(t,e,n){let i=!1;if(e)for(let r in e)n&&r in n||(i=!0,"style"==r?t.style.cssText="":t.removeAttribute(r));if(n)for(let r in n)e&&e[r]==n[r]||(i=!0,"style"==r?t.style.cssText=n[r]:t.setAttribute(r,n[r]));return i}function Pn(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let i=t.attributes[n];e[i.name]=i.value}return e}class Dn{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var Rn=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Rn||(Rn={}));class Bn extends ne{constructor(t,e,n,i){super(),this.startSide=t,this.endSide=e,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(t){return new In(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),n=!!t.block;return e+=n&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new Ln(t,e,e,n,t.widget||null,!1)}static replace(t){let e,n,i=!!t.block;if(t.isBlockGap)e=-5e8,n=4e8;else{let{start:r,end:s}=Fn(t,i);e=(r?i?-3e8:-1:5e8)-1,n=1+(s?i?2e8:1:-6e8)}return new Ln(t,e,n,i,t.widget||null,!0)}static line(t){return new Nn(t)}static set(t,e=!1){return oe.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Bn.none=oe.empty;class In extends Bn{constructor(t){let{start:e,end:n}=Fn(t);super(e?-1:5e8,n?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,n;return this==t||t instanceof In&&this.tagName==t.tagName&&(this.class||(null===(e=this.attrs)||void 0===e?void 0:e.class))==(t.class||(null===(n=t.attrs)||void 0===n?void 0:n.class))&&Mn(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}In.prototype.point=!1;class Nn extends Bn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Nn&&this.spec.class==t.spec.class&&Mn(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}Nn.prototype.mapMode=rt.TrackBefore,Nn.prototype.point=!0;class Ln extends Bn{constructor(t,e,n,i,r,s){super(e,n,r,t),this.block=i,this.isReplace=s,this.mapMode=i?e<=0?rt.TrackBefore:rt.TrackAfter:rt.TrackDel}get type(){return this.startSide!=this.endSide?Rn.WidgetRange:this.startSide<=0?Rn.WidgetBefore:Rn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Ln&&((e=this.widget)==(n=t.widget)||!!(e&&n&&e.compare(n)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,n}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}function Fn(t,e=!1){let{inclusiveStart:n,inclusiveEnd:i}=t;return null==n&&(n=t.inclusive),null==i&&(i=t.inclusive),{start:null!=n?n:e,end:null!=i?i:e}}function Vn(t,e,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=t?n[r]=Math.max(n[r],e):n.push(t,e)}Ln.prototype.point=!0;class jn extends en{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,n,i,r,s){if(n){if(!(n instanceof jn))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),on(this,t,e,n?n.children.slice():[],r,s),!0}split(t){let e=new jn;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i:n,off:i}=this.childPos(t);i&&(e.append(this.children[n].split(i),0),this.children[n].merge(i,this.children[n].length,null,!1,0,0),n++);for(let t=n;t<this.children.length;t++)e.append(this.children[t],0);for(;n>0&&0==this.children[n-1].length;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){Mn(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Sn(this,t,e)}addLineDeco(t){let e=t.spec.attributes,n=t.spec.class;e&&(this.attrs=On(e,this.attrs||{})),n&&(this.attrs=On({class:n},this.attrs||{}))}domAtPos(t){return An(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}sync(t,e){var n;this.dom?4&this.flags&&(Ye(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&&(_n(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let i=this.dom.lastChild;for(;i&&en.get(i)instanceof wn;)i=i.lastChild;if(!(i&&this.length&&("BR"==i.nodeName||0!=(null===(n=en.get(i))||void 0===n?void 0:n.isEditable)||bn.ios&&this.children.some(t=>t instanceof yn)))){let t=document.createElement("BR");t.cmIgnore=!0,this.dom.appendChild(t)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let t,e=0;for(let n of this.children){if(!(n instanceof yn)||/[^ -~]/.test(n.text))return null;let i=Be(n.dom);if(1!=i.length)return null;e+=i[0].width,t=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(t,e){let n=Cn(this,t,e);if(!this.children.length&&n&&this.parent){let{heightOracle:t}=this.parent.view.viewState,e=n.bottom-n.top;if(Math.abs(e-t.lineHeight)<2&&t.textHeight<e){let i=(e-t.textHeight)/2;return{top:n.top+i,bottom:n.bottom-i,left:n.left,right:n.left}}}return n}become(t){return t instanceof jn&&0==this.children.length&&0==t.children.length&&Mn(this.attrs,t.attrs)&&this.breakAfter==t.breakAfter}covers(){return!0}static find(t,e){for(let n=0,i=0;n<t.children.length;n++){let r=t.children[n],s=i+r.length;if(s>=e){if(r instanceof jn)return r;if(s>e)break}i=s+r.breakAfter}return null}}class zn extends en{constructor(t,e,n){super(),this.widget=t,this.length=e,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(t,e,n,i,r,s){return!(n&&(!(n instanceof zn&&this.widget.compare(n.widget))||t>0&&r<=0||e<this.length&&s<=0)||(this.length=t+(n?n.length:0)+(this.length-e),0))}domAtPos(t){return 0==t?Ze.before(this.dom):Ze.after(this.dom,t==this.length)}split(t){let e=this.length-t;this.length=t;let n=new zn(this.widget,e,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return tn}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):W.empty}domBoundsAround(){return null}become(t){return t instanceof zn&&t.widget.constructor==this.widget.constructor&&(t.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,this.deco=t.deco,this.breakAfter=t.breakAfter,!0)}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(t,e){return this.widget.coordsAt(this.dom,t,e)||(this.widget instanceof Hn?null:je(this.dom.getBoundingClientRect(),this.length?0==t:e<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(t){let{startSide:e,endSide:n}=this.deco;return e!=n&&(t<0?e<0:n>0)}}class Hn extends Dn{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Wn{constructor(t,e,n,i){this.doc=t,this.pos=e,this.end=n,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=e}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof zn&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new jn),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append($n(new kn(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||t&&this.content.length&&this.content[this.content.length-1]instanceof zn||this.getLine()}buildText(t,e,n){for(;t>0;){if(this.textOff==this.text.length){let{value:e,lineBreak:n,done:i}=this.cursor.next(this.skip);if(this.skip=0,i)throw new Error("Ran out of text content when drawing inline views");if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}this.text=e,this.textOff=0}let i=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-n)),this.getLine().append($n(new yn(this.text.slice(this.textOff,this.textOff+i)),e),n),this.atCursorPos=!0,this.textOff+=i,t-=i,n=0}}span(t,e,n,i){this.buildText(e-t,n,i),this.pos=e,this.openStart<0&&(this.openStart=i)}point(t,e,n,i,r,s){if(this.disallowBlockEffectsFor[s]&&n instanceof Ln){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(n instanceof Ln)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new zn(n.widget||qn.block,o,n));else{let s=xn.create(n.widget||qn.inline,o,o?0:n.startSide),l=this.atCursorPos&&!s.isEditable&&r<=i.length&&(t<e||n.startSide>0),a=!s.isEditable&&(t<e||r>i.length||n.startSide<=0),h=this.getLine();2!=this.pendingBuffer||l||s.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),l&&(h.append($n(new kn(1),i),r),r=i.length+Math.max(0,r-i.length)),h.append($n(s,i),r),this.atCursorPos=a,this.pendingBuffer=a?t<e||r>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}static build(t,e,n,i,r){let s=new Wn(t,e,n,r);return s.openEnd=oe.spans(i,e,n,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function $n(t,e){for(let n of e)t=new wn(n,[t],t.length);return t}class qn extends Dn{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}qn.inline=new qn("span"),qn.block=new qn("div");var Un=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Un||(Un={}));const Kn=Un.LTR,Gn=Un.RTL;function Yn(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const Qn=Yn("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Jn=Yn("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Xn=Object.create(null),Zn=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);Xn[e]=n,Xn[n]=-e}function ti(t){return t<=247?Qn[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Jn[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const ei=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ni{get dir(){return this.level%2?Gn:Kn}constructor(t,e,n){this.from=t,this.to=e,this.level=n}side(t,e){return this.dir==e==t?this.to:this.from}forward(t,e){return t==(this.dir==e)}static find(t,e,n,i){let r=-1;for(let s=0;s<t.length;s++){let o=t[s];if(o.from<=e&&o.to>=e){if(o.level==n)return s;(r<0||(0!=i?i<0?o.from<e:o.to>e:t[r].level>o.level))&&(r=s)}}if(r<0)throw new RangeError("Index out of range");return r}}function ii(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let i=t[n],r=e[n];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!ii(i.inner,r.inner))return!1}return!0}const ri=[];function si(t,e,n,i,r,s,o){let l=i%2?2:1;if(i%2==r%2)for(let a=e,h=0;a<n;){let e=!0,c=!1;if(h==s.length||a<s[h].from){let t=ri[a];t!=l&&(e=!1,c=16==t)}let u=e||1!=l?null:[],d=e?i:i+1,f=a;t:for(;;)if(h<s.length&&f==s[h].from){if(c)break t;let p=s[h];if(!e)for(let t=p.to,e=h+1;;){if(t==n)break t;if(!(e<s.length&&s[e].from==t)){if(ri[t]==l)break t;break}t=s[e++].to}h++,u?u.push(p):(p.from>a&&o.push(new ni(a,p.from,d)),oi(t,p.direction==Kn!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,o),a=p.to),f=p.to}else{if(f==n||(e?ri[f]!=l:ri[f]==l))break;f++}u?si(t,a,f,i+1,r,u,o):a<f&&o.push(new ni(a,f,d)),a=f}else for(let a=n,h=s.length;a>e;){let n=!0,c=!1;if(!h||a>s[h-1].to){let t=ri[a-1];t!=l&&(n=!1,c=16==t)}let u=n||1!=l?null:[],d=n?i:i+1,f=a;t:for(;;)if(h&&f==s[h-1].to){if(c)break t;let p=s[--h];if(!n)for(let t=p.from,n=h;;){if(t==e)break t;if(!n||s[n-1].to!=t){if(ri[t-1]==l)break t;break}t=s[--n].from}u?u.push(p):(p.to<a&&o.push(new ni(p.to,a,d)),oi(t,p.direction==Kn!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,o),a=p.from),f=p.from}else{if(f==e||(n?ri[f-1]!=l:ri[f-1]==l))break;f--}u?si(t,f,a,i+1,r,u,o):f<a&&o.push(new ni(f,a,d)),a=f}}function oi(t,e,n,i,r,s,o){let l=e%2?2:1;!function(t,e,n,i,r){for(let s=0;s<=i.length;s++){let o=s?i[s-1].to:e,l=s<i.length?i[s].from:n,a=s?256:r;for(let e=o,n=a,i=a;e<l;e++){let r=ti(t.charCodeAt(e));512==r?r=n:8==r&&4==i&&(r=16),ri[e]=4==r?2:r,7&r&&(i=r),n=r}for(let t=o,e=a,i=a;t<l;t++){let r=ri[t];if(128==r)t<l-1&&e==ri[t+1]&&24&e?r=ri[t]=e:ri[t]=256;else if(64==r){let r=t+1;for(;r<l&&64==ri[r];)r++;let s=t&&8==e||r<n&&8==ri[r]?1==i?1:8:256;for(let e=t;e<r;e++)ri[e]=s;t=r-1}else 8==r&&1==i&&(ri[t]=1);e=r,7&r&&(i=r)}}}(t,r,s,i,l),function(t,e,n,i,r){let s=1==r?2:1;for(let o=0,l=0,a=0;o<=i.length;o++){let h=o?i[o-1].to:e,c=o<i.length?i[o].from:n;for(let e,n,i,o=h;o<c;o++)if(n=Xn[e=t.charCodeAt(o)])if(n<0){for(let t=l-3;t>=0;t-=3)if(Zn[t+1]==-n){let e=Zn[t+2],n=2&e?r:4&e?1&e?s:r:0;n&&(ri[o]=ri[Zn[t]]=n),l=t;break}}else{if(189==Zn.length)break;Zn[l++]=o,Zn[l++]=e,Zn[l++]=a}else if(2==(i=ri[o])||1==i){let t=i==r;a=t?0:1;for(let e=l-3;e>=0;e-=3){let n=Zn[e+2];if(2&n)break;if(t)Zn[e+2]|=2;else{if(4&n)break;Zn[e+2]|=4}}}}}(t,r,s,i,l),function(t,e,n,i){for(let r=0,s=i;r<=n.length;r++){let o=r?n[r-1].to:t,l=r<n.length?n[r].from:e;for(let a=o;a<l;){let o=ri[a];if(256==o){let o=a+1;for(;;)if(o==l){if(r==n.length)break;o=n[r++].to,l=r<n.length?n[r].from:e}else{if(256!=ri[o])break;o++}let h=1==s,c=h==(1==(o<e?ri[o]:i))?h?1:2:i;for(let e=o,i=r,s=i?n[i-1].to:t;e>a;)e==s&&(e=n[--i].from,s=i?n[i-1].to:t),ri[--e]=c;a=o}else s=o,a++}}}(r,s,i,l),si(t,r,s,e,n,i,o)}function li(t){return[new ni(0,t,0)]}let ai="";function hi(t,e,n,i,r){var s;let o=i.head-t.from,l=ni.find(e,o,null!==(s=i.bidiLevel)&&void 0!==s?s:-1,i.assoc),a=e[l],h=a.side(r,n);if(o==h){let t=l+=r?1:-1;if(t<0||t>=e.length)return null;a=e[l=t],o=a.side(!r,n),h=a.side(r,n)}let c=Z(t.text,o,a.forward(r,n));(c<a.from||c>a.to)&&(c=h),ai=t.text.slice(Math.min(o,c),Math.max(o,c));let u=l==(r?e.length-1:0)?null:e[l+(r?1:-1)];return u&&c==h&&u.level+(r?0:1)<a.level?pt.cursor(u.side(!r,n)+t.from,u.forward(r,n)?1:-1,u.level):pt.cursor(c+t.from,a.forward(r,n)?-1:1,a.level)}function ci(t,e,n){for(let i=e;i<n;i++){let e=ti(t.charCodeAt(i));if(1==e)return Kn;if(2==e||4==e)return Gn}return Kn}const ui=vt.define(),di=vt.define(),fi=vt.define(),pi=vt.define(),gi=vt.define(),mi=vt.define(),vi=vt.define(),bi=vt.define(),yi=vt.define(),wi=vt.define({combine:t=>t.some(t=>t)}),xi=vt.define({combine:t=>t.some(t=>t)}),ki=vt.define();class Ai{constructor(t,e="nearest",n="nearest",i=5,r=5,s=!1){this.range=t,this.y=e,this.x=n,this.yMargin=i,this.xMargin=r,this.isSnapshot=s}map(t){return t.empty?this:new Ai(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Ai(pt.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Si=Wt.define({map:(t,e)=>t.map(e)}),Ci=Wt.define();function Ei(t,e,n){let i=t.facet(pi);i.length?i[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const Oi=vt.define({combine:t=>!t.length||t[0]});let Ti=0;const Mi=vt.define({combine:t=>t.filter((e,n)=>{for(let i=0;i<n;i++)if(t[i].plugin==e.plugin)return!1;return!0})});class _i{constructor(t,e,n,i,r){this.id=t,this.create=e,this.domEventHandlers=n,this.domEventObservers=i,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(Mi.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(Mi.of({plugin:this,arg:t}))}static define(t,e){const{eventHandlers:n,eventObservers:i,provide:r,decorations:s}=e||{};return new _i(Ti++,t,n,i,t=>{let e=[];return s&&e.push(Bi.of(e=>{let n=e.plugin(t);return n?s(n):Bn.none})),r&&e.push(r(t)),e})}static fromClass(t,e){return _i.define((e,n)=>new t(e,n),e)}}class Pi{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(e){if(Ei(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(e){Ei(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(e){Ei(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Di=vt.define(),Ri=vt.define(),Bi=vt.define(),Ii=vt.define(),Ni=vt.define(),Li=vt.define();function Fi(t,e){let n=t.state.facet(Li);if(!n.length)return n;let i=n.map(e=>e instanceof Function?e(t):e),r=[];return oe.spans(i,e.from,e.to,{point(){},span(t,n,i,s){let o=t-e.from,l=n-e.from,a=r;for(let t=i.length-1;t>=0;t--,s--){let n,r=i[t].spec.bidiIsolate;if(null==r&&(r=ci(e.text,o,l)),s>0&&a.length&&(n=a[a.length-1]).to==o&&n.direction==r)n.to=l,a=n.inner;else{let t={from:o,to:l,direction:r,inner:[]};a.push(t),a=t.inner}}}}),r}const Vi=vt.define();function ji(t){let e=0,n=0,i=0,r=0;for(let s of t.state.facet(Vi)){let o=s(t);o&&(null!=o.left&&(e=Math.max(e,o.left)),null!=o.right&&(n=Math.max(n,o.right)),null!=o.top&&(i=Math.max(i,o.top)),null!=o.bottom&&(r=Math.max(r,o.bottom)))}return{left:e,right:n,top:i,bottom:r}}const zi=vt.define();class Hi{constructor(t,e,n,i){this.fromA=t,this.toA=e,this.fromB=n,this.toB=i}join(t){return new Hi(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,n=this;for(;e>0;e--){let i=t[e-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),t.splice(e-1,1)}}return t.splice(e,0,n),t}static extendWithRanges(t,e){if(0==e.length)return t;let n=[];for(let i=0,r=0,s=0,o=0;;i++){let l=i==t.length?null:t[i],a=s-o,h=l?l.fromB:1e9;for(;r<e.length&&e[r]<h;){let t=e[r],i=e[r+1],s=Math.max(o,t),l=Math.min(h,i);if(s<=l&&new Hi(s+a,l+a,s,l).addToSet(n),i>h)break;r+=2}if(!l)return n;new Hi(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),s=l.toA,o=l.toB}}}class Wi{constructor(t,e,n){this.view=t,this.state=e,this.transactions=n,this.flags=0,this.startState=t.state,this.changes=ot.empty(this.startState.doc.length);for(let t of n)this.changes=this.changes.compose(t.changes);let i=[];this.changes.iterChangedRanges((t,e,n,r)=>i.push(new Hi(t,e,n,r))),this.changedRanges=i}static create(t,e,n){return new Wi(t,e,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}class $i extends en{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Bn.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new jn],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Hi(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let n=t.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:t,toA:e})=>e<this.minWidthFrom||t>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?i=this.domChanged.newSel.head:function(t,e){let n=!1;return e&&t.iterChangedRanges((t,i)=>{t<e.to&&i>e.from&&(n=!0)}),n}(t.changes,this.hasComposition)||t.selectionSet||(i=t.state.selection.main.head));let r=i>-1?function(t,e,n){let i=qi(t,n);if(!i)return null;let{node:r,from:s,to:o}=i,l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(t.state.doc.sliceString(i.from,i.to)!=l)return null;let a=e.invertedDesc,h=new Hi(a.mapPos(s),a.mapPos(o),s,o),c=[];for(let e=r.parentNode;;e=e.parentNode){let n=en.get(e);if(n instanceof wn)c.push({node:e,deco:n.mark});else{if(n instanceof jn||"DIV"==e.nodeName&&e.parentNode==t.contentDOM)return{range:h,text:r,marks:c,line:e};if(e==t.contentDOM)return null;c.push({node:e,deco:new In({inclusive:!0,attributes:Pn(e),tagName:e.tagName.toLowerCase()})})}}}(this.view,t.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:e,to:i}=this.hasComposition;n=new Hi(e,i,t.changes.mapPos(e,-1),t.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(bn.ie||bn.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let s=function(t,e,n){let i=new Ui;return oe.compare(t,e,n,i),i.changes}(this.decorations,this.updateDeco(),t.changes);return n=Hi.extendWithRanges(n,s),!!(7&this.flags||0!=n.length)&&(this.updateInner(n,t.startState.doc.length,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,n);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=bn.chrome||bn.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.flags&=-8,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(t=>t.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let t of this.children)t instanceof zn&&t.widget instanceof Hn&&r.push(t.dom);i.updateGaps(r)}updateChildren(t,e,n){let i=n?n.range.addToSet(t.slice()):t,r=this.childCursor(e);for(let t=i.length-1;;t--){let e=t>=0?i[t]:null;if(!e)break;let s,o,l,a,{fromA:h,toA:c,fromB:u,toB:d}=e;if(n&&n.range.fromB<d&&n.range.toB>u){let t=Wn.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),e=Wn.build(this.view.state.doc,n.range.toB,d,this.decorations,this.dynamicDecorationMap);o=t.breakAtStart,l=t.openStart,a=e.openEnd;let i=this.compositionView(n);e.breakAtStart?i.breakAfter=1:e.content.length&&i.merge(i.length,i.length,e.content[0],!1,e.openStart,0)&&(i.breakAfter=e.content[0].breakAfter,e.content.shift()),t.content.length&&i.merge(0,0,t.content[t.content.length-1],!0,0,t.openEnd)&&t.content.pop(),s=t.content.concat(i).concat(e.content)}else({content:s,breakAtStart:o,openStart:l,openEnd:a}=Wn.build(this.view.state.doc,u,d,this.decorations,this.dynamicDecorationMap));let{i:f,off:p}=r.findPos(c,1),{i:g,off:m}=r.findPos(h,-1);sn(this,g,m,f,p,s,o,l,a)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let t of e.effects)t.is(Ci)&&(this.editContextFormatting=t.value)}compositionView(t){let e=new yn(t.text.nodeValue);e.flags|=8;for(let{deco:n}of t.marks)e=new wn(n,[e],e.length);let n=new jn;return n.append(e,0),n}fixCompositionDOM(t){let e=(t,e)=>{e.flags|=8|(e.children.some(t=>7&t.flags)?1:0),this.markedForComposition.add(e);let n=en.get(t);n&&n!=e&&(n.dom=null),e.setDOM(t)},n=this.childPos(t.range.fromB,1),i=this.children[n.i];e(t.line,i);for(let r=t.marks.length-1;r>=-1;r--)n=i.childPos(n.off,1),i=i.children[n.i],e(r>=0?t.marks[r].node:t.text,i)}updateSelection(t=!1,e=!1){!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,r=!i&&!(this.view.state.facet(Oi)||this.dom.tabIndex>-1)&&Re(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||e||r))return;let s=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(o.anchor)),a=o.empty?l:this.moveToLine(this.domAtPos(o.head));if(bn.gecko&&o.empty&&!this.hasComposition&&1==(h=l).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable)){let t=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(t,l.node.childNodes[l.offset]||null)),l=a=new Ze(t,0),s=!0}var h;let c=this.view.observer.selectionRange;!s&&c.focusNode&&(Ie(l.node,l.offset,c.anchorNode,c.anchorOffset)&&Ie(a.node,a.offset,c.focusNode,c.focusOffset)||this.suppressWidgetCursorChange(c,o))||(this.view.observer.ignore(()=>{bn.android&&bn.chrome&&this.dom.contains(c.focusNode)&&function(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let t=Pe(this.view.root);if(t)if(o.empty){if(bn.gecko){let t=(e=l.node,i=l.offset,1!=e.nodeType?0:(i&&"false"==e.childNodes[i-1].contentEditable?1:0)|(i<e.childNodes.length&&"false"==e.childNodes[i].contentEditable?2:0));if(t&&3!=t){let e=(1==t?Je:Xe)(l.node,l.offset);e&&(l=new Ze(e.node,e.offset))}}t.collapse(l.node,l.offset),null!=o.bidiLevel&&void 0!==t.caretBidiLevel&&(t.caretBidiLevel=o.bidiLevel)}else if(t.extend){t.collapse(l.node,l.offset);try{t.extend(a.node,a.offset)}catch(t){}}else{let e=document.createRange();o.anchor>o.head&&([l,a]=[a,l]),e.setEnd(a.node,a.offset),e.setStart(l.node,l.offset),t.removeAllRanges(),t.addRange(e)}var e,i;r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(l,a)),this.impreciseAnchor=l.precise?null:new Ze(c.anchorNode,c.anchorOffset),this.impreciseHead=a.precise?null:new Ze(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Ie(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,n=Pe(t.root),{anchorNode:i,anchorOffset:r}=t.observer.selectionRange;if(!(n&&e.empty&&e.assoc&&n.modify))return;let s=jn.find(this,e.head);if(!s)return;let o=s.posAtStart;if(e.head==o||e.head==o+s.length)return;let l=this.coordsAt(e.head,-1),a=this.coordsAt(e.head,1);if(!l||!a||l.bottom>a.top)return;let h=this.domAtPos(e.head+e.assoc);n.collapse(h.node,h.offset),n.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&n.collapse(i,r)}moveToLine(t){let e,n=this.dom;if(t.node!=n)return t;for(let i=t.offset;!e&&i<n.childNodes.length;i++){let t=en.get(n.childNodes[i]);t instanceof jn&&(e=t.domAtPos(0))}for(let i=t.offset-1;!e&&i>=0;i--){let t=en.get(n.childNodes[i]);t instanceof jn&&(e=t.domAtPos(t.length))}return e?new Ze(e.node,e.offset,!0):t}nearest(t){for(let e=t;e;){let t=en.get(e);if(t&&t.rootView==this)return t;e=e.parentNode}return null}posFromDOM(t,e){let n=this.nearest(t);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(t,e)+n.posAtStart}domAtPos(t){let{i:e,off:n}=this.childCursor().findPos(t,-1);for(;e<this.children.length-1;){let t=this.children[e];if(n<t.length||t instanceof jn)break;e++,n=0}return this.children[e].domAtPos(n)}coordsAt(t,e){let n=null,i=0;for(let r=this.length,s=this.children.length-1;s>=0;s--){let o=this.children[s],l=r-o.breakAfter,a=l-o.length;if(l<t)break;if(a<=t&&(a<t||o.covers(-1))&&(l>t||o.covers(1))&&(!n||o instanceof jn&&!(n instanceof jn&&e>=0)))n=o,i=a;else if(n&&a==t&&l==t&&o instanceof zn&&Math.abs(e)<2){if(o.deco.startSide<0)break;s&&(n=null)}r=a}return n?n.coordsAt(t-i,e):null}coordsForChar(t){let{i:e,off:n}=this.childPos(t,1),i=this.children[e];if(!(i instanceof jn))return null;for(;i.children.length;){let{i:t,off:e}=i.childPos(n,1);for(;;t++){if(t==i.children.length)return null;if((i=i.children[t]).length)break}n=e}if(!(i instanceof yn))return null;let r=Z(i.text,n);if(r==n)return null;let s=Ke(i.dom,n,r).getClientRects();for(let t=0;t<s.length;t++){let e=s[t];if(t==s.length-1||e.top<e.bottom&&e.left<e.right)return e}return null}measureVisibleLineHeights(t){let e=[],{from:n,to:i}=t,r=this.view.contentDOM.clientWidth,s=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,l=this.view.textDirection==Un.LTR;for(let t=0,a=0;a<this.children.length;a++){let h=this.children[a],c=t+h.length;if(c>i)break;if(t>=n){let n=h.dom.getBoundingClientRect();if(e.push(n.height),s){let e=h.dom.lastChild,i=e?Be(e):[];if(i.length){let e=i[i.length-1],s=l?e.right-n.left:n.right-e.left;s>o&&(o=s,this.minWidth=r,this.minWidthFrom=t,this.minWidthTo=c)}}}t=c+h.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return"rtl"==getComputedStyle(this.children[e].dom).direction?Un.RTL:Un.LTR}measureTextSize(){for(let t of this.children)if(t instanceof jn){let e=t.measureTextSize();if(e)return e}let t,e,n,i=document.createElement("div");return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(i);let r=Be(i.firstChild)[0];t=i.getBoundingClientRect().height,e=r?r.width/27:7,n=r?r.height:t,i.remove()}),{lineHeight:t,charWidth:e,textHeight:n}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new rn(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let n=0,i=0;;i++){let r=i==e.viewports.length?null:e.viewports[i],s=r?r.from-1:this.length;if(s>n){let i=(e.lineBlockAt(s).bottom-e.lineBlockAt(n).top)/this.view.scaleY;t.push(Bn.replace({widget:new Hn(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!r)break;n=r.to+1}return Bn.set(t)}updateDeco(){let t=1,e=this.view.state.facet(Bi).map(e=>(this.dynamicDecorationMap[t++]="function"==typeof e)?e(this.view):e),n=!1,i=this.view.state.facet(Ii).map((t,e)=>{let i="function"==typeof t;return i&&(n=!0),i?t(this.view):t});for(i.length&&(this.dynamicDecorationMap[t++]=n,e.push(oe.join(i))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;return this.decorations}scrollIntoView(t){if(t.isSnapshot){let e=this.view.viewState.lineBlockAt(t.range.head);return this.view.scrollDOM.scrollTop=e.top-t.yMargin,void(this.view.scrollDOM.scrollLeft=t.xMargin)}for(let e of this.view.state.facet(ki))try{if(e(this.view,t.range,t))return!0}catch(t){Ei(this.view.state,t,"scroll handler")}let e,{range:n}=t,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(!i)return;!n.empty&&(e=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,e.left),top:Math.min(i.top,e.top),right:Math.max(i.right,e.right),bottom:Math.max(i.bottom,e.bottom)});let r=ji(this.view),s={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:o,offsetHeight:l}=this.view.scrollDOM;!function(t,e,n,i,r,s,o,l){let a=t.ownerDocument,h=a.defaultView||window;for(let c=t,u=!1;c&&!u;)if(1==c.nodeType){let t,d=c==a.body,f=1,p=1;if(d)t=ze(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(u=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();({scaleX:f,scaleY:p}=He(c,e)),t={left:e.left,right:e.left+c.clientWidth*f,top:e.top,bottom:e.top+c.clientHeight*p}}let g=0,m=0;if("nearest"==r)e.top<t.top?(m=e.top-(t.top+o),n>0&&e.bottom>t.bottom+m&&(m=e.bottom-t.bottom+o)):e.bottom>t.bottom&&(m=e.bottom-t.bottom+o,n<0&&e.top-m<t.top&&(m=e.top-(t.top+o)));else{let i=e.bottom-e.top,s=t.bottom-t.top;m=("center"==r&&i<=s?e.top+i/2-s/2:"start"==r||"center"==r&&n<0?e.top-o:e.bottom-s+o)-t.top}if("nearest"==i?e.left<t.left?(g=e.left-(t.left+s),n>0&&e.right>t.right+g&&(g=e.right-t.right+s)):e.right>t.right&&(g=e.right-t.right+s,n<0&&e.left<t.left+g&&(g=e.left-(t.left+s))):g=("center"==i?e.left+(e.right-e.left)/2-(t.right-t.left)/2:"start"==i==l?e.left-s:e.right-(t.right-t.left)+s)-t.left,g||m)if(d)h.scrollBy(g,m);else{let t=0,n=0;if(m){let t=c.scrollTop;c.scrollTop+=m/p,n=(c.scrollTop-t)*p}if(g){let e=c.scrollLeft;c.scrollLeft+=g/f,t=(c.scrollLeft-e)*f}e={left:e.left-t,top:e.top-n,right:e.right-t,bottom:e.bottom-n},t&&Math.abs(t-g)<1&&(i="nearest"),n&&Math.abs(n-m)<1&&(r="nearest")}if(d)break;(e.top<t.top||e.bottom>t.bottom||e.left<t.left||e.right>t.right)&&(e={left:Math.max(e.left,t.left),right:Math.min(e.right,t.right),top:Math.max(e.top,t.top),bottom:Math.min(e.bottom,t.bottom)}),c=c.assignedSlot||c.parentNode}else{if(11!=c.nodeType)break;c=c.host}}(this.view.scrollDOM,s,n.head<n.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,o),-o),Math.max(Math.min(t.yMargin,l),-l),this.view.textDirection==Un.LTR)}}function qi(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let i=Je(n.focusNode,n.focusOffset),r=Xe(n.focusNode,n.focusOffset),s=i||r;if(r&&i&&r.node!=i.node){let e=en.get(r.node);if(!e||e instanceof yn&&e.text!=r.node.nodeValue)s=r;else if(t.docView.lastCompositionAfterCursor){let t=en.get(i.node);!t||t instanceof yn&&t.text!=i.node.nodeValue||(s=r)}}if(t.docView.lastCompositionAfterCursor=s!=i,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}let Ui=class{constructor(){this.changes=[]}compareRange(t,e){Vn(t,e,this.changes)}comparePoint(t,e){Vn(t,e,this.changes)}boundChange(t){Vn(t,t,this.changes)}};function Ki(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function Gi(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function Yi(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function Qi(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function Ji(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function Xi(t,e,n){let i,r,s,o,l,a,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=Be(d);for(let f=0;f<t.length;f++){let p=t[f];r&&Yi(r,p)&&(p=Qi(Ji(p,r.bottom),r.top));let g=Ki(e,p),m=Gi(n,p);if(0==g&&0==m)return 3==d.nodeType?Zi(d,e,n):Xi(d,e,n);(!i||o>m||o==m&&s>g)&&(i=d,r=p,s=g,o=m,u=!g||(e<p.left?f>0:f<t.length-1)),0==g?n>p.bottom&&(!h||h.bottom<p.bottom)?(l=d,h=p):n<p.top&&(!c||c.top>p.top)&&(a=d,c=p):h&&Yi(h,p)?h=Ji(h,p.bottom):c&&Yi(c,p)&&(c=Qi(c,p.top))}}if(h&&h.bottom>=n?(i=l,r=h):c&&c.top<=n&&(i=a,r=c),!i)return{node:t,offset:0};let d=Math.max(r.left,Math.min(r.right,e));return 3==i.nodeType?Zi(i,d,n):u&&"false"!=i.contentEditable?Xi(i,d,n):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,i)+(e>=(r.left+r.right)/2?1:0)}}function Zi(t,e,n){let i=t.nodeValue.length,r=-1,s=1e9,o=0;for(let l=0;l<i;l++){let i=Ke(t,l,l+1).getClientRects();for(let a=0;a<i.length;a++){let h=i[a];if(h.top==h.bottom)continue;o||(o=e-h.left);let c=(h.top>n?h.top-n:n-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&c<s){let n=e>=(h.left+h.right)/2,i=n;if((bn.chrome||bn.gecko)&&Ke(t,l).getBoundingClientRect().left==h.right&&(i=!n),c<=0)return{node:t,offset:l+(i?1:0)};r=l+(i?1:0),s=c}}}return{node:t,offset:r>-1?r:o>0?t.nodeValue.length:0}}function tr(t,e,n,i=-1){var r,s;let o,l=t.contentDOM.getBoundingClientRect(),a=l.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-a;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.viewState.heightOracle.textHeight/2,r=!1;o=t.elementAtHeight(d),o.type!=Rn.Text;)for(;d=i>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(r)return n?null:0;r=!0,i=-i}u=a+d;let f=o.from;if(f<t.viewport.from)return 0==t.viewport.from?0:n?null:er(t,l,o,c,u);if(f>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:er(t,l,o,c,u);let p=t.dom.ownerDocument,g=t.root.elementFromPoint?t.root:p,m=g.elementFromPoint(c,u);m&&!t.contentDOM.contains(m)&&(m=null),m||(c=Math.max(l.left+1,Math.min(l.right-1,c)),m=g.elementFromPoint(c,u),m&&!t.contentDOM.contains(m)&&(m=null));let v,b=-1;if(m&&0!=(null===(r=t.docView.nearest(m))||void 0===r?void 0:r.isEditable)){if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:v,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:v,startOffset:b}=e),(!t.contentDOM.contains(v)||bn.safari&&function(t,e,n){let i,r=t;if(3!=t.nodeType||e!=(i=t.nodeValue.length))return!1;for(;;){let t=r.nextSibling;if(t){if("BR"==t.nodeName)break;return!1}{let t=r.parentNode;if(!t||"DIV"==t.nodeName)break;r=t}}return Ke(t,i-1,i).getBoundingClientRect().right>n}(v,b,c)||bn.chrome&&function(t,e,n){if(0!=e)return!1;for(let e=t;;){let t=e.parentNode;if(!t||1!=t.nodeType||t.firstChild!=e)return!1;if(t.classList.contains("cm-line"))break;e=t}return n-(1==t.nodeType?t.getBoundingClientRect():Ke(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}(v,b,c))&&(v=void 0))}v&&(b=Math.min(Ve(v),b))}if(!v||!t.docView.dom.contains(v)){let e=jn.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:v,offset:b}=Xi(e.dom,c,u))}let y=t.docView.nearest(v);if(!y)return null;if(y.isWidget&&1==(null===(s=y.dom)||void 0===s?void 0:s.nodeType)){let t=y.dom.getBoundingClientRect();return e.y<t.top||e.y<=t.bottom&&e.x<=(t.left+t.right)/2?y.posAtStart:y.posAtEnd}return y.localPosFromDOM(v,b)+y.posAtStart}function er(t,e,n,i,r){let s=Math.round((i-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>1.5*t.defaultLineHeight){let e=t.viewState.heightOracle.textHeight;s+=Math.floor((r-n.top-.5*(t.defaultLineHeight-e))/e)*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+function(t,e,n){for(let i=0,r=0;;){if(r>=e)return i;if(i==t.length)break;r+=9==t.charCodeAt(i)?n-r%n:1,i=Z(t,i)}return t.length}(o,s,t.state.tabSize)}function nr(t,e,n,i){let r=t.state.doc.lineAt(e.head),s=t.bidiSpans(r),o=t.textDirectionAt(r.from);for(let l=e,a=null;;){let e=hi(r,s,o,l,n),h=ai;if(!e){if(r.number==(n?t.state.doc.lines:1))return l;h="\n",r=t.state.doc.line(r.number+(n?1:-1)),s=t.bidiSpans(r),e=t.visualLineSide(r,!n)}if(a){if(!a(h))return l}else{if(!i)return e;a=i(h)}l=e}}function ir(t,e,n){for(;;){let i=0;for(let r of t)r.between(e-1,e+1,(t,r,s)=>{if(e>t&&e<r){let s=i||n||(e-t<r-e?-1:1);e=s<0?t:r,i=s}});if(!i)return e}}function rr(t,e,n){let i=ir(t.state.facet(Ni).map(e=>e(t)),n.from,e.head>n.from?-1:1);return i==n.from?n:pt.cursor(i,i<n.from?1:-1)}const sr="";class or{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(te.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=sr}readRange(t,e){if(!t)return this;let n=t.parentNode;for(let i=t;;){this.findPointBefore(n,i);let t=this.text.length;this.readNode(i);let r=i.nextSibling;if(r==e)break;let s=en.get(i),o=en.get(r);(s&&o?s.breakAfter:(s?s.breakAfter:Le(i))||Le(r)&&("BR"!=i.nodeName||i.cmIgnore)&&this.text.length>t)&&this.lineBreak(),i=r}return this.findPointBefore(n,e),this}readTextNode(t){let e=t.nodeValue;for(let n of this.points)n.node==t&&(n.pos=this.text.length+Math.min(n.offset,e.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let r,s=-1,o=1;if(this.lineSeparator?(s=e.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(r=i.exec(e))&&(s=r.index,o=r[0].length),this.append(e.slice(n,s<0?e.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let e of this.points)e.node==t&&e.pos>this.text.length&&(e.pos-=o-1);n=s+o}}readNode(t){if(t.cmIgnore)return;let e=en.get(t),n=e&&e.overrideDOMText;if(null!=n){this.findPointInside(t,n.length);for(let t=n.iter();!t.next().done;)t.lineBreak?this.lineBreak():this.append(t.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let n of this.points)n.node==t&&t.childNodes[n.offset]==e&&(n.pos=this.text.length)}findPointInside(t,e){for(let n of this.points)(3==t.nodeType?n.node==t:t.contains(n.node))&&(n.pos=this.text.length+(lr(t,n.node,n.offset)?e:0))}}function lr(t,e,n){for(;;){if(!e||n<Ve(e))return!1;if(e==t)return!0;n=Ne(e)+1,e=e.parentNode}}class ar{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class hr{constructor(t,e,n,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=e>-1;let{impreciseHead:r,impreciseAnchor:s}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,n,0))){let e=r||s?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new ar(n,i)),r==n&&s==i||e.push(new ar(r,s))),e}(t),n=new or(e,t.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(t,e){if(0==t.length)return null;let n=t[0].pos,i=2==t.length?t[1].pos:n;return n>-1&&i>-1?pt.single(n+e,i+e):null}(e,this.bounds.from)}else{let e=t.observer.selectionRange,n=r&&r.node==e.focusNode&&r.offset==e.focusOffset||!De(t.contentDOM,e.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),i=s&&s.node==e.anchorNode&&s.offset==e.anchorOffset||!De(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset),o=t.viewport;if((bn.ios||bn.chrome)&&t.state.selection.main.empty&&n!=i&&(o.from>0||o.to<t.state.doc.length)){let e=Math.min(n,i),r=Math.max(n,i),s=o.from-e,l=o.to-r;0!=s&&1!=s&&0!=e||0!=l&&-1!=l&&r!=t.state.doc.length||(n=0,i=t.state.doc.length)}this.newSel=pt.single(i,n)}}}function cr(t,e){let n,{newSel:i}=e,r=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:i,to:o}=e.bounds,l=r.from,a=null;(8===s||bn.android&&e.text.length<o-i)&&(l=r.to,a="end");let h=function(t,e,n,i){let r=Math.min(t.length,e.length),s=0;for(;s<r&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&t.length==e.length)return null;let o=t.length,l=e.length;for(;o>0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;return"end"==i&&(n-=o+Math.max(0,s-Math.min(o,l))-s),o<s&&t.length<e.length?(s-=n<=s&&n>=o?s-n:0,l=s+(l-o),o=s):l<s&&(s-=n<=s&&n>=l?s-n:0,o=s+(o-l),l=s),{from:s,toA:o,toB:l}}(t.state.doc.sliceString(i,o,sr),e.text,l-i,a);h&&(bn.chrome&&13==s&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==sr+sr&&h.toB--,n={from:i+h.from,to:i+h.toA,insert:W.of(e.text.slice(h.from,h.toB).split(sr))})}else i&&(!t.hasFocus&&t.state.facet(Oi)||i.main.eq(r))&&(i=null);if(!n&&!i)return!1;if(!n&&e.typeOver&&!r.empty&&i&&i.main.empty?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,r.to)}:(bn.mac||bn.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=pt.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:W.of([n.insert.toString().replace("."," ")])}):n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,r.to))}:bn.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&t.lineWrapping&&(i&&(i=pt.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:W.of([" "])}),n)return ur(t,n,i,s);if(i&&!i.main.eq(r)){let e=!1,n="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(e=!0),n=t.inputState.lastSelectionOrigin),t.dispatch({selection:i,scrollIntoView:e,userEvent:n}),!0}return!1}function ur(t,e,n,i=-1){if(bn.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(bn.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&" "==t.state.sliceDoc(e.from,r.from))&&1==e.insert.length&&2==e.insert.lines&&Ge(t.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&0==e.insert.length||8==i&&e.insert.length<e.to-e.from&&e.to>r.head)&&Ge(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&0==e.insert.length&&Ge(t.contentDOM,"Delete",46)))return!0;let s,o=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l=()=>s||(s=function(t,e,n){let i,r=t.state,s=r.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let n=s.from<e.from?r.sliceDoc(s.from,e.from):"",o=s.to>e.to?r.sliceDoc(e.to,s.to):"";i=r.replaceSelection(t.state.toText(n+e.insert.sliceString(0,void 0,t.state.lineBreak)+o))}else{let o=r.changes(e),l=n&&n.main.to<=o.newLength?n.main:void 0;if(r.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let a,h=t.state.sliceDoc(e.from,e.to),c=n&&qi(t,n.main.head);if(c){let t=e.insert.length-(e.to-e.from);a={from:c.from,to:c.to-t}}else a=t.state.doc.lineAt(s.head);let u=s.to-e.to,d=s.to-s.from;i=r.changeByRange(n=>{if(n.from==s.from&&n.to==s.to)return{changes:o,range:l||n.map(o)};let i=n.to-u,c=i-h.length;if(n.to-n.from!=d||t.state.sliceDoc(c,i)!=h||n.to>=a.from&&n.from<=a.to)return{range:n};let f=r.changes({from:c,to:i,insert:e.insert}),p=n.to-s.to;return{changes:f,range:l?pt.range(Math.max(0,l.anchor+p),Math.max(0,l.head+p)):n.map(f)}})}else i={changes:o,selection:l&&r.selection.replaceRange(l)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:o,scrollIntoView:!0})}(t,e,n));return t.state.facet(mi).some(n=>n(t,e.from,e.to,o,l))||t.dispatch(l()),!0}class dr{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,bn.safari&&t.contentDOM.addEventListener("input",()=>null),bn.gecko&&function(t){Vr.has(t)||(Vr.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}(t.contentDOM.ownerDocument)}handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n,i=e.target;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=en.get(i))&&n.ignoreEvent(e))return!1;return!0})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t)))}runHandlers(t,e){let n=this.handlers[t];if(n){for(let t of n.observers)t(this.view,e);for(let t of n.handlers){if(e.defaultPrevented)break;if(t(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=pr(t),n=this.handlers,i=this.view.contentDOM;for(let t in e)if("scroll"!=t){let r=!e[t].handlers.length,s=n[t];s&&r!=!s.handlers.length&&(i.removeEventListener(t,this.handleEvent),s=null),s||i.addEventListener(t,this.handleEvent,{passive:r})}for(let t in n)"scroll"==t||e[t]||i.removeEventListener(t,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=t.keyCode&&vr.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),bn.android&&bn.chrome&&!t.synthetic&&(13==t.keyCode||8==t.keyCode))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return!bn.ios||t.synthetic||t.altKey||t.metaKey||!((e=gr.find(e=>e.keyCode==t.keyCode))&&!t.ctrlKey||mr.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&!("Enter"==e.key&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString()))&&(this.pendingIOSKey=void 0,Ge(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(bn.safari&&!bn.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function fr(t,e){return(n,i)=>{try{return e.call(t,i,n)}catch(t){Ei(n.state,t)}}}function pr(t){let e=Object.create(null);function n(t){return e[t]||(e[t]={observers:[],handlers:[]})}for(let e of t){let t=e.spec,i=t&&t.plugin.domEventHandlers,r=t&&t.plugin.domEventObservers;if(i)for(let t in i){let r=i[t];r&&n(t).handlers.push(fr(e.value,r))}if(r)for(let t in r){let i=r[t];i&&n(t).observers.push(fr(e.value,i))}}for(let t in wr)n(t).handlers.push(wr[t]);for(let t in xr)n(t).observers.push(xr[t]);return e}const gr=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],mr="dthko",vr=[16,17,18,20,91,92,224,225];function br(t){return.7*Math.max(0,t)+8}class yr{constructor(t,e,n,i){this.view=t,this.startEvent=e,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParents=function(t){let e,n,i=t.ownerDocument;for(let r=t.parentNode;r&&!(r==i.body||e&&n);)if(1==r.nodeType)!n&&r.scrollHeight>r.clientHeight&&(n=r),!e&&r.scrollWidth>r.clientWidth&&(e=r),r=r.assignedSlot||r.parentNode;else{if(11!=r.nodeType)break;r=r.host}return{x:e,y:n}}(t.contentDOM),this.atoms=t.state.facet(Ni).map(e=>e(t));let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(te.allowMultipleSelections)&&function(t,e){let n=t.state.facet(ui);return n.length?n[0](e):bn.mac?e.metaKey:e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let i=Pe(t.root);if(!i||0==i.rangeCount)return!0;let r=i.getRangeAt(0).getClientRects();for(let t=0;t<r.length;t++){let n=r[t];if(n.left<=e.clientX&&n.right>=e.clientX&&n.top<=e.clientY&&n.bottom>=e.clientY)return!0}return!1}(t,e)||1!=Rr(e))&&null}start(t){!1===this.dragging&&this.select(t)}move(t){if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(e=this.startEvent,n=t,Math.max(Math.abs(e.clientX-n.clientX),Math.abs(e.clientY-n.clientY))<10))return;var e,n;this.select(this.lastEvent=t);let i=0,r=0,s=0,o=0,l=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:a}=this.scrollParents.y.getBoundingClientRect());let h=ji(this.view);t.clientX-h.left<=s+6?i=-br(s-t.clientX):t.clientX+h.right>=l-6&&(i=br(t.clientX-l)),t.clientY-h.top<=o+6?r=-br(o-t.clientY):t.clientY+h.bottom>=a-6&&(r=br(t.clientY-a)),this.setScrollSpeed(i,r)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:e}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),e&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=e,e=0),(t||e)&&this.view.win.scrollBy(t,e),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let n=0;n<t.ranges.length;n++){let i=t.ranges[n],r=null;if(i.empty){let t=ir(this.atoms,i.from,0);t!=i.from&&(r=pt.cursor(t,-1))}else{let t=ir(this.atoms,i.from,-1),e=ir(this.atoms,i.to,1);t==i.from&&e==i.to||(r=pt.range(i.from==i.anchor?t:e,i.from==i.head?t:e))}r&&(e||(e=t.ranges.slice()),e[n]=r)}return e?pt.create(e,t.mainIndex):t}select(t){let{view:e}=this,n=this.skipAtoms(this.style.get(t,this.extend,this.multiple));!this.mustSelect&&n.eq(e.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}const wr=Object.create(null),xr=Object.create(null),kr=bn.ie&&bn.ie_version<15||bn.ios&&bn.webkit_version<604;function Ar(t,e,n){for(let i of t.facet(e))n=i(n,t);return n}function Sr(t,e){e=Ar(t.state,bi,e);let n,{state:i}=t,r=1,s=i.toText(e),o=s.lines==i.selection.ranges.length;if(null!=Ir&&i.selection.ranges.every(t=>t.empty)&&Ir==s.toString()){let t=-1;n=i.changeByRange(n=>{let l=i.doc.lineAt(n.from);if(l.from==t)return{range:n};t=l.from;let a=i.toText((o?s.line(r++).text:e)+i.lineBreak);return{changes:{from:l.from,insert:a},range:pt.cursor(n.from+a.length)}})}else n=o?i.changeByRange(t=>{let e=s.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:pt.cursor(t.from+e.length)}}):i.replaceSelection(s);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function Cr(t,e,n,i){if(1==i)return pt.cursor(e,n);if(2==i)return function(t,e,n=1){let i=t.charCategorizer(e),r=t.doc.lineAt(e),s=e-r.from;if(0==r.length)return pt.cursor(e);0==s?n=1:s==r.length&&(n=-1);let o=s,l=s;n<0?o=Z(r.text,s,!1):l=Z(r.text,s);let a=i(r.text.slice(o,l));for(;o>0;){let t=Z(r.text,o,!1);if(i(r.text.slice(t,o))!=a)break;o=t}for(;l<r.length;){let t=Z(r.text,l);if(i(r.text.slice(l,t))!=a)break;l=t}return pt.range(o+r.from,l+r.from)}(t.state,e,n);{let n=jn.find(t.docView,e),i=t.state.doc.lineAt(n?n.posAtEnd:e),r=n?n.posAtStart:i.from,s=n?n.posAtEnd:i.to;return s<t.state.doc.length&&s==i.to&&s++,pt.range(r,s)}}xr.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},wr.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),27==e.keyCode&&0!=t.inputState.tabFocusMode&&(t.inputState.tabFocusMode=Date.now()+2e3),!1),xr.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},xr.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},wr.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of t.state.facet(fi))if(n=i(t,e),n)break;if(n||0!=e.button||(n=function(t,e){let n=Tr(t,e),i=Rr(e),r=t.state.selection;return{update(t){t.docChanged&&(n.pos=t.changes.mapPos(n.pos),r=r.map(t.changes))},get(e,s,o){let l,a=Tr(t,e),h=Cr(t,a.pos,a.bias,i);if(n.pos!=a.pos&&!s){let e=Cr(t,n.pos,n.bias,i),r=Math.min(e.from,h.from),s=Math.max(e.to,h.to);h=r<h.from?pt.range(r,s):pt.range(s,r)}return s?r.replaceRange(r.main.extend(h.from,h.to)):o&&1==i&&r.ranges.length>1&&(l=function(t,e){for(let n=0;n<t.ranges.length;n++){let{from:i,to:r}=t.ranges[n];if(i<=e&&r>=e)return pt.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}(r,a.pos))?l:o?r.addRange(h):pt.create([h])}}}(t,e)),n){let i=!t.hasFocus;t.inputState.startMouseSelection(new yr(t,e,n,i)),i&&t.observer.ignore(()=>{Ue(t.contentDOM);let e=t.root.activeElement;e&&!e.contains(t.contentDOM)&&e.blur()});let r=t.inputState.mouseSelection;if(r)return r.start(e),!1===r.dragging}return!1};let Er=(t,e,n)=>e>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function Or(t,e,n,i){let r=jn.find(t.docView,e);if(!r)return 1;let s=e-r.posAtStart;if(0==s)return 1;if(s==r.length)return-1;let o=r.coordsAt(s,-1);if(o&&Er(n,i,o))return-1;let l=r.coordsAt(s,1);return l&&Er(n,i,l)?1:o&&o.bottom>=i?-1:1}function Tr(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Or(t,n,e.clientX,e.clientY)}}const Mr=bn.ie&&bn.ie_version<=11;let _r=null,Pr=0,Dr=0;function Rr(t){if(!Mr)return t.detail;let e=_r,n=Dr;return _r=t,Dr=Date.now(),Pr=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Pr+1)%3:1}function Br(t,e,n,i){if(!(n=Ar(t.state,bi,n)))return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=i&&s&&function(t,e){let n=t.state.facet(di);return n.length?n[0](e):bn.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:s.from,to:s.to}:null,l={from:r,insert:n},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}wr.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.nearest(e.target);if(i&&i.isWidget){let t=i.posAtStart,e=t+i.length;(t>=n.to||e<=n.from)&&(n=pt.range(t,e))}}let{inputState:i}=t;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Ar(t.state,yi,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1},wr.dragend=t=>(t.inputState.draggedContent=null,!1),wr.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,s=()=>{++r==n.length&&Br(t,e,i.filter(t=>null!=t).join(t.state.lineBreak),!1)};for(let t=0;t<n.length;t++){let e=new FileReader;e.onerror=s,e.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(i[t]=e.result),s()},e.readAsText(n[t])}return!0}{let n=e.dataTransfer.getData("Text");if(n)return Br(t,e,n,!0),!0}return!1},wr.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=kr?null:e.clipboardData;return n?(Sr(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),Sr(t,n.value)},50)}(t),!1)};let Ir=null;wr.copy=wr.cut=(t,e)=>{let{text:n,ranges:i,linewise:r}=function(t){let e=[],n=[],i=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let r=-1;for(let{from:i}of t.selection.ranges){let s=t.doc.lineAt(i);s.number>r&&(e.push(s.text),n.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),r=s.number}i=!0}return{text:Ar(t,yi,e.join(t.lineBreak)),ranges:n,linewise:i}}(t.state);if(!n&&!r)return!1;Ir=r?n:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=kr?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(function(t,e){let n=t.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),t.focus()},50)}(t,n),!1)};const Nr=jt.define();function Lr(t,e){let n=[];for(let i of t.facet(vi)){let r=i(t,e);r&&n.push(r)}return n.length?t.update({effects:n,annotations:Nr.of(!0)}):null}function Fr(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=Lr(t.state,e);n?t.dispatch(n):t.update([])}},10)}xr.focus=t=>{t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Fr(t)},xr.blur=t=>{t.observer.clearSelectionRange(),Fr(t)},xr.compositionstart=xr.compositionupdate=t=>{t.observer.editContext||(null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))},xr.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,bn.chrome&&bn.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))},xr.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},wr.beforeinput=(t,e)=>{var n,i;if("insertReplacementText"==e.inputType&&t.observer.editContext){let i=null===(n=e.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),r=e.getTargetRanges();if(i&&r.length){let e=r[0],n=t.posAtDOM(e.startContainer,e.startOffset),s=t.posAtDOM(e.endContainer,e.endOffset);return ur(t,{from:n,to:s,insert:t.state.toText(i)},null),!0}}let r;if(bn.chrome&&bn.android&&(r=gr.find(t=>t.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),"Backspace"==r.key||"Delete"==r.key)){let e=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout(()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>e+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return bn.ios&&"deleteContentForward"==e.inputType&&t.observer.flushSoon(),bn.safari&&"insertText"==e.inputType&&t.inputState.composing>=0&&setTimeout(()=>xr.compositionend(t,e),20),!1};const Vr=new Set,jr=["pre-wrap","normal","pre-line","break-spaces"];let zr=!1;function Hr(){zr=!1}class Wr{constructor(t){this.lineWrapping=t,this.doc=W.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,e){let n=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((e-t-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jr.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let n=0;n<t.length;n++){let i=t[n];i<0?n++:this.heightSamples[Math.floor(10*i)]||(e=!0,this.heightSamples[Math.floor(10*i)]=!0)}return e}refresh(t,e,n,i,r,s){let o=jr.indexOf(t)>-1,l=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=e,this.charWidth=n,this.textHeight=i,this.lineLength=r,l){this.heightSamples={};for(let t=0;t<s.length;t++){let e=s[t];e<0?t++:this.heightSamples[Math.floor(10*e)]=!0}}return l}}class $r{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class qr{constructor(t,e,n,i,r){this.from=t,this.length=e,this.top=n,this.height=i,this._content=r}get type(){return"number"==typeof this._content?Rn.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Ln?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(t){let e=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new qr(this.from,this.length+t.length,this.top,this.height+t.height,e)}}var Ur=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Ur||(Ur={}));const Kr=.001;class Gr{constructor(t,e,n=2){this.length=t,this.height=e,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>Kr&&(zr=!0),this.height=t)}replace(t,e,n){return Gr.of(n)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,n,i){let r=this,s=n.doc;for(let o=i.length-1;o>=0;o--){let{fromA:l,toA:a,fromB:h,toB:c}=i[o],u=r.lineAt(l,Ur.ByPosNoHeight,n.setDoc(e),0,0),d=u.to>=a?u:r.lineAt(a,Ur.ByPosNoHeight,n,0,0);for(c+=d.to-a,a=d.to;o>0&&u.from<=i[o-1].toA;)l=i[o-1].fromA,h=i[o-1].fromB,o--,l<u.from&&(u=r.lineAt(l,Ur.ByPosNoHeight,n,0,0));h+=u.from-l,l=u.from;let f=es.build(n.setDoc(s),t,h,c);r=Yr(r,r.replace(l,a,f))}return r.updateHeight(n,0)}static empty(){return new Jr(0,0)}static of(t){if(1==t.length)return t[0];let e=0,n=t.length,i=0,r=0;for(;;)if(e==n)if(i>2*r){let r=t[e-1];r.break?t.splice(--e,1,r.left,null,r.right):t.splice(--e,1,r.left,r.right),n+=1+r.break,i-=r.size}else{if(!(r>2*i))break;{let e=t[n];e.break?t.splice(n,1,e.left,null,e.right):t.splice(n,1,e.left,e.right),n+=2+e.break,r-=e.size}}else if(i<r){let n=t[e++];n&&(i+=n.size)}else{let e=t[--n];e&&(r+=e.size)}let s=0;return null==t[e-1]?(s=1,e--):null==t[e]&&(s=1,n++),new Zr(Gr.of(t.slice(0,e)),s,Gr.of(t.slice(n)))}}function Yr(t,e){return t==e?t:(t.constructor!=e.constructor&&(zr=!0),e)}Gr.prototype.size=1;class Qr extends Gr{constructor(t,e,n){super(t,e),this.deco=n}blockAt(t,e,n,i){return new qr(i,this.length,n,this.height,this.deco||0)}lineAt(t,e,n,i,r){return this.blockAt(0,n,i,r)}forEachLine(t,e,n,i,r,s){t<=r+this.length&&e>=r&&s(this.blockAt(0,n,i,r))}updateHeight(t,e=0,n=!1,i){return i&&i.from<=e&&i.more&&this.setHeight(i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Jr extends Qr{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,n,i){return new qr(i,this.length,n,this.height,this.breaks)}replace(t,e,n){let i=n[0];return 1==n.length&&(i instanceof Jr||i instanceof Xr&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof Xr?i=new Jr(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Gr.of(n)}updateHeight(t,e=0,n=!1,i){return i&&i.from<=e&&i.more?this.setHeight(i.heights[i.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Xr extends Gr{constructor(t){super(t,0)}heightMetrics(t,e){let n,i=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,s=r-i+1,o=0;if(t.lineWrapping){let e=Math.min(this.height,t.lineHeight*s);n=e/s,this.length>s+1&&(o=(this.height-e)/(this.length-s-1))}else n=this.height/s;return{firstLine:i,lastLine:r,perLine:n,perChar:o}}blockAt(t,e,n,i){let{firstLine:r,lastLine:s,perLine:o,perChar:l}=this.heightMetrics(e,i);if(e.lineWrapping){let r=i+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-n)/this.height))*this.length)),s=e.doc.lineAt(r),a=o+s.length*l,h=Math.max(n,t-a/2);return new qr(s.from,s.length,h,a,0)}{let i=Math.max(0,Math.min(s-r,Math.floor((t-n)/o))),{from:l,length:a}=e.doc.line(r+i);return new qr(l,a,n+o*i,o,0)}}lineAt(t,e,n,i,r){if(e==Ur.ByHeight)return this.blockAt(t,n,i,r);if(e==Ur.ByPosNoHeight){let{from:e,to:i}=n.doc.lineAt(t);return new qr(e,i-e,0,0,0)}let{firstLine:s,perLine:o,perChar:l}=this.heightMetrics(n,r),a=n.doc.lineAt(t),h=o+a.length*l,c=a.number-s,u=i+o*c+l*(a.from-r-c);return new qr(a.from,a.length,Math.max(i,Math.min(u,i+this.height-h)),h,0)}forEachLine(t,e,n,i,r,s){t=Math.max(t,r),e=Math.min(e,r+this.length);let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(n,r);for(let h=t,c=i;h<=e;){let e=n.doc.lineAt(h);if(h==t){let n=e.number-o;c+=l*n+a*(t-r-n)}let i=l+a*e.length;s(new qr(e.from,e.length,c,i,0)),c+=i,h=e.to+1}}replace(t,e,n){let i=this.length-e;if(i>0){let t=n[n.length-1];t instanceof Xr?n[n.length-1]=new Xr(t.length+i):n.push(null,new Xr(i-1))}if(t>0){let e=n[0];e instanceof Xr?n[0]=new Xr(t+e.length):n.unshift(new Xr(t-1),null)}return Gr.of(n)}decomposeLeft(t,e){e.push(new Xr(t-1),null)}decomposeRight(t,e){e.push(null,new Xr(this.length-t-1))}updateHeight(t,e=0,n=!1,i){let r=e+this.length;if(i&&i.from<=e+this.length&&i.more){let n=[],s=Math.max(e,i.from),o=-1;for(i.from>e&&n.push(new Xr(i.from-e-1).updateHeight(t,e));s<=r&&i.more;){let e=t.doc.lineAt(s).length;n.length&&n.push(null);let r=i.heights[i.index++];-1==o?o=r:Math.abs(r-o)>=Kr&&(o=-2);let l=new Jr(e,r);l.outdated=!1,n.push(l),s+=e+1}s<=r&&n.push(null,new Xr(r-s).updateHeight(t,s));let l=Gr.of(n);return(o<0||Math.abs(l.height-this.height)>=Kr||Math.abs(o-this.heightMetrics(t,e).perLine)>=Kr)&&(zr=!0),Yr(this,l)}return(n||this.outdated)&&(this.setHeight(t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Zr extends Gr{constructor(t,e,n){super(t.length+e+n.length,t.height+n.height,e|(t.outdated||n.outdated?2:0)),this.left=t,this.right=n,this.size=t.size+n.size}get break(){return 1&this.flags}blockAt(t,e,n,i){let r=n+this.left.height;return t<r?this.left.blockAt(t,e,n,i):this.right.blockAt(t,e,r,i+this.left.length+this.break)}lineAt(t,e,n,i,r){let s=i+this.left.height,o=r+this.left.length+this.break,l=e==Ur.ByHeight?t<s:t<o,a=l?this.left.lineAt(t,e,n,i,r):this.right.lineAt(t,e,n,s,o);if(this.break||(l?a.to<o:a.from>o))return a;let h=e==Ur.ByPosNoHeight?Ur.ByPosNoHeight:Ur.ByPos;return l?a.join(this.right.lineAt(o,h,n,s,o)):this.left.lineAt(o,h,n,i,r).join(a)}forEachLine(t,e,n,i,r,s){let o=i+this.left.height,l=r+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,e,n,i,r,s),e>=l&&this.right.forEachLine(t,e,n,o,l,s);else{let a=this.lineAt(l,Ur.ByPos,n,i,r);t<a.from&&this.left.forEachLine(t,a.from-1,n,i,r,s),a.to>=t&&a.from<=e&&s(a),e>a.to&&this.right.forEachLine(a.to+1,e,n,o,l,s)}}replace(t,e,n){let i=this.left.length+this.break;if(e<i)return this.balanced(this.left.replace(t,e,n),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-i,e-i,n));let r=[];t>0&&this.decomposeLeft(t,r);let s=r.length;for(let t of n)r.push(t);if(t>0&&ts(r,s-1),e<this.length){let t=r.length;this.decomposeRight(e,r),ts(r,t)}return Gr.of(r)}decomposeLeft(t,e){let n=this.left.length;if(t<=n)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&(n++,t>=n&&e.push(null)),t>n&&this.right.decomposeLeft(t-n,e)}decomposeRight(t,e){let n=this.left.length,i=n+this.break;if(t>=i)return this.right.decomposeRight(t-i,e);t<n&&this.left.decomposeRight(t,e),this.break&&t<i&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?Gr.of(this.break?[t,null,e]:[t,e]):(this.left=Yr(this.left,t),this.right=Yr(this.right,e),this.setHeight(t.height+e.height),this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,n=!1,i){let{left:r,right:s}=this,o=e+r.length+this.break,l=null;return i&&i.from<=e+r.length&&i.more?l=r=r.updateHeight(t,e,n,i):r.updateHeight(t,e,n),i&&i.from<=o+s.length&&i.more?l=s=s.updateHeight(t,o,n,i):s.updateHeight(t,o,n),l?this.balanced(r,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function ts(t,e){let n,i;null==t[e]&&(n=t[e-1])instanceof Xr&&(i=t[e+1])instanceof Xr&&t.splice(e-1,3,new Xr(n.length+1+i.length))}class es{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let t=Math.min(e,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Jr?n.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new Jr(t-this.pos,-1)),this.writtenTo=t,e>t&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,n){if(t<e||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let s=e-t;n.block?this.addBlock(new Qr(s,i,n)):(s||r||i>=5)&&this.addLineDeco(i,r,s)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new Jr(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let n=new Xr(e-t);return this.oracle.doc.lineAt(t).to==e&&(n.flags|=4),n}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Jr)return t;let e=new Jr(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,t),i.breaks+=e,this.writtenTo=this.pos=this.pos+n}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof Jr||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Jr(0,-1));let n=t;for(let t of this.nodes)t instanceof Jr&&t.updateHeight(this.oracle,n),n+=t?t.length:1;return this.nodes}static build(t,e,n,i){let r=new es(n,t);return oe.spans(e,n,i,r,0),r.finish(n)}}class ns{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,n,i){(t<e||n&&n.heightRelevant||i&&i.heightRelevant)&&Vn(t,e,this.changes,5)}}function is(t,e){let n=t.getBoundingClientRect(),i=t.ownerDocument,r=i.defaultView||window,s=Math.max(0,n.left),o=Math.min(r.innerWidth,n.right),l=Math.max(0,n.top),a=Math.min(r.innerHeight,n.bottom);for(let e=t.parentNode;e&&e!=i.body;)if(1==e.nodeType){let n=e,i=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();s=Math.max(s,i.left),o=Math.min(o,i.right),l=Math.max(l,i.top),a=Math.min(e==t.parentNode?r.innerHeight:a,i.bottom)}e="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=e.nodeType)break;e=e.host}return{left:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+e),bottom:Math.max(l,a)-(n.top+e)}}function rs(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class ss{constructor(t,e,n,i){this.from=t,this.to=e,this.size=n,this.displaySize=i}static same(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let i=t[n],r=e[n];if(i.from!=r.from||i.to!=r.to||i.size!=r.size)return!1}return!0}draw(t,e){return Bn.replace({widget:new os(this.displaySize*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}}class os extends Dn{constructor(t,e){super(),this.size=t,this.vertical=e}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}}class ls{constructor(t){this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=us,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Un.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let e=t.facet(Ri).some(t=>"function"!=typeof t&&"cm-lineWrapping"==t.class);this.heightOracle=new Wr(e),this.stateDeco=t.facet(Bi).filter(t=>"function"!=typeof t),this.heightMap=Gr.empty().applyChanges(this.stateDeco,W.empty,this.heightOracle.setDoc(t.doc),[new Hi(0,0,0,t.doc.length)]);for(let t=0;t<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());t++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Bn.set(this.lineGaps.map(t=>t.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let n=0;n<=1;n++){let i=n?e.head:e.anchor;if(!t.some(({from:t,to:e})=>i>=t&&i<=e)){let{from:e,to:n}=this.lineBlockAt(i);t.push(new as(e,n))}}return this.viewports=t.sort((t,e)=>t.from-e.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?us:new ds(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(fs(t,this.scaler))})}update(t,e=null){this.state=t.state;let n=this.stateDeco;this.stateDeco=this.state.facet(Bi).filter(t=>"function"!=typeof t);let i=t.changedRanges,r=Hi.extendWithRanges(i,function(t,e,n){let i=new ns;return oe.compare(t,e,n,i,0),i.changes}(n,this.stateDeco,t?t.changes:ot.empty(this.state.doc.length))),s=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Hr(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=s||zr)&&(t.flags|=2),o?(this.scrollAnchorPos=t.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let l=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<l.from||e.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));let a=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,t.flags|=this.updateForViewport(),(a||!t.changes.empty||2&t.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(xi)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,n=window.getComputedStyle(e),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Un.RTL:Un.LTR;let s=this.heightOracle.mustRefreshForWrapping(r),o=e.getBoundingClientRect(),l=s||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let a=0,h=0;if(o.width&&o.height){let{scaleX:t,scaleY:n}=He(e,o);(t>.005&&Math.abs(this.scaleX-t)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=t,this.scaleY=n,a|=16,s=l=!0)}let c=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==c&&this.paddingBottom==u||(this.paddingTop=c,this.paddingBottom=u,a|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,a|=16);let d=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Qe(t.scrollDOM);let f=(this.printing?rs:is)(e,this.paddingTop),p=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&&(l=!0)),!this.inView&&!this.scrollTarget&&!function(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}(t.dom))return 0;let v=o.width;if(this.contentDOMWidth==v&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=o.width,this.editorHeight=t.scrollDOM.clientHeight,a|=16),l){let e=t.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(e)&&(s=!0),s||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:n,charWidth:o,textHeight:l}=t.docView.measureTextSize();s=n>0&&i.refresh(r,n,o,l,v/o,e),s&&(t.docView.minWidth=0,a|=16)}p>0&&g>0?h=Math.max(p,g):p<0&&g<0&&(h=Math.min(p,g)),Hr();for(let n of this.viewports){let r=n.from==this.viewport.from?e:t.docView.measureVisibleLineHeights(n);this.heightMap=(s?Gr.empty().applyChanges(this.stateDeco,W.empty,this.heightOracle,[new Hi(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(i,0,s,new $r(n.from,r))}zr&&(a|=2)}let b=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return b&&(2&a&&(a|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),a|=this.updateForViewport()),(2&a||b)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,t)),a|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),a}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let n=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),i=this.heightMap,r=this.heightOracle,{visibleTop:s,visibleBottom:o}=this,l=new as(i.lineAt(s-1e3*n,Ur.ByHeight,r,0,0).from,i.lineAt(o+1e3*(1-n),Ur.ByHeight,r,0,0).to);if(e){let{head:t}=e.range;if(t<l.from||t>l.to){let n,s=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=i.lineAt(t,Ur.ByPos,r,0,0);n="center"==e.y?(o.top+o.bottom)/2-s/2:"start"==e.y||"nearest"==e.y&&t<l.from?o.top:o.bottom-s,l=new as(i.lineAt(n-500,Ur.ByHeight,r,0,0).from,i.lineAt(n+s+500,Ur.ByHeight,r,0,0).to)}}return l}mapViewport(t,e){let n=e.mapPos(t.from,-1),i=e.mapPos(t.to,1);return new as(this.heightMap.lineAt(n,Ur.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Ur.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:e},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(t,Ur.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(e,Ur.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:o}=this;return(0==t||i<=s-Math.max(10,Math.min(-n,250)))&&(e==this.state.doc.length||r>=o+Math.max(10,Math.min(n,250)))&&i>s-2e3&&r<o+2e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let n=[];for(let i of t)e.touchesRange(i.from,i.to)||n.push(new ss(e.mapPos(i.from),e.mapPos(i.to),i.size,i.displaySize));return n}ensureLineGaps(t,e){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,r=i>>1,s=i<<1;if(this.defaultTextDirection!=Un.LTR&&!n)return[];let o=[],l=(i,s,a,h)=>{if(s-i<r)return;let c=this.state.selection.main,u=[c.from];c.empty||u.push(c.to);for(let t of u)if(t>i&&t<s)return l(i,t-10,a,h),void l(t+10,s,a,h);let d=function(t,e){for(let n of t)if(e(n))return n}(t,t=>t.from>=a.from&&t.to<=a.to&&Math.abs(t.from-i)<r&&Math.abs(t.to-s)<r&&!u.some(e=>t.from<e&&t.to>e));if(!d){if(s<a.to&&e&&n&&e.visibleRanges.some(t=>t.from<=s&&t.to>=s)){let t=e.moveToLineBoundary(pt.cursor(s),!1,!0).head;t>i&&(s=t)}let t=this.gapSize(a,i,s,h);d=new ss(i,s,t,n||t<2e6?t:2e6)}o.push(d)},a=e=>{if(e.length<s||e.type!=Rn.Text)return;let r=function(t,e,n){let i=[],r=t,s=0;return oe.spans(n,t,e,{span(){},point(t,e){t>r&&(i.push({from:r,to:t}),s+=t-r),r=e}},20),r<e&&(i.push({from:r,to:e}),s+=e-r),{total:s,ranges:i}}(e.from,e.to,this.stateDeco);if(r.total<s)return;let o,a,h=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let t,n,s=i/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=h){let i=cs(r,h),o=((this.visibleBottom-this.visibleTop)/2+s)/e.height;t=i-o,n=i+o}else t=(this.visibleTop-e.top-s)/e.height,n=(this.visibleBottom-e.top+s)/e.height;o=hs(r,t),a=hs(r,n)}else{let n=r.total*this.heightOracle.charWidth,s=i*this.heightOracle.charWidth,l=0;if(n>2e6)for(let n of t)n.from>=e.from&&n.from<e.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+l<this.pixelViewport.left&&(l=n.size-n.displaySize);let c,u,d=this.pixelViewport.left+l,f=this.pixelViewport.right+l;if(null!=h){let t=cs(r,h),e=((f-d)/2+s)/n;c=t-e,u=t+e}else c=(d-s)/n,u=(f+s)/n;o=hs(r,c),a=hs(r,u)}o>e.from&&l(e.from,o,e,r),a<e.to&&l(a,e.to,e,r)};for(let t of this.viewportLines)Array.isArray(t.type)?t.type.forEach(a):a(t);return o}gapSize(t,e,n,i){let r=cs(i,n)-cs(i,e);return this.heightOracle.lineWrapping?t.height*r:i.total*this.heightOracle.charWidth*r}updateLineGaps(t){ss.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=Bn.set(t.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let n=[];oe.spans(e,this.viewport.from,this.viewport.to,{span(t,e){n.push({from:t,to:e})},point(){}},20);let i=0;if(n.length!=this.visibleRanges.length)i=12;else for(let e=0;e<n.length&&!(8&i);e++){let r=this.visibleRanges[e],s=n[e];r.from==s.from&&r.to==s.to||(i|=4,t&&t.mapPos(r.from,-1)==s.from&&t.mapPos(r.to,1)==s.to||(i|=8))}return this.visibleRanges=n,i}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||fs(this.heightMap.lineAt(t,Ur.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(e=>e.top<=t&&e.bottom>=t)||fs(this.heightMap.lineAt(this.scaler.fromDOM(t),Ur.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return fs(this.heightMap.blockAt(this.scaler.fromDOM(t),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 as{constructor(t,e){this.from=t,this.to=e}}function hs({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let i=Math.floor(t*n);for(let t=0;;t++){let{from:n,to:r}=e[t],s=r-n;if(i<=s)return n+i;i-=s}}function cs(t,e){let n=0;for(let{from:i,to:r}of t.ranges){if(e<=r){n+=e-i;break}n+=r-i}return n/t.total}const us={toDOM:t=>t,fromDOM:t=>t,scale:1,eq(t){return t==this}};class ds{constructor(t,e,n){let i=0,r=0,s=0;this.viewports=n.map(({from:n,to:r})=>{let s=e.lineAt(n,Ur.ByPos,t,0,0).top,o=e.lineAt(r,Ur.ByPos,t,0,0).bottom;return i+=o-s,{from:n,to:r,top:s,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(e.height-i);for(let t of this.viewports)t.domTop=s+(t.top-r)*this.scale,s=t.domBottom=t.domTop+(t.bottom-t.top),r=t.bottom}toDOM(t){for(let e=0,n=0,i=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.top)return i+(t-n)*this.scale;if(t<=r.bottom)return r.domTop+(t-r.top);n=r.bottom,i=r.domBottom}}fromDOM(t){for(let e=0,n=0,i=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.domTop)return n+(t-i)/this.scale;if(t<=r.domBottom)return r.top+(t-r.domTop);n=r.bottom,i=r.domBottom}}eq(t){return t instanceof ds&&this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,n)=>e.from==t.viewports[n].from&&e.to==t.viewports[n].to)}}function fs(t,e){if(1==e.scale)return t;let n=e.toDOM(t.top),i=e.toDOM(t.bottom);return new qr(t.from,t.length,n,i-n,Array.isArray(t._content)?t._content.map(t=>fs(t,e)):t._content)}const ps=vt.define({combine:t=>t.join(" ")}),gs=vt.define({combine:t=>t.indexOf(!0)>-1}),ms=ke.newName(),vs=ke.newName(),bs=ke.newName(),ys={"&light":"."+vs,"&dark":"."+bs};function ws(t,e,n){return new ke(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,e=>{if("&"==e)return t;if(!n||!n[e])throw new RangeError(`Unsupported selector: ${e}`);return n[e]}):t+" "+e})}const xs=ws("."+ms,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".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",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ys),ks={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},As=bn.ie&&bn.ie_version<=11;class Ss{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new We,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let t of e)this.queue.push(t);(bn.ie&&bn.ie_version<=11||bn.ios&&t.composing)&&e.some(t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length)?this.flushSoon():this.flush()}),!window.EditContext||!bn.android||!1===t.constructor.EDIT_CONTEXT||bn.chrome&&bn.chrome_version<126||(this.editContext=new Os(t),t.state.facet(Oi)&&(t.contentDOM.editContext=this.editContext.editContext)),As&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){("change"!=t.type&&t.type||t.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,n)=>e!=t[n]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(Oi)?n.root.activeElement!=this.dom:!Re(this.dom,i))return;let r=i.anchorNode&&n.docView.nearest(i.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(bn.ie&&bn.ie_version<=11||bn.android&&bn.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Ie(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Pe(t.root);if(!e)return!1;let n=bn.safari&&11==t.root.nodeType&&t.root.activeElement==this.dom&&function(t,e){if(e.getComposedRanges){let n=e.getComposedRanges(t.root)[0];if(n)return Es(t,n)}let n=null;function i(t){t.preventDefault(),t.stopImmediatePropagation(),n=t.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",i,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),n?Es(t,n):null}(this.view,e)||e;if(!n||this.selectionRange.eq(n))return!1;let i=Re(this.dom,n);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){let n=e.focusNode,i=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=i)return!1;for(i=Math.min(i,Ve(n));;)if(i){if(1!=n.nodeType)return!1;let t=n.childNodes[i-1];"false"==t.contentEditable?i--:(n=t,i=Ve(n))}else{if(n==t)return!0;i=Ne(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(n),i&&(this.selectionChanged=!0),!0)}setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,e=null;for(let n=this.dom;n;)if(1==n.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==n?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);for(let t of this.scrollTargets=e)t.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,ks),As&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),As&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,e){var n;if(!this.delayedAndroidKey){let t=()=>{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=t.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&t.force&&Ge(this.dom,t.key,t.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(t)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,n=-1,i=!1;for(let r of t){let t=this.readMutation(r);t&&(t.typeOver&&(i=!0),-1==e?({from:e,to:n}=t):(e=Math.min(t.from,e),n=Math.max(t.to,n)))}return{from:e,to:n,typeOver:i}}readChange(){let{from:t,to:e,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Re(this.dom,this.selectionRange);if(t<0&&!i)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new hr(this.view,t,e,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let n=this.view.state,i=cr(this.view,e);return this.view.state==n&&(e.domChanged||e.newSel&&!e.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){let n=Cs(e,t.previousSibling||t.target.previousSibling,-1),i=Cs(e,t.nextSibling||t.target.nextSibling,1);return{from:n?e.posAfter(n):e.posAtStart,to:i?e.posBefore(i):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(Oi)!=t.state.facet(Oi)&&(t.view.contentDOM.editContext=t.state.facet(Oi)?this.editContext.editContext:null))}destroy(){var t,e,n;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Cs(t,e,n){for(;e;){let i=en.get(e);if(i&&i.parent==t)return i;let r=e.parentNode;e=r!=t.dom?r:n>0?e.nextSibling:e.previousSibling}return null}function Es(t,e){let n=e.startContainer,i=e.startOffset,r=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor);return Ie(o.node,o.offset,r,s)&&([n,i,r,s]=[r,s,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}}class Os{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let e=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=e=>{let n=t.state.selection.main,{anchor:i,head:r}=n,s=this.toEditorPos(e.updateRangeStart),o=this.toEditorPos(e.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:e.updateRangeStart,editorBase:s,drifted:!1});let l={from:s,to:o,insert:W.of(e.text.split("\n"))};if(l.from==this.from&&i<this.from?l.from=i:l.to==this.to&&i>this.to&&(l.to=i),l.from==l.to&&!l.insert.length){let i=pt.single(this.toEditorPos(e.selectionStart),this.toEditorPos(e.selectionEnd));return void(i.main.eq(n)||t.dispatch({selection:i,userEvent:"select"}))}if((bn.mac||bn.android)&&l.from==r-1&&/^\. ?$/.test(e.text)&&"off"==t.contentDOM.getAttribute("autocorrect")&&(l={from:s,to:o,insert:W.of([e.text.replace("."," ")])}),this.pendingContextChange=l,!t.state.readOnly){let n=this.to-this.from+(l.to-l.from+l.insert.length);ur(t,l,pt.single(this.toEditorPos(e.selectionStart,n),this.toEditorPos(e.selectionEnd,n)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state))},this.handlers.characterboundsupdate=n=>{let i=[],r=null;for(let e=this.toEditorPos(n.rangeStart),s=this.toEditorPos(n.rangeEnd);e<s;e++){let n=t.coordsForChar(e);r=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||r||new DOMRect,i.push(r)}e.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=e=>{let n=[];for(let t of e.getTextFormats()){let e=t.underlineStyle,i=t.underlineThickness;if("None"!=e&&"None"!=i){let r=this.toEditorPos(t.rangeStart),s=this.toEditorPos(t.rangeEnd);if(r<s){let t=`text-decoration: underline ${"Dashed"==e?"dashed ":"Squiggle"==e?"wavy ":""}${"Thin"==i?1:2}px`;n.push(Bn.mark({attributes:{style:t}}).range(r,s))}}}t.dispatch({effects:Ci.of(Bn.set(n))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:e}=this.composing;this.composing=null,e&&this.reset(t.state)}};for(let t in this.handlers)e.addEventListener(t,this.handlers[t]);this.measureReq={read:t=>{this.editContext.updateControlBounds(t.contentDOM.getBoundingClientRect());let e=Pe(t.root);e&&e.rangeCount&&this.editContext.updateSelectionBounds(e.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,n=!1,i=this.pendingContextChange;return t.changes.iterChanges((r,s,o,l,a)=>{if(n)return;let h=a.length-(s-r);if(i&&s>=i.to){if(i.from==r&&i.to==s&&i.insert.eq(a))return i=this.pendingContextChange=null,e+=h,void(this.to+=h);i=null,this.revertPending(t.state)}if(r+=e,(s+=e)<=this.from)this.from+=h,this.to+=h;else if(r<this.to){if(r<this.from||s>this.to||this.to-this.from+a.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(r),this.toContextPos(s),a.toString()),this.to+=h}e+=h}),i&&!n&&this.revertPending(t.state),!n}update(t){let e=this.pendingContextChange,n=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(n.from,n.to)&&t.transactions.some(t=>!t.isUserEvent("input.type")&&t.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):this.applyEdits(t)&&this.rangeIsValid(t.state)?(t.docChanged||t.selectionSet||e)&&this.setSelection(t.state):(this.pendingContextChange=null,this.reset(t.state)),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.from+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),i=this.toContextPos(e.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==i||this.editContext.updateSelection(n,i)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to<t.doc.length&&this.to-e<500||this.to-this.from>3e4)}toEditorPos(t,e=this.to-this.from){t=Math.min(t,e);let n=this.composing;return n&&n.drifted?n.editorBase+(t-n.contextBase):t+this.from}toContextPos(t){let e=this.composing;return e&&e.drifted?e.contextBase+(t-e.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class Ts{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&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var 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),t.parent&&t.parent.appendChild(this.dom);let{dispatch:n}=t;this.dispatchTransactions=t.dispatchTransactions||n&&(t=>t.forEach(t=>n(t,this)))||(t=>this.update(t)),this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(t.parent)||document,this.viewState=new ls(t.state||te.create(t)),t.scrollTo&&t.scrollTo.is(Si)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Mi).map(t=>new Pi(t));for(let t of this.plugins)t.update(this);this.observer=new Ss(this),this.inputState=new dr(this),this.inputState.ensureHandlers(this.plugins),this.docView=new $i(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(e=document.fonts)||void 0===e?void 0:e.ready)&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...t){let e=1==t.length&&t[0]instanceof $t?t:1==t.length&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e,n=!1,i=!1,r=this.state;for(let e of t){if(e.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=e.state}if(this.destroyed)return void(this.viewState.state=r);let s=this.hasFocus,o=0,l=null;t.some(t=>t.annotation(Nr))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=Lr(r,s),l||(o=1));let a=this.observer.delayedAndroidKey,h=null;if(a?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(h=null)):this.observer.clear(),r.facet(te.phrases)!=this.state.facet(te.phrases))return this.setState(r);e=Wi.create(this,r,t),e.flags|=o;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let e of t){if(c&&(c=c.map(e.changes)),e.scrollIntoView){let{main:t}=e.state.selection;c=new Ai(t.empty?t:pt.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(Si)&&(c=t.value.clip(this.state))}this.viewState.update(e,c),this.bidiCache=Ps.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),n=this.docView.update(e),this.state.facet(zi)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(t=>t.isUserEvent("select.pointer")))}finally{this.updateState=0}if(e.startState.facet(ps)!=e.state.facet(ps)&&(this.viewState.mustMeasureContent=!0),(n||i||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!e.empty)for(let t of this.state.facet(gi))try{t(e)}catch(t){Ei(this.state,t,"update listener")}(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!cr(this,h)&&a.force&&Ge(this.contentDOM,a.key,a.keyCode)})}setState(t){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=t);this.updateState=2;let e=this.hasFocus;try{for(let t of this.plugins)t.destroy(this);this.viewState=new ls(t),this.plugins=t.facet(Mi).map(t=>new Pi(t)),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView.destroy(),this.docView=new $i(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Mi),n=t.state.facet(Mi);if(e!=n){let i=[];for(let r of n){let n=e.indexOf(r);if(n<0)i.push(new Pi(r));else{let e=this.plugins[n];e.mustUpdate=t,i.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let e of this.plugins)e.mustUpdate=t;for(let t=0;t<this.plugins.length;t++)this.plugins[t].update(this);e!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let e=t.value;if(e&&e.docViewUpdate)try{e.docViewUpdate(this)}catch(t){Ei(this.state,t,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,n=this.scrollDOM,i=n.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:s}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let t=0;;t++){if(s<0)if(Qe(n))r=-1,s=this.viewState.heightMap.height;else{let t=this.viewState.scrollAnchorAt(i);r=t.from,s=t.top}this.updateState=1;let o=this.viewState.measure(this);if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(t>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&o||([this.measureRequests,l]=[l,this.measureRequests]);let a=l.map(t=>{try{return t.read(this)}catch(t){return Ei(this.state,t),_s}}),h=Wi.create(this,this.state,[]),c=!1;h.flags|=o,e?e.flags|=o:e=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),c=this.docView.update(h),c&&this.docViewUpdate());for(let t=0;t<l.length;t++)if(a[t]!=_s)try{let e=l[t];e.write&&e.write(a[t],this)}catch(t){Ei(this.state,t)}if(c&&this.docView.updateSelection(!0),!h.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}{let t=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-s;if(t>1||t<-1){i+=t,n.scrollTop=i/this.scaleY,s=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(gi))t(e)}get themeClasses(){return ms+" "+(this.state.facet(gs)?bs:vs)+" "+this.state.facet(ps)}updateAttrs(){let t=Ds(this,Di,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Oi)?"true":"false",class:"cm-content",style:`${bn.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ds(this,Ri,e);let n=this.observer.ignore(()=>{let n=_n(this.contentDOM,this.contentAttrs,e),i=_n(this.dom,this.editorAttrs,t);return n||i});return this.editorAttrs=t,this.contentAttrs=e,n}showAnnouncements(t){let e=!0;for(let n of t)for(let t of n.effects)t.is(Ts.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value)}mountStyles(){this.styleModules=this.state.facet(zi);let t=this.state.facet(Ts.cspNonce);ke.mount(this.root,this.styleModules.concat(xs).reverse(),t?{nonce:t}: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(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(let e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===t.key)return void(this.measureRequests[e]=t);this.measureRequests.push(t)}}plugin(t){let e=this.pluginMap.get(t);return(void 0===e||e&&e.plugin!=t)&&this.pluginMap.set(t,e=this.plugins.find(e=>e.plugin==t)||null),e&&e.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(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,n){return rr(this,t,nr(this,t,e,n))}moveByGroup(t,e){return rr(this,t,nr(this,t,e,e=>function(t,e,n){let i=t.state.charCategorizer(e),r=i(n);return t=>{let e=i(t);return r==Jt.Space&&(r=e),r==e}}(this,t.head,e)))}visualLineSide(t,e){let n=this.bidiSpans(t),i=this.textDirectionAt(t.from),r=n[e?n.length-1:0];return pt.cursor(r.side(e,i)+t.from,r.forward(!e,i)?1:-1)}moveToLineBoundary(t,e,n=!0){return function(t,e,n,i){let r=function(t,e,n){let i=t.lineBlockAt(e);if(Array.isArray(i.type)){let t;for(let r of i.type){if(r.from>e)break;if(!(r.to<e)){if(r.from<e&&r.to>e)return r;t&&(r.type!=Rn.Text||t.type==r.type&&!(n<0?r.from<e:r.to>e))||(t=r)}}return t||i}return i}(t,e.head,e.assoc||-1),s=i&&r.type==Rn.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(s){let e=t.dom.getBoundingClientRect(),i=t.textDirectionAt(r.from),o=t.posAtCoords({x:n==(i==Un.LTR)?e.right-1:e.left+1,y:(s.top+s.bottom)/2});if(null!=o)return pt.cursor(o,n?-1:1)}return pt.cursor(n?r.to:r.from,n?-1:1)}(this,t,e,n)}moveVertically(t,e,n){return rr(this,t,function(t,e,n,i){let r=e.head,s=n?1:-1;if(r==(n?t.state.doc.length:0))return pt.cursor(r,e.assoc);let o,l=e.goalColumn,a=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(r,e.assoc||-1),c=t.documentTop;if(h)null==l&&(l=h.left-a.left),o=s<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(r);null==l&&(l=Math.min(a.right-a.left,t.defaultCharacterWidth*(r-e.from))),o=(s<0?e.top:e.bottom)+c}let u=a.left+l,d=null!=i?i:t.viewState.heightOracle.textHeight>>1;for(let e=0;;e+=10){let n=o+(d+e)*s,i=tr(t,{x:u,y:n},!1,s);if(n<a.top||n>a.bottom||(s<0?i<r:i>r)){let e=t.docView.coordsForChar(i),r=!e||n<e.top?-1:1;return pt.cursor(i,r,void 0,l)}}}(this,t,e,n))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),tr(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let n=this.docView.coordsAt(t,e);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(t),r=this.bidiSpans(i);return je(n,r[ni.find(r,t-i.from,-1,e)].dir==Un.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(wi)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Ms)return li(t.length);let e,n=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==n&&(i.fresh||ii(i.isolates,e=Fi(this,t))))return i.order;e||(e=Fi(this,t));let i=function(t,e,n){if(!t)return[new ni(0,0,e==Gn?1:0)];if(e==Kn&&!n.length&&!ei.test(t))return li(t.length);if(n.length)for(;t.length>ri.length;)ri[ri.length]=256;let i=[],r=e==Kn?0:1;return oi(t,r,r,n,0,t.length,i),i}(t.text,n,e);return this.bidiCache.push(new Ps(t.from,t.to,n,e,!0,i)),i}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||bn.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ue(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.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(t,e={}){return Si.of(new Ai("number"==typeof t?pt.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,n=this.viewState.scrollAnchorAt(t);return Si.of(new Ai(pt.cursor(n.from),"start","start",n.top-t,e,!0))}setTabFocusMode(t){null==t?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof t?this.inputState.tabFocusMode=t?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return _i.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return _i.define(()=>({}),{eventObservers:t})}static theme(t,e){let n=ke.newName(),i=[ps.of(n),zi.of(ws(`.${n}`,t))];return e&&e.dark&&i.push(gs.of(!0)),i}static baseTheme(t){return Et.lowest(zi.of(ws("."+ms,t,ys)))}static findFromDOM(t){var e;let n=t.querySelector(".cm-content"),i=n&&en.get(n)||en.get(t);return(null===(e=null==i?void 0:i.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=zi,Ts.inputHandler=mi,Ts.clipboardInputFilter=bi,Ts.clipboardOutputFilter=yi,Ts.scrollHandler=ki,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=wi,Ts.exceptionSink=pi,Ts.updateListener=gi,Ts.editable=Oi,Ts.mouseSelectionStyle=fi,Ts.dragMovesSelection=di,Ts.clickAddsSelectionRange=ui,Ts.decorations=Bi,Ts.outerDecorations=Ii,Ts.atomicRanges=Ni,Ts.bidiIsolatedRanges=Li,Ts.scrollMargins=Vi,Ts.darkTheme=gs,Ts.cspNonce=vt.define({combine:t=>t.length?t[0]:""}),Ts.contentAttributes=Ri,Ts.editorAttributes=Di,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=Wt.define();const Ms=4096,_s={};class Ps{constructor(t,e,n,i,r,s){this.from=t,this.to=e,this.dir=n,this.isolates=i,this.fresh=r,this.order=s}static update(t,e){if(e.empty&&!t.some(t=>t.fresh))return t;let n=[],i=t.length?t[t.length-1].dir:Un.LTR;for(let r=Math.max(0,t.length-10);r<t.length;r++){let s=t[r];s.dir!=i||e.touchesRange(s.from,s.to)||n.push(new Ps(e.mapPos(s.from,1),e.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return n}}function Ds(t,e,n){for(let i=t.state.facet(e),r=i.length-1;r>=0;r--){let e=i[r],s="function"==typeof e?e(t):e;s&&On(s,n)}return n}const Rs=bn.mac?"mac":bn.windows?"win":bn.linux?"linux":"key";function Bs(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}const Is=Et.default(Ts.domEventHandlers({keydown:(t,e)=>function(t,e,n,i){js=e;let r=function(t){var e=!(Oe&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Te&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Ee:Ce)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(e),s=nt(tt(r,0))==r.length&&" "!=r,o="",l=!1,a=!1,h=!1;Fs&&Fs.view==n&&Fs.scope==i&&(o=Fs.prefix+" ",vr.indexOf(e.keyCode)<0&&(a=!0,Fs=null));let c,u,d=new Set,f=t=>{if(t){for(let e of t.run)if(!d.has(e)&&(d.add(e),e(n)))return t.stopPropagation&&(h=!0),!0;t.preventDefault&&(t.stopPropagation&&(h=!0),a=!0)}return!1},p=t[i];return p&&(f(p[o+Bs(r,e,!s)])?l=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(bn.windows&&e.ctrlKey&&e.altKey)&&(c=Ce[e.keyCode])&&c!=r?(f(p[o+Bs(c,e,!0)])||e.shiftKey&&(u=Ee[e.keyCode])!=r&&u!=c&&f(p[o+Bs(u,e,!1)]))&&(l=!0):s&&e.shiftKey&&f(p[o+Bs(r,e,!0)])&&(l=!0),!l&&f(p._any)&&(l=!0)),a&&(l=!0),l&&h&&e.stopPropagation(),js=null,l}(function(t){let e=t.facet(Ns),n=Ls.get(e);return n||Ls.set(e,n=function(t,e=Rs){let n=Object.create(null),i=Object.create(null),r=(t,e)=>{let n=i[t];if(null==n)i[t]=e;else if(n!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},s=(t,i,s,o,l)=>{var a,h;let c=n[t]||(n[t]=Object.create(null)),u=i.split(/ (?!$)/).map(t=>function(t,e){const n=t.split(/-(?!$)/);let i,r,s,o,l=n[n.length-1];"Space"==l&&(l=" ");for(let t=0;t<n.length-1;++t){const l=n[t];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))i=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))s=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);"mac"==e?o=!0:r=!0}}return i&&(l="Alt-"+l),r&&(l="Ctrl-"+l),o&&(l="Meta-"+l),s&&(l="Shift-"+l),l}(t,e));for(let e=1;e<u.length;e++){let n=u.slice(0,e).join(" ");r(n,!0),c[n]||(c[n]={preventDefault:!0,stopPropagation:!1,run:[e=>{let i=Fs={view:e,prefix:n,scope:t};return setTimeout(()=>{Fs==i&&(Fs=null)},Vs),!0}]})}let d=u.join(" ");r(d,!1);let f=c[d]||(c[d]={preventDefault:!1,stopPropagation:!1,run:(null===(h=null===(a=c._any)||void 0===a?void 0:a.run)||void 0===h?void 0:h.slice())||[]});s&&f.run.push(s),o&&(f.preventDefault=!0),l&&(f.stopPropagation=!0)};for(let i of t){let t=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let e of t){let t=n[e]||(n[e]=Object.create(null));t._any||(t._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:r}=i;for(let e in t)t[e].run.push(t=>r(t,js))}let r=i[e]||i.key;if(r)for(let e of t)s(e,r,i.run,i.preventDefault,i.stopPropagation),i.shift&&s(e,"Shift-"+r,i.shift,i.preventDefault,i.stopPropagation)}return n}(e.reduce((t,e)=>t.concat(e),[]))),n}(e.state),t,e,"editor")})),Ns=vt.define({enables:Is}),Ls=new WeakMap;let Fs=null;const Vs=4e3;let js=null;class zs extends Dn{constructor(t){super(),this.content=t}toDOM(t){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(t):this.content.cloneNode(!0)),e.setAttribute("aria-hidden","true"),e}coordsAt(t){let e=t.firstChild?Be(t.firstChild):[];if(!e.length)return null;let n=window.getComputedStyle(t.parentNode),i=je(e[0],"rtl"!=n.direction),r=parseInt(n.lineHeight);return i.bottom-i.top>1.5*r?{left:i.left,right:i.right,top:i.top,bottom:i.top+r}:i}ignoreEvent(){return!1}}function Hs(t){let e=_i.fromClass(class{constructor(e){this.view=e,this.placeholder=t?Bn.set([Bn.widget({widget:new zs(t),side:1}).range(0)]):Bn.none}get decorations(){return this.view.state.doc.length?Bn.none:this.placeholder}},{decorations:t=>t.decorations});return"string"==typeof t?[e,Ts.contentAttributes.of({"aria-placeholder":t})]:e}const Ws="-10000px";class $s{constructor(t,e,n,i){this.facet=e,this.createTooltipView=n,this.removeTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter(t=>t);let r=null;this.tooltipViews=this.tooltips.map(t=>r=n(t,r))}update(t,e){var n;let i=t.state.facet(this.facet),r=i.filter(t=>t);if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[],o=e?[]:null;for(let n=0;n<r.length;n++){let i=r[n],l=-1;if(i){for(let t=0;t<this.tooltips.length;t++){let e=this.tooltips[t];e&&e.create==i.create&&(l=t)}if(l<0)s[n]=this.createTooltipView(i,n?s[n-1]:null),o&&(o[n]=!!i.above);else{let i=s[n]=this.tooltipViews[l];o&&(o[n]=e[l]),i.update&&i.update(t)}}}for(let t of this.tooltipViews)s.indexOf(t)<0&&(this.removeTooltipView(t),null===(n=t.destroy)||void 0===n||n.call(t));return e&&(o.forEach((t,n)=>e[n]=t),e.length=o.length),this.input=i,this.tooltips=r,this.tooltipViews=s,!0}}function qs(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Us=vt.define({combine:t=>{var e,n,i;return{position:bn.ios?"absolute":(null===(e=t.find(t=>t.position))||void 0===e?void 0:e.position)||"fixed",parent:(null===(n=t.find(t=>t.parent))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=t.find(t=>t.tooltipSpace))||void 0===i?void 0:i.tooltipSpace)||qs}}}),Ks=new WeakMap,Gs=_i.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Us);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new $s(t,Xs,(t,e)=>this.createTooltip(t,e),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.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 t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,i=t.state.facet(Us);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),i=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",n.dom.appendChild(t)}return n.dom.style.position=this.position,n.dom.style.top=Ws,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);this.parent&&this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:t}=this.manager.tooltipViews[0];if(bn.gecko)n=t.offsetParent!=this.container.ownerDocument.body;else if(t.style.top==Ws&&"0px"==t.style.left){let e=t.getBoundingClientRect();n=Math.abs(e.top+1e4)>1||Math.abs(e.left)>1}}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(t=n.width/this.parent.offsetWidth,e=n.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=ji(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((t,e)=>{let n=this.manager.tooltipViews[e];return n.getCoords?n.getCoords(t.pos):this.view.coordsAtPos(t.pos)}),size:this.manager.tooltipViews.map(({dom:t})=>t.getBoundingClientRect()),space:this.view.state.facet(Us).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let t of this.manager.tooltipViews)t.dom.style.position="absolute"}let{visible:n,space:i,scaleX:r,scaleY:s}=t,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],h=this.manager.tooltipViews[l],{dom:c}=h,u=t.pos[l],d=t.size[l];if(!u||!1!==a.clip&&(u.bottom<=Math.max(n.top,i.top)||u.top>=Math.min(n.bottom,i.bottom)||u.right<Math.max(n.left,i.left)-.1||u.left>Math.min(n.right,i.right)+.1)){c.style.top=Ws;continue}let f=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=d.right-d.left,m=null!==(e=Ks.get(h))&&void 0!==e?e:d.bottom-d.top,v=h.offset||Js,b=this.view.textDirection==Un.LTR,y=d.width>i.right-i.left?b?i.left:i.right-d.width:b?Math.max(i.left,Math.min(u.left-(f?14:0)+v.x,i.right-g)):Math.min(Math.max(i.left,u.left-g+(f?14:0)-v.x),i.right-g),w=this.above[l];!a.strictSide&&(w?u.top-m-p-v.y<i.top:u.bottom+m+p+v.y>i.bottom)&&w==i.bottom-u.bottom>u.top-i.top&&(w=this.above[l]=!w);let x=(w?u.top-i.top:i.bottom-u.bottom)-p;if(x<m&&!1!==h.resize){if(x<this.view.defaultLineHeight){c.style.top=Ws;continue}Ks.set(h,m),c.style.height=(m=x)/s+"px"}else c.style.height&&(c.style.height="");let k=w?u.top-m-p-v.y:u.bottom+p+v.y,A=y+g;if(!0!==h.overlap)for(let t of o)t.left<A&&t.right>y&&t.top<k+m&&t.bottom>k&&(k=w?t.top-m-2-p:t.bottom+p+2);if("absolute"==this.position?(c.style.top=(k-t.parent.top)/s+"px",Ys(c,(y-t.parent.left)/r)):(c.style.top=k/s+"px",Ys(c,y/r)),f){let t=u.left+(b?v.x:-v.x)-(y+14-7);f.style.left=t/r+"px"}!0!==h.overlap&&o.push({left:y,top:k,right:A,bottom:k+m}),c.classList.toggle("cm-tooltip-above",w),c.classList.toggle("cm-tooltip-below",!w),h.positioned&&h.positioned(t.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 t of this.manager.tooltipViews)t.dom.style.top=Ws}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Ys(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const Qs=Ts.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Js={x:0,y:0},Xs=vt.define({enables:[Gs,Qs]}),Zs=vt.define({combine:t=>t.reduce((t,e)=>t.concat(e),[])});class to{static create(t){return new to(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new $s(t,Zs,(t,e)=>this.createHostedView(t,e),t=>t.dom.remove())}createHostedView(t,e){let n=t.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)null===(t=e.destroy)||void 0===t||t.call(e)}passProp(t){let e;for(let n of this.manager.tooltipViews){let i=n[t];if(void 0!==i)if(void 0===e)e=i;else if(e!==i)return}return e}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 eo=Xs.compute([Zs],t=>{let e=t.facet(Zs);return 0===e.length?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var e;return null!==(e=t.end)&&void 0!==e?e:t.pos})),create:to.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class no{constructor(t,e,n,i,r){this.view=t,this.source=e,this.field=n,this.setHover=i,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:t,lastMove:e}=this,n=t.docView.nearest(e.target);if(!n)return;let i,r=1;if(n instanceof xn)i=n.posAtStart;else{if(i=t.posAtCoords(e),null==i)return;let n=t.coordsAtPos(i);if(!n||e.y<n.top||e.y>n.bottom||e.x<n.left-t.defaultCharacterWidth||e.x>n.right+t.defaultCharacterWidth)return;let s=t.bidiSpans(t.state.doc.lineAt(i)).find(t=>t.from<=i&&t.to>=i),o=s&&s.dir==Un.RTL?-1:1;r=e.x<n.left?-o:o}let s=this.source(t,i,r);if(null==s?void 0:s.then){let e=this.pending={pos:i};s.then(n=>{this.pending==e&&(this.pending=null,!n||Array.isArray(n)&&!n.length||t.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))},e=>Ei(t.state,e,"hover tooltip"))}else!s||Array.isArray(s)&&!s.length||t.dispatch({effects:this.setHover.of(Array.isArray(s)?s:[s])})}get tooltip(){let t=this.view.plugin(Gs),e=t?t.manager.tooltips.findIndex(t=>t.create==to.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,n;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:r}=this;if(i.length&&r&&!function(t,e){let n,{left:i,right:r,top:s,bottom:o}=t.getBoundingClientRect();if(n=t.querySelector(".cm-tooltip-arrow")){let t=n.getBoundingClientRect();s=Math.min(t.top,s),o=Math.max(t.bottom,o)}return e.clientX>=i-io&&e.clientX<=r+io&&e.clientY>=s-io&&e.clientY<=o+io}(r.dom,t)||this.pending){let{pos:r}=i[0]||this.pending,s=null!==(n=null===(e=i[0])||void 0===e?void 0:e.end)&&void 0!==n?n:r;(r==s?this.view.posAtCoords(this.lastMove)==r:function(t,e,n,i,r){let s=t.scrollDOM.getBoundingClientRect(),o=t.documentTop+t.documentPadding.top+t.contentHeight;if(s.left>i||s.right<i||s.top>r||Math.min(s.bottom,o)<r)return!1;let l=t.posAtCoords({x:i,y:r},!1);return l>=e&&l<=n}(this.view,r,s,t.clientX,t.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:e}=this;e&&e.dom.contains(t.relatedTarget)?this.watchTooltipLeave(e.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=n=>{t.removeEventListener("mouseleave",e),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",e)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const io=4;function ro(t,e={}){let n=Wt.define(),i=St.define({create:()=>[],update(t,i){if(t.length&&(e.hideOnChange&&(i.docChanged||i.selection)?t=[]:e.hideOn&&(t=t.filter(t=>!e.hideOn(i,t))),i.docChanged)){let e=[];for(let n of t){let t=i.changes.mapPos(n.pos,-1,rt.TrackDel);if(null!=t){let r=Object.assign(Object.create(null),n);r.pos=t,null!=r.end&&(r.end=i.changes.mapPos(r.end)),e.push(r)}}t=e}for(let e of i.effects)e.is(n)&&(t=e.value),e.is(oo)&&(t=[]);return t},provide:t=>Zs.from(t)});return{active:i,extension:[i,_i.define(r=>new no(r,t,i,n,e.hoverTime||300)),eo]}}function so(t,e){let n=t.plugin(Gs);if(!n)return null;let i=n.manager.tooltips.indexOf(e);return i<0?null:n.manager.tooltipViews[i]}const oo=Wt.define(),lo=vt.define({combine(t){let e,n;for(let i of t)e=e||i.topContainer,n=n||i.bottomContainer;return{topContainer:e,bottomContainer:n}}}),ao=_i.fromClass(class{constructor(t){this.input=t.state.facet(uo),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(e=>e(t));let e=t.state.facet(lo);this.top=new ho(t,!0,e.topContainer),this.bottom=new ho(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(t){let e=t.state.facet(lo);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new ho(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new ho(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(uo);if(n!=this.input){let e=n.filter(t=>t),i=[],r=[],s=[],o=[];for(let n of e){let e,l=this.specs.indexOf(n);l<0?(e=n(t.view),o.push(e)):(e=this.panels[l],e.update&&e.update(t)),i.push(e),(e.top?r:s).push(e)}this.specs=e,this.panels=i,this.top.sync(r),this.bottom.sync(s);for(let t of o)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}else for(let e of this.panels)e.update&&e.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Ts.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class ho{constructor(t,e,n){this.view=t,this.top=e,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,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 t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=co(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=co(t)}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 t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function co(t){let e=t.nextSibling;return t.remove(),e}const uo=vt.define({enables:ao});class fo extends ne{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}fo.prototype.elementClass="",fo.prototype.toDOM=void 0,fo.prototype.mapMode=rt.TrackBefore,fo.prototype.startSide=fo.prototype.endSide=-1,fo.prototype.point=!0;const po=1024;let go=0;class mo{constructor(t,e){this.from=t,this.to=e}}class vo{constructor(t={}){this.id=go++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=wo.match(t)),e=>{let n=t(e);return void 0===n?null:[this,n]}}}vo.closedBy=new vo({deserialize:t=>t.split(" ")}),vo.openedBy=new vo({deserialize:t=>t.split(" ")}),vo.group=new vo({deserialize:t=>t.split(" ")}),vo.isolate=new vo({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),vo.contextHash=new vo({perNode:!0}),vo.lookAhead=new vo({perNode:!0}),vo.mounted=new vo({perNode:!0});class bo{constructor(t,e,n){this.tree=t,this.overlay=e,this.parser=n}static get(t){return t&&t.props&&t.props[vo.mounted.id]}}const yo=Object.create(null);class wo{constructor(t,e,n,i=0){this.name=t,this.props=e,this.id=n,this.flags=i}static define(t){let e=t.props&&t.props.length?Object.create(null):yo,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),i=new wo(t.name||"",e,t.id,n);if(t.props)for(let n of t.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[n[0].id]=n[1]}return i}prop(t){return this.props[t.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(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(vo.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let n in t)for(let i of n.split(" "))e[i]=t[n];return t=>{for(let n=t.prop(vo.group),i=-1;i<(n?n.length:0);i++){let r=e[i<0?t.name:n[i]];if(r)return r}}}}wo.none=new wo("",Object.create(null),0,8);class xo{constructor(t){this.types=t;for(let e=0;e<t.length;e++)if(t[e].id!=e)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let e=[];for(let n of this.types){let i=null;for(let e of t){let t=e(n);t&&(i||(i=Object.assign({},n.props)),i[t[0].id]=t[1])}e.push(i?new wo(n.name,i,n.id,n.flags):n)}return new xo(e)}}const ko=new WeakMap,Ao=new WeakMap;var So;!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(So||(So={}));class Co{constructor(t,e,n,i,r){if(this.type=t,this.children=e,this.positions=n,this.length=i,this.props=null,r&&r.length){this.props=Object.create(null);for(let[t,e]of r)this.props["number"==typeof t?t:t.id]=e}}toString(){let t=bo.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let t of this.children){let n=t.toString();n&&(e&&(e+=","),e+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e}cursor(t=0){return new Fo(this.topNode,t)}cursorAt(t,e=0,n=0){let i=ko.get(this)||this.topNode,r=new Fo(i);return r.moveTo(t,e),ko.set(this,r._tree),r}get topNode(){return new Po(this,0,0,null)}resolve(t,e=0){let n=Mo(ko.get(this)||this.topNode,t,e,!1);return ko.set(this,n),n}resolveInner(t,e=0){let n=Mo(Ao.get(this)||this.topNode,t,e,!0);return Ao.set(this,n),n}resolveStack(t,e=0){return function(t,e,n){let i=t.resolveInner(e,n),r=null;for(let t=i instanceof Po?i:i.context.parent;t;t=t.parent)if(t.index<0){let s=t.parent;(r||(r=[i])).push(s.resolve(e,n)),t=s}else{let s=bo.get(t.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let o=new Po(s.tree,s.overlay[0].from+t.from,-1,t);(r||(r=[i])).push(Mo(o,e,n,!1))}}return r?No(r):i}(this,t,e)}iterate(t){let{enter:e,leave:n,from:i=0,to:r=this.length}=t,s=t.mode||0,o=(s&So.IncludeAnonymous)>0;for(let t=this.cursor(s|So.IncludeAnonymous);;){let s=!1;if(t.from<=r&&t.to>=i&&(!o&&t.type.isAnonymous||!1!==e(t))){if(t.firstChild())continue;s=!0}for(;s&&n&&(o||!t.type.isAnonymous)&&n(t),!t.nextSibling();){if(!t.parent())return;s=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Ho(wo.none,this.children,this.positions,0,this.children.length,0,this.length,(t,e,n)=>new Co(this.type,t,e,n,this.propValues),t.makeTree||((t,e,n)=>new Co(wo.none,t,e,n)))}static build(t){return function(t){var e;let{buffer:n,nodeSet:i,maxBufferLength:r=po,reused:s=[],minRepeatType:o=i.types.length}=t,l=Array.isArray(n)?new Eo(n,n.length):n,a=i.types,h=0,c=0;function u(t,e,n,m,v,b){let{id:y,start:w,end:x,size:k}=l,A=c,S=h;for(;k<0;){if(l.next(),-1==k){let e=s[y];return n.push(e),void m.push(w-t)}if(-3==k)return void(h=y);if(-4==k)return void(c=y);throw new RangeError(`Unrecognized record size: ${k}`)}let C,E,O=a[y],T=w-t;if(x-w<=r&&(E=function(t,e){let n=l.fork(),i=0,s=0,a=0,h=n.end-r,c={size:0,start:0,skip:0};t:for(let r=n.pos-t;n.pos>r;){let t=n.size;if(n.id==e&&t>=0){c.size=i,c.start=s,c.skip=a,a+=4,i+=4,n.next();continue}let l=n.pos-t;if(t<0||l<r||n.start<h)break;let u=n.id>=o?4:0,d=n.start;for(n.next();n.pos>l;){if(n.size<0){if(-3!=n.size)break t;u+=4}else n.id>=o&&(u+=4);n.next()}s=d,i+=t,a+=u}return(e<0||i==t)&&(c.size=i,c.start=s,c.skip=a),c.size>4?c:void 0}(l.pos-e,v))){let e=new Uint16Array(E.size-E.skip),n=l.pos-E.size,r=e.length;for(;l.pos>n;)r=g(E.start,e,r);C=new Oo(e,x-E.start,i),T=E.start-t}else{let t=l.pos-k;l.next();let e=[],n=[],i=y>=o?y:-1,s=0,a=x;for(;l.pos>t;)i>=0&&l.id==i&&l.size>=0?(l.end<=a-r&&(f(e,n,w,s,l.end,a,i,A,S),s=e.length,a=l.end),l.next()):b>2500?d(w,t,e,n):u(w,t,e,n,i,b+1);if(i>=0&&s>0&&s<e.length&&f(e,n,w,s,w,a,i,A,S),e.reverse(),n.reverse(),i>-1&&s>0){let t=function(t,e){return(n,i,r)=>{let s,o,l=0,a=n.length-1;if(a>=0&&(s=n[a])instanceof Co){if(!a&&s.type==t&&s.length==r)return s;(o=s.prop(vo.lookAhead))&&(l=i[a]+s.length+o)}return p(t,n,i,r,l,e)}}(O,S);C=Ho(O,e,n,0,e.length,0,x-w,t,t)}else C=p(O,e,n,x-w,A-x,S)}n.push(C),m.push(T)}function d(t,e,n,s){let o=[],a=0,h=-1;for(;l.pos>e;){let{id:t,start:e,end:n,size:i}=l;if(i>4)l.next();else{if(h>-1&&e<h)break;h<0&&(h=n-r),o.push(t,e,n),a++,l.next()}}if(a){let e=new Uint16Array(4*a),r=o[o.length-2];for(let t=o.length-3,n=0;t>=0;t-=3)e[n++]=o[t],e[n++]=o[t+1]-r,e[n++]=o[t+2]-r,e[n++]=n;n.push(new Oo(e,o[2]-r,i)),s.push(r-t)}}function f(t,e,n,r,s,o,l,a,h){let c=[],u=[];for(;t.length>r;)c.push(t.pop()),u.push(e.pop()+n-s);t.push(p(i.types[l],c,u,o-s,a-o,h)),e.push(s-n)}function p(t,e,n,i,r,s,o){if(s){let t=[vo.contextHash,s];o=o?[t].concat(o):[t]}if(r>25){let t=[vo.lookAhead,r];o=o?[t].concat(o):[t]}return new Co(t,e,n,i,o)}function g(t,e,n){let{id:i,start:r,end:s,size:a}=l;if(l.next(),a>=0&&i<o){let o=n;if(a>4){let i=l.pos-(a-4);for(;l.pos>i;)n=g(t,e,n)}e[--n]=o,e[--n]=s-t,e[--n]=r-t,e[--n]=i}else-3==a?h=i:-4==a&&(c=i);return n}let m=[],v=[];for(;l.pos>0;)u(t.start||0,t.bufferStart||0,m,v,-1,0);let b=null!==(e=t.length)&&void 0!==e?e:m.length?v[0]+m[0].length:0;return new Co(a[t.topID],m.reverse(),v.reverse(),b)}(t)}}Co.empty=new Co(wo.none,[],[],0);class Eo{constructor(t,e){this.buffer=t,this.index=e}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 Eo(this.buffer,this.index)}}class Oo{constructor(t,e,n){this.buffer=t,this.length=e,this.set=n}get type(){return wo.none}toString(){let t=[];for(let e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}childString(t){let e=this.buffer[t],n=this.buffer[t+3],i=this.set.types[e],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),n==(t+=4))return r;let s=[];for(;t<n;)s.push(this.childString(t)),t=this.buffer[t+3];return r+"("+s.join(",")+")"}findChild(t,e,n,i,r){let{buffer:s}=this,o=-1;for(let l=t;l!=e&&!(To(r,i,s[l+1],s[l+2])&&(o=l,n>0));l=s[l+3]);return o}slice(t,e,n){let i=this.buffer,r=new Uint16Array(e-t),s=0;for(let o=t,l=0;o<e;){r[l++]=i[o++],r[l++]=i[o++]-n;let e=r[l++]=i[o++]-n;r[l++]=i[o++]-t,s=Math.max(s,e)}return new Oo(r,s,this.set)}}function To(t,e,n,i){switch(t){case-2:return n<e;case-1:return i>=e&&n<e;case 0:return n<e&&i>e;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function Mo(t,e,n,i){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let e=!i&&t instanceof Po&&t.index<0?null:t.parent;if(!e)return t;t=e}let s=i?0:So.IgnoreOverlays;if(i)for(let i=t,o=i.parent;o;i=o,o=i.parent)i instanceof Po&&i.index<0&&(null===(r=o.enter(e,n,s))||void 0===r?void 0:r.from)!=i.from&&(t=o);for(;;){let i=t.enter(e,n,s);if(!i)return t;t=i}}class _o{cursor(t=0){return new Fo(this,t)}getChild(t,e=null,n=null){let i=Do(this,t,e,n);return i.length?i[0]:null}getChildren(t,e=null,n=null){return Do(this,t,e,n)}resolve(t,e=0){return Mo(this,t,e,!1)}resolveInner(t,e=0){return Mo(this,t,e,!0)}matchContext(t){return Ro(this.parent,t)}enterUnfinishedNodesBefore(t){let e=this.childBefore(t),n=this;for(;e;){let t=e.lastChild;if(!t||t.to!=e.to)break;t.type.isError&&t.from==t.to?(n=e,e=t.prevSibling):e=t}return n}get node(){return this}get next(){return this.parent}}class Po extends _o{constructor(t,e,n,i){super(),this._tree=t,this.from=e,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,e,n,i,r=0){for(let s=this;;){for(let{children:o,positions:l}=s._tree,a=e>0?o.length:-1;t!=a;t+=e){let a=o[t],h=l[t]+s.from;if(To(i,n,h,h+a.length))if(a instanceof Oo){if(r&So.ExcludeBuffers)continue;let o=a.findChild(0,a.buffer.length,e,n-h,i);if(o>-1)return new Io(new Bo(s,a,t,h),null,o)}else if(r&So.IncludeAnonymous||!a.type.isAnonymous||Vo(a)){let o;if(!(r&So.IgnoreMounts)&&(o=bo.get(a))&&!o.overlay)return new Po(o.tree,h,t,s);let l=new Po(a,h,t,s);return r&So.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(e<0?a.children.length-1:0,e,n,i)}}if(r&So.IncludeAnonymous||!s.type.isAnonymous)return null;if(t=s.index>=0?s.index+e:e<0?-1:s._parent._tree.children.length,s=s._parent,!s)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(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,n=0){let i;if(!(n&So.IgnoreOverlays)&&(i=bo.get(this._tree))&&i.overlay){let n=t-this.from;for(let{from:t,to:r}of i.overlay)if((e>0?t<=n:t<n)&&(e<0?r>=n:r>n))return new Po(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}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 Do(t,e,n,i){let r=t.cursor(),s=[];if(!r.firstChild())return s;if(null!=n)for(let t=!1;!t;)if(t=r.type.is(n),!r.nextSibling())return s;for(;;){if(null!=i&&r.type.is(i))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return null==i?s:[]}}function Ro(t,e,n=e.length-1){for(let i=t;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}class Bo{constructor(t,e,n,i){this.parent=t,this.buffer=e,this.index=n,this.start=i}}class Io extends _o{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(t,e,n){super(),this.context=t,this._parent=e,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}child(t,e,n){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.context.start,n);return r<0?null:new Io(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,n=0){if(n&So.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new Io(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Io(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new Io(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:n}=this.context,i=this.index+4,r=n.buffer[this.index+3];if(r>i){let s=n.buffer[this.index+1];t.push(n.slice(i,r,s)),e.push(0)}return new Co(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function No(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;i<t.length;i++){let r=t[i];(r.from>n.from||r.to<n.to)&&(n=r,e=i)}let i=n instanceof Po&&n.index<0?null:n.parent,r=t.slice();return i?r[e]=i:r.splice(e,1),new Lo(r,n)}class Lo{constructor(t,e){this.heads=t,this.node=e}get next(){return No(this.heads)}}class Fo{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Po)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:n,buffer:i}=this.buffer;return this.type=e||i.set.types[i.buffer[t]],this.from=n+i.buffer[t+1],this.to=n+i.buffer[t+2],!0}yield(t){return!!t&&(t instanceof Po?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,n,this.mode));let{buffer:i}=this.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.buffer.start,n);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,n=this.mode){return this.buffer?!(n&So.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&So.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&So.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,n=this.stack.length-1;if(t<0){let t=n<0?0:this.stack[n]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(n<0?e.buffer.length:e.buffer[this.stack[n]+3]))return this.yieldBuf(t)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,n,{buffer:i}=this;if(i){if(t>0){if(this.index<i.buffer.buffer.length)return!1}else for(let t=0;t<this.index;t++)if(i.buffer.buffer[t+3]<this.index)return!1;({index:e,parent:n}=i)}else({index:e,_parent:n}=this._tree);for(;n;({index:e,_parent:n}=n))if(e>-1)for(let i=e+t,r=t<0?-1:n._tree.children.length;i!=r;i+=t){let t=n._tree.children[i];if(this.mode&So.IncludeAnonymous||t instanceof Oo||!t.type.isAnonymous||Vo(t))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,e=null,n=0;if(t&&t.context==this.buffer)t:for(let i=this.index,r=this.stack.length;r>=0;){for(let s=t;s;s=s._parent)if(s.index==i){if(i==this.index)return s;e=s,n=r+1;break t}i=this.stack[--r]}for(let t=n;t<this.stack.length;t++)e=new Io(this.buffer,e,this.stack[t]);return this.bufferNode=new Io(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,e){for(let n=0;;){let i=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&e&&e(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(t){if(!this.buffer)return Ro(this.node.parent,t);let{buffer:e}=this.buffer,{types:n}=e.set;for(let i=t.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return Ro(this._tree,t,i);let s=n[e.buffer[this.stack[r]]];if(!s.isAnonymous){if(t[i]&&t[i]!=s.name)return!1;i--}}return!0}}function Vo(t){return t.children.some(t=>t instanceof Oo||!t.type.isAnonymous||Vo(t))}const jo=new WeakMap;function zo(t,e){if(!t.isAnonymous||e instanceof Oo||e.type!=t)return 1;let n=jo.get(e);if(null==n){n=1;for(let i of e.children){if(i.type!=t||!(i instanceof Co)){n=1;break}n+=zo(t,i)}jo.set(e,n)}return n}function Ho(t,e,n,i,r,s,o,l,a){let h=0;for(let n=i;n<r;n++)h+=zo(t,e[n]);let c=Math.ceil(1.5*h/8),u=[],d=[];return function e(n,i,r,o,l){for(let h=r;h<o;){let r=h,f=i[h],p=zo(t,n[h]);for(h++;h<o;h++){let e=zo(t,n[h]);if(p+e>=c)break;p+=e}if(h==r+1){if(p>c){let t=n[r];e(t.children,t.positions,0,t.children.length,i[r]+l);continue}u.push(n[r])}else{let e=i[h-1]+n[h-1].length-f;u.push(Ho(t,n,i,r,h,f,e,null,a))}d.push(f+l-s)}}(e,n,i,r,0),(l||a)(u,d,o)}class Wo{constructor(t,e,n,i,r=!1,s=!1){this.from=t,this.to=e,this.tree=n,this.offset=i,this.open=(r?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(t,e=[],n=!1){let i=[new Wo(0,t.length,t,0,!1,n)];for(let n of e)n.to>t.length&&i.push(n);return i}static applyChanges(t,e,n=128){if(!e.length)return t;let i=[],r=1,s=t.length?t[0]:null;for(let o=0,l=0,a=0;;o++){let h=o<e.length?e[o]:null,c=h?h.fromA:1e9;if(c-l>=n)for(;s&&s.from<c;){let e=s;if(l>=e.from||c<=e.to||a){let t=Math.max(e.from,l)-a,n=Math.min(e.to,c)-a;e=t>=n?null:new Wo(t,n,e.tree,e.offset+a,o>0,!!h)}if(e&&i.push(e),s.to>c)break;s=r<t.length?t[r++]:null}if(!h)break;l=h.toA,a=h.toA-h.toB}return i}}class $o{startParse(t,e,n){return"string"==typeof t&&(t=new qo(t)),n=n?n.length?n.map(t=>new mo(t.from,t.to)):[new mo(0,0)]:[new mo(0,t.length)],this.createParse(t,e||[],n)}parse(t,e,n){let i=this.startParse(t,e,n);for(;;){let t=i.advance();if(t)return t}}}class qo{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new vo({perNode:!0});let Uo=0;class Ko{constructor(t,e,n,i){this.name=t,this.set=e,this.base=n,this.modified=i,this.id=Uo++}toString(){let{name:t}=this;for(let e of this.modified)e.name&&(t=`${e.name}(${t})`);return t}static define(t,e){let n="string"==typeof t?t:"?";if(t instanceof Ko&&(e=t),null==e?void 0:e.base)throw new Error("Can not derive from a modified tag");let i=new Ko(n,[],null,[]);if(i.set.push(i),e)for(let t of e.set)i.set.push(t);return i}static defineModifier(t){let e=new Yo(t);return t=>t.modified.indexOf(e)>-1?t:Yo.get(t.base||t,t.modified.concat(e).sort((t,e)=>t.id-e.id))}}let Go=0;class Yo{constructor(t){this.name=t,this.instances=[],this.id=Go++}static get(t,e){if(!e.length)return t;let n=e[0].instances.find(n=>{return n.base==t&&(i=e,r=n.modified,i.length==r.length&&i.every((t,e)=>t==r[e]));var i,r});if(n)return n;let i=[],r=new Ko(t.name,i,t,e);for(let t of e)t.instances.push(r);let s=function(t){let e=[[]];for(let n=0;n<t.length;n++)for(let i=0,r=e.length;i<r;i++)e.push(e[i].concat(t[n]));return e.sort((t,e)=>e.length-t.length)}(e);for(let e of t.set)if(!e.modified.length)for(let t of s)i.push(Yo.get(e,t));return r}}function Qo(t){let e=Object.create(null);for(let n in t){let i=t[n];Array.isArray(i)||(i=[i]);for(let t of n.split(" "))if(t){let n=[],r=2,s=t;for(let e=0;;){if("..."==s&&e>0&&e+3==t.length){r=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!i)throw new RangeError("Invalid path: "+t);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),e+=i[0].length,e==t.length)break;let o=t[e++];if(e==t.length&&"!"==o){r=0;break}if("/"!=o)throw new RangeError("Invalid path: "+t);s=t.slice(e)}let o=n.length-1,l=n[o];if(!l)throw new RangeError("Invalid path: "+t);let a=new Xo(i,r,o>0?n.slice(0,o):null);e[l]=a.sort(e[l])}}return Jo.add(e)}const Jo=new vo;class Xo{constructor(t,e,n,i){this.tags=t,this.mode=e,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}}function Zo(t,e){let n=Object.create(null);for(let e of t)if(Array.isArray(e.tag))for(let t of e.tag)n[t.id]=e.class;else n[e.tag.id]=e.class;let{scope:i,all:r=null}=e||{};return{style:t=>{let e=r;for(let i of t)for(let t of i.set){let i=n[t.id];if(i){e=e?e+" "+i:i;break}}return e},scope:i}}function tl(t,e,n,i=0,r=t.length){let s=new el(i,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),i,r,"",s.highlighters),s.flush(r)}Xo.empty=new Xo([],2,null);class el{constructor(t,e,n){this.at=t,this.highlighters=e,this.span=n,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,n,i,r){let{type:s,from:o,to:l}=t;if(o>=n||l<=e)return;s.isTop&&(r=this.highlighters.filter(t=>!t.scope||t.scope(s)));let a=i,h=function(t){let e=t.type.prop(Jo);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||Xo.empty,c=function(t,e){let n=null;for(let i of t){let t=i.style(e);t&&(n=n?n+" "+t:t)}return n}(r,h.tags);if(c&&(a&&(a+=" "),a+=c,1==h.mode&&(i+=(i?" ":"")+c)),this.startSpan(Math.max(e,o),a),h.opaque)return;let u=t.tree&&t.tree.prop(vo.mounted);if(u&&u.overlay){let s=t.node.enter(u.overlay[0].from+o,1),h=this.highlighters.filter(t=>!t.scope||t.scope(u.tree.type)),c=t.firstChild();for(let d=0,f=o;;d++){let p=d<u.overlay.length?u.overlay[d]:null,g=p?p.from+o:l,m=Math.max(e,f),v=Math.min(n,g);if(m<v&&c)for(;t.from<v&&(this.highlightRange(t,m,v,i,r),this.startSpan(Math.min(v,t.to),a),!(t.to>=g)&&t.nextSibling()););if(!p||g>n)break;f=p.to+o,f>e&&(this.highlightRange(s.cursor(),Math.max(e,p.from+o),Math.min(n,f),"",h),this.startSpan(Math.min(n,f),a))}c&&t.parent()}else if(t.firstChild()){u&&(i="");do{if(!(t.to<=e)){if(t.from>=n)break;this.highlightRange(t,e,n,i,r),this.startSpan(Math.min(n,t.to),a)}}while(t.nextSibling());t.parent()}}}const nl=Ko.define,il=nl(),rl=nl(),sl=nl(rl),ol=nl(rl),ll=nl(),al=nl(ll),hl=nl(ll),cl=nl(),ul=nl(cl),dl=nl(),fl=nl(),pl=nl(),gl=nl(pl),ml=nl(),vl={comment:il,lineComment:nl(il),blockComment:nl(il),docComment:nl(il),name:rl,variableName:nl(rl),typeName:sl,tagName:nl(sl),propertyName:ol,attributeName:nl(ol),className:nl(rl),labelName:nl(rl),namespace:nl(rl),macroName:nl(rl),literal:ll,string:al,docString:nl(al),character:nl(al),attributeValue:nl(al),number:hl,integer:nl(hl),float:nl(hl),bool:nl(ll),regexp:nl(ll),escape:nl(ll),color:nl(ll),url:nl(ll),keyword:dl,self:nl(dl),null:nl(dl),atom:nl(dl),unit:nl(dl),modifier:nl(dl),operatorKeyword:nl(dl),controlKeyword:nl(dl),definitionKeyword:nl(dl),moduleKeyword:nl(dl),operator:fl,derefOperator:nl(fl),arithmeticOperator:nl(fl),logicOperator:nl(fl),bitwiseOperator:nl(fl),compareOperator:nl(fl),updateOperator:nl(fl),definitionOperator:nl(fl),typeOperator:nl(fl),controlOperator:nl(fl),punctuation:pl,separator:nl(pl),bracket:gl,angleBracket:nl(gl),squareBracket:nl(gl),paren:nl(gl),brace:nl(gl),content:cl,heading:ul,heading1:nl(ul),heading2:nl(ul),heading3:nl(ul),heading4:nl(ul),heading5:nl(ul),heading6:nl(ul),contentSeparator:nl(cl),list:nl(cl),quote:nl(cl),emphasis:nl(cl),strong:nl(cl),link:nl(cl),monospace:nl(cl),strikethrough:nl(cl),inserted:nl(),deleted:nl(),changed:nl(),invalid:nl(),meta:ml,documentMeta:nl(ml),annotation:nl(ml),processingInstruction:nl(ml),definition:Ko.defineModifier("definition"),constant:Ko.defineModifier("constant"),function:Ko.defineModifier("function"),standard:Ko.defineModifier("standard"),local:Ko.defineModifier("local"),special:Ko.defineModifier("special")};for(let t in vl){let e=vl[t];e instanceof Ko&&(e.name=t)}var bl;Zo([{tag:vl.link,class:"tok-link"},{tag:vl.heading,class:"tok-heading"},{tag:vl.emphasis,class:"tok-emphasis"},{tag:vl.strong,class:"tok-strong"},{tag:vl.keyword,class:"tok-keyword"},{tag:vl.atom,class:"tok-atom"},{tag:vl.bool,class:"tok-bool"},{tag:vl.url,class:"tok-url"},{tag:vl.labelName,class:"tok-labelName"},{tag:vl.inserted,class:"tok-inserted"},{tag:vl.deleted,class:"tok-deleted"},{tag:vl.literal,class:"tok-literal"},{tag:vl.string,class:"tok-string"},{tag:vl.number,class:"tok-number"},{tag:[vl.regexp,vl.escape,vl.special(vl.string)],class:"tok-string2"},{tag:vl.variableName,class:"tok-variableName"},{tag:vl.local(vl.variableName),class:"tok-variableName tok-local"},{tag:vl.definition(vl.variableName),class:"tok-variableName tok-definition"},{tag:vl.special(vl.variableName),class:"tok-variableName2"},{tag:vl.definition(vl.propertyName),class:"tok-propertyName tok-definition"},{tag:vl.typeName,class:"tok-typeName"},{tag:vl.namespace,class:"tok-namespace"},{tag:vl.className,class:"tok-className"},{tag:vl.macroName,class:"tok-macroName"},{tag:vl.propertyName,class:"tok-propertyName"},{tag:vl.operator,class:"tok-operator"},{tag:vl.comment,class:"tok-comment"},{tag:vl.meta,class:"tok-meta"},{tag:vl.invalid,class:"tok-invalid"},{tag:vl.punctuation,class:"tok-punctuation"}]);const yl=new vo;const wl=new vo;class xl{constructor(t,e,n=[],i=""){this.data=t,this.name=i,te.prototype.hasOwnProperty("tree")||Object.defineProperty(te.prototype,"tree",{get(){return Sl(this)}}),this.parser=e,this.extension=[Rl.of(this),te.languageData.of((t,e,n)=>{let i=kl(t,e,n),r=i.type.prop(yl);if(!r)return[];let s=t.facet(r),o=i.type.prop(wl);if(o){let r=i.resolve(e-i.from,n);for(let e of o)if(e.test(r,t)){let n=t.facet(e.facet);return"replace"==e.type?n:n.concat(s)}}return s})].concat(n)}isActiveAt(t,e,n=-1){return kl(t,e,n).type.prop(yl)==this.data}findRegions(t){let e=t.facet(Rl);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let n=[],i=(t,e)=>{if(t.prop(yl)==this.data)return void n.push({from:e,to:e+t.length});let r=t.prop(vo.mounted);if(r){if(r.tree.prop(yl)==this.data){if(r.overlay)for(let t of r.overlay)n.push({from:t.from+e,to:t.to+e});else n.push({from:e,to:e+t.length});return}if(r.overlay){let t=n.length;if(i(r.tree,r.overlay[0].from+e),n.length>t)return}}for(let n=0;n<t.children.length;n++){let r=t.children[n];r instanceof Co&&i(r,t.positions[n]+e)}};return i(Sl(t),0),n}get allowsNesting(){return!0}}function kl(t,e,n){let i=t.facet(Rl),r=Sl(t).topNode;if(!i||i.allowsNesting)for(let t=r;t;t=t.enter(e,n,So.ExcludeBuffers))t.type.isTop&&(r=t);return r}xl.setState=Wt.define();class Al extends xl{constructor(t,e,n){super(t,e,[],n),this.parser=e}static define(t){let e=(n=t.languageData,vt.define({combine:n?t=>t.concat(n):void 0}));var n;return new Al(e,t.parser.configure({props:[yl.add(t=>t.isTop?e:void 0)]}),t.name)}configure(t,e){return new Al(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Sl(t){let e=t.field(xl.state,!1);return e?e.tree:Co.empty}class Cl{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let n=this.cursorPos-this.string.length;return t<n||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-n,e-n)}}let El=null;class Ol{constructor(t,e,n=[],i,r,s,o,l){this.parser=t,this.state=e,this.fragments=n,this.tree=i,this.treeLen=r,this.viewport=s,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,e,n){return new Ol(t,e,[],Co.empty,0,n,[],null)}startParse(){return this.parser.startParse(new Cl(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=Co.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof t){let e=Date.now()+t;t=()=>Date.now()>e}for(this.parse||(this.parse=this.startParse()),null!=e&&(null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&e<this.state.doc.length&&this.parse.stopAt(e);;){let i=this.parse.advance();if(i){if(this.fragments=this.withoutTempSkipped(Wo.addTree(i,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=i,this.parse=null,!(this.treeLen<(null!=e?e:this.state.doc.length)))return!0;this.parse=this.startParse()}if(t())return!1}})}takeTree(){let t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(Wo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=El;El=this;try{return t()}finally{El=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Tl(t,e.from,e.to);return t}changes(t,e){let{fragments:n,tree:i,treeLen:r,viewport:s,skipped:o}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,i,r)=>e.push({fromA:t,toA:n,fromB:i,toB:r})),n=Wo.applyChanges(n,e),i=Co.empty,r=0,s={from:t.mapPos(s.from,-1),to:t.mapPos(s.to,1)},this.skipped.length){o=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);n<i&&o.push({from:n,to:i})}}}return new Ol(this.parser,e,n,i,r,s,o,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let e=this.skipped.length;for(let e=0;e<this.skipped.length;e++){let{from:n,to:i}=this.skipped[e];n<t.to&&i>t.from&&(this.fragments=Tl(this.fragments,n,i),this.skipped.splice(e--,1))}return!(this.skipped.length>=e||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends $o{createParse(e,n,i){let r=i[0].from,s=i[i.length-1].to;return{parsedPos:r,advance(){let e=El;if(e){for(let t of i)e.tempSkipped.push(t);t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=s,new Co(wo.none,[],[],s-r)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}static get(){return El}}function Tl(t,e,n){return Wo.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Ml{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,n)||e.takeTree(),new Ml(e)}static init(t){let e=Math.min(3e3,t.doc.length),n=Ol.create(t.facet(Rl).parser,t,{from:0,to:e});return n.work(20,e)||n.takeTree(),new Ml(n)}}xl.state=St.define({create:Ml.init,update(t,e){for(let t of e.effects)if(t.is(xl.setState))return t.value;return e.startState.facet(Rl)!=e.state.facet(Rl)?Ml.init(e.state):t.apply(e)}});let _l=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(_l=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Pl="undefined"!=typeof navigator&&(null===(bl=navigator.scheduling)||void 0===bl?void 0:bl.isInputPending)?()=>navigator.scheduling.isInputPending():null,Dl=_i.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(xl.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(xl.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=_l(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,r=n.field(xl.state);if(r.tree==r.context.tree&&r.context.isDone(i+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,t&&!Pl?Math.max(25,t.timeRemaining()-5):1e9),o=r.context.treeLen<i&&n.doc.length>i+1e3,l=r.context.work(()=>Pl&&Pl()||Date.now()>s,i+(o?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:xl.setState.of(new Ml(r.context))})),this.chunkBudget>0&&(!l||o)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ei(this.view.state,t)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Rl=vt.define({combine:t=>t.length?t[0]:null,enables:t=>[xl.state,Dl,Ts.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class Bl{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const Il=vt.define(),Nl=vt.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Ll(t){let e=t.facet(Nl);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Fl(t,e){let n="",i=t.tabSize,r=t.facet(Nl)[0];if("\t"==r){for(;e>=i;)n+="\t",e-=i;r=" "}for(let t=0;t<e;t++)n+=r;return n}function Vl(t,e){t instanceof te&&(t=new jl(t));for(let n of t.state.facet(Il)){let i=n(t,e);if(void 0!==i)return i}let n=Sl(t.state);return n.length>=e?function(t,e,n){let i=e.resolveStack(n),r=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=i.node){let t=[];for(let e=r;e&&!(e.from<i.node.from||e.to>i.node.to||e.from==i.node.from&&e.type==i.node.type);e=e.parent)t.push(e);for(let e=t.length-1;e>=0;e--)i={node:t[e],next:i}}return Hl(i,t,n)}(t,n,e):null}class jl{constructor(t,e={}){this.state=t,this.options=e,this.unit=Ll(t)}lineAt(t,e=1){let n=this.state.doc.lineAt(t),{simulateBreak:i,simulateDoubleBreak:r}=this.options;return null!=i&&i>=n.from&&i<=n.to?r&&i==t?{text:"",from:t}:(e<0?i<t:i<=t)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(t,e=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(t,e);return n.slice(t-i,Math.min(n.length,t+100-i))}column(t,e=1){let{text:n,from:i}=this.lineAt(t,e),r=this.countColumn(n,t-i),s=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return s>-1&&(r+=s-this.countColumn(n,n.search(/\S|$/))),r}countColumn(t,e=t.length){return be(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:n,from:i}=this.lineAt(t,e),r=this.options.overrideIndentation;if(r){let t=r(i);if(t>-1)return t}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const zl=new vo;function Hl(t,e,n){for(let i=t;i;i=i.next){let t=Wl(i.node);if(t)return t(ql.create(e,n,i))}return 0}function Wl(t){let e=t.type.prop(zl);if(e)return e;let n,i=t.firstChild;if(i&&(n=i.type.prop(vo.closedBy))){let e=t.lastChild,i=e&&n.indexOf(e.name)>-1;return t=>function(t,e,n,i,r){let s=t.textAfter,o=s.match(/^\s*/)[0].length,l=i&&s.slice(o,o+i.length)==i||r==t.pos+o,a=e?function(t){let e=t.node,n=e.childAfter(e.from),i=e.lastChild;if(!n)return null;let r=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=null==r||r<=s.from?s.to:Math.min(s.to,r);for(let t=n.to;;){let r=e.childAfter(t);if(!r||r==i)return null;if(!r.type.isSkipped){if(r.from>=o)return null;let t=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+t}}t=r.to}}(t):null;return a?l?t.column(a.from):t.column(a.to):t.baseIndent+(l?0:t.unit*n)}(t,!0,1,void 0,i&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?$l:null}function $l(){return 0}class ql extends jl{constructor(t,e,n){super(t.state,t.options),this.base=t,this.pos=e,this.context=n}get node(){return this.context.node}static create(t,e,n){return new ql(t,e,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let n=t.resolve(e.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Ul(n,t))break;e=this.state.doc.lineAt(n.from)}return this.lineIndent(e.from)}continue(){return Hl(this.context.next,this.base,this.pos)}}function Ul(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function Kl({except:t,units:e=1}={}){return n=>{let i=t&&t.test(n.textAfter);return n.baseIndent+(i?0:e*n.unit)}}const Gl=new vo;class Yl{constructor(t,e){let n;function i(t){let e=ke.newName();return(n||(n=Object.create(null)))["."+e]=t,e}this.specs=t;const r="string"==typeof e.all?e.all:e.all?i(e.all):void 0,s=e.scope;this.scope=s instanceof xl?t=>t.prop(yl)==s.data:s?t=>t==s:void 0,this.style=Zo(t.map(t=>({tag:t.tag,class:t.class||i(Object.assign({},t,{tag:null}))})),{all:r}).style,this.module=n?new ke(n):null,this.themeType=e.themeType}static define(t,e){return new Yl(t,e||{})}}const Ql=vt.define(),Jl=vt.define({combine:t=>t.length?[t[0]]:null});function Xl(t){let e=t.facet(Ql);return e.length?e:t.facet(Jl)}class Zl{constructor(t){this.markCache=Object.create(null),this.tree=Sl(t.state),this.decorations=this.buildDeco(t,Xl(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=Sl(t.state),n=Xl(t.state),i=n!=Xl(t.startState),{viewport:r}=t.view,s=t.changes.mapPos(this.decoratedTo,1);e.length<r.to&&!i&&e.type==this.tree.type&&s>=r.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=s):(e!=this.tree||t.viewportChanged||i)&&(this.tree=e,this.decorations=this.buildDeco(t.view,n),this.decoratedTo=r.to)}buildDeco(t,e){if(!e||!this.tree.length)return Bn.none;let n=new le;for(let{from:i,to:r}of t.visibleRanges)tl(this.tree,e,(t,e,i)=>{n.add(t,e,this.markCache[i]||(this.markCache[i]=Bn.mark({class:i})))},i,r);return n.finish()}}const ta=Et.high(_i.fromClass(Zl,{decorations:t=>t.decorations})),ea=(vl.meta,vl.link,vl.heading,vl.emphasis,vl.strong,vl.strikethrough,vl.keyword,vl.atom,vl.bool,vl.url,vl.contentSeparator,vl.labelName,vl.literal,vl.inserted,vl.string,vl.deleted,vl.regexp,vl.escape,vl.string,vl.variableName,vl.variableName,vl.typeName,vl.namespace,vl.className,vl.variableName,vl.macroName,vl.propertyName,vl.comment,vl.invalid,Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}})),na="()[]{}",ia=vt.define({combine:t=>ee(t,{afterCursor:!0,brackets:na,maxScanDistance:1e4,renderMatch:oa})}),ra=Bn.mark({class:"cm-matchingBracket"}),sa=Bn.mark({class:"cm-nonmatchingBracket"});function oa(t){let e=[],n=t.matched?ra:sa;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const la=St.define({create:()=>Bn.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],i=e.state.facet(ia);for(let t of e.state.selection.ranges){if(!t.empty)continue;let r=fa(e.state,t.head,-1,i)||t.head>0&&fa(e.state,t.head-1,1,i)||i.afterCursor&&(fa(e.state,t.head,1,i)||t.head<e.state.doc.length&&fa(e.state,t.head+1,-1,i));r&&(n=n.concat(i.renderMatch(r,e.state)))}return Bn.set(n,!0)},provide:t=>Ts.decorations.from(t)}),aa=[la,ea];function ha(t={}){return[ia.of(t),aa]}const ca=new vo;function ua(t,e,n){let i=t.prop(e<0?vo.openedBy:vo.closedBy);if(i)return i;if(1==t.name.length){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function da(t){let e=t.type.prop(ca);return e?e(t.node):t}function fa(t,e,n,i={}){let r=i.maxScanDistance||1e4,s=i.brackets||na,o=Sl(t),l=o.resolveInner(e,n);for(let t=l;t;t=t.parent){let i=ua(t.type,n,s);if(i&&t.from<t.to){let r=da(t);if(r&&(n>0?e>=r.from&&e<r.to:e>r.from&&e<=r.to))return pa(0,0,n,t,r,i,s)}}return function(t,e,n,i,r,s,o){let l=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=n>0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},c=t.doc.iterRange(e,n>0?t.doc.length:0),u=0;for(let t=0;!c.next().done&&t<=s;){let s=c.value;n<0&&(t+=s.length);let l=e+t*n;for(let t=n>0?0:s.length-1,e=n>0?s.length:-1;t!=e;t+=n){let e=o.indexOf(s[t]);if(!(e<0||i.resolveInner(l+t,1).type!=r))if(e%2==0==n>0)u++;else{if(1==u)return{start:h,end:{from:l+t,to:l+t+1},matched:e>>1==a>>1};u--}}n>0&&(t+=s.length)}return c.done?{start:h,matched:!1}:null}(t,e,n,o,l.type,r,s)}function pa(t,e,n,i,r,s,o){let l=i.parent,a={from:r.from,to:r.to},h=0,c=null==l?void 0:l.cursor();if(c&&(n<0?c.childBefore(i.from):c.childAfter(i.to)))do{if(n<0?c.to<=i.from:c.from>=i.to){if(0==h&&s.indexOf(c.type.name)>-1&&c.from<c.to){let t=da(c);return{start:a,end:t?{from:t.from,to:t.to}:void 0,matched:!0}}if(ua(c.type,n,o))h++;else if(ua(c.type,-n,o)){if(0==h){let t=da(c);return{start:a,end:t&&t.from<t.to?{from:t.from,to:t.to}:void 0,matched:!1}}h--}}}while(n<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}const ga=Object.create(null),ma=[wo.none],va=[],ba=Object.create(null),ya=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])ya[t]=xa(ga,e);function wa(t,e){va.indexOf(t)>-1||(va.push(t),console.warn(e))}function xa(t,e){let n=[];for(let i of e.split(" ")){let e=[];for(let n of i.split(".")){let i=t[n]||vl[n];i?"function"==typeof i?e.length?e=e.map(i):wa(n,`Modifier ${n} used at start of tag`):e.length?wa(n,`Tag ${n} used as modifier`):e=Array.isArray(i)?i:[i]:wa(n,`Unknown highlighting tag ${n}`)}for(let t of e)n.push(t)}if(!n.length)return 0;let i=e.replace(/ /g,"_"),r=i+" "+n.map(t=>t.id),s=ba[r];if(s)return s.id;let o=ba[r]=wo.define({id:ma.length,name:i,props:[Qo({[i]:n})]});return ma.push(o),o.id}Un.RTL,Un.LTR;class ka{constructor(t,e,n,i){this.state=t,this.pos=e,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let e=Sl(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),n=Math.max(e.from,this.pos-250),i=e.text.slice(n-e.from,this.pos-e.from),r=i.search(Ea(t,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}get aborted(){return null==this.abortListeners}addEventListener(t,e,n){"abort"==t&&this.abortListeners&&(this.abortListeners.push(e),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function Aa(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}class Sa{constructor(t,e,n,i){this.completion=t,this.source=e,this.match=n,this.score=i}}function Ca(t){return t.selection.main.from}function Ea(t,e){var n;let{source:i}=t,r=e&&"^"!=i[0],s="$"!=i[i.length-1];return r||s?new RegExp(`${r?"^":""}(?:${i})${s?"$":""}`,null!==(n=t.flags)&&void 0!==n?n:t.ignoreCase?"i":""):t}const Oa=jt.define(),Ta=new WeakMap;function Ma(t){if(!Array.isArray(t))return t;let e=Ta.get(t);return e||Ta.set(t,e=function(t){let e=t.map(t=>"string"==typeof t?{label:t}:t),[n,i]=e.every(t=>/^\w+$/.test(t.label))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let t=1;t<i.length;t++)n[i[t]]=!0}let i=Aa(e)+Aa(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}(e);return t=>{let r=t.matchBefore(i);return r||t.explicit?{from:r?r.from:t.pos,options:e,validFor:n}:null}}(t)),e}const _a=Wt.define(),Pa=Wt.define();class Da{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let e=0;e<t.length;){let n=tt(t,e),i=nt(n);this.chars.push(n);let r=t.slice(e,e+i),s=r.toUpperCase();this.folded.push(tt(s==r?r.toLowerCase():s,0)),e+=i}this.astral=t.length!=this.chars.length}ret(t,e){return this.score=t,this.matched=e,this}match(t){if(0==this.pattern.length)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:e,folded:n,any:i,precise:r,byWord:s}=this;if(1==e.length){let i=tt(t,0),r=nt(i),s=r==t.length?0:-100;if(i==e[0]);else{if(i!=n[0])return null;s+=-200}return this.ret(s,[0,r])}let o=t.indexOf(this.pattern);if(0==o)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=e.length,a=0;if(o<0){for(let r=0,s=Math.min(t.length,200);r<s&&a<l;){let s=tt(t,r);s!=e[a]&&s!=n[a]||(i[a++]=r),r+=nt(s)}if(a<l)return null}let h=0,c=0,u=!1,d=0,f=-1,p=-1,g=/[a-z]/.test(t),m=!0;for(let i=0,a=Math.min(t.length,200),v=0;i<a&&c<l;){let a=tt(t,i);o<0&&(h<l&&a==e[h]&&(r[h++]=i),d<l&&(a==e[d]||a==n[d]?(0==d&&(f=i),p=i+1,d++):d=0));let b,y=a<255?a>=48&&a<=57||a>=97&&a<=122?2:a>=65&&a<=90?1:0:(b=et(a))!=b.toLowerCase()?1:b!=b.toUpperCase()?2:0;(!i||1==y&&g||0==v&&0!=y)&&(e[c]==a||n[c]==a&&(u=!0)?s[c++]=i:s.length&&(m=!1)),v=y,i+=nt(a)}return c==l&&0==s[0]&&m?this.result((u?-200:0)-100,s,t):d==l&&0==f?this.ret(-200-t.length+(p==t.length?0:-100),[0,p]):o>-1?this.ret(-700-t.length,[o,o+this.pattern.length]):d==l?this.ret(-900-t.length,[f,p]):c==l?this.result((u?-200:0)-100-700+(m?0:-1100),s,t):2==e.length?null:this.result((i[0]?-700:0)-200-1100,i,t)}result(t,e,n){let i=[],r=0;for(let t of e){let e=t+(this.astral?nt(tt(n,t)):1);r&&i[r-1]==t?i[r-1]=e:(i[r++]=t,i[r++]=e)}return this.ret(t-n.length,i)}}class Ra{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length<this.pattern.length)return null;let e=t.slice(0,this.pattern.length),n=e==this.pattern?0:e.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,e.length],this.score=n+(t.length==this.pattern.length?0:-100),this)}}const Ba=vt.define({combine:t=>ee(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Na,filterStrict:!1,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>n=>Ia(t(n),e(n)),optionClass:(t,e)=>n=>Ia(t(n),e(n)),addToOptions:(t,e)=>t.concat(e),filterStrict:(t,e)=>t||e})});function Ia(t,e){return t?e?t+" "+e:t:e}function Na(t,e,n,i,r,s){let o,l,a=t.textDirection==Un.RTL,h=a,c=!1,u="top",d=e.left-r.left,f=r.right-e.right,p=i.right-i.left,g=i.bottom-i.top;if(h&&d<Math.min(p,f)?h=!1:!h&&f<Math.min(p,d)&&(h=!0),p<=(h?d:f))o=Math.max(r.top,Math.min(n.top,r.bottom-g))-e.top,l=Math.min(400,h?d:f);else{c=!0,l=Math.min(400,(a?e.right:r.right-e.left)-30);let t=r.bottom-e.bottom;t>=g||t>e.top?o=n.bottom-e.top:(u="bottom",o=e.bottom-n.top)}return{style:`${u}: ${o/((e.bottom-e.top)/s.offsetHeight)}px; max-width: ${l/((e.right-e.left)/s.offsetWidth)}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":h?"left":"right")}}function La(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/n);return{from:t*n,to:(t+1)*n}}let i=Math.floor((t-e)/n);return{from:t-(i+1)*n,to:t-i*n}}class Fa{constructor(t,e,n){this.view=t,this.stateField=e,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:r,selected:s}=i.open,o=t.state.facet(Ba);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map(t=>"cm-completionIcon-"+t)),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,n,i){let r=document.createElement("span");r.className="cm-completionLabel";let s=t.displayLabel||t.label,o=0;for(let t=0;t<i.length;){let e=i[t++],n=i[t++];e>o&&r.appendChild(document.createTextNode(s.slice(o,e)));let l=r.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(s.slice(e,n))),l.className="cm-completionMatchedText",o=n}return o<s.length&&r.appendChild(document.createTextNode(s.slice(o))),r},position:50},{render(t){if(!t.detail)return null;let e=document.createElement("span");return e.className="cm-completionDetail",e.textContent=t.detail,e},position:80}),e.sort((t,e)=>t.position-e.position).map(t=>t.render)}(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=La(r.length,s,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",n=>{let{options:i}=t.state.field(e).open;for(let e,r=n.target;r&&r!=this.dom;r=r.parentNode)if("LI"==r.nodeName&&(e=/-(\d+)$/.exec(r.id))&&+e[1]<i.length)return this.applyCompletion(t,i[+e[1]]),void n.preventDefault()}),this.dom.addEventListener("focusout",e=>{let n=t.state.field(this.stateField,!1);n&&n.tooltip&&t.state.facet(Ba).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Pa.of(null)})}),this.showOptions(r,i.id)}mount(){this.updateSel()}showOptions(t,e){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var e;let n=t.state.field(this.stateField),i=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),n!=i){let{options:r,selected:s,disabled:o}=n.open;i.open&&i.open.options==r||(this.range=La(r.length,s,t.state.facet(Ba).maxRenderedOptions),this.showOptions(r,n.id)),this.updateSel(),o!=(null===(e=i.open)||void 0===e?void 0:e.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected<this.range.from||e.selected>=this.range.to)&&(this.range=La(e.options.length,e.selected,this.view.state.facet(Ba).maxRenderedOptions),this.showOptions(e.options,t.id)),this.updateSelectedOption(e.selected)){this.destroyInfo();let{completion:n}=e.options[e.selected],{info:i}=n;if(!i)return;let r="string"==typeof i?document.createTextNode(i):i(n);if(!r)return;"then"in r?r.then(e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e,n)}).catch(t=>Ei(this.view.state,t,"completion info")):this.addInfoPane(r,n)}}addInfoPane(t,e){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",null!=t.nodeType)n.appendChild(t),this.infoDestroy=null;else{let{dom:e,destroy:i}=t;n.appendChild(e),this.infoDestroy=i||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)"LI"==n.nodeName&&n.id?i==t?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),e=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected"):i--;return e&&function(t,e){let n=t.getBoundingClientRect(),i=e.getBoundingClientRect(),r=n.height/t.offsetHeight;i.top<n.top?t.scrollTop-=(n.top-i.top)/r:i.bottom>n.bottom&&(t.scrollTop+=(i.bottom-n.bottom)/r)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=t.getBoundingClientRect(),r=this.space;if(!r){let t=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:t.clientWidth,bottom:t.clientHeight}}return i.top>Math.min(r.bottom,e.bottom)-10||i.bottom<Math.max(r.top,e.top)+10?null:this.view.state.facet(Ba).positionInfo(this.view,e,i,n,r,this.dom)}placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(t,e,n){const i=document.createElement("ul");i.id=e,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",t=>{t.target==i&&t.preventDefault()});let r=null;for(let s=n.from;s<n.to;s++){let{completion:o,match:l}=t[s],{section:a}=o;if(a){let t="string"==typeof a?a:a.name;t!=r&&(s>n.from||0==n.from)&&(r=t,"string"!=typeof a&&a.header?i.appendChild(a.header(a)):i.appendChild(document.createElement("completion-section")).textContent=t)}const h=i.appendChild(document.createElement("li"));h.id=e+"-"+s,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,this.view,l);e&&h.appendChild(e)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<t.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function Va(t,e){return n=>new Fa(n,t,e)}function ja(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}class za{constructor(t,e,n,i,r,s){this.options=t,this.attrs=e,this.tooltip=n,this.timestamp=i,this.selected=r,this.disabled=s}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new za(this.options,qa(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,n,i,r,s){if(i&&!s&&t.some(t=>t.isPending))return i.setDisabled();let o=function(t,e){let n=[],i=null,r=t=>{n.push(t);let{section:e}=t.completion;if(e){i||(i=[]);let t="string"==typeof e?e:e.name;i.some(e=>e.name==t)||i.push("string"==typeof e?{name:t}:e)}},s=e.facet(Ba);for(let i of t)if(i.hasResult()){let t=i.result.getMatch;if(!1===i.result.filter)for(let e of i.result.options)r(new Sa(e,i.source,t?t(e):[],1e9-n.length));else{let n,o=e.sliceDoc(i.from,i.to),l=s.filterStrict?new Ra(o):new Da(o);for(let e of i.result.options)if(n=l.match(e.label)){let s=e.displayLabel?t?t(e,n.matched):[]:n.matched;r(new Sa(e,i.source,s,n.score+(e.boost||0)))}}}if(i){let t=Object.create(null),e=0,r=(t,e)=>{var n,i;return(null!==(n=t.rank)&&void 0!==n?n:1e9)-(null!==(i=e.rank)&&void 0!==i?i:1e9)||(t.name<e.name?-1:1)};for(let n of i.sort(r))e-=1e5,t[n.name]=e;for(let e of n){let{section:n}=e.completion;n&&(e.score+=t["string"==typeof n?n:n.name])}}let o=[],l=null,a=s.compareCompletions;for(let t of n.sort((t,e)=>e.score-t.score||a(t.completion,e.completion))){let e=t.completion;!l||l.label!=e.label||l.detail!=e.detail||null!=l.type&&null!=e.type&&l.type!=e.type||l.apply!=e.apply||l.boost!=e.boost?o.push(t):ja(t.completion)>ja(l)&&(o[o.length-1]=t),l=t.completion}return o}(t,e);if(!o.length)return i&&t.some(t=>t.isPending)?i.setDisabled():null;let l=e.facet(Ba).selectOnOpen?0:-1;if(i&&i.selected!=l&&-1!=i.selected){let t=i.options[i.selected].completion;for(let e=0;e<o.length;e++)if(o[e].completion==t){l=e;break}}return new za(o,qa(n,l),{pos:t.reduce((t,e)=>e.hasResult()?Math.min(t,e.from):t,1e8),create:th,above:r.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(t){return new za(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new za(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Ha{constructor(t,e,n){this.active=t,this.id=e,this.open=n}static start(){return new Ha(Ua,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,n=e.facet(Ba),i=(n.override||e.languageDataAt("autocomplete",Ca(e)).map(Ma)).map(e=>(this.active.find(t=>t.source==e)||new Ga(e,this.active.some(t=>0!=t.state)?1:0)).update(t,n));i.length==this.active.length&&i.every((t,e)=>t==this.active[e])&&(i=this.active);let r=this.open,s=t.effects.some(t=>t.is(Qa));r&&t.docChanged&&(r=r.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!function(t,e){if(t==e)return!0;for(let n=0,i=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;i<e.length&&!e[i].hasResult();)i++;let r=n==t.length,s=i==e.length;if(r||s)return r==s;if(t[n++].result!=e[i++].result)return!1}}(i,this.active)||s?r=za.build(i,e,this.id,r,n,s):r&&r.disabled&&!i.some(t=>t.isPending)&&(r=null),!r&&i.every(t=>!t.isPending)&&i.some(t=>t.hasResult())&&(i=i.map(t=>t.hasResult()?new Ga(t.source,0):t));for(let e of t.effects)e.is(Ja)&&(r=r&&r.setSelected(e.value,this.id));return i==this.active&&r==this.open?this:new Ha(i,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Wa:$a}}const Wa={"aria-autocomplete":"list"},$a={};function qa(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const Ua=[];function Ka(t,e){if(t.isUserEvent("input.complete")){let n=t.annotation(Oa);if(n&&e.activateOnCompletion(n))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Ga{constructor(t,e,n=!1){this.source=t,this.state=e,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(t,e){let n=Ka(t,e),i=this;(8&n||16&n&&this.touches(t))&&(i=new Ga(i.source,0)),4&n&&0==i.state&&(i=new Ga(this.source,1)),i=i.updateFor(t,n);for(let e of t.effects)if(e.is(_a))i=new Ga(i.source,1,e.value);else if(e.is(Pa))i=new Ga(i.source,0);else if(e.is(Qa))for(let t of e.value)t.source==i.source&&(i=t);return i}updateFor(t,e){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(Ca(t.state))}}class Ya extends Ga{constructor(t,e,n,i,r,s){super(t,3,e),this.limit=n,this.result=i,this.from=r,this.to=s}hasResult(){return!0}updateFor(t,e){var n;if(!(3&e))return this.map(t.changes);let i=this.result;i.map&&!t.changes.empty&&(i=i.map(i,t.changes));let r=t.changes.mapPos(this.from),s=t.changes.mapPos(this.to,1),o=Ca(t.state);if(o>s||!i||2&e&&(Ca(t.startState)==this.from||o<this.limit))return new Ga(this.source,4&e?1:0);let l=t.changes.mapPos(this.limit);return function(t,e,n,i){if(!t)return!1;let r=e.sliceDoc(n,i);return"function"==typeof t?t(r,n,i,e):Ea(t,!0).test(r)}(i.validFor,t.state,r,s)?new Ya(this.source,this.explicit,l,i,r,s):i.update&&(i=i.update(i,r,s,new ka(t.state,o,!1)))?new Ya(this.source,this.explicit,l,i,i.from,null!==(n=i.to)&&void 0!==n?n:Ca(t.state)):new Ga(this.source,1,this.explicit)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new Ya(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new Ga(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}const Qa=Wt.define({map:(t,e)=>t.map(t=>t.map(e))}),Ja=Wt.define(),Xa=St.define({create:()=>Ha.start(),update:(t,e)=>t.update(e),provide:t=>[Xs.from(t,t=>t.tooltip),Ts.contentAttributes.from(t,t=>t.attrs)]});function Za(t,e){const n=e.completion.apply||e.completion.label;let i=t.state.field(Xa).active.find(t=>t.source==e.source);return i instanceof Ya&&("string"==typeof n?t.dispatch(Object.assign(Object.assign({},function(t,e,n,i){let{main:r}=t.selection,s=n-r.from,o=i-r.from;return Object.assign(Object.assign({},t.changeByRange(l=>{if(l!=r&&n!=i&&t.sliceDoc(l.from+s,l.from+o)!=t.sliceDoc(n,i))return{range:l};let a=t.toText(e);return{changes:{from:l.from+s,to:i==r.from?l.to:l.from+o,insert:a},range:pt.cursor(l.from+s+a.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}(t.state,n,i.from,i.to)),{annotations:Oa.of(e.completion)})):n(t,e.completion,i.from,i.to),!0)}const th=Va(Xa,Za);function eh(t,e="option"){return n=>{let i=n.state.field(Xa,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(Ba).interactionDelay)return!1;let r,s=1;"page"==e&&(r=so(n,i.open.tooltip))&&(s=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1));let{length:o}=i.open.options,l=i.open.selected>-1?i.open.selected+s*(t?1:-1):t?0:o-1;return l<0?l="page"==e?0:o-1:l>=o&&(l="page"==e?o-1:0),n.dispatch({effects:Ja.of(l)}),!0}}const nh=t=>!!t.state.field(Xa,!1)&&(t.dispatch({effects:_a.of(!0)}),!0);class ih{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}}const rh=_i.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Xa).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Xa),n=t.state.facet(Ba);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Xa)==e)return;let i=t.transactions.some(t=>{let e=Ka(t,n);return 8&e||(t.selection||t.docChanged)&&!(3&e)});for(let e=0;e<this.running.length;e++){let n=this.running[e];if(i||n.context.abortOnDocChange&&t.docChanged||n.updates.length+t.transactions.length>50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Ei(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(t=>t.effects.some(t=>t.is(_a)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(t=>t.isPending&&!this.running.some(e=>e.active.source==t.source))?setTimeout(()=>this.startUpdate(),r):-1,0!=this.composing)for(let e of t.transactions)e.isUserEvent("input.type")?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Xa);for(let t of e.active)t.isPending&&!this.running.some(e=>e.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ba).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=Ca(e),i=new ka(e,n,t.explicit,this.view),r=new ih(t,i);this.running.push(r),Promise.resolve(t.source(i)).then(t=>{r.context.aborted||(r.done=t||null,this.scheduleAccept())},t=>{this.view.dispatch({effects:Pa.of(null)}),Ei(this.view.state,t)})}scheduleAccept(){this.running.every(t=>void 0!==t.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ba).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Ba),i=this.view.state.field(Xa);for(let r=0;r<this.running.length;r++){let s=this.running[r];if(void 0===s.done)continue;if(this.running.splice(r--,1),s.done){let i=Ca(s.updates.length?s.updates[0].startState:this.view.state),r=Math.min(i,s.done.from+(s.active.explicit?0:1)),o=new Ya(s.active.source,s.active.explicit,r,s.done,s.done.from,null!==(t=s.done.to)&&void 0!==t?t:i);for(let t of s.updates)o=o.update(t,n);if(o.hasResult()){e.push(o);continue}}let o=i.active.find(t=>t.source==s.active.source);if(o&&o.isPending)if(null==s.done){let t=new Ga(s.active.source,0);for(let e of s.updates)t=t.update(e,n);t.isPending||e.push(t)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:Qa.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Xa,!1);if(e&&e.tooltip&&this.view.state.facet(Ba).closeOnBlur){let n=e.open&&so(this.view,e.open.tooltip);n&&n.dom.contains(t.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:Pa.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:_a.of(!1)}),20),this.composing=0}}}),sh="object"==typeof navigator&&/Win/.test(navigator.platform),oh=Et.highest(Ts.domEventHandlers({keydown(t,e){let n=e.state.field(Xa,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&(!sh||!t.altKey)||t.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find(t=>t.source==i.source),s=i.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&Za(e,i),!1}})),lh=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),ah={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},hh=Wt.define({map(t,e){let n=e.mapPos(t,-1,rt.TrackAfter);return null==n?void 0:n}}),ch=new class extends ne{};ch.startSide=1,ch.endSide=-1;const uh=St.define({create:()=>oe.empty,update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:t=>t>=n.from&&t<=n.to})}for(let n of e.effects)n.is(hh)&&(t=t.update({add:[ch.range(n.value,n.value+1)]}));return t}}),dh="()[]{}<>«»»«[]{}";function fh(t){for(let e=0;e<16;e+=2)if(dh.charCodeAt(e)==t)return dh.charAt(e+1);return et(t<128?t:t+1)}const ph="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),gh=Ts.inputHandler.of((t,e,n,i)=>{if((ph?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let r=t.state.selection.main;if(i.length>2||2==i.length&&1==nt(tt(i,0))||e!=r.from||n!=r.to)return!1;let s=function(t,e){let n=function(t,e){return t.languageDataAt("closeBrackets",e)[0]||ah}(t,t.selection.main.head),i=n.brackets||ah.brackets;for(let r of i){let s=fh(tt(r,0));if(e==r)return s==r?wh(t,r,i.indexOf(r+r+r)>-1,n):bh(t,r,s,n.before||ah.before);if(e==s&&mh(t,t.selection.main.from))return yh(t,0,s)}return null}(t.state,i);return!!s&&(t.dispatch(s),!0)});function mh(t,e){let n=!1;return t.field(uh).between(0,t.doc.length,t=>{t==e&&(n=!0)}),n}function vh(t,e){let n=t.sliceString(e,e+2);return n.slice(0,nt(tt(n,0)))}function bh(t,e,n,i){let r=null,s=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:n,from:s.to}],effects:hh.of(s.to+e.length),range:pt.range(s.anchor+e.length,s.head+e.length)};let o=vh(t.doc,s.head);return!o||/\s/.test(o)||i.indexOf(o)>-1?{changes:{insert:e+n,from:s.head},effects:hh.of(s.head+e.length),range:pt.cursor(s.head+e.length)}:{range:r=s}});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function yh(t,e,n){let i=null,r=t.changeByRange(e=>e.empty&&vh(t.doc,e.head)==n?{changes:{from:e.head,to:e.head+n.length,insert:n},range:pt.cursor(e.head+n.length)}:i={range:e});return i?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function wh(t,e,n,i){let r=i.stringPrefixes||ah.stringPrefixes,s=null,o=t.changeByRange(i=>{if(!i.empty)return{changes:[{insert:e,from:i.from},{insert:e,from:i.to}],effects:hh.of(i.to+e.length),range:pt.range(i.anchor+e.length,i.head+e.length)};let o,l=i.head,a=vh(t.doc,l);if(a==e){if(xh(t,l))return{changes:{insert:e+e,from:l},effects:hh.of(l+e.length),range:pt.cursor(l+e.length)};if(mh(t,l)){let i=n&&t.sliceDoc(l,l+3*e.length)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+i.length,insert:i},range:pt.cursor(l+i.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(o=kh(t,l-2*e.length,r))>-1&&xh(t,o))return{changes:{insert:e+e+e+e,from:l},effects:hh.of(l+e.length),range:pt.cursor(l+e.length)};if(t.charCategorizer(l)(a)!=Jt.Word&&kh(t,l,r)>-1&&!function(t,e,n,i){let r=Sl(t).resolveInner(e,-1),s=i.reduce((t,e)=>Math.max(t,e.length),0);for(let o=0;o<5;o++){let o=t.sliceDoc(r.from,Math.min(r.to,r.from+n.length+s)),l=o.indexOf(n);if(!l||l>-1&&i.indexOf(o.slice(0,l))>-1){let e=r.firstChild;for(;e&&e.from==r.from&&e.to-e.from>n.length+l;){if(t.sliceDoc(e.to-n.length,e.to)==n)return!1;e=e.firstChild}return!0}let a=r.to==e&&r.parent;if(!a)break;r=a}return!1}(t,l,e,r))return{changes:{insert:e+e,from:l},effects:hh.of(l+e.length),range:pt.cursor(l+e.length)}}return{range:s=i}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function xh(t,e){let n=Sl(t).resolveInner(e+1);return n.parent&&n.from==e}function kh(t,e,n){let i=t.charCategorizer(e);if(i(t.sliceDoc(e-1,e))!=Jt.Word)return e;for(let r of n){let n=e-r.length;if(t.sliceDoc(n,e)==r&&i(t.sliceDoc(n-1,n))!=Jt.Word)return n}return-1}function Ah(t={}){return[oh,Xa,Ba.of(t),rh,Ch,lh]}const Sh=[{key:"Ctrl-Space",run:nh},{mac:"Alt-`",run:nh},{key:"Escape",run:t=>{let e=t.state.field(Xa,!1);return!(!e||!e.active.some(t=>0!=t.state)||(t.dispatch({effects:Pa.of(null)}),0))}},{key:"ArrowDown",run:eh(!0)},{key:"ArrowUp",run:eh(!1)},{key:"PageDown",run:eh(!0,"page")},{key:"PageUp",run:eh(!1,"page")},{key:"Enter",run:t=>{let e=t.state.field(Xa,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Ba).interactionDelay)&&Za(t,e.open.options[e.open.selected])}}],Ch=Et.highest(Ns.computeN([Ba],t=>t.facet(Ba).defaultKeymap?[Sh]:[]));function Eh(t,e){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=t(e,n);return!!r&&(i(n.update(r)),!0)}}const Oh=Eh(Rh,0),Th=Eh(Dh,0),Mh=Eh((t,e)=>Dh(t,e,function(t){let e=[];for(let n of t.selection.ranges){let i=t.doc.lineAt(n.from),r=n.to<=i.to?i:t.doc.lineAt(n.to);r.from>i.from&&r.from==n.to&&(r=n.to==i.to+1?i:t.doc.lineAt(n.to-1));let s=e.length-1;s>=0&&e[s].to>i.from?e[s].to=r.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return e}(e)),0);function _h(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Ph=50;function Dh(t,e,n=e.selection.ranges){let i=n.map(t=>_h(e,t.from).block);if(!i.every(t=>t))return null;let r=n.map((t,n)=>function(t,{open:e,close:n},i,r){let s,o,l=t.sliceDoc(i-Ph,i),a=t.sliceDoc(r,r+Ph),h=/\s*$/.exec(l)[0].length,c=/^\s*/.exec(a)[0].length,u=l.length-h;if(l.slice(u-e.length,u)==e&&a.slice(c,c+n.length)==n)return{open:{pos:i-h,margin:h&&1},close:{pos:r+c,margin:c&&1}};r-i<=2*Ph?s=o=t.sliceDoc(i,r):(s=t.sliceDoc(i,i+Ph),o=t.sliceDoc(r-Ph,r));let d=/^\s*/.exec(s)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-n.length;return s.slice(d,d+e.length)==e&&o.slice(p,p+n.length)==n?{open:{pos:i+d+e.length,margin:/\s/.test(s.charAt(d+e.length))?1:0},close:{pos:r-f-n.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null}(e,i[n],t.from,t.to));if(2!=t&&!r.every(t=>t))return{changes:e.changes(n.map((t,e)=>r[e]?[]:[{from:t.from,insert:i[e].open+" "},{from:t.to,insert:" "+i[e].close}]))};if(1!=t&&r.some(t=>t)){let t=[];for(let e,n=0;n<r.length;n++)if(e=r[n]){let r=i[n],{open:s,close:o}=e;t.push({from:s.pos-r.open.length,to:s.pos+s.margin},{from:o.pos-o.margin,to:o.pos+r.close.length})}return{changes:t}}return null}function Rh(t,e,n=e.selection.ranges){let i=[],r=-1;for(let{from:t,to:s}of n){let n=i.length,o=1e9,l=_h(e,t).line;if(l){for(let n=t;n<=s;){let a=e.doc.lineAt(n);if(a.from>r&&(t==s||s>a.from)){r=a.from;let t=/^\s*/.exec(a.text)[0].length,e=t==a.length,n=a.text.slice(t,t+l.length)==l?t:-1;t<a.text.length&&t<o&&(o=t),i.push({line:a,comment:n,token:l,indent:t,empty:e,single:!1})}n=a.to+1}if(o<1e9)for(let t=n;t<i.length;t++)i[t].indent<i[t].line.text.length&&(i[t].indent=o);i.length==n+1&&(i[n].single=!0)}}if(2!=t&&i.some(t=>t.comment<0&&(!t.empty||t.single))){let t=[];for(let{line:e,token:n,indent:r,empty:s,single:o}of i)!o&&s||t.push({from:e.from+r,insert:n+" "});let n=e.changes(t);return{changes:n,selection:e.selection.map(n,1)}}if(1!=t&&i.some(t=>t.comment>=0)){let t=[];for(let{line:e,comment:n,token:r}of i)if(n>=0){let i=e.from+n,s=i+r.length;" "==e.text[s-e.from]&&s++,t.push({from:i,to:s})}return{changes:t}}return null}const Bh=jt.define(),Ih=vt.define();class Nh{constructor(t,e,n,i,r){this.changes=t,this.effects=e,this.mapped=n,this.startSelection=i,this.selectionsAfter=r}setSelAfter(t){return new Nh(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,n;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(t=>t.toJSON())}}static fromJSON(t){return new Nh(t.changes&&ot.fromJSON(t.changes),[],t.mapped&&st.fromJSON(t.mapped),t.startSelection&&pt.fromJSON(t.startSelection),t.selectionsAfter.map(pt.fromJSON))}static fromTransaction(t,e){let n=Vh;for(let e of t.startState.facet(Ih)){let i=e(t);i.length&&(n=n.concat(i))}return!n.length&&t.changes.empty?null:new Nh(t.changes.invert(t.startState.doc),n,void 0,e||t.startState.selection,Vh)}static selection(t){return new Nh(void 0,Vh,void 0,void 0,t)}}function Lh(t,e,n,i){let r=e+1>n+20?e-n-1:0,s=t.slice(r,e);return s.push(i),s}function Fh(t,e){return t.length?e.length?t.concat(e):t:e}const Vh=[];function jh(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function zh(t,e){if(!t.length)return t;let n=t.length,i=Vh;for(;n;){let r=Hh(t[n-1],e,i);if(r.changes&&!r.changes.empty||r.effects.length){let e=t.slice(0,n);return e[n-1]=r,e}e=r.mapped,n--,i=r.selectionsAfter}return i.length?[Nh.selection(i)]:Vh}function Hh(t,e,n){let i=Fh(t.selectionsAfter.length?t.selectionsAfter.map(t=>t.map(e)):Vh,n);if(!t.changes)return Nh.selection(i);let r=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new Nh(r,Wt.mapEffects(t.effects,e),o,t.startSelection.map(s),i)}const Wh=/^(input\.type|delete)($|\.)/;class $h{constructor(t,e,n=0,i=void 0){this.done=t,this.undone=e,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new $h(this.done,this.undone):this}addChanges(t,e,n,i,r){let s=this.done,o=s[s.length-1];return s=o&&o.changes&&!o.changes.empty&&t.changes&&(!n||Wh.test(n))&&(!o.selectionsAfter.length&&e-this.prevTime<i.newGroupDelay&&i.joinToEvent(r,function(t,e){let n=[],i=!1;return t.iterChangedRanges((t,e)=>n.push(t,e)),e.iterChangedRanges((t,e,r,s)=>{for(let t=0;t<n.length;){let e=n[t++],o=n[t++];s>=e&&r<=o&&(i=!0)}}),i}(o.changes,t.changes))||"input.type.compose"==n)?Lh(s,s.length-1,i.minDepth,new Nh(t.changes.compose(o.changes),Fh(Wt.mapEffects(t.effects,o.changes),o.effects),o.mapped,o.startSelection,Vh)):Lh(s,s.length,i.minDepth,t),new $h(s,Vh,e,n)}addSelection(t,e,n,i){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Vh;return r.length>0&&e-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(s=r[r.length-1],o=t,s.ranges.length==o.ranges.length&&0===s.ranges.filter((t,e)=>t.empty!=o.ranges[e].empty).length)?this:new $h(function(t,e){if(t.length){let n=t[t.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return i.length&&i[i.length-1].eq(e)?t:(i.push(e),Lh(t,t.length-1,1e9,n.setSelAfter(i)))}return[Nh.selection([e])]}(this.done,t),this.undone,e,n);var s,o}addMapping(t){return new $h(zh(this.done,t),zh(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,e,n){let i=0==t?this.done:this.undone;if(0==i.length)return null;let r=i[i.length-1],s=r.selectionsAfter[0]||e.selection;if(n&&r.selectionsAfter.length)return e.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Bh.of({side:t,rest:jh(i),selection:s}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=1==i.length?Vh:i.slice(0,i.length-1);return r.mapped&&(n=zh(n,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Bh.of({side:t,rest:n,selection:s}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}function qh(t,e){return pt.create(t.ranges.map(e),t.mainIndex)}function Uh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Kh({state:t,dispatch:e},n){let i=qh(t.selection,n);return!i.eq(t.selection,!0)&&(e(Uh(t,i)),!0)}function Gh(t,e){return pt.cursor(e?t.to:t.from)}function Yh(t,e){return Kh(t,n=>n.empty?t.moveByChar(n,e):Gh(n,e))}function Qh(t){return t.textDirectionAt(t.state.selection.main.head)==Un.LTR}$h.empty=new $h(Vh,Vh);const Jh=t=>Yh(t,!Qh(t)),Xh=t=>Yh(t,Qh(t));function Zh(t,e){return Kh(t,n=>n.empty?t.moveByGroup(n,e):Gh(n,e))}function tc(t,e,n){if(e.type.prop(n))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function ec(t,e,n){let i,r,s=Sl(t).resolveInner(e.head),o=n?vo.closedBy:vo.openedBy;for(let i=e.head;;){let e=n?s.childAfter(i):s.childBefore(i);if(!e)break;tc(t,e,o)?s=e:i=n?e.to:e.from}return r=s.type.prop(o)&&(i=n?fa(t,s.from,1):fa(t,s.to,-1))&&i.matched?n?i.end.to:i.end.from:n?s.to:s.from,pt.cursor(r,n?-1:1)}function nc(t,e){return Kh(t,n=>{if(!n.empty)return Gh(n,e);let i=t.moveVertically(n,e);return i.head!=n.head?i:t.moveToLineBoundary(n,e)})}"undefined"!=typeof Intl&&Intl.Segmenter;const ic=t=>nc(t,!1),rc=t=>nc(t,!0);function sc(t){let e,n=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,i=0,r=0;if(n){for(let e of t.state.facet(Ts.scrollMargins)){let n=e(t);(null==n?void 0:n.top)&&(i=Math.max(null==n?void 0:n.top,i)),(null==n?void 0:n.bottom)&&(r=Math.max(null==n?void 0:n.bottom,r))}e=t.scrollDOM.clientHeight-i-r}else e=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:r,selfScroll:n,height:Math.max(t.defaultLineHeight,e-5)}}function oc(t,e){let n,i=sc(t),{state:r}=t,s=qh(r.selection,n=>n.empty?t.moveVertically(n,e,i.height):Gh(n,e));if(s.eq(r.selection))return!1;if(i.selfScroll){let e=t.coordsAtPos(r.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),l=o.top+i.marginTop,a=o.bottom-i.marginBottom;e&&e.top>l&&e.bottom<a&&(n=Ts.scrollIntoView(s.main.head,{y:"start",yMargin:e.top-l}))}return t.dispatch(Uh(r,s),{effects:n}),!0}const lc=t=>oc(t,!1),ac=t=>oc(t,!0);function hc(t,e,n){let i=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,n);if(r.head==e.head&&r.head!=(n?i.to:i.from)&&(r=t.moveToLineBoundary(e,n,!1)),!n&&r.head==i.from&&i.length){let n=/^\s*/.exec(t.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;n&&e.head!=i.from+n&&(r=pt.cursor(i.from+n))}return r}function cc(t,e){let n=qh(t.state.selection,t=>{let n=e(t);return pt.range(t.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(t.state.selection)&&(t.dispatch(Uh(t.state,n)),!0)}function uc(t,e){return cc(t,n=>t.moveByChar(n,e))}const dc=t=>uc(t,!Qh(t)),fc=t=>uc(t,Qh(t));function pc(t,e){return cc(t,n=>t.moveByGroup(n,e))}function gc(t,e){return cc(t,n=>t.moveVertically(n,e))}const mc=t=>gc(t,!1),vc=t=>gc(t,!0);function bc(t,e){return cc(t,n=>t.moveVertically(n,e,sc(t).height))}const yc=t=>bc(t,!1),wc=t=>bc(t,!0),xc=({state:t,dispatch:e})=>(e(Uh(t,{anchor:0})),!0),kc=({state:t,dispatch:e})=>(e(Uh(t,{anchor:t.doc.length})),!0),Ac=({state:t,dispatch:e})=>(e(Uh(t,{anchor:t.selection.main.anchor,head:0})),!0),Sc=({state:t,dispatch:e})=>(e(Uh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function Cc(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:i}=t,r=i.changeByRange(i=>{let{from:r,to:s}=i;if(r==s){let o=e(i);o<r?(n="delete.backward",o=Ec(t,o,!1)):o>r&&(n="delete.forward",o=Ec(t,o,!0)),r=Math.min(r,o),s=Math.max(s,o)}else r=Ec(t,r,!1),s=Ec(t,s,!0);return r==s?{range:i}:{changes:{from:r,to:s},range:pt.cursor(r,r<i.head?-1:1)}});return!r.changes.empty&&(t.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?Ts.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Ec(t,e,n){if(t instanceof Ts)for(let i of t.state.facet(Ts.atomicRanges).map(e=>e(t)))i.between(e,e,(t,i)=>{t<e&&i>e&&(e=n?i:t)});return e}const Oc=(t,e,n)=>Cc(t,i=>{let r,s,o=i.from,{state:l}=t,a=l.doc.lineAt(o);if(n&&!e&&o>a.from&&o<a.from+200&&!/[^ \t]/.test(r=a.text.slice(0,o-a.from))){if("\t"==r[r.length-1])return o-1;let t=be(r,l.tabSize)%Ll(l)||Ll(l);for(let e=0;e<t&&" "==r[r.length-1-e];e++)o--;s=o}else s=Z(a.text,o-a.from,e,e)+a.from,s==o&&a.number!=(e?l.doc.lines:1)?s+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(s-a.from,o-a.from))&&(s=Z(a.text,s-a.from,!1,!1)+a.from);return s}),Tc=t=>Oc(t,!1,!0),Mc=t=>Oc(t,!0,!1),_c=(t,e)=>Cc(t,n=>{let i=n.head,{state:r}=t,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let t=null;;){if(i==(e?s.to:s.from)){i==n.head&&s.number!=(e?r.doc.lines:1)&&(i+=e?1:-1);break}let l=Z(s.text,i-s.from,e)+s.from,a=s.text.slice(Math.min(i,l)-s.from,Math.max(i,l)-s.from),h=o(a);if(null!=t&&h!=t)break;" "==a&&i==n.head||(t=h),i=l}return i}),Pc=t=>_c(t,!1);function Dc(t){let e=[],n=-1;for(let i of t.selection.ranges){let r=t.doc.lineAt(i.from),s=t.doc.lineAt(i.to);if(i.empty||i.to!=s.from||(s=t.doc.lineAt(i.to-1)),n>=r.number){let t=e[e.length-1];t.to=s.to,t.ranges.push(i)}else e.push({from:r.from,to:s.to,ranges:[i]});n=s.number+1}return e}function Rc(t,e,n){if(t.readOnly)return!1;let i=[],r=[];for(let e of Dc(t)){if(n?e.to==t.doc.length:0==e.from)continue;let s=t.doc.lineAt(n?e.to+1:e.from-1),o=s.length+1;if(n){i.push({from:e.to,to:s.to},{from:e.from,insert:s.text+t.lineBreak});for(let n of e.ranges)r.push(pt.range(Math.min(t.doc.length,n.anchor+o),Math.min(t.doc.length,n.head+o)))}else{i.push({from:s.from,to:e.from},{from:e.to,insert:t.lineBreak+s.text});for(let t of e.ranges)r.push(pt.range(t.anchor-o,t.head-o))}}return!!i.length&&(e(t.update({changes:i,scrollIntoView:!0,selection:pt.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Bc(t,e,n){if(t.readOnly)return!1;let i=[];for(let e of Dc(t))n?i.push({from:e.from,insert:t.doc.slice(e.from,e.to)+t.lineBreak}):i.push({from:e.to,insert:t.lineBreak+t.doc.slice(e.from,e.to)});return e(t.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Ic=Nc(!1);function Nc(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let i=e.changeByRange(n=>{let{from:i,to:r}=n,s=e.doc.lineAt(i),o=!t&&i==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n,i=Sl(t).resolveInner(e),r=i.childBefore(e),s=i.childAfter(e);return r&&s&&r.to<=e&&s.from>=e&&(n=r.type.prop(vo.closedBy))&&n.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}(e,i);t&&(i=r=(r<=s.to?s:e.doc.lineAt(r)).to);let l=new jl(e,{simulateBreak:i,simulateDoubleBreak:!!o}),a=Vl(l,i);for(null==a&&(a=be(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));r<s.to&&/\s/.test(s.text[r-s.from]);)r++;o?({from:i,to:r}=o):i>s.from&&i<s.from+100&&!/\S/.test(s.text.slice(0,i))&&(i=s.from);let h=["",Fl(e,a)];return o&&h.push(Fl(e,l.lineIndent(s.from,-1))),{changes:{from:i,to:r,insert:W.of(h)},range:pt.cursor(i+1+h[1].length)}});return n(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Lc(t,e){let n=-1;return t.changeByRange(i=>{let r=[];for(let s=i.from;s<=i.to;){let o=t.doc.lineAt(s);o.number>n&&(i.empty||i.to>o.from)&&(e(o,r,i),n=o.number),s=o.to+1}let s=t.changes(r);return{changes:r,range:pt.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const Fc=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>Kh(t,e=>ec(t.state,e,!Qh(t))),shift:t=>cc(t,e=>ec(t.state,e,!Qh(t)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>Kh(t,e=>ec(t.state,e,Qh(t))),shift:t=>cc(t,e=>ec(t.state,e,Qh(t)))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>Rc(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Bc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>Rc(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Bc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let n=t.selection,i=null;return n.ranges.length>1?i=pt.create([n.main]):n.main.empty||(i=pt.create([pt.cursor(n.main.head)])),!!i&&(e(Uh(t,i)),!0)}},{key:"Mod-Enter",run:Nc(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let n=Dc(t).map(({from:e,to:n})=>pt.range(e,Math.min(n+1,t.doc.length)));return e(t.update({selection:pt.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let n=qh(t.selection,e=>{let n=Sl(t),i=n.resolveStack(e.from,1);if(e.empty){let t=n.resolveStack(e.from,-1);t.node.from>=i.node.from&&t.node.to<=i.node.to&&(i=t)}for(let t=i;t;t=t.next){let{node:n}=t;if((n.from<e.from&&n.to>=e.to||n.to>e.to&&n.from<=e.from)&&t.next)return pt.range(n.to,n.from)}return e});return!n.eq(t.selection)&&(e(Uh(t,n)),!0)},preventDefault:!0},{key:"Mod-[",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Lc(t,(e,n)=>{let i=/^\s*/.exec(e.text)[0];if(!i)return;let r=be(i,t.tabSize),s=0,o=Fl(t,Math.max(0,r-Ll(t)));for(;s<i.length&&s<o.length&&i.charCodeAt(s)==o.charCodeAt(s);)s++;n.push({from:e.from+s,to:e.from+i.length,insert:o.slice(s)})}),{userEvent:"delete.dedent"})),!0)},{key:"Mod-]",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Lc(t,(e,n)=>{n.push({from:e.from,insert:t.facet(Nl)})}),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),i=new jl(t,{overrideIndentation:t=>{let e=n[t];return null==e?-1:e}}),r=Lc(t,(e,r,s)=>{let o=Vl(i,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let l=/^\s*/.exec(e.text)[0],a=Fl(t,o);(l!=a||s.from<e.from+l.length)&&(n[e.from]=o,r.push({from:e.from,to:e.from+l.length,insert:a}))});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Dc(e).map(({from:t,to:n})=>(t>0?t--:n<e.doc.length&&n++,{from:t,to:n}))),i=qh(e.selection,e=>{let n;if(t.lineWrapping){let i=t.lineBlockAt(e.head),r=t.coordsAtPos(e.head,e.assoc||1);r&&(n=i.bottom+t.documentTop-r.bottom+t.defaultLineHeight/2)}return t.moveVertically(e,!0,n)}).map(n);return t.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:t,dispatch:e})=>function(t,e,n){let i=!1,r=qh(t.selection,e=>{let r=fa(t,e.head,-1)||fa(t,e.head,1)||e.head>0&&fa(t,e.head-1,1)||e.head<t.doc.length&&fa(t,e.head+1,-1);if(!r||!r.end)return e;i=!0;let s=r.start.from==e.head?r.end.to:r.end.from;return n?pt.range(e.anchor,s):pt.cursor(s)});return!!i&&(e(Uh(t,r)),!0)}(t,e,!1)},{key:"Mod-/",run:t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),i=_h(t.state,n.from);return i.line?Oh(t):!!i.block&&Mh(t)}},{key:"Alt-A",run:Th},{key:"Ctrl-m",mac:"Shift-Alt-m",run:t=>(t.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:Jh,shift:dc,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Zh(t,!Qh(t)),shift:t=>pc(t,!Qh(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>Kh(t,e=>hc(t,e,!Qh(t))),shift:t=>cc(t,e=>hc(t,e,!Qh(t))),preventDefault:!0},{key:"ArrowRight",run:Xh,shift:fc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Zh(t,Qh(t)),shift:t=>pc(t,Qh(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>Kh(t,e=>hc(t,e,Qh(t))),shift:t=>cc(t,e=>hc(t,e,Qh(t))),preventDefault:!0},{key:"ArrowUp",run:ic,shift:mc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:xc,shift:Ac},{mac:"Ctrl-ArrowUp",run:lc,shift:yc},{key:"ArrowDown",run:rc,shift:vc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:kc,shift:Sc},{mac:"Ctrl-ArrowDown",run:ac,shift:wc},{key:"PageUp",run:lc,shift:yc},{key:"PageDown",run:ac,shift:wc},{key:"Home",run:t=>Kh(t,e=>hc(t,e,!1)),shift:t=>cc(t,e=>hc(t,e,!1)),preventDefault:!0},{key:"Mod-Home",run:xc,shift:Ac},{key:"End",run:t=>Kh(t,e=>hc(t,e,!0)),shift:t=>cc(t,e=>hc(t,e,!0)),preventDefault:!0},{key:"Mod-End",run:kc,shift:Sc},{key:"Enter",run:Ic,shift:Ic},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:Tc,shift:Tc},{key:"Delete",run:Mc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Pc},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>_c(t,!0)},{mac:"Mod-Backspace",run:t=>Cc(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)})},{mac:"Mod-Delete",run:t=>Cc(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)})}].concat([{key:"Ctrl-b",run:Jh,shift:dc,preventDefault:!0},{key:"Ctrl-f",run:Xh,shift:fc},{key:"Ctrl-p",run:ic,shift:mc},{key:"Ctrl-n",run:rc,shift:vc},{key:"Ctrl-a",run:t=>Kh(t,e=>pt.cursor(t.lineBlockAt(e.head).from,1)),shift:t=>cc(t,e=>pt.cursor(t.lineBlockAt(e.head).from))},{key:"Ctrl-e",run:t=>Kh(t,e=>pt.cursor(t.lineBlockAt(e.head).to,-1)),shift:t=>cc(t,e=>pt.cursor(t.lineBlockAt(e.head).to))},{key:"Ctrl-d",run:Mc},{key:"Ctrl-h",run:Tc},{key:"Ctrl-k",run:t=>Cc(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)})},{key:"Ctrl-Alt-h",run:Pc},{key:"Ctrl-o",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:W.of(["",""])},range:pt.cursor(t.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(e=>{if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};let n=e.from,i=t.doc.lineAt(n),r=n==i.from?n-1:Z(i.text,n-i.from,!1)+i.from,s=n==i.to?n+1:Z(i.text,n-i.from,!0)+i.from;return{changes:{from:r,to:s,insert:t.doc.slice(n,s).append(t.doc.slice(r,n))},range:pt.cursor(s)}});return!n.changes.empty&&(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:ac}].map(t=>({mac:t.key,run:t.run,shift:t.shift}))));function Vc(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];"string"==typeof r?t.setAttribute(i,r):null!=r&&(t[i]=r)}e++}for(;e<arguments.length;e++)jc(t,arguments[e]);return t}function jc(t,e){if("string"==typeof e)t.appendChild(document.createTextNode(e));else if(null==e);else if(null!=e.nodeType)t.appendChild(e);else{if(!Array.isArray(e))throw new RangeError("Unsupported child node: "+e);for(var n=0;n<e.length;n++)jc(t,e[n])}}class zc{constructor(t,e,n){this.from=t,this.to=e,this.diagnostic=n}}class Hc{constructor(t,e,n){this.diagnostics=t,this.panel=e,this.selected=n}static init(t,e,n){let i=n.facet(tu).markerFilter;i&&(t=i(t,n));let r=t.slice().sort((t,e)=>t.from-e.from||t.to-e.to),s=new le,o=[],l=0;for(let t=0;;){let e,i,a=t==r.length?null:r[t];if(!a&&!o.length)break;for(o.length?(e=l,i=o.reduce((t,e)=>Math.min(t,e.to),a&&a.from>e?a.from:1e8)):(e=a.from,i=a.to,o.push(a),t++);t<r.length;){let n=r[t];if(n.from!=e||!(n.to>n.from||n.to==e)){i=Math.min(n.from,i);break}o.push(n),t++,i=Math.min(n.to,i)}let h=cu(o);if(o.some(t=>t.from==t.to||t.from==t.to-1&&n.doc.lineAt(t.from).to==t.from))s.add(e,e,Bn.widget({widget:new ru(h),diagnostics:o.slice()}));else{let t=o.reduce((t,e)=>e.markClass?t+" "+e.markClass:t,"");s.add(e,i,Bn.mark({class:"cm-lintRange cm-lintRange-"+h+t,diagnostics:o.slice(),inclusiveEnd:o.some(t=>t.to>i)}))}l=i;for(let t=0;t<o.length;t++)o[t].to<=l&&o.splice(t--,1)}let a=s.finish();return new Hc(a,e,Wc(a))}}function Wc(t,e=null,n=0){let i=null;return t.between(n,1e9,(t,n,{spec:r})=>{if(!(e&&r.diagnostics.indexOf(e)<0))if(i){if(r.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new zc(i.from,n,i.diagnostic)}else i=new zc(t,n,e||r.diagnostics[0])}),i}function $c(t,e){return t.field(Gc,!1)?e:e.concat(Wt.appendConfig.of(uu))}const qc=Wt.define(),Uc=Wt.define(),Kc=Wt.define(),Gc=St.define({create:()=>new Hc(Bn.none,null,null),update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),i=null,r=t.panel;if(t.selected){let r=e.changes.mapPos(t.selected.from,1);i=Wc(n,t.selected.diagnostic,r)||Wc(n,null,r)}!n.size&&r&&e.state.facet(tu).autoPanel&&(r=null),t=new Hc(n,r,i)}for(let n of e.effects)if(n.is(qc)){let i=e.state.facet(tu).autoPanel?n.value.length?ou.open:null:t.panel;t=Hc.init(n.value,i,e.state)}else n.is(Uc)?t=new Hc(t.diagnostics,n.value?ou.open:null,t.selected):n.is(Kc)&&(t=new Hc(t.diagnostics,t.panel,n.value));return t},provide:t=>[uo.from(t,t=>t.panel),Ts.decorations.from(t,t=>t.diagnostics)]}),Yc=Bn.mark({class:"cm-lintRange cm-lintRange-active"});function Qc(t,e,n){let i,{diagnostics:r}=t.state.field(Gc),s=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(t,r,{spec:l})=>{if(e>=t&&e<=r&&(t==r||(e>t||n>0)&&(e<r||n<0)))return i=l.diagnostics,s=t,o=r,!1});let l=t.state.facet(tu).tooltipFilter;return i&&l&&(i=l(i,t.state)),i?{pos:s,end:o,above:t.state.doc.lineAt(s).to<o,create:()=>({dom:Jc(t,i)})}:null}function Jc(t,e){return Vc("ul",{class:"cm-tooltip-lint"},e.map(e=>iu(t,e,!1)))}const Xc=t=>{let e=t.state.field(Gc,!1);return!(!e||!e.panel||(t.dispatch({effects:Uc.of(!1)}),0))},Zc=_i.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(tu);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let t=Date.now();if(t<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-t);else{this.set=!1;let{state:t}=this.view,{sources:e}=t.facet(tu);e.length&&function(t,e,n){let i=[],r=-1;for(let s of t)s.then(n=>{i.push(n),clearTimeout(r),i.length==t.length?e(i):r=setTimeout(()=>e(i),200)},n)}(e.map(t=>Promise.resolve(t(this.view))),e=>{this.view.state.doc==t.doc&&this.view.dispatch(function(t,e){return{effects:$c(t,[qc.of(e)])}}(this.view.state,e.reduce((t,e)=>t.concat(e))))},t=>{Ei(this.view.state,t)})}}update(t){let e=t.state.facet(tu);(t.docChanged||e!=t.startState.facet(tu)||e.needsRefresh&&e.needsRefresh(t))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),tu=vt.define({combine:t=>Object.assign({sources:t.map(t=>t.source).filter(t=>null!=t)},ee(t.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(t,e)=>t?e?n=>t(n)||e(n):t:e}))});function eu(t,e={}){return[tu.of({source:t,config:e}),Zc,uu]}function nu(t){let e=[];if(t)t:for(let{name:n}of t){for(let t=0;t<n.length;t++){let i=n[t];if(/[a-zA-Z]/.test(i)&&!e.some(t=>t.toLowerCase()==i.toLowerCase())){e.push(i);continue t}}e.push("")}return e}function iu(t,e,n){var i;let r=n?nu(e.actions):[];return Vc("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Vc("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),null===(i=e.actions)||void 0===i?void 0:i.map((n,i)=>{let s=!1,o=i=>{if(i.preventDefault(),s)return;s=!0;let r=Wc(t.state.field(Gc).diagnostics,e);r&&n.apply(t,r.from,r.to)},{name:l}=n,a=r[i]?l.indexOf(r[i]):-1,h=a<0?l:[l.slice(0,a),Vc("u",l.slice(a,a+1)),l.slice(a+1)];return Vc("button",{type:"button",class:"cm-diagnosticAction",onclick:o,onmousedown:o,"aria-label":` Action: ${l}${a<0?"":` (access key "${r[i]})"`}.`},h)}),e.source&&Vc("div",{class:"cm-diagnosticSource"},e.source))}class ru extends Dn{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return Vc("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class su{constructor(t,e){this.diagnostic=e,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=iu(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ou{constructor(t){this.view=t,this.items=[],this.list=Vc("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:e=>{if(27==e.keyCode)Xc(this.view),this.view.focus();else if(38==e.keyCode||33==e.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==e.keyCode||34==e.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==e.keyCode)this.moveSelection(0);else if(35==e.keyCode)this.moveSelection(this.items.length-1);else if(13==e.keyCode)this.view.focus();else{if(!(e.keyCode>=65&&e.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],i=nu(n.actions);for(let r=0;r<i.length;r++)if(i[r].toUpperCase().charCodeAt(0)==e.keyCode){let e=Wc(this.view.state.field(Gc).diagnostics,n);e&&n.actions[r].apply(t,e.from,e.to)}}}e.preventDefault()},onclick:t=>{for(let e=0;e<this.items.length;e++)this.items[e].dom.contains(t.target)&&this.moveSelection(e)}}),this.dom=Vc("div",{class:"cm-panel-lint"},this.list,Vc("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Xc(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Gc).selected;if(!t)return-1;for(let e=0;e<this.items.length;e++)if(this.items[e].diagnostic==t.diagnostic)return e;return-1}update(){let{diagnostics:t,selected:e}=this.view.state.field(Gc),n=0,i=!1,r=null,s=new Set;for(t.between(0,this.view.state.doc.length,(t,o,{spec:l})=>{for(let t of l.diagnostics){if(s.has(t))continue;s.add(t);let o,l=-1;for(let e=n;e<this.items.length;e++)if(this.items[e].diagnostic==t){l=e;break}l<0?(o=new su(this.view,t),this.items.splice(n,0,o),i=!0):(o=this.items[l],l>n&&(this.items.splice(n,l-n),i=!0)),e&&o.diagnostic==e.diagnostic?o.dom.hasAttribute("aria-selected")||(o.dom.setAttribute("aria-selected","true"),r=o):o.dom.hasAttribute("aria-selected")&&o.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();0==this.items.length&&(this.items.push(new su(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:t,panel:e})=>{let n=e.height/this.list.offsetHeight;t.top<e.top?this.list.scrollTop-=(e.top-t.top)/n:t.bottom>e.bottom&&(this.list.scrollTop+=(t.bottom-e.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let t=this.list.firstChild;function e(){let e=t;t=e.nextSibling,e.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;t!=n.dom;)e();t=n.dom.nextSibling}else this.list.insertBefore(n.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=Wc(this.view.state.field(Gc).diagnostics,this.items[t].diagnostic);e&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:Kc.of(e)})}static open(t){return new ou(t)}}function lu(t){return function(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const au=Ts.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:lu("#d11")},".cm-lintRange-warning":{backgroundImage:lu("orange")},".cm-lintRange-info":{backgroundImage:lu("#999")},".cm-lintRange-hint":{backgroundImage:lu("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function hu(t){return"error"==t?4:"warning"==t?3:"info"==t?2:1}function cu(t){let e="hint",n=1;for(let i of t){let t=hu(i.severity);t>n&&(n=t,e=i.severity)}return e}const uu=[Gc,Ts.decorations.compute([Gc],t=>{let{selected:e,panel:n}=t.field(Gc);return e&&n&&e.from!=e.to?Bn.set([Yc.range(e.from,e.to)]):Bn.none}),ro(Qc,{hideOn:function(t,e){let n=e.pos,i=e.end||n,r=t.state.facet(tu).hideOn(t,n,i);if(null!=r)return r;let s=t.startState.doc.lineAt(e.pos);return!(!t.effects.some(t=>t.is(qc))&&!t.changes.touchesRange(s.from,Math.max(s.to,i)))}}),au];class du{constructor(t,e,n,i,r,s,o,l,a,h=0,c){this.p=t,this.stack=e,this.state=n,this.reducePos=i,this.pos=r,this.score=s,this.buffer=o,this.bufferBase=l,this.curContext=a,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,n=0){let i=t.parser.context;return new du(t,[],e,n,n,0,[],0,i?new fu(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let n=t>>19,i=65535&t,{parser:r}=this.p,s=this.reducePos<this.pos-25;s&&this.setLookAhead(this.pos);let o=r.dynamicPrecedence(i);if(o&&(this.score+=o),0==n)return this.pushState(r.getGoto(this.state,i,!0),this.reducePos),i<r.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,s?8:4,!0),void this.reduceContext(i,this.reducePos);let l=this.stack.length-3*(n-1)-(262144&t?6:0),a=l?this.stack[l-2]:this.p.ranges[0].from,h=this.reducePos-a;h>=2e3&&!(null===(e=this.p.parser.nodeSet.types[i])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=h));let c=l?this.stack[l-1]:0,u=this.bufferBase+this.buffer.length-c;if(i<r.minRepeatTerm||131072&t){let t=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,t,u+4,!0)}if(262144&t)this.state=this.stack[l];else{let t=this.stack[l-3];this.state=r.getGoto(t,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,n,i=4,r=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let t=this,i=this.buffer.length;if(0==i&&t.parent&&(i=t.bufferBase-t.parent.bufferBase,t=t.parent),i>0&&0==t.buffer[i-4]&&t.buffer[i-1]>-1){if(e==n)return;if(t.buffer[i-2]>=e)return void(t.buffer[i-2]=n)}}if(r&&this.pos!=n){let r=this.buffer.length;if(r>0&&0!=this.buffer[r-4]){let t=!1;for(let e=r;e>0&&this.buffer[e-2]>n;e-=4)if(this.buffer[e-1]>=0){t=!0;break}if(t)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,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=n,this.buffer[r+3]=i}else this.buffer.push(t,e,n,i)}shift(t,e,n,i){if(131072&t)this.pushState(65535&t,this.pos);else if(262144&t)this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4);else{let r=t,{parser:s}=this.p;(i>this.pos||e<=s.maxNode)&&(this.pos=i,s.stateFlag(r,1)||(this.reducePos=i)),this.pushState(r,n),this.shiftContext(e,n),e<=s.maxNode&&this.buffer.push(e,n,i,4)}}apply(t,e,n,i){65536&t?this.reduce(t):this.shift(t,e,n,i)}useNode(t,e){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=t)&&(this.p.reused.push(t),n++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let n=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new du(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let n=t<=this.p.parser.maxNode;n&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,n?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new pu(this);;){let n=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==n)return!1;if(!(65536&n))return!0;e.reduce(n)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let n=[];for(let i,r=0;r<e.length;r+=2)(i=e[r+1])!=this.state&&this.p.parser.hasAction(i,t)&&n.push(e[r],i);if(this.stack.length<120)for(let t=0;n.length<8&&t<e.length;t+=2){let i=e[t+1];n.some((t,e)=>1&e&&t==i)||n.push(e[t],i)}e=n}let n=[];for(let t=0;t<e.length&&n.length<4;t+=2){let i=e[t+1];if(i==this.state)continue;let r=this.split();r.pushState(i,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[t],this.pos),r.reducePos=this.pos,r.score-=200,n.push(r)}return n}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if(!(65536&e))return!1;if(!t.validAction(this.state,e)){let n=e>>19,i=65535&e,r=this.stack.length-3*n;if(r<0||t.getGoto(this.stack[r],i,!1)<0){let t=this.findForcedReduction();if(null==t)return!1;e=t}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],n=(i,r)=>{if(!e.includes(i))return e.push(i),t.allActions(i,e=>{if(393216&e);else if(65536&e){let n=(e>>19)-r;if(n>1){let i=65535&e,r=this.stack.length-3*n;if(r>=0&&t.getGoto(this.stack[r],i,!1)>=0)return n<<19|65536|i}}else{let t=n(e,r+1);if(null!=t)return t}})};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:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||-3!=this.buffer[t])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||-4!=this.buffer[t])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new fu(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){t>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class fu{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class pu{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,n=t>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class gu{constructor(t,e,n){this.stack=t,this.pos=e,this.index=n,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new gu(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.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 gu(this.stack,this.pos,this.index)}}function mu(t,e=Uint16Array){if("string"!=typeof t)return t;let n=null;for(let i=0,r=0;i<t.length;){let s=0;for(;;){let e=t.charCodeAt(i++),n=!1;if(126==e){s=65535;break}e>=92&&e--,e>=34&&e--;let r=e-32;if(r>=46&&(r-=46,n=!0),s+=r,n)break;s*=46}n?n[r++]=s:n=new e(s)}return n}class vu{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const bu=new vu;class yu{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=bu,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let n=this.range,i=this.rangeIndex,r=this.pos+t;for(;r<n.from;){if(!i)return null;let t=this.ranges[--i];r-=n.from-t.to,n=t}for(;e<0?r>n.to:r>=n.to;){if(i==this.ranges.length-1)return null;let t=this.ranges[++i];r+=t.from-n.to,n=t}return r}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e,n,i=this.chunkOff+t;if(i>=0&&i<this.chunk.length)e=this.pos+t,n=this.chunk.charCodeAt(i);else{let i=this.resolveOffset(t,1);if(null==i)return-1;if(e=i,e>=this.chunk2Pos&&e<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(e-this.chunk2Pos);else{let t=this.rangeIndex,i=this.range;for(;i.to<=e;)i=this.ranges[++t];this.chunk2=this.input.chunk(this.chunk2Pos=e),e+this.chunk2.length>i.to&&(this.chunk2=this.chunk2.slice(0,i.to-e)),n=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),n}acceptToken(t,e=0){let n=e?this.resolveOffset(e,-1):this.pos;if(null==n||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=n}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,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(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,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(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=bu,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let n="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(n+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return n}}class wu{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:n}=e.p;!function(t,e,n,i,r,s){let o=0,l=1<<i,{dialect:a}=n.p.parser;t:for(;0!=(l&t[o]);){let n=t[o+1];for(let i=o+3;i<n;i+=2)if((t[i+1]&l)>0){let n=t[i];if(a.allows(n)&&(-1==e.token.value||e.token.value==n||ku(n,e.token.value,r,s))){e.acceptToken(n);break}}let i=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[n+3*c-3])){for(;h<c;){let r=h+c>>1,s=n+r+(r<<1),l=t[s],a=t[s+1]||65536;if(i<l)c=r;else{if(!(i>=a)){o=t[s+2],e.advance();continue t}h=r+1}}break}o=t[n+3*c-1]}}(this.data,t,e,this.id,n.data,n.tokenPrecTable)}}function xu(t,e,n){for(let i,r=e;65535!=(i=t[r]);r++)if(i==n)return r-e;return-1}function ku(t,e,n,i){let r=xu(n,i,e);return r<0||xu(n,i,t)<r}wu.prototype.contextual=wu.prototype.fallback=wu.prototype.extend=!1,wu.prototype.fallback=wu.prototype.extend=!1;const Au="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let Su=null;function Cu(t,e,n){let i=t.cursor(So.IncludeAnonymous);for(i.moveTo(e);;)if(!(n<0?i.childBefore(e):i.childAfter(e)))for(;;){if((n<0?i.to<e:i.from>e)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(t.length,Math.max(i.from+1,e+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:t.length}}class Eu{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Cu(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Cu(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let n=this.trees[e],i=this.index[e];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let r=n.children[i],s=this.start[e]+n.positions[i];if(s>t)return this.nextStart=s,null;if(r instanceof Co){if(s==t){if(s<this.safeFrom)return null;let t=s+r.length;if(t<=this.safeTo){let e=r.prop(vo.lookAhead);if(!e||t+e<this.fragment.to)return r}}this.index[e]++,s+r.length>=Math.max(this.safeFrom,t)&&(this.trees.push(r),this.start.push(s),this.index.push(0))}else this.index[e]++,this.nextStart=s+r.length}}}class Ou{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(t=>new vu)}getActions(t){let e=0,n=null,{parser:i}=t.p,{tokenizers:r}=i,s=i.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,l=0;for(let i=0;i<r.length;i++){if(!(1<<i&s))continue;let a=r[i],h=this.tokens[i];if((!n||a.fallback)&&((a.contextual||h.start!=t.pos||h.mask!=s||h.context!=o)&&(this.updateCachedToken(h,a,t),h.mask=s,h.context=o),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),0!=h.value)){let i=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!a.extend&&(n=h,e>i))break}}for(;this.actions.length>e;)this.actions.pop();return l&&t.setLookAhead(l),n||t.pos!=this.stream.end||(n=new vu,n.value=t.p.parser.eofTerm,n.start=n.end=t.pos,e=this.addActions(t,n.value,n.end,e)),this.mainToken=n,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new vu,{pos:n,p:i}=t;return e.start=n,e.end=Math.min(n+1,i.stream.end),e.value=n==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,n){let i=this.stream.clipPos(n.pos);if(e.token(this.stream.reset(i,t),n),t.value>-1){let{parser:e}=n.p;for(let i=0;i<e.specialized.length;i++)if(e.specialized[i]==t.value){let r=e.specializers[i](this.stream.read(t.start,t.end),n);if(r>=0&&n.p.parser.dialect.allows(r>>1)){1&r?t.extended=r>>1:t.value=r>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,n,i){for(let e=0;e<i;e+=3)if(this.actions[e]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=n,i}addActions(t,e,n,i){let{state:r}=t,{parser:s}=t.p,{data:o}=s;for(let t=0;t<2;t++)for(let l=s.stateSlot(r,t?2:1);;l+=3){if(65535==o[l]){if(1!=o[l+1]){0==i&&2==o[l+1]&&(i=this.putAction(Du(o,l+2),e,n,i));break}l=Du(o,l+2)}o[l]==e&&(i=this.putAction(Du(o,l+1),e,n,i))}return i}}class Tu{constructor(t,e,n,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new yu(e,i),this.tokens=new Ou(t,this.stream),this.topTerm=t.top[1];let{from:r}=i[0];this.stacks=[du.start(this,t.top[0],r)],this.fragments=n.length&&this.stream.end-r>4*t.bufferLength?new Eu(n,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,n=this.stacks,i=this.minStackPos,r=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[t]=n;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<n.length;s++){let o=n[s];for(;;){if(this.tokens.mainToken=null,o.pos>i)r.push(o);else{if(this.advanceStack(o,r,n))continue;{t||(t=[],e=[]),t.push(o);let n=this.tokens.getMainToken(o);e.push(n.value,n.end)}}break}}if(!r.length){let e=t&&function(t){let e=null;for(let n of t){let t=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=t&&n.pos>t)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}(t);if(e)return Au&&console.log("Finish with "+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw Au&&t&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&t){let n=null!=this.stoppedAt&&t[0].pos>this.stoppedAt?t[0]:this.runRecovery(t,e,r);if(n)return Au&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(r.length>t)for(r.sort((t,e)=>e.score-t.score);r.length>t;)r.pop();r.some(t=>t.reducePos>i)&&this.recovering--}else if(r.length>1){t:for(let t=0;t<r.length-1;t++){let e=r[t];for(let n=t+1;n<r.length;n++){let i=r[n];if(e.sameState(i)||e.buffer.length>500&&i.buffer.length>500){if(!((e.score-i.score||e.buffer.length-i.buffer.length)>0)){r.splice(t--,1);continue t}r.splice(n--,1)}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let t=1;t<r.length;t++)r[t].pos<this.minStackPos&&(this.minStackPos=r[t].pos);return null}stopAt(t){if(null!=this.stoppedAt&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,n){let i=t.pos,{parser:r}=this,s=Au?this.stackID(t)+" -> ":"";if(null!=this.stoppedAt&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,n=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(i);o;){let i=this.parser.nodeSet.types[o.type.id]==o.type?r.getGoto(t.state,o.type.id):-1;if(i>-1&&o.length&&(!e||(o.prop(vo.contextHash)||0)==n))return t.useNode(o,i),Au&&console.log(s+this.stackID(t)+` (via reuse of ${r.getName(o.type.id)})`),!0;if(!(o instanceof Co)||0==o.children.length||o.positions[0]>0)break;let l=o.children[0];if(!(l instanceof Co&&0==o.positions[0]))break;o=l}}let o=r.stateSlot(t.state,4);if(o>0)return t.reduce(o),Au&&console.log(s+this.stackID(t)+` (via always-reduce ${r.getName(65535&o)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let l=this.tokens.getActions(t);for(let o=0;o<l.length;){let a=l[o++],h=l[o++],c=l[o++],u=o==l.length||!n,d=u?t:t.split(),f=this.tokens.mainToken;if(d.apply(a,h,f?f.start:d.pos,c),Au&&console.log(s+this.stackID(d)+` (via ${65536&a?`reduce of ${r.getName(65535&a)}`:"shift"} for ${r.getName(h)} @ ${i}${d==t?"":", split"})`),u)return!0;d.pos>i?e.push(d):n.push(d)}return!1}advanceFully(t,e){let n=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>n)return Mu(t,e),!0}}runRecovery(t,e,n){let i=null,r=!1;for(let s=0;s<t.length;s++){let o=t[s],l=e[s<<1],a=e[1+(s<<1)],h=Au?this.stackID(o)+" -> ":"";if(o.deadEnd){if(r)continue;if(r=!0,o.restart(),Au&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10&&(Au&&console.log(u+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,n));t++)Au&&(u=this.stackID(c)+" -> ");for(let t of o.recoverByInsert(l))Au&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,n);this.stream.end>o.pos?(a==o.pos&&(a++,l=0),o.recoverByDelete(l,a),Au&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(l)})`),Mu(o,n)):(!i||i.score<o.score)&&(i=o)}return i}stackToTree(t){return t.close(),Co.build({buffer:gu.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(Su||(Su=new WeakMap)).get(t);return e||Su.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function Mu(t,e){for(let n=0;n<e.length;n++){let i=e[n];if(i.pos==t.pos&&i.sameState(t))return void(e[n].score<t.score&&(e[n]=t))}e.push(t)}class _u{constructor(t,e,n){this.source=t,this.flags=e,this.disabled=n}allows(t){return!this.disabled||0==this.disabled[t]}}class Pu extends $o{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let n=Object.keys(t.topRules).map(e=>t.topRules[e][1]),i=[];for(let t=0;t<e.length;t++)i.push([]);function r(t,e,n){i[t].push([e,e.deserialize(String(n))])}if(t.nodeProps)for(let e of t.nodeProps){let t=e[0];"string"==typeof t&&(t=vo[t]);for(let n=1;n<e.length;){let i=e[n++];if(i>=0)r(i,t,e[n++]);else{let s=e[n+-i];for(let o=-i;o>0;o--)r(e[n++],t,s);n++}}}this.nodeSet=new xo(e.map((e,r)=>wo.define({name:r>=this.minRepeatTerm?void 0:e,id:r,props:i[r],top:n.indexOf(r)>-1,error:0==r,skipped:t.skippedNodes&&t.skippedNodes.indexOf(r)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=po;let s=mu(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t<this.specializerSpecs.length;t++)this.specialized[t]=this.specializerSpecs[t].term;this.specializers=this.specializerSpecs.map(Ru),this.states=mu(t.states,Uint32Array),this.data=mu(t.stateData),this.goto=mu(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(t=>"number"==typeof t?new wu(s,t):t),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,n){let i=new Tu(this,t,e,n);for(let r of this.wrappers)i=r(i,t,e,n);return i}getGoto(t,e,n=!1){let i=this.goto;if(e>=i[0])return-1;for(let r=i[e+1];;){let e=i[r++],s=1&e,o=i[r++];if(s&&n)return o;for(let n=r+(e>>1);r<n;r++)if(i[r]==t)return o;if(s)return-1}}hasAction(t,e){let n=this.data;for(let i=0;i<2;i++)for(let r,s=this.stateSlot(t,i?2:1);;s+=3){if(65535==(r=n[s])){if(1!=n[s+1]){if(2==n[s+1])return Du(n,s+2);break}r=n[s=Du(n,s+2)]}if(r==e||0==r)return Du(n,s+1)}return 0}stateSlot(t,e){return this.states[6*t+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,t=>t==e||null)}allActions(t,e){let n=this.stateSlot(t,4),i=n?e(n):void 0;for(let n=this.stateSlot(t,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Du(this.data,n+2)}i=e(Du(this.data,n+1))}return i}nextStates(t){let e=[];for(let n=this.stateSlot(t,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Du(this.data,n+2)}if(!(1&this.data[n+2])){let t=this.data[n+1];e.some((e,n)=>1&n&&e==t)||e.push(this.data[n],t)}}return e}configure(t){let e=Object.assign(Object.create(Pu.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let n=this.topRules[t.top];if(!n)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=n}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((n,i)=>{let r=t.specializers.find(t=>t.from==n.external);if(!r)return n;let s=Object.assign(Object.assign({},n),{external:r.to});return e.specializers[i]=Ru(s),s})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),n=e.map(()=>!1);if(t)for(let i of t.split(" ")){let t=e.indexOf(i);t>=0&&(n[t]=!0)}let i=null;for(let t=0;t<e.length;t++)if(!n[t])for(let n,r=this.dialects[e[t]];65535!=(n=this.data[r++]);)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new _u(t,n,i)}static deserialize(t){return new Pu(t)}}function Du(t,e){return t[e]|t[e+1]<<16}function Ru(t){if(t.external){let e=t.extend?1:0;return(n,i)=>t.external(n,i)<<1|e}return t.get}const Bu=Qo({String:vl.string,Number:vl.number,"True False":vl.bool,PropertyName:vl.propertyName,Null:vl.null,", :":vl.separator,"[ ]":vl.squareBracket,"{ }":vl.brace}),Iu=Pu.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Bu],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Nu=Al.define({name:"json",parser:Iu.configure({props:[zl.add({Object:Kl({except:/^\s*\}/}),Array:Kl({except:/^\s*\]/})}),Gl.add({"Object Array":function(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Lu(){return new Bl(Nu)}const Fu=[Ts.theme({"&":{height:"100%",width:"100%"},".cm-scroller":{overflow:"auto"},"& .cm-content":{padding:"0px"},"& .cm-line":{padding:"0px"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-completionInfo":{whiteSpace:"pre-wrap",overflow:"hidden",textOverflow:"ellipsis"},"&.cm-editor":{height:"100%"},"& .cm-completionInfo > *":{whiteSpace:"normal"},"& .cm-completionInfo ul":{margin:0,paddingLeft:"15px"},"& .cm-completionInfo pre":{marginBottom:0,whiteSpace:"pre-wrap"},"& .cm-completionInfo p":{marginTop:0},"& .cm-completionInfo p:not(:last-of-type)":{marginBottom:0}}),Ts.baseTheme({"& .variableName":{color:"#10f"},"& .number":{color:"#164"},"& .string":{color:"#a11"},"& .bool":{color:"#219"},"& .function":{color:"#aa3731",fontWeight:"bold"},"& .control":{color:"#708"}}),function(t){let e,n=[ta];return t instanceof Yl&&(t.module&&n.push(Ts.styleModule.of(t.module)),e=t.themeType),e?n.push(Ql.computeN([Ts.darkTheme],n=>n.facet(Ts.darkTheme)==("dark"==e)?[t]:[])):n.push(Ql.of(t)),n}(Yl.define([{tag:vl.variableName,class:"variableName"},{tag:vl.name,class:"variableName"},{tag:vl.number,class:"number"},{tag:vl.string,class:"string"},{tag:vl.bool,class:"bool"},{tag:vl.function(vl.variableName),class:"function"},{tag:vl.function(vl.special(vl.variableName)),class:"function"},{tag:vl.controlKeyword,class:"control"},{tag:vl.operatorKeyword,class:"control"}]))];function Vu(t){return[ju(t),Ts.updateListener.of(t=>{if(t.selectionSet||t.docChanged){const{state:e}=t,n=e.selection.main.head,i=Sl(e).resolve(n,-1);if(!["Object","PropertyName","⚠"].includes(i.name))return null;""===e.doc.lineAt(n).text.trim()&&setTimeout(()=>{nh(t.view)},100)}})]}function ju(t){return Ah({override:[e=>function(t,e){const{state:n,pos:i}=t,r=n.doc.lineAt(i),s=i-r.from;if(r.text.slice(0,s).includes(":"))return null;const o=Sl(n).resolve(i,-1);if(!["Object","PropertyName","⚠"].includes(o.name))return null;const l=n.sliceDoc(o.from,i).startsWith('"'),a='"'===r.text[s],h=e.map(t=>({label:t.label,type:"variable",info:t.info,apply:(e,n,i,s)=>{const o=e.state.sliceDoc(i-1,s+1);o.startsWith('"')&&(i-=1),o.endsWith('"')&&(s+=1);let l=`"${t.label}": ,`,a=i+l.length-1,h=a;if("Number"===t.detail)l=`"${t.label}": ${t.value},`,a=i+l.length-1-t.value.toString().length,h=i+l.length-1;else if("Boolean"===t.detail)l=`"${t.label}": ${t.value},`,a=i+l.length-1-t.value.toString().length,h=i+l.length-1;else if("Context"===t.detail)l=`"${t.label}": {},`,a=i+l.length-2,h=a;else if("String"===t.detail){const e=t.value.replace(/"/g,'\\"');l=`"${t.label}": "${e}",`,a=i+l.length-2-e.length,h=i+l.length-2}else if("Object"===t.detail||"Array"===t.detail||"null"===t.detail){l=`"${t.label}": ${JSON.stringify(t.value,null,2)},`;const e=r.text.slice(0,r.text.search(/\S|$/));l=l.split("\n").map((t,n)=>0===n?t:e+t).join("\n"),a=i+`"${t.label}": `.length,h=i+l.length-1}(function(t,e){const n=t.sliceDoc(e).trimStart();return n&&'"'===n[0]})(e.state,s)||(l=l.slice(0,-1));const c=e.state.update({changes:{from:i,to:s,insert:l},selection:{anchor:a,head:h}});e.dispatch(c)}})),c="Object"===o.name?i:o.from;return{from:l?c+1:c,to:a?r.to-1:r.to,options:h}}(e,t)]})}var zu=s(467);const Hu=jt.define(),Wu=new Tt,$u="JSON contains errors",qu={},Uu=[];function Ku({allOutputs:t=qu,value:e,onChange:n,onErrorChange:i,variablesForElement:r=Uu}){const s=(0,o.useMemo)(()=>{const e=r.map(({name:t,detail:e,info:n})=>({label:t,type:"variable",info:()=>Gu(n,"Process variable"),detail:e,value:n||void 0})),n=function(t){const e=[];for(const n in t)if(t[n]){const{variables:i=[]}=t[n];for(const t in i)e.push({name:t,value:i[t],origin:n})}return e}(t),i=n.map(({name:t,value:e,origin:n})=>({label:t,type:"variable",info:()=>Gu(e,`Output variable from ${n}`),detail:Yu(e),value:e}));return[...e,...i]},[t,r]),l=(0,o.useRef)(null),[a,h]=(0,o.useState)(),[c,u]=(0,o.useState)();return(0,o.useEffect)(()=>{if(!l.current)return;const t=te.create({doc:e,extensions:[Ah(),[gh,uh],ha(),te.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:i}=t.newSelection.main,r=n.lineAt(i);if(i>r.from+200)return t;let s=n.sliceString(r.from,i);if(!e.some(t=>t.test(s)))return t;let{state:o}=t,l=-1,a=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==l)continue;l=e.from;let n=Vl(o,e.from);if(null==n)continue;let i=/^\s*/.exec(e.text)[0],r=Fl(o,n);i!=r&&a.push({from:e.from,to:e.from+i.length,insert:r})}return a.length?[t,{changes:a,sequential:!0}]:t}),Ns.of([...Fc]),(new Tt).of(Lu()),(new Tt).of(te.tabSize.of(2)),Ts.contentAttributes.of({"aria-label":"JSON editor",tabindex:"0"}),eu(t=>{const e=(t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=function(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]})(t),n=e&&e.length>0;return i(n?$u:null),u(n?$u:null),e},{delay:300}),Wu.of(Vu(s)),Hs("Enter process variables in JSON format"),Fu,Ts.lineWrapping,Ts.updateListener.of(t=>{if(t.docChanged){if(t.transactions.some(t=>t.annotation(Hu)))return;const e=t.state.doc.toString();n(e)}})]}),r=new Ts({state:t,parent:l.current});return h(r),()=>{r.destroy()}},[n]),(0,o.useEffect)(()=>{a&&a.dispatch({effects:Wu.reconfigure(Vu(s))})},[s,a]),(0,o.useEffect)(()=>{if(!a)return;const t=a.state.doc.toString();e!==t&&a.dispatch({changes:{from:0,to:t.length,insert:e},annotations:Hu.of(!0)})},[a,e]),(0,zu.jsxs)("div",{className:d()("code__editor",{"code__editor--error":c}),children:[(0,zu.jsx)("div",{className:"code__editor-codemirror",children:(0,zu.jsx)("div",{ref:l,className:"code__editor-codemirror-inner"})}),c&&(0,zu.jsx)("div",{className:"code__editor-error",children:c})]})}function Gu(t,e){const n=document.createElement("div"),i=(0,P.qV)((0,zu.jsxs)("div",{className:"info",children:[(0,zu.jsx)("span",{children:e}),t&&(0,zu.jsx)("pre",{children:"object"==typeof t?JSON.stringify(t,null,2):t})]}));return n.innerHTML=i,n}function Yu(t){const e=typeof t;return"object"===e?Array.isArray(t)?"Array":null===t?"null":"Object":e.charAt(0).toUpperCase()+e.slice(1)}function Qu({allOutputs:t,input:e="",onErrorChange:n,onResetInput:i,onSetInput:r,variablesForElement:s}){return(0,zu.jsxs)("div",{className:"input",children:[(0,zu.jsxs)("div",{className:"input__header",children:[(0,zu.jsx)("div",{className:"input__header--title",children:"Input process variables"}),(0,zu.jsx)(l.Link,{href:"https://docs.camunda.io/docs/components/concepts/variables/",target:"_blank",title:"Open documentation",children:(0,zu.jsx)(c.Launch,{})}),(0,zu.jsx)(l.Link,{className:"input__header--button-reset",onClick:()=>{i()},role:"button",children:"Clear"})]}),(0,zu.jsx)(Ku,{allOutputs:t,value:e,onChange:r,onErrorChange:n,variablesForElement:s})]})}function Ju({value:t}){const e=(0,o.useRef)(null),[n,i]=(0,o.useState)();return(0,o.useEffect)(()=>{if(!e.current)return;const n=te.create({doc:t,extensions:[Lu(),te.tabSize.of(2),te.readOnly.of(!0),Ts.editable.of(!1),Ts.lineWrapping,Fu]}),r=new Ts({state:n,parent:e.current});return i(r),()=>{r.destroy()}},[]),(0,o.useEffect)(()=>{if(!n)return;const e=n.state.doc.toString();t!==e&&n.dispatch({changes:{from:0,to:e.length,insert:t}})},[n,t]),(0,zu.jsxs)("div",{className:"code__editor",children:[(0,zu.jsx)(l.Button,{className:"code__editor-copy-button",renderIcon:c.Copy,iconDescription:"Copy to clipboard",size:"sm",kind:"ghost",hasIconOnly:!0,onClick:()=>{navigator.clipboard.writeText(t)}}),(0,zu.jsx)("div",{className:"code__editor-codemirror",children:(0,zu.jsx)("div",{ref:e,className:"code__editor-codemirror-inner"})})]})}const Xu="LOCAL",Zu="PROCESS";class td extends(E()){constructor(t,e){super(),this._api=e,this._interval=null,this._status="idle",t.get("eventBus").on("selection.changed",()=>{"idle"!==this._status&&this.emit("taskExecution.interrupted"),this.cancelTaskExecution()})}async executeTask(t,e){this._changeStatus("deploying");const n=await this._api.deploy();if("idle"===this._status)return;if(!n.success)return this._emitError("Failed to deploy process definition",n.error),void this.cancelTaskExecution();const i=function(t){const{processes:e=[]}=t;for(const t of e)if(t)return t.processDefinitionId;return null}(n.response);if(!i)return this._emitError("Failed to retrieve process ID from deployment response"),void this.cancelTaskExecution();this._changeStatus("starting-instance");const r=await this._api.startInstance(i,t,e);if("idle"===this._status)return;if(!r.success)return this._emitError("Failed to start process instance",r.error),void this.cancelTaskExecution();const s=function(t){const{processInstanceKey:e}=t;return e||null}(r.response);if(!s)return this._emitError("Failed to retrieve process instance key from start instance response"),void this.cancelTaskExecution();this._changeStatus("executing",s),this._interval=setInterval(async()=>{const e=await this._api.getProcessInstance(s);if("idle"===this._status)return void this.cancelTaskExecution();if(!e.success)return void this._emitError("Failed to get process instance",e.error);const n=ed(e.response,s);if(!n)return;const i=function(t,e){const n=ed(t,e);return n?n.state:null}(e.response,s),r=function(t,e){const n=ed(t,e);return n&&n.hasIncident||!1}(e.response,s);let o=null;if(r){const t=await this._api.getProcessInstanceIncident(s);if("idle"===this._status)return void this.cancelTaskExecution();if(!t.success)return void this._emitError("Failed to get process instance incident",t.error);o=function(t){const{items:e=[]}=t;return e.length?e[0]:null}(t.response)}if(["COMPLETED","TERMINATED","CANCELED"].includes(i)||r){const e=await this._api.getProcessInstanceVariables(s);if("idle"===this._status)return void this.cancelTaskExecution();if(!e.success)return void this._emitError("Failed to get process instance variables",e.error);const i=await this._api.getProcessInstanceElementInstances(s);if("idle"===this._status)return void this.cancelTaskExecution();if(!i.success)return void this._emitError("Failed to get process instance element instances",i.error);const r=function(t,e,n,i){const r={};for(const s of t){const{name:t,value:o}=s,l=nd(s,e,n,i);try{r[t]={value:JSON.parse(o),scope:l}}catch{r[t]={value:o,scope:l}}}return r}(e.response.items,i.response.items,n,t);this.emit("taskExecution.finished",{success:!o,incident:o,variables:r}),this.cancelTaskExecution()}},1e3)}async cancelTaskExecution(){this._interval&&clearInterval(this._interval),this._changeStatus("idle")}_emitError(t,e){const n={message:t,response:e};this.emit("taskExecution.error",n)}_changeStatus(t,...e){this._status!==t&&(this._status=t,this.emit("taskExecution.status.changed",t,...e))}}function ed(t,e){const{items:n=[]}=t;return n.length&&n.find(t=>t.processInstanceKey===e)||null}function nd(t,e,n,i){const{scopeKey:r}=t;if(e.find(t=>t.elementInstanceKey===r&&t.elementId===i))return Xu;const{processInstanceKey:s}=n;return r===s?Zu:null}const id={deploying:"Deploying...","starting-instance":"Starting instance...",executing:"Waiting for task to be completed..."};function rd({isConnectionConfigured:t,configureConnectionBannerTitle:e,configureConnectionBannerDescription:n,configureConnectionLabel:i,onConfigureConnection:r,isTaskExecuting:s,output:a,currentOperateUrl:h,onResetOutput:u,taskExecutionStatus:f}){const p=(0,o.useMemo)(()=>null!=a&&a.error||null!=a&&a.incident||!t?(0,zu.jsx)(c.ErrorFilled,{className:"output__status-icon--error"}):null!=a&&a.success?(0,zu.jsx)(c.CheckmarkFilled,{className:"output__status-icon--success"}):s?(0,zu.jsx)(l.InlineLoading,{}):(0,zu.jsx)(c.InProgress,{className:"output__status-icon--ready"}),[a,s,t]),g=t&&a,m=t&&(h||a),v=h||(null==a?void 0:a.operateUrl),b=(0,o.useMemo)(()=>{if(s)return id[f];if(!t)return"Connection error";if(a){if(a.error)return a.error.message?`Error: ${a.error.message}`:"Error";if(a.incident)return a.incident.errorType?`Incident: ${a.incident.errorType}`:"Incident";if(a.success)return"Success"}return"Ready"},[s,f,a,t]);return(0,zu.jsxs)("div",{className:"output",children:[(0,zu.jsxs)("div",{className:"output__header",children:[(0,zu.jsxs)("div",{className:"output__header--title",children:[p,(0,zu.jsx)("span",{children:b})]}),m&&(0,zu.jsx)(l.Tooltip,{className:d()({"show-tooltip":!v}),autoAlign:!0,label:"No Operate URL set for this connection",children:(0,zu.jsx)(l.Link,{className:d()({"link--disabled":!v}),href:v,target:"_blank",children:"View in Operate"})}),g&&(0,zu.jsx)(l.Link,{onClick:()=>u(),role:"button",children:"Clear"})]}),(0,zu.jsx)("div",{className:"output__body",children:t?(0,zu.jsx)(sd,{isTaskExecuting:s,output:a}):(0,zu.jsx)(od,{title:e,description:n,actionLabel:i,onActionClick:r})})]})}function sd({isTaskExecuting:t,output:e}){return t?(0,zu.jsx)(l.CodeSnippetSkeleton,{className:"output__variables--skeleton",type:"multi"}):null!=e&&e.success?(0,zu.jsxs)(l.Tabs,{children:[(0,zu.jsxs)(l.TabList,{children:[(0,zu.jsx)(l.Tab,{children:"Process variables"}),(0,zu.jsx)(l.Tab,{children:"Local variables"})]}),(0,zu.jsxs)(l.TabPanels,{children:[(0,zu.jsx)(l.TabPanel,{children:(0,zu.jsx)(Ju,{value:JSON.stringify(ad(e.variables,Zu),null,2)})}),(0,zu.jsx)(l.TabPanel,{children:(0,zu.jsx)(Ju,{value:JSON.stringify(ad(e.variables,Xu),null,2)})})]})]}):null!=e&&e.error?(0,zu.jsx)(Ju,{value:(null==e?void 0:e.error.response)||"No error details available"}):null!=e&&e.incident?(0,zu.jsxs)(l.Tabs,{children:[(0,zu.jsxs)(l.TabList,{children:[(0,zu.jsx)(l.Tab,{children:"Incident"}),(0,zu.jsx)(l.Tab,{children:"Process variables"}),(0,zu.jsx)(l.Tab,{children:"Local variables"})]}),(0,zu.jsxs)(l.TabPanels,{children:[(0,zu.jsx)(l.TabPanel,{children:(0,zu.jsx)(Ju,{value:ld(e.incident)})}),(0,zu.jsx)(l.TabPanel,{children:(0,zu.jsx)(Ju,{value:JSON.stringify(ad(e.variables,Zu),null,2)})}),(0,zu.jsx)(l.TabPanel,{children:(0,zu.jsx)(Ju,{value:JSON.stringify(ad(e.variables,Xu),null,2)})})]})]}):(0,zu.jsx)("div",{className:"output__variables--empty",children:(0,zu.jsxs)("div",{children:["Enter process variables, then click ",(0,zu.jsx)("span",{className:"output__variables--empty-action",children:"Test task"})," to see how they change once the task has executed."]})})}function od({title:t,description:e,actionLabel:n,actionUrl:i="#",onActionClick:r=()=>{}}){return(0,zu.jsxs)("div",{className:"output__error",children:[(0,zu.jsxs)("div",{className:"output__error--title",children:[(0,zu.jsx)("span",{children:t}),n&&(0,zu.jsx)("div",{className:"output__error--action",children:(0,zu.jsx)(l.Link,{href:i,onClick:()=>r(),children:n})})]}),(0,zu.jsx)("div",{className:"output__error--content",children:(0,zu.jsx)("span",{children:e})})]})}function ld(t){let e="";return Object.keys(t).forEach(n=>{e+=`${function(t){return t.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase())}(n)}: ${JSON.stringify(t[n],null,2)}\n`}),e}function ad(t,e){return Object.entries(t).reduce((t,[n,i])=>(e===(null==i?void 0:i.scope)&&(t[n]=i.value),t),{})}function hd(t){return function(t){var e=t.businessObject,n=function(t){return x(t,"bpmn:FlowElement")||x(t,"bpmn:Participant")||x(t,"bpmn:Lane")||x(t,"bpmn:SequenceFlow")||x(t,"bpmn:MessageFlow")||x(t,"bpmn:DataInput")||x(t,"bpmn:DataOutput")?"name":x(t,"bpmn:TextAnnotation")?"text":x(t,"bpmn:Group")?"categoryValueRef":void 0}(e);if(n)return"categoryValueRef"===n?function(t){var e=t.categoryValueRef;return e&&e.value||""}(e):e[n]||""}(t)}function cd(t,e){const n=e.get("translate")||(t=>t),i=e.get("elementTemplates",!1);if(i){const e=function(t,e){return e.get(t)}(t,i);if(e&&e.name)return n(e.name)}const r=function(t){return t.type.split(":")[1]}(t);return n(r.replace(/(\B[A-Z])/g," $1"))}var ud=s(72),dd=s.n(ud),fd=s(825),pd=s.n(fd),gd=s(659),md=s.n(gd),vd=s(56),bd=s.n(vd),yd=s(540),wd=s.n(yd),xd=s(113),kd=s.n(xd),Ad=s(520),Sd={};function Cd({injector:t,api:e,isConnectionConfigured:n,configureConnectionBannerTitle:i="Connection required",configureConnectionBannerDescription:r="Configure a connection to start testing.",configureConnectionLabel:s="Configure",onConfigureConnection:a,config:h,onConfigChanged:u=()=>{},operateBaseUrl:f,documentationUrl:p,onTaskExecutionStarted:g=()=>{},onTaskExecutionFinished:m=()=>{},onTaskExecutionInterrupted:v=()=>{}}){const b=(0,o.useRef)(null),y=(0,o.useRef)(null),[w,x]=(0,o.useState)([]),[C,E]=(0,o.useState)(),[O,T]=(0,o.useState)(),[P,D]=(0,o.useState)(),[R,B]=(0,o.useState)({}),[I,N]=(0,o.useState)(null),[L,F]=(0,o.useState)(),[V,j]=function(t){const[e,n]=(0,o.useState)(null),[i,r]=(0,o.useState)(S);(0,o.useEffect)(()=>{const e=t.get("selection");s({newSelection:e.get()});const n=t.get("eventBus");return n.on("selection.changed",s),()=>{n.off("selection.changed",s)}},[t]);const s=({newSelection:t})=>{1!==t.length?(n(null),r(S)):k(t[0],A)?(n(t[0]),r(null)):(n(null),r("Task testing is only supported for tasks. Select a task to start testing."))};return[e,i]}(t),z=(0,o.useRef)(null);(0,o.useEffect)(()=>{const n=new _(t);b.current=n;const i=new M(t,n,h);y.current=i;const r=new td(t,e);return z.current=r,()=>{var t;null===(t=z.current)||void 0===t||t.cancelTaskExecution()}},[t]),(0,o.useEffect)(()=>{V&&b.current&&b.current.getVariablesForElement(V).then(t=>x(t))},[V]),(0,o.useEffect)(()=>{if(!b.current)return;const t=async()=>{if(!V||!b.current)return;const t=await b.current.getVariablesForElement(V);x(t)};return b.current.on("variables.changed",t),()=>{b.current&&b.current.off("variables.changed",t)}},[V]),(0,o.useEffect)(()=>{if(!y.current)return;const t=()=>{y.current&&(u(y.current.getConfig()),V&&(T(y.current.getInputConfigForElement(V)),D(y.current.getOutputConfigForElement(V)),B(y.current.getConfig().output)))};return y.current.on("config.changed",t),()=>{y.current&&y.current.off("config.changed",t)}},[V,u,B,T,D]),(0,o.useEffect)(()=>{var t,e,n,i;const r=t=>{var e;null==y||null===(e=y.current)||void 0===e||e.setOutputConfigForElement(V,{success:!1,error:t})},s=(t,e)=>{if(E(t),e&&f){const t=function(t,e){const n=t.replace(/\/+$/,"");return new URL(`processes/${e}`,`${n}/`).toString()}(f,e);F(t)}"idle"===t&&F(void 0)},o=t=>{var e;null==y||null===(e=y.current)||void 0===e||e.setOutputConfigForElement(V,{...t,operateUrl:L}),m(V,t)},l=()=>{v()};return null==z||null===(t=z.current)||void 0===t||t.on("taskExecution.finished",o),null==z||null===(e=z.current)||void 0===e||e.on("taskExecution.status.changed",s),null==z||null===(n=z.current)||void 0===n||n.on("taskExecution.error",r),null==z||null===(i=z.current)||void 0===i||i.on("taskExecution.interrupted",l),()=>{z.current&&(z.current.off("taskExecution.finished",o),z.current.off("taskExecution.status.changed",s),z.current.off("taskExecution.error",r),z.current.off("taskExecution.interrupted",l))}},[V,f,L]),(0,o.useEffect)(()=>{h&&y.current&&JSON.stringify(h)!==JSON.stringify(y.current.getConfig())&&y.current.setConfig(h)},[h]),(0,o.useEffect)(()=>{var t,e;V?(T(null==y||null===(t=y.current)||void 0===t?void 0:t.getInputConfigForElement(V)),D(null==y||null===(e=y.current)||void 0===e?void 0:e.getOutputConfigForElement(V))):T(void 0)},[V]);const H=(0,o.useCallback)(t=>{V&&y.current&&y.current.setInputConfigForElement(V,t)},[V]),W=(0,o.useCallback)(()=>{V&&y.current&&y.current.resetInputConfigForElement(V)},[V]),$=(0,o.useCallback)(()=>{V&&y.current&&y.current.resetOutputConfigForElement(V)},[V]);if(!h)return(0,zu.jsx)("div",{className:"task-testing__container task-testing__container--empty",children:(0,zu.jsxs)("div",{className:"task-testing__container-no-config",children:[(0,zu.jsx)(l.InlineLoading,{})," ",(0,zu.jsx)("span",{children:"Configuring..."})]})});if(!V)return(0,zu.jsx)("div",{className:"task-testing__container task-testing__container--empty",children:(0,zu.jsxs)("div",{className:"task-testing__container-no-element",children:[(0,zu.jsx)(c.Cursor_1,{}),(0,zu.jsx)("span",{children:j}),p&&(0,zu.jsx)(l.Link,{href:p,target:"_blank",children:"Learn more."})]})});const q=!n||!!I,U=n?I:i,K=!!C&&"idle"!==C;return(0,zu.jsxs)("div",{className:"task-testing__container",children:[(0,zu.jsxs)("div",{className:"task-testing__container--left",children:[(0,zu.jsxs)("div",{className:"task-testing__container--header",children:[(0,zu.jsxs)("div",{className:"task-header",children:[(0,zu.jsx)("span",{className:"task-type",children:cd(V,t)}),(0,zu.jsx)("span",{className:"task-name",children:hd(V)})]}),(0,zu.jsx)(l.Tooltip,{className:d()({"show-tooltip":q}),label:U,align:"left-start",children:(0,zu.jsx)(l.Button,{"data-testid":"test-task-btn",className:"btn-execute",kind:"primary",size:"sm",renderIcon:K?c.StopFilledAlt:c.PlayFilledAlt,onClick:()=>{var t;n?K?null==z||null===(t=z.current)||void 0===t||t.cancelTaskExecution():(async()=>{if(!n||I||!V||!z.current||!y.current)return;g(V);const t=y.current.getInputConfigForElement(V);y.current.setOutputConfigForElement(V,null),z.current.executeTask(V.id,JSON.parse(t))})():a&&a()},children:K?"Cancel":"Test task"})})]}),(0,zu.jsx)(Qu,{allOutputs:R,input:O,onErrorChange:N,onResetInput:W,onSetInput:H,variablesForElement:w})]}),(0,zu.jsx)("div",{className:"task-testing__container--right",children:(0,zu.jsx)(rd,{isConnectionConfigured:n,configureConnectionBannerTitle:i,configureConnectionBannerDescription:r,configureConnectionLabel:s,onConfigureConnection:a,isTaskExecuting:K,output:P,currentOperateUrl:L,onResetOutput:$,taskExecutionStatus:C||"idle"})})]})}Sd.styleTagTransform=kd(),Sd.setAttributes=bd(),Sd.insert=md().bind(null,"head"),Sd.domAPI=pd(),Sd.insertStyleElement=wd(),dd()(Ad.A,Sd),Ad.A&&Ad.A.locals&&Ad.A.locals;export{Cd as default};
|
|
2
|
+
import*as t from"react";import*as e from"@carbon/react";import*as n from"@carbon/icons-react";var i={7:t=>{var e,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var r=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise(function(n,i){function r(n){t.removeListener(e,s),i(n)}function s(){"function"==typeof t.removeListener&&t.removeListener("error",r),n([].slice.call(arguments))}g(t,e,s,{once:!0}),"error"!==e&&function(t,e){"function"==typeof t.on&&g(t,"error",e,{once:!0})}(t,r)})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function l(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function a(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function h(t,e,n,i){var r,s,o,h;if(l(n),void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),s=t._events),o=s[e]),void 0===o)o=s[e]=n,++t._eventsCount;else if("function"==typeof o?o=s[e]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(r=a(t))>0&&o.length>r&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=o.length,h=c,console&&console.warn&&console.warn(h)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},r=c.bind(i);return r.listener=n,i.wrapFn=r,r}function d(t,e,n){var i=t._events;if(void 0===i)return[];var r=i[e];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(r):p(r,r.length)}function f(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(t,e){for(var n=new Array(e),i=0;i<e;++i)n[i]=t[i];return n}function g(t,e,n,i){if("function"==typeof t.on)i.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,function r(s){i.once&&t.removeEventListener(e,r),n(s)})}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(t){if("number"!=typeof t||t<0||r(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");o=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||r(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return a(this)},s.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,s=this._events;if(void 0!==s)r=r&&void 0===s.error;else if(!r)return!1;if(r){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var l=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw l.context=o,l}var a=s[t];if(void 0===a)return!1;if("function"==typeof a)i(a,this,e);else{var h=a.length,c=p(a,h);for(n=0;n<h;++n)i(c[n],this,e)}return!0},s.prototype.addListener=function(t,e){return h(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return h(this,t,e,!0)},s.prototype.once=function(t,e){return l(e),this.on(t,u(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return l(e),this.prependListener(t,u(this,t,e)),this},s.prototype.removeListener=function(t,e){var n,i,r,s,o;if(l(e),void 0===(i=this._events))return this;if(void 0===(n=i[t]))return this;if(n===e||n.listener===e)0===--this._eventsCount?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===e||n[s].listener===e){o=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,r),1===n.length&&(i[t]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",t,o||e)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(t){var e,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var r,s=Object.keys(n);for(i=0;i<s.length;++i)"removeListener"!==(r=s[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):f.call(t,e)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},20:(t,e,n)=>{var i=n(649),r=Symbol.for("react.element"),s=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),o=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function a(t,e,n){var i,a={},h=null,c=null;for(i in void 0!==n&&(h=""+n),void 0!==e.key&&(h=""+e.key),void 0!==e.ref&&(c=e.ref),e)s.call(e,i)&&!l.hasOwnProperty(i)&&(a[i]=e[i]);if(t&&t.defaultProps)for(i in e=t.defaultProps)void 0===a[i]&&(a[i]=e[i]);return{$$typeof:r,type:t,key:h,ref:c,props:a,_owner:o.current}}e.jsx=a,e.jsxs=a},56:(t,e,n)=>{t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},72:t=>{var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var s={},o=[],l=0;l<t.length;l++){var a=t[l],h=i.base?a[0]+i.base:a[0],c=s[h]||0,u="".concat(h," ").concat(c);s[h]=c+1;var d=n(u),f={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==d)e[d].references++,e[d].updater(f);else{var p=r(f,i);i.byIndex=l,e.splice(l,0,{identifier:u,updater:p,references:1})}o.push(u)}return o}function r(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,r){var s=i(t=t||[],r=r||{});return function(t){t=t||[];for(var o=0;o<s.length;o++){var l=n(s[o]);e[l].references--}for(var a=i(t,r),h=0;h<s.length;h++){var c=n(s[h]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}s=a}}},113:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n}).join("")},e.i=function(t,n,i,r,s){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(i)for(var l=0;l<this.length;l++){var a=this[l][0];null!=a&&(o[a]=!0)}for(var h=0;h<t.length;h++){var c=[].concat(t[h]);i&&o[c[0]]||(void 0!==s&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=s),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),e.push(c))}},e}},354:t=>{t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(r," */");return[e].concat([s]).join("\n")}return[e].join("\n")}},467:(t,e,n)=>{t.exports=n(20)},520:(t,e,n)=>{n.d(e,{A:()=>l});var i=n(354),r=n.n(i),s=n(314),o=n.n(s)()(r());o.push([t.id,".task-testing__container{display:flex;flex-direction:row;height:100%;width:100%;padding:10px;font-size:14px}.task-testing__container.task-testing__container--empty .task-testing__container-no-config,.task-testing__container.task-testing__container--empty .task-testing__container-no-element{display:flex;align-items:center;gap:5px;height:32px}.task-testing__container.task-testing__container--empty .task-testing__container-no-config .cds--inline-loading,.task-testing__container.task-testing__container--empty .task-testing__container-no-element .cds--inline-loading{inline-size:initial;min-block-size:initial}.task-testing__container .task-testing__container--left{width:50%;display:flex;flex-direction:column;border-right:1px solid #e0e0e0;padding-right:6px}.task-testing__container .task-testing__container--right{width:50%;display:flex;flex-direction:column;padding-left:6px}.task-testing__container .task-testing__container--header{display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:12px;width:100%}.task-testing__container .task-testing__container--header .task-header{display:flex;gap:6px;min-width:0}.task-testing__container .task-testing__container--header .task-header .task-type{font-weight:bold}.task-testing__container .task-testing__container--header .task-header .task-type,.task-testing__container .task-testing__container--header .task-header .task-name{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex-shrink:1;flex-grow:1}.task-testing__container .task-testing__container--header .btn-execute{width:138px}.task-testing__container .task-testing__container--header .cds--tooltip-content{padding:12px}.task-testing__container .task-testing__container--header .cds--btn .cds--inline-loading{inline-size:initial;min-block-size:initial}.task-testing__container .input{flex-grow:1;display:flex;flex-direction:column;gap:5px;margin-top:6px}.task-testing__container .input .input__header{display:flex;align-items:center;gap:5px;width:100%;padding-top:5px}.task-testing__container .input .input__header--title{color:#525252}.task-testing__container .input .input__header--button-reset{margin-left:auto}.task-testing__container .output{flex-grow:1;display:flex;flex-direction:column;gap:5px}.task-testing__container .output .output__header{display:flex;align-items:center;justify-content:flex-end;height:32px;width:100%;gap:10px}.task-testing__container .output .output__header .cds--link{cursor:pointer}.task-testing__container .output .output__header .link--disabled,.task-testing__container .output .output__header .link--disabled:hover{color:#8d8d8d;text-decoration:none;cursor:default}.task-testing__container .output .output__header--title{color:#525252;display:flex;align-items:center;gap:6px;margin-right:auto}.task-testing__container .output .output__header--title svg.output__status-icon--ready{fill:#0043ce}.task-testing__container .output .output__header--title svg.output__status-icon--success{fill:#24a148}.task-testing__container .output .output__header--title svg.output__status-icon--error{fill:#da1e28}.task-testing__container .output .output__header--title .cds--inline-loading{inline-size:16px;min-block-size:initial}.task-testing__container .output .output__body{display:flex;flex-direction:column;flex-grow:1;position:relative}.task-testing__container .output .output__body .cds--tabs{--cds-layout-size-height-local: 32px}.task-testing__container .output .output__body .cds--tab-content{padding:0;height:calc(100% - 20px)}.task-testing__container .output .output__body .cds--tab-content:not([hidden]){display:flex}.task-testing__container .output .output__body .cds--popover{display:none}.task-testing__container .output .output__error{display:flex;flex-direction:column;gap:12px;padding:12px;margin-bottom:12px;border:1px solid #da1e28;border-left-width:3px;background-color:#fff1f1}.task-testing__container .output .output__error .output__error--title{display:flex;flex-direction:row;align-items:center;font-weight:bold}.task-testing__container .output .output__error .output__error--title svg{fill:#da1e28}.task-testing__container .output .output__error .output__error--title .output__error--action{margin-left:auto}.task-testing__container .output .output__variables--empty{height:32px;display:flex;align-items:center;color:#525252}.task-testing__container .output .output__variables--empty-action{font-weight:bold}.task-testing__container .output code{font-size:14px}.task-testing__container .cds--popover-container:not(.show-tooltip) .cds--popover{display:none !important}.task-testing__container .cds--link[role=button]{cursor:pointer}.code__editor{position:relative;flex-grow:1;display:flex;flex-direction:column}.code__editor.code__editor--error .code__editor-codemirror .code__editor-codemirror-inner .cm-editor{outline:1px solid #da1e28;outline-offset:-1px}.code__editor .code__editor-codemirror{position:relative;flex-grow:1}.code__editor .code__editor-codemirror .code__editor-codemirror-inner{position:absolute;top:0;left:0;right:0;bottom:0}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .cm-editor{height:100%;background-color:var(--cds-layer, #f4f4f4)}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .cm-scroller{overflow-y:auto !important}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .cm-content{padding:15px}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .cm-focused{outline:none}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .cm-tooltip{font-size:14px}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .info{padding:5px;font-family:monospace;font-size:12px;max-width:300px;word-wrap:break-word}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .info span{font-style:italic}.code__editor .code__editor-codemirror .code__editor-codemirror-inner .info pre{margin-top:5px}.code__editor .code__editor-error{color:#da1e28;font-size:13px;margin-top:5px}.code__editor .code__editor-copy-button{position:absolute;top:10px;right:10px;z-index:10}.code__editor .code__editor-copy-button svg{fill:#525252}","",{version:3,sources:["webpack://./lib/style/style.scss"],names:[],mappings:"AAAA,yBACE,YAAA,CACA,kBAAA,CACA,WAAA,CACA,UAAA,CACA,YAAA,CACA,cAAA,CAGE,uLAEE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,WAAA,CAEA,iOACE,mBAAA,CACA,sBAAA,CAKN,wDACE,SAAA,CACA,YAAA,CACA,qBAAA,CACA,8BAAA,CACA,iBAAA,CAGF,yDACE,SAAA,CACA,YAAA,CACA,qBAAA,CACA,gBAAA,CAGF,0DACE,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,6BAAA,CACA,QAAA,CACA,UAAA,CAEA,uEACE,YAAA,CACA,OAAA,CACA,WAAA,CAEA,kFACE,gBAAA,CAGF,oKAEE,WAAA,CACA,eAAA,CACA,kBAAA,CACA,sBAAA,CACA,aAAA,CACA,WAAA,CAIJ,uEACE,WAAA,CAIF,gFACE,YAAA,CAGF,yFACE,mBAAA,CACA,sBAAA,CAIJ,gCACE,WAAA,CACA,YAAA,CACA,qBAAA,CACA,OAAA,CACA,cAAA,CAEA,+CACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,UAAA,CACA,eAAA,CAGF,sDACE,aAAA,CAGF,6DACE,gBAAA,CAIJ,iCACE,WAAA,CACA,YAAA,CACA,qBAAA,CACA,OAAA,CAEA,iDACE,YAAA,CACA,kBAAA,CACA,wBAAA,CACA,WAAA,CACA,UAAA,CACA,QAAA,CAEA,4DACE,cAAA,CAGF,wIACE,aAAA,CACA,oBAAA,CACA,cAAA,CAIJ,wDACE,aAAA,CACA,YAAA,CACA,kBAAA,CACA,OAAA,CACA,iBAAA,CAEA,uFACE,YAAA,CAGF,yFACE,YAAA,CAGF,uFACE,YAAA,CAGF,6EACE,gBAAA,CACA,sBAAA,CAIJ,+CACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,iBAAA,CAEA,0DACE,oCAAA,CAGF,iEACE,SAAA,CACA,wBAAA,CAGF,+EACE,YAAA,CAIF,6DACE,YAAA,CAIJ,gDACE,YAAA,CACA,qBAAA,CACA,QAAA,CACA,YAAA,CACA,kBAAA,CACA,wBAAA,CACA,qBAAA,CACA,wBAAA,CAEA,sEACE,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,gBAAA,CAEA,0EACE,YAAA,CAGF,6FACE,gBAAA,CAKN,2DACE,WAAA,CACA,YAAA,CACA,kBAAA,CACA,aAAA,CAGF,kEACE,gBAAA,CAGF,sCACE,cAAA,CAIJ,kFACE,uBAAA,CAGF,iDACE,cAAA,CAIJ,cACE,iBAAA,CACA,WAAA,CACA,YAAA,CACA,qBAAA,CAEA,qGACE,yBAAA,CACA,mBAAA,CAGF,uCACE,iBAAA,CACA,WAAA,CAEA,sEACE,iBAAA,CACA,KAAA,CACA,MAAA,CACA,OAAA,CACA,QAAA,CAEA,iFACE,WAAA,CACA,0CAAA,CAGF,mFACE,0BAAA,CAGF,kFACE,YAAA,CAGF,kFACE,YAAA,CAGF,kFACE,cAAA,CAGF,4EACE,WAAA,CACA,qBAAA,CACA,cAAA,CACA,eAAA,CACA,oBAAA,CAEA,iFACE,iBAAA,CAGF,gFACE,cAAA,CAMR,kCACE,aAAA,CACA,cAAA,CACA,cAAA,CAGF,wCACE,iBAAA,CACA,QAAA,CACA,UAAA,CACA,UAAA,CAEA,4CACE,YAAA",sourcesContent:['.task-testing__container {\n display: flex;\n flex-direction: row;\n height: 100%;\n width: 100%;\n padding: 10px;\n font-size: 14px;\n\n &.task-testing__container--empty {\n .task-testing__container-no-config,\n .task-testing__container-no-element {\n display: flex;\n align-items: center;\n gap: 5px;\n height: 32px;\n\n .cds--inline-loading {\n inline-size: initial;\n min-block-size: initial;\n }\n }\n }\n\n .task-testing__container--left {\n width: 50%;\n display: flex;\n flex-direction: column;\n border-right: 1px solid #E0E0E0;\n padding-right: 6px;\n }\n\n .task-testing__container--right {\n width: 50%;\n display: flex;\n flex-direction: column;\n padding-left: 6px;\n }\n\n .task-testing__container--header {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n width: 100%;\n\n .task-header {\n display: flex;\n gap: 6px;\n min-width: 0;\n \n .task-type {\n font-weight: bold;\n }\n\n .task-type,\n .task-name {\n min-width: 0;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n flex-shrink: 1;\n flex-grow: 1;\n }\n }\n\n .btn-execute {\n width: 138px;\n }\n\n\n .cds--tooltip-content {\n padding: 12px;\n }\n\n .cds--btn .cds--inline-loading {\n inline-size: initial;\n min-block-size: initial;\n }\n }\n\n .input {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 5px;\n margin-top: 6px;\n\n .input__header {\n display: flex;\n align-items: center;\n gap: 5px;\n width: 100%;\n padding-top: 5px;\n }\n\n .input__header--title {\n color: #525252;\n }\n\n .input__header--button-reset {\n margin-left: auto;\n }\n }\n\n .output {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 5px;\n\n .output__header {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n height: 32px;\n width: 100%;\n gap: 10px;\n\n .cds--link {\n cursor: pointer;\n }\n\n .link--disabled, .link--disabled:hover {\n color: #8d8d8d;\n text-decoration: none;\n cursor: default;\n }\n }\n\n .output__header--title {\n color: #525252;\n display: flex;\n align-items: center;\n gap: 6px;\n margin-right: auto;\n\n svg.output__status-icon--ready {\n fill: #0043ce;\n }\n\n svg.output__status-icon--success {\n fill: #24a148;\n }\n\n svg.output__status-icon--error {\n fill: #da1e28;\n }\n\n .cds--inline-loading {\n inline-size: 16px;\n min-block-size: initial;\n }\n }\n\n .output__body {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n position: relative;\n\n .cds--tabs {\n --cds-layout-size-height-local: 32px;\n }\n \n .cds--tab-content {\n padding: 0;\n height: calc(100% - 20px);\n }\n\n .cds--tab-content:not([hidden]) {\n display: flex;\n }\n\n // Tooltip on Carbon Button with absolute position is broken.\n .cds--popover {\n display: none;\n }\n }\n\n .output__error {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 12px;\n margin-bottom: 12px;\n border: 1px solid #da1e28;\n border-left-width: 3px;\n background-color: #fff1f1;\n\n .output__error--title {\n display: flex;\n flex-direction: row;\n align-items: center;\n font-weight: bold;\n\n svg {\n fill: #da1e28;\n }\n\n .output__error--action {\n margin-left: auto;\n }\n }\n }\n\n .output__variables--empty {\n height: 32px;\n display: flex;\n align-items: center;\n color: #525252;\n }\n\n .output__variables--empty-action {\n font-weight: bold;\n }\n\n code {\n font-size: 14px;\n }\n }\n\n .cds--popover-container:not(.show-tooltip) .cds--popover {\n display: none !important;\n }\n\n .cds--link[role="button"] {\n cursor: pointer;\n }\n}\n\n.code__editor {\n position: relative;\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n\n &.code__editor--error .code__editor-codemirror .code__editor-codemirror-inner .cm-editor {\n outline: 1px solid #da1e28;\n outline-offset: -1px;\n }\n\n .code__editor-codemirror {\n position: relative;\n flex-grow: 1;\n\n .code__editor-codemirror-inner {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n\n .cm-editor {\n height: 100%;\n background-color: var(--cds-layer, #f4f4f4);\n }\n\n .cm-scroller {\n overflow-y: auto !important;\n }\n\n .cm-content {\n padding: 15px;\n }\n\n .cm-focused {\n outline: none;\n }\n\n .cm-tooltip {\n font-size: 14px;\n }\n\n .info {\n padding: 5px;\n font-family: monospace;\n font-size: 12px;\n max-width: 300px;\n word-wrap: break-word;\n\n span {\n font-style: italic;\n }\n\n pre {\n margin-top: 5px;\n }\n }\n }\n }\n\n .code__editor-error {\n color: #da1e28;\n font-size: 13px;\n margin-top: 5px;\n }\n\n .code__editor-copy-button {\n position: absolute;\n top: 10px;\n right: 10px;\n z-index: 10;\n\n svg {\n fill: #525252;\n }\n }\n}'],sourceRoot:""}]);const l=o},540:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},633:(t,e,n)=>{var i=n(649);function r(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=Object.prototype.hasOwnProperty,o=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,l={},a={};function h(t){return!!s.call(a,t)||!s.call(l,t)&&(o.test(t)?a[t]=!0:(l[t]=!0,!1))}function c(t,e,n,i,r,s,o){this.acceptsBooleans=2===e||3===e||4===e,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var u={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){u[t]=new c(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];u[e]=new c(e,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){u[t]=new c(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){u[t]=new c(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){u[t]=new c(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){u[t]=new c(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){u[t]=new c(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){u[t]=new c(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){u[t]=new c(t,5,!1,t.toLowerCase(),null,!1,!1)});var d=/[\-:]([a-z])/g;function f(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(d,f);u[e]=new c(e,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(d,f);u[e]=new c(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(d,f);u[e]=new c(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){u[t]=new c(t,1,!1,t.toLowerCase(),null,!1,!1)}),u.xlinkHref=new c("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){u[t]=new c(t,1,!1,t.toLowerCase(),null,!0,!0)});var p={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},g=["Webkit","ms","Moz","O"];Object.keys(p).forEach(function(t){g.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),p[e]=p[t]})});var m=/["'&<>]/;function v(t){if("boolean"==typeof t||"number"==typeof t)return""+t;t=""+t;var e=m.exec(t);if(e){var n,i="",r=0;for(n=e.index;n<t.length;n++){switch(t.charCodeAt(n)){case 34:e=""";break;case 38:e="&";break;case 39:e="'";break;case 60:e="<";break;case 62:e=">";break;default:continue}r!==n&&(i+=t.substring(r,n)),r=n+1,i+=e}t=r!==n?i+t.substring(r,n):i}return t}var b=/([A-Z])/g,y=/^ms-/,w=Array.isArray;function x(t,e){return{insertionMode:t,selectedValue:e}}var k=new Map;function A(t,e,n){if("object"!=typeof n)throw Error(r(62));for(var i in e=!0,n)if(s.call(n,i)){var o=n[i];if(null!=o&&"boolean"!=typeof o&&""!==o){if(0===i.indexOf("--")){var l=v(i);o=v((""+o).trim())}else{l=i;var a=k.get(l);void 0!==a||(a=v(l.replace(b,"-$1").toLowerCase().replace(y,"-ms-")),k.set(l,a)),l=a,o="number"==typeof o?0===o||s.call(p,i)?""+o:o+"px":v((""+o).trim())}e?(e=!1,t.push(' style="',l,":",o)):t.push(";",l,":",o)}}e||t.push('"')}function S(t,e,n,i){switch(n){case"style":return void A(t,e,i);case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":return}if(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])if(null!==(e=u.hasOwnProperty(n)?u[n]:null)){switch(typeof i){case"function":case"symbol":return;case"boolean":if(!e.acceptsBooleans)return}switch(n=e.attributeName,e.type){case 3:i&&t.push(" ",n,'=""');break;case 4:!0===i?t.push(" ",n,'=""'):!1!==i&&t.push(" ",n,'="',v(i),'"');break;case 5:isNaN(i)||t.push(" ",n,'="',v(i),'"');break;case 6:!isNaN(i)&&1<=i&&t.push(" ",n,'="',v(i),'"');break;default:e.sanitizeURL&&(i=""+i),t.push(" ",n,'="',v(i),'"')}}else if(h(n)){switch(typeof i){case"function":case"symbol":return;case"boolean":if("data-"!==(e=n.toLowerCase().slice(0,5))&&"aria-"!==e)return}t.push(" ",n,'="',v(i),'"')}}function C(t,e,n){if(null!=e){if(null!=n)throw Error(r(60));if("object"!=typeof e||!("__html"in e))throw Error(r(61));null!=(e=e.__html)&&t.push(""+e)}}function E(t,e,n,i){t.push(M(n));var r,o=n=null;for(r in e)if(s.call(e,r)){var l=e[r];if(null!=l)switch(r){case"children":n=l;break;case"dangerouslySetInnerHTML":o=l;break;default:S(t,i,r,l)}}return t.push(">"),C(t,o,n),"string"==typeof n?(t.push(v(n)),null):n}var T=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,O=new Map;function M(t){var e=O.get(t);if(void 0===e){if(!T.test(t))throw Error(r(65,t));e="<"+t,O.set(t,e)}return e}function _(t,e,n){if(t.push('\x3c!--$?--\x3e<template id="'),null===n)throw Error(r(395));return t.push(n),t.push('"></template>')}var P=/[<\u2028\u2029]/g;function D(t){return JSON.stringify(t).replace(P,function(t){switch(t){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}function R(t,e,n,i){return n.generateStaticMarkup?(t.push(v(e)),!1):(""===e?t=i:(i&&t.push("\x3c!-- --\x3e"),t.push(v(e)),t=!0),t)}var B=Object.assign,I=Symbol.for("react.element"),N=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),z=Symbol.for("react.provider"),j=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),K=Symbol.for("react.scope"),G=Symbol.for("react.debug_trace_mode"),Y=Symbol.for("react.legacy_hidden"),Q=Symbol.for("react.default_value"),J=Symbol.iterator;function X(t){if(null==t)return null;if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case L:return"Fragment";case N:return"Portal";case V:return"Profiler";case F:return"StrictMode";case W:return"Suspense";case $:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case j:return(t.displayName||"Context")+".Consumer";case z:return(t._context.displayName||"Context")+".Provider";case H:var e=t.render;return(t=t.displayName)||(t=""!==(t=e.displayName||e.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case q:return null!==(e=t.displayName||null)?e:X(t.type)||"Memo";case U:e=t._payload,t=t._init;try{return X(t(e))}catch(t){}}return null}var Z={};function tt(t,e){if(!(t=t.contextTypes))return Z;var n,i={};for(n in t)i[n]=e[n];return i}var et=null;function nt(t,e){if(t!==e){t.context._currentValue2=t.parentValue,t=t.parent;var n=e.parent;if(null===t){if(null!==n)throw Error(r(401))}else{if(null===n)throw Error(r(401));nt(t,n)}e.context._currentValue2=e.value}}function it(t){t.context._currentValue2=t.parentValue,null!==(t=t.parent)&&it(t)}function rt(t){var e=t.parent;null!==e&&rt(e),t.context._currentValue2=t.value}function st(t,e){if(t.context._currentValue2=t.parentValue,null===(t=t.parent))throw Error(r(402));t.depth===e.depth?nt(t,e):st(t,e)}function ot(t,e){var n=e.parent;if(null===n)throw Error(r(402));t.depth===n.depth?nt(t,n):ot(t,n),e.context._currentValue2=e.value}function lt(t){var e=et;e!==t&&(null===e?rt(t):null===t?it(e):e.depth===t.depth?nt(e,t):e.depth>t.depth?st(e,t):ot(e,t),et=t)}var at={isMounted:function(){return!1},enqueueSetState:function(t,e){null!==(t=t._reactInternals).queue&&t.queue.push(e)},enqueueReplaceState:function(t,e){(t=t._reactInternals).replace=!0,t.queue=[e]},enqueueForceUpdate:function(){}};function ht(t,e,n,i){var r=void 0!==t.state?t.state:null;t.updater=at,t.props=n,t.state=r;var s={queue:[],replace:!1};t._reactInternals=s;var o=e.contextType;if(t.context="object"==typeof o&&null!==o?o._currentValue2:i,"function"==typeof(o=e.getDerivedStateFromProps)&&(r=null==(o=o(n,r))?r:B({},r,o),t.state=r),"function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate&&("function"==typeof t.UNSAFE_componentWillMount||"function"==typeof t.componentWillMount))if(e=t.state,"function"==typeof t.componentWillMount&&t.componentWillMount(),"function"==typeof t.UNSAFE_componentWillMount&&t.UNSAFE_componentWillMount(),e!==t.state&&at.enqueueReplaceState(t,t.state,null),null!==s.queue&&0<s.queue.length)if(e=s.queue,o=s.replace,s.queue=null,s.replace=!1,o&&1===e.length)t.state=e[0];else{for(s=o?e[0]:t.state,r=!0,o=o?1:0;o<e.length;o++){var l=e[o];null!=(l="function"==typeof l?l.call(t,s,n,i):l)&&(r?(r=!1,s=B({},s,l)):B(s,l))}t.state=s}else s.queue=null}var ct={id:1,overflow:""};function ut(t,e,n){var i=t.id;t=t.overflow;var r=32-dt(i)-1;i&=~(1<<r),n+=1;var s=32-dt(e)+r;if(30<s){var o=r-r%5;return s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,{id:1<<32-dt(e)+r|n<<r|i,overflow:s+t}}return{id:1<<s|n<<r|i,overflow:t}}var dt=Math.clz32?Math.clz32:function(t){return 0==(t>>>=0)?32:31-(ft(t)/pt|0)|0},ft=Math.log,pt=Math.LN2,gt="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},mt=null,vt=null,bt=null,yt=null,wt=!1,xt=!1,kt=0,At=null,St=0;function Ct(){if(null===mt)throw Error(r(321));return mt}function Et(){if(0<St)throw Error(r(312));return{memoizedState:null,queue:null,next:null}}function Tt(){return null===yt?null===bt?(wt=!1,bt=yt=Et()):(wt=!0,yt=bt):null===yt.next?(wt=!1,yt=yt.next=Et()):(wt=!0,yt=yt.next),yt}function Ot(){vt=mt=null,xt=!1,bt=null,St=0,yt=At=null}function Mt(t,e){return"function"==typeof e?e(t):e}function _t(t,e,n){if(mt=Ct(),yt=Tt(),wt){var i=yt.queue;if(e=i.dispatch,null!==At&&void 0!==(n=At.get(i))){At.delete(i),i=yt.memoizedState;do{i=t(i,n.action),n=n.next}while(null!==n);return yt.memoizedState=i,[i,e]}return[yt.memoizedState,e]}return t=t===Mt?"function"==typeof e?e():e:void 0!==n?n(e):e,yt.memoizedState=t,t=(t=yt.queue={last:null,dispatch:null}).dispatch=Dt.bind(null,mt,t),[yt.memoizedState,t]}function Pt(t,e){if(mt=Ct(),e=void 0===e?null:e,null!==(yt=Tt())){var n=yt.memoizedState;if(null!==n&&null!==e){var i=n[1];t:if(null===i)i=!1;else{for(var r=0;r<i.length&&r<e.length;r++)if(!gt(e[r],i[r])){i=!1;break t}i=!0}if(i)return n[0]}}return t=t(),yt.memoizedState=[t,e],t}function Dt(t,e,n){if(25<=St)throw Error(r(301));if(t===mt)if(xt=!0,t={action:n,next:null},null===At&&(At=new Map),void 0===(n=At.get(e)))At.set(e,t);else{for(e=n;null!==e.next;)e=e.next;e.next=t}}function Rt(){throw Error(r(394))}function Bt(){}var It={readContext:function(t){return t._currentValue2},useContext:function(t){return Ct(),t._currentValue2},useMemo:Pt,useReducer:_t,useRef:function(t){mt=Ct();var e=(yt=Tt()).memoizedState;return null===e?(t={current:t},yt.memoizedState=t):e},useState:function(t){return _t(Mt,t)},useInsertionEffect:Bt,useLayoutEffect:function(){},useCallback:function(t,e){return Pt(function(){return t},e)},useImperativeHandle:Bt,useEffect:Bt,useDebugValue:Bt,useDeferredValue:function(t){return Ct(),t},useTransition:function(){return Ct(),[!1,Rt]},useId:function(){var t=vt.treeContext,e=t.overflow;t=((t=t.id)&~(1<<32-dt(t)-1)).toString(32)+e;var n=Nt;if(null===n)throw Error(r(404));return e=kt++,t=":"+n.idPrefix+"R"+t,0<e&&(t+="H"+e.toString(32)),t+":"},useMutableSource:function(t,e){return Ct(),e(t._source)},useSyncExternalStore:function(t,e,n){if(void 0===n)throw Error(r(407));return n()}},Nt=null,Lt=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;function Ft(t){return console.error(t),null}function Vt(){}function zt(t,e,n,i,r,s,o,l){t.allPendingTasks++,null===n?t.pendingRootTasks++:n.pendingTasks++;var a={node:e,ping:function(){var e=t.pingedTasks;e.push(a),1===e.length&&ee(t)},blockedBoundary:n,blockedSegment:i,abortSet:r,legacyContext:s,context:o,treeContext:l};return r.add(a),a}function jt(t,e,n,i,r,s){return{status:0,id:-1,index:e,parentFlushed:!1,chunks:[],children:[],formatContext:i,boundary:n,lastPushedText:r,textEmbedded:s}}function Ht(t,e){if(null!=(t=t.onError(e))&&"string"!=typeof t)throw Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "'+typeof t+'" instead');return t}function Wt(t,e){var n=t.onShellError;n(e),(n=t.onFatalError)(e),null!==t.destination?(t.status=2,t.destination.destroy(e)):(t.status=1,t.fatalError=e)}function $t(t,e,n,i,r){for(mt={},vt=e,kt=0,t=n(i,r);xt;)xt=!1,kt=0,St+=1,yt=null,t=n(i,r);return Ot(),t}function qt(t,e,n,i){var s=n.render(),o=i.childContextTypes;if(null!=o){var l=e.legacyContext;if("function"!=typeof n.getChildContext)i=l;else{for(var a in n=n.getChildContext())if(!(a in o))throw Error(r(108,X(i)||"Unknown",a));i=B({},l,n)}e.legacyContext=i,Gt(t,e,s),e.legacyContext=l}else Gt(t,e,s)}function Ut(t,e){if(t&&t.defaultProps){for(var n in e=B({},e),t=t.defaultProps)void 0===e[n]&&(e[n]=t[n]);return e}return e}function Kt(t,e,n,o,l){if("function"==typeof n)if(n.prototype&&n.prototype.isReactComponent){l=tt(n,e.legacyContext);var a=n.contextType;ht(a=new n(o,"object"==typeof a&&null!==a?a._currentValue2:l),n,o,l),qt(t,e,a,n)}else{l=$t(t,e,n,o,a=tt(n,e.legacyContext));var c=0!==kt;if("object"==typeof l&&null!==l&&"function"==typeof l.render&&void 0===l.$$typeof)ht(l,n,o,a),qt(t,e,l,n);else if(c){o=e.treeContext,e.treeContext=ut(o,1,0);try{Gt(t,e,l)}finally{e.treeContext=o}}else Gt(t,e,l)}else{if("string"!=typeof n){switch(n){case Y:case G:case F:case V:case L:case $:return void Gt(t,e,o.children);case K:throw Error(r(343));case W:t:{n=e.blockedBoundary,l=e.blockedSegment,a=o.fallback,o=o.children;var u={id:null,rootSegmentID:-1,parentFlushed:!1,pendingTasks:0,forceClientRender:!1,completedSegments:[],byteSize:0,fallbackAbortableTasks:c=new Set,errorDigest:null},d=jt(0,l.chunks.length,u,l.formatContext,!1,!1);l.children.push(d),l.lastPushedText=!1;var f=jt(0,0,null,l.formatContext,!1,!1);f.parentFlushed=!0,e.blockedBoundary=u,e.blockedSegment=f;try{if(Qt(t,e,o),t.responseState.generateStaticMarkup||f.lastPushedText&&f.textEmbedded&&f.chunks.push("\x3c!-- --\x3e"),f.status=1,Zt(u,f),0===u.pendingTasks)break t}catch(e){f.status=4,u.forceClientRender=!0,u.errorDigest=Ht(t,e)}finally{e.blockedBoundary=n,e.blockedSegment=l}e=zt(t,a,n,d,c,e.legacyContext,e.context,e.treeContext),t.pingedTasks.push(e)}return}if("object"==typeof n&&null!==n)switch(n.$$typeof){case H:if(o=$t(t,e,n.render,o,l),0!==kt){n=e.treeContext,e.treeContext=ut(n,1,0);try{Gt(t,e,o)}finally{e.treeContext=n}}else Gt(t,e,o);return;case q:return void Kt(t,e,n=n.type,o=Ut(n,o),l);case z:if(l=o.children,n=n._context,o=o.value,a=n._currentValue2,n._currentValue2=o,et=o={parent:c=et,depth:null===c?0:c.depth+1,context:n,parentValue:a,value:o},e.context=o,Gt(t,e,l),null===(t=et))throw Error(r(403));return o=t.parentValue,t.context._currentValue2=o===Q?t.context._defaultValue:o,t=et=t.parent,void(e.context=t);case j:return void Gt(t,e,o=(o=o.children)(n._currentValue2));case U:return void Kt(t,e,n=(l=n._init)(n._payload),o=Ut(n,o),void 0)}throw Error(r(130,null==n?n:typeof n,""))}switch(a=function(t,e,n,o,l){switch(e){case"select":t.push(M("select"));var a=null,c=null;for(p in n)if(s.call(n,p)){var u=n[p];if(null!=u)switch(p){case"children":a=u;break;case"dangerouslySetInnerHTML":c=u;break;case"defaultValue":case"value":break;default:S(t,o,p,u)}}return t.push(">"),C(t,c,a),a;case"option":c=l.selectedValue,t.push(M("option"));var d=u=null,f=null,p=null;for(a in n)if(s.call(n,a)){var g=n[a];if(null!=g)switch(a){case"children":u=g;break;case"selected":f=g;break;case"dangerouslySetInnerHTML":p=g;break;case"value":d=g;default:S(t,o,a,g)}}if(null!=c)if(n=null!==d?""+d:function(t){var e="";return i.Children.forEach(t,function(t){null!=t&&(e+=t)}),e}(u),w(c)){for(o=0;o<c.length;o++)if(""+c[o]===n){t.push(' selected=""');break}}else""+c===n&&t.push(' selected=""');else f&&t.push(' selected=""');return t.push(">"),C(t,p,u),u;case"textarea":for(u in t.push(M("textarea")),p=c=a=null,n)if(s.call(n,u)&&null!=(d=n[u]))switch(u){case"children":p=d;break;case"value":a=d;break;case"defaultValue":c=d;break;case"dangerouslySetInnerHTML":throw Error(r(91));default:S(t,o,u,d)}if(null===a&&null!==c&&(a=c),t.push(">"),null!=p){if(null!=a)throw Error(r(92));if(w(p)&&1<p.length)throw Error(r(93));a=""+p}return"string"==typeof a&&"\n"===a[0]&&t.push("\n"),null!==a&&t.push(v(""+a)),null;case"input":for(c in t.push(M("input")),d=p=u=a=null,n)if(s.call(n,c)&&null!=(f=n[c]))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,"input"));case"defaultChecked":d=f;break;case"defaultValue":u=f;break;case"checked":p=f;break;case"value":a=f;break;default:S(t,o,c,f)}return null!==p?S(t,o,"checked",p):null!==d&&S(t,o,"checked",d),null!==a?S(t,o,"value",a):null!==u&&S(t,o,"value",u),t.push("/>"),null;case"menuitem":for(var m in t.push(M("menuitem")),n)if(s.call(n,m)&&null!=(a=n[m]))switch(m){case"children":case"dangerouslySetInnerHTML":throw Error(r(400));default:S(t,o,m,a)}return t.push(">"),null;case"title":for(g in t.push(M("title")),a=null,n)if(s.call(n,g)&&null!=(c=n[g]))switch(g){case"children":a=c;break;case"dangerouslySetInnerHTML":throw Error(r(434));default:S(t,o,g,c)}return t.push(">"),a;case"listing":case"pre":for(d in t.push(M(e)),c=a=null,n)if(s.call(n,d)&&null!=(u=n[d]))switch(d){case"children":a=u;break;case"dangerouslySetInnerHTML":c=u;break;default:S(t,o,d,u)}if(t.push(">"),null!=c){if(null!=a)throw Error(r(60));if("object"!=typeof c||!("__html"in c))throw Error(r(61));null!=(n=c.__html)&&("string"==typeof n&&0<n.length&&"\n"===n[0]?t.push("\n",n):t.push(""+n))}return"string"==typeof a&&"\n"===a[0]&&t.push("\n"),a;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":for(var b in t.push(M(e)),n)if(s.call(n,b)&&null!=(a=n[b]))switch(b){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,e));default:S(t,o,b,a)}return t.push("/>"),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return E(t,n,e,o);case"html":return 0===l.insertionMode&&t.push("<!DOCTYPE html>"),E(t,n,e,o);default:if(-1===e.indexOf("-")&&"string"!=typeof n.is)return E(t,n,e,o);for(f in t.push(M(e)),c=a=null,n)if(s.call(n,f)&&null!=(u=n[f]))switch(f){case"children":a=u;break;case"dangerouslySetInnerHTML":c=u;break;case"style":A(t,o,u);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:h(f)&&"function"!=typeof u&&"symbol"!=typeof u&&t.push(" ",f,'="',v(u),'"')}return t.push(">"),C(t,c,a),a}}((l=e.blockedSegment).chunks,n,o,t.responseState,l.formatContext),l.lastPushedText=!1,c=l.formatContext,l.formatContext=function(t,e,n){switch(e){case"select":return x(1,null!=n.value?n.value:n.defaultValue);case"svg":return x(2,null);case"math":return x(3,null);case"foreignObject":return x(1,null);case"table":return x(4,null);case"thead":case"tbody":case"tfoot":return x(5,null);case"colgroup":return x(7,null);case"tr":return x(6,null)}return 4<=t.insertionMode||0===t.insertionMode?x(1,null):t}(c,n,o),Qt(t,e,a),l.formatContext=c,n){case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"input":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":break;default:l.chunks.push("</",n,">")}l.lastPushedText=!1}}function Gt(t,e,n){if(e.node=n,"object"==typeof n&&null!==n){switch(n.$$typeof){case I:return void Kt(t,e,n.type,n.props,n.ref);case N:throw Error(r(257));case U:var i=n._init;return void Gt(t,e,n=i(n._payload))}if(w(n))return void Yt(t,e,n);if((i=null===n||"object"!=typeof n?null:"function"==typeof(i=J&&n[J]||n["@@iterator"])?i:null)&&(i=i.call(n))){if(!(n=i.next()).done){var s=[];do{s.push(n.value),n=i.next()}while(!n.done);Yt(t,e,s)}return}throw t=Object.prototype.toString.call(n),Error(r(31,"[object Object]"===t?"object with keys {"+Object.keys(n).join(", ")+"}":t))}"string"==typeof n?(i=e.blockedSegment).lastPushedText=R(e.blockedSegment.chunks,n,t.responseState,i.lastPushedText):"number"==typeof n&&((i=e.blockedSegment).lastPushedText=R(e.blockedSegment.chunks,""+n,t.responseState,i.lastPushedText))}function Yt(t,e,n){for(var i=n.length,r=0;r<i;r++){var s=e.treeContext;e.treeContext=ut(s,i,r);try{Qt(t,e,n[r])}finally{e.treeContext=s}}}function Qt(t,e,n){var i=e.blockedSegment.formatContext,r=e.legacyContext,s=e.context;try{return Gt(t,e,n)}catch(a){if(Ot(),"object"!=typeof a||null===a||"function"!=typeof a.then)throw e.blockedSegment.formatContext=i,e.legacyContext=r,e.context=s,lt(s),a;n=a;var o=e.blockedSegment,l=jt(0,o.chunks.length,null,o.formatContext,o.lastPushedText,!0);o.children.push(l),o.lastPushedText=!1,t=zt(t,e.node,e.blockedBoundary,l,e.abortSet,e.legacyContext,e.context,e.treeContext).ping,n.then(t,t),e.blockedSegment.formatContext=i,e.legacyContext=r,e.context=s,lt(s)}}function Jt(t){var e=t.blockedBoundary;(t=t.blockedSegment).status=3,te(this,e,t)}function Xt(t,e,n){var i=t.blockedBoundary;t.blockedSegment.status=3,null===i?(e.allPendingTasks--,2!==e.status&&(e.status=2,null!==e.destination&&e.destination.push(null))):(i.pendingTasks--,i.forceClientRender||(i.forceClientRender=!0,t=void 0===n?Error(r(432)):n,i.errorDigest=e.onError(t),i.parentFlushed&&e.clientRenderedBoundaries.push(i)),i.fallbackAbortableTasks.forEach(function(t){return Xt(t,e,n)}),i.fallbackAbortableTasks.clear(),e.allPendingTasks--,0===e.allPendingTasks&&(i=e.onAllReady)())}function Zt(t,e){if(0===e.chunks.length&&1===e.children.length&&null===e.children[0].boundary){var n=e.children[0];n.id=e.id,n.parentFlushed=!0,1===n.status&&Zt(t,n)}else t.completedSegments.push(e)}function te(t,e,n){if(null===e){if(n.parentFlushed){if(null!==t.completedRootSegment)throw Error(r(389));t.completedRootSegment=n}t.pendingRootTasks--,0===t.pendingRootTasks&&(t.onShellError=Vt,(e=t.onShellReady)())}else e.pendingTasks--,e.forceClientRender||(0===e.pendingTasks?(n.parentFlushed&&1===n.status&&Zt(e,n),e.parentFlushed&&t.completedBoundaries.push(e),e.fallbackAbortableTasks.forEach(Jt,t),e.fallbackAbortableTasks.clear()):n.parentFlushed&&1===n.status&&(Zt(e,n),1===e.completedSegments.length&&e.parentFlushed&&t.partialBoundaries.push(e)));t.allPendingTasks--,0===t.allPendingTasks&&(t=t.onAllReady)()}function ee(t){if(2!==t.status){var e=et,n=Lt.current;Lt.current=It;var i=Nt;Nt=t.responseState;try{var r,s=t.pingedTasks;for(r=0;r<s.length;r++){var o=s[r],l=t,a=o.blockedSegment;if(0===a.status){lt(o.context);try{Gt(l,o,o.node),l.responseState.generateStaticMarkup||a.lastPushedText&&a.textEmbedded&&a.chunks.push("\x3c!-- --\x3e"),o.abortSet.delete(o),a.status=1,te(l,o.blockedBoundary,a)}catch(t){if(Ot(),"object"==typeof t&&null!==t&&"function"==typeof t.then){var h=o.ping;t.then(h,h)}else{o.abortSet.delete(o),a.status=4;var c=o.blockedBoundary,u=t,d=Ht(l,u);null===c?Wt(l,u):(c.pendingTasks--,c.forceClientRender||(c.forceClientRender=!0,c.errorDigest=d,c.parentFlushed&&l.clientRenderedBoundaries.push(c))),l.allPendingTasks--,0===l.allPendingTasks&&(0,l.onAllReady)()}}}}s.splice(0,r),null!==t.destination&&le(t,t.destination)}catch(e){Ht(t,e),Wt(t,e)}finally{Nt=i,Lt.current=n,n===It&<(e)}}}function ne(t,e,n){switch(n.parentFlushed=!0,n.status){case 0:var i=n.id=t.nextSegmentId++;return n.lastPushedText=!1,n.textEmbedded=!1,t=t.responseState,e.push('<template id="'),e.push(t.placeholderPrefix),t=i.toString(16),e.push(t),e.push('"></template>');case 1:n.status=2;var s=!0;i=n.chunks;var o=0;n=n.children;for(var l=0;l<n.length;l++){for(s=n[l];o<s.index;o++)e.push(i[o]);s=ie(t,e,s)}for(;o<i.length-1;o++)e.push(i[o]);return o<i.length&&(s=e.push(i[o])),s;default:throw Error(r(390))}}function ie(t,e,n){var i=n.boundary;if(null===i)return ne(t,e,n);if(i.parentFlushed=!0,i.forceClientRender)return t.responseState.generateStaticMarkup||(i=i.errorDigest,e.push("\x3c!--$!--\x3e"),e.push("<template"),i&&(e.push(' data-dgst="'),i=v(i),e.push(i),e.push('"')),e.push("></template>")),ne(t,e,n),!!t.responseState.generateStaticMarkup||e.push("\x3c!--/$--\x3e");if(0<i.pendingTasks){i.rootSegmentID=t.nextSegmentId++,0<i.completedSegments.length&&t.partialBoundaries.push(i);var s=t.responseState,o=s.nextSuspenseID++;return s=s.boundaryPrefix+o.toString(16),i=i.id=s,_(e,t.responseState,i),ne(t,e,n),e.push("\x3c!--/$--\x3e")}if(i.byteSize>t.progressiveChunkSize)return i.rootSegmentID=t.nextSegmentId++,t.completedBoundaries.push(i),_(e,t.responseState,i.id),ne(t,e,n),e.push("\x3c!--/$--\x3e");if(t.responseState.generateStaticMarkup||e.push("\x3c!--$--\x3e"),1!==(n=i.completedSegments).length)throw Error(r(391));return ie(t,e,n[0]),!!t.responseState.generateStaticMarkup||e.push("\x3c!--/$--\x3e")}function re(t,e,n){return function(t,e,n,i){switch(n.insertionMode){case 0:case 1:return t.push('<div hidden id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');case 2:return t.push('<svg aria-hidden="true" style="display:none" id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');case 3:return t.push('<math aria-hidden="true" style="display:none" id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');case 4:return t.push('<table hidden id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');case 5:return t.push('<table hidden><tbody id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');case 6:return t.push('<table hidden><tr id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');case 7:return t.push('<table hidden><colgroup id="'),t.push(e.segmentPrefix),e=i.toString(16),t.push(e),t.push('">');default:throw Error(r(397))}}(e,t.responseState,n.formatContext,n.id),ie(t,e,n),function(t,e){switch(e.insertionMode){case 0:case 1:return t.push("</div>");case 2:return t.push("</svg>");case 3:return t.push("</math>");case 4:return t.push("</table>");case 5:return t.push("</tbody></table>");case 6:return t.push("</tr></table>");case 7:return t.push("</colgroup></table>");default:throw Error(r(397))}}(e,n.formatContext)}function se(t,e,n){for(var i=n.completedSegments,s=0;s<i.length;s++)oe(t,e,n,i[s]);if(i.length=0,t=t.responseState,i=n.id,n=n.rootSegmentID,e.push(t.startInlineScript),t.sentCompleteBoundaryFunction?e.push('$RC("'):(t.sentCompleteBoundaryFunction=!0,e.push('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("')),null===i)throw Error(r(395));return n=n.toString(16),e.push(i),e.push('","'),e.push(t.segmentPrefix),e.push(n),e.push('")<\/script>')}function oe(t,e,n,i){if(2===i.status)return!0;var s=i.id;if(-1===s){if(-1===(i.id=n.rootSegmentID))throw Error(r(392));return re(t,e,i)}return re(t,e,i),t=t.responseState,e.push(t.startInlineScript),t.sentCompleteSegmentFunction?e.push('$RS("'):(t.sentCompleteSegmentFunction=!0,e.push('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("')),e.push(t.segmentPrefix),s=s.toString(16),e.push(s),e.push('","'),e.push(t.placeholderPrefix),e.push(s),e.push('")<\/script>')}function le(t,e){try{var n=t.completedRootSegment;if(null!==n&&0===t.pendingRootTasks){ie(t,e,n),t.completedRootSegment=null;var i=t.responseState.bootstrapChunks;for(n=0;n<i.length-1;n++)e.push(i[n]);n<i.length&&e.push(i[n])}var s,o=t.clientRenderedBoundaries;for(s=0;s<o.length;s++){var l=o[s];i=e;var a=t.responseState,h=l.id,c=l.errorDigest,u=l.errorMessage,d=l.errorComponentStack;if(i.push(a.startInlineScript),a.sentClientRenderFunction?i.push('$RX("'):(a.sentClientRenderFunction=!0,i.push('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("')),null===h)throw Error(r(395));if(i.push(h),i.push('"'),c||u||d){i.push(",");var f=D(c||"");i.push(f)}if(u||d){i.push(",");var p=D(u||"");i.push(p)}if(d){i.push(",");var g=D(d);i.push(g)}if(!i.push(")<\/script>"))return t.destination=null,s++,void o.splice(0,s)}o.splice(0,s);var m=t.completedBoundaries;for(s=0;s<m.length;s++)if(!se(t,e,m[s]))return t.destination=null,s++,void m.splice(0,s);m.splice(0,s);var v=t.partialBoundaries;for(s=0;s<v.length;s++){var b=v[s];t:{o=t,l=e;var y=b.completedSegments;for(a=0;a<y.length;a++)if(!oe(o,l,b,y[a])){a++,y.splice(0,a);var w=!1;break t}y.splice(0,a),w=!0}if(!w)return t.destination=null,s++,void v.splice(0,s)}v.splice(0,s);var x=t.completedBoundaries;for(s=0;s<x.length;s++)if(!se(t,e,x[s]))return t.destination=null,s++,void x.splice(0,s);x.splice(0,s)}finally{0===t.allPendingTasks&&0===t.pingedTasks.length&&0===t.clientRenderedBoundaries.length&&0===t.completedBoundaries.length&&e.push(null)}}function ae(t,e){try{var n=t.abortableTasks;n.forEach(function(n){return Xt(n,t,e)}),n.clear(),null!==t.destination&&le(t,t.destination)}catch(e){Ht(t,e),Wt(t,e)}}function he(){}function ce(t,e,n,i){var s=!1,o=null,l="",a={push:function(t){return null!==t&&(l+=t),!0},destroy:function(t){s=!0,o=t}},h=!1;if(t=function(t,e,n,i,r,s,o){var l=[],a=new Set;return(n=jt(e={destination:null,responseState:e,progressiveChunkSize:i,status:0,fatalError:null,nextSegmentId:0,allPendingTasks:0,pendingRootTasks:0,completedRootSegment:null,abortableTasks:a,pingedTasks:l,clientRenderedBoundaries:[],completedBoundaries:[],partialBoundaries:[],onError:void 0===r?Ft:r,onAllReady:Vt,onShellReady:void 0===o?Vt:o,onShellError:Vt,onFatalError:Vt},0,null,n,!1,!1)).parentFlushed=!0,t=zt(e,t,null,n,a,Z,null,ct),l.push(t),e}(t,function(t,e){return{bootstrapChunks:[],startInlineScript:"<script>",placeholderPrefix:(e=void 0===e?"":e)+"P:",segmentPrefix:e+"S:",boundaryPrefix:e+"B:",idPrefix:e,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1,generateStaticMarkup:t}}(n,e?e.identifierPrefix:void 0),{insertionMode:1,selectedValue:null},1/0,he,0,function(){h=!0}),ee(t),ae(t,i),1===t.status)t.status=2,a.destroy(t.fatalError);else if(2!==t.status&&null===t.destination){t.destination=a;try{le(t,a)}catch(e){Ht(t,e),Wt(t,e)}}if(s)throw o;if(!h)throw Error(r(426));return l}e.renderToNodeStream=function(){throw Error(r(207))},e.renderToStaticMarkup=function(t,e){return ce(t,e,!0,'The server used "renderToStaticMarkup" which does not support Suspense. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server')},e.renderToStaticNodeStream=function(){throw Error(r(208))},e.renderToString=function(t,e){return ce(t,e,!1,'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server')},e.version="18.3.1"},649:e=>{e.exports=t},659:t=>{var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},825:t=>{t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},848:(t,e,n)=>{var i,r;i=n(633),r=n(911),i.version,i.renderToString,e.qV=i.renderToStaticMarkup,i.renderToNodeStream,i.renderToStaticNodeStream,r.renderToReadableStream},911:(t,e,n)=>{var i=n(649);function r(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=null,o=0;function l(t,e){if(0!==e.length)if(512<e.length)0<o&&(t.enqueue(new Uint8Array(s.buffer,0,o)),s=new Uint8Array(512),o=0),t.enqueue(e);else{var n=s.length-o;n<e.length&&(0===n?t.enqueue(s):(s.set(e.subarray(0,n),o),t.enqueue(s),e=e.subarray(n)),s=new Uint8Array(512),o=0),s.set(e,o),o+=e.length}}function a(t,e){return l(t,e),!0}function h(t){s&&0<o&&(t.enqueue(new Uint8Array(s.buffer,0,o)),s=null,o=0)}var c=new TextEncoder;function u(t){return c.encode(t)}function d(t){return c.encode(t)}function f(t,e){"function"==typeof t.error?t.error(e):t.close()}var p=Object.prototype.hasOwnProperty,g=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,m={},v={};function b(t){return!!p.call(v,t)||!p.call(m,t)&&(g.test(t)?v[t]=!0:(m[t]=!0,!1))}function y(t,e,n,i,r,s,o){this.acceptsBooleans=2===e||3===e||4===e,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){w[t]=new y(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];w[e]=new y(e,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){w[t]=new y(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){w[t]=new y(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){w[t]=new y(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){w[t]=new y(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){w[t]=new y(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){w[t]=new y(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){w[t]=new y(t,5,!1,t.toLowerCase(),null,!1,!1)});var x=/[\-:]([a-z])/g;function k(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(x,k);w[e]=new y(e,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(x,k);w[e]=new y(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(x,k);w[e]=new y(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){w[t]=new y(t,1,!1,t.toLowerCase(),null,!1,!1)}),w.xlinkHref=new y("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){w[t]=new y(t,1,!1,t.toLowerCase(),null,!0,!0)});var A={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},S=["Webkit","ms","Moz","O"];Object.keys(A).forEach(function(t){S.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),A[e]=A[t]})});var C=/["'&<>]/;function E(t){if("boolean"==typeof t||"number"==typeof t)return""+t;t=""+t;var e=C.exec(t);if(e){var n,i="",r=0;for(n=e.index;n<t.length;n++){switch(t.charCodeAt(n)){case 34:e=""";break;case 38:e="&";break;case 39:e="'";break;case 60:e="<";break;case 62:e=">";break;default:continue}r!==n&&(i+=t.substring(r,n)),r=n+1,i+=e}t=r!==n?i+t.substring(r,n):i}return t}var T=/([A-Z])/g,O=/^ms-/,M=Array.isArray,_=d("<script>"),P=d("<\/script>"),D=d('<script src="'),R=d('<script type="module" src="'),B=d('" async=""><\/script>'),I=/(<\/|<)(s)(cript)/gi;function N(t,e,n,i){return e+("s"===n?"\\u0073":"\\u0053")+i}function L(t,e){return{insertionMode:t,selectedValue:e}}var F=d("\x3c!-- --\x3e");function V(t,e,n,i){return""===e?i:(i&&t.push(F),t.push(u(E(e))),!0)}var z=new Map,j=d(' style="'),H=d(":"),W=d(";");function $(t,e,n){if("object"!=typeof n)throw Error(r(62));for(var i in e=!0,n)if(p.call(n,i)){var s=n[i];if(null!=s&&"boolean"!=typeof s&&""!==s){if(0===i.indexOf("--")){var o=u(E(i));s=u(E((""+s).trim()))}else{o=i;var l=z.get(o);void 0!==l||(l=d(E(o.replace(T,"-$1").toLowerCase().replace(O,"-ms-"))),z.set(o,l)),o=l,s="number"==typeof s?0===s||p.call(A,i)?u(""+s):u(s+"px"):u(E((""+s).trim()))}e?(e=!1,t.push(j,o,H,s)):t.push(W,o,H,s)}}e||t.push(K)}var q=d(" "),U=d('="'),K=d('"'),G=d('=""');function Y(t,e,n,i){switch(n){case"style":return void $(t,e,i);case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":return}if(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])if(null!==(e=w.hasOwnProperty(n)?w[n]:null)){switch(typeof i){case"function":case"symbol":return;case"boolean":if(!e.acceptsBooleans)return}switch(n=u(e.attributeName),e.type){case 3:i&&t.push(q,n,G);break;case 4:!0===i?t.push(q,n,G):!1!==i&&t.push(q,n,U,u(E(i)),K);break;case 5:isNaN(i)||t.push(q,n,U,u(E(i)),K);break;case 6:!isNaN(i)&&1<=i&&t.push(q,n,U,u(E(i)),K);break;default:e.sanitizeURL&&(i=""+i),t.push(q,n,U,u(E(i)),K)}}else if(b(n)){switch(typeof i){case"function":case"symbol":return;case"boolean":if("data-"!==(e=n.toLowerCase().slice(0,5))&&"aria-"!==e)return}t.push(q,u(n),U,u(E(i)),K)}}var Q=d(">"),J=d("/>");function X(t,e,n){if(null!=e){if(null!=n)throw Error(r(60));if("object"!=typeof e||!("__html"in e))throw Error(r(61));null!=(e=e.__html)&&t.push(u(""+e))}}var Z=d(' selected=""');function tt(t,e,n,i){t.push(rt(n));var r,s=n=null;for(r in e)if(p.call(e,r)){var o=e[r];if(null!=o)switch(r){case"children":n=o;break;case"dangerouslySetInnerHTML":s=o;break;default:Y(t,i,r,o)}}return t.push(Q),X(t,s,n),"string"==typeof n?(t.push(u(E(n))),null):n}var et=d("\n"),nt=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,it=new Map;function rt(t){var e=it.get(t);if(void 0===e){if(!nt.test(t))throw Error(r(65,t));e=d("<"+t),it.set(t,e)}return e}var st=d("<!DOCTYPE html>");var ot=d("</"),lt=d(">"),at=d('<template id="'),ht=d('"></template>'),ct=d("\x3c!--$--\x3e"),ut=d('\x3c!--$?--\x3e<template id="'),dt=d('"></template>'),ft=d("\x3c!--$!--\x3e"),pt=d("\x3c!--/$--\x3e"),gt=d("<template"),mt=d('"'),vt=d(' data-dgst="');d(' data-msg="'),d(' data-stck="');var bt=d("></template>");function yt(t,e,n){if(l(t,ut),null===n)throw Error(r(395));return l(t,n),a(t,dt)}var wt=d('<div hidden id="'),xt=d('">'),kt=d("</div>"),At=d('<svg aria-hidden="true" style="display:none" id="'),St=d('">'),Ct=d("</svg>"),Et=d('<math aria-hidden="true" style="display:none" id="'),Tt=d('">'),Ot=d("</math>"),Mt=d('<table hidden id="'),_t=d('">'),Pt=d("</table>"),Dt=d('<table hidden><tbody id="'),Rt=d('">'),Bt=d("</tbody></table>"),It=d('<table hidden><tr id="'),Nt=d('">'),Lt=d("</tr></table>"),Ft=d('<table hidden><colgroup id="'),Vt=d('">'),zt=d("</colgroup></table>"),jt=d('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("'),Ht=d('$RS("'),Wt=d('","'),$t=d('")<\/script>'),qt=d('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("'),Ut=d('$RC("'),Kt=d('","'),Gt=d('")<\/script>'),Yt=d('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("'),Qt=d('$RX("'),Jt=d('"'),Xt=d(")<\/script>"),Zt=d(","),te=/[<\u2028\u2029]/g;function ee(t){return JSON.stringify(t).replace(te,function(t){switch(t){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}var ne=Object.assign,ie=Symbol.for("react.element"),re=Symbol.for("react.portal"),se=Symbol.for("react.fragment"),oe=Symbol.for("react.strict_mode"),le=Symbol.for("react.profiler"),ae=Symbol.for("react.provider"),he=Symbol.for("react.context"),ce=Symbol.for("react.forward_ref"),ue=Symbol.for("react.suspense"),de=Symbol.for("react.suspense_list"),fe=Symbol.for("react.memo"),pe=Symbol.for("react.lazy"),ge=Symbol.for("react.scope"),me=Symbol.for("react.debug_trace_mode"),ve=Symbol.for("react.legacy_hidden"),be=Symbol.for("react.default_value"),ye=Symbol.iterator;function we(t){if(null==t)return null;if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case se:return"Fragment";case re:return"Portal";case le:return"Profiler";case oe:return"StrictMode";case ue:return"Suspense";case de:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case he:return(t.displayName||"Context")+".Consumer";case ae:return(t._context.displayName||"Context")+".Provider";case ce:var e=t.render;return(t=t.displayName)||(t=""!==(t=e.displayName||e.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case fe:return null!==(e=t.displayName||null)?e:we(t.type)||"Memo";case pe:e=t._payload,t=t._init;try{return we(t(e))}catch(t){}}return null}var xe={};function ke(t,e){if(!(t=t.contextTypes))return xe;var n,i={};for(n in t)i[n]=e[n];return i}var Ae=null;function Se(t,e){if(t!==e){t.context._currentValue=t.parentValue,t=t.parent;var n=e.parent;if(null===t){if(null!==n)throw Error(r(401))}else{if(null===n)throw Error(r(401));Se(t,n)}e.context._currentValue=e.value}}function Ce(t){t.context._currentValue=t.parentValue,null!==(t=t.parent)&&Ce(t)}function Ee(t){var e=t.parent;null!==e&&Ee(e),t.context._currentValue=t.value}function Te(t,e){if(t.context._currentValue=t.parentValue,null===(t=t.parent))throw Error(r(402));t.depth===e.depth?Se(t,e):Te(t,e)}function Oe(t,e){var n=e.parent;if(null===n)throw Error(r(402));t.depth===n.depth?Se(t,n):Oe(t,n),e.context._currentValue=e.value}function Me(t){var e=Ae;e!==t&&(null===e?Ee(t):null===t?Ce(e):e.depth===t.depth?Se(e,t):e.depth>t.depth?Te(e,t):Oe(e,t),Ae=t)}var _e={isMounted:function(){return!1},enqueueSetState:function(t,e){null!==(t=t._reactInternals).queue&&t.queue.push(e)},enqueueReplaceState:function(t,e){(t=t._reactInternals).replace=!0,t.queue=[e]},enqueueForceUpdate:function(){}};function Pe(t,e,n,i){var r=void 0!==t.state?t.state:null;t.updater=_e,t.props=n,t.state=r;var s={queue:[],replace:!1};t._reactInternals=s;var o=e.contextType;if(t.context="object"==typeof o&&null!==o?o._currentValue:i,"function"==typeof(o=e.getDerivedStateFromProps)&&(r=null==(o=o(n,r))?r:ne({},r,o),t.state=r),"function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate&&("function"==typeof t.UNSAFE_componentWillMount||"function"==typeof t.componentWillMount))if(e=t.state,"function"==typeof t.componentWillMount&&t.componentWillMount(),"function"==typeof t.UNSAFE_componentWillMount&&t.UNSAFE_componentWillMount(),e!==t.state&&_e.enqueueReplaceState(t,t.state,null),null!==s.queue&&0<s.queue.length)if(e=s.queue,o=s.replace,s.queue=null,s.replace=!1,o&&1===e.length)t.state=e[0];else{for(s=o?e[0]:t.state,r=!0,o=o?1:0;o<e.length;o++){var l=e[o];null!=(l="function"==typeof l?l.call(t,s,n,i):l)&&(r?(r=!1,s=ne({},s,l)):ne(s,l))}t.state=s}else s.queue=null}var De={id:1,overflow:""};function Re(t,e,n){var i=t.id;t=t.overflow;var r=32-Be(i)-1;i&=~(1<<r),n+=1;var s=32-Be(e)+r;if(30<s){var o=r-r%5;return s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,{id:1<<32-Be(e)+r|n<<r|i,overflow:s+t}}return{id:1<<s|n<<r|i,overflow:t}}var Be=Math.clz32?Math.clz32:function(t){return 0==(t>>>=0)?32:31-(Ie(t)/Ne|0)|0},Ie=Math.log,Ne=Math.LN2,Le="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},Fe=null,Ve=null,ze=null,je=null,He=!1,We=!1,$e=0,qe=null,Ue=0;function Ke(){if(null===Fe)throw Error(r(321));return Fe}function Ge(){if(0<Ue)throw Error(r(312));return{memoizedState:null,queue:null,next:null}}function Ye(){return null===je?null===ze?(He=!1,ze=je=Ge()):(He=!0,je=ze):null===je.next?(He=!1,je=je.next=Ge()):(He=!0,je=je.next),je}function Qe(){Ve=Fe=null,We=!1,ze=null,Ue=0,je=qe=null}function Je(t,e){return"function"==typeof e?e(t):e}function Xe(t,e,n){if(Fe=Ke(),je=Ye(),He){var i=je.queue;if(e=i.dispatch,null!==qe&&void 0!==(n=qe.get(i))){qe.delete(i),i=je.memoizedState;do{i=t(i,n.action),n=n.next}while(null!==n);return je.memoizedState=i,[i,e]}return[je.memoizedState,e]}return t=t===Je?"function"==typeof e?e():e:void 0!==n?n(e):e,je.memoizedState=t,t=(t=je.queue={last:null,dispatch:null}).dispatch=tn.bind(null,Fe,t),[je.memoizedState,t]}function Ze(t,e){if(Fe=Ke(),e=void 0===e?null:e,null!==(je=Ye())){var n=je.memoizedState;if(null!==n&&null!==e){var i=n[1];t:if(null===i)i=!1;else{for(var r=0;r<i.length&&r<e.length;r++)if(!Le(e[r],i[r])){i=!1;break t}i=!0}if(i)return n[0]}}return t=t(),je.memoizedState=[t,e],t}function tn(t,e,n){if(25<=Ue)throw Error(r(301));if(t===Fe)if(We=!0,t={action:n,next:null},null===qe&&(qe=new Map),void 0===(n=qe.get(e)))qe.set(e,t);else{for(e=n;null!==e.next;)e=e.next;e.next=t}}function en(){throw Error(r(394))}function nn(){}var rn={readContext:function(t){return t._currentValue},useContext:function(t){return Ke(),t._currentValue},useMemo:Ze,useReducer:Xe,useRef:function(t){Fe=Ke();var e=(je=Ye()).memoizedState;return null===e?(t={current:t},je.memoizedState=t):e},useState:function(t){return Xe(Je,t)},useInsertionEffect:nn,useLayoutEffect:function(){},useCallback:function(t,e){return Ze(function(){return t},e)},useImperativeHandle:nn,useEffect:nn,useDebugValue:nn,useDeferredValue:function(t){return Ke(),t},useTransition:function(){return Ke(),[!1,en]},useId:function(){var t=Ve.treeContext,e=t.overflow;t=((t=t.id)&~(1<<32-Be(t)-1)).toString(32)+e;var n=sn;if(null===n)throw Error(r(404));return e=$e++,t=":"+n.idPrefix+"R"+t,0<e&&(t+="H"+e.toString(32)),t+":"},useMutableSource:function(t,e){return Ke(),e(t._source)},useSyncExternalStore:function(t,e,n){if(void 0===n)throw Error(r(407));return n()}},sn=null,on=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;function ln(t){return console.error(t),null}function an(){}function hn(t,e,n,i,r,s,o,l){t.allPendingTasks++,null===n?t.pendingRootTasks++:n.pendingTasks++;var a={node:e,ping:function(){var e=t.pingedTasks;e.push(a),1===e.length&&Sn(t)},blockedBoundary:n,blockedSegment:i,abortSet:r,legacyContext:s,context:o,treeContext:l};return r.add(a),a}function cn(t,e,n,i,r,s){return{status:0,id:-1,index:e,parentFlushed:!1,chunks:[],children:[],formatContext:i,boundary:n,lastPushedText:r,textEmbedded:s}}function un(t,e){if(null!=(t=t.onError(e))&&"string"!=typeof t)throw Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "'+typeof t+'" instead');return t}function dn(t,e){var n=t.onShellError;n(e),(n=t.onFatalError)(e),null!==t.destination?(t.status=2,f(t.destination,e)):(t.status=1,t.fatalError=e)}function fn(t,e,n,i,r){for(Fe={},Ve=e,$e=0,t=n(i,r);We;)We=!1,$e=0,Ue+=1,je=null,t=n(i,r);return Qe(),t}function pn(t,e,n,i){var s=n.render(),o=i.childContextTypes;if(null!=o){var l=e.legacyContext;if("function"!=typeof n.getChildContext)i=l;else{for(var a in n=n.getChildContext())if(!(a in o))throw Error(r(108,we(i)||"Unknown",a));i=ne({},l,n)}e.legacyContext=i,vn(t,e,s),e.legacyContext=l}else vn(t,e,s)}function gn(t,e){if(t&&t.defaultProps){for(var n in e=ne({},e),t=t.defaultProps)void 0===e[n]&&(e[n]=t[n]);return e}return e}function mn(t,e,n,s,o){if("function"==typeof n)if(n.prototype&&n.prototype.isReactComponent){o=ke(n,e.legacyContext);var l=n.contextType;Pe(l=new n(s,"object"==typeof l&&null!==l?l._currentValue:o),n,s,o),pn(t,e,l,n)}else{o=fn(t,e,n,s,l=ke(n,e.legacyContext));var a=0!==$e;if("object"==typeof o&&null!==o&&"function"==typeof o.render&&void 0===o.$$typeof)Pe(o,n,s,l),pn(t,e,o,n);else if(a){s=e.treeContext,e.treeContext=Re(s,1,0);try{vn(t,e,o)}finally{e.treeContext=s}}else vn(t,e,o)}else{if("string"!=typeof n){switch(n){case ve:case me:case oe:case le:case se:case de:return void vn(t,e,s.children);case ge:throw Error(r(343));case ue:t:{n=e.blockedBoundary,o=e.blockedSegment,l=s.fallback,s=s.children;var h={id:null,rootSegmentID:-1,parentFlushed:!1,pendingTasks:0,forceClientRender:!1,completedSegments:[],byteSize:0,fallbackAbortableTasks:a=new Set,errorDigest:null},c=cn(0,o.chunks.length,h,o.formatContext,!1,!1);o.children.push(c),o.lastPushedText=!1;var d=cn(0,0,null,o.formatContext,!1,!1);d.parentFlushed=!0,e.blockedBoundary=h,e.blockedSegment=d;try{if(yn(t,e,s),d.lastPushedText&&d.textEmbedded&&d.chunks.push(F),d.status=1,kn(h,d),0===h.pendingTasks)break t}catch(e){d.status=4,h.forceClientRender=!0,h.errorDigest=un(t,e)}finally{e.blockedBoundary=n,e.blockedSegment=o}e=hn(t,l,n,c,a,e.legacyContext,e.context,e.treeContext),t.pingedTasks.push(e)}return}if("object"==typeof n&&null!==n)switch(n.$$typeof){case ce:if(s=fn(t,e,n.render,s,o),0!==$e){n=e.treeContext,e.treeContext=Re(n,1,0);try{vn(t,e,s)}finally{e.treeContext=n}}else vn(t,e,s);return;case fe:return void mn(t,e,n=n.type,s=gn(n,s),o);case ae:if(o=s.children,n=n._context,s=s.value,l=n._currentValue,n._currentValue=s,Ae=s={parent:a=Ae,depth:null===a?0:a.depth+1,context:n,parentValue:l,value:s},e.context=s,vn(t,e,o),null===(t=Ae))throw Error(r(403));return s=t.parentValue,t.context._currentValue=s===be?t.context._defaultValue:s,t=Ae=t.parent,void(e.context=t);case he:return void vn(t,e,s=(s=s.children)(n._currentValue));case pe:return void mn(t,e,n=(o=n._init)(n._payload),s=gn(n,s),void 0)}throw Error(r(130,null==n?n:typeof n,""))}switch(l=function(t,e,n,s,o){switch(e){case"select":t.push(rt("select"));var l=null,a=null;for(f in n)if(p.call(n,f)){var h=n[f];if(null!=h)switch(f){case"children":l=h;break;case"dangerouslySetInnerHTML":a=h;break;case"defaultValue":case"value":break;default:Y(t,s,f,h)}}return t.push(Q),X(t,a,l),l;case"option":a=o.selectedValue,t.push(rt("option"));var c=h=null,d=null,f=null;for(l in n)if(p.call(n,l)){var g=n[l];if(null!=g)switch(l){case"children":h=g;break;case"selected":d=g;break;case"dangerouslySetInnerHTML":f=g;break;case"value":c=g;default:Y(t,s,l,g)}}if(null!=a)if(n=null!==c?""+c:function(t){var e="";return i.Children.forEach(t,function(t){null!=t&&(e+=t)}),e}(h),M(a)){for(s=0;s<a.length;s++)if(""+a[s]===n){t.push(Z);break}}else""+a===n&&t.push(Z);else d&&t.push(Z);return t.push(Q),X(t,f,h),h;case"textarea":for(h in t.push(rt("textarea")),f=a=l=null,n)if(p.call(n,h)&&null!=(c=n[h]))switch(h){case"children":f=c;break;case"value":l=c;break;case"defaultValue":a=c;break;case"dangerouslySetInnerHTML":throw Error(r(91));default:Y(t,s,h,c)}if(null===l&&null!==a&&(l=a),t.push(Q),null!=f){if(null!=l)throw Error(r(92));if(M(f)&&1<f.length)throw Error(r(93));l=""+f}return"string"==typeof l&&"\n"===l[0]&&t.push(et),null!==l&&t.push(u(E(""+l))),null;case"input":for(a in t.push(rt("input")),c=f=h=l=null,n)if(p.call(n,a)&&null!=(d=n[a]))switch(a){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,"input"));case"defaultChecked":c=d;break;case"defaultValue":h=d;break;case"checked":f=d;break;case"value":l=d;break;default:Y(t,s,a,d)}return null!==f?Y(t,s,"checked",f):null!==c&&Y(t,s,"checked",c),null!==l?Y(t,s,"value",l):null!==h&&Y(t,s,"value",h),t.push(J),null;case"menuitem":for(var m in t.push(rt("menuitem")),n)if(p.call(n,m)&&null!=(l=n[m]))switch(m){case"children":case"dangerouslySetInnerHTML":throw Error(r(400));default:Y(t,s,m,l)}return t.push(Q),null;case"title":for(g in t.push(rt("title")),l=null,n)if(p.call(n,g)&&null!=(a=n[g]))switch(g){case"children":l=a;break;case"dangerouslySetInnerHTML":throw Error(r(434));default:Y(t,s,g,a)}return t.push(Q),l;case"listing":case"pre":for(c in t.push(rt(e)),a=l=null,n)if(p.call(n,c)&&null!=(h=n[c]))switch(c){case"children":l=h;break;case"dangerouslySetInnerHTML":a=h;break;default:Y(t,s,c,h)}if(t.push(Q),null!=a){if(null!=l)throw Error(r(60));if("object"!=typeof a||!("__html"in a))throw Error(r(61));null!=(n=a.__html)&&("string"==typeof n&&0<n.length&&"\n"===n[0]?t.push(et,u(n)):t.push(u(""+n)))}return"string"==typeof l&&"\n"===l[0]&&t.push(et),l;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":for(var v in t.push(rt(e)),n)if(p.call(n,v)&&null!=(l=n[v]))switch(v){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,e));default:Y(t,s,v,l)}return t.push(J),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return tt(t,n,e,s);case"html":return 0===o.insertionMode&&t.push(st),tt(t,n,e,s);default:if(-1===e.indexOf("-")&&"string"!=typeof n.is)return tt(t,n,e,s);for(d in t.push(rt(e)),a=l=null,n)if(p.call(n,d)&&null!=(h=n[d]))switch(d){case"children":l=h;break;case"dangerouslySetInnerHTML":a=h;break;case"style":$(t,s,h);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:b(d)&&"function"!=typeof h&&"symbol"!=typeof h&&t.push(q,u(d),U,u(E(h)),K)}return t.push(Q),X(t,a,l),l}}((o=e.blockedSegment).chunks,n,s,t.responseState,o.formatContext),o.lastPushedText=!1,a=o.formatContext,o.formatContext=function(t,e,n){switch(e){case"select":return L(1,null!=n.value?n.value:n.defaultValue);case"svg":return L(2,null);case"math":return L(3,null);case"foreignObject":return L(1,null);case"table":return L(4,null);case"thead":case"tbody":case"tfoot":return L(5,null);case"colgroup":return L(7,null);case"tr":return L(6,null)}return 4<=t.insertionMode||0===t.insertionMode?L(1,null):t}(a,n,s),yn(t,e,l),o.formatContext=a,n){case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"input":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":break;default:o.chunks.push(ot,u(n),lt)}o.lastPushedText=!1}}function vn(t,e,n){if(e.node=n,"object"==typeof n&&null!==n){switch(n.$$typeof){case ie:return void mn(t,e,n.type,n.props,n.ref);case re:throw Error(r(257));case pe:var i=n._init;return void vn(t,e,n=i(n._payload))}if(M(n))return void bn(t,e,n);if((i=null===n||"object"!=typeof n?null:"function"==typeof(i=ye&&n[ye]||n["@@iterator"])?i:null)&&(i=i.call(n))){if(!(n=i.next()).done){var s=[];do{s.push(n.value),n=i.next()}while(!n.done);bn(t,e,s)}return}throw t=Object.prototype.toString.call(n),Error(r(31,"[object Object]"===t?"object with keys {"+Object.keys(n).join(", ")+"}":t))}"string"==typeof n?(i=e.blockedSegment).lastPushedText=V(e.blockedSegment.chunks,n,t.responseState,i.lastPushedText):"number"==typeof n&&((i=e.blockedSegment).lastPushedText=V(e.blockedSegment.chunks,""+n,t.responseState,i.lastPushedText))}function bn(t,e,n){for(var i=n.length,r=0;r<i;r++){var s=e.treeContext;e.treeContext=Re(s,i,r);try{yn(t,e,n[r])}finally{e.treeContext=s}}}function yn(t,e,n){var i=e.blockedSegment.formatContext,r=e.legacyContext,s=e.context;try{return vn(t,e,n)}catch(a){if(Qe(),"object"!=typeof a||null===a||"function"!=typeof a.then)throw e.blockedSegment.formatContext=i,e.legacyContext=r,e.context=s,Me(s),a;n=a;var o=e.blockedSegment,l=cn(0,o.chunks.length,null,o.formatContext,o.lastPushedText,!0);o.children.push(l),o.lastPushedText=!1,t=hn(t,e.node,e.blockedBoundary,l,e.abortSet,e.legacyContext,e.context,e.treeContext).ping,n.then(t,t),e.blockedSegment.formatContext=i,e.legacyContext=r,e.context=s,Me(s)}}function wn(t){var e=t.blockedBoundary;(t=t.blockedSegment).status=3,An(this,e,t)}function xn(t,e,n){var i=t.blockedBoundary;t.blockedSegment.status=3,null===i?(e.allPendingTasks--,2!==e.status&&(e.status=2,null!==e.destination&&e.destination.close())):(i.pendingTasks--,i.forceClientRender||(i.forceClientRender=!0,t=void 0===n?Error(r(432)):n,i.errorDigest=e.onError(t),i.parentFlushed&&e.clientRenderedBoundaries.push(i)),i.fallbackAbortableTasks.forEach(function(t){return xn(t,e,n)}),i.fallbackAbortableTasks.clear(),e.allPendingTasks--,0===e.allPendingTasks&&(i=e.onAllReady)())}function kn(t,e){if(0===e.chunks.length&&1===e.children.length&&null===e.children[0].boundary){var n=e.children[0];n.id=e.id,n.parentFlushed=!0,1===n.status&&kn(t,n)}else t.completedSegments.push(e)}function An(t,e,n){if(null===e){if(n.parentFlushed){if(null!==t.completedRootSegment)throw Error(r(389));t.completedRootSegment=n}t.pendingRootTasks--,0===t.pendingRootTasks&&(t.onShellError=an,(e=t.onShellReady)())}else e.pendingTasks--,e.forceClientRender||(0===e.pendingTasks?(n.parentFlushed&&1===n.status&&kn(e,n),e.parentFlushed&&t.completedBoundaries.push(e),e.fallbackAbortableTasks.forEach(wn,t),e.fallbackAbortableTasks.clear()):n.parentFlushed&&1===n.status&&(kn(e,n),1===e.completedSegments.length&&e.parentFlushed&&t.partialBoundaries.push(e)));t.allPendingTasks--,0===t.allPendingTasks&&(t=t.onAllReady)()}function Sn(t){if(2!==t.status){var e=Ae,n=on.current;on.current=rn;var i=sn;sn=t.responseState;try{var r,s=t.pingedTasks;for(r=0;r<s.length;r++){var o=s[r],l=t,a=o.blockedSegment;if(0===a.status){Me(o.context);try{vn(l,o,o.node),a.lastPushedText&&a.textEmbedded&&a.chunks.push(F),o.abortSet.delete(o),a.status=1,An(l,o.blockedBoundary,a)}catch(t){if(Qe(),"object"==typeof t&&null!==t&&"function"==typeof t.then){var h=o.ping;t.then(h,h)}else{o.abortSet.delete(o),a.status=4;var c=o.blockedBoundary,u=t,d=un(l,u);null===c?dn(l,u):(c.pendingTasks--,c.forceClientRender||(c.forceClientRender=!0,c.errorDigest=d,c.parentFlushed&&l.clientRenderedBoundaries.push(c))),l.allPendingTasks--,0===l.allPendingTasks&&(0,l.onAllReady)()}}}}s.splice(0,r),null!==t.destination&&_n(t,t.destination)}catch(e){un(t,e),dn(t,e)}finally{sn=i,on.current=n,n===rn&&Me(e)}}}function Cn(t,e,n){switch(n.parentFlushed=!0,n.status){case 0:var i=n.id=t.nextSegmentId++;return n.lastPushedText=!1,n.textEmbedded=!1,t=t.responseState,l(e,at),l(e,t.placeholderPrefix),l(e,t=u(i.toString(16))),a(e,ht);case 1:n.status=2;var s=!0;i=n.chunks;var o=0;n=n.children;for(var h=0;h<n.length;h++){for(s=n[h];o<s.index;o++)l(e,i[o]);s=En(t,e,s)}for(;o<i.length-1;o++)l(e,i[o]);return o<i.length&&(s=a(e,i[o])),s;default:throw Error(r(390))}}function En(t,e,n){var i=n.boundary;if(null===i)return Cn(t,e,n);if(i.parentFlushed=!0,i.forceClientRender)i=i.errorDigest,a(e,ft),l(e,gt),i&&(l(e,vt),l(e,u(E(i))),l(e,mt)),a(e,bt),Cn(t,e,n);else if(0<i.pendingTasks){i.rootSegmentID=t.nextSegmentId++,0<i.completedSegments.length&&t.partialBoundaries.push(i);var s=t.responseState,o=s.nextSuspenseID++;s=d(s.boundaryPrefix+o.toString(16)),i=i.id=s,yt(e,t.responseState,i),Cn(t,e,n)}else if(i.byteSize>t.progressiveChunkSize)i.rootSegmentID=t.nextSegmentId++,t.completedBoundaries.push(i),yt(e,t.responseState,i.id),Cn(t,e,n);else{if(a(e,ct),1!==(n=i.completedSegments).length)throw Error(r(391));En(t,e,n[0])}return a(e,pt)}function Tn(t,e,n){return function(t,e,n,i){switch(n.insertionMode){case 0:case 1:return l(t,wt),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,xt);case 2:return l(t,At),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,St);case 3:return l(t,Et),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,Tt);case 4:return l(t,Mt),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,_t);case 5:return l(t,Dt),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,Rt);case 6:return l(t,It),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,Nt);case 7:return l(t,Ft),l(t,e.segmentPrefix),l(t,u(i.toString(16))),a(t,Vt);default:throw Error(r(397))}}(e,t.responseState,n.formatContext,n.id),En(t,e,n),function(t,e){switch(e.insertionMode){case 0:case 1:return a(t,kt);case 2:return a(t,Ct);case 3:return a(t,Ot);case 4:return a(t,Pt);case 5:return a(t,Bt);case 6:return a(t,Lt);case 7:return a(t,zt);default:throw Error(r(397))}}(e,n.formatContext)}function On(t,e,n){for(var i=n.completedSegments,s=0;s<i.length;s++)Mn(t,e,n,i[s]);if(i.length=0,t=t.responseState,i=n.id,n=n.rootSegmentID,l(e,t.startInlineScript),t.sentCompleteBoundaryFunction?l(e,Ut):(t.sentCompleteBoundaryFunction=!0,l(e,qt)),null===i)throw Error(r(395));return n=u(n.toString(16)),l(e,i),l(e,Kt),l(e,t.segmentPrefix),l(e,n),a(e,Gt)}function Mn(t,e,n,i){if(2===i.status)return!0;var s=i.id;if(-1===s){if(-1===(i.id=n.rootSegmentID))throw Error(r(392));return Tn(t,e,i)}return Tn(t,e,i),l(e,(t=t.responseState).startInlineScript),t.sentCompleteSegmentFunction?l(e,Ht):(t.sentCompleteSegmentFunction=!0,l(e,jt)),l(e,t.segmentPrefix),l(e,s=u(s.toString(16))),l(e,Wt),l(e,t.placeholderPrefix),l(e,s),a(e,$t)}function _n(t,e){s=new Uint8Array(512),o=0;try{var n=t.completedRootSegment;if(null!==n&&0===t.pendingRootTasks){En(t,e,n),t.completedRootSegment=null;var i=t.responseState.bootstrapChunks;for(n=0;n<i.length-1;n++)l(e,i[n]);n<i.length&&a(e,i[n])}var c,d=t.clientRenderedBoundaries;for(c=0;c<d.length;c++){var f=d[c];i=e;var p=t.responseState,g=f.id,m=f.errorDigest,v=f.errorMessage,b=f.errorComponentStack;if(l(i,p.startInlineScript),p.sentClientRenderFunction?l(i,Qt):(p.sentClientRenderFunction=!0,l(i,Yt)),null===g)throw Error(r(395));if(l(i,g),l(i,Jt),(m||v||b)&&(l(i,Zt),l(i,u(ee(m||"")))),(v||b)&&(l(i,Zt),l(i,u(ee(v||"")))),b&&(l(i,Zt),l(i,u(ee(b)))),!a(i,Xt))return t.destination=null,c++,void d.splice(0,c)}d.splice(0,c);var y=t.completedBoundaries;for(c=0;c<y.length;c++)if(!On(t,e,y[c]))return t.destination=null,c++,void y.splice(0,c);y.splice(0,c),h(e),s=new Uint8Array(512),o=0;var w=t.partialBoundaries;for(c=0;c<w.length;c++){var x=w[c];t:{d=t,f=e;var k=x.completedSegments;for(p=0;p<k.length;p++)if(!Mn(d,f,x,k[p])){p++,k.splice(0,p);var A=!1;break t}k.splice(0,p),A=!0}if(!A)return t.destination=null,c++,void w.splice(0,c)}w.splice(0,c);var S=t.completedBoundaries;for(c=0;c<S.length;c++)if(!On(t,e,S[c]))return t.destination=null,c++,void S.splice(0,c);S.splice(0,c)}finally{h(e),0===t.allPendingTasks&&0===t.pingedTasks.length&&0===t.clientRenderedBoundaries.length&&0===t.completedBoundaries.length&&e.close()}}function Pn(t,e){try{var n=t.abortableTasks;n.forEach(function(n){return xn(n,t,e)}),n.clear(),null!==t.destination&&_n(t,t.destination)}catch(e){un(t,e),dn(t,e)}}e.renderToReadableStream=function(t,e){return new Promise(function(n,i){var r,s,o=new Promise(function(t,e){s=t,r=e}),l=function(t,e,n,i,r,s,o,l,a){var h=[],c=new Set;return(n=cn(e={destination:null,responseState:e,progressiveChunkSize:void 0===i?12800:i,status:0,fatalError:null,nextSegmentId:0,allPendingTasks:0,pendingRootTasks:0,completedRootSegment:null,abortableTasks:c,pingedTasks:h,clientRenderedBoundaries:[],completedBoundaries:[],partialBoundaries:[],onError:void 0===r?ln:r,onAllReady:void 0===s?an:s,onShellReady:void 0===o?an:o,onShellError:void 0===l?an:l,onFatalError:void 0===a?an:a},0,null,n,!1,!1)).parentFlushed=!0,t=hn(e,t,null,n,c,xe,null,De),h.push(t),e}(t,function(t,e,n,i,r){t=void 0===t?"":t,e=void 0===e?_:d('<script nonce="'+E(e)+'">');var s=[];if(void 0!==n&&s.push(e,u((""+n).replace(I,N)),P),void 0!==i)for(n=0;n<i.length;n++)s.push(D,u(E(i[n])),B);if(void 0!==r)for(i=0;i<r.length;i++)s.push(R,u(E(r[i])),B);return{bootstrapChunks:s,startInlineScript:e,placeholderPrefix:d(t+"P:"),segmentPrefix:d(t+"S:"),boundaryPrefix:t+"B:",idPrefix:t,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1}}(e?e.identifierPrefix:void 0,e?e.nonce:void 0,e?e.bootstrapScriptContent:void 0,e?e.bootstrapScripts:void 0,e?e.bootstrapModules:void 0),function(t){return L("http://www.w3.org/2000/svg"===t?2:"http://www.w3.org/1998/Math/MathML"===t?3:0,null)}(e?e.namespaceURI:void 0),e?e.progressiveChunkSize:void 0,e?e.onError:void 0,s,function(){var t=new ReadableStream({type:"bytes",pull:function(t){if(1===l.status)l.status=2,f(t,l.fatalError);else if(2!==l.status&&null===l.destination){l.destination=t;try{_n(l,t)}catch(t){un(l,t),dn(l,t)}}},cancel:function(){Pn(l)}},{highWaterMark:0});t.allReady=o,n(t)},function(t){o.catch(function(){}),i(t)},r);if(e&&e.signal){var a=e.signal,h=function(){Pn(l,a.reason),a.removeEventListener("abort",h)};a.addEventListener("abort",h)}Sn(l)})},e.version="18.3.1"},942:(t,e)=>{var n;!function(){var i={}.hasOwnProperty;function r(){for(var t="",e=0;e<arguments.length;e++){var n=arguments[e];n&&(t=o(t,s(n)))}return t}function s(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return r.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var e="";for(var n in t)i.call(t,n)&&t[n]&&(e=o(e,n));return e}function o(t,e){return e?t?t+" "+e:t+e:t}t.exports?(r.default=r,t.exports=r):void 0===(n=function(){return r}.apply(e,[]))||(t.exports=n)}()}},r={};function s(t){var e=r[t];if(void 0!==e)return e.exports;var n=r[t]={id:t,exports:{}};return i[t](n,n.exports,s),n.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.nc=void 0;var o=s(649);const l=(a={Button:()=>e.Button,CodeSnippetSkeleton:()=>e.CodeSnippetSkeleton,InlineLoading:()=>e.InlineLoading,Link:()=>e.Link,Tab:()=>e.Tab,TabList:()=>e.TabList,TabPanel:()=>e.TabPanel,TabPanels:()=>e.TabPanels,Tabs:()=>e.Tabs,Tooltip:()=>e.Tooltip},h={},s.d(h,a),h);var a,h;const c=(t=>{var e={};return s.d(e,t),e})({CheckmarkFilled:()=>n.CheckmarkFilled,Copy:()=>n.Copy,Cursor_1:()=>n.Cursor_1,ErrorFilled:()=>n.ErrorFilled,InProgress:()=>n.InProgress,Launch:()=>n.Launch,PlayFilledAlt:()=>n.PlayFilledAlt,StopFilledAlt:()=>n.StopFilledAlt});var u=s(942),d=s.n(u);const f=Object.prototype.toString,p=Object.prototype.hasOwnProperty;function g(t){return"[object Object]"===f.call(t)}function m(t,e){return!(null==t)&&p.call(t,e)}function v(t,e){let n,i;if(void 0===t)return;const r=function(t){return"[object Array]"===f.call(t)}(t)?w:y;for(let s in t)if(m(t,s)&&(n=t[s],i=e(n,r(s)),!1===i))return n}function b(t,e){return!!function(t,e){const n=function(t){return function(t){const e=f.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e||"[object GeneratorFunction]"===e||"[object AsyncGeneratorFunction]"===e||"[object Proxy]"===e}(t)?t:e=>e===t}(e);let i;return v(t,function(t,e){if(n(t,e))return i=t,!1}),i}(t,e)}function y(t){return t}function w(t){return Number(t)}function x(t,e){let n={};return v(Object(t),function(t,i){-1===e.indexOf(i)&&(n[i]=t)}),n}function k(t,e){var n=S(t);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(e)}function A(t,e){return b(e,function(e){return k(t,e)})}function S(t){return t&&t.businessObject||t}const C=["bpmn:Task"],E="Select a task to start testing.",T="Task testing is only supported for tasks. Select a task to start testing.";function O(t){return t.$parent}var M=s(7),_=s.n(M);const P={input:{},output:{}},D=["bpmn:Task"];class R extends(_()){constructor(t,e,n=P){super(),this._injector=t,this._elementVariables=e,this._config={...P,...n},this._selectedElement=null,this._variablesForElements=new Map}setConfig(t){this._config=t,this.emit("config.changed")}getConfig(){return this._config}setInputConfigForElement(t,e){if(!A(t,D))throw new Error(`Unsupported element type: ${t.type}`);this._config={...this._config,input:{...this._config.input,[t.id]:e}},this.emit("config.changed",{config:this._config})}resetInputConfigForElement(t){if(!A(t,D))throw new Error(`Unsupported element type: ${t.type}`);this._config={...this._config,input:x(this._config.input,t.id)},this.emit("config.changed")}setOutputConfigForElement(t,e){if(!A(t,D))throw new Error(`Unsupported element type: ${t.type}`);this._config={...this._config,output:{...this._config.output,[t.id]:e}},this.emit("config.changed")}resetOutputConfigForElement(t){if(!A(t,D))throw new Error(`Unsupported element type: ${t.type}`);this._config={...this._config,output:x(this._config.output,t.id)},this.emit("config.changed")}getInputConfigForElement(t){if(!A(t,D))throw new Error(`Unsupported element type: ${t.type}`);return e=this._config.input[t.id],"[object String]"!==f.call(e)?this._getDefaultInputConfig():this._config.input[t.id];var e}getOutputConfigForElement(t){if(!A(t,D))throw new Error(`Unsupported element type: ${t.type}`);if(this._config.output[t.id])return this._config.output[t.id]}_getDefaultInputConfig(){return"{}"}}class B extends(_()){constructor(t){super(),this._injector=t,this._variables={},this._variableResolver=t.get("variableResolver"),this._injector.get("eventBus").on("commandStack.changed",()=>{this._variables={},this.emit("variables.changed")})}async getVariablesForElement(t){if(this._variables[t.id])return this._variables[t.id];const e=await this._variableResolver.getVariablesForElement(t).catch(()=>[]);return this._variables[t.id]=e,e}}var I=s(848);let N=[],L=[];function F(t){if(t<768)return!1;for(let e=0,n=N.length;;){let i=e+n>>1;if(t<N[i])n=i;else{if(!(t>=L[i]))return!0;e=i+1}if(e==n)return!1}}function V(t){return t>=127462&&t<=127487}function z(t,e,n=!0,i=!0){return(n?j:H)(t,e,i)}function j(t,e,n){if(e==t.length)return e;e&&$(t.charCodeAt(e))&&q(t.charCodeAt(e-1))&&e--;let i=W(t,e);for(e+=U(i);e<t.length;){let r=W(t,e);if(8205==i||8205==r||n&&F(r))e+=U(r),i=r;else{if(!V(r))break;{let n=0,i=e-2;for(;i>=0&&V(W(t,i));)n++,i-=2;if(n%2==0)break;e+=2}}}return e}function H(t,e,n){for(;e>0;){let i=j(t,e-2,n);if(i<e)return i;e--}return 0}function W(t,e){let n=t.charCodeAt(e);if(!q(n)||e+1==t.length)return n;let i=t.charCodeAt(e+1);return $(i)?i-56320+(n-55296<<10)+65536:n}function $(t){return t>=56320&&t<57344}function q(t){return t>=55296&&t<56320}function U(t){return t<65536?1:2}(()=>{let t="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(t=>t?parseInt(t,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?L:N).push(n+=t[e])})();class K{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,n){[t,e]=nt(this,t,e);let i=[];return this.decompose(0,t,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(e,this.length,i,1),Y.from(i,this.length-(e-t)+n.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=nt(this,t,e);let n=[];return this.decompose(t,e,n,0),Y.from(n,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),n=this.length-this.scanIdentical(t,-1),i=new X(this),r=new X(t);for(let t=e,s=e;;){if(i.next(t),r.next(t),t=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}iter(t=1){return new X(this,t)}iterRange(t,e=this.length){return new Z(this,t,e)}iterLines(t,e){let n;if(null==t)n=this.iter();else{null==e&&(e=this.lines+1);let i=this.line(t).from;n=this.iterRange(i,Math.max(i,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new tt(n)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(0==t.length)throw new RangeError("A document must have at least one line");return 1!=t.length||t[0]?t.length<=32?new G(t):Y.from(G.split(t,[])):K.empty}}class G extends K{constructor(t,e=function(t){let e=-1;for(let n of t)e+=n.length+1;return e}(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,n,i){for(let r=0;;r++){let s=this.text[r],o=i+s.length;if((e?n:o)>=t)return new et(i,o,n,s);i=o+1,n++}}decompose(t,e,n,i){let r=t<=0&&e>=this.length?this:new G(J(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(1&i){let t=n.pop(),e=Q(r.text,t.text.slice(),0,r.length);if(e.length<=32)n.push(new G(e,t.length+r.length));else{let t=e.length>>1;n.push(new G(e.slice(0,t)),new G(e.slice(t)))}}else n.push(r)}replace(t,e,n){if(!(n instanceof G))return super.replace(t,e,n);[t,e]=nt(this,t,e);let i=Q(this.text,Q(n.text,J(this.text,0,t)),e),r=this.length+n.length-(e-t);return i.length<=32?new G(i,r):Y.from(G.split(i,[]),r)}sliceString(t,e=this.length,n="\n"){[t,e]=nt(this,t,e);let i="";for(let r=0,s=0;r<=e&&s<this.text.length;s++){let o=this.text[s],l=r+o.length;r>t&&s&&(i+=n),t<l&&e>r&&(i+=o.slice(Math.max(0,t-r),e-r)),r=l+1}return i}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let n=[],i=-1;for(let r of t)n.push(r),i+=r.length+1,32==n.length&&(e.push(new G(n,i)),n=[],i=-1);return i>-1&&e.push(new G(n,i)),e}}class Y extends K{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let e of t)this.lines+=e.lines}lineInner(t,e,n,i){for(let r=0;;r++){let s=this.children[r],o=i+s.length,l=n+s.lines-1;if((e?l:o)>=t)return s.lineInner(t,e,n,i);i=o+1,n=l+1}}decompose(t,e,n,i){for(let r=0,s=0;s<=e&&r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(t<=l&&e>=s){let r=i&((s<=t?1:0)|(l>=e?2:0));s>=t&&l<=e&&!r?n.push(o):o.decompose(t-s,e-s,n,r)}s=l+1}}replace(t,e,n){if([t,e]=nt(this,t,e),n.lines<this.lines)for(let i=0,r=0;i<this.children.length;i++){let s=this.children[i],o=r+s.length;if(t>=r&&e<=o){let l=s.replace(t-r,e-r,n),a=this.lines-s.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let r=this.children.slice();return r[i]=l,new Y(r,this.length-(e-t)+n.length)}return super.replace(r,o,l)}r=o+1}return super.replace(t,e,n)}sliceString(t,e=this.length,n="\n"){[t,e]=nt(this,t,e);let i="";for(let r=0,s=0;r<this.children.length&&s<=e;r++){let o=this.children[r],l=s+o.length;s>t&&r&&(i+=n),t<l&&e>s&&(i+=o.sliceString(t-s,e-s,n)),s=l+1}return i}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof Y))return 0;let n=0,[i,r,s,o]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=e,r+=e){if(i==s||r==o)return n;let l=this.children[i],a=t.children[r];if(l!=a)return n+l.scanIdentical(a,e);n+=l.length+1}}static from(t,e=t.reduce((t,e)=>t+e.length+1,-1)){let n=0;for(let e of t)n+=e.lines;if(n<32){let n=[];for(let e of t)e.flatten(n);return new G(n,e)}let i=Math.max(32,n>>5),r=i<<1,s=i>>1,o=[],l=0,a=-1,h=[];function c(t){let e;if(t.lines>r&&t instanceof Y)for(let e of t.children)c(e);else t.lines>s&&(l>s||!l)?(u(),o.push(t)):t instanceof G&&l&&(e=h[h.length-1])instanceof G&&t.lines+e.lines<=32?(l+=t.lines,a+=t.length+1,h[h.length-1]=new G(e.text.concat(t.text),e.length+1+t.length)):(l+t.lines>i&&u(),l+=t.lines,a+=t.length+1,h.push(t))}function u(){0!=l&&(o.push(1==h.length?h[0]:Y.from(h,a)),a=-1,l=h.length=0)}for(let e of t)c(e);return u(),1==o.length?o[0]:new Y(o,e)}}function Q(t,e,n=0,i=1e9){for(let r=0,s=0,o=!0;s<t.length&&r<=i;s++){let l=t[s],a=r+l.length;a>=n&&(a>i&&(l=l.slice(0,i-r)),r<n&&(l=l.slice(n-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function J(t,e,n){return Q(t,[""],e,n)}K.empty=new G([""],0);class X{constructor(t,e=1){this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[e>0?1:(t instanceof G?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],s=r>>1,o=i instanceof G?i.text.length:i.children.length;if(s==(e>0?o:0)){if(0==n)return this.done=!0,this.value="",this;e>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(e>0?0:1)){if(this.offsets[n]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(i instanceof G){let r=i.text[s+(e<0?-1:0)];if(this.offsets[n]+=e,r.length>Math.max(0,t))return this.value=0==t?r:e>0?r.slice(t):r.slice(0,r.length-t),this;t-=r.length}else{let r=i.children[s+(e<0?-1:0)];t>r.length?(t-=r.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(e>0?1:(r instanceof G?r.text.length:r.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class Z{constructor(t,e,n){this.value="",this.done=!1,this.cursor=new X(t,e>n?-1:1),this.pos=e>n?t.length:0,this.from=Math.min(e,n),this.to=Math.max(e,n)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let n=e<0?this.pos-this.from:this.to-this.pos;t>n&&(t=n),n-=t;let{value:i}=this.cursor.next(t);return this.pos+=(i.length+t)*e,this.value=i.length<=n?i:e<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class tt{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:n,value:i}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(K.prototype[Symbol.iterator]=function(){return this.iter()},X.prototype[Symbol.iterator]=Z.prototype[Symbol.iterator]=tt.prototype[Symbol.iterator]=function(){return this});class et{constructor(t,e,n,i){this.from=t,this.to=e,this.number=n,this.text=i}get length(){return this.to-this.from}}function nt(t,e,n){return[e=Math.max(0,Math.min(t.length,e)),Math.max(e,Math.min(t.length,n))]}function it(t,e,n=!0,i=!0){return z(t,e,n,i)}function rt(t,e){let n=t.charCodeAt(e);if(!((i=n)>=55296&&i<56320&&e+1!=t.length))return n;var i;let r=t.charCodeAt(e+1);return function(t){return t>=56320&&t<57344}(r)?r-56320+(n-55296<<10)+65536:n}function st(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function ot(t){return t<65536?1:2}const lt=/\r\n?|\n/;var at=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(at||(at={}));class ht{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}get newLength(){let t=0;for(let e=0;e<this.sections.length;e+=2){let n=this.sections[e+1];t+=n<0?this.sections[e]:n}return t}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(t){for(let e=0,n=0,i=0;e<this.sections.length;){let r=this.sections[e++],s=this.sections[e++];s<0?(t(n,i,r),i+=r):i+=s,n+=r}}iterChangedRanges(t,e=!1){ft(this,t,e)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],i=this.sections[e++];i<0?t.push(n,i):t.push(i,n)}return new ht(t)}composeDesc(t){return this.empty?t:t.empty?this:gt(this,t)}mapDesc(t,e=!1){return t.empty?this:pt(this,t,e)}mapPos(t,e=-1,n=at.Simple){let i=0,r=0;for(let s=0;s<this.sections.length;){let o=this.sections[s++],l=this.sections[s++],a=i+o;if(l<0){if(a>t)return r+(t-i);r+=o}else{if(n!=at.Simple&&a>=t&&(n==at.TrackDel&&i<t&&a>t||n==at.TrackBefore&&i<t||n==at.TrackAfter&&a>t))return null;if(a>t||a==t&&e<0&&!o)return t==i||e<0?r:r+l;r+=l}i=a}if(t>i)throw new RangeError(`Position ${t} is out of range for changeset of length ${i}`);return r}touchesRange(t,e=t){for(let n=0,i=0;n<this.sections.length&&i<=e;){let r=i+this.sections[n++];if(this.sections[n++]>=0&&i<=e&&r>=t)return!(i<t&&r>e)||"cover";i=r}return!1}toString(){let t="";for(let e=0;e<this.sections.length;){let n=this.sections[e++],i=this.sections[e++];t+=(t?" ":"")+n+(i>=0?":"+i:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(t=>"number"!=typeof t))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ht(t)}static create(t){return new ht(t)}}class ct extends ht{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return ft(this,(e,n,i,r,s)=>t=t.replace(i,i+(n-e),s),!1),t}mapDesc(t,e=!1){return pt(this,t,e,!0)}invert(t){let e=this.sections.slice(),n=[];for(let i=0,r=0;i<e.length;i+=2){let s=e[i],o=e[i+1];if(o>=0){e[i]=o,e[i+1]=s;let l=i>>1;for(;n.length<l;)n.push(K.empty);n.push(s?t.slice(r,r+s):K.empty)}r+=s}return new ct(e,n)}compose(t){return this.empty?t:t.empty?this:gt(this,t,!0)}map(t,e=!1){return t.empty?this:pt(this,t,e,!0)}iterChanges(t,e=!1){ft(this,t,e)}get desc(){return ht.create(this.sections)}filter(t){let e=[],n=[],i=[],r=new mt(this);t:for(let s=0,o=0;;){let l=s==t.length?1e9:t[s++];for(;o<l||o==l&&0==r.len;){if(r.done)break t;let t=Math.min(r.len,l-o);ut(i,t,-1);let s=-1==r.ins?-1:0==r.off?r.ins:0;ut(e,t,s),s>0&&dt(n,e,r.text),r.forward(t),o+=t}let a=t[s++];for(;o<a;){if(r.done)break t;let t=Math.min(r.len,a-o);ut(e,t,-1),ut(i,t,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(t),o+=t}}return{changes:new ct(e,n),filtered:ht.create(i)}}toJSON(){let t=[];for(let e=0;e<this.sections.length;e+=2){let n=this.sections[e],i=this.sections[e+1];i<0?t.push(n):0==i?t.push([n]):t.push([n].concat(this.inserted[e>>1].toJSON()))}return t}static of(t,e,n){let i=[],r=[],s=0,o=null;function l(t=!1){if(!t&&!i.length)return;s<e&&ut(i,e-s,-1);let n=new ct(i,r);o=o?o.compose(n.map(o)):n,i=[],r=[],s=0}return function t(a){if(Array.isArray(a))for(let e of a)t(e);else if(a instanceof ct){if(a.length!=e)throw new RangeError(`Mismatched change set length (got ${a.length}, expected ${e})`);l(),o=o?o.compose(a.map(o)):a}else{let{from:t,to:o=t,insert:h}=a;if(t>o||t<0||o>e)throw new RangeError(`Invalid change range ${t} to ${o} (in doc of length ${e})`);let c=h?"string"==typeof h?K.of(h.split(n||lt)):h:K.empty,u=c.length;if(t==o&&0==u)return;t<s&&l(),t>s&&ut(i,t-s,-1),ut(i,o-t,u),dt(r,i,c),s=o}}(t),l(!o),o}static empty(t){return new ct(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],n=[];for(let i=0;i<t.length;i++){let r=t[i];if("number"==typeof r)e.push(r,-1);else{if(!Array.isArray(r)||"number"!=typeof r[0]||r.some((t,e)=>e&&"string"!=typeof t))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)e.push(r[0],0);else{for(;n.length<i;)n.push(K.empty);n[i]=K.of(r.slice(1)),e.push(r[0],n[i].length)}}}return new ct(e,n)}static createSet(t,e){return new ct(t,e)}}function ut(t,e,n,i=!1){if(0==e&&n<=0)return;let r=t.length-2;r>=0&&n<=0&&n==t[r+1]?t[r]+=e:r>=0&&0==e&&0==t[r]?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}function dt(t,e,n){if(0==n.length)return;let i=e.length-2>>1;if(i<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<i;)t.push(K.empty);t.push(n)}}function ft(t,e,n){let i=t.inserted;for(let r=0,s=0,o=0;o<t.sections.length;){let l=t.sections[o++],a=t.sections[o++];if(a<0)r+=l,s+=l;else{let h=r,c=s,u=K.empty;for(;h+=l,c+=a,a&&i&&(u=u.append(i[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)l=t.sections[o++],a=t.sections[o++];e(r,h,s,c,u),r=h,s=c}}}function pt(t,e,n,i=!1){let r=[],s=i?[]:null,o=new mt(t),l=new mt(e);for(let t=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(-1==o.ins&&-1==l.ins){let t=Math.min(o.len,l.len);ut(r,t,-1),o.forward(t),l.forward(t)}else if(l.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(l.len<o.len||l.len==o.len&&!n))){let e=l.len;for(ut(r,l.ins,-1);e;){let n=Math.min(o.len,e);o.ins>=0&&t<o.i&&o.len<=n&&(ut(r,0,o.ins),s&&dt(s,r,o.text),t=o.i),o.forward(n),e-=n}l.next()}else{if(!(o.ins>=0)){if(o.done&&l.done)return s?ct.createSet(r,s):ht.create(r);throw new Error("Mismatched change set lengths")}{let e=0,n=o.len;for(;n;)if(-1==l.ins){let t=Math.min(n,l.len);e+=t,n-=t,l.forward(t)}else{if(!(0==l.ins&&l.len<n))break;n-=l.len,l.next()}ut(r,e,t<o.i?o.ins:0),s&&t<o.i&&dt(s,r,o.text),t=o.i,o.forward(o.len-n)}}}}function gt(t,e,n=!1){let i=[],r=n?[]:null,s=new mt(t),o=new mt(e);for(let t=!1;;){if(s.done&&o.done)return r?ct.createSet(i,r):ht.create(i);if(0==s.ins)ut(i,s.len,0,t),s.next();else if(0!=o.len||o.done){if(s.done||o.done)throw new Error("Mismatched change set lengths");{let e=Math.min(s.len2,o.len),n=i.length;if(-1==s.ins){let n=-1==o.ins?-1:o.off?0:o.ins;ut(i,e,n,t),r&&n&&dt(r,i,o.text)}else-1==o.ins?(ut(i,s.off?0:s.len,e,t),r&&dt(r,i,s.textBit(e))):(ut(i,s.off?0:s.len,o.off?0:o.ins,t),r&&!o.off&&dt(r,i,o.text));t=(s.ins>e||o.ins>=0&&o.len>e)&&(t||i.length>n),s.forward2(e),o.forward(e)}}else ut(i,0,o.ins,t),r&&dt(r,i,o.text),o.next()}}class mt{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:t}=this.set,e=this.i-2>>1;return e>=t.length?K.empty:t[e]}textBit(t){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length&&!t?K.empty:e[n].slice(this.off,null==t?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class vt{constructor(t,e,n){this.from=t,this.to=e,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 t=7&this.flags;return 7==t?null:t}get goalColumn(){let t=this.flags>>6;return 16777215==t?void 0:t}map(t,e=-1){let n,i;return this.empty?n=i=t.mapPos(this.from,e):(n=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new vt(n,i,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return bt.range(t,e);let n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return bt.range(this.anchor,n)}eq(t,e=!1){return!(this.anchor!=t.anchor||this.head!=t.head||e&&this.empty&&this.assoc!=t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return bt.range(t.anchor,t.head)}static create(t,e,n){return new vt(t,e,n)}}class bt{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:bt.create(this.ranges.map(n=>n.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(t.ranges[n],e))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new bt([this.main],0)}addRange(t,e=!0){return bt.create([t].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(t,e=this.mainIndex){let n=this.ranges.slice();return n[e]=t,bt.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new bt(t.ranges.map(t=>vt.fromJSON(t)),t.main)}static single(t,e=t){return new bt([bt.range(t,e)],0)}static create(t,e=0){if(0==t.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;i<t.length;i++){let r=t[i];if(r.empty?r.from<=n:r.from<n)return bt.normalized(t.slice(),e);n=r.to}return new bt(t,e)}static cursor(t,e=0,n,i){return vt.create(t,t,(0==e?0:e<0?8:16)|(null==n?7:Math.min(6,n))|(null!=i?i:16777215)<<6)}static range(t,e,n,i){let r=(null!=n?n:16777215)<<6|(null==i?7:Math.min(6,i));return e<t?vt.create(e,t,48|r):vt.create(t,e,(e>t?8:0)|r)}static normalized(t,e=0){let n=t[e];t.sort((t,e)=>t.from-e.from),e=t.indexOf(n);for(let n=1;n<t.length;n++){let i=t[n],r=t[n-1];if(i.empty?i.from<=r.to:i.from<r.to){let s=r.from,o=Math.max(i.to,r.to);n<=e&&e--,t.splice(--n,2,i.anchor>i.head?bt.range(o,s):bt.range(s,o))}}return new bt(t,e)}}function yt(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let wt=0;class xt{constructor(t,e,n,i,r){this.combine=t,this.compareInput=e,this.compare=n,this.isStatic=i,this.id=wt++,this.default=t([]),this.extensions="function"==typeof r?r(this):r}get reader(){return this}static define(t={}){return new xt(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:kt),!!t.static,t.enables)}of(t){return new At([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new At(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new At(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],n=>e(n.field(t)))}}function kt(t,e){return t==e||t.length==e.length&&t.every((t,n)=>t===e[n])}class At{constructor(t,e,n,i){this.dependencies=t,this.facet=e,this.type=n,this.value=i,this.id=wt++}dynamicSlot(t){var e;let n=this.value,i=this.facet.compareInput,r=this.id,s=t[r]>>1,o=2==this.type,l=!1,a=!1,h=[];for(let n of this.dependencies)"doc"==n?l=!0:"selection"==n?a=!0:1&(null!==(e=t[n.id])&&void 0!==e?e:1)||h.push(t[n.id]);return{create:t=>(t.values[s]=n(t),1),update(t,e){if(l&&e.docChanged||a&&(e.docChanged||e.selection)||Ct(t,h)){let e=n(t);if(o?!St(e,t.values[s],i):!i(e,t.values[s]))return t.values[s]=e,1}return 0},reconfigure:(t,e)=>{let l,a=e.config.address[r];if(null!=a){let r=Nt(e,a);if(this.dependencies.every(n=>n instanceof xt?e.facet(n)===t.facet(n):!(n instanceof Ot)||e.field(n,!1)==t.field(n,!1))||(o?St(l=n(t),r,i):i(l=n(t),r)))return t.values[s]=r,0}else l=n(t);return t.values[s]=l,1}}}}function St(t,e,n){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!n(t[i],e[i]))return!1;return!0}function Ct(t,e){let n=!1;for(let i of e)1&It(t,i)&&(n=!0);return n}function Et(t,e,n){let i=n.map(e=>t[e.id]),r=n.map(t=>t.type),s=i.filter(t=>!(1&t)),o=t[e.id]>>1;function l(t){let n=[];for(let e=0;e<i.length;e++){let s=Nt(t,i[e]);if(2==r[e])for(let t of s)n.push(t);else n.push(s)}return e.combine(n)}return{create(t){for(let e of i)It(t,e);return t.values[o]=l(t),1},update(t,n){if(!Ct(t,s))return 0;let i=l(t);return e.compare(i,t.values[o])?0:(t.values[o]=i,1)},reconfigure(t,r){let s=Ct(t,i),a=r.config.facets[e.id],h=r.facet(e);if(a&&!s&&kt(n,a))return t.values[o]=h,0;let c=l(t);return e.compare(c,h)?(t.values[o]=h,0):(t.values[o]=c,1)}}}const Tt=xt.define({static:!0});class Ot{constructor(t,e,n,i,r){this.id=t,this.createF=e,this.updateF=n,this.compareF=i,this.spec=r,this.provides=void 0}static define(t){let e=new Ot(wt++,t.create,t.update,t.compare||((t,e)=>t===e),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(Tt).find(t=>t.field==this);return((null==e?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:t=>(t.values[e]=this.create(t),1),update:(t,n)=>{let i=t.values[e],r=this.updateF(i,n);return this.compareF(i,r)?0:(t.values[e]=r,1)},reconfigure:(t,n)=>{let i,r=t.facet(Tt),s=n.facet(Tt);return(i=r.find(t=>t.field==this))&&i!=s.find(t=>t.field==this)?(t.values[e]=i.create(t),1):null!=n.config.address[this.id]?(t.values[e]=n.field(this),0):(t.values[e]=this.create(t),1)}}}init(t){return[this,Tt.of({field:this,create:t})]}get extension(){return this}}function Mt(t){return e=>new Pt(e,t)}const _t={highest:Mt(0),high:Mt(1),default:Mt(2),low:Mt(3),lowest:Mt(4)};class Pt{constructor(t,e){this.inner=t,this.prec=e}}class Dt{of(t){return new Rt(this,t)}reconfigure(t){return Dt.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class Rt{constructor(t,e){this.compartment=t,this.inner=e}}class Bt{constructor(t,e,n,i,r,s){for(this.base=t,this.compartments=e,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(t){let e=this.address[t.id];return null==e?t.default:this.staticValues[e>>1]}static resolve(t,e,n){let i=[],r=Object.create(null),s=new Map;for(let n of function(t,e,n){let i=[[],[],[],[],[]],r=new Map;return function t(s,o){let l=r.get(s);if(null!=l){if(l<=o)return;let t=i[l].indexOf(s);t>-1&&i[l].splice(t,1),s instanceof Rt&&n.delete(s.compartment)}if(r.set(s,o),Array.isArray(s))for(let e of s)t(e,o);else if(s instanceof Rt){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=e.get(s.compartment)||s.inner;n.set(s.compartment,i),t(i,o)}else if(s instanceof Pt)t(s.inner,s.prec);else if(s instanceof Ot)i[o].push(s),s.provides&&t(s.provides,o);else if(s instanceof At)i[o].push(s),s.facet.extensions&&t(s.facet.extensions,2);else{let e=s.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);t(e,o)}}(t,2),i.reduce((t,e)=>t.concat(e))}(t,e,s))n instanceof Ot?i.push(n):(r[n.facet.id]||(r[n.facet.id]=[])).push(n);let o=Object.create(null),l=[],a=[];for(let t of i)o[t.id]=a.length<<1,a.push(e=>t.slot(e));let h=null==n?void 0:n.config.facets;for(let t in r){let e=r[t],i=e[0].facet,s=h&&h[t]||[];if(e.every(t=>0==t.type))if(o[i.id]=l.length<<1|1,kt(s,e))l.push(n.facet(i));else{let t=i.combine(e.map(t=>t.value));l.push(n&&i.compare(t,n.facet(i))?n.facet(i):t)}else{for(let t of e)0==t.type?(o[t.id]=l.length<<1|1,l.push(t.value)):(o[t.id]=a.length<<1,a.push(e=>t.dynamicSlot(e)));o[i.id]=a.length<<1,a.push(t=>Et(t,i,e))}}let c=a.map(t=>t(o));return new Bt(t,s,c,o,l,r)}}function It(t,e){if(1&e)return 2;let n=e>>1,i=t.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;t.status[n]=4;let r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function Nt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const Lt=xt.define(),Ft=xt.define({combine:t=>t.some(t=>t),static:!0}),Vt=xt.define({combine:t=>t.length?t[0]:void 0,static:!0}),zt=xt.define(),jt=xt.define(),Ht=xt.define(),Wt=xt.define({combine:t=>!!t.length&&t[0]});class $t{constructor(t,e){this.type=t,this.value=e}static define(){return new qt}}class qt{of(t){return new $t(this,t)}}class Ut{constructor(t){this.map=t}of(t){return new Kt(this,t)}}class Kt{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return void 0===e?void 0:e==this.value?this:new Kt(this.type,e)}is(t){return this.type==t}static define(t={}){return new Ut(t.map||(t=>t))}static mapEffects(t,e){if(!t.length)return t;let n=[];for(let i of t){let t=i.map(e);t&&n.push(t)}return n}}Kt.reconfigure=Kt.define(),Kt.appendConfig=Kt.define();class Gt{constructor(t,e,n,i,r,s){this.startState=t,this.changes=e,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=s,this._doc=null,this._state=null,n&&yt(n,e.newLength),r.some(t=>t.type==Gt.time)||(this.annotations=r.concat(Gt.time.of(Date.now())))}static create(t,e,n,i,r,s){return new Gt(t,e,n,i,r,s)}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(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(Gt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function Yt(t,e){let n=[];for(let i=0,r=0;;){let s,o;if(i<t.length&&(r==e.length||e[r]>=t[i]))s=t[i++],o=t[i++];else{if(!(r<e.length))return n;s=e[r++],o=e[r++]}!n.length||n[n.length-1]<s?n.push(s,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function Qt(t,e,n){var i;let r,s,o;return n?(r=e.changes,s=ct.empty(e.changes.length),o=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(s):null===(i=t.selection)||void 0===i?void 0:i.map(r),effects:Kt.mapEffects(t.effects,r).concat(Kt.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Jt(t,e,n){let i=e.selection,r=te(e.annotations);return e.userEvent&&(r=r.concat(Gt.userEvent.of(e.userEvent))),{changes:e.changes instanceof ct?e.changes:ct.of(e.changes||[],n,t.facet(Vt)),selection:i&&(i instanceof bt?i:bt.single(i.anchor,i.head)),effects:te(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Xt(t,e,n){let i=Jt(t,e.length?e[0]:{},t.doc.length);e.length&&!1===e[0].filter&&(n=!1);for(let r=1;r<e.length;r++){!1===e[r].filter&&(n=!1);let s=!!e[r].sequential;i=Qt(i,Jt(t,e[r],s?i.changes.newLength:t.doc.length),s)}let r=Gt.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(t){let e=t.startState,n=e.facet(Ht),i=t;for(let r=n.length-1;r>=0;r--){let s=n[r](t);s&&Object.keys(s).length&&(i=Qt(i,Jt(e,s,t.changes.newLength),!0))}return i==t?t:Gt.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(t){let e=t.startState,n=!0;for(let i of e.facet(zt)){let e=i(t);if(!1===e){n=!1;break}Array.isArray(e)&&(n=!0===n?e:Yt(n,e))}if(!0!==n){let i,r;if(!1===n)r=t.changes.invertedDesc,i=ct.empty(e.doc.length);else{let e=t.changes.filter(n);i=e.changes,r=e.filtered.mapDesc(e.changes).invertedDesc}t=Gt.create(e,i,t.selection&&t.selection.map(r),Kt.mapEffects(t.effects,r),t.annotations,t.scrollIntoView)}let i=e.facet(jt);for(let n=i.length-1;n>=0;n--){let r=i[n](t);t=r instanceof Gt?r:Array.isArray(r)&&1==r.length&&r[0]instanceof Gt?r[0]:Xt(e,te(r),!1)}return t}(r):r)}Gt.time=$t.define(),Gt.userEvent=$t.define(),Gt.addToHistory=$t.define(),Gt.remote=$t.define();const Zt=[];function te(t){return null==t?Zt:Array.isArray(t)?t:[t]}var ee=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(ee||(ee={}));const ne=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ie;try{ie=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}class re{constructor(t,e,n,i,r,s){this.config=t,this.doc=e,this.selection=n,this.values=i,this.status=t.statusTemplate.slice(),this.computeSlot=r,s&&(s._state=this);for(let t=0;t<this.config.dynamicSlots.length;t++)It(this,t<<1);this.computeSlot=null}field(t,e=!0){let n=this.config.address[t.id];if(null!=n)return It(this,n),Nt(this,n);if(e)throw new RangeError("Field is not present in this state")}update(...t){return Xt(this,t,!0)}applyTransaction(t){let e,n=this.config,{base:i,compartments:r}=n;for(let e of t.effects)e.is(Dt.reconfigure)?(n&&(r=new Map,n.compartments.forEach((t,e)=>r.set(e,t)),n=null),r.set(e.value.compartment,e.value.extension)):e.is(Kt.reconfigure)?(n=null,i=e.value):e.is(Kt.appendConfig)&&(n=null,i=te(i).concat(e.value));n?e=t.startState.values.slice():(n=Bt.resolve(i,r,this),e=new re(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(t,e)=>e.reconfigure(t,this),null).values);let s=t.startState.facet(Ft)?t.newSelection:t.newSelection.asSingle();new re(n,t.newDoc,s,e,(e,n)=>n.update(e,t),t)}replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:bt.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,n=t(e.ranges[0]),i=this.changes(n.changes),r=[n.range],s=te(n.effects);for(let n=1;n<e.ranges.length;n++){let o=t(e.ranges[n]),l=this.changes(o.changes),a=l.map(i);for(let t=0;t<n;t++)r[t]=r[t].map(a);let h=i.mapDesc(l,!0);r.push(o.range.map(h)),i=i.compose(a),s=Kt.mapEffects(s,a).concat(Kt.mapEffects(te(o.effects),h))}return{changes:i,selection:bt.create(r,e.mainIndex),effects:s}}changes(t=[]){return t instanceof ct?t:ct.of(t,this.doc.length,this.facet(re.lineSeparator))}toText(t){return K.of(t.split(this.facet(re.lineSeparator)||lt))}sliceDoc(t=0,e=this.doc.length){return this.doc.sliceString(t,e,this.lineBreak)}facet(t){let e=this.config.address[t.id];return null==e?t.default:(It(this,e),Nt(this,e))}toJSON(t){let e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let n in t){let i=t[n];i instanceof Ot&&null!=this.config.address[i.id]&&(e[n]=i.spec.toJSON(this.field(t[n]),this))}return e}static fromJSON(t,e={},n){if(!t||"string"!=typeof t.doc)throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n)for(let e in n)if(Object.prototype.hasOwnProperty.call(t,e)){let r=n[e],s=t[e];i.push(r.init(t=>r.spec.fromJSON(s,t)))}return re.create({doc:t.doc,selection:bt.fromJSON(t.selection),extensions:e.extensions?i.concat([e.extensions]):i})}static create(t={}){let e=Bt.resolve(t.extensions||[],new Map),n=t.doc instanceof K?t.doc:K.of((t.doc||"").split(e.staticFacet(re.lineSeparator)||lt)),i=t.selection?t.selection instanceof bt?t.selection:bt.single(t.selection.anchor,t.selection.head):bt.single(0);return yt(i,n.length),e.staticFacet(Ft)||(i=i.asSingle()),new re(e,n,i,e.dynamicSlots.map(()=>null),(t,e)=>e.create(t),null)}get tabSize(){return this.facet(re.tabSize)}get lineBreak(){return this.facet(re.lineSeparator)||"\n"}get readOnly(){return this.facet(Wt)}phrase(t,...e){for(let e of this.facet(re.phrases))if(Object.prototype.hasOwnProperty.call(e,t)){t=e[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,(t,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>e.length?t:e[i-1]})),t}languageDataAt(t,e,n=-1){let i=[];for(let r of this.facet(Lt))for(let s of r(this,e,n))Object.prototype.hasOwnProperty.call(s,t)&&i.push(s[t]);return i}charCategorizer(t){return e=this.languageDataAt("wordChars",t).join(""),t=>{if(!/\S/.test(t))return ee.Space;if(function(t){if(ie)return ie.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||ne.test(n)))return!0}return!1}(t))return ee.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return ee.Word;return ee.Other};var e}wordAt(t){let{text:e,from:n,length:i}=this.doc.lineAt(t),r=this.charCategorizer(t),s=t-n,o=t-n;for(;s>0;){let t=it(e,s,!1);if(r(e.slice(t,s))!=ee.Word)break;s=t}for(;o<i;){let t=it(e,o);if(r(e.slice(o,t))!=ee.Word)break;o=t}return s==o?null:bt.range(s+n,o+n)}}function se(t,e,n={}){let i={};for(let e of t)for(let t of Object.keys(e)){let r=e[t],s=i[t];if(void 0===s)i[t]=r;else if(s===r||void 0===r);else{if(!Object.hasOwnProperty.call(n,t))throw new Error("Config merge conflict for field "+t);i[t]=n[t](s,r)}}for(let t in e)void 0===i[t]&&(i[t]=e[t]);return i}re.allowMultipleSelections=Ft,re.tabSize=xt.define({combine:t=>t.length?t[0]:4}),re.lineSeparator=Vt,re.readOnly=Wt,re.phrases=xt.define({compare(t,e){let n=Object.keys(t),i=Object.keys(e);return n.length==i.length&&n.every(n=>t[n]==e[n])}}),re.languageData=Lt,re.changeFilter=zt,re.transactionFilter=jt,re.transactionExtender=Ht,Dt.reconfigure=Kt.define();class oe{eq(t){return this==t}range(t,e=t){return le.create(t,e,this)}}oe.prototype.startSide=oe.prototype.endSide=0,oe.prototype.point=!1,oe.prototype.mapMode=at.TrackDel;class le{constructor(t,e,n){this.from=t,this.to=e,this.value=n}static create(t,e,n){return new le(t,e,n)}}function ae(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class he{constructor(t,e,n,i){this.from=t,this.to=e,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(t,e,n,i=0){let r=n?this.to:this.from;for(let s=i,o=r.length;;){if(s==o)return s;let i=s+o>>1,l=r[i]-t||(n?this.value[i].endSide:this.value[i].startSide)-e;if(i==s)return l>=0?s:o;l>=0?o=i:s=i+1}}between(t,e,n,i){for(let r=this.findIndex(e,-1e9,!0),s=this.findIndex(n,1e9,!1,r);r<s;r++)if(!1===i(this.from[r]+t,this.to[r]+t,this.value[r]))return!1}map(t,e){let n=[],i=[],r=[],s=-1,o=-1;for(let l=0;l<this.value.length;l++){let a,h,c=this.value[l],u=this.from[l]+t,d=this.to[l]+t;if(u==d){let t=e.mapPos(u,c.startSide,c.mapMode);if(null==t)continue;if(a=h=t,c.startSide!=c.endSide&&(h=e.mapPos(u,c.endSide),h<a))continue}else if(a=e.mapPos(u,c.startSide),h=e.mapPos(d,c.endSide),a>h||a==h&&c.startSide>0&&c.endSide<=0)continue;(h-a||c.endSide-c.startSide)<0||(s<0&&(s=a),c.point&&(o=Math.max(o,h-a)),n.push(c),i.push(a-s),r.push(h-s))}return{mapped:n.length?new he(i,r,n,o):null,pos:s}}}class ce{constructor(t,e,n,i){this.chunkPos=t,this.chunk=e,this.nextLayer=n,this.maxPoint=i}static create(t,e,n,i){return new ce(t,e,n,i)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:n=!1,filterFrom:i=0,filterTo:r=this.length}=t,s=t.filter;if(0==e.length&&!s)return this;if(n&&(e=e.slice().sort(ae)),this.isEmpty)return e.length?ce.of(e):this;let o=new fe(this,null,-1).goto(0),l=0,a=[],h=new ue;for(;o.value||l<e.length;)if(l<e.length&&(o.from-e[l].from||o.startSide-e[l].value.startSide)>=0){let t=e[l++];h.addInner(t.from,t.to,t.value)||a.push(t)}else 1==o.rangeIndex&&o.chunkIndex<this.chunk.length&&(l==e.length||this.chunkEnd(o.chunkIndex)<e[l].from)&&(!s||i>this.chunkEnd(o.chunkIndex)||r<this.chunkPos[o.chunkIndex])&&h.addChunk(this.chunkPos[o.chunkIndex],this.chunk[o.chunkIndex])?o.nextChunk():((!s||i>o.to||r<o.from||s(o.from,o.to,o.value))&&(h.addInner(o.from,o.to,o.value)||a.push(le.create(o.from,o.to,o.value))),o.next());return h.finishInner(this.nextLayer.isEmpty&&!a.length?ce.empty:this.nextLayer.update({add:a,filter:s,filterFrom:i,filterTo:r}))}map(t){if(t.empty||this.isEmpty)return this;let e=[],n=[],i=-1;for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r],l=t.touchesRange(s,s+o.length);if(!1===l)i=Math.max(i,o.maxPoint),e.push(o),n.push(t.mapPos(s));else if(!0===l){let{mapped:r,pos:l}=o.map(s,t);r&&(i=Math.max(i,r.maxPoint),e.push(r),n.push(l))}}let r=this.nextLayer.map(t);return 0==e.length?r:new ce(n,e,r||ce.empty,i)}between(t,e,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let r=this.chunkPos[i],s=this.chunk[i];if(e>=r&&t<=r+s.length&&!1===s.between(r,t-r,e-r,n))return}this.nextLayer.between(t,e,n)}}iter(t=0){return pe.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return pe.from(t).goto(e)}static compare(t,e,n,i,r=-1){let s=t.filter(t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r),o=e.filter(t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r),l=de(s,o,n),a=new me(s,l,r),h=new me(o,l,r);n.iterGaps((t,e,n)=>ve(a,t,h,e,n,i)),n.empty&&0==n.length&&ve(a,0,h,0,0,i)}static eq(t,e,n=0,i){null==i&&(i=999999999);let r=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0),s=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0);if(r.length!=s.length)return!1;if(!r.length)return!0;let o=de(r,s),l=new me(r,o,0).goto(n),a=new me(s,o,0).goto(n);for(;;){if(l.to!=a.to||!be(l.active,a.active)||l.point&&(!a.point||!l.point.eq(a.point)))return!1;if(l.to>i)return!0;l.next(),a.next()}}static spans(t,e,n,i,r=-1){let s=new me(t,null,r).goto(e),o=e,l=s.openStart;for(;;){let t=Math.min(s.to,n);if(s.point){let n=s.activeForPoint(s.to),r=s.pointFrom<e?n.length+1:s.point.startSide<0?n.length:Math.min(n.length,l);i.point(o,t,s.point,n,r,s.pointRank),l=Math.min(s.openEnd(t),n.length)}else t>o&&(i.span(o,t,s.active,l),l=s.openEnd(t));if(s.to>n)return l+(s.point&&s.to>n?1:0);o=s.to,s.next()}}static of(t,e=!1){let n=new ue;for(let i of t instanceof le?[t]:e?function(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let i=t[n];if(ae(e,i)>0)return t.slice().sort(ae);e=i}return t}(t):t)n.add(i.from,i.to,i.value);return n.finish()}static join(t){if(!t.length)return ce.empty;let e=t[t.length-1];for(let n=t.length-2;n>=0;n--)for(let i=t[n];i!=ce.empty;i=i.nextLayer)e=new ce(i.chunkPos,i.chunk,e,Math.max(i.maxPoint,e.maxPoint));return e}}ce.empty=new ce([],[],null,-1),ce.empty.nextLayer=ce.empty;class ue{finishChunk(t){this.chunks.push(new he(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,t&&(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(t,e,n){this.addInner(t,e,n)||(this.nextLayer||(this.nextLayer=new ue)).add(t,e,n)}addInner(t,e,n){let i=t-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(t-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=n,this.lastFrom=t,this.lastTo=e,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),0))}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let n=e.value.length-1;return this.last=e.value[n],this.lastFrom=e.from[n]+t,this.lastTo=e.to[n]+t,!0}finish(){return this.finishInner(ce.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=ce.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function de(t,e,n){let i=new Map;for(let e of t)for(let t=0;t<e.chunk.length;t++)e.chunk[t].maxPoint<=0&&i.set(e.chunk[t],e.chunkPos[t]);let r=new Set;for(let t of e)for(let e=0;e<t.chunk.length;e++){let s=i.get(t.chunk[e]);null==s||(n?n.mapPos(s):s)!=t.chunkPos[e]||(null==n?void 0:n.touchesRange(s,s+t.chunk[e].length))||r.add(t.chunk[e])}return r}class fe{constructor(t,e,n,i=0){this.layer=t,this.skip=e,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,e=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}gotoInner(t,e,n){for(;this.chunkIndex<this.layer.chunk.length;){let e=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(e)||this.layer.chunkEnd(this.chunkIndex)<t||e.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],n=t+e.from[this.rangeIndex];if(this.from=n,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}class pe{constructor(t){this.heap=t}static from(t,e=null,n=-1){let i=[];for(let r=0;r<t.length;r++)for(let s=t[r];!s.isEmpty;s=s.nextLayer)s.maxPoint>=n&&i.push(new fe(s,e,n,r));return 1==i.length?i[0]:new pe(i)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let n of this.heap)n.goto(t,e);for(let t=this.heap.length>>1;t>=0;t--)ge(this.heap,t);return this.next(),this}forward(t,e){for(let n of this.heap)n.forward(t,e);for(let t=this.heap.length>>1;t>=0;t--)ge(this.heap,t);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),ge(this.heap,0)}}}function ge(t,e){for(let n=t[e];;){let i=1+(e<<1);if(i>=t.length)break;let r=t[i];if(i+1<t.length&&r.compare(t[i+1])>=0&&(r=t[i+1],i++),n.compare(r)<0)break;t[i]=n,t[e]=r,e=i}}class me{constructor(t,e,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=pe.from(t,e,n)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){ye(this.active,t),ye(this.activeTo,t),ye(this.activeRank,t),this.minActive=xe(this.active,this.activeTo)}addActive(t){let e=0,{value:n,to:i,rank:r}=this.cursor;for(;e<this.activeRank.length&&(r-this.activeRank[e]||i-this.activeTo[e])>0;)e++;we(this.active,e,n),we(this.activeTo,e,i),we(this.activeRank,e,r),t&&we(t,e,this.cursor.from),this.minActive=xe(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>t){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&ye(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let t=this.cursor.value;if(t.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=t,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=t.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}}if(n){this.openStart=0;for(let e=n.length-1;e>=0&&n[e]<t;e--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let e=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>t||this.activeTo[n]==t&&this.active[n].endSide>=this.point.endSide)&&e.push(this.active[n]);return e.reverse()}openEnd(t){let e=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>t;n--)e++;return e}}function ve(t,e,n,i,r,s){t.goto(e),n.goto(i);let o=i+r,l=i,a=i-e;for(;;){let e=t.to+a-n.to,i=e||t.endSide-n.endSide,r=i<0?t.to+a:n.to,h=Math.min(r,o);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&be(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(l,h,t.point,n.point):h>l&&!be(t.active,n.active)&&s.compareRange(l,h,t.active,n.active),r>o)break;(e||t.openEnd!=n.openEnd)&&s.boundChange&&s.boundChange(r),l=r,i<=0&&t.next(),i>=0&&n.next()}}function be(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].eq(e[n]))return!1;return!0}function ye(t,e){for(let n=e,i=t.length-1;n<i;n++)t[n]=t[n+1];t.pop()}function we(t,e,n){for(let n=t.length-1;n>=e;n--)t[n+1]=t[n];t[e]=n}function xe(t,e){let n=-1,i=1e9;for(let r=0;r<e.length;r++)(e[r]-i||t[r].endSide-t[n].endSide)<0&&(n=r,i=e[r]);return n}function ke(t,e,n=t.length){let i=0;for(let r=0;r<n&&r<t.length;)9==t.charCodeAt(r)?(i+=e-i%e,r++):(i++,r=it(t,r));return i}const Ae="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Se="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),Ce="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class Ee{constructor(t,e){this.rules=[];let{finish:n}=e||{};function i(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function r(t,e,s,o){let l=[],a=/^@(\w+)\b/.exec(t[0]),h=a&&"keyframes"==a[1];if(a&&null==e)return s.push(t[0]+";");for(let n in e){let o=e[n];if(/&/.test(n))r(n.split(/,\s*/).map(e=>t.map(t=>e.replace(/&/,t))).reduce((t,e)=>t.concat(e)),o,s);else if(o&&"object"==typeof o){if(!a)throw new RangeError("The value of a property ("+n+") should be a primitive value.");r(i(n),o,l,h)}else null!=o&&l.push(n.replace(/_.*/,"").replace(/[A-Z]/g,t=>"-"+t.toLowerCase())+": "+o+";")}(l.length||h)&&s.push((!n||a||o?t:t.map(n)).join(", ")+" {"+l.join(" ")+"}")}for(let e in t)r(i(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=Ce[Ae]||1;return Ce[Ae]=t+1,"ͼ"+t.toString(36)}static mount(t,e,n){let i=t[Se],r=n&&n.nonce;i?r&&i.setNonce(r):i=new Oe(t,r),i.mount(Array.isArray(e)?e:[e],t)}}let Te=new Map;class Oe{constructor(t,e){let n=t.ownerDocument||t,i=n.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let e=Te.get(n);if(e)return t[Se]=e;this.sheet=new i.CSSStyleSheet,Te.set(n,this)}else this.styleTag=n.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[Se]=this}mount(t,e){let n=this.sheet,i=0,r=0;for(let e=0;e<t.length;e++){let s=t[e],o=this.modules.indexOf(s);if(o<r&&o>-1&&(this.modules.splice(o,1),r--,o=-1),-1==o){if(this.modules.splice(r++,0,s),n)for(let t=0;t<s.rules.length;t++)n.insertRule(s.rules[t],i++)}else{for(;r<o;)i+=this.modules[r++].rules.length;i+=s.rules.length,r++}}if(n)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets]);else{let t="";for(let e=0;e<this.modules.length;e++)t+=this.modules[e].getRules()+"\n";this.styleTag.textContent=t;let n=e.head||e;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}for(var Me={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},_e={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Pe="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),De="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Re=0;Re<10;Re++)Me[48+Re]=Me[96+Re]=String(Re);for(Re=1;Re<=24;Re++)Me[Re+111]="F"+Re;for(Re=65;Re<=90;Re++)Me[Re]=String.fromCharCode(Re+32),_e[Re]=String.fromCharCode(Re);for(var Be in Me)_e.hasOwnProperty(Be)||(_e[Be]=Me[Be]);let Ie="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},Ne="undefined"!=typeof document?document:{documentElement:{style:{}}};const Le=/Edge\/(\d+)/.exec(Ie.userAgent),Fe=/MSIE \d/.test(Ie.userAgent),Ve=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ie.userAgent),ze=!!(Fe||Ve||Le),je=!ze&&/gecko\/(\d+)/i.test(Ie.userAgent),He=!ze&&/Chrome\/(\d+)/.exec(Ie.userAgent),We="webkitFontSmoothing"in Ne.documentElement.style,$e=!ze&&/Apple Computer/.test(Ie.vendor),qe=$e&&(/Mobile\/\w+/.test(Ie.userAgent)||Ie.maxTouchPoints>2);var Ue={mac:qe||/Mac/.test(Ie.platform),windows:/Win/.test(Ie.platform),linux:/Linux|X11/.test(Ie.platform),ie:ze,ie_version:Fe?Ne.documentMode||6:Ve?+Ve[1]:Le?+Le[1]:0,gecko:je,gecko_version:je?+(/Firefox\/(\d+)/.exec(Ie.userAgent)||[0,0])[1]:0,chrome:!!He,chrome_version:He?+He[1]:0,ios:qe,android:/Android\b/.test(Ie.userAgent),webkit:We,webkit_version:We?+(/\bAppleWebKit\/(\d+)/.exec(Ie.userAgent)||[0,0])[1]:0,safari:$e,safari_version:$e?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Ie.userAgent)||[0,0])[1]:0,tabSize:null!=Ne.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function Ke(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function Ge(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function Ye(t,e){if(!e.anchorNode)return!1;try{return Ge(t,e.anchorNode)}catch(t){return!1}}function Qe(t){return 3==t.nodeType?cn(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function Je(t,e,n,i){return!!n&&(tn(t,e,n,i,-1)||tn(t,e,n,i,1))}function Xe(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function Ze(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function tn(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:en(t))){if("DIV"==t.nodeName)return!1;let n=t.parentNode;if(!n||1!=n.nodeType)return!1;e=Xe(t)+(r<0?0:1),t=n}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=r<0?en(t):0}}}function en(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function nn(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function rn(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function sn(t,e){let n=e.width/t.offsetWidth,i=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-t.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}class on{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:n}=t;this.set(e,Math.min(t.anchorOffset,e?en(e):0),n,Math.min(t.focusOffset,n?en(n):0))}set(t,e,n,i){this.anchorNode=t,this.anchorOffset=e,this.focusNode=n,this.focusOffset=i}}let ln,an=null;function hn(t){if(t.setActive)return t.setActive();if(an)return t.focus(an);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(null==an?{get preventScroll(){return an={preventScroll:!0},!0}}:void 0),!an){an=!1;for(let t=0;t<e.length;){let n=e[t++],i=e[t++],r=e[t++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}}}function cn(t,e,n=e){let i=ln||(ln=document.createRange());return i.setEnd(t,n),i.setStart(t,e),i}function un(t,e,n,i){let r={key:e,code:e,keyCode:n,which:n,cancelable:!0};i&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let s=new KeyboardEvent("keydown",r);s.synthetic=!0,t.dispatchEvent(s);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,t.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function dn(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function fn(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function pn(t,e){for(let n=t,i=e;;){if(3==n.nodeType&&i>0)return{node:n,offset:i};if(1==n.nodeType&&i>0){if("false"==n.contentEditable)return null;n=n.childNodes[i-1],i=en(n)}else{if(!n.parentNode||Ze(n))return null;i=Xe(n),n=n.parentNode}}}function gn(t,e){for(let n=t,i=e;;){if(3==n.nodeType&&i<n.nodeValue.length)return{node:n,offset:i};if(1==n.nodeType&&i<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[i],i=0}else{if(!n.parentNode||Ze(n))return null;i=Xe(n)+1,n=n.parentNode}}}Ue.safari&&Ue.safari_version>=26&&(an=!1);class mn{constructor(t,e,n=!0){this.node=t,this.offset=e,this.precise=n}static before(t,e){return new mn(t.parentNode,Xe(t),e)}static after(t,e){return new mn(t.parentNode,Xe(t)+1,e)}}const vn=[];class bn{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(t){let e=this.posAtStart;for(let n of this.children){if(n==t)return e;e+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(2&this.flags){let n,i=this.dom,r=null;for(let s of this.children){if(7&s.flags){if(!s.dom&&(n=r?r.nextSibling:i.firstChild)){let t=bn.get(n);(!t||!t.parent&&t.canReuseDOM(s))&&s.reuseDOM(n)}s.sync(t,e),s.flags&=-8}if(n=r?r.nextSibling:i.firstChild,e&&!e.written&&e.node==i&&n!=s.dom&&(e.written=!0),s.dom.parentNode==i)for(;n&&n!=s.dom;)n=yn(n);else i.insertBefore(s.dom,n);r=s.dom}for(n=r?r.nextSibling:i.firstChild,n&&e&&e.node==i&&(e.written=!0);n;)n=yn(n)}else if(1&this.flags)for(let n of this.children)7&n.flags&&(n.sync(t,e),n.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let n;if(t==this.dom)n=this.dom.childNodes[e];else{let i=0==en(t)?0:0==e?-1:1;for(;;){let e=t.parentNode;if(e==this.dom)break;0==i&&e.firstChild!=e.lastChild&&(i=t==e.firstChild?-1:1),t=e}n=i<0?t:t.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!bn.get(n);)n=n.nextSibling;if(!n)return this.length;for(let t=0,e=0;;t++){let i=this.children[t];if(i.dom==n)return e;e+=i.length+i.breakAfter}}domBoundsAround(t,e,n=0){let i=-1,r=-1,s=-1,o=-1;for(let l=0,a=n,h=n;l<this.children.length;l++){let n=this.children[l],c=a+n.length;if(a<t&&c>e)return n.domBoundsAround(t,e,a);if(c>=t&&-1==i&&(i=l,r=a),a>e&&n.dom.parentNode==this.dom){s=l,o=h;break}h=c,a=c+n.breakAfter}return{from:r,to:o<0?n+this.length:o,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s<this.children.length&&s>=0?this.children[s].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),1&e.flags)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,n=vn){this.markDirty();for(let i=t;i<e;i++){let t=this.children[i];t.parent==this&&n.indexOf(t)<0&&t.destroy()}n.length<250?this.children.splice(t,e-t,...n):this.children=[].concat(this.children.slice(0,t),n,this.children.slice(e));for(let t=0;t<n.length;t++)n[t].setParent(this)}ignoreMutation(t){return!1}ignoreEvent(t){return!1}childCursor(t=this.length){return new wn(this.children,t,this.children.length)}childPos(t,e=1){return this.childCursor().findPos(t,e)}toString(){let t=this.constructor.name.replace("View","");return t+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==t?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(t){return t.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(t,e,n,i,r,s){return!1}become(t){return!1}canReuseDOM(t){return t.constructor==this.constructor&&!(8&(this.flags|t.flags))}getSide(){return 0}destroy(){for(let t of this.children)t.parent==this&&t.destroy();this.parent=null}}function yn(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}bn.prototype.breakAfter=0;class wn{constructor(t,e,n){this.children=t,this.pos=e,this.i=n,this.off=0}findPos(t,e=1){for(;;){if(t>this.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function xn(t,e,n,i,r,s,o,l,a){let{children:h}=t,c=h.length?h[e]:null,u=s.length?s[s.length-1]:null,d=u?u.breakAfter:o;if(!(e==i&&c&&!o&&!d&&s.length<2&&c.merge(n,r,s.length?u:null,0==n,l,a))){if(i<h.length){let t=h[i];t&&(r<t.length||t.breakAfter&&(null==u?void 0:u.breakAfter))?(e==i&&(t=t.split(r),r=0),!d&&u&&t.merge(0,r,u,!0,0,a)?s[s.length-1]=t:((r||t.children.length&&!t.children[0].length)&&t.merge(0,r,null,!1,0,a),s.push(t))):(null==t?void 0:t.breakAfter)&&(u?u.breakAfter=1:o=1),i++}for(c&&(c.breakAfter=o,n>0&&(!o&&s.length&&c.merge(n,c.length,s[0],!1,l,0)?c.breakAfter=s.shift().breakAfter:(n<c.length||c.children.length&&0==c.children[c.children.length-1].length)&&c.merge(n,c.length,null,!1,l,0),e++));e<i&&s.length;)if(h[i-1].become(s[s.length-1]))i--,s.pop(),a=s.length?0:l;else{if(!h[e].become(s[0]))break;e++,s.shift(),l=s.length?0:a}!s.length&&e&&i<h.length&&!h[e-1].breakAfter&&h[i].merge(0,0,h[e-1],!1,l,a)&&e--,(e<i||s.length)&&t.replaceChildren(e,i,s)}}function kn(t,e,n,i,r,s){let o=t.childCursor(),{i:l,off:a}=o.findPos(n,1),{i:h,off:c}=o.findPos(e,-1),u=e-n;for(let t of i)u+=t.length;t.length+=u,xn(t,h,c,l,a,i,0,r,s)}class An extends bn{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){3==t.nodeType&&this.createDOM(t)}merge(t,e,n){return!(8&this.flags||n&&(!(n instanceof An)||this.length-(e-t)+n.length>256||8&n.flags)||(this.text=this.text.slice(0,t)+(n?n.text:"")+this.text.slice(e),this.markDirty(),0))}split(t){let e=new An(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new mn(this.dom,t)}domBoundsAround(t,e,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return function(t,e,n){let i=t.nodeValue.length;e>i&&(e=i);let r=e,s=e,o=0;0==e&&n<0||e==i&&n>=0?Ue.chrome||Ue.gecko||(e?(r--,o=1):s<i&&(s++,o=-1)):n<0?r--:s<i&&s++;let l=cn(t,r,s).getClientRects();if(!l.length)return null;let a=l[(o?o<0:n>=0)?0:l.length-1];return Ue.safari&&!o&&0==a.width&&(a=Array.prototype.find.call(l,t=>t.width)||a),o?nn(a,o<0):a||null}(this.dom,t,e)}}class Sn extends bn{constructor(t,e=[],n=0){super(),this.mark=t,this.children=e,this.length=n;for(let t of e)t.setParent(this)}setAttrs(t){if(dn(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!(8&(this.flags|t.flags))}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,n,i,r,s){return!(n&&(!(n instanceof Sn&&n.mark.eq(this.mark))||t&&r<=0||e<this.length&&s<=0)||(kn(this,t,e,n?n.children.slice():[],r-1,s-1),this.markDirty(),0))}split(t){let e=[],n=0,i=-1,r=0;for(let s of this.children){let o=n+s.length;o>t&&e.push(n<t?s.split(t-n):s),i<0&&n>=t&&(i=r),n=o,r++}let s=this.length-t;return this.length=t,i>-1&&(this.children.length=i,this.markDirty()),new Sn(this.mark,e,s)}domAtPos(t){return Tn(this,t)}coordsAt(t,e){return Mn(this,t,e)}}class Cn extends bn{static create(t,e,n){return new Cn(t,e,n)}constructor(t,e,n){super(),this.widget=t,this.length=e,this.side=n,this.prevWidget=null}split(t){let e=Cn.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(t,e,n,i,r,s){return!(n&&(!(n instanceof Cn&&this.widget.compare(n.widget))||t>0&&r<=0||e<this.length&&s<=0)||(this.length=t+(n?n.length:0)+(this.length-e),0))}become(t){return t instanceof Cn&&t.side==this.side&&this.widget.constructor==t.widget.constructor&&(this.widget.compare(t.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,!0)}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get overrideDOMText(){if(0==this.length)return K.empty;let t=this;for(;t.parent;)t=t.parent;let{view:e}=t,n=e&&e.state.doc,i=this.posAtStart;return n?n.slice(i,i+this.length):K.empty}domAtPos(t){return(this.length?0==t:this.side>0)?mn.before(this.dom):mn.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let n=this.widget.coordsAt(this.dom,t,e);if(n)return n;let i=this.dom.getClientRects(),r=null;if(!i.length)return null;let s=this.side?this.side<0:t>0;for(let e=s?i.length-1:0;r=i[e],!(t>0?0==e:e==i.length-1||r.top<r.bottom);e+=s?-1:1);return nn(r,!s)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class En extends bn{constructor(t){super(),this.side=t}get length(){return 0}merge(){return!1}become(t){return t instanceof En&&t.side==this.side}split(){return new En(this.side)}sync(){if(!this.dom){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),this.setDOM(t)}}getSide(){return this.side}domAtPos(t){return this.side>0?mn.before(this.dom):mn.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return K.empty}get isHidden(){return!0}}function Tn(t,e){let n=t.dom,{children:i}=t,r=0;for(let t=0;r<i.length;r++){let s=i[r],o=t+s.length;if(!(o==t&&s.getSide()<=0)){if(e>t&&e<o&&s.dom.parentNode==n)return s.domAtPos(e-t);if(e<=t)break;t=o}}for(let t=r;t>0;t--){let e=i[t-1];if(e.dom.parentNode==n)return e.domAtPos(e.length)}for(let t=r;t<i.length;t++){let e=i[t];if(e.dom.parentNode==n)return e.domAtPos(0)}return new mn(n,0)}function On(t,e,n){let i,{children:r}=t;n>0&&e instanceof Sn&&r.length&&(i=r[r.length-1])instanceof Sn&&i.mark.eq(e.mark)?On(i,e.children[0],n-1):(r.push(e),e.setParent(t)),t.length+=e.length}function Mn(t,e,n){let i=null,r=-1,s=null,o=-1;!function t(e,l){for(let a=0,h=0;a<e.children.length&&h<=l;a++){let c=e.children[a],u=h+c.length;u>=l&&(c.children.length?t(c,l-h):(!s||s.isHidden&&(n>0||_n(s,c)))&&(u>l||h==u&&c.getSide()>0)?(s=c,o=l-h):(h<l||h==u&&c.getSide()<0&&!c.isHidden)&&(i=c,r=l-h)),h=u}}(t,e);let l=(n<0?i:s)||i||s;return l?l.coordsAt(Math.max(0,l==i?r:o),n):function(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=Qe(e);return n[n.length-1]||null}(t)}function _n(t,e){let n=t.coordsAt(0,1),i=e.coordsAt(0,1);return n&&i&&i.top<n.bottom}function Pn(t,e){for(let n in t)"class"==n&&e.class?e.class+=" "+t.class:"style"==n&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}An.prototype.children=Cn.prototype.children=En.prototype.children=vn;const Dn=Object.create(null);function Rn(t,e,n){if(t==e)return!0;t||(t=Dn),e||(e=Dn);let i=Object.keys(t),r=Object.keys(e);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let s of i)if(s!=n&&(-1==r.indexOf(s)||t[s]!==e[s]))return!1;return!0}function Bn(t,e,n){let i=!1;if(e)for(let r in e)n&&r in n||(i=!0,"style"==r?t.style.cssText="":t.removeAttribute(r));if(n)for(let r in n)e&&e[r]==n[r]||(i=!0,"style"==r?t.style.cssText=n[r]:t.setAttribute(r,n[r]));return i}function In(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let i=t.attributes[n];e[i.name]=i.value}return e}class Nn{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var Ln=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Ln||(Ln={}));class Fn extends oe{constructor(t,e,n,i){super(),this.startSide=t,this.endSide=e,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(t){return new Vn(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),n=!!t.block;return e+=n&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new jn(t,e,e,n,t.widget||null,!1)}static replace(t){let e,n,i=!!t.block;if(t.isBlockGap)e=-5e8,n=4e8;else{let{start:r,end:s}=Hn(t,i);e=(r?i?-3e8:-1:5e8)-1,n=1+(s?i?2e8:1:-6e8)}return new jn(t,e,n,i,t.widget||null,!0)}static line(t){return new zn(t)}static set(t,e=!1){return ce.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Fn.none=ce.empty;class Vn extends Fn{constructor(t){let{start:e,end:n}=Hn(t);super(e?-1:5e8,n?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,n;return this==t||t instanceof Vn&&this.tagName==t.tagName&&(this.class||(null===(e=this.attrs)||void 0===e?void 0:e.class))==(t.class||(null===(n=t.attrs)||void 0===n?void 0:n.class))&&Rn(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}Vn.prototype.point=!1;class zn extends Fn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof zn&&this.spec.class==t.spec.class&&Rn(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}zn.prototype.mapMode=at.TrackBefore,zn.prototype.point=!0;class jn extends Fn{constructor(t,e,n,i,r,s){super(e,n,r,t),this.block=i,this.isReplace=s,this.mapMode=i?e<=0?at.TrackBefore:at.TrackAfter:at.TrackDel}get type(){return this.startSide!=this.endSide?Ln.WidgetRange:this.startSide<=0?Ln.WidgetBefore:Ln.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof jn&&((e=this.widget)==(n=t.widget)||!!(e&&n&&e.compare(n)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,n}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}function Hn(t,e=!1){let{inclusiveStart:n,inclusiveEnd:i}=t;return null==n&&(n=t.inclusive),null==i&&(i=t.inclusive),{start:null!=n?n:e,end:null!=i?i:e}}function Wn(t,e,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=t?n[r]=Math.max(n[r],e):n.push(t,e)}jn.prototype.point=!0;class $n extends bn{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,n,i,r,s){if(n){if(!(n instanceof $n))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),kn(this,t,e,n?n.children.slice():[],r,s),!0}split(t){let e=new $n;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i:n,off:i}=this.childPos(t);i&&(e.append(this.children[n].split(i),0),this.children[n].merge(i,this.children[n].length,null,!1,0,0),n++);for(let t=n;t<this.children.length;t++)e.append(this.children[t],0);for(;n>0&&0==this.children[n-1].length;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){Rn(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){On(this,t,e)}addLineDeco(t){let e=t.spec.attributes,n=t.spec.class;e&&(this.attrs=Pn(e,this.attrs||{})),n&&(this.attrs=Pn({class:n},this.attrs||{}))}domAtPos(t){return Tn(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}sync(t,e){var n;this.dom?4&this.flags&&(dn(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&&(Bn(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let i=this.dom.lastChild;for(;i&&bn.get(i)instanceof Sn;)i=i.lastChild;if(!(i&&this.length&&("BR"==i.nodeName||0!=(null===(n=bn.get(i))||void 0===n?void 0:n.isEditable)||Ue.ios&&this.children.some(t=>t instanceof An)))){let t=document.createElement("BR");t.cmIgnore=!0,this.dom.appendChild(t)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let t,e=0;for(let n of this.children){if(!(n instanceof An)||/[^ -~]/.test(n.text))return null;let i=Qe(n.dom);if(1!=i.length)return null;e+=i[0].width,t=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(t,e){let n=Mn(this,t,e);if(!this.children.length&&n&&this.parent){let{heightOracle:t}=this.parent.view.viewState,e=n.bottom-n.top;if(Math.abs(e-t.lineHeight)<2&&t.textHeight<e){let i=(e-t.textHeight)/2;return{top:n.top+i,bottom:n.bottom-i,left:n.left,right:n.left}}}return n}become(t){return t instanceof $n&&0==this.children.length&&0==t.children.length&&Rn(this.attrs,t.attrs)&&this.breakAfter==t.breakAfter}covers(){return!0}static find(t,e){for(let n=0,i=0;n<t.children.length;n++){let r=t.children[n],s=i+r.length;if(s>=e){if(r instanceof $n)return r;if(s>e)break}i=s+r.breakAfter}return null}}class qn extends bn{constructor(t,e,n){super(),this.widget=t,this.length=e,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(t,e,n,i,r,s){return!(n&&(!(n instanceof qn&&this.widget.compare(n.widget))||t>0&&r<=0||e<this.length&&s<=0)||(this.length=t+(n?n.length:0)+(this.length-e),0))}domAtPos(t){return 0==t?mn.before(this.dom):mn.after(this.dom,t==this.length)}split(t){let e=this.length-t;this.length=t;let n=new qn(this.widget,e,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return vn}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):K.empty}domBoundsAround(){return null}become(t){return t instanceof qn&&t.widget.constructor==this.widget.constructor&&(t.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,this.deco=t.deco,this.breakAfter=t.breakAfter,!0)}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(t,e){return this.widget.coordsAt(this.dom,t,e)||(this.widget instanceof Un?null:nn(this.dom.getBoundingClientRect(),this.length?0==t:e<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(t){let{startSide:e,endSide:n}=this.deco;return e!=n&&(t<0?e<0:n>0)}}class Un extends Nn{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Kn{constructor(t,e,n,i){this.doc=t,this.pos=e,this.end=n,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=e}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof qn&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new $n),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Gn(new En(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||t&&this.content.length&&this.content[this.content.length-1]instanceof qn||this.getLine()}buildText(t,e,n){for(;t>0;){if(this.textOff==this.text.length){let{value:e,lineBreak:n,done:i}=this.cursor.next(this.skip);if(this.skip=0,i)throw new Error("Ran out of text content when drawing inline views");if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}this.text=e,this.textOff=0}let i=Math.min(this.text.length-this.textOff,t),r=Math.min(i,512);this.flushBuffer(e.slice(e.length-n)),this.getLine().append(Gn(new An(this.text.slice(this.textOff,this.textOff+r)),e),n),this.atCursorPos=!0,this.textOff+=r,t-=r,n=i<=r?0:e.length}}span(t,e,n,i){this.buildText(e-t,n,i),this.pos=e,this.openStart<0&&(this.openStart=i)}point(t,e,n,i,r,s){if(this.disallowBlockEffectsFor[s]&&n instanceof jn){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(n instanceof jn)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new qn(n.widget||Yn.block,o,n));else{let s=Cn.create(n.widget||Yn.inline,o,o?0:n.startSide),l=this.atCursorPos&&!s.isEditable&&r<=i.length&&(t<e||n.startSide>0),a=!s.isEditable&&(t<e||r>i.length||n.startSide<=0),h=this.getLine();2!=this.pendingBuffer||l||s.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),l&&(h.append(Gn(new En(1),i),r),r=i.length+Math.max(0,r-i.length)),h.append(Gn(s,i),r),this.atCursorPos=a,this.pendingBuffer=a?t<e||r>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}static build(t,e,n,i,r){let s=new Kn(t,e,n,r);return s.openEnd=ce.spans(i,e,n,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function Gn(t,e){for(let n of e)t=new Sn(n,[t],t.length);return t}class Yn extends Nn{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Yn.inline=new Yn("span"),Yn.block=new Yn("div");var Qn=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Qn||(Qn={}));const Jn=Qn.LTR,Xn=Qn.RTL;function Zn(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const ti=Zn("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),ei=Zn("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ni=Object.create(null),ii=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);ni[e]=n,ni[n]=-e}function ri(t){return t<=247?ti[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?ei[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const si=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class oi{get dir(){return this.level%2?Xn:Jn}constructor(t,e,n){this.from=t,this.to=e,this.level=n}side(t,e){return this.dir==e==t?this.to:this.from}forward(t,e){return t==(this.dir==e)}static find(t,e,n,i){let r=-1;for(let s=0;s<t.length;s++){let o=t[s];if(o.from<=e&&o.to>=e){if(o.level==n)return s;(r<0||(0!=i?i<0?o.from<e:o.to>e:t[r].level>o.level))&&(r=s)}}if(r<0)throw new RangeError("Index out of range");return r}}function li(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let i=t[n],r=e[n];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!li(i.inner,r.inner))return!1}return!0}const ai=[];function hi(t,e,n,i,r,s,o){let l=i%2?2:1;if(i%2==r%2)for(let a=e,h=0;a<n;){let e=!0,c=!1;if(h==s.length||a<s[h].from){let t=ai[a];t!=l&&(e=!1,c=16==t)}let u=e||1!=l?null:[],d=e?i:i+1,f=a;t:for(;;)if(h<s.length&&f==s[h].from){if(c)break t;let p=s[h];if(!e)for(let t=p.to,e=h+1;;){if(t==n)break t;if(!(e<s.length&&s[e].from==t)){if(ai[t]==l)break t;break}t=s[e++].to}h++,u?u.push(p):(p.from>a&&o.push(new oi(a,p.from,d)),ci(t,p.direction==Jn!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,o),a=p.to),f=p.to}else{if(f==n||(e?ai[f]!=l:ai[f]==l))break;f++}u?hi(t,a,f,i+1,r,u,o):a<f&&o.push(new oi(a,f,d)),a=f}else for(let a=n,h=s.length;a>e;){let n=!0,c=!1;if(!h||a>s[h-1].to){let t=ai[a-1];t!=l&&(n=!1,c=16==t)}let u=n||1!=l?null:[],d=n?i:i+1,f=a;t:for(;;)if(h&&f==s[h-1].to){if(c)break t;let p=s[--h];if(!n)for(let t=p.from,n=h;;){if(t==e)break t;if(!n||s[n-1].to!=t){if(ai[t-1]==l)break t;break}t=s[--n].from}u?u.push(p):(p.to<a&&o.push(new oi(p.to,a,d)),ci(t,p.direction==Jn!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,o),a=p.from),f=p.from}else{if(f==e||(n?ai[f-1]!=l:ai[f-1]==l))break;f--}u?hi(t,f,a,i+1,r,u,o):f<a&&o.push(new oi(f,a,d)),a=f}}function ci(t,e,n,i,r,s,o){let l=e%2?2:1;!function(t,e,n,i,r){for(let s=0;s<=i.length;s++){let o=s?i[s-1].to:e,l=s<i.length?i[s].from:n,a=s?256:r;for(let e=o,n=a,i=a;e<l;e++){let r=ri(t.charCodeAt(e));512==r?r=n:8==r&&4==i&&(r=16),ai[e]=4==r?2:r,7&r&&(i=r),n=r}for(let t=o,e=a,i=a;t<l;t++){let r=ai[t];if(128==r)t<l-1&&e==ai[t+1]&&24&e?r=ai[t]=e:ai[t]=256;else if(64==r){let r=t+1;for(;r<l&&64==ai[r];)r++;let s=t&&8==e||r<n&&8==ai[r]?1==i?1:8:256;for(let e=t;e<r;e++)ai[e]=s;t=r-1}else 8==r&&1==i&&(ai[t]=1);e=r,7&r&&(i=r)}}}(t,r,s,i,l),function(t,e,n,i,r){let s=1==r?2:1;for(let o=0,l=0,a=0;o<=i.length;o++){let h=o?i[o-1].to:e,c=o<i.length?i[o].from:n;for(let e,n,i,o=h;o<c;o++)if(n=ni[e=t.charCodeAt(o)])if(n<0){for(let t=l-3;t>=0;t-=3)if(ii[t+1]==-n){let e=ii[t+2],n=2&e?r:4&e?1&e?s:r:0;n&&(ai[o]=ai[ii[t]]=n),l=t;break}}else{if(189==ii.length)break;ii[l++]=o,ii[l++]=e,ii[l++]=a}else if(2==(i=ai[o])||1==i){let t=i==r;a=t?0:1;for(let e=l-3;e>=0;e-=3){let n=ii[e+2];if(2&n)break;if(t)ii[e+2]|=2;else{if(4&n)break;ii[e+2]|=4}}}}}(t,r,s,i,l),function(t,e,n,i){for(let r=0,s=i;r<=n.length;r++){let o=r?n[r-1].to:t,l=r<n.length?n[r].from:e;for(let a=o;a<l;){let o=ai[a];if(256==o){let o=a+1;for(;;)if(o==l){if(r==n.length)break;o=n[r++].to,l=r<n.length?n[r].from:e}else{if(256!=ai[o])break;o++}let h=1==s,c=h==(1==(o<e?ai[o]:i))?h?1:2:i;for(let e=o,i=r,s=i?n[i-1].to:t;e>a;)e==s&&(e=n[--i].from,s=i?n[i-1].to:t),ai[--e]=c;a=o}else s=o,a++}}}(r,s,i,l),hi(t,r,s,e,n,i,o)}function ui(t){return[new oi(0,t,0)]}let di="";function fi(t,e,n,i,r){var s;let o=i.head-t.from,l=oi.find(e,o,null!==(s=i.bidiLevel)&&void 0!==s?s:-1,i.assoc),a=e[l],h=a.side(r,n);if(o==h){let t=l+=r?1:-1;if(t<0||t>=e.length)return null;a=e[l=t],o=a.side(!r,n),h=a.side(r,n)}let c=it(t.text,o,a.forward(r,n));(c<a.from||c>a.to)&&(c=h),di=t.text.slice(Math.min(o,c),Math.max(o,c));let u=l==(r?e.length-1:0)?null:e[l+(r?1:-1)];return u&&c==h&&u.level+(r?0:1)<a.level?bt.cursor(u.side(!r,n)+t.from,u.forward(r,n)?1:-1,u.level):bt.cursor(c+t.from,a.forward(r,n)?-1:1,a.level)}function pi(t,e,n){for(let i=e;i<n;i++){let e=ri(t.charCodeAt(i));if(1==e)return Jn;if(2==e||4==e)return Xn}return Jn}const gi=xt.define(),mi=xt.define(),vi=xt.define(),bi=xt.define(),yi=xt.define(),wi=xt.define(),xi=xt.define(),ki=xt.define(),Ai=xt.define(),Si=xt.define({combine:t=>t.some(t=>t)}),Ci=xt.define({combine:t=>t.some(t=>t)}),Ei=xt.define();class Ti{constructor(t,e="nearest",n="nearest",i=5,r=5,s=!1){this.range=t,this.y=e,this.x=n,this.yMargin=i,this.xMargin=r,this.isSnapshot=s}map(t){return t.empty?this:new Ti(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Ti(bt.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Oi=Kt.define({map:(t,e)=>t.map(e)}),Mi=Kt.define();function _i(t,e,n){let i=t.facet(bi);i.length?i[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const Pi=xt.define({combine:t=>!t.length||t[0]});let Di=0;const Ri=xt.define({combine:t=>t.filter((e,n)=>{for(let i=0;i<n;i++)if(t[i].plugin==e.plugin)return!1;return!0})});class Bi{constructor(t,e,n,i,r){this.id=t,this.create=e,this.domEventHandlers=n,this.domEventObservers=i,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(Ri.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(Ri.of({plugin:this,arg:t}))}static define(t,e){const{eventHandlers:n,eventObservers:i,provide:r,decorations:s}=e||{};return new Bi(Di++,t,n,i,t=>{let e=[];return s&&e.push(Fi.of(e=>{let n=e.plugin(t);return n?s(n):Fn.none})),r&&e.push(r(t)),e})}static fromClass(t,e){return Bi.define((e,n)=>new t(e,n),e)}}class Ii{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(e){if(_i(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(e){_i(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(e){_i(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Ni=xt.define(),Li=xt.define(),Fi=xt.define(),Vi=xt.define(),zi=xt.define(),ji=xt.define();function Hi(t,e){let n=t.state.facet(ji);if(!n.length)return n;let i=n.map(e=>e instanceof Function?e(t):e),r=[];return ce.spans(i,e.from,e.to,{point(){},span(t,n,i,s){let o=t-e.from,l=n-e.from,a=r;for(let t=i.length-1;t>=0;t--,s--){let n,r=i[t].spec.bidiIsolate;if(null==r&&(r=pi(e.text,o,l)),s>0&&a.length&&(n=a[a.length-1]).to==o&&n.direction==r)n.to=l,a=n.inner;else{let t={from:o,to:l,direction:r,inner:[]};a.push(t),a=t.inner}}}}),r}const Wi=xt.define();function $i(t){let e=0,n=0,i=0,r=0;for(let s of t.state.facet(Wi)){let o=s(t);o&&(null!=o.left&&(e=Math.max(e,o.left)),null!=o.right&&(n=Math.max(n,o.right)),null!=o.top&&(i=Math.max(i,o.top)),null!=o.bottom&&(r=Math.max(r,o.bottom)))}return{left:e,right:n,top:i,bottom:r}}const qi=xt.define();class Ui{constructor(t,e,n,i){this.fromA=t,this.toA=e,this.fromB=n,this.toB=i}join(t){return new Ui(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,n=this;for(;e>0;e--){let i=t[e-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),t.splice(e-1,1)}}return t.splice(e,0,n),t}static extendWithRanges(t,e){if(0==e.length)return t;let n=[];for(let i=0,r=0,s=0,o=0;;i++){let l=i==t.length?null:t[i],a=s-o,h=l?l.fromB:1e9;for(;r<e.length&&e[r]<h;){let t=e[r],i=e[r+1],s=Math.max(o,t),l=Math.min(h,i);if(s<=l&&new Ui(s+a,l+a,s,l).addToSet(n),i>h)break;r+=2}if(!l)return n;new Ui(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),s=l.toA,o=l.toB}}}class Ki{constructor(t,e,n){this.view=t,this.state=e,this.transactions=n,this.flags=0,this.startState=t.state,this.changes=ct.empty(this.startState.doc.length);for(let t of n)this.changes=this.changes.compose(t.changes);let i=[];this.changes.iterChangedRanges((t,e,n,r)=>i.push(new Ui(t,e,n,r))),this.changedRanges=i}static create(t,e,n){return new Ki(t,e,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}class Gi extends bn{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Fn.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new $n],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ui(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let n=t.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:t,toA:e})=>e<this.minWidthFrom||t>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?i=this.domChanged.newSel.head:function(t,e){let n=!1;return e&&t.iterChangedRanges((t,i)=>{t<e.to&&i>e.from&&(n=!0)}),n}(t.changes,this.hasComposition)||t.selectionSet||(i=t.state.selection.main.head));let r=i>-1?function(t,e,n){let i=Yi(t,n);if(!i)return null;let{node:r,from:s,to:o}=i,l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(t.state.doc.sliceString(i.from,i.to)!=l)return null;let a=e.invertedDesc,h=new Ui(a.mapPos(s),a.mapPos(o),s,o),c=[];for(let e=r.parentNode;;e=e.parentNode){let n=bn.get(e);if(n instanceof Sn)c.push({node:e,deco:n.mark});else{if(n instanceof $n||"DIV"==e.nodeName&&e.parentNode==t.contentDOM)return{range:h,text:r,marks:c,line:e};if(e==t.contentDOM)return null;c.push({node:e,deco:new Vn({inclusive:!0,attributes:In(e),tagName:e.tagName.toLowerCase()})})}}}(this.view,t.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:e,to:i}=this.hasComposition;n=new Ui(e,i,t.changes.mapPos(e,-1),t.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Ue.ie||Ue.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let s=function(t,e,n){let i=new Qi;return ce.compare(t,e,n,i),i.changes}(this.decorations,this.updateDeco(),t.changes);return n=Ui.extendWithRanges(n,s),!!(7&this.flags||0!=n.length)&&(this.updateInner(n,t.startState.doc.length,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,n);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=Ue.chrome||Ue.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.flags&=-8,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(t=>t.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let t of this.children)t instanceof qn&&t.widget instanceof Un&&r.push(t.dom);i.updateGaps(r)}updateChildren(t,e,n){let i=n?n.range.addToSet(t.slice()):t,r=this.childCursor(e);for(let t=i.length-1;;t--){let e=t>=0?i[t]:null;if(!e)break;let s,o,l,a,{fromA:h,toA:c,fromB:u,toB:d}=e;if(n&&n.range.fromB<d&&n.range.toB>u){let t=Kn.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),e=Kn.build(this.view.state.doc,n.range.toB,d,this.decorations,this.dynamicDecorationMap);o=t.breakAtStart,l=t.openStart,a=e.openEnd;let i=this.compositionView(n);e.breakAtStart?i.breakAfter=1:e.content.length&&i.merge(i.length,i.length,e.content[0],!1,e.openStart,0)&&(i.breakAfter=e.content[0].breakAfter,e.content.shift()),t.content.length&&i.merge(0,0,t.content[t.content.length-1],!0,0,t.openEnd)&&t.content.pop(),s=t.content.concat(i).concat(e.content)}else({content:s,breakAtStart:o,openStart:l,openEnd:a}=Kn.build(this.view.state.doc,u,d,this.decorations,this.dynamicDecorationMap));let{i:f,off:p}=r.findPos(c,1),{i:g,off:m}=r.findPos(h,-1);xn(this,g,m,f,p,s,o,l,a)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let t of e.effects)t.is(Mi)&&(this.editContextFormatting=t.value)}compositionView(t){let e=new An(t.text.nodeValue);e.flags|=8;for(let{deco:n}of t.marks)e=new Sn(n,[e],e.length);let n=new $n;return n.append(e,0),n}fixCompositionDOM(t){let e=(t,e)=>{e.flags|=8|(e.children.some(t=>7&t.flags)?1:0),this.markedForComposition.add(e);let n=bn.get(t);n&&n!=e&&(n.dom=null),e.setDOM(t)},n=this.childPos(t.range.fromB,1),i=this.children[n.i];e(t.line,i);for(let r=t.marks.length-1;r>=-1;r--)n=i.childPos(n.off,1),i=i.children[n.i],e(r>=0?t.marks[r].node:t.text,i)}updateSelection(t=!1,e=!1){!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,r=!i&&!(this.view.state.facet(Pi)||this.dom.tabIndex>-1)&&Ye(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||e||r))return;let s=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(o.anchor)),a=o.empty?l:this.moveToLine(this.domAtPos(o.head));if(Ue.gecko&&o.empty&&!this.hasComposition&&1==(h=l).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable)){let t=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(t,l.node.childNodes[l.offset]||null)),l=a=new mn(t,0),s=!0}var h;let c=this.view.observer.selectionRange;!s&&c.focusNode&&(Je(l.node,l.offset,c.anchorNode,c.anchorOffset)&&Je(a.node,a.offset,c.focusNode,c.focusOffset)||this.suppressWidgetCursorChange(c,o))||(this.view.observer.ignore(()=>{Ue.android&&Ue.chrome&&this.dom.contains(c.focusNode)&&function(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let t=Ke(this.view.root);if(t)if(o.empty){if(Ue.gecko){let t=(e=l.node,i=l.offset,1!=e.nodeType?0:(i&&"false"==e.childNodes[i-1].contentEditable?1:0)|(i<e.childNodes.length&&"false"==e.childNodes[i].contentEditable?2:0));if(t&&3!=t){let e=(1==t?pn:gn)(l.node,l.offset);e&&(l=new mn(e.node,e.offset))}}t.collapse(l.node,l.offset),null!=o.bidiLevel&&void 0!==t.caretBidiLevel&&(t.caretBidiLevel=o.bidiLevel)}else if(t.extend){t.collapse(l.node,l.offset);try{t.extend(a.node,a.offset)}catch(t){}}else{let e=document.createRange();o.anchor>o.head&&([l,a]=[a,l]),e.setEnd(a.node,a.offset),e.setStart(l.node,l.offset),t.removeAllRanges(),t.addRange(e)}var e,i;r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(l,a)),this.impreciseAnchor=l.precise?null:new mn(c.anchorNode,c.anchorOffset),this.impreciseHead=a.precise?null:new mn(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Je(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,n=Ke(t.root),{anchorNode:i,anchorOffset:r}=t.observer.selectionRange;if(!(n&&e.empty&&e.assoc&&n.modify))return;let s=$n.find(this,e.head);if(!s)return;let o=s.posAtStart;if(e.head==o||e.head==o+s.length)return;let l=this.coordsAt(e.head,-1),a=this.coordsAt(e.head,1);if(!l||!a||l.bottom>a.top)return;let h=this.domAtPos(e.head+e.assoc);n.collapse(h.node,h.offset),n.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&n.collapse(i,r)}moveToLine(t){let e,n=this.dom;if(t.node!=n)return t;for(let i=t.offset;!e&&i<n.childNodes.length;i++){let t=bn.get(n.childNodes[i]);t instanceof $n&&(e=t.domAtPos(0))}for(let i=t.offset-1;!e&&i>=0;i--){let t=bn.get(n.childNodes[i]);t instanceof $n&&(e=t.domAtPos(t.length))}return e?new mn(e.node,e.offset,!0):t}nearest(t){for(let e=t;e;){let t=bn.get(e);if(t&&t.rootView==this)return t;e=e.parentNode}return null}posFromDOM(t,e){let n=this.nearest(t);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(t,e)+n.posAtStart}domAtPos(t){let{i:e,off:n}=this.childCursor().findPos(t,-1);for(;e<this.children.length-1;){let t=this.children[e];if(n<t.length||t instanceof $n)break;e++,n=0}return this.children[e].domAtPos(n)}coordsAt(t,e){let n=null,i=0;for(let r=this.length,s=this.children.length-1;s>=0;s--){let o=this.children[s],l=r-o.breakAfter,a=l-o.length;if(l<t)break;if(a<=t&&(a<t||o.covers(-1))&&(l>t||o.covers(1))&&(!n||o instanceof $n&&!(n instanceof $n&&e>=0)))n=o,i=a;else if(n&&a==t&&l==t&&o instanceof qn&&Math.abs(e)<2){if(o.deco.startSide<0)break;s&&(n=null)}r=a}return n?n.coordsAt(t-i,e):null}coordsForChar(t){let{i:e,off:n}=this.childPos(t,1),i=this.children[e];if(!(i instanceof $n))return null;for(;i.children.length;){let{i:t,off:e}=i.childPos(n,1);for(;;t++){if(t==i.children.length)return null;if((i=i.children[t]).length)break}n=e}if(!(i instanceof An))return null;let r=it(i.text,n);if(r==n)return null;let s=cn(i.dom,n,r).getClientRects();for(let t=0;t<s.length;t++){let e=s[t];if(t==s.length-1||e.top<e.bottom&&e.left<e.right)return e}return null}measureVisibleLineHeights(t){let e=[],{from:n,to:i}=t,r=this.view.contentDOM.clientWidth,s=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,l=this.view.textDirection==Qn.LTR;for(let t=0,a=0;a<this.children.length;a++){let h=this.children[a],c=t+h.length;if(c>i)break;if(t>=n){let n=h.dom.getBoundingClientRect();if(e.push(n.height),s){let e=h.dom.lastChild,i=e?Qe(e):[];if(i.length){let e=i[i.length-1],s=l?e.right-n.left:n.right-e.left;s>o&&(o=s,this.minWidth=r,this.minWidthFrom=t,this.minWidthTo=c)}}}t=c+h.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return"rtl"==getComputedStyle(this.children[e].dom).direction?Qn.RTL:Qn.LTR}measureTextSize(){for(let t of this.children)if(t instanceof $n){let e=t.measureTextSize();if(e)return e}let t,e,n,i=document.createElement("div");return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(i);let r=Qe(i.firstChild)[0];t=i.getBoundingClientRect().height,e=r?r.width/27:7,n=r?r.height:t,i.remove()}),{lineHeight:t,charWidth:e,textHeight:n}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new wn(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let n=0,i=0;;i++){let r=i==e.viewports.length?null:e.viewports[i],s=r?r.from-1:this.length;if(s>n){let i=(e.lineBlockAt(s).bottom-e.lineBlockAt(n).top)/this.view.scaleY;t.push(Fn.replace({widget:new Un(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!r)break;n=r.to+1}return Fn.set(t)}updateDeco(){let t=1,e=this.view.state.facet(Fi).map(e=>(this.dynamicDecorationMap[t++]="function"==typeof e)?e(this.view):e),n=!1,i=this.view.state.facet(Vi).map((t,e)=>{let i="function"==typeof t;return i&&(n=!0),i?t(this.view):t});for(i.length&&(this.dynamicDecorationMap[t++]=n,e.push(ce.join(i))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;return this.decorations}scrollIntoView(t){if(t.isSnapshot){let e=this.view.viewState.lineBlockAt(t.range.head);return this.view.scrollDOM.scrollTop=e.top-t.yMargin,void(this.view.scrollDOM.scrollLeft=t.xMargin)}for(let e of this.view.state.facet(Ei))try{if(e(this.view,t.range,t))return!0}catch(t){_i(this.view.state,t,"scroll handler")}let e,{range:n}=t,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(!i)return;!n.empty&&(e=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,e.left),top:Math.min(i.top,e.top),right:Math.max(i.right,e.right),bottom:Math.max(i.bottom,e.bottom)});let r=$i(this.view),s={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:o,offsetHeight:l}=this.view.scrollDOM;!function(t,e,n,i,r,s,o,l){let a=t.ownerDocument,h=a.defaultView||window;for(let c=t,u=!1;c&&!u;)if(1==c.nodeType){let t,d=c==a.body,f=1,p=1;if(d)t=rn(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(u=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();({scaleX:f,scaleY:p}=sn(c,e)),t={left:e.left,right:e.left+c.clientWidth*f,top:e.top,bottom:e.top+c.clientHeight*p}}let g=0,m=0;if("nearest"==r)e.top<t.top?(m=e.top-(t.top+o),n>0&&e.bottom>t.bottom+m&&(m=e.bottom-t.bottom+o)):e.bottom>t.bottom&&(m=e.bottom-t.bottom+o,n<0&&e.top-m<t.top&&(m=e.top-(t.top+o)));else{let i=e.bottom-e.top,s=t.bottom-t.top;m=("center"==r&&i<=s?e.top+i/2-s/2:"start"==r||"center"==r&&n<0?e.top-o:e.bottom-s+o)-t.top}if("nearest"==i?e.left<t.left?(g=e.left-(t.left+s),n>0&&e.right>t.right+g&&(g=e.right-t.right+s)):e.right>t.right&&(g=e.right-t.right+s,n<0&&e.left<t.left+g&&(g=e.left-(t.left+s))):g=("center"==i?e.left+(e.right-e.left)/2-(t.right-t.left)/2:"start"==i==l?e.left-s:e.right-(t.right-t.left)+s)-t.left,g||m)if(d)h.scrollBy(g,m);else{let t=0,n=0;if(m){let t=c.scrollTop;c.scrollTop+=m/p,n=(c.scrollTop-t)*p}if(g){let e=c.scrollLeft;c.scrollLeft+=g/f,t=(c.scrollLeft-e)*f}e={left:e.left-t,top:e.top-n,right:e.right-t,bottom:e.bottom-n},t&&Math.abs(t-g)<1&&(i="nearest"),n&&Math.abs(n-m)<1&&(r="nearest")}if(d)break;(e.top<t.top||e.bottom>t.bottom||e.left<t.left||e.right>t.right)&&(e={left:Math.max(e.left,t.left),right:Math.min(e.right,t.right),top:Math.max(e.top,t.top),bottom:Math.min(e.bottom,t.bottom)}),c=c.assignedSlot||c.parentNode}else{if(11!=c.nodeType)break;c=c.host}}(this.view.scrollDOM,s,n.head<n.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,o),-o),Math.max(Math.min(t.yMargin,l),-l),this.view.textDirection==Qn.LTR)}lineHasWidget(t){let{i:e}=this.childCursor().findPos(t);if(e==this.children.length)return!1;let n=t=>t instanceof Cn||t.children.some(n);return n(this.children[e])}}function Yi(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let i=pn(n.focusNode,n.focusOffset),r=gn(n.focusNode,n.focusOffset),s=i||r;if(r&&i&&r.node!=i.node){let e=bn.get(r.node);if(!e||e instanceof An&&e.text!=r.node.nodeValue)s=r;else if(t.docView.lastCompositionAfterCursor){let t=bn.get(i.node);!t||t instanceof An&&t.text!=i.node.nodeValue||(s=r)}}if(t.docView.lastCompositionAfterCursor=s!=i,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}let Qi=class{constructor(){this.changes=[]}compareRange(t,e){Wn(t,e,this.changes)}comparePoint(t,e){Wn(t,e,this.changes)}boundChange(t){Wn(t,t,this.changes)}};function Ji(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function Xi(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function Zi(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function tr(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function er(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function nr(t,e,n){let i,r,s,o,l,a,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=Qe(d);for(let f=0;f<t.length;f++){let p=t[f];r&&Zi(r,p)&&(p=tr(er(p,r.bottom),r.top));let g=Ji(e,p),m=Xi(n,p);if(0==g&&0==m)return 3==d.nodeType?ir(d,e,n):nr(d,e,n);(!i||o>m||o==m&&s>g)&&(i=d,r=p,s=g,o=m,u=!g||(e<p.left?f>0:f<t.length-1)),0==g?n>p.bottom&&(!h||h.bottom<p.bottom)?(l=d,h=p):n<p.top&&(!c||c.top>p.top)&&(a=d,c=p):h&&Zi(h,p)?h=er(h,p.bottom):c&&Zi(c,p)&&(c=tr(c,p.top))}}if(h&&h.bottom>=n?(i=l,r=h):c&&c.top<=n&&(i=a,r=c),!i)return{node:t,offset:0};let d=Math.max(r.left,Math.min(r.right,e));return 3==i.nodeType?ir(i,d,n):u&&"false"!=i.contentEditable?nr(i,d,n):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,i)+(e>=(r.left+r.right)/2?1:0)}}function ir(t,e,n){let i=t.nodeValue.length,r=-1,s=1e9,o=0;for(let l=0;l<i;l++){let i=cn(t,l,l+1).getClientRects();for(let a=0;a<i.length;a++){let h=i[a];if(h.top==h.bottom)continue;o||(o=e-h.left);let c=(h.top>n?h.top-n:n-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&c<s){let n=e>=(h.left+h.right)/2,i=n;if(Ue.chrome||Ue.gecko){let e=cn(t,l).getBoundingClientRect();Math.abs(e.left-h.right)<.1&&(i=!n)}if(c<=0)return{node:t,offset:l+(i?1:0)};r=l+(i?1:0),s=c}}}return{node:t,offset:r>-1?r:o>0?t.nodeValue.length:0}}function rr(t,e,n,i=-1){var r,s;let o,l=t.contentDOM.getBoundingClientRect(),a=l.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-a;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.viewState.heightOracle.textHeight/2,r=!1;o=t.elementAtHeight(d),o.type!=Ln.Text;)for(;d=i>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(r)return n?null:0;r=!0,i=-i}u=a+d;let f=o.from;if(f<t.viewport.from)return 0==t.viewport.from?0:n?null:sr(t,l,o,c,u);if(f>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:sr(t,l,o,c,u);let p=t.dom.ownerDocument,g=t.root.elementFromPoint?t.root:p,m=g.elementFromPoint(c,u);m&&!t.contentDOM.contains(m)&&(m=null),m||(c=Math.max(l.left+1,Math.min(l.right-1,c)),m=g.elementFromPoint(c,u),m&&!t.contentDOM.contains(m)&&(m=null));let v,b=-1;if(m&&0!=(null===(r=t.docView.nearest(m))||void 0===r?void 0:r.isEditable)){if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:v,offset:b}=t)}else if(p.caretRangeFromPoint){let t=p.caretRangeFromPoint(c,u);t&&({startContainer:v,startOffset:b}=t)}v&&(!t.contentDOM.contains(v)||Ue.safari&&function(t,e,n){return or(t,e,n)}(v,b,c)||Ue.chrome&&function(t,e,n){if(0!=e)return or(t,e,n);for(let e=t;;){let t=e.parentNode;if(!t||1!=t.nodeType||t.firstChild!=e)return!1;if(t.classList.contains("cm-line"))break;e=t}return n-(1==t.nodeType?t.getBoundingClientRect():cn(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}(v,b,c))&&(v=void 0),v&&(b=Math.min(en(v),b))}if(!v||!t.docView.dom.contains(v)){let e=$n.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:v,offset:b}=nr(e.dom,c,u))}let y=t.docView.nearest(v);if(!y)return null;if(y.isWidget&&1==(null===(s=y.dom)||void 0===s?void 0:s.nodeType)){let t=y.dom.getBoundingClientRect();return e.y<t.top||e.y<=t.bottom&&e.x<=(t.left+t.right)/2?y.posAtStart:y.posAtEnd}return y.localPosFromDOM(v,b)+y.posAtStart}function sr(t,e,n,i,r){let s=Math.round((i-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>1.5*t.defaultLineHeight){let e=t.viewState.heightOracle.textHeight;s+=Math.floor((r-n.top-.5*(t.defaultLineHeight-e))/e)*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+function(t,e,n){for(let i=0,r=0;;){if(r>=e)return i;if(i==t.length)break;r+=9==t.charCodeAt(i)?n-r%n:1,i=it(t,i)}return t.length}(o,s,t.state.tabSize)}function or(t,e,n){let i,r=t;if(3!=t.nodeType||e!=(i=t.nodeValue.length))return!1;for(;;){let t=r.nextSibling;if(t){if("BR"==t.nodeName)break;return!1}{let t=r.parentNode;if(!t||"DIV"==t.nodeName)break;r=t}}return cn(t,i-1,i).getBoundingClientRect().right>n}function lr(t,e,n,i){let r=t.state.doc.lineAt(e.head),s=t.bidiSpans(r),o=t.textDirectionAt(r.from);for(let l=e,a=null;;){let e=fi(r,s,o,l,n),h=di;if(!e){if(r.number==(n?t.state.doc.lines:1))return l;h="\n",r=t.state.doc.line(r.number+(n?1:-1)),s=t.bidiSpans(r),e=t.visualLineSide(r,!n)}if(a){if(!a(h))return l}else{if(!i)return e;a=i(h)}l=e}}function ar(t,e,n){for(;;){let i=0;for(let r of t)r.between(e-1,e+1,(t,r,s)=>{if(e>t&&e<r){let s=i||n||(e-t<r-e?-1:1);e=s<0?t:r,i=s}});if(!i)return e}}function hr(t,e){let n=null;for(let i=0;i<e.ranges.length;i++){let r=e.ranges[i],s=null;if(r.empty){let e=ar(t,r.from,0);e!=r.from&&(s=bt.cursor(e,-1))}else{let e=ar(t,r.from,-1),n=ar(t,r.to,1);e==r.from&&n==r.to||(s=bt.range(r.from==r.anchor?e:n,r.from==r.head?e:n))}s&&(n||(n=e.ranges.slice()),n[i]=s)}return n?bt.create(n,e.mainIndex):e}function cr(t,e,n){let i=ar(t.state.facet(zi).map(e=>e(t)),n.from,e.head>n.from?-1:1);return i==n.from?n:bt.cursor(i,i<n.from?1:-1)}const ur="";class dr{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(re.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=ur}readRange(t,e){if(!t)return this;let n=t.parentNode;for(let i=t;;){this.findPointBefore(n,i);let t=this.text.length;this.readNode(i);let r=i.nextSibling;if(r==e)break;let s=bn.get(i),o=bn.get(r);(s&&o?s.breakAfter:(s?s.breakAfter:Ze(i))||Ze(r)&&("BR"!=i.nodeName||i.cmIgnore)&&this.text.length>t)&&!pr(r,e)&&this.lineBreak(),i=r}return this.findPointBefore(n,e),this}readTextNode(t){let e=t.nodeValue;for(let n of this.points)n.node==t&&(n.pos=this.text.length+Math.min(n.offset,e.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let r,s=-1,o=1;if(this.lineSeparator?(s=e.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(r=i.exec(e))&&(s=r.index,o=r[0].length),this.append(e.slice(n,s<0?e.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let e of this.points)e.node==t&&e.pos>this.text.length&&(e.pos-=o-1);n=s+o}}readNode(t){if(t.cmIgnore)return;let e=bn.get(t),n=e&&e.overrideDOMText;if(null!=n){this.findPointInside(t,n.length);for(let t=n.iter();!t.next().done;)t.lineBreak?this.lineBreak():this.append(t.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let n of this.points)n.node==t&&t.childNodes[n.offset]==e&&(n.pos=this.text.length)}findPointInside(t,e){for(let n of this.points)(3==t.nodeType?n.node==t:t.contains(n.node))&&(n.pos=this.text.length+(fr(t,n.node,n.offset)?e:0))}}function fr(t,e,n){for(;;){if(!e||n<en(e))return!1;if(e==t)return!0;n=Xe(e)+1,e=e.parentNode}}function pr(t,e){let n;for(;t!=e&&t;t=t.nextSibling){let e=bn.get(t);if(!(null==e?void 0:e.isWidget)&&!t.cmIgnore)return!1;e&&(n||(n=[])).push(e)}if(n)for(let t of n){let e=t.overrideDOMText;if(null==e?void 0:e.length)return!1}return!0}class gr{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class mr{constructor(t,e,n,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=e>-1;let{impreciseHead:r,impreciseAnchor:s}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,n,0))){let e=r||s?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new gr(n,i)),r==n&&s==i||e.push(new gr(r,s))),e}(t),n=new dr(e,t.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(t,e){if(0==t.length)return null;let n=t[0].pos,i=2==t.length?t[1].pos:n;return n>-1&&i>-1?bt.single(n+e,i+e):null}(e,this.bounds.from)}else{let e=t.observer.selectionRange,n=r&&r.node==e.focusNode&&r.offset==e.focusOffset||!Ge(t.contentDOM,e.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),i=s&&s.node==e.anchorNode&&s.offset==e.anchorOffset||!Ge(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset),o=t.viewport;if((Ue.ios||Ue.chrome)&&t.state.selection.main.empty&&n!=i&&(o.from>0||o.to<t.state.doc.length)){let e=Math.min(n,i),r=Math.max(n,i),s=o.from-e,l=o.to-r;0!=s&&1!=s&&0!=e||0!=l&&-1!=l&&r!=t.state.doc.length||(n=0,i=t.state.doc.length)}t.inputState.composing>-1&&t.state.selection.ranges.length>1?this.newSel=t.state.selection.replaceRange(bt.range(i,n)):this.newSel=bt.single(i,n)}}}function vr(t,e){let n,{newSel:i}=e,r=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:i,to:o}=e.bounds,l=r.from,a=null;(8===s||Ue.android&&e.text.length<o-i)&&(l=r.to,a="end");let h=yr(t.state.doc.sliceString(i,o,ur),e.text,l-i,a);h&&(Ue.chrome&&13==s&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==ur+ur&&h.toB--,n={from:i+h.from,to:i+h.toA,insert:K.of(e.text.slice(h.from,h.toB).split(ur))})}else i&&(!t.hasFocus&&t.state.facet(Pi)||i.main.eq(r))&&(i=null);if(!n&&!i)return!1;if(!n&&e.typeOver&&!r.empty&&i&&i.main.empty?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,r.to)}:(Ue.mac||Ue.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=bt.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:K.of([n.insert.toString().replace("."," ")])}):n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,r.to))}:t.state.doc.lineAt(r.from).to<r.to&&t.docView.lineHasWidget(r.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:r.from,to:r.to,insert:t.state.toText(t.inputState.insertingText)}:Ue.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&t.lineWrapping&&(i&&(i=bt.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:K.of([" "])}),n)return br(t,n,i,s);if(i&&!i.main.eq(r)){let e=!1,n="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(e=!0),n=t.inputState.lastSelectionOrigin,"select.pointer"==n&&(i=hr(t.state.facet(zi).map(e=>e(t)),i))),t.dispatch({selection:i,scrollIntoView:e,userEvent:n}),!0}return!1}function br(t,e,n,i=-1){if(Ue.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(Ue.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&" "==t.state.sliceDoc(e.from,r.from))&&1==e.insert.length&&2==e.insert.lines&&un(t.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&0==e.insert.length||8==i&&e.insert.length<e.to-e.from&&e.to>r.head)&&un(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&0==e.insert.length&&un(t.contentDOM,"Delete",46)))return!0;let s,o=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l=()=>s||(s=function(t,e,n){let i,r=t.state,s=r.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let n=e.from<s.from?-1:1,i=n<0?s.from:s.to,l=ar(r.facet(zi).map(e=>e(t)),i,n);e.from==l&&(o=l)}if(o>-1)i={changes:e,selection:bt.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let n=s.from<e.from?r.sliceDoc(s.from,e.from):"",o=s.to>e.to?r.sliceDoc(e.to,s.to):"";i=r.replaceSelection(t.state.toText(n+e.insert.sliceString(0,void 0,t.state.lineBreak)+o))}else{let o=r.changes(e),l=n&&n.main.to<=o.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let a,h=t.state.sliceDoc(e.from,e.to),c=n&&Yi(t,n.main.head);if(c){let t=e.insert.length-(e.to-e.from);a={from:c.from,to:c.to-t}}else a=t.state.doc.lineAt(s.head);let u=s.to-e.to;i=r.changeByRange(n=>{if(n.from==s.from&&n.to==s.to)return{changes:o,range:l||n.map(o)};let i=n.to-u,c=i-h.length;if(t.state.sliceDoc(c,i)!=h||i>=a.from&&c<=a.to)return{range:n};let d=r.changes({from:c,to:i,insert:e.insert}),f=n.to-s.to;return{changes:d,range:l?bt.range(Math.max(0,l.anchor+f),Math.max(0,l.head+f)):n.map(d)}})}else i={changes:o,selection:l&&r.selection.replaceRange(l)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:l,scrollIntoView:!0})}(t,e,n));return t.state.facet(wi).some(n=>n(t,e.from,e.to,o,l))||t.dispatch(l()),!0}function yr(t,e,n,i){let r=Math.min(t.length,e.length),s=0;for(;s<r&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&t.length==e.length)return null;let o=t.length,l=e.length;for(;o>0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;return"end"==i&&(n-=o+Math.max(0,s-Math.min(o,l))-s),o<s&&t.length<e.length?(s-=n<=s&&n>=o?s-n:0,l=s+(l-o),o=s):l<s&&(s-=n<=s&&n>=l?s-n:0,o=s+(o-l),l=s),{from:s,toA:o,toB:l}}class wr{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,Ue.safari&&t.contentDOM.addEventListener("input",()=>null),Ue.gecko&&function(t){Kr.has(t)||(Kr.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}(t.contentDOM.ownerDocument)}handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n,i=e.target;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=bn.get(i))&&n.ignoreEvent(e))return!1;return!0})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t)))}runHandlers(t,e){let n=this.handlers[t];if(n){for(let t of n.observers)t(this.view,e);for(let t of n.handlers){if(e.defaultPrevented)break;if(t(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=kr(t),n=this.handlers,i=this.view.contentDOM;for(let t in e)if("scroll"!=t){let r=!e[t].handlers.length,s=n[t];s&&r!=!s.handlers.length&&(i.removeEventListener(t,this.handleEvent),s=null),s||i.addEventListener(t,this.handleEvent,{passive:r})}for(let t in n)"scroll"==t||e[t]||i.removeEventListener(t,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=t.keyCode&&Cr.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Ue.android&&Ue.chrome&&!t.synthetic&&(13==t.keyCode||8==t.keyCode))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return!Ue.ios||t.synthetic||t.altKey||t.metaKey||!((e=Ar.find(e=>e.keyCode==t.keyCode))&&!t.ctrlKey||Sr.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&!("Enter"==e.key&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString()))&&(this.pendingIOSKey=void 0,un(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0))}ignoreDuringComposition(t){return!(!/^key/.test(t.type)||t.synthetic)&&(this.composing>0||!!(Ue.safari&&!Ue.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function xr(t,e){return(n,i)=>{try{return e.call(t,i,n)}catch(t){_i(n.state,t)}}}function kr(t){let e=Object.create(null);function n(t){return e[t]||(e[t]={observers:[],handlers:[]})}for(let e of t){let t=e.spec,i=t&&t.plugin.domEventHandlers,r=t&&t.plugin.domEventObservers;if(i)for(let t in i){let r=i[t];r&&n(t).handlers.push(xr(e.value,r))}if(r)for(let t in r){let i=r[t];i&&n(t).observers.push(xr(e.value,i))}}for(let t in Or)n(t).handlers.push(Or[t]);for(let t in Mr)n(t).observers.push(Mr[t]);return e}const Ar=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Sr="dthko",Cr=[16,17,18,20,91,92,224,225];function Er(t){return.7*Math.max(0,t)+8}class Tr{constructor(t,e,n,i){this.view=t,this.startEvent=e,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParents=function(t){let e,n,i=t.ownerDocument;for(let r=t.parentNode;r&&!(r==i.body||e&&n);)if(1==r.nodeType)!n&&r.scrollHeight>r.clientHeight&&(n=r),!e&&r.scrollWidth>r.clientWidth&&(e=r),r=r.assignedSlot||r.parentNode;else{if(11!=r.nodeType)break;r=r.host}return{x:e,y:n}}(t.contentDOM),this.atoms=t.state.facet(zi).map(e=>e(t));let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(re.allowMultipleSelections)&&function(t,e){let n=t.state.facet(gi);return n.length?n[0](e):Ue.mac?e.metaKey:e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let i=Ke(t.root);if(!i||0==i.rangeCount)return!0;let r=i.getRangeAt(0).getClientRects();for(let t=0;t<r.length;t++){let n=r[t];if(n.left<=e.clientX&&n.right>=e.clientX&&n.top<=e.clientY&&n.bottom>=e.clientY)return!0}return!1}(t,e)||1!=jr(e))&&null}start(t){!1===this.dragging&&this.select(t)}move(t){if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(e=this.startEvent,n=t,Math.max(Math.abs(e.clientX-n.clientX),Math.abs(e.clientY-n.clientY))<10))return;var e,n;this.select(this.lastEvent=t);let i=0,r=0,s=0,o=0,l=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:a}=this.scrollParents.y.getBoundingClientRect());let h=$i(this.view);t.clientX-h.left<=s+6?i=-Er(s-t.clientX):t.clientX+h.right>=l-6&&(i=Er(t.clientX-l)),t.clientY-h.top<=o+6?r=-Er(o-t.clientY):t.clientY+h.bottom>=a-6&&(r=Er(t.clientY-a)),this.setScrollSpeed(i,r)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:e}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),e&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=e,e=0),(t||e)&&this.view.win.scrollBy(t,e),!1===this.dragging&&this.select(this.lastEvent)}select(t){let{view:e}=this,n=hr(this.atoms,this.style.get(t,this.extend,this.multiple));!this.mustSelect&&n.eq(e.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}const Or=Object.create(null),Mr=Object.create(null),_r=Ue.ie&&Ue.ie_version<15||Ue.ios&&Ue.webkit_version<604;function Pr(t,e,n){for(let i of t.facet(e))n=i(n,t);return n}function Dr(t,e){e=Pr(t.state,ki,e);let n,{state:i}=t,r=1,s=i.toText(e),o=s.lines==i.selection.ranges.length;if(null!=Wr&&i.selection.ranges.every(t=>t.empty)&&Wr==s.toString()){let t=-1;n=i.changeByRange(n=>{let l=i.doc.lineAt(n.from);if(l.from==t)return{range:n};t=l.from;let a=i.toText((o?s.line(r++).text:e)+i.lineBreak);return{changes:{from:l.from,insert:a},range:bt.cursor(n.from+a.length)}})}else n=o?i.changeByRange(t=>{let e=s.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:bt.cursor(t.from+e.length)}}):i.replaceSelection(s);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function Rr(t,e,n,i){if(1==i)return bt.cursor(e,n);if(2==i)return function(t,e,n=1){let i=t.charCategorizer(e),r=t.doc.lineAt(e),s=e-r.from;if(0==r.length)return bt.cursor(e);0==s?n=1:s==r.length&&(n=-1);let o=s,l=s;n<0?o=it(r.text,s,!1):l=it(r.text,s);let a=i(r.text.slice(o,l));for(;o>0;){let t=it(r.text,o,!1);if(i(r.text.slice(t,o))!=a)break;o=t}for(;l<r.length;){let t=it(r.text,l);if(i(r.text.slice(l,t))!=a)break;l=t}return bt.range(o+r.from,l+r.from)}(t.state,e,n);{let n=$n.find(t.docView,e),i=t.state.doc.lineAt(n?n.posAtEnd:e),r=n?n.posAtStart:i.from,s=n?n.posAtEnd:i.to;return s<t.state.doc.length&&s==i.to&&s++,bt.range(r,s)}}Mr.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},Or.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),27==e.keyCode&&0!=t.inputState.tabFocusMode&&(t.inputState.tabFocusMode=Date.now()+2e3),!1),Mr.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Mr.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},Or.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of t.state.facet(vi))if(n=i(t,e),n)break;if(n||0!=e.button||(n=function(t,e){let n=Nr(t,e),i=jr(e),r=t.state.selection;return{update(t){t.docChanged&&(n.pos=t.changes.mapPos(n.pos),r=r.map(t.changes))},get(e,s,o){let l,a=Nr(t,e),h=Rr(t,a.pos,a.bias,i);if(n.pos!=a.pos&&!s){let e=Rr(t,n.pos,n.bias,i),r=Math.min(e.from,h.from),s=Math.max(e.to,h.to);h=r<h.from?bt.range(r,s):bt.range(s,r)}return s?r.replaceRange(r.main.extend(h.from,h.to)):o&&1==i&&r.ranges.length>1&&(l=function(t,e){for(let n=0;n<t.ranges.length;n++){let{from:i,to:r}=t.ranges[n];if(i<=e&&r>=e)return bt.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}(r,a.pos))?l:o?r.addRange(h):bt.create([h])}}}(t,e)),n){let i=!t.hasFocus;t.inputState.startMouseSelection(new Tr(t,e,n,i)),i&&t.observer.ignore(()=>{hn(t.contentDOM);let e=t.root.activeElement;e&&!e.contains(t.contentDOM)&&e.blur()});let r=t.inputState.mouseSelection;if(r)return r.start(e),!1===r.dragging}else t.inputState.setSelectionOrigin("select.pointer");return!1};let Br=(t,e,n)=>e>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function Ir(t,e,n,i){let r=$n.find(t.docView,e);if(!r)return 1;let s=e-r.posAtStart;if(0==s)return 1;if(s==r.length)return-1;let o=r.coordsAt(s,-1);if(o&&Br(n,i,o))return-1;let l=r.coordsAt(s,1);return l&&Br(n,i,l)?1:o&&o.bottom>=i?-1:1}function Nr(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Ir(t,n,e.clientX,e.clientY)}}const Lr=Ue.ie&&Ue.ie_version<=11;let Fr=null,Vr=0,zr=0;function jr(t){if(!Lr)return t.detail;let e=Fr,n=zr;return Fr=t,zr=Date.now(),Vr=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Vr+1)%3:1}function Hr(t,e,n,i){if(!(n=Pr(t.state,ki,n)))return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=i&&s&&function(t,e){let n=t.state.facet(mi);return n.length?n[0](e):Ue.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:s.from,to:s.to}:null,l={from:r,insert:n},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Or.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.nearest(e.target);if(i&&i.isWidget){let t=i.posAtStart,e=t+i.length;(t>=n.to||e<=n.from)&&(n=bt.range(t,e))}}let{inputState:i}=t;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Pr(t.state,Ai,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Or.dragend=t=>(t.inputState.draggedContent=null,!1),Or.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,s=()=>{++r==n.length&&Hr(t,e,i.filter(t=>null!=t).join(t.state.lineBreak),!1)};for(let t=0;t<n.length;t++){let e=new FileReader;e.onerror=s,e.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(i[t]=e.result),s()},e.readAsText(n[t])}return!0}{let n=e.dataTransfer.getData("Text");if(n)return Hr(t,e,n,!0),!0}return!1},Or.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=_r?null:e.clipboardData;return n?(Dr(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),Dr(t,n.value)},50)}(t),!1)};let Wr=null;Or.copy=Or.cut=(t,e)=>{let{text:n,ranges:i,linewise:r}=function(t){let e=[],n=[],i=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let r=-1;for(let{from:i}of t.selection.ranges){let s=t.doc.lineAt(i);s.number>r&&(e.push(s.text),n.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),r=s.number}i=!0}return{text:Pr(t,Ai,e.join(t.lineBreak)),ranges:n,linewise:i}}(t.state);if(!n&&!r)return!1;Wr=r?n:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=_r?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(function(t,e){let n=t.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),t.focus()},50)}(t,n),!1)};const $r=$t.define();function qr(t,e){let n=[];for(let i of t.facet(xi)){let r=i(t,e);r&&n.push(r)}return n.length?t.update({effects:n,annotations:$r.of(!0)}):null}function Ur(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=qr(t.state,e);n?t.dispatch(n):t.update([])}},10)}Mr.focus=t=>{t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Ur(t)},Mr.blur=t=>{t.observer.clearSelectionRange(),Ur(t)},Mr.compositionstart=Mr.compositionupdate=t=>{t.observer.editContext||(null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))},Mr.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Ue.chrome&&Ue.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))},Mr.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Or.beforeinput=(t,e)=>{var n,i;if("insertText"!=e.inputType&&"insertCompositionText"!=e.inputType||(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),"insertReplacementText"==e.inputType&&t.observer.editContext){let i=null===(n=e.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),r=e.getTargetRanges();if(i&&r.length){let e=r[0],n=t.posAtDOM(e.startContainer,e.startOffset),s=t.posAtDOM(e.endContainer,e.endOffset);return br(t,{from:n,to:s,insert:t.state.toText(i)},null),!0}}let r;if(Ue.chrome&&Ue.android&&(r=Ar.find(t=>t.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),"Backspace"==r.key||"Delete"==r.key)){let e=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout(()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>e+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Ue.ios&&"deleteContentForward"==e.inputType&&t.observer.flushSoon(),Ue.safari&&"insertText"==e.inputType&&t.inputState.composing>=0&&setTimeout(()=>Mr.compositionend(t,e),20),!1};const Kr=new Set,Gr=["pre-wrap","normal","pre-line","break-spaces"];let Yr=!1;function Qr(){Yr=!1}class Jr{constructor(t){this.lineWrapping=t,this.doc=K.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,e){let n=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((e-t-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return Gr.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let n=0;n<t.length;n++){let i=t[n];i<0?n++:this.heightSamples[Math.floor(10*i)]||(e=!0,this.heightSamples[Math.floor(10*i)]=!0)}return e}refresh(t,e,n,i,r,s){let o=Gr.indexOf(t)>-1,l=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=e,this.charWidth=n,this.textHeight=i,this.lineLength=r,l){this.heightSamples={};for(let t=0;t<s.length;t++){let e=s[t];e<0?t++:this.heightSamples[Math.floor(10*e)]=!0}}return l}}class Xr{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class Zr{constructor(t,e,n,i,r){this.from=t,this.length=e,this.top=n,this.height=i,this._content=r}get type(){return"number"==typeof this._content?Ln.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof jn?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(t){let e=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new Zr(this.from,this.length+t.length,this.top,this.height+t.height,e)}}var ts=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(ts||(ts={}));const es=.001;class ns{constructor(t,e,n=2){this.length=t,this.height=e,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>es&&(Yr=!0),this.height=t)}replace(t,e,n){return ns.of(n)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,n,i){let r=this,s=n.doc;for(let o=i.length-1;o>=0;o--){let{fromA:l,toA:a,fromB:h,toB:c}=i[o],u=r.lineAt(l,ts.ByPosNoHeight,n.setDoc(e),0,0),d=u.to>=a?u:r.lineAt(a,ts.ByPosNoHeight,n,0,0);for(c+=d.to-a,a=d.to;o>0&&u.from<=i[o-1].toA;)l=i[o-1].fromA,h=i[o-1].fromB,o--,l<u.from&&(u=r.lineAt(l,ts.ByPosNoHeight,n,0,0));h+=u.from-l,l=u.from;let f=hs.build(n.setDoc(s),t,h,c);r=is(r,r.replace(l,a,f))}return r.updateHeight(n,0)}static empty(){return new ss(0,0)}static of(t){if(1==t.length)return t[0];let e=0,n=t.length,i=0,r=0;for(;;)if(e==n)if(i>2*r){let r=t[e-1];r.break?t.splice(--e,1,r.left,null,r.right):t.splice(--e,1,r.left,r.right),n+=1+r.break,i-=r.size}else{if(!(r>2*i))break;{let e=t[n];e.break?t.splice(n,1,e.left,null,e.right):t.splice(n,1,e.left,e.right),n+=2+e.break,r-=e.size}}else if(i<r){let n=t[e++];n&&(i+=n.size)}else{let e=t[--n];e&&(r+=e.size)}let s=0;return null==t[e-1]?(s=1,e--):null==t[e]&&(s=1,n++),new ls(ns.of(t.slice(0,e)),s,ns.of(t.slice(n)))}}function is(t,e){return t==e?t:(t.constructor!=e.constructor&&(Yr=!0),e)}ns.prototype.size=1;class rs extends ns{constructor(t,e,n){super(t,e),this.deco=n}blockAt(t,e,n,i){return new Zr(i,this.length,n,this.height,this.deco||0)}lineAt(t,e,n,i,r){return this.blockAt(0,n,i,r)}forEachLine(t,e,n,i,r,s){t<=r+this.length&&e>=r&&s(this.blockAt(0,n,i,r))}updateHeight(t,e=0,n=!1,i){return i&&i.from<=e&&i.more&&this.setHeight(i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ss extends rs{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,n,i){return new Zr(i,this.length,n,this.height,this.breaks)}replace(t,e,n){let i=n[0];return 1==n.length&&(i instanceof ss||i instanceof os&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof os?i=new ss(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):ns.of(n)}updateHeight(t,e=0,n=!1,i){return i&&i.from<=e&&i.more?this.setHeight(i.heights[i.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class os extends ns{constructor(t){super(t,0)}heightMetrics(t,e){let n,i=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,s=r-i+1,o=0;if(t.lineWrapping){let e=Math.min(this.height,t.lineHeight*s);n=e/s,this.length>s+1&&(o=(this.height-e)/(this.length-s-1))}else n=this.height/s;return{firstLine:i,lastLine:r,perLine:n,perChar:o}}blockAt(t,e,n,i){let{firstLine:r,lastLine:s,perLine:o,perChar:l}=this.heightMetrics(e,i);if(e.lineWrapping){let r=i+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-n)/this.height))*this.length)),s=e.doc.lineAt(r),a=o+s.length*l,h=Math.max(n,t-a/2);return new Zr(s.from,s.length,h,a,0)}{let i=Math.max(0,Math.min(s-r,Math.floor((t-n)/o))),{from:l,length:a}=e.doc.line(r+i);return new Zr(l,a,n+o*i,o,0)}}lineAt(t,e,n,i,r){if(e==ts.ByHeight)return this.blockAt(t,n,i,r);if(e==ts.ByPosNoHeight){let{from:e,to:i}=n.doc.lineAt(t);return new Zr(e,i-e,0,0,0)}let{firstLine:s,perLine:o,perChar:l}=this.heightMetrics(n,r),a=n.doc.lineAt(t),h=o+a.length*l,c=a.number-s,u=i+o*c+l*(a.from-r-c);return new Zr(a.from,a.length,Math.max(i,Math.min(u,i+this.height-h)),h,0)}forEachLine(t,e,n,i,r,s){t=Math.max(t,r),e=Math.min(e,r+this.length);let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(n,r);for(let h=t,c=i;h<=e;){let e=n.doc.lineAt(h);if(h==t){let n=e.number-o;c+=l*n+a*(t-r-n)}let i=l+a*e.length;s(new Zr(e.from,e.length,c,i,0)),c+=i,h=e.to+1}}replace(t,e,n){let i=this.length-e;if(i>0){let t=n[n.length-1];t instanceof os?n[n.length-1]=new os(t.length+i):n.push(null,new os(i-1))}if(t>0){let e=n[0];e instanceof os?n[0]=new os(t+e.length):n.unshift(new os(t-1),null)}return ns.of(n)}decomposeLeft(t,e){e.push(new os(t-1),null)}decomposeRight(t,e){e.push(null,new os(this.length-t-1))}updateHeight(t,e=0,n=!1,i){let r=e+this.length;if(i&&i.from<=e+this.length&&i.more){let n=[],s=Math.max(e,i.from),o=-1;for(i.from>e&&n.push(new os(i.from-e-1).updateHeight(t,e));s<=r&&i.more;){let e=t.doc.lineAt(s).length;n.length&&n.push(null);let r=i.heights[i.index++];-1==o?o=r:Math.abs(r-o)>=es&&(o=-2);let l=new ss(e,r);l.outdated=!1,n.push(l),s+=e+1}s<=r&&n.push(null,new os(r-s).updateHeight(t,s));let l=ns.of(n);return(o<0||Math.abs(l.height-this.height)>=es||Math.abs(o-this.heightMetrics(t,e).perLine)>=es)&&(Yr=!0),is(this,l)}return(n||this.outdated)&&(this.setHeight(t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ls extends ns{constructor(t,e,n){super(t.length+e+n.length,t.height+n.height,e|(t.outdated||n.outdated?2:0)),this.left=t,this.right=n,this.size=t.size+n.size}get break(){return 1&this.flags}blockAt(t,e,n,i){let r=n+this.left.height;return t<r?this.left.blockAt(t,e,n,i):this.right.blockAt(t,e,r,i+this.left.length+this.break)}lineAt(t,e,n,i,r){let s=i+this.left.height,o=r+this.left.length+this.break,l=e==ts.ByHeight?t<s:t<o,a=l?this.left.lineAt(t,e,n,i,r):this.right.lineAt(t,e,n,s,o);if(this.break||(l?a.to<o:a.from>o))return a;let h=e==ts.ByPosNoHeight?ts.ByPosNoHeight:ts.ByPos;return l?a.join(this.right.lineAt(o,h,n,s,o)):this.left.lineAt(o,h,n,i,r).join(a)}forEachLine(t,e,n,i,r,s){let o=i+this.left.height,l=r+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,e,n,i,r,s),e>=l&&this.right.forEachLine(t,e,n,o,l,s);else{let a=this.lineAt(l,ts.ByPos,n,i,r);t<a.from&&this.left.forEachLine(t,a.from-1,n,i,r,s),a.to>=t&&a.from<=e&&s(a),e>a.to&&this.right.forEachLine(a.to+1,e,n,o,l,s)}}replace(t,e,n){let i=this.left.length+this.break;if(e<i)return this.balanced(this.left.replace(t,e,n),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-i,e-i,n));let r=[];t>0&&this.decomposeLeft(t,r);let s=r.length;for(let t of n)r.push(t);if(t>0&&as(r,s-1),e<this.length){let t=r.length;this.decomposeRight(e,r),as(r,t)}return ns.of(r)}decomposeLeft(t,e){let n=this.left.length;if(t<=n)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&(n++,t>=n&&e.push(null)),t>n&&this.right.decomposeLeft(t-n,e)}decomposeRight(t,e){let n=this.left.length,i=n+this.break;if(t>=i)return this.right.decomposeRight(t-i,e);t<n&&this.left.decomposeRight(t,e),this.break&&t<i&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?ns.of(this.break?[t,null,e]:[t,e]):(this.left=is(this.left,t),this.right=is(this.right,e),this.setHeight(t.height+e.height),this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,n=!1,i){let{left:r,right:s}=this,o=e+r.length+this.break,l=null;return i&&i.from<=e+r.length&&i.more?l=r=r.updateHeight(t,e,n,i):r.updateHeight(t,e,n),i&&i.from<=o+s.length&&i.more?l=s=s.updateHeight(t,o,n,i):s.updateHeight(t,o,n),l?this.balanced(r,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function as(t,e){let n,i;null==t[e]&&(n=t[e-1])instanceof os&&(i=t[e+1])instanceof os&&t.splice(e-1,3,new os(n.length+1+i.length))}class hs{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let t=Math.min(e,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof ss?n.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new ss(t-this.pos,-1)),this.writtenTo=t,e>t&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,n){if(t<e||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let s=e-t;n.block?this.addBlock(new rs(s,i,n)):(s||r||i>=5)&&this.addLineDeco(i,r,s)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new ss(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let n=new os(e-t);return this.oracle.doc.lineAt(t).to==e&&(n.flags|=4),n}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof ss)return t;let e=new ss(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,t),i.breaks+=e,this.writtenTo=this.pos=this.pos+n}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof ss||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new ss(0,-1));let n=t;for(let t of this.nodes)t instanceof ss&&t.updateHeight(this.oracle,n),n+=t?t.length:1;return this.nodes}static build(t,e,n,i){let r=new hs(n,t);return ce.spans(e,n,i,r,0),r.finish(n)}}class cs{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,n,i){(t<e||n&&n.heightRelevant||i&&i.heightRelevant)&&Wn(t,e,this.changes,5)}}function us(t,e){let n=t.getBoundingClientRect(),i=t.ownerDocument,r=i.defaultView||window,s=Math.max(0,n.left),o=Math.min(r.innerWidth,n.right),l=Math.max(0,n.top),a=Math.min(r.innerHeight,n.bottom);for(let e=t.parentNode;e&&e!=i.body;)if(1==e.nodeType){let n=e,i=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();s=Math.max(s,i.left),o=Math.min(o,i.right),l=Math.max(l,i.top),a=Math.min(e==t.parentNode?r.innerHeight:a,i.bottom)}e="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=e.nodeType)break;e=e.host}return{left:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+e),bottom:Math.max(l,a)-(n.top+e)}}function ds(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class fs{constructor(t,e,n,i){this.from=t,this.to=e,this.size=n,this.displaySize=i}static same(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let i=t[n],r=e[n];if(i.from!=r.from||i.to!=r.to||i.size!=r.size)return!1}return!0}draw(t,e){return Fn.replace({widget:new ps(this.displaySize*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}}class ps extends Nn{constructor(t,e){super(),this.size=t,this.vertical=e}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}}class gs{constructor(t){this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=ys,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Qn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let e=t.facet(Li).some(t=>"function"!=typeof t&&"cm-lineWrapping"==t.class);this.heightOracle=new Jr(e),this.stateDeco=t.facet(Fi).filter(t=>"function"!=typeof t),this.heightMap=ns.empty().applyChanges(this.stateDeco,K.empty,this.heightOracle.setDoc(t.doc),[new Ui(0,0,0,t.doc.length)]);for(let t=0;t<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());t++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Fn.set(this.lineGaps.map(t=>t.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let n=0;n<=1;n++){let i=n?e.head:e.anchor;if(!t.some(({from:t,to:e})=>i>=t&&i<=e)){let{from:e,to:n}=this.lineBlockAt(i);t.push(new ms(e,n))}}return this.viewports=t.sort((t,e)=>t.from-e.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?ys:new ws(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(xs(t,this.scaler))})}update(t,e=null){this.state=t.state;let n=this.stateDeco;this.stateDeco=this.state.facet(Fi).filter(t=>"function"!=typeof t);let i=t.changedRanges,r=Ui.extendWithRanges(i,function(t,e,n){let i=new cs;return ce.compare(t,e,n,i,0),i.changes}(n,this.stateDeco,t?t.changes:ct.empty(this.state.doc.length))),s=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Qr(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=s||Yr)&&(t.flags|=2),o?(this.scrollAnchorPos=t.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let l=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<l.from||e.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));let a=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,t.flags|=this.updateForViewport(),(a||!t.changes.empty||2&t.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(Ci)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,n=window.getComputedStyle(e),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Qn.RTL:Qn.LTR;let s=this.heightOracle.mustRefreshForWrapping(r),o=e.getBoundingClientRect(),l=s||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let a=0,h=0;if(o.width&&o.height){let{scaleX:t,scaleY:n}=sn(e,o);(t>.005&&Math.abs(this.scaleX-t)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=t,this.scaleY=n,a|=16,s=l=!0)}let c=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==c&&this.paddingBottom==u||(this.paddingTop=c,this.paddingBottom=u,a|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,a|=16);let d=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=fn(t.scrollDOM);let f=(this.printing?ds:us)(e,this.paddingTop),p=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&&(l=!0)),!this.inView&&!this.scrollTarget&&!function(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}(t.dom))return 0;let v=o.width;if(this.contentDOMWidth==v&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=o.width,this.editorHeight=t.scrollDOM.clientHeight,a|=16),l){let e=t.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(e)&&(s=!0),s||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:n,charWidth:o,textHeight:l}=t.docView.measureTextSize();s=n>0&&i.refresh(r,n,o,l,Math.max(5,v/o),e),s&&(t.docView.minWidth=0,a|=16)}p>0&&g>0?h=Math.max(p,g):p<0&&g<0&&(h=Math.min(p,g)),Qr();for(let n of this.viewports){let r=n.from==this.viewport.from?e:t.docView.measureVisibleLineHeights(n);this.heightMap=(s?ns.empty().applyChanges(this.stateDeco,K.empty,this.heightOracle,[new Ui(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(i,0,s,new Xr(n.from,r))}Yr&&(a|=2)}let b=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return b&&(2&a&&(a|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),a|=this.updateForViewport()),(2&a||b)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,t)),a|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),a}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let n=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),i=this.heightMap,r=this.heightOracle,{visibleTop:s,visibleBottom:o}=this,l=new ms(i.lineAt(s-1e3*n,ts.ByHeight,r,0,0).from,i.lineAt(o+1e3*(1-n),ts.ByHeight,r,0,0).to);if(e){let{head:t}=e.range;if(t<l.from||t>l.to){let n,s=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=i.lineAt(t,ts.ByPos,r,0,0);n="center"==e.y?(o.top+o.bottom)/2-s/2:"start"==e.y||"nearest"==e.y&&t<l.from?o.top:o.bottom-s,l=new ms(i.lineAt(n-500,ts.ByHeight,r,0,0).from,i.lineAt(n+s+500,ts.ByHeight,r,0,0).to)}}return l}mapViewport(t,e){let n=e.mapPos(t.from,-1),i=e.mapPos(t.to,1);return new ms(this.heightMap.lineAt(n,ts.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,ts.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:e},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(t,ts.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(e,ts.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:o}=this;return(0==t||i<=s-Math.max(10,Math.min(-n,250)))&&(e==this.state.doc.length||r>=o+Math.max(10,Math.min(n,250)))&&i>s-2e3&&r<o+2e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let n=[];for(let i of t)e.touchesRange(i.from,i.to)||n.push(new fs(e.mapPos(i.from),e.mapPos(i.to),i.size,i.displaySize));return n}ensureLineGaps(t,e){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,r=i>>1,s=i<<1;if(this.defaultTextDirection!=Qn.LTR&&!n)return[];let o=[],l=(i,s,a,h)=>{if(s-i<r)return;let c=this.state.selection.main,u=[c.from];c.empty||u.push(c.to);for(let t of u)if(t>i&&t<s)return l(i,t-10,a,h),void l(t+10,s,a,h);let d=function(t,e){for(let n of t)if(e(n))return n}(t,t=>t.from>=a.from&&t.to<=a.to&&Math.abs(t.from-i)<r&&Math.abs(t.to-s)<r&&!u.some(e=>t.from<e&&t.to>e));if(!d){if(s<a.to&&e&&n&&e.visibleRanges.some(t=>t.from<=s&&t.to>=s)){let t=e.moveToLineBoundary(bt.cursor(s),!1,!0).head;t>i&&(s=t)}let t=this.gapSize(a,i,s,h);d=new fs(i,s,t,n||t<2e6?t:2e6)}o.push(d)},a=e=>{if(e.length<s||e.type!=Ln.Text)return;let r=function(t,e,n){let i=[],r=t,s=0;return ce.spans(n,t,e,{span(){},point(t,e){t>r&&(i.push({from:r,to:t}),s+=t-r),r=e}},20),r<e&&(i.push({from:r,to:e}),s+=e-r),{total:s,ranges:i}}(e.from,e.to,this.stateDeco);if(r.total<s)return;let o,a,h=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let t,n,s=i/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=h){let i=bs(r,h),o=((this.visibleBottom-this.visibleTop)/2+s)/e.height;t=i-o,n=i+o}else t=(this.visibleTop-e.top-s)/e.height,n=(this.visibleBottom-e.top+s)/e.height;o=vs(r,t),a=vs(r,n)}else{let n=r.total*this.heightOracle.charWidth,s=i*this.heightOracle.charWidth,l=0;if(n>2e6)for(let n of t)n.from>=e.from&&n.from<e.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+l<this.pixelViewport.left&&(l=n.size-n.displaySize);let c,u,d=this.pixelViewport.left+l,f=this.pixelViewport.right+l;if(null!=h){let t=bs(r,h),e=((f-d)/2+s)/n;c=t-e,u=t+e}else c=(d-s)/n,u=(f+s)/n;o=vs(r,c),a=vs(r,u)}o>e.from&&l(e.from,o,e,r),a<e.to&&l(a,e.to,e,r)};for(let t of this.viewportLines)Array.isArray(t.type)?t.type.forEach(a):a(t);return o}gapSize(t,e,n,i){let r=bs(i,n)-bs(i,e);return this.heightOracle.lineWrapping?t.height*r:i.total*this.heightOracle.charWidth*r}updateLineGaps(t){fs.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=Fn.set(t.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let n=[];ce.spans(e,this.viewport.from,this.viewport.to,{span(t,e){n.push({from:t,to:e})},point(){}},20);let i=0;if(n.length!=this.visibleRanges.length)i=12;else for(let e=0;e<n.length&&!(8&i);e++){let r=this.visibleRanges[e],s=n[e];r.from==s.from&&r.to==s.to||(i|=4,t&&t.mapPos(r.from,-1)==s.from&&t.mapPos(r.to,1)==s.to||(i|=8))}return this.visibleRanges=n,i}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||xs(this.heightMap.lineAt(t,ts.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(e=>e.top<=t&&e.bottom>=t)||xs(this.heightMap.lineAt(this.scaler.fromDOM(t),ts.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return xs(this.heightMap.blockAt(this.scaler.fromDOM(t),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 ms{constructor(t,e){this.from=t,this.to=e}}function vs({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let i=Math.floor(t*n);for(let t=0;;t++){let{from:n,to:r}=e[t],s=r-n;if(i<=s)return n+i;i-=s}}function bs(t,e){let n=0;for(let{from:i,to:r}of t.ranges){if(e<=r){n+=e-i;break}n+=r-i}return n/t.total}const ys={toDOM:t=>t,fromDOM:t=>t,scale:1,eq(t){return t==this}};class ws{constructor(t,e,n){let i=0,r=0,s=0;this.viewports=n.map(({from:n,to:r})=>{let s=e.lineAt(n,ts.ByPos,t,0,0).top,o=e.lineAt(r,ts.ByPos,t,0,0).bottom;return i+=o-s,{from:n,to:r,top:s,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(e.height-i);for(let t of this.viewports)t.domTop=s+(t.top-r)*this.scale,s=t.domBottom=t.domTop+(t.bottom-t.top),r=t.bottom}toDOM(t){for(let e=0,n=0,i=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.top)return i+(t-n)*this.scale;if(t<=r.bottom)return r.domTop+(t-r.top);n=r.bottom,i=r.domBottom}}fromDOM(t){for(let e=0,n=0,i=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.domTop)return n+(t-i)/this.scale;if(t<=r.domBottom)return r.top+(t-r.domTop);n=r.bottom,i=r.domBottom}}eq(t){return t instanceof ws&&this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,n)=>e.from==t.viewports[n].from&&e.to==t.viewports[n].to)}}function xs(t,e){if(1==e.scale)return t;let n=e.toDOM(t.top),i=e.toDOM(t.bottom);return new Zr(t.from,t.length,n,i-n,Array.isArray(t._content)?t._content.map(t=>xs(t,e)):t._content)}const ks=xt.define({combine:t=>t.join(" ")}),As=xt.define({combine:t=>t.indexOf(!0)>-1}),Ss=Ee.newName(),Cs=Ee.newName(),Es=Ee.newName(),Ts={"&light":"."+Cs,"&dark":"."+Es};function Os(t,e,n){return new Ee(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,e=>{if("&"==e)return t;if(!n||!n[e])throw new RangeError(`Unsupported selector: ${e}`);return n[e]}):t+" "+e})}const Ms=Os("."+Ss,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".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",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Ts),_s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Ps=Ue.ie&&Ue.ie_version<=11;class Ds{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new on,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let t of e)this.queue.push(t);(Ue.ie&&Ue.ie_version<=11||Ue.ios&&t.composing)&&e.some(t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length)?this.flushSoon():this.flush()}),!window.EditContext||!Ue.android||!1===t.constructor.EDIT_CONTEXT||Ue.chrome&&Ue.chrome_version<126||(this.editContext=new Is(t),t.state.facet(Pi)&&(t.contentDOM.editContext=this.editContext.editContext)),Ps&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){("change"!=t.type&&t.type||t.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,n)=>e!=t[n]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(Pi)?n.root.activeElement!=this.dom:!Ye(this.dom,i))return;let r=i.anchorNode&&n.docView.nearest(i.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(Ue.ie&&Ue.ie_version<=11||Ue.android&&Ue.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Je(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Ke(t.root);if(!e)return!1;let n=Ue.safari&&11==t.root.nodeType&&t.root.activeElement==this.dom&&function(t,e){if(e.getComposedRanges){let n=e.getComposedRanges(t.root)[0];if(n)return Bs(t,n)}let n=null;function i(t){t.preventDefault(),t.stopImmediatePropagation(),n=t.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",i,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),n?Bs(t,n):null}(this.view,e)||e;if(!n||this.selectionRange.eq(n))return!1;let i=Ye(this.dom,n);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){let n=e.focusNode,i=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=i)return!1;for(i=Math.min(i,en(n));;)if(i){if(1!=n.nodeType)return!1;let t=n.childNodes[i-1];"false"==t.contentEditable?i--:(n=t,i=en(n))}else{if(n==t)return!0;i=Xe(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(n),i&&(this.selectionChanged=!0),!0)}setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,e=null;for(let n=this.dom;n;)if(1==n.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==n?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);for(let t of this.scrollTargets=e)t.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,_s),Ps&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Ps&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,e){var n;if(!this.delayedAndroidKey){let t=()=>{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=t.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&t.force&&un(this.dom,t.key,t.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(t)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,n=-1,i=!1;for(let r of t){let t=this.readMutation(r);t&&(t.typeOver&&(i=!0),-1==e?({from:e,to:n}=t):(e=Math.min(t.from,e),n=Math.max(t.to,n)))}return{from:e,to:n,typeOver:i}}readChange(){let{from:t,to:e,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Ye(this.dom,this.selectionRange);if(t<0&&!i)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new mr(this.view,t,e,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let n=this.view.state,i=vr(this.view,e);return this.view.state==n&&(e.domChanged||e.newSel&&!e.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){let n=Rs(e,t.previousSibling||t.target.previousSibling,-1),i=Rs(e,t.nextSibling||t.target.nextSibling,1);return{from:n?e.posAfter(n):e.posAtStart,to:i?e.posBefore(i):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(Pi)!=t.state.facet(Pi)&&(t.view.contentDOM.editContext=t.state.facet(Pi)?this.editContext.editContext:null))}destroy(){var t,e,n;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Rs(t,e,n){for(;e;){let i=bn.get(e);if(i&&i.parent==t)return i;let r=e.parentNode;e=r!=t.dom?r:n>0?e.nextSibling:e.previousSibling}return null}function Bs(t,e){let n=e.startContainer,i=e.startOffset,r=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor);return Je(o.node,o.offset,r,s)&&([n,i,r,s]=[r,s,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}}class Is{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let e=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=n=>{let i=t.state.selection.main,{anchor:r,head:s}=i,o=this.toEditorPos(n.updateRangeStart),l=this.toEditorPos(n.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:o,drifted:!1});let a=l-o>n.text.length;o==this.from&&r<this.from?o=r:l==this.to&&r>this.to&&(l=r);let h=yr(t.state.sliceDoc(o,l),n.text,(a?i.from:i.to)-o,a?"end":null);if(!h){let e=bt.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));return void(e.main.eq(i)||t.dispatch({selection:e,userEvent:"select"}))}let c={from:h.from+o,to:h.toA+o,insert:K.of(n.text.slice(h.from,h.toB).split("\n"))};if((Ue.mac||Ue.android)&&c.from==s-1&&/^\. ?$/.test(n.text)&&"off"==t.contentDOM.getAttribute("autocorrect")&&(c={from:o,to:l,insert:K.of([n.text.replace("."," ")])}),this.pendingContextChange=c,!t.state.readOnly){let e=this.to-this.from+(c.to-c.from+c.insert.length);br(t,c,bt.single(this.toEditorPos(n.selectionStart,e),this.toEditorPos(n.selectionEnd,e)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),c.from<c.to&&!c.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(e.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(e.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let i=[],r=null;for(let e=this.toEditorPos(n.rangeStart),s=this.toEditorPos(n.rangeEnd);e<s;e++){let n=t.coordsForChar(e);r=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||r||new DOMRect,i.push(r)}e.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=e=>{let n=[];for(let t of e.getTextFormats()){let e=t.underlineStyle,i=t.underlineThickness;if(!/none/i.test(e)&&!/none/i.test(i)){let r=this.toEditorPos(t.rangeStart),s=this.toEditorPos(t.rangeEnd);if(r<s){let t=`text-decoration: underline ${/^[a-z]/.test(e)?e+" ":"Dashed"==e?"dashed ":"Squiggle"==e?"wavy ":""}${/thin/i.test(i)?1:2}px`;n.push(Fn.mark({attributes:{style:t}}).range(r,s))}}}t.dispatch({effects:Mi.of(Fn.set(n))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:e}=this.composing;this.composing=null,e&&this.reset(t.state)}};for(let t in this.handlers)e.addEventListener(t,this.handlers[t]);this.measureReq={read:t=>{this.editContext.updateControlBounds(t.contentDOM.getBoundingClientRect());let e=Ke(t.root);e&&e.rangeCount&&this.editContext.updateSelectionBounds(e.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,n=!1,i=this.pendingContextChange;return t.changes.iterChanges((r,s,o,l,a)=>{if(n)return;let h=a.length-(s-r);if(i&&s>=i.to){if(i.from==r&&i.to==s&&i.insert.eq(a))return i=this.pendingContextChange=null,e+=h,void(this.to+=h);i=null,this.revertPending(t.state)}if(r+=e,(s+=e)<=this.from)this.from+=h,this.to+=h;else if(r<this.to){if(r<this.from||s>this.to||this.to-this.from+a.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(r),this.toContextPos(s),a.toString()),this.to+=h}e+=h}),i&&!n&&this.revertPending(t.state),!n}update(t){let e=this.pendingContextChange,n=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(n.from,n.to)&&t.transactions.some(t=>!t.isUserEvent("input.type")&&t.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):this.applyEdits(t)&&this.rangeIsValid(t.state)?(t.docChanged||t.selectionSet||e)&&this.setSelection(t.state):(this.pendingContextChange=null,this.reset(t.state)),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.from+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),i=this.toContextPos(e.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==i||this.editContext.updateSelection(n,i)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to<t.doc.length&&this.to-e<500||this.to-this.from>3e4)}toEditorPos(t,e=this.to-this.from){t=Math.min(t,e);let n=this.composing;return n&&n.drifted?n.editorBase+(t-n.contextBase):t+this.from}toContextPos(t){let e=this.composing;return e&&e.drifted?e.contextBase+(t-e.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class Ns{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&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var 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),t.parent&&t.parent.appendChild(this.dom);let{dispatch:n}=t;this.dispatchTransactions=t.dispatchTransactions||n&&(t=>t.forEach(t=>n(t,this)))||(t=>this.update(t)),this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(t.parent)||document,this.viewState=new gs(t.state||re.create(t)),t.scrollTo&&t.scrollTo.is(Oi)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ri).map(t=>new Ii(t));for(let t of this.plugins)t.update(this);this.observer=new Ds(this),this.inputState=new wr(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Gi(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(e=document.fonts)||void 0===e?void 0:e.ready)&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...t){let e=1==t.length&&t[0]instanceof Gt?t:1==t.length&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e,n=!1,i=!1,r=this.state;for(let e of t){if(e.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=e.state}if(this.destroyed)return void(this.viewState.state=r);let s=this.hasFocus,o=0,l=null;t.some(t=>t.annotation($r))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=qr(r,s),l||(o=1));let a=this.observer.delayedAndroidKey,h=null;if(a?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(h=null)):this.observer.clear(),r.facet(re.phrases)!=this.state.facet(re.phrases))return this.setState(r);e=Ki.create(this,r,t),e.flags|=o;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let e of t){if(c&&(c=c.map(e.changes)),e.scrollIntoView){let{main:t}=e.state.selection;c=new Ti(t.empty?t:bt.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(Oi)&&(c=t.value.clip(this.state))}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),n=this.docView.update(e),this.state.facet(qi)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(t=>t.isUserEvent("select.pointer")))}finally{this.updateState=0}if(e.startState.facet(ks)!=e.state.facet(ks)&&(this.viewState.mustMeasureContent=!0),(n||i||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!e.empty)for(let t of this.state.facet(yi))try{t(e)}catch(t){_i(this.state,t,"update listener")}(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!vr(this,h)&&a.force&&un(this.contentDOM,a.key,a.keyCode)})}setState(t){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=t);this.updateState=2;let e=this.hasFocus;try{for(let t of this.plugins)t.destroy(this);this.viewState=new gs(t),this.plugins=t.facet(Ri).map(t=>new Ii(t)),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView.destroy(),this.docView=new Gi(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Ri),n=t.state.facet(Ri);if(e!=n){let i=[];for(let r of n){let n=e.indexOf(r);if(n<0)i.push(new Ii(r));else{let e=this.plugins[n];e.mustUpdate=t,i.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let e of this.plugins)e.mustUpdate=t;for(let t=0;t<this.plugins.length;t++)this.plugins[t].update(this);e!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let e=t.value;if(e&&e.docViewUpdate)try{e.docViewUpdate(this)}catch(t){_i(this.state,t,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,n=this.scrollDOM,i=n.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:s}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let t=0;;t++){if(s<0)if(fn(n))r=-1,s=this.viewState.heightMap.height;else{let t=this.viewState.scrollAnchorAt(i);r=t.from,s=t.top}this.updateState=1;let o=this.viewState.measure(this);if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(t>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&o||([this.measureRequests,l]=[l,this.measureRequests]);let a=l.map(t=>{try{return t.read(this)}catch(t){return _i(this.state,t),Fs}}),h=Ki.create(this,this.state,[]),c=!1;h.flags|=o,e?e.flags|=o:e=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),c=this.docView.update(h),c&&this.docViewUpdate());for(let t=0;t<l.length;t++)if(a[t]!=Fs)try{let e=l[t];e.write&&e.write(a[t],this)}catch(t){_i(this.state,t)}if(c&&this.docView.updateSelection(!0),!h.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}{let t=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-s;if(t>1||t<-1){i+=t,n.scrollTop=i/this.scaleY,s=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(yi))t(e)}get themeClasses(){return Ss+" "+(this.state.facet(As)?Es:Cs)+" "+this.state.facet(ks)}updateAttrs(){let t=zs(this,Ni,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Pi)?"true":"false",class:"cm-content",style:`${Ue.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),zs(this,Li,e);let n=this.observer.ignore(()=>{let n=Bn(this.contentDOM,this.contentAttrs,e),i=Bn(this.dom,this.editorAttrs,t);return n||i});return this.editorAttrs=t,this.contentAttrs=e,n}showAnnouncements(t){let e=!0;for(let n of t)for(let t of n.effects)t.is(Ns.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value)}mountStyles(){this.styleModules=this.state.facet(qi);let t=this.state.facet(Ns.cspNonce);Ee.mount(this.root,this.styleModules.concat(Ms).reverse(),t?{nonce:t}: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(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(let e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===t.key)return void(this.measureRequests[e]=t);this.measureRequests.push(t)}}plugin(t){let e=this.pluginMap.get(t);return(void 0===e||e&&e.plugin!=t)&&this.pluginMap.set(t,e=this.plugins.find(e=>e.plugin==t)||null),e&&e.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(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,n){return cr(this,t,lr(this,t,e,n))}moveByGroup(t,e){return cr(this,t,lr(this,t,e,e=>function(t,e,n){let i=t.state.charCategorizer(e),r=i(n);return t=>{let e=i(t);return r==ee.Space&&(r=e),r==e}}(this,t.head,e)))}visualLineSide(t,e){let n=this.bidiSpans(t),i=this.textDirectionAt(t.from),r=n[e?n.length-1:0];return bt.cursor(r.side(e,i)+t.from,r.forward(!e,i)?1:-1)}moveToLineBoundary(t,e,n=!0){return function(t,e,n,i){let r=function(t,e,n){let i=t.lineBlockAt(e);if(Array.isArray(i.type)){let t;for(let r of i.type){if(r.from>e)break;if(!(r.to<e)){if(r.from<e&&r.to>e)return r;t&&(r.type!=Ln.Text||t.type==r.type&&!(n<0?r.from<e:r.to>e))||(t=r)}}return t||i}return i}(t,e.head,e.assoc||-1),s=i&&r.type==Ln.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(s){let e=t.dom.getBoundingClientRect(),i=t.textDirectionAt(r.from),o=t.posAtCoords({x:n==(i==Qn.LTR)?e.right-1:e.left+1,y:(s.top+s.bottom)/2});if(null!=o)return bt.cursor(o,n?-1:1)}return bt.cursor(n?r.to:r.from,n?-1:1)}(this,t,e,n)}moveVertically(t,e,n){return cr(this,t,function(t,e,n,i){let r=e.head,s=n?1:-1;if(r==(n?t.state.doc.length:0))return bt.cursor(r,e.assoc);let o,l=e.goalColumn,a=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(r,e.assoc||-1),c=t.documentTop;if(h)null==l&&(l=h.left-a.left),o=s<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(r);null==l&&(l=Math.min(a.right-a.left,t.defaultCharacterWidth*(r-e.from))),o=(s<0?e.top:e.bottom)+c}let u=a.left+l,d=null!=i?i:t.viewState.heightOracle.textHeight>>1;for(let e=0;;e+=10){let n=o+(d+e)*s,i=rr(t,{x:u,y:n},!1,s);if(n<a.top||n>a.bottom||(s<0?i<r:i>r)){let e=t.docView.coordsForChar(i),r=!e||n<e.top?-1:1;return bt.cursor(i,r,void 0,l)}}}(this,t,e,n))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),rr(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let n=this.docView.coordsAt(t,e);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(t),r=this.bidiSpans(i);return nn(n,r[oi.find(r,t-i.from,-1,e)].dir==Qn.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(Si)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Ls)return ui(t.length);let e,n=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==n&&(i.fresh||li(i.isolates,e=Hi(this,t))))return i.order;e||(e=Hi(this,t));let i=function(t,e,n){if(!t)return[new oi(0,0,e==Xn?1:0)];if(e==Jn&&!n.length&&!si.test(t))return ui(t.length);if(n.length)for(;t.length>ai.length;)ai[ai.length]=256;let i=[],r=e==Jn?0:1;return ci(t,r,r,n,0,t.length,i),i}(t.text,n,e);return this.bidiCache.push(new Vs(t.from,t.to,n,e,!0,i)),i}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Ue.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{hn(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.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(t,e={}){return Oi.of(new Ti("number"==typeof t?bt.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,n=this.viewState.scrollAnchorAt(t);return Oi.of(new Ti(bt.cursor(n.from),"start","start",n.top-t,e,!0))}setTabFocusMode(t){null==t?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof t?this.inputState.tabFocusMode=t?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return Bi.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Bi.define(()=>({}),{eventObservers:t})}static theme(t,e){let n=Ee.newName(),i=[ks.of(n),qi.of(Os(`.${n}`,t))];return e&&e.dark&&i.push(As.of(!0)),i}static baseTheme(t){return _t.lowest(qi.of(Os("."+Ss,t,Ts)))}static findFromDOM(t){var e;let n=t.querySelector(".cm-content"),i=n&&bn.get(n)||bn.get(t);return(null===(e=null==i?void 0:i.rootView)||void 0===e?void 0:e.view)||null}}Ns.styleModule=qi,Ns.inputHandler=wi,Ns.clipboardInputFilter=ki,Ns.clipboardOutputFilter=Ai,Ns.scrollHandler=Ei,Ns.focusChangeEffect=xi,Ns.perLineTextDirection=Si,Ns.exceptionSink=bi,Ns.updateListener=yi,Ns.editable=Pi,Ns.mouseSelectionStyle=vi,Ns.dragMovesSelection=mi,Ns.clickAddsSelectionRange=gi,Ns.decorations=Fi,Ns.outerDecorations=Vi,Ns.atomicRanges=zi,Ns.bidiIsolatedRanges=ji,Ns.scrollMargins=Wi,Ns.darkTheme=As,Ns.cspNonce=xt.define({combine:t=>t.length?t[0]:""}),Ns.contentAttributes=Li,Ns.editorAttributes=Ni,Ns.lineWrapping=Ns.contentAttributes.of({class:"cm-lineWrapping"}),Ns.announce=Kt.define();const Ls=4096,Fs={};class Vs{constructor(t,e,n,i,r,s){this.from=t,this.to=e,this.dir=n,this.isolates=i,this.fresh=r,this.order=s}static update(t,e){if(e.empty&&!t.some(t=>t.fresh))return t;let n=[],i=t.length?t[t.length-1].dir:Qn.LTR;for(let r=Math.max(0,t.length-10);r<t.length;r++){let s=t[r];s.dir!=i||e.touchesRange(s.from,s.to)||n.push(new Vs(e.mapPos(s.from,1),e.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return n}}function zs(t,e,n){for(let i=t.state.facet(e),r=i.length-1;r>=0;r--){let e=i[r],s="function"==typeof e?e(t):e;s&&Pn(s,n)}return n}const js=Ue.mac?"mac":Ue.windows?"win":Ue.linux?"linux":"key";function Hs(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}const Ws=_t.default(Ns.domEventHandlers({keydown:(t,e)=>function(t,e,n,i){Gs=e;let r=function(t){var e=!(Pe&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||De&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?_e:Me)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(e),s=ot(rt(r,0))==r.length&&" "!=r,o="",l=!1,a=!1,h=!1;Us&&Us.view==n&&Us.scope==i&&(o=Us.prefix+" ",Cr.indexOf(e.keyCode)<0&&(a=!0,Us=null));let c,u,d=new Set,f=t=>{if(t){for(let e of t.run)if(!d.has(e)&&(d.add(e),e(n)))return t.stopPropagation&&(h=!0),!0;t.preventDefault&&(t.stopPropagation&&(h=!0),a=!0)}return!1},p=t[i];return p&&(f(p[o+Hs(r,e,!s)])?l=!0:!s||!(e.altKey||e.metaKey||e.ctrlKey)||Ue.windows&&e.ctrlKey&&e.altKey||Ue.mac&&e.altKey&&!e.ctrlKey&&!e.metaKey||!(c=Me[e.keyCode])||c==r?s&&e.shiftKey&&f(p[o+Hs(r,e,!0)])&&(l=!0):(f(p[o+Hs(c,e,!0)])||e.shiftKey&&(u=_e[e.keyCode])!=r&&u!=c&&f(p[o+Hs(u,e,!1)]))&&(l=!0),!l&&f(p._any)&&(l=!0)),a&&(l=!0),l&&h&&e.stopPropagation(),Gs=null,l}(function(t){let e=t.facet($s),n=qs.get(e);return n||qs.set(e,n=function(t,e=js){let n=Object.create(null),i=Object.create(null),r=(t,e)=>{let n=i[t];if(null==n)i[t]=e;else if(n!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},s=(t,i,s,o,l)=>{var a,h;let c=n[t]||(n[t]=Object.create(null)),u=i.split(/ (?!$)/).map(t=>function(t,e){const n=t.split(/-(?!$)/);let i,r,s,o,l=n[n.length-1];"Space"==l&&(l=" ");for(let t=0;t<n.length-1;++t){const l=n[t];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))i=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))s=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);"mac"==e?o=!0:r=!0}}return i&&(l="Alt-"+l),r&&(l="Ctrl-"+l),o&&(l="Meta-"+l),s&&(l="Shift-"+l),l}(t,e));for(let e=1;e<u.length;e++){let n=u.slice(0,e).join(" ");r(n,!0),c[n]||(c[n]={preventDefault:!0,stopPropagation:!1,run:[e=>{let i=Us={view:e,prefix:n,scope:t};return setTimeout(()=>{Us==i&&(Us=null)},Ks),!0}]})}let d=u.join(" ");r(d,!1);let f=c[d]||(c[d]={preventDefault:!1,stopPropagation:!1,run:(null===(h=null===(a=c._any)||void 0===a?void 0:a.run)||void 0===h?void 0:h.slice())||[]});s&&f.run.push(s),o&&(f.preventDefault=!0),l&&(f.stopPropagation=!0)};for(let i of t){let t=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let e of t){let t=n[e]||(n[e]=Object.create(null));t._any||(t._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:r}=i;for(let e in t)t[e].run.push(t=>r(t,Gs))}let r=i[e]||i.key;if(r)for(let e of t)s(e,r,i.run,i.preventDefault,i.stopPropagation),i.shift&&s(e,"Shift-"+r,i.shift,i.preventDefault,i.stopPropagation)}return n}(e.reduce((t,e)=>t.concat(e),[]))),n}(e.state),t,e,"editor")})),$s=xt.define({enables:Ws}),qs=new WeakMap;let Us=null;const Ks=4e3;let Gs=null;class Ys extends Nn{constructor(t){super(),this.content=t}toDOM(t){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(t):this.content.cloneNode(!0)),e.setAttribute("aria-hidden","true"),e}coordsAt(t){let e=t.firstChild?Qe(t.firstChild):[];if(!e.length)return null;let n=window.getComputedStyle(t.parentNode),i=nn(e[0],"rtl"!=n.direction),r=parseInt(n.lineHeight);return i.bottom-i.top>1.5*r?{left:i.left,right:i.right,top:i.top,bottom:i.top+r}:i}ignoreEvent(){return!1}}function Qs(t){let e=Bi.fromClass(class{constructor(e){this.view=e,this.placeholder=t?Fn.set([Fn.widget({widget:new Ys(t),side:1}).range(0)]):Fn.none}get decorations(){return this.view.state.doc.length?Fn.none:this.placeholder}},{decorations:t=>t.decorations});return"string"==typeof t?[e,Ns.contentAttributes.of({"aria-placeholder":t})]:e}const Js="-10000px";class Xs{constructor(t,e,n,i){this.facet=e,this.createTooltipView=n,this.removeTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter(t=>t);let r=null;this.tooltipViews=this.tooltips.map(t=>r=n(t,r))}update(t,e){var n;let i=t.state.facet(this.facet),r=i.filter(t=>t);if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[],o=e?[]:null;for(let n=0;n<r.length;n++){let i=r[n],l=-1;if(i){for(let t=0;t<this.tooltips.length;t++){let e=this.tooltips[t];e&&e.create==i.create&&(l=t)}if(l<0)s[n]=this.createTooltipView(i,n?s[n-1]:null),o&&(o[n]=!!i.above);else{let i=s[n]=this.tooltipViews[l];o&&(o[n]=e[l]),i.update&&i.update(t)}}}for(let t of this.tooltipViews)s.indexOf(t)<0&&(this.removeTooltipView(t),null===(n=t.destroy)||void 0===n||n.call(t));return e&&(o.forEach((t,n)=>e[n]=t),e.length=o.length),this.input=i,this.tooltips=r,this.tooltipViews=s,!0}}function Zs(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const to=xt.define({combine:t=>{var e,n,i;return{position:Ue.ios?"absolute":(null===(e=t.find(t=>t.position))||void 0===e?void 0:e.position)||"fixed",parent:(null===(n=t.find(t=>t.parent))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=t.find(t=>t.tooltipSpace))||void 0===i?void 0:i.tooltipSpace)||Zs}}}),eo=new WeakMap,no=Bi.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(to);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Xs(t,oo,(t,e)=>this.createTooltip(t,e),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.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 t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,i=t.state.facet(to);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),i=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",n.dom.appendChild(t)}return n.dom.style.position=this.position,n.dom.style.top=Js,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);this.parent&&this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:t}=this.manager.tooltipViews[0];if(Ue.safari){let e=t.getBoundingClientRect();n=Math.abs(e.top+1e4)>1||Math.abs(e.left)>1}else n=!!t.offsetParent&&t.offsetParent!=this.container.ownerDocument.body}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(t=n.width/this.parent.offsetWidth,e=n.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=$i(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((t,e)=>{let n=this.manager.tooltipViews[e];return n.getCoords?n.getCoords(t.pos):this.view.coordsAtPos(t.pos)}),size:this.manager.tooltipViews.map(({dom:t})=>t.getBoundingClientRect()),space:this.view.state.facet(to).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let t of this.manager.tooltipViews)t.dom.style.position="absolute"}let{visible:n,space:i,scaleX:r,scaleY:s}=t,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],h=this.manager.tooltipViews[l],{dom:c}=h,u=t.pos[l],d=t.size[l];if(!u||!1!==a.clip&&(u.bottom<=Math.max(n.top,i.top)||u.top>=Math.min(n.bottom,i.bottom)||u.right<Math.max(n.left,i.left)-.1||u.left>Math.min(n.right,i.right)+.1)){c.style.top=Js;continue}let f=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=d.right-d.left,m=null!==(e=eo.get(h))&&void 0!==e?e:d.bottom-d.top,v=h.offset||so,b=this.view.textDirection==Qn.LTR,y=d.width>i.right-i.left?b?i.left:i.right-d.width:b?Math.max(i.left,Math.min(u.left-(f?14:0)+v.x,i.right-g)):Math.min(Math.max(i.left,u.left-g+(f?14:0)-v.x),i.right-g),w=this.above[l];!a.strictSide&&(w?u.top-m-p-v.y<i.top:u.bottom+m+p+v.y>i.bottom)&&w==i.bottom-u.bottom>u.top-i.top&&(w=this.above[l]=!w);let x=(w?u.top-i.top:i.bottom-u.bottom)-p;if(x<m&&!1!==h.resize){if(x<this.view.defaultLineHeight){c.style.top=Js;continue}eo.set(h,m),c.style.height=(m=x)/s+"px"}else c.style.height&&(c.style.height="");let k=w?u.top-m-p-v.y:u.bottom+p+v.y,A=y+g;if(!0!==h.overlap)for(let t of o)t.left<A&&t.right>y&&t.top<k+m&&t.bottom>k&&(k=w?t.top-m-2-p:t.bottom+p+2);if("absolute"==this.position?(c.style.top=(k-t.parent.top)/s+"px",io(c,(y-t.parent.left)/r)):(c.style.top=k/s+"px",io(c,y/r)),f){let t=u.left+(b?v.x:-v.x)-(y+14-7);f.style.left=t/r+"px"}!0!==h.overlap&&o.push({left:y,top:k,right:A,bottom:k+m}),c.classList.toggle("cm-tooltip-above",w),c.classList.toggle("cm-tooltip-below",!w),h.positioned&&h.positioned(t.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 t of this.manager.tooltipViews)t.dom.style.top=Js}},{eventObservers:{scroll(){this.maybeMeasure()}}});function io(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const ro=Ns.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),so={x:0,y:0},oo=xt.define({enables:[no,ro]}),lo=xt.define({combine:t=>t.reduce((t,e)=>t.concat(e),[])});class ao{static create(t){return new ao(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Xs(t,lo,(t,e)=>this.createHostedView(t,e),t=>t.dom.remove())}createHostedView(t,e){let n=t.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)null===(t=e.destroy)||void 0===t||t.call(e)}passProp(t){let e;for(let n of this.manager.tooltipViews){let i=n[t];if(void 0!==i)if(void 0===e)e=i;else if(e!==i)return}return e}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 ho=oo.compute([lo],t=>{let e=t.facet(lo);return 0===e.length?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var e;return null!==(e=t.end)&&void 0!==e?e:t.pos})),create:ao.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class co{constructor(t,e,n,i,r){this.view=t,this.source=e,this.field=n,this.setHover=i,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:t,lastMove:e}=this,n=t.docView.nearest(e.target);if(!n)return;let i,r=1;if(n instanceof Cn)i=n.posAtStart;else{if(i=t.posAtCoords(e),null==i)return;let n=t.coordsAtPos(i);if(!n||e.y<n.top||e.y>n.bottom||e.x<n.left-t.defaultCharacterWidth||e.x>n.right+t.defaultCharacterWidth)return;let s=t.bidiSpans(t.state.doc.lineAt(i)).find(t=>t.from<=i&&t.to>=i),o=s&&s.dir==Qn.RTL?-1:1;r=e.x<n.left?-o:o}let s=this.source(t,i,r);if(null==s?void 0:s.then){let e=this.pending={pos:i};s.then(n=>{this.pending==e&&(this.pending=null,!n||Array.isArray(n)&&!n.length||t.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))},e=>_i(t.state,e,"hover tooltip"))}else!s||Array.isArray(s)&&!s.length||t.dispatch({effects:this.setHover.of(Array.isArray(s)?s:[s])})}get tooltip(){let t=this.view.plugin(no),e=t?t.manager.tooltips.findIndex(t=>t.create==ao.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,n;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:r}=this;if(i.length&&r&&!function(t,e){let n,{left:i,right:r,top:s,bottom:o}=t.getBoundingClientRect();if(n=t.querySelector(".cm-tooltip-arrow")){let t=n.getBoundingClientRect();s=Math.min(t.top,s),o=Math.max(t.bottom,o)}return e.clientX>=i-uo&&e.clientX<=r+uo&&e.clientY>=s-uo&&e.clientY<=o+uo}(r.dom,t)||this.pending){let{pos:r}=i[0]||this.pending,s=null!==(n=null===(e=i[0])||void 0===e?void 0:e.end)&&void 0!==n?n:r;(r==s?this.view.posAtCoords(this.lastMove)==r:function(t,e,n,i,r){let s=t.scrollDOM.getBoundingClientRect(),o=t.documentTop+t.documentPadding.top+t.contentHeight;if(s.left>i||s.right<i||s.top>r||Math.min(s.bottom,o)<r)return!1;let l=t.posAtCoords({x:i,y:r},!1);return l>=e&&l<=n}(this.view,r,s,t.clientX,t.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:e}=this;e&&e.dom.contains(t.relatedTarget)?this.watchTooltipLeave(e.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=n=>{t.removeEventListener("mouseleave",e),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",e)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const uo=4;function fo(t,e={}){let n=Kt.define(),i=Ot.define({create:()=>[],update(t,i){if(t.length&&(e.hideOnChange&&(i.docChanged||i.selection)?t=[]:e.hideOn&&(t=t.filter(t=>!e.hideOn(i,t))),i.docChanged)){let e=[];for(let n of t){let t=i.changes.mapPos(n.pos,-1,at.TrackDel);if(null!=t){let r=Object.assign(Object.create(null),n);r.pos=t,null!=r.end&&(r.end=i.changes.mapPos(r.end)),e.push(r)}}t=e}for(let e of i.effects)e.is(n)&&(t=e.value),e.is(go)&&(t=[]);return t},provide:t=>lo.from(t)});return{active:i,extension:[i,Bi.define(r=>new co(r,t,i,n,e.hoverTime||300)),ho]}}function po(t,e){let n=t.plugin(no);if(!n)return null;let i=n.manager.tooltips.indexOf(e);return i<0?null:n.manager.tooltipViews[i]}const go=Kt.define(),mo=xt.define({combine(t){let e,n;for(let i of t)e=e||i.topContainer,n=n||i.bottomContainer;return{topContainer:e,bottomContainer:n}}}),vo=Bi.fromClass(class{constructor(t){this.input=t.state.facet(wo),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(e=>e(t));let e=t.state.facet(mo);this.top=new bo(t,!0,e.topContainer),this.bottom=new bo(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(t){let e=t.state.facet(mo);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new bo(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new bo(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(wo);if(n!=this.input){let e=n.filter(t=>t),i=[],r=[],s=[],o=[];for(let n of e){let e,l=this.specs.indexOf(n);l<0?(e=n(t.view),o.push(e)):(e=this.panels[l],e.update&&e.update(t)),i.push(e),(e.top?r:s).push(e)}this.specs=e,this.panels=i,this.top.sync(r),this.bottom.sync(s);for(let t of o)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}else for(let e of this.panels)e.update&&e.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Ns.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class bo{constructor(t,e,n){this.view=t,this.top=e,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,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 t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=yo(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=yo(t)}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 t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function yo(t){let e=t.nextSibling;return t.remove(),e}const wo=xt.define({enables:vo});class xo extends oe{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}xo.prototype.elementClass="",xo.prototype.toDOM=void 0,xo.prototype.mapMode=at.TrackBefore,xo.prototype.startSide=xo.prototype.endSide=-1,xo.prototype.point=!0;const ko=1024;let Ao=0;class So{constructor(t,e){this.from=t,this.to=e}}class Co{constructor(t={}){this.id=Ao++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=Oo.match(t)),e=>{let n=t(e);return void 0===n?null:[this,n]}}}Co.closedBy=new Co({deserialize:t=>t.split(" ")}),Co.openedBy=new Co({deserialize:t=>t.split(" ")}),Co.group=new Co({deserialize:t=>t.split(" ")}),Co.isolate=new Co({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),Co.contextHash=new Co({perNode:!0}),Co.lookAhead=new Co({perNode:!0}),Co.mounted=new Co({perNode:!0});class Eo{constructor(t,e,n){this.tree=t,this.overlay=e,this.parser=n}static get(t){return t&&t.props&&t.props[Co.mounted.id]}}const To=Object.create(null);class Oo{constructor(t,e,n,i=0){this.name=t,this.props=e,this.id=n,this.flags=i}static define(t){let e=t.props&&t.props.length?Object.create(null):To,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),i=new Oo(t.name||"",e,t.id,n);if(t.props)for(let n of t.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[n[0].id]=n[1]}return i}prop(t){return this.props[t.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(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(Co.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let n in t)for(let i of n.split(" "))e[i]=t[n];return t=>{for(let n=t.prop(Co.group),i=-1;i<(n?n.length:0);i++){let r=e[i<0?t.name:n[i]];if(r)return r}}}}Oo.none=new Oo("",Object.create(null),0,8);class Mo{constructor(t){this.types=t;for(let e=0;e<t.length;e++)if(t[e].id!=e)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let e=[];for(let n of this.types){let i=null;for(let e of t){let t=e(n);t&&(i||(i=Object.assign({},n.props)),i[t[0].id]=t[1])}e.push(i?new Oo(n.name,i,n.id,n.flags):n)}return new Mo(e)}}const _o=new WeakMap,Po=new WeakMap;var Do;!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(Do||(Do={}));class Ro{constructor(t,e,n,i,r){if(this.type=t,this.children=e,this.positions=n,this.length=i,this.props=null,r&&r.length){this.props=Object.create(null);for(let[t,e]of r)this.props["number"==typeof t?t:t.id]=e}}toString(){let t=Eo.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let t of this.children){let n=t.toString();n&&(e&&(e+=","),e+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e}cursor(t=0){return new Uo(this.topNode,t)}cursorAt(t,e=0,n=0){let i=_o.get(this)||this.topNode,r=new Uo(i);return r.moveTo(t,e),_o.set(this,r._tree),r}get topNode(){return new Vo(this,0,0,null)}resolve(t,e=0){let n=Lo(_o.get(this)||this.topNode,t,e,!1);return _o.set(this,n),n}resolveInner(t,e=0){let n=Lo(Po.get(this)||this.topNode,t,e,!0);return Po.set(this,n),n}resolveStack(t,e=0){return function(t,e,n){let i=t.resolveInner(e,n),r=null;for(let t=i instanceof Vo?i:i.context.parent;t;t=t.parent)if(t.index<0){let s=t.parent;(r||(r=[i])).push(s.resolve(e,n)),t=s}else{let s=Eo.get(t.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let o=new Vo(s.tree,s.overlay[0].from+t.from,-1,t);(r||(r=[i])).push(Lo(o,e,n,!1))}}return r?$o(r):i}(this,t,e)}iterate(t){let{enter:e,leave:n,from:i=0,to:r=this.length}=t,s=t.mode||0,o=(s&Do.IncludeAnonymous)>0;for(let t=this.cursor(s|Do.IncludeAnonymous);;){let s=!1;if(t.from<=r&&t.to>=i&&(!o&&t.type.isAnonymous||!1!==e(t))){if(t.firstChild())continue;s=!0}for(;s&&n&&(o||!t.type.isAnonymous)&&n(t),!t.nextSibling();){if(!t.parent())return;s=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Qo(Oo.none,this.children,this.positions,0,this.children.length,0,this.length,(t,e,n)=>new Ro(this.type,t,e,n,this.propValues),t.makeTree||((t,e,n)=>new Ro(Oo.none,t,e,n)))}static build(t){return function(t){var e;let{buffer:n,nodeSet:i,maxBufferLength:r=ko,reused:s=[],minRepeatType:o=i.types.length}=t,l=Array.isArray(n)?new Bo(n,n.length):n,a=i.types,h=0,c=0;function u(t,e,n,m,v,b){let{id:y,start:w,end:x,size:k}=l,A=c,S=h;for(;k<0;){if(l.next(),-1==k){let e=s[y];return n.push(e),void m.push(w-t)}if(-3==k)return void(h=y);if(-4==k)return void(c=y);throw new RangeError(`Unrecognized record size: ${k}`)}let C,E,T=a[y],O=w-t;if(x-w<=r&&(E=function(t,e){let n=l.fork(),i=0,s=0,a=0,h=n.end-r,c={size:0,start:0,skip:0};t:for(let r=n.pos-t;n.pos>r;){let t=n.size;if(n.id==e&&t>=0){c.size=i,c.start=s,c.skip=a,a+=4,i+=4,n.next();continue}let l=n.pos-t;if(t<0||l<r||n.start<h)break;let u=n.id>=o?4:0,d=n.start;for(n.next();n.pos>l;){if(n.size<0){if(-3!=n.size)break t;u+=4}else n.id>=o&&(u+=4);n.next()}s=d,i+=t,a+=u}return(e<0||i==t)&&(c.size=i,c.start=s,c.skip=a),c.size>4?c:void 0}(l.pos-e,v))){let e=new Uint16Array(E.size-E.skip),n=l.pos-E.size,r=e.length;for(;l.pos>n;)r=g(E.start,e,r);C=new Io(e,x-E.start,i),O=E.start-t}else{let t=l.pos-k;l.next();let e=[],n=[],i=y>=o?y:-1,s=0,a=x;for(;l.pos>t;)i>=0&&l.id==i&&l.size>=0?(l.end<=a-r&&(f(e,n,w,s,l.end,a,i,A,S),s=e.length,a=l.end),l.next()):b>2500?d(w,t,e,n):u(w,t,e,n,i,b+1);if(i>=0&&s>0&&s<e.length&&f(e,n,w,s,w,a,i,A,S),e.reverse(),n.reverse(),i>-1&&s>0){let t=function(t,e){return(n,i,r)=>{let s,o,l=0,a=n.length-1;if(a>=0&&(s=n[a])instanceof Ro){if(!a&&s.type==t&&s.length==r)return s;(o=s.prop(Co.lookAhead))&&(l=i[a]+s.length+o)}return p(t,n,i,r,l,e)}}(T,S);C=Qo(T,e,n,0,e.length,0,x-w,t,t)}else C=p(T,e,n,x-w,A-x,S)}n.push(C),m.push(O)}function d(t,e,n,s){let o=[],a=0,h=-1;for(;l.pos>e;){let{id:t,start:e,end:n,size:i}=l;if(i>4)l.next();else{if(h>-1&&e<h)break;h<0&&(h=n-r),o.push(t,e,n),a++,l.next()}}if(a){let e=new Uint16Array(4*a),r=o[o.length-2];for(let t=o.length-3,n=0;t>=0;t-=3)e[n++]=o[t],e[n++]=o[t+1]-r,e[n++]=o[t+2]-r,e[n++]=n;n.push(new Io(e,o[2]-r,i)),s.push(r-t)}}function f(t,e,n,r,s,o,l,a,h){let c=[],u=[];for(;t.length>r;)c.push(t.pop()),u.push(e.pop()+n-s);t.push(p(i.types[l],c,u,o-s,a-o,h)),e.push(s-n)}function p(t,e,n,i,r,s,o){if(s){let t=[Co.contextHash,s];o=o?[t].concat(o):[t]}if(r>25){let t=[Co.lookAhead,r];o=o?[t].concat(o):[t]}return new Ro(t,e,n,i,o)}function g(t,e,n){let{id:i,start:r,end:s,size:a}=l;if(l.next(),a>=0&&i<o){let o=n;if(a>4){let i=l.pos-(a-4);for(;l.pos>i;)n=g(t,e,n)}e[--n]=o,e[--n]=s-t,e[--n]=r-t,e[--n]=i}else-3==a?h=i:-4==a&&(c=i);return n}let m=[],v=[];for(;l.pos>0;)u(t.start||0,t.bufferStart||0,m,v,-1,0);let b=null!==(e=t.length)&&void 0!==e?e:m.length?v[0]+m[0].length:0;return new Ro(a[t.topID],m.reverse(),v.reverse(),b)}(t)}}Ro.empty=new Ro(Oo.none,[],[],0);class Bo{constructor(t,e){this.buffer=t,this.index=e}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 Bo(this.buffer,this.index)}}class Io{constructor(t,e,n){this.buffer=t,this.length=e,this.set=n}get type(){return Oo.none}toString(){let t=[];for(let e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}childString(t){let e=this.buffer[t],n=this.buffer[t+3],i=this.set.types[e],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),n==(t+=4))return r;let s=[];for(;t<n;)s.push(this.childString(t)),t=this.buffer[t+3];return r+"("+s.join(",")+")"}findChild(t,e,n,i,r){let{buffer:s}=this,o=-1;for(let l=t;l!=e&&!(No(r,i,s[l+1],s[l+2])&&(o=l,n>0));l=s[l+3]);return o}slice(t,e,n){let i=this.buffer,r=new Uint16Array(e-t),s=0;for(let o=t,l=0;o<e;){r[l++]=i[o++],r[l++]=i[o++]-n;let e=r[l++]=i[o++]-n;r[l++]=i[o++]-t,s=Math.max(s,e)}return new Io(r,s,this.set)}}function No(t,e,n,i){switch(t){case-2:return n<e;case-1:return i>=e&&n<e;case 0:return n<e&&i>e;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function Lo(t,e,n,i){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let e=!i&&t instanceof Vo&&t.index<0?null:t.parent;if(!e)return t;t=e}let s=i?0:Do.IgnoreOverlays;if(i)for(let i=t,o=i.parent;o;i=o,o=i.parent)i instanceof Vo&&i.index<0&&(null===(r=o.enter(e,n,s))||void 0===r?void 0:r.from)!=i.from&&(t=o);for(;;){let i=t.enter(e,n,s);if(!i)return t;t=i}}class Fo{cursor(t=0){return new Uo(this,t)}getChild(t,e=null,n=null){let i=zo(this,t,e,n);return i.length?i[0]:null}getChildren(t,e=null,n=null){return zo(this,t,e,n)}resolve(t,e=0){return Lo(this,t,e,!1)}resolveInner(t,e=0){return Lo(this,t,e,!0)}matchContext(t){return jo(this.parent,t)}enterUnfinishedNodesBefore(t){let e=this.childBefore(t),n=this;for(;e;){let t=e.lastChild;if(!t||t.to!=e.to)break;t.type.isError&&t.from==t.to?(n=e,e=t.prevSibling):e=t}return n}get node(){return this}get next(){return this.parent}}class Vo extends Fo{constructor(t,e,n,i){super(),this._tree=t,this.from=e,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,e,n,i,r=0){for(let s=this;;){for(let{children:o,positions:l}=s._tree,a=e>0?o.length:-1;t!=a;t+=e){let a=o[t],h=l[t]+s.from;if(No(i,n,h,h+a.length))if(a instanceof Io){if(r&Do.ExcludeBuffers)continue;let o=a.findChild(0,a.buffer.length,e,n-h,i);if(o>-1)return new Wo(new Ho(s,a,t,h),null,o)}else if(r&Do.IncludeAnonymous||!a.type.isAnonymous||Ko(a)){let o;if(!(r&Do.IgnoreMounts)&&(o=Eo.get(a))&&!o.overlay)return new Vo(o.tree,h,t,s);let l=new Vo(a,h,t,s);return r&Do.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(e<0?a.children.length-1:0,e,n,i)}}if(r&Do.IncludeAnonymous||!s.type.isAnonymous)return null;if(t=s.index>=0?s.index+e:e<0?-1:s._parent._tree.children.length,s=s._parent,!s)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(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,n=0){let i;if(!(n&Do.IgnoreOverlays)&&(i=Eo.get(this._tree))&&i.overlay){let n=t-this.from;for(let{from:t,to:r}of i.overlay)if((e>0?t<=n:t<n)&&(e<0?r>=n:r>n))return new Vo(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}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 zo(t,e,n,i){let r=t.cursor(),s=[];if(!r.firstChild())return s;if(null!=n)for(let t=!1;!t;)if(t=r.type.is(n),!r.nextSibling())return s;for(;;){if(null!=i&&r.type.is(i))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return null==i?s:[]}}function jo(t,e,n=e.length-1){for(let i=t;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}class Ho{constructor(t,e,n,i){this.parent=t,this.buffer=e,this.index=n,this.start=i}}class Wo extends Fo{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(t,e,n){super(),this.context=t,this._parent=e,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}child(t,e,n){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.context.start,n);return r<0?null:new Wo(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,n=0){if(n&Do.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new Wo(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Wo(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new Wo(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:n}=this.context,i=this.index+4,r=n.buffer[this.index+3];if(r>i){let s=n.buffer[this.index+1];t.push(n.slice(i,r,s)),e.push(0)}return new Ro(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function $o(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;i<t.length;i++){let r=t[i];(r.from>n.from||r.to<n.to)&&(n=r,e=i)}let i=n instanceof Vo&&n.index<0?null:n.parent,r=t.slice();return i?r[e]=i:r.splice(e,1),new qo(r,n)}class qo{constructor(t,e){this.heads=t,this.node=e}get next(){return $o(this.heads)}}class Uo{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Vo)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:n,buffer:i}=this.buffer;return this.type=e||i.set.types[i.buffer[t]],this.from=n+i.buffer[t+1],this.to=n+i.buffer[t+2],!0}yield(t){return!!t&&(t instanceof Vo?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,n,this.mode));let{buffer:i}=this.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.buffer.start,n);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,n=this.mode){return this.buffer?!(n&Do.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Do.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Do.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,n=this.stack.length-1;if(t<0){let t=n<0?0:this.stack[n]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(n<0?e.buffer.length:e.buffer[this.stack[n]+3]))return this.yieldBuf(t)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,n,{buffer:i}=this;if(i){if(t>0){if(this.index<i.buffer.buffer.length)return!1}else for(let t=0;t<this.index;t++)if(i.buffer.buffer[t+3]<this.index)return!1;({index:e,parent:n}=i)}else({index:e,_parent:n}=this._tree);for(;n;({index:e,_parent:n}=n))if(e>-1)for(let i=e+t,r=t<0?-1:n._tree.children.length;i!=r;i+=t){let t=n._tree.children[i];if(this.mode&Do.IncludeAnonymous||t instanceof Io||!t.type.isAnonymous||Ko(t))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,e=null,n=0;if(t&&t.context==this.buffer)t:for(let i=this.index,r=this.stack.length;r>=0;){for(let s=t;s;s=s._parent)if(s.index==i){if(i==this.index)return s;e=s,n=r+1;break t}i=this.stack[--r]}for(let t=n;t<this.stack.length;t++)e=new Wo(this.buffer,e,this.stack[t]);return this.bufferNode=new Wo(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,e){for(let n=0;;){let i=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&e&&e(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(t){if(!this.buffer)return jo(this.node.parent,t);let{buffer:e}=this.buffer,{types:n}=e.set;for(let i=t.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return jo(this._tree,t,i);let s=n[e.buffer[this.stack[r]]];if(!s.isAnonymous){if(t[i]&&t[i]!=s.name)return!1;i--}}return!0}}function Ko(t){return t.children.some(t=>t instanceof Io||!t.type.isAnonymous||Ko(t))}const Go=new WeakMap;function Yo(t,e){if(!t.isAnonymous||e instanceof Io||e.type!=t)return 1;let n=Go.get(e);if(null==n){n=1;for(let i of e.children){if(i.type!=t||!(i instanceof Ro)){n=1;break}n+=Yo(t,i)}Go.set(e,n)}return n}function Qo(t,e,n,i,r,s,o,l,a){let h=0;for(let n=i;n<r;n++)h+=Yo(t,e[n]);let c=Math.ceil(1.5*h/8),u=[],d=[];return function e(n,i,r,o,l){for(let h=r;h<o;){let r=h,f=i[h],p=Yo(t,n[h]);for(h++;h<o;h++){let e=Yo(t,n[h]);if(p+e>=c)break;p+=e}if(h==r+1){if(p>c){let t=n[r];e(t.children,t.positions,0,t.children.length,i[r]+l);continue}u.push(n[r])}else{let e=i[h-1]+n[h-1].length-f;u.push(Qo(t,n,i,r,h,f,e,null,a))}d.push(f+l-s)}}(e,n,i,r,0),(l||a)(u,d,o)}class Jo{constructor(t,e,n,i,r=!1,s=!1){this.from=t,this.to=e,this.tree=n,this.offset=i,this.open=(r?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(t,e=[],n=!1){let i=[new Jo(0,t.length,t,0,!1,n)];for(let n of e)n.to>t.length&&i.push(n);return i}static applyChanges(t,e,n=128){if(!e.length)return t;let i=[],r=1,s=t.length?t[0]:null;for(let o=0,l=0,a=0;;o++){let h=o<e.length?e[o]:null,c=h?h.fromA:1e9;if(c-l>=n)for(;s&&s.from<c;){let e=s;if(l>=e.from||c<=e.to||a){let t=Math.max(e.from,l)-a,n=Math.min(e.to,c)-a;e=t>=n?null:new Jo(t,n,e.tree,e.offset+a,o>0,!!h)}if(e&&i.push(e),s.to>c)break;s=r<t.length?t[r++]:null}if(!h)break;l=h.toA,a=h.toA-h.toB}return i}}class Xo{startParse(t,e,n){return"string"==typeof t&&(t=new Zo(t)),n=n?n.length?n.map(t=>new So(t.from,t.to)):[new So(0,0)]:[new So(0,t.length)],this.createParse(t,e||[],n)}parse(t,e,n){let i=this.startParse(t,e,n);for(;;){let t=i.advance();if(t)return t}}}class Zo{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new Co({perNode:!0});let tl=0;class el{constructor(t,e,n,i){this.name=t,this.set=e,this.base=n,this.modified=i,this.id=tl++}toString(){let{name:t}=this;for(let e of this.modified)e.name&&(t=`${e.name}(${t})`);return t}static define(t,e){let n="string"==typeof t?t:"?";if(t instanceof el&&(e=t),null==e?void 0:e.base)throw new Error("Can not derive from a modified tag");let i=new el(n,[],null,[]);if(i.set.push(i),e)for(let t of e.set)i.set.push(t);return i}static defineModifier(t){let e=new il(t);return t=>t.modified.indexOf(e)>-1?t:il.get(t.base||t,t.modified.concat(e).sort((t,e)=>t.id-e.id))}}let nl=0;class il{constructor(t){this.name=t,this.instances=[],this.id=nl++}static get(t,e){if(!e.length)return t;let n=e[0].instances.find(n=>{return n.base==t&&(i=e,r=n.modified,i.length==r.length&&i.every((t,e)=>t==r[e]));var i,r});if(n)return n;let i=[],r=new el(t.name,i,t,e);for(let t of e)t.instances.push(r);let s=function(t){let e=[[]];for(let n=0;n<t.length;n++)for(let i=0,r=e.length;i<r;i++)e.push(e[i].concat(t[n]));return e.sort((t,e)=>e.length-t.length)}(e);for(let e of t.set)if(!e.modified.length)for(let t of s)i.push(il.get(e,t));return r}}function rl(t){let e=Object.create(null);for(let n in t){let i=t[n];Array.isArray(i)||(i=[i]);for(let t of n.split(" "))if(t){let n=[],r=2,s=t;for(let e=0;;){if("..."==s&&e>0&&e+3==t.length){r=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!i)throw new RangeError("Invalid path: "+t);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),e+=i[0].length,e==t.length)break;let o=t[e++];if(e==t.length&&"!"==o){r=0;break}if("/"!=o)throw new RangeError("Invalid path: "+t);s=t.slice(e)}let o=n.length-1,l=n[o];if(!l)throw new RangeError("Invalid path: "+t);let a=new ol(i,r,o>0?n.slice(0,o):null);e[l]=a.sort(e[l])}}return sl.add(e)}const sl=new Co;class ol{constructor(t,e,n,i){this.tags=t,this.mode=e,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}}function ll(t,e){let n=Object.create(null);for(let e of t)if(Array.isArray(e.tag))for(let t of e.tag)n[t.id]=e.class;else n[e.tag.id]=e.class;let{scope:i,all:r=null}=e||{};return{style:t=>{let e=r;for(let i of t)for(let t of i.set){let i=n[t.id];if(i){e=e?e+" "+i:i;break}}return e},scope:i}}function al(t,e,n,i=0,r=t.length){let s=new hl(i,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),i,r,"",s.highlighters),s.flush(r)}ol.empty=new ol([],2,null);class hl{constructor(t,e,n){this.at=t,this.highlighters=e,this.span=n,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,n,i,r){let{type:s,from:o,to:l}=t;if(o>=n||l<=e)return;s.isTop&&(r=this.highlighters.filter(t=>!t.scope||t.scope(s)));let a=i,h=function(t){let e=t.type.prop(sl);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||ol.empty,c=function(t,e){let n=null;for(let i of t){let t=i.style(e);t&&(n=n?n+" "+t:t)}return n}(r,h.tags);if(c&&(a&&(a+=" "),a+=c,1==h.mode&&(i+=(i?" ":"")+c)),this.startSpan(Math.max(e,o),a),h.opaque)return;let u=t.tree&&t.tree.prop(Co.mounted);if(u&&u.overlay){let s=t.node.enter(u.overlay[0].from+o,1),h=this.highlighters.filter(t=>!t.scope||t.scope(u.tree.type)),c=t.firstChild();for(let d=0,f=o;;d++){let p=d<u.overlay.length?u.overlay[d]:null,g=p?p.from+o:l,m=Math.max(e,f),v=Math.min(n,g);if(m<v&&c)for(;t.from<v&&(this.highlightRange(t,m,v,i,r),this.startSpan(Math.min(v,t.to),a),!(t.to>=g)&&t.nextSibling()););if(!p||g>n)break;f=p.to+o,f>e&&(this.highlightRange(s.cursor(),Math.max(e,p.from+o),Math.min(n,f),"",h),this.startSpan(Math.min(n,f),a))}c&&t.parent()}else if(t.firstChild()){u&&(i="");do{if(!(t.to<=e)){if(t.from>=n)break;this.highlightRange(t,e,n,i,r),this.startSpan(Math.min(n,t.to),a)}}while(t.nextSibling());t.parent()}}}const cl=el.define,ul=cl(),dl=cl(),fl=cl(dl),pl=cl(dl),gl=cl(),ml=cl(gl),vl=cl(gl),bl=cl(),yl=cl(bl),wl=cl(),xl=cl(),kl=cl(),Al=cl(kl),Sl=cl(),Cl={comment:ul,lineComment:cl(ul),blockComment:cl(ul),docComment:cl(ul),name:dl,variableName:cl(dl),typeName:fl,tagName:cl(fl),propertyName:pl,attributeName:cl(pl),className:cl(dl),labelName:cl(dl),namespace:cl(dl),macroName:cl(dl),literal:gl,string:ml,docString:cl(ml),character:cl(ml),attributeValue:cl(ml),number:vl,integer:cl(vl),float:cl(vl),bool:cl(gl),regexp:cl(gl),escape:cl(gl),color:cl(gl),url:cl(gl),keyword:wl,self:cl(wl),null:cl(wl),atom:cl(wl),unit:cl(wl),modifier:cl(wl),operatorKeyword:cl(wl),controlKeyword:cl(wl),definitionKeyword:cl(wl),moduleKeyword:cl(wl),operator:xl,derefOperator:cl(xl),arithmeticOperator:cl(xl),logicOperator:cl(xl),bitwiseOperator:cl(xl),compareOperator:cl(xl),updateOperator:cl(xl),definitionOperator:cl(xl),typeOperator:cl(xl),controlOperator:cl(xl),punctuation:kl,separator:cl(kl),bracket:Al,angleBracket:cl(Al),squareBracket:cl(Al),paren:cl(Al),brace:cl(Al),content:bl,heading:yl,heading1:cl(yl),heading2:cl(yl),heading3:cl(yl),heading4:cl(yl),heading5:cl(yl),heading6:cl(yl),contentSeparator:cl(bl),list:cl(bl),quote:cl(bl),emphasis:cl(bl),strong:cl(bl),link:cl(bl),monospace:cl(bl),strikethrough:cl(bl),inserted:cl(),deleted:cl(),changed:cl(),invalid:cl(),meta:Sl,documentMeta:cl(Sl),annotation:cl(Sl),processingInstruction:cl(Sl),definition:el.defineModifier("definition"),constant:el.defineModifier("constant"),function:el.defineModifier("function"),standard:el.defineModifier("standard"),local:el.defineModifier("local"),special:el.defineModifier("special")};for(let t in Cl){let e=Cl[t];e instanceof el&&(e.name=t)}var El;ll([{tag:Cl.link,class:"tok-link"},{tag:Cl.heading,class:"tok-heading"},{tag:Cl.emphasis,class:"tok-emphasis"},{tag:Cl.strong,class:"tok-strong"},{tag:Cl.keyword,class:"tok-keyword"},{tag:Cl.atom,class:"tok-atom"},{tag:Cl.bool,class:"tok-bool"},{tag:Cl.url,class:"tok-url"},{tag:Cl.labelName,class:"tok-labelName"},{tag:Cl.inserted,class:"tok-inserted"},{tag:Cl.deleted,class:"tok-deleted"},{tag:Cl.literal,class:"tok-literal"},{tag:Cl.string,class:"tok-string"},{tag:Cl.number,class:"tok-number"},{tag:[Cl.regexp,Cl.escape,Cl.special(Cl.string)],class:"tok-string2"},{tag:Cl.variableName,class:"tok-variableName"},{tag:Cl.local(Cl.variableName),class:"tok-variableName tok-local"},{tag:Cl.definition(Cl.variableName),class:"tok-variableName tok-definition"},{tag:Cl.special(Cl.variableName),class:"tok-variableName2"},{tag:Cl.definition(Cl.propertyName),class:"tok-propertyName tok-definition"},{tag:Cl.typeName,class:"tok-typeName"},{tag:Cl.namespace,class:"tok-namespace"},{tag:Cl.className,class:"tok-className"},{tag:Cl.macroName,class:"tok-macroName"},{tag:Cl.propertyName,class:"tok-propertyName"},{tag:Cl.operator,class:"tok-operator"},{tag:Cl.comment,class:"tok-comment"},{tag:Cl.meta,class:"tok-meta"},{tag:Cl.invalid,class:"tok-invalid"},{tag:Cl.punctuation,class:"tok-punctuation"}]);const Tl=new Co;const Ol=new Co;class Ml{constructor(t,e,n=[],i=""){this.data=t,this.name=i,re.prototype.hasOwnProperty("tree")||Object.defineProperty(re.prototype,"tree",{get(){return Dl(this)}}),this.parser=e,this.extension=[jl.of(this),re.languageData.of((t,e,n)=>{let i=_l(t,e,n),r=i.type.prop(Tl);if(!r)return[];let s=t.facet(r),o=i.type.prop(Ol);if(o){let r=i.resolve(e-i.from,n);for(let e of o)if(e.test(r,t)){let n=t.facet(e.facet);return"replace"==e.type?n:n.concat(s)}}return s})].concat(n)}isActiveAt(t,e,n=-1){return _l(t,e,n).type.prop(Tl)==this.data}findRegions(t){let e=t.facet(jl);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let n=[],i=(t,e)=>{if(t.prop(Tl)==this.data)return void n.push({from:e,to:e+t.length});let r=t.prop(Co.mounted);if(r){if(r.tree.prop(Tl)==this.data){if(r.overlay)for(let t of r.overlay)n.push({from:t.from+e,to:t.to+e});else n.push({from:e,to:e+t.length});return}if(r.overlay){let t=n.length;if(i(r.tree,r.overlay[0].from+e),n.length>t)return}}for(let n=0;n<t.children.length;n++){let r=t.children[n];r instanceof Ro&&i(r,t.positions[n]+e)}};return i(Dl(t),0),n}get allowsNesting(){return!0}}function _l(t,e,n){let i=t.facet(jl),r=Dl(t).topNode;if(!i||i.allowsNesting)for(let t=r;t;t=t.enter(e,n,Do.ExcludeBuffers))t.type.isTop&&(r=t);return r}Ml.setState=Kt.define();class Pl extends Ml{constructor(t,e,n){super(t,e,[],n),this.parser=e}static define(t){let e=(n=t.languageData,xt.define({combine:n?t=>t.concat(n):void 0}));var n;return new Pl(e,t.parser.configure({props:[Tl.add(t=>t.isTop?e:void 0)]}),t.name)}configure(t,e){return new Pl(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Dl(t){let e=t.field(Ml.state,!1);return e?e.tree:Ro.empty}class Rl{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let n=this.cursorPos-this.string.length;return t<n||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-n,e-n)}}let Bl=null;class Il{constructor(t,e,n=[],i,r,s,o,l){this.parser=t,this.state=e,this.fragments=n,this.tree=i,this.treeLen=r,this.viewport=s,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,e,n){return new Il(t,e,[],Ro.empty,0,n,[],null)}startParse(){return this.parser.startParse(new Rl(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=Ro.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof t){let e=Date.now()+t;t=()=>Date.now()>e}for(this.parse||(this.parse=this.startParse()),null!=e&&(null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&e<this.state.doc.length&&this.parse.stopAt(e);;){let i=this.parse.advance();if(i){if(this.fragments=this.withoutTempSkipped(Jo.addTree(i,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=i,this.parse=null,!(this.treeLen<(null!=e?e:this.state.doc.length)))return!0;this.parse=this.startParse()}if(t())return!1}})}takeTree(){let t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(Jo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Bl;Bl=this;try{return t()}finally{Bl=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Nl(t,e.from,e.to);return t}changes(t,e){let{fragments:n,tree:i,treeLen:r,viewport:s,skipped:o}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,i,r)=>e.push({fromA:t,toA:n,fromB:i,toB:r})),n=Jo.applyChanges(n,e),i=Ro.empty,r=0,s={from:t.mapPos(s.from,-1),to:t.mapPos(s.to,1)},this.skipped.length){o=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);n<i&&o.push({from:n,to:i})}}}return new Il(this.parser,e,n,i,r,s,o,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let e=this.skipped.length;for(let e=0;e<this.skipped.length;e++){let{from:n,to:i}=this.skipped[e];n<t.to&&i>t.from&&(this.fragments=Nl(this.fragments,n,i),this.skipped.splice(e--,1))}return!(this.skipped.length>=e||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends Xo{createParse(e,n,i){let r=i[0].from,s=i[i.length-1].to;return{parsedPos:r,advance(){let e=Bl;if(e){for(let t of i)e.tempSkipped.push(t);t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=s,new Ro(Oo.none,[],[],s-r)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}static get(){return Bl}}function Nl(t,e,n){return Jo.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Ll{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,n)||e.takeTree(),new Ll(e)}static init(t){let e=Math.min(3e3,t.doc.length),n=Il.create(t.facet(jl).parser,t,{from:0,to:e});return n.work(20,e)||n.takeTree(),new Ll(n)}}Ml.state=Ot.define({create:Ll.init,update(t,e){for(let t of e.effects)if(t.is(Ml.setState))return t.value;return e.startState.facet(jl)!=e.state.facet(jl)?Ll.init(e.state):t.apply(e)}});let Fl=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Fl=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Vl="undefined"!=typeof navigator&&(null===(El=navigator.scheduling)||void 0===El?void 0:El.isInputPending)?()=>navigator.scheduling.isInputPending():null,zl=Bi.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(Ml.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Ml.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Fl(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,r=n.field(Ml.state);if(r.tree==r.context.tree&&r.context.isDone(i+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,t&&!Vl?Math.max(25,t.timeRemaining()-5):1e9),o=r.context.treeLen<i&&n.doc.length>i+1e3,l=r.context.work(()=>Vl&&Vl()||Date.now()>s,i+(o?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Ml.setState.of(new Ll(r.context))})),this.chunkBudget>0&&(!l||o)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(t=>_i(this.view.state,t)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),jl=xt.define({combine:t=>t.length?t[0]:null,enables:t=>[Ml.state,zl,Ns.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class Hl{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const Wl=xt.define(),$l=xt.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function ql(t){let e=t.facet($l);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ul(t,e){let n="",i=t.tabSize,r=t.facet($l)[0];if("\t"==r){for(;e>=i;)n+="\t",e-=i;r=" "}for(let t=0;t<e;t++)n+=r;return n}function Kl(t,e){t instanceof re&&(t=new Gl(t));for(let n of t.state.facet(Wl)){let i=n(t,e);if(void 0!==i)return i}let n=Dl(t.state);return n.length>=e?function(t,e,n){let i=e.resolveStack(n),r=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=i.node){let t=[];for(let e=r;e&&!(e.from<i.node.from||e.to>i.node.to||e.from==i.node.from&&e.type==i.node.type);e=e.parent)t.push(e);for(let e=t.length-1;e>=0;e--)i={node:t[e],next:i}}return Ql(i,t,n)}(t,n,e):null}class Gl{constructor(t,e={}){this.state=t,this.options=e,this.unit=ql(t)}lineAt(t,e=1){let n=this.state.doc.lineAt(t),{simulateBreak:i,simulateDoubleBreak:r}=this.options;return null!=i&&i>=n.from&&i<=n.to?r&&i==t?{text:"",from:t}:(e<0?i<t:i<=t)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(t,e=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(t,e);return n.slice(t-i,Math.min(n.length,t+100-i))}column(t,e=1){let{text:n,from:i}=this.lineAt(t,e),r=this.countColumn(n,t-i),s=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return s>-1&&(r+=s-this.countColumn(n,n.search(/\S|$/))),r}countColumn(t,e=t.length){return ke(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:n,from:i}=this.lineAt(t,e),r=this.options.overrideIndentation;if(r){let t=r(i);if(t>-1)return t}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Yl=new Co;function Ql(t,e,n){for(let i=t;i;i=i.next){let t=Jl(i.node);if(t)return t(Zl.create(e,n,i))}return 0}function Jl(t){let e=t.type.prop(Yl);if(e)return e;let n,i=t.firstChild;if(i&&(n=i.type.prop(Co.closedBy))){let e=t.lastChild,i=e&&n.indexOf(e.name)>-1;return t=>function(t,e,n,i,r){let s=t.textAfter,o=s.match(/^\s*/)[0].length,l=i&&s.slice(o,o+i.length)==i||r==t.pos+o,a=e?function(t){let e=t.node,n=e.childAfter(e.from),i=e.lastChild;if(!n)return null;let r=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=null==r||r<=s.from?s.to:Math.min(s.to,r);for(let t=n.to;;){let r=e.childAfter(t);if(!r||r==i)return null;if(!r.type.isSkipped){if(r.from>=o)return null;let t=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+t}}t=r.to}}(t):null;return a?l?t.column(a.from):t.column(a.to):t.baseIndent+(l?0:t.unit*n)}(t,!0,1,void 0,i&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Xl:null}function Xl(){return 0}class Zl extends Gl{constructor(t,e,n){super(t.state,t.options),this.base=t,this.pos=e,this.context=n}get node(){return this.context.node}static create(t,e,n){return new Zl(t,e,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let n=t.resolve(e.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(ta(n,t))break;e=this.state.doc.lineAt(n.from)}return this.lineIndent(e.from)}continue(){return Ql(this.context.next,this.base,this.pos)}}function ta(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function ea({except:t,units:e=1}={}){return n=>{let i=t&&t.test(n.textAfter);return n.baseIndent+(i?0:e*n.unit)}}const na=new Co;class ia{constructor(t,e){let n;function i(t){let e=Ee.newName();return(n||(n=Object.create(null)))["."+e]=t,e}this.specs=t;const r="string"==typeof e.all?e.all:e.all?i(e.all):void 0,s=e.scope;this.scope=s instanceof Ml?t=>t.prop(Tl)==s.data:s?t=>t==s:void 0,this.style=ll(t.map(t=>({tag:t.tag,class:t.class||i(Object.assign({},t,{tag:null}))})),{all:r}).style,this.module=n?new Ee(n):null,this.themeType=e.themeType}static define(t,e){return new ia(t,e||{})}}const ra=xt.define(),sa=xt.define({combine:t=>t.length?[t[0]]:null});function oa(t){let e=t.facet(ra);return e.length?e:t.facet(sa)}class la{constructor(t){this.markCache=Object.create(null),this.tree=Dl(t.state),this.decorations=this.buildDeco(t,oa(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=Dl(t.state),n=oa(t.state),i=n!=oa(t.startState),{viewport:r}=t.view,s=t.changes.mapPos(this.decoratedTo,1);e.length<r.to&&!i&&e.type==this.tree.type&&s>=r.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=s):(e!=this.tree||t.viewportChanged||i)&&(this.tree=e,this.decorations=this.buildDeco(t.view,n),this.decoratedTo=r.to)}buildDeco(t,e){if(!e||!this.tree.length)return Fn.none;let n=new ue;for(let{from:i,to:r}of t.visibleRanges)al(this.tree,e,(t,e,i)=>{n.add(t,e,this.markCache[i]||(this.markCache[i]=Fn.mark({class:i})))},i,r);return n.finish()}}const aa=_t.high(Bi.fromClass(la,{decorations:t=>t.decorations})),ha=(Cl.meta,Cl.link,Cl.heading,Cl.emphasis,Cl.strong,Cl.strikethrough,Cl.keyword,Cl.atom,Cl.bool,Cl.url,Cl.contentSeparator,Cl.labelName,Cl.literal,Cl.inserted,Cl.string,Cl.deleted,Cl.regexp,Cl.escape,Cl.string,Cl.variableName,Cl.variableName,Cl.typeName,Cl.namespace,Cl.className,Cl.variableName,Cl.macroName,Cl.propertyName,Cl.comment,Cl.invalid,Ns.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}})),ca="()[]{}",ua=xt.define({combine:t=>se(t,{afterCursor:!0,brackets:ca,maxScanDistance:1e4,renderMatch:pa})}),da=Fn.mark({class:"cm-matchingBracket"}),fa=Fn.mark({class:"cm-nonmatchingBracket"});function pa(t){let e=[],n=t.matched?da:fa;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const ga=Ot.define({create:()=>Fn.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],i=e.state.facet(ua);for(let t of e.state.selection.ranges){if(!t.empty)continue;let r=xa(e.state,t.head,-1,i)||t.head>0&&xa(e.state,t.head-1,1,i)||i.afterCursor&&(xa(e.state,t.head,1,i)||t.head<e.state.doc.length&&xa(e.state,t.head+1,-1,i));r&&(n=n.concat(i.renderMatch(r,e.state)))}return Fn.set(n,!0)},provide:t=>Ns.decorations.from(t)}),ma=[ga,ha];function va(t={}){return[ua.of(t),ma]}const ba=new Co;function ya(t,e,n){let i=t.prop(e<0?Co.openedBy:Co.closedBy);if(i)return i;if(1==t.name.length){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function wa(t){let e=t.type.prop(ba);return e?e(t.node):t}function xa(t,e,n,i={}){let r=i.maxScanDistance||1e4,s=i.brackets||ca,o=Dl(t),l=o.resolveInner(e,n);for(let t=l;t;t=t.parent){let i=ya(t.type,n,s);if(i&&t.from<t.to){let r=wa(t);if(r&&(n>0?e>=r.from&&e<r.to:e>r.from&&e<=r.to))return ka(0,0,n,t,r,i,s)}}return function(t,e,n,i,r,s,o){let l=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=n>0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},c=t.doc.iterRange(e,n>0?t.doc.length:0),u=0;for(let t=0;!c.next().done&&t<=s;){let s=c.value;n<0&&(t+=s.length);let l=e+t*n;for(let t=n>0?0:s.length-1,e=n>0?s.length:-1;t!=e;t+=n){let e=o.indexOf(s[t]);if(!(e<0||i.resolveInner(l+t,1).type!=r))if(e%2==0==n>0)u++;else{if(1==u)return{start:h,end:{from:l+t,to:l+t+1},matched:e>>1==a>>1};u--}}n>0&&(t+=s.length)}return c.done?{start:h,matched:!1}:null}(t,e,n,o,l.type,r,s)}function ka(t,e,n,i,r,s,o){let l=i.parent,a={from:r.from,to:r.to},h=0,c=null==l?void 0:l.cursor();if(c&&(n<0?c.childBefore(i.from):c.childAfter(i.to)))do{if(n<0?c.to<=i.from:c.from>=i.to){if(0==h&&s.indexOf(c.type.name)>-1&&c.from<c.to){let t=wa(c);return{start:a,end:t?{from:t.from,to:t.to}:void 0,matched:!0}}if(ya(c.type,n,o))h++;else if(ya(c.type,-n,o)){if(0==h){let t=wa(c);return{start:a,end:t&&t.from<t.to?{from:t.from,to:t.to}:void 0,matched:!1}}h--}}}while(n<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}const Aa=Object.create(null),Sa=[Oo.none],Ca=[],Ea=Object.create(null),Ta=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Ta[t]=Ma(Aa,e);function Oa(t,e){Ca.indexOf(t)>-1||(Ca.push(t),console.warn(e))}function Ma(t,e){let n=[];for(let i of e.split(" ")){let e=[];for(let n of i.split(".")){let i=t[n]||Cl[n];i?"function"==typeof i?e.length?e=e.map(i):Oa(n,`Modifier ${n} used at start of tag`):e.length?Oa(n,`Tag ${n} used as modifier`):e=Array.isArray(i)?i:[i]:Oa(n,`Unknown highlighting tag ${n}`)}for(let t of e)n.push(t)}if(!n.length)return 0;let i=e.replace(/ /g,"_"),r=i+" "+n.map(t=>t.id),s=Ea[r];if(s)return s.id;let o=Ea[r]=Oo.define({id:Sa.length,name:i,props:[rl({[i]:n})]});return Sa.push(o),o.id}Qn.RTL,Qn.LTR;class _a{constructor(t,e,n,i){this.state=t,this.pos=e,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let e=Dl(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),n=Math.max(e.from,this.pos-250),i=e.text.slice(n-e.from,this.pos-e.from),r=i.search(Ba(t,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}get aborted(){return null==this.abortListeners}addEventListener(t,e,n){"abort"==t&&this.abortListeners&&(this.abortListeners.push(e),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function Pa(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}class Da{constructor(t,e,n,i){this.completion=t,this.source=e,this.match=n,this.score=i}}function Ra(t){return t.selection.main.from}function Ba(t,e){var n;let{source:i}=t,r=e&&"^"!=i[0],s="$"!=i[i.length-1];return r||s?new RegExp(`${r?"^":""}(?:${i})${s?"$":""}`,null!==(n=t.flags)&&void 0!==n?n:t.ignoreCase?"i":""):t}const Ia=$t.define();function Na(t,e,n,i){let{main:r}=t.selection,s=n-r.from,o=i-r.from;return{...t.changeByRange(l=>{if(l!=r&&n!=i&&t.sliceDoc(l.from+s,l.from+o)!=t.sliceDoc(n,i))return{range:l};let a=t.toText(e);return{changes:{from:l.from+s,to:i==r.from?l.to:l.from+o,insert:a},range:bt.cursor(l.from+s+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const La=new WeakMap;function Fa(t){if(!Array.isArray(t))return t;let e=La.get(t);return e||La.set(t,e=function(t){let e=t.map(t=>"string"==typeof t?{label:t}:t),[n,i]=e.every(t=>/^\w+$/.test(t.label))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let t=1;t<i.length;t++)n[i[t]]=!0}let i=Pa(e)+Pa(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}(e);return t=>{let r=t.matchBefore(i);return r||t.explicit?{from:r?r.from:t.pos,options:e,validFor:n}:null}}(t)),e}const Va=Kt.define(),za=Kt.define();class ja{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let e=0;e<t.length;){let n=rt(t,e),i=ot(n);this.chars.push(n);let r=t.slice(e,e+i),s=r.toUpperCase();this.folded.push(rt(s==r?r.toLowerCase():s,0)),e+=i}this.astral=t.length!=this.chars.length}ret(t,e){return this.score=t,this.matched=e,this}match(t){if(0==this.pattern.length)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:e,folded:n,any:i,precise:r,byWord:s}=this;if(1==e.length){let i=rt(t,0),r=ot(i),s=r==t.length?0:-100;if(i==e[0]);else{if(i!=n[0])return null;s+=-200}return this.ret(s,[0,r])}let o=t.indexOf(this.pattern);if(0==o)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=e.length,a=0;if(o<0){for(let r=0,s=Math.min(t.length,200);r<s&&a<l;){let s=rt(t,r);s!=e[a]&&s!=n[a]||(i[a++]=r),r+=ot(s)}if(a<l)return null}let h=0,c=0,u=!1,d=0,f=-1,p=-1,g=/[a-z]/.test(t),m=!0;for(let i=0,a=Math.min(t.length,200),v=0;i<a&&c<l;){let a=rt(t,i);o<0&&(h<l&&a==e[h]&&(r[h++]=i),d<l&&(a==e[d]||a==n[d]?(0==d&&(f=i),p=i+1,d++):d=0));let b,y=a<255?a>=48&&a<=57||a>=97&&a<=122?2:a>=65&&a<=90?1:0:(b=st(a))!=b.toLowerCase()?1:b!=b.toUpperCase()?2:0;(!i||1==y&&g||0==v&&0!=y)&&(e[c]==a||n[c]==a&&(u=!0)?s[c++]=i:s.length&&(m=!1)),v=y,i+=ot(a)}return c==l&&0==s[0]&&m?this.result((u?-200:0)-100,s,t):d==l&&0==f?this.ret(-200-t.length+(p==t.length?0:-100),[0,p]):o>-1?this.ret(-700-t.length,[o,o+this.pattern.length]):d==l?this.ret(-900-t.length,[f,p]):c==l?this.result((u?-200:0)-100-700+(m?0:-1100),s,t):2==e.length?null:this.result((i[0]?-700:0)-200-1100,i,t)}result(t,e,n){let i=[],r=0;for(let t of e){let e=t+(this.astral?ot(rt(n,t)):1);r&&i[r-1]==t?i[r-1]=e:(i[r++]=t,i[r++]=e)}return this.ret(t-n.length,i)}}class Ha{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length<this.pattern.length)return null;let e=t.slice(0,this.pattern.length),n=e==this.pattern?0:e.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,e.length],this.score=n+(t.length==this.pattern.length?0:-100),this)}}const Wa=xt.define({combine:t=>se(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:qa,filterStrict:!1,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>n=>$a(t(n),e(n)),optionClass:(t,e)=>n=>$a(t(n),e(n)),addToOptions:(t,e)=>t.concat(e),filterStrict:(t,e)=>t||e})});function $a(t,e){return t?e?t+" "+e:t:e}function qa(t,e,n,i,r,s){let o,l,a=t.textDirection==Qn.RTL,h=a,c=!1,u="top",d=e.left-r.left,f=r.right-e.right,p=i.right-i.left,g=i.bottom-i.top;if(h&&d<Math.min(p,f)?h=!1:!h&&f<Math.min(p,d)&&(h=!0),p<=(h?d:f))o=Math.max(r.top,Math.min(n.top,r.bottom-g))-e.top,l=Math.min(400,h?d:f);else{c=!0,l=Math.min(400,(a?e.right:r.right-e.left)-30);let t=r.bottom-e.bottom;t>=g||t>e.top?o=n.bottom-e.top:(u="bottom",o=e.bottom-n.top)}return{style:`${u}: ${o/((e.bottom-e.top)/s.offsetHeight)}px; max-width: ${l/((e.right-e.left)/s.offsetWidth)}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":h?"left":"right")}}function Ua(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/n);return{from:t*n,to:(t+1)*n}}let i=Math.floor((t-e)/n);return{from:t-(i+1)*n,to:t-i*n}}class Ka{constructor(t,e,n){this.view=t,this.stateField=e,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:r,selected:s}=i.open,o=t.state.facet(Wa);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map(t=>"cm-completionIcon-"+t)),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,n,i){let r=document.createElement("span");r.className="cm-completionLabel";let s=t.displayLabel||t.label,o=0;for(let t=0;t<i.length;){let e=i[t++],n=i[t++];e>o&&r.appendChild(document.createTextNode(s.slice(o,e)));let l=r.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(s.slice(e,n))),l.className="cm-completionMatchedText",o=n}return o<s.length&&r.appendChild(document.createTextNode(s.slice(o))),r},position:50},{render(t){if(!t.detail)return null;let e=document.createElement("span");return e.className="cm-completionDetail",e.textContent=t.detail,e},position:80}),e.sort((t,e)=>t.position-e.position).map(t=>t.render)}(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=Ua(r.length,s,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",n=>{let{options:i}=t.state.field(e).open;for(let e,r=n.target;r&&r!=this.dom;r=r.parentNode)if("LI"==r.nodeName&&(e=/-(\d+)$/.exec(r.id))&&+e[1]<i.length)return this.applyCompletion(t,i[+e[1]]),void n.preventDefault()}),this.dom.addEventListener("focusout",e=>{let n=t.state.field(this.stateField,!1);n&&n.tooltip&&t.state.facet(Wa).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:za.of(null)})}),this.showOptions(r,i.id)}mount(){this.updateSel()}showOptions(t,e){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var e;let n=t.state.field(this.stateField),i=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),n!=i){let{options:r,selected:s,disabled:o}=n.open;i.open&&i.open.options==r||(this.range=Ua(r.length,s,t.state.facet(Wa).maxRenderedOptions),this.showOptions(r,n.id)),this.updateSel(),o!=(null===(e=i.open)||void 0===e?void 0:e.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;(e.selected>-1&&e.selected<this.range.from||e.selected>=this.range.to)&&(this.range=Ua(e.options.length,e.selected,this.view.state.facet(Wa).maxRenderedOptions),this.showOptions(e.options,t.id));let n=this.updateSelectedOption(e.selected);if(n){this.destroyInfo();let{completion:i}=e.options[e.selected],{info:r}=i;if(!r)return;let s="string"==typeof r?document.createTextNode(r):r(i);if(!s)return;"then"in s?s.then(e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e,i)}).catch(t=>_i(this.view.state,t,"completion info")):(this.addInfoPane(s,i),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,e){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=t.nodeType)n.appendChild(t),this.infoDestroy=null;else{let{dom:e,destroy:i}=t;n.appendChild(e),this.infoDestroy=i||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)"LI"==n.nodeName&&n.id?i==t?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),e=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby")):i--;return e&&function(t,e){let n=t.getBoundingClientRect(),i=e.getBoundingClientRect(),r=n.height/t.offsetHeight;i.top<n.top?t.scrollTop-=(n.top-i.top)/r:i.bottom>n.bottom&&(t.scrollTop+=(i.bottom-n.bottom)/r)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=t.getBoundingClientRect(),r=this.space;if(!r){let t=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:t.clientWidth,bottom:t.clientHeight}}return i.top>Math.min(r.bottom,e.bottom)-10||i.bottom<Math.max(r.top,e.top)+10?null:this.view.state.facet(Wa).positionInfo(this.view,e,i,n,r,this.dom)}placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(t,e,n){const i=document.createElement("ul");i.id=e,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",t=>{t.target==i&&t.preventDefault()});let r=null;for(let s=n.from;s<n.to;s++){let{completion:o,match:l}=t[s],{section:a}=o;if(a){let t="string"==typeof a?a:a.name;t!=r&&(s>n.from||0==n.from)&&(r=t,"string"!=typeof a&&a.header?i.appendChild(a.header(a)):i.appendChild(document.createElement("completion-section")).textContent=t)}const h=i.appendChild(document.createElement("li"));h.id=e+"-"+s,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,this.view,l);e&&h.appendChild(e)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<t.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function Ga(t,e){return n=>new Ka(n,t,e)}function Ya(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}class Qa{constructor(t,e,n,i,r,s){this.options=t,this.attrs=e,this.tooltip=n,this.timestamp=i,this.selected=r,this.disabled=s}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new Qa(this.options,th(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,n,i,r,s){if(i&&!s&&t.some(t=>t.isPending))return i.setDisabled();let o=function(t,e){let n=[],i=null,r=null,s=t=>{n.push(t);let{section:e}=t.completion;if(e){i||(i=[]);let t="string"==typeof e?e:e.name;i.some(e=>e.name==t)||i.push("string"==typeof e?{name:t}:e)}},o=e.facet(Wa);for(let i of t)if(i.hasResult()){let t=i.result.getMatch;if(!1===i.result.filter)for(let e of i.result.options)s(new Da(e,i.source,t?t(e):[],1e9-n.length));else{let n,l=e.sliceDoc(i.from,i.to),a=o.filterStrict?new Ha(l):new ja(l);for(let e of i.result.options)if(n=a.match(e.label)){let o=e.displayLabel?t?t(e,n.matched):[]:n.matched,l=n.score+(e.boost||0);if(s(new Da(e,i.source,o,l)),"object"==typeof e.section&&"dynamic"===e.section.rank){let{name:t}=e.section;r||(r=Object.create(null)),r[t]=Math.max(l,r[t]||-1e9)}}}}if(i){let t=Object.create(null),e=0,s=(t,e)=>("dynamic"===t.rank&&"dynamic"===e.rank?r[e.name]-r[t.name]:0)||("number"==typeof t.rank?t.rank:1e9)-("number"==typeof e.rank?e.rank:1e9)||(t.name<e.name?-1:1);for(let n of i.sort(s))e-=1e5,t[n.name]=e;for(let e of n){let{section:n}=e.completion;n&&(e.score+=t["string"==typeof n?n:n.name])}}let l=[],a=null,h=o.compareCompletions;for(let t of n.sort((t,e)=>e.score-t.score||h(t.completion,e.completion))){let e=t.completion;!a||a.label!=e.label||a.detail!=e.detail||null!=a.type&&null!=e.type&&a.type!=e.type||a.apply!=e.apply||a.boost!=e.boost?l.push(t):Ya(t.completion)>Ya(a)&&(l[l.length-1]=t),a=t.completion}return l}(t,e);if(!o.length)return i&&t.some(t=>t.isPending)?i.setDisabled():null;let l=e.facet(Wa).selectOnOpen?0:-1;if(i&&i.selected!=l&&-1!=i.selected){let t=i.options[i.selected].completion;for(let e=0;e<o.length;e++)if(o[e].completion==t){l=e;break}}return new Qa(o,th(n,l),{pos:t.reduce((t,e)=>e.hasResult()?Math.min(t,e.from):t,1e8),create:hh,above:r.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(t){return new Qa(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Qa(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Ja{constructor(t,e,n){this.active=t,this.id=e,this.open=n}static start(){return new Ja(eh,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,n=e.facet(Wa),i=(n.override||e.languageDataAt("autocomplete",Ra(e)).map(Fa)).map(e=>(this.active.find(t=>t.source==e)||new ih(e,this.active.some(t=>0!=t.state)?1:0)).update(t,n));i.length==this.active.length&&i.every((t,e)=>t==this.active[e])&&(i=this.active);let r=this.open,s=t.effects.some(t=>t.is(sh));r&&t.docChanged&&(r=r.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!function(t,e){if(t==e)return!0;for(let n=0,i=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;i<e.length&&!e[i].hasResult();)i++;let r=n==t.length,s=i==e.length;if(r||s)return r==s;if(t[n++].result!=e[i++].result)return!1}}(i,this.active)||s?r=Qa.build(i,e,this.id,r,n,s):r&&r.disabled&&!i.some(t=>t.isPending)&&(r=null),!r&&i.every(t=>!t.isPending)&&i.some(t=>t.hasResult())&&(i=i.map(t=>t.hasResult()?new ih(t.source,0):t));for(let e of t.effects)e.is(oh)&&(r=r&&r.setSelected(e.value,this.id));return i==this.active&&r==this.open?this:new Ja(i,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Xa:Za}}const Xa={"aria-autocomplete":"list"},Za={};function th(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const eh=[];function nh(t,e){if(t.isUserEvent("input.complete")){let n=t.annotation(Ia);if(n&&e.activateOnCompletion(n))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class ih{constructor(t,e,n=!1){this.source=t,this.state=e,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(t,e){let n=nh(t,e),i=this;(8&n||16&n&&this.touches(t))&&(i=new ih(i.source,0)),4&n&&0==i.state&&(i=new ih(this.source,1)),i=i.updateFor(t,n);for(let e of t.effects)if(e.is(Va))i=new ih(i.source,1,e.value);else if(e.is(za))i=new ih(i.source,0);else if(e.is(sh))for(let t of e.value)t.source==i.source&&(i=t);return i}updateFor(t,e){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(Ra(t.state))}}class rh extends ih{constructor(t,e,n,i,r,s){super(t,3,e),this.limit=n,this.result=i,this.from=r,this.to=s}hasResult(){return!0}updateFor(t,e){var n;if(!(3&e))return this.map(t.changes);let i=this.result;i.map&&!t.changes.empty&&(i=i.map(i,t.changes));let r=t.changes.mapPos(this.from),s=t.changes.mapPos(this.to,1),o=Ra(t.state);if(o>s||!i||2&e&&(Ra(t.startState)==this.from||o<this.limit))return new ih(this.source,4&e?1:0);let l=t.changes.mapPos(this.limit);return function(t,e,n,i){if(!t)return!1;let r=e.sliceDoc(n,i);return"function"==typeof t?t(r,n,i,e):Ba(t,!0).test(r)}(i.validFor,t.state,r,s)?new rh(this.source,this.explicit,l,i,r,s):i.update&&(i=i.update(i,r,s,new _a(t.state,o,!1)))?new rh(this.source,this.explicit,l,i,i.from,null!==(n=i.to)&&void 0!==n?n:Ra(t.state)):new ih(this.source,1,this.explicit)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new rh(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new ih(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}const sh=Kt.define({map:(t,e)=>t.map(t=>t.map(e))}),oh=Kt.define(),lh=Ot.define({create:()=>Ja.start(),update:(t,e)=>t.update(e),provide:t=>[oo.from(t,t=>t.tooltip),Ns.contentAttributes.from(t,t=>t.attrs)]});function ah(t,e){const n=e.completion.apply||e.completion.label;let i=t.state.field(lh).active.find(t=>t.source==e.source);return i instanceof rh&&("string"==typeof n?t.dispatch({...Na(t.state,n,i.from,i.to),annotations:Ia.of(e.completion)}):n(t,e.completion,i.from,i.to),!0)}const hh=Ga(lh,ah);function ch(t,e="option"){return n=>{let i=n.state.field(lh,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(Wa).interactionDelay)return!1;let r,s=1;"page"==e&&(r=po(n,i.open.tooltip))&&(s=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1));let{length:o}=i.open.options,l=i.open.selected>-1?i.open.selected+s*(t?1:-1):t?0:o-1;return l<0?l="page"==e?0:o-1:l>=o&&(l="page"==e?o-1:0),n.dispatch({effects:oh.of(l)}),!0}}const uh=t=>!!t.state.field(lh,!1)&&(t.dispatch({effects:Va.of(!0)}),!0);class dh{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}}const fh=Bi.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(lh).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(lh),n=t.state.facet(Wa);if(!t.selectionSet&&!t.docChanged&&t.startState.field(lh)==e)return;let i=t.transactions.some(t=>{let e=nh(t,n);return 8&e||(t.selection||t.docChanged)&&!(3&e)});for(let e=0;e<this.running.length;e++){let n=this.running[e];if(i||n.context.abortOnDocChange&&t.docChanged||n.updates.length+t.transactions.length>50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){_i(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(t=>t.effects.some(t=>t.is(Va)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(t=>t.isPending&&!this.running.some(e=>e.active.source==t.source))?setTimeout(()=>this.startUpdate(),r):-1,0!=this.composing)for(let e of t.transactions)e.isUserEvent("input.type")?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(lh);for(let t of e.active)t.isPending&&!this.running.some(e=>e.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Wa).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=Ra(e),i=new _a(e,n,t.explicit,this.view),r=new dh(t,i);this.running.push(r),Promise.resolve(t.source(i)).then(t=>{r.context.aborted||(r.done=t||null,this.scheduleAccept())},t=>{this.view.dispatch({effects:za.of(null)}),_i(this.view.state,t)})}scheduleAccept(){this.running.every(t=>void 0!==t.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Wa).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Wa),i=this.view.state.field(lh);for(let r=0;r<this.running.length;r++){let s=this.running[r];if(void 0===s.done)continue;if(this.running.splice(r--,1),s.done){let i=Ra(s.updates.length?s.updates[0].startState:this.view.state),r=Math.min(i,s.done.from+(s.active.explicit?0:1)),o=new rh(s.active.source,s.active.explicit,r,s.done,s.done.from,null!==(t=s.done.to)&&void 0!==t?t:i);for(let t of s.updates)o=o.update(t,n);if(o.hasResult()){e.push(o);continue}}let o=i.active.find(t=>t.source==s.active.source);if(o&&o.isPending)if(null==s.done){let t=new ih(s.active.source,0);for(let e of s.updates)t=t.update(e,n);t.isPending||e.push(t)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:sh.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(lh,!1);if(e&&e.tooltip&&this.view.state.facet(Wa).closeOnBlur){let n=e.open&&po(this.view,e.open.tooltip);n&&n.dom.contains(t.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:za.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:Va.of(!1)}),20),this.composing=0}}}),ph="object"==typeof navigator&&/Win/.test(navigator.platform),gh=_t.highest(Ns.domEventHandlers({keydown(t,e){let n=e.state.field(lh,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&(!ph||!t.altKey)||t.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find(t=>t.source==i.source),s=i.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&ah(e,i),!1}})),mh=Ns.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),vh={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},bh=Kt.define({map(t,e){let n=e.mapPos(t,-1,at.TrackAfter);return null==n?void 0:n}}),yh=new class extends oe{};yh.startSide=1,yh.endSide=-1;const wh=Ot.define({create:()=>ce.empty,update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:t=>t>=n.from&&t<=n.to})}for(let n of e.effects)n.is(bh)&&(t=t.update({add:[yh.range(n.value,n.value+1)]}));return t}}),xh="()[]{}<>«»»«[]{}";function kh(t){for(let e=0;e<16;e+=2)if(xh.charCodeAt(e)==t)return xh.charAt(e+1);return st(t<128?t:t+1)}const Ah="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Sh=Ns.inputHandler.of((t,e,n,i)=>{if((Ah?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let r=t.state.selection.main;if(i.length>2||2==i.length&&1==ot(rt(i,0))||e!=r.from||n!=r.to)return!1;let s=function(t,e){let n=function(t,e){return t.languageDataAt("closeBrackets",e)[0]||vh}(t,t.selection.main.head),i=n.brackets||vh.brackets;for(let r of i){let s=kh(rt(r,0));if(e==r)return s==r?Mh(t,r,i.indexOf(r+r+r)>-1,n):Th(t,r,s,n.before||vh.before);if(e==s&&Ch(t,t.selection.main.from))return Oh(t,0,s)}return null}(t.state,i);return!!s&&(t.dispatch(s),!0)});function Ch(t,e){let n=!1;return t.field(wh).between(0,t.doc.length,t=>{t==e&&(n=!0)}),n}function Eh(t,e){let n=t.sliceString(e,e+2);return n.slice(0,ot(rt(n,0)))}function Th(t,e,n,i){let r=null,s=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:n,from:s.to}],effects:bh.of(s.to+e.length),range:bt.range(s.anchor+e.length,s.head+e.length)};let o=Eh(t.doc,s.head);return!o||/\s/.test(o)||i.indexOf(o)>-1?{changes:{insert:e+n,from:s.head},effects:bh.of(s.head+e.length),range:bt.cursor(s.head+e.length)}:{range:r=s}});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Oh(t,e,n){let i=null,r=t.changeByRange(e=>e.empty&&Eh(t.doc,e.head)==n?{changes:{from:e.head,to:e.head+n.length,insert:n},range:bt.cursor(e.head+n.length)}:i={range:e});return i?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Mh(t,e,n,i){let r=i.stringPrefixes||vh.stringPrefixes,s=null,o=t.changeByRange(i=>{if(!i.empty)return{changes:[{insert:e,from:i.from},{insert:e,from:i.to}],effects:bh.of(i.to+e.length),range:bt.range(i.anchor+e.length,i.head+e.length)};let o,l=i.head,a=Eh(t.doc,l);if(a==e){if(_h(t,l))return{changes:{insert:e+e,from:l},effects:bh.of(l+e.length),range:bt.cursor(l+e.length)};if(Ch(t,l)){let i=n&&t.sliceDoc(l,l+3*e.length)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+i.length,insert:i},range:bt.cursor(l+i.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(o=Ph(t,l-2*e.length,r))>-1&&_h(t,o))return{changes:{insert:e+e+e+e,from:l},effects:bh.of(l+e.length),range:bt.cursor(l+e.length)};if(t.charCategorizer(l)(a)!=ee.Word&&Ph(t,l,r)>-1&&!function(t,e,n,i){let r=Dl(t).resolveInner(e,-1),s=i.reduce((t,e)=>Math.max(t,e.length),0);for(let o=0;o<5;o++){let o=t.sliceDoc(r.from,Math.min(r.to,r.from+n.length+s)),l=o.indexOf(n);if(!l||l>-1&&i.indexOf(o.slice(0,l))>-1){let e=r.firstChild;for(;e&&e.from==r.from&&e.to-e.from>n.length+l;){if(t.sliceDoc(e.to-n.length,e.to)==n)return!1;e=e.firstChild}return!0}let a=r.to==e&&r.parent;if(!a)break;r=a}return!1}(t,l,e,r))return{changes:{insert:e+e,from:l},effects:bh.of(l+e.length),range:bt.cursor(l+e.length)}}return{range:s=i}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function _h(t,e){let n=Dl(t).resolveInner(e+1);return n.parent&&n.from==e}function Ph(t,e,n){let i=t.charCategorizer(e);if(i(t.sliceDoc(e-1,e))!=ee.Word)return e;for(let r of n){let n=e-r.length;if(t.sliceDoc(n,e)==r&&i(t.sliceDoc(n-1,n))!=ee.Word)return n}return-1}function Dh(t={}){return[gh,lh,Wa.of(t),fh,Bh,mh]}const Rh=[{key:"Ctrl-Space",run:uh},{mac:"Alt-`",run:uh},{mac:"Alt-i",run:uh},{key:"Escape",run:t=>{let e=t.state.field(lh,!1);return!(!e||!e.active.some(t=>0!=t.state)||(t.dispatch({effects:za.of(null)}),0))}},{key:"ArrowDown",run:ch(!0)},{key:"ArrowUp",run:ch(!1)},{key:"PageDown",run:ch(!0,"page")},{key:"PageUp",run:ch(!1,"page")},{key:"Enter",run:t=>{let e=t.state.field(lh,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Wa).interactionDelay)&&ah(t,e.open.options[e.open.selected])}}],Bh=_t.highest($s.computeN([Wa],t=>t.facet(Wa).defaultKeymap?[Rh]:[]));function Ih(t,e){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=t(e,n);return!!r&&(i(n.update(r)),!0)}}const Nh=Ih(Hh,0),Lh=Ih(jh,0),Fh=Ih((t,e)=>jh(t,e,function(t){let e=[];for(let n of t.selection.ranges){let i=t.doc.lineAt(n.from),r=n.to<=i.to?i:t.doc.lineAt(n.to);r.from>i.from&&r.from==n.to&&(r=n.to==i.to+1?i:t.doc.lineAt(n.to-1));let s=e.length-1;s>=0&&e[s].to>i.from?e[s].to=r.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return e}(e)),0);function Vh(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const zh=50;function jh(t,e,n=e.selection.ranges){let i=n.map(t=>Vh(e,t.from).block);if(!i.every(t=>t))return null;let r=n.map((t,n)=>function(t,{open:e,close:n},i,r){let s,o,l=t.sliceDoc(i-zh,i),a=t.sliceDoc(r,r+zh),h=/\s*$/.exec(l)[0].length,c=/^\s*/.exec(a)[0].length,u=l.length-h;if(l.slice(u-e.length,u)==e&&a.slice(c,c+n.length)==n)return{open:{pos:i-h,margin:h&&1},close:{pos:r+c,margin:c&&1}};r-i<=2*zh?s=o=t.sliceDoc(i,r):(s=t.sliceDoc(i,i+zh),o=t.sliceDoc(r-zh,r));let d=/^\s*/.exec(s)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-n.length;return s.slice(d,d+e.length)==e&&o.slice(p,p+n.length)==n?{open:{pos:i+d+e.length,margin:/\s/.test(s.charAt(d+e.length))?1:0},close:{pos:r-f-n.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null}(e,i[n],t.from,t.to));if(2!=t&&!r.every(t=>t))return{changes:e.changes(n.map((t,e)=>r[e]?[]:[{from:t.from,insert:i[e].open+" "},{from:t.to,insert:" "+i[e].close}]))};if(1!=t&&r.some(t=>t)){let t=[];for(let e,n=0;n<r.length;n++)if(e=r[n]){let r=i[n],{open:s,close:o}=e;t.push({from:s.pos-r.open.length,to:s.pos+s.margin},{from:o.pos-o.margin,to:o.pos+r.close.length})}return{changes:t}}return null}function Hh(t,e,n=e.selection.ranges){let i=[],r=-1;for(let{from:t,to:s}of n){let n=i.length,o=1e9,l=Vh(e,t).line;if(l){for(let n=t;n<=s;){let a=e.doc.lineAt(n);if(a.from>r&&(t==s||s>a.from)){r=a.from;let t=/^\s*/.exec(a.text)[0].length,e=t==a.length,n=a.text.slice(t,t+l.length)==l?t:-1;t<a.text.length&&t<o&&(o=t),i.push({line:a,comment:n,token:l,indent:t,empty:e,single:!1})}n=a.to+1}if(o<1e9)for(let t=n;t<i.length;t++)i[t].indent<i[t].line.text.length&&(i[t].indent=o);i.length==n+1&&(i[n].single=!0)}}if(2!=t&&i.some(t=>t.comment<0&&(!t.empty||t.single))){let t=[];for(let{line:e,token:n,indent:r,empty:s,single:o}of i)!o&&s||t.push({from:e.from+r,insert:n+" "});let n=e.changes(t);return{changes:n,selection:e.selection.map(n,1)}}if(1!=t&&i.some(t=>t.comment>=0)){let t=[];for(let{line:e,comment:n,token:r}of i)if(n>=0){let i=e.from+n,s=i+r.length;" "==e.text[s-e.from]&&s++,t.push({from:i,to:s})}return{changes:t}}return null}const Wh=$t.define(),$h=xt.define();class qh{constructor(t,e,n,i,r){this.changes=t,this.effects=e,this.mapped=n,this.startSelection=i,this.selectionsAfter=r}setSelAfter(t){return new qh(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,n;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(t=>t.toJSON())}}static fromJSON(t){return new qh(t.changes&&ct.fromJSON(t.changes),[],t.mapped&&ht.fromJSON(t.mapped),t.startSelection&&bt.fromJSON(t.startSelection),t.selectionsAfter.map(bt.fromJSON))}static fromTransaction(t,e){let n=Gh;for(let e of t.startState.facet($h)){let i=e(t);i.length&&(n=n.concat(i))}return!n.length&&t.changes.empty?null:new qh(t.changes.invert(t.startState.doc),n,void 0,e||t.startState.selection,Gh)}static selection(t){return new qh(void 0,Gh,void 0,void 0,t)}}function Uh(t,e,n,i){let r=e+1>n+20?e-n-1:0,s=t.slice(r,e);return s.push(i),s}function Kh(t,e){return t.length?e.length?t.concat(e):t:e}const Gh=[];function Yh(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Qh(t,e){if(!t.length)return t;let n=t.length,i=Gh;for(;n;){let r=Jh(t[n-1],e,i);if(r.changes&&!r.changes.empty||r.effects.length){let e=t.slice(0,n);return e[n-1]=r,e}e=r.mapped,n--,i=r.selectionsAfter}return i.length?[qh.selection(i)]:Gh}function Jh(t,e,n){let i=Kh(t.selectionsAfter.length?t.selectionsAfter.map(t=>t.map(e)):Gh,n);if(!t.changes)return qh.selection(i);let r=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new qh(r,Kt.mapEffects(t.effects,e),o,t.startSelection.map(s),i)}const Xh=/^(input\.type|delete)($|\.)/;class Zh{constructor(t,e,n=0,i=void 0){this.done=t,this.undone=e,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new Zh(this.done,this.undone):this}addChanges(t,e,n,i,r){let s=this.done,o=s[s.length-1];return s=o&&o.changes&&!o.changes.empty&&t.changes&&(!n||Xh.test(n))&&(!o.selectionsAfter.length&&e-this.prevTime<i.newGroupDelay&&i.joinToEvent(r,function(t,e){let n=[],i=!1;return t.iterChangedRanges((t,e)=>n.push(t,e)),e.iterChangedRanges((t,e,r,s)=>{for(let t=0;t<n.length;){let e=n[t++],o=n[t++];s>=e&&r<=o&&(i=!0)}}),i}(o.changes,t.changes))||"input.type.compose"==n)?Uh(s,s.length-1,i.minDepth,new qh(t.changes.compose(o.changes),Kh(Kt.mapEffects(t.effects,o.changes),o.effects),o.mapped,o.startSelection,Gh)):Uh(s,s.length,i.minDepth,t),new Zh(s,Gh,e,n)}addSelection(t,e,n,i){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Gh;return r.length>0&&e-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(s=r[r.length-1],o=t,s.ranges.length==o.ranges.length&&0===s.ranges.filter((t,e)=>t.empty!=o.ranges[e].empty).length)?this:new Zh(function(t,e){if(t.length){let n=t[t.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return i.length&&i[i.length-1].eq(e)?t:(i.push(e),Uh(t,t.length-1,1e9,n.setSelAfter(i)))}return[qh.selection([e])]}(this.done,t),this.undone,e,n);var s,o}addMapping(t){return new Zh(Qh(this.done,t),Qh(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,e,n){let i=0==t?this.done:this.undone;if(0==i.length)return null;let r=i[i.length-1],s=r.selectionsAfter[0]||e.selection;if(n&&r.selectionsAfter.length)return e.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Wh.of({side:t,rest:Yh(i),selection:s}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=1==i.length?Gh:i.slice(0,i.length-1);return r.mapped&&(n=Qh(n,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Wh.of({side:t,rest:n,selection:s}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}function tc(t,e){return bt.create(t.ranges.map(e),t.mainIndex)}function ec(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function nc({state:t,dispatch:e},n){let i=tc(t.selection,n);return!i.eq(t.selection,!0)&&(e(ec(t,i)),!0)}function ic(t,e){return bt.cursor(e?t.to:t.from)}function rc(t,e){return nc(t,n=>n.empty?t.moveByChar(n,e):ic(n,e))}function sc(t){return t.textDirectionAt(t.state.selection.main.head)==Qn.LTR}Zh.empty=new Zh(Gh,Gh);const oc=t=>rc(t,!sc(t)),lc=t=>rc(t,sc(t));function ac(t,e){return nc(t,n=>n.empty?t.moveByGroup(n,e):ic(n,e))}function hc(t,e,n){if(e.type.prop(n))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function cc(t,e,n){let i,r,s=Dl(t).resolveInner(e.head),o=n?Co.closedBy:Co.openedBy;for(let i=e.head;;){let e=n?s.childAfter(i):s.childBefore(i);if(!e)break;hc(t,e,o)?s=e:i=n?e.to:e.from}return r=s.type.prop(o)&&(i=n?xa(t,s.from,1):xa(t,s.to,-1))&&i.matched?n?i.end.to:i.end.from:n?s.to:s.from,bt.cursor(r,n?-1:1)}function uc(t,e){return nc(t,n=>{if(!n.empty)return ic(n,e);let i=t.moveVertically(n,e);return i.head!=n.head?i:t.moveToLineBoundary(n,e)})}"undefined"!=typeof Intl&&Intl.Segmenter;const dc=t=>uc(t,!1),fc=t=>uc(t,!0);function pc(t){let e,n=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,i=0,r=0;if(n){for(let e of t.state.facet(Ns.scrollMargins)){let n=e(t);(null==n?void 0:n.top)&&(i=Math.max(null==n?void 0:n.top,i)),(null==n?void 0:n.bottom)&&(r=Math.max(null==n?void 0:n.bottom,r))}e=t.scrollDOM.clientHeight-i-r}else e=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:r,selfScroll:n,height:Math.max(t.defaultLineHeight,e-5)}}function gc(t,e){let n,i=pc(t),{state:r}=t,s=tc(r.selection,n=>n.empty?t.moveVertically(n,e,i.height):ic(n,e));if(s.eq(r.selection))return!1;if(i.selfScroll){let e=t.coordsAtPos(r.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),l=o.top+i.marginTop,a=o.bottom-i.marginBottom;e&&e.top>l&&e.bottom<a&&(n=Ns.scrollIntoView(s.main.head,{y:"start",yMargin:e.top-l}))}return t.dispatch(ec(r,s),{effects:n}),!0}const mc=t=>gc(t,!1),vc=t=>gc(t,!0);function bc(t,e,n){let i=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,n);if(r.head==e.head&&r.head!=(n?i.to:i.from)&&(r=t.moveToLineBoundary(e,n,!1)),!n&&r.head==i.from&&i.length){let n=/^\s*/.exec(t.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;n&&e.head!=i.from+n&&(r=bt.cursor(i.from+n))}return r}function yc(t,e){let n=tc(t.state.selection,t=>{let n=e(t);return bt.range(t.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(t.state.selection)&&(t.dispatch(ec(t.state,n)),!0)}function wc(t,e){return yc(t,n=>t.moveByChar(n,e))}const xc=t=>wc(t,!sc(t)),kc=t=>wc(t,sc(t));function Ac(t,e){return yc(t,n=>t.moveByGroup(n,e))}function Sc(t,e){return yc(t,n=>t.moveVertically(n,e))}const Cc=t=>Sc(t,!1),Ec=t=>Sc(t,!0);function Tc(t,e){return yc(t,n=>t.moveVertically(n,e,pc(t).height))}const Oc=t=>Tc(t,!1),Mc=t=>Tc(t,!0),_c=({state:t,dispatch:e})=>(e(ec(t,{anchor:0})),!0),Pc=({state:t,dispatch:e})=>(e(ec(t,{anchor:t.doc.length})),!0),Dc=({state:t,dispatch:e})=>(e(ec(t,{anchor:t.selection.main.anchor,head:0})),!0),Rc=({state:t,dispatch:e})=>(e(ec(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function Bc(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:i}=t,r=i.changeByRange(i=>{let{from:r,to:s}=i;if(r==s){let o=e(i);o<r?(n="delete.backward",o=Ic(t,o,!1)):o>r&&(n="delete.forward",o=Ic(t,o,!0)),r=Math.min(r,o),s=Math.max(s,o)}else r=Ic(t,r,!1),s=Ic(t,s,!0);return r==s?{range:i}:{changes:{from:r,to:s},range:bt.cursor(r,r<i.head?-1:1)}});return!r.changes.empty&&(t.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?Ns.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Ic(t,e,n){if(t instanceof Ns)for(let i of t.state.facet(Ns.atomicRanges).map(e=>e(t)))i.between(e,e,(t,i)=>{t<e&&i>e&&(e=n?i:t)});return e}const Nc=(t,e,n)=>Bc(t,i=>{let r,s,o=i.from,{state:l}=t,a=l.doc.lineAt(o);if(n&&!e&&o>a.from&&o<a.from+200&&!/[^ \t]/.test(r=a.text.slice(0,o-a.from))){if("\t"==r[r.length-1])return o-1;let t=ke(r,l.tabSize)%ql(l)||ql(l);for(let e=0;e<t&&" "==r[r.length-1-e];e++)o--;s=o}else s=it(a.text,o-a.from,e,e)+a.from,s==o&&a.number!=(e?l.doc.lines:1)?s+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(s-a.from,o-a.from))&&(s=it(a.text,s-a.from,!1,!1)+a.from);return s}),Lc=t=>Nc(t,!1,!0),Fc=t=>Nc(t,!0,!1),Vc=(t,e)=>Bc(t,n=>{let i=n.head,{state:r}=t,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let t=null;;){if(i==(e?s.to:s.from)){i==n.head&&s.number!=(e?r.doc.lines:1)&&(i+=e?1:-1);break}let l=it(s.text,i-s.from,e)+s.from,a=s.text.slice(Math.min(i,l)-s.from,Math.max(i,l)-s.from),h=o(a);if(null!=t&&h!=t)break;" "==a&&i==n.head||(t=h),i=l}return i}),zc=t=>Vc(t,!1);function jc(t){let e=[],n=-1;for(let i of t.selection.ranges){let r=t.doc.lineAt(i.from),s=t.doc.lineAt(i.to);if(i.empty||i.to!=s.from||(s=t.doc.lineAt(i.to-1)),n>=r.number){let t=e[e.length-1];t.to=s.to,t.ranges.push(i)}else e.push({from:r.from,to:s.to,ranges:[i]});n=s.number+1}return e}function Hc(t,e,n){if(t.readOnly)return!1;let i=[],r=[];for(let e of jc(t)){if(n?e.to==t.doc.length:0==e.from)continue;let s=t.doc.lineAt(n?e.to+1:e.from-1),o=s.length+1;if(n){i.push({from:e.to,to:s.to},{from:e.from,insert:s.text+t.lineBreak});for(let n of e.ranges)r.push(bt.range(Math.min(t.doc.length,n.anchor+o),Math.min(t.doc.length,n.head+o)))}else{i.push({from:s.from,to:e.from},{from:e.to,insert:t.lineBreak+s.text});for(let t of e.ranges)r.push(bt.range(t.anchor-o,t.head-o))}}return!!i.length&&(e(t.update({changes:i,scrollIntoView:!0,selection:bt.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Wc(t,e,n){if(t.readOnly)return!1;let i=[];for(let e of jc(t))n?i.push({from:e.from,insert:t.doc.slice(e.from,e.to)+t.lineBreak}):i.push({from:e.to,insert:t.lineBreak+t.doc.slice(e.from,e.to)});return e(t.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const $c=qc(!1);function qc(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let i=e.changeByRange(n=>{let{from:i,to:r}=n,s=e.doc.lineAt(i),o=!t&&i==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n,i=Dl(t).resolveInner(e),r=i.childBefore(e),s=i.childAfter(e);return r&&s&&r.to<=e&&s.from>=e&&(n=r.type.prop(Co.closedBy))&&n.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}(e,i);t&&(i=r=(r<=s.to?s:e.doc.lineAt(r)).to);let l=new Gl(e,{simulateBreak:i,simulateDoubleBreak:!!o}),a=Kl(l,i);for(null==a&&(a=ke(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));r<s.to&&/\s/.test(s.text[r-s.from]);)r++;o?({from:i,to:r}=o):i>s.from&&i<s.from+100&&!/\S/.test(s.text.slice(0,i))&&(i=s.from);let h=["",Ul(e,a)];return o&&h.push(Ul(e,l.lineIndent(s.from,-1))),{changes:{from:i,to:r,insert:K.of(h)},range:bt.cursor(i+1+h[1].length)}});return n(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Uc(t,e){let n=-1;return t.changeByRange(i=>{let r=[];for(let s=i.from;s<=i.to;){let o=t.doc.lineAt(s);o.number>n&&(i.empty||i.to>o.from)&&(e(o,r,i),n=o.number),s=o.to+1}let s=t.changes(r);return{changes:r,range:bt.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const Kc=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>nc(t,e=>cc(t.state,e,!sc(t))),shift:t=>yc(t,e=>cc(t.state,e,!sc(t)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>nc(t,e=>cc(t.state,e,sc(t))),shift:t=>yc(t,e=>cc(t.state,e,sc(t)))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>Hc(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Wc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>Hc(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Wc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let n=t.selection,i=null;return n.ranges.length>1?i=bt.create([n.main]):n.main.empty||(i=bt.create([bt.cursor(n.main.head)])),!!i&&(e(ec(t,i)),!0)}},{key:"Mod-Enter",run:qc(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let n=jc(t).map(({from:e,to:n})=>bt.range(e,Math.min(n+1,t.doc.length)));return e(t.update({selection:bt.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let n=tc(t.selection,e=>{let n=Dl(t),i=n.resolveStack(e.from,1);if(e.empty){let t=n.resolveStack(e.from,-1);t.node.from>=i.node.from&&t.node.to<=i.node.to&&(i=t)}for(let t=i;t;t=t.next){let{node:n}=t;if((n.from<e.from&&n.to>=e.to||n.to>e.to&&n.from<=e.from)&&t.next)return bt.range(n.to,n.from)}return e});return!n.eq(t.selection)&&(e(ec(t,n)),!0)},preventDefault:!0},{key:"Mod-[",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Uc(t,(e,n)=>{let i=/^\s*/.exec(e.text)[0];if(!i)return;let r=ke(i,t.tabSize),s=0,o=Ul(t,Math.max(0,r-ql(t)));for(;s<i.length&&s<o.length&&i.charCodeAt(s)==o.charCodeAt(s);)s++;n.push({from:e.from+s,to:e.from+i.length,insert:o.slice(s)})}),{userEvent:"delete.dedent"})),!0)},{key:"Mod-]",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Uc(t,(e,n)=>{n.push({from:e.from,insert:t.facet($l)})}),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),i=new Gl(t,{overrideIndentation:t=>{let e=n[t];return null==e?-1:e}}),r=Uc(t,(e,r,s)=>{let o=Kl(i,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let l=/^\s*/.exec(e.text)[0],a=Ul(t,o);(l!=a||s.from<e.from+l.length)&&(n[e.from]=o,r.push({from:e.from,to:e.from+l.length,insert:a}))});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(jc(e).map(({from:t,to:n})=>(t>0?t--:n<e.doc.length&&n++,{from:t,to:n}))),i=tc(e.selection,e=>{let n;if(t.lineWrapping){let i=t.lineBlockAt(e.head),r=t.coordsAtPos(e.head,e.assoc||1);r&&(n=i.bottom+t.documentTop-r.bottom+t.defaultLineHeight/2)}return t.moveVertically(e,!0,n)}).map(n);return t.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:t,dispatch:e})=>function(t,e,n){let i=!1,r=tc(t.selection,e=>{let r=xa(t,e.head,-1)||xa(t,e.head,1)||e.head>0&&xa(t,e.head-1,1)||e.head<t.doc.length&&xa(t,e.head+1,-1);if(!r||!r.end)return e;i=!0;let s=r.start.from==e.head?r.end.to:r.end.from;return n?bt.range(e.anchor,s):bt.cursor(s)});return!!i&&(e(ec(t,r)),!0)}(t,e,!1)},{key:"Mod-/",run:t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),i=Vh(t.state,n.from);return i.line?Nh(t):!!i.block&&Fh(t)}},{key:"Alt-A",run:Lh},{key:"Ctrl-m",mac:"Shift-Alt-m",run:t=>(t.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:oc,shift:xc,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>ac(t,!sc(t)),shift:t=>Ac(t,!sc(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>nc(t,e=>bc(t,e,!sc(t))),shift:t=>yc(t,e=>bc(t,e,!sc(t))),preventDefault:!0},{key:"ArrowRight",run:lc,shift:kc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>ac(t,sc(t)),shift:t=>Ac(t,sc(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>nc(t,e=>bc(t,e,sc(t))),shift:t=>yc(t,e=>bc(t,e,sc(t))),preventDefault:!0},{key:"ArrowUp",run:dc,shift:Cc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:_c,shift:Dc},{mac:"Ctrl-ArrowUp",run:mc,shift:Oc},{key:"ArrowDown",run:fc,shift:Ec,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Pc,shift:Rc},{mac:"Ctrl-ArrowDown",run:vc,shift:Mc},{key:"PageUp",run:mc,shift:Oc},{key:"PageDown",run:vc,shift:Mc},{key:"Home",run:t=>nc(t,e=>bc(t,e,!1)),shift:t=>yc(t,e=>bc(t,e,!1)),preventDefault:!0},{key:"Mod-Home",run:_c,shift:Dc},{key:"End",run:t=>nc(t,e=>bc(t,e,!0)),shift:t=>yc(t,e=>bc(t,e,!0)),preventDefault:!0},{key:"Mod-End",run:Pc,shift:Rc},{key:"Enter",run:$c,shift:$c},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:Lc,shift:Lc},{key:"Delete",run:Fc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:zc},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Vc(t,!0)},{mac:"Mod-Backspace",run:t=>Bc(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)})},{mac:"Mod-Delete",run:t=>Bc(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)})}].concat([{key:"Ctrl-b",run:oc,shift:xc,preventDefault:!0},{key:"Ctrl-f",run:lc,shift:kc},{key:"Ctrl-p",run:dc,shift:Cc},{key:"Ctrl-n",run:fc,shift:Ec},{key:"Ctrl-a",run:t=>nc(t,e=>bt.cursor(t.lineBlockAt(e.head).from,1)),shift:t=>yc(t,e=>bt.cursor(t.lineBlockAt(e.head).from))},{key:"Ctrl-e",run:t=>nc(t,e=>bt.cursor(t.lineBlockAt(e.head).to,-1)),shift:t=>yc(t,e=>bt.cursor(t.lineBlockAt(e.head).to))},{key:"Ctrl-d",run:Fc},{key:"Ctrl-h",run:Lc},{key:"Ctrl-k",run:t=>Bc(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)})},{key:"Ctrl-Alt-h",run:zc},{key:"Ctrl-o",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:K.of(["",""])},range:bt.cursor(t.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(e=>{if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};let n=e.from,i=t.doc.lineAt(n),r=n==i.from?n-1:it(i.text,n-i.from,!1)+i.from,s=n==i.to?n+1:it(i.text,n-i.from,!0)+i.from;return{changes:{from:r,to:s,insert:t.doc.slice(n,s).append(t.doc.slice(r,n))},range:bt.cursor(s)}});return!n.changes.empty&&(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:vc}].map(t=>({mac:t.key,run:t.run,shift:t.shift}))));function Gc(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];"string"==typeof r?t.setAttribute(i,r):null!=r&&(t[i]=r)}e++}for(;e<arguments.length;e++)Yc(t,arguments[e]);return t}function Yc(t,e){if("string"==typeof e)t.appendChild(document.createTextNode(e));else if(null==e);else if(null!=e.nodeType)t.appendChild(e);else{if(!Array.isArray(e))throw new RangeError("Unsupported child node: "+e);for(var n=0;n<e.length;n++)Yc(t,e[n])}}class Qc{constructor(t,e,n){this.from=t,this.to=e,this.diagnostic=n}}class Jc{constructor(t,e,n){this.diagnostics=t,this.panel=e,this.selected=n}static init(t,e,n){let i=n.facet(hu).markerFilter;i&&(t=i(t,n));let r=t.slice().sort((t,e)=>t.from-e.from||t.to-e.to),s=new ue,o=[],l=0;for(let t=0;;){let e,i,a=t==r.length?null:r[t];if(!a&&!o.length)break;for(o.length?(e=l,i=o.reduce((t,e)=>Math.min(t,e.to),a&&a.from>e?a.from:1e8)):(e=a.from,i=a.to,o.push(a),t++);t<r.length;){let n=r[t];if(n.from!=e||!(n.to>n.from||n.to==e)){i=Math.min(n.from,i);break}o.push(n),t++,i=Math.min(n.to,i)}let h=yu(o);if(o.some(t=>t.from==t.to||t.from==t.to-1&&n.doc.lineAt(t.from).to==t.from))s.add(e,e,Fn.widget({widget:new fu(h),diagnostics:o.slice()}));else{let t=o.reduce((t,e)=>e.markClass?t+" "+e.markClass:t,"");s.add(e,i,Fn.mark({class:"cm-lintRange cm-lintRange-"+h+t,diagnostics:o.slice(),inclusiveEnd:o.some(t=>t.to>i)}))}l=i;for(let t=0;t<o.length;t++)o[t].to<=l&&o.splice(t--,1)}let a=s.finish();return new Jc(a,e,Xc(a))}}function Xc(t,e=null,n=0){let i=null;return t.between(n,1e9,(t,n,{spec:r})=>{if(!(e&&r.diagnostics.indexOf(e)<0))if(i){if(r.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new Qc(i.from,n,i.diagnostic)}else i=new Qc(t,n,e||r.diagnostics[0])}),i}function Zc(t,e){return t.field(iu,!1)?e:e.concat(Kt.appendConfig.of(wu))}const tu=Kt.define(),eu=Kt.define(),nu=Kt.define(),iu=Ot.define({create:()=>new Jc(Fn.none,null,null),update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),i=null,r=t.panel;if(t.selected){let r=e.changes.mapPos(t.selected.from,1);i=Xc(n,t.selected.diagnostic,r)||Xc(n,null,r)}!n.size&&r&&e.state.facet(hu).autoPanel&&(r=null),t=new Jc(n,r,i)}for(let n of e.effects)if(n.is(tu)){let i=e.state.facet(hu).autoPanel?n.value.length?gu.open:null:t.panel;t=Jc.init(n.value,i,e.state)}else n.is(eu)?t=new Jc(t.diagnostics,n.value?gu.open:null,t.selected):n.is(nu)&&(t=new Jc(t.diagnostics,t.panel,n.value));return t},provide:t=>[wo.from(t,t=>t.panel),Ns.decorations.from(t,t=>t.diagnostics)]}),ru=Fn.mark({class:"cm-lintRange cm-lintRange-active"});function su(t,e,n){let i,{diagnostics:r}=t.state.field(iu),s=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(t,r,{spec:l})=>{if(e>=t&&e<=r&&(t==r||(e>t||n>0)&&(e<r||n<0)))return i=l.diagnostics,s=t,o=r,!1});let l=t.state.facet(hu).tooltipFilter;return i&&l&&(i=l(i,t.state)),i?{pos:s,end:o,above:t.state.doc.lineAt(s).to<o,create:()=>({dom:ou(t,i)})}:null}function ou(t,e){return Gc("ul",{class:"cm-tooltip-lint"},e.map(e=>du(t,e,!1)))}const lu=t=>{let e=t.state.field(iu,!1);return!(!e||!e.panel||(t.dispatch({effects:eu.of(!1)}),0))},au=Bi.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(hu);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let t=Date.now();if(t<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-t);else{this.set=!1;let{state:t}=this.view,{sources:e}=t.facet(hu);e.length&&function(t,e,n){let i=[],r=-1;for(let s of t)s.then(n=>{i.push(n),clearTimeout(r),i.length==t.length?e(i):r=setTimeout(()=>e(i),200)},n)}(e.map(t=>Promise.resolve(t(this.view))),e=>{this.view.state.doc==t.doc&&this.view.dispatch(function(t,e){return{effects:Zc(t,[tu.of(e)])}}(this.view.state,e.reduce((t,e)=>t.concat(e))))},t=>{_i(this.view.state,t)})}}update(t){let e=t.state.facet(hu);(t.docChanged||e!=t.startState.facet(hu)||e.needsRefresh&&e.needsRefresh(t))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),hu=xt.define({combine:t=>Object.assign({sources:t.map(t=>t.source).filter(t=>null!=t)},se(t.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(t,e)=>t?e?n=>t(n)||e(n):t:e}))});function cu(t,e={}){return[hu.of({source:t,config:e}),au,wu]}function uu(t){let e=[];if(t)t:for(let{name:n}of t){for(let t=0;t<n.length;t++){let i=n[t];if(/[a-zA-Z]/.test(i)&&!e.some(t=>t.toLowerCase()==i.toLowerCase())){e.push(i);continue t}}e.push("")}return e}function du(t,e,n){var i;let r=n?uu(e.actions):[];return Gc("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Gc("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),null===(i=e.actions)||void 0===i?void 0:i.map((n,i)=>{let s=!1,o=i=>{if(i.preventDefault(),s)return;s=!0;let r=Xc(t.state.field(iu).diagnostics,e);r&&n.apply(t,r.from,r.to)},{name:l}=n,a=r[i]?l.indexOf(r[i]):-1,h=a<0?l:[l.slice(0,a),Gc("u",l.slice(a,a+1)),l.slice(a+1)];return Gc("button",{type:"button",class:"cm-diagnosticAction",onclick:o,onmousedown:o,"aria-label":` Action: ${l}${a<0?"":` (access key "${r[i]})"`}.`},h)}),e.source&&Gc("div",{class:"cm-diagnosticSource"},e.source))}class fu extends Nn{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return Gc("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class pu{constructor(t,e){this.diagnostic=e,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=du(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class gu{constructor(t){this.view=t,this.items=[],this.list=Gc("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:e=>{if(27==e.keyCode)lu(this.view),this.view.focus();else if(38==e.keyCode||33==e.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==e.keyCode||34==e.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==e.keyCode)this.moveSelection(0);else if(35==e.keyCode)this.moveSelection(this.items.length-1);else if(13==e.keyCode)this.view.focus();else{if(!(e.keyCode>=65&&e.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],i=uu(n.actions);for(let r=0;r<i.length;r++)if(i[r].toUpperCase().charCodeAt(0)==e.keyCode){let e=Xc(this.view.state.field(iu).diagnostics,n);e&&n.actions[r].apply(t,e.from,e.to)}}}e.preventDefault()},onclick:t=>{for(let e=0;e<this.items.length;e++)this.items[e].dom.contains(t.target)&&this.moveSelection(e)}}),this.dom=Gc("div",{class:"cm-panel-lint"},this.list,Gc("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>lu(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(iu).selected;if(!t)return-1;for(let e=0;e<this.items.length;e++)if(this.items[e].diagnostic==t.diagnostic)return e;return-1}update(){let{diagnostics:t,selected:e}=this.view.state.field(iu),n=0,i=!1,r=null,s=new Set;for(t.between(0,this.view.state.doc.length,(t,o,{spec:l})=>{for(let t of l.diagnostics){if(s.has(t))continue;s.add(t);let o,l=-1;for(let e=n;e<this.items.length;e++)if(this.items[e].diagnostic==t){l=e;break}l<0?(o=new pu(this.view,t),this.items.splice(n,0,o),i=!0):(o=this.items[l],l>n&&(this.items.splice(n,l-n),i=!0)),e&&o.diagnostic==e.diagnostic?o.dom.hasAttribute("aria-selected")||(o.dom.setAttribute("aria-selected","true"),r=o):o.dom.hasAttribute("aria-selected")&&o.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();0==this.items.length&&(this.items.push(new pu(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:t,panel:e})=>{let n=e.height/this.list.offsetHeight;t.top<e.top?this.list.scrollTop-=(e.top-t.top)/n:t.bottom>e.bottom&&(this.list.scrollTop+=(t.bottom-e.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let t=this.list.firstChild;function e(){let e=t;t=e.nextSibling,e.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;t!=n.dom;)e();t=n.dom.nextSibling}else this.list.insertBefore(n.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=Xc(this.view.state.field(iu).diagnostics,this.items[t].diagnostic);e&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:nu.of(e)})}static open(t){return new gu(t)}}function mu(t){return function(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const vu=Ns.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:mu("#d11")},".cm-lintRange-warning":{backgroundImage:mu("orange")},".cm-lintRange-info":{backgroundImage:mu("#999")},".cm-lintRange-hint":{backgroundImage:mu("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function bu(t){return"error"==t?4:"warning"==t?3:"info"==t?2:1}function yu(t){let e="hint",n=1;for(let i of t){let t=bu(i.severity);t>n&&(n=t,e=i.severity)}return e}const wu=[iu,Ns.decorations.compute([iu],t=>{let{selected:e,panel:n}=t.field(iu);return e&&n&&e.from!=e.to?Fn.set([ru.range(e.from,e.to)]):Fn.none}),fo(su,{hideOn:function(t,e){let n=e.pos,i=e.end||n,r=t.state.facet(hu).hideOn(t,n,i);if(null!=r)return r;let s=t.startState.doc.lineAt(e.pos);return!(!t.effects.some(t=>t.is(tu))&&!t.changes.touchesRange(s.from,Math.max(s.to,i)))}}),vu];class xu{constructor(t,e,n,i,r,s,o,l,a,h=0,c){this.p=t,this.stack=e,this.state=n,this.reducePos=i,this.pos=r,this.score=s,this.buffer=o,this.bufferBase=l,this.curContext=a,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,n=0){let i=t.parser.context;return new xu(t,[],e,n,n,0,[],0,i?new ku(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let n=t>>19,i=65535&t,{parser:r}=this.p,s=this.reducePos<this.pos-25;s&&this.setLookAhead(this.pos);let o=r.dynamicPrecedence(i);if(o&&(this.score+=o),0==n)return this.pushState(r.getGoto(this.state,i,!0),this.reducePos),i<r.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,s?8:4,!0),void this.reduceContext(i,this.reducePos);let l=this.stack.length-3*(n-1)-(262144&t?6:0),a=l?this.stack[l-2]:this.p.ranges[0].from,h=this.reducePos-a;h>=2e3&&!(null===(e=this.p.parser.nodeSet.types[i])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=h));let c=l?this.stack[l-1]:0,u=this.bufferBase+this.buffer.length-c;if(i<r.minRepeatTerm||131072&t){let t=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,t,u+4,!0)}if(262144&t)this.state=this.stack[l];else{let t=this.stack[l-3];this.state=r.getGoto(t,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,n,i=4,r=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let t=this,i=this.buffer.length;if(0==i&&t.parent&&(i=t.bufferBase-t.parent.bufferBase,t=t.parent),i>0&&0==t.buffer[i-4]&&t.buffer[i-1]>-1){if(e==n)return;if(t.buffer[i-2]>=e)return void(t.buffer[i-2]=n)}}if(r&&this.pos!=n){let r=this.buffer.length;if(r>0&&0!=this.buffer[r-4]){let t=!1;for(let e=r;e>0&&this.buffer[e-2]>n;e-=4)if(this.buffer[e-1]>=0){t=!0;break}if(t)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,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=n,this.buffer[r+3]=i}else this.buffer.push(t,e,n,i)}shift(t,e,n,i){if(131072&t)this.pushState(65535&t,this.pos);else if(262144&t)this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4);else{let r=t,{parser:s}=this.p;(i>this.pos||e<=s.maxNode)&&(this.pos=i,s.stateFlag(r,1)||(this.reducePos=i)),this.pushState(r,n),this.shiftContext(e,n),e<=s.maxNode&&this.buffer.push(e,n,i,4)}}apply(t,e,n,i){65536&t?this.reduce(t):this.shift(t,e,n,i)}useNode(t,e){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=t)&&(this.p.reused.push(t),n++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let n=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new xu(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let n=t<=this.p.parser.maxNode;n&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,n?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Au(this);;){let n=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==n)return!1;if(!(65536&n))return!0;e.reduce(n)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let n=[];for(let i,r=0;r<e.length;r+=2)(i=e[r+1])!=this.state&&this.p.parser.hasAction(i,t)&&n.push(e[r],i);if(this.stack.length<120)for(let t=0;n.length<8&&t<e.length;t+=2){let i=e[t+1];n.some((t,e)=>1&e&&t==i)||n.push(e[t],i)}e=n}let n=[];for(let t=0;t<e.length&&n.length<4;t+=2){let i=e[t+1];if(i==this.state)continue;let r=this.split();r.pushState(i,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[t],this.pos),r.reducePos=this.pos,r.score-=200,n.push(r)}return n}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if(!(65536&e))return!1;if(!t.validAction(this.state,e)){let n=e>>19,i=65535&e,r=this.stack.length-3*n;if(r<0||t.getGoto(this.stack[r],i,!1)<0){let t=this.findForcedReduction();if(null==t)return!1;e=t}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],n=(i,r)=>{if(!e.includes(i))return e.push(i),t.allActions(i,e=>{if(393216&e);else if(65536&e){let n=(e>>19)-r;if(n>1){let i=65535&e,r=this.stack.length-3*n;if(r>=0&&t.getGoto(this.stack[r],i,!1)>=0)return n<<19|65536|i}}else{let t=n(e,r+1);if(null!=t)return t}})};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:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||-3!=this.buffer[t])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||-4!=this.buffer[t])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new ku(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){t>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class ku{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class Au{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,n=t>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class Su{constructor(t,e,n){this.stack=t,this.pos=e,this.index=n,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Su(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.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 Su(this.stack,this.pos,this.index)}}function Cu(t,e=Uint16Array){if("string"!=typeof t)return t;let n=null;for(let i=0,r=0;i<t.length;){let s=0;for(;;){let e=t.charCodeAt(i++),n=!1;if(126==e){s=65535;break}e>=92&&e--,e>=34&&e--;let r=e-32;if(r>=46&&(r-=46,n=!0),s+=r,n)break;s*=46}n?n[r++]=s:n=new e(s)}return n}class Eu{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Tu=new Eu;class Ou{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Tu,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let n=this.range,i=this.rangeIndex,r=this.pos+t;for(;r<n.from;){if(!i)return null;let t=this.ranges[--i];r-=n.from-t.to,n=t}for(;e<0?r>n.to:r>=n.to;){if(i==this.ranges.length-1)return null;let t=this.ranges[++i];r+=t.from-n.to,n=t}return r}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e,n,i=this.chunkOff+t;if(i>=0&&i<this.chunk.length)e=this.pos+t,n=this.chunk.charCodeAt(i);else{let i=this.resolveOffset(t,1);if(null==i)return-1;if(e=i,e>=this.chunk2Pos&&e<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(e-this.chunk2Pos);else{let t=this.rangeIndex,i=this.range;for(;i.to<=e;)i=this.ranges[++t];this.chunk2=this.input.chunk(this.chunk2Pos=e),e+this.chunk2.length>i.to&&(this.chunk2=this.chunk2.slice(0,i.to-e)),n=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),n}acceptToken(t,e=0){let n=e?this.resolveOffset(e,-1):this.pos;if(null==n||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=n}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,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(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,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(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Tu,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let n="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(n+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return n}}class Mu{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:n}=e.p;!function(t,e,n,i,r,s){let o=0,l=1<<i,{dialect:a}=n.p.parser;t:for(;0!=(l&t[o]);){let n=t[o+1];for(let i=o+3;i<n;i+=2)if((t[i+1]&l)>0){let n=t[i];if(a.allows(n)&&(-1==e.token.value||e.token.value==n||Pu(n,e.token.value,r,s))){e.acceptToken(n);break}}let i=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[n+3*c-3])){for(;h<c;){let r=h+c>>1,s=n+r+(r<<1),l=t[s],a=t[s+1]||65536;if(i<l)c=r;else{if(!(i>=a)){o=t[s+2],e.advance();continue t}h=r+1}}break}o=t[n+3*c-1]}}(this.data,t,e,this.id,n.data,n.tokenPrecTable)}}function _u(t,e,n){for(let i,r=e;65535!=(i=t[r]);r++)if(i==n)return r-e;return-1}function Pu(t,e,n,i){let r=_u(n,i,e);return r<0||_u(n,i,t)<r}Mu.prototype.contextual=Mu.prototype.fallback=Mu.prototype.extend=!1,Mu.prototype.fallback=Mu.prototype.extend=!1;const Du="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let Ru=null;function Bu(t,e,n){let i=t.cursor(Do.IncludeAnonymous);for(i.moveTo(e);;)if(!(n<0?i.childBefore(e):i.childAfter(e)))for(;;){if((n<0?i.to<e:i.from>e)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(t.length,Math.max(i.from+1,e+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:t.length}}class Iu{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Bu(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Bu(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let n=this.trees[e],i=this.index[e];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let r=n.children[i],s=this.start[e]+n.positions[i];if(s>t)return this.nextStart=s,null;if(r instanceof Ro){if(s==t){if(s<this.safeFrom)return null;let t=s+r.length;if(t<=this.safeTo){let e=r.prop(Co.lookAhead);if(!e||t+e<this.fragment.to)return r}}this.index[e]++,s+r.length>=Math.max(this.safeFrom,t)&&(this.trees.push(r),this.start.push(s),this.index.push(0))}else this.index[e]++,this.nextStart=s+r.length}}}class Nu{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(t=>new Eu)}getActions(t){let e=0,n=null,{parser:i}=t.p,{tokenizers:r}=i,s=i.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,l=0;for(let i=0;i<r.length;i++){if(!(1<<i&s))continue;let a=r[i],h=this.tokens[i];if((!n||a.fallback)&&((a.contextual||h.start!=t.pos||h.mask!=s||h.context!=o)&&(this.updateCachedToken(h,a,t),h.mask=s,h.context=o),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),0!=h.value)){let i=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!a.extend&&(n=h,e>i))break}}for(;this.actions.length>e;)this.actions.pop();return l&&t.setLookAhead(l),n||t.pos!=this.stream.end||(n=new Eu,n.value=t.p.parser.eofTerm,n.start=n.end=t.pos,e=this.addActions(t,n.value,n.end,e)),this.mainToken=n,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Eu,{pos:n,p:i}=t;return e.start=n,e.end=Math.min(n+1,i.stream.end),e.value=n==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,n){let i=this.stream.clipPos(n.pos);if(e.token(this.stream.reset(i,t),n),t.value>-1){let{parser:e}=n.p;for(let i=0;i<e.specialized.length;i++)if(e.specialized[i]==t.value){let r=e.specializers[i](this.stream.read(t.start,t.end),n);if(r>=0&&n.p.parser.dialect.allows(r>>1)){1&r?t.extended=r>>1:t.value=r>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,n,i){for(let e=0;e<i;e+=3)if(this.actions[e]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=n,i}addActions(t,e,n,i){let{state:r}=t,{parser:s}=t.p,{data:o}=s;for(let t=0;t<2;t++)for(let l=s.stateSlot(r,t?2:1);;l+=3){if(65535==o[l]){if(1!=o[l+1]){0==i&&2==o[l+1]&&(i=this.putAction(ju(o,l+2),e,n,i));break}l=ju(o,l+2)}o[l]==e&&(i=this.putAction(ju(o,l+1),e,n,i))}return i}}class Lu{constructor(t,e,n,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Ou(e,i),this.tokens=new Nu(t,this.stream),this.topTerm=t.top[1];let{from:r}=i[0];this.stacks=[xu.start(this,t.top[0],r)],this.fragments=n.length&&this.stream.end-r>4*t.bufferLength?new Iu(n,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,n=this.stacks,i=this.minStackPos,r=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[t]=n;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<n.length;s++){let o=n[s];for(;;){if(this.tokens.mainToken=null,o.pos>i)r.push(o);else{if(this.advanceStack(o,r,n))continue;{t||(t=[],e=[]),t.push(o);let n=this.tokens.getMainToken(o);e.push(n.value,n.end)}}break}}if(!r.length){let e=t&&function(t){let e=null;for(let n of t){let t=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=t&&n.pos>t)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}(t);if(e)return Du&&console.log("Finish with "+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw Du&&t&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&t){let n=null!=this.stoppedAt&&t[0].pos>this.stoppedAt?t[0]:this.runRecovery(t,e,r);if(n)return Du&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(r.length>t)for(r.sort((t,e)=>e.score-t.score);r.length>t;)r.pop();r.some(t=>t.reducePos>i)&&this.recovering--}else if(r.length>1){t:for(let t=0;t<r.length-1;t++){let e=r[t];for(let n=t+1;n<r.length;n++){let i=r[n];if(e.sameState(i)||e.buffer.length>500&&i.buffer.length>500){if(!((e.score-i.score||e.buffer.length-i.buffer.length)>0)){r.splice(t--,1);continue t}r.splice(n--,1)}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let t=1;t<r.length;t++)r[t].pos<this.minStackPos&&(this.minStackPos=r[t].pos);return null}stopAt(t){if(null!=this.stoppedAt&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,n){let i=t.pos,{parser:r}=this,s=Du?this.stackID(t)+" -> ":"";if(null!=this.stoppedAt&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,n=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(i);o;){let i=this.parser.nodeSet.types[o.type.id]==o.type?r.getGoto(t.state,o.type.id):-1;if(i>-1&&o.length&&(!e||(o.prop(Co.contextHash)||0)==n))return t.useNode(o,i),Du&&console.log(s+this.stackID(t)+` (via reuse of ${r.getName(o.type.id)})`),!0;if(!(o instanceof Ro)||0==o.children.length||o.positions[0]>0)break;let l=o.children[0];if(!(l instanceof Ro&&0==o.positions[0]))break;o=l}}let o=r.stateSlot(t.state,4);if(o>0)return t.reduce(o),Du&&console.log(s+this.stackID(t)+` (via always-reduce ${r.getName(65535&o)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let l=this.tokens.getActions(t);for(let o=0;o<l.length;){let a=l[o++],h=l[o++],c=l[o++],u=o==l.length||!n,d=u?t:t.split(),f=this.tokens.mainToken;if(d.apply(a,h,f?f.start:d.pos,c),Du&&console.log(s+this.stackID(d)+` (via ${65536&a?`reduce of ${r.getName(65535&a)}`:"shift"} for ${r.getName(h)} @ ${i}${d==t?"":", split"})`),u)return!0;d.pos>i?e.push(d):n.push(d)}return!1}advanceFully(t,e){let n=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>n)return Fu(t,e),!0}}runRecovery(t,e,n){let i=null,r=!1;for(let s=0;s<t.length;s++){let o=t[s],l=e[s<<1],a=e[1+(s<<1)],h=Du?this.stackID(o)+" -> ":"";if(o.deadEnd){if(r)continue;if(r=!0,o.restart(),Du&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10&&(Du&&console.log(u+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,n));t++)Du&&(u=this.stackID(c)+" -> ");for(let t of o.recoverByInsert(l))Du&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,n);this.stream.end>o.pos?(a==o.pos&&(a++,l=0),o.recoverByDelete(l,a),Du&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(l)})`),Fu(o,n)):(!i||i.score<o.score)&&(i=o)}return i}stackToTree(t){return t.close(),Ro.build({buffer:Su.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(Ru||(Ru=new WeakMap)).get(t);return e||Ru.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function Fu(t,e){for(let n=0;n<e.length;n++){let i=e[n];if(i.pos==t.pos&&i.sameState(t))return void(e[n].score<t.score&&(e[n]=t))}e.push(t)}class Vu{constructor(t,e,n){this.source=t,this.flags=e,this.disabled=n}allows(t){return!this.disabled||0==this.disabled[t]}}class zu extends Xo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let n=Object.keys(t.topRules).map(e=>t.topRules[e][1]),i=[];for(let t=0;t<e.length;t++)i.push([]);function r(t,e,n){i[t].push([e,e.deserialize(String(n))])}if(t.nodeProps)for(let e of t.nodeProps){let t=e[0];"string"==typeof t&&(t=Co[t]);for(let n=1;n<e.length;){let i=e[n++];if(i>=0)r(i,t,e[n++]);else{let s=e[n+-i];for(let o=-i;o>0;o--)r(e[n++],t,s);n++}}}this.nodeSet=new Mo(e.map((e,r)=>Oo.define({name:r>=this.minRepeatTerm?void 0:e,id:r,props:i[r],top:n.indexOf(r)>-1,error:0==r,skipped:t.skippedNodes&&t.skippedNodes.indexOf(r)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=ko;let s=Cu(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t<this.specializerSpecs.length;t++)this.specialized[t]=this.specializerSpecs[t].term;this.specializers=this.specializerSpecs.map(Hu),this.states=Cu(t.states,Uint32Array),this.data=Cu(t.stateData),this.goto=Cu(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(t=>"number"==typeof t?new Mu(s,t):t),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,n){let i=new Lu(this,t,e,n);for(let r of this.wrappers)i=r(i,t,e,n);return i}getGoto(t,e,n=!1){let i=this.goto;if(e>=i[0])return-1;for(let r=i[e+1];;){let e=i[r++],s=1&e,o=i[r++];if(s&&n)return o;for(let n=r+(e>>1);r<n;r++)if(i[r]==t)return o;if(s)return-1}}hasAction(t,e){let n=this.data;for(let i=0;i<2;i++)for(let r,s=this.stateSlot(t,i?2:1);;s+=3){if(65535==(r=n[s])){if(1!=n[s+1]){if(2==n[s+1])return ju(n,s+2);break}r=n[s=ju(n,s+2)]}if(r==e||0==r)return ju(n,s+1)}return 0}stateSlot(t,e){return this.states[6*t+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,t=>t==e||null)}allActions(t,e){let n=this.stateSlot(t,4),i=n?e(n):void 0;for(let n=this.stateSlot(t,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=ju(this.data,n+2)}i=e(ju(this.data,n+1))}return i}nextStates(t){let e=[];for(let n=this.stateSlot(t,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=ju(this.data,n+2)}if(!(1&this.data[n+2])){let t=this.data[n+1];e.some((e,n)=>1&n&&e==t)||e.push(this.data[n],t)}}return e}configure(t){let e=Object.assign(Object.create(zu.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let n=this.topRules[t.top];if(!n)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=n}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((n,i)=>{let r=t.specializers.find(t=>t.from==n.external);if(!r)return n;let s=Object.assign(Object.assign({},n),{external:r.to});return e.specializers[i]=Hu(s),s})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),n=e.map(()=>!1);if(t)for(let i of t.split(" ")){let t=e.indexOf(i);t>=0&&(n[t]=!0)}let i=null;for(let t=0;t<e.length;t++)if(!n[t])for(let n,r=this.dialects[e[t]];65535!=(n=this.data[r++]);)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new Vu(t,n,i)}static deserialize(t){return new zu(t)}}function ju(t,e){return t[e]|t[e+1]<<16}function Hu(t){if(t.external){let e=t.extend?1:0;return(n,i)=>t.external(n,i)<<1|e}return t.get}const Wu=rl({String:Cl.string,Number:Cl.number,"True False":Cl.bool,PropertyName:Cl.propertyName,Null:Cl.null,", :":Cl.separator,"[ ]":Cl.squareBracket,"{ }":Cl.brace}),$u=zu.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Wu],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),qu=Pl.define({name:"json",parser:$u.configure({props:[Yl.add({Object:ea({except:/^\s*\}/}),Array:ea({except:/^\s*\]/})}),na.add({"Object Array":function(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Uu(){return new Hl(qu)}const Ku=[Ns.theme({"&":{height:"100%",width:"100%"},".cm-scroller":{overflow:"auto"},"& .cm-content":{padding:"0px"},"& .cm-line":{padding:"0px"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-completionInfo":{whiteSpace:"pre-wrap",overflow:"hidden",textOverflow:"ellipsis"},"&.cm-editor":{height:"100%"},"& .cm-completionInfo > *":{whiteSpace:"normal"},"& .cm-completionInfo ul":{margin:0,paddingLeft:"15px"},"& .cm-completionInfo pre":{marginBottom:0,whiteSpace:"pre-wrap"},"& .cm-completionInfo p":{marginTop:0},"& .cm-completionInfo p:not(:last-of-type)":{marginBottom:0}}),Ns.baseTheme({"& .variableName":{color:"#10f"},"& .number":{color:"#164"},"& .string":{color:"#a11"},"& .bool":{color:"#219"},"& .function":{color:"#aa3731",fontWeight:"bold"},"& .control":{color:"#708"}}),function(t){let e,n=[aa];return t instanceof ia&&(t.module&&n.push(Ns.styleModule.of(t.module)),e=t.themeType),e?n.push(ra.computeN([Ns.darkTheme],n=>n.facet(Ns.darkTheme)==("dark"==e)?[t]:[])):n.push(ra.of(t)),n}(ia.define([{tag:Cl.variableName,class:"variableName"},{tag:Cl.name,class:"variableName"},{tag:Cl.number,class:"number"},{tag:Cl.string,class:"string"},{tag:Cl.bool,class:"bool"},{tag:Cl.function(Cl.variableName),class:"function"},{tag:Cl.function(Cl.special(Cl.variableName)),class:"function"},{tag:Cl.controlKeyword,class:"control"},{tag:Cl.operatorKeyword,class:"control"}]))];function Gu(t){return[Yu(t),Ns.updateListener.of(t=>{if(t.selectionSet||t.docChanged){const{state:e}=t,n=e.selection.main.head,i=Dl(e).resolve(n,-1);if(!["Object","PropertyName","⚠"].includes(i.name))return null;""===e.doc.lineAt(n).text.trim()&&setTimeout(()=>{uh(t.view)},100)}})]}function Yu(t){return Dh({override:[e=>function(t,e){const{state:n,pos:i}=t,r=n.doc.lineAt(i),s=i-r.from;if(r.text.slice(0,s).includes(":"))return null;const o=Dl(n).resolve(i,-1);if(!["Object","PropertyName","⚠"].includes(o.name))return null;const l=n.sliceDoc(o.from,i).startsWith('"'),a='"'===r.text[s],h=e.map(t=>({label:t.label,type:"variable",info:t.info,apply:(e,n,i,s)=>{const o=e.state.sliceDoc(i-1,s+1);o.startsWith('"')&&(i-=1),o.endsWith('"')&&(s+=1);let l=`"${t.label}": ,`,a=i+l.length-1,h=a;if("Number"===t.detail)l=`"${t.label}": ${t.value},`,a=i+l.length-1-t.value.toString().length,h=i+l.length-1;else if("Boolean"===t.detail)l=`"${t.label}": ${t.value},`,a=i+l.length-1-t.value.toString().length,h=i+l.length-1;else if("Context"===t.detail)l=`"${t.label}": {},`,a=i+l.length-2,h=a;else if("String"===t.detail){const e=t.value.replace(/"/g,'\\"');l=`"${t.label}": "${e}",`,a=i+l.length-2-e.length,h=i+l.length-2}else if("Object"===t.detail||"Array"===t.detail||"null"===t.detail){l=`"${t.label}": ${JSON.stringify(t.value,null,2)},`;const e=r.text.slice(0,r.text.search(/\S|$/));l=l.split("\n").map((t,n)=>0===n?t:e+t).join("\n"),a=i+`"${t.label}": `.length,h=i+l.length-1}(function(t,e){const n=t.sliceDoc(e).trimStart();return n&&'"'===n[0]})(e.state,s)||(l=l.slice(0,-1));const c=e.state.update({changes:{from:i,to:s,insert:l},selection:{anchor:a,head:h}});e.dispatch(c)}})),c="Object"===o.name?i:o.from;return{from:l?c+1:c,to:a?r.to-1:r.to,options:h}}(e,t)]})}var Qu=s(467);const Ju=$t.define(),Xu=new Dt,Zu="JSON contains errors",td={},ed=[];function nd({allOutputs:t=td,value:e,onChange:n,onErrorChange:i,variablesForElement:r=ed}){const s=(0,o.useMemo)(()=>{const e=r.map(({name:t,detail:e,info:n})=>({label:t,type:"variable",info:()=>id(n,"Process variable"),detail:e,value:n||void 0})),n=function(t){const e=[];for(const n in t)if(t[n]){const{variables:i={}}=t[n];v(i,t=>{if(!g(t)||!m(t,"name"))return;const{name:i,value:r}=t;e.push({name:i,value:r,origin:n})})}return e}(t),i=n.map(({name:t,value:e,origin:n})=>({label:t,type:"variable",info:()=>id(e,`Output variable from ${n}`),detail:rd(e),value:e}));return[...e,...i]},[t,r]),l=(0,o.useRef)(null),[a,h]=(0,o.useState)(),[c,u]=(0,o.useState)();return(0,o.useEffect)(()=>{if(!l.current)return;const t=re.create({doc:e,extensions:[Dh(),[Sh,wh],va(),re.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:i}=t.newSelection.main,r=n.lineAt(i);if(i>r.from+200)return t;let s=n.sliceString(r.from,i);if(!e.some(t=>t.test(s)))return t;let{state:o}=t,l=-1,a=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==l)continue;l=e.from;let n=Kl(o,e.from);if(null==n)continue;let i=/^\s*/.exec(e.text)[0],r=Ul(o,n);i!=r&&a.push({from:e.from,to:e.from+i.length,insert:r})}return a.length?[t,{changes:a,sequential:!0}]:t}),$s.of([...Kc]),(new Dt).of(Uu()),(new Dt).of(re.tabSize.of(2)),Ns.contentAttributes.of({"aria-label":"JSON editor",tabindex:"0"}),cu(t=>{const e=(t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=function(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]})(t),n=e&&e.length>0;return i(n?Zu:null),u(n?Zu:null),e},{delay:300}),Xu.of(Gu(s)),Qs("Enter process variables in JSON format"),Ku,Ns.lineWrapping,Ns.updateListener.of(t=>{if(t.docChanged){if(t.transactions.some(t=>t.annotation(Ju)))return;const e=t.state.doc.toString();n(e)}})]}),r=new Ns({state:t,parent:l.current});return h(r),()=>{r.destroy()}},[n]),(0,o.useEffect)(()=>{a&&a.dispatch({effects:Xu.reconfigure(Gu(s))})},[s,a]),(0,o.useEffect)(()=>{if(!a)return;const t=a.state.doc.toString();e!==t&&a.dispatch({changes:{from:0,to:t.length,insert:e},annotations:Ju.of(!0)})},[a,e]),(0,Qu.jsxs)("div",{className:d()("code__editor",{"code__editor--error":c}),children:[(0,Qu.jsx)("div",{className:"code__editor-codemirror",children:(0,Qu.jsx)("div",{ref:l,className:"code__editor-codemirror-inner"})}),c&&(0,Qu.jsx)("div",{className:"code__editor-error",children:c})]})}function id(t,e){const n=document.createElement("div"),i=(0,I.qV)((0,Qu.jsxs)("div",{className:"info",children:[(0,Qu.jsx)("span",{children:e}),t&&(0,Qu.jsx)("pre",{children:"object"==typeof t?JSON.stringify(t,null,2):t})]}));return n.innerHTML=i,n}function rd(t){const e=typeof t;return"object"===e?Array.isArray(t)?"Array":null===t?"null":"Object":e.charAt(0).toUpperCase()+e.slice(1)}function sd({allOutputs:t,input:e="",onErrorChange:n,onResetInput:i,onSetInput:r,variablesForElement:s}){return(0,Qu.jsxs)("div",{className:"input",children:[(0,Qu.jsxs)("div",{className:"input__header",children:[(0,Qu.jsx)("div",{className:"input__header--title",children:"Input process variables"}),(0,Qu.jsx)(l.Link,{href:"https://docs.camunda.io/docs/components/concepts/variables/",target:"_blank",title:"Open documentation",children:(0,Qu.jsx)(c.Launch,{})}),(0,Qu.jsx)(l.Link,{className:"input__header--button-reset",onClick:()=>{i()},role:"button",children:"Clear"})]}),(0,Qu.jsx)(nd,{allOutputs:t,value:e,onChange:r,onErrorChange:n,variablesForElement:s})]})}function od({value:t}){const e=(0,o.useRef)(null),[n,i]=(0,o.useState)();return(0,o.useEffect)(()=>{if(!e.current)return;const n=re.create({doc:t,extensions:[Uu(),re.tabSize.of(2),re.readOnly.of(!0),Ns.editable.of(!1),Ns.lineWrapping,Ku]}),r=new Ns({state:n,parent:e.current});return i(r),()=>{r.destroy()}},[]),(0,o.useEffect)(()=>{if(!n)return;const e=n.state.doc.toString();t!==e&&n.dispatch({changes:{from:0,to:e.length,insert:t}})},[n,t]),(0,Qu.jsxs)("div",{className:"code__editor",children:[(0,Qu.jsx)(l.Button,{className:"code__editor-copy-button",renderIcon:c.Copy,iconDescription:"Copy to clipboard",size:"sm",kind:"ghost",hasIconOnly:!0,onClick:()=>{navigator.clipboard.writeText(t)}}),(0,Qu.jsx)("div",{className:"code__editor-codemirror",children:(0,Qu.jsx)("div",{ref:e,className:"code__editor-codemirror-inner"})})]})}const ld="LOCAL",ad="PROCESS";class hd extends(_()){constructor(t,e){super(),this._api=e,this._interval=null,this._status="idle",t.get("eventBus").on("selection.changed",()=>{"idle"!==this._status&&this.emit("taskExecution.interrupted"),this.cancelTaskExecution()})}async executeTask(t,e){this._changeStatus("deploying");const n=await this._api.deploy();if("idle"===this._status)return;if(!n.success)return this._emitError("Failed to deploy process definition",n.error),void this.cancelTaskExecution();const i=function(t){const{processes:e=[]}=t;for(const t of e)if(t)return t.processDefinitionId;return null}(n.response);if(!i)return this._emitError("Failed to retrieve process ID from deployment response"),void this.cancelTaskExecution();this._changeStatus("starting-instance");const r=await this._api.startInstance(i,t,e);if("idle"===this._status)return;if(!r.success)return this._emitError("Failed to start process instance",r.error),void this.cancelTaskExecution();const s=function(t){const{processInstanceKey:e}=t;return e||null}(r.response);if(!s)return this._emitError("Failed to retrieve process instance key from start instance response"),void this.cancelTaskExecution();this._changeStatus("executing",s),this._interval=setInterval(async()=>{const e=await this._api.getProcessInstance(s);if("idle"===this._status)return void this.cancelTaskExecution();if(!e.success)return void this._emitError("Failed to get process instance",e.error);const n=cd(e.response,s);if(!n)return;const i=function(t,e){const n=cd(t,e);return n?n.state:null}(e.response,s),r=function(t,e){const n=cd(t,e);return n&&n.hasIncident||!1}(e.response,s);let o=null;if(r){const t=await this._api.getProcessInstanceIncident(s);if("idle"===this._status)return void this.cancelTaskExecution();if(!t.success)return void this._emitError("Failed to get process instance incident",t.error);o=function(t){const{items:e=[]}=t;return e.length?e[0]:null}(t.response)}if(["COMPLETED","TERMINATED","CANCELED"].includes(i)||r){const e=await this._api.getProcessInstanceVariables(s);if("idle"===this._status)return void this.cancelTaskExecution();if(!e.success)return void this._emitError("Failed to get process instance variables",e.error);const i=await this._api.getProcessInstanceElementInstances(s);if("idle"===this._status)return void this.cancelTaskExecution();if(!i.success)return void this._emitError("Failed to get process instance element instances",i.error);const r=function(t,e,n,i){const r={};for(const s of t){const{name:t,value:o,variableKey:l}=s,a=ud(s,e,n,i);try{r[l]={name:t,value:JSON.parse(o),scope:a}}catch{r[l]={name:t,value:o,scope:a}}}return r}(e.response.items,i.response.items,n,t);this.emit("taskExecution.finished",{success:!o,incident:o,variables:r}),this.cancelTaskExecution()}},1e3)}async cancelTaskExecution(){this._interval&&clearInterval(this._interval),this._changeStatus("idle")}_emitError(t,e){const n={message:t,response:e};this.emit("taskExecution.error",n)}_changeStatus(t,...e){this._status!==t&&(this._status=t,this.emit("taskExecution.status.changed",t,...e))}}function cd(t,e){const{items:n=[]}=t;return n.length&&n.find(t=>t.processInstanceKey===e)||null}function ud(t,e,n,i){const{scopeKey:r}=t;if(e.find(t=>t.elementInstanceKey===r&&t.elementId===i))return ld;const{processInstanceKey:s}=n;return r===s?ad:null}const dd={deploying:"Deploying...","starting-instance":"Starting instance...",executing:"Waiting for task to be completed..."};function fd({isConnectionConfigured:t,configureConnectionBannerTitle:e,configureConnectionBannerDescription:n,configureConnectionLabel:i,onConfigureConnection:r,isTaskExecuting:s,output:a,currentOperateUrl:h,onResetOutput:u,taskExecutionStatus:f}){const p=(0,o.useMemo)(()=>null!=a&&a.error||null!=a&&a.incident||!t?(0,Qu.jsx)(c.ErrorFilled,{className:"output__status-icon--error"}):null!=a&&a.success?(0,Qu.jsx)(c.CheckmarkFilled,{className:"output__status-icon--success"}):s?(0,Qu.jsx)(l.InlineLoading,{}):(0,Qu.jsx)(c.InProgress,{className:"output__status-icon--ready"}),[a,s,t]),g=t&&a,m=t&&(h||a&&!a.error),v=h||(null==a?void 0:a.operateUrl),b=(0,o.useMemo)(()=>{if(s)return dd[f];if(!t)return"Connection error";if(a){if(a.error)return a.error.message?`Error: ${a.error.message}`:"Error";if(a.incident)return a.incident.errorType?`Incident: ${a.incident.errorType}`:"Incident";if(a.success)return"Success"}return"Ready"},[s,f,a,t]);return(0,Qu.jsxs)("div",{className:"output",children:[(0,Qu.jsxs)("div",{className:"output__header",children:[(0,Qu.jsxs)("div",{className:"output__header--title",children:[p,(0,Qu.jsx)("span",{children:b})]}),m&&(0,Qu.jsx)(l.Tooltip,{className:d()({"show-tooltip":!v}),autoAlign:!0,label:"No Operate URL set for this connection",children:(0,Qu.jsx)(l.Link,{className:d()({"link--disabled":!v}),href:v,target:"_blank",children:"View in Operate"})}),g&&(0,Qu.jsx)(l.Link,{onClick:()=>u(),role:"button",children:"Clear"})]}),(0,Qu.jsx)("div",{className:"output__body",children:t?(0,Qu.jsx)(pd,{isTaskExecuting:s,output:a}):(0,Qu.jsx)(gd,{title:e,description:n,actionLabel:i,onActionClick:r})})]})}function pd({isTaskExecuting:t,output:e}){return t?(0,Qu.jsx)(l.CodeSnippetSkeleton,{className:"output__variables--skeleton",type:"multi"}):null!=e&&e.success?(0,Qu.jsxs)(l.Tabs,{children:[(0,Qu.jsxs)(l.TabList,{children:[(0,Qu.jsx)(l.Tab,{children:"Process variables"}),(0,Qu.jsx)(l.Tab,{children:"Local variables"})]}),(0,Qu.jsxs)(l.TabPanels,{children:[(0,Qu.jsx)(l.TabPanel,{children:(0,Qu.jsx)(od,{value:JSON.stringify(vd(e.variables,ad),null,2)})}),(0,Qu.jsx)(l.TabPanel,{children:(0,Qu.jsx)(od,{value:JSON.stringify(vd(e.variables,ld),null,2)})})]})]}):null!=e&&e.error?(0,Qu.jsx)(od,{value:(null==e?void 0:e.error.response)||"No error details available"}):null!=e&&e.incident?(0,Qu.jsxs)(l.Tabs,{children:[(0,Qu.jsxs)(l.TabList,{children:[(0,Qu.jsx)(l.Tab,{children:"Incident"}),(0,Qu.jsx)(l.Tab,{children:"Process variables"}),(0,Qu.jsx)(l.Tab,{children:"Local variables"})]}),(0,Qu.jsxs)(l.TabPanels,{children:[(0,Qu.jsx)(l.TabPanel,{children:(0,Qu.jsx)(od,{value:md(e.incident)})}),(0,Qu.jsx)(l.TabPanel,{children:(0,Qu.jsx)(od,{value:JSON.stringify(vd(e.variables,ad),null,2)})}),(0,Qu.jsx)(l.TabPanel,{children:(0,Qu.jsx)(od,{value:JSON.stringify(vd(e.variables,ld),null,2)})})]})]}):(0,Qu.jsx)("div",{className:"output__variables--empty",children:(0,Qu.jsxs)("div",{children:["Enter process variables, then click ",(0,Qu.jsx)("span",{className:"output__variables--empty-action",children:"Test task"})," to see how they change once the task has executed."]})})}function gd({title:t,description:e,actionLabel:n,actionUrl:i="#",onActionClick:r=()=>{}}){return(0,Qu.jsxs)("div",{className:"output__error",children:[(0,Qu.jsxs)("div",{className:"output__error--title",children:[(0,Qu.jsx)("span",{children:t}),n&&(0,Qu.jsx)("div",{className:"output__error--action",children:(0,Qu.jsx)(l.Link,{href:i,onClick:()=>r(),children:n})})]}),(0,Qu.jsx)("div",{className:"output__error--content",children:(0,Qu.jsx)("span",{children:e})})]})}function md(t){let e="";return Object.keys(t).forEach(n=>{e+=`${function(t){return t.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase())}(n)}: ${JSON.stringify(t[n],null,2)}\n`}),e}function vd(t,e){return Object.values(t).reduce((t,n)=>(g(n)&&m(n,"name")&&e===n.scope&&(t[n.name]=n.value),t),{})}function bd(t){return function(t){var e=t.businessObject,n=function(t){return k(t,"bpmn:FlowElement")||k(t,"bpmn:Participant")||k(t,"bpmn:Lane")||k(t,"bpmn:SequenceFlow")||k(t,"bpmn:MessageFlow")||k(t,"bpmn:DataInput")||k(t,"bpmn:DataOutput")?"name":k(t,"bpmn:TextAnnotation")?"text":k(t,"bpmn:Group")?"categoryValueRef":void 0}(e);if(n)return"categoryValueRef"===n?function(t){var e=t.categoryValueRef;return e&&e.value||""}(e):e[n]||""}(t)}function yd(t,e){const n=e.get("translate")||(t=>t),i=e.get("elementTemplates",!1);if(i){const e=function(t,e){return e.get(t)}(t,i);if(e&&e.name)return n(e.name)}const r=function(t){return t.type.split(":")[1]}(t);return n(r.replace(/(\B[A-Z])/g," $1"))}var wd=s(72),xd=s.n(wd),kd=s(825),Ad=s.n(kd),Sd=s(659),Cd=s.n(Sd),Ed=s(56),Td=s.n(Ed),Od=s(540),Md=s.n(Od),_d=s(113),Pd=s.n(_d),Dd=s(520),Rd={};function Bd({injector:t,api:e,isConnectionConfigured:n,configureConnectionBannerTitle:i="Connection required",configureConnectionBannerDescription:r="Configure a connection to start testing.",configureConnectionLabel:s="Configure",onConfigureConnection:a,config:h,onConfigChanged:u=()=>{},operateBaseUrl:f,documentationUrl:p,onTaskExecutionStarted:g=()=>{},onTaskExecutionFinished:m=()=>{},onTaskExecutionInterrupted:v=()=>{}}){const b=(0,o.useRef)(null),y=(0,o.useRef)(null),[w,x]=(0,o.useState)([]),[M,_]=(0,o.useState)(),[P,D]=(0,o.useState)(),[I,N]=(0,o.useState)(),[L,F]=(0,o.useState)({}),[V,z]=(0,o.useState)(null),[j,H]=(0,o.useState)(),[W,$]=function(t){const[e,n]=(0,o.useState)(null),[i,r]=(0,o.useState)(E);(0,o.useEffect)(()=>{const e=t.get("selection");s({newSelection:e.get()});const n=t.get("eventBus");return n.on("selection.changed",s),()=>{n.off("selection.changed",s)}},[t]);const s=({newSelection:t})=>{const e=1!==(i=t).length?E:A(i[0],C)?function(t){let e=O(S(t));for(;e;){if(k(e,"bpmn:AdHocSubProcess"))return!0;e=O(e)}return!1}(i[0])?"Task testing is not supported for tasks inside an ad-hoc subprocess. Select a different task to start testing.":null:T;var i;if(e)return n(null),void r(e);n(t[0]),r(null),1!==t.length?(n(null),r(E)):A(t[0],C)?(n(t[0]),r(null)):(n(null),r(T))};return[e,i]}(t),q=(0,o.useRef)(null);(0,o.useEffect)(()=>{const n=new B(t);b.current=n;const i=new R(t,n,h);y.current=i;const r=new hd(t,e);return q.current=r,()=>{var t;null===(t=q.current)||void 0===t||t.cancelTaskExecution()}},[t]),(0,o.useEffect)(()=>{W&&b.current&&b.current.getVariablesForElement(W).then(t=>x(t))},[W]),(0,o.useEffect)(()=>{if(!b.current)return;const t=async()=>{if(!W||!b.current)return;const t=await b.current.getVariablesForElement(W);x(t)};return b.current.on("variables.changed",t),()=>{b.current&&b.current.off("variables.changed",t)}},[W]),(0,o.useEffect)(()=>{if(!y.current)return;const t=()=>{y.current&&(u(y.current.getConfig()),W&&(D(y.current.getInputConfigForElement(W)),N(y.current.getOutputConfigForElement(W)),F(y.current.getConfig().output)))};return y.current.on("config.changed",t),()=>{y.current&&y.current.off("config.changed",t)}},[W,u,F,D,N]),(0,o.useEffect)(()=>{var t,e,n,i;const r=t=>{var e;null==y||null===(e=y.current)||void 0===e||e.setOutputConfigForElement(W,{success:!1,error:t})},s=(t,e)=>{if(_(t),e&&f){const t=function(t,e){const n=t.replace(/\/+$/,"");return new URL(`processes/${e}`,`${n}/`).toString()}(f,e);H(t)}"idle"===t&&H(void 0)},o=t=>{var e;null==y||null===(e=y.current)||void 0===e||e.setOutputConfigForElement(W,{...t,operateUrl:j}),m(W,t)},l=()=>{v()};return null==q||null===(t=q.current)||void 0===t||t.on("taskExecution.finished",o),null==q||null===(e=q.current)||void 0===e||e.on("taskExecution.status.changed",s),null==q||null===(n=q.current)||void 0===n||n.on("taskExecution.error",r),null==q||null===(i=q.current)||void 0===i||i.on("taskExecution.interrupted",l),()=>{q.current&&(q.current.off("taskExecution.finished",o),q.current.off("taskExecution.status.changed",s),q.current.off("taskExecution.error",r),q.current.off("taskExecution.interrupted",l))}},[W,f,j]),(0,o.useEffect)(()=>{h&&y.current&&JSON.stringify(h)!==JSON.stringify(y.current.getConfig())&&y.current.setConfig(h)},[h]),(0,o.useEffect)(()=>{var t,e;W?(D(null==y||null===(t=y.current)||void 0===t?void 0:t.getInputConfigForElement(W)),N(null==y||null===(e=y.current)||void 0===e?void 0:e.getOutputConfigForElement(W))):D(void 0)},[W]);const U=(0,o.useCallback)(t=>{W&&y.current&&y.current.setInputConfigForElement(W,t)},[W]),K=(0,o.useCallback)(()=>{W&&y.current&&y.current.resetInputConfigForElement(W)},[W]),G=(0,o.useCallback)(()=>{W&&y.current&&y.current.resetOutputConfigForElement(W)},[W]);if(!h)return(0,Qu.jsx)("div",{className:"task-testing__container task-testing__container--empty",children:(0,Qu.jsxs)("div",{className:"task-testing__container-no-config",children:[(0,Qu.jsx)(l.InlineLoading,{})," ",(0,Qu.jsx)("span",{children:"Configuring..."})]})});if(!W)return(0,Qu.jsx)("div",{className:"task-testing__container task-testing__container--empty",children:(0,Qu.jsxs)("div",{className:"task-testing__container-no-element",children:[(0,Qu.jsx)(c.Cursor_1,{}),(0,Qu.jsx)("span",{children:$}),p&&(0,Qu.jsx)(l.Link,{href:p,target:"_blank",children:"Learn more."})]})});const Y=!n||!!V,Q=n?V:i,J=!!M&&"idle"!==M;return(0,Qu.jsxs)("div",{className:"task-testing__container",children:[(0,Qu.jsxs)("div",{className:"task-testing__container--left",children:[(0,Qu.jsxs)("div",{className:"task-testing__container--header",children:[(0,Qu.jsxs)("div",{className:"task-header",children:[(0,Qu.jsx)("span",{className:"task-type",children:yd(W,t)}),(0,Qu.jsx)("span",{className:"task-name",children:bd(W)})]}),(0,Qu.jsx)(l.Tooltip,{className:d()({"show-tooltip":Y}),label:Q,align:"left-start",children:(0,Qu.jsx)(l.Button,{"data-testid":"test-task-btn",className:"btn-execute",kind:"primary",size:"sm",renderIcon:J?c.StopFilledAlt:c.PlayFilledAlt,onClick:()=>{var t;n?J?null==q||null===(t=q.current)||void 0===t||t.cancelTaskExecution():(async()=>{if(!n||V||!W||!q.current||!y.current)return;g(W);const t=y.current.getInputConfigForElement(W);y.current.setOutputConfigForElement(W,null),q.current.executeTask(W.id,JSON.parse(t))})():a&&a()},children:J?"Cancel":"Test task"})})]}),(0,Qu.jsx)(sd,{allOutputs:L,input:P,onErrorChange:z,onResetInput:K,onSetInput:U,variablesForElement:w})]}),(0,Qu.jsx)("div",{className:"task-testing__container--right",children:(0,Qu.jsx)(fd,{isConnectionConfigured:n,configureConnectionBannerTitle:i,configureConnectionBannerDescription:r,configureConnectionLabel:s,onConfigureConnection:a,isTaskExecuting:J,output:I,currentOperateUrl:j,onResetOutput:G,taskExecutionStatus:M||"idle"})})]})}Rd.styleTagTransform=Pd(),Rd.setAttributes=Td(),Rd.insert=Cd().bind(null,"head"),Rd.domAPI=Ad(),Rd.insertStyleElement=Md(),xd()(Dd.A,Rd),Dd.A&&Dd.A.locals&&Dd.A.locals;export{Bd as default};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|