p3x-redis-ui-material
Version:
💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity
1 lines • 38.8 kB
JavaScript
import {z,b as cn}from'./chunk-C9L1hxzX.js';import {G as Gl,u as ur,p as pt$1,N as N$1,Q as Q$1,V as Vo,A,R as R$1,r as rt$1}from'./chunk-CSgt_bzr.js';import {codePointAt as ct$1,EditorSelection as v,Annotation as M,Transaction as D$1,Text as m,StateEffect as I,Facet as k$1,StateField as V,combineConfig as wt$1,Prec as pt$2,codePointSize as gt$1,RangeSet as ie,fromCodePoint as dt$1,CharCategory as b,MapMode as A$1,RangeValue as $}from'./chunk-OaLmDfu9.js';import {F,E as E$1}from'./main-HNF44SV3.js';var Q=class{constructor(e,t,n,o){this.state=e,this.pos=t,this.explicit=n,this.view=o,this.abortListeners=[],this.abortOnDocChange=false;}tokenBefore(e){let t=z(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),o=t.text.slice(n-t.from,this.pos-t.from),s=o.search(Ke(e,false));return s<0?null:{from:n+s,to:this.pos,text:o.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=true));}};function ke(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function et(i){let e=Object.create(null),t=Object.create(null);for(let{label:o}of i){e[o[0]]=true;for(let s=1;s<o.length;s++)t[o[s]]=true;}let n=ke(e)+ke(t)+"*$";return [new RegExp("^"+n),new RegExp(n)]}function tt(i){let e=i.map(o=>typeof o=="string"?{label:o}:o),[t,n]=e.every(o=>/^\w+$/.test(o.label))?[/\w*$/,/\w+$/]:et(e);return o=>{let s=o.matchBefore(n);return s||o.explicit?{from:s?s.from:o.pos,options:e,validFor:t}:null}}function Qt(i,e){return t=>{for(let n=z(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(i.indexOf(n.name)>-1)return e(t);if(n.type.isTop)break}return null}}function Xt(i,e){return t=>{for(let n=z(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(i.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}var X=class{constructor(e,t,n,o){this.completion=e,this.source=t,this.match=n,this.score=o;}};function D(i){return i.selection.main.from}function Ke(i,e){var t;let{source:n}=i,o=e&&n[0]!="^",s=n[n.length-1]!="$";return !o&&!s?i:new RegExp(`${o?"^":""}(?:${n})${s?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}var ye=M.define();function it(i,e,t,n){let{main:o}=i.selection,s=t-o.from,l=n-o.from;return F(E$1({},i.changeByRange(a=>{if(a!=o&&t!=n&&i.sliceDoc(a.from+s,a.from+l)!=i.sliceDoc(t,n))return {range:a};let r=i.toText(e);return {changes:{from:a.from+s,to:n==o.from?a.to:a.from+l,insert:r},range:v.cursor(a.from+s+r.length)}})),{scrollIntoView:true,userEvent:"input.complete"})}var Me=new WeakMap;function nt(i){if(!Array.isArray(i))return i;let e=Me.get(i);return e||Me.set(i,e=tt(i)),e}var G=I.define(),W=I.define(),ae=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=ct$1(e,t),o=gt$1(n);this.chars.push(n);let s=e.slice(t,t+o),l=s.toUpperCase();this.folded.push(ct$1(l==s?s.toLowerCase():l,0)),t+=o;}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:o,precise:s,byWord:l}=this;if(t.length==1){let d=ct$1(e,0),P=gt$1(d),C=P==e.length?0:-100;if(d!=t[0])if(d==n[0])C+=-200;else return null;return this.ret(C,[0,P])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let r=t.length,h=0;if(a<0){for(let d=0,P=Math.min(e.length,200);d<P&&h<r;){let C=ct$1(e,d);(C==t[h]||C==n[h])&&(o[h++]=d),d+=gt$1(C);}if(h<r)return null}let c=0,f=0,u=false,p=0,m=-1,b=-1,M=/[a-z]/.test(e),O=true;for(let d=0,P=Math.min(e.length,200),C=0;d<P&&f<r;){let x=ct$1(e,d);a<0&&(c<r&&x==t[c]&&(s[c++]=d),p<r&&(x==t[p]||x==n[p]?(p==0&&(m=d),b=d+1,p++):p=0));let j,ee=x<255?x>=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:(j=dt$1(x))!=j.toLowerCase()?1:j!=j.toUpperCase()?2:0;(!d||ee==1&&M||C==0&&ee!=0)&&(t[f]==x||n[f]==x&&(u=true)?l[f++]=d:l.length&&(O=false)),C=ee,d+=gt$1(x);}return f==r&&l[0]==0&&O?this.result(-100+(u?-200:0),l,e):p==r&&m==0?this.ret(-200-e.length+(b==e.length?0:-100),[0,b]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==r?this.ret(-900-e.length,[m,b]):f==r?this.result(-100+(u?-200:0)+-700+(O?0:-1100),l,e):t.length==2?null:this.result((o[0]?-700:0)+-200+-1100,o,e)}result(e,t,n){let o=[],s=0;for(let l of t){let a=l+(this.astral?gt$1(ct$1(n,l)):1);s&&o[s-1]==l?o[s-1]=a:(o[s++]=l,o[s++]=a);}return this.ret(e-n.length,o)}},ce=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)}},y=k$1.define({combine(i){return wt$1(i,{activateOnTyping:true,activateOnCompletion:()=>false,activateOnTypingDelay:100,selectOnOpen:true,override:null,closeOnBlur:true,maxRenderedOptions:100,defaultKeymap:true,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:false,icons:true,addToOptions:[],positionInfo:ot,filterStrict:false,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=>Be(e(n),t(n)),optionClass:(e,t)=>n=>Be(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Be(i,e){return i?e?i+" "+e:i:e}function ot(i,e,t,n,o,s){let l=i.textDirection==R$1.RTL,a=l,r=false,h="top",c,f,u=e.left-o.left,p=o.right-e.right,m=n.right-n.left,b=n.bottom-n.top;if(a&&u<Math.min(m,p)?a=false:!a&&p<Math.min(m,u)&&(a=true),m<=(a?u:p))c=Math.max(o.top,Math.min(t.top,o.bottom-b))-e.top,f=Math.min(400,a?u:p);else {r=true,f=Math.min(400,(l?e.right:o.right-e.left)-30);let d=o.bottom-e.bottom;d>=b||d>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top);}let M=(e.bottom-e.top)/s.offsetHeight,O=(e.right-e.left)/s.offsetWidth;return {style:`${h}: ${c/M}px; max-width: ${f/O}px`,class:"cm-completionInfo-"+(r?l?"left-narrow":"right-narrow":a?"left":"right")}}var Z=I.define();function st(i){let e=i.addToOptions.slice();return i.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(o=>"cm-completionIcon-"+o)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,o,s){let l=document.createElement("span");l.className="cm-completionLabel";let a=t.displayLabel||t.label,r=0;for(let h=0;h<s.length;){let c=s[h++],f=s[h++];c>r&&l.appendChild(document.createTextNode(a.slice(r,c)));let u=l.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(a.slice(c,f))),u.className="cm-completionMatchedText",r=f;}return r<a.length&&l.appendChild(document.createTextNode(a.slice(r))),l},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function se(i,e,t){if(i<=t)return {from:0,to:i};if(e<0&&(e=0),e<=i>>1){let o=Math.floor(e/t);return {from:o*t,to:(o+1)*t}}let n=Math.floor((i-e)/t);return {from:i-(n+1)*t,to:i-n*t}}var fe=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:r=>this.placeInfo(r),key:this},this.space=null,this.currentClass="";let o=e.state.field(t),{options:s,selected:l}=o.open,a=e.state.facet(y);this.optionContent=st(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=se(s.length,l,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",r=>{let{options:h}=e.state.field(t).open;for(let c=r.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]<h.length){this.applyCompletion(e,h[+f[1]]),r.preventDefault();return}if(r.target==this.list){let c=this.list.classList.contains("cm-completionListIncompleteTop")&&r.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&r.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:Z.of(c)}),r.preventDefault());}}),this.dom.addEventListener("focusout",r=>{let h=e.state.field(this.stateField,false);h&&h.tooltip&&e.state.facet(y).closeOnBlur&&r.relatedTarget!=e.contentDOM&&e.dispatch({effects:W.of(null)});}),this.showOptions(s,o.id);}mount(){this.updateSel();}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq);});}update(e){var t;let n=e.state.field(this.stateField),o=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=o){let{options:s,selected:l,disabled:a}=n.open;(!o.open||o.open.options!=s)&&(this.range=se(s.length,l,e.state.facet(y).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),a!=((t=o.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a);}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);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=se(t.options.length,t.selected,this.view.state.facet(y).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:o}=t.options[t.selected],{info:s}=o;if(!s)return;let l=typeof s=="string"?document.createTextNode(s):s(o);if(!l)return;"then"in l?l.then(a=>{a&&this.view.state.field(this.stateField,false)==e&&this.addInfoPane(a,o);}).catch(a=>Q$1(this.view.state,a,"completion info")):(this.addInfoPane(l,o),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:o,destroy:s}=e;n.appendChild(o),this.infoDestroy=s||null;}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq);}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,o=this.range.from;n;n=n.nextSibling,o++)n.nodeName!="LI"||!n.id?o--:o==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&&rt(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),o=e.getBoundingClientRect(),s=this.space;if(!s){let l=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight};}return o.top>Math.min(s.bottom,t.bottom)-10||o.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(y).positionInfo(this.view,t,o,n,s,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 o=document.createElement("ul");o.id=t,o.setAttribute("role","listbox"),o.setAttribute("aria-expanded","true"),o.setAttribute("aria-label",this.view.state.phrase("Completions")),o.addEventListener("mousedown",l=>{l.target==o&&l.preventDefault();});let s=null;for(let l=n.from;l<n.to;l++){let{completion:a,match:r}=e[l],{section:h}=a;if(h){let u=typeof h=="string"?h:h.name;if(u!=s&&(l>n.from||n.from==0))if(s=u,typeof h!="string"&&h.header)o.appendChild(h.header(h));else {let p=o.appendChild(document.createElement("completion-section"));p.textContent=u;}}let c=o.appendChild(document.createElement("li"));c.id=t+"-"+l,c.setAttribute("role","option");let f=this.optionClass(a);f&&(c.className=f);for(let u of this.optionContent){let p=u(a,this.view.state,this.view,r);p&&c.appendChild(p);}}return n.from&&o.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&o.classList.add("cm-completionListIncompleteBottom"),o}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null);}destroy(){this.destroyInfo();}};function lt(i,e){return t=>new fe(t,i,e)}function rt(i,e){let t=i.getBoundingClientRect(),n=e.getBoundingClientRect(),o=t.height/i.offsetHeight;n.top<t.top?i.scrollTop-=(t.top-n.top)/o:n.bottom>t.bottom&&(i.scrollTop+=(n.bottom-t.bottom)/o);}function $e(i){return (i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function at(i,e){let t=[],n=null,o=null,s=c=>{t.push(c);let{section:f}=c.completion;if(f){n||(n=[]);let u=typeof f=="string"?f:f.name;n.some(p=>p.name==u)||n.push(typeof f=="string"?{name:u}:f);}},l=e.facet(y);for(let c of i)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===false)for(let u of c.result.options)s(new X(u,c.source,f?f(u):[],1e9-t.length));else {let u=e.sliceDoc(c.from,c.to),p,m=l.filterStrict?new ce(u):new ae(u);for(let b of c.result.options)if(p=m.match(b.label)){let M=b.displayLabel?f?f(b,p.matched):[]:p.matched,O=p.score+(b.boost||0);if(s(new X(b,c.source,M,O)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:d}=b.section;o||(o=Object.create(null)),o[d]=Math.max(O,o[d]||-1e9);}}}}if(n){let c=Object.create(null),f=0,u=(p,m)=>(p.rank==="dynamic"&&m.rank==="dynamic"?o[m.name]-o[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(p.name<m.name?-1:1);for(let p of n.sort(u))f-=1e5,c[p.name]=f;for(let p of t){let{section:m}=p.completion;m&&(p.score+=c[typeof m=="string"?m:m.name]);}}let a=[],r=null,h=l.compareCompletions;for(let c of t.sort((f,u)=>u.score-f.score||h(f.completion,u.completion))){let f=c.completion;!r||r.label!=f.label||r.detail!=f.detail||r.type!=null&&f.type!=null&&r.type!=f.type||r.apply!=f.apply||r.boost!=f.boost?a.push(c):$e(c.completion)>$e(r)&&(a[a.length-1]=c),r=c.completion;}return a}var he=class i{constructor(e,t,n,o,s,l){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=o,this.selected=s,this.disabled=l;}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new i(this.options,Fe(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,o,s,l){if(o&&!l&&e.some(h=>h.isPending))return o.setDisabled();let a=at(e,t);if(!a.length)return o&&e.some(h=>h.isPending)?o.setDisabled():null;let r=t.facet(y).selectOnOpen?0:-1;if(o&&o.selected!=r&&o.selected!=-1){let h=o.options[o.selected].completion;for(let c=0;c<a.length;c++)if(a[c].completion==h){r=c;break}}return new i(a,Fe(n,r),{pos:e.reduce((h,c)=>c.hasResult()?Math.min(h,c.from):h,1e8),create:dt,above:s.aboveCursor},o?o.timestamp:Date.now(),r,false)}map(e){return new i(this.options,this.attrs,F(E$1({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new i(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,true)}},ue=class i{constructor(e,t,n){this.active=e,this.id=t,this.open=n;}static start(){return new i(ut,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(y),s=(n.override||t.languageDataAt("autocomplete",D(t)).map(nt)).map(r=>(this.active.find(c=>c.source==r)||new T(r,this.active.some(c=>c.state!=0)?1:0)).update(e,n));s.length==this.active.length&&s.every((r,h)=>r==this.active[h])&&(s=this.active);let l=this.open,a=e.effects.some(r=>r.is(be));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||s.some(r=>r.hasResult()&&e.changes.touchesRange(r.from,r.to))||!ct(s,this.active)||a?l=he.build(s,t,this.id,l,n,a):l&&l.disabled&&!s.some(r=>r.isPending)&&(l=null),!l&&s.every(r=>!r.isPending)&&s.some(r=>r.hasResult())&&(s=s.map(r=>r.hasResult()?new T(r.source,0):r));for(let r of e.effects)r.is(Z)&&(l=l&&l.setSelected(r.value,this.id));return s==this.active&&l==this.open?this:new i(s,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?ft:ht}};function ct(i,e){if(i==e)return true;for(let t=0,n=0;;){for(;t<i.length&&!i[t].hasResult();)t++;for(;n<e.length&&!e[n].hasResult();)n++;let o=t==i.length,s=n==e.length;if(o||s)return o==s;if(i[t++].result!=e[n++].result)return false}}var ft={"aria-autocomplete":"list"},ht={};function Fe(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}var ut=[];function ze(i,e){if(i.isUserEvent("input.complete")){let n=i.annotation(ye);if(n&&e.activateOnCompletion(n))return 12}let t=i.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:i.isUserEvent("delete.backward")?2:i.selection?8:i.docChanged?16:0}var T=class i{constructor(e,t,n=false){this.source=e,this.state=t,this.explicit=n;}hasResult(){return false}get isPending(){return this.state==1}update(e,t){let n=ze(e,t),o=this;(n&8||n&16&&this.touches(e))&&(o=new i(o.source,0)),n&4&&o.state==0&&(o=new i(this.source,1)),o=o.updateFor(e,n);for(let s of e.effects)if(s.is(G))o=new i(o.source,1,s.value);else if(s.is(W))o=new i(o.source,0);else if(s.is(be))for(let l of s.value)l.source==o.source&&(o=l);return o}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(D(e.state))}},J=class i extends T{constructor(e,t,n,o,s,l){super(e,3,t),this.limit=n,this.result=o,this.from=s,this.to=l;}hasResult(){return true}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let o=this.result;o.map&&!e.changes.empty&&(o=o.map(o,e.changes));let s=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),a=D(e.state);if(a>l||!o||t&2&&(D(e.startState)==this.from||a<this.limit))return new T(this.source,t&4?1:0);let r=e.changes.mapPos(this.limit);return pt(o.validFor,e.state,s,l)?new i(this.source,this.explicit,r,o,s,l):o.update&&(o=o.update(o,s,l,new Q(e.state,a,false)))?new i(this.source,this.explicit,r,o,o.from,(n=o.to)!==null&&n!==void 0?n:D(e.state)):new T(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new i(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new T(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function pt(i,e,t,n){if(!i)return false;let o=e.sliceDoc(t,n);return typeof i=="function"?i(o,t,n,e):Ke(i,true).test(o)}var be=I.define({map(i,e){return i.map(t=>t.map(e))}}),g=V.define({create(){return ue.start()},update(i,e){return i.update(e)},provide:i=>[ur.from(i,e=>e.tooltip),pt$1.contentAttributes.from(i,e=>e.attrs)]});function xe(i,e){let t=e.completion.apply||e.completion.label,n=i.state.field(g).active.find(o=>o.source==e.source);return n instanceof J?(typeof t=="string"?i.dispatch(F(E$1({},it(i.state,t,n.from,n.to)),{annotations:ye.of(e.completion)})):t(i,e.completion,n.from,n.to),true):false}var dt=lt(g,xe);function Y(i,e="option"){return t=>{let n=t.state.field(g,false);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(y).interactionDelay)return false;let o=1,s;e=="page"&&(s=Gl(t,n.open.tooltip))&&(o=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:l}=n.open.options,a=n.open.selected>-1?n.open.selected+o*(i?1:-1):i?0:l-1;return a<0?a=e=="page"?0:l-1:a>=l&&(a=e=="page"?l-1:0),t.dispatch({effects:Z.of(a)}),true}}var mt=i=>{let e=i.state.field(g,false);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(y).interactionDelay?false:xe(i,e.open.options[e.open.selected])},le=i=>i.state.field(g,false)?(i.dispatch({effects:G.of(true)}),true):false,gt=i=>{let e=i.state.field(g,false);return !e||!e.active.some(t=>t.state!=0)?false:(i.dispatch({effects:W.of(null)}),true)},pe=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0;}},yt=50,bt=1e3,xt=N$1.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=false,this.composing=0;for(let e of i.state.field(g).active)e.isPending&&this.startQuery(e);}update(i){let e=i.state.field(g),t=i.state.facet(y);if(!i.selectionSet&&!i.docChanged&&i.startState.field(g)==e)return;let n=i.transactions.some(s=>{let l=ze(s,t);return l&8||(s.selection||s.docChanged)&&!(l&3)});for(let s=0;s<this.running.length;s++){let l=this.running[s];if(n||l.context.abortOnDocChange&&i.docChanged||l.updates.length+i.transactions.length>yt&&Date.now()-l.time>bt){for(let a of l.context.abortListeners)try{a();}catch(r){Q$1(this.view.state,r);}l.context.abortListeners=null,this.running.splice(s--,1);}else l.updates.push(...i.transactions);}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(s=>s.effects.some(l=>l.is(G)))&&(this.pendingStart=true);let o=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(l=>l.active.source==s.source))?setTimeout(()=>this.startUpdate(),o):-1,this.composing!=0)for(let s of i.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3);}startUpdate(){this.debounceUpdate=-1,this.pendingStart=false;let{state:i}=this.view,e=i.field(g);for(let t of e.active)t.isPending&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(y).updateSyncTime));}startQuery(i){let{state:e}=this.view,t=D(e),n=new Q(e,t,i.explicit,this.view),o=new pe(i,n);this.running.push(o),Promise.resolve(i.source(n)).then(s=>{o.context.aborted||(o.done=s||null,this.scheduleAccept());},s=>{this.view.dispatch({effects:W.of(null)}),Q$1(this.view.state,s);});}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(y).updateSyncTime));}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(y),n=this.view.state.field(g);for(let o=0;o<this.running.length;o++){let s=this.running[o];if(s.done===void 0)continue;if(this.running.splice(o--,1),s.done){let a=D(s.updates.length?s.updates[0].startState:this.view.state),r=Math.min(a,s.done.from+(s.active.explicit?0:1)),h=new J(s.active.source,s.active.explicit,r,s.done,s.done.from,(i=s.done.to)!==null&&i!==void 0?i:a);for(let c of s.updates)h=h.update(c,t);if(h.hasResult()){e.push(h);continue}}let l=n.active.find(a=>a.source==s.active.source);if(l&&l.isPending)if(s.done==null){let a=new T(s.active.source,0);for(let r of s.updates)a=a.update(r,t);a.isPending||e.push(a);}else this.startQuery(l);}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:be.of(e)});}},{eventHandlers:{blur(i){let e=this.view.state.field(g,false);if(e&&e.tooltip&&this.view.state.facet(y).closeOnBlur){let t=e.open&&Gl(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:W.of(null)}),10);}},compositionstart(){this.composing=1;},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:G.of(false)}),20),this.composing=0;}}}),vt=typeof navigator=="object"&&/Win/.test(navigator.platform),wt=pt$2.highest(pt$1.domEventHandlers({keydown(i,e){let t=e.state.field(g,false);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(vt&&i.altKey)||i.metaKey)return false;let n=t.open.options[t.open.selected],o=t.active.find(l=>l.source==n.source),s=n.completion.commitCharacters||o.result.commitCharacters;return s&&s.indexOf(i.key)>-1&&xe(e,n),false}})),Ye=pt$1.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:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),de=class{constructor(e,t,n,o){this.field=e,this.line=t,this.from=n,this.to=o;}},me=class i{constructor(e,t,n){this.field=e,this.from=t,this.to=n;}map(e){let t=e.mapPos(this.from,-1,A$1.TrackDel),n=e.mapPos(this.to,1,A$1.TrackDel);return t==null||n==null?null:new i(this.field,t,n)}},ge=class i{constructor(e,t){this.lines=e,this.fieldPositions=t;}instantiate(e,t){let n=[],o=[t],s=e.doc.lineAt(t),l=/^\s*/.exec(s.text)[0];for(let r of this.lines){if(n.length){let h=l,c=/^\t*/.exec(r)[0].length;for(let f=0;f<c;f++)h+=e.facet(cn);o.push(t+h.length-c),r=h+r.slice(c);}n.push(r),t+=r.length+1;}let a=this.fieldPositions.map(r=>new me(r.field,o[r.line]+r.from,o[r.line]+r.to));return {text:n,ranges:a}}static parse(e){let t=[],n=[],o=[],s;for(let l of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let a=s[1]?+s[1]:null,r=s[2]||s[3]||"",h=-1,c=r.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f<t.length;f++)(a!=null?t[f].seq==a:c&&t[f].name==c)&&(h=f);if(h<0){let f=0;for(;f<t.length&&(a==null||t[f].seq!=null&&t[f].seq<a);)f++;t.splice(f,0,{seq:a,name:c}),h=f;for(let u of o)u.field>=h&&u.field++;}for(let f of o)if(f.line==n.length&&f.from>s.index){let u=s[2]?3+(s[1]||"").length:2;f.from-=u,f.to-=u;}o.push(new de(h,n.length,s.index,s.index+c.length)),l=l.slice(0,s.index)+r+l.slice(s.index+s[0].length);}l=l.replace(/\\([{}])/g,(a,r,h)=>{for(let c of o)c.line==n.length&&c.from>h&&(c.from--,c.to--);return r}),n.push(l);}return new i(n,o)}},Ct=A.widget({widget:new class extends rt$1{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return false}}}),St=A.mark({class:"cm-snippetField"}),k=class i{constructor(e,t){this.ranges=e,this.active=t,this.deco=A.set(e.map(n=>(n.from==n.to?Ct:St).range(n.from,n.to)),true);}map(e){let t=[];for(let n of this.ranges){let o=n.map(e);if(!o)return null;t.push(o);}return new i(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(n=>n.field==this.active&&n.from<=t.from&&n.to>=t.to))}},U=I.define({map(i,e){return i&&i.map(e)}}),It=I.define(),R=V.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(U))return t.value;if(t.is(It)&&i)return new k(i.ranges,t.value)}return i&&e.docChanged&&(i=i.map(e.changes)),i&&e.selection&&!i.selectionInsideField(e.selection)&&(i=null),i},provide:i=>pt$1.decorations.from(i,e=>e?e.deco:A.none)});function ve(i,e){return v.create(i.filter(t=>t.field==e).map(t=>v.range(t.from,t.to)))}function Tt(i){let e=ge.parse(i);return (t,n,o,s)=>{let{text:l,ranges:a}=e.instantiate(t.state,o),{main:r}=t.state.selection,h={changes:{from:o,to:s==r.from?r.to:s,insert:m.of(l)},scrollIntoView:true,annotations:n?[ye.of(n),D$1.userEvent.of("input.complete")]:void 0};if(a.length&&(h.selection=ve(a,0)),a.some(c=>c.field>0)){let c=new k(a,0),f=h.effects=[U.of(c)];t.state.field(R,false)===void 0&&f.push(I.appendConfig.of([R,Rt,Pt,Ye]));}t.dispatch(t.state.update(h));}}function Qe(i){return ({state:e,dispatch:t})=>{let n=e.field(R,false);if(!n||i<0&&n.active==0)return false;let o=n.active+i,s=i>0&&!n.ranges.some(l=>l.field==o+i);return t(e.update({selection:ve(n.ranges,o),effects:U.of(s?null:new k(n.ranges,o)),scrollIntoView:true})),true}}var Ot=({state:i,dispatch:e})=>i.field(R,false)?(e(i.update({effects:U.of(null)})),true):false,At=Qe(1),Et=Qe(-1);function Gt(i){let e=i.field(R,false);return !!(e&&e.ranges.some(t=>t.field==e.active+1))}function Jt(i){let e=i.field(R,false);return !!(e&&e.active>0)}var Dt=[{key:"Tab",run:At,shift:Et},{key:"Escape",run:Ot}],We=k$1.define({combine(i){return i.length?i[0]:Dt}}),Rt=pt$2.highest(Vo.compute([We],i=>i.facet(We)));function Zt(i,e){return F(E$1({},e),{apply:Tt(i)})}var Pt=pt$1.domEventHandlers({mousedown(i,e){let t=e.state.field(R,false),n;if(!t||(n=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return false;let o=t.ranges.find(s=>s.from<=n&&s.to>=n);return !o||o.field==t.active?false:(e.dispatch({selection:ve(t.ranges,o.field),effects:U.of(t.ranges.some(s=>s.field>o.field)?new k(t.ranges,o.field):null),scrollIntoView:true}),true)}});function Lt(i){let e=i.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${e}]+`,"ug")}catch(t){return new RegExp(`[w${e}]`,"g")}}function Ne(i,e){return new RegExp(e(i.source),i.unicode?"u":"")}var Ue=Object.create(null);function kt(i){return Ue[i]||(Ue[i]=new WeakMap)}function je(i,e,t,n,o){for(let s=i.iterLines(),l=0;!s.next().done;){let{value:a}=s,r;for(e.lastIndex=0;r=e.exec(a);)if(!n[r[0]]&&l+r.index!=o&&(t.push({type:"text",label:r[0]}),n[r[0]]=true,t.length>=2e3))return;l+=a.length+1;}}function Xe(i,e,t,n,o){let s=i.length>=1e3,l=s&&e.get(i);if(l)return l;let a=[],r=Object.create(null);if(i.children){let h=0;for(let c of i.children){if(c.length>=1e3)for(let f of Xe(c,e,t,n-h,o-h))r[f.label]||(r[f.label]=true,a.push(f));else je(c,t,a,r,o-h);h+=c.length+1;}}else je(i,t,a,r,o);return s&&a.length<2e3&&e.set(i,a),a}var _t=i=>{var e;let t=(e=i.state.languageDataAt("wordChars",i.pos)[0])!==null&&e!==void 0?e:"",n=Lt(t),o=i.matchBefore(Ne(n,a=>a+"$"));if(!o&&!i.explicit)return null;let s=o?o.from:i.pos,l=Xe(i.state.doc,kt(t),n,5e4,s);return {from:s,options:l,validFor:Ne(n,a=>"^"+a)}},N={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},E=I.define({map(i,e){let t=e.mapPos(i,-1,A$1.TrackAfter);return t??void 0}}),we=new class extends ${};we.startSide=1;we.endSide=-1;var Ge=V.define({create(){return ie.empty},update(i,e){if(i=i.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);i=i.update({filter:n=>n>=t.from&&n<=t.to});}for(let t of e.effects)t.is(E)&&(i=i.update({add:[we.range(t.value,t.value+1)]}));return i}});function ei(){return [Bt,Ge]}var re="()[]{}<>\xAB\xBB\xBB\xAB\uFF3B\uFF3D\uFF5B\uFF5D";function Je(i){for(let e=0;e<re.length;e+=2)if(re.charCodeAt(e)==i)return re.charAt(e+1);return dt$1(i<128?i:i+1)}function Ze(i,e){return i.languageDataAt("closeBrackets",e)[0]||N}var Mt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Bt=pt$1.inputHandler.of((i,e,t,n)=>{if((Mt?i.composing:i.compositionStarted)||i.state.readOnly)return false;let o=i.state.selection.main;if(n.length>2||n.length==2&>$1(ct$1(n,0))==1||e!=o.from||t!=o.to)return false;let s=Ft(i.state,n);return s?(i.dispatch(s),true):false}),$t=({state:i,dispatch:e})=>{if(i.readOnly)return false;let n=Ze(i,i.selection.main.head).brackets||N.brackets,o=null,s=i.changeByRange(l=>{if(l.empty){let a=Wt(i.doc,l.head);for(let r of n)if(r==a&&_(i.doc,l.head)==Je(ct$1(r,0)))return {changes:{from:l.head-r.length,to:l.head+r.length},range:v.cursor(l.head-r.length)}}return {range:o=l}});return o||e(i.update(s,{scrollIntoView:true,userEvent:"delete.backward"})),!o},ti=[{key:"Backspace",run:$t}];function Ft(i,e){let t=Ze(i,i.selection.main.head),n=t.brackets||N.brackets;for(let o of n){let s=Je(ct$1(o,0));if(e==o)return s==o?jt(i,o,n.indexOf(o+o+o)>-1,t):Nt(i,o,s,t.before||N.before);if(e==s&&_e(i,i.selection.main.from))return Ut(i,o,s)}return null}function _e(i,e){let t=false;return i.field(Ge).between(0,i.doc.length,n=>{n==e&&(t=true);}),t}function _(i,e){let t=i.sliceString(e,e+2);return t.slice(0,gt$1(ct$1(t,0)))}function Wt(i,e){let t=i.sliceString(e-2,e);return gt$1(ct$1(t,0))==t.length?t:t.slice(1)}function Nt(i,e,t,n){let o=null,s=i.changeByRange(l=>{if(!l.empty)return {changes:[{insert:e,from:l.from},{insert:t,from:l.to}],effects:E.of(l.to+e.length),range:v.range(l.anchor+e.length,l.head+e.length)};let a=_(i.doc,l.head);return !a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+t,from:l.head},effects:E.of(l.head+e.length),range:v.cursor(l.head+e.length)}:{range:o=l}});return o?null:i.update(s,{scrollIntoView:true,userEvent:"input.type"})}function Ut(i,e,t){let n=null,o=i.changeByRange(s=>s.empty&&_(i.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:v.cursor(s.head+t.length)}:n={range:s});return n?null:i.update(o,{scrollIntoView:true,userEvent:"input.type"})}function jt(i,e,t,n){let o=n.stringPrefixes||N.stringPrefixes,s=null,l=i.changeByRange(a=>{if(!a.empty)return {changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:E.of(a.to+e.length),range:v.range(a.anchor+e.length,a.head+e.length)};let r=a.head,h=_(i.doc,r),c;if(h==e){if(He(i,r))return {changes:{insert:e+e,from:r},effects:E.of(r+e.length),range:v.cursor(r+e.length)};if(_e(i,r)){let u=t&&i.sliceDoc(r,r+e.length*3)==e+e+e?e+e+e:e;return {changes:{from:r,to:r+u.length,insert:u},range:v.cursor(r+u.length)}}}else {if(t&&i.sliceDoc(r-2*e.length,r)==e+e&&(c=Ve(i,r-2*e.length,o))>-1&&He(i,c))return {changes:{insert:e+e+e+e,from:r},effects:E.of(r+e.length),range:v.cursor(r+e.length)};if(i.charCategorizer(r)(h)!=b.Word&&Ve(i,r,o)>-1&&!Ht(i,r,e,o))return {changes:{insert:e+e,from:r},effects:E.of(r+e.length),range:v.cursor(r+e.length)}}return {range:s=a}});return s?null:i.update(l,{scrollIntoView:true,userEvent:"input.type"})}function He(i,e){let t=z(i).resolveInner(e+1);return t.parent&&t.from==e}function Ht(i,e,t,n){let o=z(i).resolveInner(e,-1),s=n.reduce((l,a)=>Math.max(l,a.length),0);for(let l=0;l<5;l++){let a=i.sliceDoc(o.from,Math.min(o.to,o.from+t.length+s)),r=a.indexOf(t);if(!r||r>-1&&n.indexOf(a.slice(0,r))>-1){let c=o.firstChild;for(;c&&c.from==o.from&&c.to-c.from>t.length+r;){if(i.sliceDoc(c.to-t.length,c.to)==t)return false;c=c.firstChild;}return true}let h=o.to==e&&o.parent;if(!h)break;o=h;}return false}function Ve(i,e,t){let n=i.charCategorizer(e);if(n(i.sliceDoc(e-1,e))!=b.Word)return e;for(let o of t){let s=e-o.length;if(i.sliceDoc(s,e)==o&&n(i.sliceDoc(s-1,s))!=b.Word)return s}return -1}function ii(i={}){return [wt,g,y.of(i),xt,qt,Ye]}var Vt=[{key:"Ctrl-Space",run:le},{mac:"Alt-`",run:le},{mac:"Alt-i",run:le},{key:"Escape",run:gt},{key:"ArrowDown",run:Y(true)},{key:"ArrowUp",run:Y(false)},{key:"PageDown",run:Y(true,"page")},{key:"PageUp",run:Y(false,"page")},{key:"Enter",run:mt}],qt=pt$2.highest(Vo.computeN([y],i=>i.facet(y).defaultKeymap?[Vt]:[]));function ni(i){let e=i.field(g,false);return e&&e.active.some(t=>t.isPending)?"pending":e&&e.active.some(t=>t.state!=0)?"active":null}var qe=new WeakMap;function oi(i){var e;let t=(e=i.field(g,false))===null||e===void 0?void 0:e.open;if(!t||t.disabled)return [];let n=qe.get(t.options);return n||qe.set(t.options,n=t.options.map(o=>o.completion)),n}function si(i){var e;let t=(e=i.field(g,false))===null||e===void 0?void 0:e.open;return t&&!t.disabled&&t.selected>=0?t.options[t.selected].completion:null}function li(i){var e;let t=(e=i.field(g,false))===null||e===void 0?void 0:e.open;return t&&!t.disabled&&t.selected>=0?t.selected:null}function ri(i){return Z.of(i)}export{Q as CompletionContext,mt as acceptCompletion,ii as autocompletion,Ot as clearSnippet,ei as closeBrackets,ti as closeBracketsKeymap,gt as closeCompletion,_t as completeAnyWord,tt as completeFromList,Vt as completionKeymap,ni as completionStatus,oi as currentCompletions,$t as deleteBracketPair,Gt as hasNextSnippetField,Jt as hasPrevSnippetField,Qt as ifIn,Xt as ifNotIn,Ft as insertBracket,it as insertCompletionText,Y as moveCompletionSelection,At as nextSnippetField,ye as pickedCompletion,Et as prevSnippetField,si as selectedCompletion,li as selectedCompletionIndex,ri as setSelectedCompletion,Tt as snippet,Zt as snippetCompletion,We as snippetKeymap,le as startCompletion};