pi-webapp 0.1.57 → 0.1.58-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extension.js +71 -71
- package/dist/hosted-recovery.js +2 -2
- package/dist/hosted-worker.js +2 -2
- package/docs/desktop.md +16 -5
- package/package.json +3 -2
- package/web/dist/.vite/manifest.json +80 -64
- package/web/dist/assets/{MarkdownText-Ca6_qCyr.js → MarkdownText-BmWua1fx.js} +11 -11
- package/web/dist/assets/WorkspacePanel.module-q1UBTZQr.js +2 -0
- package/web/dist/assets/app-Bl_vjH4f.js +53 -0
- package/web/dist/assets/app.css +1 -1
- package/web/dist/assets/app.js +4 -4
- package/web/dist/assets/{code-editor-B5kVAtku.js → code-editor-bWuZTiS2.js} +4 -4
- package/web/dist/assets/{icons-D8yiYkWB.js → code-file-types-BZAEsqNG.js} +3 -3
- package/web/dist/assets/{dist-CWWynAS-.js → dist-B8Mp_VTU.js} +2 -2
- package/web/dist/assets/{dist-o-4nubru.js → dist-BD_2QeWa.js} +2 -2
- package/web/dist/assets/{dist-Im2q9dJ0.js → dist-C2WSXtwq.js} +2 -2
- package/web/dist/assets/{dist-BRYLL4VU.js → dist-C7kRRV1b.js} +2 -2
- package/web/dist/assets/{dist-CaNhruaD.js → dist-CCfANS3F.js} +2 -2
- package/web/dist/assets/{dist-BFhI7cEI.js → dist-CP5SBgQB.js} +2 -2
- package/web/dist/assets/{dist-DAlictfL.js → dist-CmPE8_f_.js} +2 -2
- package/web/dist/assets/{dist-CszBAiM6.js → dist-D-nx7RRS.js} +2 -2
- package/web/dist/assets/{dist-BYJ4SXpR.js → dist-DFTCmV51.js} +2 -2
- package/web/dist/assets/{dist-CsFhAvz7.js → dist-Dr0qO3Zr.js} +2 -2
- package/web/dist/assets/{dist-CqXTRhJp.js → dist-Nlb4zANG.js} +2 -2
- package/web/dist/assets/{graphql-Cz1_wnUp.js → graphql-B5jxVvgN.js} +2 -2
- package/web/dist/assets/{http-CTlzQwRP.js → http-C6M1fy61.js} +2 -2
- package/web/dist/assets/{php-BHNgHgMp.js → php-B61pLHqK.js} +2 -2
- package/web/dist/assets/{plugin-D1z0mcl1.js → plugin-CE1WaS8V.js} +4 -4
- package/web/dist/assets/plugin-CsVaeNQM.js +6 -0
- package/web/dist/assets/plugin-Cyidq4oP.js +2 -0
- package/web/dist/assets/plugin-Gwwlx9MU.js +4 -0
- package/web/dist/assets/plugin.css +1 -1
- package/web/dist/assets/plugin2.css +1 -1
- package/web/dist/assets/plugin3.css +1 -0
- package/web/dist/assets/{rst-BdGjFUxD.js → rst-950N-2sy.js} +2 -2
- package/web/dist/assets/{ruby-D7-ny0V-.js → ruby-Qm2HAXfx.js} +2 -2
- package/web/dist/assets/{svelte-DoD3sicb.js → svelte-CoZSSs0h.js} +2 -2
- package/web/dist/assets/{vue-BYLUelN7.js → vue-as6FrWIW.js} +2 -2
- package/web/dist/assets/WorkspacePanel.module-V6gI-nG1.js +0 -2
- package/web/dist/assets/app-CIlV3hYO.js +0 -49
- package/web/dist/assets/plugin-CZx51rmJ.js +0 -6
- package/web/dist/assets/plugin-CvqNiFRV.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-
|
|
2
|
-
(function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`1aba5d55-b6aa-4228-83d2-9f22d39aadb4`,e._sentryDebugIdIdentifier=`sentry-dbid-1aba5d55-b6aa-4228-83d2-9f22d39aadb4`)}catch{}})();import{n as e}from"./rolldown-runtime-CgmABjMJ.js";import{$ as t,A as n,B as r,Ct as i,Dt as a,E as o,Et as s,F as c,G as l,H as u,I as d,J as f,K as p,L as m,O as h,Ot as ee,P as g,Q as te,R as ne,S as _,St as v,T as re,Tt as ie,U as ae,V as oe,W as se,X as ce,Y as le,Z as ue,_t as de,a as y,at as b,bt as x,c as fe,ct as pe,dt as S,et as me,f as he,ft as ge,g as _e,gt as ve,ht as ye,it as be,j as C,jt as xe,l as Se,lt as w,mt as Ce,n as we,nt as Te,o as Ee,ot as De,pt as T,q as Oe,rt as ke,st as Ae,t as je,tt as Me,ut as Ne,v as Pe,vt as Fe,w as Ie,wt as E,x as Le,xt as Re,yt as D,z as ze}from"./dist-IkQ96Etc.js";import{a as O}from"./app.js";import{h as k}from"./app-CIlV3hYO.js";var Be=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=C(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),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(Ke(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function Ve(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 He(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=Ve(t)+Ve(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function Ue(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:He(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function We(e,t){return n=>{for(let t=C(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)}}var Ge=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function A(e){return e.selection.main.from}function Ke(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var qe=De.define();function Je(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:S.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var Ye=new WeakMap;function Xe(e){if(!Array.isArray(e))return e;let t=Ye.get(e);return t||Ye.set(e,t=Ue(e)),t}var Ze=D.define(),Qe=D.define(),$e=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=i(e,t),r=E(n);this.chars.push(n);let a=e.slice(t,t+r),o=a.toUpperCase();this.folded.push(i(o==a?a.toLowerCase():o,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:a,byWord:o}=this;if(t.length==1){let r=i(e,0),a=E(r),o=a==e.length?0:-100;if(r!=t[0]){if(r==n[0])o+=-200;else return null}return this.ret(o,[0,a])}let s=e.indexOf(this.pattern);if(s==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=t.length,l=0;if(s<0){for(let a=0,o=Math.min(e.length,200);a<o&&l<c;){let o=i(e,a);(o==t[l]||o==n[l])&&(r[l++]=a),a+=E(o)}if(l<c)return null}let u=0,d=0,f=!1,p=0,m=-1,h=-1,g=/[a-z]/.test(e),te=!0;for(let r=0,l=Math.min(e.length,200),ne=0;r<l&&d<c;){let l=i(e,r);s<0&&(u<c&&l==t[u]&&(a[u++]=r),p<c&&(l==t[p]||l==n[p]?(p==0&&(m=r),h=r+1,p++):p=0));let _,v=l<255?l>=48&&l<=57||l>=97&&l<=122?2:+(l>=65&&l<=90):(_=ee(l))==_.toLowerCase()?_==_.toUpperCase()?0:2:1;(!r||v==1&&g||ne==0&&v!=0)&&(t[d]==l||n[d]==l&&(f=!0)?o[d++]=r:o.length&&(te=!1)),ne=v,r+=E(l)}return d==c&&o[0]==0&&te?this.result(-100+(f?-200:0),o,e):p==c&&m==0?this.ret(-200-e.length+(h==e.length?0:-100),[0,h]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):p==c?this.ret(-900-e.length,[m,h]):d==c?this.result(-100+(f?-200:0)+-700+(te?0:-1100),o,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],a=0;for(let e of t){let t=e+(this.astral?E(i(n,e)):1);a&&r[a-1]==e?r[a-1]=t:(r[a++]=e,r[a++]=t)}return this.ret(e-n.length,r)}},et=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},j=T.define({combine(e){return ie(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:nt,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>tt(e(n),t(n)),optionClass:(e,t)=>n=>tt(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function tt(e,t){return e?t?e+` `+t:e:t}function nt(e,t,n,r,i,a){let o=e.textDirection==d.RTL,s=o,c=!1,l=`top`,u,f,p=t.left-i.left,m=i.right-t.right,h=r.right-r.left,ee=r.bottom-r.top;if(s&&p<Math.min(h,m)?s=!1:!s&&m<Math.min(h,p)&&(s=!0),h<=(s?p:m))u=Math.max(i.top,Math.min(n.top,i.bottom-ee))-t.top,f=Math.min(400,s?p:m);else{c=!0,f=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=ee||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,te=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${f/te}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var rt=D.define();function it(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,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function at(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 r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var ot=class{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 r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(j);this.optionContent=it(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=at(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:rt.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(j).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:Qe.of(null)})}),this.showOptions(i,r.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){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;n.open&&n.open.options==r||(this.range=at(r.length,i,e.state.facet(j).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}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),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=at(n.options.length,n.selected,this.view.state.facet(j).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:i}=n.options[n.selected],{info:a}=i;if(!a)return;let o=typeof a==`string`?document.createTextNode(a):a(i);if(!o)return;`then`in o?o.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,i)}).catch(e=>t(this.view.state,e,`completion info`)):(this.addInfoPane(o,i),r.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&ct(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(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(j).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0)){if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function st(e,t){return n=>new ot(n,e,t)}function ct(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function lt(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function ut(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(j);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new Ge(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new et(n):new $e(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new Ge(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):lt(e.completion)>lt(c)&&(s[s.length-1]=e),c=e.completion}return s}var dt=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,gt(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=ut(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(j).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,gt(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:Ct,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},ft=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(_t,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(j),i=(r.override||n.languageDataAt(`autocomplete`,A(n)).map(Xe)).map(e=>(this.active.find(t=>t.source==e)||new M(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(xt));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!pt(i,this.active)||o?a=dt.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new M(e.source,0):e));for(let e of t.effects)e.is(rt)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?mt:ht}};function pt(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var mt={"aria-autocomplete":`list`},ht={};function gt(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var _t=[];function vt(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(qe);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var M=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=vt(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(Ze))i=new e(i.source,1,n.value);else if(n.is(Qe))i=new e(i.source,0);else if(n.is(xt))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(A(e.state))}},yt=class e extends M{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=A(t.state);if(o>a||!r||n&2&&(A(t.startState)==this.from||o<this.limit))return new M(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return bt(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new Be(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??A(t.state)):new M(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new M(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function bt(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):Ke(e,!0).test(i)}var xt=D.define({map(e,t){return e.map(e=>e.map(t))}}),N=x.define({create(){return ft.start()},update(e,t){return e.update(t)},provide:e=>[be.from(e,e=>e.tooltip),m.contentAttributes.from(e,e=>e.attrs)]});function St(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(N).active.find(e=>e.source==t.source);return r instanceof yt&&(typeof n==`string`?e.dispatch({...Je(e.state,n,r.from,r.to),annotations:qe.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var Ct=st(N,St);function wt(e,t=`option`){return n=>{let r=n.state.field(N,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(j).interactionDelay)return!1;let i=1,a;t==`page`&&(a=p(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector(`li`).offsetHeight)-1));let{length:o}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t==`page`?0:o-1:s>=o&&(s=t==`page`?o-1:0),n.dispatch({effects:rt.of(s)}),!0}}var Tt=e=>{let t=e.state.field(N,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(j).interactionDelay?!1:St(e,t.open.options[t.open.selected])},Et=e=>e.state.field(N,!1)?(e.dispatch({effects:Ze.of(!0)}),!0):!1,Dt=e=>{let t=e.state.field(N,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:Qe.of(null)}),!0)},Ot=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},kt=50,At=1e3,jt=ne.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(N).active)t.isPending&&this.startQuery(t)}update(e){let n=e.state.field(N),r=e.state.facet(j);if(!e.selectionSet&&!e.docChanged&&e.startState.field(N)==n)return;let i=e.transactions.some(e=>{let t=vt(e,r);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let n=0;n<this.running.length;n++){let r=this.running[n];if(i||r.context.abortOnDocChange&&e.docChanged||r.updates.length+e.transactions.length>kt&&Date.now()-r.time>At){for(let e of r.context.abortListeners)try{e()}catch(e){t(this.view.state,e)}r.context.abortListeners=null,this.running.splice(n--,1)}else r.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(Ze)))&&(this.pendingStart=!0);let a=this.pendingStart?50:r.activateOnTypingDelay;if(this.debounceUpdate=n.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),a):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(N);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(j).updateSyncTime))}startQuery(e){let{state:n}=this.view,r=new Be(n,A(n),e.explicit,this.view),i=new Ot(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:Qe.of(null)}),t(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(j).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(j),n=this.view.state.field(N);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=A(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new yt(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending){if(i.done==null){let n=new M(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:xt.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(N,!1);if(t&&t.tooltip&&this.view.state.facet(j).closeOnBlur){let n=t.open&&p(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:Qe.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ze.of(!1)}),20),this.composing=0}}}),Mt=typeof navigator==`object`&&/Win/.test(navigator.platform),Nt=ye.highest(m.domEventHandlers({keydown(e,t){let n=t.state.field(N,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||!e.key||e.key.length>1||e.ctrlKey&&!(Mt&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&St(t,r),!1}})),Pt=m.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`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),Ft=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},It=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,Ce.TrackDel),r=t.mapPos(this.to,1,Ce.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},Lt=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,s=/^\t*/.exec(i)[0].length;for(let t=0;t<s;t++)n+=e.facet(o);r.push(t+n.length-s),i=n+i.slice(s)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new It(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new Ft(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},Rt=c.widget({widget:new class extends ze{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),zt=c.mark({class:`cm-snippetField`}),Bt=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=c.set(e.map(e=>(e.from==e.to?Rt:zt).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},Vt=D.define({map(e,t){return e&&e.map(t)}}),Ht=D.define(),Ut=x.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(Vt))return n.value;if(n.is(Ht)&&e)return new Bt(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>m.decorations.from(e,e=>e?e.deco:c.none)});function Wt(e,t){return S.create(e.filter(e=>e.field==t).map(e=>S.range(e.from,e.to)))}function Gt(e){let t=Lt.parse(e);return(e,n,r,i)=>{let{text:a,ranges:o}=t.instantiate(e.state,r),{main:s}=e.state.selection,c={changes:{from:r,to:i==s.from?s.to:i,insert:Re.of(a)},scrollIntoView:!0,annotations:n?[qe.of(n),v.userEvent.of(`input.complete`)]:void 0};if(o.length&&(c.selection=Wt(o,0)),o.some(e=>e.field>0)){let t=new Bt(o,0),n=c.effects=[Vt.of(t)];e.state.field(Ut,!1)===void 0&&n.push(D.appendConfig.of([Ut,Yt,Zt,Pt]))}e.dispatch(e.state.update(c))}}function Kt(e){return({state:t,dispatch:n})=>{let r=t.field(Ut,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:Wt(r.ranges,i),effects:Vt.of(a?null:new Bt(r.ranges,i)),scrollIntoView:!0})),!0}}var qt=[{key:`Tab`,run:Kt(1),shift:Kt(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(Ut,!1)?(t(e.update({effects:Vt.of(null)})),!0):!1}],Jt=T.define({combine(e){return e.length?e[0]:qt}}),Yt=ye.highest(ue.compute([Jt],e=>e.facet(Jt)));function Xt(e,t){return{...t,apply:Gt(e)}}var Zt=m.domEventHandlers({mousedown(e,t){let n=t.state.field(Ut,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:Wt(n.ranges,i.field),effects:Vt.of(n.ranges.some(e=>e.field>i.field)?new Bt(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),Qt={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},P=D.define({map(e,t){return t.mapPos(e,-1,Ce.TrackAfter)??void 0}}),$t=new class extends Fe{};$t.startSide=1,$t.endSide=-1;var en=x.define({create(){return ve.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(P)&&(e=e.update({add:[$t.range(n.value,n.value+1)]}));return e}});function tn(){return[sn,en]}var nn=`()[]{}<>«»»«[]{}`;function rn(e){for(let t=0;t<16;t+=2)if(nn.charCodeAt(t)==e)return nn.charAt(t+1);return ee(e<128?e:e+1)}function an(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||Qt}var on=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),sn=m.inputHandler.of((e,t,n,r)=>{if((on?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let a=e.state.selection.main;if(r.length>2||r.length==2&&E(i(r,0))==1||t!=a.from||n!=a.to)return!1;let o=ln(e.state,r);return o?(e.dispatch(o),!0):!1}),cn=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=an(e,e.selection.main.head).brackets||Qt.brackets,r=null,a=e.changeByRange(t=>{if(t.empty){let r=fn(e.doc,t.head);for(let a of n)if(a==r&&dn(e.doc,t.head)==rn(i(a,0)))return{changes:{from:t.head-a.length,to:t.head+a.length},range:S.cursor(t.head-a.length)}}return{range:r=t}});return r||t(e.update(a,{scrollIntoView:!0,userEvent:`delete.backward`})),!r}}];function ln(e,t){let n=an(e,e.selection.main.head),r=n.brackets||Qt.brackets;for(let a of r){let o=rn(i(a,0));if(t==a)return o==a?hn(e,a,r.indexOf(a+a+a)>-1,n):pn(e,a,o,n.before||Qt.before);if(t==o&&un(e,e.selection.main.from))return mn(e,a,o)}return null}function un(e,t){let n=!1;return e.field(en).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function dn(e,t){let n=e.sliceString(t,t+2);return n.slice(0,E(i(n,0)))}function fn(e,t){let n=e.sliceString(t-2,t);return E(i(n,0))==n.length?n:n.slice(1)}function pn(e,t,n,r){let i=null,a=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:P.of(a.to+t.length),range:S.range(a.anchor+t.length,a.head+t.length)};let o=dn(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:P.of(a.head+t.length),range:S.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function mn(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&dn(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:S.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function hn(e,t,n,r){let i=r.stringPrefixes||Qt.stringPrefixes,a=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:P.of(r.to+t.length),range:S.range(r.anchor+t.length,r.head+t.length)};let o=r.head,s=dn(e.doc,o),c;if(s==t){if(gn(e,o))return{changes:{insert:t+t,from:o},effects:P.of(o+t.length),range:S.cursor(o+t.length)};if(un(e,o)){let r=n&&e.sliceDoc(o,o+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:o,to:o+r.length,insert:r},range:S.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(c=vn(e,o-2*t.length,i))>-1&&gn(e,c))return{changes:{insert:t+t+t+t,from:o},effects:P.of(o+t.length),range:S.cursor(o+t.length)};else if(e.charCategorizer(o)(s)!=w.Word&&vn(e,o,i)>-1&&!_n(e,o,t,i))return{changes:{insert:t+t,from:o},effects:P.of(o+t.length),range:S.cursor(o+t.length)};return{range:a=r}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function gn(e,t){let n=C(e).resolveInner(t+1);return n.parent&&n.from==t}function _n(e,t,n,r){let i=C(e).resolveInner(t,-1),a=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+a)),s=o.indexOf(n);if(!s||s>-1&&r.indexOf(o.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function vn(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=w.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))!=w.Word)return n}return-1}function yn(e={}){return[Nt,N,j.of(e),jt,xn,Pt]}var bn=[{key:`Ctrl-Space`,run:Et},{mac:"Alt-`",run:Et},{mac:`Alt-i`,run:Et},{key:`Escape`,run:Dt},{key:`ArrowDown`,run:wt(!0)},{key:`ArrowUp`,run:wt(!1)},{key:`PageDown`,run:wt(!0,`page`)},{key:`PageUp`,run:wt(!1,`page`)},{key:`Enter`,run:Tt}],xn=ye.highest(ue.computeN([j],e=>e.facet(j).defaultKeymap?[bn]:[])),Sn=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Dn(e.state,n.from);return r.line?wn(e):r.block?En(e):!1};function Cn(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var wn=Cn(Mn,0),Tn=Cn(jn,0),En=Cn((e,t)=>jn(e,t,An(t)),0);function Dn(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var On=50;function kn(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-On,r),o=e.sliceDoc(i,i+On),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+On),d=e.sliceDoc(i-On,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function An(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function jn(e,t,n=t.selection.ranges){let r=n.map(e=>Dn(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>kn(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function Mn(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=Dn(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var Nn=De.define(),Pn=De.define(),Fn=T.define(),In=T.define({combine(e){return ie(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),Ln=x.define({create(){return er.empty},update(e,t){let n=t.state.facet(In),r=t.annotation(Nn);if(r){let i=F.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?Wn(o,o.length,n.minDepth,i):Yn(o,t.startState.selection),new er(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(Pn);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(v.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=F.fromTransaction(t),o=t.annotation(v.time),s=t.annotation(v.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(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 er(e.done.map(F.fromJSON),e.undone.map(F.fromJSON))}});function Rn(e={}){return[Ln,In.of(e),m.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?Bn:e.inputType==`historyRedo`?Vn:null;return n?(e.preventDefault(),n(t)):!1}})]}function zn(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Ln,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var Bn=zn(0,!1),Vn=zn(1,!1),Hn=zn(0,!0),Un=zn(1,!0),F=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&pe.fromJSON(t.changes),[],t.mapped&&Ae.fromJSON(t.mapped),t.startSelection&&S.fromJSON(t.startSelection),t.selectionsAfter.map(S.fromJSON))}static fromTransaction(t,n){let r=I;for(let e of t.startState.facet(Fn)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,I)}static selection(t){return new e(void 0,I,void 0,void 0,t)}};function Wn(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function Gn(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function Kn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function qn(e,t){return e.length?t.length?e.concat(t):e:t}var I=[],Jn=200;function Yn(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Jn));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Wn(e,e.length-1,1e9,n.setSelAfter(r)))}return[F.selection([t])]}function Xn(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 Zn(e,t){if(!e.length)return e;let n=e.length,r=I;for(;n;){let i=Qn(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[F.selection(r)]:I}function Qn(e,t,n){let r=qn(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):I,n);if(!e.changes)return F.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new F(i,D.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var $n=/^(input\.type|delete)($|\.)/,er=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||$n.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,Gn(s.changes,t.changes))||r==`input.type.compose`)?Wn(o,o.length-1,i.minDepth,new F(t.changes.compose(s.changes),qn(D.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,I)):Wn(o,o.length,i.minDepth,t),new e(o,I,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:I;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Kn(a[a.length-1],t)?this:new e(Yn(this.done,t),this.undone,n,r)}addMapping(t){return new e(Zn(this.done,t),Zn(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Nn.of({side:e,rest:Xn(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?I:r.slice(0,r.length-1);return i.mapped&&(n=Zn(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Nn.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};er.empty=new er(I,I);var tr=[{key:`Mod-z`,run:Bn,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:Vn,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:Vn,preventDefault:!0},{key:`Mod-u`,run:Hn,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Un,preventDefault:!0}];function L(e,t){return S.create(e.ranges.map(t),e.mainIndex)}function R(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function z({state:e,dispatch:t},n){let r=L(e.selection,n);return!r.eq(e.selection,!0)&&(t(R(e,r)),!0)}function nr(e,t){return S.cursor(t?e.to:e.from)}function rr(e,t){return z(e,n=>n.empty?e.moveByChar(n,t):nr(n,t))}function B(e){return e.textDirectionAt(e.state.selection.main.head)==d.LTR}var ir=e=>rr(e,!B(e)),ar=e=>rr(e,B(e));function or(e,t){return z(e,n=>n.empty?e.moveByGroup(n,t):nr(n,t))}var sr=e=>or(e,!B(e)),cr=e=>or(e,B(e));typeof Intl<`u`&&Intl.Segmenter;function lr(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function ur(e,t,n){let r=C(e).resolveInner(t.head),i=n?xe.closedBy:xe.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;lr(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?h(e,r.from,1):h(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,S.cursor(s,n?-1:1)}var dr=e=>z(e,t=>ur(e.state,t,!B(e))),fr=e=>z(e,t=>ur(e.state,t,B(e)));function pr(e,t){return z(e,n=>{if(!n.empty)return nr(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var mr=e=>pr(e,!1),hr=e=>pr(e,!0);function gr(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(m.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function _r(e,t){let n=gr(e),{state:r}=e,i=L(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):nr(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=m.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(R(r,i),{effects:a}),!0}var vr=e=>_r(e,!1),yr=e=>_r(e,!0);function V(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=S.cursor(r.from+n))}return i}var br=e=>z(e,t=>V(e,t,!0)),xr=e=>z(e,t=>V(e,t,!1)),Sr=e=>z(e,t=>V(e,t,!B(e))),Cr=e=>z(e,t=>V(e,t,B(e))),wr=e=>z(e,t=>e.moveToLineBoundary(t,!1,!1)),Tr=e=>z(e,t=>e.moveToLineBoundary(t,!0,!1));function Er(e,t,n){let r=!1,i=L(e.selection,t=>{let i=h(e,t.head,-1)||h(e,t.head,1)||t.head>0&&h(e,t.head-1,1)||t.head<e.doc.length&&h(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?S.range(t.anchor,a):S.cursor(a)});return r?(t(R(e,i)),!0):!1}var Dr=({state:e,dispatch:t})=>Er(e,t,!1);function H(e,t,n){let r=L(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=S.range(e.head,e.anchor));let r=n(e);return S.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(R(e.state,r)),!0)}function Or(e,t){return H(e,t,n=>e.moveByChar(n,t))}var kr=e=>Or(e,!B(e)),Ar=e=>Or(e,B(e));function jr(e,t){return H(e,t,n=>e.moveByGroup(n,t))}var Mr=e=>jr(e,!B(e)),Nr=e=>jr(e,B(e)),Pr=e=>{let t=!B(e);return H(e,t,n=>ur(e.state,n,t))},Fr=e=>{let t=B(e);return H(e,t,n=>ur(e.state,n,t))};function Ir(e,t){return H(e,t,n=>e.moveVertically(n,t))}var Lr=e=>Ir(e,!1),Rr=e=>Ir(e,!0);function zr(e,t){return H(e,t,n=>e.moveVertically(n,t,gr(e).height))}var Br=e=>zr(e,!1),Vr=e=>zr(e,!0),Hr=e=>H(e,!0,t=>V(e,t,!0)),Ur=e=>H(e,!1,t=>V(e,t,!1)),Wr=e=>{let t=!B(e);return H(e,t,n=>V(e,n,t))},Gr=e=>{let t=B(e);return H(e,t,n=>V(e,n,t))},Kr=e=>H(e,!1,t=>S.cursor(e.lineBlockAt(t.head).from)),qr=e=>H(e,!0,t=>S.cursor(e.lineBlockAt(t.head).to)),Jr=({state:e,dispatch:t})=>(t(R(e,{anchor:0})),!0),Yr=({state:e,dispatch:t})=>(t(R(e,{anchor:e.doc.length})),!0),Xr=({state:e,dispatch:t})=>(t(R(e,{anchor:e.selection.main.anchor,head:0})),!0),Zr=({state:e,dispatch:t})=>(t(R(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Qr=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),$r=({state:e,dispatch:t})=>{let n=vi(e).map(({from:t,to:n})=>S.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:S.create(n),userEvent:`select`})),!0},ei=({state:e,dispatch:t})=>{let n=L(e.selection,t=>{let n=C(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return S.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(R(e,n)),!0)};function ti(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(R(n,S.create(i,i.length-1))),!0)}var ni=e=>ti(e,!1),ri=e=>ti(e,!0),ii=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=S.create([n.main]):n.main.empty||(r=S.create([S.cursor(n.main.head)])),r?(t(R(e,r)),!0):!1};function ai(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=oi(e,o,!1)):o>i&&(n=`delete.forward`,o=oi(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=oi(e,i,!1),a=oi(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:S.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?m.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function oi(e,t,n){if(e instanceof m)for(let r of e.state.facet(m.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var si=(e,t,n)=>ai(e,r=>{let i=r.from,{state:o}=e,c=o.doc.lineAt(i),l,u;if(n&&!t&&i>c.from&&i<c.from+200&&!/[^ \t]/.test(l=c.text.slice(0,i-c.from))){if(l[l.length-1]==` `)return i-1;let e=s(l,o.tabSize)%Le(o)||Le(o);for(let t=0;t<e&&l[l.length-1-t]==` `;t++)i--;u=i}else u=a(c.text,i-c.from,t,t)+c.from,u==i&&c.number!=(t?o.doc.lines:1)?u+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(c.text.slice(u-c.from,i-c.from))&&(u=a(c.text,u-c.from,!1,!1)+c.from);return u}),ci=e=>si(e,!1,!0),li=e=>si(e,!0,!1),ui=(e,t)=>ai(e,n=>{let r=n.head,{state:i}=e,o=i.doc.lineAt(r),s=i.charCategorizer(r);for(let e=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let c=a(o.text,r-o.from,t)+o.from,l=o.text.slice(Math.min(r,c)-o.from,Math.max(r,c)-o.from),u=s(l);if(e!=null&&u!=e)break;(l!=` `||r!=n.head)&&(e=u),r=c}return r}),di=e=>ui(e,!1),fi=e=>ui(e,!0),pi=e=>ai(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),mi=e=>ai(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),hi=e=>ai(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),gi=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:Re.of([``,``])},range:S.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},_i=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:a(r.text,n-r.from,!1)+r.from,o=n==r.to?n+1:a(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(i,n))},range:S.cursor(o)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function vi(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function yi(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of vi(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(S.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(S.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:S.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var bi=({state:e,dispatch:t})=>yi(e,t,!1),xi=({state:e,dispatch:t})=>yi(e,t,!0);function Si(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of vi(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var Ci=({state:e,dispatch:t})=>Si(e,t,!1),wi=({state:e,dispatch:t})=>Si(e,t,!0),Ti=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(vi(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=L(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function Ei(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=C(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(xe.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var Di=ki(!1),Oi=ki(!0);function ki(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&Ei(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let c=new we(t,{simulateBreak:r,simulateDoubleBreak:!!o}),l=_(c,r);for(l??=s(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let u=[``,re(t,l)];return o&&u.push(re(t,c.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:Re.of(u)},range:S.cursor(r+1+u[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function Ai(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:S.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var ji=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new we(e,{overrideIndentation:e=>n[e]??-1}),i=Ai(e,(t,i,a)=>{let o=_(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=re(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},Mi=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Ai(e,(t,n)=>{n.push({from:t.from,insert:e.facet(o)})}),{userEvent:`input.indent`})),!0),Ni=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Ai(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=s(r,e.tabSize),a=0,o=re(e,Math.max(0,i-Le(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),Pi=e=>(e.setTabFocusMode(),!0),Fi=[{key:`Ctrl-b`,run:ir,shift:kr,preventDefault:!0},{key:`Ctrl-f`,run:ar,shift:Ar},{key:`Ctrl-p`,run:mr,shift:Lr},{key:`Ctrl-n`,run:hr,shift:Rr},{key:`Ctrl-a`,run:wr,shift:Kr},{key:`Ctrl-e`,run:Tr,shift:qr},{key:`Ctrl-d`,run:li},{key:`Ctrl-h`,run:ci},{key:`Ctrl-k`,run:pi},{key:`Ctrl-Alt-h`,run:di},{key:`Ctrl-o`,run:gi},{key:`Ctrl-t`,run:_i},{key:`Ctrl-v`,run:yr}],Ii=[{key:`ArrowLeft`,run:ir,shift:kr,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:sr,shift:Mr,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:Sr,shift:Wr,preventDefault:!0},{key:`ArrowRight`,run:ar,shift:Ar,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:cr,shift:Nr,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Cr,shift:Gr,preventDefault:!0},{key:`ArrowUp`,run:mr,shift:Lr,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Jr,shift:Xr},{mac:`Ctrl-ArrowUp`,run:vr,shift:Br},{key:`ArrowDown`,run:hr,shift:Rr,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Yr,shift:Zr},{mac:`Ctrl-ArrowDown`,run:yr,shift:Vr},{key:`PageUp`,run:vr,shift:Br},{key:`PageDown`,run:yr,shift:Vr},{key:`Home`,run:xr,shift:Ur,preventDefault:!0},{key:`Mod-Home`,run:Jr,shift:Xr},{key:`End`,run:br,shift:Hr,preventDefault:!0},{key:`Mod-End`,run:Yr,shift:Zr},{key:`Enter`,run:Di,shift:Di},{key:`Mod-a`,run:Qr},{key:`Backspace`,run:ci,shift:ci,preventDefault:!0},{key:`Delete`,run:li,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:di,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:fi,preventDefault:!0},{mac:`Mod-Backspace`,run:mi,preventDefault:!0},{mac:`Mod-Delete`,run:hi,preventDefault:!0}].concat(Fi.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Li=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:dr,shift:Pr},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:fr,shift:Fr},{key:`Alt-ArrowUp`,run:bi},{key:`Shift-Alt-ArrowUp`,run:Ci},{key:`Alt-ArrowDown`,run:xi},{key:`Shift-Alt-ArrowDown`,run:wi},{key:`Mod-Alt-ArrowUp`,run:ni},{key:`Mod-Alt-ArrowDown`,run:ri},{key:`Escape`,run:ii},{key:`Mod-Enter`,run:Oi},{key:`Alt-l`,mac:`Ctrl-l`,run:$r},{key:`Mod-i`,run:ei,preventDefault:!0},{key:`Mod-[`,run:Ni},{key:`Mod-]`,run:Mi},{key:`Mod-Alt-\\`,run:ji},{key:`Shift-Mod-k`,run:Ti},{key:`Shift-Mod-\\`,run:Dr},{key:`Mod-/`,run:Sn},{key:`Alt-A`,mac:`Ctrl-A`,run:Tn},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Pi}].concat(Ii),Ri={key:`Tab`,run:Mi,shift:Ni},zi=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,U=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(zi(e)):zi,this.query=this.normalize(t)}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 i(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=ee(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=E(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(U.prototype[Symbol.iterator]=function(){return this});var Bi={from:-1,to:-1,match:/.*/.exec(``),precise:!0},Vi=`gm`+(/x/.unicode==null?``:`u`),Hi=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=Bi,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Gi(e,t,n,r,i);this.re=new RegExp(t,Vi+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=qi(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),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 e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=qi(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},Ui=new WeakMap,Wi=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=Ui.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Ui.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),Ui.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Gi=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Bi,this.matchPos=qi(e,r),this.re=new RegExp(t,Vi+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Wi.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=qi(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Wi.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Hi.prototype[Symbol.iterator]=Gi.prototype[Symbol.iterator]=function(){return this});function Ki(e){try{return new RegExp(e,Vi),!0}catch{return!1}}function qi(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var Ji=e=>{let t=se(e,`cm-goto-line`);if(t){let e=t.dom.querySelector(`input[type=text]`);return e&&e.select(),!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:a}=Te(e,{class:`cm-goto-line`,label:n.phrase(`Go to line`),input:{type:`text`,name:`line`,value:r},focus:!0,submitLabel:n.phrase(`go`)});return a.then(t=>{let r=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!r){e.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,o,s,c,l]=r,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/n.doc.lines),d=Math.round(n.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=n.doc.line(Math.max(1,Math.min(n.doc.lines,d))),p=S.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[i,m.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},Yi={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Xi=T.define({combine(e){return ie(e,Yi,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Zi(e){let t=[ra,na];return e&&t.push(Xi.of(e)),t}var Qi=c.mark({class:`cm-selectionMatch`}),$i=c.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function ea(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=w.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=w.Word)}function ta(e,t,n,r){return e(t.sliceDoc(n,n+1))==w.Word&&e(t.sliceDoc(r-1,r))==w.Word}var na=ne.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Xi),{state:n}=e,r=n.selection;if(r.ranges.length>1)return c.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return c.none;let e=n.wordAt(i.head);if(!e)return c.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return c.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(ea(o,n,i.from,i.to)&&ta(o,n,i.from,i.to)))return c.none}else if(a=n.sliceDoc(i.from,i.to),!a)return c.none}let s=[];for(let r of e.visibleRanges){let e=new U(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||ea(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push($i.range(r,a)):(r>=i.to||a<=i.from)&&s.push(Qi.range(r,a)),s.length>t.maxMatches))return c.none}}return c.set(s)}},{decorations:e=>e.decorations}),ra=m.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),ia=({state:e,dispatch:t})=>{let{selection:n}=e,r=S.create(n.ranges.map(t=>e.wordAt(t.head)||S.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function aa(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new U(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new U(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var oa=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return ia({state:e,dispatch:t});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 i=aa(e,r);return i?(t(e.update({selection:e.selection.addRange(S.range(i.from,i.to),!1),effects:m.scrollIntoView(i.to)})),!0):!1},W=T.define({combine(e){return ie(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ra(e),scrollToMatch:e=>m.scrollIntoView(e)})}});function sa(e){return e?[W.of(e),Ua]:Ua}var ca=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||Ki(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
3
|
-
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new _a(this):new fa(this)}getCursor(e,t=0,n){let r=e.doc?e:ge.create({doc:e});return n??=r.doc.length,this.regexp?K(this,r,t,n):G(this,r,t,n)}},la=class{constructor(e){this.spec=e}};function ua(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function G(e,t,n,r){let i;return e.wholeWord&&(i=da(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=ua(e.test,t,i)),new U(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function da(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(ma(i,n-a))!=w.Word||t(ha(i,n-a))!=w.Word)&&(t(ha(i,r-a))!=w.Word||t(ma(i,r-a))!=w.Word))}var fa=class extends la{constructor(e){super(e)}nextMatch(e,t,n){let r=G(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=G(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=G(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=G(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=G(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function pa(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function K(e,t,n,r){let i;return e.wholeWord&&(i=ga(t.charCategorizer(t.selection.main.head))),e.test&&(i=pa(e.test,t,i)),new Hi(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function ma(e,t){return e.slice(a(e,t,!1),t)}function ha(e,t){return e.slice(t,a(e,t))}function ga(e){return(t,n,r)=>!r[0].length||(e(ma(r.input,r.index))!=w.Word||e(ha(r.input,r.index))!=w.Word)&&(e(ha(r.input,r.index+r[0].length))!=w.Word||e(ma(r.input,r.index+r[0].length))!=w.Word)}var _a=class extends la{nextMatch(e,t,n){let r=K(this.spec,e,n,e.doc.length).next();return r.done&&(r=K(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=K(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=K(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=K(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},q=D.define(),va=D.define(),J=x.define({create(e){return new ba(Ma(e).create(),null)},update(e,t){for(let n of t.effects)n.is(q)?e=new ba(n.value.create(),e.panel):n.is(va)&&(e=new ba(e.query,n.value?ja:null));return e},provide:e=>ke.from(e,e=>e.panel)});function ya(e){let t=e.field(J,!1);return t?t.query.spec:Ma(e)}var ba=class{constructor(e,t){this.query=e,this.panel=t}},xa=c.mark({class:`cm-searchMatch`}),Sa=c.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Ca=ne.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(J))}update(e){let t=e.state.field(J);(t!=e.startState.field(J)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return c.none;let{view:n}=this,r=new de;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Sa:xa)})}return r.finish()}},{decorations:e=>e.decorations});function wa(e){return t=>{let n=t.state.field(J,!1);return n&&n.query.spec.valid?e(t,n):Fa(t)}}var Ta=wa((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=S.single(r.from,r.to),a=e.state.facet(W);return e.dispatch({selection:i,effects:[Va(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Pa(e),!0}),Ea=wa((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=S.single(i.from,i.to),o=e.state.facet(W);return e.dispatch({selection:a,effects:[Va(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Pa(e),!0}),Da=wa((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:S.create(n.map(e=>S.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Oa=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new U(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(S.range(t.value.from,t.value.to))}return t(e.update({selection:S.create(a,o),userEvent:`select.search.matches`})),!0},ka=wa((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.precise?o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(m.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let d=e.state.changes(s);return o&&(c=S.single(o.from,o.to).map(d),u.push(Va(e,o)),u.push(n.facet(W).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),Aa=wa((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:m.announce.of(r),userEvent:`input.replace.all`}),!0});function ja(e){return e.state.facet(W).createPanel(e)}function Ma(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(W);return new ca({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function Na(e){let t=l(e,ja);return t&&t.dom.querySelector(`[main-field]`)}function Pa(e){let t=Na(e);t&&t==e.root.activeElement&&t.select()}var Fa=e=>{let t=e.state.field(J,!1);if(t&&t.panel){let n=Na(e);if(n&&n!=e.root.activeElement){let r=Ma(e.state,t.query.spec);r.valid&&e.dispatch({effects:q.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[va.of(!0),t?q.of(Ma(e.state,t.query.spec)):D.appendConfig.of(Ua)]});return!0},Ia=e=>{let t=e.state.field(J,!1);if(!t||!t.panel)return!1;let n=l(e,ja);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:va.of(!1)}),!0},La=[{key:`Mod-f`,run:Fa,scope:`editor search-panel`},{key:`F3`,run:Ta,shift:Ea,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:Ta,shift:Ea,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Ia,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Oa},{key:`Mod-Alt-g`,run:Ji},{key:`Mod-d`,run:oa,preventDefault:!0}],Ra=class{constructor(e){this.view=e;let t=this.query=e.state.field(J).query.spec;this.commit=this.commit.bind(this),this.searchField=b(`input`,{value:t.search,placeholder:Y(e,`Find`),"aria-label":Y(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=b(`input`,{value:t.replace,placeholder:Y(e,`Replace`),"aria-label":Y(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=b(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=b(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=b(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return b(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=b(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>Ta(e),[Y(e,`next`)]),n(`prev`,()=>Ea(e),[Y(e,`previous`)]),n(`select`,()=>Da(e),[Y(e,`all`)]),b(`label`,null,[this.caseField,Y(e,`match case`)]),b(`label`,null,[this.reField,Y(e,`regexp`)]),b(`label`,null,[this.wordField,Y(e,`by word`)]),...e.state.readOnly?[]:[b(`br`),this.replaceField,n(`replace`,()=>ka(e),[Y(e,`replace`)]),n(`replaceAll`,()=>Aa(e),[Y(e,`replace all`)])],b(`button`,{name:`close`,onclick:()=>Ia(e),"aria-label":Y(e,`close`),type:`button`},[`×`])])}commit(){let e=new ca({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:q.of(e)}))}keydown(e){Me(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ea:Ta)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),ka(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(q)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(W).top}};function Y(e,t){return e.state.phrase(t)}var za=30,Ba=/[\s\.,:;?!]/;function Va(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-za),o=Math.min(i,n+za),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<za;e++)if(!Ba.test(s[e+1])&&Ba.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-za;e--)if(!Ba.test(s[e-1])&&Ba.test(s[e])){s=s.slice(0,e);break}}return m.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Ha=m.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`}}),Ua=[J,ye.low(Ca),Ha],Wa=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},Ga=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(ro).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new de,s=[],l=0,u=r.doc.iter(),d=0,f=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=l,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>f)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,f);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==f))&&(i=n==r,!i&&r-n<10)){let e=n-(d+u.value.length);e>0&&(u.next(e),d=n);for(let e=n;;){if(e>=r){i=!0;break}if(!u.lineBreak&&d+u.value.length>e)break;e=d+u.value.length,d+=u.value.length,u.next()}}let p=ho(s);if(i)o.add(n,n,c.widget({widget:new so(p),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,c.mark({class:`cm-lintRange cm-lintRange-`+p+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(l=r,l==f)break;for(let e=0;e<s.length;e++)s[e].to<=l&&s.splice(e--,1)}let p=o.finish();return new e(p,n,X(p))}};function X(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0)){if(!r)r=new Wa(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new Wa(r.from,n,r.diagnostic)}}),r}function Ka(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(ro).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(Ja))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function qa(e,t){return e.field(Z,!1)?t:t.concat(D.appendConfig.of(_o))}var Ja=D.define(),Ya=D.define(),Xa=D.define(),Z=x.define({create(){return new Ga(c.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=X(n,e.selected.diagnostic,i)||X(n,null,i)}!n.size&&i&&t.state.facet(ro).autoPanel&&(i=null),e=new Ga(n,i,r)}for(let n of t.effects)if(n.is(Ja)){let r=t.state.facet(ro).autoPanel?n.value.length?lo.open:null:e.panel;e=Ga.init(n.value,r,t.state)}else n.is(Ya)?e=new Ga(e.diagnostics,n.value?lo.open:null,e.selected):n.is(Xa)&&(e=new Ga(e.diagnostics,e.panel,n.value));return e},provide:e=>[ke.from(e,e=>e.panel),m.decorations.from(e,e=>e.diagnostics)]}),Za=c.mark({class:`cm-lintRange cm-lintRange-active`});function Qa(e,t,n){let{diagnostics:r}=e.state.field(Z),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(ro).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:!0,create(){return{dom:$a(e,i)}}}:null}function $a(e,t){return b(`ul`,{class:`cm-tooltip-lint`},t.map(t=>oo(e,t,!1)))}var eo=e=>{let t=e.state.field(Z,!1);t&&t.panel||e.dispatch({effects:qa(e.state,[Ya.of(!0)])});let n=l(e,lo.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},to=e=>{let t=e.state.field(Z,!1);return!t||!t.panel?!1:(e.dispatch({effects:Ya.of(!1)}),!0)},no=[{key:`Mod-Shift-m`,run:eo,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(Z,!1);if(!t)return!1;let n=e.state.selection.main,i=X(t.diagnostics,null,n.to+1);return!i&&(i=X(t.diagnostics,null,0),!i||i.from==n.from&&i.to==n.to)?!1:(e.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),r(e,i.from,1,{tooltip:go,until:e=>e.docChanged||e.newSelection.main.head<i.from||e.newSelection.main.head>i.to}),!0)}}],ro=T.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...ie(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:io,tooltipFilter:io,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function io(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function ao(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function oo(e,t,n){let r=n?ao(t.actions):[];return b(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},b(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=X(e.state.field(Z).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),b(`u`,s.slice(c,c+1)),s.slice(c+1)],u=n.markClass?` `+n.markClass:``;return b(`button`,{type:`button`,class:`cm-diagnosticAction`+u,onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&b(`div`,{class:`cm-diagnosticSource`},t.source))}var so=class extends ze{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return b(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},co=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=oo(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},lo=class e{constructor(e){this.view=e,this.items=[];let t=t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)to(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=ao(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=X(this.view.state.field(Z).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=b(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t,onclick:n}),this.dom=b(`div`,{class:`cm-panel-lint`},this.list,b(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>to(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(Z).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Z),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new co(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new co(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&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=X(this.view.state.field(Z).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Xa.of(t)})}static open(t){return new e(t)}};function uo(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function fo(e){return uo(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var po=m.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:fo(`#f11`)},".cm-lintRange-warning":{backgroundImage:fo(`orange`)},".cm-lintRange-info":{backgroundImage:fo(`#999`)},".cm-lintRange-hint":{backgroundImage:fo(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function mo(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function ho(e){let t=`hint`,n=1;for(let r of e){let e=mo(r.severity);e>n&&(n=e,t=r.severity)}return t}var go=ce(Qa,{hideOn:Ka}),_o=[Z,m.decorations.compute([Z],e=>{let{selected:t,panel:n}=e.field(Z);return!t||!n||t.from==t.to?c.none:c.set([Za.range(t.from,t.to)])}),go,po],vo=[te(),f(),le(),Rn(),_e(),u(),ae(),ge.allowMultipleSelections.of(!0),Ie(),n(he,{fallback:!0}),Se(),tn(),yn(),me(),oe(),Oe(),Zi(),ue.of([...cn,...Li,...La,...tr,...Pe,...bn,...no])];function Q(e){return new Ee(fe.define(e))}function $(e){return O(()=>import(`./dist-BFhI7cEI.js`).then(t=>t.sql({dialect:t[e]})),__vite__mapDeps([0,1,2]))}var yo=[y.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return O(()=>import(`./dist-C0vYCeId.js`).then(e=>e.cpp()),__vite__mapDeps([3,2,1]))}}),y.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return O(()=>import(`./dist-C0vYCeId.js`).then(e=>e.cpp()),__vite__mapDeps([3,2,1]))}}),y.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return $(`Cassandra`)}}),y.of({name:`CSS`,extensions:[`css`],load(){return O(()=>import(`./dist-RJnNnBqa.js`).then(e=>e.i).then(e=>e.css()),__vite__mapDeps([4,5,2,1]))}}),y.of({name:`Go`,extensions:[`go`],load(){return O(()=>import(`./dist-BRYLL4VU.js`).then(e=>e.go()),__vite__mapDeps([6,2,1]))}}),y.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return O(()=>import(`./dist-DAlictfL.js`).then(e=>e.html()),__vite__mapDeps([7,2,1,4,5,8]))}}),y.of({name:`Java`,extensions:[`java`],load(){return O(()=>import(`./dist-Cc1Gj7tZ.js`).then(e=>e.java()),__vite__mapDeps([9,2,1]))}}),y.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return O(()=>import(`./dist-Im2q9dJ0.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,5,2,1]))}}),y.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return O(()=>import(`./dist-o-4nubru.js`).then(e=>e.jinja()),__vite__mapDeps([10,1,7,2,4,5,8]))}}),y.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return O(()=>import(`./dist-ByVjh-LO.js`).then(e=>e.json()),__vite__mapDeps([11,2,1]))}}),y.of({name:`JSX`,extensions:[`jsx`],load(){return O(()=>import(`./dist-Im2q9dJ0.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([8,5,2,1]))}}),y.of({name:`LESS`,extensions:[`less`],load(){return O(()=>import(`./dist-BZwn6_Fh.js`).then(e=>e.less()),__vite__mapDeps([12,1,4,5,2]))}}),y.of({name:`Liquid`,extensions:[`liquid`],load(){return O(()=>import(`./dist-BYJ4SXpR.js`).then(e=>e.liquid()),__vite__mapDeps([13,1,7,2,4,5,8]))}}),y.of({name:`MariaDB SQL`,load(){return $(`MariaSQL`)}}),y.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return O(()=>import(`./dist-CaNhruaD.js`).then(e=>e.markdown()),__vite__mapDeps([14,1,7,2,4,5,8]))}}),y.of({name:`MS SQL`,load(){return $(`MSSQL`)}}),y.of({name:`MySQL`,load(){return $(`MySQL`)}}),y.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return O(()=>import(`./dist-CszBAiM6.js`).then(e=>e.php()),__vite__mapDeps([15,2,1,7,4,5,8]))}}),y.of({name:`PLSQL`,extensions:[`pls`],load(){return $(`PLSQL`)}}),y.of({name:`PostgreSQL`,load(){return $(`PostgreSQL`)}}),y.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return O(()=>import(`./dist-CsFhAvz7.js`).then(e=>e.python()),__vite__mapDeps([16,2,1]))}}),y.of({name:`Rust`,extensions:[`rs`],load(){return O(()=>import(`./dist-Cm6nrvBz.js`).then(e=>e.rust()),__vite__mapDeps([17,2,1]))}}),y.of({name:`Sass`,extensions:[`sass`],load(){return O(()=>import(`./dist-DuwjrxJ6.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([18,2,1,4,5]))}}),y.of({name:`SCSS`,extensions:[`scss`],load(){return O(()=>import(`./dist-DuwjrxJ6.js`).then(e=>e.sass()),__vite__mapDeps([18,2,1,4,5]))}}),y.of({name:`SQL`,extensions:[`sql`],load(){return $(`StandardSQL`)}}),y.of({name:`SQLite`,load(){return $(`SQLite`)}}),y.of({name:`TSX`,extensions:[`tsx`],load(){return O(()=>import(`./dist-Im2q9dJ0.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([8,5,2,1]))}}),y.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return O(()=>import(`./dist-Im2q9dJ0.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,5,2,1]))}}),y.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return O(()=>import(`./dist-DKNlD5B9.js`).then(e=>e.wast()),__vite__mapDeps([19,1,2]))}}),y.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return O(()=>import(`./dist-DBsUA7Da.js`).then(e=>e.xml()),__vite__mapDeps([20,2,1]))}}),y.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return O(()=>import(`./dist-BFoOtrHc.js`).then(e=>e.yaml()),__vite__mapDeps([21,2,1]))}}),y.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return O(()=>import(`./apl-CHPMLzQP.js`).then(e=>Q(e.apl)),[])}}),y.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return O(()=>import(`./asciiarmor-Qq1NDodh.js`).then(e=>Q(e.asciiArmor)),[])}}),y.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return O(()=>import(`./asn1-DRgkG9yc.js`).then(e=>Q(e.asn1({}))),[])}}),y.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return O(()=>import(`./asterisk-ae5wsYrl.js`).then(e=>Q(e.asterisk)),[])}}),y.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return O(()=>import(`./brainfuck-BKsya-lF.js`).then(e=>Q(e.brainfuck)),[])}}),y.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return O(()=>import(`./cobol-B3aUFbKf.js`).then(e=>Q(e.cobol)),[])}}),y.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.csharp)),[])}}),y.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return O(()=>import(`./clojure-CgPaYiPv.js`).then(e=>Q(e.clojure)),[])}}),y.of({name:`ClojureScript`,extensions:[`cljs`],load(){return O(()=>import(`./clojure-CgPaYiPv.js`).then(e=>Q(e.clojure)),[])}}),y.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return O(()=>import(`./css-DN2LLrF8.js`).then(e=>Q(e.gss)),[])}}),y.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return O(()=>import(`./cmake-DbqTW5io.js`).then(e=>Q(e.cmake)),[])}}),y.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return O(()=>import(`./coffeescript-CCPt9S--.js`).then(e=>Q(e.coffeeScript)),[])}}),y.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return O(()=>import(`./commonlisp-Clm1YIex.js`).then(e=>Q(e.commonLisp)),[])}}),y.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return O(()=>import(`./cypher-CCkHI_OH.js`).then(e=>Q(e.cypher)),[])}}),y.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return O(()=>import(`./python-4ztzejrZ.js`).then(e=>Q(e.cython)),[])}}),y.of({name:`Crystal`,extensions:[`cr`],load(){return O(()=>import(`./crystal-BmCet_35.js`).then(e=>Q(e.crystal)),[])}}),y.of({name:`D`,extensions:[`d`],load(){return O(()=>import(`./d-DXS80xi8.js`).then(e=>Q(e.d)),[])}}),y.of({name:`Dart`,extensions:[`dart`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.dart)),[])}}),y.of({name:`diff`,extensions:[`diff`,`patch`],load(){return O(()=>import(`./diff-LtZN2nYD.js`).then(e=>Q(e.diff)),[])}}),y.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return O(()=>import(`./dockerfile-nM1Ko-Z7.js`).then(e=>Q(e.dockerFile)),__vite__mapDeps([22,23]))}}),y.of({name:`DTD`,extensions:[`dtd`],load(){return O(()=>import(`./dtd-u6doTIMs.js`).then(e=>Q(e.dtd)),[])}}),y.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return O(()=>import(`./dylan-CqCzC1wV.js`).then(e=>Q(e.dylan)),[])}}),y.of({name:`EBNF`,load(){return O(()=>import(`./ebnf-Br6TG6Ej.js`).then(e=>Q(e.ebnf)),[])}}),y.of({name:`ECL`,extensions:[`ecl`],load(){return O(()=>import(`./ecl-DySBI3Mi.js`).then(e=>Q(e.ecl)),[])}}),y.of({name:`edn`,extensions:[`edn`],load(){return O(()=>import(`./clojure-CgPaYiPv.js`).then(e=>Q(e.clojure)),[])}}),y.of({name:`Eiffel`,extensions:[`e`],load(){return O(()=>import(`./eiffel-sYWuGv6G.js`).then(e=>Q(e.eiffel)),[])}}),y.of({name:`Elm`,extensions:[`elm`],load(){return O(()=>import(`./elm--68dTWWw.js`).then(e=>Q(e.elm)),[])}}),y.of({name:`Erlang`,extensions:[`erl`],load(){return O(()=>import(`./erlang-DRzMWhmI.js`).then(e=>Q(e.erlang)),[])}}),y.of({name:`Esper`,load(){return O(()=>import(`./sql-CCvDj5CS.js`).then(e=>Q(e.esper)),[])}}),y.of({name:`Factor`,extensions:[`factor`],load(){return O(()=>import(`./factor-BZWcskYe.js`).then(e=>Q(e.factor)),__vite__mapDeps([24,23]))}}),y.of({name:`FCL`,load(){return O(()=>import(`./fcl-NiqhPlpc.js`).then(e=>Q(e.fcl)),[])}}),y.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return O(()=>import(`./forth-DSgqrjnb.js`).then(e=>Q(e.forth)),[])}}),y.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return O(()=>import(`./fortran-DowQl6ME.js`).then(e=>Q(e.fortran)),[])}}),y.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return O(()=>import(`./mllike-Bk45LYJs.js`).then(e=>Q(e.fSharp)),[])}}),y.of({name:`Gas`,extensions:[`s`],load(){return O(()=>import(`./gas-BGG03rL_.js`).then(e=>Q(e.gas)),[])}}),y.of({name:`Gherkin`,extensions:[`feature`],load(){return O(()=>import(`./gherkin-Cqb_6D-9.js`).then(e=>Q(e.gherkin)),[])}}),y.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return O(()=>import(`./groovy-B7zM4Cov.js`).then(e=>Q(e.groovy)),[])}}),y.of({name:`Haskell`,extensions:[`hs`],load(){return O(()=>import(`./haskell-D7qM5JJh.js`).then(e=>Q(e.haskell)),[])}}),y.of({name:`Haxe`,extensions:[`hx`],load(){return O(()=>import(`./haxe-C6pwwQZb.js`).then(e=>Q(e.haxe)),[])}}),y.of({name:`HXML`,extensions:[`hxml`],load(){return O(()=>import(`./haxe-C6pwwQZb.js`).then(e=>Q(e.hxml)),[])}}),y.of({name:`HTTP`,load(){return O(()=>import(`./http-CmD77Vm0.js`).then(e=>Q(e.http)),[])}}),y.of({name:`IDL`,extensions:[`pro`],load(){return O(()=>import(`./idl-aL_loni0.js`).then(e=>Q(e.idl)),[])}}),y.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return O(()=>import(`./javascript-BXKxGTTj.js`).then(e=>Q(e.jsonld)),[])}}),y.of({name:`Julia`,extensions:[`jl`],load(){return O(()=>import(`./julia-CfBqSgho.js`).then(e=>Q(e.julia)),[])}}),y.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.kotlin)),[])}}),y.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return O(()=>import(`./livescript-CR8U3wM3.js`).then(e=>Q(e.liveScript)),[])}}),y.of({name:`Lua`,extensions:[`lua`],load(){return O(()=>import(`./lua-Bg4VZnNk.js`).then(e=>Q(e.lua)),[])}}),y.of({name:`mIRC`,extensions:[`mrc`],load(){return O(()=>import(`./mirc-CN27htLS.js`).then(e=>Q(e.mirc)),[])}}),y.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return O(()=>import(`./mathematica-BfPIWI-2.js`).then(e=>Q(e.mathematica)),[])}}),y.of({name:`Modelica`,extensions:[`mo`],load(){return O(()=>import(`./modelica-BhMDrNyP.js`).then(e=>Q(e.modelica)),[])}}),y.of({name:`MUMPS`,extensions:[`mps`],load(){return O(()=>import(`./mumps-q10v_7vy.js`).then(e=>Q(e.mumps)),[])}}),y.of({name:`Mbox`,extensions:[`mbox`],load(){return O(()=>import(`./mbox-BJBtIzYn.js`).then(e=>Q(e.mbox)),[])}}),y.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return O(()=>import(`./nginx-B3xldx-W.js`).then(e=>Q(e.nginx)),[])}}),y.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return O(()=>import(`./nsis-DbrGokpL.js`).then(e=>Q(e.nsis)),__vite__mapDeps([25,23]))}}),y.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return O(()=>import(`./ntriples--7wOxqgF.js`).then(e=>Q(e.ntriples)),[])}}),y.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.objectiveC)),[])}}),y.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.objectiveCpp)),[])}}),y.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return O(()=>import(`./mllike-Bk45LYJs.js`).then(e=>Q(e.oCaml)),[])}}),y.of({name:`Octave`,extensions:[`m`],load(){return O(()=>import(`./octave-1xDlNsHK.js`).then(e=>Q(e.octave)),[])}}),y.of({name:`Oz`,extensions:[`oz`],load(){return O(()=>import(`./oz-BjT3jK8F.js`).then(e=>Q(e.oz)),[])}}),y.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return O(()=>import(`./pascal-BPtkfU66.js`).then(e=>Q(e.pascal)),[])}}),y.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return O(()=>import(`./perl-DTi_Gu_W.js`).then(e=>Q(e.perl)),[])}}),y.of({name:`Pig`,extensions:[`pig`],load(){return O(()=>import(`./pig-WgPxIDtX.js`).then(e=>Q(e.pig)),[])}}),y.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return O(()=>import(`./powershell-DRMXCHuF.js`).then(e=>Q(e.powerShell)),[])}}),y.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return O(()=>import(`./properties-BmWTtUTd.js`).then(e=>Q(e.properties)),[])}}),y.of({name:`ProtoBuf`,extensions:[`proto`],load(){return O(()=>import(`./protobuf-DWkEBtMs.js`).then(e=>Q(e.protobuf)),[])}}),y.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return O(()=>import(`./pug-aQNhkzLr.js`).then(e=>Q(e.pug)),__vite__mapDeps([26,27]))}}),y.of({name:`Puppet`,extensions:[`pp`],load(){return O(()=>import(`./puppet-D_Fwwei_.js`).then(e=>Q(e.puppet)),[])}}),y.of({name:`Q`,extensions:[`q`],load(){return O(()=>import(`./q-CBhhTF3v.js`).then(e=>Q(e.q)),[])}}),y.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return O(()=>import(`./r-C9LQ8gef.js`).then(e=>Q(e.r)),[])}}),y.of({name:`RPM Changes`,load(){return O(()=>import(`./rpm-X0uOxMxY.js`).then(e=>Q(e.rpmChanges)),[])}}),y.of({name:`RPM Spec`,extensions:[`spec`],load(){return O(()=>import(`./rpm-X0uOxMxY.js`).then(e=>Q(e.rpmSpec)),[])}}),y.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return O(()=>import(`./ruby-C47yS3tR.js`).then(e=>Q(e.ruby)),[])}}),y.of({name:`SAS`,extensions:[`sas`],load(){return O(()=>import(`./sas-B1FBIZ4F.js`).then(e=>Q(e.sas)),[])}}),y.of({name:`Scala`,extensions:[`scala`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.scala)),[])}}),y.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return O(()=>import(`./scheme-BNyhth_j.js`).then(e=>Q(e.scheme)),[])}}),y.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return O(()=>import(`./shell-5WXBrNPS.js`).then(e=>Q(e.shell)),[])}}),y.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return O(()=>import(`./sieve-D1Disq_M.js`).then(e=>Q(e.sieve)),[])}}),y.of({name:`Smalltalk`,extensions:[`st`],load(){return O(()=>import(`./smalltalk-sYJEN366.js`).then(e=>Q(e.smalltalk)),[])}}),y.of({name:`Solr`,load(){return O(()=>import(`./solr-C4NTsT9q.js`).then(e=>Q(e.solr)),[])}}),y.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return O(()=>import(`./mllike-Bk45LYJs.js`).then(e=>Q(e.sml)),[])}}),y.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return O(()=>import(`./sparql-BUDcgvyA.js`).then(e=>Q(e.sparql)),[])}}),y.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return O(()=>import(`./spreadsheet-Cc9aoY1X.js`).then(e=>Q(e.spreadsheet)),[])}}),y.of({name:`Squirrel`,extensions:[`nut`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.squirrel)),[])}}),y.of({name:`Stylus`,extensions:[`styl`],load(){return O(()=>import(`./stylus-gypP4Wbw.js`).then(e=>Q(e.stylus)),[])}}),y.of({name:`Swift`,extensions:[`swift`],load(){return O(()=>import(`./swift-B3wDQDLW.js`).then(e=>Q(e.swift)),[])}}),y.of({name:`sTeX`,load(){return O(()=>import(`./stex-QOxlzChr.js`).then(e=>Q(e.stex)),[])}}),y.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return O(()=>import(`./stex-QOxlzChr.js`).then(e=>Q(e.stex)),[])}}),y.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return O(()=>import(`./verilog-BQwnhnkI.js`).then(e=>Q(e.verilog)),[])}}),y.of({name:`Tcl`,extensions:[`tcl`],load(){return O(()=>import(`./tcl-BrLMXonE.js`).then(e=>Q(e.tcl)),[])}}),y.of({name:`Textile`,extensions:[`textile`],load(){return O(()=>import(`./textile-3OdJWGLP.js`).then(e=>Q(e.textile)),[])}}),y.of({name:`TiddlyWiki`,load(){return O(()=>import(`./tiddlywiki-CmXBv0bH.js`).then(e=>Q(e.tiddlyWiki)),[])}}),y.of({name:`Tiki wiki`,load(){return O(()=>import(`./tiki-DH9217vp.js`).then(e=>Q(e.tiki)),[])}}),y.of({name:`TOML`,extensions:[`toml`],load(){return O(()=>import(`./toml-BbNXaVxN.js`).then(e=>Q(e.toml)),[])}}),y.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return O(()=>import(`./troff-B3-4D8jV.js`).then(e=>Q(e.troff)),[])}}),y.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return O(()=>import(`./ttcn-T6YAhFaa.js`).then(e=>Q(e.ttcn)),[])}}),y.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return O(()=>import(`./ttcn-cfg-B2HBoHuP.js`).then(e=>Q(e.ttcnCfg)),[])}}),y.of({name:`Turtle`,extensions:[`ttl`],load(){return O(()=>import(`./turtle-DWZbcJ3Q.js`).then(e=>Q(e.turtle)),[])}}),y.of({name:`Web IDL`,extensions:[`webidl`],load(){return O(()=>import(`./webidl-ClkPG1IF.js`).then(e=>Q(e.webIDL)),[])}}),y.of({name:`VB.NET`,extensions:[`vb`],load(){return O(()=>import(`./vb-B2tgJzbE.js`).then(e=>Q(e.vb)),[])}}),y.of({name:`VBScript`,extensions:[`vbs`],load(){return O(()=>import(`./vbscript-CdcLDZO3.js`).then(e=>Q(e.vbScript)),[])}}),y.of({name:`Velocity`,extensions:[`vtl`],load(){return O(()=>import(`./velocity-BNg1Q2g9.js`).then(e=>Q(e.velocity)),[])}}),y.of({name:`Verilog`,extensions:[`v`],load(){return O(()=>import(`./verilog-BQwnhnkI.js`).then(e=>Q(e.verilog)),[])}}),y.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return O(()=>import(`./vhdl-DMlpjilm.js`).then(e=>Q(e.vhdl)),[])}}),y.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return O(()=>import(`./xquery-ChetrTQb.js`).then(e=>Q(e.xQuery)),[])}}),y.of({name:`Yacas`,extensions:[`ys`],load(){return O(()=>import(`./yacas-eBln9l6K.js`).then(e=>Q(e.yacas)),[])}}),y.of({name:`Z80`,extensions:[`z80`],load(){return O(()=>import(`./z80-Bu1e9FlK.js`).then(e=>Q(e.z80)),[])}}),y.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return O(()=>import(`./mscgen-CiE_ZxvV.js`).then(e=>Q(e.mscgen)),[])}}),y.of({name:`Xù`,extensions:[`xu`],load(){return O(()=>import(`./mscgen-CiE_ZxvV.js`).then(e=>Q(e.xu)),[])}}),y.of({name:`MsGenny`,extensions:[`msgenny`],load(){return O(()=>import(`./mscgen-CiE_ZxvV.js`).then(e=>Q(e.msgenny)),[])}}),y.of({name:`Vue`,extensions:[`vue`],load(){return O(()=>import(`./dist-CWWynAS-.js`).then(e=>e.vue()),__vite__mapDeps([28,1,7,2,4,5,8]))}}),y.of({name:`Angular Template`,load(){return O(()=>import(`./dist-CqXTRhJp.js`).then(e=>e.angular()),__vite__mapDeps([29,1,7,2,4,5,8]))}})],bo=999,xo=`xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"`,So={previous:`<svg ${xo}><path d="M4 10l4-4 4 4"/></svg>`,next:`<svg ${xo}><path d="M4 6l4 4 4-4"/></svg>`,close:`<svg ${xo}><path d="M4.5 4.5l7 7M11.5 4.5l-7 7"/></svg>`};function Co(e,t,n){let r=document.createElement(`button`);return r.type=`button`,r.className=`cm-find-button`,r.setAttribute(`aria-label`,t),r.title=t,r.innerHTML=So[e],r.addEventListener(`mousedown`,e=>e.preventDefault()),r.addEventListener(`click`,n),r}function wo(e,t){if(!t.search||!t.valid)return``;let{from:n,to:r}=e.state.selection.main,i=0,a=0,o=t.getCursor(e.state);for(let e=o.next();!e.done;e=o.next())if(i++,e.value.from===n&&e.value.to===r&&(a=i),i>bo)return a?`${a}/${bo}+`:`${bo}+`;return i?a?`${a}/${i}`:String(i):k(`无结果`,`No results`)}function To(e){let t=document.createElement(`div`);t.className=`cm-find`,t.setAttribute(`role`,`search`);let n=document.createElement(`input`);n.className=`cm-find-input`,n.type=`text`,n.spellcheck=!1,n.placeholder=k(`查找`,`Find`),n.setAttribute(`aria-label`,k(`在文件中查找`,`Find in file`)),n.setAttribute(`main-field`,`true`),n.value=ya(e.state).search;let r=document.createElement(`span`);r.className=`cm-find-count`,r.setAttribute(`aria-live`,`polite`);let i=()=>{r.textContent=wo(e,ya(e.state))},a=t=>{t?Ea(e):Ta(e)};return n.addEventListener(`input`,()=>{let t=new ca({...ya(e.state),search:n.value});if(e.dispatch({effects:q.of(t)}),!t.search||!t.valid)return;let r=e.state.selection.main.from,i=t.getCursor(e.state,r).next(),a=i.done?t.getCursor(e.state,0,r).next():i;a.done||e.dispatch({selection:{anchor:a.value.from,head:a.value.to},scrollIntoView:!0,userEvent:`select.search`})}),n.addEventListener(`keydown`,t=>{t.key===`Enter`?(t.preventDefault(),a(t.shiftKey)):t.key===`Escape`&&(t.preventDefault(),Ia(e),e.focus())}),t.append(n,r,Co(`previous`,k(`上一个匹配(Shift+Enter)`,`Previous match (Shift+Enter)`),()=>a(!0)),Co(`next`,k(`下一个匹配(Enter)`,`Next match (Enter)`),()=>a(!1)),Co(`close`,k(`关闭(Esc)`,`Close (Esc)`),()=>{Ia(e),e.focus()})),i(),{dom:t,top:!0,mount(){n.focus(),n.select()},update(e){let t=ya(e.state);t.search!==n.value&&e.transactions.some(e=>e.effects.some(e=>e.is(q)))&&(n.value=t.search),(e.docChanged||e.selectionSet||t!==ya(e.startState))&&i()}}}var Eo=m.theme({".cm-panels.cm-panels-top":{position:`absolute`,top:`8px`,right:`16px`,left:`auto`,border:`none`,backgroundColor:`transparent`,zIndex:`300`},".cm-find":{display:`flex`,alignItems:`center`,gap:`2px`,boxSizing:`border-box`,width:`min(340px, calc(100vw - 48px))`,padding:`6px`,border:`0.5px solid var(--dsw-alias-border-l2)`,borderRadius:`var(--dsw-radius-md)`,backgroundColor:`var(--dsw-menu-surface-fill, var(--dsw-alias-bg-layer-1))`,boxShadow:`var(--dsw-elevation-panel)`,fontFamily:`var(--ds-font-family, inherit)`,fontSize:`12.5px`,color:`var(--dsw-alias-label-primary)`},".cm-find-input":{flex:`1`,minWidth:`0`,height:`28px`,boxSizing:`border-box`,margin:`0 4px 0 0`,padding:`0 10px`,border:`0.5px solid var(--dsw-alias-border-l3)`,borderRadius:`var(--dsw-radius-sm)`,backgroundColor:`var(--dsw-alias-bg-base, transparent)`,color:`inherit`,font:`inherit`,outline:`none`},".cm-find-input:focus":{borderColor:`var(--dsw-alias-border-l1)`},".cm-find-input::placeholder":{color:`var(--dsw-alias-label-tertiary)`},".cm-find-count":{flex:`none`,minWidth:`0`,padding:`0 6px 0 2px`,color:`var(--dsw-alias-label-tertiary)`,fontSize:`12px`,fontVariantNumeric:`tabular-nums`,whiteSpace:`nowrap`},".cm-find-count:empty":{display:`none`},".cm-find-button":{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flex:`none`,width:`28px`,height:`28px`,padding:`0`,border:`0`,borderRadius:`var(--dsw-radius-sm)`,backgroundColor:`transparent`,color:`var(--dsw-alias-label-secondary)`,cursor:`pointer`},".cm-find-button:hover":{backgroundColor:`var(--dsw-alias-interactive-bg-hover)`},".cm-find-button:focus-visible":{outline:`2px solid var(--dsw-alias-label-primary)`,outlineOffset:`-2px`},".cm-searchMatch":{backgroundColor:`color-mix(in srgb, var(--dsw-alias-state-warn-label) 22%, transparent)`,outline:`none`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`color-mix(in srgb, var(--dsw-alias-state-warn-label) 48%, transparent)`}}),Do=[sa({top:!0,createPanel:To}),Eo],Oo=e({createCodeEditor:()=>jo}),ko=je.define([{tag:[g.keyword,g.controlKeyword,g.operatorKeyword,g.definitionKeyword,g.moduleKeyword,g.modifier,g.self,g.tagName],color:`var(--shiki-token-keyword)`},{tag:[g.string,g.special(g.string),g.regexp,g.character,g.inserted],color:`var(--shiki-token-string)`},{tag:[g.comment,g.lineComment,g.blockComment,g.docComment,g.meta],color:`var(--shiki-token-comment)`,fontStyle:`italic`},{tag:[g.number,g.bool,g.null,g.atom,g.constant(g.name),g.standard(g.name),g.typeName,g.className,g.namespace,g.unit],color:`var(--shiki-token-constant)`},{tag:[g.function(g.variableName),g.function(g.propertyName),g.macroName,g.labelName],color:`var(--shiki-token-function)`},{tag:[g.attributeName,g.local(g.variableName),g.special(g.variableName)],color:`var(--shiki-token-parameter)`},{tag:[g.punctuation,g.bracket,g.operator,g.separator,g.angleBracket],color:`var(--shiki-token-punctuation)`},{tag:[g.link,g.url],color:`var(--shiki-token-link)`,textDecoration:`underline`},{tag:g.heading,color:`var(--shiki-token-keyword)`,fontWeight:`600`},{tag:g.emphasis,fontStyle:`italic`},{tag:g.strong,fontWeight:`600`},{tag:g.strikethrough,textDecoration:`line-through`},{tag:[g.invalid,g.deleted],color:`var(--dsw-alias-state-error-primary)`}]),Ao=m.theme({"&":{height:`100%`,color:`var(--shiki-foreground)`,backgroundColor:`var(--shiki-background)`,fontSize:`12.5px`},"&.cm-focused":{outline:`none`},".cm-scroller":{fontFamily:`var(--ds-font-family-code)`,lineHeight:`1.6`,overflow:`auto`},".cm-content":{padding:`10px 0 calc(10px + var(--pi-floating-composer-overlap, 0px))`,caretColor:`var(--dsw-alias-label-primary)`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`var(--dsw-alias-label-primary)`},".cm-gutters":{backgroundColor:`var(--shiki-background)`,color:`var(--dsw-alias-label-tertiary)`,border:`none`},".cm-lineNumbers .cm-gutterElement":{padding:`0 10px 0 14px`,minWidth:`3ch`},".cm-activeLine":{backgroundColor:`color-mix(in srgb, var(--dsw-alias-label-primary) 4%, transparent)`},".cm-activeLineGutter":{backgroundColor:`transparent`,color:`var(--dsw-alias-label-secondary)`},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:`color-mix(in srgb, var(--dsw-static-blue-500, #3b82f6) 22%, transparent)`},".cm-selectionMatch":{backgroundColor:`color-mix(in srgb, var(--dsw-alias-state-warn-label) 18%, transparent)`},".cm-matchingBracket, &.cm-focused .cm-matchingBracket":{backgroundColor:`color-mix(in srgb, var(--dsw-alias-label-primary) 10%, transparent)`,outline:`none`},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:`var(--dsw-alias-label-tertiary)`},".cm-panels":{backgroundColor:`var(--dsw-alias-bg-layer-1, var(--shiki-background))`,color:`var(--dsw-alias-label-primary)`},".cm-panels.cm-panels-bottom":{borderTop:`0.5px solid var(--dsw-alias-border-l3)`},".cm-tooltip":{border:`0.5px solid var(--dsw-alias-border-l2)`,backgroundColor:`var(--dsw-alias-bg-layer-1, var(--shiki-background))`}});function jo(e,t){let r=new Ne,i=document.querySelector(`meta[name="pi-style-nonce"]`)?.content,a=!1,o=new m({parent:e,state:ge.create({doc:t.text,extensions:[vo,Do,ue.of([Ri]),ye.highest(ue.of([{key:`Mod-s`,preventDefault:!0,run:()=>(t.onSave(),!0)}])),n(ko),Ao,r.of([]),...i?[m.cspNonce.of(i)]:[],m.contentAttributes.of({"aria-label":t.label}),m.updateListener.of(e=>{if(e.docChanged&&!a&&t.onChange(e.state.doc.toString()),e.selectionSet||e.docChanged){let n=e.state.selection.main;t.onSelection?.(n.empty?null:{from:e.state.doc.lineAt(n.from).number,to:e.state.doc.lineAt(n.to).number})}})]})}),s=!1;return y.matchFilename(yo,t.filename)?.load().then(e=>{s||o.dispatch({effects:r.reconfigure(e)})}).catch(()=>{}),{setText(e){if(e!==o.state.doc.toString()){a=!0;try{o.dispatch({changes:{from:0,to:o.state.doc.length,insert:e}})}finally{a=!1}}},reveal(e){let t=o.state.doc.line(Math.min(Math.max(1,e),o.state.doc.lines));o.dispatch({selection:{anchor:t.from,head:t.to},effects:m.scrollIntoView(t.from,{y:`center`})})},focus:()=>o.focus(),destroy(){s=!0,o.destroy()}}}export{Xt as a,jo as createCodeEditor,We as i,Be as n,Ue as r,Oo as t};
|
|
4
|
-
//# debugId=
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-CP5SBgQB.js","assets/dist-IkQ96Etc.js","assets/dist-DTWmF6Zy.js","assets/dist-C0vYCeId.js","assets/dist-RJnNnBqa.js","assets/rolldown-runtime-CgmABjMJ.js","assets/dist-C7kRRV1b.js","assets/dist-CmPE8_f_.js","assets/dist-C2WSXtwq.js","assets/dist-Cc1Gj7tZ.js","assets/dist-BD_2QeWa.js","assets/dist-ByVjh-LO.js","assets/dist-BZwn6_Fh.js","assets/dist-DFTCmV51.js","assets/dist-CCfANS3F.js","assets/dist-D-nx7RRS.js","assets/dist-Dr0qO3Zr.js","assets/dist-Cm6nrvBz.js","assets/dist-DuwjrxJ6.js","assets/dist-DKNlD5B9.js","assets/dist-DBsUA7Da.js","assets/dist-BFoOtrHc.js","assets/dockerfile-nM1Ko-Z7.js","assets/simple-mode-CZvkON1J.js","assets/factor-BZWcskYe.js","assets/nsis-DbrGokpL.js","assets/pug-aQNhkzLr.js","assets/javascript-BXKxGTTj.js","assets/dist-B8Mp_VTU.js","assets/dist-Nlb4zANG.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`02b2b3ce-e929-492e-a114-774fa639d1a6`,e._sentryDebugIdIdentifier=`sentry-dbid-02b2b3ce-e929-492e-a114-774fa639d1a6`)}catch{}})();import{n as e}from"./rolldown-runtime-CgmABjMJ.js";import{$ as t,A as n,B as r,Ct as i,Dt as a,E as o,Et as s,F as c,G as l,H as u,I as d,J as f,K as p,L as m,O as h,Ot as ee,P as g,Q as te,R as ne,S as _,St as v,T as re,Tt as ie,U as ae,V as oe,W as se,X as ce,Y as le,Z as ue,_t as de,a as y,at as b,bt as x,c as fe,ct as pe,dt as S,et as me,f as he,ft as ge,g as _e,gt as ve,ht as ye,it as be,j as C,jt as xe,l as Se,lt as w,mt as Ce,n as we,nt as Te,o as Ee,ot as De,pt as T,q as Oe,rt as ke,st as Ae,t as je,tt as Me,ut as Ne,v as Pe,vt as Fe,w as Ie,wt as E,x as Le,xt as Re,yt as D,z as ze}from"./dist-IkQ96Etc.js";import{a as O}from"./app.js";import{B as k}from"./app-Bl_vjH4f.js";var Be=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=C(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),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(Ke(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function Ve(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 He(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=Ve(t)+Ve(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function Ue(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:He(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function We(e,t){return n=>{for(let t=C(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)}}var Ge=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function A(e){return e.selection.main.from}function Ke(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var qe=De.define();function Je(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:S.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var Ye=new WeakMap;function Xe(e){if(!Array.isArray(e))return e;let t=Ye.get(e);return t||Ye.set(e,t=Ue(e)),t}var Ze=D.define(),Qe=D.define(),$e=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=i(e,t),r=E(n);this.chars.push(n);let a=e.slice(t,t+r),o=a.toUpperCase();this.folded.push(i(o==a?a.toLowerCase():o,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:a,byWord:o}=this;if(t.length==1){let r=i(e,0),a=E(r),o=a==e.length?0:-100;if(r!=t[0]){if(r==n[0])o+=-200;else return null}return this.ret(o,[0,a])}let s=e.indexOf(this.pattern);if(s==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=t.length,l=0;if(s<0){for(let a=0,o=Math.min(e.length,200);a<o&&l<c;){let o=i(e,a);(o==t[l]||o==n[l])&&(r[l++]=a),a+=E(o)}if(l<c)return null}let u=0,d=0,f=!1,p=0,m=-1,h=-1,g=/[a-z]/.test(e),te=!0;for(let r=0,l=Math.min(e.length,200),ne=0;r<l&&d<c;){let l=i(e,r);s<0&&(u<c&&l==t[u]&&(a[u++]=r),p<c&&(l==t[p]||l==n[p]?(p==0&&(m=r),h=r+1,p++):p=0));let _,v=l<255?l>=48&&l<=57||l>=97&&l<=122?2:+(l>=65&&l<=90):(_=ee(l))==_.toLowerCase()?_==_.toUpperCase()?0:2:1;(!r||v==1&&g||ne==0&&v!=0)&&(t[d]==l||n[d]==l&&(f=!0)?o[d++]=r:o.length&&(te=!1)),ne=v,r+=E(l)}return d==c&&o[0]==0&&te?this.result(-100+(f?-200:0),o,e):p==c&&m==0?this.ret(-200-e.length+(h==e.length?0:-100),[0,h]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):p==c?this.ret(-900-e.length,[m,h]):d==c?this.result(-100+(f?-200:0)+-700+(te?0:-1100),o,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],a=0;for(let e of t){let t=e+(this.astral?E(i(n,e)):1);a&&r[a-1]==e?r[a-1]=t:(r[a++]=e,r[a++]=t)}return this.ret(e-n.length,r)}},et=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},j=T.define({combine(e){return ie(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:nt,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>tt(e(n),t(n)),optionClass:(e,t)=>n=>tt(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function tt(e,t){return e?t?e+` `+t:e:t}function nt(e,t,n,r,i,a){let o=e.textDirection==d.RTL,s=o,c=!1,l=`top`,u,f,p=t.left-i.left,m=i.right-t.right,h=r.right-r.left,ee=r.bottom-r.top;if(s&&p<Math.min(h,m)?s=!1:!s&&m<Math.min(h,p)&&(s=!0),h<=(s?p:m))u=Math.max(i.top,Math.min(n.top,i.bottom-ee))-t.top,f=Math.min(400,s?p:m);else{c=!0,f=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=ee||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,te=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${f/te}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var rt=D.define();function it(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,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function at(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 r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var ot=class{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 r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(j);this.optionContent=it(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=at(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:rt.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(j).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:Qe.of(null)})}),this.showOptions(i,r.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){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;n.open&&n.open.options==r||(this.range=at(r.length,i,e.state.facet(j).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}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),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=at(n.options.length,n.selected,this.view.state.facet(j).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:i}=n.options[n.selected],{info:a}=i;if(!a)return;let o=typeof a==`string`?document.createTextNode(a):a(i);if(!o)return;`then`in o?o.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,i)}).catch(e=>t(this.view.state,e,`completion info`)):(this.addInfoPane(o,i),r.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&ct(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(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(j).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0)){if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function st(e,t){return n=>new ot(n,e,t)}function ct(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function lt(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function ut(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(j);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new Ge(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new et(n):new $e(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new Ge(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):lt(e.completion)>lt(c)&&(s[s.length-1]=e),c=e.completion}return s}var dt=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,gt(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=ut(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(j).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,gt(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:Ct,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},ft=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(_t,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(j),i=(r.override||n.languageDataAt(`autocomplete`,A(n)).map(Xe)).map(e=>(this.active.find(t=>t.source==e)||new M(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(xt));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!pt(i,this.active)||o?a=dt.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new M(e.source,0):e));for(let e of t.effects)e.is(rt)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?mt:ht}};function pt(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var mt={"aria-autocomplete":`list`},ht={};function gt(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var _t=[];function vt(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(qe);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var M=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=vt(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(Ze))i=new e(i.source,1,n.value);else if(n.is(Qe))i=new e(i.source,0);else if(n.is(xt))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(A(e.state))}},yt=class e extends M{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=A(t.state);if(o>a||!r||n&2&&(A(t.startState)==this.from||o<this.limit))return new M(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return bt(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new Be(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??A(t.state)):new M(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new M(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function bt(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):Ke(e,!0).test(i)}var xt=D.define({map(e,t){return e.map(e=>e.map(t))}}),N=x.define({create(){return ft.start()},update(e,t){return e.update(t)},provide:e=>[be.from(e,e=>e.tooltip),m.contentAttributes.from(e,e=>e.attrs)]});function St(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(N).active.find(e=>e.source==t.source);return r instanceof yt&&(typeof n==`string`?e.dispatch({...Je(e.state,n,r.from,r.to),annotations:qe.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var Ct=st(N,St);function wt(e,t=`option`){return n=>{let r=n.state.field(N,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(j).interactionDelay)return!1;let i=1,a;t==`page`&&(a=p(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector(`li`).offsetHeight)-1));let{length:o}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t==`page`?0:o-1:s>=o&&(s=t==`page`?o-1:0),n.dispatch({effects:rt.of(s)}),!0}}var Tt=e=>{let t=e.state.field(N,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(j).interactionDelay?!1:St(e,t.open.options[t.open.selected])},Et=e=>e.state.field(N,!1)?(e.dispatch({effects:Ze.of(!0)}),!0):!1,Dt=e=>{let t=e.state.field(N,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:Qe.of(null)}),!0)},Ot=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},kt=50,At=1e3,jt=ne.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(N).active)t.isPending&&this.startQuery(t)}update(e){let n=e.state.field(N),r=e.state.facet(j);if(!e.selectionSet&&!e.docChanged&&e.startState.field(N)==n)return;let i=e.transactions.some(e=>{let t=vt(e,r);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let n=0;n<this.running.length;n++){let r=this.running[n];if(i||r.context.abortOnDocChange&&e.docChanged||r.updates.length+e.transactions.length>kt&&Date.now()-r.time>At){for(let e of r.context.abortListeners)try{e()}catch(e){t(this.view.state,e)}r.context.abortListeners=null,this.running.splice(n--,1)}else r.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(Ze)))&&(this.pendingStart=!0);let a=this.pendingStart?50:r.activateOnTypingDelay;if(this.debounceUpdate=n.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),a):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(N);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(j).updateSyncTime))}startQuery(e){let{state:n}=this.view,r=new Be(n,A(n),e.explicit,this.view),i=new Ot(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:Qe.of(null)}),t(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(j).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(j),n=this.view.state.field(N);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=A(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new yt(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending){if(i.done==null){let n=new M(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:xt.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(N,!1);if(t&&t.tooltip&&this.view.state.facet(j).closeOnBlur){let n=t.open&&p(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:Qe.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ze.of(!1)}),20),this.composing=0}}}),Mt=typeof navigator==`object`&&/Win/.test(navigator.platform),Nt=ye.highest(m.domEventHandlers({keydown(e,t){let n=t.state.field(N,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||!e.key||e.key.length>1||e.ctrlKey&&!(Mt&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&St(t,r),!1}})),Pt=m.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`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),Ft=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},It=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,Ce.TrackDel),r=t.mapPos(this.to,1,Ce.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},Lt=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,s=/^\t*/.exec(i)[0].length;for(let t=0;t<s;t++)n+=e.facet(o);r.push(t+n.length-s),i=n+i.slice(s)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new It(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new Ft(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},Rt=c.widget({widget:new class extends ze{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),zt=c.mark({class:`cm-snippetField`}),Bt=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=c.set(e.map(e=>(e.from==e.to?Rt:zt).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},Vt=D.define({map(e,t){return e&&e.map(t)}}),Ht=D.define(),Ut=x.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(Vt))return n.value;if(n.is(Ht)&&e)return new Bt(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>m.decorations.from(e,e=>e?e.deco:c.none)});function Wt(e,t){return S.create(e.filter(e=>e.field==t).map(e=>S.range(e.from,e.to)))}function Gt(e){let t=Lt.parse(e);return(e,n,r,i)=>{let{text:a,ranges:o}=t.instantiate(e.state,r),{main:s}=e.state.selection,c={changes:{from:r,to:i==s.from?s.to:i,insert:Re.of(a)},scrollIntoView:!0,annotations:n?[qe.of(n),v.userEvent.of(`input.complete`)]:void 0};if(o.length&&(c.selection=Wt(o,0)),o.some(e=>e.field>0)){let t=new Bt(o,0),n=c.effects=[Vt.of(t)];e.state.field(Ut,!1)===void 0&&n.push(D.appendConfig.of([Ut,Yt,Zt,Pt]))}e.dispatch(e.state.update(c))}}function Kt(e){return({state:t,dispatch:n})=>{let r=t.field(Ut,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:Wt(r.ranges,i),effects:Vt.of(a?null:new Bt(r.ranges,i)),scrollIntoView:!0})),!0}}var qt=[{key:`Tab`,run:Kt(1),shift:Kt(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(Ut,!1)?(t(e.update({effects:Vt.of(null)})),!0):!1}],Jt=T.define({combine(e){return e.length?e[0]:qt}}),Yt=ye.highest(ue.compute([Jt],e=>e.facet(Jt)));function Xt(e,t){return{...t,apply:Gt(e)}}var Zt=m.domEventHandlers({mousedown(e,t){let n=t.state.field(Ut,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:Wt(n.ranges,i.field),effects:Vt.of(n.ranges.some(e=>e.field>i.field)?new Bt(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),Qt={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},P=D.define({map(e,t){return t.mapPos(e,-1,Ce.TrackAfter)??void 0}}),$t=new class extends Fe{};$t.startSide=1,$t.endSide=-1;var en=x.define({create(){return ve.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(P)&&(e=e.update({add:[$t.range(n.value,n.value+1)]}));return e}});function tn(){return[sn,en]}var nn=`()[]{}<>«»»«[]{}`;function rn(e){for(let t=0;t<16;t+=2)if(nn.charCodeAt(t)==e)return nn.charAt(t+1);return ee(e<128?e:e+1)}function an(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||Qt}var on=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),sn=m.inputHandler.of((e,t,n,r)=>{if((on?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let a=e.state.selection.main;if(r.length>2||r.length==2&&E(i(r,0))==1||t!=a.from||n!=a.to)return!1;let o=ln(e.state,r);return o?(e.dispatch(o),!0):!1}),cn=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=an(e,e.selection.main.head).brackets||Qt.brackets,r=null,a=e.changeByRange(t=>{if(t.empty){let r=fn(e.doc,t.head);for(let a of n)if(a==r&&dn(e.doc,t.head)==rn(i(a,0)))return{changes:{from:t.head-a.length,to:t.head+a.length},range:S.cursor(t.head-a.length)}}return{range:r=t}});return r||t(e.update(a,{scrollIntoView:!0,userEvent:`delete.backward`})),!r}}];function ln(e,t){let n=an(e,e.selection.main.head),r=n.brackets||Qt.brackets;for(let a of r){let o=rn(i(a,0));if(t==a)return o==a?hn(e,a,r.indexOf(a+a+a)>-1,n):pn(e,a,o,n.before||Qt.before);if(t==o&&un(e,e.selection.main.from))return mn(e,a,o)}return null}function un(e,t){let n=!1;return e.field(en).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function dn(e,t){let n=e.sliceString(t,t+2);return n.slice(0,E(i(n,0)))}function fn(e,t){let n=e.sliceString(t-2,t);return E(i(n,0))==n.length?n:n.slice(1)}function pn(e,t,n,r){let i=null,a=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:P.of(a.to+t.length),range:S.range(a.anchor+t.length,a.head+t.length)};let o=dn(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:P.of(a.head+t.length),range:S.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function mn(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&dn(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:S.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function hn(e,t,n,r){let i=r.stringPrefixes||Qt.stringPrefixes,a=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:P.of(r.to+t.length),range:S.range(r.anchor+t.length,r.head+t.length)};let o=r.head,s=dn(e.doc,o),c;if(s==t){if(gn(e,o))return{changes:{insert:t+t,from:o},effects:P.of(o+t.length),range:S.cursor(o+t.length)};if(un(e,o)){let r=n&&e.sliceDoc(o,o+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:o,to:o+r.length,insert:r},range:S.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(c=vn(e,o-2*t.length,i))>-1&&gn(e,c))return{changes:{insert:t+t+t+t,from:o},effects:P.of(o+t.length),range:S.cursor(o+t.length)};else if(e.charCategorizer(o)(s)!=w.Word&&vn(e,o,i)>-1&&!_n(e,o,t,i))return{changes:{insert:t+t,from:o},effects:P.of(o+t.length),range:S.cursor(o+t.length)};return{range:a=r}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function gn(e,t){let n=C(e).resolveInner(t+1);return n.parent&&n.from==t}function _n(e,t,n,r){let i=C(e).resolveInner(t,-1),a=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+a)),s=o.indexOf(n);if(!s||s>-1&&r.indexOf(o.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function vn(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=w.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))!=w.Word)return n}return-1}function yn(e={}){return[Nt,N,j.of(e),jt,xn,Pt]}var bn=[{key:`Ctrl-Space`,run:Et},{mac:"Alt-`",run:Et},{mac:`Alt-i`,run:Et},{key:`Escape`,run:Dt},{key:`ArrowDown`,run:wt(!0)},{key:`ArrowUp`,run:wt(!1)},{key:`PageDown`,run:wt(!0,`page`)},{key:`PageUp`,run:wt(!1,`page`)},{key:`Enter`,run:Tt}],xn=ye.highest(ue.computeN([j],e=>e.facet(j).defaultKeymap?[bn]:[])),Sn=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Dn(e.state,n.from);return r.line?wn(e):r.block?En(e):!1};function Cn(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var wn=Cn(Mn,0),Tn=Cn(jn,0),En=Cn((e,t)=>jn(e,t,An(t)),0);function Dn(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var On=50;function kn(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-On,r),o=e.sliceDoc(i,i+On),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+On),d=e.sliceDoc(i-On,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function An(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function jn(e,t,n=t.selection.ranges){let r=n.map(e=>Dn(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>kn(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function Mn(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=Dn(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var Nn=De.define(),Pn=De.define(),Fn=T.define(),In=T.define({combine(e){return ie(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),Ln=x.define({create(){return er.empty},update(e,t){let n=t.state.facet(In),r=t.annotation(Nn);if(r){let i=F.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?Wn(o,o.length,n.minDepth,i):Yn(o,t.startState.selection),new er(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(Pn);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(v.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=F.fromTransaction(t),o=t.annotation(v.time),s=t.annotation(v.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(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 er(e.done.map(F.fromJSON),e.undone.map(F.fromJSON))}});function Rn(e={}){return[Ln,In.of(e),m.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?Bn:e.inputType==`historyRedo`?Vn:null;return n?(e.preventDefault(),n(t)):!1}})]}function zn(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Ln,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var Bn=zn(0,!1),Vn=zn(1,!1),Hn=zn(0,!0),Un=zn(1,!0),F=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&pe.fromJSON(t.changes),[],t.mapped&&Ae.fromJSON(t.mapped),t.startSelection&&S.fromJSON(t.startSelection),t.selectionsAfter.map(S.fromJSON))}static fromTransaction(t,n){let r=I;for(let e of t.startState.facet(Fn)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,I)}static selection(t){return new e(void 0,I,void 0,void 0,t)}};function Wn(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function Gn(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function Kn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function qn(e,t){return e.length?t.length?e.concat(t):e:t}var I=[],Jn=200;function Yn(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Jn));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Wn(e,e.length-1,1e9,n.setSelAfter(r)))}return[F.selection([t])]}function Xn(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 Zn(e,t){if(!e.length)return e;let n=e.length,r=I;for(;n;){let i=Qn(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[F.selection(r)]:I}function Qn(e,t,n){let r=qn(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):I,n);if(!e.changes)return F.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new F(i,D.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var $n=/^(input\.type|delete)($|\.)/,er=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||$n.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,Gn(s.changes,t.changes))||r==`input.type.compose`)?Wn(o,o.length-1,i.minDepth,new F(t.changes.compose(s.changes),qn(D.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,I)):Wn(o,o.length,i.minDepth,t),new e(o,I,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:I;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Kn(a[a.length-1],t)?this:new e(Yn(this.done,t),this.undone,n,r)}addMapping(t){return new e(Zn(this.done,t),Zn(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Nn.of({side:e,rest:Xn(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?I:r.slice(0,r.length-1);return i.mapped&&(n=Zn(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Nn.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};er.empty=new er(I,I);var tr=[{key:`Mod-z`,run:Bn,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:Vn,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:Vn,preventDefault:!0},{key:`Mod-u`,run:Hn,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Un,preventDefault:!0}];function L(e,t){return S.create(e.ranges.map(t),e.mainIndex)}function R(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function z({state:e,dispatch:t},n){let r=L(e.selection,n);return!r.eq(e.selection,!0)&&(t(R(e,r)),!0)}function nr(e,t){return S.cursor(t?e.to:e.from)}function rr(e,t){return z(e,n=>n.empty?e.moveByChar(n,t):nr(n,t))}function B(e){return e.textDirectionAt(e.state.selection.main.head)==d.LTR}var ir=e=>rr(e,!B(e)),ar=e=>rr(e,B(e));function or(e,t){return z(e,n=>n.empty?e.moveByGroup(n,t):nr(n,t))}var sr=e=>or(e,!B(e)),cr=e=>or(e,B(e));typeof Intl<`u`&&Intl.Segmenter;function lr(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function ur(e,t,n){let r=C(e).resolveInner(t.head),i=n?xe.closedBy:xe.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;lr(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?h(e,r.from,1):h(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,S.cursor(s,n?-1:1)}var dr=e=>z(e,t=>ur(e.state,t,!B(e))),fr=e=>z(e,t=>ur(e.state,t,B(e)));function pr(e,t){return z(e,n=>{if(!n.empty)return nr(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var mr=e=>pr(e,!1),hr=e=>pr(e,!0);function gr(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(m.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function _r(e,t){let n=gr(e),{state:r}=e,i=L(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):nr(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=m.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(R(r,i),{effects:a}),!0}var vr=e=>_r(e,!1),yr=e=>_r(e,!0);function V(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=S.cursor(r.from+n))}return i}var br=e=>z(e,t=>V(e,t,!0)),xr=e=>z(e,t=>V(e,t,!1)),Sr=e=>z(e,t=>V(e,t,!B(e))),Cr=e=>z(e,t=>V(e,t,B(e))),wr=e=>z(e,t=>e.moveToLineBoundary(t,!1,!1)),Tr=e=>z(e,t=>e.moveToLineBoundary(t,!0,!1));function Er(e,t,n){let r=!1,i=L(e.selection,t=>{let i=h(e,t.head,-1)||h(e,t.head,1)||t.head>0&&h(e,t.head-1,1)||t.head<e.doc.length&&h(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?S.range(t.anchor,a):S.cursor(a)});return r?(t(R(e,i)),!0):!1}var Dr=({state:e,dispatch:t})=>Er(e,t,!1);function H(e,t,n){let r=L(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=S.range(e.head,e.anchor));let r=n(e);return S.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(R(e.state,r)),!0)}function Or(e,t){return H(e,t,n=>e.moveByChar(n,t))}var kr=e=>Or(e,!B(e)),Ar=e=>Or(e,B(e));function jr(e,t){return H(e,t,n=>e.moveByGroup(n,t))}var Mr=e=>jr(e,!B(e)),Nr=e=>jr(e,B(e)),Pr=e=>{let t=!B(e);return H(e,t,n=>ur(e.state,n,t))},Fr=e=>{let t=B(e);return H(e,t,n=>ur(e.state,n,t))};function Ir(e,t){return H(e,t,n=>e.moveVertically(n,t))}var Lr=e=>Ir(e,!1),Rr=e=>Ir(e,!0);function zr(e,t){return H(e,t,n=>e.moveVertically(n,t,gr(e).height))}var Br=e=>zr(e,!1),Vr=e=>zr(e,!0),Hr=e=>H(e,!0,t=>V(e,t,!0)),Ur=e=>H(e,!1,t=>V(e,t,!1)),Wr=e=>{let t=!B(e);return H(e,t,n=>V(e,n,t))},Gr=e=>{let t=B(e);return H(e,t,n=>V(e,n,t))},Kr=e=>H(e,!1,t=>S.cursor(e.lineBlockAt(t.head).from)),qr=e=>H(e,!0,t=>S.cursor(e.lineBlockAt(t.head).to)),Jr=({state:e,dispatch:t})=>(t(R(e,{anchor:0})),!0),Yr=({state:e,dispatch:t})=>(t(R(e,{anchor:e.doc.length})),!0),Xr=({state:e,dispatch:t})=>(t(R(e,{anchor:e.selection.main.anchor,head:0})),!0),Zr=({state:e,dispatch:t})=>(t(R(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Qr=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),$r=({state:e,dispatch:t})=>{let n=vi(e).map(({from:t,to:n})=>S.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:S.create(n),userEvent:`select`})),!0},ei=({state:e,dispatch:t})=>{let n=L(e.selection,t=>{let n=C(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return S.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(R(e,n)),!0)};function ti(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(R(n,S.create(i,i.length-1))),!0)}var ni=e=>ti(e,!1),ri=e=>ti(e,!0),ii=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=S.create([n.main]):n.main.empty||(r=S.create([S.cursor(n.main.head)])),r?(t(R(e,r)),!0):!1};function ai(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=oi(e,o,!1)):o>i&&(n=`delete.forward`,o=oi(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=oi(e,i,!1),a=oi(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:S.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?m.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function oi(e,t,n){if(e instanceof m)for(let r of e.state.facet(m.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var si=(e,t,n)=>ai(e,r=>{let i=r.from,{state:o}=e,c=o.doc.lineAt(i),l,u;if(n&&!t&&i>c.from&&i<c.from+200&&!/[^ \t]/.test(l=c.text.slice(0,i-c.from))){if(l[l.length-1]==` `)return i-1;let e=s(l,o.tabSize)%Le(o)||Le(o);for(let t=0;t<e&&l[l.length-1-t]==` `;t++)i--;u=i}else u=a(c.text,i-c.from,t,t)+c.from,u==i&&c.number!=(t?o.doc.lines:1)?u+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(c.text.slice(u-c.from,i-c.from))&&(u=a(c.text,u-c.from,!1,!1)+c.from);return u}),ci=e=>si(e,!1,!0),li=e=>si(e,!0,!1),ui=(e,t)=>ai(e,n=>{let r=n.head,{state:i}=e,o=i.doc.lineAt(r),s=i.charCategorizer(r);for(let e=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let c=a(o.text,r-o.from,t)+o.from,l=o.text.slice(Math.min(r,c)-o.from,Math.max(r,c)-o.from),u=s(l);if(e!=null&&u!=e)break;(l!=` `||r!=n.head)&&(e=u),r=c}return r}),di=e=>ui(e,!1),fi=e=>ui(e,!0),pi=e=>ai(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),mi=e=>ai(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),hi=e=>ai(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),gi=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:Re.of([``,``])},range:S.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},_i=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:a(r.text,n-r.from,!1)+r.from,o=n==r.to?n+1:a(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(i,n))},range:S.cursor(o)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function vi(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function yi(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of vi(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(S.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(S.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:S.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var bi=({state:e,dispatch:t})=>yi(e,t,!1),xi=({state:e,dispatch:t})=>yi(e,t,!0);function Si(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of vi(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var Ci=({state:e,dispatch:t})=>Si(e,t,!1),wi=({state:e,dispatch:t})=>Si(e,t,!0),Ti=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(vi(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=L(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function Ei(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=C(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(xe.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var Di=ki(!1),Oi=ki(!0);function ki(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&Ei(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let c=new we(t,{simulateBreak:r,simulateDoubleBreak:!!o}),l=_(c,r);for(l??=s(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let u=[``,re(t,l)];return o&&u.push(re(t,c.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:Re.of(u)},range:S.cursor(r+1+u[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function Ai(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:S.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var ji=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new we(e,{overrideIndentation:e=>n[e]??-1}),i=Ai(e,(t,i,a)=>{let o=_(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=re(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},Mi=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Ai(e,(t,n)=>{n.push({from:t.from,insert:e.facet(o)})}),{userEvent:`input.indent`})),!0),Ni=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Ai(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=s(r,e.tabSize),a=0,o=re(e,Math.max(0,i-Le(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),Pi=e=>(e.setTabFocusMode(),!0),Fi=[{key:`Ctrl-b`,run:ir,shift:kr,preventDefault:!0},{key:`Ctrl-f`,run:ar,shift:Ar},{key:`Ctrl-p`,run:mr,shift:Lr},{key:`Ctrl-n`,run:hr,shift:Rr},{key:`Ctrl-a`,run:wr,shift:Kr},{key:`Ctrl-e`,run:Tr,shift:qr},{key:`Ctrl-d`,run:li},{key:`Ctrl-h`,run:ci},{key:`Ctrl-k`,run:pi},{key:`Ctrl-Alt-h`,run:di},{key:`Ctrl-o`,run:gi},{key:`Ctrl-t`,run:_i},{key:`Ctrl-v`,run:yr}],Ii=[{key:`ArrowLeft`,run:ir,shift:kr,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:sr,shift:Mr,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:Sr,shift:Wr,preventDefault:!0},{key:`ArrowRight`,run:ar,shift:Ar,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:cr,shift:Nr,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Cr,shift:Gr,preventDefault:!0},{key:`ArrowUp`,run:mr,shift:Lr,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Jr,shift:Xr},{mac:`Ctrl-ArrowUp`,run:vr,shift:Br},{key:`ArrowDown`,run:hr,shift:Rr,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Yr,shift:Zr},{mac:`Ctrl-ArrowDown`,run:yr,shift:Vr},{key:`PageUp`,run:vr,shift:Br},{key:`PageDown`,run:yr,shift:Vr},{key:`Home`,run:xr,shift:Ur,preventDefault:!0},{key:`Mod-Home`,run:Jr,shift:Xr},{key:`End`,run:br,shift:Hr,preventDefault:!0},{key:`Mod-End`,run:Yr,shift:Zr},{key:`Enter`,run:Di,shift:Di},{key:`Mod-a`,run:Qr},{key:`Backspace`,run:ci,shift:ci,preventDefault:!0},{key:`Delete`,run:li,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:di,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:fi,preventDefault:!0},{mac:`Mod-Backspace`,run:mi,preventDefault:!0},{mac:`Mod-Delete`,run:hi,preventDefault:!0}].concat(Fi.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Li=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:dr,shift:Pr},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:fr,shift:Fr},{key:`Alt-ArrowUp`,run:bi},{key:`Shift-Alt-ArrowUp`,run:Ci},{key:`Alt-ArrowDown`,run:xi},{key:`Shift-Alt-ArrowDown`,run:wi},{key:`Mod-Alt-ArrowUp`,run:ni},{key:`Mod-Alt-ArrowDown`,run:ri},{key:`Escape`,run:ii},{key:`Mod-Enter`,run:Oi},{key:`Alt-l`,mac:`Ctrl-l`,run:$r},{key:`Mod-i`,run:ei,preventDefault:!0},{key:`Mod-[`,run:Ni},{key:`Mod-]`,run:Mi},{key:`Mod-Alt-\\`,run:ji},{key:`Shift-Mod-k`,run:Ti},{key:`Shift-Mod-\\`,run:Dr},{key:`Mod-/`,run:Sn},{key:`Alt-A`,mac:`Ctrl-A`,run:Tn},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Pi}].concat(Ii),Ri={key:`Tab`,run:Mi,shift:Ni},zi=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,U=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(zi(e)):zi,this.query=this.normalize(t)}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 i(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=ee(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=E(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(U.prototype[Symbol.iterator]=function(){return this});var Bi={from:-1,to:-1,match:/.*/.exec(``),precise:!0},Vi=`gm`+(/x/.unicode==null?``:`u`),Hi=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=Bi,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Gi(e,t,n,r,i);this.re=new RegExp(t,Vi+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=qi(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),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 e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=qi(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},Ui=new WeakMap,Wi=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=Ui.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Ui.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),Ui.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Gi=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Bi,this.matchPos=qi(e,r),this.re=new RegExp(t,Vi+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Wi.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=qi(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Wi.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Hi.prototype[Symbol.iterator]=Gi.prototype[Symbol.iterator]=function(){return this});function Ki(e){try{return new RegExp(e,Vi),!0}catch{return!1}}function qi(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var Ji=e=>{let t=se(e,`cm-goto-line`);if(t){let e=t.dom.querySelector(`input[type=text]`);return e&&e.select(),!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:a}=Te(e,{class:`cm-goto-line`,label:n.phrase(`Go to line`),input:{type:`text`,name:`line`,value:r},focus:!0,submitLabel:n.phrase(`go`)});return a.then(t=>{let r=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!r){e.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,o,s,c,l]=r,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/n.doc.lines),d=Math.round(n.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=n.doc.line(Math.max(1,Math.min(n.doc.lines,d))),p=S.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[i,m.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},Yi={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Xi=T.define({combine(e){return ie(e,Yi,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Zi(e){let t=[ra,na];return e&&t.push(Xi.of(e)),t}var Qi=c.mark({class:`cm-selectionMatch`}),$i=c.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function ea(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=w.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=w.Word)}function ta(e,t,n,r){return e(t.sliceDoc(n,n+1))==w.Word&&e(t.sliceDoc(r-1,r))==w.Word}var na=ne.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Xi),{state:n}=e,r=n.selection;if(r.ranges.length>1)return c.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return c.none;let e=n.wordAt(i.head);if(!e)return c.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return c.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(ea(o,n,i.from,i.to)&&ta(o,n,i.from,i.to)))return c.none}else if(a=n.sliceDoc(i.from,i.to),!a)return c.none}let s=[];for(let r of e.visibleRanges){let e=new U(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||ea(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push($i.range(r,a)):(r>=i.to||a<=i.from)&&s.push(Qi.range(r,a)),s.length>t.maxMatches))return c.none}}return c.set(s)}},{decorations:e=>e.decorations}),ra=m.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),ia=({state:e,dispatch:t})=>{let{selection:n}=e,r=S.create(n.ranges.map(t=>e.wordAt(t.head)||S.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function aa(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new U(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new U(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var oa=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return ia({state:e,dispatch:t});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 i=aa(e,r);return i?(t(e.update({selection:e.selection.addRange(S.range(i.from,i.to),!1),effects:m.scrollIntoView(i.to)})),!0):!1},W=T.define({combine(e){return ie(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ra(e),scrollToMatch:e=>m.scrollIntoView(e)})}});function sa(e){return e?[W.of(e),Ua]:Ua}var ca=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||Ki(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
3
|
+
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new _a(this):new fa(this)}getCursor(e,t=0,n){let r=e.doc?e:ge.create({doc:e});return n??=r.doc.length,this.regexp?K(this,r,t,n):G(this,r,t,n)}},la=class{constructor(e){this.spec=e}};function ua(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function G(e,t,n,r){let i;return e.wholeWord&&(i=da(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=ua(e.test,t,i)),new U(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function da(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(ma(i,n-a))!=w.Word||t(ha(i,n-a))!=w.Word)&&(t(ha(i,r-a))!=w.Word||t(ma(i,r-a))!=w.Word))}var fa=class extends la{constructor(e){super(e)}nextMatch(e,t,n){let r=G(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=G(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=G(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=G(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=G(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function pa(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function K(e,t,n,r){let i;return e.wholeWord&&(i=ga(t.charCategorizer(t.selection.main.head))),e.test&&(i=pa(e.test,t,i)),new Hi(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function ma(e,t){return e.slice(a(e,t,!1),t)}function ha(e,t){return e.slice(t,a(e,t))}function ga(e){return(t,n,r)=>!r[0].length||(e(ma(r.input,r.index))!=w.Word||e(ha(r.input,r.index))!=w.Word)&&(e(ha(r.input,r.index+r[0].length))!=w.Word||e(ma(r.input,r.index+r[0].length))!=w.Word)}var _a=class extends la{nextMatch(e,t,n){let r=K(this.spec,e,n,e.doc.length).next();return r.done&&(r=K(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=K(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=K(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=K(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},q=D.define(),va=D.define(),J=x.define({create(e){return new ba(Ma(e).create(),null)},update(e,t){for(let n of t.effects)n.is(q)?e=new ba(n.value.create(),e.panel):n.is(va)&&(e=new ba(e.query,n.value?ja:null));return e},provide:e=>ke.from(e,e=>e.panel)});function ya(e){let t=e.field(J,!1);return t?t.query.spec:Ma(e)}var ba=class{constructor(e,t){this.query=e,this.panel=t}},xa=c.mark({class:`cm-searchMatch`}),Sa=c.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Ca=ne.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(J))}update(e){let t=e.state.field(J);(t!=e.startState.field(J)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return c.none;let{view:n}=this,r=new de;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Sa:xa)})}return r.finish()}},{decorations:e=>e.decorations});function wa(e){return t=>{let n=t.state.field(J,!1);return n&&n.query.spec.valid?e(t,n):Fa(t)}}var Ta=wa((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=S.single(r.from,r.to),a=e.state.facet(W);return e.dispatch({selection:i,effects:[Va(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Pa(e),!0}),Ea=wa((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=S.single(i.from,i.to),o=e.state.facet(W);return e.dispatch({selection:a,effects:[Va(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Pa(e),!0}),Da=wa((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:S.create(n.map(e=>S.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Oa=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new U(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(S.range(t.value.from,t.value.to))}return t(e.update({selection:S.create(a,o),userEvent:`select.search.matches`})),!0},ka=wa((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.precise?o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(m.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let d=e.state.changes(s);return o&&(c=S.single(o.from,o.to).map(d),u.push(Va(e,o)),u.push(n.facet(W).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),Aa=wa((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:m.announce.of(r),userEvent:`input.replace.all`}),!0});function ja(e){return e.state.facet(W).createPanel(e)}function Ma(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(W);return new ca({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function Na(e){let t=l(e,ja);return t&&t.dom.querySelector(`[main-field]`)}function Pa(e){let t=Na(e);t&&t==e.root.activeElement&&t.select()}var Fa=e=>{let t=e.state.field(J,!1);if(t&&t.panel){let n=Na(e);if(n&&n!=e.root.activeElement){let r=Ma(e.state,t.query.spec);r.valid&&e.dispatch({effects:q.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[va.of(!0),t?q.of(Ma(e.state,t.query.spec)):D.appendConfig.of(Ua)]});return!0},Ia=e=>{let t=e.state.field(J,!1);if(!t||!t.panel)return!1;let n=l(e,ja);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:va.of(!1)}),!0},La=[{key:`Mod-f`,run:Fa,scope:`editor search-panel`},{key:`F3`,run:Ta,shift:Ea,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:Ta,shift:Ea,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Ia,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Oa},{key:`Mod-Alt-g`,run:Ji},{key:`Mod-d`,run:oa,preventDefault:!0}],Ra=class{constructor(e){this.view=e;let t=this.query=e.state.field(J).query.spec;this.commit=this.commit.bind(this),this.searchField=b(`input`,{value:t.search,placeholder:Y(e,`Find`),"aria-label":Y(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=b(`input`,{value:t.replace,placeholder:Y(e,`Replace`),"aria-label":Y(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=b(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=b(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=b(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return b(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=b(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>Ta(e),[Y(e,`next`)]),n(`prev`,()=>Ea(e),[Y(e,`previous`)]),n(`select`,()=>Da(e),[Y(e,`all`)]),b(`label`,null,[this.caseField,Y(e,`match case`)]),b(`label`,null,[this.reField,Y(e,`regexp`)]),b(`label`,null,[this.wordField,Y(e,`by word`)]),...e.state.readOnly?[]:[b(`br`),this.replaceField,n(`replace`,()=>ka(e),[Y(e,`replace`)]),n(`replaceAll`,()=>Aa(e),[Y(e,`replace all`)])],b(`button`,{name:`close`,onclick:()=>Ia(e),"aria-label":Y(e,`close`),type:`button`},[`×`])])}commit(){let e=new ca({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:q.of(e)}))}keydown(e){Me(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ea:Ta)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),ka(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(q)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(W).top}};function Y(e,t){return e.state.phrase(t)}var za=30,Ba=/[\s\.,:;?!]/;function Va(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-za),o=Math.min(i,n+za),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<za;e++)if(!Ba.test(s[e+1])&&Ba.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-za;e--)if(!Ba.test(s[e-1])&&Ba.test(s[e])){s=s.slice(0,e);break}}return m.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Ha=m.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`}}),Ua=[J,ye.low(Ca),Ha],Wa=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},Ga=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(ro).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new de,s=[],l=0,u=r.doc.iter(),d=0,f=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=l,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>f)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,f);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==f))&&(i=n==r,!i&&r-n<10)){let e=n-(d+u.value.length);e>0&&(u.next(e),d=n);for(let e=n;;){if(e>=r){i=!0;break}if(!u.lineBreak&&d+u.value.length>e)break;e=d+u.value.length,d+=u.value.length,u.next()}}let p=ho(s);if(i)o.add(n,n,c.widget({widget:new so(p),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,c.mark({class:`cm-lintRange cm-lintRange-`+p+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(l=r,l==f)break;for(let e=0;e<s.length;e++)s[e].to<=l&&s.splice(e--,1)}let p=o.finish();return new e(p,n,X(p))}};function X(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0)){if(!r)r=new Wa(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new Wa(r.from,n,r.diagnostic)}}),r}function Ka(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(ro).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(Ja))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function qa(e,t){return e.field(Z,!1)?t:t.concat(D.appendConfig.of(_o))}var Ja=D.define(),Ya=D.define(),Xa=D.define(),Z=x.define({create(){return new Ga(c.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=X(n,e.selected.diagnostic,i)||X(n,null,i)}!n.size&&i&&t.state.facet(ro).autoPanel&&(i=null),e=new Ga(n,i,r)}for(let n of t.effects)if(n.is(Ja)){let r=t.state.facet(ro).autoPanel?n.value.length?lo.open:null:e.panel;e=Ga.init(n.value,r,t.state)}else n.is(Ya)?e=new Ga(e.diagnostics,n.value?lo.open:null,e.selected):n.is(Xa)&&(e=new Ga(e.diagnostics,e.panel,n.value));return e},provide:e=>[ke.from(e,e=>e.panel),m.decorations.from(e,e=>e.diagnostics)]}),Za=c.mark({class:`cm-lintRange cm-lintRange-active`});function Qa(e,t,n){let{diagnostics:r}=e.state.field(Z),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(ro).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:!0,create(){return{dom:$a(e,i)}}}:null}function $a(e,t){return b(`ul`,{class:`cm-tooltip-lint`},t.map(t=>oo(e,t,!1)))}var eo=e=>{let t=e.state.field(Z,!1);t&&t.panel||e.dispatch({effects:qa(e.state,[Ya.of(!0)])});let n=l(e,lo.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},to=e=>{let t=e.state.field(Z,!1);return!t||!t.panel?!1:(e.dispatch({effects:Ya.of(!1)}),!0)},no=[{key:`Mod-Shift-m`,run:eo,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(Z,!1);if(!t)return!1;let n=e.state.selection.main,i=X(t.diagnostics,null,n.to+1);return!i&&(i=X(t.diagnostics,null,0),!i||i.from==n.from&&i.to==n.to)?!1:(e.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),r(e,i.from,1,{tooltip:go,until:e=>e.docChanged||e.newSelection.main.head<i.from||e.newSelection.main.head>i.to}),!0)}}],ro=T.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...ie(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:io,tooltipFilter:io,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function io(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function ao(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function oo(e,t,n){let r=n?ao(t.actions):[];return b(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},b(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=X(e.state.field(Z).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),b(`u`,s.slice(c,c+1)),s.slice(c+1)],u=n.markClass?` `+n.markClass:``;return b(`button`,{type:`button`,class:`cm-diagnosticAction`+u,onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&b(`div`,{class:`cm-diagnosticSource`},t.source))}var so=class extends ze{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return b(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},co=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=oo(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},lo=class e{constructor(e){this.view=e,this.items=[];let t=t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)to(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=ao(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=X(this.view.state.field(Z).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=b(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t,onclick:n}),this.dom=b(`div`,{class:`cm-panel-lint`},this.list,b(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>to(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(Z).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Z),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new co(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new co(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&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=X(this.view.state.field(Z).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Xa.of(t)})}static open(t){return new e(t)}};function uo(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function fo(e){return uo(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var po=m.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:fo(`#f11`)},".cm-lintRange-warning":{backgroundImage:fo(`orange`)},".cm-lintRange-info":{backgroundImage:fo(`#999`)},".cm-lintRange-hint":{backgroundImage:fo(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function mo(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function ho(e){let t=`hint`,n=1;for(let r of e){let e=mo(r.severity);e>n&&(n=e,t=r.severity)}return t}var go=ce(Qa,{hideOn:Ka}),_o=[Z,m.decorations.compute([Z],e=>{let{selected:t,panel:n}=e.field(Z);return!t||!n||t.from==t.to?c.none:c.set([Za.range(t.from,t.to)])}),go,po],vo=[te(),f(),le(),Rn(),_e(),u(),ae(),ge.allowMultipleSelections.of(!0),Ie(),n(he,{fallback:!0}),Se(),tn(),yn(),me(),oe(),Oe(),Zi(),ue.of([...cn,...Li,...La,...tr,...Pe,...bn,...no])];function Q(e){return new Ee(fe.define(e))}function $(e){return O(()=>import(`./dist-CP5SBgQB.js`).then(t=>t.sql({dialect:t[e]})),__vite__mapDeps([0,1,2]))}var yo=[y.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return O(()=>import(`./dist-C0vYCeId.js`).then(e=>e.cpp()),__vite__mapDeps([3,2,1]))}}),y.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return O(()=>import(`./dist-C0vYCeId.js`).then(e=>e.cpp()),__vite__mapDeps([3,2,1]))}}),y.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return $(`Cassandra`)}}),y.of({name:`CSS`,extensions:[`css`],load(){return O(()=>import(`./dist-RJnNnBqa.js`).then(e=>e.i).then(e=>e.css()),__vite__mapDeps([4,5,2,1]))}}),y.of({name:`Go`,extensions:[`go`],load(){return O(()=>import(`./dist-C7kRRV1b.js`).then(e=>e.go()),__vite__mapDeps([6,2,1]))}}),y.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return O(()=>import(`./dist-CmPE8_f_.js`).then(e=>e.html()),__vite__mapDeps([7,2,1,4,5,8]))}}),y.of({name:`Java`,extensions:[`java`],load(){return O(()=>import(`./dist-Cc1Gj7tZ.js`).then(e=>e.java()),__vite__mapDeps([9,2,1]))}}),y.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return O(()=>import(`./dist-C2WSXtwq.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,5,2,1]))}}),y.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return O(()=>import(`./dist-BD_2QeWa.js`).then(e=>e.jinja()),__vite__mapDeps([10,1,7,2,4,5,8]))}}),y.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return O(()=>import(`./dist-ByVjh-LO.js`).then(e=>e.json()),__vite__mapDeps([11,2,1]))}}),y.of({name:`JSX`,extensions:[`jsx`],load(){return O(()=>import(`./dist-C2WSXtwq.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([8,5,2,1]))}}),y.of({name:`LESS`,extensions:[`less`],load(){return O(()=>import(`./dist-BZwn6_Fh.js`).then(e=>e.less()),__vite__mapDeps([12,1,4,5,2]))}}),y.of({name:`Liquid`,extensions:[`liquid`],load(){return O(()=>import(`./dist-DFTCmV51.js`).then(e=>e.liquid()),__vite__mapDeps([13,1,7,2,4,5,8]))}}),y.of({name:`MariaDB SQL`,load(){return $(`MariaSQL`)}}),y.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return O(()=>import(`./dist-CCfANS3F.js`).then(e=>e.markdown()),__vite__mapDeps([14,1,7,2,4,5,8]))}}),y.of({name:`MS SQL`,load(){return $(`MSSQL`)}}),y.of({name:`MySQL`,load(){return $(`MySQL`)}}),y.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return O(()=>import(`./dist-D-nx7RRS.js`).then(e=>e.php()),__vite__mapDeps([15,2,1,7,4,5,8]))}}),y.of({name:`PLSQL`,extensions:[`pls`],load(){return $(`PLSQL`)}}),y.of({name:`PostgreSQL`,load(){return $(`PostgreSQL`)}}),y.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return O(()=>import(`./dist-Dr0qO3Zr.js`).then(e=>e.python()),__vite__mapDeps([16,2,1]))}}),y.of({name:`Rust`,extensions:[`rs`],load(){return O(()=>import(`./dist-Cm6nrvBz.js`).then(e=>e.rust()),__vite__mapDeps([17,2,1]))}}),y.of({name:`Sass`,extensions:[`sass`],load(){return O(()=>import(`./dist-DuwjrxJ6.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([18,2,1,4,5]))}}),y.of({name:`SCSS`,extensions:[`scss`],load(){return O(()=>import(`./dist-DuwjrxJ6.js`).then(e=>e.sass()),__vite__mapDeps([18,2,1,4,5]))}}),y.of({name:`SQL`,extensions:[`sql`],load(){return $(`StandardSQL`)}}),y.of({name:`SQLite`,load(){return $(`SQLite`)}}),y.of({name:`TSX`,extensions:[`tsx`],load(){return O(()=>import(`./dist-C2WSXtwq.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([8,5,2,1]))}}),y.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return O(()=>import(`./dist-C2WSXtwq.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,5,2,1]))}}),y.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return O(()=>import(`./dist-DKNlD5B9.js`).then(e=>e.wast()),__vite__mapDeps([19,1,2]))}}),y.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return O(()=>import(`./dist-DBsUA7Da.js`).then(e=>e.xml()),__vite__mapDeps([20,2,1]))}}),y.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return O(()=>import(`./dist-BFoOtrHc.js`).then(e=>e.yaml()),__vite__mapDeps([21,2,1]))}}),y.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return O(()=>import(`./apl-CHPMLzQP.js`).then(e=>Q(e.apl)),[])}}),y.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return O(()=>import(`./asciiarmor-Qq1NDodh.js`).then(e=>Q(e.asciiArmor)),[])}}),y.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return O(()=>import(`./asn1-DRgkG9yc.js`).then(e=>Q(e.asn1({}))),[])}}),y.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return O(()=>import(`./asterisk-ae5wsYrl.js`).then(e=>Q(e.asterisk)),[])}}),y.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return O(()=>import(`./brainfuck-BKsya-lF.js`).then(e=>Q(e.brainfuck)),[])}}),y.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return O(()=>import(`./cobol-B3aUFbKf.js`).then(e=>Q(e.cobol)),[])}}),y.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.csharp)),[])}}),y.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return O(()=>import(`./clojure-CgPaYiPv.js`).then(e=>Q(e.clojure)),[])}}),y.of({name:`ClojureScript`,extensions:[`cljs`],load(){return O(()=>import(`./clojure-CgPaYiPv.js`).then(e=>Q(e.clojure)),[])}}),y.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return O(()=>import(`./css-DN2LLrF8.js`).then(e=>Q(e.gss)),[])}}),y.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return O(()=>import(`./cmake-DbqTW5io.js`).then(e=>Q(e.cmake)),[])}}),y.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return O(()=>import(`./coffeescript-CCPt9S--.js`).then(e=>Q(e.coffeeScript)),[])}}),y.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return O(()=>import(`./commonlisp-Clm1YIex.js`).then(e=>Q(e.commonLisp)),[])}}),y.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return O(()=>import(`./cypher-CCkHI_OH.js`).then(e=>Q(e.cypher)),[])}}),y.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return O(()=>import(`./python-4ztzejrZ.js`).then(e=>Q(e.cython)),[])}}),y.of({name:`Crystal`,extensions:[`cr`],load(){return O(()=>import(`./crystal-BmCet_35.js`).then(e=>Q(e.crystal)),[])}}),y.of({name:`D`,extensions:[`d`],load(){return O(()=>import(`./d-DXS80xi8.js`).then(e=>Q(e.d)),[])}}),y.of({name:`Dart`,extensions:[`dart`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.dart)),[])}}),y.of({name:`diff`,extensions:[`diff`,`patch`],load(){return O(()=>import(`./diff-LtZN2nYD.js`).then(e=>Q(e.diff)),[])}}),y.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return O(()=>import(`./dockerfile-nM1Ko-Z7.js`).then(e=>Q(e.dockerFile)),__vite__mapDeps([22,23]))}}),y.of({name:`DTD`,extensions:[`dtd`],load(){return O(()=>import(`./dtd-u6doTIMs.js`).then(e=>Q(e.dtd)),[])}}),y.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return O(()=>import(`./dylan-CqCzC1wV.js`).then(e=>Q(e.dylan)),[])}}),y.of({name:`EBNF`,load(){return O(()=>import(`./ebnf-Br6TG6Ej.js`).then(e=>Q(e.ebnf)),[])}}),y.of({name:`ECL`,extensions:[`ecl`],load(){return O(()=>import(`./ecl-DySBI3Mi.js`).then(e=>Q(e.ecl)),[])}}),y.of({name:`edn`,extensions:[`edn`],load(){return O(()=>import(`./clojure-CgPaYiPv.js`).then(e=>Q(e.clojure)),[])}}),y.of({name:`Eiffel`,extensions:[`e`],load(){return O(()=>import(`./eiffel-sYWuGv6G.js`).then(e=>Q(e.eiffel)),[])}}),y.of({name:`Elm`,extensions:[`elm`],load(){return O(()=>import(`./elm--68dTWWw.js`).then(e=>Q(e.elm)),[])}}),y.of({name:`Erlang`,extensions:[`erl`],load(){return O(()=>import(`./erlang-DRzMWhmI.js`).then(e=>Q(e.erlang)),[])}}),y.of({name:`Esper`,load(){return O(()=>import(`./sql-CCvDj5CS.js`).then(e=>Q(e.esper)),[])}}),y.of({name:`Factor`,extensions:[`factor`],load(){return O(()=>import(`./factor-BZWcskYe.js`).then(e=>Q(e.factor)),__vite__mapDeps([24,23]))}}),y.of({name:`FCL`,load(){return O(()=>import(`./fcl-NiqhPlpc.js`).then(e=>Q(e.fcl)),[])}}),y.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return O(()=>import(`./forth-DSgqrjnb.js`).then(e=>Q(e.forth)),[])}}),y.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return O(()=>import(`./fortran-DowQl6ME.js`).then(e=>Q(e.fortran)),[])}}),y.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return O(()=>import(`./mllike-Bk45LYJs.js`).then(e=>Q(e.fSharp)),[])}}),y.of({name:`Gas`,extensions:[`s`],load(){return O(()=>import(`./gas-BGG03rL_.js`).then(e=>Q(e.gas)),[])}}),y.of({name:`Gherkin`,extensions:[`feature`],load(){return O(()=>import(`./gherkin-Cqb_6D-9.js`).then(e=>Q(e.gherkin)),[])}}),y.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return O(()=>import(`./groovy-B7zM4Cov.js`).then(e=>Q(e.groovy)),[])}}),y.of({name:`Haskell`,extensions:[`hs`],load(){return O(()=>import(`./haskell-D7qM5JJh.js`).then(e=>Q(e.haskell)),[])}}),y.of({name:`Haxe`,extensions:[`hx`],load(){return O(()=>import(`./haxe-C6pwwQZb.js`).then(e=>Q(e.haxe)),[])}}),y.of({name:`HXML`,extensions:[`hxml`],load(){return O(()=>import(`./haxe-C6pwwQZb.js`).then(e=>Q(e.hxml)),[])}}),y.of({name:`HTTP`,load(){return O(()=>import(`./http-CmD77Vm0.js`).then(e=>Q(e.http)),[])}}),y.of({name:`IDL`,extensions:[`pro`],load(){return O(()=>import(`./idl-aL_loni0.js`).then(e=>Q(e.idl)),[])}}),y.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return O(()=>import(`./javascript-BXKxGTTj.js`).then(e=>Q(e.jsonld)),[])}}),y.of({name:`Julia`,extensions:[`jl`],load(){return O(()=>import(`./julia-CfBqSgho.js`).then(e=>Q(e.julia)),[])}}),y.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.kotlin)),[])}}),y.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return O(()=>import(`./livescript-CR8U3wM3.js`).then(e=>Q(e.liveScript)),[])}}),y.of({name:`Lua`,extensions:[`lua`],load(){return O(()=>import(`./lua-Bg4VZnNk.js`).then(e=>Q(e.lua)),[])}}),y.of({name:`mIRC`,extensions:[`mrc`],load(){return O(()=>import(`./mirc-CN27htLS.js`).then(e=>Q(e.mirc)),[])}}),y.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return O(()=>import(`./mathematica-BfPIWI-2.js`).then(e=>Q(e.mathematica)),[])}}),y.of({name:`Modelica`,extensions:[`mo`],load(){return O(()=>import(`./modelica-BhMDrNyP.js`).then(e=>Q(e.modelica)),[])}}),y.of({name:`MUMPS`,extensions:[`mps`],load(){return O(()=>import(`./mumps-q10v_7vy.js`).then(e=>Q(e.mumps)),[])}}),y.of({name:`Mbox`,extensions:[`mbox`],load(){return O(()=>import(`./mbox-BJBtIzYn.js`).then(e=>Q(e.mbox)),[])}}),y.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return O(()=>import(`./nginx-B3xldx-W.js`).then(e=>Q(e.nginx)),[])}}),y.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return O(()=>import(`./nsis-DbrGokpL.js`).then(e=>Q(e.nsis)),__vite__mapDeps([25,23]))}}),y.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return O(()=>import(`./ntriples--7wOxqgF.js`).then(e=>Q(e.ntriples)),[])}}),y.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.objectiveC)),[])}}),y.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.objectiveCpp)),[])}}),y.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return O(()=>import(`./mllike-Bk45LYJs.js`).then(e=>Q(e.oCaml)),[])}}),y.of({name:`Octave`,extensions:[`m`],load(){return O(()=>import(`./octave-1xDlNsHK.js`).then(e=>Q(e.octave)),[])}}),y.of({name:`Oz`,extensions:[`oz`],load(){return O(()=>import(`./oz-BjT3jK8F.js`).then(e=>Q(e.oz)),[])}}),y.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return O(()=>import(`./pascal-BPtkfU66.js`).then(e=>Q(e.pascal)),[])}}),y.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return O(()=>import(`./perl-DTi_Gu_W.js`).then(e=>Q(e.perl)),[])}}),y.of({name:`Pig`,extensions:[`pig`],load(){return O(()=>import(`./pig-WgPxIDtX.js`).then(e=>Q(e.pig)),[])}}),y.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return O(()=>import(`./powershell-DRMXCHuF.js`).then(e=>Q(e.powerShell)),[])}}),y.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return O(()=>import(`./properties-BmWTtUTd.js`).then(e=>Q(e.properties)),[])}}),y.of({name:`ProtoBuf`,extensions:[`proto`],load(){return O(()=>import(`./protobuf-DWkEBtMs.js`).then(e=>Q(e.protobuf)),[])}}),y.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return O(()=>import(`./pug-aQNhkzLr.js`).then(e=>Q(e.pug)),__vite__mapDeps([26,27]))}}),y.of({name:`Puppet`,extensions:[`pp`],load(){return O(()=>import(`./puppet-D_Fwwei_.js`).then(e=>Q(e.puppet)),[])}}),y.of({name:`Q`,extensions:[`q`],load(){return O(()=>import(`./q-CBhhTF3v.js`).then(e=>Q(e.q)),[])}}),y.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return O(()=>import(`./r-C9LQ8gef.js`).then(e=>Q(e.r)),[])}}),y.of({name:`RPM Changes`,load(){return O(()=>import(`./rpm-X0uOxMxY.js`).then(e=>Q(e.rpmChanges)),[])}}),y.of({name:`RPM Spec`,extensions:[`spec`],load(){return O(()=>import(`./rpm-X0uOxMxY.js`).then(e=>Q(e.rpmSpec)),[])}}),y.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return O(()=>import(`./ruby-C47yS3tR.js`).then(e=>Q(e.ruby)),[])}}),y.of({name:`SAS`,extensions:[`sas`],load(){return O(()=>import(`./sas-B1FBIZ4F.js`).then(e=>Q(e.sas)),[])}}),y.of({name:`Scala`,extensions:[`scala`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.scala)),[])}}),y.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return O(()=>import(`./scheme-BNyhth_j.js`).then(e=>Q(e.scheme)),[])}}),y.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return O(()=>import(`./shell-5WXBrNPS.js`).then(e=>Q(e.shell)),[])}}),y.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return O(()=>import(`./sieve-D1Disq_M.js`).then(e=>Q(e.sieve)),[])}}),y.of({name:`Smalltalk`,extensions:[`st`],load(){return O(()=>import(`./smalltalk-sYJEN366.js`).then(e=>Q(e.smalltalk)),[])}}),y.of({name:`Solr`,load(){return O(()=>import(`./solr-C4NTsT9q.js`).then(e=>Q(e.solr)),[])}}),y.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return O(()=>import(`./mllike-Bk45LYJs.js`).then(e=>Q(e.sml)),[])}}),y.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return O(()=>import(`./sparql-BUDcgvyA.js`).then(e=>Q(e.sparql)),[])}}),y.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return O(()=>import(`./spreadsheet-Cc9aoY1X.js`).then(e=>Q(e.spreadsheet)),[])}}),y.of({name:`Squirrel`,extensions:[`nut`],load(){return O(()=>import(`./clike-DBtGfPmP.js`).then(e=>Q(e.squirrel)),[])}}),y.of({name:`Stylus`,extensions:[`styl`],load(){return O(()=>import(`./stylus-gypP4Wbw.js`).then(e=>Q(e.stylus)),[])}}),y.of({name:`Swift`,extensions:[`swift`],load(){return O(()=>import(`./swift-B3wDQDLW.js`).then(e=>Q(e.swift)),[])}}),y.of({name:`sTeX`,load(){return O(()=>import(`./stex-QOxlzChr.js`).then(e=>Q(e.stex)),[])}}),y.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return O(()=>import(`./stex-QOxlzChr.js`).then(e=>Q(e.stex)),[])}}),y.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return O(()=>import(`./verilog-BQwnhnkI.js`).then(e=>Q(e.verilog)),[])}}),y.of({name:`Tcl`,extensions:[`tcl`],load(){return O(()=>import(`./tcl-BrLMXonE.js`).then(e=>Q(e.tcl)),[])}}),y.of({name:`Textile`,extensions:[`textile`],load(){return O(()=>import(`./textile-3OdJWGLP.js`).then(e=>Q(e.textile)),[])}}),y.of({name:`TiddlyWiki`,load(){return O(()=>import(`./tiddlywiki-CmXBv0bH.js`).then(e=>Q(e.tiddlyWiki)),[])}}),y.of({name:`Tiki wiki`,load(){return O(()=>import(`./tiki-DH9217vp.js`).then(e=>Q(e.tiki)),[])}}),y.of({name:`TOML`,extensions:[`toml`],load(){return O(()=>import(`./toml-BbNXaVxN.js`).then(e=>Q(e.toml)),[])}}),y.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return O(()=>import(`./troff-B3-4D8jV.js`).then(e=>Q(e.troff)),[])}}),y.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return O(()=>import(`./ttcn-T6YAhFaa.js`).then(e=>Q(e.ttcn)),[])}}),y.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return O(()=>import(`./ttcn-cfg-B2HBoHuP.js`).then(e=>Q(e.ttcnCfg)),[])}}),y.of({name:`Turtle`,extensions:[`ttl`],load(){return O(()=>import(`./turtle-DWZbcJ3Q.js`).then(e=>Q(e.turtle)),[])}}),y.of({name:`Web IDL`,extensions:[`webidl`],load(){return O(()=>import(`./webidl-ClkPG1IF.js`).then(e=>Q(e.webIDL)),[])}}),y.of({name:`VB.NET`,extensions:[`vb`],load(){return O(()=>import(`./vb-B2tgJzbE.js`).then(e=>Q(e.vb)),[])}}),y.of({name:`VBScript`,extensions:[`vbs`],load(){return O(()=>import(`./vbscript-CdcLDZO3.js`).then(e=>Q(e.vbScript)),[])}}),y.of({name:`Velocity`,extensions:[`vtl`],load(){return O(()=>import(`./velocity-BNg1Q2g9.js`).then(e=>Q(e.velocity)),[])}}),y.of({name:`Verilog`,extensions:[`v`],load(){return O(()=>import(`./verilog-BQwnhnkI.js`).then(e=>Q(e.verilog)),[])}}),y.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return O(()=>import(`./vhdl-DMlpjilm.js`).then(e=>Q(e.vhdl)),[])}}),y.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return O(()=>import(`./xquery-ChetrTQb.js`).then(e=>Q(e.xQuery)),[])}}),y.of({name:`Yacas`,extensions:[`ys`],load(){return O(()=>import(`./yacas-eBln9l6K.js`).then(e=>Q(e.yacas)),[])}}),y.of({name:`Z80`,extensions:[`z80`],load(){return O(()=>import(`./z80-Bu1e9FlK.js`).then(e=>Q(e.z80)),[])}}),y.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return O(()=>import(`./mscgen-CiE_ZxvV.js`).then(e=>Q(e.mscgen)),[])}}),y.of({name:`Xù`,extensions:[`xu`],load(){return O(()=>import(`./mscgen-CiE_ZxvV.js`).then(e=>Q(e.xu)),[])}}),y.of({name:`MsGenny`,extensions:[`msgenny`],load(){return O(()=>import(`./mscgen-CiE_ZxvV.js`).then(e=>Q(e.msgenny)),[])}}),y.of({name:`Vue`,extensions:[`vue`],load(){return O(()=>import(`./dist-B8Mp_VTU.js`).then(e=>e.vue()),__vite__mapDeps([28,1,7,2,4,5,8]))}}),y.of({name:`Angular Template`,load(){return O(()=>import(`./dist-Nlb4zANG.js`).then(e=>e.angular()),__vite__mapDeps([29,1,7,2,4,5,8]))}})],bo=999,xo=`xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"`,So={previous:`<svg ${xo}><path d="M4 10l4-4 4 4"/></svg>`,next:`<svg ${xo}><path d="M4 6l4 4 4-4"/></svg>`,close:`<svg ${xo}><path d="M4.5 4.5l7 7M11.5 4.5l-7 7"/></svg>`};function Co(e,t,n){let r=document.createElement(`button`);return r.type=`button`,r.className=`cm-find-button`,r.setAttribute(`aria-label`,t),r.title=t,r.innerHTML=So[e],r.addEventListener(`mousedown`,e=>e.preventDefault()),r.addEventListener(`click`,n),r}function wo(e,t){if(!t.search||!t.valid)return``;let{from:n,to:r}=e.state.selection.main,i=0,a=0,o=t.getCursor(e.state);for(let e=o.next();!e.done;e=o.next())if(i++,e.value.from===n&&e.value.to===r&&(a=i),i>bo)return a?`${a}/${bo}+`:`${bo}+`;return i?a?`${a}/${i}`:String(i):k(`无结果`,`No results`)}function To(e){let t=document.createElement(`div`);t.className=`cm-find`,t.setAttribute(`role`,`search`);let n=document.createElement(`input`);n.className=`cm-find-input`,n.type=`text`,n.spellcheck=!1,n.placeholder=k(`查找`,`Find`),n.setAttribute(`aria-label`,k(`在文件中查找`,`Find in file`)),n.setAttribute(`main-field`,`true`),n.value=ya(e.state).search;let r=document.createElement(`span`);r.className=`cm-find-count`,r.setAttribute(`aria-live`,`polite`);let i=()=>{r.textContent=wo(e,ya(e.state))},a=t=>{t?Ea(e):Ta(e)};return n.addEventListener(`input`,()=>{let t=new ca({...ya(e.state),search:n.value});if(e.dispatch({effects:q.of(t)}),!t.search||!t.valid)return;let r=e.state.selection.main.from,i=t.getCursor(e.state,r).next(),a=i.done?t.getCursor(e.state,0,r).next():i;a.done||e.dispatch({selection:{anchor:a.value.from,head:a.value.to},scrollIntoView:!0,userEvent:`select.search`})}),n.addEventListener(`keydown`,t=>{t.key===`Enter`?(t.preventDefault(),a(t.shiftKey)):t.key===`Escape`&&(t.preventDefault(),Ia(e),e.focus())}),t.append(n,r,Co(`previous`,k(`上一个匹配(Shift+Enter)`,`Previous match (Shift+Enter)`),()=>a(!0)),Co(`next`,k(`下一个匹配(Enter)`,`Next match (Enter)`),()=>a(!1)),Co(`close`,k(`关闭(Esc)`,`Close (Esc)`),()=>{Ia(e),e.focus()})),i(),{dom:t,top:!0,mount(){n.focus(),n.select()},update(e){let t=ya(e.state);t.search!==n.value&&e.transactions.some(e=>e.effects.some(e=>e.is(q)))&&(n.value=t.search),(e.docChanged||e.selectionSet||t!==ya(e.startState))&&i()}}}var Eo=m.theme({".cm-panels.cm-panels-top":{position:`absolute`,top:`8px`,right:`16px`,left:`auto`,border:`none`,backgroundColor:`transparent`,zIndex:`300`},".cm-find":{display:`flex`,alignItems:`center`,gap:`2px`,boxSizing:`border-box`,width:`min(340px, calc(100vw - 48px))`,padding:`6px`,border:`0.5px solid var(--dsw-alias-border-l2)`,borderRadius:`var(--dsw-radius-md)`,backgroundColor:`var(--dsw-menu-surface-fill, var(--dsw-alias-bg-layer-1))`,boxShadow:`var(--dsw-elevation-panel)`,fontFamily:`var(--ds-font-family, inherit)`,fontSize:`12.5px`,color:`var(--dsw-alias-label-primary)`},".cm-find-input":{flex:`1`,minWidth:`0`,height:`28px`,boxSizing:`border-box`,margin:`0 4px 0 0`,padding:`0 10px`,border:`0.5px solid var(--dsw-alias-border-l3)`,borderRadius:`var(--dsw-radius-sm)`,backgroundColor:`var(--dsw-alias-bg-base, transparent)`,color:`inherit`,font:`inherit`,outline:`none`},".cm-find-input:focus":{borderColor:`var(--dsw-alias-border-l1)`},".cm-find-input::placeholder":{color:`var(--dsw-alias-label-tertiary)`},".cm-find-count":{flex:`none`,minWidth:`0`,padding:`0 6px 0 2px`,color:`var(--dsw-alias-label-tertiary)`,fontSize:`12px`,fontVariantNumeric:`tabular-nums`,whiteSpace:`nowrap`},".cm-find-count:empty":{display:`none`},".cm-find-button":{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flex:`none`,width:`28px`,height:`28px`,padding:`0`,border:`0`,borderRadius:`var(--dsw-radius-sm)`,backgroundColor:`transparent`,color:`var(--dsw-alias-label-secondary)`,cursor:`pointer`},".cm-find-button:hover":{backgroundColor:`var(--dsw-alias-interactive-bg-hover)`},".cm-find-button:focus-visible":{outline:`2px solid var(--dsw-alias-label-primary)`,outlineOffset:`-2px`},".cm-searchMatch":{backgroundColor:`color-mix(in srgb, var(--dsw-alias-state-warn-label) 22%, transparent)`,outline:`none`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`color-mix(in srgb, var(--dsw-alias-state-warn-label) 48%, transparent)`}}),Do=[sa({top:!0,createPanel:To}),Eo],Oo=e({createCodeEditor:()=>jo}),ko=je.define([{tag:[g.keyword,g.controlKeyword,g.operatorKeyword,g.definitionKeyword,g.moduleKeyword,g.modifier,g.self,g.tagName],color:`var(--shiki-token-keyword)`},{tag:[g.string,g.special(g.string),g.regexp,g.character,g.inserted],color:`var(--shiki-token-string)`},{tag:[g.comment,g.lineComment,g.blockComment,g.docComment,g.meta],color:`var(--shiki-token-comment)`,fontStyle:`italic`},{tag:[g.number,g.bool,g.null,g.atom,g.constant(g.name),g.standard(g.name),g.typeName,g.className,g.namespace,g.unit],color:`var(--shiki-token-constant)`},{tag:[g.function(g.variableName),g.function(g.propertyName),g.macroName,g.labelName],color:`var(--shiki-token-function)`},{tag:[g.attributeName,g.local(g.variableName),g.special(g.variableName)],color:`var(--shiki-token-parameter)`},{tag:[g.punctuation,g.bracket,g.operator,g.separator,g.angleBracket],color:`var(--shiki-token-punctuation)`},{tag:[g.link,g.url],color:`var(--shiki-token-link)`,textDecoration:`underline`},{tag:g.heading,color:`var(--shiki-token-keyword)`,fontWeight:`600`},{tag:g.emphasis,fontStyle:`italic`},{tag:g.strong,fontWeight:`600`},{tag:g.strikethrough,textDecoration:`line-through`},{tag:[g.invalid,g.deleted],color:`var(--dsw-alias-state-error-primary)`}]),Ao=m.theme({"&":{height:`100%`,color:`var(--shiki-foreground)`,backgroundColor:`var(--shiki-background)`,fontSize:`12.5px`},"&.cm-focused":{outline:`none`},".cm-scroller":{fontFamily:`var(--ds-font-family-code)`,lineHeight:`1.6`,overflow:`auto`},".cm-content":{padding:`10px 0 calc(10px + var(--pi-floating-composer-overlap, 0px))`,caretColor:`var(--dsw-alias-label-primary)`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`var(--dsw-alias-label-primary)`},".cm-gutters":{backgroundColor:`var(--shiki-background)`,color:`var(--dsw-alias-label-tertiary)`,border:`none`},".cm-lineNumbers .cm-gutterElement":{padding:`0 10px 0 14px`,minWidth:`3ch`},".cm-activeLine":{backgroundColor:`color-mix(in srgb, var(--dsw-alias-label-primary) 4%, transparent)`},".cm-activeLineGutter":{backgroundColor:`transparent`,color:`var(--dsw-alias-label-secondary)`},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:`color-mix(in srgb, var(--dsw-static-blue-500, #3b82f6) 22%, transparent)`},".cm-selectionMatch":{backgroundColor:`color-mix(in srgb, var(--dsw-alias-state-warn-label) 18%, transparent)`},".cm-matchingBracket, &.cm-focused .cm-matchingBracket":{backgroundColor:`color-mix(in srgb, var(--dsw-alias-label-primary) 10%, transparent)`,outline:`none`},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:`var(--dsw-alias-label-tertiary)`},".cm-panels":{backgroundColor:`var(--dsw-alias-bg-layer-1, var(--shiki-background))`,color:`var(--dsw-alias-label-primary)`},".cm-panels.cm-panels-bottom":{borderTop:`0.5px solid var(--dsw-alias-border-l3)`},".cm-tooltip":{border:`0.5px solid var(--dsw-alias-border-l2)`,backgroundColor:`var(--dsw-alias-bg-layer-1, var(--shiki-background))`}});function jo(e,t){let r=new Ne,i=document.querySelector(`meta[name="pi-style-nonce"]`)?.content,a=!1,o=new m({parent:e,state:ge.create({doc:t.text,extensions:[vo,Do,ue.of([Ri]),ye.highest(ue.of([{key:`Mod-s`,preventDefault:!0,run:()=>(t.onSave(),!0)}])),n(ko),Ao,r.of([]),...i?[m.cspNonce.of(i)]:[],m.contentAttributes.of({"aria-label":t.label}),m.updateListener.of(e=>{if(e.docChanged&&!a&&t.onChange(e.state.doc.toString()),e.selectionSet||e.docChanged){let n=e.state.selection.main;t.onSelection?.(n.empty?null:{from:e.state.doc.lineAt(n.from).number,to:e.state.doc.lineAt(n.to).number})}})]})}),s=!1;return y.matchFilename(yo,t.filename)?.load().then(e=>{s||o.dispatch({effects:r.reconfigure(e)})}).catch(()=>{}),{setText(e){if(e!==o.state.doc.toString()){a=!0;try{o.dispatch({changes:{from:0,to:o.state.doc.length,insert:e}})}finally{a=!1}}},reveal(e){let t=o.state.doc.line(Math.min(Math.max(1,e),o.state.doc.lines));o.dispatch({selection:{anchor:t.from,head:t.to},effects:m.scrollIntoView(t.from,{y:`center`})})},focus:()=>o.focus(),destroy(){s=!0,o.destroy()}}}export{Xt as a,jo as createCodeEditor,We as i,Be as n,Ue as r,Oo as t};
|
|
4
|
+
//# debugId=02b2b3ce-e929-492e-a114-774fa639d1a6
|