nomoreide 0.1.49 → 0.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
[](https://nodejs.org)
|
|
14
14
|
[](https://modelcontextprotocol.io)
|
|
15
15
|
|
|
16
|
-
Give your coding agents and yourself a **shared local control surface** for services, ports, logs, Git review, and MCP workflows — no IDE required.
|
|
16
|
+
Give your coding agents and yourself a **shared local control surface** for services, ports, logs, Git review, GitHub workflows, database work, and MCP workflows — no IDE required.
|
|
17
17
|
|
|
18
18
|
[Quick Start](#quick-start) · [MCP Setup](#-connect-your-ai-agent) · [CLI Reference](#cli) · [MCP Tools](#mcp-tools) · [Architecture](#architecture)
|
|
19
19
|
|
|
@@ -23,7 +23,7 @@ Give your coding agents and yourself a **shared local control surface** for serv
|
|
|
23
23
|
|
|
24
24
|
## What Is NoMoreIDE?
|
|
25
25
|
|
|
26
|
-
NoMoreIDE is a lightweight process manager, Git reviewer, log aggregator, and MCP server — all in one `npx` command. It gives AI coding agents (Claude Code, Codex CLI, Gemini CLI, and others) a safe, structured window into your running dev environment through the **Model Context Protocol (MCP)**, while also providing a terminal UI and a local React web dashboard for humans.
|
|
26
|
+
NoMoreIDE is a lightweight process manager, Git reviewer, GitHub workflow surface, database workbench, log aggregator, and MCP server — all in one `npx` command. It gives AI coding agents (Claude Code, Codex CLI, Gemini CLI, and others) a safe, structured window into your running dev environment through the **Model Context Protocol (MCP)**, while also providing a terminal UI and a local React web dashboard for humans.
|
|
27
27
|
|
|
28
28
|
```
|
|
29
29
|
┌──────────────────────────────────────────────────────┐
|
|
@@ -270,6 +270,11 @@ graph TD
|
|
|
270
270
|
| Git status & diff | ✓ | | ✓ | ✓ |
|
|
271
271
|
| Stage / unstage / commit | ✓ | | ✓ | ✓ |
|
|
272
272
|
| Branch management | ✓ | | ✓ | ✓ |
|
|
273
|
+
| GitHub PRs / issues / Actions | | | ✓ | ✓ |
|
|
274
|
+
| Reusable git/GitHub workflows | | | ✓ | |
|
|
275
|
+
| Database browse and SQL query | | | ✓ | ✓ |
|
|
276
|
+
| Human-approved SQL writes | | | ✓ | |
|
|
277
|
+
| Agent tools, hooks, plugins, usage | | | ✓ | |
|
|
273
278
|
| Safe Git (no force-push, no reset) | ✓ | ✓ | ✓ | ✓ |
|
|
274
279
|
|
|
275
280
|
---
|
|
@@ -418,6 +423,29 @@ All tools are prefixed with `nomoreide_` and are available to any connected MCP
|
|
|
418
423
|
| `nomoreide_git_register_repository` | Register a repo path |
|
|
419
424
|
| `nomoreide_git_select_repository` | Select the active repo |
|
|
420
425
|
|
|
426
|
+
### Database Tools
|
|
427
|
+
|
|
428
|
+
| Tool | Description |
|
|
429
|
+
|---|---|
|
|
430
|
+
| `nomoreide_list_databases` | List registered database connections with masked URLs |
|
|
431
|
+
| `nomoreide_db_tables` | List tables and views for a connection |
|
|
432
|
+
| `nomoreide_db_sample` | Sample rows and schema metadata |
|
|
433
|
+
| `nomoreide_db_query` | Run read-only SQL queries; writes are rejected and staged for the Web UI SQL console |
|
|
434
|
+
|
|
435
|
+
### GitHub Tools
|
|
436
|
+
|
|
437
|
+
| Tool | Description |
|
|
438
|
+
|---|---|
|
|
439
|
+
| `nomoreide_github_set_token` | Store a GitHub token for API access |
|
|
440
|
+
| `nomoreide_github_list_prs` / `nomoreide_github_get_pr` | Inspect pull requests |
|
|
441
|
+
| `nomoreide_github_get_pr_diff` | Fetch a pull request diff |
|
|
442
|
+
| `nomoreide_github_create_pr` / `nomoreide_github_merge_pr` | Create or merge pull requests with explicit user intent |
|
|
443
|
+
| `nomoreide_github_list_issues` / `nomoreide_github_get_issue` | Inspect issues |
|
|
444
|
+
| `nomoreide_github_list_issue_comments` / `nomoreide_github_add_issue_comment` | Read or add issue and PR comments |
|
|
445
|
+
| `nomoreide_github_create_issue` | Create an issue |
|
|
446
|
+
| `nomoreide_github_get_commit_ci` | Inspect commit check status |
|
|
447
|
+
| `nomoreide_github_list_workflow_runs` | List recent GitHub Actions workflow runs |
|
|
448
|
+
|
|
421
449
|
---
|
|
422
450
|
|
|
423
451
|
## Example Configurations
|
|
@@ -462,7 +490,10 @@ NoMoreIDE is designed to be **safe for AI agents to call without guard rails**:
|
|
|
462
490
|
- Does not kill processes it did not start
|
|
463
491
|
- Reports port conflicts instead of terminating the occupying process
|
|
464
492
|
- Git tools omit all destructive operations (no `reset --hard`, `clean`, `push --force`, or `branch -D`)
|
|
465
|
-
-
|
|
493
|
+
- Database MCP tools are read-only; writes are staged for the human-only SQL console
|
|
494
|
+
- Database writes require explicit unlock, preview, and commit
|
|
495
|
+
- GitHub create/comment/merge tools require a configured token and explicit user intent
|
|
496
|
+
- Config is scoped to `~/.config/nomoreide/config.json`
|
|
466
497
|
- Logs are written only to `.nomoreide/logs/`
|
|
467
498
|
|
|
468
499
|
---
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as It,j as Rf}from"./index-BYrd1HFJ.js";const sh=1024;let Af=0,Te=class{constructor(e,t){this.from=e,this.to=t}};class R{constructor(e={}){this.id=Af++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=re.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}R.closedBy=new R({deserialize:r=>r.split(" ")});R.openedBy=new R({deserialize:r=>r.split(" ")});R.group=new R({deserialize:r=>r.split(" ")});R.isolate=new R({deserialize:r=>{if(r&&r!="rtl"&&r!="ltr"&&r!="auto")throw new RangeError("Invalid value for isolate: "+r);return r||"auto"}});R.contextHash=new R({perNode:!0});R.lookAhead=new R({perNode:!0});R.mounted=new R({perNode:!0});class Ht{constructor(e,t,i,n=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=n}static get(e){return e&&e.props&&e.props[R.mounted.id]}}const Mf=Object.create(null);class re{constructor(e,t,i,n=0){this.name=e,this.props=t,this.id=i,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):Mf,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new re(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(n)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(R.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let n of i.split(" "))t[n]=e[i];return i=>{for(let n=i.prop(R.group),s=-1;s<(n?n.length:0);s++){let o=t[s<0?i.name:n[s]];if(o)return o}}}}re.none=new re("",Object.create(null),0,8);class ir{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let n=null;for(let s of e){let o=s(i);if(o){n||(n=Object.assign({},i.props));let l=o[1],a=o[0];a.combine&&a.id in n&&(l=a.combine(n[a.id],l)),n[a.id]=l}}t.push(n?new re(i.name,n,i.id,i.flags):i)}return new ir(t)}}const Or=new WeakMap,Ko=new WeakMap;var E;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays",r[r.EnterBracketed=16]="EnterBracketed"})(E||(E={}));class W{constructor(e,t,i,n,s){if(this.type=e,this.children=t,this.positions=i,this.length=n,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=Ht.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let n=i.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new _r(this.topNode,e)}cursorAt(e,t=0,i=0){let n=Or.get(this)||this.topNode,s=new _r(n);return s.moveTo(e,t),Or.set(this,s._tree),s}get topNode(){return new ce(this,0,0,null)}resolve(e,t=0){let i=Wi(Or.get(this)||this.topNode,e,t,!1);return Or.set(this,i),i}resolveInner(e,t=0){let i=Wi(Ko.get(this)||this.topNode,e,t,!0);return Ko.set(this,i),i}resolveStack(e,t=0){return Lf(this,e,t)}iterate(e){let{enter:t,leave:i,from:n=0,to:s=this.length}=e,o=e.mode||0,l=(o&E.IncludeAnonymous)>0;for(let a=this.cursor(o|E.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=n&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:co(re.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,n)=>new W(this.type,t,i,n,this.propValues),e.makeTree||((t,i,n)=>new W(re.none,t,i,n)))}static build(e){return Yf(e)}}W.empty=new W(re.none,[],[],0);class ao{constructor(e,t){this.buffer=e,this.index=t}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]}get pos(){return this.index}next(){this.index-=4}fork(){return new ao(this.buffer,this.index)}}class Qt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return re.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],n=this.set.types[t],s=n.name;if(/\W/.test(s)&&!n.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,i,n,s){let{buffer:o}=this,l=-1;for(let a=e;a!=t&&!(oh(s,n,o[a+1],o[a+2])&&(l=a,i>0));a=o[a+3]);return l}slice(e,t,i){let n=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){s[a++]=n[l++],s[a++]=n[l++]-i;let h=s[a++]=n[l++]-i;s[a++]=n[l++]-e,o=Math.max(o,h)}return new Qt(s,o,this.set)}}function oh(r,e,t,i){switch(r){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Wi(r,e,t,i){for(var n;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let o=!i&&r instanceof ce&&r.index<0?null:r.parent;if(!o)return r;r=o}let s=i?0:E.IgnoreOverlays;if(i)for(let o=r,l=o.parent;l;o=l,l=o.parent)o instanceof ce&&o.index<0&&((n=l.enter(e,t,s))===null||n===void 0?void 0:n.from)!=o.from&&(r=l);for(;;){let o=r.enter(e,t,s);if(!o)return r;r=o}}class lh{cursor(e=0){return new _r(this,e)}getChild(e,t=null,i=null){let n=Jo(this,e,t,i);return n.length?n[0]:null}getChildren(e,t=null,i=null){return Jo(this,e,t,i)}resolve(e,t=0){return Wi(this,e,t,!1)}resolveInner(e,t=0){return Wi(this,e,t,!0)}matchContext(e){return os(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let n=t.lastChild;if(!n||n.to!=t.to)break;n.type.isError&&n.from==n.to?(i=t,t=n.prevSibling):t=n}return i}get node(){return this}get next(){return this.parent}}class ce extends lh{constructor(e,t,i,n){super(),this._tree=e,this.from=t,this.index=i,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,n,s=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,h=t>0?l.length:-1;e!=h;e+=t){let c=l[e],O=a[e]+o.from,f;if(!(!(s&E.EnterBracketed&&c instanceof W&&(f=Ht.get(c))&&!f.overlay&&f.bracketed&&i>=O&&i<=O+c.length)&&!oh(n,i,O,O+c.length))){if(c instanceof Qt){if(s&E.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-O,n);if(u>-1)return new Ne(new jf(o,c,e,O),null,u)}else if(s&E.IncludeAnonymous||!c.type.isAnonymous||ho(c)){let u;if(!(s&E.IgnoreMounts)&&(u=Ht.get(c))&&!u.overlay)return new ce(u.tree,O,e,o);let d=new ce(c,O,e,o);return s&E.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,n,s)}}}if(s&E.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let n;if(!(i&E.IgnoreOverlays)&&(n=Ht.get(this._tree))&&n.overlay){let s=e-this.from,o=i&E.EnterBracketed&&n.bracketed;for(let{from:l,to:a}of n.overlay)if((t>0||o?l<=s:l<s)&&(t<0||o?a>=s:a>s))return new ce(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Jo(r,e,t,i){let n=r.cursor(),s=[];if(!n.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=n.type.is(t),!n.nextSibling())return s}for(;;){if(i!=null&&n.type.is(i))return s;if(n.type.is(e)&&s.push(n.node),!n.nextSibling())return i==null?s:[]}}function os(r,e,t=e.length-1){for(let i=r;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class jf{constructor(e,t,i,n){this.parent=e,this.buffer=t,this.index=i,this.start=n}}class Ne extends lh{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new Ne(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&E.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new Ne(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Ne(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Ne(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,n=this.index+4,s=i.buffer[this.index+3];if(s>n){let o=i.buffer[this.index+1];e.push(i.slice(n,s,o)),t.push(0)}return new W(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ah(r){if(!r.length)return null;let e=0,t=r[0];for(let s=1;s<r.length;s++){let o=r[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let i=t instanceof ce&&t.index<0?null:t.parent,n=r.slice();return i?n[e]=i:n.splice(e,1),new zf(n,t)}class zf{constructor(e,t){this.heads=e,this.node=t}get next(){return ah(this.heads)}}function Lf(r,e,t){let i=r.resolveInner(e,t),n=null;for(let s=i instanceof ce?i:i.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(n||(n=[i])).push(o.resolve(e,t)),s=o}else{let o=Ht.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new ce(o.tree,o.overlay[0].from+s.from,-1,s);(n||(n=[i])).push(Wi(l,e,t,!1))}}return n?ah(n):i}class _r{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~E.EnterBracketed,e instanceof ce)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=i+n.buffer[e+1],this.to=i+n.buffer[e+2],!0}yield(e){return e?e instanceof ce?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&E.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&E.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&E.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(n)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(n.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=n)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,o=e<0?-1:i._tree.children.length;s!=o;s+=e){let l=i._tree.children[s];if(this.mode&E.IncludeAnonymous||l instanceof Qt||!l.type.isAnonymous||ho(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let n=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==n){if(n==this.index)return o;t=o,i=s+1;break e}n=this.stack[--s]}for(let n=i;n<this.stack.length;n++)t=new Ne(this.buffer,t,this.stack[n]);return this.bufferNode=new Ne(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let n=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,n=!0}}}matchContext(e){if(!this.buffer)return os(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let n=e.length-1,s=this.stack.length-1;n>=0;s--){if(s<0)return os(this._tree,e,n);let o=i[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}}function ho(r){return r.children.some(e=>e instanceof Qt||!e.type.isAnonymous||ho(e))}function Yf(r){var e;let{buffer:t,nodeSet:i,maxBufferLength:n=sh,reused:s=[],minRepeatType:o=i.types.length}=r,l=Array.isArray(t)?new ao(t,t.length):t,a=i.types,h=0,c=0;function O(x,w,$,Y,j,D){let{id:M,start:C,end:q,size:_}=l,G=c,fe=h;if(_<0)if(l.next(),_==-1){let tt=s[M];$.push(tt),Y.push(C-x);return}else if(_==-3){h=M;return}else if(_==-4){c=M;return}else throw new RangeError(`Unrecognized record size: ${_}`);let ke=a[M],_e,ne,we=C-x;if(q-C<=n&&(ne=m(l.pos-w,j))){let tt=new Uint16Array(ne.size-ne.skip),ve=l.pos-ne.size,We=tt.length;for(;l.pos>ve;)We=Q(ne.start,tt,We);_e=new Qt(tt,q-ne.start,i),we=ne.start-x}else{let tt=l.pos-_;l.next();let ve=[],We=[],vt=M>=o?M:-1,Dt=0,cr=q;for(;l.pos>tt;)vt>=0&&l.id==vt&&l.size>=0?(l.end<=cr-n&&(d(ve,We,C,Dt,l.end,cr,vt,G,fe),Dt=ve.length,cr=l.end),l.next()):D>2500?f(C,tt,ve,We):O(C,tt,ve,We,vt,D+1);if(vt>=0&&Dt>0&&Dt<ve.length&&d(ve,We,C,Dt,C,cr,vt,G,fe),ve.reverse(),We.reverse(),vt>-1&&Dt>0){let Ho=u(ke,fe);_e=co(ke,ve,We,0,ve.length,0,q-C,Ho,Ho)}else _e=g(ke,ve,We,q-C,G-q,fe)}$.push(_e),Y.push(we)}function f(x,w,$,Y){let j=[],D=0,M=-1;for(;l.pos>w;){let{id:C,start:q,end:_,size:G}=l;if(G>4)l.next();else{if(M>-1&&q<M)break;M<0&&(M=_-n),j.push(C,q,_),D++,l.next()}}if(D){let C=new Uint16Array(D*4),q=j[j.length-2];for(let _=j.length-3,G=0;_>=0;_-=3)C[G++]=j[_],C[G++]=j[_+1]-q,C[G++]=j[_+2]-q,C[G++]=G;$.push(new Qt(C,j[2]-q,i)),Y.push(q-x)}}function u(x,w){return($,Y,j)=>{let D=0,M=$.length-1,C,q;if(M>=0&&(C=$[M])instanceof W){if(!M&&C.type==x&&C.length==j)return C;(q=C.prop(R.lookAhead))&&(D=Y[M]+C.length+q)}return g(x,$,Y,j,D,w)}}function d(x,w,$,Y,j,D,M,C,q){let _=[],G=[];for(;x.length>Y;)_.push(x.pop()),G.push(w.pop()+$-j);x.push(g(i.types[M],_,G,D-j,C-D,q)),w.push(j-$)}function g(x,w,$,Y,j,D,M){if(D){let C=[R.contextHash,D];M=M?[C].concat(M):[C]}if(j>25){let C=[R.lookAhead,j];M=M?[C].concat(M):[C]}return new W(x,w,$,Y,M)}function m(x,w){let $=l.fork(),Y=0,j=0,D=0,M=$.end-n,C={size:0,start:0,skip:0};e:for(let q=$.pos-x;$.pos>q;){let _=$.size;if($.id==w&&_>=0){C.size=Y,C.start=j,C.skip=D,D+=4,Y+=4,$.next();continue}let G=$.pos-_;if(_<0||G<q||$.start<M)break;let fe=$.id>=o?4:0,ke=$.start;for($.next();$.pos>G;){if($.size<0)if($.size==-3||$.size==-4)fe+=4;else break e;else $.id>=o&&(fe+=4);$.next()}j=ke,Y+=_,D+=fe}return(w<0||Y==x)&&(C.size=Y,C.start=j,C.skip=D),C.size>4?C:void 0}function Q(x,w,$){let{id:Y,start:j,end:D,size:M}=l;if(l.next(),M>=0&&Y<o){let C=$;if(M>4){let q=l.pos-(M-4);for(;l.pos>q;)$=Q(x,w,$)}w[--$]=C,w[--$]=D-x,w[--$]=j-x,w[--$]=Y}else M==-3?h=Y:M==-4&&(c=Y);return $}let S=[],y=[];for(;l.pos>0;)O(r.start||0,r.bufferStart||0,S,y,-1,0);let A=(e=r.length)!==null&&e!==void 0?e:S.length?y[0]+S[0].length:0;return new W(a[r.topID],S.reverse(),y.reverse(),A)}const el=new WeakMap;function Xr(r,e){if(!r.isAnonymous||e instanceof Qt||e.type!=r)return 1;let t=el.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=r||!(i instanceof W)){t=1;break}t+=Xr(r,i)}el.set(e,t)}return t}function co(r,e,t,i,n,s,o,l,a){let h=0;for(let d=i;d<n;d++)h+=Xr(r,e[d]);let c=Math.ceil(h*1.5/8),O=[],f=[];function u(d,g,m,Q,S){for(let y=m;y<Q;){let A=y,x=g[y],w=Xr(r,d[y]);for(y++;y<Q;y++){let $=Xr(r,d[y]);if(w+$>=c)break;w+=$}if(y==A+1){if(w>c){let $=d[A];u($.children,$.positions,0,$.children.length,g[A]+S);continue}O.push(d[A])}else{let $=g[y-1]+d[y-1].length-x;O.push(co(r,d,g,A,y,x,$,null,a))}f.push(x+S-s)}}return u(e,t,i,n,0),(l||a)(O,f,o)}class hh{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof Ne?this.setBuffer(e.context.buffer,e.index,t):e instanceof ce&&this.map.set(e.tree,t)}get(e){return e instanceof Ne?this.getBuffer(e.context.buffer,e.index):e instanceof ce?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class ot{constructor(e,t,i,n,s=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=n,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let n=[new ot(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&n.push(s);return n}static applyChanges(e,t,i=128){if(!t.length)return e;let n=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l<t.length?t[l]:null,O=c?c.fromA:1e9;if(O-a>=i)for(;o&&o.from<O;){let f=o;if(a>=f.from||O<=f.to||h){let u=Math.max(f.from,a)-h,d=Math.min(f.to,O)-h;f=u>=d?null:new ot(u,d,f.tree,f.offset+h,l>0,!!c)}if(f&&n.push(f),o.to>O)break;o=s<e.length?e[s++]:null}if(!c)break;a=c.toA,h=c.toA-c.toB}return n}}class Oo{startParse(e,t,i){return typeof e=="string"&&(e=new _f(e)),i=i?i.length?i.map(n=>new Te(n.from,n.to)):[new Te(0,0)]:[new Te(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let n=this.startParse(e,t,i);for(;;){let s=n.advance();if(s)return s}}}class _f{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function ch(r){return(e,t,i,n)=>new Vf(e,r,t,i,n)}class tl{constructor(e,t,i,n,s,o){this.parser=e,this.parse=t,this.overlay=i,this.bracketed=n,this.target=s,this.from=o}}function il(r){if(!r.length||r.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(r))}class Wf{constructor(e,t,i,n,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=i,this.index=n,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const ls=new R({perNode:!0});class Vf{constructor(e,t,i,n,s){this.nest=t,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new W(i.type,i.children,i.positions,i.length,i.propValues.concat([[ls,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[R.mounted.id]=new Ht(t,e.overlay,e.parser,e.bracketed),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new Bf(this.fragments),t=null,i=null,n=new _r(new ce(this.baseTree,this.ranges[0].from,0,null),E.IncludeAnonymous|E.IgnoreMounts);e:for(let s,o;;){let l=!0,a;if(this.stoppedAt!=null&&n.from>=this.stoppedAt)l=!1;else if(e.hasNode(n)){if(t){let h=t.mounts.find(c=>c.frag.from<=n.from&&c.frag.to>=n.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let O=c.from+h.pos,f=c.to+h.pos;O>=n.from&&f<=n.to&&!t.ranges.some(u=>u.from<f&&u.to>O)&&t.ranges.push({from:O,to:f})}}l=!1}else if(i&&(o=Ef(i.ranges,n.from,n.to)))l=o!=2;else if(!n.type.isAnonymous&&(s=this.nest(n,this.input))&&(n.from<n.to||!s.overlay)){n.tree||(qf(n),t&&t.depth++,i&&i.depth++);let h=e.findMounts(n.from,s.parser);if(typeof s.overlay=="function")t=new Wf(s.parser,s.overlay,h,this.inner.length,n.from,!!s.bracketed,n.tree,t);else{let c=sl(this.ranges,s.overlay||(n.from<n.to?[new Te(n.from,n.to)]:[]));c.length&&il(c),(c.length||!s.overlay)&&this.inner.push(new tl(s.parser,c.length?s.parser.startParse(this.input,ol(h,c),c):s.parser.startParse(""),s.overlay?s.overlay.map(O=>new Te(O.from-n.from,O.to-n.from)):null,!!s.bracketed,n.tree,c.length?c[0].from:n.from)),s.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):l=!1}}else if(t&&(a=t.predicate(n))&&(a===!0&&(a=new Te(n.from,n.to)),a.from<a.to)){let h=t.ranges.length-1;h>=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&n.firstChild())t&&t.depth++,i&&i.depth++;else for(;!n.nextSibling();){if(!n.parent())break e;if(t&&!--t.depth){let h=sl(this.ranges,t.ranges);h.length&&(il(h),this.inner.splice(t.index,0,new tl(t.parser,t.parser.startParse(this.input,ol(t.mounts,h),h),t.ranges.map(c=>new Te(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function Ef(r,e,t){for(let i of r){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function rl(r,e,t,i,n,s){if(e<t){let o=r.buffer[e+1];i.push(r.slice(e,t,o)),n.push(o-s)}}function qf(r){let{node:e}=r,t=[],i=e.context.buffer;do t.push(r.index),r.parent();while(!r.tree);let n=r.tree,s=n.children.indexOf(i),o=n.children[s],l=o.buffer,a=[s];function h(c,O,f,u,d,g){let m=t[g],Q=[],S=[];rl(o,c,m,Q,S,u);let y=l[m+1],A=l[m+2];a.push(Q.length);let x=g?h(m+4,l[m+3],o.set.types[l[m]],y,A-y,g-1):e.toTree();return Q.push(x),S.push(y-u),rl(o,l[m+3],O,Q,S,u),new W(f,Q,S,d)}n.children[s]=h(0,l.length,re.none,0,o.length,t.length-1);for(let c of a){let O=r.tree.children[c],f=r.tree.positions[c];r.yield(new ce(O,f+r.from,c,r._tree))}}class nl{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(E.IncludeAnonymous|E.IgnoreMounts)}moveTo(e){let{cursor:t}=this,i=e-this.offset;for(;!this.done&&t.from<i;)if(!(t.to>=e&&t.enter(i,1,E.IgnoreOverlays|E.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof W)t=t.children[0];else break}return!1}}let Bf=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(ls))!==null&&t!==void 0?t:i.to,this.inner=new nl(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(ls))!==null&&e!==void 0?e:t.to,this.inner=new nl(t.tree,-t.offset)}}findMounts(e,t){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(i=s.tree)===null||i===void 0?void 0:i.prop(R.mounted);if(o&&o.parser==t)for(let l=this.fragI;l<this.fragments.length;l++){let a=this.fragments[l];if(a.from>=s.to)break;a.tree==this.curFrag.tree&&n.push({frag:a,pos:s.from-a.offset,mount:o})}}}return n}};function sl(r,e){let t=null,i=e;for(let n=1,s=0;n<r.length;n++){let o=r[n-1].to,l=r[n].from;for(;s<i.length;s++){let a=i[s];if(a.from>=l)break;a.to<=o||(t||(i=t=e.slice()),a.from<o?(t[s]=new Te(a.from,o),a.to>l&&t.splice(s+1,0,new Te(l,a.to))):a.to>l?t[s--]=new Te(l,a.to):t.splice(s--,1))}}return i}function Df(r,e,t,i){let n=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=n==r.length?1e9:o?r[n].to:r[n].from,O=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),u=Math.min(c,O,i);f<u&&h.push(new Te(f,u))}if(a=Math.min(c,O),a==1e9)break;c==a&&(o?(o=!1,n++):o=!0),O==a&&(l?(l=!1,s++):l=!0)}return h}function ol(r,e){let t=[];for(let{pos:i,mount:n,frag:s}of r){let o=i+(n.overlay?n.overlay[0].from:0),l=o+n.tree.length,a=Math.max(s.from,o),h=Math.min(s.to,l);if(n.overlay){let c=n.overlay.map(f=>new Te(f.from+i,f.to+i)),O=Df(e,c,a,h);for(let f=0,u=a;;f++){let d=f==O.length,g=d?h:O[f].from;if(g>u&&t.push(new ot(u,g,n.tree,-o,s.from>=u||s.openStart,s.to<=g||s.openEnd)),d)break;u=O[f].to}}else t.push(new ot(a,h,n.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}var ll={};class Wr{constructor(e,t,i,n,s,o,l,a,h,c=0,O){this.p=e,this.stack=t,this.state=i,this.reducePos=n,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=O}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let n=e.parser.context;return new Wr(e,[],t,i,i,0,[],0,n?new al(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,n=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),l=s.dynamicPrecedence(n);if(l&&(this.score+=l),i==0){n<s.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n<s.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(n,this.reducePos);return}let a=this.stack.length-(i-1)*3-(e&262144?6:0),h=a?this.stack[a-2]:this.p.ranges[0].from;n<s.minRepeatTerm&&h==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-h;c>=2e3&&!(!((t=this.p.parser.nodeSet.types[n])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=c));let O=a?this.stack[a-1]:0,f=this.bufferBase+this.buffer.length-O;if(n<s.minRepeatTerm||e&131072){let u=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,h,u,f+4,!0)}if(e&262144)this.state=this.stack[a];else{let u=this.stack[a-3];this.state=s.getGoto(u,n,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(n,h)}storeNode(e,t,i,n=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this.buffer.length;if(o>0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==i)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(e,t,i,n);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>i;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=n}}shift(e,t,i,n){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;this.pos=n;let l=o.stateFlag(s,1);!l&&(n>i||t<=o.maxNode)&&(this.reducePos=n),this.pushState(s,l?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,n,4)}else this.pos=n,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,n,4)}apply(e,t,i,n){e&65536?this.reduce(e):this.shift(e,t,i,n)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),n=e.bufferBase+t;for(;e&&n==e.bufferBase;)e=e.parent;return new Wr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new If(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&n.push(t[s],o);if(this.stack.length<120)for(let s=0;n.length<8&&s<t.length;s+=2){let o=t[s+1];n.some((l,a)=>a&1&&l==o)||n.push(t[s],o)}t=n}let i=[];for(let n=0;n<t.length&&i.length<4;n+=2){let s=t[n+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[n],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let i=t>>19,n=t&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(n,s)=>{if(!t.includes(n))return t.push(n),e.allActions(n,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,s+1);if(l!=null)return l}})};return i(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:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new al(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class al{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class If{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}}class Vr{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Vr(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.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 Vr(this.stack,this.pos,this.index)}}function Ti(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let i=0,n=0;i<r.length;){let s=0;for(;;){let o=r.charCodeAt(i++),l=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[n++]=s:t=new e(s)}return t}class Zr{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const hl=new Zr;class Gf{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=hl,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,n=this.rangeIndex,s=this.pos+e;for(;s<i.from;){if(!n)return null;let o=this.ranges[--n];s-=i.from-o.to,i=o}for(;t<0?s>i.to:s>=i.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];s+=o.from-i.to,i=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,n;if(t>=0&&t<this.chunk.length)i=this.pos+e,n=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(i=s,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,l=this.range;for(;l.to<=i;)l=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),n=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),n}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,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(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,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(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=hl,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(i+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return i}}class Kt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;Oh(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}Kt.prototype.contextual=Kt.prototype.fallback=Kt.prototype.extend=!1;class Er{constructor(e,t,i){this.precTable=t,this.elseToken=i,this.data=typeof e=="string"?Ti(e):e}token(e,t){let i=e.pos,n=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Oh(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||n++,o==null)break;e.reset(o,e.token)}n&&(e.reset(i,e.token),e.acceptToken(this.elseToken,n))}}Er.prototype.contextual=Kt.prototype.fallback=Kt.prototype.extend=!1;class le{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Oh(r,e,t,i,n,s){let o=0,l=1<<i,{dialect:a}=t.p.parser;e:for(;(l&r[o])!=0;){let h=r[o+1];for(let u=o+3;u<h;u+=2)if((r[u+1]&l)>0){let d=r[u];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||Nf(d,e.token.value,n,s))){e.acceptToken(d);break}}let c=e.next,O=0,f=r[o+2];if(e.next<0&&f>O&&r[h+f*3-3]==65535){o=r[h+f*3-1];continue e}for(;O<f;){let u=O+f>>1,d=h+u+(u<<1),g=r[d],m=r[d+1]||65536;if(c<g)f=u;else if(c>=m)O=u+1;else{o=r[d+2],e.advance();continue e}}break}}function cl(r,e,t){for(let i=e,n;(n=r[i])!=65535;i++)if(n==t)return i-e;return-1}function Nf(r,e,t,i){let n=cl(t,i,e);return n<0||cl(t,i,r)<n}const ye=typeof process<"u"&&ll&&/\bparse\b/.test(ll.LOG);let wn=null;function Ol(r,e,t){let i=r.cursor(E.IncludeAnonymous);for(i.moveTo(e);;)if(!(t<0?i.childBefore(e):i.childAfter(e)))for(;;){if((t<0?i.to<e:i.from>e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(r.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:r.length}}let Uf=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Ol(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Ol(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let i=this.trees[t],n=this.index[t];if(n==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=i.children[n],o=this.start[t]+i.positions[n];if(o>e)return this.nextStart=o,null;if(s instanceof W){if(o==e){if(o<this.safeFrom)return null;let l=o+s.length;if(l<=this.safeTo){let a=s.prop(R.lookAhead);if(!a||l+a<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}};class Ff{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Zr)}getActions(e){let t=0,i=null,{parser:n}=e.p,{tokenizers:s}=n,o=n.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;h<s.length;h++){if((1<<h&o)==0)continue;let c=s[h],O=this.tokens[h];if(!(i&&!c.fallback)&&((c.contextual||O.start!=e.pos||O.mask!=o||O.context!=l)&&(this.updateCachedToken(O,c,e),O.mask=o,O.context=l),O.lookAhead>O.end+25&&(a=Math.max(O.lookAhead,a)),O.value!=0)){let f=t;if(O.extended>-1&&(t=this.addActions(e,O.extended,O.end,t)),t=this.addActions(e,O.value,O.end,t),!c.extend&&(i=O,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new Zr,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Zr,{pos:i,p:n}=e;return t.start=i,t.end=Math.min(i+1,n.stream.end),t.value=i==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,i){let n=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(n,e),i),e.value>-1){let{parser:s}=i.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let l=s.specializers[o](this.stream.read(e.start,e.end),i);if(l>=0&&i.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,i,n){for(let s=0;s<n;s+=3)if(this.actions[s]==e)return n;return this.actions[n++]=e,this.actions[n++]=t,this.actions[n++]=i,n}addActions(e,t,i,n){let{state:s}=e,{parser:o}=e.p,{data:l}=o;for(let a=0;a<2;a++)for(let h=o.stateSlot(s,a?2:1);;h+=3){if(l[h]==65535)if(l[h+1]==1)h=rt(l,h+2);else{n==0&&l[h+1]==2&&(n=this.putAction(rt(l,h+2),t,i,n));break}l[h]==t&&(n=this.putAction(rt(l,h+1),t,i,n))}return n}}class Hf{constructor(e,t,i,n){this.parser=e,this.input=t,this.ranges=n,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 Gf(t,n),this.tokens=new Ff(e,this.stream),this.topTerm=e.top[1];let{from:s}=n[0];this.stacks=[Wr.start(this,e.top[0],s)],this.fragments=i.length&&this.stream.end-s>e.bufferLength*4?new Uf(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],n,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let l=e[o];for(;;){if(this.tokens.mainToken=null,l.pos>t)i.push(l);else{if(this.advanceStack(l,i,e))continue;{n||(n=[],s=[]),n.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!i.length){let o=n&&Jf(n);if(o)return ye&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ye&&n&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,s,i);if(o)return ye&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o<i.length-1;o++){let l=i[o];for(let a=o+1;a<i.length;a++){let h=i[a];if(l.sameState(h)||l.buffer.length>500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue e}}}i.length>12&&(i.sort((o,l)=>l.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,i){let n=e.pos,{parser:s}=this,o=ye?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let O=this.fragments.nodeAt(n);O;){let f=this.parser.nodeSet.types[O.type.id]==O.type?s.getGoto(e.state,O.type.id):-1;if(f>-1&&O.length&&(!h||(O.prop(R.contextHash)||0)==c))return e.useNode(O,f),ye&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(O.type.id)})`),!0;if(!(O instanceof W)||O.children.length==0||O.positions[0]>0)break;let u=O.children[0];if(u instanceof W&&O.positions[0]==0)O=u;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),ye&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;h<a.length;){let c=a[h++],O=a[h++],f=a[h++],u=h==a.length||!i,d=u?e:e.split(),g=this.tokens.mainToken;if(d.apply(c,O,g?g.start:d.pos,f),ye&&console.log(o+this.stackID(d)+` (via ${(c&65536)==0?"shift":`reduce of ${s.getName(c&65535)}`} for ${s.getName(O)} @ ${n}${d==e?"":", split"})`),u)return!0;d.pos>n?t.push(d):i.push(d)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return fl(e,t),!0}}runRecovery(e,t,i){let n=null,s=!1;for(let o=0;o<e.length;o++){let l=e[o],a=t[o<<1],h=t[(o<<1)+1],c=ye?this.stackID(l)+" -> ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),ye&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let O=l.split(),f=c;for(let u=0;u<10&&O.forceReduce()&&(ye&&console.log(f+this.stackID(O)+" (via force-reduce)"),!this.advanceFully(O,i));u++)ye&&(f=this.stackID(O)+" -> ");for(let u of l.recoverByInsert(a))ye&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,i);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),ye&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),fl(l,i)):(!n||n.score<O.score)&&(n=O)}return n}stackToTree(e){return e.close(),W.build({buffer:Vr.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(wn||(wn=new WeakMap)).get(e);return t||wn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function fl(r,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==r.pos&&i.sameState(r)){e[t].score<r.score&&(e[t]=r);return}}e.push(r)}class Kf{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}const vn=r=>r;class fo{constructor(e){this.start=e.start,this.shift=e.shift||vn,this.reduce=e.reduce||vn,this.reuse=e.reuse||vn,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class St extends Oo{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;l<e.repeatNodeCount;l++)t.push("");let i=Object.keys(e.topRules).map(l=>e.topRules[l][1]),n=[];for(let l=0;l<t.length;l++)n.push([]);function s(l,a,h){n[l].push([a,a.deserialize(String(h))])}if(e.nodeProps)for(let l of e.nodeProps){let a=l[0];typeof a=="string"&&(a=R[a]);for(let h=1;h<l.length;){let c=l[h++];if(c>=0)s(c,a,l[h++]);else{let O=l[h+-c];for(let f=-c;f>0;f--)s(l[h++],a,O);h++}}}this.nodeSet=new ir(t.map((l,a)=>re.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:n[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=sh;let o=Ti(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(ul),this.states=Ti(e.states,Uint32Array),this.data=Ti(e.stateData),this.goto=Ti(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(l=>typeof l=="number"?new Kt(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let n=new Hf(this,e,t,i);for(let s of this.wrappers)n=s(n,e,t,i);return n}getGoto(e,t,i=!1){let n=this.goto;if(t>=n[0])return-1;for(let s=n[t+1];;){let o=n[s++],l=o&1,a=n[s++];if(l&&i)return a;for(let h=s+(o>>1);s<h;s++)if(n[s]==e)return a;if(l)return-1}}hasAction(e,t){let i=this.data;for(let n=0;n<2;n++)for(let s=this.stateSlot(e,n?2:1),o;;s+=3){if((o=i[s])==65535)if(i[s+1]==1)o=i[s=rt(i,s+2)];else{if(i[s+1]==2)return rt(i,s+2);break}if(o==t||o==0)return rt(i,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),n=i?t(i):void 0;for(let s=this.stateSlot(e,1);n==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=rt(this.data,s+2);else break;n=t(rt(this.data,s+1))}return n}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=rt(this.data,i+2);else break;if((this.data[i+2]&1)==0){let n=this.data[i+1];t.some((s,o)=>o&1&&s==n)||t.push(this.data[i],n)}}return t}configure(e){let t=Object.assign(Object.create(St.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let n=e.tokenizers.find(s=>s.from==i);return n?n.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,n)=>{let s=e.specializers.find(l=>l.from==i.external);if(!s)return i;let o=Object.assign(Object.assign({},i),{external:s.to});return t.specializers[n]=ul(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(i[o]=!0)}let n=null;for(let s=0;s<t.length;s++)if(!i[s])for(let o=this.dialects[t[s]],l;(l=this.data[o++])!=65535;)(n||(n=new Uint8Array(this.maxTerm+1)))[l]=1;return new Kf(e,i,n)}static deserialize(e){return new St(e)}}function rt(r,e){return r[e]|r[e+1]<<16}function Jf(r){let e=null;for(let t of r){let i=t.p.stoppedAt;(t.pos==t.p.stream.end||i!=null&&t.pos>i)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function ul(r){if(r.external){let e=r.extend?1:0;return(t,i)=>r.external(t,i)<<1|e}return r.get}let eu=0,De=class as{constructor(e,t,i,n){this.name=e,this.set=t,this.base=i,this.modified=n,this.id=eu++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof as&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let n=new as(i,[],null,[]);if(n.set.push(n),t)for(let s of t.set)n.set.push(s);return n}static defineModifier(e){let t=new qr(e);return i=>i.modified.indexOf(t)>-1?i:qr.get(i.base||i,i.modified.concat(t).sort((n,s)=>n.id-s.id))}},tu=0;class qr{constructor(e){this.name=e,this.instances=[],this.id=tu++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&iu(t,l.modified));if(i)return i;let n=[],s=new De(e.name,n,e,t);for(let l of t)l.instances.push(s);let o=ru(t);for(let l of e.set)if(!l.modified.length)for(let a of o)n.push(qr.get(l,a));return s}}function iu(r,e){return r.length==e.length&&r.every((t,i)=>t==e[i])}function ru(r){let e=[[]];for(let t=0;t<r.length;t++)for(let i=0,n=e.length;i<n;i++)e.push(e[i].concat(r[t]));return e.sort((t,i)=>i.length-t.length)}function $t(r){let e=Object.create(null);for(let t in r){let i=r[t];Array.isArray(i)||(i=[i]);for(let n of t.split(" "))if(n){let s=[],o=2,l=n;for(let O=0;;){if(l=="..."&&O>0&&O+3==n.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+n);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),O+=f[0].length,O==n.length)break;let u=n[O++];if(O==n.length&&u=="!"){o=0;break}if(u!="/")throw new RangeError("Invalid path: "+n);l=n.slice(O)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+n);let c=new Vi(i,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return fh.add(e)}const fh=new R({combine(r,e){let t,i,n;for(;r||e;){if(!r||e&&r.depth>=e.depth?(n=e,e=e.next):(n=r,r=r.next),t&&t.mode==n.mode&&!n.context&&!t.context)continue;let s=new Vi(n.tags,n.mode,n.context);t?t.next=s:i=s,t=s}return i}});class Vi{constructor(e,t,i,n){this.tags=e,this.mode=t,this.context=i,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Vi.empty=new Vi([],2,null);function uh(r,e){let t=Object.create(null);for(let s of r)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:i,all:n=null}=e||{};return{style:s=>{let o=n;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function nu(r,e){let t=null;for(let i of r){let n=i.style(e);n&&(t=t?t+" "+n:n)}return t}function su(r,e,t,i=0,n=r.length){let s=new ou(i,Array.isArray(e)?e:[e],t);s.highlightRange(r.cursor(),i,n,"",s.highlighters),s.flush(n)}class ou{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,n,s){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(s=this.highlighters.filter(u=>!u.scope||u.scope(o)));let h=n,c=lu(e)||Vi.empty,O=nu(s,c.tags);if(O&&(h&&(h+=" "),h+=O,c.mode==1&&(n+=(n?" ":"")+O)),this.startSpan(Math.max(t,l),h),c.opaque)return;let f=e.tree&&e.tree.prop(R.mounted);if(f&&f.overlay){let u=e.node.enter(f.overlay[0].from+l,1),d=this.highlighters.filter(m=>!m.scope||m.scope(f.tree.type)),g=e.firstChild();for(let m=0,Q=l;;m++){let S=m<f.overlay.length?f.overlay[m]:null,y=S?S.from+l:a,A=Math.max(t,Q),x=Math.min(i,y);if(A<x&&g)for(;e.from<x&&(this.highlightRange(e,A,x,n,s),this.startSpan(Math.min(x,e.to),h),!(e.to>=y||!e.nextSibling())););if(!S||y>i)break;Q=S.to+l,Q>t&&(this.highlightRange(u.cursor(),Math.max(t,S.from+l),Math.min(i,Q),"",d),this.startSpan(Math.min(i,Q),h))}g&&e.parent()}else if(e.firstChild()){f&&(n="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,n,s),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function lu(r){let e=r.type.prop(fh);for(;e&&e.context&&!r.matchContext(e.context);)e=e.next;return e||null}const P=De.define,fr=P(),dt=P(),dl=P(dt),pl=P(dt),pt=P(),ur=P(pt),Tn=P(pt),Be=P(),Tt=P(Be),Ve=P(),Ee=P(),hs=P(),bi=P(hs),dr=P(),p={comment:fr,lineComment:P(fr),blockComment:P(fr),docComment:P(fr),name:dt,variableName:P(dt),typeName:dl,tagName:P(dl),propertyName:pl,attributeName:P(pl),className:P(dt),labelName:P(dt),namespace:P(dt),macroName:P(dt),literal:pt,string:ur,docString:P(ur),character:P(ur),attributeValue:P(ur),number:Tn,integer:P(Tn),float:P(Tn),bool:P(pt),regexp:P(pt),escape:P(pt),color:P(pt),url:P(pt),keyword:Ve,self:P(Ve),null:P(Ve),atom:P(Ve),unit:P(Ve),modifier:P(Ve),operatorKeyword:P(Ve),controlKeyword:P(Ve),definitionKeyword:P(Ve),moduleKeyword:P(Ve),operator:Ee,derefOperator:P(Ee),arithmeticOperator:P(Ee),logicOperator:P(Ee),bitwiseOperator:P(Ee),compareOperator:P(Ee),updateOperator:P(Ee),definitionOperator:P(Ee),typeOperator:P(Ee),controlOperator:P(Ee),punctuation:hs,separator:P(hs),bracket:bi,angleBracket:P(bi),squareBracket:P(bi),paren:P(bi),brace:P(bi),content:Be,heading:Tt,heading1:P(Tt),heading2:P(Tt),heading3:P(Tt),heading4:P(Tt),heading5:P(Tt),heading6:P(Tt),contentSeparator:P(Be),list:P(Be),quote:P(Be),emphasis:P(Be),strong:P(Be),link:P(Be),monospace:P(Be),strikethrough:P(Be),inserted:P(),deleted:P(),changed:P(),invalid:P(),meta:dr,documentMeta:P(dr),annotation:P(dr),processingInstruction:P(dr),definition:De.defineModifier("definition"),constant:De.defineModifier("constant"),function:De.defineModifier("function"),standard:De.defineModifier("standard"),local:De.defineModifier("local"),special:De.defineModifier("special")};for(let r in p){let e=p[r];e instanceof De&&(e.name=r)}uh([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);const au=135,gl=1,hu=136,cu=137,dh=2,Ou=138,fu=3,uu=4,ph=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],du=58,pu=40,gh=95,gu=91,Cr=45,mu=46,Qu=35,Su=37,bu=38,ku=92,yu=10,xu=42;function Ei(r){return r>=65&&r<=90||r>=97&&r<=122||r>=161}function uo(r){return r>=48&&r<=57}function ml(r){return uo(r)||r>=97&&r<=102||r>=65&&r<=70}const mh=(r,e,t)=>(i,n)=>{for(let s=!1,o=0,l=0;;l++){let{next:a}=i;if(Ei(a)||a==Cr||a==gh||s&&uo(a))!s&&(a!=Cr||l>0)&&(s=!0),o===l&&a==Cr&&o++,i.advance();else if(a==ku&&i.peek(1)!=yu){if(i.advance(),ml(i.next)){do i.advance();while(ml(i.next));i.next==32&&i.advance()}else i.next>-1&&i.advance();s=!0}else{s&&i.acceptToken(o==2&&n.canShift(dh)?e:a==pu?t:r);break}}},Pu=new le(mh(hu,dh,cu),{contextual:!0}),$u=new le(mh(Ou,fu,uu),{contextual:!0}),wu=new le(r=>{if(ph.includes(r.peek(-1))){let{next:e}=r;(Ei(e)||e==gh||e==Qu||e==mu||e==xu||e==gu||e==du&&Ei(r.peek(1))||e==Cr||e==bu)&&r.acceptToken(au)}}),vu=new le(r=>{if(!ph.includes(r.peek(-1))){let{next:e}=r;if(e==Su&&(r.advance(),r.acceptToken(gl)),Ei(e)){do r.advance();while(Ei(r.next)||uo(r.next));r.acceptToken(gl)}}}),Tu=$t({"AtKeyword import charset namespace keyframes media supports font-feature-values":p.definitionKeyword,"from to selector scope MatchFlag":p.keyword,NamespaceName:p.namespace,KeyframeName:p.labelName,KeyframeRangeName:p.operatorKeyword,TagName:p.tagName,ClassName:p.className,PseudoClassName:p.constant(p.className),IdName:p.labelName,"FeatureName PropertyName":p.propertyName,AttributeName:p.attributeName,NumberLiteral:p.number,KeywordQuery:p.keyword,UnaryQueryOp:p.operatorKeyword,"CallTag ValueName FontName":p.atom,VariableName:p.variableName,Callee:p.operatorKeyword,Unit:p.unit,"UniversalSelector NestingSelector":p.definitionOperator,"MatchOp CompareOp":p.compareOperator,"ChildOp SiblingOp, LogicOp":p.logicOperator,BinOp:p.arithmeticOperator,Important:p.modifier,Comment:p.blockComment,ColorLiteral:p.color,"ParenthesizedContent StringLiteral":p.string,":":p.punctuation,"PseudoOp #":p.derefOperator,"; , |":p.separator,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace}),Xu={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:90,url:132,"url-prefix":132,domain:132,regexp:132},Zu={__proto__:null,or:104,and:104,not:112,only:112,layer:186},Cu={__proto__:null,selector:118,layer:182},Ru={__proto__:null,"@import":178,"@media":190,"@charset":194,"@namespace":198,"@keyframes":204,"@supports":216,"@scope":220,"@font-feature-values":226},Au={__proto__:null,to:223},Mu=St.deserialize({version:14,states:"IpQYQdOOO#}QdOOP$UO`OOO%OQaO'#CfOOQP'#Ce'#CeO%VQdO'#CgO%[Q`O'#CgO%aQaO'#FdO&XQdO'#CkO&xQaO'#CcO'SQdO'#CnO'_QdO'#DtO'dQdO'#DvO'oQdO'#D}O'oQdO'#EQOOQP'#Fd'#FdO)OQhO'#EsOOQS'#Fc'#FcOOQS'#Ev'#EvQYQdOOO)VQdO'#EWO*cQhO'#E^O)VQdO'#E`O*jQdO'#EbO*uQdO'#EeO)zQhO'#EkO*}QdO'#EmO+YQdO'#EpO+_QaO'#CfO+fQ`O'#ETO+kQ`O'#FnO+vQdO'#FnQOQ`OOP,QO&jO'#CaPOOO)CAR)CAROOQP'#Ci'#CiOOQP,59R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!qQ&n%oR'm'_R!}gR#PhR$q#PS&O$p&PR'f&wV%|$p&P&wR#XkQ#_qR%Q#_QcOSoP!RU!kco$}R$}#ZQ%Z#pY&`%Z&f'U'^'sQ&f%_Q'U&aQ'^&kR's'kQ$Y!mQ$[!nQ$^!oV%j$Y$[$^Q%t$gR&t%tQ&j%gS']&j'lR'l'^Q&b%ZR'V&bQ&^%WR'T&^Q!QXR#l!QQ&W$yR'O&WQ#[nS%O#[%PR%P#]Q'`&nR'n'`Q$k!xR%x$kQ&P$pR&z&PQ&x&OR'g&xQ#WkR$w#WQ$O!dR%d$O_bOPco!R#Z$}^XOPco!R#Z$}Q!`]Q!a^Q#h|Q#i}Q#j!OQ#k!PQ$s#RQ%W#oR'S&]R%[#pQ!qdQ!zf[$V!m!n!o$Y$[$^Q$y#Yd%Y#p%Z%_&a&f&k'U'^'k'sQ%^#uQ%n$aS&U$y&WQ&[%UQ&}&VR'b&p]$X!m!n!o$Y$[$^Q!d`U!xe!q$eQ#QiQ#x!cS#{!d$OQ$Q!eQ%b#|Q%c#}Q%g$RS%r$g%tQ%w$jR'Z&iQ#z!cQ&h%`R'j'YR%i$RR%X#oQpPR#n!RQ!yeQ$d!qR%q$e",nodeNames:"⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NamespacedTagSelector NamespaceName TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , PseudoQuery CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName NamespacedAttribute NamespaceName AttributeName MatchOp MatchFlag ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to FontFeatureStatement font-feature-values FontName AtRule Styles",maxTerm:159,nodeProps:[["isolate",-2,5,39,""],["openedBy",23,"(",31,"[",34,"{"],["closedBy",24,")",32,"]",35,"}"]],propSources:[Tu],skippedNodes:[0,5,117],repeatNodeCount:17,tokenData:"K`~R!bOX%ZX^&R^p%Zpq&Rqr)ers)vst+jtu2Xuv%Zvw3Rwx3dxy5Ryz5dz{5i{|6S|}:u}!O;W!O!P;u!P!Q<^!Q![=V![!]>Q!]!^>|!^!_?_!_!`@Z!`!a@n!a!b%Z!b!cAo!c!k%Z!k!lC|!l!u%Z!u!vC|!v!}%Z!}#OD_#O#P%Z#P#QDp#Q#R2X#R#]%Z#]#^ER#^#g%Z#g#hC|#h#o%Z#o#pIf#p#qIw#q#rJ`#r#sJq#s#y%Z#y#z&R#z$f%Z$f$g&R$g#BY%Z#BY#BZ&R#BZ$IS%Z$IS$I_&R$I_$I|%Z$I|$JO&R$JO$JT%Z$JT$JU&R$JU$KV%Z$KV$KW&R$KW&FU%Z&FU&FV&R&FV;'S%Z;'S;=`KY<%lO%Z`%^SOy%jz;'S%j;'S;=`%{<%lO%j`%oS!e`Oy%jz;'S%j;'S;=`%{<%lO%j`&OP;=`<%l%j~&Wh$Q~OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ'r#BZ$IS%j$IS$I_'r$I_$I|%j$I|$JO'r$JO$JT%j$JT$JU'r$JU$KV%j$KV$KW'r$KW&FU%j&FU&FV'r&FV;'S%j;'S;=`%{<%lO%j~'yh$Q~!e`OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ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[z{a~~g~aO$T~~dP!P!Qg~lO$U~~",28,142)],topRules:{StyleSheet:[0,6],Styles:[1,116]},dynamicPrecedences:{84:1},specialized:[{term:137,get:r=>Xu[r]||-1},{term:138,get:r=>Zu[r]||-1},{term:4,get:r=>Cu[r]||-1},{term:28,get:r=>Ru[r]||-1},{term:136,get:r=>Au[r]||-1}],tokenPrec:2256});let cs=[],Qh=[];(()=>{let r="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<r.length;e++)(e%2?Qh:cs).push(t=t+r[e])})();function ju(r){if(r<768)return!1;for(let e=0,t=cs.length;;){let i=e+t>>1;if(r<cs[i])t=i;else if(r>=Qh[i])e=i+1;else return!0;if(e==t)return!1}}function Ql(r){return r>=127462&&r<=127487}const Sl=8205;function zu(r,e,t=!0,i=!0){return(t?Sh:Lu)(r,e,i)}function Sh(r,e,t){if(e==r.length)return e;e&&bh(r.charCodeAt(e))&&kh(r.charCodeAt(e-1))&&e--;let i=Xn(r,e);for(e+=bl(i);e<r.length;){let n=Xn(r,e);if(i==Sl||n==Sl||t&&ju(n))e+=bl(n),i=n;else if(Ql(n)){let s=0,o=e-2;for(;o>=0&&Ql(Xn(r,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Lu(r,e,t){for(;e>0;){let i=Sh(r,e-2,t);if(i<e)return i;e--}return 0}function Xn(r,e){let t=r.charCodeAt(e);if(!kh(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return bh(i)?(t-55296<<10)+(i-56320)+65536:t}function bh(r){return r>=56320&&r<57344}function kh(r){return r>=55296&&r<56320}function bl(r){return r<65536?1:2}class L{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=ni(this,e,t);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),Ie.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ni(this,e,t);let i=[];return this.decompose(e,t,i,0),Ie.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new Ri(this),s=new Ri(e);for(let o=t,l=t;;){if(n.next(o),s.next(o),o=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(l+=n.value.length,n.done||l>=i)return!0}}iter(e=1){return new Ri(this,e)}iterRange(e,t=this.length){return new yh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new xh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?L.empty:e.length<=32?new ee(e):Ie.from(ee.split(e,[]))}}class ee extends L{constructor(e,t=Yu(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let s=0;;s++){let o=this.text[s],l=n+o.length;if((t?i:l)>=e)return new _u(n,l,i,o);n=l+1,i++}}decompose(e,t,i,n){let s=e<=0&&t>=this.length?this:new ee(kl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let o=i.pop(),l=Rr(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new ee(l,o.length+s.length));else{let a=l.length>>1;i.push(new ee(l.slice(0,a)),new ee(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof ee))return super.replace(e,t,i);[e,t]=ni(this,e,t);let n=Rr(this.text,Rr(i.text,kl(this.text,0,e)),t),s=this.length+i.length-(t-e);return n.length<=32?new ee(n,s):Ie.from(ee.split(n,[]),s)}sliceString(e,t=this.length,i=`
|
|
1
|
+
import{r as It,j as Rf}from"./index-BEojL6wP.js";const sh=1024;let Af=0,Te=class{constructor(e,t){this.from=e,this.to=t}};class R{constructor(e={}){this.id=Af++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=re.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}R.closedBy=new R({deserialize:r=>r.split(" ")});R.openedBy=new R({deserialize:r=>r.split(" ")});R.group=new R({deserialize:r=>r.split(" ")});R.isolate=new R({deserialize:r=>{if(r&&r!="rtl"&&r!="ltr"&&r!="auto")throw new RangeError("Invalid value for isolate: "+r);return r||"auto"}});R.contextHash=new R({perNode:!0});R.lookAhead=new R({perNode:!0});R.mounted=new R({perNode:!0});class Ht{constructor(e,t,i,n=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=n}static get(e){return e&&e.props&&e.props[R.mounted.id]}}const Mf=Object.create(null);class re{constructor(e,t,i,n=0){this.name=e,this.props=t,this.id=i,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):Mf,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new re(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(n)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(R.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let n of i.split(" "))t[n]=e[i];return i=>{for(let n=i.prop(R.group),s=-1;s<(n?n.length:0);s++){let o=t[s<0?i.name:n[s]];if(o)return o}}}}re.none=new re("",Object.create(null),0,8);class ir{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let n=null;for(let s of e){let o=s(i);if(o){n||(n=Object.assign({},i.props));let l=o[1],a=o[0];a.combine&&a.id in n&&(l=a.combine(n[a.id],l)),n[a.id]=l}}t.push(n?new re(i.name,n,i.id,i.flags):i)}return new ir(t)}}const Or=new WeakMap,Ko=new WeakMap;var E;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays",r[r.EnterBracketed=16]="EnterBracketed"})(E||(E={}));class W{constructor(e,t,i,n,s){if(this.type=e,this.children=t,this.positions=i,this.length=n,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=Ht.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let n=i.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new _r(this.topNode,e)}cursorAt(e,t=0,i=0){let n=Or.get(this)||this.topNode,s=new _r(n);return s.moveTo(e,t),Or.set(this,s._tree),s}get topNode(){return new ce(this,0,0,null)}resolve(e,t=0){let i=Wi(Or.get(this)||this.topNode,e,t,!1);return Or.set(this,i),i}resolveInner(e,t=0){let i=Wi(Ko.get(this)||this.topNode,e,t,!0);return Ko.set(this,i),i}resolveStack(e,t=0){return Lf(this,e,t)}iterate(e){let{enter:t,leave:i,from:n=0,to:s=this.length}=e,o=e.mode||0,l=(o&E.IncludeAnonymous)>0;for(let a=this.cursor(o|E.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=n&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:co(re.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,n)=>new W(this.type,t,i,n,this.propValues),e.makeTree||((t,i,n)=>new W(re.none,t,i,n)))}static build(e){return Yf(e)}}W.empty=new W(re.none,[],[],0);class ao{constructor(e,t){this.buffer=e,this.index=t}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]}get pos(){return this.index}next(){this.index-=4}fork(){return new ao(this.buffer,this.index)}}class Qt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return re.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],n=this.set.types[t],s=n.name;if(/\W/.test(s)&&!n.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,i,n,s){let{buffer:o}=this,l=-1;for(let a=e;a!=t&&!(oh(s,n,o[a+1],o[a+2])&&(l=a,i>0));a=o[a+3]);return l}slice(e,t,i){let n=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){s[a++]=n[l++],s[a++]=n[l++]-i;let h=s[a++]=n[l++]-i;s[a++]=n[l++]-e,o=Math.max(o,h)}return new Qt(s,o,this.set)}}function oh(r,e,t,i){switch(r){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Wi(r,e,t,i){for(var n;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let o=!i&&r instanceof ce&&r.index<0?null:r.parent;if(!o)return r;r=o}let s=i?0:E.IgnoreOverlays;if(i)for(let o=r,l=o.parent;l;o=l,l=o.parent)o instanceof ce&&o.index<0&&((n=l.enter(e,t,s))===null||n===void 0?void 0:n.from)!=o.from&&(r=l);for(;;){let o=r.enter(e,t,s);if(!o)return r;r=o}}class lh{cursor(e=0){return new _r(this,e)}getChild(e,t=null,i=null){let n=Jo(this,e,t,i);return n.length?n[0]:null}getChildren(e,t=null,i=null){return Jo(this,e,t,i)}resolve(e,t=0){return Wi(this,e,t,!1)}resolveInner(e,t=0){return Wi(this,e,t,!0)}matchContext(e){return os(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let n=t.lastChild;if(!n||n.to!=t.to)break;n.type.isError&&n.from==n.to?(i=t,t=n.prevSibling):t=n}return i}get node(){return this}get next(){return this.parent}}class ce extends lh{constructor(e,t,i,n){super(),this._tree=e,this.from=t,this.index=i,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,n,s=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,h=t>0?l.length:-1;e!=h;e+=t){let c=l[e],O=a[e]+o.from,f;if(!(!(s&E.EnterBracketed&&c instanceof W&&(f=Ht.get(c))&&!f.overlay&&f.bracketed&&i>=O&&i<=O+c.length)&&!oh(n,i,O,O+c.length))){if(c instanceof Qt){if(s&E.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-O,n);if(u>-1)return new Ne(new jf(o,c,e,O),null,u)}else if(s&E.IncludeAnonymous||!c.type.isAnonymous||ho(c)){let u;if(!(s&E.IgnoreMounts)&&(u=Ht.get(c))&&!u.overlay)return new ce(u.tree,O,e,o);let d=new ce(c,O,e,o);return s&E.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,n,s)}}}if(s&E.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let n;if(!(i&E.IgnoreOverlays)&&(n=Ht.get(this._tree))&&n.overlay){let s=e-this.from,o=i&E.EnterBracketed&&n.bracketed;for(let{from:l,to:a}of n.overlay)if((t>0||o?l<=s:l<s)&&(t<0||o?a>=s:a>s))return new ce(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Jo(r,e,t,i){let n=r.cursor(),s=[];if(!n.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=n.type.is(t),!n.nextSibling())return s}for(;;){if(i!=null&&n.type.is(i))return s;if(n.type.is(e)&&s.push(n.node),!n.nextSibling())return i==null?s:[]}}function os(r,e,t=e.length-1){for(let i=r;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class jf{constructor(e,t,i,n){this.parent=e,this.buffer=t,this.index=i,this.start=n}}class Ne extends lh{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new Ne(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&E.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new Ne(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Ne(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Ne(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,n=this.index+4,s=i.buffer[this.index+3];if(s>n){let o=i.buffer[this.index+1];e.push(i.slice(n,s,o)),t.push(0)}return new W(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ah(r){if(!r.length)return null;let e=0,t=r[0];for(let s=1;s<r.length;s++){let o=r[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let i=t instanceof ce&&t.index<0?null:t.parent,n=r.slice();return i?n[e]=i:n.splice(e,1),new zf(n,t)}class zf{constructor(e,t){this.heads=e,this.node=t}get next(){return ah(this.heads)}}function Lf(r,e,t){let i=r.resolveInner(e,t),n=null;for(let s=i instanceof ce?i:i.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(n||(n=[i])).push(o.resolve(e,t)),s=o}else{let o=Ht.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new ce(o.tree,o.overlay[0].from+s.from,-1,s);(n||(n=[i])).push(Wi(l,e,t,!1))}}return n?ah(n):i}class _r{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~E.EnterBracketed,e instanceof ce)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=i+n.buffer[e+1],this.to=i+n.buffer[e+2],!0}yield(e){return e?e instanceof ce?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&E.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&E.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&E.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(n)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(n.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=n)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,o=e<0?-1:i._tree.children.length;s!=o;s+=e){let l=i._tree.children[s];if(this.mode&E.IncludeAnonymous||l instanceof Qt||!l.type.isAnonymous||ho(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let n=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==n){if(n==this.index)return o;t=o,i=s+1;break e}n=this.stack[--s]}for(let n=i;n<this.stack.length;n++)t=new Ne(this.buffer,t,this.stack[n]);return this.bufferNode=new Ne(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let n=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,n=!0}}}matchContext(e){if(!this.buffer)return os(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let n=e.length-1,s=this.stack.length-1;n>=0;s--){if(s<0)return os(this._tree,e,n);let o=i[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}}function ho(r){return r.children.some(e=>e instanceof Qt||!e.type.isAnonymous||ho(e))}function Yf(r){var e;let{buffer:t,nodeSet:i,maxBufferLength:n=sh,reused:s=[],minRepeatType:o=i.types.length}=r,l=Array.isArray(t)?new ao(t,t.length):t,a=i.types,h=0,c=0;function O(x,w,$,Y,j,D){let{id:M,start:C,end:q,size:_}=l,G=c,fe=h;if(_<0)if(l.next(),_==-1){let tt=s[M];$.push(tt),Y.push(C-x);return}else if(_==-3){h=M;return}else if(_==-4){c=M;return}else throw new RangeError(`Unrecognized record size: ${_}`);let ke=a[M],_e,ne,we=C-x;if(q-C<=n&&(ne=m(l.pos-w,j))){let tt=new Uint16Array(ne.size-ne.skip),ve=l.pos-ne.size,We=tt.length;for(;l.pos>ve;)We=Q(ne.start,tt,We);_e=new Qt(tt,q-ne.start,i),we=ne.start-x}else{let tt=l.pos-_;l.next();let ve=[],We=[],vt=M>=o?M:-1,Dt=0,cr=q;for(;l.pos>tt;)vt>=0&&l.id==vt&&l.size>=0?(l.end<=cr-n&&(d(ve,We,C,Dt,l.end,cr,vt,G,fe),Dt=ve.length,cr=l.end),l.next()):D>2500?f(C,tt,ve,We):O(C,tt,ve,We,vt,D+1);if(vt>=0&&Dt>0&&Dt<ve.length&&d(ve,We,C,Dt,C,cr,vt,G,fe),ve.reverse(),We.reverse(),vt>-1&&Dt>0){let Ho=u(ke,fe);_e=co(ke,ve,We,0,ve.length,0,q-C,Ho,Ho)}else _e=g(ke,ve,We,q-C,G-q,fe)}$.push(_e),Y.push(we)}function f(x,w,$,Y){let j=[],D=0,M=-1;for(;l.pos>w;){let{id:C,start:q,end:_,size:G}=l;if(G>4)l.next();else{if(M>-1&&q<M)break;M<0&&(M=_-n),j.push(C,q,_),D++,l.next()}}if(D){let C=new Uint16Array(D*4),q=j[j.length-2];for(let _=j.length-3,G=0;_>=0;_-=3)C[G++]=j[_],C[G++]=j[_+1]-q,C[G++]=j[_+2]-q,C[G++]=G;$.push(new Qt(C,j[2]-q,i)),Y.push(q-x)}}function u(x,w){return($,Y,j)=>{let D=0,M=$.length-1,C,q;if(M>=0&&(C=$[M])instanceof W){if(!M&&C.type==x&&C.length==j)return C;(q=C.prop(R.lookAhead))&&(D=Y[M]+C.length+q)}return g(x,$,Y,j,D,w)}}function d(x,w,$,Y,j,D,M,C,q){let _=[],G=[];for(;x.length>Y;)_.push(x.pop()),G.push(w.pop()+$-j);x.push(g(i.types[M],_,G,D-j,C-D,q)),w.push(j-$)}function g(x,w,$,Y,j,D,M){if(D){let C=[R.contextHash,D];M=M?[C].concat(M):[C]}if(j>25){let C=[R.lookAhead,j];M=M?[C].concat(M):[C]}return new W(x,w,$,Y,M)}function m(x,w){let $=l.fork(),Y=0,j=0,D=0,M=$.end-n,C={size:0,start:0,skip:0};e:for(let q=$.pos-x;$.pos>q;){let _=$.size;if($.id==w&&_>=0){C.size=Y,C.start=j,C.skip=D,D+=4,Y+=4,$.next();continue}let G=$.pos-_;if(_<0||G<q||$.start<M)break;let fe=$.id>=o?4:0,ke=$.start;for($.next();$.pos>G;){if($.size<0)if($.size==-3||$.size==-4)fe+=4;else break e;else $.id>=o&&(fe+=4);$.next()}j=ke,Y+=_,D+=fe}return(w<0||Y==x)&&(C.size=Y,C.start=j,C.skip=D),C.size>4?C:void 0}function Q(x,w,$){let{id:Y,start:j,end:D,size:M}=l;if(l.next(),M>=0&&Y<o){let C=$;if(M>4){let q=l.pos-(M-4);for(;l.pos>q;)$=Q(x,w,$)}w[--$]=C,w[--$]=D-x,w[--$]=j-x,w[--$]=Y}else M==-3?h=Y:M==-4&&(c=Y);return $}let S=[],y=[];for(;l.pos>0;)O(r.start||0,r.bufferStart||0,S,y,-1,0);let A=(e=r.length)!==null&&e!==void 0?e:S.length?y[0]+S[0].length:0;return new W(a[r.topID],S.reverse(),y.reverse(),A)}const el=new WeakMap;function Xr(r,e){if(!r.isAnonymous||e instanceof Qt||e.type!=r)return 1;let t=el.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=r||!(i instanceof W)){t=1;break}t+=Xr(r,i)}el.set(e,t)}return t}function co(r,e,t,i,n,s,o,l,a){let h=0;for(let d=i;d<n;d++)h+=Xr(r,e[d]);let c=Math.ceil(h*1.5/8),O=[],f=[];function u(d,g,m,Q,S){for(let y=m;y<Q;){let A=y,x=g[y],w=Xr(r,d[y]);for(y++;y<Q;y++){let $=Xr(r,d[y]);if(w+$>=c)break;w+=$}if(y==A+1){if(w>c){let $=d[A];u($.children,$.positions,0,$.children.length,g[A]+S);continue}O.push(d[A])}else{let $=g[y-1]+d[y-1].length-x;O.push(co(r,d,g,A,y,x,$,null,a))}f.push(x+S-s)}}return u(e,t,i,n,0),(l||a)(O,f,o)}class hh{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof Ne?this.setBuffer(e.context.buffer,e.index,t):e instanceof ce&&this.map.set(e.tree,t)}get(e){return e instanceof Ne?this.getBuffer(e.context.buffer,e.index):e instanceof ce?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class ot{constructor(e,t,i,n,s=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=n,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let n=[new ot(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&n.push(s);return n}static applyChanges(e,t,i=128){if(!t.length)return e;let n=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l<t.length?t[l]:null,O=c?c.fromA:1e9;if(O-a>=i)for(;o&&o.from<O;){let f=o;if(a>=f.from||O<=f.to||h){let u=Math.max(f.from,a)-h,d=Math.min(f.to,O)-h;f=u>=d?null:new ot(u,d,f.tree,f.offset+h,l>0,!!c)}if(f&&n.push(f),o.to>O)break;o=s<e.length?e[s++]:null}if(!c)break;a=c.toA,h=c.toA-c.toB}return n}}class Oo{startParse(e,t,i){return typeof e=="string"&&(e=new _f(e)),i=i?i.length?i.map(n=>new Te(n.from,n.to)):[new Te(0,0)]:[new Te(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let n=this.startParse(e,t,i);for(;;){let s=n.advance();if(s)return s}}}class _f{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function ch(r){return(e,t,i,n)=>new Vf(e,r,t,i,n)}class tl{constructor(e,t,i,n,s,o){this.parser=e,this.parse=t,this.overlay=i,this.bracketed=n,this.target=s,this.from=o}}function il(r){if(!r.length||r.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(r))}class Wf{constructor(e,t,i,n,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=i,this.index=n,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const ls=new R({perNode:!0});class Vf{constructor(e,t,i,n,s){this.nest=t,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new W(i.type,i.children,i.positions,i.length,i.propValues.concat([[ls,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[R.mounted.id]=new Ht(t,e.overlay,e.parser,e.bracketed),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new Bf(this.fragments),t=null,i=null,n=new _r(new ce(this.baseTree,this.ranges[0].from,0,null),E.IncludeAnonymous|E.IgnoreMounts);e:for(let s,o;;){let l=!0,a;if(this.stoppedAt!=null&&n.from>=this.stoppedAt)l=!1;else if(e.hasNode(n)){if(t){let h=t.mounts.find(c=>c.frag.from<=n.from&&c.frag.to>=n.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let O=c.from+h.pos,f=c.to+h.pos;O>=n.from&&f<=n.to&&!t.ranges.some(u=>u.from<f&&u.to>O)&&t.ranges.push({from:O,to:f})}}l=!1}else if(i&&(o=Ef(i.ranges,n.from,n.to)))l=o!=2;else if(!n.type.isAnonymous&&(s=this.nest(n,this.input))&&(n.from<n.to||!s.overlay)){n.tree||(qf(n),t&&t.depth++,i&&i.depth++);let h=e.findMounts(n.from,s.parser);if(typeof s.overlay=="function")t=new Wf(s.parser,s.overlay,h,this.inner.length,n.from,!!s.bracketed,n.tree,t);else{let c=sl(this.ranges,s.overlay||(n.from<n.to?[new Te(n.from,n.to)]:[]));c.length&&il(c),(c.length||!s.overlay)&&this.inner.push(new tl(s.parser,c.length?s.parser.startParse(this.input,ol(h,c),c):s.parser.startParse(""),s.overlay?s.overlay.map(O=>new Te(O.from-n.from,O.to-n.from)):null,!!s.bracketed,n.tree,c.length?c[0].from:n.from)),s.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):l=!1}}else if(t&&(a=t.predicate(n))&&(a===!0&&(a=new Te(n.from,n.to)),a.from<a.to)){let h=t.ranges.length-1;h>=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&n.firstChild())t&&t.depth++,i&&i.depth++;else for(;!n.nextSibling();){if(!n.parent())break e;if(t&&!--t.depth){let h=sl(this.ranges,t.ranges);h.length&&(il(h),this.inner.splice(t.index,0,new tl(t.parser,t.parser.startParse(this.input,ol(t.mounts,h),h),t.ranges.map(c=>new Te(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function Ef(r,e,t){for(let i of r){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function rl(r,e,t,i,n,s){if(e<t){let o=r.buffer[e+1];i.push(r.slice(e,t,o)),n.push(o-s)}}function qf(r){let{node:e}=r,t=[],i=e.context.buffer;do t.push(r.index),r.parent();while(!r.tree);let n=r.tree,s=n.children.indexOf(i),o=n.children[s],l=o.buffer,a=[s];function h(c,O,f,u,d,g){let m=t[g],Q=[],S=[];rl(o,c,m,Q,S,u);let y=l[m+1],A=l[m+2];a.push(Q.length);let x=g?h(m+4,l[m+3],o.set.types[l[m]],y,A-y,g-1):e.toTree();return Q.push(x),S.push(y-u),rl(o,l[m+3],O,Q,S,u),new W(f,Q,S,d)}n.children[s]=h(0,l.length,re.none,0,o.length,t.length-1);for(let c of a){let O=r.tree.children[c],f=r.tree.positions[c];r.yield(new ce(O,f+r.from,c,r._tree))}}class nl{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(E.IncludeAnonymous|E.IgnoreMounts)}moveTo(e){let{cursor:t}=this,i=e-this.offset;for(;!this.done&&t.from<i;)if(!(t.to>=e&&t.enter(i,1,E.IgnoreOverlays|E.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof W)t=t.children[0];else break}return!1}}let Bf=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(ls))!==null&&t!==void 0?t:i.to,this.inner=new nl(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(ls))!==null&&e!==void 0?e:t.to,this.inner=new nl(t.tree,-t.offset)}}findMounts(e,t){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(i=s.tree)===null||i===void 0?void 0:i.prop(R.mounted);if(o&&o.parser==t)for(let l=this.fragI;l<this.fragments.length;l++){let a=this.fragments[l];if(a.from>=s.to)break;a.tree==this.curFrag.tree&&n.push({frag:a,pos:s.from-a.offset,mount:o})}}}return n}};function sl(r,e){let t=null,i=e;for(let n=1,s=0;n<r.length;n++){let o=r[n-1].to,l=r[n].from;for(;s<i.length;s++){let a=i[s];if(a.from>=l)break;a.to<=o||(t||(i=t=e.slice()),a.from<o?(t[s]=new Te(a.from,o),a.to>l&&t.splice(s+1,0,new Te(l,a.to))):a.to>l?t[s--]=new Te(l,a.to):t.splice(s--,1))}}return i}function Df(r,e,t,i){let n=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=n==r.length?1e9:o?r[n].to:r[n].from,O=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),u=Math.min(c,O,i);f<u&&h.push(new Te(f,u))}if(a=Math.min(c,O),a==1e9)break;c==a&&(o?(o=!1,n++):o=!0),O==a&&(l?(l=!1,s++):l=!0)}return h}function ol(r,e){let t=[];for(let{pos:i,mount:n,frag:s}of r){let o=i+(n.overlay?n.overlay[0].from:0),l=o+n.tree.length,a=Math.max(s.from,o),h=Math.min(s.to,l);if(n.overlay){let c=n.overlay.map(f=>new Te(f.from+i,f.to+i)),O=Df(e,c,a,h);for(let f=0,u=a;;f++){let d=f==O.length,g=d?h:O[f].from;if(g>u&&t.push(new ot(u,g,n.tree,-o,s.from>=u||s.openStart,s.to<=g||s.openEnd)),d)break;u=O[f].to}}else t.push(new ot(a,h,n.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}var ll={};class Wr{constructor(e,t,i,n,s,o,l,a,h,c=0,O){this.p=e,this.stack=t,this.state=i,this.reducePos=n,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=O}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let n=e.parser.context;return new Wr(e,[],t,i,i,0,[],0,n?new al(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,n=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),l=s.dynamicPrecedence(n);if(l&&(this.score+=l),i==0){n<s.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n<s.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(n,this.reducePos);return}let a=this.stack.length-(i-1)*3-(e&262144?6:0),h=a?this.stack[a-2]:this.p.ranges[0].from;n<s.minRepeatTerm&&h==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-h;c>=2e3&&!(!((t=this.p.parser.nodeSet.types[n])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=c));let O=a?this.stack[a-1]:0,f=this.bufferBase+this.buffer.length-O;if(n<s.minRepeatTerm||e&131072){let u=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,h,u,f+4,!0)}if(e&262144)this.state=this.stack[a];else{let u=this.stack[a-3];this.state=s.getGoto(u,n,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(n,h)}storeNode(e,t,i,n=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this.buffer.length;if(o>0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==i)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(e,t,i,n);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>i;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=n}}shift(e,t,i,n){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;this.pos=n;let l=o.stateFlag(s,1);!l&&(n>i||t<=o.maxNode)&&(this.reducePos=n),this.pushState(s,l?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,n,4)}else this.pos=n,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,n,4)}apply(e,t,i,n){e&65536?this.reduce(e):this.shift(e,t,i,n)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),n=e.bufferBase+t;for(;e&&n==e.bufferBase;)e=e.parent;return new Wr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new If(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&n.push(t[s],o);if(this.stack.length<120)for(let s=0;n.length<8&&s<t.length;s+=2){let o=t[s+1];n.some((l,a)=>a&1&&l==o)||n.push(t[s],o)}t=n}let i=[];for(let n=0;n<t.length&&i.length<4;n+=2){let s=t[n+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[n],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let i=t>>19,n=t&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(n,s)=>{if(!t.includes(n))return t.push(n),e.allActions(n,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,s+1);if(l!=null)return l}})};return i(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:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new al(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class al{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class If{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}}class Vr{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Vr(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.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 Vr(this.stack,this.pos,this.index)}}function Ti(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let i=0,n=0;i<r.length;){let s=0;for(;;){let o=r.charCodeAt(i++),l=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[n++]=s:t=new e(s)}return t}class Zr{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const hl=new Zr;class Gf{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=hl,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,n=this.rangeIndex,s=this.pos+e;for(;s<i.from;){if(!n)return null;let o=this.ranges[--n];s-=i.from-o.to,i=o}for(;t<0?s>i.to:s>=i.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];s+=o.from-i.to,i=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,n;if(t>=0&&t<this.chunk.length)i=this.pos+e,n=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(i=s,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,l=this.range;for(;l.to<=i;)l=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),n=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),n}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,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(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,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(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=hl,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(i+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return i}}class Kt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;Oh(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}Kt.prototype.contextual=Kt.prototype.fallback=Kt.prototype.extend=!1;class Er{constructor(e,t,i){this.precTable=t,this.elseToken=i,this.data=typeof e=="string"?Ti(e):e}token(e,t){let i=e.pos,n=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Oh(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||n++,o==null)break;e.reset(o,e.token)}n&&(e.reset(i,e.token),e.acceptToken(this.elseToken,n))}}Er.prototype.contextual=Kt.prototype.fallback=Kt.prototype.extend=!1;class le{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Oh(r,e,t,i,n,s){let o=0,l=1<<i,{dialect:a}=t.p.parser;e:for(;(l&r[o])!=0;){let h=r[o+1];for(let u=o+3;u<h;u+=2)if((r[u+1]&l)>0){let d=r[u];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||Nf(d,e.token.value,n,s))){e.acceptToken(d);break}}let c=e.next,O=0,f=r[o+2];if(e.next<0&&f>O&&r[h+f*3-3]==65535){o=r[h+f*3-1];continue e}for(;O<f;){let u=O+f>>1,d=h+u+(u<<1),g=r[d],m=r[d+1]||65536;if(c<g)f=u;else if(c>=m)O=u+1;else{o=r[d+2],e.advance();continue e}}break}}function cl(r,e,t){for(let i=e,n;(n=r[i])!=65535;i++)if(n==t)return i-e;return-1}function Nf(r,e,t,i){let n=cl(t,i,e);return n<0||cl(t,i,r)<n}const ye=typeof process<"u"&&ll&&/\bparse\b/.test(ll.LOG);let wn=null;function Ol(r,e,t){let i=r.cursor(E.IncludeAnonymous);for(i.moveTo(e);;)if(!(t<0?i.childBefore(e):i.childAfter(e)))for(;;){if((t<0?i.to<e:i.from>e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(r.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:r.length}}let Uf=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Ol(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Ol(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let i=this.trees[t],n=this.index[t];if(n==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=i.children[n],o=this.start[t]+i.positions[n];if(o>e)return this.nextStart=o,null;if(s instanceof W){if(o==e){if(o<this.safeFrom)return null;let l=o+s.length;if(l<=this.safeTo){let a=s.prop(R.lookAhead);if(!a||l+a<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}};class Ff{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Zr)}getActions(e){let t=0,i=null,{parser:n}=e.p,{tokenizers:s}=n,o=n.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;h<s.length;h++){if((1<<h&o)==0)continue;let c=s[h],O=this.tokens[h];if(!(i&&!c.fallback)&&((c.contextual||O.start!=e.pos||O.mask!=o||O.context!=l)&&(this.updateCachedToken(O,c,e),O.mask=o,O.context=l),O.lookAhead>O.end+25&&(a=Math.max(O.lookAhead,a)),O.value!=0)){let f=t;if(O.extended>-1&&(t=this.addActions(e,O.extended,O.end,t)),t=this.addActions(e,O.value,O.end,t),!c.extend&&(i=O,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new Zr,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Zr,{pos:i,p:n}=e;return t.start=i,t.end=Math.min(i+1,n.stream.end),t.value=i==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,i){let n=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(n,e),i),e.value>-1){let{parser:s}=i.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let l=s.specializers[o](this.stream.read(e.start,e.end),i);if(l>=0&&i.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,i,n){for(let s=0;s<n;s+=3)if(this.actions[s]==e)return n;return this.actions[n++]=e,this.actions[n++]=t,this.actions[n++]=i,n}addActions(e,t,i,n){let{state:s}=e,{parser:o}=e.p,{data:l}=o;for(let a=0;a<2;a++)for(let h=o.stateSlot(s,a?2:1);;h+=3){if(l[h]==65535)if(l[h+1]==1)h=rt(l,h+2);else{n==0&&l[h+1]==2&&(n=this.putAction(rt(l,h+2),t,i,n));break}l[h]==t&&(n=this.putAction(rt(l,h+1),t,i,n))}return n}}class Hf{constructor(e,t,i,n){this.parser=e,this.input=t,this.ranges=n,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 Gf(t,n),this.tokens=new Ff(e,this.stream),this.topTerm=e.top[1];let{from:s}=n[0];this.stacks=[Wr.start(this,e.top[0],s)],this.fragments=i.length&&this.stream.end-s>e.bufferLength*4?new Uf(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],n,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let l=e[o];for(;;){if(this.tokens.mainToken=null,l.pos>t)i.push(l);else{if(this.advanceStack(l,i,e))continue;{n||(n=[],s=[]),n.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!i.length){let o=n&&Jf(n);if(o)return ye&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ye&&n&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,s,i);if(o)return ye&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o<i.length-1;o++){let l=i[o];for(let a=o+1;a<i.length;a++){let h=i[a];if(l.sameState(h)||l.buffer.length>500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue e}}}i.length>12&&(i.sort((o,l)=>l.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,i){let n=e.pos,{parser:s}=this,o=ye?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let O=this.fragments.nodeAt(n);O;){let f=this.parser.nodeSet.types[O.type.id]==O.type?s.getGoto(e.state,O.type.id):-1;if(f>-1&&O.length&&(!h||(O.prop(R.contextHash)||0)==c))return e.useNode(O,f),ye&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(O.type.id)})`),!0;if(!(O instanceof W)||O.children.length==0||O.positions[0]>0)break;let u=O.children[0];if(u instanceof W&&O.positions[0]==0)O=u;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),ye&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;h<a.length;){let c=a[h++],O=a[h++],f=a[h++],u=h==a.length||!i,d=u?e:e.split(),g=this.tokens.mainToken;if(d.apply(c,O,g?g.start:d.pos,f),ye&&console.log(o+this.stackID(d)+` (via ${(c&65536)==0?"shift":`reduce of ${s.getName(c&65535)}`} for ${s.getName(O)} @ ${n}${d==e?"":", split"})`),u)return!0;d.pos>n?t.push(d):i.push(d)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return fl(e,t),!0}}runRecovery(e,t,i){let n=null,s=!1;for(let o=0;o<e.length;o++){let l=e[o],a=t[o<<1],h=t[(o<<1)+1],c=ye?this.stackID(l)+" -> ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),ye&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let O=l.split(),f=c;for(let u=0;u<10&&O.forceReduce()&&(ye&&console.log(f+this.stackID(O)+" (via force-reduce)"),!this.advanceFully(O,i));u++)ye&&(f=this.stackID(O)+" -> ");for(let u of l.recoverByInsert(a))ye&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,i);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),ye&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),fl(l,i)):(!n||n.score<O.score)&&(n=O)}return n}stackToTree(e){return e.close(),W.build({buffer:Vr.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(wn||(wn=new WeakMap)).get(e);return t||wn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function fl(r,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==r.pos&&i.sameState(r)){e[t].score<r.score&&(e[t]=r);return}}e.push(r)}class Kf{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}const vn=r=>r;class fo{constructor(e){this.start=e.start,this.shift=e.shift||vn,this.reduce=e.reduce||vn,this.reuse=e.reuse||vn,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class St extends Oo{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;l<e.repeatNodeCount;l++)t.push("");let i=Object.keys(e.topRules).map(l=>e.topRules[l][1]),n=[];for(let l=0;l<t.length;l++)n.push([]);function s(l,a,h){n[l].push([a,a.deserialize(String(h))])}if(e.nodeProps)for(let l of e.nodeProps){let a=l[0];typeof a=="string"&&(a=R[a]);for(let h=1;h<l.length;){let c=l[h++];if(c>=0)s(c,a,l[h++]);else{let O=l[h+-c];for(let f=-c;f>0;f--)s(l[h++],a,O);h++}}}this.nodeSet=new ir(t.map((l,a)=>re.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:n[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=sh;let o=Ti(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(ul),this.states=Ti(e.states,Uint32Array),this.data=Ti(e.stateData),this.goto=Ti(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(l=>typeof l=="number"?new Kt(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let n=new Hf(this,e,t,i);for(let s of this.wrappers)n=s(n,e,t,i);return n}getGoto(e,t,i=!1){let n=this.goto;if(t>=n[0])return-1;for(let s=n[t+1];;){let o=n[s++],l=o&1,a=n[s++];if(l&&i)return a;for(let h=s+(o>>1);s<h;s++)if(n[s]==e)return a;if(l)return-1}}hasAction(e,t){let i=this.data;for(let n=0;n<2;n++)for(let s=this.stateSlot(e,n?2:1),o;;s+=3){if((o=i[s])==65535)if(i[s+1]==1)o=i[s=rt(i,s+2)];else{if(i[s+1]==2)return rt(i,s+2);break}if(o==t||o==0)return rt(i,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),n=i?t(i):void 0;for(let s=this.stateSlot(e,1);n==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=rt(this.data,s+2);else break;n=t(rt(this.data,s+1))}return n}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=rt(this.data,i+2);else break;if((this.data[i+2]&1)==0){let n=this.data[i+1];t.some((s,o)=>o&1&&s==n)||t.push(this.data[i],n)}}return t}configure(e){let t=Object.assign(Object.create(St.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let n=e.tokenizers.find(s=>s.from==i);return n?n.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,n)=>{let s=e.specializers.find(l=>l.from==i.external);if(!s)return i;let o=Object.assign(Object.assign({},i),{external:s.to});return t.specializers[n]=ul(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(i[o]=!0)}let n=null;for(let s=0;s<t.length;s++)if(!i[s])for(let o=this.dialects[t[s]],l;(l=this.data[o++])!=65535;)(n||(n=new Uint8Array(this.maxTerm+1)))[l]=1;return new Kf(e,i,n)}static deserialize(e){return new St(e)}}function rt(r,e){return r[e]|r[e+1]<<16}function Jf(r){let e=null;for(let t of r){let i=t.p.stoppedAt;(t.pos==t.p.stream.end||i!=null&&t.pos>i)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function ul(r){if(r.external){let e=r.extend?1:0;return(t,i)=>r.external(t,i)<<1|e}return r.get}let eu=0,De=class as{constructor(e,t,i,n){this.name=e,this.set=t,this.base=i,this.modified=n,this.id=eu++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof as&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let n=new as(i,[],null,[]);if(n.set.push(n),t)for(let s of t.set)n.set.push(s);return n}static defineModifier(e){let t=new qr(e);return i=>i.modified.indexOf(t)>-1?i:qr.get(i.base||i,i.modified.concat(t).sort((n,s)=>n.id-s.id))}},tu=0;class qr{constructor(e){this.name=e,this.instances=[],this.id=tu++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&iu(t,l.modified));if(i)return i;let n=[],s=new De(e.name,n,e,t);for(let l of t)l.instances.push(s);let o=ru(t);for(let l of e.set)if(!l.modified.length)for(let a of o)n.push(qr.get(l,a));return s}}function iu(r,e){return r.length==e.length&&r.every((t,i)=>t==e[i])}function ru(r){let e=[[]];for(let t=0;t<r.length;t++)for(let i=0,n=e.length;i<n;i++)e.push(e[i].concat(r[t]));return e.sort((t,i)=>i.length-t.length)}function $t(r){let e=Object.create(null);for(let t in r){let i=r[t];Array.isArray(i)||(i=[i]);for(let n of t.split(" "))if(n){let s=[],o=2,l=n;for(let O=0;;){if(l=="..."&&O>0&&O+3==n.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+n);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),O+=f[0].length,O==n.length)break;let u=n[O++];if(O==n.length&&u=="!"){o=0;break}if(u!="/")throw new RangeError("Invalid path: "+n);l=n.slice(O)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+n);let c=new Vi(i,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return fh.add(e)}const fh=new R({combine(r,e){let t,i,n;for(;r||e;){if(!r||e&&r.depth>=e.depth?(n=e,e=e.next):(n=r,r=r.next),t&&t.mode==n.mode&&!n.context&&!t.context)continue;let s=new Vi(n.tags,n.mode,n.context);t?t.next=s:i=s,t=s}return i}});class Vi{constructor(e,t,i,n){this.tags=e,this.mode=t,this.context=i,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Vi.empty=new Vi([],2,null);function uh(r,e){let t=Object.create(null);for(let s of r)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:i,all:n=null}=e||{};return{style:s=>{let o=n;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function nu(r,e){let t=null;for(let i of r){let n=i.style(e);n&&(t=t?t+" "+n:n)}return t}function su(r,e,t,i=0,n=r.length){let s=new ou(i,Array.isArray(e)?e:[e],t);s.highlightRange(r.cursor(),i,n,"",s.highlighters),s.flush(n)}class ou{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,n,s){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(s=this.highlighters.filter(u=>!u.scope||u.scope(o)));let h=n,c=lu(e)||Vi.empty,O=nu(s,c.tags);if(O&&(h&&(h+=" "),h+=O,c.mode==1&&(n+=(n?" ":"")+O)),this.startSpan(Math.max(t,l),h),c.opaque)return;let f=e.tree&&e.tree.prop(R.mounted);if(f&&f.overlay){let u=e.node.enter(f.overlay[0].from+l,1),d=this.highlighters.filter(m=>!m.scope||m.scope(f.tree.type)),g=e.firstChild();for(let m=0,Q=l;;m++){let S=m<f.overlay.length?f.overlay[m]:null,y=S?S.from+l:a,A=Math.max(t,Q),x=Math.min(i,y);if(A<x&&g)for(;e.from<x&&(this.highlightRange(e,A,x,n,s),this.startSpan(Math.min(x,e.to),h),!(e.to>=y||!e.nextSibling())););if(!S||y>i)break;Q=S.to+l,Q>t&&(this.highlightRange(u.cursor(),Math.max(t,S.from+l),Math.min(i,Q),"",d),this.startSpan(Math.min(i,Q),h))}g&&e.parent()}else if(e.firstChild()){f&&(n="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,n,s),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function lu(r){let e=r.type.prop(fh);for(;e&&e.context&&!r.matchContext(e.context);)e=e.next;return e||null}const P=De.define,fr=P(),dt=P(),dl=P(dt),pl=P(dt),pt=P(),ur=P(pt),Tn=P(pt),Be=P(),Tt=P(Be),Ve=P(),Ee=P(),hs=P(),bi=P(hs),dr=P(),p={comment:fr,lineComment:P(fr),blockComment:P(fr),docComment:P(fr),name:dt,variableName:P(dt),typeName:dl,tagName:P(dl),propertyName:pl,attributeName:P(pl),className:P(dt),labelName:P(dt),namespace:P(dt),macroName:P(dt),literal:pt,string:ur,docString:P(ur),character:P(ur),attributeValue:P(ur),number:Tn,integer:P(Tn),float:P(Tn),bool:P(pt),regexp:P(pt),escape:P(pt),color:P(pt),url:P(pt),keyword:Ve,self:P(Ve),null:P(Ve),atom:P(Ve),unit:P(Ve),modifier:P(Ve),operatorKeyword:P(Ve),controlKeyword:P(Ve),definitionKeyword:P(Ve),moduleKeyword:P(Ve),operator:Ee,derefOperator:P(Ee),arithmeticOperator:P(Ee),logicOperator:P(Ee),bitwiseOperator:P(Ee),compareOperator:P(Ee),updateOperator:P(Ee),definitionOperator:P(Ee),typeOperator:P(Ee),controlOperator:P(Ee),punctuation:hs,separator:P(hs),bracket:bi,angleBracket:P(bi),squareBracket:P(bi),paren:P(bi),brace:P(bi),content:Be,heading:Tt,heading1:P(Tt),heading2:P(Tt),heading3:P(Tt),heading4:P(Tt),heading5:P(Tt),heading6:P(Tt),contentSeparator:P(Be),list:P(Be),quote:P(Be),emphasis:P(Be),strong:P(Be),link:P(Be),monospace:P(Be),strikethrough:P(Be),inserted:P(),deleted:P(),changed:P(),invalid:P(),meta:dr,documentMeta:P(dr),annotation:P(dr),processingInstruction:P(dr),definition:De.defineModifier("definition"),constant:De.defineModifier("constant"),function:De.defineModifier("function"),standard:De.defineModifier("standard"),local:De.defineModifier("local"),special:De.defineModifier("special")};for(let r in p){let e=p[r];e instanceof De&&(e.name=r)}uh([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);const au=135,gl=1,hu=136,cu=137,dh=2,Ou=138,fu=3,uu=4,ph=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],du=58,pu=40,gh=95,gu=91,Cr=45,mu=46,Qu=35,Su=37,bu=38,ku=92,yu=10,xu=42;function Ei(r){return r>=65&&r<=90||r>=97&&r<=122||r>=161}function uo(r){return r>=48&&r<=57}function ml(r){return uo(r)||r>=97&&r<=102||r>=65&&r<=70}const mh=(r,e,t)=>(i,n)=>{for(let s=!1,o=0,l=0;;l++){let{next:a}=i;if(Ei(a)||a==Cr||a==gh||s&&uo(a))!s&&(a!=Cr||l>0)&&(s=!0),o===l&&a==Cr&&o++,i.advance();else if(a==ku&&i.peek(1)!=yu){if(i.advance(),ml(i.next)){do i.advance();while(ml(i.next));i.next==32&&i.advance()}else i.next>-1&&i.advance();s=!0}else{s&&i.acceptToken(o==2&&n.canShift(dh)?e:a==pu?t:r);break}}},Pu=new le(mh(hu,dh,cu),{contextual:!0}),$u=new le(mh(Ou,fu,uu),{contextual:!0}),wu=new le(r=>{if(ph.includes(r.peek(-1))){let{next:e}=r;(Ei(e)||e==gh||e==Qu||e==mu||e==xu||e==gu||e==du&&Ei(r.peek(1))||e==Cr||e==bu)&&r.acceptToken(au)}}),vu=new le(r=>{if(!ph.includes(r.peek(-1))){let{next:e}=r;if(e==Su&&(r.advance(),r.acceptToken(gl)),Ei(e)){do r.advance();while(Ei(r.next)||uo(r.next));r.acceptToken(gl)}}}),Tu=$t({"AtKeyword import charset namespace keyframes media supports font-feature-values":p.definitionKeyword,"from to selector scope MatchFlag":p.keyword,NamespaceName:p.namespace,KeyframeName:p.labelName,KeyframeRangeName:p.operatorKeyword,TagName:p.tagName,ClassName:p.className,PseudoClassName:p.constant(p.className),IdName:p.labelName,"FeatureName PropertyName":p.propertyName,AttributeName:p.attributeName,NumberLiteral:p.number,KeywordQuery:p.keyword,UnaryQueryOp:p.operatorKeyword,"CallTag ValueName FontName":p.atom,VariableName:p.variableName,Callee:p.operatorKeyword,Unit:p.unit,"UniversalSelector NestingSelector":p.definitionOperator,"MatchOp CompareOp":p.compareOperator,"ChildOp SiblingOp, LogicOp":p.logicOperator,BinOp:p.arithmeticOperator,Important:p.modifier,Comment:p.blockComment,ColorLiteral:p.color,"ParenthesizedContent StringLiteral":p.string,":":p.punctuation,"PseudoOp #":p.derefOperator,"; , |":p.separator,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace}),Xu={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:90,url:132,"url-prefix":132,domain:132,regexp:132},Zu={__proto__:null,or:104,and:104,not:112,only:112,layer:186},Cu={__proto__:null,selector:118,layer:182},Ru={__proto__:null,"@import":178,"@media":190,"@charset":194,"@namespace":198,"@keyframes":204,"@supports":216,"@scope":220,"@font-feature-values":226},Au={__proto__:null,to:223},Mu=St.deserialize({version:14,states:"IpQYQdOOO#}QdOOP$UO`OOO%OQaO'#CfOOQP'#Ce'#CeO%VQdO'#CgO%[Q`O'#CgO%aQaO'#FdO&XQdO'#CkO&xQaO'#CcO'SQdO'#CnO'_QdO'#DtO'dQdO'#DvO'oQdO'#D}O'oQdO'#EQOOQP'#Fd'#FdO)OQhO'#EsOOQS'#Fc'#FcOOQS'#Ev'#EvQYQdOOO)VQdO'#EWO*cQhO'#E^O)VQdO'#E`O*jQdO'#EbO*uQdO'#EeO)zQhO'#EkO*}QdO'#EmO+YQdO'#EpO+_QaO'#CfO+fQ`O'#ETO+kQ`O'#FnO+vQdO'#FnQOQ`OOP,QO&jO'#CaPOOO)CAR)CAROOQP'#Ci'#CiOOQP,59R,59RO%VQdO,59ROOQP'#Cm'#CmOOQP,59V,59VO&XQdO,59VO,]QdO,59YO'_QdO,5:`O'dQdO,5:bO'oQdO,5:iO'oQdO,5:kO'oQdO,5:lO'oQdO'#E}O,hQ`O,58}O,pQdO'#ESOOQS,58},58}OOQP'#Cq'#CqOOQO'#Dr'#DrOOQP,59Y,59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'l'^Q&b%ZR'V&bQ&^%WR'T&^Q!QXR#l!QQ&W$yR'O&WQ#[nS%O#[%PR%P#]Q'`&nR'n'`Q$k!xR%x$kQ&P$pR&z&PQ&x&OR'g&xQ#WkR$w#WQ$O!dR%d$O_bOPco!R#Z$}^XOPco!R#Z$}Q!`]Q!a^Q#h|Q#i}Q#j!OQ#k!PQ$s#RQ%W#oR'S&]R%[#pQ!qdQ!zf[$V!m!n!o$Y$[$^Q$y#Yd%Y#p%Z%_&a&f&k'U'^'k'sQ%^#uQ%n$aS&U$y&WQ&[%UQ&}&VR'b&p]$X!m!n!o$Y$[$^Q!d`U!xe!q$eQ#QiQ#x!cS#{!d$OQ$Q!eQ%b#|Q%c#}Q%g$RS%r$g%tQ%w$jR'Z&iQ#z!cQ&h%`R'j'YR%i$RR%X#oQpPR#n!RQ!yeQ$d!qR%q$e",nodeNames:"⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NamespacedTagSelector NamespaceName TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , PseudoQuery CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName NamespacedAttribute NamespaceName AttributeName MatchOp MatchFlag ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to FontFeatureStatement font-feature-values Font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4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<r.length;e++)(e%2?Qh:cs).push(t=t+r[e])})();function ju(r){if(r<768)return!1;for(let e=0,t=cs.length;;){let i=e+t>>1;if(r<cs[i])t=i;else if(r>=Qh[i])e=i+1;else return!0;if(e==t)return!1}}function Ql(r){return r>=127462&&r<=127487}const Sl=8205;function zu(r,e,t=!0,i=!0){return(t?Sh:Lu)(r,e,i)}function Sh(r,e,t){if(e==r.length)return e;e&&bh(r.charCodeAt(e))&&kh(r.charCodeAt(e-1))&&e--;let i=Xn(r,e);for(e+=bl(i);e<r.length;){let n=Xn(r,e);if(i==Sl||n==Sl||t&&ju(n))e+=bl(n),i=n;else if(Ql(n)){let s=0,o=e-2;for(;o>=0&&Ql(Xn(r,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Lu(r,e,t){for(;e>0;){let i=Sh(r,e-2,t);if(i<e)return i;e--}return 0}function Xn(r,e){let t=r.charCodeAt(e);if(!kh(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return bh(i)?(t-55296<<10)+(i-56320)+65536:t}function bh(r){return r>=56320&&r<57344}function kh(r){return r>=55296&&r<56320}function bl(r){return r<65536?1:2}class L{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=ni(this,e,t);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),Ie.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ni(this,e,t);let i=[];return this.decompose(e,t,i,0),Ie.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new Ri(this),s=new Ri(e);for(let o=t,l=t;;){if(n.next(o),s.next(o),o=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(l+=n.value.length,n.done||l>=i)return!0}}iter(e=1){return new Ri(this,e)}iterRange(e,t=this.length){return new yh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new xh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?L.empty:e.length<=32?new ee(e):Ie.from(ee.split(e,[]))}}class ee extends L{constructor(e,t=Yu(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let s=0;;s++){let o=this.text[s],l=n+o.length;if((t?i:l)>=e)return new _u(n,l,i,o);n=l+1,i++}}decompose(e,t,i,n){let s=e<=0&&t>=this.length?this:new ee(kl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let o=i.pop(),l=Rr(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new ee(l,o.length+s.length));else{let a=l.length>>1;i.push(new ee(l.slice(0,a)),new ee(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof ee))return super.replace(e,t,i);[e,t]=ni(this,e,t);let n=Rr(this.text,Rr(i.text,kl(this.text,0,e)),t),s=this.length+i.length-(t-e);return n.length<=32?new ee(n,s):Ie.from(ee.split(n,[]),s)}sliceString(e,t=this.length,i=`
|
|
2
2
|
`){[e,t]=ni(this,e,t);let n="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(n+=i),e<a&&t>s&&(n+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],n=-1;for(let s of e)i.push(s),n+=s.length+1,i.length==32&&(t.push(new ee(i,n)),i=[],n=-1);return n>-1&&t.push(new ee(i,n)),t}}class Ie extends L{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,n){for(let s=0;;s++){let o=this.children[s],l=n+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,n);n=l+1,i=a+1}}decompose(e,t,i,n){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let h=n&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=ni(this,e,t),i.lines<this.lines)for(let n=0,s=0;n<this.children.length;n++){let o=this.children[n],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[n]=a,new Ie(c,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
3
3
|
`){[e,t]=ni(this,e,t);let n="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(n+=i),e<a&&t>o&&(n+=l.sliceString(e-o,t-o,i)),o=a+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ie))return 0;let i=0,[n,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,s+=t){if(n==o||s==l)return i;let a=this.children[n],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let u of e)i+=u.lines;if(i<32){let u=[];for(let d of e)d.flatten(u);return new ee(u,t)}let n=Math.max(32,i>>5),s=n<<1,o=n>>1,l=[],a=0,h=-1,c=[];function O(u){let d;if(u.lines>s&&u instanceof Ie)for(let g of u.children)O(g);else u.lines>o&&(a>o||!a)?(f(),l.push(u)):u instanceof ee&&a&&(d=c[c.length-1])instanceof ee&&u.lines+d.lines<=32?(a+=u.lines,h+=u.length+1,c[c.length-1]=new ee(d.text.concat(u.text),d.length+1+u.length)):(a+u.lines>n&&f(),a+=u.lines,h+=u.length+1,c.push(u))}function f(){a!=0&&(l.push(c.length==1?c[0]:Ie.from(c,h)),h=-1,a=c.length=0)}for(let u of e)O(u);return f(),l.length==1?l[0]:new Ie(l,t)}}L.empty=new ee([""],0);function Yu(r){let e=-1;for(let t of r)e+=t.length+1;return e}function Rr(r,e,t=0,i=1e9){for(let n=0,s=0,o=!0;s<r.length&&n<=i;s++){let l=r[s],a=n+l.length;a>=t&&(a>i&&(l=l.slice(0,i-n)),n<t&&(l=l.slice(t-n)),o?(e[e.length-1]+=l,o=!1):e.push(l)),n=a+1}return e}function kl(r,e,t){return Rr(r,[""],e,t)}class Ri{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof ee?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],s=this.offsets[i],o=s>>1,l=n instanceof ee?n.text.length:n.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
4
4
|
`,this;e--}else if(n instanceof ee){let a=n.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=n.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof ee?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class yh{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ri(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=i?n:t<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class xh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(L.prototype[Symbol.iterator]=function(){return this.iter()},Ri.prototype[Symbol.iterator]=yh.prototype[Symbol.iterator]=xh.prototype[Symbol.iterator]=function(){return this});let _u=class{constructor(e,t,i,n){this.from=e,this.to=t,this.number=i,this.text=n}get length(){return this.to-this.from}};function ni(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}function he(r,e,t=!0,i=!0){return zu(r,e,t,i)}function Wu(r){return r>=56320&&r<57344}function Vu(r){return r>=55296&&r<56320}function Ph(r,e){let t=r.charCodeAt(e);if(!Vu(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return Wu(i)?(t-55296<<10)+(i-56320)+65536:t}function Eu(r){return r<65536?1:2}const Os=/\r\n?|\n/;var de=(function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r})(de||(de={}));class Ke{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,n=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,n,s),n+=s):n+=o,i+=s}}iterChangedRanges(e,t=!1){fs(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];n<0?e.push(i,n):e.push(n,i)}return new Ke(e)}composeDesc(e){return this.empty?e:e.empty?this:$h(this,e)}mapDesc(e,t=!1){return e.empty?this:us(this,e,t)}mapPos(e,t=-1,i=de.Simple){let n=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=n+l;if(a<0){if(h>e)return s+(e-n);s+=l}else{if(i!=de.Simple&&h>=e&&(i==de.TrackDel&&n<e&&h>e||i==de.TrackBefore&&n<e||i==de.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==n||t<0?s:s+a;s+=a}n=h}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return s}touchesRange(e,t=e){for(let i=0,n=0;i<this.sections.length&&n<=t;){let s=this.sections[i++],o=this.sections[i++],l=n+s;if(o>=0&&n<=t&&l>=e)return n<e&&l>t?"cover":!0;n=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+i+(n>=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ke(e)}static create(e){return new Ke(e)}}class ie extends Ke{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return fs(this,(t,i,n,s,o)=>e=e.replace(n,n+(i-t),o),!1),e}mapDesc(e,t=!1){return us(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let n=0,s=0;n<t.length;n+=2){let o=t[n],l=t[n+1];if(l>=0){t[n]=l,t[n+1]=o;let a=n>>1;for(;i.length<a;)i.push(L.empty);i.push(o?e.slice(s,s+o):L.empty)}s+=o}return new ie(t,i)}compose(e){return this.empty?e:e.empty?this:$h(this,e,!0)}map(e,t=!1){return e.empty?this:us(this,e,t,!0)}iterChanges(e,t=!1){fs(this,e,t)}get desc(){return Ke.create(this.sections)}filter(e){let t=[],i=[],n=[],s=new qi(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let c=Math.min(s.len,a-l);ae(n,c,-1);let O=s.ins==-1?-1:s.off==0?s.ins:0;ae(t,c,O),O>0&&mt(i,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l<h;){if(s.done)break e;let c=Math.min(s.len,h-l);ae(t,c,-1),ae(n,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),l+=c}}return{changes:new ie(t,i),filtered:Ke.create(n)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],n=this.sections[t+1];n<0?e.push(i):n==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let n=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!n.length)return;o<t&&ae(n,t-o,-1);let O=new ie(n,s);l=l?l.compose(O.map(l)):O,n=[],s=[],o=0}function h(c){if(Array.isArray(c))for(let O of c)h(O);else if(c instanceof ie){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:O,to:f=O,insert:u}=c;if(O>f||O<0||f>t)throw new RangeError(`Invalid change range ${O} to ${f} (in doc of length ${t})`);let d=u?typeof u=="string"?L.of(u.split(i||Os)):u:L.empty,g=d.length;if(O==f&&g==0)return;O<o&&a(),O>o&&ae(n,O-o,-1),ae(n,f-O,g),mt(s,n,d),o=f}}return h(e),a(!l),l}static empty(e){return new ie(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let n=0;n<e.length;n++){let s=e[n];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<n;)i.push(L.empty);i[n]=L.of(s.slice(1)),t.push(s[0],i[n].length)}}}return new ie(t,i)}static createSet(e,t){return new ie(e,t)}}function ae(r,e,t,i=!1){if(e==0&&t<=0)return;let n=r.length-2;n>=0&&t<=0&&t==r[n+1]?r[n]+=e:n>=0&&e==0&&r[n]==0?r[n+1]+=t:i?(r[n]+=e,r[n+1]+=t):r.push(e,t)}function mt(r,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<r.length)r[r.length-1]=r[r.length-1].append(t);else{for(;r.length<i;)r.push(L.empty);r.push(t)}}function fs(r,e,t){let i=r.inserted;for(let n=0,s=0,o=0;o<r.sections.length;){let l=r.sections[o++],a=r.sections[o++];if(a<0)n+=l,s+=l;else{let h=n,c=s,O=L.empty;for(;h+=l,c+=a,a&&i&&(O=O.append(i[o-2>>1])),!(t||o==r.sections.length||r.sections[o+1]<0);)l=r.sections[o++],a=r.sections[o++];e(n,h,s,c,O),n=h,s=c}}}function us(r,e,t,i=!1){let n=[],s=i?[]:null,o=new qi(r),l=new qi(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ae(n,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(ae(n,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(ae(n,0,o.ins),s&&mt(s,n,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let O=Math.min(c,l.len);h+=O,c-=O,l.forward(O)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;ae(n,h,a<o.i?o.ins:0),s&&a<o.i&&mt(s,n,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return s?ie.createSet(n,s):Ke.create(n);throw new Error("Mismatched change set lengths")}}}function $h(r,e,t=!1){let i=[],n=t?[]:null,s=new qi(r),o=new qi(e);for(let l=!1;;){if(s.done&&o.done)return n?ie.createSet(i,n):Ke.create(i);if(s.ins==0)ae(i,s.len,0,l),s.next();else if(o.len==0&&!o.done)ae(i,0,o.ins,l),n&&mt(n,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),h=i.length;if(s.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;ae(i,a,c,l),n&&c&&mt(n,i,o.text)}else o.ins==-1?(ae(i,s.off?0:s.len,a,l),n&&mt(n,i,s.textBit(a))):(ae(i,s.off?0:s.len,o.off?0:o.ins,l),n&&!o.off&&mt(n,i,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),s.forward2(a),o.forward(a)}}}}class qi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?L.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?L.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class At{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,n;return this.empty?i=n=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new At(i,n,this.flags)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t,void 0,void 0,i);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,n,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,i){return new At(e,t,i)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new b([this.main],0)}addRange(e,t=!0){return b.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,b.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>At.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;n<e.length;n++){let s=e[n];if(s.empty?s.from<=i:s.from<i)return b.normalized(e.slice(),t);i=s.to}return new b(e,t)}static cursor(e,t=0,i,n){return At.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(n??16777215)<<6)}static range(e,t,i,n,s){let o=(i??16777215)<<6|(n==null?7:Math.min(6,n));return!s&&e!=t&&(s=t<e?1:-1),t<e?At.create(t,e,48|o):At.create(e,t,(s?s<0?8:16:0)|o)}static normalized(e,t=0){let i=e[t];e.sort((n,s)=>n.from-s.from),t=e.indexOf(i);for(let n=1;n<e.length;n++){let s=e[n],o=e[n-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);n<=t&&t--,e.splice(--n,2,s.anchor>s.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function wh(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let po=0;class X{constructor(e,t,i,n,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=n,this.id=po++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new X(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:go),!!e.static,e.enables)}of(e){return new Ar([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ar(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ar(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function go(r,e){return r==e||r.length==e.length&&r.every((t,i)=>t===e[i])}class Ar{constructor(e,t,i,n){this.dependencies=e,this.facet=t,this.type=i,this.value=n,this.id=po++}dynamicSlot(e){var t;let i=this.value,n=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let O of this.dependencies)O=="doc"?a=!0:O=="selection"?h=!0:(((t=e[O.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[O.id]);return{create(O){return O.values[o]=i(O),1},update(O,f){if(a&&f.docChanged||h&&(f.docChanged||f.selection)||ds(O,c)){let u=i(O);if(l?!yl(u,O.values[o],n):!n(u,O.values[o]))return O.values[o]=u,1}return 0},reconfigure:(O,f)=>{let u,d=f.config.address[s];if(d!=null){let g=Dr(f,d);if(this.dependencies.every(m=>m instanceof X?f.facet(m)===O.facet(m):m instanceof Ot?f.field(m,!1)==O.field(m,!1):!0)||(l?yl(u=i(O),g,n):n(u=i(O),g)))return O.values[o]=g,0}else u=i(O);return O.values[o]=u,1}}}}function yl(r,e,t){if(r.length!=e.length)return!1;for(let i=0;i<r.length;i++)if(!t(r[i],e[i]))return!1;return!0}function ds(r,e){let t=!1;for(let i of e)Ai(r,i)&1&&(t=!0);return t}function qu(r,e,t){let i=t.map(a=>r[a.id]),n=t.map(a=>a.type),s=i.filter(a=>!(a&1)),o=r[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let O=Dr(a,i[c]);if(n[c]==2)for(let f of O)h.push(f);else h.push(O)}return e.combine(h)}return{create(a){for(let h of i)Ai(a,h);return a.values[o]=l(a),1},update(a,h){if(!ds(a,s))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=ds(a,i),O=h.config.facets[e.id],f=h.facet(e);if(O&&!c&&go(t,O))return a.values[o]=f,0;let u=l(a);return e.compare(u,f)?(a.values[o]=f,0):(a.values[o]=u,1)}}}const pr=X.define({static:!0});class Ot{constructor(e,t,i,n,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=n,this.spec=s,this.provides=void 0}static define(e){let t=new Ot(po++,e.create,e.update,e.compare||((i,n)=>i===n),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(pr).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,n)=>{let s=i.values[t],o=this.updateF(s,n);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,n)=>{let s=i.facet(pr),o=n.facet(pr),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):n.config.address[this.id]!=null?(i.values[t]=n.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,pr.of({field:this,create:e})]}get extension(){return this}}const Zt={lowest:4,low:3,default:2,high:1,highest:0};function ki(r){return e=>new vh(e,r)}const mi={highest:ki(Zt.highest),high:ki(Zt.high),default:ki(Zt.default),low:ki(Zt.low),lowest:ki(Zt.lowest)};class vh{constructor(e,t){this.inner=e,this.prec=t}}class fn{of(e){return new ps(this,e)}reconfigure(e){return fn.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ps{constructor(e,t){this.compartment=e,this.inner=t}}class Br{constructor(e,t,i,n,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=n,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let n=[],s=Object.create(null),o=new Map;for(let f of Bu(e,t,o))f instanceof Ot?n.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],h=[];for(let f of n)l[f.id]=h.length<<1,h.push(u=>f.slot(u));let c=i?.config.facets;for(let f in s){let u=s[f],d=u[0].facet,g=c&&c[f]||[];if(u.every(m=>m.type==0))if(l[d.id]=a.length<<1|1,go(g,u))a.push(i.facet(d));else{let m=d.combine(u.map(Q=>Q.value));a.push(i&&d.compare(m,i.facet(d))?i.facet(d):m)}else{for(let m of u)m.type==0?(l[m.id]=a.length<<1|1,a.push(m.value)):(l[m.id]=h.length<<1,h.push(Q=>m.dynamicSlot(Q)));l[d.id]=h.length<<1,h.push(m=>qu(m,d,u))}}let O=h.map(f=>f(l));return new Br(e,o,O,l,a,s)}}function Bu(r,e,t){let i=[[],[],[],[],[]],n=new Map;function s(o,l){let a=n.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof ps&&t.delete(o.compartment)}if(n.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof ps){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof vh)s(o.inner,o.prec);else if(o instanceof Ot)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Ar)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,Zt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(r,Zt.default),i.reduce((o,l)=>o.concat(l))}function Ai(r,e){if(e&1)return 2;let t=e>>1,i=r.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;r.status[t]=4;let n=r.computeSlot(r,r.config.dynamicSlots[t]);return r.status[t]=2|n}function Dr(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}const Th=X.define(),gs=X.define({combine:r=>r.some(e=>e),static:!0}),Xh=X.define({combine:r=>r.length?r[0]:void 0,static:!0}),Zh=X.define(),Ch=X.define(),Rh=X.define(),Ah=X.define({combine:r=>r.length?r[0]:!1});class ft{constructor(e,t){this.type=e,this.value=t}static define(){return new Du}}class Du{of(e){return new ft(this,e)}}class Iu{constructor(e){this.map=e}of(e){return new F(this,e)}}class F{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new F(this.type,t)}is(e){return this.type==e}static define(e={}){return new Iu(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let n of e){let s=n.map(t);s&&i.push(s)}return i}}F.reconfigure=F.define();F.appendConfig=F.define();class te{constructor(e,t,i,n,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=n,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&wh(i,t.newLength),s.some(l=>l.type==te.time)||(this.annotations=s.concat(te.time.of(Date.now())))}static create(e,t,i,n,s,o){return new te(e,t,i,n,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(te.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}te.time=ft.define();te.userEvent=ft.define();te.addToHistory=ft.define();te.remote=ft.define();function Gu(r,e){let t=[];for(let i=0,n=0;;){let s,o;if(i<r.length&&(n==e.length||e[n]>=r[i]))s=r[i++],o=r[i++];else if(n<e.length)s=e[n++],o=e[n++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Mh(r,e,t){var i;let n,s,o;return t?(n=e.changes,s=ie.empty(e.changes.length),o=r.changes.compose(e.changes)):(n=e.changes.map(r.changes),s=r.changes.mapDesc(e.changes,!0),o=r.changes.compose(n)),{changes:o,selection:e.selection?e.selection.map(s):(i=r.selection)===null||i===void 0?void 0:i.map(n),effects:F.mapEffects(r.effects,n).concat(F.mapEffects(e.effects,s)),annotations:r.annotations.length?r.annotations.concat(e.annotations):e.annotations,scrollIntoView:r.scrollIntoView||e.scrollIntoView}}function ms(r,e,t){let i=e.selection,n=Jt(e.annotations);return e.userEvent&&(n=n.concat(te.userEvent.of(e.userEvent))),{changes:e.changes instanceof ie?e.changes:ie.of(e.changes||[],t,r.facet(Xh)),selection:i&&(i instanceof b?i:b.single(i.anchor,i.head)),effects:Jt(e.effects),annotations:n,scrollIntoView:!!e.scrollIntoView}}function jh(r,e,t){let i=ms(r,e.length?e[0]:{},r.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;i=Mh(i,ms(r,e[s],o?i.changes.newLength:r.doc.length),o)}let n=te.create(r,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Uu(t?Nu(n):n)}function Nu(r){let e=r.startState,t=!0;for(let n of e.facet(Zh)){let s=n(r);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Gu(t,s))}if(t!==!0){let n,s;if(t===!1)s=r.changes.invertedDesc,n=ie.empty(e.doc.length);else{let o=r.changes.filter(t);n=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}r=te.create(e,n,r.selection&&r.selection.map(s),F.mapEffects(r.effects,s),r.annotations,r.scrollIntoView)}let i=e.facet(Ch);for(let n=i.length-1;n>=0;n--){let s=i[n](r);s instanceof te?r=s:Array.isArray(s)&&s.length==1&&s[0]instanceof te?r=s[0]:r=jh(e,Jt(s),!1)}return r}function Uu(r){let e=r.startState,t=e.facet(Rh),i=r;for(let n=t.length-1;n>=0;n--){let s=t[n](r);s&&Object.keys(s).length&&(i=Mh(i,ms(e,s,r.changes.newLength),!0))}return i==r?r:te.create(e,r.changes,r.selection,i.effects,i.annotations,i.scrollIntoView)}const Fu=[];function Jt(r){return r==null?Fu:Array.isArray(r)?r:[r]}var st=(function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r})(st||(st={}));const Hu=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Qs;try{Qs=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Ku(r){if(Qs)return Qs.test(r);for(let e=0;e<r.length;e++){let t=r[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||Hu.test(t)))return!0}return!1}function Ju(r){return e=>{if(!/\S/.test(e))return st.Space;if(Ku(e))return st.Word;for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>-1)return st.Word;return st.Other}}class V{constructor(e,t,i,n,s,o){this.config=e,this.doc=t,this.selection=i,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Ai(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Ai(this,i),Dr(this,i)}update(...e){return jh(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:n}=t;for(let l of e.effects)l.is(fn.reconfigure)?(t&&(n=new Map,t.compartments.forEach((a,h)=>n.set(h,a)),t=null),n.set(l.value.compartment,l.value.extension)):l.is(F.reconfigure)?(t=null,i=l.value):l.is(F.appendConfig)&&(t=null,i=Jt(i).concat(l.value));let s;t?s=e.startState.values.slice():(t=Br.resolve(i,n,this),s=new V(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(gs)?e.newSelection:e.newSelection.asSingle();new V(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),n=this.changes(i.changes),s=[i.range],o=Jt(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(n);for(let f=0;f<l;f++)s[f]=s[f].map(c);let O=n.mapDesc(h,!0);s.push(a.range.map(O)),n=n.compose(c),o=F.mapEffects(o,c).concat(F.mapEffects(Jt(a.effects),O))}return{changes:n,selection:b.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ie?e:ie.of(e,this.doc.length,this.facet(V.lineSeparator))}toText(e){return L.of(e.split(this.facet(V.lineSeparator)||Os))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Ai(this,t),Dr(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let n=e[i];n instanceof Ot&&this.config.address[n.id]!=null&&(t[i]=n.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let n=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],l=e[s];n.push(o.init(a=>o.spec.fromJSON(l,a)))}}return V.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?n.concat([t.extensions]):n})}static create(e={}){let t=Br.resolve(e.extensions||[],new Map),i=e.doc instanceof L?e.doc:L.of((e.doc||"").split(t.staticFacet(V.lineSeparator)||Os)),n=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return wh(n,i.length),t.staticFacet(gs)||(n=n.asSingle()),new V(t,i,n,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(V.tabSize)}get lineBreak(){return this.facet(V.lineSeparator)||`
|
|
@@ -57,7 +57,7 @@ ${a.logExcerpt.join(`
|
|
|
57
57
|
`):`Incident #${i}`}).join(`
|
|
58
58
|
|
|
59
59
|
`)].join(`
|
|
60
|
-
`):null}function uz(e,t){if(!t.length)return null;const s=dz(e),i=e.git.selectedRepository?.path??e.git.cwd,a=e.git.status?.files.map(u=>`${u.
|
|
60
|
+
`):null}function uz(e,t){if(!t.length)return null;const s=dz(e),i=e.git.selectedRepository?.path??e.git.cwd,a=e.git.status?.files.map(u=>`${u.index}${u.workingTree}: ${u.path}`)??[];return["Git Repositories",t.map(u=>{const h=s.find(d=>d.path===u),m=u===i;return[`Repository: ${h?.name??u.split("/").pop()??u}`,`path: ${u}`,m?"current: yes":"current: no",m?a.length?`changed files:
|
|
61
61
|
${a.join(`
|
|
62
62
|
`)}`:"changed files: none":"changed files: not loaded for this repository in the current dashboard view"].join(`
|
|
63
63
|
`)}).join(`
|
|
@@ -202,10 +202,10 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Xt=me,bt=ze),et===void
|
|
|
202
202
|
`+e.slice(a,l),a=l+1),u=h;return m+=`
|
|
203
203
|
`,e.length-a>t&&u>a?m+=e.slice(a,u)+`
|
|
204
204
|
`+e.slice(u+1):m+=e.slice(a),m.slice(1)}function JG(e){for(var t="",s=0,i,a=0;a<e.length;s>=65536?a+=2:a++)s=zc(e,a),i=Ws[s],!i&&ru(s)?(t+=e[a],s>=65536&&(t+=e[a+1])):t+=i||qG(s);return t}function eW(e,t,s){var i="",a=e.tag,l,u,h;for(l=0,u=s.length;l<u;l+=1)h=s[l],e.replacer&&(h=e.replacer.call(s,String(l),h)),(gr(e,t,h,!1,!1)||typeof h>"u"&&gr(e,t,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=a,e.dump="["+i+"]"}function Hk(e,t,s,i){var a="",l=e.tag,u,h,m;for(u=0,h=s.length;u<h;u+=1)m=s[u],e.replacer&&(m=e.replacer.call(s,String(u),m)),(gr(e,t+1,m,!0,!0,!1,!0)||typeof m>"u"&&gr(e,t+1,null,!0,!0,!1,!0))&&((!i||a!=="")&&(a+=yb(e,t)),e.dump&&nu===e.dump.charCodeAt(0)?a+="-":a+="- ",a+=e.dump);e.tag=l,e.dump=a||"[]"}function tW(e,t,s){var i="",a=e.tag,l=Object.keys(s),u,h,m,d,p;for(u=0,h=l.length;u<h;u+=1)p="",i!==""&&(p+=", "),e.condenseFlow&&(p+='"'),m=l[u],d=s[m],e.replacer&&(d=e.replacer.call(s,m,d)),gr(e,t,m,!1,!1)&&(e.dump.length>1024&&(p+="? "),p+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),gr(e,t,d,!1,!1)&&(p+=e.dump,i+=p));e.tag=a,e.dump="{"+i+"}"}function sW(e,t,s,i){var a="",l=e.tag,u=Object.keys(s),h,m,d,p,g,v;if(e.sortKeys===!0)u.sort();else if(typeof e.sortKeys=="function")u.sort(e.sortKeys);else if(e.sortKeys)throw new Zs("sortKeys must be a boolean or a function");for(h=0,m=u.length;h<m;h+=1)v="",(!i||a!=="")&&(v+=yb(e,t)),d=u[h],p=s[d],e.replacer&&(p=e.replacer.call(s,d,p)),gr(e,t+1,d,!0,!0,!0)&&(g=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,g&&(e.dump&&nu===e.dump.charCodeAt(0)?v+="?":v+="? "),v+=e.dump,g&&(v+=yb(e,t)),gr(e,t+1,p,!0,g)&&(e.dump&&nu===e.dump.charCodeAt(0)?v+=":":v+=": ",v+=e.dump,a+=v));e.tag=l,e.dump=a||"{}"}function Uk(e,t,s){var i,a,l,u,h,m;for(a=s?e.explicitTypes:e.implicitTypes,l=0,u=a.length;l<u;l+=1)if(h=a[l],(h.instanceOf||h.predicate)&&(!h.instanceOf||typeof t=="object"&&t instanceof h.instanceOf)&&(!h.predicate||h.predicate(t))){if(s?h.multi&&h.representName?e.tag=h.representName(t):e.tag=h.tag:e.tag="?",h.represent){if(m=e.styleMap[h.tag]||h.defaultStyle,I5.call(h.represent)==="[object Function]")i=h.represent(t,m);else if(P5.call(h.represent,m))i=h.represent[m](t,m);else throw new Zs("!<"+h.tag+'> tag resolver accepts not "'+m+'" style');e.dump=i}return!0}return!1}function gr(e,t,s,i,a,l,u){e.tag=null,e.dump=s,Uk(e,s,!1)||Uk(e,s,!0);var h=I5.call(e.dump),m=i,d;i&&(i=e.flowLevel<0||e.flowLevel>t);var p=h==="[object Object]"||h==="[object Array]",g,v;if(p&&(g=e.duplicates.indexOf(s),v=g!==-1),(e.tag!==null&&e.tag!=="?"||v||e.indent!==2&&t>0)&&(a=!1),v&&e.usedDuplicates[g])e.dump="*ref_"+g;else{if(p&&v&&!e.usedDuplicates[g]&&(e.usedDuplicates[g]=!0),h==="[object Object]")i&&Object.keys(e.dump).length!==0?(sW(e,t,e.dump,a),v&&(e.dump="&ref_"+g+e.dump)):(tW(e,t,e.dump),v&&(e.dump="&ref_"+g+" "+e.dump));else if(h==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!u&&t>0?Hk(e,t-1,e.dump,a):Hk(e,t,e.dump,a),v&&(e.dump="&ref_"+g+e.dump)):(eW(e,t,e.dump),v&&(e.dump="&ref_"+g+" "+e.dump));else if(h==="[object String]")e.tag!=="?"&&ZG(e,e.dump,t,l,m);else{if(h==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Zs("unacceptable kind of an object to dump "+h)}e.tag!==null&&e.tag!=="?"&&(d=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?d="!"+d:d.slice(0,18)==="tag:yaml.org,2002:"?d="!!"+d.slice(18):d="!<"+d+">",e.dump=d+" "+e.dump)}return!0}function nW(e,t){var s=[],i=[],a,l;for(wb(e,s,i),a=0,l=i.length;a<l;a+=1)t.duplicates.push(s[i[a]]);t.usedDuplicates=new Array(l)}function wb(e,t,s){var i,a,l;if(e!==null&&typeof e=="object")if(a=t.indexOf(e),a!==-1)s.indexOf(a)===-1&&s.push(a);else if(t.push(e),Array.isArray(e))for(a=0,l=e.length;a<l;a+=1)wb(e[a],t,s);else for(i=Object.keys(e),a=0,l=i.length;a<l;a+=1)wb(e[i[a]],t,s)}function iW(e,t){t=t||{};var s=new GG(t);s.noRefs||nW(e,s);var i=e;return s.replacer&&(i=s.replacer.call({"":i},"",i)),gr(s,0,i,!0,!0)?s.dump+`
|
|
205
|
-
`:""}var rW=iW,aW={dump:rW};function Fx(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var oW=Is,lW=c5,cW=f5,uW=x5,dW=v5,hW=Px,fW=B5.load,mW=B5.loadAll,pW=aW.dump,gW=Zs,bW={binary:k5,float:b5,map:h5,null:m5,pairs:N5,set:E5,timestamp:S5,bool:p5,int:g5,merge:w5,omap:C5,seq:d5,str:u5},xW=Fx("safeLoad","load"),vW=Fx("safeLoadAll","loadAll"),_W=Fx("safeDump","dump"),yW={Type:oW,Schema:lW,FAILSAFE_SCHEMA:cW,JSON_SCHEMA:uW,CORE_SCHEMA:dW,DEFAULT_SCHEMA:hW,load:fW,loadAll:mW,dump:pW,YAMLException:gW,types:bW,safeLoad:xW,safeLoadAll:vW,safeDump:_W};function Y5(e){return e!==null&&typeof e=="object"}function X5(e){return typeof e=="string"?"text-rose-700 dark:text-rose-300":typeof e=="number"?"text-emerald-700 dark:text-emerald-300":typeof e=="boolean"?"text-blue-700 dark:text-blue-400":e==null?"text-muted-foreground italic":"text-foreground"}function Z5(e){return e==null?"null":typeof e=="string"?e===""?'""':e:String(e)}function Q5({label:e,value:t,depth:s,defaultOpen:i}){const[a,l]=y.useState(i),u={paddingLeft:`${s*1.1}rem`};if(!Y5(t))return o.jsxs("div",{className:"flex items-baseline gap-2 py-[1px]",style:u,children:[o.jsxs("span",{className:"text-muted-foreground",children:[e,":"]}),o.jsx("span",{className:le("whitespace-pre-wrap break-words",X5(t)),children:Z5(t)})]});const h=Array.isArray(t)?t.map((d,p)=>[String(p),d]):Object.entries(t),m=Array.isArray(t)?`[${h.length}]`:`{${h.length}}`;return o.jsxs("div",{children:[o.jsxs("button",{type:"button",onClick:()=>l(d=>!d),className:"flex w-full items-center gap-1 py-[1px] text-left hover:bg-muted",style:u,children:[a?o.jsx(Mn,{className:"size-3.5 shrink-0 text-muted-foreground"}):o.jsx(Li,{className:"size-3.5 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"font-medium text-foreground",children:e}),o.jsx("span",{className:"text-muted-foreground",children:m})]}),a?h.map(([d,p])=>o.jsx(Q5,{label:d,value:p,depth:s+1,defaultOpen:s<1},d)):null]})}function SW({content:e}){const t=y.useMemo(()=>{try{const i=yW.loadAll(e);return{value:i.length<=1?i[0]:i,error:null}}catch(i){return{value:null,error:i instanceof Error?i.message:String(i)}}},[e]);if(t.error)return o.jsx("div",{className:"p-4",children:o.jsxs(Qe,{variant:"destructive",children:["Could not parse YAML: ",t.error]})});if(!Y5(t.value))return o.jsx("div",{className:"p-4 font-mono text-[12px]",children:o.jsx("span",{className:X5(t.value),children:Z5(t.value)})});const s=Array.isArray(t.value)?t.value.map((i,a)=>[String(a),i]):Object.entries(t.value);return o.jsx("div",{className:"min-w-max px-4 py-3 font-mono text-[12px] leading-[1.6]",children:s.map(([i,a])=>o.jsx(Q5,{label:i,value:a,depth:0,defaultOpen:!0},i))})}const wW=y.lazy(()=>mq(()=>import("./code-editor-
|
|
205
|
+
`:""}var rW=iW,aW={dump:rW};function Fx(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var oW=Is,lW=c5,cW=f5,uW=x5,dW=v5,hW=Px,fW=B5.load,mW=B5.loadAll,pW=aW.dump,gW=Zs,bW={binary:k5,float:b5,map:h5,null:m5,pairs:N5,set:E5,timestamp:S5,bool:p5,int:g5,merge:w5,omap:C5,seq:d5,str:u5},xW=Fx("safeLoad","load"),vW=Fx("safeLoadAll","loadAll"),_W=Fx("safeDump","dump"),yW={Type:oW,Schema:lW,FAILSAFE_SCHEMA:cW,JSON_SCHEMA:uW,CORE_SCHEMA:dW,DEFAULT_SCHEMA:hW,load:fW,loadAll:mW,dump:pW,YAMLException:gW,types:bW,safeLoad:xW,safeLoadAll:vW,safeDump:_W};function Y5(e){return e!==null&&typeof e=="object"}function X5(e){return typeof e=="string"?"text-rose-700 dark:text-rose-300":typeof e=="number"?"text-emerald-700 dark:text-emerald-300":typeof e=="boolean"?"text-blue-700 dark:text-blue-400":e==null?"text-muted-foreground italic":"text-foreground"}function Z5(e){return e==null?"null":typeof e=="string"?e===""?'""':e:String(e)}function Q5({label:e,value:t,depth:s,defaultOpen:i}){const[a,l]=y.useState(i),u={paddingLeft:`${s*1.1}rem`};if(!Y5(t))return o.jsxs("div",{className:"flex items-baseline gap-2 py-[1px]",style:u,children:[o.jsxs("span",{className:"text-muted-foreground",children:[e,":"]}),o.jsx("span",{className:le("whitespace-pre-wrap break-words",X5(t)),children:Z5(t)})]});const h=Array.isArray(t)?t.map((d,p)=>[String(p),d]):Object.entries(t),m=Array.isArray(t)?`[${h.length}]`:`{${h.length}}`;return o.jsxs("div",{children:[o.jsxs("button",{type:"button",onClick:()=>l(d=>!d),className:"flex w-full items-center gap-1 py-[1px] text-left hover:bg-muted",style:u,children:[a?o.jsx(Mn,{className:"size-3.5 shrink-0 text-muted-foreground"}):o.jsx(Li,{className:"size-3.5 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"font-medium text-foreground",children:e}),o.jsx("span",{className:"text-muted-foreground",children:m})]}),a?h.map(([d,p])=>o.jsx(Q5,{label:d,value:p,depth:s+1,defaultOpen:s<1},d)):null]})}function SW({content:e}){const t=y.useMemo(()=>{try{const i=yW.loadAll(e);return{value:i.length<=1?i[0]:i,error:null}}catch(i){return{value:null,error:i instanceof Error?i.message:String(i)}}},[e]);if(t.error)return o.jsx("div",{className:"p-4",children:o.jsxs(Qe,{variant:"destructive",children:["Could not parse YAML: ",t.error]})});if(!Y5(t.value))return o.jsx("div",{className:"p-4 font-mono text-[12px]",children:o.jsx("span",{className:X5(t.value),children:Z5(t.value)})});const s=Array.isArray(t.value)?t.value.map((i,a)=>[String(a),i]):Object.entries(t.value);return o.jsx("div",{className:"min-w-max px-4 py-3 font-mono text-[12px] leading-[1.6]",children:s.map(([i,a])=>o.jsx(Q5,{label:i,value:a,depth:0,defaultOpen:!0},i))})}const wW=y.lazy(()=>mq(()=>import("./code-editor-C3yeCqYg.js"),[]).then(e=>({default:e.CodeEditor})));function kW(e){const t=e.split("/").pop()?.toLowerCase().split(".").pop()??"";return t==="md"||t==="mdx"||t==="markdown"?"markdown":t==="yml"||t==="yaml"?"yaml":null}function CW(e){const t=e.split("/").pop()?.toLowerCase()??"",s=t.includes(".")?t.split(".").pop()??"":"",i={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",h:"c",cpp:"cpp",cc:"cpp",hpp:"cpp",cs:"csharp",sh:"bash",bash:"bash",zsh:"bash",json:"json",yaml:"yaml",yml:"yaml",toml:"ini",ini:"ini",md:"markdown",mdx:"markdown",css:"css",scss:"scss",less:"less",html:"xml",xml:"xml",sql:"sql",dockerfile:"dockerfile"};return i[s]?i[s]:t==="dockerfile"?"dockerfile":null}function NW(e,t){const s=e.endsWith(`
|
|
206
206
|
`)?e.slice(0,-1):e;return!t||!xb.getLanguage(t)?s.split(`
|
|
207
207
|
`).map(Fk):s.split(`
|
|
208
208
|
`).map(i=>{if(!i)return"";try{return xb.highlight(i,{language:t,ignoreIllegals:!0}).value}catch{return Fk(i)}})}function Fk(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function EW({content:e,path:t}){const s=y.useMemo(()=>CW(t),[t]),i=y.useMemo(()=>NW(e,s),[e,s]),a=`${Math.max(2,String(i.length).length)}ch`;return o.jsx("div",{className:"min-w-max font-mono text-[12px] leading-[1.5]",children:i.map((l,u)=>o.jsxs("div",{className:"flex",children:[o.jsx("span",{className:"shrink-0 select-none border-r border-zinc-200 bg-zinc-100 px-2 text-right text-zinc-400 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-500",style:{minWidth:`calc(${a} + 1rem)`},children:u+1}),o.jsx("span",{className:"hljs whitespace-pre px-3 text-zinc-800 dark:text-zinc-100",dangerouslySetInnerHTML:{__html:l||" "}})]},u))})}function TW({path:e,isModified:t,onViewDiff:s,onFileSaved:i,onSendToAi:a}){const[l,u]=y.useState(null),[h,m]=y.useState(""),[d,p]=y.useState(!1),[g,v]=y.useState(null),[_,S]=y.useState(!1),[w,C]=y.useState(!1),{success:E,error:T}=Ns(),N=y.useMemo(()=>kW(e),[e]),[j,R]=y.useState("preview"),z=!!(l&&!l.binary&&!l.truncated),D=l?h!==l.content:!1;y.useEffect(()=>{R(N?"preview":"source"),p(!1)},[N]),y.useEffect(()=>{if(!e){u(null);return}let L=!0;return S(!0),v(null),p(!1),F6(e).then(B=>{L&&(u(B),m(B.content),S(!1))}).catch(B=>{L&&(v(B instanceof Error?B.message:String(B)),S(!1))}),()=>{L=!1}},[e]);async function M(){if(!(!e||!l||!D||w)){C(!0);try{await q6(e,h);const L={...l,content:h,size:new TextEncoder().encode(h).length};u(L),p(!1),E(`Saved ${e}.`),i?.(e)}catch(L){T(L instanceof Error?L.message:String(L))}finally{C(!1)}}}function $(){m(l?.content??""),p(!1)}return e?o.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:e}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[o.jsx("span",{children:"Read-only view of tracked file."}),l?.truncated?o.jsx("span",{className:"text-amber-700",children:"Truncated — file exceeds 1MB."}):null,l?.binary?o.jsx("span",{className:"text-amber-700",children:"Binary file."}):null]})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[N&&!l?.binary?o.jsxs("div",{className:"flex items-center rounded-md border border-border p-0.5",children:[o.jsxs("button",{type:"button",onClick:()=>R("preview"),"aria-pressed":j==="preview",className:le("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",j==="preview"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[o.jsx(Rb,{className:"size-3.5"}),"Preview"]}),o.jsxs("button",{type:"button",onClick:()=>R("source"),"aria-pressed":j==="source",className:le("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",j==="source"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[o.jsx(cC,{className:"size-3.5"}),"Source"]})]}):null,t?o.jsx(se,{onClick:s,size:"sm",type:"button",variant:"outline",children:"View diff"}):null,a?o.jsx(se,{"aria-label":"Send file to AI input",className:"size-8",disabled:!e,onClick:a,size:"icon",title:"Send file path to AI input",type:"button",variant:"outline",children:o.jsx(Gt,{className:"size-4"})}):null,d?o.jsxs(o.Fragment,{children:[o.jsxs(se,{disabled:!D||w,onClick:()=>{M()},size:"sm",type:"button",children:[o.jsx(wC,{}),"Apply"]}),o.jsxs(se,{disabled:w,onClick:$,size:"sm",type:"button",variant:"outline",children:[o.jsx(Gs,{}),"Cancel"]})]}):z?o.jsxs(se,{onClick:()=>{R("source"),p(!0)},size:"sm",type:"button",variant:"outline",children:[o.jsx(Gc,{}),"Edit"]}):null]})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto bg-zinc-50 dark:bg-zinc-950",children:g?o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"destructive",children:g})}):_?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading…"}):l?.binary?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Cannot display binary content."}):l?d?o.jsx(y.Suspense,{fallback:o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading editor…"}),children:o.jsx(wW,{path:e,value:h,onChange:m})}):N&&j==="preview"?N==="markdown"?o.jsx(tV,{content:l.content}):o.jsx(SW,{content:l.content}):o.jsx(EW,{content:l.content,path:e}):null})]}):o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a file to view its contents."})})}function jW({activeHunkIndex:e,filePaths:t,hunkCount:s,pendingNextFilePath:i,selectedFile:a}){if(s>0&&e<s-1)return{kind:"hunk",activeHunkIndex:e+1};const l=t.indexOf(a),u=t[l+1];return u?i===u?{kind:"file",filePath:u}:{kind:"confirm-next-file",filePath:u}:{kind:"none"}}function qk(e){const t={name:"",fullPath:"",children:new Map};for(const s of e){const i=s.name.split("/");let a=t;i.forEach((l,u)=>{let h=a.children.get(l);h||(h={name:l,fullPath:i.slice(0,u+1).join("/"),children:new Map},a.children.set(l,h)),a=h}),a.branch=s}return t}function Vk({label:e,tree:t,onSelect:s,defaultOpen:i,forceOpen:a}){const[l,u]=y.useState(i??!1),h=a||l,m=t.children.size===0;return o.jsxs("div",{className:"mb-1",children:[o.jsxs("button",{type:"button",onClick:()=>u(d=>!d),className:"flex w-full items-center gap-1 px-2 py-0.5 text-left text-[11px] font-semibold uppercase tracking-wide text-muted-foreground hover:text-foreground",children:[h?o.jsx(Mn,{size:12}):o.jsx(Li,{size:12}),e,m?null:o.jsxs("span",{className:"ml-1 text-[10px] font-normal",children:["(",t.children.size,")"]})]}),h&&!m?o.jsx("ul",{children:Array.from(t.children.values()).map(d=>o.jsx(J5,{node:d,depth:1,onSelect:s,forceOpen:a},d.fullPath))}):null]})}function J5({node:e,depth:t,onSelect:s,forceOpen:i}){const[a,l]=y.useState(!0),u=i||a,h=e.children.size>0,m=e.branch,d={paddingLeft:`${t*10}px`};return!h&&m?o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>s(m),style:d,title:m.name,className:`flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60 ${m.current?"font-semibold text-emerald-700":""}`,children:[o.jsx(pn,{size:11,className:"shrink-0 opacity-70"}),o.jsx("span",{className:"truncate",children:e.name}),m.current?o.jsx("span",{className:"text-[10px]",children:"●"}):null]})}):o.jsxs("li",{children:[o.jsxs("button",{type:"button",onClick:()=>{m?s(m):l(p=>!p)},style:d,className:"flex w-full items-center gap-1 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60",children:[h?u?o.jsx(Mn,{size:11}):o.jsx(Li,{size:11}):o.jsx("span",{className:"inline-block w-[11px]"}),o.jsx("span",{className:"truncate",children:e.name})]}),u&&h?o.jsx("ul",{children:Array.from(e.children.values()).map(p=>o.jsx(J5,{node:p,depth:t+1,onSelect:s,forceOpen:i},p.fullPath))}):null]})}function AW({selectedCommit:e,selectedFile:t,diff:s,diffLoading:i,diffError:a}){return o.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col bg-card border-b border-border",children:[o.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:t??(e?e.subject:"Commit")}),e?o.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[o.jsx("span",{className:"font-mono",children:e.hash.slice(0,12)}),o.jsxs("span",{children:[e.author," <",e.email,">"]}),o.jsx("span",{children:new Date(e.timestamp*1e3).toLocaleString()})]}):null]})}),o.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:a?o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"destructive",children:a})}):e?i?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading diff…"}):s?o.jsx(Bx,{activeHunkIndex:0,diff:s}):o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"muted",className:"border-dashed p-6 text-center",children:e.parents.length>1?"Merge commit with no conflict resolution — no diff against the first parent.":"No textual changes in this commit."})}):o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a commit to inspect its diff."})})})]})}function MW({files:e,filesError:t,selectedHash:s,selectedFile:i,onSelect:a}){return o.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[o.jsx("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:o.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Files",e.length?o.jsx("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:e.length}):null]})}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:t?o.jsx("div",{className:"p-3",children:o.jsx(Qe,{variant:"destructive",children:t})}):s?e.length===0?o.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No file changes."}):o.jsx("ul",{className:"divide-y divide-border",children:e.map(l=>o.jsx("li",{children:o.jsxs("button",{onClick:()=>a(l.path),type:"button",title:l.path,className:`flex w-full items-center gap-2 px-2 py-1 text-left text-[12px] transition-colors hover:bg-muted/60 ${i===l.path?"bg-muted":""}`,children:[o.jsx("span",{className:RW(l.index),children:l.index.trim()||"·"}),o.jsx("span",{className:"truncate font-mono",children:l.path})]})},l.path))}):o.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Select a commit to see its files."})})]})}function RW(e){const t="inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-[10px] font-bold";switch(e.trim().toUpperCase()){case"A":return`${t} bg-emerald-100 text-emerald-800`;case"D":return`${t} bg-red-100 text-red-800`;case"M":return`${t} bg-amber-100 text-amber-800`;case"R":return`${t} bg-blue-100 text-blue-800`;case"C":return`${t} bg-indigo-100 text-indigo-800`;default:return`${t} bg-slate-100 text-slate-700`}}const Gk=["#3b82f6","#10b981","#f59e0b","#ec4899","#8b5cf6","#14b8a6","#ef4444","#84cc16"];function kc(e){return Gk[e%Gk.length]}function DW({lane:e,laneCount:t,edges:s,throughLanes:i,isMerge:a,height:l=28,laneWidth:u=14}){const m=Math.max(e+1,t,1)*u,d=l/2,p=Cc(e,u),g=a?4:3.5;return o.jsxs("svg",{width:m,height:l,viewBox:`0 0 ${m} ${l}`,style:{flex:"0 0 auto",display:"block"},children:[i.map(v=>o.jsx("line",{x1:Cc(v,u),y1:0,x2:Cc(v,u),y2:l,stroke:kc(v),strokeWidth:1.5},`t-${v}`)),o.jsx("line",{x1:p,y1:0,x2:p,y2:d,stroke:kc(e),strokeWidth:1.5}),s.map((v,_)=>{const S=Cc(v.fromLane,u),w=Cc(v.toLane,u);if(S===w)return o.jsx("line",{x1:S,y1:d,x2:w,y2:l,stroke:kc(v.toLane),strokeWidth:1.5},`e-${_}`);const C=d+(l-d)/2;return o.jsx("path",{d:`M ${S} ${d} C ${S} ${C}, ${w} ${C}, ${w} ${l}`,fill:"none",stroke:kc(v.toLane),strokeWidth:1.5},`e-${_}`)}),o.jsx("circle",{cx:p,cy:d,r:g,fill:kc(e),stroke:"var(--background, #fff)",strokeWidth:1.5})]})}function Cc(e,t){return e*t+t/2}const OW=5,kb=new Map,t0=new Map,Cb=[];let Nb=0;function Wk(){for(;Nb<OW&&Cb.length>0;){const e=Cb.shift();e&&(Nb++,e())}}function LW(e){return kb.get(e)}function zW(e){const t=kb.get(e);if(t)return Promise.resolve(t);const s=t0.get(e);if(s)return s;const i=new Promise((a,l)=>{Cb.push(()=>{rR(e).then(u=>{u.state!=="pending"&&kb.set(e,u),a(u)}).catch(l).finally(()=>{Nb--,t0.delete(e),Wk()})})});return t0.set(e,i),Wk(),i}function BW({sha:e}){const[t,s]=y.useState(()=>LW(e)??null),i=y.useRef(null);if(y.useEffect(()=>{if(t)return;const u=i.current;if(!u||typeof IntersectionObserver>"u")return;let h=!0;const m=new IntersectionObserver(d=>{d.some(p=>p.isIntersecting)&&(m.disconnect(),zW(e).then(p=>{h&&s(p)}).catch(()=>{}))},{rootMargin:"200px"});return m.observe(u),()=>{h=!1,m.disconnect()}},[e,t]),!t||t.state==="unknown"||t.totalCount===0)return o.jsx("span",{ref:i,"aria-hidden":!0,className:"inline-block size-2 shrink-0"});const a=IW(t.state),l=`CI: ${t.state} (${t.totalCount} check${t.totalCount!==1?"s":""})`;return o.jsx("span",{"aria-label":l,className:`shrink-0 size-2 rounded-full ${a}`,title:l})}function IW(e){switch(e){case"success":return"bg-emerald-500";case"pending":return"bg-amber-400 animate-pulse";case"failure":return"bg-red-500";case"error":return"bg-orange-500";default:return"bg-zinc-400"}}const Kk=28;function PW({commits:e,loading:t,error:s,selectedHash:i,maxLanes:a,rowRefs:l,onSelect:u,onLoadMore:h}){const{sendToAgent:m}=Bt(),[d,p]=y.useState(null);function g(v,_){p(null),m({prompt:Z9(v,_),source:{type:"git-commit",label:v.hash.slice(0,7)},label:`${v.hash.slice(0,7)}: ${_}`})}return o.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[o.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Commit tree",e.length?o.jsxs("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:[e.length," commits"]}):null]}),o.jsx(se,{disabled:t,onClick:h,size:"sm",type:"button",variant:"outline",children:"Load more"})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:s?o.jsx("div",{className:"p-3",children:o.jsx(Qe,{variant:"destructive",children:s})}):t&&e.length===0?o.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Loading commits…"}):e.length===0?o.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No commits."}):o.jsx("ul",{className:"divide-y divide-border",children:e.map(v=>o.jsxs("li",{ref:_=>{_?l.current.set(v.hash,_):l.current.delete(v.hash)},className:"group flex flex-col",children:[o.jsxs("div",{className:`flex items-center transition-colors hover:bg-muted/60 ${i===v.hash?"bg-muted":""}`,children:[o.jsxs("button",{onClick:()=>u(v.hash),type:"button",className:"flex min-w-0 flex-1 items-center gap-2 px-2 py-0.5 text-left",style:{minHeight:Kk},title:`${v.hash}
|
|
209
209
|
${v.author} <${v.email}>
|
|
210
210
|
${v.subject}`,children:[o.jsx(DW,{lane:v.lane,laneCount:Math.max(v.laneCount,a),edges:v.edges,throughLanes:v.throughLanes,isMerge:v.parents.length>1,height:Kk}),o.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[v.hash.slice(0,7),o.jsx(BW,{sha:v.hash})]}),o.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[v.refs.map(_=>o.jsx("span",{className:HW(_.kind),children:_.name},`${_.kind}-${_.name}`)),o.jsx("span",{className:"truncate text-[12px]",children:v.subject})]}),o.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:v.author}),o.jsx("span",{className:"shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground/70",title:new Date(v.timestamp*1e3).toLocaleString(),children:$W(v.timestamp)})]}),o.jsx(ll,{className:`mr-1 shrink-0 ${d===v.hash?"opacity-100":""}`,label:`Ask AI about commit ${v.hash.slice(0,7)}`,onAsk:()=>p(_=>_===v.hash?null:v.hash)})]}),d===v.hash?o.jsx("div",{className:"px-2 pb-1.5 pt-0.5",children:o.jsx(pu,{placeholder:"What should the agent do with this commit? (explain, summarize, find regressions…)",onSubmit:_=>g(v,_),onCancel:()=>p(null)})}):null]},v.hash))})})]})}function $W(e){if(!e)return"";const t=Math.max(0,Math.floor(Date.now()/1e3-e));if(t<60)return`${t}s`;const s=Math.floor(t/60);if(s<60)return`${s}m`;const i=Math.floor(s/60);if(i<24)return`${i}h`;const a=Math.floor(i/24);if(a<30)return`${a}d`;const l=Math.floor(a/30);return l<12?`${l}mo`:`${Math.floor(l/12)}y`}function HW(e){const t="rounded border px-1.5 py-px text-[10px] font-medium";switch(e){case"head":return`${t} border-emerald-200 bg-emerald-100 text-emerald-800 dark:border-emerald-400/30 dark:bg-emerald-500/15 dark:text-emerald-300`;case"branch":return`${t} border-blue-200 bg-blue-100 text-blue-800 dark:border-blue-400/30 dark:bg-blue-500/15 dark:text-blue-300`;case"remote":return`${t} border-slate-200 bg-slate-100 text-slate-700 dark:border-zinc-700/80 dark:bg-zinc-800/80 dark:text-zinc-300`;case"tag":return`${t} border-amber-200 bg-amber-100 text-amber-800 dark:border-amber-400/30 dark:bg-amber-500/15 dark:text-amber-300`}}const Yk=200;function UW(){const[e,t]=y.useState([]),[s,i]=y.useState(Yk),[a,l]=y.useState(!0),[u,h]=y.useState(null),[m,d]=y.useState(null),[p,g]=y.useState([]),[v,_]=y.useState(!1),[S,w]=y.useState(null),[C,E]=y.useState(null),[T,N]=y.useState(""),[j,R]=y.useState(!1),[z,D]=y.useState(null),M=y.useCallback(B=>{d(B),g([]),E(null),N("")},[]);y.useEffect(()=>{let B=!0;return l(!0),h(null),I6(s).then(P=>{B&&(t(P),P.length>0&&!P.some(F=>F.hash===m)&&M(P[0].hash))}).catch(P=>{B&&h(P instanceof Error?P.message:String(P))}).finally(()=>{B&&l(!1)}),()=>{B=!1}},[s]),y.useEffect(()=>{if(!m){g([]),E(null),_(!1);return}let B=!0;return w(null),_(!0),$6(m).then(P=>{B&&(g(P),E(P[0]?.path??null))}).catch(P=>{B&&w(P instanceof Error?P.message:String(P))}).finally(()=>{B&&_(!1)}),()=>{B=!1}},[m]),y.useEffect(()=>{if(!m||!C){N(""),R(!1);return}let B=!0;return D(null),R(!0),P6(m,C).then(P=>{B&&N(P)}).catch(P=>{B&&D(P instanceof Error?P.message:String(P))}).finally(()=>{B&&R(!1)}),()=>{B=!1}},[m,C]);const $=y.useMemo(()=>e.reduce((B,P)=>Math.max(B,P.laneCount),1),[e]),L=e.find(B=>B.hash===m)??null;return{commits:e,loading:a,error:u,selectedHash:m,setSelectedHash:M,files:p,filesError:S,selectedFile:C,setSelectedFile:E,diff:T,diffLoading:j||v,diffError:z,maxLanes:$,selectedCommit:L,loadMore:()=>i(B=>B+Yk)}}function FW({branches:e=[]}){const{commits:t,loading:s,error:i,selectedHash:a,setSelectedHash:l,files:u,filesError:h,selectedFile:m,setSelectedFile:d,diff:p,diffLoading:g,diffError:v,maxLanes:_,selectedCommit:S,loadMore:w}=UW(),[C,E]=y.useState(""),T=y.useMemo(()=>{const M=C.trim().toLowerCase();return M?e.filter($=>$.name.toLowerCase().includes(M)):e},[e,C]),N=y.useMemo(()=>qk(T.filter(M=>!M.remote)),[T]),j=y.useMemo(()=>qk(T.filter(M=>M.remote)),[T]),R=C.trim().length>0,z=y.useRef(new Map);function D(M){const $=M.remote?"remote":"branch",L=t.find(F=>F.refs.some(V=>V.kind===$&&V.name===M.name));if(!L)return;l(L.hash);const B=z.current.get(L.hash),P=B?.parentElement?.parentElement;!B||!P||P.scrollTo({top:Math.max(B.offsetTop-P.clientHeight/2+B.clientHeight/2,0),behavior:"smooth"})}return o.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 grid-cols-[220px_minmax(0,1fr)]",children:[o.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[o.jsxs("div",{className:"flex shrink-0 flex-col gap-1 border-b border-border px-3 py-1.5",children:[o.jsx("h2",{className:"text-[13px] font-semibold tracking-tight",children:"Branches"}),o.jsx("input",{type:"search",value:C,onChange:M=>E(M.target.value),placeholder:"Search branches…",className:"w-full rounded border border-border bg-background px-2 py-1 text-[11px] outline-none focus:border-foreground"})]}),o.jsxs("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:[o.jsx(Vk,{label:"Local",tree:N,onSelect:D,defaultOpen:!0,forceOpen:R}),o.jsx(Vk,{label:"Remote",tree:j,onSelect:D,forceOpen:R})]})]}),o.jsxs("div",{className:"grid min-h-0 min-w-0 grid-rows-[minmax(0,3fr)_minmax(0,2fr)]",children:[o.jsx(AW,{selectedCommit:S,selectedFile:m,diff:p,diffLoading:g,diffError:v}),o.jsxs("div",{className:"grid min-h-0 min-w-0 grid-cols-[minmax(0,1fr)_280px]",children:[o.jsx(PW,{commits:t,loading:s,error:i,selectedHash:a,maxLanes:_,rowRefs:z,onSelect:l,onLoadMore:w}),o.jsx(MW,{files:u,filesError:h,selectedHash:a,selectedFile:m,onSelect:d})]})]})]})}const Eb=300,qW=600,VW=new Set(["md","mdx","markdown","txt","rst","adoc","json","jsonc","json5","yaml","yml","toml","xml","ini","cfg","conf","env","properties","csv","tsv","lock","svg","map","snap","png","jpg","jpeg","gif","ico","webp"]);function GW(e){const t=e.toLowerCase();if(t.endsWith(".d.ts")||t.endsWith(".min.js")||t.endsWith(".min.css"))return!1;const s=t.lastIndexOf(".");return s<0?!0:!VW.has(t.slice(s+1))}function WW(e){return e>=qW?"danger":e>=Eb?"warn":"ok"}const KW={ok:"bg-emerald-500/60",warn:"bg-amber-500/70",danger:"bg-destructive/70"},YW={ok:"text-muted-foreground",warn:"text-amber-600 dark:text-amber-400",danger:"text-destructive"};function XW({onOpenFile:e,root:t}){const[s,i]=y.useState([]),[a,l]=y.useState(!0),[u,h]=y.useState(null),[m,d]=y.useState(!0);function p(){l(!0),h(null),U6().then(i).catch(w=>h(w instanceof Error?w.message:String(w))).finally(()=>l(!1))}y.useEffect(()=>{p()},[]);const g=y.useMemo(()=>m?s.filter(w=>GW(w.path)):s,[s,m]),v=s.length-g.length,_=g[0]?.lines??1,S=g.filter(w=>w.lines>=Eb).length;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx(mC,{className:"size-4"}),o.jsx("span",{className:"font-semibold text-foreground",children:"Largest files"}),!a&&!u?o.jsxs("span",{children:[g.length," files · ",S," over ",Eb," lines",m&&v>0?` · ${v} data/docs hidden`:""]}):null]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs(se,{size:"sm",variant:m?"default":"outline",className:"h-7",onClick:()=>d(w=>!w),title:"Hide docs, data, config and generated files",type:"button",children:[o.jsx(cC,{}),"Code only"]}),o.jsxs(se,{size:"sm",variant:"outline",className:"h-7",onClick:p,disabled:a,type:"button",children:[a?o.jsx(pt,{className:"animate-spin"}):o.jsx(ou,{}),"Refresh"]})]})]}),u?o.jsx(Qe,{variant:"destructive",className:"m-3",children:u}):a&&s.length===0?o.jsxs("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:[o.jsx(pt,{className:"mr-2 size-4 animate-spin"}),"Scanning tracked files…"]}):g.length===0?o.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:s.length===0?"No tracked text files found.":"No code files — toggle off “Code only” to see data & docs."}):o.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border/60 overflow-auto",children:g.map((w,C)=>{const E=WW(w.lines);return o.jsxs("li",{className:"group flex items-center gap-3 px-3 transition-colors hover:bg-muted/50",children:[o.jsx("span",{className:"w-6 shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:C+1}),o.jsx("button",{type:"button",onClick:()=>e(w.path),className:"min-w-0 flex-1 py-1.5 text-left",children:o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"truncate font-mono text-[11px]",children:w.path}),o.jsxs("span",{className:le("shrink-0 font-mono text-[11px] tabular-nums",YW[E]),children:[w.truncated?"≥":"",w.lines.toLocaleString()," lines"]})]}),o.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:le("h-full rounded-full",KW[E]),style:{width:`${Math.max(2,w.lines/_*100)}%`}})})]})}),o.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-0.5",children:[o.jsx(ZW,{file:w,root:t}),o.jsx(QW,{file:w,root:t})]})]},w.path)})})]})}function ZW({file:e,root:t}){const{sendToAgent:s}=Bt(),i=bu(t,e.path),a=e.path.split("/").pop()??e.path;function l(){s({prompt:X9({absolutePath:i,lines:e.lines,relativePath:e.path}),source:{label:a,type:"large-file"},label:`Help me split \`${e.path}\` (${e.lines.toLocaleString()} lines).`,mode:"send"})}function u(){s({prompt:i,source:{label:a,type:"large-file"},mode:"draft"})}return o.jsx(eT,{label:`AI actions for ${e.path}`,trigger:o.jsx(Gt,{className:"size-3.5"}),children:h=>o.jsxs(o.Fragment,{children:[o.jsx(Vc,{icon:o.jsx(Gt,{className:"size-3.5"}),onSelect:()=>{h(),l()},children:"Ask AI to split this file"}),o.jsx(Vc,{icon:o.jsx(fC,{className:"size-3.5"}),onSelect:()=>{h(),u()},children:"Send file path to AI"})]})})}function QW({file:e,root:t}){const{error:s,success:i}=Ns(),a=bu(t,e.path),l=e.path.split("/").pop()??e.path;async function u(h,m){try{await navigator.clipboard.writeText(h),i(`Copied ${m}.`)}catch(d){s(d instanceof Error?d.message:`Could not copy ${m}.`)}}return o.jsx(eT,{label:`Copy path for ${e.path}`,trigger:o.jsxs(o.Fragment,{children:[o.jsx(dC,{className:"size-3.5"}),o.jsx("span",{className:"sr-only",children:"More actions"})]}),children:h=>o.jsxs(o.Fragment,{children:[o.jsx(Vc,{icon:o.jsx(pC,{className:"size-3.5"}),onSelect:()=>{h(),u(l,"file name")},children:"Copy file name"}),o.jsx(Vc,{icon:o.jsx(kh,{className:"size-3.5"}),onSelect:()=>{h(),u(e.path,"relative path")},children:"Copy relative path"}),o.jsx(Vc,{icon:o.jsx(kh,{className:"size-3.5"}),onSelect:()=>{h(),u(a,"absolute path")},children:"Copy absolute path"})]})})}function eT({children:e,label:t,trigger:s}){const[i,a]=y.useState(!1),[l,u]=y.useState({right:0,top:0}),h=y.useRef(null),m=y.useRef(null);function d(){a(!1)}function p(){const g=h.current?.getBoundingClientRect();g&&u({top:g.bottom+6,right:window.innerWidth-g.right}),a(v=>!v)}return y.useEffect(()=>{if(!i)return;function g(_){const S=_.target;h.current?.contains(S)||m.current?.contains(S)||d()}function v(_){_.key==="Escape"&&d()}return document.addEventListener("mousedown",g),document.addEventListener("keydown",v),window.addEventListener("scroll",d,!0),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",v),window.removeEventListener("scroll",d,!0)}},[i]),o.jsxs(o.Fragment,{children:[o.jsx("button",{"aria-label":t,className:le("flex h-7 min-w-7 shrink-0 items-center justify-center gap-1 rounded-md px-1.5 text-muted-foreground opacity-0 transition-all duration-150 hover:bg-muted hover:text-foreground group-hover:opacity-100",i&&"bg-muted text-foreground opacity-100"),onClick:p,ref:h,title:t,type:"button",children:s}),i?gu.createPortal(o.jsx("div",{className:"fixed z-50 w-56 overflow-hidden rounded-md border border-border bg-card p-1 shadow-md",ref:m,style:{top:l.top,right:l.right},children:e(d)}),document.body):null]})}function Vc({children:e,icon:t,onSelect:s}){return o.jsxs("button",{className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition-colors hover:bg-muted",onClick:s,type:"button",children:[o.jsx("span",{className:"text-muted-foreground",children:t}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:e})]})}function JW(){const[e,t]=y.useState(!1),[s,i]=y.useState(!1),[a,l]=y.useState(!0);function u(){l(!0),K6().then(h=>{t(h.configured),i(h.deviceFlowAvailable)}).catch(()=>{t(!1),i(!1)}).finally(()=>l(!1))}return y.useEffect(()=>{u()},[]),{configured:e,deviceFlowAvailable:s,loading:a,refresh:u}}const s0=30;function eK(e="open"){const[t,s]=y.useState([]),[i,a]=y.useState(!0),[l,u]=y.useState(!1),[h,m]=y.useState(!1),[d,p]=y.useState(1),[g,v]=y.useState(null),[_,S]=y.useState(null),[w,C]=y.useState(null),[E,T]=y.useState(""),[N,j]=y.useState(!1),[R,z]=y.useState(null);y.useEffect(()=>{let $=!0;return a(!0),v(null),p(1),Ap(e,1).then(L=>{$&&(s(L),m(L.length===s0),L.length>0&&!L.some(B=>B.number===_)&&S(L[0]?.number??null))}).catch(L=>{$&&v(L instanceof Error?L.message:String(L))}).finally(()=>{$&&a(!1)}),()=>{$=!1}},[e]),y.useEffect(()=>{if(!_){C(null);return}let $=!0;return Q6(_).then(L=>{$&&C(L)}).catch(()=>{}),()=>{$=!1}},[_]),y.useEffect(()=>{if(!_){T("");return}let $=!0;return j(!0),z(null),J6(_).then(L=>{$&&T(L)}).catch(L=>{$&&z(L instanceof Error?L.message:String(L))}).finally(()=>{$&&j(!1)}),()=>{$=!1}},[_]);function D(){if(l||!h)return;const $=d+1;u(!0),Ap(e,$).then(L=>{s(B=>{const P=new Set(B.map(F=>F.number));return[...B,...L.filter(F=>!P.has(F.number))]}),m(L.length===s0),p($)}).catch(L=>v(L instanceof Error?L.message:String(L))).finally(()=>u(!1))}function M(){let $=!0;return a(!0),v(null),p(1),Ap(e,1).then(L=>{$&&(s(L),m(L.length===s0))}).catch(L=>{$&&v(L instanceof Error?L.message:String(L))}).finally(()=>{$&&a(!1)}),()=>{$=!1}}return{prs:t,loading:i,loadingMore:l,hasMore:h,error:g,selectedNumber:_,setSelectedNumber:S,selectedPR:w,diff:E,diffLoading:N,diffError:R,loadMore:D,refresh:M}}const n0=30;function tK(e="open"){const[t,s]=y.useState([]),[i,a]=y.useState(!0),[l,u]=y.useState(!1),[h,m]=y.useState(!1),[d,p]=y.useState(1),[g,v]=y.useState(null),[_,S]=y.useState(null),[w,C]=y.useState(null),[E,T]=y.useState([]),[N,j]=y.useState(!1),[R,z]=y.useState(null),[D,M]=y.useState(!1);y.useEffect(()=>{let P=!0;return a(!0),v(null),p(1),Mp(e,1).then(F=>{P&&(s(F),m(F.length===n0),F.length>0&&!F.some(V=>V.number===_)&&S(F[0]?.number??null))}).catch(F=>{P&&v(F instanceof Error?F.message:String(F))}).finally(()=>{P&&a(!1)}),()=>{P=!1}},[e]),y.useEffect(()=>{if(!_){C(null),T([]);return}let P=!0;return j(!0),Promise.all([sR(_),nR(_)]).then(([F,V])=>{P&&(C(F),T(V))}).catch(()=>{}).finally(()=>{P&&j(!1)}),()=>{P=!1}},[_]);async function $(P){if(_){M(!0),z(null);try{const F=await iR(_,P);T(V=>[...V,F])}catch(F){z(F instanceof Error?F.message:String(F))}finally{M(!1)}}}function L(){if(l||!h)return;const P=d+1;u(!0),Mp(e,P).then(F=>{s(V=>{const G=new Set(V.map(I=>I.number));return[...V,...F.filter(I=>!G.has(I.number))]}),m(F.length===n0),p(P)}).catch(F=>v(F instanceof Error?F.message:String(F))).finally(()=>u(!1))}function B(){let P=!0;return a(!0),p(1),Mp(e,1).then(F=>{P&&(s(F),m(F.length===n0))}).catch(()=>{}).finally(()=>{P&&a(!1)}),()=>{P=!1}}return{issues:t,loading:i,loadingMore:l,hasMore:h,error:g,selectedNumber:_,setSelectedNumber:S,selectedIssue:w,comments:E,commentsLoading:N,commentError:R,submitting:D,addComment:$,loadMore:L,refresh:B}}function tT({className:e}){return o.jsx("svg",{className:le("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:o.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})})}function sK({deviceFlowAvailable:e,onSaved:t}){const[s,i]=y.useState(e?"choose":"pat");return s==="device-pending"?o.jsx(nK,{onSuccess:t,onCancel:()=>i("choose")}):s==="pat"?o.jsx(iK,{onSaved:t,onBack:e?()=>i("choose"):void 0}):o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-muted",children:o.jsx(Ly,{className:"size-6 text-muted-foreground"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-base font-semibold",children:"Connect GitHub"}),o.jsx("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:"Authorize NoMoreIDE to read pull requests, issues, and CI status for your repositories."})]})]}),o.jsxs("div",{className:"flex w-full max-w-xs flex-col gap-2",children:[o.jsxs(se,{className:"w-full",onClick:()=>i("device-pending"),type:"button",children:[o.jsx(Ly,{className:"mr-2 size-4"}),"Authorize with GitHub"]}),o.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:()=>i("pat"),type:"button",children:"Use a Personal Access Token instead"})]})]})}function nK({onSuccess:e,onCancel:t}){const[s,i]=y.useState(null),[a,l]=y.useState(null),[u,h]=y.useState(!0),[m,d]=y.useState(!1),p=y.useRef(null),g=y.useRef(5),v=y.useRef(!1);y.useEffect(()=>{let C=!0;return Y6().then(E=>{if(!C)return;i(E),g.current=E.interval,h(!1);const T=E.verification_uri_complete||E.verification_uri;T&&window.open(T,"_blank","noopener,noreferrer"),_(E.device_code,E.interval),setTimeout(()=>{v.current=!0},E.expires_in*1e3)}).catch(E=>{C&&(l(E instanceof Error?E.message:String(E)),h(!1))}),()=>{C=!1,p.current&&clearTimeout(p.current)}},[]);function _(C,E){p.current=setTimeout(()=>{S(C,E)},E*1e3)}async function S(C,E){if(v.current){l("Authorization expired. Please try again.");return}try{const T=await X6(C);if(T.done){e();return}const N=T.slowDown?E+5:E;g.current=N,_(C,N)}catch{_(C,g.current)}}function w(){s&&navigator.clipboard.writeText(s.user_code).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)})}return u?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx(zy,{className:"size-6 animate-spin text-muted-foreground"}),o.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Requesting authorization…"})]})}):a?o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 p-8",children:[o.jsx(Qe,{variant:"destructive",children:a}),o.jsx(se,{onClick:t,variant:"outline",children:"Go back"})]}):o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-emerald-100 dark:bg-emerald-500/15",children:o.jsx(Mb,{className:"size-6 text-emerald-600 dark:text-emerald-400"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-base font-semibold",children:"Authorize on GitHub"}),o.jsxs("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:["A GitHub page just opened in a new tab. Enter the code below and click"," ",o.jsx("strong",{children:"Authorize"}),"."]})]})]}),o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx("div",{className:"flex cursor-pointer select-all items-center gap-3 rounded-xl border-2 border-border bg-muted px-6 py-4 font-mono text-2xl font-bold tracking-[0.3em] transition-colors hover:border-ring",onClick:w,title:"Click to copy",children:s?.user_code}),o.jsx("button",{className:"text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:w,type:"button",children:m?"Copied!":"Click code to copy"})]}),o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:[o.jsx(zy,{className:"size-3.5 animate-spin"}),"Waiting for authorization…"]}),o.jsx("a",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",href:s?.verification_uri_complete||s?.verification_uri,rel:"noopener noreferrer",target:"_blank",children:"Open GitHub again"}),o.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:t,type:"button",children:"Cancel"})]})]})}function iK({onSaved:e,onBack:t}){const[s,i]=y.useState(""),[a,l]=y.useState(!1),[u,h]=y.useState(null);async function m(d){d.preventDefault();const p=s.trim();if(p){l(!0),h(null);try{await Z6("github.com",p),e()}catch(g){h(g instanceof Error?g.message:String(g))}finally{l(!1)}}}return o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-muted",children:o.jsx(xC,{className:"size-6 text-muted-foreground"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-base font-semibold",children:"Personal Access Token"}),o.jsxs("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:["Create a token at"," ",o.jsx("a",{className:"underline underline-offset-2 hover:text-foreground",href:"https://github.com/settings/tokens/new?scopes=repo,workflow",rel:"noopener noreferrer",target:"_blank",children:"github.com/settings/tokens"})," ","with ",o.jsx("code",{className:"rounded bg-muted px-1 py-px text-[11px]",children:"repo"})," and"," ",o.jsx("code",{className:"rounded bg-muted px-1 py-px text-[11px]",children:"workflow"})," scopes."]})]})]}),o.jsxs("form",{className:"flex w-full max-w-sm flex-col gap-3",onSubmit:d=>{m(d)},children:[o.jsx("input",{autoComplete:"off",className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",onChange:d=>i(d.target.value),placeholder:"ghp_...",spellCheck:!1,type:"password",value:s}),u?o.jsx(Qe,{variant:"destructive",children:u}):null,o.jsx(se,{disabled:!s.trim()||a,type:"submit",children:a?"Saving…":"Save token"}),t?o.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:t,type:"button",children:"← Back"}):null]})]})}function qx({hasMore:e,loading:t,onLoadMore:s}){return e?o.jsx("div",{className:"p-2",children:o.jsxs("button",{className:"flex w-full items-center justify-center gap-1.5 rounded-md border border-border py-1.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground disabled:opacity-60",disabled:t,onClick:s,type:"button",children:[t?o.jsx(pt,{className:"size-3 animate-spin"}):null,t?"Loading…":"Load more"]})}):null}function rK({prs:e,loading:t,loadingMore:s,hasMore:i,error:a,selectedNumber:l,onSelect:u,onLoadMore:h}){return t&&e.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading pull requests…"}):a?o.jsx("div",{className:"p-4 text-[12px] text-red-500",children:a}):e.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No pull requests found."}):o.jsxs(o.Fragment,{children:[o.jsx("ul",{className:"divide-y divide-border",children:e.map(m=>o.jsx("li",{children:o.jsxs("button",{className:`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${l===m.number?"bg-muted":""}`,onClick:()=>u(m.number),type:"button",children:[o.jsx("span",{className:"mt-0.5 shrink-0",children:o.jsx(aK,{pr:m})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-[13px] font-medium",children:m.title}),o.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",m.number," · ",m.base.ref," ← ",m.head.ref," · ",m.user.login]})]}),m.draft?o.jsx("span",{className:"shrink-0 rounded border border-border px-1.5 py-px text-[10px] text-muted-foreground",children:"Draft"}):null]})},m.number))}),o.jsx(qx,{hasMore:i,loading:s,onLoadMore:h})]})}function aK({pr:e}){return e.state==="merged"?o.jsx(Db,{className:"size-4 text-purple-500"}):e.state==="closed"?o.jsx(P4,{className:"size-4 text-red-500"}):o.jsx(F4,{className:"size-4 text-emerald-500"})}function oK({pr:e,diff:t,diffLoading:s,diffError:i,onMerged:a}){const[l,u]=y.useState("overview"),[h,m]=y.useState(!1),[d,p]=y.useState(null);if(!e)return o.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select a pull request"});const g=e.state==="open"&&!e.draft;async function v(){if(!(!e||h)&&window.confirm(`Squash & merge PR #${e.number} "${e.title}" into ${e.base.ref}?`)){m(!0),p(null);try{await tR(e.number,{method:"squash"}),a?.()}catch(S){p(S instanceof Error?S.message:String(S))}finally{m(!1)}}}const _=S=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${S?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:e.title}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o.jsx("button",{className:_(l==="overview"),onClick:()=>u("overview"),type:"button",children:"Overview"}),o.jsx("button",{className:_(l==="diff"),onClick:()=>u("diff"),type:"button",children:"Diff"})]}),g?o.jsxs("button",{className:"flex shrink-0 items-center gap-1 rounded bg-emerald-600 px-2 py-0.5 text-[11px] font-medium text-white transition-colors hover:bg-emerald-700 disabled:opacity-60",disabled:h,onClick:()=>{v()},title:"Squash & merge this pull request",type:"button",children:[h?o.jsx(pt,{className:"size-3 animate-spin"}):o.jsx(Db,{className:"size-3"}),"Squash & merge"]}):null,o.jsx("a",{"aria-label":"Open on GitHub",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:e.html_url,rel:"noopener noreferrer",target:"_blank",title:"Open on GitHub",children:o.jsx(aa,{className:"size-3.5"})})]}),d?o.jsx("div",{className:"shrink-0 border-b border-border bg-red-500/10 px-3 py-1.5 text-[11px] text-red-500",children:d}):null,l==="overview"?o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:o.jsxs("div",{className:"space-y-4 p-4",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-[12px]",children:[o.jsx(lK,{pr:e}),o.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-border bg-muted/40 px-2 py-1 font-mono text-[11px]",children:[o.jsx(pn,{className:"size-3 shrink-0 text-muted-foreground"}),e.base.ref,o.jsx(au,{className:"size-3 shrink-0 text-muted-foreground"}),e.head.ref]}),o.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[o.jsx(f6,{className:"size-3 shrink-0"}),e.user.login]}),o.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[o.jsx(IA,{className:"size-3 shrink-0"}),new Date(e.created_at).toLocaleDateString()]})]}),e.body?o.jsx("div",{className:"whitespace-pre-wrap rounded-md border border-border bg-muted/30 p-3 font-mono text-[12px]",children:e.body}):o.jsx("p",{className:"text-[12px] text-muted-foreground italic",children:"No description provided."})]})}):o.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:s?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading diff…"}):i?o.jsx("div",{className:"p-4 text-[12px] text-red-500",children:i}):t?o.jsx(Bx,{diff:t}):o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No diff available."})})]})}function lK({pr:e}){const{label:t,cls:s}=e.state==="merged"?{label:"Merged",cls:"border-purple-300 bg-purple-100 text-purple-800 dark:border-purple-400/30 dark:bg-purple-500/15 dark:text-purple-300"}:e.state==="closed"?{label:"Closed",cls:"border-red-300 bg-red-100 text-red-800 dark:border-red-400/30 dark:bg-red-500/15 dark:text-red-300"}:e.draft?{label:"Draft",cls:"border-border bg-muted text-muted-foreground"}:{label:"Open",cls:"border-emerald-300 bg-emerald-100 text-emerald-800 dark:border-emerald-400/30 dark:bg-emerald-500/15 dark:text-emerald-300"};return o.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium ${s}`,children:[t==="Merged"?o.jsx(Db,{className:"size-3"}):null,t]})}function cK({issues:e,loading:t,loadingMore:s,hasMore:i,error:a,selectedNumber:l,onSelect:u,onLoadMore:h}){return t&&e.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading issues…"}):a?o.jsx("div",{className:"p-4 text-[12px] text-red-500",children:a}):e.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No issues found."}):o.jsxs(o.Fragment,{children:[o.jsx("ul",{className:"divide-y divide-border",children:e.map(m=>o.jsx("li",{children:o.jsxs("button",{className:`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${l===m.number?"bg-muted":""}`,onClick:()=>u(m.number),type:"button",children:[o.jsx(ZA,{className:`mt-0.5 size-4 shrink-0 ${m.state==="open"?"text-emerald-500":"text-red-500"}`}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-[13px] font-medium",children:m.title}),o.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",m.number," · ",m.user.login," · ",m.comments," comment",m.comments!==1?"s":""]})]}),m.labels.length>0?o.jsx("span",{className:"flex shrink-0 flex-wrap gap-1",children:m.labels.slice(0,3).map(d=>o.jsx("span",{className:"rounded-full px-1.5 py-px text-[10px] font-medium text-white",style:{backgroundColor:`#${d.color}`},children:d.name},d.name))}):null]})},m.number))}),o.jsx(qx,{hasMore:i,loading:s,onLoadMore:h})]})}function uK({issue:e,comments:t,commentsLoading:s,commentError:i,submitting:a,onAddComment:l}){const[u,h]=y.useState("");if(!e)return o.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select an issue"});async function m(d){d.preventDefault();const p=u.trim();p&&(await l(p),h(""))}return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:e.title}),o.jsx("a",{"aria-label":"Open on GitHub",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:e.html_url,rel:"noopener noreferrer",target:"_blank",children:o.jsx(aa,{className:"size-3.5"})})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:o.jsxs("div",{className:"space-y-3 p-4",children:[o.jsxs("div",{className:"flex flex-wrap gap-2 text-[12px]",children:[o.jsxs("span",{className:"rounded border border-border bg-muted/50 px-2 py-0.5 text-[11px]",children:[o.jsx("span",{className:"text-muted-foreground",children:"Author: "}),o.jsx("span",{className:"font-medium",children:e.user.login})]}),o.jsxs("span",{className:"rounded border border-border bg-muted/50 px-2 py-0.5 text-[11px]",children:[o.jsx("span",{className:"text-muted-foreground",children:"Opened: "}),o.jsx("span",{className:"font-medium",children:new Date(e.created_at).toLocaleDateString()})]}),e.labels.map(d=>o.jsx("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-medium text-white",style:{backgroundColor:`#${d.color}`},children:d.name},d.name))]}),e.body?o.jsx("div",{className:"whitespace-pre-wrap rounded-md border border-border bg-muted/30 p-3 font-mono text-[12px]",children:e.body}):o.jsx("p",{className:"text-[12px] text-muted-foreground italic",children:"No description provided."}),s?o.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Loading comments…"}):o.jsx("div",{className:"space-y-2",children:t.map(d=>o.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",children:[o.jsxs("div",{className:"mb-1 flex items-baseline gap-2",children:[o.jsx("span",{className:"text-[11px] font-semibold",children:d.user.login}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:new Date(d.created_at).toLocaleDateString()})]}),o.jsx("p",{className:"whitespace-pre-wrap font-mono text-[12px]",children:d.body})]},d.id))})]})}),o.jsx("div",{className:"shrink-0 border-t border-border p-3",children:o.jsxs("form",{className:"flex flex-col gap-2",onSubmit:d=>{m(d)},children:[o.jsx("textarea",{className:"w-full resize-none rounded-md border border-border bg-background px-3 py-2 font-mono text-[12px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",onChange:d=>h(d.target.value),placeholder:"Add a comment…",rows:3,value:u}),i?o.jsx(Qe,{variant:"destructive",children:i}):null,o.jsx(se,{className:"self-end",disabled:!u.trim()||a,size:"sm",type:"submit",children:a?"Posting…":"Comment"})]})})]})}const Xk=30;function dK(e){const[t,s]=y.useState([]),[i,a]=y.useState(null),[l,u]=y.useState([]),[h,m]=y.useState(!0),[d,p]=y.useState(!1),[g,v]=y.useState(!1),[_,S]=y.useState(1),[w,C]=y.useState(!1),[E,T]=y.useState(null),[N,j]=y.useState(null);function R(){let D=!0;return m(!0),T(null),S(1),i0(e,1).then(M=>{D&&(s(M),v(M.length===Xk))}).catch(M=>{D&&T(M instanceof Error?M.message:String(M))}).finally(()=>{D&&m(!1)}),()=>{D=!1}}function z(){if(d||!g)return;const D=_+1;p(!0),i0(e,D).then(M=>{s($=>{const L=new Set($.map(B=>B.id));return[...$,...M.filter(B=>!L.has(B.id))]}),v(M.length===Xk),S(D)}).catch(M=>T(M instanceof Error?M.message:String(M))).finally(()=>p(!1))}return y.useEffect(R,[e]),y.useEffect(()=>{a(D=>D&&t.some(M=>M.id===D)?D:t[0]?.id??null)},[t]),y.useEffect(()=>{if(!i){u([]);return}let D=!0;return C(!0),j(null),aR(i).then(M=>{D&&u(M)}).catch(M=>{D&&j(M instanceof Error?M.message:String(M))}).finally(()=>{D&&C(!1)}),()=>{D=!1}},[i]),{runs:t,selectedRunId:i,jobs:l,loading:h,loadingMore:d,hasMore:g,jobsLoading:w,error:E,jobsError:N,loadMore:z,refresh:R,setSelectedRunId:a}}function hK(){const{runs:e,selectedRunId:t,jobs:s,loading:i,loadingMore:a,hasMore:l,jobsLoading:u,error:h,jobsError:m,loadMore:d,refresh:p,setSelectedRunId:g}=dK(),v=e.find(_=>_.id===t)??null;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[o.jsx("h2",{className:"text-[13px] font-semibold",children:"Workflow Runs"}),o.jsxs(se,{disabled:i,onClick:()=>{p()},size:"sm",type:"button",variant:"outline",children:[o.jsx(ou,{className:`mr-1 size-3.5 ${i?"animate-spin":""}`}),"Refresh"]})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:h?o.jsx("div",{className:"p-4 text-[12px] text-red-500",children:h}):i&&e.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading workflow runs…"}):e.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No workflow runs found."}):o.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(280px,380px)_minmax(0,1fr)] divide-x divide-border",children:[o.jsxs("div",{className:"min-h-0 overflow-auto",children:[o.jsx("ul",{className:"divide-y divide-border",children:e.map(_=>o.jsx("li",{children:o.jsxs("button",{className:`flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${_.id===t?"bg-muted/70":""}`,onClick:()=>g(_.id),type:"button",children:[o.jsx(fK,{run:_}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-[13px] font-medium",children:_.name}),o.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",_.run_number," · ",_.head_branch," · ",_.event," ·"," ",new Date(_.created_at).toLocaleDateString()]})]}),o.jsx(mK,{run:_})]})},_.id))}),o.jsx(qx,{hasMore:l,loading:a,onLoadMore:d})]}),o.jsx(pK,{error:m,jobs:s,loading:u,run:v})]})})]})}function fK({run:e}){return e.status==="in_progress"||e.status==="queued"?o.jsx(wh,{className:"size-4 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"?o.jsx(Mb,{className:"size-4 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"?o.jsx(lC,{className:"size-4 shrink-0 text-red-500"}):o.jsx(wh,{className:"size-4 shrink-0 text-zinc-400"})}function mK({run:e}){const t=e.status==="completed"?e.conclusion??"completed":e.status,s=t==="success"?"border-emerald-200 bg-emerald-100 text-emerald-800 dark:border-emerald-400/30 dark:bg-emerald-500/15 dark:text-emerald-300":t==="failure"||t==="timed_out"?"border-red-200 bg-red-100 text-red-800 dark:border-red-400/30 dark:bg-red-500/15 dark:text-red-300":t==="in_progress"||t==="queued"?"border-amber-200 bg-amber-100 text-amber-800 dark:border-amber-400/30 dark:bg-amber-500/15 dark:text-amber-300":"border-border bg-muted/50 text-muted-foreground";return o.jsx("span",{className:`shrink-0 rounded border px-1.5 py-px text-[10px] font-medium ${s}`,children:t})}function pK({run:e,jobs:t,loading:s,error:i}){return e?o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-[13px] font-semibold",children:e.name}),o.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["Run #",e.run_number," · ",e.head_branch," · ",e.head_sha.slice(0,7)]})]}),o.jsx("a",{"aria-label":"Open run on GitHub",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:e.html_url,rel:"noopener noreferrer",target:"_blank",title:"Open run on GitHub",children:o.jsx(aa,{className:"size-3.5"})})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:i?o.jsx("div",{className:"p-4 text-[12px] text-red-500",children:i}):s?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading jobs…"}):t.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No jobs found for this run."}):o.jsx("ul",{className:"divide-y divide-border",children:t.map(a=>o.jsxs("li",{className:"px-3 py-3",children:[o.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[o.jsx(Zk,{item:a}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium",children:a.name}),o.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:Qk(a.started_at,a.completed_at)}),o.jsx("a",{"aria-label":`Open ${a.name} job on GitHub`,className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:a.html_url,rel:"noopener noreferrer",target:"_blank",title:"Open job on GitHub",children:o.jsx(aa,{className:"size-3.5"})})]}),a.steps.length?o.jsx("ol",{className:"space-y-1.5 pl-6",children:a.steps.map(l=>o.jsxs("li",{className:"flex items-center gap-2 text-[12px]",children:[o.jsx(Zk,{item:l}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:l.name}),o.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:Qk(l.started_at,l.completed_at)})]},`${a.id}:${l.number}`))}):o.jsx("p",{className:"pl-6 text-[12px] text-muted-foreground",children:"No step details available."})]},a.id))})})]}):o.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select a workflow run"})}function Zk({item:e}){return e.status==="in_progress"||e.status==="queued"?o.jsx(wh,{className:"size-3.5 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"||e.conclusion==="skipped"?o.jsx(Mb,{className:"size-3.5 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"||e.conclusion==="cancelled"?o.jsx(lC,{className:"size-3.5 shrink-0 text-red-500"}):o.jsx(wh,{className:"size-3.5 shrink-0 text-zinc-400"})}function Qk(e,t){if(!e)return"-";const s=Date.parse(e),i=t?Date.parse(t):Date.now();if(!Number.isFinite(s)||!Number.isFinite(i)||i<s)return"-";const a=Math.max(0,Math.round((i-s)/1e3));if(a<60)return`${a}s`;const l=Math.floor(a/60),u=a%60;return u?`${l}m ${u}s`:`${l}m`}function gK(){const{configured:e,deviceFlowAvailable:t,loading:s,refresh:i}=JW();return s?o.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Loading…"}):e?o.jsx(bK,{}):o.jsx(sK,{deviceFlowAvailable:t,onSaved:i})}function bK(){const[e,t]=y.useState("prs"),[s,i]=y.useState("open"),[a,l]=y.useState("open"),[u,h]=y.useState(!1),m=eK(s),d=tK(a),p=v=>`rounded px-2.5 py-1 text-[11px] font-medium transition-colors ${v?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,g=v=>`rounded px-2 py-0.5 text-[10px] font-medium transition-colors ${v?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-foreground",children:[o.jsx(tT,{className:"size-4"}),o.jsx("span",{className:"text-[12px] font-semibold tracking-tight",children:"GitHub"})]}),o.jsx("div",{className:"h-4 w-px bg-border"}),o.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[o.jsx("button",{className:p(e==="prs"),onClick:()=>t("prs"),type:"button",children:"Pull Requests"}),o.jsx("button",{className:p(e==="issues"),onClick:()=>t("issues"),type:"button",children:"Issues"}),o.jsx("button",{className:p(e==="actions"),onClick:()=>t("actions"),type:"button",children:"Actions"})]}),e==="prs"?o.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[o.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[o.jsx("button",{className:g(s==="open"),onClick:()=>i("open"),type:"button",children:"Open"}),o.jsx("button",{className:g(s==="closed"),onClick:()=>i("closed"),type:"button",children:"Closed"})]}),o.jsx(se,{onClick:()=>h(!0),size:"sm",type:"button",variant:"outline",children:"New PR"})]}):e==="issues"?o.jsxs("div",{className:"ml-auto flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[o.jsx("button",{className:g(a==="open"),onClick:()=>l("open"),type:"button",children:"Open"}),o.jsx("button",{className:g(a==="closed"),onClick:()=>l("closed"),type:"button",children:"Closed"})]}):null]}),u?o.jsx(xK,{onCreated:()=>{h(!1),m.refresh()},onCancel:()=>h(!1)}):o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e==="prs"?o.jsxs("div",{className:"grid h-full min-h-0 grid-cols-2 divide-x divide-border",children:[o.jsx("div",{className:"min-h-0 overflow-auto",children:o.jsx(rK,{error:m.error,hasMore:m.hasMore,loading:m.loading,loadingMore:m.loadingMore,onLoadMore:m.loadMore,onSelect:m.setSelectedNumber,prs:m.prs,selectedNumber:m.selectedNumber})}),o.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:o.jsx(oK,{diff:m.diff,diffError:m.diffError,diffLoading:m.diffLoading,onMerged:()=>m.refresh(),pr:m.selectedPR})})]}):e==="issues"?o.jsxs("div",{className:"grid h-full min-h-0 grid-cols-2 divide-x divide-border",children:[o.jsx("div",{className:"min-h-0 overflow-auto",children:o.jsx(cK,{error:d.error,hasMore:d.hasMore,issues:d.issues,loading:d.loading,loadingMore:d.loadingMore,onLoadMore:d.loadMore,onSelect:d.setSelectedNumber,selectedNumber:d.selectedNumber})}),o.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:o.jsx(uK,{commentError:d.commentError,comments:d.comments,commentsLoading:d.commentsLoading,issue:d.selectedIssue,onAddComment:d.addComment,submitting:d.submitting})})]}):o.jsx(hK,{})})]})}function xK({onCreated:e,onCancel:t}){const[s,i]=y.useState(""),[a,l]=y.useState(""),[u,h]=y.useState(""),[m,d]=y.useState("main"),[p,g]=y.useState(!1),[v,_]=y.useState(!1),[S,w]=y.useState(null);async function C(T){if(T.preventDefault(),!(!s.trim()||!u.trim()||!m.trim())){_(!0),w(null);try{await eR({title:s.trim(),body:a.trim()||void 0,head:u.trim(),base:m.trim(),draft:p}),e()}catch(N){w(N instanceof Error?N.message:String(N))}finally{_(!1)}}}const E="w-full rounded-md border border-border bg-background px-3 py-2 text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring";return o.jsxs("form",{className:"flex flex-col gap-3 overflow-auto p-4",onSubmit:T=>{C(T)},children:[o.jsx("h3",{className:"text-[13px] font-semibold",children:"New Pull Request"}),o.jsx("input",{className:E,onChange:T=>i(T.target.value),placeholder:"Title",required:!0,value:s}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsx("input",{className:E,onChange:T=>h(T.target.value),placeholder:"Head branch",required:!0,value:u}),o.jsx("input",{className:E,onChange:T=>d(T.target.value),placeholder:"Base branch (e.g. main)",required:!0,value:m})]}),o.jsx("textarea",{className:`${E} resize-none`,onChange:T=>l(T.target.value),placeholder:"Description (optional)",rows:5,value:a}),o.jsxs("label",{className:"flex items-center gap-2 text-[12px]",children:[o.jsx("input",{checked:p,className:"size-3.5",onChange:T=>g(T.target.checked),type:"checkbox"}),"Create as draft"]}),S?o.jsx(Qe,{variant:"destructive",children:S}):null,o.jsxs("div",{className:"flex gap-2",children:[o.jsx(se,{disabled:v,type:"submit",children:v?"Creating…":"Create PR"}),o.jsx(se,{onClick:t,type:"button",variant:"outline",children:"Cancel"})]})]})}function Jk(e,t,s){const i=e.trim(),a=i.toLowerCase(),l=[],u=/\breview|check|inspect|audit\b/.test(a),h=/\btest|verify|ci\b/.test(a),m=/\bcommit\b/.test(a)||/\bship|push|pr|pull request\b/.test(a),d=/\bpush|ship|pr|pull request\b/.test(a),p=/\bpr\b|pull request/.test(a),g=_K(a,s);return u&&(l.push(ah("gate-review","Approve review","Review the current changes?")),l.push(Nc("review","Review changes","Review the current git changes. Summarize risks, likely bugs, and anything that should change before committing.",oh(g,["skills","mcpServers"])))),h&&l.push(Nc("verify","Run verification","Run the relevant tests or checks for this repository. If something fails, stop and explain the failure.",oh(g,["skills","mcpServers","plugins"]))),m&&(l.push(ah("gate-commit","Approve commit","Create one commit from the current changes?")),l.push(Nc("commit","Commit changes","Stage the appropriate changed files, inspect the staged diff briefly, and create one conventional commit.",oh(g,["skills"]),"committed"))),d&&(l.push(ah("gate-push","Approve push",p?"Push and continue toward a PR?":"Push this branch?")),l.push({kind:"action",id:"push",title:"Push branch",op:"push"})),p&&l.push(Nc("open-pr","Open PR","Open a pull request for the current branch. Use the latest commit subject as the title and summarize the commit list in the body.",oh(g,["mcpServers","plugins"]))),l.length||(l.push(ah("gate-start","Approve start","Run this workflow?")),l.push(Nc("ai-step","AI step",i||"Complete this workflow step.",g))),{id:SK(sT(eC(a))||"custom-workflow",t),name:eC(a),description:i||"Custom AI-authored workflow.",builtin:!1,steps:yK(l)}}function vK(e){return["Create a NoMoreIDE workflow from this user intent:","",e.trim()||"(no intent provided)","","Return a workflow JSON object only. Use this shape:","{",' "id": "short-kebab-id",',' "name": "Human name",',' "description": "One sentence",',' "steps": [',' { kind: "gate", id: "gate-id", title: "Approve thing", message: "Question for the user?" },',' { kind: "agent", id: "ai-id", title: "AI task", prompt: "Clear instruction", capabilities: { skills: [], mcpServers: [], plugins: [], hooks: [] }, verify: "committed" },',' { kind: "action", id: "push", title: "Push", op: "push" }'," ]","}","","Use gates before mutating git or GitHub state. Prefer intent-level AI steps over direct MCP tool calls."].join(`
|
|
211
|
-
`)}function eC(e){const t=/\breview|check|inspect|audit\b/.test(e),s=/\bcommit\b|\bship|push|pr|pull request\b/.test(e),i=/\bpr\b|pull request/.test(e),a=/\btest|verify|ci\b/.test(e);return t&&s&&i?"Review, Commit & PR":a&&s&&i?"Verify, Commit & PR":t&&s?"Review & Commit":s&&i?"Commit & PR":s?"Commit workflow":t?"Review workflow":"Custom workflow"}function ah(e,t,s){return{kind:"gate",id:e,title:t,message:s}}function Nc(e,t,s,i,a){return{kind:"agent",id:e,title:t,prompt:s,capabilities:Vx(i),verify:a}}function _K(e,t){return Vx({skills:t.skills.filter(s=>e.includes(s.toLowerCase())),mcpServers:t.mcpServers.filter(s=>e.includes(s.toLowerCase())),plugins:t.plugins.filter(s=>e.includes(s.toLowerCase())),hooks:t.hooks.filter(s=>e.includes(s.toLowerCase()))})??{}}function oh(e,t){const s={};for(const i of t){const a=e[i];a?.length&&(s[i]=a)}return Vx(s)}function Vx(e){if(!e)return;const t={};for(const s of["skills","mcpServers","plugins","hooks"]){const i=Array.from(new Set((e[s]??[]).filter(Boolean)));i.length&&(t[s]=i)}return Object.keys(t).length?t:void 0}function yK(e){const t=new Map;return e.map(s=>{const i=sT(s.id)||s.kind,a=t.get(i)??0;return t.set(i,a+1),a===0?{...s,id:i}:{...s,id:`${i}-${a+1}`}})}function SK(e,t){const s=new Set(t.map(l=>l.id));let i=e||"workflow",a=2;for(;s.has(i);)i=`${e}-${a}`,a++;return i}function sT(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function wK(){const{run:e,start:t,approve:s,skip:i,stop:a,dismiss:l}=yB(),[u,h]=y.useState([]),[m,d]=y.useState(null),[p,g]=y.useState(null),[v,_]=y.useState(null),[S,w]=y.useState(!0),[C,E]=y.useState(!0);y.useEffect(()=>{let z=!0;return w(!0),Promise.all([NR(),MC().catch(()=>null)]).then(([D,M])=>{z&&(h(D),d(M))}).catch(D=>{z&&_(D instanceof Error?D.message:String(D))}).finally(()=>{z&&w(!1)}),()=>{z=!1}},[]);function T(z){t(z,C)}async function N(z){_(null);try{const D=await ER(z);h(D),g(null)}catch(D){_(D instanceof Error?D.message:String(D))}}async function j(z){if(!z.builtin&&window.confirm(`Delete workflow "${z.name}"?`)){_(null);try{h(await TR(z.id))}catch(D){_(D instanceof Error?D.message:String(D))}}}function R(z){g({...z,id:Gx(`${z.id}-copy`,u),name:`${z.name} copy`,builtin:!1,steps:z.steps.map((D,M)=>({...D,id:`${D.id}-${M+1}`}))})}return e?o.jsx(RK,{run:e,onApprove:s,onSkip:i,onStop:a,onBack:l}):p?o.jsx(CK,{agent:m?LK(m):null,existing:u,initial:p,onCancel:()=>g(null),onSave:z=>{N(z)}}):o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-card/85",children:[o.jsxs("div",{className:"border-b border-border px-4 py-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[o.jsx(Gt,{className:"size-4"})," AI Workflows"]}),o.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"One-click rituals that exceed the IDE — the agent does the work in the dock, pausing at each gate for your OK."})]}),o.jsxs(se,{onClick:()=>g(BK(u)),size:"sm",type:"button",variant:"outline",children:[o.jsx(Cs,{className:"size-3.5"})," New"]})]}),o.jsxs("label",{className:"mt-2 flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground",children:[o.jsx("input",{checked:C,className:"size-3.5 accent-primary",onChange:z=>E(z.target.checked),type:"checkbox"}),"Run without step-by-step prompts",o.jsx("span",{className:"text-muted-foreground/60",children:"— gates still pause; risky shell still asks."})]})]}),v?o.jsx(Qe,{variant:"destructive",className:"m-4",children:v}):S?o.jsxs("div",{className:"flex flex-1 items-center justify-center text-[12px] text-muted-foreground",children:[o.jsx(pt,{className:"mr-2 size-4 animate-spin"})," Loading workflows…"]}):o.jsx("div",{className:"grid gap-3 p-4 sm:grid-cols-2 xl:grid-cols-3",children:u.map(z=>o.jsx(kK,{workflow:z,onDelete:()=>{j(z)},onDuplicate:()=>R(z),onEdit:()=>g(z),onRun:()=>T(z)},z.id))})]})}function kK({workflow:e,onDelete:t,onDuplicate:s,onEdit:i,onRun:a}){return o.jsxs("div",{className:"flex flex-col rounded-lg border border-border bg-background p-3.5 shadow-sm",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx("h3",{className:"text-[13px] font-semibold",children:e.name}),e.builtin?o.jsx("span",{className:"rounded-full border border-border px-1.5 py-px text-[9px] uppercase tracking-wide text-muted-foreground",children:"Template"}):null]}),e.description?o.jsx("p",{className:"mt-1 text-[11px] leading-snug text-muted-foreground",children:e.description}):null,o.jsx("ol",{className:"mt-2.5 space-y-1",children:e.steps.map(l=>o.jsxs("li",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[o.jsx(VK,{kind:l.kind}),o.jsx("span",{className:"truncate",children:Wx(l)})]},l.id))}),o.jsxs(se,{className:"mt-3 w-full",onClick:a,size:"sm",type:"button",children:[o.jsx(eo,{className:"size-3.5"})," Run"]}),o.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:[o.jsxs(se,{onClick:i,size:"sm",type:"button",variant:"outline",children:[o.jsx(OM,{className:"size-3.5"})," Edit"]}),o.jsxs(se,{onClick:s,size:"sm",type:"button",variant:"outline",children:[o.jsx(kh,{className:"size-3.5"})," Copy"]}),o.jsxs(se,{disabled:e.builtin,onClick:t,size:"sm",title:e.builtin?"Duplicate or edit to create your own version first":"Delete workflow",type:"button",variant:"outline",children:[o.jsx(ua,{className:"size-3.5"})," Delete"]})]})]})}function CK({agent:e,existing:t,initial:s,onCancel:i,onSave:a}){const[l,u]=y.useState(()=>structuredClone(s)),[h,m]=y.useState(s.description??""),d=zK(e),{sendToAgent:p}=Bt(),g=!l.id.trim()||!l.name.trim()||l.steps.length===0;function v(N,j){u(R=>({...R,steps:R.steps.map((z,D)=>D===N?j(z):z)}))}function _(N,j){u(R=>{const z=N+j;if(z<0||z>=R.steps.length)return R;const D=[...R.steps],[M]=D.splice(N,1);return D.splice(z,0,M),{...R,steps:D}})}function S(N){u(j=>({...j,steps:j.steps.filter((R,z)=>z!==N)}))}function w(N=h){const j=Jk(N,t,d);u(j)}function C(N){const j=Jk(N,[],d);u(R=>({...R,steps:[...R.steps,...j.steps]}))}function E(){p({prompt:vK(h||l.description||l.name),source:{type:"workflow",label:"Workflow composer"},mode:"draft"})}function T(){const N=rl(l.id)||Gx(rl(l.name)||"workflow",t);a({...l,id:N,name:l.name.trim(),description:(h||l.description)?.trim()||void 0,builtin:!1,steps:l.steps.map(IK)})}return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-card/85",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-4 py-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[o.jsx(Gt,{className:"size-4"})," Workflow Composer"]}),o.jsx("p",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:"Describe the ritual. NoMoreIDE turns it into a gated timeline you can tune."})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs(se,{onClick:i,size:"sm",type:"button",variant:"outline",children:[o.jsx(au,{className:"size-3.5"})," Back"]}),o.jsxs(se,{disabled:g,onClick:T,size:"sm",type:"button",children:[o.jsx(hi,{className:"size-3.5"})," Save"]})]})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsxs("section",{className:"shrink-0 border-b border-border p-4",children:[o.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(280px,0.9fr)_minmax(0,1.1fr)]",children:[o.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 shadow-sm",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(Qa,{children:"Workflow identity"}),o.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:l.id})]}),o.jsx("input",{className:"w-full bg-transparent text-lg font-semibold outline-none",onChange:N=>u(j=>({...j,name:N.target.value,id:rl(N.target.value)||j.id})),value:l.name})]}),o.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 shadow-sm",children:[o.jsx(Qa,{children:"Describe workflow"}),o.jsx("textarea",{className:"min-h-16 w-full resize-none bg-transparent text-[13px] leading-relaxed outline-none placeholder:text-muted-foreground",onChange:N=>m(N.target.value),placeholder:"Review my changes with code-review, ask before commit, push, then open a PR with GitHub...",value:h}),o.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[o.jsxs(se,{onClick:()=>w(),size:"sm",type:"button",children:[o.jsx(zi,{className:"size-3.5"})," Draft timeline"]}),o.jsxs(se,{onClick:E,size:"sm",type:"button",variant:"outline",children:[o.jsx(fM,{className:"size-3.5"})," Ask AI"]}),["Commit safely","Review then push","Fix CI then PR","File issue from changes"].map(N=>o.jsx("button",{className:"rounded-md border border-border bg-muted/30 px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>{m(N),w(N)},type:"button",children:N},N))]})]})]}),o.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-[minmax(0,1fr)_minmax(280px,0.45fr)]",children:[o.jsx(EK,{capabilities:d}),o.jsx(NK,{onAdd:C})]})]}),o.jsx("main",{className:"min-h-0 flex-1 overflow-auto p-4",children:l.steps.length?o.jsx("ol",{className:"mx-auto max-w-6xl space-y-0",children:l.steps.map((N,j)=>o.jsxs("li",{className:"relative pb-5 pl-14 last:pb-0",children:[o.jsx(jK,{index:j,kind:N.kind}),j===l.steps.length-1?null:o.jsx(AK,{}),o.jsx(TK,{capabilities:d,index:j,isFirst:j===0,isLast:j===l.steps.length-1,onMove:_,onRemove:S,onUpdate:v,step:N})]},`${N.kind}:${N.id}`))}):o.jsx("div",{className:"flex h-52 items-center justify-center rounded-lg border border-dashed border-border text-[12px] text-muted-foreground",children:"Add a step to start."})})]})]})}function NK({onAdd:e}){const[t,s]=y.useState("");return o.jsxs("form",{className:"rounded-lg border border-dashed border-border bg-background/70 p-3",onSubmit:i=>{i.preventDefault();const a=t.trim();a&&(e(a),s(""))},children:[o.jsx(Qa,{children:"Add a step"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[12px] outline-none placeholder:text-muted-foreground",onChange:i=>s(i.target.value),placeholder:"ask before merge, run tests, open an issue...",value:t}),o.jsxs(se,{size:"sm",type:"submit",variant:"outline",children:[o.jsx(Cs,{className:"size-3.5"})," Add"]})]})]})}function EK({capabilities:e}){const t=[...e.skills.map(s=>`@skill:${s}`),...e.mcpServers.map(s=>`@mcp:${s}`),...e.plugins.map(s=>`@plugin:${s}`)].slice(0,18);return t.length?o.jsxs("div",{className:"rounded-lg border border-border bg-background p-3",children:[o.jsx(Qa,{children:"Detected capabilities"}),o.jsx("div",{className:"flex max-h-20 flex-wrap gap-1.5 overflow-hidden",children:t.map(s=>o.jsx("span",{className:"rounded-md border border-border bg-muted/30 px-2 py-1 font-mono text-[11px] text-muted-foreground",children:s},s))})]}):null}function TK({capabilities:e,index:t,isFirst:s,isLast:i,onMove:a,onRemove:l,onUpdate:u,step:h}){const m=PK(h);return o.jsx("section",{className:"group rounded-lg border border-border bg-background p-3 shadow-sm",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(iT,{kind:h.kind}),o.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[13px] font-semibold outline-none",onChange:d=>u(t,p=>({...p,title:d.target.value})),value:h.title})]}),o.jsx("textarea",{className:"mt-2 min-h-16 w-full resize-none bg-transparent text-[12px] leading-relaxed text-muted-foreground outline-none focus:text-foreground",onChange:d=>{const p=d.target.value;u(t,g=>$K(g,p))},value:m}),h.kind==="agent"?o.jsx(MK,{capabilities:e,selected:h.capabilities,onToggle:(d,p)=>u(t,g=>g.kind==="agent"?{...g,capabilities:HK(g.capabilities,d,p)}:g)}):null]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-70 transition-opacity group-hover:opacity-100",children:[o.jsx(se,{disabled:s,onClick:()=>a(t,-1),size:"sm",type:"button",variant:"ghost",children:"↑"}),o.jsx(se,{disabled:i,onClick:()=>a(t,1),size:"sm",type:"button",variant:"ghost",children:"↓"}),o.jsx(se,{onClick:()=>l(t),size:"sm",type:"button",variant:"ghost",children:o.jsx(ua,{className:"size-3.5"})})]})]})})}function jK({index:e,kind:t}){return o.jsxs("div",{className:"absolute left-0 top-2 z-10 flex size-9 items-center justify-center rounded-full border border-border bg-card shadow-sm",children:[o.jsx("span",{className:"absolute -right-1 -top-1 flex size-4 items-center justify-center rounded-full border border-border bg-background font-mono text-[9px] text-muted-foreground",children:e+1}),o.jsx(FK,{kind:t})]})}function AK(){return o.jsxs("svg",{"aria-hidden":!0,className:"absolute bottom-1 left-[18px] top-12 w-6 overflow-visible text-border",preserveAspectRatio:"none",viewBox:"0 0 24 100",children:[o.jsx("title",{children:"Next step connector"}),o.jsx("line",{stroke:"currentColor",strokeDasharray:"4 5",strokeLinecap:"round",strokeWidth:"2",x1:"12",x2:"12",y1:"0",y2:"82"}),o.jsx("path",{d:"M6 78 L12 88 L18 78",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function MK({capabilities:e,onToggle:t,selected:s}){const i=[{key:"skills",label:"Skills",values:e.skills},{key:"mcpServers",label:"MCP",values:e.mcpServers},{key:"plugins",label:"Plugins",values:e.plugins},{key:"hooks",label:"Hooks",values:e.hooks}];return o.jsxs("div",{className:"space-y-2",children:[o.jsx(Qa,{children:"Capabilities"}),i.map(a=>o.jsxs("div",{children:[o.jsx("div",{className:"mb-1 text-[10px] text-muted-foreground",children:a.label}),a.values.length?o.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.values.map(l=>{const u=s?.[a.key]?.includes(l)??!1;return o.jsx("button",{className:le("rounded-md border px-2 py-1 text-[11px] transition-colors",u?"border-primary/50 bg-primary/10 text-primary":"border-border bg-muted/30 text-muted-foreground hover:bg-muted"),onClick:()=>t(a.key,l),type:"button",children:l},l)})}):o.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"None detected."})]},a.key))]})}function RK({run:e,onApprove:t,onSkip:s,onStop:i,onBack:a}){const l=e.outcome!=="running",[u,h]=y.useState(()=>new Set);y.useEffect(()=>{const d=e.workflow.steps[e.index],p=e.statuses[e.index];d&&(p==="running"||p==="waiting")&&h(g=>g.has(d.id)?g:new Set(g).add(d.id))},[e.index,e.statuses,e.workflow.steps]);const m=d=>h(p=>{const g=new Set(p);return g.has(d)?g.delete(d):g.add(d),g});return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-card/85",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[o.jsx(Gt,{className:"size-4"})," ",e.workflow.name]}),o.jsxs("p",{className:"mt-0.5 flex items-center gap-1 text-[11px] text-muted-foreground",children:[o.jsx(af,{className:"size-3"})," Watch the agent work in the dock below."]})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(UK,{outcome:e.outcome}),l?o.jsxs(se,{onClick:a,size:"sm",type:"button",variant:"outline",children:[o.jsx(au,{className:"size-3.5"})," Workflows"]}):o.jsxs(se,{onClick:i,size:"sm",type:"button",variant:"outline",children:[o.jsx(lu,{className:"size-3.5"})," Stop"]})]})]}),o.jsx("ol",{className:"px-4 py-4",children:e.workflow.steps.map((d,p)=>{const g=e.statuses[p],v=p===e.workflow.steps.length-1,_=d.kind==="gate"&&g==="waiting",S=u.has(d.id)||g==="waiting"||g==="failed"||g==="blocked",w=g==="running"||g==="waiting";return o.jsxs("li",{className:"relative pb-3 pl-10 last:pb-0",children:[v?null:o.jsx("span",{"aria-hidden":!0,className:"absolute bottom-0 left-[19px] top-9 w-px bg-border"}),o.jsx("span",{className:le("absolute left-1 top-1 flex size-8 items-center justify-center rounded-full border bg-card",g==="failed"?"border-destructive/50":g==="blocked"?"border-amber-500/50":w?"border-primary/50":g==="done"?"border-emerald-500/50":"border-border"),children:o.jsx(qK,{status:g,kind:d.kind})}),o.jsxs("section",{className:le("overflow-hidden rounded-lg border transition-colors",g==="failed"?"border-destructive/40 bg-destructive/[0.03]":g==="blocked"?"border-amber-500/40 bg-amber-500/[0.04]":w?"border-primary/40 bg-primary/[0.03]":"border-border bg-background"),children:[o.jsxs("button",{className:"flex w-full items-center gap-2 px-3 py-2.5 text-left transition-colors hover:bg-muted/40",onClick:()=>m(d.id),type:"button",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium",children:Wx(d)}),o.jsx(iT,{kind:d.kind}),o.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:DK(g)}),S?o.jsx(Mn,{className:"size-3.5 shrink-0 text-muted-foreground/60"}):o.jsx(Li,{className:"size-3.5 shrink-0 text-muted-foreground/60"})]}),S?o.jsxs("div",{className:"border-t border-border px-3 py-2.5 text-[11px] leading-relaxed",children:[o.jsx(OK,{step:d,status:g,output:e.outputs[p]}),_?o.jsxs("div",{className:"mt-2.5 flex items-center gap-1.5",children:[o.jsxs(se,{onClick:t,size:"sm",type:"button",children:[o.jsx(hi,{className:"size-3.5"})," Approve"]}),o.jsxs(se,{onClick:s,size:"sm",type:"button",variant:"outline",children:[o.jsx(TC,{className:"size-3.5"})," Skip"]}),o.jsxs(se,{onClick:i,size:"sm",type:"button",variant:"outline",children:[o.jsx(Gs,{className:"size-3.5"})," Stop"]})]}):null,g==="failed"&&e.error?o.jsx("p",{className:"mt-2 text-destructive",children:e.error}):null,g==="blocked"&&e.error?o.jsx("p",{className:"mt-2 text-amber-700 dark:text-amber-400",children:e.error}):null]}):null]})]},d.id)})})]})}function DK(e){return e==="running"?"Running":e==="waiting"?"Waiting":e==="done"?"Done":e==="blocked"?"Needs you":e==="failed"?"Failed":e==="skipped"?"Skipped":"Queued"}function OK({step:e,status:t,output:s}){if(e.kind==="gate")return o.jsx("p",{className:"text-muted-foreground",children:e.message});if(e.kind==="action")return o.jsx("p",{className:"text-muted-foreground",children:e.op==="push"?"Pushes the current branch to its remote.":"Stages and commits all changes."});const i=t==="done"||t==="failed"||t==="skipped";return s?o.jsxs("div",{children:[o.jsx(Qa,{children:"Result"}),o.jsx("div",{className:"whitespace-pre-wrap break-words rounded-md bg-muted/50 px-2.5 py-2 font-mono text-[11px] text-foreground",children:s})]}):o.jsxs("div",{children:[o.jsx(Qa,{children:i?"Result":"Task"}),i?o.jsx("p",{className:"italic text-muted-foreground",children:"No text reply — see the dock for what the agent did."}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-muted-foreground",children:e.prompt}),t==="running"?o.jsxs("p",{className:"mt-1.5 flex items-center gap-1 text-muted-foreground/80",children:[o.jsx(pt,{className:"size-3 animate-spin"})," Working in the dock…"]}):null]})]})}function LK(e){return e.detected.name==="codex"?e.agents.codex:e.agents["claude-code"]??e}function zK(e){return e?{skills:Bc(e.skills.map(t=>t.name)),mcpServers:Bc(e.mcpServers.map(t=>t.name)),plugins:Bc(e.plugins.map(t=>t.name)),hooks:Bc(e.hooks.map(t=>t.matcher?`${t.event}: ${t.matcher}`:t.event))}:{skills:[],mcpServers:[],plugins:[],hooks:[]}}function BK(e){return{id:Gx("custom-workflow",e),name:"Custom workflow",description:"A user-built workflow.",builtin:!1,steps:[{kind:"gate",id:"gate-start",title:"Approve start",message:"Run this workflow?"}]}}function IK(e){const t=rl(e.id)||e.kind,s=e.title.trim()||Wx(e);if(e.kind==="gate")return{...e,id:t,title:s,message:e.message.trim()||"Continue?"};if(e.kind==="action")return{...e,id:t,title:s};const i=nT(e.capabilities);return{...e,id:t,title:s,prompt:e.prompt.trim()||"Complete this workflow step.",capabilities:i}}function PK(e){return e.kind==="gate"?e.message:e.kind==="agent"?e.prompt:e.op==="push"?"Push the current branch to its remote.":"Stage and commit changed files."}function $K(e,t){return e.kind==="gate"?{...e,message:t}:e.kind==="agent"?{...e,prompt:t}:{...e,op:/\bpush\b/i.test(t)?"push":/\bcommit\b/i.test(t)?"commit":e.op,title:t.trim()||e.title}}function nT(e){if(!e)return;const t={};for(const s of["skills","mcpServers","plugins","hooks"]){const i=Bc((e[s]??[]).map(a=>a.trim()).filter(Boolean));i.length&&(t[s]=i)}return Object.keys(t).length?t:void 0}function HK(e,t,s){const i=e?.[t]??[],a=i.includes(s)?i.filter(l=>l!==s):[...i,s];return nT({...e??{},[t]:a})}function Gx(e,t){const s=new Set(t.map(l=>l.id));let i=rl(e)||"workflow",a=2;for(;s.has(i);)i=`${rl(e)||"workflow"}-${a}`,a++;return i}function rl(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Bc(e){return Array.from(new Set(e.filter(Boolean)))}function Qa({children:e}){return o.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:e})}function UK({outcome:e}){const t={running:{label:"Running",className:"border-primary/40 text-primary"},done:{label:"Done",className:"border-emerald-500/40 text-emerald-600 dark:text-emerald-400"},stopped:{label:"Stopped",className:"border-border text-muted-foreground"},failed:{label:"Failed",className:"border-destructive/40 text-destructive"},blocked:{label:"Needs you",className:"border-amber-500/40 text-amber-700 dark:text-amber-400"}},{label:s,className:i}=t[e];return o.jsx("span",{className:le("rounded-full border px-2 py-0.5 text-[10px] font-medium",i),children:s})}function FK({kind:e}){return e==="gate"?o.jsx(EC,{className:"size-4 text-amber-600 dark:text-amber-400"}):e==="agent"?o.jsx(zi,{className:"size-4 text-primary"}):o.jsx(eo,{className:"size-4 text-muted-foreground"})}function qK({status:e,kind:t}){return e==="running"?o.jsx(pt,{className:"size-4 shrink-0 animate-spin text-primary"}):e==="waiting"?o.jsx(EC,{className:"size-4 shrink-0 text-primary"}):e==="done"?o.jsx(hi,{className:"size-4 shrink-0 text-emerald-600 dark:text-emerald-400"}):e==="blocked"?o.jsx(GA,{className:"size-4 shrink-0 text-amber-600 dark:text-amber-400"}):e==="failed"?o.jsx(cu,{className:"size-4 shrink-0 text-destructive"}):e==="skipped"?o.jsx(TC,{className:"size-4 shrink-0 text-muted-foreground/60"}):t==="agent"?o.jsx(zi,{className:"size-4 shrink-0 text-muted-foreground/50"}):o.jsx(YA,{className:"size-4 shrink-0 text-muted-foreground/50"})}function VK(e){return o.jsx(Li,{className:"size-3 shrink-0 text-muted-foreground/40","aria-hidden":!0})}function iT({kind:e}){const t=e==="agent"?"AI":e==="gate"?"Gate":"Auto",s=e==="agent"?"border-primary/30 text-primary":e==="gate"?"border-amber-500/40 text-amber-600 dark:text-amber-400":"border-border text-muted-foreground";return o.jsx("span",{className:le("shrink-0 rounded-full border px-1.5 py-px text-[9px] uppercase tracking-wide",s),children:t})}function Wx(e){return e.title}function GK({data:e,onRefresh:t}){const{insertPath:s}=Bt(),[i,a]=y.useState(!1),[l,u]=y.useState("changes"),[h,m]=y.useState("changes"),[d,p]=y.useState(e.git.status?.files[0]?.path??""),[g,v]=y.useState(""),[_,S]=y.useState([]),[w,C]=y.useState(null),[E,T]=y.useState(""),[N,j]=y.useState(null),[R,z]=y.useState(0),[D,M]=y.useState(null),[$,L]=y.useState(()=>new Set),B=e.git.status?.files??[],P=y.useMemo(()=>{const ge=new Set(B.map(Ae=>Ae.path)),Te=[...$].filter(Ae=>!ge.has(Ae)).sort().map(Ae=>({path:Ae,index:" ",workingTree:"M"}));return[...B,...Te]},[B,$]),F=y.useMemo(()=>P.map(ge=>ge.path),[P]),V=y.useMemo(()=>eq(E),[E]),G=y.useCallback(async(ge,Te)=>{if(Te.length){a(!0);try{await ge(Te),t?.()}finally{a(!1)}}},[t]),I=t?{busy:i,onStage:ge=>{G(LC,ge)},onUnstage:ge=>{G(G6,ge)}}:void 0;y.useEffect(()=>{const ge=P[0]?.path??"";p(Te=>Te&&P.some(Ae=>Ae.path===Te)?Te:ge)},[P]),y.useEffect(()=>{if(l!=="all"||_.length>0)return;let ge=!0;return C(null),H6().then(Te=>{ge&&S(Te)}).catch(Te=>{ge&&C(Te instanceof Error?Te.message:String(Te))}),()=>{ge=!1}},[l,_.length]),y.useEffect(()=>{if(!d){T("");return}let ge=!0;return j(null),V6(d).then(Te=>{ge&&(T(Te),z(0),M(null))}).catch(Te=>{ge&&j(Te instanceof Error?Te.message:String(Te))}),()=>{ge=!1}},[d]);function Y(ge){z(0),M(null),p(ge)}function X(){const ge=jW({activeHunkIndex:R,filePaths:F,hunkCount:V.hunks,pendingNextFilePath:D,selectedFile:d});ge.kind==="hunk"?(M(null),z(ge.activeHunkIndex)):ge.kind==="confirm-next-file"?M(ge.filePath):ge.kind==="file"?Y(ge.filePath):M(null)}function W(){if(M(null),R>0){z(Ae=>Ae-1);return}const ge=P.findIndex(Ae=>Ae.path===d),Te=P[ge-1];Te&&Y(Te.path)}const ee=P.findIndex(ge=>ge.path===d),O=!!(V.hunks&&R<V.hunks-1||P[ee+1]),Z=!!(R>0||P[ee-1]),ie=D?`End of file. Click Next again to open ${D}.`:null,de=ge=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${ge?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,fe=ge=>`flex-1 px-2 py-0.5 text-[11px] font-medium transition-colors ${ge?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,pe=y.useMemo(()=>{const ge=new Set(P.map(Te=>Te.path));for(const Te of $)ge.add(Te);return ge},[P,$]);if(!e.git.selectedRepository)return o.jsx(WK,{});function Se(){g&&(u("changes"),m("changes"),Y(g))}function Le(ge){L(Te=>new Set(Te).add(ge)),v(ge),u("changes"),m("changes"),Y(ge)}function ve(ge){v(ge),u("all")}function Ge(ge){ge&&s(bu(e.git.cwd,ge))}return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[o.jsx("button",{type:"button",className:de(l==="changes"),onClick:()=>u("changes"),children:"Changes"}),o.jsx("button",{type:"button","aria-label":"Open all tracked files",className:de(l==="all"),onClick:()=>u("all"),children:"All files"}),o.jsx("button",{type:"button",className:de(l==="graph"),onClick:()=>u("graph"),children:"Tree"}),o.jsx("button",{type:"button",className:de(l==="largest"),onClick:()=>u("largest"),children:"Largest files"}),o.jsx("button",{type:"button",className:de(l==="github"),onClick:()=>u("github"),children:o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(tT,{className:"size-3"}),"GitHub"]})}),o.jsx("button",{type:"button",className:de(l==="workflows"),onClick:()=>u("workflows"),children:o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(Gt,{className:"size-3"}),"Workflows"]})})]}),o.jsx("div",{className:"min-h-0 flex-1",children:l==="workflows"?o.jsx(wK,{}):l==="github"?o.jsx(gK,{}):l==="graph"?o.jsx(FW,{branches:e.git.branches??[]}):l==="largest"?o.jsx(XW,{onOpenFile:ve,root:e.git.cwd}):l==="all"?o.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[o.jsx("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:w?o.jsx(Qe,{variant:"destructive",className:"m-3",children:w}):o.jsx(U2,{branch:e.git.status?.branch||void 0,onSelectFile:v,paths:_,root:e.git.cwd,selectedFile:g,status:P})}),o.jsx(TW,{isModified:pe.has(g),onFileSaved:Le,onSendToAi:()=>Ge(g),onViewDiff:Se,path:g})]}):o.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[o.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 gap-0.5 border-b border-border bg-card/95 p-1",children:[o.jsx("button",{"aria-label":"Show changed files as a list",className:fe(h==="changes"),onClick:()=>m("changes"),type:"button",children:"Changes"}),o.jsx("button",{"aria-label":"Show changed files as a tree",className:fe(h==="tree"),onClick:()=>m("tree"),type:"button",children:"Tree"})]}),h==="changes"?o.jsx(iq,{branch:e.git.status?.branch||void 0,error:e.git.error,files:P,selectedFile:d,onSelectFile:Y,root:e.git.cwd,staging:I}):o.jsx(U2,{branch:e.git.status?.branch||void 0,defaultExpandAll:!0,emptyMessage:e.git.error??"No changed files.",onSelectFile:Y,paths:F,root:e.git.cwd,selectedFile:d,status:P,title:"Changes"}),t&&e.git.status?o.jsx(cq,{branch:e.git.status.branch||void 0,files:P,onDone:t}):null]}),o.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:d||"Diff"}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[o.jsx("span",{children:"Long rows wrap inside the editor pane."}),V.additions||V.deletions?o.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[o.jsxs("span",{className:"text-emerald-700",children:["+",V.additions]}),o.jsxs("span",{className:"text-red-700",children:["-",V.deletions]})]}):null]})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[ie?o.jsx("span",{className:"max-w-72 truncate rounded border border-amber-200 bg-amber-50 px-2 py-1 text-[11px] text-amber-900",children:ie}):null,o.jsxs(se,{disabled:!d||!Z,onClick:W,size:"sm",type:"button",variant:"outline",children:[o.jsx(Ab,{}),"Previous"]}),o.jsxs(se,{disabled:!d||!O,onClick:X,size:"sm",type:"button",variant:"outline",children:[o.jsx(jb,{}),"Next"]}),o.jsx(se,{"aria-label":"Send selected file to AI input",className:"size-8",disabled:!d,onClick:()=>Ge(d),size:"icon",title:"Send selected file path to AI input",type:"button",variant:"outline",children:o.jsx(Gt,{className:"size-4"})})]})]}),o.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:N?o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"destructive",children:N})}):d?o.jsx(Bx,{activeHunkIndex:R,diff:E||"No unstaged diff for this file."}):o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a changed file to inspect its diff."})})})]})]})})]})}function WK(){return o.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:o.jsxs("div",{className:"max-w-sm",children:[o.jsx(C4,{className:"mx-auto size-8 text-muted-foreground/50"}),o.jsx("p",{className:"mt-3 text-sm font-medium",children:"No Git project registered"}),o.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Add a folder that is a Git worktree to review changes, browse files, and inspect history. Use the project picker in the header to add one."})]})})}function KK({initialPath:e,onSelect:t,selectedPath:s}){const[i,a]=y.useState(e),[l,u]=y.useState(null),[h,m]=y.useState(null),[d,p]=y.useState(!1),g=YK(l);return y.useEffect(()=>{a(e)},[e]),y.useEffect(()=>{let v=!0;return p(!0),m(null),IC(i).then(_=>{v&&(u(_),t(_.path))}).catch(_=>{v&&m(_ instanceof Error?_.message:String(_))}).finally(()=>{v&&p(!1)}),()=>{v=!1}},[i,t]),o.jsxs("div",{className:"rounded-md border border-border bg-background",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[g?o.jsx(se,{"aria-label":"Open parent folder",onClick:()=>l&&a(l.parent),size:"icon",type:"button",variant:"ghost",children:o.jsx(Mn,{className:"rotate-90"})}):null,o.jsx("div",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:l?.path??i}),d?o.jsx(pt,{className:"size-4 animate-spin text-muted-foreground"}):null]}),o.jsxs("div",{className:"max-h-56 overflow-auto p-1",children:[h?o.jsx(Qe,{variant:"destructive",className:"m-1",children:h}):null,!h&&l?.entries.length===0?o.jsx(Qe,{variant:"muted",className:"m-1 text-center",children:"No folders here."}):null,l?.entries.map(v=>o.jsxs(se,{className:le("h-8 w-full justify-start rounded-sm px-2 text-left",s===v.path&&"bg-muted"),onClick:()=>a(v.path),title:v.path,type:"button",variant:"ghost",children:[o.jsx(Ja,{className:"text-accent"}),o.jsx("span",{className:"truncate",children:v.name})]},v.path))]})]})}function YK(e){return!!(e&&e.parent!==e.path)}function tC(e){return e.split(/[\\/]/).filter(Boolean).pop()??"project"}function XK({data:e,onRefresh:t}){const[s,i]=y.useState(!1),[a,l]=y.useState(e.git.cwd),[u,h]=y.useState(null),[m,d]=y.useState(!1),[p,g]=y.useState(e.git.cwd),v=y.useRef(null),_=e.git.selectedRepository,S=_?.name??(e.git.cwd?tC(e.git.cwd):"Add Git project"),{error:w,success:C}=Ns(),E=QK({gitCwd:e.git.cwd});y.useEffect(()=>{l(e.git.cwd),g(e.git.cwd)},[e.git.cwd]),y.useEffect(()=>{if(!s)return;function D(M){v.current&&M.target instanceof Node&&!v.current.contains(M.target)&&i(!1)}return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[s]);async function T(D){try{await mn("/api/git/select",{name:D}),i(!1),await t(),C(`Switched to ${D}.`)}catch(M){w(M instanceof Error?M.message:String(M))}}async function N(D){const M=D.trim();if(!ZK(M)){const $="Please add an absolute path. Paths beginning with ~ are not expanded here.";return h($),w($),!1}try{const $=tC(M);return await mn("/api/git/repositories",{name:$,path:M}),h(null),await t(),C(`Added Git project ${$}.`),!0}catch($){const L=$ instanceof Error?$.message:String($);return h(L),w(L),!1}}async function j(D){try{await W6(D),await t(),C(`Removed Git project ${D}.`)}catch(M){w(M instanceof Error?M.message:String(M))}}async function R(D){D.preventDefault(),await N(a)&&i(!1)}function z(){h(null),g(E.selectedPath),d(!0)}return o.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:v,children:[o.jsxs(se,{className:"max-w-[220px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>i(D=>!D),size:"sm",type:"button",variant:"outline",children:[o.jsx(Ja,{className:"text-muted-foreground"}),o.jsx("span",{className:"truncate",children:S}),o.jsx(Mn,{className:le("ml-auto transition-transform",s&&"rotate-180")})]}),o.jsx(se,{"aria-label":"Add Git project",onClick:z,size:"sm",type:"button",variant:"outline",children:o.jsx(Cs,{})}),s?o.jsxs("div",{className:"absolute right-0 top-10 z-50 w-[min(380px,calc(100vw-2rem))] overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[o.jsx(d4,{className:"size-3.5 text-muted-foreground"}),o.jsx("div",{className:"text-xs font-semibold",children:"Git Projects"}),o.jsx(Pe,{className:"ml-auto h-5 px-1.5 text-[10px]",variant:"outline",children:e.config.gitRepositories.length})]}),o.jsx("div",{className:"max-h-72 overflow-auto",children:e.config.gitRepositories.length?o.jsx("div",{className:"divide-y divide-border",children:e.config.gitRepositories.map(D=>{const M=D.name===_?.name;return o.jsxs("div",{className:le("group grid w-full grid-cols-[1fr_auto_auto] items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted",M&&"bg-muted/70"),children:[o.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{T(D.name)},type:"button",children:[o.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:D.name}),o.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:D.path})]}),M?o.jsx(hi,{className:"size-3.5"}):o.jsx("span",{className:"size-3.5"}),o.jsx(se,{"aria-label":`Remove ${D.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{j(D.name)},size:"icon",title:`Remove ${D.name}`,type:"button",variant:"ghost",children:o.jsx(ua,{className:"size-3.5 text-destructive"})})]},D.name)})}):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No saved Git projects yet."})}),o.jsxs("div",{className:"border-t border-border bg-muted/20 p-2",children:[o.jsxs("form",{className:"flex gap-1.5",onSubmit:R,children:[o.jsx(nt,{"aria-label":"Paste absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:D=>{l(D.target.value),h(null)},placeholder:"/absolute/path",value:a}),o.jsxs(se,{className:"h-7 px-2 text-[11px]",size:"sm",type:"submit",children:[o.jsx(Cs,{className:"size-3"}),"Add"]}),o.jsx(se,{"aria-label":"Browse and add Git project",className:"h-7 px-2",onClick:z,size:"sm",type:"button",variant:"outline",children:o.jsx(T4,{className:"size-3"})})]}),u?o.jsx("div",{className:"mt-1.5 truncate text-[10px] text-destructive",children:u}):null]})]}):null,m?o.jsx(JK,{confirmLabel:E.confirmLabel,errorMessage:u,initialPath:E.initialPath,selectedPath:p,title:"Add Git Project",onCancel:()=>d(!1),onSelect:g,onUse:async()=>{await N(p)&&(d(!1),i(!1))}}):null]})}function ZK(e){return e.startsWith("/")}function QK({gitCwd:e}){return{confirmLabel:"Add Git project",initialPath:e,selectedPath:e}}function JK({confirmLabel:e="Use this folder",errorMessage:t,initialPath:s,onCancel:i,onSelect:a,onUse:l,selectedPath:u,title:h="Choose Git Project Folder"}){return gu.createPortal(o.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",children:o.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-border bg-card p-4 shadow-xl",children:[o.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[o.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg border border-border bg-background",children:o.jsx(Ja,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"text-sm font-semibold",children:h}),o.jsx("div",{className:"truncate font-mono text-xs text-muted-foreground",children:u})]}),o.jsx(se,{"aria-label":"Close folder picker",onClick:i,size:"icon",variant:"ghost",children:o.jsx(Gs,{})})]}),o.jsx(KK,{initialPath:s,onSelect:a,selectedPath:u}),t?o.jsx("div",{className:"mt-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:t}):null,o.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[o.jsx(se,{onClick:i,type:"button",variant:"outline",children:"Cancel"}),o.jsx(se,{onClick:()=>{l()},type:"button",children:e})]})]})}),document.body)}function eY({ahead:e=0,behind:t=0,branches:s,currentBranch:i,disabled:a,onRefresh:l,upstream:u}){const[h,m]=y.useState(!1),[d,p]=y.useState(""),[g,v]=y.useState(null),[_,S]=y.useState(null),[w,C]=y.useState(null),E=s.filter($=>!$.remote),T=s.filter($=>$.remote);async function N($,L){v($),C(null),S(null);try{await L(),await l()}catch(B){C(B instanceof Error?B.message:String(B))}finally{v(null)}}async function j($){await N(`switch:${$}`,async()=>{await mn("/api/git/branches/switch",{name:$}),m(!1)})}async function R(){await N("fetch",async()=>{await mn("/api/git/fetch",{}),S("Fetched latest branch refs.")})}async function z(){await N("push",async()=>{const $=await of();S($.setUpstream?`Pushed ${$.branch} and set upstream.`:`Pushed ${$.branch}.`)})}const D=!!i&&(e>0||!u&&t===0);async function M($){$.preventDefault();const L=d.trim();if(!L){C("Branch name is required.");return}await N("create",async()=>{await mn("/api/git/branches",{name:L}),p(""),m(!1)})}return o.jsxs("div",{className:"fixed bottom-12 right-4 z-50 flex items-end",children:[h?o.jsxs("div",{"aria-label":"Switch Git branch",className:"mb-11 w-[min(460px,calc(100vw-2rem))] rounded-lg border border-border bg-card shadow-xl",role:"dialog",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border p-3",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(pn,{className:"size-4 text-muted-foreground"}),o.jsx("span",{className:"truncate text-sm font-semibold",children:i||"Branches"})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[D?o.jsxs(se,{"aria-label":"Push current branch",className:"gap-1.5 px-2 text-xs",disabled:a||g!==null,onClick:()=>{z()},size:"sm",title:u?`Push ${e} commit${e===1?"":"s"} to ${u}`:"Push and set upstream",type:"button",variant:"default",children:[o.jsx(Lb,{className:le("size-3.5",g==="push"&&"animate-pulse")}),"Push",e>0?` ${e}`:""]}):null,o.jsx(se,{"aria-label":"Fetch branches",disabled:a||g!==null,onClick:()=>{R()},size:"icon",title:"Fetch branches",type:"button",variant:"ghost",children:o.jsx(ou,{className:le(g==="fetch"&&"animate-spin")})}),o.jsx(se,{"aria-label":"Close branch dialog",onClick:()=>m(!1),size:"icon",type:"button",variant:"ghost",children:o.jsx(Gs,{})})]})]}),o.jsx("div",{className:"max-h-72 overflow-auto",children:s.length?o.jsxs(o.Fragment,{children:[o.jsx(sC,{branches:E,busy:g!==null,disabled:a,label:"Local",onSwitch:j}),o.jsx(sC,{branches:T,busy:g!==null,disabled:a,label:"Remote",onSwitch:j})]}):o.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No branches found."})}),o.jsxs("div",{className:"border-t border-border p-3",children:[o.jsxs("form",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",onSubmit:M,children:[o.jsx(nt,{"aria-label":"New branch name",disabled:a||g!==null,onChange:$=>{p($.target.value),C(null),S(null)},placeholder:"feature/new-work",value:d}),o.jsxs(se,{disabled:a||g!==null,type:"submit",children:[o.jsx(H4,{}),"Create"]})]}),w||_?o.jsx(Qe,{className:"mt-3 px-3 py-2 text-xs",variant:w?"destructive":"muted",children:w??_}):null]})]}):null,o.jsxs(se,{className:"h-8 max-w-[260px] gap-2 rounded-md shadow-lg",disabled:a,onClick:()=>m($=>!$),size:"sm",title:"Switch Git branch",type:"button",variant:"default",children:[o.jsx(pn,{className:"size-4"}),o.jsx("span",{className:"truncate font-mono text-xs",children:i||"No branch"}),i&&(e>0||t>0)?o.jsxs("span",{className:"flex items-center gap-1 font-mono text-[11px] tabular-nums",title:u?`${e} ahead / ${t} behind ${u}`:`${e} ahead / ${t} behind`,children:[t>0?o.jsxs("span",{className:"flex items-center",children:[o.jsx(jb,{className:"size-3"}),t]}):null,e>0?o.jsxs("span",{className:"flex items-center",children:[o.jsx(Ab,{className:"size-3"}),e]}):null]}):null,o.jsx(Mn,{className:le("size-4 transition-transform",h&&"rotate-180")})]})]})}function sC({branches:e,busy:t,disabled:s,label:i,onSwitch:a}){return o.jsxs("section",{children:[o.jsx("div",{className:"border-b border-border bg-muted/60 px-3 py-1.5 text-[11px] font-semibold uppercase text-muted-foreground",children:i}),e.length?e.map(l=>o.jsxs("button",{className:le("grid w-full grid-cols-[1fr_auto] items-center gap-2 border-b border-border px-3 py-2 text-left text-sm last:border-b-0 hover:bg-muted",l.current&&"bg-muted/70"),disabled:s||t||l.current,onClick:()=>{a(l.name)},type:"button",children:[o.jsxs("span",{className:"min-w-0",children:[o.jsx("span",{className:"block truncate font-medium",children:l.name}),l.upstream?o.jsxs("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:["tracks ",l.upstream]}):null]}),o.jsx(Pe,{variant:l.current?"success":l.remote?"outline":"secondary",children:l.current?"current":l.remote?"remote":"local"})]},`${l.remote?"remote":"local"}:${l.name}`)):o.jsxs("div",{className:"border-b border-border px-3 py-3 text-sm text-muted-foreground",children:["No ",i.toLowerCase()," branches."]})]})}const rT="nomoreide-theme-choice";function tY(){if(typeof window>"u")return"dark";const e=window.localStorage.getItem(rT);return e==="light"||e==="dark"?e:"dark"}function sY(e){const t=document.documentElement;t.classList.toggle("dark",e==="dark"),t.style.colorScheme=e}function nY(){const[e,t]=y.useState(()=>tY()),s=y.useRef(null);y.useEffect(()=>{sY(e),window.localStorage.setItem(rT,e)},[e]);const i=y.useCallback(()=>{const a=e==="dark"?"light":"dark",l=s.current,u=document;if(!l||!u.startViewTransition||window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(a);return}const h=l.getBoundingClientRect(),m=h.left+h.width/2,d=h.top+h.height/2,p=Math.hypot(Math.max(m,window.innerWidth-m),Math.max(d,window.innerHeight-d));u.startViewTransition(()=>{t(a)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${m}px ${d}px)`,`circle(${p}px at ${m}px ${d}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},[e]);return o.jsxs("button",{ref:s,onClick:i,title:e==="dark"?"Switch to light mode":"Switch to dark mode","aria-label":"Toggle theme",className:zh(),children:[o.jsx("span",{className:Bh(),children:e==="dark"?o.jsx(a6,{}):o.jsx(xM,{})}),o.jsx("span",{className:Ih(),children:"Theme"})]})}function iY(e=!1){return le("group/sidebar hidden h-full shrink-0 overflow-x-hidden overflow-y-auto border-r border-border bg-card/85 py-5 backdrop-blur transition-[width,padding] duration-200 md:flex md:flex-col",e?"w-64 px-4":"w-16 px-2 hover:w-64 hover:px-4")}function rY(e,t=!1){return le("relative grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center justify-start gap-0 overflow-hidden rounded-md px-0 text-[15px] font-medium transition-[background-color,color,width] duration-150",t?"w-full":"w-12 group-hover/sidebar:w-full",e?"bg-primary text-primary-foreground hover:bg-primary/90":"hover:bg-muted")}function aY(e=!1,t=!1){return le("min-w-0 overflow-hidden text-left text-current transition duration-150 whitespace-pre",e?"translate-x-1 opacity-100":"opacity-0 group-hover/sidebar:translate-x-1 group-hover/sidebar:opacity-100",t?"pr-10":"pr-3")}function oY(e=!1){return le("flex size-12 items-center justify-center text-current transition-transform duration-150 [&_svg]:size-5",e?"translate-x-0":"-translate-x-px group-hover/sidebar:translate-x-0")}function lY({docked:e,onToggleDock:t}){return o.jsxs("div",{className:le("mt-auto flex h-10 min-w-0 items-center overflow-hidden border-t border-border/60 text-[11px] text-muted-foreground transition-[height,opacity,width] duration-150",e?"w-full justify-start opacity-100":"w-12 justify-center group-hover/sidebar:w-full group-hover/sidebar:justify-start group-hover/sidebar:opacity-100"),children:[o.jsxs("span",{className:le("flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-pre transition-[opacity,width] duration-150",e?"flex-1 opacity-100":"w-0 flex-none opacity-0 group-hover/sidebar:w-auto group-hover/sidebar:flex-1 group-hover/sidebar:opacity-100"),children:[o.jsx("span",{children:"Made with"}),o.jsx(V4,{"aria-label":"love",className:"size-3 shrink-0 fill-red-500 text-red-500"}),o.jsx("span",{children:"by Robert Wang"}),o.jsx("a",{"aria-label":"Robert Wang on LinkedIn",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-[#0A66C2]",href:"https://www.linkedin.com/in/robert-wang-cs/",rel:"noopener noreferrer",target:"_blank",title:"LinkedIn",children:o.jsx("svg",{"aria-hidden":!0,className:"size-3 fill-current",role:"img",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.063 2.063 0 1 1 0-4.126 2.063 2.063 0 0 1 0 4.126zM7.119 20.452H3.554V9h3.565v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.225 0z"})})})]}),o.jsx("button",{"aria-label":e?"Undock sidebar":"Dock sidebar","aria-pressed":e,className:le("flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-4",e?"ml-auto bg-muted text-foreground":"group-hover/sidebar:ml-auto"),onClick:t,title:e?"Undock sidebar":"Dock sidebar",type:"button",children:e?o.jsx(kM,{}):o.jsx(NM,{})})]})}function cY({className:e}){return o.jsxs("div",{className:le("min-w-0",e),children:[o.jsxs("div",{className:"flex items-baseline gap-1.5",children:[o.jsx("div",{className:"text-sm font-semibold",children:"NoMoreIDE"}),o.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:["v","0.1.49"]})]}),o.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:"127.0.0.1 console"})]})}function uY({syncLocation:e=!0}={}){const[t,s]=y.useState(()=>e?window.location.pathname.startsWith("/agent")?"agent":window.location.pathname.startsWith("/errors")?"errors":window.location.pathname.startsWith("/database")?"database":window.location.pathname.startsWith("/terminal")?"terminal":window.location.pathname.startsWith("/git")?"git":"services":"services"),[i,a]=y.useState(null),[l,u]=y.useState(null),[h,m]=y.useState(null),[d,p]=y.useState(null),[g,v]=y.useState(!0),{error:_,success:S}=Ns(),[w,C]=y.useState(()=>window.localStorage.getItem("nomoreide:sidebar-docked")==="true"),E=y.useCallback(async(N={})=>{N.silent||v(!0),p(null);try{a(await fR()),N.notify&&S("Dashboard refreshed.")}catch(j){const R=j instanceof Error?j.message:String(j);p(R),_(R)}finally{v(!1)}},[_,S]);y.useEffect(()=>{E()},[E]),y.useEffect(()=>{function N(){document.visibilityState==="visible"&&E({silent:!0})}const j=window.setInterval(N,5e3);return window.addEventListener("focus",N),document.addEventListener("visibilitychange",N),()=>{window.clearInterval(j),window.removeEventListener("focus",N),document.removeEventListener("visibilitychange",N)}},[t,E]),y.useEffect(()=>{if(!e)return;const N=t==="git"?"/git":t==="agent"?"/agent":t==="errors"?"/errors":t==="database"?"/database":t==="terminal"?"/terminal":"/";window.location.pathname!==N&&window.history.pushState(null,"",N)},[t,e]),y.useEffect(()=>{window.localStorage.setItem("nomoreide:sidebar-docked",String(w))},[w]);const T=y.useMemo(()=>i?Object.values(i.runtime.services).filter(N=>N.state==="running").length:0,[i]);return o.jsx(k9,{children:o.jsx(_B,{onRefresh:()=>{E({silent:!0})},children:o.jsxs("div",{className:"h-screen overflow-hidden pb-9",children:[o.jsxs("div",{className:"mx-auto flex h-full max-w-[1500px]",children:[o.jsxs("aside",{className:iY(w),children:[o.jsxs("div",{className:le("grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden transition-[width] duration-150",w?"w-full":"w-12 group-hover/sidebar:w-full"),children:[o.jsx("div",{className:"flex size-12 items-center justify-center",children:o.jsx("div",{className:"flex size-9 items-center justify-center overflow-hidden rounded-md bg-primary text-primary-foreground",children:o.jsxs("svg",{"aria-label":"NoMoreIDE",className:"size-6",fill:"none",role:"img",viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M5 17C5 13.69 7.69 11 11 11H25L31 17H53C56.31 17 59 19.69 59 23V53C59 56.31 56.31 59 53 59H11C7.69 59 5 56.31 5 53V17Z",fill:"currentColor"}),o.jsx("path",{d:"M22 31L30 39L22 47",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"4.5"}),o.jsx("path",{d:"M36 47H48",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeWidth:"4.5"})]})})}),o.jsx(cY,{className:le("min-w-0 translate-x-1 overflow-hidden transition-opacity duration-200",w?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100")})]}),o.jsxs("nav",{className:"mt-5 grid flex-1 content-start gap-1",children:[o.jsx(Yo,{active:t==="services",badge:T,docked:w,icon:o.jsx(CC,{}),label:"Services",onClick:()=>s("services")}),o.jsx(Yo,{active:t==="git",docked:w,icon:o.jsx(pn,{}),label:"Git Review",onClick:()=>s("git")}),o.jsx(Yo,{active:t==="errors",docked:w,icon:o.jsx(Ch,{}),label:"Error Inbox",onClick:()=>s("errors")}),o.jsx(Yo,{active:t==="database",docked:w,icon:o.jsx(Xn,{}),label:"Database",onClick:()=>s("database")}),o.jsx(Yo,{active:t==="terminal",docked:w,icon:o.jsx(n6,{}),label:"Terminal",onClick:()=>s("terminal")}),o.jsx(Yo,{active:t==="agent",docked:w,icon:o.jsx(RA,{}),label:"Agent",onClick:()=>s("agent")})]}),o.jsx(lY,{docked:w,onToggleDock:()=>C(N=>!N)})]}),o.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col px-0 py-0",children:[o.jsxs("header",{className:le("relative z-40 flex shrink-0 flex-wrap items-center justify-between gap-3 border border-border bg-card/90 px-4 py-3 backdrop-blur","border-x-0 border-t-0 border-b"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(TM,{className:"size-4 text-muted-foreground md:hidden"}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:t==="git"?"Git Review":t==="agent"?"Agent":t==="errors"?"Error Inbox":t==="database"?"Database":t==="terminal"?"Terminal":"Services"}),o.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:i?.git.selectedRepository?.name??i?.git.cwd??"Local workspace"})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[d?o.jsx(Pe,{variant:"danger",children:d}):null,i&&t==="git"?o.jsx(XK,{data:i,onRefresh:E}):null,o.jsxs("div",{"aria-label":"Dashboard quick actions",className:"flex items-center gap-1 rounded-lg border border-border bg-background p-px",role:"group",children:[o.jsxs("button",{"aria-label":"Refresh dashboard",className:zh(),onClick:()=>{E({notify:!0})},title:"Refresh dashboard",type:"button",children:[o.jsx("span",{className:Bh(),children:o.jsx(ou,{className:le(g&&"animate-spin")})}),o.jsx("span",{className:Ih(),children:"Refresh"})]}),o.jsx(nY,{}),o.jsxs("a",{"aria-label":"Open NoMoreIDE documentation",className:zh(),href:"https://www.nomoreide.com/docs",rel:"noreferrer",target:"_blank",title:"Open NoMoreIDE documentation",children:[o.jsx("span",{className:Bh(),children:o.jsx(AA,{})}),o.jsx("span",{className:Ih(),children:"Docs"})]}),i?o.jsx(cB,{data:i}):null]})]})]}),i?o.jsx(GF,{data:i,onOpenService:N=>{u(N),s("services"),E({silent:!0})}}):null,g&&!i?o.jsx(Qe,{variant:"muted",children:"Loading NoMoreIDE state..."}):null,o.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[i&&t==="services"?o.jsx(FF,{data:i,onRefresh:E,focusService:l,onServiceFocused:()=>u(null)}):null,i&&t==="git"?o.jsx(GK,{data:i,onRefresh:()=>{E({silent:!0})}}):null,t==="agent"?o.jsx(Pz,{}):null,t==="errors"?o.jsx(kP,{}):null,t==="database"?o.jsx(xP,{staged:h,onStageConsumed:()=>m(null)}):null,t==="terminal"?o.jsx(QF,{}):null]})]})]}),i&&t==="git"?o.jsx(eY,{ahead:i.git.status?.ahead??0,behind:i.git.status?.behind??0,branches:i.git.branches,currentBranch:i.git.status?.branch||void 0,disabled:!i.git.status,onRefresh:E,upstream:i.git.status?.upstream}):null,o.jsx(II,{git:i?.git,onGitRefresh:()=>{E({silent:!0})},onOpenAgentPage:t==="agent"?void 0:()=>s("agent"),onOpenService:N=>{u(N),s("services"),E({silent:!0})},onOpenSqlConsole:(N,j)=>{m(R=>({connection:N,sql:j,nonce:(R?.nonce??0)+1})),s("database")}})]})})})}function Yo({active:e,badge:t,docked:s,icon:i,label:a,onClick:l}){const u=t!==void 0&&t>0;return o.jsxs(se,{"aria-label":a,title:a,className:rY(e,s),variant:"ghost",onClick:l,type:"button",children:[o.jsx("span",{className:oY(s),children:i}),o.jsx("span",{className:aY(s,u),children:a}),t!==void 0&&t>0?o.jsx(Pe,{appearance:t>0?"solid":"outline",className:le("min-w-6 justify-center px-1.5 font-mono shadow-none",e?"border-primary-foreground/40 bg-primary-foreground/15 text-primary-foreground dark:border-primary-foreground/40 dark:bg-primary-foreground/15 dark:text-primary-foreground":t>0?"":"border-border bg-background text-muted-foreground","absolute right-1.5 top-1.5 h-4 min-w-4 rounded-full px-1 text-[10px] leading-none shadow-none group-hover/sidebar:right-2 group-hover/sidebar:top-1/2 group-hover/sidebar:-translate-y-1/2 group-hover/sidebar:text-xs",s&&"right-2 top-1/2 -translate-y-1/2 text-xs"),size:"small",variant:t>0?"success":"outline",children:t}):null]})}iC.createRoot(document.getElementById("root")).render(o.jsx(y.StrictMode,{children:o.jsx(uY,{})}));export{o as j,y as r};
|
|
211
|
+
`)}function eC(e){const t=/\breview|check|inspect|audit\b/.test(e),s=/\bcommit\b|\bship|push|pr|pull request\b/.test(e),i=/\bpr\b|pull request/.test(e),a=/\btest|verify|ci\b/.test(e);return t&&s&&i?"Review, Commit & PR":a&&s&&i?"Verify, Commit & PR":t&&s?"Review & Commit":s&&i?"Commit & PR":s?"Commit workflow":t?"Review workflow":"Custom workflow"}function ah(e,t,s){return{kind:"gate",id:e,title:t,message:s}}function Nc(e,t,s,i,a){return{kind:"agent",id:e,title:t,prompt:s,capabilities:Vx(i),verify:a}}function _K(e,t){return Vx({skills:t.skills.filter(s=>e.includes(s.toLowerCase())),mcpServers:t.mcpServers.filter(s=>e.includes(s.toLowerCase())),plugins:t.plugins.filter(s=>e.includes(s.toLowerCase())),hooks:t.hooks.filter(s=>e.includes(s.toLowerCase()))})??{}}function oh(e,t){const s={};for(const i of t){const a=e[i];a?.length&&(s[i]=a)}return Vx(s)}function Vx(e){if(!e)return;const t={};for(const s of["skills","mcpServers","plugins","hooks"]){const i=Array.from(new Set((e[s]??[]).filter(Boolean)));i.length&&(t[s]=i)}return Object.keys(t).length?t:void 0}function yK(e){const t=new Map;return e.map(s=>{const i=sT(s.id)||s.kind,a=t.get(i)??0;return t.set(i,a+1),a===0?{...s,id:i}:{...s,id:`${i}-${a+1}`}})}function SK(e,t){const s=new Set(t.map(l=>l.id));let i=e||"workflow",a=2;for(;s.has(i);)i=`${e}-${a}`,a++;return i}function sT(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function wK(){const{run:e,start:t,approve:s,skip:i,stop:a,dismiss:l}=yB(),[u,h]=y.useState([]),[m,d]=y.useState(null),[p,g]=y.useState(null),[v,_]=y.useState(null),[S,w]=y.useState(!0),[C,E]=y.useState(!0);y.useEffect(()=>{let z=!0;return w(!0),Promise.all([NR(),MC().catch(()=>null)]).then(([D,M])=>{z&&(h(D),d(M))}).catch(D=>{z&&_(D instanceof Error?D.message:String(D))}).finally(()=>{z&&w(!1)}),()=>{z=!1}},[]);function T(z){t(z,C)}async function N(z){_(null);try{const D=await ER(z);h(D),g(null)}catch(D){_(D instanceof Error?D.message:String(D))}}async function j(z){if(!z.builtin&&window.confirm(`Delete workflow "${z.name}"?`)){_(null);try{h(await TR(z.id))}catch(D){_(D instanceof Error?D.message:String(D))}}}function R(z){g({...z,id:Gx(`${z.id}-copy`,u),name:`${z.name} copy`,builtin:!1,steps:z.steps.map((D,M)=>({...D,id:`${D.id}-${M+1}`}))})}return e?o.jsx(RK,{run:e,onApprove:s,onSkip:i,onStop:a,onBack:l}):p?o.jsx(CK,{agent:m?LK(m):null,existing:u,initial:p,onCancel:()=>g(null),onSave:z=>{N(z)}}):o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-card/85",children:[o.jsxs("div",{className:"border-b border-border px-4 py-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[o.jsx(Gt,{className:"size-4"})," AI Workflows"]}),o.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"One-click rituals that exceed the IDE — the agent does the work in the dock, pausing at each gate for your OK."})]}),o.jsxs(se,{onClick:()=>g(BK(u)),size:"sm",type:"button",variant:"outline",children:[o.jsx(Cs,{className:"size-3.5"})," New"]})]}),o.jsxs("label",{className:"mt-2 flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground",children:[o.jsx("input",{checked:C,className:"size-3.5 accent-primary",onChange:z=>E(z.target.checked),type:"checkbox"}),"Run without step-by-step prompts",o.jsx("span",{className:"text-muted-foreground/60",children:"— gates still pause; risky shell still asks."})]})]}),v?o.jsx(Qe,{variant:"destructive",className:"m-4",children:v}):S?o.jsxs("div",{className:"flex flex-1 items-center justify-center text-[12px] text-muted-foreground",children:[o.jsx(pt,{className:"mr-2 size-4 animate-spin"})," Loading workflows…"]}):o.jsx("div",{className:"grid gap-3 p-4 sm:grid-cols-2 xl:grid-cols-3",children:u.map(z=>o.jsx(kK,{workflow:z,onDelete:()=>{j(z)},onDuplicate:()=>R(z),onEdit:()=>g(z),onRun:()=>T(z)},z.id))})]})}function kK({workflow:e,onDelete:t,onDuplicate:s,onEdit:i,onRun:a}){return o.jsxs("div",{className:"flex flex-col rounded-lg border border-border bg-background p-3.5 shadow-sm",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx("h3",{className:"text-[13px] font-semibold",children:e.name}),e.builtin?o.jsx("span",{className:"rounded-full border border-border px-1.5 py-px text-[9px] uppercase tracking-wide text-muted-foreground",children:"Template"}):null]}),e.description?o.jsx("p",{className:"mt-1 text-[11px] leading-snug text-muted-foreground",children:e.description}):null,o.jsx("ol",{className:"mt-2.5 space-y-1",children:e.steps.map(l=>o.jsxs("li",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[o.jsx(VK,{kind:l.kind}),o.jsx("span",{className:"truncate",children:Wx(l)})]},l.id))}),o.jsxs(se,{className:"mt-3 w-full",onClick:a,size:"sm",type:"button",children:[o.jsx(eo,{className:"size-3.5"})," Run"]}),o.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:[o.jsxs(se,{onClick:i,size:"sm",type:"button",variant:"outline",children:[o.jsx(OM,{className:"size-3.5"})," Edit"]}),o.jsxs(se,{onClick:s,size:"sm",type:"button",variant:"outline",children:[o.jsx(kh,{className:"size-3.5"})," Copy"]}),o.jsxs(se,{disabled:e.builtin,onClick:t,size:"sm",title:e.builtin?"Duplicate or edit to create your own version first":"Delete workflow",type:"button",variant:"outline",children:[o.jsx(ua,{className:"size-3.5"})," Delete"]})]})]})}function CK({agent:e,existing:t,initial:s,onCancel:i,onSave:a}){const[l,u]=y.useState(()=>structuredClone(s)),[h,m]=y.useState(s.description??""),d=zK(e),{sendToAgent:p}=Bt(),g=!l.id.trim()||!l.name.trim()||l.steps.length===0;function v(N,j){u(R=>({...R,steps:R.steps.map((z,D)=>D===N?j(z):z)}))}function _(N,j){u(R=>{const z=N+j;if(z<0||z>=R.steps.length)return R;const D=[...R.steps],[M]=D.splice(N,1);return D.splice(z,0,M),{...R,steps:D}})}function S(N){u(j=>({...j,steps:j.steps.filter((R,z)=>z!==N)}))}function w(N=h){const j=Jk(N,t,d);u(j)}function C(N){const j=Jk(N,[],d);u(R=>({...R,steps:[...R.steps,...j.steps]}))}function E(){p({prompt:vK(h||l.description||l.name),source:{type:"workflow",label:"Workflow composer"},mode:"draft"})}function T(){const N=rl(l.id)||Gx(rl(l.name)||"workflow",t);a({...l,id:N,name:l.name.trim(),description:(h||l.description)?.trim()||void 0,builtin:!1,steps:l.steps.map(IK)})}return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-card/85",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-4 py-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[o.jsx(Gt,{className:"size-4"})," Workflow Composer"]}),o.jsx("p",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:"Describe the ritual. NoMoreIDE turns it into a gated timeline you can tune."})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs(se,{onClick:i,size:"sm",type:"button",variant:"outline",children:[o.jsx(au,{className:"size-3.5"})," Back"]}),o.jsxs(se,{disabled:g,onClick:T,size:"sm",type:"button",children:[o.jsx(hi,{className:"size-3.5"})," Save"]})]})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsxs("section",{className:"shrink-0 border-b border-border p-4",children:[o.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(280px,0.9fr)_minmax(0,1.1fr)]",children:[o.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 shadow-sm",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(Qa,{children:"Workflow identity"}),o.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:l.id})]}),o.jsx("input",{className:"w-full bg-transparent text-lg font-semibold outline-none",onChange:N=>u(j=>({...j,name:N.target.value,id:rl(N.target.value)||j.id})),value:l.name})]}),o.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 shadow-sm",children:[o.jsx(Qa,{children:"Describe workflow"}),o.jsx("textarea",{className:"min-h-16 w-full resize-none bg-transparent text-[13px] leading-relaxed outline-none placeholder:text-muted-foreground",onChange:N=>m(N.target.value),placeholder:"Review my changes with code-review, ask before commit, push, then open a PR with GitHub...",value:h}),o.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[o.jsxs(se,{onClick:()=>w(),size:"sm",type:"button",children:[o.jsx(zi,{className:"size-3.5"})," Draft timeline"]}),o.jsxs(se,{onClick:E,size:"sm",type:"button",variant:"outline",children:[o.jsx(fM,{className:"size-3.5"})," Ask AI"]}),["Commit safely","Review then push","Fix CI then PR","File issue from changes"].map(N=>o.jsx("button",{className:"rounded-md border border-border bg-muted/30 px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>{m(N),w(N)},type:"button",children:N},N))]})]})]}),o.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-[minmax(0,1fr)_minmax(280px,0.45fr)]",children:[o.jsx(EK,{capabilities:d}),o.jsx(NK,{onAdd:C})]})]}),o.jsx("main",{className:"min-h-0 flex-1 overflow-auto p-4",children:l.steps.length?o.jsx("ol",{className:"mx-auto max-w-6xl space-y-0",children:l.steps.map((N,j)=>o.jsxs("li",{className:"relative pb-5 pl-14 last:pb-0",children:[o.jsx(jK,{index:j,kind:N.kind}),j===l.steps.length-1?null:o.jsx(AK,{}),o.jsx(TK,{capabilities:d,index:j,isFirst:j===0,isLast:j===l.steps.length-1,onMove:_,onRemove:S,onUpdate:v,step:N})]},`${N.kind}:${N.id}`))}):o.jsx("div",{className:"flex h-52 items-center justify-center rounded-lg border border-dashed border-border text-[12px] text-muted-foreground",children:"Add a step to start."})})]})]})}function NK({onAdd:e}){const[t,s]=y.useState("");return o.jsxs("form",{className:"rounded-lg border border-dashed border-border bg-background/70 p-3",onSubmit:i=>{i.preventDefault();const a=t.trim();a&&(e(a),s(""))},children:[o.jsx(Qa,{children:"Add a step"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[12px] outline-none placeholder:text-muted-foreground",onChange:i=>s(i.target.value),placeholder:"ask before merge, run tests, open an issue...",value:t}),o.jsxs(se,{size:"sm",type:"submit",variant:"outline",children:[o.jsx(Cs,{className:"size-3.5"})," Add"]})]})]})}function EK({capabilities:e}){const t=[...e.skills.map(s=>`@skill:${s}`),...e.mcpServers.map(s=>`@mcp:${s}`),...e.plugins.map(s=>`@plugin:${s}`)].slice(0,18);return t.length?o.jsxs("div",{className:"rounded-lg border border-border bg-background p-3",children:[o.jsx(Qa,{children:"Detected capabilities"}),o.jsx("div",{className:"flex max-h-20 flex-wrap gap-1.5 overflow-hidden",children:t.map(s=>o.jsx("span",{className:"rounded-md border border-border bg-muted/30 px-2 py-1 font-mono text-[11px] text-muted-foreground",children:s},s))})]}):null}function TK({capabilities:e,index:t,isFirst:s,isLast:i,onMove:a,onRemove:l,onUpdate:u,step:h}){const m=PK(h);return o.jsx("section",{className:"group rounded-lg border border-border bg-background p-3 shadow-sm",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(iT,{kind:h.kind}),o.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[13px] font-semibold outline-none",onChange:d=>u(t,p=>({...p,title:d.target.value})),value:h.title})]}),o.jsx("textarea",{className:"mt-2 min-h-16 w-full resize-none bg-transparent text-[12px] leading-relaxed text-muted-foreground outline-none focus:text-foreground",onChange:d=>{const p=d.target.value;u(t,g=>$K(g,p))},value:m}),h.kind==="agent"?o.jsx(MK,{capabilities:e,selected:h.capabilities,onToggle:(d,p)=>u(t,g=>g.kind==="agent"?{...g,capabilities:HK(g.capabilities,d,p)}:g)}):null]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-70 transition-opacity group-hover:opacity-100",children:[o.jsx(se,{disabled:s,onClick:()=>a(t,-1),size:"sm",type:"button",variant:"ghost",children:"↑"}),o.jsx(se,{disabled:i,onClick:()=>a(t,1),size:"sm",type:"button",variant:"ghost",children:"↓"}),o.jsx(se,{onClick:()=>l(t),size:"sm",type:"button",variant:"ghost",children:o.jsx(ua,{className:"size-3.5"})})]})]})})}function jK({index:e,kind:t}){return o.jsxs("div",{className:"absolute left-0 top-2 z-10 flex size-9 items-center justify-center rounded-full border border-border bg-card shadow-sm",children:[o.jsx("span",{className:"absolute -right-1 -top-1 flex size-4 items-center justify-center rounded-full border border-border bg-background font-mono text-[9px] text-muted-foreground",children:e+1}),o.jsx(FK,{kind:t})]})}function AK(){return o.jsxs("svg",{"aria-hidden":!0,className:"absolute bottom-1 left-[18px] top-12 w-6 overflow-visible text-border",preserveAspectRatio:"none",viewBox:"0 0 24 100",children:[o.jsx("title",{children:"Next step connector"}),o.jsx("line",{stroke:"currentColor",strokeDasharray:"4 5",strokeLinecap:"round",strokeWidth:"2",x1:"12",x2:"12",y1:"0",y2:"82"}),o.jsx("path",{d:"M6 78 L12 88 L18 78",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function MK({capabilities:e,onToggle:t,selected:s}){const i=[{key:"skills",label:"Skills",values:e.skills},{key:"mcpServers",label:"MCP",values:e.mcpServers},{key:"plugins",label:"Plugins",values:e.plugins},{key:"hooks",label:"Hooks",values:e.hooks}];return o.jsxs("div",{className:"space-y-2",children:[o.jsx(Qa,{children:"Capabilities"}),i.map(a=>o.jsxs("div",{children:[o.jsx("div",{className:"mb-1 text-[10px] text-muted-foreground",children:a.label}),a.values.length?o.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.values.map(l=>{const u=s?.[a.key]?.includes(l)??!1;return o.jsx("button",{className:le("rounded-md border px-2 py-1 text-[11px] transition-colors",u?"border-primary/50 bg-primary/10 text-primary":"border-border bg-muted/30 text-muted-foreground hover:bg-muted"),onClick:()=>t(a.key,l),type:"button",children:l},l)})}):o.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"None detected."})]},a.key))]})}function RK({run:e,onApprove:t,onSkip:s,onStop:i,onBack:a}){const l=e.outcome!=="running",[u,h]=y.useState(()=>new Set);y.useEffect(()=>{const d=e.workflow.steps[e.index],p=e.statuses[e.index];d&&(p==="running"||p==="waiting")&&h(g=>g.has(d.id)?g:new Set(g).add(d.id))},[e.index,e.statuses,e.workflow.steps]);const m=d=>h(p=>{const g=new Set(p);return g.has(d)?g.delete(d):g.add(d),g});return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-card/85",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[o.jsx(Gt,{className:"size-4"})," ",e.workflow.name]}),o.jsxs("p",{className:"mt-0.5 flex items-center gap-1 text-[11px] text-muted-foreground",children:[o.jsx(af,{className:"size-3"})," Watch the agent work in the dock below."]})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(UK,{outcome:e.outcome}),l?o.jsxs(se,{onClick:a,size:"sm",type:"button",variant:"outline",children:[o.jsx(au,{className:"size-3.5"})," Workflows"]}):o.jsxs(se,{onClick:i,size:"sm",type:"button",variant:"outline",children:[o.jsx(lu,{className:"size-3.5"})," Stop"]})]})]}),o.jsx("ol",{className:"px-4 py-4",children:e.workflow.steps.map((d,p)=>{const g=e.statuses[p],v=p===e.workflow.steps.length-1,_=d.kind==="gate"&&g==="waiting",S=u.has(d.id)||g==="waiting"||g==="failed"||g==="blocked",w=g==="running"||g==="waiting";return o.jsxs("li",{className:"relative pb-3 pl-10 last:pb-0",children:[v?null:o.jsx("span",{"aria-hidden":!0,className:"absolute bottom-0 left-[19px] top-9 w-px bg-border"}),o.jsx("span",{className:le("absolute left-1 top-1 flex size-8 items-center justify-center rounded-full border bg-card",g==="failed"?"border-destructive/50":g==="blocked"?"border-amber-500/50":w?"border-primary/50":g==="done"?"border-emerald-500/50":"border-border"),children:o.jsx(qK,{status:g,kind:d.kind})}),o.jsxs("section",{className:le("overflow-hidden rounded-lg border transition-colors",g==="failed"?"border-destructive/40 bg-destructive/[0.03]":g==="blocked"?"border-amber-500/40 bg-amber-500/[0.04]":w?"border-primary/40 bg-primary/[0.03]":"border-border bg-background"),children:[o.jsxs("button",{className:"flex w-full items-center gap-2 px-3 py-2.5 text-left transition-colors hover:bg-muted/40",onClick:()=>m(d.id),type:"button",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium",children:Wx(d)}),o.jsx(iT,{kind:d.kind}),o.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:DK(g)}),S?o.jsx(Mn,{className:"size-3.5 shrink-0 text-muted-foreground/60"}):o.jsx(Li,{className:"size-3.5 shrink-0 text-muted-foreground/60"})]}),S?o.jsxs("div",{className:"border-t border-border px-3 py-2.5 text-[11px] leading-relaxed",children:[o.jsx(OK,{step:d,status:g,output:e.outputs[p]}),_?o.jsxs("div",{className:"mt-2.5 flex items-center gap-1.5",children:[o.jsxs(se,{onClick:t,size:"sm",type:"button",children:[o.jsx(hi,{className:"size-3.5"})," Approve"]}),o.jsxs(se,{onClick:s,size:"sm",type:"button",variant:"outline",children:[o.jsx(TC,{className:"size-3.5"})," Skip"]}),o.jsxs(se,{onClick:i,size:"sm",type:"button",variant:"outline",children:[o.jsx(Gs,{className:"size-3.5"})," Stop"]})]}):null,g==="failed"&&e.error?o.jsx("p",{className:"mt-2 text-destructive",children:e.error}):null,g==="blocked"&&e.error?o.jsx("p",{className:"mt-2 text-amber-700 dark:text-amber-400",children:e.error}):null]}):null]})]},d.id)})})]})}function DK(e){return e==="running"?"Running":e==="waiting"?"Waiting":e==="done"?"Done":e==="blocked"?"Needs you":e==="failed"?"Failed":e==="skipped"?"Skipped":"Queued"}function OK({step:e,status:t,output:s}){if(e.kind==="gate")return o.jsx("p",{className:"text-muted-foreground",children:e.message});if(e.kind==="action")return o.jsx("p",{className:"text-muted-foreground",children:e.op==="push"?"Pushes the current branch to its remote.":"Stages and commits all changes."});const i=t==="done"||t==="failed"||t==="skipped";return s?o.jsxs("div",{children:[o.jsx(Qa,{children:"Result"}),o.jsx("div",{className:"whitespace-pre-wrap break-words rounded-md bg-muted/50 px-2.5 py-2 font-mono text-[11px] text-foreground",children:s})]}):o.jsxs("div",{children:[o.jsx(Qa,{children:i?"Result":"Task"}),i?o.jsx("p",{className:"italic text-muted-foreground",children:"No text reply — see the dock for what the agent did."}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-muted-foreground",children:e.prompt}),t==="running"?o.jsxs("p",{className:"mt-1.5 flex items-center gap-1 text-muted-foreground/80",children:[o.jsx(pt,{className:"size-3 animate-spin"})," Working in the dock…"]}):null]})]})}function LK(e){return e.detected.name==="codex"?e.agents.codex:e.agents["claude-code"]??e}function zK(e){return e?{skills:Bc(e.skills.map(t=>t.name)),mcpServers:Bc(e.mcpServers.map(t=>t.name)),plugins:Bc(e.plugins.map(t=>t.name)),hooks:Bc(e.hooks.map(t=>t.matcher?`${t.event}: ${t.matcher}`:t.event))}:{skills:[],mcpServers:[],plugins:[],hooks:[]}}function BK(e){return{id:Gx("custom-workflow",e),name:"Custom workflow",description:"A user-built workflow.",builtin:!1,steps:[{kind:"gate",id:"gate-start",title:"Approve start",message:"Run this workflow?"}]}}function IK(e){const t=rl(e.id)||e.kind,s=e.title.trim()||Wx(e);if(e.kind==="gate")return{...e,id:t,title:s,message:e.message.trim()||"Continue?"};if(e.kind==="action")return{...e,id:t,title:s};const i=nT(e.capabilities);return{...e,id:t,title:s,prompt:e.prompt.trim()||"Complete this workflow step.",capabilities:i}}function PK(e){return e.kind==="gate"?e.message:e.kind==="agent"?e.prompt:e.op==="push"?"Push the current branch to its remote.":"Stage and commit changed files."}function $K(e,t){return e.kind==="gate"?{...e,message:t}:e.kind==="agent"?{...e,prompt:t}:{...e,op:/\bpush\b/i.test(t)?"push":/\bcommit\b/i.test(t)?"commit":e.op,title:t.trim()||e.title}}function nT(e){if(!e)return;const t={};for(const s of["skills","mcpServers","plugins","hooks"]){const i=Bc((e[s]??[]).map(a=>a.trim()).filter(Boolean));i.length&&(t[s]=i)}return Object.keys(t).length?t:void 0}function HK(e,t,s){const i=e?.[t]??[],a=i.includes(s)?i.filter(l=>l!==s):[...i,s];return nT({...e??{},[t]:a})}function Gx(e,t){const s=new Set(t.map(l=>l.id));let i=rl(e)||"workflow",a=2;for(;s.has(i);)i=`${rl(e)||"workflow"}-${a}`,a++;return i}function rl(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Bc(e){return Array.from(new Set(e.filter(Boolean)))}function Qa({children:e}){return o.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:e})}function UK({outcome:e}){const t={running:{label:"Running",className:"border-primary/40 text-primary"},done:{label:"Done",className:"border-emerald-500/40 text-emerald-600 dark:text-emerald-400"},stopped:{label:"Stopped",className:"border-border text-muted-foreground"},failed:{label:"Failed",className:"border-destructive/40 text-destructive"},blocked:{label:"Needs you",className:"border-amber-500/40 text-amber-700 dark:text-amber-400"}},{label:s,className:i}=t[e];return o.jsx("span",{className:le("rounded-full border px-2 py-0.5 text-[10px] font-medium",i),children:s})}function FK({kind:e}){return e==="gate"?o.jsx(EC,{className:"size-4 text-amber-600 dark:text-amber-400"}):e==="agent"?o.jsx(zi,{className:"size-4 text-primary"}):o.jsx(eo,{className:"size-4 text-muted-foreground"})}function qK({status:e,kind:t}){return e==="running"?o.jsx(pt,{className:"size-4 shrink-0 animate-spin text-primary"}):e==="waiting"?o.jsx(EC,{className:"size-4 shrink-0 text-primary"}):e==="done"?o.jsx(hi,{className:"size-4 shrink-0 text-emerald-600 dark:text-emerald-400"}):e==="blocked"?o.jsx(GA,{className:"size-4 shrink-0 text-amber-600 dark:text-amber-400"}):e==="failed"?o.jsx(cu,{className:"size-4 shrink-0 text-destructive"}):e==="skipped"?o.jsx(TC,{className:"size-4 shrink-0 text-muted-foreground/60"}):t==="agent"?o.jsx(zi,{className:"size-4 shrink-0 text-muted-foreground/50"}):o.jsx(YA,{className:"size-4 shrink-0 text-muted-foreground/50"})}function VK(e){return o.jsx(Li,{className:"size-3 shrink-0 text-muted-foreground/40","aria-hidden":!0})}function iT({kind:e}){const t=e==="agent"?"AI":e==="gate"?"Gate":"Auto",s=e==="agent"?"border-primary/30 text-primary":e==="gate"?"border-amber-500/40 text-amber-600 dark:text-amber-400":"border-border text-muted-foreground";return o.jsx("span",{className:le("shrink-0 rounded-full border px-1.5 py-px text-[9px] uppercase tracking-wide",s),children:t})}function Wx(e){return e.title}function GK({data:e,onRefresh:t}){const{insertPath:s}=Bt(),[i,a]=y.useState(!1),[l,u]=y.useState("changes"),[h,m]=y.useState("changes"),[d,p]=y.useState(e.git.status?.files[0]?.path??""),[g,v]=y.useState(""),[_,S]=y.useState([]),[w,C]=y.useState(null),[E,T]=y.useState(""),[N,j]=y.useState(null),[R,z]=y.useState(0),[D,M]=y.useState(null),[$,L]=y.useState(()=>new Set),B=e.git.status?.files??[],P=y.useMemo(()=>{const ge=new Set(B.map(Ae=>Ae.path)),Te=[...$].filter(Ae=>!ge.has(Ae)).sort().map(Ae=>({path:Ae,index:" ",workingTree:"M"}));return[...B,...Te]},[B,$]),F=y.useMemo(()=>P.map(ge=>ge.path),[P]),V=y.useMemo(()=>eq(E),[E]),G=y.useCallback(async(ge,Te)=>{if(Te.length){a(!0);try{await ge(Te),t?.()}finally{a(!1)}}},[t]),I=t?{busy:i,onStage:ge=>{G(LC,ge)},onUnstage:ge=>{G(G6,ge)}}:void 0;y.useEffect(()=>{const ge=P[0]?.path??"";p(Te=>Te&&P.some(Ae=>Ae.path===Te)?Te:ge)},[P]),y.useEffect(()=>{if(l!=="all"||_.length>0)return;let ge=!0;return C(null),H6().then(Te=>{ge&&S(Te)}).catch(Te=>{ge&&C(Te instanceof Error?Te.message:String(Te))}),()=>{ge=!1}},[l,_.length]),y.useEffect(()=>{if(!d){T("");return}let ge=!0;return j(null),V6(d).then(Te=>{ge&&(T(Te),z(0),M(null))}).catch(Te=>{ge&&j(Te instanceof Error?Te.message:String(Te))}),()=>{ge=!1}},[d]);function Y(ge){z(0),M(null),p(ge)}function X(){const ge=jW({activeHunkIndex:R,filePaths:F,hunkCount:V.hunks,pendingNextFilePath:D,selectedFile:d});ge.kind==="hunk"?(M(null),z(ge.activeHunkIndex)):ge.kind==="confirm-next-file"?M(ge.filePath):ge.kind==="file"?Y(ge.filePath):M(null)}function W(){if(M(null),R>0){z(Ae=>Ae-1);return}const ge=P.findIndex(Ae=>Ae.path===d),Te=P[ge-1];Te&&Y(Te.path)}const ee=P.findIndex(ge=>ge.path===d),O=!!(V.hunks&&R<V.hunks-1||P[ee+1]),Z=!!(R>0||P[ee-1]),ie=D?`End of file. Click Next again to open ${D}.`:null,de=ge=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${ge?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,fe=ge=>`flex-1 px-2 py-0.5 text-[11px] font-medium transition-colors ${ge?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,pe=y.useMemo(()=>{const ge=new Set(P.map(Te=>Te.path));for(const Te of $)ge.add(Te);return ge},[P,$]);if(!e.git.selectedRepository)return o.jsx(WK,{});function Se(){g&&(u("changes"),m("changes"),Y(g))}function Le(ge){L(Te=>new Set(Te).add(ge)),v(ge),u("changes"),m("changes"),Y(ge)}function ve(ge){v(ge),u("all")}function Ge(ge){ge&&s(bu(e.git.cwd,ge))}return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[o.jsx("button",{type:"button",className:de(l==="changes"),onClick:()=>u("changes"),children:"Changes"}),o.jsx("button",{type:"button","aria-label":"Open all tracked files",className:de(l==="all"),onClick:()=>u("all"),children:"All files"}),o.jsx("button",{type:"button",className:de(l==="graph"),onClick:()=>u("graph"),children:"Tree"}),o.jsx("button",{type:"button",className:de(l==="largest"),onClick:()=>u("largest"),children:"Largest files"}),o.jsx("button",{type:"button",className:de(l==="github"),onClick:()=>u("github"),children:o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(tT,{className:"size-3"}),"GitHub"]})}),o.jsx("button",{type:"button",className:de(l==="workflows"),onClick:()=>u("workflows"),children:o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(Gt,{className:"size-3"}),"Workflows"]})})]}),o.jsx("div",{className:"min-h-0 flex-1",children:l==="workflows"?o.jsx(wK,{}):l==="github"?o.jsx(gK,{}):l==="graph"?o.jsx(FW,{branches:e.git.branches??[]}):l==="largest"?o.jsx(XW,{onOpenFile:ve,root:e.git.cwd}):l==="all"?o.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[o.jsx("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:w?o.jsx(Qe,{variant:"destructive",className:"m-3",children:w}):o.jsx(U2,{branch:e.git.status?.branch||void 0,onSelectFile:v,paths:_,root:e.git.cwd,selectedFile:g,status:P})}),o.jsx(TW,{isModified:pe.has(g),onFileSaved:Le,onSendToAi:()=>Ge(g),onViewDiff:Se,path:g})]}):o.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[o.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 gap-0.5 border-b border-border bg-card/95 p-1",children:[o.jsx("button",{"aria-label":"Show changed files as a list",className:fe(h==="changes"),onClick:()=>m("changes"),type:"button",children:"Changes"}),o.jsx("button",{"aria-label":"Show changed files as a tree",className:fe(h==="tree"),onClick:()=>m("tree"),type:"button",children:"Tree"})]}),h==="changes"?o.jsx(iq,{branch:e.git.status?.branch||void 0,error:e.git.error,files:P,selectedFile:d,onSelectFile:Y,root:e.git.cwd,staging:I}):o.jsx(U2,{branch:e.git.status?.branch||void 0,defaultExpandAll:!0,emptyMessage:e.git.error??"No changed files.",onSelectFile:Y,paths:F,root:e.git.cwd,selectedFile:d,status:P,title:"Changes"}),t&&e.git.status?o.jsx(cq,{branch:e.git.status.branch||void 0,files:P,onDone:t}):null]}),o.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:d||"Diff"}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[o.jsx("span",{children:"Long rows wrap inside the editor pane."}),V.additions||V.deletions?o.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[o.jsxs("span",{className:"text-emerald-700",children:["+",V.additions]}),o.jsxs("span",{className:"text-red-700",children:["-",V.deletions]})]}):null]})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[ie?o.jsx("span",{className:"max-w-72 truncate rounded border border-amber-200 bg-amber-50 px-2 py-1 text-[11px] text-amber-900",children:ie}):null,o.jsxs(se,{disabled:!d||!Z,onClick:W,size:"sm",type:"button",variant:"outline",children:[o.jsx(Ab,{}),"Previous"]}),o.jsxs(se,{disabled:!d||!O,onClick:X,size:"sm",type:"button",variant:"outline",children:[o.jsx(jb,{}),"Next"]}),o.jsx(se,{"aria-label":"Send selected file to AI input",className:"size-8",disabled:!d,onClick:()=>Ge(d),size:"icon",title:"Send selected file path to AI input",type:"button",variant:"outline",children:o.jsx(Gt,{className:"size-4"})})]})]}),o.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:N?o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"destructive",children:N})}):d?o.jsx(Bx,{activeHunkIndex:R,diff:E||"No unstaged diff for this file."}):o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a changed file to inspect its diff."})})})]})]})})]})}function WK(){return o.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:o.jsxs("div",{className:"max-w-sm",children:[o.jsx(C4,{className:"mx-auto size-8 text-muted-foreground/50"}),o.jsx("p",{className:"mt-3 text-sm font-medium",children:"No Git project registered"}),o.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Add a folder that is a Git worktree to review changes, browse files, and inspect history. Use the project picker in the header to add one."})]})})}function KK({initialPath:e,onSelect:t,selectedPath:s}){const[i,a]=y.useState(e),[l,u]=y.useState(null),[h,m]=y.useState(null),[d,p]=y.useState(!1),g=YK(l);return y.useEffect(()=>{a(e)},[e]),y.useEffect(()=>{let v=!0;return p(!0),m(null),IC(i).then(_=>{v&&(u(_),t(_.path))}).catch(_=>{v&&m(_ instanceof Error?_.message:String(_))}).finally(()=>{v&&p(!1)}),()=>{v=!1}},[i,t]),o.jsxs("div",{className:"rounded-md border border-border bg-background",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[g?o.jsx(se,{"aria-label":"Open parent folder",onClick:()=>l&&a(l.parent),size:"icon",type:"button",variant:"ghost",children:o.jsx(Mn,{className:"rotate-90"})}):null,o.jsx("div",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:l?.path??i}),d?o.jsx(pt,{className:"size-4 animate-spin text-muted-foreground"}):null]}),o.jsxs("div",{className:"max-h-56 overflow-auto p-1",children:[h?o.jsx(Qe,{variant:"destructive",className:"m-1",children:h}):null,!h&&l?.entries.length===0?o.jsx(Qe,{variant:"muted",className:"m-1 text-center",children:"No folders here."}):null,l?.entries.map(v=>o.jsxs(se,{className:le("h-8 w-full justify-start rounded-sm px-2 text-left",s===v.path&&"bg-muted"),onClick:()=>a(v.path),title:v.path,type:"button",variant:"ghost",children:[o.jsx(Ja,{className:"text-accent"}),o.jsx("span",{className:"truncate",children:v.name})]},v.path))]})]})}function YK(e){return!!(e&&e.parent!==e.path)}function tC(e){return e.split(/[\\/]/).filter(Boolean).pop()??"project"}function XK({data:e,onRefresh:t}){const[s,i]=y.useState(!1),[a,l]=y.useState(e.git.cwd),[u,h]=y.useState(null),[m,d]=y.useState(!1),[p,g]=y.useState(e.git.cwd),v=y.useRef(null),_=e.git.selectedRepository,S=_?.name??(e.git.cwd?tC(e.git.cwd):"Add Git project"),{error:w,success:C}=Ns(),E=QK({gitCwd:e.git.cwd});y.useEffect(()=>{l(e.git.cwd),g(e.git.cwd)},[e.git.cwd]),y.useEffect(()=>{if(!s)return;function D(M){v.current&&M.target instanceof Node&&!v.current.contains(M.target)&&i(!1)}return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[s]);async function T(D){try{await mn("/api/git/select",{name:D}),i(!1),await t(),C(`Switched to ${D}.`)}catch(M){w(M instanceof Error?M.message:String(M))}}async function N(D){const M=D.trim();if(!ZK(M)){const $="Please add an absolute path. Paths beginning with ~ are not expanded here.";return h($),w($),!1}try{const $=tC(M);return await mn("/api/git/repositories",{name:$,path:M}),h(null),await t(),C(`Added Git project ${$}.`),!0}catch($){const L=$ instanceof Error?$.message:String($);return h(L),w(L),!1}}async function j(D){try{await W6(D),await t(),C(`Removed Git project ${D}.`)}catch(M){w(M instanceof Error?M.message:String(M))}}async function R(D){D.preventDefault(),await N(a)&&i(!1)}function z(){h(null),g(E.selectedPath),d(!0)}return o.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:v,children:[o.jsxs(se,{className:"max-w-[220px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>i(D=>!D),size:"sm",type:"button",variant:"outline",children:[o.jsx(Ja,{className:"text-muted-foreground"}),o.jsx("span",{className:"truncate",children:S}),o.jsx(Mn,{className:le("ml-auto transition-transform",s&&"rotate-180")})]}),o.jsx(se,{"aria-label":"Add Git project",onClick:z,size:"sm",type:"button",variant:"outline",children:o.jsx(Cs,{})}),s?o.jsxs("div",{className:"absolute right-0 top-10 z-50 w-[min(380px,calc(100vw-2rem))] overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[o.jsx(d4,{className:"size-3.5 text-muted-foreground"}),o.jsx("div",{className:"text-xs font-semibold",children:"Git Projects"}),o.jsx(Pe,{className:"ml-auto h-5 px-1.5 text-[10px]",variant:"outline",children:e.config.gitRepositories.length})]}),o.jsx("div",{className:"max-h-72 overflow-auto",children:e.config.gitRepositories.length?o.jsx("div",{className:"divide-y divide-border",children:e.config.gitRepositories.map(D=>{const M=D.name===_?.name;return o.jsxs("div",{className:le("group grid w-full grid-cols-[1fr_auto_auto] items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted",M&&"bg-muted/70"),children:[o.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{T(D.name)},type:"button",children:[o.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:D.name}),o.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:D.path})]}),M?o.jsx(hi,{className:"size-3.5"}):o.jsx("span",{className:"size-3.5"}),o.jsx(se,{"aria-label":`Remove ${D.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{j(D.name)},size:"icon",title:`Remove ${D.name}`,type:"button",variant:"ghost",children:o.jsx(ua,{className:"size-3.5 text-destructive"})})]},D.name)})}):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No saved Git projects yet."})}),o.jsxs("div",{className:"border-t border-border bg-muted/20 p-2",children:[o.jsxs("form",{className:"flex gap-1.5",onSubmit:R,children:[o.jsx(nt,{"aria-label":"Paste absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:D=>{l(D.target.value),h(null)},placeholder:"/absolute/path",value:a}),o.jsxs(se,{className:"h-7 px-2 text-[11px]",size:"sm",type:"submit",children:[o.jsx(Cs,{className:"size-3"}),"Add"]}),o.jsx(se,{"aria-label":"Browse and add Git project",className:"h-7 px-2",onClick:z,size:"sm",type:"button",variant:"outline",children:o.jsx(T4,{className:"size-3"})})]}),u?o.jsx("div",{className:"mt-1.5 truncate text-[10px] text-destructive",children:u}):null]})]}):null,m?o.jsx(JK,{confirmLabel:E.confirmLabel,errorMessage:u,initialPath:E.initialPath,selectedPath:p,title:"Add Git Project",onCancel:()=>d(!1),onSelect:g,onUse:async()=>{await N(p)&&(d(!1),i(!1))}}):null]})}function ZK(e){return e.startsWith("/")}function QK({gitCwd:e}){return{confirmLabel:"Add Git project",initialPath:e,selectedPath:e}}function JK({confirmLabel:e="Use this folder",errorMessage:t,initialPath:s,onCancel:i,onSelect:a,onUse:l,selectedPath:u,title:h="Choose Git Project Folder"}){return gu.createPortal(o.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",children:o.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-border bg-card p-4 shadow-xl",children:[o.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[o.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg border border-border bg-background",children:o.jsx(Ja,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"text-sm font-semibold",children:h}),o.jsx("div",{className:"truncate font-mono text-xs text-muted-foreground",children:u})]}),o.jsx(se,{"aria-label":"Close folder picker",onClick:i,size:"icon",variant:"ghost",children:o.jsx(Gs,{})})]}),o.jsx(KK,{initialPath:s,onSelect:a,selectedPath:u}),t?o.jsx("div",{className:"mt-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:t}):null,o.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[o.jsx(se,{onClick:i,type:"button",variant:"outline",children:"Cancel"}),o.jsx(se,{onClick:()=>{l()},type:"button",children:e})]})]})}),document.body)}function eY({ahead:e=0,behind:t=0,branches:s,currentBranch:i,disabled:a,onRefresh:l,upstream:u}){const[h,m]=y.useState(!1),[d,p]=y.useState(""),[g,v]=y.useState(null),[_,S]=y.useState(null),[w,C]=y.useState(null),E=s.filter($=>!$.remote),T=s.filter($=>$.remote);async function N($,L){v($),C(null),S(null);try{await L(),await l()}catch(B){C(B instanceof Error?B.message:String(B))}finally{v(null)}}async function j($){await N(`switch:${$}`,async()=>{await mn("/api/git/branches/switch",{name:$}),m(!1)})}async function R(){await N("fetch",async()=>{await mn("/api/git/fetch",{}),S("Fetched latest branch refs.")})}async function z(){await N("push",async()=>{const $=await of();S($.setUpstream?`Pushed ${$.branch} and set upstream.`:`Pushed ${$.branch}.`)})}const D=!!i&&(e>0||!u&&t===0);async function M($){$.preventDefault();const L=d.trim();if(!L){C("Branch name is required.");return}await N("create",async()=>{await mn("/api/git/branches",{name:L}),p(""),m(!1)})}return o.jsxs("div",{className:"fixed bottom-12 right-4 z-50 flex items-end",children:[h?o.jsxs("div",{"aria-label":"Switch Git branch",className:"mb-11 w-[min(460px,calc(100vw-2rem))] rounded-lg border border-border bg-card shadow-xl",role:"dialog",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border p-3",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(pn,{className:"size-4 text-muted-foreground"}),o.jsx("span",{className:"truncate text-sm font-semibold",children:i||"Branches"})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[D?o.jsxs(se,{"aria-label":"Push current branch",className:"gap-1.5 px-2 text-xs",disabled:a||g!==null,onClick:()=>{z()},size:"sm",title:u?`Push ${e} commit${e===1?"":"s"} to ${u}`:"Push and set upstream",type:"button",variant:"default",children:[o.jsx(Lb,{className:le("size-3.5",g==="push"&&"animate-pulse")}),"Push",e>0?` ${e}`:""]}):null,o.jsx(se,{"aria-label":"Fetch branches",disabled:a||g!==null,onClick:()=>{R()},size:"icon",title:"Fetch branches",type:"button",variant:"ghost",children:o.jsx(ou,{className:le(g==="fetch"&&"animate-spin")})}),o.jsx(se,{"aria-label":"Close branch dialog",onClick:()=>m(!1),size:"icon",type:"button",variant:"ghost",children:o.jsx(Gs,{})})]})]}),o.jsx("div",{className:"max-h-72 overflow-auto",children:s.length?o.jsxs(o.Fragment,{children:[o.jsx(sC,{branches:E,busy:g!==null,disabled:a,label:"Local",onSwitch:j}),o.jsx(sC,{branches:T,busy:g!==null,disabled:a,label:"Remote",onSwitch:j})]}):o.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No branches found."})}),o.jsxs("div",{className:"border-t border-border p-3",children:[o.jsxs("form",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",onSubmit:M,children:[o.jsx(nt,{"aria-label":"New branch name",disabled:a||g!==null,onChange:$=>{p($.target.value),C(null),S(null)},placeholder:"feature/new-work",value:d}),o.jsxs(se,{disabled:a||g!==null,type:"submit",children:[o.jsx(H4,{}),"Create"]})]}),w||_?o.jsx(Qe,{className:"mt-3 px-3 py-2 text-xs",variant:w?"destructive":"muted",children:w??_}):null]})]}):null,o.jsxs(se,{className:"h-8 max-w-[260px] gap-2 rounded-md shadow-lg",disabled:a,onClick:()=>m($=>!$),size:"sm",title:"Switch Git branch",type:"button",variant:"default",children:[o.jsx(pn,{className:"size-4"}),o.jsx("span",{className:"truncate font-mono text-xs",children:i||"No branch"}),i&&(e>0||t>0)?o.jsxs("span",{className:"flex items-center gap-1 font-mono text-[11px] tabular-nums",title:u?`${e} ahead / ${t} behind ${u}`:`${e} ahead / ${t} behind`,children:[t>0?o.jsxs("span",{className:"flex items-center",children:[o.jsx(jb,{className:"size-3"}),t]}):null,e>0?o.jsxs("span",{className:"flex items-center",children:[o.jsx(Ab,{className:"size-3"}),e]}):null]}):null,o.jsx(Mn,{className:le("size-4 transition-transform",h&&"rotate-180")})]})]})}function sC({branches:e,busy:t,disabled:s,label:i,onSwitch:a}){return o.jsxs("section",{children:[o.jsx("div",{className:"border-b border-border bg-muted/60 px-3 py-1.5 text-[11px] font-semibold uppercase text-muted-foreground",children:i}),e.length?e.map(l=>o.jsxs("button",{className:le("grid w-full grid-cols-[1fr_auto] items-center gap-2 border-b border-border px-3 py-2 text-left text-sm last:border-b-0 hover:bg-muted",l.current&&"bg-muted/70"),disabled:s||t||l.current,onClick:()=>{a(l.name)},type:"button",children:[o.jsxs("span",{className:"min-w-0",children:[o.jsx("span",{className:"block truncate font-medium",children:l.name}),l.upstream?o.jsxs("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:["tracks ",l.upstream]}):null]}),o.jsx(Pe,{variant:l.current?"success":l.remote?"outline":"secondary",children:l.current?"current":l.remote?"remote":"local"})]},`${l.remote?"remote":"local"}:${l.name}`)):o.jsxs("div",{className:"border-b border-border px-3 py-3 text-sm text-muted-foreground",children:["No ",i.toLowerCase()," branches."]})]})}const rT="nomoreide-theme-choice";function tY(){if(typeof window>"u")return"dark";const e=window.localStorage.getItem(rT);return e==="light"||e==="dark"?e:"dark"}function sY(e){const t=document.documentElement;t.classList.toggle("dark",e==="dark"),t.style.colorScheme=e}function nY(){const[e,t]=y.useState(()=>tY()),s=y.useRef(null);y.useEffect(()=>{sY(e),window.localStorage.setItem(rT,e)},[e]);const i=y.useCallback(()=>{const a=e==="dark"?"light":"dark",l=s.current,u=document;if(!l||!u.startViewTransition||window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(a);return}const h=l.getBoundingClientRect(),m=h.left+h.width/2,d=h.top+h.height/2,p=Math.hypot(Math.max(m,window.innerWidth-m),Math.max(d,window.innerHeight-d));u.startViewTransition(()=>{t(a)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${m}px ${d}px)`,`circle(${p}px at ${m}px ${d}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},[e]);return o.jsxs("button",{ref:s,onClick:i,title:e==="dark"?"Switch to light mode":"Switch to dark mode","aria-label":"Toggle theme",className:zh(),children:[o.jsx("span",{className:Bh(),children:e==="dark"?o.jsx(a6,{}):o.jsx(xM,{})}),o.jsx("span",{className:Ih(),children:"Theme"})]})}function iY(e=!1){return le("group/sidebar hidden h-full shrink-0 overflow-x-hidden overflow-y-auto border-r border-border bg-card/85 py-5 backdrop-blur transition-[width,padding] duration-200 md:flex md:flex-col",e?"w-64 px-4":"w-16 px-2 hover:w-64 hover:px-4")}function rY(e,t=!1){return le("relative grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center justify-start gap-0 overflow-hidden rounded-md px-0 text-[15px] font-medium transition-[background-color,color,width] duration-150",t?"w-full":"w-12 group-hover/sidebar:w-full",e?"bg-primary text-primary-foreground hover:bg-primary/90":"hover:bg-muted")}function aY(e=!1,t=!1){return le("min-w-0 overflow-hidden text-left text-current transition duration-150 whitespace-pre",e?"translate-x-1 opacity-100":"opacity-0 group-hover/sidebar:translate-x-1 group-hover/sidebar:opacity-100",t?"pr-10":"pr-3")}function oY(e=!1){return le("flex size-12 items-center justify-center text-current transition-transform duration-150 [&_svg]:size-5",e?"translate-x-0":"-translate-x-px group-hover/sidebar:translate-x-0")}function lY({docked:e,onToggleDock:t}){return o.jsxs("div",{className:le("mt-auto flex h-10 min-w-0 items-center overflow-hidden border-t border-border/60 text-[11px] text-muted-foreground transition-[height,opacity,width] duration-150",e?"w-full justify-start opacity-100":"w-12 justify-center group-hover/sidebar:w-full group-hover/sidebar:justify-start group-hover/sidebar:opacity-100"),children:[o.jsxs("span",{className:le("flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-pre transition-[opacity,width] duration-150",e?"flex-1 opacity-100":"w-0 flex-none opacity-0 group-hover/sidebar:w-auto group-hover/sidebar:flex-1 group-hover/sidebar:opacity-100"),children:[o.jsx("span",{children:"Made with"}),o.jsx(V4,{"aria-label":"love",className:"size-3 shrink-0 fill-red-500 text-red-500"}),o.jsx("span",{children:"by Robert Wang"}),o.jsx("a",{"aria-label":"Robert Wang on LinkedIn",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-[#0A66C2]",href:"https://www.linkedin.com/in/robert-wang-cs/",rel:"noopener noreferrer",target:"_blank",title:"LinkedIn",children:o.jsx("svg",{"aria-hidden":!0,className:"size-3 fill-current",role:"img",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.063 2.063 0 1 1 0-4.126 2.063 2.063 0 0 1 0 4.126zM7.119 20.452H3.554V9h3.565v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.225 0z"})})})]}),o.jsx("button",{"aria-label":e?"Undock sidebar":"Dock sidebar","aria-pressed":e,className:le("flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-4",e?"ml-auto bg-muted text-foreground":"group-hover/sidebar:ml-auto"),onClick:t,title:e?"Undock sidebar":"Dock sidebar",type:"button",children:e?o.jsx(kM,{}):o.jsx(NM,{})})]})}function cY({className:e}){return o.jsxs("div",{className:le("min-w-0",e),children:[o.jsxs("div",{className:"flex items-baseline gap-1.5",children:[o.jsx("div",{className:"text-sm font-semibold",children:"NoMoreIDE"}),o.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:["v","0.1.50"]})]}),o.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:"127.0.0.1 console"})]})}function uY({syncLocation:e=!0}={}){const[t,s]=y.useState(()=>e?window.location.pathname.startsWith("/agent")?"agent":window.location.pathname.startsWith("/errors")?"errors":window.location.pathname.startsWith("/database")?"database":window.location.pathname.startsWith("/terminal")?"terminal":window.location.pathname.startsWith("/git")?"git":"services":"services"),[i,a]=y.useState(null),[l,u]=y.useState(null),[h,m]=y.useState(null),[d,p]=y.useState(null),[g,v]=y.useState(!0),{error:_,success:S}=Ns(),[w,C]=y.useState(()=>window.localStorage.getItem("nomoreide:sidebar-docked")==="true"),E=y.useCallback(async(N={})=>{N.silent||v(!0),p(null);try{a(await fR()),N.notify&&S("Dashboard refreshed.")}catch(j){const R=j instanceof Error?j.message:String(j);p(R),_(R)}finally{v(!1)}},[_,S]);y.useEffect(()=>{E()},[E]),y.useEffect(()=>{function N(){document.visibilityState==="visible"&&E({silent:!0})}const j=window.setInterval(N,5e3);return window.addEventListener("focus",N),document.addEventListener("visibilitychange",N),()=>{window.clearInterval(j),window.removeEventListener("focus",N),document.removeEventListener("visibilitychange",N)}},[t,E]),y.useEffect(()=>{if(!e)return;const N=t==="git"?"/git":t==="agent"?"/agent":t==="errors"?"/errors":t==="database"?"/database":t==="terminal"?"/terminal":"/";window.location.pathname!==N&&window.history.pushState(null,"",N)},[t,e]),y.useEffect(()=>{window.localStorage.setItem("nomoreide:sidebar-docked",String(w))},[w]);const T=y.useMemo(()=>i?Object.values(i.runtime.services).filter(N=>N.state==="running").length:0,[i]);return o.jsx(k9,{children:o.jsx(_B,{onRefresh:()=>{E({silent:!0})},children:o.jsxs("div",{className:"h-screen overflow-hidden pb-9",children:[o.jsxs("div",{className:"mx-auto flex h-full max-w-[1500px]",children:[o.jsxs("aside",{className:iY(w),children:[o.jsxs("div",{className:le("grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden transition-[width] duration-150",w?"w-full":"w-12 group-hover/sidebar:w-full"),children:[o.jsx("div",{className:"flex size-12 items-center justify-center",children:o.jsx("div",{className:"flex size-9 items-center justify-center overflow-hidden rounded-md bg-primary text-primary-foreground",children:o.jsxs("svg",{"aria-label":"NoMoreIDE",className:"size-6",fill:"none",role:"img",viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M5 17C5 13.69 7.69 11 11 11H25L31 17H53C56.31 17 59 19.69 59 23V53C59 56.31 56.31 59 53 59H11C7.69 59 5 56.31 5 53V17Z",fill:"currentColor"}),o.jsx("path",{d:"M22 31L30 39L22 47",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"4.5"}),o.jsx("path",{d:"M36 47H48",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeWidth:"4.5"})]})})}),o.jsx(cY,{className:le("min-w-0 translate-x-1 overflow-hidden transition-opacity duration-200",w?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100")})]}),o.jsxs("nav",{className:"mt-5 grid flex-1 content-start gap-1",children:[o.jsx(Yo,{active:t==="services",badge:T,docked:w,icon:o.jsx(CC,{}),label:"Services",onClick:()=>s("services")}),o.jsx(Yo,{active:t==="git",docked:w,icon:o.jsx(pn,{}),label:"Git Review",onClick:()=>s("git")}),o.jsx(Yo,{active:t==="errors",docked:w,icon:o.jsx(Ch,{}),label:"Error Inbox",onClick:()=>s("errors")}),o.jsx(Yo,{active:t==="database",docked:w,icon:o.jsx(Xn,{}),label:"Database",onClick:()=>s("database")}),o.jsx(Yo,{active:t==="terminal",docked:w,icon:o.jsx(n6,{}),label:"Terminal",onClick:()=>s("terminal")}),o.jsx(Yo,{active:t==="agent",docked:w,icon:o.jsx(RA,{}),label:"Agent",onClick:()=>s("agent")})]}),o.jsx(lY,{docked:w,onToggleDock:()=>C(N=>!N)})]}),o.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col px-0 py-0",children:[o.jsxs("header",{className:le("relative z-40 flex shrink-0 flex-wrap items-center justify-between gap-3 border border-border bg-card/90 px-4 py-3 backdrop-blur","border-x-0 border-t-0 border-b"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(TM,{className:"size-4 text-muted-foreground md:hidden"}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:t==="git"?"Git Review":t==="agent"?"Agent":t==="errors"?"Error Inbox":t==="database"?"Database":t==="terminal"?"Terminal":"Services"}),o.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:i?.git.selectedRepository?.name??i?.git.cwd??"Local workspace"})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[d?o.jsx(Pe,{variant:"danger",children:d}):null,i&&t==="git"?o.jsx(XK,{data:i,onRefresh:E}):null,o.jsxs("div",{"aria-label":"Dashboard quick actions",className:"flex items-center gap-1 rounded-lg border border-border bg-background p-px",role:"group",children:[o.jsxs("button",{"aria-label":"Refresh dashboard",className:zh(),onClick:()=>{E({notify:!0})},title:"Refresh dashboard",type:"button",children:[o.jsx("span",{className:Bh(),children:o.jsx(ou,{className:le(g&&"animate-spin")})}),o.jsx("span",{className:Ih(),children:"Refresh"})]}),o.jsx(nY,{}),o.jsxs("a",{"aria-label":"Open NoMoreIDE documentation",className:zh(),href:"https://www.nomoreide.com/docs",rel:"noreferrer",target:"_blank",title:"Open NoMoreIDE documentation",children:[o.jsx("span",{className:Bh(),children:o.jsx(AA,{})}),o.jsx("span",{className:Ih(),children:"Docs"})]}),i?o.jsx(cB,{data:i}):null]})]})]}),i?o.jsx(GF,{data:i,onOpenService:N=>{u(N),s("services"),E({silent:!0})}}):null,g&&!i?o.jsx(Qe,{variant:"muted",children:"Loading NoMoreIDE state..."}):null,o.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[i&&t==="services"?o.jsx(FF,{data:i,onRefresh:E,focusService:l,onServiceFocused:()=>u(null)}):null,i&&t==="git"?o.jsx(GK,{data:i,onRefresh:()=>{E({silent:!0})}}):null,t==="agent"?o.jsx(Pz,{}):null,t==="errors"?o.jsx(kP,{}):null,t==="database"?o.jsx(xP,{staged:h,onStageConsumed:()=>m(null)}):null,t==="terminal"?o.jsx(QF,{}):null]})]})]}),i&&t==="git"?o.jsx(eY,{ahead:i.git.status?.ahead??0,behind:i.git.status?.behind??0,branches:i.git.branches,currentBranch:i.git.status?.branch||void 0,disabled:!i.git.status,onRefresh:E,upstream:i.git.status?.upstream}):null,o.jsx(II,{git:i?.git,onGitRefresh:()=>{E({silent:!0})},onOpenAgentPage:t==="agent"?void 0:()=>s("agent"),onOpenService:N=>{u(N),s("services"),E({silent:!0})},onOpenSqlConsole:(N,j)=>{m(R=>({connection:N,sql:j,nonce:(R?.nonce??0)+1})),s("database")}})]})})})}function Yo({active:e,badge:t,docked:s,icon:i,label:a,onClick:l}){const u=t!==void 0&&t>0;return o.jsxs(se,{"aria-label":a,title:a,className:rY(e,s),variant:"ghost",onClick:l,type:"button",children:[o.jsx("span",{className:oY(s),children:i}),o.jsx("span",{className:aY(s,u),children:a}),t!==void 0&&t>0?o.jsx(Pe,{appearance:t>0?"solid":"outline",className:le("min-w-6 justify-center px-1.5 font-mono shadow-none",e?"border-primary-foreground/40 bg-primary-foreground/15 text-primary-foreground dark:border-primary-foreground/40 dark:bg-primary-foreground/15 dark:text-primary-foreground":t>0?"":"border-border bg-background text-muted-foreground","absolute right-1.5 top-1.5 h-4 min-w-4 rounded-full px-1 text-[10px] leading-none shadow-none group-hover/sidebar:right-2 group-hover/sidebar:top-1/2 group-hover/sidebar:-translate-y-1/2 group-hover/sidebar:text-xs",s&&"right-2 top-1/2 -translate-y-1/2 text-xs"),size:"small",variant:t>0?"success":"outline",children:t}):null]})}iC.createRoot(document.getElementById("root")).render(o.jsx(y.StrictMode,{children:o.jsx(uY,{})}));export{o as j,y as r};
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
})();
|
|
20
20
|
</script>
|
|
21
|
-
<script type="module" crossorigin src="/assets/index-
|
|
21
|
+
<script type="module" crossorigin src="/assets/index-BEojL6wP.js"></script>
|
|
22
22
|
<link rel="stylesheet" crossorigin href="/assets/index-vGzOmeUL.css">
|
|
23
23
|
</head>
|
|
24
24
|
<body>
|