@i14ks/ccv 0.9.5 → 0.11.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 +423 -121
  2. package/package.json +1 -1
  3. package/web/assets/{codemirror-BrML4DhQ.js → codemirror-BVMwXG_R.js} +1 -1
  4. package/web/assets/{index-BmDgU61K.js → index-AByrn5FE.js} +1 -1
  5. package/web/assets/{index-BZMuV7wL.js → index-BCAmULlL.js} +1 -1
  6. package/web/assets/{index-BnX4KThz.js → index-BFLfK-j6.js} +1 -1
  7. package/web/assets/{index-CIOcaugJ.js → index-BZ8Mi5_8.js} +1 -1
  8. package/web/assets/{index-CzJCmwIj.js → index-BlZDoET-.js} +1 -1
  9. package/web/assets/{index-Cg-P0Yp1.js → index-BsH-IJBy.js} +1 -1
  10. package/web/assets/{index-ZQEm-9IM.js → index-Bu_Ukh1_.js} +1 -1
  11. package/web/assets/{index-BMtQHCPD.js → index-C-geC5VJ.js} +1 -1
  12. package/web/assets/{index-B11vIedv.js → index-C1BT9XMC.js} +1 -1
  13. package/web/assets/{index-ZDWxlF_B.js → index-C59fVtiO.js} +1 -1
  14. package/web/assets/{index-MEYLoAjh.js → index-CPWAVXhz.js} +1 -1
  15. package/web/assets/{index-BCuOAg0C.js → index-CrW8SGCA.js} +1 -1
  16. package/web/assets/{index-BMlMiQH4.js → index-DAjl7nVl.js} +1 -1
  17. package/web/assets/{index-BH51XSCv.js → index-DJYXqBtm.js} +1 -1
  18. package/web/assets/{index-DueUeK4W.js → index-DKofSKA7.js} +1 -1
  19. package/web/assets/{index-TS7xklzI.js → index-DLDXVZaf.js} +1 -1
  20. package/web/assets/index-DRlKZHMW.js +132 -0
  21. package/web/assets/{index-kYR8PJFy.js → index-Ey94wZ1k.js} +1 -1
  22. package/web/assets/index-c0zvhlqR.css +1 -0
  23. package/web/assets/{index-MtnHR_Fv.js → index-gl1MvN4b.js} +1 -1
  24. package/web/assets/{index-CJJjf7QW.js → index-mnefozuu.js} +1 -1
  25. package/web/index.html +2 -2
  26. package/web/assets/index-D0UlXcXr.css +0 -1
  27. package/web/assets/index-DhmD70Mu.js +0 -132
@@ -1 +1 @@
1
- import{EditorSelection as h,Text as ke,findClusterBreak as T,StateField as tt,Transaction as K,Facet as Ae,Annotation as Be,combineConfig as nt,StateEffect as Se,ChangeSet as rt,ChangeDesc as ot,countColumn as ee,CharCategory as D}from"./index-BHot-lnj.js";import{E as O,o as lt}from"./index-891wE-Rj.js";import{I as Ce,g as De,c as G,e as te,m as E,h as j,j as st}from"./index-DueUeK4W.js";import{N as Q}from"./index-DhmD70Mu.js";const ct=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=ne(e.state,n.from);return r.line?it(e):r.block?ft(e):!1};function L(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let l=e(t,n);return l?(r(n.update(l)),!0):!1}}const it=L(re,0),An=L(re,1),Bn=L(re,2),ut=L(V,0),Sn=L(V,1),Cn=L(V,2),ft=L((e,t)=>V(e,t,ht(t)),0);function ne(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const v=50;function at(e,{open:t,close:n},r,l){let o=e.sliceDoc(r-v,r),s=e.sliceDoc(l,l+v),c=/\s*$/.exec(o)[0].length,i=/^\s*/.exec(s)[0].length,f=o.length-c;if(o.slice(f-t.length,f)==t&&s.slice(i,i+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:l+i,margin:i&&1}};let u,a;l-r<=2*v?u=a=e.sliceDoc(r,l):(u=e.sliceDoc(r,r+v),a=e.sliceDoc(l-v,l));let d=/^\s*/.exec(u)[0].length,B=/\s*$/.exec(a)[0].length,k=a.length-B-n.length;return u.slice(d,d+t.length)==t&&a.slice(k,k+n.length)==n?{open:{pos:r+d+t.length,margin:/\s/.test(u.charAt(d+t.length))?1:0},close:{pos:l-B-n.length,margin:/\s/.test(a.charAt(k-1))?1:0}}:null}function ht(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),l=n.to<=r.to?r:e.doc.lineAt(n.to);l.from>r.from&&l.from==n.to&&(l=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>r.from?t[o].to=l.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:l.to})}return t}function V(e,t,n=t.selection.ranges){let r=n.map(o=>ne(t,o.from).block);if(!r.every(o=>o))return null;let l=n.map((o,s)=>at(t,r[s],o.from,o.to));if(e!=2&&!l.every(o=>o))return{changes:t.changes(n.map((o,s)=>l[s]?[]:[{from:o.from,insert:r[s].open+" "},{from:o.to,insert:" "+r[s].close}]))};if(e!=1&&l.some(o=>o)){let o=[];for(let s=0,c;s<l.length;s++)if(c=l[s]){let i=r[s],{open:f,close:u}=c;o.push({from:f.pos-i.open.length,to:f.pos+f.margin},{from:u.pos-u.margin,to:u.pos+i.close.length})}return{changes:o}}return null}function re(e,t,n=t.selection.ranges){let r=[],l=-1;e:for(let{from:o,to:s}of n){let c=r.length,i=1e9,f;for(let u=o;u<=s;){let a=t.doc.lineAt(u);if(f==null&&(f=ne(t,a.from).line,!f))continue e;if(a.from>l&&(o==s||s>a.from)){l=a.from;let d=/^\s*/.exec(a.text)[0].length,B=d==a.length,k=a.text.slice(d,d+f.length)==f?d:-1;d<a.text.length&&d<i&&(i=d),r.push({line:a,comment:k,token:f,indent:d,empty:B,single:!1})}u=a.to+1}if(i<1e9)for(let u=c;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=i);r.length==c+1&&(r[c].single=!0)}if(e!=2&&r.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:c,token:i,indent:f,empty:u,single:a}of r)(a||!u)&&o.push({from:c.from+f,insert:i+" "});let s=t.changes(o);return{changes:s,selection:t.selection.map(s,1)}}else if(e!=1&&r.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:c,token:i}of r)if(c>=0){let f=s.from+c,u=f+i.length;s.text[u-s.from]==" "&&u++,o.push({from:f,to:u})}return{changes:o}}return null}const X=Be.define(),dt=Be.define(),mt=Ae.define(),xe=Ae.define({combine(e){return nt(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,l)=>t(r,l)||n(r,l)})}}),N=tt.define({create(){return C.empty},update(e,t){let n=t.state.facet(xe),r=t.annotation(X);if(r){let i=g.fromTransaction(t,r.selection),f=r.side,u=f==0?e.undone:e.done;return i?u=U(u,u.length,n.minDepth,i):u=Ee(u,t.startState.selection),new C(f==0?r.rest:u,f==0?u:r.rest)}let l=t.annotation(dt);if((l=="full"||l=="before")&&(e=e.isolate()),t.annotation(K.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let o=g.fromTransaction(t),s=t.annotation(K.time),c=t.annotation(K.userEvent);return o?e=e.addChanges(o,s,c,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,c,n.newGroupDelay)),(l=="full"||l=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new C(e.done.map(g.fromJSON),e.undone.map(g.fromJSON))}});function Dn(e={}){return[N,xe.of(e),O.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?Le:t.inputType=="historyRedo"?Y:null;return r?(t.preventDefault(),r(n)):!1}})]}const xn=N;function P(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let l=n.field(N,!1);if(!l)return!1;let o=l.pop(e,n,t);return o?(r(o),!0):!1}}const Le=P(0,!1),Y=P(1,!1),pt=P(0,!0),gt=P(1,!0);function Me(e){return function(t){let n=t.field(N,!1);if(!n)return 0;let r=e==0?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}const Ln=Me(0),Mn=Me(1);class g{constructor(t,n,r,l,o){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=l,this.selectionsAfter=o}setSelAfter(t){return new g(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(l=>l.toJSON())}}static fromJSON(t){return new g(t.changes&&rt.fromJSON(t.changes),[],t.mapped&&ot.fromJSON(t.mapped),t.startSelection&&h.fromJSON(t.startSelection),t.selectionsAfter.map(h.fromJSON))}static fromTransaction(t,n){let r=A;for(let l of t.startState.facet(mt)){let o=l(t);o.length&&(r=r.concat(o))}return!r.length&&t.changes.empty?null:new g(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,A)}static selection(t){return new g(void 0,A,void 0,void 0,t)}}function U(e,t,n,r){let l=t+1>n+20?t-n-1:0,o=e.slice(l,t);return o.push(r),o}function yt(e,t){let n=[],r=!1;return e.iterChangedRanges((l,o)=>n.push(l,o)),t.iterChangedRanges((l,o,s,c)=>{for(let i=0;i<n.length;){let f=n[i++],u=n[i++];c>=f&&s<=u&&(r=!0)}}),r}function kt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function be(e,t){return e.length?t.length?e.concat(t):e:t}const A=[],At=200;function Ee(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-At));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),U(e,e.length-1,1e9,n.setSelAfter(r)))}else return[g.selection([t])]}function Bt(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function $(e,t){if(!e.length)return e;let n=e.length,r=A;for(;n;){let l=St(e[n-1],t,r);if(l.changes&&!l.changes.empty||l.effects.length){let o=e.slice(0,n);return o[n-1]=l,o}else t=l.mapped,n--,r=l.selectionsAfter}return r.length?[g.selection(r)]:A}function St(e,t,n){let r=be(e.selectionsAfter.length?e.selectionsAfter.map(c=>c.map(t)):A,n);if(!e.changes)return g.selection(r);let l=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new g(l,Se.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}const Ct=/^(input\.type|delete)($|\.)/;class C{constructor(t,n,r=0,l=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=l}isolate(){return this.prevTime?new C(this.done,this.undone):this}addChanges(t,n,r,l,o){let s=this.done,c=s[s.length-1];return c&&c.changes&&!c.changes.empty&&t.changes&&(!r||Ct.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime<l.newGroupDelay&&l.joinToEvent(o,yt(c.changes,t.changes))||r=="input.type.compose")?s=U(s,s.length-1,l.minDepth,new g(t.changes.compose(c.changes),be(Se.mapEffects(t.effects,c.changes),c.effects),c.mapped,c.startSelection,A)):s=U(s,s.length,l.minDepth,t),new C(s,A,n,r)}addSelection(t,n,r,l){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:A;return o.length>0&&n-this.prevTime<l&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&kt(o[o.length-1],t)?this:new C(Ee(this.done,t),this.undone,n,r)}addMapping(t){return new C($(this.done,t),$(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let l=t==0?this.done:this.undone;if(l.length==0)return null;let o=l[l.length-1],s=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):n.selection);if(r&&o.selectionsAfter.length)return n.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:X.of({side:t,rest:Bt(l),selection:s}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let c=l.length==1?A:l.slice(0,l.length-1);return o.mapped&&(c=$(c,o.mapped)),n.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:X.of({side:t,rest:c,selection:s}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}C.empty=new C(A,A);const bn=[{key:"Mod-z",run:Le,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Y,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Y,preventDefault:!0},{key:"Mod-u",run:pt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:gt,preventDefault:!0}];function I(e,t){return h.create(e.ranges.map(t),e.mainIndex)}function S(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function y({state:e,dispatch:t},n){let r=I(e.selection,n);return r.eq(e.selection,!0)?!1:(t(S(e,r)),!0)}function M(e,t){return h.cursor(t?e.to:e.from)}function J(e,t){return y(e,n=>n.empty?e.moveByChar(n,t):M(n,t))}function m(e){return e.textDirectionAt(e.state.selection.main.head)==lt.LTR}const Te=e=>J(e,!m(e)),Oe=e=>J(e,m(e)),En=e=>J(e,!0),Tn=e=>J(e,!1);function oe(e,t,n){let r=t.head,l=e.doc.lineAt(r);return r==(n?l.to:l.from)?r=n?Math.min(e.doc.length,l.to+1):Math.max(0,l.from-1):r=l.from+T(l.text,r-l.from,n),h.cursor(r,n?-1:1)}function Ie(e,t){return y(e,n=>n.empty?oe(e.state,n,t):M(n,t))}const On=e=>Ie(e,!0),In=e=>Ie(e,!1);function w(e,t){return y(e,n=>n.empty?e.moveByGroup(n,t):M(n,t))}const Dt=e=>w(e,!m(e)),xt=e=>w(e,m(e)),vn=e=>w(e,!0),Rn=e=>w(e,!1);function le(e,t,n){let r=e.state.charCategorizer(t),l=r(n),o=l!=D.Space;return s=>{let c=r(s);return c!=D.Space?o&&c==l:(o=!1,!0)}}const Fn=e=>y(e,t=>t.empty?e.moveByChar(t,!0,n=>le(e,t.head,n)):M(t,!0)),ue=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function ve(e,t,n){let r=e.state.charCategorizer(t.from),l=D.Space,o=t.from,s=0,c=!1,i=!1,f=!1,u=d=>{if(c)return!1;o+=n?d.length:-d.length;let B=r(d),k;if(B==D.Word&&d.charCodeAt(0)<128&&/[\W_]/.test(d)&&(B=-1),l==D.Space&&(l=B),l!=B)return!1;if(l==D.Word)if(d.toLowerCase()==d){if(!n&&i)return!1;f=!0}else if(f){if(n)return!1;c=!0}else{if(i&&n&&r(k=e.state.sliceDoc(o,o+1))==D.Word&&k.toLowerCase()==k)return!1;i=!0}return s++,!0},a=e.moveByChar(t,n,d=>(u(d),u));if(ue&&l==D.Word&&a.from==t.from+s*(n?1:-1)){let d=Math.min(t.head,a.head),B=Math.max(t.head,a.head),k=e.state.sliceDoc(d,B);if(k.length>1&&/[\u4E00-\uffff]/.test(k)){let R=Array.from(ue.segment(k));if(R.length>1)return n?h.cursor(t.head+R[1].index,-1):h.cursor(a.head+R[R.length-1].index,1)}}return a}function Re(e,t){return y(e,n=>n.empty?ve(e,n,t):M(n,t))}const Gn=e=>Re(e,!0),Un=e=>Re(e,!1);function Lt(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function z(e,t,n){let r=te(e).resolveInner(t.head),l=n?Q.closedBy:Q.openedBy;for(let i=t.head;;){let f=n?r.childAfter(i):r.childBefore(i);if(!f)break;Lt(e,f,l)?r=f:i=n?f.to:f.from}let o=r.type.prop(l),s,c;return o&&(s=n?E(e,r.from,1):E(e,r.to,-1))&&s.matched?c=n?s.end.to:s.end.from:c=n?r.to:r.from,h.cursor(c,n?-1:1)}const Mt=e=>y(e,t=>z(e.state,t,!m(e))),bt=e=>y(e,t=>z(e.state,t,m(e)));function Fe(e,t){return y(e,n=>{if(!n.empty)return M(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Ge=e=>Fe(e,!1),Ue=e=>Fe(e,!0);function Ve(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,l;if(t){for(let o of e.state.facet(O.scrollMargins)){let s=o(e);s!=null&&s.top&&(n=Math.max(s==null?void 0:s.top,n)),s!=null&&s.bottom&&(r=Math.max(s==null?void 0:s.bottom,r))}l=e.scrollDOM.clientHeight-n-r}else l=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,l-5)}}function Ne(e,t){let n=Ve(e),{state:r}=e,l=I(r.selection,s=>s.empty?e.moveVertically(s,t,n.height):M(s,t));if(l.eq(r.selection))return!1;let o;if(n.selfScroll){let s=e.coordsAtPos(r.selection.main.head),c=e.scrollDOM.getBoundingClientRect(),i=c.top+n.marginTop,f=c.bottom-n.marginBottom;s&&s.top>i&&s.bottom<f&&(o=O.scrollIntoView(l.main.head,{y:"start",yMargin:s.top-i}))}return e.dispatch(S(r,l),{effects:o}),!0}const fe=e=>Ne(e,!1),Z=e=>Ne(e,!0);function x(e,t,n){let r=e.lineBlockAt(t.head),l=e.moveToLineBoundary(t,n);if(l.head==t.head&&l.head!=(n?r.to:r.from)&&(l=e.moveToLineBoundary(t,n,!1)),!n&&l.head==r.from&&r.length){let o=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;o&&t.head!=r.from+o&&(l=h.cursor(r.from+o))}return l}const Et=e=>y(e,t=>x(e,t,!0)),Tt=e=>y(e,t=>x(e,t,!1)),Ot=e=>y(e,t=>x(e,t,!m(e))),It=e=>y(e,t=>x(e,t,m(e))),vt=e=>y(e,t=>h.cursor(e.lineBlockAt(t.head).from,1)),Rt=e=>y(e,t=>h.cursor(e.lineBlockAt(t.head).to,-1));function Pe(e,t,n){let r=!1,l=I(e.selection,o=>{let s=E(e,o.head,-1)||E(e,o.head,1)||o.head>0&&E(e,o.head-1,1)||o.head<e.doc.length&&E(e,o.head+1,-1);if(!s||!s.end)return o;r=!0;let c=s.start.from==o.head?s.end.to:s.end.from;return n?h.range(o.anchor,c):h.cursor(c)});return r?(t(S(e,l)),!0):!1}const Ft=({state:e,dispatch:t})=>Pe(e,t,!1),Vn=({state:e,dispatch:t})=>Pe(e,t,!0);function p(e,t,n){let r=I(e.state.selection,l=>{l.undirectional&&l.head>=l.anchor!=t&&(l=h.range(l.head,l.anchor));let o=n(l);return h.range(l.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(S(e.state,r)),!0)}function W(e,t){return p(e,t,n=>e.moveByChar(n,t))}const Je=e=>W(e,!m(e)),we=e=>W(e,m(e)),Nn=e=>W(e,!0),Pn=e=>W(e,!1),Jn=e=>p(e,!0,t=>oe(e.state,t,!0)),wn=e=>p(e,!1,t=>oe(e.state,t,!1));function H(e,t){return p(e,t,n=>e.moveByGroup(n,t))}const Gt=e=>H(e,!m(e)),Ut=e=>H(e,m(e)),zn=e=>H(e,!0),Wn=e=>H(e,!1),Hn=e=>p(e,!0,t=>e.moveByChar(t,!0,n=>le(e,t.head,n)));function ze(e,t){return p(e,t,n=>ve(e,n,t))}const qn=e=>ze(e,!0),Kn=e=>ze(e,!1),Vt=e=>{let t=!m(e);return p(e,t,n=>z(e.state,n,t))},Nt=e=>{let t=m(e);return p(e,t,n=>z(e.state,n,t))};function We(e,t){return p(e,t,n=>e.moveVertically(n,t))}const He=e=>We(e,!1),qe=e=>We(e,!0);function Ke(e,t){return p(e,t,n=>e.moveVertically(n,t,Ve(e).height))}const ae=e=>Ke(e,!1),he=e=>Ke(e,!0),Pt=e=>p(e,!0,t=>x(e,t,!0)),Jt=e=>p(e,!1,t=>x(e,t,!1)),wt=e=>{let t=!m(e);return p(e,t,n=>x(e,n,t))},zt=e=>{let t=m(e);return p(e,t,n=>x(e,n,t))},Wt=e=>p(e,!1,t=>h.cursor(e.lineBlockAt(t.head).from)),Ht=e=>p(e,!0,t=>h.cursor(e.lineBlockAt(t.head).to)),de=({state:e,dispatch:t})=>(t(S(e,{anchor:0})),!0),me=({state:e,dispatch:t})=>(t(S(e,{anchor:e.doc.length})),!0),pe=({state:e,dispatch:t})=>(t(S(e,{anchor:e.selection.main.anchor,head:0})),!0),ge=({state:e,dispatch:t})=>(t(S(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),qt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Kt=({state:e,dispatch:t})=>{let n=q(e).map(({from:r,to:l})=>h.range(r,Math.min(l+1,e.doc.length)));return t(e.update({selection:h.create(n),userEvent:"select"})),!0},$t=({state:e,dispatch:t})=>{let n=I(e.selection,r=>{let l=te(e),o=l.resolveStack(r.from,1);if(r.empty){let s=l.resolveStack(r.from,-1);s.node.from>=o.node.from&&s.node.to<=o.node.to&&(o=s)}for(let s=o;s;s=s.next){let{node:c}=s;if((c.from<r.from&&c.to>=r.to||c.to>r.to&&c.from<=r.from)&&s.next)return h.range(c.to,c.from)}return r});return n.eq(e.selection)?!1:(t(S(e,n)),!0)};function $e(e,t){let{state:n}=e,r=n.selection,l=n.selection.ranges.slice();for(let o of n.selection.ranges){let s=n.doc.lineAt(o.head);if(t?s.to<e.state.doc.length:s.from>0)for(let c=o;;){let i=e.moveVertically(c,t);if(i.head<s.from||i.head>s.to){l.some(f=>f.head==i.head)||l.push(i);break}else{if(i.head==c.head)break;c=i}}}return l.length==r.ranges.length?!1:(e.dispatch(S(n,h.create(l,l.length-1))),!0)}const jt=e=>$e(e,!1),Qt=e=>$e(e,!0),Xt=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=h.create([n.main]):n.main.empty||(r=h.create([h.cursor(n.main.head)])),r?(t(S(e,r)),!0):!1};function b(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,l=r.changeByRange(o=>{let{from:s,to:c}=o;if(s==c){let i=t(o);i<s?(n="delete.backward",i=F(e,i,!1)):i>s&&(n="delete.forward",i=F(e,i,!0)),s=Math.min(s,i),c=Math.max(c,i)}else s=F(e,s,!1),c=F(e,c,!0);return s==c?{range:o}:{changes:{from:s,to:c},range:h.cursor(s,s<o.head?-1:1)}});return l.changes.empty?!1:(e.dispatch(r.update(l,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?O.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function F(e,t,n){if(e instanceof O)for(let r of e.state.facet(O.atomicRanges).map(l=>l(e)))r.between(t,t,(l,o)=>{l<t&&o>t&&(t=n?o:l)});return t}const se=(e,t,n)=>b(e,r=>{let l=r.from,{state:o}=e,s=o.doc.lineAt(l),c,i;if(n&&!t&&l>s.from&&l<s.from+200&&!/[^ \t]/.test(c=s.text.slice(0,l-s.from))){if(c[c.length-1]==" ")return l-1;let f=ee(c,o.tabSize),u=f%j(o)||j(o);for(let a=0;a<u&&c[c.length-1-a]==" ";a++)l--;i=l}else i=T(s.text,l-s.from,t,t)+s.from,i==l&&s.number!=(t?o.doc.lines:1)?i+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(i-s.from,l-s.from))&&(i=T(s.text,i-s.from,!1,!1)+s.from);return i}),_=e=>se(e,!1,!0),$n=e=>se(e,!1,!1),je=e=>se(e,!0,!1),Qe=(e,t)=>b(e,n=>{let r=n.head,{state:l}=e,o=l.doc.lineAt(r),s=l.charCategorizer(r);for(let c=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?l.doc.lines:1)&&(r+=t?1:-1);break}let i=T(o.text,r-o.from,t)+o.from,f=o.text.slice(Math.min(r,i)-o.from,Math.max(r,i)-o.from),u=s(f);if(c!=null&&u!=c)break;(f!=" "||r!=n.head)&&(c=u),r=i}return r}),Xe=e=>Qe(e,!1),Yt=e=>Qe(e,!0),jn=e=>b(e,t=>e.moveByChar(t,!0,n=>le(e,t.head,n)).head),Zt=e=>b(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Qn=e=>b(e,t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)}),_t=e=>b(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),en=e=>b(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Xn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let r=0,l="",o=e.doc.iter();;){if(o.next(),o.lineBreak||o.done){let s=l.search(/\s+$/);if(s>-1&&n.push({from:r-(l.length-s),to:r}),o.done)break;l=""}else l=o.value;r+=o.value.length}return n.length?(t(e.update({changes:n,userEvent:"delete"})),!0):!1},tn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:ke.of(["",""])},range:h.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},nn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let l=r.from,o=e.doc.lineAt(l),s=l==o.from?l-1:T(o.text,l-o.from,!1)+o.from,c=l==o.to?l+1:T(o.text,l-o.from,!0)+o.from;return{changes:{from:s,to:c,insert:e.doc.slice(l,c).append(e.doc.slice(s,l))},range:h.cursor(c)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function q(e){let t=[],n=-1;for(let r of e.selection.ranges){let l=e.doc.lineAt(r.from),o=e.doc.lineAt(r.to);if(!r.empty&&r.to==o.from&&(o=e.doc.lineAt(r.to-1)),n>=l.number){let s=t[t.length-1];s.to=o.to,s.ranges.push(r)}else t.push({from:l.from,to:o.to,ranges:[r]});n=o.number+1}return t}function Ye(e,t,n){if(e.readOnly)return!1;let r=[],l=[];for(let o of q(e)){if(n?o.to==e.doc.length:o.from==0)continue;let s=e.doc.lineAt(n?o.to+1:o.from-1),c=s.length+1;if(n){r.push({from:o.to,to:s.to},{from:o.from,insert:s.text+e.lineBreak});for(let i of o.ranges)l.push(h.range(Math.min(e.doc.length,i.anchor+c),Math.min(e.doc.length,i.head+c)))}else{r.push({from:s.from,to:o.from},{from:o.to,insert:e.lineBreak+s.text});for(let i of o.ranges)l.push(h.range(i.anchor-c,i.head-c))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:h.create(l,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const rn=({state:e,dispatch:t})=>Ye(e,t,!1),on=({state:e,dispatch:t})=>Ye(e,t,!0);function Ze(e,t,n){if(e.readOnly)return!1;let r=[];for(let o of q(e))n?r.push({from:o.from,insert:e.doc.slice(o.from,o.to)+e.lineBreak}):r.push({from:o.to,insert:e.lineBreak+e.doc.slice(o.from,o.to)});let l=e.changes(r);return t(e.update({changes:l,selection:e.selection.map(l,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const ln=({state:e,dispatch:t})=>Ze(e,t,!1),sn=({state:e,dispatch:t})=>Ze(e,t,!0),cn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(q(t).map(({from:l,to:o})=>(l>0?l--:o<t.doc.length&&o++,{from:l,to:o}))),r=I(t.selection,l=>{let o;if(e.lineWrapping){let s=e.lineBlockAt(l.head),c=e.coordsAtPos(l.head,l.assoc||1);c&&(o=s.bottom+e.documentTop-c.bottom+e.defaultLineHeight/2)}return e.moveVertically(l,!0,o)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0},Yn=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),Zn=({state:e,dispatch:t})=>(t(e.update(e.changeByRange(n=>{let r=/^\s*/.exec(e.doc.lineAt(n.from).text)[0];return{changes:{from:n.from,to:n.to,insert:e.lineBreak+r},range:h.cursor(n.from+r.length+1)}}),{scrollIntoView:!0,userEvent:"input"})),!0);function un(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=te(e).resolveInner(t),r=n.childBefore(t),l=n.childAfter(t),o;return r&&l&&r.to<=t&&l.from>=t&&(o=r.type.prop(Q.closedBy))&&o.indexOf(l.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(l.from).from&&!/\S/.test(e.sliceDoc(r.to,l.from))?{from:r.to,to:l.from}:null}const ye=_e(!1),fn=_e(!0);function _e(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(l=>{let{from:o,to:s}=l,c=t.doc.lineAt(o),i=!e&&o==s&&un(t,o);e&&(o=s=(s<=c.to?c:t.doc.lineAt(s)).to);let f=new Ce(t,{simulateBreak:o,simulateDoubleBreak:!!i}),u=De(f,o);for(u==null&&(u=ee(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));s<c.to&&/\s/.test(c.text[s-c.from]);)s++;i?{from:o,to:s}=i:o>c.from&&o<c.from+100&&!/\S/.test(c.text.slice(0,o))&&(o=c.from);let a=["",G(t,u)];return i&&a.push(G(t,f.lineIndent(c.from,-1))),{changes:{from:o,to:s,insert:ke.of(a)},range:h.cursor(o+1+a[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function ce(e,t){let n=-1;return e.changeByRange(r=>{let l=[];for(let s=r.from;s<=r.to;){let c=e.doc.lineAt(s);c.number>n&&(r.empty||r.to>c.from)&&(t(c,l,r),n=c.number),s=c.to+1}let o=e.changes(l);return{changes:l,range:h.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}const an=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Ce(e,{overrideIndentation:o=>{let s=n[o];return s??-1}}),l=ce(e,(o,s,c)=>{let i=De(r,o.from);if(i==null)return;/\S/.test(o.text)||(i=0);let f=/^\s*/.exec(o.text)[0],u=G(e,i);(f!=u||c.from<o.from+f.length)&&(n[o.from]=i,s.push({from:o.from,to:o.from+f.length,insert:u}))});return l.changes.empty||t(e.update(l,{userEvent:"indent"})),!0},ie=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(ce(e,(n,r)=>{r.push({from:n.from,insert:e.facet(st)})}),{userEvent:"input.indent"})),!0),et=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(ce(e,(n,r)=>{let l=/^\s*/.exec(n.text)[0];if(!l)return;let o=ee(l,e.tabSize),s=0,c=G(e,Math.max(0,o-j(e)));for(;s<l.length&&s<c.length&&l.charCodeAt(s)==c.charCodeAt(s);)s++;r.push({from:n.from+s,to:n.from+l.length,insert:c.slice(s)})}),{userEvent:"delete.dedent"})),!0),hn=e=>(e.setTabFocusMode(),!0),_n=e=>(e.setTabFocusMode(2e3),!0),er=({state:e,dispatch:t})=>e.selection.ranges.some(n=>!n.empty)?ie({state:e,dispatch:t}):(t(e.update(e.replaceSelection(" "),{scrollIntoView:!0,userEvent:"input"})),!0),dn=[{key:"Ctrl-b",run:Te,shift:Je,preventDefault:!0},{key:"Ctrl-f",run:Oe,shift:we},{key:"Ctrl-p",run:Ge,shift:He},{key:"Ctrl-n",run:Ue,shift:qe},{key:"Ctrl-a",run:vt,shift:Wt},{key:"Ctrl-e",run:Rt,shift:Ht},{key:"Ctrl-d",run:je},{key:"Ctrl-h",run:_},{key:"Ctrl-k",run:Zt},{key:"Ctrl-Alt-h",run:Xe},{key:"Ctrl-o",run:tn},{key:"Ctrl-t",run:nn},{key:"Ctrl-v",run:Z}],mn=[{key:"ArrowLeft",run:Te,shift:Je,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Dt,shift:Gt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Ot,shift:wt,preventDefault:!0},{key:"ArrowRight",run:Oe,shift:we,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:xt,shift:Ut,preventDefault:!0},{mac:"Cmd-ArrowRight",run:It,shift:zt,preventDefault:!0},{key:"ArrowUp",run:Ge,shift:He,preventDefault:!0},{mac:"Cmd-ArrowUp",run:de,shift:pe},{mac:"Ctrl-ArrowUp",run:fe,shift:ae},{key:"ArrowDown",run:Ue,shift:qe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:me,shift:ge},{mac:"Ctrl-ArrowDown",run:Z,shift:he},{key:"PageUp",run:fe,shift:ae},{key:"PageDown",run:Z,shift:he},{key:"Home",run:Tt,shift:Jt,preventDefault:!0},{key:"Mod-Home",run:de,shift:pe},{key:"End",run:Et,shift:Pt,preventDefault:!0},{key:"Mod-End",run:me,shift:ge},{key:"Enter",run:ye,shift:ye},{key:"Mod-a",run:qt},{key:"Backspace",run:_,shift:_,preventDefault:!0},{key:"Delete",run:je,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Xe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Yt,preventDefault:!0},{mac:"Mod-Backspace",run:_t,preventDefault:!0},{mac:"Mod-Delete",run:en,preventDefault:!0}].concat(dn.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),tr=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Mt,shift:Vt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:bt,shift:Nt},{key:"Alt-ArrowUp",run:rn},{key:"Shift-Alt-ArrowUp",run:ln},{key:"Alt-ArrowDown",run:on},{key:"Shift-Alt-ArrowDown",run:sn},{key:"Mod-Alt-ArrowUp",run:jt},{key:"Mod-Alt-ArrowDown",run:Qt},{key:"Escape",run:Xt},{key:"Mod-Enter",run:fn},{key:"Alt-l",mac:"Ctrl-l",run:Kt},{key:"Mod-i",run:$t,preventDefault:!0},{key:"Mod-[",run:et},{key:"Mod-]",run:ie},{key:"Mod-Alt-\\",run:an},{key:"Shift-Mod-k",run:cn},{key:"Shift-Mod-\\",run:Ft},{key:"Mod-/",run:ct},{key:"Alt-A",run:ut},{key:"Ctrl-m",mac:"Shift-Alt-m",run:hn}].concat(mn),nr={key:"Tab",run:ie,shift:et};export{jt as addCursorAbove,Qt as addCursorBelow,Sn as blockComment,Cn as blockUncomment,sn as copyLineDown,ln as copyLineUp,Tn as cursorCharBackward,In as cursorCharBackwardLogical,En as cursorCharForward,On as cursorCharForwardLogical,Te as cursorCharLeft,Oe as cursorCharRight,me as cursorDocEnd,de as cursorDocStart,Rn as cursorGroupBackward,vn as cursorGroupForward,Fn as cursorGroupForwardWin,Dt as cursorGroupLeft,xt as cursorGroupRight,Tt as cursorLineBoundaryBackward,Et as cursorLineBoundaryForward,Ot as cursorLineBoundaryLeft,It as cursorLineBoundaryRight,Ue as cursorLineDown,Rt as cursorLineEnd,vt as cursorLineStart,Ge as cursorLineUp,Ft as cursorMatchingBracket,Z as cursorPageDown,fe as cursorPageUp,Un as cursorSubwordBackward,Gn as cursorSubwordForward,Mt as cursorSyntaxLeft,bt as cursorSyntaxRight,tr as defaultKeymap,_ as deleteCharBackward,$n as deleteCharBackwardStrict,je as deleteCharForward,Xe as deleteGroupBackward,Yt as deleteGroupForward,jn as deleteGroupForwardWin,cn as deleteLine,_t as deleteLineBoundaryBackward,en as deleteLineBoundaryForward,Zt as deleteToLineEnd,Qn as deleteToLineStart,Xn as deleteTrailingWhitespace,dn as emacsStyleKeymap,Dn as history,xn as historyField,bn as historyKeymap,et as indentLess,ie as indentMore,an as indentSelection,nr as indentWithTab,fn as insertBlankLine,Yn as insertNewline,ye as insertNewlineAndIndent,Zn as insertNewlineKeepIndent,er as insertTab,mt as invertedEffects,dt as isolateHistory,An as lineComment,Bn as lineUncomment,on as moveLineDown,rn as moveLineUp,Y as redo,Mn as redoDepth,gt as redoSelection,qt as selectAll,Pn as selectCharBackward,wn as selectCharBackwardLogical,Nn as selectCharForward,Jn as selectCharForwardLogical,Je as selectCharLeft,we as selectCharRight,ge as selectDocEnd,pe as selectDocStart,Wn as selectGroupBackward,zn as selectGroupForward,Hn as selectGroupForwardWin,Gt as selectGroupLeft,Ut as selectGroupRight,Kt as selectLine,Jt as selectLineBoundaryBackward,Pt as selectLineBoundaryForward,wt as selectLineBoundaryLeft,zt as selectLineBoundaryRight,qe as selectLineDown,Ht as selectLineEnd,Wt as selectLineStart,He as selectLineUp,Vn as selectMatchingBracket,he as selectPageDown,ae as selectPageUp,$t as selectParentSyntax,Kn as selectSubwordBackward,qn as selectSubwordForward,Vt as selectSyntaxLeft,Nt as selectSyntaxRight,Xt as simplifySelection,tn as splitLine,mn as standardKeymap,_n as temporarilySetTabFocusMode,ut as toggleBlockComment,ft as toggleBlockCommentByLine,ct as toggleComment,it as toggleLineComment,hn as toggleTabFocusMode,nn as transposeChars,Le as undo,Ln as undoDepth,pt as undoSelection};
1
+ import{EditorSelection as h,Text as ke,findClusterBreak as T,StateField as tt,Transaction as K,Facet as Ae,Annotation as Be,combineConfig as nt,StateEffect as Se,ChangeSet as rt,ChangeDesc as ot,countColumn as ee,CharCategory as D}from"./index-BHot-lnj.js";import{E as O,o as lt}from"./index-891wE-Rj.js";import{I as Ce,g as De,c as G,e as te,m as E,h as j,j as st}from"./index-DKofSKA7.js";import{N as Q}from"./index-DRlKZHMW.js";const ct=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=ne(e.state,n.from);return r.line?it(e):r.block?ft(e):!1};function L(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let l=e(t,n);return l?(r(n.update(l)),!0):!1}}const it=L(re,0),An=L(re,1),Bn=L(re,2),ut=L(V,0),Sn=L(V,1),Cn=L(V,2),ft=L((e,t)=>V(e,t,ht(t)),0);function ne(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const v=50;function at(e,{open:t,close:n},r,l){let o=e.sliceDoc(r-v,r),s=e.sliceDoc(l,l+v),c=/\s*$/.exec(o)[0].length,i=/^\s*/.exec(s)[0].length,f=o.length-c;if(o.slice(f-t.length,f)==t&&s.slice(i,i+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:l+i,margin:i&&1}};let u,a;l-r<=2*v?u=a=e.sliceDoc(r,l):(u=e.sliceDoc(r,r+v),a=e.sliceDoc(l-v,l));let d=/^\s*/.exec(u)[0].length,B=/\s*$/.exec(a)[0].length,k=a.length-B-n.length;return u.slice(d,d+t.length)==t&&a.slice(k,k+n.length)==n?{open:{pos:r+d+t.length,margin:/\s/.test(u.charAt(d+t.length))?1:0},close:{pos:l-B-n.length,margin:/\s/.test(a.charAt(k-1))?1:0}}:null}function ht(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),l=n.to<=r.to?r:e.doc.lineAt(n.to);l.from>r.from&&l.from==n.to&&(l=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>r.from?t[o].to=l.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:l.to})}return t}function V(e,t,n=t.selection.ranges){let r=n.map(o=>ne(t,o.from).block);if(!r.every(o=>o))return null;let l=n.map((o,s)=>at(t,r[s],o.from,o.to));if(e!=2&&!l.every(o=>o))return{changes:t.changes(n.map((o,s)=>l[s]?[]:[{from:o.from,insert:r[s].open+" "},{from:o.to,insert:" "+r[s].close}]))};if(e!=1&&l.some(o=>o)){let o=[];for(let s=0,c;s<l.length;s++)if(c=l[s]){let i=r[s],{open:f,close:u}=c;o.push({from:f.pos-i.open.length,to:f.pos+f.margin},{from:u.pos-u.margin,to:u.pos+i.close.length})}return{changes:o}}return null}function re(e,t,n=t.selection.ranges){let r=[],l=-1;e:for(let{from:o,to:s}of n){let c=r.length,i=1e9,f;for(let u=o;u<=s;){let a=t.doc.lineAt(u);if(f==null&&(f=ne(t,a.from).line,!f))continue e;if(a.from>l&&(o==s||s>a.from)){l=a.from;let d=/^\s*/.exec(a.text)[0].length,B=d==a.length,k=a.text.slice(d,d+f.length)==f?d:-1;d<a.text.length&&d<i&&(i=d),r.push({line:a,comment:k,token:f,indent:d,empty:B,single:!1})}u=a.to+1}if(i<1e9)for(let u=c;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=i);r.length==c+1&&(r[c].single=!0)}if(e!=2&&r.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:c,token:i,indent:f,empty:u,single:a}of r)(a||!u)&&o.push({from:c.from+f,insert:i+" "});let s=t.changes(o);return{changes:s,selection:t.selection.map(s,1)}}else if(e!=1&&r.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:c,token:i}of r)if(c>=0){let f=s.from+c,u=f+i.length;s.text[u-s.from]==" "&&u++,o.push({from:f,to:u})}return{changes:o}}return null}const X=Be.define(),dt=Be.define(),mt=Ae.define(),xe=Ae.define({combine(e){return nt(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,l)=>t(r,l)||n(r,l)})}}),N=tt.define({create(){return C.empty},update(e,t){let n=t.state.facet(xe),r=t.annotation(X);if(r){let i=g.fromTransaction(t,r.selection),f=r.side,u=f==0?e.undone:e.done;return i?u=U(u,u.length,n.minDepth,i):u=Ee(u,t.startState.selection),new C(f==0?r.rest:u,f==0?u:r.rest)}let l=t.annotation(dt);if((l=="full"||l=="before")&&(e=e.isolate()),t.annotation(K.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let o=g.fromTransaction(t),s=t.annotation(K.time),c=t.annotation(K.userEvent);return o?e=e.addChanges(o,s,c,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,c,n.newGroupDelay)),(l=="full"||l=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new C(e.done.map(g.fromJSON),e.undone.map(g.fromJSON))}});function Dn(e={}){return[N,xe.of(e),O.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?Le:t.inputType=="historyRedo"?Y:null;return r?(t.preventDefault(),r(n)):!1}})]}const xn=N;function P(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let l=n.field(N,!1);if(!l)return!1;let o=l.pop(e,n,t);return o?(r(o),!0):!1}}const Le=P(0,!1),Y=P(1,!1),pt=P(0,!0),gt=P(1,!0);function Me(e){return function(t){let n=t.field(N,!1);if(!n)return 0;let r=e==0?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}const Ln=Me(0),Mn=Me(1);class g{constructor(t,n,r,l,o){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=l,this.selectionsAfter=o}setSelAfter(t){return new g(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(l=>l.toJSON())}}static fromJSON(t){return new g(t.changes&&rt.fromJSON(t.changes),[],t.mapped&&ot.fromJSON(t.mapped),t.startSelection&&h.fromJSON(t.startSelection),t.selectionsAfter.map(h.fromJSON))}static fromTransaction(t,n){let r=A;for(let l of t.startState.facet(mt)){let o=l(t);o.length&&(r=r.concat(o))}return!r.length&&t.changes.empty?null:new g(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,A)}static selection(t){return new g(void 0,A,void 0,void 0,t)}}function U(e,t,n,r){let l=t+1>n+20?t-n-1:0,o=e.slice(l,t);return o.push(r),o}function yt(e,t){let n=[],r=!1;return e.iterChangedRanges((l,o)=>n.push(l,o)),t.iterChangedRanges((l,o,s,c)=>{for(let i=0;i<n.length;){let f=n[i++],u=n[i++];c>=f&&s<=u&&(r=!0)}}),r}function kt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function be(e,t){return e.length?t.length?e.concat(t):e:t}const A=[],At=200;function Ee(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-At));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),U(e,e.length-1,1e9,n.setSelAfter(r)))}else return[g.selection([t])]}function Bt(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function $(e,t){if(!e.length)return e;let n=e.length,r=A;for(;n;){let l=St(e[n-1],t,r);if(l.changes&&!l.changes.empty||l.effects.length){let o=e.slice(0,n);return o[n-1]=l,o}else t=l.mapped,n--,r=l.selectionsAfter}return r.length?[g.selection(r)]:A}function St(e,t,n){let r=be(e.selectionsAfter.length?e.selectionsAfter.map(c=>c.map(t)):A,n);if(!e.changes)return g.selection(r);let l=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new g(l,Se.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}const Ct=/^(input\.type|delete)($|\.)/;class C{constructor(t,n,r=0,l=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=l}isolate(){return this.prevTime?new C(this.done,this.undone):this}addChanges(t,n,r,l,o){let s=this.done,c=s[s.length-1];return c&&c.changes&&!c.changes.empty&&t.changes&&(!r||Ct.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime<l.newGroupDelay&&l.joinToEvent(o,yt(c.changes,t.changes))||r=="input.type.compose")?s=U(s,s.length-1,l.minDepth,new g(t.changes.compose(c.changes),be(Se.mapEffects(t.effects,c.changes),c.effects),c.mapped,c.startSelection,A)):s=U(s,s.length,l.minDepth,t),new C(s,A,n,r)}addSelection(t,n,r,l){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:A;return o.length>0&&n-this.prevTime<l&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&kt(o[o.length-1],t)?this:new C(Ee(this.done,t),this.undone,n,r)}addMapping(t){return new C($(this.done,t),$(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let l=t==0?this.done:this.undone;if(l.length==0)return null;let o=l[l.length-1],s=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):n.selection);if(r&&o.selectionsAfter.length)return n.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:X.of({side:t,rest:Bt(l),selection:s}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let c=l.length==1?A:l.slice(0,l.length-1);return o.mapped&&(c=$(c,o.mapped)),n.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:X.of({side:t,rest:c,selection:s}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}C.empty=new C(A,A);const bn=[{key:"Mod-z",run:Le,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Y,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Y,preventDefault:!0},{key:"Mod-u",run:pt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:gt,preventDefault:!0}];function I(e,t){return h.create(e.ranges.map(t),e.mainIndex)}function S(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function y({state:e,dispatch:t},n){let r=I(e.selection,n);return r.eq(e.selection,!0)?!1:(t(S(e,r)),!0)}function M(e,t){return h.cursor(t?e.to:e.from)}function J(e,t){return y(e,n=>n.empty?e.moveByChar(n,t):M(n,t))}function m(e){return e.textDirectionAt(e.state.selection.main.head)==lt.LTR}const Te=e=>J(e,!m(e)),Oe=e=>J(e,m(e)),En=e=>J(e,!0),Tn=e=>J(e,!1);function oe(e,t,n){let r=t.head,l=e.doc.lineAt(r);return r==(n?l.to:l.from)?r=n?Math.min(e.doc.length,l.to+1):Math.max(0,l.from-1):r=l.from+T(l.text,r-l.from,n),h.cursor(r,n?-1:1)}function Ie(e,t){return y(e,n=>n.empty?oe(e.state,n,t):M(n,t))}const On=e=>Ie(e,!0),In=e=>Ie(e,!1);function w(e,t){return y(e,n=>n.empty?e.moveByGroup(n,t):M(n,t))}const Dt=e=>w(e,!m(e)),xt=e=>w(e,m(e)),vn=e=>w(e,!0),Rn=e=>w(e,!1);function le(e,t,n){let r=e.state.charCategorizer(t),l=r(n),o=l!=D.Space;return s=>{let c=r(s);return c!=D.Space?o&&c==l:(o=!1,!0)}}const Fn=e=>y(e,t=>t.empty?e.moveByChar(t,!0,n=>le(e,t.head,n)):M(t,!0)),ue=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function ve(e,t,n){let r=e.state.charCategorizer(t.from),l=D.Space,o=t.from,s=0,c=!1,i=!1,f=!1,u=d=>{if(c)return!1;o+=n?d.length:-d.length;let B=r(d),k;if(B==D.Word&&d.charCodeAt(0)<128&&/[\W_]/.test(d)&&(B=-1),l==D.Space&&(l=B),l!=B)return!1;if(l==D.Word)if(d.toLowerCase()==d){if(!n&&i)return!1;f=!0}else if(f){if(n)return!1;c=!0}else{if(i&&n&&r(k=e.state.sliceDoc(o,o+1))==D.Word&&k.toLowerCase()==k)return!1;i=!0}return s++,!0},a=e.moveByChar(t,n,d=>(u(d),u));if(ue&&l==D.Word&&a.from==t.from+s*(n?1:-1)){let d=Math.min(t.head,a.head),B=Math.max(t.head,a.head),k=e.state.sliceDoc(d,B);if(k.length>1&&/[\u4E00-\uffff]/.test(k)){let R=Array.from(ue.segment(k));if(R.length>1)return n?h.cursor(t.head+R[1].index,-1):h.cursor(a.head+R[R.length-1].index,1)}}return a}function Re(e,t){return y(e,n=>n.empty?ve(e,n,t):M(n,t))}const Gn=e=>Re(e,!0),Un=e=>Re(e,!1);function Lt(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function z(e,t,n){let r=te(e).resolveInner(t.head),l=n?Q.closedBy:Q.openedBy;for(let i=t.head;;){let f=n?r.childAfter(i):r.childBefore(i);if(!f)break;Lt(e,f,l)?r=f:i=n?f.to:f.from}let o=r.type.prop(l),s,c;return o&&(s=n?E(e,r.from,1):E(e,r.to,-1))&&s.matched?c=n?s.end.to:s.end.from:c=n?r.to:r.from,h.cursor(c,n?-1:1)}const Mt=e=>y(e,t=>z(e.state,t,!m(e))),bt=e=>y(e,t=>z(e.state,t,m(e)));function Fe(e,t){return y(e,n=>{if(!n.empty)return M(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Ge=e=>Fe(e,!1),Ue=e=>Fe(e,!0);function Ve(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,l;if(t){for(let o of e.state.facet(O.scrollMargins)){let s=o(e);s!=null&&s.top&&(n=Math.max(s==null?void 0:s.top,n)),s!=null&&s.bottom&&(r=Math.max(s==null?void 0:s.bottom,r))}l=e.scrollDOM.clientHeight-n-r}else l=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,l-5)}}function Ne(e,t){let n=Ve(e),{state:r}=e,l=I(r.selection,s=>s.empty?e.moveVertically(s,t,n.height):M(s,t));if(l.eq(r.selection))return!1;let o;if(n.selfScroll){let s=e.coordsAtPos(r.selection.main.head),c=e.scrollDOM.getBoundingClientRect(),i=c.top+n.marginTop,f=c.bottom-n.marginBottom;s&&s.top>i&&s.bottom<f&&(o=O.scrollIntoView(l.main.head,{y:"start",yMargin:s.top-i}))}return e.dispatch(S(r,l),{effects:o}),!0}const fe=e=>Ne(e,!1),Z=e=>Ne(e,!0);function x(e,t,n){let r=e.lineBlockAt(t.head),l=e.moveToLineBoundary(t,n);if(l.head==t.head&&l.head!=(n?r.to:r.from)&&(l=e.moveToLineBoundary(t,n,!1)),!n&&l.head==r.from&&r.length){let o=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;o&&t.head!=r.from+o&&(l=h.cursor(r.from+o))}return l}const Et=e=>y(e,t=>x(e,t,!0)),Tt=e=>y(e,t=>x(e,t,!1)),Ot=e=>y(e,t=>x(e,t,!m(e))),It=e=>y(e,t=>x(e,t,m(e))),vt=e=>y(e,t=>h.cursor(e.lineBlockAt(t.head).from,1)),Rt=e=>y(e,t=>h.cursor(e.lineBlockAt(t.head).to,-1));function Pe(e,t,n){let r=!1,l=I(e.selection,o=>{let s=E(e,o.head,-1)||E(e,o.head,1)||o.head>0&&E(e,o.head-1,1)||o.head<e.doc.length&&E(e,o.head+1,-1);if(!s||!s.end)return o;r=!0;let c=s.start.from==o.head?s.end.to:s.end.from;return n?h.range(o.anchor,c):h.cursor(c)});return r?(t(S(e,l)),!0):!1}const Ft=({state:e,dispatch:t})=>Pe(e,t,!1),Vn=({state:e,dispatch:t})=>Pe(e,t,!0);function p(e,t,n){let r=I(e.state.selection,l=>{l.undirectional&&l.head>=l.anchor!=t&&(l=h.range(l.head,l.anchor));let o=n(l);return h.range(l.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(S(e.state,r)),!0)}function W(e,t){return p(e,t,n=>e.moveByChar(n,t))}const Je=e=>W(e,!m(e)),we=e=>W(e,m(e)),Nn=e=>W(e,!0),Pn=e=>W(e,!1),Jn=e=>p(e,!0,t=>oe(e.state,t,!0)),wn=e=>p(e,!1,t=>oe(e.state,t,!1));function H(e,t){return p(e,t,n=>e.moveByGroup(n,t))}const Gt=e=>H(e,!m(e)),Ut=e=>H(e,m(e)),zn=e=>H(e,!0),Wn=e=>H(e,!1),Hn=e=>p(e,!0,t=>e.moveByChar(t,!0,n=>le(e,t.head,n)));function ze(e,t){return p(e,t,n=>ve(e,n,t))}const qn=e=>ze(e,!0),Kn=e=>ze(e,!1),Vt=e=>{let t=!m(e);return p(e,t,n=>z(e.state,n,t))},Nt=e=>{let t=m(e);return p(e,t,n=>z(e.state,n,t))};function We(e,t){return p(e,t,n=>e.moveVertically(n,t))}const He=e=>We(e,!1),qe=e=>We(e,!0);function Ke(e,t){return p(e,t,n=>e.moveVertically(n,t,Ve(e).height))}const ae=e=>Ke(e,!1),he=e=>Ke(e,!0),Pt=e=>p(e,!0,t=>x(e,t,!0)),Jt=e=>p(e,!1,t=>x(e,t,!1)),wt=e=>{let t=!m(e);return p(e,t,n=>x(e,n,t))},zt=e=>{let t=m(e);return p(e,t,n=>x(e,n,t))},Wt=e=>p(e,!1,t=>h.cursor(e.lineBlockAt(t.head).from)),Ht=e=>p(e,!0,t=>h.cursor(e.lineBlockAt(t.head).to)),de=({state:e,dispatch:t})=>(t(S(e,{anchor:0})),!0),me=({state:e,dispatch:t})=>(t(S(e,{anchor:e.doc.length})),!0),pe=({state:e,dispatch:t})=>(t(S(e,{anchor:e.selection.main.anchor,head:0})),!0),ge=({state:e,dispatch:t})=>(t(S(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),qt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Kt=({state:e,dispatch:t})=>{let n=q(e).map(({from:r,to:l})=>h.range(r,Math.min(l+1,e.doc.length)));return t(e.update({selection:h.create(n),userEvent:"select"})),!0},$t=({state:e,dispatch:t})=>{let n=I(e.selection,r=>{let l=te(e),o=l.resolveStack(r.from,1);if(r.empty){let s=l.resolveStack(r.from,-1);s.node.from>=o.node.from&&s.node.to<=o.node.to&&(o=s)}for(let s=o;s;s=s.next){let{node:c}=s;if((c.from<r.from&&c.to>=r.to||c.to>r.to&&c.from<=r.from)&&s.next)return h.range(c.to,c.from)}return r});return n.eq(e.selection)?!1:(t(S(e,n)),!0)};function $e(e,t){let{state:n}=e,r=n.selection,l=n.selection.ranges.slice();for(let o of n.selection.ranges){let s=n.doc.lineAt(o.head);if(t?s.to<e.state.doc.length:s.from>0)for(let c=o;;){let i=e.moveVertically(c,t);if(i.head<s.from||i.head>s.to){l.some(f=>f.head==i.head)||l.push(i);break}else{if(i.head==c.head)break;c=i}}}return l.length==r.ranges.length?!1:(e.dispatch(S(n,h.create(l,l.length-1))),!0)}const jt=e=>$e(e,!1),Qt=e=>$e(e,!0),Xt=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=h.create([n.main]):n.main.empty||(r=h.create([h.cursor(n.main.head)])),r?(t(S(e,r)),!0):!1};function b(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,l=r.changeByRange(o=>{let{from:s,to:c}=o;if(s==c){let i=t(o);i<s?(n="delete.backward",i=F(e,i,!1)):i>s&&(n="delete.forward",i=F(e,i,!0)),s=Math.min(s,i),c=Math.max(c,i)}else s=F(e,s,!1),c=F(e,c,!0);return s==c?{range:o}:{changes:{from:s,to:c},range:h.cursor(s,s<o.head?-1:1)}});return l.changes.empty?!1:(e.dispatch(r.update(l,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?O.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function F(e,t,n){if(e instanceof O)for(let r of e.state.facet(O.atomicRanges).map(l=>l(e)))r.between(t,t,(l,o)=>{l<t&&o>t&&(t=n?o:l)});return t}const se=(e,t,n)=>b(e,r=>{let l=r.from,{state:o}=e,s=o.doc.lineAt(l),c,i;if(n&&!t&&l>s.from&&l<s.from+200&&!/[^ \t]/.test(c=s.text.slice(0,l-s.from))){if(c[c.length-1]==" ")return l-1;let f=ee(c,o.tabSize),u=f%j(o)||j(o);for(let a=0;a<u&&c[c.length-1-a]==" ";a++)l--;i=l}else i=T(s.text,l-s.from,t,t)+s.from,i==l&&s.number!=(t?o.doc.lines:1)?i+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(i-s.from,l-s.from))&&(i=T(s.text,i-s.from,!1,!1)+s.from);return i}),_=e=>se(e,!1,!0),$n=e=>se(e,!1,!1),je=e=>se(e,!0,!1),Qe=(e,t)=>b(e,n=>{let r=n.head,{state:l}=e,o=l.doc.lineAt(r),s=l.charCategorizer(r);for(let c=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?l.doc.lines:1)&&(r+=t?1:-1);break}let i=T(o.text,r-o.from,t)+o.from,f=o.text.slice(Math.min(r,i)-o.from,Math.max(r,i)-o.from),u=s(f);if(c!=null&&u!=c)break;(f!=" "||r!=n.head)&&(c=u),r=i}return r}),Xe=e=>Qe(e,!1),Yt=e=>Qe(e,!0),jn=e=>b(e,t=>e.moveByChar(t,!0,n=>le(e,t.head,n)).head),Zt=e=>b(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Qn=e=>b(e,t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)}),_t=e=>b(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),en=e=>b(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Xn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let r=0,l="",o=e.doc.iter();;){if(o.next(),o.lineBreak||o.done){let s=l.search(/\s+$/);if(s>-1&&n.push({from:r-(l.length-s),to:r}),o.done)break;l=""}else l=o.value;r+=o.value.length}return n.length?(t(e.update({changes:n,userEvent:"delete"})),!0):!1},tn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:ke.of(["",""])},range:h.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},nn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let l=r.from,o=e.doc.lineAt(l),s=l==o.from?l-1:T(o.text,l-o.from,!1)+o.from,c=l==o.to?l+1:T(o.text,l-o.from,!0)+o.from;return{changes:{from:s,to:c,insert:e.doc.slice(l,c).append(e.doc.slice(s,l))},range:h.cursor(c)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function q(e){let t=[],n=-1;for(let r of e.selection.ranges){let l=e.doc.lineAt(r.from),o=e.doc.lineAt(r.to);if(!r.empty&&r.to==o.from&&(o=e.doc.lineAt(r.to-1)),n>=l.number){let s=t[t.length-1];s.to=o.to,s.ranges.push(r)}else t.push({from:l.from,to:o.to,ranges:[r]});n=o.number+1}return t}function Ye(e,t,n){if(e.readOnly)return!1;let r=[],l=[];for(let o of q(e)){if(n?o.to==e.doc.length:o.from==0)continue;let s=e.doc.lineAt(n?o.to+1:o.from-1),c=s.length+1;if(n){r.push({from:o.to,to:s.to},{from:o.from,insert:s.text+e.lineBreak});for(let i of o.ranges)l.push(h.range(Math.min(e.doc.length,i.anchor+c),Math.min(e.doc.length,i.head+c)))}else{r.push({from:s.from,to:o.from},{from:o.to,insert:e.lineBreak+s.text});for(let i of o.ranges)l.push(h.range(i.anchor-c,i.head-c))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:h.create(l,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const rn=({state:e,dispatch:t})=>Ye(e,t,!1),on=({state:e,dispatch:t})=>Ye(e,t,!0);function Ze(e,t,n){if(e.readOnly)return!1;let r=[];for(let o of q(e))n?r.push({from:o.from,insert:e.doc.slice(o.from,o.to)+e.lineBreak}):r.push({from:o.to,insert:e.lineBreak+e.doc.slice(o.from,o.to)});let l=e.changes(r);return t(e.update({changes:l,selection:e.selection.map(l,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const ln=({state:e,dispatch:t})=>Ze(e,t,!1),sn=({state:e,dispatch:t})=>Ze(e,t,!0),cn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(q(t).map(({from:l,to:o})=>(l>0?l--:o<t.doc.length&&o++,{from:l,to:o}))),r=I(t.selection,l=>{let o;if(e.lineWrapping){let s=e.lineBlockAt(l.head),c=e.coordsAtPos(l.head,l.assoc||1);c&&(o=s.bottom+e.documentTop-c.bottom+e.defaultLineHeight/2)}return e.moveVertically(l,!0,o)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0},Yn=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),Zn=({state:e,dispatch:t})=>(t(e.update(e.changeByRange(n=>{let r=/^\s*/.exec(e.doc.lineAt(n.from).text)[0];return{changes:{from:n.from,to:n.to,insert:e.lineBreak+r},range:h.cursor(n.from+r.length+1)}}),{scrollIntoView:!0,userEvent:"input"})),!0);function un(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=te(e).resolveInner(t),r=n.childBefore(t),l=n.childAfter(t),o;return r&&l&&r.to<=t&&l.from>=t&&(o=r.type.prop(Q.closedBy))&&o.indexOf(l.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(l.from).from&&!/\S/.test(e.sliceDoc(r.to,l.from))?{from:r.to,to:l.from}:null}const ye=_e(!1),fn=_e(!0);function _e(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(l=>{let{from:o,to:s}=l,c=t.doc.lineAt(o),i=!e&&o==s&&un(t,o);e&&(o=s=(s<=c.to?c:t.doc.lineAt(s)).to);let f=new Ce(t,{simulateBreak:o,simulateDoubleBreak:!!i}),u=De(f,o);for(u==null&&(u=ee(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));s<c.to&&/\s/.test(c.text[s-c.from]);)s++;i?{from:o,to:s}=i:o>c.from&&o<c.from+100&&!/\S/.test(c.text.slice(0,o))&&(o=c.from);let a=["",G(t,u)];return i&&a.push(G(t,f.lineIndent(c.from,-1))),{changes:{from:o,to:s,insert:ke.of(a)},range:h.cursor(o+1+a[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function ce(e,t){let n=-1;return e.changeByRange(r=>{let l=[];for(let s=r.from;s<=r.to;){let c=e.doc.lineAt(s);c.number>n&&(r.empty||r.to>c.from)&&(t(c,l,r),n=c.number),s=c.to+1}let o=e.changes(l);return{changes:l,range:h.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}const an=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Ce(e,{overrideIndentation:o=>{let s=n[o];return s??-1}}),l=ce(e,(o,s,c)=>{let i=De(r,o.from);if(i==null)return;/\S/.test(o.text)||(i=0);let f=/^\s*/.exec(o.text)[0],u=G(e,i);(f!=u||c.from<o.from+f.length)&&(n[o.from]=i,s.push({from:o.from,to:o.from+f.length,insert:u}))});return l.changes.empty||t(e.update(l,{userEvent:"indent"})),!0},ie=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(ce(e,(n,r)=>{r.push({from:n.from,insert:e.facet(st)})}),{userEvent:"input.indent"})),!0),et=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(ce(e,(n,r)=>{let l=/^\s*/.exec(n.text)[0];if(!l)return;let o=ee(l,e.tabSize),s=0,c=G(e,Math.max(0,o-j(e)));for(;s<l.length&&s<c.length&&l.charCodeAt(s)==c.charCodeAt(s);)s++;r.push({from:n.from+s,to:n.from+l.length,insert:c.slice(s)})}),{userEvent:"delete.dedent"})),!0),hn=e=>(e.setTabFocusMode(),!0),_n=e=>(e.setTabFocusMode(2e3),!0),er=({state:e,dispatch:t})=>e.selection.ranges.some(n=>!n.empty)?ie({state:e,dispatch:t}):(t(e.update(e.replaceSelection(" "),{scrollIntoView:!0,userEvent:"input"})),!0),dn=[{key:"Ctrl-b",run:Te,shift:Je,preventDefault:!0},{key:"Ctrl-f",run:Oe,shift:we},{key:"Ctrl-p",run:Ge,shift:He},{key:"Ctrl-n",run:Ue,shift:qe},{key:"Ctrl-a",run:vt,shift:Wt},{key:"Ctrl-e",run:Rt,shift:Ht},{key:"Ctrl-d",run:je},{key:"Ctrl-h",run:_},{key:"Ctrl-k",run:Zt},{key:"Ctrl-Alt-h",run:Xe},{key:"Ctrl-o",run:tn},{key:"Ctrl-t",run:nn},{key:"Ctrl-v",run:Z}],mn=[{key:"ArrowLeft",run:Te,shift:Je,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Dt,shift:Gt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Ot,shift:wt,preventDefault:!0},{key:"ArrowRight",run:Oe,shift:we,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:xt,shift:Ut,preventDefault:!0},{mac:"Cmd-ArrowRight",run:It,shift:zt,preventDefault:!0},{key:"ArrowUp",run:Ge,shift:He,preventDefault:!0},{mac:"Cmd-ArrowUp",run:de,shift:pe},{mac:"Ctrl-ArrowUp",run:fe,shift:ae},{key:"ArrowDown",run:Ue,shift:qe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:me,shift:ge},{mac:"Ctrl-ArrowDown",run:Z,shift:he},{key:"PageUp",run:fe,shift:ae},{key:"PageDown",run:Z,shift:he},{key:"Home",run:Tt,shift:Jt,preventDefault:!0},{key:"Mod-Home",run:de,shift:pe},{key:"End",run:Et,shift:Pt,preventDefault:!0},{key:"Mod-End",run:me,shift:ge},{key:"Enter",run:ye,shift:ye},{key:"Mod-a",run:qt},{key:"Backspace",run:_,shift:_,preventDefault:!0},{key:"Delete",run:je,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Xe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Yt,preventDefault:!0},{mac:"Mod-Backspace",run:_t,preventDefault:!0},{mac:"Mod-Delete",run:en,preventDefault:!0}].concat(dn.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),tr=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Mt,shift:Vt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:bt,shift:Nt},{key:"Alt-ArrowUp",run:rn},{key:"Shift-Alt-ArrowUp",run:ln},{key:"Alt-ArrowDown",run:on},{key:"Shift-Alt-ArrowDown",run:sn},{key:"Mod-Alt-ArrowUp",run:jt},{key:"Mod-Alt-ArrowDown",run:Qt},{key:"Escape",run:Xt},{key:"Mod-Enter",run:fn},{key:"Alt-l",mac:"Ctrl-l",run:Kt},{key:"Mod-i",run:$t,preventDefault:!0},{key:"Mod-[",run:et},{key:"Mod-]",run:ie},{key:"Mod-Alt-\\",run:an},{key:"Shift-Mod-k",run:cn},{key:"Shift-Mod-\\",run:Ft},{key:"Mod-/",run:ct},{key:"Alt-A",run:ut},{key:"Ctrl-m",mac:"Shift-Alt-m",run:hn}].concat(mn),nr={key:"Tab",run:ie,shift:et};export{jt as addCursorAbove,Qt as addCursorBelow,Sn as blockComment,Cn as blockUncomment,sn as copyLineDown,ln as copyLineUp,Tn as cursorCharBackward,In as cursorCharBackwardLogical,En as cursorCharForward,On as cursorCharForwardLogical,Te as cursorCharLeft,Oe as cursorCharRight,me as cursorDocEnd,de as cursorDocStart,Rn as cursorGroupBackward,vn as cursorGroupForward,Fn as cursorGroupForwardWin,Dt as cursorGroupLeft,xt as cursorGroupRight,Tt as cursorLineBoundaryBackward,Et as cursorLineBoundaryForward,Ot as cursorLineBoundaryLeft,It as cursorLineBoundaryRight,Ue as cursorLineDown,Rt as cursorLineEnd,vt as cursorLineStart,Ge as cursorLineUp,Ft as cursorMatchingBracket,Z as cursorPageDown,fe as cursorPageUp,Un as cursorSubwordBackward,Gn as cursorSubwordForward,Mt as cursorSyntaxLeft,bt as cursorSyntaxRight,tr as defaultKeymap,_ as deleteCharBackward,$n as deleteCharBackwardStrict,je as deleteCharForward,Xe as deleteGroupBackward,Yt as deleteGroupForward,jn as deleteGroupForwardWin,cn as deleteLine,_t as deleteLineBoundaryBackward,en as deleteLineBoundaryForward,Zt as deleteToLineEnd,Qn as deleteToLineStart,Xn as deleteTrailingWhitespace,dn as emacsStyleKeymap,Dn as history,xn as historyField,bn as historyKeymap,et as indentLess,ie as indentMore,an as indentSelection,nr as indentWithTab,fn as insertBlankLine,Yn as insertNewline,ye as insertNewlineAndIndent,Zn as insertNewlineKeepIndent,er as insertTab,mt as invertedEffects,dt as isolateHistory,An as lineComment,Bn as lineUncomment,on as moveLineDown,rn as moveLineUp,Y as redo,Mn as redoDepth,gt as redoSelection,qt as selectAll,Pn as selectCharBackward,wn as selectCharBackwardLogical,Nn as selectCharForward,Jn as selectCharForwardLogical,Je as selectCharLeft,we as selectCharRight,ge as selectDocEnd,pe as selectDocStart,Wn as selectGroupBackward,zn as selectGroupForward,Hn as selectGroupForwardWin,Gt as selectGroupLeft,Ut as selectGroupRight,Kt as selectLine,Jt as selectLineBoundaryBackward,Pt as selectLineBoundaryForward,wt as selectLineBoundaryLeft,zt as selectLineBoundaryRight,qe as selectLineDown,Ht as selectLineEnd,Wt as selectLineStart,He as selectLineUp,Vn as selectMatchingBracket,he as selectPageDown,ae as selectPageUp,$t as selectParentSyntax,Kn as selectSubwordBackward,qn as selectSubwordForward,Vt as selectSyntaxLeft,Nt as selectSyntaxRight,Xt as simplifySelection,tn as splitLine,mn as standardKeymap,_n as temporarilySetTabFocusMode,ut as toggleBlockComment,ft as toggleBlockCommentByLine,ct as toggleComment,it as toggleLineComment,hn as toggleTabFocusMode,nn as transposeChars,Le as undo,Ln as undoDepth,pt as undoSelection};
@@ -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;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 +1 @@
1
- import{P as L,b as $,a as E,D as j,N as y,c as S,I as G}from"./index-DhmD70Mu.js";var N={};class v{constructor(t,e,s,i,h,r,n,o,a,u=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=a,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new v(t,[],e,s,s,0,[],0,i?new R(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n&&(this.score+=n),s==0){i<h.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0),this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),a=o?this.stack[o-2]:this.p.ranges[0].from;i<h.minRepeatTerm&&a==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let u=this.reducePos-a;u>=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=u));let f=o?this.stack[o-1]:0,d=this.bufferBase+this.buffer.length-f;if(i<h.minRepeatTerm||t&131072){let c=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,c,d+4,!0)}if(t&262144)this.state=this.stack[o];else{let c=this.stack[o-3];this.state=h.getGoto(c,i,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this.buffer.length;if(r>0&&this.buffer[r-4]==0&&this.buffer[r-1]>-1){if(e==s)return;if(this.buffer[r-2]>=e){this.buffer[r-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);!n&&(i>s||e<=r.maxNode)&&(this.reducePos=i),this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}else this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4)}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(e&&t.buffer[e-4]==0&&(e-=4);e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new v(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new U(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)(r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t)&&i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];i.some((n,o)=>o&1&&n==r)||i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,a=this.stack.length-n*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new R(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class R{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class U{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class A{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new A(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new A(this.stack,this.pos,this.index)}}function x(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s<l.length;){let h=0;for(;;){let r=l.charCodeAt(s++),n=!1;if(r==126){h=65535;break}r>=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,n=!0),h+=o,n)break;h*=46}e?e[i++]=h:e=new t(h)}return e}class P{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const z=new P;class H{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=z,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;for(;h<s.from;){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}for(;e<0?h>s.to:h>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;for(;n.to<=s;)n=this.ranges[++r];this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to&&(this.chunk2=this.chunk2.slice(0,n.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=z,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;O(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class W{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(O(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(h||i++,r==null)break;t.reset(r,t.token)}i&&(t.reset(s,t.token),t.acceptToken(this.elseToken,i))}}W.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class Z{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function O(l,t,e,s,i,h){let r=0,n=1<<s,{dialect:o}=e.p.parser;t:for(;(n&l[r])!=0;){let a=l[r+1];for(let c=r+3;c<a;c+=2)if((l[c+1]&n)>0){let p=l[c];if(o.allows(p)&&(t.token.value==-1||t.token.value==p||q(p,t.token.value,i,h))){t.acceptToken(p);break}}let u=t.next,f=0,d=l[r+2];if(t.next<0&&d>f&&l[a+d*3-3]==65535){r=l[a+d*3-1];continue t}for(;f<d;){let c=f+d>>1,p=a+c+(c<<1),b=l[p],M=l[p+1]||65536;if(u<b)d=c;else if(u>=M)f=c+1;else{r=l[p+2],t.advance();continue t}}break}}function I(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function q(l,t,e,s){let i=I(e,s,t);return i<0||I(e,s,l)<i}const g=typeof process<"u"&&N&&/\bparse\b/.test(N.LOG);let T=null;function D(l,t,e){let s=l.cursor(G.IncludeAnonymous);for(s.moveTo(t);;)if(!(e<0?s.childBefore(t):s.childAfter(t)))for(;;){if((e<0?s.to<t:s.from>t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class J{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?D(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?D(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof S){if(r==t){if(r<this.safeFrom)return null;let n=r+h.length;if(n<=this.safeTo){let o=h.prop(y.lookAhead);if(!o||n+o<this.fragment.to)return h}}this.index[e]++,r+h.length>=Math.max(this.safeFrom,t)&&(this.trees.push(h),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+h.length}}}class K{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new P)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let a=0;a<h.length;a++){if((1<<a&r)==0)continue;let u=h[a],f=this.tokens[a];if(!(s&&!u.fallback)&&((u.contextual||f.start!=t.pos||f.mask!=r||f.context!=n)&&(this.updateCachedToken(f,u,t),f.mask=r,f.context=n),f.lookAhead>f.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let d=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!u.extend&&(s=f,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new P,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new P,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){(n&1)==0?t.value=n>>1:t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let a=r.stateSlot(h,o?2:1);;a+=3){if(n[a]==65535)if(n[a+1]==1)a=k(n,a+2);else{i==0&&n[a+1]==2&&(i=this.putAction(k(n,a+2),e,s,i));break}n[a]==e&&(i=this.putAction(k(n,a+1),e,s,i))}return i}}class Q{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new H(e,i),this.tokens=new K(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[v.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new J(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else{if(this.advanceStack(n,s,t))continue;{i||(i=[],h=[]),i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}}break}}if(!s.length){let r=i&&X(i);if(r)return g&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw g&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r)return g&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((n,o)=>o.score-n.score);s.length>r;)s.pop();s.some(n=>n.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let a=s[o];if(n.sameState(a)||n.buffer.length>500&&a.buffer.length>500)if((n.score-a.score||n.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&(s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)s[r].pos<this.minStackPos&&(this.minStackPos=s[r].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=g?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,u=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?h.getGoto(t.state,f.type.id):-1;if(d>-1&&f.length&&(!a||(f.prop(y.contextHash)||0)==u))return t.useNode(f,d),g&&console.log(r+this.stackID(t)+` (via reuse of ${h.getName(f.type.id)})`),!0;if(!(f instanceof S)||f.children.length==0||f.positions[0]>0)break;let c=f.children[0];if(c instanceof S&&f.positions[0]==0)f=c;else break}}let n=h.stateSlot(t.state,4);if(n>0)return t.reduce(n),g&&console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;a<o.length;){let u=o[a++],f=o[a++],d=o[a++],c=a==o.length||!s,p=c?t:t.split(),b=this.tokens.mainToken;if(p.apply(u,f,b?b.start:p.pos,d),g&&console.log(r+this.stackID(p)+` (via ${(u&65536)==0?"shift":`reduce of ${h.getName(u&65535)}`} for ${h.getName(f)} @ ${i}${p==t?"":", split"})`),c)return!0;p.pos>i?e.push(p):s.push(p)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return B(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],a=e[(r<<1)+1],u=g?this.stackID(n)+" -> ":"";if(n.deadEnd&&(h||(h=!0,n.restart(),g&&console.log(u+this.stackID(n)+" (restarted)"),this.advanceFully(n,s))))continue;let f=n.split(),d=u;for(let c=0;c<10&&f.forceReduce()&&(g&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));c++)g&&(d=this.stackID(f)+" -> ");for(let c of n.recoverByInsert(o))g&&console.log(u+this.stackID(c)+" (via recover-insert)"),this.advanceFully(c,s);this.stream.end>n.pos?(a==n.pos&&(a++,o=0),n.recoverByDelete(o,a),g&&console.log(u+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`),B(n,s)):(!i||i.score<f.score)&&(i=f)}return i}stackToTree(t){return t.close(),S.build({buffer:A.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(T||(T=new WeakMap)).get(t);return e||T.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function B(l,t){for(let e=0;e<t.length;e++){let s=t[e];if(s.pos==l.pos&&s.sameState(l)){t[e].score<l.score&&(t[e]=l);return}}t.push(l)}class V{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}const C=l=>l;class _{constructor(t){this.start=t.start,this.shift=t.shift||C,this.reduce=t.reduce||C,this.reuse=t.reuse||C,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class w extends L{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map(n=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,a){i[n].push([o,o.deserialize(String(a))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];typeof o=="string"&&(o=y[o]);for(let a=1;a<n.length;){let u=n[a++];if(u>=0)h(u,o,n[a++]);else{let f=n[a+-u];for(let d=-u;d>0;d--)h(n[a++],o,f);a++}}}this.nodeSet=new $(e.map((n,o)=>E.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=j;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(F),this.states=x(t.states,Uint32Array),this.data=x(t.stateData),this.goto=x(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(n=>typeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new Q(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let a=h+(r>>1);h<a;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=k(s,h+2)];else{if(s[h+1]==2)return k(s,h+2);break}if(r==e||r==0)return k(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];e.some((h,r)=>r&1&&h==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(w.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(h=>h.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find(n=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=F(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);r>=0&&(s[r]=!0)}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new V(t,s,i)}static deserialize(t){return new w(t)}}function k(l,t){return l[t]|l[t+1]<<16}function X(l){let t=null;for(let e of l){let s=e.p.stoppedAt;(e.pos==e.p.stream.end||s!=null&&e.pos>s)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.score<e.score)&&(t=e)}return t}function F(l){if(l.external){let t=l.extend?1:0;return(e,s)=>l.external(e,s)<<1|t}return l.get}export{_ as C,Z as E,w as L,W as a};
1
+ import{P as L,b as $,a as E,D as j,N as y,c as S,I as G}from"./index-DRlKZHMW.js";var N={};class v{constructor(t,e,s,i,h,r,n,o,a,u=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=a,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new v(t,[],e,s,s,0,[],0,i?new R(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n&&(this.score+=n),s==0){i<h.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0),this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),a=o?this.stack[o-2]:this.p.ranges[0].from;i<h.minRepeatTerm&&a==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let u=this.reducePos-a;u>=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=u));let f=o?this.stack[o-1]:0,d=this.bufferBase+this.buffer.length-f;if(i<h.minRepeatTerm||t&131072){let c=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,c,d+4,!0)}if(t&262144)this.state=this.stack[o];else{let c=this.stack[o-3];this.state=h.getGoto(c,i,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this.buffer.length;if(r>0&&this.buffer[r-4]==0&&this.buffer[r-1]>-1){if(e==s)return;if(this.buffer[r-2]>=e){this.buffer[r-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);!n&&(i>s||e<=r.maxNode)&&(this.reducePos=i),this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}else this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4)}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(e&&t.buffer[e-4]==0&&(e-=4);e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new v(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new U(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)(r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t)&&i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];i.some((n,o)=>o&1&&n==r)||i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,a=this.stack.length-n*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new R(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class R{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class U{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class A{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new A(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new A(this.stack,this.pos,this.index)}}function x(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s<l.length;){let h=0;for(;;){let r=l.charCodeAt(s++),n=!1;if(r==126){h=65535;break}r>=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,n=!0),h+=o,n)break;h*=46}e?e[i++]=h:e=new t(h)}return e}class P{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const z=new P;class H{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=z,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;for(;h<s.from;){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}for(;e<0?h>s.to:h>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;for(;n.to<=s;)n=this.ranges[++r];this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to&&(this.chunk2=this.chunk2.slice(0,n.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=z,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;O(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class W{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(O(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(h||i++,r==null)break;t.reset(r,t.token)}i&&(t.reset(s,t.token),t.acceptToken(this.elseToken,i))}}W.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class Z{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function O(l,t,e,s,i,h){let r=0,n=1<<s,{dialect:o}=e.p.parser;t:for(;(n&l[r])!=0;){let a=l[r+1];for(let c=r+3;c<a;c+=2)if((l[c+1]&n)>0){let p=l[c];if(o.allows(p)&&(t.token.value==-1||t.token.value==p||q(p,t.token.value,i,h))){t.acceptToken(p);break}}let u=t.next,f=0,d=l[r+2];if(t.next<0&&d>f&&l[a+d*3-3]==65535){r=l[a+d*3-1];continue t}for(;f<d;){let c=f+d>>1,p=a+c+(c<<1),b=l[p],M=l[p+1]||65536;if(u<b)d=c;else if(u>=M)f=c+1;else{r=l[p+2],t.advance();continue t}}break}}function I(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function q(l,t,e,s){let i=I(e,s,t);return i<0||I(e,s,l)<i}const g=typeof process<"u"&&N&&/\bparse\b/.test(N.LOG);let T=null;function D(l,t,e){let s=l.cursor(G.IncludeAnonymous);for(s.moveTo(t);;)if(!(e<0?s.childBefore(t):s.childAfter(t)))for(;;){if((e<0?s.to<t:s.from>t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class J{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?D(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?D(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof S){if(r==t){if(r<this.safeFrom)return null;let n=r+h.length;if(n<=this.safeTo){let o=h.prop(y.lookAhead);if(!o||n+o<this.fragment.to)return h}}this.index[e]++,r+h.length>=Math.max(this.safeFrom,t)&&(this.trees.push(h),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+h.length}}}class K{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new P)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let a=0;a<h.length;a++){if((1<<a&r)==0)continue;let u=h[a],f=this.tokens[a];if(!(s&&!u.fallback)&&((u.contextual||f.start!=t.pos||f.mask!=r||f.context!=n)&&(this.updateCachedToken(f,u,t),f.mask=r,f.context=n),f.lookAhead>f.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let d=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!u.extend&&(s=f,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new P,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new P,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){(n&1)==0?t.value=n>>1:t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let a=r.stateSlot(h,o?2:1);;a+=3){if(n[a]==65535)if(n[a+1]==1)a=k(n,a+2);else{i==0&&n[a+1]==2&&(i=this.putAction(k(n,a+2),e,s,i));break}n[a]==e&&(i=this.putAction(k(n,a+1),e,s,i))}return i}}class Q{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new H(e,i),this.tokens=new K(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[v.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new J(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else{if(this.advanceStack(n,s,t))continue;{i||(i=[],h=[]),i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}}break}}if(!s.length){let r=i&&X(i);if(r)return g&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw g&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r)return g&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((n,o)=>o.score-n.score);s.length>r;)s.pop();s.some(n=>n.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let a=s[o];if(n.sameState(a)||n.buffer.length>500&&a.buffer.length>500)if((n.score-a.score||n.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&(s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)s[r].pos<this.minStackPos&&(this.minStackPos=s[r].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=g?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,u=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?h.getGoto(t.state,f.type.id):-1;if(d>-1&&f.length&&(!a||(f.prop(y.contextHash)||0)==u))return t.useNode(f,d),g&&console.log(r+this.stackID(t)+` (via reuse of ${h.getName(f.type.id)})`),!0;if(!(f instanceof S)||f.children.length==0||f.positions[0]>0)break;let c=f.children[0];if(c instanceof S&&f.positions[0]==0)f=c;else break}}let n=h.stateSlot(t.state,4);if(n>0)return t.reduce(n),g&&console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;a<o.length;){let u=o[a++],f=o[a++],d=o[a++],c=a==o.length||!s,p=c?t:t.split(),b=this.tokens.mainToken;if(p.apply(u,f,b?b.start:p.pos,d),g&&console.log(r+this.stackID(p)+` (via ${(u&65536)==0?"shift":`reduce of ${h.getName(u&65535)}`} for ${h.getName(f)} @ ${i}${p==t?"":", split"})`),c)return!0;p.pos>i?e.push(p):s.push(p)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return B(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],a=e[(r<<1)+1],u=g?this.stackID(n)+" -> ":"";if(n.deadEnd&&(h||(h=!0,n.restart(),g&&console.log(u+this.stackID(n)+" (restarted)"),this.advanceFully(n,s))))continue;let f=n.split(),d=u;for(let c=0;c<10&&f.forceReduce()&&(g&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));c++)g&&(d=this.stackID(f)+" -> ");for(let c of n.recoverByInsert(o))g&&console.log(u+this.stackID(c)+" (via recover-insert)"),this.advanceFully(c,s);this.stream.end>n.pos?(a==n.pos&&(a++,o=0),n.recoverByDelete(o,a),g&&console.log(u+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`),B(n,s)):(!i||i.score<f.score)&&(i=f)}return i}stackToTree(t){return t.close(),S.build({buffer:A.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(T||(T=new WeakMap)).get(t);return e||T.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function B(l,t){for(let e=0;e<t.length;e++){let s=t[e];if(s.pos==l.pos&&s.sameState(l)){t[e].score<l.score&&(t[e]=l);return}}t.push(l)}class V{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}const C=l=>l;class _{constructor(t){this.start=t.start,this.shift=t.shift||C,this.reduce=t.reduce||C,this.reuse=t.reuse||C,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class w extends L{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map(n=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,a){i[n].push([o,o.deserialize(String(a))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];typeof o=="string"&&(o=y[o]);for(let a=1;a<n.length;){let u=n[a++];if(u>=0)h(u,o,n[a++]);else{let f=n[a+-u];for(let d=-u;d>0;d--)h(n[a++],o,f);a++}}}this.nodeSet=new $(e.map((n,o)=>E.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=j;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(F),this.states=x(t.states,Uint32Array),this.data=x(t.stateData),this.goto=x(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(n=>typeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new Q(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let a=h+(r>>1);h<a;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=k(s,h+2)];else{if(s[h+1]==2)return k(s,h+2);break}if(r==e||r==0)return k(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];e.some((h,r)=>r&1&&h==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(w.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(h=>h.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find(n=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=F(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);r>=0&&(s[r]=!0)}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new V(t,s,i)}static deserialize(t){return new w(t)}}function k(l,t){return l[t]|l[t+1]<<16}function X(l){let t=null;for(let e of l){let s=e.p.stoppedAt;(e.pos==e.p.stream.end||s!=null&&e.pos>s)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.score<e.score)&&(t=e)}return t}function F(l){if(l.external){let t=l.extend?1:0;return(e,s)=>l.external(e,s)<<1|t}return l.get}export{_ as C,Z as E,w as L,W as a};