@camunda/task-testing 2.2.0 → 3.0.0-0
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/README.md +72 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/ElementConfig.d.ts +9 -6
- package/dist/types/ExecutionLog.d.ts +196 -0
- package/dist/types/TaskExecution.d.ts +99 -33
- package/dist/types/components/Input/InputEditor.d.ts +2 -1
- package/dist/types/components/Output/ExecutionLog.d.ts +24 -0
- package/dist/types/components/Output/Output.d.ts +30 -33
- package/dist/types/components/TaskTesting/TaskTesting.d.ts +28 -19
- package/dist/types/components/shared/Tooltip.d.ts +24 -0
- package/dist/types/components/shared/plugins.d.ts +3 -3
- package/dist/types/hooks/useSelectedElement.d.ts +8 -6
- package/dist/types/types.d.ts +176 -21
- package/dist/types/utils/autocompletion.d.ts +6 -6
- package/dist/types/utils/element.d.ts +11 -2
- package/dist/types/utils/getOperateUrl.d.ts +5 -2
- package/dist/types/utils/getTasklistUrl.d.ts +9 -0
- package/dist/types/utils/trimTrailingSlashes.d.ts +12 -0
- package/dist/types/utils/variables.d.ts +28 -0
- package/package.json +19 -17
- package/dist/types/components/Output/OutputVariables.d.ts +0 -20
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"),o=Object.prototype.hasOwnProperty,l=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function h(t,e,n){var i,s={},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)o.call(e,i)&&!a.hasOwnProperty(i)&&(s[i]=e[i]);if(t&&t.defaultProps)for(i in e=t.defaultProps)void 0===s[i]&&(s[i]=e[i]);return{$$typeof:r,type:t,key:h,ref:c,props:s,_owner:l.current}}e.Fragment=s,e.jsx=h,e.jsxs=h},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 .output__variables--skeleton{max-inline-size:unset}.task-testing__container .output .output__incident--details{position:absolute;width:100%;height:calc(100% - 30px);background-color:var(--cds-layer, #f4f4f4);padding:12px;line-height:20px;overflow:auto}.task-testing__container .output .output__incident--details pre{margin:0;font-size:14px;white-space:pre-wrap;word-break:break-word}.task-testing__container .output .output__incident--details .bold{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 pre{margin-top:8px}.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,CAGF,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,8DACE,qBAAA,CAGF,4DACE,iBAAA,CACA,UAAA,CACA,wBAAA,CACA,0CAAA,CACA,YAAA,CACA,gBAAA,CACA,aAAA,CAEA,gEACE,QAAA,CACA,cAAA,CACA,oBAAA,CACA,qBAAA,CAGF,kEACE,gBAAA,CAIJ,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,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 .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 .output__variables--skeleton {\n max-inline-size: unset;\n }\n\n .output__incident--details {\n position: absolute;\n width: 100%;\n height: calc(100% - 30px);\n background-color: var(--cds-layer, #f4f4f4);\n padding: 12px;\n line-height: 20px;\n overflow: auto;\n\n pre {\n margin: 0;\n font-size: 14px;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .bold {\n font-weight: bold;\n }\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 pre {\n margin-top: 8px;\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 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,Settings:()=>n.Settings,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){const e=f.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e||"[object GeneratorFunction]"===e||"[object AsyncGeneratorFunction]"===e||"[object Proxy]"===e}function v(t,e){return!(null==t)&&p.call(t,e)}function b(t,e){let n,i;if(void 0===t)return;const r=function(t){return"[object Array]"===f.call(t)}(t)?x:w;for(let s in t)if(v(t,s)&&(n=t[s],i=e(n,r(s)),!1===i))return n}function y(t,e){return!!function(t,e){const n=function(t){return m(t)?t:e=>e===t}(e);let i;return b(t,function(t,e){if(n(t,e))return i=t,!1}),i}(t,e)}function w(t){return t}function x(t){return Number(t)}function k(t,e){let n={};return b(Object(t),function(t,i){-1===e.indexOf(i)&&(n[i]=t)}),n}function A(t,e){var n=C(t);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(e)}function S(t,e){return y(e,function(e){return A(t,e)})}function C(t){return t&&t.businessObject||t}const E=["bpmn:Task"],O="Select a task to start testing.",T="Task testing is only supported for tasks. Select a task to start testing.";function M(t){return t.$parent}var _=s(7),P=s.n(_);const D={input:{},output:{}},R=["bpmn:Task"];class B extends(P()){constructor(t,e,n=D){super(),this._injector=t,this._elementVariables=e,this._config={...D,...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(!S(t,R))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(!S(t,R))throw new Error(`Unsupported element type: ${t.type}`);this._config={...this._config,input:k(this._config.input,t.id)},this.emit("config.changed")}setOutputConfigForElement(t,e){if(!S(t,R))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(!S(t,R))throw new Error(`Unsupported element type: ${t.type}`);this._config={...this._config,output:k(this._config.output,t.id)},this.emit("config.changed")}getInputConfigForElement(t){if(!S(t,R))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(!S(t,R))throw new Error(`Unsupported element type: ${t.type}`);if(this._config.output[t.id])return this._config.output[t.id]}_getDefaultInputConfig(){return"{}"}}class I extends(P()){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(()=>[])).filter(({origin:e})=>!(1===e.length&&e[0].id===t.id));return this._variables[t.id]=e,e}}var N=s(848);let L=[],F=[];function V(t){if(t<768)return!1;for(let e=0,n=L.length;;){let i=e+n>>1;if(t<L[i])n=i;else{if(!(t>=F[i]))return!0;e=i+1}if(e==n)return!1}}function j(t){return t>=127462&&t<=127487}function z(t,e,n=!0,i=!0){return(n?H:W)(t,e,i)}function H(t,e,n){if(e==t.length)return e;e&&q(t.charCodeAt(e))&&U(t.charCodeAt(e-1))&&e--;let i=$(t,e);for(e+=K(i);e<t.length;){let r=$(t,e);if(8205==i||8205==r||n&&V(r))e+=K(r),i=r;else{if(!j(r))break;{let n=0,i=e-2;for(;i>=0&&j($(t,i));)n++,i-=2;if(n%2==0)break;e+=2}}}return e}function W(t,e,n){for(;e>0;){let i=H(t,e-2,n);if(i<e)return i;e--}return 0}function $(t,e){let n=t.charCodeAt(e);if(!U(n)||e+1==t.length)return n;let i=t.charCodeAt(e+1);return q(i)?i-56320+(n-55296<<10)+65536:n}function q(t){return t>=56320&&t<57344}function U(t){return t>=55296&&t<56320}function K(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?F:L).push(n+=t[e])})();class G{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]=it(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]=it(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 Z(this),r=new Z(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 Z(this,t)}iterRange(t,e=this.length){return new tt(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 et(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 Y(t):Q.from(Y.split(t,[])):G.empty}}class Y extends G{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 nt(i,o,n,s);i=o+1,n++}}decompose(t,e,n,i){let r=t<=0&&e>=this.length?this:new Y(X(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(1&i){let t=n.pop(),e=J(r.text,t.text.slice(),0,r.length);if(e.length<=32)n.push(new Y(e,t.length+r.length));else{let t=e.length>>1;n.push(new Y(e.slice(0,t)),new Y(e.slice(t)))}}else n.push(r)}replace(t,e,n){if(!(n instanceof Y))return super.replace(t,e,n);[t,e]=it(this,t,e);let i=J(this.text,J(n.text,X(this.text,0,t)),e),r=this.length+n.length-(e-t);return i.length<=32?new Y(i,r):Q.from(Y.split(i,[]),r)}sliceString(t,e=this.length,n="\n"){[t,e]=it(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 Y(n,i)),n=[],i=-1);return i>-1&&e.push(new Y(n,i)),e}}class Q extends G{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]=it(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]=it(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 Y(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 Y&&l&&(e=h[h.length-1])instanceof Y&&t.lines+e.lines<=32?(l+=t.lines,a+=t.length+1,h[h.length-1]=new Y(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 J(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 X(t,e,n){return J(t,[""],e,n)}G.empty=new Y([""],0);class Z{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 Y?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 Y?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 Y){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 Y?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 tt{constructor(t,e,n){this.value="",this.done=!1,this.cursor=new Z(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 et{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&&(G.prototype[Symbol.iterator]=function(){return this.iter()},Z.prototype[Symbol.iterator]=tt.prototype[Symbol.iterator]=et.prototype[Symbol.iterator]=function(){return this});class nt{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 it(t,e,n){return[e=Math.max(0,Math.min(t.length,e)),Math.max(e,Math.min(t.length,n))]}function rt(t,e,n=!0,i=!0){return z(t,e,n,i)}function st(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 ot(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function lt(t){return t<65536?1:2}const at=/\r\n?|\n/;var ht=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(ht||(ht={}));class ct{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){pt(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 ct(t)}composeDesc(t){return this.empty?t:t.empty?this:mt(this,t)}mapDesc(t,e=!1){return t.empty?this:gt(this,t,e)}mapPos(t,e=-1,n=ht.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!=ht.Simple&&a>=t&&(n==ht.TrackDel&&i<t&&a>t||n==ht.TrackBefore&&i<t||n==ht.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 ct(t)}static create(t){return new ct(t)}}class ut extends ct{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 pt(this,(e,n,i,r,s)=>t=t.replace(i,i+(n-e),s),!1),t}mapDesc(t,e=!1){return gt(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(G.empty);n.push(s?t.slice(r,r+s):G.empty)}r+=s}return new ut(e,n)}compose(t){return this.empty?t:t.empty?this:mt(this,t,!0)}map(t,e=!1){return t.empty?this:gt(this,t,e,!0)}iterChanges(t,e=!1){pt(this,t,e)}get desc(){return ct.create(this.sections)}filter(t){let e=[],n=[],i=[],r=new vt(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);dt(i,t,-1);let s=-1==r.ins?-1:0==r.off?r.ins:0;dt(e,t,s),s>0&&ft(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);dt(e,t,-1),dt(i,t,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(t),o+=t}}return{changes:new ut(e,n),filtered:ct.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&&dt(i,e-s,-1);let n=new ut(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 ut){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?G.of(h.split(n||at)):h:G.empty,u=c.length;if(t==o&&0==u)return;t<s&&l(),t>s&&dt(i,t-s,-1),dt(i,o-t,u),ft(r,i,c),s=o}}(t),l(!o),o}static empty(t){return new ut(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(G.empty);n[i]=G.of(r.slice(1)),e.push(r[0],n[i].length)}}}return new ut(e,n)}static createSet(t,e){return new ut(t,e)}}function dt(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 ft(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(G.empty);t.push(n)}}function pt(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=G.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 gt(t,e,n,i=!1){let r=[],s=i?[]:null,o=new vt(t),l=new vt(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);dt(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(dt(r,l.ins,-1);e;){let n=Math.min(o.len,e);o.ins>=0&&t<o.i&&o.len<=n&&(dt(r,0,o.ins),s&&ft(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?ut.createSet(r,s):ct.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()}dt(r,e,t<o.i?o.ins:0),s&&t<o.i&&ft(s,r,o.text),t=o.i,o.forward(o.len-n)}}}}function mt(t,e,n=!1){let i=[],r=n?[]:null,s=new vt(t),o=new vt(e);for(let t=!1;;){if(s.done&&o.done)return r?ut.createSet(i,r):ct.create(i);if(0==s.ins)dt(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;dt(i,e,n,t),r&&n&&ft(r,i,o.text)}else-1==o.ins?(dt(i,s.off?0:s.len,e,t),r&&ft(r,i,s.textBit(e))):(dt(i,s.off?0:s.len,o.off?0:o.ins,t),r&&!o.off&&ft(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 dt(i,0,o.ins,t),r&&ft(r,i,o.text),o.next()}}class vt{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?G.empty:t[e]}textBit(t){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length&&!t?G.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 bt{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 bt(n,i,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return yt.range(t,e);let n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return yt.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 yt.range(t.anchor,t.head)}static create(t,e,n){return new bt(t,e,n)}}class yt{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:yt.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 yt([this.main],0)}addRange(t,e=!0){return yt.create([t].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(t,e=this.mainIndex){let n=this.ranges.slice();return n[e]=t,yt.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 yt(t.ranges.map(t=>bt.fromJSON(t)),t.main)}static single(t,e=t){return new yt([yt.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 yt.normalized(t.slice(),e);n=r.to}return new yt(t,e)}static cursor(t,e=0,n,i){return bt.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?bt.create(e,t,48|r):bt.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?yt.range(o,s):yt.range(s,o))}}return new yt(t,e)}}function wt(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let xt=0;class kt{constructor(t,e,n,i,r){this.combine=t,this.compareInput=e,this.compare=n,this.isStatic=i,this.id=xt++,this.default=t([]),this.extensions="function"==typeof r?r(this):r}get reader(){return this}static define(t={}){return new kt(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:At),!!t.static,t.enables)}of(t){return new St([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new St(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new St(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],n=>e(n.field(t)))}}function At(t,e){return t==e||t.length==e.length&&t.every((t,n)=>t===e[n])}class St{constructor(t,e,n,i){this.dependencies=t,this.facet=e,this.type=n,this.value=i,this.id=xt++}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)||Et(t,h)){let e=n(t);if(o?!Ct(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=Lt(e,a);if(this.dependencies.every(n=>n instanceof kt?e.facet(n)===t.facet(n):!(n instanceof Mt)||e.field(n,!1)==t.field(n,!1))||(o?Ct(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 Ct(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 Et(t,e){let n=!1;for(let i of e)1&Nt(t,i)&&(n=!0);return n}function Ot(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=Lt(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)Nt(t,e);return t.values[o]=l(t),1},update(t,n){if(!Et(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=Et(t,i),a=r.config.facets[e.id],h=r.facet(e);if(a&&!s&&At(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=kt.define({static:!0});class Mt{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 Mt(xt++,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 _t(t){return e=>new Dt(e,t)}const Pt={highest:_t(0),high:_t(1),default:_t(2),low:_t(3),lowest:_t(4)};class Dt{constructor(t,e){this.inner=t,this.prec=e}}class Rt{of(t){return new Bt(this,t)}reconfigure(t){return Rt.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class Bt{constructor(t,e){this.compartment=t,this.inner=e}}class It{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 Bt&&n.delete(s.compartment)}if(r.set(s,o),Array.isArray(s))for(let e of s)t(e,o);else if(s instanceof Bt){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 Dt)t(s.inner,s.prec);else if(s instanceof Mt)i[o].push(s),s.provides&&t(s.provides,o);else if(s instanceof St)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 Mt?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,At(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=>Ot(t,i,e))}}let c=a.map(t=>t(o));return new It(t,s,c,o,l,r)}}function Nt(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 Lt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const Ft=kt.define(),Vt=kt.define({combine:t=>t.some(t=>t),static:!0}),jt=kt.define({combine:t=>t.length?t[0]:void 0,static:!0}),zt=kt.define(),Ht=kt.define(),Wt=kt.define(),$t=kt.define({combine:t=>!!t.length&&t[0]});class qt{constructor(t,e){this.type=t,this.value=e}static define(){return new Ut}}class Ut{of(t){return new qt(this,t)}}class Kt{constructor(t){this.map=t}of(t){return new Gt(this,t)}}class Gt{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 Gt(this.type,e)}is(t){return this.type==t}static define(t={}){return new Kt(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}}Gt.reconfigure=Gt.define(),Gt.appendConfig=Gt.define();class Yt{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&&wt(n,e.newLength),r.some(t=>t.type==Yt.time)||(this.annotations=r.concat(Yt.time.of(Date.now())))}static create(t,e,n,i,r,s){return new Yt(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(Yt.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 Jt(t,e,n){var i;let r,s,o;return n?(r=e.changes,s=ut.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:Gt.mapEffects(t.effects,r).concat(Gt.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Xt(t,e,n){let i=e.selection,r=ee(e.annotations);return e.userEvent&&(r=r.concat(Yt.userEvent.of(e.userEvent))),{changes:e.changes instanceof ut?e.changes:ut.of(e.changes||[],n,t.facet(jt)),selection:i&&(i instanceof yt?i:yt.single(i.anchor,i.head)),effects:ee(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Zt(t,e,n){let i=Xt(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=Jt(i,Xt(t,e[r],s?i.changes.newLength:t.doc.length),s)}let r=Yt.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(t){let e=t.startState,n=e.facet(Wt),i=t;for(let r=n.length-1;r>=0;r--){let s=n[r](t);s&&Object.keys(s).length&&(i=Jt(i,Xt(e,s,t.changes.newLength),!0))}return i==t?t:Yt.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:Qt(n,e))}if(!0!==n){let i,r;if(!1===n)r=t.changes.invertedDesc,i=ut.empty(e.doc.length);else{let e=t.changes.filter(n);i=e.changes,r=e.filtered.mapDesc(e.changes).invertedDesc}t=Yt.create(e,i,t.selection&&t.selection.map(r),Gt.mapEffects(t.effects,r),t.annotations,t.scrollIntoView)}let i=e.facet(Ht);for(let n=i.length-1;n>=0;n--){let r=i[n](t);t=r instanceof Yt?r:Array.isArray(r)&&1==r.length&&r[0]instanceof Yt?r[0]:Zt(e,ee(r),!1)}return t}(r):r)}Yt.time=qt.define(),Yt.userEvent=qt.define(),Yt.addToHistory=qt.define(),Yt.remote=qt.define();const te=[];function ee(t){return null==t?te:Array.isArray(t)?t:[t]}var ne=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(ne||(ne={}));const ie=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let re;try{re=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}class se{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++)Nt(this,t<<1);this.computeSlot=null}field(t,e=!0){let n=this.config.address[t.id];if(null!=n)return Nt(this,n),Lt(this,n);if(e)throw new RangeError("Field is not present in this state")}update(...t){return Zt(this,t,!0)}applyTransaction(t){let e,n=this.config,{base:i,compartments:r}=n;for(let e of t.effects)e.is(Rt.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(Gt.reconfigure)?(n=null,i=e.value):e.is(Gt.appendConfig)&&(n=null,i=ee(i).concat(e.value));n?e=t.startState.values.slice():(n=It.resolve(i,r,this),e=new se(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(t,e)=>e.reconfigure(t,this),null).values);let s=t.startState.facet(Vt)?t.newSelection:t.newSelection.asSingle();new se(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:yt.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=ee(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=Gt.mapEffects(s,a).concat(Gt.mapEffects(ee(o.effects),h))}return{changes:i,selection:yt.create(r,e.mainIndex),effects:s}}changes(t=[]){return t instanceof ut?t:ut.of(t,this.doc.length,this.facet(se.lineSeparator))}toText(t){return G.of(t.split(this.facet(se.lineSeparator)||at))}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:(Nt(this,e),Lt(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 Mt&&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 se.create({doc:t.doc,selection:yt.fromJSON(t.selection),extensions:e.extensions?i.concat([e.extensions]):i})}static create(t={}){let e=It.resolve(t.extensions||[],new Map),n=t.doc instanceof G?t.doc:G.of((t.doc||"").split(e.staticFacet(se.lineSeparator)||at)),i=t.selection?t.selection instanceof yt?t.selection:yt.single(t.selection.anchor,t.selection.head):yt.single(0);return wt(i,n.length),e.staticFacet(Vt)||(i=i.asSingle()),new se(e,n,i,e.dynamicSlots.map(()=>null),(t,e)=>e.create(t),null)}get tabSize(){return this.facet(se.tabSize)}get lineBreak(){return this.facet(se.lineSeparator)||"\n"}get readOnly(){return this.facet($t)}phrase(t,...e){for(let e of this.facet(se.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(Ft))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 ne.Space;if(function(t){if(re)return re.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||ie.test(n)))return!0}return!1}(t))return ne.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return ne.Word;return ne.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=rt(e,s,!1);if(r(e.slice(t,s))!=ne.Word)break;s=t}for(;o<i;){let t=rt(e,o);if(r(e.slice(o,t))!=ne.Word)break;o=t}return s==o?null:yt.range(s+n,o+n)}}function oe(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}se.allowMultipleSelections=Vt,se.tabSize=kt.define({combine:t=>t.length?t[0]:4}),se.lineSeparator=jt,se.readOnly=$t,se.phrases=kt.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])}}),se.languageData=Ft,se.changeFilter=zt,se.transactionFilter=Ht,se.transactionExtender=Wt,Rt.reconfigure=Gt.define();class le{eq(t){return this==t}range(t,e=t){return ae.create(t,e,this)}}le.prototype.startSide=le.prototype.endSide=0,le.prototype.point=!1,le.prototype.mapMode=ht.TrackDel;class ae{constructor(t,e,n){this.from=t,this.to=e,this.value=n}static create(t,e,n){return new ae(t,e,n)}}function he(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class ce{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 ce(i,r,n,o):null,pos:s}}}class ue{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 ue(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(he)),this.isEmpty)return e.length?ue.of(e):this;let o=new pe(this,null,-1).goto(0),l=0,a=[],h=new de;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(ae.create(o.from,o.to,o.value))),o.next());return h.finishInner(this.nextLayer.isEmpty&&!a.length?ue.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 ue(n,e,r||ue.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 ge.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return ge.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=fe(s,o,n),a=new ve(s,l,r),h=new ve(o,l,r);n.iterGaps((t,e,n)=>be(a,t,h,e,n,i)),n.empty&&0==n.length&&be(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=fe(r,s),l=new ve(r,o,0).goto(n),a=new ve(s,o,0).goto(n);for(;;){if(l.to!=a.to||!ye(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 ve(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 de;for(let i of t instanceof ae?[t]:e?function(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let i=t[n];if(he(e,i)>0)return t.slice().sort(he);e=i}return t}(t):t)n.add(i.from,i.to,i.value);return n.finish()}static join(t){if(!t.length)return ue.empty;let e=t[t.length-1];for(let n=t.length-2;n>=0;n--)for(let i=t[n];i!=ue.empty;i=i.nextLayer)e=new ue(i.chunkPos,i.chunk,e,Math.max(i.maxPoint,e.maxPoint));return e}}ue.empty=new ue([],[],null,-1),ue.empty.nextLayer=ue.empty;class de{finishChunk(t){this.chunks.push(new ce(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 de)).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(ue.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=ue.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function fe(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 pe{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 ge{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 pe(s,e,n,r));return 1==i.length?i[0]:new ge(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--)me(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--)me(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(),me(this.heap,0)}}}function me(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 ve{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=ge.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){we(this.active,t),we(this.activeTo,t),we(this.activeRank,t),this.minActive=ke(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++;xe(this.active,e,n),xe(this.activeTo,e,i),xe(this.activeRank,e,r),t&&xe(t,e,this.cursor.from),this.minActive=ke(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&&we(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 be(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))&&ye(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(l,h,t.point,n.point):h>l&&!ye(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 ye(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 we(t,e){for(let n=e,i=t.length-1;n<i;n++)t[n]=t[n+1];t.pop()}function xe(t,e,n){for(let n=t.length-1;n>=e;n--)t[n+1]=t[n];t[e]=n}function ke(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 Ae(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=rt(t,r));return i}const Se="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Ce="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),Ee="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class Oe{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=Ee[Se]||1;return Ee[Se]=t+1,"ͼ"+t.toString(36)}static mount(t,e,n){let i=t[Ce],r=n&&n.nonce;i?r&&i.setNonce(r):i=new Me(t,r),i.mount(Array.isArray(e)?e:[e],t)}}let Te=new Map;class Me{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[Ce]=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[Ce]=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 _e={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:"'"},Pe={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},De="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Re="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Be=0;Be<10;Be++)_e[48+Be]=_e[96+Be]=String(Be);for(Be=1;Be<=24;Be++)_e[Be+111]="F"+Be;for(Be=65;Be<=90;Be++)_e[Be]=String.fromCharCode(Be+32),Pe[Be]=String.fromCharCode(Be);for(var Ie in _e)Pe.hasOwnProperty(Ie)||(Pe[Ie]=_e[Ie]);let Ne="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},Le="undefined"!=typeof document?document:{documentElement:{style:{}}};const Fe=/Edge\/(\d+)/.exec(Ne.userAgent),Ve=/MSIE \d/.test(Ne.userAgent),je=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ne.userAgent),ze=!!(Ve||je||Fe),He=!ze&&/gecko\/(\d+)/i.test(Ne.userAgent),We=!ze&&/Chrome\/(\d+)/.exec(Ne.userAgent),$e="webkitFontSmoothing"in Le.documentElement.style,qe=!ze&&/Apple Computer/.test(Ne.vendor),Ue=qe&&(/Mobile\/\w+/.test(Ne.userAgent)||Ne.maxTouchPoints>2);var Ke={mac:Ue||/Mac/.test(Ne.platform),windows:/Win/.test(Ne.platform),linux:/Linux|X11/.test(Ne.platform),ie:ze,ie_version:Ve?Le.documentMode||6:je?+je[1]:Fe?+Fe[1]:0,gecko:He,gecko_version:He?+(/Firefox\/(\d+)/.exec(Ne.userAgent)||[0,0])[1]:0,chrome:!!We,chrome_version:We?+We[1]:0,ios:Ue,android:/Android\b/.test(Ne.userAgent),webkit:$e,webkit_version:$e?+(/\bAppleWebKit\/(\d+)/.exec(Ne.userAgent)||[0,0])[1]:0,safari:qe,safari_version:qe?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Ne.userAgent)||[0,0])[1]:0,tabSize:null!=Le.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function Ge(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function Ye(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function Qe(t,e){if(!e.anchorNode)return!1;try{return Ye(t,e.anchorNode)}catch(t){return!1}}function Je(t){return 3==t.nodeType?un(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function Xe(t,e,n,i){return!!n&&(en(t,e,n,i,-1)||en(t,e,n,i,1))}function Ze(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function tn(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function en(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:nn(t))){if("DIV"==t.nodeName)return!1;let n=t.parentNode;if(!n||1!=n.nodeType)return!1;e=Ze(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?nn(t):0}}}function nn(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function rn(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function sn(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 on(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 ln{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?nn(e):0),n,Math.min(t.focusOffset,n?nn(n):0))}set(t,e,n,i){this.anchorNode=t,this.anchorOffset=e,this.focusNode=n,this.focusOffset=i}}let an,hn=null;function cn(t){if(t.setActive)return t.setActive();if(hn)return t.focus(hn);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(null==hn?{get preventScroll(){return hn={preventScroll:!0},!0}}:void 0),!hn){hn=!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 un(t,e,n=e){let i=an||(an=document.createRange());return i.setEnd(t,n),i.setStart(t,e),i}function dn(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 fn(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function pn(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function gn(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=nn(n)}else{if(!n.parentNode||tn(n))return null;i=Ze(n),n=n.parentNode}}}function mn(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||tn(n))return null;i=Ze(n)+1,n=n.parentNode}}}Ke.safari&&Ke.safari_version>=26&&(hn=!1);class vn{constructor(t,e,n=!0){this.node=t,this.offset=e,this.precise=n}static before(t,e){return new vn(t.parentNode,Ze(t),e)}static after(t,e){return new vn(t.parentNode,Ze(t)+1,e)}}const bn=[];class yn{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=yn.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=wn(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=wn(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==nn(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&&!yn.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=bn){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 xn(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 wn(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}yn.prototype.breakAfter=0;class xn{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 kn(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 An(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,kn(t,h,c,l,a,i,0,r,s)}class Sn extends yn{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 Sn)||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 Sn(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 vn(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?Ke.chrome||Ke.gecko||(e?(r--,o=1):s<i&&(s++,o=-1)):n<0?r--:s<i&&s++;let l=un(t,r,s).getClientRects();if(!l.length)return null;let a=l[(o?o<0:n>=0)?0:l.length-1];return Ke.safari&&!o&&0==a.width&&(a=Array.prototype.find.call(l,t=>t.width)||a),o?rn(a,o<0):a||null}(this.dom,t,e)}}class Cn extends yn{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(fn(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 Cn&&n.mark.eq(this.mark))||t&&r<=0||e<this.length&&s<=0)||(An(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 Cn(this.mark,e,s)}domAtPos(t){return Tn(this,t)}coordsAt(t,e){return _n(this,t,e)}}class En extends yn{static create(t,e,n){return new En(t,e,n)}constructor(t,e,n){super(),this.widget=t,this.length=e,this.side=n,this.prevWidget=null}split(t){let e=En.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 En&&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 En&&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 G.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):G.empty}domAtPos(t){return(this.length?0==t:this.side>0)?vn.before(this.dom):vn.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 rn(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 On extends yn{constructor(t){super(),this.side=t}get length(){return 0}merge(){return!1}become(t){return t instanceof On&&t.side==this.side}split(){return new On(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?vn.before(this.dom):vn.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return G.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 vn(n,0)}function Mn(t,e,n){let i,{children:r}=t;n>0&&e instanceof Cn&&r.length&&(i=r[r.length-1])instanceof Cn&&i.mark.eq(e.mark)?Mn(i,e.children[0],n-1):(r.push(e),e.setParent(t)),t.length+=e.length}function _n(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||Pn(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=Je(e);return n[n.length-1]||null}(t)}function Pn(t,e){let n=t.coordsAt(0,1),i=e.coordsAt(0,1);return n&&i&&i.top<n.bottom}function Dn(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}Sn.prototype.children=En.prototype.children=On.prototype.children=bn;const Rn=Object.create(null);function Bn(t,e,n){if(t==e)return!0;t||(t=Rn),e||(e=Rn);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 In(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 Nn(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 Ln{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 Fn=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Fn||(Fn={}));class Vn extends le{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 jn(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 Hn(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}=Wn(t,i);e=(r?i?-3e8:-1:5e8)-1,n=1+(s?i?2e8:1:-6e8)}return new Hn(t,e,n,i,t.widget||null,!0)}static line(t){return new zn(t)}static set(t,e=!1){return ue.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Vn.none=ue.empty;class jn extends Vn{constructor(t){let{start:e,end:n}=Wn(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 jn&&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))&&Bn(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)}}jn.prototype.point=!1;class zn extends Vn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof zn&&this.spec.class==t.spec.class&&Bn(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=ht.TrackBefore,zn.prototype.point=!0;class Hn extends Vn{constructor(t,e,n,i,r,s){super(e,n,r,t),this.block=i,this.isReplace=s,this.mapMode=i?e<=0?ht.TrackBefore:ht.TrackAfter:ht.TrackDel}get type(){return this.startSide!=this.endSide?Fn.WidgetRange:this.startSide<=0?Fn.WidgetBefore:Fn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Hn&&((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 Wn(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 $n(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)}Hn.prototype.point=!0;class qn extends yn{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 qn))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),An(this,t,e,n?n.children.slice():[],r,s),!0}split(t){let e=new qn;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){Bn(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Mn(this,t,e)}addLineDeco(t){let e=t.spec.attributes,n=t.spec.class;e&&(this.attrs=Dn(e,this.attrs||{})),n&&(this.attrs=Dn({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&&(fn(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&&(In(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&&yn.get(i)instanceof Cn;)i=i.lastChild;if(!(i&&this.length&&("BR"==i.nodeName||0!=(null===(n=yn.get(i))||void 0===n?void 0:n.isEditable)||Ke.ios&&this.children.some(t=>t instanceof Sn)))){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 Sn)||/[^ -~]/.test(n.text))return null;let i=Je(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=_n(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 qn&&0==this.children.length&&0==t.children.length&&Bn(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 qn)return r;if(s>e)break}i=s+r.breakAfter}return null}}class Un extends yn{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 Un&&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?vn.before(this.dom):vn.after(this.dom,t==this.length)}split(t){let e=this.length-t;this.length=t;let n=new Un(this.widget,e,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return bn}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):G.empty}domBoundsAround(){return null}become(t){return t instanceof Un&&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 Kn?null:rn(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 Kn extends Ln{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 Gn{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 Un&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new qn),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Yn(new On(-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 Un||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(Yn(new Sn(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 Hn){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 Hn)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Un(n.widget||Qn.block,o,n));else{let s=En.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(Yn(new On(1),i),r),r=i.length+Math.max(0,r-i.length)),h.append(Yn(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 Gn(t,e,n,r);return s.openEnd=ue.spans(i,e,n,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function Yn(t,e){for(let n of e)t=new Cn(n,[t],t.length);return t}class Qn extends Ln{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 Jn=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Jn||(Jn={}));const Xn=Jn.LTR,Zn=Jn.RTL;function ti(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const ei=ti("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),ni=ti("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ii=Object.create(null),ri=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);ii[e]=n,ii[n]=-e}function si(t){return t<=247?ei[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?ni[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const oi=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class li{get dir(){return this.level%2?Zn:Xn}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 ai(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||!ai(i.inner,r.inner))return!1}return!0}const hi=[];function ci(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=hi[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(hi[t]==l)break t;break}t=s[e++].to}h++,u?u.push(p):(p.from>a&&o.push(new li(a,p.from,d)),ui(t,p.direction==Xn!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,o),a=p.to),f=p.to}else{if(f==n||(e?hi[f]!=l:hi[f]==l))break;f++}u?ci(t,a,f,i+1,r,u,o):a<f&&o.push(new li(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=hi[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(hi[t-1]==l)break t;break}t=s[--n].from}u?u.push(p):(p.to<a&&o.push(new li(p.to,a,d)),ui(t,p.direction==Xn!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,o),a=p.from),f=p.from}else{if(f==e||(n?hi[f-1]!=l:hi[f-1]==l))break;f--}u?ci(t,f,a,i+1,r,u,o):f<a&&o.push(new li(f,a,d)),a=f}}function ui(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=si(t.charCodeAt(e));512==r?r=n:8==r&&4==i&&(r=16),hi[e]=4==r?2:r,7&r&&(i=r),n=r}for(let t=o,e=a,i=a;t<l;t++){let r=hi[t];if(128==r)t<l-1&&e==hi[t+1]&&24&e?r=hi[t]=e:hi[t]=256;else if(64==r){let r=t+1;for(;r<l&&64==hi[r];)r++;let s=t&&8==e||r<n&&8==hi[r]?1==i?1:8:256;for(let e=t;e<r;e++)hi[e]=s;t=r-1}else 8==r&&1==i&&(hi[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=ii[e=t.charCodeAt(o)])if(n<0){for(let t=l-3;t>=0;t-=3)if(ri[t+1]==-n){let e=ri[t+2],n=2&e?r:4&e?1&e?s:r:0;n&&(hi[o]=hi[ri[t]]=n),l=t;break}}else{if(189==ri.length)break;ri[l++]=o,ri[l++]=e,ri[l++]=a}else if(2==(i=hi[o])||1==i){let t=i==r;a=t?0:1;for(let e=l-3;e>=0;e-=3){let n=ri[e+2];if(2&n)break;if(t)ri[e+2]|=2;else{if(4&n)break;ri[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=hi[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!=hi[o])break;o++}let h=1==s,c=h==(1==(o<e?hi[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),hi[--e]=c;a=o}else s=o,a++}}}(r,s,i,l),ci(t,r,s,e,n,i,o)}function di(t){return[new li(0,t,0)]}let fi="";function pi(t,e,n,i,r){var s;let o=i.head-t.from,l=li.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=rt(t.text,o,a.forward(r,n));(c<a.from||c>a.to)&&(c=h),fi=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?yt.cursor(u.side(!r,n)+t.from,u.forward(r,n)?1:-1,u.level):yt.cursor(c+t.from,a.forward(r,n)?-1:1,a.level)}function gi(t,e,n){for(let i=e;i<n;i++){let e=si(t.charCodeAt(i));if(1==e)return Xn;if(2==e||4==e)return Zn}return Xn}const mi=kt.define(),vi=kt.define(),bi=kt.define(),yi=kt.define(),wi=kt.define(),xi=kt.define(),ki=kt.define(),Ai=kt.define(),Si=kt.define(),Ci=kt.define({combine:t=>t.some(t=>t)}),Ei=kt.define({combine:t=>t.some(t=>t)}),Oi=kt.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(yt.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Mi=Gt.define({map:(t,e)=>t.map(e)}),_i=Gt.define();function Pi(t,e,n){let i=t.facet(yi);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 Di=kt.define({combine:t=>!t.length||t[0]});let Ri=0;const Bi=kt.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 Ii{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(Bi.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(Bi.of({plugin:this,arg:t}))}static define(t,e){const{eventHandlers:n,eventObservers:i,provide:r,decorations:s}=e||{};return new Ii(Ri++,t,n,i,t=>{let e=[];return s&&e.push(Vi.of(e=>{let n=e.plugin(t);return n?s(n):Vn.none})),r&&e.push(r(t)),e})}static fromClass(t,e){return Ii.define((e,n)=>new t(e,n),e)}}class Ni{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(Pi(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){Pi(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){Pi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Li=kt.define(),Fi=kt.define(),Vi=kt.define(),ji=kt.define(),zi=kt.define(),Hi=kt.define();function Wi(t,e){let n=t.state.facet(Hi);if(!n.length)return n;let i=n.map(e=>e instanceof Function?e(t):e),r=[];return ue.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=gi(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 $i=kt.define();function qi(t){let e=0,n=0,i=0,r=0;for(let s of t.state.facet($i)){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 Ui=kt.define();class Ki{constructor(t,e,n,i){this.fromA=t,this.toA=e,this.fromB=n,this.toB=i}join(t){return new Ki(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 Ki(s+a,l+a,s,l).addToSet(n),i>h)break;r+=2}if(!l)return n;new Ki(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),s=l.toA,o=l.toB}}}class Gi{constructor(t,e,n){this.view=t,this.state=e,this.transactions=n,this.flags=0,this.startState=t.state,this.changes=ut.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 Ki(t,e,n,r))),this.changedRanges=i}static create(t,e,n){return new Gi(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 Yi extends yn{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=Vn.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 qn],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ki(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 Ki(a.mapPos(s),a.mapPos(o),s,o),c=[];for(let e=r.parentNode;;e=e.parentNode){let n=yn.get(e);if(n instanceof Cn)c.push({node:e,deco:n.mark});else{if(n instanceof qn||"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 jn({inclusive:!0,attributes:Nn(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 Ki(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,(Ke.ie||Ke.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let s=function(t,e,n){let i=new Ji;return ue.compare(t,e,n,i),i.changes}(this.decorations,this.updateDeco(),t.changes);return n=Ki.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=Ke.chrome||Ke.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 Un&&t.widget instanceof Kn&&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=Gn.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),e=Gn.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}=Gn.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);kn(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(_i)&&(this.editContextFormatting=t.value)}compositionView(t){let e=new Sn(t.text.nodeValue);e.flags|=8;for(let{deco:n}of t.marks)e=new Cn(n,[e],e.length);let n=new qn;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=yn.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(Di)||this.dom.tabIndex>-1)&&Qe(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(Ke.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 vn(t,0),s=!0}var h;let c=this.view.observer.selectionRange;!s&&c.focusNode&&(Xe(l.node,l.offset,c.anchorNode,c.anchorOffset)&&Xe(a.node,a.offset,c.focusNode,c.focusOffset)||this.suppressWidgetCursorChange(c,o))||(this.view.observer.ignore(()=>{Ke.android&&Ke.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=Ge(this.view.root);if(t)if(o.empty){if(Ke.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?gn:mn)(l.node,l.offset);e&&(l=new vn(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 vn(c.anchorNode,c.anchorOffset),this.impreciseHead=a.precise?null:new vn(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Xe(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=Ge(t.root),{anchorNode:i,anchorOffset:r}=t.observer.selectionRange;if(!(n&&e.empty&&e.assoc&&n.modify))return;let s=qn.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=yn.get(n.childNodes[i]);t instanceof qn&&(e=t.domAtPos(0))}for(let i=t.offset-1;!e&&i>=0;i--){let t=yn.get(n.childNodes[i]);t instanceof qn&&(e=t.domAtPos(t.length))}return e?new vn(e.node,e.offset,!0):t}nearest(t){for(let e=t;e;){let t=yn.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 qn)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 qn&&!(n instanceof qn&&e>=0)))n=o,i=a;else if(n&&a==t&&l==t&&o instanceof Un&&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 qn))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 Sn))return null;let r=rt(i.text,n);if(r==n)return null;let s=un(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==Jn.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?Je(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?Jn.RTL:Jn.LTR}measureTextSize(){for(let t of this.children)if(t instanceof qn){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=Je(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 xn(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(Vn.replace({widget:new Kn(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!r)break;n=r.to+1}return Vn.set(t)}updateDeco(){let t=1,e=this.view.state.facet(Vi).map(e=>(this.dynamicDecorationMap[t++]="function"==typeof e)?e(this.view):e),n=!1,i=this.view.state.facet(ji).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(ue.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(Oi))try{if(e(this.view,t.range,t))return!0}catch(t){Pi(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=qi(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=sn(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}=on(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==Jn.LTR)}lineHasWidget(t){let{i:e}=this.childCursor().findPos(t);if(e==this.children.length)return!1;let n=t=>t instanceof En||t.children.some(n);return n(this.children[e])}}function Qi(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let i=gn(n.focusNode,n.focusOffset),r=mn(n.focusNode,n.focusOffset),s=i||r;if(r&&i&&r.node!=i.node){let e=yn.get(r.node);if(!e||e instanceof Sn&&e.text!=r.node.nodeValue)s=r;else if(t.docView.lastCompositionAfterCursor){let t=yn.get(i.node);!t||t instanceof Sn&&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 Ji=class{constructor(){this.changes=[]}compareRange(t,e){$n(t,e,this.changes)}comparePoint(t,e){$n(t,e,this.changes)}boundChange(t){$n(t,t,this.changes)}};function Xi(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function Zi(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function tr(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function er(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function nr(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function ir(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=Je(d);for(let f=0;f<t.length;f++){let p=t[f];r&&tr(r,p)&&(p=er(nr(p,r.bottom),r.top));let g=Xi(e,p),m=Zi(n,p);if(0==g&&0==m)return 3==d.nodeType?rr(d,e,n):ir(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&&tr(h,p)?h=nr(h,p.bottom):c&&tr(c,p)&&(c=er(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?rr(i,d,n):u&&"false"!=i.contentEditable?ir(i,d,n):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,i)+(e>=(r.left+r.right)/2?1:0)}}function rr(t,e,n){let i=t.nodeValue.length,r=-1,s=1e9,o=0;for(let l=0;l<i;l++){let i=un(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(Ke.chrome||Ke.gecko){let e=un(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 sr(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!=Fn.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:or(t,l,o,c,u);if(f>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:or(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)||Ke.safari&&function(t,e,n){return lr(t,e,n)}(v,b,c)||Ke.chrome&&function(t,e,n){if(0!=e)return lr(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():un(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}(v,b,c))&&(v=void 0),v&&(b=Math.min(nn(v),b))}if(!v||!t.docView.dom.contains(v)){let e=qn.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:v,offset:b}=ir(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 or(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=rt(t,i)}return t.length}(o,s,t.state.tabSize)}function lr(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 un(t,i-1,i).getBoundingClientRect().right>n}function ar(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=pi(r,s,o,l,n),h=fi;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 hr(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 cr(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=hr(t,r.from,0);e!=r.from&&(s=yt.cursor(e,-1))}else{let e=hr(t,r.from,-1),n=hr(t,r.to,1);e==r.from&&n==r.to||(s=yt.range(r.from==r.anchor?e:n,r.from==r.head?e:n))}s&&(n||(n=e.ranges.slice()),n[i]=s)}return n?yt.create(n,e.mainIndex):e}function ur(t,e,n){let i=hr(t.state.facet(zi).map(e=>e(t)),n.from,e.head>n.from?-1:1);return i==n.from?n:yt.cursor(i,i<n.from?1:-1)}const dr="";class fr{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(se.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=dr}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=yn.get(i),o=yn.get(r);(s&&o?s.breakAfter:(s?s.breakAfter:tn(i))||tn(r)&&("BR"!=i.nodeName||i.cmIgnore)&&this.text.length>t)&&!gr(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=yn.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+(pr(t,n.node,n.offset)?e:0))}}function pr(t,e,n){for(;;){if(!e||n<nn(e))return!1;if(e==t)return!0;n=Ze(e)+1,e=e.parentNode}}function gr(t,e){let n;for(;t!=e&&t;t=t.nextSibling){let e=yn.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 mr{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class vr{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 mr(n,i)),r==n&&s==i||e.push(new mr(r,s))),e}(t),n=new fr(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?yt.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||!Ye(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||!Ye(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset),o=t.viewport;if((Ke.ios||Ke.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(yt.range(i,n)):this.newSel=yt.single(i,n)}}}function br(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||Ke.android&&e.text.length<o-i)&&(l=r.to,a="end");let h=wr(t.state.doc.sliceString(i,o,dr),e.text,l-i,a);h&&(Ke.chrome&&13==s&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==dr+dr&&h.toB--,n={from:i+h.from,to:i+h.toA,insert:G.of(e.text.slice(h.from,h.toB).split(dr))})}else i&&(!t.hasFocus&&t.state.facet(Di)||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)}:(Ke.mac||Ke.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=yt.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:G.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)}:Ke.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&t.lineWrapping&&(i&&(i=yt.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:G.of([" "])}),n)return yr(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=cr(t.state.facet(zi).map(e=>e(t)),i))),t.dispatch({selection:i,scrollIntoView:e,userEvent:n}),!0}return!1}function yr(t,e,n,i=-1){if(Ke.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(Ke.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&&dn(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)&&dn(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&0==e.insert.length&&dn(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=hr(r.facet(zi).map(e=>e(t)),i,n);e.from==l&&(o=l)}if(o>-1)i={changes:e,selection:yt.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&&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;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?yt.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(xi).some(n=>n(t,e.from,e.to,o,l))||t.dispatch(l()),!0}function wr(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 xr{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,Ke.safari&&t.contentDOM.addEventListener("input",()=>null),Ke.gecko&&function(t){Gr.has(t)||(Gr.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=yn.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=Ar(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&&Er.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Ke.android&&Ke.chrome&&!t.synthetic&&(13==t.keyCode||8==t.keyCode))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return!Ke.ios||t.synthetic||t.altKey||t.metaKey||!((e=Sr.find(e=>e.keyCode==t.keyCode))&&!t.ctrlKey||Cr.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,dn(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||!!(Ke.safari&&!Ke.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 kr(t,e){return(n,i)=>{try{return e.call(t,i,n)}catch(t){Pi(n.state,t)}}}function Ar(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(kr(e.value,r))}if(r)for(let t in r){let i=r[t];i&&n(t).observers.push(kr(e.value,i))}}for(let t in Mr)n(t).handlers.push(Mr[t]);for(let t in _r)n(t).observers.push(_r[t]);return e}const Sr=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Cr="dthko",Er=[16,17,18,20,91,92,224,225];function Or(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(se.allowMultipleSelections)&&function(t,e){let n=t.state.facet(mi);return n.length?n[0](e):Ke.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=Ge(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!=Hr(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=qi(this.view);t.clientX-h.left<=s+6?i=-Or(s-t.clientX):t.clientX+h.right>=l-6&&(i=Or(t.clientX-l)),t.clientY-h.top<=o+6?r=-Or(o-t.clientY):t.clientY+h.bottom>=a-6&&(r=Or(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=cr(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 Mr=Object.create(null),_r=Object.create(null),Pr=Ke.ie&&Ke.ie_version<15||Ke.ios&&Ke.webkit_version<604;function Dr(t,e,n){for(let i of t.facet(e))n=i(n,t);return n}function Rr(t,e){e=Dr(t.state,Ai,e);let n,{state:i}=t,r=1,s=i.toText(e),o=s.lines==i.selection.ranges.length;if(null!=$r&&i.selection.ranges.every(t=>t.empty)&&$r==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:yt.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:yt.cursor(t.from+e.length)}}):i.replaceSelection(s);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function Br(t,e,n,i){if(1==i)return yt.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 yt.cursor(e);0==s?n=1:s==r.length&&(n=-1);let o=s,l=s;n<0?o=rt(r.text,s,!1):l=rt(r.text,s);let a=i(r.text.slice(o,l));for(;o>0;){let t=rt(r.text,o,!1);if(i(r.text.slice(t,o))!=a)break;o=t}for(;l<r.length;){let t=rt(r.text,l);if(i(r.text.slice(l,t))!=a)break;l=t}return yt.range(o+r.from,l+r.from)}(t.state,e,n);{let n=qn.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++,yt.range(r,s)}}_r.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},Mr.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),27==e.keyCode&&0!=t.inputState.tabFocusMode&&(t.inputState.tabFocusMode=Date.now()+2e3),!1),_r.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},_r.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},Mr.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(bi))if(n=i(t,e),n)break;if(n||0!=e.button||(n=function(t,e){let n=Lr(t,e),i=Hr(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=Lr(t,e),h=Br(t,a.pos,a.bias,i);if(n.pos!=a.pos&&!s){let e=Br(t,n.pos,n.bias,i),r=Math.min(e.from,h.from),s=Math.max(e.to,h.to);h=r<h.from?yt.range(r,s):yt.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 yt.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):yt.create([h])}}}(t,e)),n){let i=!t.hasFocus;t.inputState.startMouseSelection(new Tr(t,e,n,i)),i&&t.observer.ignore(()=>{cn(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 Ir=(t,e,n)=>e>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function Nr(t,e,n,i){let r=qn.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&&Ir(n,i,o))return-1;let l=r.coordsAt(s,1);return l&&Ir(n,i,l)?1:o&&o.bottom>=i?-1:1}function Lr(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Nr(t,n,e.clientX,e.clientY)}}const Fr=Ke.ie&&Ke.ie_version<=11;let Vr=null,jr=0,zr=0;function Hr(t){if(!Fr)return t.detail;let e=Vr,n=zr;return Vr=t,zr=Date.now(),jr=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(jr+1)%3:1}function Wr(t,e,n,i){if(!(n=Dr(t.state,Ai,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(vi);return n.length?n[0](e):Ke.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}Mr.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=yt.range(t,e))}}let{inputState:i}=t;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Dr(t.state,Si,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Mr.dragend=t=>(t.inputState.draggedContent=null,!1),Mr.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&&Wr(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 Wr(t,e,n,!0),!0}return!1},Mr.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=Pr?null:e.clipboardData;return n?(Rr(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(),Rr(t,n.value)},50)}(t),!1)};let $r=null;Mr.copy=Mr.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:Dr(t,Si,e.join(t.lineBreak)),ranges:n,linewise:i}}(t.state);if(!n&&!r)return!1;$r=r?n:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=Pr?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 qr=qt.define();function Ur(t,e){let n=[];for(let i of t.facet(ki)){let r=i(t,e);r&&n.push(r)}return n.length?t.update({effects:n,annotations:qr.of(!0)}):null}function Kr(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=Ur(t.state,e);n?t.dispatch(n):t.update([])}},10)}_r.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),Kr(t)},_r.blur=t=>{t.observer.clearSelectionRange(),Kr(t)},_r.compositionstart=_r.compositionupdate=t=>{t.observer.editContext||(null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))},_r.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,Ke.chrome&&Ke.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))},_r.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Mr.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 yr(t,{from:n,to:s,insert:t.state.toText(i)},null),!0}}let r;if(Ke.chrome&&Ke.android&&(r=Sr.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 Ke.ios&&"deleteContentForward"==e.inputType&&t.observer.flushSoon(),Ke.safari&&"insertText"==e.inputType&&t.inputState.composing>=0&&setTimeout(()=>_r.compositionend(t,e),20),!1};const Gr=new Set,Yr=["pre-wrap","normal","pre-line","break-spaces"];let Qr=!1;function Jr(){Qr=!1}class Xr{constructor(t){this.lineWrapping=t,this.doc=G.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 Yr.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=Yr.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 Zr{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class ts{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?Fn.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 Hn?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 ts(this.from,this.length+t.length,this.top,this.height+t.height,e)}}var es=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(es||(es={}));const ns=.001;class is{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)>ns&&(Qr=!0),this.height=t)}replace(t,e,n){return is.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,es.ByPosNoHeight,n.setDoc(e),0,0),d=u.to>=a?u:r.lineAt(a,es.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,es.ByPosNoHeight,n,0,0));h+=u.from-l,l=u.from;let f=cs.build(n.setDoc(s),t,h,c);r=rs(r,r.replace(l,a,f))}return r.updateHeight(n,0)}static empty(){return new os(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 as(is.of(t.slice(0,e)),s,is.of(t.slice(n)))}}function rs(t,e){return t==e?t:(t.constructor!=e.constructor&&(Qr=!0),e)}is.prototype.size=1;class ss extends is{constructor(t,e,n){super(t,e),this.deco=n}blockAt(t,e,n,i){return new ts(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 os extends ss{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,n,i){return new ts(i,this.length,n,this.height,this.breaks)}replace(t,e,n){let i=n[0];return 1==n.length&&(i instanceof os||i instanceof ls&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof ls?i=new os(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):is.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 ls extends is{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 ts(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 ts(l,a,n+o*i,o,0)}}lineAt(t,e,n,i,r){if(e==es.ByHeight)return this.blockAt(t,n,i,r);if(e==es.ByPosNoHeight){let{from:e,to:i}=n.doc.lineAt(t);return new ts(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 ts(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 ts(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 ls?n[n.length-1]=new ls(t.length+i):n.push(null,new ls(i-1))}if(t>0){let e=n[0];e instanceof ls?n[0]=new ls(t+e.length):n.unshift(new ls(t-1),null)}return is.of(n)}decomposeLeft(t,e){e.push(new ls(t-1),null)}decomposeRight(t,e){e.push(null,new ls(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 ls(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)>=ns&&(o=-2);let l=new os(e,r);l.outdated=!1,n.push(l),s+=e+1}s<=r&&n.push(null,new ls(r-s).updateHeight(t,s));let l=is.of(n);return(o<0||Math.abs(l.height-this.height)>=ns||Math.abs(o-this.heightMetrics(t,e).perLine)>=ns)&&(Qr=!0),rs(this,l)}return(n||this.outdated)&&(this.setHeight(t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class as extends is{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==es.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==es.ByPosNoHeight?es.ByPosNoHeight:es.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,es.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&&hs(r,s-1),e<this.length){let t=r.length;this.decomposeRight(e,r),hs(r,t)}return is.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?is.of(this.break?[t,null,e]:[t,e]):(this.left=rs(this.left,t),this.right=rs(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 hs(t,e){let n,i;null==t[e]&&(n=t[e-1])instanceof ls&&(i=t[e+1])instanceof ls&&t.splice(e-1,3,new ls(n.length+1+i.length))}class cs{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 os?n.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new os(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 ss(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 os(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let n=new ls(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 os)return t;let e=new os(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 os||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new os(0,-1));let n=t;for(let t of this.nodes)t instanceof os&&t.updateHeight(this.oracle,n),n+=t?t.length:1;return this.nodes}static build(t,e,n,i){let r=new cs(n,t);return ue.spans(e,n,i,r,0),r.finish(n)}}class us{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,n,i){(t<e||n&&n.heightRelevant||i&&i.heightRelevant)&&$n(t,e,this.changes,5)}}function ds(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 fs(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class ps{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 Vn.replace({widget:new gs(this.displaySize*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}}class gs extends Ln{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 ms{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=ws,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Jn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let e=t.facet(Fi).some(t=>"function"!=typeof t&&"cm-lineWrapping"==t.class);this.heightOracle=new Xr(e),this.stateDeco=t.facet(Vi).filter(t=>"function"!=typeof t),this.heightMap=is.empty().applyChanges(this.stateDeco,G.empty,this.heightOracle.setDoc(t.doc),[new Ki(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=Vn.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 vs(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?ws:new xs(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(ks(t,this.scaler))})}update(t,e=null){this.state=t.state;let n=this.stateDeco;this.stateDeco=this.state.facet(Vi).filter(t=>"function"!=typeof t);let i=t.changedRanges,r=Ki.extendWithRanges(i,function(t,e,n){let i=new us;return ue.compare(t,e,n,i,0),i.changes}(n,this.stateDeco,t?t.changes:ut.empty(this.state.doc.length))),s=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Jr(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=s||Qr)&&(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(Ei)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,n=window.getComputedStyle(e),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Jn.RTL:Jn.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}=on(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=pn(t.scrollDOM);let f=(this.printing?fs:ds)(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)),Jr();for(let n of this.viewports){let r=n.from==this.viewport.from?e:t.docView.measureVisibleLineHeights(n);this.heightMap=(s?is.empty().applyChanges(this.stateDeco,G.empty,this.heightOracle,[new Ki(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(i,0,s,new Zr(n.from,r))}Qr&&(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 vs(i.lineAt(s-1e3*n,es.ByHeight,r,0,0).from,i.lineAt(o+1e3*(1-n),es.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,es.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 vs(i.lineAt(n-500,es.ByHeight,r,0,0).from,i.lineAt(n+s+500,es.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 vs(this.heightMap.lineAt(n,es.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,es.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,es.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(e,es.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 ps(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!=Jn.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(yt.cursor(s),!1,!0).head;t>i&&(s=t)}let t=this.gapSize(a,i,s,h);d=new ps(i,s,t,n||t<2e6?t:2e6)}o.push(d)},a=e=>{if(e.length<s||e.type!=Fn.Text)return;let r=function(t,e,n){let i=[],r=t,s=0;return ue.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=ys(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=bs(r,t),a=bs(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=ys(r,h),e=((f-d)/2+s)/n;c=t-e,u=t+e}else c=(d-s)/n,u=(f+s)/n;o=bs(r,c),a=bs(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=ys(i,n)-ys(i,e);return this.heightOracle.lineWrapping?t.height*r:i.total*this.heightOracle.charWidth*r}updateLineGaps(t){ps.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=Vn.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=[];ue.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)||ks(this.heightMap.lineAt(t,es.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)||ks(this.heightMap.lineAt(this.scaler.fromDOM(t),es.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 ks(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 vs{constructor(t,e){this.from=t,this.to=e}}function bs({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 ys(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 ws={toDOM:t=>t,fromDOM:t=>t,scale:1,eq(t){return t==this}};class xs{constructor(t,e,n){let i=0,r=0,s=0;this.viewports=n.map(({from:n,to:r})=>{let s=e.lineAt(n,es.ByPos,t,0,0).top,o=e.lineAt(r,es.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 xs&&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 ks(t,e){if(1==e.scale)return t;let n=e.toDOM(t.top),i=e.toDOM(t.bottom);return new ts(t.from,t.length,n,i-n,Array.isArray(t._content)?t._content.map(t=>ks(t,e)):t._content)}const As=kt.define({combine:t=>t.join(" ")}),Ss=kt.define({combine:t=>t.indexOf(!0)>-1}),Cs=Oe.newName(),Es=Oe.newName(),Os=Oe.newName(),Ts={"&light":"."+Es,"&dark":"."+Os};function Ms(t,e,n){return new Oe(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 _s=Ms("."+Cs,{"&":{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),Ps={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Ds=Ke.ie&&Ke.ie_version<=11;class Rs{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new ln,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);(Ke.ie&&Ke.ie_version<=11||Ke.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||!Ke.android||!1===t.constructor.EDIT_CONTEXT||Ke.chrome&&Ke.chrome_version<126||(this.editContext=new Ns(t),t.state.facet(Di)&&(t.contentDOM.editContext=this.editContext.editContext)),Ds&&(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(Di)?n.root.activeElement!=this.dom:!Qe(this.dom,i))return;let r=i.anchorNode&&n.docView.nearest(i.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(Ke.ie&&Ke.ie_version<=11||Ke.android&&Ke.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Xe(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Ge(t.root);if(!e)return!1;let n=Ke.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 Is(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?Is(t,n):null}(this.view,e)||e;if(!n||this.selectionRange.eq(n))return!1;let i=Qe(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,nn(n));;)if(i){if(1!=n.nodeType)return!1;let t=n.childNodes[i-1];"false"==t.contentEditable?i--:(n=t,i=nn(n))}else{if(n==t)return!0;i=Ze(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,Ps),Ds&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Ds&&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&&dn(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&&Qe(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 vr(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=br(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=Bs(e,t.previousSibling||t.target.previousSibling,-1),i=Bs(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(Di)!=t.state.facet(Di)&&(t.view.contentDOM.editContext=t.state.facet(Di)?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 Bs(t,e,n){for(;e;){let i=yn.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 Is(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 Xe(o.node,o.offset,r,s)&&([n,i,r,s]=[r,s,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}}class Ns{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=wr(t.state.sliceDoc(o,l),n.text,(a?i.from:i.to)-o,a?"end":null);if(!h){let e=yt.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:G.of(n.text.slice(h.from,h.toB).split("\n"))};if((Ke.mac||Ke.android)&&c.from==s-1&&/^\. ?$/.test(n.text)&&"off"==t.contentDOM.getAttribute("autocorrect")&&(c={from:o,to:l,insert:G.of([n.text.replace("."," ")])}),this.pendingContextChange=c,!t.state.readOnly){let e=this.to-this.from+(c.to-c.from+c.insert.length);yr(t,c,yt.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(Vn.mark({attributes:{style:t}}).range(r,s))}}}t.dispatch({effects:_i.of(Vn.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=Ge(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 Ls{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 ms(t.state||se.create(t)),t.scrollTo&&t.scrollTo.is(Mi)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Bi).map(t=>new Ni(t));for(let t of this.plugins)t.update(this);this.observer=new Rs(this),this.inputState=new xr(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Yi(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 Yt?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(qr))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=Ur(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(se.phrases)!=this.state.facet(se.phrases))return this.setState(r);e=Gi.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:yt.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(Mi)&&(c=t.value.clip(this.state))}this.viewState.update(e,c),this.bidiCache=js.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),n=this.docView.update(e),this.state.facet(Ui)!=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(As)!=e.state.facet(As)&&(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(wi))try{t(e)}catch(t){Pi(this.state,t,"update listener")}(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!br(this,h)&&a.force&&dn(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 ms(t),this.plugins=t.facet(Bi).map(t=>new Ni(t)),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView.destroy(),this.docView=new Yi(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(Bi),n=t.state.facet(Bi);if(e!=n){let i=[];for(let r of n){let n=e.indexOf(r);if(n<0)i.push(new Ni(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){Pi(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(pn(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 Pi(this.state,t),Vs}}),h=Gi.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]!=Vs)try{let e=l[t];e.write&&e.write(a[t],this)}catch(t){Pi(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(wi))t(e)}get themeClasses(){return Cs+" "+(this.state.facet(Ss)?Os:Es)+" "+this.state.facet(As)}updateAttrs(){let t=zs(this,Li,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Di)?"true":"false",class:"cm-content",style:`${Ke.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),zs(this,Fi,e);let n=this.observer.ignore(()=>{let n=In(this.contentDOM,this.contentAttrs,e),i=In(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(Ls.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value)}mountStyles(){this.styleModules=this.state.facet(Ui);let t=this.state.facet(Ls.cspNonce);Oe.mount(this.root,this.styleModules.concat(_s).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 ur(this,t,ar(this,t,e,n))}moveByGroup(t,e){return ur(this,t,ar(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==ne.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 yt.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!=Fn.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==Fn.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==Jn.LTR)?e.right-1:e.left+1,y:(s.top+s.bottom)/2});if(null!=o)return yt.cursor(o,n?-1:1)}return yt.cursor(n?r.to:r.from,n?-1:1)}(this,t,e,n)}moveVertically(t,e,n){return ur(this,t,function(t,e,n,i){let r=e.head,s=n?1:-1;if(r==(n?t.state.doc.length:0))return yt.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=sr(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 yt.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(),sr(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 rn(n,r[li.find(r,t-i.from,-1,e)].dir==Jn.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(Ci)||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>Fs)return di(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||ai(i.isolates,e=Wi(this,t))))return i.order;e||(e=Wi(this,t));let i=function(t,e,n){if(!t)return[new li(0,0,e==Zn?1:0)];if(e==Xn&&!n.length&&!oi.test(t))return di(t.length);if(n.length)for(;t.length>hi.length;)hi[hi.length]=256;let i=[],r=e==Xn?0:1;return ui(t,r,r,n,0,t.length,i),i}(t.text,n,e);return this.bidiCache.push(new js(t.from,t.to,n,e,!0,i)),i}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Ke.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{cn(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 Mi.of(new Ti("number"==typeof t?yt.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 Mi.of(new Ti(yt.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 Ii.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Ii.define(()=>({}),{eventObservers:t})}static theme(t,e){let n=Oe.newName(),i=[As.of(n),Ui.of(Ms(`.${n}`,t))];return e&&e.dark&&i.push(Ss.of(!0)),i}static baseTheme(t){return Pt.lowest(Ui.of(Ms("."+Cs,t,Ts)))}static findFromDOM(t){var e;let n=t.querySelector(".cm-content"),i=n&&yn.get(n)||yn.get(t);return(null===(e=null==i?void 0:i.rootView)||void 0===e?void 0:e.view)||null}}Ls.styleModule=Ui,Ls.inputHandler=xi,Ls.clipboardInputFilter=Ai,Ls.clipboardOutputFilter=Si,Ls.scrollHandler=Oi,Ls.focusChangeEffect=ki,Ls.perLineTextDirection=Ci,Ls.exceptionSink=yi,Ls.updateListener=wi,Ls.editable=Di,Ls.mouseSelectionStyle=bi,Ls.dragMovesSelection=vi,Ls.clickAddsSelectionRange=mi,Ls.decorations=Vi,Ls.outerDecorations=ji,Ls.atomicRanges=zi,Ls.bidiIsolatedRanges=Hi,Ls.scrollMargins=$i,Ls.darkTheme=Ss,Ls.cspNonce=kt.define({combine:t=>t.length?t[0]:""}),Ls.contentAttributes=Fi,Ls.editorAttributes=Li,Ls.lineWrapping=Ls.contentAttributes.of({class:"cm-lineWrapping"}),Ls.announce=Gt.define();const Fs=4096,Vs={};class js{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:Jn.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 js(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&&Dn(s,n)}return n}const Hs=Ke.mac?"mac":Ke.windows?"win":Ke.linux?"linux":"key";function Ws(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 $s=Pt.default(Ls.domEventHandlers({keydown:(t,e)=>function(t,e,n,i){Ys=e;let r=function(t){var e=!(De&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Re&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Pe:_e)[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=lt(st(r,0))==r.length&&" "!=r,o="",l=!1,a=!1,h=!1;Ks&&Ks.view==n&&Ks.scope==i&&(o=Ks.prefix+" ",Er.indexOf(e.keyCode)<0&&(a=!0,Ks=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+Ws(r,e,!s)])?l=!0:!s||!(e.altKey||e.metaKey||e.ctrlKey)||Ke.windows&&e.ctrlKey&&e.altKey||Ke.mac&&e.altKey&&!e.ctrlKey&&!e.metaKey||!(c=_e[e.keyCode])||c==r?s&&e.shiftKey&&f(p[o+Ws(r,e,!0)])&&(l=!0):(f(p[o+Ws(c,e,!0)])||e.shiftKey&&(u=Pe[e.keyCode])!=r&&u!=c&&f(p[o+Ws(u,e,!1)]))&&(l=!0),!l&&f(p._any)&&(l=!0)),a&&(l=!0),l&&h&&e.stopPropagation(),Ys=null,l}(function(t){let e=t.facet(qs),n=Us.get(e);return n||Us.set(e,n=function(t,e=Hs){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=Ks={view:e,prefix:n,scope:t};return setTimeout(()=>{Ks==i&&(Ks=null)},Gs),!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,Ys))}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")})),qs=kt.define({enables:$s}),Us=new WeakMap;let Ks=null;const Gs=4e3;let Ys=null;class Qs extends Ln{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?Je(t.firstChild):[];if(!e.length)return null;let n=window.getComputedStyle(t.parentNode),i=rn(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 Js(t){let e=Ii.fromClass(class{constructor(e){this.view=e,this.placeholder=t?Vn.set([Vn.widget({widget:new Qs(t),side:1}).range(0)]):Vn.none}get decorations(){return this.view.state.doc.length?Vn.none:this.placeholder}},{decorations:t=>t.decorations});return"string"==typeof t?[e,Ls.contentAttributes.of({"aria-placeholder":t})]:e}const Xs="-10000px";class Zs{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 to(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const eo=kt.define({combine:t=>{var e,n,i;return{position:Ke.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)||to}}}),no=new WeakMap,io=Ii.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(eo);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 Zs(t,lo,(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(eo);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=Xs,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(Ke.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=qi(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(eo).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=Xs;continue}let f=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=d.right-d.left,m=null!==(e=no.get(h))&&void 0!==e?e:d.bottom-d.top,v=h.offset||oo,b=this.view.textDirection==Jn.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=Xs;continue}no.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",ro(c,(y-t.parent.left)/r)):(c.style.top=k/s+"px",ro(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=Xs}},{eventObservers:{scroll(){this.maybeMeasure()}}});function ro(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const so=Ls.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"}}}),oo={x:0,y:0},lo=kt.define({enables:[io,so]}),ao=kt.define({combine:t=>t.reduce((t,e)=>t.concat(e),[])});class ho{static create(t){return new ho(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Zs(t,ao,(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 co=lo.compute([ao],t=>{let e=t.facet(ao);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:ho.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class uo{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 En)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==Jn.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=>Pi(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(io),e=t?t.manager.tooltips.findIndex(t=>t.create==ho.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-fo&&e.clientX<=r+fo&&e.clientY>=s-fo&&e.clientY<=o+fo}(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 fo=4;function po(t,e={}){let n=Gt.define(),i=Mt.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,ht.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(mo)&&(t=[]);return t},provide:t=>ao.from(t)});return{active:i,extension:[i,Ii.define(r=>new uo(r,t,i,n,e.hoverTime||300)),co]}}function go(t,e){let n=t.plugin(io);if(!n)return null;let i=n.manager.tooltips.indexOf(e);return i<0?null:n.manager.tooltipViews[i]}const mo=Gt.define(),vo=kt.define({combine(t){let e,n;for(let i of t)e=e||i.topContainer,n=n||i.bottomContainer;return{topContainer:e,bottomContainer:n}}}),bo=Ii.fromClass(class{constructor(t){this.input=t.state.facet(xo),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(e=>e(t));let e=t.state.facet(vo);this.top=new yo(t,!0,e.topContainer),this.bottom=new yo(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(vo);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new yo(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new yo(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(xo);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=>Ls.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class yo{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=wo(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=wo(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 wo(t){let e=t.nextSibling;return t.remove(),e}const xo=kt.define({enables:bo});class ko extends le{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}ko.prototype.elementClass="",ko.prototype.toDOM=void 0,ko.prototype.mapMode=ht.TrackBefore,ko.prototype.startSide=ko.prototype.endSide=-1,ko.prototype.point=!0;const Ao=1024;let So=0;class Co{constructor(t,e){this.from=t,this.to=e}}class Eo{constructor(t={}){this.id=So++,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=Mo.match(t)),e=>{let n=t(e);return void 0===n?null:[this,n]}}}Eo.closedBy=new Eo({deserialize:t=>t.split(" ")}),Eo.openedBy=new Eo({deserialize:t=>t.split(" ")}),Eo.group=new Eo({deserialize:t=>t.split(" ")}),Eo.isolate=new Eo({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),Eo.contextHash=new Eo({perNode:!0}),Eo.lookAhead=new Eo({perNode:!0}),Eo.mounted=new Eo({perNode:!0});class Oo{constructor(t,e,n){this.tree=t,this.overlay=e,this.parser=n}static get(t){return t&&t.props&&t.props[Eo.mounted.id]}}const To=Object.create(null);class Mo{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 Mo(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(Eo.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(Eo.group),i=-1;i<(n?n.length:0);i++){let r=e[i<0?t.name:n[i]];if(r)return r}}}}Mo.none=new Mo("",Object.create(null),0,8);class _o{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 Mo(n.name,i,n.id,n.flags):n)}return new _o(e)}}const Po=new WeakMap,Do=new WeakMap;var Ro;!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(Ro||(Ro={}));class Bo{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=Oo.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 Ko(this.topNode,t)}cursorAt(t,e=0,n=0){let i=Po.get(this)||this.topNode,r=new Ko(i);return r.moveTo(t,e),Po.set(this,r._tree),r}get topNode(){return new jo(this,0,0,null)}resolve(t,e=0){let n=Fo(Po.get(this)||this.topNode,t,e,!1);return Po.set(this,n),n}resolveInner(t,e=0){let n=Fo(Do.get(this)||this.topNode,t,e,!0);return Do.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 jo?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=Oo.get(t.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let o=new jo(s.tree,s.overlay[0].from+t.from,-1,t);(r||(r=[i])).push(Fo(o,e,n,!1))}}return r?qo(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&Ro.IncludeAnonymous)>0;for(let t=this.cursor(s|Ro.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:Jo(Mo.none,this.children,this.positions,0,this.children.length,0,this.length,(t,e,n)=>new Bo(this.type,t,e,n,this.propValues),t.makeTree||((t,e,n)=>new Bo(Mo.none,t,e,n)))}static build(t){return function(t){var e;let{buffer:n,nodeSet:i,maxBufferLength:r=Ao,reused:s=[],minRepeatType:o=i.types.length}=t,l=Array.isArray(n)?new Io(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 No(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 Bo){if(!a&&s.type==t&&s.length==r)return s;(o=s.prop(Eo.lookAhead))&&(l=i[a]+s.length+o)}return p(t,n,i,r,l,e)}}(O,S);C=Jo(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 No(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=[Eo.contextHash,s];o=o?[t].concat(o):[t]}if(r>25){let t=[Eo.lookAhead,r];o=o?[t].concat(o):[t]}return new Bo(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 Bo(a[t.topID],m.reverse(),v.reverse(),b)}(t)}}Bo.empty=new Bo(Mo.none,[],[],0);class Io{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 Io(this.buffer,this.index)}}class No{constructor(t,e,n){this.buffer=t,this.length=e,this.set=n}get type(){return Mo.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&&!(Lo(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 No(r,s,this.set)}}function Lo(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 Fo(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 jo&&t.index<0?null:t.parent;if(!e)return t;t=e}let s=i?0:Ro.IgnoreOverlays;if(i)for(let i=t,o=i.parent;o;i=o,o=i.parent)i instanceof jo&&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 Vo{cursor(t=0){return new Ko(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 Fo(this,t,e,!1)}resolveInner(t,e=0){return Fo(this,t,e,!0)}matchContext(t){return Ho(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 jo extends Vo{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(Lo(i,n,h,h+a.length))if(a instanceof No){if(r&Ro.ExcludeBuffers)continue;let o=a.findChild(0,a.buffer.length,e,n-h,i);if(o>-1)return new $o(new Wo(s,a,t,h),null,o)}else if(r&Ro.IncludeAnonymous||!a.type.isAnonymous||Go(a)){let o;if(!(r&Ro.IgnoreMounts)&&(o=Oo.get(a))&&!o.overlay)return new jo(o.tree,h,t,s);let l=new jo(a,h,t,s);return r&Ro.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(e<0?a.children.length-1:0,e,n,i)}}if(r&Ro.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&Ro.IgnoreOverlays)&&(i=Oo.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 jo(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 Ho(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 Wo{constructor(t,e,n,i){this.parent=t,this.buffer=e,this.index=n,this.start=i}}class $o extends Vo{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 $o(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&Ro.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 $o(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 $o(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 $o(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 Bo(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function qo(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 jo&&n.index<0?null:n.parent,r=t.slice();return i?r[e]=i:r.splice(e,1),new Uo(r,n)}class Uo{constructor(t,e){this.heads=t,this.node=e}get next(){return qo(this.heads)}}class Ko{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 jo)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 jo?(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&Ro.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ro.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Ro.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&Ro.IncludeAnonymous||t instanceof No||!t.type.isAnonymous||Go(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 $o(this.buffer,e,this.stack[t]);return this.bufferNode=new $o(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 Ho(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 Ho(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 Go(t){return t.children.some(t=>t instanceof No||!t.type.isAnonymous||Go(t))}const Yo=new WeakMap;function Qo(t,e){if(!t.isAnonymous||e instanceof No||e.type!=t)return 1;let n=Yo.get(e);if(null==n){n=1;for(let i of e.children){if(i.type!=t||!(i instanceof Bo)){n=1;break}n+=Qo(t,i)}Yo.set(e,n)}return n}function Jo(t,e,n,i,r,s,o,l,a){let h=0;for(let n=i;n<r;n++)h+=Qo(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=Qo(t,n[h]);for(h++;h<o;h++){let e=Qo(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(Jo(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 Xo{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 Xo(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 Xo(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 Zo{startParse(t,e,n){return"string"==typeof t&&(t=new tl(t)),n=n?n.length?n.map(t=>new Co(t.from,t.to)):[new Co(0,0)]:[new Co(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 tl{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 Eo({perNode:!0});let el=0;class nl{constructor(t,e,n,i){this.name=t,this.set=e,this.base=n,this.modified=i,this.id=el++}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 nl&&(e=t),null==e?void 0:e.base)throw new Error("Can not derive from a modified tag");let i=new nl(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 rl(t);return t=>t.modified.indexOf(e)>-1?t:rl.get(t.base||t,t.modified.concat(e).sort((t,e)=>t.id-e.id))}}let il=0;class rl{constructor(t){this.name=t,this.instances=[],this.id=il++}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 nl(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(rl.get(e,t));return r}}function sl(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 ll(i,r,o>0?n.slice(0,o):null);e[l]=a.sort(e[l])}}return ol.add(e)}const ol=new Eo;class ll{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 al(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 hl(t,e,n,i=0,r=t.length){let s=new cl(i,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),i,r,"",s.highlighters),s.flush(r)}ll.empty=new ll([],2,null);class cl{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(ol);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||ll.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(Eo.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 ul=nl.define,dl=ul(),fl=ul(),pl=ul(fl),gl=ul(fl),ml=ul(),vl=ul(ml),bl=ul(ml),yl=ul(),wl=ul(yl),xl=ul(),kl=ul(),Al=ul(),Sl=ul(Al),Cl=ul(),El={comment:dl,lineComment:ul(dl),blockComment:ul(dl),docComment:ul(dl),name:fl,variableName:ul(fl),typeName:pl,tagName:ul(pl),propertyName:gl,attributeName:ul(gl),className:ul(fl),labelName:ul(fl),namespace:ul(fl),macroName:ul(fl),literal:ml,string:vl,docString:ul(vl),character:ul(vl),attributeValue:ul(vl),number:bl,integer:ul(bl),float:ul(bl),bool:ul(ml),regexp:ul(ml),escape:ul(ml),color:ul(ml),url:ul(ml),keyword:xl,self:ul(xl),null:ul(xl),atom:ul(xl),unit:ul(xl),modifier:ul(xl),operatorKeyword:ul(xl),controlKeyword:ul(xl),definitionKeyword:ul(xl),moduleKeyword:ul(xl),operator:kl,derefOperator:ul(kl),arithmeticOperator:ul(kl),logicOperator:ul(kl),bitwiseOperator:ul(kl),compareOperator:ul(kl),updateOperator:ul(kl),definitionOperator:ul(kl),typeOperator:ul(kl),controlOperator:ul(kl),punctuation:Al,separator:ul(Al),bracket:Sl,angleBracket:ul(Sl),squareBracket:ul(Sl),paren:ul(Sl),brace:ul(Sl),content:yl,heading:wl,heading1:ul(wl),heading2:ul(wl),heading3:ul(wl),heading4:ul(wl),heading5:ul(wl),heading6:ul(wl),contentSeparator:ul(yl),list:ul(yl),quote:ul(yl),emphasis:ul(yl),strong:ul(yl),link:ul(yl),monospace:ul(yl),strikethrough:ul(yl),inserted:ul(),deleted:ul(),changed:ul(),invalid:ul(),meta:Cl,documentMeta:ul(Cl),annotation:ul(Cl),processingInstruction:ul(Cl),definition:nl.defineModifier("definition"),constant:nl.defineModifier("constant"),function:nl.defineModifier("function"),standard:nl.defineModifier("standard"),local:nl.defineModifier("local"),special:nl.defineModifier("special")};for(let t in El){let e=El[t];e instanceof nl&&(e.name=t)}var Ol;al([{tag:El.link,class:"tok-link"},{tag:El.heading,class:"tok-heading"},{tag:El.emphasis,class:"tok-emphasis"},{tag:El.strong,class:"tok-strong"},{tag:El.keyword,class:"tok-keyword"},{tag:El.atom,class:"tok-atom"},{tag:El.bool,class:"tok-bool"},{tag:El.url,class:"tok-url"},{tag:El.labelName,class:"tok-labelName"},{tag:El.inserted,class:"tok-inserted"},{tag:El.deleted,class:"tok-deleted"},{tag:El.literal,class:"tok-literal"},{tag:El.string,class:"tok-string"},{tag:El.number,class:"tok-number"},{tag:[El.regexp,El.escape,El.special(El.string)],class:"tok-string2"},{tag:El.variableName,class:"tok-variableName"},{tag:El.local(El.variableName),class:"tok-variableName tok-local"},{tag:El.definition(El.variableName),class:"tok-variableName tok-definition"},{tag:El.special(El.variableName),class:"tok-variableName2"},{tag:El.definition(El.propertyName),class:"tok-propertyName tok-definition"},{tag:El.typeName,class:"tok-typeName"},{tag:El.namespace,class:"tok-namespace"},{tag:El.className,class:"tok-className"},{tag:El.macroName,class:"tok-macroName"},{tag:El.propertyName,class:"tok-propertyName"},{tag:El.operator,class:"tok-operator"},{tag:El.comment,class:"tok-comment"},{tag:El.meta,class:"tok-meta"},{tag:El.invalid,class:"tok-invalid"},{tag:El.punctuation,class:"tok-punctuation"}]);const Tl=new Eo;const Ml=new Eo;class _l{constructor(t,e,n=[],i=""){this.data=t,this.name=i,se.prototype.hasOwnProperty("tree")||Object.defineProperty(se.prototype,"tree",{get(){return Rl(this)}}),this.parser=e,this.extension=[Hl.of(this),se.languageData.of((t,e,n)=>{let i=Pl(t,e,n),r=i.type.prop(Tl);if(!r)return[];let s=t.facet(r),o=i.type.prop(Ml);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 Pl(t,e,n).type.prop(Tl)==this.data}findRegions(t){let e=t.facet(Hl);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(Eo.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 Bo&&i(r,t.positions[n]+e)}};return i(Rl(t),0),n}get allowsNesting(){return!0}}function Pl(t,e,n){let i=t.facet(Hl),r=Rl(t).topNode;if(!i||i.allowsNesting)for(let t=r;t;t=t.enter(e,n,Ro.ExcludeBuffers))t.type.isTop&&(r=t);return r}_l.setState=Gt.define();class Dl extends _l{constructor(t,e,n){super(t,e,[],n),this.parser=e}static define(t){let e=(n=t.languageData,kt.define({combine:n?t=>t.concat(n):void 0}));var n;return new Dl(e,t.parser.configure({props:[Tl.add(t=>t.isTop?e:void 0)]}),t.name)}configure(t,e){return new Dl(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Rl(t){let e=t.field(_l.state,!1);return e?e.tree:Bo.empty}class Bl{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 Il=null;class Nl{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 Nl(t,e,[],Bo.empty,0,n,[],null)}startParse(){return this.parser.startParse(new Bl(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=Bo.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(Xo.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(Xo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Il;Il=this;try{return t()}finally{Il=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ll(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=Xo.applyChanges(n,e),i=Bo.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 Nl(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=Ll(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 Zo{createParse(e,n,i){let r=i[0].from,s=i[i.length-1].to;return{parsedPos:r,advance(){let e=Il;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 Bo(Mo.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 Il}}function Ll(t,e,n){return Xo.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Fl{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 Fl(e)}static init(t){let e=Math.min(3e3,t.doc.length),n=Nl.create(t.facet(Hl).parser,t,{from:0,to:e});return n.work(20,e)||n.takeTree(),new Fl(n)}}_l.state=Mt.define({create:Fl.init,update(t,e){for(let t of e.effects)if(t.is(_l.setState))return t.value;return e.startState.facet(Hl)!=e.state.facet(Hl)?Fl.init(e.state):t.apply(e)}});let Vl=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Vl=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const jl="undefined"!=typeof navigator&&(null===(Ol=navigator.scheduling)||void 0===Ol?void 0:Ol.isInputPending)?()=>navigator.scheduling.isInputPending():null,zl=Ii.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(_l.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(_l.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Vl(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(_l.state);if(r.tree==r.context.tree&&r.context.isDone(i+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,t&&!jl?Math.max(25,t.timeRemaining()-5):1e9),o=r.context.treeLen<i&&n.doc.length>i+1e3,l=r.context.work(()=>jl&&jl()||Date.now()>s,i+(o?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:_l.setState.of(new Fl(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=>Pi(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()}}}),Hl=kt.define({combine:t=>t.length?t[0]:null,enables:t=>[_l.state,zl,Ls.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class Wl{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const $l=kt.define(),ql=kt.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 Ul(t){let e=t.facet(ql);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Kl(t,e){let n="",i=t.tabSize,r=t.facet(ql)[0];if("\t"==r){for(;e>=i;)n+="\t",e-=i;r=" "}for(let t=0;t<e;t++)n+=r;return n}function Gl(t,e){t instanceof se&&(t=new Yl(t));for(let n of t.state.facet($l)){let i=n(t,e);if(void 0!==i)return i}let n=Rl(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 Jl(i,t,n)}(t,n,e):null}class Yl{constructor(t,e={}){this.state=t,this.options=e,this.unit=Ul(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 Ae(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 Ql=new Eo;function Jl(t,e,n){for(let i=t;i;i=i.next){let t=Xl(i.node);if(t)return t(ta.create(e,n,i))}return 0}function Xl(t){let e=t.type.prop(Ql);if(e)return e;let n,i=t.firstChild;if(i&&(n=i.type.prop(Eo.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?Zl:null}function Zl(){return 0}class ta extends Yl{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 ta(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(ea(n,t))break;e=this.state.doc.lineAt(n.from)}return this.lineIndent(e.from)}continue(){return Jl(this.context.next,this.base,this.pos)}}function ea(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function na({except:t,units:e=1}={}){return n=>{let i=t&&t.test(n.textAfter);return n.baseIndent+(i?0:e*n.unit)}}const ia=new Eo;class ra{constructor(t,e){let n;function i(t){let e=Oe.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 _l?t=>t.prop(Tl)==s.data:s?t=>t==s:void 0,this.style=al(t.map(t=>({tag:t.tag,class:t.class||i(Object.assign({},t,{tag:null}))})),{all:r}).style,this.module=n?new Oe(n):null,this.themeType=e.themeType}static define(t,e){return new ra(t,e||{})}}const sa=kt.define(),oa=kt.define({combine:t=>t.length?[t[0]]:null});function la(t){let e=t.facet(sa);return e.length?e:t.facet(oa)}class aa{constructor(t){this.markCache=Object.create(null),this.tree=Rl(t.state),this.decorations=this.buildDeco(t,la(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=Rl(t.state),n=la(t.state),i=n!=la(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 Vn.none;let n=new de;for(let{from:i,to:r}of t.visibleRanges)hl(this.tree,e,(t,e,i)=>{n.add(t,e,this.markCache[i]||(this.markCache[i]=Vn.mark({class:i})))},i,r);return n.finish()}}const ha=Pt.high(Ii.fromClass(aa,{decorations:t=>t.decorations})),ca=(El.meta,El.link,El.heading,El.emphasis,El.strong,El.strikethrough,El.keyword,El.atom,El.bool,El.url,El.contentSeparator,El.labelName,El.literal,El.inserted,El.string,El.deleted,El.regexp,El.escape,El.string,El.variableName,El.variableName,El.typeName,El.namespace,El.className,El.variableName,El.macroName,El.propertyName,El.comment,El.invalid,Ls.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}})),ua="()[]{}",da=kt.define({combine:t=>oe(t,{afterCursor:!0,brackets:ua,maxScanDistance:1e4,renderMatch:ga})}),fa=Vn.mark({class:"cm-matchingBracket"}),pa=Vn.mark({class:"cm-nonmatchingBracket"});function ga(t){let e=[],n=t.matched?fa:pa;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 ma=Mt.define({create:()=>Vn.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],i=e.state.facet(da);for(let t of e.state.selection.ranges){if(!t.empty)continue;let r=ka(e.state,t.head,-1,i)||t.head>0&&ka(e.state,t.head-1,1,i)||i.afterCursor&&(ka(e.state,t.head,1,i)||t.head<e.state.doc.length&&ka(e.state,t.head+1,-1,i));r&&(n=n.concat(i.renderMatch(r,e.state)))}return Vn.set(n,!0)},provide:t=>Ls.decorations.from(t)}),va=[ma,ca];function ba(t={}){return[da.of(t),va]}const ya=new Eo;function wa(t,e,n){let i=t.prop(e<0?Eo.openedBy:Eo.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 xa(t){let e=t.type.prop(ya);return e?e(t.node):t}function ka(t,e,n,i={}){let r=i.maxScanDistance||1e4,s=i.brackets||ua,o=Rl(t),l=o.resolveInner(e,n);for(let t=l;t;t=t.parent){let i=wa(t.type,n,s);if(i&&t.from<t.to){let r=xa(t);if(r&&(n>0?e>=r.from&&e<r.to:e>r.from&&e<=r.to))return Aa(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 Aa(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=xa(c);return{start:a,end:t?{from:t.from,to:t.to}:void 0,matched:!0}}if(wa(c.type,n,o))h++;else if(wa(c.type,-n,o)){if(0==h){let t=xa(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 Sa=Object.create(null),Ca=[Mo.none],Ea=[],Oa=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]=_a(Sa,e);function Ma(t,e){Ea.indexOf(t)>-1||(Ea.push(t),console.warn(e))}function _a(t,e){let n=[];for(let i of e.split(" ")){let e=[];for(let n of i.split(".")){let i=t[n]||El[n];i?"function"==typeof i?e.length?e=e.map(i):Ma(n,`Modifier ${n} used at start of tag`):e.length?Ma(n,`Tag ${n} used as modifier`):e=Array.isArray(i)?i:[i]:Ma(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=Oa[r];if(s)return s.id;let o=Oa[r]=Mo.define({id:Ca.length,name:i,props:[sl({[i]:n})]});return Ca.push(o),o.id}Jn.RTL,Jn.LTR;class Pa{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=Rl(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(Ia(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 Da(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 Ra{constructor(t,e,n,i){this.completion=t,this.source=e,this.match=n,this.score=i}}function Ba(t){return t.selection.main.from}function Ia(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 Na=qt.define();function La(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:yt.cursor(l.from+s+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Fa=new WeakMap;function Va(t){if(!Array.isArray(t))return t;let e=Fa.get(t);return e||Fa.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=Da(e)+Da(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 ja=Gt.define(),za=Gt.define();class Ha{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=st(t,e),i=lt(n);this.chars.push(n);let r=t.slice(e,e+i),s=r.toUpperCase();this.folded.push(st(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=st(t,0),r=lt(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=st(t,r);s!=e[a]&&s!=n[a]||(i[a++]=r),r+=lt(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=st(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=ot(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+=lt(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?lt(st(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 Wa{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 $a=kt.define({combine:t=>oe(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:Ua,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=>qa(t(n),e(n)),optionClass:(t,e)=>n=>qa(t(n),e(n)),addToOptions:(t,e)=>t.concat(e),filterStrict:(t,e)=>t||e})});function qa(t,e){return t?e?t+" "+e:t:e}function Ua(t,e,n,i,r,s){let o,l,a=t.textDirection==Jn.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 Ka(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 Ga{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($a);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=Ka(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($a).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=Ka(r.length,s,t.state.facet($a).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=Ka(e.options.length,e.selected,this.view.state.facet($a).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=>Pi(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($a).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 Ya(t,e){return n=>new Ga(n,t,e)}function Qa(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}class Ja{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 Ja(this.options,eh(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($a);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 Ra(e,i.source,t?t(e):[],1e9-n.length));else{let n,l=e.sliceDoc(i.from,i.to),a=o.filterStrict?new Wa(l):new Ha(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 Ra(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):Qa(t.completion)>Qa(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($a).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 Ja(o,eh(n,l),{pos:t.reduce((t,e)=>e.hasResult()?Math.min(t,e.from):t,1e8),create:ch,above:r.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(t){return new Ja(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Ja(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Xa{constructor(t,e,n){this.active=t,this.id=e,this.open=n}static start(){return new Xa(nh,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,n=e.facet($a),i=(n.override||e.languageDataAt("autocomplete",Ba(e)).map(Va)).map(e=>(this.active.find(t=>t.source==e)||new rh(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(oh));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=Ja.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 rh(t.source,0):t));for(let e of t.effects)e.is(lh)&&(r=r&&r.setSelected(e.value,this.id));return i==this.active&&r==this.open?this:new Xa(i,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Za:th}}const Za={"aria-autocomplete":"list"},th={};function eh(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const nh=[];function ih(t,e){if(t.isUserEvent("input.complete")){let n=t.annotation(Na);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 rh{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=ih(t,e),i=this;(8&n||16&n&&this.touches(t))&&(i=new rh(i.source,0)),4&n&&0==i.state&&(i=new rh(this.source,1)),i=i.updateFor(t,n);for(let e of t.effects)if(e.is(ja))i=new rh(i.source,1,e.value);else if(e.is(za))i=new rh(i.source,0);else if(e.is(oh))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(Ba(t.state))}}class sh extends rh{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=Ba(t.state);if(o>s||!i||2&e&&(Ba(t.startState)==this.from||o<this.limit))return new rh(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):Ia(t,!0).test(r)}(i.validFor,t.state,r,s)?new sh(this.source,this.explicit,l,i,r,s):i.update&&(i=i.update(i,r,s,new Pa(t.state,o,!1)))?new sh(this.source,this.explicit,l,i,i.from,null!==(n=i.to)&&void 0!==n?n:Ba(t.state)):new rh(this.source,1,this.explicit)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new sh(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new rh(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}const oh=Gt.define({map:(t,e)=>t.map(t=>t.map(e))}),lh=Gt.define(),ah=Mt.define({create:()=>Xa.start(),update:(t,e)=>t.update(e),provide:t=>[lo.from(t,t=>t.tooltip),Ls.contentAttributes.from(t,t=>t.attrs)]});function hh(t,e){const n=e.completion.apply||e.completion.label;let i=t.state.field(ah).active.find(t=>t.source==e.source);return i instanceof sh&&("string"==typeof n?t.dispatch({...La(t.state,n,i.from,i.to),annotations:Na.of(e.completion)}):n(t,e.completion,i.from,i.to),!0)}const ch=Ya(ah,hh);function uh(t,e="option"){return n=>{let i=n.state.field(ah,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet($a).interactionDelay)return!1;let r,s=1;"page"==e&&(r=go(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:lh.of(l)}),!0}}const dh=t=>!!t.state.field(ah,!1)&&(t.dispatch({effects:ja.of(!0)}),!0);class fh{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}}const ph=Ii.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(ah).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ah),n=t.state.facet($a);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ah)==e)return;let i=t.transactions.some(t=>{let e=ih(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){Pi(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(ja)))&&(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(ah);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($a).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=Ba(e),i=new Pa(e,n,t.explicit,this.view),r=new fh(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)}),Pi(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($a).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet($a),i=this.view.state.field(ah);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=Ba(s.updates.length?s.updates[0].startState:this.view.state),r=Math.min(i,s.done.from+(s.active.explicit?0:1)),o=new sh(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 rh(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:oh.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ah,!1);if(e&&e.tooltip&&this.view.state.facet($a).closeOnBlur){let n=e.open&&go(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:ja.of(!1)}),20),this.composing=0}}}),gh="object"==typeof navigator&&/Win/.test(navigator.platform),mh=Pt.highest(Ls.domEventHandlers({keydown(t,e){let n=e.state.field(ah,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&(!gh||!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&&hh(e,i),!1}})),vh=Ls.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"}}}),bh={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},yh=Gt.define({map(t,e){let n=e.mapPos(t,-1,ht.TrackAfter);return null==n?void 0:n}}),wh=new class extends le{};wh.startSide=1,wh.endSide=-1;const xh=Mt.define({create:()=>ue.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(yh)&&(t=t.update({add:[wh.range(n.value,n.value+1)]}));return t}}),kh="()[]{}<>«»»«[]{}";function Ah(t){for(let e=0;e<16;e+=2)if(kh.charCodeAt(e)==t)return kh.charAt(e+1);return ot(t<128?t:t+1)}const Sh="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Ch=Ls.inputHandler.of((t,e,n,i)=>{if((Sh?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let r=t.state.selection.main;if(i.length>2||2==i.length&&1==lt(st(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]||bh}(t,t.selection.main.head),i=n.brackets||bh.brackets;for(let r of i){let s=Ah(st(r,0));if(e==r)return s==r?_h(t,r,i.indexOf(r+r+r)>-1,n):Th(t,r,s,n.before||bh.before);if(e==s&&Eh(t,t.selection.main.from))return Mh(t,0,s)}return null}(t.state,i);return!!s&&(t.dispatch(s),!0)});function Eh(t,e){let n=!1;return t.field(xh).between(0,t.doc.length,t=>{t==e&&(n=!0)}),n}function Oh(t,e){let n=t.sliceString(e,e+2);return n.slice(0,lt(st(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:yh.of(s.to+e.length),range:yt.range(s.anchor+e.length,s.head+e.length)};let o=Oh(t.doc,s.head);return!o||/\s/.test(o)||i.indexOf(o)>-1?{changes:{insert:e+n,from:s.head},effects:yh.of(s.head+e.length),range:yt.cursor(s.head+e.length)}:{range:r=s}});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Mh(t,e,n){let i=null,r=t.changeByRange(e=>e.empty&&Oh(t.doc,e.head)==n?{changes:{from:e.head,to:e.head+n.length,insert:n},range:yt.cursor(e.head+n.length)}:i={range:e});return i?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function _h(t,e,n,i){let r=i.stringPrefixes||bh.stringPrefixes,s=null,o=t.changeByRange(i=>{if(!i.empty)return{changes:[{insert:e,from:i.from},{insert:e,from:i.to}],effects:yh.of(i.to+e.length),range:yt.range(i.anchor+e.length,i.head+e.length)};let o,l=i.head,a=Oh(t.doc,l);if(a==e){if(Ph(t,l))return{changes:{insert:e+e,from:l},effects:yh.of(l+e.length),range:yt.cursor(l+e.length)};if(Eh(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:yt.cursor(l+i.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(o=Dh(t,l-2*e.length,r))>-1&&Ph(t,o))return{changes:{insert:e+e+e+e,from:l},effects:yh.of(l+e.length),range:yt.cursor(l+e.length)};if(t.charCategorizer(l)(a)!=ne.Word&&Dh(t,l,r)>-1&&!function(t,e,n,i){let r=Rl(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:yh.of(l+e.length),range:yt.cursor(l+e.length)}}return{range:s=i}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Ph(t,e){let n=Rl(t).resolveInner(e+1);return n.parent&&n.from==e}function Dh(t,e,n){let i=t.charCategorizer(e);if(i(t.sliceDoc(e-1,e))!=ne.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))!=ne.Word)return n}return-1}function Rh(t={}){return[mh,ah,$a.of(t),ph,Ih,vh]}const Bh=[{key:"Ctrl-Space",run:dh},{mac:"Alt-`",run:dh},{mac:"Alt-i",run:dh},{key:"Escape",run:t=>{let e=t.state.field(ah,!1);return!(!e||!e.active.some(t=>0!=t.state)||(t.dispatch({effects:za.of(null)}),0))}},{key:"ArrowDown",run:uh(!0)},{key:"ArrowUp",run:uh(!1)},{key:"PageDown",run:uh(!0,"page")},{key:"PageUp",run:uh(!1,"page")},{key:"Enter",run:t=>{let e=t.state.field(ah,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet($a).interactionDelay)&&hh(t,e.open.options[e.open.selected])}}],Ih=Pt.highest(qs.computeN([$a],t=>t.facet($a).defaultKeymap?[Bh]:[]));function Nh(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 Lh=Nh(Wh,0),Fh=Nh(Hh,0),Vh=Nh((t,e)=>Hh(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 jh(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const zh=50;function Hh(t,e,n=e.selection.ranges){let i=n.map(t=>jh(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 Wh(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=jh(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 $h=qt.define(),qh=kt.define();class Uh{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 Uh(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 Uh(t.changes&&ut.fromJSON(t.changes),[],t.mapped&&ct.fromJSON(t.mapped),t.startSelection&&yt.fromJSON(t.startSelection),t.selectionsAfter.map(yt.fromJSON))}static fromTransaction(t,e){let n=Yh;for(let e of t.startState.facet(qh)){let i=e(t);i.length&&(n=n.concat(i))}return!n.length&&t.changes.empty?null:new Uh(t.changes.invert(t.startState.doc),n,void 0,e||t.startState.selection,Yh)}static selection(t){return new Uh(void 0,Yh,void 0,void 0,t)}}function Kh(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 Gh(t,e){return t.length?e.length?t.concat(e):t:e}const Yh=[];function Qh(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 Jh(t,e){if(!t.length)return t;let n=t.length,i=Yh;for(;n;){let r=Xh(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?[Uh.selection(i)]:Yh}function Xh(t,e,n){let i=Gh(t.selectionsAfter.length?t.selectionsAfter.map(t=>t.map(e)):Yh,n);if(!t.changes)return Uh.selection(i);let r=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new Uh(r,Gt.mapEffects(t.effects,e),o,t.startSelection.map(s),i)}const Zh=/^(input\.type|delete)($|\.)/;class tc{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 tc(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||Zh.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)?Kh(s,s.length-1,i.minDepth,new Uh(t.changes.compose(o.changes),Gh(Gt.mapEffects(t.effects,o.changes),o.effects),o.mapped,o.startSelection,Yh)):Kh(s,s.length,i.minDepth,t),new tc(s,Yh,e,n)}addSelection(t,e,n,i){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Yh;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 tc(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),Kh(t,t.length-1,1e9,n.setSelAfter(i)))}return[Uh.selection([e])]}(this.done,t),this.undone,e,n);var s,o}addMapping(t){return new tc(Jh(this.done,t),Jh(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:$h.of({side:t,rest:Qh(i),selection:s}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=1==i.length?Yh:i.slice(0,i.length-1);return r.mapped&&(n=Jh(n,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:$h.of({side:t,rest:n,selection:s}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}function ec(t,e){return yt.create(t.ranges.map(e),t.mainIndex)}function nc(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function ic({state:t,dispatch:e},n){let i=ec(t.selection,n);return!i.eq(t.selection,!0)&&(e(nc(t,i)),!0)}function rc(t,e){return yt.cursor(e?t.to:t.from)}function sc(t,e){return ic(t,n=>n.empty?t.moveByChar(n,e):rc(n,e))}function oc(t){return t.textDirectionAt(t.state.selection.main.head)==Jn.LTR}tc.empty=new tc(Yh,Yh);const lc=t=>sc(t,!oc(t)),ac=t=>sc(t,oc(t));function hc(t,e){return ic(t,n=>n.empty?t.moveByGroup(n,e):rc(n,e))}function cc(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 uc(t,e,n){let i,r,s=Rl(t).resolveInner(e.head),o=n?Eo.closedBy:Eo.openedBy;for(let i=e.head;;){let e=n?s.childAfter(i):s.childBefore(i);if(!e)break;cc(t,e,o)?s=e:i=n?e.to:e.from}return r=s.type.prop(o)&&(i=n?ka(t,s.from,1):ka(t,s.to,-1))&&i.matched?n?i.end.to:i.end.from:n?s.to:s.from,yt.cursor(r,n?-1:1)}function dc(t,e){return ic(t,n=>{if(!n.empty)return rc(n,e);let i=t.moveVertically(n,e);return i.head!=n.head?i:t.moveToLineBoundary(n,e)})}"undefined"!=typeof Intl&&Intl.Segmenter;const fc=t=>dc(t,!1),pc=t=>dc(t,!0);function gc(t){let e,n=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,i=0,r=0;if(n){for(let e of t.state.facet(Ls.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 mc(t,e){let n,i=gc(t),{state:r}=t,s=ec(r.selection,n=>n.empty?t.moveVertically(n,e,i.height):rc(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=Ls.scrollIntoView(s.main.head,{y:"start",yMargin:e.top-l}))}return t.dispatch(nc(r,s),{effects:n}),!0}const vc=t=>mc(t,!1),bc=t=>mc(t,!0);function yc(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=yt.cursor(i.from+n))}return r}function wc(t,e){let n=ec(t.state.selection,t=>{let n=e(t);return yt.range(t.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(t.state.selection)&&(t.dispatch(nc(t.state,n)),!0)}function xc(t,e){return wc(t,n=>t.moveByChar(n,e))}const kc=t=>xc(t,!oc(t)),Ac=t=>xc(t,oc(t));function Sc(t,e){return wc(t,n=>t.moveByGroup(n,e))}function Cc(t,e){return wc(t,n=>t.moveVertically(n,e))}const Ec=t=>Cc(t,!1),Oc=t=>Cc(t,!0);function Tc(t,e){return wc(t,n=>t.moveVertically(n,e,gc(t).height))}const Mc=t=>Tc(t,!1),_c=t=>Tc(t,!0),Pc=({state:t,dispatch:e})=>(e(nc(t,{anchor:0})),!0),Dc=({state:t,dispatch:e})=>(e(nc(t,{anchor:t.doc.length})),!0),Rc=({state:t,dispatch:e})=>(e(nc(t,{anchor:t.selection.main.anchor,head:0})),!0),Bc=({state:t,dispatch:e})=>(e(nc(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function Ic(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=Nc(t,o,!1)):o>r&&(n="delete.forward",o=Nc(t,o,!0)),r=Math.min(r,o),s=Math.max(s,o)}else r=Nc(t,r,!1),s=Nc(t,s,!0);return r==s?{range:i}:{changes:{from:r,to:s},range:yt.cursor(r,r<i.head?-1:1)}});return!r.changes.empty&&(t.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?Ls.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Nc(t,e,n){if(t instanceof Ls)for(let i of t.state.facet(Ls.atomicRanges).map(e=>e(t)))i.between(e,e,(t,i)=>{t<e&&i>e&&(e=n?i:t)});return e}const Lc=(t,e,n)=>Ic(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=Ae(r,l.tabSize)%Ul(l)||Ul(l);for(let e=0;e<t&&" "==r[r.length-1-e];e++)o--;s=o}else s=rt(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=rt(a.text,s-a.from,!1,!1)+a.from);return s}),Fc=t=>Lc(t,!1,!0),Vc=t=>Lc(t,!0,!1),jc=(t,e)=>Ic(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=rt(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=>jc(t,!1);function Hc(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 Wc(t,e,n){if(t.readOnly)return!1;let i=[],r=[];for(let e of Hc(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(yt.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(yt.range(t.anchor-o,t.head-o))}}return!!i.length&&(e(t.update({changes:i,scrollIntoView:!0,selection:yt.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function $c(t,e,n){if(t.readOnly)return!1;let i=[];for(let e of Hc(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 qc=Uc(!1);function Uc(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=Rl(t).resolveInner(e),r=i.childBefore(e),s=i.childAfter(e);return r&&s&&r.to<=e&&s.from>=e&&(n=r.type.prop(Eo.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 Yl(e,{simulateBreak:i,simulateDoubleBreak:!!o}),a=Gl(l,i);for(null==a&&(a=Ae(/^\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=["",Kl(e,a)];return o&&h.push(Kl(e,l.lineIndent(s.from,-1))),{changes:{from:i,to:r,insert:G.of(h)},range:yt.cursor(i+1+h[1].length)}});return n(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Kc(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:yt.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const Gc=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>ic(t,e=>uc(t.state,e,!oc(t))),shift:t=>wc(t,e=>uc(t.state,e,!oc(t)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>ic(t,e=>uc(t.state,e,oc(t))),shift:t=>wc(t,e=>uc(t.state,e,oc(t)))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>Wc(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>$c(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>Wc(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>$c(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let n=t.selection,i=null;return n.ranges.length>1?i=yt.create([n.main]):n.main.empty||(i=yt.create([yt.cursor(n.main.head)])),!!i&&(e(nc(t,i)),!0)}},{key:"Mod-Enter",run:Uc(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let n=Hc(t).map(({from:e,to:n})=>yt.range(e,Math.min(n+1,t.doc.length)));return e(t.update({selection:yt.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let n=ec(t.selection,e=>{let n=Rl(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 yt.range(n.to,n.from)}return e});return!n.eq(t.selection)&&(e(nc(t,n)),!0)},preventDefault:!0},{key:"Mod-[",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Kc(t,(e,n)=>{let i=/^\s*/.exec(e.text)[0];if(!i)return;let r=Ae(i,t.tabSize),s=0,o=Kl(t,Math.max(0,r-Ul(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(Kc(t,(e,n)=>{n.push({from:e.from,insert:t.facet(ql)})}),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),i=new Yl(t,{overrideIndentation:t=>{let e=n[t];return null==e?-1:e}}),r=Kc(t,(e,r,s)=>{let o=Gl(i,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let l=/^\s*/.exec(e.text)[0],a=Kl(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(Hc(e).map(({from:t,to:n})=>(t>0?t--:n<e.doc.length&&n++,{from:t,to:n}))),i=ec(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=ec(t.selection,e=>{let r=ka(t,e.head,-1)||ka(t,e.head,1)||e.head>0&&ka(t,e.head-1,1)||e.head<t.doc.length&&ka(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?yt.range(e.anchor,s):yt.cursor(s)});return!!i&&(e(nc(t,r)),!0)}(t,e,!1)},{key:"Mod-/",run:t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),i=jh(t.state,n.from);return i.line?Lh(t):!!i.block&&Vh(t)}},{key:"Alt-A",run:Fh},{key:"Ctrl-m",mac:"Shift-Alt-m",run:t=>(t.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:lc,shift:kc,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>hc(t,!oc(t)),shift:t=>Sc(t,!oc(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>ic(t,e=>yc(t,e,!oc(t))),shift:t=>wc(t,e=>yc(t,e,!oc(t))),preventDefault:!0},{key:"ArrowRight",run:ac,shift:Ac,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>hc(t,oc(t)),shift:t=>Sc(t,oc(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>ic(t,e=>yc(t,e,oc(t))),shift:t=>wc(t,e=>yc(t,e,oc(t))),preventDefault:!0},{key:"ArrowUp",run:fc,shift:Ec,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Pc,shift:Rc},{mac:"Ctrl-ArrowUp",run:vc,shift:Mc},{key:"ArrowDown",run:pc,shift:Oc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Dc,shift:Bc},{mac:"Ctrl-ArrowDown",run:bc,shift:_c},{key:"PageUp",run:vc,shift:Mc},{key:"PageDown",run:bc,shift:_c},{key:"Home",run:t=>ic(t,e=>yc(t,e,!1)),shift:t=>wc(t,e=>yc(t,e,!1)),preventDefault:!0},{key:"Mod-Home",run:Pc,shift:Rc},{key:"End",run:t=>ic(t,e=>yc(t,e,!0)),shift:t=>wc(t,e=>yc(t,e,!0)),preventDefault:!0},{key:"Mod-End",run:Dc,shift:Bc},{key:"Enter",run:qc,shift:qc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:Fc,shift:Fc},{key:"Delete",run:Vc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:zc},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>jc(t,!0)},{mac:"Mod-Backspace",run:t=>Ic(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=>Ic(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:lc,shift:kc,preventDefault:!0},{key:"Ctrl-f",run:ac,shift:Ac},{key:"Ctrl-p",run:fc,shift:Ec},{key:"Ctrl-n",run:pc,shift:Oc},{key:"Ctrl-a",run:t=>ic(t,e=>yt.cursor(t.lineBlockAt(e.head).from,1)),shift:t=>wc(t,e=>yt.cursor(t.lineBlockAt(e.head).from))},{key:"Ctrl-e",run:t=>ic(t,e=>yt.cursor(t.lineBlockAt(e.head).to,-1)),shift:t=>wc(t,e=>yt.cursor(t.lineBlockAt(e.head).to))},{key:"Ctrl-d",run:Vc},{key:"Ctrl-h",run:Fc},{key:"Ctrl-k",run:t=>Ic(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:G.of(["",""])},range:yt.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:rt(i.text,n-i.from,!1)+i.from,s=n==i.to?n+1:rt(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:yt.cursor(s)}});return!n.changes.empty&&(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:bc}].map(t=>({mac:t.key,run:t.run,shift:t.shift}))));function Yc(){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++)Qc(t,arguments[e]);return t}function Qc(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++)Qc(t,e[n])}}class Jc{constructor(t,e,n){this.from=t,this.to=e,this.diagnostic=n}}class Xc{constructor(t,e,n){this.diagnostics=t,this.panel=e,this.selected=n}static init(t,e,n){let i=n.facet(cu).markerFilter;i&&(t=i(t,n));let r=t.slice().sort((t,e)=>t.from-e.from||t.to-e.to),s=new de,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=wu(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,Vn.widget({widget:new pu(h),diagnostics:o.slice()}));else{let t=o.reduce((t,e)=>e.markClass?t+" "+e.markClass:t,"");s.add(e,i,Vn.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 Xc(a,e,Zc(a))}}function Zc(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 Jc(i.from,n,i.diagnostic)}else i=new Jc(t,n,e||r.diagnostics[0])}),i}function tu(t,e){return t.field(ru,!1)?e:e.concat(Gt.appendConfig.of(xu))}const eu=Gt.define(),nu=Gt.define(),iu=Gt.define(),ru=Mt.define({create:()=>new Xc(Vn.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=Zc(n,t.selected.diagnostic,r)||Zc(n,null,r)}!n.size&&r&&e.state.facet(cu).autoPanel&&(r=null),t=new Xc(n,r,i)}for(let n of e.effects)if(n.is(eu)){let i=e.state.facet(cu).autoPanel?n.value.length?mu.open:null:t.panel;t=Xc.init(n.value,i,e.state)}else n.is(nu)?t=new Xc(t.diagnostics,n.value?mu.open:null,t.selected):n.is(iu)&&(t=new Xc(t.diagnostics,t.panel,n.value));return t},provide:t=>[xo.from(t,t=>t.panel),Ls.decorations.from(t,t=>t.diagnostics)]}),su=Vn.mark({class:"cm-lintRange cm-lintRange-active"});function ou(t,e,n){let i,{diagnostics:r}=t.state.field(ru),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(cu).tooltipFilter;return i&&l&&(i=l(i,t.state)),i?{pos:s,end:o,above:t.state.doc.lineAt(s).to<o,create:()=>({dom:lu(t,i)})}:null}function lu(t,e){return Yc("ul",{class:"cm-tooltip-lint"},e.map(e=>fu(t,e,!1)))}const au=t=>{let e=t.state.field(ru,!1);return!(!e||!e.panel||(t.dispatch({effects:nu.of(!1)}),0))},hu=Ii.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(cu);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(cu);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:tu(t,[eu.of(e)])}}(this.view.state,e.reduce((t,e)=>t.concat(e))))},t=>{Pi(this.view.state,t)})}}update(t){let e=t.state.facet(cu);(t.docChanged||e!=t.startState.facet(cu)||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)}}),cu=kt.define({combine:t=>Object.assign({sources:t.map(t=>t.source).filter(t=>null!=t)},oe(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 uu(t,e={}){return[cu.of({source:t,config:e}),hu,xu]}function du(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 fu(t,e,n){var i;let r=n?du(e.actions):[];return Yc("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Yc("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=Zc(t.state.field(ru).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),Yc("u",l.slice(a,a+1)),l.slice(a+1)];return Yc("button",{type:"button",class:"cm-diagnosticAction",onclick:o,onmousedown:o,"aria-label":` Action: ${l}${a<0?"":` (access key "${r[i]})"`}.`},h)}),e.source&&Yc("div",{class:"cm-diagnosticSource"},e.source))}class pu extends Ln{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return Yc("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class gu{constructor(t,e){this.diagnostic=e,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=fu(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class mu{constructor(t){this.view=t,this.items=[],this.list=Yc("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:e=>{if(27==e.keyCode)au(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=du(n.actions);for(let r=0;r<i.length;r++)if(i[r].toUpperCase().charCodeAt(0)==e.keyCode){let e=Zc(this.view.state.field(ru).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=Yc("div",{class:"cm-panel-lint"},this.list,Yc("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>au(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(ru).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(ru),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 gu(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 gu(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=Zc(this.view.state.field(ru).diagnostics,this.items[t].diagnostic);e&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:iu.of(e)})}static open(t){return new mu(t)}}function vu(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 bu=Ls.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:vu("#d11")},".cm-lintRange-warning":{backgroundImage:vu("orange")},".cm-lintRange-info":{backgroundImage:vu("#999")},".cm-lintRange-hint":{backgroundImage:vu("#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 yu(t){return"error"==t?4:"warning"==t?3:"info"==t?2:1}function wu(t){let e="hint",n=1;for(let i of t){let t=yu(i.severity);t>n&&(n=t,e=i.severity)}return e}const xu=[ru,Ls.decorations.compute([ru],t=>{let{selected:e,panel:n}=t.field(ru);return e&&n&&e.from!=e.to?Vn.set([su.range(e.from,e.to)]):Vn.none}),po(ou,{hideOn:function(t,e){let n=e.pos,i=e.end||n,r=t.state.facet(cu).hideOn(t,n,i);if(null!=r)return r;let s=t.startState.doc.lineAt(e.pos);return!(!t.effects.some(t=>t.is(eu))&&!t.changes.touchesRange(s.from,Math.max(s.to,i)))}}),bu];class ku{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 ku(t,[],e,n,n,0,[],0,i?new Au(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 ku(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 Su(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 Au(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 Au{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class Su{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 Cu{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 Cu(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 Cu(this.stack,this.pos,this.index)}}function Eu(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 Ou{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 Ou;class Mu{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 _u{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||Du(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 Pu(t,e,n){for(let i,r=e;65535!=(i=t[r]);r++)if(i==n)return r-e;return-1}function Du(t,e,n,i){let r=Pu(n,i,e);return r<0||Pu(n,i,t)<r}_u.prototype.contextual=_u.prototype.fallback=_u.prototype.extend=!1,_u.prototype.fallback=_u.prototype.extend=!1;const Ru="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let Bu=null;function Iu(t,e,n){let i=t.cursor(Ro.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 Nu{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?Iu(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Iu(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 Bo){if(s==t){if(s<this.safeFrom)return null;let t=s+r.length;if(t<=this.safeTo){let e=r.prop(Eo.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 Lu{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(t=>new Ou)}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 Ou,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 Ou,{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(Hu(o,l+2),e,n,i));break}l=Hu(o,l+2)}o[l]==e&&(i=this.putAction(Hu(o,l+1),e,n,i))}return i}}class Fu{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 Mu(e,i),this.tokens=new Lu(t,this.stream),this.topTerm=t.top[1];let{from:r}=i[0];this.stacks=[ku.start(this,t.top[0],r)],this.fragments=n.length&&this.stream.end-r>4*t.bufferLength?new Nu(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 Ru&&console.log("Finish with "+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw Ru&&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 Ru&&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=Ru?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(Eo.contextHash)||0)==n))return t.useNode(o,i),Ru&&console.log(s+this.stackID(t)+` (via reuse of ${r.getName(o.type.id)})`),!0;if(!(o instanceof Bo)||0==o.children.length||o.positions[0]>0)break;let l=o.children[0];if(!(l instanceof Bo&&0==o.positions[0]))break;o=l}}let o=r.stateSlot(t.state,4);if(o>0)return t.reduce(o),Ru&&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),Ru&&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 Vu(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=Ru?this.stackID(o)+" -> ":"";if(o.deadEnd){if(r)continue;if(r=!0,o.restart(),Ru&&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&&(Ru&&console.log(u+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,n));t++)Ru&&(u=this.stackID(c)+" -> ");for(let t of o.recoverByInsert(l))Ru&&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),Ru&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(l)})`),Vu(o,n)):(!i||i.score<o.score)&&(i=o)}return i}stackToTree(t){return t.close(),Bo.build({buffer:Cu.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=(Bu||(Bu=new WeakMap)).get(t);return e||Bu.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function Vu(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 ju{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 Zo{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=Eo[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 _o(e.map((e,r)=>Mo.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=Ao;let s=Eu(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(Wu),this.states=Eu(t.states,Uint32Array),this.data=Eu(t.stateData),this.goto=Eu(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(t=>"number"==typeof t?new _u(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 Fu(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 Hu(n,s+2);break}r=n[s=Hu(n,s+2)]}if(r==e||0==r)return Hu(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=Hu(this.data,n+2)}i=e(Hu(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=Hu(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]=Wu(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 ju(t,n,i)}static deserialize(t){return new zu(t)}}function Hu(t,e){return t[e]|t[e+1]<<16}function Wu(t){if(t.external){let e=t.extend?1:0;return(n,i)=>t.external(n,i)<<1|e}return t.get}const $u=sl({String:El.string,Number:El.number,"True False":El.bool,PropertyName:El.propertyName,Null:El.null,", :":El.separator,"[ ]":El.squareBracket,"{ }":El.brace}),qu=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:[$u],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}),Uu=Dl.define({name:"json",parser:qu.configure({props:[Ql.add({Object:na({except:/^\s*\}/}),Array:na({except:/^\s*\]/})}),ia.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 Ku(){return new Wl(Uu)}const Gu=[Ls.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},"& .cm-completionDetail":{float:"right",fontStyle:"normal"}}),Ls.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=[ha];return t instanceof ra&&(t.module&&n.push(Ls.styleModule.of(t.module)),e=t.themeType),e?n.push(sa.computeN([Ls.darkTheme],n=>n.facet(Ls.darkTheme)==("dark"==e)?[t]:[])):n.push(sa.of(t)),n}(ra.define([{tag:El.variableName,class:"variableName"},{tag:El.name,class:"variableName"},{tag:El.number,class:"number"},{tag:El.string,class:"string"},{tag:El.bool,class:"bool"},{tag:El.function(El.variableName),class:"function"},{tag:El.function(El.special(El.variableName)),class:"function"},{tag:El.controlKeyword,class:"control"},{tag:El.operatorKeyword,class:"control"}]))];function Yu(t){return[Qu(t),Ls.updateListener.of(t=>{if(t.selectionSet||t.docChanged){const{state:e}=t,n=e.selection.main.head;if(!Ju(Rl(e).resolve(n,-1)))return null;""===e.doc.lineAt(n).text.trim()&&setTimeout(()=>{dh(t.view)},100)}})]}function Qu(t){return Rh({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=Rl(n).resolve(i,-1);if(!Ju(o))return null;const l=n.sliceDoc(o.from,i).startsWith('"'),a='"'===r.text[s],h=e.map(t=>({label:t.label,type:t.type,info:t.info,detail:t.detail,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)]})}function Ju(t){return!!function(t){let e=0,n=t;for(;n.parent;){if("Object"===n.name&&e++,e>1)return!1;n=n.parent}return!0}(t)&&["Object","PropertyName","⚠"].includes(t.name)}function Xu(t){return function(t){var e=t.businessObject,n=function(t){return A(t,"bpmn:FlowElement")||A(t,"bpmn:Participant")||A(t,"bpmn:Lane")||A(t,"bpmn:SequenceFlow")||A(t,"bpmn:MessageFlow")||A(t,"bpmn:DataInput")||A(t,"bpmn:DataOutput")?"name":A(t,"bpmn:TextAnnotation")?"text":A(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 Zu(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"))}const td="LOCAL",ed="PROCESS";class nd extends(P()){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){const n=function(t){let e=C(t);for(;e;){if(A(e,"bpmn:Process"))return e.get("id");e=e.$parent}return null}(t);if(!n)return void this._emitError(`Process ID for element <${t.id}> not found`,null);this._changeStatus("deploying");const i=await this._api.deploy();if("idle"===this._status)return;if(!i.success)return this._emitError("Failed to deploy process definition",i.error),void this.cancelTaskExecution();const r=function(t,e){const{deployments:n=[]}=t;for(const t of n)if(t.processDefinition){const{processDefinition:n}=t;if(n.processDefinitionId===e)return n.processDefinitionKey}return null}(i.response,n);if(!r)return this._emitError("Failed to retrieve process definition key from deployment response",i.response),void this.cancelTaskExecution();this._changeStatus("starting-instance");const s=await this._api.startInstance(r,t.id,e);if("idle"===this._status)return;if(!s.success)return this._emitError("Failed to start process instance",s.error),void this.cancelTaskExecution();const o=function(t){const{processInstanceKey:e}=t;return e||null}(s.response);if(!o)return this._emitError("Failed to retrieve process instance key from start instance response"),void this.cancelTaskExecution();this._changeStatus("executing",o),this._interval=setInterval(async()=>{const e=await this._api.getProcessInstance(o);if("idle"===this._status)return void this.cancelTaskExecution();if(!e.success)return void this._emitError("Failed to get process instance",e.error);const n=id(e.response,o);if(!n)return;const i=function(t,e){const n=id(t,e);return n?n.state:null}(e.response,o),r=function(t,e){const n=id(t,e);return n&&n.hasIncident||!1}(e.response,o);let s=null;if(r){const t=await this._api.getProcessInstanceIncident(o);if("idle"===this._status)return void this.cancelTaskExecution();if(!t.success)return void this._emitError("Failed to get process instance incident",t.error);s=function(t){const{items:e=[]}=t;return e.length?e[0]:null}(t.response)}if(i&&["COMPLETED","TERMINATED","CANCELED"].includes(i)||r){const e=await this._api.getProcessInstanceVariables(o);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(o);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=rd(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.id);this.emit("taskExecution.finished",{success:!s,incident:s,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 id(t,e){const{items:n=[]}=t;return n.length&&n.find(t=>t.processInstanceKey===e)||null}function rd(t,e,n,i){const{scopeKey:r}=t;if(e.find(t=>String(t.elementInstanceKey)===String(r)&&t.elementId===i))return td;const{processInstanceKey:s}=n;return String(r)===String(s)?ed:null}var sd=s(467);const od=qt.define(),ld=new Rt,ad="JSON contains errors",hd={},cd=[];function ud({allOutputs:t=hd,value:e,onChange:n,onErrorChange:i,variablesForElement:r=cd}){const s=(0,o.useMemo)(()=>{const e=r.map(({name:t,detail:e,info:n})=>({label:t,type:"variable",info:()=>dd(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];b(i,t=>{if(!g(t)||!v(t,"name"))return;const{name:i,value:r,scope:s}=t;s===ed&&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:()=>dd(e,`Output variable from ${n}`),detail:fd(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=se.create({doc:e,extensions:[Rh(),[Ch,xh],ba(),se.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=Gl(o,e.from);if(null==n)continue;let i=/^\s*/.exec(e.text)[0],r=Kl(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}),qs.of([...Gc]),(new Rt).of(Ku()),(new Rt).of(se.tabSize.of(2)),Ls.contentAttributes.of({"aria-label":"JSON editor",tabindex:"0"}),uu(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?ad:null),u(n?ad:null),e},{delay:300}),ld.of(Yu(s)),Js("Enter process variables in JSON format"),Gu,Ls.lineWrapping,Ls.updateListener.of(t=>{if(t.docChanged){if(t.transactions.some(t=>t.annotation(od)))return;const e=t.state.doc.toString();n(e)}})]}),r=new Ls({state:t,parent:l.current});return h(r),()=>{r.destroy()}},[n]),(0,o.useEffect)(()=>{a&&a.dispatch({effects:ld.reconfigure(Yu(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:od.of(!0)})},[a,e]),(0,sd.jsxs)("div",{className:d()("code__editor",{"code__editor--error":c}),children:[(0,sd.jsx)("div",{className:"code__editor-codemirror",children:(0,sd.jsx)("div",{ref:l,className:"code__editor-codemirror-inner"})}),c&&(0,sd.jsx)("div",{className:"code__editor-error",children:c})]})}function dd(t,e){const n=document.createElement("div"),i=(0,N.qV)((0,sd.jsxs)("div",{className:"info",children:[(0,sd.jsx)("span",{children:e}),void 0!==t&&(0,sd.jsx)("pre",{children:"object"==typeof t?JSON.stringify(t,null,2):t})]}));return n.innerHTML=i,n}function fd(t){const e=typeof t;return"object"===e?Array.isArray(t)?"Array":null===t?"null":"Object":e.charAt(0).toUpperCase()+e.slice(1)}function pd({allOutputs:t,input:e="",onErrorChange:n,onResetInput:i,onSetInput:r,variablesForElement:s}){return(0,sd.jsxs)("div",{className:"input",children:[(0,sd.jsxs)("div",{className:"input__header",children:[(0,sd.jsx)("div",{className:"input__header--title",children:"Input process variables"}),(0,sd.jsx)(l.Link,{href:"https://docs.camunda.io/docs/components/concepts/variables/",target:"_blank",title:"Open documentation",children:(0,sd.jsx)(c.Launch,{})}),(0,sd.jsx)(l.Link,{className:"input__header--button-reset",onClick:()=>{i()},role:"button",children:"Clear"})]}),(0,sd.jsx)(ud,{allOutputs:t,value:e,onChange:r,onErrorChange:n,variablesForElement:s})]})}const gd={plugins:[],registerPlugin:t=>{},unregisterPlugin:t=>{},getPlugins:t=>[]},md=(0,o.createContext)(gd);function vd({value:t}){const e=(0,o.useRef)(null),[n,i]=(0,o.useState)();return(0,o.useEffect)(()=>{if(!e.current)return;const n=se.create({doc:t,extensions:[Ku(),se.tabSize.of(2),se.readOnly.of(!0),Ls.editable.of(!1),Ls.lineWrapping,Gu]}),r=new Ls({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,sd.jsxs)("div",{className:"code__editor",children:[(0,sd.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,sd.jsx)("div",{className:"code__editor-codemirror",children:(0,sd.jsx)("div",{ref:e,className:"code__editor-codemirror-inner"})})]})}function bd({isTaskExecuting:t,output:e,element:n}){return t?(0,sd.jsx)(l.CodeSnippetSkeleton,{className:"output__variables--skeleton",type:"multi"}):e?null!=e&&e.error?(0,sd.jsx)(vd,{value:(null==e?void 0:e.error.response)||"No error details available"}):(0,sd.jsxs)(sd.Fragment,{children:[(0,sd.jsx)(kd,{}),(0,sd.jsx)(Ad,{}),(0,sd.jsx)(xd,{}),(0,sd.jsx)(wd,{element:n,output:e,isTaskExecuting:t})]}):(0,sd.jsx)("div",{className:"output__variables--empty",children:(0,sd.jsxs)("div",{children:["Enter process variables, then click ",(0,sd.jsx)("span",{className:"output__variables--empty-action",children:"Test task"})," to see how they change once the task has executed."]})})}const yd=({children:t=null,render:e=()=>null,label:n,priority:i=1e3})=>{const{registerPlugin:r,unregisterPlugin:s}=(0,o.useContext)(md);return(0,o.useEffect)(()=>{const o={label:n,render:e,children:t,priority:i,type:"output.body.tab"};return r(o),()=>{s(o)}},[t,e,n,i,r,s]),null},wd=t=>{const{getPlugins:e}=(0,o.useContext)(md),n=e("output.body.tab").map(e=>{var n;return{label:e.label,content:(null===(n=e.render)||void 0===n?void 0:n.call(e,t))||e.children}}).filter(t=>t.content);return(0,sd.jsxs)(l.Tabs,{children:[(0,sd.jsx)(l.TabList,{children:n.map((t,e)=>(0,sd.jsx)(l.Tab,{children:t.label},e))}),(0,sd.jsx)(l.TabPanels,{children:n.map((t,e)=>(0,sd.jsx)(l.TabPanel,{children:t.content},e))})]})},xd=()=>{const t=(0,o.useCallback)(({output:t})=>{if(null!=t&&t.incident)return(0,sd.jsx)(Sd,{incident:t.incident})},[]);return(0,sd.jsx)(yd,{priority:3e3,label:"Incident",render:t})},kd=()=>{const t=(0,o.useCallback)(({output:t})=>{if(t&&(t.success||t.incident))return(0,sd.jsx)(vd,{value:JSON.stringify(Ed(t.variables,ed),null,2)})},[]);return(0,sd.jsx)(yd,{priority:2e3,label:"Process Variables",render:t})},Ad=()=>{const t=(0,o.useCallback)(({output:t})=>{if(t&&(t.success||t.incident))return(0,sd.jsx)(vd,{value:JSON.stringify(Ed(t.variables,td),null,2)})},[]);return(0,sd.jsx)(yd,{priority:1e3,label:"Local Variables",render:t})};function Sd({incident:t}){const{errorType:e,errorMessage:n,creationTime:i,...r}=t;return(0,sd.jsxs)("div",{className:"output__incident--details",children:[(0,sd.jsxs)("div",{children:[(0,sd.jsx)("span",{className:"bold",children:"Type: "}),e]}),(0,sd.jsxs)("div",{children:[(0,sd.jsx)("span",{className:"bold",children:"Creation Time: "}),new Date(i).toLocaleString()]}),(0,sd.jsx)("div",{children:(0,sd.jsxs)("pre",{children:[(0,sd.jsx)("span",{className:"bold",children:"Message: "}),n]})}),Object.entries(r).map(([t,e])=>(0,sd.jsxs)("div",{children:[(0,sd.jsxs)("span",{className:"bold",children:[Cd(t),":"]})," ",e]},t))]})}function Cd(t){return t.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase())}function Ed(t,e){return Object.values(t).reduce((t,n)=>(g(n)&&v(n,"name")&&e===n.scope&&(t[n.name]=n.value),t),{})}const Od={deploying:"Deploying...","starting-instance":"Starting instance...",executing:"Waiting for task to be completed..."};function Td({element:t,isConnectionConfigured:e,configureConnectionBannerTitle:n,configureConnectionBannerDescription:i,configureConnectionLabel:r,onConfigureConnection:s,isTaskExecuting:a,output:h,currentOperateUrl:u,onResetOutput:d,taskExecutionStatus:f}){const p=(0,o.useMemo)(()=>null!=h&&h.error||null!=h&&h.incident||!e?(0,sd.jsx)(c.ErrorFilled,{className:"output__status-icon--error"}):null!=h&&h.success?(0,sd.jsx)(c.CheckmarkFilled,{className:"output__status-icon--success"}):a?(0,sd.jsx)(l.InlineLoading,{}):(0,sd.jsx)(c.InProgress,{className:"output__status-icon--ready"}),[h,a,e]),g=(0,o.useMemo)(()=>{if(a)return Od[f];if(!e)return"Connection error";if(h){if(h.error)return h.error.message?`Error: ${h.error.message}`:"Error";if(h.incident)return h.incident.errorType?`Incident: ${h.incident.errorType}`:"Incident";if(h.success)return"Success"}return"Ready"},[a,f,h,e]);return(0,sd.jsxs)("div",{className:"output",children:[(0,sd.jsxs)("div",{className:"output__header",children:[(0,sd.jsxs)("div",{className:"output__header--title",children:[p,(0,sd.jsx)("span",{children:g})]}),(0,sd.jsx)(Md,{onResetOutput:d,isConnectionConfigured:e,currentOperateUrl:u,element:t,output:h,isTaskExecuting:a}),(0,sd.jsx)(Pd,{}),(0,sd.jsx)(Dd,{})]}),(0,sd.jsx)("div",{className:"output__body",children:e?(0,sd.jsx)(bd,{isTaskExecuting:a,output:h,element:t}):(0,sd.jsx)(Rd,{title:n,description:i,actionLabel:r,onActionClick:s})})]})}const Md=t=>{const{getPlugins:e}=(0,o.useContext)(md),n=e("output.header.link").reduce((e,n)=>{var i;const r=e=>m(e)?e(t):e;if(!(r(n.visible)??1))return e;const s=(null===(i=n.render)||void 0===i?void 0:i.call(n,t))||n.children;return e.push({content:s,href:r(n.href),target:r(n.target),className:r(n.className),onClick:r(n.onClick),role:r(n.role),tooltip:r(n.tooltip)}),e},[]);return(0,sd.jsx)(sd.Fragment,{children:n.map(({content:t,href:e,target:n,className:i,onClick:r,role:s,tooltip:o},a)=>{const h=(0,sd.jsx)(l.Link,{href:e,target:n,className:i,onClick:r,role:s,children:t},a);return o?(0,sd.jsx)(l.Tooltip,{autoAlign:!0,label:o,children:h},a):h})})},_d=({children:t=null,render:e=()=>null,visible:n,href:i,target:r,className:s,onClick:l,role:a,tooltip:h,priority:c=100})=>{const{registerPlugin:u,unregisterPlugin:d}=(0,o.useContext)(md);return(0,o.useEffect)(()=>{const o={children:t,render:e,visible:n,href:i,target:r,className:s,onClick:l,role:a,tooltip:h,priority:c,type:"output.header.link"};return u(o),()=>{d(o)}},[t,e,n,i,r,s,l,a,h,c,u,d]),null},Pd=()=>{const t=(0,o.useCallback)(()=>"View in Operate",[]),e=(0,o.useCallback)(({output:t,isConnectionConfigured:e,currentOperateUrl:n})=>e&&(n||t&&!t.error),[]),n=(0,o.useCallback)(({output:t,currentOperateUrl:e})=>e||(null==t?void 0:t.operateUrl),[]),i=(0,o.useCallback)(({output:t,currentOperateUrl:e})=>e||(null==t?void 0:t.operateUrl)?void 0:"link--disabled",[]),r=(0,o.useCallback)(({output:t,currentOperateUrl:e})=>e||(null==t?void 0:t.operateUrl)?void 0:"No Operate URL set for this connection",[]);return(0,sd.jsx)(_d,{priority:200,render:t,visible:e,href:n,target:"_blank",className:i,tooltip:r})};function Dd(){const t=(0,o.useCallback)(()=>"Clear",[]),e=(0,o.useCallback)(({isConnectionConfigured:t,output:e})=>t&&e,[]),n=(0,o.useCallback)(({onResetOutput:t})=>()=>t(),[]);return(0,sd.jsx)(_d,{priority:100,render:t,visible:e,onClick:n,role:"button"})}function Rd({title:t,description:e,actionLabel:n,actionUrl:i="#",onActionClick:r}){return(0,sd.jsxs)("div",{className:"output__error",children:[(0,sd.jsxs)("div",{className:"output__error--title",children:[(0,sd.jsx)("span",{children:t}),n&&r&&(0,sd.jsx)("div",{className:"output__error--action",children:(0,sd.jsx)(l.Link,{href:i,onClick:()=>r(),children:n})})]}),(0,sd.jsx)("div",{className:"output__error--content",children:(0,sd.jsx)("span",{children:e})})]})}var Bd=s(72),Id=s.n(Bd),Nd=s(825),Ld=s.n(Nd),Fd=s(659),Vd=s.n(Fd),jd=s(56),zd=s.n(jd),Hd=s(540),Wd=s.n(Hd),$d=s(113),qd=s.n($d),Ud=s(520),Kd={};function Gd({injector:t,api:e,isConnectionConfigured:n,configureConnectionBannerTitle:i="Connection required",configureConnectionBannerDescription:r="Configure a connection to start testing.",configureConnectionLabel:s="Configure",onConfigureConnection:a,onTestTask:h,config:u,onConfigChanged:f=()=>{},operateBaseUrl:p,documentationUrl:g,onTaskExecutionStarted:m=()=>{},onTaskExecutionFinished:v=()=>{},onTaskExecutionInterrupted:b=()=>{},children:y=[]}){const w=(0,o.useRef)(null),x=(0,o.useRef)(null),[k,_]=(0,o.useState)([]),[P,D]=(0,o.useState)(),[R,N]=(0,o.useState)(),[L,F]=(0,o.useState)(),[V,j]=(0,o.useState)({}),[z,H]=(0,o.useState)(null),[W,$]=(0,o.useState)(),[q,U]=function(t){const[e,n]=(0,o.useState)(null),[i,r]=(0,o.useState)(O);(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?O:S(i[0],E)?function(t){let e=M(C(t));for(;e;){if(A(e,"bpmn:AdHocSubProcess"))return!0;e=M(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(O)):S(t[0],E)?(n(t[0]),r(null)):(n(null),r(T))};return[e,i]}(t),K=(0,o.useRef)(null),[G,Y]=(0,o.useState)(!0);(0,o.useEffect)(()=>{const n=new I(t);w.current=n;const i=new B(t,n,u);x.current=i;const r=new nd(t,e);return K.current=r,()=>{var t;null===(t=K.current)||void 0===t||t.cancelTaskExecution()}},[t]),(0,o.useEffect)(()=>{q&&w.current&&w.current.getVariablesForElement(q).then(t=>_(t))},[q]),(0,o.useEffect)(()=>{if(!w.current)return;const t=async()=>{if(!q||!w.current)return;const t=await w.current.getVariablesForElement(q);_(t)};return w.current.on("variables.changed",t),()=>{w.current&&w.current.off("variables.changed",t)}},[q]),(0,o.useEffect)(()=>{if(!x.current)return;const t=()=>{x.current&&(f(x.current.getConfig()),q&&(N(x.current.getInputConfigForElement(q)),F(x.current.getOutputConfigForElement(q)),j(x.current.getConfig().output)))};return x.current.on("config.changed",t),()=>{x.current&&x.current.off("config.changed",t)}},[q,f,j,N,F]),(0,o.useEffect)(()=>{var t,e,n,i;const r=t=>{var e;null==x||null===(e=x.current)||void 0===e||e.setOutputConfigForElement(q,{success:!1,error:t})},s=(t,e)=>{if(D(t),e&&p){const t=function(t,e){const n=t.replace(/\/+$/,"");return new URL(`processes/${e}`,`${n}/`).toString()}(p,e);$(t)}"idle"===t&&$(void 0)},o=t=>{var e;null==x||null===(e=x.current)||void 0===e||e.setOutputConfigForElement(q,{...t,operateUrl:W}),v(q,t)},l=()=>{b()};return null==K||null===(t=K.current)||void 0===t||t.on("taskExecution.finished",o),null==K||null===(e=K.current)||void 0===e||e.on("taskExecution.status.changed",s),null==K||null===(n=K.current)||void 0===n||n.on("taskExecution.error",r),null==K||null===(i=K.current)||void 0===i||i.on("taskExecution.interrupted",l),()=>{K.current&&(K.current.off("taskExecution.finished",o),K.current.off("taskExecution.status.changed",s),K.current.off("taskExecution.error",r),K.current.off("taskExecution.interrupted",l))}},[q,p,W]),(0,o.useEffect)(()=>{u&&x.current&&JSON.stringify(u)!==JSON.stringify(x.current.getConfig())&&x.current.setConfig(u)},[u]),(0,o.useEffect)(()=>{var t,e;q?(N(null==x||null===(t=x.current)||void 0===t?void 0:t.getInputConfigForElement(q)),F(null==x||null===(e=x.current)||void 0===e?void 0:e.getOutputConfigForElement(q))):N(void 0)},[q]);const Q=((t=[])=>{const[e,n]=(0,o.useState)(t),i=(0,o.useCallback)(t=>{n(e=>[...e,t])},[]),r=(0,o.useCallback)(t=>{n(e=>e.filter(e=>e!==t))},[]),s=(0,o.useCallback)(t=>e.filter(e=>e.type===t).sort((t,e)=>(e.priority??0)-(t.priority??0)),[e]);return{plugins:e,registerPlugin:i,unregisterPlugin:r,getPlugins:s}})(),J=(0,o.useCallback)(t=>{q&&x.current&&x.current.setInputConfigForElement(q,t)},[q]),X=(0,o.useCallback)(()=>{q&&x.current&&x.current.resetInputConfigForElement(q)},[q]),Z=async()=>{if(z||!q||!K.current||!x.current)return;m(q);const t=x.current.getInputConfigForElement(q);x.current.setOutputConfigForElement(q,null),K.current.executeTask(q,JSON.parse(t))},tt=(0,o.useCallback)(()=>{q&&x.current&&x.current.resetOutputConfigForElement(q)},[q]);if(!u)return(0,sd.jsx)("div",{className:"task-testing__container task-testing__container--empty",children:(0,sd.jsxs)("div",{className:"task-testing__container-no-config",children:[(0,sd.jsx)(l.InlineLoading,{})," ",(0,sd.jsx)("span",{children:"Configuring..."})]})});if(!q)return(0,sd.jsx)("div",{className:"task-testing__container task-testing__container--empty",children:(0,sd.jsxs)("div",{className:"task-testing__container-no-element",children:[(0,sd.jsx)(c.Cursor_1,{}),(0,sd.jsx)("span",{children:U}),g&&(0,sd.jsx)(l.Link,{href:g,target:"_blank",children:"Learn more."})]})});const et=!n||!!z,nt=n?z:i,it=!!P&&"idle"!==P;return(0,sd.jsxs)(md.Provider,{value:Q,children:[(0,sd.jsxs)("div",{className:"task-testing__container",children:[(0,sd.jsxs)("div",{className:"task-testing__container--left",children:[(0,sd.jsxs)("div",{className:"task-testing__container--header",children:[(0,sd.jsxs)("div",{className:"task-header",children:[(0,sd.jsx)("span",{className:"task-type",children:Zu(q,t)}),(0,sd.jsx)("span",{className:"task-name",children:Xu(q)})]}),(0,sd.jsxs)("div",{children:[(0,sd.jsx)(l.Tooltip,{className:d()({"show-tooltip":et}),label:nt,align:"left-start",children:(0,sd.jsx)(l.Button,{"data-testid":"test-task-btn",className:"btn-execute",kind:"primary",size:"sm",renderIcon:it?c.StopFilledAlt:c.PlayFilledAlt,iconDescription:it?"Cancel":"Test task",onClick:async()=>{var t;it?null==K||null===(t=K.current)||void 0===t||t.cancelTaskExecution():h?(Y(!1),await h()&&Z(),Y(!0)):n&&Z()},disabled:!G,children:it?"Cancel":"Test task"})}),a&&(0,sd.jsx)(l.Button,{"data-testid":"configure-connection-btn",kind:"ghost",size:"sm",hasIconOnly:!0,renderIcon:c.Settings,iconDescription:s,onClick:()=>a()})]})]}),(0,sd.jsx)(pd,{allOutputs:V,input:R,onErrorChange:H,onResetInput:X,onSetInput:J,variablesForElement:k})]}),(0,sd.jsx)("div",{className:"task-testing__container--right",children:(0,sd.jsx)(Td,{element:q,isConnectionConfigured:n,configureConnectionBannerTitle:i,configureConnectionBannerDescription:r,configureConnectionLabel:s,onConfigureConnection:a,isTaskExecuting:it,output:L,currentOperateUrl:W,onResetOutput:tt,taskExecutionStatus:P||"idle"})})]}),y]})}Kd.styleTagTransform=qd(),Kd.setAttributes=zd(),Kd.insert=Vd().bind(null,"head"),Kd.domAPI=Ld(),Kd.insertStyleElement=Wd(),Id()(Ud.A,Kd),Ud.A&&Ud.A.locals&&Ud.A.locals,Gd.Tab=yd,Gd.Link=_d;export{Gd as default};
|
|
2
|
+
import*as e from"react";import{Button as t,InlineLoading as n,Link as i,SkeletonPlaceholder as r}from"@carbon/react";import{createPortal as s}from"react-dom";import{CheckmarkFilled as o,CheckmarkOutline as l,ChevronDown as a,ChevronRight as c,Copy as h,Cursor_1 as u,Email as d,Erase as f,ErrorFilled as p,Information as g,Launch as m,PlayFilledAlt as A,Settings as v,StopFilledAlt as b,TaskComplete as x,Warning as y,WarningFilled as w}from"@carbon/icons-react";var C={520(e,t,n){n.d(t,{A:()=>l});var i=n(354),r=n.n(i),s=n(314),o=n.n(s)()(r());o.push([e.id,'.task-testing__container{--color-text-primary: #161616;--color-text-secondary: #525252;--color-text-disabled: #8d8d8d;--color-text-placeholder: hsl(225, 10%, 35%);--color-bg: #fff;--color-bg-light: #f4f4f4;--color-bg-muted: hsl(225, 10%, 95%);--color-border-light: #e0e0e0;--color-border-strong: hsl(225, 10%, 75%);--color-interactive: #0f62fe;--color-info: #0043ce;--color-info-bg: #edf5ff;--color-info-border: #0043ce4d;--color-success: #24a148;--color-success-bg: #defbe6;--color-success-border: #24a1484d;--color-error: #da1e28;--color-error-bg: #fff1f1;--color-error-border: #da1e284d;--color-warning: #f1c21b;--color-warning-bg: #fdf6dd;--color-warning-border: #e0a520;--color-canceled: var(--color-text-secondary);--color-canceled-bg: #f4f4f4;--color-canceled-border: #e0e0e0;display:flex;flex-direction:column;height:100%;width:100%;font-size:14px;container-type:inline-size}.task-testing__container.task-testing__container--empty{align-items:center;justify-content:center;background-color:var(--color-bg-muted)}.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;flex-direction:column;align-items:center;gap:8px}.task-testing__container.task-testing__container--empty .task-testing__container-no-config>svg,.task-testing__container.task-testing__container--empty .task-testing__container-no-element>svg{width:32px;height:32px;color:var(--color-text-placeholder)}.task-testing__container.task-testing__container--empty .task-testing__container-no-config>span,.task-testing__container.task-testing__container--empty .task-testing__container-no-element>span{margin:12px 48px;text-align:center;color:var(--color-text-placeholder);font-size:14px}.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-tabs__list{display:flex;border-bottom:1px solid var(--color-border-strong);background:var(--color-bg-muted);flex-shrink:0}.task-testing__container .task-testing-tabs__tab{padding:6px 12px;background:none;border:none;border-bottom:2px solid rgba(0,0,0,0);font-size:14px;font-weight:600;color:var(--color-text-secondary)}.task-testing__container .task-testing-tabs__tab:hover{color:var(--color-text-primary);background-color:var(--color-bg-light);cursor:pointer}.task-testing__container .task-testing-tabs__tab.task-testing-tabs__tab--active{color:var(--color-text-primary);border-bottom-color:var(--color-interactive)}.task-testing__container .task-testing-tabs__tab.task-testing-tabs__tab--disabled{color:var(--color-text-disabled)}.task-testing__container .task-testing-tabs__panel{display:flex;flex-direction:column;flex-grow:1;min-height:0;overflow-y:auto}.task-testing__container .task-testing__container--header{flex-shrink:0;display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:12px;border-bottom:1px solid var(--color-border-light)}.task-testing__container .task-testing__container--header .cds--popover{display:none}.task-testing__container .task-testing__container--header .task-testing__header-status{display:flex;align-items:center;gap:6px;min-width:0;flex:1}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__status-icon--success{fill:var(--color-success);flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__status-icon--error{fill:var(--color-error);flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__status-icon--canceled{fill:var(--color-canceled);flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__status-icon--terminated{fill:var(--color-warning);flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__header-status-text{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.task-testing__container .task-testing__container--header .task-testing__header-actions{display:flex;align-items:center;flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-actions-right{display:flex;align-items:center;flex-shrink:0}.task-testing__container .task-testing__container--header .btn-execute{width:140px}.task-testing__container .task-testing__container--header .cds--btn .cds--inline-loading{inline-size:initial;min-block-size:initial}.task-testing__container .task-testing__container--body{display:flex;flex-direction:column;flex-grow:1;min-height:0;overflow:hidden}.task-testing__container .task-testing__container--body.task-testing__container--body-executing{padding-bottom:12px;overflow-y:auto}.task-testing__container .input{flex-grow:1;display:flex;flex-direction:column;gap:6px;margin:12px 0;padding:0 12px}.task-testing__container .input .input__header{display:flex;justify-content:space-between;align-items:center;gap:6px;width:100%}.task-testing__container .input .input__header--title{color:var(--color-text-secondary);font-weight:600}.task-testing__container .input .input__footer{border-radius:4px;border:1px solid var(--color-info-border);background-color:var(--color-info-bg);color:var(--color-text-primary);padding:12px;display:flex;align-items:flex-start}.task-testing__container .input .input__footer .input__footer--icon{flex-shrink:0;display:flex;align-items:center}.task-testing__container .input .input__footer .input__footer--icon svg{fill:var(--color-info)}.task-testing__container .input .input__footer .input__footer--text{font-size:14px;line-height:18px;margin-left:12px}.task-testing__container .output{flex-grow:1;display:flex;flex-direction:column;gap:12px;min-height:0}.task-testing__container .output .output__banner{display:flex;flex-direction:column;gap:0;font-size:14px;flex-shrink:0;border-radius:4px;margin:12px 12px 0}.task-testing__container .output .output__banner.output__banner--success{background-color:var(--color-success-bg);border:1px solid var(--color-success-border)}.task-testing__container .output .output__banner.output__banner--success .output__banner-icon svg{fill:var(--color-success)}.task-testing__container .output .output__banner.output__banner--error{background-color:var(--color-error-bg);border:1px solid var(--color-error-border)}.task-testing__container .output .output__banner.output__banner--error .output__banner-details-content{margin-top:6px;white-space:pre-wrap;font-family:"IBM Plex Mono",monospace;line-height:18px;width:100%}.task-testing__container .output .output__banner.output__banner--error .output__banner-icon svg{fill:var(--color-error)}.task-testing__container .output .output__banner.output__banner--warning{background-color:var(--color-warning-bg);border:1px solid var(--color-warning-border)}.task-testing__container .output .output__banner.output__banner--warning .output__banner-icon svg{fill:var(--color-warning)}.task-testing__container .output .output__banner.output__banner--canceled{background-color:var(--color-canceled-bg);border:1px solid var(--color-canceled-border)}.task-testing__container .output .output__banner.output__banner--canceled .output__banner-icon svg{fill:var(--color-canceled)}.task-testing__container .output .output__banner.output__banner--executing{background-color:var(--color-info-bg);border:1px solid var(--color-info-border)}.task-testing__container .output .output__banner.output__banner--executing .output__banner-loader{width:auto;min-height:0}.task-testing__container .output .output__banner .output__banner-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px}.task-testing__container .output .output__banner .output__banner-main{display:flex;align-items:center;gap:6px;min-width:0;flex-grow:1}.task-testing__container .output .output__banner .output__banner-chevron{margin-left:auto;flex-shrink:0;fill:currentColor}.task-testing__container .output .output__banner .output__banner-icon{display:flex;flex-shrink:0}.task-testing__container .output .output__banner .output__banner-text{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.task-testing__container .output .output__banner .output__banner-timing{color:var(--color-text-secondary);white-space:nowrap;flex-shrink:0;margin-left:auto}.task-testing__container .output .output__banner .output__banner-actions{display:flex;flex-direction:column;gap:4px;padding:0 12px 8px 34px}.task-testing__container .output .output__banner .output__banner-actions .cds--link{font-size:14px;display:flex;align-items:center}.task-testing__container .output .output__banner .output__banner-actions .link--disabled,.task-testing__container .output .output__banner .output__banner-actions .link--disabled:hover{color:var(--color-text-disabled);text-decoration:none}.task-testing__container .output .output__banner .output__banner-details{padding:0 12px 8px 34px}.task-testing__container .output .output__banner .output__banner-details .output__banner-details-content{margin:0;color:var(--color-text-secondary)}.task-testing__container .output .output__banner .output__banner-incident,.task-testing__container .output .output__banner .output__banner-error{display:flex;flex-direction:column;gap:6px;align-items:flex-start}.task-testing__container .output .output__banner .output__banner-incident-heading,.task-testing__container .output .output__banner .output__banner-error-heading{font-weight:600;color:var(--color-text-primary);text-decoration:underline dotted;text-underline-offset:2px}.task-testing__container .output .output__banner .output__banner--error .output__banner-details{font-family:"IBM Plex Mono",monospace;line-height:18px}.task-testing__container .output .output__banner .output__banner-details-row{display:flex;column-gap:8px;line-height:18px}.task-testing__container .output .output__banner .output__banner-details-label{color:var(--color-text-secondary);white-space:nowrap;width:30%;overflow:hidden;text-overflow:ellipsis}.task-testing__container .output .output__banner .output__banner-details-value{color:var(--color-text-primary);font-family:"IBM Plex Mono",monospace;width:70%;white-space:pre-wrap;word-break:break-word}@container (max-width: 380px){.task-testing__container .output .output__banner .output__banner-details-row{flex-wrap:wrap}.task-testing__container .output .output__banner .output__banner-details-label{width:auto}.task-testing__container .output .output__banner .output__banner-details-value{width:auto;overflow:visible;white-space:normal;word-break:break-word}}.task-testing__container .output .output__empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:48px 24px;color:var(--color-text-secondary)}.task-testing__container .output .output__empty-state .output__empty-state-icon{width:42px;height:42px;border-radius:50%;display:flex;align-items:center;justify-content:center;background-color:var(--color-bg-light)}.task-testing__container .output .output__empty-state .output__empty-state-icon svg{width:24px;height:24px}.task-testing__container .output .output__empty-state .output__empty-state-text{text-align:center}.task-testing__container .output .output__body{display:flex;flex-direction:column;padding-bottom:8px}.task-testing__container .output .output__body .cds--tabs{--cds-layout-size-height-local: 32px;display:flex;flex-direction:column;min-height:0}.task-testing__container .output .output__body .cds--tab-content{padding:0}.task-testing__container .output .output__body .cds--tab-content:not([hidden]){display:flex;flex-grow:1;min-height:0}.task-testing__container .output .output__collapsible{border-bottom:1px solid var(--color-border-strong)}.task-testing__container .output .output__collapsible:last-child{border-bottom:none}.task-testing__container .output .output__collapsible-sentinel{height:1px;margin-bottom:-1px;visibility:hidden;pointer-events:none}.task-testing__container .output .output__collapsible-header{display:flex;align-items:center;gap:4px;width:100%;padding:6px 12px;background:var(--color-bg);border:none;border-bottom:1px solid rgba(0,0,0,0);font-size:14px;font-weight:normal;color:var(--color-text-secondary);position:sticky;top:0;z-index:2}.task-testing__container .output .output__collapsible-header.stuck{background:var(--color-bg-muted);border-bottom-color:var(--color-border-strong)}.task-testing__container .output .output__collapsible-header:hover{color:var(--color-text-primary)}.task-testing__container .output .output__collapsible-header svg{flex-shrink:0;fill:currentColor}.task-testing__container .output .output__collapsible-chevron{margin-left:auto}.task-testing__container .output .output__collapsible-title{user-select:none}.task-testing__container .output .output__collapsible-content{padding:0 12px 8px}.task-testing__container .output .output__section-empty{color:var(--color-text-secondary);font-size:14px;padding:4px 0}.task-testing__container .output .output__error{display:flex;flex-direction:column;gap:12px;padding:12px;margin-bottom:12px;border:1px solid var(--color-error);border-left-width:3px;background-color:var(--color-error-bg)}.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:var(--color-error)}.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:var(--color-text-secondary)}.task-testing__container .output .output__variables--empty-action{font-weight:bold}.task-testing__container .output .output__variables--skeleton .cds--skeleton__placeholder{width:100% !important}.task-testing__container .output code{font-size:14px}.task-testing__container .execution-log{font-size:14px}.task-testing__container .execution-log .execution-log__details{margin:4px 0 0 0}.task-testing__container .execution-log .execution-log__details-row{display:flex;column-gap:8px;line-height:18px}.task-testing__container .execution-log .execution-log__details-label{color:var(--color-text-secondary);white-space:nowrap;width:30%;overflow:hidden;text-overflow:ellipsis}.task-testing__container .execution-log .execution-log__details-value{color:var(--color-text-primary);font-family:"IBM Plex Mono",monospace;width:70%;overflow:hidden;text-overflow:ellipsis}@container (max-width: 380px){.task-testing__container .execution-log .execution-log__details-row{flex-wrap:wrap}.task-testing__container .execution-log .execution-log__details-label{width:auto}.task-testing__container .execution-log .execution-log__details-value{width:auto;overflow:visible;white-space:normal;word-break:break-word}}.task-testing__container .execution-log .execution-log__empty{color:var(--color-text-secondary)}.task-testing__container .execution-log .execution-log__empty-action{font-weight:bold}.task-testing__container .execution-log .execution-log__entries{list-style:none;margin:0;padding:0 0 0 2px;display:flex;flex-direction:column;position:relative}.task-testing__container .execution-log .execution-log__entry-wrapper{display:flex;flex-direction:column;position:relative;padding:0 0 0 20px;margin-bottom:0}.task-testing__container .execution-log .execution-log__entry-wrapper::before{content:"";position:absolute;left:0;top:9px;width:7px;height:7px;border-radius:50%;background-color:var(--color-border-light);z-index:1}.task-testing__container .execution-log .execution-log__entry-wrapper::after{content:"";position:absolute;left:3px;top:20px;bottom:-4px;width:1px;background-color:var(--color-border-light)}.task-testing__container .execution-log .execution-log__entry-wrapper:last-child::after{display:none}.task-testing__container .execution-log .execution-log__entry-wrapper.execution-log__entry-wrapper--active::before{background-color:rgba(0,0,0,0);border:1px solid var(--color-border-strong)}.task-testing__container .execution-log .execution-log__entry-content{padding:4px 8px;border-radius:4px}.task-testing__container .execution-log .execution-log__entry-content:hover{background-color:var(--color-bg-light)}.task-testing__container .execution-log .execution-log__entry{display:flex;align-items:center;gap:8px;color:var(--color-text-secondary);font-size:14px;line-height:18px}.task-testing__container .execution-log .execution-log__entry--expandable:hover{color:var(--color-text-primary)}.task-testing__container .execution-log .execution-log__toggle{display:flex;align-items:center;margin-left:auto}.task-testing__container .execution-log .execution-log__toggle svg{fill:var(--color-text-disabled)}.task-testing__container .execution-log .execution-log__labels{display:flex;flex-direction:column;min-width:0;flex:1}.task-testing__container .execution-log .execution-log__label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.task-testing__container .execution-log .execution-log__label-row{display:flex;align-items:center;gap:8px;min-width:0}.task-testing__container .execution-log .execution-log__duration{font-size:11px;color:var(--color-text-disabled);white-space:nowrap;flex-shrink:0}.task-testing__container .execution-log .execution-log__secondary-label{color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border-radius:4px;background-color:var(--color-bg-light);padding:2px 4px;font-size:12px;align-self:flex-start;margin-top:2px}.task-testing__container .execution-log .execution-log__cta{margin-top:12px;padding:12px;border:1px solid var(--color-info-border);background-color:var(--color-info-bg);border-radius:4px}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-header{display:flex;align-items:center;gap:6px;margin-bottom:6px}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-header svg{fill:var(--color-info-border);flex-shrink:0}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-title{font-weight:600;font-size:14px;color:var(--color-text-primary)}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-description{margin:0 0 8px;font-size:14px;color:var(--color-text-secondary);line-height:18px}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-link{font-size:14px}.task-testing__container .task-testing-tooltip__wrapper{display:inline-flex;align-items:center;width:fit-content}.task-testing__container .code__editor{position:relative;display:flex;flex-direction:column}.task-testing__container .code__editor.code__editor--error .code__editor-codemirror{border-color:var(--color-error);background-color:var(--color-error-bg)}.task-testing__container .code__editor.code__editor--error .cm-gutter{background-color:var(--color-error-bg)}.task-testing__container .code__editor .code__editor-codemirror{border:1px solid var(--color-border-strong);border-radius:2px;background-color:var(--color-bg-light)}.task-testing__container .code__editor .code__editor-codemirror .cm-scroller{overflow:visible !important}.task-testing__container .code__editor .code__editor-codemirror .cm-content{padding:6px}.task-testing__container .code__editor .code__editor-codemirror .cm-focused{outline:none}.task-testing__container .code__editor .code__editor-codemirror .cm-tooltip{font-size:14px}.task-testing__container .code__editor .code__editor-codemirror .info{padding:6px;font-family:"IBM Plex Mono",monospace;font-size:12px;max-width:300px;word-wrap:break-word}.task-testing__container .code__editor .code__editor-codemirror .info pre{margin-top:8px}.task-testing__container .code__editor .code__editor-error{color:var(--color-error);font-size:14px;margin-top:5px}.task-testing__container .code__editor .code__editor-copy-button,.task-testing__container .code__editor .code__editor-clear-button{position:absolute;top:5px;right:5px;z-index:10;block-size:24px;inline-size:24px;padding-block-start:0;padding-inline-end:0;min-block-size:0;display:flex;justify-content:center;align-items:center}.task-testing__container .code__editor .code__editor-copy-button svg,.task-testing__container .code__editor .code__editor-clear-button svg{fill:var(--color-text-secondary)}.task-testing__container .has-tooltip{text-decoration:underline;text-decoration-style:dotted;text-underline-offset:2px}.task-testing-tooltip{--tooltip-color-bg: hsl(0, 0%, 22%);--tooltip-color-text: #fff;--tooltip-color-link: hsl(218, 100%, 74%);--tooltip-color-code-text: hsl(225, 10%, 35%);--tooltip-color-code-bg: hsl(225, 10%, 97%);--tooltip-color-code-border: hsl(225, 10%, 85%);position:fixed;z-index:1000;max-width:300px;font-size:13px;font-family:"IBM Plex Sans",sans-serif;color:var(--tooltip-color-text)}.task-testing-tooltip .task-testing-tooltip__content{background-color:var(--tooltip-color-bg);color:var(--tooltip-color-text);padding:16px;border-radius:2px;font-size:14px;font-weight:400;white-space:pre-wrap;line-height:21px}.task-testing-tooltip .task-testing-tooltip__content .bio-properties-panel-tooltip-content h1{font-size:14px;font-weight:bold;margin:0}.task-testing-tooltip .task-testing-tooltip__content a{color:var(--tooltip-color-link) !important;text-decoration:underline !important}.task-testing-tooltip .task-testing-tooltip__content code,.task-testing-tooltip .task-testing-tooltip__content pre{color:var(--tooltip-color-code-text);font-family:"IBM Plex Mono",monospace;font-size:13px;line-height:17px;padding:0 2px;background-color:var(--tooltip-color-code-bg);border:1px solid var(--tooltip-color-code-border);border-radius:2px}.task-testing-tooltip .task-testing-tooltip__content pre code{border:none}.task-testing-tooltip .task-testing-tooltip__content p:first-child{margin-top:0}.task-testing-tooltip .task-testing-tooltip__content p:last-child{margin-bottom:0}.task-testing-tooltip .task-testing-tooltip__arrow{position:absolute;width:0;height:0}.task-testing-tooltip.bottom-start,.task-testing-tooltip.bottom-end{padding-top:6px}.task-testing-tooltip.bottom-start .task-testing-tooltip__arrow,.task-testing-tooltip.bottom-end .task-testing-tooltip__arrow{top:1px;left:12px;border-left:5px solid rgba(0,0,0,0);border-right:5px solid rgba(0,0,0,0);border-bottom:5px solid var(--tooltip-color-bg)}.task-testing-tooltip.bottom-end .task-testing-tooltip__arrow{left:auto;right:12px}.task-testing-tooltip.top-start,.task-testing-tooltip.top-end{padding-bottom:6px}.task-testing-tooltip.top-start .task-testing-tooltip__arrow,.task-testing-tooltip.top-end .task-testing-tooltip__arrow{bottom:1px;left:12px;border-left:5px solid rgba(0,0,0,0);border-right:5px solid rgba(0,0,0,0);border-top:5px solid var(--tooltip-color-bg)}.task-testing-tooltip.top-end .task-testing-tooltip__arrow{left:auto;right:12px}',"",{version:3,sources:["webpack://./lib/style/style.scss"],names:[],mappings:"AAAA,yBAGE,6BAAA,CACA,+BAAA,CACA,8BAAA,CACA,4CAAA,CAGA,gBAAA,CACA,yBAAA,CACA,oCAAA,CAGA,6BAAA,CACA,yCAAA,CAGA,4BAAA,CAGA,qBAAA,CACA,wBAAA,CACA,8BAAA,CAGA,wBAAA,CACA,2BAAA,CACA,iCAAA,CAGA,sBAAA,CACA,yBAAA,CACA,+BAAA,CAGA,wBAAA,CACA,2BAAA,CACA,+BAAA,CAGA,6CAAA,CACA,4BAAA,CACA,gCAAA,CAEA,YAAA,CACA,qBAAA,CACA,WAAA,CACA,UAAA,CACA,cAAA,CACA,0BAAA,CAEA,wDACE,kBAAA,CACA,sBAAA,CACA,sCAAA,CAEA,uLAEE,YAAA,CACA,qBAAA,CACA,kBAAA,CACA,OAAA,CAEA,+LACE,UAAA,CACA,WAAA,CACA,mCAAA,CAGF,iMACE,gBAAA,CACA,iBAAA,CACA,mCAAA,CACA,cAAA,CAGF,iOACE,mBAAA,CACA,sBAAA,CAKN,kDACE,YAAA,CACA,kDAAA,CACA,gCAAA,CACA,aAAA,CAGF,iDACE,gBAAA,CACA,eAAA,CACA,WAAA,CACA,qCAAA,CACA,cAAA,CACA,eAAA,CACA,iCAAA,CAEA,uDACE,+BAAA,CACA,sCAAA,CACA,cAAA,CAGF,gFACE,+BAAA,CACA,4CAAA,CAGF,kFACE,gCAAA,CAIJ,mDACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,YAAA,CACA,eAAA,CAGF,0DACE,aAAA,CACA,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,6BAAA,CACA,QAAA,CACA,UAAA,CACA,YAAA,CACA,iDAAA,CAGA,wEACE,YAAA,CAGF,uFACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,WAAA,CACA,MAAA,CAEA,2HACE,yBAAA,CACA,aAAA,CAGF,yHACE,uBAAA,CACA,aAAA,CAGF,4HACE,0BAAA,CACA,aAAA,CAGF,8HACE,yBAAA,CACA,aAAA,CAGF,yHACE,cAAA,CACA,kBAAA,CACA,eAAA,CACA,sBAAA,CAIJ,wFACE,YAAA,CACA,kBAAA,CACA,aAAA,CAGF,8FACE,YAAA,CACA,kBAAA,CACA,aAAA,CAGF,uEACE,WAAA,CAGF,yFACE,mBAAA,CACA,sBAAA,CAIJ,wDACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,YAAA,CACA,eAAA,CAEA,gGACE,mBAAA,CACA,eAAA,CAIJ,gCACE,WAAA,CACA,YAAA,CACA,qBAAA,CACA,OAAA,CACA,aAAA,CACA,cAAA,CAEA,+CACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,OAAA,CACA,UAAA,CAGF,sDACE,iCAAA,CACA,eAAA,CAGF,+CACE,iBAAA,CACA,yCAAA,CACA,qCAAA,CACA,+BAAA,CACA,YAAA,CACA,YAAA,CACA,sBAAA,CAEA,oEACE,aAAA,CACA,YAAA,CACA,kBAAA,CAEA,wEACE,sBAAA,CAIJ,oEACE,cAAA,CACA,gBAAA,CACA,gBAAA,CAKN,iCACE,WAAA,CACA,YAAA,CACA,qBAAA,CACA,QAAA,CACA,YAAA,CAEA,iDACE,YAAA,CACA,qBAAA,CACA,KAAA,CACA,cAAA,CACA,aAAA,CACA,iBAAA,CACA,kBAAA,CAEA,yEACE,wCAAA,CACA,4CAAA,CAEA,kGACE,yBAAA,CAIJ,uEACE,sCAAA,CACA,0CAAA,CAEA,uGACE,cAAA,CACA,oBAAA,CACA,qCAAA,CACA,gBAAA,CACA,UAAA,CAGF,gGACE,uBAAA,CAIJ,yEACE,wCAAA,CACA,4CAAA,CAEA,kGACE,yBAAA,CAIJ,0EACE,yCAAA,CACA,6CAAA,CAEA,mGACE,0BAAA,CAIJ,2EACE,qCAAA,CACA,yCAAA,CAEA,kGACE,UAAA,CACA,YAAA,CAIJ,wEACE,YAAA,CACA,kBAAA,CACA,6BAAA,CACA,OAAA,CACA,gBAAA,CAGF,sEACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,WAAA,CACA,WAAA,CAGF,yEACE,gBAAA,CACA,aAAA,CACA,iBAAA,CAGF,sEACE,YAAA,CACA,aAAA,CAGF,sEACE,eAAA,CACA,kBAAA,CACA,eAAA,CACA,sBAAA,CAGF,wEACE,iCAAA,CACA,kBAAA,CACA,aAAA,CACA,gBAAA,CAGF,yEACE,YAAA,CACA,qBAAA,CACA,OAAA,CACA,uBAAA,CAEA,oFACE,cAAA,CACA,YAAA,CACA,kBAAA,CAGF,wLACE,gCAAA,CACA,oBAAA,CAIJ,yEACE,uBAAA,CAEA,yGACE,QAAA,CACA,iCAAA,CAIJ,iJACE,YAAA,CACA,qBAAA,CACA,OAAA,CACA,sBAAA,CAGF,iKACE,eAAA,CACA,+BAAA,CACA,gCAAA,CACA,yBAAA,CAGF,gGACE,qCAAA,CACA,gBAAA,CAGF,6EACE,YAAA,CACA,cAAA,CACA,gBAAA,CAGF,+EACE,iCAAA,CACA,kBAAA,CACA,SAAA,CACA,eAAA,CACA,sBAAA,CAGF,+EACE,+BAAA,CACA,qCAAA,CACA,SAAA,CACA,oBAAA,CACA,qBAAA,CAGF,8BACE,6EACE,cAAA,CAGF,+EACE,UAAA,CAGF,+EACE,UAAA,CACA,gBAAA,CACA,kBAAA,CACA,qBAAA,CAAA,CAKN,sDACE,YAAA,CACA,qBAAA,CACA,kBAAA,CACA,sBAAA,CACA,QAAA,CACA,iBAAA,CACA,iCAAA,CAEA,gFACE,UAAA,CACA,WAAA,CACA,iBAAA,CACA,YAAA,CACA,kBAAA,CACA,sBAAA,CACA,sCAAA,CAEA,oFACE,UAAA,CACA,WAAA,CAIJ,gFACE,iBAAA,CAIJ,+CACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAEA,0DACE,oCAAA,CACA,YAAA,CACA,qBAAA,CACA,YAAA,CAGF,iEACE,SAAA,CAGF,+EACE,YAAA,CACA,WAAA,CACA,YAAA,CAIJ,sDACE,kDAAA,CAEA,iEACE,kBAAA,CAIJ,+DACE,UAAA,CACA,kBAAA,CACA,iBAAA,CACA,mBAAA,CAGF,6DACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,UAAA,CACA,gBAAA,CACA,0BAAA,CACA,WAAA,CACA,qCAAA,CACA,cAAA,CACA,kBAAA,CACA,iCAAA,CACA,eAAA,CACA,KAAA,CACA,SAAA,CAEA,mEACE,gCAAA,CACA,8CAAA,CAGF,mEACE,+BAAA,CAGF,iEACE,aAAA,CACA,iBAAA,CAIJ,8DACE,gBAAA,CAGF,4DACE,gBAAA,CAGF,8DACE,kBAAA,CAGF,wDACE,iCAAA,CACA,cAAA,CACA,aAAA,CAGF,gDACE,YAAA,CACA,qBAAA,CACA,QAAA,CACA,YAAA,CACA,kBAAA,CACA,mCAAA,CACA,qBAAA,CACA,sCAAA,CAEA,sEACE,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,gBAAA,CAEA,0EACE,uBAAA,CAGF,6FACE,gBAAA,CAKN,2DACE,WAAA,CACA,YAAA,CACA,kBAAA,CACA,iCAAA,CAGF,kEACE,gBAAA,CAGF,0FACE,qBAAA,CAGF,sCACE,cAAA,CAIJ,wCACE,cAAA,CAEA,gEACE,gBAAA,CAGF,oEACE,YAAA,CACA,cAAA,CACA,gBAAA,CAGF,sEACE,iCAAA,CACA,kBAAA,CACA,SAAA,CACA,eAAA,CACA,sBAAA,CAGF,sEACE,+BAAA,CACA,qCAAA,CACA,SAAA,CACA,eAAA,CACA,sBAAA,CAGF,8BACE,oEACE,cAAA,CAGF,sEACE,UAAA,CAGF,sEACE,UAAA,CACA,gBAAA,CACA,kBAAA,CACA,qBAAA,CAAA,CAIJ,8DACE,iCAAA,CAGF,qEACE,gBAAA,CAGF,gEACE,eAAA,CACA,QAAA,CACA,iBAAA,CACA,YAAA,CACA,qBAAA,CACA,iBAAA,CAGF,sEACE,YAAA,CACA,qBAAA,CACA,iBAAA,CACA,kBAAA,CACA,eAAA,CAGA,8EACE,UAAA,CACA,iBAAA,CACA,MAAA,CACA,OAAA,CACA,SAAA,CACA,UAAA,CACA,iBAAA,CACA,0CAAA,CACA,SAAA,CAIF,6EACE,UAAA,CACA,iBAAA,CACA,QAAA,CACA,QAAA,CACA,WAAA,CACA,SAAA,CACA,0CAAA,CAGF,wFACE,YAAA,CAGF,mHAEE,8BAAA,CACA,2CAAA,CAIJ,sEACE,eAAA,CACA,iBAAA,CAEA,4EACE,sCAAA,CAIJ,8DACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,iCAAA,CACA,cAAA,CACA,gBAAA,CAIA,gFACE,+BAAA,CAIJ,+DACE,YAAA,CACA,kBAAA,CACA,gBAAA,CAEA,mEACE,+BAAA,CAIJ,+DACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,MAAA,CAGF,8DACE,kBAAA,CACA,eAAA,CACA,sBAAA,CAGF,kEACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,WAAA,CAGF,iEACE,cAAA,CACA,gCAAA,CACA,kBAAA,CACA,aAAA,CAGF,wEACE,iCAAA,CACA,kBAAA,CACA,eAAA,CACA,sBAAA,CACA,iBAAA,CACA,sCAAA,CACA,eAAA,CACA,cAAA,CACA,qBAAA,CACA,cAAA,CAGF,4DACE,eAAA,CACA,YAAA,CACA,yCAAA,CACA,qCAAA,CACA,iBAAA,CAEA,uFACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,iBAAA,CAEA,2FACE,6BAAA,CACA,aAAA,CAIJ,sFACE,eAAA,CACA,cAAA,CACA,+BAAA,CAGF,4FACE,cAAA,CACA,cAAA,CACA,iCAAA,CACA,gBAAA,CAGF,qFACE,cAAA,CAKN,wDACE,mBAAA,CACA,kBAAA,CACA,iBAAA,CAGF,uCACE,iBAAA,CACA,YAAA,CACA,qBAAA,CAGE,oFACE,+BAAA,CACA,sCAAA,CAGF,sEACE,sCAAA,CAIJ,gEACE,2CAAA,CACA,iBAAA,CACA,sCAAA,CAEA,6EACE,2BAAA,CAGF,4EACE,WAAA,CAGF,4EACE,YAAA,CAGF,4EACE,cAAA,CAGF,sEACE,WAAA,CACA,qCAAA,CACA,cAAA,CACA,eAAA,CACA,oBAAA,CAEA,0EACE,cAAA,CAKN,2DACE,wBAAA,CACA,cAAA,CACA,cAAA,CAGF,mIAEE,iBAAA,CACA,OAAA,CACA,SAAA,CACA,UAAA,CACA,eAAA,CACA,gBAAA,CACA,qBAAA,CACA,oBAAA,CACA,gBAAA,CACA,YAAA,CACA,sBAAA,CACA,kBAAA,CAEA,2IACE,gCAAA,CAKN,sCACE,yBAAA,CACA,4BAAA,CACA,yBAAA,CAKJ,sBACE,mCAAA,CACA,0BAAA,CACA,yCAAA,CACA,6CAAA,CACA,2CAAA,CACA,+CAAA,CAEA,cAAA,CACA,YAAA,CACA,eAAA,CACA,cAAA,CACA,sCAAA,CACA,+BAAA,CAEA,qDACE,wCAAA,CACA,+BAAA,CACA,YAAA,CACA,iBAAA,CACA,cAAA,CACA,eAAA,CACA,oBAAA,CACA,gBAAA,CAEA,8FACE,cAAA,CACA,gBAAA,CACA,QAAA,CAGF,uDACE,0CAAA,CACA,oCAAA,CAGF,mHACE,oCAAA,CACA,qCAAA,CACA,cAAA,CACA,gBAAA,CACA,aAAA,CACA,6CAAA,CACA,iDAAA,CACA,iBAAA,CAGF,8DACE,WAAA,CAGF,mEACE,YAAA,CAGF,kEACE,eAAA,CAIJ,mDACE,iBAAA,CACA,OAAA,CACA,QAAA,CAIF,oEAEE,eAAA,CAEA,8HACE,OAAA,CACA,SAAA,CACA,mCAAA,CACA,oCAAA,CACA,+CAAA,CAKF,8DACE,SAAA,CACA,UAAA,CAKJ,8DAEE,kBAAA,CAEA,wHACE,UAAA,CACA,SAAA,CACA,mCAAA,CACA,oCAAA,CACA,4CAAA,CAKF,2DACE,SAAA,CACA,UAAA",sourcesContent:[".task-testing__container {\n\n // Text\n --color-text-primary: #161616;\n --color-text-secondary: #525252;\n --color-text-disabled: #8d8d8d;\n --color-text-placeholder: hsl(225, 10%, 35%);\n\n // Backgrounds\n --color-bg: #fff;\n --color-bg-light: #f4f4f4;\n --color-bg-muted: hsl(225, 10%, 95%);\n\n // Borders\n --color-border-light: #e0e0e0;\n --color-border-strong: hsl(225, 10%, 75%);\n\n // Interactive\n --color-interactive: #0f62fe;\n\n // Info\n --color-info: #0043ce;\n --color-info-bg: #edf5ff;\n --color-info-border: #0043ce4d;\n\n // Success\n --color-success: #24a148;\n --color-success-bg: #defbe6;\n --color-success-border: #24a1484d;\n\n // Error\n --color-error: #da1e28;\n --color-error-bg: #fff1f1;\n --color-error-border: #da1e284d;\n\n // Warning\n --color-warning: #f1c21b;\n --color-warning-bg: #fdf6dd;\n --color-warning-border: #e0a520;\n\n // Canceled\n --color-canceled: var(--color-text-secondary);\n --color-canceled-bg: #f4f4f4;\n --color-canceled-border: #e0e0e0;\n\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n font-size: 14px;\n container-type: inline-size;\n\n &.task-testing__container--empty {\n align-items: center;\n justify-content: center;\n background-color: var(--color-bg-muted);\n\n .task-testing__container-no-config,\n .task-testing__container-no-element {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n\n > svg {\n width: 32px;\n height: 32px;\n color: var(--color-text-placeholder);\n }\n\n > span {\n margin: 12px 48px;\n text-align: center;\n color: var(--color-text-placeholder);\n font-size: 14px;\n }\n\n .cds--inline-loading {\n inline-size: initial;\n min-block-size: initial;\n }\n }\n }\n\n .task-testing-tabs__list {\n display: flex;\n border-bottom: 1px solid var(--color-border-strong);\n background: var(--color-bg-muted);\n flex-shrink: 0;\n }\n\n .task-testing-tabs__tab {\n padding: 6px 12px;\n background: none;\n border: none;\n border-bottom: 2px solid transparent;\n font-size: 14px;\n font-weight: 600;\n color: var(--color-text-secondary);\n\n &:hover {\n color: var(--color-text-primary);\n background-color: var(--color-bg-light);\n cursor: pointer;\n }\n\n &.task-testing-tabs__tab--active {\n color: var(--color-text-primary);\n border-bottom-color: var(--color-interactive);\n }\n\n &.task-testing-tabs__tab--disabled {\n color: var(--color-text-disabled);\n }\n }\n\n .task-testing-tabs__panel {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n min-height: 0;\n overflow-y: auto;\n }\n\n .task-testing__container--header {\n flex-shrink: 0;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n width: 100%;\n padding: 12px;\n border-bottom: 1px solid var(--color-border-light);\n\n /** Prevent IBM Carbon tooltips for `hasIconOnly` buttons */\n .cds--popover {\n display: none;\n }\n\n .task-testing__header-status {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n flex: 1;\n\n .task-testing__status-icon--success {\n fill: var(--color-success);\n flex-shrink: 0;\n }\n\n .task-testing__status-icon--error {\n fill: var(--color-error);\n flex-shrink: 0;\n }\n\n .task-testing__status-icon--canceled {\n fill: var(--color-canceled);\n flex-shrink: 0;\n }\n\n .task-testing__status-icon--terminated {\n fill: var(--color-warning);\n flex-shrink: 0;\n }\n\n .task-testing__header-status-text {\n font-size: 14px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .task-testing__header-actions {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .task-testing__header-actions-right {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .btn-execute {\n width: 140px;\n }\n\n .cds--btn .cds--inline-loading {\n inline-size: initial;\n min-block-size: initial;\n }\n }\n\n .task-testing__container--body {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n min-height: 0;\n overflow: hidden;\n\n &.task-testing__container--body-executing {\n padding-bottom: 12px;\n overflow-y: auto;\n }\n }\n\n .input {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin: 12px 0;\n padding: 0 12px;\n\n .input__header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 6px;\n width: 100%;\n }\n\n .input__header--title {\n color: var(--color-text-secondary);\n font-weight: 600;\n }\n\n .input__footer {\n border-radius: 4px;\n border: 1px solid var(--color-info-border);\n background-color: var(--color-info-bg);\n color: var(--color-text-primary);\n padding: 12px;\n display: flex;\n align-items: flex-start;\n\n .input__footer--icon {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n\n svg {\n fill: var(--color-info);\n }\n }\n\n .input__footer--text {\n font-size: 14px;\n line-height: 18px;\n margin-left: 12px;\n }\n }\n }\n\n .output {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 12px;\n min-height: 0;\n\n .output__banner {\n display: flex;\n flex-direction: column;\n gap: 0;\n font-size: 14px;\n flex-shrink: 0;\n border-radius: 4px;\n margin: 12px 12px 0;\n\n &.output__banner--success {\n background-color: var(--color-success-bg);\n border: 1px solid var(--color-success-border);\n\n .output__banner-icon svg {\n fill: var(--color-success);\n }\n }\n\n &.output__banner--error {\n background-color: var(--color-error-bg);\n border: 1px solid var(--color-error-border);\n\n .output__banner-details-content {\n margin-top: 6px;\n white-space: pre-wrap;\n font-family: 'IBM Plex Mono', monospace;\n line-height: 18px;\n width: 100%;\n }\n\n .output__banner-icon svg {\n fill: var(--color-error);\n }\n }\n\n &.output__banner--warning {\n background-color: var(--color-warning-bg);\n border: 1px solid var(--color-warning-border);\n\n .output__banner-icon svg {\n fill: var(--color-warning);\n }\n }\n\n &.output__banner--canceled {\n background-color: var(--color-canceled-bg);\n border: 1px solid var(--color-canceled-border);\n\n .output__banner-icon svg {\n fill: var(--color-canceled);\n }\n }\n\n &.output__banner--executing {\n background-color: var(--color-info-bg);\n border: 1px solid var(--color-info-border);\n\n .output__banner-loader {\n width: auto;\n min-height: 0;\n }\n }\n\n .output__banner-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 8px 12px;\n }\n\n .output__banner-main {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n flex-grow: 1;\n }\n\n .output__banner-chevron {\n margin-left: auto;\n flex-shrink: 0;\n fill: currentColor;\n }\n\n .output__banner-icon {\n display: flex;\n flex-shrink: 0;\n }\n\n .output__banner-text {\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .output__banner-timing {\n color: var(--color-text-secondary);\n white-space: nowrap;\n flex-shrink: 0;\n margin-left: auto;\n }\n\n .output__banner-actions {\n display: flex;\n flex-direction: column;\n gap: 4px;\n padding: 0 12px 8px 34px;\n\n .cds--link {\n font-size: 14px;\n display: flex;\n align-items: center;\n }\n\n .link--disabled, .link--disabled:hover {\n color: var(--color-text-disabled);\n text-decoration: none;\n }\n }\n\n .output__banner-details {\n padding: 0 12px 8px 34px;\n\n .output__banner-details-content {\n margin: 0;\n color: var(--color-text-secondary);\n }\n }\n\n .output__banner-incident, .output__banner-error {\n display: flex;\n flex-direction: column;\n gap: 6px;\n align-items: flex-start;\n }\n\n .output__banner-incident-heading, .output__banner-error-heading {\n font-weight: 600;\n color: var(--color-text-primary);\n text-decoration: underline dotted;\n text-underline-offset: 2px;\n }\n\n .output__banner--error .output__banner-details {\n font-family: 'IBM Plex Mono', monospace;\n line-height: 18px;\n }\n\n .output__banner-details-row {\n display: flex;\n column-gap: 8px;\n line-height: 18px;\n }\n\n .output__banner-details-label {\n color: var(--color-text-secondary);\n white-space: nowrap;\n width: 30%;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .output__banner-details-value {\n color: var(--color-text-primary);\n font-family: 'IBM Plex Mono', monospace;\n width: 70%;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n @container (max-width: 380px) {\n .output__banner-details-row {\n flex-wrap: wrap;\n }\n\n .output__banner-details-label {\n width: auto;\n }\n\n .output__banner-details-value {\n width: auto;\n overflow: visible;\n white-space: normal;\n word-break: break-word;\n }\n }\n }\n\n .output__empty-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n padding: 48px 24px;\n color: var(--color-text-secondary);\n\n .output__empty-state-icon {\n width: 42px;\n height: 42px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--color-bg-light);\n\n svg {\n width: 24px;\n height: 24px;\n }\n }\n\n .output__empty-state-text {\n text-align: center;\n }\n }\n\n .output__body {\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n\n .cds--tabs {\n --cds-layout-size-height-local: 32px;\n display: flex;\n flex-direction: column;\n min-height: 0;\n }\n \n .cds--tab-content {\n padding: 0;\n }\n\n .cds--tab-content:not([hidden]) {\n display: flex;\n flex-grow: 1;\n min-height: 0;\n }\n }\n\n .output__collapsible {\n border-bottom: 1px solid var(--color-border-strong);\n\n &:last-child {\n border-bottom: none;\n }\n }\n\n .output__collapsible-sentinel {\n height: 1px;\n margin-bottom: -1px;\n visibility: hidden;\n pointer-events: none;\n }\n\n .output__collapsible-header {\n display: flex;\n align-items: center;\n gap: 4px;\n width: 100%;\n padding: 6px 12px;\n background: var(--color-bg);\n border: none;\n border-bottom: 1px solid transparent;\n font-size: 14px;\n font-weight: normal;\n color: var(--color-text-secondary);\n position: sticky;\n top: 0;\n z-index: 2;\n\n &.stuck {\n background: var(--color-bg-muted);\n border-bottom-color: var(--color-border-strong);\n }\n\n &:hover {\n color: var(--color-text-primary);\n }\n\n svg {\n flex-shrink: 0;\n fill: currentColor;\n }\n }\n\n .output__collapsible-chevron {\n margin-left: auto;\n }\n\n .output__collapsible-title {\n user-select: none;\n }\n\n .output__collapsible-content {\n padding: 0 12px 8px;\n }\n\n .output__section-empty {\n color: var(--color-text-secondary);\n font-size: 14px;\n padding: 4px 0;\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 var(--color-error);\n border-left-width: 3px;\n background-color: var(--color-error-bg);\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: var(--color-error);\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: var(--color-text-secondary);\n }\n\n .output__variables--empty-action {\n font-weight: bold;\n }\n\n .output__variables--skeleton .cds--skeleton__placeholder {\n width: 100% !important;\n }\n\n code {\n font-size: 14px;\n }\n }\n\n .execution-log {\n font-size: 14px;\n\n .execution-log__details {\n margin: 4px 0 0 0;\n }\n\n .execution-log__details-row {\n display: flex;\n column-gap: 8px;\n line-height: 18px;\n }\n\n .execution-log__details-label {\n color: var(--color-text-secondary);\n white-space: nowrap;\n width: 30%;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .execution-log__details-value {\n color: var(--color-text-primary);\n font-family: 'IBM Plex Mono', monospace;\n width: 70%;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n @container (max-width: 380px) {\n .execution-log__details-row {\n flex-wrap: wrap;\n }\n\n .execution-log__details-label {\n width: auto;\n }\n\n .execution-log__details-value {\n width: auto;\n overflow: visible;\n white-space: normal;\n word-break: break-word;\n }\n }\n\n .execution-log__empty {\n color: var(--color-text-secondary);\n }\n\n .execution-log__empty-action {\n font-weight: bold;\n }\n\n .execution-log__entries {\n list-style: none;\n margin: 0;\n padding: 0 0 0 2px;\n display: flex;\n flex-direction: column;\n position: relative;\n }\n\n .execution-log__entry-wrapper {\n display: flex;\n flex-direction: column;\n position: relative;\n padding: 0 0 0 20px;\n margin-bottom: 0;\n\n // timeline dot\n &::before {\n content: '';\n position: absolute;\n left: 0;\n top: 9px;\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background-color: var(--color-border-light);\n z-index: 1;\n }\n\n // timeline line\n &::after {\n content: '';\n position: absolute;\n left: 3px;\n top: 20px;\n bottom: -4px;\n width: 1px;\n background-color: var(--color-border-light);\n }\n\n &:last-child::after {\n display: none;\n }\n\n &.execution-log__entry-wrapper--active::before {\n // make it unfilled with a border to indicate active entry\n background-color: transparent;\n border: 1px solid var(--color-border-strong);\n }\n }\n\n .execution-log__entry-content {\n padding: 4px 8px;\n border-radius: 4px;\n\n &:hover {\n background-color: var(--color-bg-light);\n }\n }\n\n .execution-log__entry {\n display: flex;\n align-items: center;\n gap: 8px;\n color: var(--color-text-secondary);\n font-size: 14px;\n line-height: 18px;\n }\n\n .execution-log__entry--expandable {\n &:hover {\n color: var(--color-text-primary);\n }\n }\n\n .execution-log__toggle {\n display: flex;\n align-items: center;\n margin-left: auto;\n\n svg {\n fill: var(--color-text-disabled);\n }\n }\n\n .execution-log__labels {\n display: flex;\n flex-direction: column;\n min-width: 0;\n flex: 1;\n }\n\n .execution-log__label {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .execution-log__label-row {\n display: flex;\n align-items: center;\n gap: 8px;\n min-width: 0;\n }\n\n .execution-log__duration {\n font-size: 11px;\n color: var(--color-text-disabled);\n white-space: nowrap;\n flex-shrink: 0;\n }\n\n .execution-log__secondary-label {\n color: var(--color-text-secondary);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n border-radius: 4px;\n background-color: var(--color-bg-light);\n padding: 2px 4px;\n font-size: 12px;\n align-self: flex-start;\n margin-top: 2px;\n }\n\n .execution-log__cta {\n margin-top: 12px;\n padding: 12px;\n border: 1px solid var(--color-info-border);\n background-color: var(--color-info-bg);\n border-radius: 4px;\n\n .execution-log__cta-header {\n display: flex;\n align-items: center;\n gap: 6px;\n margin-bottom: 6px;\n\n svg {\n fill: var(--color-info-border);\n flex-shrink: 0;\n }\n }\n\n .execution-log__cta-title {\n font-weight: 600;\n font-size: 14px;\n color: var(--color-text-primary);\n }\n\n .execution-log__cta-description {\n margin: 0 0 8px;\n font-size: 14px;\n color: var(--color-text-secondary);\n line-height: 18px;\n }\n\n .execution-log__cta-link {\n font-size: 14px;\n }\n }\n }\n\n .task-testing-tooltip__wrapper {\n display: inline-flex;\n align-items: center;\n width: fit-content;\n }\n\n .code__editor {\n position: relative;\n display: flex;\n flex-direction: column;\n\n &.code__editor--error {\n .code__editor-codemirror {\n border-color: var(--color-error);\n background-color: var(--color-error-bg);\n }\n\n .cm-gutter {\n background-color: var(--color-error-bg);\n }\n }\n\n .code__editor-codemirror {\n border: 1px solid var(--color-border-strong);\n border-radius: 2px;\n background-color: var(--color-bg-light);\n\n .cm-scroller {\n overflow: visible !important;\n }\n\n .cm-content {\n padding: 6px;\n }\n\n .cm-focused {\n outline: none;\n }\n\n .cm-tooltip {\n font-size: 14px;\n }\n\n .info {\n padding: 6px;\n font-family: 'IBM Plex Mono', monospace;\n font-size: 12px;\n max-width: 300px;\n word-wrap: break-word;\n\n pre {\n margin-top: 8px;\n }\n }\n }\n\n .code__editor-error {\n color: var(--color-error);\n font-size: 14px;\n margin-top: 5px;\n }\n\n .code__editor-copy-button,\n .code__editor-clear-button {\n position: absolute;\n top: 5px;\n right: 5px;\n z-index: 10;\n block-size: 24px;\n inline-size: 24px;\n padding-block-start: 0;\n padding-inline-end: 0;\n min-block-size: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n\n svg {\n fill: var(--color-text-secondary);\n }\n }\n }\n\n .has-tooltip {\n text-decoration: underline;\n text-decoration-style: dotted;\n text-underline-offset: 2px;\n }\n}\n\n// Tooltip (portaled to document.body)\n.task-testing-tooltip {\n --tooltip-color-bg: hsl(0, 0%, 22%);\n --tooltip-color-text: #fff;\n --tooltip-color-link: hsl(218, 100%, 74%);\n --tooltip-color-code-text: hsl(225, 10%, 35%);\n --tooltip-color-code-bg: hsl(225, 10%, 97%);\n --tooltip-color-code-border: hsl(225, 10%, 85%);\n\n position: fixed;\n z-index: 1000;\n max-width: 300px;\n font-size: 13px;\n font-family: 'IBM Plex Sans', sans-serif;\n color: var(--tooltip-color-text);\n\n .task-testing-tooltip__content {\n background-color: var(--tooltip-color-bg);\n color: var(--tooltip-color-text);\n padding: 16px;\n border-radius: 2px;\n font-size: 14px;\n font-weight: 400;\n white-space: pre-wrap;\n line-height: 21px;\n\n .bio-properties-panel-tooltip-content h1 {\n font-size: 14px;\n font-weight: bold;\n margin: 0;\n }\n\n a {\n color: var(--tooltip-color-link) !important;\n text-decoration: underline !important;\n }\n\n code, pre {\n color: var(--tooltip-color-code-text);\n font-family: 'IBM Plex Mono', monospace;\n font-size: 13px;\n line-height: 17px;\n padding: 0 2px;\n background-color: var(--tooltip-color-code-bg);\n border: 1px solid var(--tooltip-color-code-border);\n border-radius: 2px;\n }\n\n pre code {\n border: none;\n }\n\n p:first-child {\n margin-top: 0;\n }\n\n p:last-child {\n margin-bottom: 0;\n }\n }\n\n .task-testing-tooltip__arrow {\n position: absolute;\n width: 0;\n height: 0;\n }\n\n // bottom-start / bottom-end\n &.bottom-start,\n &.bottom-end {\n padding-top: 6px;\n\n .task-testing-tooltip__arrow {\n top: 1px;\n left: 12px;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-bottom: 5px solid var(--tooltip-color-bg);\n }\n }\n\n &.bottom-end {\n .task-testing-tooltip__arrow {\n left: auto;\n right: 12px;\n }\n }\n\n // top-start / top-end\n &.top-start,\n &.top-end {\n padding-bottom: 6px;\n\n .task-testing-tooltip__arrow {\n bottom: 1px;\n left: 12px;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid var(--tooltip-color-bg);\n }\n }\n\n &.top-end {\n .task-testing-tooltip__arrow {\n left: auto;\n right: 12px;\n }\n }\n}"],sourceRoot:""}]);const l=o},314(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,i,r,s){"string"==typeof e&&(e=[[null,e,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 c=0;c<e.length;c++){var h=[].concat(e[c]);i&&o[h[0]]||(void 0!==s&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=s),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},354(e){e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;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[t].concat([s]).join("\n")}return[t].join("\n")}},7(e){var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise(function(n,i){function r(n){e.removeListener(t,s),i(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}g(e,t,s,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,r)})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function a(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function c(e,t,n,i){var r,s,o,c;if(l(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(r=a(e))>0&&o.length>r&&!o.warned){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=o.length,c=h,console&&console.warn&&console.warn(c)}return e}function h(){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(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=h.bind(i);return r.listener=n,i.wrapFn=r,r}function d(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):p(r,r.length)}function f(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function g(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function r(s){i.once&&e.removeEventListener(t,r),n(s)})}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),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(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return a(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,s=this._events;if(void 0!==s)r=r&&void 0===s.error;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var l=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw l.context=o,l}var a=s[e];if(void 0===a)return!1;if("function"==typeof a)i(a,this,t);else{var c=a.length,h=p(a,c);for(n=0;n<c;++n)i(h[n],this,t)}return!0},s.prototype.addListener=function(e,t){return c(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return c(this,e,t,!0)},s.prototype.once=function(e,t){return l(t),this.on(e,u(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,u(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,i,r,s,o;if(l(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,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[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[e]),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(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},633(e,t,n){var i=n(649);function r(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" 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 c(e){return!!s.call(a,e)||!s.call(l,e)&&(o.test(e)?a[e]=!0:(l[e]=!0,!1))}function h(e,t,n,i,r,s,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var u={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){u[e]=new h(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];u[t]=new h(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){u[e]=new h(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){u[e]=new h(e,2,!1,e,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(e){u[e]=new h(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){u[e]=new h(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){u[e]=new h(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){u[e]=new h(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){u[e]=new h(e,5,!1,e.toLowerCase(),null,!1,!1)});var d=/[\-:]([a-z])/g;function f(e){return e[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(e){var t=e.replace(d,f);u[t]=new h(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(d,f);u[t]=new h(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(d,f);u[t]=new h(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){u[e]=new h(e,1,!1,e.toLowerCase(),null,!1,!1)}),u.xlinkHref=new h("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){u[e]=new h(e,1,!1,e.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(e){g.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),p[t]=p[e]})});var m=/["'&<>]/;function A(e){if("boolean"==typeof e||"number"==typeof e)return""+e;e=""+e;var t=m.exec(e);if(t){var n,i="",r=0;for(n=t.index;n<e.length;n++){switch(e.charCodeAt(n)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}r!==n&&(i+=e.substring(r,n)),r=n+1,i+=t}e=r!==n?i+e.substring(r,n):i}return e}var v=/([A-Z])/g,b=/^ms-/,x=Array.isArray;function y(e,t){return{insertionMode:e,selectedValue:t}}var w=new Map;function C(e,t,n){if("object"!=typeof n)throw Error(r(62));for(var i in t=!0,n)if(s.call(n,i)){var o=n[i];if(null!=o&&"boolean"!=typeof o&&""!==o){if(0===i.indexOf("--")){var l=A(i);o=A((""+o).trim())}else{l=i;var a=w.get(l);void 0!==a||(a=A(l.replace(v,"-$1").toLowerCase().replace(b,"-ms-")),w.set(l,a)),l=a,o="number"==typeof o?0===o||s.call(p,i)?""+o:o+"px":A((""+o).trim())}t?(t=!1,e.push(' style="',l,":",o)):e.push(";",l,":",o)}}t||e.push('"')}function k(e,t,n,i){switch(n){case"style":return void C(e,t,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!==(t=u.hasOwnProperty(n)?u[n]:null)){switch(typeof i){case"function":case"symbol":return;case"boolean":if(!t.acceptsBooleans)return}switch(n=t.attributeName,t.type){case 3:i&&e.push(" ",n,'=""');break;case 4:!0===i?e.push(" ",n,'=""'):!1!==i&&e.push(" ",n,'="',A(i),'"');break;case 5:isNaN(i)||e.push(" ",n,'="',A(i),'"');break;case 6:!isNaN(i)&&1<=i&&e.push(" ",n,'="',A(i),'"');break;default:t.sanitizeURL&&(i=""+i),e.push(" ",n,'="',A(i),'"')}}else if(c(n)){switch(typeof i){case"function":case"symbol":return;case"boolean":if("data-"!==(t=n.toLowerCase().slice(0,5))&&"aria-"!==t)return}e.push(" ",n,'="',A(i),'"')}}function _(e,t,n){if(null!=t){if(null!=n)throw Error(r(60));if("object"!=typeof t||!("__html"in t))throw Error(r(61));null!=(t=t.__html)&&e.push(""+t)}}function S(e,t,n,i){e.push(O(n));var r,o=n=null;for(r in t)if(s.call(t,r)){var l=t[r];if(null!=l)switch(r){case"children":n=l;break;case"dangerouslySetInnerHTML":o=l;break;default:k(e,i,r,l)}}return e.push(">"),_(e,o,n),"string"==typeof n?(e.push(A(n)),null):n}var E=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,T=new Map;function O(e){var t=T.get(e);if(void 0===t){if(!E.test(e))throw Error(r(65,e));t="<"+e,T.set(e,t)}return t}function M(e,t,n){if(e.push('\x3c!--$?--\x3e<template id="'),null===n)throw Error(r(395));return e.push(n),e.push('"></template>')}var B=/[<\u2028\u2029]/g;function D(e){return JSON.stringify(e).replace(B,function(e){switch(e){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(e,t,n,i){return n.generateStaticMarkup?(e.push(A(t)),!1):(""===t?e=i:(i&&e.push("\x3c!-- --\x3e"),e.push(A(t)),e=!0),e)}var I=Object.assign,P=Symbol.for("react.element"),N=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),z=Symbol.for("react.provider"),V=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),$=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"),J=Symbol.for("react.default_value"),Q=Symbol.iterator;function X(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case L:return"Fragment";case N:return"Portal";case j:return"Profiler";case F:return"StrictMode";case H:return"Suspense";case q:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case V:return(e.displayName||"Context")+".Consumer";case z:return(e._context.displayName||"Context")+".Provider";case W:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case $:return null!==(t=e.displayName||null)?t:X(e.type)||"Memo";case U:t=e._payload,e=e._init;try{return X(e(t))}catch(e){}}return null}var Z={};function ee(e,t){if(!(e=e.contextTypes))return Z;var n,i={};for(n in e)i[n]=t[n];return i}var te=null;function ne(e,t){if(e!==t){e.context._currentValue2=e.parentValue,e=e.parent;var n=t.parent;if(null===e){if(null!==n)throw Error(r(401))}else{if(null===n)throw Error(r(401));ne(e,n)}t.context._currentValue2=t.value}}function ie(e){e.context._currentValue2=e.parentValue,null!==(e=e.parent)&&ie(e)}function re(e){var t=e.parent;null!==t&&re(t),e.context._currentValue2=e.value}function se(e,t){if(e.context._currentValue2=e.parentValue,null===(e=e.parent))throw Error(r(402));e.depth===t.depth?ne(e,t):se(e,t)}function oe(e,t){var n=t.parent;if(null===n)throw Error(r(402));e.depth===n.depth?ne(e,n):oe(e,n),t.context._currentValue2=t.value}function le(e){var t=te;t!==e&&(null===t?re(e):null===e?ie(t):t.depth===e.depth?ne(t,e):t.depth>e.depth?se(t,e):oe(t,e),te=e)}var ae={isMounted:function(){return!1},enqueueSetState:function(e,t){null!==(e=e._reactInternals).queue&&e.queue.push(t)},enqueueReplaceState:function(e,t){(e=e._reactInternals).replace=!0,e.queue=[t]},enqueueForceUpdate:function(){}};function ce(e,t,n,i){var r=void 0!==e.state?e.state:null;e.updater=ae,e.props=n,e.state=r;var s={queue:[],replace:!1};e._reactInternals=s;var o=t.contextType;if(e.context="object"==typeof o&&null!==o?o._currentValue2:i,"function"==typeof(o=t.getDerivedStateFromProps)&&(r=null==(o=o(n,r))?r:I({},r,o),e.state=r),"function"!=typeof t.getDerivedStateFromProps&&"function"!=typeof e.getSnapshotBeforeUpdate&&("function"==typeof e.UNSAFE_componentWillMount||"function"==typeof e.componentWillMount))if(t=e.state,"function"==typeof e.componentWillMount&&e.componentWillMount(),"function"==typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),t!==e.state&&ae.enqueueReplaceState(e,e.state,null),null!==s.queue&&0<s.queue.length)if(t=s.queue,o=s.replace,s.queue=null,s.replace=!1,o&&1===t.length)e.state=t[0];else{for(s=o?t[0]:e.state,r=!0,o=o?1:0;o<t.length;o++){var l=t[o];null!=(l="function"==typeof l?l.call(e,s,n,i):l)&&(r?(r=!1,s=I({},s,l)):I(s,l))}e.state=s}else s.queue=null}var he={id:1,overflow:""};function ue(e,t,n){var i=e.id;e=e.overflow;var r=32-de(i)-1;i&=~(1<<r),n+=1;var s=32-de(t)+r;if(30<s){var o=r-r%5;return s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,{id:1<<32-de(t)+r|n<<r|i,overflow:s+e}}return{id:1<<s|n<<r|i,overflow:e}}var de=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(fe(e)/pe|0)|0},fe=Math.log,pe=Math.LN2,ge="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},me=null,Ae=null,ve=null,be=null,xe=!1,ye=!1,we=0,Ce=null,ke=0;function _e(){if(null===me)throw Error(r(321));return me}function Se(){if(0<ke)throw Error(r(312));return{memoizedState:null,queue:null,next:null}}function Ee(){return null===be?null===ve?(xe=!1,ve=be=Se()):(xe=!0,be=ve):null===be.next?(xe=!1,be=be.next=Se()):(xe=!0,be=be.next),be}function Te(){Ae=me=null,ye=!1,ve=null,ke=0,be=Ce=null}function Oe(e,t){return"function"==typeof t?t(e):t}function Me(e,t,n){if(me=_e(),be=Ee(),xe){var i=be.queue;if(t=i.dispatch,null!==Ce&&void 0!==(n=Ce.get(i))){Ce.delete(i),i=be.memoizedState;do{i=e(i,n.action),n=n.next}while(null!==n);return be.memoizedState=i,[i,t]}return[be.memoizedState,t]}return e=e===Oe?"function"==typeof t?t():t:void 0!==n?n(t):t,be.memoizedState=e,e=(e=be.queue={last:null,dispatch:null}).dispatch=De.bind(null,me,e),[be.memoizedState,e]}function Be(e,t){if(me=_e(),t=void 0===t?null:t,null!==(be=Ee())){var n=be.memoizedState;if(null!==n&&null!==t){var i=n[1];e:if(null===i)i=!1;else{for(var r=0;r<i.length&&r<t.length;r++)if(!ge(t[r],i[r])){i=!1;break e}i=!0}if(i)return n[0]}}return e=e(),be.memoizedState=[e,t],e}function De(e,t,n){if(25<=ke)throw Error(r(301));if(e===me)if(ye=!0,e={action:n,next:null},null===Ce&&(Ce=new Map),void 0===(n=Ce.get(t)))Ce.set(t,e);else{for(t=n;null!==t.next;)t=t.next;t.next=e}}function Re(){throw Error(r(394))}function Ie(){}var Pe={readContext:function(e){return e._currentValue2},useContext:function(e){return _e(),e._currentValue2},useMemo:Be,useReducer:Me,useRef:function(e){me=_e();var t=(be=Ee()).memoizedState;return null===t?(e={current:e},be.memoizedState=e):t},useState:function(e){return Me(Oe,e)},useInsertionEffect:Ie,useLayoutEffect:function(){},useCallback:function(e,t){return Be(function(){return e},t)},useImperativeHandle:Ie,useEffect:Ie,useDebugValue:Ie,useDeferredValue:function(e){return _e(),e},useTransition:function(){return _e(),[!1,Re]},useId:function(){var e=Ae.treeContext,t=e.overflow;e=((e=e.id)&~(1<<32-de(e)-1)).toString(32)+t;var n=Ne;if(null===n)throw Error(r(404));return t=we++,e=":"+n.idPrefix+"R"+e,0<t&&(e+="H"+t.toString(32)),e+":"},useMutableSource:function(e,t){return _e(),t(e._source)},useSyncExternalStore:function(e,t,n){if(void 0===n)throw Error(r(407));return n()}},Ne=null,Le=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;function Fe(e){return console.error(e),null}function je(){}function ze(e,t,n,i,r,s,o,l){e.allPendingTasks++,null===n?e.pendingRootTasks++:n.pendingTasks++;var a={node:t,ping:function(){var t=e.pingedTasks;t.push(a),1===t.length&&tt(e)},blockedBoundary:n,blockedSegment:i,abortSet:r,legacyContext:s,context:o,treeContext:l};return r.add(a),a}function Ve(e,t,n,i,r,s){return{status:0,id:-1,index:t,parentFlushed:!1,chunks:[],children:[],formatContext:i,boundary:n,lastPushedText:r,textEmbedded:s}}function We(e,t){if(null!=(e=e.onError(t))&&"string"!=typeof e)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 e+'" instead');return e}function He(e,t){var n=e.onShellError;n(t),(n=e.onFatalError)(t),null!==e.destination?(e.status=2,e.destination.destroy(t)):(e.status=1,e.fatalError=t)}function qe(e,t,n,i,r){for(me={},Ae=t,we=0,e=n(i,r);ye;)ye=!1,we=0,ke+=1,be=null,e=n(i,r);return Te(),e}function $e(e,t,n,i){var s=n.render(),o=i.childContextTypes;if(null!=o){var l=t.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=I({},l,n)}t.legacyContext=i,Ge(e,t,s),t.legacyContext=l}else Ge(e,t,s)}function Ue(e,t){if(e&&e.defaultProps){for(var n in t=I({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function Ke(e,t,n,o,l){if("function"==typeof n)if(n.prototype&&n.prototype.isReactComponent){l=ee(n,t.legacyContext);var a=n.contextType;ce(a=new n(o,"object"==typeof a&&null!==a?a._currentValue2:l),n,o,l),$e(e,t,a,n)}else{l=qe(e,t,n,o,a=ee(n,t.legacyContext));var h=0!==we;if("object"==typeof l&&null!==l&&"function"==typeof l.render&&void 0===l.$$typeof)ce(l,n,o,a),$e(e,t,l,n);else if(h){o=t.treeContext,t.treeContext=ue(o,1,0);try{Ge(e,t,l)}finally{t.treeContext=o}}else Ge(e,t,l)}else{if("string"!=typeof n){switch(n){case Y:case G:case F:case j:case L:case q:return void Ge(e,t,o.children);case K:throw Error(r(343));case H:e:{n=t.blockedBoundary,l=t.blockedSegment,a=o.fallback,o=o.children;var u={id:null,rootSegmentID:-1,parentFlushed:!1,pendingTasks:0,forceClientRender:!1,completedSegments:[],byteSize:0,fallbackAbortableTasks:h=new Set,errorDigest:null},d=Ve(0,l.chunks.length,u,l.formatContext,!1,!1);l.children.push(d),l.lastPushedText=!1;var f=Ve(0,0,null,l.formatContext,!1,!1);f.parentFlushed=!0,t.blockedBoundary=u,t.blockedSegment=f;try{if(Je(e,t,o),e.responseState.generateStaticMarkup||f.lastPushedText&&f.textEmbedded&&f.chunks.push("\x3c!-- --\x3e"),f.status=1,Ze(u,f),0===u.pendingTasks)break e}catch(t){f.status=4,u.forceClientRender=!0,u.errorDigest=We(e,t)}finally{t.blockedBoundary=n,t.blockedSegment=l}t=ze(e,a,n,d,h,t.legacyContext,t.context,t.treeContext),e.pingedTasks.push(t)}return}if("object"==typeof n&&null!==n)switch(n.$$typeof){case W:if(o=qe(e,t,n.render,o,l),0!==we){n=t.treeContext,t.treeContext=ue(n,1,0);try{Ge(e,t,o)}finally{t.treeContext=n}}else Ge(e,t,o);return;case $:return void Ke(e,t,n=n.type,o=Ue(n,o),l);case z:if(l=o.children,n=n._context,o=o.value,a=n._currentValue2,n._currentValue2=o,te=o={parent:h=te,depth:null===h?0:h.depth+1,context:n,parentValue:a,value:o},t.context=o,Ge(e,t,l),null===(e=te))throw Error(r(403));return o=e.parentValue,e.context._currentValue2=o===J?e.context._defaultValue:o,e=te=e.parent,void(t.context=e);case V:return void Ge(e,t,o=(o=o.children)(n._currentValue2));case U:return void Ke(e,t,n=(l=n._init)(n._payload),o=Ue(n,o),void 0)}throw Error(r(130,null==n?n:typeof n,""))}switch(a=function(e,t,n,o,l){switch(t){case"select":e.push(O("select"));var a=null,h=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":h=u;break;case"defaultValue":case"value":break;default:k(e,o,p,u)}}return e.push(">"),_(e,h,a),a;case"option":h=l.selectedValue,e.push(O("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:k(e,o,a,g)}}if(null!=h)if(n=null!==d?""+d:function(e){var t="";return i.Children.forEach(e,function(e){null!=e&&(t+=e)}),t}(u),x(h)){for(o=0;o<h.length;o++)if(""+h[o]===n){e.push(' selected=""');break}}else""+h===n&&e.push(' selected=""');else f&&e.push(' selected=""');return e.push(">"),_(e,p,u),u;case"textarea":for(u in e.push(O("textarea")),p=h=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":h=d;break;case"dangerouslySetInnerHTML":throw Error(r(91));default:k(e,o,u,d)}if(null===a&&null!==h&&(a=h),e.push(">"),null!=p){if(null!=a)throw Error(r(92));if(x(p)&&1<p.length)throw Error(r(93));a=""+p}return"string"==typeof a&&"\n"===a[0]&&e.push("\n"),null!==a&&e.push(A(""+a)),null;case"input":for(h in e.push(O("input")),d=p=u=a=null,n)if(s.call(n,h)&&null!=(f=n[h]))switch(h){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:k(e,o,h,f)}return null!==p?k(e,o,"checked",p):null!==d&&k(e,o,"checked",d),null!==a?k(e,o,"value",a):null!==u&&k(e,o,"value",u),e.push("/>"),null;case"menuitem":for(var m in e.push(O("menuitem")),n)if(s.call(n,m)&&null!=(a=n[m]))switch(m){case"children":case"dangerouslySetInnerHTML":throw Error(r(400));default:k(e,o,m,a)}return e.push(">"),null;case"title":for(g in e.push(O("title")),a=null,n)if(s.call(n,g)&&null!=(h=n[g]))switch(g){case"children":a=h;break;case"dangerouslySetInnerHTML":throw Error(r(434));default:k(e,o,g,h)}return e.push(">"),a;case"listing":case"pre":for(d in e.push(O(t)),h=a=null,n)if(s.call(n,d)&&null!=(u=n[d]))switch(d){case"children":a=u;break;case"dangerouslySetInnerHTML":h=u;break;default:k(e,o,d,u)}if(e.push(">"),null!=h){if(null!=a)throw Error(r(60));if("object"!=typeof h||!("__html"in h))throw Error(r(61));null!=(n=h.__html)&&("string"==typeof n&&0<n.length&&"\n"===n[0]?e.push("\n",n):e.push(""+n))}return"string"==typeof a&&"\n"===a[0]&&e.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 v in e.push(O(t)),n)if(s.call(n,v)&&null!=(a=n[v]))switch(v){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,t));default:k(e,o,v,a)}return e.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 S(e,n,t,o);case"html":return 0===l.insertionMode&&e.push("<!DOCTYPE html>"),S(e,n,t,o);default:if(-1===t.indexOf("-")&&"string"!=typeof n.is)return S(e,n,t,o);for(f in e.push(O(t)),h=a=null,n)if(s.call(n,f)&&null!=(u=n[f]))switch(f){case"children":a=u;break;case"dangerouslySetInnerHTML":h=u;break;case"style":C(e,o,u);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:c(f)&&"function"!=typeof u&&"symbol"!=typeof u&&e.push(" ",f,'="',A(u),'"')}return e.push(">"),_(e,h,a),a}}((l=t.blockedSegment).chunks,n,o,e.responseState,l.formatContext),l.lastPushedText=!1,h=l.formatContext,l.formatContext=function(e,t,n){switch(t){case"select":return y(1,null!=n.value?n.value:n.defaultValue);case"svg":return y(2,null);case"math":return y(3,null);case"foreignObject":return y(1,null);case"table":return y(4,null);case"thead":case"tbody":case"tfoot":return y(5,null);case"colgroup":return y(7,null);case"tr":return y(6,null)}return 4<=e.insertionMode||0===e.insertionMode?y(1,null):e}(h,n,o),Je(e,t,a),l.formatContext=h,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 Ge(e,t,n){if(t.node=n,"object"==typeof n&&null!==n){switch(n.$$typeof){case P:return void Ke(e,t,n.type,n.props,n.ref);case N:throw Error(r(257));case U:var i=n._init;return void Ge(e,t,n=i(n._payload))}if(x(n))return void Ye(e,t,n);if((i=null===n||"object"!=typeof n?null:"function"==typeof(i=Q&&n[Q]||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);Ye(e,t,s)}return}throw e=Object.prototype.toString.call(n),Error(r(31,"[object Object]"===e?"object with keys {"+Object.keys(n).join(", ")+"}":e))}"string"==typeof n?(i=t.blockedSegment).lastPushedText=R(t.blockedSegment.chunks,n,e.responseState,i.lastPushedText):"number"==typeof n&&((i=t.blockedSegment).lastPushedText=R(t.blockedSegment.chunks,""+n,e.responseState,i.lastPushedText))}function Ye(e,t,n){for(var i=n.length,r=0;r<i;r++){var s=t.treeContext;t.treeContext=ue(s,i,r);try{Je(e,t,n[r])}finally{t.treeContext=s}}}function Je(e,t,n){var i=t.blockedSegment.formatContext,r=t.legacyContext,s=t.context;try{return Ge(e,t,n)}catch(a){if(Te(),"object"!=typeof a||null===a||"function"!=typeof a.then)throw t.blockedSegment.formatContext=i,t.legacyContext=r,t.context=s,le(s),a;n=a;var o=t.blockedSegment,l=Ve(0,o.chunks.length,null,o.formatContext,o.lastPushedText,!0);o.children.push(l),o.lastPushedText=!1,e=ze(e,t.node,t.blockedBoundary,l,t.abortSet,t.legacyContext,t.context,t.treeContext).ping,n.then(e,e),t.blockedSegment.formatContext=i,t.legacyContext=r,t.context=s,le(s)}}function Qe(e){var t=e.blockedBoundary;(e=e.blockedSegment).status=3,et(this,t,e)}function Xe(e,t,n){var i=e.blockedBoundary;e.blockedSegment.status=3,null===i?(t.allPendingTasks--,2!==t.status&&(t.status=2,null!==t.destination&&t.destination.push(null))):(i.pendingTasks--,i.forceClientRender||(i.forceClientRender=!0,e=void 0===n?Error(r(432)):n,i.errorDigest=t.onError(e),i.parentFlushed&&t.clientRenderedBoundaries.push(i)),i.fallbackAbortableTasks.forEach(function(e){return Xe(e,t,n)}),i.fallbackAbortableTasks.clear(),t.allPendingTasks--,0===t.allPendingTasks&&(i=t.onAllReady)())}function Ze(e,t){if(0===t.chunks.length&&1===t.children.length&&null===t.children[0].boundary){var n=t.children[0];n.id=t.id,n.parentFlushed=!0,1===n.status&&Ze(e,n)}else e.completedSegments.push(t)}function et(e,t,n){if(null===t){if(n.parentFlushed){if(null!==e.completedRootSegment)throw Error(r(389));e.completedRootSegment=n}e.pendingRootTasks--,0===e.pendingRootTasks&&(e.onShellError=je,(t=e.onShellReady)())}else t.pendingTasks--,t.forceClientRender||(0===t.pendingTasks?(n.parentFlushed&&1===n.status&&Ze(t,n),t.parentFlushed&&e.completedBoundaries.push(t),t.fallbackAbortableTasks.forEach(Qe,e),t.fallbackAbortableTasks.clear()):n.parentFlushed&&1===n.status&&(Ze(t,n),1===t.completedSegments.length&&t.parentFlushed&&e.partialBoundaries.push(t)));e.allPendingTasks--,0===e.allPendingTasks&&(e=e.onAllReady)()}function tt(e){if(2!==e.status){var t=te,n=Le.current;Le.current=Pe;var i=Ne;Ne=e.responseState;try{var r,s=e.pingedTasks;for(r=0;r<s.length;r++){var o=s[r],l=e,a=o.blockedSegment;if(0===a.status){le(o.context);try{Ge(l,o,o.node),l.responseState.generateStaticMarkup||a.lastPushedText&&a.textEmbedded&&a.chunks.push("\x3c!-- --\x3e"),o.abortSet.delete(o),a.status=1,et(l,o.blockedBoundary,a)}catch(e){if(Te(),"object"==typeof e&&null!==e&&"function"==typeof e.then){var c=o.ping;e.then(c,c)}else{o.abortSet.delete(o),a.status=4;var h=o.blockedBoundary,u=e,d=We(l,u);null===h?He(l,u):(h.pendingTasks--,h.forceClientRender||(h.forceClientRender=!0,h.errorDigest=d,h.parentFlushed&&l.clientRenderedBoundaries.push(h))),l.allPendingTasks--,0===l.allPendingTasks&&(0,l.onAllReady)()}}}}s.splice(0,r),null!==e.destination&<(e,e.destination)}catch(t){We(e,t),He(e,t)}finally{Ne=i,Le.current=n,n===Pe&&le(t)}}}function nt(e,t,n){switch(n.parentFlushed=!0,n.status){case 0:var i=n.id=e.nextSegmentId++;return n.lastPushedText=!1,n.textEmbedded=!1,e=e.responseState,t.push('<template id="'),t.push(e.placeholderPrefix),e=i.toString(16),t.push(e),t.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++)t.push(i[o]);s=it(e,t,s)}for(;o<i.length-1;o++)t.push(i[o]);return o<i.length&&(s=t.push(i[o])),s;default:throw Error(r(390))}}function it(e,t,n){var i=n.boundary;if(null===i)return nt(e,t,n);if(i.parentFlushed=!0,i.forceClientRender)return e.responseState.generateStaticMarkup||(i=i.errorDigest,t.push("\x3c!--$!--\x3e"),t.push("<template"),i&&(t.push(' data-dgst="'),i=A(i),t.push(i),t.push('"')),t.push("></template>")),nt(e,t,n),!!e.responseState.generateStaticMarkup||t.push("\x3c!--/$--\x3e");if(0<i.pendingTasks){i.rootSegmentID=e.nextSegmentId++,0<i.completedSegments.length&&e.partialBoundaries.push(i);var s=e.responseState,o=s.nextSuspenseID++;return s=s.boundaryPrefix+o.toString(16),i=i.id=s,M(t,e.responseState,i),nt(e,t,n),t.push("\x3c!--/$--\x3e")}if(i.byteSize>e.progressiveChunkSize)return i.rootSegmentID=e.nextSegmentId++,e.completedBoundaries.push(i),M(t,e.responseState,i.id),nt(e,t,n),t.push("\x3c!--/$--\x3e");if(e.responseState.generateStaticMarkup||t.push("\x3c!--$--\x3e"),1!==(n=i.completedSegments).length)throw Error(r(391));return it(e,t,n[0]),!!e.responseState.generateStaticMarkup||t.push("\x3c!--/$--\x3e")}function rt(e,t,n){return function(e,t,n,i){switch(n.insertionMode){case 0:case 1:return e.push('<div hidden id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 2:return e.push('<svg aria-hidden="true" style="display:none" id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 3:return e.push('<math aria-hidden="true" style="display:none" id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 4:return e.push('<table hidden id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 5:return e.push('<table hidden><tbody id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 6:return e.push('<table hidden><tr id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 7:return e.push('<table hidden><colgroup id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');default:throw Error(r(397))}}(t,e.responseState,n.formatContext,n.id),it(e,t,n),function(e,t){switch(t.insertionMode){case 0:case 1:return e.push("</div>");case 2:return e.push("</svg>");case 3:return e.push("</math>");case 4:return e.push("</table>");case 5:return e.push("</tbody></table>");case 6:return e.push("</tr></table>");case 7:return e.push("</colgroup></table>");default:throw Error(r(397))}}(t,n.formatContext)}function st(e,t,n){for(var i=n.completedSegments,s=0;s<i.length;s++)ot(e,t,n,i[s]);if(i.length=0,e=e.responseState,i=n.id,n=n.rootSegmentID,t.push(e.startInlineScript),e.sentCompleteBoundaryFunction?t.push('$RC("'):(e.sentCompleteBoundaryFunction=!0,t.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),t.push(i),t.push('","'),t.push(e.segmentPrefix),t.push(n),t.push('")<\/script>')}function ot(e,t,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 rt(e,t,i)}return rt(e,t,i),e=e.responseState,t.push(e.startInlineScript),e.sentCompleteSegmentFunction?t.push('$RS("'):(e.sentCompleteSegmentFunction=!0,t.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("')),t.push(e.segmentPrefix),s=s.toString(16),t.push(s),t.push('","'),t.push(e.placeholderPrefix),t.push(s),t.push('")<\/script>')}function lt(e,t){try{var n=e.completedRootSegment;if(null!==n&&0===e.pendingRootTasks){it(e,t,n),e.completedRootSegment=null;var i=e.responseState.bootstrapChunks;for(n=0;n<i.length-1;n++)t.push(i[n]);n<i.length&&t.push(i[n])}var s,o=e.clientRenderedBoundaries;for(s=0;s<o.length;s++){var l=o[s];i=t;var a=e.responseState,c=l.id,h=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===c)throw Error(r(395));if(i.push(c),i.push('"'),h||u||d){i.push(",");var f=D(h||"");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 e.destination=null,s++,void o.splice(0,s)}o.splice(0,s);var m=e.completedBoundaries;for(s=0;s<m.length;s++)if(!st(e,t,m[s]))return e.destination=null,s++,void m.splice(0,s);m.splice(0,s);var A=e.partialBoundaries;for(s=0;s<A.length;s++){var v=A[s];e:{o=e,l=t;var b=v.completedSegments;for(a=0;a<b.length;a++)if(!ot(o,l,v,b[a])){a++,b.splice(0,a);var x=!1;break e}b.splice(0,a),x=!0}if(!x)return e.destination=null,s++,void A.splice(0,s)}A.splice(0,s);var y=e.completedBoundaries;for(s=0;s<y.length;s++)if(!st(e,t,y[s]))return e.destination=null,s++,void y.splice(0,s);y.splice(0,s)}finally{0===e.allPendingTasks&&0===e.pingedTasks.length&&0===e.clientRenderedBoundaries.length&&0===e.completedBoundaries.length&&t.push(null)}}function at(e,t){try{var n=e.abortableTasks;n.forEach(function(n){return Xe(n,e,t)}),n.clear(),null!==e.destination&<(e,e.destination)}catch(t){We(e,t),He(e,t)}}function ct(){}function ht(e,t,n,i){var s=!1,o=null,l="",a={push:function(e){return null!==e&&(l+=e),!0},destroy:function(e){s=!0,o=e}},c=!1;if(e=function(e,t,n,i,r,s,o){var l=[],a=new Set;return(n=Ve(t={destination:null,responseState:t,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?Fe:r,onAllReady:je,onShellReady:void 0===o?je:o,onShellError:je,onFatalError:je},0,null,n,!1,!1)).parentFlushed=!0,e=ze(t,e,null,n,a,Z,null,he),l.push(e),t}(e,function(e,t){return{bootstrapChunks:[],startInlineScript:"<script>",placeholderPrefix:(t=void 0===t?"":t)+"P:",segmentPrefix:t+"S:",boundaryPrefix:t+"B:",idPrefix:t,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1,generateStaticMarkup:e}}(n,t?t.identifierPrefix:void 0),{insertionMode:1,selectedValue:null},1/0,ct,0,function(){c=!0}),tt(e),at(e,i),1===e.status)e.status=2,a.destroy(e.fatalError);else if(2!==e.status&&null===e.destination){e.destination=a;try{lt(e,a)}catch(t){We(e,t),He(e,t)}}if(s)throw o;if(!c)throw Error(r(426));return l}t.renderToNodeStream=function(){throw Error(r(207))},t.renderToStaticMarkup=function(e,t){return ht(e,t,!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')},t.renderToStaticNodeStream=function(){throw Error(r(208))},t.renderToString=function(e,t){return ht(e,t,!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')},t.version="18.3.1"},911(e,t,n){var i=n(649);function r(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" 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(e,t){if(0!==t.length)if(512<t.length)0<o&&(e.enqueue(new Uint8Array(s.buffer,0,o)),s=new Uint8Array(512),o=0),e.enqueue(t);else{var n=s.length-o;n<t.length&&(0===n?e.enqueue(s):(s.set(t.subarray(0,n),o),e.enqueue(s),t=t.subarray(n)),s=new Uint8Array(512),o=0),s.set(t,o),o+=t.length}}function a(e,t){return l(e,t),!0}function c(e){s&&0<o&&(e.enqueue(new Uint8Array(s.buffer,0,o)),s=null,o=0)}var h=new TextEncoder;function u(e){return h.encode(e)}function d(e){return h.encode(e)}function f(e,t){"function"==typeof e.error?e.error(t):e.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={},A={};function v(e){return!!p.call(A,e)||!p.call(m,e)&&(g.test(e)?A[e]=!0:(m[e]=!0,!1))}function b(e,t,n,i,r,s,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var x={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){x[e]=new b(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];x[t]=new b(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){x[e]=new b(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){x[e]=new b(e,2,!1,e,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(e){x[e]=new b(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){x[e]=new b(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){x[e]=new b(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){x[e]=new b(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){x[e]=new b(e,5,!1,e.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function w(e){return e[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(e){var t=e.replace(y,w);x[t]=new b(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(y,w);x[t]=new b(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(y,w);x[t]=new b(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){x[e]=new b(e,1,!1,e.toLowerCase(),null,!1,!1)}),x.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){x[e]=new b(e,1,!1,e.toLowerCase(),null,!0,!0)});var C={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},k=["Webkit","ms","Moz","O"];Object.keys(C).forEach(function(e){k.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),C[t]=C[e]})});var _=/["'&<>]/;function S(e){if("boolean"==typeof e||"number"==typeof e)return""+e;e=""+e;var t=_.exec(e);if(t){var n,i="",r=0;for(n=t.index;n<e.length;n++){switch(e.charCodeAt(n)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}r!==n&&(i+=e.substring(r,n)),r=n+1,i+=t}e=r!==n?i+e.substring(r,n):i}return e}var E=/([A-Z])/g,T=/^ms-/,O=Array.isArray,M=d("<script>"),B=d("<\/script>"),D=d('<script src="'),R=d('<script type="module" src="'),I=d('" async=""><\/script>'),P=/(<\/|<)(s)(cript)/gi;function N(e,t,n,i){return t+("s"===n?"\\u0073":"\\u0053")+i}function L(e,t){return{insertionMode:e,selectedValue:t}}var F=d("\x3c!-- --\x3e");function j(e,t,n,i){return""===t?i:(i&&e.push(F),e.push(u(S(t))),!0)}var z=new Map,V=d(' style="'),W=d(":"),H=d(";");function q(e,t,n){if("object"!=typeof n)throw Error(r(62));for(var i in t=!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(S(i));s=u(S((""+s).trim()))}else{o=i;var l=z.get(o);void 0!==l||(l=d(S(o.replace(E,"-$1").toLowerCase().replace(T,"-ms-"))),z.set(o,l)),o=l,s="number"==typeof s?0===s||p.call(C,i)?u(""+s):u(s+"px"):u(S((""+s).trim()))}t?(t=!1,e.push(V,o,W,s)):e.push(H,o,W,s)}}t||e.push(K)}var $=d(" "),U=d('="'),K=d('"'),G=d('=""');function Y(e,t,n,i){switch(n){case"style":return void q(e,t,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!==(t=x.hasOwnProperty(n)?x[n]:null)){switch(typeof i){case"function":case"symbol":return;case"boolean":if(!t.acceptsBooleans)return}switch(n=u(t.attributeName),t.type){case 3:i&&e.push($,n,G);break;case 4:!0===i?e.push($,n,G):!1!==i&&e.push($,n,U,u(S(i)),K);break;case 5:isNaN(i)||e.push($,n,U,u(S(i)),K);break;case 6:!isNaN(i)&&1<=i&&e.push($,n,U,u(S(i)),K);break;default:t.sanitizeURL&&(i=""+i),e.push($,n,U,u(S(i)),K)}}else if(v(n)){switch(typeof i){case"function":case"symbol":return;case"boolean":if("data-"!==(t=n.toLowerCase().slice(0,5))&&"aria-"!==t)return}e.push($,u(n),U,u(S(i)),K)}}var J=d(">"),Q=d("/>");function X(e,t,n){if(null!=t){if(null!=n)throw Error(r(60));if("object"!=typeof t||!("__html"in t))throw Error(r(61));null!=(t=t.__html)&&e.push(u(""+t))}}var Z=d(' selected=""');function ee(e,t,n,i){e.push(re(n));var r,s=n=null;for(r in t)if(p.call(t,r)){var o=t[r];if(null!=o)switch(r){case"children":n=o;break;case"dangerouslySetInnerHTML":s=o;break;default:Y(e,i,r,o)}}return e.push(J),X(e,s,n),"string"==typeof n?(e.push(u(S(n))),null):n}var te=d("\n"),ne=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,ie=new Map;function re(e){var t=ie.get(e);if(void 0===t){if(!ne.test(e))throw Error(r(65,e));t=d("<"+e),ie.set(e,t)}return t}var se=d("<!DOCTYPE html>");var oe=d("</"),le=d(">"),ae=d('<template id="'),ce=d('"></template>'),he=d("\x3c!--$--\x3e"),ue=d('\x3c!--$?--\x3e<template id="'),de=d('"></template>'),fe=d("\x3c!--$!--\x3e"),pe=d("\x3c!--/$--\x3e"),ge=d("<template"),me=d('"'),Ae=d(' data-dgst="');d(' data-msg="'),d(' data-stck="');var ve=d("></template>");function be(e,t,n){if(l(e,ue),null===n)throw Error(r(395));return l(e,n),a(e,de)}var xe=d('<div hidden id="'),ye=d('">'),we=d("</div>"),Ce=d('<svg aria-hidden="true" style="display:none" id="'),ke=d('">'),_e=d("</svg>"),Se=d('<math aria-hidden="true" style="display:none" id="'),Ee=d('">'),Te=d("</math>"),Oe=d('<table hidden id="'),Me=d('">'),Be=d("</table>"),De=d('<table hidden><tbody id="'),Re=d('">'),Ie=d("</tbody></table>"),Pe=d('<table hidden><tr id="'),Ne=d('">'),Le=d("</tr></table>"),Fe=d('<table hidden><colgroup id="'),je=d('">'),ze=d("</colgroup></table>"),Ve=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("'),We=d('$RS("'),He=d('","'),qe=d('")<\/script>'),$e=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("'),Ue=d('$RC("'),Ke=d('","'),Ge=d('")<\/script>'),Ye=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("'),Je=d('$RX("'),Qe=d('"'),Xe=d(")<\/script>"),Ze=d(","),et=/[<\u2028\u2029]/g;function tt(e){return JSON.stringify(e).replace(et,function(e){switch(e){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 nt=Object.assign,it=Symbol.for("react.element"),rt=Symbol.for("react.portal"),st=Symbol.for("react.fragment"),ot=Symbol.for("react.strict_mode"),lt=Symbol.for("react.profiler"),at=Symbol.for("react.provider"),ct=Symbol.for("react.context"),ht=Symbol.for("react.forward_ref"),ut=Symbol.for("react.suspense"),dt=Symbol.for("react.suspense_list"),ft=Symbol.for("react.memo"),pt=Symbol.for("react.lazy"),gt=Symbol.for("react.scope"),mt=Symbol.for("react.debug_trace_mode"),At=Symbol.for("react.legacy_hidden"),vt=Symbol.for("react.default_value"),bt=Symbol.iterator;function xt(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case st:return"Fragment";case rt:return"Portal";case lt:return"Profiler";case ot:return"StrictMode";case ut:return"Suspense";case dt:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case ct:return(e.displayName||"Context")+".Consumer";case at:return(e._context.displayName||"Context")+".Provider";case ht:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case ft:return null!==(t=e.displayName||null)?t:xt(e.type)||"Memo";case pt:t=e._payload,e=e._init;try{return xt(e(t))}catch(e){}}return null}var yt={};function wt(e,t){if(!(e=e.contextTypes))return yt;var n,i={};for(n in e)i[n]=t[n];return i}var Ct=null;function kt(e,t){if(e!==t){e.context._currentValue=e.parentValue,e=e.parent;var n=t.parent;if(null===e){if(null!==n)throw Error(r(401))}else{if(null===n)throw Error(r(401));kt(e,n)}t.context._currentValue=t.value}}function _t(e){e.context._currentValue=e.parentValue,null!==(e=e.parent)&&_t(e)}function St(e){var t=e.parent;null!==t&&St(t),e.context._currentValue=e.value}function Et(e,t){if(e.context._currentValue=e.parentValue,null===(e=e.parent))throw Error(r(402));e.depth===t.depth?kt(e,t):Et(e,t)}function Tt(e,t){var n=t.parent;if(null===n)throw Error(r(402));e.depth===n.depth?kt(e,n):Tt(e,n),t.context._currentValue=t.value}function Ot(e){var t=Ct;t!==e&&(null===t?St(e):null===e?_t(t):t.depth===e.depth?kt(t,e):t.depth>e.depth?Et(t,e):Tt(t,e),Ct=e)}var Mt={isMounted:function(){return!1},enqueueSetState:function(e,t){null!==(e=e._reactInternals).queue&&e.queue.push(t)},enqueueReplaceState:function(e,t){(e=e._reactInternals).replace=!0,e.queue=[t]},enqueueForceUpdate:function(){}};function Bt(e,t,n,i){var r=void 0!==e.state?e.state:null;e.updater=Mt,e.props=n,e.state=r;var s={queue:[],replace:!1};e._reactInternals=s;var o=t.contextType;if(e.context="object"==typeof o&&null!==o?o._currentValue:i,"function"==typeof(o=t.getDerivedStateFromProps)&&(r=null==(o=o(n,r))?r:nt({},r,o),e.state=r),"function"!=typeof t.getDerivedStateFromProps&&"function"!=typeof e.getSnapshotBeforeUpdate&&("function"==typeof e.UNSAFE_componentWillMount||"function"==typeof e.componentWillMount))if(t=e.state,"function"==typeof e.componentWillMount&&e.componentWillMount(),"function"==typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),t!==e.state&&Mt.enqueueReplaceState(e,e.state,null),null!==s.queue&&0<s.queue.length)if(t=s.queue,o=s.replace,s.queue=null,s.replace=!1,o&&1===t.length)e.state=t[0];else{for(s=o?t[0]:e.state,r=!0,o=o?1:0;o<t.length;o++){var l=t[o];null!=(l="function"==typeof l?l.call(e,s,n,i):l)&&(r?(r=!1,s=nt({},s,l)):nt(s,l))}e.state=s}else s.queue=null}var Dt={id:1,overflow:""};function Rt(e,t,n){var i=e.id;e=e.overflow;var r=32-It(i)-1;i&=~(1<<r),n+=1;var s=32-It(t)+r;if(30<s){var o=r-r%5;return s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,{id:1<<32-It(t)+r|n<<r|i,overflow:s+e}}return{id:1<<s|n<<r|i,overflow:e}}var It=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(Pt(e)/Nt|0)|0},Pt=Math.log,Nt=Math.LN2,Lt="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Ft=null,jt=null,zt=null,Vt=null,Wt=!1,Ht=!1,qt=0,$t=null,Ut=0;function Kt(){if(null===Ft)throw Error(r(321));return Ft}function Gt(){if(0<Ut)throw Error(r(312));return{memoizedState:null,queue:null,next:null}}function Yt(){return null===Vt?null===zt?(Wt=!1,zt=Vt=Gt()):(Wt=!0,Vt=zt):null===Vt.next?(Wt=!1,Vt=Vt.next=Gt()):(Wt=!0,Vt=Vt.next),Vt}function Jt(){jt=Ft=null,Ht=!1,zt=null,Ut=0,Vt=$t=null}function Qt(e,t){return"function"==typeof t?t(e):t}function Xt(e,t,n){if(Ft=Kt(),Vt=Yt(),Wt){var i=Vt.queue;if(t=i.dispatch,null!==$t&&void 0!==(n=$t.get(i))){$t.delete(i),i=Vt.memoizedState;do{i=e(i,n.action),n=n.next}while(null!==n);return Vt.memoizedState=i,[i,t]}return[Vt.memoizedState,t]}return e=e===Qt?"function"==typeof t?t():t:void 0!==n?n(t):t,Vt.memoizedState=e,e=(e=Vt.queue={last:null,dispatch:null}).dispatch=en.bind(null,Ft,e),[Vt.memoizedState,e]}function Zt(e,t){if(Ft=Kt(),t=void 0===t?null:t,null!==(Vt=Yt())){var n=Vt.memoizedState;if(null!==n&&null!==t){var i=n[1];e:if(null===i)i=!1;else{for(var r=0;r<i.length&&r<t.length;r++)if(!Lt(t[r],i[r])){i=!1;break e}i=!0}if(i)return n[0]}}return e=e(),Vt.memoizedState=[e,t],e}function en(e,t,n){if(25<=Ut)throw Error(r(301));if(e===Ft)if(Ht=!0,e={action:n,next:null},null===$t&&($t=new Map),void 0===(n=$t.get(t)))$t.set(t,e);else{for(t=n;null!==t.next;)t=t.next;t.next=e}}function tn(){throw Error(r(394))}function nn(){}var rn={readContext:function(e){return e._currentValue},useContext:function(e){return Kt(),e._currentValue},useMemo:Zt,useReducer:Xt,useRef:function(e){Ft=Kt();var t=(Vt=Yt()).memoizedState;return null===t?(e={current:e},Vt.memoizedState=e):t},useState:function(e){return Xt(Qt,e)},useInsertionEffect:nn,useLayoutEffect:function(){},useCallback:function(e,t){return Zt(function(){return e},t)},useImperativeHandle:nn,useEffect:nn,useDebugValue:nn,useDeferredValue:function(e){return Kt(),e},useTransition:function(){return Kt(),[!1,tn]},useId:function(){var e=jt.treeContext,t=e.overflow;e=((e=e.id)&~(1<<32-It(e)-1)).toString(32)+t;var n=sn;if(null===n)throw Error(r(404));return t=qt++,e=":"+n.idPrefix+"R"+e,0<t&&(e+="H"+t.toString(32)),e+":"},useMutableSource:function(e,t){return Kt(),t(e._source)},useSyncExternalStore:function(e,t,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(e){return console.error(e),null}function an(){}function cn(e,t,n,i,r,s,o,l){e.allPendingTasks++,null===n?e.pendingRootTasks++:n.pendingTasks++;var a={node:t,ping:function(){var t=e.pingedTasks;t.push(a),1===t.length&&kn(e)},blockedBoundary:n,blockedSegment:i,abortSet:r,legacyContext:s,context:o,treeContext:l};return r.add(a),a}function hn(e,t,n,i,r,s){return{status:0,id:-1,index:t,parentFlushed:!1,chunks:[],children:[],formatContext:i,boundary:n,lastPushedText:r,textEmbedded:s}}function un(e,t){if(null!=(e=e.onError(t))&&"string"!=typeof e)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 e+'" instead');return e}function dn(e,t){var n=e.onShellError;n(t),(n=e.onFatalError)(t),null!==e.destination?(e.status=2,f(e.destination,t)):(e.status=1,e.fatalError=t)}function fn(e,t,n,i,r){for(Ft={},jt=t,qt=0,e=n(i,r);Ht;)Ht=!1,qt=0,Ut+=1,Vt=null,e=n(i,r);return Jt(),e}function pn(e,t,n,i){var s=n.render(),o=i.childContextTypes;if(null!=o){var l=t.legacyContext;if("function"!=typeof n.getChildContext)i=l;else{for(var a in n=n.getChildContext())if(!(a in o))throw Error(r(108,xt(i)||"Unknown",a));i=nt({},l,n)}t.legacyContext=i,An(e,t,s),t.legacyContext=l}else An(e,t,s)}function gn(e,t){if(e&&e.defaultProps){for(var n in t=nt({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function mn(e,t,n,s,o){if("function"==typeof n)if(n.prototype&&n.prototype.isReactComponent){o=wt(n,t.legacyContext);var l=n.contextType;Bt(l=new n(s,"object"==typeof l&&null!==l?l._currentValue:o),n,s,o),pn(e,t,l,n)}else{o=fn(e,t,n,s,l=wt(n,t.legacyContext));var a=0!==qt;if("object"==typeof o&&null!==o&&"function"==typeof o.render&&void 0===o.$$typeof)Bt(o,n,s,l),pn(e,t,o,n);else if(a){s=t.treeContext,t.treeContext=Rt(s,1,0);try{An(e,t,o)}finally{t.treeContext=s}}else An(e,t,o)}else{if("string"!=typeof n){switch(n){case At:case mt:case ot:case lt:case st:case dt:return void An(e,t,s.children);case gt:throw Error(r(343));case ut:e:{n=t.blockedBoundary,o=t.blockedSegment,l=s.fallback,s=s.children;var c={id:null,rootSegmentID:-1,parentFlushed:!1,pendingTasks:0,forceClientRender:!1,completedSegments:[],byteSize:0,fallbackAbortableTasks:a=new Set,errorDigest:null},h=hn(0,o.chunks.length,c,o.formatContext,!1,!1);o.children.push(h),o.lastPushedText=!1;var d=hn(0,0,null,o.formatContext,!1,!1);d.parentFlushed=!0,t.blockedBoundary=c,t.blockedSegment=d;try{if(bn(e,t,s),d.lastPushedText&&d.textEmbedded&&d.chunks.push(F),d.status=1,wn(c,d),0===c.pendingTasks)break e}catch(t){d.status=4,c.forceClientRender=!0,c.errorDigest=un(e,t)}finally{t.blockedBoundary=n,t.blockedSegment=o}t=cn(e,l,n,h,a,t.legacyContext,t.context,t.treeContext),e.pingedTasks.push(t)}return}if("object"==typeof n&&null!==n)switch(n.$$typeof){case ht:if(s=fn(e,t,n.render,s,o),0!==qt){n=t.treeContext,t.treeContext=Rt(n,1,0);try{An(e,t,s)}finally{t.treeContext=n}}else An(e,t,s);return;case ft:return void mn(e,t,n=n.type,s=gn(n,s),o);case at:if(o=s.children,n=n._context,s=s.value,l=n._currentValue,n._currentValue=s,Ct=s={parent:a=Ct,depth:null===a?0:a.depth+1,context:n,parentValue:l,value:s},t.context=s,An(e,t,o),null===(e=Ct))throw Error(r(403));return s=e.parentValue,e.context._currentValue=s===vt?e.context._defaultValue:s,e=Ct=e.parent,void(t.context=e);case ct:return void An(e,t,s=(s=s.children)(n._currentValue));case pt:return void mn(e,t,n=(o=n._init)(n._payload),s=gn(n,s),void 0)}throw Error(r(130,null==n?n:typeof n,""))}switch(l=function(e,t,n,s,o){switch(t){case"select":e.push(re("select"));var l=null,a=null;for(f in n)if(p.call(n,f)){var c=n[f];if(null!=c)switch(f){case"children":l=c;break;case"dangerouslySetInnerHTML":a=c;break;case"defaultValue":case"value":break;default:Y(e,s,f,c)}}return e.push(J),X(e,a,l),l;case"option":a=o.selectedValue,e.push(re("option"));var h=c=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":c=g;break;case"selected":d=g;break;case"dangerouslySetInnerHTML":f=g;break;case"value":h=g;default:Y(e,s,l,g)}}if(null!=a)if(n=null!==h?""+h:function(e){var t="";return i.Children.forEach(e,function(e){null!=e&&(t+=e)}),t}(c),O(a)){for(s=0;s<a.length;s++)if(""+a[s]===n){e.push(Z);break}}else""+a===n&&e.push(Z);else d&&e.push(Z);return e.push(J),X(e,f,c),c;case"textarea":for(c in e.push(re("textarea")),f=a=l=null,n)if(p.call(n,c)&&null!=(h=n[c]))switch(c){case"children":f=h;break;case"value":l=h;break;case"defaultValue":a=h;break;case"dangerouslySetInnerHTML":throw Error(r(91));default:Y(e,s,c,h)}if(null===l&&null!==a&&(l=a),e.push(J),null!=f){if(null!=l)throw Error(r(92));if(O(f)&&1<f.length)throw Error(r(93));l=""+f}return"string"==typeof l&&"\n"===l[0]&&e.push(te),null!==l&&e.push(u(S(""+l))),null;case"input":for(a in e.push(re("input")),h=f=c=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":h=d;break;case"defaultValue":c=d;break;case"checked":f=d;break;case"value":l=d;break;default:Y(e,s,a,d)}return null!==f?Y(e,s,"checked",f):null!==h&&Y(e,s,"checked",h),null!==l?Y(e,s,"value",l):null!==c&&Y(e,s,"value",c),e.push(Q),null;case"menuitem":for(var m in e.push(re("menuitem")),n)if(p.call(n,m)&&null!=(l=n[m]))switch(m){case"children":case"dangerouslySetInnerHTML":throw Error(r(400));default:Y(e,s,m,l)}return e.push(J),null;case"title":for(g in e.push(re("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(e,s,g,a)}return e.push(J),l;case"listing":case"pre":for(h in e.push(re(t)),a=l=null,n)if(p.call(n,h)&&null!=(c=n[h]))switch(h){case"children":l=c;break;case"dangerouslySetInnerHTML":a=c;break;default:Y(e,s,h,c)}if(e.push(J),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]?e.push(te,u(n)):e.push(u(""+n)))}return"string"==typeof l&&"\n"===l[0]&&e.push(te),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 A in e.push(re(t)),n)if(p.call(n,A)&&null!=(l=n[A]))switch(A){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,t));default:Y(e,s,A,l)}return e.push(Q),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 ee(e,n,t,s);case"html":return 0===o.insertionMode&&e.push(se),ee(e,n,t,s);default:if(-1===t.indexOf("-")&&"string"!=typeof n.is)return ee(e,n,t,s);for(d in e.push(re(t)),a=l=null,n)if(p.call(n,d)&&null!=(c=n[d]))switch(d){case"children":l=c;break;case"dangerouslySetInnerHTML":a=c;break;case"style":q(e,s,c);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:v(d)&&"function"!=typeof c&&"symbol"!=typeof c&&e.push($,u(d),U,u(S(c)),K)}return e.push(J),X(e,a,l),l}}((o=t.blockedSegment).chunks,n,s,e.responseState,o.formatContext),o.lastPushedText=!1,a=o.formatContext,o.formatContext=function(e,t,n){switch(t){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<=e.insertionMode||0===e.insertionMode?L(1,null):e}(a,n,s),bn(e,t,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(oe,u(n),le)}o.lastPushedText=!1}}function An(e,t,n){if(t.node=n,"object"==typeof n&&null!==n){switch(n.$$typeof){case it:return void mn(e,t,n.type,n.props,n.ref);case rt:throw Error(r(257));case pt:var i=n._init;return void An(e,t,n=i(n._payload))}if(O(n))return void vn(e,t,n);if((i=null===n||"object"!=typeof n?null:"function"==typeof(i=bt&&n[bt]||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);vn(e,t,s)}return}throw e=Object.prototype.toString.call(n),Error(r(31,"[object Object]"===e?"object with keys {"+Object.keys(n).join(", ")+"}":e))}"string"==typeof n?(i=t.blockedSegment).lastPushedText=j(t.blockedSegment.chunks,n,e.responseState,i.lastPushedText):"number"==typeof n&&((i=t.blockedSegment).lastPushedText=j(t.blockedSegment.chunks,""+n,e.responseState,i.lastPushedText))}function vn(e,t,n){for(var i=n.length,r=0;r<i;r++){var s=t.treeContext;t.treeContext=Rt(s,i,r);try{bn(e,t,n[r])}finally{t.treeContext=s}}}function bn(e,t,n){var i=t.blockedSegment.formatContext,r=t.legacyContext,s=t.context;try{return An(e,t,n)}catch(a){if(Jt(),"object"!=typeof a||null===a||"function"!=typeof a.then)throw t.blockedSegment.formatContext=i,t.legacyContext=r,t.context=s,Ot(s),a;n=a;var o=t.blockedSegment,l=hn(0,o.chunks.length,null,o.formatContext,o.lastPushedText,!0);o.children.push(l),o.lastPushedText=!1,e=cn(e,t.node,t.blockedBoundary,l,t.abortSet,t.legacyContext,t.context,t.treeContext).ping,n.then(e,e),t.blockedSegment.formatContext=i,t.legacyContext=r,t.context=s,Ot(s)}}function xn(e){var t=e.blockedBoundary;(e=e.blockedSegment).status=3,Cn(this,t,e)}function yn(e,t,n){var i=e.blockedBoundary;e.blockedSegment.status=3,null===i?(t.allPendingTasks--,2!==t.status&&(t.status=2,null!==t.destination&&t.destination.close())):(i.pendingTasks--,i.forceClientRender||(i.forceClientRender=!0,e=void 0===n?Error(r(432)):n,i.errorDigest=t.onError(e),i.parentFlushed&&t.clientRenderedBoundaries.push(i)),i.fallbackAbortableTasks.forEach(function(e){return yn(e,t,n)}),i.fallbackAbortableTasks.clear(),t.allPendingTasks--,0===t.allPendingTasks&&(i=t.onAllReady)())}function wn(e,t){if(0===t.chunks.length&&1===t.children.length&&null===t.children[0].boundary){var n=t.children[0];n.id=t.id,n.parentFlushed=!0,1===n.status&&wn(e,n)}else e.completedSegments.push(t)}function Cn(e,t,n){if(null===t){if(n.parentFlushed){if(null!==e.completedRootSegment)throw Error(r(389));e.completedRootSegment=n}e.pendingRootTasks--,0===e.pendingRootTasks&&(e.onShellError=an,(t=e.onShellReady)())}else t.pendingTasks--,t.forceClientRender||(0===t.pendingTasks?(n.parentFlushed&&1===n.status&&wn(t,n),t.parentFlushed&&e.completedBoundaries.push(t),t.fallbackAbortableTasks.forEach(xn,e),t.fallbackAbortableTasks.clear()):n.parentFlushed&&1===n.status&&(wn(t,n),1===t.completedSegments.length&&t.parentFlushed&&e.partialBoundaries.push(t)));e.allPendingTasks--,0===e.allPendingTasks&&(e=e.onAllReady)()}function kn(e){if(2!==e.status){var t=Ct,n=on.current;on.current=rn;var i=sn;sn=e.responseState;try{var r,s=e.pingedTasks;for(r=0;r<s.length;r++){var o=s[r],l=e,a=o.blockedSegment;if(0===a.status){Ot(o.context);try{An(l,o,o.node),a.lastPushedText&&a.textEmbedded&&a.chunks.push(F),o.abortSet.delete(o),a.status=1,Cn(l,o.blockedBoundary,a)}catch(e){if(Jt(),"object"==typeof e&&null!==e&&"function"==typeof e.then){var c=o.ping;e.then(c,c)}else{o.abortSet.delete(o),a.status=4;var h=o.blockedBoundary,u=e,d=un(l,u);null===h?dn(l,u):(h.pendingTasks--,h.forceClientRender||(h.forceClientRender=!0,h.errorDigest=d,h.parentFlushed&&l.clientRenderedBoundaries.push(h))),l.allPendingTasks--,0===l.allPendingTasks&&(0,l.onAllReady)()}}}}s.splice(0,r),null!==e.destination&&Mn(e,e.destination)}catch(t){un(e,t),dn(e,t)}finally{sn=i,on.current=n,n===rn&&Ot(t)}}}function _n(e,t,n){switch(n.parentFlushed=!0,n.status){case 0:var i=n.id=e.nextSegmentId++;return n.lastPushedText=!1,n.textEmbedded=!1,e=e.responseState,l(t,ae),l(t,e.placeholderPrefix),l(t,e=u(i.toString(16))),a(t,ce);case 1:n.status=2;var s=!0;i=n.chunks;var o=0;n=n.children;for(var c=0;c<n.length;c++){for(s=n[c];o<s.index;o++)l(t,i[o]);s=Sn(e,t,s)}for(;o<i.length-1;o++)l(t,i[o]);return o<i.length&&(s=a(t,i[o])),s;default:throw Error(r(390))}}function Sn(e,t,n){var i=n.boundary;if(null===i)return _n(e,t,n);if(i.parentFlushed=!0,i.forceClientRender)i=i.errorDigest,a(t,fe),l(t,ge),i&&(l(t,Ae),l(t,u(S(i))),l(t,me)),a(t,ve),_n(e,t,n);else if(0<i.pendingTasks){i.rootSegmentID=e.nextSegmentId++,0<i.completedSegments.length&&e.partialBoundaries.push(i);var s=e.responseState,o=s.nextSuspenseID++;s=d(s.boundaryPrefix+o.toString(16)),i=i.id=s,be(t,e.responseState,i),_n(e,t,n)}else if(i.byteSize>e.progressiveChunkSize)i.rootSegmentID=e.nextSegmentId++,e.completedBoundaries.push(i),be(t,e.responseState,i.id),_n(e,t,n);else{if(a(t,he),1!==(n=i.completedSegments).length)throw Error(r(391));Sn(e,t,n[0])}return a(t,pe)}function En(e,t,n){return function(e,t,n,i){switch(n.insertionMode){case 0:case 1:return l(e,xe),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,ye);case 2:return l(e,Ce),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,ke);case 3:return l(e,Se),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,Ee);case 4:return l(e,Oe),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,Me);case 5:return l(e,De),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,Re);case 6:return l(e,Pe),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,Ne);case 7:return l(e,Fe),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,je);default:throw Error(r(397))}}(t,e.responseState,n.formatContext,n.id),Sn(e,t,n),function(e,t){switch(t.insertionMode){case 0:case 1:return a(e,we);case 2:return a(e,_e);case 3:return a(e,Te);case 4:return a(e,Be);case 5:return a(e,Ie);case 6:return a(e,Le);case 7:return a(e,ze);default:throw Error(r(397))}}(t,n.formatContext)}function Tn(e,t,n){for(var i=n.completedSegments,s=0;s<i.length;s++)On(e,t,n,i[s]);if(i.length=0,e=e.responseState,i=n.id,n=n.rootSegmentID,l(t,e.startInlineScript),e.sentCompleteBoundaryFunction?l(t,Ue):(e.sentCompleteBoundaryFunction=!0,l(t,$e)),null===i)throw Error(r(395));return n=u(n.toString(16)),l(t,i),l(t,Ke),l(t,e.segmentPrefix),l(t,n),a(t,Ge)}function On(e,t,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 En(e,t,i)}return En(e,t,i),l(t,(e=e.responseState).startInlineScript),e.sentCompleteSegmentFunction?l(t,We):(e.sentCompleteSegmentFunction=!0,l(t,Ve)),l(t,e.segmentPrefix),l(t,s=u(s.toString(16))),l(t,He),l(t,e.placeholderPrefix),l(t,s),a(t,qe)}function Mn(e,t){s=new Uint8Array(512),o=0;try{var n=e.completedRootSegment;if(null!==n&&0===e.pendingRootTasks){Sn(e,t,n),e.completedRootSegment=null;var i=e.responseState.bootstrapChunks;for(n=0;n<i.length-1;n++)l(t,i[n]);n<i.length&&a(t,i[n])}var h,d=e.clientRenderedBoundaries;for(h=0;h<d.length;h++){var f=d[h];i=t;var p=e.responseState,g=f.id,m=f.errorDigest,A=f.errorMessage,v=f.errorComponentStack;if(l(i,p.startInlineScript),p.sentClientRenderFunction?l(i,Je):(p.sentClientRenderFunction=!0,l(i,Ye)),null===g)throw Error(r(395));if(l(i,g),l(i,Qe),(m||A||v)&&(l(i,Ze),l(i,u(tt(m||"")))),(A||v)&&(l(i,Ze),l(i,u(tt(A||"")))),v&&(l(i,Ze),l(i,u(tt(v)))),!a(i,Xe))return e.destination=null,h++,void d.splice(0,h)}d.splice(0,h);var b=e.completedBoundaries;for(h=0;h<b.length;h++)if(!Tn(e,t,b[h]))return e.destination=null,h++,void b.splice(0,h);b.splice(0,h),c(t),s=new Uint8Array(512),o=0;var x=e.partialBoundaries;for(h=0;h<x.length;h++){var y=x[h];e:{d=e,f=t;var w=y.completedSegments;for(p=0;p<w.length;p++)if(!On(d,f,y,w[p])){p++,w.splice(0,p);var C=!1;break e}w.splice(0,p),C=!0}if(!C)return e.destination=null,h++,void x.splice(0,h)}x.splice(0,h);var k=e.completedBoundaries;for(h=0;h<k.length;h++)if(!Tn(e,t,k[h]))return e.destination=null,h++,void k.splice(0,h);k.splice(0,h)}finally{c(t),0===e.allPendingTasks&&0===e.pingedTasks.length&&0===e.clientRenderedBoundaries.length&&0===e.completedBoundaries.length&&t.close()}}function Bn(e,t){try{var n=e.abortableTasks;n.forEach(function(n){return yn(n,e,t)}),n.clear(),null!==e.destination&&Mn(e,e.destination)}catch(t){un(e,t),dn(e,t)}}t.renderToReadableStream=function(e,t){return new Promise(function(n,i){var r,s,o=new Promise(function(e,t){s=e,r=t}),l=function(e,t,n,i,r,s,o,l,a){var c=[],h=new Set;return(n=hn(t={destination:null,responseState:t,progressiveChunkSize:void 0===i?12800:i,status:0,fatalError:null,nextSegmentId:0,allPendingTasks:0,pendingRootTasks:0,completedRootSegment:null,abortableTasks:h,pingedTasks:c,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,e=cn(t,e,null,n,h,yt,null,Dt),c.push(e),t}(e,function(e,t,n,i,r){e=void 0===e?"":e,t=void 0===t?M:d('<script nonce="'+S(t)+'">');var s=[];if(void 0!==n&&s.push(t,u((""+n).replace(P,N)),B),void 0!==i)for(n=0;n<i.length;n++)s.push(D,u(S(i[n])),I);if(void 0!==r)for(i=0;i<r.length;i++)s.push(R,u(S(r[i])),I);return{bootstrapChunks:s,startInlineScript:t,placeholderPrefix:d(e+"P:"),segmentPrefix:d(e+"S:"),boundaryPrefix:e+"B:",idPrefix:e,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1}}(t?t.identifierPrefix:void 0,t?t.nonce:void 0,t?t.bootstrapScriptContent:void 0,t?t.bootstrapScripts:void 0,t?t.bootstrapModules:void 0),function(e){return L("http://www.w3.org/2000/svg"===e?2:"http://www.w3.org/1998/Math/MathML"===e?3:0,null)}(t?t.namespaceURI:void 0),t?t.progressiveChunkSize:void 0,t?t.onError:void 0,s,function(){var e=new ReadableStream({type:"bytes",pull:function(e){if(1===l.status)l.status=2,f(e,l.fatalError);else if(2!==l.status&&null===l.destination){l.destination=e;try{Mn(l,e)}catch(e){un(l,e),dn(l,e)}}},cancel:function(){Bn(l)}},{highWaterMark:0});e.allReady=o,n(e)},function(e){o.catch(function(){}),i(e)},r);if(t&&t.signal){var a=t.signal,c=function(){Bn(l,a.reason),a.removeEventListener("abort",c)};a.addEventListener("abort",c)}kn(l)})},t.version="18.3.1"},467(e,t,n){var i,r;i=n(633),r=n(911),i.version,i.renderToString,t.qV=i.renderToStaticMarkup,i.renderToNodeStream,i.renderToStaticNodeStream,r.renderToReadableStream},20(e,t,n){var i=n(649),r=Symbol.for("react.element"),s=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,l=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var i,s={},c=null,h=null;for(i in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(h=t.ref),t)o.call(t,i)&&!a.hasOwnProperty(i)&&(s[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===s[i]&&(s[i]=t[i]);return{$$typeof:r,type:e,key:c,ref:h,props:s,_owner:l.current}}t.Fragment=s,t.jsx=c,t.jsxs=c},848(e,t,n){e.exports=n(20)},72(e){var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var s={},o=[],l=0;l<e.length;l++){var a=e[l],c=i.base?a[0]+i.base:a[0],h=s[c]||0,u="".concat(c," ").concat(h);s[c]=h+1;var d=n(u),f={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==d)t[d].references++,t[d].updater(f);else{var p=r(f,i);i.byIndex=l,t.splice(l,0,{identifier:u,updater:p,references:1})}o.push(u)}return o}function r(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var s=i(e=e||[],r=r||{});return function(e){e=e||[];for(var o=0;o<s.length;o++){var l=n(s[o]);t[l].references--}for(var a=i(e,r),c=0;c<s.length;c++){var h=n(s[c]);0===t[h].references&&(t[h].updater(),t.splice(h,1))}s=a}}},659(e){var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);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)}},540(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},56(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},825(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,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))))," */")),t.styleTagTransform(i,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},113(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},649(t){t.exports=e},942(e,t){var n;!function(){var i={}.hasOwnProperty;function r(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=o(e,s(n)))}return e}function s(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)i.call(e,n)&&e[n]&&(t=o(t,n));return t}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()}},k={};function _(e){var t=k[e];if(void 0!==t)return t.exports;var n=k[e]={id:e,exports:{}};return C[e](n,n.exports,_),n.exports}_.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return _.d(t,{a:t}),t},_.d=(e,t)=>{for(var n in t)_.o(t,n)&&!_.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},_.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),_.nc=void 0;var S=_(649),E=_(848);function T({label:e,children:t,align:n="bottom-start",className:i,showDelay:r=250,hideDelay:o=250}){const[l,a]=(0,S.useState)(!1),c=(0,S.useRef)(void 0),h=(0,S.useRef)(void 0),u=(0,S.useRef)(null),d=(0,S.useRef)(null),f=(0,S.useCallback)((e=!1)=>{clearTimeout(c.current),clearTimeout(h.current),e?c.current=setTimeout(()=>{a(!0)},r):a(!0)},[r]),p=(0,S.useCallback)((e=!1)=>{clearTimeout(c.current),clearTimeout(h.current),e?h.current=setTimeout(()=>{a(!1)},o):a(!1)},[o]);(0,S.useEffect)(()=>()=>{clearTimeout(c.current),clearTimeout(h.current)},[]),(0,S.useEffect)(()=>{if(!l)return;const e=e=>{u.current&&!u.current.contains(e.target)&&d.current&&!d.current.contains(e.target)&&p(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[l,p]);const g=({relatedTarget:e})=>{var t,n;if(e===u.current||e===d.current||null!==(t=u.current)&&void 0!==t&&t.contains(e)||null!==(n=d.current)&&void 0!==n&&n.contains(e))return;const i=window.getSelection();if(i&&i.toString().length>0)try{var r,s,o;const e=i.getRangeAt(0);if(null!==(r=d.current)&&void 0!==r&&r.contains(e.commonAncestorContainer)||null!==(s=d.current)&&void 0!==s&&s.contains(i.anchorNode)||null!==(o=d.current)&&void 0!==o&&o.contains(i.focusNode))return}catch(e){}p(!0)},m=()=>{clearTimeout(h.current)};return(0,E.jsxs)("div",{className:"task-testing-tooltip__wrapper"+(i?` ${i}`:""),ref:u,onMouseEnter:()=>f(!0),onMouseLeave:g,onFocus:e=>{e.target===u.current&&f(!1)},onBlur:e=>{var t,n;const{relatedTarget:i}=e;null!==(t=d.current)&&void 0!==t&&t.contains(i)||null!==(n=u.current)&&void 0!==n&&n.contains(i)||p(!1)},onKeyDown:e=>{"Escape"===e.code&&p(!1)},children:[t,l&&s((()=>{const t=function(e,t){if(!e)return{};const n=e.getBoundingClientRect(),i={};return t.startsWith("bottom")?i.top=n.bottom+6:t.startsWith("top")&&(i.bottom=window.innerHeight-n.top+6),t.endsWith("start")?i.left=n.left:t.endsWith("end")&&(i.right=window.innerWidth-n.right),i}(u.current,n);return(0,E.jsxs)("div",{className:`task-testing-tooltip ${n}`,role:"tooltip",style:t,ref:d,onClick:e=>e.stopPropagation(),onMouseEnter:m,onMouseLeave:g,children:[(0,E.jsx)("div",{className:"task-testing-tooltip__content",children:e}),(0,E.jsx)("div",{className:"task-testing-tooltip__arrow"})]})})(),document.body)]})}var O=_(942),M=_.n(O);const B=Object.prototype.toString,D=Object.prototype.hasOwnProperty;function R(e){return"[object Object]"===B.call(e)}function I(e){const t=B.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function P(e,t){return!(null==e)&&D.call(e,t)}function N(e,t){let n,i;if(void 0===e)return;const r=function(e){return"[object Array]"===B.call(e)}(e)?j:F;for(let s in e)if(P(e,s)&&(n=e[s],i=t(n,r(s)),!1===i))return n}function L(e,t){return!!function(e,t){const n=function(e){return I(e)?e:t=>t===e}(t);let i;return N(e,function(e,t){if(n(e,t))return i=e,!1}),i}(e,t)}function F(e){return e}function j(e){return Number(e)}function z(e,t){let n={};return N(Object(e),function(e,i){-1===t.indexOf(i)&&(n[i]=e)}),n}function V(e,t){var n=H(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function W(e,t){return L(t,function(t){return V(e,t)})}function H(e){return e&&e.businessObject||e}const q=["bpmn:Task","bpmn:SubProcess"],$="Select a task or subprocess to start testing.",U="Task testing is only supported for tasks and subprocesses. Select one to start testing.";var K=_(7),G=_.n(K);const Y={input:{},output:{}},J=["bpmn:Task","bpmn:SubProcess"];class Q extends(G()){constructor(e,t,n=Y){super(),this._injector=e,this._elementVariables=t,this._config={...Y,...n},this._selectedElement=null,this._variablesForElements=new Map}setConfig(e){this._config=e,this.emit("config.changed")}getConfig(){return this._config}setInputConfigForElement(e,t){if(!W(e,J))throw new Error(`Unsupported element type: ${e.type}`);this._config={...this._config,input:{...this._config.input,[e.id]:t}},this.emit("config.changed",{config:this._config})}resetInputConfigForElement(e){if(!W(e,J))throw new Error(`Unsupported element type: ${e.type}`);this._config={...this._config,input:z(this._config.input,e.id)},this.emit("config.changed")}setOutputConfigForElement(e,t){if(!W(e,J))throw new Error(`Unsupported element type: ${e.type}`);this._config={...this._config,output:{...this._config.output,[e.id]:t}},this.emit("config.changed")}resetOutputConfigForElement(e){if(!W(e,J))throw new Error(`Unsupported element type: ${e.type}`);this._config={...this._config,output:z(this._config.output,e.id)},this.emit("config.changed")}getInputConfigForElement(e){if(!W(e,J))throw new Error(`Unsupported element type: ${e.type}`);return t=this._config.input[e.id],"[object String]"!==B.call(t)?this._getDefaultInputConfig():this._config.input[e.id];var t}getOutputConfigForElement(e){if(!W(e,J))throw new Error(`Unsupported element type: ${e.type}`);if(this._config.output[e.id])return this._config.output[e.id]}_getDefaultInputConfig(){return"{}"}}class X extends(G()){constructor(e){super(),this._injector=e,this._variables={},this._variableResolver=e.get("variableResolver"),this._injector.get("eventBus").on("commandStack.changed",()=>{this._variables={},this.emit("variables.changed")})}async getVariablesForElement(e){if(this._variables[e.id])return this._variables[e.id];const t=(await this._variableResolver.getVariablesForElement(e).catch(()=>[])).filter(({origin:t})=>!(1===t.length&&t[0].id===e.id));return this._variables[e.id]=t,t}}var Z=_(467);let ee=[],te=[];function ne(e){if(e<768)return!1;for(let t=0,n=ee.length;;){let i=t+n>>1;if(e<ee[i])n=i;else{if(!(e>=te[i]))return!0;t=i+1}if(t==n)return!1}}function ie(e){return e>=127462&&e<=127487}function re(e,t,n=!0,i=!0){return(n?se:oe)(e,t,i)}function se(e,t,n){if(t==e.length)return t;t&&ae(e.charCodeAt(t))&&ce(e.charCodeAt(t-1))&&t--;let i=le(e,t);for(t+=he(i);t<e.length;){let r=le(e,t);if(8205==i||8205==r||n&&ne(r))t+=he(r),i=r;else{if(!ie(r))break;{let n=0,i=t-2;for(;i>=0&&ie(le(e,i));)n++,i-=2;if(n%2==0)break;t+=2}}}return t}function oe(e,t,n){for(;t>0;){let i=se(e,t-2,n);if(i<t)return i;t--}return 0}function le(e,t){let n=e.charCodeAt(t);if(!ce(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return ae(i)?i-56320+(n-55296<<10)+65536:n}function ae(e){return e>=56320&&e<57344}function ce(e){return e>=55296&&e<56320}function he(e){return e<65536?1:2}(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?te:ee).push(n+=e[t])})();class ue{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=xe(this,e,t);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),fe.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=xe(this,e,t);let n=[];return this.decompose(e,t,n,0),fe.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new me(this),r=new me(e);for(let e=t,s=t;;){if(i.next(e),r.next(e),e=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}iter(e=1){return new me(this,e)}iterRange(e,t=this.length){return new Ae(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ve(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new de(e):fe.from(de.split(e,[])):ue.empty}}class de extends ue{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let r=0;;r++){let s=this.text[r],o=i+s.length;if((t?n:o)>=e)return new be(i,o,n,s);i=o+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new de(ge(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=pe(r.text,e.text.slice(),0,r.length);if(t.length<=32)n.push(new de(t,e.length+r.length));else{let e=t.length>>1;n.push(new de(t.slice(0,e)),new de(t.slice(e)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof de))return super.replace(e,t,n);[e,t]=xe(this,e,t);let i=pe(this.text,pe(n.text,ge(this.text,0,e)),t),r=this.length+n.length-(t-e);return i.length<=32?new de(i,r):fe.from(de.split(i,[]),r)}sliceString(e,t=this.length,n="\n"){[e,t]=xe(this,e,t);let i="";for(let r=0,s=0;r<=t&&s<this.text.length;s++){let o=this.text[s],l=r+o.length;r>e&&s&&(i+=n),e<l&&t>r&&(i+=o.slice(Math.max(0,e-r),t-r)),r=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let r of e)n.push(r),i+=r.length+1,32==n.length&&(t.push(new de(n,i)),n=[],i=-1);return i>-1&&t.push(new de(n,i)),t}}class fe extends ue{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,i){for(let r=0;;r++){let s=this.children[r],o=i+s.length,l=n+s.lines-1;if((t?l:o)>=e)return s.lineInner(e,t,n,i);i=o+1,n=l+1}}decompose(e,t,n,i){for(let r=0,s=0;s<=t&&r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e<=l&&t>=s){let r=i&((s<=e?1:0)|(l>=t?2:0));s>=e&&l<=t&&!r?n.push(o):o.decompose(e-s,t-s,n,r)}s=l+1}}replace(e,t,n){if([e,t]=xe(this,e,t),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(e>=r&&t<=o){let l=s.replace(e-r,t-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 fe(r,this.length-(t-e)+n.length)}return super.replace(r,o,l)}r=o+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=xe(this,e,t);let i="";for(let r=0,s=0;r<this.children.length&&s<=t;r++){let o=this.children[r],l=s+o.length;s>e&&r&&(i+=n),e<l&&t>s&&(i+=o.sliceString(e-s,t-s,n)),s=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof fe))return 0;let n=0,[i,r,s,o]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,r+=t){if(i==s||r==o)return n;let l=this.children[i],a=e.children[r];if(l!=a)return n+l.scanIdentical(a,t);n+=l.length+1}}static from(e,t=e.reduce((e,t)=>e+t.length+1,-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new de(n,t)}let i=Math.max(32,n>>5),r=i<<1,s=i>>1,o=[],l=0,a=-1,c=[];function h(e){let t;if(e.lines>r&&e instanceof fe)for(let t of e.children)h(t);else e.lines>s&&(l>s||!l)?(u(),o.push(e)):e instanceof de&&l&&(t=c[c.length-1])instanceof de&&e.lines+t.lines<=32?(l+=e.lines,a+=e.length+1,c[c.length-1]=new de(t.text.concat(e.text),t.length+1+e.length)):(l+e.lines>i&&u(),l+=e.lines,a+=e.length+1,c.push(e))}function u(){0!=l&&(o.push(1==c.length?c[0]:fe.from(c,a)),a=-1,l=c.length=0)}for(let t of e)h(t);return u(),1==o.length?o[0]:new fe(o,t)}}function pe(e,t,n=0,i=1e9){for(let r=0,s=0,o=!0;s<e.length&&r<=i;s++){let l=e[s],a=r+l.length;a>=n&&(a>i&&(l=l.slice(0,i-r)),r<n&&(l=l.slice(n-r)),o?(t[t.length-1]+=l,o=!1):t.push(l)),r=a+1}return t}function ge(e,t,n){return pe(e,[""],t,n)}ue.empty=new de([""],0);class me{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof de?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],s=r>>1,o=i instanceof de?i.text.length:i.children.length;if(s==(t>0?o:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof de){let r=i.text[s+(t<0?-1:0)];if(this.offsets[n]+=t,r.length>Math.max(0,e))return this.value=0==e?r:t>0?r.slice(e):r.slice(0,r.length-e),this;e-=r.length}else{let r=i.children[s+(t<0?-1:0)];e>r.length?(e-=r.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(t>0?1:(r instanceof de?r.text.length:r.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Ae{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new me(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class ve{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(ue.prototype[Symbol.iterator]=function(){return this.iter()},me.prototype[Symbol.iterator]=Ae.prototype[Symbol.iterator]=ve.prototype[Symbol.iterator]=function(){return this});class be{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function xe(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function ye(e,t,n=!0,i=!0){return re(e,t,n,i)}function we(e,t){let n=e.charCodeAt(t);if(!((i=n)>=55296&&i<56320&&t+1!=e.length))return n;var i;let r=e.charCodeAt(t+1);return function(e){return e>=56320&&e<57344}(r)?r-56320+(n-55296<<10)+65536:n}function Ce(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function ke(e){return e<65536?1:2}const _e=/\r\n?|\n/;var Se=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Se||(Se={}));class Ee{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let r=this.sections[t++],s=this.sections[t++];s<0?(e(n,i,r),i+=r):i+=s,n+=r}}iterChangedRanges(e,t=!1){Be(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new Ee(e)}composeDesc(e){return this.empty?e:e.empty?this:Re(this,e)}mapDesc(e,t=!1){return e.empty?this:De(this,e,t)}mapPos(e,t=-1,n=Se.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>e)return r+(e-i);r+=o}else{if(n!=Se.Simple&&a>=e&&(n==Se.TrackDel&&i<e&&a>e||n==Se.TrackBefore&&i<e||n==Se.TrackAfter&&a>e))return null;if(a>e||a==e&&t<0&&!o)return e==i||t<0?r:r+l;r+=l}i=a}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return r}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let r=i+this.sections[n++];if(this.sections[n++]>=0&&i<=t&&r>=e)return!(i<e&&r>t)||"cover";i=r}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(e=>"number"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ee(e)}static create(e){return new Ee(e)}}class Te extends Ee{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Be(this,(t,n,i,r,s)=>e=e.replace(i,i+(n-t),s),!1),e}mapDesc(e,t=!1){return De(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,r=0;i<t.length;i+=2){let s=t[i],o=t[i+1];if(o>=0){t[i]=o,t[i+1]=s;let l=i>>1;for(;n.length<l;)n.push(ue.empty);n.push(s?e.slice(r,r+s):ue.empty)}r+=s}return new Te(t,n)}compose(e){return this.empty?e:e.empty?this:Re(this,e,!0)}map(e,t=!1){return e.empty?this:De(this,e,t,!0)}iterChanges(e,t=!1){Be(this,e,t)}get desc(){return Ee.create(this.sections)}filter(e){let t=[],n=[],i=[],r=new Ie(this);e:for(let s=0,o=0;;){let l=s==e.length?1e9:e[s++];for(;o<l||o==l&&0==r.len;){if(r.done)break e;let e=Math.min(r.len,l-o);Oe(i,e,-1);let s=-1==r.ins?-1:0==r.off?r.ins:0;Oe(t,e,s),s>0&&Me(n,t,r.text),r.forward(e),o+=e}let a=e[s++];for(;o<a;){if(r.done)break e;let e=Math.min(r.len,a-o);Oe(t,e,-1),Oe(i,e,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(e),o+=e}}return{changes:new Te(t,n),filtered:Ee.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];i<0?e.push(n):0==i?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],r=[],s=0,o=null;function l(e=!1){if(!e&&!i.length)return;s<t&&Oe(i,t-s,-1);let n=new Te(i,r);o=o?o.compose(n.map(o)):n,i=[],r=[],s=0}return function e(a){if(Array.isArray(a))for(let t of a)e(t);else if(a instanceof Te){if(a.length!=t)throw new RangeError(`Mismatched change set length (got ${a.length}, expected ${t})`);l(),o=o?o.compose(a.map(o)):a}else{let{from:e,to:o=e,insert:c}=a;if(e>o||e<0||o>t)throw new RangeError(`Invalid change range ${e} to ${o} (in doc of length ${t})`);let h=c?"string"==typeof c?ue.of(c.split(n||_e)):c:ue.empty,u=h.length;if(e==o&&0==u)return;e<s&&l(),e>s&&Oe(i,e-s,-1),Oe(i,o-e,u),Me(r,i,h),s=o}}(e),l(!o),o}static empty(e){return new Te(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let r=e[i];if("number"==typeof r)t.push(r,-1);else{if(!Array.isArray(r)||"number"!=typeof r[0]||r.some((e,t)=>t&&"string"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)t.push(r[0],0);else{for(;n.length<i;)n.push(ue.empty);n[i]=ue.of(r.slice(1)),t.push(r[0],n[i].length)}}}return new Te(t,n)}static createSet(e,t){return new Te(e,t)}}function Oe(e,t,n,i=!1){if(0==t&&n<=0)return;let r=e.length-2;r>=0&&n<=0&&n==e[r+1]?e[r]+=t:r>=0&&0==t&&0==e[r]?e[r+1]+=n:i?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function Me(e,t,n){if(0==n.length)return;let i=t.length-2>>1;if(i<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<i;)e.push(ue.empty);e.push(n)}}function Be(e,t,n){let i=e.inserted;for(let r=0,s=0,o=0;o<e.sections.length;){let l=e.sections[o++],a=e.sections[o++];if(a<0)r+=l,s+=l;else{let c=r,h=s,u=ue.empty;for(;c+=l,h+=a,a&&i&&(u=u.append(i[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)l=e.sections[o++],a=e.sections[o++];t(r,c,s,h,u),r=c,s=h}}}function De(e,t,n,i=!1){let r=[],s=i?[]:null,o=new Ie(e),l=new Ie(t);for(let e=-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 e=Math.min(o.len,l.len);Oe(r,e,-1),o.forward(e),l.forward(e)}else if(l.ins>=0&&(o.ins<0||e==o.i||0==o.off&&(l.len<o.len||l.len==o.len&&!n))){let t=l.len;for(Oe(r,l.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(Oe(r,0,o.ins),s&&Me(s,r,o.text),e=o.i),o.forward(n),t-=n}l.next()}else{if(!(o.ins>=0)){if(o.done&&l.done)return s?Te.createSet(r,s):Ee.create(r);throw new Error("Mismatched change set lengths")}{let t=0,n=o.len;for(;n;)if(-1==l.ins){let e=Math.min(n,l.len);t+=e,n-=e,l.forward(e)}else{if(!(0==l.ins&&l.len<n))break;n-=l.len,l.next()}Oe(r,t,e<o.i?o.ins:0),s&&e<o.i&&Me(s,r,o.text),e=o.i,o.forward(o.len-n)}}}}function Re(e,t,n=!1){let i=[],r=n?[]:null,s=new Ie(e),o=new Ie(t);for(let e=!1;;){if(s.done&&o.done)return r?Te.createSet(i,r):Ee.create(i);if(0==s.ins)Oe(i,s.len,0,e),s.next();else if(0!=o.len||o.done){if(s.done||o.done)throw new Error("Mismatched change set lengths");{let t=Math.min(s.len2,o.len),n=i.length;if(-1==s.ins){let n=-1==o.ins?-1:o.off?0:o.ins;Oe(i,t,n,e),r&&n&&Me(r,i,o.text)}else-1==o.ins?(Oe(i,s.off?0:s.len,t,e),r&&Me(r,i,s.textBit(t))):(Oe(i,s.off?0:s.len,o.off?0:o.ins,e),r&&!o.off&&Me(r,i,o.text));e=(s.ins>t||o.ins>=0&&o.len>t)&&(e||i.length>n),s.forward2(t),o.forward(t)}}else Oe(i,0,o.ins,e),r&&Me(r,i,o.text),o.next()}}class Ie{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?ue.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?ue.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Pe{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new Pe(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Ne.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Ne.range(this.anchor,n)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||this.goalColumn!=e.goalColumn||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return Ne.range(e.anchor,e.head)}static create(e,t,n){return new Pe(e,t,n)}}class Ne{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Ne.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new Ne([this.main],0)}addRange(e,t=!0){return Ne.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,Ne.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ne(e.ranges.map(e=>Pe.fromJSON(e)),e.main)}static single(e,t=e){return new Ne([Ne.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let r=e[i];if(r.empty?r.from<=n:r.from<n)return Ne.normalized(e.slice(),t);n=r.to}return new Ne(e,t)}static cursor(e,t=0,n,i){return Pe.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n))|(null!=i?i:16777215)<<6)}static range(e,t,n,i){let r=(null!=n?n:16777215)<<6|(null==i?7:Math.min(6,i));return t<e?Pe.create(t,e,48|r):Pe.create(e,t,(t>e?8:0)|r)}static normalized(e,t=0){let n=e[t];e.sort((e,t)=>e.from-t.from),t=e.indexOf(n);for(let n=1;n<e.length;n++){let i=e[n],r=e[n-1];if(i.empty?i.from<=r.to:i.from<r.to){let s=r.from,o=Math.max(i.to,r.to);n<=t&&t--,e.splice(--n,2,i.anchor>i.head?Ne.range(o,s):Ne.range(s,o))}}return new Ne(e,t)}}function Le(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let Fe=0;class je{constructor(e,t,n,i,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=Fe++,this.default=e([]),this.extensions="function"==typeof r?r(this):r}get reader(){return this}static define(e={}){return new je(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:ze),!!e.static,e.enables)}of(e){return new Ve([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ve(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ve(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],n=>t(n.field(e)))}}function ze(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}class Ve{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=Fe++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,r=this.id,s=e[r]>>1,o=2==this.type,l=!1,a=!1,c=[];for(let n of this.dependencies)"doc"==n?l=!0:"selection"==n?a=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||c.push(e[n.id]);return{create:e=>(e.values[s]=n(e),1),update(e,t){if(l&&t.docChanged||a&&(t.docChanged||t.selection)||He(e,c)){let t=n(e);if(o?!We(t,e.values[s],i):!i(t,e.values[s]))return e.values[s]=t,1}return 0},reconfigure:(e,t)=>{let l,a=t.config.address[r];if(null!=a){let r=et(t,a);if(this.dependencies.every(n=>n instanceof je?t.facet(n)===e.facet(n):!(n instanceof Ue)||t.field(n,!1)==e.field(n,!1))||(o?We(l=n(e),r,i):i(l=n(e),r)))return e.values[s]=r,0}else l=n(e);return e.values[s]=l,1}}}}function We(e,t,n){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}function He(e,t){let n=!1;for(let i of t)1&Ze(e,i)&&(n=!0);return n}function qe(e,t,n){let i=n.map(t=>e[t.id]),r=n.map(e=>e.type),s=i.filter(e=>!(1&e)),o=e[t.id]>>1;function l(e){let n=[];for(let t=0;t<i.length;t++){let s=et(e,i[t]);if(2==r[t])for(let e of s)n.push(e);else n.push(s)}return t.combine(n)}return{create(e){for(let t of i)Ze(e,t);return e.values[o]=l(e),1},update(e,n){if(!He(e,s))return 0;let i=l(e);return t.compare(i,e.values[o])?0:(e.values[o]=i,1)},reconfigure(e,r){let s=He(e,i),a=r.config.facets[t.id],c=r.facet(t);if(a&&!s&&ze(n,a))return e.values[o]=c,0;let h=l(e);return t.compare(h,c)?(e.values[o]=c,0):(e.values[o]=h,1)}}}const $e=je.define({static:!0});class Ue{constructor(e,t,n,i,r){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=r,this.provides=void 0}static define(e){let t=new Ue(Fe++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet($e).find(e=>e.field==this);return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let i=e.values[t],r=this.updateF(i,n);return this.compareF(i,r)?0:(e.values[t]=r,1)},reconfigure:(e,n)=>{let i,r=e.facet($e),s=n.facet($e);return(i=r.find(e=>e.field==this))&&i!=s.find(e=>e.field==this)?(e.values[t]=i.create(e),1):null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,$e.of({field:this,create:e})]}get extension(){return this}}function Ke(e){return t=>new Ye(t,e)}const Ge={highest:Ke(0),high:Ke(1),default:Ke(2),low:Ke(3),lowest:Ke(4)};class Ye{constructor(e,t){this.inner=e,this.prec=t}}class Je{of(e){return new Qe(this,e)}reconfigure(e){return Je.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Qe{constructor(e,t){this.compartment=e,this.inner=t}}class Xe{constructor(e,t,n,i,r,s){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let i=[],r=Object.create(null),s=new Map;for(let n of function(e,t,n){let i=[[],[],[],[],[]],r=new Map;return function e(s,o){let l=r.get(s);if(null!=l){if(l<=o)return;let e=i[l].indexOf(s);e>-1&&i[l].splice(e,1),s instanceof Qe&&n.delete(s.compartment)}if(r.set(s,o),Array.isArray(s))for(let t of s)e(t,o);else if(s instanceof Qe){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=t.get(s.compartment)||s.inner;n.set(s.compartment,i),e(i,o)}else if(s instanceof Ye)e(s.inner,s.prec);else if(s instanceof Ue)i[o].push(s),s.provides&&e(s.provides,o);else if(s instanceof Ve)i[o].push(s),s.facet.extensions&&e(s.facet.extensions,2);else{let t=s.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(t,o)}}(e,2),i.reduce((e,t)=>e.concat(t))}(e,t,s))n instanceof Ue?i.push(n):(r[n.facet.id]||(r[n.facet.id]=[])).push(n);let o=Object.create(null),l=[],a=[];for(let e of i)o[e.id]=a.length<<1,a.push(t=>e.slot(t));let c=null==n?void 0:n.config.facets;for(let e in r){let t=r[e],i=t[0].facet,s=c&&c[e]||[];if(t.every(e=>0==e.type))if(o[i.id]=l.length<<1|1,ze(s,t))l.push(n.facet(i));else{let e=i.combine(t.map(e=>e.value));l.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(o[e.id]=l.length<<1|1,l.push(e.value)):(o[e.id]=a.length<<1,a.push(t=>e.dynamicSlot(t)));o[i.id]=a.length<<1,a.push(e=>qe(e,i,t))}}let h=a.map(e=>e(o));return new Xe(e,s,h,o,l,r)}}function Ze(e,t){if(1&t)return 2;let n=t>>1,i=e.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function et(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const tt=je.define(),nt=je.define({combine:e=>e.some(e=>e),static:!0}),it=je.define({combine:e=>e.length?e[0]:void 0,static:!0}),rt=je.define(),st=je.define(),ot=je.define(),lt=je.define({combine:e=>!!e.length&&e[0]});class at{constructor(e,t){this.type=e,this.value=t}static define(){return new ct}}class ct{of(e){return new at(this,e)}}class ht{constructor(e){this.map=e}of(e){return new ut(this,e)}}class ut{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new ut(this.type,t)}is(e){return this.type==e}static define(e={}){return new ht(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let e=i.map(t);e&&n.push(e)}return n}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{constructor(e,t,n,i,r,s){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=s,this._doc=null,this._state=null,n&&Le(n,t.newLength),r.some(e=>e.type==dt.time)||(this.annotations=r.concat(dt.time.of(Date.now())))}static create(e,t,n,i,r,s){return new dt(e,t,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(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(dt.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function ft(e,t){let n=[];for(let i=0,r=0;;){let s,o;if(i<e.length&&(r==t.length||t[r]>=e[i]))s=e[i++],o=e[i++];else{if(!(r<t.length))return n;s=t[r++],o=t[r++]}!n.length||n[n.length-1]<s?n.push(s,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function pt(e,t,n){var i;let r,s,o;return n?(r=t.changes,s=Te.empty(t.changes.length),o=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),s=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(r)),{changes:o,selection:t.selection?t.selection.map(s):null===(i=e.selection)||void 0===i?void 0:i.map(r),effects:ut.mapEffects(e.effects,r).concat(ut.mapEffects(t.effects,s)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function gt(e,t,n){let i=t.selection,r=vt(t.annotations);return t.userEvent&&(r=r.concat(dt.userEvent.of(t.userEvent))),{changes:t.changes instanceof Te?t.changes:Te.of(t.changes||[],n,e.facet(it)),selection:i&&(i instanceof Ne?i:Ne.single(i.anchor,i.head)),effects:vt(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function mt(e,t,n){let i=gt(e,t.length?t[0]:{},e.doc.length);t.length&&!1===t[0].filter&&(n=!1);for(let r=1;r<t.length;r++){!1===t[r].filter&&(n=!1);let s=!!t[r].sequential;i=pt(i,gt(e,t[r],s?i.changes.newLength:e.doc.length),s)}let r=dt.create(e,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(e){let t=e.startState,n=t.facet(ot),i=e;for(let r=n.length-1;r>=0;r--){let s=n[r](e);s&&Object.keys(s).length&&(i=pt(i,gt(t,s,e.changes.newLength),!0))}return i==e?e:dt.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let i of t.facet(rt)){let t=i(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:ft(n,t))}if(!0!==n){let i,r;if(!1===n)r=e.changes.invertedDesc,i=Te.empty(t.doc.length);else{let t=e.changes.filter(n);i=t.changes,r=t.filtered.mapDesc(t.changes).invertedDesc}e=dt.create(t,i,e.selection&&e.selection.map(r),ut.mapEffects(e.effects,r),e.annotations,e.scrollIntoView)}let i=t.facet(st);for(let n=i.length-1;n>=0;n--){let r=i[n](e);e=r instanceof dt?r:Array.isArray(r)&&1==r.length&&r[0]instanceof dt?r[0]:mt(t,vt(r),!1)}return e}(r):r)}dt.time=at.define(),dt.userEvent=at.define(),dt.addToHistory=at.define(),dt.remote=at.define();const At=[];function vt(e){return null==e?At:Array.isArray(e)?e:[e]}var bt=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(bt||(bt={}));const xt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let yt;try{yt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class wt{constructor(e,t,n,i,r,s){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=r,s&&(s._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)Ze(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null!=n)return Ze(this,n),et(this,n);if(t)throw new RangeError("Field is not present in this state")}update(...e){return mt(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:i,compartments:r}=n;for(let t of e.effects)t.is(Je.reconfigure)?(n&&(r=new Map,n.compartments.forEach((e,t)=>r.set(t,e)),n=null),r.set(t.value.compartment,t.value.extension)):t.is(ut.reconfigure)?(n=null,i=t.value):t.is(ut.appendConfig)&&(n=null,i=vt(i).concat(t.value));n?t=e.startState.values.slice():(n=Xe.resolve(i,r,this),t=new wt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let s=e.startState.facet(nt)?e.newSelection:e.newSelection.asSingle();new wt(n,e.newDoc,s,t,(t,n)=>n.update(t,e),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Ne.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),r=[n.range],s=vt(n.effects);for(let n=1;n<t.ranges.length;n++){let o=e(t.ranges[n]),l=this.changes(o.changes),a=l.map(i);for(let e=0;e<n;e++)r[e]=r[e].map(a);let c=i.mapDesc(l,!0);r.push(o.range.map(c)),i=i.compose(a),s=ut.mapEffects(s,a).concat(ut.mapEffects(vt(o.effects),c))}return{changes:i,selection:Ne.create(r,t.mainIndex),effects:s}}changes(e=[]){return e instanceof Te?e:Te.of(e,this.doc.length,this.facet(wt.lineSeparator))}toText(e){return ue.of(e.split(this.facet(wt.lineSeparator)||_e))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(Ze(this,t),et(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof Ue&&null!=this.config.address[i.id]&&(t[n]=i.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n)for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)){let r=n[t],s=e[t];i.push(r.init(e=>r.spec.fromJSON(s,e)))}return wt.create({doc:e.doc,selection:Ne.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=Xe.resolve(e.extensions||[],new Map),n=e.doc instanceof ue?e.doc:ue.of((e.doc||"").split(t.staticFacet(wt.lineSeparator)||_e)),i=e.selection?e.selection instanceof Ne?e.selection:Ne.single(e.selection.anchor,e.selection.head):Ne.single(0);return Le(i,n.length),t.staticFacet(nt)||(i=i.asSingle()),new wt(t,n,i,t.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(wt.tabSize)}get lineBreak(){return this.facet(wt.lineSeparator)||"\n"}get readOnly(){return this.facet(lt)}phrase(e,...t){for(let t of this.facet(wt.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(e,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>t.length?e:t[i-1]})),e}languageDataAt(e,t,n=-1){let i=[];for(let r of this.facet(tt))for(let s of r(this,t,n))Object.prototype.hasOwnProperty.call(s,e)&&i.push(s[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return n=t.length?t[0]:"",e=>{if(!/\S/.test(e))return bt.Space;if(function(e){if(yt)return yt.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||xt.test(n)))return!0}return!1}(e))return bt.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return bt.Word;return bt.Other};var n}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),r=this.charCategorizer(e),s=e-n,o=e-n;for(;s>0;){let e=ye(t,s,!1);if(r(t.slice(e,s))!=bt.Word)break;s=e}for(;o<i;){let e=ye(t,o);if(r(t.slice(o,e))!=bt.Word)break;o=e}return s==o?null:Ne.range(s+n,o+n)}}function Ct(e,t,n={}){let i={};for(let t of e)for(let e of Object.keys(t)){let r=t[e],s=i[e];if(void 0===s)i[e]=r;else if(s===r||void 0===r);else{if(!Object.hasOwnProperty.call(n,e))throw new Error("Config merge conflict for field "+e);i[e]=n[e](s,r)}}for(let e in t)void 0===i[e]&&(i[e]=t[e]);return i}wt.allowMultipleSelections=nt,wt.tabSize=je.define({combine:e=>e.length?e[0]:4}),wt.lineSeparator=it,wt.readOnly=lt,wt.phrases=je.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every(n=>e[n]==t[n])}}),wt.languageData=tt,wt.changeFilter=rt,wt.transactionFilter=st,wt.transactionExtender=ot,Je.reconfigure=ut.define();class kt{eq(e){return this==e}range(e,t=e){return St.create(e,t,this)}}function _t(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}kt.prototype.startSide=kt.prototype.endSide=0,kt.prototype.point=!1,kt.prototype.mapMode=Se.TrackDel;class St{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new St(e,t,n)}}function Et(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class Tt{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let r=n?this.to:this.from;for(let s=i,o=r.length;;){if(s==o)return s;let i=s+o>>1,l=r[i]-e||(n?this.value[i].endSide:this.value[i].startSide)-t;if(i==s)return l>=0?s:o;l>=0?o=i:s=i+1}}between(e,t,n,i){for(let r=this.findIndex(t,-1e9,!0),s=this.findIndex(n,1e9,!1,r);r<s;r++)if(!1===i(this.from[r]+e,this.to[r]+e,this.value[r]))return!1}map(e,t){let n=[],i=[],r=[],s=-1,o=-1;for(let l=0;l<this.value.length;l++){let a,c,h=this.value[l],u=this.from[l]+e,d=this.to[l]+e;if(u==d){let e=t.mapPos(u,h.startSide,h.mapMode);if(null==e)continue;if(a=c=e,h.startSide!=h.endSide&&(c=t.mapPos(u,h.endSide),c<a))continue}else if(a=t.mapPos(u,h.startSide),c=t.mapPos(d,h.endSide),a>c||a==c&&h.startSide>0&&h.endSide<=0)continue;(c-a||h.endSide-h.startSide)<0||(s<0&&(s=a),h.point&&(o=Math.max(o,c-a)),n.push(h),i.push(a-s),r.push(c-s))}return{mapped:n.length?new Tt(i,r,n,o):null,pos:s}}}class Ot{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new Ot(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:r=this.length}=e,s=e.filter;if(0==t.length&&!s)return this;if(n&&(t=t.slice().sort(Et)),this.isEmpty)return t.length?Ot.of(t):this;let o=new Dt(this,null,-1).goto(0),l=0,a=[],c=new Mt;for(;o.value||l<t.length;)if(l<t.length&&(o.from-t[l].from||o.startSide-t[l].value.startSide)>=0){let e=t[l++];c.addInner(e.from,e.to,e.value)||a.push(e)}else 1==o.rangeIndex&&o.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(o.chunkIndex)<t[l].from)&&(!s||i>this.chunkEnd(o.chunkIndex)||r<this.chunkPos[o.chunkIndex])&&c.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))&&(c.addInner(o.from,o.to,o.value)||a.push(St.create(o.from,o.to,o.value))),o.next());return c.finishInner(this.nextLayer.isEmpty&&!a.length?Ot.empty:this.nextLayer.update({add:a,filter:s,filterFrom:i,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1;for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r],l=e.touchesRange(s,s+o.length);if(!1===l)i=Math.max(i,o.maxPoint),t.push(o),n.push(e.mapPos(s));else if(!0===l){let{mapped:r,pos:l}=o.map(s,e);r&&(i=Math.max(i,r.maxPoint),t.push(r),n.push(l))}}let r=this.nextLayer.map(e);return 0==t.length?r:new Ot(n,t,r||Ot.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let r=this.chunkPos[i],s=this.chunk[i];if(t>=r&&e<=r+s.length&&!1===s.between(r,e-r,t-r,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return Rt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Rt.from(e).goto(t)}static compare(e,t,n,i,r=-1){let s=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r),o=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r),l=Bt(s,o,n),a=new Pt(s,l,r),c=new Pt(o,l,r);n.iterGaps((e,t,n)=>Nt(a,e,c,t,n,i)),n.empty&&0==n.length&&Nt(a,0,c,0,0,i)}static eq(e,t,n=0,i){null==i&&(i=999999999);let r=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),s=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(r.length!=s.length)return!1;if(!r.length)return!0;let o=Bt(r,s),l=new Pt(r,o,0).goto(n),a=new Pt(s,o,0).goto(n);for(;;){if(l.to!=a.to||!Lt(l.active,a.active)||l.point&&(!a.point||!_t(l.point,a.point)))return!1;if(l.to>i)return!0;l.next(),a.next()}}static spans(e,t,n,i,r=-1){let s=new Pt(e,null,r).goto(t),o=t,l=s.openStart;for(;;){let e=Math.min(s.to,n);if(s.point){let n=s.activeForPoint(s.to),r=s.pointFrom<t?n.length+1:s.point.startSide<0?n.length:Math.min(n.length,l);i.point(o,e,s.point,n,r,s.pointRank),l=Math.min(s.openEnd(e),n.length)}else e>o&&(i.span(o,e,s.active,l),l=s.openEnd(e));if(s.to>n)return l+(s.point&&s.to>n?1:0);o=s.to,s.next()}}static of(e,t=!1){let n=new Mt;for(let i of e instanceof St?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let i=e[n];if(Et(t,i)>0)return e.slice().sort(Et);t=i}return e}(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return Ot.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=Ot.empty;i=i.nextLayer)t=new Ot(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}Ot.empty=new Ot([],[],null,-1),Ot.empty.nextLayer=Ot.empty;class Mt{finishChunk(e){this.chunks.push(new Tt(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Mt)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),0))}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Ot.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=Ot.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Bt(e,t,n){let i=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&i.set(t.chunk[e],t.chunkPos[e]);let r=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let s=i.get(e.chunk[t]);null==s||(n?n.mapPos(s):s)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(s,s+e.chunk[t].length))||r.add(e.chunk[t])}return r}class Dt{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Rt{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let r=0;r<e.length;r++)for(let s=e[r];!s.isEmpty;s=s.nextLayer)s.maxPoint>=n&&i.push(new Dt(s,t,n,r));return 1==i.length?i[0]:new Rt(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)It(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)It(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),It(this.heap,0)}}}function It(e,t){for(let n=e[t];;){let i=1+(t<<1);if(i>=e.length)break;let r=e[i];if(i+1<e.length&&r.compare(e[i+1])>=0&&(r=e[i+1],i++),n.compare(r)<0)break;e[i]=n,e[t]=r,t=i}}class Pt{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Rt.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Ft(this.active,e),Ft(this.activeTo,e),Ft(this.activeRank,e),this.minActive=zt(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:r}=this.cursor;for(;t<this.activeRank.length&&(r-this.activeRank[t]||i-this.activeTo[t])>0;)t++;jt(this.active,t,n),jt(this.activeTo,t,i),jt(this.activeRank,t,r),e&&jt(e,t,this.cursor.from),this.minActive=zt(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&Ft(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Nt(e,t,n,i,r,s){e.goto(t),n.goto(i);let o=i+r,l=i,a=i-t,c=!!s.boundChange;for(let t=!1;;){let i=e.to+a-n.to,r=i||e.endSide-n.endSide,h=r<0?e.to+a:n.to,u=Math.min(h,o);if(e.point||n.point?(e.point&&n.point&&_t(e.point,n.point)&&Lt(e.activeForPoint(e.to),n.activeForPoint(n.to))||s.comparePoint(l,u,e.point,n.point),t=!1):(t&&s.boundChange(l),u>l&&!Lt(e.active,n.active)&&s.compareRange(l,u,e.active,n.active),c&&u<o&&(i||e.openEnd(h)!=n.openEnd(h))&&(t=!0)),h>o)break;l=h,r<=0&&e.next(),r>=0&&n.next()}}function Lt(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!_t(e[n],t[n]))return!1;return!0}function Ft(e,t){for(let n=t,i=e.length-1;n<i;n++)e[n]=e[n+1];e.pop()}function jt(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function zt(e,t){let n=-1,i=1e9;for(let r=0;r<t.length;r++)(t[r]-i||e[r].endSide-e[n].endSide)<0&&(n=r,i=t[r]);return n}function Vt(e,t,n=e.length){let i=0;for(let r=0;r<n&&r<e.length;)9==e.charCodeAt(r)?(i+=t-i%t,r++):(i++,r=ye(e,r));return i}const Wt="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Ht="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),qt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class $t{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function r(e,t,s,o){let l=[],a=/^@(\w+)\b/.exec(e[0]),c=a&&"keyframes"==a[1];if(a&&null==t)return s.push(e[0]+";");for(let n in t){let o=t[n];if(/&/.test(n))r(n.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),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,c)}else null!=o&&l.push(n.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+o+";")}(l.length||c)&&s.push((!n||a||o?e:e.map(n)).join(", ")+" {"+l.join(" ")+"}")}for(let t in e)r(i(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=qt[Wt]||1;return qt[Wt]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[Ht],r=n&&n.nonce;i?r&&i.setNonce(r):i=new Kt(e,r),i.mount(Array.isArray(t)?t:[t],e)}}let Ut=new Map;class Kt{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let t=Ut.get(n);if(t)return e[Ht]=t;this.sheet=new i.CSSStyleSheet,Ut.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Ht]=this}mount(e,t){let n=this.sheet,i=0,r=0;for(let t=0;t<e.length;t++){let s=e[t],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 e=0;e<s.rules.length;e++)n.insertRule(s.rules[e],i++)}else{for(;r<o;)i+=this.modules[r++].rules.length;i+=s.rules.length,r++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Gt={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:"'"},Yt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Jt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Qt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Xt=0;Xt<10;Xt++)Gt[48+Xt]=Gt[96+Xt]=String(Xt);for(Xt=1;Xt<=24;Xt++)Gt[Xt+111]="F"+Xt;for(Xt=65;Xt<=90;Xt++)Gt[Xt]=String.fromCharCode(Xt+32),Yt[Xt]=String.fromCharCode(Xt);for(var Zt in Gt)Yt.hasOwnProperty(Zt)||(Yt[Zt]=Gt[Zt]);let en="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},tn="undefined"!=typeof document?document:{documentElement:{style:{}}};const nn=/Edge\/(\d+)/.exec(en.userAgent),rn=/MSIE \d/.test(en.userAgent),sn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(en.userAgent),on=!!(rn||sn||nn),ln=!on&&/gecko\/(\d+)/i.test(en.userAgent),an=!on&&/Chrome\/(\d+)/.exec(en.userAgent),cn="webkitFontSmoothing"in tn.documentElement.style,hn=!on&&/Apple Computer/.test(en.vendor),un=hn&&(/Mobile\/\w+/.test(en.userAgent)||en.maxTouchPoints>2);var dn={mac:un||/Mac/.test(en.platform),windows:/Win/.test(en.platform),linux:/Linux|X11/.test(en.platform),ie:on,ie_version:rn?tn.documentMode||6:sn?+sn[1]:nn?+nn[1]:0,gecko:ln,gecko_version:ln?+(/Firefox\/(\d+)/.exec(en.userAgent)||[0,0])[1]:0,chrome:!!an,chrome_version:an?+an[1]:0,ios:un,android:/Android\b/.test(en.userAgent),webkit:cn,webkit_version:cn?+(/\bAppleWebKit\/(\d+)/.exec(en.userAgent)||[0,0])[1]:0,safari:hn,safari_version:hn?+(/\bVersion\/(\d+(\.\d+)?)/.exec(en.userAgent)||[0,0])[1]:0,tabSize:null!=tn.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function fn(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const pn=Object.create(null);function gn(e,t,n){if(e==t)return!0;e||(e=pn),t||(t=pn);let i=Object.keys(e),r=Object.keys(t);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let s of i)if(s!=n&&(-1==r.indexOf(s)||e[s]!==t[s]))return!1;return!0}function mn(e,t,n){let i=!1;if(t)for(let r in t)n&&r in n||(i=!0,"style"==r?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(i=!0,"style"==r?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return i}function An(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let i=e.attributes[n];t[i.name]=i.value}return t}class vn{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var bn=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(bn||(bn={}));class xn extends kt{constructor(e,t,n,i){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new yn(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Cn(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,i=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:r,end:s}=kn(e,i);t=(r?i?-3e8:-1:5e8)-1,n=1+(s?i?2e8:1:-6e8)}return new Cn(e,t,n,i,e.widget||null,!0)}static line(e){return new wn(e)}static set(e,t=!1){return Ot.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}xn.none=Ot.empty;class yn extends xn{constructor(e){let{start:t,end:n}=kn(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?fn(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||pn}eq(e){return this==e||e instanceof yn&&this.tagName==e.tagName&&gn(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}yn.prototype.point=!1;class wn extends xn{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof wn&&this.spec.class==e.spec.class&&gn(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}wn.prototype.mapMode=Se.TrackBefore,wn.prototype.point=!0;class Cn extends xn{constructor(e,t,n,i,r,s){super(t,n,r,e),this.block=i,this.isReplace=s,this.mapMode=i?t<=0?Se.TrackBefore:Se.TrackAfter:Se.TrackDel}get type(){return this.startSide!=this.endSide?bn.WidgetRange:this.startSide<=0?bn.WidgetBefore:bn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Cn&&((t=this.widget)==(n=e.widget)||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function kn(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;return null==n&&(n=e.inclusive),null==i&&(i=e.inclusive),{start:null!=n?n:t,end:null!=i?i:t}}function _n(e,t,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=e?n[r]=Math.max(n[r],t):n.push(e,t)}Cn.prototype.point=!0;class Sn extends kt{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof Sn&&this.tagName==e.tagName&&gn(this.attributes,e.attributes)}static create(e){return new Sn(e.tagName,e.attributes||pn)}static set(e,t=!1){return Ot.of(e,t)}}function En(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Tn(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function On(e,t){if(!t.anchorNode)return!1;try{return Tn(e,t.anchorNode)}catch(e){return!1}}function Mn(e){return 3==e.nodeType?qn(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function Bn(e,t,n,i){return!!n&&(In(e,t,n,i,-1)||In(e,t,n,i,1))}function Dn(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function Rn(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function In(e,t,n,i,r){for(;;){if(e==n&&t==i)return!0;if(t==(r<0?0:Pn(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=Dn(e)+(r<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(r<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=r<0?Pn(e):0}}}function Pn(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Nn(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function Ln(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Fn(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}function jn(e,t=!0){let n=e.ownerDocument,i=null,r=null;for(let s=e.parentNode;s&&s!=n.body&&(t&&!i||!r);)if(1==s.nodeType)!r&&s.scrollHeight>s.clientHeight&&(r=s),t&&!i&&s.scrollWidth>s.clientWidth&&(i=s),s=s.assignedSlot||s.parentNode;else{if(11!=s.nodeType)break;s=s.host}return{x:i,y:r}}Sn.prototype.startSide=Sn.prototype.endSide=-1;class zn{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?Pn(t):0),n,Math.min(e.focusOffset,n?Pn(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let Vn,Wn=null;function Hn(e){if(e.setActive)return e.setActive();if(Wn)return e.focus(Wn);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==Wn?{get preventScroll(){return Wn={preventScroll:!0},!0}}:void 0),!Wn){Wn=!1;for(let e=0;e<t.length;){let n=t[e++],i=t[e++],r=t[e++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}}}function qn(e,t,n=t){let i=Vn||(Vn=document.createRange());return i.setEnd(e,n),i.setStart(e,t),i}function $n(e,t,n,i){let r={key:t,code:t,keyCode:n,which:n,cancelable:!0};i&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let s=new KeyboardEvent("keydown",r);s.synthetic=!0,e.dispatchEvent(s);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,e.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function Un(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Kn(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i>0)return{node:n,offset:i};if(1==n.nodeType&&i>0){if("false"==n.contentEditable)return null;n=n.childNodes[i-1],i=Pn(n)}else{if(!n.parentNode||Rn(n))return null;i=Dn(n),n=n.parentNode}}}function Gn(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i<n.nodeValue.length)return{node:n,offset:i};if(1==n.nodeType&&i<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[i],i=0}else{if(!n.parentNode||Rn(n))return null;i=Dn(n)+1,n=n.parentNode}}}dn.safari&&dn.safari_version>=26&&(Wn=!1);class Yn{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Yn(e.parentNode,Dn(e),t)}static after(e,t){return new Yn(e.parentNode,Dn(e)+1,t)}}var Jn=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Jn||(Jn={}));const Qn=Jn.LTR,Xn=Jn.RTL;function Zn(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const ei=Zn("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),ti=Zn("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ni=Object.create(null),ii=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);ni[t]=n,ni[n]=-t}function ri(e){return e<=247?ei[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?ti[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const si=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class oi{get dir(){return this.level%2?Xn:Qn}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,i){let r=-1;for(let s=0;s<e.length;s++){let o=e[s];if(o.from<=t&&o.to>=t){if(o.level==n)return s;(r<0||(0!=i?i<0?o.from<t:o.to>t:e[r].level>o.level))&&(r=s)}}if(r<0)throw new RangeError("Index out of range");return r}}function li(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!li(i.inner,r.inner))return!1}return!0}const ai=[];function ci(e,t,n,i,r,s,o){let l=i%2?2:1;if(i%2==r%2)for(let a=t,c=0;a<n;){let t=!0,h=!1;if(c==s.length||a<s[c].from){let e=ai[a];e!=l&&(t=!1,h=16==e)}let u=t||1!=l?null:[],d=t?i:i+1,f=a;e:for(;;)if(c<s.length&&f==s[c].from){if(h)break e;let p=s[c];if(!t)for(let e=p.to,t=c+1;;){if(e==n)break e;if(!(t<s.length&&s[t].from==e)){if(ai[e]==l)break e;break}e=s[t++].to}c++,u?u.push(p):(p.from>a&&o.push(new oi(a,p.from,d)),hi(e,p.direction==Qn!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,o),a=p.to),f=p.to}else{if(f==n||(t?ai[f]!=l:ai[f]==l))break;f++}u?ci(e,a,f,i+1,r,u,o):a<f&&o.push(new oi(a,f,d)),a=f}else for(let a=n,c=s.length;a>t;){let n=!0,h=!1;if(!c||a>s[c-1].to){let e=ai[a-1];e!=l&&(n=!1,h=16==e)}let u=n||1!=l?null:[],d=n?i:i+1,f=a;e:for(;;)if(c&&f==s[c-1].to){if(h)break e;let p=s[--c];if(!n)for(let e=p.from,n=c;;){if(e==t)break e;if(!n||s[n-1].to!=e){if(ai[e-1]==l)break e;break}e=s[--n].from}u?u.push(p):(p.to<a&&o.push(new oi(p.to,a,d)),hi(e,p.direction==Qn!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,o),a=p.from),f=p.from}else{if(f==t||(n?ai[f-1]!=l:ai[f-1]==l))break;f--}u?ci(e,f,a,i+1,r,u,o):f<a&&o.push(new oi(f,a,d)),a=f}}function hi(e,t,n,i,r,s,o){let l=t%2?2:1;!function(e,t,n,i,r){for(let s=0;s<=i.length;s++){let o=s?i[s-1].to:t,l=s<i.length?i[s].from:n,a=s?256:r;for(let t=o,n=a,i=a;t<l;t++){let r=ri(e.charCodeAt(t));512==r?r=n:8==r&&4==i&&(r=16),ai[t]=4==r?2:r,7&r&&(i=r),n=r}for(let e=o,t=a,i=a;e<l;e++){let r=ai[e];if(128==r)e<l-1&&t==ai[e+1]&&24&t?r=ai[e]=t:ai[e]=256;else if(64==r){let r=e+1;for(;r<l&&64==ai[r];)r++;let s=e&&8==t||r<n&&8==ai[r]?1==i?1:8:256;for(let t=e;t<r;t++)ai[t]=s;e=r-1}else 8==r&&1==i&&(ai[e]=1);t=r,7&r&&(i=r)}}}(e,r,s,i,l),function(e,t,n,i,r){let s=1==r?2:1;for(let o=0,l=0,a=0;o<=i.length;o++){let c=o?i[o-1].to:t,h=o<i.length?i[o].from:n;for(let t,n,i,o=c;o<h;o++)if(n=ni[t=e.charCodeAt(o)])if(n<0){for(let e=l-3;e>=0;e-=3)if(ii[e+1]==-n){let t=ii[e+2],n=2&t?r:4&t?1&t?s:r:0;n&&(ai[o]=ai[ii[e]]=n),l=e;break}}else{if(189==ii.length)break;ii[l++]=o,ii[l++]=t,ii[l++]=a}else if(2==(i=ai[o])||1==i){let e=i==r;a=e?0:1;for(let t=l-3;t>=0;t-=3){let n=ii[t+2];if(2&n)break;if(e)ii[t+2]|=2;else{if(4&n)break;ii[t+2]|=4}}}}}(e,r,s,i,l),function(e,t,n,i){for(let r=0,s=i;r<=n.length;r++){let o=r?n[r-1].to:e,l=r<n.length?n[r].from:t;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:t}else{if(256!=ai[o])break;o++}let c=1==s,h=c==(1==(o<t?ai[o]:i))?c?1:2:i;for(let t=o,i=r,s=i?n[i-1].to:e;t>a;)t==s&&(t=n[--i].from,s=i?n[i-1].to:e),ai[--t]=h;a=o}else s=o,a++}}}(r,s,i,l),ci(e,r,s,t,n,i,o)}function ui(e){return[new oi(0,e,0)]}let di="";function fi(e,t,n,i,r){var s;let o=i.head-e.from,l=oi.find(t,o,null!==(s=i.bidiLevel)&&void 0!==s?s:-1,i.assoc),a=t[l],c=a.side(r,n);if(o==c){let e=l+=r?1:-1;if(e<0||e>=t.length)return null;a=t[l=e],o=a.side(!r,n),c=a.side(r,n)}let h=ye(e.text,o,a.forward(r,n));(h<a.from||h>a.to)&&(h=c),di=e.text.slice(Math.min(o,h),Math.max(o,h));let u=l==(r?t.length-1:0)?null:t[l+(r?1:-1)];return u&&h==c&&u.level+(r?0:1)<a.level?Ne.cursor(u.side(!r,n)+e.from,u.forward(r,n)?1:-1,u.level):Ne.cursor(h+e.from,a.forward(r,n)?-1:1,a.level)}function pi(e,t,n){for(let i=t;i<n;i++){let t=ri(e.charCodeAt(i));if(1==t)return Qn;if(2==t||4==t)return Xn}return Qn}const gi=je.define(),mi=je.define(),Ai=je.define(),vi=je.define(),bi=je.define(),xi=je.define(),yi=je.define(),wi=je.define(),Ci=je.define(),ki=je.define({combine:e=>e.some(e=>e)}),_i=je.define({combine:e=>e.some(e=>e)}),Si=je.define();class Ei{constructor(e,t="nearest",n="nearest",i=5,r=5,s=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=r,this.isSnapshot=s}map(e){return e.empty?this:new Ei(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Ei(Ne.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Ti=ut.define({map:(e,t)=>e.map(t)}),Oi=ut.define();function Mi(e,t,n){let i=e.facet(vi);i.length?i[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const Bi=je.define({combine:e=>!e.length||e[0]});let Di=0;const Ri=je.define({combine:e=>e.filter((t,n)=>{for(let i=0;i<n;i++)if(e[i].plugin==t.plugin)return!1;return!0})});class Ii{constructor(e,t,n,i,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(Ri.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Ri.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:r,decorations:s}=t||{};return new Ii(Di++,e,n,i,e=>{let t=[];return s&&t.push(Fi.of(t=>{let n=t.plugin(e);return n?s(n):xn.none})),r&&t.push(r(e)),t})}static fromClass(e,t){return Ii.define((t,n)=>new e(t,n),t)}}class Pi{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(Mi(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Mi(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){Mi(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Ni=je.define(),Li=je.define(),Fi=je.define(),ji=je.define(),zi=je.define(),Vi=je.define(),Wi=je.define();function Hi(e,t){let n=e.state.facet(Wi);if(!n.length)return n;let i=n.map(t=>t instanceof Function?t(e):t),r=[];return Ot.spans(i,t.from,t.to,{point(){},span(e,n,i,s){let o=e-t.from,l=n-t.from,a=r;for(let e=i.length-1;e>=0;e--,s--){let n,r=i[e].spec.bidiIsolate;if(null==r&&(r=pi(t.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 e={from:o,to:l,direction:r,inner:[]};a.push(e),a=e.inner}}}}),r}const qi=je.define();function $i(e){let t=0,n=0,i=0,r=0;for(let s of e.state.facet(qi)){let o=s(e);o&&(null!=o.left&&(t=Math.max(t,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:t,right:n,top:i,bottom:r}}const Ui=je.define();class Ki{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new Ki(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let i=0,r=0,s=0;;){let o=i<e.length?e[i].fromB:1e9,l=r<t.length?t[r]:1e9,a=Math.min(o,l);if(1e9==a)break;let c=a+s,h=a,u=c;for(;;)if(r<t.length&&t[r]<=h){let n=t[r+1];r+=2,h=Math.max(h,n);for(let t=i;t<e.length&&e[t].fromB<=h;t++)s=e[t].toA-e[t].toB;u=Math.max(u,n+s)}else{if(!(i<e.length&&e[i].fromB<=h))break;{let t=e[i++];h=Math.max(h,t.toB),u=Math.max(u,t.toA),s=t.toA-t.toB}}n.push(new Ki(c,u,a,h))}return n}}class Gi{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Te.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let i=[];this.changes.iterChangedRanges((e,t,n,r)=>i.push(new Ki(e,t,n,r))),this.changedRanges=i}static create(e,t,n){return new Gi(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}const Yi=[];class Ji{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return Yi}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,4&this.flags){this.flags&=-5;let e=this.domAttrs;e&&function(e,t){for(let n=e.attributes.length-1;n>=0;n--){let i=e.attributes[n].name;null==t[i]&&e.removeAttribute(i)}for(let n in t){let i=t[n];"style"==n?e.style.cssText=i:e.getAttribute(n)!=i&&e.setAttribute(n,i)}}(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=Dn(this.dom),i=this.length?e>0:t>0;return new Yn(this.parent.dom,n+(i?1:0),0==e||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Zi)return e;return null}static get(e){return e.cmTile}}class Qi extends Ji{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(2&this.flags)return;super.sync(e);let t,n=this.dom,i=null,r=(null==e?void 0:e.node)==n?e:null,s=0;for(let o of this.children){if(o.sync(e),s+=o.length+o.breakAfter,t=i?i.nextSibling:n.firstChild,r&&t!=o.dom&&(r.written=!0),o.dom.parentNode==n)for(;t&&t!=o.dom;)t=Xi(t);else n.insertBefore(o.dom,t);i=o.dom}for(t=i?i.nextSibling:n.firstChild,r&&t&&(r.written=!0);t;)t=Xi(t);this.length=s}}function Xi(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class Zi extends Qi{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Ji.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,i=0,r=0;;)if(i==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&r++,i=t.pop()}else{let s=n.children[i++];if(s instanceof er)t.push(i),n=s,i=0;else{let t=r+s.length,n=e(s,r);if(void 0!==n)return n;r=t+s.breakAfter}}}resolveBlock(e,t){let n,i,r=-1,s=-1;if(this.blockTiles((o,l)=>{let a=l+o.length;if(e>=l&&e<=a){if(o.isWidget()&&t>=-1&&t<=1){if(32&o.flags)return!0;16&o.flags&&(n=void 0)}(l<e||e==a&&(t<-1?o.length:o.covers(1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=e-l),(a>e||e==l&&(t>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,s=e-l)}}),!n&&!i)throw new Error("No tile at position "+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:s}}}class er extends Qi{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return!!this.children.length&&(e<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new er(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class tr extends Qi{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let i=new tr(t||document.createElement("div"),e);return t&&n||(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n){let i=null,r=-1,s=null,o=-1;!function e(l,a){for(let c=0,h=0;c<l.children.length&&h<=a;c++){let u=l.children[c],d=h+u.length;d>=a&&(u.isComposite()?e(u,a-h):(!s||s.isHidden&&(t>0||n&&nr(s,u)))&&(d>a||32&u.flags)?(s=u,o=a-h):(h<a||16&u.flags&&!u.isHidden)&&(i=u,r=a-h)),h=d}}(this,e);let l=(t<0?i:s)||i||s;return l?{tile:l,offset:l==i?r:o}:null}coordsIn(e,t){let n=this.resolveInline(e,t,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),t):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Mn(t);return n[n.length-1]||null}(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:i}=n;if(this.dom.contains(e.dom))return e.isText()?new Yn(e.dom,Math.min(e.dom.nodeValue.length,i)):e.domPosFor(i,16&e.flags?1:32&e.flags?-1:t);let r=n.tile.parent,s=!1;for(let e of r.children){if(s)return new Yn(e.dom,0);e==n.tile&&(s=!0)}}return new Yn(this.dom,0)}}function nr(e,t){let n=e.coordsIn(0,1),i=t.coordsIn(0,1);return n&&i&&i.top<n.bottom}class ir extends Qi{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new ir(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class rr extends Ji{constructor(e,t){super(e,t.length),this.text=t}sync(e){2&this.flags||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let n=this.dom.nodeValue.length;e>n&&(e=n);let i=e,r=e,s=0;0==e&&t<0||e==n&&t>=0?dn.chrome||dn.gecko||(e?(i--,s=1):r<n&&(r++,s=-1)):t<0?i--:r<n&&r++;let o=qn(this.dom,i,r).getClientRects();if(!o.length)return null;let l=o[(s?s<0:t>=0)?0:o.length-1];return dn.safari&&!s&&0==l.width&&(l=Array.prototype.find.call(o,e=>e.width)||l),s?Nn(l,s<0):l||null}static of(e,t){let n=new rr(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class sr extends Ji{constructor(e,t,n,i){super(e,t,i),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return!(48&this.flags)&&(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(n)return Nn(this.dom.getBoundingClientRect(),this.length?0==e:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let i=!!(16&this.flags)||!(32&this.flags)&&e>0;for(let r=i?t.length-1:0;n=t[r],!(e>0?0==r:r==t.length-1||n.top<n.bottom);r+=i?-1:1);return Nn(n,!i)}}get overrideDOMText(){if(!this.length)return ue.empty;let{root:e}=this;if(!e)return ue.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,i,r){return r||(r=e.toDOM(t),e.editable||(r.contentEditable="false")),new sr(r,n,e,i)}}class or extends Ji{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return ue.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class lr{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:i,index:r,beforeBreak:s,parents:o}=this;for(;e||t>0;)if(i.isComposite())if(s){if(!e)break;n&&n.break(),e--,s=!1}else if(r==i.children.length){if(!e&&!o.length)break;n&&n.leave(i),s=!!i.breakAfter,({tile:i,index:r}=o.pop()),r++}else{let l=i.children[r],a=l.breakAfter;!(t>0?l.length<=e:l.length<e)||n&&!1===n.skip(l,0,l.length)&&l.isComposite?(o.push({tile:i,index:r}),i=l,r=0,n&&l.isComposite()&&n.enter(l)):(s=!!a,r++,e-=l.length)}else if(r==i.length)s=!!i.breakAfter,({tile:i,index:r}=o.pop()),r++;else{if(!e)break;{let t=Math.min(e,i.length-r);n&&n.skip(i,r,r+t),e-=t,r+=t}}return this.tile=i,this.index=r,this.beforeBreak=s,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class ar{constructor(e,t,n,i){this.from=e,this.to=t,this.wrapper=n,this.rank=i}}class cr{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,i){var r;this.flushBuffer();let s=this.ensureMarks(t,n),o=s.lastChild;o&&o.isText()&&!(8&o.flags)&&o.length+e.length<512?(this.cache.reused.set(o,2),(s.children[s.children.length-1]=new rr(o.dom,o.text+e)).parent=s):s.append(i||rr.of(e,null===(r=this.cache.find(rr))||void 0===r?void 0:r.dom)),this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?mr(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let i=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],r=i.lastChild;if(r instanceof ir&&r.mark.eq(n.mark))r.dom!=n.dom&&r.setDOM(mr(n.dom)),i=r;else{if(this.cache.reused.get(n)){let e=Ji.get(n.dom);e&&e.setDOM(mr(n.dom))}let e=ir.of(n.mark,n.dom);i.append(e),i=e}this.cache.reused.set(n,2)}let r=Ji.get(e.text);r&&this.cache.reused.set(r,2);let s=new rr(e.text,e.text.nodeValue);s.flags|=8,i.append(s)}addInlineWidget(e,t,n){let i=this.afterWidget&&48&e.flags&&(48&this.afterWidget.flags)==(48&e.flags);i||this.flushBuffer();let r=this.ensureMarks(t,n);i||16&e.flags||r.append(this.getBuffer(1)),r.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){(this.afterWidget||this.lastBlock).length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=gr);let i=tr.start(e,t||(null===(n=this.cache.find(tr))||void 0===n?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let i=this.curLine;for(let r=e.length-1;r>=0;r--){let s,o=e[r];if(t>0&&(s=i.lastChild)&&s instanceof ir&&s.mark.eq(o))i=s,t--;else{let e=ir.of(o,null===(n=this.cache.find(ir,e=>e.mark.eq(o)))||void 0===n?void 0:n.dom);i.append(e),i=e,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;e&&pr(this.curLine,!1)&&("BR"==e.dom.nodeName||!e.isWidget()||dn.ios&&pr(this.curLine,!0))||this.curLine.append(this.cache.findWidget(vr,0,32)||new sr(vr.toDOM(),0,vr,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=new ar(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-t.rank||this.wrappers[n-1].to-t.to)<0;)n--;this.wrappers.splice(n,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let i=t.lastChild;if(n.from<this.pos&&i instanceof er&&i.wrapper.eq(n.wrapper))t=i;else{let i=er.of(n.wrapper,null===(e=this.cache.find(er,e=>e.wrapper.eq(n.wrapper)))||void 0===e?void 0:e.dom);t.append(i),t=i}}return t}blockPosCovered(){let e=this.lastBlock;return null!=e&&!e.breakAfter&&(!e.isWidget()||(160&e.flags)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(or,void 0,1);return n&&(n.flags=t),n||new or(t)}flushBuffer(){!this.afterWidget||32&this.afterWidget.flags||(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class hr{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:i}=this.cursor.next(this.skipCount);if(this.skipCount=0,i)throw new Error("Ran out of text content when drawing inline views");this.text=t;let r=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,r)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}const ur=[sr,tr,rr,ir,or,er,Zi];for(let e=0;e<ur.length;e++)ur[e].bucket=e;class dr{constructor(e){this.view=e,this.buckets=ur.map(()=>[]),this.index=ur.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let i=e.bucket,r=this.buckets[i],s=this.index[i];for(let e=r.length-1;e>=0;e--){let o=(e+s)%r.length,l=r[o];if((!t||t(l))&&!this.reused.has(l))return r.splice(o,1),o<s&&this.index[i]--,this.reused.set(l,n),l}return null}findWidget(e,t,n){let i=this.buckets[0];if(i.length)for(let r=0,s=0;;r++){if(r==i.length){if(s)return null;s=1,r=0}let o=i[r];if(!this.reused.has(o)&&(0==s?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view)))return i.splice(r,1),r<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(497&o.flags)==n?(this.reused.set(o,1),o):(this.reused.set(o,2),new sr(o.dom,t,e,-498&o.flags|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class fr{constructor(e,t,n,i,r){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=r,this.openWidget=!1,this.openMarks=0,this.cache=new dr(e),this.text=new hr(e.state.doc),this.builder=new cr(this.cache,new Zi(e,e.contentDOM),Ot.iter(n)),this.cache.reused.set(t,2),this.old=new lr(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let i=0,r=0,s=0;;){let o=s<e.length?e[s++]:null,l=o?o.fromA:this.old.root.length;if(l>i){let e=l-i;this.preserve(e,!s,!o),i=l,r+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(r,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(r,o.toB)),r=o.toB,i=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let i=function(e){let t=[];for(let n=e.parents.length;n>1;n--){let i=n==e.parents.length?e.tile:e.parents[n].tile;i instanceof ir&&t.push(i.mark)}return t}(this.old),r=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget())if(this.openWidget)this.builder.continueWidget(n-t);else{let s=n>0||t<e.length?sr.of(e.widget,this.view,n-t,496&e.flags,this.cache.maybeReuse(e)):this.cache.reuse(e);256&s.flags?(s.flags&=-2,this.builder.addBlockWidget(s)):(this.builder.ensureLine(null),this.builder.addInlineWidget(s,i,r),r=i.length)}else if(e.isText())this.builder.ensureLine(null),t||n!=e.length||this.cache.reused.has(e)?(this.cache.add(e),this.builder.addText(e.text.slice(t,n),i,r)):this.builder.addText(e.text,i,r,this.cache.reuse(e)),r=i.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof or)this.cache.add(e);else{if(!(e instanceof ir))return!1;this.builder.ensureLine(null),this.builder.addMark(e,i,r),this.cache.reused.set(e,1),r=i.length}this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof ir&&i.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?i.length&&(i.length=r=0):e instanceof ir&&(i.shift(),r=Math.min(r,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,i=this.builder,r=0,s=Ot.spans(this.decorations,e,t,{point:(e,t,s,o,l,a)=>{if(s instanceof Cn){if(this.disallowBlockEffectsFor[a]){if(s.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.view.state.doc.lineAt(e).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=o.length,l>o.length)i.continueWidget(t-e);else{let r=s.widget||(s.block?Ar.block:Ar.inline),a=function(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}(s),c=this.cache.findWidget(r,t-e,a)||sr.of(r,this.view,t-e,a);s.block?(s.startSide>0&&i.addLineStartIfNotCovered(n),i.addBlockWidget(c)):(i.ensureLine(n),i.addInlineWidget(c,o,l))}n=null}else n=function(e,t){let n=t.spec.attributes,i=t.spec.class;return n||i?(e||(e={class:"cm-line"}),n&&fn(n,e),i&&(e.class+=" "+i),e):e}(n,s);t>e&&this.text.skip(t-e)},span:(e,t,r,s)=>{for(let o=e;o<t;){let l=this.text.next(Math.min(512,t-o));null==l?(i.addLineStartIfNotCovered(n),i.addBreak(),o++):(i.ensureLine(n),i.addText(l,r,o==e?s:r.length),o+=l.length),n=null}}});i.addLineStartIfNotCovered(n),this.openWidget=s>r,this.openMarks=s}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let i=e.parentNode;;i=i.parentNode){let e=Ji.get(i);if(i==this.view.contentDOM)break;e instanceof ir?t.push(e):(null==e?void 0:e.isLine())?n=e:e instanceof er||("DIV"!=i.nodeName||n||i==this.view.contentDOM?n||t.push(ir.of(new yn({tagName:i.nodeName.toLowerCase(),attributes:An(i)}),i)):n=new tr(i,gr))}return{line:n,marks:t}}}function pr(e,t){let n=e=>{for(let i of e.children)if((t?i.isText():i.length)||n(i))return!0;return!1};return n(e)}const gr={class:"cm-line"};function mr(e){let t=Ji.get(e);return t&&t.setDOM(e.cloneNode()),e}class Ar extends vn{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Ar.inline=new Ar("span"),Ar.block=new Ar("div");const vr=new class extends vn{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class br{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=xn.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.updateDeco(),this.tile=new Zi(e,e.contentDOM),this.updateInner([new Ki(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?i=this.domChanged.newSel.head:function(e,t){let n=!1;return t&&e.iterChangedRanges((e,i)=>{e<t.to&&i>t.from&&(n=!0)}),n}(e.changes,this.hasComposition)||e.selectionSet||(i=e.state.selection.main.head));let r=i>-1?function(e,t,n){let i=yr(e,n);if(!i)return null;let{node:r,from:s,to:o}=i,l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(e.state.doc.sliceString(i.from,i.to)!=l)return null;let a=t.invertedDesc;return{range:new Ki(a.mapPos(s),a.mapPos(o),s,o),text:r}}(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:t,to:i}=this.hasComposition;n=new Ki(t,i,e.changes.mapPos(t,-1),e.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(dn.ie||dn.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,o=this.blockWrappers;this.updateDeco();let l=function(e,t,n){let i=new wr;return Ot.compare(e,t,n,i),i.changes}(s,this.decorations,e.changes);l.length&&(n=Ki.extendWithRanges(n,l));let a=function(e,t,n){let i=new Cr;return Ot.compare(e,t,n,i),i.changes}(o,this.blockWrappers,e.changes);return a.length&&(n=Ki.extendWithRanges(n,a)),r&&!n.some(e=>e.fromA<=r.range.fromA&&e.toA>=r.range.toA)&&(n=r.range.addToSet(n.slice())),!(2&this.tile.flags&&0==n.length||(this.updateInner(n,r),e.transactions.length&&(this.lastUpdate=Date.now()),0))}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,i=new fr(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Ji.get(t.text)&&i.cache.reused.set(Ji.get(t.text),2),this.tile=i.run(e,t),xr(n,i.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let i=dn.chrome||dn.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),!i||!i.written&&n.selectionRange.focusNode==i.node&&this.tile.dom.contains(i.node)||(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof kr&&i.push(e.dom);n.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(Oi)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let{dom:n}=this.tile,i=this.view.root.activeElement,r=i==n,s=!r&&!(this.view.state.facet(Bi)||n.tabIndex>-1)&&On(n,this.view.observer.selectionRange)&&!(i&&n.contains(i));if(!(r||t||s))return;let o=this.forceSelection;this.forceSelection=!1;let l,a,c=this.view.state.selection.main;if(c.empty?a=l=this.inlineDOMNearPos(c.anchor,c.assoc||1):(a=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),l=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),dn.gecko&&c.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 e=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(e,l.node.childNodes[l.offset]||null)),l=a=new Yn(e,0),o=!0}var h;let u=this.view.observer.selectionRange;!o&&u.focusNode&&(Bn(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Bn(a.node,a.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,c))||(this.view.observer.ignore(()=>{dn.android&&dn.chrome&&n.contains(u.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=En(this.view.root);if(e)if(c.empty){if(dn.gecko){let e=(t=l.node,r=l.offset,1!=t.nodeType?0:(r&&"false"==t.childNodes[r-1].contentEditable?1:0)|(r<t.childNodes.length&&"false"==t.childNodes[r].contentEditable?2:0));if(e&&3!=e){let t=(1==e?Kn:Gn)(l.node,l.offset);t&&(l=new Yn(t.node,t.offset))}}e.collapse(l.node,l.offset),null!=c.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=c.bidiLevel)}else if(e.extend){e.collapse(l.node,l.offset);try{e.extend(a.node,a.offset)}catch(e){}}else{let t=document.createRange();c.anchor>c.head&&([l,a]=[a,l]),t.setEnd(a.node,a.offset),t.setStart(l.node,l.offset),e.removeAllRanges(),e.addRange(t)}var t,r;s&&this.view.root.activeElement==n&&(n.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(l,a)),this.impreciseAnchor=l.precise?null:new Yn(u.anchorNode,u.anchorOffset),this.impreciseHead=a.precise?null:new Yn(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Bn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=En(e.root),{anchorNode:i,anchorOffset:r}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let s=this.lineAt(t.head,t.assoc);if(!s)return;let o=s.posAtStart;if(t.head==o||t.head==o+s.length)return;let l=this.coordsAt(t.head,-1),a=this.coordsAt(t.head,1);if(!l||!a||l.bottom>a.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(i,r)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return 2&this.tile.dom.compareDocumentPosition(e)?0:this.view.state.doc.length;let i=n.posAtStart;if(!n.isComposite())return n.isText()?e==n.dom?i+t:i+(t?n.length:0):i;{let r;if(e==n.dom)r=n.dom.childNodes[t];else{let i=0==Pn(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;0==i&&t.firstChild!=t.lastChild&&(i=e==t.firstChild?-1:1),e=t}r=i<0?e:e.nextSibling}if(r==n.dom.firstChild)return i;for(;r&&!Ji.get(r);)r=r.nextSibling;if(!r)return i+n.length;for(let e=0,t=i;;e++){let i=n.children[e];if(i.dom==r)return t;t+=i.length+i.breakAfter}}}domAtPos(e,t){let{tile:n,offset:i}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(i,t)}inlineDOMNearPos(e,t){let n,i,r=-1,s=!1,o=-1,l=!1;return this.tile.blockTiles((t,a)=>{if(t.isWidget()){if(32&t.flags&&a>=e)return!0;16&t.flags&&(s=!0)}else{let c=a+t.length;if(a<=e&&(n=t,r=e-a,s=c<e),c>=e&&!i&&(i=t,o=e-a,l=a>e),a>e&&i)return!0}}),n||i?(s&&i?n=null:l&&n&&(i=null),n&&t<0||!i?n.domIn(r,t):i.domIn(o,t)):this.domAtPos(e,t)}coordsAt(e,t){let{tile:n,offset:i}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof kr?null:n.coordsInWidget(i,t,!0):n.coordsIn(i,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);return t.isLine()?function e(t,n){if(t.isComposite())for(let i of t.children){if(i.length>=n){let t=e(i,n);if(t)return t}if((n-=i.length)<0)break}else if(t.isText()&&n<t.length){let e=ye(t.text,n);if(e==n)return null;let i=qn(t.dom,n,e).getClientRects();for(let e=0;e<i.length;e++){let t=i[e];if(e==i.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}(t,n):null}measureVisibleLineHeights(e){let t=[],{from:n,to:i}=e,r=this.view.contentDOM.clientWidth,s=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,l=this.view.textDirection==Jn.LTR,a=0,c=(e,h,u)=>{for(let d=0;d<e.children.length&&!(h>i);d++){let i=e.children[d],f=h+i.length,p=i.dom.getBoundingClientRect(),{height:g}=p;if(u&&!d&&(a+=p.top-u.top),i instanceof er)f>n&&c(i,h,p);else if(h>=n&&(a>0&&t.push(-a),t.push(g+a),a=0,s)){let e=i.dom.lastChild,t=e?Mn(e):[];if(t.length){let e=t[t.length-1],n=l?e.right-p.left:p.right-e.left;n>o&&(o=n,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=f)}}u&&d==e.children.length-1&&(a+=u.bottom-p.bottom),h=f+i.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return"rtl"==getComputedStyle(t.dom).direction?Jn.RTL:Jn.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t,n=0;for(let i of e.children){if(!i.isText()||/[^ -~]/.test(i.text))return;let e=Mn(i.dom);if(1!=e.length)return;n+=e[0].width,t=e[0].height}if(n)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:n/e.length,textHeight:t}}});if(e)return e;let t,n,i,r=document.createElement("div");return r.className="cm-line",r.style.width="99999px",r.style.position="absolute",r.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(r);let e=Mn(r.firstChild)[0];t=r.getBoundingClientRect().height,n=e&&e.width?e.width/27:7,i=e&&e.height?e.height:t,r.remove()}),{lineHeight:t,charWidth:n,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let r=i==t.viewports.length?null:t.viewports[i],s=r?r.from-1:this.view.state.doc.length;if(s>n){let i=(t.lineBlockAt(s).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(xn.replace({widget:new kr(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!r)break;n=r.to+1}return xn.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Fi).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),n=!1,i=this.view.state.facet(zi).map((e,t)=>{let i="function"==typeof e;return i&&(n=!0),i?e(this.view):e});for(i.length&&(this.dynamicDecorationMap[e++]=n,t.push(Ot.join(i))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(ji).map(e=>"function"==typeof e?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);return this.view.scrollDOM.scrollTop=t.top-e.yMargin,void(this.view.scrollDOM.scrollLeft=e.xMargin)}for(let t of this.view.state.facet(Si))try{if(t(this.view,e.range,e))return!0}catch(e){Mi(this.view.state,e,"scroll handler")}let t,{range:n}=e,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(!i)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,t.left),top:Math.min(i.top,t.top),right:Math.max(i.right,t.right),bottom:Math.max(i.bottom,t.bottom)});let r=$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;if(function(e,t,n,i,r,s,o,l){let a=e.ownerDocument,c=a.defaultView||window;for(let h=e,u=!1;h&&!u;)if(1==h.nodeType){let e,d=h==a.body,f=1,p=1;if(d)e=Ln(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let t=h.getBoundingClientRect();({scaleX:f,scaleY:p}=Fn(h,t)),e={left:t.left,right:t.left+h.clientWidth*f,top:t.top,bottom:t.top+h.clientHeight*p}}let g=0,m=0;if("nearest"==r)t.top<e.top?(m=t.top-(e.top+o),n>0&&t.bottom>e.bottom+m&&(m=t.bottom-e.bottom+o)):t.bottom>e.bottom&&(m=t.bottom-e.bottom+o,n<0&&t.top-m<e.top&&(m=t.top-(e.top+o)));else{let i=t.bottom-t.top,s=e.bottom-e.top;m=("center"==r&&i<=s?t.top+i/2-s/2:"start"==r||"center"==r&&n<0?t.top-o:t.bottom-s+o)-e.top}if("nearest"==i?t.left<e.left?(g=t.left-(e.left+s),n>0&&t.right>e.right+g&&(g=t.right-e.right+s)):t.right>e.right&&(g=t.right-e.right+s,n<0&&t.left<e.left+g&&(g=t.left-(e.left+s))):g=("center"==i?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==i==l?t.left-s:t.right-(e.right-e.left)+s)-e.left,g||m)if(d)c.scrollBy(g,m);else{let e=0,n=0;if(m){let e=h.scrollTop;h.scrollTop+=m/p,n=(h.scrollTop-e)*p}if(g){let t=h.scrollLeft;h.scrollLeft+=g/f,e=(h.scrollLeft-t)*f}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-g)<1&&(i="nearest"),n&&Math.abs(n-m)<1&&(r="nearest")}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}(this.view.scrollDOM,s,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,o),-o),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==Jn.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(n.head,1);e&&e.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){xr(this.tile)}}function xr(e,t){let n=null==t?void 0:t.get(e);if(1!=n){null==n&&e.destroy();for(let n of e.children)xr(n,t)}}function yr(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let i=Kn(n.focusNode,n.focusOffset),r=Gn(n.focusNode,n.focusOffset),s=i||r;if(r&&i&&r.node!=i.node){let t=Ji.get(r.node);if(!t||t.isText()&&t.text!=r.node.nodeValue)s=r;else if(e.docView.lastCompositionAfterCursor){let e=Ji.get(i.node);!e||e.isText()&&e.text!=i.node.nodeValue||(s=r)}}if(e.docView.lastCompositionAfterCursor=s!=i,!s)return null;let o=t-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}let wr=class{constructor(){this.changes=[]}compareRange(e,t){_n(e,t,this.changes)}comparePoint(e,t){_n(e,t,this.changes)}boundChange(e){_n(e,e,this.changes)}};class Cr{constructor(){this.changes=[]}compareRange(e,t){_n(e,t,this.changes)}comparePoint(){}boundChange(e){_n(e,e,this.changes)}}class kr extends vn{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function _r(e,t,n,i){let r=e.state.doc.lineAt(t.head),s=e.bidiSpans(r),o=e.textDirectionAt(r.from);for(let l=t,a=null;;){let t=fi(r,s,o,l,n),c=di;if(!t){if(r.number==(n?e.state.doc.lines:1))return l;c="\n",r=e.state.doc.line(r.number+(n?1:-1)),s=e.bidiSpans(r),t=e.visualLineSide(r,!n)}if(a){if(!a(c))return l}else{if(!i)return t;a=i(c)}l=t}}function Sr(e,t,n){for(;;){let i=0;for(let r of e)r.between(t-1,t+1,(e,r,s)=>{if(t>e&&t<r){let s=i||n||(t-e<r-t?-1:1);t=s<0?e:r,i=s}});if(!i)return t}}function Er(e,t){let n=null;for(let i=0;i<t.ranges.length;i++){let r=t.ranges[i],s=null;if(r.empty){let t=Sr(e,r.from,0);t!=r.from&&(s=Ne.cursor(t,-1))}else{let t=Sr(e,r.from,-1),n=Sr(e,r.to,1);t==r.from&&n==r.to||(s=Ne.range(r.from==r.anchor?t:n,r.from==r.head?t:n))}s&&(n||(n=t.ranges.slice()),n[i]=s)}return n?Ne.create(n,t.mainIndex):t}function Tr(e,t,n){let i=Sr(e.state.facet(Vi).map(t=>t(e)),n.from,t.head>n.from?-1:1);return i==n.from?n:Ne.cursor(i,i<n.from?1:-1)}class Or{constructor(e,t){this.pos=e,this.assoc=t}}function Mr(e,t,n,i){let r,s=e.contentDOM.getBoundingClientRect(),o=s.top+e.viewState.paddingTop,{x:l,y:a}=t,c=a-o;for(;;){if(c<0)return new Or(0,1);if(c>e.viewState.docHeight)return new Or(e.state.doc.length,-1);if(r=e.elementAtHeight(c),null==i)break;if(r.type==bn.Text){if(i<0?r.to<e.viewport.from:r.from>e.viewport.to)break;let t=e.docView.coordsAt(i<0?r.from:r.to,i>0?-1:1);if(t&&(i<0?t.top<=c+o:t.bottom>=c+o))break}let t=e.viewState.heightOracle.textHeight/2;c=i>0?r.bottom+t:r.top-t}if(e.viewport.from>=r.to||e.viewport.to<=r.from){if(n)return null;if(r.type==bn.Text){let t=function(e,t,n,i,r){let s=Math.round((i-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;s+=Math.floor((r-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+function(e,t,n){for(let i=0,r=0;;){if(r>=t)return i;if(i==e.length)break;r+=9==e.charCodeAt(i)?n-r%n:1,i=ye(e,i)}return e.length}(o,s,e.state.tabSize)}(e,s,r,l,a);return new Or(t,t==r.from?1:-1)}}if(r.type!=bn.Text)return c<(r.top+r.bottom)/2?new Or(r.from,1):new Or(r.to,-1);let h=e.docView.lineAt(r.from,2);return h&&h.length==r.length||(h=e.docView.lineAt(r.from,-2)),new Br(e,l,a,e.textDirectionAt(r.from)).scanTile(h,r.from)}class Br{constructor(e,t,n,i){this.view=e,this.x=t,this.y=n,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[oi.find(i,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[oi.find(i,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:i}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+i.from<t)}scan(e,t){let n,i,r,s=0,o=e.length-1,l=new Set,a=this.bidiIn(e[0],e[o]),c=-1,h=1e9;e:for(;s<o;){let u=o-s,d=s+o>>1;t:if(l.has(d)){let e=s+Math.floor(Math.random()*u);for(let t=0;t<u;t++){if(!l.has(e)){d=e;break t}e++,e==o&&(e=s)}break e}l.add(d);let f=t(d);if(f)for(let t=0;t<f.length;t++){let l=f[t],u=0;if(l.bottom<this.y)(!n||n.bottom<l.bottom)&&(n=l),u=1;else if(l.top>this.y)(!i||i.top>l.top)&&(i=l),u=-1;else{let e=l.left>this.x?this.x-l.left:l.right<this.x?this.x-l.right:0,t=Math.abs(e);t<h&&(c=d,h=t,r=l),e&&(u=e<0==(this.baseDir==Jn.LTR)?-1:1)}-1!=u||a&&!this.baseDirAt(e[d],1)?1!=u||a&&!this.baseDirAt(e[d+1],-1)||(s=d+1):o=d}}if(!r){let r=n&&(!i||this.y-n.bottom<i.top-this.y)?n:i;return this.y=(r.top+r.bottom)/2,this.scan(e,t)}let u=(a?this.dirAt(e[c],1):this.baseDir)==Jn.LTR;return{i:c,after:this.x>(r.left+r.right)/2==u}}scanText(e,t){let n=[];for(let i=0;i<e.length;i=ye(e.text,i))n.push(t+i);n.push(t+e.length);let i=this.scan(n,i=>{let r=n[i]-t,s=n[i+1]-t;return qn(e.dom,r,s).getClientRects()});return i.after?new Or(n[i.i+1],-1):new Or(n[i.i],1)}scanTile(e,t){if(!e.length)return new Or(t,1);if(1==e.children.length){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let i=0,r=t;i<e.children.length;i++)n.push(r+=e.children[i].length);let i=this.scan(n,t=>{let n=e.children[t];return 48&n.flags?null:(1==n.dom.nodeType?n.dom:qn(n.dom,0,n.length)).getClientRects()}),r=e.children[i.i],s=n[i.i];return r.isText()?this.scanText(r,s):r.isComposite()?this.scanTile(r,s):i.after?new Or(n[i.i+1],-1):new Or(s,1)}}const Dr="";class Rr{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(wt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Dr}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let e=this.text.length;this.readNode(i);let r=Ji.get(i),s=i.nextSibling;if(s==t){(null==r?void 0:r.breakAfter)&&!s&&n!=this.view.contentDOM&&this.lineBreak();break}let o=Ji.get(s);(r&&o?r.breakAfter:(r?r.breakAfter:Rn(i))||Rn(s)&&("BR"!=i.nodeName||(null==r?void 0:r.isWidget()))&&this.text.length>e)&&!Pr(s,t)&&this.lineBreak(),i=s}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let r,s=-1,o=1;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(r=i.exec(t))&&(s=r.index,o=r[0].length),this.append(t.slice(n,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=o-1);n=s+o}}readNode(e){let t=Ji.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Ir(e,n.node,n.offset)?t:0))}}function Ir(e,t,n){for(;;){if(!t||n<Pn(t))return!1;if(t==e)return!0;n=Dn(t)+1,t=t.parentNode}}function Pr(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=Ji.get(e);if(!(null==t?void 0:t.isWidget()))return!1;t&&(n||(n=[])).push(t)}if(n)for(let e of n){let t=e.overrideDOMText;if(null==t?void 0:t.length)return!1}return!0}class Nr{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Lr{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:r,impreciseAnchor:s}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Fr(e.docView.tile,t,n,0))){let t=r||s?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}=e.observer.selectionRange;return n&&(t.push(new Nr(n,i)),r==n&&s==i||t.push(new Nr(r,s))),t}(e),n=new Rr(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,i=2==e.length?e[1].pos:n;return n>-1&&i>-1?Ne.single(n+t,i+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=r&&r.node==t.focusNode&&r.offset==t.focusOffset||!Tn(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),i=s&&s.node==t.anchorNode&&s.offset==t.anchorOffset||!Tn(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),o=e.viewport;if((dn.ios||dn.chrome)&&e.state.selection.main.empty&&n!=i&&(o.from>0||o.to<e.state.doc.length)){let t=Math.min(n,i),r=Math.max(n,i),s=o.from-t,l=o.to-r;0!=s&&1!=s&&0!=t||0!=l&&-1!=l&&r!=e.state.doc.length||(n=0,i=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ne.range(i,n)):this.newSel=Ne.single(i,n)}}}function Fr(e,t,n,i){if(e.isComposite()){let r=-1,s=-1,o=-1,l=-1;for(let a=0,c=i,h=i;a<e.children.length;a++){let i=e.children[a],u=c+i.length;if(c<t&&u>n)return Fr(i,t,n,c);if(u>=t&&-1==r&&(r=a,s=c),c>n&&i.dom.parentNode==e.dom){o=a,l=h;break}h=u,c=u+i.breakAfter}return{from:s,to:l<0?i+e.length:l,startDOM:(r?e.children[r-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}return e.isText()?{from:i,to:i+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function jr(e,t){let n,{newSel:i}=t,{state:r}=e,s=r.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:i}=t.bounds,l=s.from,a=null;(8===o||dn.android&&t.text.length<i-e)&&(l=s.to,a="end");let c,h,u=r.doc.sliceString(e,i,Dr);!s.empty&&s.from>=e&&s.to<=i&&(t.typeOver||u!=t.text)&&u.slice(0,s.from-e)==t.text.slice(0,s.from-e)&&u.slice(s.to-e)==t.text.slice(c=t.text.length-(u.length-(s.to-e)))?n={from:s.from,to:s.to,insert:ue.of(t.text.slice(s.from-e,c).split(Dr))}:(h=Vr(u,t.text,l-e,a))&&(dn.chrome&&13==o&&h.toB==h.from+2&&t.text.slice(h.from,h.toB)==Dr+Dr&&h.toB--,n={from:e+h.from,to:e+h.toA,insert:ue.of(t.text.slice(h.from,h.toB).split(Dr))})}else i&&(!e.hasFocus&&r.facet(Bi)||Wr(i,s))&&(i=null);if(!n&&!i)return!1;if((dn.mac||dn.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=Ne.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:ue.of([n.insert.toString().replace("."," ")])}):r.doc.lineAt(s.from).to<s.to&&e.docView.lineHasWidget(s.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:s.from,to:s.to,insert:r.toText(e.inputState.insertingText)}:dn.chrome&&n&&n.from==n.to&&n.from==s.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(i&&(i=Ne.single(i.main.anchor-1,i.main.head-1)),n={from:s.from,to:s.to,insert:ue.of([" "])}),n)return zr(e,n,i,o);if(i&&!Wr(i,s)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin,"select.pointer"==n&&(i=Er(r.facet(Vi).map(t=>t(e)),i))),e.dispatch({selection:i,scrollIntoView:t,userEvent:n}),!0}return!1}function zr(e,t,n,i=-1){if(dn.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(dn.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&" "==e.state.sliceDoc(t.from,r.from))&&1==t.insert.length&&2==t.insert.lines&&$n(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&0==t.insert.length||8==i&&t.insert.length<t.to-t.from&&t.to>r.head)&&$n(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&0==t.insert.length&&$n(e.contentDOM,"Delete",46)))return!0;let s,o=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let l=()=>s||(s=function(e,t,n){let i,r=e.state,s=r.selection.main,o=-1;if(t.from==t.to&&t.from<s.from||t.from>s.to){let n=t.from<s.from?-1:1,i=n<0?s.from:s.to,l=Sr(r.facet(Vi).map(t=>t(e)),i,n);t.from==l&&(o=l)}if(o>-1)i={changes:t,selection:Ne.cursor(t.from+t.insert.length,-1)};else if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=s.from<t.from?r.sliceDoc(s.from,t.from):"",o=s.to>t.to?r.sliceDoc(t.to,s.to):"";i=r.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=r.changes(t),l=n&&n.main.to<=o.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=s.to+10&&t.to>=s.to-10){let a,c=e.state.sliceDoc(t.from,t.to),h=n&&yr(e,n.main.head);if(h){let e=t.insert.length-(t.to-t.from);a={from:h.from,to:h.to-e}}else a=e.state.doc.lineAt(s.head);let u=s.to-t.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,h=i-c.length;if(e.state.sliceDoc(h,i)!=c||i>=a.from&&h<=a.to)return{range:n};let d=r.changes({from:h,to:i,insert:t.insert}),f=n.to-s.to;return{changes:d,range:l?Ne.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(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange&&(l+=".start",e.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:l,scrollIntoView:!0})}(e,t,n));return e.state.facet(xi).some(n=>n(e,t.from,t.to,o,l))||e.dispatch(l()),!0}function Vr(e,t,n,i){let r=Math.min(e.length,t.length),s=0;for(;s<r&&e.charCodeAt(s)==t.charCodeAt(s);)s++;if(s==r&&e.length==t.length)return null;let o=e.length,l=t.length;for(;o>0&&l>0&&e.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;return"end"==i&&(n-=o+Math.max(0,s-Math.min(o,l))-s),o<s&&e.length<t.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}}function Wr(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class Hr{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=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=e.hasFocus,dn.safari&&e.contentDOM.addEventListener("input",()=>null),dn.gecko&&function(e){fs.has(e)||(fs.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,i=t.target;i!=e.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=Ji.get(i))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e)))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=$r(e),n=this.handlers,i=this.view.contentDOM;for(let e in t)if("scroll"!=e){let r=!t[e].handlers.length,s=n[e];s&&r!=!s.handlers.length&&(i.removeEventListener(e,this.handleEvent),s=null),s||i.addEventListener(e,this.handleEvent,{passive:r})}for(let e in n)"scroll"==e||t[e]||i.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&Gr.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),dn.android&&dn.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!dn.ios||e.synthetic||e.altKey||e.metaKey||!((t=Ur.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||Kr.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&!("Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,$n(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!(!/^key/.test(e.type)||e.synthetic)&&(this.composing>0||!!(dn.safari&&!dn.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function qr(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(e){Mi(n.state,e)}}}function $r(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,i=e&&e.plugin.domEventHandlers,r=e&&e.plugin.domEventObservers;if(i)for(let e in i){let r=i[e];r&&n(e).handlers.push(qr(t.value,r))}if(r)for(let e in r){let i=r[e];i&&n(e).observers.push(qr(t.value,i))}}for(let e in Qr)n(e).handlers.push(Qr[e]);for(let e in Xr)n(e).observers.push(Xr[e]);return t}const Ur=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Kr="dthko",Gr=[16,17,18,20,91,92,224,225];function Yr(e){return.7*Math.max(0,e)+8}class Jr{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=jn(e.contentDOM),this.atoms=e.state.facet(Vi).map(t=>t(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(wt.allowMultipleSelections)&&function(e,t){let n=e.state.facet(gi);return n.length?n[0](t):dn.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=En(e.root);if(!i||0==i.rangeCount)return!0;let r=i.getRangeAt(0).getClientRects();for(let e=0;e<r.length;e++){let n=r[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=ls(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(t=this.startEvent,n=e,Math.max(Math.abs(t.clientX-n.clientX),Math.abs(t.clientY-n.clientY))<10))return;var t,n;this.select(this.lastEvent=e);let i=0,r=0,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 c=$i(this.view);e.clientX-c.left<=s+6?i=-Yr(s-e.clientX):e.clientX+c.right>=l-6&&(i=Yr(e.clientX-l)),e.clientY-c.top<=o+6?r=-Yr(o-e.clientY):e.clientY+c.bottom>=a-6&&(r=Yr(e.clientY-a)),this.setScrollSpeed(i,r)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=Er(this.atoms,this.style.get(e,this.extend,this.multiple));!this.mustSelect&&n.eq(t.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}const Qr=Object.create(null),Xr=Object.create(null),Zr=dn.ie&&dn.ie_version<15||dn.ios&&dn.webkit_version<604;function es(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function ts(e,t){t=es(e.state,wi,t);let n,{state:i}=e,r=1,s=i.toText(t),o=s.lines==i.selection.ranges.length;if(null!=cs&&i.selection.ranges.every(e=>e.empty)&&cs==s.toString()){let e=-1;n=i.changeByRange(n=>{let l=i.doc.lineAt(n.from);if(l.from==e)return{range:n};e=l.from;let a=i.toText((o?s.line(r++).text:t)+i.lineBreak);return{changes:{from:l.from,insert:a},range:Ne.cursor(n.from+a.length)}})}else n=o?i.changeByRange(e=>{let t=s.line(r++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Ne.cursor(e.from+t.length)}}):i.replaceSelection(s);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function ns(e,t,n,i){if(1==i)return Ne.cursor(t,n);if(2==i)return function(e,t,n=1){let i=e.charCategorizer(t),r=e.doc.lineAt(t),s=t-r.from;if(0==r.length)return Ne.cursor(t);0==s?n=1:s==r.length&&(n=-1);let o=s,l=s;n<0?o=ye(r.text,s,!1):l=ye(r.text,s);let a=i(r.text.slice(o,l));for(;o>0;){let e=ye(r.text,o,!1);if(i(r.text.slice(e,o))!=a)break;o=e}for(;l<r.length;){let e=ye(r.text,l);if(i(r.text.slice(l,e))!=a)break;l=e}return Ne.range(o+r.from,l+r.from)}(e.state,t,n);{let i=e.docView.lineAt(t,n),r=e.state.doc.lineAt(i?i.posAtEnd:t),s=i?i.posAtStart:r.from,o=i?i.posAtEnd:r.to;return o<e.state.doc.length&&o==r.to&&o++,Ne.range(s,o)}}Xr.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},Xr.wheel=Xr.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},Qr.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),Xr.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},Xr.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},Qr.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of e.state.facet(Ai))if(n=i(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=ls(t),r=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),r=r.map(e.changes))},get(t,s,o){let l,a=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c=ns(e,a.pos,a.assoc,i);if(n.pos!=a.pos&&!s){let t=ns(e,n.pos,n.assoc,i),r=Math.min(t.from,c.from),s=Math.max(t.to,c.to);c=r<c.from?Ne.range(r,s):Ne.range(s,r)}return s?r.replaceRange(r.main.extend(c.from,c.to)):o&&1==i&&r.ranges.length>1&&(l=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:i,to:r}=e.ranges[n];if(i<=t&&r>=t)return Ne.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(r,a.pos))?l:o?r.addRange(c):Ne.create([c])}}}(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new Jr(e,t,n,i)),i&&e.observer.ignore(()=>{Hn(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),!1===r.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};const is=dn.ie&&dn.ie_version<=11;let rs=null,ss=0,os=0;function ls(e){if(!is)return e.detail;let t=rs,n=os;return rs=e,os=Date.now(),ss=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(ss+1)%3:1}function as(e,t,n,i){if(!(n=es(e.state,wi,n)))return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,o=i&&s&&function(e,t){let n=e.state.facet(mi);return n.length?n[0](t):dn.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:s.from,to:s.to}:null,l={from:r,insert:n},a=e.state.changes(o?[o,l]:l);e.focus(),e.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Qr.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let i=e.docView.tile.nearest(t.target);if(i&&i.isWidget()){let e=i.posAtStart,t=e+i.length;(e>=n.to||t<=n.from)&&(n=Ne.range(e,t))}}let{inputState:i}=e;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",es(e.state,Ci,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},Qr.dragend=e=>(e.inputState.draggedContent=null,!1),Qr.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,s=()=>{++r==n.length&&as(e,t,i.filter(e=>null!=e).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=s,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(i[e]=t.result),s()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return as(e,t,n,!0),!0}return!1},Qr.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Zr?null:t.clipboardData;return n?(ts(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),ts(e,n.value)},50)}(e),!1)};let cs=null;Qr.copy=Qr.cut=(e,t)=>{if(!On(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:i,linewise:r}=function(e){let t=[],n=[],i=!1;for(let i of e.selection.ranges)i.empty||(t.push(e.sliceDoc(i.from,i.to)),n.push(i));if(!t.length){let r=-1;for(let{from:i}of e.selection.ranges){let s=e.doc.lineAt(i);s.number>r&&(t.push(s.text),n.push({from:s.from,to:Math.min(e.doc.length,s.to+1)})),r=s.number}i=!0}return{text:es(e,Ci,t.join(e.lineBreak)),ranges:n,linewise:i}}(e.state);if(!n&&!r)return!1;cs=r?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=Zr?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),e.focus()},50)}(e,n),!1)};const hs=at.define();function us(e,t){let n=[];for(let i of e.facet(yi)){let r=i(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:hs.of(!0)}):null}function ds(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=us(e.state,t);n?e.dispatch(n):e.update([])}},10)}Xr.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),ds(e)},Xr.blur=e=>{e.observer.clearSelectionRange(),ds(e)},Xr.compositionstart=Xr.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},Xr.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,dn.chrome&&dn.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},Xr.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},Qr.beforeinput=(e,t)=>{var n,i;if("insertText"!=t.inputType&&"insertCompositionText"!=t.inputType||(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let i=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),r=t.getTargetRanges();if(i&&r.length){let t=r[0],n=e.posAtDOM(t.startContainer,t.startOffset),s=e.posAtDOM(t.endContainer,t.endOffset);return zr(e,{from:n,to:s,insert:e.state.toText(i)},null),!0}}let r;if(dn.chrome&&dn.android&&(r=Ur.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(r.key,r.keyCode),"Backspace"==r.key||"Delete"==r.key)){let t=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout(()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return dn.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),dn.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>Xr.compositionend(e,t),20),!1};const fs=new Set,ps=["pre-wrap","normal","pre-line","break-spaces"];let gs=!1;function ms(){gs=!1}class As{constructor(e){this.lineWrapping=e,this.doc=ue.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return ps.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(10*i)]||(t=!0,this.heightSamples[Math.floor(10*i)]=!0)}return t}refresh(e,t,n,i,r,s){let o=ps.indexOf(e)>-1,l=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=r,l){this.heightSamples={};for(let e=0;e<s.length;e++){let t=s[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return l}}class vs{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class bs{constructor(e,t,n,i,r){this.from=e,this.length=t,this.top=n,this.height=i,this._content=r}get type(){return"number"==typeof this._content?bn.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 Cn?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new bs(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var xs=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(xs||(xs={}));const ys=.001;class ws{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>ys&&(gs=!0),this.height=e)}replace(e,t,n){return ws.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let r=this,s=n.doc;for(let o=i.length-1;o>=0;o--){let{fromA:l,toA:a,fromB:c,toB:h}=i[o],u=r.lineAt(l,xs.ByPosNoHeight,n.setDoc(t),0,0),d=u.to>=a?u:r.lineAt(a,xs.ByPosNoHeight,n,0,0);for(h+=d.to-a,a=d.to;o>0&&u.from<=i[o-1].toA;)l=i[o-1].fromA,c=i[o-1].fromB,o--,l<u.from&&(u=r.lineAt(l,xs.ByPosNoHeight,n,0,0));c+=u.from-l,l=u.from;let f=Ms.build(n.setDoc(s),e,c,h);r=Cs(r,r.replace(l,a,f))}return r.updateHeight(n,0)}static empty(){return new Ss(0,0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,i=0,r=0;for(;;)if(t==n)if(i>2*r){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,1,r.left,r.right),n+=1+r.break,i-=r.size}else{if(!(r>2*i))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,r-=t.size}}else if(i<r){let n=e[t++];n&&(i+=n.size)}else{let t=e[--n];t&&(r+=t.size)}let s=0;return null==e[t-1]?(s=1,t--):null==e[t]&&(s=1,n++),new Ts(ws.of(e.slice(0,t)),s,ws.of(e.slice(n)))}}function Cs(e,t){return e==t?e:(e.constructor!=t.constructor&&(gs=!0),t)}ws.prototype.size=1;const ks=xn.replace({});class _s extends ws{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new bs(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,i){return this.spaceAbove&&e<n+this.spaceAbove?new bs(i,0,n,this.spaceAbove,ks):this.mainBlock(n,i)}lineAt(e,t,n,i,r){let s=this.mainBlock(i,r);return this.spaceAbove?this.blockAt(0,n,i,r).join(s):s}forEachLine(e,t,n,i,r,s){e<=r+this.length&&t>=r&&s(this.lineAt(0,xs.ByPos,n,i,r))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ss extends _s{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new bs(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let i=n[0];return 1==n.length&&(i instanceof Ss||i instanceof Es&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof Es?i=new Ss(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):ws.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setMeasuredHeight(i):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Es extends ws{constructor(e){super(e,0)}heightMetrics(e,t){let n,i=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,s=r-i+1,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*s);n=t/s,this.length>s+1&&(o=(this.height-t)/(this.length-s-1))}else n=this.height/s;return{firstLine:i,lastLine:r,perLine:n,perChar:o}}blockAt(e,t,n,i){let{firstLine:r,lastLine:s,perLine:o,perChar:l}=this.heightMetrics(t,i);if(t.lineWrapping){let r=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),s=t.doc.lineAt(r),a=o+s.length*l,c=Math.max(n,e-a/2);return new bs(s.from,s.length,c,a,0)}{let i=Math.max(0,Math.min(s-r,Math.floor((e-n)/o))),{from:l,length:a}=t.doc.line(r+i);return new bs(l,a,n+o*i,o,0)}}lineAt(e,t,n,i,r){if(t==xs.ByHeight)return this.blockAt(e,n,i,r);if(t==xs.ByPosNoHeight){let{from:t,to:i}=n.doc.lineAt(e);return new bs(t,i-t,0,0,0)}let{firstLine:s,perLine:o,perChar:l}=this.heightMetrics(n,r),a=n.doc.lineAt(e),c=o+a.length*l,h=a.number-s,u=i+o*h+l*(a.from-r-h);return new bs(a.from,a.length,Math.max(i,Math.min(u,i+this.height-c)),c,0)}forEachLine(e,t,n,i,r,s){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(n,r);for(let c=e,h=i;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-o;h+=l*n+a*(e-r-n)}let i=l+a*t.length;s(new bs(t.from,t.length,h,i,0)),h+=i,c=t.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let e=n[n.length-1];e instanceof Es?n[n.length-1]=new Es(e.length+i):n.push(null,new Es(i-1))}if(e>0){let t=n[0];t instanceof Es?n[0]=new Es(e+t.length):n.unshift(new Es(e-1),null)}return ws.of(n)}decomposeLeft(e,t){t.push(new Es(e-1),null)}decomposeRight(e,t){t.push(null,new Es(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let r=t+this.length;if(i&&i.from<=t+this.length&&i.more){let n=[],s=Math.max(t,i.from),o=-1;for(i.from>t&&n.push(new Es(i.from-t-1).updateHeight(e,t));s<=r&&i.more;){let t=e.doc.lineAt(s).length;n.length&&n.push(null);let r=i.heights[i.index++],l=0;r<0&&(l=-r,r=i.heights[i.index++]),-1==o?o=r:Math.abs(r-o)>=ys&&(o=-2);let a=new Ss(t,r,l);a.outdated=!1,n.push(a),s+=t+1}s<=r&&n.push(null,new Es(r-s).updateHeight(e,s));let l=ws.of(n);return(o<0||Math.abs(l.height-this.height)>=ys||Math.abs(o-this.heightMetrics(e,t).perLine)>=ys)&&(gs=!0),Cs(this,l)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Ts extends ws{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,i){let r=n+this.left.height;return e<r?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,r,i+this.left.length+this.break)}lineAt(e,t,n,i,r){let s=i+this.left.height,o=r+this.left.length+this.break,l=t==xs.ByHeight?e<s:e<o,a=l?this.left.lineAt(e,t,n,i,r):this.right.lineAt(e,t,n,s,o);if(this.break||(l?a.to<o:a.from>o))return a;let c=t==xs.ByPosNoHeight?xs.ByPosNoHeight:xs.ByPos;return l?a.join(this.right.lineAt(o,c,n,s,o)):this.left.lineAt(o,c,n,i,r).join(a)}forEachLine(e,t,n,i,r,s){let o=i+this.left.height,l=r+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,n,i,r,s),t>=l&&this.right.forEachLine(e,t,n,o,l,s);else{let a=this.lineAt(l,xs.ByPos,n,i,r);e<a.from&&this.left.forEachLine(e,a.from-1,n,i,r,s),a.to>=e&&a.from<=t&&s(a),t>a.to&&this.right.forEachLine(a.to+1,t,n,o,l,s)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let r=[];e>0&&this.decomposeLeft(e,r);let s=r.length;for(let e of n)r.push(e);if(e>0&&Os(r,s-1),t<this.length){let e=r.length;this.decomposeRight(t,r),Os(r,e)}return ws.of(r)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?ws.of(this.break?[e,null,t]:[e,t]):(this.left=Cs(this.left,e),this.right=Cs(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,i){let{left:r,right:s}=this,o=t+r.length+this.break,l=null;return i&&i.from<=t+r.length&&i.more?l=r=r.updateHeight(e,t,n,i):r.updateHeight(e,t,n),i&&i.from<=o+s.length&&i.more?l=s=s.updateHeight(e,o,n,i):s.updateHeight(e,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 Os(e,t){let n,i;null==e[t]&&(n=e[t-1])instanceof Es&&(i=e[t+1])instanceof Es&&e.splice(t-1,3,new Es(n.length+1+i.length))}class Ms{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Ss?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Ss(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let s=t-e;n.block?this.addBlock(new _s(s,i,n)):(s||r||i>=5)&&this.addLineDeco(i,r,s)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ss(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Es(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ss)return e;let t=new Ss(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof Ss||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Ss(0,-1,0));let n=e;for(let e of this.nodes)e instanceof Ss&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,i){let r=new Ms(n,e);return Ot.spans(t,n,i,r,0),r.finish(n)}}class Bs{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&_n(e,t,this.changes,5)}}function Ds(e,t){let n=e.getBoundingClientRect(),i=e.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 t=e.parentNode;t&&t!=i.body;)if(1==t.nodeType){let n=t,i=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();s=Math.max(s,i.left),o=Math.min(o,i.right),l=Math.max(l,i.top),a=Math.min(t==e.parentNode?r.innerHeight:a,i.bottom)}t="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+t),bottom:Math.max(l,a)-(n.top+t)}}function Rs(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class Is{constructor(e,t,n,i){this.from=e,this.to=t,this.size=n,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.size!=r.size)return!1}return!0}draw(e,t){return xn.replace({widget:new Ps(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Ps extends vn{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Ns{constructor(e,t){this.view=e,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.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=zs,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Jn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(Li).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new As(n),this.stateDeco=Vs(t),this.heightMap=ws.empty().applyChanges(this.stateDeco,ue.empty,this.heightOracle.setDoc(t.doc),[new Ki(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=xn.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>i>=e&&i<=t)){let{from:t,to:n}=this.lineBlockAt(i);e.push(new Ls(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?zs:new Ws(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Hs(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=Vs(this.state);let i=e.changedRanges,r=Ki.extendWithRanges(i,function(e,t,n){let i=new Bs;return Ot.compare(e,t,n,i,0),i.changes}(n,this.stateDeco,e?e.changes:Te.empty(this.state.doc.length))),s=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);ms(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=s||gs)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let a=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(a||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(_i)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Jn.RTL:Jn.LTR;let s=this.heightOracle.mustRefreshForWrapping(r)||"refresh"===this.mustMeasureContent,o=t.getBoundingClientRect(),l=s||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let a=0,c=0;if(o.width&&o.height){let{scaleX:e,scaleY:n}=Fn(t,o);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,a|=16,s=l=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==h&&this.paddingBottom==u||(this.paddingTop=h,this.paddingBottom=u,a|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,a|=16);let d=jn(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let f=this.getScrollOffset();this.scrollOffset!=f&&(this.scrollAnchorHeight=-1,this.scrollOffset=f),this.scrolledToBottom=Un(this.scrollParent||e.win);let p=(this.printing?Rs:Ds)(t,this.paddingTop),g=p.top-this.pixelViewport.top,m=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let A=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(A!=this.inView&&(this.inView=A,A&&(l=!0)),!this.inView&&!this.scrollTarget&&!function(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}(e.dom))return 0;let v=o.width;if(this.contentDOMWidth==v&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,a|=16),l){let t=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(t)&&(s=!0),s||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:n,charWidth:o,textHeight:l}=e.docView.measureTextSize();s=n>0&&i.refresh(r,n,o,l,Math.max(5,v/o),t),s&&(e.docView.minWidth=0,a|=16)}g>0&&m>0?c=Math.max(g,m):g<0&&m<0&&(c=Math.min(g,m)),ms();for(let n of this.viewports){let r=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(s?ws.empty().applyChanges(this.stateDeco,ue.empty,this.heightOracle,[new Ki(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,s,new vs(n.from,r))}gs&&(a|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||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(c,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,e)),a|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),a}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,r=this.heightOracle,{visibleTop:s,visibleBottom:o}=this,l=new Ls(i.lineAt(s-1e3*n,xs.ByHeight,r,0,0).from,i.lineAt(o+1e3*(1-n),xs.ByHeight,r,0,0).to);if(t){let{head:e}=t.range;if(e<l.from||e>l.to){let n,s=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=i.lineAt(e,xs.ByPos,r,0,0);n="center"==t.y?(o.top+o.bottom)/2-s/2:"start"==t.y||"nearest"==t.y&&e<l.from?o.top:o.bottom-s,l=new Ls(i.lineAt(n-500,xs.ByHeight,r,0,0).from,i.lineAt(n+s+500,xs.ByHeight,r,0,0).to)}}return l}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new Ls(this.heightMap.lineAt(n,xs.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,xs.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,xs.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,xs.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:o}=this;return(0==e||i<=s-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||r>=o+Math.max(10,Math.min(n,250)))&&i>s-2e3&&r<o+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)t.touchesRange(i.from,i.to)||n.push(new Is(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,r=i>>1,s=i<<1;if(this.defaultTextDirection!=Jn.LTR&&!n)return[];let o=[],l=(i,s,a,c)=>{if(s-i<r)return;let h=this.state.selection.main,u=[h.from];h.empty||u.push(h.to);for(let e of u)if(e>i&&e<s)return l(i,e-10,a,c),void l(e+10,s,a,c);let d=function(e,t){for(let n of e)if(t(n))return n}(e,e=>e.from>=a.from&&e.to<=a.to&&Math.abs(e.from-i)<r&&Math.abs(e.to-s)<r&&!u.some(t=>e.from<t&&e.to>t));if(!d){if(s<a.to&&t&&n&&t.visibleRanges.some(e=>e.from<=s&&e.to>=s)){let e=t.moveToLineBoundary(Ne.cursor(s),!1,!0).head;e>i&&(s=e)}let e=this.gapSize(a,i,s,c);d=new Is(i,s,e,n||e<2e6?e:2e6)}o.push(d)},a=t=>{if(t.length<s||t.type!=bn.Text)return;let r=function(e,t,n){let i=[],r=e,s=0;return Ot.spans(n,e,t,{span(){},point(e,t){e>r&&(i.push({from:r,to:e}),s+=e-r),r=t}},20),r<t&&(i.push({from:r,to:t}),s+=t-r),{total:s,ranges:i}}(t.from,t.to,this.stateDeco);if(r.total<s)return;let o,a,c=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,s=i/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=c){let i=js(r,c),o=((this.visibleBottom-this.visibleTop)/2+s)/t.height;e=i-o,n=i+o}else e=(this.visibleTop-t.top-s)/t.height,n=(this.visibleBottom-t.top+s)/t.height;o=Fs(r,e),a=Fs(r,n)}else{let n=r.total*this.heightOracle.charWidth,s=i*this.heightOracle.charWidth,l=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+l<this.pixelViewport.left&&(l=n.size-n.displaySize);let h,u,d=this.pixelViewport.left+l,f=this.pixelViewport.right+l;if(null!=c){let e=js(r,c),t=((f-d)/2+s)/n;h=e-t,u=e+t}else h=(d-s)/n,u=(f+s)/n;o=Fs(r,h),a=Fs(r,u)}o>t.from&&l(t.from,o,t,r),a<t.to&&l(a,t.to,t,r)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(a):a(e);return o}gapSize(e,t,n,i){let r=js(i,n)-js(i,t);return this.heightOracle.lineWrapping?e.height*r:i.total*this.heightOracle.charWidth*r}updateLineGaps(e){Is.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=xn.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];Ot.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let i=0;if(n.length!=this.visibleRanges.length)i=12;else for(let t=0;t<n.length&&!(8&i);t++){let r=this.visibleRanges[t],s=n[t];r.from==s.from&&r.to==s.to||(i|=4,e&&e.mapPos(r.from,-1)==s.from&&e.mapPos(r.to,1)==s.to||(i|=8))}return this.visibleRanges=n,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Hs(this.heightMap.lineAt(e,xs.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Hs(this.heightMap.lineAt(this.scaler.fromDOM(e),xs.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Hs(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Ls{constructor(e,t){this.from=e,this.to=t}}function Fs({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:r}=t[e],s=r-n;if(i<=s)return n+i;i-=s}}function js(e,t){let n=0;for(let{from:i,to:r}of e.ranges){if(t<=r){n+=t-i;break}n+=r-i}return n/e.total}const zs={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};function Vs(e){let t=e.facet(Fi).filter(e=>"function"!=typeof e),n=e.facet(zi).filter(e=>"function"!=typeof e);return n.length&&t.push(Ot.join(n)),t}class Ws{constructor(e,t,n){let i=0,r=0,s=0;this.viewports=n.map(({from:n,to:r})=>{let s=t.lineAt(n,xs.ByPos,e,0,0).top,o=t.lineAt(r,xs.ByPos,e,0,0).bottom;return i+=o-s,{from:n,to:r,top:s,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let e of this.viewports)e.domTop=s+(e.top-r)*this.scale,s=e.domBottom=e.domTop+(e.bottom-e.top),r=e.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return i+(e-n)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);n=r.bottom,i=r.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return n+(e-i)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);n=r.bottom,i=r.domBottom}}eq(e){return e instanceof Ws&&this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to)}}function Hs(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new bs(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map(e=>Hs(e,t)):e._content)}const qs=je.define({combine:e=>e.join(" ")}),$s=je.define({combine:e=>e.indexOf(!0)>-1}),Us=$t.newName(),Ks=$t.newName(),Gs=$t.newName(),Ys={"&light":"."+Ks,"&dark":"."+Gs};function Js(e,t,n){return new $t(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]}):e+" "+t})}const Qs=Js("."+Us,{"&":{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),Xs={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Zs=dn.ie&&dn.ie_version<=11;class eo{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new zn,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(dn.ie&&dn.ie_version<=11||dn.ios&&e.composing)&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),!window.EditContext||!dn.android||!1===e.constructor.EDIT_CONTEXT||dn.chrome&&dn.chrome_version<126||(this.editContext=new io(e),e.state.facet(Bi)&&(e.contentDOM.editContext=this.editContext.editContext)),Zs&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(Bi)?n.root.activeElement!=this.dom:!On(this.dom,i))return;let r=i.anchorNode&&n.docView.tile.nearest(i.anchorNode);r&&r.isWidget()&&r.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(dn.ie&&dn.ie_version<=11||dn.android&&dn.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Bn(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=En(e.root);if(!t)return!1;let n=dn.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return no(e,n)}let n=null;function i(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),n?no(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let i=On(this.dom,n);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,i=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=i)return!1;for(i=Math.min(i,Pn(n));;)if(i){if(1!=n.nodeType)return!1;let e=n.childNodes[i-1];"false"==e.contentEditable?i--:(n=e,i=Pn(n))}else{if(n==e)return!0;i=Dn(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Xs),Zs&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Zs&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&$n(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,i=!1;for(let r of e){let e=this.readMutation(r);e&&(e.typeOver&&(i=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&On(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Lr(this.view,e,t,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=jr(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!Wr(this.view.state.selection,t.newSel.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty("attributes"==e.type),"childList"==e.type){let n=to(t,e.previousSibling||e.target.previousSibling,-1),i=to(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Bi)!=e.state.facet(Bi)&&(e.view.contentDOM.editContext=e.state.facet(Bi)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function to(e,t,n){for(;t;){let i=Ji.get(t);if(i&&i.parent==e)return i;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function no(e,t){let n=t.startContainer,i=t.startOffset,r=t.endContainer,s=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return Bn(o.node,o.offset,r,s)&&([n,i,r,s]=[r,s,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}}class io{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let i=e.state.selection.main,{anchor:r,head:s}=i,o=this.toEditorPos(n.updateRangeStart),l=this.toEditorPos(n.updateRangeEnd);e.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 c=Vr(e.state.sliceDoc(o,l),n.text,(a?i.from:i.to)-o,a?"end":null);if(!c){let t=Ne.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));return void(Wr(t,i)||e.dispatch({selection:t,userEvent:"select"}))}let h={from:c.from+o,to:c.toA+o,insert:ue.of(n.text.slice(c.from,c.toB).split("\n"))};if((dn.mac||dn.android)&&h.from==s-1&&/^\. ?$/.test(n.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(h={from:o,to:l,insert:ue.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let t=this.to-this.from+(h.to-h.from+h.insert.length);zr(e,h,Ne.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let i=[],r=null;for(let t=this.toEditorPos(n.rangeStart),s=this.toEditorPos(n.rangeEnd);t<s;t++){let n=e.coordsForChar(t);r=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||r||new DOMRect,i.push(r)}t.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,i=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(i)){let r=this.toEditorPos(e.rangeStart),s=this.toEditorPos(e.rangeEnd);if(r<s){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+" ":"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${/thin/i.test(i)?1:2}px`;n.push(xn.mark({attributes:{style:e}}).range(r,s))}}}e.dispatch({effects:Oi.of(xn.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=En(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;return e.changes.iterChanges((r,s,o,l,a)=>{if(n)return;let c=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,t+=c,void(this.to+=c);i=null,this.revertPending(e.state)}if(r+=t,(s+=t)<=this.from)this.from+=c,this.to+=c;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+=c}t+=c}),i&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==i||this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ro{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(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach(e=>n(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new Ns(this,e.state||wt.create(e)),e.scrollTo&&e.scrollTo.is(Ti)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ri).map(e=>new Pi(e));for(let e of this.plugins)e.update(this);this.observer=new eo(this),this.inputState=new Hr(this),this.inputState.ensureHandlers(this.plugins),this.docView=new br(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=1==e.length&&e[0]instanceof dt?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,i=!1,r=this.state;for(let t of e){if(t.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=t.state}if(this.destroyed)return void(this.viewState.state=r);let s=this.hasFocus,o=0,l=null;e.some(e=>e.annotation(hs))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=us(r,s),l||(o=1));let a=this.observer.delayedAndroidKey,c=null;if(a?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(wt.phrases)!=this.state.facet(wt.phrases))return this.setState(r);t=Gi.create(this,r,e),t.flags|=o;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(h&&(h=h.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;h=new Ei(e.empty?e:Ne.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(Ti)&&(h=e.value.clip(this.state))}this.viewState.update(t,h),this.bidiCache=lo.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(Ui)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(e=>e.isUserEvent("select.pointer")))}finally{this.updateState=0}if(t.startState.facet(qs)!=t.state.facet(qs)&&(this.viewState.mustMeasureContent=!0),(n||i||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(bi))try{e(t)}catch(e){Mi(this.state,e,"update listener")}(l||c)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!jr(this,c)&&a.force&&$n(this.contentDOM,a.key,a.keyCode)})}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new Ns(this,e),this.plugins=e.facet(Ri).map(e=>new Pi(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new br(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Ri),n=e.state.facet(Ri);if(t!=n){let i=[];for(let r of n){let n=t.indexOf(r);if(n<0)i.push(new Pi(r));else{let t=this.plugins[n];t.mustUpdate=e,i.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){Mi(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:s}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(s<0)if(Un(n||this.win))r=-1,s=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(i);r=e.from,s=e.top}this.updateState=1;let o=this.viewState.measure();if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&o||([this.measureRequests,l]=[l,this.measureRequests]);let a=l.map(e=>{try{return e.read(this)}catch(e){return Mi(this.state,e),oo}}),c=Gi.create(this,this.state,[]),h=!1;c.flags|=o,t?t.flags|=o:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),h=this.docView.update(c),h&&this.docViewUpdate());for(let e=0;e<l.length;e++)if(a[e]!=oo)try{let t=l[e];t.write&&t.write(a[e],this)}catch(e){Mi(this.state,e)}if(h&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}{let e=((r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-s)/this.scaleY;if((e>1||e<-1)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i+=e,n?n.scrollTop+=e:this.win.scrollBy(0,e),s=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(bi))e(t)}get themeClasses(){return Us+" "+(this.state.facet($s)?Gs:Ks)+" "+this.state.facet(qs)}updateAttrs(){let e=ao(this,Ni,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Bi)?"true":"false",class:"cm-content",style:`${dn.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),ao(this,Li,t);let n=this.observer.ignore(()=>{let n=mn(this.contentDOM,this.contentAttrs,t),i=mn(this.dom,this.editorAttrs,e);return n||i});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)e.is(ro.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(Ui);let e=this.state.facet(ro.cspNonce);$t.mount(this.root,this.styleModules.concat(Qs).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key)return void(this.measureRequests[t]=e);this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Tr(this,e,_r(this,e,t,n))}moveByGroup(e,t){return Tr(this,e,_r(this,e,t,t=>function(e,t,n){let i=e.state.charCategorizer(t),r=i(n);return e=>{let t=i(e);return r==bt.Space&&(r=t),r==t}}(this,e.head,t)))}visualLineSide(e,t){let n=this.bidiSpans(e),i=this.textDirectionAt(e.from),r=n[t?n.length-1:0];return Ne.cursor(r.side(t,i)+e.from,r.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,i){let r=function(e,t,n){let i=e.lineBlockAt(t);if(Array.isArray(i.type)){let e;for(let r of i.type){if(r.from>t)break;if(!(r.to<t)){if(r.from<t&&r.to>t)return r;e&&(r.type!=bn.Text||e.type==r.type&&!(n<0?r.from<t:r.to>t))||(e=r)}}return e||i}return i}(e,t.head,t.assoc||-1),s=i&&r.type==bn.Text&&(e.lineWrapping||r.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head):null;if(s){let t=e.dom.getBoundingClientRect(),i=e.textDirectionAt(r.from),o=e.posAtCoords({x:n==(i==Jn.LTR)?t.right-1:t.left+1,y:(s.top+s.bottom)/2});if(null!=o)return Ne.cursor(o,n?-1:1)}return Ne.cursor(n?r.to:r.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return Tr(this,e,function(e,t,n,i){let r=t.head,s=n?1:-1;if(r==(n?e.state.doc.length:0))return Ne.cursor(r,t.assoc);let o,l=t.goalColumn,a=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(r,(t.empty?t.assoc:0)||(n?1:-1)),h=e.documentTop;if(c)null==l&&(l=c.left-a.left),o=s<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(r);null==l&&(l=Math.min(a.right-a.left,e.defaultCharacterWidth*(r-t.from))),o=(s<0?t.top:t.bottom)+h}let u=Mr(e,{x:a.left+l,y:o+(null!=i?i:e.viewState.heightOracle.textHeight>>1)*s},!1,s);return Ne.cursor(u.pos,u.assoc,void 0,l)}(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=Mr(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Mr(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(e),r=this.bidiSpans(i);return Nn(n,r[oi.find(r,e-i.from,-1,t)].dir==Jn.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(ki)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>so)return ui(e.length);let t,n=this.textDirectionAt(e.from);for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||li(i.isolates,t=Hi(this,e))))return i.order;t||(t=Hi(this,e));let i=function(e,t,n){if(!e)return[new oi(0,0,t==Xn?1:0)];if(t==Qn&&!n.length&&!si.test(e))return ui(e.length);if(n.length)for(;e.length>ai.length;)ai[ai.length]=256;let i=[],r=t==Qn?0:1;return hi(e,r,r,n,0,e.length,i),i}(e.text,n,t);return this.bidiCache.push(new lo(e.from,e.to,n,t,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||dn.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Hn(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Ti.of(new Ei("number"==typeof e?Ne.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Ti.of(new Ei(Ne.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Ii.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ii.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=$t.newName(),i=[qs.of(n),Ui.of(Js(`.${n}`,e))];return t&&t.dark&&i.push($s.of(!0)),i}static baseTheme(e){return Ge.lowest(Ui.of(Js("."+Us,e,Ys)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&Ji.get(n)||Ji.get(e);return(null===(t=null==i?void 0:i.root)||void 0===t?void 0:t.view)||null}}ro.styleModule=Ui,ro.inputHandler=xi,ro.clipboardInputFilter=wi,ro.clipboardOutputFilter=Ci,ro.scrollHandler=Si,ro.focusChangeEffect=yi,ro.perLineTextDirection=ki,ro.exceptionSink=vi,ro.updateListener=bi,ro.editable=Bi,ro.mouseSelectionStyle=Ai,ro.dragMovesSelection=mi,ro.clickAddsSelectionRange=gi,ro.decorations=Fi,ro.blockWrappers=ji,ro.outerDecorations=zi,ro.atomicRanges=Vi,ro.bidiIsolatedRanges=Wi,ro.scrollMargins=qi,ro.darkTheme=$s,ro.cspNonce=je.define({combine:e=>e.length?e[0]:""}),ro.contentAttributes=Li,ro.editorAttributes=Ni,ro.lineWrapping=ro.contentAttributes.of({class:"cm-lineWrapping"}),ro.announce=ut.define();const so=4096,oo={};class lo{constructor(e,t,n,i,r,s){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=r,this.order=s}static update(e,t){if(t.empty&&!e.some(e=>e.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:Jn.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let s=e[r];s.dir!=i||t.touchesRange(s.from,s.to)||n.push(new lo(t.mapPos(s.from,1),t.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return n}}function ao(e,t,n){for(let i=e.state.facet(t),r=i.length-1;r>=0;r--){let t=i[r],s="function"==typeof t?t(e):t;s&&fn(s,n)}return n}const co=dn.mac?"mac":dn.windows?"win":dn.linux?"linux":"key";function ho(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const uo=Ge.default(ro.domEventHandlers({keydown:(e,t)=>function(e,t,n,i){Ao=t;let r=function(e){var t=!(Jt&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Qt&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Yt:Gt)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),s=ke(we(r,0))==r.length&&" "!=r,o="",l=!1,a=!1,c=!1;go&&go.view==n&&go.scope==i&&(o=go.prefix+" ",Gr.indexOf(t.keyCode)<0&&(a=!0,go=null));let h,u,d=new Set,f=e=>{if(e){for(let t of e.run)if(!d.has(t)&&(d.add(t),t(n)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),a=!0)}return!1},p=e[i];return p&&(f(p[o+ho(r,t,!s)])?l=!0:!s||!(t.altKey||t.metaKey||t.ctrlKey)||dn.windows&&t.ctrlKey&&t.altKey||dn.mac&&t.altKey&&!t.ctrlKey&&!t.metaKey||!(h=Gt[t.keyCode])||h==r?s&&t.shiftKey&&f(p[o+ho(r,t,!0)])&&(l=!0):(f(p[o+ho(h,t,!0)])||t.shiftKey&&(u=Yt[t.keyCode])!=r&&u!=h&&f(p[o+ho(u,t,!1)]))&&(l=!0),!l&&f(p._any)&&(l=!0)),a&&(l=!0),l&&c&&t.stopPropagation(),Ao=null,l}(function(e){let t=e.facet(fo),n=po.get(t);return n||po.set(t,n=function(e,t=co){let n=Object.create(null),i=Object.create(null),r=(e,t)=>{let n=i[e];if(null==n)i[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},s=(e,i,s,o,l)=>{var a,c;let h=n[e]||(n[e]=Object.create(null)),u=i.split(/ (?!$)/).map(e=>function(e,t){const n=e.split(/-(?!$)/);let i,r,s,o,l=n[n.length-1];"Space"==l&&(l=" ");for(let e=0;e<n.length-1;++e){const l=n[e];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"==t?o=!0:r=!0}}return i&&(l="Alt-"+l),r&&(l="Ctrl-"+l),o&&(l="Meta-"+l),s&&(l="Shift-"+l),l}(e,t));for(let t=1;t<u.length;t++){let n=u.slice(0,t).join(" ");r(n,!0),h[n]||(h[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let i=go={view:t,prefix:n,scope:e};return setTimeout(()=>{go==i&&(go=null)},mo),!0}]})}let d=u.join(" ");r(d,!1);let f=h[d]||(h[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===c?void 0:c.slice())||[]});s&&f.run.push(s),o&&(f.preventDefault=!0),l&&(f.stopPropagation=!0)};for(let i of e){let e=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:r}=i;for(let t in e)e[t].run.push(e=>r(e,Ao))}let r=i[t]||i.key;if(r)for(let t of e)s(t,r,i.run,i.preventDefault,i.stopPropagation),i.shift&&s(t,"Shift-"+r,i.shift,i.preventDefault,i.stopPropagation)}return n}(t.reduce((e,t)=>e.concat(t),[]))),n}(t.state),e,t,"editor")})),fo=je.define({enables:uo}),po=new WeakMap;let go=null;const mo=4e3;let Ao=null;class vo extends vn{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Mn(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=Nn(t[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 bo(e){let t=Ii.fromClass(class{constructor(t){this.view=t,this.placeholder=e?xn.set([xn.widget({widget:new vo(e),side:1}).range(0)]):xn.none}get decorations(){return this.view.state.doc.length?xn.none:this.placeholder}},{decorations:e=>e.decorations});return"string"==typeof e?[t,ro.contentAttributes.of({"aria-placeholder":e})]:t}const xo="-10000px";class yo{constructor(e,t,n,i){this.facet=t,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let r=null;this.tooltipViews=this.tooltips.map(e=>r=n(e,r))}update(e,t){var n;let i=e.state.facet(this.facet),r=i.filter(e=>e);if(i===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let s=[],o=t?[]:null;for(let n=0;n<r.length;n++){let i=r[n],l=-1;if(i){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==i.create&&(l=e)}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]=t[l]),i.update&&i.update(e)}}}for(let e of this.tooltipViews)s.indexOf(e)<0&&(this.removeTooltipView(e),null===(n=e.destroy)||void 0===n||n.call(e));return t&&(o.forEach((e,n)=>t[n]=e),t.length=o.length),this.input=i,this.tooltips=r,this.tooltipViews=s,!0}}function wo(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const Co=je.define({combine:e=>{var t,n,i;return{position:dn.ios?"absolute":(null===(t=e.find(e=>e.position))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find(e=>e.parent))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=e.find(e=>e.tooltipSpace))||void 0===i?void 0:i.tooltipSpace)||wo}}}),ko=new WeakMap,_o=Ii.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Co);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new yo(e,Oo,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(Co);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),i=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=xo,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(dn.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),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((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(Co).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{visible:n,space:i,scaleX:r,scaleY:s}=e,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],c=this.manager.tooltipViews[l],{dom:h}=c,u=e.pos[l],d=e.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)){h.style.top=xo;continue}let f=a.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=d.right-d.left,m=null!==(t=ko.get(c))&&void 0!==t?t:d.bottom-d.top,A=c.offset||To,v=this.view.textDirection==Jn.LTR,b=d.width>i.right-i.left?v?i.left:i.right-d.width:v?Math.max(i.left,Math.min(u.left-(f?14:0)+A.x,i.right-g)):Math.min(Math.max(i.left,u.left-g+(f?14:0)-A.x),i.right-g),x=this.above[l];!a.strictSide&&(x?u.top-m-p-A.y<i.top:u.bottom+m+p+A.y>i.bottom)&&x==i.bottom-u.bottom>u.top-i.top&&(x=this.above[l]=!x);let y=(x?u.top-i.top:i.bottom-u.bottom)-p;if(y<m&&!1!==c.resize){if(y<this.view.defaultLineHeight){h.style.top=xo;continue}ko.set(c,m),h.style.height=(m=y)/s+"px"}else h.style.height&&(h.style.height="");let w=x?u.top-m-p-A.y:u.bottom+p+A.y,C=b+g;if(!0!==c.overlap)for(let e of o)e.left<C&&e.right>b&&e.top<w+m&&e.bottom>w&&(w=x?e.top-m-2-p:e.bottom+p+2);if("absolute"==this.position?(h.style.top=(w-e.parent.top)/s+"px",So(h,(b-e.parent.left)/r)):(h.style.top=w/s+"px",So(h,b/r)),f){let e=u.left+(v?A.x:-A.x)-(b+14-7);f.style.left=e/r+"px"}!0!==c.overlap&&o.push({left:b,top:w,right:C,bottom:w+m}),h.classList.toggle("cm-tooltip-above",x),h.classList.toggle("cm-tooltip-below",!x),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=xo}},{eventObservers:{scroll(){this.maybeMeasure()}}});function So(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const Eo=ro.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"}}}),To={x:0,y:0},Oo=je.define({enables:[_o,Eo]}),Mo=je.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])});class Bo{static create(e){return new Bo(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new yo(e,Mo,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let i=n[e];if(void 0!==i)if(void 0===t)t=i;else if(t!==i)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Do=Oo.compute([Mo],e=>{let t=e.facet(Mo);return 0===t.length?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos})),create:Bo.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class Ro{constructor(e,t,n,i,r){this.view=e,this.source=t,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:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let i,r=1;if(n.isWidget())i=n.posAtStart;else{if(i=e.posAtCoords(t),null==i)return;let n=e.coordsAtPos(i);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let s=e.bidiSpans(e.state.doc.lineAt(i)).find(e=>e.from<=i&&e.to>=i),o=s&&s.dir==Jn.RTL?-1:1;r=t.x<n.left?-o:o}let s=this.source(e,i,r);if(null==s?void 0:s.then){let t=this.pending={pos:i};s.then(n=>{this.pending==t&&(this.pending=null,!n||Array.isArray(n)&&!n.length||e.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))},t=>Mi(e.state,t,"hover tooltip"))}else!s||Array.isArray(s)&&!s.length||e.dispatch({effects:this.setHover.of(Array.isArray(s)?s:[s])})}get tooltip(){let e=this.view.plugin(_o),t=e?e.manager.tooltips.findIndex(e=>e.create==Bo.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:r}=this;if(i.length&&r&&!function(e,t){let n,{left:i,right:r,top:s,bottom:o}=e.getBoundingClientRect();if(n=e.querySelector(".cm-tooltip-arrow")){let e=n.getBoundingClientRect();s=Math.min(e.top,s),o=Math.max(e.bottom,o)}return t.clientX>=i-Io&&t.clientX<=r+Io&&t.clientY>=s-Io&&t.clientY<=o+Io}(r.dom,e)||this.pending){let{pos:r}=i[0]||this.pending,s=null!==(n=null===(t=i[0])||void 0===t?void 0:t.end)&&void 0!==n?n:r;(r==s?this.view.posAtCoords(this.lastMove)==r:function(e,t,n,i,r){let s=e.scrollDOM.getBoundingClientRect(),o=e.documentTop+e.documentPadding.top+e.contentHeight;if(s.left>i||s.right<i||s.top>r||Math.min(s.bottom,o)<r)return!1;let l=e.posAtCoords({x:i,y:r},!1);return l>=t&&l<=n}(this.view,r,s,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Io=4;function Po(e,t={}){let n=ut.define(),i=Ue.define({create:()=>[],update(e,i){if(e.length&&(t.hideOnChange&&(i.docChanged||i.selection)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(i,e))),i.docChanged)){let t=[];for(let n of e){let e=i.changes.mapPos(n.pos,-1,Se.TrackDel);if(null!=e){let r=Object.assign(Object.create(null),n);r.pos=e,null!=r.end&&(r.end=i.changes.mapPos(r.end)),t.push(r)}}e=t}for(let t of i.effects)t.is(n)&&(e=t.value),t.is(Lo)&&(e=[]);return e},provide:e=>Mo.from(e)});return{active:i,extension:[i,Ii.define(r=>new Ro(r,e,i,n,t.hoverTime||300)),Do]}}function No(e,t){let n=e.plugin(_o);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}const Lo=ut.define(),Fo=je.define({combine(e){let t,n;for(let i of e)t=t||i.topContainer,n=n||i.bottomContainer;return{topContainer:t,bottomContainer:n}}}),jo=Ii.fromClass(class{constructor(e){this.input=e.state.facet(Wo),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(Fo);this.top=new zo(e,!0,t.topContainer),this.bottom=new zo(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(Fo);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new zo(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new zo(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Wo);if(n!=this.input){let t=n.filter(e=>e),i=[],r=[],s=[],o=[];for(let n of t){let t,l=this.specs.indexOf(n);l<0?(t=n(e.view),o.push(t)):(t=this.panels[l],t.update&&t.update(e)),i.push(t),(t.top?r:s).push(t)}this.specs=t,this.panels=i,this.top.sync(r),this.bottom.sync(s);for(let e of o)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>ro.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class zo{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Vo(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Vo(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Vo(e){let t=e.nextSibling;return e.remove(),t}const Wo=je.define({enables:jo});class Ho extends kt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ho.prototype.elementClass="",Ho.prototype.toDOM=void 0,Ho.prototype.mapMode=Se.TrackBefore,Ho.prototype.startSide=Ho.prototype.endSide=-1,Ho.prototype.point=!0;const qo=je.define(),$o=je.define(),Uo={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ot.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Ko=je.define();function Go(e){return[Jo(),Ko.of({...Uo,...e})]}const Yo=je.define({combine:e=>e.some(e=>e)});function Jo(e){let t=[Qo];return e&&!1===e.fixed&&t.push(Yo.of(!0)),t}const Qo=Ii.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(Ko).map(t=>new tl(e,t)),this.fixed=!e.state.facet(Yo);for(let e of this.gutters)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,i=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(i<.8*(n.to-n.from))}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Yo)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Ot.iter(this.view.state.facet(qo),this.view.viewport.from),i=[],r=this.gutters.map(e=>new el(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(e.type)){let t=!0;for(let s of e.type)if(s.type==bn.Text&&t){Zo(n,i,s.from);for(let e of r)e.line(this.view,s,i);t=!1}else if(s.widget)for(let e of r)e.widget(this.view,s)}else if(e.type==bn.Text){Zo(n,i,e.from);for(let t of r)t.line(this.view,e,i)}else if(e.widget)for(let t of r)t.widget(this.view,e);for(let e of r)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(Ko),n=e.state.facet(Ko),i=e.docChanged||e.heightChanged||e.viewportChanged||!Ot.eq(e.startState.facet(qo),e.state.facet(qo),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(i=!0);else{i=!0;let r=[];for(let i of n){let n=t.indexOf(i);n<0?r.push(new tl(this.view,i)):(this.gutters[n].update(e),r.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),r.indexOf(e)<0&&e.destroy();for(let e of r)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=r}return i}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>ro.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||0==n.gutters.length||!n.fixed)return null;let i=n.dom.offsetWidth*t.scaleX,r=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==Jn.LTR?{left:i,right:r}:{right:i,left:r}})});function Xo(e){return Array.isArray(e)?e:[e]}function Zo(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class el{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Ot.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,r=(t.top-this.height)/e.scaleY,s=t.height/e.scaleY;if(this.i==i.elements.length){let t=new nl(e,s,r,n);i.elements.push(t),i.dom.appendChild(t.dom)}else i.elements[this.i].update(e,s,r,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];Zo(this.cursor,i,t.from),n.length&&(i=i.concat(n));let r=this.gutter.config.lineMarker(e,t,i);r&&i.unshift(r);let s=this.gutter;(0!=i.length||s.config.renderEmptyElements)&&this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),i=n?[n]:null;for(let n of e.state.facet($o)){let r=n(e,t.widget,t);r&&(i||(i=[])).push(r)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class tl{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,i=>{let r,s=i.target;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let e=s.getBoundingClientRect();r=(e.top+e.bottom)/2}else r=i.clientY;let o=e.lineBlockAtHeight(r-e.documentTop);t.domEventHandlers[n](e,o,i)&&i.preventDefault()});this.markers=Xo(t.markers(e)),t.initialSpacer&&(this.spacer=new nl(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Xo(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!Ot.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class nl{constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let n="cm-gutterElement",i=this.dom.firstChild;for(let r=0,s=0;;){let o=s,l=r<t.length?t[r++]:null,a=!1;if(l){let e=l.elementClass;e&&(n+=" "+e);for(let e=s;e<this.markers.length;e++)if(this.markers[e].compare(l)){o=e,a=!0;break}}else o=this.markers.length;for(;s<o;){let e=this.markers[s++];if(e.toDOM){e.destroy(i);let t=i.nextSibling;i.remove(),i=t}}if(!l)break;l.toDOM&&(a?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),a&&s++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}const il=1024;let rl=0;class sl{constructor(e,t){this.from=e,this.to=t}}class ol{constructor(e={}){this.id=rl++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=cl.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}ol.closedBy=new ol({deserialize:e=>e.split(" ")}),ol.openedBy=new ol({deserialize:e=>e.split(" ")}),ol.group=new ol({deserialize:e=>e.split(" ")}),ol.isolate=new ol({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),ol.contextHash=new ol({perNode:!0}),ol.lookAhead=new ol({perNode:!0}),ol.mounted=new ol({perNode:!0});class ll{constructor(e,t,n,i=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=i}static get(e){return e&&e.props&&e.props[ol.mounted.id]}}const al=Object.create(null);class cl{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):al,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),i=new cl(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return i}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(ol.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return e=>{for(let n=e.prop(ol.group),i=-1;i<(n?n.length:0);i++){let r=t[i<0?e.name:n[i]];if(r)return r}}}}cl.none=new cl("",Object.create(null),0,8);class hl{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let i=null;for(let t of e){let e=t(n);if(e){i||(i=Object.assign({},n.props));let t=e[1],r=e[0];r.combine&&r.id in i&&(t=r.combine(i[r.id],t)),i[r.id]=t}}t.push(i?new cl(n.name,i,n.id,n.flags):n)}return new hl(t)}}const ul=new WeakMap,dl=new WeakMap;var fl;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"}(fl||(fl={}));class pl{constructor(e,t,n,i,r){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,r&&r.length){this.props=Object.create(null);for(let[e,t]of r)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=ll.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let n=e.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new El(this.topNode,e)}cursorAt(e,t=0,n=0){let i=ul.get(this)||this.topNode,r=new El(i);return r.moveTo(e,t),ul.set(this,r._tree),r}get topNode(){return new xl(this,0,0,null)}resolve(e,t=0){let n=vl(ul.get(this)||this.topNode,e,t,!1);return ul.set(this,n),n}resolveInner(e,t=0){let n=vl(dl.get(this)||this.topNode,e,t,!0);return dl.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let i=e.resolveInner(t,n),r=null;for(let e=i instanceof xl?i:i.context.parent;e;e=e.parent)if(e.index<0){let s=e.parent;(r||(r=[i])).push(s.resolve(t,n)),e=s}else{let s=ll.get(e.tree);if(s&&s.overlay&&s.overlay[0].from<=t&&s.overlay[s.overlay.length-1].to>=t){let o=new xl(s.tree,s.overlay[0].from+e.from,-1,e);(r||(r=[i])).push(vl(o,t,n,!1))}}return r?_l(r):i}(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:r=this.length}=e,s=e.mode||0,o=(s&fl.IncludeAnonymous)>0;for(let e=this.cursor(s|fl.IncludeAnonymous);;){let s=!1;if(e.from<=r&&e.to>=i&&(!o&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;s=!0}for(;s&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;s=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Bl(cl.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new pl(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new pl(cl.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=il,reused:s=[],minRepeatType:o=i.types.length}=e,l=Array.isArray(n)?new gl(n,n.length):n,a=i.types,c=0,h=0;function u(e,t,n,m,A,v){let{id:b,start:x,end:y,size:w}=l,C=h,k=c;if(w<0){if(l.next(),-1==w){let t=s[b];return n.push(t),void m.push(x-e)}if(-3==w)return void(c=b);if(-4==w)return void(h=b);throw new RangeError(`Unrecognized record size: ${w}`)}let _,S,E=a[b],T=x-e;if(y-x<=r&&(S=function(e,t){let n=l.fork(),i=0,s=0,a=0,c=n.end-r,h={size:0,start:0,skip:0};e:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){h.size=i,h.start=s,h.skip=a,a+=4,i+=4,n.next();continue}let l=n.pos-e;if(e<0||l<r||n.start<c)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&&-4!=n.size)break e;u+=4}else n.id>=o&&(u+=4);n.next()}s=d,i+=e,a+=u}return(t<0||i==e)&&(h.size=i,h.start=s,h.skip=a),h.size>4?h:void 0}(l.pos-t,A))){let t=new Uint16Array(S.size-S.skip),n=l.pos-S.size,r=t.length;for(;l.pos>n;)r=g(S.start,t,r);_=new ml(t,y-S.start,i),T=S.start-e}else{let e=l.pos-w;l.next();let t=[],n=[],i=b>=o?b:-1,s=0,a=y;for(;l.pos>e;)i>=0&&l.id==i&&l.size>=0?(l.end<=a-r&&(f(t,n,x,s,l.end,a,i,C,k),s=t.length,a=l.end),l.next()):v>2500?d(x,e,t,n):u(x,e,t,n,i,v+1);if(i>=0&&s>0&&s<t.length&&f(t,n,x,s,x,a,i,C,k),t.reverse(),n.reverse(),i>-1&&s>0){let e=function(e,t){return(n,i,r)=>{let s,o,l=0,a=n.length-1;if(a>=0&&(s=n[a])instanceof pl){if(!a&&s.type==e&&s.length==r)return s;(o=s.prop(ol.lookAhead))&&(l=i[a]+s.length+o)}return p(e,n,i,r,l,t)}}(E,k);_=Bl(E,t,n,0,t.length,0,y-x,e,e)}else _=p(E,t,n,y-x,C-y,k)}n.push(_),m.push(T)}function d(e,t,n,s){let o=[],a=0,c=-1;for(;l.pos>t;){let{id:e,start:t,end:n,size:i}=l;if(i>4)l.next();else{if(c>-1&&t<c)break;c<0&&(c=n-r),o.push(e,t,n),a++,l.next()}}if(a){let t=new Uint16Array(4*a),r=o[o.length-2];for(let e=o.length-3,n=0;e>=0;e-=3)t[n++]=o[e],t[n++]=o[e+1]-r,t[n++]=o[e+2]-r,t[n++]=n;n.push(new ml(t,o[2]-r,i)),s.push(r-e)}}function f(e,t,n,r,s,o,l,a,c){let h=[],u=[];for(;e.length>r;)h.push(e.pop()),u.push(t.pop()+n-s);e.push(p(i.types[l],h,u,o-s,a-o,c)),t.push(s-n)}function p(e,t,n,i,r,s,o){if(s){let e=[ol.contextHash,s];o=o?[e].concat(o):[e]}if(r>25){let e=[ol.lookAhead,r];o=o?[e].concat(o):[e]}return new pl(e,t,n,i,o)}function g(e,t,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(e,t,n)}t[--n]=o,t[--n]=s-e,t[--n]=r-e,t[--n]=i}else-3==a?c=i:-4==a&&(h=i);return n}let m=[],A=[];for(;l.pos>0;)u(e.start||0,e.bufferStart||0,m,A,-1,0);let v=null!==(t=e.length)&&void 0!==t?t:m.length?A[0]+m[0].length:0;return new pl(a[e.topID],m.reverse(),A.reverse(),v)}(e)}}pl.empty=new pl(cl.none,[],[],0);class gl{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new gl(this.buffer,this.index)}}class ml{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return cl.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),n==(e+=4))return r;let s=[];for(;e<n;)s.push(this.childString(e)),e=this.buffer[e+3];return r+"("+s.join(",")+")"}findChild(e,t,n,i,r){let{buffer:s}=this,o=-1;for(let l=e;l!=t&&!(Al(r,i,s[l+1],s[l+2])&&(o=l,n>0));l=s[l+3]);return o}slice(e,t,n){let i=this.buffer,r=new Uint16Array(t-e),s=0;for(let o=e,l=0;o<t;){r[l++]=i[o++],r[l++]=i[o++]-n;let t=r[l++]=i[o++]-n;r[l++]=i[o++]-e,s=Math.max(s,t)}return new ml(r,s,this.set)}}function Al(e,t,n,i){switch(e){case-2:return n<t;case-1:return i>=t&&n<t;case 0:return n<t&&i>t;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function vl(e,t,n,i){for(var r;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!i&&e instanceof xl&&e.index<0?null:e.parent;if(!t)return e;e=t}let s=i?0:fl.IgnoreOverlays;if(i)for(let i=e,o=i.parent;o;i=o,o=i.parent)i instanceof xl&&i.index<0&&(null===(r=o.enter(t,n,s))||void 0===r?void 0:r.from)!=i.from&&(e=o);for(;;){let i=e.enter(t,n,s);if(!i)return e;e=i}}class bl{cursor(e=0){return new El(this,e)}getChild(e,t=null,n=null){let i=yl(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return yl(this,e,t,n)}resolve(e,t=0){return vl(this,e,t,!1)}resolveInner(e,t=0){return vl(this,e,t,!0)}matchContext(e){return wl(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class xl extends bl{constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,r=0){for(let s=this;;){for(let{children:o,positions:l}=s._tree,a=t>0?o.length:-1;e!=a;e+=t){let a,c=o[e],h=l[e]+s.from;if(r&fl.EnterBracketed&&c instanceof pl&&(a=ll.get(c))&&!a.overlay&&a.bracketed&&n>=h&&n<=h+c.length||Al(i,n,h,h+c.length))if(c instanceof ml){if(r&fl.ExcludeBuffers)continue;let o=c.findChild(0,c.buffer.length,t,n-h,i);if(o>-1)return new kl(new Cl(s,c,e,h),null,o)}else if(r&fl.IncludeAnonymous||!c.type.isAnonymous||Tl(c)){let o;if(!(r&fl.IgnoreMounts)&&(o=ll.get(c))&&!o.overlay)return new xl(o.tree,h,e,s);let l=new xl(c,h,e,s);return r&fl.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(t<0?c.children.length-1:0,t,n,i,r)}}if(r&fl.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+t:t<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(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let i;if(!(n&fl.IgnoreOverlays)&&(i=ll.get(this._tree))&&i.overlay){let r=e-this.from,s=n&fl.EnterBracketed&&i.bracketed;for(let{from:e,to:n}of i.overlay)if((t>0||s?e<=r:e<r)&&(t<0||s?n>=r:n>r))return new xl(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function yl(e,t,n,i){let r=e.cursor(),s=[];if(!r.firstChild())return s;if(null!=n)for(let e=!1;!e;)if(e=r.type.is(n),!r.nextSibling())return s;for(;;){if(null!=i&&r.type.is(i))return s;if(r.type.is(t)&&s.push(r.node),!r.nextSibling())return null==i?s:[]}}function wl(e,t,n=t.length-1){for(let i=e;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class Cl{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class kl extends bl{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new kl(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&fl.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new kl(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new kl(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new kl(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,r=n.buffer[this.index+3];if(r>i){let s=n.buffer[this.index+1];e.push(n.slice(i,r,s)),t.push(0)}return new pl(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function _l(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let r=e[i];(r.from>n.from||r.to<n.to)&&(n=r,t=i)}let i=n instanceof xl&&n.index<0?null:n.parent,r=e.slice();return i?r[t]=i:r.splice(t,1),new Sl(r,n)}class Sl{constructor(e,t){this.heads=e,this.node=t}get next(){return _l(this.heads)}}class El{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~fl.EnterBracketed,e instanceof xl)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return!!e&&(e instanceof xl?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?!(n&fl.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&fl.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&fl.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(i.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;({index:t,_parent:n}=n))if(t>-1)for(let i=t+e,r=e<0?-1:n._tree.children.length;i!=r;i+=e){let e=n._tree.children[i];if(this.mode&fl.IncludeAnonymous||e instanceof ml||!e.type.isAnonymous||Tl(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,r=this.stack.length;r>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;t=s,n=r+1;break e}i=this.stack[--r]}for(let e=n;e<this.stack.length;e++)t=new kl(this.buffer,t,this.stack[e]);return this.bufferNode=new kl(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return wl(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return wl(this._tree,e,i);let s=n[t.buffer[this.stack[r]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function Tl(e){return e.children.some(e=>e instanceof ml||!e.type.isAnonymous||Tl(e))}const Ol=new WeakMap;function Ml(e,t){if(!e.isAnonymous||t instanceof ml||t.type!=e)return 1;let n=Ol.get(t);if(null==n){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof pl)){n=1;break}n+=Ml(e,i)}Ol.set(t,n)}return n}function Bl(e,t,n,i,r,s,o,l,a){let c=0;for(let n=i;n<r;n++)c+=Ml(e,t[n]);let h=Math.ceil(1.5*c/8),u=[],d=[];return function t(n,i,r,o,l){for(let c=r;c<o;){let r=c,f=i[c],p=Ml(e,n[c]);for(c++;c<o;c++){let t=Ml(e,n[c]);if(p+t>=h)break;p+=t}if(c==r+1){if(p>h){let e=n[r];t(e.children,e.positions,0,e.children.length,i[r]+l);continue}u.push(n[r])}else{let t=i[c-1]+n[c-1].length-f;u.push(Bl(e,n,i,r,c,f,t,null,a))}d.push(f+l-s)}}(t,n,i,r,0),(l||a)(u,d,o)}class Dl{constructor(e,t,n,i,r=!1,s=!1){this.from=e,this.to=t,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(e,t=[],n=!1){let i=[new Dl(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],r=1,s=e.length?e[0]:null;for(let o=0,l=0,a=0;;o++){let c=o<t.length?t[o]:null,h=c?c.fromA:1e9;if(h-l>=n)for(;s&&s.from<h;){let t=s;if(l>=t.from||h<=t.to||a){let e=Math.max(t.from,l)-a,n=Math.min(t.to,h)-a;t=e>=n?null:new Dl(e,n,t.tree,t.offset+a,o>0,!!c)}if(t&&i.push(t),s.to>h)break;s=r<e.length?e[r++]:null}if(!c)break;l=c.toA,a=c.toA-c.toB}return i}}class Rl{startParse(e,t,n){return"string"==typeof e&&(e=new Il(e)),n=n?n.length?n.map(e=>new sl(e.from,e.to)):[new sl(0,0)]:[new sl(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let e=i.advance();if(e)return e}}}class Il{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new ol({perNode:!0});let Pl=0;class Nl{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=Pl++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof Nl&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let i=new Nl(n,[],null,[]);if(i.set.push(i),t)for(let e of t.set)i.set.push(e);return i}static defineModifier(e){let t=new Fl(e);return e=>e.modified.indexOf(t)>-1?e:Fl.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let Ll=0;class Fl{constructor(e){this.name=e,this.instances=[],this.id=Ll++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(n=>{return n.base==e&&(i=t,r=n.modified,i.length==r.length&&i.every((e,t)=>e==r[t]));var i,r});if(n)return n;let i=[],r=new Nl(e.name,i,e,t);for(let e of t)e.instances.push(r);let s=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let i=0,r=t.length;i<r;i++)t.push(t[i].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of s)i.push(Fl.get(t,e));return r}}function jl(e){let t=Object.create(null);for(let n in e){let i=e[n];Array.isArray(i)||(i=[i]);for(let e of n.split(" "))if(e){let n=[],r=2,s=e;for(let t=0;;){if("..."==s&&t>0&&t+3==e.length){r=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!i)throw new RangeError("Invalid path: "+e);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),t+=i[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&"!"==o){r=0;break}if("/"!=o)throw new RangeError("Invalid path: "+e);s=e.slice(t)}let o=n.length-1,l=n[o];if(!l)throw new RangeError("Invalid path: "+e);let a=new Vl(i,r,o>0?n.slice(0,o):null);t[l]=a.sort(t[l])}}return zl.add(t)}const zl=new ol({combine(e,t){let n,i,r;for(;e||t;){if(!e||t&&e.depth>=t.depth?(r=t,t=t.next):(r=e,e=e.next),n&&n.mode==r.mode&&!r.context&&!n.context)continue;let s=new Vl(r.tags,r.mode,r.context);n?n.next=s:i=s,n=s}return i}});class Vl{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function Wl(e,t){let n=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)n[e.id]=t.class;else n[t.tag.id]=t.class;let{scope:i,all:r=null}=t||{};return{style:e=>{let t=r;for(let i of e)for(let e of i.set){let i=n[e.id];if(i){t=t?t+" "+i:i;break}}return t},scope:i}}function Hl(e,t,n,i=0,r=e.length){let s=new ql(i,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),i,r,"",s.highlighters),s.flush(r)}Vl.empty=new Vl([],2,null);class ql{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,i,r){let{type:s,from:o,to:l}=e;if(o>=n||l<=t)return;s.isTop&&(r=this.highlighters.filter(e=>!e.scope||e.scope(s)));let a=i,c=function(e){let t=e.type.prop(zl);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||Vl.empty,h=function(e,t){let n=null;for(let i of e){let e=i.style(t);e&&(n=n?n+" "+e:e)}return n}(r,c.tags);if(h&&(a&&(a+=" "),a+=h,1==c.mode&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(t,o),a),c.opaque)return;let u=e.tree&&e.tree.prop(ol.mounted);if(u&&u.overlay){let s=e.node.enter(u.overlay[0].from+o,1),c=this.highlighters.filter(e=>!e.scope||e.scope(u.tree.type)),h=e.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(t,f),A=Math.min(n,g);if(m<A&&h)for(;e.from<A&&(this.highlightRange(e,m,A,i,r),this.startSpan(Math.min(A,e.to),a),!(e.to>=g)&&e.nextSibling()););if(!p||g>n)break;f=p.to+o,f>t&&(this.highlightRange(s.cursor(),Math.max(t,p.from+o),Math.min(n,f),"",c),this.startSpan(Math.min(n,f),a))}h&&e.parent()}else if(e.firstChild()){u&&(i="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,r),this.startSpan(Math.min(n,e.to),a)}}while(e.nextSibling());e.parent()}}}const $l=Nl.define,Ul=$l(),Kl=$l(),Gl=$l(Kl),Yl=$l(Kl),Jl=$l(),Ql=$l(Jl),Xl=$l(Jl),Zl=$l(),ea=$l(Zl),ta=$l(),na=$l(),ia=$l(),ra=$l(ia),sa=$l(),oa={comment:Ul,lineComment:$l(Ul),blockComment:$l(Ul),docComment:$l(Ul),name:Kl,variableName:$l(Kl),typeName:Gl,tagName:$l(Gl),propertyName:Yl,attributeName:$l(Yl),className:$l(Kl),labelName:$l(Kl),namespace:$l(Kl),macroName:$l(Kl),literal:Jl,string:Ql,docString:$l(Ql),character:$l(Ql),attributeValue:$l(Ql),number:Xl,integer:$l(Xl),float:$l(Xl),bool:$l(Jl),regexp:$l(Jl),escape:$l(Jl),color:$l(Jl),url:$l(Jl),keyword:ta,self:$l(ta),null:$l(ta),atom:$l(ta),unit:$l(ta),modifier:$l(ta),operatorKeyword:$l(ta),controlKeyword:$l(ta),definitionKeyword:$l(ta),moduleKeyword:$l(ta),operator:na,derefOperator:$l(na),arithmeticOperator:$l(na),logicOperator:$l(na),bitwiseOperator:$l(na),compareOperator:$l(na),updateOperator:$l(na),definitionOperator:$l(na),typeOperator:$l(na),controlOperator:$l(na),punctuation:ia,separator:$l(ia),bracket:ra,angleBracket:$l(ra),squareBracket:$l(ra),paren:$l(ra),brace:$l(ra),content:Zl,heading:ea,heading1:$l(ea),heading2:$l(ea),heading3:$l(ea),heading4:$l(ea),heading5:$l(ea),heading6:$l(ea),contentSeparator:$l(Zl),list:$l(Zl),quote:$l(Zl),emphasis:$l(Zl),strong:$l(Zl),link:$l(Zl),monospace:$l(Zl),strikethrough:$l(Zl),inserted:$l(),deleted:$l(),changed:$l(),invalid:$l(),meta:sa,documentMeta:$l(sa),annotation:$l(sa),processingInstruction:$l(sa),definition:Nl.defineModifier("definition"),constant:Nl.defineModifier("constant"),function:Nl.defineModifier("function"),standard:Nl.defineModifier("standard"),local:Nl.defineModifier("local"),special:Nl.defineModifier("special")};for(let e in oa){let t=oa[e];t instanceof Nl&&(t.name=e)}var la;Wl([{tag:oa.link,class:"tok-link"},{tag:oa.heading,class:"tok-heading"},{tag:oa.emphasis,class:"tok-emphasis"},{tag:oa.strong,class:"tok-strong"},{tag:oa.keyword,class:"tok-keyword"},{tag:oa.atom,class:"tok-atom"},{tag:oa.bool,class:"tok-bool"},{tag:oa.url,class:"tok-url"},{tag:oa.labelName,class:"tok-labelName"},{tag:oa.inserted,class:"tok-inserted"},{tag:oa.deleted,class:"tok-deleted"},{tag:oa.literal,class:"tok-literal"},{tag:oa.string,class:"tok-string"},{tag:oa.number,class:"tok-number"},{tag:[oa.regexp,oa.escape,oa.special(oa.string)],class:"tok-string2"},{tag:oa.variableName,class:"tok-variableName"},{tag:oa.local(oa.variableName),class:"tok-variableName tok-local"},{tag:oa.definition(oa.variableName),class:"tok-variableName tok-definition"},{tag:oa.special(oa.variableName),class:"tok-variableName2"},{tag:oa.definition(oa.propertyName),class:"tok-propertyName tok-definition"},{tag:oa.typeName,class:"tok-typeName"},{tag:oa.namespace,class:"tok-namespace"},{tag:oa.className,class:"tok-className"},{tag:oa.macroName,class:"tok-macroName"},{tag:oa.propertyName,class:"tok-propertyName"},{tag:oa.operator,class:"tok-operator"},{tag:oa.comment,class:"tok-comment"},{tag:oa.meta,class:"tok-meta"},{tag:oa.invalid,class:"tok-invalid"},{tag:oa.punctuation,class:"tok-punctuation"}]);const aa=new ol;const ca=new ol;class ha{constructor(e,t,n=[],i=""){this.data=e,this.name=i,wt.prototype.hasOwnProperty("tree")||Object.defineProperty(wt.prototype,"tree",{get(){return fa(this)}}),this.parser=t,this.extension=[wa.of(this),wt.languageData.of((e,t,n)=>{let i=ua(e,t,n),r=i.type.prop(aa);if(!r)return[];let s=e.facet(r),o=i.type.prop(ca);if(o){let r=i.resolve(t-i.from,n);for(let t of o)if(t.test(r,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(s)}}return s})].concat(n)}isActiveAt(e,t,n=-1){return ua(e,t,n).type.prop(aa)==this.data}findRegions(e){let t=e.facet(wa);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(e,t)=>{if(e.prop(aa)==this.data)return void n.push({from:t,to:t+e.length});let r=e.prop(ol.mounted);if(r){if(r.tree.prop(aa)==this.data){if(r.overlay)for(let e of r.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(r.overlay){let e=n.length;if(i(r.tree,r.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let r=e.children[n];r instanceof pl&&i(r,e.positions[n]+t)}};return i(fa(e),0),n}get allowsNesting(){return!0}}function ua(e,t,n){let i=e.facet(wa),r=fa(e).topNode;if(!i||i.allowsNesting)for(let e=r;e;e=e.enter(t,n,fl.ExcludeBuffers|fl.EnterBracketed))e.type.isTop&&(r=e);return r}ha.setState=ut.define();class da extends ha{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=(n=e.languageData,je.define({combine:n?e=>e.concat(n):void 0}));var n;return new da(t,e.parser.configure({props:[aa.add(e=>e.isTop?t:void 0)]}),e.name)}configure(e,t){return new da(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function fa(e){let t=e.field(ha.state,!1);return t?t.tree:pl.empty}class pa{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let ga=null;class ma{constructor(e,t,n=[],i,r,s,o,l){this.parser=e,this.state=t,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(e,t,n){return new ma(e,t,[],pl.empty,0,n,[],null)}startParse(){return this.parser.startParse(new pa(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=pl.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i){if(this.fragments=this.withoutTempSkipped(Dl.addTree(i,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=i,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Dl.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=ga;ga=this;try{return e()}finally{ga=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Aa(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:r,viewport:s,skipped:o}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges((e,n,i,r)=>t.push({fromA:e,toA:n,fromB:i,toB:r})),n=Dl.applyChanges(n,t),i=pl.empty,r=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){o=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);n<i&&o.push({from:n,to:i})}}}return new ma(this.parser,t,n,i,r,s,o,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:i}=this.skipped[t];n<e.to&&i>e.from&&(this.fragments=Aa(this.fragments,n,i),this.skipped.splice(t--,1))}return!(this.skipped.length>=t||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Rl{createParse(t,n,i){let r=i[0].from,s=i[i.length-1].to;return{parsedPos:r,advance(){let t=ga;if(t){for(let e of i)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=s,new pl(cl.none,[],[],s-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return ga}}function Aa(e,t,n){return Dl.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class va{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new va(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=ma.create(e.facet(wa).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new va(n)}}ha.state=Ue.define({create:va.init,update(e,t){for(let e of t.effects)if(e.is(ha.setState))return e.value;return t.startState.facet(wa)!=t.state.facet(wa)?va.init(t.state):e.apply(t)}});let ba=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(ba=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const xa="undefined"!=typeof navigator&&(null===(la=navigator.scheduling)||void 0===la?void 0:la.isInputPending)?()=>navigator.scheduling.isInputPending():null,ya=Ii.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(ha.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(ha.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=ba(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,r=n.field(ha.state);if(r.tree==r.context.tree&&r.context.isDone(i+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!xa?Math.max(25,e.timeRemaining()-5):1e9),o=r.context.treeLen<i&&n.doc.length>i+1e3,l=r.context.work(()=>xa&&xa()||Date.now()>s,i+(o?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:ha.setState.of(new va(r.context))})),this.chunkBudget>0&&(!l||o)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Mi(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),wa=je.define({combine:e=>e.length?e[0]:null,enables:e=>[ha.state,ya,ro.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class Ca{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const ka=je.define(),_a=je.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function Sa(e){let t=e.facet(_a);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function Ea(e,t){let n="",i=e.tabSize,r=e.facet(_a)[0];if("\t"==r){for(;t>=i;)n+="\t",t-=i;r=" "}for(let e=0;e<t;e++)n+=r;return n}function Ta(e,t){e instanceof wt&&(e=new Oa(e));for(let n of e.state.facet(ka)){let i=n(e,t);if(void 0!==i)return i}let n=fa(e.state);return n.length>=t?function(e,t,n){let i=t.resolveStack(n),r=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=i.node){let e=[];for(let t=r;t&&!(t.from<i.node.from||t.to>i.node.to||t.from==i.node.from&&t.type==i.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)i={node:e[t],next:i}}return Ba(i,e,n)}(e,n,t):null}class Oa{constructor(e,t={}){this.state=e,this.options=t,this.unit=Sa(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:r}=this.options;return null!=i&&i>=n.from&&i<=n.to?r&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.countColumn(n,e-i),s=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return s>-1&&(r+=s-this.countColumn(n,n.search(/\S|$/))),r}countColumn(e,t=e.length){return Vt(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let e=r(i);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ma=new ol;function Ba(e,t,n){for(let i=e;i;i=i.next){let e=Da(i.node);if(e)return e(Ia.create(t,n,i))}return 0}function Da(e){let t=e.type.prop(Ma);if(t)return t;let n,i=e.firstChild;if(i&&(n=i.type.prop(ol.closedBy))){let t=e.lastChild,i=t&&n.indexOf(t.name)>-1;return e=>function(e,t,n,i,r){let s=e.textAfter,o=s.match(/^\s*/)[0].length,l=i&&s.slice(o,o+i.length)==i||r==e.pos+o,a=t?function(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,s=e.state.doc.lineAt(n.from),o=null==r||r<=s.from?s.to:Math.min(s.to,r);for(let e=n.to;;){let r=t.childAfter(e);if(!r||r==i)return null;if(!r.type.isSkipped){if(r.from>=o)return null;let e=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+e}}e=r.to}}(e):null;return a?l?e.column(a.from):e.column(a.to):e.baseIndent+(l?0:e.unit*n)}(e,!0,1,void 0,i&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?Ra:null}function Ra(){return 0}class Ia extends Oa{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new Ia(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Pa(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Ba(this.context.next,this.base,this.pos)}}function Pa(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Na({except:e,units:t=1}={}){return n=>{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}const La=je.define(),Fa=new ol;function ja(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function za(e,t,n){for(let i of e.facet(La)){let r=i(e,t,n);if(r)return r}return function(e,t,n){let i=fa(e);if(i.length<n)return null;let r=null;for(let s=i.resolveStack(n,1);s;s=s.next){let o=s.node;if(o.to<=n||o.from>n)continue;if(r&&o.from<t)break;let l=o.type.prop(Fa);if(l&&(o.to<i.length-50||i.length==e.doc.length||!ja(o))){let i=l(o,e);i&&i.from<=n&&i.from>=t&&i.to>n&&(r=i)}}return r}(e,t,n)}function Va(e,t){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);return n>=i?void 0:{from:n,to:i}}const Wa=ut.define({map:Va}),Ha=ut.define({map:Va});function qa(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}const $a=Ue.define({create:()=>xn.none,update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((t,n)=>e=Ua(e,t,n)),e=e.map(t.changes);for(let n of t.effects)if(n.is(Wa)&&!Ga(e,n.value.from,n.value.to)){let{preparePlaceholder:i}=t.state.facet(Za),r=i?xn.replace({widget:new ic(i(t.state,n.value))}):nc;e=e.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(Ha)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=Ua(e,t.selection.main.head)),e},provide:e=>ro.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let i=e[n++],r=e[n++];if("number"!=typeof i||"number"!=typeof r)throw new RangeError("Invalid JSON for fold state");t.push(nc.range(i,r))}return xn.set(t,!0)}});function Ua(e,t,n=t){let i=!1;return e.between(t,n,(e,r)=>{e<n&&r>t&&(i=!0)}),i?e.update({filterFrom:t,filterTo:n,filter:(e,i)=>e>=n||i<=t}):e}function Ka(e,t,n){var i;let r=null;return null===(i=e.field($a,!1))||void 0===i||i.between(t,n,(e,t)=>{(!r||r.from>e)&&(r={from:e,to:t})}),r}function Ga(e,t,n){let i=!1;return e.between(t,t,(e,r)=>{e==t&&r==n&&(i=!0)}),i}function Ya(e,t){return e.field($a,!1)?t:t.concat(ut.appendConfig.of(ec()))}function Ja(e,t,n=!0){let i=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return ro.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${i} ${e.state.phrase("to")} ${r}.`)}const Qa=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of qa(e)){let n=za(e.state,t.from,t.to);if(n)return e.dispatch({effects:Ya(e.state,[Wa.of(n),Ja(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field($a,!1))return!1;let t=[];for(let n of qa(e)){let i=Ka(e.state,n.from,n.to);i&&t.push(Ha.of(i),Ja(e,i,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let i=0;i<t.doc.length;){let r=e.lineBlockAt(i),s=za(t,r.from,r.to);s&&n.push(Wa.of(s)),i=(s?e.lineBlockAt(s.to):r).to+1}return n.length&&e.dispatch({effects:Ya(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field($a,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(Ha.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],Xa={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Za=je.define({combine:e=>Ct(e,Xa)});function ec(e){let t=[$a,lc];return e&&t.push(Za.of(e)),t}function tc(e,t){let{state:n}=e,i=n.facet(Za),r=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),i=Ka(e.state,n.from,n.to);i&&e.dispatch({effects:Ha.of(i)}),t.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(e,r,t);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}const nc=xn.replace({widget:new class extends vn{toDOM(e){return tc(e,null)}}});class ic extends vn{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return tc(e,this.value)}}const rc={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class sc extends Ho{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function oc(e={}){let t={...rc,...e},n=new sc(t,!0),i=new sc(t,!1),r=Ii.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(wa)!=e.state.facet(wa)||e.startState.field($a,!1)!=e.state.field($a,!1)||fa(e.startState)!=fa(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new Mt;for(let r of e.viewportLineBlocks){let s=Ka(e.state,r.from,r.to)?i:za(e.state,r.from,r.to)?n:null;s&&t.add(r.from,r.from,s)}return t.finish()}}),{domEventHandlers:s}=t;return[r,Go({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.markers)||Ot.empty},initialSpacer:()=>new sc(t,!1),domEventHandlers:{...s,click:(e,t,n)=>{if(s.click&&s.click(e,t,n))return!0;let i=Ka(e.state,t.from,t.to);if(i)return e.dispatch({effects:Ha.of(i)}),!0;let r=za(e.state,t.from,t.to);return!!r&&(e.dispatch({effects:Wa.of(r)}),!0)}}}),ec()]}const lc=ro.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class ac{constructor(e,t){let n;function i(e){let t=$t.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const r="string"==typeof t.all?t.all:t.all?i(t.all):void 0,s=t.scope;this.scope=s instanceof ha?e=>e.prop(aa)==s.data:s?e=>e==s:void 0,this.style=Wl(e.map(e=>({tag:e.tag,class:e.class||i(Object.assign({},e,{tag:null}))})),{all:r}).style,this.module=n?new $t(n):null,this.themeType=t.themeType}static define(e,t){return new ac(e,t||{})}}const cc=je.define(),hc=je.define({combine:e=>e.length?[e[0]]:null});function uc(e){let t=e.facet(cc);return t.length?t:e.facet(hc)}class dc{constructor(e){this.markCache=Object.create(null),this.tree=fa(e.state),this.decorations=this.buildDeco(e,uc(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=fa(e.state),n=uc(e.state),i=n!=uc(e.startState),{viewport:r}=e.view,s=e.changes.mapPos(this.decoratedTo,1);t.length<r.to&&!i&&t.type==this.tree.type&&s>=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=s):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return xn.none;let n=new Mt;for(let{from:i,to:r}of e.visibleRanges)Hl(this.tree,t,(e,t,i)=>{n.add(e,t,this.markCache[i]||(this.markCache[i]=xn.mark({class:i})))},i,r);return n.finish()}}const fc=Ge.high(Ii.fromClass(dc,{decorations:e=>e.decorations})),pc=(oa.meta,oa.link,oa.heading,oa.emphasis,oa.strong,oa.strikethrough,oa.keyword,oa.atom,oa.bool,oa.url,oa.contentSeparator,oa.labelName,oa.literal,oa.inserted,oa.string,oa.deleted,oa.regexp,oa.escape,oa.string,oa.variableName,oa.variableName,oa.typeName,oa.namespace,oa.className,oa.variableName,oa.macroName,oa.propertyName,oa.comment,oa.invalid,ro.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}})),gc="()[]{}",mc=je.define({combine:e=>Ct(e,{afterCursor:!0,brackets:gc,maxScanDistance:1e4,renderMatch:bc})}),Ac=xn.mark({class:"cm-matchingBracket"}),vc=xn.mark({class:"cm-nonmatchingBracket"});function bc(e){let t=[],n=e.matched?Ac:vc;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function xc(e){let t=[],n=e.facet(mc);for(let i of e.selection.ranges){if(!i.empty)continue;let r=Sc(e,i.head,-1,n)||i.head>0&&Sc(e,i.head-1,1,n)||n.afterCursor&&(Sc(e,i.head,1,n)||i.head<e.doc.length&&Sc(e,i.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e)))}return xn.set(t,!0)}const yc=[Ii.fromClass(class{constructor(e){this.paused=!1,this.decorations=xc(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=xc(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),pc];function wc(e={}){return[mc.of(e),yc]}const Cc=new ol;function kc(e,t,n){let i=e.prop(t<0?ol.openedBy:ol.closedBy);if(i)return i;if(1==e.name.length){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function _c(e){let t=e.type.prop(Cc);return t?t(e.node):e}function Sc(e,t,n,i={}){let r=i.maxScanDistance||1e4,s=i.brackets||gc,o=fa(e),l=o.resolveInner(t,n);for(let e=l;e;e=e.parent){let i=kc(e.type,n,s);if(i&&e.from<e.to){let r=_c(e);if(r&&(n>0?t>=r.from&&t<r.to:t>r.from&&t<=r.to))return Ec(0,0,n,e,r,i,s)}}return function(e,t,n,i,r,s,o){let l=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),a=o.indexOf(l);if(a<0||a%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},h=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!h.next().done&&e<=s;){let s=h.value;n<0&&(e+=s.length);let l=t+e*n;for(let e=n>0?0:s.length-1,t=n>0?s.length:-1;e!=t;e+=n){let t=o.indexOf(s[e]);if(!(t<0||i.resolveInner(l+e,1).type!=r))if(t%2==0==n>0)u++;else{if(1==u)return{start:c,end:{from:l+e,to:l+e+1},matched:t>>1==a>>1};u--}}n>0&&(e+=s.length)}return h.done?{start:c,matched:!1}:null}(e,t,n,o,l.type,r,s)}function Ec(e,t,n,i,r,s,o){let l=i.parent,a={from:r.from,to:r.to},c=0,h=null==l?void 0:l.cursor();if(h&&(n<0?h.childBefore(i.from):h.childAfter(i.to)))do{if(n<0?h.to<=i.from:h.from>=i.to){if(0==c&&s.indexOf(h.type.name)>-1&&h.from<h.to){let e=_c(h);return{start:a,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(kc(h.type,n,o))c++;else if(kc(h.type,-n,o)){if(0==c){let e=_c(h);return{start:a,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}}while(n<0?h.prevSibling():h.nextSibling());return{start:a,matched:!1}}const Tc=Object.create(null),Oc=[cl.none],Mc=[],Bc=Object.create(null),Dc=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Dc[e]=Ic(Tc,t);function Rc(e,t){Mc.indexOf(e)>-1||(Mc.push(e),console.warn(t))}function Ic(e,t){let n=[];for(let i of t.split(" ")){let t=[];for(let n of i.split(".")){let i=e[n]||oa[n];i?"function"==typeof i?t.length?t=t.map(i):Rc(n,`Modifier ${n} used at start of tag`):t.length?Rc(n,`Tag ${n} used as modifier`):t=Array.isArray(i)?i:[i]:Rc(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),r=i+" "+n.map(e=>e.id),s=Bc[r];if(s)return s.id;let o=Bc[r]=cl.define({id:Oc.length,name:i,props:[jl({[i]:n})]});return Oc.push(o),o.id}Jn.RTL,Jn.LTR;class Pc{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=fa(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),r=i.search(jc(e,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function Nc(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}class Lc{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function Fc(e){return e.selection.main.from}function jc(e,t){var n;let{source:i}=e,r=t&&"^"!=i[0],s="$"!=i[i.length-1];return r||s?new RegExp(`${r?"^":""}(?:${i})${s?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const zc=at.define();function Vc(e,t,n,i){let{main:r}=e.selection,s=n-r.from,o=i-r.from;return{...e.changeByRange(l=>{if(l!=r&&n!=i&&e.sliceDoc(l.from+s,l.from+o)!=e.sliceDoc(n,i))return{range:l};let a=e.toText(t);return{changes:{from:l.from+s,to:i==r.from?l.to:l.from+o,insert:a},range:Ne.cursor(l.from+s+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Wc=new WeakMap;function Hc(e){if(!Array.isArray(e))return e;let t=Wc.get(e);return t||Wc.set(e,t=function(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[n,i]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let e=1;e<i.length;e++)n[i[e]]=!0}let i=Nc(t)+Nc(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}(t);return e=>{let r=e.matchBefore(i);return r||e.explicit?{from:r?r.from:e.pos,options:t,validFor:n}:null}}(e)),t}const qc=ut.define(),$c=ut.define();class Uc{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=we(e,t),i=ke(n);this.chars.push(n);let r=e.slice(t,t+i),s=r.toUpperCase();this.folded.push(we(s==r?r.toLowerCase():s,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:i,precise:r,byWord:s}=this;if(1==t.length){let i=we(e,0),r=ke(i),s=r==e.length?0:-100;if(i==t[0]);else{if(i!=n[0])return null;s+=-200}return this.ret(s,[0,r])}let o=e.indexOf(this.pattern);if(0==o)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,a=0;if(o<0){for(let r=0,s=Math.min(e.length,200);r<s&&a<l;){let s=we(e,r);s!=t[a]&&s!=n[a]||(i[a++]=r),r+=ke(s)}if(a<l)return null}let c=0,h=0,u=!1,d=0,f=-1,p=-1,g=/[a-z]/.test(e),m=!0;for(let i=0,a=Math.min(e.length,200),A=0;i<a&&h<l;){let a=we(e,i);o<0&&(c<l&&a==t[c]&&(r[c++]=i),d<l&&(a==t[d]||a==n[d]?(0==d&&(f=i),p=i+1,d++):d=0));let v,b=a<255?a>=48&&a<=57||a>=97&&a<=122?2:a>=65&&a<=90?1:0:(v=Ce(a))!=v.toLowerCase()?1:v!=v.toUpperCase()?2:0;(!i||1==b&&g||0==A&&0!=b)&&(t[h]==a||n[h]==a&&(u=!0)?s[h++]=i:s.length&&(m=!1)),A=b,i+=ke(a)}return h==l&&0==s[0]&&m?this.result((u?-200:0)-100,s,e):d==l&&0==f?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):d==l?this.ret(-900-e.length,[f,p]):h==l?this.result((u?-200:0)-100-700+(m?0:-1100),s,e):2==t.length?null:this.result((i[0]?-700:0)-200-1100,i,e)}result(e,t,n){let i=[],r=0;for(let e of t){let t=e+(this.astral?ke(we(n,e)):1);r&&i[r-1]==e?i[r-1]=t:(i[r++]=e,i[r++]=t)}return this.ret(e-n.length,i)}}class Kc{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const Gc=je.define({combine:e=>Ct(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Jc,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>Yc(e(n),t(n)),optionClass:(e,t)=>n=>Yc(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function Yc(e,t){return e?t?e+" "+t:e:t}function Jc(e,t,n,i,r,s){let o,l,a=e.textDirection==Jn.RTL,c=a,h=!1,u="top",d=t.left-r.left,f=r.right-t.right,p=i.right-i.left,g=i.bottom-i.top;if(c&&d<Math.min(p,f)?c=!1:!c&&f<Math.min(p,d)&&(c=!0),p<=(c?d:f))o=Math.max(r.top,Math.min(n.top,r.bottom-g))-t.top,l=Math.min(400,c?d:f);else{h=!0,l=Math.min(400,(a?t.right:r.right-t.left)-30);let e=r.bottom-t.bottom;e>=g||e>t.top?o=n.bottom-t.top:(u="bottom",o=t.bottom-n.top)}return{style:`${u}: ${o/((t.bottom-t.top)/s.offsetHeight)}px; max-width: ${l/((t.right-t.left)/s.offsetWidth)}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":c?"left":"right")}}const Qc=ut.define();function Xc(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let i=Math.floor((e-t)/n);return{from:e-(i+1)*n,to:e-i*n}}class Zc{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:r,selected:s}=i.open,o=e.state.facet(Gc);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,i){let r=document.createElement("span");r.className="cm-completionLabel";let s=e.displayLabel||e.label,o=0;for(let e=0;e<i.length;){let t=i[e++],n=i[e++];t>o&&r.appendChild(document.createTextNode(s.slice(o,t)));let l=r.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(s.slice(t,n))),l.className="cm-completionMatchedText",o=n}return o<s.length&&r.appendChild(document.createTextNode(s.slice(o))),r},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=Xc(r.length,s,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",n=>{let{options:i}=e.state.field(t).open;for(let t,r=n.target;r&&r!=this.dom;r=r.parentNode)if("LI"==r.nodeName&&(t=/-(\d+)$/.exec(r.id))&&+t[1]<i.length)return this.applyCompletion(e,i[+t[1]]),void n.preventDefault();if(n.target==this.list){let t=this.list.classList.contains("cm-completionListIncompleteTop")&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;null!=t&&(e.dispatch({effects:Qc.of(t)}),n.preventDefault())}}),this.dom.addEventListener("focusout",t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(Gc).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:$c.of(null)})}),this.showOptions(r,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:r,selected:s,disabled:o}=n.open;i.open&&i.open.options==r||(this.range=Xc(r.length,s,e.state.facet(Gc).maxRenderedOptions),this.showOptions(r,n.id)),this.updateSel(),o!=(null===(t=i.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Xc(t.options.length,t.selected,this.view.state.facet(Gc).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:i}=t.options[t.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(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,i)}).catch(e=>Mi(this.view.state,e,"completion info")):(this.addInfoPane(s,i),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){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!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:i}=e;n.appendChild(t),this.infoDestroy=i||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)"LI"==n.nodeName&&n.id?i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby")):i--;return t&&function(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=n.height/e.offsetHeight;i.top<n.top?e.scrollTop-=(n.top-i.top)/r:i.bottom>n.bottom&&(e.scrollTop+=(i.bottom-n.bottom)/r)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),r=this.space;if(!r){let e=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return i.top>Math.min(r.bottom,t.bottom)-10||i.bottom<Math.max(r.top,t.top)+10?null:this.view.state.facet(Gc).positionInfo(this.view,t,i,n,r,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",e=>{e.target==i&&e.preventDefault()});let r=null;for(let s=n.from;s<n.to;s++){let{completion:o,match:l}=e[s],{section:a}=o;if(a){let e="string"==typeof a?a:a.name;e!=r&&(s>n.from||0==n.from)&&(r=e,"string"!=typeof a&&a.header?i.appendChild(a.header(a)):i.appendChild(document.createElement("completion-section")).textContent=e)}const c=i.appendChild(document.createElement("li"));c.id=t+"-"+s,c.setAttribute("role","option");let h=this.optionClass(o);h&&(c.className=h);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,l);t&&c.appendChild(t)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function eh(e,t){return n=>new Zc(n,e,t)}function th(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class nh{constructor(e,t,n,i,r,s){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=r,this.disabled=s}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new nh(this.options,oh(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,r,s){if(i&&!s&&e.some(e=>e.isPending))return i.setDisabled();let o=function(e,t){let n=[],i=null,r=null,s=e=>{n.push(e);let{section:t}=e.completion;if(t){i||(i=[]);let e="string"==typeof t?t:t.name;i.some(t=>t.name==e)||i.push("string"==typeof t?{name:e}:t)}},o=t.facet(Gc);for(let i of e)if(i.hasResult()){let e=i.result.getMatch;if(!1===i.result.filter)for(let t of i.result.options)s(new Lc(t,i.source,e?e(t):[],1e9-n.length));else{let n,l=t.sliceDoc(i.from,i.to),a=o.filterStrict?new Kc(l):new Uc(l);for(let t of i.result.options)if(n=a.match(t.label)){let o=t.displayLabel?e?e(t,n.matched):[]:n.matched,l=n.score+(t.boost||0);if(s(new Lc(t,i.source,o,l)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;r||(r=Object.create(null)),r[e]=Math.max(l,r[e]||-1e9)}}}}if(i){let e=Object.create(null),t=0,s=(e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?r[t.name]-r[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of i.sort(s))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let l=[],a=null,c=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||c(e.completion,t.completion))){let t=e.completion;!a||a.label!=t.label||a.detail!=t.detail||null!=a.type&&null!=t.type&&a.type!=t.type||a.apply!=t.apply||a.boost!=t.boost?l.push(e):th(e.completion)>th(a)&&(l[l.length-1]=e),a=e.completion}return l}(e,t);if(!o.length)return i&&e.some(e=>e.isPending)?i.setDisabled():null;let l=t.facet(Gc).selectOnOpen?0:-1;if(i&&i.selected!=l&&-1!=i.selected){let e=i.options[i.selected].completion;for(let t=0;t<o.length;t++)if(o[t].completion==e){l=t;break}}return new nh(o,oh(n,l),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:ph,above:r.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new nh(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new nh(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class ih{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new ih(lh,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Gc),i=(n.override||t.languageDataAt("autocomplete",Fc(t)).map(Hc)).map(t=>(this.active.find(e=>e.source==t)||new ch(t,this.active.some(e=>0!=e.state)?1:0)).update(e,n));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let r=this.open,s=e.effects.some(e=>e.is(uh));r&&e.docChanged&&(r=r.map(e.changes)),e.selection||i.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!function(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;i<t.length&&!t[i].hasResult();)i++;let r=n==e.length,s=i==t.length;if(r||s)return r==s;if(e[n++].result!=t[i++].result)return!1}}(i,this.active)||s?r=nh.build(i,t,this.id,r,n,s):r&&r.disabled&&!i.some(e=>e.isPending)&&(r=null),!r&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new ch(e.source,0):e));for(let t of e.effects)t.is(Qc)&&(r=r&&r.setSelected(t.value,this.id));return i==this.active&&r==this.open?this:new ih(i,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?rh:sh}}const rh={"aria-autocomplete":"list"},sh={};function oh(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const lh=[];function ah(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(zc);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class ch{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=ah(e,t),i=this;(8&n||16&n&&this.touches(e))&&(i=new ch(i.source,0)),4&n&&0==i.state&&(i=new ch(this.source,1)),i=i.updateFor(e,n);for(let t of e.effects)if(t.is(qc))i=new ch(i.source,1,t.value);else if(t.is($c))i=new ch(i.source,0);else if(t.is(uh))for(let e of t.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Fc(e.state))}}class hh extends ch{constructor(e,t,n,i,r,s){super(e,3,t),this.limit=n,this.result=i,this.from=r,this.to=s}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let r=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1),o=Fc(e.state);if(o>s||!i||2&t&&(Fc(e.startState)==this.from||o<this.limit))return new ch(this.source,4&t?1:0);let l=e.changes.mapPos(this.limit);return function(e,t,n,i){if(!e)return!1;let r=t.sliceDoc(n,i);return"function"==typeof e?e(r,n,i,t):jc(e,!0).test(r)}(i.validFor,e.state,r,s)?new hh(this.source,this.explicit,l,i,r,s):i.update&&(i=i.update(i,r,s,new Pc(e.state,o,!1)))?new hh(this.source,this.explicit,l,i,i.from,null!==(n=i.to)&&void 0!==n?n:Fc(e.state)):new ch(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new hh(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new ch(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}const uh=ut.define({map:(e,t)=>e.map(e=>e.map(t))}),dh=Ue.define({create:()=>ih.start(),update:(e,t)=>e.update(t),provide:e=>[Oo.from(e,e=>e.tooltip),ro.contentAttributes.from(e,e=>e.attrs)]});function fh(e,t){const n=t.completion.apply||t.completion.label;let i=e.state.field(dh).active.find(e=>e.source==t.source);return i instanceof hh&&("string"==typeof n?e.dispatch({...Vc(e.state,n,i.from,i.to),annotations:zc.of(t.completion)}):n(e,t.completion,i.from,i.to),!0)}const ph=eh(dh,fh);function gh(e,t="option"){return n=>{let i=n.state.field(dh,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(Gc).interactionDelay)return!1;let r,s=1;"page"==t&&(r=No(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*(e?1:-1):e?0:o-1;return l<0?l="page"==t?0:o-1:l>=o&&(l="page"==t?o-1:0),n.dispatch({effects:Qc.of(l)}),!0}}const mh=e=>!!e.state.field(dh,!1)&&(e.dispatch({effects:qc.of(!0)}),!0);class Ah{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const vh=Ii.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(dh).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(dh),n=e.state.facet(Gc);if(!e.selectionSet&&!e.docChanged&&e.startState.field(dh)==t)return;let i=e.transactions.some(e=>{let t=ah(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(i||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){Mi(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(qc)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),r):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(dh);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Gc).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Fc(t),i=new Pc(t,n,e.explicit,this.view),r=new Ah(e,i);this.running.push(r),Promise.resolve(e.source(i)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:$c.of(null)}),Mi(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Gc).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Gc),i=this.view.state.field(dh);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=Fc(s.updates.length?s.updates[0].startState:this.view.state),r=Math.min(i,s.done.from+(s.active.explicit?0:1)),o=new hh(s.active.source,s.active.explicit,r,s.done,s.done.from,null!==(e=s.done.to)&&void 0!==e?e:i);for(let e of s.updates)o=o.update(e,n);if(o.hasResult()){t.push(o);continue}}let o=i.active.find(e=>e.source==s.active.source);if(o&&o.isPending)if(null==s.done){let e=new ch(s.active.source,0);for(let t of s.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(o)}(t.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:uh.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(dh,!1);if(t&&t.tooltip&&this.view.state.facet(Gc).closeOnBlur){let n=t.open&&No(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:$c.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:qc.of(!1)}),20),this.composing=0}}}),bh="object"==typeof navigator&&/Win/.test(navigator.platform),xh=Ge.highest(ro.domEventHandlers({keydown(e,t){let n=t.state.field(dh,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&(!bh||!e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find(e=>e.source==i.source),s=i.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&fh(t,i),!1}})),yh=ro.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"}}}),wh={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ch=ut.define({map(e,t){let n=t.mapPos(e,-1,Se.TrackAfter);return null==n?void 0:n}}),kh=new class extends kt{};kh.startSide=1,kh.endSide=-1;const _h=Ue.define({create:()=>Ot.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(Ch)&&(e=e.update({add:[kh.range(n.value,n.value+1)]}));return e}}),Sh="()[]{}<>«»»«[]{}";function Eh(e){for(let t=0;t<16;t+=2)if(Sh.charCodeAt(t)==e)return Sh.charAt(t+1);return Ce(e<128?e:e+1)}const Th="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Oh=ro.inputHandler.of((e,t,n,i)=>{if((Th?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(i.length>2||2==i.length&&1==ke(we(i,0))||t!=r.from||n!=r.to)return!1;let s=function(e,t){let n=function(e,t){return e.languageDataAt("closeBrackets",t)[0]||wh}(e,e.selection.main.head),i=n.brackets||wh.brackets;for(let r of i){let s=Eh(we(r,0));if(t==r)return s==r?Ih(e,r,i.indexOf(r+r+r)>-1,n):Dh(e,r,s,n.before||wh.before);if(t==s&&Mh(e,e.selection.main.from))return Rh(e,0,s)}return null}(e.state,i);return!!s&&(e.dispatch(s),!0)});function Mh(e,t){let n=!1;return e.field(_h).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function Bh(e,t){let n=e.sliceString(t,t+2);return n.slice(0,ke(we(n,0)))}function Dh(e,t,n,i){let r=null,s=e.changeByRange(s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:n,from:s.to}],effects:Ch.of(s.to+t.length),range:Ne.range(s.anchor+t.length,s.head+t.length)};let o=Bh(e.doc,s.head);return!o||/\s/.test(o)||i.indexOf(o)>-1?{changes:{insert:t+n,from:s.head},effects:Ch.of(s.head+t.length),range:Ne.cursor(s.head+t.length)}:{range:r=s}});return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Rh(e,t,n){let i=null,r=e.changeByRange(t=>t.empty&&Bh(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:Ne.cursor(t.head+n.length)}:i={range:t});return i?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Ih(e,t,n,i){let r=i.stringPrefixes||wh.stringPrefixes,s=null,o=e.changeByRange(i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:t,from:i.to}],effects:Ch.of(i.to+t.length),range:Ne.range(i.anchor+t.length,i.head+t.length)};let o,l=i.head,a=Bh(e.doc,l);if(a==t){if(Ph(e,l))return{changes:{insert:t+t,from:l},effects:Ch.of(l+t.length),range:Ne.cursor(l+t.length)};if(Mh(e,l)){let i=n&&e.sliceDoc(l,l+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+i.length,insert:i},range:Ne.cursor(l+i.length)}}}else{if(n&&e.sliceDoc(l-2*t.length,l)==t+t&&(o=Nh(e,l-2*t.length,r))>-1&&Ph(e,o))return{changes:{insert:t+t+t+t,from:l},effects:Ch.of(l+t.length),range:Ne.cursor(l+t.length)};if(e.charCategorizer(l)(a)!=bt.Word&&Nh(e,l,r)>-1&&!function(e,t,n,i){let r=fa(e).resolveInner(t,-1),s=i.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.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 t=r.firstChild;for(;t&&t.from==r.from&&t.to-t.from>n.length+l;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let a=r.to==t&&r.parent;if(!a)break;r=a}return!1}(e,l,t,r))return{changes:{insert:t+t,from:l},effects:Ch.of(l+t.length),range:Ne.cursor(l+t.length)}}return{range:s=i}});return s?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Ph(e,t){let n=fa(e).resolveInner(t+1);return n.parent&&n.from==t}function Nh(e,t,n){let i=e.charCategorizer(t);if(i(e.sliceDoc(t-1,t))!=bt.Word)return t;for(let r of n){let n=t-r.length;if(e.sliceDoc(n,t)==r&&i(e.sliceDoc(n-1,n))!=bt.Word)return n}return-1}function Lh(e={}){return[xh,dh,Gc.of(e),vh,jh,yh]}const Fh=[{key:"Ctrl-Space",run:mh},{mac:"Alt-`",run:mh},{mac:"Alt-i",run:mh},{key:"Escape",run:e=>{let t=e.state.field(dh,!1);return!(!t||!t.active.some(e=>0!=e.state)||(e.dispatch({effects:$c.of(null)}),0))}},{key:"ArrowDown",run:gh(!0)},{key:"ArrowUp",run:gh(!1)},{key:"PageDown",run:gh(!0,"page")},{key:"PageUp",run:gh(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(dh,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Gc).interactionDelay)&&fh(e,t.open.options[t.open.selected])}}],jh=Ge.highest(fo.computeN([Gc],e=>e.facet(Gc).defaultKeymap?[Fh]:[]));function zh(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=e(t,n);return!!r&&(i(n.update(r)),!0)}}const Vh=zh(Kh,0),Wh=zh(Uh,0),Hh=zh((e,t)=>Uh(e,t,function(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),r=n.to<=i.to?i:e.doc.lineAt(n.to);r.from>i.from&&r.from==n.to&&(r=n.to==i.to+1?i:e.doc.lineAt(n.to-1));let s=t.length-1;s>=0&&t[s].to>i.from?t[s].to=r.to:t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return t}(t)),0);function qh(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const $h=50;function Uh(e,t,n=t.selection.ranges){let i=n.map(e=>qh(t,e.from).block);if(!i.every(e=>e))return null;let r=n.map((e,n)=>function(e,{open:t,close:n},i,r){let s,o,l=e.sliceDoc(i-$h,i),a=e.sliceDoc(r,r+$h),c=/\s*$/.exec(l)[0].length,h=/^\s*/.exec(a)[0].length,u=l.length-c;if(l.slice(u-t.length,u)==t&&a.slice(h,h+n.length)==n)return{open:{pos:i-c,margin:c&&1},close:{pos:r+h,margin:h&&1}};r-i<=2*$h?s=o=e.sliceDoc(i,r):(s=e.sliceDoc(i,i+$h),o=e.sliceDoc(r-$h,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+t.length)==t&&o.slice(p,p+n.length)==n?{open:{pos:i+d+t.length,margin:/\s/.test(s.charAt(d+t.length))?1:0},close:{pos:r-f-n.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null}(t,i[n],e.from,e.to));if(2!=e&&!r.every(e=>e))return{changes:t.changes(n.map((e,t)=>r[t]?[]:[{from:e.from,insert:i[t].open+" "},{from:e.to,insert:" "+i[t].close}]))};if(1!=e&&r.some(e=>e)){let e=[];for(let t,n=0;n<r.length;n++)if(t=r[n]){let r=i[n],{open:s,close:o}=t;e.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:e}}return null}function Kh(e,t,n=t.selection.ranges){let i=[],r=-1;e:for(let{from:e,to:s}of n){let n,o=i.length,l=1e9;for(let o=e;o<=s;){let a=t.doc.lineAt(o);if(null==n&&(n=qh(t,a.from).line,!n))continue e;if(a.from>r&&(e==s||s>a.from)){r=a.from;let e=/^\s*/.exec(a.text)[0].length,t=e==a.length,s=a.text.slice(e,e+n.length)==n?e:-1;e<a.text.length&&e<l&&(l=e),i.push({line:a,comment:s,token:n,indent:e,empty:t,single:!1})}o=a.to+1}if(l<1e9)for(let e=o;e<i.length;e++)i[e].indent<i[e].line.text.length&&(i[e].indent=l);i.length==o+1&&(i[o].single=!0)}if(2!=e&&i.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:r,empty:s,single:o}of i)!o&&s||e.push({from:t.from+r,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&i.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:r}of i)if(n>=0){let i=t.from+n,s=i+r.length;" "==t.text[s-t.from]&&s++,e.push({from:i,to:s})}return{changes:e}}return null}const Gh=at.define(),Yh=je.define();class Jh{constructor(e,t,n,i,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=r}setSelAfter(e){return new Jh(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new Jh(e.changes&&Te.fromJSON(e.changes),[],e.mapped&&Ee.fromJSON(e.mapped),e.startSelection&&Ne.fromJSON(e.startSelection),e.selectionsAfter.map(Ne.fromJSON))}static fromTransaction(e,t){let n=Zh;for(let t of e.startState.facet(Yh)){let i=t(e);i.length&&(n=n.concat(i))}return!n.length&&e.changes.empty?null:new Jh(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Zh)}static selection(e){return new Jh(void 0,Zh,void 0,void 0,e)}}function Qh(e,t,n,i){let r=t+1>n+20?t-n-1:0,s=e.slice(r,t);return s.push(i),s}function Xh(e,t){return e.length?t.length?e.concat(t):e:t}const Zh=[];function eu(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function tu(e,t){if(!e.length)return e;let n=e.length,i=Zh;for(;n;){let r=nu(e[n-1],t,i);if(r.changes&&!r.changes.empty||r.effects.length){let t=e.slice(0,n);return t[n-1]=r,t}t=r.mapped,n--,i=r.selectionsAfter}return i.length?[Jh.selection(i)]:Zh}function nu(e,t,n){let i=Xh(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Zh,n);if(!e.changes)return Jh.selection(i);let r=e.changes.map(t),s=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(s):s;return new Jh(r,ut.mapEffects(e.effects,t),o,e.startSelection.map(s),i)}const iu=/^(input\.type|delete)($|\.)/;class ru{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new ru(this.done,this.undone):this}addChanges(e,t,n,i,r){let s=this.done,o=s[s.length-1];return s=o&&o.changes&&!o.changes.empty&&e.changes&&(!n||iu.test(n))&&(!o.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(r,function(e,t){let n=[],i=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,r,s)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];s>=t&&r<=o&&(i=!0)}}),i}(o.changes,e.changes))||"input.type.compose"==n)?Qh(s,s.length-1,i.minDepth,new Jh(e.changes.compose(o.changes),Xh(ut.mapEffects(e.effects,o.changes),o.effects),o.mapped,o.startSelection,Zh)):Qh(s,s.length,i.minDepth,e),new ru(s,Zh,t,n)}addSelection(e,t,n,i){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return r.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(s=r[r.length-1],o=e,s.ranges.length==o.ranges.length&&0===s.ranges.filter((e,t)=>e.empty!=o.ranges[t].empty).length)?this:new ru(function(e,t){if(e.length){let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return i.length&&i[i.length-1].eq(t)?e:(i.push(t),Qh(e,e.length-1,1e9,n.setSelAfter(i)))}return[Jh.selection([t])]}(this.done,e),this.undone,t,n);var s,o}addMapping(e){return new ru(tu(this.done,e),tu(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=0==e?this.done:this.undone;if(0==i.length)return null;let r=i[i.length-1],s=r.selectionsAfter[0]||(r.startSelection?r.startSelection.map(r.changes.invertedDesc,1):t.selection);if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Gh.of({side:e,rest:eu(i),selection:s}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=1==i.length?Zh:i.slice(0,i.length-1);return r.mapped&&(n=tu(n,r.mapped)),t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Gh.of({side:e,rest:n,selection:s}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}function su(e,t){return Ne.create(e.ranges.map(t),e.mainIndex)}function ou(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function lu({state:e,dispatch:t},n){let i=su(e.selection,n);return!i.eq(e.selection,!0)&&(t(ou(e,i)),!0)}function au(e,t){return Ne.cursor(t?e.to:e.from)}function cu(e,t){return lu(e,n=>n.empty?e.moveByChar(n,t):au(n,t))}function hu(e){return e.textDirectionAt(e.state.selection.main.head)==Jn.LTR}ru.empty=new ru(Zh,Zh);const uu=e=>cu(e,!hu(e)),du=e=>cu(e,hu(e));function fu(e,t){return lu(e,n=>n.empty?e.moveByGroup(n,t):au(n,t))}function pu(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function gu(e,t,n){let i,r,s=fa(e).resolveInner(t.head),o=n?ol.closedBy:ol.openedBy;for(let i=t.head;;){let t=n?s.childAfter(i):s.childBefore(i);if(!t)break;pu(e,t,o)?s=t:i=n?t.to:t.from}return r=s.type.prop(o)&&(i=n?Sc(e,s.from,1):Sc(e,s.to,-1))&&i.matched?n?i.end.to:i.end.from:n?s.to:s.from,Ne.cursor(r,n?-1:1)}function mu(e,t){return lu(e,n=>{if(!n.empty)return au(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)})}"undefined"!=typeof Intl&&Intl.Segmenter;const Au=e=>mu(e,!1),vu=e=>mu(e,!0);function bu(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,i=0,r=0;if(n){for(let t of e.state.facet(ro.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(i=Math.max(null==n?void 0:n.top,i)),(null==n?void 0:n.bottom)&&(r=Math.max(null==n?void 0:n.bottom,r))}t=e.scrollDOM.clientHeight-i-r}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:r,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function xu(e,t){let n,i=bu(e),{state:r}=e,s=su(r.selection,n=>n.empty?e.moveVertically(n,t,i.height):au(n,t));if(s.eq(r.selection))return!1;if(i.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),l=o.top+i.marginTop,a=o.bottom-i.marginBottom;t&&t.top>l&&t.bottom<a&&(n=ro.scrollIntoView(s.main.head,{y:"start",yMargin:t.top-l}))}return e.dispatch(ou(r,s),{effects:n}),!0}const yu=e=>xu(e,!1),wu=e=>xu(e,!0);function Cu(e,t,n){let i=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?i.to:i.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==i.from&&i.length){let n=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;n&&t.head!=i.from+n&&(r=Ne.cursor(i.from+n))}return r}function ku(e,t){let n=su(e.state.selection,e=>{let n=t(e);return Ne.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(e.state.selection)&&(e.dispatch(ou(e.state,n)),!0)}function _u(e,t){return ku(e,n=>e.moveByChar(n,t))}const Su=e=>_u(e,!hu(e)),Eu=e=>_u(e,hu(e));function Tu(e,t){return ku(e,n=>e.moveByGroup(n,t))}function Ou(e,t){return ku(e,n=>e.moveVertically(n,t))}const Mu=e=>Ou(e,!1),Bu=e=>Ou(e,!0);function Du(e,t){return ku(e,n=>e.moveVertically(n,t,bu(e).height))}const Ru=e=>Du(e,!1),Iu=e=>Du(e,!0),Pu=({state:e,dispatch:t})=>(t(ou(e,{anchor:0})),!0),Nu=({state:e,dispatch:t})=>(t(ou(e,{anchor:e.doc.length})),!0),Lu=({state:e,dispatch:t})=>(t(ou(e,{anchor:e.selection.main.anchor,head:0})),!0),Fu=({state:e,dispatch:t})=>(t(ou(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function ju(e,t){let{state:n}=e,i=n.selection,r=n.selection.ranges.slice();for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head);if(t?s.to<e.state.doc.length:s.from>0)for(let n=i;;){let i=e.moveVertically(n,t);if(i.head<s.from||i.head>s.to){r.some(e=>e.head==i.head)||r.push(i);break}if(i.head==n.head)break;n=i}}return r.length!=i.ranges.length&&(e.dispatch(ou(n,Ne.create(r,r.length-1))),!0)}function zu(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,r=i.changeByRange(i=>{let{from:r,to:s}=i;if(r==s){let o=t(i);o<r?(n="delete.backward",o=Vu(e,o,!1)):o>r&&(n="delete.forward",o=Vu(e,o,!0)),r=Math.min(r,o),s=Math.max(s,o)}else r=Vu(e,r,!1),s=Vu(e,s,!0);return r==s?{range:i}:{changes:{from:r,to:s},range:Ne.cursor(r,r<i.head?-1:1)}});return!r.changes.empty&&(e.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?ro.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Vu(e,t,n){if(e instanceof ro)for(let i of e.state.facet(ro.atomicRanges).map(t=>t(e)))i.between(t,t,(e,i)=>{e<t&&i>t&&(t=n?i:e)});return t}const Wu=(e,t,n)=>zu(e,i=>{let r,s,o=i.from,{state:l}=e,a=l.doc.lineAt(o);if(n&&!t&&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 e=Vt(r,l.tabSize)%Sa(l)||Sa(l);for(let t=0;t<e&&" "==r[r.length-1-t];t++)o--;s=o}else s=ye(a.text,o-a.from,t,t)+a.from,s==o&&a.number!=(t?l.doc.lines:1)?s+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(a.text.slice(s-a.from,o-a.from))&&(s=ye(a.text,s-a.from,!1,!1)+a.from);return s}),Hu=e=>Wu(e,!1,!0),qu=e=>Wu(e,!0,!1),$u=(e,t)=>zu(e,n=>{let i=n.head,{state:r}=e,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let e=null;;){if(i==(t?s.to:s.from)){i==n.head&&s.number!=(t?r.doc.lines:1)&&(i+=t?1:-1);break}let l=ye(s.text,i-s.from,t)+s.from,a=s.text.slice(Math.min(i,l)-s.from,Math.max(i,l)-s.from),c=o(a);if(null!=e&&c!=e)break;" "==a&&i==n.head||(e=c),i=l}return i}),Uu=e=>$u(e,!1);function Ku(e){let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.from),s=e.doc.lineAt(i.to);if(i.empty||i.to!=s.from||(s=e.doc.lineAt(i.to-1)),n>=r.number){let e=t[t.length-1];e.to=s.to,e.ranges.push(i)}else t.push({from:r.from,to:s.to,ranges:[i]});n=s.number+1}return t}function Gu(e,t,n){if(e.readOnly)return!1;let i=[],r=[];for(let t of Ku(e)){if(n?t.to==e.doc.length:0==t.from)continue;let s=e.doc.lineAt(n?t.to+1:t.from-1),o=s.length+1;if(n){i.push({from:t.to,to:s.to},{from:t.from,insert:s.text+e.lineBreak});for(let n of t.ranges)r.push(Ne.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{i.push({from:s.from,to:t.from},{from:t.to,insert:e.lineBreak+s.text});for(let e of t.ranges)r.push(Ne.range(e.anchor-o,e.head-o))}}return!!i.length&&(t(e.update({changes:i,scrollIntoView:!0,selection:Ne.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0)}function Yu(e,t,n){if(e.readOnly)return!1;let i=[];for(let t of Ku(e))n?i.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):i.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let r=e.changes(i);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Ju=Qu(!1);function Qu(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>{let{from:i,to:r}=n,s=t.doc.lineAt(i),o=!e&&i==r&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,i=fa(e).resolveInner(t),r=i.childBefore(t),s=i.childAfter(t);return r&&s&&r.to<=t&&s.from>=t&&(n=r.type.prop(ol.closedBy))&&n.indexOf(s.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}(t,i);e&&(i=r=(r<=s.to?s:t.doc.lineAt(r)).to);let l=new Oa(t,{simulateBreak:i,simulateDoubleBreak:!!o}),a=Ta(l,i);for(null==a&&(a=Vt(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.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 c=["",Ea(t,a)];return o&&c.push(Ea(t,l.lineIndent(s.from,-1))),{changes:{from:i,to:r,insert:ue.of(c)},range:Ne.cursor(i+1+c[1].length)}});return n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Xu(e,t){let n=-1;return e.changeByRange(i=>{let r=[];for(let s=i.from;s<=i.to;){let o=e.doc.lineAt(s);o.number>n&&(i.empty||i.to>o.from)&&(t(o,r,i),n=o.number),s=o.to+1}let s=e.changes(r);return{changes:r,range:Ne.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const Zu=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>lu(e,t=>gu(e.state,t,!hu(e))),shift:e=>ku(e,t=>gu(e.state,t,!hu(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>lu(e,t=>gu(e.state,t,hu(e))),shift:e=>ku(e,t=>gu(e.state,t,hu(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>Gu(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>Yu(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>Gu(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>Yu(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>ju(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>ju(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,i=null;return n.ranges.length>1?i=Ne.create([n.main]):n.main.empty||(i=Ne.create([Ne.cursor(n.main.head)])),!!i&&(t(ou(e,i)),!0)}},{key:"Mod-Enter",run:Qu(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=Ku(e).map(({from:t,to:n})=>Ne.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:Ne.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=su(e.selection,t=>{let n=fa(e),i=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=i.node.from&&e.node.to<=i.node.to&&(i=e)}for(let e=i;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return Ne.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(ou(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Xu(e,(t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let r=Vt(i,e.tabSize),s=0,o=Ea(e,Math.max(0,r-Sa(e)));for(;s<i.length&&s<o.length&&i.charCodeAt(s)==o.charCodeAt(s);)s++;n.push({from:t.from+s,to:t.from+i.length,insert:o.slice(s)})}),{userEvent:"delete.dedent"})),!0)},{key:"Mod-]",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Xu(e,(t,n)=>{n.push({from:t.from,insert:e.facet(_a)})}),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new Oa(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),r=Xu(e,(t,r,s)=>{let o=Ta(i,t.from);if(null==o)return;/\S/.test(t.text)||(o=0);let l=/^\s*/.exec(t.text)[0],a=Ea(e,o);(l!=a||s.from<t.from+l.length)&&(n[t.from]=o,r.push({from:t.from,to:t.from+l.length,insert:a}))});return r.changes.empty||t(e.update(r,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Ku(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),i=su(t.selection,t=>{let n;if(e.lineWrapping){let i=e.lineBlockAt(t.head),r=e.coordsAtPos(t.head,t.assoc||1);r&&(n=i.bottom+e.documentTop-r.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let i=!1,r=su(e.selection,t=>{let r=Sc(e,t.head,-1)||Sc(e,t.head,1)||t.head>0&&Sc(e,t.head-1,1)||t.head<e.doc.length&&Sc(e,t.head+1,-1);if(!r||!r.end)return t;i=!0;let s=r.start.from==t.head?r.end.to:r.end.from;return n?Ne.range(t.anchor,s):Ne.cursor(s)});return!!i&&(t(ou(e,r)),!0)}(e,t,!1)},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=qh(e.state,n.from);return i.line?Vh(e):!!i.block&&Hh(e)}},{key:"Alt-A",run:Wh},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:uu,shift:Su,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>fu(e,!hu(e)),shift:e=>Tu(e,!hu(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>lu(e,t=>Cu(e,t,!hu(e))),shift:e=>ku(e,t=>Cu(e,t,!hu(e))),preventDefault:!0},{key:"ArrowRight",run:du,shift:Eu,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>fu(e,hu(e)),shift:e=>Tu(e,hu(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>lu(e,t=>Cu(e,t,hu(e))),shift:e=>ku(e,t=>Cu(e,t,hu(e))),preventDefault:!0},{key:"ArrowUp",run:Au,shift:Mu,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Pu,shift:Lu},{mac:"Ctrl-ArrowUp",run:yu,shift:Ru},{key:"ArrowDown",run:vu,shift:Bu,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Nu,shift:Fu},{mac:"Ctrl-ArrowDown",run:wu,shift:Iu},{key:"PageUp",run:yu,shift:Ru},{key:"PageDown",run:wu,shift:Iu},{key:"Home",run:e=>lu(e,t=>Cu(e,t,!1)),shift:e=>ku(e,t=>Cu(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:Pu,shift:Lu},{key:"End",run:e=>lu(e,t=>Cu(e,t,!0)),shift:e=>ku(e,t=>Cu(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:Nu,shift:Fu},{key:"Enter",run:Ju,shift:Ju},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:Hu,shift:Hu,preventDefault:!0},{key:"Delete",run:qu,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Uu,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>$u(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>zu(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>zu(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat([{key:"Ctrl-b",run:uu,shift:Su,preventDefault:!0},{key:"Ctrl-f",run:du,shift:Eu},{key:"Ctrl-p",run:Au,shift:Mu},{key:"Ctrl-n",run:vu,shift:Bu},{key:"Ctrl-a",run:e=>lu(e,t=>Ne.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>ku(e,t=>Ne.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>lu(e,t=>Ne.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>ku(e,t=>Ne.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:qu},{key:"Ctrl-h",run:Hu},{key:"Ctrl-k",run:e=>zu(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:Uu},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:ue.of(["",""])},range:Ne.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,i=e.doc.lineAt(n),r=n==i.from?n-1:ye(i.text,n-i.from,!1)+i.from,s=n==i.to?n+1:ye(i.text,n-i.from,!0)+i.from;return{changes:{from:r,to:s,insert:e.doc.slice(n,s).append(e.doc.slice(r,n))},range:Ne.cursor(s)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:wu}].map(e=>({mac:e.key,run:e.run,shift:e.shift}))));function ed(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];"string"==typeof r?e.setAttribute(i,r):null!=r&&(e[i]=r)}t++}for(;t<arguments.length;t++)td(e,arguments[t]);return e}function td(e,t){if("string"==typeof t)e.appendChild(document.createTextNode(t));else if(null==t);else if(null!=t.nodeType)e.appendChild(t);else{if(!Array.isArray(t))throw new RangeError("Unsupported child node: "+t);for(var n=0;n<t.length;n++)td(e,t[n])}}class nd{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class id{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let i=n.facet(gd).markerFilter;i&&(e=i(e,n));let r=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),s=new Mt,o=[],l=0,a=n.doc.iter(),c=0,h=n.doc.length;for(let e=0;;){let t,n,i=e==r.length?null:r[e];if(!i&&!o.length)break;if(o.length)t=l,n=o.reduce((e,t)=>Math.min(e,t.to),i&&i.from>t?i.from:1e8);else{if(t=i.from,t>h)break;n=i.to,o.push(i),e++}for(;e<r.length;){let i=r[e];if(i.from!=t||!(i.to>i.from||i.to==t)){n=Math.min(i.from,n);break}o.push(i),e++,n=Math.min(i.to,n)}n=Math.min(n,h);let u=!1;if(o.some(e=>e.from==t&&(e.to==n||n==h))&&(u=t==n,!u&&n-t<10)){let e=t-(c+a.value.length);e>0&&(a.next(e),c=t);for(let e=t;;){if(e>=n){u=!0;break}if(!a.lineBreak&&c+a.value.length>e)break;e=c+a.value.length,c+=a.value.length,a.next()}}let d=Sd(o);if(u)s.add(t,t,xn.widget({widget:new xd(d),diagnostics:o.slice()}));else{let e=o.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");s.add(t,n,xn.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:o.slice(),inclusiveEnd:o.some(e=>e.to>n)}))}if(l=n,l==h)break;for(let e=0;e<o.length;e++)o[e].to<=l&&o.splice(e--,1)}let u=s.finish();return new id(u,t,rd(u))}}function rd(e,t=null,n=0){let i=null;return e.between(n,1e9,(e,n,{spec:r})=>{if(!(t&&r.diagnostics.indexOf(t)<0))if(i){if(r.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new nd(i.from,n,i.diagnostic)}else i=new nd(e,n,t||r.diagnostics[0])}),i}function sd(e,t){return e.field(cd,!1)?t:t.concat(ut.appendConfig.of(Ed))}const od=ut.define(),ld=ut.define(),ad=ut.define(),cd=Ue.define({create:()=>new id(xn.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),i=null,r=e.panel;if(e.selected){let r=t.changes.mapPos(e.selected.from,1);i=rd(n,e.selected.diagnostic,r)||rd(n,null,r)}!n.size&&r&&t.state.facet(gd).autoPanel&&(r=null),e=new id(n,r,i)}for(let n of t.effects)if(n.is(od)){let i=t.state.facet(gd).autoPanel?n.value.length?wd.open:null:e.panel;e=id.init(n.value,i,t.state)}else n.is(ld)?e=new id(e.diagnostics,n.value?wd.open:null,e.selected):n.is(ad)&&(e=new id(e.diagnostics,e.panel,n.value));return e},provide:e=>[Wo.from(e,e=>e.panel),ro.decorations.from(e,e=>e.diagnostics)]}),hd=xn.mark({class:"cm-lintRange cm-lintRange-active"});function ud(e,t,n){let i,{diagnostics:r}=e.state.field(cd),s=-1,o=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(e,r,{spec:l})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=l.diagnostics,s=e,o=r,!1});let l=e.state.facet(gd).tooltipFilter;return i&&l&&(i=l(i,e.state)),i?{pos:s,end:o,above:e.state.doc.lineAt(s).to<o,create:()=>({dom:dd(e,i)})}:null}function dd(e,t){return ed("ul",{class:"cm-tooltip-lint"},t.map(t=>bd(e,t,!1)))}const fd=e=>{let t=e.state.field(cd,!1);return!(!t||!t.panel||(e.dispatch({effects:ld.of(!1)}),0))},pd=Ii.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(gd);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(gd);t.length&&function(e,t,n){let i=[],r=-1;for(let s of e)s.then(n=>{i.push(n),clearTimeout(r),i.length==e.length?t(i):r=setTimeout(()=>t(i),200)},n)}(t.map(e=>Promise.resolve(e(this.view))),t=>{this.view.state.doc==e.doc&&this.view.dispatch(function(e,t){return{effects:sd(e,[od.of(t)])}}(this.view.state,t.reduce((e,t)=>e.concat(t))))},e=>{Mi(this.view.state,e)})}}update(e){let t=e.state.facet(gd);(e.docChanged||t!=e.startState.facet(gd)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),gd=je.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...Ct(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:md,tooltipFilter:md,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,i,r)=>e(n,i,r)||t(n,i,r):e:t,autoPanel:(e,t)=>e||t})})});function md(e,t){return e?t?(n,i)=>t(e(n,i),i):e:t}function Ad(e,t={}){return[gd.of({source:e,config:t}),pd,Ed]}function vd(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;e<n.length;e++){let i=n[e];if(/[a-zA-Z]/.test(i)&&!t.some(e=>e.toLowerCase()==i.toLowerCase())){t.push(i);continue e}}t.push("")}return t}function bd(e,t,n){var i;let r=n?vd(t.actions):[];return ed("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},ed("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(i=t.actions)||void 0===i?void 0:i.map((n,i)=>{let s=!1,o=i=>{if(i.preventDefault(),s)return;s=!0;let r=rd(e.state.field(cd).diagnostics,t);r&&n.apply(e,r.from,r.to)},{name:l}=n,a=r[i]?l.indexOf(r[i]):-1,c=a<0?l:[l.slice(0,a),ed("u",l.slice(a,a+1)),l.slice(a+1)];return ed("button",{type:"button",class:"cm-diagnosticAction"+(n.markClass?" "+n.markClass:""),onclick:o,onmousedown:o,"aria-label":` Action: ${l}${a<0?"":` (access key "${r[i]})"`}.`},c)}),t.source&&ed("div",{class:"cm-diagnosticSource"},t.source))}class xd extends vn{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return ed("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class yd{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=bd(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class wd{constructor(e){this.view=e,this.items=[],this.list=ed("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(27==t.keyCode)fd(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],i=vd(n.actions);for(let r=0;r<i.length;r++)if(i[r].toUpperCase().charCodeAt(0)==t.keyCode){let t=rd(this.view.state.field(cd).diagnostics,n);t&&n.actions[r].apply(e,t.from,t.to)}}}t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=ed("div",{class:"cm-panel-lint"},this.list,ed("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>fd(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(cd).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(cd),n=0,i=!1,r=null,s=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:l})=>{for(let e of l.diagnostics){if(s.has(e))continue;s.add(e);let o,l=-1;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){l=t;break}l<0?(o=new yd(this.view,e),this.items.splice(n,0,o),i=!0):(o=this.items[l],l>n&&(this.items.splice(n,l-n),i=!0)),t&&o.diagnostic==t.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 yd(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:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=rd(this.view.state.field(cd).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:ad.of(t)})}static open(e){return new wd(e)}}function Cd(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const kd=ro.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:Cd("#d11")},".cm-lintRange-warning":{backgroundImage:Cd("orange")},".cm-lintRange-info":{backgroundImage:Cd("#999")},".cm-lintRange-hint":{backgroundImage:Cd("#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}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function _d(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function Sd(e){let t="hint",n=1;for(let i of e){let e=_d(i.severity);e>n&&(n=e,t=i.severity)}return t}const Ed=[cd,ro.decorations.compute([cd],e=>{let{selected:t,panel:n}=e.field(cd);return t&&n&&t.from!=t.to?xn.set([hd.range(t.from,t.to)]):xn.none}),Po(ud,{hideOn:function(e,t){let n=t.pos,i=t.end||n,r=e.state.facet(gd).hideOn(e,n,i);if(null!=r)return r;let s=e.startState.doc.lineAt(t.pos);return!(!e.effects.some(e=>e.is(od))&&!e.changes.touchesRange(s.from,Math.max(s.to,i)))}}),kd];class Td{constructor(e,t,n,i,r,s,o,l,a,c=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=r,this.score=s,this.buffer=o,this.bufferBase=l,this.curContext=a,this.lookAhead=c,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new Td(e,[],t,n,n,0,[],0,i?new Od(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=65535&e,{parser:r}=this.p,s=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),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&e?6:0),a=l?this.stack[l-2]:this.p.ranges[0].from,c=this.reducePos-a;c>=2e3&&!(null===(t=this.p.parser.nodeSet.types[i])||void 0===t?void 0:t.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=c));let h=l?this.stack[l-1]:0,u=this.bufferBase+this.buffer.length-h;if(i<r.minRepeatTerm||131072&e){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,e,u+4,!0)}if(262144&e)this.state=this.stack[l];else{let e=this.stack[l-3];this.state=r.getGoto(e,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,a)}storeNode(e,t,n,i=4,r=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,i=this.buffer.length;if(0==i&&e.parent&&(i=e.bufferBase-e.parent.bufferBase,e=e.parent),i>0&&0==e.buffer[i-4]&&e.buffer[i-1]>-1){if(t==n)return;if(e.buffer[i-2]>=t)return void(e.buffer[i-2]=n)}}if(r&&this.pos!=n){let r=this.buffer.length;if(r>0&&(0!=this.buffer[r-4]||this.buffer[r-1]<0)){let e=!1;for(let t=r;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)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]=e,this.buffer[r+1]=t,this.buffer[r+2]=n,this.buffer[r+3]=i}else this.buffer.push(e,t,n,i)}shift(e,t,n,i){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4);else{let r=e,{parser:s}=this.p;this.pos=i;let o=s.stateFlag(r,1);!o&&(i>n||t<=s.maxNode)&&(this.reducePos=i),this.pushState(r,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=s.maxNode&&this.buffer.push(t,n,i,4)}}apply(e,t,n,i){65536&e?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new Td(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Md(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(!(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let i,r=0;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let i=t[e+1];n.some((e,t)=>1&t&&e==i)||n.push(t[e],i)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let i=t[e+1];if(i==this.state)continue;let r=this.split();r.pushState(i,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(t[e],this.pos),r.reducePos=this.pos,r.score-=200,n.push(r)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(65536&t))return!1;if(!e.validAction(this.state,t)){let n=t>>19,i=65535&t,r=this.stack.length-3*n;if(r<0||e.getGoto(this.stack[r],i,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,r)=>{if(!t.includes(i))return t.push(i),e.allActions(i,t=>{if(393216&t);else if(65536&t){let n=(t>>19)-r;if(n>1){let i=65535&t,r=this.stack.length-3*n;if(r>=0&&e.getGoto(this.stack[r],i,!1)>=0)return n<<19|65536|i}}else{let e=n(t,r+1);if(null!=e)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Od(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return!(e<=this.lookAhead||(this.emitLookAhead(),this.lookAhead=e,0))}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Od{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Md{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class Bd{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Bd(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Bd(this.stack,this.pos,this.index)}}function Dd(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let i=0,r=0;i<e.length;){let s=0;for(;;){let t=e.charCodeAt(i++),n=!1;if(126==t){s=65535;break}t>=92&&t--,t>=34&&t--;let r=t-32;if(r>=46&&(r-=46,n=!0),s+=r,n)break;s*=46}n?n[r++]=s:n=new t(s)}return n}class Rd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Id=new Rd;class Pd{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Id,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,r=this.pos+e;for(;r<n.from;){if(!i)return null;let e=this.ranges[--i];r-=n.from-e.to,n=e}for(;t<0?r>n.to:r>=n.to;){if(i==this.ranges.length-1)return null;let e=this.ranges[++i];r+=e.from-n.to,n=e}return r}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t,n,i=this.chunkOff+e;if(i>=0&&i<this.chunk.length)t=this.pos+e,n=this.chunk.charCodeAt(i);else{let i=this.resolveOffset(e,1);if(null==i)return-1;if(t=i,t>=this.chunk2Pos&&t<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(t-this.chunk2Pos);else{let e=this.rangeIndex,i=this.range;for(;i.to<=t;)i=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=t),t+this.chunk2.length>i.to&&(this.chunk2=this.chunk2.slice(0,i.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Id,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class Nd{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;!function(e,t,n,i,r,s){let o=0,l=1<<i,{dialect:a}=n.p.parser;e:for(;0!=(l&e[o]);){let n=e[o+1];for(let i=o+3;i<n;i+=2)if((e[i+1]&l)>0){let n=e[i];if(a.allows(n)&&(-1==t.token.value||t.token.value==n||Fd(n,t.token.value,r,s))){t.acceptToken(n);break}}let i=t.next,c=0,h=e[o+2];if(!(t.next<0&&h>c&&65535==e[n+3*h-3])){for(;c<h;){let r=c+h>>1,s=n+r+(r<<1),l=e[s],a=e[s+1]||65536;if(i<l)h=r;else{if(!(i>=a)){o=e[s+2],t.advance();continue e}c=r+1}}break}o=e[n+3*h-1]}}(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}function Ld(e,t,n){for(let i,r=t;65535!=(i=e[r]);r++)if(i==n)return r-t;return-1}function Fd(e,t,n,i){let r=Ld(n,i,t);return r<0||Ld(n,i,e)<r}Nd.prototype.contextual=Nd.prototype.fallback=Nd.prototype.extend=!1,Nd.prototype.fallback=Nd.prototype.extend=!1;const jd="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let zd=null;function Vd(e,t,n){let i=e.cursor(fl.IncludeAnonymous);for(i.moveTo(t);;)if(!(n<0?i.childBefore(t):i.childAfter(t)))for(;;){if((n<0?i.to<t:i.from>t)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(e.length,Math.max(i.from+1,t+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:e.length}}class Wd{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Vd(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Vd(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let r=n.children[i],s=this.start[t]+n.positions[i];if(s>e)return this.nextStart=s,null;if(r instanceof pl){if(s==e){if(s<this.safeFrom)return null;let e=s+r.length;if(e<=this.safeTo){let t=r.prop(ol.lookAhead);if(!t||e+t<this.fragment.to)return r}}this.index[t]++,s+r.length>=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(s),this.index.push(0))}else this.index[t]++,this.nextStart=s+r.length}}}class Hd{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new Rd)}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:r}=i,s=i.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,l=0;for(let i=0;i<r.length;i++){if(!(1<<i&s))continue;let a=r[i],c=this.tokens[i];if((!n||a.fallback)&&((a.contextual||c.start!=e.pos||c.mask!=s||c.context!=o)&&(this.updateCachedToken(c,a,e),c.mask=s,c.context=o),c.lookAhead>c.end+25&&(l=Math.max(c.lookAhead,l)),0!=c.value)){let i=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!a.extend&&(n=c,t>i))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),n||e.pos!=this.stream.end||(n=new Rd,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Rd,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:t}=n.p;for(let i=0;i<t.specialized.length;i++)if(t.specialized[i]==e.value){let r=t.specializers[i](this.stream.read(e.start,e.end),n);if(r>=0&&n.p.parser.dialect.allows(r>>1)){1&r?e.extended=r>>1:e.value=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let t=0;t<i;t+=3)if(this.actions[t]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=n,i}addActions(e,t,n,i){let{state:r}=e,{parser:s}=e.p,{data:o}=s;for(let e=0;e<2;e++)for(let l=s.stateSlot(r,e?2:1);;l+=3){if(65535==o[l]){if(1!=o[l+1]){0==i&&2==o[l+1]&&(i=this.putAction(Gd(o,l+2),t,n,i));break}l=Gd(o,l+2)}o[l]==t&&(i=this.putAction(Gd(o,l+1),t,n,i))}return i}}class qd{constructor(e,t,n,i){this.parser=e,this.input=t,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Pd(t,i),this.tokens=new Hd(e,this.stream),this.topTerm=e.top[1];let{from:r}=i[0];this.stacks=[Td.start(this,e.top[0],r)],this.fragments=n.length&&this.stream.end-r>4*e.bufferLength?new Wd(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,i=this.minStackPos,r=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let 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;{e||(e=[],t=[]),e.push(o);let n=this.tokens.getMainToken(o);t.push(n.value,n.end)}}break}}if(!r.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}(e);if(t)return jd&&console.log("Finish with "+this.stackID(t)),this.stackToTree(t);if(this.parser.strict)throw jd&&e&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&e){let n=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,r);if(n)return jd&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(r.length>e)for(r.sort((e,t)=>t.score-e.score);r.length>e;)r.pop();r.some(e=>e.reducePos>i)&&this.recovering--}else if(r.length>1){e:for(let e=0;e<r.length-1;e++){let t=r[e];for(let n=e+1;n<r.length;n++){let i=r[n];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500){if(!((t.score-i.score||t.buffer.length-i.buffer.length)>0)){r.splice(e--,1);continue e}r.splice(n--,1)}}}r.length>12&&(r.sort((e,t)=>t.score-e.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let e=1;e<r.length;e++)r[e].pos<this.minStackPos&&(this.minStackPos=r[e].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let i=e.pos,{parser:r}=this,s=jd?this.stackID(e)+" -> ":"";if(null!=this.stoppedAt&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(i);o;){let i=this.parser.nodeSet.types[o.type.id]==o.type?r.getGoto(e.state,o.type.id):-1;if(i>-1&&o.length&&(!t||(o.prop(ol.contextHash)||0)==n))return e.useNode(o,i),jd&&console.log(s+this.stackID(e)+` (via reuse of ${r.getName(o.type.id)})`),!0;if(!(o instanceof pl)||0==o.children.length||o.positions[0]>0)break;let l=o.children[0];if(!(l instanceof pl&&0==o.positions[0]))break;o=l}}let o=r.stateSlot(e.state,4);if(o>0)return e.reduce(o),jd&&console.log(s+this.stackID(e)+` (via always-reduce ${r.getName(65535&o)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let o=0;o<l.length;){let a=l[o++],c=l[o++],h=l[o++],u=o==l.length||!n,d=u?e:e.split(),f=this.tokens.mainToken;if(d.apply(a,c,f?f.start:d.pos,h),jd&&console.log(s+this.stackID(d)+` (via ${65536&a?`reduce of ${r.getName(65535&a)}`:"shift"} for ${r.getName(c)} @ ${i}${d==e?"":", split"})`),u)return!0;d.pos>i?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return $d(e,t),!0}}runRecovery(e,t,n){let i=null,r=!1;for(let s=0;s<e.length;s++){let o=e[s],l=t[s<<1],a=t[1+(s<<1)],c=jd?this.stackID(o)+" -> ":"";if(o.deadEnd){if(r)continue;if(r=!0,o.restart(),jd&&console.log(c+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))continue}let h=o.split(),u=c;for(let e=0;e<10&&h.forceReduce()&&(jd&&console.log(u+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));e++)jd&&(u=this.stackID(h)+" -> ");for(let e of o.recoverByInsert(l))jd&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>o.pos?(a==o.pos&&(a++,l=0),o.recoverByDelete(l,a),jd&&console.log(c+this.stackID(o)+` (via recover-delete ${this.parser.getName(l)})`),$d(o,n)):(!i||i.score<h.score)&&(i=h)}return i}stackToTree(e){return e.close(),pl.build({buffer:Bd.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(zd||(zd=new WeakMap)).get(e);return t||zd.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function $d(e,t){for(let n=0;n<t.length;n++){let i=t[n];if(i.pos==e.pos&&i.sameState(e))return void(t[n].score<e.score&&(t[n]=e))}t.push(e)}class Ud{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||0==this.disabled[e]}}class Kd extends Rl{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push("");let n=Object.keys(e.topRules).map(t=>e.topRules[t][1]),i=[];for(let e=0;e<t.length;e++)i.push([]);function r(e,t,n){i[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];"string"==typeof e&&(e=ol[e]);for(let n=1;n<t.length;){let i=t[n++];if(i>=0)r(i,e,t[n++]);else{let s=t[n+-i];for(let o=-i;o>0;o--)r(t[n++],e,s);n++}}}this.nodeSet=new hl(t.map((t,r)=>cl.define({name:r>=this.minRepeatTerm?void 0:t,id:r,props:i[r],top:n.indexOf(r)>-1,error:0==r,skipped:e.skippedNodes&&e.skippedNodes.indexOf(r)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=il;let s=Dd(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(Yd),this.states=Dd(e.states,Uint32Array),this.data=Dd(e.stateData),this.goto=Dd(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>"number"==typeof e?new Nd(s,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let i=new qd(this,e,t,n);for(let r of this.wrappers)i=r(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let r=i[t+1];;){let t=i[r++],s=1&t,o=i[r++];if(s&&n)return o;for(let n=r+(t>>1);r<n;r++)if(i[r]==e)return o;if(s)return-1}}hasAction(e,t){let n=this.data;for(let i=0;i<2;i++)for(let r,s=this.stateSlot(e,i?2:1);;s+=3){if(65535==(r=n[s])){if(1!=n[s+1]){if(2==n[s+1])return Gd(n,s+2);break}r=n[s=Gd(n,s+2)]}if(r==t||0==r)return Gd(n,s+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Gd(this.data,n+2)}i=t(Gd(this.data,n+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Gd(this.data,n+2)}if(!(1&this.data[n+2])){let e=this.data[n+1];t.some((t,n)=>1&n&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(Kd.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,i)=>{let r=e.specializers.find(e=>e.from==n.external);if(!r)return n;let s=Object.assign(Object.assign({},n),{external:r.to});return t.specializers[i]=Yd(s),s})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let i of e.split(" ")){let e=t.indexOf(i);e>=0&&(n[e]=!0)}let i=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n,r=this.dialects[t[e]];65535!=(n=this.data[r++]);)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new Ud(e,n,i)}static deserialize(e){return new Kd(e)}}function Gd(e,t){return e[t]|e[t+1]<<16}function Yd(e){if(e.external){let t=e.extend?1:0;return(n,i)=>e.external(n,i)<<1|t}return e.get}const Jd=jl({String:oa.string,Number:oa.number,"True False":oa.bool,PropertyName:oa.propertyName,Null:oa.null,", :":oa.separator,"[ ]":oa.squareBracket,"{ }":oa.brace}),Qd=Kd.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:[Jd],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}),Xd=da.define({name:"json",parser:Qd.configure({props:[Ma.add({Object:Na({except:/^\s*\}/}),Array:Na({except:/^\s*\]/})}),Fa.add({"Object Array":function(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Zd(){return new Ca(Xd)}const ef=[ro.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},"& .cm-completionDetail":{float:"right",fontStyle:"normal"}}),ro.baseTheme({"& .variableName":{color:"#10f"},"& .number":{color:"#164"},"& .string":{color:"#a11"},"& .bool":{color:"#219"},"& .function":{color:"#aa3731",fontWeight:"bold"},"& .control":{color:"#708"}}),function(e){let t,n=[fc];return e instanceof ac&&(e.module&&n.push(ro.styleModule.of(e.module)),t=e.themeType),t?n.push(cc.computeN([ro.darkTheme],n=>n.facet(ro.darkTheme)==("dark"==t)?[e]:[])):n.push(cc.of(e)),n}(ac.define([{tag:oa.variableName,class:"variableName"},{tag:oa.name,class:"variableName"},{tag:oa.number,class:"number"},{tag:oa.string,class:"string"},{tag:oa.bool,class:"bool"},{tag:oa.function(oa.variableName),class:"function"},{tag:oa.function(oa.special(oa.variableName)),class:"function"},{tag:oa.controlKeyword,class:"control"},{tag:oa.operatorKeyword,class:"control"}]))];function tf(e){return[nf(e),ro.updateListener.of(e=>{if(e.selectionSet||e.docChanged){const{state:t}=e,n=t.selection.main.head;if(!rf(fa(t).resolve(n,-1)))return null;""===t.doc.lineAt(n).text.trim()&&setTimeout(()=>{mh(e.view)},100)}})]}function nf(e){return Lh({override:[t=>function(e,t){const{state:n,pos:i}=e,r=n.doc.lineAt(i),s=i-r.from;if(r.text.slice(0,s).includes(":"))return null;const o=fa(n).resolve(i,-1);if(!rf(o))return null;const l=n.sliceDoc(o.from,i).startsWith('"'),a='"'===r.text[s],c=t.map(e=>({label:e.label,type:e.type,info:e.info,apply:(t,n,i,r)=>{const s=t.state.sliceDoc(i-1,r+1);s.startsWith('"')&&(i-=1),s.endsWith('"')&&(r+=1);let o=`"${e.label}": ,`,l=i+o.length-1,a=l;(function(e,t){const n=e.sliceDoc(t).trimStart();return n&&'"'===n[0]})(t.state,r)||(o=o.slice(0,-1));const c=t.state.update({changes:{from:i,to:r,insert:o},selection:{anchor:l,head:a}});t.dispatch(c)}})),h="Object"===o.name?i:o.from;return{from:l?h+1:h,to:a?r.to-1:r.to,options:c}}(t,e)]})}function rf(e){return!!function(e){let t=0,n=e;for(;n.parent;){if("Object"===n.name&&t++,t>1)return!1;n=n.parent}return!0}(e)&&["Object","PropertyName","⚠"].includes(e.name)}const sf="LOCAL",of="PROCESS";function lf(e,t,n,i){const r={};for(const s of e){const{name:e,value:o,variableKey:l}=s,a=af(s,t,n,i);try{r[l]={name:e,value:JSON.parse(o),scope:a}}catch{r[l]={name:e,value:o,scope:a}}}return r}function af(e,t,n,i){const{scopeKey:r}=e;return t.find(e=>e.elementInstanceKey===r&&e.elementId===i)?sf:r===n?of:null}function cf(e,t){return Object.values(e).reduce((e,n)=>(R(n)&&P(n,"name")&&t===n.scope&&(e[n.name]=n.value),e),{})}const hf=at.define(),uf=new Je,df="JSON contains errors",ff={},pf=[];function gf({allOutputs:e=ff,value:n,onChange:i,onClear:r,onErrorChange:s,variablesForElement:o=pf}){const l=(0,S.useMemo)(()=>{const t=o.map(({name:e,detail:t,info:n})=>({label:e,type:"variable",info:()=>mf(0,"Process variable"),detail:t,value:n||void 0})),n=function(e){const t=[];for(const n in e)if(e[n]){const{variables:i={}}=e[n];N(i,e=>{if(!R(e)||!P(e,"name"))return;const{name:i,value:r,scope:s}=e;s===of&&t.push({name:i,value:r,origin:n})})}return t}(e),i=n.map(({name:e,value:t,origin:n})=>({label:e,type:"variable",info:()=>mf(0,`Output variable from ${n}`),detail:Af(t),value:t}));return[...t,...i]},[e,o]),a=(0,S.useRef)(null),[c,h]=(0,S.useState)(),[u,d]=(0,S.useState)();return(0,S.useEffect)(()=>{if(!a.current)return;const e=wt.create({doc:n,extensions:[Lh(),[Oh,_h],wc(),wt.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:i}=e.newSelection.main,r=n.lineAt(i);if(i>r.from+200)return e;let s=n.sliceString(r.from,i);if(!t.some(e=>e.test(s)))return e;let{state:o}=e,l=-1,a=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==l)continue;l=t.from;let n=Ta(o,t.from);if(null==n)continue;let i=/^\s*/.exec(t.text)[0],r=Ea(o,n);i!=r&&a.push({from:t.from,to:t.from+i.length,insert:r})}return a.length?[e,{changes:a,sequential:!0}]:e}),fo.of([...Zu]),(new Je).of(Zd()),(new Je).of(wt.tabSize.of(2)),ro.contentAttributes.of({"aria-label":"JSON editor",tabindex:"0"}),Ad(e=>{const t=(e=>{try{JSON.parse(e.state.doc.toString())}catch(t){if(!(t instanceof SyntaxError))throw t;const n=function(e,t){let n;return(n=e.message.match(/at position (\d+)/))?Math.min(+n[1],t.length):(n=e.message.match(/at line (\d+) column (\d+)/))?Math.min(t.line(+n[1]).from+ +n[2]-1,t.length):0}(t,e.state.doc);return[{from:n,message:t.message,severity:"error",to:n}]}return[]})(e),n=t&&t.length>0;return s(n?df:null),d(n?df:null),t},{delay:300}),uf.of(tf(l)),bo("Enter process variables in JSON format"),oc(),fo.of(Qa),ef,ro.lineWrapping,ro.updateListener.of(e=>{if(e.docChanged){if(e.transactions.some(e=>e.annotation(hf)))return;const t=e.state.doc.toString();i(t)}})]}),t=new ro({state:e,parent:a.current});return h(t),()=>{t.destroy()}},[i]),(0,S.useEffect)(()=>{c&&c.dispatch({effects:uf.reconfigure(tf(l))})},[l,c]),(0,S.useEffect)(()=>{if(!c)return;const e=c.state.doc.toString();n!==e&&c.dispatch({changes:{from:0,to:e.length,insert:n},annotations:hf.of(!0)})},[c,n]),(0,E.jsxs)("div",{className:M()("code__editor",{"code__editor--error":u}),children:[(0,E.jsx)(t,{className:"code__editor-clear-button",renderIcon:f,iconDescription:"Clear editor",size:"sm",kind:"ghost",hasIconOnly:!0,onClick:r}),(0,E.jsx)("div",{className:"code__editor-codemirror",children:(0,E.jsx)("div",{ref:a,className:"code__editor-codemirror-inner"})}),u&&(0,E.jsx)("div",{className:"code__editor-error",children:u})]})}function mf(e,t){const n=document.createElement("div"),i=(0,Z.qV)((0,E.jsx)("div",{className:"info",children:(0,E.jsx)("span",{children:t})}));return n.innerHTML=i,n}function Af(e){const t=typeof e;return"object"===t?Array.isArray(e)?"Array":null===e?"null":"Object":t.charAt(0).toUpperCase()+t.slice(1)}function vf({allOutputs:e,input:t="",onErrorChange:n,onResetInput:r,onSetInput:s,variablesForElement:o}){return(0,E.jsxs)("div",{className:"input",children:[(0,E.jsx)("div",{className:"input__header",children:(0,E.jsx)("div",{className:"input__header--title",children:(0,E.jsx)(T,{className:"has-tooltip",label:(0,E.jsxs)("span",{children:["Variables the process instance will be started with. ",(0,E.jsx)(i,{href:"https://docs.camunda.io/docs/components/concepts/variables/",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),align:"bottom-start",children:(0,E.jsx)("span",{children:"Process variables"})})})}),(0,E.jsx)(gf,{allOutputs:e,value:t,onChange:s,onClear:()=>{r()},onErrorChange:n,variablesForElement:o}),(0,E.jsxs)("div",{className:"input__footer",children:[(0,E.jsx)("div",{className:"input__footer--icon",children:(0,E.jsx)(g,{})}),(0,E.jsx)("div",{className:"input__footer--text",children:"Optionally define process variables to start the process instance with."})]})]})}function bf({value:e}){const n=(0,S.useRef)(null),[i,r]=(0,S.useState)();return(0,S.useEffect)(()=>{if(!n.current)return;const t=wt.create({doc:e,extensions:[Zd(),wt.tabSize.of(2),wt.readOnly.of(!0),ro.editable.of(!1),ro.lineWrapping,oc(),fo.of(Qa),ef]}),i=new ro({state:t,parent:n.current});return r(i),()=>{i.destroy()}},[]),(0,S.useEffect)(()=>{if(!i)return;const t=i.state.doc.toString();e!==t&&i.dispatch({changes:{from:0,to:t.length,insert:e}})},[i,e]),(0,E.jsxs)("div",{className:"code__editor",children:[(0,E.jsx)(t,{className:"code__editor-copy-button",renderIcon:h,iconDescription:"Copy to clipboard",size:"sm",kind:"ghost",hasIconOnly:!0,onClick:()=>{navigator.clipboard.writeText(e)}}),(0,E.jsx)("div",{className:"code__editor-codemirror",children:(0,E.jsx)("div",{ref:n,className:"code__editor-codemirror-inner"})})]})}const xf="status",yf="job",wf="user-task",Cf="message-subscription",kf="element-instance",_f="deployed",Sf="instance-started";function Ef(e){if(!e)return null;const t=new Date(e).getTime();return isNaN(t)?null:t}function Tf(e,t){return{state:e.state,type:e.type,elementId:e.elementId,kind:e.kind,listenerEventType:e.listenerEventType,jobKey:e.jobKey,creationTime:e.creationTime,endTime:e.endTime,...t}}function Of(e,t){return{state:e.state||"",name:e.name,userTaskKey:e.userTaskKey,creationDate:e.creationDate,completionDate:e.completionDate,...t}}function Mf(e,t){return{type:e.type,state:e.state,elementId:e.elementId,elementName:e.elementName,startDate:e.startDate,endDate:e.endDate,elementInstanceKey:e.elementInstanceKey,...t}}function Bf(e,t){return{messageName:e.messageName,elementId:e.elementId,messageSubscriptionState:e.messageSubscriptionState,messageSubscriptionKey:e.messageSubscriptionKey,...t}}function Df(e,t,n){return{type:yf,data:Tf(e,n),timestamp:t}}class Rf{constructor(e){var t;this._state=null,this._deployResponse=null,this._startInstanceResponse=null,this._polledResult=null,this._finishedResult=null,this._entries=[],this._elementRegistry=(null==e||null===(t=e.get)||void 0===t?void 0:t.call(e,"elementRegistry"))||null}setState(e,t=Date.now()){this._state={type:e,timestamp:t},this._updateEntries()}setDeployResponse(e,t=Date.now()){this._deployResponse={response:e,timestamp:t},this._updateEntries()}setStartInstanceResponse(e,t=Date.now()){this._startInstanceResponse={response:e,timestamp:t},this._updateEntries()}setPolledResult(e,t=Date.now()){this._polledResult={result:e,timestamp:t},this._updateEntries()}setFinishedResult(e,t=Date.now()){this._finishedResult={result:e,timestamp:t},this._updateEntries()}getEntries(){return this._entries}reset(){this._state=null,this._deployResponse=null,this._startInstanceResponse=null,this._polledResult=null,this._finishedResult=null,this._entries=[]}_updateEntries(){const e=[];if(this._deployResponse){const n=this._deployResponse.response;let i;if(!1!==n.success){var t;const e=n.response||n,r=null===(t=e.deployments)||void 0===t?void 0:t[0],s=r&&"processDefinition"in r?r.processDefinition:void 0;i={processDefinitionId:null==s?void 0:s.processDefinitionId,processDefinitionKey:null==s?void 0:s.processDefinitionKey,processDefinitionVersion:null==s?void 0:s.processDefinitionVersion,deploymentKey:e.deploymentKey}}e.push({type:xf,status:_f,data:i,timestamp:this._deployResponse.timestamp})}if(this._startInstanceResponse){const t=this._startInstanceResponse.response;let n;if(!1!==t.success){const e=t.response||t;n={processInstanceKey:e.processInstanceKey,processDefinitionId:e.processDefinitionId,processDefinitionKey:e.processDefinitionKey}}e.push({type:xf,status:Sf,data:n,timestamp:this._startInstanceResponse.timestamp})}if(this._polledResult){var n,i,r,s;const{result:t,timestamp:o}=this._polledResult;let l=[];if(null!==(n=t.elementInstancesResponse)&&void 0!==n&&n.success&&(l=t.elementInstancesResponse.response.items||[],e.push(...function(e,t){const n=[];for(const i of e){const e=Ef(i.startDate);if(n.push({type:kf,data:Mf(i,{state:"ACTIVE"}),timestamp:e||t}),"ACTIVE"===i.state)continue;const r=Ef(i.endDate);n.push({type:kf,data:Mf(i),timestamp:r||t})}return n}(l,o))),null!==(i=t.jobsResponse)&&void 0!==i&&i.success){const n=t.jobsResponse.response.items||[];e.push(...function(e,t,n){const i=[];for(const r of e){let e=Ef(r.creationTime);if(!e&&r.elementInstanceKey&&t){const n=t.find(e=>e.elementInstanceKey===r.elementInstanceKey);if(null!=n&&n.startDate){const t=new Date(n.startDate).getTime();isNaN(t)||(e=t)}}if(i.push(Df(r,e||n,{state:"CREATED"})),"CREATED"===r.state)continue;const s=Ef(r.endTime);i.push(Df(r,s||n,{state:r.state}))}return i}(n,l,o))}if(null!==(r=t.userTasksResponse)&&void 0!==r&&r.success){const n=t.userTasksResponse.response.items||[];e.push(...function(e,t){const n=[];for(const i of e){const e=Ef(i.creationDate);if(n.push({type:wf,data:Of(i,{state:"CREATED"}),timestamp:e||t}),"CREATED"===i.state)continue;const r=Ef(i.completionDate);n.push({type:wf,data:Of(i),timestamp:r||t})}return n}(n,o))}if(null!==(s=t.messageSubscriptionsResponse)&&void 0!==s&&s.success){const n=t.messageSubscriptionsResponse.response.items||[];e.push(...function(e,t,n){const i=[];for(const r of e){let e=n,s=n;if(r.elementInstanceKey&&t){const n=t.find(e=>e.elementInstanceKey===r.elementInstanceKey);if(null!=n&&n.startDate){const t=new Date(n.startDate).getTime();isNaN(t)||(e=t)}if(null!=n&&n.endDate&&"CORRELATED"===r.messageSubscriptionState){const e=new Date(n.endDate).getTime();isNaN(e)||(s=e)}}i.push({type:Cf,data:Bf(r,{messageSubscriptionState:"CREATED"}),timestamp:e}),"CORRELATED"===r.messageSubscriptionState&&i.push({type:Cf,data:Bf(r),timestamp:s})}return i}(n,l,o))}}if(this._finishedResult){const{result:t,timestamp:n}=this._finishedResult;e.push(function(e,t){var n,i;if(e.success)return{type:xf,status:"completed",data:{processInstanceKey:e.processInstanceKey},timestamp:t};switch(e.reason){case"incident":return{type:xf,status:"incident",data:{processInstanceKey:e.processInstanceKey,errorType:null===(n=e.incident)||void 0===n?void 0:n.errorType,errorMessage:null===(i=e.incident)||void 0===i?void 0:i.errorMessage},timestamp:t};case"terminated":return{type:xf,status:"terminated",data:{processInstanceKey:e.processInstanceKey},timestamp:t};default:return{type:xf,status:"canceled",data:"error"in e?{error:e.error}:void 0,timestamp:t}}}(t,n))}this._state&&("deploying"===this._state.type&&!this._deployResponse||"starting-instance"===this._state.type&&!this._startInstanceResponse||"executing"===this._state.type&&!this._polledResult&&!this._finishedResult)&&e.push({type:xf,status:this._state.type,timestamp:this._state.timestamp}),e.sort((e,t)=>e.timestamp-t.timestamp),this._entries=e}}function If(e){let t=e.length;for(;t>0&&"/"===e[t-1];)t--;return e.slice(0,t)}const Pf={deploying:"Deploying process",deployed:"Process deployed","starting-instance":"Starting process instance","instance-started":"Process instance started",executing:null,completed:"Process instance completed",terminated:"Process instance terminated",incident:"Incident",canceled:"Test canceled"},Nf="CREATED",Lf="CREATED",Ff="ACTIVE";function jf(e){const t=e.data;if(!t)return[];const n=[];return e.status===_f&&(t.processDefinitionId&&n.push({label:"Process",value:t.processDefinitionId}),t.processDefinitionKey&&n.push({label:"Definition Key",value:t.processDefinitionKey}),t.processDefinitionVersion&&n.push({label:"Version",value:String(t.processDefinitionVersion)}),t.deploymentKey&&n.push({label:"Deployment Key",value:t.deploymentKey})),e.status===Sf&&(t.processInstanceKey&&n.push({label:"Instance Key",value:t.processInstanceKey}),t.processDefinitionId&&n.push({label:"Process",value:t.processDefinitionId}),t.processDefinitionKey&&n.push({label:"Definition Key",value:t.processDefinitionKey})),"completed"!==e.status&&"terminated"!==e.status||t.processInstanceKey&&n.push({label:"Instance Key",value:t.processInstanceKey}),"incident"===e.status&&(t.processInstanceKey&&n.push({label:"Instance Key",value:t.processInstanceKey}),t.errorType&&n.push({label:"Error Type",value:t.errorType}),t.errorMessage&&n.push({label:"Error",value:t.errorMessage})),n}function zf(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`}function Vf({entries:e,tasklistBaseUrl:t,currentOperateUrl:n,isTaskExecuting:i}){if(!e.length)return(0,E.jsx)("div",{className:"execution-log",children:(0,E.jsxs)("div",{className:"execution-log__empty",children:["No log entries yet. Click ",(0,E.jsx)("span",{className:"execution-log__empty-action",children:"Test"})," to execute the task."]})});const r=function(e,t){if(!t)return[];const n=[];for(const t of e)t.type===yf&&t.data.state===Nf?n.push({label:"Waiting for job to be completed",secondaryLabel:t.data.type}):t.type===wf&&t.data.state===Lf?n.push({label:"Waiting for user task to be completed",secondaryLabel:t.data.name||t.data.elementId}):t.type===Cf&&"CREATED"===t.data.messageSubscriptionState&&n.push({label:"Waiting for message to be correlated",secondaryLabel:t.data.messageName});return n}(e,i);return(0,E.jsxs)("div",{className:"execution-log",children:[(0,E.jsxs)("ol",{className:"execution-log__entries",children:[e.map((e,t)=>e.type===xf?(0,E.jsx)(Wf,{entry:e},t):(0,E.jsx)(Hf,{entry:e},t)),r.map((e,t)=>(0,E.jsx)("li",{className:"execution-log__entry-wrapper execution-log__entry-wrapper--active",children:(0,E.jsx)("div",{className:"execution-log__entry-content",children:(0,E.jsx)("div",{className:"execution-log__entry",children:(0,E.jsxs)("div",{className:"execution-log__labels",children:[(0,E.jsx)("div",{className:"execution-log__label-row",children:(0,E.jsx)("span",{className:"execution-log__label",children:e.label})}),(0,E.jsx)("span",{className:"execution-log__secondary-label",children:e.secondaryLabel})]})})})},`waiting-${t}`))]}),(0,E.jsx)(qf,{entries:e,currentOperateUrl:n,isTaskExecuting:i}),(0,E.jsx)($f,{entries:e,currentOperateUrl:n,isTaskExecuting:i}),(0,E.jsx)(Uf,{entries:e,tasklistBaseUrl:t,isTaskExecuting:i})]})}function Wf({entry:e}){const[t,n]=(0,S.useState)(!1),i=Pf[e.status];if(!i)return null;const r=jf(e),s=r.length>0,o=s,l=()=>{o&&n(!t)};return(0,E.jsx)("li",{className:"execution-log__entry-wrapper",children:(0,E.jsxs)("div",{className:"execution-log__entry-content",children:[(0,E.jsxs)("div",{className:M()("execution-log__entry",{"execution-log__entry--expandable":o}),onClick:o?l:void 0,children:[(0,E.jsx)("span",{className:"execution-log__label",children:i}),o&&(0,E.jsx)("span",{className:"execution-log__toggle",onClick:e=>{e.stopPropagation(),l()},children:t?(0,E.jsx)(a,{size:16,className:"execution-log__chevron execution-log__chevron--open"}):(0,E.jsx)(c,{size:16,className:"execution-log__chevron"})})]}),t&&s&&(0,E.jsx)("dl",{className:"execution-log__details",children:r.map(({label:e,value:t},n)=>(0,E.jsxs)("div",{className:"execution-log__details-row",children:[(0,E.jsx)("dt",{className:"execution-log__details-label",children:e}),(0,E.jsx)("dd",{className:"execution-log__details-value",children:t})]},n))})]})})}function Hf({entry:e}){const[t,n]=(0,S.useState)(!1),i=function(e){switch(e.type){case xf:return Pf[e.status]||null;case yf:return"CANCELED"===(t=e.data).state?"Job canceled":"COMPLETED"===t.state?"Job completed":t.state===Nf?"Job created":"ERROR_THROWN"===t.state?"Job threw an error":"FAILED"===t.state?"Job failed":"MIGRATED"===t.state?"Job migrated":"RETRIES_UPDATED"===t.state?"Job retries updated":"TIMED_OUT"===t.state?"Job timed out":void 0;case wf:return function(e){return"COMPLETED"===e.state?"User task completed":"CANCELED"===e.state?"User task canceled":e.state===Lf?"User task created":void 0}(e.data);case Cf:return function(e){return"CREATED"===e.messageSubscriptionState?"Message subscription created":"CORRELATED"===e.messageSubscriptionState?"Message correlated":"CANCELED"===e.messageSubscriptionState?"Message subscription canceled":void 0}(e.data);case kf:return function(e){const{type:t,state:n}=e;if("BOUNDARY_EVENT"===t)return n===Ff?"Boundary event triggered":"Boundary event completed";if("EVENT_SUB_PROCESS"===t)return n===Ff?"Event sub-process triggered":"Event sub-process completed";const i=function(e){return(e||"").toLowerCase().replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}(t);return n===Ff?`${i} activated`:`${i} completed`}(e.data);default:return null}var t}(e),r=function(e){var t,n,i,r,s;switch(e.type){case kf:return(null===(t=e.data)||void 0===t?void 0:t.elementName)||(null===(n=e.data)||void 0===n?void 0:n.elementId)||null;case yf:return(null===(i=e.data)||void 0===i?void 0:i.type)||null;case Cf:return(null===(r=e.data)||void 0===r?void 0:r.messageName)||null;case wf:return(null===(s=e.data)||void 0===s?void 0:s.name)||null;default:return null}}(e),s=function(e){const{data:t,type:n}=e;if(n===kf){const{endDate:e,startDate:n,state:i}=t;if(["COMPLETED","TERMINATED"].includes(i)&&n&&e)return zf(new Date(e).getTime()-new Date(n).getTime())}else if(n===yf){const{creationTime:e,endTime:n,state:i}=t;if(["COMPLETED","FAILED"].includes(i)&&e&&n)return zf(new Date(n).getTime()-new Date(e).getTime())}else if(n===wf){const{completionDate:e,creationDate:n,state:i}=t;if(["CANCELED","COMPLETED","FAILED"].includes(i)&&n&&e)return zf(new Date(e).getTime()-new Date(n).getTime())}return null}(e),o=function(e){if(e.type===xf)return jf(e);if(e.type===yf){const t=e.data,n=[];t.type&&n.push({label:"Type",value:t.type}),t.elementId&&n.push({label:"Element",value:t.elementId});const i=function(e){if(!e)return null;const{kind:t,listenerEventType:n}=e;return"EXECUTION_LISTENER"!==t?null:"START"===n?"Start execution listener":"END"===n?"End execution listener":null}(t);return i&&n.push({label:"Kind",value:i}),t.state&&n.push({label:"State",value:t.state}),t.jobKey&&n.push({label:"Job Key",value:t.jobKey}),n}if(e.type===Cf){const t=e.data,n=[];return t.messageName&&n.push({label:"Message",value:t.messageName}),t.elementId&&n.push({label:"Element",value:t.elementId}),t.messageSubscriptionState&&n.push({label:"State",value:t.messageSubscriptionState}),t.messageSubscriptionKey&&n.push({label:"Subscription Key",value:t.messageSubscriptionKey}),n}if(e.type===kf){const t=e.data,n=[];return t.elementId&&n.push({label:"Element",value:t.elementId}),t.elementName&&n.push({label:"Name",value:t.elementName}),t.state&&n.push({label:"State",value:t.state}),t.startDate&&n.push({label:"Started",value:new Date(t.startDate).toLocaleTimeString()}),t.elementInstanceKey&&n.push({label:"Instance Key",value:t.elementInstanceKey}),n}return[]}(e),l=o.length>0,h=l;if(!i)return null;const u=()=>{h&&n(!t)},d=["execution-log__entry",h?"execution-log__entry--expandable":""].filter(Boolean).join(" ");return(0,E.jsx)("li",{className:"execution-log__entry-wrapper",children:(0,E.jsxs)("div",{className:"execution-log__entry-content",children:[(0,E.jsxs)("div",{className:d,onClick:h?u:void 0,children:[(0,E.jsxs)("div",{className:"execution-log__labels",children:[(0,E.jsxs)("div",{className:"execution-log__label-row",children:[(0,E.jsx)("span",{className:"execution-log__label",children:i}),s&&(0,E.jsx)("span",{className:"execution-log__duration",children:s})]}),r&&(0,E.jsx)("span",{className:"execution-log__secondary-label",children:r})]}),h&&(0,E.jsx)("span",{className:"execution-log__toggle",onClick:e=>{e.stopPropagation(),u()},children:t?(0,E.jsx)(a,{size:16,className:"execution-log__chevron execution-log__chevron--open"}):(0,E.jsx)(c,{size:16,className:"execution-log__chevron"})})]}),t&&l&&(0,E.jsx)("dl",{className:"execution-log__details",children:o.map(({label:e,value:t},n)=>(0,E.jsxs)("div",{className:"execution-log__details-row",children:[(0,E.jsx)("dt",{className:"execution-log__details-label",children:e}),(0,E.jsx)("dd",{className:"execution-log__details-value",children:t})]},n))})]})})}function qf({entries:e,currentOperateUrl:t,isTaskExecuting:n}){return n&&e.some(e=>e.type===yf&&"COMPLETED"!==e.data.state)?(0,E.jsxs)("div",{className:"execution-log__cta",children:[(0,E.jsxs)("div",{className:"execution-log__cta-header",children:[(0,E.jsx)(d,{size:16}),(0,E.jsx)("span",{className:"execution-log__cta-title",children:"Waiting for job completion"})]}),(0,E.jsx)("p",{className:"execution-log__cta-description",children:"Ensure the corresponding job is completed to continue the test execution."}),t&&(0,E.jsx)(i,{className:"execution-log__cta-link",href:t,target:"_blank",renderIcon:m,children:"Open in Operate"})]}):null}function $f({entries:e,currentOperateUrl:t,isTaskExecuting:n}){return n&&e.some(e=>e.type===Cf&&"CREATED"===e.data.messageSubscriptionState)?(0,E.jsxs)("div",{className:"execution-log__cta",children:[(0,E.jsxs)("div",{className:"execution-log__cta-header",children:[(0,E.jsx)(d,{size:16}),(0,E.jsx)("span",{className:"execution-log__cta-title",children:"Waiting for message correlation"})]}),(0,E.jsx)("p",{className:"execution-log__cta-description",children:"Ensure the required message is correlated to continue the test execution."}),t&&(0,E.jsx)(i,{className:"execution-log__cta-link",href:t,target:"_blank",renderIcon:m,children:"Open in Operate"})]}):null}function Uf({entries:e,tasklistBaseUrl:t,isTaskExecuting:n}){if(!n)return null;const r=e.find(e=>e.type===wf&&e.data.state===Lf);if(!r)return null;const s=function(e,t){try{const n=If(e);return new URL(t,`${n}/`).toString()}catch(e){return null}}(t,r.data.userTaskKey);return(0,E.jsxs)("div",{className:"execution-log__cta",children:[(0,E.jsxs)("div",{className:"execution-log__cta-header",children:[(0,E.jsx)(x,{size:16}),(0,E.jsx)("span",{className:"execution-log__cta-title",children:"Waiting for user task completion"})]}),(0,E.jsx)("p",{className:"execution-log__cta-description",children:"Complete the user task to continue the test execution."}),s&&(0,E.jsx)(i,{className:"execution-log__cta-link",href:s,target:"_blank",renderIcon:m,children:"Open in Tasklist"})]})}const Kf={plugins:[],registerPlugin:e=>{},unregisterPlugin:e=>{},getPlugins:e=>[]},Gf=(0,S.createContext)(Kf),Yf=[];function Jf({element:e,isConnectionConfigured:t,isTaskExecuting:n,output:i,currentOperateUrl:r,onResetOutput:s,taskExecutionState:l,executionLog:a,tasklistBaseUrl:c,currentVariables:h}){const u=(null==i?void 0:i.error)||(null==i?void 0:i.incident),d=(null==i?void 0:i.success)&&!u,f=null==i?void 0:i.terminated,g=null==i?void 0:i.canceled,m=(0,S.useMemo)(()=>u?"error":d?"success":f?"warning":g?"canceled":null,[u,d,f,g]),A=(0,S.useMemo)(()=>u?(0,E.jsx)(w,{}):d?(0,E.jsx)(o,{}):f?(0,E.jsx)(b,{}):g?(0,E.jsx)(p,{}):null,[u,d,f,g]),v=(0,S.useMemo)(()=>{if(null==i||!i.startedAt||null==i||!i.finishedAt)return null;const e=i.finishedAt-i.startedAt;return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`},[i]);return(0,E.jsxs)("div",{className:"output",children:[n&&(0,E.jsx)(ip,{currentOperateUrl:r}),!n&&i&&(0,E.jsx)(rp,{bannerVariant:m,statusIcon:A,timingText:v,onResetOutput:s,isConnectionConfigured:t,currentOperateUrl:r,element:e,output:i,isTaskExecuting:n}),n||i?(0,E.jsxs)("div",{className:"output__body",children:[(0,E.jsx)(op,{title:"Log",defaultOpen:!0,isExecuting:n,children:(null==a?void 0:a.length)>0?(0,E.jsx)(Vf,{entries:a,tasklistBaseUrl:c,currentOperateUrl:r,isTaskExecuting:n}):(0,E.jsx)("div",{className:"output__section-empty",children:"Result does not have a log."})}),(0,E.jsx)(lp,{title:"Process Variables",tooltip:(0,E.jsxs)("span",{children:["Variables in the process scope. ",(0,E.jsx)("a",{href:"https://docs.camunda.io/docs/components/concepts/variables/",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),scope:of,output:i,currentVariables:h,isTaskExecuting:n}),(0,E.jsx)(lp,{title:"Local Variables",tooltip:(0,E.jsxs)("span",{children:["Variables in the scope of the executed element. ",(0,E.jsx)("a",{href:"https://docs.camunda.io/docs/components/concepts/variables/",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),scope:sf,output:i,currentVariables:h,isTaskExecuting:n})]}):(0,E.jsx)(np,{})]})}const Qf=e=>{const{getPlugins:t}=(0,S.useContext)(Gf),n=t("output.header.link").reduce((t,n)=>{var i;const r=t=>I(t)?t(e):t;if(!(r(n.visible)??1))return t;const s=(null===(i=n.render)||void 0===i?void 0:i.call(n,e))||n.children;return t.push({content:s,href:r(n.href),target:r(n.target),className:r(n.className),onClick:r(n.onClick),renderIcon:r(n.renderIcon),role:r(n.role),tooltip:r(n.tooltip)}),t},[]);return(0,E.jsx)(E.Fragment,{children:n.map(({content:e,href:t,target:n,className:r,onClick:s,renderIcon:o,role:l,tooltip:a},c)=>{const h=(0,E.jsx)(i,{href:t,target:n,className:r,onClick:s,renderIcon:o,role:l,children:e},c);return a?(0,E.jsx)(T,{className:"has-tooltip",label:a,align:"bottom-start",children:h},c):h})})},Xf=()=>null,Zf=({children:e=null,render:t=Xf,visible:n,href:i,target:r,className:s,onClick:o,renderIcon:l,role:a,tooltip:c,priority:h=100})=>{const{registerPlugin:u,unregisterPlugin:d}=(0,S.useContext)(Gf);return(0,S.useEffect)(()=>{const f={children:e,render:t,visible:n,href:i,target:r,className:s,onClick:o,renderIcon:l,role:a,tooltip:c,priority:h,type:"output.header.link"};return u(f),()=>{d(f)}},[e,t,n,i,r,s,o,l,a,c,h,u,d]),null},ep=()=>{const e=(0,S.useCallback)(()=>"Open in Operate",[]),t=(0,S.useCallback)(({output:e,isConnectionConfigured:t,currentOperateUrl:n})=>t&&(n||e&&!e.error),[]),n=(0,S.useCallback)(({output:e,currentOperateUrl:t})=>t||(null==e?void 0:e.operateUrl),[]),i=(0,S.useCallback)(({output:e,currentOperateUrl:t})=>t||(null==e?void 0:e.operateUrl)?void 0:"link--disabled",[]),r=(0,S.useCallback)(({output:e,currentOperateUrl:t})=>t||(null==e?void 0:e.operateUrl)?null:"Operate URL not found",[]);return(0,E.jsx)(Zf,{priority:1/0,render:e,visible:t,href:n,target:"_blank",className:i,tooltip:r,renderIcon:m})};function tp(){return(0,E.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("mask",{id:"mask0_191_9328",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:(0,E.jsx)("path",{d:"M24 0H0V24H24V0Z",fill:"white"})}),(0,E.jsxs)("g",{mask:"url(#mask0_191_9328)",children:[(0,E.jsx)("path",{d:"M19.3852 2.40472C21.2873 2.50108 22.8 4.07389 22.8 6.00002V13.2H21.3V6.00002C21.3 4.84022 20.3598 3.90002 19.2 3.90002H4.80001C3.64021 3.90002 2.70001 4.84022 2.70001 6.00002V15.6C2.70001 16.7598 3.64021 17.7 4.80001 17.7H13.2V19.2H4.80001C2.87388 19.2 1.30106 17.6873 1.2047 15.7852L1.20001 15.6V6.00002C1.20001 4.0118 2.81179 2.40002 4.80001 2.40002H19.2L19.3852 2.40472Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M15.9273 22.8C15.8405 22.8 15.7572 22.7579 15.6959 22.6829C15.6345 22.6079 15.6 22.5061 15.6 22.4V13.6001C15.6 13.5305 15.6148 13.4622 15.643 13.4018C15.6712 13.3415 15.7118 13.2911 15.7607 13.2557C15.8097 13.2203 15.8654 13.2011 15.9222 13.2C15.9791 13.1989 16.0352 13.216 16.0851 13.2496L22.6305 17.6495C22.6818 17.684 22.7247 17.7348 22.7544 17.7964C22.7843 17.858 22.8 17.9284 22.8 18C22.8 18.0716 22.7843 18.142 22.7544 18.2036C22.7247 18.2652 22.6818 18.316 22.6305 18.3505L16.0851 22.7504C16.0367 22.783 15.9825 22.8 15.9273 22.8Z",fill:"currentColor"})]})]})}function np(){return(0,E.jsxs)("div",{className:"output__empty-state",children:[(0,E.jsx)("span",{className:"output__empty-state-icon",children:(0,E.jsx)(tp,{})}),(0,E.jsx)("span",{className:"output__empty-state-text",children:"Result will appear here after you run the test."})]})}function ip({currentOperateUrl:e}){return(0,E.jsx)("div",{className:"output__banner output__banner--executing",children:(0,E.jsxs)("div",{className:"output__banner-header",children:[(0,E.jsxs)("div",{className:"output__banner-main",children:[(0,E.jsx)(n,{className:"output__banner-loader"}),(0,E.jsx)("span",{className:"output__banner-text",children:"Running test..."})]}),e&&(0,E.jsx)(i,{className:"output__banner-operate-link",href:e,target:"_blank",renderIcon:m,children:"Open in Operate"})]})})}function rp({bannerVariant:e,statusIcon:t,timingText:n,output:r,onResetOutput:s,isConnectionConfigured:o,currentOperateUrl:l,element:h,isTaskExecuting:u}){var d,f,p,g,m;const A=(0,S.useMemo)(()=>{if(r){var e;if(r.error)return r.error?`Error: ${null==r||null===(e=r.error)||void 0===e?void 0:e.message}`:"Error";if(r.incident)return r.incident.errorType?`Incident: ${r.incident.errorType}`:"Incident";if(r.success)return"Test passed";if(r.terminated)return"Process instance terminated";if(r.canceled)return"Test canceled"}return null},[r]),v=(0,S.useMemo)(()=>null!=r&&r.success?"See output variables below.":null!=r&&r.terminated?"The process instance was terminated before the test could complete. This might be the expected behavior.":null!=r&&r.canceled?"The test was manually canceled.":null,[r]),b=(0,S.useMemo)(()=>null!=r&&r.incident?function(e){const{errorType:t,errorMessage:n,creationTime:i,...r}=e,s=[];return t&&s.push({label:"Type",value:t}),i&&s.push({label:"Creation Time",value:new Date(i).toLocaleString()}),n&&s.push({label:"Message",value:n}),Object.entries(r).forEach(([e,t])=>{s.push({label:sp(e),value:String(t)})}),s}(r.incident):null,[r]),x=(null==r?void 0:r.error)||(null==r?void 0:r.incident),[y,w]=(0,S.useState)(!0);return(0,E.jsxs)("div",{className:`output__banner output__banner--${e}`,children:[(0,E.jsxs)("div",{className:"output__banner-header",onClick:x?()=>w(!y):void 0,children:[(0,E.jsxs)("div",{className:"output__banner-main",children:[(0,E.jsx)("span",{className:"output__banner-icon",children:t}),(0,E.jsx)("span",{className:"output__banner-text",children:A})]}),n&&(0,E.jsx)("span",{className:"output__banner-timing",children:n}),x&&(y?(0,E.jsx)(a,{size:16,className:"output__banner-chevron output__banner-chevron--open"}):(0,E.jsx)(c,{size:16,className:"output__banner-chevron"}))]}),y&&v&&(0,E.jsx)("div",{className:"output__banner-details",children:(0,E.jsx)("div",{className:"output__banner-details-content",children:v})}),y&&(null==r?void 0:r.error)&&(0,E.jsx)("div",{className:"output__banner-details",children:(0,E.jsxs)("div",{className:"output__banner-error",children:[(0,E.jsx)(T,{className:"has-tooltip",label:(0,E.jsx)("span",{children:"Details about the error that occurred during task execution"}),align:"bottom-start",children:(0,E.jsx)("span",{className:"output__banner-error-heading",children:"Error details"})}),(0,E.jsxs)("div",{className:"output__banner-details-content",children:[(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Message"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:(null===(d=r.error)||void 0===d?void 0:d.message)||"No error message available"})]}),(null===(f=r.error)||void 0===f?void 0:f.detail)&&(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Detail"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:r.error.detail})]}),(null===(p=r.error)||void 0===p?void 0:p.errorType)&&(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Error type"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:r.error.errorType})]}),null!=(null===(g=r.error)||void 0===g?void 0:g.status)&&(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Status"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:r.error.status})]}),(null===(m=r.error)||void 0===m?void 0:m.response)&&(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Response"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:r.error.response})]})]})]})}),y&&b&&(0,E.jsx)("div",{className:"output__banner-details",children:(0,E.jsxs)("div",{className:"output__banner-incident",children:[(0,E.jsx)(T,{className:"has-tooltip",label:(0,E.jsxs)("span",{children:["Details about the incident that occurred during task execution ",(0,E.jsx)(i,{href:"https://docs.camunda.io/docs/components/concepts/incidents/",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),align:"bottom-start",children:(0,E.jsx)("span",{className:"output__banner-incident-heading",children:"Incident details"})}),(0,E.jsx)("div",{className:"output__banner-details-content",children:b.map(({label:e,value:t},n)=>(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:e}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:t})]},n))})]})}),(0,E.jsxs)("div",{className:"output__banner-actions",children:[(0,E.jsx)(ep,{}),(0,E.jsx)(Qf,{onResetOutput:s,isConnectionConfigured:o,currentOperateUrl:l,element:h,output:r,isTaskExecuting:u})]})]})}function sp(e){return e.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase())}function op({title:e,tooltip:t,defaultOpen:n=!0,isExecuting:i=!1,children:r}){const[s,o]=(0,S.useState)(n),[l,h]=(0,S.useState)(!1),u=(0,S.useRef)(null);return(0,S.useEffect)(()=>{const e=u.current;if(!e)return;const t=e.closest(".task-testing-tabs__panel")||e.closest(".task-testing__container--body-executing");if(!t)return;const n=new IntersectionObserver(([e])=>{h(!e.isIntersecting)},{root:t,threshold:0});return n.observe(e),()=>n.disconnect()},[]),(0,E.jsxs)("div",{className:"output__collapsible"+(s?" output__collapsible--open":""),children:[(0,E.jsx)("div",{ref:u,className:"output__collapsible-sentinel"}),(0,E.jsxs)("button",{className:"output__collapsible-header"+(l?" stuck":""),onClick:()=>o(!s),children:[s?(0,E.jsx)(a,{size:16,className:"output__chevron output__chevron--open"}):(0,E.jsx)(c,{size:16,className:"output__chevron"}),t?(0,E.jsx)(T,{className:"has-tooltip",label:t,align:"bottom-start",children:(0,E.jsx)("span",{className:"output__collapsible-title",children:e})}):(0,E.jsx)("span",{className:"output__collapsible-title",children:e})]}),s&&(0,E.jsx)("div",{className:"output__collapsible-content",children:r})]})}function lp({title:e,tooltip:t,scope:n,output:i,currentVariables:s,isTaskExecuting:o}){const l=o&&!s,a=(0,S.useMemo)(()=>o&&s&&Object.keys(s).length>0?cf(s,n):i&&i.variables?cf(i.variables,n):null,[o,s,i,n]),c=!a||0===Object.keys(a).length,h=c?"":JSON.stringify(a,null,2);return(0,E.jsx)(op,{title:e,tooltip:t,defaultOpen:!0,isExecuting:o,children:l?(0,E.jsx)("div",{className:"output__variables--skeleton",children:(0,E.jsx)(r,{})}):(0,E.jsx)(bf,{value:c?"{}":h})})}function ap(e,t){return{message:e,response:null==t?void 0:t.error,errorType:null==t?void 0:t.errorType,status:null==t?void 0:t.status,detail:null==t?void 0:t.detail,operationId:null==t?void 0:t.operationId}}const cp="idle",hp="error",up="incident",dp="terminated",fp="user.cancel",pp="user.selectionChanged",gp="taskExecution.state.changed",mp="taskExecution.deployed",Ap="taskExecution.instanceStarted",vp="taskExecution.polled",bp="taskExecution.finished";class xp extends(G()){constructor(e,t){super(),this._api=t,this._interval=null,this._executionId=null,this._state=cp,this._lastPolledResult=null,e.get("eventBus").on("selection.changed",()=>{this._cancelTaskExecution(pp)})}async executeTask(e,t){const n=function(e){let t=H(e);for(;t;){if(V(t,"bpmn:Process"))return t.get("id");t=t.$parent}return null}(e);if(!n)return;this._lastPolledResult=null;const i=Symbol();this._executionId=i,this._changeState("deploying");const r=await this._api.deploy();if(this._executionId!==i)return;if(!r.success){const e=ap("Failed to deploy process definition",r);return void this._cancelTaskExecution(hp,e)}const s=function(e,t){const{deployments:n=[]}=e;for(const e of n)if(e.processDefinition){const{processDefinition:n}=e;if(n.processDefinitionId===t)return n.processDefinitionKey}return null}(r.response,n);if(!s){const e=ap("Failed to retrieve process definition key from deployment response");return void this._cancelTaskExecution(hp,e)}this.emit(mp,r),this._changeState("starting-instance");const o=await this._api.startInstance(s,e.id,t);if(this._executionId!==i)return;if(!o.success){const e=ap("Failed to start process instance",o);return void this._cancelTaskExecution(hp,e)}const l=function(e){const{processInstanceKey:t}=e;return t||null}(o.response);if(!l){const e=ap("Failed to retrieve process instance key from start instance response");return void this._cancelTaskExecution(hp,e)}this.emit(Ap,o),this._changeState("executing"),this._interval=setInterval(async()=>{const t=await this._api.getProcessInstance(l);if(this._executionId!==i)return;if(!t.success)return void this._cancelTaskExecution(hp,ap("Failed to get process instance",t));if(!yp(t.response,l))return;const n=await Promise.all([this._api.getProcessInstanceElementInstances(l),this._api.getProcessInstanceJobs(l,e.id),this._api.getProcessInstanceMessageSubscriptions(l,e.id),this._api.getProcessInstanceUserTasks(l,e.id),this._api.getProcessInstanceVariables(l)]);if(this._executionId!==i)return;const r=n.find(e=>!e.success);if(r)return void this._cancelTaskExecution(hp,ap("Failed to poll process instance data",r));const[s,o,a,c,h]=n,u={elementId:e.id,processInstanceKey:l,elementInstancesResponse:s,jobsResponse:o,messageSubscriptionsResponse:a,processInstanceResponse:t,userTasksResponse:c,variablesResponse:h};this._lastPolledResult=u,this.emit(vp,u);const d=function(e,t){const n=yp(e,t);return n&&n.hasIncident||!1}(t.response,l);if(d){const e=await this._api.getProcessInstanceIncident(l);if(this._executionId!==i)return;if(!e.success)return void this._cancelTaskExecution(hp,ap("Failed to get process instance incident",e));const t=function(e){const{items:t=[]}=e;return t.length?t[0]:null}(e.response);return this.emit(bp,{incident:t,lastPolledResult:this._lastPolledResult,processInstanceKey:l,reason:up,success:!1}),void this._cancelTaskExecution()}const f=function(e,t){const n=yp(e,t);return n?n.state:null}(t.response,l);if("COMPLETED"===f||"TERMINATED"===f){const t=s.success?function(e,t){const{items:n=[]}=e;return n.find(e=>e.elementId===t.id)||null}(s.response,e):null;t&&"COMPLETED"===t.state?this.emit(bp,{lastPolledResult:this._lastPolledResult,processInstanceKey:l,success:!0}):this.emit(bp,{lastPolledResult:this._lastPolledResult,processInstanceKey:l,reason:dp,success:!1}),this._cancelTaskExecution()}},1e3)}async cancelTaskExecution(){this._cancelTaskExecution(fp)}_cancelTaskExecution(e,t){if(!this._isIdle()){if(this._interval&&clearInterval(this._interval),this._executionId=null,this._changeState(cp),e){var n,i;const r=e===hp?{success:!1,reason:e,error:t,processInstanceKey:(null===(n=this._lastPolledResult)||void 0===n?void 0:n.processInstanceKey)??null,lastPolledResult:this._lastPolledResult}:{success:!1,reason:e,processInstanceKey:(null===(i=this._lastPolledResult)||void 0===i?void 0:i.processInstanceKey)??null,lastPolledResult:this._lastPolledResult};this.emit(bp,r)}this._lastPolledResult=null}}_changeState(e){this._state!==e&&(this._state=e,this.emit(gp,e))}_isIdle(){return this._state===cp}}function yp(e,t){const{items:n=[]}=e;return n.length&&n.find(e=>e.processInstanceKey===t)||null}var wp=_(72),Cp=_.n(wp),kp=_(825),_p=_.n(kp),Sp=_(659),Ep=_.n(Sp),Tp=_(56),Op=_.n(Tp),Mp=_(540),Bp=_.n(Mp),Dp=_(113),Rp=_.n(Dp),Ip=_(520),Pp={};Pp.styleTagTransform=Rp(),Pp.setAttributes=Op(),Pp.insert=Ep().bind(null,"head"),Pp.domAPI=_p(),Pp.insertStyleElement=Bp(),Cp()(Ip.A,Pp),Ip.A&&Ip.A.locals&&Ip.A.locals;const Np=()=>null;function Lp({injector:e,api:r,isConnectionConfigured:s,configureConnectionBannerTitle:o="Connection required",configureConnectionBannerDescription:l="Configure a connection to start testing.",configureConnectionLabel:a="Configure",onConfigureConnection:c,onTestTask:h,config:d,onConfigChanged:p=()=>{},operateBaseUrl:g,tasklistBaseUrl:m,documentationUrl:x,onTaskExecutionStarted:y=()=>{},onTaskExecutionFinished:w=()=>{},children:C=[]}){const k=(0,S.useRef)(null),_=(0,S.useRef)(null),[O,M]=(0,S.useState)([]),[B,D]=(0,S.useState)(cp),[R,I]=(0,S.useState)(),[P,N]=(0,S.useState)(),[L,F]=(0,S.useState)({}),[j,z]=(0,S.useState)(null),[K,G]=(0,S.useState)(null),[Y,J]=function(e){const[t,n]=(0,S.useState)(null),[i,r]=(0,S.useState)($);(0,S.useEffect)(()=>{const t=e.get("selection");s({newSelection:t.get()});const n=e.get("eventBus");return n.on("selection.changed",s),()=>{n.off("selection.changed",s)}},[e]);const s=({newSelection:e})=>{const t=1!==(i=e).length?$:W(i[0],q)?function(e){let t=H(e).$parent;for(;t;){if(V(t,"bpmn:AdHocSubProcess"))return!0;t=t.$parent}return!1}(i[0])?"Task testing is not supported for tasks inside ad-hoc subprocesses.":null:U;var i;if(t)return n(null),void r(t);n(e[0]),r(null),1!==e.length?(n(null),r($)):W(e[0],q)?(n(e[0]),r(null)):(n(null),r(U))};return[t,i]}(e),Z=(0,S.useRef)(null),[ee,te]=(0,S.useState)(!0),[ne,ie]=(0,S.useState)([]),re=(0,S.useRef)(new Rf),se=(0,S.useRef)(null),[oe,le]=(0,S.useState)(null),[ae,ce]=(0,S.useState)(0);(0,S.useEffect)(()=>{const t=new X(e);k.current=t;const n=new Q(e,t,d);_.current=n;const i=new xp(e,r);return Z.current=i,re.current=new Rf(e),()=>{var e;null===(e=Z.current)||void 0===e||e.cancelTaskExecution()}},[e]),(0,S.useEffect)(()=>{Y&&k.current&&k.current.getVariablesForElement(Y).then(e=>M(e))},[Y]),(0,S.useEffect)(()=>{if(!k.current)return;const e=async()=>{if(!Y||!k.current)return;const e=await k.current.getVariablesForElement(Y);M(e)};return k.current.on("variables.changed",e),()=>{k.current&&k.current.off("variables.changed",e)}},[Y]),(0,S.useEffect)(()=>{if(!_.current)return;const e=()=>{_.current&&(p(_.current.getConfig()),Y&&(I(_.current.getInputConfigForElement(Y)),N(_.current.getOutputConfigForElement(Y)),F(_.current.getConfig().output)))};return _.current.on("config.changed",e),()=>{_.current&&_.current.off("config.changed",e)}},[Y,p,F,I,N]),(0,S.useEffect)(()=>{var e,t,n,i,r;const s=e=>{D(e),re.current.setState(e,Date.now()),ie(re.current.getEntries())},o=e=>{re.current.setDeployResponse(e),ie(re.current.getEntries())},l=e=>{if(e.success){const t=g?function(e,t){try{const n=If(e),i=`processes/${t}`;return new URL(i,`${n}/`).toString()}catch(e){return null}}(g,e.response.processInstanceKey):null;G(t)}re.current.setStartInstanceResponse(e),ie(re.current.getEntries())},a=e=>{var t,n;if(null!==(t=e.variablesResponse)&&void 0!==t&&t.success&&null!==(n=e.elementInstancesResponse)&&void 0!==n&&n.success){const t=lf(e.variablesResponse.response.items,e.elementInstancesResponse.response.items||[],e.processInstanceKey,Y.id);le(t)}re.current.setPolledResult(e),ie(re.current.getEntries())},c=e=>{re.current.setFinishedResult(e,Date.now()),ie(re.current.getEntries());const t=re.current.getEntries(),n=function(e,t){var n,i;const r=e.lastPolledResult;if(null!=r&&null!==(n=r.variablesResponse)&&void 0!==n&&n.success&&null!=r&&null!==(i=r.elementInstancesResponse)&&void 0!==i&&i.success)return lf(r.variablesResponse.response.items,r.elementInstancesResponse.response.items||[],r.processInstanceKey,t.id)}(e,Y);var i;if(e.success)null==_||null===(i=_.current)||void 0===i||i.setOutputConfigForElement(Y,{success:!0,variables:n,operateUrl:K,executionLog:t,startedAt:se.current,finishedAt:Date.now()});else if(function(e){return!e.success&&e.reason===up}(e)){var r;null==_||null===(r=_.current)||void 0===r||r.setOutputConfigForElement(Y,{success:!1,variables:n,incident:e.incident,operateUrl:K,executionLog:t,startedAt:se.current,finishedAt:Date.now()})}else if(function(e){return!e.success&&e.reason===hp}(e)){var s;null==_||null===(s=_.current)||void 0===s||s.setOutputConfigForElement(Y,{success:!1,error:e.error,executionLog:t,startedAt:se.current,finishedAt:Date.now()})}else if(function(e){return!e.success&&e.reason===dp}(e)){var o;null==_||null===(o=_.current)||void 0===o||o.setOutputConfigForElement(Y,{success:!1,terminated:!0,variables:n,operateUrl:K,executionLog:t,startedAt:se.current,finishedAt:Date.now()})}else if(e.reason===fp||e.reason===pp){var l;null==_||null===(l=_.current)||void 0===l||l.setOutputConfigForElement(Y,{success:!1,canceled:!0,variables:n,operateUrl:K,executionLog:t,startedAt:se.current,finishedAt:Date.now()})}w(Y,e)};return null==Z||null===(e=Z.current)||void 0===e||e.on(bp,c),null==Z||null===(t=Z.current)||void 0===t||t.on(mp,o),null==Z||null===(n=Z.current)||void 0===n||n.on(Ap,l),null==Z||null===(i=Z.current)||void 0===i||i.on(vp,a),null==Z||null===(r=Z.current)||void 0===r||r.on(gp,s),()=>{Z.current&&(Z.current.off(gp,s),Z.current.off(mp,o),Z.current.off(Ap,l),Z.current.off(vp,a),Z.current.off(bp,c))}},[Y,g,K,w]),(0,S.useEffect)(()=>{d&&_.current&&JSON.stringify(d)!==JSON.stringify(_.current.getConfig())&&_.current.setConfig(d)},[d]),(0,S.useEffect)(()=>{var e,t;Y?(I(null==_||null===(e=_.current)||void 0===e?void 0:e.getInputConfigForElement(Y)),N(null==_||null===(t=_.current)||void 0===t?void 0:t.getOutputConfigForElement(Y))):I(void 0)},[Y]);const he=((e=Yf)=>{const[t,n]=(0,S.useState)(e),i=(0,S.useCallback)(e=>{n(t=>[...t,e])},[]),r=(0,S.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]),s=(0,S.useCallback)(e=>t.filter(t=>t.type===e).sort((e,t)=>(t.priority||0)-(e.priority||0)),[t]);return(0,S.useMemo)(()=>({plugins:t,registerPlugin:i,unregisterPlugin:r,getPlugins:s}),[t,i,r,s])})(),ue=(0,S.useCallback)(e=>{Y&&_.current&&_.current.setInputConfigForElement(Y,e)},[Y]),de=(0,S.useCallback)(()=>{Y&&_.current&&_.current.resetInputConfigForElement(Y)},[Y]),fe=async()=>{if(j||!Y||!Z.current||!_.current)return;y(Y),ce(1),ie([]),re.current.reset(),le(null),se.current=Date.now();const e=_.current.getInputConfigForElement(Y);_.current.setOutputConfigForElement(Y,null),Z.current.executeTask(Y,JSON.parse(e))},pe=(0,S.useCallback)(()=>{Y&&_.current&&(_.current.resetOutputConfigForElement(Y),ce(1))},[Y]);if(!d)return(0,E.jsx)("div",{className:"task-testing__container task-testing__container--empty",children:(0,E.jsxs)("div",{className:"task-testing__container-no-config",children:[(0,E.jsx)(n,{})," ",(0,E.jsx)("span",{children:"Configuring..."})]})});if(!Y)return(0,E.jsx)("div",{className:"task-testing__container task-testing__container--empty",children:(0,E.jsxs)("div",{className:"task-testing__container-no-element",children:[(0,E.jsx)(u,{}),(0,E.jsx)("span",{children:J}),x&&(0,E.jsx)(i,{href:x,target:"_blank",children:"Learn more"})]})});const ge=!s||!!j,me=s?j:o,Ae=B!==cp,ve=async()=>{var e;Ae?null==Z||null===(e=Z.current)||void 0===e||e.cancelTaskExecution():h?(te(!1),await h()&&fe(),te(!0)):s&&fe()};return(0,E.jsxs)(Gf.Provider,{value:he,children:[(0,E.jsxs)("div",{className:"task-testing__container",children:[(0,E.jsxs)("div",{className:`task-testing__container--header ${Fp({isTaskExecuting:Ae,isConnectionConfigured:s,inputError:j,output:P})}`,children:[(0,E.jsx)("div",{className:"task-testing__header-actions",children:ge?(0,E.jsx)(T,{label:me,align:"bottom-start",children:(0,E.jsx)(t,{"data-testid":"test-task-btn",className:"btn-execute",kind:"secondary",size:"sm",renderIcon:Ae?b:A,iconDescription:Ae?"Stop test":"Run test",onClick:ve,disabled:!ee,children:Ae?"Stop test":"Run test"})}):(0,E.jsx)(t,{"data-testid":"test-task-btn",className:"btn-execute",kind:Ae?"secondary":"primary",size:"sm",renderIcon:Ae?b:A,iconDescription:Ae?"Stop test":"Run test",onClick:ve,disabled:!ee,children:Ae?"Stop test":"Run test"})}),(0,E.jsxs)("div",{className:"task-testing__header-status",children:[(0,E.jsx)(jp,{isTaskExecuting:Ae,isConnectionConfigured:s,inputError:j,output:P}),(0,E.jsx)("span",{className:"task-testing__header-status-text",children:(0,E.jsx)(zp,{configureConnectionBannerTitle:o,isConnectionConfigured:s,inputError:j,output:P})})]}),(0,E.jsxs)("div",{className:"task-testing__header-actions-right",children:[(0,E.jsx)(T,{label:"Clear result",align:"bottom-end",children:(0,E.jsx)(t,{kind:"ghost",size:"sm",hasIconOnly:!0,renderIcon:f,iconDescription:"Clear result",onClick:pe,disabled:!P||Ae})}),c&&(0,E.jsx)(T,{label:s?"Configure connection":a,align:"bottom-end",children:(0,E.jsx)(t,{"data-testid":"configure-connection-btn",kind:"ghost",size:"sm",hasIconOnly:!0,renderIcon:v,iconDescription:a,onClick:()=>c(),disabled:Ae})})]})]}),(0,E.jsx)("div",{className:"task-testing__container--body"+(Ae?" task-testing__container--body-executing":""),children:(0,E.jsx)(Vp,{selectedIndex:ae,setSelectedIndex:ce,tabs:[{label:"Input",disabled:Ae,children:(0,E.jsx)(vf,{allOutputs:L,input:R,onErrorChange:z,onResetInput:de,onSetInput:ue,variablesForElement:O})},{label:"Result",children:(0,E.jsx)(Jf,{element:Y,isConnectionConfigured:s,isTaskExecuting:Ae,currentVariables:oe,output:P,currentOperateUrl:K,onResetOutput:pe,taskExecutionState:B,executionLog:Ae?ne:(null==P?void 0:P.executionLog)||[],tasklistBaseUrl:m})},...he.getPlugins("output.body.tab").map(e=>{var t;return{label:e.label,disabled:Ae,children:(null===(t=e.render)||void 0===t?void 0:t.call(e,{element:Y,output:P,isTaskExecuting:Ae,executionLog:ne}))||e.children}}).filter(e=>e.children)]})})]}),C]})}function Fp({isTaskExecuting:e,isConnectionConfigured:t,inputError:n,output:i}){return e?"task-testing__container--header-executing":null!=i&&i.error||null!=i&&i.incident||!t||n?"task-testing__container--header-error":null!=i&&i.success?"task-testing__container--header-success":null!=i&&i.terminated?"task-testing__container--header-terminated":null!=i&&i.canceled?"task-testing__container--header-canceled":""}function jp({isTaskExecuting:e,isConnectionConfigured:t,inputError:n,output:i}){return null!=i&&i.error||null!=i&&i.incident||!t||n?(0,E.jsx)(y,{size:16,className:"task-testing__status-icon--error"}):null!=i&&i.success?(0,E.jsx)(l,{size:16,className:"task-testing__status-icon--success"}):null!=i&&i.terminated?(0,E.jsx)(b,{size:16,className:"task-testing__status-icon--terminated"}):null!=i&&i.canceled?(0,E.jsx)(p,{size:16,className:"task-testing__status-icon--canceled"}):null}function zp({isConnectionConfigured:e,configureConnectionBannerTitle:t,inputError:n,output:i}){if(!e)return t;if(n)return"Input error";if(i){if(i.error)return"Error";if(i.incident)return"Incident";if(i.success)return"Passed";if(i.terminated)return"Terminated";if(i.canceled)return"Canceled"}return null}function Vp({selectedIndex:e=0,setSelectedIndex:t=()=>{},tabs:n}){var i;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"task-testing-tabs__list",role:"tablist",children:n.map((n,i)=>(0,E.jsx)("button",{type:"button",role:"tab",className:M()("task-testing-tabs__tab",{"task-testing-tabs__tab--active":i===e,"task-testing-tabs__tab--disabled":n.disabled}),"aria-selected":i===e,onClick:()=>t(i),disabled:n.disabled,children:n.label},i))}),(0,E.jsx)("div",{className:"task-testing-tabs__panel",children:null===(i=n[e])||void 0===i?void 0:i.children})]})}Lp.Tab=({children:e=null,render:t=Np,label:n,priority:i=1e3})=>{const{registerPlugin:r,unregisterPlugin:s}=(0,S.useContext)(Gf);return(0,S.useEffect)(()=>{const o={label:n,render:t,children:e,priority:i,type:"output.body.tab"};return r(o),()=>{s(o)}},[e,t,n,i,r,s]),null},Lp.Link=Zf;export{Lp as default};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|