@i14ks/ccv 0.11.0 → 0.12.0

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.
Files changed (27) hide show
  1. package/bundle/ccv.mjs +69 -5
  2. package/package.json +1 -1
  3. package/web/assets/{codemirror-BVMwXG_R.js → codemirror-Byu5BOry.js} +1 -1
  4. package/web/assets/{index-BlZDoET-.js → index-BednlsnR.js} +1 -1
  5. package/web/assets/{index-gl1MvN4b.js → index-BhTNEiv0.js} +1 -1
  6. package/web/assets/{index-CrW8SGCA.js → index-BiJkY5lu.js} +1 -1
  7. package/web/assets/{index-CPWAVXhz.js → index-Buinfinc.js} +1 -1
  8. package/web/assets/{index-mnefozuu.js → index-CBtC705w.js} +1 -1
  9. package/web/assets/{index-C1BT9XMC.js → index-CNdrabZC.js} +1 -1
  10. package/web/assets/{index-BsH-IJBy.js → index-CPLRJruN.js} +1 -1
  11. package/web/assets/{index-BZ8Mi5_8.js → index-CQlHFJzv.js} +1 -1
  12. package/web/assets/{index-C-geC5VJ.js → index-CmXpz6wO.js} +1 -1
  13. package/web/assets/{index-Bu_Ukh1_.js → index-CsBX1VvC.js} +1 -1
  14. package/web/assets/{index-DKofSKA7.js → index-CzPnlrTh.js} +1 -1
  15. package/web/assets/index-D5y0Nk74.css +1 -0
  16. package/web/assets/{index-DAjl7nVl.js → index-DG-5rv4t.js} +1 -1
  17. package/web/assets/{index-DLDXVZaf.js → index-DJN6swZl.js} +1 -1
  18. package/web/assets/{index-DJYXqBtm.js → index-DJPI4hL4.js} +1 -1
  19. package/web/assets/{index-BCAmULlL.js → index-DM4oBLe8.js} +1 -1
  20. package/web/assets/{index-Ey94wZ1k.js → index-DNppE7jj.js} +1 -1
  21. package/web/assets/index-DO6gKWcT.js +132 -0
  22. package/web/assets/{index-C59fVtiO.js → index-DSzfAcOE.js} +1 -1
  23. package/web/assets/{index-BFLfK-j6.js → index-DXYp3jsl.js} +1 -1
  24. package/web/assets/{index-AByrn5FE.js → index-rekQBGDD.js} +1 -1
  25. package/web/index.html +2 -2
  26. package/web/assets/index-DRlKZHMW.js +0 -132
  27. package/web/assets/index-c0zvhlqR.css +0 -1
@@ -1 +1 @@
1
- import{codePointAt as v,EditorSelection as C,codePointSize as T,StateField as _,RangeSet as Pe,Prec as ee,Facet as be,combineConfig as Le,fromCodePoint as xe,StateEffect as O,MapMode as G,RangeValue as Me,Annotation as ke,CharCategory as J,Transaction as Be,Text as Fe}from"./index-BHot-lnj.js";import{E as L,p as $e,V as We,q as Z,t as Ce,n as we,o as Ne,D as H,W as Ue}from"./index-891wE-Rj.js";import{e as q,j as je}from"./index-DKofSKA7.js";class ve{constructor(e,t,n,s){this.state=e,this.pos=t,this.explicit=n,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=q(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),s=t.text.slice(n-t.from,this.pos-t.from),o=s.search(Se(e,!1));return o<0?null:{from:n+o,to:this.pos,text:s.slice(o)}}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 ce(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 Ve(i){let e=Object.create(null),t=Object.create(null);for(let{label:s}of i){e[s[0]]=!0;for(let o=1;o<s.length;o++)t[s[o]]=!0}let n=ce(e)+ce(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function He(i){let e=i.map(s=>typeof s=="string"?{label:s}:s),[t,n]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:Ve(e);return s=>{let o=s.matchBefore(n);return o||s.explicit?{from:o?o.from:s.pos,options:e,validFor:t}:null}}function Nt(i,e){return t=>{for(let n=q(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)}}class fe{constructor(e,t,n,s){this.completion=e,this.source=t,this.match=n,this.score=s}}function A(i){return i.selection.main.from}function Se(i,e){var t;let{source:n}=i,s=e&&n[0]!="^",o=n[n.length-1]!="$";return!s&&!o?i:new RegExp(`${s?"^":""}(?:${n})${o?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}const te=ke.define();function qe(i,e,t,n){let{main:s}=i.selection,o=t-s.from,l=n-s.from;return{...i.changeByRange(a=>{if(a!=s&&t!=n&&i.sliceDoc(a.from+o,a.from+l)!=i.sliceDoc(t,n))return{range:a};let r=i.toText(e);return{changes:{from:a.from+o,to:n==s.from?a.to:a.from+l,insert:r},range:C.cursor(a.from+o+r.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const he=new WeakMap;function ze(i){if(!Array.isArray(i))return i;let e=he.get(i);return e||he.set(i,e=He(i)),e}const j=O.define(),B=O.define();class Ke{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=v(e,t),s=T(n);this.chars.push(n);let o=e.slice(t,t+s),l=o.toUpperCase();this.folded.push(v(l==o?o.toLowerCase():l,0)),t+=s}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:s,precise:o,byWord:l}=this;if(t.length==1){let d=v(e,0),D=T(d),S=D==e.length?0:-100;if(d!=t[0])if(d==n[0])S+=-200;else return null;return this.ret(S,[0,D])}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,D=Math.min(e.length,200);d<D&&h<r;){let S=v(e,d);(S==t[h]||S==n[h])&&(s[h++]=d),d+=T(S)}if(h<r)return null}let c=0,f=0,p=!1,u=0,m=-1,y=-1,k=/[a-z]/.test(e),I=!0;for(let d=0,D=Math.min(e.length,200),S=0;d<D&&f<r;){let b=v(e,d);a<0&&(c<r&&b==t[c]&&(o[c++]=d),u<r&&(b==t[u]||b==n[u]?(u==0&&(m=d),y=d+1,u++):u=0));let N,K=b<255?b>=48&&b<=57||b>=97&&b<=122?2:b>=65&&b<=90?1:0:(N=xe(b))!=N.toLowerCase()?1:N!=N.toUpperCase()?2:0;(!d||K==1&&k||S==0&&K!=0)&&(t[f]==b||n[f]==b&&(p=!0)?l[f++]=d:l.length&&(I=!1)),S=K,d+=T(b)}return f==r&&l[0]==0&&I?this.result(-100+(p?-200:0),l,e):u==r&&m==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):u==r?this.ret(-900-e.length,[m,y]):f==r?this.result(-100+(p?-200:0)+-700+(I?0:-1100),l,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,n){let s=[],o=0;for(let l of t){let a=l+(this.astral?T(v(n,l)):1);o&&s[o-1]==l?s[o-1]=a:(s[o++]=l,s[o++]=a)}return this.ret(e-n.length,s)}}class Qe{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)}}const g=be.define({combine(i){return Le(i,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Ye,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=>pe(e(n),t(n)),optionClass:(e,t)=>n=>pe(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function pe(i,e){return i?e?i+" "+e:i:e}function Ye(i,e,t,n,s,o){let l=i.textDirection==Ne.RTL,a=l,r=!1,h="top",c,f,p=e.left-s.left,u=s.right-e.right,m=n.right-n.left,y=n.bottom-n.top;if(a&&p<Math.min(m,u)?a=!1:!a&&u<Math.min(m,p)&&(a=!0),m<=(a?p:u))c=Math.max(s.top,Math.min(t.top,s.bottom-y))-e.top,f=Math.min(400,a?p:u);else{r=!0,f=Math.min(400,(l?e.right:s.right-e.left)-30);let d=s.bottom-e.bottom;d>=y||d>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let k=(e.bottom-e.top)/o.offsetHeight,I=(e.right-e.left)/o.offsetWidth;return{style:`${h}: ${c/k}px; max-width: ${f/I}px`,class:"cm-completionInfo-"+(r?l?"left-narrow":"right-narrow":a?"left":"right")}}const ie=O.define();function Xe(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(s=>"cm-completionIcon-"+s)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,s,o){let l=document.createElement("span");l.className="cm-completionLabel";let a=t.displayLabel||t.label,r=0;for(let h=0;h<o.length;){let c=o[h++],f=o[h++];c>r&&l.appendChild(document.createTextNode(a.slice(r,c)));let p=l.appendChild(document.createElement("span"));p.appendChild(document.createTextNode(a.slice(c,f))),p.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 Q(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let n=Math.ceil((i-e)/t);return{from:i-n*t,to:i-(n-1)*t}}class Ge{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 s=e.state.field(t),{options:o,selected:l}=s.open,a=e.state.facet(g);this.optionContent=Xe(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=Q(o.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:ie.of(c)}),r.preventDefault())}}),this.dom.addEventListener("focusout",r=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(g).closeOnBlur&&r.relatedTarget!=e.contentDOM&&e.dispatch({effects:B.of(null)})}),this.showOptions(o,s.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),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=s){let{options:o,selected:l,disabled:a}=n.open;(!s.open||s.open.options!=o)&&(this.range=Q(o.length,l,e.state.facet(g).maxRenderedOptions),this.showOptions(o,n.id)),this.updateSel(),a!=((t=s.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=Q(t.options.length,t.selected,this.view.state.facet(g).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:o}=s;if(!o)return;let l=typeof o=="string"?document.createTextNode(o):o(s);if(!l)return;"then"in l?l.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>Z(this.view.state,a,"completion info")):(this.addInfoPane(l,s),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:s,destroy:o}=e;n.appendChild(s),this.infoDestroy=o||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,s=this.range.from;n;n=n.nextSibling,s++)n.nodeName!="LI"||!n.id?s--:s==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&&Ze(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(),s=e.getBoundingClientRect(),o=this.space;if(!o){let l=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return s.top>Math.min(o.bottom,t.bottom)-10||s.bottom<Math.max(o.top,t.top)+10?null:this.view.state.facet(g).positionInfo(this.view,t,s,n,o,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){const s=document.createElement("ul");s.id=t,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",l=>{l.target==s&&l.preventDefault()});let o=null;for(let l=n.from;l<n.to;l++){let{completion:a,match:r}=e[l],{section:h}=a;if(h){let p=typeof h=="string"?h:h.name;if(p!=o&&(l>n.from||n.from==0))if(o=p,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let u=s.appendChild(document.createElement("completion-section"));u.textContent=p}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+l,c.setAttribute("role","option");let f=this.optionClass(a);f&&(c.className=f);for(let p of this.optionContent){let u=p(a,this.view.state,this.view,r);u&&c.appendChild(u)}}return n.from&&s.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function Je(i,e){return t=>new Ge(t,i,e)}function Ze(i,e){let t=i.getBoundingClientRect(),n=e.getBoundingClientRect(),s=t.height/i.offsetHeight;n.top<t.top?i.scrollTop-=(t.top-n.top)/s:n.bottom>t.bottom&&(i.scrollTop+=(n.bottom-t.bottom)/s)}function ue(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function _e(i,e){let t=[],n=null,s=null,o=c=>{t.push(c);let{section:f}=c.completion;if(f){n||(n=[]);let p=typeof f=="string"?f:f.name;n.some(u=>u.name==p)||n.push(typeof f=="string"?{name:p}:f)}},l=e.facet(g);for(let c of i)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let p of c.result.options)o(new fe(p,c.source,f?f(p):[],1e9-t.length));else{let p=e.sliceDoc(c.from,c.to),u,m=l.filterStrict?new Qe(p):new Ke(p);for(let y of c.result.options)if(u=m.match(y.label)){let k=y.displayLabel?f?f(y,u.matched):[]:u.matched,I=u.score+(y.boost||0);if(o(new fe(y,c.source,k,I)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:d}=y.section;s||(s=Object.create(null)),s[d]=Math.max(I,s[d]||-1e9)}}}}if(n){let c=Object.create(null),f=0,p=(u,m)=>(u.rank==="dynamic"&&m.rank==="dynamic"?s[m.name]-s[u.name]:0)||(typeof u.rank=="number"?u.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(u.name<m.name?-1:1);for(let u of n.sort(p))f-=1e5,c[u.name]=f;for(let u of t){let{section:m}=u.completion;m&&(u.score+=c[typeof m=="string"?m:m.name])}}let a=[],r=null,h=l.compareCompletions;for(let c of t.sort((f,p)=>p.score-f.score||h(f.completion,p.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):ue(c.completion)>ue(r)&&(a[a.length-1]=c),r=c.completion}return a}class R{constructor(e,t,n,s,o,l){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=s,this.selected=o,this.disabled=l}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new R(this.options,de(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,s,o,l){if(s&&!l&&e.some(h=>h.isPending))return s.setDisabled();let a=_e(e,t);if(!a.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let r=t.facet(g).selectOnOpen?0:-1;if(s&&s.selected!=r&&s.selected!=-1){let h=s.options[s.selected].completion;for(let c=0;c<a.length;c++)if(a[c].completion==h){r=c;break}}return new R(a,de(n,r),{pos:e.reduce((h,c)=>c.hasResult()?Math.min(h,c.from):h,1e8),create:ot,above:o.aboveCursor},s?s.timestamp:Date.now(),r,!1)}map(e){return new R(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new R(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class V{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new V(nt,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(g),o=(n.override||t.languageDataAt("autocomplete",A(t)).map(ze)).map(r=>(this.active.find(c=>c.source==r)||new w(r,this.active.some(c=>c.state!=0)?1:0)).update(e,n));o.length==this.active.length&&o.every((r,h)=>r==this.active[h])&&(o=this.active);let l=this.open,a=e.effects.some(r=>r.is(ne));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||o.some(r=>r.hasResult()&&e.changes.touchesRange(r.from,r.to))||!et(o,this.active)||a?l=R.build(o,t,this.id,l,n,a):l&&l.disabled&&!o.some(r=>r.isPending)&&(l=null),!l&&o.every(r=>!r.isPending)&&o.some(r=>r.hasResult())&&(o=o.map(r=>r.hasResult()?new w(r.source,0):r));for(let r of e.effects)r.is(ie)&&(l=l&&l.setSelected(r.value,this.id));return o==this.active&&l==this.open?this:new V(o,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?tt:it}}function et(i,e){if(i==e)return!0;for(let t=0,n=0;;){for(;t<i.length&&!i[t].hasResult();)t++;for(;n<e.length&&!e[n].hasResult();)n++;let s=t==i.length,o=n==e.length;if(s||o)return s==o;if(i[t++].result!=e[n++].result)return!1}}const tt={"aria-autocomplete":"list"},it={};function de(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}const nt=[];function Ie(i,e){if(i.isUserEvent("input.complete")){let n=i.annotation(te);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}class w{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=Ie(e,t),s=this;(n&8||n&16&&this.touches(e))&&(s=new w(s.source,0)),n&4&&s.state==0&&(s=new w(this.source,1)),s=s.updateFor(e,n);for(let o of e.effects)if(o.is(j))s=new w(s.source,1,o.value);else if(o.is(B))s=new w(s.source,0);else if(o.is(ne))for(let l of o.value)l.source==s.source&&(s=l);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(A(e.state))}}class P extends w{constructor(e,t,n,s,o,l){super(e,3,t),this.limit=n,this.result=s,this.from=o,this.to=l}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let o=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),a=A(e.state);if(a>l||!s||t&2&&(A(e.startState)==this.from||a<this.limit))return new w(this.source,t&4?1:0);let r=e.changes.mapPos(this.limit);return st(s.validFor,e.state,o,l)?new P(this.source,this.explicit,r,s,o,l):s.update&&(s=s.update(s,o,l,new ve(e.state,a,!1)))?new P(this.source,this.explicit,r,s,s.from,(n=s.to)!==null&&n!==void 0?n:A(e.state)):new w(this.source,1,this.explicit)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;return t?new P(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1)):new w(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function st(i,e,t,n){if(!i)return!1;let s=e.sliceDoc(t,n);return typeof i=="function"?i(s,t,n,e):Se(i,!0).test(s)}const ne=O.define({map(i,e){return i.map(t=>t.map(e))}}),x=_.define({create(){return V.start()},update(i,e){return i.update(e)},provide:i=>[$e.from(i,e=>e.tooltip),L.contentAttributes.from(i,e=>e.attrs)]});function se(i,e){const t=e.completion.apply||e.completion.label;let n=i.state.field(x).active.find(s=>s.source==e.source);return n instanceof P?(typeof t=="string"?i.dispatch({...qe(i.state,t,n.from,n.to),annotations:te.of(e.completion)}):t(i,e.completion,n.from,n.to),!0):!1}const ot=Je(x,se);function U(i,e="option"){return t=>{let n=t.state.field(x,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(g).interactionDelay)return!1;let s=1,o;e=="page"&&(o=Ce(t,n.open.tooltip))&&(s=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:l}=n.open.options,a=n.open.selected>-1?n.open.selected+s*(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:ie.of(a)}),!0}}const lt=i=>{let e=i.state.field(x,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(g).interactionDelay?!1:se(i,e.open.options[e.open.selected])},Y=i=>i.state.field(x,!1)?(i.dispatch({effects:j.of(!0)}),!0):!1,rt=i=>{let e=i.state.field(x,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:B.of(null)}),!0)};class at{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const ct=50,ft=1e3,ht=We.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(x).active)e.isPending&&this.startQuery(e)}update(i){let e=i.state.field(x),t=i.state.facet(g);if(!i.selectionSet&&!i.docChanged&&i.startState.field(x)==e)return;let n=i.transactions.some(o=>{let l=Ie(o,t);return l&8||(o.selection||o.docChanged)&&!(l&3)});for(let o=0;o<this.running.length;o++){let l=this.running[o];if(n||l.context.abortOnDocChange&&i.docChanged||l.updates.length+i.transactions.length>ct&&Date.now()-l.time>ft){for(let a of l.context.abortListeners)try{a()}catch(r){Z(this.view.state,r)}l.context.abortListeners=null,this.running.splice(o--,1)}else l.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(o=>o.effects.some(l=>l.is(j)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(l=>l.active.source==o.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let o of i.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(x);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(g).updateSyncTime))}startQuery(i){let{state:e}=this.view,t=A(e),n=new ve(e,t,i.explicit,this.view),s=new at(i,n);this.running.push(s),Promise.resolve(i.source(n)).then(o=>{s.context.aborted||(s.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:B.of(null)}),Z(this.view.state,o)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(g).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(g),n=this.view.state.field(x);for(let s=0;s<this.running.length;s++){let o=this.running[s];if(o.done===void 0)continue;if(this.running.splice(s--,1),o.done){let a=A(o.updates.length?o.updates[0].startState:this.view.state),r=Math.min(a,o.done.from+(o.active.explicit?0:1)),h=new P(o.active.source,o.active.explicit,r,o.done,o.done.from,(i=o.done.to)!==null&&i!==void 0?i:a);for(let c of o.updates)h=h.update(c,t);if(h.hasResult()){e.push(h);continue}}let l=n.active.find(a=>a.source==o.active.source);if(l&&l.isPending)if(o.done==null){let a=new w(o.active.source,0);for(let r of o.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:ne.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(x,!1);if(e&&e.tooltip&&this.view.state.facet(g).closeOnBlur){let t=e.open&&Ce(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:B.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:j.of(!1)}),20),this.composing=0}}}),pt=typeof navigator=="object"&&/Win/.test(navigator.platform),ut=ee.highest(L.domEventHandlers({keydown(i,e){let t=e.state.field(x,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(pt&&i.altKey)||i.metaKey)return!1;let n=t.open.options[t.open.selected],s=t.active.find(l=>l.source==n.source),o=n.completion.commitCharacters||s.result.commitCharacters;return o&&o.indexOf(i.key)>-1&&se(e,n),!1}})),Te=L.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"}}});class dt{constructor(e,t,n,s){this.field=e,this.line=t,this.from=n,this.to=s}}class oe{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,G.TrackDel),n=e.mapPos(this.to,1,G.TrackDel);return t==null||n==null?null:new oe(this.field,t,n)}}class le{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],s=[t],o=e.doc.lineAt(t),l=/^\s*/.exec(o.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(je);s.push(t+h.length-c),r=h+r.slice(c)}n.push(r),t+=r.length+1}let a=this.fieldPositions.map(r=>new oe(r.field,s[r.line]+r.from,s[r.line]+r.to));return{text:n,ranges:a}}static parse(e){let t=[],n=[],s=[],o;for(let l of e.split(/\r\n?|\n/)){for(;o=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let a=o[1]?+o[1]:null,r=o[2]||o[3]||"",h=-1;a===0&&(a=1e9);let 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 p of s)p.field>=h&&p.field++}for(let f of s)if(f.line==n.length&&f.from>o.index){let p=o[2]?3+(o[1]||"").length:2;f.from-=p,f.to-=p}s.push(new dt(h,n.length,o.index,o.index+c.length)),l=l.slice(0,o.index)+r+l.slice(o.index+o[0].length)}l=l.replace(/\\([{}])/g,(a,r,h)=>{for(let c of s)c.line==n.length&&c.from>h&&(c.from--,c.to--);return r}),n.push(l)}return new le(n,s)}}let mt=H.widget({widget:new class extends Ue{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),gt=H.mark({class:"cm-snippetField"});class M{constructor(e,t){this.ranges=e,this.active=t,this.deco=H.set(e.map(n=>(n.from==n.to?mt:gt).range(n.from,n.to)),!0)}map(e){let t=[];for(let n of this.ranges){let s=n.map(e);if(!s)return null;t.push(s)}return new M(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))}}const W=O.define({map(i,e){return i&&i.map(e)}}),yt=O.define(),F=_.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(W))return t.value;if(t.is(yt)&&i)return new M(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=>L.decorations.from(i,e=>e?e.deco:H.none)});function re(i,e){return C.create(i.filter(t=>t.field==e).map(t=>C.range(t.from,t.to)))}function bt(i){let e=le.parse(i);return(t,n,s,o)=>{let{text:l,ranges:a}=e.instantiate(t.state,s),{main:r}=t.state.selection,h={changes:{from:s,to:o==r.from?r.to:o,insert:Fe.of(l)},scrollIntoView:!0,annotations:n?[te.of(n),Be.userEvent.of("input.complete")]:void 0};if(a.length&&(h.selection=re(a,0)),a.some(c=>c.field>0)){let c=new M(a,0),f=h.effects=[W.of(c)];t.state.field(F,!1)===void 0&&f.push(O.appendConfig.of([F,St,It,Te]))}t.dispatch(t.state.update(h))}}function Oe(i){return({state:e,dispatch:t})=>{let n=e.field(F,!1);if(!n||i<0&&n.active==0)return!1;let s=n.active+i,o=i>0&&!n.ranges.some(l=>l.field==s+i);return t(e.update({selection:re(n.ranges,s),effects:W.of(o?null:new M(n.ranges,s)),scrollIntoView:!0})),!0}}const xt=({state:i,dispatch:e})=>i.field(F,!1)?(e(i.update({effects:W.of(null)})),!0):!1,Ct=Oe(1),wt=Oe(-1),vt=[{key:"Tab",run:Ct,shift:wt},{key:"Escape",run:xt}],me=be.define({combine(i){return i.length?i[0]:vt}}),St=ee.highest(we.compute([me],i=>i.facet(me)));function Ut(i,e){return{...e,apply:bt(i)}}const It=L.domEventHandlers({mousedown(i,e){let t=e.state.field(F,!1),n;if(!t||(n=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let s=t.ranges.find(o=>o.from<=n&&o.to>=n);return!s||s.field==t.active?!1:(e.dispatch({selection:re(t.ranges,s.field),effects:W.of(t.ranges.some(o=>o.field>s.field)?new M(t.ranges,s.field):null),scrollIntoView:!0}),!0)}}),$={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},E=O.define({map(i,e){let t=e.mapPos(i,-1,G.TrackAfter);return t??void 0}}),ae=new class extends Me{};ae.startSide=1;ae.endSide=-1;const Ee=_.define({create(){return Pe.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:[ae.range(t.value,t.value+1)]}));return i}});function jt(){return[Ot,Ee]}const X="()[]{}<>«»»«[]{}";function Ae(i){for(let e=0;e<X.length;e+=2)if(X.charCodeAt(e)==i)return X.charAt(e+1);return xe(i<128?i:i+1)}function De(i,e){return i.languageDataAt("closeBrackets",e)[0]||$}const Tt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ot=L.inputHandler.of((i,e,t,n)=>{if((Tt?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let s=i.state.selection.main;if(n.length>2||n.length==2&&T(v(n,0))==1||e!=s.from||t!=s.to)return!1;let o=At(i.state,n);return o?(i.dispatch(o),!0):!1}),Et=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let n=De(i,i.selection.main.head).brackets||$.brackets,s=null,o=i.changeByRange(l=>{if(l.empty){let a=Dt(i.doc,l.head);for(let r of n)if(r==a&&z(i.doc,l.head)==Ae(v(r,0)))return{changes:{from:l.head-r.length,to:l.head+r.length},range:C.cursor(l.head-r.length)}}return{range:s=l}});return s||e(i.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Vt=[{key:"Backspace",run:Et}];function At(i,e){let t=De(i,i.selection.main.head),n=t.brackets||$.brackets;for(let s of n){let o=Ae(v(s,0));if(e==s)return o==s?Lt(i,s,n.indexOf(s+s+s)>-1,t):Rt(i,s,o,t.before||$.before);if(e==o&&Re(i,i.selection.main.from))return Pt(i,s,o)}return null}function Re(i,e){let t=!1;return i.field(Ee).between(0,i.doc.length,n=>{n==e&&(t=!0)}),t}function z(i,e){let t=i.sliceString(e,e+2);return t.slice(0,T(v(t,0)))}function Dt(i,e){let t=i.sliceString(e-2,e);return T(v(t,0))==t.length?t:t.slice(1)}function Rt(i,e,t,n){let s=null,o=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:C.range(l.anchor+e.length,l.head+e.length)};let a=z(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:C.cursor(l.head+e.length)}:{range:s=l}});return s?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Pt(i,e,t){let n=null,s=i.changeByRange(o=>o.empty&&z(i.doc,o.head)==t?{changes:{from:o.head,to:o.head+t.length,insert:t},range:C.cursor(o.head+t.length)}:n={range:o});return n?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Lt(i,e,t,n){let s=n.stringPrefixes||$.stringPrefixes,o=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:C.range(a.anchor+e.length,a.head+e.length)};let r=a.head,h=z(i.doc,r),c;if(h==e){if(ge(i,r))return{changes:{insert:e+e,from:r},effects:E.of(r+e.length),range:C.cursor(r+e.length)};if(Re(i,r)){let p=t&&i.sliceDoc(r,r+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:r,to:r+p.length,insert:p},range:C.cursor(r+p.length)}}}else{if(t&&i.sliceDoc(r-2*e.length,r)==e+e&&(c=ye(i,r-2*e.length,s))>-1&&ge(i,c))return{changes:{insert:e+e+e+e,from:r},effects:E.of(r+e.length),range:C.cursor(r+e.length)};if(i.charCategorizer(r)(h)!=J.Word&&ye(i,r,s)>-1&&!Mt(i,r,e,s))return{changes:{insert:e+e,from:r},effects:E.of(r+e.length),range:C.cursor(r+e.length)}}return{range:o=a}});return o?null:i.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function ge(i,e){let t=q(i).resolveInner(e+1);return t.parent&&t.from==e}function Mt(i,e,t,n){let s=q(i).resolveInner(e,-1),o=n.reduce((l,a)=>Math.max(l,a.length),0);for(let l=0;l<5;l++){let a=i.sliceDoc(s.from,Math.min(s.to,s.from+t.length+o)),r=a.indexOf(t);if(!r||r>-1&&n.indexOf(a.slice(0,r))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+r;){if(i.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function ye(i,e,t){let n=i.charCategorizer(e);if(n(i.sliceDoc(e-1,e))!=J.Word)return e;for(let s of t){let o=e-s.length;if(i.sliceDoc(o,e)==s&&n(i.sliceDoc(o-1,o))!=J.Word)return o}return-1}function Ht(i={}){return[ut,x,g.of(i),ht,Bt,Te]}const kt=[{key:"Ctrl-Space",run:Y},{mac:"Alt-`",run:Y},{mac:"Alt-i",run:Y},{key:"Escape",run:rt},{key:"ArrowDown",run:U(!0)},{key:"ArrowUp",run:U(!1)},{key:"PageDown",run:U(!0,"page")},{key:"PageUp",run:U(!1,"page")},{key:"Enter",run:lt}],Bt=ee.highest(we.computeN([g],i=>i.facet(g).defaultKeymap?[kt]:[]));export{ve as C,Ht as a,Vt as b,jt as c,kt as d,He as e,Nt as i,Ut as s};
1
+ import{codePointAt as v,EditorSelection as C,codePointSize as T,StateField as _,RangeSet as Pe,Prec as ee,Facet as be,combineConfig as Le,fromCodePoint as xe,StateEffect as O,MapMode as G,RangeValue as Me,Annotation as ke,CharCategory as J,Transaction as Be,Text as Fe}from"./index-BHot-lnj.js";import{E as L,p as $e,V as We,q as Z,t as Ce,n as we,o as Ne,D as H,W as Ue}from"./index-891wE-Rj.js";import{e as q,j as je}from"./index-CzPnlrTh.js";class ve{constructor(e,t,n,s){this.state=e,this.pos=t,this.explicit=n,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=q(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),s=t.text.slice(n-t.from,this.pos-t.from),o=s.search(Se(e,!1));return o<0?null:{from:n+o,to:this.pos,text:s.slice(o)}}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 ce(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 Ve(i){let e=Object.create(null),t=Object.create(null);for(let{label:s}of i){e[s[0]]=!0;for(let o=1;o<s.length;o++)t[s[o]]=!0}let n=ce(e)+ce(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function He(i){let e=i.map(s=>typeof s=="string"?{label:s}:s),[t,n]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:Ve(e);return s=>{let o=s.matchBefore(n);return o||s.explicit?{from:o?o.from:s.pos,options:e,validFor:t}:null}}function Nt(i,e){return t=>{for(let n=q(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)}}class fe{constructor(e,t,n,s){this.completion=e,this.source=t,this.match=n,this.score=s}}function A(i){return i.selection.main.from}function Se(i,e){var t;let{source:n}=i,s=e&&n[0]!="^",o=n[n.length-1]!="$";return!s&&!o?i:new RegExp(`${s?"^":""}(?:${n})${o?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}const te=ke.define();function qe(i,e,t,n){let{main:s}=i.selection,o=t-s.from,l=n-s.from;return{...i.changeByRange(a=>{if(a!=s&&t!=n&&i.sliceDoc(a.from+o,a.from+l)!=i.sliceDoc(t,n))return{range:a};let r=i.toText(e);return{changes:{from:a.from+o,to:n==s.from?a.to:a.from+l,insert:r},range:C.cursor(a.from+o+r.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const he=new WeakMap;function ze(i){if(!Array.isArray(i))return i;let e=he.get(i);return e||he.set(i,e=He(i)),e}const j=O.define(),B=O.define();class Ke{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=v(e,t),s=T(n);this.chars.push(n);let o=e.slice(t,t+s),l=o.toUpperCase();this.folded.push(v(l==o?o.toLowerCase():l,0)),t+=s}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:s,precise:o,byWord:l}=this;if(t.length==1){let d=v(e,0),D=T(d),S=D==e.length?0:-100;if(d!=t[0])if(d==n[0])S+=-200;else return null;return this.ret(S,[0,D])}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,D=Math.min(e.length,200);d<D&&h<r;){let S=v(e,d);(S==t[h]||S==n[h])&&(s[h++]=d),d+=T(S)}if(h<r)return null}let c=0,f=0,p=!1,u=0,m=-1,y=-1,k=/[a-z]/.test(e),I=!0;for(let d=0,D=Math.min(e.length,200),S=0;d<D&&f<r;){let b=v(e,d);a<0&&(c<r&&b==t[c]&&(o[c++]=d),u<r&&(b==t[u]||b==n[u]?(u==0&&(m=d),y=d+1,u++):u=0));let N,K=b<255?b>=48&&b<=57||b>=97&&b<=122?2:b>=65&&b<=90?1:0:(N=xe(b))!=N.toLowerCase()?1:N!=N.toUpperCase()?2:0;(!d||K==1&&k||S==0&&K!=0)&&(t[f]==b||n[f]==b&&(p=!0)?l[f++]=d:l.length&&(I=!1)),S=K,d+=T(b)}return f==r&&l[0]==0&&I?this.result(-100+(p?-200:0),l,e):u==r&&m==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):u==r?this.ret(-900-e.length,[m,y]):f==r?this.result(-100+(p?-200:0)+-700+(I?0:-1100),l,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,n){let s=[],o=0;for(let l of t){let a=l+(this.astral?T(v(n,l)):1);o&&s[o-1]==l?s[o-1]=a:(s[o++]=l,s[o++]=a)}return this.ret(e-n.length,s)}}class Qe{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)}}const g=be.define({combine(i){return Le(i,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Ye,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=>pe(e(n),t(n)),optionClass:(e,t)=>n=>pe(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function pe(i,e){return i?e?i+" "+e:i:e}function Ye(i,e,t,n,s,o){let l=i.textDirection==Ne.RTL,a=l,r=!1,h="top",c,f,p=e.left-s.left,u=s.right-e.right,m=n.right-n.left,y=n.bottom-n.top;if(a&&p<Math.min(m,u)?a=!1:!a&&u<Math.min(m,p)&&(a=!0),m<=(a?p:u))c=Math.max(s.top,Math.min(t.top,s.bottom-y))-e.top,f=Math.min(400,a?p:u);else{r=!0,f=Math.min(400,(l?e.right:s.right-e.left)-30);let d=s.bottom-e.bottom;d>=y||d>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let k=(e.bottom-e.top)/o.offsetHeight,I=(e.right-e.left)/o.offsetWidth;return{style:`${h}: ${c/k}px; max-width: ${f/I}px`,class:"cm-completionInfo-"+(r?l?"left-narrow":"right-narrow":a?"left":"right")}}const ie=O.define();function Xe(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(s=>"cm-completionIcon-"+s)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,s,o){let l=document.createElement("span");l.className="cm-completionLabel";let a=t.displayLabel||t.label,r=0;for(let h=0;h<o.length;){let c=o[h++],f=o[h++];c>r&&l.appendChild(document.createTextNode(a.slice(r,c)));let p=l.appendChild(document.createElement("span"));p.appendChild(document.createTextNode(a.slice(c,f))),p.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 Q(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let n=Math.ceil((i-e)/t);return{from:i-n*t,to:i-(n-1)*t}}class Ge{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 s=e.state.field(t),{options:o,selected:l}=s.open,a=e.state.facet(g);this.optionContent=Xe(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=Q(o.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:ie.of(c)}),r.preventDefault())}}),this.dom.addEventListener("focusout",r=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(g).closeOnBlur&&r.relatedTarget!=e.contentDOM&&e.dispatch({effects:B.of(null)})}),this.showOptions(o,s.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),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=s){let{options:o,selected:l,disabled:a}=n.open;(!s.open||s.open.options!=o)&&(this.range=Q(o.length,l,e.state.facet(g).maxRenderedOptions),this.showOptions(o,n.id)),this.updateSel(),a!=((t=s.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=Q(t.options.length,t.selected,this.view.state.facet(g).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:o}=s;if(!o)return;let l=typeof o=="string"?document.createTextNode(o):o(s);if(!l)return;"then"in l?l.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>Z(this.view.state,a,"completion info")):(this.addInfoPane(l,s),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:s,destroy:o}=e;n.appendChild(s),this.infoDestroy=o||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,s=this.range.from;n;n=n.nextSibling,s++)n.nodeName!="LI"||!n.id?s--:s==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&&Ze(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(),s=e.getBoundingClientRect(),o=this.space;if(!o){let l=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return s.top>Math.min(o.bottom,t.bottom)-10||s.bottom<Math.max(o.top,t.top)+10?null:this.view.state.facet(g).positionInfo(this.view,t,s,n,o,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){const s=document.createElement("ul");s.id=t,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",l=>{l.target==s&&l.preventDefault()});let o=null;for(let l=n.from;l<n.to;l++){let{completion:a,match:r}=e[l],{section:h}=a;if(h){let p=typeof h=="string"?h:h.name;if(p!=o&&(l>n.from||n.from==0))if(o=p,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let u=s.appendChild(document.createElement("completion-section"));u.textContent=p}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+l,c.setAttribute("role","option");let f=this.optionClass(a);f&&(c.className=f);for(let p of this.optionContent){let u=p(a,this.view.state,this.view,r);u&&c.appendChild(u)}}return n.from&&s.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function Je(i,e){return t=>new Ge(t,i,e)}function Ze(i,e){let t=i.getBoundingClientRect(),n=e.getBoundingClientRect(),s=t.height/i.offsetHeight;n.top<t.top?i.scrollTop-=(t.top-n.top)/s:n.bottom>t.bottom&&(i.scrollTop+=(n.bottom-t.bottom)/s)}function ue(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function _e(i,e){let t=[],n=null,s=null,o=c=>{t.push(c);let{section:f}=c.completion;if(f){n||(n=[]);let p=typeof f=="string"?f:f.name;n.some(u=>u.name==p)||n.push(typeof f=="string"?{name:p}:f)}},l=e.facet(g);for(let c of i)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let p of c.result.options)o(new fe(p,c.source,f?f(p):[],1e9-t.length));else{let p=e.sliceDoc(c.from,c.to),u,m=l.filterStrict?new Qe(p):new Ke(p);for(let y of c.result.options)if(u=m.match(y.label)){let k=y.displayLabel?f?f(y,u.matched):[]:u.matched,I=u.score+(y.boost||0);if(o(new fe(y,c.source,k,I)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:d}=y.section;s||(s=Object.create(null)),s[d]=Math.max(I,s[d]||-1e9)}}}}if(n){let c=Object.create(null),f=0,p=(u,m)=>(u.rank==="dynamic"&&m.rank==="dynamic"?s[m.name]-s[u.name]:0)||(typeof u.rank=="number"?u.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(u.name<m.name?-1:1);for(let u of n.sort(p))f-=1e5,c[u.name]=f;for(let u of t){let{section:m}=u.completion;m&&(u.score+=c[typeof m=="string"?m:m.name])}}let a=[],r=null,h=l.compareCompletions;for(let c of t.sort((f,p)=>p.score-f.score||h(f.completion,p.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):ue(c.completion)>ue(r)&&(a[a.length-1]=c),r=c.completion}return a}class R{constructor(e,t,n,s,o,l){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=s,this.selected=o,this.disabled=l}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new R(this.options,de(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,s,o,l){if(s&&!l&&e.some(h=>h.isPending))return s.setDisabled();let a=_e(e,t);if(!a.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let r=t.facet(g).selectOnOpen?0:-1;if(s&&s.selected!=r&&s.selected!=-1){let h=s.options[s.selected].completion;for(let c=0;c<a.length;c++)if(a[c].completion==h){r=c;break}}return new R(a,de(n,r),{pos:e.reduce((h,c)=>c.hasResult()?Math.min(h,c.from):h,1e8),create:ot,above:o.aboveCursor},s?s.timestamp:Date.now(),r,!1)}map(e){return new R(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new R(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class V{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new V(nt,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(g),o=(n.override||t.languageDataAt("autocomplete",A(t)).map(ze)).map(r=>(this.active.find(c=>c.source==r)||new w(r,this.active.some(c=>c.state!=0)?1:0)).update(e,n));o.length==this.active.length&&o.every((r,h)=>r==this.active[h])&&(o=this.active);let l=this.open,a=e.effects.some(r=>r.is(ne));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||o.some(r=>r.hasResult()&&e.changes.touchesRange(r.from,r.to))||!et(o,this.active)||a?l=R.build(o,t,this.id,l,n,a):l&&l.disabled&&!o.some(r=>r.isPending)&&(l=null),!l&&o.every(r=>!r.isPending)&&o.some(r=>r.hasResult())&&(o=o.map(r=>r.hasResult()?new w(r.source,0):r));for(let r of e.effects)r.is(ie)&&(l=l&&l.setSelected(r.value,this.id));return o==this.active&&l==this.open?this:new V(o,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?tt:it}}function et(i,e){if(i==e)return!0;for(let t=0,n=0;;){for(;t<i.length&&!i[t].hasResult();)t++;for(;n<e.length&&!e[n].hasResult();)n++;let s=t==i.length,o=n==e.length;if(s||o)return s==o;if(i[t++].result!=e[n++].result)return!1}}const tt={"aria-autocomplete":"list"},it={};function de(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}const nt=[];function Ie(i,e){if(i.isUserEvent("input.complete")){let n=i.annotation(te);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}class w{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=Ie(e,t),s=this;(n&8||n&16&&this.touches(e))&&(s=new w(s.source,0)),n&4&&s.state==0&&(s=new w(this.source,1)),s=s.updateFor(e,n);for(let o of e.effects)if(o.is(j))s=new w(s.source,1,o.value);else if(o.is(B))s=new w(s.source,0);else if(o.is(ne))for(let l of o.value)l.source==s.source&&(s=l);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(A(e.state))}}class P extends w{constructor(e,t,n,s,o,l){super(e,3,t),this.limit=n,this.result=s,this.from=o,this.to=l}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let o=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),a=A(e.state);if(a>l||!s||t&2&&(A(e.startState)==this.from||a<this.limit))return new w(this.source,t&4?1:0);let r=e.changes.mapPos(this.limit);return st(s.validFor,e.state,o,l)?new P(this.source,this.explicit,r,s,o,l):s.update&&(s=s.update(s,o,l,new ve(e.state,a,!1)))?new P(this.source,this.explicit,r,s,s.from,(n=s.to)!==null&&n!==void 0?n:A(e.state)):new w(this.source,1,this.explicit)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;return t?new P(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1)):new w(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function st(i,e,t,n){if(!i)return!1;let s=e.sliceDoc(t,n);return typeof i=="function"?i(s,t,n,e):Se(i,!0).test(s)}const ne=O.define({map(i,e){return i.map(t=>t.map(e))}}),x=_.define({create(){return V.start()},update(i,e){return i.update(e)},provide:i=>[$e.from(i,e=>e.tooltip),L.contentAttributes.from(i,e=>e.attrs)]});function se(i,e){const t=e.completion.apply||e.completion.label;let n=i.state.field(x).active.find(s=>s.source==e.source);return n instanceof P?(typeof t=="string"?i.dispatch({...qe(i.state,t,n.from,n.to),annotations:te.of(e.completion)}):t(i,e.completion,n.from,n.to),!0):!1}const ot=Je(x,se);function U(i,e="option"){return t=>{let n=t.state.field(x,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(g).interactionDelay)return!1;let s=1,o;e=="page"&&(o=Ce(t,n.open.tooltip))&&(s=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:l}=n.open.options,a=n.open.selected>-1?n.open.selected+s*(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:ie.of(a)}),!0}}const lt=i=>{let e=i.state.field(x,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(g).interactionDelay?!1:se(i,e.open.options[e.open.selected])},Y=i=>i.state.field(x,!1)?(i.dispatch({effects:j.of(!0)}),!0):!1,rt=i=>{let e=i.state.field(x,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:B.of(null)}),!0)};class at{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const ct=50,ft=1e3,ht=We.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(x).active)e.isPending&&this.startQuery(e)}update(i){let e=i.state.field(x),t=i.state.facet(g);if(!i.selectionSet&&!i.docChanged&&i.startState.field(x)==e)return;let n=i.transactions.some(o=>{let l=Ie(o,t);return l&8||(o.selection||o.docChanged)&&!(l&3)});for(let o=0;o<this.running.length;o++){let l=this.running[o];if(n||l.context.abortOnDocChange&&i.docChanged||l.updates.length+i.transactions.length>ct&&Date.now()-l.time>ft){for(let a of l.context.abortListeners)try{a()}catch(r){Z(this.view.state,r)}l.context.abortListeners=null,this.running.splice(o--,1)}else l.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(o=>o.effects.some(l=>l.is(j)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(l=>l.active.source==o.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let o of i.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(x);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(g).updateSyncTime))}startQuery(i){let{state:e}=this.view,t=A(e),n=new ve(e,t,i.explicit,this.view),s=new at(i,n);this.running.push(s),Promise.resolve(i.source(n)).then(o=>{s.context.aborted||(s.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:B.of(null)}),Z(this.view.state,o)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(g).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(g),n=this.view.state.field(x);for(let s=0;s<this.running.length;s++){let o=this.running[s];if(o.done===void 0)continue;if(this.running.splice(s--,1),o.done){let a=A(o.updates.length?o.updates[0].startState:this.view.state),r=Math.min(a,o.done.from+(o.active.explicit?0:1)),h=new P(o.active.source,o.active.explicit,r,o.done,o.done.from,(i=o.done.to)!==null&&i!==void 0?i:a);for(let c of o.updates)h=h.update(c,t);if(h.hasResult()){e.push(h);continue}}let l=n.active.find(a=>a.source==o.active.source);if(l&&l.isPending)if(o.done==null){let a=new w(o.active.source,0);for(let r of o.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:ne.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(x,!1);if(e&&e.tooltip&&this.view.state.facet(g).closeOnBlur){let t=e.open&&Ce(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:B.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:j.of(!1)}),20),this.composing=0}}}),pt=typeof navigator=="object"&&/Win/.test(navigator.platform),ut=ee.highest(L.domEventHandlers({keydown(i,e){let t=e.state.field(x,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(pt&&i.altKey)||i.metaKey)return!1;let n=t.open.options[t.open.selected],s=t.active.find(l=>l.source==n.source),o=n.completion.commitCharacters||s.result.commitCharacters;return o&&o.indexOf(i.key)>-1&&se(e,n),!1}})),Te=L.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"}}});class dt{constructor(e,t,n,s){this.field=e,this.line=t,this.from=n,this.to=s}}class oe{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,G.TrackDel),n=e.mapPos(this.to,1,G.TrackDel);return t==null||n==null?null:new oe(this.field,t,n)}}class le{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],s=[t],o=e.doc.lineAt(t),l=/^\s*/.exec(o.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(je);s.push(t+h.length-c),r=h+r.slice(c)}n.push(r),t+=r.length+1}let a=this.fieldPositions.map(r=>new oe(r.field,s[r.line]+r.from,s[r.line]+r.to));return{text:n,ranges:a}}static parse(e){let t=[],n=[],s=[],o;for(let l of e.split(/\r\n?|\n/)){for(;o=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let a=o[1]?+o[1]:null,r=o[2]||o[3]||"",h=-1;a===0&&(a=1e9);let 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 p of s)p.field>=h&&p.field++}for(let f of s)if(f.line==n.length&&f.from>o.index){let p=o[2]?3+(o[1]||"").length:2;f.from-=p,f.to-=p}s.push(new dt(h,n.length,o.index,o.index+c.length)),l=l.slice(0,o.index)+r+l.slice(o.index+o[0].length)}l=l.replace(/\\([{}])/g,(a,r,h)=>{for(let c of s)c.line==n.length&&c.from>h&&(c.from--,c.to--);return r}),n.push(l)}return new le(n,s)}}let mt=H.widget({widget:new class extends Ue{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),gt=H.mark({class:"cm-snippetField"});class M{constructor(e,t){this.ranges=e,this.active=t,this.deco=H.set(e.map(n=>(n.from==n.to?mt:gt).range(n.from,n.to)),!0)}map(e){let t=[];for(let n of this.ranges){let s=n.map(e);if(!s)return null;t.push(s)}return new M(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))}}const W=O.define({map(i,e){return i&&i.map(e)}}),yt=O.define(),F=_.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(W))return t.value;if(t.is(yt)&&i)return new M(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=>L.decorations.from(i,e=>e?e.deco:H.none)});function re(i,e){return C.create(i.filter(t=>t.field==e).map(t=>C.range(t.from,t.to)))}function bt(i){let e=le.parse(i);return(t,n,s,o)=>{let{text:l,ranges:a}=e.instantiate(t.state,s),{main:r}=t.state.selection,h={changes:{from:s,to:o==r.from?r.to:o,insert:Fe.of(l)},scrollIntoView:!0,annotations:n?[te.of(n),Be.userEvent.of("input.complete")]:void 0};if(a.length&&(h.selection=re(a,0)),a.some(c=>c.field>0)){let c=new M(a,0),f=h.effects=[W.of(c)];t.state.field(F,!1)===void 0&&f.push(O.appendConfig.of([F,St,It,Te]))}t.dispatch(t.state.update(h))}}function Oe(i){return({state:e,dispatch:t})=>{let n=e.field(F,!1);if(!n||i<0&&n.active==0)return!1;let s=n.active+i,o=i>0&&!n.ranges.some(l=>l.field==s+i);return t(e.update({selection:re(n.ranges,s),effects:W.of(o?null:new M(n.ranges,s)),scrollIntoView:!0})),!0}}const xt=({state:i,dispatch:e})=>i.field(F,!1)?(e(i.update({effects:W.of(null)})),!0):!1,Ct=Oe(1),wt=Oe(-1),vt=[{key:"Tab",run:Ct,shift:wt},{key:"Escape",run:xt}],me=be.define({combine(i){return i.length?i[0]:vt}}),St=ee.highest(we.compute([me],i=>i.facet(me)));function Ut(i,e){return{...e,apply:bt(i)}}const It=L.domEventHandlers({mousedown(i,e){let t=e.state.field(F,!1),n;if(!t||(n=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let s=t.ranges.find(o=>o.from<=n&&o.to>=n);return!s||s.field==t.active?!1:(e.dispatch({selection:re(t.ranges,s.field),effects:W.of(t.ranges.some(o=>o.field>s.field)?new M(t.ranges,s.field):null),scrollIntoView:!0}),!0)}}),$={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},E=O.define({map(i,e){let t=e.mapPos(i,-1,G.TrackAfter);return t??void 0}}),ae=new class extends Me{};ae.startSide=1;ae.endSide=-1;const Ee=_.define({create(){return Pe.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:[ae.range(t.value,t.value+1)]}));return i}});function jt(){return[Ot,Ee]}const X="()[]{}<>«»»«[]{}";function Ae(i){for(let e=0;e<X.length;e+=2)if(X.charCodeAt(e)==i)return X.charAt(e+1);return xe(i<128?i:i+1)}function De(i,e){return i.languageDataAt("closeBrackets",e)[0]||$}const Tt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ot=L.inputHandler.of((i,e,t,n)=>{if((Tt?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let s=i.state.selection.main;if(n.length>2||n.length==2&&T(v(n,0))==1||e!=s.from||t!=s.to)return!1;let o=At(i.state,n);return o?(i.dispatch(o),!0):!1}),Et=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let n=De(i,i.selection.main.head).brackets||$.brackets,s=null,o=i.changeByRange(l=>{if(l.empty){let a=Dt(i.doc,l.head);for(let r of n)if(r==a&&z(i.doc,l.head)==Ae(v(r,0)))return{changes:{from:l.head-r.length,to:l.head+r.length},range:C.cursor(l.head-r.length)}}return{range:s=l}});return s||e(i.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Vt=[{key:"Backspace",run:Et}];function At(i,e){let t=De(i,i.selection.main.head),n=t.brackets||$.brackets;for(let s of n){let o=Ae(v(s,0));if(e==s)return o==s?Lt(i,s,n.indexOf(s+s+s)>-1,t):Rt(i,s,o,t.before||$.before);if(e==o&&Re(i,i.selection.main.from))return Pt(i,s,o)}return null}function Re(i,e){let t=!1;return i.field(Ee).between(0,i.doc.length,n=>{n==e&&(t=!0)}),t}function z(i,e){let t=i.sliceString(e,e+2);return t.slice(0,T(v(t,0)))}function Dt(i,e){let t=i.sliceString(e-2,e);return T(v(t,0))==t.length?t:t.slice(1)}function Rt(i,e,t,n){let s=null,o=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:C.range(l.anchor+e.length,l.head+e.length)};let a=z(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:C.cursor(l.head+e.length)}:{range:s=l}});return s?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Pt(i,e,t){let n=null,s=i.changeByRange(o=>o.empty&&z(i.doc,o.head)==t?{changes:{from:o.head,to:o.head+t.length,insert:t},range:C.cursor(o.head+t.length)}:n={range:o});return n?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Lt(i,e,t,n){let s=n.stringPrefixes||$.stringPrefixes,o=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:C.range(a.anchor+e.length,a.head+e.length)};let r=a.head,h=z(i.doc,r),c;if(h==e){if(ge(i,r))return{changes:{insert:e+e,from:r},effects:E.of(r+e.length),range:C.cursor(r+e.length)};if(Re(i,r)){let p=t&&i.sliceDoc(r,r+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:r,to:r+p.length,insert:p},range:C.cursor(r+p.length)}}}else{if(t&&i.sliceDoc(r-2*e.length,r)==e+e&&(c=ye(i,r-2*e.length,s))>-1&&ge(i,c))return{changes:{insert:e+e+e+e,from:r},effects:E.of(r+e.length),range:C.cursor(r+e.length)};if(i.charCategorizer(r)(h)!=J.Word&&ye(i,r,s)>-1&&!Mt(i,r,e,s))return{changes:{insert:e+e,from:r},effects:E.of(r+e.length),range:C.cursor(r+e.length)}}return{range:o=a}});return o?null:i.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function ge(i,e){let t=q(i).resolveInner(e+1);return t.parent&&t.from==e}function Mt(i,e,t,n){let s=q(i).resolveInner(e,-1),o=n.reduce((l,a)=>Math.max(l,a.length),0);for(let l=0;l<5;l++){let a=i.sliceDoc(s.from,Math.min(s.to,s.from+t.length+o)),r=a.indexOf(t);if(!r||r>-1&&n.indexOf(a.slice(0,r))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+r;){if(i.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function ye(i,e,t){let n=i.charCategorizer(e);if(n(i.sliceDoc(e-1,e))!=J.Word)return e;for(let s of t){let o=e-s.length;if(i.sliceDoc(o,e)==s&&n(i.sliceDoc(o-1,o))!=J.Word)return o}return-1}function Ht(i={}){return[ut,x,g.of(i),ht,Bt,Te]}const kt=[{key:"Ctrl-Space",run:Y},{mac:"Alt-`",run:Y},{mac:"Alt-i",run:Y},{key:"Escape",run:rt},{key:"ArrowDown",run:U(!0)},{key:"ArrowUp",run:U(!1)},{key:"PageDown",run:U(!0,"page")},{key:"PageUp",run:U(!1,"page")},{key:"Enter",run:lt}],Bt=ee.highest(we.computeN([g],i=>i.facet(g).defaultKeymap?[kt]:[]));export{ve as C,Ht as a,Vt as b,jt as c,kt as d,He as e,Nt as i,Ut as s};
@@ -1 +1 @@
1
- import{N as b,e as Be,c as C,h as Me,I as Z,f as M,P as Ne,a as X,t as u,s as Fe}from"./index-DRlKZHMW.js";import{RangeSetBuilder as fe,RangeSet as Ee,EditorState as I,countColumn as Le,Facet as y,StateField as ce,StateEffect as L,Prec as He,combineConfig as ue}from"./index-BHot-lnj.js";import{V as H,u as We,E as w,G as Re,D as g,S as _,q as Ue,W as he,o as ee}from"./index-891wE-Rj.js";var $;const A=new b;function $e(n){return y.define({combine:n?e=>e.concat(n):void 0})}const qe=new b;class m{constructor(e,t,r=[],i=""){this.data=e,this.name=i,I.prototype.hasOwnProperty("tree")||Object.defineProperty(I.prototype,"tree",{get(){return k(this)}}),this.parser=t,this.extension=[x.of(this),I.languageData.of((s,o,l)=>{let a=te(s,o,l),f=a.type.prop(A);if(!f)return[];let c=s.facet(f),h=a.type.prop(qe);if(h){let p=a.resolve(o-a.from,l);for(let d of h)if(d.test(p,s)){let S=s.facet(d.facet);return d.type=="replace"?S:S.concat(c)}}return c})].concat(r)}isActiveAt(e,t,r=-1){return te(e,t,r).type.prop(A)==this.data}findRegions(e){let t=e.facet(x);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(A)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(b.mounted);if(l){if(l.tree.prop(A)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(i(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;a<s.children.length;a++){let f=s.children[a];f instanceof C&&i(f,s.positions[a]+o)}};return i(k(e),0),r}get allowsNesting(){return!0}}m.setState=L.define();function te(n,e,t){let r=n.facet(x),i=k(n).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,t,Z.ExcludeBuffers|Z.EnterBracketed))s.type.isTop&&(i=s);return i}class V extends m{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=$e(e.languageData);return new V(t,e.parser.configure({props:[A.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new V(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function k(n){let e=n.field(m.state,!1);return e?e.tree:C.empty}class je{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}}let D=null;class N{constructor(e,t,r=[],i,s,o,l,a){this.parser=e,this.state=t,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new N(e,t,[],C.empty,0,r,[],null)}startParse(){return this.parser.startParse(new je(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=C.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(M.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(M.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=D;D=this;try{return e()}finally{D=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=ne(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((f,c,h,p)=>a.push({fromA:f,toA:c,fromB:h,toB:p})),r=M.applyChanges(r,a),i=C.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let f of this.skipped){let c=e.mapPos(f.from,1),h=e.mapPos(f.to,-1);c<h&&l.push({from:c,to:h})}}}return new N(this.parser,t,r,i,s,o,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=ne(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Ne{createParse(t,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let a=D;if(a){for(let f of i)a.tempSkipped.push(f);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new C(X.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return D}}function ne(n,e,t){return M.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class P{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,r)||t.takeTree(),new P(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=N.create(e.facet(x).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new P(r)}}m.state=ce.define({create:P.init,update(n,e){for(let t of e.effects)if(t.is(m.setState))return t.value;return e.startState.facet(x)!=e.state.facet(x)?P.init(e.state):n.apply(e)}});let de=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(de=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const q=typeof navigator<"u"&&(!(($=navigator.scheduling)===null||$===void 0)&&$.isInputPending)?()=>navigator.scheduling.isInputPending():null,ze=H.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(m.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(m.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=de(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(m.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!q?Math.max(25,e.timeRemaining()-5):1e9),l=s.context.treeLen<i&&r.doc.length>i+1e3,a=s.context.work(()=>q&&q()||Date.now()>o,i+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:m.setState.of(new P(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ue(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),x=y.define({combine(n){return n.length?n[0]:null},enables:n=>[m.state,ze,w.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class Ft{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class pe{constructor(e,t,r,i,s,o=void 0){this.name=e,this.alias=t,this.extensions=r,this.filename=i,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:r}=e;if(!t){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(r)}return new pe(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,t,r)}static matchFilename(e,t){for(let i of e)if(i.filename&&i.filename.test(t))return i;let r=/\.([^.]+)$/.exec(t);if(r){for(let i of e)if(i.extensions.indexOf(r[1])>-1)return i}return null}static matchLanguageName(e,t,r=!0){t=t.toLowerCase();for(let i of e)if(i.alias.some(s=>s==t))return i;if(r)for(let i of e)for(let s of i.alias){let o=t.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+s.length])))return i}return null}}const Ge=y.define(),me=y.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Ve(n){let e=n.facet(me);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Je(n,e){let t="",r=n.tabSize,i=n.facet(me)[0];if(i==" "){for(;e>=r;)t+=" ",e-=r;i=" "}for(let s=0;s<e;s++)t+=i;return t}function Ke(n,e){n instanceof I&&(n=new ge(n));for(let r of n.state.facet(Ge)){let i=r(n,e);if(i!==void 0)return i}let t=k(n.state);return t.length>=e?Xe(n,t,e):null}class ge{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ve(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,t);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,t=e.length){return Le(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Qe=new b;function Xe(n,e,t){let r=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return ke(r,n,t)}function ke(n,e,t){for(let r=n;r;r=r.next){let i=Ze(r.node);if(i)return i(Y.create(e,t,r))}return 0}function Ye(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function Ze(n){let e=n.type.prop(Qe);if(e)return e;let t=n.firstChild,r;if(t&&(r=t.type.prop(b.closedBy))){let i=n.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>be(o,!0,1,void 0,s&&!Ye(o)?i.from:void 0)}return n.parent==null?_e:null}function _e(){return 0}class Y extends ge{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new Y(e,t,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(et(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return ke(this.context.next,this.base,this.pos)}}function et(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function tt(n){let e=n.node,t=e.childAfter(e.from),r=e.lastChild;if(!t)return null;let i=n.options.simulateBreak,s=n.state.doc.lineAt(t.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let f=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+f}}l=a.to}}function Et({closing:n,align:e=!0,units:t=1}){return r=>be(r,e,t,n)}function be(n,e,t,r,i){let s=n.textAfter,o=s.match(/^\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||i==n.pos+o,a=e?tt(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}const Lt=n=>n.baseIndent;function Ht({except:n,units:e=1}={}){return t=>{let r=n&&n.test(t.textAfter);return t.baseIndent+(r?0:e*t.unit)}}const nt=200;function Wt(){return I.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:r}=n.newSelection.main,i=t.lineAt(r);if(r>i.from+nt)return n;let s=t.sliceString(i.from,r);if(!e.some(f=>f.test(s)))return n;let{state:o}=n,l=-1,a=[];for(let{head:f}of o.selection.ranges){let c=o.doc.lineAt(f);if(c.from==l)continue;l=c.from;let h=Ke(o,c.from);if(h==null)continue;let p=/^\s*/.exec(c.text)[0],d=Je(o,h);p!=d&&a.push({from:c.from,to:c.from+p.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const rt=y.define(),it=new b;function Rt(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}function st(n,e,t){let r=k(n);if(r.length<t)return null;let i=r.resolveStack(t,1),s=null;for(let o=i;o;o=o.next){let l=o.node;if(l.to<=t||l.from>t)continue;if(s&&l.from<e)break;let a=l.type.prop(it);if(a&&(l.to<r.length-50||r.length==n.doc.length||!ot(l))){let f=a(l,n);f&&f.from<=t&&f.from>=e&&f.to>t&&(s=f)}}return s}function ot(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function F(n,e,t){for(let r of n.facet(rt)){let i=r(n,e,t);if(i)return i}return st(n,e,t)}function ye(n,e){let t=e.mapPos(n.from,1),r=e.mapPos(n.to,-1);return t>=r?void 0:{from:t,to:r}}const W=L.define({map:ye}),O=L.define({map:ye});function we(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(r=>r.from<=t&&r.to>=t)||e.push(n.lineBlockAt(t));return e}const v=ce.define({create(){return g.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((r,i)=>n=re(n,r,i)),n=n.map(e.changes);let t=[];for(let r of e.effects)r.is(W)&&!at(n,r.value.from,r.value.to)?t.push(r.value):r.is(O)&&(n=n.update({filter:(i,s)=>r.value.from!=i||r.value.to!=s,filterFrom:r.value.from,filterTo:r.value.to}));if(t.length){let{preparePlaceholder:r}=e.state.facet(Se),i=t.map(s=>(r?g.replace({widget:new dt(r(e.state,s))}):ie).range(s.from,s.to));n=n.update({add:i})}return e.selection&&(n=re(n,e.selection.main.head)),n},provide:n=>w.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(r,i)=>{t.push(r,i)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<n.length;){let r=n[t++],i=n[t++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(ie.range(r,i))}return g.set(e,!0)}});function re(n,e,t=e){let r=!1;return n.between(e,t,(i,s)=>{i<t&&s>e&&(r=!0)}),r?n.update({filterFrom:e,filterTo:t,filter:(i,s)=>i>=t||s<=e}):n}function E(n,e,t){var r;let i=null;return(r=n.field(v,!1))===null||r===void 0||r.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function at(n,e,t){let r=!1;return n.between(e,e,(i,s)=>{i==e&&s==t&&(r=!0)}),r}function xe(n,e){return n.field(v,!1)?e:e.concat(L.appendConfig.of(Te()))}const lt=n=>{for(let e of we(n)){let t=F(n.state,e.from,e.to);if(t)return n.dispatch({effects:xe(n.state,[W.of(t),ve(n,t)])}),!0}return!1},ft=n=>{if(!n.state.field(v,!1))return!1;let e=[];for(let t of we(n)){let r=E(n.state,t.from,t.to);r&&e.push(O.of(r),ve(n,r,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function ve(n,e,t=!0){let r=n.state.doc.lineAt(e.from).number,i=n.state.doc.lineAt(e.to).number;return w.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${r} ${n.state.phrase("to")} ${i}.`)}const ct=n=>{let{state:e}=n,t=[];for(let r=0;r<e.doc.length;){let i=n.lineBlockAt(r),s=F(e,i.from,i.to);s&&t.push(W.of(s)),r=(s?n.lineBlockAt(s.to):i).to+1}return t.length&&n.dispatch({effects:xe(n.state,t)}),!!t.length},ut=n=>{let e=n.state.field(v,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(r,i)=>{t.push(O.of({from:r,to:i}))}),n.dispatch({effects:t}),!0},Ut=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:lt},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:ft},{key:"Ctrl-Alt-[",run:ct},{key:"Ctrl-Alt-]",run:ut}],ht={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Se=y.define({combine(n){return ue(n,ht)}});function Te(n){return[v,mt]}function Ce(n,e){let{state:t}=n,r=t.facet(Se),i=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=E(n.state,l.from,l.to);a&&n.dispatch({effects:O.of(a)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(n,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const ie=g.replace({widget:new class extends he{toDOM(n){return Ce(n,null)}}});class dt extends he{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Ce(e,this.value)}}const pt={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class j extends Re{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function $t(n={}){let e={...pt,...n},t=new j(e,!0),r=new j(e,!1),i=H.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(x)!=o.state.facet(x)||o.startState.field(v,!1)!=o.state.field(v,!1)||k(o.startState)!=k(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new fe;for(let a of o.viewportLineBlocks){let f=E(o.state,a.from,a.to)?r:F(o.state,a.from,a.to)?t:null;f&&l.add(a.from,a.from,f)}return l.finish()}}),{domEventHandlers:s}=e;return[i,We({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(i))===null||l===void 0?void 0:l.markers)||Ee.empty},initialSpacer(){return new j(e,!1)},domEventHandlers:{...s,click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let f=E(o.state,l.from,l.to);if(f)return o.dispatch({effects:O.of(f)}),!0;let c=F(o.state,l.from,l.to);return c?(o.dispatch({effects:W.of(c)}),!0):!1}}}),Te()]}const mt=w.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class R{constructor(e,t){this.specs=e;let r;function i(l){let a=_.newName();return(r||(r=Object.create(null)))["."+a]=l,a}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof m?l=>l.prop(A)==o.data:o?l=>l==o:void 0,this.style=Be(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new _(r):null,this.themeType=t.themeType}static define(e,t){return new R(e,t||{})}}const J=y.define(),Ae=y.define({combine(n){return n.length?[n[0]]:null}});function z(n){let e=n.facet(J);return e.length?e:n.facet(Ae)}function qt(n,e){let t=[kt],r;return n instanceof R&&(n.module&&t.push(w.styleModule.of(n.module)),r=n.themeType),e!=null&&e.fallback?t.push(Ae.of(n)):r?t.push(J.computeN([w.darkTheme],i=>i.facet(w.darkTheme)==(r=="dark")?[n]:[])):t.push(J.of(n)),t}class gt{constructor(e){this.markCache=Object.create(null),this.tree=k(e.state),this.decorations=this.buildDeco(e,z(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=k(e.state),r=z(e.state),i=r!=z(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return g.none;let r=new fe;for(let{from:i,to:s}of e.visibleRanges)Me(this.tree,t,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=g.mark({class:a})))},i,s);return r.finish()}}const kt=He.high(H.fromClass(gt,{decorations:n=>n.decorations})),jt=R.define([{tag:u.meta,color:"#404740"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,textDecoration:"underline",fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.strong,fontWeight:"bold"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:u.keyword,color:"#708"},{tag:[u.atom,u.bool,u.url,u.contentSeparator,u.labelName],color:"#219"},{tag:[u.literal,u.inserted],color:"#164"},{tag:[u.string,u.deleted],color:"#a11"},{tag:[u.regexp,u.escape,u.special(u.string)],color:"#e40"},{tag:u.definition(u.variableName),color:"#00f"},{tag:u.local(u.variableName),color:"#30a"},{tag:[u.typeName,u.namespace],color:"#085"},{tag:u.className,color:"#167"},{tag:[u.special(u.variableName),u.macroName],color:"#256"},{tag:u.definition(u.propertyName),color:"#00c"},{tag:u.comment,color:"#940"},{tag:u.invalid,color:"#f00"}]),bt=w.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Pe=1e4,De="()[]{}",Ie=y.define({combine(n){return ue(n,{afterCursor:!0,brackets:De,maxScanDistance:Pe,renderMatch:xt})}}),yt=g.mark({class:"cm-matchingBracket"}),wt=g.mark({class:"cm-nonmatchingBracket"});function xt(n){let e=[],t=n.matched?yt:wt;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function se(n){let e=[],t=n.facet(Ie);for(let r of n.selection.ranges){if(!r.empty)continue;let i=B(n,r.head,-1,t)||r.head>0&&B(n,r.head-1,1,t)||t.afterCursor&&(B(n,r.head,1,t)||r.head<n.doc.length&&B(n,r.head+1,-1,t));i&&(e=e.concat(t.renderMatch(i,n)))}return g.set(e,!0)}const vt=H.fromClass(class{constructor(n){this.paused=!1,this.decorations=se(n.state)}update(n){(n.docChanged||n.selectionSet||this.paused)&&(n.view.composing?(this.decorations=this.decorations.map(n.changes),this.paused=!0):(this.decorations=se(n.state),this.paused=!1))}},{decorations:n=>n.decorations}),St=[vt,bt];function zt(n={}){return[Ie.of(n),St]}const Tt=new b;function K(n,e,t){let r=n.prop(e<0?b.openedBy:b.closedBy);if(r)return r;if(n.name.length==1){let i=t.indexOf(n.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function Q(n){let e=n.type.prop(Tt);return e?e(n.node):n}function B(n,e,t,r={}){let i=r.maxScanDistance||Pe,s=r.brackets||De,o=k(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let f=K(a.type,t,s);if(f&&a.from<a.to){let c=Q(a);if(c&&(t>0?e>=c.from&&e<c.to:e>c.from&&e<=c.to))return Ct(n,e,t,a,c,f,s)}}return At(n,e,t,o,l.type,i,s)}function Ct(n,e,t,r,i,s,o){let l=r.parent,a={from:i.from,to:i.to},f=0,c=l==null?void 0:l.cursor();if(c&&(t<0?c.childBefore(r.from):c.childAfter(r.to)))do if(t<0?c.to<=r.from:c.from>=r.to){if(f==0&&s.indexOf(c.type.name)>-1&&c.from<c.to){let h=Q(c);return{start:a,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(K(c.type,t,o))f++;else if(K(c.type,-t,o)){if(f==0){let h=Q(c);return{start:a,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}f--}}while(t<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}function At(n,e,t,r,i,s,o){if(t<0?!e:e==n.doc.length)return null;let l=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=t>0)return null;let f={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),h=0;for(let p=0;!c.next().done&&p<=s;){let d=c.value;t<0&&(p+=d.length);let S=e+p*t;for(let T=t>0?0:d.length-1,Oe=t>0?d.length:-1;T!=Oe;T+=t){let U=o.indexOf(d[T]);if(!(U<0||r.resolveInner(S+T,1).type!=i))if(U%2==0==t>0)h++;else{if(h==1)return{start:f,end:{from:S+T,to:S+T+1},matched:U>>1==a>>1};h--}}t>0&&(p+=d.length)}return c.done?{start:f,matched:!1}:null}const Pt=Object.create(null),oe=[X.none],ae=[],le=Object.create(null),Dt=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Dt[n]=It(Pt,e);function G(n,e){ae.indexOf(n)>-1||(ae.push(n),console.warn(e))}function It(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let f of l.split(".")){let c=n[f]||u[f];c?typeof c=="function"?a.length?a=a.map(c):G(f,`Modifier ${f} used at start of tag`):a.length?G(f,`Tag ${f} used as modifier`):a=Array.isArray(c)?c:[c]:G(f,`Unknown highlighting tag ${f}`)}for(let f of a)t.push(f)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+t.map(l=>l.id),s=le[i];if(s)return s.id;let o=le[i]=X.define({id:oe.length,name:r,props:[Fe({[r]:t})]});return oe.push(o),o.id}ee.RTL,ee.LTR;export{R as H,ge as I,Ft as L,N as P,Ut as a,zt as b,Je as c,jt as d,k as e,$t as f,Ke as g,Ve as h,Wt as i,me as j,V as k,Qe as l,B as m,Ht as n,it as o,Rt as p,rt as q,m as r,qt as s,$e as t,A as u,pe as v,Et as w,Lt as x,Tt as y,qe as z};
1
+ import{N as b,e as Be,c as C,h as Me,I as Z,f as M,P as Ne,a as X,t as u,s as Fe}from"./index-DO6gKWcT.js";import{RangeSetBuilder as fe,RangeSet as Ee,EditorState as I,countColumn as Le,Facet as y,StateField as ce,StateEffect as L,Prec as He,combineConfig as ue}from"./index-BHot-lnj.js";import{V as H,u as We,E as w,G as Re,D as g,S as _,q as Ue,W as he,o as ee}from"./index-891wE-Rj.js";var $;const A=new b;function $e(n){return y.define({combine:n?e=>e.concat(n):void 0})}const qe=new b;class m{constructor(e,t,r=[],i=""){this.data=e,this.name=i,I.prototype.hasOwnProperty("tree")||Object.defineProperty(I.prototype,"tree",{get(){return k(this)}}),this.parser=t,this.extension=[x.of(this),I.languageData.of((s,o,l)=>{let a=te(s,o,l),f=a.type.prop(A);if(!f)return[];let c=s.facet(f),h=a.type.prop(qe);if(h){let p=a.resolve(o-a.from,l);for(let d of h)if(d.test(p,s)){let S=s.facet(d.facet);return d.type=="replace"?S:S.concat(c)}}return c})].concat(r)}isActiveAt(e,t,r=-1){return te(e,t,r).type.prop(A)==this.data}findRegions(e){let t=e.facet(x);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(A)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(b.mounted);if(l){if(l.tree.prop(A)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(i(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;a<s.children.length;a++){let f=s.children[a];f instanceof C&&i(f,s.positions[a]+o)}};return i(k(e),0),r}get allowsNesting(){return!0}}m.setState=L.define();function te(n,e,t){let r=n.facet(x),i=k(n).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,t,Z.ExcludeBuffers|Z.EnterBracketed))s.type.isTop&&(i=s);return i}class V extends m{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=$e(e.languageData);return new V(t,e.parser.configure({props:[A.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new V(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function k(n){let e=n.field(m.state,!1);return e?e.tree:C.empty}class je{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}}let D=null;class N{constructor(e,t,r=[],i,s,o,l,a){this.parser=e,this.state=t,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new N(e,t,[],C.empty,0,r,[],null)}startParse(){return this.parser.startParse(new je(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=C.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(M.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(M.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=D;D=this;try{return e()}finally{D=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=ne(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((f,c,h,p)=>a.push({fromA:f,toA:c,fromB:h,toB:p})),r=M.applyChanges(r,a),i=C.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let f of this.skipped){let c=e.mapPos(f.from,1),h=e.mapPos(f.to,-1);c<h&&l.push({from:c,to:h})}}}return new N(this.parser,t,r,i,s,o,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=ne(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Ne{createParse(t,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let a=D;if(a){for(let f of i)a.tempSkipped.push(f);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new C(X.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return D}}function ne(n,e,t){return M.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class P{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,r)||t.takeTree(),new P(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=N.create(e.facet(x).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new P(r)}}m.state=ce.define({create:P.init,update(n,e){for(let t of e.effects)if(t.is(m.setState))return t.value;return e.startState.facet(x)!=e.state.facet(x)?P.init(e.state):n.apply(e)}});let de=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(de=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const q=typeof navigator<"u"&&(!(($=navigator.scheduling)===null||$===void 0)&&$.isInputPending)?()=>navigator.scheduling.isInputPending():null,ze=H.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(m.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(m.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=de(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(m.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!q?Math.max(25,e.timeRemaining()-5):1e9),l=s.context.treeLen<i&&r.doc.length>i+1e3,a=s.context.work(()=>q&&q()||Date.now()>o,i+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:m.setState.of(new P(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ue(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),x=y.define({combine(n){return n.length?n[0]:null},enables:n=>[m.state,ze,w.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class Ft{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class pe{constructor(e,t,r,i,s,o=void 0){this.name=e,this.alias=t,this.extensions=r,this.filename=i,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:r}=e;if(!t){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(r)}return new pe(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,t,r)}static matchFilename(e,t){for(let i of e)if(i.filename&&i.filename.test(t))return i;let r=/\.([^.]+)$/.exec(t);if(r){for(let i of e)if(i.extensions.indexOf(r[1])>-1)return i}return null}static matchLanguageName(e,t,r=!0){t=t.toLowerCase();for(let i of e)if(i.alias.some(s=>s==t))return i;if(r)for(let i of e)for(let s of i.alias){let o=t.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+s.length])))return i}return null}}const Ge=y.define(),me=y.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Ve(n){let e=n.facet(me);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Je(n,e){let t="",r=n.tabSize,i=n.facet(me)[0];if(i==" "){for(;e>=r;)t+=" ",e-=r;i=" "}for(let s=0;s<e;s++)t+=i;return t}function Ke(n,e){n instanceof I&&(n=new ge(n));for(let r of n.state.facet(Ge)){let i=r(n,e);if(i!==void 0)return i}let t=k(n.state);return t.length>=e?Xe(n,t,e):null}class ge{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ve(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,t);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,t=e.length){return Le(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Qe=new b;function Xe(n,e,t){let r=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return ke(r,n,t)}function ke(n,e,t){for(let r=n;r;r=r.next){let i=Ze(r.node);if(i)return i(Y.create(e,t,r))}return 0}function Ye(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function Ze(n){let e=n.type.prop(Qe);if(e)return e;let t=n.firstChild,r;if(t&&(r=t.type.prop(b.closedBy))){let i=n.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>be(o,!0,1,void 0,s&&!Ye(o)?i.from:void 0)}return n.parent==null?_e:null}function _e(){return 0}class Y extends ge{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new Y(e,t,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(et(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return ke(this.context.next,this.base,this.pos)}}function et(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function tt(n){let e=n.node,t=e.childAfter(e.from),r=e.lastChild;if(!t)return null;let i=n.options.simulateBreak,s=n.state.doc.lineAt(t.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let f=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+f}}l=a.to}}function Et({closing:n,align:e=!0,units:t=1}){return r=>be(r,e,t,n)}function be(n,e,t,r,i){let s=n.textAfter,o=s.match(/^\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||i==n.pos+o,a=e?tt(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}const Lt=n=>n.baseIndent;function Ht({except:n,units:e=1}={}){return t=>{let r=n&&n.test(t.textAfter);return t.baseIndent+(r?0:e*t.unit)}}const nt=200;function Wt(){return I.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:r}=n.newSelection.main,i=t.lineAt(r);if(r>i.from+nt)return n;let s=t.sliceString(i.from,r);if(!e.some(f=>f.test(s)))return n;let{state:o}=n,l=-1,a=[];for(let{head:f}of o.selection.ranges){let c=o.doc.lineAt(f);if(c.from==l)continue;l=c.from;let h=Ke(o,c.from);if(h==null)continue;let p=/^\s*/.exec(c.text)[0],d=Je(o,h);p!=d&&a.push({from:c.from,to:c.from+p.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const rt=y.define(),it=new b;function Rt(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}function st(n,e,t){let r=k(n);if(r.length<t)return null;let i=r.resolveStack(t,1),s=null;for(let o=i;o;o=o.next){let l=o.node;if(l.to<=t||l.from>t)continue;if(s&&l.from<e)break;let a=l.type.prop(it);if(a&&(l.to<r.length-50||r.length==n.doc.length||!ot(l))){let f=a(l,n);f&&f.from<=t&&f.from>=e&&f.to>t&&(s=f)}}return s}function ot(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function F(n,e,t){for(let r of n.facet(rt)){let i=r(n,e,t);if(i)return i}return st(n,e,t)}function ye(n,e){let t=e.mapPos(n.from,1),r=e.mapPos(n.to,-1);return t>=r?void 0:{from:t,to:r}}const W=L.define({map:ye}),O=L.define({map:ye});function we(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(r=>r.from<=t&&r.to>=t)||e.push(n.lineBlockAt(t));return e}const v=ce.define({create(){return g.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((r,i)=>n=re(n,r,i)),n=n.map(e.changes);let t=[];for(let r of e.effects)r.is(W)&&!at(n,r.value.from,r.value.to)?t.push(r.value):r.is(O)&&(n=n.update({filter:(i,s)=>r.value.from!=i||r.value.to!=s,filterFrom:r.value.from,filterTo:r.value.to}));if(t.length){let{preparePlaceholder:r}=e.state.facet(Se),i=t.map(s=>(r?g.replace({widget:new dt(r(e.state,s))}):ie).range(s.from,s.to));n=n.update({add:i})}return e.selection&&(n=re(n,e.selection.main.head)),n},provide:n=>w.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(r,i)=>{t.push(r,i)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<n.length;){let r=n[t++],i=n[t++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(ie.range(r,i))}return g.set(e,!0)}});function re(n,e,t=e){let r=!1;return n.between(e,t,(i,s)=>{i<t&&s>e&&(r=!0)}),r?n.update({filterFrom:e,filterTo:t,filter:(i,s)=>i>=t||s<=e}):n}function E(n,e,t){var r;let i=null;return(r=n.field(v,!1))===null||r===void 0||r.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function at(n,e,t){let r=!1;return n.between(e,e,(i,s)=>{i==e&&s==t&&(r=!0)}),r}function xe(n,e){return n.field(v,!1)?e:e.concat(L.appendConfig.of(Te()))}const lt=n=>{for(let e of we(n)){let t=F(n.state,e.from,e.to);if(t)return n.dispatch({effects:xe(n.state,[W.of(t),ve(n,t)])}),!0}return!1},ft=n=>{if(!n.state.field(v,!1))return!1;let e=[];for(let t of we(n)){let r=E(n.state,t.from,t.to);r&&e.push(O.of(r),ve(n,r,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function ve(n,e,t=!0){let r=n.state.doc.lineAt(e.from).number,i=n.state.doc.lineAt(e.to).number;return w.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${r} ${n.state.phrase("to")} ${i}.`)}const ct=n=>{let{state:e}=n,t=[];for(let r=0;r<e.doc.length;){let i=n.lineBlockAt(r),s=F(e,i.from,i.to);s&&t.push(W.of(s)),r=(s?n.lineBlockAt(s.to):i).to+1}return t.length&&n.dispatch({effects:xe(n.state,t)}),!!t.length},ut=n=>{let e=n.state.field(v,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(r,i)=>{t.push(O.of({from:r,to:i}))}),n.dispatch({effects:t}),!0},Ut=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:lt},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:ft},{key:"Ctrl-Alt-[",run:ct},{key:"Ctrl-Alt-]",run:ut}],ht={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Se=y.define({combine(n){return ue(n,ht)}});function Te(n){return[v,mt]}function Ce(n,e){let{state:t}=n,r=t.facet(Se),i=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=E(n.state,l.from,l.to);a&&n.dispatch({effects:O.of(a)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(n,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const ie=g.replace({widget:new class extends he{toDOM(n){return Ce(n,null)}}});class dt extends he{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Ce(e,this.value)}}const pt={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class j extends Re{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function $t(n={}){let e={...pt,...n},t=new j(e,!0),r=new j(e,!1),i=H.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(x)!=o.state.facet(x)||o.startState.field(v,!1)!=o.state.field(v,!1)||k(o.startState)!=k(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new fe;for(let a of o.viewportLineBlocks){let f=E(o.state,a.from,a.to)?r:F(o.state,a.from,a.to)?t:null;f&&l.add(a.from,a.from,f)}return l.finish()}}),{domEventHandlers:s}=e;return[i,We({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(i))===null||l===void 0?void 0:l.markers)||Ee.empty},initialSpacer(){return new j(e,!1)},domEventHandlers:{...s,click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let f=E(o.state,l.from,l.to);if(f)return o.dispatch({effects:O.of(f)}),!0;let c=F(o.state,l.from,l.to);return c?(o.dispatch({effects:W.of(c)}),!0):!1}}}),Te()]}const mt=w.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class R{constructor(e,t){this.specs=e;let r;function i(l){let a=_.newName();return(r||(r=Object.create(null)))["."+a]=l,a}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof m?l=>l.prop(A)==o.data:o?l=>l==o:void 0,this.style=Be(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new _(r):null,this.themeType=t.themeType}static define(e,t){return new R(e,t||{})}}const J=y.define(),Ae=y.define({combine(n){return n.length?[n[0]]:null}});function z(n){let e=n.facet(J);return e.length?e:n.facet(Ae)}function qt(n,e){let t=[kt],r;return n instanceof R&&(n.module&&t.push(w.styleModule.of(n.module)),r=n.themeType),e!=null&&e.fallback?t.push(Ae.of(n)):r?t.push(J.computeN([w.darkTheme],i=>i.facet(w.darkTheme)==(r=="dark")?[n]:[])):t.push(J.of(n)),t}class gt{constructor(e){this.markCache=Object.create(null),this.tree=k(e.state),this.decorations=this.buildDeco(e,z(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=k(e.state),r=z(e.state),i=r!=z(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return g.none;let r=new fe;for(let{from:i,to:s}of e.visibleRanges)Me(this.tree,t,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=g.mark({class:a})))},i,s);return r.finish()}}const kt=He.high(H.fromClass(gt,{decorations:n=>n.decorations})),jt=R.define([{tag:u.meta,color:"#404740"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,textDecoration:"underline",fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.strong,fontWeight:"bold"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:u.keyword,color:"#708"},{tag:[u.atom,u.bool,u.url,u.contentSeparator,u.labelName],color:"#219"},{tag:[u.literal,u.inserted],color:"#164"},{tag:[u.string,u.deleted],color:"#a11"},{tag:[u.regexp,u.escape,u.special(u.string)],color:"#e40"},{tag:u.definition(u.variableName),color:"#00f"},{tag:u.local(u.variableName),color:"#30a"},{tag:[u.typeName,u.namespace],color:"#085"},{tag:u.className,color:"#167"},{tag:[u.special(u.variableName),u.macroName],color:"#256"},{tag:u.definition(u.propertyName),color:"#00c"},{tag:u.comment,color:"#940"},{tag:u.invalid,color:"#f00"}]),bt=w.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Pe=1e4,De="()[]{}",Ie=y.define({combine(n){return ue(n,{afterCursor:!0,brackets:De,maxScanDistance:Pe,renderMatch:xt})}}),yt=g.mark({class:"cm-matchingBracket"}),wt=g.mark({class:"cm-nonmatchingBracket"});function xt(n){let e=[],t=n.matched?yt:wt;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function se(n){let e=[],t=n.facet(Ie);for(let r of n.selection.ranges){if(!r.empty)continue;let i=B(n,r.head,-1,t)||r.head>0&&B(n,r.head-1,1,t)||t.afterCursor&&(B(n,r.head,1,t)||r.head<n.doc.length&&B(n,r.head+1,-1,t));i&&(e=e.concat(t.renderMatch(i,n)))}return g.set(e,!0)}const vt=H.fromClass(class{constructor(n){this.paused=!1,this.decorations=se(n.state)}update(n){(n.docChanged||n.selectionSet||this.paused)&&(n.view.composing?(this.decorations=this.decorations.map(n.changes),this.paused=!0):(this.decorations=se(n.state),this.paused=!1))}},{decorations:n=>n.decorations}),St=[vt,bt];function zt(n={}){return[Ie.of(n),St]}const Tt=new b;function K(n,e,t){let r=n.prop(e<0?b.openedBy:b.closedBy);if(r)return r;if(n.name.length==1){let i=t.indexOf(n.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function Q(n){let e=n.type.prop(Tt);return e?e(n.node):n}function B(n,e,t,r={}){let i=r.maxScanDistance||Pe,s=r.brackets||De,o=k(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let f=K(a.type,t,s);if(f&&a.from<a.to){let c=Q(a);if(c&&(t>0?e>=c.from&&e<c.to:e>c.from&&e<=c.to))return Ct(n,e,t,a,c,f,s)}}return At(n,e,t,o,l.type,i,s)}function Ct(n,e,t,r,i,s,o){let l=r.parent,a={from:i.from,to:i.to},f=0,c=l==null?void 0:l.cursor();if(c&&(t<0?c.childBefore(r.from):c.childAfter(r.to)))do if(t<0?c.to<=r.from:c.from>=r.to){if(f==0&&s.indexOf(c.type.name)>-1&&c.from<c.to){let h=Q(c);return{start:a,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(K(c.type,t,o))f++;else if(K(c.type,-t,o)){if(f==0){let h=Q(c);return{start:a,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}f--}}while(t<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}function At(n,e,t,r,i,s,o){if(t<0?!e:e==n.doc.length)return null;let l=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=t>0)return null;let f={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),h=0;for(let p=0;!c.next().done&&p<=s;){let d=c.value;t<0&&(p+=d.length);let S=e+p*t;for(let T=t>0?0:d.length-1,Oe=t>0?d.length:-1;T!=Oe;T+=t){let U=o.indexOf(d[T]);if(!(U<0||r.resolveInner(S+T,1).type!=i))if(U%2==0==t>0)h++;else{if(h==1)return{start:f,end:{from:S+T,to:S+T+1},matched:U>>1==a>>1};h--}}t>0&&(p+=d.length)}return c.done?{start:f,matched:!1}:null}const Pt=Object.create(null),oe=[X.none],ae=[],le=Object.create(null),Dt=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Dt[n]=It(Pt,e);function G(n,e){ae.indexOf(n)>-1||(ae.push(n),console.warn(e))}function It(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let f of l.split(".")){let c=n[f]||u[f];c?typeof c=="function"?a.length?a=a.map(c):G(f,`Modifier ${f} used at start of tag`):a.length?G(f,`Tag ${f} used as modifier`):a=Array.isArray(c)?c:[c]:G(f,`Unknown highlighting tag ${f}`)}for(let f of a)t.push(f)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+t.map(l=>l.id),s=le[i];if(s)return s.id;let o=le[i]=X.define({id:oe.length,name:r,props:[Fe({[r]:t})]});return oe.push(o),o.id}ee.RTL,ee.LTR;export{R as H,ge as I,Ft as L,N as P,Ut as a,zt as b,Je as c,jt as d,k as e,$t as f,Ke as g,Ve as h,Wt as i,me as j,V as k,Qe as l,B as m,Ht as n,it as o,Rt as p,rt as q,m as r,qt as s,$e as t,A as u,pe as v,Et as w,Lt as x,Tt as y,qe as z};
@@ -0,0 +1 @@
1
+ :root{color-scheme:light;--bg: #faf9f5;--surface: #ffffff;--surface-2: #f2f0e8;--surface-3: #e9e6db;--sidebar: #f0eee6;--border: #e2dfd3;--border-soft: #edebe1;--text: #1f1e1d;--text-2: #3d3d3a;--muted: #7c7a73;--accent: #c96442;--accent-hover: #b1553a;--accent-fg: #fffdf9;--accent-soft: rgba(201, 100, 66, .1);--accent-line: rgba(201, 100, 66, .36);--select: rgba(201, 100, 66, .28);--warn: #b0762c;--warn-soft: rgba(176, 118, 44, .12);--warn-line: rgba(176, 118, 44, .42);--danger: #bf4d43;--danger-soft: rgba(191, 77, 67, .1);--ok: #5b7f45;--ok-soft: rgba(91, 127, 69, .12);--ok-line: rgba(91, 127, 69, .4);--add-bg: rgba(91, 127, 69, .13);--add-fg: #35512b;--del-bg: rgba(191, 77, 67, .1);--del-fg: #7d2f2a;--code-fg: #3d3d3a;--scroll: rgba(31, 30, 29, .2);--scroll-hover: rgba(31, 30, 29, .36);--shadow-sm: 0 1px 2px rgba(31, 30, 29, .07);--shadow-md: 0 6px 18px rgba(31, 30, 29, .1);--shadow-lg: 0 18px 44px rgba(31, 30, 29, .18);--ring: 0 0 0 3px rgba(201, 100, 66, .18);--mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;--sans: ui-sans-serif, system-ui, "Segoe UI", Inter, Roboto, sans-serif;--serif: ui-serif, "Iowan Old Style", Georgia, "Times New Roman", serif;--radius: 10px;--radius-lg: 16px;--sidebar-w: 276px;--files-w: 260px;--search-w: 320px;--git-w: 320px;--ask-w: 380px;--cm-key: #9a5bb0;--cm-str: #5b7f45;--cm-num: #b0762c;--cm-comment: #8a8880;--cm-fn: #4f7cac;--cm-type: #3f8f8a;--cm-prop: #a05063;--cm-const: #b1553a;--cm-op: #7c7a73;--cm-selection: rgba(201, 100, 66, .28);--cm-active: rgba(31, 30, 29, .035);--cm-match: rgba(176, 118, 44, .26);--lane-0: #c96442;--lane-1: #4f7cac;--lane-2: #5b7f45;--lane-3: #9a6bb0;--lane-4: #b0762c;--lane-5: #3f8f8a;--lane-6: #a05063}:root[data-theme=dark]{color-scheme:dark;--bg: #262624;--surface: #30302e;--surface-2: #3a3a37;--surface-3: #454542;--sidebar: #1f1e1d;--border: #3e3e3b;--border-soft: #343432;--text: #f5f4ee;--text-2: #d4d1c8;--muted: #918e86;--accent: #d97757;--accent-hover: #e08b6e;--accent-fg: #251610;--accent-soft: rgba(217, 119, 87, .14);--accent-line: rgba(217, 119, 87, .42);--select: rgba(217, 119, 87, .34);--warn: #d9a05b;--warn-soft: rgba(217, 160, 91, .14);--warn-line: rgba(217, 160, 91, .42);--danger: #e0776a;--danger-soft: rgba(224, 119, 106, .13);--ok: #8fb06b;--ok-soft: rgba(143, 176, 107, .14);--ok-line: rgba(143, 176, 107, .42);--add-bg: rgba(143, 176, 107, .13);--add-fg: #cfe0b8;--del-bg: rgba(224, 119, 106, .13);--del-fg: #f0c6c0;--code-fg: #d4d1c8;--scroll: rgba(245, 244, 238, .16);--scroll-hover: rgba(245, 244, 238, .3);--shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);--shadow-md: 0 6px 18px rgba(0, 0, 0, .36);--shadow-lg: 0 18px 44px rgba(0, 0, 0, .5);--ring: 0 0 0 3px rgba(217, 119, 87, .22);--lane-0: #d97757;--lane-1: #7aa5d2;--lane-2: #8fb06b;--lane-3: #b98fd0;--lane-4: #d9a05b;--lane-5: #6fbdb6;--lane-6: #d2818f;--cm-key: #c39ad8;--cm-str: #a3c47f;--cm-num: #e0b276;--cm-comment: #86837b;--cm-fn: #8db6e2;--cm-type: #74c9c2;--cm-prop: #e0949f;--cm-const: #e79674;--cm-op: #a9a69d;--cm-selection: rgba(217, 119, 87, .34);--cm-active: rgba(245, 244, 238, .045);--cm-match: rgba(217, 160, 91, .3)}*{box-sizing:border-box}html,body,#root{height:100%}html,body{overflow:hidden;overscroll-behavior:none}body{margin:0;background:var(--bg);color:var(--text);font-family:var(--sans);font-size:14px;line-height:1.6;-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;background:none;border:none;cursor:pointer}:focus-visible{outline:2px solid var(--accent);outline-offset:2px}::selection{background:var(--select)}*{scrollbar-width:thin;scrollbar-color:var(--scroll) transparent}::-webkit-scrollbar{width:11px;height:11px}::-webkit-scrollbar-track,::-webkit-scrollbar-corner{background:transparent}::-webkit-scrollbar-thumb{background:var(--scroll);border:3px solid transparent;background-clip:content-box;border-radius:999px}::-webkit-scrollbar-thumb:hover{background:var(--scroll-hover);background-clip:content-box}.app{display:grid;grid-template-columns:[sidebar] var(--sidebar-w) [files] auto [search] auto [git] auto [main] minmax(0,1fr) [ask] auto;height:100%}.sidebar,.main,.sidepane{grid-row:1}.sidebar{grid-column:sidebar}.sidepane--files{grid-column:files;width:var(--files-w)}.sidepane--search{grid-column:search;width:var(--search-w)}.sidepane--git{grid-column:git;width:var(--git-w)}.main{grid-column:main}.sidepane--ask{grid-column:ask;width:var(--ask-w)}.pane-resizer{grid-row:1;display:flex;justify-content:center;position:relative;z-index:5;width:9px;cursor:col-resize;touch-action:none}.pane-resizer--left{justify-self:end;margin-right:-4px}.pane-resizer--right{justify-self:start;margin-left:-4px}.pane-resizer--sidebar{grid-column:sidebar}.pane-resizer--files{grid-column:files}.pane-resizer--search{grid-column:search}.pane-resizer--git{grid-column:git}.pane-resizer--ask{grid-column:ask}.pane-resizer__line{width:2px;border-radius:2px;background:transparent;transition:background .12s ease}.pane-resizer:hover .pane-resizer__line,.pane-resizer:active .pane-resizer__line,.pane-resizer:focus-visible .pane-resizer__line{background:var(--accent)}.pane-resizer:focus-visible{outline:none}body.is-resizing{cursor:col-resize;-webkit-user-select:none;user-select:none}.main{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--bg);container-type:inline-size}.main--zoomed{position:fixed;top:0;right:0;bottom:0;left:0;z-index:32}.sidebar{display:flex;flex-direction:column;min-height:0;background:var(--sidebar);border-right:1px solid var(--border)}.sidebar__head{display:flex;align-items:center;gap:9px;padding:14px 14px 14px 16px}.brand{font-family:var(--serif);font-size:16px;letter-spacing:-.01em;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dot{width:7px;height:7px;border-radius:50%;background:var(--danger);flex:none}.dot--on{background:var(--ok)}.sidebar__section{display:flex;align-items:center;gap:6px;width:100%;padding:14px 16px 6px 10px;font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);text-align:left}.sidebar__section--btn:hover{color:var(--text-2)}.sidebar__section-name{flex:1;min-width:0}.sidebar__count{font-family:var(--mono);font-weight:500;letter-spacing:0;font-size:11px;color:var(--muted);opacity:.75}.sidebar__chev{flex:none;width:12px;height:12px;transition:transform .15s ease}.sidebar__chev--open{transform:rotate(90deg)}.fssearch--sidebar{margin:2px 12px 4px}.sidebar__scroll{overflow-y:auto;flex:1;min-height:0;padding-bottom:8px}.row{display:flex;align-items:center;gap:2px;width:calc(100% - 16px);margin:1px 8px;padding:7px 8px 7px 10px;border-radius:8px}.row:hover{background:var(--surface-2)}.sidebar .row{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.row--active{background:var(--surface-2)}.row--active .row__title{color:var(--text);font-weight:560}.row--active{box-shadow:inset 2px 0 0 var(--accent)}.row--selected,.row--selected:hover{background:var(--select)}.row__main{display:block;text-align:left;padding:0;min-width:0;flex:1}.row__edit{flex:none;display:grid;place-items:center;width:24px;height:24px;border-radius:6px;color:var(--muted);font-size:13px;opacity:0;transition:opacity .12s ease,background .12s ease}.row:hover .row__edit{opacity:1}.row__edit:hover{color:var(--text);background:var(--surface-3)}.row__edit:focus-visible{opacity:1}@media(hover:none){.row__edit{opacity:1}}.row__restore{flex:none;padding:4px 10px;border-radius:999px;border:1px solid var(--border);color:var(--text-2);font-size:11.5px;white-space:nowrap}.row__restore:hover{background:var(--surface-2);color:var(--text);border-color:var(--surface-3)}@media(max-width:860px){.row__restore{min-height:40px;padding:0 12px;display:inline-flex;align-items:center}}.row__head{display:flex;align-items:center;gap:8px;min-width:0}.row__title{display:block;min-width:0;flex:1 1 auto;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.row__pin{width:11px;height:11px;margin:0 4px -1px 0;color:var(--accent);opacity:.8}.row__project{flex:none;max-width:42%;color:var(--muted);font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.row__meta{display:block;font-size:12px;line-height:1.45;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.row__state{display:inline-flex;align-items:center;gap:5px}.row__state-dot{width:6px;height:6px;flex:none;border-radius:50%;background:currentColor}.row__state--running{color:var(--accent)}.row__state--starting{color:var(--accent);opacity:.6}.row__state--reconnecting{color:var(--accent);animation:state-breathe 1.9s ease-in-out infinite}.row__state--waiting{color:var(--warn)}.row__state--halted{color:var(--warn);opacity:.8}.row__state--ready{color:var(--ok)}.row__state--error{color:var(--danger)}.row__state--closed,.row__state--fresh{color:var(--muted)}.row__state--background{color:var(--accent);animation:state-breathe 1.9s ease-in-out infinite}@keyframes state-breathe{0%,to{opacity:.72}50%{opacity:.32}}.sidebar__foot{padding:12px 12px calc(12px + env(safe-area-inset-bottom));border-top:1px solid var(--border);display:flex;gap:8px}.sidebar__foot .btn{flex:1;justify-content:center}.rename{width:100%;background:var(--surface);color:var(--text);border:1px solid var(--accent);border-radius:7px;padding:3px 7px;font:inherit;box-shadow:var(--ring)}.rename:focus{outline:none}.rename--title{font-weight:560;max-width:420px}.btn{display:inline-flex;align-items:center;gap:6px;padding:7px 13px;border-radius:8px;border:1px solid var(--border);background:var(--surface);color:var(--text-2);font-size:13px;font-weight:500;white-space:nowrap;text-decoration:none;transition:background .12s ease,border-color .12s ease,color .12s ease}.btn:hover{background:var(--surface-2);color:var(--text)}.btn--primary{background:var(--accent);border-color:var(--accent);color:var(--accent-fg)}.btn--primary:hover{background:var(--accent-hover);border-color:var(--accent-hover);color:var(--accent-fg)}.btn--warn{background:var(--warn);border-color:var(--warn);color:var(--accent-fg);font-weight:600}.btn--warn:hover{filter:brightness(1.06);color:var(--accent-fg)}.btn--ok{background:var(--ok);border-color:var(--ok);color:var(--accent-fg);font-weight:600}.btn--ok:hover{filter:brightness(1.06);color:var(--accent-fg)}.btn--ghost{background:transparent;border-color:transparent;color:var(--text-2)}.btn--ghost:hover{background:var(--surface-2)}.btn:disabled{opacity:.4;cursor:default;background:var(--surface);border-color:var(--border);color:var(--text-2)}.btn--primary:disabled{background:var(--accent);border-color:var(--accent);color:var(--accent-fg)}.btn--ok:disabled{background:var(--ok);border-color:var(--ok);color:var(--accent-fg)}.theme-btn{flex:none;display:grid;place-items:center;width:28px;height:28px;padding:0;border-radius:8px;color:var(--muted)}.theme-btn:hover{background:var(--surface-2);color:var(--text)}.theme-btn svg{width:16px;height:16px}.theme-btn[aria-pressed=true]{color:var(--accent);background:var(--accent-soft)}.topbar{display:flex;align-items:center;gap:10px;padding:10px 16px;border-bottom:1px solid var(--border);background:var(--bg);flex:none;flex-wrap:wrap;min-width:0}.topbar__tools{display:flex;align-items:center;gap:10px;min-width:0;margin-left:auto;flex-wrap:wrap;justify-content:flex-end;row-gap:6px}@container (max-width: 780px){.topbar .clock{display:none}}@container (max-width: 660px){.topbar .badge--cost{display:none}}@container (max-width: 520px){.topbar .usage{display:none}}.topbar .select__trigger{max-width:min(40vw,190px)}.topbar__id{display:flex;flex-direction:column;min-width:0;flex:0 1 auto;line-height:1.3}.topbar__head{display:flex;align-items:center;gap:8px;min-width:0}.topbar__title{display:block;text-align:left;font-family:var(--serif);font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;max-width:100%;padding:0}.topbar__title:hover:not(:disabled){color:var(--accent)}.topbar__title:disabled{cursor:default}.topbar__project{flex:0 1 auto;min-width:0;max-width:12em;padding-left:8px;border-left:1px solid var(--border);color:var(--muted);font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cwd{position:relative;min-width:0;z-index:20}.cwd__toggle{display:flex;align-items:center;gap:3px;width:100%;min-width:0;padding:0;text-align:left;color:var(--muted)}.cwd__toggle:hover{color:var(--text-2)}.cwd__chev{flex:none;width:10px;height:10px;transition:transform .15s ease}.cwd__chev--open{transform:rotate(90deg)}.cwd__short{font-family:var(--mono);font-size:11.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cwd__pop{position:absolute;top:calc(100% + 6px);left:0;display:flex;align-items:flex-end;gap:10px;width:max-content;min-width:min(320px,88vw);max-width:min(620px,88vw);padding:9px 10px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-lg);animation:pop .12s ease-out}.cwd__full{flex:1;min-width:0;font-family:var(--mono);font-size:12px;line-height:1.5;color:var(--text-2);word-break:break-all;-webkit-user-select:text;user-select:text}.cwd__copy{flex:none;padding:3px 9px;font-size:12px;white-space:nowrap}.badge{font-size:12px;font-family:var(--mono);color:var(--muted);background:var(--surface);padding:4px 10px;border:1px solid var(--border);border-radius:999px;white-space:nowrap;flex:none;max-width:40vw;overflow:hidden;text-overflow:ellipsis}.badge--live{color:var(--accent);border-color:var(--accent-line);background:var(--accent-soft)}.badge--wait{color:var(--warn);border-color:var(--warn-line);background:var(--warn-soft)}.menu-btn{display:none}.meters-refresh{display:grid;place-items:center;flex:none;width:26px;height:26px;border-radius:8px;color:var(--muted);transition:background .12s ease,color .12s ease}.meters-refresh:hover:not(:disabled){background:var(--surface-2);color:var(--accent)}.meters-refresh:disabled{opacity:.4;cursor:default}.meters-refresh svg{width:14px;height:14px}.meters-refresh.is-busy svg{animation:meters-spin .8s linear infinite}@keyframes meters-spin{to{transform:rotate(360deg)}}.usage{display:grid;grid-template-columns:auto minmax(44px,72px) auto auto;align-items:center;gap:2px 7px;flex:none;padding:4px 11px;border:1px solid var(--border);border-radius:12px;background:var(--surface);font-size:11px;line-height:1.3;color:var(--muted);cursor:default}.usage__label{font-family:var(--mono);white-space:nowrap}.usage__track{height:4px;border-radius:999px;background:var(--surface-3);overflow:hidden}.usage__fill{display:block;height:100%;border-radius:999px;background:var(--accent);transition:width .3s ease,background .2s ease}.usage__fill--warn{background:var(--warn)}.usage__fill--over{background:var(--danger)}.usage__pct{font-family:var(--mono);font-variant-numeric:tabular-nums;text-align:right;color:var(--text-2);white-space:nowrap}.usage__reset{font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--muted);white-space:nowrap;padding-left:2px}.contextbar{display:flex;align-items:center;gap:9px;flex:none;padding:7px 16px;border-bottom:1px solid var(--border);background:var(--bg);font-size:11px;line-height:1.3;color:var(--muted)}.contextbar__label{font-family:var(--mono);white-space:nowrap}.contextbar__track{flex:1 1 auto;min-width:0;height:4px;border-radius:999px;background:var(--surface-3);overflow:hidden}.contextbar__fill{display:block;height:100%;border-radius:999px;background:var(--accent);transition:width .3s ease,background .2s ease}.contextbar__fill--warn{background:var(--warn)}.contextbar__fill--over{background:var(--danger)}.contextbar__pct{font-family:var(--mono);font-variant-numeric:tabular-nums;text-align:right;color:var(--text-2);white-space:nowrap}.clock{display:flex;flex-direction:column;align-items:flex-end;flex:none;font-family:var(--mono);font-variant-numeric:tabular-nums;line-height:1.3;cursor:default}.clock__time{font-size:13px;color:var(--text-2)}.clock__date{font-size:10.5px;color:var(--muted);white-space:nowrap}.select{position:relative;flex:none}.select__trigger{display:flex;align-items:center;gap:6px;max-width:40vw;padding:4px 8px 4px 11px;border:1px solid var(--border);border-radius:999px;background:var(--surface);color:var(--text-2);font-size:12px;font-family:var(--mono);transition:background .12s ease,border-color .12s ease}.select__trigger:hover{background:var(--surface-2);border-color:var(--surface-3)}.select--open .select__trigger{border-color:var(--accent-line);background:var(--accent-soft);color:var(--text)}.select__value{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select__chev{flex:none;width:12px;height:12px;color:var(--muted);transition:transform .15s ease}.select--open .select__chev{transform:rotate(180deg)}.select__menu{position:absolute;top:calc(100% + 6px);right:0;z-index:25;min-width:232px;max-width:min(340px,92vw);max-height:min(320px,60vh);overflow-y:auto;padding:5px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-lg);animation:pop .12s ease-out}@keyframes pop{0%{opacity:0;transform:translateY(-4px)}}.select__option{display:grid;grid-template-columns:16px 1fr;gap:2px 8px;width:100%;padding:7px 9px;border-radius:7px;text-align:left}.select__option.is-cursor{background:var(--surface-2)}.select__option.is-on .select__label{color:var(--accent)}.select__check{grid-row:1;color:var(--accent);font-size:12px;line-height:1.5}.select__label{grid-row:1;font-family:var(--mono);font-size:12.5px;color:var(--text);overflow-wrap:anywhere}.select__hint{grid-row:2;grid-column:2;font-size:11.5px;line-height:1.4;color:var(--muted)}.select__suffix{flex:none;padding:1px 6px;border-radius:999px;background:var(--accent-soft);color:var(--accent);font-size:11px}.select__suffix--hot{background:var(--accent);color:var(--accent-fg);font-weight:560}.modelmenu{min-width:296px}.modelmenu__head{padding:4px 9px 6px;font-size:11px;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}.modelmenu__sep{height:1px;margin:5px 4px;background:var(--border-soft)}.modelmenu__row{display:flex;align-items:center;gap:10px;width:100%;padding:7px 9px;border-radius:7px;text-align:left}.modelmenu__row--btn:hover{background:var(--surface-2)}.modelmenu__label{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0;font-size:12.5px;color:var(--text)}.modelmenu__desc{font-size:11.5px;line-height:1.35;color:var(--muted)}.modelmenu__levels{flex:none;display:flex;gap:2px;padding:2px;border:1px solid var(--border);border-radius:999px;background:var(--surface-2)}.modelmenu__level{padding:3px 8px;border-radius:999px;font-family:var(--mono);font-size:11px;color:var(--muted);transition:background .12s ease,color .12s ease}.modelmenu__level:hover{color:var(--text)}.modelmenu__level.is-on{background:var(--accent);color:var(--accent-fg)}.switch{flex:none;position:relative;width:30px;height:17px;border-radius:999px;background:var(--surface-3);transition:background .14s ease}.switch.is-on{background:var(--accent)}.switch__knob{position:absolute;top:2px;left:2px;width:13px;height:13px;border-radius:999px;background:var(--surface);box-shadow:var(--shadow-sm);transition:transform .14s ease}.switch.is-on .switch__knob{transform:translate(13px)}.transcript{flex:1;min-height:0;overflow-y:auto;padding:24px 16px 8px}.stream{max-width:760px;margin:0 auto;display:flex;flex-direction:column;gap:16px}.msg--user{align-self:flex-end;max-width:82%;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);padding:10px 15px;color:var(--text);white-space:pre-wrap;overflow-wrap:anywhere}.msg--user__images{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}.msg--user__image{width:88px;height:88px;object-fit:cover;border-radius:10px;border:1px solid var(--border);background:var(--surface)}.msg--user--editing{align-self:stretch;max-width:100%}.msg--user__edit{display:flex;flex-direction:column;gap:8px}.msg--user__edit-field{width:100%;resize:none;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:10px;padding:8px 11px;font:inherit;line-height:1.55;min-height:38px;max-height:320px;overflow-y:auto}.msg--user__edit-field:focus{outline:none;border-color:var(--accent-line);box-shadow:var(--ring)}.msg--user__edit-actions{display:flex;justify-content:flex-end;gap:8px}.msg--assistant{color:var(--text);line-height:1.72;overflow-wrap:anywhere}.markdown-preview.msg--assistant__body{padding:0;font-family:inherit;font-size:inherit;line-height:inherit;color:inherit}.copybtn{flex:none;padding:3px 9px;border:1px solid var(--border);border-radius:7px;background:var(--surface);color:var(--muted);font-size:11.5px;line-height:1.45;white-space:nowrap;transition:opacity .12s ease,background .12s ease,color .12s ease,border-color .12s ease}.copybtn:hover{background:var(--surface-2);color:var(--text)}.copybtn--done{color:var(--ok);border-color:var(--ok)}.codeblock{position:relative}.codeblock__copy{position:absolute;top:8px;right:8px;z-index:1;opacity:0}.codeblock:hover .codeblock__copy,.codeblock__copy:focus-visible{opacity:1}.markdown-preview .codeblock{margin:1em 0}.markdown-preview .codeblock>pre{margin:0}.markdown-preview.msg--assistant__body>:last-child{margin-bottom:0}.msg--assistant__foot{display:flex;justify-content:flex-end;margin-top:4px}.msg--assistant__foot .copybtn{opacity:0}.msg--assistant:hover .msg--assistant__foot .copybtn,.msg--assistant__foot .copybtn:focus-visible{opacity:1}@media(hover:none){.codeblock{display:flex;flex-direction:column;align-items:flex-end;gap:6px}.codeblock>pre{width:100%}.codeblock__copy{position:static;order:-1;opacity:1}.msg--assistant__foot .copybtn{opacity:1}}.caret{display:inline-block;width:7px;height:1.05em;vertical-align:text-bottom;background:var(--accent);border-radius:1px;animation:blink 1s steps(2,start) infinite}@keyframes blink{50%{opacity:0}}.thinking{border-left:2px solid var(--border);padding-left:14px;color:var(--muted);font-size:13px;font-style:italic;white-space:pre-wrap}.transcript__more{align-self:center;display:inline-flex;align-items:center;padding:6px 16px;border-radius:999px;border:1px solid var(--border);background:var(--surface);color:var(--muted);font-size:12.5px}.transcript__more:hover:not(:disabled){background:var(--surface-2);color:var(--text);border-color:var(--surface-3)}.transcript__more:disabled{opacity:.7;cursor:default}.transcript__divider{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:12px}.transcript__divider:before,.transcript__divider:after{content:"";flex:1;height:1px;background:var(--border-soft)}.work{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--muted)}.work__dots{display:flex;gap:4px}.work__dot{width:6px;height:6px;border-radius:50%;background:var(--accent);animation:work-bounce 1.15s ease-in-out infinite}.work__dot:nth-child(2){animation-delay:.16s}.work__dot:nth-child(3){animation-delay:.32s}@keyframes work-bounce{0%,75%,to{transform:translateY(0);opacity:.3}35%{transform:translateY(-4px);opacity:1}}.work__label{background:linear-gradient(90deg,var(--muted) 25%,var(--text) 50%,var(--muted) 75%);background-size:220% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;animation:work-shimmer 2.1s linear infinite}@keyframes work-shimmer{0%{background-position:110% 0}to{background-position:-110% 0}}.work__time{font-family:var(--mono);font-size:12px}.work--wait .work__dot{background:var(--warn);animation:none;opacity:1}.work--wait .work__label{color:var(--warn);background:none;-webkit-background-clip:border-box;background-clip:border-box;animation:none}.badge--live{animation:badge-pulse 2s ease-in-out infinite}@keyframes badge-pulse{50%{opacity:.55}}@media(prefers-reduced-motion:reduce){.work__dot,.work__label,.badge--live,.caret,.select__menu,.modal,.modal-backdrop,.oplog,.cwd__pop,.micbtn.is-on,.row__state--reconnecting,.row__state--background,.relink,.relink__dot,.mediaview__progress-fill{animation:none}.row__state--reconnecting,.row__state--background{opacity:.6}.work__dot{opacity:1}.work__label{color:var(--text);background:none}.mediaview__progress-fill{width:100%}.oplog--leaving,.usage__fill,.sidebar__chev,.cwd__chev{transition:none}.meters-refresh.is-busy svg,.sessionmenu__refresh.is-busy svg{animation:none}}.tool{border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);box-shadow:var(--shadow-sm);overflow:hidden}.tool--wait{border-color:var(--warn-line)}.tool--error{border-color:var(--danger)}.tool__head{display:flex;align-items:center;gap:9px;width:100%;padding:9px 12px;text-align:left}.tool__head:hover{background:var(--surface-2)}.tool__name{font-family:var(--mono);font-size:12.5px;font-weight:600;color:var(--accent);flex:none}.tool__arg{font-family:var(--mono);font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.tool__status{font-size:12px;color:var(--muted);flex:none}.tool__body{border-top:1px solid var(--border-soft);padding:11px 12px;background:var(--bg)}.tool__questions{display:flex;flex-direction:column;gap:12px}.tool__question+.tool__question{padding-top:12px;border-top:1px solid var(--border-soft)}.tool__question-head{display:flex;align-items:baseline;flex-wrap:wrap;gap:5px 8px;margin-bottom:5px}.tool__question-text{font-size:13px;line-height:1.45;color:var(--text)}.tool__question-answer{font-size:12.5px}.tool__answer-value{color:var(--text-2)}.tool__answer-value:before{content:"→ ";color:var(--accent);font-weight:600}.tool__answer-empty{color:var(--muted);font-style:italic}pre.code{margin:0;font-family:var(--mono);font-size:12.5px;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere;max-height:340px;overflow-y:auto;color:var(--code-fg)}.diff{border:1px solid var(--border);border-radius:8px;overflow:hidden;background:var(--surface)}.diff__head{display:flex;align-items:center;gap:10px;padding:7px 10px;background:var(--surface-2);border-bottom:1px solid var(--border-soft);font-family:var(--mono);font-size:12px}.diff__path{min-width:0;flex:1;overflow-wrap:anywhere;color:var(--text-2)}.diff__stat{flex:none;display:flex;gap:8px;font-weight:600}.diff__stat--add{color:var(--ok)}.diff__stat--del{color:var(--danger)}.diff__note{padding:5px 10px;font-size:12px;color:var(--muted);border-bottom:1px solid var(--border-soft)}.diff__body{max-height:min(340px,46vh);overflow-y:auto;padding:4px 0;background:var(--bg)}.diff__row{display:flex;align-items:flex-start;gap:6px;padding:0 10px 0 6px;font-family:var(--mono);font-size:12.5px;line-height:1.55;color:var(--code-fg)}.diff__mark{flex:none;width:10px;text-align:center;color:var(--muted);-webkit-user-select:none;user-select:none}.diff__text{min-width:0;flex:1;white-space:pre-wrap;overflow-wrap:anywhere;-moz-tab-size:2;tab-size:2}.diff__row--add{background:var(--add-bg);color:var(--add-fg)}.diff__row--add .diff__mark{color:var(--ok)}.diff__row--del{background:var(--del-bg);color:var(--del-fg)}.diff__row--del .diff__mark{color:var(--danger)}.diff__row--gap{color:var(--muted);font-size:12px;padding-top:2px;padding-bottom:2px}.result-line{display:flex;gap:14px;font-size:12px;color:var(--muted);font-family:var(--mono);border-top:1px dashed var(--border);padding-top:10px}.notice{font-size:13px;color:var(--muted);border-left:2px solid var(--border);padding-left:14px}.notice--error{color:var(--danger);border-left-color:var(--danger)}.empty{color:var(--muted);text-align:center;padding:64px 16px;max-width:460px;margin:0 auto;font-family:var(--serif);font-size:16px;line-height:1.6}.relink{flex:none;width:min(760px,100% - 32px);margin:0 auto 8px;display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:8px 9px 8px 12px;border:1px solid var(--border);border-left:2px solid var(--accent);border-radius:var(--radius);background:var(--surface-2);color:var(--text-2);font-size:12.5px;animation:relink-in .18s ease-out}.relink__msg{flex:1;min-width:210px;display:flex;align-items:center;gap:10px;line-height:1.45}.relink .btn{flex:none}.relink__dot{width:6px;height:6px;flex:none;border-radius:50%;background:var(--accent);animation:state-breathe 1.9s ease-in-out infinite}.relink--error{border-left-color:var(--danger)}.relink--error .relink__dot{background:var(--danger);animation:none}@keyframes relink-in{0%{opacity:0;transform:translateY(4px)}}.composer{flex:none;background:var(--bg);padding:8px 16px calc(14px + env(safe-area-inset-bottom))}.composer__inner{max-width:760px;margin:0 auto;position:relative}.composer__field{display:flex;gap:8px;align-items:flex-end;padding:8px 8px 8px 4px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow-sm);transition:border-color .14s ease,box-shadow .14s ease}.composer__field:focus-within{border-color:var(--accent-line);box-shadow:var(--ring)}.composer textarea{flex:1;resize:none;background:none;color:var(--text);border:none;padding:7px 8px 7px 12px;font:inherit;line-height:1.55;max-height:190px;min-height:38px}.composer textarea:focus{outline:none}.composer textarea::placeholder{color:var(--muted)}.composer .btn{flex:none;border-radius:999px;padding:7px 16px}.sendbtn__icon{display:none;flex:none}.addbtn{flex:none;display:grid;place-items:center;width:30px;height:30px;margin-left:4px;border-radius:999px;color:var(--muted);transition:background .12s ease,color .12s ease}.addbtn:hover:not(:disabled){background:var(--surface-2);color:var(--text)}.addbtn:disabled{opacity:.4}.addbtn svg{width:16px;height:16px}.composer__fileinput{display:none}.attachbtn{flex:none;display:grid;place-items:center;width:30px;height:30px;border-radius:999px;color:var(--muted);transition:background .12s ease,color .12s ease}.attachbtn:hover:not(:disabled){background:var(--surface-2);color:var(--text)}.attachbtn:disabled{opacity:.4}.attachbtn svg{width:16px;height:16px}.composer__attachments{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 8px 4px}.composer__thumb{position:relative;flex:none;width:60px;height:60px;border-radius:var(--radius);overflow:hidden;border:1px solid var(--border);background:var(--surface-2)}.composer__thumb img{display:block;width:100%;height:100%;object-fit:cover}.composer__thumb-remove{position:absolute;top:3px;right:3px;display:grid;place-items:center;width:18px;height:18px;border-radius:999px;background:#14131299;color:#fdfcfa;transition:background .12s ease}.composer__thumb-remove:hover{background:#141312d1}.composer__thumb-remove svg{width:9px;height:9px}.micbtn{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:999px;color:var(--muted);transition:background .12s ease,color .12s ease}.micbtn:hover:not(:disabled){background:var(--surface-2);color:var(--text)}.micbtn:disabled{opacity:.4}.micbtn svg{width:16px;height:16px}.micbtn.is-on{color:var(--danger);background:color-mix(in srgb,var(--danger) 14%,transparent);animation:mic-pulse 1.6s ease-in-out infinite}.micbtn.is-on:hover:not(:disabled){color:var(--danger);background:color-mix(in srgb,var(--danger) 22%,transparent)}@keyframes mic-pulse{0%,to{box-shadow:0 0 color-mix(in srgb,var(--danger) 40%,transparent)}70%{box-shadow:0 0 0 5px transparent}}.composer .oplog{margin:0 0 8px}.cmdmenu{position:absolute;left:0;right:0;bottom:calc(100% + 8px);z-index:10;padding:5px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-lg);max-height:min(320px,46vh);overflow-y:auto;overflow-x:hidden;animation:pop .12s ease-out}.cmdmenu__row{display:flex;align-items:baseline;gap:8px;width:100%;padding:7px 10px;border-radius:7px;text-align:left}.cmdmenu__row.is-on{background:var(--surface-2)}.cmdmenu__name{font-family:var(--mono);font-size:13px;color:var(--accent);flex:none}.cmdmenu__hint{font-family:var(--mono);font-size:12px;color:var(--warn);flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cmdmenu__desc{font-size:12px;color:var(--muted);min-width:0;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cmdmenu__empty{padding:9px 10px;font-size:12px;color:var(--muted)}.ctxmenu{position:fixed;z-index:45;min-width:224px;max-width:min(320px,92vw);padding:5px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-lg);animation:pop .12s ease-out}.ctxmenu:focus{outline:none}.ctxmenu__note{padding:7px 9px 10px;margin-bottom:3px;border-bottom:1px solid var(--border-soft);font-size:12px;line-height:1.45;color:var(--muted)}.ctxmenu__item{display:flex;align-items:baseline;gap:8px;width:100%;padding:8px 9px;border-radius:7px;text-align:left;color:var(--text);font-size:13px}.ctxmenu__item.is-cursor{background:var(--surface-2)}.ctxmenu__label{flex:1;min-width:0}.ctxmenu__hint{font-size:11.5px;color:var(--muted)}@media(max-width:860px){.ctxmenu__item{min-height:40px}}@media(hover:none){.ctxmenu__item{min-height:40px}}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:40;display:flex;align-items:center;justify-content:center;padding:16px;background:#1f1e1d6b;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);animation:fade .14s ease-out}.modal-backdrop--sheet{align-items:flex-end;overflow-y:auto}@keyframes fade{0%{opacity:0}}.modal{width:100%;max-width:460px;display:flex;flex-direction:column;max-height:calc(100vh - 32px);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);overflow:hidden;animation:rise .16s cubic-bezier(.2,.8,.3,1)}@keyframes rise{0%{opacity:0;transform:translateY(10px) scale(.985)}}.modal__head{display:flex;align-items:center;gap:10px;padding:16px 16px 0}.modal__title{margin:0;flex:1;min-width:0;font-family:var(--serif);font-size:17px;font-weight:500}.modal__close{flex:none;display:grid;place-items:center;width:28px;height:28px;margin:-4px -4px 0 0;border-radius:8px;color:var(--muted);font-size:16px;line-height:1}.modal__close:hover{background:var(--surface-2);color:var(--text)}.modal__body{padding:10px 16px 16px;flex:1 1 auto;min-height:0;overflow-y:auto}.modal__text{margin:0 0 12px;font-size:13px;color:var(--muted)}.modal__text--dim{color:var(--muted);opacity:.75}.modal__error{margin:10px 0 0;padding:8px 10px;border:1px solid var(--warn);border-radius:8px;background:var(--surface-2);font-size:12.5px;color:var(--text)}.modal__actions{display:flex;justify-content:flex-end;gap:8px;padding:12px 16px;background:var(--surface-2);border-top:1px solid var(--border-soft)}.modal__actions .btn{padding:8px 16px}.modal__actions .btn:not(.btn--primary){background:var(--surface)}.modal__actions .btn.btn--warn{background:var(--warn);border-color:var(--warn)}.modal--sheet{max-width:480px;max-height:none;border-radius:var(--radius-lg) var(--radius-lg) 0 0;overflow:visible;margin-bottom:env(safe-area-inset-bottom)}.modal--sheet .modal__body{flex:none;overflow:visible}.sessionmenu__row{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:11px 2px;border-bottom:1px solid var(--border-soft)}.sessionmenu__row:last-child{border-bottom:none}.sessionmenu__label{min-width:0;font-size:13.5px;color:var(--text-2)}.sessionmenu__row .select,.sessionmenu__row .cwd{flex:1;min-width:0}.sessionmenu__row .select__trigger{max-width:none;width:100%}.sessionmenu__row .cwd__pop{left:auto;right:0}.sessionmenu__rename{width:100%;margin-top:4px;padding:11px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface-2);color:var(--text);font-size:13.5px;font-weight:520;text-align:center}.sessionmenu__rename:hover{background:var(--surface-3)}.sessionmenu__refresh{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:44px;margin-top:4px;padding:8px 11px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface-2);color:var(--text);font-size:13.5px;font-weight:520;text-align:center}.sessionmenu__refresh:hover:not(:disabled){background:var(--surface-3)}.sessionmenu__refresh:disabled{opacity:.6;cursor:default}.sessionmenu__refresh svg{flex:none;width:15px;height:15px}.sessionmenu__refresh.is-busy svg{animation:meters-spin .8s linear infinite}.sessionmenu__refresh-text{display:flex;flex-direction:column;line-height:1.35}.sessionmenu__refresh-time{font-size:11.5px;font-weight:400;color:var(--muted)}.field{display:block;font-size:12px;font-weight:500;color:var(--muted);margin-bottom:6px}.input{width:100%;padding:9px 12px;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:9px;font:inherit;transition:border-color .12s ease,box-shadow .12s ease}.input:focus{outline:none;border-color:var(--accent-line);box-shadow:var(--ring)}.input::placeholder{color:var(--muted)}.input--mono{font-family:var(--mono);font-size:13px}.finds{list-style:none;margin:12px 0 0;padding:0;max-height:240px;overflow-y:auto;border:1px solid var(--border-soft);border-radius:10px}.finds li+li{border-top:1px solid var(--border-soft)}.find{display:grid;grid-template-columns:1fr auto;gap:2px 10px;width:100%;padding:8px 10px;background:none;border:none;border-radius:0;text-align:left;cursor:pointer;color:var(--text);font:inherit}.find:hover:not(:disabled){background:var(--surface-2)}.find:disabled{cursor:default;opacity:.55}.find__name{font-size:13px;font-weight:500}.find__path{grid-column:1;font-family:var(--mono);font-size:11.5px;color:var(--muted);overflow-wrap:anywhere}.find__note{grid-column:2;grid-row:1 / span 2;align-self:center;max-width:45%;font-size:11.5px;color:var(--muted);text-align:right}.finds__agent{margin-top:12px;height:260px;border:1px solid var(--border-soft);border-radius:10px;overflow:hidden}.finds__agent .transcript{height:100%}.newproj__roots{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}.newproj__root{padding:4px 9px;border:1px solid var(--border);border-radius:999px;background:var(--surface-2);color:var(--muted);font-family:var(--mono);font-size:11.5px;cursor:pointer}.newproj__root:hover{color:var(--text)}.newproj__root.is-on{border-color:var(--accent-line);color:var(--text)}.newproj__field{margin-top:14px}.newproj__preview{margin:8px 0 0;font-family:var(--mono);font-size:12px;color:var(--muted);overflow-wrap:anywhere}.newproj__opts{margin-top:14px;border:1px solid var(--border-soft);border-radius:10px;overflow:hidden}.newproj__opt+.newproj__opt{border-top:1px solid var(--border-soft)}.newproj__opt{display:flex;align-items:center;gap:10px;width:100%;padding:9px 11px;background:none;border:none;text-align:left;cursor:pointer;color:var(--text);font:inherit;font-size:13px}.newproj__opt:hover{background:var(--surface-2)}.newproj__optlabel{flex:1;display:flex;flex-direction:column;gap:1px}.newproj__optdesc{font-size:11.5px;color:var(--muted)}.newproj__warnings{margin:0;padding:0;list-style:none}.newproj__warnings li+li{margin-top:4px}.modal--wide{max-width:620px}.tabs{display:flex;gap:4px;margin-bottom:14px;padding-bottom:2px;border-bottom:1px solid var(--border-soft)}.tabs__tab{display:inline-flex;align-items:center;gap:7px;padding:7px 12px;border-radius:8px 8px 0 0;color:var(--muted);font-size:13px;font-weight:500;position:relative}.tabs__tab:hover,.tabs__tab.is-on{color:var(--text)}.tabs__tab.is-on:after{content:"";position:absolute;left:8px;right:8px;bottom:-3px;height:2px;border-radius:2px;background:var(--accent)}.tabs__count{padding:1px 6px;border-radius:999px;background:var(--surface-2);font-size:11px;font-variant-numeric:tabular-nums}.extlist{list-style:none;margin:0 0 12px;padding:0;display:flex;flex-direction:column;gap:8px}.extlist__row{padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2)}.extlist__head{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-bottom:4px}.extlist__name{font-family:var(--mono);font-size:13px;font-weight:600;color:var(--text);margin-right:2px}.extlist__meta{font-family:var(--mono);font-size:11.5px;color:var(--muted);overflow-wrap:anywhere}.extlist__error{margin-top:3px;font-size:12px;color:var(--danger);overflow-wrap:anywhere}.extlist__actions{display:flex;flex-wrap:wrap;gap:4px;margin-top:7px}.chip{padding:2px 7px;border:1px solid var(--border);border-radius:999px;background:var(--surface);color:var(--muted);font-size:11px;white-space:nowrap}.chip--ok{color:var(--ok);border-color:var(--ok)}.chip--bad{color:var(--danger);border-color:var(--danger)}.chip--warn{color:var(--warn);border-color:var(--warn-line);background:var(--warn-soft)}.chip--mute{opacity:.75}.btn--sm{padding:4px 9px;font-size:12px}.btn--danger{color:var(--danger)}.btn--danger:hover{background:var(--danger-soft);color:var(--danger)}.extform{margin-bottom:12px}.extform .field{margin-top:10px}.extform .field:first-child{margin-top:0}.extform--card{padding:12px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2)}.extform--card .input{background:var(--surface)}.extbar{display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;gap:8px;margin-bottom:12px}.extform--card .extbar{margin:12px 0 0}.extbar .btn{padding:8px 16px}.extform__row{display:flex;gap:8px;align-items:center}.extform__row .input{flex:1;min-width:0}.extform__row .btn{flex:none}.input--area{min-height:62px;resize:vertical}.oplog{margin:12px 0;padding:9px 11px;border-radius:9px;border:1px solid var(--border);background:var(--surface-2);font-size:12.5px;white-space:pre-wrap;overflow-wrap:anywhere;animation:oplog-in .18s ease-out}.oplog:last-child{margin-bottom:0}.oplog--ok{border-color:var(--ok);color:var(--text-2)}.oplog--bad{border-color:var(--danger);color:var(--danger)}.oplog__link{display:block;margin-top:3px;color:var(--accent);font-family:var(--mono);font-size:12px;overflow-wrap:anywhere}.oplog__link:hover{text-decoration:underline}.oplog--dismissible{position:relative;padding-right:28px}.oplog__dismiss{position:absolute;top:7px;right:7px;display:grid;place-items:center;width:18px;height:18px;border-radius:5px;color:var(--muted);font-size:10.5px;line-height:1}.oplog__dismiss:hover{background:var(--surface-3);color:var(--text)}.oplog--leaving{opacity:0;transform:translateY(-4px);transition:opacity .22s ease,transform .22s ease;pointer-events:none}@keyframes oplog-in{0%{opacity:0;transform:translateY(5px)}}.sidebar__foot{flex-wrap:wrap}.sidebar__wide{flex-basis:100%}.catalog__filters{display:flex;gap:8px;margin-bottom:12px}.catalog__filters .input{flex:1;min-width:0}.catalog__desc{margin:2px 0 4px;font-size:12.5px;line-height:1.5;color:var(--text-2);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.linkish{padding:0;color:var(--accent);text-decoration:underline;text-underline-offset:2px}.account-btn{display:flex;align-items:center;gap:8px;width:100%;padding:8px 10px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);font-size:13px;text-align:left}.account-btn:hover{background:var(--surface-2)}.account-btn__id{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.account{padding:12px;margin-bottom:12px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2)}.account__id{font-family:var(--mono);font-size:13.5px;font-weight:600;overflow-wrap:anywhere}.account__chips{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0 4px}.account__flow .field{margin-top:12px}.account__link{display:block;padding:9px 11px;border:1px solid var(--accent-line);border-radius:9px;background:var(--accent-soft);color:var(--accent);font-family:var(--mono);font-size:12px;line-height:1.5;overflow-wrap:anywhere}.account__step{margin:8px 0 0;color:var(--muted);font-size:12.5px;line-height:1.55}.account__go{justify-content:center;width:100%;margin-top:10px;padding:11px 16px;font-size:14px}.account__raw{display:flex;align-items:center;gap:8px;margin-top:8px}.account__rawurl{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-family:var(--mono);font-size:11.5px}.account__fallback{margin-top:10px;font-size:12.5px}.account__fallback summary{cursor:pointer;color:var(--muted)}.account__fallback summary:hover{color:var(--text-2)}.account__fallback .account__link{margin-top:8px}.account__coderow{flex-wrap:wrap}.account__coderow .input{flex:1 1 100%}.account__coderow .btn{flex:1 1 0;justify-content:center;min-height:40px}.account__note--code{margin:8px 0 0}.account__log{margin:12px 0;padding:9px 11px;max-height:180px;overflow:auto;border:1px solid var(--border);border-radius:9px;background:var(--surface-2);color:var(--muted);font-family:var(--mono);font-size:11.5px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}.account__warn{margin:0 0 12px;padding:9px 11px;border:1px solid var(--warn-line);border-radius:9px;background:var(--warn-soft);color:var(--warn);font-size:12.5px;line-height:1.5}.account__note{margin:0 0 6px;color:var(--muted);font-size:12.5px;line-height:1.5}.account__bar{flex-wrap:nowrap}.account__bar .btn{padding:8px 13px}.account__bar .account__relink{margin-inline-end:auto}@media(max-width:459.98px){.account__bar{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}.account__bar .account__relink{margin-inline-end:0}.account__bar>.account__relink,.account__bar>.btn--warn~.btn{grid-column:1 / -1}.account__bar .btn{justify-content:center}}.account__relink svg{flex:none;width:15px;height:15px;color:var(--muted)}.account__relink:hover:not(:disabled) svg{color:var(--warn)}.sheet{width:100%;max-width:560px;background:var(--surface);border:1px solid var(--warn-line);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);overflow:hidden;margin-bottom:env(safe-area-inset-bottom);animation:rise .16s cubic-bezier(.2,.8,.3,1)}.sheet__head{display:flex;align-items:center;gap:8px;padding:13px 16px;background:var(--warn-soft);border-bottom:1px solid var(--border-soft);font-weight:600;color:var(--text)}.sheet__body{padding:14px 16px}.sheet__tool{font-family:var(--mono);font-size:13px;color:var(--warn);margin-bottom:8px}.sheet__reason{margin:0 0 10px;font-size:13px;line-height:1.45;color:var(--text-2)}.sheet__actions{display:flex;gap:10px;padding:0 16px 16px}.sheet__actions .btn{flex:1;justify-content:center;padding:11px}.qsheet{width:100%;max-width:620px;max-height:calc(100vh - 32px);display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--accent-line);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);overflow:hidden;margin-bottom:env(safe-area-inset-bottom);animation:rise .16s cubic-bezier(.2,.8,.3,1)}.qsheet__head{display:flex;align-items:center;gap:10px;padding:13px 16px;background:var(--accent-soft);border-bottom:1px solid var(--border-soft);font-weight:600;color:var(--text);flex:none}.qsheet__head-icon{display:grid;place-items:center;flex:none;width:22px;height:22px;border-radius:999px;border:1.5px solid var(--accent);color:var(--accent);font-family:var(--serif);font-size:13px;font-weight:700}.qsheet__body{padding:14px 16px 6px;overflow-y:auto;flex:1}.qsheet__reason{margin:0 0 12px;font-size:13px;line-height:1.45;color:var(--text-2)}.qsheet__question+.qsheet__question{margin-top:20px;padding-top:18px;border-top:1px solid var(--border-soft)}.qsheet__question{margin-bottom:10px}.qsheet__qhead{display:flex;align-items:baseline;flex-wrap:wrap;gap:8px 9px;margin-bottom:10px}.qsheet__qtext{font-family:var(--serif);font-size:15px;font-weight:500;line-height:1.4;color:var(--text)}.chip--accent{color:var(--accent);border-color:var(--accent-line);background:var(--accent-soft)}.qsheet__options{display:flex;flex-direction:column;gap:6px}.qsheet__option{display:flex;align-items:flex-start;gap:10px;width:100%;padding:9px 11px;text-align:left;border:1px solid var(--border);border-radius:10px;background:var(--surface);transition:border-color .12s ease,background .12s ease}.qsheet__option:hover{background:var(--surface-2)}.qsheet__option:focus-visible{outline:none;box-shadow:var(--ring)}.qsheet__option.is-selected{border-color:var(--accent);background:var(--accent-soft)}.qsheet__opt-mark{position:relative;flex:none;margin-top:2px;width:15px;height:15px;border:1.5px solid var(--border);background:var(--surface)}.qsheet__options--radio .qsheet__opt-mark{border-radius:999px}.qsheet__options:not(.qsheet__options--radio) .qsheet__opt-mark{border-radius:5px}.qsheet__option.is-selected .qsheet__opt-mark{border-color:var(--accent);background:var(--accent)}.qsheet__options--radio .qsheet__option.is-selected .qsheet__opt-mark{box-shadow:inset 0 0 0 3px var(--surface)}.qsheet__options:not(.qsheet__options--radio) .qsheet__option.is-selected .qsheet__opt-mark:after{content:"✓";position:absolute;top:0;right:0;bottom:0;left:0;display:grid;place-items:center;font-size:10px;line-height:1;color:var(--accent-fg)}.qsheet__opt-body{min-width:0}.qsheet__opt-label{display:block;font-size:13.5px;font-weight:560;color:var(--text)}.qsheet__opt-desc{display:block;margin-top:2px;font-size:12.5px;line-height:1.4;color:var(--muted)}.qsheet__other{display:flex;flex-direction:column}.qsheet__other-input{margin-top:6px;width:100%;padding:8px 10px;border:1px solid var(--accent-line);border-radius:8px;background:var(--surface);color:var(--text);font:inherit;font-size:13px}.qsheet__other-input:focus{outline:none;box-shadow:var(--ring)}.qsheet__other-input::placeholder{color:var(--muted)}.qsheet__preview{margin:10px 0 0;padding:10px 12px;border:1px solid var(--border-soft);border-radius:8px;background:var(--bg);color:var(--code-fg);font-family:var(--mono);font-size:12px;line-height:1.5;white-space:pre;overflow:auto;max-height:220px}.qsheet__actions{display:flex;gap:10px;padding:12px 16px;border-top:1px solid var(--border-soft);flex:none}.qsheet__actions .btn{flex:1;justify-content:center;padding:11px}.plansheet{width:100%;max-width:720px;min-height:min(56vh,460px);max-height:calc(100vh - 24px);display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--ok-line);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);overflow:hidden;margin-bottom:env(safe-area-inset-bottom);animation:rise .16s cubic-bezier(.2,.8,.3,1)}.plansheet__head{display:flex;align-items:center;gap:10px;padding:13px 16px;background:var(--ok-soft);border-bottom:1px solid var(--border-soft);font-weight:600;color:var(--text);flex:none}.plansheet__head-icon{display:grid;place-items:center;flex:none;width:22px;height:22px;border-radius:999px;border:1.5px solid var(--ok);color:var(--ok)}.plansheet__head-icon svg{width:13px;height:13px}.plansheet__head-text{flex:1;min-width:0}.plansheet__viewtoggle{display:flex;flex:none;gap:2px;padding:2px;background:var(--surface);border-radius:var(--radius)}.plansheet__viewtoggle .btn{border:none;background:transparent;color:var(--muted)}.plansheet__viewtoggle .btn:hover{background:var(--surface-3);color:var(--text-2)}.plansheet__viewtoggle .btn.is-on{background:var(--surface-2);color:var(--text);box-shadow:var(--shadow-sm)}.plansheet__body{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.plansheet__reason{margin:12px 16px 0;font-size:13px;line-height:1.45;color:var(--text-2);flex:none}.plansheet__content{flex:1;min-height:0;display:flex;overflow:hidden}.markdown-preview.plansheet__preview{padding:22px 26px}.plansheet__source{flex:1;min-height:0;width:100%;resize:none;border:none;padding:22px 26px;background:var(--bg);color:var(--text);font:inherit;font-family:var(--mono);font-size:13px;line-height:1.65;-moz-tab-size:2;tab-size:2}.plansheet__source:focus{outline:none}.plansheet__source::placeholder{color:var(--muted)}.plansheet__actions{display:flex;gap:10px;padding:12px 16px;border-top:1px solid var(--border-soft);flex:none}.plansheet__actions .btn{flex:1;justify-content:center;padding:11px}.pane-btn{flex:none;display:grid;place-items:center;width:30px;height:30px;border-radius:8px;color:var(--muted);transition:background .12s ease,color .12s ease}.pane-btn:hover{background:var(--surface-2);color:var(--text)}.pane-btn.is-on{background:var(--accent-soft);color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent-line)}.pane-btn svg{width:16px;height:16px}.sidepane{display:none;flex-direction:column;min-height:0;min-width:0;background:var(--sidebar)}.sidepane--open{display:flex}.sidepane--git{border-right:1px solid var(--border)}.sidepane--ask{border-left:1px solid var(--border)}.sidepane.sidepane--zoomed{position:fixed;top:0;right:0;bottom:0;left:0;z-index:32;width:auto}.sidepane__head{display:flex;align-items:center;gap:8px;flex:none;padding:12px 10px 12px 14px;border-bottom:1px solid var(--border-soft)}.sidepane__icon{flex:none;width:15px;height:15px;color:var(--muted)}.sidepane__title{flex:1;min-width:0;font-family:var(--serif);font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sidepane__btn{flex:none;display:grid;place-items:center;width:26px;height:26px;border-radius:7px;color:var(--muted);font-size:13px;line-height:1}.sidepane__btn:hover{background:var(--surface-2);color:var(--text)}.sidepane__btn:disabled{opacity:.35;cursor:default;background:none}.sidepane__btn svg{width:15px;height:15px}.sidepane__scroll{flex:1;min-height:0;overflow-y:auto;padding:6px 0 10px}.sidepane__empty{margin:0;padding:22px 16px;color:var(--muted);font-size:13px;line-height:1.55}.gitempty{padding:22px 16px}.gitempty__text{margin:0 0 14px;color:var(--muted);font-size:13px;line-height:1.55}.gitempty__btn{width:100%;justify-content:center}.gitempty__hint{margin:8px 0 0;color:var(--muted);font-size:12px;line-height:1.45}.sidepane__tools{display:flex;align-items:center;gap:8px;flex:none;padding:0 10px 8px;border-bottom:1px solid var(--border-soft)}.sidepane__note{font-size:11px;color:var(--muted);white-space:nowrap;cursor:default}.select--compact{min-width:0}.select--compact .select__trigger{max-width:100%;padding:3px 7px 3px 10px;font-size:11.5px}.select--compact .select__menu{left:0;right:auto;max-width:min(340px,calc(100vw - 24px))}.composer--side{padding:8px 10px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--border-soft)}.composer--side .composer__inner{max-width:none}.composer--side .composer__field{flex-wrap:wrap;gap:4px 6px;padding:5px 6px;border-radius:var(--radius)}.composer--side textarea{order:-1;flex:1 0 100%;padding:4px 4px 2px 6px;font-size:13px;line-height:1.5;min-height:26px;max-height:140px}.composer--side .btn{padding:5px 13px;font-size:12.5px}.composer--side .addbtn{width:26px;height:26px;margin:0 auto 0 0}.composer--side .addbtn svg{width:14px;height:14px}.composer--side .micbtn{width:28px;height:28px}.composer--side .micbtn svg{width:14px;height:14px}.sidepane--ask .transcript{padding:14px 12px 4px}.sidepane--ask .stream{gap:12px}.sidepane--ask .msg--user{max-width:94%}.sidepane--ask .empty{padding:28px 4px;font-size:14px;text-align:left}.sidepane--files,.sidepane--search{border-right:1px solid var(--border)}.fssearch{display:flex;flex:none;align-items:center;gap:7px;margin:10px 10px 2px;padding:6px 9px;border:1px solid var(--border-soft);border-radius:8px;background:var(--surface)}.fssearch:focus-within{border-color:var(--accent-line);box-shadow:var(--ring)}.fssearch svg{flex:none;width:14px;height:14px;color:var(--muted)}.fssearch__input{flex:1;min-width:0;background:none;border:none;color:var(--text);font:inherit;font-size:12.5px}.fssearch__input:focus{outline:none}.fssearch__input::placeholder{color:var(--muted)}.fssearch__clear{flex:none;display:grid;place-items:center;width:18px;height:18px;border-radius:5px;color:var(--muted);font-size:10px;line-height:1}.fssearch__clear:hover{background:var(--surface-3);color:var(--text)}.fstree{padding:4px 0 clamp(96px,26vh,160px);overflow-x:auto}.fstree:focus{outline:none}.fsrow{display:flex;align-items:center;min-width:100%;width:max-content;padding-left:calc(8px + var(--depth, 0) * 13px);padding-right:4px;height:25px}.fsrow:hover,.fsrow.is-selected{background:var(--surface-2)}.fsrow.is-open{background:var(--accent-soft);box-shadow:inset 2px 0 0 var(--accent)}.fsrow--dragging{opacity:.4}.fsrow--drop-target{background:var(--accent-soft);box-shadow:inset 0 0 0 1px var(--accent-line)}.fsrow--cut{opacity:.4}.fstree--drop-target{background:var(--surface-2)}.fsrow__main{display:flex;align-items:center;gap:6px;flex:1;min-width:0;height:100%;padding:0;text-align:left}.fsrow__icon{flex:none;display:grid;place-items:center;width:15px;height:15px;color:var(--muted)}.fsrow__icon svg{width:15px;height:15px}.fsrow.is-open .fsrow__icon{color:var(--accent)}.fsrow__name{font-size:13px;color:var(--text-2);white-space:nowrap;min-width:0;overflow:hidden;text-overflow:ellipsis}.fsrow.is-open .fsrow__name{color:var(--text)}.fsrow__icon--git-added,.fsrow__name--git-added{color:var(--ok)}.fsrow__icon--git-modified,.fsrow__name--git-modified{color:var(--warn)}.fsrow--ignored .fsrow__icon,.fsrow--ignored .fsrow__name{color:var(--muted);opacity:.72}.fsrow__tag,.cmdmenu__tag{flex:none;margin-left:6px;font-family:var(--mono);font-size:10px;letter-spacing:.02em;color:var(--muted);opacity:.8;white-space:nowrap}.fsrow__dot{flex:none;width:6px;height:6px;margin-left:2px;border-radius:50%;background:var(--accent)}.fsrow__act{flex:none;display:none;place-items:center;width:20px;height:20px;border-radius:6px;color:var(--muted);font-size:11px;line-height:1}.fsrow:hover .fsrow__act{display:grid}.fsrow__act:hover{background:var(--surface-3);color:var(--text)}.fsrow__act:focus-visible{display:grid}@media(hover:none){.fsrow__act{display:grid}}.fsrow--search{gap:6px;width:100%;color:inherit;font:inherit;text-align:left;padding-right:8px}.fsrow--search:hover{background:var(--surface-2)}.fsrow__path{flex:1;min-width:0;margin-left:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:11.5px}.fsrow--draft{gap:6px}.rename--file{flex:1;min-width:0;height:21px;padding:0 6px;font-size:13px}.fsrow__pending{margin:0;padding:2px 0 2px calc(8px + var(--depth) * 13px + 21px);color:var(--muted);font-size:12px}.searchgroup__path{margin:10px 0 0;padding:3px 10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text-2);font-size:12px;font-weight:600}.searchgroup__path:first-child{margin-top:0}.searchmatch{display:flex;width:100%;align-items:baseline;gap:10px;padding:3px 10px 3px 14px;border:none;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}.searchmatch:hover{background:var(--surface-2)}.searchmatch__line{flex:none;min-width:2ch;color:var(--muted);font-family:var(--mono);font-size:11.5px;text-align:right}.searchmatch__text{flex:1;min-width:0;overflow:hidden;color:var(--text-2);font-family:var(--mono);font-size:12.5px;white-space:pre;text-overflow:ellipsis}.searchmatch__text mark{background:var(--accent-soft);color:var(--text);border-radius:3px}.worktabs{display:flex;flex:none;align-items:stretch;gap:2px;padding:4px 8px 0;overflow-x:auto;background:var(--bg);border-bottom:1px solid var(--border)}.worktabs__spacer{flex:1;min-width:8px}.worktabs__zoom{flex:none;align-self:center;display:grid;place-items:center;width:26px;height:26px;margin:0 2px;border-radius:7px;color:var(--muted)}.worktabs__zoom:hover{background:var(--surface-2);color:var(--text)}.worktabs__zoom svg{width:15px;height:15px}.worktab{display:flex;align-items:center;gap:5px;flex:none;max-width:220px;padding:0 8px 0 10px;height:30px;border:1px solid transparent;border-bottom:none;border-radius:8px 8px 0 0;color:var(--muted);font-size:12.5px}.worktab:hover{background:var(--surface-2);color:var(--text-2)}.worktab.is-on{background:var(--surface);border-color:var(--border);color:var(--text);margin-bottom:-1px;padding-bottom:1px}.worktab__name{min-width:0;padding:0;color:inherit;font:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.worktab__close{flex:none;display:grid;place-items:center;width:17px;height:17px;border-radius:5px;color:var(--muted);font-size:10px;line-height:1}.worktab__close:hover{background:var(--surface-3);color:var(--text)}.worktab__dot{flex:none;width:7px;height:7px;margin:0 5px;border-radius:50%;background:var(--accent);padding:0}.worktab__dot--busy{background:var(--ok);cursor:default;animation:badge-pulse 2s ease-in-out infinite}.editor{display:flex;flex-direction:column;flex:1;min-height:0;background:var(--bg)}.editor__bar{display:flex;align-items:center;gap:10px;flex:none;padding:7px 14px;border-bottom:1px solid var(--border-soft)}.editor__path{min-width:0;flex:1;font-family:var(--mono);font-size:12px;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;direction:rtl;text-align:left}.editor__meta{flex:none;font-family:var(--mono);font-size:11.5px;color:var(--muted)}.editor__warn{display:flex;align-items:center;gap:10px;flex-wrap:wrap;flex:none;padding:8px 14px;background:var(--warn-soft);border-bottom:1px solid var(--warn-line);color:var(--warn);font-size:12.5px}.editor__code{flex:1;min-height:0;overflow:hidden}.editor__code-surface{width:100%;height:100%}.editor__code-surface.is-hidden{display:none}.editor__state{display:grid;justify-items:center;align-content:center;gap:10px;height:100%;color:var(--muted);font-size:13.5px}.editor__fallback{display:flex;flex-direction:column;height:100%;min-height:0}.editor__fallback-banner{display:flex;align-items:center;gap:10px;flex-wrap:wrap;flex:none;padding:8px 14px;background:var(--danger-soft);border-bottom:1px solid color-mix(in srgb,var(--danger) 40%,transparent);color:var(--danger);font-size:12.5px}.editor__fallback-text{flex:1;min-height:0;margin:0;padding:14px;overflow:auto;font-family:var(--mono);font-size:12.5px;line-height:1.6;color:var(--text-2);white-space:pre-wrap;word-break:break-word}.editor__empty{margin:0;padding:28px 20px;color:var(--muted);font-size:13.5px;line-height:1.6}.editor__viewtoggle{display:flex;flex:none;gap:2px;padding:2px;background:var(--surface-2);border-radius:var(--radius)}.editor__viewtoggle .btn{border:none;background:transparent;color:var(--muted)}.editor__viewtoggle .btn:hover{background:var(--surface-3);color:var(--text-2)}.editor__viewtoggle .btn.is-on{background:var(--surface);color:var(--text);box-shadow:var(--shadow-sm)}.markdown-preview{flex:1;min-height:0;overflow:auto;padding:28px 32px;font-family:var(--serif);font-size:15px;line-height:1.65;color:var(--text)}.markdown-preview>:first-child{margin-top:0}.markdown-preview h1,.markdown-preview h2,.markdown-preview h3,.markdown-preview h4,.markdown-preview h5,.markdown-preview h6{font-family:var(--sans);font-weight:600;line-height:1.3;margin:1.4em 0 .5em}.markdown-preview h1{font-size:1.6em;border-bottom:1px solid var(--border-soft);padding-bottom:.3em}.markdown-preview h2{font-size:1.3em}.markdown-preview h3{font-size:1.1em}.markdown-preview p,.markdown-preview ul,.markdown-preview ol,.markdown-preview blockquote{margin:.8em 0}.markdown-preview ul,.markdown-preview ol{padding-left:1.6em}.markdown-preview li+li{margin-top:.3em}.markdown-preview a{color:var(--accent)}.markdown-preview blockquote{border-left:3px solid var(--border);padding-left:1em;color:var(--text-2)}.markdown-preview code{font-family:var(--mono);font-size:.87em;background:var(--surface-2);padding:.15em .4em;border-radius:4px}.markdown-preview pre{background:var(--surface-2);padding:12px 14px;border-radius:var(--radius);overflow:auto}.markdown-preview pre code{background:none;padding:0}.markdown-preview pre code .cmh-key{color:var(--cm-key)}.markdown-preview pre code .cmh-prop{color:var(--cm-prop)}.markdown-preview pre code .cmh-fn{color:var(--cm-fn)}.markdown-preview pre code .cmh-const{color:var(--cm-const)}.markdown-preview pre code .cmh-type{color:var(--cm-type)}.markdown-preview pre code .cmh-num{color:var(--cm-num)}.markdown-preview pre code .cmh-str{color:var(--cm-str)}.markdown-preview pre code .cmh-op{color:var(--cm-op)}.markdown-preview pre code .cmh-comment{color:var(--cm-comment);font-style:italic}.markdown-preview pre code .cmh-invalid{color:var(--danger)}.markdown-preview table{border-collapse:collapse;width:100%;font-size:.92em}.markdown-preview th,.markdown-preview td{border:1px solid var(--border-soft);padding:6px 10px;text-align:left}.markdown-preview th{background:var(--surface-2)}.markdown-preview img{max-width:100%}.markdown-preview hr{border:none;border-top:1px solid var(--border-soft);margin:1.6em 0}.mediaview{position:relative;display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden;background:var(--bg)}.mediaview--message{display:grid;justify-items:center;align-content:center;gap:12px;height:100%;padding:24px;text-align:center}.mediaview__progress{width:220px;height:3px;border-radius:2px;background:var(--surface-3);overflow:hidden}.mediaview__progress-fill{height:100%;width:35%;border-radius:2px;background:var(--accent);animation:mediaview-progress 1.3s ease-in-out infinite}@keyframes mediaview-progress{0%{transform:translate(-100%)}to{transform:translate(385%)}}.mediaview__label{color:var(--muted);font-size:13px}.mediaview__error{max-width:42ch;margin:0;color:var(--text-2);font-size:13.5px;line-height:1.6}.mediaview--image .mediaview__stage{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;overflow:hidden;touch-action:none}.mediaview--image .mediaview__stage.is-zoomed{cursor:grab}.mediaview--image .mediaview__stage.is-dragging{cursor:grabbing}.mediaview__image{max-width:100%;max-height:100%;-webkit-user-select:none;user-select:none;will-change:transform}.mediaview__toolbar{position:absolute;left:50%;bottom:16px;transform:translate(-50%);display:flex;align-items:center;gap:2px;padding:3px;background:var(--surface);border:1px solid var(--border-soft);border-radius:var(--radius);box-shadow:var(--shadow-sm)}.mediaview__toolbar .btn{border:none;background:transparent;color:var(--muted);padding:5px 8px}.mediaview__toolbar .btn:hover{background:var(--surface-2);color:var(--text-2)}.mediaview__toolbar .btn svg{width:15px;height:15px;display:block}.mediaview__zoomlabel{min-width:3.6ch;padding:0 2px;text-align:center;font-family:var(--mono);font-size:11.5px;color:var(--muted);font-variant-numeric:tabular-nums}.mediaview--video{align-items:center;justify-content:center;gap:12px;padding:20px}.mediaview__video{max-width:100%;max-height:calc(100% - 44px);border-radius:var(--radius);background:#000;box-shadow:var(--shadow-sm)}.mediaview__speedbar{display:flex;flex:none;align-items:center;gap:8px}.mediaview__speedlabel{font-size:12px;color:var(--muted)}.mediaview__speedselect .select__trigger{max-width:none}.gitbar{display:flex;align-items:center;gap:6px;flex:none;padding:10px 12px;border-bottom:1px solid var(--border-soft)}.gitbar__branch{flex:1;min-width:0}.gitbar__branch .select__trigger{width:100%;max-width:none}.gitbar__branch .select__menu{left:0;right:auto;min-width:100%}.gitbar__note{margin:0;padding:8px 14px;background:var(--warn-soft);border-bottom:1px solid var(--border-soft);color:var(--warn);font-size:12px;line-height:1.45}.gitbar__actions{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:8px 12px;border-bottom:1px solid var(--border-soft)}.gitbar__group{display:inline-flex;gap:3px}.gitbar__check{padding-left:7px;padding-right:7px}.gitbar__check svg{width:13px;height:13px}.gitbar__actions svg{width:13px;height:13px;flex:none}.gitbar__count{padding:0 5px;border-radius:999px;background:var(--accent-soft);color:var(--accent);font-size:11px;font-variant-numeric:tabular-nums}.btn--primary .gitbar__count{background:#ffffff38;color:inherit}.gitbar__busy{display:flex;align-items:center;gap:7px;margin:0;color:var(--muted);font-size:12.5px}.gitbar__busy svg{animation:meters-spin .8s linear infinite}.gitrow{display:flex;align-items:center;gap:2px;width:100%;height:50px;padding:0 10px 0 0;text-align:left}.gitrow:hover{background:var(--surface-2)}.gitrow.is-on{background:var(--surface-2);box-shadow:inset 2px 0 0 var(--accent)}.gitrow--work{height:46px;padding-left:14px;border-bottom:1px solid var(--border-soft);margin-bottom:4px}.gitrow__body{min-width:0;flex:1;display:flex;flex-direction:column;gap:1px}.gitrow__subject{display:block;font-size:13px;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gitrow.is-on .gitrow__subject{color:var(--text)}.gitrow__meta{display:block;font-family:var(--mono);font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gitrow__ref{display:inline-block;margin-right:5px;padding:0 5px;border:1px solid var(--accent-line);border-radius:999px;background:var(--accent-soft);color:var(--accent);font-family:var(--mono);font-size:10.5px;vertical-align:1px}.gitgraph{flex:none}.gitgraph line,.gitgraph path{stroke-width:1.6;fill:none}.gitgraph__dot{fill:var(--sidebar);stroke-width:2}.gitrow:hover .gitgraph__dot{fill:var(--surface-2)}.gitgraph__head{fill:none;stroke:var(--accent);stroke-width:1.4;opacity:.65}.gitrow__local{margin-left:5px;color:var(--warn)}.commit__head{padding-bottom:12px;margin-bottom:12px;border-bottom:1px solid var(--border-soft)}.commit__subject{margin:0 0 6px;font-size:15px;font-weight:560;overflow-wrap:anywhere}.commit__meta{margin:0;font-size:12px;color:var(--muted);overflow-wrap:anywhere}.commit__hash{font-family:var(--mono);font-size:11.5px}.commit__meta--local{margin-top:4px;color:var(--warn)}.commit__body{margin:10px 0 0;padding:9px 11px;border-radius:9px;background:var(--surface-2);font-family:var(--mono);font-size:12px;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--text-2)}.commit__file{margin-bottom:8px}.commit__filehead{display:flex;align-items:center;gap:10px;width:100%;padding:7px 10px;border:1px solid var(--border);border-radius:8px;background:var(--surface-2);font-family:var(--mono);font-size:12px;text-align:left}.commit__filehead:hover{background:var(--surface-3)}.commit__filepath{min-width:0;flex:1;color:var(--text-2);overflow-wrap:anywhere}.commit__file .diff{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.commit__file .diff__head{display:none}.publish__section{margin-top:20px;padding-top:18px;border-top:1px solid var(--border-soft)}.publish__section--first{margin-top:0;padding-top:0;border-top:none}.publish__heading{margin:0 0 10px;font-size:13px;font-weight:650;color:var(--text)}.publish__field{margin-top:10px}.publish__static{margin:0;padding:9px 12px;background:var(--surface-2);border-radius:9px;font-family:var(--mono);font-size:13px;color:var(--text-2)}.publish__account{display:flex;align-items:center;flex-wrap:wrap;gap:9px}.publish__accountvia{font-size:12.5px;color:var(--muted)}.publish__connect .modal__text{margin-bottom:10px}.publish__tokenhint{margin:8px 0 0;font-size:12px;line-height:1.5;color:var(--muted)}.publish__tokenhint code{font-family:var(--mono);font-size:.95em}.publish__tokenhint a{color:var(--accent)}.publish__filehead{display:flex;align-items:center;gap:8px;margin-bottom:8px}.publish__filecount{flex:1;font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums}.publish__filter{margin-bottom:8px;font-size:12.5px}.publish__filelist{max-height:240px;overflow-y:auto;border:1px solid var(--border-soft);border-radius:9px}.publish__file{display:flex;align-items:center;gap:9px;width:100%;padding:6px 10px;text-align:left;font-family:var(--mono);font-size:12px;color:var(--text-2)}.publish__file:hover{background:var(--surface-2)}.publish__file+.publish__file{border-top:1px solid var(--border-soft)}.publish__box{flex:none;display:grid;place-items:center;width:15px;height:15px;border:1.5px solid var(--border);border-radius:4px;font-size:10px;color:var(--accent-fg);transition:background .12s ease,border-color .12s ease}.publish__box.is-on{background:var(--accent);border-color:var(--accent)}.publish__filepath{min-width:0;overflow-wrap:anywhere}.publish__filesempty{margin:0;padding:10px}.publish__truncated{margin:8px 0 0;font-size:12px;color:var(--warn)}.pwfield{position:relative}.pwfield__input{padding-right:34px}.pwfield__input::-ms-reveal,.pwfield__input::-ms-clear{display:none}.pwfield__toggle{position:absolute;right:4px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:26px;height:26px;border-radius:6px;color:var(--muted)}.pwfield__toggle svg{width:15px;height:15px}.pwfield__toggle:hover{background:var(--surface-2);color:var(--text)}.pwfield__toggle[aria-pressed=true]{color:var(--accent)}.scrim{display:none}@media(max-width:860px){.app{grid-template-columns:1fr}.sidebar,.main,.sidepane{grid-column:1}.pane-resizer{display:none}.sidepane--open{position:fixed;top:0;bottom:0;width:min(var(--ask-w),calc(100vw - 44px));z-index:30;box-shadow:var(--shadow-lg)}.sidepane--open.sidepane--git,.sidepane--open.sidepane--files,.sidepane--open.sidepane--search{left:0;width:min(var(--git-w),calc(100vw - 44px))}.sidepane--open.sidepane--ask{right:0}.scrim--pane{display:block}.sidebar{position:fixed;inset:0 auto 0 0;width:var(--sidebar-w);z-index:30;transform:translate(-100%);transition:transform .18s ease;box-shadow:var(--shadow-lg)}.sidebar--open{transform:none}.scrim{display:block;position:fixed;top:0;right:0;bottom:0;left:0;background:#1f1e1d6b;z-index:20}.menu-btn{display:grid;place-items:center;width:40px;height:40px;padding:0}.pane-btn{width:40px;height:40px}.pane-btn svg{width:18px;height:18px}.topbar{gap:6px}.topbar__id{flex:1 1 100%;flex-direction:row;align-items:center;gap:10px}.topbar__head,.topbar__title{flex:1 1 auto;min-width:0}.msg--user{max-width:92%}.transcript{padding:16px 12px 4px}.composer{padding:6px 12px calc(10px + env(safe-area-inset-bottom))}.composer .sendbtn{width:32px;height:32px;padding:0;justify-content:center;border-radius:999px}.sendbtn__label{display:none}.sendbtn__icon{display:block;width:16px;height:16px}.composer--side .sendbtn{width:28px;height:28px}.composer--side .sendbtn__icon{width:14px;height:14px}.worktabs{padding:4px 6px 0}.worktab{max-width:150px}.editor__bar{padding:6px 10px}.editor__path{font-size:11.5px}}@media(max-width:380px){.menu-btn,.pane-btn{width:36px;height:36px}.pane-btn svg{width:16px;height:16px}.topbar{gap:4px}}.term-resizer{flex:none;display:flex;align-items:center;justify-content:center;position:relative;z-index:5;height:9px;margin:-4px 0;cursor:row-resize;touch-action:none}.term-resizer__line{width:100%;height:2px;margin:0 10px;border-radius:2px;background:transparent;transition:background .12s ease}.term-resizer:hover .term-resizer__line,.term-resizer:active .term-resizer__line,.term-resizer:focus-visible .term-resizer__line{background:var(--accent)}.term-resizer:focus-visible{outline:none}body.is-resizing-row{cursor:row-resize;-webkit-user-select:none;user-select:none}.termpanel{display:flex;flex-direction:column;flex:none;min-height:0;background:var(--surface);border-top:1px solid var(--border)}.termpanel--mobile{position:fixed;inset:0 0 auto 0;z-index:35;border-top:none;overscroll-behavior:none;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}.termpanel--zoomed{position:fixed;top:0;right:0;bottom:0;left:0;z-index:32;border-top:none}.termpanel__tabbar{display:flex;align-items:stretch;flex:none;gap:2px;padding:4px 6px;background:var(--bg);border-bottom:1px solid var(--border)}.termpanel--mobile .termpanel__tabbar{touch-action:pan-x}.termpanel__tabs{display:flex;align-items:stretch;gap:2px;min-width:0;overflow-x:auto}.termpanel--mobile .termpanel__tabs{touch-action:pan-x}.termtab{display:flex;align-items:center;gap:6px;flex:none;max-width:180px;padding:0 6px 0 11px;height:28px;border-radius:7px;color:var(--muted);font-size:12.5px}.termtab:hover{background:var(--surface-2);color:var(--text-2)}.termtab.is-on{background:var(--surface-3);color:var(--text)}.termtab--exited{opacity:.62}.termtab--exited.is-on{opacity:.85}.termtab__name{min-width:0;padding:0;color:inherit;font:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.termtab__code{flex:none;padding:0 5px;border-radius:999px;background:var(--danger-soft);color:var(--danger);font-family:var(--mono);font-size:10.5px;line-height:16px}.termtab__close{flex:none;display:grid;place-items:center;width:17px;height:17px;border-radius:5px;color:var(--muted);font-size:10px;line-height:1}.termtab__close:hover{background:var(--surface-3);color:var(--text)}.termpanel__add{flex:none;display:grid;place-items:center;width:26px;height:28px;margin-left:2px;border-radius:7px;color:var(--muted);font-size:16px;line-height:1}.termpanel__add:hover:not(:disabled){background:var(--surface-2);color:var(--text)}.termpanel__add:disabled{opacity:.4;cursor:default}.termpanel__spacer{flex:1}.termpanel__zoom,.termpanel__hide{flex:none;display:grid;place-items:center;width:26px;height:28px;border-radius:7px;color:var(--muted);font-size:11px}.termpanel__zoom:hover,.termpanel__hide:hover{background:var(--surface-2);color:var(--text)}.termpanel__zoom svg{width:15px;height:15px}.termpanel--mobile .termpanel__hide{width:44px;height:44px;font-size:15px}.termpanel__body{position:relative;flex:1;min-height:0}.termview{display:none;width:100%;height:100%;padding:4px 0 4px 10px}.termview.is-active{display:block}.termpanel--mobile .xterm-viewport{overscroll-behavior:contain}.termpanel--mobile .termview{touch-action:pinch-zoom}.termview__surface{width:100%;height:100%}.termview__surface.is-hidden{display:none}.termview__state{display:grid;justify-items:center;align-content:center;gap:10px;height:100%;color:var(--muted);font-size:13.5px;text-align:center}.termview__state p{margin:0}.termview__state--error p:first-child{color:var(--text-2);font-weight:550}.termpanel__empty{display:grid;justify-items:center;align-content:center;gap:10px;height:100%;color:var(--muted);font-size:13.5px}.termpanel__empty p{margin:0}.termpanel--mobile .termpanel__empty,.termpanel--mobile .termview__state{touch-action:none}.termpanel__hint{max-width:46ch;text-align:center;font-size:12.5px;line-height:1.5}.termfail{display:flex;flex-direction:column;align-items:center;gap:10px;height:100%;padding:12px 16px;overflow:auto;color:var(--muted);font-size:13.5px;text-align:center}.termfail>:first-child{margin-top:auto}.termfail>:last-child{margin-bottom:auto}.termfail__text{display:grid;gap:6px;max-width:52ch}.termfail__lede{margin:0;color:var(--danger);font-weight:550;line-height:1.45}.termfail__hint{margin:0;font-size:12.5px;line-height:1.5}.termfail__bar{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}.termfail__bar .btn{padding:9px 15px}.termfail__details{font-size:12px}.termfail__details summary{cursor:pointer;color:var(--muted);text-align:center}.termfail__details summary:hover{color:var(--text-2)}.termfail__details pre{margin:6px 0 0;padding:8px 10px;max-height:96px;overflow:auto;border-radius:8px;background:var(--surface-2);color:var(--muted);font-family:var(--mono);font-size:11.5px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere;text-align:left}.termfail--strip{flex-direction:row;align-items:flex-start;gap:10px;height:auto;max-height:40%;padding:8px 10px;border-bottom:1px solid var(--border);background:var(--danger-soft);text-align:left}.termfail--strip>:first-child,.termfail--strip>:last-child{margin:0}.termfail--strip .termfail__text{flex:1;min-width:0;max-width:none}.termfail--strip .termfail__details summary{text-align:left}.termfail--strip .termfail__bar{flex:none}.termpanel--mobile .termfail{touch-action:pan-y}.relay{display:grid;gap:16px}.relay__lede{margin:0;color:var(--text-2);line-height:1.55}.relay__steps{margin:0;padding-left:20px;display:grid;gap:7px;color:var(--text-2);font-size:14px;line-height:1.5}.relay__form{display:grid;gap:14px}.relay__code{font-family:var(--mono);font-size:20px;letter-spacing:.16em;text-align:center;text-transform:uppercase}.relay__facts{margin:0;display:grid;gap:10px;padding:14px 16px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface-2)}.relay__facts>div{display:flex;align-items:center;gap:12px;font-size:14px}.relay__facts dt{color:var(--muted);min-width:96px}.relay__facts dd{margin:0;color:var(--text)}.relay__error{margin:0;padding:10px 12px;border:1px solid var(--danger);border-radius:var(--radius);background:var(--danger-soft);color:var(--danger);font-size:13.5px}.relay__note{margin:0;color:var(--muted);font-size:13px;line-height:1.5}.settings{display:grid;gap:22px}.settings__section{display:grid;gap:10px}.settings__heading{margin:0;font-size:13px;font-weight:600;color:var(--text)}.settings__hint{margin:0;color:var(--muted);font-size:13px;line-height:1.5}.settings__field{display:grid;gap:6px}.settings__field-label{font-size:12.5px;color:var(--text-2)}.settings__select{width:100%}.settings__select .select__trigger{width:100%;max-width:none;justify-content:space-between}.settings__select .select__menu{left:0;right:0;max-width:none}.settings__select-skeleton{display:flex;align-items:center;height:33px;padding:4px 8px 4px 11px;border:1px solid var(--border);border-radius:999px;background:var(--surface);color:var(--muted);font-size:12px;font-family:var(--mono)}.access{display:grid;gap:8px}.access__card{display:flex;align-items:flex-start;gap:11px;width:100%;padding:12px 13px;text-align:left;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);transition:border-color .12s ease,background .12s ease}.access__card:hover:not(:disabled){background:var(--surface-2)}.access__card:disabled{opacity:.55;cursor:default}.access__card.is-on{border-color:var(--accent-line);background:var(--accent-soft)}.access__card--risky{border-color:var(--warn-line)}.access__card--risky.is-on{border-color:var(--warn);background:var(--warn-soft)}.access__radio{position:relative;flex:none;margin-top:2px;width:15px;height:15px;border-radius:50%;border:1.5px solid var(--border);background:var(--surface);transition:border-color .12s ease}.access__card.is-on .access__radio{border-color:var(--accent)}.access__card--risky.is-on .access__radio{border-color:var(--warn)}.access__card.is-on .access__radio:after{content:"";position:absolute;top:3px;right:3px;bottom:3px;left:3px;border-radius:50%;background:var(--accent)}.access__card--risky.is-on .access__radio:after{background:var(--warn)}.access__body{display:grid;gap:3px;min-width:0}.access__title{display:flex;align-items:center;gap:8px;font-size:13.5px;font-weight:560;color:var(--text)}.access__risk{padding:1px 7px;border:1px solid var(--warn-line);border-radius:999px;background:var(--warn-soft);color:var(--warn);font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.02em}.access__desc{font-size:12.5px;line-height:1.45;color:var(--muted)}.settings__switch-row{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.settings__switch-copy{display:grid;gap:4px;min-width:0}.settings__switch-row>.switch,.settings__switch-row>.settings__switch-skeleton{margin-top:3px}.settings__switch-skeleton{flex:none;width:30px;height:17px;border-radius:999px;background:var(--surface-3);opacity:.55}.settings__nested{display:grid;gap:10px;padding-top:10px;border-top:1px dashed var(--border)}.settings__nested-heading{margin:0;font-size:13px;font-weight:600;color:var(--text)}.settings__nested.is-disabled{opacity:.5}
@@ -1,2 +1,2 @@
1
- import{L as M,k as H,l as J,n as ee,o as te,e as ae}from"./index-DKofSKA7.js";import{s as re,t as o}from"./index-DRlKZHMW.js";import{E as ne,L as oe}from"./index-gl1MvN4b.js";import{i as le,e as se}from"./index-Bu_Ukh1_.js";import"./index-BHot-lnj.js";import"./index-891wE-Rj.js";const ie=36,R=1,ce=2,k=3,S=4,fe=5,de=6,Oe=7,me=8,ue=9,he=10,ke=11,Qe=12,ge=13,ve=14,xe=15,be=16,pe=17,q=18,Ce=19,$=20,A=21,L=22,Se=23,Pe=24;function y(t){return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57}function ye(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function h(t,e,r){for(let a=!1;;){if(t.next<0)return;if(t.next==e&&!a){t.advance();return}a=r&&!a&&t.next==92,t.advance()}}function we(t,e){e:for(;;){if(t.next<0)return;if(t.next==36){t.advance();for(let r=0;r<e.length;r++){if(t.next!=e.charCodeAt(r))continue e;t.advance()}if(t.next==36){t.advance();return}}else t.advance()}}function Te(t,e){let r="[{<(".indexOf(String.fromCharCode(e)),a=r<0?e:"]}>)".charCodeAt(r);for(;;){if(t.next<0)return;if(t.next==a&&t.peek(1)==39){t.advance(2);return}t.advance()}}function w(t,e){for(;!(t.next!=95&&!y(t.next));)e!=null&&(e+=String.fromCharCode(t.next)),t.advance();return e}function Ue(t){if(t.next==39||t.next==34||t.next==96){let e=t.next;t.advance(),h(t,e,!1)}else w(t)}function Z(t,e){for(;t.next==48||t.next==49;)t.advance();e&&t.next==e&&t.advance()}function D(t,e){for(;;){if(t.next==46){if(e)break;e=!0}else if(t.next<48||t.next>57)break;t.advance()}if(t.next==69||t.next==101)for(t.advance(),(t.next==43||t.next==45)&&t.advance();t.next>=48&&t.next<=57;)t.advance()}function j(t){for(;!(t.next<0||t.next==10);)t.advance()}function u(t,e){for(let r=0;r<e.length;r++)if(e.charCodeAt(r)==t)return!0;return!1}const P=` \r
1
+ import{L as M,k as H,l as J,n as ee,o as te,e as ae}from"./index-CzPnlrTh.js";import{s as re,t as o}from"./index-DO6gKWcT.js";import{E as ne,L as oe}from"./index-BhTNEiv0.js";import{i as le,e as se}from"./index-CsBX1VvC.js";import"./index-BHot-lnj.js";import"./index-891wE-Rj.js";const ie=36,R=1,ce=2,k=3,S=4,fe=5,de=6,Oe=7,me=8,ue=9,he=10,ke=11,Qe=12,ge=13,ve=14,xe=15,be=16,pe=17,q=18,Ce=19,$=20,A=21,L=22,Se=23,Pe=24;function y(t){return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57}function ye(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function h(t,e,r){for(let a=!1;;){if(t.next<0)return;if(t.next==e&&!a){t.advance();return}a=r&&!a&&t.next==92,t.advance()}}function we(t,e){e:for(;;){if(t.next<0)return;if(t.next==36){t.advance();for(let r=0;r<e.length;r++){if(t.next!=e.charCodeAt(r))continue e;t.advance()}if(t.next==36){t.advance();return}}else t.advance()}}function Te(t,e){let r="[{<(".indexOf(String.fromCharCode(e)),a=r<0?e:"]}>)".charCodeAt(r);for(;;){if(t.next<0)return;if(t.next==a&&t.peek(1)==39){t.advance(2);return}t.advance()}}function w(t,e){for(;!(t.next!=95&&!y(t.next));)e!=null&&(e+=String.fromCharCode(t.next)),t.advance();return e}function Ue(t){if(t.next==39||t.next==34||t.next==96){let e=t.next;t.advance(),h(t,e,!1)}else w(t)}function Z(t,e){for(;t.next==48||t.next==49;)t.advance();e&&t.next==e&&t.advance()}function D(t,e){for(;;){if(t.next==46){if(e)break;e=!0}else if(t.next<48||t.next>57)break;t.advance()}if(t.next==69||t.next==101)for(t.advance(),(t.next==43||t.next==45)&&t.advance();t.next>=48&&t.next<=57;)t.advance()}function j(t){for(;!(t.next<0||t.next==10);)t.advance()}function u(t,e){for(let r=0;r<e.length;r++)if(e.charCodeAt(r)==t)return!0;return!1}const P=` \r
2
2
  `;function V(t,e,r){let a=Object.create(null);a.true=a.false=fe,a.null=a.unknown=de;for(let n of t.split(" "))n&&(a[n]=$);for(let n of e.split(" "))n&&(a[n]=A);for(let n of(r||"").split(" "))n&&(a[n]=Pe);return a}const Be="array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying ",Xe="absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone ",T={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:"*+-%<>!=&|~^/",specialVar:"?",identifierQuotes:'"',caseInsensitiveIdentifiers:!1,words:V(Xe,Be)};function Ie(t,e,r,a){let n={};for(let l in T)n[l]=(t.hasOwnProperty(l)?t:T)[l];return e&&(n.words=V(e,r||"",a)),n}function W(t){return new ne(e=>{var r;let{next:a}=e;if(e.advance(),u(a,P)){for(;u(e.next,P);)e.advance();e.acceptToken(ie)}else if(a==36&&t.doubleDollarQuotedStrings){let n=w(e,"");e.next==36&&(e.advance(),we(e,n),e.acceptToken(k))}else if(a==39||a==34&&t.doubleQuotedStrings)h(e,a,t.backslashEscapes),e.acceptToken(k);else if(a==35&&t.hashComments||a==47&&e.next==47&&t.slashComments)j(e),e.acceptToken(R);else if(a==45&&e.next==45&&(!t.spaceAfterDashes||e.peek(1)==32))j(e),e.acceptToken(R);else if(a==47&&e.next==42){e.advance();for(let n=1;;){let l=e.next;if(e.next<0)break;if(e.advance(),l==42&&e.next==47){if(n--,e.advance(),!n)break}else l==47&&e.next==42&&(n++,e.advance())}e.acceptToken(ce)}else if((a==101||a==69)&&e.next==39)e.advance(),h(e,39,!0),e.acceptToken(k);else if((a==110||a==78)&&e.next==39&&t.charSetCasts)e.advance(),h(e,39,t.backslashEscapes),e.acceptToken(k);else if(a==95&&t.charSetCasts)for(let n=0;;n++){if(e.next==39&&n>1){e.advance(),h(e,39,t.backslashEscapes),e.acceptToken(k);break}if(!y(e.next))break;e.advance()}else if(t.plsqlQuotingMechanism&&(a==113||a==81)&&e.next==39&&e.peek(1)>0&&!u(e.peek(1),P)){let n=e.peek(1);e.advance(2),Te(e,n),e.acceptToken(k)}else if(u(a,t.identifierQuotes)){const n=a==91?93:a;h(e,n,!1),e.acceptToken(Ce)}else if(a==40)e.acceptToken(Oe);else if(a==41)e.acceptToken(me);else if(a==123)e.acceptToken(ue);else if(a==125)e.acceptToken(he);else if(a==91)e.acceptToken(ke);else if(a==93)e.acceptToken(Qe);else if(a==59)e.acceptToken(ge);else if(t.unquotedBitLiterals&&a==48&&e.next==98)e.advance(),Z(e),e.acceptToken(L);else if((a==98||a==66)&&(e.next==39||e.next==34)){const n=e.next;e.advance(),t.treatBitsAsBytes?(h(e,n,t.backslashEscapes),e.acceptToken(Se)):(Z(e,n),e.acceptToken(L))}else if(a==48&&(e.next==120||e.next==88)||(a==120||a==88)&&e.next==39){let n=e.next==39;for(e.advance();ye(e.next);)e.advance();n&&e.next==39&&e.advance(),e.acceptToken(S)}else if(a==46&&e.next>=48&&e.next<=57)D(e,!0),e.acceptToken(S);else if(a==46)e.acceptToken(ve);else if(a>=48&&a<=57)D(e,!1),e.acceptToken(S);else if(u(a,t.operatorChars)){for(;u(e.next,t.operatorChars);)e.advance();e.acceptToken(xe)}else if(u(a,t.specialVar))e.next==a&&e.advance(),Ue(e),e.acceptToken(pe);else if(a==58||a==44)e.acceptToken(be);else if(y(a)){let n=w(e,String.fromCharCode(a));e.acceptToken(e.next==46||e.peek(-n.length-1)==46?q:(r=t.words[n.toLowerCase()])!==null&&r!==void 0?r:q)}})}const F=W(T),_e=oe.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,F],topRules:{Script:[0,25]},tokenPrec:0});function U(t){let e=t.cursor().moveTo(t.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function v(t,e){let r=t.sliceString(e.from,e.to),a=/^([`'"\[])(.*)([`'"\]])$/.exec(r);return a?a[2]:r}function p(t){return t&&(t.name=="Identifier"||t.name=="QuotedIdentifier")}function Re(t,e){if(e.name=="CompositeIdentifier"){let r=[];for(let a=e.firstChild;a;a=a.nextSibling)p(a)&&r.push(v(t,a));return r}return[v(t,e)]}function N(t,e){for(let r=[];;){if(!e||e.name!=".")return r;let a=U(e);if(!p(a))return r;r.unshift(v(t,a)),e=U(a)}}function qe(t,e){let r=ae(t).resolveInner(e,-1),a=Ze(t.doc,r);return r.name=="Identifier"||r.name=="QuotedIdentifier"||r.name=="Keyword"?{from:r.from,quoted:r.name=="QuotedIdentifier"?t.doc.sliceString(r.from,r.from+1):null,parents:N(t.doc,U(r)),aliases:a}:r.name=="."?{from:e,quoted:null,parents:N(t.doc,r),aliases:a}:{from:e,quoted:null,parents:[],empty:!0,aliases:a}}const Le=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function Ze(t,e){let r;for(let n=e;!r;n=n.parent){if(!n)return null;n.name=="Statement"&&(r=n)}let a=null;for(let n=r.firstChild,l=!1,c=null;n;n=n.nextSibling){let i=n.name=="Keyword"?t.sliceString(n.from,n.to).toLowerCase():null,s=null;if(!l)l=i=="from";else if(i=="as"&&c&&p(n.nextSibling))s=v(t,n.nextSibling);else{if(i&&Le.has(i))break;c&&p(n)&&(s=v(t,n))}s&&(a||(a=Object.create(null)),a[s]=Re(t,c)),c=/Identifier$/.test(n.name)?n:null}return a}function De(t,e,r){return r.map(a=>({...a,label:a.label[0]==t?a.label:t+a.label+e,apply:void 0}))}const je=/^\w*$/,Ne=/^[`'"\[]?\w*[`'"\]]?$/;function z(t){return t.self&&typeof t.self.label=="string"}class B{constructor(e,r){this.idQuote=e,this.idCaseInsensitive=r,this.list=[],this.children=void 0}child(e){let r=this.children||(this.children=Object.create(null)),a=r[e];return a||(e&&!this.list.some(n=>n.label==e)&&this.list.push(E(e,"type",this.idQuote,this.idCaseInsensitive)),r[e]=new B(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let r=this.list.findIndex(a=>a.label==e.label);r>-1?this.list[r]=e:this.list.push(e)}addCompletions(e){for(let r of e)this.addCompletion(typeof r=="string"?E(r,"property",this.idQuote,this.idCaseInsensitive):r)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):z(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let r of Object.keys(e)){let a=e[r],n=null,l=r.replace(/\\?\./g,i=>i=="."?"\0":i).split("\0"),c=this;z(a)&&(n=a.self,a=a.children);for(let i=0;i<l.length;i++)n&&i==l.length-1&&c.addCompletion(n),c=c.child(l[i].replace(/\\\./g,"."));c.addNamespace(a)}}}function E(t,e,r,a){return new RegExp("^[a-z_][a-z_\\d]*$",a?"i":"").test(t)?{label:t,type:e}:{label:t,type:e,apply:r+t+K(r)}}function K(t){return t==="["?"]":t}function ze(t,e,r,a,n,l){var c;let i=((c=l==null?void 0:l.spec.identifierQuotes)===null||c===void 0?void 0:c[0])||'"',s=new B(i,!!(l!=null&&l.spec.caseInsensitiveIdentifiers)),d=n?s.child(n):null;return s.addNamespace(t),e&&(d||s).addCompletions(e),r&&s.addCompletions(r),d&&s.addCompletions(d.list),a&&s.addCompletions((d||s).child(a).list),O=>{let{parents:Q,from:I,quoted:_,empty:G,aliases:x}=qe(O.state,O.pos);if(G&&!O.explicit)return null;x&&Q.length==1&&(Q=x[Q[0]]||Q);let f=s;for(let m of Q){for(;!f.children||!f.children[m];)if(f==s&&d)f=d;else if(f==d&&a)f=f.child(a);else return null;let g=f.maybeChild(m);if(!g)return null;f=g}let b=f.list;if(f==s&&x&&(b=b.concat(Object.keys(x).map(m=>({label:m,type:"constant"})))),_){let m=_[0],g=K(m),Y=O.state.sliceDoc(O.pos,O.pos+1)==g;return{from:I,to:Y?O.pos+1:void 0,options:De(m,g,b),validFor:Ne}}else return{from:I,options:b,validFor:je}}}function Ee(t){return t==A?"type":t==$?"keyword":"variable"}function $e(t,e,r){let a=Object.keys(t).map(n=>r(e?n.toUpperCase():n,Ee(t[n])));return le(["QuotedIdentifier","String","LineComment","BlockComment","."],se(a))}let Ae=_e.configure({props:[J.add({Statement:ee()}),te.add({Statement(t,e){return{from:Math.min(t.from+100,e.doc.lineAt(t.from).to),to:t.to}},BlockComment(t){return{from:t.from+2,to:t.to-2}}}),re({Keyword:o.keyword,Type:o.typeName,Builtin:o.standard(o.name),Bits:o.number,Bytes:o.string,Bool:o.bool,Null:o.null,Number:o.number,String:o.string,Identifier:o.name,QuotedIdentifier:o.special(o.string),SpecialVar:o.special(o.name),LineComment:o.lineComment,BlockComment:o.blockComment,Operator:o.operator,"Semi Punctuation":o.punctuation,"( )":o.paren,"{ }":o.brace,"[ ]":o.squareBracket})]});class C{constructor(e,r,a){this.dialect=e,this.language=r,this.spec=a}get extension(){return this.language.extension}configureLanguage(e,r){return new C(this.dialect,this.language.configure(e,r),this.spec)}static define(e){let r=Ie(e,e.keywords,e.types,e.builtin),a=H.define({name:"sql",parser:Ae.configure({tokenizers:[{from:F,to:W(r)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new C(r,a,e)}}function Ve(t,e){return{label:t,type:e,boost:-1}}function We(t,e=!1,r){return $e(t.dialect.words,e,r||Ve)}function Fe(t){return t.schema?ze(t.schema,t.tables,t.schemas,t.defaultTable,t.defaultSchema,t.dialect||X):()=>null}function Ke(t){return t.schema?(t.dialect||X).language.data.of({autocomplete:Fe(t)}):[]}function tt(t={}){let e=t.dialect||X;return new M(e.language,[Ke(t),e.language.data.of({autocomplete:We(e,t.upperCaseKeywords,t.keywordCompletion)})])}const X=C.define({});export{C as SQLDialect,X as StandardSQL,We as keywordCompletionSource,Fe as schemaCompletionSource,tt as sql};