1"use strict";(self.webpackChunkwhatsapp_dashboard=self.webpackChunkwhatsapp_dashboard||[]).push([[3016],{12285:(t,e,i)=>{var n=i(64836),s=i(75263);e.Z=void 0;var r=s(i(47313)),o=(0,n(i(52293)).default)(r.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"}),"GetApp");e.Z=o},85375:(t,e,i)=>{var n=i(64836),s=i(75263);e.Z=void 0;var r=s(i(47313)),o=(0,n(i(52293)).default)(r.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"}),"Info");e.Z=o},27457:(t,e,i)=>{i.d(e,{jD:()=>H});var n=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(e){r(e)}}function l(t){try{h(n.throw(t))}catch(e){r(e)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,l)}h((n=n.apply(t,e||[])).next())}))};const s="application/font-woff",r="image/jpeg",o={woff:s,woff2:s,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:r,jpeg:r,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"},l=function(){let t=0;return()=>(t+=1,"u".concat("0000".concat((Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)).concat(t))}();function h(t){const e=function(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}(t).toLowerCase();return o[e]||""}function a(t){return-1!==t.search(/^(data:)/)}function c(t,e){return"data:".concat(e,";base64,").concat(t)}function u(t){return t.split(/,/)[1]}function f(t){const e=[];for(let i=0,n=t.length;i<n;i+=1)e.push(t[i]);return e}function d(t,e){const i=window.getComputedStyle(t).getPropertyValue(e);return parseFloat(i.replace("px",""))}function p(t){return new Promise(((e,i)=>{const n=new Image;n.onload=()=>e(n),n.onerror=i,n.crossOrigin="anonymous",n.src=t}))}var g;!function(t){t.clonePseudoElement=function(t,e,i){const n=window.getComputedStyle(t,i),s=n.getPropertyValue("content");if(""===s||"none"===s)return;const r=l(),o=document.createElement("style");o.appendChild(function(t,e,i){const n=".".concat(t,":").concat(e),s=i.cssText?function(t){const e=t.getPropertyValue("content");return"".concat(t.cssText," content: ").concat(e,";")}(i):function(t){return f(t).map((e=>{const i=t.getPropertyValue(e),n=t.getPropertyPriority(e);return"".concat(e,": ").concat(i).concat(n?" !important":"",";")})).join(" ")}(i);return document.createTextNode("".concat(n,"{").concat(s,"}"))}(r,i,n)),e.className="".concat(e.className," ").concat(r),e.appendChild(o)}}(g||(g={}));var m=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(e){r(e)}}function l(t){try{h(n.throw(t))}catch(e){r(e)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,l)}h((n=n.apply(t,e||[])).next())}))};function v(t){return m(this,void 0,void 0,(function*(){if(t instanceof HTMLCanvasElement){const e=t.toDataURL();return"data:,"===e?Promise.resolve(t.cloneNode(!1)):p(e)}return Promise.resolve(t.cloneNode(!1))}))}function w(t,e){return m(this,void 0,void 0,(function*(){return e instanceof Element?Promise.resolve().then((()=>function(t,e){const i=window.getComputedStyle(t),n=e.style;i.cssText?n.cssText=i.cssText:f(i).forEach((t=>{n.setProperty(t,i.getPropertyValue(t),i.getPropertyPriority(t))}))}(t,e))).then((()=>function(t,e){[":before",":after"].forEach((i=>g.clonePseudoElement(t,e,i)))}(t,e))).then((()=>function(t,e){t instanceof HTMLTextAreaElement&&(e.innerHTML=t.value);t instanceof HTMLInputElement&&e.setAttribute("value",t.value)}(t,e))).then((()=>e)):e}))}function y(t,e,i){return m(this,void 0,void 0,(function*(){return i||!e||e(t)?Promise.resolve(t).then(v).then((i=>function(t,e,i){return m(this,void 0,void 0,(function*(){const n=f(t.childNodes);return 0===n.length?Promise.resolve(e):n.reduce(((t,n)=>t.then((()=>y(n,i))).then((t=>{t&&e.appendChild(t)}))),Promise.resolve()).then((()=>e))}))}(t,i,e))).then((e=>w(t,e))):Promise.resolve(null)}))}const b=3e4;function x(t,e){e.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+(new Date).getTime());return(window.fetch?window.fetch(t).then((t=>t.blob())).then((t=>new Promise(((e,i)=>{const n=new FileReader;n.onloadend=()=>e(n.result),n.onerror=i,n.readAsDataURL(t)})))).then(u).catch((()=>new Promise(((t,e)=>e())))):new Promise(((e,i)=>{const n=new XMLHttpRequest;n.onreadystatechange=()=>{if(4!==n.readyState)return;if(200!==n.status)return void i(new Error("Failed to fetch resource: ".concat(t,", status: ").concat(n.status)));const s=new FileReader;s.onloadend=()=>{e(u(s.result))},s.readAsDataURL(n.response)},n.ontimeout=()=>{i(new Error("Timeout of ".concat(b,"ms occured while fetching resource: ").concat(t)))},n.responseType="blob",n.timeout=b,n.open("GET",t,!0),n.send()}))).catch((i=>{let n="";if(e.imagePlaceholder){const t=e.imagePlaceholder.split(/,/);t&&t[1]&&(n=t[1])}let s="Failed to fetch resource: ".concat(t);return i&&(s="string"===typeof i?i:i.message),s&&console.error(s),n}))}const k=/url\((['"]?)([^'"]+?)\1\)/g;function S(t){return-1!==t.search(k)}function A(t,e,i){return S(t)?Promise.resolve(t).then(C).then((n=>n.reduce(((t,n)=>t.then((t=>
1function(t,e,i,n,s){const r=i?function(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;const i=document.implementation.createHTMLDocument(),n=i.createElement("base"),s=i.createElement("a");i.head.appendChild(n),i.body.appendChild(s),e&&(n.href=e);return s.href=t,s.href}(e,i):e;return Promise.resolve(r).then((t=>s?s(t):x(t,n))).then((t=>c(t,h(e)))).then((i=>t.replace(function(t){return new RegExp("(url\\(['\"]?)(".concat(function(t){return t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")}(t),")(['\"]?\\))"),"g")}(e),"$1".concat(i,"$3")))).then((t=>t),(()=>r))}(t,n,e,i)))),Promise.resolve(t)))):Promise.resolve(t)}function C(t){const e=[];return t.replace(k,((t,i,n)=>(e.push(n),t))),e.filter((t=>!a(t)))}var M=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(e){r(e)}}function l(t){try{h(n.throw(t))}catch(e){r(e)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,l)}h((n=n.apply(t,e||[])).next())}))};function T(t,e){return M(this,void 0,void 0,(function*(){return t instanceof Element?Promise.resolve(t).then((t=>function(t,e){return M(this,void 0,void 0,(function*(){const i=t.style.getPropertyValue("background");return i?Promise.resolve(i).then((t=>A(t,null,e))).then((e=>(t.style.setProperty("background",e,t.style.getPropertyPriority("background")),t))):Promise.resolve(t)}))}(t,e))).then((t=>function(t,e){if(!(t instanceof HTMLImageElement)||a(t.src))return Promise.resolve(t);return Promise.resolve(t.src).then((t=>x(t,e))).then((e=>c(e,h(t.src)))).then((e=>new Promise(((i,n)=>{t.onload=i,t.onerror=n,t.src=e})))).then((()=>t),(()=>t))}(t,e))).then((t=>function(t,e){return M(this,void 0,void 0,(function*(){const i=f(t.childNodes).map((t=>T(t,e)));return Promise.all(i).then((()=>t))}))}(t,e))):Promise.resolve(t)}))}var O=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(e){r(e)}}function l(t){try{h(n.throw(t))}catch(e){r(e)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,l)}h((n=n.apply(t,e||[])).next())}))};function P(t,e){return O(this,void 0,void 0,(function*(){return function(t){return O(this,void 0,void 0,(function*(){return new Promise(((e,i)=>{t.ownerDocument||i(new Error("Provided element is not within a Document")),e(f(t.ownerDocument.styleSheets))})).then(D).then(E)}))}(t).then((t=>Promise.all(t.map((t=>{const i=t.parentStyleSheet?t.parentStyleSheet.href:null;return A(t.cssText,i,e)}))))).then((t=>t.join("\n"))).then((e=>{const i=document.createElement("style"),n=document.createTextNode(e);return i.appendChild(n),t.firstChild?t.insertBefore(i,t.firstChild):t.appendChild(i),t}))}))}function D(t){return O(this,void 0,void 0,(function*(){const e=[],i=[];return t.forEach((e=>{if("cssRules"in e)try{f(e.cssRules).forEach((t=>{t.type===CSSRule.IMPORT_RULE&&i.push(L(t.href,e).then(N).then((t=>{R(t).forEach((t=>{e.insertRule(t,e.cssRules.length)}))})).catch((t=>{console.log("Error loading remote css",t.toString())})))}))}catch(n){const s=t.find((t=>null===t.href))||document.styleSheets[0];null!=e.href&&i.push(L(e.href,s).then(N).then((t=>{R(t).forEach((t=>{s.insertRule(t,e.cssRules.length)}))})).catch((t=>{console.log("Error loading remote stylesheet",t.toString())}))),console.log("Error inlining remote css file",n.toString())}})),Promise.all(i).then((()=>(t.forEach((t=>{if("cssRules"in t)try{f(t.cssRules).forEach((t=>{e.push(t)}))}catch(i){console.log("Error while reading CSS rules from ".concat(t.href),i.toString())}})),e)))}))}function E(t){return t.filter((t=>t.type===CSSRule.FONT_FACE_RULE)).filter((t=>S(t.style.getPropertyValue("src"))))}function R(t){if(void 0===t)return[];let e=t;const i=[],n=new RegExp("(\\/\\*[\\s\\S]*?\\*\\/)","gi");e=e.replace(n,"");const s=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)}
1)","gi");let r;for(;r=s.exec(e),null!==r;)i.push(r[0]);e=e.replace(s,"");const o=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;r=o.exec(e),null!==r;)i.push(r[0]);return i}function L(t,e){return fetch(t).then((e=>({url:t,cssText:e.text()})),(t=>{console.log("ERROR FETCHING CSS: ",t.toString())}))}function N(t){return O(this,void 0,void 0,(function*(){return t.cssText.then((e=>{let i=e;const n=/url\(["']?([^"')]+)["']?\)/g,s=(i.match(/url\([^)]+\)/g)||[]).map((e=>{let s=e.replace(n,"$1");if(!s.startsWith("https://")){const e=t.url;s=new URL(s,e).href}return new Promise(((t,n)=>{fetch(s).then((t=>t.blob())).then((n=>{const s=new FileReader;s.addEventListener("load",(n=>{i=i.replace(e,"url(".concat(s.result,")")),t([e,s.result])})),s.readAsDataURL(n)})).catch(n)}))}));return Promise.all(s).then((()=>i))}))}))}function I(t,e,i){const s="http://www.w3.org/2000/svg",r=document.createElementNS(s,"svg"),o=document.createElementNS(s,"foreignObject");return r.setAttributeNS("","width","".concat(e)),r.setAttributeNS("","height","".concat(i)),o.setAttributeNS("","width","100%"),o.setAttributeNS("","height","100%"),o.setAttributeNS("","x","0"),o.setAttributeNS("","y","0"),o.setAttributeNS("","externalResourcesRequired","true"),r.appendChild(o),o.appendChild(t),function(t){return n(this,void 0,void 0,(function*(){return Promise.resolve().then((()=>(new XMLSerializer).serializeToString(t))).then(encodeURIComponent).then((t=>"data:image/svg+xml;charset=utf-8,".concat(t)))}))}(r)}var B=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(e){r(e)}}function l(t){try{h(n.throw(t))}catch(e){r(e)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,l)}h((n=n.apply(t,e||[])).next())}))};function V(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{width:e.width||function(t){const e=d(t,"border-left-width"),i=d(t,"border-right-width");return t.scrollWidth+e+i}(t),height:e.height||function(t){const e=d(t,"border-top-width"),i=d(t,"border-bottom-width");return t.scrollHeight+e+i}(t)}}function z(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return B(this,void 0,void 0,(function*(){const{width:i,height:n}=V(t,e);return y(t,e.filter,!0).then((t=>P(t,e))).then((t=>T(t,e))).then((t=>function(t,e){const{style:i}=t;return e.backgroundColor&&(i.backgroundColor=e.backgroundColor),e.width&&(i.width="".concat(e.width,"px")),e.height&&(i.height="".concat(e.height,"px")),e.style&&Object.assign(i,e.style),t}(t,e))).then((t=>I(t,i,n)))}))}const H=z},33714:(t,e,i)=>{i.d(e,{Z:()=>o});var n=i(47313),s=function(){return s=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var s in e=arguments[i])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},s.apply(this,arguments)},r=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(i[n[s]]=t[n[s]])}return i};const o=function(t){var e=function(e){var i=e.bgStyle,o=e.borderRadius,l=e.iconFillColor,h=e.round,a=e.size,c=r(e,["bgStyle","borderRadius","iconFillColor","round","size"]);return n.createElement("svg",s({viewBox:"0 0 64 64",width:a,height:a},c),h?n.createElement("circle",{cx:"32",cy:"32",r:"31",fill:t.color,style:i}):n.createElement("rect",{width:"64",height:"64",rx:o,ry:o,fill:t.color,style:i}),n.createElement("path",{d:t.path,fill:l}))};return e.defaultProps={bgStyle:{},borderRadius:0,iconFillColor:"white",size:64},e}({color:"#25D366",networkName:"whatsapp",path:"m42.32286,33.93287c-0.5178,-0.2589 -3.04726,-1.49644 -3.52105,-1.66732c-0.4712,-0.17346 -0.81554,-0.2589 -1.15987,0.2589c-0.34175,0.51004 -1.33075,1.66474 -1.63108,2.00648c-0.30032,0.33658 -0.60064,0.36247 -1.11327,
10.12945c-0.5178,-0.2589 -2.17994,-0.80259 -4.14759,-2.56312c-1.53269,-1.37217 -2.56312,-3.05503 -2.86603,-3.57283c-0.30033,-0.5178 -0.03366,-0.80259 0.22524,-1.06149c0.23301,-0.23301 0.5178,-0.59547 0.7767,-0.90616c0.25372,-0.31068 0.33657,-0.5178 0.51262,-0.85437c0.17088,-0.36246 0.08544,-0.64725 -0.04402,-0.90615c-0.12945,-0.2589 -1.15987,-2.79613 -1.58964,-3.80584c-0.41424,-1.00971 -0.84142,-0.88027 -1.15987,-0.88027c-0.29773,-0.02588 -0.64208,-0.02588 -0.98382,-0.02588c-0.34693,0 -0.90616,0.12945 -1.37736,0.62136c-0.4712,0.5178 -1.80194,1.76053 -1.80194,4.27186c0,2.51134 1.84596,4.945 2.10227,5.30747c0.2589,0.33657 3.63497,5.51458 8.80262,7.74113c1.23237,0.5178 2.1903,0.82848 2.94111,1.08738c1.23237,0.38836 2.35599,0.33657 3.24402,0.20712c0.99159,-0.15534 3.04985,-1.24272 3.47963,-2.45956c0.44013,-1.21683 0.44013,-2.22654 0.31068,-2.45955c-0.12945,-0.23301 -0.46601,-0.36247 -0.98382,-0.59548m-9.40068,12.84407l-0.02589,0c-3.05503,0 -6.08417,-0.82849 -8.72495,-2.38189l-0.62136,-0.37023l-6.47252,1.68286l1.73463,-6.29129l-0.41424,-0.64725c-1.70875,-2.71846 -2.6149,-5.85116 -2.6149,-9.07706c0,-9.39809 7.68934,-17.06155 17.15993,-17.06155c4.58253,0 8.88029,1.78642 12.11655,5.02268c3.23625,3.21036 5.02267,7.50812 5.02267,12.06476c-0.0078,9.3981 -7.69712,17.06155 -17.14699,17.06155m14.58906,-31.58846c-3.93529,-3.80584 -9.1133,-5.95471 -14.62789,-5.95471c-11.36055,0 -20.60848,9.2065 -20.61625,20.52564c0,3.61684 0.94757,7.14565 2.75211,10.26282l-2.92557,10.63564l10.93337,-2.85309c3.0136,1.63108 6.4052,2.4958 9.85634,2.49839l0.01037,0c11.36574,0 20.61884,-9.2091 20.62403,-20.53082c0,-5.48093 -2.14111,-10.64081 -6.03239,-14.51915"})},67112:(t,e,i)=>{i.d(e,{Xy:()=>ln});var n=i(32725),s=i(89933);const r=s.q6.define(),o=s.q6.define(),l=s.r$.define(),h=s.r$.define({combine:t=>(0,s.BO)(t,{minDepth:100,newGroupDelay:500},{minDepth:Math.max,newGroupDelay:Math.min})}),a=s.QQ.define({create:()=>M.empty,update(t,e){let i=e.state.facet(h),n=e.annotation(r);if(n){let s=v.fromTransaction(e),r=n.side,o=0==r?t.undone:t.done;return o=s?w(o,o.length,i.minDepth,s):k(o,e.startState.selection),new M(0==r?n.rest:o,0==r?o:n.rest)}let l=e.annotation(o);if("full"!=l&&"before"!=l||(t=t.isolate()),!1===e.annotation(s.YW.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let a=v.fromTransaction(e),c=e.annotation(s.YW.time),u=e.annotation(s.YW.userEvent);return a?t=t.addChanges(a,c,u,i.newGroupDelay,i.minDepth):e.selection&&(t=t.addSelection(e.startState.selection,c,u,i.newGroupDelay)),"full"!=l&&"after"!=l||(t=t.isolate()),t},toJSON:t=>({done:t.done.map((t=>t.toJSON())),undone:t.undone.map((t=>t.toJSON()))}),fromJSON:t=>new M(t.done.map(v.fromJSON),t.undone.map(v.fromJSON))});function c(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};
1return[a,h.of(t),n.tk.domEventHandlers({beforeinput:(t,e)=>"historyUndo"==t.inputType?f(e):"historyRedo"==t.inputType&&d(e)})]}function u(t,e){return function(i){let{state:n,dispatch:s}=i,r=n.field(a,!1);if(!r)return!1;let o=r.pop(t,n,e);return!!o&&(s(o),!0)}}const f=u(0,!1),d=u(1,!1),p=u(0,!0),g=u(1,!0);function m(t){return function(e){let i=e.field(a,!1);if(!i)return 0;let n=0==t?i.done:i.undone;return n.length-(n.length&&!n[0].changes?1:0)}}m(0),m(1);class v{constructor(t,e,i,n,s){this.changes=t,this.effects=e,this.mapped=i,this.startSelection=n,this.selectionsAfter=s}setSelAfter(t){return new v(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,i;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===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map((t=>t.toJSON()))}}static fromJSON(t){return new v(t.changes&&s.as.fromJSON(t.changes),[],t.mapped&&s.n0.fromJSON(t.mapped),t.startSelection&&s.jT.fromJSON(t.startSelection),t.selectionsAfter.map(s.jT.fromJSON))}static fromTransaction(t){let e=b;for(let i of t.startState.facet(l)){let n=i(t);n.length&&(e=e.concat(n))}return!e.length&&t.changes.empty?null:new v(t.changes.invert(t.startState.doc),e,void 0,t.startState.selection,b)}static selection(t){return new v(void 0,b,void 0,void 0,t)}}function w(t,e,i,n){let s=e+1>i+20?e-i-1:0,r=t.slice(s,e);return r.push(n),r}function y(t,e){return t.length?e.length?t.concat(e):t:e}const b=[],x=200;function k(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-x));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),w(t,t.length-1,1e9,i.setSelAfter(n)))}return[v.selection([e])]}function S(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function A(t,e){if(!t.length)return t;let i=t.length,n=b;for(;i;){let s=C(t[i-1],e,n);if(s.changes&&!s.changes.empty||s.effects.length){let e=t.slice(0,i);return e[i-1]=s,e}e=s.mapped,i--,n=s.selectionsAfter}return n.length?[v.selection(n)]:b}function C(t,e,i){let n=y(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):b,i);if(!t.changes)return v.selection(n);let r=t.changes.map(e),o=e.mapDesc(t.changes,!0),l=t.mapped?t.mapped.composeDesc(o):o;return new v(r,s.Py.mapEffects(t.effects,e),l,t.startSelection.map(o),n)}class M{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new M(this.done,this.undone):this}addChanges(t,e,i,n,s){let r=this.done,o=r[r.length-1];return r=o&&o.changes&&e-this.prevTime<n&&!o.selectionsAfter.length&&!o.changes.empty&&t.changes&&function(t,e){let i=[],n=!1;return t.iterChangedRanges(((t,e)=>i.push(t,e))),e.iterChangedRanges(((t,e,s,r)=>{for(let o=0;o<i.length;){let t=i[o++],e=i[o++];r>=t&&s<=e&&(n=!0)}})),n}(o.changes,t.changes)?w(r,r.length-1,s,new v(t.changes.compose(o.changes),y(t.effects,o.effects),o.mapped,o.startSelection,b)):w(r,r.length,s,t),new M(r,b,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:b;return s.length>0&&e-this.prevTime<n&&"keyboardselection"==i&&this.prevUserEvent==i&&(r=s[s.length-1],o=t,r.ranges.length==o.ranges.length&&0===r.ranges.filter(((t,e)=>t.empty!=o.ranges[e].empty)).length)?this:new M(k(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new M(A(this.done,t),A(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,e,i){let n=0==t?this.done:this.undone;if(0==n.length)return null;let s=n[n.length-1];if(i&&s.selectionsAfter.length)return e.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:r.of({side:t,rest:S(n)})});if(s.changes){let i=1==n.length?b:n.slice(0,n.length-1);return s.mapped&&(i=A(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:r.of({side:t,rest:i}),filter:!1})}return null}}M.empty=new M(b,b);const T=[{key:"Mod-z",run:f,preventDefault:!0}
1,{key:"Mod-y",mac:"Mod-Shift-z",run:d,preventDefault:!0},{key:"Mod-u",run:p,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:g,preventDefault:!0}];var O=i(92649),P=i(98759);class D extends P.uU{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}at(t){return this.range(t)}}D.prototype.elementClass="",D.prototype.toDOM=void 0,D.prototype.mapMode=s.gc.TrackBefore,D.prototype.point=!0;const E=s.r$.define(),R={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>P.Xs.empty,lineMarker:()=>null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},L=s.r$.define();function N(t){return[V(),L.of(Object.assign(Object.assign({},R),t))]}const I=n.tk.baseTheme({".cm-gutters":{display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#999",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",height:"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"}}),B=s.r$.define({combine:t=>t.some((t=>t))});function V(t){let e=[z,I];return t&&!1===t.fixed&&e.push(B.of(!0)),e}const z=n.lg.fromClass(class{constructor(t){this.view=t,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.gutters=t.state.facet(L).map((e=>new _(t,e)));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!t.state.facet(B),this.fixed&&(this.dom.style.position="sticky"),t.scrollDOM.insertBefore(this.dom,t.contentDOM),this.syncGutters()}update(t){this.updateGutters(t)&&this.syncGutters()}syncGutters(){let t=P.Xs.iter(this.view.state.facet(E),this.view.viewport.from),e=[],i=this.gutters.map((t=>new j(t,this.view.viewport)));this.view.viewportLines((s=>{let r;if(Array.isArray(s.type)){for(let t of s.type)if(t.type==n.kH.Text){r=t;break}}else r=s.type==n.kH.Text?s:void 0;if(r){e.length&&(e=[]),W(t,e,s.from);for(let t of i)t.line(this.view,r,e)}}),0);for(let n of i)n.finish();this.dom.style.minHeight=this.view.contentHeight+"px",this.view.state.facet(B)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"")}updateGutters(t){let e=t.startState.facet(L),i=t.state.facet(L),n=t.docChanged||t.heightChanged||t.viewportChanged||!P.Xs.eq(t.startState.facet(E),t.state.facet(E),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let s of this.gutters)s.update(t)&&(n=!0);else{n=!0;let s=[];for(let n of i){let i=e.indexOf(n);i<0?s.push(new _(this.view,n)):(this.gutters[i].update(t),s.push(this.gutters[i]))}for(let t of this.gutters)t.dom.remove();for(let t of s)this.dom.appendChild(t.dom);this.gutters=s}return n}destroy(){this.dom.remove()}},{provide:n.BF.scrollMargins.from((t=>0!=t.gutters.length&&t.fixed?t.view.textDirection==n.Nm.LTR?{left:t.dom.offsetWidth}:{right:t.dom.offsetWidth}:null))});function H(t){return Array.isArray(t)?t:[t]}function W(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class j{constructor(t,e){this.gutter=t,this.localMarkers=[],this.i=0,this.height=0,this.cursor=P.Xs.iter(t.markers,e.from)}line(t,e,i){this.localMarkers.length&&(this.localMarkers=[]),W(this.cursor,this.localMarkers,e.from);let n=i.length?this.localMarkers.concat(i):this.localMarkers,s=this.gutter.config.lineMarker(t,e,n);s&&n.unshift(s);let r=this.gutter;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new F(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else{let i=r.elements[this.i];(function(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!t[i].compare(e[i]))return!1;return!0})(n,i.markers)&&(n=i.markers),i.update(t,e.height,o,n)}this.height=e.bottom,this.i++}finish(){let t=this.gutter;for(;t.elements.length>this.i;)t.dom.removeChild(t.elements.pop().dom)}}class _{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="
1cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in e.domEventHandlers)this.dom.addEventListener(i,(n=>{let s=t.visualLineAtHeight(n.clientY,t.contentDOM.getBoundingClientRect().top);e.domEventHandlers[i](t,s,n)&&n.preventDefault()}));this.markers=H(e.markers(t)),e.initialSpacer&&(this.spacer=new F(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=H(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let e=this.config.updateSpacer(this.spacer.markers[0],t);e!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[e])}let i=t.view.viewport;return!P.Xs.eq(this.markers,e,i.from,i.to)}}class F{constructor(t,e,i,n){this.height=-1,this.above=0,this.dom=document.createElement("div"),this.update(t,e,i,n)}update(t,e,i,n){if(this.height!=e&&(this.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),this.markers!=n){this.markers=n;for(let t;t=this.dom.lastChild;)t.remove();let e="cm-gutterElement";for(let i of n){i.toDOM&&this.dom.appendChild(i.toDOM(t));let n=i.elementClass;n&&(e+=" "+n)}this.dom.className=e}}}const q=s.r$.define(),Q=s.r$.define({combine:t=>(0,s.BO)(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let n in e){let t=i[n],s=e[n];i[n]=t?(e,i,n)=>t(e,i,n)||s(e,i,n):s}return i}})});class $ extends D{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(t){return document.createTextNode(this.number)}}function U(t,e){return t.state.facet(Q).formatNumber(e,t.state)}const G=N({class:"cm-lineNumbers",markers:t=>t.state.facet(q),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new $(U(t,t.state.doc.lineAt(e.from).number)),initialSpacer:t=>new $(U(t,Y(t.state.doc.lines))),updateSpacer(t,e){let i=U(e.view,Y(e.view.state.doc.lines));return i==t.number?t:new $(i)}});function K(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Q.of(t),G]}function Y(t){let e=9;for(;e<t;)e=10*e+9;return e}const J=new class extends D{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}eq(){return!0}},X=E.compute(["selection"],(t=>{let e=[],i=-1;for(let n of t.selection.ranges)if(n.empty){let s=t.doc.lineAt(n.head).from;s>i&&(i=s,e.push(J.range(s)))}return P.Xs.of(e)}));function Z(){return X}function tt(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const et=s.Py.define({map:tt}),it=s.Py.define({map:tt});function nt(t){let e=[];for(let{head:i}of t.state.selection.ranges)e.some((t=>t.from<=i&&t.to>=i))||e.push(t.visualLineAt(i));return e}const st=s.QQ.define({create:()=>n.p.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(et)&&!ot(t,i.value.from,i.value.to)?t=t.update({add:[dt.range(i.value.from,i.value.to)]}):i.is(it)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{t<n&&e>n&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>n.tk.decorations.from(t)});function rt(t,e,i){var n;let s=null;return null===(n=t.field(st,!1))||void 0===n||n.between(e,i,((t,e)=>{(!s||s.from>t)&&(s={from:t,to:e})})),s}function ot(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}function lt(t,e){return t.field(st,!1)?e:e.concat(s.Py.appendConfig.of(ft()))}function ht(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=t.state.doc.lineAt(e.from).number,r=t.state.doc.lineAt(e.to).number;return n.tk.announce.of("".concat(t.state.phrase(i?"Folded lines":"Unfolded lines")," ").concat(s," ").concat(t.state.phrase("to")," ").concat(r,"."))}const at=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:t=>{for(let e of nt(t)){let i=(0,O.Fw)(t.state,e.from,e.to);if(i)return t.dispatch({effects:lt(t.state,[et.of(i),ht(t,i)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:t=>{if(!t.state.field(st,!1))return!1;let e=[];for(let i of nt(t)){let n=rt(t.state,i.from,i.to);n&&e.push(it.of(n),ht(t,n,!1))}return e.length&&t.dispatch({effects:e}),e.length>0}},{key:"Ctrl-Alt-[",run:t=>{let{state:e}=t,i=[];for(let n=0;n<e.doc.length;){let s=t.visualLineAt(n),r=(0,O.Fw)(e,s.from,s.to);
1r&&i.push(et.of(r)),n=(r?t.visualLineAt(r.to):s).to+1}return i.length&&t.dispatch({effects:lt(t.state,i)}),!!i.length}},{key:"Ctrl-Alt-]",run:t=>{let e=t.state.field(st,!1);if(!e||!e.size)return!1;let i=[];return e.between(0,t.state.doc.length,((t,e)=>{i.push(it.of({from:t,to:e}))})),t.dispatch({effects:i}),!0}}],ct={placeholderDOM:null,placeholderText:"\u2026"},ut=s.r$.define({combine:t=>(0,s.BO)(t,ct)});function ft(t){let e=[st,vt];return t&&e.push(ut.of(t)),e}const dt=n.p.replace({widget:new class extends n.l9{ignoreEvents(){return!1}toDOM(t){let{state:e}=t,i=e.facet(ut);if(i.placeholderDOM)return i.placeholderDOM();let n=document.createElement("span");return n.textContent=i.placeholderText,n.setAttribute("aria-label",e.phrase("folded code")),n.title=e.phrase("unfold"),n.className="cm-foldPlaceholder",n.onclick=e=>{let i=t.visualLineAt(t.posAtDOM(e.target)),n=rt(t.state,i.from,i.to);n&&t.dispatch({effects:it.of(n)}),e.preventDefault()},n}}}),pt={openText:"\u2304",closedText:"\u203a",markerDOM:null};class gt extends D{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}function mt(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign(Object.assign({},pt),t),i=new gt(e,!0),s=new gt(e,!1),r=n.lg.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(O.dK)!=t.state.facet(O.dK)||t.startState.field(st,!1)!=t.state.field(st,!1))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new P.f_;return t.viewportLines((n=>{let r=rt(t.state,n.from,n.to)?s:(0,O.Fw)(t.state,n.from,n.to)?i:null;r&&e.add(n.from,n.from,r)})),e.finish()}});return[r,N({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(r))||void 0===e?void 0:e.markers)||P.Xs.empty},initialSpacer:()=>new gt(e,!1),domEventHandlers:{click:(t,e)=>{let i=rt(t.state,e.from,e.to);if(i)return t.dispatch({effects:it.of(i)}),!0;let n=(0,O.Fw)(t.state,e.from,e.to);return!!n&&(t.dispatch({effects:et.of(n)}),!0)}}}),ft()]}const vt=n.tk.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter .cm-gutterElement":{padding:"0 1px",cursor:"pointer"}});var wt=i(75453),yt=i(25877),bt=i(78528);const xt={brackets:["(","[","{","'",'"'],before:")]}'\":;>"},kt=s.Py.define({map(t,e){let i=e.mapPos(t,-1,s.gc.TrackAfter);return null==i?void 0:i}}),St=s.Py.define({map:(t,e)=>e.mapPos(t)}),At=new class extends P.uU{};At.startSide=1,At.endSide=-1;const Ct=s.QQ.define({create:()=>P.Xs.empty,update(t,e){if(e.selection){let i=e.state.doc.lineAt(e.selection.main.head).from,n=e.startState.doc.lineAt(e.startState.selection.main.head).from;i!=e.changes.mapPos(n,-1)&&(t=P.Xs.empty)}t=t.map(e.changes);for(let i of e.effects)i.is(kt)?t=t.update({add:[At.range(i.value,i.value+1)]}):i.is(St)&&(t=t.update({filter:t=>t!=i.value}));return t}});function Mt(){return[n.tk.inputHandler.of(Dt),Ct]}const Tt="()[]{}<>";function Ot(t){for(let e=0;e<Tt.length;e+=2)if(Tt.charCodeAt(e)==t)return Tt.charAt(e+1);return(0,bt.bg)(t<128?t:t+1)}function Pt(t,e){return t.languageDataAt("closeBrackets",e)[0]||xt}function Dt(t,e,i,n){if(t.composing)return!1;let s=t.state.selection.main;if(n.length>2||2==n.length&&1==(0,bt.nZ)((0,bt.gm)(n,0))||e!=s.from||i!=s.to)return!1;let r=function(t,e){let i=Pt(t,t.selection.main.head),n=i.brackets||xt.brackets;for(let s of n){let r=Ot((0,bt.gm)(s,0));if(e==s)return r==s?Bt(t,s,n.indexOf(s+s+s)>-1):Nt(t,s,r,i.before||xt.before);if(e==r&&Rt(t,t.selection.main.from))return It(t,s,r)}return null}(t.state,n);return!!r&&(t.dispatch(r),!0)}const Et=[{key:"Backspace",run:t=>{let{state:e,dispatch:i}=t,n=Pt(e,e.selection.main.head).brackets||xt.brackets,r=null,o=e.changeByRange((t=>
1{if(t.empty){let i=function(t,e){let i=t.sliceString(e-2,e);return(0,bt.nZ)((0,bt.gm)(i,0))==i.length?i:i.slice(1)}(e.doc,t.head);for(let r of n)if(r==i&&Lt(e.doc,t.head)==Ot((0,bt.gm)(r,0)))return{changes:{from:t.head-r.length,to:t.head+r.length},range:s.jT.cursor(t.head-r.length),annotations:s.YW.userEvent.of("delete")}}return{range:r=t}}));return r||i(e.update(o,{scrollIntoView:!0})),!r}}];function Rt(t,e){let i=!1;return t.field(Ct).between(0,t.doc.length,(t=>{t==e&&(i=!0)})),i}function Lt(t,e){let i=t.sliceString(e,e+2);return i.slice(0,(0,bt.nZ)((0,bt.gm)(i,0)))}function Nt(t,e,i,n){let r=null,o=t.changeByRange((o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:i,from:o.to}],effects:kt.of(o.to+e.length),range:s.jT.range(o.anchor+e.length,o.head+e.length)};let l=Lt(t.doc,o.head);return!l||/\s/.test(l)||n.indexOf(l)>-1?{changes:{insert:e+i,from:o.head},effects:kt.of(o.head+e.length),range:s.jT.cursor(o.head+e.length)}:{range:r=o}}));return r?null:t.update(o,{scrollIntoView:!0,annotations:s.YW.userEvent.of("input")})}function It(t,e,i){let n=null,r=t.selection.ranges.map((e=>e.empty&&Lt(t.doc,e.head)==i?s.jT.cursor(e.head+i.length):n=e));return n?null:t.update({selection:s.jT.create(r,t.selection.mainIndex),scrollIntoView:!0,effects:t.selection.ranges.map((t=>{let{from:e}=t;return St.of(e)}))})}function Bt(t,e,i){let n=null,r=t.changeByRange((r=>{if(!r.empty)return{changes:[{insert:e,from:r.from},{insert:e,from:r.to}],effects:kt.of(r.to+e.length),range:s.jT.range(r.anchor+e.length,r.head+e.length)};let o=r.head,l=Lt(t.doc,o);if(l==e){if(Vt(t,o))return{changes:{insert:e+e,from:o},effects:kt.of(o+e.length),range:s.jT.cursor(o+e.length)};if(Rt(t,o)){let n=i&&t.sliceDoc(o,o+3*e.length)==e+e+e;return{range:s.jT.cursor(o+e.length*(n?3:1)),effects:St.of(o)}}}else{if(i&&t.sliceDoc(o-2*e.length,o)==e+e&&Vt(t,o-2*e.length))return{changes:{insert:e+e+e+e,from:o},effects:kt.of(o+e.length),range:s.jT.cursor(o+e.length)};if(t.charCategorizer(o)(l)!=s.D0.Word){let i=t.sliceDoc(o-1,o);if(i!=e&&t.charCategorizer(o)(i)!=s.D0.Word)return{changes:{insert:e+e,from:o},effects:kt.of(o+e.length),range:s.jT.cursor(o+e.length)}}}return{range:n=r}}));return n?null:t.update(r,{scrollIntoView:!0,annotations:s.YW.userEvent.of("input")})}function Vt(t,e){let i=(0,O.qz)(t).resolve(e+1);return i.parent&&i.from==e}const zt=s.r$.define({combine(t){let e,i;for(let n of t)e=e||n.topContainer,i=i||n.bottomContainer;return{topContainer:e,bottomContainer:i}}});function Ht(t,e){let i=t.plugin(Wt),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Wt=n.lg.fromClass(class{constructor(t){this.input=t.state.facet(qt),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(zt);this.top=new jt(t,!0,e.topContainer),this.bottom=new jt(t,!1,e.bottomContainer),this.top.sync(this.panels.filter((t=>t.top))),this.bottom.sync(this.panels.filter((t=>!t.top)));for(let i of this.panels)i.dom.classList.add("cm-panel"),i.class&&i.dom.classList.add(i.class),i.mount&&i.mount()}update(t){let e=t.state.facet(zt);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new jt(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new jt(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(qt);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,l=this.specs.indexOf(i);l<0?(e=i(t.view),o.push(e)):(e=this.panels[l],e.update&&e.update(t)),n.push(e),(e.top?s:r).push(e)}this.specs=e,this.panels=n,this.top.sync(s),this.bottom.sync(r);for(let t of o)t.dom.classList.add("cm-panel"),t.class&&t.dom.classList.add(t.class),t.mount&&t.mount()}else for(let n of this.panels)n.update&&n.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n.BF.scrollMargins.from((t=>({top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()})))});class jt{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){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?"to
1p":"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=_t(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=_t(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 _t(t){let e=t.nextSibling;return t.remove(),e}const Ft=n.tk.baseTheme({".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"}}),qt=s.r$.define({enables:[Wt,Ft]});function Qt(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&"object"==typeof i&&null==i.nodeType&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var s=i[n];"string"==typeof s?t.setAttribute(n,s):null!=s&&(t[n]=s)}e++}for(;e<arguments.length;e++)$t(t,arguments[e]);return t}function $t(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 i=0;i<e.length;i++)$t(t,e[i])}}const Ut="function"==typeof String.prototype.normalize?t=>t.normalize("NFKD"):t=>t;class Gt{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length,s=arguments.length>4?arguments[4]:void 0;this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,n),this.bufferStart=i,this.normalize=s?t=>s(Ut(t)):Ut,this.query=this.normalize(e)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return(0,bt.gm)(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=(0,bt.bg)(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=(0,bt.nZ)(t);let n=this.normalize(e);for(let s=0,r=i;;s++){let t=n.charCodeAt(s),o=this.match(t,r);if(o)return this.value=o,this;if(s==n.length-1)break;r==i&&s<e.length&&e.charCodeAt(s)==t&&r++}}}match(t,e){let i=null;for(let n=0;n<this.matches.length;n+=2){let s=this.matches[n],r=!1;this.query.charCodeAt(s)==t&&(s==this.query.length-1?i={from:this.matches[n+1],to:e+1}:(this.matches[n]++,r=!0)),r||(this.matches.splice(n,2),n-=2)}return this.query.charCodeAt(0)==t&&(1==this.query.length?i={from:e,to:e+1}:this.matches.push(1,e)),i}}const Kt={from:-1,to:-1,match:/.*/.exec("")},Yt="gm"+(null==/x/.unicode?"":"u");class Jt{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.length;if(this.to=s,this.curLine="",this.done=!1,this.value=Kt,/\\[sWDnr]|\n|\r|\[\^/.test(e))return new te(t,e,i,n,s);this.re=new RegExp(e,Yt+((null===i||void 0===i?void 0:i.ignoreCase)?"i":"")),this.iter=t.iter();let r=t.lineAt(n);this.curLineStart=r.from,this.matchPos=n,this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let i=this.curLineStart+e.index,n=i+e[0].length;if(this.matchPos=n+(i==n?1:0),i==this.curLine.length&&this.nextLine(),i<n||i>this.value.to)return this.value={from:i,to:n,match:e},this;t=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),t=0}}}}const Xt=new WeakMap;class Zt{constructor(t,e){this.from=t,this.text=e}get to(){return this.from+this.text.length}static get(t,e,i){let n=Xt.get(t);if(!n||n.from>=i||n.to<=e){let n=new Zt(e,t.sliceString(e,i));
1return Xt.set(t,n),n}if(n.from==e&&n.to==i)return n;let{text:s,from:r}=n;return r>e&&(s=t.sliceString(e,r)+s,r=e),n.to<i&&(s+=t.sliceString(n.to,i)),Xt.set(t,new Zt(r,s)),new Zt(e,s.slice(e-r,i-r))}}class te{constructor(t,e,i,n,s){this.text=t,this.to=s,this.done=!1,this.value=Kt,this.matchPos=n,this.re=new RegExp(e,Yt+((null===i||void 0===i?void 0:i.ignoreCase)?"i":"")),this.flat=Zt.get(t,n,this.chunkEnd(n+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e&&this.flat.to<this.to&&e.index+e[0].length>this.flat.text.length-10&&(e=null),e){let t=this.flat.from+e.index,i=t+e[0].length;return this.value={from:t,to:i,match:e},this.matchPos=i+(t==i?1:0),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Zt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function ee(t){let e=Qt("input",{class:"cm-textfield",name:"line"});function i(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!i)return;let{state:n}=t,r=n.doc.lineAt(n.selection.main.head),[,o,l,h,a]=i,c=h?+h.slice(1):0,u=l?+l:r.number;if(l&&a){let t=u/100;o&&(t=t*("-"==o?-1:1)+r.number/n.doc.lines),u=Math.round(n.doc.lines*t)}else l&&o&&(u=u*("-"==o?-1:1)+r.number);let f=n.doc.line(Math.max(1,Math.min(n.doc.lines,u)));t.dispatch({effects:ie.of(!1),selection:s.jT.cursor(f.from+Math.max(0,Math.min(c,f.length))),scrollIntoView:!0}),t.focus()}return{dom:Qt("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:ie.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Qt("label",t.state.phrase("Go to line"),": ",e)," ",Qt("button",{class:"cm-button",type:"submit"},t.state.phrase("go"))),pos:-10}}const ie=s.Py.define(),ne=s.QQ.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(ie)&&(t=i.value);return t},provide:t=>qt.from(t,(t=>t?ee:null))}),se=n.tk.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),re={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100},oe=s.r$.define({combine:t=>(0,s.BO)(t,re,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function le(t){let e=[ue,ce];return t&&e.push(oe.of(t)),e}const he=n.p.mark({class:"cm-selectionMatch"}),ae=n.p.mark({class:"cm-selectionMatch cm-selectionMatch-main"}),ce=n.lg.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(oe),{state:i}=t,r=i.selection;if(r.ranges.length>1)return n.p.none;let o,l=r.main,h=null;if(l.empty){if(!e.highlightWordAroundCursor)return n.p.none;let t=i.wordAt(l.head);if(!t)return n.p.none;h=i.charCategorizer(l.head),o=i.sliceDoc(t.from,t.to)}else{let t=l.to-l.from;if(t<e.minSelectionLength||t>200)return n.p.none;if(o=i.sliceDoc(l.from,l.to).trim(),!o)return n.p.none}let a=[];for(let c of t.visibleRanges){let t=new Gt(i.doc,o,c.from,c.to);for(;!t.nextOverlapping().done;){let{from:r,to:o}=t.value;if((!h||(0==r||h(i.sliceDoc(r-1,r))!=s.D0.Word)&&(o==i.doc.length||h(i.sliceDoc(o,o+1))!=s.D0.Word))&&(h&&r<=l.from&&o>=l.to?a.push(ae.range(r,o)):(r>=l.to||o<=l.from)&&a.push(he.range(r,o)),a.length>e.maxMatches))return n.p.none}}return n.p.set(a)}},{decorations:t=>t.decorations}),ue=n.tk.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const fe=s.r$.define({combine:t=>({top:t.some((t=>t.top))})});class de{constructor(t,e,i){this.search=t,this.replace=e,this.caseInsensitive=i}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseInsensitive==t.caseInsensitive&&this.constructor==t.constructor}}class pe extends de{constructor(t,e,i){super(t,e,i),this.unquoted=t.replace(/\\([nrt\\])/g,((t,e)=>"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\"))}cursor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;return new Gt(t,this.unquoted,e,i,this.caseInsensitive?t=>t.toLowerCase():void 0)}nextMatch(t,e,i){let n=this.cursor(t,i).nextOverlapping();return n.done&&(n=this.cursor(t,0,e).nextOverlapping()),n.done?null:n.value}prevMatchInRange(t,e,i){for(let n=i;;){let i=Math.max(e,n-1e4-this.unquoted.length),s=this.cursor(t,i,n),r=null;for(;!s.nextOverlapping().done;)r=s.value;if(r)return r;if(i==e)return null;n-=1e4}}prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.length)}getReplacement(t){return this.replace}matchAll(t,e){let i=this.cursor(t),n=[];for(;!i.next().done;){if(n.length>=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let s=this.cursor(t,Math.max(0,e-this.unquoted.length),Math.min(i+this.unquoted.length,t.length));for(;!s.next().done;)n(s.value.from,s.value.to)}get valid(){return!!this.search}}class ge extends de{constructor(t,e,i){super(t,e,i),this.valid=!!t&&function(t){try{return new RegExp(t,Yt),!0}catch(e){return!1}}(t)}cursor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;return new Jt(t,this.search,this.caseInsensitive?{ignoreCase:!0}:void 0,e,i)}nextMatch(t,e,i){let n=this.cursor(t,i).next();return n.done&&(n=this.cursor(t,0,e).next()),n.done?null:n.value}prevMatchInRange(t,e,i){for(let n=1;;n++){let s=Math.max(e,i-1e4*n),r=this.cursor(t,s,i),o=null;for(;!r.next().done;)o=r.value;if(o&&(s==e||o.from>s+10))return o;if(s==e)return null}}prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.length)}getReplacement(t){return this.replace.replace(/\$([$&\d+])/g,((e,i)=>"$"==i?"$":"&"==i?t.match[0]:"0"!=i&&+i<t.match.length?t.match[i]:e))}matchAll(t,e){let i=this.cursor(t),n=[];for(;!i.next().done;){if(n.length>=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let s=this.cursor(t,Math.max(0,e-250),Math.min(i+250,t.length));for(;!s.next().done;)n(s.value.from,s.value.to)}}
1const me=s.Py.define(),ve=s.Py.define(),we=s.QQ.define({create:t=>new ye(De(t),Pe),update(t,e){for(let i of e.effects)i.is(me)?t=new ye(i.value,t.panel):i.is(ve)&&(t=new ye(t.query,i.value?Pe:null));return t},provide:t=>qt.from(t,(t=>t.panel))});class ye{constructor(t,e){this.query=t,this.panel=e}}const be=n.p.mark({class:"cm-searchMatch"}),xe=n.p.mark({class:"cm-searchMatch cm-searchMatch-selected"}),ke=n.lg.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(we))}update(t){let e=t.state.field(we);(e!=t.startState.field(we)||t.docChanged||t.selectionSet)&&(this.decorations=this.highlight(e))}highlight(t){let{query:e,panel:i}=t;if(!i||!e.valid)return n.p.none;let{view:s}=this,r=new P.f_;for(let n=0,o=s.visibleRanges,l=o.length;n<l;n++){let{from:t,to:i}=o[n];for(;n<l-1&&i>o[n+1].from-500;)i=o[++n].to;e.highlight(s.state.doc,t,i,((t,e)=>{let i=s.state.selection.ranges.some((i=>i.from==t&&i.to==e));r.add(t,e,i?xe:be)}))}return r.finish()}},{decorations:t=>t.decorations});function Se(t){return e=>{let i=e.state.field(we,!1);return i&&i.query.valid?t(e,i):Ee(e)}}const Ae=Se(((t,e)=>{let{query:i}=e,{from:n,to:s}=t.state.selection.main,r=i.nextMatch(t.state.doc,n,s);return!(!r||r.from==n&&r.to==s)&&(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Ve(t,r)}),!0)})),Ce=Se(((t,e)=>{let{query:i}=e,{state:n}=t,{from:s,to:r}=n.selection.main,o=i.prevMatch(n.doc,s,r);return!!o&&(t.dispatch({selection:{anchor:o.from,head:o.to},scrollIntoView:!0,effects:Ve(t,o)}),!0)})),Me=Se(((t,e)=>{let{query:i}=e,n=i.matchAll(t.state.doc,1e3);return!(!n||!n.length)&&(t.dispatch({selection:s.jT.create(n.map((t=>s.jT.range(t.from,t.to))))}),!0)})),Te=Se(((t,e)=>{let{query:i}=e,{state:n}=t,{from:s,to:r}=n.selection.main,o=i.nextMatch(n.doc,s,s);if(!o)return!1;let l,h,a=[];if(o.from==s&&o.to==r&&(h=n.toText(i.getReplacement(o)),a.push({from:o.from,to:o.to,insert:h}),o=i.nextMatch(n.doc,o.from,o.to)),o){let t=0==a.length||a[0].from>=o.to?0:o.to-o.from-h.length;l={anchor:o.from-t,head:o.to-t}}return t.dispatch({changes:a,selection:l,scrollIntoView:!!l,effects:o?Ve(t,o):void 0}),!0})),Oe=Se(((t,e)=>{let{query:i}=e,n=i.matchAll(t.state.doc,1e9).map((t=>{let{from:e,to:n}=t;return{from:e,to:n,insert:i.getReplacement(t)}}));return!!n.length&&(t.dispatch({changes:n}),!0)}));function Pe(t){let{query:e}=t.state.field(we);return{dom:Ne({view:t,query:e,updateQuery(i){e.eq(i)||(e=i,t.dispatch({effects:me.of(e)}))}}),mount(){this.dom.querySelector("[name=search]").select()},pos:80,top:t.state.facet(fe).top}}function De(t,e){let i=t.selection.main,n=i.empty||i.to>i.from+100?"":t.sliceDoc(i.from,i.to);return e&&!n?e:new pe(n.replace(/\n/g,"\\n"),"",(null===e||void 0===e?void 0:e.caseInsensitive)||!1)}const Ee=t=>{let e=t.state.field(we,!1);if(e&&e.panel){let e=Ht(t,Pe);if(!e)return!1;e.dom.querySelector("[name=search]").focus()}else t.dispatch({effects:[ve.of(!0),e?me.of(De(t.state,e.query)):s.Py.appendConfig.of(He)]});return!0},Re=t=>{let e=t.state.field(we,!1);if(!e||!e.panel)return!1;let i=Ht(t,Pe);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:ve.of(!1)}),!0},Le=[{key:"Mod-f",run:Ee,scope:"editor search-panel"},{key:"F3",run:Ae,shift:Ce,scope:"editor search-panel"},{key:"Mod-g",run:Ae,shift:Ce,scope:"editor search-panel"},{key:"Escape",run:Re,scope:"editor search-panel"},{key:"Mod-Shift-l",run:t=>{let{state:e,dispatch:i}=t,n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:o}=n.main,l=[],h=0;for(let a=new Gt(e.doc,e.sliceDoc(r,o));!a.next().done;){if(l.length>1e3)return!1;a.value.from==r&&(h=l.length),l.push(s.jT.range(a.value.from,a.value.to))}return i(e.update({selection:s.jT.create(l,h)})),!0}},{key:"Alt-g",run:t=>{let e=Ht(t,ee);if(!e){let i=[ie.of(!0)];null==t.state.field(ne,!1)&&i.push(s.Py.appendConfig.of([ne,se])),t.dispatch({effects:i}),e=Ht(t,ee)}return e&&e.dom.querySelector("input").focus(),!0}},{key:"Mod-d",run:t=>{let{state:e,dispatch:i}=t,{ranges:n}=e.selection;if(n.some((t=>t.from===t.to)))return(t=>{let{state:e,dispatch:i}=t,{selection:n}=e,r=s.jT.create(n.ranges.map((t=>
1e.wordAt(t.head)||s.jT.cursor(t.head))),n.mainIndex);return!r.eq(n)&&(i(e.update({selection:r})),!0)})({state:e,dispatch:i});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some((t=>e.sliceDoc(t.from,t.to)!=r)))return!1;let o=function(t,e){let{ranges:i}=t.selection,n=new Gt(t.doc,e,i[i.length-1].to).next();if(!n.done)return n.value;let s=new Gt(t.doc,e,0,Math.max(0,i[i.length-1].from-1));for(;!s.next().done;)if(!i.some((t=>t.from===s.value.from)))return s.value;return null}(e,r);return!!o&&(i(e.update({selection:e.selection.addRange(s.jT.range(o.from,o.to)),scrollIntoView:!0})),!0)}}];function Ne(t){function e(e){return t.view.state.phrase(e)}let i=Qt("input",{value:t.query.search,placeholder:e("Find"),"aria-label":e("Find"),class:"cm-textfield",name:"search",onchange:l,onkeyup:l}),s=Qt("input",{value:t.query.replace,placeholder:e("Replace"),"aria-label":e("Replace"),class:"cm-textfield",name:"replace",onchange:l,onkeyup:l}),r=Qt("input",{type:"checkbox",name:"case",checked:!t.query.caseInsensitive,onchange:l}),o=Qt("input",{type:"checkbox",name:"re",checked:t.query instanceof ge,onchange:l});function l(){t.updateQuery(new(o.checked?ge:pe)(i.value,s.value,!r.checked))}function h(t,e,i){return Qt("button",{class:"cm-button",name:t,onclick:e},i)}return Qt("div",{onkeydown:function(e){(0,n.$1)(t.view,e,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==i?(e.preventDefault(),(e.shiftKey?Ce:Ae)(t.view)):13==e.keyCode&&e.target==s&&(e.preventDefault(),Te(t.view))},class:"cm-search"},[i,h("next",(()=>Ae(t.view)),[e("next")]),h("prev",(()=>Ce(t.view)),[e("previous")]),h("select",(()=>Me(t.view)),[e("all")]),Qt("label",null,[r,e("match case")]),Qt("label",null,[o,e("regexp")]),Qt("br"),s,h("replace",(()=>Te(t.view)),[e("replace")]),h("replaceAll",(()=>Oe(t.view)),[e("replace all")]),Qt("button",{name:"close",onclick:()=>Re(t.view),"aria-label":e("close")},["\xd7"])])}const Ie=30,Be=/[\s\.,:;?!]/;function Ve(t,e){let{from:i,to:s}=e,r=t.state.doc.lineAt(i).from,o=t.state.doc.lineAt(s).to,l=Math.max(r,i-Ie),h=Math.min(o,s+Ie),a=t.state.sliceDoc(l,h);if(l!=r)for(let n=0;n<Ie;n++)if(!Be.test(a[n+1])&&Be.test(a[n])){a=a.slice(n);break}if(h!=o)for(let n=a.length-1;n>a.length-Ie;n--)if(!Be.test(a[n-1])&&Be.test(a[n])){a=a.slice(0,n);break}return n.tk.announce.of("".concat(t.state.phrase("current match"),". ").concat(a," ").concat(t.state.phrase("on line")," ").concat(t.state.doc.lineAt(i).number))}const ze=n.tk.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),He=[we,s.Wl.override(ke),ze],We="undefined"!=typeof navigator&&!/Edge\/(\d+)/.exec(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor)&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),je="-10000px",_e=n.lg.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.input=t.state.facet(qe),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map((t=>this.createTooltip(t)))}update(t){let e=t.state.facet(qe);if(e==this.input)for(let i of this.tooltipViews)i.update&&i.update(t);else{let i=e.filter((t=>t)),n=[];for(let e=0;e<i.length;e++){let s=i[e],r=-1;if(s){for(let t=0;t<this.tooltips.length;t++){let e=this.tooltips[t];e&&e.create==s.create&&(r=t)}if(r<0)n[e]=this.createTooltip(s);else{let i=n[e]=this.tooltipViews[r];i.update&&i.update(t)}}}for(let t of this.tooltipViews)n.indexOf(t)<0&&t.dom.remove();this.input=e,this.tooltips=i,this.tooltipViews=n,this.maybeMeasure()}}createTooltip(t){let e=t.create(this.view);return e.dom.classList.add("cm-tooltip"),t.class&&e.dom.classList.add(t.class),e.dom.style.top=je,this.view.dom.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){for(let{dom:t}of this.tooltipViews)t.remove()}readMeasure(){return{editor:this.view.dom.getBoundingClientRect(),pos:this.tooltips.map((t=>this.view.coordsAtPos(t.pos))),size:this.tooltipViews.map((t=>{let{dom:e}=t;return e.getBoundingClientRect()})),innerWidth:window.innerWidth,innerHeight:window.innerHeight}}writeMeasure(t){let{editor:e}=t;for(let i=0;i<this.tooltipViews.length;i++){let s=this.tooltips[i],r=this.tooltipViews[i],{dom:o}=r,l=t.pos[i],h=t.size[i];if(!l||l.bottom<=e.top||l.top>=e.bottom||l.right<=e.left||l.left>=e.right){o.style.top=je;continue}let a=h.right-h.left,c=h.bottom-h.top,u=this.view.textDirection==n.Nm.LTR?Math.min(l.left,t.innerWidth-a):Math.max(0,l.left-a),f=!!s.above;!s.strictSide&&(f?l.top-(h.bottom-h.top)<0:l.bottom+(h.bottom-h.top)>
1t.innerHeight)&&(f=!f),We?(o.style.top=(f?l.top-c:l.bottom)-e.top+"px",o.style.left=u-e.left+"px",o.style.position="absolute"):(o.style.top=(f?l.top-c:l.bottom)+"px",o.style.left=u+"px"),o.classList.toggle("cm-tooltip-above",f),o.classList.toggle("cm-tooltip-below",!f),r.positioned&&r.positioned()}}maybeMeasure(){this.tooltips.length&&((this.view.inView||this.inView)&&this.view.requestMeasure(this.measureReq),this.inView=this.view.inView)}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Fe=n.tk.baseTheme({".cm-tooltip":{position:"fixed",zIndex:100},"&light .cm-tooltip":{border:"1px solid #ddd",backgroundColor:"#f5f5f5"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"}});const qe=s.r$.define({enables:[_e,Fe]});class Qe{constructor(t,e,i,n){this.view=t,this.source=e,this.field=i,this.setHover=n,this.lastMouseMove=null,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,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)return;let t=Date.now(),e=this.lastMouseMove;t-e.timeStamp<750?this.hoverTimeout=setTimeout(this.checkHover,750-(t-e.timeStamp)):this.startHover()}startHover(){var t;clearTimeout(this.restartTimeout);let e=this.lastMouseMove,i={x:e.clientX,y:e.clientY},s=this.view.contentDOM.contains(e.target)?this.view.posAtCoords(i):null;if(null==s)return;let r=this.view.coordsAtPos(s);if(null==r||i.y<r.top||i.y>r.bottom||i.x<r.left-this.view.defaultCharacterWidth||i.x>r.right+this.view.defaultCharacterWidth)return;let o=this.view.bidiSpans(this.view.state.doc.lineAt(s)).find((t=>t.from<=s&&t.to>=s)),l=o&&o.dir==n.Nm.RTL?-1:1,h=this.source(this.view,s,i.x<r.left?-l:l);if(null===(t=h)||void 0===t?void 0:t.then){let t=this.pending={pos:s};h.then((e=>{this.pending==t&&(this.pending=null,e&&this.view.dispatch({effects:this.setHover.of(e)}))}),(t=>(0,n.OO)(this.view.state,t,"hover tooltip")))}else h&&this.view.dispatch({effects:this.setHover.of(h)})}mousemove(t){var e;this.lastMouseMove=t,this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,750));let i=this.active;if(i&&!function(t){for(let e=t;e;e=e.parentNode)if(1==e.nodeType&&e.classList.contains("cm-tooltip"))return!0;return!1}(t.target)||this.pending){let{pos:n}=i||this.pending,s=null!==(e=null===i||void 0===i?void 0:i.end)&&void 0!==e?e:n;(n==s?this.view.posAtCoords({x:t.clientX,y:t.clientY})==n:function(t,e,i,n,s,r){let o=document.createRange(),l=t.domAtPos(e),h=t.domAtPos(i);o.setEnd(h.node,h.offset),o.setStart(l.node,l.offset);let a=o.getClientRects();o.detach();for(let c=0;c<a.length;c++){let t=a[c];if(Math.max(t.top-s,s-t.bottom,t.left-n,n-t.right)<=r)return!0}return!1}(this.view,n,s,t.clientX,t.clientY,6))||(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function $e(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=s.Py.define(),r=s.QQ.define({create:()=>null,update(t,n){if(t&&e.hideOnChange&&(n.docChanged||n.selection))return null;for(let e of n.effects)if(e.is(i))return e.value;if(t&&n.docChanged){let e=n.changes.mapPos(t.pos,-1,s.gc.TrackDel);if(null==e)return null;let i=Object.assign(Object.create(null),t);return i.pos=e,null!=t.end&&(i.end=n.changes.mapPos(t.end)),i}return t},provide:t=>qe.from(t)});return[r,n.lg.define((e=>new Qe(e,t,r,i)))]}class Ue{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=(0,O.qz)(this.state).resolve(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),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(Xe(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Ge(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),"[".concat(i?"\\w":"").concat(e.replace(/[^\w\s]/g,"\\$&"),"]")}function Ke(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let t=1;t<s.length;t++)i[s[t]]=!0}let n=Ge(e)+Ge(i)+"*$";return[new RegExp("^"+n),new RegExp(n)]}(e);return t=>{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,span:i}:null}}class Ye{constructor(t,e,i){this.completion=t,this.source=e,this.match=i}}function Je(t){return t.selection.main.head}function Xe(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp("".concat(s?"^":"","(?:").concat(n,")").concat(r?"$":""),null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}function Ze(t,e){let i=e.completion.apply||e.completion.label,n=e.source;"string"==typeof i?t.dispatch({changes:{from:n.from,to:n.to,insert:i},selection:{anchor:n.from+i.length}}):i(t,e.completion,n.from,n.to)}const ti=new WeakMap;function ei(t){if(!Array.isArray(t))return t;let e=ti.get(t);return e||ti.set(t,e=Ke(t)),e}class ii{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e<t.length;){let i=(0,bt.gm)(t,e),n=(0,bt.nZ)(i);this.chars.push(i);let s=t.slice(e,e+n),r=s.toUpperCase();this.folded.push((0,bt.gm)(r==s?s.toLowerCase():r,0)),e+=n}
1this.astral=t.length!=this.chars.length}match(t){if(0==this.pattern.length)return[0];if(t.length<this.pattern.length)return null;let{chars:e,folded:i,any:n,precise:s,byWord:r}=this;if(1==e.length){let n=(0,bt.gm)(t,0);return n==e[0]?[0,0,(0,bt.nZ)(n)]:n==i[0]?[-200,0,(0,bt.nZ)(n)]:null}let o=t.indexOf(this.pattern);if(0==o)return[0,0,this.pattern.length];let l=e.length,h=0;if(o<0){for(let s=0,r=Math.min(t.length,200);s<r&&h<l;){let r=(0,bt.gm)(t,s);r!=e[h]&&r!=i[h]||(n[h++]=s),s+=(0,bt.nZ)(r)}if(h<l)return null}let a=0,c=0,u=!1,f=0,d=-1,p=-1,g=/[a-z]/.test(t);for(let m=0,v=Math.min(t.length,200),w=0;m<v&&c<l;){let n=(0,bt.gm)(t,m);o<0&&(a<l&&n==e[a]&&(s[a++]=m),f<l&&(n==e[f]||n==i[f]?(0==f&&(d=m),p=m,f++):f=0));let h,v=n<255?n>=48&&n<=57||n>=97&&n<=122?2:n>=65&&n<=90?1:0:(h=(0,bt.bg)(n))!=h.toLowerCase()?1:h!=h.toUpperCase()?2:0;(1==v&&g||0==w&&0!=v)&&(e[c]==n||i[c]==n&&(u=!0))&&(r[c++]=m),w=v,m+=(0,bt.nZ)(n)}return c==l&&0==r[0]?this.result((u?-200:0)-100,r,t):f==l&&0==d?[-200,0,p]:o>-1?[-700,o,o+this.pattern.length]:f==l?[-900,d,p]:c==l?this.result((u?-200:0)-100-700,r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t],s=1;for(let r of e){let t=r+(this.astral?(0,bt.nZ)((0,bt.gm)(i,r)):1);s>1&&n[s-1]==r?n[s-1]=t:(n[s++]=r,n[s++]=t)}return n}}const ni=s.r$.define({combine:t=>(0,s.BO)(t,{activateOnTyping:!0,override:null,maxRenderedOptions:100,defaultKeymap:!0},{defaultKeymap:(t,e)=>t&&e})}),si=n.tk.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",maxHeight:"10em",listStyle:"none",margin:0,padding:0,"& > li":{cursor:"pointer",padding:"1px 1em 1px 3px",lineHeight:1.2},"& > li[aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"}}},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xb7\xb7\xb7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"300px"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",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"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25cb'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25cc'"}},".cm-completionIcon-variable":{"&:after":{content:"'\ud835\udc65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\ud835\udc36'"}},".cm-completionIcon-type":{"&:after":{content:"'\ud835\udc61'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222a'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25a1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\ud83d\udd11\ufe0e'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25a2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});function ri(t,e,i){const n=document.createElement("ul");n.id=e,n.setAttribute("role","listbox"),n.setAttribute("aria-expanded","true");for(let s=i.from;s<i.to;s++){let{completion:i,match:r}=t[s];const o=n.appendChild(document.createElement("li"));o.id=e+"-"+s;let l=o.appendChild(document.createElement("div"));l.classList.add("cm-completionIcon"),i.type&&l.classList.add(...i.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),l.setAttribute("aria-hidden","true");let h=o.appendChild(document.createElement("span"));h.className="cm-completionLabel";let{label:a,detail:c}=i,u=0;for(let t=1;t<r.length;){let e=r[t++],i=r[t++];e>u&&h.appendChild(document.createTextNode(a.slice(u,e)));let n=h.appendChild(document.createElement("span"));n.appendChild(document.createTextNode(a.slice(e,i))),n.className="
1cm-completionMatchedText",u=i}if(u<a.length&&h.appendChild(document.createTextNode(a.slice(u))),c){let t=o.appendChild(document.createElement("span"));t.className="cm-completionDetail",t.textContent=c}o.setAttribute("role","option")}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to<t.length&&n.classList.add("cm-completionListIncompleteBottom"),n}function oi(t,e,i){if(t<=i)return{from:0,to:t};if(e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class li{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfo={read:()=>this.measureInfo(),write:t=>this.positionInfo(t),key:this};let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(ni);this.range=oi(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]<n.length)return Ze(t,n[+i[1]]),void e.preventDefault()})),this.list=this.dom.appendChild(ri(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfo)}))}mount(){this.updateSel()}update(t){t.state.field(this.stateField)!=t.startState.field(this.stateField)&&this.updateSel()}positioned(){this.info&&this.view.requestMeasure(this.placeInfo)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected<this.range.from||e.selected>=this.range.to)&&(this.range=oi(e.options.length,e.selected,this.view.state.facet(ni).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(ri(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfo)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let t=e.options[e.selected];t.completion.info&&(this.info=this.dom.appendChild(function(t,e){let i=document.createElement("div");i.className="cm-tooltip cm-completionInfo";let{info:s}=t.completion;if("string"==typeof s)i.textContent=s;else{let r=s(t.completion);r.then?r.then((t=>i.appendChild(t)),(t=>(0,n.OO)(e.state,t,"completion info"))):i.appendChild(r)}return i}(t,this.view)),this.view.requestMeasure(this.placeInfo))}}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected");return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.top<i.top?t.scrollTop-=i.top-n.top:n.bottom>i.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t)return null;let e=this.dom.getBoundingClientRect(),i=t.getBoundingClientRect().top-e.top;if(i<0||i>this.list.clientHeight-10)return null;let s=this.view.textDirection==n.Nm.RTL,r=e.left,o=innerWidth-e.right;return s&&r<Math.min(300,o)?s=!1:!s&&o<Math.min(300,r)&&(s=!0),{top:i,left:s}}positionInfo(t){this.info&&t&&(this.info.style.top=t.top+"px",this.info.classList.toggle("cm-completionInfo-left",t.left),this.info.classList.toggle("cm-completionInfo-right",!t.left))}}function hi(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}class ai{constructor(t,e,i,n,s){this.options=t,this.attrs=e,this.tooltip=i,this.timestamp=n,this.selected=s}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new ai(this.options,ui(e,t),this.tooltip,this.timestamp,t)}static build(t,e,i,n){let s=function(t,e){let i=[],n=0;for(let o of t)if(o.hasResult())if(!1===o.result.filter)for(let t of o.result.options)i.push(new Ye(t,o,[1e9-n++]));else{let t,n=new ii(e.sliceDoc(o.from,o.to));for(let e of o.result.options)(t=n.match(e.label))&&(null!=e.boost&&(t[0]+=e.boost),i.push(new Ye(e,o,t)))}i.sort(pi);let s=[],r=null;for(let o of i.sort(pi)){if(300==s.length)break;r&&r.label==o.completion.label&&r.detail==o.completion.detail?hi(o.completion)>hi(r)&&(s[s.length-1]=o):s.push(o),r=o.completion}return s}(t,e);if(!s.length)return null;let r=0;if(n&&n.selected){let t=n.options[n.selected].completion;for(let e=0;e<s.length&&!r;e++)s[e].completion==t&&(r=e)}return new ai(s,ui(i,r),{pos:t.reduce(((t,e)=>e.hasResult()?Math.min(t,e.from):t),1e8),create:(o=xi,t=>new li(t,o))},n?n.timestamp:Date.now(),r);var o}map(t){return new ai(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected)}}class ci{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new ci(di,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(ni),n=(i.override||e.languageDataAt("autocomplete",Je(e)).map(ei)).map((e=>(this.active.find((t=>t.source==e))||new gi(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i<t.length&&!t[i].hasResult;)i++;for(;n<e.length&&!e[n].hasResult;)n++;let s=i==t.length,r=n==e.length;if(s||r)return s==r;if(t[i++].result!=e[n++].result)return!1}}(n,this.active)?ai.build(n,e,this.id,this.open):this.open&&t.docChanged?this.open.map(t.changes):this.open;!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new gi(t.source,0):t)));for(let r of t.effects)r.is(bi)&&(s=s&&s.setSelected(r.value,this.id));return n==this.active&&s==this.open?this:new ci(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fi}}function ui(t,e){return{"aria-autocomplete":"list","aria-activedescendant":t+"-"+e,"aria-owns":t}}const fi={"aria-autocomplete":"list"},di=[];function pi(t,e){let i=e.match[0]-t.match[0];if(i)return i;let n=t.completion.label,s=e.completion.label;return n<s?-1:n==s?0:1}class gi{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=t.annotation(s.YW.userEvent),n=this;
1"input"==i||"delete"==i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new gi(n.source,0));for(let s of t.effects)if(s.is(vi))n=new gi(n.source,1,s.value?Je(t.state):-1);else if(s.is(wi))n=new gi(n.source,0);else if(s.is(yi))for(let t of s.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new gi(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Je(t.startState))?new gi(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new gi(this.source,this.state,t.mapPos(this.explicitPos))}}class mi extends gi{constructor(t,e,i,n,s,r){super(t,2,e),this.result=i,this.from=n,this.to=s,this.span=r}hasResult(){return!0}handleUserEvent(t,e,i){let n=t.changes.mapPos(this.from),s=t.changes.mapPos(this.to,1),r=Je(t.state);if((this.explicitPos>-1?r<n:r<=n)||r>s)return new gi(this.source,"input"==e&&i.activateOnTyping?1:0);let o=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return this.span&&(n==s||this.span.test(t.state.sliceDoc(n,s)))?new mi(this.source,o,this.result,n,s,this.span):new gi(this.source,1,o)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new gi(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new mi(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1),this.span)}}const vi=s.Py.define(),wi=s.Py.define(),yi=s.Py.define({map:(t,e)=>t.map((t=>t.map(e)))}),bi=s.Py.define(),xi=s.QQ.define({create:()=>ci.start(),update:(t,e)=>t.update(e),provide:t=>[qe.from(t,(t=>t.tooltip)),n.tk.contentAttributes.from(t,(t=>t.attrs))]});function ki(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"option";return i=>{let n=i.state.field(xi,!1);if(!n||!n.open||Date.now()-n.open.timestamp<75)return!1;let s,r=1;"page"==e&&(s=i.dom.querySelector(".cm-tooltip-autocomplete"))&&(r=Math.max(2,Math.floor(s.offsetHeight/s.firstChild.offsetHeight)));let o=n.open.selected+r*(t?1:-1),{length:l}=n.open.options;return o<0?o="page"==e?0:l-1:o>=l&&(o="page"==e?l-1:0),i.dispatch({effects:bi.of(o)}),!0}}class Si{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}}const Ai=n.lg.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of t.state.field(xi).active)1==e.state&&this.startQuery(e)}update(t){let e=t.state.field(xi);if(!t.selectionSet&&!t.docChanged&&t.startState.field(xi)==e)return;let i=t.transactions.some((t=>{let e=t.annotation(s.YW.userEvent);return(t.selection||t.docChanged)&&"input"!=e&&"delete"!=e}));for(let s=0;s<this.running.length;s++){let e=this.running[s];if(i||e.updates.length+t.transactions.length>50&&e.time-Date.now()>1e3){for(let t of e.context.abortListeners)try{t()}catch(r){(0,n.OO)(this.view.state,r)}e.context.abortListeners=null,this.running.splice(s--,1)}else e.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let n of t.transactions)"input"==n.annotation(s.YW.userEvent)?this.composing=2:2==this.composing&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(xi);for(let i of e.active)1!=i.state||this.running.some((t=>t.active.source==i.source))||this.startQuery(i)}startQuery(t){let{state:e}=this.view,i=Je(e),s=new Ue(e,i,t.explicitPos==i),r=new Si(t,s);this.running.push(r),Promise.resolve(t.source(s)).then((t=>{r.context.aborted||(r.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:wi.of(null)}),(0,n.OO)(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(ni);for(let n=0;n<this.running.length;n++){let s=this.running[n];if(void 0===s.done)continue;if(this.running.splice(n--,1),s.done){let n=new mi(s.active.source,s.active.explicitPos,s.done,s.done.from,null!==(t=s.done.to)&&void 0!==t?t:Je(s.updates.length?s.updates[0].startState:this.view.state),s.done.span&&!1!==s.done.filter?Xe(s.done.span,!0):null);for(let t of s.updates)n=n.update(t,i);if(n.hasResult()){e.push(n);continue}}let r=this.view.state.field(xi).active.find((t=>t.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new gi(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:yi.of(e)})}},{eventHandlers:{compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:vi.of(!1)})),20),this.composing=0}}});function Ci(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[xi,ni.of(t),Ai,Ti,si]}const Mi=[{key:"Ctrl-Space",run:t=>!!t.state.field(xi,!1)&&(t.dispatch({effects:vi.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(xi,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:wi.of(null)}),!0)}},{key:"ArrowDown",run:ki(!0)},{key:"ArrowUp",run:ki(!1)},{key:"PageDown",run:ki(!0,"page")},{key:"PageUp",run:ki(!1,"page")},{key:"Enter",run:t=>{let e=t.state.field(xi,!1);return!(!e||!e.open||Date.now()-e.open.timestamp<75)&&(Ze(t,e.open.options[e.open.selected]),!0)}}],Ti=s.Wl.override(n.$f.computeN([ni],(t=>t.facet(ni).defaultKeymap?[Mi]:[])));function Oi(t,e){return i=>{let{state:n,dispatch:s}=i,r=t(e,n.selection.ranges,n);return!!r&&(s(n.update(r)),!0)}}const Pi=Oi(Ii,0),Di=Oi(Ni,0),Ei=[{key:"Mod-/",run:t=>{let e=Ri(t.state);return e.line?Pi(t):!!e.block&&Di(t)}},{key:"Alt-A",run:Di}];function Ri(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.selection.main.head,i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const Li=50;
1function Ni(t,e,i){let n=e.map((t=>Ri(i,t.from).block));if(!n.every((t=>t)))return null;let r=e.map(((t,e)=>function(t,e,i,n){let s,r,{open:o,close:l}=e,h=t.sliceDoc(i-Li,i),a=t.sliceDoc(n,n+Li),c=/\s*$/.exec(h)[0].length,u=/^\s*/.exec(a)[0].length,f=h.length-c;if(h.slice(f-o.length,f)==o&&a.slice(u,u+l.length)==l)return{open:{pos:i-c,margin:c&&1},close:{pos:n+u,margin:u&&1}};n-i<=2*Li?s=r=t.sliceDoc(i,n):(s=t.sliceDoc(i,i+Li),r=t.sliceDoc(n-Li,n));let d=/^\s*/.exec(s)[0].length,p=/\s*$/.exec(r)[0].length,g=r.length-p-l.length;return s.slice(d,d+o.length)==o&&r.slice(g,g+l.length)==l?{open:{pos:i+d+o.length,margin:/\s/.test(s.charAt(d+o.length))?1:0},close:{pos:n-p-l.length,margin:/\s/.test(r.charAt(g-1))?1:0}}:null}(i,n[e],t.from,t.to)));if(2!=t&&!r.every((t=>t))){let t=0;return i.changeByRange((e=>{let{open:i,close:o}=n[t++];if(r[t])return{range:e};let l=i.length+1;return{changes:[{from:e.from,insert:i+" "},{from:e.to,insert:" "+o}],range:s.jT.range(e.anchor+l,e.head+l)}}))}if(1!=t&&r.some((t=>t))){let t=[];for(let e,i=0;i<r.length;i++)if(e=r[i]){let s=n[i],{open:r,close:o}=e;t.push({from:r.pos-s.open.length,to:r.pos+r.margin},{from:o.pos-o.margin,to:o.pos+s.close.length})}return{changes:t}}return null}function Ii(t,e,i){let n=[],s=-1;for(let{from:r,to:o}of e){let t=n.length,e=1e9;for(let l=r;l<=o;){let t=i.doc.lineAt(l);if(t.from>s&&(r==o||o>t.from)){s=t.from;let r=Ri(i,l).line;if(!r)continue;let o=/^\s*/.exec(t.text)[0].length,h=o==t.length,a=t.text.slice(o,o+r.length)==r?o:-1;o<t.text.length&&o<e&&(e=o),n.push({line:t,comment:a,token:r,indent:o,empty:h,single:!1})}l=t.to+1}if(e<1e9)for(let i=t;i<n.length;i++)n[i].indent<n[i].line.text.length&&(n[i].indent=e);n.length==t+1&&(n[t].single=!0)}if(2!=t&&n.some((t=>t.comment<0&&(!t.empty||t.single)))){let t=[];for(let{line:i,token:s,indent:r,empty:o,single:l}of n)!l&&o||t.push({from:i.from+r,insert:s+" "});let e=i.changes(t);return{changes:e,selection:i.selection.map(e,1)}}if(1!=t&&n.some((t=>t.comment>=0))){let t=[];for(let{line:e,comment:i,token:s}of n)if(i>=0){let n=e.from+i,r=n+s.length;" "==e.text[r-e.from]&&r++,t.push({from:n,to:r})}return{changes:t}}return null}const Bi=2e3;function Vi(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(i),s=i-n.from,r=s>Bi?-1:s==n.length?function(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}(t,e.clientX):(0,bt.IS)(n.text.slice(0,i-n.from),0,t.state.tabSize);return{line:n.number,col:r,off:s}}function zi(t,e){let i=Vi(t,e),n=t.state.selection;return i?{update(t){if(t.docChanged){let e=t.changes.mapPos(t.startState.doc.line(i.line).from),s=t.state.doc.lineAt(e);i={line:s.number,col:i.col,off:Math.min(i.off,s.length)},n=n.map(t.changes)}},get(e,r,o){let l=Vi(t,e);if(!l)return n;let h=function(t,e,i){let n=Math.min(e.line,i.line),r=Math.max(e.line,i.line),o=[];if(e.off>Bi||i.off>Bi||e.col<0||i.col<0){let l=Math.min(e.off,i.off),h=Math.max(e.off,i.off);for(let e=n;e<=r;e++){let i=t.doc.line(e);i.length<=h&&o.push(s.jT.range(i.from+l,i.to+h))}}else{let l=Math.min(e.col,i.col),h=Math.max(e.col,i.col);for(let e=n;e<=r;e++){let i=t.doc.line(e),n=(0,bt.Gz)(i.text,l,t.tabSize),r=(0,bt.Gz)(i.text,h,t.tabSize);n<r&&o.push(s.jT.range(i.from+n,i.from+r))}}return o}(t.state,i,l);return h.length?o?s.jT.create(h.concat(n.ranges)):s.jT.create(h):n}}:null}function Hi(t){let e=(null===t||void 0===t?void 0:t.eventFilter)||(t=>t.altKey&&0==t.button);return n.tk.mouseSelectionStyle.of(((t,i)=>e(i)?zi(t,i):null))}var Wi=i(17453);class ji{constructor(t,e,i){this.from=t,this.to=e,this.diagnostic=i}}class _i{constructor(t,e,i){this.diagnostics=t,this.panel=e,this.selected=i}static init(t,e){let i=n.p.set(t.map((t=>t.from<t.to?n.p.mark({attributes:{class:"cm-lintRange cm-lintRange-"+t.severity},diagnostic:t}).range(t.from,t.to):n.p.widget({widget:new en(t),diagnostic:t}).range(t.from))),!0);return new _i(i,e,Fi(i))}}function Fi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=null;return t.between(i,1e9,((t,i,s)=>{let{spec:r}=s;if(!e||r.diagnostic==e)return n=new ji(t,i,r.diagnostic),!1})),n}function qi(t,e,i){return t.field(Gi,!1)?e:e.concat(s.Py.appendConfig.of([Gi.init(i),n.tk.decorations.compute([Gi],(t=>{let{selected:e,panel:i}=t.field(Gi);return e&&i&&e.from!=e.to?n.p.set([Ki.range(e.from,e.to)]):n.p.none})),$e(Yi),on]))}const Qi=s.Py.define(),$i=s.Py.define(),Ui=s.Py.define(),Gi=s.QQ.define({create:()=>new _i(n.p.none,null,null),update(t,e){if(e.docChanged){let i=t.diagnostics.map(e.changes),n=null;if(t.selected){let s=e.changes.mapPos(t.selected.from,1);n=Fi(i,t.selected.diagnostic,s)||Fi(i,null,s)}t=new _i(i,t.panel,n)}for(let i of e.effects)i.is(Qi)?t=_i.init(i.value,t.panel):i.is($i)?t=new _i(t.diagnostics,i.value?sn.open:null,t.selected):i.is(Ui)&&(t=new _i(t.diagnostics,t.panel,i.value));return t},provide:t=>[qt.from(t,(t=>t.panel)),n.tk.decorations.from(t,(t=>t.diagnostics))]}),Ki=n.p.mark({class:"cm-lintRange cm-lintRange-active"});function Yi(t,e,i){let{diagnostics:n}=t.state.field(Gi),s=[],r=2e8,o=0;return n.between(e-(i<0?1:0),e+(i>0?1:0),((t,n,l)=>{let{spec:h}=l;e>=t&&e<=n&&(t==n||(e>t||i>0)&&(e<n||i<0))&&(s.push(h.diagnostic),r=Math.min(t,r),o=Math.max(n,o))})),s.length?{pos:r,end:o,above:t.state.doc.lineAt(r).to<o,create:()=>({dom:Qt("ul",{class:"cm-tooltip-lint"},s.map((e=>tn(t,e,!1))))})}:null}const Ji=t=>{let e=t.state.field(Gi,!1);return!(!e||!e.panel)&&(t.dispatch({effects:$i.of(!1)}),!0)}
1,Xi=[{key:"Mod-Shift-m",run:t=>{let e=t.state.field(Gi,!1);e&&e.panel||t.dispatch({effects:qi(t.state,[$i.of(!0)],(()=>_i.init([],sn.open)))});let i=Ht(t,sn.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0}},{key:"F8",run:t=>{let e=t.state.field(Gi,!1);if(!e)return!1;let i=t.state.selection.main,n=e.diagnostics.iter(i.to+1);return!(!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==i.from&&n.to==i.to))&&(t.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)}}];function Zi(t){let e=[];if(t)t:for(let{name:i}of t){for(let t=0;t<i.length;t++){let n=i[t];if(/[a-zA-Z]/.test(n)&&!e.some((t=>t.toLowerCase()==n.toLowerCase()))){e.push(n);continue t}}e.push("")}return e}function tn(t,e,i){var n;let s=i?Zi(e.actions):[];return Qt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Qt("span",{class:"cm-diagnosticText"},e.message),null===(n=e.actions)||void 0===n?void 0:n.map(((i,n)=>{let r=n=>{n.preventDefault();let s=Fi(t.state.field(Gi).diagnostics,e);s&&i.apply(t,s.from,s.to)},{name:o}=i,l=s[n]?o.indexOf(s[n]):-1,h=l<0?o:[o.slice(0,l),Qt("u",o.slice(l,l+1)),o.slice(l+1)];return Qt("button",{class:"cm-diagnosticAction",onclick:r,onmousedown:r,"aria-label":" Action: ".concat(o).concat(l<0?"":' (access key "'.concat(s[n],')"'),".")},h)})),e.source&&Qt("div",{class:"cm-diagnosticSource"},e.source))}class en extends n.l9{constructor(t){super(),this.diagnostic=t}eq(t){return t.diagnostic==this.diagnostic}toDOM(){return Qt("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class nn{constructor(t,e){this.diagnostic=e,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=tn(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class sn{constructor(t){this.view=t,this.items=[];this.list=Qt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:e=>{if(27==e.keyCode)Ji(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:i}=this.items[this.selectedIndex],n=Zi(i.actions);for(let s=0;s<n.length;s++)if(n[s].toUpperCase().charCodeAt(0)==e.keyCode){let e=Fi(this.view.state.field(Gi).diagnostics,i);e&&i.actions[s].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=Qt("div",{class:"cm-panel-lint"},this.list,Qt("button",{name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Ji(this.view)},"\xd7")),this.update()}get selectedIndex(){let t=this.view.state.field(Gi).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(Gi),i=0,n=!1,s=null;for(t.between(0,this.view.state.doc.length,((t,r,o)=>{let l,{spec:h}=o,a=-1;for(let e=i;e<this.items.length;e++)if(this.items[e].diagnostic==h.diagnostic){a=e;break}a<0?(l=new nn(this.view,h.diagnostic),this.items.splice(i,0,l),n=!0):(l=this.items[a],a>i&&(this.items.splice(i,a-i),n=!0)),e&&l.diagnostic==e.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),s=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),i++}));i<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)n=!0,this.items.pop();0==this.items.length&&(this.items.push(new nn(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),n=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:t=>{let{sel:e,panel:i}=t;e.top<i.top?this.list.scrollTop-=i.top-e.top:e.bottom>i.bottom&&(this.list.scrollTop+=e.bottom-i.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),n&&this.sync()}sync(){let t=this.list.firstChild;function e(){let e=t;t=e.nextSibling,e.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;t!=i.dom;)e();t=i.dom.nextSibling}else this.list.insertBefore(i.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=Fi(this.view.state.field(Gi).diagnostics,this.items[t].diagnostic);e&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:Ui.of(e)})}static open(t){return new sn(t)}}function rn(t){if("function"!=typeof btoa)return"none";let e='<svg xmlns="http://www.w3.org/2000/svg" width="6" height="3">\n <path d="m0 3 l2 -2 l1 0 l2 2 l1 0" stroke="'.concat(t,'" fill="none" stroke-width=".7"/>\n </svg>');
1return"url('data:image/svg+xml;base64,".concat(btoa(e),"')")}const on=n.tk.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-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x"},".cm-lintRange-error":{backgroundImage:rn("#d11")},".cm-lintRange-warning":{backgroundImage:rn("orange")},".cm-lintRange-info":{backgroundImage:rn("#999")},".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-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}}}),ln=[K(),Z(),(0,n.AE)(),c(),mt(),(0,n.Uw)(),s.yy.allowMultipleSelections.of(!0),(0,O.nY)(),Wi.R_.fallback,(0,yt.n)(),Mt(),Ci(),Hi(),(0,n.ZO)(),le(),n.$f.of([...Et,...wt.wQ,...Le,...T,...at,...Ei,...Mi,...Xi])]},75453:(t,e,i)=>{i.d(e,{s1:()=>lt,wQ:()=>ot});var n=i(89933),s=i(78528),r=i(32725),o=i(25877),l=i(92649),h=i(23129);function a(t,e){return n.jT.create(t.ranges.map(e),t.mainIndex)}function c(t,e){return t.update({selection:e,scrollIntoView:!0,annotations:n.YW.userEvent.of("keyboardselection")})}function u(t,e){let{state:i,dispatch:n}=t,s=a(i.selection,e);return!s.eq(i.selection)&&(n(c(i,s)),!0)}function f(t,e){return n.jT.cursor(e?t.to:t.from)}function d(t,e){return u(t,(i=>i.empty?t.moveByChar(i,e):f(i,e)))}const p=t=>d(t,t.textDirection!=r.Nm.LTR),g=t=>d(t,t.textDirection==r.Nm.LTR);function m(t,e){return u(t,(i=>i.empty?t.moveByGroup(i,e):f(i,e)))}function v(t,e,i){if(e.type.prop(i))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function w(t,e,i){let s,r,a=(0,l.qz)(t).resolve(e.head),c=i?h.md.closedBy:h.md.openedBy;for(let n=e.head;;){let e=i?a.childAfter(n):a.childBefore(n);if(!e)break;v(t,e,c)?a=e:n=i?e.to:e.from}return r=a.type.prop(c)&&(s=i?(0,o.U)(t,a.from,1):(0,o.U)(t,a.to,-1))&&s.matched?i?s.end.to:s.end.from:i?a.to:a.from,n.jT.cursor(r,i?-1:1)}function y(t,e){return u(t,(i=>i.empty?t.moveVertically(i,e):f(i,e)))}const b=t=>y(t,!1),x=t=>y(t,!0);function k(t,e){return u(t,(i=>i.empty?t.moveVertically(i,e,t.dom.clientHeight):f(i,e)))}const S=t=>k(t,!1),A=t=>k(t,!0);function C(t,e,i){let s=t.visualLineAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?s.to:s.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==s.from&&s.length){let i=/^\s*/.exec(t.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;i&&e.head!=s.from+i&&(r=n.jT.cursor(s.from+i))}return r}const M=t=>u(t,(e=>C(t,e,!0))),T=t=>u(t,(e=>C(t,e,!1)));function O(t,e,i){let s=!1,r=a(t.selection,(e=>{let r=(0,o.U)(t,e.head,-1)||(0,o.U)(t,e.head,1)||e.head>0&&(0,o.U)(t,e.head-1,1)||e.head<t.doc.length&&(0,o.U)(t,e.head+1,-1);if(!r||!r.end)return e;s=!0;let l=r.start.from==e.head?r.end.to:r.end.from;return i?n.jT.range(e.anchor,l):n.jT.cursor(l)}));return!!s&&(e(c(t,r)),!0)}function P(t,e){let i=a(t.state.selection,(t=>{let i=e(t);return n.jT.range(t.anchor,i.head,i.goalColumn)}));return!i.eq(t.state.selection)&&(t.dispatch(c(t.state,i)),!0)}function D(t,e){return P(t,(i=>t.moveByChar(i,e)))}const E=t=>D(t,t.textDirection!=r.Nm.LTR),R=t=>D(t,t.textDirection==r.Nm.LTR);function L(t,e){return P(t,(i=>t.moveByGroup(i,e)))}function N(t,e){return P(t,(i=>t.moveVertically(i,e)))}const I=t=>N(t,!1),B=t=>N(t,!0);function V(t,e){return P(t,(i=>t.moveVertically(i,e,t.dom.clientHeight)))}const z=t=>V(t,!1),H=t=>V(t,!0),W=t=>P(t,(e=>C(t,e,!0))),j=t=>P(t,(e=>C(t,e,!1))),_=t=>{let{state:e,dispatch:i}=t;return i(c(e,{anchor:0})),!0},F=t=>{let{state:e,dispatch:i}=t;return i(c(e,{anchor:e.doc.length})),!0},q=t=>{let{state:e,dispatch:i}=t;return i(c(e,{anchor:e.selection.main.anchor,head:0})),!0},Q=t=>{let{state:e,dispatch:i}=t;return i(c(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0};function $(t,e){let{state:i,dispatch:s}=t,r=i.changeByRange((t=>{let{from:i,to:s}=t;if(i==s){let t=e(i);i=Math.min(i,t),s=Math.max(s,t)}return i==s?{range:t}:{changes:{from:i,to:s},range:n.jT.cursor(i)}}));return!r.changes.empty&&(s(i.update(r,{scrollIntoView:!0,annotations:n.YW.userEvent.of("delete")})),!0)}const U=(t,e,i)=>$(t,(n=>{let r,o,{state:h}=t,a=h.doc.lineAt(n);if(!e&&n>a.from&&n<a.from+200&&!/[^ \t]/.test(r=a.text.slice(0,n-a.from))){if("\t"==r[r.length-1])return n-1;let t=(0,s.IS)(r,0,h.tabSize)%(0,l.y1)(h)||(0,l.y1)(h);for(let e=0;e<t&&" "==r[r.length-1-e];e++)n--;return n}if(i){let t=a.text.slice(n-a.from+(e?0:-2),n-a.from+(e?2:0)),i=t?(0,s.nZ)((0,s.gm)(t,0)):1;o=e?Math.min(h.doc.length,n+i):Math.max(0,n-i)}else o=(0,s.cp)(a.text,n-a.from,e)+a.from;return o==n&&a.number!=(e?h.doc.lines:1)&&(o+=e?1:-1),o})),G=t=>U(t,!1,!0),K=t=>U(t,!0,!1),Y=(t,e)=>$(t,(i=>{let n=i,{state:r}=t,o=r.doc.lineAt(n),l=r.charCategorizer(n);for(let t=null;;){if(n==(e?o.to:o.from)){n==i&&o.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let h=(0,s.cp)(o.text,n-o.from,e)+o.from,a=o.text.slice(Math.min(n,h)-o.from,Math.max(n,h)-o.from),c=l(a);if(null!=t&&c!=t)break;" "==a&&n==i||(t=c),n=h}return n})),J=t=>Y(t,!1),X=t=>Y(t,!0),Z=t=>$(t,(e=>{let i=t.visualLineAt(e).to;return e<i?i:Math.min(t.state.doc.length,e+1)}));function tt(t){let e=[],i=-1;for(let n of t.selection.ranges){let s=t.doc.lineAt(n.from),r=t.doc.lineAt(n.to);if(n.empty||n.to!=r.from||(r=t.doc.lineAt(n.to-1)),i>=s.number){let t=e[e.length-1];t.to=r.to,t.ranges.push(n)}else e.push({from:s.from,to:r.to,ranges:[n]});i=r.number+1}return e}function et(t,e,i){let s=[],r=[];for(let o of tt(t)){if(i?o.to==t.doc.length:0==o.from)continue;let e=t.doc.lineAt(i?o.to+1:o.from-1),l=e.length+1;if(i){s.push({from:o.to,to:e.to},{from:o.from,insert:e.text+t.lineBreak});for(let e of o.ranges)r.push(n.jT.range(Math.min(t.doc.length,e.anchor+l),Math.min(t.doc.length,e.head+l)))}else{s.push({from:e.from,to:o.from},{from:o.to,insert:t.lineBreak+e.text});for(let t of o.ranges)r.push(n.jT.range(t.anchor-l,t.head-l))}}return!!s.length&&(e(t.update({changes:s,scrollIntoView:!0,selection:n.jT.create(r,t.selection.mainIndex)})),!0)}function it(t,e,i){let n=[];for(let s of tt(t))i?n.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):n.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});return e(t.update({changes:n,scrollIntoView:!0})),!0}function nt(t,e){let i=-1;return t.changeByRange((s=>{let r=[];for(let n=s.from;n<=s.to;){let o=t.doc.lineAt(n);o.number>i&&(s.empty||s.to>o.from)&&(e(o,r,s),i=o.number),n=o.to+1}let o=t.changes(r);return{changes:r,range:n.jT.range(o.mapPos(s.anchor,1),o.mapPos(s.head,1))}}))}const st=t=>{let{state:e,dispatch:i}=t,n=Object.create(null),s=new l.Gn(e,{overrideIndentation:t=>{let e=n[t];return null==e?-1:e}}),r=nt(e,((t,i,r)=>{let o=(0,l.K0)(s,t.from);if(null==o)return;let h=/^\s*/.exec(t.text)[0],a=(0,l.SS)(e,o);(h!=a||r.from<t.from+h.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+h.length,insert:a}))}));return r.changes.empty||i(e.update(r)),!0},rt=t=>{let{state:e,dispatch:i}=t;return i(e.update(nt(e,((t,i)=>{i.push({from:t.from,insert:e.facet(l.c)})})))),!0},ot=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>u(t,(e=>
1w(t.state,e,t.textDirection!=r.Nm.LTR))),shift:t=>P(t,(e=>w(t.state,e,t.textDirection!=r.Nm.LTR)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>u(t,(e=>w(t.state,e,t.textDirection==r.Nm.LTR))),shift:t=>P(t,(e=>w(t.state,e,t.textDirection==r.Nm.LTR)))},{key:"Alt-ArrowUp",run:t=>{let{state:e,dispatch:i}=t;return et(e,i,!1)}},{key:"Shift-Alt-ArrowUp",run:t=>{let{state:e,dispatch:i}=t;return it(e,i,!1)}},{key:"Alt-ArrowDown",run:t=>{let{state:e,dispatch:i}=t;return et(e,i,!0)}},{key:"Shift-Alt-ArrowDown",run:t=>{let{state:e,dispatch:i}=t;return it(e,i,!0)}},{key:"Escape",run:t=>{let{state:e,dispatch:i}=t,s=e.selection,r=null;return s.ranges.length>1?r=n.jT.create([s.main]):s.main.empty||(r=n.jT.create([n.jT.cursor(s.main.head)])),!!r&&(i(c(e,r)),!0)}},{key:"Alt-l",mac:"Ctrl-l",run:t=>{let{state:e,dispatch:i}=t,s=tt(e).map((t=>{let{from:i,to:s}=t;return n.jT.range(i,Math.min(s+1,e.doc.length))}));return i(e.update({selection:n.jT.create(s),annotations:n.YW.userEvent.of("keyboardselection")})),!0}},{key:"Mod-i",run:t=>{let{state:e,dispatch:i}=t,s=a(e.selection,(t=>{var i;let s=(0,l.qz)(e).resolve(t.head,1);for(;!(s.from<t.from&&s.to>=t.to||s.to>t.to&&s.from<=t.from)&&(null===(i=s.parent)||void 0===i?void 0:i.parent);)s=s.parent;return n.jT.range(s.to,s.from)}));return i(c(e,s)),!0},preventDefault:!0},{key:"Mod-[",run:t=>{let{state:e,dispatch:i}=t;return i(e.update(nt(e,((t,i)=>{let n=/^\s*/.exec(t.text)[0];if(!n)return;let r=(0,s.IS)(n,0,e.tabSize),o=0,h=(0,l.SS)(e,Math.max(0,r-(0,l.y1)(e)));for(;
1o<n.length&&o<h.length&&n.charCodeAt(o)==h.charCodeAt(o);)o++;i.push({from:t.from+o,to:t.from+n.length,insert:h.slice(o)})})))),!0}},{key:"Mod-]",run:rt},{key:"Mod-Alt-\\",run:st},{key:"Shift-Mod-k",run:t=>{let{state:e}=t,i=e.changes(tt(e).map((t=>{let{from:i,to:n}=t;return i>0?i--:n<e.doc.length&&n++,{from:i,to:n}}))),n=a(e.selection,(e=>t.moveVertically(e,!0))).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0}),!0}},{key:"Shift-Mod-\\",run:t=>{let{state:e,dispatch:i}=t;return O(e,i,!1)}}].concat([{key:"ArrowLeft",run:p,shift:E,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>m(t,t.textDirection!=r.Nm.LTR),shift:t=>L(t,t.textDirection!=r.Nm.LTR)},{mac:"Cmd-ArrowLeft",run:T,shift:j},{key:"ArrowRight",run:g,shift:R,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>m(t,t.textDirection==r.Nm.LTR),shift:t=>L(t,t.textDirection==r.Nm.LTR)},{mac:"Cmd-ArrowRight",run:M,shift:W},{key:"ArrowUp",run:b,shift:I,preventDefault:!0},{mac:"Cmd-ArrowUp",run:_,shift:q},{mac:"Ctrl-ArrowUp",run:S,shift:z},{key:"ArrowDown",run:x,shift:B,preventDefault:!0},{mac:"Cmd-ArrowDown",run:F,shift:Q},{mac:"Ctrl-ArrowDown",run:A,shift:H},{key:"PageUp",run:S,shift:z},{key:"PageDown",run:A,shift:H},{key:"Home",run:T,shift:j},{key:"Mod-Home",run:_,shift:q},{key:"End",run:M,shift:W},{key:"Mod-End",run:F,shift:Q},{key:"Enter",run:t=>{let{state:e,dispatch:i}=t,r=e.changeByRange((t=>{let{from:i,to:r}=t,o=i==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=(0,l.qz)(t).resolve(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(h.md.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(e,i),a=new l.Gn(e,{simulateBreak:i,simulateDoubleBreak:!!o}),c=(0,l.K0)(a,i);null==c&&(c=/^\s*/.exec(e.doc.lineAt(i).text)[0].length);let u=e.doc.lineAt(i);for(;r<u.to&&/\s/.test(u.text.slice(r-u.from,r+1-u.from));)r++;o?({from:i,to:r}=o):i>u.from&&i<u.from+100&&!/\S/.test(u.text.slice(0,i))&&(i=u.from);let f=["",(0,l.SS)(e,c)];return o&&f.push((0,l.SS)(e,a.lineIndent(u))),{changes:{from:i,to:r,insert:s.xv.of(f)},range:n.jT.cursor(i+1+f[1].length)}}));return i(e.update(r,{scrollIntoView:!0})),!0}},{key:"Mod-a",run:t=>{let{state:e,dispatch:i}=t;return i(e.update({selection:{anchor:0,head:e.doc.length},annotations:n.YW.userEvent.of("keyboardselection")})),!0}},{key:"Backspace",run:G,shift:G},{key:"Delete",run:K,shift:K},{key:"Mod-Backspace",mac:"Alt-Backspace",run:J},{key:"Mod-Delete",mac:"Alt-Delete",run:X},{mac:"Mod-Backspace",run:t=>$(t,(e=>{let i=t.visualLineAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Z}].concat([{key:"Ctrl-b",run:p,shift:E,preventDefault:!0},{key:"Ctrl-f",run:g,shift:R},{key:"Ctrl-p",run:b,shift:I},{key:"Ctrl-n",run:x,shift:B},{key:"Ctrl-a",run:t=>u(t,(e=>n.jT.cursor(t.visualLineAt(e.head).from,1))),shift:t=>P(t,(e=>n.jT.cursor(t.visualLineAt(e.head).from)))},{key:"Ctrl-e",run:t=>u(t,(e=>n.jT.cursor(t.visualLineAt(e.head).to,-1))),shift:t=>P(t,(e=>
1n.jT.cursor(t.visualLineAt(e.head).to)))},{key:"Ctrl-d",run:K},{key:"Ctrl-h",run:t=>U(t,!1,!1)},{key:"Ctrl-k",run:Z},{key:"Alt-d",run:X},{key:"Ctrl-Alt-h",run:J},{key:"Ctrl-o",run:t=>{let{state:e,dispatch:i}=t,r=e.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:s.xv.of(["",""])},range:n.jT.cursor(t.from)})));return i(e.update(r,{scrollIntoView:!0,annotations:n.YW.userEvent.of("input")})),!0}},{key:"Ctrl-t",run:t=>{let{state:e,dispatch:i}=t,r=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let i=t.from,r=e.doc.lineAt(i),o=i==r.from?i-1:(0,s.cp)(r.text,i-r.from,!1)+r.from,l=i==r.to?i+1:(0,s.cp)(r.text,i-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:e.doc.slice(i,l).append(e.doc.slice(o,i))},range:n.jT.cursor(l)}}));return!r.changes.empty&&(i(e.update(r,{scrollIntoView:!0})),!0)}},{key:"Alt-f",run:t=>m(t,!0),shift:t=>L(t,!0)},{key:"Alt-b",run:t=>m(t,!1),shift:t=>L(t,!1)},{key:"Alt-<",run:_},{key:"Alt->",run:F},{key:"Ctrl-v",run:A},{key:"Alt-v",run:S}].map((t=>({mac:t.key,run:t.run,shift:t.shift}))))),lt={key:"Tab",run:t=>{let{state:e,dispatch:i}=t;return e.selection.ranges.some((t=>!t.empty))?rt({state:e,dispatch:i}):(i(e.update(e.replaceSelection("\t"),{scrollIntoView:!0,annotations:n.YW.userEvent.of("input")})),!0)},shift:st}},17453:(t,e,i)=>{i.d(e,{Gv:()=>p,R_:()=>j,pJ:()=>W});var n=i(23129),s=i(28335),r=i(32725),o=i(89933),l=i(92649),h=i(98759);let a=0;class c{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=a++}static define(t){if(null===t||void 0===t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new c([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new f;return e=>e.modified.indexOf(t)>-1?e:f.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let u=0;class f{constructor(){this.instances=[],this.id=u++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find((i=>{return i.base==t&&(n=e,s=i.modified,n.length==s.length&&n.every(((t,e)=>t==s[e])));var n,s}));if(i)return i;let n=[],s=new c(n,t,e);for(let o of e)o.instances.push(s);let r=d(e);for(let o of t.set)for(let t of r)n.push(f.get(o,t));return s}}function d(t){let e=[t];for(let i=0;i<t.length;i++)for(let n of d(t.slice(0,i).concat(t.slice(i+1))))e.push(n);return e}function p(t){let e=Object.create(null);for(let i in t){let n=t[i];Array.isArray(n)||(n=[n]);for(let t of i.split(" "))if(t){let i=[],s=2,r=t;for(let e=0;;){if("..."==r&&e>0&&e+3==t.length){s=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!n)throw new RangeError("Invalid path: "+t);if(i.push("*"==n[0]?null:'"'==n[0][0]?JSON.parse(n[0]):n[0]),e+=n[0].length,e==t.length)break;let o=t[e++];if(e==t.length&&"!"==o){s=0;break}if("/"!=o)throw new RangeError("Invalid path: "+t);r=t.slice(e)}let o=i.length-1,l=i[o];if(!l)throw new RangeError("Invalid path: "+t);let h=new y(n,s,o>0?i.slice(0,o):null);e[l]=h.sort(e[l])}}return g.add(e)}const g=new n.md,m=o.r$.define({combine:t=>t.length?b.combinedMatch(t):null}),v=o.r$.define({combine:t=>t.length?t[0].match:null});function w(t){return t.facet(m)||t.facet(v)}class y{constructor(t,e,i,n){this.tags=t,this.mode=e,this.context=i,this.next=n}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}}class b{constructor(t,e){let i;function n(t){let e=s.V.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.map=Object.create(null),this.all="string"==typeof e.all?e.all:e.all?n(e.all):null;for(let s of t){let t=(s.class||n(Object.assign({},s,{tag:null})))+(this.all?" "+this.all:""),e=s.tag;if(Array.isArray(e))for(let i of e)this.map[i.id]=t;else this.map[e.id]=t}this.module=i?new s.V(i):null,this.scope=e.scope||null,this.match=this.match.bind(this);let o=[k];this.module&&o.push(r.tk.styleModule.of(this.module)),this.extension=o.concat(m.of(this)),this.fallback=o.concat(v.of(this))}match(t,e){if(this.scope&&e!=this.scope)return null;for(let i of t.set){let e=this.map[i.id];if(void 0!==e)return i!=t&&(this.map[t.id]=e),e}return this.map[t.id]=this.all}static combinedMatch(t){if(1==t.length)return t[0].match;let e=t.some((t=>t.scope))?void 0:Object.create(null);return(i,n)=>{let s=e&&e[i.id];if(void 0!==s)return s;let r=null;for(let e of t){let t=e.match(i,n);t&&(r=r?r+" "+t:t)}return e&&(e[i.id]=r),r}}static define(t,e){return new b(t,e||{})}static get(t,e,i){let s=w(t);return s&&s(e,i||n.Jq.none)}}class x{constructor(t){this.markCache=Object.create(null),this.tree=(0,l.qz)(t.state),this.decorations=this.buildDeco(t,w(t.state))}update(t){let e=(0,l.qz)(t.state),i=w(t.state),n=i!=t.startState.facet(m);e.length<t.view.viewport.to&&!n?this.decorations=this.decorations.map(t.changes):(e!=this.tree||t.viewportChanged||n)&&(this.tree=e,this.decorations=this.buildDeco(t.view,i))}buildDeco(t,e){if(!e||!this.tree.length)return r.p.none;let i=new h.f_;for(let{from:n,to:s}
1of t.visibleRanges)A(this.tree,n,s,e,((t,e,n)=>{i.add(t,e,this.markCache[n]||(this.markCache[n]=r.p.mark({class:n})))}));return i.finish()}}const k=o.Wl.fallback(r.lg.fromClass(x,{decorations:t=>t.decorations})),S=[""];function A(t,e,i,n,s){let r=e,o="",l=t.topNode.cursor;function h(t,e){o&&s(r,t,o),r=t,o=e}!function t(s,r,a){let{type:c,from:u,to:f}=l;if(u>=i||f<=e)return;S[r]=c.name,c.isTop&&(a=c);let d=s,p=c.prop(g),m=!1;for(;p;){if(!p.context||C(p.context,S,r)){for(let t of p.tags){let e=n(t,a);e&&(d&&(d+=" "),d+=e,1==p.mode?s+=(s?" ":"")+e:0==p.mode&&(m=!0))}break}p=p.next}let v=u;if(!m&&l.firstChild()){do{l.from>v&&o!=d&&h(v,d),v=l.to,t(s,r+1,a)}while(l.nextSibling());l.parent()}f>v&&o!=d&&h(v,d)}("",0,t.type),h(i,"")}function C(t,e,i){if(t.length>i-1)return!1;for(let n=i-1,s=t.length-1;s>=0;s--,n--){let i=t[s];if(i&&i!=e[n])return!1}return!0}const M=c.define,T=M(),O=M(),P=M(O),D=M(),E=M(D),R=M(D),L=M(),N=M(L),I=M(),B=M(),V=M(),z=M(V),H=M(),W={comment:T,lineComment:M(T),blockComment:M(T),docComment:M(T),name:O,variableName:M(O),typeName:P,tagName:M(P),propertyName:M(O),className:M(O),labelName:M(O),namespace:M(O),macroName:M(O),literal:D,string:E,docString:M(E),character:M(E),number:R,integer:M(R),float:M(R),bool:M(D),regexp:M(D),escape:M(D),color:M(D),url:M(D),keyword:I,self:M(I),null:M(I),atom:M(I),unit:M(I),modifier:M(I),operatorKeyword:M(I),controlKeyword:M(I),definitionKeyword:M(I),operator:B,derefOperator:M(B),arithmeticOperator:M(B),logicOperator:M(B),bitwiseOperator:M(B),compareOperator:M(B),updateOperator:M(B),definitionOperator:M(B),typeOperator:M(B),controlOperator:M(B),punctuation:V,separator:M(V),bracket:z,angleBracket:M(z),squareBracket:M(z),paren:M(z),brace:M(z),content:L,heading:N,heading1:M(N),heading2:M(N),heading3:M(N),heading4:M(N),heading5:M(N),heading6:M(N),contentSeparator:M(L),list:M(L),quote:M(L),emphasis:M(L),strong:M(L),link:M(L),monospace:M(L),strikethrough:M(L),inserted:M(),deleted:M(),changed:M(),invalid:M(),meta:H,documentMeta:M(H),annotation:M(H),processingInstruction:M(H),definition:c.defineModifier(),constant:c.defineModifier(),function:c.defineModifier(),standard:c.defineModifier(),local:c.defineModifier(),special:c.defineModifier()},j=b.define([{tag:W.link,textDecoration:"underline"},{tag:W.heading,textDecoration:"underline",fontWeight:"bold"},{tag:W.emphasis,fontStyle:"italic"},{tag:W.strong,fontWeight:"bold"},{tag:W.strikethrough,textDecoration:"line-through"},{tag:W.keyword,color:"#708"},{tag:[W.atom,W.bool,W.url,W.contentSeparator,W.labelName],color:"#219"},{tag:[W.literal,W.inserted],color:"#164"},{tag:[W.string,W.deleted],color:"#a11"},{tag:[W.regexp,W.escape,W.special(W.string)],color:"#e40"},{tag:W.definition(W.variableName),color:"#00f"},{tag:W.local(W.variableName),color:"#30a"},{tag:[W.typeName,W.namespace],color:"#085"},{tag:W.className,color:"#167"},{tag:[W.special(W.variableName),W.macroName],color:"#256"},{tag:W.definition(W.propertyName),color:"#00c"},{tag:W.comment,color:"#940"},{tag:W.meta,color:"#7a757a"},{tag:W.invalid,color:"#f00"}]);W.link,W.heading,W.emphasis,W.strong,W.keyword,W.atom,W.bool,W.url,W.labelName,W.inserted,W.deleted,W.literal,W.string,W.number,W.regexp,W.escape,W.string,W.variableName,W.variableName,W.variableName,W.variableName,W.typeName,W.namespace,W.macroName,W.propertyName,W.operator,W.comment,W.meta,W.invalid,W.punctuation},83998:(t,e,i)=>{i.d(e,{AV:()=>D});var n,s=i(23129);class r{constructor(t,e,i,n,s,r,o,l,h,a){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=l,this.curContext=h,this.parent=a}toString(){return"[".concat(this.stack.filter(((t,e)=>e%3==0)).concat(this.state),"]@").concat(this.pos).concat(this.score?"!"+this.score:"")}static start(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=t.parser.context;return new r(t,[],e,i,i,0,[],0,n?new o(n,n.start):null,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){let e=t>>19,i=65535&t,{parser:n}=this.p,s=n.dynamicPrecedence(i);if(s&&(this.score+=s),0==e)return i<n.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,4,!0),this.pushState(n.getGoto(this.state,i,!0),this.reducePos),void this.reduceContext(i);let r=this.stack.length-3*(e-1)-(262144&t?6:0),o=this.stack[r-2],l=this.stack[r-1],h=this.bufferBase+this.buffer.length-l;if(i<n.minRepeatTerm||131072&t){let t=n.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,o,t,h+4,!0)}if(262144&t)this.state=this.stack[r];else{let t=this.stack[r-3];this.state=n.getGoto(t,i,!0)}for(;this.stack.length>r;)this.stack.pop();this.reduceContext(i)}storeNode(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(0==t){let t=this,n=this.buffer.length;if(0==n&&t.parent&&(n=t.bufferBase-t.parent.bufferBase,t=t.parent),n>0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let n=this.pos,s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),e<=r.maxNode&&this.buffer.push(e,n,i,4),this.shiftContext(e)}else e<=this.p.parser.maxNode&&this.buffer.push(e,this.pos,i,4),this.pos=i}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this.p.input,this))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new r(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=200}canShift(t){for(let e=new l(this);;){let i=this.p.parser.stateSlot(e.top,4)||this.p.parser.hasAction(e.top,t);if(0==(65536&i))return!0;
1if(0==i)return!1;e.reduce(i)}}get ruleStart(){for(let t=this.state,e=this.stack.length;;){let i=this.p.parser.stateSlot(t,5);if(!(65536&i))return 0;if(e-=3*(i>>19),(65535&i)<this.p.parser.minRepeatTerm)return this.stack[e+1];t=this.stack[e]}}startOf(t,e){let i=this.state,n=this.stack.length,{parser:s}=this.p;for(;;){let r=s.stateSlot(i,5),o=r>>19,l=65535&r;if(t.indexOf(l)>-1){let t=n-3*(r>>19),i=this.stack[t+1];if(null==e||e>i)return i}if(0==n)return null;0==o?(n-=3,i=this.stack[n]):(n-=3*(o-1),i=s.getGoto(this.stack[n-3],l,!0))}}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 i=[];for(let n,s=0;s<e.length;s+=2)(n=e[s+1])!=this.state&&this.p.parser.hasAction(n,t)&&i.push(e[s],n);if(this.stack.length<120)for(let t=0;i.length<8&&t<e.length;t+=2){let n=e[t+1];i.some(((t,e)=>1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let n=0;n<e.length&&i.length<4;n+=2){let t=e[n+1];if(t==this.state)continue;let s=this.split();s.storeNode(0,s.pos,s.pos,4,!0),s.pushState(t,this.pos),s.shiftContext(e[n]),s.score-=200,i.push(s)}return i}forceReduce(){let t=this.p.parser.stateSlot(this.state,5);return 0!=(65536&t)&&(this.p.parser.validAction(this.state,t)||(this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100),this.reduce(t),!0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2)&&this.forceReduce(););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.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){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this.p.input,this))}reduceContext(t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this.p.input,this))}emitContext(){let t=this.curContext;if(!t.tracker.strict)return;let e=this.buffer.length-1;(e<0||-2!=this.buffer[e])&&this.buffer.push(t.hash,this.reducePos,this.reducePos,-2)}updateContext(t){if(t!=this.curContext.context){let e=new o(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}}class o{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.hash(e)}}!function(t){t[t.Token=200]="Token",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth"}(n||(n={}));class l{constructor(t){this.stack=t,this.top=t.state,this.rest=t.stack,this.offset=this.rest.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.rest==this.stack.stack&&(this.rest=this.rest.slice()),this.rest.push(this.top,0,0),this.offset+=3):this.offset-=3*(i-1);let n=this.stack.p.parser.getGoto(this.rest[this.offset-3],e,!0);this.top=n}}class h{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t){return new h(t,t.bufferBase+t.buffer.length,t.buffer.length)}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 h(this.stack,this.pos,this.index)}}class a{constructor(){this.start=-1,this.value=-1,this.end=-1}accept(t,e){this.value=t,this.end=e}}class c{constructor(t,e){this.data=t,this.id=e}token(t,e,i){!function(t,e,i,n,s){let r=0,o=1<<s,l=n.p.parser.dialect;t:for(let h=i.start;0!=(o&t[r]);){let s=t[r+1];for(let e=r+3;e<s;e+=2)if((t[e+1]&o)>0){let s=t[e];if(l.allows(s)&&(-1==i.value||i.value==s||n.p.parser.overrides(s,i.value))){i.accept(s,h);break}}let a=e.get(h++);for(let e=0,i=t[r+2];e<i;){let n=e+i>>1,o=s+n+(n<<1),l=t[o],h=t[o+1];if(a<l)i=n;else{if(!(a>=h)){r=t[o+2];continue t}e=n+1}}break}}(this.data,t,e,i,this.id)}}c.prototype.contextual=c.prototype.fallback=c.prototype.extend=!1;function u(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Uint16Array;if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n<t.length;){let r=0;for(;;){let e=t.charCodeAt(n++),i=!1;if(126==e){r=65535;break}e>=92&&e--,e>=34&&e--;let s=e-32;if(s>
1=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}const f="undefined"!=typeof process&&/\bparse\b/.test({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_FCM_API_KEY:"AIzaSyDh8nbQws1ViQAoozn4ja0wNbn47tITIXs",REACT_APP_HOST_URL:"https://www.app.aisensy.com",REACT_APP_MIXPANEL_TOKEN:"45086d156acd1778afc04ec7e0c94950",REACT_APP_ADS_MFE_REMOTE_URL:"https://www.aiads.aisensy.com/remoteEntry.js",REACT_APP_PAYU_RESELLER_ID:"11ee-09da-4deae48c-9523-0a696b110fde",REACT_APP_CHARGEBEE_SITE_NAME:"aisensy",REACT_APP_MEDIA_LIBRARY_CF_URL:"https://d3jt6ku4g6z5l8.cloudfront.net",REACT_APP_INTERCOM_APP_ID:"g4xf4bna",REACT_APP_TAPFILIATE_ACCOUNT_ID:"23498-252db1",REACT_APP_SEGMENT_WRITE_KEY:"7plNOQEcWheaMDkqD2xMCi3IMhpVaz7e",REACT_APP_FCM_SENDER_ID:"909070779131",REACT_APP_CHARGEBEE_API_KEY:"live_QtTCVcBnCkrMOgXhMCMLNttIsS98R7SM",REACT_APP_FREE_AD_CREDIT_INR:"1000",REACT_APP_GOOGLE_KEY:"6Lewx2MkAAAAAPIP-2tn1NIeBnhFoO3bX2QdKI90 ",REACT_APP_MODE:"production",REACT_APP_VAPID_KEY:"BGDHm58HbBCUHGbXDsD6Ug1cfnyN_Ic1gdhWNOAgYsyoToUvB-gbeda_HpTHyb20iWQ2P0VzJ3UowXGEJoHwZww",REACT_APP_FCM_PROJECT_ID:"aisensypushnotifications-prod",REACT_APP_FCM_APP_ID:"1:909070779131:web:644d9980e8b345acbd265e"}.LOG);let d=null;function p(t,e,i){let n=t.cursor(e);for(;;)if(!(i<0?n.childBefore(e):n.childAfter(e)))for(;;){if((i<0?n.to<e:n.from>e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-5)):Math.min(t.length,Math.max(n.from+1,e+5));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}class g{constructor(t){this.fragments=t,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?p(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?p(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 i=this.trees[e],n=this.index[e];if(n==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let r=i.children[n],o=this.start[e]+i.positions[n];if(o>t)return this.nextStart=o,null;if(o==t&&o+r.length<=this.safeTo)return o==t&&o>=this.safeFrom?r:null;r instanceof s.C8?(this.index[e]++,this.nextStart=o+r.length):(this.index[e]++,o+r.length>=t&&(this.trees.push(r),this.start.push(o),this.index.push(0)))}}}class m extends a{constructor(){super(...arguments),this.extended=-1,this.mask=0,this.context=0}clear(t){this.start=t,this.value=this.extended=-1}}const v=new a;class w{constructor(t){this.tokens=[],this.mainToken=v,this.actions=[],this.tokens=t.tokenizers.map((t=>new m))}getActions(t,e){let i=0,n=null,{parser:s}=t.p,{tokenizers:r}=s,o=s.stateSlot(t.state,3),l=t.curContext?t.curContext.hash:0;for(let h=0;h<r.length;h++){if(0==(1<<h&o))continue;let s=r[h],a=this.tokens[h];if((!n||s.fallback)&&((s.contextual||a.start!=t.pos||a.mask!=o||a.context!=l)&&(this.updateCachedToken(a,s,t,e),a.mask=o,a.context=l),0!=a.value)){let e=i;if(a.extended>-1&&(i=this.addActions(t,a.extended,a.end,i)),i=this.addActions(t,a.value,a.end,i),!s.extend&&(n=a,i>e))break}}for(;this.actions.length>i;)this.actions.pop();return n||(n=v,n.start=t.pos,t.pos==e.length?n.accept(t.p.parser.eofTerm,t.pos):n.accept(0,t.pos+1)),this.mainToken=n,this.actions}updateCachedToken(t,e,i,n){if(t.clear(i.pos),e.token(n,t,i),t.value>-1){let{parser:e}=i.p;for(let s=0;s<e.specialized.length;s++)if(e.specialized[s]==t.value){let r=e.specializers[s](n.read(t.start,t.end),i);if(r>=0&&i.p.parser.dialect.allows(r>>1)){0==(1&r)?t.value=r>>1:t.extended=r>>1;break}}}else i.pos==n.length?t.accept(i.p.parser.eofTerm,i.pos):t.accept(0,i.pos+1)}
1putAction(t,e,i,n){for(let s=0;s<n;s+=3)if(this.actions[s]==t)return n;return this.actions[n++]=t,this.actions[n++]=e,this.actions[n++]=i,n}addActions(t,e,i,n){let{state:s}=t,{parser:r}=t.p,{data:o}=r;for(let l=0;l<2;l++)for(let t=r.stateSlot(s,l?2:1);;t+=3){if(65535==o[t]){if(1!=o[t+1]){0==n&&2==o[t+1]&&(n=this.putAction(A(o,t+1),e,i,n));break}t=A(o,t+2)}o[t]==e&&(n=this.putAction(A(o,t+1),e,i,n))}return n}}var y;!function(t){t[t.Distance=5]="Distance",t[t.MaxRemainingPerStep=3]="MaxRemainingPerStep",t[t.MinBufferLengthPrune=200]="MinBufferLengthPrune",t[t.ForceReduceLimit=10]="ForceReduceLimit"}(y||(y={}));class b{constructor(t,e,i,n){this.parser=t,this.input=e,this.startPos=i,this.context=n,this.pos=0,this.recovering=0,this.nextStackID=9812,this.nested=null,this.nestEnd=0,this.nestWrap=null,this.reused=[],this.tokens=new w(t),this.topTerm=t.top[1],this.stacks=[r.start(this,t.top[0],this.startPos)];let s=null===n||void 0===n?void 0:n.fragments;this.fragments=s&&s.length?new g(s):null}advance(){if(this.nested){let t=this.nested.advance();return this.pos=this.nested.pos,t&&(this.finishNested(this.stacks[0],t),this.nested=null),null}let t,e,i,n=this.stacks,s=this.pos,r=this.stacks=[];for(let o=0;o<n.length;o++){let l,h=n[o];for(;;){if(h.pos>s)r.push(h);else if(l=this.checkNest(h))(!i||i.stack.score<h.score)&&(i=l);else{if(this.advanceStack(h,r,n))continue;{t||(t=[],e=[]),t.push(h);let i=this.tokens.mainToken;e.push(i.value,i.end)}}break}}if(i)return this.startNested(i),null;if(!r.length){let e=t&&function(t){let e=null;for(let i of t)i.pos==i.p.input.length&&i.p.parser.stateFlag(i.state,2)&&(!e||e.score<i.score)&&(e=i);return e}(t);if(e)return this.stackToTree(e);if(this.parser.strict)throw f&&t&&console.log("Stuck with token "+this.parser.getName(this.tokens.mainToken.value)),new SyntaxError("No parse at "+s);this.recovering||(this.recovering=5)}if(this.recovering&&t){let i=this.runRecovery(t,e,r);if(i)return this.stackToTree(i.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>s))&&this.recovering--}
1else if(r.length>1)t:for(let o=0;o<r.length-1;o++){let t=r[o];for(let e=o+1;e<r.length;e++){let i=r[e];if(t.sameState(i)||t.buffer.length>200&&i.buffer.length>200){if(!((t.score-i.score||t.buffer.length-i.buffer.length)>0)){r.splice(o--,1);continue t}r.splice(e--,1)}}}this.pos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.pos&&(this.pos=r[o].pos);return null}advanceStack(t,e,i){let n=t.pos,{input:r,parser:o}=this,l=f?this.stackID(t)+" -> ":"";if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let r=this.fragments.nodeAt(n);r;){let n=this.parser.nodeSet.types[r.type.id]==r.type?o.getGoto(t.state,r.type.id):-1;if(n>-1&&r.length&&(!e||(r.contextHash||0)==i))return t.useNode(r,n),f&&console.log(l+this.stackID(t)+" (via reuse of ".concat(o.getName(r.type.id),")")),!0;if(!(r instanceof s.mp)||0==r.children.length||r.positions[0]>0)break;let h=r.children[0];if(!(h instanceof s.mp))break;r=h}}let h=o.stateSlot(t.state,4);if(h>0)return t.reduce(h),f&&console.log(l+this.stackID(t)+" (via always-reduce ".concat(o.getName(65535&h),")")),!0;let a=this.tokens.getActions(t,r);for(let s=0;s<a.length;){let r=a[s++],h=a[s++],c=a[s++],u=s==a.length||!i,d=u?t:t.split();if(d.apply(r,h,c),f&&console.log(l+this.stackID(d)+" (via ".concat(0==(65536&r)?"shift":"reduce of ".concat(o.getName(65535&r))," for ").concat(o.getName(h)," @ ").concat(n).concat(d==t?"":", split",")")),u)return!0;d.pos>n?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){let n=this.checkNest(t);if(n)return n;if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return x(t,e),!0}}runRecovery(t,e,i){let n,s=null,r=!1;for(let o=0;o<t.length;o++){let l=t[o],h=e[o<<1],a=e[1+(o<<1)],c=f?this.stackID(l)+" -> ":"";if(l.deadEnd){if(r)continue;r=!0,l.restart(),f&&console.log(c+this.stackID(l)+" (restarted)");let t=this.advanceFully(l,i);if(t){!0!==t&&(n=t);continue}}let u=l.split(),d=c;for(let t=0;u.forceReduce()&&t<10;t++){f&&console.log(d+this.stackID(u)+" (via force-reduce)");let t=this.advanceFully(u,i);if(t){!0!==t&&(n=t);break}f&&(d=this.stackID(u)+" -> ")}for(let t of l.recoverByInsert(h))f&&console.log(c+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.input.length>l.pos?(a==l.pos&&(a++,h=0),l.recoverByDelete(h,a),f&&console.log(c+this.stackID(l)+" (via recover-delete ".concat(this.parser.getName(h),")")),x(l,i)):(!s||s.score<l.score)&&(s=l)}if(s)return s;if(n)for(let o of this.stacks)if(o.score>n.stack.score){n=void 0;break}return n&&this.startNested(n),null}forceFinish(){let t=this.stacks[0].split();return this.nested&&this.finishNested(t,this.nested.forceFinish()),this.stackToTree(t.forceAll())}stackToTree(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.pos;return this.parser.context&&t.emitContext(),s.mp.build({buffer:h.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.startPos,length:e-this.startPos,minRepeatType:this.parser.minRepeatTerm})}checkNest(t){let e=this.parser.findNested(t.state);if(!e)return null;let i=e.value;return"function"==typeof i&&(i=i(this.input,t)),i?{stack:t,info:e,spec:i}:null}startNested(t){let{stack:e,info:i,spec:n}=t;this.stacks=[e],this.nestEnd=this.scanForNestEnd(e,i.end,n.filterEnd),this.nestWrap="number"==typeof n.wrapType?this.parser.nodeSet.types[n.wrapType]:n.wrapType||null,n.startParse?this.nested=n.startParse(this.input.clip(this.nestEnd),e.pos,this.context):this.finishNested(e)}scanForNestEnd(t,e,i){for(let n=t.pos;n<this.input.length;n++)if(v.start=n,v.value=-1,e.token(this.input,v,t),v.value>-1&&(!i||i(this.input.read(n,v.end))))return n;return this.input.length}finishNested(t,e){this.nestWrap?e=new s.mp(this.nestWrap,e?[e]:[],e?[0]:[],this.nestEnd-t.pos):e||(e=new s.mp(s.Jq.none,[],[],this.nestEnd-t.pos));let i=this.parser.findNested(t.state);t.useNode(e,this.parser.getGoto(t.state,i.placeholder,!0)),f&&console.log(this.stackID(t)+" (via unnest)")}stackID(t){let e=(d||(d=new WeakMap)).get(t);return e||d.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function x(t,e){for(let i=0;i<e.length;i++){let n=e[i];if(n.pos==t.pos&&n.sameState(t))return void(e[i].score<t.score&&(e[i]=t))}
1e.push(t)}class k{constructor(t,e,i){this.source=t,this.flags=e,this.disabled=i}allows(t){return!this.disabled||0==this.disabled[t]}}class S{constructor(t){if(this.bufferLength=s.L3,this.strict=!1,this.cachedDialect=null,13!=t.version)throw new RangeError("Parser version (".concat(t.version,") doesn't match runtime version (",13,")"));let e=u(t.tokenData),i=t.nodeNames.split(" ");this.minRepeatTerm=i.length,this.context=t.context;for(let s=0;s<t.repeatNodeCount;s++)i.push("");let n=[];for(let s=0;s<i.length;s++)n.push([]);function r(t,e,i){n[t].push([e,e.deserialize(String(i))])}if(t.nodeProps)for(let s of t.nodeProps){let t=s[0];for(let e=1;e<s.length;){let i=s[e++];if(i>=0)r(i,t,s[e++]);else{let n=s[e+-i];for(let o=-i;o>0;o--)r(s[e++],t,n);e++}}}if(this.specialized=new Uint16Array(t.specialized?t.specialized.length:0),this.specializers=[],t.specialized)for(let s=0;s<t.specialized.length;s++)this.specialized[s]=t.specialized[s].term,this.specializers[s]=t.specialized[s].get;this.states=u(t.states,Uint32Array),this.data=u(t.stateData),this.goto=u(t.goto);let o=Object.keys(t.topRules).map((e=>t.topRules[e][1]));this.nodeSet=new s.Lj(i.map(((e,i)=>s.Jq.define({name:i>=this.minRepeatTerm?void 0:e,id:i,props:n[i],top:o.indexOf(i)>-1,error:0==i,skipped:t.skippedNodes&&t.skippedNodes.indexOf(i)>-1})))),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map((t=>"number"==typeof t?new c(e,t):t)),this.topRules=t.topRules,this.nested=(t.nested||[]).map((t=>{let[e,i,n,s]=t;return{name:e,value:i,end:new c(u(n),0),placeholder:s}})),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]]}parse(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"string"==typeof t&&(t=(0,s.AY)(t));let n=new b(this,t,e,i);for(;;){let t=n.advance();if(t)return t}}startParse(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return"string"==typeof t&&(t=(0,s.AY)(t)),new b(this,t,e,i)}getGoto(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s<i;s++)if(n[s]==t)return o;if(r)return-1}}hasAction(t,e){let i=this.data;for(let n=0;n<2;n++)for(let s,r=this.stateSlot(t,n?2:1);;r+=3){if(65535==(s=i[r])){if(1!=i[r+1]){if(2==i[r+1])return A(i,r+2);break}s=i[r=A(i,r+2)]}if(s==e||0==s)return A(i,r+1)}return 0}stateSlot(t,e){return this.states[6*t+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}findNested(t){let e=this.stateSlot(t,0);return 4&e?this.nested[e>>10]:null}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;
1i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=A(this.data,i+2)}if(e==A(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=A(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}overrides(t,e){let i=C(this.data,this.tokenPrecTable,e);return i<0||C(this.data,this.tokenPrecTable,t)<i}configure(t){let e=Object.assign(Object.create(S.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError("Invalid top rule name ".concat(t.top));e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.nested&&(e.nested=this.nested.map((e=>Object.prototype.hasOwnProperty.call(t.nested,e.name)?{name:e.name,value:t.nested[e.name],end:e.end,placeholder:e.placeholder}:e))),null!=t.strict&&(e.strict=t.strict),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}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 hasNested(){return this.nested.length>0}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){if(this.cachedDialect&&this.cachedDialect.source==t)return this.cachedDialect;let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let s of t.split(" ")){let t=e.indexOf(s);t>=0&&(i[t]=!0)}let n=null;for(let s=0;s<e.length;s++)if(!i[s])for(let t,i=this.dialects[e[s]];65535!=(t=this.data[i++]);)(n||(n=new Uint8Array(this.maxTerm+1)))[t]=1;return this.cachedDialect=new k(t,i,n)}static deserialize(t){return new S(t)}}function A(t,e){return t[e]|t[e+1]<<16}function C(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}const M=S.deserialize({version:13,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"\u26a0 JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[[s.md.openedBy,7,"{",12,"["],[s.md.closedBy,8,"}",13,"]"]],skippedNodes:[0],repeatNodeCount:2,tokenData:"(p~RaXY!WYZ!W]^!Wpq!Wrs!]|}$i}!O$n!Q!R$w!R![&V![!]&h!}#O&m#P#Q&r#Y#Z&w#b#c'f#h#i'}#o#p(f#q#r(k~!]Oc~~!`Upq!]qr!]rs!rs#O!]#O#P!w#P~!]~!wOe~~!zXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#g~#jR!Q![#s!c!i#s#T#Z#s~#vR!Q![$P!c!i$P#T#Z$P~$SR!Q![$]!c!i$]#T#Z$]~$`R!Q![!]!c!i!]#T#Z!]~$nOh~~$qQ!Q!R$w!R![&V~$|RT~!O!P%V!g!h%k#X#Y%k~%YP!Q![%]~%bRT~!Q![%]!g!h%k#X#Y%k~%nR{|%w}!O%w!Q![%}~%zP!Q![%}~&SPT~!Q![%}~&[ST~!O!P%V!Q![&V!g!h%k#X#Y%k~&mOg~~&rO]~~&wO[~~&zP#T#U&}~'QP#`#a'T~'WP#g#h'Z~'^P#X#Y'a~'fOR~~'iP#i#j'l~'oP#`#a'r~'uP#`#a'x~'}OS~~(QP#f#g(T~(WP#i#j(Z~(^P#X#Y(a~(fOQ~~(kOW~~(pOV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});var T=i(92649),O=i(17453);const P=T.LN.define({parser:M.configure({props:[T.uj.add({Object:(0,T.tC)({except:/^\s*\}/}),Array:(0,T.tC)({except:/^\s*\]/})}),T.x0.add({"Object Array":T.Dv}),(0,O.Gv)({String:O.pJ.string,Number:O.pJ.number,"True False":O.pJ.bool,PropertyName:O.pJ.propertyName,null:O.pJ.null,",":O.pJ.separator,"[ ]":O.pJ.squareBracket,"{ }":O.pJ.brace})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function D(){return new T.ri(P)}},92649:(t,e,i)=>{i.d(e,{Dv:()=>H,Fw:()=>W,Gn:()=>M,K0:()=>C,LN:()=>c,SS:()=>A,c:()=>k,dK:()=>y,nY:()=>B,qz:()=>u,ri:()=>b,tC:()=>N,uj:()=>T,x0:()=>z,y1:()=>S});var n=i(23129),s=i(78528),r=i(89933),o=i(32725);const l=new n.md;class h{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];this.data=t,this.topNode=i,r.yy.prototype.hasOwnProperty("tree")||Object.defineProperty(r.yy.prototype,"tree",{get(){return u(this)}}
1),this.parser=e,this.extension=[y.of(this),r.yy.languageData.of(((t,e)=>t.facet(a(t,e))))].concat(n)}isActiveAt(t,e){return a(t,e)==this.data}findRegions(t){let e=t.facet(y);if((null===e||void 0===e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[];return u(t).iterate({enter:(t,e,n)=>{if(t.isTop&&t.prop(l)==this.data)return i.push({from:e,to:n}),!1}}),i}get allowsNesting(){return!0}parseString(t){let e,i=s.xv.of(t.split("\n")),o=this.parser.startParse(new f(i),0,new d(this.parser,r.yy.create({doc:i}),[],n.mp.empty,{from:0,to:t.length},[],null));for(;!(e=o.advance()););return e}}function a(t,e){let i=t.facet(y);if(!i)return null;if(!i.allowsNesting)return i.data;let n=u(t).resolve(e,-1);for(;n;){let t=n.type.prop(l);if(t)return t;n=n.parent}return i.data}h.setState=r.Py.define();class c extends h{constructor(t,e){super(t,e,e.topNode),this.parser=e}static define(t){let e=(i=t.languageData,r.r$.define({combine:i?t=>t.concat(i):void 0}));var i;return new c(e,t.parser.configure({props:[l.add((t=>t.isTop?e:void 0))]}))}configure(t){return new c(this.data,this.parser.configure(t))}get allowsNesting(){return this.parser.hasNested}}function u(t){let e=t.field(h.state,!1);return e?e.tree:n.mp.empty}class f{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length;this.doc=t,this.length=e,this.cursorPos=0,this.string="",this.prevString="",this.cursor=t.iter()}syncTo(t){return t<this.cursorPos&&(this.cursor=this.doc.iter(),this.cursorPos=0),this.prevString=t==this.cursorPos?this.string:"",this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}get(t){if(t>=this.length)return-1;let e=this.cursorPos-this.string.length;if(t<e||t>=this.cursorPos){if(t<e&&t>=e-this.prevString.length)return this.prevString.charCodeAt(t-(e-this.prevString.length));e=this.syncTo(t)}return this.string.charCodeAt(t-e)}lineAfter(t){if(t>=this.length||t<0)return"";let e=this.cursorPos-this.string.length;return(t<e||t>=this.cursorPos)&&(e=this.syncTo(t)),this.cursor.lineBreak?"":this.string.slice(t-e,Math.min(this.length-e,this.string.length))}read(t,e){let i=this.cursorPos-this.string.length;return t<i||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}clip(t){return new f(this.doc,t)}}class d{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0;this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.viewport=s,this.skipped=r,this.scheduleOn=o,this.parse=null,this.tempSkipped=[]}work(t,e){if(this.tree!=n.mp.empty&&(null==e?this.tree.length==this.state.doc.length:this.tree.length>=e))return this.takeTree(),!0;this.parse||(this.parse=this.parser.startParse(new f(this.state.doc),0,this));let i=Date.now()+t;for(;;){let t=this.parse.advance();if(t)return this.fragments=this.withoutTempSkipped(n.i9.addTree(t)),this.parse=null,this.tree=t,!0;if(null!=e&&this.parse.pos>=e)return this.takeTree(),!0;if(Date.now()>i)return!1}}takeTree(){this.parse&&this.parse.pos>this.tree.length&&(this.tree=this.parse.forceFinish(),this.fragments=this.withoutTempSkipped(n.i9.addTree(this.tree,this.fragments,!0)))}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=p(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:s,viewport:r,skipped:o}=this;if(this.takeTree(),!t.empty){let e=[];
1if(t.iterChangedRanges(((t,i,n,s)=>e.push({fromA:t,toA:i,fromB:n,toB:s}))),i=n.i9.applyChanges(i,e),s=n.mp.empty,r={from:t.mapPos(r.from,-1),to:t.mapPos(r.to,1)},this.skipped.length){o=[];for(let e of this.skipped){let i=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);i<n&&o.push({from:i,to:n})}}}return new d(this.parser,e,i,s,r,o,this.scheduleOn)}updateViewport(t){this.viewport=t;let e=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:e,to:n}=this.skipped[i];e<t.to&&n>t.from&&(this.fragments=p(this.fragments,e,n),this.skipped.splice(i--,1))}return this.skipped.length<e}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return{startParse:(e,i,s)=>({pos:i,advance(){let r=s;return r.tempSkipped.push({from:i,to:e.length}),t&&(r.scheduleOn=r.scheduleOn?Promise.all([r.scheduleOn,t]):t),this.pos=e.length,new n.mp(n.Jq.none,[],[],e.length-i)},forceFinish(){return this.advance()}})}}movedPast(t){return this.tree.length<t&&this.parse&&this.parse.pos>=t}}function p(t,e,i){return n.i9.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}d.skippingParser=d.getSkippingParser();class g{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged)return this;let e=this.context.changes(t.changes,t.state),i=this.context.tree.length==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.tree.length),e.viewport.to);return e.work(25,i)||e.takeTree(),new g(e)}static init(t){let e=new d(t.facet(y).parser,t,[],n.mp.empty,{from:0,to:t.doc.length},[],null);return e.work(25)||e.takeTree(),new g(e)}}h.state=r.QQ.define({create:g.init,update(t,e){for(let i of e.effects)if(i.is(h.setState))return i.value;return e.startState.facet(y)!=e.state.facet(y)?g.init(e.state):t.apply(e)}});let m="undefined"!=typeof window&&window.requestIdleCallback||((t,e)=>{let{timeout:i}=e;return setTimeout(t,i)}),v="undefined"!=typeof window&&window.cancelIdleCallback||clearTimeout;const w=o.lg.fromClass(class{constructor(t){this.view=t,this.working=-1,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(h.state).context;t.viewportChanged&&(e.updateViewport(t.view.viewport)&&e.reset(),this.view.viewport.to>e.tree.length&&this.scheduleWork()),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working>-1)return;let{state:t}=this.view,e=t.field(h.state),i=e.context.fragments;e.tree.length>=t.doc.length&&i.length&&0==i[0].from&&i[0].to>=t.doc.length||(this.working=m(this.work,{timeout:500}))}work(t){this.working=-1;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:i,viewport:{to:n}}=this.view,s=i.field(h.state);if(s.tree.length>=n+1e6)return;let r=Math.min(this.chunkBudget,t?Math.max(25,t.timeRemaining()):100),o=s.context.work(r,n+1e6);this.chunkBudget-=Date.now()-e,(o||this.chunkBudget<=0||s.context.movedPast(n))&&(s.context.takeTree(),this.view.dispatch({effects:h.setState.of(new g(s.context))})),!o&&this.chunkBudget>0&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(t.scheduleOn.then((()=>this.scheduleWork())),t.scheduleOn=null)}destroy(){this.working>=0&&v(this.working)}},{eventHandlers:{focus(){this.scheduleWork()}}}),y=r.r$.define({combine:t=>t.length?t[0]:null,enables:[h.state,w]});class b{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.language=t,this.support=e,this.extension=[t,e]}}const x=r.r$.define(),k=r.r$.define({combine:t=>{if(!t.length)return" ";if(!/^(?: +|\t+)$/.test(t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return t[0]}});function S(t){let e=t.facet(k);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function A(t,e){let i="",n=t.tabSize;if(9==t.facet(k).charCodeAt(0))for(;e>=n;)i+="\t",e-=n;for(let s=0;s<e;s++)i+=" ";return i}function C(t,e){t instanceof r.yy&&(t=new M(t));for(let n of t.state.facet(x)){let i=n(t,e);if(null!=i)return i}let i=u(t.state);
1return i?function(t,e,i){let n=e.resolve(i);for(let s=n,r=i;;){let t=s.childBefore(r);if(!t)break;t.type.isError&&t.from==t.to?(n=s,r=t.from):(s=t,r=s.to+1)}return P(n,i,t)}(t,i,e):null}class M{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.state=t,this.options=e,this.unit=S(t)}textAfterPos(t){var e,i;let n=null===(e=this.options)||void 0===e?void 0:e.simulateBreak;return t==n&&(null===(i=this.options)||void 0===i?void 0:i.simulateDoubleBreak)?"":this.state.sliceDoc(t,Math.min(t+100,null!=n&&n>t?n:1e9,this.state.doc.lineAt(t).to))}column(t){var e;let i=this.state.doc.lineAt(t),n=i.text.slice(0,t-i.from),s=this.countColumn(n,t-i.from),r=(null===(e=this.options)||void 0===e?void 0:e.overrideIndentation)?this.options.overrideIndentation(i.from):-1;return r>-1&&(s+=r-this.countColumn(n,n.search(/\S/))),s}countColumn(t,e){return(0,s.IS)(e<0?t:t.slice(0,e),0,this.state.tabSize)}lineIndent(t){var e;let i=null===(e=this.options)||void 0===e?void 0:e.overrideIndentation;if(i){let e=i(t.from);if(e>-1)return e}return this.countColumn(t.text,t.text.search(/\S/))}}const T=new n.md;function O(t){let e=t.type.prop(T);if(e)return e;let i,s=t.firstChild;if(s&&(i=s.type.prop(n.md.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>L(t,!0,1,void 0,n&&!function(t){var e,i;return t.pos==(null===(e=t.options)||void 0===e?void 0:e.simulateBreak)&&(null===(i=t.options)||void 0===i?void 0:i.simulateDoubleBreak)}(t)?e.from:void 0)}return null==t.parent?D:null}function P(t,e,i){for(;t;t=t.parent){let n=O(t);if(n)return n(new E(i,e,t))}return null}function D(){return 0}class E extends M{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(R(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t)}continue(){let t=this.node.parent;return t?P(t,this.pos,this.base):0}}function R(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function L(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,l=n&&r.slice(o,o+n.length)==n||s==t.pos+o,h=e?function(t){var e;let i=t.node,n=i.childAfter(i.from),s=i.lastChild;if(!n)return null;let r=null===(e=t.options)||void 0===e?void 0:e.simulateBreak,o=t.state.doc.lineAt(n.from),l=null==r||r<=o.from?o.to:Math.min(o.to,r);for(let h=n.to;;){let t=i.childAfter(h);if(!t||t==s)return null;if(!t.type.isSkipped)return t.from<l?n:null;h=t.to}}(t):null;return h?l?t.column(h.from):t.column(h.to):t.baseIndent+(l?0:t.unit*i)}function N(){let{except:t,units:e=1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i=>{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}const I=200;function B(){return r.yy.transactionFilter.of((t=>{if(!t.docChanged||"input"!=t.annotation(r.YW.userEvent))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+I)return t;let o=i.sliceString(s.from,n);if(!e.some((t=>t.test(o))))return t;let{state:l}=t,h=-1,a=[];for(let{head:r}of l.selection.ranges){let t=l.doc.lineAt(r);if(t.from==h)continue;h=t.from;let e=C(l,t.from);if(null==e)continue;let i=/^\s*/.exec(t.text)[0],n=A(l,e);i!=n&&a.push({from:t.from,to:t.from+i.length,insert:n})}return a.length?[t,{changes:a}]:t}))}const V=r.r$.define(),z=new n.md;function H(t){let e=t.firstChild,i=t.lastChild;return e&&e.to<i.from?{from:e.to,to:i.type.isError?t.to:i.from}:null}function W(t,e,i){for(let n of t.facet(V)){let s=n(t,e,i);if(s)return s}return function(t,e,i){let n=u(t);if(0==n.length)return null;let s=null;for(let r=n.resolve(i);r;r=r.parent){if(r.to<=i||r.from>i)continue;if(s&&r.from<e)break;let n=r.type.prop(z);if(n){let o=n(r,t);o&&o.from<=i&&o.from>=e&&o.to>i&&(s=o)}}return s}(t,e,i)}},25877:(t,e,i)=>{i.d(e,{U:()=>m,n:()=>p});var n=i(89933),s=i(92649),r=i(32725),o=i(23129);const l=r.tk.baseTheme({".cm-matchingBracket":{color:"#0b0"},".cm-nonmatchingBracket":{color:"#a22"}}),h=1e4,a="()[]{}",c=n.r$.define({combine:t=>
1(0,n.BO)(t,{afterCursor:!0,brackets:a,maxScanDistance:h})}),u=r.p.mark({class:"cm-matchingBracket"}),f=r.p.mark({class:"cm-nonmatchingBracket"}),d=[n.QQ.define({create:()=>r.p.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(c);for(let s of e.state.selection.ranges){if(!s.empty)continue;let t=m(e.state,s.head,-1,n)||s.head>0&&m(e.state,s.head-1,1,n)||n.afterCursor&&(m(e.state,s.head,1,n)||s.head<e.state.doc.length&&m(e.state,s.head+1,-1,n));if(!t)continue;let r=t.matched?u:f;i.push(r.range(t.start.from,t.start.to)),t.end&&i.push(r.range(t.end.from,t.end.to))}return r.p.set(i,!0)},provide:t=>r.tk.decorations.from(t)}),l];function p(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[c.of(t),d]}function g(t,e,i){let n=t.prop(e<0?o.md.openedBy:o.md.closedBy);if(n)return n;if(1==t.name.length){let n=i.indexOf(t.name);if(n>-1&&n%2==(e<0?1:0))return[i[n+e]]}return null}function m(t,e,i){let n,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.maxScanDistance||h,l=r.brackets||a,c=(0,s.qz)(t),u=c.resolve(e,i);return(n=g(u.type,i,l))?function(t,e,i,n,s,r){let o=n.parent,l={from:n.from,to:n.to},h=0,a=null===o||void 0===o?void 0:o.cursor;if(a&&(i<0?a.childBefore(n.from):a.childAfter(n.to)))do{if(i<0?a.to<=n.from:a.from>=n.to){if(0==h&&s.indexOf(a.type.name)>-1)return{start:l,end:{from:a.from,to:a.to},matched:!0};if(g(a.type,i,r))h++;else if(g(a.type,-i,r)&&(h--,0==h))return{start:l,end:{from:a.from,to:a.to},matched:!1}}}while(i<0?a.prevSibling():a.nextSibling());return{start:l,matched:!1}}(0,0,i,u,n,l):function(t,e,i,n,s,r,o){let l=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),h=o.indexOf(l);if(h<0||h%2==0!=i>0)return null;let a={from:i<0?e-1:e,to:i>0?e+1:e},c=t.doc.iterRange(e,i>0?t.doc.length:0),u=0;for(let f=0;!c.next().done&&f<=r;){let t=c.value;i<0&&(f+=t.length);let r=e+f*i;for(let e=i>0?0:t.length-1,l=i>0?t.length:-1;e!=l;e+=i){let l=o.indexOf(t[e]);if(!(l<0||n.resolve(r+e,1).type!=s))if(l%2==0==i>0)u++;else{if(1==u)return{start:a,end:{from:r+e,to:r+e+1},matched:l>>1==h>>1};u--}}i>0&&(f+=t.length)}return c.done?{start:a,matched:!1}:null}(t,e,i,c,u.type,o,l)}},98759:(t,e,i)=>{i.d(e,{Xs:()=>h,f_:()=>a,uU:()=>s});var n=i(89933);class s{eq(t){return this==t}range(t){return new r(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,this)}}s.prototype.startSide=s.prototype.endSide=0,s.prototype.point=!1,s.prototype.mapMode=n.gc.TrackDel;class r{constructor(t,e,i){this.from=t,this.to=e,this.value=i}}function o(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class l{constructor(t,e,i,n){this.from=t,this.to=e,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=i?this.to:this.from;for(let r=n,o=s.length;;){if(r==o)return r;let n=r+o>>1,l=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return l>=0?r:o;l>=0?o=n:r=n+1}}between(t,e,i,n){for(let s=this.findIndex(e,-1e9,!0),r=this.findIndex(i,1e9,!1,s);s<r;s++)if(!1===n(this.from[s]+t,this.to[s]+t,this.value[s]))return!1}map(t,e){let i=[],n=[],s=[],r=-1,o=-1;for(let l=0;l<this.value.length;l++){let h,a,c=this.value[l],u=this.from[l]+t,f=this.to[l]+t;if(u==f){let t=e.mapPos(u,c.startSide,c.mapMode);if(null==t)continue;h=a=t}else if(h=e.mapPos(u,c.startSide),a=e.mapPos(f,c.endSide),h>a||h==a&&c.startSide>0&&c.endSide<=0)continue;(a-h||c.endSide-c.startSide)<0||(r<0&&(r=h),c.point&&(o=Math.max(o,a-h)),i.push(c),n.push(h-r),s.push(a-r))}return{mapped:i.length?new l(n,s,i,o):null,pos:r}}}class h{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h.empty,n=arguments.length>3?arguments[3]:void 0;this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=n}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:i=!1,filterFrom:n=0,filterTo:s=this.length}=t,l=t.filter;if(0==e.length&&!l)return this;if(i&&e.slice().sort(o),this.isEmpty)return e.length?h.of(e):this;let c=new u(this,null,-1).goto(0),f=0,d=[],p=new a;for(;c.value||f<e.length;)if(f<e.length&&(c.from-e[f].from||c.startSide-e[f].value.startSide)>=0){let t=e[f++];p.addInner(t.from,t.to,t.value)||d.push(t)}else 1==c.rangeIndex&&c.chunkIndex<this.chunk.length&&(f==e.length||this.chunkEnd(c.chunkIndex)<e[f].from)&&(!l||n>this.chunkEnd(c.chunkIndex)||s<this.chunkPos[c.chunkIndex])&&p.addChunk(this.chunkPos[c.chunkIndex],this.chunk[c.chunkIndex])?c.nextChunk():((!l||n>c.to||s<c.from||l(c.from,c.to,c.value))&&(p.addInner(c.from,c.to,c.value)||d.push(new r(c.from,c.to,c.value))),c.next());return p.finishInner(this.nextLayer.isEmpty&&!d.length?h.empty:this.nextLayer.update({add:d,filter:l,filterFrom:n,filterTo:s}))}map(t){if(0==t.length||this.isEmpty)return this;let e=[],i=[],n=-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)n=Math.max(n,o.maxPoint),e.push(o),i.push(t.mapPos(s));else if(!0===l){let{mapped:r,pos:l}=o.map(s,t);r&&(n=Math.max(n,r.maxPoint),e.push(r),i.push(l))}}let s=this.nextLayer.map(t);return 0==e.length?s:new h(i,e,s,n)}between(t,e,i){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let s=this.chunkPos[n],r=this.chunk[n];if(e>=s&&t<=s+r.length&&!1===r.between(s,t-s,e-s,i))return}this.nextLayer.between(t,e,i)}}iter(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return f.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return f.from(t).goto(e)}static compare(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,r=t.filter((t=>t.maxPoint>=500||!t.isEmpty&&e.indexOf(t)<0&&t.maxPoint>=s)),o=e.filter((e=>e.maxPoint>=500||!e.isEmpty&&t.indexOf(e)<0&&e.maxPoint>=s)),l=c(r,o),h=new p(r,l,s),a=new p(o,l,s);
1i.iterGaps(((t,e,i)=>g(h,t,a,e,i,n))),i.empty&&0==i.length&&g(h,0,a,0,0,n)}static eq(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;null==n&&(n=1e9);let s=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0)),r=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0));if(s.length!=r.length)return!1;if(!s.length)return!0;let o=c(s,r),l=new p(s,o,0).goto(i),h=new p(r,o,0).goto(i);for(;;){if(l.to!=h.to||!m(l.active,h.active)||l.point&&(!h.point||!l.point.eq(h.point)))return!1;if(l.to>=n)return!0;l.next(),h.next()}}static spans(t,e,i,n){let s=new p(t,null,arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1).goto(e),r=e,o=s.openStart;for(;;){let t=Math.min(s.to,i);if(s.point?(n.point(r,t,s.point,s.activeForPoint(s.to),o),o=s.openEnd(t)+(s.to>t?1:0)):t>r&&(n.span(r,t,s.active,o),o=s.openEnd(t)),s.to>i)break;r=s.to,s.next()}return o}static of(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=new a;for(let n of t instanceof r?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i<t.length;i++){let n=t[i];if(o(e,n)>0)return t.slice().sort(o);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}h.empty=new h([],[],null,-1),h.empty.nextLayer=h.empty;class a{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}finishChunk(t){this.chunks.push(new l(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new a)).add(t,e,i)}addInner(t,e,i){let n=t-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(n<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=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.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 i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(h.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=new h(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function c(t,e){let i=new Map;for(let s of t)for(let t=0;t<s.chunk.length;t++)s.chunk[t].maxPoint<500&&i.set(s.chunk[t],s.chunkPos[t]);let n=new Set;for(let s of e)for(let t=0;t<s.chunk.length;t++)i.get(s.chunk[t])==s.chunkPos[t]&&n.add(s.chunk[t]);return n}class u{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.layer=t,this.skip=e,this.minPoint=i,this.rank=n}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}gotoInner(t,e,i){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++,i=!1}let n=this.chunkIndex==this.layer.chunk.length?0:this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!i||this.rangeIndex<n)&&(this.rangeIndex=n),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],i=t+e.from[this.rangeIndex];if(this.from=i,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],++this.rangeIndex==e.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}if(this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.to-t.to||this.endSide-t.endSide}}class f{constructor(t){this.heap=t}static from(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n=[];for(let s=0;s<t.length;s++)for(let r=t[s];!r.isEmpty;r=r.nextLayer)r.maxPoint>=i&&n.push(new u(r,e,i,s));return 1==n.length?n[0]:new f(n)}get startSide(){return this.value?this.value.startSide:0}goto(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;for(let i of this.heap)i.goto(t,e);for(let i=this.heap.length>>1;i>=0;i--)d(this.heap,i);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let i=this.heap.length>>1;i>=0;i--)d(this.heap,i);(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(),d(this.heap,0)}}}function d(t,e){for(let i=t[e];;){let n=1+(e<<1);if(n>=t.length)break;let s=t[n];
1if(n+1<t.length&&s.compare(t[n+1])>=0&&(s=t[n+1],n++),i.compare(s)<0)break;t[n]=i,t[e]=s,e=n}}class p{constructor(t,e,i){this.minPoint=i,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=f.from(t,e,i)}goto(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-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){v(this.active,t),v(this.activeTo,t),v(this.activeRank,t),this.minActive=y(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:n,rank:s}=this.cursor;for(;e<this.activeRank.length&&this.activeRank[e]<=s;)e++;w(this.active,e,i),w(this.activeTo,e,n),w(this.activeRank,e,s),t&&w(t,e,this.cursor.from),this.minActive=y(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let i=this.openStart<0?[]:null,n=0;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>t){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&v(i,s)}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 s=this.cursor.value;if(s.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to&&s.endSide==this.endSide)){this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.from<t&&(n=1),this.cursor.next(),this.to>t&&this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(i),this.cursor.next()}}}if(i){let e=0;for(;e<i.length&&i[e]<t;)e++;this.openStart=e+n}}activeForPoint(t){if(!this.active.length)return this.active;let e=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}}function g(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,l=n,h=n-e;for(;;){let e=t.to+h-i.to||t.endSide-i.endSide,n=e<0?t.to+h:i.to,s=Math.min(n,o);if(t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&m(t.activeForPoint(t.to+h),i.activeForPoint(i.to))||r.comparePoint(l,s,t.point,i.point):s>l&&!m(t.active,i.active)&&r.compareRange(l,s,t.active,i.active),n>o)break;l=n,e<=0&&t.next(),e>=0&&i.next()}}function m(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!=e[i]&&!t[i].eq(e[i]))return!1;return!0}function v(t,e){for(let i=e,n=t.length-1;i<n;i++)t[i]=t[i+1];t.pop()}function w(t,e,i){for(let n=t.length-1;n>=e;n--)t[n+1]=t[n];t[e]=i}function y(t,e){let i=-1,n=1e9;for(let s=0;s<e.length;s++)(e[s]-n||t[s].endSide-t[i].endSide)<0&&(i=s,n=e[s]);return i}},89933:(t,e,i)=>{i.d(e,{BO:()=>rt,D0:()=>tt,Py:()=>$,QQ:()=>C,Wl:()=>D,YW:()=>U,as:()=>l,gc:()=>r,jT:()=>g,n0:()=>o,q6:()=>F,r$:()=>y,yy:()=>st});var n=i(78528);const s=/\r\n?|\n/;var r=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(r||(r={}));class o{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 i=this.sections[e+1];t+=i<0?this.sections[e]:i}return t}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(t){for(let e=0,i=0,n=0;e<this.sections.length;){let s=this.sections[e++],r=this.sections[e++];r<0?(t(i,n,s),n+=s):n+=r,i+=s}}iterChangedRanges(t){c(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let i=this.sections[e++],n=this.sections[e++];n<0?t.push(i,n):t.push(n,i)}return new o(t)}composeDesc(t){return this.empty?t:t.empty?this:f(this,t)}mapDesc(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:u(this,t,e)}mapPos(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.Simple,n=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],h=this.sections[o++],a=n+l;if(h<0){if(a>t)return s+(t-n);s+=l}else{if(i!=r.Simple&&a>=t&&(i==r.TrackDel&&n<t&&a>t||i==r.TrackBefore&&n<t||i==r.TrackAfter&&a>t))return null;if(a>t||a==t&&e<0&&!l)return t==n||e<0?s:s+h;s+=h}n=a}if(t>n)throw new RangeError("Position ".concat(t," is out of range for changeset of length ").concat(n));return s}touchesRange(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;for(let i=0,n=0;i<this.sections.length&&n<=e;){let s=n+this.sections[i++];if(this.sections[i++]>=0&&n<=e&&s>=t)return!(n<t&&s>e)||"cover";n=s}return!1}toString(){let t="";for(let e=0;e<this.sections.length;){let i=this.sections[e++],n=this.sections[e++];t+=(t?" ":"")+i+(n>=0?":"+n:"")}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 o(t)}}class l extends o{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 c(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t){return u(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1],!0)}invert(t){let e=this.sections.slice(),i=[];for(let s=0,r=0;
1s<e.length;s+=2){let o=e[s],l=e[s+1];if(l>=0){e[s]=l,e[s+1]=o;let h=s>>1;for(;i.length<h;)i.push(n.xv.empty);i.push(o?t.slice(r,r+o):n.xv.empty)}r+=o}return new l(e,i)}compose(t){return this.empty?t:t.empty?this:f(this,t,!0)}map(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:u(this,t,e,!0)}iterChanges(t){c(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}get desc(){return new o(this.sections)}filter(t){let e=[],i=[],n=[],s=new d(this);t:for(let r=0,o=0;;){let l=r==t.length?1e9:t[r++];for(;o<l||o==l&&0==s.len;){if(s.done)break t;let t=Math.min(s.len,l-o);h(n,t,-1);let r=-1==s.ins?-1:0==s.off?s.ins:0;h(e,t,r),r>0&&a(i,e,s.text),s.forward(t),o+=t}let c=t[r++];for(;o<c;){if(s.done)break t;let t=Math.min(s.len,c-o);h(e,t,-1),h(n,t,-1==s.ins?-1:0==s.off?s.ins:0),s.forward(t),o+=t}}return{changes:new l(e,i),filtered:new o(n)}}toJSON(){let t=[];for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e],n=this.sections[e+1];n<0?t.push(i):0==n?t.push([i]):t.push([i].concat(this.inserted[e>>1].toJSON()))}return t}static of(t,e,i){let r=[],o=[],c=0,u=null;function f(){if(!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&!r.length)return;c<e&&h(r,e-c,-1);let t=new l(r,o);u=u?u.compose(t.map(u)):t,r=[],o=[],c=0}return function t(d){if(Array.isArray(d))for(let e of d)t(e);else if(d instanceof l){if(d.length!=e)throw new RangeError("Mismatched change set length (got ".concat(d.length,", expected ").concat(e,")"));f(),u=u?u.compose(d.map(u)):d}else{let{from:t,to:l=t,insert:u}=d;if(t>l||t<0||l>e)throw new RangeError("Invalid change range ".concat(t," to ").concat(l," (in doc of length ").concat(e,")"));let p=u?"string"==typeof u?n.xv.of(u.split(i||s)):u:n.xv.empty,g=p.length;if(t==l&&0==g)return;t<c&&f(),t>c&&h(r,t-c,-1),h(r,l-t,g),a(o,r,p),c=l}}(t),f(!u),u}static empty(t){return new l(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],i=[];for(let s=0;s<t.length;s++){let r=t[s];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(;i.length<s;)i.push(n.xv.empty);i[s]=n.xv.of(r.slice(1)),e.push(r[0],i[s].length)}}}return new l(e,i)}}function h(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(0==e&&i<=0)return;let s=t.length-2;s>=0&&i<=0&&i==t[s+1]?t[s]+=e:0==e&&0==t[s]?t[s+1]+=i:n?(t[s]+=e,t[s+1]+=i):t.push(e,i)}function a(t,e,i){if(0==i.length)return;let s=e.length-2>>1;if(s<t.length)t[t.length-1]=t[t.length-1].append(i);else{for(;t.length<s;)t.push(n.xv.empty);t.push(i)}}function c(t,e,i){let s=t.inserted;for(let r=0,o=0,l=0;l<t.sections.length;){let h=t.sections[l++],a=t.sections[l++];if(a<0)r+=h,o+=h;else{let c=r,u=o,f=n.xv.empty;for(;c+=h,u+=a,a&&s&&(f=f.append(s[l-2>>1])),!(i||l==t.sections.length||t.sections[l+1]<0);)h=t.sections[l++],a=t.sections[l++];e(r,c,o,u,f),r=c,o=u}}}function u(t,e,i){let n=[],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3]?[]:null,r=new d(t),c=new d(e);for(let u=0,f=0;;)if(-1==r.ins)u+=r.len,r.next();else if(-1==c.ins&&f<u){let t=Math.min(c.len,u-f);c.forward(t),h(n,t,-1),f+=t}else if(c.ins>=0&&(r.done||f<u||f==u&&(c.len<r.len||c.len==r.len&&!i))){for(h(n,c.ins,-1);u>f&&!r.done&&u+r.len<f+c.len;)u+=r.len,r.next();f+=c.len,c.next()}else{if(!(r.ins>=0)){if(r.done&&c.done)return s?new l(n,s):new o(n);throw new Error("Mismatched change set lengths")}{let t=0,e=u+r.len;for(;;)if(c.ins>=0&&f>u&&f+c.len<e)t+=c.ins,f+=c.len,c.next();else{if(!(-1==c.ins&&f<e))break;{let i=Math.min(c.len,e-f);t+=i,c.forward(i),f+=i}}h(n,t,r.ins),s&&a(s,n,r.text),u=e,r.next()}}}function f(t,e){let i=[],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2]?[]:null,s=new d(t),r=new d(e);for(let c=!1;;){if(s.done&&r.done)return n?new l(i,n):new o(i);if(0==s.ins)h(i,s.len,0,c),s.next();else if(0!=r.len||r.done){if(s.done||r.done)throw new Error("Mismatched change set lengths");{let t=Math.min(s.len2,r.len),e=i.length;if(-1==s.ins){let e=-1==r.ins?-1:r.off?0:r.ins;h(i,t,e,c),n&&e&&a(n,i,r.text)}else-1==r.ins?(h(i,s.off?0:s.len,t,c),n&&a(n,i,s.textBit(t))):(h(i,s.off?0:s.len,r.off?0:r.ins,c),n&&!r.off&&a(n,i,r.text));c=(s.ins>t||r.ins>=0&&r.len>t)&&(c||i.length>e),s.forward2(t),r.forward(t)}}else h(i,0,r.ins,c),n&&a(n,i,r.text),r.next()}}class d{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?n.xv.empty:t[e]}textBit(t){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length&&!t?n.xv.empty:e[i].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 p{constructor(t,e,i){this.from=t,this.to=e,this.flags=i}get anchor(){return 16&this.flags?this.to:this.from}get head(){return 16&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 4&this.flags?-1:8&this.flags?1:0}get bidiLevel(){let t=3&this.flags;return 3==t?null:t}get goalColumn(){let t=this.flags>>5;return 33554431==t?void 0:t}
1map(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,i=t.mapPos(this.from,e),n=t.mapPos(this.to,e);return i==this.from&&n==this.to?this:new p(i,n,this.flags)}extend(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(t<=this.anchor&&e>=this.anchor)return g.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return g.range(this.anchor,i)}eq(t){return this.anchor==t.anchor&&this.head==t.head}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 g.range(t.anchor,t.head)}}class g{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.ranges=t,this.mainIndex=e}map(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return t.empty?this:g.create(this.ranges.map((i=>i.map(t,e))),this.mainIndex)}eq(t){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let e=0;e<this.ranges.length;e++)if(!this.ranges[e].eq(t.ranges[e]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new g([this.main])}addRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return g.create([t].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.mainIndex,i=this.ranges.slice();return i[e]=t,g.create(i,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 g(t.ranges.map((t=>p.fromJSON(t))),t.main)}static single(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return new g([g.range(t,e)],0)}static create(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0==t.length)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;n<t.length;n++){let s=t[n];if(s.empty?s.from<=i:s.from<i)return m(t.slice(),e);i=s.to}return new g(t,e)}static cursor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;return new p(t,t,(0==e?0:e<0?4:8)|(null==i?3:Math.min(2,i))|(null!==n&&void 0!==n?n:33554431)<<5)}static range(t,e,i){let n=(null!==i&&void 0!==i?i:33554431)<<5;return e<t?new p(e,t,16|n):new p(t,e,n)}}function m(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=t[e];t.sort(((t,e)=>t.from-e.from)),e=t.indexOf(i);for(let n=1;n<t.length;n++){let i=t[n],s=t[n-1];if(i.empty?i.from<=s.to:i.from<s.to){let r=s.from,o=Math.max(i.to,s.to);n<=e&&e--,t.splice(--n,2,i.anchor>i.head?g.range(o,r):g.range(r,o))}}return new g(t,e)}function v(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let w=0;class y{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.extensions=s,this.id=w++,this.default=t([])}static define(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new y(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:b),!!t.static,t.enables)}of(t){return new x([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new x(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new x(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function b(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class x{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=w++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=t[this.id]>>1,r=2==this.type,o=!1,l=!1,h=[];for(let a of this.dependencies)"doc"==a?o=!0:"selection"==a?l=!0:0==(1&(null!==(e=t[a.id])&&void 0!==e?e:1))&&h.push(t[a.id]);return(t,e)=>{if(!e||e.reconfigured)return t.values[s]=i(t),1;{if(!(o&&e.docChanged||l&&(e.docChanged||e.selection)||h.some((e=>(1&I(t,e))>0))))return 0;let a=i(t),c=e.startState.values[s];
1return(r?function(t,e,i){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!i(t[n],e[n]))return!1;return!0}(a,c,n):n(a,c))?0:(t.values[s]=a,1)}}}}function k(t,e,i){let n=i.map((e=>t[e.id])),s=i.map((t=>t.type)),r=n.filter((t=>!(1&t))),o=t[e.id]>>1;return(t,i)=>{let l=i?i.reconfigured?i.startState.config.address[e.id]:o<<1:null,h=null==l;for(let e of r)1&I(t,e)&&(h=!0);if(!h)return 0;let a=[];for(let e=0;e<n.length;e++){let i=B(t,n[e]);if(2==s[e])for(let t of i)a.push(t);else a.push(i)}let c=e.combine(a);return null!=l&&e.compare(c,B(i.startState,l))?0:(t.values[o]=c,1)}}function S(t,e){let i=t.config.address[e];return null==i?null:i>>1}const A=y.define({static:!0});class C{constructor(t,e,i,n,s){this.id=t,this.createF=e,this.updateF=i,this.compareF=n,this.spec=s,this.provides=void 0}static define(t){let e=new C(w++,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(A).find((t=>t.field==this));return((null===e||void 0===e?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return(t,i)=>{if(!i||i.reconfigured&&null==S(i.startState,this.id))return t.values[e]=this.create(t),1;let n,s=0;i.reconfigured?(n=i.startState.values[S(i.startState,this.id)],s=1):n=i.startState.values[e];let r=this.updateF(n,i);return s||this.compareF(n,r)||(s=1),s&&(t.values[e]=r),s}}init(t){return[this,A.of({field:this,create:t})]}get extension(){return this}}const M=2,T=1,O=0;function P(t){return e=>new E(e,t)}const D={fallback:P(3),default:P(M),extend:P(T),override:P(O)};class E{constructor(t,e){this.inner=t,this.prec=e}}class R{of(t){return new L(this,t)}reconfigure(t){return R.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class L{constructor(t,e){this.compartment=t,this.inner=e}}class N{constructor(t,e,i,n,s){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=n,this.staticValues=s,this.statusTemplate=[];this.statusTemplate.length<i.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,i){let n=[],s=Object.create(null),r=new Map;for(let a of function(t,e,i){let n=[[],[],[],[]],s=new Map;function r(t,o){let l=s.get(t);if(null!=l){if(l>=o)return;let e=n[l].indexOf(t);e>-1&&n[l].splice(e,1),t instanceof L&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof L){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof E)r(t.inner,t.prec);else if(t instanceof C)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof x)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,o);else{let e=t.extension;if(!e)throw new Error("Unrecognized extension value in extension set (".concat(t,"). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks."));r(e,o)}}return r(t,M),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))a instanceof C?n.push(a):(s[a.facet.id]||(s[a.facet.id]=[])).push(a);let o=Object.create(null),l=[],h=[];for(let a of n)o[a.id]=h.length<<1,h.push((t=>a.slot(t)));for(let a in s){let t=s[a],e=t[0].facet;if(t.every((t=>0==t.type))){o[e.id]=l.length<<1|1;let n=e.combine(t.map((t=>t.value))),s=i?i.config.address[e.id]:null;if(null!=s){let t=B(i,s);e.compare(n,t)&&(n=t)}l.push(n)}else{for(let e of t)0==e.type?(o[e.id]=l.length<<1|1,l.push(e.value)):(o[e.id]=h.length<<1,h.push((t=>e.dynamicSlot(t))));o[e.id]=h.length<<1,h.push((i=>k(i,e,t)))}}return new N(t,r,h.map((t=>t(o))),o,l)}}function I(t,e){if(1&e)return 2;let i=e>>1,n=t.status[i];if(4==n)throw new Error("Cyclic dependency between fields and/or facets");if(2&n)return n;t.status[i]=4;let s=t.config.dynamicSlots[i](t,t.applying);return t.status[i]=2|s}function B(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const V=y.define(),z=y.define({combine:t=>t.some((t=>t)),static:!0}),H=y.define({combine:t=>t.length?t[0]:void 0,static:!0}),W=y.define(),j=y.define(),_=y.define();class F{constructor(t,e){this.type=t,this.value=e}static define(){return new q}}class q{of(t){return new F(this,t)}}class Q{constructor(t){this.map=t}of(t){return new $(this,t)}}class ${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 $(this.type,e)}is(t){return this.type==t}static define(){return new Q((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).map||(t=>t))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let n of t){let t=n.map(e);t&&i.push(t)}return i}}$.reconfigure=$.define(),$.appendConfig=$.define();class U{constructor(t,e,i,n,s,r){this.startState=t,this.changes=e,this.selection=i,this.effects=n,this.annotations=s,this.scrollIntoView=r,this._doc=null,this._state=null,i&&v(i,e.newLength),s.some((t=>t.type==U.time))||(this.annotations=s.concat(U.time.of(Date.now())))}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}}function G(t,e){let i=[];for(let n=0,s=0;;){let r,o;if(n<t.length&&(s==e.length||e[s]>=t[n]))r=t[n++],o=t[n++];else{if(!(s<e.length))return i;r=e[s++],o=e[s++]}!i.length||i[i.length-1]<r?i.push(r,o):i[i.length-1]<o&&(i[i.length-1]=o)}}function K(t,e,i){var n;let s,r,o;return i?(s=e.changes,r=l.empty(e.changes.length),o=t.changes.compose(e.changes)):(s=e.changes.map(t.changes),r=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(r):null===(n=t.selection)||void 0===n?void 0:n.map(s),effects:$.mapEffects(t.effects,s).concat($.mapEffects(e.effects,r)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Y(t,e,i){let n=e.selection;return{changes:e.changes instanceof l?e.changes:l.of(e.changes||[],i,t.facet(H)),selection:n&&(n instanceof g?n:g.single(n.anchor,
1n.head)),effects:Z(e.effects),annotations:Z(e.annotations),scrollIntoView:!!e.scrollIntoView}}function J(t,e,i){let n=Y(t,e.length?e[0]:{},t.doc.length);e.length&&!1===e[0].filter&&(i=!1);for(let r=1;r<e.length;r++){!1===e[r].filter&&(i=!1);let s=!!e[r].sequential;n=K(n,Y(t,e[r],s?n.changes.newLength:t.doc.length),s)}let s=new U(t,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return function(t){let e=t.startState,i=e.facet(_),n=t;for(let s=i.length-1;s>=0;s--){let r=i[s](t);r&&Object.keys(r).length&&(n=K(t,Y(e,r,t.changes.newLength),!0))}return n==t?t:new U(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}(i?function(t){let e=t.startState,i=!0;for(let s of e.facet(W)){let e=s(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:G(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=l.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.invertedDesc}t=new U(e,n,t.selection&&t.selection.map(s),$.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(j);for(let s=n.length-1;s>=0;s--){let i=n[s](t);t=i instanceof U?i:Array.isArray(i)&&1==i.length&&i[0]instanceof U?i[0]:J(e,Z(i),!1)}return t}(s):s)}U.time=F.define(),U.userEvent=F.define(),U.addToHistory=F.define(),U.remote=F.define();const X=[];function Z(t){return null==t?X:Array.isArray(t)?t:[t]}var tt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(tt||(tt={}));const et=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let it;try{it=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(ot){}function nt(t){return e=>{if(!/\S/.test(e))return tt.Space;if(function(t){if(it)return it.test(t);for(let e=0;e<t.length;e++){let i=t[e];if(/\w/.test(i)||i>"\x80"&&(i.toUpperCase()!=i.toLowerCase()||et.test(i)))return!0}return!1}(e))return tt.Word;for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>-1)return tt.Word;return tt.Other}}class st{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.config=t,this.doc=e,this.selection=i,this.applying=null,this.status=t.statusTemplate.slice(),n&&n.startState.config==t)this.values=n.startState.values.slice();else if(this.values=t.dynamicSlots.map((t=>null)),n)for(let s in t.address){let e=t.address[s],i=n.startState.config.address[s];null!=i&&0==(1&e)&&(this.values[e>>1]=B(n.startState,i))}this.applying=n,n&&(n._state=this);for(let s=0;s<this.config.dynamicSlots.length;s++)I(this,s<<1);this.applying=null}field(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.config.address[t.id];if(null!=i)return I(this,i),B(this,i);if(e)throw new RangeError("Field is not present in this state")}update(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return J(this,e,!0)}applyTransaction(t){let e=this.config,{base:i,compartments:n}=e;for(let s of t.effects)s.is(R.reconfigure)?(e&&(n=new Map,e.compartments.forEach(((t,e)=>n.set(e,t))),e=null),n.set(s.value.compartment,s.value.extension)):s.is($.reconfigure)?(e=null,i=s.value):s.is($.appendConfig)&&(e=null,i=Z(i).concat(s.value));new st(e||N.resolve(i,n,this),t.newDoc,t.newSelection,t)}replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:t},range:g.cursor(e.from+t.length)})))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),n=this.changes(i.changes),s=[i.range],r=Z(i.effects);for(let o=1;o<e.ranges.length;o++){let i=t(e.ranges[o]),l=this.changes(i.changes),h=l.map(n);for(let t=0;t<o;t++)s[t]=s[t].map(h);let a=n.mapDesc(l,!0);s.push(i.range.map(a)),n=n.compose(h),r=$.mapEffects(r,h).concat($.mapEffects(Z(i.effects),a))}return{changes:n,selection:g.create(s,e.mainIndex),effects:r}}changes(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return t instanceof l?t:l.of(t,this.doc.length,this.facet(st.lineSeparator))}toText(t){return n.xv.of(t.split(this.facet(st.lineSeparator)||s))}sliceDoc(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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:(I(this,e),B(this,e))}toJSON(t){let e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let i in t){let n=t[i];n instanceof C&&(e[i]=n.spec.toJSON(this.field(t[i]),this))}return e}static fromJSON(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(!t||"string"!=typeof t.doc)throw new RangeError("Invalid JSON representation for EditorState");let n=[];if(i)for(let s in i){let e=i[s],r=t[s];n.push(e.init((t=>e.spec.fromJSON(r,t))))}return st.create({doc:t.doc,selection:g.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=N.resolve(t.extensions||[],new Map),i=t.doc instanceof n.xv?t.doc:n.xv.of((t.doc||"").split(e.staticFacet(st.lineSeparator)||s)),r=t.selection?t.selection instanceof g?t.selection:g.single(t.selection.anchor,t.selection.head):g.single(0);return v(r,i.length),e.staticFacet(z)||(r=r.asSingle()),new st(e,i,r)}get tabSize(){return this.facet(st.tabSize)}get lineBreak(){return this.facet(st.lineSeparator)||"\n"}phrase(t){for(let e of this.facet(st.phrases))if(Object.prototype.hasOwnProperty.call(e,t))return e[t];return t}languageDataAt(t,e){let i=[];for(let n of this.facet(V))for(let s of n(this,e))Object.prototype.hasOwnProperty.call(s,t)&&i.push(s[t]);return i}charCategorizer(t){return nt(this.languageDataAt("wordChars",t).join(""))}wordAt(t){let{text:e,from:i,length:s}=this.doc.lineAt(t),r=this.charCategorizer(t),o=t-i,l=t-i;for(;o>0;){let t=(0,n.cp)(e,o,!1);if(r(e.slice(t,o))!=tt.Word)break;o=t}for(;l<s;){let t=(0,n.cp)(e,l);if(r(e.slice(l,t))!=tt.Word)break;l=t}return o==l?g.range(o+i,l+i):null}}function rt(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};for(let s of t)for(let t of Object.keys(s)){let e=s[t],r=n[t];if(void 0===r)n[t]=e;else if(r===e||void 0===e);else{if(!Object.hasOwnProperty.call(i,t))throw new Error("Config merge conflict for field "+t);n[t]=i[t](r,e)}}for(let s in e)void 0===n[s]&&(n[s]=e[s]);return n}st.allowMultipleSelections=z,st.tabSize=y.define({combine:t=>t.length?t[0]:4}),st.lineSeparator=H,st.phrases=y.define(),st.languageData=V,st.changeFilter=W,st.transactionFilter=j,st.transactionExtender=_,R.reconfigure=$.define()},78528:(t,e,i)=>{i.d(e,{Gz:()=>m,IS:()=>g,bg:()=>d,cp:()=>l,gm:()=>f,nZ:()=>p,xv:()=>v});let n="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=>
1t?parseInt(t,36):1));for(let C=1;C<n.length;C++)n[C]+=n[C-1];function s(t){for(let e=1;e<n.length;e+=2)if(n[e]>t)return n[e-1]<=t;return!1}function r(t){return t>=127462&&t<=127487}const o=8205;function l(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?h:a)(t,e)}function h(t,e){if(e==t.length)return e;e&&c(t.charCodeAt(e))&&u(t.charCodeAt(e-1))&&e--;let i=f(t,e);for(e+=p(i);e<t.length;){let n=f(t,e);if(i==o||n==o||s(n))e+=p(n),i=n;else{if(!r(n))break;{let i=0,n=e-2;for(;n>=0&&r(f(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function a(t,e){for(;e>0;){let i=h(t,e-2);if(i<e)return i;e--}return 0}function c(t){return t>=56320&&t<57344}function u(t){return t>=55296&&t<56320}function f(t,e){let i=t.charCodeAt(e);if(!u(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return c(n)?n-56320+(i-55296<<10)+65536:i}function d(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function p(t){return t<65536?1:2}function g(t,e,i){for(let n=0;n<t.length;)9==t.charCodeAt(n)?(e+=i-e%i,n++):(e++,n=l(t,n));return e}function m(t,e,i){let n=arguments[3];null!=n&&(e=i,i=n);for(let s=0,r=0;s<t.length;){if(r>=e)return s;r+=9==t.charCodeAt(s)?i-r%i:1,s=l(t,s)}return t.length}class v{constructor(){}lineAt(t){if(t<0||t>this.length)throw new RangeError("Invalid position ".concat(t," in document of length ").concat(this.length));return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError("Invalid line number ".concat(t," in ").concat(this.lines,"-line document"));return this.lineInner(t,!0,1,0)}replace(t,e,i){let n=[];return this.decompose(0,t,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(e,this.length,n,1),y.from(n,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,i=[];return this.decompose(t,e,i,0),y.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=new k(this),i=new k(t);for(;;){if(e.next(),i.next(),e.lineBreak!=i.lineBreak||e.done!=i.done||e.value!=i.value)return!1;if(e.done)return!0}}iter(){return new k(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)}iterRange(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return new S(this,t,e)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 w(t):y.from(w.split(t,[])):v.empty}}"undefined"!=typeof Symbol&&(v.prototype[Symbol.iterator]=function(){return this.iter()});class w extends v{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){let e=-1;for(let i of t)e+=i.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,i,n){for(let s=0;;s++){let r=this.text[s],o=n+r.length;if((e?i:o)>=t)return new A(n,o,i,r);n=o+1,i++}}decompose(t,e,i,n){let s=t<=0&&e>=this.length?this:new w(x(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(1&n){let t=i.pop(),e=b(s.text,t.text.slice(),0,s.length);if(e.length<=32)i.push(new w(e,t.length+s.length));else{let t=e.length>>1;i.push(new w(e.slice(0,t)),new w(e.slice(t)))}}else i.push(s)}replace(t,e,i){if(!(i instanceof w))return super.replace(t,e,i);let n=b(this.text,b(i.text,x(this.text,0,t)),e),s=this.length+i.length-(e-t);return n.length<=32?new w(n,s):y.from(w.split(n,[]),s)}sliceString(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",n="";for(let s=0,r=0;s<=e&&r<this.text.length;r++){let o=this.text[r],l=s+o.length;s>t&&r&&(n+=i),t<l&&e>s&&(n+=o.slice(Math.max(0,t-s),e-s)),s=l+1}return n}flatten(t){for(let e of this.text)t.push(e)}static split(t,e){let i=[],n=-1;for(let s of t)i.push(s),n+=s.length+1,32==i.length&&(e.push(new w(i,n)),i=[],n=-1);return n>-1&&e.push(new w(i,n)),e}}class y extends v{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let i of t)this.lines+=i.lines}lineInner(t,e,i,n){for(let s=0;;s++){let r=this.children[s],o=n+r.length,l=i+r.lines-1;if((e?l:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=l+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s<this.children.length;s++){let o=this.children[s],l=r+o.length;if(t<=l&&e>=r){let s=n&((r<=t?1:0)|(l>=e?2:0));r>=t&&l<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=l+1}}replace(t,e,i){if(i.lines<this.lines)for(let n=0,s=0;n<this.children.length;n++){let r=this.children[n],o=s+r.length;if(t>=s&&e<=o){let l=r.replace(t-s,e-s,i),h=this.lines-r.lines+l.lines;if(l.lines<h>>4&&l.lines>h>>6){let s=this.children.slice();return s[n]=l,new y(s,this.length-(e-t)+i.length)}return super.replace(s,o,l)}s=o+1}return super.replace(t,e,i)}sliceString(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",n="";for(let s=0,r=0;
1s<this.children.length&&r<=e;s++){let o=this.children[s],l=r+o.length;r>t&&s&&(n+=i),t<l&&e>r&&(n+=o.sliceString(t-r,e-r,i)),r=l+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}static from(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.reduce(((t,e)=>t+e.length+1),-1),i=0;for(let f of t)i+=f.lines;if(i<32){let i=[];for(let e of t)e.flatten(i);return new w(i,e)}let n=Math.max(32,i>>5),s=n<<1,r=n>>1,o=[],l=0,h=-1,a=[];function c(t){let e;if(t.lines>s&&t instanceof y)for(let i of t.children)c(i);else t.lines>r&&(l>r||!l)?(u(),o.push(t)):t instanceof w&&l&&(e=a[a.length-1])instanceof w&&t.lines+e.lines<=32?(l+=t.lines,h+=t.length+1,a[a.length-1]=new w(e.text.concat(t.text),e.length+1+t.length)):(l+t.lines>n&&u(),l+=t.lines,h+=t.length+1,a.push(t))}function u(){0!=l&&(o.push(1==a.length?a[0]:y.from(a,h)),h=-1,l=a.length=0)}for(let f of t)c(f);return u(),1==o.length?o[0]:new y(o,e)}}function b(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e9;for(let s=0,r=0,o=!0;r<t.length&&s<=n;r++){let l=t[r],h=s+l.length;h>=i&&(h>n&&(l=l.slice(0,n-s)),s<i&&(l=l.slice(i-s)),o?(e[e.length-1]+=l,o=!1):e.push(l)),s=h+1}return e}function x(t,e,i){return b(t,[""],e,i)}v.empty=new w([""],0);class k{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[e>0?1:(t instanceof w?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],s=this.offsets[i],r=s>>1,o=n instanceof w?n.text.length:n.children.length;if(r==(e>0?o:0)){if(0==i)return this.done=!0,this.value="",this;e>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&s)==(e>
10?0:1)){if(this.offsets[i]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(n instanceof w){let s=n.text[r+(e<0?-1:0)];if(this.offsets[i]+=e,s.length>Math.max(0,t))return this.value=0==t?s:e>0?s.slice(t):s.slice(0,s.length-t),this;t-=s.length}else{let s=n.children[r+(e<0?-1:0)];t>s.length?(t-=s.length,this.offsets[i]+=e):(e<0&&this.offsets[i]--,this.nodes.push(s),this.offsets.push(e>0?1:(s instanceof w?s.text.length:s.children.length)<<1))}}}next(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class S{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new k(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;this.done=!1,t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=i?n:e<0?n.slice(n.length-i):n.slice(0,i),this}next(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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 A{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}}},32725:(t,e,i)=>{i.d(e,{kH:()=>ft,p:()=>dt,Nm:()=>Jt,tk:()=>Oi,BF:()=>Nt,lg:()=>Vt,l9:()=>ut,Uw:()=>Ui,ZO:()=>pn,AE:()=>cn,$f:()=>zi,OO:()=>Et,$1:()=>ji});for(var n=i(89933),s=i(78528),r=i(28335),o=i(98759),l={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:"'"},h={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},a="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),c=("undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)),u="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),f=c||a&&+a[1]<57,d=0;d<10;d++)l[48+d]=l[96+d]=String(d);for(d=1;d<=24;d++)l[d+111]="F"+d;for(d=65;d<=90;d++)l[d]=String.fromCharCode(d+32),h[d]=String.fromCharCode(d);for(var p in l)h.hasOwnProperty(p)||(h[p]=l[p]);function g(t){return t.getSelection?t.getSelection():document.getSelection()}function m(t,e){return!!e&&t.contains(1!=e.nodeType?e.parentNode:e)}function v(t,e){if(!e.anchorNode)return!1;try{return m(t,e.anchorNode)}catch(i){return!1}}function w(t){return 3==t.nodeType?D(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function y(t,e,i,n){return!!i&&(x(t,e,i,n,-1)||x(t,e,i,n,1))}function b(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function x(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:k(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=b(t)+(s<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(s<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=s<0?k(t):0}}}function k(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const S={left:0,right:0,top:0,bottom:0};function A(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function C(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class M{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}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}}let T,O=null;function P(t){if(t.setActive)return t.setActive();if(O)return t.focus(O);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);
1if(t.focus(null==O?{get preventScroll(){return O={preventScroll:!0},!0}}:void 0),!O){O=!1;for(let t=0;t<e.length;){let i=e[t++],n=e[t++],s=e[t++];i.scrollTop!=n&&(i.scrollTop=n),i.scrollLeft!=s&&(i.scrollLeft=s)}}}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,n=T||(T=document.createRange());return n.setEnd(t,i),n.setStart(t,e),n}function E(t,e,i){let n={key:e,code:e,keyCode:i,which:i,cancelable:!0},s=new KeyboardEvent("keydown",n);s.synthetic=!0,t.dispatchEvent(s);let r=new KeyboardEvent("keyup",n);return r.synthetic=!0,t.dispatchEvent(r),s.defaultPrevented||r.defaultPrevented}let R=null;function L(){if(null==R){R=!1;let e=document.createElement("div");try{e.contentEditable="plaintext-only",R="plaintext-only"==e.contentEditable}catch(t){}}return R}class N{constructor(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.node=t,this.offset=e,this.precise=i}static before(t,e){return new N(t.parentNode,b(t),e)}static after(t,e){return new N(t.parentNode,b(t)+1,e)}}const I=[];class B{constructor(){this.parent=null,this.dom=null,this.dirty=2}get editorView(){if(!this.parent)throw new Error("Accessing view in orphan content view");return this.parent.editorView}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 i of this.children){if(i==t)return e;e+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}coordsAt(t,e){return null}sync(t){var e;if(2&this.dirty){let i=this.dom,n=null;for(let r of this.children){if(r.dirty){let s=n?n.nextSibling:i.firstChild;r.dom||!s||(null===(e=B.get(s))||void 0===e?void 0:e.parent)||r.reuseDOM(s),r.sync(t),r.dirty=0}t&&t.node==i&&n!=r.dom&&(t.written=!0),z(i,n,r.dom),n=r.dom}let s=n?n.nextSibling:i.firstChild;for(s&&t&&t.node==i&&(t.written=!0);s;)s=V(s)}else if(1&this.dirty)for(let i of this.children)i.dirty&&(i.sync(t),i.dirty=0)}reuseDOM(t){return!1}localPosFromDOM(t,e){let i;if(t==this.dom)i=this.dom.childNodes[e];else{let n=0==k(t)?0:0==e?-1:1;for(;;){let e=t.parentNode;if(e==this.dom)break;0==n&&e.firstChild!=e.lastChild&&(n=t==e.firstChild?-1:1),t=e}i=n<0?t:t.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!B.get(i);)i=i.nextSibling;if(!i)return this.length;for(let n=0,s=0;;n++){let t=this.children[n];if(t.dom==i)return s;s+=t.length+t.breakAfter}}domBoundsAround(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=-1,s=-1,r=-1,o=-1;for(let l=0,h=i,a=i;l<this.children.length;l++){let i=this.children[l],c=h+i.length;if(h<t&&c>e)return i.domBoundsAround(t,e,h);if(c>=t&&-1==n&&(n=l,s=h),h>e&&i.dom.parentNode==this.dom){r=l,o=a;break}a=c,h=c+i.breakAfter}return{from:s,to:o<0?i+this.length:o,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:r<this.children.length&&r>=0?this.children[r].dom:null}}markDirty(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];2&this.dirty||(this.dirty|=2,this.markParentsDirty(t))}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(t){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){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:I;this.markDirty();for(let n=t;n<e;n++){let t=this.children[n];t.parent==this&&(t.parent=null)}this.children.splice(t,e-t,...i);for(let n=0;n<i.length;n++)i[n].setParent(this)}ignoreMutation(t){return!1}ignoreEvent(t){return!1}childCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length;return new H(this.children,t,this.children.length)}childPos(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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}}function V(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}function z(t,e,i){let n=e?e.nextSibling:t.firstChild;if(i.parentNode==t)for(;n!=i;)n=V(n);else t.insertBefore(i,n)}B.prototype.breakAfter=0;class H{constructor(t,e,i){this.children=t,this.pos=e,this.i=i,this.off=0}findPos(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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 i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}let[W,j]="undefined"!=typeof navigator?[navigator,document]:[{userAgent:"",vendor:"",platform:""},{documentElement:{style:{}}}];const _=/Edge\/(\d+)/.exec(W.userAgent),F=/MSIE \d/.test(W.userAgent),q=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(W.userAgent),Q=!!(F||q||_),$=!Q&&/gecko\/(\d+)/i.test(W.userAgent),U=!Q&&/Chrome\/(\d+)/.exec(W.userAgent),G="webkitFontSmoothing"in j.documentElement.style,K=!Q&&/Apple Computer/.test(W.vendor);var Y={mac:/Mac/.test(W.platform),ie:Q,ie_version:F?j.documentMode||6:q?+q[1]:_?+_[1]:0,gecko:$,gecko_version:$?+(/Firefox\/(\d+)/.exec(W.userAgent)||[0,0])[1]:0,chrome:!!U,chrome_version:U?+U[1]:0,ios:K&&(/Mobile\/\w+/.test(W.userAgent)||W.maxTouchPoints>2),android:/Android\b/.test(W.userAgent),webkit:G,safari:K,webkit_version:G?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=j.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};const J=[];class X extends B{become(t){return!1}getSide(){return 0}}X.prototype.children=J;class Z extends X{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){return 3==t.nodeType&&(this.createDOM(t),!0)}merge(t,e,i){return(!i||i instanceof Z&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}slice(t){return new Z(this.text.slice(t))}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new N(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return et(this.dom,t,e)}}class tt extends X{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;super(),this.mark=t,this.children=e,this.length=i;for(let n of e)n.setParent(this)}createDOM(){let t=document.createElement(this.mark.tagName);if(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]);this.setDOM(t)}sync(t){this.dom||this.createDOM(),super.sync(t)}merge(t,e,i,n,s){return(!i||!(!(i instanceof tt&&i.mark.eq(this.mark))||t&&n<=0||e<this.length&&s<=0))&&(st(this,t,e,i?i.children:J,n-1,s-1),this.markDirty(),!0)}slice(t){return new tt(this.mark,function(t,e){let i=[],n=0;for(let s of t){let t=n+s.length;t>e&&i.push(n<e?s.slice(e-n):s),n=t}return i}(this.children,t),this.length-t)}domAtPos(t){return rt(this.dom,this.children,t)}coordsAt(t,e){return lt(this,t,e)}}function et(t,e,i){let n=t.nodeValue.length;e>n&&(e=n);let s=e,r=e,o=0;0==e&&i<0||e==n&&i>=0?Y.chrome||Y.gecko||(e?(s--,o=1):(r++,o=-1)):i<0?s--:r++;let l=D(t,s,r).getClientRects();if(!l.length)return S;let h=l[(o?o<0:i>=0)?0:l.length-1];return Y.safari&&!o&&0==h.width&&(h=Array.prototype.find.call(l,(t=>t.width))||h),o?A(h,o<0):h}class it extends X{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i}
1static create(t,e,i){return new(t.customView||it)(t,e,i)}slice(t){return it.create(this.widget,this.length-t,this.side)}sync(){this.dom&&this.widget.updateDOM(this.dom)||(this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}getSide(){return this.side}merge(t,e,i,n,s){return!(i&&(!(i instanceof it&&this.widget.compare(i.widget))||t>0&&n<=0||e<this.length&&s<=0))&&(this.length=t+(i?i.length:0)+(this.length-e),!0)}become(t){return t.length==this.length&&t instanceof it&&t.side==this.side&&this.widget.constructor==t.widget.constructor&&(this.widget.eq(t.widget)||this.markDirty(!0),this.widget=t.widget,!0)}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get overrideDOMText(){if(0==this.length)return s.xv.empty;let t=this;for(;t.parent;)t=t.parent;let e=t.editorView,i=e&&e.state.doc,n=this.posAtStart;return i?i.slice(n,n+this.length):s.xv.empty}domAtPos(t){return 0==t?N.before(this.dom):N.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return S;for(let s=t>0?i.length-1:0;n=i[s],!(t>0?0==s:s==i.length-1||n.top<n.bottom);s+=t>0?-1:1);return 0==t&&e>0||t==this.length&&e<=0?n:A(n,0==t)}}class nt extends it{domAtPos(t){return new N(this.widget.text,t)}sync(){this.dom||this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){return e?3==t.nodeType?Math.min(e,this.length):this.length:0}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){return et(this.widget.text,t,e)}}function st(t,e,i,n,s,r){let o=t.childCursor(),{i:l,off:h}=o.findPos(i,1),{i:a,off:c}=o.findPos(e,-1),u=e-i;for(let d of n)u+=d.length;t.length+=u;let{children:f}=t;if(a==l&&c){let t=f[a];if(1==n.length&&t.merge(c,h,n[0],s,r))return;if(0==n.length)return void t.merge(c,h,null,s,r);let e=t.slice(h);e.merge(0,0,n[n.length-1],0,r)?n[n.length-1]=e:n.push(e),l++,r=h=0}if(h){let t=f[l];n.length&&t.merge(0,h,n[n.length-1],0,r)?(n.pop(),r=n.length?0:s):t.merge(0,h,null,0,0)}else l<f.length&&n.length&&f[l].merge(0,0,n[n.length-1],0,r)&&(n.pop(),r=n.length?0:s);if(c){let t=f[a];n.length&&t.merge(c,t.length,n[0],s,0)?(n.shift(),s=n.length?0:r):t.merge(c,t.length,null,0,0),a++}else if(a&&n.length){let t=f[a-1];t.merge(t.length,t.length,n[0],s,0)&&(n.shift(),s=n.length?0:r)}for(;a<l&&n.length&&f[l-1].become(n[n.length-1]);)n.pop(),l--,r=n.length?0:s;for(;a<l&&n.length&&f[a].become(n[0]);)n.shift(),a++,s=n.length?0:r;!n.length&&a&&l<f.length&&s&&r&&f[l].merge(0,0,f[a-1],s,r)&&a--,(n.length||a!=l)&&t.replaceChildren(a,l,n)}function rt(t,e,i){let n=0;for(let s=0;n<e.length;n++){let r=e[n],o=s+r.length;if(!(o==s&&r.getSide()<=0)){if(i>s&&i<o&&r.dom.parentNode==t)return r.domAtPos(i-s);if(i<=s)break;s=o}}for(;n>0;n--){let i=e[n-1].dom;if(i.parentNode==t)return N.after(i)}return new N(t,0)}function ot(t,e,i){let n,{children:s}=t;i>0&&e instanceof tt&&s.length&&(n=s[s.length-1])instanceof tt&&n.mark.eq(e.mark)?ot(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function lt(t,e,i){for(let r=0,o=0;o<t.children.length;o++){let n=t.children[o],s=r+n.length;if(!(s==r&&n.getSide()<=0)){if(i<=0||s==t.length?s>=e:s>e)return n.coordsAt(e-r,i);r=s}}let n=t.dom.lastChild;if(!n)return t.dom.getBoundingClientRect();let s=w(n);return s[s.length-1]}function ht(t,e){for(let i in t)"class"==i&&e.class?e.class+=" "+t.class:"style"==i&&e.style?e.style+=";"+t.style:e[i]=t[i];return e}function at(t,e){if(t==e)return!0;if(!t||!e)return!1;let i=Object.keys(t),n=Object.keys(e);if(i.length!=n.length)return!1;for(let s of i)if(-1==n.indexOf(s)||t[s]!==e[s])return!1;return!0}function ct(t,e,i){if(e)for(let n in e)i&&n in i||t.removeAttribute(n);if(i)for(let n in i)e&&e[n]==i[n]||t.setAttribute(n,i[n])}class ut{eq(t){return!1}updateDOM(t){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}ignoreEvent(t){return!0}get customView(){return null}}
1var ft=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(ft||(ft={}));class dt extends o.uU{constructor(t,e,i,n){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(t){return new pt(t)}static widget(t){let e=t.side||0;return t.block&&(e+=200000001*(e>0?1:-1)),new mt(t,e,e,!!t.block,t.widget||null,!1)}static replace(t){let e=!!t.block,{start:i,end:n}=vt(t);return new mt(t,e?-2e8*(i?2:1):1e8*(i?-1:1),e?2e8*(n?2:1):1e8*(n?1:-1),e,t.widget||null,!0)}static line(t){return new gt(t)}static set(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return o.Xs.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}dt.none=o.Xs.empty;class pt extends dt{constructor(t){let{start:e,end:i}=vt(t);super(1e8*(e?-1:1),1e8*(i?1:-1),null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){return this==t||t instanceof pt&&this.tagName==t.tagName&&this.class==t.class&&at(this.attrs,t.attrs)}range(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}pt.prototype.point=!1;class gt extends dt{constructor(t){super(-1e8,-1e8,null,t)}eq(t){return t instanceof gt&&at(this.spec.attributes,t.spec.attributes)}range(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}gt.prototype.mapMode=n.gc.TrackBefore,gt.prototype.point=!0;class mt extends dt{constructor(t,e,i,s,r,o){super(e,i,r,t),this.block=s,this.isReplace=o,this.mapMode=s?e<0?n.gc.TrackBefore:n.gc.TrackAfter:n.gc.TrackDel}get type(){return this.startSide<this.endSide?ft.WidgetRange:this.startSide<0?ft.WidgetBefore:ft.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&this.widget.estimatedHeight>=5}eq(t){return t instanceof mt&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}range(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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 vt(t){let{inclusiveStart:e,inclusiveEnd:i}=t;return null==e&&(e=t.inclusive),null==i&&(i=t.inclusive),{start:e||!1,end:i||!1}}function wt(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=i.length-1;s>=0&&i[s]+n>t?i[s]=Math.max(i[s],e):i.push(t,e)}mt.prototype.point=!0;class yt extends B{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,n,s,r){if(i){if(!(i instanceof yt))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),st(this,t,e,i?i.children:bt,s,r),!0}split(t){let e=new yt;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i:i,off:n}=this.childPos(t);n&&(e.append(this.children[i].slice(n),0),this.children[i].merge(n,this.children[i].length,null,0,0),i++);for(let s=i;s<this.children.length;s++)e.append(this.children[s],0);for(;i>0&&0==this.children[i-1].length;)this.children[i-1].parent=null,i--;return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){at(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){ot(this,t,e)}addLineDeco(t){let e=t.spec.attributes;e&&(this.attrs=ht(e,this.attrs||{}))}domAtPos(t){return rt(this.dom,this.children,t)}sync(t){this.dom||(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(ct(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t);let e=this.dom.lastChild;if(!e||"BR"!=e.nodeName&&B.get(e)instanceof it&&(!Y.ios||!this.children.some((t=>t instanceof Z)))){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=0;for(let e of this.children){if(!(e instanceof Z))return null;let i=w(e.dom);if(1!=i.length)return null;t+=i[0].width}return{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length}}coordsAt(t,e){return lt(this,t,e)}match(t){return!1}get type(){return ft.Text}static find(t,e){for(let i=0,n=0;;i++){let s=t.children[i],r=n+s.length;if(r>=e){if(s instanceof yt)return s;if(s.length)return null}n=r+s.breakAfter}}}const bt=[];class xt extends B{constructor(t,e,i){super(),this.widget=t,this.length=e,this.type=i,this.breakAfter=0}merge(t,e,i,n,s,r){return!(i&&(!(i instanceof xt&&this.widget.compare(i.widget))||t>0&&s<=0||e<this.length&&r<=0))&&(this.length=t+(i?i.length:0)+(this.length-e),
1!0)}domAtPos(t){return 0==t?N.before(this.dom):N.after(this.dom,t==this.length)}split(t){let e=this.length-t;return this.length=t,new xt(this.widget,e,this.type)}get children(){return bt}sync(){this.dom&&this.widget.updateDOM(this.dom)||(this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):s.xv.empty}domBoundsAround(){return null}match(t){return t instanceof xt&&t.type==this.type&&t.widget.constructor==this.widget.constructor&&(t.widget.eq(this.widget)||this.markDirty(!0),this.widget=t.widget,this.length=t.length,this.breakAfter=t.breakAfter,!0)}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}}class kt{constructor(t,e,i){this.doc=t,this.pos=e,this.end=i,this.content=[],this.curLine=null,this.breakAtStart=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 xt&&t.type==ft.WidgetBefore)}getLine(){return this.curLine||this.content.push(this.curLine=new yt),this.curLine}addWidget(t){this.curLine=null,this.content.push(t)}finish(){this.posCovered()||this.getLine()}wrapMarks(t,e){for(let i of e)t=new tt(i,[t],t.length);return t}buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){let{value:e,lineBreak:i,done:n}=this.cursor.next(this.skip);if(this.skip=0,n)throw new Error("Ran out of text content when drawing inline views");if(i){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.curLine=null,t--;continue}this.text=e,this.textOff=0}let n=Math.min(this.text.length-this.textOff,t,512);this.getLine().append(this.wrapMarks(new Z(this.text.slice(this.textOff,this.textOff+n)),e),i),this.textOff+=n,t-=n,i=0}}span(t,e,i,n){this.buildText(e-t,i,n),this.pos=e,this.openStart<0&&(this.openStart=n)}point(t,e,i,n,s){let r=e-t;if(i instanceof mt)if(i.block){let{type:t}=i;t!=ft.WidgetAfter||this.posCovered()||this.getLine(),this.addWidget(new xt(i.widget||new St("div"),r,t))}else{let t=this.wrapMarks(it.create(i.widget||new St("span"),r,i.startSide),n);this.getLine().append(t,s)}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=s)}static build(t,e,i,n){let s=new kt(t,e,i);return s.openEnd=o.Xs.spans(n,e,i,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(),s}}class St extends ut{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}}const At=[],Ct=n.r$.define(),Mt=n.r$.define(),Tt=n.r$.define(),Ot=n.r$.define(),Pt=n.r$.define(),Dt=n.r$.define();function Et(t,e,i){let n=t.facet(Ot);n.length?n[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e)}const Rt=n.r$.define({combine:t=>!t.length||t[0]});class Lt{constructor(t,e){this.field=t,this.get=e}}class Nt{from(t){return new Lt(this,t)}static define(){return new Nt}}Nt.decorations=Nt.define(),Nt.atomicRanges=Nt.define(),Nt.scrollMargins=Nt.define();let It=0;const Bt=n.r$.define();class Vt{constructor(t,e,i){this.id=t,this.create=e,this.fields=i,this.extension=Bt.of(this)}static define(t,e){let{eventHandlers:i,provide:n,decorations:s}=e||{},r=[];if(n)for(let o of Array.isArray(n)?n:[n])r.push(o);return i&&r.push(zt.from((t=>({plugin:t,handlers:i})))),s&&r.push(Nt.decorations.from(s)),new Vt(It++,t,r)}static fromClass(t,e){return Vt.define((e=>new t(e)),e)}}const zt=Nt.define();class Ht{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}takeField(t,e){for(let{field:i,get:n}of this.spec.fields)i==t&&e.push(n(this.value))}update(t){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,!this.value.update)return this;try{this.value.update(t)}catch(e){if(Et(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(i){}return Ht.dummy}}}else try{this.value=this.spec.create(t)}catch(e){return Et(t.state,e,"CodeMirror plugin crashed"),Ht.dummy}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(i){Et(t.state,i,"CodeMirror plugin crashed")}}}Ht.dummy=new Ht(Vt.define((()=>({}))));const Wt=n.r$.define({combine:t=>t.reduce(((t,e)=>ht(e,t)),{})}),jt=n.r$.define({combine:t=>t.reduce(((t,e)=>ht(e,t)),{})}),_t=n.r$.define(),Ft=n.r$.define();class qt{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new qt(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,i=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>i.toA)){if(n.toA<i.fromA)break;
1i=i.join(n),t.splice(e-1,1)}}return t.splice(e,0,i),t}static extendWithRanges(t,e){if(0==e.length)return t;let i=[];for(let n=0,s=0,r=0,o=0;;n++){let l=n==t.length?null:t[n],h=r-o,a=l?l.fromB:1e9;for(;s<e.length&&e[s]<a;){let t=e[s],n=e[s+1],r=Math.max(o,t),l=Math.min(a,n);if(r<=l&&new qt(r+h,l+h,r,l).addToSet(i),n>a)break;s+=2}if(!l)return i;new qt(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),r=l.toA,o=l.toB}}}class Qt{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:At;this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=n.as.empty(this.startState.doc.length);for(let n of i)this.changes=this.changes.compose(n.changes);let s=[];this.changes.iterChangedRanges(((t,e,i,n)=>s.push(new qt(t,e,i,n)))),this.changedRanges=s;let r=t.hasFocus;r!=t.inputState.notifiedFocused&&(t.inputState.notifiedFocused=r,this.flags|=1),this.docChanged&&(this.flags|=2)}get viewportChanged(){return(4&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.transactions.some((t=>t.docChanged))}get selectionSet(){return this.transactions.some((t=>t.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}class $t extends B{constructor(t){super(),this.view=t,this.compositionDeco=dt.none,this.decorations=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.setDOM(t.contentDOM),this.children=[new yt],this.children[0].setParent(this),this.updateInner([new qt(0,0,0,t.state.doc.length)],this.updateDeco(),0)}get root(){return this.view.root}get editorView(){return this.view}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.every((t=>{let{fromA:e,toA:i}=t;return i<this.minWidthFrom||e>this.minWidthTo}))?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=0),this.view.inputState.composing<0?this.compositionDeco=dt.none:t.transactions.length&&(this.compositionDeco=function(t,e){let i=t.observer.selectionRange,n=i.focusNode&&Kt(i.focusNode,i.focusOffset,0);if(!n)return dt.none;let s,r,o=t.docView.nearest(n),l=n;if(o instanceof X){for(;o.parent instanceof X;)o=o.parent;s=o.posAtStart,r=s+o.length,l=o.dom}else{if(!(o instanceof yt))return dt.none;{for(;l.parentNode!=o.dom;)l=l.parentNode;let t=l.previousSibling;for(;t&&!B.get(t);)t=t.previousSibling;s=r=t?B.get(t).posAtEnd:o.posAtStart}}let h=e.mapPos(s,1),a=Math.max(h,e.mapPos(r,-1)),c=n.nodeValue,{state:u}=t;if(a-h<c.length)if(u.sliceDoc(h,Math.min(u.doc.length,h+c.length))==c)a=h+c.length;else{if(u.sliceDoc(Math.max(0,a-c.length),a)!=c)return dt.none;h=a-c.length}else if(u.sliceDoc(h,a)!=c)return dt.none;return dt.set(dt.replace({widget:new Gt(l,n)}).range(h,a))}(this.view,t.changes));let i=(Y.ie||Y.chrome)&&!this.compositionDeco.size&&t&&t.state.doc.lines!=t.startState.doc.lines,s=this.decorations,r=this.updateDeco(),l=function(t,e,i){let n=new Yt;return o.Xs.compare(t,e,i,n),n.changes}(s,r,t.changes);e=qt.extendWithRanges(e,l);let h=t.transactions.some((t=>"pointerselection"==t.annotation(n.YW.userEvent)));return 0==this.dirty&&0==e.length&&!(12&t.flags)&&t.state.selection.main.from>=this.view.viewport.from&&t.state.selection.main.to<=this.view.viewport.to?(this.updateSelection(i,h),!1):(this.updateInner(e,r,t.startState.doc.length,i,h),!0)}updateInner(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this.updateChildren(t,e,i);let{observer:r}=this.view;r.ignore((()=>{this.dom.style.height=this.view.viewState.domHeight+"px",this.dom.style.minWidth=this.minWidth?this.minWidth+"px":"";let t=Y.chrome||Y.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.sync(t),this.dirty=0,t&&(t.written||r.selectionRange.focusNode!=t.node)&&(n=!0),this.updateSelection(n,s),this.dom.style.height=""}))}updateChildren(t,e,i){let n=this.childCursor(i);for(let s=t.length-1;;s--){let i=s>=0?t[s]:null;if(!i)break;let{fromA:r,toA:o,fromB:l,toB:h}=i,{content:a,breakAtStart:c,openStart:u,openEnd:f}=kt.build(this.view.state.doc,l,h,e),{i:d,off:p}=n.findPos(o,1),{i:g,off:m}=n.findPos(r,-1);this.replaceRange(g,m,d,p,a,c,u,f)}}replaceRange(t,e,i,n,s,r,o,l){let h=this.children[t],a=s.length?s[s.length-1]:null,c=a?a.breakAfter:r;
1if(t==i&&!r&&!c&&s.length<2&&h.merge(e,n,s.length?a:null,0==e,o,l))return;let u=this.children[i];for(n<u.length||u.children.length&&0==u.children[u.children.length-1].length?(t==i&&(u=u.split(n),n=0),!c&&a&&u.merge(0,n,a,!0,0,l)?s[s.length-1]=u:((n||u.children.length&&0==u.children[0].length)&&u.merge(0,n,null,!1,0,l),s.push(u))):u.breakAfter&&(a?a.breakAfter=1:r=1),i++,h.breakAfter=r,e>0&&(!r&&s.length&&h.merge(e,h.length,s[0],!1,o,0)?h.breakAfter=s.shift().breakAfter:(e<h.length||h.children.length&&0==h.children[h.children.length-1].length)&&h.merge(e,h.length,null,!1,o,0),t++);t<i&&s.length;)if(this.children[i-1].match(s[s.length-1]))i--,s.pop();else{if(!this.children[t].match(s[0]))break;t++,s.shift()}(t<i||s.length)&&this.replaceChildren(t,i,s)}updateSelection(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&!this.mayControlSelection()||Y.ios&&this.view.inputState.rapidCompositionStart)return;let e=this.view.state.selection.main,i=this.domAtPos(e.anchor),n=e.empty?i:this.domAtPos(e.head);if(Y.gecko&&e.empty&&(1==(s=i).node.nodeType&&s.node.firstChild&&(0==s.offset||"false"==s.node.childNodes[s.offset-1].contentEditable)&&(s.offset==s.node.childNodes.length||"false"==s.node.childNodes[s.offset].contentEditable))){let e=document.createTextNode("");this.view.observer.ignore((()=>i.node.insertBefore(e,i.node.childNodes[i.offset]||null))),i=n=new N(e,0),t=!0}var s;let r=this.view.observer.selectionRange;!t&&r.focusNode&&y(i.node,i.offset,r.anchorNode,r.anchorOffset)&&y(n.node,n.offset,r.focusNode,r.focusOffset)||(this.view.observer.ignore((()=>{let t=g(this.root);if(e.empty){if(Y.gecko){let t=(s=i.node,o=i.offset,1!=s.nodeType?0:(o&&"false"==s.childNodes[o-1].contentEditable?1:0)|(o<s.childNodes.length&&"false"==s.childNodes[o].contentEditable?2:0));if(t&&3!=t){let e=Kt(i.node,i.offset,1==t?1:-1);e&&(i=new N(e,1==t?0:e.nodeValue.length))}}t.collapse(i.node,i.offset),null!=e.bidiLevel&&null!=r.cursorBidiLevel&&(r.cursorBidiLevel=e.bidiLevel)}else if(t.extend)t.collapse(i.node,i.offset),t.extend(n.node,n.offset);else{let s=document.createRange();e.anchor>e.head&&([i,n]=[n,i]),s.setEnd(n.node,n.offset),s.setStart(i.node,i.offset),t.removeAllRanges(),t.addRange(s)}var s,o})),this.view.observer.setSelectionRange(i,n)),this.impreciseAnchor=i.precise?null:new N(r.anchorNode,r.anchorOffset),this.impreciseHead=n.precise?null:new N(r.focusNode,r.focusOffset)}enforceCursorAssoc(){if(this.view.composing)return;let t=this.view.state.selection.main,e=g(this.root);if(!t.empty||!t.assoc||!e.modify)return;let i=yt.find(this,t.head);if(!i)return;let n=i.posAtStart;if(t.head==n||t.head==n+i.length)return;let s=this.coordsAt(t.head,-1),r=this.coordsAt(t.head,1);if(!s||!r||s.bottom>r.top)return;let o=this.domAtPos(t.head+t.assoc);e.collapse(o.node,o.offset),e.modify("move",t.assoc<0?"forward":"backward","lineboundary")}mayControlSelection(){return this.view.state.facet(Rt)?this.root.activeElement==this.dom:v(this.dom,this.view.observer.selectionRange)}nearest(t){for(let e=t;e;){let t=B.get(e);if(t&&t.rootView==this)return t;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;e<this.children.length-1;){let t=this.children[e];if(i<t.length||t instanceof yt)break;e++,i=0}return this.children[e].domAtPos(i)}coordsAt(t,e){for(let i=this.length,n=this.children.length-1;;n--){let s=this.children[n],r=i-s.breakAfter-s.length;if(t>r||t==r&&s.type!=ft.WidgetBefore&&s.type!=ft.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ft.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}measureVisibleLineHeights(){let t=[],{from:e,to:i}=this.view.viewState.viewport,n=Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1;for(let s=0,r=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(l>i)break;if(s>=e){t.push(o.dom.getBoundingClientRect().height);let e=o.dom.scrollWidth;e>n&&(this.minWidth=n=e,this.minWidthFrom=s,this.minWidthTo=l)}s=l+o.breakAfter}return t}measureTextSize(){for(let n of this.children)if(n instanceof yt){let t=n.measureTextSize();if(t)return t}let t,e,i=document.createElement("div");
1return i.className="cm-line",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(i);let n=w(i.firstChild)[0];t=i.getBoundingClientRect().height,e=n?n.width/27:7,i.remove()})),{lineHeight:t,charWidth:e}}childCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length,e=this.children.length;return e&&(t-=this.children[--e].length),new H(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,n=0;;n++){let s=n==e.viewports.length?null:e.viewports[n],r=s?s.from-1:this.length;if(r>i){let n=e.lineAt(r,0).bottom-e.lineAt(i,0).top;t.push(dt.replace({widget:new Ut(n),block:!0,inclusive:!0}).range(i,r))}if(!s)break;i=s.to+1}return dt.set(t)}updateDeco(){return this.decorations=[...this.view.pluginField(Nt.decorations),...this.view.state.facet(_t),this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollPosIntoView(t,e){let i=this.coordsAt(t,e);if(!i)return;let n=0,s=0,r=0,o=0;for(let l of this.view.pluginField(Nt.scrollMargins))if(l){let{left:t,right:e,top:i,bottom:h}=l;null!=t&&(n=Math.max(n,t)),null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=h&&(o=Math.max(o,h))}!function(t,e){let i=t.ownerDocument.defaultView;for(let n=t.parentNode;n;)if(1==n.nodeType){let t,s=n==document.body;if(s)t=C(i);else{if(n.scrollHeight<=n.clientHeight&&n.scrollWidth<=n.clientWidth){n=n.parentNode;continue}let e=n.getBoundingClientRect();t={left:e.left,right:e.left+n.clientWidth,top:e.top,bottom:e.top+n.clientHeight}}let r=0,o=0;if(e.top<t.top?o=-(t.top-e.top+5):e.bottom>t.bottom&&(o=e.bottom-t.bottom+5),e.left<t.left?r=-(t.left-e.left+5):e.right>t.right&&(r=e.right-t.right+5),r||o)if(s)i.scrollBy(r,o);else{if(o){let t=n.scrollTop;n.scrollTop+=o,o=n.scrollTop-t}if(r){let t=n.scrollLeft;n.scrollLeft+=r,r=n.scrollLeft-t}e={left:e.left-r,top:e.top-o,right:e.right-r,bottom:e.bottom-o}}if(s)break;n=n.assignedSlot||n.parentNode}else{if(11!=n.nodeType)break;n=n.host}}(this.dom,{left:i.left-n,top:i.top-r,right:i.right+s,bottom:i.bottom+o})}}class Ut extends ut{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}}class Gt extends ut{constructor(t,e){super(),this.top=t,this.text=e}eq(t){return this.top==t.top&&this.text==t.text}toDOM(){return this.top}ignoreEvent(){return!1}get customView(){return nt}}function Kt(t,e,i){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0&&i<=0)e=k(t=t.childNodes[e-1]);else{if(!(1==t.nodeType&&e<t.childNodes.length&&i>=0))return null;t=t.childNodes[e],e=0}}}class Yt{constructor(){this.changes=[]}compareRange(t,e){wt(t,e,this.changes)}comparePoint(t,e){wt(t,e,this.changes)}}var Jt=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Jt||(Jt={}));const Xt=Jt.LTR,Zt=Jt.RTL;function te(t){let e=[];for(let i=0;i<t.length;i++)e.push(1<<+t[i]);return e}const ee=te("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),ie=te("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ne=Object.create(null),se=[];for(let vn of["()","[]","{}"]){let t=vn.charCodeAt(0),e=vn.charCodeAt(1);ne[t]=e,ne[e]=-t}const re=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;class oe{constructor(t,e,i){this.from=t,this.to=e,this.level=i}get dir(){return this.level%2?Zt:Xt}side(t,e){return this.dir==e==t?this.to:this.from}static find(t,e,i,n){let s=-1;for(let r=0;r<t.length;r++){let o=t[r];if(o.from<=e&&o.to>=e){if(o.level==i)return r;(s<0||(0!=n?n<0?o.from<e:o.to>e:t[s].level>o.level))&&(s=r)}}if(s<0)throw new RangeError("Index out of range");return s}}const le=[];function he(t,e){let i=t.length,n=e==Xt?1:2,s=e==Xt?2:1;if(!t||1==n&&!re.test(t))return ae(i);for(let l=0,h=n,a=n;l<i;l++){let e=(r=t.charCodeAt(l))<=247?ee[r]:1424<=r&&r<=1524?2:1536<=r&&r<=1785?ie[r-1536]:1774<=r&&r<=2220?4:8192<=r&&r<=8203||8204==r?256:1;512==e?e=h:8==e&&4==a&&(e=16),le[l]=4==e?2:e,7&e&&(a=e),h=e}var r;for(let l=0,h=n,a=n;l<i;l++){let t=le[l];if(128==t)l<i-1&&h==le[l+1]&&24&h?t=le[l]=h:le[l]=256;else if(64==t){let t=l+1;for(;t<i&&64==le[t];)t++;let e=l&&8==h||t<i&&8==le[t]?1==a?1:8:256;for(let i=l;i<t;i++)le[i]=e;l=t-1}else 8==t&&1==a&&(le[l]=1);h=t,7&t&&(a=t)}for(let l,h,a,c=0,u=0,f=0;c<i;c++)if(h=ne[l=t.charCodeAt(c)])if(h<0){for(let t=u-3;t>=0;t-=3)if(se[t+1]==-h){let e=se[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(le[c]=le[se[t]]=i),u=t;break}}else{if(189==se.length)break;se[u++]=c,se[u++]=l,se[u++]=f}else if(2==(a=le[c])||1==a){let t=a==n;f=t?0:1;for(let e=u-3;e>=0;e-=3){let i=se[e+2];if(2&i)break;if(t)se[e+2]|=2;else{if(4&i)break;se[e+2]|=4}}}for(let l=0;l<i;l++)if(256==le[l]){let t=l+1;for(;t<i&&256==le[t];)t++;let e=1==(l?le[l-1]:n),s=e==(1==(t<i?le[t]:n))?e?1:2:n;for(let i=l;i<t;i++)le[i]=s;l=t-1}let o=[];if(1==n)for(let l=0;l<i;){let t=l,e=1!=le[l++];for(;l<i&&e==(1!=le[l]);)l++;if(e)for(let i=l;i>t;){let e=i,n=2!=le[--i];for(;i>t&&n==(2!=le[i-1]);)i--;o.push(new oe(i,e,n?2:1))}else o.push(new oe(t,l,0))}else for(let l=0;l<i;){let t=l,e=2==le[l++];for(;l<i&&e==(2==le[l]);)l++;o.push(new oe(t,l,e?1:2))}return o}function ae(t){return[new oe(0,t,0)]}let ce="";function ue(t,e,i,r,o){var l;let h=r.head-t.from,a=-1;if(0==h){if(!o||!t.length)return null;e[0].level!=i&&(h=e[0].side(!1,i),a=0)}else if(h==t.length){if(o)return null;let t=e[e.length-1];t.level!=i&&(h=t.side(!0,i),a=e.length-1)}a<0&&(a=oe.find(e,h,null!==(l=r.bidiLevel)&&void 0!==l?l:-1,r.assoc));let c=e[a];h==c.side(o,i)&&(c=e[a+=o?1:-1],h=c.side(!o,i));let u=o==(c.dir==i),f=(0,s.cp)(t.text,h,u);if(ce=t.text.slice(Math.min(h,f),Math.max(h,f)),f!=c.side(o,i))return n.jT.cursor(f+t.from,u?-1:1,c.level);let d=a==(o?e.length-1:0)?null:e[a+(o?1:-1)];return d||c.level==i?d&&d.level<c.level?n.jT.cursor(d.side(!o,i)+t.from,o?1:-1,d.level):n.jT.cursor(f+t.from,o?-1:1,c.level):n.jT.cursor(o?t.to:t.from,o?-1:1,i)}function fe(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function de(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function pe(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function ge(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function me(t,e){return e>
1t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function ve(t,e,i){let n,s,r,o,l,h,a,c;for(let f=t.firstChild;f;f=f.nextSibling){let t=w(f);for(let u=0;u<t.length;u++){let d=t[u];s&&pe(s,d)&&(d=ge(me(d,s.bottom),s.top));let p=fe(e,d),g=de(i,d);if(0==p&&0==g)return 3==f.nodeType?we(f,e,i):ve(f,e,i);(!n||o>g||o==g&&r>p)&&(n=f,s=d,r=p,o=g),0==p?i>d.bottom&&(!a||a.bottom<d.bottom)?(l=f,a=d):i<d.top&&(!c||c.top>d.top)&&(h=f,c=d):a&&pe(a,d)?a=me(a,d.bottom):c&&pe(c,d)&&(c=ge(c,d.top))}}if(a&&a.bottom>=i?(n=l,s=a):c&&c.top<=i&&(n=h,s=c),!n)return{node:t,offset:0};let u=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?we(n,u,i):r||"true"!=n.contentEditable?{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}:ve(n,u,i)}function we(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;l<n;l++){let n=D(t,l,l+1).getClientRects();for(let h=0;h<n.length;h++){let a=n[h];if(a.top==a.bottom)continue;o||(o=e-a.left);let c=(a.top>i?a.top-i:i-a.bottom)-1;if(a.left-1<=e&&a.right+1>=e&&c<r){let i=e>=(a.left+a.right)/2,n=i;if(Y.chrome||Y.gecko){D(t,l).getBoundingClientRect().left==a.right&&(n=!i)}if(c<=0)return{node:t,offset:l+(n?1:0)};s=l+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function ye(t,e,i){let n,{x:s,y:r}=e,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,l=t.contentDOM.getBoundingClientRect(),h=t.defaultLineHeight/2;for(let p=!1;;){if(n=t.blockAtHeight(r,l.top),n.top>r||n.bottom<r){if(o=n.top>r?-1:1,r=Math.min(n.bottom-h,Math.max(n.top+h,r)),p)return i?null:0;p=!0}if(n.type==ft.Text)break;r=o>0?n.bottom+h:n.top-h}let a=n.from;if(s=Math.max(l.left+1,Math.min(l.right-1,s)),a<t.viewport.from)return 0==t.viewport.from?0:be(t,l,n,s,r);if(a>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:be(t,l,n,s,r);let c,u=t.root,f=u.elementFromPoint(s,r),d=-1;if(f&&t.contentDOM.contains(f)&&!(t.docView.nearest(f)instanceof it))if(u.caretPositionFromPoint){let t=u.caretPositionFromPoint(s,r);t&&({offsetNode:c,offset:d}=t)}else if(u.caretRangeFromPoint){let t=u.caretRangeFromPoint(s,r);t&&(({startContainer:c,startOffset:d}=t),Y.safari&&function(t,e,i){let n;if(3!=t.nodeType||e!=(n=t.nodeValue.length))return!1;for(let s=t.nextSibling;s;s=s.nextSibling)if(1!=s.nodeType||"BR"!=s.nodeName)return!1;return D(t,n-1,n).getBoundingClientRect().left>i}(c,d,s)&&(c=void 0))}if(!c||!t.docView.dom.contains(c)){let e=yt.find(t.docView,a);({node:c,offset:d}=ve(e.dom,s,r))}return t.docView.posFromDOM(c,d)}function be(t,e,i,n,r){let o=Math.round((n-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>1.5*t.defaultLineHeight){o+=Math.floor((r-i.top)/t.defaultLineHeight)*t.viewState.heightOracle.lineLength}let l=t.state.sliceDoc(i.from,i.to);return i.from+(0,s.Gz)(l,o,t.state.tabSize)}function xe(t,e,i,s){let r=t.state.doc.lineAt(e.head),o=t.bidiSpans(r);for(let l=e,h=null;;){let e=ue(r,o,t.textDirection,l,i),a=ce;if(!e){if(r.number==(i?t.state.doc.lines:1))return l;a="\n",r=t.state.doc.line(r.number+(i?1:-1)),o=t.bidiSpans(r),e=n.jT.cursor(i?r.from:r.to)}if(h){if(!h(a))return l}else{if(!s)return e;h=s(a)}l=e}}function ke(t,e,i){let s=t.pluginField(Nt.atomicRanges);for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.from<r&&(i=e.from>i.from?n.jT.cursor(s,1):n.jT.cursor(r,-1),t=!0)}));if(!t)return i}}class Se{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.pendingIOSKey=null,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionEndedAt=0,this.rapidCompositionStart=!1,this.mouseSelection=null;for(let e in Te){let i=Te[e];t.contentDOM.addEventListener(e,(n=>{"keydown"==e&&this.keydown(t,n)||Me(t,n)&&!this.ignoreDuringComposition(n)&&(this.mustFlushObserver(n)&&t.observer.forceFlush(),this.runCustomHandlers(e,t,n)?n.preventDefault():i(t,n))})),this.registeredEvents.push(e)}this.notifiedFocused=t.hasFocus,this.ensureHandlers(t),Y.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}ensureHandlers(t){let e=this.customHandlers=t.pluginField(zt);for(let i of e)for(let e in i.handlers)this.registeredEvents.indexOf(e)<0&&"scroll"!=e&&(this.registeredEvents.push(e),t.contentDOM.addEventListener(e,(i=>{Me(t,i)&&this.runCustomHandlers(e,t,i)&&i.preventDefault()})))}runCustomHandlers(t,e,i){for(let s of this.customHandlers){let r=s.handlers[t],o=!1;if(r){try{o=r.call(s.plugin,i,e)}catch(n){Et(e.state,n)}if(o||i.defaultPrevented)return Y.android&&"keydown"==t&&13==i.keyCode&&e.observer.flushSoon(),!0}}return!1}runScrollHandlers(t,e){for(let n of this.customHandlers){let s=n.handlers.scroll;if(s)try{s.call(n.plugin,e,t)}catch(i){Et(t.state,i)}}}keydown(t,e){return this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),!!this.screenKeyEvent(t,e)||!(!Y.ios||13!=e.keyCode&&8!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey||e.synthetic)&&(this.pendingIOSKey=13==e.keyCode?"enter":"backspace",setTimeout((()=>this.flushIOSKey(t)),250),!0)}flushIOSKey(t){if(!this.pendingIOSKey)return!1;let e=t.contentDOM,i=this.pendingIOSKey;return this.pendingIOSKey=null,"enter"==i?E(e,"Enter",13):E(e,"Backspace",8)}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Y.safari&&Date.now()-this.compositionEndedAt<500)&&(this.compositionEndedAt=0,!0))}screenKeyEvent(t,e){let i=9==e.keyCode&&Date.now()<this.lastEscPress+2e3;return 27==e.keyCode?this.lastEscPress=Date.now():Ae.indexOf(e.keyCode)<0&&(this.lastEscPress=0),i}mustFlushObserver(t){return"keydown"==t.type&&229!=t.keyCode||"compositionend"==t.type&&!Y.ios}
1startMouseSelection(t,e,i){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=new Ce(this,t,e,i)}update(t){this.mouseSelection&&this.mouseSelection.update(t),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const Ae=[16,17,18,20,91,92,224,225];class Ce{constructor(t,e,i,s){this.inputState=t,this.view=e,this.style=s,this.lastEvent=i;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=i.shiftKey,this.multiple=e.state.facet(n.yy.allowMultipleSelections)&&function(t,e){let i=t.state.facet(Ct);return i.length?i[0](e):Y.mac?e.metaKey:e.ctrlKey}(e,i),this.dragMove=function(t,e){let i=t.state.facet(Mt);return i.length?i[0](e):Y.mac?!e.altKey:!e.ctrlKey}(e,i),this.dragging=!!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=g(t.root);if(0==n.rangeCount)return!0;let s=n.getRangeAt(0).getClientRects();for(let r=0;r<s.length;r++){let t=s[r];if(t.left<=e.clientX&&t.right>=e.clientX&&t.top<=e.clientY&&t.bottom>=e.clientY)return!0}return!1}(e,i)&&null,!1===this.dragging&&(i.preventDefault(),this.select(i))}move(t){if(0==t.buttons)return this.destroy();!1===this.dragging&&this.select(this.lastEvent=t)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.inputState.mouseSelection=null}select(t){let e=this.style.get(t,this.extend,this.multiple);e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,annotations:n.YW.userEvent.of("pointerselection"),scrollIntoView:!0})}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Me(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i,n=e.target;n!=t.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(i=B.get(n))&&i.ignoreEvent(e))return!1;return!0}const Te=Object.create(null),Oe=Y.ie&&Y.ie_version<15||Y.ios&&Y.webkit_version<604;function Pe(t,e){let i,{state:s}=t,r=1,o=s.toText(e),l=o.lines==s.selection.ranges.length;if(je&&s.selection.ranges.every((t=>t.empty))&&je==o.toString()){let t=-1;i=s.changeByRange((i=>{let h=s.doc.lineAt(i.from);if(h.from==t)return{range:i};t=h.from;let a=s.toText((l?o.line(r++).text:e)+s.lineBreak);return{changes:{from:h.from,insert:a},range:n.jT.cursor(i.from+a.length)}}))}else i=l?s.changeByRange((t=>{let e=o.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:n.jT.cursor(t.from+e.length)}})):s.replaceSelection(o);t.dispatch(i,{annotations:n.YW.userEvent.of("paste"),scrollIntoView:!0})}Te.keydown=(t,e)=>{t.inputState.setSelectionOrigin("keyboardselection")};let De=0;function Ee(t,e,i,r){if(1==r)return n.jT.cursor(e,i);if(2==r)return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=t.charCategorizer(e),o=t.doc.lineAt(e),l=e-o.from;if(0==o.length)return n.jT.cursor(e);0==l?i=1:l==o.length&&(i=-1);let h=l,a=l;i<0?h=(0,s.cp)(o.text,l,!1):a=(0,s.cp)(o.text,l);let c=r(o.text.slice(h,a));for(;h>0;){let t=(0,s.cp)(o.text,h,!1);if(r(o.text.slice(t,h))!=c)break;h=t}for(;a<o.length;){let t=(0,s.cp)(o.text,a);if(r(o.text.slice(a,t))!=c)break;a=t}return n.jT.range(h+o.from,a+o.from)}(t.state,e,i);{let i=yt.find(t.docView,e),s=t.state.doc.lineAt(i?i.posAtEnd:e),r=i?i.posAtStart:s.from,o=i?i.posAtEnd:s.to;return o<t.state.doc.length&&o==s.to&&o++,n.jT.range(r,o)}}Te.touchstart=(t,e)=>{De=Date.now(),t.inputState.setSelectionOrigin("pointerselection")},Te.touchmove=t=>{t.inputState.setSelectionOrigin("pointerselection")},Te.mousedown=(t,e)=>{if(t.observer.flush(),De>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(Tt))if(i=n(t,e),i)break;i||0!=e.button||(i=function(t,e){let i=Ie(t,e),s=function(t){if(!Be)return t.detail;let e=Ve,i=He;return Ve=t,He=Date.now(),ze=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(ze+1)%3:1}(e),r=t.state.selection,o=i,l=e;return{update(t){t.changes&&(i&&(i.pos=t.changes.mapPos(i.pos)),r=r.map(t.changes),l=null)},get(e,h,a){let c;if(l&&e.clientX==l.clientX&&e.clientY==l.clientY?c=o:(c=o=Ie(t,e),l=e),!c||!i)return r;let u=Ee(t,c.pos,c.bias,s);if(i.pos!=c.pos&&!h){let e=Ee(t,i.pos,i.bias,s),r=Math.min(e.from,u.from),o=Math.max(e.to,u.to);u=r<u.from?n.jT.range(r,o):n.jT.range(o,r)}return h?r.replaceRange(r.main.extend(u.from,u.to)):a?r.addRange(u):n.jT.create([u])}}}(t,e)),i&&(t.root.activeElement!=t.contentDOM&&t.observer.ignore((()=>
1P(t.contentDOM))),t.inputState.startMouseSelection(t,e,i))};let Re=(t,e)=>t>=e.top&&t<=e.bottom,Le=(t,e,i)=>Re(e,i)&&t>=i.left&&t<=i.right;function Ne(t,e,i,n){let s=yt.find(t.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(0==r)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&Le(i,n,o))return-1;let l=s.coordsAt(r,1);return l&&Le(i,n,l)?1:o&&Re(n,o)?-1:1}function Ie(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:Ne(t,i,e.clientX,e.clientY)}}const Be=Y.ie&&Y.ie_version<=11;let Ve=null,ze=0,He=0;function We(t,e,i,s){let r=t.posAtCoords({x:e.clientX,y:e.clientY});if(null==r||!i)return;e.preventDefault();let{mouseSelection:o}=t.inputState,l=s&&o&&o.dragging&&o.dragMove?{from:o.dragging.from,to:o.dragging.to}:null,h={from:r,insert:i},a=t.state.changes(l?[l,h]:h);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},annotations:n.YW.userEvent.of("drop")})}Te.dragstart=(t,e)=>{let{selection:{main:i}}=t.state,{mouseSelection:n}=t.inputState;n&&(n.dragging=i),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove")},Te.drop=(t,e)=>{if(!e.dataTransfer||!t.state.facet(Rt))return;let i=e.dataTransfer.files;if(i&&i.length){e.preventDefault();let n=Array(i.length),s=0,r=()=>{++s==i.length&&We(t,e,n.filter((t=>null!=t)).join(t.state.lineBreak),!1)};for(let t=0;t<i.length;t++){let e=new FileReader;e.onerror=r,e.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(n[t]=e.result),r()},e.readAsText(i[t])}}else We(t,e,e.dataTransfer.getData("Text"),!0)},Te.paste=(t,e)=>{if(!t.state.facet(Rt))return;t.observer.flush();let i=Oe?null:e.clipboardData,n=i&&i.getData("text/plain");n?(Pe(t,n),e.preventDefault()):function(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout((()=>{t.focus(),i.remove(),Pe(t,i.value)}),50)}(t)};let je=null;function _e(t,e){if(t.docView.compositionDeco.size){t.inputState.rapidCompositionStart=e;try{t.update([])}finally{t.inputState.rapidCompositionStart=!1}}}Te.copy=Te.cut=(t,e)=>{let{text:i,ranges:s,linewise:r}=function(t){let e=[],i=[],n=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),i.push(s));if(!e.length){let s=-1;for(let{from:n}of t.selection.ranges){let r=t.doc.lineAt(n);r.number>s&&(e.push(r.text),i.push({from:r.from,to:Math.min(t.doc.length,r.to+1)})),s=r.number}n=!0}return{text:e.join(t.lineBreak),ranges:i,linewise:n}}(t.state);if(!i)return;je=r?i:null;let o=Oe?null:e.clipboardData;o?(e.preventDefault(),o.clearData(),o.setData("text/plain",i)):function(t,e){let i=t.dom.parentNode;if(!i)return;let n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout((()=>{n.remove(),t.focus()}),50)}(t,i),"cut"==e.type&&t.state.facet(Rt)&&t.dispatch({changes:s,scrollIntoView:!0,annotations:n.YW.userEvent.of("cut")})},Te.focus=Te.blur=t=>{setTimeout((()=>{t.hasFocus!=t.inputState.notifiedFocused&&t.update([])}),10)},Te.beforeprint=t=>{t.viewState.printing=!0,t.requestMeasure(),setTimeout((()=>{t.viewState.printing=!1,t.requestMeasure()}),2e3)},Te.compositionstart=Te.compositionupdate=t=>{t.inputState.composing<0&&(t.docView.compositionDeco.size&&(t.observer.flush(),_e(t,!0)),t.inputState.composing=0)},Te.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),setTimeout((()=>{t.inputState.composing<0&&_e(t,!1)}),50)},Te.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};const Fe=["pre-wrap","normal","pre-line"];class qe{constructor(){this.doc=s.xv.empty,this.lineWrapping=!1,this.direction=Jt.LTR,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength)),this.lineHeight*i}heightForLine(t){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefresh(t,e,i){let n=!1;for(let s=0;s<t.length;s++){let e=t[s];e<0?s++:this.heightSamples[Math.floor(10*e)]||(n=!0,this.heightSamples[Math.floor(10*e)]=!0)}return n||Fe.indexOf(e)>-1!=this.lineWrapping||this.direction!=i}refresh(t,e,i,n,s,r){let o=Fe.indexOf(t)>-1,l=Math.round(i)!=Math.round(this.lineHeight)||this.lineWrapping!=o||this.direction!=e;if(this.lineWrapping=o,this.direction=e,this.lineHeight=i,this.charWidth=n,this.lineLength=s,l){this.heightSamples={};for(let t=0;t<r.length;t++){let e=r[t];e<0?t++:this.heightSamples[Math.floor(10*e)]=!0}}return l}}class Qe{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class $e{constructor(t,e,i,n,s){this.from=t,this.length=e,this.top=i,this.height=n,this.type=s}get to(){return this.from+this.length}get bottom(){return this.top+this.height}join(t){let e=(Array.isArray(this.type)?this.type:[this]).concat(Array.isArray(t.type)?t.type:[t]);return new $e(this.from,this.length+t.length,this.top,this.height+t.height,e)}}var Ue=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Ue||(Ue={}));class Ge{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;this.length=t,this.height=e,this.flags=i}get outdated(){return(2&this.flags)>0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>1e-4&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return Ge.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,n){let s=this;for(let r=n.length-1;r>=0;r--){let{fromA:o,toA:l,fromB:h,toB:a}=n[r],c=s.lineAt(o,Ue.ByPosNoHeight,e,0,0),u=c.to>=l?c:s.lineAt(l,Ue.ByPosNoHeight,e,0,0);for(a+=u.to-l,l=u.to;r>0&&c.from<=n[r-1].toA;)o=n[r-1].fromA,h=n[r-1].fromB,r--,o<c.from&&(c=s.lineAt(o,Ue.ByPosNoHeight,e,0,0));h+=c.from-o,o=c.from;let f=ti.build(i,t,h,a);s=s.replace(o,l,f)}return s.updateHeight(i,0)}static empty(){return new Ye(0,0)}static of(t){if(1==t.length)return t[0];let e=0,i=t.length,n=0,s=0;for(;;)if(e==i)if(n>2*s){let s=t[e-1];s.break?t.splice(--e,1,s.left,null,s.right):t.splice(--e,1,s.left,s.right),i+=1+s.break,n-=s.size}else{if(!(s>2*n))break;{let e=t[i];e.break?t.splice(i,1,e.left,null,e.right):t.splice(i,1,e.left,e.right),i+=2+e.break,s-=e.size}}else if(n<s){let i=t[e++];i&&(n+=i.size)}else{let e=t[--i];e&&(s+=e.size)}let r=0;return null==t[e-1]?(r=1,e--):null==t[e]&&(r=1,i++),new Xe(Ge.of(t.slice(0,e)),r,Ge.of(t.slice(i)))}}Ge.prototype.size=1;class Ke extends Ge{constructor(t,e,i){super(t,e),this.type=i}blockAt(t,e,i,n){return new $e(n,this.length,i,this.height,this.type)}lineAt(t,e,i,n,s){return this.blockAt(0,i,n,s)}
1forEachLine(t,e,i,n,s,r){r(this.blockAt(0,i,n,s))}updateHeight(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>3?arguments[3]:void 0;return i&&i.from<=e&&i.more&&this.setHeight(t,i.heights[i.index++]),this.outdated=!1,this}toString(){return"block(".concat(this.length,")")}}class Ye extends Ke{constructor(t,e){super(t,e,ft.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof Ye||n instanceof Je&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof Je?n=new Ye(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Ge.of(i)}updateHeight(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;return n&&n.from<=e&&n.more?this.setHeight(t,n.heights[n.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}toString(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}class Je extends Ge{constructor(t){super(t,0)}lines(t,e){let i=t.lineAt(e).number,n=t.lineAt(e+this.length).number;return{firstLine:i,lastLine:n,lineHeight:this.height/(n-i+1)}}blockAt(t,e,i,n){let{firstLine:s,lastLine:r,lineHeight:o}=this.lines(e,n),l=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:h,length:a}=e.line(s+l);return new $e(h,a,i+o*l,o,ft.Text)}lineAt(t,e,i,n,s){if(e==Ue.ByHeight)return this.blockAt(t,i,n,s);if(e==Ue.ByPosNoHeight){let{from:e,to:n}=i.lineAt(t);return new $e(e,n-e,0,0,ft.Text)}let{firstLine:r,lineHeight:o}=this.lines(i,s),{from:l,length:h,number:a}=i.lineAt(t);return new $e(l,h,n+o*(a-r),o,ft.Text)}forEachLine(t,e,i,n,s,r){let{firstLine:o,lineHeight:l}=this.lines(i,s);for(let h=Math.max(t,s),a=Math.min(s+this.length,e);h<=a;){let e=i.lineAt(h);h==t&&(n+=l*(e.number-o)),r(new $e(e.from,e.length,n,l,ft.Text)),n+=l,h=e.to+1}}replace(t,e,i){let n=this.length-e;if(n>0){let t=i[i.length-1];t instanceof Je?i[i.length-1]=new Je(t.length+n):i.push(null,new Je(n-1))}if(t>0){let e=i[0];e instanceof Je?i[0]=new Je(t+e.length):i.unshift(new Je(t-1),null)}return Ge.of(i)}decomposeLeft(t,e){e.push(new Je(t-1),null)}decomposeRight(t,e){e.push(null,new Je(this.length-t-1))}updateHeight(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0,s=e+this.length;if(n&&n.from<=e+this.length&&n.more){let i=[],r=Math.max(e,n.from);for(n.from>e&&i.push(new Je(n.from-e-1).updateHeight(t,e));r<=s&&n.more;){let e=t.doc.lineAt(r).length;i.length&&i.push(null);let s=new Ye(e,n.heights[n.index++]);s.outdated=!1,i.push(s),r+=e+1}return r<=s&&i.push(null,new Je(s-r).updateHeight(t,r)),t.heightChanged=!0,Ge.of(i)}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return"gap(".concat(this.length,")")}}class Xe extends Ge{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return 1&this.flags}blockAt(t,e,i,n){let s=i+this.left.height;return t<s||0==this.right.height?this.left.blockAt(t,e,i,n):this.right.blockAt(t,e,s,n+this.left.length+this.break)}lineAt(t,e,i,n,s){let r=n+this.left.height,o=s+this.left.length+this.break,l=e==Ue.ByHeight?t<r||0==this.right.height:t<o,h=l?this.left.lineAt(t,e,i,n,s):this.right.lineAt(t,e,i,r,o);if(this.break||(l?h.to<o:h.from>o))return h;let a=e==Ue.ByPosNoHeight?Ue.ByPosNoHeight:Ue.ByPos;return l?h.join(this.right.lineAt(o,a,i,r,o)):this.left.lineAt(o,a,i,n,s).join(h)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,l=s+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,e,i,n,s,r),e>=l&&this.right.forEachLine(t,e,i,o,l,r);else{let h=this.lineAt(l,Ue.ByPos,i,n,s);t<h.from&&this.left.forEachLine(t,h.from-1,i,n,s,r),h.to>=t&&h.from<=e&&r(h),e>h.to&&this.right.forEachLine(h.to+1,e,i,o,l,r)}}replace(t,e,i){let n=this.left.length+this.break;if(e<n)return this.balanced(this.left.replace(t,e,i),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,i));let s=[];t>0&&this.decomposeLeft(t,s);let r=s.length;for(let o of i)s.push(o);if(t>0&&Ze(s,r-1),e<this.length){let t=s.length;this.decomposeRight(e,s),Ze(s,t)}return Ge.of(s)}decomposeLeft(t,e){let i=this.left.length;if(t<=i)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&(i++,t>=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,n=i+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t<i&&this.left.decomposeRight(t,e),this.break&&t<n&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?Ge.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=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){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0,{left:s,right:r}=this,o=e+s.length+this.break,l=null;return n&&n.from<=e+s.length&&n.more?l=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?l=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),l?this.balanced(s,r):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ze(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof Je&&(n=t[e+1])instanceof Je&&t.splice(e-1,3,new Je(i.length+1+n.length))}class ti{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),i=this.nodes[this.nodes.length-1];i instanceof Ye?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new Ye(t-this.pos,-1)),this.writtenTo=t,e>t&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t<e||i.heightRelevant){let n=i.widget?Math.max(0,i.widget.estimatedHeight):0,s=e-t;i.block?this.addBlock(new Ke(s,n,i.type)):(s||n>=5)&&this.addLineDeco(n,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 Ye(this.pos-t,-1)),this.writtenTo=this.pos}
1blankContent(t,e){let i=new Je(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Ye)return t;let e=new Ye(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ft.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ft.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof Ye||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Ye(0,-1));let i=t;for(let n of this.nodes)n instanceof Ye&&n.updateHeight(this.oracle,i),i+=n?n.length:1;return this.nodes}static build(t,e,i,n){let s=new ti(i,t);return o.Xs.spans(e,i,n,s,0),s.finish(i)}}class ei{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,i,n){(t<e||i&&i.heightRelevant||n&&n.heightRelevant)&&wt(t,e,this.changes,5)}}class ii{constructor(t,e,i){this.from=t,this.to=e,this.size=i}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let n=t[i],s=e[i];if(n.from!=s.from||n.to!=s.to||n.size!=s.size)return!1}return!0}draw(t){return dt.replace({widget:new ni(this.size,t)}).range(this.from,this.to)}}class ni extends ut{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 si{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.contentWidth=0,this.heightOracle=new qe,this.scaler=ai,this.scrollTo=null,this.printing=!1,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1,this.heightMap=Ge.empty().applyChanges(t.facet(_t),s.xv.empty,this.heightOracle.setDoc(t.doc),[new qt(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=dt.set(this.lineGaps.map((t=>t.draw(!1)))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let n=i?e.head:e.anchor;if(!t.some((t=>{let{from:e,to:i}=t;return n>=e&&n<=i}))){let{from:e,to:i}=this.lineAt(n,0);t.push(new ri(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?ai:new ci(this.heightOracle.doc,this.heightMap,this.viewports)}update(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.state;this.state=t.state;let s=this.state.facet(_t),r=t.changedRanges,l=qt.extendWithRanges(r,function(t,e,i){let n=new ei;return o.Xs.compare(t,e,i,n,0),n.changes}(t.startState.facet(_t),s,t?t.changes:n.as.empty(this.state.doc.length))),h=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(s,i.doc,this.heightOracle.setDoc(this.state.doc),l),this.heightMap.height!=h&&(t.flags|=2);let a=l.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.head<a.from||e.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,e)),a.eq(this.viewport)||(this.viewport=a,t.flags|=4),this.updateForViewport(),(this.lineGaps.length||this.viewport.to-this.viewport.from>15e3)&&(t.flags|=this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes)))),this.computeVisibleRanges(),e&&(this.scrollTo=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&(this.mustEnforceCursorAssoc=!0)}measure(t,e){let i=t.dom,n="",s=Jt.LTR;if(!e){let t=window.getComputedStyle(i);n=t.whiteSpace,s="rtl"==t.direction?Jt.RTL:Jt.LTR,this.paddingTop=parseInt(t.paddingTop)||0,this.paddingBottom=parseInt(t.paddingBottom)||
10}let r=this.printing?{top:-1e8,bottom:1e8,left:-1e8,right:1e8}:function(t,e){let i=t.getBoundingClientRect(),n=Math.max(0,i.left),s=Math.min(innerWidth,i.right),r=Math.max(0,i.top),o=Math.min(innerHeight,i.bottom);for(let l=t.parentNode;l;)if(1==l.nodeType){let t=window.getComputedStyle(l);if((l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth)&&"visible"!=t.overflow){let t=l.getBoundingClientRect();n=Math.max(n,t.left),s=Math.min(s,t.right),r=Math.max(r,t.top),o=Math.min(o,t.bottom)}l="absolute"==t.position||"fixed"==t.position?l.offsetParent:l.parentNode}else{if(11!=l.nodeType)break;l=l.host}return{left:n-i.left,right:s-i.left,top:r-(i.top+e),bottom:o-(i.top+e)}}(i,this.paddingTop),o=r.top-this.pixelViewport.top,l=r.bottom-this.pixelViewport.bottom;if(this.pixelViewport=r,this.inView=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left,!this.inView)return 0;let h=t.measureVisibleLineHeights(),a=!1,c=0,u=0,f=this.heightOracle;if(!e){let e=t.dom.clientWidth;if(f.mustRefresh(h,n,s)||f.lineWrapping&&Math.abs(e-this.contentWidth)>f.charWidth){let{lineHeight:i,charWidth:r}=t.measureTextSize();a=f.refresh(n,s,i,r,e/r,h),a&&(t.minWidth=0,u|=16)}this.contentWidth!=e&&(this.contentWidth=e,u|=16),o>0&&l>0?c=Math.max(o,l):o<0&&l<0&&(c=Math.min(o,l))}if(f.heightChanged=!1,this.heightMap=this.heightMap.updateHeight(f,0,a,new Qe(this.viewport.from,h)),f.heightChanged&&(u|=2),!this.viewportIsAppropriate(this.viewport,c)||this.scrollTo&&(this.scrollTo.head<this.viewport.from||this.scrollTo.head>this.viewport.to)){let t=this.getViewport(c,this.scrollTo);t.from==this.viewport.from&&t.to==this.viewport.to||(this.viewport=t,u|=4)}return this.updateForViewport(),(this.lineGaps.length||this.viewport.to-this.viewport.from>15e3)&&(u|=this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps))),this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top,0)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom,0)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,s=this.state.doc,{visibleTop:r,visibleBottom:o}=this,l=new ri(n.lineAt(r-1e3*i,Ue.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Ue.ByHeight,s,0,0).to);if(e)if(e.head<l.from){let{top:t}=n.lineAt(e.head,Ue.ByPos,s,0,0);l=new ri(n.lineAt(t-500,Ue.ByHeight,s,0,0).from,n.lineAt(t+(o-r)+500,Ue.ByHeight,s,0,0).to)}else if(e.head>l.to){let{bottom:t}=n.lineAt(e.head,Ue.ByPos,s,0,0);l=new ri(n.lineAt(t-(o-r)-500,Ue.ByHeight,s,0,0).from,n.lineAt(t+500,Ue.ByHeight,s,0,0).to)}return l}mapViewport(t,e){let i=e.mapPos(t.from,-1),n=e.mapPos(t.to,1);return new ri(this.heightMap.lineAt(i,Ue.ByPos,this.state.doc,0,0).from,this.heightMap.lineAt(n,Ue.ByPos,this.state.doc,0,0).to)}viewportIsAppropriate(t){let{from:e,to:i}=t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,{top:s}=this.heightMap.lineAt(e,Ue.ByPos,this.state.doc,0,0),{bottom:r}=this.heightMap.lineAt(i,Ue.ByPos,this.state.doc,0,0),{visibleTop:o,visibleBottom:l}=this;return(0==e||s<=o-Math.max(10,Math.min(-n,250)))&&(i==this.state.doc.length||r>=l+Math.max(10,Math.min(n,250)))&&s>o-2e3&&r<l+2e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let i=[];for(let n of t)e.touchesRange(n.from,n.to)||i.push(new ii(e.mapPos(n.from),e.mapPos(n.to),n.size));return i}ensureLineGaps(t){let e=[];return this.heightOracle.direction!=Jt.LTR||this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.state.doc,0,0,(i=>{if(i.length<1e4)return;let n,s,r=function(t,e,i){let n=[],s=t,r=0;o.Xs.spans(i.facet(_t),t,e,{span(){},point(t,e){t>s&&(n.push({from:s,to:t}),r+=t-s),s=e}},20),s<e&&(n.push({from:s,to:e}),r+=e-s);return{total:r,ranges:n}}(i.from,i.to,this.state);if(r.total<1e4)return;if(this.heightOracle.lineWrapping)n=i.from!=this.viewport.from?i.from:oi(r,(this.visibleTop-i.top)/i.height),s=i.to!=this.viewport.to?i.to:oi(r,(this.visibleBottom-i.top)/i.height);else{let t=r.total*this.heightOracle.charWidth;n=oi(r,this.pixelViewport.left/t),s=oi(r,this.pixelViewport.right/t)}let l=this.state.selection.main;l.from<=n&&l.to>=i.from&&(n=l.from),l.from<=i.to&&l.to>=s&&(s=l.to);let h=n-1e4,a=s+1e4;h>i.from+5e3&&e.push(hi(t,(t=>t.from==i.from&&t.to>h-5e3&&t.to<h+5e3))||new ii(i.from,h,this.gapSize(i,h,!0,r))),a<i.to-5e3&&e.push(hi(t,(t=>t.to==i.to&&t.from>a-5e3&&t.from<a+5e3))||new ii(a,i.to,this.gapSize(i,a,!1,r)))})),e}gapSize(t,e,i,n){if(this.heightOracle.lineWrapping){let s=t.height*li(n,e);return i?s:t.height-s}{let t=li(n,e);return n.total*this.heightOracle.charWidth*(i?t:1-t)}}updateLineGaps(t){return ii.same(t,this.lineGaps)?0:(this.lineGaps=t,this.lineGapDeco=dt.set(t.map((t=>t.draw(this.heightOracle.lineWrapping)))),8)}computeVisibleRanges(){let t=this.state.facet(_t);this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];o.Xs.spans(t,this.viewport.from,this.viewport.to,{span(t,i){e.push({from:t,to:i})}
1,point(){}},20),this.visibleRanges=e}lineAt(t,e){return e+=this.paddingTop,ui(this.heightMap.lineAt(t,Ue.ByPos,this.state.doc,e,0),this.scaler,e)}lineAtHeight(t,e){return e+=this.paddingTop,ui(this.heightMap.lineAt(this.scaler.fromDOM(t,e),Ue.ByHeight,this.state.doc,e,0),this.scaler,e)}blockAtHeight(t,e){return e+=this.paddingTop,ui(this.heightMap.blockAt(this.scaler.fromDOM(t,e),this.state.doc,e,0),this.scaler,e)}forEachLine(t,e,i,n){return n+=this.paddingTop,this.heightMap.forEachLine(t,e,this.state.doc,n,0,1==this.scaler.scale?i:t=>i(ui(t,this.scaler,n)))}get contentHeight(){return this.domHeight+this.paddingTop+this.paddingBottom}get domHeight(){return this.scaler.toDOM(this.heightMap.height,this.paddingTop)}}class ri{constructor(t,e){this.from=t,this.to=e}eq(t){return this.from==t.from&&this.to==t.to}}function oi(t,e){let{total:i,ranges:n}=t;if(e<=0)return n[0].from;if(e>=1)return n[n.length-1].to;let s=Math.floor(i*e);for(let r=0;;r++){let{from:t,to:e}=n[r],i=e-t;if(s<=i)return t+s;s-=i}}function li(t,e){let i=0;for(let{from:n,to:s}of t.ranges){if(e<=s){i+=e-n;break}i+=s-n}return i/t.total}function hi(t,e){for(let i of t)if(e(i))return i}const ai={toDOM:t=>t,fromDOM:t=>t,scale:1};class ci{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((i=>{let{from:s,to:r}=i,o=e.lineAt(s,Ue.ByPos,t,0,0).top,l=e.lineAt(r,Ue.ByPos,t,0,0).bottom;return n+=l-o,{from:s,to:r,top:o,bottom:l,domTop:0,domBottom:0}})),this.scale=(7e6-n)/(e.height-n);for(let o of this.viewports)o.domTop=r+(o.top-s)*this.scale,r=o.domBottom=o.domTop+(o.bottom-o.top),s=o.bottom}toDOM(t,e){t-=e;for(let i=0,n=0,s=0;;i++){let r=i<this.viewports.length?this.viewports[i]:null;if(!r||t<r.top)return s+(t-n)*this.scale+e;if(t<=r.bottom)return r.domTop+(t-r.top)+e;n=r.bottom,s=r.domBottom}}fromDOM(t,e){t-=e;for(let i=0,n=0,s=0;;i++){let r=i<this.viewports.length?this.viewports[i]:null;if(!r||t<r.domTop)return n+(t-s)/this.scale+e;if(t<=r.domBottom)return r.top+(t-r.domTop)+e;n=r.bottom,s=r.domBottom}}}function ui(t,e,i){if(1==e.scale)return t;let n=e.toDOM(t.top,i),s=e.toDOM(t.bottom,i);return new $e(t.from,t.length,n,s-n,Array.isArray(t.type)?t.type.map((t=>ui(t,e,i))):t.type)}const fi=n.r$.define({combine:t=>t.join(" ")}),di=n.r$.define({combine:t=>t.indexOf(!0)>-1}),pi=r.V.newName(),gi=r.V.newName(),mi=r.V.newName(),vi={"&light":"."+gi,"&dark":"."+mi};function wi(t,e,i){return new r.V(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,(e=>{if("&"==e)return t;if(!i||!i[e])throw new RangeError("Unsupported selector: ".concat(e));return i[e]})):t+" "+e})}const yi=wi("."+pi,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,minHeight:"100%",display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none"},".cm-lineWrapping":{whiteSpace:"pre-wrap",wordBreak:"break-word",overflowWrap:"anywhere"},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 4px"},".cm-selectionLayer":{zIndex:-1,contain:"size style"},".cm-selectionBackground":{position:"absolute"},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{zIndex:100,contain:"size style",pointerEvents:"none"},"&.cm-focused .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{visibility:"hidden"},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{visibility:"hidden"},"100%":{}},".cm-cursor":{position:"absolute",borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none",display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},"&.cm-focused .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#f3f9ff"},"&dark .cm-activeLine":{backgroundColor:"#223039"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-placeholder":{color:"#888",display:"inline-block"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"3px"},"&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"}},vi),bi={childList:!0,characterData:!0,subtree:!0,characterDataOldValue:!0},xi=Y.ie&&Y.ie_version<=11;class ki{constructor(t,e,i){this.view=t,this.onChange=e,this.onScrollChanged=i,this.active=!1,this.ignoreSelection=new M,this.delayedFlush=-1,this.queue=[],this.lastFlush=0,this.scrollTargets=[],this.intersection=null,this.intersecting=!1,this._selectionRange=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver((e=>{for(let t of e)this.queue.push(t);this._selectionRange=null,(Y.ie&&Y.ie_version<=11||Y.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()})),xi&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.start(),this.onScroll=this.onScroll.bind(this),window.addEventListener("scroll",this.onScroll),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{}),this.intersection.observe(this.dom)),this.listenForScroll()}onScroll(t){this.intersecting&&this.flush(),this.onScrollChanged(t)}onSelectionChange(t){this.lastFlush<Date.now()-50&&(this._selectionRange=null);let{view:e}=this,i=this.selectionRange;if(e.state.facet(Rt)?e.root.activeElement!=this.dom:!v(e.dom,i))return;let n=i.anchorNode&&e.docView.nearest(i.anchorNode);n&&n.ignoreEvent(t)||(Y.ie&&Y.ie_version<=11&&!e.state.selection.main.empty&&i.focusNode&&y(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush())}get selectionRange(){if(!this._selectionRange){let{root:t}=this.view,e=g(t);Y.safari&&11==t.nodeType&&function(){let t=document.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}()==this.view.contentDOM&&(e=function(t){let e=null;function i(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",i,!0),document.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),!e)return null;let n=e.startContainer,s=e.startOffset,r=e.endContainer,o=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);y(l.node,l.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||e),this._selectionRange=e}return this._selectionRange}setSelectionRange(t,e){var i;(null===(i=this._selectionRange)||void 0===i?void 0:i.type)||(this._selectionRange={anchorNode:t.node,anchorOffset:t.offset,focu
1sNode:e.node,focusOffset:e.offset})}listenForScroll(){this.parentCheck=-1;let t=0,e=null;for(let i=this.dom;i;)if(1==i.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==i?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(i),i=i.assignedSlot||i.parentNode;else{if(11!=i.nodeType)break;i=i.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,bi),this.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange),xi&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),this.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange),xi&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clearSelection(){this.ignoreSelection.set(this.selectionRange)}clear(){this.observer.takeRecords(),this.queue.length=0,this.clearSelection()}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=window.setTimeout((()=>{this.delayedFlush=-1,this.flush()}),20))}forceFlush(){this.delayedFlush>=0&&(window.clearTimeout(this.delayedFlush),this.delayedFlush=-1,this.flush())}flush(){if(this.delayedFlush>=0)return;this.lastFlush=Date.now();let t=this.queue;for(let l of this.observer.takeRecords())t.push(l);t.length&&(this.queue=[]);let e=this.selectionRange,i=!this.ignoreSelection.eq(e)&&v(this.dom,e);if(0==t.length&&!i)return;let n=-1,s=-1,r=!1;for(let l of t){let t=this.readMutation(l);t&&(t.typeOver&&(r=!0),-1==n?({from:n,to:s}=t):(n=Math.min(t.from,n),s=Math.max(t.to,s)))}let o=this.view.state;(n>-1||i)&&this.onChange(n,s,r),this.view.state==o&&(this.view.docView.dirty&&(this.ignore((()=>this.view.docView.sync())),this.view.docView.dirty=0),i&&this.view.docView.updateSelection()),this.clearSelection()}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty(),"childList"==t.type){let i=Si(e,t.previousSibling||t.target.previousSibling,-1),n=Si(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}return{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}}destroy(){this.stop(),this.intersection&&this.intersection.disconnect();for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);window.removeEventListener("scroll",this.onScroll),clearTimeout(this.parentCheck)}}function Si(t,e,i){for(;e;){let n=B.get(e);if(n&&n.parent==t)return n;let s=e.parentNode;e=s!=t.dom?s:i>0?e.nextSibling:e.previousSibling}return null}function Ai(t,e,i,s){let r,o,l,h=t.state.selection.main;if(e>-1&&(l=t.docView.domBoundsAround(e,i,0))){let{from:e,to:i}=l,s=t.docView.impreciseHead||t.docView.impreciseAnchor?[]:function(t){let e=[];
1if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:s,focusOffset:r}=t.observer.selectionRange;i&&(e.push(new Ti(i,n)),s==i&&r==n||e.push(new Ti(s,r)));return e}(t),a=new Ci(s,t);a.readRange(l.startDOM,l.endDOM),o=function(t,e){if(0==t.length)return null;let i=t[0].pos,s=2==t.length?t[1].pos:i;return i>-1&&s>-1?n.jT.single(i+e,s+e):null}(s,e);let c=h.from,u=null;(8===t.inputState.lastKeyCode&&t.inputState.lastKeyTime>Date.now()-100||Y.android&&a.text.length<i-e)&&(c=h.to,u="end");let f=function(t,e,i,n){let s=Math.min(t.length,e.length),r=0;for(;r<s&&t.charCodeAt(r)==e.charCodeAt(r);)r++;if(r==s&&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--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,l))-r}if(o<r&&t.length<e.length){r-=i<=r&&i>=o?r-i:0,l=r+(l-o),o=r}else if(l<r){r-=i<=r&&i>=l?r-i:0,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}(t.state.sliceDoc(e,i),a.text,c-e,u);f&&(r={from:e+f.from,to:e+f.toA,insert:t.state.toText(a.text.slice(f.from,f.toB))})}else if(t.hasFocus||!t.state.facet(Rt)){let e=t.observer.selectionRange,{impreciseHead:i,impreciseAnchor:s}=t.docView,r=i&&i.node==e.focusNode&&i.offset==e.focusOffset||!m(t.contentDOM,e.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),l=s&&s.node==e.anchorNode&&s.offset==e.anchorOffset||!m(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);r==h.head&&l==h.anchor||(o=n.jT.single(l,r))}if(r||o)if(!r&&s&&!h.empty&&o&&o.main.empty?r={from:h.from,to:h.to,insert:t.state.doc.slice(h.from,h.to)}:r&&r.from>=h.from&&r.to<=h.to&&(r.from!=h.from||r.to!=h.to)&&h.to-h.from-(r.to-r.from)<=4&&(r={from:h.from,to:h.to,insert:t.state.doc.slice(h.from,r.from).append(r.insert).append(t.state.doc.slice(r.to,h.to))}),r){let e=t.state;if(Y.android&&(r.from==h.from&&r.to==h.to&&1==r.insert.length&&2==r.insert.lines&&E(t.contentDOM,"Enter",13)||r.from==h.from-1&&r.to==h.to&&0==r.insert.length&&E(t.contentDOM,"Backspace",8)||r.from==h.from&&r.to==h.to+1&&0==r.insert.length&&E(t.contentDOM,"Delete",46))||Y.ios&&t.inputState.flushIOSKey(t))return;let i,s=r.insert.toString();if(t.state.facet(Dt).some((e=>e(t,r.from,r.to,s))))return;if(t.inputState.composing>=0&&t.inputState.composing++,r.from>=h.from&&r.to<=h.to&&r.to-r.from>=(h.to-h.from)/3&&(!o||o.main.empty&&o.main.from==r.from+r.insert.length)){let n=h.from<r.from?e.sliceDoc(h.from,r.from):"",s=h.to>r.to?e.sliceDoc(r.to,h.to):"";i=e.replaceSelection(t.state.toText(n+r.insert.sliceString(0,void 0,t.state.lineBreak)+s))}else{let t=e.changes(r);i={changes:t,selection:o&&!e.selection.main.eq(o.main)&&o.main.to<=t.newLength?e.selection.replaceRange(o.main):void 0}}t.dispatch(i,{scrollIntoView:!0,annotations:n.YW.userEvent.of("input")})}else if(o&&!o.main.eq(h)){let e,i=!1;t.inputState.lastSelectionTime>Date.now()-50&&("keyboardselection"==t.inputState.lastSelectionOrigin?i=!0:e=n.YW.userEvent.of(t.inputState.lastSelectionOrigin)),t.dispatch({selection:o,scrollIntoView:i,annotations:e})}}class Ci{constructor(t,e){this.points=t,this.view=e,this.text="",this.lineBreak=e.state.lineBreak}readRange(t,e){if(!t)return;let i=t.parentNode;for(let n=t;;){this.findPointBefore(i,n),this.readNode(n);let t=n.nextSibling;if(t==e)break;let s=B.get(n),r=B.get(t);((s?s.breakAfter:Mi(n))||(r?r.breakAfter:Mi(t))&&("BR"!=n.nodeName||n.cmIgnore))&&(this.text+=this.lineBreak),n=t}this.findPointBefore(i,e)}readNode(t){if(t.cmIgnore)return;let e,i=B.get(t),n=i&&i.overrideDOMText;null!=n?e=n.sliceString(0,void 0,this.lineBreak):3==t.nodeType?e=t.nodeValue:"BR"==t.nodeName?e=t.nextSibling?this.lineBreak:"":1==t.nodeType&&this.readRange(t.firstChild,null),null!=e&&(this.findPointIn(t,e.length),this.text+=e,Y.chrome&&13==this.view.inputState.lastKeyCode&&!t.nextSibling&&/\n\n$/.test(this.text)&&(this.text=this.text.slice(0,-1)))}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointIn(t,e){for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e))}}function Mi(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.no
1deName)}class Ti{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class Oi{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.plugins=[],this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],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.style.cssText="position: absolute; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=t.dispatch||(t=>this.update([t])),this.dispatch=this.dispatch.bind(this),this.root=t.root||document,this.viewState=new si(t.state||n.yy.create()),this.plugins=this.state.facet(Bt).map((t=>new Ht(t).update(this))),this.observer=new ki(this,((t,e,i)=>{Ai(this,t,e,i)}),(t=>{this.inputState.runScrollHandlers(this,t),this.observer.intersecting&&this.measure()})),this.inputState=new Se(this),this.docView=new $t(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,window.addEventListener("resize",(()=>{-1==Ei&&(Ei=setTimeout(Ri,50))})),this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}dispatch(){this._dispatch(1==arguments.length&&(arguments.length<=0?void 0:arguments[0])instanceof n.YW?arguments.length<=0?void 0:arguments[0]:this.state.update(...arguments))}update(t){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e,i,s=!1,r=this.state;for(let n of t){if(n.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=n.state}if(r.facet(n.yy.phrases)!=this.state.facet(n.yy.phrases))return this.setState(r);e=new Qt(this,r,t);try{this.updateState=2,i=t.some((t=>t.scrollIntoView))?r.selection.main:null,this.viewState.update(e,i),this.bidiCache=Ni.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),s=this.docView.update(e),this.state.facet(Ft)!=this.styleModules&&this.mountStyles(),this.updateAttrs(),this.showAnnouncements(t)}finally{this.updateState=0}if((s||i||this.viewState.mustEnforceCursorAssoc)&&this.requestMeasure(),!e.empty)for(let n of this.state.facet(Pt))n(e)}setState(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");this.updateState=2;try{for(let t of this.plugins)t.destroy(this);this.viewState=new si(t),this.plugins=t.facet(Bt).map((t=>new Ht(t).update(this))),this.docView=new $t(this),this.inputState.ensureHandlers(this),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Bt),i=t.state.facet(Bt);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Ht(s));else{let e=this.plugins[i];e.mustUpdate=t,n.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=n,this.inputState.ensureHandlers(this)}else for(let n of this.plugins)n.mustUpdate=t;for(let n=0;n<this.plugins.length;n++)this.plugins[n]=this.plugins[n].update(this)}measure(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled),this.measureScheduled=-1,t&&this.observer.flush();let e=null;try{for(let t=0;;t++){this.updateState=1;let n=this.viewState.measure(this.docView,t>0),s=this.measureRequests;if(!n&&!s.length&&null==this.viewState.scrollTo)break;if(this.measureRequests=[],t>5){console.warn("Viewport failed to stabilize");break}let r=s.map((t=>{try{return t.read(this)}catch(e){return Et(this.state,e),Li}})),o=new Qt(this,this.state);o.flags|=n,e?e.flags|=n:e=o,this.updateState=2,o.empty||(this.updatePlugins(o),this.inputState.update(o)),this.updateAttrs(),n&&this.docView.update(o);for(let t=0;t<s.length;t++)if(r[t]!=Li)try{s[t].write(r[t],this)}catch(i){Et(this.state,i)}if(this.viewState.scrollTo&&(this.docView.scrollPosIntoView(this.viewState.scrollTo.head,this.viewState.scrollTo.assoc),this.viewState.scrollTo=null),!(4&n)&&0==this.measureRequests.length)break}}finally{this.updateState=0}if(this.measureScheduled=-1,e&&!e.empty)for(let n of this.state.facet(Pt))n(e)}get themeClasses(){return pi+" "+(this.state.facet(di)?mi:gi)+" "+this.state.facet(fi)}updateAttrs(){let t=ht(this.state.facet(Wt),{class:"cm-editor cm-wrap"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses});ct(this.dom,this.editorAttrs,t),this.editorAttrs=t;
1let e=ht(this.state.facet(jt),{spellcheck:"false",autocorrect:"off",autocapitalize:"off",contenteditable:this.state.facet(Rt)?L()?"plaintext-only":"true":"false",class:"cm-content",style:"".concat(Y.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"});ct(this.contentDOM,this.contentAttrs,e),this.contentAttrs=e}showAnnouncements(t){let e=!0;for(let i of t)for(let t of i.effects)if(t.is(Oi.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Ft),r.V.mount(this.root,this.styleModules.concat(yi).reverse())}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=requestAnimationFrame((()=>this.measure()))),t){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)}}pluginField(t){let e=[];for(let i of this.plugins)i.update(this).takeField(t,e);return e}plugin(t){for(let e of this.plugins)if(e.spec==t)return e.update(this).value;return null}blockAtHeight(t,e){return this.readMeasured(),this.viewState.blockAtHeight(t,Di(e,this.contentDOM))}visualLineAtHeight(t,e){return this.readMeasured(),this.viewState.lineAtHeight(t,Di(e,this.contentDOM))}viewportLines(t,e){let{from:i,to:n}=this.viewport;this.viewState.forEachLine(i,n,t,Di(e,this.contentDOM))}visualLineAt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.viewState.lineAt(t,e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return ke(this,t,xe(this,t,e,i))}moveByGroup(t,e){return ke(this,t,xe(this,t,e,(e=>function(t,e,i){let s=t.state.charCategorizer(e),r=s(i);return t=>{let e=s(t);return r==n.D0.Space&&(r=e),r==e}}(this,t.head,e))))}moveToLineBoundary(t,e){return function(t,e,i,s){let r=t.state.doc.lineAt(e.head),o=s&&t.lineWrapping?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(o){let e=t.dom.getBoundingClientRect(),s=t.posAtCoords({x:i==(t.textDirection==Jt.LTR)?e.right-1:e.left+1,y:(o.top+o.bottom)/2});if(null!=s)return n.jT.cursor(s,i?-1:1)}let l=yt.find(t.docView,e.head),h=l?i?l.posAtEnd:l.posAtStart:i?r.to:r.from;return n.jT.cursor(h,i?-1:1)}(this,t,e,!(arguments.length>2&&void 0!==arguments[2])||arguments[2])}moveVertically(t,e,i){return ke(this,t,function(t,e,i,s){let r=e.head,o=i?1:-1;if(r==(i?t.state.doc.length:0))return n.jT.cursor(r);let l,h=e.goalColumn,a=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(r);if(c)null==h&&(h=c.left-a.left),l=o<0?c.top:c.bottom;else{let e=t.viewState.lineAt(r,t.dom.getBoundingClientRect().top);null==h&&(h=Math.min(a.right-a.left,t.defaultCharacterWidth*(r-e.from))),l=o<0?e.top:e.bottom}let u=a.left+h,f=null!==s&&void 0!==s?s:t.defaultLineHeight>>1;for(let d=0;;d+=10){let e=l+(f+d)*o,i=ye(t,{x:u,y:e},!1,o);if(e<a.top||e>a.bottom||(o<0?i<r:i>r))return n.jT.cursor(i,void 0,void 0,h)}}(this,t,e,i))}scrollPosIntoView(t){this.viewState.scrollTo=n.jT.cursor(t),this.requestMeasure()}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.posFromDOM(t,e)}posAtCoords(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.readMeasured(),ye(this,t,e)}coordsAtPos(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let n=this.state.doc.lineAt(t),s=this.bidiSpans(n);return A(i,s[oe.find(s,t-n.from,-1,e)].dir==Jt.LTR==e>0)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.heightOracle.direction}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Pi)return ae(t.length);let e=this.textDirection;for(let n of this.bidiCache)if(n.from==t.from&&n.dir==e)return n.order;let i=he(t.text,this.textDirection);return this.bidiCache.push(new Ni(t.from,t.to,e,i)),i}get hasFocus(){var t;return(document.hasFocus()||Y.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{P(this.contentDOM),this.docView.updateSelection()}))}destroy(){for(let t of this.plugins)t.destroy(this);this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled)}static domEventHandlers(t){return Vt.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=r.V.newName(),n=[fi.of(i),Ft.of(wi(".".concat(i),t))];return e&&e.dark&&n.push(di.of(!0)),n}static baseTheme(t){return n.Wl.fallback(Ft.of(wi("."+pi,t,vi)))}}Oi.styleModule=Ft,Oi.inputHandler=Dt,Oi.exceptionSink=Ot,Oi.updateListener=Pt,Oi.editable=Rt,Oi.mouseSelectionStyle=Tt,Oi.dragMovesSelection=Mt,Oi.clickAddsSelectionRange=Ct,Oi.decorations=_t,Oi.contentAttributes=jt,Oi.editorAttributes=Wt,Oi.lineWrapping=Oi.contentAttributes.of({class:"cm-lineWrapping"}),Oi.announce=n.Py.define();const Pi=4096;function Di(t,e){return null==t?e.getBoundingClientRect().top:t}let Ei=-1;function Ri(){Ei=-1;let t=document.querySelectorAll(".cm-content");for(let e=0;e<t.length;e++){let i=B.get(t[e]);i&&i.editorView.requestMeasure()}}const Li={};class Ni{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Jt.LTR;for(let s=Math.max(0,t.length-10);s<t.length;s++){let r=t[s];r.dir!=n||e.touchesRange(r.from,r.to)||i.push(new Ni(e.mapPos(r.from,1),e.mapPos(r.to,-1),r.dir,r.order))}return i}}const Ii="undefined"==typeof navigator?"key":/Mac/.test(navigator.platform)?"mac":/Win/.test(navigator.platform)?"win":/Linux|X11/.test(navigator.platform)?"linux":"key";
1function Bi(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t}const Vi=Oi.domEventHandlers({keydown:(t,e)=>qi(Wi(e.state),t,e,"editor")}),zi=n.r$.define({enables:Vi}),Hi=new WeakMap;function Wi(t){let e=t.facet(zi),i=Hi.get(e);return i||Hi.set(e,i=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ii,i=Object.create(null),n=Object.create(null),s=(t,e)=>{let i=n[t];if(null==i)n[t]=e;else if(i!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},r=(t,n,r,o)=>{let l=i[t]||(i[t]=Object.create(null)),h=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,l=i[i.length-1];"Space"==l&&(l=" ");for(let h=0;h<i.length-1;++h){const t=i[h];if(/^(cmd|meta|m)$/i.test(t))o=!0;else if(/^a(lt)?$/i.test(t))n=!0;else if(/^(c|ctrl|control)$/i.test(t))s=!0;else if(/^s(hift)?$/i.test(t))r=!0;else{if(!/^mod$/i.test(t))throw new Error("Unrecognized modifier name: "+t);"mac"==e?o=!0:s=!0}}return n&&(l="Alt-"+l),s&&(l="Ctrl-"+l),o&&(l="Meta-"+l),r&&(l="Shift-"+l),l}(t,e)));for(let e=1;e<h.length;e++){let i=h.slice(0,e).join(" ");s(i,!0),l[i]||(l[i]={preventDefault:!0,commands:[e=>{let n=_i={view:e,prefix:i,scope:t};return setTimeout((()=>{_i==n&&(_i=null)}),Fi),!0}]})}let a=h.join(" ");s(a,!1);let c=l[a]||(l[a]={preventDefault:!1,commands:[]});c.commands.push(r),o&&(c.preventDefault=!0)};for(let o of t){let t=o[e]||o.key;if(t)for(let e of o.scope?o.scope.split(" "):["editor"])r(e,t,o.run,o.preventDefault),o.shift&&r(e,"Shift-"+t,o.shift,o.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}function ji(t,e,i){return qi(Wi(t.state),e,t,i)}let _i=null;const Fi=4e3;function qi(t,e,i,n){let s=function(t){var e=!(f&&(t.ctrlKey||t.altKey||t.metaKey)||u&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?h:l)[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),r=1==s.length&&" "!=s,o="",a=!1;_i&&_i.view==i&&_i.scope==n&&(o=_i.prefix+" ",(a=Ae.indexOf(e.keyCode)<0)&&(_i=null));let c,d=t=>{if(t){for(let e of t.commands)if(e(i))return!0;t.preventDefault&&(a=!0)}return!1},p=t[n];if(p){if(d(p[o+Bi(s,e,!r)]))return!0;if(r&&(e.shiftKey||e.altKey||e.metaKey)&&(c=l[e.keyCode])&&c!=s){if(d(p[o+Bi(c,e,!0)]))return!0}else if(r&&e.shiftKey&&d(p[o+Bi(s,e,!0)]))return!0}return a}const Qi=!Y.ios,$i=n.r$.define({combine:t=>(0,n.BO)(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function Ui(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[$i.of(t),Ki,Ji]}class Gi{constructor(t,e,i,n,s){this.left=t,this.top=e,this.width=i,this.height=n,this.className=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width>=0&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}}const Ki=Vt.fromClass(class{constructor(t){this.view=t,this.rangePieces=[],this.cursors=[],this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.selectionLayer=t.scrollDOM.appendChild(document.createElement("div")),this.selectionLayer.className="cm-selectionLayer",this.selectionLayer.setAttribute("aria-hidden","true"),this.cursorLayer=t.scrollDOM.appendChild(document.createElement("div")),this.cursorLayer.className="cm-cursorLayer",this.cursorLayer.setAttribute("aria-hidden","true"),t.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){this.cursorLayer.style.animationDuration=this.view.state.facet($i).cursorBlinkRate+"ms"}update(t){let e=t.startState.facet($i)!=t.state.facet($i);(e||t.selectionSet||t.geometryChanged||t.viewportChanged)&&this.view.requestMeasure(this.measureReq),t.transactions.some((t=>t.scrollIntoView))&&(this.cursorLayer.style.animationName="cm-blink"==this.cursorLayer.style.animationName?"cm-blink2":"cm-blink"),e&&this.setBlinkRate()}readPos(){let{state:t}=this.view,e=t.facet($i),i=t.selection.ranges.map((t=>t.empty?[]:function(t,e){if(e.to<=t.viewport.from||e.from>=t.viewport.to)return[];let i=Math.max(e.from,t.viewport.from),n=Math.min(e.to,t.viewport.to),s=t.textDirection==Jt.LTR,r=t.contentDOM,o=r.getBoundingClientRect(),l=Xi(t),h=window.getComputedStyle(r.firstChild),a=o.left+parseInt(h.paddingLeft),c=o.right-parseInt(h.paddingRight),u=tn(t,i),f=tn(t,n),d=u.type==ft.Text?u:null,p=f.type==ft.Text?f:null;
1t.lineWrapping&&(d&&(d=Zi(t,i,d)),p&&(p=Zi(t,n,p)));if(d&&p&&d.from==p.from)return m(v(e.from,e.to,d));{let i=d?v(e.from,null,d):w(u,!1),n=p?v(null,e.to,p):w(f,!0),s=[];return(d||u).to<(p||f).from-1?s.push(g(a,i.bottom,c,n.top)):i.bottom<n.top&&tn(t,(i.bottom+n.top)/2).type==ft.Text&&(i.bottom=n.top=(i.bottom+n.top)/2),m(i).concat(s).concat(m(n))}function g(t,e,i,n){return new Gi(t-l.left,e-l.top,i-t,n-e,"cm-selectionBackground")}function m(t){let{top:e,bottom:i,horizontal:n}=t,s=[];for(let r=0;r<n.length;r+=2)s.push(g(n[r],e,n[r+1],i));return s}function v(e,i,n){let r=1e9,o=-1e9,l=[];function h(e,i,h,u,f){let d=t.coordsAtPos(e,e==n.to?-2:2),p=t.coordsAtPos(h,h==n.from?2:-2);r=Math.min(d.top,p.top,r),o=Math.max(d.bottom,p.bottom,o),f==Jt.LTR?l.push(s&&i?a:d.left,s&&u?c:p.right):l.push(!s&&u?a:p.left,!s&&i?c:d.right)}let u=null!==e&&void 0!==e?e:n.from,f=null!==i&&void 0!==i?i:n.to;for(let s of t.visibleRanges)if(s.to>u&&s.from<f)for(let n=Math.max(s.from,u),r=Math.min(s.to,f);;){let s=t.state.doc.lineAt(n);for(let o of t.bidiSpans(s)){let t=o.from+s.from,l=o.to+s.from;if(t>=r)break;l>n&&h(Math.max(t,n),null==e&&t<=u,Math.min(l,r),null==i&&l>=f,o.dir)}if(n=s.to+1,n>=r)break}return 0==l.length&&h(u,null==e,f,null==i,t.textDirection),{top:r,bottom:o,horizontal:l}}function w(t,e){let i=o.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(this.view,t))).reduce(((t,e)=>t.concat(e))),n=[];for(let s of t.selection.ranges){let i=s==t.selection.main;if(s.empty?!i||Qi:e.drawRangeCursor){let t=en(this.view,s,i);t&&n.push(t)}}return{rangePieces:i,cursors:n}}drawSel(t){let{rangePieces:e,cursors:i}=t;if(e.length!=this.rangePieces.length||e.some(((t,e)=>!t.eq(this.rangePieces[e])))){this.selectionLayer.textContent="";for(let t of e)this.selectionLayer.appendChild(t.draw());this.rangePieces=e}if(i.length!=this.cursors.length||i.some(((t,e)=>!t.eq(this.cursors[e])))){let t=this.cursorLayer.children;if(t.length!==i.length){this.cursorLayer.textContent="";for(const t of i)this.cursorLayer.appendChild(t.draw())}else i.forEach(((e,i)=>e.adjust(t[i])));this.cursors=i}}destroy(){this.selectionLayer.remove(),this.cursorLayer.remove()}}),Yi={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Qi&&(Yi[".cm-line"].caretColor="transparent !important");const Ji=n.Wl.override(Oi.theme(Yi));function Xi(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Jt.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Zi(t,e,i){let s=n.jT.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(s,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(s,!0,!0).from),type:ft.Text}}function tn(t,e){let i=t.visualLineAt(e);if(Array.isArray(i.type))for(let n of i.type)if(n.to>e||n.to==e&&(n.to==i.to||n.type==ft.Text))return n;return i}function en(t,e,i){let n=t.coordsAtPos(e.head,e.assoc||1);if(!n)return null;let s=Xi(t);return new Gi(n.left-s.left,n.top-s.top,-1,n.bottom-n.top,i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary")}function nn(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),l=i;!o.next().done;l+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(l+r.index,l+r.index+r[0].length,r)}class sn{constructor(t){let{regexp:e,decoration:i,boundary:n}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");this.regexp=e,this.getDeco="function"==typeof i?i:()=>i,this.boundary=n}createDeco(t){let e=new o.f_;for(let{from:i,to:n}of t.visibleRanges)nn(t.state.doc,this.regexp,i,n,((i,n,s)=>e.add(i,n,this.getDeco(s,t,i))));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r<t.view.viewport.to&&(i=Math.min(r,i),n=Math.max(o,n))})),t.viewportChanged||n-i>1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.to<o?t.state.doc.lineAt(o):i,l=Math.max(s.from,i.from),h=Math.min(s.to,n.to);if(this.boundary){for(;r>i.from;r--)if(this.boundary.test(i.text[r-1-i.from])){l=r;break}for(;o<n.to;o++)if(this.boundary.test(n.text[o-n.from])){h=o;break}}let a,c=[];if(i==n)for(this.regexp.lastIndex=l-i.from;(a=this.regexp.exec(i.text))&&a.index<h-i.from;){let e=a.index+i.from;c.push(this.getDeco(a,t,e).range(e,e+a[0].length))}else nn(t.state.doc,this.regexp,l,h,((e,i,n)=>c.push(this.getDeco(n,t,e).range(e,i))));e=e.update({filterFrom:l,filterTo:h,filter:()=>!1,add:c})}}return e}}const rn=null!=/x/.unicode?"gu":"g",on=new RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]",rn),ln={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let hn=null;const an=n.r$.define({combine(t){let e=(0,n.BO)(t,{render:null,specialChars:on,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==hn&&"undefined"!=typeof document&&document.body){let e=document.body.style;hn=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return hn||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,rn)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,rn)),e}});function cn(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[an.of(t),un||(un=Vt.fromClass(class{constructor(t){this.view=t,this.decorations=dt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(an)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new sn({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:r}=i.state,o=(0,s.gm)(e[0],0);if(9==o){let t=r.lineAt(n),e=i.state.tabSize,o=(0,s.IS)(r.sliceString(t.from,n),0,e);return dt.replace({widget:new dn((e-o%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[o]||(this.decorationCache[o]=dt.replace({widget:new fn(t,o)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(an);t.startState.facet(an)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let un=null;class fn extends ut{constructor(t,e){super(),this.options=t,this.co
1de=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"\u2022":10==t?"\u2424":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(ln[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class dn extends ut{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}function pn(){return mn}const gn=dt.line({attributes:{class:"cm-activeLine"}}),mn=Vt.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let n of t.state.selection.ranges){if(!n.empty)return dt.none;let s=t.visualLineAt(n.head);s.from>e&&(i.push(gn.range(s.from)),e=s.from)}return dt.set(i)}},{decorations:t=>t.decorations})},23129:(t,e,i)=>{i.d(e,{AY:()=>A,C8:()=>f,Jq:()=>h,L3:()=>n,Lj:()=>a,i9:()=>S,md:()=>o,mp:()=>c});const n=1024;let s=0;const r=new WeakMap;class o{constructor(){let{deserialize:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.id=s++,this.deserialize=t||(()=>{throw new Error("This node type doesn't define a deserialize function")})}static string(){return new o({deserialize:t=>t})}static number(){return new o({deserialize:Number})}static flag(){return new o({deserialize:()=>!0})}set(t,e){return t[this.id]=e,t}add(t){return"function"!=typeof t&&(t=h.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}o.closedBy=new o({deserialize:t=>t.split(" ")}),o.openedBy=new o({deserialize:t=>t.split(" ")}),o.group=new o({deserialize:t=>t.split(" ")});const l=Object.create(null);class h{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.name=t,this.props=e,this.id=i,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):l,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new h(t.name||"",e,t.id,i);if(t.props)for(let s of t.props)Array.isArray(s)||(s=s(n)),s&&s[0].set(e,s[1]);return n}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(o.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let n of i.split(" "))e[n]=t[i];return t=>{for(let i=t.prop(o.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}h.none=new h("",Object.create(null),0,8);class a{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(){let t=[];for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];for(let s of this.types){let e=null;for(let t of i){let i=t(s);i&&(e||(e=Object.assign({},s.props)),i[0].set(e,i[1]))}t.push(e?new h(s.name,e,s.id,s.flags):s)}return new a(t)}}class c{constructor(t,e,i,n){this.type=t,this.children=e,this.positions=i,this.length=n}toString(){let t=this.children.map((t=>t.toString())).join();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(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=null!=t&&r.get(this)||this.topNode,n=new v(i);return null!=t&&(n.moveTo(t,e),r.set(this,n._tree)),n}fullCursor(){return new v(this.topNode,!0)}get topNode(){return new d(this,0,0,null)}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.cursor(t,e).node}iterate(t){let{enter:e,leave:i,from:n=0,to:s=this.length}=t;for(let r=this.cursor();;){let t=!1;if(r.from<=s&&r.to>=n&&(r.type.isAnonymous||!1!==e(r.type,r.from,r.to))){if(r.firstChild())continue;r.type.isAnonymous||(t=!0)}for(;t&&i&&i(r.type,r.from,r.to),t=r.type.isAnonymous,!r.nextSibling();){if(!r.parent())return;t=!0}}}balance(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n;return this.children.length<=b?this:x(this.type,h.none,this.children,this.positions,0,this.children.length,0,t,this.length,0)}static build(t){return function(t){var e;let{buffer:i,nodeSet:s,topID:r=0,maxBufferLength:o=n,reused:l=[],minRepeatType:a=s.types.length}=t,d=Array.isArray(i)?new y(i,i.length):i,p=s.types,g=0;function m(t,e,i,n,r){let{id:y,start:k,end:S,size:A}=d,C=k-t;if(A<0)return-1==A?(i.push(l[y]),n.push(C)):g=y,void d.next();let M,T,O=p[y];if(S-k<=o&&(T=v(d.pos-e,r))){let e=new Uint16Array(T.size-T.skip),i=d.pos-T.size,n=e.length;for(;d.pos>i;)n=w(T.start,e,n,r);M=new f(e,S-T.start,s,r<0?h.none:p[r]),C=T.start-t}else{let t=d.pos-A;d.next();let e=[],i=[],n=y>
1=a?y:-1;for(;d.pos>t;)d.id==n?d.next():m(k,t,e,i,n);e.reverse(),i.reverse(),M=n>-1&&e.length>b?x(O,O,e,i,0,e.length,0,o,S-k,g):u(new c(O,e,i,S-k),g)}i.push(M),n.push(C)}function v(t,e){let i=d.fork(),n=0,s=0,r=0,l=i.end-o,h={size:0,start:0,skip:0};t:for(let o=i.pos-t;i.pos>o;){if(i.id==e){h.size=n,h.start=s,h.skip=r,r+=4,n+=4,i.next();continue}let t=i.size,c=i.pos-t;if(t<0||c<o||i.start<l)break;let u=i.id>=a?4:0,f=i.start;for(i.next();i.pos>c;){if(i.size<0)break t;i.id>=a&&(u+=4),i.next()}s=f,n+=t,r+=u}return(e<0||n==t)&&(h.size=n,h.start=s,h.skip=r),h.size>4?h:void 0}function w(t,e,i,n){let{id:s,start:r,end:o,size:l}=d;if(d.next(),s==n)return i;let h=i;if(l>4){let s=d.pos-(l-4);for(;d.pos>s;)i=w(t,e,i,n)}return s<a&&(e[--i]=h,e[--i]=o-t,e[--i]=r-t,e[--i]=s),i}let k=[],S=[];for(;d.pos>0;)m(t.start||0,0,k,S,-1);let A=null!==(e=t.length)&&void 0!==e?e:k.length?S[0]+k[0].length:0;return new c(p[r],k.reverse(),S.reverse(),A)}(t)}}function u(t,e){return e&&(t.contextHash=e),t}c.empty=new c(h.none,[],[],0);class f{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:h.none;this.buffer=t,this.length=e,this.set=i,this.type=n}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],i=this.buffer[t+3],n=this.set.types[e],s=n.name;if(/\W/.test(s)&&!n.isError&&(s=JSON.stringify(s)),i==(t+=4))return s;let r=[];for(;t<i;)r.push(this.childString(t)),t=this.buffer[t+3];return s+"("+r.join(",")+")"}findChild(t,e,i,n){let{buffer:s}=this,r=-1;for(let o=t;o!=e;o=s[o+3])if(-1e8!=n){let t=s[o+1],e=s[o+2];if(i>0){if(e>n&&(r=o),e>n)break}else if(t<n&&(r=o),e>=n)break}else if(r=o,i>0)break;return r}}class d{constructor(t,e,i,n){this.node=t,this.from=e,this.index=i,this._parent=n}get type(){return this.node.type}get name(){return this.node.type.name}get to(){return this.from+this.node.length}nextChild(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];for(let s=this;;){for(let{children:r,positions:o}=s.node,l=e>0?r.length:-1;t!=l;t+=e){let l=r[t],h=o[t]+s.from;if(-1e8==i||!(e<0?h>=i:h+l.length<=i))if(l instanceof f){let n=l.findChild(0,l.buffer.length,e,-1e8==i?-1e8:i-h);if(n>-1)return new m(new g(s,l,t,h),null,n)}else if(n||!l.type.isAnonymous||w(l)){let r=new d(l,h,t,s);return n||!r.type.isAnonymous?r:r.nextChild(e<0?l.children.length-1:0,e,i)}}if(n||!s.type.isAnonymous)return null;if(t=s.index+e,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,-1e8)}get lastChild(){return this.nextChild(this.node.children.length-1,-1,-1e8)}childAfter(t){return this.nextChild(0,1,t)}childBefore(t){return this.nextChild(this.node.children.length-1,-1,t)}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._parent.nextChild(this.index+1,1,-1):null}get prevSibling(){return this._parent?this._parent.nextChild(this.index-1,-1,-1):null}get cursor(){return new v(this)}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.cursor.moveTo(t,e).node}getChild(t){let e=p(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return e.length?e[0]:null}getChildren(t){return p(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}toString(){return this.node.toString()}}function p(t,e,i,n){let s=t.cursor,r=[];if(!s.firstChild())return r;if(null!=i)for(;!s.type.is(i);)if(!s.nextSibling())return r;for(;;){if(null!=n&&s.type.is(n))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return null==n?r:[]}}class g{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class m{constructor(t,e,i){this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}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]}child(t,e){let{buffer:i}=this.context,n=i.findChild(this.index+4,i.buffer[this.index+3],t,-1e8==e?-1e8:e-this.context.start);return n<0?null:new m(this.context,this,n)}get firstChild(){return this.child(1,-1e8)}get lastChild(){return this.child(-1,-1e8)}childAfter(t){return this.child(1,t)}childBefore(t){return this.child(-1,t)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.
1index+t,t,-1)}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 m(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 m(this.context,this._parent,t.findChild(e,this.index,-1,-1e8))}get cursor(){return new v(this)}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.cursor.moveTo(t,e).node}toString(){return this.context.buffer.childString(this.index)}getChild(t){let e=p(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return e.length?e[0]:null}getChildren(t){return p(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}}class v{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.full=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof d)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;
1for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}get name(){return this.type.name}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:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof d?(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()}enter(t,e){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree.node.children.length-1:0,t,e,this.full));let{buffer:i}=this.buffer,n=i.findChild(this.index+4,i.buffer[this.index+3],t,-1e8==e?-1e8:e-this.buffer.start);return!(n<0)&&(this.stack.push(this.index),this.yieldBuf(n))}firstChild(){return this.enter(1,-1e8)}lastChild(){return this.enter(-1,-1e8)}childAfter(t){return this.enter(1,t)}childBefore(t){return this.enter(-1,t)}parent(){if(!this.buffer)return this.yieldNode(this.full?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.full?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._parent.nextChild(this._tree.index+t,t,-1e8,this.full));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,-1e8))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,-1e8,this.full))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){if(this.index<n.buffer.buffer.length)return!1}else for(let t=0;t<this.index;t++)if(n.buffer.buffer[t+3]<this.index)return!1;({index:e,parent:i}=n)}else({index:e,_parent:i}=this._tree);for(;i;({index:e,_parent:i}=i))for(let n=e+t,s=t<0?-1:i.node.children.length;n!=s;n+=t){let t=i.node.children[n];if(this.full||!t.type.isAnonymous||t instanceof f||w(t))return!1}return!0}move(t){if(this.enter(t,-1e8))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(){return this.move(1)}prev(){return this.move(-1)}moveTo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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(;e<0?this.childBefore(t):this.childAfter(t);)if(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t)){this.parent();break}return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,e=null,i=0;if(t&&t.context==this.buffer)t:for(let n=this.index,s=this.stack.length;s>=0;){for(let r=t;r;r=r._parent)if(r.index==n){if(n==this.index)return r;e=r,i=s+1;break t}n=this.stack[--s]}for(let n=i;n<this.stack.length;n++)e=new m(this.buffer,e,this.stack[n]);return this.bufferNode=new m(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree.node}}function w(t){return t.children.some((t=>!t.type.isAnonymous||t instanceof f||w(t)))}class y{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 y(this.buffer,this.index)}}const b=8;function x(t,e,i,n,s,r,o,l,a,f){let d=[],p=[];if(a<=l)for(let h=s;h<r;h++)d.push(i[h]),p.push(n[h]-o);else{let t=Math.max(l,Math.ceil(1.5*a/b));for(let a=s;a<r;){let s=a,g=n[a];for(a++;a<r;a++){if(n[a]+i[a].length-g>t)break}if(a==s+1){let n=i[s];if(n instanceof c&&n.type==e&&n.length>t<<1){for(let t=0;t<n.children.length;t++)d.push(n.children[t]),p.push(n.positions[t]+g-o);continue}d.push(n)}else if(a==s+1)d.push(i[s]);else{let t=x(e,e,i,n,s,a,g,l,n[a-1]+i[a-1].length-g,f);e==h.none||k(t.children,e)||(t=u(new c(h.none,t.children,t.positions,t.length),f)),d.push(t)}p.push(g-o)}}return u(new c(t,d,p,a),f)}function k(t,e){for(let i of t)if(i.type==e)return!0;return!1}class S{constructor(t,e,i,n,s){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=s}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static applyChanges(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:128;if(!e.length)return t;let n=[],s=1,r=t.length?t[0]:null,o=0,l=0,h=0;for(;;){let a=o<e.length?e[o++]:null,c=a?a.fromA:1e9;if(c-l>=i)for(;r&&r.from<c;){let e=r;if(l>=e.from||c<=e.to||h){let t=Math.max(e.from,l)-h,i=Math.min(e.to,c)-h;e=t>=i?null:new S(t,i,e.tree,e.offset+h,(o>0?1:0)|(a?2:0))}if(e&&n.push(e),r.to>c)break;r=s<t.length?t[s++]:null}if(!a)break;l=a.toA,h=a.toA-a.toB}return n}static addTree(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=[new S(0,t.length,t,0,i?2:0)];for(let s of e)s.to>t.length&&n.push(s);return n}}function A(t){return new C(t)}class C{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length;this.string=t,this.length=e}get(t){return t<0||t>=this.length?-1:this.string.charCodeAt(t)}lineAfter(t){if(t<0)return"";let e=this.string.indexOf("\n",t);return this.string.slice(t,e<0?this.length:Math.min(e,this.length))}read(t,e){return this.string.slice(t,Math.min(this.length,e))}clip(t){return new C(this.string,t)}}},28335:(t,e,i)=>{i.d(e,{V:()=>o});const n="undefined"==typeof Symbol?"__\u037c":Symbol.for("\u037c"),s="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class o{constructor(t,e){this.rules=[];let{finish:i}=e||{};function n(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function s(t,e,r,o){let l=[],h=/^@(\w+)\b/.exec(t[0]),a=h&&"keyframes"==h[1];if(h&&null==e)return r.push(t[0]+";");for(let i in e){let o=e[i];if(/&/.test(i))s(i.split(/,\s*/).map((e=>t.map((t=>e.replace(/&/,t))))).reduce(((t,e)=>t.concat(e))),o,r);else if(o&&"object"==typeof o){if(!h)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,l,a)}else null!=o&&l.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(l.length||a)&&r.push((!i||h||o?t:t.map(i)).join(", ")+" {"+l.join(" ")+"}")}for(let r in t)s(n(r),t[r],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=r[n]||1;return r[n]=t+1,"\u037c"+t.toString(36)}
1static mount(t,e){(t[s]||new h(t)).mount(Array.isArray(e)?e:[e])}}let l=new Map;class h{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=l.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[s]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],l.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[s]=this}mount(t){let e=this.sheet,i=0,n=0;for(let s=0;s<t.length;s++){let r=t[s],o=this.modules.indexOf(r);if(o<n&&o>-1&&(this.modules.splice(o,1),n--,o=-1),-1==o){if(this.modules.splice(n++,0,r),e)for(let t=0;t<r.rules.length;t++)e.insertRule(r.rules[t],i++)}else{for(;n<o;)i+=this.modules[n++].rules.length;i+=r.rules.length,n++}}if(!e){let t="";for(let e=0;e<this.modules.length;e++)t+=this.modules[e].getRules()+"\n";this.styleTag.textContent=t}}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.