static.kuangkie.pc.bundle.c406698c23731d9ea02a.js Maven / Gradle / Ivy
The newest version!
"use strict";(self.webpackChunkaldehyde=self.webpackChunkaldehyde||[]).push([[867],{34790:function(e,t,n){n.d(t,{B1:function(){return ae},GA:function(){return K},Mb:function(){return a},eC:function(){return c},vQ:function(){return _},ys:function(){return le}});var o=n(78120),r=n(47421),i=n(59119);class s{constructor(e,t,n){this.state=e,this.pos=t,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let t=(0,i.qz)(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),o=t.text.slice(n-t.from,this.pos-t.from),r=o.search(h(e,!1));return r<0?null:{from:n+r,to:this.pos,text:o.slice(r)}}get aborted(){return null==this.abortListeners}addEventListener(e,t){"abort"==e&&this.abortListeners&&this.abortListeners.push(t)}}function l(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function a(e){let t=e.map((e=>"string"==typeof e?{label:e}:e)),[n,o]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:o}of e){t[o[0]]=!0;for(let e=1;e{let r=e.matchBefore(o);return r||e.explicit?{from:r?r.from:e.pos,options:t,validFor:n}:null}}function c(e,t){return n=>{for(let t=(0,i.qz)(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}class u{constructor(e,t,n,o){this.completion=e,this.source=t,this.match=n,this.score=o}}function f(e){return e.selection.main.from}function h(e,t){var n;let{source:o}=e,r=t&&"^"!=o[0],i="$"!=o[o.length-1];return r||i?new RegExp(`${r?"^":""}(?:${o})${i?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const d=o.q6.define(),p=new WeakMap;function m(e){if(!Array.isArray(e))return e;let t=p.get(e);return t||p.set(e,t=a(e)),t}const g=o.Py.define(),v=o.Py.define();class k{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&c<=57||c>=97&&c<=122?2:c>=65&&c<=90?1:0:(y=(0,o.bg)(c))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!r||1==b&&g||0==k&&0!=b)&&(t[f]==c||n[f]==c&&(h=!0)?s[f++]=r:s.length&&(v=!1)),k=b,r+=(0,o.nZ)(c)}return f==a&&0==s[0]&&v?this.result((h?-200:0)-100,s,e):d==a&&0==p?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):f==a?this.result((h?-200:0)-100-700+(v?0:-1100),s,e):2!=t.length&&this.result((r[0]?-700:0)-200-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?(0,o.nZ)((0,o.gm)(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}}const y=o.r$.define({combine(e){return(0,o.BO)(e,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:w,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>b(e(n),t(n)),optionClass:(e,t)=>n=>b(e(n),t(n)),addToOptions:(e,t)=>e.concat(t)})}});function b(e,t){return e?t?e+" "+t:e:t}function w(e,t,n,o,i,s){let l,a,c=e.textDirection==r.Nm.RTL,u=c,f=!1,h="top",d=t.left-i.left,p=i.right-t.right,m=o.right-o.left,g=o.bottom-o.top;if(u&&d=g||e>t.top?l=n.bottom-t.top:(h="bottom",l=t.bottom-n.top)}return{style:`${h}: ${l/((t.bottom-t.top)/s.offsetHeight)}px; max-width: ${a/((t.right-t.left)/s.offsetWidth)}px`,class:"cm-completionInfo-"+(f?c?"left-narrow":"right-narrow":u?"left":"right")}}function x(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let o=Math.floor((e-t)/n);return{from:e-(o+1)*n,to:e-o*n}}class O{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let o=e.state.field(t),{options:r,selected:i}=o.open,s=e.state.facet(y);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map((e=>"cm-completionIcon-"+e))),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,o){let r=document.createElement("span");r.className="cm-completionLabel";let i=e.displayLabel||e.label,s=0;for(let e=0;es&&r.appendChild(document.createTextNode(i.slice(s,t)));let l=r.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(i.slice(t,n))),l.className="cm-completionMatchedText",s=n}return se.position-t.position)).map((e=>e.render))}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=x(r.length,i,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",(n=>{let{options:o}=e.state.field(t).open;for(let t,r=n.target;r&&r!=this.dom;r=r.parentNode)if("LI"==r.nodeName&&(t=/-(\d+)$/.exec(r.id))&&+t[1]{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(y).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:v.of(null)})})),this.showOptions(r,o.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}update(e){var t;let n=e.state.field(this.stateField),o=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=o){let{options:r,selected:i,disabled:s}=n.open;o.open&&o.open.options==r||(this.range=x(r.length,i,e.state.facet(y).maxRenderedOptions),this.showOptions(r,n.id)),this.updateSel(),s!=(null===(t=o.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=x(t.options.length,t.selected,this.view.state.facet(y).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:n}=t.options[t.selected],{info:o}=n;if(!o)return;let i="string"==typeof o?document.createTextNode(o):o(n);if(!i)return;"then"in i?i.then((t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,n)})).catch((e=>(0,r.OO)(this.view.state,e,"completion info"))):this.addInfoPane(i,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:o}=e;n.appendChild(t),this.infoDestroy=o||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,o=this.range.from;n;n=n.nextSibling,o++)"LI"==n.nodeName&&n.id?o==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected"):o--;return t&&function(e,t){let n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.height/e.offsetHeight;o.topn.bottom&&(e.scrollTop+=(o.bottom-n.bottom)/r)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),o=e.getBoundingClientRect(),r=this.space;if(!r){let e=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:e.innerWidth,bottom:e.innerHeight}}return o.top>Math.min(r.bottom,t.bottom)-10||o.bottomn.from||0==n.from)&&(r=e,"string"!=typeof a&&a.header?o.appendChild(a.header(a)):o.appendChild(document.createElement("completion-section")).textContent=e)}const c=o.appendChild(document.createElement("li"));c.id=t+"-"+i,c.setAttribute("role","option");let u=this.optionClass(s);u&&(c.className=u);for(let e of this.optionContent){let t=e(s,this.view.state,this.view,l);t&&c.appendChild(t)}}return n.from&&o.classList.add("cm-completionListIncompleteTop"),n.tonew O(n,e,t)}function S(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class A{constructor(e,t,n,o,r,i){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=o,this.selected=r,this.disabled=i}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new A(this.options,P(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,o,r){let i=function(e,t){let n=[],o=null,r=e=>{n.push(e);let{section:t}=e.completion;if(t){o||(o=[]);let e="string"==typeof t?t:t.name;o.some((t=>t.name==e))||o.push("string"==typeof t?{name:e}:t)}};for(let o of e)if(o.hasResult()){let e=o.result.getMatch;if(!1===o.result.filter)for(let t of o.result.options)r(new u(t,o.source,e?e(t):[],1e9-n.length));else{let n=new k(t.sliceDoc(o.from,o.to));for(let t of o.result.options)if(n.match(t.label)){let i=t.displayLabel?e?e(t,n.matched):[]:n.matched;r(new u(t,o.source,i,n.score+(t.boost||0)))}}}if(o){let e=Object.create(null),t=0,r=(e,t)=>{var n,o;return(null!==(n=e.rank)&&void 0!==n?n:1e9)-(null!==(o=t.rank)&&void 0!==o?o:1e9)||(e.namet.score-e.score||l(e.completion,t.completion)))){let t=e.completion;!s||s.label!=t.label||s.detail!=t.detail||null!=s.type&&null!=t.type&&s.type!=t.type||s.apply!=t.apply||s.boost!=t.boost?i.push(e):S(e.completion)>S(s)&&(i[i.length-1]=e),s=e.completion}return i}(e,t);if(!i.length)return o&&e.some((e=>1==e.state))?new A(o.options,o.attrs,o.tooltip,o.timestamp,o.selected,!0):null;let s=t.facet(y).selectOnOpen?0:-1;if(o&&o.selected!=s&&-1!=o.selected){let e=o.options[o.selected].completion;for(let t=0;tt.hasResult()?Math.min(e,t.from):e),1e8),create:J,above:r.aboveCursor},o?o.timestamp:Date.now(),s,!1)}map(e){return new A(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class T{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new T(B,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(y),o=(n.override||t.languageDataAt("autocomplete",f(t)).map(m)).map((t=>(this.active.find((e=>e.source==t))||new Q(t,this.active.some((e=>0!=e.state))?1:0)).update(e,n)));o.length==this.active.length&&o.every(((e,t)=>e==this.active[t]))&&(o=this.active);let r=this.open;r&&e.docChanged&&(r=r.map(e.changes)),e.selection||o.some((t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to)))||!function(e,t){if(e==t)return!0;for(let n=0,o=0;;){for(;n1==e.state))&&(r=null),!r&&o.every((e=>1!=e.state))&&o.some((e=>e.hasResult()))&&(o=o.map((e=>e.hasResult()?new Q(e.source,0):e)));for(let t of e.effects)t.is(U)&&(r=r&&r.setSelected(t.value,this.id));return o==this.active&&r==this.open?this:new T(o,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:D}}const D={"aria-autocomplete":"list"};function P(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const B=[];function I(e){return e.isUserEvent("input.type")?"input":e.isUserEvent("delete.backward")?"delete":null}class Q{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=I(e),o=this;n?o=o.handleUserEvent(e,n,t):e.docChanged?o=o.handleChange(e):e.selection&&0!=o.state&&(o=new Q(o.source,0));for(let t of e.effects)if(t.is(g))o=new Q(o.source,1,t.value?f(e.state):-1);else if(t.is(v))o=new Q(o.source,0);else if(t.is(R))for(let e of t.value)e.source==o.source&&(o=e);return o}handleUserEvent(e,t,n){return"delete"!=t&&n.activateOnTyping?new Q(this.source,1):this.map(e.changes)}handleChange(e){return e.changes.touchesRange(f(e.startState))?new Q(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new Q(this.source,this.state,e.mapPos(this.explicitPos))}}class M extends Q{constructor(e,t,n,o,r){super(e,2,t),this.result=n,this.from=o,this.to=r}hasResult(){return!0}handleUserEvent(e,t,n){var o;let r=e.changes.mapPos(this.from),i=e.changes.mapPos(this.to,1),l=f(e.state);if((this.explicitPos<0?l<=r:li||"delete"==t&&f(e.startState)==this.from)return new Q(this.source,"input"==t&&n.activateOnTyping?1:0);let a,c=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return function(e,t,n,o){if(!e)return!1;let r=t.sliceDoc(n,o);return"function"==typeof e?e(r,n,o,t):h(e,!0).test(r)}(this.result.validFor,e.state,r,i)?new M(this.source,c,this.result,r,i):this.result.update&&(a=this.result.update(this.result,r,i,new s(e.state,l,c>=0)))?new M(this.source,c,a,a.from,null!==(o=a.to)&&void 0!==o?o:f(e.state)):new Q(this.source,1,c)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new Q(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new M(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}const R=o.Py.define({map(e,t){return e.map((e=>e.map(t)))}}),U=o.Py.define(),E=o.QQ.define({create(){return T.start()},update(e,t){return e.update(t)},provide:e=>[r.hJ.from(e,(e=>e.tooltip)),r.tk.contentAttributes.from(e,(e=>e.attrs))]});function j(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(E).active.find((e=>e.source==t.source));return r instanceof M&&("string"==typeof n?e.dispatch(Object.assign(Object.assign({},function(e,t,n,r){let{main:i}=e.selection,s=n-i.from,l=r-i.from;return Object.assign(Object.assign({},e.changeByRange((a=>a!=i&&n!=r&&e.sliceDoc(a.from+s,a.from+l)!=e.sliceDoc(n,r)?{range:a}:{changes:{from:a.from+s,to:r==i.from?a.to:a.from+l,insert:t},range:o.jT.cursor(a.from+s+t.length)}))),{scrollIntoView:!0,userEvent:"input.complete"})}(e.state,n,r.from,r.to)),{annotations:d.of(t.completion)})):n(e,t.completion,r.from,r.to),!0)}const J=C(E,j);function L(e,t="option"){return n=>{let o=n.state.field(E,!1);if(!o||!o.open||o.open.disabled||Date.now()-o.open.timestamp-1?o.open.selected+s*(e?1:-1):e?0:l-1;return a<0?a="page"==t?0:l-1:a>=l&&(a="page"==t?l-1:0),n.dispatch({effects:U.of(a)}),!0}}class N{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const $=r.lg.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let t of e.state.field(E).active)1==t.state&&this.startQuery(t)}update(e){let t=e.state.field(E);if(!e.selectionSet&&!e.docChanged&&e.startState.field(E)==t)return;let n=e.transactions.some((e=>(e.selection||e.docChanged)&&!I(e)));for(let t=0;t50&&Date.now()-o.time>1e3){for(let e of o.context.abortListeners)try{e()}catch(e){(0,r.OO)(this.view.state,e)}o.context.abortListeners=null,this.running.splice(t--,1)}else o.updates.push(...e.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=t.active.some((e=>1==e.state&&!this.running.some((t=>t.active.source==e.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let t of e.transactions)"input"==I(t)?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:e}=this.view,t=e.field(E);for(let e of t.active)1!=e.state||this.running.some((t=>t.active.source==e.source))||this.startQuery(e)}startQuery(e){let{state:t}=this.view,n=f(t),o=new s(t,n,e.explicitPos==n),i=new N(e,o);this.running.push(i),Promise.resolve(e.source(o)).then((e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())}),(e=>{this.view.dispatch({effects:v.of(null)}),(0,r.OO)(this.view.state,e)}))}scheduleAccept(){this.running.every((e=>void 0!==e.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(y).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(y);for(let o=0;oe.source==r.active.source));if(i&&1==i.state)if(null==r.done){let e=new Q(r.active.source,0);for(let t of r.updates)e=e.update(t,n);1!=e.state&&t.push(e)}else this.startQuery(i)}t.length&&this.view.dispatch({effects:R.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(E,!1);if(t&&t.tooltip&&this.view.state.facet(y).closeOnBlur){let n=t.open&&(0,r.gB)(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||this.view.dispatch({effects:v.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:g.of(!1)})),20),this.composing=0}}}),q=r.tk.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),V={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Z=o.Py.define({map(e,t){let n=t.mapPos(e,-1,o.gc.TrackAfter);return null==n?void 0:n}}),z=new class extends o.uU{};z.startSide=1,z.endSide=-1;const W=o.QQ.define({create(){return o.Xs.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(Z)&&(e=e.update({add:[z.range(n.value,n.value+1)]}));return e}});function _(){return[Y,W]}const X="()[]{}<>";function F(e){for(let t=0;t<8;t+=2)if(X.charCodeAt(t)==e)return X.charAt(t+1);return(0,o.bg)(e<128?e:e+1)}function H(e,t){return e.languageDataAt("closeBrackets",t)[0]||V}const G="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Y=r.tk.inputHandler.of(((e,t,n,r)=>{if((G?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||2==r.length&&1==(0,o.nZ)((0,o.gm)(r,0))||t!=i.from||n!=i.to)return!1;let s=function(e,t){let n=H(e,e.selection.main.head),r=n.brackets||V.brackets;for(let i of r){let s=F((0,o.gm)(i,0));if(t==i)return s==i?re(e,i,r.indexOf(i+i+i)>-1,n):ne(e,i,s,n.before||V.before);if(t==s&&ee(e,e.selection.main.from))return oe(e,0,s)}return null}(e.state,r);return!!s&&(e.dispatch(s),!0)})),K=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=H(e,e.selection.main.head).brackets||V.brackets,r=null,i=e.changeByRange((t=>{if(t.empty){let r=function(e,t){let n=e.sliceString(t-2,t);return(0,o.nZ)((0,o.gm)(n,0))==n.length?n:n.slice(1)}(e.doc,t.head);for(let i of n)if(i==r&&te(e.doc,t.head)==F((0,o.gm)(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:o.jT.cursor(t.head-i.length)}}return{range:r=t}}));return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function ee(e,t){let n=!1;return e.field(W).between(0,e.doc.length,(e=>{e==t&&(n=!0)})),n}function te(e,t){let n=e.sliceString(t,t+2);return n.slice(0,(0,o.nZ)((0,o.gm)(n,0)))}function ne(e,t,n,r){let i=null,s=e.changeByRange((s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:n,from:s.to}],effects:Z.of(s.to+t.length),range:o.jT.range(s.anchor+t.length,s.head+t.length)};let l=te(e.doc,s.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:t+n,from:s.head},effects:Z.of(s.head+t.length),range:o.jT.cursor(s.head+t.length)}:{range:i=s}}));return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function oe(e,t,n){let r=null,i=e.changeByRange((t=>t.empty&&te(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:o.jT.cursor(t.head+n.length)}:r={range:t}));return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function re(e,t,n,r){let s=r.stringPrefixes||V.stringPrefixes,l=null,a=e.changeByRange((r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:Z.of(r.to+t.length),range:o.jT.range(r.anchor+t.length,r.head+t.length)};let a,c=r.head,u=te(e.doc,c);if(u==t){if(ie(e,c))return{changes:{insert:t+t,from:c},effects:Z.of(c+t.length),range:o.jT.cursor(c+t.length)};if(ee(e,c)){let r=n&&e.sliceDoc(c,c+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:c,to:c+r.length,insert:r},range:o.jT.cursor(c+r.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(a=se(e,c-2*t.length,s))>-1&&ie(e,a))return{changes:{insert:t+t+t+t,from:c},effects:Z.of(c+t.length),range:o.jT.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=o.D0.Word&&se(e,c,s)>-1&&!function(e,t,n,o){let r=(0,i.qz)(e).resolveInner(t,-1),s=o.reduce(((e,t)=>Math.max(e,t.length)),0);for(let i=0;i<5;i++){let i=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+s)),l=i.indexOf(n);if(!l||l>-1&&o.indexOf(i.slice(0,l))>-1){let t=r.firstChild;for(;t&&t.from==r.from&&t.to-t.from>n.length+l;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let a=r.to==t&&r.parent;if(!a)break;r=a}return!1}(e,c,t,s))return{changes:{insert:t+t,from:c},effects:Z.of(c+t.length),range:o.jT.cursor(c+t.length)}}return{range:l=r}}));return l?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function ie(e,t){let n=(0,i.qz)(e).resolveInner(t+1);return n.parent&&n.from==t}function se(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=o.D0.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=o.D0.Word)return n}return-1}function le(e={}){return[E,y.of(e),$,ce,q]}const ae=[{key:"Ctrl-Space",run:e=>!!e.state.field(E,!1)&&(e.dispatch({effects:g.of(!0)}),!0)},{key:"Escape",run:e=>{let t=e.state.field(E,!1);return!(!t||!t.active.some((e=>0!=e.state))||(e.dispatch({effects:v.of(null)}),0))}},{key:"ArrowDown",run:L(!0)},{key:"ArrowUp",run:L(!1)},{key:"PageDown",run:L(!0,"page")},{key:"PageUp",run:L(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(E,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.facet(y).defaultKeymap?[ae]:[])))},21390:function(e,t,n){n.d(t,{i6:function(){return J}});var o=n(59119),r=n(35524),i=n(53105),s=n(34790);const l=20,a=21;function c(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function u(e,t,n){for(let o=!1;;){if(e.next<0)return;if(e.next==t&&!o)return void e.advance();o=n&&!o&&92==e.next,e.advance()}}function f(e,t){for(;95==e.next||c(e.next);)null!=t&&(t+=String.fromCharCode(e.next)),e.advance();return t}function h(e,t){for(;48==e.next||49==e.next;)e.advance();t&&e.next==t&&e.advance()}function d(e,t){for(;;){if(46==e.next){if(t)break;t=!0}else if(e.next<48||e.next>57)break;e.advance()}if(69==e.next||101==e.next)for(e.advance(),43!=e.next&&45!=e.next||e.advance();e.next>=48&&e.next<=57;)e.advance()}function p(e){for(;!(e.next<0||10==e.next);)e.advance()}function m(e,t){for(let n=0;n!=&|~^/",specialVar:"?",identifierQuotes:'"',words:v("absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone ","array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying ")};function y(e){return new i.Jq((t=>{var n;let{next:o}=t;if(t.advance(),m(o,g)){for(;m(t.next,g);)t.advance();t.acceptToken(36)}else if(36==o&&36==t.next&&e.doubleDollarQuotedStrings)!function(e){for(;;){if(e.next<0||e.peek(1)<0)return;if(36==e.next&&36==e.peek(1))return void e.advance(2);e.advance()}}(t),t.acceptToken(3);else if(39==o||34==o&&e.doubleQuotedStrings)u(t,o,e.backslashEscapes),t.acceptToken(3);else if(35==o&&e.hashComments||47==o&&47==t.next&&e.slashComments)p(t),t.acceptToken(1);else if(45!=o||45!=t.next||e.spaceAfterDashes&&32!=t.peek(1))if(47==o&&42==t.next){t.advance();for(let e=1;;){let n=t.next;if(t.next<0)break;if(t.advance(),42==n&&47==t.next){if(e--,t.advance(),!e)break}else 47==n&&42==t.next&&(e++,t.advance())}t.acceptToken(2)}else if(101!=o&&69!=o||39!=t.next)if(110!=o&&78!=o||39!=t.next||!e.charSetCasts)if(95==o&&e.charSetCasts)for(let n=0;;n++){if(39==t.next&&n>1){t.advance(),u(t,39,e.backslashEscapes),t.acceptToken(3);break}if(!c(t.next))break;t.advance()}else if(e.plsqlQuotingMechanism&&(113==o||81==o)&&39==t.next&&t.peek(1)>0&&!m(t.peek(1),g)){let e=t.peek(1);t.advance(2),function(e,t){let n="[{<(".indexOf(String.fromCharCode(t)),o=n<0?t:"]}>)".charCodeAt(n);for(;;){if(e.next<0)return;if(e.next==o&&39==e.peek(1))return void e.advance(2);e.advance()}}(t,e),t.acceptToken(3)}else if(40==o)t.acceptToken(7);else if(41==o)t.acceptToken(8);else if(123==o)t.acceptToken(9);else if(125==o)t.acceptToken(10);else if(91==o)t.acceptToken(11);else if(93==o)t.acceptToken(12);else if(59==o)t.acceptToken(13);else if(e.unquotedBitLiterals&&48==o&&98==t.next)t.advance(),h(t),t.acceptToken(22);else if(98!=o&&66!=o||39!=t.next&&34!=t.next){if(48==o&&(120==t.next||88==t.next)||(120==o||88==o)&&39==t.next){let e=39==t.next;for(t.advance();(r=t.next)>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70;)t.advance();e&&39==t.next&&t.advance(),t.acceptToken(4)}else if(46==o&&t.next>=48&&t.next<=57)d(t,!0),t.acceptToken(4);else if(46==o)t.acceptToken(14);else if(o>=48&&o<=57)d(t,!1),t.acceptToken(4);else if(m(o,e.operatorChars)){for(;m(t.next,e.operatorChars);)t.advance();t.acceptToken(15)}else if(m(o,e.specialVar))t.next==o&&t.advance(),function(e){if(39==e.next||34==e.next||96==e.next){let t=e.next;e.advance(),u(e,t,!1)}else f(e)}(t),t.acceptToken(17);else if(m(o,e.identifierQuotes))u(t,o,!1),t.acceptToken(19);else if(58==o||44==o)t.acceptToken(16);else if(c(o)){let r=f(t,String.fromCharCode(o));t.acceptToken(46==t.next?18:null!==(n=e.words[r.toLowerCase()])&&void 0!==n?n:18)}}else{const n=t.next;t.advance(),e.treatBitsAsBytes?(u(t,n,e.backslashEscapes),t.acceptToken(23)):(h(t,n),t.acceptToken(22))}else t.advance(),u(t,39,e.backslashEscapes),t.acceptToken(3);else t.advance(),u(t,39,!0);else p(t),t.acceptToken(1);var r}))}const b=y(k),w=i.WQ.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,b],topRules:{Script:[0,25]},tokenPrec:0});function x(e){let t=e.cursor().moveTo(e.from,-1);for(;/Comment/.test(t.name);)t.moveTo(t.from,-1);return t.node}function O(e,t){let n=e.sliceString(t.from,t.to),o=/^([`'"])(.*)\1$/.exec(n);return o?o[2]:n}function C(e){return e&&("Identifier"==e.name||"QuotedIdentifier"==e.name)}function S(e,t){if("CompositeIdentifier"==t.name){let n=[];for(let o=t.firstChild;o;o=o.nextSibling)C(o)&&n.push(O(e,o));return n}return[O(e,t)]}function A(e,t){for(let n=[];;){if(!t||"."!=t.name)return n;let o=x(t);if(!C(o))return n;n.unshift(O(e,o)),t=x(o)}}const T=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" ")),D=/^\w*$/,P=/^[`'"]?\w*[`'"]?$/;class B{constructor(){this.list=[],this.children=void 0}child(e,t){let n=this.children||(this.children=Object.create(null));return n[e]||(e&&this.list.push(I(e,"type",t)),n[e]=new B)}addCompletions(e){for(let t of e){let e=this.list.findIndex((e=>e.label==t.label));e>-1?this.list[e]=t:this.list.push(t)}}}function I(e,t,n){return/[^\w\xb5-\uffff]/.test(e)?{label:e,type:t,apply:n+e+n}:{label:e,type:t}}let Q=w.configure({props:[o.uj.add({Statement:(0,o.tC)()}),o.x0.add({Statement(e){return{from:e.firstChild.to,to:e.to}},BlockComment(e){return{from:e.from+2,to:e.to-2}}}),(0,r.Gv)({Keyword:r.pJ.keyword,Type:r.pJ.typeName,Builtin:r.pJ.standard(r.pJ.name),Bits:r.pJ.number,Bytes:r.pJ.string,Bool:r.pJ.bool,Null:r.pJ.null,Number:r.pJ.number,String:r.pJ.string,Identifier:r.pJ.name,QuotedIdentifier:r.pJ.special(r.pJ.string),SpecialVar:r.pJ.special(r.pJ.name),LineComment:r.pJ.lineComment,BlockComment:r.pJ.blockComment,Operator:r.pJ.operator,"Semi Punctuation":r.pJ.punctuation,"( )":r.pJ.paren,"{ }":r.pJ.brace,"[ ]":r.pJ.squareBracket})]});class M{constructor(e,t,n){this.dialect=e,this.language=t,this.spec=n}get extension(){return this.language.extension}static define(e){let t=function(e,t,n,o){let r={};for(let t in k)r[t]=(e.hasOwnProperty(t)?e:k)[t];return t&&(r.words=v(t,n||"",o)),r}(e,e.keywords,e.types,e.builtin),n=o.qp.define({name:"sql",parser:Q.configure({tokenizers:[{from:b,to:y(t)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new M(t,n,e)}}function R(e,t=!1){return function(e,t){let n=Object.keys(e).map((n=>({label:t?n.toUpperCase():n,type:e[n]==a?"type":e[n]==l?"keyword":"variable",boost:-1})));return(0,s.eC)(["QuotedIdentifier","SpecialVar","String","LineComment","BlockComment","."],(0,s.Mb)(n))}(e.dialect.words,t)}function U(e,t=!1){return e.language.data.of({autocomplete:R(e,t)})}function E(e){return e.schema?function(e,t,n,r,i,s){var l;let a=new B,c=(null===(l=null==s?void 0:s.spec.identifierQuotes)||void 0===l?void 0:l[0])||'"',u=a.child(i||"",c);for(let t in e){let n=t.replace(/\\?\./g,(e=>"."==e?"\0":e)).split("\0"),o=1==n.length?u:a;for(let e of n)o=o.child(e.replace(/\\\./g,"."),c);for(let n of e[t])n&&o.list.push("string"==typeof n?I(n,"property",c):n)}return t&&u.addCompletions(t),n&&a.addCompletions(n),a.addCompletions(u.list),r&&a.addCompletions(u.child(r,c).list),e=>{let{parents:t,from:n,quoted:i,empty:s,aliases:l}=function(e,t){let n=(0,o.qz)(e).resolveInner(t,-1),r=function(e,t){let n;for(let e=t;!n;e=e.parent){if(!e)return null;"Statement"==e.name&&(n=e)}let o=null;for(let t=n.firstChild,r=!1,i=null;t;t=t.nextSibling){let n="Keyword"==t.name?e.sliceString(t.from,t.to).toLowerCase():null,s=null;if(r)if("as"==n&&i&&C(t.nextSibling))s=O(e,t.nextSibling);else{if(n&&T.has(n))break;i&&C(t)&&(s=O(e,t))}else r="from"==n;s&&(o||(o=Object.create(null)),o[s]=S(e,i)),i=/Identifier$/.test(t.name)?t:null}return o}(e.doc,n);return"Identifier"==n.name||"QuotedIdentifier"==n.name||"Keyword"==n.name?{from:n.from,quoted:"QuotedIdentifier"==n.name?e.doc.sliceString(n.from,n.from+1):null,parents:A(e.doc,x(n)),aliases:r}:"."==n.name?{from:t,quoted:null,parents:A(e.doc,n),aliases:r}:{from:t,quoted:null,parents:[],empty:!0,aliases:r}}(e.state,e.pos);if(s&&!e.explicit)return null;l&&1==t.length&&(t=l[t[0]]||t);let f=a;for(let e of t){for(;!f.children||!f.children[e];)if(f==a)f=u;else{if(f!=u||!r)return null;f=f.child(r,c)}f=f.child(e,c)}let h=i&&e.state.sliceDoc(e.pos,e.pos+1)==i,d=f.list;return f==a&&l&&(d=d.concat(Object.keys(l).map((e=>({label:e,type:"constant"}))))),{from:n,to:h?e.pos+1:void 0,options:(p=i,m=d,p?m.map((e=>Object.assign(Object.assign({},e),{label:p+e.label+p,apply:void 0}))):m),validFor:i?P:D};var p,m}}(e.schema,e.tables,e.schemas,e.defaultTable,e.defaultSchema,e.dialect||L):()=>null}function j(e){return e.schema?(e.dialect||L).language.data.of({autocomplete:E(e)}):[]}function J(e={}){let t=e.dialect||L;return new o.ri(t.language,[j(e),U(t,!!e.upperCaseKeywords)])}const L=M.define({})},59119:function(e,t,n){n.d(t,{Gn:function(){return B},K0:function(){return P},R_:function(){return ve},SS:function(){return D},Um:function(){return Be},c:function(){return A},e7:function(){return K},mi:function(){return ae},n$:function(){return Ae},nF:function(){return pe},nY:function(){return L},qp:function(){return d},qz:function(){return p},ri:function(){return C},tC:function(){return j},uj:function(){return I},x0:function(){return $},y1:function(){return T}});var o,r=n(41113),i=n(78120),s=n(47421),l=n(35524),a=n(28699);const c=new r.md;const u=new r.md;class f{constructor(e,t,n=[],o=""){this.data=e,this.name=o,i.yy.prototype.hasOwnProperty("tree")||Object.defineProperty(i.yy.prototype,"tree",{get(){return p(this)}}),this.parser=t,this.extension=[O.of(this),i.yy.languageData.of(((e,t,n)=>{let o=h(e,t,n),r=o.type.prop(c);if(!r)return[];let i=e.facet(r),s=o.type.prop(u);if(s){let r=o.resolve(t-o.from,n);for(let t of s)if(t.test(r,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(i)}}return i}))].concat(n)}isActiveAt(e,t,n=-1){return h(e,t,n).type.prop(c)==this.data}findRegions(e){let t=e.facet(O);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],o=(e,t)=>{if(e.prop(c)==this.data)return void n.push({from:t,to:t+e.length});let i=e.prop(r.md.mounted);if(i){if(i.tree.prop(c)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(o(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;ne.concat(n):void 0}));var n;return new d(t,e.parser.configure({props:[c.add((e=>e.isTop?t:void 0))]}),e.name)}configure(e,t){return new d(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function p(e){let t=e.field(f.state,!1);return t?t.tree:r.mp.empty}class m{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let g=null;class v{constructor(e,t,n=[],o,r,i,s,l){this.parser=e,this.state=t,this.fragments=n,this.tree=o,this.treeLen=r,this.viewport=i,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new v(e,t,[],r.mp.empty,0,n,[],null)}startParse(){return this.parser.startParse(new m(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=r.mp.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((()=>{for(;!(t=this.parse.advance()););})),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(r.i9.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=g;g=this;try{return e()}finally{g=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=k(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:o,treeLen:i,viewport:s,skipped:l}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,n,o,r)=>t.push({fromA:e,toA:n,fromB:o,toB:r}))),n=r.i9.applyChanges(n,t),o=r.mp.empty,i=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){l=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),o=e.mapPos(t.to,-1);ne.from&&(this.fragments=k(this.fragments,n,o),this.skipped.splice(t--,1))}return!(this.skipped.length>=t||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends r._b{createParse(t,n,o){let i=o[0].from,s=o[o.length-1].to;return{parsedPos:i,advance(){let t=g;if(t){for(let e of o)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=s,new r.mp(r.Jq.none,[],[],s-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return g}}function k(e,t,n){return r.i9.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class y{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new y(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=v.create(e.facet(O).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new y(n)}}f.state=i.QQ.define({create:y.init,update(e,t){for(let e of t.effects)if(e.is(f.setState))return e.value;return t.startState.facet(O)!=t.state.facet(O)?y.init(t.state):e.apply(t)}});let b=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(b=e=>{let t=-1,n=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const w="undefined"!=typeof navigator&&(null===(o=navigator.scheduling)||void 0===o?void 0:o.isInputPending)?()=>navigator.scheduling.isInputPending():null,x=s.lg.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(f.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(f.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=b(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndo+1e3,l=r.context.work((()=>w&&w()||Date.now()>i),o+(s?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:f.setState.of(new y(r.context))})),this.chunkBudget>0&&(!l||s)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((()=>this.scheduleWork())).catch((e=>(0,s.OO)(this.view.state,e))).then((()=>this.workScheduled--)),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),O=i.r$.define({combine(e){return e.length?e[0]:null},enables:e=>[f.state,x,s.tk.contentAttributes.compute([e],(t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]});class C{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const S=i.r$.define(),A=i.r$.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((e=>e!=t[0])))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function T(e){let t=e.facet(A);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function D(e,t){let n="",o=e.tabSize,r=e.facet(A)[0];if("\t"==r){for(;t>=o;)n+="\t",t-=o;r=" "}for(let e=0;e=t?function(e,t,n){let o=t.resolveStack(n),r=o.node.enterUnfinishedNodesBefore(n);if(r!=o.node){let e=[];for(let t=r;t!=o.node;t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)o={node:e[t],next:o}}return Q(o,e,n)}(e,n,t):null}class B{constructor(e,t={}){this.state=e,this.options=t,this.unit=T(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:o,simulateDoubleBreak:r}=this.options;return null!=o&&o>=n.from&&o<=n.to?r&&o==e?{text:"",from:e}:(t<0?o-1&&(r+=i-this.countColumn(n,n.search(/\S|$/))),r}countColumn(e,t=e.length){return(0,i.IS)(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:o}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let e=r(o);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const I=new r.md;function Q(e,t,n){for(let o=e;o;o=o.next){let e=M(o.node);if(e)return e(U.create(t,n,o))}return 0}function M(e){let t=e.type.prop(I);if(t)return t;let n,o=e.firstChild;if(o&&(n=o.type.prop(r.md.closedBy))){let t=e.lastChild,o=t&&n.indexOf(t.name)>-1;return e=>function(e,t,n,o,r){let i=e.textAfter,s=i.match(/^\s*/)[0].length,l=o&&i.slice(s,s+o.length)==o||r==e.pos+s,a=t?function(e){let t=e.node,n=t.childAfter(t.from),o=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),s=null==r||r<=i.from?i.to:Math.min(i.to,r);for(let e=n.to;;){let r=t.childAfter(e);if(!r||r==o)return null;if(!r.type.isSkipped)return r.from{let o=e&&e.test(n.textAfter);return n.baseIndent+(o?0:t*n.unit)}}const J=200;function L(){return i.yy.transactionFilter.of((e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:o}=e.newSelection.main,r=n.lineAt(o);if(o>r.from+J)return e;let i=n.sliceString(r.from,o);if(!t.some((e=>e.test(i))))return e;let{state:s}=e,l=-1,a=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==l)continue;l=t.from;let n=P(s,t.from);if(null==n)continue;let o=/^\s*/.exec(t.text)[0],r=D(s,n);o!=r&&a.push({from:t.from,to:t.from+o.length,insert:r})}return a.length?[e,{changes:a,sequential:!0}]:e}))}const N=i.r$.define(),$=new r.md;function q(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function V(e,t,n){for(let o of e.facet(N)){let r=o(e,t,n);if(r)return r}return function(e,t,n){let o=p(e);if(o.lengthn)continue;if(r&&s.from=t&&o.to>n&&(r=o)}}return r}(e,t,n)}function Z(e,t){let n=t.mapPos(e.from,1),o=t.mapPos(e.to,-1);return n>=o?void 0:{from:n,to:o}}const z=i.Py.define({map:Z}),W=i.Py.define({map:Z});function _(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some((e=>e.from<=n&&e.to>=n))||t.push(e.lineBlockAt(n));return t}const X=i.QQ.define({create(){return s.p.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)if(n.is(z)&&!H(e,n.value.from,n.value.to)){let{preparePlaceholder:o}=t.state.facet(te),r=o?s.p.replace({widget:new ie(o(t.state,n.value))}):re;e=e.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(W)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));if(t.selection){let n=!1,{head:o}=t.selection.main;e.between(o,o,((e,t)=>{eo&&(n=!0)})),n&&(e=e.update({filterFrom:o,filterTo:o,filter:(e,t)=>t<=o||e>=o}))}return e},provide:e=>s.tk.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,((e,t)=>{n.push(e,t)})),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n{(!r||r.from>e)&&(r={from:e,to:t})})),r}function H(e,t,n){let o=!1;return e.between(t,t,((e,r)=>{e==t&&r==n&&(o=!0)})),o}function G(e,t){return e.field(X,!1)?t:t.concat(i.Py.appendConfig.of(ne()))}function Y(e,t,n=!0){let o=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return s.tk.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${o} ${e.state.phrase("to")} ${r}.`)}const K=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of _(e)){let n=V(e.state,t.from,t.to);if(n)return e.dispatch({effects:G(e.state,[z.of(n),Y(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(X,!1))return!1;let t=[];for(let n of _(e)){let o=F(e.state,n.from,n.to);o&&t.push(W.of(o),Y(e,o,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let o=0;o{let t=e.state.field(X,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,((e,t)=>{n.push(W.of({from:e,to:t}))})),e.dispatch({effects:n}),!0}}],ee={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},te=i.r$.define({combine(e){return(0,i.BO)(e,ee)}});function ne(e){let t=[X,ce];return e&&t.push(te.of(e)),t}function oe(e,t){let{state:n}=e,o=n.facet(te),r=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),o=F(e.state,n.from,n.to);o&&e.dispatch({effects:W.of(o)}),t.preventDefault()};if(o.placeholderDOM)return o.placeholderDOM(e,r,t);let i=document.createElement("span");return i.textContent=o.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=r,i}const re=s.p.replace({widget:new class extends s.l9{toDOM(e){return oe(e,null)}}});class ie extends s.l9{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return oe(e,this.value)}}const se={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class le extends s.SJ{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function ae(e={}){let t=Object.assign(Object.assign({},se),e),n=new le(t,!0),o=new le(t,!1),r=s.lg.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(O)!=e.state.facet(O)||e.startState.field(X,!1)!=e.state.field(X,!1)||p(e.startState)!=p(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new i.f_;for(let r of e.viewportLineBlocks){let i=F(e.state,r.from,r.to)?o:V(e.state,r.from,r.to)?n:null;i&&t.add(r.from,r.from,i)}return t.finish()}}),{domEventHandlers:l}=t;return[r,(0,s.v5)({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.markers)||i.Xs.empty},initialSpacer(){return new le(t,!1)},domEventHandlers:Object.assign(Object.assign({},l),{click:(e,t,n)=>{if(l.click&&l.click(e,t,n))return!0;let o=F(e.state,t.from,t.to);if(o)return e.dispatch({effects:W.of(o)}),!0;let r=V(e.state,t.from,t.to);return!!r&&(e.dispatch({effects:z.of(r)}),!0)}})}),ne()]}const ce=s.tk.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class ue{constructor(e,t){let n;function o(e){let t=a.V.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const r="string"==typeof t.all?t.all:t.all?o(t.all):void 0,i=t.scope;this.scope=i instanceof f?e=>e.prop(c)==i.data:i?e=>e==i:void 0,this.style=(0,l.QR)(e.map((e=>({tag:e.tag,class:e.class||o(Object.assign({},e,{tag:null}))}))),{all:r}).style,this.module=n?new a.V(n):null,this.themeType=t.themeType}static define(e,t){return new ue(e,t||{})}}const fe=i.r$.define(),he=i.r$.define({combine(e){return e.length?[e[0]]:null}});function de(e){let t=e.facet(fe);return t.length?t:e.facet(he)}function pe(e,t){let n,o=[ge];return e instanceof ue&&(e.module&&o.push(s.tk.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?o.push(he.of(e)):n?o.push(fe.computeN([s.tk.darkTheme],(t=>t.facet(s.tk.darkTheme)==("dark"==n)?[e]:[]))):o.push(fe.of(e)),o}class me{constructor(e){this.markCache=Object.create(null),this.tree=p(e.state),this.decorations=this.buildDeco(e,de(e.state))}update(e){let t=p(e.state),n=de(e.state),o=n!=de(e.startState);t.length{n.add(e,t,this.markCache[o]||(this.markCache[o]=s.p.mark({class:o})))}),o,r);return n.finish()}}const ge=i.Wl.high(s.lg.fromClass(me,{decorations:e=>e.decorations})),ve=ue.define([{tag:l.pJ.meta,color:"#404740"},{tag:l.pJ.link,textDecoration:"underline"},{tag:l.pJ.heading,textDecoration:"underline",fontWeight:"bold"},{tag:l.pJ.emphasis,fontStyle:"italic"},{tag:l.pJ.strong,fontWeight:"bold"},{tag:l.pJ.strikethrough,textDecoration:"line-through"},{tag:l.pJ.keyword,color:"#708"},{tag:[l.pJ.atom,l.pJ.bool,l.pJ.url,l.pJ.contentSeparator,l.pJ.labelName],color:"#219"},{tag:[l.pJ.literal,l.pJ.inserted],color:"#164"},{tag:[l.pJ.string,l.pJ.deleted],color:"#a11"},{tag:[l.pJ.regexp,l.pJ.escape,l.pJ.special(l.pJ.string)],color:"#e40"},{tag:l.pJ.definition(l.pJ.variableName),color:"#00f"},{tag:l.pJ.local(l.pJ.variableName),color:"#30a"},{tag:[l.pJ.typeName,l.pJ.namespace],color:"#085"},{tag:l.pJ.className,color:"#167"},{tag:[l.pJ.special(l.pJ.variableName),l.pJ.macroName],color:"#256"},{tag:l.pJ.definition(l.pJ.propertyName),color:"#00c"},{tag:l.pJ.comment,color:"#940"},{tag:l.pJ.invalid,color:"#f00"}]),ke=s.tk.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),ye=1e4,be="()[]{}",we=i.r$.define({combine(e){return(0,i.BO)(e,{afterCursor:!0,brackets:be,maxScanDistance:ye,renderMatch:Ce})}}),xe=s.p.mark({class:"cm-matchingBracket"}),Oe=s.p.mark({class:"cm-nonmatchingBracket"});function Ce(e){let t=[],n=e.matched?xe:Oe;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const Se=[i.QQ.define({create(){return s.p.none},update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],o=t.state.facet(we);for(let e of t.state.selection.ranges){if(!e.empty)continue;let r=Be(t.state,e.head,-1,o)||e.head>0&&Be(t.state,e.head-1,1,o)||o.afterCursor&&(Be(t.state,e.head,1,o)||e.heads.tk.decorations.from(e)}),ke];function Ae(e={}){return[we.of(e),Se]}const Te=new r.md;function De(e,t,n){let o=e.prop(t<0?r.md.openedBy:r.md.closedBy);if(o)return o;if(1==e.name.length){let o=n.indexOf(e.name);if(o>-1&&o%2==(t<0?1:0))return[n[o+t]]}return null}function Pe(e){let t=e.type.prop(Te);return t?t(e.node):e}function Be(e,t,n,o={}){let r=o.maxScanDistance||ye,i=o.brackets||be,s=p(e),l=s.resolveInner(t,n);for(let e=l;e;e=e.parent){let o=De(e.type,n,i);if(o&&e.from0?t>=r.from&&tr.from&&t<=r.to))return Ie(0,0,n,e,r,o,i)}}return function(e,t,n,o,r,i,s){let l=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),a=s.indexOf(l);if(a<0||a%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),f=0;for(let e=0;!u.next().done&&e<=i;){let i=u.value;n<0&&(e+=i.length);let l=t+e*n;for(let e=n>0?0:i.length-1,t=n>0?i.length:-1;e!=t;e+=n){let t=s.indexOf(i[e]);if(!(t<0||o.resolveInner(l+e,1).type!=r))if(t%2==0==n>0)f++;else{if(1==f)return{start:c,end:{from:l+e,to:l+e+1},matched:t>>1==a>>1};f--}}n>0&&(e+=i.length)}return u.done?{start:c,matched:!1}:null}(e,t,n,s,l.type,r,i)}function Ie(e,t,n,o,r,i,s){let l=o.parent,a={from:r.from,to:r.to},c=0,u=null==l?void 0:l.cursor();if(u&&(n<0?u.childBefore(o.from):u.childAfter(o.to)))do{if(n<0?u.to<=o.from:u.from>=o.to){if(0==c&&i.indexOf(u.type.name)>-1&&u.from-1||(Re.push(e),console.warn(t))}function Je(e,t){let n=[];for(let o of t.split(" ")){let t=[];for(let n of o.split(".")){let o=e[n]||l.pJ[n];o?"function"==typeof o?t.length?t=t.map(o):je(n,`Modifier ${n} used at start of tag`):t.length?je(n,`Tag ${n} used as modifier`):t=Array.isArray(o)?o:[o]:je(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let o=t.replace(/ /g,"_"),i=o+" "+n.map((e=>e.id)),s=Ue[i];if(s)return s.id;let a=Ue[i]=r.Jq.define({id:Me.length,name:o,props:[(0,l.Gv)({[o]:n})]});return Me.push(a),a.id}},7170:function(e,t,n){n.d(t,{Xy:function(){return nt}});var o=n(47421),r=n(78120),i=n(59119),s=n(41113);function l(e,t){return({state:n,dispatch:o})=>{if(n.readOnly)return!1;let r=e(t,n);return!!r&&(o(n.update(r)),!0)}}const a=l(p,0),c=l(d,0),u=l(((e,t)=>d(e,t,function(e){let t=[];for(let n of e.selection.ranges){let o=e.doc.lineAt(n.from),r=n.to<=o.to?o:e.doc.lineAt(n.to),i=t.length-1;i>=0&&t[i].to>o.from?t[i].to=r.to:t.push({from:o.from+/^\s*/.exec(o.text)[0].length,to:r.to})}return t}(t))),0);function f(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}const h=50;function d(e,t,n=t.selection.ranges){let o=n.map((e=>f(t,e.from).block));if(!o.every((e=>e)))return null;let r=n.map(((e,n)=>function(e,{open:t,close:n},o,r){let i,s,l=e.sliceDoc(o-h,o),a=e.sliceDoc(r,r+h),c=/\s*$/.exec(l)[0].length,u=/^\s*/.exec(a)[0].length,f=l.length-c;if(l.slice(f-t.length,f)==t&&a.slice(u,u+n.length)==n)return{open:{pos:o-c,margin:c&&1},close:{pos:r+u,margin:u&&1}};r-o<=2*h?i=s=e.sliceDoc(o,r):(i=e.sliceDoc(o,o+h),s=e.sliceDoc(r-h,r));let d=/^\s*/.exec(i)[0].length,p=/\s*$/.exec(s)[0].length,m=s.length-p-n.length;return i.slice(d,d+t.length)==t&&s.slice(m,m+n.length)==n?{open:{pos:o+d+t.length,margin:/\s/.test(i.charAt(d+t.length))?1:0},close:{pos:r-p-n.length,margin:/\s/.test(s.charAt(m-1))?1:0}}:null}(t,o[n],e.from,e.to)));if(2!=e&&!r.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>r[t]?[]:[{from:e.from,insert:o[t].open+" "},{from:e.to,insert:" "+o[t].close}])))};if(1!=e&&r.some((e=>e))){let e=[];for(let t,n=0;nr&&(e==i||i>a.from)){r=a.from;let e=/^\s*/.exec(a.text)[0].length,t=e==a.length,n=a.text.slice(e,e+l.length)==l?e:-1;ee.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:r,empty:i,single:s}of o)!s&&i||e.push({from:t.from+r,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&o.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:r}of o)if(n>=0){let o=t.from+n,i=o+r.length;" "==t.text[i-t.from]&&i++,e.push({from:o,to:i})}return{changes:e}}return null}const m=r.q6.define(),g=r.q6.define(),v=r.r$.define(),k=r.r$.define({combine(e){return(0,r.BO)(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,o)=>e(n,o)||t(n,o)})}}),y=r.QQ.define({create(){return E.empty},update(e,t){let n=t.state.facet(k),o=t.annotation(m);if(o){let r=A.fromTransaction(t,o.selection),i=o.side,s=0==i?e.undone:e.done;return s=r?T(s,s.length,n.minDepth,r):I(s,t.startState.selection),new E(0==i?o.rest:s,0==i?s:o.rest)}let i=t.annotation(g);if("full"!=i&&"before"!=i||(e=e.isolate()),!1===t.annotation(r.YW.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let s=A.fromTransaction(t),l=t.annotation(r.YW.time),a=t.annotation(r.YW.userEvent);return s?e=e.addChanges(s,l,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,l,a,n.newGroupDelay)),"full"!=i&&"after"!=i||(e=e.isolate()),e},toJSON(e){return{done:e.done.map((e=>e.toJSON())),undone:e.undone.map((e=>e.toJSON()))}},fromJSON(e){return new E(e.done.map(A.fromJSON),e.undone.map(A.fromJSON))}});function b(e={}){return[y,k.of(e),o.tk.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?x:"historyRedo"==e.inputType?O:null;return!!n&&(e.preventDefault(),n(t))}})]}function w(e,t){return function({state:n,dispatch:o}){if(!t&&n.readOnly)return!1;let r=n.field(y,!1);if(!r)return!1;let i=r.pop(e,n,t);return!!i&&(o(i),!0)}}const x=w(0,!1),O=w(1,!1),C=w(0,!0),S=w(1,!0);class A{constructor(e,t,n,o,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=o,this.selectionsAfter=r}setSelAfter(e){return new A(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new A(e.changes&&r.as.fromJSON(e.changes),[],e.mapped&&r.n0.fromJSON(e.mapped),e.startSelection&&r.jT.fromJSON(e.startSelection),e.selectionsAfter.map(r.jT.fromJSON))}static fromTransaction(e,t){let n=P;for(let t of e.startState.facet(v)){let o=t(e);o.length&&(n=n.concat(o))}return!n.length&&e.changes.empty?null:new A(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,P)}static selection(e){return new A(void 0,P,void 0,void 0,e)}}function T(e,t,n,o){let r=t+1>n+20?t-n-1:0,i=e.slice(r,t);return i.push(o),i}function D(e,t){return e.length?t.length?e.concat(t):e:t}const P=[],B=200;function I(e,t){if(e.length){let n=e[e.length-1],o=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-B));return o.length&&o[o.length-1].eq(t)?e:(o.push(t),T(e,e.length-1,1e9,n.setSelAfter(o)))}return[A.selection([t])]}function Q(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function M(e,t){if(!e.length)return e;let n=e.length,o=P;for(;n;){let r=R(e[n-1],t,o);if(r.changes&&!r.changes.empty||r.effects.length){let t=e.slice(0,n);return t[n-1]=r,t}t=r.mapped,n--,o=r.selectionsAfter}return o.length?[A.selection(o)]:P}function R(e,t,n){let o=D(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):P,n);if(!e.changes)return A.selection(o);let i=e.changes.map(t),s=t.mapDesc(e.changes,!0),l=e.mapped?e.mapped.composeDesc(s):s;return new A(i,r.Py.mapEffects(e.effects,t),l,e.startSelection.map(s),o)}const U=/^(input\.type|delete)($|\.)/;class E{constructor(e,t,n=0,o=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=o}isolate(){return this.prevTime?new E(this.done,this.undone):this}addChanges(e,t,n,o,r){let i=this.done,s=i[i.length-1];return i=s&&s.changes&&!s.changes.empty&&e.changes&&(!n||U.test(n))&&(!s.selectionsAfter.length&&t-this.prevTimen.push(e,t))),t.iterChangedRanges(((e,t,r,i)=>{for(let e=0;e=t&&r<=s&&(o=!0)}})),o}(s.changes,e.changes))||"input.type.compose"==n)?T(i,i.length-1,o.minDepth,new A(e.changes.compose(s.changes),D(e.effects,s.effects),s.mapped,s.startSelection,P)):T(i,i.length,o.minDepth,e),new E(i,P,t,n)}addSelection(e,t,n,o){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:P;return r.length>0&&t-this.prevTimee.empty!=s.ranges[t].empty)).length)?this:new E(I(this.done,e),this.undone,t,n);var i,s}addMapping(e){return new E(M(this.done,e),M(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let o=0==e?this.done:this.undone;if(0==o.length)return null;let r=o[o.length-1],i=r.selectionsAfter[0]||t.selection;if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:m.of({side:e,rest:Q(o),selection:i}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=1==o.length?P:o.slice(0,o.length-1);return r.mapped&&(n=M(n,r.mapped)),t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:m.of({side:e,rest:n,selection:i}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}E.empty=new E(P,P);const j=[{key:"Mod-z",run:x,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:O,preventDefault:!0},{linux:"Ctrl-Shift-z",run:O,preventDefault:!0},{key:"Mod-u",run:C,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:S,preventDefault:!0}];function J(e,t){return r.jT.create(e.ranges.map(t),e.mainIndex)}function L(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function N({state:e,dispatch:t},n){let o=J(e.selection,n);return!o.eq(e.selection)&&(t(L(e,o)),!0)}function $(e,t){return r.jT.cursor(t?e.to:e.from)}function q(e,t){return N(e,(n=>n.empty?e.moveByChar(n,t):$(n,t)))}function V(e){return e.textDirectionAt(e.state.selection.main.head)==o.Nm.LTR}const Z=e=>q(e,!V(e)),z=e=>q(e,V(e));function W(e,t){return N(e,(n=>n.empty?e.moveByGroup(n,t):$(n,t)))}function _(e,t,n){if(t.type.prop(n))return!0;let o=t.to-t.from;return o&&(o>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function X(e,t,n){let o,l,a=(0,i.qz)(e).resolveInner(t.head),c=n?s.md.closedBy:s.md.openedBy;for(let o=t.head;;){let t=n?a.childAfter(o):a.childBefore(o);if(!t)break;_(e,t,c)?a=t:o=n?t.to:t.from}return l=a.type.prop(c)&&(o=n?(0,i.Um)(e,a.from,1):(0,i.Um)(e,a.to,-1))&&o.matched?n?o.end.to:o.end.from:n?a.to:a.from,r.jT.cursor(l,n?-1:1)}function F(e,t){return N(e,(n=>{if(!n.empty)return $(n,t);let o=e.moveVertically(n,t);return o.head!=n.head?o:e.moveToLineBoundary(n,t)}))}"undefined"!=typeof Intl&&Intl.Segmenter;const H=e=>F(e,!1),G=e=>F(e,!0);function Y(e){let t,n=e.scrollDOM.clientHeightn.empty?e.moveVertically(n,t,r.height):$(n,t)));if(s.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),a=l.top+r.marginTop,c=l.bottom-r.marginBottom;t&&t.top>a&&t.bottomK(e,!1),te=e=>K(e,!0);function ne(e,t,n){let o=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?o.to:o.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==o.from&&o.length){let n=/^\s*/.exec(e.state.sliceDoc(o.from,Math.min(o.from+100,o.to)))[0].length;n&&t.head!=o.from+n&&(i=r.jT.cursor(o.from+n))}return i}function oe(e,t){let n=J(e.state.selection,(e=>{let n=t(e);return r.jT.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(e.state.selection)&&(e.dispatch(L(e.state,n)),!0)}function re(e,t){return oe(e,(n=>e.moveByChar(n,t)))}const ie=e=>re(e,!V(e)),se=e=>re(e,V(e));function le(e,t){return oe(e,(n=>e.moveByGroup(n,t)))}function ae(e,t){return oe(e,(n=>e.moveVertically(n,t)))}const ce=e=>ae(e,!1),ue=e=>ae(e,!0);function fe(e,t){return oe(e,(n=>e.moveVertically(n,t,Y(e).height)))}const he=e=>fe(e,!1),de=e=>fe(e,!0),pe=({state:e,dispatch:t})=>(t(L(e,{anchor:0})),!0),me=({state:e,dispatch:t})=>(t(L(e,{anchor:e.doc.length})),!0),ge=({state:e,dispatch:t})=>(t(L(e,{anchor:e.selection.main.anchor,head:0})),!0),ve=({state:e,dispatch:t})=>(t(L(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function ke(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,s=i.changeByRange((o=>{let{from:i,to:s}=o;if(i==s){let r=t(o);ri&&(n="delete.forward",r=ye(e,r,!0)),i=Math.min(i,r),s=Math.max(s,r)}else i=ye(e,i,!1),s=ye(e,s,!0);return i==s?{range:o}:{changes:{from:i,to:s},range:r.jT.cursor(i,it(e))))r.between(t,t,((e,o)=>{et&&(t=n?o:e)}));return t}const be=(e,t)=>ke(e,(n=>{let o,s,l=n.from,{state:a}=e,c=a.doc.lineAt(l);if(!t&&l>c.from&&lbe(e,!1),xe=e=>be(e,!0),Oe=(e,t)=>ke(e,(n=>{let o=n.head,{state:i}=e,s=i.doc.lineAt(o),l=i.charCategorizer(o);for(let e=null;;){if(o==(t?s.to:s.from)){o==n.head&&s.number!=(t?i.doc.lines:1)&&(o+=t?1:-1);break}let a=(0,r.cp)(s.text,o-s.from,t)+s.from,c=s.text.slice(Math.min(o,a)-s.from,Math.max(o,a)-s.from),u=l(c);if(null!=e&&u!=e)break;" "==c&&o==n.head||(e=u),o=a}return o})),Ce=e=>Oe(e,!1);function Se(e){let t=[],n=-1;for(let o of e.selection.ranges){let r=e.doc.lineAt(o.from),i=e.doc.lineAt(o.to);if(o.empty||o.to!=i.from||(i=e.doc.lineAt(o.to-1)),n>=r.number){let e=t[t.length-1];e.to=i.to,e.ranges.push(o)}else t.push({from:r.from,to:i.to,ranges:[o]});n=i.number+1}return t}function Ae(e,t,n){if(e.readOnly)return!1;let o=[],i=[];for(let t of Se(e)){if(n?t.to==e.doc.length:0==t.from)continue;let s=e.doc.lineAt(n?t.to+1:t.from-1),l=s.length+1;if(n){o.push({from:t.to,to:s.to},{from:t.from,insert:s.text+e.lineBreak});for(let n of t.ranges)i.push(r.jT.range(Math.min(e.doc.length,n.anchor+l),Math.min(e.doc.length,n.head+l)))}else{o.push({from:s.from,to:t.from},{from:t.to,insert:e.lineBreak+s.text});for(let e of t.ranges)i.push(r.jT.range(e.anchor-l,e.head-l))}}return!!o.length&&(t(e.update({changes:o,scrollIntoView:!0,selection:r.jT.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function Te(e,t,n){if(e.readOnly)return!1;let o=[];for(let t of Se(e))n?o.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):o.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:o,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const De=Pe(!1);function Pe(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let o=t.changeByRange((n=>{let{from:o,to:l}=n,a=t.doc.lineAt(o),c=!e&&o==l&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,o=(0,i.qz)(e).resolveInner(t),r=o.childBefore(t),l=o.childAfter(t);return r&&l&&r.to<=t&&l.from>=t&&(n=r.type.prop(s.md.closedBy))&&n.indexOf(l.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(l.from).from&&!/\S/.test(e.sliceDoc(r.to,l.from))?{from:r.to,to:l.from}:null}(t,o);e&&(o=l=(l<=a.to?a:t.doc.lineAt(l)).to);let u=new i.Gn(t,{simulateBreak:o,simulateDoubleBreak:!!c}),f=(0,i.K0)(u,o);for(null==f&&(f=(0,r.IS)(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));la.from&&o{let i=[];for(let r=o.from;r<=o.to;){let s=e.doc.lineAt(r);s.number>n&&(o.empty||o.to>s.from)&&(t(s,i,o),n=s.number),r=s.to+1}let s=e.changes(i);return{changes:i,range:r.jT.range(s.mapPos(o.anchor,1),s.mapPos(o.head,1))}}))}const Ie=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>N(e,(t=>X(e.state,t,!V(e)))),shift:e=>oe(e,(t=>X(e.state,t,!V(e))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>N(e,(t=>X(e.state,t,V(e)))),shift:e=>oe(e,(t=>X(e.state,t,V(e))))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>Ae(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>Te(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>Ae(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>Te(e,t,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,o=null;return n.ranges.length>1?o=r.jT.create([n.main]):n.main.empty||(o=r.jT.create([r.jT.cursor(n.main.head)])),!!o&&(t(L(e,o)),!0)}},{key:"Mod-Enter",run:Pe(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=Se(e).map((({from:t,to:n})=>r.jT.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:r.jT.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=J(e.selection,(t=>{var n;for(let o=(0,i.qz)(e).resolveStack(t.from,1);o;o=o.next){let{node:e}=o;if((e.from=t.to||e.to>t.to&&e.from<=t.from)&&(null===(n=e.parent)||void 0===n?void 0:n.parent))return r.jT.range(e.to,e.from)}return t}));return t(L(e,n)),!0},preventDefault:!0},{key:"Mod-[",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Be(e,((t,n)=>{let o=/^\s*/.exec(t.text)[0];if(!o)return;let s=(0,r.IS)(o,e.tabSize),l=0,a=(0,i.SS)(e,Math.max(0,s-(0,i.y1)(e)));for(;l!e.readOnly&&(t(e.update(Be(e,((t,n)=>{n.push({from:t.from,insert:e.facet(i.c)})})),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),o=new i.Gn(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),r=Be(e,((t,r,s)=>{let l=(0,i.K0)(o,t.from);if(null==l)return;/\S/.test(t.text)||(l=0);let a=/^\s*/.exec(t.text)[0],c=(0,i.SS)(e,l);(a!=c||s.from{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Se(t).map((({from:e,to:n})=>(e>0?e--:ne.moveVertically(t,!0))).map(n);return e.dispatch({changes:n,selection:o,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let o=!1,s=J(e.selection,(t=>{let s=(0,i.Um)(e,t.head,-1)||(0,i.Um)(e,t.head,1)||t.head>0&&(0,i.Um)(e,t.head-1,1)||t.head{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),o=f(e.state,n.from);return o.line?a(e):!!o.block&&u(e)}},{key:"Alt-A",run:c}].concat([{key:"ArrowLeft",run:Z,shift:ie,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>W(e,!V(e)),shift:e=>le(e,!V(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>N(e,(t=>ne(e,t,!V(e)))),shift:e=>oe(e,(t=>ne(e,t,!V(e)))),preventDefault:!0},{key:"ArrowRight",run:z,shift:se,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>W(e,V(e)),shift:e=>le(e,V(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>N(e,(t=>ne(e,t,V(e)))),shift:e=>oe(e,(t=>ne(e,t,V(e)))),preventDefault:!0},{key:"ArrowUp",run:H,shift:ce,preventDefault:!0},{mac:"Cmd-ArrowUp",run:pe,shift:ge},{mac:"Ctrl-ArrowUp",run:ee,shift:he},{key:"ArrowDown",run:G,shift:ue,preventDefault:!0},{mac:"Cmd-ArrowDown",run:me,shift:ve},{mac:"Ctrl-ArrowDown",run:te,shift:de},{key:"PageUp",run:ee,shift:he},{key:"PageDown",run:te,shift:de},{key:"Home",run:e=>N(e,(t=>ne(e,t,!1))),shift:e=>oe(e,(t=>ne(e,t,!1))),preventDefault:!0},{key:"Mod-Home",run:pe,shift:ge},{key:"End",run:e=>N(e,(t=>ne(e,t,!0))),shift:e=>oe(e,(t=>ne(e,t,!0))),preventDefault:!0},{key:"Mod-End",run:me,shift:ve},{key:"Enter",run:De},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:we,shift:we},{key:"Delete",run:xe},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Ce},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>Oe(e,!0)},{mac:"Mod-Backspace",run:e=>ke(e,(t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}))},{mac:"Mod-Delete",run:e=>ke(e,(t=>{let n=e.moveToLineBoundary(t,!0).head;return t.headN(e,(t=>r.jT.cursor(e.lineBlockAt(t.head).from,1))),shift:e=>oe(e,(t=>r.jT.cursor(e.lineBlockAt(t.head).from)))},{key:"Ctrl-e",run:e=>N(e,(t=>r.jT.cursor(e.lineBlockAt(t.head).to,-1))),shift:e=>oe(e,(t=>r.jT.cursor(e.lineBlockAt(t.head).to)))},{key:"Ctrl-d",run:xe},{key:"Ctrl-h",run:we},{key:"Ctrl-k",run:e=>ke(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:r.xv.of(["",""])},range:r.jT.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,o=e.doc.lineAt(n),i=n==o.from?n-1:(0,r.cp)(o.text,n-o.from,!1)+o.from,s=n==o.to?n+1:(0,r.cp)(o.text,n-o.from,!0)+o.from;return{changes:{from:i,to:s,insert:e.doc.slice(n,s).append(e.doc.slice(i,n))},range:r.jT.cursor(s)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:te}].map((e=>({mac:e.key,run:e.run,shift:e.shift})))));var Qe=n(49892),Me=n(34790),Re=n(18580);class Ue{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class Ee{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=e,i=n.facet(_e).markerFilter;i&&(r=i(r));let s=o.p.set(r.map((e=>e.from==e.to||e.from==e.to-1&&n.doc.lineAt(e.from).to==e.from?o.p.widget({widget:new He(e),diagnostic:e}).range(e.from):o.p.mark({attributes:{class:"cm-lintRange cm-lintRange-"+e.severity+(e.markClass?" "+e.markClass:"")},diagnostic:e}).range(e.from,e.to))),!0);return new Ee(s,t,je(s))}}function je(e,t=null,n=0){let o=null;return e.between(n,1e9,((e,n,{spec:r})=>{if(!t||r.diagnostic==t)return o=new Ue(e,n,r.diagnostic),!1})),o}const Je=r.Py.define(),Le=r.Py.define(),Ne=r.Py.define(),$e=r.QQ.define({create(){return new Ee(o.p.none,null,null)},update(e,t){if(t.docChanged){let n=e.diagnostics.map(t.changes),o=null;if(e.selected){let r=t.changes.mapPos(e.selected.from,1);o=je(n,e.selected.diagnostic,r)||je(n,null,r)}e=new Ee(n,e.panel,o)}for(let n of t.effects)n.is(Je)?e=Ee.init(n.value,e.panel,t.state):n.is(Le)?e=new Ee(e.diagnostics,n.value?Ye.open:null,e.selected):n.is(Ne)&&(e=new Ee(e.diagnostics,e.panel,n.value));return e},provide:e=>[o.mH.from(e,(e=>e.panel)),o.tk.decorations.from(e,(e=>e.diagnostics))]}),qe=o.p.mark({class:"cm-lintRange cm-lintRange-active"});function Ve(e,t,n){let{diagnostics:o}=e.state.field($e),r=[],i=2e8,s=0;o.between(t-(n<0?1:0),t+(n>0?1:0),((e,o,{spec:l})=>{t>=e&&t<=o&&(e==o||(t>e||n>0)&&(tFe(e,t,!1))))}const ze=e=>{let t=e.state.field($e,!1);return!(!t||!t.panel||(e.dispatch({effects:Le.of(!1)}),0))},We=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field($e,!1);var n,i;t&&t.panel||e.dispatch({effects:(n=e.state,i=[Le.of(!0)],n.field($e,!1)?i:i.concat(r.Py.appendConfig.of(tt)))});let s=(0,o.Sd)(e,Ye.open);return s&&s.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field($e,!1);if(!t)return!1;let n=e.state.selection.main,o=t.diagnostics.iter(n.to+1);return!(!o.value&&(o=t.diagnostics.iter(0),!o.value||o.from==n.from&&o.to==n.to)||(e.dispatch({selection:{anchor:o.from,head:o.to},scrollIntoView:!0}),0))}}],_e=r.r$.define({combine(e){return Object.assign({sources:e.map((e=>e.source))},(0,r.BO)(e.map((e=>e.config)),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t}))}});function Xe(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;ee.toLowerCase()==o.toLowerCase()))){t.push(o);continue e}}t.push("")}return t}function Fe(e,t,n){var o;let r=n?Xe(t.actions):[];return(0,Re.Z)("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},(0,Re.Z)("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage():t.message),null===(o=t.actions)||void 0===o?void 0:o.map(((n,o)=>{let i=!1,s=o=>{if(o.preventDefault(),i)return;i=!0;let r=je(e.state.field($e).diagnostics,t);r&&n.apply(e,r.from,r.to)},{name:l}=n,a=r[o]?l.indexOf(r[o]):-1,c=a<0?l:[l.slice(0,a),(0,Re.Z)("u",l.slice(a,a+1)),l.slice(a+1)];return(0,Re.Z)("button",{type:"button",class:"cm-diagnosticAction",onclick:s,onmousedown:s,"aria-label":` Action: ${l}${a<0?"":` (access key "${r[o]})"`}.`},c)})),t.source&&(0,Re.Z)("div",{class:"cm-diagnosticSource"},t.source))}class He extends o.l9{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return(0,Re.Z)("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class Ge{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=Fe(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Ye{constructor(e){this.view=e,this.items=[],this.list=(0,Re.Z)("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)ze(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],o=Xe(n.actions);for(let r=0;r{for(let t=0;tze(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field($e).selected;if(!e)return-1;for(let t=0;t{let l,a=-1;for(let e=n;en&&(this.items.splice(n,a-n),o=!0)),t&&l.diagnostic==t.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),r=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),n++}));n({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.topt.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=je(this.view.state.field($e).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Ne.of(t)})}static open(e){return new Ye(e)}}function Ke(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,')`}(` `,'width="6" height="3"')}const et=o.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-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Ke("#d11")},".cm-lintRange-warning":{backgroundImage:Ke("orange")},".cm-lintRange-info":{backgroundImage:Ke("#999")},".cm-lintRange-hint":{backgroundImage:Ke("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});o.SJ;const tt=[$e,o.tk.decorations.compute([$e],(e=>{let{selected:t,panel:n}=e.field($e);return t&&n&&t.from!=t.to?o.p.set([qe.range(t.from,t.to)]):o.p.none})),(0,o.bF)(Ve,{hideOn:function(e,t){let n=e.startState.doc.lineAt(t.pos);return!(!e.effects.some((e=>e.is(Je)))&&!e.changes.touchesRange(n.from,n.to))}}),et],nt=(()=>[(0,o.Eu)(),(0,o.HQ)(),(0,o.AE)(),b(),(0,i.mi)(),(0,o.Uw)(),(0,o.qr)(),r.yy.allowMultipleSelections.of(!0),(0,i.nY)(),(0,i.nF)(i.R_,{fallback:!0}),(0,i.n$)(),(0,Me.vQ)(),(0,Me.ys)(),(0,o.Zs)(),(0,o.S2)(),(0,o.ZO)(),(0,Qe.sW)(),o.$f.of([...Me.GA,...Ie,...Qe.Lp,...j,...i.e7,...Me.B1,...We])])()}}]);