@ahpd/web 0.3.0 → 0.3.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/README.md +3 -2
- package/dist/app/assets/{AudioPage-BCuwTLKN.js → AudioPage-DAAck9ph.js} +1 -1
- package/dist/app/assets/{Composer-Crdqrcjj.js → Composer-Dp_Z0bXp.js} +1 -1
- package/dist/app/assets/{DataTable-D9RxuuR3.js → DataTable-8woVlU4S.js} +1 -1
- package/dist/app/assets/{Details-BhWMrDPk.js → Details-ByJkvhJN.js} +1 -1
- package/dist/app/assets/{DiffPage-D8wjIu2g.js → DiffPage-Ck21x0bd.js} +1 -1
- package/dist/app/assets/{Edit-B12zsW3c.js → Edit-rv9ZDDDu.js} +1 -1
- package/dist/app/assets/{Explorer-C2wZaZN2.js → Explorer-CDm6vvt6.js} +1 -1
- package/dist/app/assets/{Explorer-DLH41MqT.js → Explorer-CNz5U5q-.js} +1 -1
- package/dist/app/assets/{Explorer-CViecqG_.js → Explorer-DS_lqr3R.js} +1 -1
- package/dist/app/assets/{Explorer-z4mktaMi.js → Explorer-DoNVPZ-C.js} +1 -1
- package/dist/app/assets/{Explorer-BR0vyz4x.js → Explorer-VoN5CYd5.js} +1 -1
- package/dist/app/assets/{FilePage-CErxqbDp.js → FilePage-CAUDXIh9.js} +3 -3
- package/dist/app/assets/{Filter-DohSRUkD.js → Filter-D1FpBH5R.js} +1 -1
- package/dist/app/assets/{ImagePage-B-n1btEA.js → ImagePage-cy_jkGi1.js} +1 -1
- package/dist/app/assets/{Info-BbyvhG4Q.js → Info-DqnamTeq.js} +1 -1
- package/dist/app/assets/{LocaleToggle-CETgRIRf.js → LocaleToggle-B91QrqGs.js} +1 -1
- package/dist/app/assets/{LogPage-C_h99NtQ.js → LogPage-CKm7_URt.js} +1 -1
- package/dist/app/assets/{LoginForm-p7rsv-LJ.js → LoginForm-rBz-5JFG.js} +1 -1
- package/dist/app/assets/{MarkdownPage-Cv5UyfVY.js → MarkdownPage-DgalhN_B.js} +1 -1
- package/dist/app/assets/{New-D0REy_20.js → New-D6QCCHrx.js} +1 -1
- package/dist/app/assets/{Page-TDRLt015.js → Page-CnfUTsQD.js} +1 -1
- package/dist/app/assets/{Page-B3UbQqyT.js → Page-DGp_WebG.js} +1 -1
- package/dist/app/assets/{Page-cKDPN7cD.js → Page-Dqf45zd4.js} +1 -1
- package/dist/app/assets/{Pagination-v2fHA8Hf.js → Pagination-fEfxXCWD.js} +1 -1
- package/dist/app/assets/{PortaLock-ieoqUizB.js → PortaLock-BFpTWuKB.js} +2 -2
- package/dist/app/assets/{Settings-BP67xLx9.js → Settings-ALaVSuhU.js} +1 -1
- package/dist/app/assets/{SigillumGate-DNRuVdn4.js → SigillumGate-Bq_GLDvI.js} +1 -1
- package/dist/app/assets/{SingleLayout-D0y3xoJg.js → SingleLayout-BzRi_cEY.js} +1 -1
- package/dist/app/assets/SpatialLayout-Cote5YNZ.js +1 -0
- package/dist/app/assets/SplitLayout-CK5SuMF1.js +1 -0
- package/dist/app/assets/StackLayout-BUdng0sD.js +1 -0
- package/dist/app/assets/Start-D5KBqSwf.js +1 -0
- package/dist/app/assets/Start-Dtuu25RL.css +1 -0
- package/dist/app/assets/TabLayout-ByKrZ0yM.js +1 -0
- package/dist/app/assets/TabPanelLayout-B4DWG6Zm.js +1 -0
- package/dist/app/assets/{TerminalPage-BaFThhYG.js → TerminalPage-CDtmKMSK.js} +1 -1
- package/dist/app/assets/{ThemeModeToggle-D1kTZNm_.js → ThemeModeToggle-C0j9D4s0.js} +1 -1
- package/dist/app/assets/{ThemePicker-BIFeJU_m.js → ThemePicker-DEUED0NH.js} +1 -1
- package/dist/app/assets/{Tree-BqFzA5wp.js → Tree-fxC7yDSR.js} +1 -1
- package/dist/app/assets/{VideoPage-DbVVXi0p.js → VideoPage-Cz7g_2E1.js} +1 -1
- package/dist/app/assets/{actions-BmFc5yoR.js → actions-BzJiPQuh.js} +1 -1
- package/dist/app/assets/{changeset-BgSW341C.js → changeset-eZAmDe3s.js} +1 -1
- package/dist/app/assets/{channel-8aIcEm3f.js → channel-UD2KGCy_.js} +1 -1
- package/dist/app/assets/{clicks-B3stbczh.js → clicks-DIh3kBLi.js} +1 -1
- package/dist/app/assets/{composer-commands-AmOY6XGO.js → composer-commands-B8AF8OGi.js} +1 -1
- package/dist/app/assets/data-hUAVersf.js +2 -0
- package/dist/app/assets/{dist-D9412h7o.js → dist-B4E-6SqB.js} +1 -1
- package/dist/app/assets/{dist-B9NMd4es.js → dist-BdNRSgzN.js} +1 -1
- package/dist/app/assets/{dist-CEr2uR4w.js → dist-BwHJSc3S.js} +1 -1
- package/dist/app/assets/{dist-DYPX2Ybv.js → dist-DUFzb_Eu.js} +1 -1
- package/dist/app/assets/{dist-drsoOe-s.js → dist-DX2Uz40S.js} +1 -1
- package/dist/app/assets/{dist-BnQxBrCW.js → dist-Db_OB0lX.js} +1 -1
- package/dist/app/assets/{dist-CYq92lOO.js → dist-uvIW_qsj.js} +1 -1
- package/dist/app/assets/folder-path-CTpCmycG.js +1 -0
- package/dist/app/assets/index-B1VQ36Tb.css +1 -0
- package/dist/app/assets/index-yhQX4tVS.js +14 -0
- package/dist/app/assets/{media-C3ferCB3.js → media-Coozt7AL.js} +1 -1
- package/dist/app/assets/{notify-CJo-T9e2.js → notify-BQ9fSOfy.js} +1 -1
- package/dist/app/assets/sessions-8PScJEDe.js +2 -0
- package/dist/app/assets/{terminal-BMZxY-St.js → terminal-BPj7jGw5.js} +1 -1
- package/dist/app/assets/{text-B601jRcP.js → text-BdULOY8N.js} +1 -1
- package/dist/app/index.html +8 -8
- package/dist/embed/index.d.ts +5 -0
- package/package.json +2 -2
- package/dist/app/assets/SpatialLayout-CKZCVibM.js +0 -1
- package/dist/app/assets/SplitLayout-7EOWfDlZ.js +0 -1
- package/dist/app/assets/StackLayout-1wBXKLKy.js +0 -1
- package/dist/app/assets/TabLayout-ClrRSvj1.js +0 -1
- package/dist/app/assets/TabPanelLayout-YGvLy1cR.js +0 -1
- package/dist/app/assets/data-CBWyZN_H.js +0 -2
- package/dist/app/assets/folder-path-CmVXGhKI.js +0 -1
- package/dist/app/assets/index-BQcTkW2q.css +0 -1
- package/dist/app/assets/index-DBKNxflN.js +0 -14
- package/dist/app/assets/sessions-BcRKb9k7.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-
|
|
2
|
-
import{r as e,t}from"./jsx-runtime-BguD1OXD.js";import{t as n}from"./react-CybPckBe.js";import{t as r}from"./preload-helper-BaNbYf_w.js";import{t as i}from"./useCloseGuard-B4qJKmaF.js";import{F as a,st as o,y as s}from"./data-CBWyZN_H.js";import{t as c}from"./Spinner-B-iOhBZq.js";import{t as l}from"./Alert-CHZkhmDE.js";import{$ as u,A as d,B as f,C as p,D as m,Dt as h,F as g,G as _,H as v,I as ee,J as te,K as ne,L as re,M as ie,N as y,P as ae,Q as b,R as oe,T as se,U as ce,V as le,W as ue,X as de,Y as fe,Z as pe,_ as me,_t as x,at as he,b as ge,bt as S,c as _e,ct as ve,dt as ye,et as be,ft as C,gt as w,h as xe,ht as Se,it as T,j as E,k as Ce,l as we,lt as Te,mt as Ee,n as De,nt as D,ot as O,pt as Oe,q as ke,rt as Ae,st as je,t as Me,tt as Ne,ut as Pe,vt as Fe,w as Ie,wt as k,x as Le,xt as Re,yt as ze,z as Be}from"./dist-BDH0Q8eg.js";import{n as Ve,t as He}from"./text-B601jRcP.js";var A=n(),Ue=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=d(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(Ye(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 We(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 Ge(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=We(t)+We(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function Ke(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:Ge(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function qe(e,t){return n=>{for(let t=d(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 Je=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function j(e){return e.selection.main.from}function Ye(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 Xe=u.define();function Ze(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:T.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var Qe=new WeakMap;function $e(e){if(!Array.isArray(e))return e;let t=Qe.get(e);return t||Qe.set(e,t=Ke(e)),t}var et=C.define(),tt=C.define(),nt=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=w(e,t),r=x(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(w(a==i?i.toLowerCase():a,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:i,byWord:a}=this;if(t.length==1){let r=w(e,0),i=x(r),a=i==e.length?0:-100;if(r!=t[0]){if(r==n[0])a+=-200;else return null}return this.ret(a,[0,i])}let o=e.indexOf(this.pattern);if(o==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let s=t.length,c=0;if(o<0){for(let i=0,a=Math.min(e.length,200);i<a&&c<s;){let a=w(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=x(a)}if(c<s)return null}let l=0,u=0,d=!1,f=0,p=-1,m=-1,h=/[a-z]/.test(e),g=!0;for(let r=0,c=Math.min(e.length,200),_=0;r<c&&u<s;){let c=w(e,r);o<0&&(l<s&&c==t[l]&&(i[l++]=r),f<s&&(c==t[f]||c==n[f]?(f==0&&(p=r),m=r+1,f++):f=0));let v,ee=c<255?c>=48&&c<=57||c>=97&&c<=122?2:+(c>=65&&c<=90):(v=Re(c))==v.toLowerCase()?v==v.toUpperCase()?0:2:1;(!r||ee==1&&h||_==0&&ee!=0)&&(t[u]==c||n[u]==c&&(d=!0)?a[u++]=r:a.length&&(g=!1)),_=ee,r+=x(c)}return u==s&&a[0]==0&&g?this.result(-100+(d?-200:0),a,e):f==s&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):f==s?this.ret(-900-e.length,[p,m]):u==s?this.result(-100+(d?-200:0)+-700+(g?0:-1100),a,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?x(w(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}},rt=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)}},M=O.define({combine(e){return Fe(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:at,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=>it(e(n),t(n)),optionClass:(e,t)=>n=>it(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function it(e,t){return e?t?e+` `+t:e:t}function at(e,t,n,r,i,a){let o=e.textDirection==ie.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,_=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${d/_}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var ot=C.define();function st(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 ct(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 lt=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(M);this.optionContent=st(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=ct(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:ot.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(M).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:tt.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=ct(r.length,i,e.state.facet(M).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),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=ct(t.options.length,t.selected,this.view.state.facet(M).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>ne(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(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&&dt(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(M).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 ut(e,t){return n=>new lt(n,e,t)}function dt(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 ft(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function pt(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(M);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 Je(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new rt(n):new nt(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 Je(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):ft(e.completion)>ft(c)&&(s[s.length-1]=e),c=e.completion}return s}var mt=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,yt(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=pt(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(M).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,yt(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:Et,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)}},ht=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(bt,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(M),i=(r.override||n.languageDataAt(`autocomplete`,j(n)).map($e)).map(e=>(this.active.find(t=>t.source==e)||new N(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(wt));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!gt(i,this.active)||o?a=mt.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 N(e.source,0):e));for(let e of t.effects)e.is(ot)&&(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?_t:vt}};function gt(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 _t={"aria-autocomplete":`list`},vt={};function yt(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var bt=[];function xt(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(Xe);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 N=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=xt(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(et))i=new e(i.source,1,n.value);else if(n.is(tt))i=new e(i.source,0);else if(n.is(wt))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(j(e.state))}},St=class e extends N{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=j(t.state);if(o>a||!r||n&2&&(j(t.startState)==this.from||o<this.limit))return new N(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return Ct(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 Ue(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??j(t.state)):new N(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 N(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function Ct(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):Ye(e,!0).test(i)}var wt=C.define({map(e,t){return e.map(e=>e.map(t))}}),P=Oe.define({create(){return ht.start()},update(e,t){return e.update(t)},provide:e=>[pe.from(e,e=>e.tooltip),y.contentAttributes.from(e,e=>e.attrs)]});function Tt(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(P).active.find(e=>e.source==t.source);return r instanceof St&&(typeof n==`string`?e.dispatch({...Ze(e.state,n,r.from,r.to),annotations:Xe.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var Et=ut(P,Tt);function Dt(e,t=`option`){return n=>{let r=n.state.field(P,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(M).interactionDelay)return!1;let i=1,a;t==`page`&&(a=f(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:ot.of(s)}),!0}}var Ot=e=>{let t=e.state.field(P,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(M).interactionDelay?!1:Tt(e,t.open.options[t.open.selected])},kt=e=>e.state.field(P,!1)?(e.dispatch({effects:et.of(!0)}),!0):!1,At=e=>{let t=e.state.field(P,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:tt.of(null)}),!0)},jt=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},Mt=50,Nt=1e3,Pt=ae.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(P).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(P),n=e.state.facet(M);if(!e.selectionSet&&!e.docChanged&&e.startState.field(P)==t)return;let r=e.transactions.some(e=>{let t=xt(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>Mt&&Date.now()-n.time>Nt){for(let e of n.context.abortListeners)try{e()}catch(e){ne(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(et)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-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(P);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(M).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new Ue(t,j(t),e.explicit,this.view),r=new jt(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:tt.of(null)}),ne(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(M).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(M),n=this.view.state.field(P);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=j(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new St(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 N(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:wt.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(P,!1);if(t&&t.tooltip&&this.view.state.facet(M).closeOnBlur){let n=t.open&&f(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:tt.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:et.of(!1)}),20),this.composing=0}}}),Ft=typeof navigator==`object`&&/Win/.test(navigator.platform),It=ve.highest(y.domEventHandlers({keydown(e,t){let n=t.state.field(P,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Ft&&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&&Tt(t,r),!1}})),Lt=y.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`}}}),Rt=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},zt=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,je.TrackDel),r=t.mapPos(this.to,1,je.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},Bt=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,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(se);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new zt(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 Rt(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)}},Vt=E.widget({widget:new class extends g{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),Ht=E.mark({class:`cm-snippetField`}),Ut=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=E.set(e.map(e=>(e.from==e.to?Vt:Ht).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))}},Wt=C.define({map(e,t){return e&&e.map(t)}}),Gt=C.define(),Kt=Oe.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(Wt))return n.value;if(n.is(Gt)&&e)return new Ut(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=>y.decorations.from(e,e=>e?e.deco:E.none)});function qt(e,t){return T.create(e.filter(e=>e.field==t).map(e=>T.range(e.from,e.to)))}function Jt(e){let t=Bt.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:Ee.of(a)},scrollIntoView:!0,annotations:n?[Xe.of(n),Se.userEvent.of(`input.complete`)]:void 0};if(o.length&&(c.selection=qt(o,0)),o.some(e=>e.field>0)){let t=new Ut(o,0),n=c.effects=[Wt.of(t)];e.state.field(Kt,!1)===void 0&&n.push(C.appendConfig.of([Kt,Qt,en,Lt]))}e.dispatch(e.state.update(c))}}function Yt(e){return({state:t,dispatch:n})=>{let r=t.field(Kt,!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:qt(r.ranges,i),effects:Wt.of(a?null:new Ut(r.ranges,i)),scrollIntoView:!0})),!0}}var Xt=[{key:`Tab`,run:Yt(1),shift:Yt(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(Kt,!1)?(t(e.update({effects:Wt.of(null)})),!0):!1}],Zt=O.define({combine(e){return e.length?e[0]:Xt}}),Qt=ve.highest(ue.compute([Zt],e=>e.facet(Zt)));function $t(e,t){return{...t,apply:Jt(e)}}var en=y.domEventHandlers({mousedown(e,t){let n=t.state.field(Kt,!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:qt(n.ranges,i.field),effects:Wt.of(n.ranges.some(e=>e.field>i.field)?new Ut(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),F={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},I=C.define({map(e,t){return t.mapPos(e,-1,je.TrackAfter)??void 0}}),tn=new class extends ye{};tn.startSide=1,tn.endSide=-1;var nn=Oe.define({create(){return Te.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(I)&&(e=e.update({add:[tn.range(n.value,n.value+1)]}));return e}});function rn(){return[ln,nn]}var an=`()[]{}<>«»»«[]{}`;function on(e){for(let t=0;t<16;t+=2)if(an.charCodeAt(t)==e)return an.charAt(t+1);return Re(e<128?e:e+1)}function sn(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||F}var cn=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),ln=y.inputHandler.of((e,t,n,r)=>{if((cn?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&x(w(r,0))==1||t!=i.from||n!=i.to)return!1;let a=dn(e.state,r);return a?(e.dispatch(a),!0):!1}),un=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=sn(e,e.selection.main.head).brackets||F.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=mn(e.doc,t.head);for(let i of n)if(i==r&&pn(e.doc,t.head)==on(w(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:T.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:`delete.backward`})),!r}}];function dn(e,t){let n=sn(e,e.selection.main.head),r=n.brackets||F.brackets;for(let i of r){let a=on(w(i,0));if(t==i)return a==i?_n(e,i,r.indexOf(i+i+i)>-1,n):hn(e,i,a,n.before||F.before);if(t==a&&fn(e,e.selection.main.from))return gn(e,i,a)}return null}function fn(e,t){let n=!1;return e.field(nn).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function pn(e,t){let n=e.sliceString(t,t+2);return n.slice(0,x(w(n,0)))}function mn(e,t){let n=e.sliceString(t-2,t);return x(w(n,0))==n.length?n:n.slice(1)}function hn(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:I.of(a.to+t.length),range:T.range(a.anchor+t.length,a.head+t.length)};let o=pn(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:I.of(a.head+t.length),range:T.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function gn(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&pn(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:T.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function _n(e,t,n,r){let i=r.stringPrefixes||F.stringPrefixes,a=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:I.of(r.to+t.length),range:T.range(r.anchor+t.length,r.head+t.length)};let o=r.head,s=pn(e.doc,o),c;if(s==t){if(vn(e,o))return{changes:{insert:t+t,from:o},effects:I.of(o+t.length),range:T.cursor(o+t.length)};if(fn(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:T.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(c=bn(e,o-2*t.length,i))>-1&&vn(e,c))return{changes:{insert:t+t+t+t,from:o},effects:I.of(o+t.length),range:T.cursor(o+t.length)};else if(e.charCategorizer(o)(s)!=D.Word&&bn(e,o,i)>-1&&!yn(e,o,t,i))return{changes:{insert:t+t,from:o},effects:I.of(o+t.length),range:T.cursor(o+t.length)};return{range:a=r}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function vn(e,t){let n=d(e).resolveInner(t+1);return n.parent&&n.from==t}function yn(e,t,n,r){let i=d(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 bn(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=D.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))!=D.Word)return n}return-1}function xn(e={}){return[It,P,M.of(e),Pt,Cn,Lt]}var Sn=[{key:`Ctrl-Space`,run:kt},{mac:"Alt-`",run:kt},{mac:`Alt-i`,run:kt},{key:`Escape`,run:At},{key:`ArrowDown`,run:Dt(!0)},{key:`ArrowUp`,run:Dt(!1)},{key:`PageDown`,run:Dt(!0,`page`)},{key:`PageUp`,run:Dt(!1,`page`)},{key:`Enter`,run:Ot}],Cn=ve.highest(ue.computeN([M],e=>e.facet(M).defaultKeymap?[Sn]:[])),wn=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=kn(e.state,n.from);return r.line?En(e):r.block?On(e):!1};function Tn(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 En=Tn(Pn,0),Dn=Tn(Nn,0),On=Tn((e,t)=>Nn(e,t,Mn(t)),0);function kn(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var An=50;function jn(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-An,r),o=e.sliceDoc(i,i+An),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+An),d=e.sliceDoc(i-An,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 Mn(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 Nn(e,t,n=t.selection.ranges){let r=n.map(e=>kn(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>jn(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 Pn(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=kn(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 Fn=u.define(),In=u.define(),Ln=O.define(),Rn=O.define({combine(e){return Fe(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)})}}),zn=Oe.define({create(){return nr.empty},update(e,t){let n=t.state.facet(Rn),r=t.annotation(Fn);if(r){let i=L.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?Kn(o,o.length,n.minDepth,i):Zn(o,t.startState.selection),new nr(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(In);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(Se.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=L.fromTransaction(t),o=t.annotation(Se.time),s=t.annotation(Se.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 nr(e.done.map(L.fromJSON),e.undone.map(L.fromJSON))}});function Bn(e={}){return[zn,Rn.of(e),y.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?Hn:e.inputType==`historyRedo`?Un:null;return n?(e.preventDefault(),n(t)):!1}})]}function Vn(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(zn,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var Hn=Vn(0,!1),Un=Vn(1,!1),Wn=Vn(0,!0),Gn=Vn(1,!0),L=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&&Ne.fromJSON(t.changes),[],t.mapped&&be.fromJSON(t.mapped),t.startSelection&&T.fromJSON(t.startSelection),t.selectionsAfter.map(T.fromJSON))}static fromTransaction(t,n){let r=R;for(let e of t.startState.facet(Ln)){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,R)}static selection(t){return new e(void 0,R,void 0,void 0,t)}};function Kn(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 qn(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 Jn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Yn(e,t){return e.length?t.length?e.concat(t):e:t}var R=[],Xn=200;function Zn(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Xn));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Kn(e,e.length-1,1e9,n.setSelAfter(r)))}return[L.selection([t])]}function Qn(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 $n(e,t){if(!e.length)return e;let n=e.length,r=R;for(;n;){let i=er(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?[L.selection(r)]:R}function er(e,t,n){let r=Yn(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):R,n);if(!e.changes)return L.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new L(i,C.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var tr=/^(input\.type|delete)($|\.)/,nr=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||tr.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,qn(s.changes,t.changes))||r==`input.type.compose`)?Kn(o,o.length-1,i.minDepth,new L(t.changes.compose(s.changes),Yn(C.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,R)):Kn(o,o.length,i.minDepth,t),new e(o,R,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:R;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Jn(a[a.length-1],t)?this:new e(Zn(this.done,t),this.undone,n,r)}addMapping(t){return new e($n(this.done,t),$n(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:Fn.of({side:e,rest:Qn(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?R:r.slice(0,r.length-1);return i.mapped&&(n=$n(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Fn.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};nr.empty=new nr(R,R);var rr=[{key:`Mod-z`,run:Hn,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:Un,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:Un,preventDefault:!0},{key:`Mod-u`,run:Wn,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Gn,preventDefault:!0}];function z(e,t){return T.create(e.ranges.map(t),e.mainIndex)}function B(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function V({state:e,dispatch:t},n){let r=z(e.selection,n);return!r.eq(e.selection,!0)&&(t(B(e,r)),!0)}function ir(e,t){return T.cursor(t?e.to:e.from)}function ar(e,t){return V(e,n=>n.empty?e.moveByChar(n,t):ir(n,t))}function H(e){return e.textDirectionAt(e.state.selection.main.head)==ie.LTR}var or=e=>ar(e,!H(e)),sr=e=>ar(e,H(e));function cr(e,t){return V(e,n=>n.empty?e.moveByGroup(n,t):ir(n,t))}var lr=e=>cr(e,!H(e)),ur=e=>cr(e,H(e));typeof Intl<`u`&&Intl.Segmenter;function dr(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 fr(e,t,n){let r=d(e).resolveInner(t.head),i=n?h.closedBy:h.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;dr(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?m(e,r.from,1):m(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,T.cursor(s,n?-1:1)}var pr=e=>V(e,t=>fr(e.state,t,!H(e))),mr=e=>V(e,t=>fr(e.state,t,H(e)));function hr(e,t){return V(e,n=>{if(!n.empty)return ir(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var gr=e=>hr(e,!1),_r=e=>hr(e,!0);function vr(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(y.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 yr(e,t){let n=vr(e),{state:r}=e,i=z(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):ir(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=y.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(B(r,i),{effects:a}),!0}var br=e=>yr(e,!1),xr=e=>yr(e,!0);function U(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=T.cursor(r.from+n))}return i}var Sr=e=>V(e,t=>U(e,t,!0)),Cr=e=>V(e,t=>U(e,t,!1)),wr=e=>V(e,t=>U(e,t,!H(e))),Tr=e=>V(e,t=>U(e,t,H(e))),Er=e=>V(e,t=>e.moveToLineBoundary(t,!1,!1)),Dr=e=>V(e,t=>e.moveToLineBoundary(t,!0,!1));function Or(e,t,n){let r=!1,i=z(e.selection,t=>{let i=m(e,t.head,-1)||m(e,t.head,1)||t.head>0&&m(e,t.head-1,1)||t.head<e.doc.length&&m(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?T.range(t.anchor,a):T.cursor(a)});return r?(t(B(e,i)),!0):!1}var kr=({state:e,dispatch:t})=>Or(e,t,!1);function W(e,t,n){let r=z(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=T.range(e.head,e.anchor));let r=n(e);return T.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(B(e.state,r)),!0)}function Ar(e,t){return W(e,t,n=>e.moveByChar(n,t))}var jr=e=>Ar(e,!H(e)),Mr=e=>Ar(e,H(e));function Nr(e,t){return W(e,t,n=>e.moveByGroup(n,t))}var Pr=e=>Nr(e,!H(e)),Fr=e=>Nr(e,H(e)),Ir=e=>{let t=!H(e);return W(e,t,n=>fr(e.state,n,t))},Lr=e=>{let t=H(e);return W(e,t,n=>fr(e.state,n,t))};function Rr(e,t){return W(e,t,n=>e.moveVertically(n,t))}var zr=e=>Rr(e,!1),Br=e=>Rr(e,!0);function Vr(e,t){return W(e,t,n=>e.moveVertically(n,t,vr(e).height))}var Hr=e=>Vr(e,!1),Ur=e=>Vr(e,!0),Wr=e=>W(e,!0,t=>U(e,t,!0)),Gr=e=>W(e,!1,t=>U(e,t,!1)),Kr=e=>{let t=!H(e);return W(e,t,n=>U(e,n,t))},qr=e=>{let t=H(e);return W(e,t,n=>U(e,n,t))},Jr=e=>W(e,!1,t=>T.cursor(e.lineBlockAt(t.head).from)),Yr=e=>W(e,!0,t=>T.cursor(e.lineBlockAt(t.head).to)),Xr=({state:e,dispatch:t})=>(t(B(e,{anchor:0})),!0),Zr=({state:e,dispatch:t})=>(t(B(e,{anchor:e.doc.length})),!0),Qr=({state:e,dispatch:t})=>(t(B(e,{anchor:e.selection.main.anchor,head:0})),!0),$r=({state:e,dispatch:t})=>(t(B(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),ei=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),ti=({state:e,dispatch:t})=>{let n=bi(e).map(({from:t,to:n})=>T.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:T.create(n),userEvent:`select`})),!0},ni=({state:e,dispatch:t})=>{let n=z(e.selection,t=>{let n=d(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 T.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(B(e,n)),!0)};function ri(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(B(n,T.create(i,i.length-1))),!0)}var ii=e=>ri(e,!1),ai=e=>ri(e,!0),oi=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=T.create([n.main]):n.main.empty||(r=T.create([T.cursor(n.main.head)])),r?(t(B(e,r)),!0):!1};function si(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=ci(e,o,!1)):o>i&&(n=`delete.forward`,o=ci(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=ci(e,i,!1),a=ci(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:T.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?y.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function ci(e,t,n){if(e instanceof y)for(let r of e.state.facet(y.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var li=(e,t,n)=>si(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=ze(s,a.tabSize)%ge(a)||ge(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=S(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=S(o.text,c-o.from,!1,!1)+o.from);return c}),ui=e=>li(e,!1,!0),di=e=>li(e,!0,!1),fi=(e,t)=>si(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=S(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),pi=e=>fi(e,!1),mi=e=>fi(e,!0),hi=e=>si(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),gi=e=>si(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),_i=e=>si(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),vi=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:Ee.of([``,``])},range:T.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},yi=({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:S(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:S(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:T.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function bi(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 xi(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of bi(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(T.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(T.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:T.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var Si=({state:e,dispatch:t})=>xi(e,t,!1),Ci=({state:e,dispatch:t})=>xi(e,t,!0);function wi(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of bi(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 Ti=({state:e,dispatch:t})=>wi(e,t,!1),Ei=({state:e,dispatch:t})=>wi(e,t,!0),Di=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(bi(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=z(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 Oi(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=d(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(h.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 ki=ji(!1),Ai=ji(!0);function ji(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&&Oi(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new De(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=Le(s,r);for(c??=ze(/^\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 l=[``,Ie(t,c)];return o&&l.push(Ie(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:Ee.of(l)},range:T.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function Mi(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:T.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var Ni=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new De(e,{overrideIndentation:e=>n[e]??-1}),i=Mi(e,(t,i,a)=>{let o=Le(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=Ie(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},Pi=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Mi(e,(t,n)=>{n.push({from:t.from,insert:e.facet(se)})}),{userEvent:`input.indent`})),!0),Fi=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Mi(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=ze(r,e.tabSize),a=0,o=Ie(e,Math.max(0,i-ge(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),Ii=e=>(e.setTabFocusMode(),!0),Li=[{key:`Ctrl-b`,run:or,shift:jr,preventDefault:!0},{key:`Ctrl-f`,run:sr,shift:Mr},{key:`Ctrl-p`,run:gr,shift:zr},{key:`Ctrl-n`,run:_r,shift:Br},{key:`Ctrl-a`,run:Er,shift:Jr},{key:`Ctrl-e`,run:Dr,shift:Yr},{key:`Ctrl-d`,run:di},{key:`Ctrl-h`,run:ui},{key:`Ctrl-k`,run:hi},{key:`Ctrl-Alt-h`,run:pi},{key:`Ctrl-o`,run:vi},{key:`Ctrl-t`,run:yi},{key:`Ctrl-v`,run:xr}],Ri=[{key:`ArrowLeft`,run:or,shift:jr,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:lr,shift:Pr,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:wr,shift:Kr,preventDefault:!0},{key:`ArrowRight`,run:sr,shift:Mr,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:ur,shift:Fr,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Tr,shift:qr,preventDefault:!0},{key:`ArrowUp`,run:gr,shift:zr,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Xr,shift:Qr},{mac:`Ctrl-ArrowUp`,run:br,shift:Hr},{key:`ArrowDown`,run:_r,shift:Br,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Zr,shift:$r},{mac:`Ctrl-ArrowDown`,run:xr,shift:Ur},{key:`PageUp`,run:br,shift:Hr},{key:`PageDown`,run:xr,shift:Ur},{key:`Home`,run:Cr,shift:Gr,preventDefault:!0},{key:`Mod-Home`,run:Xr,shift:Qr},{key:`End`,run:Sr,shift:Wr,preventDefault:!0},{key:`Mod-End`,run:Zr,shift:$r},{key:`Enter`,run:ki,shift:ki},{key:`Mod-a`,run:ei},{key:`Backspace`,run:ui,shift:ui,preventDefault:!0},{key:`Delete`,run:di,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:pi,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:mi,preventDefault:!0},{mac:`Mod-Backspace`,run:gi,preventDefault:!0},{mac:`Mod-Delete`,run:_i,preventDefault:!0}].concat(Li.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),zi=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:pr,shift:Ir},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:mr,shift:Lr},{key:`Alt-ArrowUp`,run:Si},{key:`Shift-Alt-ArrowUp`,run:Ti},{key:`Alt-ArrowDown`,run:Ci},{key:`Shift-Alt-ArrowDown`,run:Ei},{key:`Mod-Alt-ArrowUp`,run:ii},{key:`Mod-Alt-ArrowDown`,run:ai},{key:`Escape`,run:oi},{key:`Mod-Enter`,run:Ai},{key:`Alt-l`,mac:`Ctrl-l`,run:ti},{key:`Mod-i`,run:ni,preventDefault:!0},{key:`Mod-[`,run:Fi},{key:`Mod-]`,run:Pi},{key:`Mod-Alt-\\`,run:Ni},{key:`Shift-Mod-k`,run:Di},{key:`Shift-Mod-\\`,run:kr},{key:`Mod-/`,run:wn},{key:`Alt-A`,mac:`Ctrl-A`,run:Dn},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Ii}].concat(Ri),Bi={key:`Tab`,run:Pi,shift:Fi},Vi=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,G=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(Vi(e)):Vi,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 w(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=Re(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=x(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`&&(G.prototype[Symbol.iterator]=function(){return this});var Hi={from:-1,to:-1,match:/.*/.exec(``),precise:!0},Ui=`gm`+(/x/.unicode==null?``:`u`),Wi=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=Hi,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new qi(e,t,n,r,i);this.re=new RegExp(t,Ui+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=Yi(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=Yi(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}}},Gi=new WeakMap,Ki=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=Gi.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Gi.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)),Gi.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},qi=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Hi,this.matchPos=Yi(e,r),this.re=new RegExp(t,Ui+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Ki.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=Yi(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ki.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Wi.prototype[Symbol.iterator]=qi.prototype[Symbol.iterator]=function(){return this});function Ji(e){try{return new RegExp(e,Ui),!0}catch{return!1}}function Yi(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 Xi=e=>{let t=oe(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}=fe(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=T.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[i,y.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},Zi={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Qi=O.define({combine(e){return Fe(e,Zi,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function $i(e){let t=[aa,ia];return e&&t.push(Qi.of(e)),t}var ea=E.mark({class:`cm-selectionMatch`}),ta=E.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function na(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=D.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=D.Word)}function ra(e,t,n,r){return e(t.sliceDoc(n,n+1))==D.Word&&e(t.sliceDoc(r-1,r))==D.Word}var ia=ae.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(Qi),{state:n}=e,r=n.selection;if(r.ranges.length>1)return E.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return E.none;let e=n.wordAt(i.head);if(!e)return E.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 E.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(na(o,n,i.from,i.to)&&ra(o,n,i.from,i.to)))return E.none}else if(a=n.sliceDoc(i.from,i.to),!a)return E.none}let s=[];for(let r of e.visibleRanges){let e=new G(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||na(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(ta.range(r,a)):(r>=i.to||a<=i.from)&&s.push(ea.range(r,a)),s.length>t.maxMatches))return E.none}}return E.set(s)}},{decorations:e=>e.decorations}),aa=y.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),oa=({state:e,dispatch:t})=>{let{selection:n}=e,r=T.create(n.ranges.map(t=>e.wordAt(t.head)||T.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function sa(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 G(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new G(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 ca=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return oa({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=sa(e,r);return i?(t(e.update({selection:e.selection.addRange(T.range(i.from,i.to),!1),effects:y.scrollIntoView(i.to)})),!0):!1},K=O.define({combine(e){return Fe(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ba(e),scrollToMatch:e=>y.scrollIntoView(e)})}});function la(e){return e?[K.of(e),Ga]:Ga}var ua=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||Ji(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 ya(this):new ma(this)}getCursor(e,t=0,n){let r=e.doc?e:he.create({doc:e});return n??=r.doc.length,this.regexp?J(this,r,t,n):q(this,r,t,n)}},da=class{constructor(e){this.spec=e}};function fa(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 q(e,t,n,r){let i;return e.wholeWord&&(i=pa(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=fa(e.test,t,i)),new G(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function pa(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(ga(i,n-a))!=D.Word||t(_a(i,n-a))!=D.Word)&&(t(_a(i,r-a))!=D.Word||t(ga(i,r-a))!=D.Word))}var ma=class extends da{constructor(e){super(e)}nextMatch(e,t,n){let r=q(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=q(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=q(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=q(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=q(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 ha(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function J(e,t,n,r){let i;return e.wholeWord&&(i=va(t.charCategorizer(t.selection.main.head))),e.test&&(i=ha(e.test,t,i)),new Wi(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function ga(e,t){return e.slice(S(e,t,!1),t)}function _a(e,t){return e.slice(t,S(e,t))}function va(e){return(t,n,r)=>!r[0].length||(e(ga(r.input,r.index))!=D.Word||e(_a(r.input,r.index))!=D.Word)&&(e(_a(r.input,r.index+r[0].length))!=D.Word||e(ga(r.input,r.index+r[0].length))!=D.Word)}var ya=class extends da{nextMatch(e,t,n){let r=J(this.spec,e,n,e.doc.length).next();return r.done&&(r=J(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=J(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=J(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=J(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)}},ba=C.define(),xa=C.define(),Y=Oe.define({create(e){return new Sa(Pa(e).create(),null)},update(e,t){for(let n of t.effects)n.is(ba)?e=new Sa(n.value.create(),e.panel):n.is(xa)&&(e=new Sa(e.query,n.value?Na:null));return e},provide:e=>de.from(e,e=>e.panel)}),Sa=class{constructor(e,t){this.query=e,this.panel=t}},Ca=E.mark({class:`cm-searchMatch`}),wa=E.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Ta=ae.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Y))}update(e){let t=e.state.field(Y);(t!=e.startState.field(Y)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return E.none;let{view:n}=this,r=new Pe;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?wa:Ca)})}return r.finish()}},{decorations:e=>e.decorations});function Ea(e){return t=>{let n=t.state.field(Y,!1);return n&&n.query.spec.valid?e(t,n):La(t)}}var Da=Ea((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=T.single(r.from,r.to),a=e.state.facet(K);return e.dispatch({selection:i,effects:[Ua(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Ia(e),!0}),Oa=Ea((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=T.single(i.from,i.to),o=e.state.facet(K);return e.dispatch({selection:a,effects:[Ua(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Ia(e),!0}),ka=Ea((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:T.create(n.map(e=>T.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Aa=({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 G(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(T.range(t.value.from,t.value.to))}return t(e.update({selection:T.create(a,o),userEvent:`select.search.matches`})),!0},ja=Ea((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(y.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=T.single(o.from,o.to).map(d),u.push(Ua(e,o)),u.push(n.facet(K).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),Ma=Ea((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:y.announce.of(r),userEvent:`input.replace.all`}),!0});function Na(e){return e.state.facet(K).createPanel(e)}function Pa(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(K);return new ua({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 Fa(e){let t=Be(e,Na);return t&&t.dom.querySelector(`[main-field]`)}function Ia(e){let t=Fa(e);t&&t==e.root.activeElement&&t.select()}var La=e=>{let t=e.state.field(Y,!1);if(t&&t.panel){let n=Fa(e);if(n&&n!=e.root.activeElement){let r=Pa(e.state,t.query.spec);r.valid&&e.dispatch({effects:ba.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[xa.of(!0),t?ba.of(Pa(e.state,t.query.spec)):C.appendConfig.of(Ga)]});return!0},Ra=e=>{let t=e.state.field(Y,!1);if(!t||!t.panel)return!1;let n=Be(e,Na);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:xa.of(!1)}),!0},za=[{key:`Mod-f`,run:La,scope:`editor search-panel`},{key:`F3`,run:Da,shift:Oa,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:Da,shift:Oa,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Ra,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Aa},{key:`Mod-Alt-g`,run:Xi},{key:`Mod-d`,run:ca,preventDefault:!0}],Ba=class{constructor(e){this.view=e;let t=this.query=e.state.field(Y).query.spec;this.commit=this.commit.bind(this),this.searchField=b(`input`,{value:t.search,placeholder:X(e,`Find`),"aria-label":X(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:X(e,`Replace`),"aria-label":X(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`,()=>Da(e),[X(e,`next`)]),n(`prev`,()=>Oa(e),[X(e,`previous`)]),n(`select`,()=>ka(e),[X(e,`all`)]),b(`label`,null,[this.caseField,X(e,`match case`)]),b(`label`,null,[this.reField,X(e,`regexp`)]),b(`label`,null,[this.wordField,X(e,`by word`)]),...e.state.readOnly?[]:[b(`br`),this.replaceField,n(`replace`,()=>ja(e),[X(e,`replace`)]),n(`replaceAll`,()=>Ma(e),[X(e,`replace all`)])],b(`button`,{name:`close`,onclick:()=>Ra(e),"aria-label":X(e,`close`),type:`button`},[`×`])])}commit(){let e=new ua({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:ba.of(e)}))}keydown(e){te(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Oa:Da)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),ja(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(ba)&&!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(K).top}};function X(e,t){return e.state.phrase(t)}var Va=30,Ha=/[\s\.,:;?!]/;function Ua(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-Va),o=Math.min(i,n+Va),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Va;e++)if(!Ha.test(s[e+1])&&Ha.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Va;e--)if(!Ha.test(s[e-1])&&Ha.test(s[e])){s=s.slice(0,e);break}}return y.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Wa=y.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`}}),Ga=[Y,ve.low(Ta),Wa],Ka={js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`jsx`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsx:`tsx`,c:`cpp`,h:`cpp`,cpp:`cpp`,cc:`cpp`,cxx:`cpp`,hpp:`cpp`,hh:`cpp`,java:`java`,kt:`kotlin`,kts:`kotlin`,cs:`csharp`,html:`html`,htm:`html`,xhtml:`html`,php:`php`,xml:`xml`,svg:`xml`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`toml`,py:`python`,rb:`ruby`,lua:`lua`,swift:`swift`,rs:`rust`,go:`go`,sql:`sql`,sh:`shell`,bash:`shell`,dockerfile:`dockerfile`};function qa(e){let t=(e.replace(/[?#].*$/,``).split(`/`).pop()??``).toLowerCase();if(t===`dockerfile`||t.startsWith(`dockerfile.`))return`dockerfile`;let n=t.lastIndexOf(`.`);return n<=0?null:Ka[t.slice(n+1)]??null}var Z=e=>_e.define(e),Ja={javascript:async()=>(await r(async()=>{let{javascript:e}=await import(`./dist-DYPX2Ybv.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([0,1,2,3]),import.meta.url)).javascript(),jsx:async()=>(await r(async()=>{let{javascript:e}=await import(`./dist-DYPX2Ybv.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([0,1,2,3]),import.meta.url)).javascript({jsx:!0}),typescript:async()=>(await r(async()=>{let{javascript:e}=await import(`./dist-DYPX2Ybv.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([0,1,2,3]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await r(async()=>{let{javascript:e}=await import(`./dist-DYPX2Ybv.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([0,1,2,3]),import.meta.url)).javascript({jsx:!0,typescript:!0}),cpp:async()=>(await r(async()=>{let{cpp:e}=await import(`./dist-rmKzqdIO.js`);return{cpp:e}},__vite__mapDeps([4,2,3]),import.meta.url)).cpp(),java:async()=>(await r(async()=>{let{java:e}=await import(`./dist-IR189dk6.js`);return{java:e}},__vite__mapDeps([5,2,3]),import.meta.url)).java(),kotlin:async()=>Z((await r(async()=>{let{kotlin:e}=await import(`./clike-pnxEhJ5P.js`);return{kotlin:e}},[],import.meta.url)).kotlin),csharp:async()=>Z((await r(async()=>{let{csharp:e}=await import(`./clike-pnxEhJ5P.js`);return{csharp:e}},[],import.meta.url)).csharp),html:async()=>(await r(async()=>{let{html:e}=await import(`./dist-D9412h7o.js`);return{html:e}},__vite__mapDeps([6,2,3,7,1,0]),import.meta.url)).html(),php:async()=>(await r(async()=>{let{php:e}=await import(`./dist-CYq92lOO.js`);return{php:e}},__vite__mapDeps([8,2,3,6,7,1,0]),import.meta.url)).php(),xml:async()=>(await r(async()=>{let{xml:e}=await import(`./dist-CxEuuaKq.js`);return{xml:e}},__vite__mapDeps([9,2,3]),import.meta.url)).xml(),css:async()=>(await r(async()=>{let{css:e}=await import(`./dist-BfGIsxxP.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([7,1,2,3]),import.meta.url)).css(),scss:async()=>(await r(async()=>{let{css:e}=await import(`./dist-BfGIsxxP.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([7,1,2,3]),import.meta.url)).css(),less:async()=>(await r(async()=>{let{css:e}=await import(`./dist-BfGIsxxP.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([7,1,2,3]),import.meta.url)).css(),json:async()=>(await r(async()=>{let{json:e}=await import(`./dist-33oU5N7i.js`);return{json:e}},__vite__mapDeps([10,2,3]),import.meta.url)).json(),markdown:async()=>(await r(async()=>{let{markdown:e}=await import(`./dist-CEr2uR4w.js`);return{markdown:e}},__vite__mapDeps([11,2,6,3,7,1,0]),import.meta.url)).markdown(),yaml:async()=>(await r(async()=>{let{yaml:e}=await import(`./dist-1MAn9CBM.js`);return{yaml:e}},__vite__mapDeps([12,2,3]),import.meta.url)).yaml(),toml:async()=>Z((await r(async()=>{let{toml:e}=await import(`./toml-BPTmHmyx.js`);return{toml:e}},[],import.meta.url)).toml),python:async()=>(await r(async()=>{let{python:e}=await import(`./dist-drsoOe-s.js`);return{python:e}},__vite__mapDeps([13,2,3]),import.meta.url)).python(),ruby:async()=>Z((await r(async()=>{let{ruby:e}=await import(`./ruby-ChfNwlCY.js`);return{ruby:e}},[],import.meta.url)).ruby),lua:async()=>Z((await r(async()=>{let{lua:e}=await import(`./lua-DPCEkfD_.js`);return{lua:e}},[],import.meta.url)).lua),swift:async()=>Z((await r(async()=>{let{swift:e}=await import(`./swift-DKB6_1j6.js`);return{swift:e}},[],import.meta.url)).swift),rust:async()=>(await r(async()=>{let{rust:e}=await import(`./dist-C5-Hv917.js`);return{rust:e}},__vite__mapDeps([14,2,3]),import.meta.url)).rust(),go:async()=>(await r(async()=>{let{go:e}=await import(`./dist-BnQxBrCW.js`);return{go:e}},__vite__mapDeps([15,2,3]),import.meta.url)).go(),sql:async()=>(await r(async()=>{let{sql:e}=await import(`./dist-B9NMd4es.js`);return{sql:e}},__vite__mapDeps([16,2,3]),import.meta.url)).sql(),shell:async()=>Z((await r(async()=>{let{shell:e}=await import(`./shell-DwuoZtxw.js`);return{shell:e}},[],import.meta.url)).shell),dockerfile:async()=>Z((await r(async()=>{let{dockerFile:e}=await import(`./dockerfile-BDePf5PZ.js`);return{dockerFile:e}},[],import.meta.url)).dockerFile)};function Ya(e){return e===null?Promise.resolve([]):Ja[e]()}var Q=t(),Xa=u.define(),$=(e,t)=>`color-mix(in srgb, var(${e}) ${t}%, transparent)`,Za=y.theme({"&":{height:`100%`,color:`var(--oo-color-text)`,backgroundColor:`var(--oo-color-canvas)`,fontSize:`var(--oo-font-size-xs)`},".cm-scroller":{fontFamily:`var(--oo-font-mono, monospace)`,lineHeight:`1.5`},".cm-content":{caretColor:`var(--oo-color-accent)`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`var(--oo-color-accent)`},".cm-selectionBackground, &.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection":{backgroundColor:$(`--oo-color-accent`,28)},".cm-activeLine":{backgroundColor:$(`--oo-color-text`,5)},".cm-gutters":{backgroundColor:`var(--oo-color-canvas)`,color:`var(--oo-color-muted)`,borderRight:`1px solid var(--oo-color-border)`},".cm-activeLineGutter":{backgroundColor:$(`--oo-color-text`,5),color:`var(--oo-color-text)`},".cm-foldPlaceholder":{backgroundColor:`var(--oo-color-hover)`,border:`1px solid var(--oo-color-border)`,color:`var(--oo-color-muted)`},".cm-selectionMatch":{backgroundColor:$(`--oo-color-accent`,14)},"&.cm-focused .cm-matchingBracket":{backgroundColor:$(`--oo-color-accent`,30),outline:`1px solid var(--oo-color-accent)`},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:$(`--oo-color-danger`,30)},".cm-searchMatch":{backgroundColor:$(`--oo-color-warning`,30)},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:$(`--oo-color-warning`,60)},".cm-panels":{backgroundColor:`var(--oo-color-panel)`,color:`var(--oo-color-text)`},".cm-panels.cm-panels-top":{borderBottom:`1px solid var(--oo-color-border)`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid var(--oo-color-border)`},".cm-textfield":{backgroundColor:`var(--oo-color-canvas)`,color:`var(--oo-color-text)`,border:`1px solid var(--oo-color-border)`,borderRadius:`var(--oo-radius-sm)`},".cm-button":{backgroundImage:`none`,backgroundColor:`var(--oo-color-surface)`,color:`var(--oo-color-text)`,border:`1px solid var(--oo-color-border)`,borderRadius:`var(--oo-radius-sm)`},".cm-tooltip":{backgroundColor:`var(--oo-color-raised)`,color:`var(--oo-color-text)`,border:`1px solid var(--oo-color-border)`},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:`var(--oo-color-selected)`,color:`var(--oo-color-text)`}}),Qa=Me.define([{tag:[k.keyword,k.controlKeyword,k.moduleKeyword,k.operatorKeyword,k.definitionKeyword,k.modifier],color:`var(--ahpw-code-keyword)`},{tag:[k.string,k.special(k.string),k.regexp,k.character],color:`var(--ahpw-code-string)`},{tag:[k.number,k.bool,k.null,k.atom,k.unit],color:`var(--ahpw-code-number)`},{tag:[k.comment,k.lineComment,k.blockComment,k.docComment],color:`var(--ahpw-code-comment)`,fontStyle:`italic`},{tag:[k.function(k.variableName),k.function(k.propertyName),k.macroName],color:`var(--ahpw-code-function)`},{tag:[k.typeName,k.className,k.namespace,k.standard(k.typeName)],color:`var(--ahpw-code-type)`},{tag:[k.propertyName,k.definition(k.propertyName),k.labelName],color:`var(--ahpw-code-property)`},{tag:[k.tagName,k.angleBracket],color:`var(--ahpw-code-tag)`},{tag:k.attributeName,color:`var(--ahpw-code-attribute)`},{tag:[k.meta,k.processingInstruction,k.annotation],color:`var(--ahpw-code-meta)`},{tag:k.heading,color:`var(--ahpw-code-keyword)`,fontWeight:`600`},{tag:[k.link,k.url],color:`var(--ahpw-code-string)`,textDecoration:`underline`},{tag:k.emphasis,fontStyle:`italic`},{tag:k.strong,fontWeight:`600`},{tag:k.strikethrough,textDecoration:`line-through`},{tag:k.invalid,color:`var(--oo-color-danger)`}]),$a=e=>[he.readOnly.of(e),y.editable.of(!e)];function eo(e,t,n){let r=e.state.doc,i=r.line(Math.min(Math.max(t,1),r.lines)),a=r.line(Math.min(Math.max(n??t,i.number),r.lines));e.dispatch({selection:T.range(i.from,a.to),effects:y.scrollIntoView(i.from,{y:`center`})})}function to({value:e,language:t=null,readOnly:n=!1,line:r,end:i,onChange:a,onSave:o}){let s=(0,A.useRef)(null),c=(0,A.useRef)(null),l=(0,A.useRef)(new Ae),u=(0,A.useRef)(new Ae),d=(0,A.useRef)({onChange:a,onSave:o});return d.current={onChange:a,onSave:o},(0,A.useEffect)(()=>{let t=s.current;if(t===null)return;let r=new y({parent:t,state:he.create({doc:e,extensions:[_(),v(),ce(),Bn(),xe(),ee(),re(),he.allowMultipleSelections.of(!0),p(),Ce(Qa),we(),rn(),xn(),ke(),le(),$i(),la({top:!0}),ue.of([{key:`Mod-s`,preventDefault:!0,run:e=>(d.current.onSave?.(e.state.doc.toString()),!0)},...un,...zi,...za,...rr,...me,...Sn,Bi]),Za,l.current.of([]),u.current.of($a(n)),y.updateListener.of(e=>{e.docChanged&&!e.transactions.some(e=>e.annotation(Xa)===!0)&&d.current.onChange?.(e.state.doc.toString())})]})});return c.current=r,()=>{r.destroy(),c.current=null}},[]),(0,A.useEffect)(()=>{let t=c.current;t!==null&&t.state.doc.toString()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e},annotations:Xa.of(!0)})},[e]),(0,A.useEffect)(()=>{let e=!0;return Ya(t).then(t=>{e&&c.current?.dispatch({effects:l.current.reconfigure(t)})}).catch(()=>void 0),()=>{e=!1}},[t]),(0,A.useEffect)(()=>{c.current?.dispatch({effects:u.current.reconfigure($a(n))})},[n]),(0,A.useEffect)(()=>{let e=c.current;e!==null&&typeof r==`number`&&eo(e,r,i)},[r,i,e]),(0,Q.jsx)(`div`,{className:`web-editor`,ref:s})}var no=5e6;function ro(e){return e.length>5e6?{text:e.slice(0,no),cut:!0}:{text:e,cut:!1}}function io(e){return typeof e==`object`&&!!e&&e.code===o.PermissionDenied}function ao(e){return typeof e==`object`&&!!e&&e.code===o.Conflict}var oo=e({default:()=>so});function so({uri:e,line:t,end:n}){let r=Ve(e),[o,u]=(0,A.useState)(!1),[d,f]=(0,A.useState)(null),p=(0,A.useRef)(``),m=(0,A.useRef)(``),h=(0,A.useRef)(!1),g=(0,A.useRef)(void 0);i(()=>o?`The changes to this file are not saved.`:null);let _=r!==null&&`text`in r&&r.text!==null?ro(r.text):null;(0,A.useEffect)(()=>{if(p.current=_?.text??``,m.current=p.current,u(!1),f(null),g.current=void 0,e===void 0||_===null)return;let t=!0;return s(e).then(e=>{t&&(g.current=e)}).catch(()=>void 0),()=>{t=!1}},[e,_?.text]);let v=(0,A.useCallback)(e=>{m.current=e,u(e!==p.current)},[]),ee=(0,A.useCallback)(t=>{e===void 0||h.current||(h.current=!0,a(e,t,g.current).then(async()=>{p.current=t,u(m.current!==t),f(null),g.current=await s(e).catch(()=>void 0)}).catch(e=>{let t=ao(e)?`The file changed on the server since it was opened. Copy your edit, then reopen the file.`:e instanceof Error?e.message:String(e);f({message:t,refused:io(e)})}).finally(()=>{h.current=!1}))},[e]);if(e===void 0)return(0,Q.jsx)(l,{tone:`warning`,message:`No file was named.`});let te=(0,Q.jsx)(He,{uri:e,dirty:o});return r===null?(0,Q.jsxs)(`div`,{className:`web-file`,children:[te,(0,Q.jsx)(c,{label:`Reading the file`})]}):`error`in r?(0,Q.jsxs)(`div`,{className:`web-file`,children:[te,(0,Q.jsx)(l,{tone:`danger`,title:`Not readable`,message:r.error})]}):_===null?(0,Q.jsxs)(`div`,{className:`web-file`,children:[te,(0,Q.jsx)(`p`,{className:`web-note`,children:`This file is not text.`})]}):(0,Q.jsxs)(`div`,{className:`web-file`,children:[te,d===null?null:(0,Q.jsx)(l,{tone:`danger`,title:d.refused?`Read-only`:`Not saved`,message:d.message}),_.cut?(0,Q.jsx)(`p`,{className:`web-note`,children:`This file is over 5 MB. It shows the start, read-only.`}):null,(0,Q.jsx)(`div`,{className:`web-file__body web-file__body--editor`,children:(0,Q.jsx)(to,{value:_.text,language:qa(e),readOnly:_.cut||d?.refused===!0,line:t??null,end:n??null,onChange:v,onSave:ee})})]})}export{$t as a,so as default,qe as i,Ue as n,Ke as r,oo as t};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-DUFzb_Eu.js","./jsx-runtime-BguD1OXD.js","./dist-BDH0Q8eg.js","./dist-Bq_hlZV8.js","./dist-rmKzqdIO.js","./dist-IR189dk6.js","./dist-B4E-6SqB.js","./dist-BfGIsxxP.js","./dist-uvIW_qsj.js","./dist-CxEuuaKq.js","./dist-33oU5N7i.js","./dist-BwHJSc3S.js","./dist-1MAn9CBM.js","./dist-DX2Uz40S.js","./dist-C5-Hv917.js","./dist-Db_OB0lX.js","./dist-BdNRSgzN.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e,t}from"./jsx-runtime-BguD1OXD.js";import{t as n}from"./react-CybPckBe.js";import{t as r}from"./preload-helper-BaNbYf_w.js";import{t as i}from"./useCloseGuard-B4qJKmaF.js";import{F as a,st as o,y as s}from"./data-hUAVersf.js";import{t as c}from"./Spinner-B-iOhBZq.js";import{t as l}from"./Alert-CHZkhmDE.js";import{$ as u,A as d,B as f,C as p,D as m,Dt as h,F as g,G as _,H as v,I as ee,J as te,K as ne,L as re,M as ie,N as y,P as ae,Q as b,R as oe,T as se,U as ce,V as le,W as ue,X as de,Y as fe,Z as pe,_ as me,_t as x,at as he,b as ge,bt as S,c as _e,ct as ve,dt as ye,et as be,ft as C,gt as w,h as xe,ht as Se,it as T,j as E,k as Ce,l as we,lt as Te,mt as Ee,n as De,nt as D,ot as O,pt as Oe,q as ke,rt as Ae,st as je,t as Me,tt as Ne,ut as Pe,vt as Fe,w as Ie,wt as k,x as Le,xt as Re,yt as ze,z as Be}from"./dist-BDH0Q8eg.js";import{n as Ve,t as He}from"./text-BdULOY8N.js";var A=n(),Ue=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=d(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(Ye(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 We(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 Ge(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=We(t)+We(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function Ke(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:Ge(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function qe(e,t){return n=>{for(let t=d(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 Je=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function j(e){return e.selection.main.from}function Ye(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 Xe=u.define();function Ze(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:T.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var Qe=new WeakMap;function $e(e){if(!Array.isArray(e))return e;let t=Qe.get(e);return t||Qe.set(e,t=Ke(e)),t}var et=C.define(),tt=C.define(),nt=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=w(e,t),r=x(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(w(a==i?i.toLowerCase():a,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:i,byWord:a}=this;if(t.length==1){let r=w(e,0),i=x(r),a=i==e.length?0:-100;if(r!=t[0]){if(r==n[0])a+=-200;else return null}return this.ret(a,[0,i])}let o=e.indexOf(this.pattern);if(o==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let s=t.length,c=0;if(o<0){for(let i=0,a=Math.min(e.length,200);i<a&&c<s;){let a=w(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=x(a)}if(c<s)return null}let l=0,u=0,d=!1,f=0,p=-1,m=-1,h=/[a-z]/.test(e),g=!0;for(let r=0,c=Math.min(e.length,200),_=0;r<c&&u<s;){let c=w(e,r);o<0&&(l<s&&c==t[l]&&(i[l++]=r),f<s&&(c==t[f]||c==n[f]?(f==0&&(p=r),m=r+1,f++):f=0));let v,ee=c<255?c>=48&&c<=57||c>=97&&c<=122?2:+(c>=65&&c<=90):(v=Re(c))==v.toLowerCase()?v==v.toUpperCase()?0:2:1;(!r||ee==1&&h||_==0&&ee!=0)&&(t[u]==c||n[u]==c&&(d=!0)?a[u++]=r:a.length&&(g=!1)),_=ee,r+=x(c)}return u==s&&a[0]==0&&g?this.result(-100+(d?-200:0),a,e):f==s&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):f==s?this.ret(-900-e.length,[p,m]):u==s?this.result(-100+(d?-200:0)+-700+(g?0:-1100),a,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?x(w(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}},rt=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)}},M=O.define({combine(e){return Fe(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:at,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=>it(e(n),t(n)),optionClass:(e,t)=>n=>it(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function it(e,t){return e?t?e+` `+t:e:t}function at(e,t,n,r,i,a){let o=e.textDirection==ie.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,_=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${d/_}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var ot=C.define();function st(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 ct(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 lt=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(M);this.optionContent=st(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=ct(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:ot.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(M).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:tt.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=ct(r.length,i,e.state.facet(M).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),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=ct(t.options.length,t.selected,this.view.state.facet(M).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>ne(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(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&&dt(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(M).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 ut(e,t){return n=>new lt(n,e,t)}function dt(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 ft(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function pt(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(M);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 Je(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new rt(n):new nt(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 Je(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):ft(e.completion)>ft(c)&&(s[s.length-1]=e),c=e.completion}return s}var mt=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,yt(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=pt(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(M).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,yt(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:Et,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)}},ht=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(bt,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(M),i=(r.override||n.languageDataAt(`autocomplete`,j(n)).map($e)).map(e=>(this.active.find(t=>t.source==e)||new N(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(wt));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!gt(i,this.active)||o?a=mt.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 N(e.source,0):e));for(let e of t.effects)e.is(ot)&&(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?_t:vt}};function gt(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 _t={"aria-autocomplete":`list`},vt={};function yt(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var bt=[];function xt(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(Xe);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 N=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=xt(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(et))i=new e(i.source,1,n.value);else if(n.is(tt))i=new e(i.source,0);else if(n.is(wt))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(j(e.state))}},St=class e extends N{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=j(t.state);if(o>a||!r||n&2&&(j(t.startState)==this.from||o<this.limit))return new N(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return Ct(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 Ue(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??j(t.state)):new N(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 N(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function Ct(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):Ye(e,!0).test(i)}var wt=C.define({map(e,t){return e.map(e=>e.map(t))}}),P=Oe.define({create(){return ht.start()},update(e,t){return e.update(t)},provide:e=>[pe.from(e,e=>e.tooltip),y.contentAttributes.from(e,e=>e.attrs)]});function Tt(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(P).active.find(e=>e.source==t.source);return r instanceof St&&(typeof n==`string`?e.dispatch({...Ze(e.state,n,r.from,r.to),annotations:Xe.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var Et=ut(P,Tt);function Dt(e,t=`option`){return n=>{let r=n.state.field(P,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(M).interactionDelay)return!1;let i=1,a;t==`page`&&(a=f(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:ot.of(s)}),!0}}var Ot=e=>{let t=e.state.field(P,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(M).interactionDelay?!1:Tt(e,t.open.options[t.open.selected])},kt=e=>e.state.field(P,!1)?(e.dispatch({effects:et.of(!0)}),!0):!1,At=e=>{let t=e.state.field(P,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:tt.of(null)}),!0)},jt=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},Mt=50,Nt=1e3,Pt=ae.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(P).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(P),n=e.state.facet(M);if(!e.selectionSet&&!e.docChanged&&e.startState.field(P)==t)return;let r=e.transactions.some(e=>{let t=xt(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>Mt&&Date.now()-n.time>Nt){for(let e of n.context.abortListeners)try{e()}catch(e){ne(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(et)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-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(P);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(M).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new Ue(t,j(t),e.explicit,this.view),r=new jt(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:tt.of(null)}),ne(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(M).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(M),n=this.view.state.field(P);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=j(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new St(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 N(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:wt.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(P,!1);if(t&&t.tooltip&&this.view.state.facet(M).closeOnBlur){let n=t.open&&f(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:tt.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:et.of(!1)}),20),this.composing=0}}}),Ft=typeof navigator==`object`&&/Win/.test(navigator.platform),It=ve.highest(y.domEventHandlers({keydown(e,t){let n=t.state.field(P,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Ft&&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&&Tt(t,r),!1}})),Lt=y.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`}}}),Rt=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},zt=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,je.TrackDel),r=t.mapPos(this.to,1,je.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},Bt=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,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(se);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new zt(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 Rt(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)}},Vt=E.widget({widget:new class extends g{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),Ht=E.mark({class:`cm-snippetField`}),Ut=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=E.set(e.map(e=>(e.from==e.to?Vt:Ht).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))}},Wt=C.define({map(e,t){return e&&e.map(t)}}),Gt=C.define(),Kt=Oe.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(Wt))return n.value;if(n.is(Gt)&&e)return new Ut(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=>y.decorations.from(e,e=>e?e.deco:E.none)});function qt(e,t){return T.create(e.filter(e=>e.field==t).map(e=>T.range(e.from,e.to)))}function Jt(e){let t=Bt.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:Ee.of(a)},scrollIntoView:!0,annotations:n?[Xe.of(n),Se.userEvent.of(`input.complete`)]:void 0};if(o.length&&(c.selection=qt(o,0)),o.some(e=>e.field>0)){let t=new Ut(o,0),n=c.effects=[Wt.of(t)];e.state.field(Kt,!1)===void 0&&n.push(C.appendConfig.of([Kt,Qt,en,Lt]))}e.dispatch(e.state.update(c))}}function Yt(e){return({state:t,dispatch:n})=>{let r=t.field(Kt,!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:qt(r.ranges,i),effects:Wt.of(a?null:new Ut(r.ranges,i)),scrollIntoView:!0})),!0}}var Xt=[{key:`Tab`,run:Yt(1),shift:Yt(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(Kt,!1)?(t(e.update({effects:Wt.of(null)})),!0):!1}],Zt=O.define({combine(e){return e.length?e[0]:Xt}}),Qt=ve.highest(ue.compute([Zt],e=>e.facet(Zt)));function $t(e,t){return{...t,apply:Jt(e)}}var en=y.domEventHandlers({mousedown(e,t){let n=t.state.field(Kt,!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:qt(n.ranges,i.field),effects:Wt.of(n.ranges.some(e=>e.field>i.field)?new Ut(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),F={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},I=C.define({map(e,t){return t.mapPos(e,-1,je.TrackAfter)??void 0}}),tn=new class extends ye{};tn.startSide=1,tn.endSide=-1;var nn=Oe.define({create(){return Te.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(I)&&(e=e.update({add:[tn.range(n.value,n.value+1)]}));return e}});function rn(){return[ln,nn]}var an=`()[]{}<>«»»«[]{}`;function on(e){for(let t=0;t<16;t+=2)if(an.charCodeAt(t)==e)return an.charAt(t+1);return Re(e<128?e:e+1)}function sn(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||F}var cn=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),ln=y.inputHandler.of((e,t,n,r)=>{if((cn?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&x(w(r,0))==1||t!=i.from||n!=i.to)return!1;let a=dn(e.state,r);return a?(e.dispatch(a),!0):!1}),un=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=sn(e,e.selection.main.head).brackets||F.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=mn(e.doc,t.head);for(let i of n)if(i==r&&pn(e.doc,t.head)==on(w(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:T.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:`delete.backward`})),!r}}];function dn(e,t){let n=sn(e,e.selection.main.head),r=n.brackets||F.brackets;for(let i of r){let a=on(w(i,0));if(t==i)return a==i?_n(e,i,r.indexOf(i+i+i)>-1,n):hn(e,i,a,n.before||F.before);if(t==a&&fn(e,e.selection.main.from))return gn(e,i,a)}return null}function fn(e,t){let n=!1;return e.field(nn).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function pn(e,t){let n=e.sliceString(t,t+2);return n.slice(0,x(w(n,0)))}function mn(e,t){let n=e.sliceString(t-2,t);return x(w(n,0))==n.length?n:n.slice(1)}function hn(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:I.of(a.to+t.length),range:T.range(a.anchor+t.length,a.head+t.length)};let o=pn(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:I.of(a.head+t.length),range:T.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function gn(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&pn(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:T.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function _n(e,t,n,r){let i=r.stringPrefixes||F.stringPrefixes,a=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:I.of(r.to+t.length),range:T.range(r.anchor+t.length,r.head+t.length)};let o=r.head,s=pn(e.doc,o),c;if(s==t){if(vn(e,o))return{changes:{insert:t+t,from:o},effects:I.of(o+t.length),range:T.cursor(o+t.length)};if(fn(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:T.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(c=bn(e,o-2*t.length,i))>-1&&vn(e,c))return{changes:{insert:t+t+t+t,from:o},effects:I.of(o+t.length),range:T.cursor(o+t.length)};else if(e.charCategorizer(o)(s)!=D.Word&&bn(e,o,i)>-1&&!yn(e,o,t,i))return{changes:{insert:t+t,from:o},effects:I.of(o+t.length),range:T.cursor(o+t.length)};return{range:a=r}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function vn(e,t){let n=d(e).resolveInner(t+1);return n.parent&&n.from==t}function yn(e,t,n,r){let i=d(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 bn(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=D.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))!=D.Word)return n}return-1}function xn(e={}){return[It,P,M.of(e),Pt,Cn,Lt]}var Sn=[{key:`Ctrl-Space`,run:kt},{mac:"Alt-`",run:kt},{mac:`Alt-i`,run:kt},{key:`Escape`,run:At},{key:`ArrowDown`,run:Dt(!0)},{key:`ArrowUp`,run:Dt(!1)},{key:`PageDown`,run:Dt(!0,`page`)},{key:`PageUp`,run:Dt(!1,`page`)},{key:`Enter`,run:Ot}],Cn=ve.highest(ue.computeN([M],e=>e.facet(M).defaultKeymap?[Sn]:[])),wn=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=kn(e.state,n.from);return r.line?En(e):r.block?On(e):!1};function Tn(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 En=Tn(Pn,0),Dn=Tn(Nn,0),On=Tn((e,t)=>Nn(e,t,Mn(t)),0);function kn(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var An=50;function jn(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-An,r),o=e.sliceDoc(i,i+An),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+An),d=e.sliceDoc(i-An,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 Mn(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 Nn(e,t,n=t.selection.ranges){let r=n.map(e=>kn(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>jn(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 Pn(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=kn(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 Fn=u.define(),In=u.define(),Ln=O.define(),Rn=O.define({combine(e){return Fe(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)})}}),zn=Oe.define({create(){return nr.empty},update(e,t){let n=t.state.facet(Rn),r=t.annotation(Fn);if(r){let i=L.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?Kn(o,o.length,n.minDepth,i):Zn(o,t.startState.selection),new nr(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(In);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(Se.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=L.fromTransaction(t),o=t.annotation(Se.time),s=t.annotation(Se.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 nr(e.done.map(L.fromJSON),e.undone.map(L.fromJSON))}});function Bn(e={}){return[zn,Rn.of(e),y.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?Hn:e.inputType==`historyRedo`?Un:null;return n?(e.preventDefault(),n(t)):!1}})]}function Vn(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(zn,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var Hn=Vn(0,!1),Un=Vn(1,!1),Wn=Vn(0,!0),Gn=Vn(1,!0),L=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&&Ne.fromJSON(t.changes),[],t.mapped&&be.fromJSON(t.mapped),t.startSelection&&T.fromJSON(t.startSelection),t.selectionsAfter.map(T.fromJSON))}static fromTransaction(t,n){let r=R;for(let e of t.startState.facet(Ln)){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,R)}static selection(t){return new e(void 0,R,void 0,void 0,t)}};function Kn(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 qn(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 Jn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Yn(e,t){return e.length?t.length?e.concat(t):e:t}var R=[],Xn=200;function Zn(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Xn));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Kn(e,e.length-1,1e9,n.setSelAfter(r)))}return[L.selection([t])]}function Qn(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 $n(e,t){if(!e.length)return e;let n=e.length,r=R;for(;n;){let i=er(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?[L.selection(r)]:R}function er(e,t,n){let r=Yn(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):R,n);if(!e.changes)return L.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new L(i,C.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var tr=/^(input\.type|delete)($|\.)/,nr=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||tr.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,qn(s.changes,t.changes))||r==`input.type.compose`)?Kn(o,o.length-1,i.minDepth,new L(t.changes.compose(s.changes),Yn(C.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,R)):Kn(o,o.length,i.minDepth,t),new e(o,R,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:R;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Jn(a[a.length-1],t)?this:new e(Zn(this.done,t),this.undone,n,r)}addMapping(t){return new e($n(this.done,t),$n(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:Fn.of({side:e,rest:Qn(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?R:r.slice(0,r.length-1);return i.mapped&&(n=$n(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Fn.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};nr.empty=new nr(R,R);var rr=[{key:`Mod-z`,run:Hn,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:Un,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:Un,preventDefault:!0},{key:`Mod-u`,run:Wn,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Gn,preventDefault:!0}];function z(e,t){return T.create(e.ranges.map(t),e.mainIndex)}function B(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function V({state:e,dispatch:t},n){let r=z(e.selection,n);return!r.eq(e.selection,!0)&&(t(B(e,r)),!0)}function ir(e,t){return T.cursor(t?e.to:e.from)}function ar(e,t){return V(e,n=>n.empty?e.moveByChar(n,t):ir(n,t))}function H(e){return e.textDirectionAt(e.state.selection.main.head)==ie.LTR}var or=e=>ar(e,!H(e)),sr=e=>ar(e,H(e));function cr(e,t){return V(e,n=>n.empty?e.moveByGroup(n,t):ir(n,t))}var lr=e=>cr(e,!H(e)),ur=e=>cr(e,H(e));typeof Intl<`u`&&Intl.Segmenter;function dr(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 fr(e,t,n){let r=d(e).resolveInner(t.head),i=n?h.closedBy:h.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;dr(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?m(e,r.from,1):m(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,T.cursor(s,n?-1:1)}var pr=e=>V(e,t=>fr(e.state,t,!H(e))),mr=e=>V(e,t=>fr(e.state,t,H(e)));function hr(e,t){return V(e,n=>{if(!n.empty)return ir(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var gr=e=>hr(e,!1),_r=e=>hr(e,!0);function vr(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(y.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 yr(e,t){let n=vr(e),{state:r}=e,i=z(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):ir(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=y.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(B(r,i),{effects:a}),!0}var br=e=>yr(e,!1),xr=e=>yr(e,!0);function U(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=T.cursor(r.from+n))}return i}var Sr=e=>V(e,t=>U(e,t,!0)),Cr=e=>V(e,t=>U(e,t,!1)),wr=e=>V(e,t=>U(e,t,!H(e))),Tr=e=>V(e,t=>U(e,t,H(e))),Er=e=>V(e,t=>e.moveToLineBoundary(t,!1,!1)),Dr=e=>V(e,t=>e.moveToLineBoundary(t,!0,!1));function Or(e,t,n){let r=!1,i=z(e.selection,t=>{let i=m(e,t.head,-1)||m(e,t.head,1)||t.head>0&&m(e,t.head-1,1)||t.head<e.doc.length&&m(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?T.range(t.anchor,a):T.cursor(a)});return r?(t(B(e,i)),!0):!1}var kr=({state:e,dispatch:t})=>Or(e,t,!1);function W(e,t,n){let r=z(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=T.range(e.head,e.anchor));let r=n(e);return T.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(B(e.state,r)),!0)}function Ar(e,t){return W(e,t,n=>e.moveByChar(n,t))}var jr=e=>Ar(e,!H(e)),Mr=e=>Ar(e,H(e));function Nr(e,t){return W(e,t,n=>e.moveByGroup(n,t))}var Pr=e=>Nr(e,!H(e)),Fr=e=>Nr(e,H(e)),Ir=e=>{let t=!H(e);return W(e,t,n=>fr(e.state,n,t))},Lr=e=>{let t=H(e);return W(e,t,n=>fr(e.state,n,t))};function Rr(e,t){return W(e,t,n=>e.moveVertically(n,t))}var zr=e=>Rr(e,!1),Br=e=>Rr(e,!0);function Vr(e,t){return W(e,t,n=>e.moveVertically(n,t,vr(e).height))}var Hr=e=>Vr(e,!1),Ur=e=>Vr(e,!0),Wr=e=>W(e,!0,t=>U(e,t,!0)),Gr=e=>W(e,!1,t=>U(e,t,!1)),Kr=e=>{let t=!H(e);return W(e,t,n=>U(e,n,t))},qr=e=>{let t=H(e);return W(e,t,n=>U(e,n,t))},Jr=e=>W(e,!1,t=>T.cursor(e.lineBlockAt(t.head).from)),Yr=e=>W(e,!0,t=>T.cursor(e.lineBlockAt(t.head).to)),Xr=({state:e,dispatch:t})=>(t(B(e,{anchor:0})),!0),Zr=({state:e,dispatch:t})=>(t(B(e,{anchor:e.doc.length})),!0),Qr=({state:e,dispatch:t})=>(t(B(e,{anchor:e.selection.main.anchor,head:0})),!0),$r=({state:e,dispatch:t})=>(t(B(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),ei=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),ti=({state:e,dispatch:t})=>{let n=bi(e).map(({from:t,to:n})=>T.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:T.create(n),userEvent:`select`})),!0},ni=({state:e,dispatch:t})=>{let n=z(e.selection,t=>{let n=d(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 T.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(B(e,n)),!0)};function ri(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(B(n,T.create(i,i.length-1))),!0)}var ii=e=>ri(e,!1),ai=e=>ri(e,!0),oi=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=T.create([n.main]):n.main.empty||(r=T.create([T.cursor(n.main.head)])),r?(t(B(e,r)),!0):!1};function si(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=ci(e,o,!1)):o>i&&(n=`delete.forward`,o=ci(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=ci(e,i,!1),a=ci(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:T.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?y.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function ci(e,t,n){if(e instanceof y)for(let r of e.state.facet(y.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var li=(e,t,n)=>si(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=ze(s,a.tabSize)%ge(a)||ge(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=S(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=S(o.text,c-o.from,!1,!1)+o.from);return c}),ui=e=>li(e,!1,!0),di=e=>li(e,!0,!1),fi=(e,t)=>si(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=S(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),pi=e=>fi(e,!1),mi=e=>fi(e,!0),hi=e=>si(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),gi=e=>si(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),_i=e=>si(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),vi=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:Ee.of([``,``])},range:T.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},yi=({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:S(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:S(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:T.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function bi(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 xi(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of bi(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(T.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(T.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:T.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var Si=({state:e,dispatch:t})=>xi(e,t,!1),Ci=({state:e,dispatch:t})=>xi(e,t,!0);function wi(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of bi(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 Ti=({state:e,dispatch:t})=>wi(e,t,!1),Ei=({state:e,dispatch:t})=>wi(e,t,!0),Di=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(bi(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=z(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 Oi(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=d(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(h.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 ki=ji(!1),Ai=ji(!0);function ji(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&&Oi(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new De(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=Le(s,r);for(c??=ze(/^\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 l=[``,Ie(t,c)];return o&&l.push(Ie(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:Ee.of(l)},range:T.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function Mi(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:T.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var Ni=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new De(e,{overrideIndentation:e=>n[e]??-1}),i=Mi(e,(t,i,a)=>{let o=Le(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=Ie(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},Pi=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Mi(e,(t,n)=>{n.push({from:t.from,insert:e.facet(se)})}),{userEvent:`input.indent`})),!0),Fi=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Mi(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=ze(r,e.tabSize),a=0,o=Ie(e,Math.max(0,i-ge(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),Ii=e=>(e.setTabFocusMode(),!0),Li=[{key:`Ctrl-b`,run:or,shift:jr,preventDefault:!0},{key:`Ctrl-f`,run:sr,shift:Mr},{key:`Ctrl-p`,run:gr,shift:zr},{key:`Ctrl-n`,run:_r,shift:Br},{key:`Ctrl-a`,run:Er,shift:Jr},{key:`Ctrl-e`,run:Dr,shift:Yr},{key:`Ctrl-d`,run:di},{key:`Ctrl-h`,run:ui},{key:`Ctrl-k`,run:hi},{key:`Ctrl-Alt-h`,run:pi},{key:`Ctrl-o`,run:vi},{key:`Ctrl-t`,run:yi},{key:`Ctrl-v`,run:xr}],Ri=[{key:`ArrowLeft`,run:or,shift:jr,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:lr,shift:Pr,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:wr,shift:Kr,preventDefault:!0},{key:`ArrowRight`,run:sr,shift:Mr,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:ur,shift:Fr,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Tr,shift:qr,preventDefault:!0},{key:`ArrowUp`,run:gr,shift:zr,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Xr,shift:Qr},{mac:`Ctrl-ArrowUp`,run:br,shift:Hr},{key:`ArrowDown`,run:_r,shift:Br,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Zr,shift:$r},{mac:`Ctrl-ArrowDown`,run:xr,shift:Ur},{key:`PageUp`,run:br,shift:Hr},{key:`PageDown`,run:xr,shift:Ur},{key:`Home`,run:Cr,shift:Gr,preventDefault:!0},{key:`Mod-Home`,run:Xr,shift:Qr},{key:`End`,run:Sr,shift:Wr,preventDefault:!0},{key:`Mod-End`,run:Zr,shift:$r},{key:`Enter`,run:ki,shift:ki},{key:`Mod-a`,run:ei},{key:`Backspace`,run:ui,shift:ui,preventDefault:!0},{key:`Delete`,run:di,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:pi,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:mi,preventDefault:!0},{mac:`Mod-Backspace`,run:gi,preventDefault:!0},{mac:`Mod-Delete`,run:_i,preventDefault:!0}].concat(Li.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),zi=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:pr,shift:Ir},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:mr,shift:Lr},{key:`Alt-ArrowUp`,run:Si},{key:`Shift-Alt-ArrowUp`,run:Ti},{key:`Alt-ArrowDown`,run:Ci},{key:`Shift-Alt-ArrowDown`,run:Ei},{key:`Mod-Alt-ArrowUp`,run:ii},{key:`Mod-Alt-ArrowDown`,run:ai},{key:`Escape`,run:oi},{key:`Mod-Enter`,run:Ai},{key:`Alt-l`,mac:`Ctrl-l`,run:ti},{key:`Mod-i`,run:ni,preventDefault:!0},{key:`Mod-[`,run:Fi},{key:`Mod-]`,run:Pi},{key:`Mod-Alt-\\`,run:Ni},{key:`Shift-Mod-k`,run:Di},{key:`Shift-Mod-\\`,run:kr},{key:`Mod-/`,run:wn},{key:`Alt-A`,mac:`Ctrl-A`,run:Dn},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Ii}].concat(Ri),Bi={key:`Tab`,run:Pi,shift:Fi},Vi=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,G=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(Vi(e)):Vi,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 w(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=Re(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=x(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`&&(G.prototype[Symbol.iterator]=function(){return this});var Hi={from:-1,to:-1,match:/.*/.exec(``),precise:!0},Ui=`gm`+(/x/.unicode==null?``:`u`),Wi=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=Hi,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new qi(e,t,n,r,i);this.re=new RegExp(t,Ui+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=Yi(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=Yi(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}}},Gi=new WeakMap,Ki=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=Gi.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Gi.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)),Gi.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},qi=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Hi,this.matchPos=Yi(e,r),this.re=new RegExp(t,Ui+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Ki.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=Yi(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ki.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Wi.prototype[Symbol.iterator]=qi.prototype[Symbol.iterator]=function(){return this});function Ji(e){try{return new RegExp(e,Ui),!0}catch{return!1}}function Yi(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 Xi=e=>{let t=oe(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}=fe(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=T.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[i,y.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},Zi={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Qi=O.define({combine(e){return Fe(e,Zi,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function $i(e){let t=[aa,ia];return e&&t.push(Qi.of(e)),t}var ea=E.mark({class:`cm-selectionMatch`}),ta=E.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function na(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=D.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=D.Word)}function ra(e,t,n,r){return e(t.sliceDoc(n,n+1))==D.Word&&e(t.sliceDoc(r-1,r))==D.Word}var ia=ae.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(Qi),{state:n}=e,r=n.selection;if(r.ranges.length>1)return E.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return E.none;let e=n.wordAt(i.head);if(!e)return E.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 E.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(na(o,n,i.from,i.to)&&ra(o,n,i.from,i.to)))return E.none}else if(a=n.sliceDoc(i.from,i.to),!a)return E.none}let s=[];for(let r of e.visibleRanges){let e=new G(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||na(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(ta.range(r,a)):(r>=i.to||a<=i.from)&&s.push(ea.range(r,a)),s.length>t.maxMatches))return E.none}}return E.set(s)}},{decorations:e=>e.decorations}),aa=y.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),oa=({state:e,dispatch:t})=>{let{selection:n}=e,r=T.create(n.ranges.map(t=>e.wordAt(t.head)||T.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function sa(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 G(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new G(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 ca=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return oa({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=sa(e,r);return i?(t(e.update({selection:e.selection.addRange(T.range(i.from,i.to),!1),effects:y.scrollIntoView(i.to)})),!0):!1},K=O.define({combine(e){return Fe(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ba(e),scrollToMatch:e=>y.scrollIntoView(e)})}});function la(e){return e?[K.of(e),Ga]:Ga}var ua=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||Ji(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 ya(this):new ma(this)}getCursor(e,t=0,n){let r=e.doc?e:he.create({doc:e});return n??=r.doc.length,this.regexp?J(this,r,t,n):q(this,r,t,n)}},da=class{constructor(e){this.spec=e}};function fa(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 q(e,t,n,r){let i;return e.wholeWord&&(i=pa(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=fa(e.test,t,i)),new G(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function pa(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(ga(i,n-a))!=D.Word||t(_a(i,n-a))!=D.Word)&&(t(_a(i,r-a))!=D.Word||t(ga(i,r-a))!=D.Word))}var ma=class extends da{constructor(e){super(e)}nextMatch(e,t,n){let r=q(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=q(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=q(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=q(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=q(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 ha(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function J(e,t,n,r){let i;return e.wholeWord&&(i=va(t.charCategorizer(t.selection.main.head))),e.test&&(i=ha(e.test,t,i)),new Wi(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function ga(e,t){return e.slice(S(e,t,!1),t)}function _a(e,t){return e.slice(t,S(e,t))}function va(e){return(t,n,r)=>!r[0].length||(e(ga(r.input,r.index))!=D.Word||e(_a(r.input,r.index))!=D.Word)&&(e(_a(r.input,r.index+r[0].length))!=D.Word||e(ga(r.input,r.index+r[0].length))!=D.Word)}var ya=class extends da{nextMatch(e,t,n){let r=J(this.spec,e,n,e.doc.length).next();return r.done&&(r=J(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=J(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=J(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=J(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)}},ba=C.define(),xa=C.define(),Y=Oe.define({create(e){return new Sa(Pa(e).create(),null)},update(e,t){for(let n of t.effects)n.is(ba)?e=new Sa(n.value.create(),e.panel):n.is(xa)&&(e=new Sa(e.query,n.value?Na:null));return e},provide:e=>de.from(e,e=>e.panel)}),Sa=class{constructor(e,t){this.query=e,this.panel=t}},Ca=E.mark({class:`cm-searchMatch`}),wa=E.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Ta=ae.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Y))}update(e){let t=e.state.field(Y);(t!=e.startState.field(Y)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return E.none;let{view:n}=this,r=new Pe;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?wa:Ca)})}return r.finish()}},{decorations:e=>e.decorations});function Ea(e){return t=>{let n=t.state.field(Y,!1);return n&&n.query.spec.valid?e(t,n):La(t)}}var Da=Ea((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=T.single(r.from,r.to),a=e.state.facet(K);return e.dispatch({selection:i,effects:[Ua(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Ia(e),!0}),Oa=Ea((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=T.single(i.from,i.to),o=e.state.facet(K);return e.dispatch({selection:a,effects:[Ua(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Ia(e),!0}),ka=Ea((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:T.create(n.map(e=>T.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Aa=({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 G(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(T.range(t.value.from,t.value.to))}return t(e.update({selection:T.create(a,o),userEvent:`select.search.matches`})),!0},ja=Ea((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(y.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=T.single(o.from,o.to).map(d),u.push(Ua(e,o)),u.push(n.facet(K).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),Ma=Ea((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:y.announce.of(r),userEvent:`input.replace.all`}),!0});function Na(e){return e.state.facet(K).createPanel(e)}function Pa(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(K);return new ua({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 Fa(e){let t=Be(e,Na);return t&&t.dom.querySelector(`[main-field]`)}function Ia(e){let t=Fa(e);t&&t==e.root.activeElement&&t.select()}var La=e=>{let t=e.state.field(Y,!1);if(t&&t.panel){let n=Fa(e);if(n&&n!=e.root.activeElement){let r=Pa(e.state,t.query.spec);r.valid&&e.dispatch({effects:ba.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[xa.of(!0),t?ba.of(Pa(e.state,t.query.spec)):C.appendConfig.of(Ga)]});return!0},Ra=e=>{let t=e.state.field(Y,!1);if(!t||!t.panel)return!1;let n=Be(e,Na);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:xa.of(!1)}),!0},za=[{key:`Mod-f`,run:La,scope:`editor search-panel`},{key:`F3`,run:Da,shift:Oa,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:Da,shift:Oa,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Ra,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Aa},{key:`Mod-Alt-g`,run:Xi},{key:`Mod-d`,run:ca,preventDefault:!0}],Ba=class{constructor(e){this.view=e;let t=this.query=e.state.field(Y).query.spec;this.commit=this.commit.bind(this),this.searchField=b(`input`,{value:t.search,placeholder:X(e,`Find`),"aria-label":X(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:X(e,`Replace`),"aria-label":X(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`,()=>Da(e),[X(e,`next`)]),n(`prev`,()=>Oa(e),[X(e,`previous`)]),n(`select`,()=>ka(e),[X(e,`all`)]),b(`label`,null,[this.caseField,X(e,`match case`)]),b(`label`,null,[this.reField,X(e,`regexp`)]),b(`label`,null,[this.wordField,X(e,`by word`)]),...e.state.readOnly?[]:[b(`br`),this.replaceField,n(`replace`,()=>ja(e),[X(e,`replace`)]),n(`replaceAll`,()=>Ma(e),[X(e,`replace all`)])],b(`button`,{name:`close`,onclick:()=>Ra(e),"aria-label":X(e,`close`),type:`button`},[`×`])])}commit(){let e=new ua({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:ba.of(e)}))}keydown(e){te(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Oa:Da)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),ja(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(ba)&&!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(K).top}};function X(e,t){return e.state.phrase(t)}var Va=30,Ha=/[\s\.,:;?!]/;function Ua(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-Va),o=Math.min(i,n+Va),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Va;e++)if(!Ha.test(s[e+1])&&Ha.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Va;e--)if(!Ha.test(s[e-1])&&Ha.test(s[e])){s=s.slice(0,e);break}}return y.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Wa=y.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`}}),Ga=[Y,ve.low(Ta),Wa],Ka={js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`jsx`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsx:`tsx`,c:`cpp`,h:`cpp`,cpp:`cpp`,cc:`cpp`,cxx:`cpp`,hpp:`cpp`,hh:`cpp`,java:`java`,kt:`kotlin`,kts:`kotlin`,cs:`csharp`,html:`html`,htm:`html`,xhtml:`html`,php:`php`,xml:`xml`,svg:`xml`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`toml`,py:`python`,rb:`ruby`,lua:`lua`,swift:`swift`,rs:`rust`,go:`go`,sql:`sql`,sh:`shell`,bash:`shell`,dockerfile:`dockerfile`};function qa(e){let t=(e.replace(/[?#].*$/,``).split(`/`).pop()??``).toLowerCase();if(t===`dockerfile`||t.startsWith(`dockerfile.`))return`dockerfile`;let n=t.lastIndexOf(`.`);return n<=0?null:Ka[t.slice(n+1)]??null}var Z=e=>_e.define(e),Ja={javascript:async()=>(await r(async()=>{let{javascript:e}=await import(`./dist-DUFzb_Eu.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([0,1,2,3]),import.meta.url)).javascript(),jsx:async()=>(await r(async()=>{let{javascript:e}=await import(`./dist-DUFzb_Eu.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([0,1,2,3]),import.meta.url)).javascript({jsx:!0}),typescript:async()=>(await r(async()=>{let{javascript:e}=await import(`./dist-DUFzb_Eu.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([0,1,2,3]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await r(async()=>{let{javascript:e}=await import(`./dist-DUFzb_Eu.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([0,1,2,3]),import.meta.url)).javascript({jsx:!0,typescript:!0}),cpp:async()=>(await r(async()=>{let{cpp:e}=await import(`./dist-rmKzqdIO.js`);return{cpp:e}},__vite__mapDeps([4,2,3]),import.meta.url)).cpp(),java:async()=>(await r(async()=>{let{java:e}=await import(`./dist-IR189dk6.js`);return{java:e}},__vite__mapDeps([5,2,3]),import.meta.url)).java(),kotlin:async()=>Z((await r(async()=>{let{kotlin:e}=await import(`./clike-pnxEhJ5P.js`);return{kotlin:e}},[],import.meta.url)).kotlin),csharp:async()=>Z((await r(async()=>{let{csharp:e}=await import(`./clike-pnxEhJ5P.js`);return{csharp:e}},[],import.meta.url)).csharp),html:async()=>(await r(async()=>{let{html:e}=await import(`./dist-B4E-6SqB.js`);return{html:e}},__vite__mapDeps([6,2,3,7,1,0]),import.meta.url)).html(),php:async()=>(await r(async()=>{let{php:e}=await import(`./dist-uvIW_qsj.js`);return{php:e}},__vite__mapDeps([8,2,3,6,7,1,0]),import.meta.url)).php(),xml:async()=>(await r(async()=>{let{xml:e}=await import(`./dist-CxEuuaKq.js`);return{xml:e}},__vite__mapDeps([9,2,3]),import.meta.url)).xml(),css:async()=>(await r(async()=>{let{css:e}=await import(`./dist-BfGIsxxP.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([7,1,2,3]),import.meta.url)).css(),scss:async()=>(await r(async()=>{let{css:e}=await import(`./dist-BfGIsxxP.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([7,1,2,3]),import.meta.url)).css(),less:async()=>(await r(async()=>{let{css:e}=await import(`./dist-BfGIsxxP.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([7,1,2,3]),import.meta.url)).css(),json:async()=>(await r(async()=>{let{json:e}=await import(`./dist-33oU5N7i.js`);return{json:e}},__vite__mapDeps([10,2,3]),import.meta.url)).json(),markdown:async()=>(await r(async()=>{let{markdown:e}=await import(`./dist-BwHJSc3S.js`);return{markdown:e}},__vite__mapDeps([11,2,6,3,7,1,0]),import.meta.url)).markdown(),yaml:async()=>(await r(async()=>{let{yaml:e}=await import(`./dist-1MAn9CBM.js`);return{yaml:e}},__vite__mapDeps([12,2,3]),import.meta.url)).yaml(),toml:async()=>Z((await r(async()=>{let{toml:e}=await import(`./toml-BPTmHmyx.js`);return{toml:e}},[],import.meta.url)).toml),python:async()=>(await r(async()=>{let{python:e}=await import(`./dist-DX2Uz40S.js`);return{python:e}},__vite__mapDeps([13,2,3]),import.meta.url)).python(),ruby:async()=>Z((await r(async()=>{let{ruby:e}=await import(`./ruby-ChfNwlCY.js`);return{ruby:e}},[],import.meta.url)).ruby),lua:async()=>Z((await r(async()=>{let{lua:e}=await import(`./lua-DPCEkfD_.js`);return{lua:e}},[],import.meta.url)).lua),swift:async()=>Z((await r(async()=>{let{swift:e}=await import(`./swift-DKB6_1j6.js`);return{swift:e}},[],import.meta.url)).swift),rust:async()=>(await r(async()=>{let{rust:e}=await import(`./dist-C5-Hv917.js`);return{rust:e}},__vite__mapDeps([14,2,3]),import.meta.url)).rust(),go:async()=>(await r(async()=>{let{go:e}=await import(`./dist-Db_OB0lX.js`);return{go:e}},__vite__mapDeps([15,2,3]),import.meta.url)).go(),sql:async()=>(await r(async()=>{let{sql:e}=await import(`./dist-BdNRSgzN.js`);return{sql:e}},__vite__mapDeps([16,2,3]),import.meta.url)).sql(),shell:async()=>Z((await r(async()=>{let{shell:e}=await import(`./shell-DwuoZtxw.js`);return{shell:e}},[],import.meta.url)).shell),dockerfile:async()=>Z((await r(async()=>{let{dockerFile:e}=await import(`./dockerfile-BDePf5PZ.js`);return{dockerFile:e}},[],import.meta.url)).dockerFile)};function Ya(e){return e===null?Promise.resolve([]):Ja[e]()}var Q=t(),Xa=u.define(),$=(e,t)=>`color-mix(in srgb, var(${e}) ${t}%, transparent)`,Za=y.theme({"&":{height:`100%`,color:`var(--oo-color-text)`,backgroundColor:`var(--oo-color-canvas)`,fontSize:`var(--oo-font-size-xs)`},".cm-scroller":{fontFamily:`var(--oo-font-mono, monospace)`,lineHeight:`1.5`},".cm-content":{caretColor:`var(--oo-color-accent)`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`var(--oo-color-accent)`},".cm-selectionBackground, &.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection":{backgroundColor:$(`--oo-color-accent`,28)},".cm-activeLine":{backgroundColor:$(`--oo-color-text`,5)},".cm-gutters":{backgroundColor:`var(--oo-color-canvas)`,color:`var(--oo-color-muted)`,borderRight:`1px solid var(--oo-color-border)`},".cm-activeLineGutter":{backgroundColor:$(`--oo-color-text`,5),color:`var(--oo-color-text)`},".cm-foldPlaceholder":{backgroundColor:`var(--oo-color-hover)`,border:`1px solid var(--oo-color-border)`,color:`var(--oo-color-muted)`},".cm-selectionMatch":{backgroundColor:$(`--oo-color-accent`,14)},"&.cm-focused .cm-matchingBracket":{backgroundColor:$(`--oo-color-accent`,30),outline:`1px solid var(--oo-color-accent)`},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:$(`--oo-color-danger`,30)},".cm-searchMatch":{backgroundColor:$(`--oo-color-warning`,30)},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:$(`--oo-color-warning`,60)},".cm-panels":{backgroundColor:`var(--oo-color-panel)`,color:`var(--oo-color-text)`},".cm-panels.cm-panels-top":{borderBottom:`1px solid var(--oo-color-border)`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid var(--oo-color-border)`},".cm-textfield":{backgroundColor:`var(--oo-color-canvas)`,color:`var(--oo-color-text)`,border:`1px solid var(--oo-color-border)`,borderRadius:`var(--oo-radius-sm)`},".cm-button":{backgroundImage:`none`,backgroundColor:`var(--oo-color-surface)`,color:`var(--oo-color-text)`,border:`1px solid var(--oo-color-border)`,borderRadius:`var(--oo-radius-sm)`},".cm-tooltip":{backgroundColor:`var(--oo-color-raised)`,color:`var(--oo-color-text)`,border:`1px solid var(--oo-color-border)`},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:`var(--oo-color-selected)`,color:`var(--oo-color-text)`}}),Qa=Me.define([{tag:[k.keyword,k.controlKeyword,k.moduleKeyword,k.operatorKeyword,k.definitionKeyword,k.modifier],color:`var(--ahpw-code-keyword)`},{tag:[k.string,k.special(k.string),k.regexp,k.character],color:`var(--ahpw-code-string)`},{tag:[k.number,k.bool,k.null,k.atom,k.unit],color:`var(--ahpw-code-number)`},{tag:[k.comment,k.lineComment,k.blockComment,k.docComment],color:`var(--ahpw-code-comment)`,fontStyle:`italic`},{tag:[k.function(k.variableName),k.function(k.propertyName),k.macroName],color:`var(--ahpw-code-function)`},{tag:[k.typeName,k.className,k.namespace,k.standard(k.typeName)],color:`var(--ahpw-code-type)`},{tag:[k.propertyName,k.definition(k.propertyName),k.labelName],color:`var(--ahpw-code-property)`},{tag:[k.tagName,k.angleBracket],color:`var(--ahpw-code-tag)`},{tag:k.attributeName,color:`var(--ahpw-code-attribute)`},{tag:[k.meta,k.processingInstruction,k.annotation],color:`var(--ahpw-code-meta)`},{tag:k.heading,color:`var(--ahpw-code-keyword)`,fontWeight:`600`},{tag:[k.link,k.url],color:`var(--ahpw-code-string)`,textDecoration:`underline`},{tag:k.emphasis,fontStyle:`italic`},{tag:k.strong,fontWeight:`600`},{tag:k.strikethrough,textDecoration:`line-through`},{tag:k.invalid,color:`var(--oo-color-danger)`}]),$a=e=>[he.readOnly.of(e),y.editable.of(!e)];function eo(e,t,n){let r=e.state.doc,i=r.line(Math.min(Math.max(t,1),r.lines)),a=r.line(Math.min(Math.max(n??t,i.number),r.lines));e.dispatch({selection:T.range(i.from,a.to),effects:y.scrollIntoView(i.from,{y:`center`})})}function to({value:e,language:t=null,readOnly:n=!1,line:r,end:i,onChange:a,onSave:o}){let s=(0,A.useRef)(null),c=(0,A.useRef)(null),l=(0,A.useRef)(new Ae),u=(0,A.useRef)(new Ae),d=(0,A.useRef)({onChange:a,onSave:o});return d.current={onChange:a,onSave:o},(0,A.useEffect)(()=>{let t=s.current;if(t===null)return;let r=new y({parent:t,state:he.create({doc:e,extensions:[_(),v(),ce(),Bn(),xe(),ee(),re(),he.allowMultipleSelections.of(!0),p(),Ce(Qa),we(),rn(),xn(),ke(),le(),$i(),la({top:!0}),ue.of([{key:`Mod-s`,preventDefault:!0,run:e=>(d.current.onSave?.(e.state.doc.toString()),!0)},...un,...zi,...za,...rr,...me,...Sn,Bi]),Za,l.current.of([]),u.current.of($a(n)),y.updateListener.of(e=>{e.docChanged&&!e.transactions.some(e=>e.annotation(Xa)===!0)&&d.current.onChange?.(e.state.doc.toString())})]})});return c.current=r,()=>{r.destroy(),c.current=null}},[]),(0,A.useEffect)(()=>{let t=c.current;t!==null&&t.state.doc.toString()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e},annotations:Xa.of(!0)})},[e]),(0,A.useEffect)(()=>{let e=!0;return Ya(t).then(t=>{e&&c.current?.dispatch({effects:l.current.reconfigure(t)})}).catch(()=>void 0),()=>{e=!1}},[t]),(0,A.useEffect)(()=>{c.current?.dispatch({effects:u.current.reconfigure($a(n))})},[n]),(0,A.useEffect)(()=>{let e=c.current;e!==null&&typeof r==`number`&&eo(e,r,i)},[r,i,e]),(0,Q.jsx)(`div`,{className:`web-editor`,ref:s})}var no=5e6;function ro(e){return e.length>5e6?{text:e.slice(0,no),cut:!0}:{text:e,cut:!1}}function io(e){return typeof e==`object`&&!!e&&e.code===o.PermissionDenied}function ao(e){return typeof e==`object`&&!!e&&e.code===o.Conflict}var oo=e({default:()=>so});function so({uri:e,line:t,end:n}){let r=Ve(e),[o,u]=(0,A.useState)(!1),[d,f]=(0,A.useState)(null),p=(0,A.useRef)(``),m=(0,A.useRef)(``),h=(0,A.useRef)(!1),g=(0,A.useRef)(void 0);i(()=>o?`The changes to this file are not saved.`:null);let _=r!==null&&`text`in r&&r.text!==null?ro(r.text):null;(0,A.useEffect)(()=>{if(p.current=_?.text??``,m.current=p.current,u(!1),f(null),g.current=void 0,e===void 0||_===null)return;let t=!0;return s(e).then(e=>{t&&(g.current=e)}).catch(()=>void 0),()=>{t=!1}},[e,_?.text]);let v=(0,A.useCallback)(e=>{m.current=e,u(e!==p.current)},[]),ee=(0,A.useCallback)(t=>{e===void 0||h.current||(h.current=!0,a(e,t,g.current).then(async()=>{p.current=t,u(m.current!==t),f(null),g.current=await s(e).catch(()=>void 0)}).catch(e=>{let t=ao(e)?`The file changed on the server since it was opened. Copy your edit, then reopen the file.`:e instanceof Error?e.message:String(e);f({message:t,refused:io(e)})}).finally(()=>{h.current=!1}))},[e]);if(e===void 0)return(0,Q.jsx)(l,{tone:`warning`,message:`No file was named.`});let te=(0,Q.jsx)(He,{uri:e,dirty:o});return r===null?(0,Q.jsxs)(`div`,{className:`web-file`,children:[te,(0,Q.jsx)(c,{label:`Reading the file`})]}):`error`in r?(0,Q.jsxs)(`div`,{className:`web-file`,children:[te,(0,Q.jsx)(l,{tone:`danger`,title:`Not readable`,message:r.error})]}):_===null?(0,Q.jsxs)(`div`,{className:`web-file`,children:[te,(0,Q.jsx)(`p`,{className:`web-note`,children:`This file is not text.`})]}):(0,Q.jsxs)(`div`,{className:`web-file`,children:[te,d===null?null:(0,Q.jsx)(l,{tone:`danger`,title:d.refused?`Read-only`:`Not saved`,message:d.message}),_.cut?(0,Q.jsx)(`p`,{className:`web-note`,children:`This file is over 5 MB. It shows the start, read-only.`}):null,(0,Q.jsx)(`div`,{className:`web-file__body web-file__body--editor`,children:(0,Q.jsx)(to,{value:_.text,language:qa(e),readOnly:_.cut||d?.refused===!0,line:t??null,end:n??null,onChange:v,onSave:ee})})]})}export{$t as a,so as default,qe as i,Ue as n,Ke as r,oo as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{t}from"./useStore-BQkzWMs-.js";import{n}from"./ScenaProvider-6A3TJumQ.js";import{
|
|
1
|
+
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{t}from"./useStore-BQkzWMs-.js";import{n}from"./ScenaProvider-6A3TJumQ.js";import{C as r}from"./index-yhQX4tVS.js";var i=e();function a({namespace:e,fields:a}){let d=n(),{t:f}=r(`query`),p=t(`$/${e}/query`),m=p?.where??[],h=t=>d.store.set(`$/${e}/query`,{...p??{page:1,pageSize:50},...t,page:1}),g=e=>e.value??!0,_=e=>m.some(t=>t.field===e.field&&t.value===g(e)),v=e=>{let t=m.filter(t=>t.field!==e.field),n=_(e)?t:[...t,{field:e.field,op:e.op??`eq`,value:g(e)}];h({where:n})};return(0,i.jsxs)(`div`,{style:o,children:[(0,i.jsx)(`input`,{style:s,placeholder:f(`search`,`Search…`),value:p?.q??``,onChange:e=>h({q:e.currentTarget.value})}),a?.length?(0,i.jsx)(`div`,{style:c,children:a.map(e=>(0,i.jsx)(`button`,{type:`button`,style:{...l,..._(e)?u:{}},onClick:()=>v(e),children:e.label??e.field},e.field))}):null]})}var o={display:`flex`,flexDirection:`column`,gap:6,padding:8},s={boxSizing:`border-box`,width:`100%`,padding:`6px 8px`,background:`var(--oo-color-canvas, #16181d)`,border:`1px solid var(--oo-color-border, #2b2f37)`,borderRadius:4,outline:`none`,fontSize:13,color:`var(--oo-color-text, #e6e8eb)`},c={display:`flex`,flexWrap:`wrap`,gap:4},l={appearance:`none`,border:`1px solid var(--oo-color-border, #2b2f37)`,background:`none`,borderRadius:999,padding:`2px 8px`,fontSize:11,cursor:`pointer`,color:`var(--oo-color-muted, #8a8f98)`},u={color:`#fff`,background:`var(--oo-color-accent, #4c7fff)`,borderColor:`var(--oo-color-accent, #4c7fff)`};export{a as Filter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{t}from"./react-CybPckBe.js";import{t as n}from"./media-
|
|
1
|
+
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{t}from"./react-CybPckBe.js";import{t as n}from"./media-Coozt7AL.js";var r=t();function i(e,t,n){return Math.round(n>0&&t>0?t*e*100/n:e*100)}var a=e(),o=1,s=20,c=1.25;function l({url:e,alt:t}){let n=(0,r.useRef)(null),l=(0,r.useRef)(null),[u,d]=(0,r.useState)(o),[f,p]=(0,r.useState)({fitted:0,natural:0}),[m,h]=(0,r.useState)({x:0,y:0}),[g,_]=(0,r.useState)(!1),v=(0,r.useRef)(null),y=()=>{d(o),h({x:0,y:0})};(0,r.useEffect)(y,[e]);let b=(e,t=0,n=0)=>{let r=Math.min(s,Math.max(o,e));if(r===u)return;let i=r/u;h(r===o?{x:0,y:0}:e=>({x:t-(t-e.x)*i,y:n-(n-e.y)*i})),d(r)},x=e=>{let t=n.current?.getBoundingClientRect();t!==void 0&&b(u*Math.exp(-e.deltaY*.0015),e.clientX-t.left-t.width/2,e.clientY-t.top-t.height/2)},S=()=>{let e=l.current;e!==null&&p({fitted:e.offsetWidth,natural:e.naturalWidth})};(0,r.useEffect)(()=>{let e=n.current;if(e===null||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(S);return t.observe(e),()=>t.disconnect()},[]);let C=e=>{u<=o||(v.current={x:e.clientX,y:e.clientY,ox:m.x,oy:m.y},_(!0),e.currentTarget.setPointerCapture(e.pointerId))},w=e=>{let t=v.current;t!==null&&h({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},T=()=>{v.current=null,_(!1)};(0,r.useEffect)(()=>{let e=n.current,t=e=>e.preventDefault();return e?.addEventListener(`wheel`,t,{passive:!1}),()=>e?.removeEventListener(`wheel`,t)},[]);let E=u>o;return(0,a.jsxs)(`div`,{className:`web-image__view`,children:[(0,a.jsxs)(`div`,{className:`web-image__bar`,role:`toolbar`,"aria-label":`Zoom`,children:[(0,a.jsx)(`button`,{type:`button`,className:`web-image__step`,title:`Zoom out`,"aria-label":`Zoom out`,disabled:!E,onClick:()=>b(u/c),children:`−`}),(0,a.jsxs)(`button`,{type:`button`,className:`web-image__step web-image__percent`,title:`Fit`,"aria-label":`Fit`,disabled:!E,onClick:y,children:[i(u,f.fitted,f.natural),`%`]}),(0,a.jsx)(`button`,{type:`button`,className:`web-image__step`,title:`Zoom in`,"aria-label":`Zoom in`,disabled:u>=s,onClick:()=>b(u*c),children:`+`})]}),(0,a.jsx)(`div`,{ref:n,className:`web-image`,"data-zoomed":E?`true`:`false`,"data-dragging":g?`true`:`false`,onWheel:x,onPointerDown:C,onPointerMove:w,onPointerUp:T,onPointerCancel:T,onDoubleClick:y,children:(0,a.jsx)(`img`,{ref:l,src:e,alt:t,draggable:!1,onLoad:S,style:{transform:`translate(${m.x}px, ${m.y}px) scale(${u})`}})})]})}var u=e=>decodeURIComponent(e.split(`/`).pop()??e);function d({uri:e}){return(0,a.jsx)(n,{uri:e,children:t=>(0,a.jsx)(l,{url:t,alt:u(e??``)})})}export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{t}from"./react-CybPckBe.js";import{t as n}from"./useStore-BQkzWMs-.js";import{n as r}from"./ScenaProvider-6A3TJumQ.js";import{t as i}from"./Button-_R1oktDz.js";import{O as a,i as o,n as s,o as c,r as l}from"./data-
|
|
1
|
+
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{t}from"./react-CybPckBe.js";import{t as n}from"./useStore-BQkzWMs-.js";import{n as r}from"./ScenaProvider-6A3TJumQ.js";import{t as i}from"./Button-_R1oktDz.js";import{O as a,i as o,n as s,o as c,r as l}from"./data-hUAVersf.js";import{n as u,t as d}from"./words-T8-D0K4W.js";import{t as f}from"./Badge-BDEW5PFb.js";import{t as p}from"./Alert-CHZkhmDE.js";import{t as m}from"./Text-MPtQvYE-.js";import{t as h}from"./DetailList-Yalgw0YM.js";import{y as g}from"./index-yhQX4tVS.js";import{a as _}from"./turn-BoF7W1h6.js";var v=t(),y=e(),b={connected:{tone:`success`,text:`Connected`},connecting:{tone:`info`,text:`Connecting`},reconnecting:{tone:`warning`,text:`Reconnecting`},disconnected:{tone:`default`,text:`Disconnected`},failed:{tone:`danger`,text:`Failed`}};function x(e){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(null);return(0,v.useEffect)(()=>{n(null),i(null)},[e]),{status:t,error:r}}function S(){let[e,t]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{let e=window.setInterval(()=>t(Date.now()),1e3);return()=>window.clearInterval(e)},[]),e}function C(){let e=r(),t=n(l),v=n(c),C=n(`$/ahp/agents`)??[],w=n(o),T=n(s),{status:E,error:D}=x(t?.generation??0),O=S(),k=b[t?.status??`disconnected`]??b.disconnected,A=E?.startedAt===void 0?NaN:Date.parse(E.startedAt),j=[{label:`Status`,value:k.text}];v!=null&&(j.push({label:`Host`,value:v.label}),v.protocolVersion!==null&&j.push({label:`Protocol`,value:v.protocolVersion}),v.connectedAt!==null&&j.push({label:`Connected`,value:`${_(v.connectedAt)} \u{00B7} ${d(O-v.connectedAt)}`}),j.push({label:`Client`,value:(0,y.jsx)(`code`,{children:v.clientId})},{label:`Server sequence`,value:String(v.serverSeq)},{label:`Following`,value:`${v.subscriptions} channels`})),t?.error!==null&&t?.error!==void 0&&j.push({label:`Last error`,value:t.error});let M=[];E!==null&&(Number.isNaN(A)||M.push({label:`Started`,value:`${_(A)} \u{00B7} up ${d(O-A)}`}),E.pid!==void 0&&M.push({label:`Process`,value:String(E.pid)}),E.url!==void 0&&M.push({label:`Address`,value:(0,y.jsx)(`code`,{children:E.url})}),E.automations!==void 0&&M.push({label:`Automations kept in`,value:E.automations}),(E.paths??[]).length>0&&M.push({label:`Sessions kept in`,value:(0,y.jsx)(`span`,{className:`web-lines`,children:E.paths.map(e=>(0,y.jsx)(`code`,{children:e},e))})}));let N=[{label:`Agents`,value:(0,y.jsx)(`button`,{type:`button`,className:`web-link`,onClick:()=>void e.commands.execute(`sidebar.activate`,{section:g}),children:C.length===0?`None`:C.map(e=>e.displayName).join(`, `)})},{label:`Default folder`,value:w==null?`None`:(0,y.jsx)(`code`,{children:u(w)})}];v?.activeSessions!==null&&v?.activeSessions!==void 0&&N.push({label:`Active sessions`,value:String(v.activeSessions)}),N.push({label:`Automations`,value:T==null?`Not offered`:[T.create===void 0?`Read only`:`Clients can create them`,T.schedules?.minIntervalMinutes===void 0?void 0:`at most every ${T.schedules.minIntervalMinutes} minutes`,T.runCancellation===void 0?void 0:`runs can be stopped`].filter(e=>e!==void 0).join(`, `)});let P=v?.terminals??[];return(0,y.jsxs)(`div`,{className:`web-page`,children:[(0,y.jsxs)(`div`,{className:`web-page__head`,children:[(0,y.jsxs)(`div`,{className:`web-chat__title`,children:[(0,y.jsx)(m,{variant:`h2`,text:`Host`}),(0,y.jsx)(f,{tone:k.tone,text:k.text})]}),(0,y.jsxs)(`div`,{className:`web-page__actions`,children:[t?.status===`connected`?null:(0,y.jsx)(i,{label:`Reconnect now`,variant:`primary`,onClick:a}),(0,y.jsx)(i,{label:`Settings`,onClick:()=>void e.commands.execute(`ahp.openSettings`)})]})]}),(0,y.jsx)(m,{variant:`h3`,text:`Connection`}),(0,y.jsx)(h,{items:j,columns:2}),E===null&&D===null?null:(0,y.jsx)(m,{variant:`h3`,text:`Daemon`}),D===null?null:(0,y.jsx)(p,{tone:`warning`,message:`The daemon's status is not readable: ${D}`}),M.length===0?null:(0,y.jsx)(h,{items:M,columns:2}),(0,y.jsx)(m,{variant:`h3`,text:`Offers`}),(0,y.jsx)(h,{items:N,columns:2}),(0,y.jsx)(m,{variant:`h3`,text:`Terminals`}),P.length===0?(0,y.jsx)(`p`,{className:`web-note`,children:`No terminals open.`}):(0,y.jsxs)(`table`,{className:`web-runs web-table`,children:[(0,y.jsx)(`thead`,{children:(0,y.jsxs)(`tr`,{children:[(0,y.jsx)(`th`,{children:`Title`}),(0,y.jsx)(`th`,{children:`State`})]})}),(0,y.jsx)(`tbody`,{children:P.map(e=>{let t=e.lifecycle;return(0,y.jsxs)(`tr`,{children:[(0,y.jsx)(`td`,{children:e.title}),(0,y.jsx)(`td`,{children:t.status===`exited`?`Exited${t.exitCode===void 0?``:` (${t.exitCode})`}`:`Running`})]},e.resource)})})]})]})}export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{t}from"./react-CybPckBe.js";import{
|
|
1
|
+
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{t}from"./react-CybPckBe.js";import{C as n}from"./index-yhQX4tVS.js";var r=t(),i=e();function a({display:e=`text`,locales:t,separator:a=`|`,className:s,style:c}){let{locale:l,locales:u,setLocale:d}=n(),f=t?t.map(e=>u.find(t=>t.locale===e)).filter(Boolean):u;return(0,i.jsx)(`div`,{className:[`oo-locale-toggle`,s].filter(Boolean).join(` `),style:c,role:`group`,children:f.map((t,n)=>(0,i.jsxs)(r.Fragment,{children:[n>0&&a!=null?(0,i.jsx)(`span`,{className:`oo-locale-toggle__sep`,"aria-hidden":`true`,children:a}):null,(0,i.jsx)(`button`,{type:`button`,className:`oo-locale-toggle__item`+(t.locale===l?` oo-locale-toggle__item--active`:``),"aria-pressed":t.locale===l,title:t.name??t.locale,onClick:()=>d(t.locale),children:o(t,e)})]},t.locale))})}function o(e,t){let n=(e.language??e.locale).toUpperCase();return t===`emoji`?e.emoji??n:t===`both`&&e.emoji?`${e.emoji} ${n}`:n}export{a as LocaleToggle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{t}from"./react-CybPckBe.js";import{n}from"./ScenaProvider-6A3TJumQ.js";import{B as r,H as i,I as a,L as o,U as s,V as c,W as l,z as u}from"./data-
|
|
1
|
+
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{t}from"./react-CybPckBe.js";import{n}from"./ScenaProvider-6A3TJumQ.js";import{B as r,H as i,I as a,L as o,U as s,V as c,W as l,z as u}from"./data-hUAVersf.js";import{t as d}from"./emojis-7RT6GvLa.js";var f=t(),p=e(),m=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)?`Cmd+click to open`:`Ctrl+click to open`,h={connection:`Connection`,session:`Session`,terminal:`Terminal`,traffic:`Traffic`};function g(e,t){return t.startsWith(`ahp-terminal:`)?{tip:`Open the terminal`,run:()=>void e.commands.execute(`ahp.openTerminal`,{uri:t})}:(e.store.get(`$/ahp/sessions`)??[]).some(e=>e.resource===t)?{tip:`Open the session`,run:()=>void e.commands.execute(`ahp.openSession`,{resource:t})}:t.startsWith(`file:`)?{tip:`Open the file`,run:()=>void e.commands.execute(`ahp.openFile`,{uri:t})}:/^https?:/i.test(t)?{tip:`Open the page`,run:()=>void window.open(t,`_blank`,`noopener`)}:null}function _(e){if(typeof e==`string`)try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return JSON.stringify(e,null,2)??String(e)}var v=e=>void navigator.clipboard?.writeText(e).catch(()=>void 0),y=(0,f.memo)(function({entry:e,open:t,onToggle:r}){let i=n(),a=s(e.text).map((e,t)=>{if(e.kind===`text`)return(0,p.jsx)(`span`,{children:e.text},t);let n=g(i,e.text);return n===null?(0,p.jsx)(`span`,{children:e.text},t):(0,p.jsx)(`a`,{className:`web-log__link`,title:`${n.tip} (${m})`,onClick:e=>{(e.ctrlKey||e.metaKey)&&(e.stopPropagation(),n.run())},children:e.text},t)});return(0,p.jsxs)(`div`,{className:`web-log__row`,"data-open":t||void 0,"data-level":e.level,children:[(0,p.jsxs)(`div`,{className:`web-log__line`,role:`button`,tabIndex:0,"aria-expanded":t,onClick:()=>r(e.id),onKeyDown:t=>{t.key===`Enter`&&r(e.id)},children:[(0,p.jsx)(`span`,{className:`web-log__caret`,children:t?d.caretDown:d.caretRight}),(0,p.jsx)(`span`,{className:`web-log__time`,children:u(e.at)}),(0,p.jsx)(`span`,{className:`web-log__level`,children:e.level.toUpperCase()}),(0,p.jsx)(`span`,{className:`web-log__scope`,"data-scope":e.scope,children:(0,p.jsx)(`span`,{children:h[e.scope]})}),(0,p.jsx)(`span`,{className:`web-log__text`,children:a}),t?(0,p.jsx)(`button`,{type:`button`,className:`web-log__icon`,title:`Copy the line`,onClick:t=>{t.stopPropagation(),v(c(e))},children:d.copy}):null]}),t&&e.detail!==void 0?(0,p.jsx)(`pre`,{className:`web-log__detail`,children:_(e.detail)}):null]})});function b(){let e=l(),[t,n]=(0,f.useState)([]),[s,c]=(0,f.useState)(`info`),[u,m]=(0,f.useState)(``),[g,_]=(0,f.useState)(new Set),b=(0,f.useMemo)(()=>r(e,{scopes:t.length===0?o.filter(e=>e!==`traffic`):t,minLevel:t.includes(`traffic`)?`debug`:s,query:u}),[e,t,s,u]),x=(0,f.useCallback)(e=>{_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),S=e=>n(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),C=()=>c(a[(a.indexOf(s)+1)%a.length]??`info`),w=(0,f.useRef)(null),T=(0,f.useRef)(!0);return(0,f.useEffect)(()=>{let e=w.current;if(e===null)return;let t=()=>{T.current=e.scrollHeight-e.scrollTop-e.clientHeight<24};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[]),(0,f.useLayoutEffect)(()=>{let e=w.current;e!==null&&T.current&&(e.scrollTop=e.scrollHeight)},[b]),(0,p.jsxs)(`div`,{className:`web-log`,children:[(0,p.jsxs)(`div`,{className:`web-log__bar`,children:[(0,p.jsx)(`button`,{type:`button`,className:`web-log__chip`,"data-on":t.length===0||void 0,onClick:()=>n([]),children:`All`}),o.map(e=>(0,p.jsxs)(`button`,{type:`button`,className:`web-log__chip`,"data-on":t.includes(e)||void 0,onClick:()=>S(e),children:[(0,p.jsx)(`span`,{className:`web-log__dot`,"data-scope":e}),h[e]]},e)),(0,p.jsx)(`span`,{className:`web-log__rule`}),(0,p.jsxs)(`button`,{type:`button`,className:`web-log__chip`,title:`Least severe level shown`,disabled:t.includes(`traffic`),onClick:C,children:[t.includes(`traffic`)?`debug`:s,` and up`]}),(0,p.jsx)(`input`,{className:`web-log__search`,type:`search`,placeholder:`Filter (!word excludes)`,value:u,onChange:e=>m(e.target.value)}),(0,p.jsx)(`button`,{type:`button`,className:`web-log__icon`,title:`Copy the lines shown`,onClick:()=>v(i(b)),children:d.copy})]}),(0,p.jsxs)(`div`,{className:`web-log__list`,ref:w,children:[b.length===0?(0,p.jsxs)(`p`,{className:`web-note`,children:[`Nothing logged`,e.length===0?` yet`:` matches the filter`,`.`]}):null,b.map(e=>(0,p.jsx)(y,{entry:e,open:g.has(e.id),onToggle:x},e.id))]})]})}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{t}from"./react-CybPckBe.js";import{t as n}from"./useStore-BQkzWMs-.js";import{n as r}from"./ScenaProvider-6A3TJumQ.js";import{t as i}from"./sigillum-Bev0l9LS.js";import{t as a}from"./Button-_R1oktDz.js";/* empty css */import{
|
|
1
|
+
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{t}from"./react-CybPckBe.js";import{t as n}from"./useStore-BQkzWMs-.js";import{n as r}from"./ScenaProvider-6A3TJumQ.js";import{t as i}from"./sigillum-Bev0l9LS.js";import{t as a}from"./Button-_R1oktDz.js";/* empty css */import{C as o,S as s}from"./index-yhQX4tVS.js";var c=t(),l=e();function u(e){return e&&typeof e==`object`&&`path`in e?e.path:void 0}function d(e,t=``){let r=n(u(e));return u(e)?r??t:(typeof e==`string`?e:void 0)??t}function f({provider:e,pending:t,fire:n,t:r}){let i=d(e.label,e.id);return(0,l.jsx)(a,{label:`${e.icon?`${e.icon} `:``}${r(`auth/providerLabel`,{provider:i,fallback:`Continue with {provider}`})}`,disabled:t,onClick:()=>n(`sigillum.signin`,{providerId:e.id,credentials:{}})})}function p({field:e}){let t=e.label&&typeof e.label==`object`&&`path`in e.label?u(e.label):void 0,r=n(t);return t?(0,l.jsx)(l.Fragment,{children:r??``}):(0,l.jsx)(l.Fragment,{children:typeof e.label==`string`?e.label:``})}function m({providers:e,allowSignup:t=!1,allowForgotPassword:u=!1,onSignup:m,onForgotPassword:_}){let v=r(),y=s(),{t:b}=o(),x=!!n(i.pending),S=n(i.error)??null,C=n(i.challenge)??null,w=(0,c.useMemo)(()=>e?y.providers.filter(t=>e.includes(t.id)):y.providers,[y.providers,e]),T=w.filter(e=>e.kind===`oauth-button`),E=w.filter(e=>e.kind===`form-fields`),D=w.filter(e=>e.kind===`otp`),O=w.filter(e=>e.kind===`magic-link`),k=(0,c.useMemo)(()=>{let e=[],t=new Set;for(let n of E)for(let r of n.fields??[])t.has(r.name)||(t.add(r.name),e.push({field:r,ownerId:n.id}));return e},[E]),[A,j]=(0,c.useState)({});function M(e,t){j(n=>({...n,[e]:t}))}function N(e,t){v.commands.execute(e,t)}function P(e){if(e.preventDefault(),E.length===0)return;let t=E.find(e=>e.id===`password`)??E[0];t&&N(`sigillum.signin`,{providerId:t.id,credentials:A})}let F=k.length>0||D.length>0||O.length>0,I=d((E.find(e=>e.id===`password`)??E[0])?.label,b(`auth/signIn`,`Sign in`));return(0,l.jsxs)(`form`,{className:`porta-form`,onSubmit:P,children:[T.length>0?(0,l.jsx)(`div`,{className:`porta-form__oauth`,children:T.map(e=>(0,l.jsx)(f,{provider:e,pending:x,fire:N,t:b},e.id))}):null,T.length>0&&F?(0,l.jsx)(`div`,{className:`porta-form__divider`,children:`or`}):null,k.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`porta-form__fields`,children:k.map(({field:e})=>(0,l.jsxs)(`label`,{className:`oo-field`,children:[(0,l.jsx)(`span`,{className:`oo-field__label`,children:e.label&&typeof e.label==`object`&&`t`in e.label?b(e.label.t,{...e.label.args,fallback:`???`}):(0,l.jsx)(p,{field:e})}),(0,l.jsx)(`input`,{className:`oo-input`,type:e.type,name:e.name,autoComplete:e.autoComplete,required:e.required,placeholder:e.placeholder,value:A[e.name]??``,onChange:t=>M(e.name,t.currentTarget.value)})]},e.name))}),(0,l.jsx)(a,{type:`submit`,variant:`primary`,label:I,disabled:x})]}):null,D.map(e=>(0,l.jsx)(h,{provider:e,challenge:C,pending:x,fire:N},e.id)),O.map(e=>(0,l.jsx)(g,{provider:e,challenge:C,pending:x,fire:N},e.id)),(0,l.jsxs)(`div`,{className:`porta-form__footer`,children:[(0,l.jsxs)(`span`,{children:[x?(0,l.jsx)(`span`,{className:`porta-form__pending`,children:`Working…`}):null,S?(0,l.jsx)(`span`,{className:`porta-form__error`,children:S}):null]}),(0,l.jsxs)(`div`,{className:`porta-form__aux`,children:[u?(0,l.jsx)(`button`,{type:`button`,onClick:_,children:b(`auth/forgotPassword`,`Forgot password?`)}):null,t?(0,l.jsx)(`button`,{type:`button`,onClick:m,children:b(`auth/createAccount`,`Create account`)}):null]})]})]})}function h({provider:e,challenge:t,pending:n,fire:r}){let{t:i}=o(`auth`),s=d(e.label,e.id),u=t?.providerId===e.id,f=e.otp?.digits??6,[p,m]=(0,c.useState)(``),[h,g]=(0,c.useState)(``);return(0,l.jsxs)(`div`,{className:`porta-form__two-step`,children:[(0,l.jsxs)(`span`,{className:`porta-form__two-step-label`,children:[e.icon?`${e.icon} `:``,s]}),u?(0,l.jsxs)(`div`,{className:`porta-form__two-step-row`,children:[(0,l.jsx)(_,{digits:f,value:h,onChange:g}),(0,l.jsx)(a,{label:`Verify`,variant:`primary`,disabled:n||h.length!==f,onClick:()=>r(`sigillum.verifyOtp`,{providerId:e.id,code:h})})]}):(0,l.jsxs)(`div`,{className:`porta-form__two-step-row`,children:[(0,l.jsxs)(`label`,{className:`oo-field`,children:[(0,l.jsx)(`span`,{className:`oo-field__label`,children:e.otp?.channel===`sms`?i(`phoneLabel`,`Phone number`):i(`emailLabel`,`Email address`)}),(0,l.jsx)(`input`,{className:`oo-input`,type:e.otp?.channel===`sms`?`tel`:`email`,value:p,placeholder:e.otp?.channel===`sms`?`+1 555 …`:`you@example.com`,onChange:e=>m(e.currentTarget.value)})]}),(0,l.jsx)(a,{label:e.otp?.sendLabel??i(`sendCode`,`Send code`),disabled:n||!p,onClick:()=>r(`sigillum.requestOtp`,{providerId:e.id,value:p})})]})]})}function g({provider:e,challenge:t,pending:n,fire:r}){let{t:i}=o(`auth`),s=d(e.label,e.id),u=t?.providerId===e.id,[f,p]=(0,c.useState)(``);return(0,l.jsxs)(`div`,{className:`porta-form__two-step`,children:[(0,l.jsxs)(`span`,{className:`porta-form__two-step-label`,children:[e.icon?`${e.icon} `:``,s]}),u?(0,l.jsxs)(`span`,{className:`porta-form__pending`,children:[`Check your `,e.magicLink?.channel??`inbox`,` for the link.`]}):(0,l.jsxs)(`div`,{className:`porta-form__two-step-row`,children:[(0,l.jsxs)(`label`,{className:`oo-field`,children:[(0,l.jsx)(`span`,{className:`oo-field__label`,children:e.magicLink?.channel===`sms`?i(`phoneLabel`,`Phone number`):i(`emailLabel`,`Email address`)}),(0,l.jsx)(`input`,{className:`oo-input`,type:e.magicLink?.channel===`sms`?`tel`:`email`,value:f,placeholder:e.magicLink?.channel===`sms`?`+1 555 …`:`you@example.com`,onChange:e=>p(e.currentTarget.value)})]}),(0,l.jsx)(a,{label:e.magicLink?.sendLabel??i(`sendLink`,`Send link`),disabled:n||!f,onClick:()=>r(`sigillum.requestOtp`,{providerId:e.id,value:f})})]})]})}function _({digits:e,value:t,onChange:n}){let r=(0,c.useRef)([]);(0,c.useEffect)(()=>{r.current=r.current.slice(0,e)},[e]);let i=t.padEnd(e,` `).slice(0,e).split(``);function a(t,a){let o=i.slice();o[t]=a.slice(-1)||` `,n(o.join(``).trimEnd()),a&&t+1<e&&r.current[t+1]?.focus()}return(0,l.jsx)(`div`,{className:`porta-form__otp-digits`,children:Array.from({length:e}).map((e,t)=>(0,l.jsx)(`input`,{ref:e=>{r.current[t]=e},className:`porta-form__otp-digit`,inputMode:`numeric`,maxLength:1,value:i[t]?.trim()??``,onChange:e=>a(t,e.currentTarget.value),onKeyDown:e=>{e.key===`Backspace`&&!i[t]?.trim()&&t>0&&r.current[t-1]?.focus()}},t))})}export{m as LoginForm,m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{n as t}from"./ScenaProvider-6A3TJumQ.js";import{t as n}from"./Spinner-B-iOhBZq.js";import{t as r}from"./Markdown-_Awuh7Ku.js";import{t as i}from"./Alert-CHZkhmDE.js";import{r as a,t as o}from"./clicks-
|
|
1
|
+
import{t as e}from"./jsx-runtime-BguD1OXD.js";import{n as t}from"./ScenaProvider-6A3TJumQ.js";import{t as n}from"./Spinner-B-iOhBZq.js";import{t as r}from"./Markdown-_Awuh7Ku.js";import{t as i}from"./Alert-CHZkhmDE.js";import{r as a,t as o}from"./clicks-DIh3kBLi.js";import{n as s,t as c}from"./text-BdULOY8N.js";import{n as l}from"./media-Coozt7AL.js";var u=e();function d({src:e,alt:t,base:n}){let r=/^(https?|data):/i.test(e)?null:a(e,n),i=l(r?.uri);return r===null?(0,u.jsx)(`img`,{src:e,alt:t}):i!==null&&`url`in i?(0,u.jsx)(`img`,{src:i.url,alt:t}):(0,u.jsx)(`span`,{className:`web-md__image`,title:r.uri,"data-state":i===null?`reading`:`missing`,children:t})}var f=e=>(t,n)=>(0,u.jsx)(d,{src:t,alt:n,base:e}),p=e=>e.replace(/\/[^/]*$/,``);function m({uri:e}){let a=t(),l=s(e);if(e===void 0)return(0,u.jsx)(i,{tone:`warning`,message:`No file was named.`});let d=(0,u.jsx)(c,{uri:e});return l===null?(0,u.jsxs)(`div`,{className:`web-file`,children:[d,(0,u.jsx)(n,{label:`Reading the file`})]}):`error`in l?(0,u.jsxs)(`div`,{className:`web-file`,children:[d,(0,u.jsx)(i,{tone:`danger`,title:`Not readable`,message:l.error})]}):l.text===null?(0,u.jsxs)(`div`,{className:`web-file`,children:[d,(0,u.jsx)(`p`,{className:`web-note`,children:`This file is not text.`})]}):(0,u.jsxs)(`div`,{className:`web-file`,children:[d,(0,u.jsx)(`div`,{className:`web-file__body`,children:(0,u.jsx)(`div`,{className:`web-file__doc web-md`,onClick:o(a,p(e)),children:(0,u.jsx)(r,{text:l.text,image:f(p(e))})})})]})}export{m as default};
|