diff --git a/Cargo.lock b/Cargo.lock index 3e4378b5..72e0bca7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1505,7 +1505,7 @@ dependencies = [ [[package]] name = "nightcrow" -version = "0.1.28" +version = "0.1.29" dependencies = [ "aes-gcm", "alacritty_terminal", @@ -1546,7 +1546,7 @@ dependencies = [ [[package]] name = "nightcrow-memory" -version = "0.1.28" +version = "0.1.29" dependencies = [ "anyhow", "rusqlite", @@ -1557,7 +1557,7 @@ dependencies = [ [[package]] name = "nightcrow-recovery" -version = "0.1.28" +version = "0.1.29" dependencies = [ "anyhow", "serde", diff --git a/Cargo.toml b/Cargo.toml index 8ad84f27..e4a39254 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ members = [".", "plugins/nightcrow-recovery", "plugins/nightcrow-memory"] # was never built at — a class of drift the release check could only report # after the fact. [workspace.package] -version = "0.1.28" +version = "0.1.29" [package] name = "nightcrow" @@ -44,7 +44,7 @@ exclude = [ ] [dependencies] -ratatui = { version = "0.30", features = ["crossterm"] } +ratatui = { version = "0.30", features = ["crossterm", "unstable-rendered-line-info"] } crossterm = "0.29" git2 = { version = "0.21", features = ["vendored-openssl", "vendored-libgit2"] } syntect = "5.3" diff --git a/docs/architecture/git-views.md b/docs/architecture/git-views.md index bc369715..54b6715f 100644 --- a/docs/architecture/git-views.md +++ b/docs/architecture/git-views.md @@ -18,7 +18,7 @@ Paths used only as commit objects or Git pathspecs go through `validate_commit_p `DiffLine` preserves the old/new line numbers supplied by libgit2. Unified mode uses two gutter columns, split mode one old and one new column, and file view displays file line numbers. The gutter and body render as separate `Paragraph`s so horizontal scrolling affects only the body; gutter width is computed from the maximum number in the whole hunk and a minimum width. -Wrap mode cannot be combined with horizontal scrolling and resets `scroll_x` to zero when enabled. In wrap mode the gutter is included in the body; split mode ignores wrap to preserve old/new row alignment. Vertical scroll and search indexes use logical lines. `DiffPaneView` cycles through `Diff → Split → File`, skipping File when the selected file cannot be opened. +Wrap mode cannot be combined with horizontal scrolling and resets `scroll_x` to zero when enabled. Wrapped TUI lines reserve the gutter across all continuation rows and display line numbers and diff markers on the first row. Split mode keeps old/new rows aligned by clipping to one screen row per side. The browser uses horizontal scrolling for long diff and file lines and its virtualized previews use fixed-height rows. Vertical scroll and search indexes use logical lines. `DiffPaneView` cycles through `Diff → Split → File`, skipping File when the selected file cannot be opened. Syntax highlighting runs synchronously on the UI thread, so both the diff pane and the file overlay highlight only the leading `HIGHLIGHT_LINE_CAP` body lines of the current generation. A hunk past the cap has no cached entry and a hunk that straddles it keeps only its in-budget prefix; the renderers emit plain text for the rest while keeping the add/remove background derived from the line kind. Each generation reuses the unchanged leading hunks, or the leading lines of a grown hunk, from the previous cache and resumes syntect from saved parser/highlighter state, so an appended diff or file overlay highlights only its new tail. A changed line, hunk shape, or syntax stops reuse at that point and the remainder is recomputed exactly as a full pass; a hunk header change alone does not invalidate the cache because headers do not feed the segments. The file overlay applies the same rule to line-boundary appends and falls back when its last cached line was unterminated. Search and the split layout still cover every line because they read the full hunk and search indexes, not the highlight cache, and the file overlay keeps per-line byte offsets so its unhighlighted tail can be rendered without rescanning the content. The lowercased search cache is also built on demand by `ensure_lower_cache`: a load without an active query skips the lowercase pass, and a search pays it once per generation. diff --git a/src/ui/diff_viewer/gutter.rs b/src/ui/diff_viewer/gutter.rs index 9101e504..7d5eb908 100644 --- a/src/ui/diff_viewer/gutter.rs +++ b/src/ui/diff_viewer/gutter.rs @@ -60,9 +60,6 @@ fn lineno_text(no: Option) -> String { /// separate `Paragraph`s because `Paragraph::scroll` shifts the whole line, so /// a gutter span in the body's paragraph would slide off the left edge; /// vertical scroll is instead expressed by *which* lines the caller collected. -/// With `wrap` set that split is abandoned: a wrapped body line occupies -/// several screen rows while its gutter line still occupies one, so the number -/// is folded into the body line instead, where wrapping carries it along. pub(crate) fn render_gutter_and_body( frame: &mut Frame, inner: Rect, @@ -73,12 +70,7 @@ pub(crate) fn render_gutter_and_body( wrap: bool, ) { if wrap { - frame.render_widget( - // `trim: false` keeps a continuation row's leading whitespace, which - // in source code is the indentation. - Paragraph::new(merge_gutter_into_body(gutter, body)).wrap(Wrap { trim: false }), - inner, - ); + render_wrapped_rows(frame, inner, gutter_width, gutter, body); return; } let cols = Layout::default() @@ -89,18 +81,36 @@ pub(crate) fn render_gutter_and_body( frame.render_widget(Paragraph::new(body).scroll((0, scroll_x)), cols[1]); } -/// Prepend each gutter line's spans to the body line it belongs to; the two -/// vectors are built in lockstep by the callers, so index `i` pairs row `i`. -fn merge_gutter_into_body<'a>(gutter: Vec>, body: Vec>) -> Vec> { +fn render_wrapped_rows( + frame: &mut Frame, + inner: Rect, + gutter_width: u16, + gutter: Vec>, + body: Vec>, +) { let mut gutter = gutter.into_iter(); - body.into_iter() - .map(|line| match gutter.next() { - Some(g) => { - let mut spans = g.spans; - spans.extend(line.spans); - Line::from(spans) - } - None => line, - }) - .collect() + let mut y = inner.top(); + for line in body { + let remaining_height = inner.bottom().saturating_sub(y); + if remaining_height == 0 { + break; + } + + // Headers and placeholders have no gutter contents and use the full width. + let number = gutter.next().filter(|line| line.width() > 0); + let reserved = if let Some(number) = number { + let width = gutter_width.min(inner.width); + frame.render_widget(number, Rect::new(inner.x, y, width, 1)); + width + } else { + 0 + }; + let width = inner.width - reserved; + let paragraph = Paragraph::new(line).wrap(Wrap { trim: false }); + let height = paragraph + .line_count(width) + .clamp(1, usize::from(remaining_height)) as u16; + frame.render_widget(paragraph, Rect::new(inner.x + reserved, y, width, height)); + y += height; + } } diff --git a/src/ui/diff_viewer/mod.rs b/src/ui/diff_viewer/mod.rs index 206ea644..69b9be99 100644 --- a/src/ui/diff_viewer/mod.rs +++ b/src/ui/diff_viewer/mod.rs @@ -94,10 +94,11 @@ pub fn render( // loaded the pane holds only a placeholder message, which has no line to // number. let digits = digits_for(app.diff_pane().max_line_number() as usize); + let wrap = app.diff_pane().wrap; let gutter_width = if total_lines == 0 { 0 } else { - unified_gutter_width(digits) + unified_gutter_width(digits) + u16::from(wrap) }; let mut lines: Vec = Vec::with_capacity(visible_height); @@ -121,8 +122,6 @@ pub fn render( hunk.header.as_str(), Style::default().fg(Color::Cyan), ))); - // Blank, but full width: a header row with no gutter cell would - // start its `@@` one column left of the body's left edge. gutter_lines.push(Line::from("")); } @@ -158,10 +157,19 @@ pub fn render( LineKind::Context => " ", }; - let mut spans = vec![Span::styled( - prefix, - Style::default().fg(Color::DarkGray).bg(bg), - )]; + let gutter_style = Style::default().fg(Color::DarkGray).bg(bg); + let number = Span::styled( + unified_gutter_text(diff_line.old_lineno, diff_line.new_lineno, digits), + gutter_style, + ); + let marker = Span::styled(prefix, gutter_style); + let mut spans = Vec::new(); + if wrap { + gutter_lines.push(Line::from(vec![number, marker])); + } else { + gutter_lines.push(Line::from(number)); + spans.push(marker); + } // Read from the prebuilt highlight cache; the shape is guaranteed // to match `hunks` after `ensure_highlight_cache`, so a mismatch @@ -186,12 +194,6 @@ pub fn render( } lines.push(Line::from(spans)); - // Same background as the row so the number reads as part of it - // rather than as a column floating beside the highlight. - gutter_lines.push(Line::from(Span::styled( - unified_gutter_text(diff_line.old_lineno, diff_line.new_lineno, digits), - Style::default().fg(Color::DarkGray).bg(bg), - ))); } } @@ -239,7 +241,7 @@ pub fn render( gutter_lines, lines, app.diff_pane().scroll_x.min(u16::MAX as usize) as u16, - app.diff_pane().wrap, + wrap, ); if let Some(sa) = search_area { diff --git a/src/ui/diff_viewer/tests/file_view.rs b/src/ui/diff_viewer/tests/file_view.rs index 0323e214..f1e7923d 100644 --- a/src/ui/diff_viewer/tests/file_view.rs +++ b/src/ui/diff_viewer/tests/file_view.rs @@ -41,6 +41,27 @@ fn file_view_line_numbers_stay_put_when_the_body_scrolls_sideways() { ); } +#[test] +fn file_view_wraps_wide_text_under_the_body_column() { + let mut app = app_with_files(vec!["src/lib.rs"]); + app.git.view.mode = ViewMode::Status; + app.git.view.diff.view = DiffPaneView::File; + app.git.view.diff.wrap = true; + app.git.view.diff.file_view.key = + Some(crate::app::FileViewKey::Status("src/lib.rs".to_string())); + app.git + .view + .diff + .file_view + .set_content("start 가나다라마바\nnext row\n".to_string()); + + let screen = drawn_file_view(&mut app, 20, 8, 0); + let first = screen.iter().find(|row| row.contains("start")).unwrap(); + let continuation = screen.iter().find(|row| row.contains('가')).unwrap(); + assert_eq!(col_of(first, "start"), col_of(continuation, "가")); + assert!(screen.iter().any(|row| row.contains("2 next row"))); +} + /// The file view reads its own horizontal offset, not `diff.scroll_x`. fn drawn_file_view(app: &mut App, width: u16, height: u16, scroll_x: usize) -> Vec { app.git.view.diff.file_view.scroll_x = scroll_x; diff --git a/src/ui/diff_viewer/tests/wrap.rs b/src/ui/diff_viewer/tests/wrap.rs index dd4868b1..a9edf68e 100644 --- a/src/ui/diff_viewer/tests/wrap.rs +++ b/src/ui/diff_viewer/tests/wrap.rs @@ -50,11 +50,18 @@ fn wrapping_folds_a_long_line_onto_several_rows() { ); } -/// With wrapping on the gutter is folded into the body line, because a separate -/// gutter paragraph would desynchronise the moment a line spans two rows. #[test] -fn wrapping_keeps_the_line_number_on_the_row_the_line_starts_on() { - let mut app = app_showing(long_line_hunk(), DiffPaneView::Diff); +fn wrapping_aligns_continuations_and_keeps_numbers_with_their_lines() { + let mut hunk = long_line_hunk(); + hunk.lines[0].kind = LineKind::Added; + hunk.lines[0].old_lineno = None; + hunk.lines.push(DiffLine { + kind: LineKind::Added, + content: "next row".to_string(), + old_lineno: None, + new_lineno: Some(8), + }); + let mut app = app_showing(hunk, DiffPaneView::Diff); app.git.view.diff.wrap = true; let screen = drawn(&mut app, 40, 10, 0); @@ -64,17 +71,20 @@ fn wrapping_keeps_the_line_number_on_the_row_the_line_starts_on() { .expect("the row the line starts on"); assert!( - first.contains('7'), + first.contains("7 +alpha"), "the number travels with its own line: {first:?}" ); let continuation = screen .iter() .find(|l| l.contains("juliett") && !l.contains("alpha")) .expect("a continuation row"); - assert!( - !continuation.contains('7'), - "a continuation row must not be numbered again: {continuation:?}" + let body_column = col_of(first, "alpha"); + assert_eq!( + left_columns(continuation, body_column), + format!("│{}", " ".repeat(body_column - 1)), + "the continuation must leave the gutter and marker columns blank" ); + assert!(screen.iter().any(|row| row.contains("8 +next row"))); } #[test] diff --git a/viewer-ui/dist/assets/Terminal-C0v33aMU.js b/viewer-ui/dist/assets/Terminal-DiFTvhqh.js similarity index 93% rename from viewer-ui/dist/assets/Terminal-C0v33aMU.js rename to viewer-ui/dist/assets/Terminal-DiFTvhqh.js index 28f126f2..a573b445 100644 --- a/viewer-ui/dist/assets/Terminal-C0v33aMU.js +++ b/viewer-ui/dist/assets/Terminal-DiFTvhqh.js @@ -78,4 +78,4 @@ void main() { outColor = v_color; }`,Cf=8,wf=Cf*Float32Array.BYTES_PER_ELEMENT,Tf=20*Cf,Ef=class{constructor(){this.attributes=new Float32Array(Tf),this.count=0}},Df=0,Of=0,kf=0,Af=0,jf=0,Mf=0,Nf=0,Pf=class extends uu{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new Ef,this._verticesCursor=new Ef;let i=this._gl;this._program=Y(ef(i,xf,Sf)),this._register(su(()=>i.deleteProgram(this._program))),this._projectionLocation=Y(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(su(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(su(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=Y(i.createBuffer()),this._register(su(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,wf,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,wf,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,wf,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,$d),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i>24&255)/255,jf=(Df>>16&255)/255,Mf=(Df>>8&255)/255,Nf=1,this._addRectangle(e.attributes,t,Of,kf,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Af,jf,Mf,Nf)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},Ff=class extends uu{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(su(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Y(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Kd(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=Xu,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},If=class extends Ff{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&Wd(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t=0;!(Vf.indexOf(`Chrome`)>=0)&&Vf.indexOf(`Safari`),Vf.indexOf(`Electron/`),Vf.indexOf(`Android`);var Uf=!1;if(typeof Lf.matchMedia==`function`){let e=Lf.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=Lf.matchMedia(`(display-mode: fullscreen)`);Uf=e.matches,Bf(Lf,e,({matches:e})=>{Uf&&t.matches||(Uf=e)})}function Wf(){return Uf}var Gf=`en`,Kf=!1,qf=!1,Jf=!1,Yf=Gf,Xf,Zf=globalThis,Qf;typeof Zf.vscode<`u`&&typeof Zf.vscode.process<`u`?Qf=Zf.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(Qf=process);var $f=typeof Qf?.versions?.electron==`string`&&Qf?.type===`renderer`;if(typeof Qf==`object`){Qf.platform,Qf.platform,Kf=Qf.platform===`linux`,Kf&&Qf.env.SNAP&&Qf.env.SNAP_REVISION,Qf.env.CI||Qf.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Yf=Gf;let e=Qf.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,Yf=t.resolvedLanguage||Gf,t.languagePack?.translationsConfigFile}catch{}qf=!0}else typeof navigator==`object`&&!$f?(Xf=navigator.userAgent,Xf.indexOf(`Windows`),Xf.indexOf(`Macintosh`),(Xf.indexOf(`Macintosh`)>=0||Xf.indexOf(`iPad`)>=0||Xf.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,Kf=Xf.indexOf(`Linux`)>=0,Xf?.indexOf(`Mobi`),Jf=!0,Yf=globalThis._VSCODE_NLS_LANGUAGE||Gf,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var ep=qf;Jf&&typeof Zf.importScripts==`function`&&Zf.origin;var tp=Xf,np=Yf,rp;(e=>{function t(){return np}e.value=t;function n(){return np.length===2?np===`en`:np.length>=3&&np[0]===`e`&&np[1]===`n`&&np[2]===`-`}e.isDefaultVariant=n;function r(){return np===`en`}e.isDefault=r})(rp||={});var ip=typeof Zf.postMessage==`function`&&!Zf.importScripts;(()=>{if(ip){let e=[];Zf.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let r=++t;e.push({id:r,callback:n}),Zf.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var ap=!!(tp&&tp.indexOf(`Chrome`)>=0);tp&&tp.indexOf(`Firefox`),!ap&&tp&&tp.indexOf(`Safari`),tp&&tp.indexOf(`Edg/`),tp&&tp.indexOf(`Android`);var op=typeof navigator==`object`?navigator:{};ep||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||op&&op.clipboard&&op.clipboard.writeText,ep||op&&op.clipboard&&op.clipboard.readText,ep||Wf()||op.keyboard,`ontouchstart`in Lf||op.maxTouchPoints,Lf.PointerEvent&&(`ontouchstart`in Lf||navigator.maxTouchPoints);var sp=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},cp=new sp,lp=new sp,up=new sp;Array(230);var dp;(e=>{function t(e){return cp.keyCodeToStr(e)}e.toString=t;function n(e){return cp.strToKeyCode(e)}e.fromString=n;function r(e){return lp.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return up.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return lp.strToKeyCode(e)||up.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return cp.keyCodeToStr(e)}e.toElectronAccelerator=o})(dp||={});var fp=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),pp;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof mp?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:xd.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:fp})})(pp||={});var mp=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?fp:(this._emitter||=new X,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var hp;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(hp||={});var gp=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new X,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};gp.EMPTY=gp.fromArray([]);function _p(e){return vp(e,0)}function vp(e,t){switch(typeof e){case`object`:return e===null?yp(349,t):Array.isArray(e)?Sp(e,t):Cp(e,t);case`string`:return xp(e,t);case`boolean`:return bp(e,t);case`number`:return yp(e,t);case`undefined`:return yp(937,t);default:return yp(617,t)}}function yp(e,t){return(t<<5)-t+e|0}function bp(e,t){return yp(e?433:863,t)}function xp(e,t){t=yp(149417,t);for(let n=0,r=e.length;nvp(t,e),t)}function Cp(e,t){return t=yp(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=xp(n,t),vp(e[n],t)),t)}var{registerWindow:wp,getWindow:Tp,getDocument:Ep,getWindows:Dp,getWindowsCount:Op,getWindowId:kp,getWindowById:Ap,hasWindow:jp,onDidRegisterWindow:Mp,onWillUnregisterWindow:Np,onDidUnregisterWindow:Pp}=function(){let e=new Map,t={window:Lf,disposables:new lu};e.set(Lf.vscodeWindowId,t);let n=new X,r=new X,i=new X;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return uu.None;let a=new lu,o={window:t,disposables:a.add(new lu)};return e.set(t.vscodeWindowId,o),a.add(su(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(Ip(t,Rp.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:Lf},getDocument(e){return Tp(e).document}}}(),Fp=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function Ip(e,t,n,r){return new Fp(e,t,n,r)}var Lp=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};Lp.None=new Lp(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=_p(n),a=r.get(i);if(a)a.users+=1;else{let o=new X,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(su(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var Rp={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:Hf?`webkitAnimationStart`:`animationstart`,ANIMATION_END:Hf?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:Hf?`webkitAnimationIteration`:`animationiteration`},zp=class extends uu{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new du,this._charAtlasDisposable=this._register(new du),this._observerDisposable=this._register(new du),this._model=new bf,this._workCell=new Qd,this._workCell2=new Qd,this._rectangleRenderer=this._register(new du),this._glyphRenderer=this._register(new du),this._onChangeTextureAtlas=this._register(new X),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new X),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new X),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new X),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new X),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Ju(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new If(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=Ru(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Ip(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(Ip(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,qd(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Xd(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=Xd(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(su(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),qd(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Pf(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new ff(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=Kd(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=ou(xd.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),xd.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached){if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new Yd(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=Vp(e,n.rows-1,0),t=Vp(t,n.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,ee=S-n.buffer.ydisp,C=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),w=-1,T=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let E=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=S===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v=p[1],d?(l=!0,r=new Bp(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*hf,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),T&&o===S&&(y===C&&(this._model.cursor={x:C,y:ee,width:r.getWidth(),style:this._coreBrowserService.isFocused?x:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},w=C+r.getWidth()-1),y>=C&&y<=w&&(this._coreBrowserService.isFocused&&x===`block`||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),g!==0&&(this._model.lineLengths[a]=y+1),(this._model.cells[v]!==g||this._model.cells[v+gf]!==this._cellColorResolver.result.bg||this._model.cells[v+_f]!==this._cellColorResolver.result.fg||this._model.cells[v+vf]!==this._cellColorResolver.result.ext)&&(E=!0,h.length>1&&(g|=yf),this._model.cells[v]=g,this._model.cells[v+gf]=this._cellColorResolver.result.bg,this._model.cells[v+_f]=this._cellColorResolver.result.fg,this._model.cells[v+vf]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*hf,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,yu,0,0),this._model.cells[b]=0,this._model.cells[b+gf]=this._cellColorResolver.result.bg,this._model.cells[b+_f]=this._cellColorResolver.result.fg,this._model.cells[b+vf]=this._cellColorResolver.result.ext;y--}}E&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},Bp=class extends gd{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Vp(e,t,n=0){return Math.max(Math.min(e,t),n)}var Hp=`di$target`,Up=`di$dependencies`,Wp=new Map;function Gp(e){if(Wp.has(e))return Wp.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Kp(t,e,r)};return t._id=e,Wp.set(e,t),t}function Kp(e,t,n){t[Hp]===t?t[Up].push({id:e,index:n}):(t[Up]=[{id:e,index:n}],t[Hp]=t)}Gp(`BufferService`),Gp(`CoreMouseService`),Gp(`CoreService`),Gp(`CharsetService`),Gp(`InstantiationService`),Gp(`LogService`);var qp=Gp(`OptionsService`);Gp(`OscLinkService`),Gp(`UnicodeService`),Gp(`DecorationService`);var Jp={trace:0,debug:1,info:2,warn:3,error:4,off:5},Yp=`xterm.js: `,Xp=class extends uu{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),Zp=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Jp[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new zp(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(xd.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(xd.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(xd.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(xd.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(su(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},$p=250;function em(e){return e.type===`keydown`&&e.ctrlKey&&!e.altKey&&!e.metaKey&&(e.code===`KeyL`||e.key===`l`||e.key===`L`)}var tm=class{seen=null;noteKey(e,t){em(e)&&(this.seen={at:t,trusted:e.isTrusted,repeat:e.repeat,code:e.code})}report(e,t){if(!e.includes(`\f`))return null;let n=this.seen;return this.seen=null,!n||t-n.at>$p||t{let e=um;e!==null&&cm(e).then(n=>{n&&um===e&&(um=null,te(t))})}}})}function fm(e,t=250){let n=null,r=0,i=null,a=null,o=()=>{a!==null&&clearTimeout(a),a=null},s=t=>{n=t,r=Date.now(),e(t)},c=()=>{if(a=null,i===null)return;let e=i;i=null,e!==n&&s(e)};return{push(e){if(e===n){i=null,o();return}let l=Date.now()-r;r===0||l>=t?(i=null,o(),s(e)):(i=e,a===null&&(a=setTimeout(c,t-l)))},cancel(){o(),i=null}}}function pm(e,t){let n;try{n=t()}catch{return!1}let r=n.onContextLoss(()=>n.dispose());try{e.loadAddon(n)}catch{return r.dispose(),n.dispose(),!1}return!0}var mm=new Set([20,229,16,17,18]);function hm(e){let t=e.parentElement;if(!t)return{dispose(){},noteKeyPassedToXterm(){}};let n=!1,r=0,i,a=()=>{i!==void 0&&clearTimeout(i),i=void 0},o=t=>{t.target===e&&(r++,n=!0,a())},s=t=>{if(t.target!==e||!n)return;let a=r;i=setTimeout(()=>{i=void 0,r===a&&(n=!1)},0)},c=t=>{let r=t;n&&t.target===e&&r.inputType===`insertText`&&t.stopImmediatePropagation()};return t.addEventListener(`compositionstart`,o),t.addEventListener(`compositionend`,s),t.addEventListener(`input`,c,!0),{noteKeyPassedToXterm(e){e.type===`keydown`&&!mm.has(e.keyCode)&&n&&(r++,n=!1,a())},dispose(){n=!1,r++,a(),t.removeEventListener(`compositionstart`,o),t.removeEventListener(`compositionend`,s),t.removeEventListener(`input`,c,!0)}}}function gm({panes:e,size:t,zoomed:n,mode:r,screenScale:i,socketRef:a,viewsRef:o,bodyRefs:s,pendingRef:c,replayRef:l,ptySizesRef:u,consumeLatches:d,setTitles:f}){let p=(0,j.useRef)(new Map);(0,j.useEffect)(()=>{let e=p.current;return()=>e.forEach(e=>e.cancel())},[]),(0,j.useEffect)(()=>{let t=fl(i);for(let n of e){let e=o.current.get(n);if(e){e.term.options.fontSize!==t.fontSize&&(e.term.options.fontSize=t.fontSize),e.term.options.fontFamily!==t.fontFamily&&(e.term.options.fontFamily=t.fontFamily);continue}let r=s.current.get(n);if(!r)continue;let i=new cl({...t,theme:{background:`#111112`,foreground:`#f2f2f3`},cursorBlink:!0,macOptionIsMeta:!1,macOptionClickForcesSelection:!0}),m=new dl;i.loadAddon(m);let h=new tm,g=null;i.attachCustomKeyEventHandler(e=>{if(h.noteKey(e,performance.now()),im(e,navigator.platform))return!1;let t=rm(e);return t===null?(g?.noteKeyPassedToXterm(e),!0):(i.input(t),!1)}),i.onData(e=>{let t=h.report(e,performance.now()),r=d(e);Ee(a.current,{type:`input`,pane:n,data:r})&&t&&Ee(a.current,{type:`clear_key_report`,pane:n,...t})});let _=pt(i,l.current.panes.has(n),e=>{sm(e).catch(e=>{console.error(`nightcrow: a pane's clipboard request failed`,e)})}),v=fm(e=>{f(t=>t[n]===e?t:{...t,[n]:e})});p.current.set(n,v),i.onTitleChange(e=>{let t=e.replace(/\s+/g,` `).trim();t&&v.push(t)}),i.open(r),i.textarea&&(g=hm(i.textarea),i.loadAddon({activate(){},dispose(){g?.dispose()}})),pm(i,()=>new Qp);let y=u.current.get(n);y&&i.resize(y.cols,y.rows);let b={term:i,fit:m,replayGate:_};o.current.set(n,b);let x=c.current.get(n);if(x){for(let e of x)e instanceof Uint8Array?ct(i,e):dt(i,b.replayGate,()=>{o.current.get(n)===b&&l.current.panes.get(n)===e.token&&l.current.panes.delete(n)});c.current.delete(n),lt(i,()=>i.scrollToBottom())}}for(let[t,n]of o.current)e.includes(t)||(p.current.get(t)?.cancel(),p.current.delete(t),ut(n.term),n.term.dispose(),o.current.delete(t))},[e,t,n,r,i,a,o,s,c,l,u,d,f])}function _m({repo:e,refs:t,size:n,mode:r,panes:i,active:a,replayLeft:o,pending:s,ownsSize:c,keyboardOpen:l,screenScale:u,refitEpoch:d,zoomShown:f,zoomServer:p,consumeLatches:m,setLink:h,setPending:g,setReplayLeft:_,setPanes:v,setActive:y,setZoomed:b,setTitles:x,setOwnsSize:S,onSizeAcquired:ee,setRecovery:C}){let{containerRef:w,socketRef:T,viewsRef:E,bodyRefs:te,ptySizesRef:D,askedSizesRef:ne,desiredSizesRef:re,ownsSizeRef:ie,sizeOwnerGenerationRef:O,pendingRef:k,replayRef:A,zoomAskedRef:ae,slotRefs:oe}=t;kl({repo:e,socketRef:T,viewsRef:E,pendingRef:k,replayRef:A,ptySizesRef:D,askedSizesRef:ne,desiredSizesRef:re,ownsSizeRef:ie,sizeOwnerGenerationRef:O,zoomAskedRef:ae,setLink:h,setPending:g,setReplayLeft:_,setPanes:v,setActive:y,setZoomed:b,setTitles:x,setOwnsSize:S,onSizeAcquired:ee,setRecovery:C}),Bl({containerRef:w,socketRef:T,viewsRef:E}),gm({panes:i,size:n,zoomed:f,mode:r,screenScale:u,socketRef:T,viewsRef:E,bodyRefs:te,pendingRef:k,replayRef:A,ptySizesRef:D,consumeLatches:m,setTitles:x});let se=(0,j.useCallback)(()=>g(null),[g]);pl({pending:s,size:n,screenScale:u,socketRef:T,slotRefs:oe,panesExist:i.length>0,onAnswered:se}),St({panes:i,size:n,zoomed:f,mode:r,screenScale:u,socketRef:T,viewsRef:E,bodyRefs:te,ptySizesRef:D,askedSizesRef:ne,desiredSizesRef:re,ownsSize:c,layoutPending:Ge(p,i),keyboardOpen:l,refitEpoch:d}),yt({panes:i,viewsRef:E,bodyRefs:te,keyboardOpen:l,size:n,zoomed:f,mode:r}),bt({repo:e,panes:i,replayLeft:o,active:a,setActive:y,zoomed:p,zoom:f,viewsRef:E,panelRef:w,size:n,mode:r})}var vm=()=>bm(ze),ym=()=>bm(Be);function bm(e){let[t,n]=(0,j.useState)(!1),r=(0,j.useRef)(!1),i=(0,j.useCallback)(e=>{r.current=e,n(e)},[]),a=(0,j.useCallback)(t=>{let n=e(r.current,t);return n.armed!==r.current&&i(n.armed),n.data},[e,i]);return{armed:t,toggle:(0,j.useCallback)(()=>{let e=!r.current;return i(e),e},[i]),clear:(0,j.useCallback)(()=>i(!1),[i]),consume:a}}function xm(e){let[t,n]=(0,j.useState)({w:0,h:0});return(0,j.useEffect)(()=>{let t=e.current;if(!t)return;let r=new ResizeObserver(()=>{let e=t.clientWidth,r=t.clientHeight;n(t=>t.w===e&&t.h===r?t:{w:e,h:r})});return r.observe(t),()=>r.disconnect()},[e]),t}function Sm(e=window){return(0,j.useSyncExternalStore)(t=>Cm(e,t),()=>x(e)>0,()=>!1)}function Cm(e,t){let n=e.visualViewport;return e.addEventListener(`resize`,t),n?.addEventListener(`resize`,t),n?.addEventListener(`scroll`,t),()=>{e.removeEventListener(`resize`,t),n?.removeEventListener(`resize`,t),n?.removeEventListener(`scroll`,t)}}function wm({link:e,panes:t,replayLeft:n,pending:r}){return e===`live`?n>0?{kind:`attaching`,left:n}:t>0?{kind:`ready`}:r===null?{kind:`empty`}:{kind:`starting`,count:r}:{kind:e}}function Tm(e){switch(e.kind){case`connecting`:return`Connecting…`;case`reconnecting`:return`Reconnecting…`;case`attaching`:return`Attaching ${Em(e.left)}…`;case`starting`:return`Starting ${Em(e.count)}…`;case`empty`:case`ready`:return null}}function Em(e){return`${e} terminal${e===1?``:`s`}`}var $=e();function Dm({status:e}){if(e.kind===`empty`)return(0,$.jsxs)(`p`,{className:`p-3 text-ink-400`,children:[`No terminal open. Press `,(0,$.jsx)(`span`,{className:`text-accent`,children:`+`}),` above to start one.`]});let t=e.kind===`starting`?null:Tm(e);return t?(0,$.jsx)(`div`,{role:`status`,className:`pointer-events-none absolute inset-0 z-10 flex items-center justify-center p-6`,children:(0,$.jsxs)(`span`,{className:`flex animate-pulse items-center gap-2 rounded-md bg-ink-950/80 px-3 py-2 text-caption text-ink-400 uppercase`,children:[(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-accent`}),t]})}):null}var Om=100;function km({socketRef:e,viewsRef:t,active:n,panes:r,onSent:i}){let[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)({}),[l,u]=(0,j.useState)(!1),d=(0,j.useRef)(null),f=(0,j.useRef)(r),p=(0,j.useRef)(0),m=(0,j.useRef)(!1);f.current=r;let h=a!==null&&r.includes(a)?a:null,g=h===null?``:s[h]??``,_=()=>{p.current+=1,m.current=!1,u(!1)};(0,j.useEffect)(()=>()=>{p.current+=1,m.current=!1,d.current=null},[]),(0,j.useEffect)(()=>{a!==null&&!r.includes(a)&&(d.current=null,_(),o(null))},[a,r]);let v=e=>{h!==null&&c(t=>({...t,[h]:e}))};return{target:h,draft:g,setDraft:v,open:()=>{d.current===null&&n!==null&&(_(),d.current=n,o(n))},close:()=>{d.current=null,_(),o(null)},send:()=>{if(h===null||m.current||!Pl(g))return!1;let n=t.current.get(h)?.term.modes.bracketedPasteMode??!1,r=Nl(g,n);return Ee(e.current,{type:`input`,pane:h,data:r})?(window.setTimeout(()=>{Ee(e.current,{type:`input`,pane:h,data:`\r`})},Om),v(``),d.current=null,_(),o(null),i(h),!0):!1},attachImage:async e=>{if(h===null||m.current)return;if(!Il.includes(e.type)){b.error(`Choose a PNG, JPEG, GIF, or WebP image.`);return}if(e.size>10485760){b.error(`Image must be 10 MiB or smaller.`);return}let t=h,n=p.current,r=()=>n===p.current&&d.current===t&&f.current.includes(t);m.current=!0,u(!0);try{let n=await _e.pasteImage(e);if(!n)throw Error(`the server returned no image path`);if(!r())return;c(e=>{let r=e[t]??``,i=r.length>0&&!/\s$/.test(r)?` `:``;return{...e,[t]:`${r}${i}${Rl(n)}`}})}catch(e){r()&&b.error(e instanceof Error?`Could not attach image: ${e.message}`:`Could not attach image.`)}finally{r()&&(m.current=!1,u(!1))}},uploading:l}}var Am=ge();function jm(){let e=window,t=e.SpeechRecognition??e.webkitSpeechRecognition;return t?()=>new t:null}function Mm(e,t){return t?e?`ready`:`insecure`:`unsupported`}function Nm(e){let t=``;for(let n=e.resultIndex;n{i.current?.stop()},[]),s=(0,j.useCallback)(()=>{if(!e||i.current)return;let t;try{t=e()}catch{Lm(`unavailable`);return}t.lang=navigator.language,t.continuous=!1,t.interimResults=!1,t.onresult=e=>{let t=Nm(e);t&&a.current(t)},t.onerror=e=>Lm(e.error),t.onend=()=>{i.current===t&&(i.current=null),r(!1)};try{t.start()}catch{Lm(`start-failed`);return}i.current=t,r(!0)},[e]);return(0,j.useEffect)(()=>()=>{let e=i.current;i.current=null,e&&(e.onend=null,e.onresult=null,e.onerror=null,e.abort())},[]),{listening:n,toggle:n?o:s}}var zm=`flex h-11 w-11 shrink-0 items-center justify-center rounded-sm hover:text-accent`;function Bm({availability:e,factory:t,onText:n}){let{listening:r,toggle:i}=Rm(e===`ready`?t:null,n);if(e===`unsupported`)return null;let a=e===`ready`;return(0,$.jsx)(`button`,{type:`button`,onClick:a?i:void 0,"aria-disabled":!a||void 0,"aria-pressed":a?r:void 0,"aria-label":a?r?`Stop voice input`:`Voice input`:`Voice input needs HTTPS`,title:a?r?`Stop voice input`:`Voice input`:Im,className:`${zm} ${r?`animate-pulse text-accent`:a?`text-ink-400`:`text-ink-600`}`,children:(0,$.jsx)(ee,{})})}function Vm(){let[e,t]=(0,j.useState)(null),n=(0,j.useRef)(new Map);return(0,j.useEffect)(()=>T(e=>{let r=e.filter(e=>e.kind===`error`),i=r.filter(e=>n.current.get(e.id)!==e.bump);n.current=new Map(r.map(e=>[e.id,e.bump])),i.length>0?t(i[i.length-1]):t(e=>e&&n.current.has(e.id)?e:null)}),[]),(0,$.jsx)(`div`,{className:`sr-only`,children:e&&(0,$.jsx)(`p`,{role:`alert`,children:e.message},`${e.id}-${e.bump}`)})}var Hm=`nc-compose-title`;function Um(){let e=navigator;return e.userAgentData?.platform||e.platform||``}function Wm({label:e,draft:t,onChange:n,onSend:r,onAttachImage:i,uploading:a,onClose:o,dictation:s}){let c=(0,j.useRef)(null),l=(0,j.useRef)(null),[u,d]=(0,j.useState)(!1),f=Pl(t)&&!a,p=Fl(Um()),[m]=(0,j.useState)(()=>{if(s)return s;let e=jm();return{availability:Mm(window.isSecureContext,e),factory:e}});(0,j.useEffect)(()=>{let e=c.current;e?.focus(),e?.setSelectionRange(e.value.length,e.value.length)},[]),(0,j.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!e.isComposing&&o()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[o]);let h=()=>{f&&d(!r())};return(0,Am.createPortal)((0,$.jsx)(`div`,{className:`nc-fade-in fixed inset-0 z-50 flex items-start justify-center bg-black/60 p-4 pt-[8vh]`,onClick:o,children:(0,$.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":Hm,className:`nc-rise-in flex w-[56rem] max-w-full flex-col rounded-lg border border-ink-700 bg-ink-900`,onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(Vm,{}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-ink-700 px-3 py-2`,children:[(0,$.jsxs)(`span`,{id:Hm,className:`min-w-0 truncate font-medium text-ink-50`,children:[`Send to `,e]}),(0,$.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`close`,className:`ml-auto flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-ink-200`,children:(0,$.jsx)(O,{})})]}),(0,$.jsx)(`textarea`,{ref:c,value:t,onChange:e=>{n(e.target.value),d(!1)},onKeyDown:e=>{e.key!==`Enter`||e.nativeEvent.isComposing||(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())},rows:8,"aria-label":`message`,className:`m-3 resize-none overflow-y-auto rounded-sm border border-ink-700 bg-ink-950 p-2 font-mono text-[16px] text-ink-50 focus:border-accent focus:outline-none`}),(0,$.jsx)(`input`,{ref:l,type:`file`,accept:Il.join(`,`),"aria-label":`Choose an image`,tabIndex:-1,className:`hidden`,onChange:e=>{let t=e.currentTarget.files?.[0];e.currentTarget.value=``,t&&i(t)}}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 pb-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>l.current?.click(),disabled:a,"aria-label":`Attach image`,title:`Attach image`,className:`${zm} text-ink-400 disabled:text-ink-600 disabled:hover:text-ink-600`,children:(0,$.jsx)(ae,{})}),(0,$.jsx)(Bm,{availability:m.availability,factory:m.factory,onText:e=>{n(Pm(t,e)),d(!1)}}),a&&(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-ink-300`,children:`Uploading image…`}),u&&(0,$.jsx)(`span`,{role:`alert`,className:`min-w-0 basis-full truncate text-removed`,children:`Not connected — nothing was sent.`}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>{n(``),d(!1),c.current?.focus()},disabled:t.length===0,className:`min-h-11 rounded-sm px-3 text-ink-200 hover:text-ink-50 disabled:text-ink-600`,children:`Clear`}),(0,$.jsxs)(`button`,{type:`button`,onClick:h,disabled:!f,title:`Send and run (${p})`,"aria-keyshortcuts":`Meta+Enter Control+Enter`,className:`flex min-h-11 items-center gap-1.5 rounded-sm bg-accent px-3 py-1.5 font-medium text-ink-950 disabled:bg-ink-700 disabled:text-ink-400`,children:[(0,$.jsx)(`kbd`,{"aria-hidden":`true`,className:`font-sans opacity-70`,children:p}),`Send`]})]})]})]})}),document.body)}function Gm({closing:e,panes:t,paneLabel:n,onConfirmClose:r,onCancelClose:i,compose:a}){return(0,$.jsxs)($.Fragment,{children:[e!==null&&t.includes(e)&&(0,$.jsx)(fe,{label:n(e),detail:`The process running in it will be terminated.`,onConfirm:()=>r(e),onCancel:i}),a.target!==null&&(0,$.jsx)(Wm,{label:n(a.target),draft:a.draft,onChange:a.setDraft,onSend:a.send,onAttachImage:a.attachImage,uploading:a.uploading,onClose:a.close})]})}function Km({report:e,pane:t,onCancel:n}){let r=t===void 0?Tl(e):`pane ${t} · ${Tl(e)}`;return(0,$.jsxs)(`span`,{className:`flex min-w-0 shrink items-center gap-1 rounded-sm bg-ink-800 px-1 text-accent`,title:e.detail??r,children:[(0,$.jsx)(`span`,{className:`truncate`,children:r}),e.detail&&(0,$.jsx)(`span`,{className:`hidden min-w-0 truncate text-ink-400 md:inline`,children:e.detail}),(0,$.jsx)(`button`,{onMouseDown:e=>e.stopPropagation(),onClick:n,title:`Stop waiting and release this pane's slot`,"aria-label":`cancel recovery${t===void 0?``:` for pane ${t}`}`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-removed`,children:(0,$.jsx)(O,{className:`h-3 w-3`})})]})}function qm({pane:e,index:t,label:n,cellStyle:r,isActive:i,isZoomed:a,showZoom:o,isDragged:s,isDropTarget:d,reorderable:f,showHeader:p,recovery:m,onCancelRecovery:h,onFocus:g,onToggleZoom:_,onClose:v,onPaneDragStart:y,onPaneDragMove:b,onPaneDragEnd:x,onPaneDragCancel:S,bodyRef:ee,bodyTouch:C}){let w=u(),T=(e,t)=>i?w(e,t):{title:t};return(0,$.jsxs)(`div`,{"data-pane-id":e,"data-pane-cell":!0,onMouseDown:g,style:r,className:`nc-cell-in relative min-h-0 min-w-0 flex-col overflow-hidden rounded-sm border ${d?`border-accent ring-1 ring-accent`:i?`border-accent`:`border-ink-700`} ${s?`opacity-60`:``}`,children:[!p&&m&&(0,$.jsx)(`div`,{className:`absolute top-1 right-1 z-10 text-xs`,children:(0,$.jsx)(Km,{report:m,onCancel:h})}),p&&(0,$.jsxs)(`div`,{onPointerDown:y,onPointerMove:b,onPointerUp:x,onPointerCancel:S,"data-active":i,className:`nc-title-target flex shrink-0 items-center gap-1 select-none bg-ink-900 px-2 py-0.5 text-xs ${f?s?`cursor-grabbing touch-none`:`cursor-grab touch-none`:``}`,children:[(0,$.jsx)(`span`,{title:n,className:`min-w-0 flex-1 ${i?`text-ink-50`:`text-ink-400`}`,children:(0,$.jsx)(c,{title:n})}),m&&(0,$.jsx)(Km,{report:m,onCancel:h}),o&&(0,$.jsx)(`button`,{onMouseDown:e=>e.stopPropagation(),onClick:_,"aria-pressed":a,...T(`view.toggleMaximize`,a?`Restore the grid`:`Zoom this terminal`),"aria-label":a?`Restore the grid`:`Zoom this terminal`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent md:h-6 md:w-6`,children:(0,$.jsx)(l,{maximized:a})}),(0,$.jsx)(`button`,{onMouseDown:e=>e.stopPropagation(),onClick:v,...T(`terminal.closePane`,`Close terminal`),"aria-label":`close terminal ${t+1}`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-removed md:h-6 md:w-6`,children:(0,$.jsx)(O,{})})]}),(0,$.jsx)(`div`,{ref:ee,...C,className:`nc-pane-body flex min-h-0 flex-1 flex-col justify-end overflow-hidden touch-pinch-zoom`})]})}function Jm({count:e,slotStyle:t,showHeader:n,bodyTouch:r,slotRefs:i}){return Array.from({length:e},(e,a)=>(0,$.jsx)(qm,{pane:-1-a,index:a,label:`starting…`,cellStyle:t(a),isActive:!1,isZoomed:!1,showZoom:!1,isDragged:!1,isDropTarget:!1,reorderable:!1,showHeader:n,bodyTouch:r,onCancelRecovery:()=>{},onFocus:()=>{},onToggleZoom:()=>{},onClose:()=>{},onPaneDragStart:()=>{},onPaneDragMove:()=>{},onPaneDragEnd:()=>{},onPaneDragCancel:()=>{},bodyRef:e=>{e?i.current.set(a,e):i.current.delete(a)}},`slot-${a}`))}function Ym(e,t){let n=(0,j.useRef)(t);(0,j.useLayoutEffect)(()=>{n.current!==t&&(n.current=t,Pe(e.current))},[e,t])}function Xm({containerRef:e,mode:t,panes:n,titles:r,active:i,shown:a,layout:o,pending:s,maximized:c=!1,recovery:l,draggingPane:u,dragOverPane:d,reorderable:f,bodyTouch:p,slotRefs:m,bodyRefs:h,onFocus:g,onToggleZoom:_,onClose:v,onCancelRecovery:y,onPaneDragStart:b,onPaneDragMove:x,onPaneDragEnd:S,onPaneDragCancel:ee}){let C=t===`tabs`;Ym(e,`${t}:${a}:${o.cols}x${o.rows}:${c}`);let w=e=>{let t=o.cells[e];return{display:`flex`,gridColumn:`${t.colStart} / span ${t.colSpan}`,gridRow:`${t.row}`}},T=(e,t)=>C?E(e===a):a===null?w(t):{display:e===a?`flex`:`none`};return(0,$.jsxs)(`div`,{ref:e,className:C?ue:`grid h-full gap-1`,style:C?void 0:a===null?{gridTemplateColumns:`repeat(${o.cols}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${o.rows}, minmax(0, 1fr))`}:{gridTemplateColumns:`1fr`,gridTemplateRows:`1fr`},children:[n.length===0&&s!==null&&(0,$.jsx)(Jm,{count:s,showHeader:!C,bodyTouch:p,slotStyle:e=>C?E(e===0):w(e),slotRefs:m}),n.map((e,t)=>(0,$.jsx)(qm,{pane:e,index:t,label:r[e]??`term ${t+1}`,cellStyle:T(e,t),isActive:e===i,isZoomed:!C&&a===e,showZoom:!C&&n.length>1,isDragged:u===e,isDropTarget:d===e,reorderable:f,showHeader:!C,bodyTouch:p,recovery:l[e],onCancelRecovery:()=>y(e),onFocus:()=>g(e),onToggleZoom:()=>_(e),onClose:()=>v(e),onPaneDragStart:t=>b(t,e),onPaneDragMove:x,onPaneDragEnd:S,onPaneDragCancel:ee,bodyRef:t=>{t?h.current.set(e,t):h.current.delete(e)}},e))]})}function Zm({panes:e,titles:t,shown:n,reorderable:r,draggingPane:i,dragOverPane:a,onClose:o,onPaneDragStart:s,onPaneDragMove:l,onPaneDragEnd:u,onPaneDragCancel:d}){let f=(0,j.useRef)(new Map);(0,j.useEffect)(()=>{n!==null&&f.current.get(n)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[n,e.length]);let p=(0,j.useRef)(null),m=(0,j.useRef)(!1);return(0,j.useEffect)(()=>{m.current=i!==null},[i]),(0,j.useEffect)(()=>{let e=p.current;if(!e)return;let t=e=>{m.current&&e.cancelable&&e.preventDefault()};return e.addEventListener(`touchmove`,t,{passive:!1}),()=>e.removeEventListener(`touchmove`,t)},[]),(0,$.jsx)(`div`,{ref:p,role:`tablist`,"aria-label":`Terminals`,className:`-my-1 flex min-w-0 flex-1 items-stretch self-stretch overflow-x-auto`,children:e.map((e,p)=>{let m=t[e]??`term ${p+1}`,h=e===n;return(0,$.jsxs)(`div`,{"data-pane-id":e,ref:t=>{t?f.current.set(e,t):f.current.delete(e)},role:`tab`,"aria-selected":h,title:m,onPointerDown:t=>s(t,e,{holdToDrag:!0}),onPointerMove:l,onPointerUp:u,onPointerCancel:d,onLostPointerCapture:d,className:`nc-title-target flex shrink-0 touch-pan-x items-center border-r border-ink-700 whitespace-nowrap select-none [-webkit-touch-callout:none] ${r?`cursor-grab`:``} ${i===e?`opacity-60`:``} ${a===e?`bg-ink-800 ring-1 ring-inset ring-accent`:``} ${h?`bg-ink-950 text-ink-50 shadow-[inset_0_-1px_0_0_var(--color-accent)]`:`text-ink-400 hover:bg-ink-850 hover:text-ink-200`}`,children:[(0,$.jsx)(`span`,{className:`flex min-w-0 items-center self-stretch pr-1 pl-3`,children:(0,$.jsx)(c,{title:m,className:_})}),(0,$.jsx)(`button`,{onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),o(e)},"data-tab-close":!0,title:`Close terminal`,"aria-label":`close terminal ${p+1}`,className:`mr-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:bg-ink-700 hover:text-removed`,children:(0,$.jsx)(O,{className:`h-3.5 w-3.5`})})]},e)})})}var Qm=`flex min-h-9 min-w-9 shrink-0 items-center justify-center rounded-xs border px-2 text-xs active:bg-ink-700 active:text-accent`,$m=`border-ink-700 bg-ink-850 text-ink-200`,eh=`border-accent bg-ink-700 text-accent`;function th({onKey:e,ctrl:t,alt:n,onArm:r}){(0,j.useEffect)(()=>t.clear,[t.clear]),(0,j.useEffect)(()=>n.clear,[n.clear]);let i=()=>{t.clear(),n.clear()};return(0,$.jsx)(`div`,{className:`flex shrink-0 items-stretch gap-1 overflow-x-auto border-t border-chrome-line bg-ink-900 px-1 py-1`,children:Ue.map(a=>a.kind===`latch`?(0,$.jsx)(nh,{latch:a.latch===`ctrl`?t:n,label:a.label,aria:a.aria,onArm:r},a.latch):(0,$.jsx)(`button`,{onPointerDown:e=>e.preventDefault(),onClick:()=>{i(),e(a.key)},"aria-label":a.aria,className:`${Qm} ${$m}`,children:a.label},a.key))})}function nh({latch:e,label:t,aria:n,onArm:r}){return(0,$.jsx)(`button`,{onPointerDown:e=>e.preventDefault(),onClick:()=>{e.toggle()&&r()},"aria-pressed":e.armed,"aria-label":n,className:`${Qm} ${e.armed?eh:$m}`,children:t})}function rh(e){return{lastY:e,pending:0,scrolling:!1}}function ih(e,t){let n=e.pending+(e.lastY-t);return Math.abs(n)<50?{next:{...e,lastY:t,pending:n},deltaY:0}:{next:{lastY:t,pending:0,scrolling:!0},deltaY:n}}function ah({viewsRef:e,bodyRefs:t}){let n=(0,j.useRef)(null),r=(0,j.useRef)(null),i=(0,j.useCallback)(()=>{n.current=null,r.current=null},[]),a=(0,j.useCallback)(e=>{e.pointerType===`touch`&&(n.current===null?(n.current=e.pointerId,r.current=rh(e.clientY)):i())},[i]),o=(0,j.useCallback)(i=>{if(i.pointerId!==n.current)return;let a=r.current;if(!a)return;let{next:o,deltaY:s}=ih(a,i.clientY);if(r.current=o,s===0)return;i.preventDefault();let c=i.currentTarget;sh(c,i,s,oh(c,e,t))},[e,t]),s=(0,j.useCallback)(e=>{e.pointerId===n.current&&i()},[i]);return{onPointerDown:a,onPointerMove:o,onPointerUp:s,onPointerCancel:s}}function oh(e,t,n){for(let[r,i]of n.current)if(i===e)return t.current.get(r)}function sh(e,t,n,r){let i=e.querySelector(`.xterm`);if(!i)return;let a=new WheelEvent(`wheel`,{deltaY:n,deltaMode:WheelEvent.DOM_DELTA_PIXEL,clientX:t.clientX,clientY:t.clientY,bubbles:!0,cancelable:!0,view:window});if(i.dispatchEvent(a),a.defaultPrevented||!r)return;let o=r.term.rows,s=o>0?i.clientHeight/o:0;if(s<=0)return;let c=Math.round(n/s);r.term.scrollLines(n<0?Math.min(-1,c):Math.max(1,c))}var ch=`nightcrow.paneViewMode`;function lh(){return w(d(ch))}function uh(e){f(ch,e)}function dh(){return typeof window>`u`?768:window.innerWidth}function fh(){let[e,t]=(0,j.useState)(lh),[n,r]=(0,j.useState)(dh);(0,j.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>r(window.innerWidth);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let i=oe(e,n),a=C(n);return{mode:i,toggle:(0,j.useCallback)(()=>{if(!a)return;let e=i===`tabs`?`grid`:`tabs`;uh(e),t(e)},[i,a]),canToggle:a}}var ph=`nightcrow.termKeyBar`,mh=`(pointer: coarse)`;function hh(){return Ve(d(ph))}function gh(e){f(ph,e)}function _h(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(mh).matches}function vh(){return typeof window>`u`?768:window.innerWidth}function yh(){let[e,t]=(0,j.useState)(hh),[n,r]=(0,j.useState)(_h),[i,a]=(0,j.useState)(vh);(0,j.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>a(window.innerWidth);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,j.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(mh),t=()=>r(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let o=e?e===`shown`:He(n,i);return{shown:o,toggle:(0,j.useCallback)(()=>{let e=o?`hidden`:`shown`;gh(e),t(e)},[o])}}function bh({showDivider:e,draggingUpper:t,onUpperDragStart:n,onUpperDragMove:r,onUpperDragEnd:i,onUpperDragCancel:a}){return e?(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize the terminal panel (double-click to reset)`,title:`Drag to resize · double-click to reset`,onPointerDown:n,onPointerMove:r,onPointerUp:i,onPointerCancel:a,onLostPointerCapture:i,className:`absolute -top-px left-0 z-10 hidden h-1.5 w-full cursor-row-resize touch-none md:block ${t?`bg-accent`:`hover:bg-accent`}`}):null}function xh({mode:e,onToggleMode:t,canToggleMode:n,tabs:r,ownsSize:a,maximized:o,keyBarShown:c,recovery:d,panes:f,onCancelRecovery:g,onClaimSize:_,onCreate:v,onCompose:y,onToggleKeyBar:b,onToggleMaximized:x}){let S=u(),ee=(0,j.useRef)(null),C=(0,j.useRef)(f.length);(0,j.useLayoutEffect)(()=>{let e=C.current;C.current=f.length;let t=document.activeElement===null||document.activeElement===document.body;h(f.length,e,t)&&ee.current?.focus()},[f.length]);let w=`flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent`;return(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 bg-ink-900 px-2 py-1 text-xs`,children:[Cl(d,f).map(e=>(0,$.jsx)(Km,{pane:e,report:d[e],onCancel:()=>g(e)},e)),r,!a&&(0,$.jsx)(`button`,{onClick:_,...S(`terminal.claimSizing`,`These panes are sized for another client. Resize them to fit this screen.`),"aria-label":`Fit the panes to this screen`,className:`ml-auto ${w}`,children:(0,$.jsx)(p,{})}),(0,$.jsx)(`button`,{ref:ee,onClick:v,...S(`terminal.newPane`,`New terminal`),"aria-label":`New terminal`,className:`${w} ${a?`ml-auto`:``}`,children:(0,$.jsx)(de,{})}),n&&(0,$.jsx)(`button`,{onClick:t,"aria-pressed":e===`tabs`,title:e===`tabs`?`Show the panes side by side`:`Show one pane per tab`,"aria-label":e===`tabs`?`Show the panes side by side`:`Show one pane per tab`,className:w,children:e===`tabs`?(0,$.jsx)(m,{}):(0,$.jsx)(i,{})}),f.length>0&&(0,$.jsx)(`button`,{onClick:y,...S(`terminal.composeMessage`,`Write a message to the active terminal`),"aria-label":`Write a message to the active terminal`,className:w,children:(0,$.jsx)(re,{})}),f.length>0&&(0,$.jsx)(`button`,{onClick:b,"aria-pressed":c,title:c?`Hide the key bar`:`Show the key bar`,"aria-label":c?`Hide the key bar`:`Show the key bar`,className:`${w} ${c?`text-accent`:``}`,children:(0,$.jsx)(s,{})}),(0,$.jsx)(`button`,{onClick:x,"aria-pressed":o,...S(`view.toggleMaximize`,o?`Restore panel height`:`Maximize the panel`),"aria-label":o?`Restore panel height`:`Maximize the panel`,className:`hidden md:flex ${w}`,children:(0,$.jsx)(l,{maximized:o})})]})}function Sh({repo:e,maximized:t,onToggleMaximized:n,className:r=``,sectionRef:i,...a}){let o=ht(),{containerRef:s,socketRef:c,viewsRef:l,bodyRefs:u,zoomAskedRef:d,slotRefs:f}=o,{pending:p,setPending:m,link:h,setLink:g,replayLeft:_,setReplayLeft:v,panes:y,setPanes:b,active:x,setActive:S,zoomed:ee,setZoomed:C,titles:w,setTitles:T,closing:E,setClosing:te,ownsSize:ne,setOwnsSize:re}=Ze(),O=xm(s),{scale:k}=D(),{refitEpoch:A,forceFit:ae}=Xe(h,c),oe=Sm(),{recovery:ce,setRecovery:le,cancelRecovery:ue}=Oe(c),de=We(ee,y),fe=ah({viewsRef:l,bodyRefs:u}),{mode:pe,toggle:me,canToggle:he}=fh(),ge=yh(),_e=vm(),ve=ym(),ye=_e.consume,Se=ve.consume,Ce=(0,j.useCallback)(e=>Se(ye(e)),[Se,ye]),we=pe===`tabs`,Te=we?null:de,Ee=we?null:ee,De=we?ie(x,y):de;_m({repo:e,refs:o,size:O,mode:pe,panes:y,active:x,replayLeft:_,pending:p,ownsSize:ne,keyboardOpen:oe,screenScale:k,refitEpoch:A,zoomShown:Te,zoomServer:Ee,consumeLatches:Ce,setLink:g,setPending:m,setReplayLeft:v,setPanes:b,setActive:S,setZoomed:C,setTitles:T,setOwnsSize:re,onSizeAcquired:ae,setRecovery:le});let ke=t=>{S(t),se(e,t),l.current.get(t)?.term.focus()},Ae=e=>w[e]||`terminal ${y.indexOf(e)+1}`,je=()=>x!==null&&ke(x),Me=km({socketRef:c,viewsRef:l,active:x,panes:y,onSent:e=>{_e.clear(),ve.clear(),ke(e)}}),Ne=qe({socketRef:c,viewsRef:l,zoomed:de,zoomAskedRef:d,active:x,onForceFit:ae}),{create:Pe,toggleZoom:Fe,claimSize:Ie,closePane:Le,reorder:Re,sendKey:ze}=Ne;gt({socketRef:c,panes:y,active:x,zoom:Te,link:h,commands:Ne,focusPane:ke,cancelRecovery:ue,openCompose:Me.open});let{draggingPane:Be,dragOverPane:Ve,reorderable:He,endPaneDrag:Ue,onPaneDragStart:Ge,onPaneDragMove:Ke,onPaneDragEnd:Je}=xe({panes:y,zoomed:Te,onFocus:ke,onReorder:Re}),Ye=be(y.length+_>0?y.length+_:p??0,O.w>=O.h),Qe=wm({link:h,panes:y.length,replayLeft:_,pending:p});return(0,$.jsxs)(`section`,{ref:i,"data-terminal-panel":``,className:`relative flex min-h-0 min-w-0 flex-col border-t border-chrome-line ${r}`,children:[(0,$.jsx)(bh,{...a}),(0,$.jsx)(xh,{mode:pe,onToggleMode:me,canToggleMode:he,tabs:we&&y.length>0?(0,$.jsx)(Zm,{panes:y,titles:w,shown:De,reorderable:He,draggingPane:Be,dragOverPane:Ve,onClose:te,onPaneDragStart:Ge,onPaneDragMove:Ke,onPaneDragEnd:Je,onPaneDragCancel:Ue}):void 0,ownsSize:ne,maximized:t,keyBarShown:ge.shown,recovery:ce,panes:y,onCancelRecovery:ue,onClaimSize:Ie,onCreate:Pe,onCompose:Me.open,onToggleKeyBar:ge.toggle,onToggleMaximized:n}),(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-ink-950 p-1`,children:[(0,$.jsx)(Dm,{status:Qe}),(0,$.jsx)(Xm,{containerRef:s,mode:pe,maximized:t,panes:y,titles:w,active:x,shown:De,layout:Ye,pending:p,recovery:ce,draggingPane:Be,dragOverPane:Ve,reorderable:He,bodyTouch:fe,slotRefs:f,bodyRefs:u,onFocus:ke,onToggleZoom:Fe,onClose:te,onCancelRecovery:ue,onPaneDragStart:Ge,onPaneDragMove:Ke,onPaneDragEnd:Je,onPaneDragCancel:Ue})]}),y.length>0&&ge.shown&&(0,$.jsx)(th,{onKey:ze,ctrl:_e,alt:ve,onArm:je}),(0,$.jsx)(Gm,{closing:E,panes:y,paneLabel:Ae,onConfirmClose:e=>{te(null),Le(e)},onCancelClose:()=>{te(null),je()},compose:Me})]})}var Ch=(0,j.memo)(Sh);export{Ch as TerminalPanel}; \ No newline at end of file +`:nm}function im(e,t){return e.type!==`keydown`||am.test(t)?!1:e.ctrlKey&&!e.altKey&&!e.metaKey&&(e.key===`v`||e.key===`V`)}var am=/mac|iphone|ipad|ipod/i,om=`A pane wants to put something on your clipboard.`;async function sm(e){let t=Qe(e);t.kind===`write`&&(await cm(t.text)||dm(t.text))}async function cm(e){let t=navigator.clipboard;if(t)try{return await t.writeText(e),!0}catch{}return lm(e)}function lm(e){let t=document.activeElement,n=document.createElement(`textarea`);n.value=e,n.readOnly=!0,n.style.position=`fixed`,n.style.top=`-1000px`,n.style.opacity=`0`,document.body.appendChild(n),n.select();let r=!1;try{r=document.execCommand(`copy`)}catch{r=!1}return n.remove(),t instanceof HTMLElement&&t.focus(),r}var um=null;function dm(e){um=e;let t=b.info(om,{sticky:!0,action:{label:`Copy`,run:()=>{let e=um;e!==null&&cm(e).then(n=>{n&&um===e&&(um=null,te(t))})}}})}function fm(e,t=250){let n=null,r=0,i=null,a=null,o=()=>{a!==null&&clearTimeout(a),a=null},s=t=>{n=t,r=Date.now(),e(t)},c=()=>{if(a=null,i===null)return;let e=i;i=null,e!==n&&s(e)};return{push(e){if(e===n){i=null,o();return}let l=Date.now()-r;r===0||l>=t?(i=null,o(),s(e)):(i=e,a===null&&(a=setTimeout(c,t-l)))},cancel(){o(),i=null}}}function pm(e,t){let n;try{n=t()}catch{return!1}let r=n.onContextLoss(()=>n.dispose());try{e.loadAddon(n)}catch{return r.dispose(),n.dispose(),!1}return!0}function mm(e,t=document){let n=()=>{t.visibilityState===`visible`&&e.clearTextureAtlas()};return{activate(){t.addEventListener(`visibilitychange`,n)},dispose(){t.removeEventListener(`visibilitychange`,n)}}}var hm=new Set([20,229,16,17,18]);function gm(e){let t=e.parentElement;if(!t)return{dispose(){},noteKeyPassedToXterm(){}};let n=!1,r=0,i,a=()=>{i!==void 0&&clearTimeout(i),i=void 0},o=t=>{t.target===e&&(r++,n=!0,a())},s=t=>{if(t.target!==e||!n)return;let a=r;i=setTimeout(()=>{i=void 0,r===a&&(n=!1)},0)},c=t=>{let r=t;n&&t.target===e&&r.inputType===`insertText`&&t.stopImmediatePropagation()};return t.addEventListener(`compositionstart`,o),t.addEventListener(`compositionend`,s),t.addEventListener(`input`,c,!0),{noteKeyPassedToXterm(e){e.type===`keydown`&&!hm.has(e.keyCode)&&n&&(r++,n=!1,a())},dispose(){n=!1,r++,a(),t.removeEventListener(`compositionstart`,o),t.removeEventListener(`compositionend`,s),t.removeEventListener(`input`,c,!0)}}}function _m({panes:e,size:t,zoomed:n,mode:r,screenScale:i,socketRef:a,viewsRef:o,bodyRefs:s,pendingRef:c,replayRef:l,ptySizesRef:u,consumeLatches:d,setTitles:f}){let p=(0,j.useRef)(new Map);(0,j.useEffect)(()=>{let e=p.current;return()=>e.forEach(e=>e.cancel())},[]),(0,j.useEffect)(()=>{let t=fl(i);for(let n of e){let e=o.current.get(n);if(e){e.term.options.fontSize!==t.fontSize&&(e.term.options.fontSize=t.fontSize),e.term.options.fontFamily!==t.fontFamily&&(e.term.options.fontFamily=t.fontFamily);continue}let r=s.current.get(n);if(!r)continue;let i=new cl({...t,theme:{background:`#111112`,foreground:`#f2f2f3`},allowTransparency:!0,cursorBlink:!0,macOptionIsMeta:!1,macOptionClickForcesSelection:!0}),m=new dl;i.loadAddon(m);let h=new tm,g=null;i.attachCustomKeyEventHandler(e=>{if(h.noteKey(e,performance.now()),im(e,navigator.platform))return!1;let t=rm(e);return t===null?(g?.noteKeyPassedToXterm(e),!0):(i.input(t),!1)}),i.onData(e=>{let t=h.report(e,performance.now()),r=d(e);Ee(a.current,{type:`input`,pane:n,data:r})&&t&&Ee(a.current,{type:`clear_key_report`,pane:n,...t})});let _=pt(i,l.current.panes.has(n),e=>{sm(e).catch(e=>{console.error(`nightcrow: a pane's clipboard request failed`,e)})}),v=fm(e=>{f(t=>t[n]===e?t:{...t,[n]:e})});p.current.set(n,v),i.onTitleChange(e=>{let t=e.replace(/\s+/g,` `).trim();t&&v.push(t)}),i.open(r),i.textarea&&(g=gm(i.textarea),i.loadAddon({activate(){},dispose(){g?.dispose()}})),pm(i,()=>new Qp),i.loadAddon(mm(i));let y=u.current.get(n);y&&i.resize(y.cols,y.rows);let b={term:i,fit:m,replayGate:_};o.current.set(n,b);let x=c.current.get(n);if(x){for(let e of x)e instanceof Uint8Array?ct(i,e):dt(i,b.replayGate,()=>{o.current.get(n)===b&&l.current.panes.get(n)===e.token&&l.current.panes.delete(n)});c.current.delete(n),lt(i,()=>i.scrollToBottom())}}for(let[t,n]of o.current)e.includes(t)||(p.current.get(t)?.cancel(),p.current.delete(t),ut(n.term),n.term.dispose(),o.current.delete(t))},[e,t,n,r,i,a,o,s,c,l,u,d,f])}function vm({repo:e,refs:t,size:n,mode:r,panes:i,active:a,replayLeft:o,pending:s,ownsSize:c,keyboardOpen:l,screenScale:u,refitEpoch:d,zoomShown:f,zoomServer:p,consumeLatches:m,setLink:h,setPending:g,setReplayLeft:_,setPanes:v,setActive:y,setZoomed:b,setTitles:x,setOwnsSize:S,onSizeAcquired:ee,setRecovery:C}){let{containerRef:w,socketRef:T,viewsRef:E,bodyRefs:te,ptySizesRef:D,askedSizesRef:ne,desiredSizesRef:re,ownsSizeRef:ie,sizeOwnerGenerationRef:O,pendingRef:k,replayRef:A,zoomAskedRef:ae,slotRefs:oe}=t;kl({repo:e,socketRef:T,viewsRef:E,pendingRef:k,replayRef:A,ptySizesRef:D,askedSizesRef:ne,desiredSizesRef:re,ownsSizeRef:ie,sizeOwnerGenerationRef:O,zoomAskedRef:ae,setLink:h,setPending:g,setReplayLeft:_,setPanes:v,setActive:y,setZoomed:b,setTitles:x,setOwnsSize:S,onSizeAcquired:ee,setRecovery:C}),Bl({containerRef:w,socketRef:T,viewsRef:E}),_m({panes:i,size:n,zoomed:f,mode:r,screenScale:u,socketRef:T,viewsRef:E,bodyRefs:te,pendingRef:k,replayRef:A,ptySizesRef:D,consumeLatches:m,setTitles:x});let se=(0,j.useCallback)(()=>g(null),[g]);pl({pending:s,size:n,screenScale:u,socketRef:T,slotRefs:oe,panesExist:i.length>0,onAnswered:se}),St({panes:i,size:n,zoomed:f,mode:r,screenScale:u,socketRef:T,viewsRef:E,bodyRefs:te,ptySizesRef:D,askedSizesRef:ne,desiredSizesRef:re,ownsSize:c,layoutPending:Ge(p,i),keyboardOpen:l,refitEpoch:d}),yt({panes:i,viewsRef:E,bodyRefs:te,keyboardOpen:l,size:n,zoomed:f,mode:r}),bt({repo:e,panes:i,replayLeft:o,active:a,setActive:y,zoomed:p,zoom:f,viewsRef:E,panelRef:w,size:n,mode:r})}var ym=()=>xm(ze),bm=()=>xm(Be);function xm(e){let[t,n]=(0,j.useState)(!1),r=(0,j.useRef)(!1),i=(0,j.useCallback)(e=>{r.current=e,n(e)},[]),a=(0,j.useCallback)(t=>{let n=e(r.current,t);return n.armed!==r.current&&i(n.armed),n.data},[e,i]);return{armed:t,toggle:(0,j.useCallback)(()=>{let e=!r.current;return i(e),e},[i]),clear:(0,j.useCallback)(()=>i(!1),[i]),consume:a}}function Sm(e){let[t,n]=(0,j.useState)({w:0,h:0});return(0,j.useEffect)(()=>{let t=e.current;if(!t)return;let r=new ResizeObserver(()=>{let e=t.clientWidth,r=t.clientHeight;n(t=>t.w===e&&t.h===r?t:{w:e,h:r})});return r.observe(t),()=>r.disconnect()},[e]),t}function Cm(e=window){return(0,j.useSyncExternalStore)(t=>wm(e,t),()=>x(e)>0,()=>!1)}function wm(e,t){let n=e.visualViewport;return e.addEventListener(`resize`,t),n?.addEventListener(`resize`,t),n?.addEventListener(`scroll`,t),()=>{e.removeEventListener(`resize`,t),n?.removeEventListener(`resize`,t),n?.removeEventListener(`scroll`,t)}}function Tm({link:e,panes:t,replayLeft:n,pending:r}){return e===`live`?n>0?{kind:`attaching`,left:n}:t>0?{kind:`ready`}:r===null?{kind:`empty`}:{kind:`starting`,count:r}:{kind:e}}function Em(e){switch(e.kind){case`connecting`:return`Connecting…`;case`reconnecting`:return`Reconnecting…`;case`attaching`:return`Attaching ${Dm(e.left)}…`;case`starting`:return`Starting ${Dm(e.count)}…`;case`empty`:case`ready`:return null}}function Dm(e){return`${e} terminal${e===1?``:`s`}`}var $=e();function Om({status:e}){if(e.kind===`empty`)return(0,$.jsxs)(`p`,{className:`p-3 text-ink-400`,children:[`No terminal open. Press `,(0,$.jsx)(`span`,{className:`text-accent`,children:`+`}),` above to start one.`]});let t=e.kind===`starting`?null:Em(e);return t?(0,$.jsx)(`div`,{role:`status`,className:`pointer-events-none absolute inset-0 z-10 flex items-center justify-center p-6`,children:(0,$.jsxs)(`span`,{className:`flex animate-pulse items-center gap-2 rounded-md bg-ink-950/80 px-3 py-2 text-caption text-ink-400 uppercase`,children:[(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-accent`}),t]})}):null}var km=100;function Am({socketRef:e,viewsRef:t,active:n,panes:r,onSent:i}){let[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)({}),[l,u]=(0,j.useState)(!1),d=(0,j.useRef)(null),f=(0,j.useRef)(r),p=(0,j.useRef)(0),m=(0,j.useRef)(!1);f.current=r;let h=a!==null&&r.includes(a)?a:null,g=h===null?``:s[h]??``,_=()=>{p.current+=1,m.current=!1,u(!1)};(0,j.useEffect)(()=>()=>{p.current+=1,m.current=!1,d.current=null},[]),(0,j.useEffect)(()=>{a!==null&&!r.includes(a)&&(d.current=null,_(),o(null))},[a,r]);let v=e=>{h!==null&&c(t=>({...t,[h]:e}))};return{target:h,draft:g,setDraft:v,open:()=>{d.current===null&&n!==null&&(_(),d.current=n,o(n))},close:()=>{d.current=null,_(),o(null)},send:()=>{if(h===null||m.current||!Pl(g))return!1;let n=t.current.get(h)?.term.modes.bracketedPasteMode??!1,r=Nl(g,n);return Ee(e.current,{type:`input`,pane:h,data:r})?(window.setTimeout(()=>{Ee(e.current,{type:`input`,pane:h,data:`\r`})},km),v(``),d.current=null,_(),o(null),i(h),!0):!1},attachImage:async e=>{if(h===null||m.current)return;if(!Il.includes(e.type)){b.error(`Choose a PNG, JPEG, GIF, or WebP image.`);return}if(e.size>10485760){b.error(`Image must be 10 MiB or smaller.`);return}let t=h,n=p.current,r=()=>n===p.current&&d.current===t&&f.current.includes(t);m.current=!0,u(!0);try{let n=await _e.pasteImage(e);if(!n)throw Error(`the server returned no image path`);if(!r())return;c(e=>{let r=e[t]??``,i=r.length>0&&!/\s$/.test(r)?` `:``;return{...e,[t]:`${r}${i}${Rl(n)}`}})}catch(e){r()&&b.error(e instanceof Error?`Could not attach image: ${e.message}`:`Could not attach image.`)}finally{r()&&(m.current=!1,u(!1))}},uploading:l}}var jm=ge();function Mm(){let e=window,t=e.SpeechRecognition??e.webkitSpeechRecognition;return t?()=>new t:null}function Nm(e,t){return t?e?`ready`:`insecure`:`unsupported`}function Pm(e){let t=``;for(let n=e.resultIndex;n{i.current?.stop()},[]),s=(0,j.useCallback)(()=>{if(!e||i.current)return;let t;try{t=e()}catch{Rm(`unavailable`);return}t.lang=navigator.language,t.continuous=!1,t.interimResults=!1,t.onresult=e=>{let t=Pm(e);t&&a.current(t)},t.onerror=e=>Rm(e.error),t.onend=()=>{i.current===t&&(i.current=null),r(!1)};try{t.start()}catch{Rm(`start-failed`);return}i.current=t,r(!0)},[e]);return(0,j.useEffect)(()=>()=>{let e=i.current;i.current=null,e&&(e.onend=null,e.onresult=null,e.onerror=null,e.abort())},[]),{listening:n,toggle:n?o:s}}var Bm=`flex h-11 w-11 shrink-0 items-center justify-center rounded-sm hover:text-accent`;function Vm({availability:e,factory:t,onText:n}){let{listening:r,toggle:i}=zm(e===`ready`?t:null,n);if(e===`unsupported`)return null;let a=e===`ready`;return(0,$.jsx)(`button`,{type:`button`,onClick:a?i:void 0,"aria-disabled":!a||void 0,"aria-pressed":a?r:void 0,"aria-label":a?r?`Stop voice input`:`Voice input`:`Voice input needs HTTPS`,title:a?r?`Stop voice input`:`Voice input`:Lm,className:`${Bm} ${r?`animate-pulse text-accent`:a?`text-ink-400`:`text-ink-600`}`,children:(0,$.jsx)(ee,{})})}function Hm(){let[e,t]=(0,j.useState)(null),n=(0,j.useRef)(new Map);return(0,j.useEffect)(()=>T(e=>{let r=e.filter(e=>e.kind===`error`),i=r.filter(e=>n.current.get(e.id)!==e.bump);n.current=new Map(r.map(e=>[e.id,e.bump])),i.length>0?t(i[i.length-1]):t(e=>e&&n.current.has(e.id)?e:null)}),[]),(0,$.jsx)(`div`,{className:`sr-only`,children:e&&(0,$.jsx)(`p`,{role:`alert`,children:e.message},`${e.id}-${e.bump}`)})}var Um=`nc-compose-title`;function Wm(){let e=navigator;return e.userAgentData?.platform||e.platform||``}function Gm({label:e,draft:t,onChange:n,onSend:r,onAttachImage:i,uploading:a,onClose:o,dictation:s}){let c=(0,j.useRef)(null),l=(0,j.useRef)(null),u=Pl(t)&&!a,d=Fl(Wm()),[f]=(0,j.useState)(()=>{if(s)return s;let e=Mm();return{availability:Nm(window.isSecureContext,e),factory:e}});(0,j.useEffect)(()=>{let e=c.current;e?.focus(),e?.setSelectionRange(e.value.length,e.value.length)},[]),(0,j.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!e.isComposing&&o()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[o]);let p=()=>{u&&!r()&&b.error(`Not connected — nothing was sent.`)};return(0,jm.createPortal)((0,$.jsx)(`div`,{className:`nc-fade-in fixed inset-0 z-50 flex items-start justify-center bg-black/60 p-4 pt-[8vh]`,onClick:o,children:(0,$.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":Um,className:`nc-rise-in flex w-[56rem] max-w-full flex-col rounded-lg border border-ink-700 bg-ink-900`,onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(Hm,{}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-ink-700 px-3 py-2`,children:[(0,$.jsxs)(`span`,{id:Um,className:`min-w-0 truncate font-medium text-ink-50`,children:[`Send to `,e]}),(0,$.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`close`,className:`ml-auto flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-ink-200`,children:(0,$.jsx)(O,{})})]}),(0,$.jsx)(`textarea`,{ref:c,value:t,onChange:e=>{n(e.target.value)},onKeyDown:e=>{e.key!==`Enter`||e.nativeEvent.isComposing||(e.metaKey||e.ctrlKey)&&(e.preventDefault(),p())},rows:8,"aria-label":`message`,className:`m-3 resize-none overflow-y-auto rounded-sm border border-ink-700 bg-ink-950 p-2 font-mono text-[16px] text-ink-50 focus:border-accent focus:outline-none`}),(0,$.jsx)(`input`,{ref:l,type:`file`,accept:Il.join(`,`),"aria-label":`Choose an image`,tabIndex:-1,className:`hidden`,onChange:e=>{let t=e.currentTarget.files?.[0];e.currentTarget.value=``,t&&i(t)}}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 pb-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>l.current?.click(),disabled:a,"aria-label":`Attach image`,title:`Attach image`,className:`${Bm} text-ink-400 disabled:text-ink-600 disabled:hover:text-ink-600`,children:(0,$.jsx)(ae,{})}),(0,$.jsx)(Vm,{availability:f.availability,factory:f.factory,onText:e=>{n(Fm(t,e))}}),a&&(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-ink-300`,children:`Uploading image…`}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>{n(``),c.current?.focus()},disabled:t.length===0,className:`min-h-11 rounded-sm px-3 text-ink-200 hover:text-ink-50 disabled:text-ink-600`,children:`Clear`}),(0,$.jsxs)(`button`,{type:`button`,onClick:p,disabled:!u,title:`Send and run (${d})`,"aria-keyshortcuts":`Meta+Enter Control+Enter`,className:`flex min-h-11 items-center gap-1.5 rounded-sm bg-accent px-3 py-1.5 font-medium text-ink-950 disabled:bg-ink-700 disabled:text-ink-400`,children:[(0,$.jsx)(`kbd`,{"aria-hidden":`true`,className:`font-sans opacity-70`,children:d}),`Send`]})]})]})]})}),document.body)}function Km({closing:e,panes:t,paneLabel:n,onConfirmClose:r,onCancelClose:i,compose:a}){return(0,$.jsxs)($.Fragment,{children:[e!==null&&t.includes(e)&&(0,$.jsx)(fe,{label:n(e),detail:`The process running in it will be terminated.`,onConfirm:()=>r(e),onCancel:i}),a.target!==null&&(0,$.jsx)(Gm,{label:n(a.target),draft:a.draft,onChange:a.setDraft,onSend:a.send,onAttachImage:a.attachImage,uploading:a.uploading,onClose:a.close})]})}function qm({report:e,pane:t,onCancel:n}){let r=t===void 0?Tl(e):`pane ${t} · ${Tl(e)}`;return(0,$.jsxs)(`span`,{className:`flex min-w-0 shrink items-center gap-1 rounded-sm bg-ink-800 px-1 text-accent`,title:e.detail??r,children:[(0,$.jsx)(`span`,{className:`truncate`,children:r}),e.detail&&(0,$.jsx)(`span`,{className:`hidden min-w-0 truncate text-ink-400 md:inline`,children:e.detail}),(0,$.jsx)(`button`,{onMouseDown:e=>e.stopPropagation(),onClick:n,title:`Stop waiting and release this pane's slot`,"aria-label":`cancel recovery${t===void 0?``:` for pane ${t}`}`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-removed`,children:(0,$.jsx)(O,{className:`h-3 w-3`})})]})}function Jm({pane:e,index:t,label:n,cellStyle:r,isActive:i,isZoomed:a,showZoom:o,isDragged:s,isDropTarget:d,reorderable:f,showHeader:p,recovery:m,onCancelRecovery:h,onFocus:g,onToggleZoom:_,onClose:v,onPaneDragStart:y,onPaneDragMove:b,onPaneDragEnd:x,onPaneDragCancel:S,bodyRef:ee,bodyTouch:C}){let w=u(),T=(e,t)=>i?w(e,t):{title:t};return(0,$.jsxs)(`div`,{"data-pane-id":e,"data-pane-cell":!0,onMouseDown:g,style:r,className:`nc-cell-in relative min-h-0 min-w-0 flex-col overflow-hidden rounded-sm border ${d?`border-accent ring-1 ring-accent`:i?`border-accent`:`border-ink-700`} ${s?`opacity-60`:``}`,children:[!p&&m&&(0,$.jsx)(`div`,{className:`absolute top-1 right-1 z-10 text-xs`,children:(0,$.jsx)(qm,{report:m,onCancel:h})}),p&&(0,$.jsxs)(`div`,{onPointerDown:y,onPointerMove:b,onPointerUp:x,onPointerCancel:S,"data-active":i,className:`nc-title-target flex shrink-0 items-center gap-1 select-none bg-ink-900 px-2 py-0.5 text-xs ${f?s?`cursor-grabbing touch-none`:`cursor-grab touch-none`:``}`,children:[(0,$.jsx)(`span`,{title:n,className:`min-w-0 flex-1 ${i?`text-ink-50`:`text-ink-400`}`,children:(0,$.jsx)(c,{title:n})}),m&&(0,$.jsx)(qm,{report:m,onCancel:h}),o&&(0,$.jsx)(`button`,{onMouseDown:e=>e.stopPropagation(),onClick:_,"aria-pressed":a,...T(`view.toggleMaximize`,a?`Restore the grid`:`Zoom this terminal`),"aria-label":a?`Restore the grid`:`Zoom this terminal`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent md:h-6 md:w-6`,children:(0,$.jsx)(l,{maximized:a})}),(0,$.jsx)(`button`,{onMouseDown:e=>e.stopPropagation(),onClick:v,...T(`terminal.closePane`,`Close terminal`),"aria-label":`close terminal ${t+1}`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-removed md:h-6 md:w-6`,children:(0,$.jsx)(O,{})})]}),(0,$.jsx)(`div`,{ref:ee,...C,className:`nc-pane-body flex min-h-0 flex-1 flex-col justify-end overflow-hidden touch-pinch-zoom`})]})}function Ym({count:e,slotStyle:t,showHeader:n,bodyTouch:r,slotRefs:i}){return Array.from({length:e},(e,a)=>(0,$.jsx)(Jm,{pane:-1-a,index:a,label:`starting…`,cellStyle:t(a),isActive:!1,isZoomed:!1,showZoom:!1,isDragged:!1,isDropTarget:!1,reorderable:!1,showHeader:n,bodyTouch:r,onCancelRecovery:()=>{},onFocus:()=>{},onToggleZoom:()=>{},onClose:()=>{},onPaneDragStart:()=>{},onPaneDragMove:()=>{},onPaneDragEnd:()=>{},onPaneDragCancel:()=>{},bodyRef:e=>{e?i.current.set(a,e):i.current.delete(a)}},`slot-${a}`))}function Xm(e,t){let n=(0,j.useRef)(t);(0,j.useLayoutEffect)(()=>{n.current!==t&&(n.current=t,Pe(e.current))},[e,t])}function Zm({containerRef:e,mode:t,panes:n,titles:r,active:i,shown:a,layout:o,pending:s,maximized:c=!1,recovery:l,draggingPane:u,dragOverPane:d,reorderable:f,bodyTouch:p,slotRefs:m,bodyRefs:h,onFocus:g,onToggleZoom:_,onClose:v,onCancelRecovery:y,onPaneDragStart:b,onPaneDragMove:x,onPaneDragEnd:S,onPaneDragCancel:ee}){let C=t===`tabs`;Xm(e,`${t}:${a}:${o.cols}x${o.rows}:${c}`);let w=e=>{let t=o.cells[e];return{display:`flex`,gridColumn:`${t.colStart} / span ${t.colSpan}`,gridRow:`${t.row}`}},T=(e,t)=>C?E(e===a):a===null?w(t):{display:e===a?`flex`:`none`};return(0,$.jsxs)(`div`,{ref:e,className:C?ue:`grid h-full gap-1`,style:C?void 0:a===null?{gridTemplateColumns:`repeat(${o.cols}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${o.rows}, minmax(0, 1fr))`}:{gridTemplateColumns:`1fr`,gridTemplateRows:`1fr`},children:[n.length===0&&s!==null&&(0,$.jsx)(Ym,{count:s,showHeader:!C,bodyTouch:p,slotStyle:e=>C?E(e===0):w(e),slotRefs:m}),n.map((e,t)=>(0,$.jsx)(Jm,{pane:e,index:t,label:r[e]??`term ${t+1}`,cellStyle:T(e,t),isActive:e===i,isZoomed:!C&&a===e,showZoom:!C&&n.length>1,isDragged:u===e,isDropTarget:d===e,reorderable:f,showHeader:!C,bodyTouch:p,recovery:l[e],onCancelRecovery:()=>y(e),onFocus:()=>g(e),onToggleZoom:()=>_(e),onClose:()=>v(e),onPaneDragStart:t=>b(t,e),onPaneDragMove:x,onPaneDragEnd:S,onPaneDragCancel:ee,bodyRef:t=>{t?h.current.set(e,t):h.current.delete(e)}},e))]})}function Qm({panes:e,titles:t,shown:n,reorderable:r,draggingPane:i,dragOverPane:a,onClose:o,onPaneDragStart:s,onPaneDragMove:l,onPaneDragEnd:u,onPaneDragCancel:d}){let f=(0,j.useRef)(new Map);(0,j.useEffect)(()=>{n!==null&&f.current.get(n)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[n,e.length]);let p=(0,j.useRef)(null),m=(0,j.useRef)(!1);return(0,j.useEffect)(()=>{m.current=i!==null},[i]),(0,j.useEffect)(()=>{let e=p.current;if(!e)return;let t=e=>{m.current&&e.cancelable&&e.preventDefault()};return e.addEventListener(`touchmove`,t,{passive:!1}),()=>e.removeEventListener(`touchmove`,t)},[]),(0,$.jsx)(`div`,{ref:p,role:`tablist`,"aria-label":`Terminals`,className:`-my-1 flex min-w-0 flex-1 items-stretch self-stretch overflow-x-auto`,children:e.map((e,p)=>{let m=t[e]??`term ${p+1}`,h=e===n;return(0,$.jsxs)(`div`,{"data-pane-id":e,ref:t=>{t?f.current.set(e,t):f.current.delete(e)},role:`tab`,"aria-selected":h,title:m,onPointerDown:t=>s(t,e,{holdToDrag:!0}),onPointerMove:l,onPointerUp:u,onPointerCancel:d,onLostPointerCapture:d,className:`nc-title-target flex shrink-0 touch-pan-x items-center border-r border-ink-700 whitespace-nowrap select-none [-webkit-touch-callout:none] ${r?`cursor-grab`:``} ${i===e?`opacity-60`:``} ${a===e?`bg-ink-800 ring-1 ring-inset ring-accent`:``} ${h?`bg-ink-950 text-ink-50 shadow-[inset_0_-1px_0_0_var(--color-accent)]`:`text-ink-400 hover:bg-ink-850 hover:text-ink-200`}`,children:[(0,$.jsx)(`span`,{className:`flex min-w-0 items-center self-stretch pr-1 pl-3`,children:(0,$.jsx)(c,{title:m,className:_})}),(0,$.jsx)(`button`,{onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),o(e)},"data-tab-close":!0,title:`Close terminal`,"aria-label":`close terminal ${p+1}`,className:`mr-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:bg-ink-700 hover:text-removed`,children:(0,$.jsx)(O,{className:`h-3.5 w-3.5`})})]},e)})})}var $m=`flex min-h-9 min-w-9 shrink-0 items-center justify-center rounded-xs border px-2 text-xs active:bg-ink-700 active:text-accent`,eh=`border-ink-700 bg-ink-850 text-ink-200`,th=`border-accent bg-ink-700 text-accent`;function nh({onKey:e,ctrl:t,alt:n,onArm:r}){(0,j.useEffect)(()=>t.clear,[t.clear]),(0,j.useEffect)(()=>n.clear,[n.clear]);let i=()=>{t.clear(),n.clear()};return(0,$.jsx)(`div`,{className:`flex shrink-0 items-stretch gap-1 overflow-x-auto border-t border-chrome-line bg-ink-900 px-1 py-1`,children:Ue.map(a=>a.kind===`latch`?(0,$.jsx)(rh,{latch:a.latch===`ctrl`?t:n,label:a.label,aria:a.aria,onArm:r},a.latch):(0,$.jsx)(`button`,{onPointerDown:e=>e.preventDefault(),onClick:()=>{i(),e(a.key)},"aria-label":a.aria,className:`${$m} ${eh}`,children:a.label},a.key))})}function rh({latch:e,label:t,aria:n,onArm:r}){return(0,$.jsx)(`button`,{onPointerDown:e=>e.preventDefault(),onClick:()=>{e.toggle()&&r()},"aria-pressed":e.armed,"aria-label":n,className:`${$m} ${e.armed?th:eh}`,children:t})}function ih(e){return{lastY:e,pending:0,scrolling:!1}}function ah(e,t){let n=e.pending+(e.lastY-t);return Math.abs(n)<50?{next:{...e,lastY:t,pending:n},deltaY:0}:{next:{lastY:t,pending:0,scrolling:!0},deltaY:n}}function oh({viewsRef:e,bodyRefs:t}){let n=(0,j.useRef)(null),r=(0,j.useRef)(null),i=(0,j.useCallback)(()=>{n.current=null,r.current=null},[]),a=(0,j.useCallback)(e=>{e.pointerType===`touch`&&(n.current===null?(n.current=e.pointerId,r.current=ih(e.clientY)):i())},[i]),o=(0,j.useCallback)(i=>{if(i.pointerId!==n.current)return;let a=r.current;if(!a)return;let{next:o,deltaY:s}=ah(a,i.clientY);if(r.current=o,s===0)return;i.preventDefault();let c=i.currentTarget;ch(c,i,s,sh(c,e,t))},[e,t]),s=(0,j.useCallback)(e=>{e.pointerId===n.current&&i()},[i]);return{onPointerDown:a,onPointerMove:o,onPointerUp:s,onPointerCancel:s}}function sh(e,t,n){for(let[r,i]of n.current)if(i===e)return t.current.get(r)}function ch(e,t,n,r){let i=e.querySelector(`.xterm`);if(!i)return;let a=new WheelEvent(`wheel`,{deltaY:n,deltaMode:WheelEvent.DOM_DELTA_PIXEL,clientX:t.clientX,clientY:t.clientY,bubbles:!0,cancelable:!0,view:window});if(i.dispatchEvent(a),a.defaultPrevented||!r)return;let o=r.term.rows,s=o>0?i.clientHeight/o:0;if(s<=0)return;let c=Math.round(n/s);r.term.scrollLines(n<0?Math.min(-1,c):Math.max(1,c))}var lh=`nightcrow.paneViewMode`;function uh(){return w(d(lh))}function dh(e){f(lh,e)}function fh(){return typeof window>`u`?768:window.innerWidth}function ph(){let[e,t]=(0,j.useState)(uh),[n,r]=(0,j.useState)(fh);(0,j.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>r(window.innerWidth);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let i=oe(e,n),a=C(n);return{mode:i,toggle:(0,j.useCallback)(()=>{if(!a)return;let e=i===`tabs`?`grid`:`tabs`;dh(e),t(e)},[i,a]),canToggle:a}}var mh=`nightcrow.termKeyBar`,hh=`(pointer: coarse)`;function gh(){return Ve(d(mh))}function _h(e){f(mh,e)}function vh(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(hh).matches}function yh(){return typeof window>`u`?768:window.innerWidth}function bh(){let[e,t]=(0,j.useState)(gh),[n,r]=(0,j.useState)(vh),[i,a]=(0,j.useState)(yh);(0,j.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>a(window.innerWidth);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,j.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(hh),t=()=>r(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let o=e?e===`shown`:He(n,i);return{shown:o,toggle:(0,j.useCallback)(()=>{let e=o?`hidden`:`shown`;_h(e),t(e)},[o])}}function xh({showDivider:e,draggingUpper:t,onUpperDragStart:n,onUpperDragMove:r,onUpperDragEnd:i,onUpperDragCancel:a}){return e?(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize the terminal panel (double-click to reset)`,title:`Drag to resize · double-click to reset`,onPointerDown:n,onPointerMove:r,onPointerUp:i,onPointerCancel:a,onLostPointerCapture:i,className:`absolute -top-px left-0 z-10 hidden h-1.5 w-full cursor-row-resize touch-none md:block ${t?`bg-accent`:`hover:bg-accent`}`}):null}function Sh({mode:e,onToggleMode:t,canToggleMode:n,tabs:r,ownsSize:a,maximized:o,keyBarShown:c,recovery:d,panes:f,onCancelRecovery:g,onClaimSize:_,onCreate:v,onCompose:y,onToggleKeyBar:b,onToggleMaximized:x}){let S=u(),ee=(0,j.useRef)(null),C=(0,j.useRef)(f.length);(0,j.useLayoutEffect)(()=>{let e=C.current;C.current=f.length;let t=document.activeElement===null||document.activeElement===document.body;h(f.length,e,t)&&ee.current?.focus()},[f.length]);let w=`flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent`;return(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 bg-ink-900 px-2 py-1 text-xs`,children:[Cl(d,f).map(e=>(0,$.jsx)(qm,{pane:e,report:d[e],onCancel:()=>g(e)},e)),r,!a&&(0,$.jsx)(`button`,{onClick:_,...S(`terminal.claimSizing`,`These panes are sized for another client. Resize them to fit this screen.`),"aria-label":`Fit the panes to this screen`,className:`ml-auto ${w}`,children:(0,$.jsx)(p,{})}),(0,$.jsx)(`button`,{ref:ee,onClick:v,...S(`terminal.newPane`,`New terminal`),"aria-label":`New terminal`,className:`${w} ${a?`ml-auto`:``}`,children:(0,$.jsx)(de,{})}),n&&(0,$.jsx)(`button`,{onClick:t,"aria-pressed":e===`tabs`,title:e===`tabs`?`Show the panes side by side`:`Show one pane per tab`,"aria-label":e===`tabs`?`Show the panes side by side`:`Show one pane per tab`,className:w,children:e===`tabs`?(0,$.jsx)(m,{}):(0,$.jsx)(i,{})}),f.length>0&&(0,$.jsx)(`button`,{onClick:y,...S(`terminal.composeMessage`,`Write a message to the active terminal`),"aria-label":`Write a message to the active terminal`,className:w,children:(0,$.jsx)(re,{})}),f.length>0&&(0,$.jsx)(`button`,{onClick:b,"aria-pressed":c,title:c?`Hide the key bar`:`Show the key bar`,"aria-label":c?`Hide the key bar`:`Show the key bar`,className:`${w} ${c?`text-accent`:``}`,children:(0,$.jsx)(s,{})}),(0,$.jsx)(`button`,{onClick:x,"aria-pressed":o,...S(`view.toggleMaximize`,o?`Restore panel height`:`Maximize the panel`),"aria-label":o?`Restore panel height`:`Maximize the panel`,className:`hidden md:flex ${w}`,children:(0,$.jsx)(l,{maximized:o})})]})}function Ch({repo:e,maximized:t,onToggleMaximized:n,className:r=``,sectionRef:i,...a}){let o=ht(),{containerRef:s,socketRef:c,viewsRef:l,bodyRefs:u,zoomAskedRef:d,slotRefs:f}=o,{pending:p,setPending:m,link:h,setLink:g,replayLeft:_,setReplayLeft:v,panes:y,setPanes:b,active:x,setActive:S,zoomed:ee,setZoomed:C,titles:w,setTitles:T,closing:E,setClosing:te,ownsSize:ne,setOwnsSize:re}=Ze(),O=Sm(s),{scale:k}=D(),{refitEpoch:A,forceFit:ae}=Xe(h,c),oe=Cm(),{recovery:ce,setRecovery:le,cancelRecovery:ue}=Oe(c),de=We(ee,y),fe=oh({viewsRef:l,bodyRefs:u}),{mode:pe,toggle:me,canToggle:he}=ph(),ge=bh(),_e=ym(),ve=bm(),ye=_e.consume,Se=ve.consume,Ce=(0,j.useCallback)(e=>Se(ye(e)),[Se,ye]),we=pe===`tabs`,Te=we?null:de,Ee=we?null:ee,De=we?ie(x,y):de;vm({repo:e,refs:o,size:O,mode:pe,panes:y,active:x,replayLeft:_,pending:p,ownsSize:ne,keyboardOpen:oe,screenScale:k,refitEpoch:A,zoomShown:Te,zoomServer:Ee,consumeLatches:Ce,setLink:g,setPending:m,setReplayLeft:v,setPanes:b,setActive:S,setZoomed:C,setTitles:T,setOwnsSize:re,onSizeAcquired:ae,setRecovery:le});let ke=t=>{S(t),se(e,t),l.current.get(t)?.term.focus()},Ae=e=>w[e]||`terminal ${y.indexOf(e)+1}`,je=()=>x!==null&&ke(x),Me=Am({socketRef:c,viewsRef:l,active:x,panes:y,onSent:e=>{_e.clear(),ve.clear(),ke(e)}}),Ne=qe({socketRef:c,viewsRef:l,zoomed:de,zoomAskedRef:d,active:x,onForceFit:ae}),{create:Pe,toggleZoom:Fe,claimSize:Ie,closePane:Le,reorder:Re,sendKey:ze}=Ne;gt({socketRef:c,panes:y,active:x,zoom:Te,link:h,commands:Ne,focusPane:ke,cancelRecovery:ue,openCompose:Me.open});let{draggingPane:Be,dragOverPane:Ve,reorderable:He,endPaneDrag:Ue,onPaneDragStart:Ge,onPaneDragMove:Ke,onPaneDragEnd:Je}=xe({panes:y,zoomed:Te,onFocus:ke,onReorder:Re}),Ye=be(y.length+_>0?y.length+_:p??0,O.w>=O.h),Qe=Tm({link:h,panes:y.length,replayLeft:_,pending:p});return(0,$.jsxs)(`section`,{ref:i,"data-terminal-panel":``,className:`relative flex min-h-0 min-w-0 flex-col border-t border-chrome-line ${r}`,children:[(0,$.jsx)(xh,{...a}),(0,$.jsx)(Sh,{mode:pe,onToggleMode:me,canToggleMode:he,tabs:we&&y.length>0?(0,$.jsx)(Qm,{panes:y,titles:w,shown:De,reorderable:He,draggingPane:Be,dragOverPane:Ve,onClose:te,onPaneDragStart:Ge,onPaneDragMove:Ke,onPaneDragEnd:Je,onPaneDragCancel:Ue}):void 0,ownsSize:ne,maximized:t,keyBarShown:ge.shown,recovery:ce,panes:y,onCancelRecovery:ue,onClaimSize:Ie,onCreate:Pe,onCompose:Me.open,onToggleKeyBar:ge.toggle,onToggleMaximized:n}),(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-ink-950 p-1`,children:[(0,$.jsx)(Om,{status:Qe}),(0,$.jsx)(Zm,{containerRef:s,mode:pe,maximized:t,panes:y,titles:w,active:x,shown:De,layout:Ye,pending:p,recovery:ce,draggingPane:Be,dragOverPane:Ve,reorderable:He,bodyTouch:fe,slotRefs:f,bodyRefs:u,onFocus:ke,onToggleZoom:Fe,onClose:te,onCancelRecovery:ue,onPaneDragStart:Ge,onPaneDragMove:Ke,onPaneDragEnd:Je,onPaneDragCancel:Ue})]}),y.length>0&&ge.shown&&(0,$.jsx)(nh,{onKey:ze,ctrl:_e,alt:ve,onArm:je}),(0,$.jsx)(Km,{closing:E,panes:y,paneLabel:Ae,onConfirmClose:e=>{te(null),Le(e)},onCancelClose:()=>{te(null),je()},compose:Me})]})}var wh=(0,j.memo)(Ch);export{wh as TerminalPanel}; \ No newline at end of file diff --git a/viewer-ui/dist/assets/index-BaOPGVzu.css b/viewer-ui/dist/assets/index-BaOPGVzu.css new file mode 100644 index 00000000..a63a7801 --- /dev/null +++ b/viewer-ui/dist/assets/index-BaOPGVzu.css @@ -0,0 +1,2 @@ +/*! tailwindcss v4.3.4 | MIT License | https://tailwindcss.com */ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:system-ui, sans-serif;--font-mono:"JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wide:.025em;--radius-xs:4px;--radius-sm:4px;--radius-md:8px;--radius-lg:12px;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-ink-950:#111112;--color-ink-900:#19191b;--color-ink-850:#202023;--color-ink-800:#232326;--color-ink-700:#343438;--color-ink-600:#48484e;--color-ink-400:#8f8f97;--color-ink-200:#c4c4ca;--color-ink-50:#f2f2f3;--color-chrome-line:#29292d;--color-accent:#d9a441;--color-added:#4ba36b;--color-removed:#d76a6a;--text-2xs:.65rem;--text-caption:.7rem;--text-caption--letter-spacing:.16em}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-y-0{inset-block:0}.-top-0\.5{top:calc(var(--spacing) * -.5)}.-top-px{top:-1px}.top-0{top:0}.top-1{top:var(--spacing)}.top-3{top:calc(var(--spacing) * 3)}.top-\[calc\(var\(--nc-header-h\)\+8px\)\]{top:calc(var(--nc-header-h) + 8px)}.-right-2{right:calc(var(--spacing) * -2)}.-right-px{right:-1px}.right-1{right:var(--spacing)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.left-0{left:0}.left-1\/2{left:50%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[60\]{z-index:60}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-3{margin:calc(var(--spacing) * 3)}.mx-1{margin-inline:var(--spacing)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-auto{margin-inline:auto}.-my-1{margin-block:calc(var(--spacing) * -1)}.my-1{margin-block:var(--spacing)}.my-2{margin-block:calc(var(--spacing) * 2)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mr-1{margin-right:var(--spacing)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\.5{margin-bottom:calc(var(--spacing) * 2.5)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.ml-1{margin-left:var(--spacing)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.table{display:table}.h-\(--nc-header-h\){height:var(--nc-header-h)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-72{height:calc(var(--spacing) * 72)}.h-\[22px\]{height:22px}.h-full{height:100%}.max-h-\[70vh\]{max-height:70vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[calc\(100vh-3\.75rem\)\]{max-height:calc(100vh - 3.75rem)}.max-h-\[min\(80vh\,calc\(var\(--nc-visual-viewport-height\,100vh\)-8vh-1rem\)\)\]{max-height:min(80vh, calc(var(--nc-visual-viewport-height,100vh) - 8vh - 1rem))}.min-h-0{min-height:0}.min-h-9{min-height:calc(var(--spacing) * 9)}.min-h-11{min-height:calc(var(--spacing) * 11)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-1\/2{width:50%}.w-1\/3{width:33.3333%}.w-2{width:calc(var(--spacing) * 2)}.w-2\/3{width:66.6667%}.w-2\/5{width:40%}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-3\/4{width:75%}.w-3\/5{width:60%}.w-4{width:calc(var(--spacing) * 4)}.w-4\/5{width:80%}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-30{width:calc(var(--spacing) * 30)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-\[17rem\]{width:17rem}.w-\[22px\]{width:22px}.w-\[28rem\]{width:28rem}.w-\[34rem\]{width:34rem}.w-\[40rem\]{width:40rem}.w-\[56rem\]{width:56rem}.w-full{width:100%}.w-max{width:max-content}.max-w-\[6rem\]{max-width:6rem}.max-w-\[50\%\]{max-width:50%}.max-w-\[80vw\]{max-width:80vw}.max-w-\[86vw\]{max-width:86vw}.max-w-\[calc\(100vw-1\.5rem\)\]{max-width:calc(100vw - 1.5rem)}.max-w-\[calc\(100vw-1rem\)\]{max-width:calc(100vw - 1rem)}.max-w-full{max-width:100%}.min-w-0{min-width:0}.min-w-9{min-width:calc(var(--spacing) * 9)}.min-w-full{min-width:100%}.flex-1{flex:1}.flex-none{flex:none}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.shrink-\[1000\]{flex-shrink:1000}.grow{flex-grow:1}.origin-top-left{transform-origin:0 0}.origin-top-right{transform-origin:100% 0}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, )}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-row-resize{cursor:row-resize}.touch-pan-x{--tw-pan-x:pan-x;touch-action:var(--tw-pan-x, ) var(--tw-pan-y, ) var(--tw-pinch-zoom, )}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x, ) var(--tw-pan-y, ) var(--tw-pinch-zoom, )}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-\[minmax\(0\,1fr\)\]{grid-template-columns:minmax(0,1fr)}.grid-rows-\[1fr\]{grid-template-rows:1fr}.grid-rows-\[minmax\(0\,1fr\)\]{grid-template-rows:minmax(0,1fr)}.grid-rows-\[minmax\(0\,1fr\)_auto_auto\]{grid-template-rows:minmax(0,1fr) auto auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-\[1ch\]{gap:1ch}.self-center{align-self:center}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[20\.7\%\]{border-radius:20.7%}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xs{border-radius:var(--radius-xs)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-accent{border-color:var(--color-accent)}.border-added\/60{border-color:#4ba36b99}@supports (color:color-mix(in lab, red, red)){.border-added\/60{border-color:color-mix(in oklab, var(--color-added) 60%, transparent)}}.border-chrome-line{border-color:var(--color-chrome-line)}.border-ink-600{border-color:var(--color-ink-600)}.border-ink-700{border-color:var(--color-ink-700)}.border-ink-800{border-color:var(--color-ink-800)}.bg-accent{background-color:var(--color-accent)}.bg-added\/10{background-color:#4ba36b1a}@supports (color:color-mix(in lab, red, red)){.bg-added\/10{background-color:color-mix(in oklab, var(--color-added) 10%, transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\/60{background-color:color-mix(in oklab, var(--color-black) 60%, transparent)}}.bg-current{background-color:currentColor}.bg-ink-50{background-color:var(--color-ink-50)}.bg-ink-700{background-color:var(--color-ink-700)}.bg-ink-800{background-color:var(--color-ink-800)}.bg-ink-850{background-color:var(--color-ink-850)}.bg-ink-900{background-color:var(--color-ink-900)}.bg-ink-900\/40{background-color:#19191b66}@supports (color:color-mix(in lab, red, red)){.bg-ink-900\/40{background-color:color-mix(in oklab, var(--color-ink-900) 40%, transparent)}}.bg-ink-950{background-color:var(--color-ink-950)}.bg-ink-950\/80{background-color:#111112cc}@supports (color:color-mix(in lab, red, red)){.bg-ink-950\/80{background-color:color-mix(in oklab, var(--color-ink-950) 80%, transparent)}}.bg-removed{background-color:var(--color-removed)}.bg-removed\/10{background-color:#d76a6a1a}@supports (color:color-mix(in lab, red, red)){.bg-removed\/10{background-color:color-mix(in oklab, var(--color-removed) 10%, transparent)}}.bg-white{background-color:var(--color-white)}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-\[1ch\]{padding-inline:1ch}.px-\[12\.8px\]{padding-inline:12.8px}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.pt-\[8vh\]{padding-top:8vh}.pt-\[20vh\]{padding-top:20vh}.pr-1{padding-right:var(--spacing)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-7{padding-right:calc(var(--spacing) * 7)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-1{padding-left:var(--spacing)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-caption{font-size:var(--text-caption);letter-spacing:var(--tw-tracking,var(--text-caption--letter-spacing))}.text-2xs{font-size:var(--text-2xs)}.text-\[16px\]{font-size:16px}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.04em\]{--tw-tracking:.04em;letter-spacing:.04em}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.text-accent{color:var(--color-accent)}.text-added{color:var(--color-added)}.text-ink-50{color:var(--color-ink-50)}.text-ink-200{color:var(--color-ink-200)}.text-ink-400{color:var(--color-ink-400)}.text-ink-600{color:var(--color-ink-600)}.text-ink-950{color:var(--color-ink-950)}.text-removed{color:var(--color-removed)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal, ) var(--tw-slashed-zero, ) var(--tw-numeric-figure, ) var(--tw-numeric-spacing, ) var(--tw-numeric-fraction, )}.underline{text-decoration-line:underline}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow-\[inset_0_-1px_0_0_var\(--color-accent\)\]{--tw-shadow:inset 0 -1px 0 0 var(--tw-shadow-color,var(--color-accent));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[inset_1px_0_0_0_var\(--color-accent\)\]{--tw-shadow:inset 1px 0 0 0 var(--tw-shadow-color,var(--color-accent));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-accent{--tw-ring-color:var(--color-accent)}.ring-ink-600{--tw-ring-color:var(--color-ink-600)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, )}.filter{filter:var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, )}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.\[-webkit-touch-callout\:none\]{-webkit-touch-callout:none}.ring-inset{--tw-ring-inset:inset}.placeholder\:text-ink-400::placeholder{color:var(--color-ink-400)}@media (hover:hover){.hover\:border-accent:hover{border-color:var(--color-accent)}.hover\:bg-accent:hover{background-color:var(--color-accent)}.hover\:bg-ink-700:hover{background-color:var(--color-ink-700)}.hover\:bg-ink-850:hover{background-color:var(--color-ink-850)}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:text-accent:hover{color:var(--color-accent)}.hover\:text-ink-50:hover{color:var(--color-ink-50)}.hover\:text-ink-200:hover{color:var(--color-ink-200)}.hover\:text-removed:hover{color:var(--color-removed)}}.focus\:border-accent:focus{border-color:var(--color-accent)}.focus\:border-ink-600:focus{border-color:var(--color-ink-600)}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-\[3px\]:focus{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-accent:focus{--tw-ring-color:var(--color-accent)}.focus\:ring-accent\/15:focus{--tw-ring-color:#d9a44126}@supports (color:color-mix(in lab, red, red)){.focus\:ring-accent\/15:focus{--tw-ring-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.active\:bg-ink-700:active{background-color:var(--color-ink-700)}.active\:text-accent:active{color:var(--color-accent)}.disabled\:cursor-progress:disabled{cursor:progress}.disabled\:bg-ink-700:disabled{background-color:var(--color-ink-700)}.disabled\:text-ink-400:disabled{color:var(--color-ink-400)}.disabled\:text-ink-600:disabled{color:var(--color-ink-600)}.disabled\:opacity-50:disabled{opacity:.5}@media (hover:hover){.disabled\:hover\:bg-transparent:disabled:hover{background-color:#0000}.disabled\:hover\:text-ink-600:disabled:hover{color:var(--color-ink-600)}}@media (width>=48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:block{display:block}.md\:flex{display:flex}.md\:grid{display:grid}.md\:hidden{display:none}.md\:inline{display:inline}.md\:inline-flex{display:inline-flex}.md\:h-6{height:calc(var(--spacing) * 6)}.md\:w-6{width:calc(var(--spacing) * 6)}.md\:flex-1{flex:1}.md\:basis-1\/2{flex-basis:50%}.md\:grid-cols-\[18rem_minmax\(0\,1fr\)\]{grid-template-columns:18rem minmax(0,1fr)}.md\:grid-cols-\[var\(--nc-sidebar\)_minmax\(0\,1fr\)\]{grid-template-columns:var(--nc-sidebar) minmax(0,1fr)}.md\:grid-rows-\[minmax\(0\,0fr\)_minmax\(0\,1fr\)_auto_auto\]{grid-template-rows:minmax(0,0fr) minmax(0,1fr) auto auto}.md\:grid-rows-\[minmax\(0\,1fr\)_minmax\(0\,0fr\)_auto_auto\]{grid-template-rows:minmax(0,1fr) minmax(0,0fr) auto auto}.md\:grid-rows-\[minmax\(0\,3fr\)_minmax\(0\,2fr\)\]{grid-template-rows:minmax(0,3fr) minmax(0,2fr)}.md\:grid-rows-\[minmax\(0\,var\(--nc-upper\)\)_minmax\(0\,var\(--nc-lower\)\)_auto_auto\]{grid-template-rows:minmax(0,var(--nc-upper)) minmax(0,var(--nc-lower)) auto auto}.md\:flex-row{flex-direction:row}.md\:border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.md\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.md\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.md\:pt-\[8vh\]{padding-top:8vh}}}.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;-webkit-text-decoration:overline double underline;-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;-webkit-text-decoration:overline wavy underline;-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;-webkit-text-decoration:overline dotted underline;-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;-webkit-text-decoration:overline dashed underline;-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}:root{--nc-motion-fast:.12s;--nc-motion-base:.16s;--nc-motion-ease:cubic-bezier(.2, 0, 0, 1);--nc-title-fade:1rem;--nc-title-delay:.5s}.nc-title{white-space:nowrap;min-width:0;display:block;overflow:hidden}.nc-title-text{width:max-content;display:inline-block}.nc-title[data-overflow=true]{-webkit-mask-image:linear-gradient(to right, #000 calc(100% - var(--nc-title-fade)), transparent);-webkit-mask-image:linear-gradient(to right, #000 calc(100% - var(--nc-title-fade)), transparent);-webkit-mask-image:linear-gradient(to right, #000 calc(100% - var(--nc-title-fade)), transparent);mask-image:linear-gradient(to right, #000 calc(100% - var(--nc-title-fade)), transparent)}.nc-skeleton{background-color:var(--color-ink-800)}@keyframes nc-title-scroll{to{transform:translateX(calc(var(--nc-title-travel) - var(--nc-title-fade)))}}@keyframes nc-shimmer{0%{background-position:100% 0}to{background-position:0 0}}@keyframes nc-fade-in{0%{opacity:0}}@keyframes nc-pop-in{0%{opacity:0;transform:translateY(-4px)scale(.98)}}@keyframes nc-rise-in{0%{opacity:0;transform:translateY(8px)scale(.98)}}@keyframes nc-cell-in{0%{opacity:0;transform:translateY(12px)}}@keyframes nc-busy-dot{50%{opacity:.2}}@keyframes nc-slide-in{0%{opacity:0;transform:translate(16px)}}@media (prefers-reduced-motion:no-preference){.nc-title-target:is(:hover,:focus-visible,:has(:focus-visible)) .nc-title[data-overflow=true] .nc-title-text{animation:nc-title-scroll var(--nc-title-duration) linear var(--nc-title-delay) forwards}@media (hover:none){.nc-title-target:is([aria-selected=true],[data-active=true]) .nc-title[data-overflow=true] .nc-title-text{animation:nc-title-scroll var(--nc-title-duration) linear var(--nc-title-delay) forwards}}.nc-skeleton{background-image:linear-gradient(90deg, var(--color-ink-800) 40%, var(--color-ink-700) 50%, var(--color-ink-800) 60%);background-size:300% 100%;animation:1.6s linear infinite nc-shimmer}.nc-fade-in{animation:nc-fade-in var(--nc-motion-base) var(--nc-motion-ease)}.nc-pop-in{animation:nc-pop-in var(--nc-motion-fast) var(--nc-motion-ease)}.nc-rise-in{animation:nc-rise-in var(--nc-motion-base) var(--nc-motion-ease)}.nc-cell-in{animation:nc-cell-in .26s var(--nc-motion-ease)}.nc-busy-dot{animation:1s ease-in-out infinite nc-busy-dot}.nc-slide-in{animation:nc-slide-in var(--nc-motion-base) var(--nc-motion-ease)}[role=tab],.nc-title-target,.nc-content li>button{transition:background-color var(--nc-motion-fast) ease-out, color var(--nc-motion-fast) ease-out, box-shadow var(--nc-motion-fast) ease-out}}@font-face{font-family:JetBrains Mono;font-style:normal;font-display:block;font-weight:100 800;src:url(./jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:JetBrains Mono;font-style:normal;font-display:block;font-weight:100 800;src:url(./jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}html,body,#root{height:var(--nc-visual-viewport-height,100%)}html{font-size:14px}.nc-content{zoom:var(--nc-content-zoom,1)}@media (pointer:coarse){input:not([type=checkbox]):not([type=radio]),select,textarea:not(.xterm-helper-textarea){font-size:max(16px,1em)}}.overflow-auto,.overflow-y-auto,.xterm-viewport{overscroll-behavior-y:contain}body{background:var(--color-ink-950);color:var(--color-ink-50);font-family:var(--font-mono);margin:0;font-size:.85rem;line-height:1.4}button:not(:disabled),[role=button]:not(:disabled){cursor:pointer}:focus-visible{outline:1px solid var(--color-accent);outline-offset:-1px}:root{--nc-header-h:42px}*{scrollbar-width:thin;scrollbar-color:var(--color-ink-600) transparent}.nc-markdown{max-width:52rem;font-family:var(--font-sans);color:var(--color-ink-50);line-height:1.6}.nc-markdown h1,.nc-markdown h2,.nc-markdown h3,.nc-markdown h4,.nc-markdown h5,.nc-markdown h6{margin:1.4em 0 .6em;font-weight:600;line-height:1.25}.nc-markdown h1{border-bottom:1px solid var(--color-ink-700);padding-bottom:.3em;font-size:1.6em}.nc-markdown h2{border-bottom:1px solid var(--color-ink-800);padding-bottom:.25em;font-size:1.35em}.nc-markdown h3{font-size:1.15em}.nc-markdown h4{font-size:1em}.nc-markdown h5,.nc-markdown h6{color:var(--color-ink-200);font-size:.9em}.nc-markdown :first-child{margin-top:0}.nc-markdown p,.nc-markdown ul,.nc-markdown ol,.nc-markdown blockquote,.nc-markdown table,.nc-markdown pre{margin:.75em 0}.nc-markdown ul,.nc-markdown ol{padding-left:1.5em}.nc-markdown ul{list-style:outside}.nc-markdown ol{list-style:decimal}.nc-markdown li{margin:.25em 0}.nc-markdown li::marker{color:var(--color-ink-400)}.nc-markdown li:has(>input[type=checkbox]){margin-left:-1.2em;list-style:none}.nc-markdown a{color:var(--color-accent);text-underline-offset:2px;text-decoration:underline}.nc-markdown strong{font-weight:600}.nc-markdown em{font-style:italic}.nc-markdown blockquote{border-left:3px solid var(--color-ink-700);color:var(--color-ink-200);padding-left:1em}.nc-markdown hr{border:0;border-top:1px solid var(--color-ink-700);margin:1.5em 0}.nc-markdown img{max-width:100%}.nc-markdown :not(pre)>code{font-family:var(--font-mono);background:var(--color-ink-800);border-radius:3px;padding:.1em .35em;font-size:.9em}.nc-markdown pre{background:var(--color-ink-850);border:1px solid var(--color-ink-800);border-radius:4px;padding:.9em 1em;overflow-x:auto}.nc-markdown pre code{font-family:var(--font-mono);background:0 0;padding:0;font-size:.85em}.nc-markdown table{border-collapse:collapse;display:block;overflow-x:auto}.nc-markdown th,.nc-markdown td{border:1px solid var(--color-ink-700);text-align:left;padding:.4em .7em}.nc-markdown th{background:var(--color-ink-850);font-weight:600}.nc-pane-body>.xterm{flex:none}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/viewer-ui/dist/assets/index-CVFGi1WM.css b/viewer-ui/dist/assets/index-CVFGi1WM.css deleted file mode 100644 index d2237bcb..00000000 --- a/viewer-ui/dist/assets/index-CVFGi1WM.css +++ /dev/null @@ -1,2 +0,0 @@ -/*! tailwindcss v4.3.4 | MIT License | https://tailwindcss.com */ -@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:system-ui, sans-serif;--font-mono:"JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wide:.025em;--radius-xs:4px;--radius-sm:4px;--radius-md:8px;--radius-lg:12px;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-ink-950:#111112;--color-ink-900:#19191b;--color-ink-850:#202023;--color-ink-800:#232326;--color-ink-700:#343438;--color-ink-600:#48484e;--color-ink-400:#8f8f97;--color-ink-200:#c4c4ca;--color-ink-50:#f2f2f3;--color-chrome-line:#29292d;--color-accent:#d9a441;--color-added:#4ba36b;--color-removed:#d76a6a;--text-2xs:.65rem;--text-caption:.7rem;--text-caption--letter-spacing:.16em}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-y-0{inset-block:0}.-top-0\.5{top:calc(var(--spacing) * -.5)}.-top-px{top:-1px}.top-0{top:0}.top-1{top:var(--spacing)}.top-3{top:calc(var(--spacing) * 3)}.top-\[calc\(var\(--nc-header-h\)\+8px\)\]{top:calc(var(--nc-header-h) + 8px)}.-right-2{right:calc(var(--spacing) * -2)}.-right-px{right:-1px}.right-1{right:var(--spacing)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.left-0{left:0}.left-1\/2{left:50%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[60\]{z-index:60}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-3{margin:calc(var(--spacing) * 3)}.mx-1{margin-inline:var(--spacing)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-auto{margin-inline:auto}.-my-1{margin-block:calc(var(--spacing) * -1)}.my-1{margin-block:var(--spacing)}.my-2{margin-block:calc(var(--spacing) * 2)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mr-1{margin-right:var(--spacing)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\.5{margin-bottom:calc(var(--spacing) * 2.5)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.ml-1{margin-left:var(--spacing)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.table{display:table}.h-\(--nc-header-h\){height:var(--nc-header-h)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-72{height:calc(var(--spacing) * 72)}.h-\[22px\]{height:22px}.h-full{height:100%}.max-h-\[70vh\]{max-height:70vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[calc\(100vh-3\.75rem\)\]{max-height:calc(100vh - 3.75rem)}.max-h-\[min\(80vh\,calc\(var\(--nc-visual-viewport-height\,100vh\)-8vh-1rem\)\)\]{max-height:min(80vh, calc(var(--nc-visual-viewport-height,100vh) - 8vh - 1rem))}.min-h-0{min-height:0}.min-h-9{min-height:calc(var(--spacing) * 9)}.min-h-11{min-height:calc(var(--spacing) * 11)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-1\/2{width:50%}.w-1\/3{width:33.3333%}.w-2{width:calc(var(--spacing) * 2)}.w-2\/3{width:66.6667%}.w-2\/5{width:40%}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-3\/4{width:75%}.w-3\/5{width:60%}.w-4{width:calc(var(--spacing) * 4)}.w-4\/5{width:80%}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-30{width:calc(var(--spacing) * 30)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-\[17rem\]{width:17rem}.w-\[22px\]{width:22px}.w-\[28rem\]{width:28rem}.w-\[34rem\]{width:34rem}.w-\[40rem\]{width:40rem}.w-\[56rem\]{width:56rem}.w-full{width:100%}.w-max{width:max-content}.max-w-\[6rem\]{max-width:6rem}.max-w-\[50\%\]{max-width:50%}.max-w-\[80vw\]{max-width:80vw}.max-w-\[86vw\]{max-width:86vw}.max-w-\[calc\(100vw-1\.5rem\)\]{max-width:calc(100vw - 1.5rem)}.max-w-\[calc\(100vw-1rem\)\]{max-width:calc(100vw - 1rem)}.max-w-full{max-width:100%}.min-w-0{min-width:0}.min-w-9{min-width:calc(var(--spacing) * 9)}.min-w-full{min-width:100%}.flex-1{flex:1}.flex-none{flex:none}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.shrink-\[1000\]{flex-shrink:1000}.grow{flex-grow:1}.basis-full{flex-basis:100%}.origin-top-left{transform-origin:0 0}.origin-top-right{transform-origin:100% 0}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, )}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-row-resize{cursor:row-resize}.touch-pan-x{--tw-pan-x:pan-x;touch-action:var(--tw-pan-x, ) var(--tw-pan-y, ) var(--tw-pinch-zoom, )}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x, ) var(--tw-pan-y, ) var(--tw-pinch-zoom, )}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-\[minmax\(0\,1fr\)\]{grid-template-columns:minmax(0,1fr)}.grid-rows-\[1fr\]{grid-template-rows:1fr}.grid-rows-\[minmax\(0\,1fr\)\]{grid-template-rows:minmax(0,1fr)}.grid-rows-\[minmax\(0\,1fr\)_auto_auto\]{grid-template-rows:minmax(0,1fr) auto auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-\[1ch\]{gap:1ch}.self-center{align-self:center}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[20\.7\%\]{border-radius:20.7%}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xs{border-radius:var(--radius-xs)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-accent{border-color:var(--color-accent)}.border-added\/60{border-color:#4ba36b99}@supports (color:color-mix(in lab, red, red)){.border-added\/60{border-color:color-mix(in oklab, var(--color-added) 60%, transparent)}}.border-chrome-line{border-color:var(--color-chrome-line)}.border-ink-600{border-color:var(--color-ink-600)}.border-ink-700{border-color:var(--color-ink-700)}.border-ink-800{border-color:var(--color-ink-800)}.bg-accent{background-color:var(--color-accent)}.bg-added\/10{background-color:#4ba36b1a}@supports (color:color-mix(in lab, red, red)){.bg-added\/10{background-color:color-mix(in oklab, var(--color-added) 10%, transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\/60{background-color:color-mix(in oklab, var(--color-black) 60%, transparent)}}.bg-current{background-color:currentColor}.bg-ink-50{background-color:var(--color-ink-50)}.bg-ink-700{background-color:var(--color-ink-700)}.bg-ink-800{background-color:var(--color-ink-800)}.bg-ink-850{background-color:var(--color-ink-850)}.bg-ink-900{background-color:var(--color-ink-900)}.bg-ink-900\/40{background-color:#19191b66}@supports (color:color-mix(in lab, red, red)){.bg-ink-900\/40{background-color:color-mix(in oklab, var(--color-ink-900) 40%, transparent)}}.bg-ink-950{background-color:var(--color-ink-950)}.bg-ink-950\/80{background-color:#111112cc}@supports (color:color-mix(in lab, red, red)){.bg-ink-950\/80{background-color:color-mix(in oklab, var(--color-ink-950) 80%, transparent)}}.bg-removed{background-color:var(--color-removed)}.bg-removed\/10{background-color:#d76a6a1a}@supports (color:color-mix(in lab, red, red)){.bg-removed\/10{background-color:color-mix(in oklab, var(--color-removed) 10%, transparent)}}.bg-white{background-color:var(--color-white)}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-\[1ch\]{padding-inline:1ch}.px-\[12\.8px\]{padding-inline:12.8px}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.pt-\[8vh\]{padding-top:8vh}.pt-\[20vh\]{padding-top:20vh}.pr-1{padding-right:var(--spacing)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-7{padding-right:calc(var(--spacing) * 7)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-1{padding-left:var(--spacing)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-caption{font-size:var(--text-caption);letter-spacing:var(--tw-tracking,var(--text-caption--letter-spacing))}.text-2xs{font-size:var(--text-2xs)}.text-\[16px\]{font-size:16px}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.04em\]{--tw-tracking:.04em;letter-spacing:.04em}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.text-accent{color:var(--color-accent)}.text-added{color:var(--color-added)}.text-ink-50{color:var(--color-ink-50)}.text-ink-200{color:var(--color-ink-200)}.text-ink-400{color:var(--color-ink-400)}.text-ink-600{color:var(--color-ink-600)}.text-ink-950{color:var(--color-ink-950)}.text-removed{color:var(--color-removed)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal, ) var(--tw-slashed-zero, ) var(--tw-numeric-figure, ) var(--tw-numeric-spacing, ) var(--tw-numeric-fraction, )}.underline{text-decoration-line:underline}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow-\[inset_0_-1px_0_0_var\(--color-accent\)\]{--tw-shadow:inset 0 -1px 0 0 var(--tw-shadow-color,var(--color-accent));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[inset_1px_0_0_0_var\(--color-accent\)\]{--tw-shadow:inset 1px 0 0 0 var(--tw-shadow-color,var(--color-accent));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-accent{--tw-ring-color:var(--color-accent)}.ring-ink-600{--tw-ring-color:var(--color-ink-600)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, )}.filter{filter:var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, )}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.\[-webkit-touch-callout\:none\]{-webkit-touch-callout:none}.ring-inset{--tw-ring-inset:inset}.placeholder\:text-ink-400::placeholder{color:var(--color-ink-400)}@media (hover:hover){.hover\:border-accent:hover{border-color:var(--color-accent)}.hover\:bg-accent:hover{background-color:var(--color-accent)}.hover\:bg-ink-700:hover{background-color:var(--color-ink-700)}.hover\:bg-ink-850:hover{background-color:var(--color-ink-850)}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:text-accent:hover{color:var(--color-accent)}.hover\:text-ink-50:hover{color:var(--color-ink-50)}.hover\:text-ink-200:hover{color:var(--color-ink-200)}.hover\:text-removed:hover{color:var(--color-removed)}}.focus\:border-accent:focus{border-color:var(--color-accent)}.focus\:border-ink-600:focus{border-color:var(--color-ink-600)}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-\[3px\]:focus{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-accent:focus{--tw-ring-color:var(--color-accent)}.focus\:ring-accent\/15:focus{--tw-ring-color:#d9a44126}@supports (color:color-mix(in lab, red, red)){.focus\:ring-accent\/15:focus{--tw-ring-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.active\:bg-ink-700:active{background-color:var(--color-ink-700)}.active\:text-accent:active{color:var(--color-accent)}.disabled\:cursor-progress:disabled{cursor:progress}.disabled\:bg-ink-700:disabled{background-color:var(--color-ink-700)}.disabled\:text-ink-400:disabled{color:var(--color-ink-400)}.disabled\:text-ink-600:disabled{color:var(--color-ink-600)}.disabled\:opacity-50:disabled{opacity:.5}@media (hover:hover){.disabled\:hover\:bg-transparent:disabled:hover{background-color:#0000}.disabled\:hover\:text-ink-600:disabled:hover{color:var(--color-ink-600)}}@media (width>=48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:block{display:block}.md\:flex{display:flex}.md\:grid{display:grid}.md\:hidden{display:none}.md\:inline{display:inline}.md\:inline-flex{display:inline-flex}.md\:h-6{height:calc(var(--spacing) * 6)}.md\:w-6{width:calc(var(--spacing) * 6)}.md\:flex-1{flex:1}.md\:basis-1\/2{flex-basis:50%}.md\:grid-cols-\[18rem_minmax\(0\,1fr\)\]{grid-template-columns:18rem minmax(0,1fr)}.md\:grid-cols-\[var\(--nc-sidebar\)_minmax\(0\,1fr\)\]{grid-template-columns:var(--nc-sidebar) minmax(0,1fr)}.md\:grid-rows-\[minmax\(0\,0fr\)_minmax\(0\,1fr\)_auto_auto\]{grid-template-rows:minmax(0,0fr) minmax(0,1fr) auto auto}.md\:grid-rows-\[minmax\(0\,1fr\)_minmax\(0\,0fr\)_auto_auto\]{grid-template-rows:minmax(0,1fr) minmax(0,0fr) auto auto}.md\:grid-rows-\[minmax\(0\,3fr\)_minmax\(0\,2fr\)\]{grid-template-rows:minmax(0,3fr) minmax(0,2fr)}.md\:grid-rows-\[minmax\(0\,var\(--nc-upper\)\)_minmax\(0\,var\(--nc-lower\)\)_auto_auto\]{grid-template-rows:minmax(0,var(--nc-upper)) minmax(0,var(--nc-lower)) auto auto}.md\:flex-row{flex-direction:row}.md\:border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.md\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.md\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.md\:pt-\[8vh\]{padding-top:8vh}}}.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;-webkit-text-decoration:overline double underline;-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;-webkit-text-decoration:overline wavy underline;-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;-webkit-text-decoration:overline dotted underline;-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;-webkit-text-decoration:overline dashed underline;-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}:root{--nc-motion-fast:.12s;--nc-motion-base:.16s;--nc-motion-ease:cubic-bezier(.2, 0, 0, 1);--nc-title-fade:1rem;--nc-title-delay:.5s}.nc-title{white-space:nowrap;min-width:0;display:block;overflow:hidden}.nc-title-text{width:max-content;display:inline-block}.nc-title[data-overflow=true]{-webkit-mask-image:linear-gradient(to right, #000 calc(100% - var(--nc-title-fade)), transparent);-webkit-mask-image:linear-gradient(to right, #000 calc(100% - var(--nc-title-fade)), transparent);-webkit-mask-image:linear-gradient(to right, #000 calc(100% - var(--nc-title-fade)), transparent);mask-image:linear-gradient(to right, #000 calc(100% - var(--nc-title-fade)), transparent)}.nc-skeleton{background-color:var(--color-ink-800)}@keyframes nc-title-scroll{to{transform:translateX(calc(var(--nc-title-travel) - var(--nc-title-fade)))}}@keyframes nc-shimmer{0%{background-position:100% 0}to{background-position:0 0}}@keyframes nc-fade-in{0%{opacity:0}}@keyframes nc-pop-in{0%{opacity:0;transform:translateY(-4px)scale(.98)}}@keyframes nc-rise-in{0%{opacity:0;transform:translateY(8px)scale(.98)}}@keyframes nc-cell-in{0%{opacity:0;transform:translateY(12px)}}@keyframes nc-busy-dot{50%{opacity:.2}}@keyframes nc-slide-in{0%{opacity:0;transform:translate(16px)}}@media (prefers-reduced-motion:no-preference){.nc-title-target:is(:hover,:focus-visible,:has(:focus-visible)) .nc-title[data-overflow=true] .nc-title-text{animation:nc-title-scroll var(--nc-title-duration) linear var(--nc-title-delay) forwards}@media (hover:none){.nc-title-target:is([aria-selected=true],[data-active=true]) .nc-title[data-overflow=true] .nc-title-text{animation:nc-title-scroll var(--nc-title-duration) linear var(--nc-title-delay) forwards}}.nc-skeleton{background-image:linear-gradient(90deg, var(--color-ink-800) 40%, var(--color-ink-700) 50%, var(--color-ink-800) 60%);background-size:300% 100%;animation:1.6s linear infinite nc-shimmer}.nc-fade-in{animation:nc-fade-in var(--nc-motion-base) var(--nc-motion-ease)}.nc-pop-in{animation:nc-pop-in var(--nc-motion-fast) var(--nc-motion-ease)}.nc-rise-in{animation:nc-rise-in var(--nc-motion-base) var(--nc-motion-ease)}.nc-cell-in{animation:nc-cell-in .26s var(--nc-motion-ease)}.nc-busy-dot{animation:1s ease-in-out infinite nc-busy-dot}.nc-slide-in{animation:nc-slide-in var(--nc-motion-base) var(--nc-motion-ease)}[role=tab],.nc-title-target,.nc-content li>button{transition:background-color var(--nc-motion-fast) ease-out, color var(--nc-motion-fast) ease-out, box-shadow var(--nc-motion-fast) ease-out}}@font-face{font-family:JetBrains Mono;font-style:normal;font-display:block;font-weight:100 800;src:url(./jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:JetBrains Mono;font-style:normal;font-display:block;font-weight:100 800;src:url(./jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}html,body,#root{height:var(--nc-visual-viewport-height,100%)}html{font-size:14px}.nc-content{zoom:var(--nc-content-zoom,1)}@media (pointer:coarse){input:not([type=checkbox]):not([type=radio]),select,textarea:not(.xterm-helper-textarea){font-size:max(16px,1em)}}.overflow-auto,.overflow-y-auto,.xterm-viewport{overscroll-behavior-y:contain}body{background:var(--color-ink-950);color:var(--color-ink-50);font-family:var(--font-mono);margin:0;font-size:.85rem;line-height:1.4}button:not(:disabled),[role=button]:not(:disabled){cursor:pointer}:focus-visible{outline:1px solid var(--color-accent);outline-offset:-1px}:root{--nc-header-h:42px}*{scrollbar-width:thin;scrollbar-color:var(--color-ink-600) transparent}.nc-markdown{max-width:52rem;font-family:var(--font-sans);color:var(--color-ink-50);line-height:1.6}.nc-markdown h1,.nc-markdown h2,.nc-markdown h3,.nc-markdown h4,.nc-markdown h5,.nc-markdown h6{margin:1.4em 0 .6em;font-weight:600;line-height:1.25}.nc-markdown h1{border-bottom:1px solid var(--color-ink-700);padding-bottom:.3em;font-size:1.6em}.nc-markdown h2{border-bottom:1px solid var(--color-ink-800);padding-bottom:.25em;font-size:1.35em}.nc-markdown h3{font-size:1.15em}.nc-markdown h4{font-size:1em}.nc-markdown h5,.nc-markdown h6{color:var(--color-ink-200);font-size:.9em}.nc-markdown :first-child{margin-top:0}.nc-markdown p,.nc-markdown ul,.nc-markdown ol,.nc-markdown blockquote,.nc-markdown table,.nc-markdown pre{margin:.75em 0}.nc-markdown ul,.nc-markdown ol{padding-left:1.5em}.nc-markdown ul{list-style:outside}.nc-markdown ol{list-style:decimal}.nc-markdown li{margin:.25em 0}.nc-markdown li::marker{color:var(--color-ink-400)}.nc-markdown li:has(>input[type=checkbox]){margin-left:-1.2em;list-style:none}.nc-markdown a{color:var(--color-accent);text-underline-offset:2px;text-decoration:underline}.nc-markdown strong{font-weight:600}.nc-markdown em{font-style:italic}.nc-markdown blockquote{border-left:3px solid var(--color-ink-700);color:var(--color-ink-200);padding-left:1em}.nc-markdown hr{border:0;border-top:1px solid var(--color-ink-700);margin:1.5em 0}.nc-markdown img{max-width:100%}.nc-markdown :not(pre)>code{font-family:var(--font-mono);background:var(--color-ink-800);border-radius:3px;padding:.1em .35em;font-size:.9em}.nc-markdown pre{background:var(--color-ink-850);border:1px solid var(--color-ink-800);border-radius:4px;padding:.9em 1em;overflow-x:auto}.nc-markdown pre code{font-family:var(--font-mono);background:0 0;padding:0;font-size:.85em}.nc-markdown table{border-collapse:collapse;display:block;overflow-x:auto}.nc-markdown th,.nc-markdown td{border:1px solid var(--color-ink-700);text-align:left;padding:.4em .7em}.nc-markdown th{background:var(--color-ink-850);font-weight:600}.nc-pane-body>.xterm{flex:none}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/viewer-ui/dist/assets/index-fDiSI_v6.js b/viewer-ui/dist/assets/index-DQWkMvEh.js similarity index 99% rename from viewer-ui/dist/assets/index-fDiSI_v6.js rename to viewer-ui/dist/assets/index-DQWkMvEh.js index 217fa1ec..4fb25f95 100644 --- a/viewer-ui/dist/assets/index-fDiSI_v6.js +++ b/viewer-ui/dist/assets/index-DQWkMvEh.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Markdown-DEJAds14.js","./jsx-runtime-EIAPxkjE.js","./react-BPk_wmJm.js","./Markdown-C8LL_u4z.css","./Html-DGFy4jGa.js","./HtmlEditor-DzgQSTDx.js","./BusyLabel-BNTNuT1X.js","./api-BwgkHPos.js","./Terminal-C0v33aMU.js","./lastPane-FlqACl6i.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Markdown-DEJAds14.js","./jsx-runtime-EIAPxkjE.js","./react-BPk_wmJm.js","./Markdown-C8LL_u4z.css","./Html-DGFy4jGa.js","./HtmlEditor-DzgQSTDx.js","./BusyLabel-BNTNuT1X.js","./api-BwgkHPos.js","./Terminal-DiFTvhqh.js","./lastPane-FlqACl6i.js"])))=>i.map(i=>d[i]); import{n as e,t}from"./jsx-runtime-EIAPxkjE.js";import{t as n}from"./react-BPk_wmJm.js";import{$ as r,A as i,C as a,D as o,F as s,G as c,H as l,I as u,J as d,K as f,L as p,M as m,N as h,O as g,Q as _,R as v,U as y,V as b,W as x,X as S,Y as C,Z as w,_t as T,at as E,b as ee,c as te,dt as ne,et as re,ft as ie,g as ae,gt as oe,ht as se,i as ce,it as le,j as ue,k as de,lt as fe,mt as pe,nt as me,pt as he,q as ge,r as _e,rt as ve,s as ye,st as be,tt as xe,ut as D,v as O,vt as Se,w as Ce,x as we,y as Te,yt as Ee,z as De}from"./lastPane-FlqACl6i.js";import{t as k}from"./BusyLabel-BNTNuT1X.js";import{a as Oe,i as ke,n as Ae,o as je,r as Me,s as Ne,t as A}from"./api-BwgkHPos.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Pe=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,te());else{var t=n(l);t!==null&&ie(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ie(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(ee)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=ee,te=function(){re.postMessage(null)}}else te=function(){_(ee,0)};function ie(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ie(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Fe=e(((e,t)=>{t.exports=Pe()})),Ie=e((e=>{var t=Fe(),r=n(),i=Ee();function a(e){var t=`https://react.dev/errors/`+e;if(1we||(e.current=Ce[we],Ce[we]=null,we--)}function k(e,t){we++,Ce[we]=e.current,e.current=t}var Oe=Te(null),ke=Te(null),Ae=Te(null),je=Te(null);function Me(e,t){switch(k(Ae,t),k(ke,e),k(Oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}De(Oe),k(Oe,e)}function Ne(){De(Oe),De(ke),De(Ae)}function A(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,k(je,e)),t=Oe.current;var n=dp(t,e.type);t!==n&&(k(ke,e),k(Oe,n))}function Pe(e){ke.current===e&&(De(Oe),De(ke)),je.current===e&&(De(je),sh._currentValue=Se)}var Ie,Le;function j(e){if(Ie===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ie=t&&t[1]||``,Le=-1)`:-1>>=0,e===0?32:31-(at(e)/ot|0)|0}var ct=256,lt=262144,ut=4194304;function dt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ft(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=dt(n))):i=dt(o):i=dt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=dt(n))):i=dt(o)):i=dt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function pt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function mt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0n;n++)t.push(e);return t}function vt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function yt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0=_r),br=` `,xr=!1;function Sr(e,t){switch(e){case`keyup`:return hr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Cr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var wr=!1;function Tr(e,t){switch(e){case`compositionend`:return Cr(t);case`keypress`:return t.which===32?(xr=!0,br):null;case`textInput`:return e=t.data,e===br&&xr?null:e;default:return null}}function Er(e,t){if(wr)return e===`compositionend`||!gr&&Sr(e,t)?(e=zn(),Rn=Ln=In=null,wr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Yr(n)}}function Zr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Zr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Jr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Jr(e.document)}return t}function $r(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var ei=Nn&&`documentMode`in document&&11>=document.documentMode,ti=null,ni=null,ri=null,ii=!1;function ai(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ii||ti==null||ti!==Jr(r)||(r=ti,`selectionStart`in r&&$r(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ri&&qr(ri,r)||(ri=r,r=Jf(ni,`onSelect`),0>=o,i-=o,ta=1<<32-it(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),I&&ra(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),I&&ra(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return I&&ra(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),I&&ra(i,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===ne&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case ee:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===ne){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),fo(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===de&&io(l)===r.type){n(e,r.sibling),c=i(r,o.props),fo(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===ne?(c=Hi(o.props.children,e.mode,c,o.key),fo(c,o),c.return=e,e=c):(c=Vi(o.type,o.key,o.props,null,e.mode,c),fo(c,o),c.return=e,e=c)}return s(e);case te:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Gi(o,e.mode,c),c.return=e,e=c}return s(e);case de:return o=io(o),_(e,r,o,c)}if(xe(o))return h(e,r,o,c);if(ve(o)){if(l=ve(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,uo(o),c);if(o.$$typeof===oe)return _(e,r,Aa(e,o),c);po(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=Ui(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{lo=0;var i=_(e,t,n,r);return co=null,i}catch(t){if(t===Qa||t===eo)throw t;var a=Li(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ho=mo(!0),go=mo(!1),_o=!1;function vo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function bo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,W&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Pi(e),Ni(e,null,n),t}return Ai(e,r,t,n),Pi(e)}function So(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}function Co(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var wo=!1;function To(){if(wo){var e=Ua;if(e!==null)throw e}}function Eo(e,t,n,r){wo=!1;var i=e.updateQueue;_o=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(q&f)===f:(r&f)===f){f!==0&&f===Ha&&(wo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=T({},d,f);break a;case 2:_o=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),sd|=o,e.lanes=o,e.memoizedState=d}}function Do(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function Oo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=D.T,s={};s.types=o===null?null:o.types,D.T=s,pc(e,!1,t,n);try{var c=i(),l=D.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?fc(e,t,Ka(c,r),jd(e)):fc(e,t,r,jd(e))}catch(n){fc(e,t,{then:function(){},status:`rejected`,reason:n},jd())}finally{O.p=a,o!==null&&s.types!==null&&(o.types=s.types),D.T=o}}function nc(){}function rc(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=ic(e).queue;tc(e,i,t,Se,n===null?nc:function(){return ac(e),n(r)})}function ic(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Se,baseState:Se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:Se},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ac(e){var t=ic(e);t.next===null&&(t=e.alternate.memoizedState),fc(e,t.next.queue,{},jd())}function oc(){return ka(sh)}function sc(){return ls().memoizedState}function cc(){return ls().memoizedState}function lc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=jd();e=bo(n);var r=xo(t,e,n);r!==null&&(Pd(r,t,n),So(r,t,n)),t={cache:Fa()},e.payload=t;return}t=t.return}}function uc(e,t,n){var r=jd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},mc(e)?hc(t,n):(n=ji(e,t,n,r),n!==null&&(Pd(n,e,r),gc(n,t,r)))}function dc(e,t,n){fc(e,t,n,jd())}function fc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(mc(e))hc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Kr(s,o))return Ai(e,t,i,0),G===null&&ki(),!1}catch{}if(n=ji(e,t,i,r),n!==null)return Pd(n,e,r),gc(n,t,r),!0}return!1}function pc(e,t,n,r){if(r={lane:2,revertLane:Pf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},mc(e)){if(t)throw Error(a(479))}else t=ji(e,n,r,2),t!==null&&Pd(t,e,2)}function mc(e){var t=e.alternate;return e===R||t!==null&&t===R}function hc(e,t){Jo=qo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}var _c={readContext:ka,use:fs,useCallback:B,useContext:B,useEffect:B,useImperativeHandle:B,useLayoutEffect:B,useInsertionEffect:B,useMemo:B,useReducer:B,useRef:B,useState:B,useDebugValue:B,useDeferredValue:B,useTransition:B,useSyncExternalStore:B,useId:B,useHostTransitionStatus:B,useFormState:B,useActionState:B,useOptimistic:B,useMemoCache:B,useCacheRefresh:B,useEffectEvent:B},vc={readContext:ka,use:fs,useCallback:function(e,t){return cs().memoizedState=[e,t===void 0?null:t],e},useContext:ka,useEffect:Hs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Bs(4194308,4,Js.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bs(4194308,4,e,t)},useInsertionEffect:function(e,t){Bs(4,2,e,t)},useMemo:function(e,t){var n=cs();t=t===void 0?null:t;var r=e();if(Yo){rt(!0);try{e()}finally{rt(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=cs();if(n!==void 0){var i=n(t);if(Yo){rt(!0);try{n(t)}finally{rt(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=uc.bind(null,R,e),[r.memoizedState,e]},useRef:function(e){var t=cs();return e={current:e},t.memoizedState=e},useState:function(e){e=ws(e);var t=e.queue,n=dc.bind(null,R,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Xs,useDeferredValue:function(e,t){return $s(cs(),e,t)},useTransition:function(){var e=ws(!1);return e=tc.bind(null,R,e.queue,!0,!1),cs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=R,i=cs();if(I){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),G===null)throw Error(a(349));q&127||ys(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,Hs(xs.bind(null,r,o,e),[e]),r.flags|=2048,Rs(9,{destroy:void 0},bs.bind(null,r,o,n,t),null),n},useId:function(){var e=cs(),t=G.identifierPrefix;if(I){var n=na,r=ta;n=(r&~(1<<32-it(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Xo++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[Ot]=t,o[kt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(np(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&gl(t)}}return V(t),t.subtreeFlags&=-33554433,_l(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&gl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=Ae.current,ha(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=ca,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||ep(e.nodeValue,n)),e||fa(t,!0)}else e=lp(e).createTextNode(r),e[Ot]=t,t.stateNode=e}return V(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ha(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[Ot]=t}else ga(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;V(t),e=!1}else n=_a(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Bo(t),t):(Bo(t),null);if(t.flags&128)throw Error(a(558))}return V(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=ha(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[Ot]=t}else ga(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;V(t),i=!1}else i=_a(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Bo(t),t):(Bo(t),null)}return Bo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),yl(t,t.updateQueue),V(t),null);case 4:return Ne(),e===null&&Wf(t.stateNode.containerInfo),t.flags|=67108864,V(t),null;case 10:return Ca(t.type),V(t),null;case 19:if(Uo(t),r=t.memoizedState,r===null)return V(t),null;if(i=!!(t.flags&128),o=r.rendering,o===null){if(i)bl(r,!1);else{if(Y!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Wo(e),o!==null){for(t.flags|=128,bl(r,!1),e=o.updateQueue,t.updateQueue=e,yl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Bi(n,e),n=n.sibling;return Ho(t,Vo.current&1|2),I&&ra(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ke()>_d&&(t.flags|=128,i=!0,bl(r,!1),t.lanes=4194304)}}else{if(!i){if(e=Wo(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,yl(t,e),bl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!I)return V(t),null}else 2*Ke()-r.renderingStartTime>_d&&n!==536870912&&(t.flags|=128,i=!0,bl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ke(),e.sibling=null,o=Vo.current,o=i?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||I?Ho(t,o):(n=o,k(Po,t),k(Vo,n),Fo===null&&(Fo=t)),I&&ra(t,r.treeForkCount),e}return V(t),null;case 22:case 23:return Bo(t),No(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(V(t),t.subtreeFlags&6&&(t.flags|=8192)):V(t),n=t.updateQueue,n!==null&&yl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&De(Ja),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ca(L),V(t),null;case 25:return null;case 30:return t.flags|=33554432,V(t),null}throw Error(a(156,t.tag))}function Sl(e,t){switch(oa(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ca(L),Ne(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Pe(t),null;case 31:if(t.memoizedState!==null){if(Bo(t),t.alternate===null)throw Error(a(340));ga()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Bo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));ga()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Uo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Ne(),null;case 10:return Ca(t.type),null;case 22:case 23:return Bo(t),No(),e!==null&&De(Ja),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ca(L),null;case 25:return null;default:return null}}function Cl(e,t){switch(oa(t),t.tag){case 3:Ca(L),Ne();break;case 26:case 27:case 5:Pe(t);break;case 4:Ne();break;case 31:t.memoizedState!==null&&Bo(t);break;case 13:Bo(t);break;case 19:Uo(t);break;case 10:Ca(t.type);break;case 22:case 23:Bo(t),No(),e!==null&&De(Ja);break;case 24:Ca(L)}}function wl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Tl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function El(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Oo(t,n)}catch(t){Z(e,e.return,t)}}}function Dl(e,t,n){n.props=Tc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function Ol(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=Si(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);p(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function kl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}}function Al(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n title`))),np(r,t,n),r[Ot]=e,Ht(r),t=r;break a;case`link`:if(o=Gm(`link`,`href`,i).get(t+(n.href||``))){for(s=0;sg&&(o=g,g=h,h=o);var _=Xr(s,h),v=Xr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,D.T=null,n=wd,wd=null;var o=bd,s=Sd;if(X=0,xd=bd=null,Sd=0,W&6)throw Error(a(331));var c=W;if(W|=4,Zu(o.current),Uu(o,o.current,s,n),W=c,Df(0,!1),nt&&typeof nt.onPostCommitFiberRoot==`function`)try{nt.onPostCommitFiberRoot(tt,o)}catch{}return!0}finally{O.p=i,D.T=r,uf(e,t)}}function pf(e,t,n){t=qi(n,t),t=jc(e.stateNode,t,2),e=xo(e,t,2),e!==null&&(vt(e,2),Ef(e))}function Z(e,t,n){if(e.tag===3)pf(e,e,n);else for(;t!==null;){if(t.tag===3){pf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(yd===null||!yd.has(r))){e=qi(n,e),n=Mc(2),r=xo(t,n,2),r!==null&&(Nc(n,r,t,e),vt(r,2),Ef(r));break}}t=t.return}}function mf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new td;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ad=!0,i.add(n),e=hf.bind(null,e,t,n),t.then(e,e))}function hf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,G===e&&(q&n)===n&&(Y===4||Y===3&&(q&62914560)===q&&300>Ke()-hd?W&2?ld|=n:Vd(e,0):ld|=n,dd===q&&(dd=0)),Ef(e)}function gf(e,t){t===0&&(t=gt()),e=Mi(e,t),e!==null&&(vt(e,t),Ef(e))}function _f(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gf(e,n)}function vf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),gf(e,n)}function yf(e,t){return He(e,t)}var bf=null,xf=null,Sf=!1,Cf=!1,wf=!1,Tf=0;function Ef(e){e!==xf&&e.next===null&&(xf===null?bf=xf=e:xf=xf.next=e),Cf=!0,Sf||(Sf=!0,Nf())}function Df(e,t){if(!wf&&Cf){wf=!0;do for(var n=!1,r=bf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-it(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Mf(r,a))}else a=q,a=ft(r,r===G?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||pt(r,a)||(n=!0,Mf(r,a))}r=r.next}while(n);wf=!1}}function Of(){kf()}function kf(){Cf=Sf=!1;var e=0;Tf!==0&&hp()&&(e=Tf);for(var t=Ke(),n=null,r=bf;r!==null;){var i=r.next,a=Af(r,t);a===0?(r.next=null,n===null?bf=i:n.next=i,i===null&&(xf=n)):(n=r,(e!==0||a&3)&&(Cf=!0)),r=i}X!==0&&X!==5||Df(e,!1),Tf!==0&&(Tf=0)}function Af(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=ln(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Ht(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+ln(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+ln(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+ln(n.imageSizes)+`"]`)):i+=`[href="`+ln(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[It]=!0,o.onload=o.onerror=function(){Ut(o)}),Ht(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+ln(r)+`"][href="`+ln(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=T({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Ht(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=Vt(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Ht(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=Vt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=T({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Ht(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=Vt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Ht(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var i=(i=Ae.current)?bm(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=Vt(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=Vt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(i,e,o,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=Vt(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Pm(e){return`href="`+ln(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[It]){r.loading=1;return}}else t=e.createElement(`link`),t[It]=!0,t.onload=t.onerror=Ut.bind(null,t),np(t,`link`,n),Ht(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+ln(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+ln(n.href)+`"]`);if(r)return t.instance=r,Ht(r),r;var i=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ht(r),np(r,`style`,i),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Pm(n.href);var o=e.querySelector(Fm(i));if(o)return t.state.loading|=4,t.instance=o,Ht(o),o;r=Im(n),(i=vm.get(i))&&Hm(r,i),o=(e.ownerDocument||e).createElement(`link`),Ht(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(i=e.querySelector(zm(o)))?(t.instance=i,Ht(i),i):(r=n,(i=vm.get(o))&&(r=T({},n),Um(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Ht(i),np(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ht(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Ht(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Ie()}))(),j=n(),M=t();function Re({onClose:e,onOpened:t,canClone:n,cloning:r,onClone:i}){let[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(null),[l,u]=(0,j.useState)(null),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(``),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(0);(0,j.useEffect)(()=>{let e=!1;return A.browse(a??void 0).then(t=>{e||(c(t),u(null))}).catch(t=>{e||u(t instanceof Error?t.message:`could not browse`)}),()=>{e=!0}},[a,y]);let x=e=>o(`${s.path.replace(/\/$/,``)}/${e}`),S=async()=>{if(s){f(!0);try{t(await A.open(s.path))}catch(e){T.error(e instanceof Error?e.message:`could not open`),f(!1)}}},C=async()=>{if(!s)return;let e=p.trim();if(e){g(!0);try{await A.mkdir(s.path,e),m(``),b(e=>e+1)}catch(e){T.error(e instanceof Error?e.message:`could not create folder`)}finally{g(!1)}}};return(0,M.jsx)(`div`,{className:`nc-fade-in fixed inset-0 z-50 flex items-start justify-center bg-black/60 p-4 md:pt-[8vh]`,onClick:e,children:(0,M.jsxs)(`div`,{className:`nc-rise-in flex max-h-[min(80vh,calc(var(--nc-visual-viewport-height,100vh)-8vh-1rem))] w-[34rem] max-w-full flex-col rounded-lg border border-ink-700 bg-ink-900`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-ink-700 px-3 py-2`,children:[(0,M.jsx)(`span`,{className:`font-medium text-ink-50`,children:`Open a project`}),(0,M.jsx)(`button`,{onClick:e,"aria-label":`close`,className:`ml-auto flex h-6 w-6 items-center justify-center rounded-sm text-ink-400 hover:text-ink-200`,children:(0,M.jsx)(pe,{})})]}),(0,M.jsx)(`div`,{className:`shrink-0 truncate border-b border-ink-700 px-3 py-1.5 text-ink-400`,children:s?.path??`…`}),(0,M.jsxs)(`ul`,{className:`h-72 min-h-0 overflow-y-auto`,children:[s?.parent&&(0,M.jsx)(`li`,{children:(0,M.jsx)(`button`,{onClick:()=>o(s.parent),className:`w-full px-3 py-1 text-left text-ink-400 hover:bg-ink-850`,children:`../`})}),s?.entries.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{onClick:()=>x(e.name),className:`flex w-full items-center gap-2 px-3 py-1 text-left hover:bg-ink-850`,children:[(0,M.jsxs)(`span`,{className:`truncate text-accent`,children:[e.name,`/`]}),e.is_repo&&(0,M.jsx)(`span`,{className:`rounded-sm bg-ink-700 px-1 text-2xs text-ink-200`,children:`git`})]})},e.name)),s&&s.entries.length===0&&(0,M.jsx)(`li`,{className:`px-3 py-1 text-ink-400`,children:`No sub-folders.`})]}),l&&(0,M.jsx)(`p`,{className:`shrink-0 px-3 py-1 text-removed`,children:l}),(0,M.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-2 border-t border-ink-700 px-3 py-2`,children:[(0,M.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C()},placeholder:`New folder name`,"aria-label":`new folder name`,className:`min-w-0 flex-1 rounded-sm border border-ink-700 bg-ink-950 px-2 py-1 text-ink-50 placeholder:text-ink-400 focus:border-ink-600 focus:outline-none`}),(0,M.jsx)(`button`,{onClick:C,disabled:!s||!p.trim()||h,"aria-busy":h,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850 disabled:opacity-50`,children:(0,M.jsx)(k,{busy:h,children:`Create`})})]}),(0,M.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-2 border-t border-ink-700 px-3 py-2`,children:[(0,M.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&s&&i(s.path,_)},disabled:!n,placeholder:n?`Clone a git URL here`:`git is not installed on the server`,"aria-label":`git URL to clone`,spellCheck:!1,autoCapitalize:`none`,autoCorrect:`off`,className:`min-w-0 flex-1 rounded-sm border border-ink-700 bg-ink-950 px-2 py-1 text-ink-50 placeholder:text-ink-400 focus:border-ink-600 focus:outline-none disabled:opacity-50`}),(0,M.jsx)(`button`,{onClick:()=>s&&i(s.path,_),disabled:!n||!s||!_.trim()||r,"aria-busy":r,title:n?void 0:`the server has no git on its PATH`,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850 disabled:opacity-50`,children:(0,M.jsx)(k,{busy:r,children:`Clone`})})]}),(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-ink-700 px-3 py-2`,children:[(0,M.jsx)(`span`,{className:`truncate text-ink-400`,children:s?s.path:``}),(0,M.jsx)(`button`,{onClick:S,disabled:!s||d,"aria-busy":d,className:`ml-auto shrink-0 rounded-sm bg-ink-50 px-3 py-1 font-semibold text-ink-950 hover:bg-white disabled:opacity-50`,children:(0,M.jsx)(k,{busy:d,children:`Open`})})]})]})})}var ze=`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='12%2057%201150%201150'%20role='img'%20aria-label='Black%20crow'%3e%3ctitle%3eBlack%20crow%3c/title%3e%3cdesc%3eMonochrome%20black%20crow%20silhouette%20on%20a%20transparent%20background,%20framed%20so%20the%20bird%20sits%20centred%20for%20use%20as%20an%20inline%20mark%20on%20a%20square%20tile.%3c/desc%3e%3cg%20fill-rule='evenodd'%20clip-rule='evenodd'%3e%3cpath%20fill='%23000000'%20d='M%20882%20147%20L%20859%20136%20L%20844%20131%20L%20831%20129%20L%20830%20128%20L%20815%20127%20L%20814%20126%20L%20796%20126%20L%20795%20127%20L%20786%20127%20L%20785%20128%20L%20775%20129%20L%20752%20136%20L%20732%20146%20L%20713%20160%20L%20701%20172%20L%20684%20172%20L%20683%20173%20L%20673%20173%20L%20672%20174%20L%20650%20176%20L%20649%20177%20L%20627%20181%20L%20602%20190%20L%20589%20197%20L%20579%20204%20L%20562%20221%20L%20562%20223%20L%20565%20223%20L%20578%20228%20L%20581%20228%20L%20612%20238%20L%20672%20252%20L%20684%20258%20L%20698%20271%20L%20702%20278%20L%20705%20288%20L%20705%20294%20L%20703%20301%20L%20699%20308%20L%20688%20318%20L%20630%20347%20L%20593%20372%20L%20561%20399%20L%20544%20416%20L%20522%20441%20L%20492%20481%20L%20461%20531%20L%20438%20576%20L%20431%20594%20L%20425%20602%20L%20405%20635%20L%20387%20668%20L%20385%20676%20L%20390%20679%20L%20368%20705%20L%20330%20755%20L%20306%20790%20L%20296%20808%20L%20289%20818%20L%20280%20838%20L%20280%20843%20L%20283%20845%20L%20292%20843%20L%20297%20840%20L%20299%20840%20L%20321%20828%20L%20322%20830%20L%20311%20844%20L%20288%20878%20L%20287%20881%20L%20259%20924%20L%20235%20965%20L%20205%201023%20L%20205%201025%20L%20197%201042%20L%20191%201061%20L%20191%201071%20L%20192%201072%20L%20198%201071%20L%20220%201056%20L%20242%201038%20L%20300%20986%20L%20302%20987%20L%20265%201040%20L%20264%201043%20L%20246%201070%20L%20235%201090%20L%20227%201112%20L%20227%201123%20L%20229%201128%20L%20234%201133%20L%20239%201135%20L%20255%201135%20L%20274%201129%20L%20279%201134%20L%20286%201137%20L%20290%201137%20L%20291%201138%20L%20310%201138%20L%20311%201137%20L%20317%201137%20L%20318%201136%20L%20326%201135%20L%20344%201129%20L%20369%201116%20L%20395%201097%20L%20420%201073%20L%20445%201042%20L%20457%201024%20L%20461%201016%20L%20464%201013%20L%20468%201011%20L%20489%20994%20L%20595%20901%20L%20601%20906%20L%20606%20913%20L%20614%20921%20L%20637%20949%20L%20639%20953%20L%20639%20956%20L%20636%20960%20L%20634%20961%20L%20619%20962%20L%20613%20965%20L%20605%20974%20L%20602%20982%20L%20602%20994%20L%20605%201001%20L%20608%201004%20L%20609%201004%20L%20609%20999%20L%20612%20992%20L%20616%20988%20L%20620%20986%20L%20627%20986%20L%20635%20983%20L%20645%20983%20L%20646%20982%20L%20655%20982%20L%20668%20986%20L%20676%20990%20L%20682%20996%20L%20685%201003%20L%20688%201006%20L%20696%201009%20L%20697%201012%20L%20697%201024%20L%20693%201033%20L%20693%201035%20L%20695%201035%20L%20700%201032%20L%20707%201025%20L%20710%201020%20L%20713%201010%20L%20713%201003%20L%20711%20998%20L%20711%20994%20L%20712%20993%20L%20719%201003%20L%20723%201005%20L%20727%201005%20L%20730%201011%20L%20730%201022%20L%20727%201031%20L%20728%201033%20L%20740%201021%20L%20743%201014%20L%20744%201003%20L%20747%20999%20L%20749%20992%20L%20748%20977%20L%20744%20968%20L%20740%20963%20L%20741%20962%20L%20755%20961%20L%20768%20964%20L%20777%20969%20L%20783%20975%20L%20786%20981%20L%20789%20984%20L%20795%20987%20L%20799%20987%20L%20801%20991%20L%20801%20997%20L%20802%20998%20L%20799%201013%20L%20802%201012%20L%20808%201007%20L%20813%201000%20L%20816%20991%20L%20816%20981%20L%20814%20976%20L%20814%20968%20L%20815%20967%20L%20819%20970%20L%20823%20970%20L%20826%20973%20L%20829%20980%20L%20830%20993%20L%20834%20990%20L%20838%20979%20L%20838%20968%20L%20832%20951%20L%20822%20940%20L%20815%20936%20L%20803%20933%20L%20776%20935%20L%20763%20931%20L%20753%20922%20L%20731%20898%20L%20703%20865%20L%20703%20863%20L%20710%20853%20L%20711%20855%20L%20707%20862%20L%20709%20862%20L%20718%20857%20L%20754%20832%20L%20793%20799%20L%20818%20774%20L%20849%20737%20L%20850%20741%20L%20845%20755%20L%20847%20755%20L%20861%20743%20L%20881%20721%20L%20906%20686%20L%20918%20665%20L%20933%20635%20L%20951%20590%20L%20971%20525%20L%20971%20521%20L%20974%20512%20L%20974%20508%20L%20978%20493%20L%20979%20482%20L%20980%20481%20L%20981%20466%20L%20982%20465%20L%20983%20441%20L%20982%20440%20L%20982%20428%20L%20981%20427%20L%20980%20414%20L%20978%20409%20L%20976%20397%20L%20970%20381%20L%20971%20379%20L%20974%20383%20L%20976%20381%20L%20977%20334%20L%20976%20333%20L%20976%20322%20L%20975%20321%20L%20974%20307%20L%20973%20306%20L%20973%20301%20L%20972%20300%20L%20969%20280%20L%20958%20243%20L%20949%20224%20L%20949%20222%20L%20939%20204%20L%20922%20181%20L%20903%20162%20Z%20M%20625%20888%20L%20656%20874%20L%20658%20874%20L%20665%20870%20L%20725%20930%20L%20728%20934%20L%20728%20940%20L%20723%20943%20L%20714%20944%20L%20707%20950%20L%20683%20951%20L%20673%20947%20L%20659%20932%20Z%20M%20787%20182%20L%20792%20182%20L%20796%20187%20L%20795%20192%20L%20791%20195%20L%20788%20195%20L%20783%20191%20L%20783%20186%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20895%20156%20L%20863%20138%20L%20838%20130%20L%20819%20127%20L%20789%20127%20L%20777%20129%20L%20753%20136%20L%20736%20144%20L%20717%20157%20L%20702%20172%20L%20652%20176%20L%20628%20181%20L%20607%20188%20L%20585%20200%20L%20562%20222%20L%20613%20238%20L%20670%20251%20L%20683%20257%20L%20697%20269%20L%20705%20286%20L%20705%20296%20L%20703%20302%20L%20698%20310%20L%20687%20319%20L%20631%20347%20L%20591%20374%20L%20568%20393%20L%20538%20423%20L%20520%20444%20L%20481%20498%20L%20457%20539%20L%20437%20579%20L%20432%20593%20L%20413%20622%20L%20386%20671%20L%20386%20677%20L%20390%20677%20L%20391%20679%20L%20374%20698%20L%20334%20750%20L%20307%20789%20L%20290%20817%20L%20280%20839%20L%20281%20844%20L%20291%20843%20L%20323%20826%20L%20325%20827%20L%20289%20877%20L%20237%20962%20L%20209%201015%20L%20198%201040%20L%20191%201063%20L%20191%201070%20L%20194%201072%20L%20213%201061%20L%20259%201023%20L%20302%20984%20L%20303%20985%20L%20262%201045%20L%20245%201072%20L%20233%201095%20L%20227%201114%20L%20228%201126%20L%20233%201132%20L%20242%201135%20L%20252%201135%20L%20274%201128%20L%20278%201133%20L%20288%201137%20L%20313%201137%20L%20343%201129%20L%20373%201113%20L%20398%201094%20L%20424%201068%20L%20441%201047%20L%20465%201012%20L%20520%20967%20L%20595%20900%20L%20611%20917%20L%20639%20952%20L%20639%20957%20L%20637%20960%20L%20632%20962%20L%20618%20963%20L%20611%20967%20L%20606%20973%20L%20602%20983%20L%20602%20992%20L%20608%201004%20L%20611%20993%20L%20619%20986%20L%20626%20986%20L%20643%20982%20L%20656%20982%20L%20675%20989%20L%20683%20997%20L%20688%201006%20L%20696%201009%20L%20697%201025%20L%20693%201034%20L%20694%201035%20L%20701%201031%20L%20710%201019%20L%20712%201013%20L%20712%20993%20L%20720%201003%20L%20727%201005%20L%20730%201009%20L%20730%201025%20L%20727%201032%20L%20732%201030%20L%20739%201022%20L%20743%201013%20L%20743%201004%20L%20749%20991%20L%20748%20978%20L%20740%20964%20L%20743%20961%20L%20757%20961%20L%20769%20964%20L%20781%20972%20L%20791%20985%20L%20798%20986%20L%20802%20994%20L%20802%201003%20L%20799%201013%20L%20810%201004%20L%20815%20994%20L%20816%20983%20L%20814%20977%20L%20814%20965%20L%20818%20969%20L%20825%20971%20L%20830%20983%20L%20830%20993%20L%20833%20991%20L%20837%20982%20L%20838%20969%20L%20834%20956%20L%20825%20943%20L%20820%20939%20L%20807%20934%20L%20774%20935%20L%20762%20931%20L%20736%20904%20L%20702%20864%20L%20715%20845%20L%20716%20847%20L%20707%20862%20L%20719%20856%20L%20744%20839%20L%20786%20805%20L%20824%20767%20L%20851%20733%20L%20852%20735%20L%20846%20755%20L%20853%20750%20L%20883%20718%20L%20906%20685%20L%20927%20647%20L%20951%20589%20L%20968%20535%20L%20976%20502%20L%20982%20461%20L%20981%20422%20L%20976%20398%20L%20968%20378%20L%20969%20376%20L%20975%20383%20L%20977%20341%20L%20970%20286%20L%20958%20244%20L%20945%20215%20L%20925%20185%20L%20906%20165%20Z%20M%20625%20888%20L%20665%20870%20L%20728%20933%20L%20729%20940%20L%20726%20943%20L%20715%20944%20L%20708%20950%20L%20692%20952%20L%20678%20950%20L%20672%20947%20L%20662%20936%20Z%20M%20785%20183%20L%20792%20182%20L%20796%20186%20L%20796%20191%20L%20791%20195%20L%20785%20194%20L%20783%20191%20L%20783%20186%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20896%20157%20L%20869%20141%20L%20837%20130%20L%20817%20127%20L%20792%20127%20L%20778%20129%20L%20751%20137%20L%20733%20146%20L%20715%20159%20L%20702%20172%20L%20653%20176%20L%20610%20187%20L%20581%20203%20L%20562%20222%20L%20625%20241%20L%20671%20251%20L%20683%20257%20L%20698%20270%20L%20705%20285%20L%20704%20300%20L%20699%20309%20L%20689%20318%20L%20628%20349%20L%20581%20382%20L%20540%20421%20L%20517%20448%20L%20478%20503%20L%20456%20541%20L%20439%20575%20L%20432%20593%20L%20412%20624%20L%20388%20667%20L%20386%20676%20L%20390%20677%20L%20391%20679%20L%20363%20712%20L%20332%20753%20L%20289%20819%20L%20281%20836%20L%20281%20844%20L%20293%20842%20L%20323%20826%20L%20325%20827%20L%20284%20885%20L%20236%20964%20L%20205%201024%20L%20197%201043%20L%20191%201064%20L%20191%201070%20L%20197%201071%20L%20210%201063%20L%20253%201028%20L%20303%20983%20L%20304%20984%20L%20259%201050%20L%20235%201091%20L%20227%201115%20L%20228%201125%20L%20232%201131%20L%20238%201134%20L%20249%201135%20L%20261%201133%20L%20274%201128%20L%20278%201133%20L%20289%201137%20L%20312%201137%20L%20342%201129%20L%20368%201116%20L%20399%201093%20L%20423%201069%20L%20443%201044%20L%20463%201013%20L%20493%20990%20L%20595%20900%20L%20612%20918%20L%20639%20952%20L%20639%20957%20L%20636%20961%20L%20616%20964%20L%20606%20973%20L%20602%20984%20L%20602%20991%20L%20608%201004%20L%20611%20993%20L%20621%20985%20L%20625%20986%20L%20639%20982%20L%20657%20982%20L%20677%20990%20L%20685%201002%20L%20690%201007%20L%20697%201010%20L%20698%201021%20L%20693%201034%20L%20694%201035%20L%20705%201027%20L%20710%201018%20L%20712%201011%20L%20712%201001%20L%20710%20994%20L%20712%20993%20L%20720%201003%20L%20729%201006%20L%20731%201020%20L%20728%201032%20L%20738%201023%20L%20743%201012%20L%20743%201003%20L%20748%20994%20L%20747%20976%20L%20740%20964%20L%20743%20961%20L%20759%20961%20L%20767%20963%20L%20780%20971%20L%20790%20984%20L%20799%20986%20L%20802%20992%20L%20802%201004%20L%20799%201012%20L%20803%201011%20L%20810%201004%20L%20815%20994%20L%20814%20965%20L%20818%20969%20L%20823%20969%20L%20830%20982%20L%20830%20992%20L%20832%20992%20L%20837%20982%20L%20837%20965%20L%20831%20950%20L%20821%20940%20L%20806%20934%20L%20772%20935%20L%20762%20931%20L%20733%20901%20L%20702%20863%20L%20717%20842%20L%20718%20844%20L%20707%20862%20L%20738%20843%20L%20780%20810%20L%20822%20769%20L%20851%20733%20L%20852%20735%20L%20846%20755%20L%20855%20748%20L%20882%20719%20L%20904%20688%20L%20930%20640%20L%20950%20591%20L%20967%20538%20L%20978%20490%20L%20982%20459%20L%20982%20434%20L%20976%20399%20L%20967%20376%20L%20969%20375%20L%20975%20383%20L%20976%20329%20L%20971%20293%20L%20960%20250%20L%20942%20210%20L%20923%20183%20Z%20M%20625%20888%20L%20665%20870%20L%20729%20934%20L%20729%20940%20L%20726%20943%20L%20716%20944%20L%20708%20950%20L%20695%20952%20L%20677%20950%20L%20666%20941%20Z%20M%20786%20182%20L%20790%20181%20L%20794%20183%20L%20797%20188%20L%20792%20195%20L%20787%20195%20L%20782%20190%20L%20782%20187%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20893%20155%20L%20873%20143%20L%20841%20131%20L%20816%20127%20L%20794%20127%20L%20779%20129%20L%20754%20136%20L%20735%20145%20L%20715%20159%20L%20702%20172%20L%20648%20177%20L%20629%20181%20L%20608%20188%20L%20584%20201%20L%20562%20222%20L%20614%20238%20L%20671%20251%20L%20685%20258%20L%20698%20270%20L%20704%20281%20L%20706%20292%20L%20703%20303%20L%20699%20309%20L%20686%20320%20L%20628%20349%20L%20590%20375%20L%20565%20396%20L%20543%20418%20L%20518%20447%20L%20490%20485%20L%20460%20534%20L%20441%20571%20L%20431%20595%20L%20405%20636%20L%20386%20672%20L%20386%20676%20L%20390%20677%20L%20391%20679%20L%20371%20702%20L%20335%20749%20L%20291%20816%20L%20280%20840%20L%20282%20844%20L%20298%20840%20L%20324%20825%20L%20326%20826%20L%20294%20870%20L%20235%20966%20L%20206%201022%20L%20198%201041%20L%20191%201065%20L%20191%201070%20L%20196%201071%20L%20214%201060%20L%20254%201027%20L%20303%20983%20L%20304%20984%20L%20256%201055%20L%20232%201098%20L%20227%201115%20L%20228%201125%20L%20232%201131%20L%20239%201134%20L%20248%201135%20L%20264%201132%20L%20274%201128%20L%20280%201134%20L%20289%201137%20L%20311%201137%20L%20339%201130%20L%20371%201114%20L%20401%201091%20L%20422%201070%20L%20440%201048%20L%20463%201013%20L%20487%20995%20L%20595%20900%20L%20613%20919%20L%20639%20951%20L%20639%20958%20L%20636%20961%20L%20619%20963%20L%20613%20966%20L%20605%20975%20L%20602%20991%20L%20604%20998%20L%20608%201003%20L%20611%20993%20L%20620%20985%20L%20624%20986%20L%20632%20983%20L%20647%20981%20L%20658%20982%20L%20677%20990%20L%20689%201006%20L%20697%201009%20L%20698%201021%20L%20694%201035%20L%20703%201029%20L%20710%201018%20L%20712%201010%20L%20712%201002%20L%20710%20997%20L%20711%20992%20L%20720%201003%20L%20728%201005%20L%20730%201008%20L%20731%201021%20L%20728%201032%20L%20738%201023%20L%20742%201014%20L%20743%201003%20L%20748%20994%20L%20748%20980%20L%20742%20966%20L%20739%20963%20L%20741%20961%20L%20753%20960%20L%20770%20964%20L%20780%20971%20L%20790%20984%20L%20799%20986%20L%20802%20992%20L%20802%201005%20L%20799%201012%20L%20804%201010%20L%20809%201005%20L%20815%20993%20L%20813%20964%20L%20817%20968%20L%20823%20969%20L%20826%20972%20L%20830%20982%20L%20831%20992%20L%20834%20989%20L%20838%20975%20L%20837%20966%20L%20831%20950%20L%20821%20940%20L%20804%20934%20L%20779%20936%20L%20763%20932%20L%20731%20899%20L%20702%20865%20L%20702%20863%20L%20717%20842%20L%20718%20844%20L%20708%20862%20L%20749%20835%20L%20781%20809%20L%20820%20771%20L%20851%20733%20L%20852%20736%20L%20846%20755%20L%20857%20746%20L%20881%20720%20L%20907%20683%20L%20928%20644%20L%20945%20604%20L%20967%20537%20L%20978%20489%20L%20982%20455%20L%20982%20437%20L%20979%20413%20L%20975%20396%20L%20967%20377%20L%20968%20374%20L%20975%20382%20L%20976%20332%20L%20972%20299%20L%20962%20257%20L%20954%20235%20L%20943%20212%20L%20923%20183%20Z%20M%20624%20888%20L%20666%20870%20L%20729%20934%20L%20729%20940%20L%20726%20943%20L%20716%20944%20L%20706%20951%20L%20684%20952%20L%20677%20950%20L%20665%20940%20Z%20M%20701%20220%20L%20710%20219%20L%20717%20221%20L%20704%20223%20L%20704%20221%20Z%20M%20666%20217%20L%20679%20216%20L%20689%20218%20L%20685%20220%20L%20675%20220%20Z%20M%20658%20210%20L%20661%20208%20L%20686%20205%20L%20706%20206%20L%20725%20209%20L%20733%20217%20L%20741%20220%20L%20738%20221%20L%20696%20214%20L%20661%20212%20Z%20M%20788%20181%20L%20793%20182%20L%20797%20188%20L%20792%20195%20L%20786%20195%20L%20782%20190%20L%20783%20185%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20893%20155%20L%20864%20139%20L%20836%20130%20L%20813%20127%20L%20796%20127%20L%20774%20130%20L%20749%20138%20L%20735%20145%20L%20720%20155%20L%20702%20172%20L%20687%20173%20L%20700%20174%20L%20694%20181%20L%20674%20184%20L%20670%20180%20L%20665%20183%20L%20657%20184%20L%20639%20196%20L%20641%20198%20L%20647%20198%20L%20648%20194%20L%20654%20193%20L%20686%20204%20L%20724%20208%20L%20740%20213%20L%20751%20222%20L%20750%20223%20L%20693%20214%20L%20671%20212%20L%20639%20212%20L%20636%20211%20L%20634%20207%20L%20629%20207%20L%20626%20210%20L%20617%20210%20L%20614%20208%20L%20604%20207%20L%20594%20213%20L%20582%20216%20L%20580%20214%20L%20581%20210%20L%20576%20208%20L%20586%20200%20L%20565%20218%20L%20563%20222%20L%20618%20239%20L%20671%20251%20L%20682%20256%20L%20689%20261%20L%20702%20276%20L%20706%20288%20L%20704%20301%20L%20700%20308%20L%20683%20322%20L%20630%20348%20L%20585%20379%20L%20563%20398%20L%20523%20441%20L%20497%20475%20L%20459%20536%20L%20443%20567%20L%20431%20595%20L%20411%20626%20L%20387%20670%20L%20386%20676%20L%20390%20677%20L%20391%20679%20L%20368%20706%20L%20333%20752%20L%20290%20818%20L%20281%20837%20L%20282%20844%20L%20300%20839%20L%20324%20825%20L%20326%20826%20L%20285%20884%20L%20242%20954%20L%20207%201020%20L%20192%201060%20L%20192%201071%20L%20196%201071%20L%20211%201062%20L%20240%201039%20L%20303%20983%20L%20305%20984%20L%20277%201023%20L%20242%201078%20L%20228%201110%20L%20227%201119%20L%20231%201130%20L%20239%201134%20L%20255%201134%20L%20274%201128%20L%20280%201134%20L%20285%201136%20L%20310%201137%20L%20339%201130%20L%20374%201112%20L%20394%201097%20L%20421%201071%20L%20445%201041%20L%20463%201013%20L%20488%20994%20L%20595%20900%20L%20614%20920%20L%20639%20951%20L%20639%20958%20L%20636%20961%20L%20619%20963%20L%20613%20966%20L%20607%20972%20L%20603%20980%20L%20602%20989%20L%20603%20995%20L%20608%201003%20L%20610%20994%20L%20620%20985%20L%20623%20986%20L%20631%20983%20L%20647%20981%20L%20665%20984%20L%20676%20989%20L%20689%201006%20L%20695%201007%20L%20697%201009%20L%20698%201023%20L%20694%201035%20L%20699%201032%20L%20709%201020%20L%20712%201010%20L%20710%20997%20L%20711%20992%20L%20719%201002%20L%20725%201005%20L%20727%201004%20L%20730%201008%20L%20731%201022%20L%20728%201032%20L%20739%201021%20L%20743%201010%20L%20743%201003%20L%20748%20993%20L%20748%20981%20L%20746%20974%20L%20739%20963%20L%20741%20961%20L%20755%20960%20L%20770%20964%20L%20779%20970%20L%20789%20983%20L%20799%20986%20L%20802%20992%20L%20802%201005%20L%20799%201012%20L%20808%201006%20L%20815%20993%20L%20813%20964%20L%20817%20968%20L%20825%20970%20L%20829%20978%20L%20831%20992%20L%20837%20981%20L%20837%20966%20L%20832%20952%20L%20822%20941%20L%20813%20936%20L%20803%20934%20L%20776%20936%20L%20763%20932%20L%20723%20890%20L%20702%20865%20L%20702%20863%20L%20717%20841%20L%20719%20842%20L%20708%20862%20L%20742%20840%20L%20782%20808%20L%20818%20773%20L%20851%20733%20L%20852%20736%20L%20846%20754%20L%20850%20752%20L%20881%20720%20L%20905%20686%20L%20932%20635%20L%20950%20590%20L%20969%20529%20L%20977%20494%20L%20982%20454%20L%20980%20419%20L%20975%20396%20L%20967%20377%20L%20968%20374%20L%20975%20382%20L%20976%20334%20L%20969%20284%20L%20959%20248%20L%20941%20209%20L%20921%20181%20Z%20M%20624%20888%20L%20666%20870%20L%20729%20934%20L%20729%20941%20L%20724%20944%20L%20716%20944%20L%20707%20951%20L%20683%20952%20L%20673%20948%20L%20659%20933%20Z%20M%20563%20618%20L%20569%20614%20L%20579%20621%20L%20576%20626%20L%20572%20627%20L%20568%20623%20L%20565%20623%20Z%20M%20575%20603%20L%20578%20603%20L%20588%20613%20L%20588%20619%20L%20585%20621%20L%20582%20620%20L%20575%20613%20L%20576%20612%20L%20573%20605%20Z%20M%20748%20398%20L%20752%20412%20L%20752%20432%20L%20748%20444%20L%20732%20470%20L%20716%20484%20L%20698%20493%20L%20685%20494%20L%20682%20491%20L%20707%20445%20L%20685%20473%20L%20667%20492%20L%20647%20508%20L%20632%20517%20L%20619%20519%20L%20615%20517%20L%20615%20513%20L%20643%20470%20L%20603%20514%20L%20589%20526%20L%20569%20538%20L%20558%20540%20L%20554%20539%20L%20552%20535%20L%20577%20498%20L%20549%20528%20L%20526%20546%20L%20508%20554%20L%20498%20555%20L%20495%20552%20L%20501%20541%20L%20482%20555%20L%20471%20558%20L%20464%20558%20L%20461%20560%20L%20460%20559%20L%20461%20555%20L%20469%20547%20L%20473%20537%20L%20491%20512%20L%20511%20497%20L%20582%20434%20L%20617%20408%20L%20632%20399%20L%20659%20386%20L%20677%20380%20L%20695%20377%20L%20712%20377%20L%20725%20380%20L%20739%20388%20Z%20M%20625%20216%20L%20683%20216%20L%20737%20222%20L%20742%20224%20L%20733%20226%20L%20721%20225%20L%20713%20230%20L%20711%20228%20L%20706%20228%20L%20694%20237%20L%20690%20233%20L%20690%20225%20L%20679%20228%20L%20674%20232%20L%20668%20232%20L%20659%20229%20L%20649%20222%20L%20632%20219%20L%20632%20217%20Z%20M%20788%20181%20L%20793%20182%20L%20797%20187%20L%20795%20193%20L%20792%20195%20L%20786%20195%20L%20782%20190%20L%20783%20185%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20607%20972%20L%20603%20981%20L%20603%20995%20L%20608%201003%20L%20610%20994%20L%20616%20987%20L%20620%20985%20L%20627%20985%20L%20635%20982%20L%20655%20981%20L%20676%20989%20L%20683%20996%20L%20689%201006%20L%20695%201007%20L%20697%201009%20L%20698%201024%20L%20694%201034%20L%20699%201032%20L%20706%201025%20L%20712%201010%20L%20710%20994%20L%20709%20997%20L%20706%20994%20L%20700%20994%20L%20694%20997%20L%20672%20976%20L%20658%20974%20L%20647%20967%20L%20642%20974%20L%20638%20974%20L%20636%20972%20L%20636%20961%20L%20629%20963%20L%20631%20972%20L%20625%20977%20L%20620%20977%20L%20613%20967%20L%20614%20966%20Z%20M%20686%20966%20L%20704%20980%20L%20719%201002%20L%20727%201004%20L%20730%201007%20L%20731%201023%20L%20728%201032%20L%20731%201030%20L%20741%201017%20L%20743%201003%20L%20748%20992%20L%20748%20981%20L%20742%20967%20L%20740%20965%20L%20742%20968%20L%20735%20972%20L%20726%20965%20L%20705%20960%20L%20724%20968%20L%20740%20983%20L%20742%20987%20L%20740%20991%20L%20732%20991%20L%20728%20996%20L%20726%20996%20L%20721%20992%20L%20713%20979%20Z%20M%20784%20943%20L%20784%20946%20L%20798%20950%20L%20819%20969%20L%20825%20970%20L%20830%20981%20L%20831%20992%20L%20837%20981%20L%20837%20966%20L%20829%20948%20L%20825%20944%20L%20830%20950%20L%20821%20957%20L%20813%20951%20L%20794%20942%20Z%20M%20659%20933%20L%20662%20937%20L%20658%20942%20L%20658%20945%20L%20663%20947%20L%20666%20945%20L%20667%20946%20L%20668%20944%20L%20670%20946%20Z%20M%20643%20913%20L%20647%20918%20L%20644%20921%20L%20642%20928%20L%20629%20938%20L%20627%20936%20L%20636%20947%20L%20634%20945%20L%20641%20933%20L%20651%20923%20L%20657%20930%20Z%20M%20936%20310%20L%20934%20309%20L%20945%20338%20L%20949%20368%20L%20949%20381%20L%20947%20383%20L%20935%20367%20L%20914%20348%20L%20929%20377%20L%20934%20397%20L%20936%20414%20L%20935%20440%20L%20933%20442%20L%20930%20440%20L%20924%20419%20L%20912%20395%20L%20909%20393%20L%20910%20410%20L%20907%20433%20L%20899%20458%20L%20895%20462%20L%20893%20460%20L%20892%20445%20L%20888%20427%20L%20873%20390%20L%20873%20416%20L%20871%20430%20L%20866%20448%20L%20862%20454%20L%20859%20452%20L%20853%20433%20L%20842%20410%20L%20823%20382%20L%20807%20365%20L%20805%20366%20L%20811%20394%20L%20812%20416%20L%20810%20425%20L%20806%20428%20L%20801%20423%20L%20790%20403%20L%20772%20383%20L%20759%20372%20L%20733%20357%20L%20724%20355%20L%20705%20346%20L%20693%20344%20L%20669%20344%20L%20646%20349%20L%20636%20353%20L%20662%20349%20L%20677%20349%20L%20699%20353%20L%20708%20356%20L%20725%20366%20L%20736%20376%20L%20745%20389%20L%20753%20415%20L%20752%20442%20L%20743%20476%20L%20723%20520%20L%20693%20569%20L%20646%20631%20L%20605%20676%20L%20568%20709%20L%20565%20710%20L%20562%20706%20L%20562%20692%20L%20567%20665%20L%20578%20636%20L%20602%20619%20L%20622%20602%20L%20645%20578%20L%20670%20546%20L%20630%20588%20L%20603%20610%20L%20574%20628%20L%20560%20633%20L%20556%20633%20L%20555%20631%20L%20563%20617%20L%20596%20572%20L%20647%20509%20L%20636%20515%20L%20562%20609%20L%20541%20630%20L%20520%20645%20L%20502%20653%20L%20490%20653%20L%20536%20590%20L%20513%20617%20L%20478%20651%20L%20454%20665%20L%20440%20669%20L%20436%20667%20L%20488%20596%20L%20459%20630%20L%20436%20653%20L%20411%20671%20L%20392%20678%20L%20372%20701%20L%20319%20772%20L%20289%20820%20L%20281%20838%20L%20282%20844%20L%20295%20841%20L%20324%20825%20L%20326%20826%20L%20289%20878%20L%20242%20954%20L%20209%201016%20L%20193%201056%20L%20191%201069%20L%20192%201071%20L%20196%201071%20L%20219%201056%20L%20303%20983%20L%20305%20984%20L%20255%201057%20L%20234%201094%20L%20228%201111%20L%20228%201124%20L%20234%201132%20L%20240%201134%20L%20254%201134%20L%20275%201128%20L%20279%201133%20L%20291%201137%20L%20316%201136%20L%20344%201128%20L%20364%201118%20L%20389%201101%20L%20403%201089%20L%20427%201064%20L%20447%201038%20L%20463%201013%20L%20489%20993%20L%20594%20901%20L%20595%20899%20L%20593%20894%20L%20588%20891%20L%20567%20868%20L%20569%20865%20L%20576%20867%20L%20586%20873%20L%20589%20867%20L%20607%20867%20L%20619%20880%20L%20622%20887%20L%20626%20891%20L%20624%20889%20L%20626%20886%20L%20666%20870%20L%20705%20909%20L%20710%20905%20L%20713%20905%20L%20716%20908%20L%20716%20911%20L%20712%20916%20L%20728%20932%20L%20730%20939%20L%20727%20943%20L%20717%20944%20L%20710%20949%20L%20712%20948%20L%20725%20951%20L%20739%20963%20L%20740%20961%20L%20756%20960%20L%20774%20966%20L%20784%20975%20L%20789%20983%20L%20800%20987%20L%20802%20991%20L%20802%201005%20L%20799%201012%20L%20806%201008%20L%20811%201002%20L%20815%20993%20L%20813%20968%20L%20812%20973%20L%20807%20971%20L%20796%20976%20L%20791%20973%20L%20788%20967%20L%20779%20958%20L%20767%20952%20L%20762%20941%20L%20756%20940%20L%20751%20932%20L%20749%20931%20L%20743%20936%20L%20738%20936%20L%20736%20933%20L%20741%20925%20L%20739%20915%20L%20742%20912%20L%20745%20914%20L%20702%20865%20L%20702%20863%20L%20717%20841%20L%20719%20842%20L%20709%20861%20L%20746%20837%20L%20783%20807%20L%20826%20764%20L%20851%20732%20L%20853%20734%20L%20846%20754%20L%20851%20751%20L%20874%20728%20L%20890%20708%20L%20908%20681%20L%20938%20621%20L%20960%20560%20L%20971%20521%20L%20979%20481%20L%20982%20444%20L%20977%20405%20L%20970%20382%20L%20966%20375%20L%20968%20374%20L%20974%20381%20L%20975%20368%20L%20974%20372%20L%20968%20364%20L%20966%20354%20L%20957%20337%20Z%20M%20247%201077%20L%20251%201085%20L%20246%201088%20L%20245%201091%20L%20240%201092%20L%20239%201085%20L%20241%201081%20Z%20M%20370%20935%20L%20371%20937%20L%20326%20997%20L%20301%201034%20L%20289%201044%20L%20286%201042%20L%20283%201045%20L%20277%201045%20L%20273%201043%20L%20264%201052%20L%20261%201049%20L%20270%201037%20L%20271%201038%20L%20281%201027%20L%20293%201010%20L%20326%20971%20Z%20M%20726%20921%20L%20728%20921%20L%20731%20926%20L%20729%20933%20L%20722%20926%20Z%20M%20729%20897%20L%20734%20902%20L%20732%20906%20L%20726%20902%20L%20726%20899%20Z%20M%20715%20882%20L%20720%20886%20L%20718%20890%20L%20711%20887%20Z%20M%20605%20762%20L%20608%20761%20L%20607%20760%20L%20609%20757%20L%20610%20759%20L%20617%20761%20L%20620%20764%20L%20611%20770%20L%20607%20770%20L%20606%20765%20L%20608%20765%20Z%20M%20611%20754%20L%20617%20750%20L%20620%20751%20L%20621%20749%20L%20625%20749%20L%20628%20752%20L%20628%20756%20L%20623%20761%20Z%20M%20549%20710%20L%20551%20713%20L%20551%20722%20L%20506%20774%20L%20403%20878%20L%20309%20963%20L%20307%20961%20L%20313%20953%20L%20322%20945%20L%20340%20922%20L%20375%20885%20Z%20M%20695%20704%20L%20696%20708%20L%20698%20709%20L%20695%20710%20L%20695%20713%20L%20692%20715%20L%20688%20710%20Z%20M%20704%20694%20L%20706%20695%20L%20706%20698%20L%20710%20698%20L%20713%20703%20L%20708%20708%20L%20707%20714%20L%20705%20716%20L%20701%20716%20L%20697%20708%20L%20699%20706%20L%20697%20705%20L%20701%20701%20L%20704%20705%20L%20706%20704%20L%20706%20700%20L%20702%20697%20Z%20M%20552%20678%20L%20554%20681%20L%20552%20701%20L%20465%20787%20L%20361%20883%20L%20316%20927%20L%20253%20993%20L%20211%201042%20L%20211%201036%20L%20222%201011%20L%20261%20942%20L%20292%20898%20L%20338%20843%20L%20374%20807%20L%20387%20807%20L%20403%20801%20L%20419%20792%20L%20456%20766%20L%20500%20728%20Z%20M%20704%20654%20L%20706%20658%20L%20711%20658%20L%20714%20661%20L%20715%20673%20L%20713%20676%20L%20705%20676%20L%20702%20674%20L%20704%20677%20L%20704%20681%20L%20702%20682%20L%20704%20685%20L%20700%20686%20L%20694%20678%20L%20691%20678%20L%20688%20674%20L%20692%20670%20L%20692%20664%20L%20694%20661%20Z%20M%20565%20642%20L%20558%20663%20L%20545%20677%20L%20494%20726%20L%20443%20767%20L%20401%20792%20L%20392%20795%20L%20387%20794%20L%20405%20766%20L%20455%20707%20L%20388%20767%20L%20355%20794%20L%20304%20827%20L%20299%20826%20L%20302%20817%20L%20316%20795%20L%20360%20739%20L%20398%20700%20L%20425%20677%20L%20428%20679%20L%20443%20679%20L%20461%20673%20L%20476%20664%20L%20493%20666%20L%20517%20657%20L%20542%20641%20L%20546%20643%20Z%20M%20563%20221%20L%20572%20225%20L%20571%20223%20L%20574%20220%20L%20585%20217%20L%20596%20218%20L%20607%20215%20L%20653%20214%20L%20706%20218%20L%20749%20224%20L%20749%20226%20L%20735%20233%20L%20732%20238%20L%20732%20249%20L%20693%20242%20L%20620%20239%20L%20672%20251%20L%20688%20260%20L%20701%20274%20L%20706%20287%20L%20704%20301%20L%20707%20297%20L%20711%20300%20L%20713%20309%20L%20720%20324%20L%20723%20327%20L%20724%20308%20L%20726%20304%20L%20735%20318%20L%20757%20341%20L%20753%20319%20L%20754%20313%20L%20760%20317%20L%20786%20345%20L%20784%20324%20L%20775%20300%20L%20779%20300%20L%20800%20317%20L%20800%20312%20L%20787%20283%20L%20772%20264%20L%20778%20263%20L%20800%20271%20L%20803%20270%20L%20770%20236%20L%20772%20234%20L%20797%20234%20L%20807%20230%20L%20801%20230%20L%20800%20228%20L%20811%20218%20L%20818%20203%20L%20818%20193%20L%20812%20179%20L%20798%20168%20L%20784%20166%20L%20760%20173%20L%20747%20173%20L%20712%20163%20L%20718%20157%20L%20703%20171%20L%20711%20173%20L%20720%20178%20L%20723%20182%20L%20720%20186%20L%20695%20190%20L%20680%20190%20L%20670%20193%20L%20656%20193%20L%20687%20204%20L%20729%20209%20L%20742%20214%20L%20753%20223%20L%20752%20224%20L%20729%20219%20L%20669%20212%20L%20610%20213%20L%20576%20218%20L%20565%20221%20L%20565%20219%20Z%20M%20771%20189%20L%20772%20201%20L%20775%20207%20L%20780%20212%20L%20787%20215%20L%20796%20216%20L%20796%20218%20L%20784%20219%20L%20776%20215%20L%20771%20210%20L%20768%20204%20L%20768%20194%20Z%20M%20788%20181%20L%20793%20182%20L%20797%20187%20L%20796%20192%20L%20790%20196%20L%20786%20195%20L%20782%20191%20L%20782%20186%20Z'/%3e%3c/g%3e%3c/svg%3e`;function Be({className:e}){return(0,M.jsx)(`span`,{className:`block overflow-hidden rounded-[20.7%] bg-accent ${e??``}`,children:(0,M.jsx)(`img`,{src:ze,alt:``,"aria-hidden":`true`,className:`h-full w-full`})})}function Ve(){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Be,{className:`h-[22px] w-[22px] shrink-0`}),(0,M.jsx)(`span`,{className:`hidden text-[16px] font-medium tracking-[0.04em] text-ink-50 md:inline`,children:`nightcrow`})]})}function He({open:e}){return(0,M.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,className:`h-3.5 w-3.5 shrink-0 transition-transform ${e?`rotate-90`:``}`,children:(0,M.jsx)(`path`,{d:`m9 18 6-6-6-6`})})}function Ue({className:e=`h-4 w-4`}){return(0,M.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,className:`shrink-0 ${e}`,children:[(0,M.jsx)(`path`,{d:`M3 6h.01`}),(0,M.jsx)(`path`,{d:`M3 12h.01`}),(0,M.jsx)(`path`,{d:`M3 18h.01`}),(0,M.jsx)(`path`,{d:`M8 6h13`}),(0,M.jsx)(`path`,{d:`M8 12h13`}),(0,M.jsx)(`path`,{d:`M8 18h13`})]})}function We({className:e=`h-4 w-4`}){return(0,M.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,className:`shrink-0 ${e}`,children:[(0,M.jsx)(`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`}),(0,M.jsx)(`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`}),(0,M.jsx)(`path`,{d:`M10 9H8`}),(0,M.jsx)(`path`,{d:`M16 13H8`}),(0,M.jsx)(`path`,{d:`M16 17H8`})]})}function Ge({className:e=`h-4 w-4`}){return(0,M.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,className:`shrink-0 ${e}`,children:[(0,M.jsx)(`path`,{d:`m4 17 6-6-6-6`}),(0,M.jsx)(`path`,{d:`M12 19h8`})]})}function Ke({repos:e,currentId:t,onSelect:n,onCloseProject:r,onOpenPicker:i,className:a=``}){let[o,s]=(0,j.useState)(!1),c=f(),l=(0,j.useRef)(null),u=e.find(e=>e.id===t);return(0,j.useEffect)(()=>{if(!o)return;let e=e=>{e.key===`Escape`&&(s(!1),l.current?.focus())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[o]),(0,M.jsxs)(`div`,{className:`relative min-w-0 flex-1 ${a}`,children:[(0,M.jsxs)(`button`,{ref:l,onClick:()=>s(e=>!e),"aria-haspopup":`menu`,"aria-expanded":o,title:u?.display_path??`Select a project`,className:`flex min-w-0 max-w-full items-center gap-1 rounded-sm bg-ink-700 py-0.5 pl-2 pr-1 text-ink-50`,children:[(0,M.jsx)(`span`,{className:`truncate`,children:u?.name??`No project`}),(0,M.jsx)(He,{open:o})]}),o&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`fixed inset-0 z-40`,onClick:()=>s(!1)}),(0,M.jsxs)(`div`,{role:`menu`,className:`nc-pop-in origin-top-left absolute left-0 z-50 mt-1 max-h-[70vh] w-56 max-w-[80vw] overflow-y-auto rounded-md border border-ink-700 bg-ink-900 py-1 shadow-lg`,children:[e.length===0&&(0,M.jsx)(`p`,{className:`px-3 py-1.5 text-ink-400`,children:`No projects open.`}),e.map(e=>(0,M.jsxs)(`div`,{className:`flex items-center ${e.id===t?`bg-ink-700 text-ink-50`:`text-ink-200`}`,children:[(0,M.jsx)(`button`,{role:`menuitem`,onClick:()=>{n(e.id),s(!1)},title:e.display_path,className:`min-w-0 flex-1 truncate py-1.5 pl-3 pr-1 text-left hover:text-accent`,children:e.name}),(0,M.jsx)(`button`,{onClick:()=>r(e.id),"aria-label":`close ${e.name}`,...e.id===t?c(`project.close`,`Close project`):{title:`Close project`},className:`mr-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-removed`,children:(0,M.jsx)(pe,{className:`h-3.5 w-3.5`})})]},e.id)),(0,M.jsx)(`div`,{className:`my-1 border-t border-ink-800`}),(0,M.jsxs)(`button`,{role:`menuitem`,onClick:()=>{i(),s(!1)},...c(`project.openDialog`,`Open a project`),className:`flex w-full items-center gap-1 px-3 py-1.5 text-left text-ink-400 hover:text-ink-200`,children:[(0,M.jsx)(D,{className:`h-3.5 w-3.5`}),`open`]})]})]})]})}function qe({side:e,repos:t,repo:n,onSelectRepo:r,onCloseRepo:i,onOpenPicker:a,draggingRepo:o,dragOverRepo:s,onRepoDragStart:u,onRepoDragMove:p,onRepoDragEnd:m}){let h=f(),g=c(),_=t.length>1?[`project.previous`,`project.next`]:[],v=e=>e!==null,b=_.map(e=>ge(e,g)).filter(v),x=_.map(e=>d(e,g)).filter(v),S=e===`left`;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`nav`,{"aria-keyshortcuts":b.length>0?b.join(` `):void 0,title:x.length>0?`Previous or next project (${x.join(`, `)})`:void 0,className:S?`hidden min-h-0 flex-1 flex-col overflow-y-auto md:flex`:`hidden items-stretch self-stretch overflow-x-auto pl-1 md:flex`,children:t.map(e=>(0,M.jsxs)(`div`,{"data-repo-id":e.id,onPointerDown:t=>u(t,e.id),onPointerMove:p,onPointerUp:m,onPointerCancel:m,onLostPointerCapture:m,"data-active":e.id===n,className:`nc-title-target flex items-center whitespace-nowrap ${S?`min-w-0 border-b border-ink-700`:`border-r border-ink-700`} ${t.length>1?`touch-none`:``} ${o===e.id?`opacity-60`:``} ${s===e.id?`bg-ink-800 ring-1 ring-inset ring-accent`:``} ${e.id===n?S?`bg-ink-900 text-ink-50 shadow-[inset_1px_0_0_0_var(--color-accent)]`:`bg-ink-950 text-ink-50 shadow-[inset_0_-1px_0_0_var(--color-accent)]`:`text-ink-400 hover:bg-ink-850 hover:text-ink-200`}`,title:e.display_path,children:[(0,M.jsx)(`button`,{onClick:()=>{r(e.id)},"aria-label":e.name,className:`self-stretch pl-3 pr-1 text-left ${S?`min-w-0 flex-1 py-2`:``}`,children:(0,M.jsx)(l,{title:e.name,className:S?``:y})}),(0,M.jsx)(`button`,{onClick:t=>{t.stopPropagation(),i(e.id)},"data-tab-close":!0,...e.id===n?h(`project.close`,`Close project`):{title:`Close project`},"aria-label":`close ${e.name}`,className:`mr-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-removed`,children:(0,M.jsx)(pe,{})})]},e.id))}),(0,M.jsxs)(`button`,{onClick:a,...h(`project.openDialog`,`Open a project`),className:`hidden shrink-0 items-center gap-1 rounded-sm px-2 py-0.5 text-ink-400 hover:text-accent md:inline-flex ${S?`mx-1 my-2 justify-center`:``}`,children:[(0,M.jsx)(D,{className:`h-3.5 w-3.5`}),`open`]})]})}var Je={key:()=>Me(`/api/push/key`).then(e=>e.public_key),subscribe:e=>ke(`/api/push/subscribe`,e),unsubscribe:e=>ke(`/api/push/unsubscribe`,{endpoint:e}),status:e=>ke(`/api/push/status`,{endpoint:e}).then(e=>e.subscribed),test:e=>ke(`/api/push/test`,{endpoint:e})};function Ye(){let e=navigator;return{secure:window.isSecureContext,serviceWorker:`serviceWorker`in navigator?navigator.serviceWorker:void 0,hasPushManager:`PushManager`in window,permission:()=>typeof Notification>`u`?void 0:Notification.permission,requestPermission:()=>Notification.requestPermission(),isIos:/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&navigator.maxTouchPoints>1,standalone:e.standalone===!0||window.matchMedia?.(`(display-mode: standalone)`).matches===!0}}function Xe(e){return e.secure?e.isIos&&!e.standalone?`needs-install`:!e.serviceWorker||!e.hasPushManager||e.permission()===void 0?`unsupported`:e.permission()===`denied`?`denied`:null:`insecure`}function Ze(e){e.secure&&e.serviceWorker&&e.serviceWorker.register(`./sw.js`).catch(()=>{})}async function Qe(e){return(await e.serviceWorker.ready).pushManager.getSubscription()}async function $e(e){let t=Xe(e);if(t)return t;let n=await Qe(e);return n?await Je.status(n.endpoint)?`on`:(await n.unsubscribe().catch(()=>!1),`off`):`off`}async function et(e){let t=Xe(e);if(t)return t;let n=await e.requestPermission();if(n===`denied`)return`denied`;if(n!==`granted`)return`off`;let r;try{r=await Je.key()}catch{return`unavailable`}let i=await e.serviceWorker.ready;await(await i.pushManager.getSubscription())?.unsubscribe();let a=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:rt(r)});return await Je.subscribe(a.toJSON()),`on`}async function tt(e){let t=await Qe(e);return t&&(await Je.unsubscribe(t.endpoint).catch(()=>void 0),await t.unsubscribe().catch(()=>!1)),Xe(e)??`off`}async function nt(e){let t=await Qe(e);if(!t)throw Error(`notifications are off in this browser`);await Je.test(t.endpoint)}function rt(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t+`=`.repeat((4-t.length%4)%4),r=atob(n),i=new Uint8Array(new ArrayBuffer(r.length));for(let e=0;e{let e=!1;return $e(a).then(t=>!e&&n(t)).catch(()=>!e&&n(`off`)),()=>{e=!0}},[a]);let o=(0,j.useCallback)(async(e,t)=>{i(!0);try{let t=await e();return t&&n(t),!0}catch(e){return T.error(e instanceof Error?`${t}: ${e.message}`:t),!1}finally{i(!1)}},[]);return{state:t,busy:r,enable:()=>o(()=>et(a),`could not turn notifications on`),disable:()=>o(()=>tt(a),`could not turn notifications off`),test:async()=>{await o(()=>nt(a),`could not send a test`)&&T.info(`Test notification sent`)}}}var at={unsupported:`This browser does not support notifications.`,insecure:`Notifications need HTTPS or localhost. See the notifications guide for tailscale serve.`,"needs-install":`On iPhone and iPad, add nightcrow to the Home Screen and open it from there first.`,denied:`Notifications are blocked for this site. Allow them in the browser's site settings.`,unavailable:`The server could not load its notification key. Check the daemon log.`},ot=`rounded-sm px-2 py-1 text-ink-200 hover:bg-ink-700 disabled:cursor-progress disabled:text-ink-400 disabled:hover:bg-transparent`;function st(){let{state:e,busy:t,enable:n,disable:r,test:i}=it(),a=e?at[e]:void 0;return(0,M.jsxs)(`section`,{"aria-labelledby":`nc-notifications-title`,className:`border-t border-ink-800 px-3 py-2`,children:[(0,M.jsx)(`h3`,{id:`nc-notifications-title`,className:`mb-1 text-xs uppercase tracking-wide text-ink-400`,children:`Notifications`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-ink-200`,children:`When a terminal asks for you`}),(e===`off`||e===`on`)&&(0,M.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e===`on`,"aria-busy":t,disabled:t,onClick:e===`on`?r:n,className:ot,children:e===`on`?`On`:`Off`}),e===null&&(0,M.jsx)(`span`,{className:`text-ink-400`,children:`…`})]}),a&&(0,M.jsx)(`p`,{className:`mt-1 text-xs text-ink-400`,children:a}),e===`on`&&(0,M.jsx)(`button`,{type:`button`,disabled:t,onClick:i,className:`mt-1 ${ot}`,children:`Send a test notification`})]})}var ct=`nc-settings-title`,lt=`nc-settings-dialog`,ut=`nc-screen-scale`;function dt({accent:e,next:t,cycle:n,onReloadConfig:r,reloading:i,onShowShortcuts:a}){let[c,l]=(0,j.useState)(!1),u=(0,j.useRef)(null),d=(0,j.useRef)(null),{scale:p,setScale:m}=ue(),h=f();(0,j.useLayoutEffect)(()=>{if(!c)return;let e=d.current;if(!e)return;e.querySelector(`[data-initial-focus]`)?.focus();let t=()=>[...e.querySelectorAll(`a[href], button:not(:disabled), select:not(:disabled), input:not(:disabled), [tabindex]:not([tabindex="-1"])`)],n=n=>{if(n.key===`Escape`){n.preventDefault(),l(!1),u.current?.focus();return}if(n.key!==`Tab`)return;let r=t(),i=r[0],a=r.at(-1);!i||!a?(n.preventDefault(),e.focus()):n.shiftKey&&document.activeElement===i?(n.preventDefault(),a.focus()):!n.shiftKey&&document.activeElement===a&&(n.preventDefault(),i.focus())},r=t=>{let n=t.target;n instanceof Node&&!e.contains(n)&&!u.current?.contains(n)&&l(!1)};return document.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r),()=>{document.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r)}},[c]);let g=()=>{l(!1),u.current?.focus(),a()};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{ref:u,type:`button`,onClick:()=>l(e=>!e),"aria-label":`Settings`,"aria-haspopup":`dialog`,"aria-expanded":c,"aria-controls":lt,title:`Settings`,className:`ml-auto flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent`,children:(0,M.jsx)(he,{})}),c&&(0,M.jsxs)(`div`,{ref:d,id:lt,role:`dialog`,"aria-labelledby":ct,tabIndex:-1,className:`nc-pop-in origin-top-right fixed right-2 top-[calc(var(--nc-header-h)+8px)] z-50 flex max-h-[calc(100vh-3.75rem)] w-72 max-w-[calc(100vw-1rem)] flex-col overflow-y-auto rounded-md border border-ink-700 bg-ink-900 shadow-xl focus:outline-none`,style:{maxHeight:`calc(100dvh - 3.75rem)`},children:[(0,M.jsx)(`div`,{className:`border-b border-ink-700 px-3 py-2`,children:(0,M.jsx)(`h2`,{id:ct,className:`font-medium text-ink-50`,children:`Settings`})}),(0,M.jsxs)(`section`,{"aria-labelledby":`nc-appearance-title`,className:`px-3 py-2`,children:[(0,M.jsx)(`h3`,{id:`nc-appearance-title`,className:`mb-1 text-xs uppercase tracking-wide text-ink-400`,children:`Appearance`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-ink-200`,children:`Accent colour`}),(0,M.jsxs)(`button`,{type:`button`,"data-initial-focus":!0,onClick:n,...h(`session.cycleAccent`,`Accent: ${e.name} (click for ${t.name})`),"aria-label":`accent colour: ${e.name}, click for ${t.name}`,className:`flex items-center gap-1.5 rounded-sm px-2 py-1 text-ink-200 hover:bg-ink-700`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-3 rounded-full bg-accent ring-1 ring-ink-600`}),e.name]})]}),(0,M.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,M.jsx)(`label`,{htmlFor:ut,className:`min-w-0 flex-1 text-ink-200`,children:`Screen scale`}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(`select`,{id:ut,"aria-label":`Screen scale`,value:p,onChange:e=>m(Number(e.currentTarget.value)),className:`appearance-none rounded-sm border border-ink-700 bg-ink-850 py-1 pl-2 pr-7 text-ink-50 focus:border-accent focus:outline-none`,children:o.map(e=>(0,M.jsxs)(`option`,{value:e,children:[e,`%`]},e))}),(0,M.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 right-2 flex items-center text-ink-400`,children:(0,M.jsx)(He,{open:!0})})]})]})]}),(0,M.jsx)(st,{}),(0,M.jsxs)(`div`,{className:`border-t border-ink-800 px-3 py-2`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:r,disabled:i,"aria-busy":i,...h(`session.reloadConfig`,`Reload config.toml on the server (does not reload this page)`),"aria-label":`reload the server config`,className:`flex w-full items-center gap-2 rounded-sm py-1.5 text-left text-ink-200 hover:bg-ink-700 disabled:cursor-progress disabled:text-ink-400 disabled:hover:bg-transparent`,children:[(0,M.jsx)(ne,{className:`h-3.5 w-3.5 ${i?`animate-spin`:``}`}),`Reload config.toml`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:g,...h(`help.shortcuts`,`Keyboard shortcuts`),"aria-label":`keyboard shortcuts`,className:`mt-1 flex w-full items-center gap-2 rounded-sm py-1.5 text-left text-ink-200 hover:bg-ink-700`,children:[(0,M.jsx)(s,{className:`h-3.5 w-3.5`}),`Keyboard shortcuts`]})]})]})]})}function ft(e){return e===`top`||e===`left`?e:null}function pt(e){return e===`top`?`left`:`top`}function mt({repos:e,repo:t,onSelectRepo:n,onCloseRepo:r,onOpenPicker:i,cloning:a,accent:o,next:s,cycle:c,draggingRepo:l,dragOverRepo:u,onRepoDragStart:d,onRepoDragMove:f,onRepoDragEnd:p,onReloadConfig:m,reloading:h,onShowShortcuts:g,tabStrip:_}){return(0,M.jsxs)(`header`,{className:`flex h-(--nc-header-h) items-center gap-2 border-b border-chrome-line bg-ink-900 px-[12.8px]`,children:[(0,M.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,M.jsx)(Ve,{})}),(0,M.jsx)(Ke,{className:`md:hidden`,repos:e,currentId:t,onSelect:n,onCloseProject:r,onOpenPicker:i}),_.side===`top`&&(0,M.jsx)(qe,{side:`top`,repos:e,repo:t,onSelectRepo:n,onCloseRepo:r,onOpenPicker:i,draggingRepo:l,dragOverRepo:u,onRepoDragStart:d,onRepoDragMove:f,onRepoDragEnd:p}),a&&(0,M.jsxs)(`span`,{role:`status`,title:`A clone is running on the server`,className:`flex shrink-0 items-center gap-1.5 px-2 py-0.5 text-ink-400`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 animate-pulse rounded-full bg-accent`}),`Cloning…`]}),(0,M.jsx)(dt,{accent:o,next:s,cycle:c,onReloadConfig:m,reloading:h,onShowShortcuts:g}),(0,M.jsx)(`button`,{onClick:_.toggle,title:`Project tabs ${_.side===`top`?`across the top`:`down the left`} (click to move them ${pt(_.side)})`,"aria-label":`project tabs: ${_.side}, click for ${pt(_.side)}`,"aria-pressed":_.side===`left`,className:`ml-1 hidden h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent md:flex`,children:(0,M.jsx)(De,{side:_.side})}),(0,M.jsx)(`a`,{href:`/logout`,title:`Sign out`,"aria-label":`sign out`,className:`ml-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent`,children:(0,M.jsx)(be,{})})]})}var ht=[`w-3/5`,`w-2/5`,`w-4/5`,`w-1/2`,`w-3/4`,`w-1/3`,`w-2/3`];function gt({className:e=``}){return(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`nc-skeleton block h-2.5 rounded-xs ${e}`})}function _t({rows:e=6,as:t=`div`,className:n=``}){let r=t;return(0,M.jsx)(M.Fragment,{children:Array.from({length:e},(e,t)=>(0,M.jsxs)(r,{"aria-hidden":`true`,className:`flex items-center gap-2 px-3 py-1.5 ${n}`,children:[(0,M.jsx)(gt,{className:`w-3 shrink-0`}),(0,M.jsx)(gt,{className:ht[t%ht.length]})]},t))})}function vt(){return(0,M.jsxs)(`div`,{"aria-busy":`true`,"aria-label":`Loading`,className:`flex h-full flex-col`,children:[(0,M.jsxs)(`div`,{className:`flex h-(--nc-header-h) shrink-0 items-center gap-2 border-b border-chrome-line bg-ink-900 px-[12.8px]`,children:[(0,M.jsx)(gt,{className:`h-[22px] w-[22px] shrink-0 rounded-sm`}),(0,M.jsx)(gt,{className:`hidden w-24 md:block`}),(0,M.jsx)(gt,{className:`w-28 md:hidden`}),(0,M.jsx)(gt,{className:`ml-auto h-4 w-4 shrink-0`}),(0,M.jsx)(gt,{className:`ml-1 h-4 w-4 shrink-0`})]}),(0,M.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 grid-rows-[minmax(0,1fr)] md:grid-cols-[18rem_minmax(0,1fr)] md:grid-rows-[minmax(0,3fr)_minmax(0,2fr)]`,children:[(0,M.jsx)(`div`,{className:`overflow-hidden border-chrome-line py-2 md:border-r`,children:(0,M.jsx)(_t,{rows:10})}),(0,M.jsx)(`div`,{className:`hidden overflow-hidden py-2 md:block`,children:(0,M.jsx)(_t,{rows:14})}),(0,M.jsxs)(`div`,{className:`hidden overflow-hidden border-t border-chrome-line md:col-span-2 md:block`,children:[(0,M.jsxs)(`div`,{className:`flex h-8 items-center gap-2 border-b border-chrome-line px-3`,children:[(0,M.jsx)(gt,{className:`w-30`}),(0,M.jsx)(gt,{className:`w-30`})]}),(0,M.jsx)(`div`,{className:`py-2`,children:(0,M.jsx)(_t,{rows:5})})]})]}),(0,M.jsx)(`div`,{className:`flex shrink-0 border-t border-chrome-line bg-ink-900 md:hidden`,children:[0,1,2].map(e=>(0,M.jsxs)(`div`,{className:`flex min-h-11 flex-1 flex-col items-center justify-center gap-1 py-1`,children:[(0,M.jsx)(gt,{className:`h-5 w-5`}),(0,M.jsx)(gt,{className:`h-2 w-10`})]},e))})]})}function yt({onSuccess:e}){let[t,n]=(0,j.useState)(``),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(!1);return(0,M.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,M.jsxs)(`form`,{onSubmit:async n=>{n.preventDefault(),o(!0),i(null);try{await A.login(t),e()}catch(e){i(e instanceof Error?e.message:`login failed`)}finally{o(!1)}},className:`w-[17rem] max-w-[86vw]`,children:[(0,M.jsx)(Be,{className:`mx-auto mb-3 block h-10 w-10`}),(0,M.jsx)(`h1`,{className:`text-center text-lg font-medium tracking-wide text-ink-50`,children:`nightcrow`}),(0,M.jsx)(`p`,{className:`mt-1 mb-5 text-center text-caption text-ink-400 uppercase`,children:`web viewer`}),r&&(0,M.jsx)(`p`,{className:`mb-2.5 text-center text-removed`,children:r}),(0,M.jsx)(`input`,{type:`password`,autoFocus:!0,value:t,onChange:e=>n(e.target.value),placeholder:`password`,className:`mb-2 w-full rounded-sm border border-ink-700 bg-ink-900 px-2.5 py-1.5 outline-none placeholder:text-ink-400 focus:border-accent focus:ring-[3px] focus:ring-accent/15`}),(0,M.jsx)(`button`,{"aria-busy":a,type:`submit`,disabled:a,className:`w-full rounded-sm bg-ink-50 py-1.5 font-semibold text-ink-950 hover:bg-white disabled:opacity-50`,children:(0,M.jsx)(k,{busy:a,children:`Sign in`})})]})})}var bt=`nightcrow.sidebarWidth`,xt=.5;function St(e){return Math.min(Math.max(Math.round(e),280),720)}function Ct(e){let t=720;try{t=Math.min(t,Math.round(window.innerWidth*xt))}catch{}return Math.min(Math.max(Math.round(e),280),Math.max(t,280))}function wt(){let e=Number(m(bt));return Number.isFinite(e)&&e>0?St(e):460}function Tt(e){h(bt,String(e))}function Et(){let[e,t]=(0,j.useState)(wt),n=(0,j.useCallback)(e=>{let n=Ct(e);t(n),Tt(n)},[]);return{width:e,resize:n,commit:n,reset:(0,j.useCallback)(()=>{let e=St(460);t(e),Tt(e)},[])}}var Dt=`[data-terminal-panel]`,Ot=`dialog[open], [role="dialog"], [aria-modal="true"]`,kt=`input, textarea, select, [contenteditable], [role="textbox"], [role="searchbox"], [role="combobox"]`,At=`data-focus-region`;function jt(e){return{"data-focus-region":e,tabIndex:-1}}function Mt(e){if(!(e instanceof Element)||e.closest(`[data-terminal-panel]`))return null;let t=e.closest(kt)??e;return{tagName:t.tagName,isContentEditable:It(t),role:t.getAttribute(`role`),type:Lt(t),inDialog:e.closest(Ot)!==null}}function Nt(e=document){return Pt(e)===`terminal`}function Pt(e=document){let t=e.activeElement;if(!t)return null;if(t.closest(`[data-terminal-panel]`))return`terminal`;let n=t.closest(`[${At}]`)?.getAttribute(At);return n===`list`||n===`content`?n:null}function Ft(e,t=document){let n=t.querySelector(`[${At}="${e}"]`);if(!n)return!1;let r=a(t.activeElement,t.querySelector(Dt));return Ce(r)?(n.focus(),!0):!1}function It(e){let t=e.getAttribute(`contenteditable`);return t===null?e.isContentEditable===!0:t!==`false`}function Lt(e){return e.tagName===`INPUT`?e.type?.toLowerCase()??null:null}var Rt=600;function zt(e){let[t,n]=(0,j.useState)({scrollTop:0,height:Rt}),r=(0,j.useCallback)(()=>{let t=e.current;if(!t)return;let r={scrollTop:t.scrollTop,height:t.clientHeight||Rt};n(e=>e.scrollTop===r.scrollTop&&e.height===r.height?e:r)},[e]);return(0,j.useLayoutEffect)(()=>{r();let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(r);return n.observe(t),()=>n.disconnect()},[e,r]),{viewport:t,refresh:r}}function Bt(){let e=new Map;return{start(t){let n=(e.get(t)??0)+1;return e.set(t,n),n},isCurrent(t,n){return e.get(t)===n}}}var Vt={children:{},expanded:new Set};function Ht(e,t,n){return{...e,children:{...e.children,[t]:n}}}function Ut(e,t){let n=new Set(e);return n.delete(t)||n.add(t),n}function Wt(e,t){return{...e,expanded:Ut(e.expanded,t)}}function Gt(e,t){let n=new Set(e.expanded);return t.forEach(e=>n.add(e)),{...e,expanded:n}}function Kt(e){let t=[],n=``;for(let r of e.split(`/`))n=n?`${n}/${r}`:r,t.push(n);return t}var qt=180,Jt={items:[],truncated:!1};function Yt({repo:e,authed:t,tab:n,filter:r,filterOpen:i,handle:a}){let[o,s]=(0,j.useState)(Vt),[c,l]=(0,j.useState)(Jt),[u,d]=(0,j.useState)(!1),[f]=(0,j.useState)(Bt);(0,j.useEffect)(()=>{if(!e||!t||n!==`tree`||!i||!r){l(Jt),d(!1);return}d(!0);let o=!0,s=setTimeout(()=>{A.treeSearch(e,r).then(e=>{o&&l({items:e.matches,truncated:e.truncated})}).catch(e=>{o&&a(e)}).finally(()=>{o&&d(!1)})},qt);return()=>{o=!1,clearTimeout(s)}},[e,t,n,r,i,a]);let p=(0,j.useCallback)((t,n)=>{if(!e)return;let r=f.start(t);A.tree(e,t).then(e=>{f.isCurrent(t,r)&&s(n=>Ht(n,t,e.entries))}).catch(e=>{if(!f.isCurrent(t,r)||n?.restoring)return Ne(e)?a(e):void 0;a(e)})},[e,a,f]);(0,j.useEffect)(()=>{e&&t&&n===`tree`&&p(``)},[e,t,n,p]);let m=(0,j.useCallback)(e=>{let t=!o.expanded.has(e);s(t=>Wt(t,e)),t&&!(e in o.children)&&p(e)},[o,p]),h=(0,j.useCallback)(e=>{s(t=>({...t,expanded:new Set(e)})),e.forEach(e=>{e in o.children||p(e,{restoring:!0})})},[o,p]),g=(0,j.useCallback)(e=>{let t=Kt(e);s(e=>Gt(e,t)),t.forEach(e=>{e in o.children||p(e)})},[o,p]);return{treeChildren:o.children,treeExpanded:o.expanded,treeMatches:c.items,treeTruncated:c.truncated,treeSearchLoading:u,loadTreeChildren:p,toggleTreeDir:m,revealTreeDir:g,seedTreeExpanded:h}}function Xt(e,t){let n=[],r=(i,a)=>{for(let o of e[i]??[]){let e=i?`${i}/${o.name}`:o.name;n.push({path:e,name:o.name,is_dir:o.is_dir,depth:a}),o.is_dir&&t.has(e)&&r(e,a+1)}};return r(``,0),n}var Zt=[`status`,`log`,`tree`],N={status:`Show the working-tree status`,log:`Show the commit log`,tree:`Show the file tree`};function Qt(e){return e===`log`?`view.toggleLog`:e===`tree`?`view.toggleTree`:null}function $t({tab:e,onChoose:t,filterOpen:n,onToggleFilter:r}){let i=f();return(0,M.jsxs)(`div`,{className:`flex shrink-0 items-stretch border-b border-chrome-line px-2`,children:[Zt.map(n=>{let r=Qt(n);return(0,M.jsx)(`button`,{onClick:()=>t(n),"aria-current":n===e?`page`:void 0,...r&&n!==e?i(r,N[n]):{title:N[n]},className:`px-2 py-1.5 ${n===e?`text-ink-50 shadow-[inset_0_-1px_0_0_var(--color-accent)]`:`text-ink-400 hover:text-ink-200`}`,children:n},n)}),(0,M.jsx)(`button`,{onClick:r,"aria-pressed":n,title:n?`Hide the filter`:`Filter the list`,"aria-label":n?`Hide the filter`:`Filter the list`,className:`my-1 ml-auto flex shrink-0 items-center rounded-sm px-1.5 hover:text-accent ${n?`text-ink-50`:`text-ink-400`}`,children:(0,M.jsx)(ie,{})})]})}function en({path:e,from:t,className:n}){return(0,M.jsx)(`span`,{className:`whitespace-nowrap ${n??``}`,title:t?`${t} → ${e}`:e,children:t?`${t} → ${e}`:e})}var tn=1e3;function nn(e,t){return e===void 0||e<=0?0:e-t}function rn(e,t,n){let r=nn(t,n);return e===null||Math.abs(r-e)>=1e3?r:e}function an(e,t,n){if(e===void 0)return`cool`;let r=Math.max(0,t-e);return r>=n?`cool`:r<5e3?`fresh`:`warm`}function on(e,t,n){return e.some(e=>an(e,t,n)!==`cool`)}var sn={fresh:`text-accent font-bold`,warm:`text-accent`,cool:``};function cn(e,t,n){let[r,i]=(0,j.useState)(()=>Date.now()+n);return(0,j.useEffect)(()=>{if(t<=0||!e)return;let r=e.map(e=>e.mtime),a=Date.now()+n;if(i(a),!on(r,a,t))return;let o=setInterval(()=>{let e=Date.now()+n;i(e),on(r,e,t)||clearInterval(o)},tn);return()=>clearInterval(o)},[e,t,n]),r}function ln(e){return e.startsWith(`not a git repository`)?`Not a git repository. Run git init here to track changes.`:`Status unavailable: ${e}`}function un(e){let t=Math.max(0,Math.floor(Date.now()/1e3-e));return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:t<2592e3?`${Math.floor(t/86400)}d`:t<31536e3?`${Math.floor(t/2592e3)}mo`:`${Math.floor(t/31536e3)}y`}function dn(e){return e===`+`?`bg-added/10`:e===`-`?`bg-removed/10`:``}function fn(e){return e===`?`?`text-ink-400`:e===`D`?`text-removed`:e===`A`?`text-added`:`text-accent`}function pn(e,t,n,r=20,i=12){let a=Math.max(1,Math.ceil(n/r)),o=Math.min(Math.floor(Math.max(0,t)/r),Math.max(0,e-a)),s=o+a,c=Math.max(0,Math.min(e,o-i)),l=Math.max(c,Math.min(e,s+i));return{start:c,end:l,before:c*r,after:(e-l)*r}}function mn(e){return Math.max(0,e-1)*20}function hn({status:e,files:t,hotWindowMs:n,clockSkewMs:r,viewport:i,openDiff:a}){let o=cn(t,n,r);if(e===null)return(0,M.jsx)(_t,{as:`li`,rows:8});if(e.unavailable!==void 0)return(0,M.jsx)(`li`,{className:`nc-fade-in px-3 py-1 text-ink-400`,children:ln(e.unavailable)});let s=t.length>200?pn(t.length,i.scrollTop,i.height):null,c=s?.start??0,l=s?t.slice(s.start,s.end):t;return(0,M.jsxs)(M.Fragment,{children:[s&&(0,M.jsx)(`li`,{"aria-hidden":`true`,"data-virtual-count":t.length,style:{height:s.before}}),l.map((e,t)=>{let r=c+t;return(0,M.jsx)(`li`,{"data-virtual-row":s?r:void 0,children:(0,M.jsxs)(`button`,{onClick:()=>a(e.path),className:`flex w-max min-w-full gap-2 px-3 py-0.5 text-left hover:bg-ink-850`,children:[(0,M.jsxs)(`span`,{className:`shrink-0`,children:[(0,M.jsx)(`span`,{className:fn(e.index),children:e.index===` `?` `:e.index}),(0,M.jsx)(`span`,{className:fn(e.worktree),children:e.worktree===` `?` `:e.worktree})]}),(0,M.jsx)(en,{path:e.path,from:e.old_path,className:sn[an(e.mtime,o,n)]})]})},e.path)}),s&&(0,M.jsx)(`li`,{"aria-hidden":`true`,style:{height:s.after}}),e.truncated&&(0,M.jsxs)(`li`,{className:`px-3 py-1 text-accent`,children:[`Showing the first `,e.files.length,` changed files.`]})]})}var gn={merge:`MERGING`,rebase:`REBASING`,"cherry-pick":`CHERRY-PICKING`,revert:`REVERTING`,bisect:`BISECTING`,am:`APPLYING`};function _n(e){let t=e?.operation,n=t?t.step!==void 0&&t.total!==void 0?`${gn[t.kind]} ${t.step}/${t.total}`:gn[t.kind]:null,r=e?.conflicts??0,i=r===0?null:r===1?`1 conflict`:`${r} conflicts`;return n&&i?`${n} · ${i}`:n??i}function vn(e){return e.kind===`head`&&e.name!==`HEAD`?`HEAD → ${e.name}`:e.name}function yn(e){switch(e){case`head`:return`border-accent text-accent font-medium`;case`local`:return`border-added/60 text-added`;case`tag`:return`border-ink-600 text-ink-200`;case`remote`:return`border-ink-700 text-ink-400`}}function bn({visibleCommits:e,decorations:t,commits:n,commitDrillDown:r,visibleCommitFiles:i,logDone:a,logStalled:o,logPagingPaused:s,viewport:c,setLogStalled:l,logSentinelRef:u,openCommitFiles:d,openCommit:f,openCommitFileDiff:p,setCommitDrillDown:m,setPaneEmpty:h,bumpPaneRequest:g}){let _=!r&&e.length>200?pn(e.length,c.scrollTop,c.height):null,v=_?e.slice(_.start,_.end):e,y=_?.start??0,b=r&&i.length>200?pn(i.length,c.scrollTop,c.height):null,x=b?i.slice(b.start,b.end):i,S=b?.start??0;return(0,M.jsxs)(M.Fragment,{children:[!r&&_&&(0,M.jsx)(`li`,{"aria-hidden":`true`,"data-virtual-count":e.length,style:{height:_.before}}),!r&&v.map((e,n)=>{let r=y+n,i=t.divergenceOf(e.oid);return(0,M.jsx)(`li`,{"data-virtual-row":_?r:void 0,children:(0,M.jsxs)(`button`,{onClick:()=>void d(e),title:`${e.author} · ${e.summary}`,className:`flex w-max min-w-full items-baseline gap-2 px-3 py-0.5 text-left hover:bg-ink-850`,children:[(0,M.jsx)(`span`,{className:`w-2 shrink-0 ${i===`behind`?`text-accent`:`text-added`}`,title:i===`ahead`?`Not on the upstream yet`:i===`behind`?`On the upstream, not here yet`:void 0,children:i===`ahead`?`↑`:i===`behind`?`↓`:``}),(0,M.jsx)(`span`,{className:`shrink-0 text-accent`,children:e.short_id}),(0,M.jsx)(`span`,{className:`w-10 shrink-0 text-right text-ink-400`,children:un(e.time)}),(0,M.jsx)(`span`,{className:`max-w-[6rem] shrink-0 truncate text-ink-400`,children:e.author}),t.refsOf(e.oid)?.map(e=>(0,M.jsx)(`span`,{className:`shrink-0 self-center rounded-sm border px-1 text-2xs ${yn(e.kind)}`,children:vn(e)},`${e.kind}:${e.name}`)),(0,M.jsx)(`span`,{className:`whitespace-nowrap ${e.merge?`text-ink-400`:``}`,children:e.summary})]})},e.oid)}),!r&&_&&(0,M.jsx)(`li`,{"aria-hidden":`true`,style:{height:_.after}}),!r&&t.truncated&&(0,M.jsx)(`li`,{className:`px-3 py-1 text-2xs text-ink-400`,children:`Too many refs to mark them all — some branch, tag or upstream marks are not shown.`}),!r&&!a&&!o&&!s&&(0,M.jsxs)(`li`,{ref:u,className:`flex flex-col gap-2 px-3 py-1.5`,"aria-hidden":`true`,children:[(0,M.jsx)(gt,{className:`w-3/5`}),(0,M.jsx)(gt,{className:`w-2/5`}),(0,M.jsx)(gt,{className:`w-1/2`})]}),!r&&!a&&!o&&s&&(0,M.jsxs)(`li`,{className:`px-3 py-1 text-ink-400`,children:[`filtering `,n.length,` loaded commits — clear the filter to load more`]}),!r&&o&&(0,M.jsx)(`li`,{className:`px-3 py-1`,children:(0,M.jsx)(`button`,{onClick:()=>l(!1),className:`text-ink-400 hover:text-accent`,children:`could not load more — retry`})}),r&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`li`,{className:`sticky top-0 z-10 flex w-max min-w-full items-center gap-1 bg-ink-900 px-2 py-1 text-ink-400`,children:[(0,M.jsx)(`button`,{onClick:()=>{g(),m(null),h()},className:`rounded-sm px-1 hover:text-accent`,title:`Back to commit log`,children:`< log`}),(0,M.jsx)(`span`,{className:`text-ink-600`,children:`·`}),(0,M.jsx)(`span`,{className:`shrink-0 text-accent`,children:r.commit.short_id}),(0,M.jsx)(`button`,{onClick:()=>f(r.commit.oid),className:`rounded-sm px-1 hover:text-accent`,title:`Show the complete commit diff`,children:`all changes`})]}),b&&(0,M.jsx)(`li`,{"aria-hidden":`true`,"data-virtual-count":i.length,style:{height:b.before}}),x.map((e,t)=>{let n=S+t;return(0,M.jsx)(`li`,{"data-virtual-row":b?n:void 0,children:(0,M.jsxs)(`button`,{onClick:()=>p(r.commit.oid,e.path),className:`flex w-max min-w-full gap-2 px-3 py-0.5 text-left hover:bg-ink-850`,children:[(0,M.jsx)(`span`,{className:fn(e.index),children:e.index}),(0,M.jsx)(en,{path:e.path,from:e.old_path})]})},e.path)}),b&&(0,M.jsx)(`li`,{"aria-hidden":`true`,style:{height:b.after}}),r.files.length===0&&(0,M.jsx)(`li`,{className:`px-3 py-2 text-ink-400`,children:`No changed files.`}),r.files.length>0&&i.length===0&&(0,M.jsx)(`li`,{className:`px-3 py-2 text-ink-400`,children:`No matching files.`}),r.truncated&&(0,M.jsxs)(`li`,{className:`px-3 py-1 text-accent`,children:[`Showing the first `,r.files.length,` files.`]})]})]})}function xn({treeSearching:e,treeMatches:t,treeTruncated:n,treeSearchLoading:r,treeRows:i,treeExpanded:a,openFile:o,revealTreeDir:s,toggleTreeDir:c}){return e?(0,M.jsxs)(M.Fragment,{children:[t.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(`button`,{onClick:()=>{e.is_dir?s(e.path):o(e.path)},title:e.path,className:`w-max min-w-full whitespace-nowrap px-3 py-0.5 text-left hover:bg-ink-850`,children:e.is_dir?(0,M.jsxs)(`span`,{className:`text-accent`,children:[e.path,`/`]}):e.path})},e.path)),t.length===0&&(0,M.jsx)(`li`,{className:`px-3 py-0.5 text-ink-400`,children:r?`searching…`:`no matches`}),n&&(0,M.jsxs)(`li`,{className:`px-3 py-0.5 text-ink-400`,children:[`showing the first `,t.length,` matches`]})]}):(0,M.jsx)(M.Fragment,{children:i.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{onClick:()=>e.is_dir?c(e.path):o(e.path),title:e.path,style:{paddingLeft:`${e.depth*.75+.5}rem`},className:`flex w-max min-w-full items-center gap-1 py-0.5 pr-3 text-left hover:bg-ink-850`,children:[e.is_dir?(0,M.jsx)(He,{open:a.has(e.path)}):(0,M.jsx)(`span`,{className:`h-3.5 w-3.5 shrink-0`}),(0,M.jsx)(`span`,{className:`whitespace-nowrap ${e.is_dir?`text-accent`:``}`,children:e.is_dir?`${e.name}/`:e.name})]})},e.path))})}function Sn(e){let{tab:t,chooseTab:n,filter:r,setFilter:i,filterOpen:a,setFilterOpen:o,status:s,files:c,hotWindowMs:l,clockSkewMs:u,openDiff:d,openFile:f,openCommit:p,openCommitFileDiff:m,openCommitFiles:h,repo:g,authed:_,handle:v,sidebarRef:y,draggingSidebar:b,onSidebarDragStart:x,onSidebarDragMove:S,onSidebarDragEnd:C,onSidebarDragCancel:w,filesMax:T,bumpPaneRequest:E,commits:ee,logDone:te,logStalled:ne,setLogStalled:re,commitDrillDown:ie,setCommitDrillDown:ae,logSentinelRef:oe,visibleCommits:se,decorations:ce,logPagingPaused:le,visibleCommitFiles:ue,mobileView:de,restoreTree:fe,restoreKnown:pe,onTreeExpanded:me,clearPane:he,touched:ge}=e,_e=Yt({repo:g,authed:_,tab:t,filter:r,filterOpen:a,handle:v}),ve=(0,j.useRef)(null),{viewport:ye,refresh:be}=zt(ve),xe=t===`tree`&&a&&r!==``,D=Xt(_e.treeChildren,_e.treeExpanded),{seedTreeExpanded:O}=_e,Se=(0,j.useRef)(!1);(0,j.useEffect)(()=>{Se.current||pe&&!ge&&t===`tree`&&(Se.current=!0,fe.length!==0&&O(fe))},[t,pe,ge,fe,O]);let Ce=e=>{me([...Ut(_e.treeExpanded,e)]),_e.toggleTreeDir(e)},we=e=>{let t=new Set(_e.treeExpanded);Kt(e).forEach(e=>t.add(e)),me([...t]),_e.revealTreeDir(e)},Te=()=>{a&&i(``),o(e=>!e)};return(0,M.jsxs)(`section`,{ref:y,...jt(`list`),className:`nc-fade-in relative min-h-0 flex-col overflow-hidden ${de===`files`?`flex`:`hidden md:flex`} ${T?`md:flex`:`border-chrome-line md:border-r`}`,children:[!T&&(0,M.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the file sidebar (double-click to reset)`,title:`Drag to resize · double-click to reset`,onPointerDown:x,onPointerMove:S,onPointerUp:C,onPointerCancel:w,onLostPointerCapture:C,className:`absolute -right-px top-0 z-20 hidden h-full w-1.5 cursor-col-resize touch-none md:block ${b?`bg-accent`:`hover:bg-accent`}`}),(0,M.jsx)($t,{tab:t,onChoose:n,filterOpen:a,onToggleFilter:Te}),a&&(0,M.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`filter…`,autoFocus:!0,className:`mx-2 mb-1 shrink-0 rounded-sm bg-ink-850 px-2 py-1 outline-none placeholder:text-ink-400 focus:ring-1 focus:ring-accent`}),(0,M.jsxs)(`ul`,{ref:ve,onScroll:be,className:`nc-content min-h-0 flex-1 overflow-auto`,children:[t===`status`&&(0,M.jsx)(hn,{status:s,files:c,hotWindowMs:l,clockSkewMs:u,viewport:ye,openDiff:d}),t===`log`&&(0,M.jsx)(bn,{visibleCommits:se,decorations:ce,commits:ee,commitDrillDown:ie,visibleCommitFiles:ue,logDone:te,logStalled:ne,logPagingPaused:le,viewport:ye,setLogStalled:re,logSentinelRef:oe,openCommitFiles:h,openCommit:p,openCommitFileDiff:m,setCommitDrillDown:ae,setPaneEmpty:he,bumpPaneRequest:E}),t===`tree`&&(0,M.jsx)(xn,{treeSearching:xe,treeMatches:_e.treeMatches,treeTruncated:_e.treeTruncated,treeSearchLoading:_e.treeSearchLoading,treeRows:D,treeExpanded:_e.treeExpanded,openFile:f,revealTreeDir:we,toggleTreeDir:Ce})]})]})}function Cn(e){let t=[],n=[],r=[],i=()=>{let e=Math.max(n.length,r.length);for(let i=0;i{t(e=>e===`split`?`unified`:`split`)},[])}}var Tn=[`.md`,`.markdown`],En=[`.html`,`.htm`];function Dn(e){let t=e.toLowerCase();return Tn.some(e=>t.endsWith(e))}function On(e){let t=e.toLowerCase();return En.some(e=>t.endsWith(e))}function kn(e){return Dn(e)||On(e)}function An(e){return e.map(e=>e.map(e=>e.t).join(``)).join(` -`)}function jn(e,t=0){if(new Set(e.hunks.map(t=>t.file_path??e.path)).size>1)return null;for(let n of e.hunks.slice(Math.max(0,t)))for(let e of n.lines)if(e.new_lineno!==void 0)return e.new_lineno;return null}function Mn(e){return Math.max(0,e-1-2)}function Nn(e,t){return t<=0?null:Math.min(e,t)}function Pn(e,t){let n=0;return e.forEach((e,r)=>{e<=t&&(n=r)}),n}function Fn(e){return e.kind===`empty`||!e.source?null:{want:e.kind===`diff`?`file`:`diff`,source:e.source}}function In(e){return e.index!==`D`&&e.worktree!==`D`}function Ln(e){return e.hunks.some(e=>e.lines.some(e=>e.old_lineno!==void 0||e.new_lineno!==void 0))}function Rn(e){return e.kind===`workdir`?`workdir:${e.path}`:`commit:${e.oid}:${e.path}`}function zn({pane:e,previewRendered:t,setPreviewRendered:n,filesMax:r,setMaximized:i,onShowOtherFace:a,canEdit:o,editing:s,onToggleEdit:c}){let l=wn(),d=f();return(0,M.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[Fn(e)&&(0,M.jsx)(`button`,{onClick:a,"aria-pressed":e.kind===`file`,title:e.kind===`file`?`Back to the diff`:`Open the whole file at this change`,"aria-label":e.kind===`file`?`Back to the diff`:`Open the whole file at this change`,className:`flex shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent ${e.kind===`file`?`text-accent`:``}`,children:(0,M.jsx)(b,{})}),e.kind===`diff`&&(0,M.jsx)(`button`,{onClick:l.toggle,"aria-pressed":l.layout===`split`,title:l.layout===`split`?`Switch to unified diff`:`Switch to split diff`,"aria-label":l.layout===`split`?`Switch to unified diff`:`Switch to split diff`,className:`flex shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent ${l.layout===`split`?`text-accent`:``}`,children:(0,M.jsx)(v,{})}),o&&(0,M.jsx)(`button`,{onClick:c,"aria-pressed":s,title:s?`Stop editing`:`Edit this page's text`,"aria-label":s?`Stop editing`:`Edit this page's text`,className:`flex shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent ${s?`text-accent`:``}`,children:(0,M.jsx)(fe,{})}),e.kind===`file`&&kn(e.value.path)&&!s&&(0,M.jsx)(`button`,{onClick:()=>n(e=>!e),"aria-pressed":t,title:t?`Show raw source`:`Show the rendered page`,"aria-label":t?`Show raw source`:`Show the rendered page`,className:`flex shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent ${t?`text-accent`:``}`,children:(0,M.jsx)(p,{})}),(0,M.jsx)(`button`,{onClick:()=>i(r?`none`:`files`),"aria-pressed":r,...d(`view.toggleMaximize`,r?`Restore the layout`:`Maximize the file pane`),"aria-label":r?`Restore the layout`:`Maximize the file pane`,className:`hidden shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent md:flex`,children:(0,M.jsx)(u,{maximized:r})})]})}var Bn=3;function Vn(e){let t=e<1?1:String(Math.floor(e)).length;return Math.max(t,Bn)}function Hn(e){let t=0;for(let n of e)for(let e of n.lines)t=Math.max(t,e.old_lineno??0,e.new_lineno??0);return Vn(t)}function P({nos:e,digits:t,tint:n=``,stickyClass:r=`sticky left-0`}){return(0,M.jsx)(`span`,{className:`${r} shrink-0 select-none bg-ink-950`,children:(0,M.jsx)(`span`,{className:`flex gap-[1ch] px-[1ch] text-ink-400 ${n}`,children:e.map((e,n)=>(0,M.jsx)(`span`,{className:`text-right`,style:{width:`${t}ch`},children:e??``},n))})})}function Un(){let e=`(min-width: 768px)`,[t,n]=(0,j.useState)(()=>window.matchMedia(e).matches);return(0,j.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[]),t}function Wn(e,t,n){return e.hunks.flatMap((e,r)=>{let i={kind:`header`,hunk:r,text:`${e.file_path?`${e.file_path} `:``}${e.header}`};if(!t)return[i,...e.lines.map(e=>({kind:`unified`,hunk:r,line:e}))];let a=Cn(e.lines);return n?[i,...a.map(({left:e,right:t})=>({kind:`pair`,hunk:r,left:e,right:t}))]:[i,...a.map(({left:e})=>({kind:`side`,hunk:r,line:e,side:`old`,border:!1})),...a.map(({right:e},t)=>({kind:`side`,hunk:r,line:e,side:`new`,border:t===0}))]})}function Gn({line:e}){return(0,M.jsxs)(`span`,{className:`whitespace-pre pr-3`,children:[(0,M.jsx)(`span`,{className:`select-none text-ink-400`,children:e.kind}),e.spans.map((e,t)=>(0,M.jsx)(`span`,{style:{color:e.c},children:e.t},t))]})}function Kn({line:e,side:t,digits:n,stickyClass:r}){let i=e?dn(e.kind):`bg-ink-900/40`;return(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-1 ${i}`,children:[(0,M.jsx)(P,{nos:[e?t===`old`?e.old_lineno:e.new_lineno:void 0],digits:n,tint:i,stickyClass:r}),e?(0,M.jsx)(Gn,{line:e}):(0,M.jsx)(`span`,{className:`pr-3`,children:` `})]})}function qn({diff:e,split:t,viewport:n}){let r=Un(),i=(0,j.useMemo)(()=>Wn(e,t,r),[e,t,r]),a=Hn(e.hunks),o=pn(i.length,n.scrollTop,n.height);return(0,M.jsxs)(`div`,{className:`min-w-full py-1`,"data-virtual-count":i.length,children:[(0,M.jsx)(`div`,{"aria-hidden":`true`,style:{height:o.before}}),i.slice(o.start,o.end).map((e,t)=>{let n=o.start+t,r={"data-hunk":e.hunk,"data-virtual-row":n};if(e.kind===`header`)return(0,M.jsx)(`div`,{...r,className:`h-5 bg-ink-850 px-3 text-ink-400`,children:e.text},n);if(e.kind===`unified`){let t=dn(e.line.kind);return(0,M.jsxs)(`div`,{...r,className:`flex h-5 w-max min-w-full ${t}`,children:[(0,M.jsx)(P,{nos:[e.line.old_lineno,e.line.new_lineno],digits:a,tint:t}),(0,M.jsx)(Gn,{line:e.line})]},n)}return e.kind===`pair`?(0,M.jsxs)(`div`,{...r,className:`flex h-5 min-w-full`,children:[(0,M.jsx)(Kn,{line:e.left,side:`old`,digits:a}),(0,M.jsx)(`div`,{className:`flex min-w-0 flex-1 border-l border-ink-800`,children:(0,M.jsx)(Kn,{line:e.right,side:`new`,digits:a,stickyClass:`sticky left-1/2`})})]},n):(0,M.jsx)(`div`,{...r,className:`flex h-5 min-w-full ${e.border?`border-t border-ink-800`:``}`,children:(0,M.jsx)(Kn,{line:e.line,side:e.side,digits:a})},n)}),(0,M.jsx)(`div`,{"aria-hidden":`true`,style:{height:o.after}})]})}function Jn({line:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`text-ink-400 select-none`,children:e.kind}),e.spans.map((e,t)=>(0,M.jsx)(`span`,{style:{color:e.c},children:e.t},t))]})}function Yn({line:e,digits:t,side:n}){if(e===null)return(0,M.jsxs)(`div`,{className:`flex bg-ink-900/40`,children:[(0,M.jsx)(P,{nos:[void 0],digits:t,tint:`bg-ink-900/40`}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:` `})]});let r=dn(e.kind);return(0,M.jsxs)(`div`,{className:`flex ${r}`,children:[(0,M.jsx)(P,{nos:[n===`old`?e.old_lineno:e.new_lineno],digits:t,tint:r}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:(0,M.jsx)(Jn,{line:e})})]})}function Xn({cells:e,digits:t,side:n,border:r}){return(0,M.jsx)(`div`,{className:`min-w-0 flex-none overflow-x-auto md:flex-1 md:basis-1/2 ${r?`border-t border-ink-800 md:border-t-0 md:border-l`:``}`,children:(0,M.jsx)(`div`,{className:`w-max min-w-full`,children:e.map((e,r)=>(0,M.jsx)(Yn,{line:e,digits:t,side:n},r))})})}function Zn({lines:e,digits:t}){let n=Cn(e);return(0,M.jsxs)(`div`,{className:`flex flex-col md:flex-row`,children:[(0,M.jsx)(Xn,{cells:n.map(e=>e.left),digits:t,side:`old`,border:!1}),(0,M.jsx)(Xn,{cells:n.map(e=>e.right),digits:t,side:`new`,border:!0})]})}function Qn({diff:e,split:t,viewport:n={scrollTop:0,height:600}}){if(e.hunks.reduce((e,t)=>e+t.lines.length,0)>200)return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(qn,{diff:e,split:t,viewport:n}),e.truncated&&(0,M.jsx)(`p`,{className:`p-3 text-accent`,children:`Diff truncated — it exceeded the server's size ceiling.`})]});let r=Hn(e.hunks);return(0,M.jsxs)(`div`,{className:`p-1`,children:[e.hunks.length===0&&(0,M.jsx)(`p`,{className:`p-3 text-ink-400`,children:`No changes.`}),e.hunks.map((e,n)=>{let i=(0,M.jsxs)(`div`,{className:`bg-ink-850 px-3 py-0.5 text-ink-400`,children:[e.file_path?`${e.file_path} `:``,e.header]});return(0,M.jsx)(`div`,{"data-hunk":n,className:`mb-2`,children:t?(0,M.jsxs)(M.Fragment,{children:[i,(0,M.jsx)(Zn,{lines:e.lines,digits:r})]}):(0,M.jsxs)(`div`,{className:`w-max min-w-full`,children:[i,e.lines.map((e,t)=>{let n=dn(e.kind);return(0,M.jsxs)(`div`,{className:`flex ${n}`,children:[(0,M.jsx)(P,{nos:[e.old_lineno,e.new_lineno],digits:r,tint:n}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:(0,M.jsx)(Jn,{line:e})})]},t)})]})},n)}),e.truncated&&(0,M.jsx)(`p`,{className:`p-3 text-accent`,children:`Diff truncated — it exceeded the server's size ceiling.`})]})}var $n=[`failed to fetch dynamically imported module`,`error loading dynamically imported module`,`importing a module script failed`,`unable to preload css`];function er(e){let t=e instanceof Error?e.message:typeof e==`string`?e:``;if(!t)return!1;let n=t.toLowerCase();return $n.some(e=>n.includes(e))}var tr=class extends j.Component{state={error:null,failed:!1};static getDerivedStateFromError(e){return{error:e,failed:!0}}componentDidCatch(e,t){console.error(`nightcrow: a subtree failed to render`,e,t)}render(){return this.state.failed?(0,M.jsx)(nr,{chunk:er(this.state.error),region:this.props.region,className:this.props.className}):this.props.children}};function nr({chunk:e,region:t,className:n}){return(0,M.jsxs)(`div`,{role:`alert`,className:`h-full min-h-0 flex-col items-start gap-3 p-4 text-ink-400 ${n??`flex`}`,children:[e?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{className:`text-accent`,children:`Part of the app could not be loaded.`}),(0,M.jsx)(`p`,{children:`Most likely the server was updated while this tab was open, and reloading picks up the current version. If the reload fails too, the server is not reachable from here. Either way nothing on the server is affected — the session, its repositories, and its terminals are untouched.`})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{className:`text-removed`,children:t?`The ${t} could not be rendered.`:`Something went wrong.`}),(0,M.jsx)(`p`,{children:`The details are in the browser console.`})]}),(0,M.jsx)(`button`,{onClick:()=>window.location.reload(),className:`rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:border-accent hover:text-accent`,children:`Reload`})]})}function rr({lines:e}){let t=Vn(e.length);return(0,M.jsx)(`pre`,{className:`w-max min-w-full py-2 text-ink-200`,children:e.map((e,n)=>(0,M.jsxs)(`div`,{"data-line":n+1,className:`flex`,children:[(0,M.jsx)(P,{nos:[n+1],digits:t}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:e.length===0?` `:e.map((e,t)=>(0,M.jsx)(`span`,{style:{color:e.c},children:e.t},t))})]},n))})}function ir({lines:e,viewport:t}){let n=Vn(e.length),r=pn(e.length,t.scrollTop,t.height);return(0,M.jsxs)(`pre`,{className:`w-max min-w-full`,"data-virtual-count":e.length,children:[(0,M.jsx)(`div`,{"aria-hidden":`true`,style:{height:r.before}}),e.slice(r.start,r.end).map((e,t)=>{let i=r.start+t;return(0,M.jsxs)(`div`,{"data-line":i+1,"data-virtual-row":i,className:`flex h-5 text-ink-200`,children:[(0,M.jsx)(P,{nos:[i+1],digits:n}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:e.length===0?` `:e.map((e,t)=>(0,M.jsx)(`span`,{style:{color:e.c},children:e.t},t))})]},i)}),(0,M.jsx)(`div`,{"aria-hidden":`true`,style:{height:r.after}})]})}var ar=`modulepreload`,or=function(e,t){return new URL(e,t).href},sr={},cr=function(e){return e.pathname.endsWith(`.css`)},lr=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},ur=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=or(t,n);let r=s(t),i=cr(r);return lr(sr,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:ar,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function dr(e,t){return`${e??``}\u0000${Rn(t)}`}var fr=(0,j.lazy)(()=>ur(()=>import(`./Markdown-DEJAds14.js`).then(e=>({default:e.MarkdownView})),__vite__mapDeps([0,1,2,3]),import.meta.url)),pr=(0,j.lazy)(()=>ur(()=>import(`./Html-DGFy4jGa.js`).then(e=>({default:e.HtmlView})),__vite__mapDeps([4,1]),import.meta.url)),mr=(0,j.lazy)(()=>ur(()=>import(`./HtmlEditor-DzgQSTDx.js`).then(e=>({default:e.HtmlEditor})),__vite__mapDeps([5,1,2,6,7]),import.meta.url));function hr({repo:e,pane:t,loading:n=!1,previewRendered:r,setPreviewRendered:i,filesMax:a,setMaximized:o,showOtherFace:s,status:c,className:l=``}){let u=wn(),[d,f]=(0,j.useState)(!1),p=t.kind===`file`?t.value.path:null,m=t.kind===`file`&&t.source?.kind===`commit`,h=e!==null&&p!==null&&!m&&On(p),g=(0,j.useRef)(null),{viewport:_,refresh:v}=zt(g),y=t.kind===`file`?t.anchor:void 0,b=(0,j.useRef)(null),x=()=>{let n=g.current;if(!n)return 0;let r=n.getBoundingClientRect().top,i=Array.from(n.querySelectorAll(`[data-hunk]`),e=>({offset:e.getBoundingClientRect().top-r+n.scrollTop,hunk:Number(e.dataset.hunk??0)}));return t.kind===`diff`&&t.source&&(b.current={key:dr(e,t.source),top:n.scrollTop,left:n.scrollLeft}),i[Pn(i.map(e=>e.offset),n.scrollTop)]?.hunk??0};return(0,j.useEffect)(()=>{let n=g.current;if(!n)return;if(t.kind===`diff`&&t.source){let r=b.current;r&&r.key===dr(e,t.source)&&(n.scrollTop=r.top,n.scrollLeft=r.left,b.current=null,v());return}if(y===void 0||t.kind!==`file`)return;let r=Nn(y,t.value.lines.length);if(r===null)return;if(t.value.lines.length>200){n.scrollTop=mn(r),v();return}let i=n.querySelector(`[data-line="${r}"]`);i&&(n.scrollTop+=i.getBoundingClientRect().top-n.getBoundingClientRect().top,v())},[t,y,e,v]),(0,j.useEffect)(()=>{f(!1)},[e,p,m]),(0,M.jsxs)(`section`,{...jt(`content`),className:`min-h-0 min-w-0 flex-col ${l}`,children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 bg-ink-850 px-3 py-0.5 text-ink-400`,children:[t.kind===`file`&&(0,M.jsx)(en,{path:t.value.path,className:`min-w-0 truncate`}),(0,M.jsx)(zn,{pane:t,previewRendered:r,setPreviewRendered:i,filesMax:a,setMaximized:o,onShowOtherFace:()=>s(x()),canEdit:h,editing:d&&h,onToggleEdit:()=>f(e=>!e)})]}),(0,M.jsx)(`div`,{ref:g,onScroll:v,className:`nc-content min-h-0 flex-1 overflow-auto`,children:n?(0,M.jsx)(`div`,{"aria-busy":`true`,"aria-label":`Loading`,className:`py-2`,children:(0,M.jsx)(_t,{rows:12})}):(0,M.jsxs)(M.Fragment,{children:[t.kind===`empty`&&(c===null?(0,M.jsx)(`div`,{"aria-busy":`true`,"aria-label":`Loading`,className:`py-2`,children:(0,M.jsx)(_t,{rows:12})}):c.unavailable===void 0?(0,M.jsx)(`p`,{className:`nc-fade-in p-4 text-ink-400`,children:`Select a file or commit.`}):(0,M.jsx)(`p`,{className:`nc-fade-in p-4 text-ink-400`,children:ln(c.unavailable)})),t.kind===`file`&&(0,M.jsxs)(M.Fragment,{children:[d&&h&&e!==null&&p!==null?(0,M.jsx)(tr,{region:`preview`,children:(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(`div`,{"aria-busy":`true`,"aria-label":`Opening the editor`,className:`py-2`,children:(0,M.jsx)(_t,{rows:12})}),children:(0,M.jsx)(mr,{repo:e,path:p})})},`edit:${p}`):kn(t.value.path)&&r?(0,M.jsx)(tr,{region:`preview`,children:(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(`div`,{"aria-busy":`true`,"aria-label":`Rendering`,className:`py-2`,children:(0,M.jsx)(_t,{rows:12})}),children:On(t.value.path)&&e!==null?(0,M.jsx)(pr,{src:A.previewUrl(e,t.value.path,t.source?.kind===`commit`?t.source.oid:void 0)}):(0,M.jsx)(fr,{source:An(t.value.lines)})})},t.value.path):t.value.lines.length>200?(0,M.jsx)(ir,{lines:t.value.lines,viewport:_}):(0,M.jsx)(rr,{lines:t.value.lines}),t.value.truncated&&(0,M.jsx)(`p`,{className:`p-3 text-accent`,children:`File truncated — it exceeded the server's size ceiling.`})]}),t.kind===`diff`&&(0,M.jsx)(Qn,{diff:t.value,split:u.layout===`split`,viewport:_})]})})]})}var gr=[{key:`files`,label:`Repo`,icon:Ue},{key:`diff`,label:`Content`,icon:We},{key:`terminal`,label:`Terminal`,icon:Ge}];function _r({view:e,onSelect:t}){return(0,M.jsx)(`nav`,{"aria-label":`Switch view`,className:`flex shrink-0 items-stretch border-t border-chrome-line bg-ink-900 md:hidden`,children:gr.map(({key:n,label:r,icon:i})=>(0,M.jsxs)(`button`,{onClick:()=>t(n),"aria-current":e===n?`page`:void 0,className:`flex min-h-11 flex-1 flex-col items-center justify-center gap-0.5 py-1 text-xs ${e===n?`text-accent`:`text-ink-400`}`,children:[(0,M.jsx)(i,{className:`h-5 w-5`}),r]},n))})}var vr=(0,j.lazy)(()=>ur(()=>import(`./Terminal-C0v33aMU.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([8,1,2,9,7]),import.meta.url));function yr({repository:{id:e,current:t,status:n},sidebar:r,filePane:i,layout:{sidebarWidth:a,sidebarRef:o,draggingSidebar:s,onSidebarDragStart:c,onSidebarDragMove:l,onSidebarDragEnd:u,onSidebarDragCancel:d,upperRef:f,lowerRef:p,draggingUpper:m,onUpperDragStart:h,onUpperDragMove:g,onUpperDragEnd:_,onUpperDragCancel:v,maximized:y,setMaximized:b,mobileView:x,setMobileView:S}}){let C=y===`files`;(0,j.useEffect)(()=>d,[e,d]),(0,j.useEffect)(()=>v,[v]);let w=(0,j.useCallback)(()=>b(e=>e===`terminal`?`none`:`terminal`),[b]);return(0,M.jsxs)(M.Fragment,{children:[s&&(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 cursor-col-resize`}),m&&(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 cursor-row-resize`}),(0,M.jsxs)(`main`,{ref:f,className:`grid min-h-0 grid-cols-1 md:grid-cols-[var(--nc-sidebar)_minmax(0,1fr)] ${x===`terminal`?`hidden md:grid`:``} ${s||m?`select-none`:``}`,style:{"--nc-sidebar":C?`0px`:`min(${a}px, ${xt*100}vw)`},children:[(0,M.jsx)(Sn,{...r,repo:e,status:n,sidebarRef:o,draggingSidebar:s,onSidebarDragStart:c,onSidebarDragMove:l,onSidebarDragEnd:u,onSidebarDragCancel:d,filesMax:C,mobileView:x},e),(0,M.jsx)(hr,{...i,filesMax:C,setMaximized:b,status:n,className:`nc-fade-in ${x===`diff`?`flex`:`hidden md:flex`}`})]}),(0,M.jsx)(tr,{region:`terminal panel`,className:x===`terminal`?`flex`:`hidden md:flex`,children:(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(`div`,{className:`min-h-0 border-t border-chrome-line ${x===`terminal`?`block`:`hidden md:block`}`}),children:(0,M.jsx)(vr,{repo:e,maximized:y===`terminal`,onToggleMaximized:w,className:`nc-fade-in ${x===`terminal`?`flex`:`hidden md:flex`} ${y===`files`?`overflow-hidden`:``}`,sectionRef:p,showDivider:y===`none`,draggingUpper:m,onUpperDragStart:h,onUpperDragMove:g,onUpperDragEnd:_,onUpperDragCancel:v})})}),(0,M.jsx)(_r,{view:x,onSelect:S}),(0,M.jsxs)(`footer`,{className:`flex shrink-0 items-center gap-3 border-t border-chrome-line bg-ink-900 px-3 py-1 text-ink-400`,children:[(0,M.jsx)(`span`,{className:`min-w-0 shrink-[1000] truncate`,children:t?.display_path}),n?.branch&&(0,M.jsx)(`span`,{className:`max-w-[50%] shrink-0 truncate text-accent`,children:n.branch}),_n(n)&&(0,M.jsx)(`span`,{className:`shrink-0 font-medium text-removed`,role:`status`,children:_n(n)}),n?.tracking&&(0,M.jsxs)(`span`,{className:`shrink-0`,children:[`↑`,n.tracking.ahead,` ↓`,n.tracking.behind]}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0`,children:n?(0,M.jsx)(`span`,{className:`text-added`,children:`● live`}):`connecting…`})]})]})}var br=`0.1.28`;function xr({settings:e}){let{leaderText:t,conflict:n,setLeader:r,disable:i,reset:a}=e,[o,s]=(0,j.useState)(t),[c,l]=(0,j.useState)(null);(0,j.useEffect)(()=>{s(t),l(null)},[t]);let u=()=>{r(o)?l(null):l(`"${o}" is not a chord. Write it as Ctrl+F, Alt+Space or Ctrl+Shift+ArrowLeft.`)};return(0,M.jsxs)(`section`,{className:`shrink-0 border-b border-ink-700 px-3 py-2`,children:[(0,M.jsxs)(`p`,{className:`text-ink-400`,children:[`Leader chord:`,` `,t?(0,M.jsx)(`kbd`,{className:`rounded-sm border border-ink-600 bg-ink-850 px-1.5 py-0.5 font-mono text-ink-50`,children:t}):(0,M.jsx)(`span`,{className:`text-ink-200`,children:`switched off`})]}),(0,M.jsxs)(`div`,{className:`mt-1.5 flex items-stretch gap-2`,children:[(0,M.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u()},placeholder:`Ctrl+F`,"aria-label":`leader chord`,spellCheck:!1,autoCapitalize:`none`,autoCorrect:`off`,className:`min-w-0 flex-1 rounded-sm border border-ink-700 bg-ink-950 px-2 py-1 font-mono text-ink-50 placeholder:text-ink-400 focus:border-ink-600 focus:outline-none`}),(0,M.jsx)(`button`,{type:`button`,onClick:u,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850`,children:`Rebind`}),(0,M.jsx)(`button`,{type:`button`,onClick:i,title:`Leave the leader unbound. Standalone chords keep working.`,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850`,children:`Switch off`}),(0,M.jsx)(`button`,{type:`button`,onClick:a,title:`Back to the leader the TUI ships with`,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850`,children:`Reset`})]}),c&&(0,M.jsx)(`p`,{role:`alert`,className:`mt-1 text-removed`,children:c}),n&&(0,M.jsxs)(`p`,{role:`status`,className:`mt-1 text-accent`,children:[n,` Rebind it above if you would rather keep that key.`]})]})}function Sr({keys:e}){return e?(0,M.jsx)(`span`,{className:`flex shrink-0 items-center gap-1`,children:e.map((e,t)=>(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t>0&&(0,M.jsx)(`span`,{className:`text-ink-400`,children:`then`}),(0,M.jsx)(`kbd`,{className:`rounded-sm border border-ink-600 bg-ink-850 px-1.5 py-0.5 font-mono text-ink-50`,children:e})]},e))}):(0,M.jsx)(`span`,{className:`shrink-0 text-ink-400`,children:`no key — the leader is switched off`})}function Cr({action:e,keys:t,ariaKeys:n,available:r,onRun:i}){let a=`flex w-full flex-col gap-0.5 rounded-sm px-3 py-1.5 text-left ${r?``:`opacity-50`}`,o=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`span`,{className:`flex w-full items-baseline gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-ink-50`,children:e.label}),e.support===`reinterpreted`&&(0,M.jsx)(`span`,{className:`shrink-0 rounded-sm bg-ink-700 px-1 text-2xs uppercase tracking-wide text-ink-200`,children:`reinterpreted`}),e.support===`browserOnly`&&(0,M.jsx)(`span`,{className:`shrink-0 rounded-sm bg-ink-700 px-1 text-2xs uppercase tracking-wide text-ink-200`,children:`browser only`}),!r&&(0,M.jsx)(`span`,{className:`shrink-0 text-2xs uppercase tracking-wide text-ink-400`,children:`not available here`}),(0,M.jsx)(Sr,{keys:t})]}),e.note&&(0,M.jsx)(`span`,{className:`text-ink-400`,children:e.note})]}),s={"data-shortcut-action":e.id,"aria-disabled":!r||void 0,"aria-keyshortcuts":n??void 0};return e.keyboardOnly?(0,M.jsx)(`li`,{children:(0,M.jsx)(`div`,{...s,className:a,children:o})}):(0,M.jsx)(`li`,{children:(0,M.jsx)(`button`,{type:`button`,...s,onClick:()=>{r&&i()},className:`${a} ${r?`hover:bg-ink-850`:``}`,children:o})})}var wr={terminal:`Terminal`,project:`Projects`,view:`Layout and views`,focus:`Focus`,session:`Session`,help:`Help`},Tr=(()=>{let e=[];for(let t of S){let n=e.find(e=>e.group===t.group);n?n.actions.push(t):e.push({group:t.group,actions:[t]})}return e})(),Er=`nc-shortcut-help-title`;function Dr({onClose:e,leader:t}){let n=we(),r=ee(),i=(0,j.useRef)(null),a=(0,j.useRef)(!1);(0,j.useEffect)(()=>{let e=document.activeElement;return i.current?.focus(),()=>{a.current||e instanceof HTMLElement&&e.isConnected&&e.focus()}},[]),(0,j.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e]);let o=t=>{a.current=!0,n?.runAction(t.id),e()};return(0,M.jsx)(`div`,{className:`nc-fade-in fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e,children:(0,M.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-labelledby":Er,tabIndex:-1,className:`nc-rise-in flex max-h-[85vh] w-[40rem] max-w-full flex-col rounded-lg border border-ink-700 bg-ink-900 focus:outline-none`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-ink-700 px-3 py-2`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{id:Er,className:`block font-medium text-ink-50`,children:`Keyboard shortcuts`}),(0,M.jsxs)(`span`,{className:`block text-caption text-ink-400`,children:[`nightcrow v`,br]})]}),(0,M.jsx)(`button`,{type:`button`,onClick:e,"aria-label":`close`,className:`ml-auto flex h-6 w-6 items-center justify-center rounded-sm text-ink-400 hover:text-ink-200`,children:(0,M.jsx)(pe,{})})]}),(0,M.jsx)(xr,{settings:t}),(0,M.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-1`,children:[Tr.map(({group:e,actions:n})=>(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h3`,{className:`px-3 py-1 text-caption uppercase text-ink-400`,children:wr[e]}),(0,M.jsx)(`ul`,{children:n.map(e=>(0,M.jsx)(Cr,{action:e,keys:C(e.id,t.leader),ariaKeys:ge(e.id,t.leader),available:r(e.id),onRun:()=>o(e)},e.id))})]},e)),(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h3`,{className:`px-3 py-1 text-caption uppercase text-ink-400`,children:`Not bound in the browser`}),(0,M.jsx)(`ul`,{children:w.map(e=>(0,M.jsxs)(`li`,{className:`px-3 py-1.5`,children:[(0,M.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-ink-200`,children:e.label}),(0,M.jsx)(`kbd`,{className:`shrink-0 rounded-sm border border-ink-700 bg-ink-850 px-1.5 py-0.5 font-mono text-ink-400`,children:e.leader})]}),(0,M.jsx)(`span`,{className:`text-ink-400`,children:e.reason})]},e.leader))})]})]})]})})}var Or=[`terminal.newPane`,`terminal.closePane`,`view.toggleMaximize`,`project.openDialog`,`help.shortcuts`],kr={keys:`3-9,0`,label:`pane 1-8`,click:null},Ar={keys:`3-9,0`,label:`swap active pane with this pane`,click:null},jr={keys:`esc`,label:`cancel`,click:null};function Mr(e,t,n){return e.armed&&e.swapPending?{chip:`SWAP`,segments:[Ar,jr]}:e.armed?{chip:`PREFIX`,segments:Pr(n)}:t?{chip:null,segments:Nr(t,n)}:{chip:null,segments:Fr(n)}}function Nr(e,t){let n=me(e),r=[{keys:n,label:`leader`,click:{kind:`arm`}}];for(let e of S)Or.includes(e.id)&&t(e.id)&&r.push(Ir(e,`${n} ${e.leader}`));return r}function Pr(e){let t=[],n=!1;for(let i of S)i.leader!==void 0&&e(i.id)&&(r(i.id)===null?t.push(Ir(i,i.leader)):(n||t.push(kr),n=!0));return t.push(jr),t}function Fr(e){let t=[{keys:`leader`,label:`switched off`,click:{kind:`run`,action:`help.shortcuts`}}];for(let n of S)n.chord!==void 0&&e(n.id)&&t.push(Ir(n,n.chord));return t}function Ir(e,t){return{keys:t,label:e.hint,click:{kind:`run`,action:e.id}}}var Lr=`shrink-0 whitespace-nowrap`;function Rr({state:e,onClick:t}){let n=Mr(e,c(),ee());return(0,M.jsxs)(`div`,{role:`toolbar`,"aria-label":`Keyboard hints`,className:`hidden shrink-0 items-center gap-1 overflow-hidden border-t border-chrome-line bg-ink-900 px-2 py-0.5 text-xs text-ink-400 md:flex`,children:[n.chip&&(0,M.jsx)(`span`,{"data-hint-chip":n.chip,className:`shrink-0 bg-accent px-1 font-bold text-ink-950`,children:n.chip}),n.segments.map((e,n)=>(0,M.jsxs)(j.Fragment,{children:[n>0&&(0,M.jsx)(`span`,{className:`shrink-0 text-ink-600`,children:`|`}),(0,M.jsx)(zr,{segment:e,onClick:t})]},`${e.keys} ${e.label}`))]})}function zr({segment:e,onClick:t}){let n=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`text-ink-200`,children:e.keys}),`: `,e.label]});if(!e.click)return(0,M.jsx)(`span`,{className:Lr,children:n});let r=e.click;return(0,M.jsx)(`button`,{type:`button`,"data-hint-action":r.kind===`run`?r.action:`arm`,onPointerDown:e=>e.preventDefault(),onClick:()=>t(r),className:`${Lr} rounded-sm hover:text-accent`,children:n})}function Br(e,t){return e?`grid-rows-[minmax(0,1fr)_auto_auto] ${t===`terminal`?`md:grid-rows-[minmax(0,0fr)_minmax(0,1fr)_auto_auto]`:t===`files`?`md:grid-rows-[minmax(0,1fr)_minmax(0,0fr)_auto_auto]`:`md:grid-rows-[minmax(0,var(--nc-upper))_minmax(0,var(--nc-lower))_auto_auto]`}`:`grid-rows-[1fr]`}function Vr(e,t){let n=Hr(e);if(n.length===0)return null;let r=e.at,i=r===null?-1:n.findIndex(e=>Ur(e,r)),a;return a=i===-1?t>0?n[0]:n[n.length-1]:n[(i+t+n.length)%n.length],r!==null&&Ur(a,r)?null:a}function Hr({paneCount:e,maximized:t,narrow:n,mobileView:r}){let i={kind:`list`},a={kind:`content`},o=Array.from({length:e},(e,t)=>({kind:`pane`,index:t}));if(n)switch(r){case`files`:return[i];case`diff`:return[a];case`terminal`:return o}switch(t){case`terminal`:return o;case`files`:return[i,a];case`none`:return[i,a,...o]}}function Ur(e,t){return e.kind===t.kind?e.kind!==`pane`||t.kind!==`pane`||e.index===t.index:!1}function Wr(e,t,n){if(e.length<=1||t===null)return null;let r=e.indexOf(t);return r<0?null:e[(r+n+e.length)%e.length]}var Gr={armed:!1},Kr={kind:`none`};function qr(e=Kr){return{state:Gr,effect:e}}function Jr(e,t){switch(t.kind){case`blur`:case`focusChange`:case`dialogOpen`:case`repoChange`:case`socketReconnect`:case`disabled`:case`suppressed`:case`cancel`:return qr();case`consumed`:return qr();case`arm`:return{state:{armed:!0,swapPending:!1},effect:Kr};case`literalLeader`:return qr({kind:`sendLiteralLeader`,data:t.data});case`action`:return Yr(e,t.action.id);case`ignore`:return{state:e,effect:Kr}}}function Yr(e,t){if(e.armed&&e.swapPending){let e=r(t);return e===null?qr():qr({kind:`swapWith`,pane:e})}return t===`terminal.swapPanePrompt`?{state:{armed:!0,swapPending:!0},effect:Kr}:qr({kind:`run`,action:t})}var Xr=S.flatMap(e=>{if(!e.chord)return[];let t=E(e.chord);return t?[{spec:t,action:e}]:[]}),Zr=new Set([`Shift`,`Control`,`Alt`,`Meta`]),Qr=229,$r=new Set([`Process`,`Unidentified`]),ei={kind:`ignore`};function ti(e){return e.isComposing===!0||e.keyCode===Qr||$r.has(e.key)}function ni(e){return e.key===`Escape`||e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&e.key.toLowerCase()===`c`}function ri(e,t){if(e.type!==`keydown`||ti(e)||e.repeat===!0||t.suppressed)return ei;if(t.armed){if(ni(e))return{kind:`cancel`};if(t.leader&&xe(t.leader,e))return{kind:`literalLeader`,data:le(t.leader)??``};if(e.key.length===1){let t=_(e.key);if(t)return{kind:`action`,action:t}}return Zr.has(e.key)?ei:{kind:`consumed`}}if(t.leader&&xe(t.leader,e))return{kind:`arm`};for(let{spec:t,action:n}of Xr)if(xe(t,e))return{kind:`action`,action:n};return ei}var ii=new Set([`checkbox`,`radio`,`button`,`submit`,`reset`,`image`,`range`,`color`,`file`]),ai=new Set([`textbox`,`searchbox`,`combobox`]);function oi(e){if(!e)return!1;if(e.isContentEditable===!0)return!0;let t=e.role?.toLowerCase()??``;if(ai.has(t))return!0;switch(e.tagName.toUpperCase()){case`INPUT`:return!ii.has(e.type?.toLowerCase()??`text`);case`TEXTAREA`:case`SELECT`:return!0;default:return!1}}function si(e){return e.dialogOpen||e.composing||e.target?.inDialog===!0?!0:oi(e.target)}function ci(e,t=!0){let n=(0,j.useRef)(e);n.current=e,(0,j.useEffect)(()=>{if(!t)return;let e=e=>{n.current(e)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())};return document.addEventListener(`keydown`,e,{capture:!0}),()=>document.removeEventListener(`keydown`,e,{capture:!0})},[t])}function li({enabled:e,leader:t,dialogOpen:n,repo:r}){let i=we(),a=(0,j.useRef)(Gr),[o,s]=(0,j.useState)(Gr),c=(0,j.useRef)(i);c.current=i;let l=(0,j.useCallback)(e=>{let t=Jr(a.current,e);a.current=t.state,s(t.state);let n=c.current;n&&ui(t.effect,n)},[]);ci((0,j.useCallback)(e=>{let r=si({target:Mt(e.target),dialogOpen:n,composing:e.isComposing===!0}),i=ri(e,{leader:t,armed:a.current.armed,suppressed:r});return r?(l({kind:`suppressed`}),!1):(l(i),i.kind!==`ignore`)},[n,t,l]),e&&i!==null),(0,j.useEffect)(()=>{if(!e)return;let t=()=>l({kind:`blur`}),n=e=>{let t=Mt(e.target);(oi(t)||t?.inDialog===!0)&&l({kind:`focusChange`})};return window.addEventListener(`blur`,t),document.addEventListener(`focusin`,n,{capture:!0}),()=>{window.removeEventListener(`blur`,t),document.removeEventListener(`focusin`,n,{capture:!0})}},[e,l]),(0,j.useEffect)(()=>{n&&l({kind:`dialogOpen`})},[n,l]),(0,j.useEffect)(()=>{e||l({kind:`disabled`})},[e,l]);let u=(0,j.useRef)(r);return(0,j.useEffect)(()=>{u.current!==r&&(u.current=r,l({kind:`repoChange`}))},[r,l]),(0,j.useEffect)(()=>{if(i)return i.onDisarm(()=>l({kind:`socketReconnect`}))},[i,l]),(0,j.useEffect)(()=>{l({kind:`cancel`})},[t,l]),{state:o,arm:(0,j.useCallback)(()=>l({kind:`arm`}),[l]),disarm:(0,j.useCallback)(()=>l({kind:`cancel`}),[l])}}function ui(e,t){switch(e.kind){case`none`:return;case`run`:t.runAction(e.action);return;case`swapWith`:t.swapPanes(e.pane);return;case`sendLiteralLeader`:e.data&&t.sendLiteralLeader(e.data);return}}var di=`nightcrow.shortcut.leader`;function fi(){let[e,t]=(0,j.useState)(pi),n=(0,j.useCallback)(e=>{t(e),hi(e===null?null:me(e))},[]),r=(0,j.useCallback)(e=>{let t=E(e);return t?(n(t),!0):!1},[n]),i=(0,j.useCallback)(()=>n(null),[n]),a=(0,j.useCallback)(()=>n(re),[n]);return{leader:e,leaderText:e?me(e):``,conflict:e?ve(e):null,setLeader:r,disable:i,reset:a}}function pi(){let e=mi();return e?e.leader===null?null:E(e.leader)??re:re}function mi(){try{let e=localStorage.getItem(di);if(!e)return null;let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.leader;return n===null?{leader:null}:typeof n==`string`?{leader:n}:null}catch{return null}}function hi(e){try{localStorage.setItem(di,JSON.stringify({leader:e}))}catch{}}function gi({enabled:e,repo:t,repos:n,selectRepo:r,closeRepo:i,openPicker:a,pickerOpen:o,cycleAccent:s,reloadConfig:c,tab:l,chooseTab:u,maximized:d,setMaximized:f,mobileView:p}){let m=we(),h=fi(),[g,_]=(0,j.useState)(!1),v=(0,j.useCallback)(()=>_(!0),[]),y=(0,j.useCallback)(()=>_(!1),[]),b=(0,j.useCallback)(e=>{let i=Wr(n.map(e=>e.id),t,e);i!==null&&r(i)},[n,t,r]),x=m?.zoomActivePane,S=(0,j.useCallback)(()=>{Nt()?(f(e=>e===`terminal`?`none`:`terminal`),x?.()):f(e=>e===`files`?`none`:`files`)},[f,x]),C=(0,j.useCallback)(e=>{let t=m?.paneCursor()??null,n=Pt(),r=null;n===`terminal`?t&&t.index>=0&&(r={kind:`pane`,index:t.index}):n!==null&&(r={kind:n});let i=Vr({at:r,paneCount:t?.count??0,maximized:d,narrow:window.innerWidth<768,mobileView:p},e);i!==null&&(i.kind===`pane`?m?.focusPaneAt(i.index):Ft(i.kind))},[m,d,p]),w=(0,j.useMemo)(()=>{let e={"project.openDialog":a,"session.cycleAccent":s,"session.reloadConfig":c,"help.shortcuts":v};return n.length>1&&(e[`project.previous`]=()=>b(-1),e[`project.next`]=()=>b(1)),t===null||(e[`project.close`]=()=>i(t),e[`view.toggleLog`]=()=>u(l===`log`?`status`:`log`),e[`view.toggleTree`]=()=>u(l===`tree`?`status`:`tree`),e[`view.toggleMaximize`]=S,e[`focus.list`]=()=>void Ft(`list`),e[`focus.content`]=()=>void Ft(`content`),e[`focus.previous`]=()=>C(-1),e[`focus.next`]=()=>C(1)),e},[a,s,c,v,n.length,b,t,l,i,u,S,C]);Te(w);let T=li({enabled:e,leader:h.leader,dialogOpen:o||g,repo:t}),{arm:E,disarm:ee}=T,te=(0,j.useCallback)(e=>{e.kind===`arm`?E():(ee(),m?.runAction(e.action))},[E,ee,m]);return{shortcutHelp:{open:g,show:v,hide:y},settings:h,hint:{state:T.state,onClick:te}}}var _i=1e3,vi=3,yi=2e3;function bi(e,t){let[n,r]=(0,j.useState)(!1),i=(0,j.useRef)(!1),a=(0,j.useRef)(!1);(0,j.useEffect)(()=>(a.current=!1,()=>{a.current=!0}),[]);let o=(0,j.useCallback)(async t=>{for(;!a.current;){if(await new Promise(e=>setTimeout(e,_i)),a.current)return;let n;try{n=await A.cloneStatus(t)}catch(e){if(Ne(e)){i.current=!1,a.current||r(!1);return}if(e instanceof Oe&&e.status===404){if(a.current)return;T.error(`the clone's progress is no longer available`),i.current=!1,r(!1);return}continue}if(a.current)return;if(n.state===`done`){try{let t=await A.open(n.path);if(a.current)return;e(t)}catch(e){if(a.current)return;T.error(e instanceof Error?e.message:`could not open`)}finally{i.current=!1,a.current||r(!1)}return}if(n.state===`failed`){T.error(n.message),i.current=!1,r(!1);return}}},[e]),s=(0,j.useCallback)(async(e=()=>!1)=>{for(let t=0;t0&&await new Promise(e=>setTimeout(e,yi)),i.current||e()||a.current)return;let n;try{({job:n}=await A.runningClone())}catch(e){if(Ne(e))return;continue}if(n===null||e()||a.current||i.current)return;i.current=!0,r(!0),o(n);return}},[o]);return(0,j.useEffect)(()=>{if(!t)return;let e=!1;return s(()=>e),()=>{e=!0}},[t,s]),{busy:n,start:(0,j.useCallback)(async(e,t)=>{if(t.trim()&&!i.current){i.current=!0,r(!0);try{let{job:n}=await A.clone(e,t.trim());await o(n)}catch(e){if(i.current=!1,a.current)return;let t=e instanceof Oe&&e.status>=400;T.error(t?e.message:`could not confirm the clone started — check this folder before retrying`),r(!1),s()}}},[o,s])}}function xi(e,t,n,r=!1){return r&&n&&t.includes(n)?n:e&&t.includes(e)?e:n&&t.includes(n)?n:t[0]??null}function Si(e){let t=!1,n=null,r=()=>{if(t||n===null)return;let i=n;n=null,t=!0,e(i).catch(()=>{}).finally(()=>{t=!1,r()})};return e=>{n=e,r()}}function Ci(e,t){return e?.enabled===t.enabled&&e.window_secs===t.window_secs?e:t}function wi(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.id===r.id&&e.name===r.name&&e.display_path===r.display_path})?e:t}var Ti=`The viewer was updated on the server.`,Ei=null,Di=null,Oi=null;function ki(e,t){return e===null||t===null?!1:e!==t}function Ai(e){Ei=e}function ji(e){ki(Ei,e)?Di!==e&&(Di=e,Oi=T.info(Ti,{sticky:!0,action:{label:`Reload`,run:()=>window.location.reload()}})):e===Ei&&Di!==null&&(Oi!==null&&se(Oi),Di=null,Oi=null)}var Mi=3e3;function Ni({authed:e,setAuthed:t,handle:n,adoptAccent:r,adoptUpperPct:i,adoptMaximized:a,adoptViews:o,upperDraggingRef:s,accentWrites:c,upperPctWrites:l,maximizedWrites:u,viewWrites:d,resumeTick:f,orderWrites:p,repoDraggingRef:m,reorderInFlightRef:h,pendingReorderRef:g}){let[_,v]=(0,j.useState)([]),[y,b]=(0,j.useState)(null),[x,S]=(0,j.useState)(null),[C,w]=(0,j.useState)(null),[T,E]=(0,j.useState)(!1),[ee,te]=(0,j.useState)(!0),{current:ne}=(0,j.useRef)(Si(A.setActiveRepo)),re=(0,j.useRef)(null),ie=(0,j.useRef)(null);return(0,j.useEffect)(()=>{if(e===!1)return;let f=!1,_,y=new AbortController,x=()=>{let e=c.current,C=l.current,T=u.current,ee=d.current,ne=p.current;return A.repos(y.signal).then(n=>{let{repos:y,hot:ae,accent:oe,upper_pct:se,active_repo:ce,maximized:le,last_view:ue,now_ms:de,can_clone:fe,viewer_build:pe}=n;if(f)return;ji(pe),S(e=>Ci(e,ae)),te(fe),w(e=>rn(e,de,Date.now())),c.current===e&&r(oe),l.current===C&&!s.current&&i(se),u.current===T&&a(le),d.current===ee&&o(ue??{},y.map(e=>e.id)),t(!0),E(!0);let me=h.current||g.current!==null;p.current===ne&&!m.current&&!me?v(e=>wi(e,y)):v(e=>{let t=ye(y.map(e=>e.id),e.map(e=>e.id)),n=new Map(y.map(e=>[e.id,e]));return wi(e,t.map(e=>n.get(e)).filter(Boolean))});let he=y.map(e=>e.id),ge=ce!==re.current;re.current=ce??null,ge&&ce&&he.includes(ce)&&(ie.current=ce),b(e=>xi(e,he,ce,ge)),f||(_=setTimeout(x,Mi))}).catch(e=>{f||(Ne(e)?(t(!1),E(!1)):(je(e)||n(e),_=setTimeout(x,Mi)))})};return x(),()=>{f=!0,y.abort(),_&&clearTimeout(_)}},[e,t,n,r,i,f,c,l,u,d,s,a,o,p,m,h,g]),(0,j.useEffect)(()=>{y?y!==ie.current&&(ie.current=null,ne(y)):ie.current=null},[y,ne]),{repos:_,setRepos:v,repo:y,setRepo:b,hot:x,clockSkewMs:C,reposLoaded:T,canClone:ee}}var Pi=4;function Fi({ids:e,onReorder:t,draggingRef:n}){let r=(0,j.useRef)(null),i=(0,j.useRef)(null),a=(0,j.useRef)(null),[o,s]=(0,j.useState)(null),[c,l]=(0,j.useState)(null);return{dragging:o,target:c,onStart:(t,a)=>{t.target.closest(`button[data-tab-close]`)||t.button!==0||e.length<2||(r.current=a,i.current={x:t.clientX,y:t.clientY},n.current=!1)},onMove:e=>{let t=r.current,o=i.current;if(t===null||o===null)return;if(!n.current&&e.buttons===0){r.current=null,i.current=null;return}if(!n.current&&Math.hypot(e.clientX-o.x,e.clientY-o.y){let o=r.current,c=a.current;o!==null&&n.current&&c!==null&&t(te(e,o,c)),r.current=null,i.current=null,a.current=null,n.current=!1,s(null),l(null)}}}function Ii({repos:e,setRepos:t,handle:n,writesRef:r,draggingRef:i,inFlightRef:a,pendingRef:o}){let s=(0,j.useCallback)(()=>{if(a.current||o.current===null)return;let e=o.current;o.current=null,a.current=!0;let i=r.current;A.reorderRepos(e).then(e=>{r.current===i&&t(e)}).catch(n).finally(()=>{a.current=!1,s()})},[n,t,a,o,r]),c=(0,j.useCallback)(e=>{r.current+=1,t(t=>{let n=ye(t.map(e=>e.id),e),r=new Map(t.map(e=>[e.id,e]));return n.map(e=>r.get(e)).filter(Boolean)}),o.current=e,s()},[s,t,o,r]);return{...Fi({ids:e.map(e=>e.id),onReorder:c,draggingRef:i}),writesRef:r,draggingRef:i,inFlightRef:a,pendingRef:o}}function Li({authed:e,setAuthed:t,handle:n,resumeTick:r,adoptAccent:i,adoptUpperPct:a,adoptMaximized:o,adoptViews:s,accentWrites:c,upperPctWrites:l,maximizedWrites:u,viewWrites:d,upperDraggingRef:f}){let p=(0,j.useRef)(0),m=(0,j.useRef)(!1),h=(0,j.useRef)(!1),g=(0,j.useRef)(null),_=Ni({authed:e,setAuthed:t,handle:n,adoptAccent:i,adoptUpperPct:a,adoptMaximized:o,adoptViews:s,upperDraggingRef:f,accentWrites:c,upperPctWrites:l,maximizedWrites:u,viewWrites:d,resumeTick:r,orderWrites:p,repoDraggingRef:m,reorderInFlightRef:h,pendingReorderRef:g}),{dragging:v,target:y,onStart:b,onMove:x,onEnd:S}=Ii({repos:_.repos,setRepos:_.setRepos,handle:n,writesRef:p,draggingRef:m,inFlightRef:h,pendingRef:g});return{..._,orderWrites:p,draggingRepo:v,dragOverRepo:y,onRepoDragStart:b,onRepoDragMove:x,onRepoDragEnd:S}}function Ri(){let[e,t]=(0,j.useState)(!1),n=(0,j.useRef)(!1);return{reload:(0,j.useCallback)(async()=>{if(!n.current){n.current=!0,t(!0);try{T.success(await A.reloadConfig())}catch(e){T.error(e instanceof Error?e.message:`could not reload the config`)}finally{n.current=!1,t(!1)}}},[]),pending:e}}function zi(e,t){let n=e.indexOf(t);return n===-1?e[0]??null:e[n+1]??e[n-1]??null}function Bi({repo:e,repos:t,setRepos:n,setRepo:r,setPane:i,setTab:a,setPickerOpen:o,handle:s,orderWrites:c}){let l=(0,j.useRef)(t);l.current=t;let u=(0,j.useRef)(e);return u.current=e,{selectOpenedRepo:(0,j.useCallback)(e=>{c.current+=1,n(t=>t.some(t=>t.id===e.id)?t:[...t,e]),r(e.id),e.id!==u.current&&(i({kind:`empty`}),a(`status`)),o(!1)},[n,r,i,a,o,c]),closeRepo:(0,j.useCallback)(async e=>{try{await A.close(e),c.current+=1;let t=zi(l.current.map(e=>e.id),e);n(t=>t.filter(t=>t.id!==e)),r(n=>n===e?t:n)}catch(e){s(e)}},[n,r,s,c])}}function Vi(e,t,n){return t!==e&&(n.bumpPaneRequest(),e===`log`&&n.leaveLog(),n.recordTab(t),n.forgetPane(),!0)}function Hi(e,t,n,r,i){(0,j.useLayoutEffect)(()=>{t&&(e.some(e=>e.oid===t.commit.oid)||(r(),n(null),i()))},[e,t,n,r,i])}var Ui=5e3,Wi={refs:{},ahead:[],behind:[],truncated:!1};function Gi({repo:e,authed:t,tab:n,head:r,branch:i,refs:a,upstream:o}){let[s,c]=(0,j.useState)({key:``,value:Wi}),[l,u]=(0,j.useState)(0),d=e&&r!==void 0?`${e}|${r??``}|${i??``}|${a??``}|${o??``}`:``,f=(0,j.useRef)(s.key);f.current=s.key,(0,j.useEffect)(()=>{if(!e||!t||n!==`log`||d===``||f.current===d)return;let r=new AbortController,i;return A.logDecorations(e,r.signal).then(e=>c({key:d,value:e})).catch(()=>{r.signal.aborted||(i=setTimeout(()=>u(e=>e+1),Ui))}),()=>{r.abort(),i&&clearTimeout(i)}},[e,t,n,d,l]);let p=s.key.startsWith(`${e}|`)?s.value:Wi;return(0,j.useMemo)(()=>{let e=new Set(p.ahead),t=new Set(p.behind);return{refsOf:e=>p.refs[e],divergenceOf:n=>e.has(n)?`ahead`:t.has(n)?`behind`:void 0,truncated:p.truncated}},[p])}function Ki(e,t,n){let r=!e.truncated||e.head===void 0,i=t[0]?.oid,a=i===void 0?-1:e.commits.findIndex(e=>e.oid===i),o=a<0?[]:e.commits.slice(a);return a>=0&&o.length<=t.length&&o.every((e,n)=>e.oid===t[n].oid)?{commits:a===0?t:[...e.commits.slice(0,a),...t],anchor:e.head??null,done:n||r,mode:`prepend`}:{commits:e.commits,anchor:e.head??null,done:r,mode:`replace`}}function qi({repo:e,authed:t,tab:n,filter:r,head:i,handle:a}){let o=(0,j.useRef)([]),[,s]=(0,j.useState)(0),c=(0,j.useCallback)(()=>s(e=>e+1),[]),l=o.current,[u,d]=(0,j.useState)(!1),[f,p]=(0,j.useState)(!1),m=(0,j.useRef)(null),h=(0,j.useRef)(!1),g=(0,j.useRef)(!1),_=(0,j.useRef)(0),v=(0,j.useRef)(void 0),y=(0,j.useRef)(void 0),b=(0,j.useCallback)(()=>{_.current+=1,h.current=!1,g.current=!1,o.current=[],c(),m.current=null,d(!1),p(!1),v.current=void 0,y.current=void 0},[c]),[x,S]=(0,j.useState)(null),C=(0,j.useRef)(u);C.current=u;let w=(0,j.useRef)(i);w.current=i;let T=(0,j.useCallback)(async t=>{if(!e)return;y.current=w.current,_.current+=1;let n=_.current;h.current=!0,g.current=!0;try{let r=await A.log(e);if(n!==_.current)return;let i=t??{commits:o.current,done:C.current},a=Ki(r,i.commits,i.done);o.current=a.commits,c(),m.current=a.anchor,v.current=a.anchor,a.anchor===w.current&&(y.current=void 0),d(a.done),p(!1)}catch(e){n===_.current&&(y.current=void 0,a(e),p(!0))}finally{n===_.current&&(h.current=!1,g.current=!1)}},[e,a,c]),E=(0,j.useCallback)(async()=>{if(!e||h.current)return;h.current=!0;let t=_.current;try{let n=m.current,r=await A.log(e,n===null?void 0:{from:n,skip:o.current.length});if(t!==_.current)return;if(o.current.push(...r.commits),c(),m.current=r.head??null,d(!r.truncated||r.head===void 0),n===null){v.current=r.head??null;let e=w.current;e!==void 0&&e!==(r.head??null)&&T({commits:r.commits,done:!r.truncated||r.head===void 0})}}catch(e){t===_.current&&(a(e),p(!0))}finally{t===_.current&&(h.current=!1)}},[e,a,T,c]);(0,j.useEffect)(()=>{e&&t&&n===`log`&&l.length===0&&!u&&!f&&E()},[e,t,n,l.length,u,f,E]),(0,j.useEffect)(()=>{if(!e||!t||n!==`log`||i===void 0||f)return;let r=v.current;r!==void 0&&(r===i?g.current||(y.current=void 0):y.current!==i&&T())},[e,t,n,i,f,T]);let ee=r.toLowerCase(),te=ee===``?l:l.filter(e=>e.summary.toLowerCase().includes(ee)),ne=r!==``,re=(0,j.useRef)(null);return(0,j.useEffect)(()=>{let e=re.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&E()},{root:e.closest(`ul`),rootMargin:`400px`});return t.observe(e),()=>t.disconnect()},[E,u,f,ne,x,n,te.length]),{commits:l,logDone:u,logStalled:f,setLogStalled:p,commitDrillDown:x,setCommitDrillDown:S,resetLog:b,logSentinelRef:re,visibleCommits:te,logPagingPaused:ne}}function Ji(e,t){return[t??``,e.index,e.worktree,e.mtime??``,e.old_path??``].join(`\0`)}function Yi({repo:e,authed:t,resumeTick:n,tab:r,pane:i,setPane:a,handle:o,paneRequestRef:s}){let[c,l]=(0,j.useState)(null),u=(0,j.useRef)(i);u.current=i;let d=(0,j.useRef)(r);d.current=r;let f=(0,j.useRef)(null),p=(0,j.useRef)(null);return(0,j.useLayoutEffect)(()=>{l(null),p.current=null},[e,t]),(0,j.useEffect)(()=>{if(e&&t)return Ae(e,l,({reason:e})=>l({files:[],truncated:!1,unavailable:e}))},[e,t,n]),(0,j.useEffect)(()=>{if(!e||!c)return;let t=p.current;p.current=new Map(c.files.map(e=>[e.path,Ji(e,c.head)]));let n=u.current;if(d.current!==`status`||n.kind!==`diff`){f.current=null;return}let r=n.value.path,i=c.files.find(e=>e.path===r);if(!i){f.current=null,a({kind:`empty`});return}let l=Ji(i,c.head),m=f.current;if(m?.path===r&&m.key===l)return;if(m?.path!==r&&t?.get(r)===l){f.current={path:r,key:l};return}let h=s.current,g=!0,_=()=>{let e=u.current;return g&&h===s.current&&e.kind===`diff`&&e.value.path===r};return A.diff(e,r).then(e=>{_()&&(f.current={path:r,key:l},a({kind:`diff`,value:e,source:In(i)&&Ln(e)?{kind:`workdir`,path:r}:void 0}))}).catch(e=>{_()&&o(e)}),()=>{g=!1}},[c,e,o,u,d,s,a]),{status:c,paneRef:u,tabRef:d}}function Xi({repo:e,authed:t,hot:n,clockSkewMs:r,resumeTick:i,handle:a}){let[o,s]=(0,j.useState)(`status`),[c,l]=(0,j.useState)(``),[u,d]=(0,j.useState)(!1),[f,p]=(0,j.useState)({kind:`empty`}),[m,h]=(0,j.useState)(e);m!==e&&(h(e),p({kind:`empty`}),s(`status`));let g=(0,j.useRef)(0),_=(0,j.useCallback)(()=>{g.current+=1},[]),v=(0,j.useCallback)(()=>p({kind:`empty`}),[]),{status:y}=Yi({repo:e,authed:t,resumeTick:i,tab:o,pane:f,setPane:p,handle:a,paneRequestRef:g}),b=n?.enabled?n.window_secs*1e3:0,x=qi({repo:e,authed:t,tab:o,filter:c,head:y?y.head??null:void 0,handle:a}),S=Gi({repo:e,authed:t,tab:o,head:y?y.head??null:void 0,branch:y?.branch,refs:y?.refs,upstream:y?.tracking?.upstream}),C=x.setCommitDrillDown,w=x.resetLog;(0,j.useLayoutEffect)(()=>{_(),C(null),w()},[e,_,C,w]);let T=c.toLowerCase(),E=(0,j.useMemo)(()=>(y?.files??[]).filter(e=>e.path.toLowerCase().includes(T)),[y?.files,T]),ee=(0,j.useMemo)(()=>(x.commitDrillDown?.files??[]).filter(e=>e.path.toLowerCase().includes(T)||e.old_path?.toLowerCase().includes(T)),[x.commitDrillDown?.files,T]);return{screen:{tab:o,setTab:s,filter:c,setFilter:l,filterOpen:u,setFilterOpen:d,pane:f,setPane:p},request:{paneRequestRef:g,bumpPaneRequest:_,clearPane:v},status:{value:y,files:E,hotWindowMs:b,clockSkewMs:r??0},log:{...x,decorations:S,visibleCommitFiles:ee}}}var Zi=`nightcrow.mobileView`;function Qi(e){return e===`diff`||e===`terminal`||e===`files`?e:`files`}function $i(){return Qi(m(Zi))}function ea(){let[e,t]=(0,j.useState)($i);return{mobileView:e,setMobileView:(0,j.useCallback)(e=>{h(Zi,e),t(e)},[])}}function ta({repo:e,handle:t,setPane:n,paneRequestRef:r,setCommitDrillDown:i,setMobileView:a,setPreviewRendered:o,statusRef:s,track:c}){let l=(0,j.useCallback)(e=>{let t=s.current?.files.find(t=>t.path===e);return t?In(t):!1},[s]);return{openDiff:(0,j.useCallback)((i,o)=>{if(!e)return;o?.restoring||a(`diff`);let s=r.current+=1;c(s,A.diff(e,i)).then(e=>{s===r.current&&n({kind:`diff`,value:e,source:l(i)&&Ln(e)?{kind:`workdir`,path:i}:void 0})}).catch(e=>{if(s!==r.current)return Ne(e)?t(e):void 0;if(!o?.restoring)return t(e);Ne(e)&&t(e),n({kind:`empty`})})},[e,t,n,r,a,l,c]),openFile:(0,j.useCallback)((i,s)=>{if(!e)return;s?.restoring||a(`diff`),o(!0);let l=r.current+=1;c(l,A.file(e,i)).then(e=>{l===r.current&&n({kind:`file`,value:e})}).catch(e=>{if(l!==r.current)return Ne(e)?t(e):void 0;if(!s?.restoring)return t(e);Ne(e)&&t(e),n({kind:`empty`})})},[e,t,n,r,a,o,c]),openCommit:(0,j.useCallback)(i=>{if(!e)return;a(`diff`);let o=r.current+=1;c(o,A.commit(e,i)).then(e=>{o===r.current&&n({kind:`diff`,value:e})}).catch(e=>{o===r.current&&t(e)})},[e,t,n,r,a,c]),openCommitFileDiff:(0,j.useCallback)((i,o,s)=>{if(!e)return;s?.restoring||a(`diff`);let l=r.current+=1;c(l,A.commitFileDiff(e,i,o)).then(e=>{l===r.current&&n({kind:`diff`,value:e,source:Ln(e)?{kind:`commit`,oid:i,path:o}:void 0})}).catch(e=>{if(l!==r.current)return Ne(e)?t(e):void 0;if(!s?.restoring)return t(e);Ne(e)&&t(e),n({kind:`empty`})})},[e,t,n,r,a,c]),openCommitFiles:(0,j.useCallback)(async o=>{if(!e)return;a(`diff`);let s=r.current+=1;try{let t=await c(s,A.commitFiles(e,o.oid));if(s!==r.current)return;if(i({commit:o,...t}),t.files.length===0){n({kind:`empty`});return}let a=await c(s,A.commit(e,o.oid));s===r.current&&n({kind:`diff`,value:a})}catch(e){s===r.current&&t(e)}},[e,t,n,r,i,a,c]),showOtherFace:(0,j.useCallback)((i,a=0)=>{let s=Fn(i);if(!e||!s)return;let{source:u}=s,d=s.want===`file`,f=d&&i.kind===`diff`?jn(i.value,a):null,p=r.current+=1,m=u.kind===`workdir`?d?A.file(e,u.path):A.diff(e,u.path):d?A.commitFile(e,u.oid,u.path):A.commitFileDiff(e,u.oid,u.path);d&&o(!1),c(p,m).then(e=>{p===r.current&&n(d?{kind:`file`,value:e,source:u,anchor:f===null?void 0:Mn(f)+1}:{kind:`diff`,value:e,source:Ln(e)&&(u.kind!==`workdir`||l(u.path))?u:void 0})}).catch(e=>{p===r.current&&t(e)})},[e,t,n,r,o,l,c])}}function na(){let[e,t]=(0,j.useState)(null),n=(0,j.useCallback)((e,n)=>{t(e);let r=()=>t(t=>t===e?null:t);return n.then(r,r),n},[]);return{loading:e!==null,track:n}}function ra({repo:e,handle:t,pane:n,setPane:r,paneRequestRef:i,setCommitDrillDown:a,status:o}){let{mobileView:s,setMobileView:c}=ea(),[l,u]=(0,j.useState)(!0),{loading:d,track:f}=na(),p=(0,j.useRef)(o);p.current=o;let{openDiff:m,openFile:h,openCommit:g,openCommitFileDiff:_,openCommitFiles:v,showOtherFace:y}=ta({repo:e,handle:t,setPane:r,paneRequestRef:i,setCommitDrillDown:a,setMobileView:c,setPreviewRendered:u,statusRef:p,track:f}),b=(0,j.useMemo)(()=>({openDiff:m,openFile:h,openCommit:g,openCommitFileDiff:_,openCommitFiles:v,showOtherFace:y}),[m,h,g,_,v,y]);return(0,j.useMemo)(()=>({openers:b,pane:n,setPane:r,paneLoading:d,previewRendered:l,setPreviewRendered:u,mobileView:s,setMobileView:c}),[b,n,r,d,l,s,c])}var ia=[`status`,`log`,`tree`];function aa(){return{tab:`status`,file:null,tree_expanded:[]}}function oa(e,t){return{path:e,commit:null,face:t}}function sa(e,t,n){return{path:t,commit:e,face:n}}function ca(e){return[...e].sort().slice(0,200)}function F(e){let t=e?.file;return!t||!t.path?{kind:`none`}:t.commit?{kind:`commitDiff`,oid:t.commit,path:t.path}:t.face===`source`?{kind:`file`,path:t.path}:{kind:`diff`,path:t.path}}function I(e){let t=e?.tab;return t&&ia.includes(t)?t:`status`}function la(e,t){return e?e.tab===t.tab&&e.tree_expanded.length===t.tree_expanded.length&&e.tree_expanded.every((e,n)=>e===t.tree_expanded[n])&&ua(e.file,t.file):!1}function ua(e,t){return!e||!t?e===t:e.path===t.path&&e.commit===t.commit&&e.face===t.face}function da({repo:e,known:t,remembered:n,latest:r,remember:i,setTab:a,openDiff:o,openFile:s,openCommitFileDiff:c}){let l=(0,j.useRef)(null),u=(0,j.useRef)(null),d=(0,j.useRef)(new Map),[f,p]=(0,j.useState)(!1),m=(0,j.useRef)(!1);(0,j.useEffect)(()=>{if(u.current!==e&&(u.current=e,l.current=null,m.current=!1,p(!1)),!e||!t||l.current===e)return;l.current=e;let r=d.current.get(e);d.current.delete(e);let f=r?{...n??aa(),...r}:n;if(r&&i(e,f),m.current)return;a(I(f));let h=F(f);if(h.kind===`none`)return;let g={restoring:!0};h.kind===`diff`?o(h.path,g):h.kind===`file`?s(h.path,g):c(h.oid,h.path,g)},[e,t,n,i,a,o,s,c]);let h=(0,j.useCallback)(t=>{if(e){if(m.current=!0,p(!0),l.current!==e){let n=d.current.get(e);d.current.set(e,{...n,...t})}else i(e,{...r(e)??aa(),...t})}},[e,r,i]);return{touched:f,noteTab:(0,j.useCallback)(e=>h({tab:e}),[h]),noteFile:(0,j.useCallback)(e=>h({file:e}),[h]),noteTree:(0,j.useCallback)(e=>h({tree_expanded:ca(e)}),[h])}}function fa({repo:e,known:t,remembered:n,latest:r,remember:i,setTab:a,clearPane:o,openers:s}){let c=da({repo:e,known:t,remembered:n,latest:r,remember:i,setTab:a,openDiff:s.openDiff,openFile:s.openFile,openCommitFileDiff:s.openCommitFileDiff}),{noteFile:l,noteTab:u,noteTree:d}=c,f=(0,j.useCallback)(e=>{u(e),a(e)},[u,a]),p=(0,j.useCallback)(()=>{l(null),o()},[l,o]),m=(0,j.useMemo)(()=>({openDiff:e=>{l(oa(e,`diff`)),s.openDiff(e)},openFile:e=>{l(oa(e,`source`)),s.openFile(e)},openCommit:e=>{l(null),s.openCommit(e)},openCommitFiles:e=>(l(null),s.openCommitFiles(e)),openCommitFileDiff:(e,t)=>{l(sa(e,t,`diff`)),s.openCommitFileDiff(e,t)}}),[s,l]),h=(0,j.useCallback)((e,t)=>{l(e.kind===`commit`?sa(e.oid,e.path,t):oa(e.path,t))},[l]);return{...c,noteTree:d,chooseTab:f,forgetPane:p,asked:m,noteOtherFace:h}}function pa({project:e,view:t,layout:n}){let{repo:r,repos:i,authed:a,hot:o,clockSkewMs:s,resumeTick:c,handle:l}=e,u=Xi({repo:r,authed:a,hot:o,clockSkewMs:s,resumeTick:c,handle:l}),d=ra({repo:r,handle:l,pane:u.screen.pane,setPane:u.screen.setPane,paneRequestRef:u.request.paneRequestRef,setCommitDrillDown:u.log.setCommitDrillDown,status:u.status.value}),f=fa({repo:r,known:t.known,remembered:t.remembered,latest:t.latest,remember:t.remember,setTab:u.screen.setTab,clearPane:u.request.clearPane,openers:d.openers}),p=u.screen.tab,{bumpPaneRequest:m}=u.request,{setCommitDrillDown:h,resetLog:g}=u.log,{chooseTab:_,forgetPane:v}=f,y=(0,j.useCallback)(e=>void Vi(p,e,{bumpPaneRequest:m,leaveLog:()=>{h(null),g()},recordTab:_,forgetPane:v}),[p,m,h,g,_,v]);Hi(u.log.commits,u.log.commitDrillDown,u.log.setCommitDrillDown,u.request.bumpPaneRequest,f.forgetPane);let b=n.maximizedPanelOf(r),x=n.setMaximizedFor,S=(0,j.useCallback)(e=>x(r,e),[r,x]),C=d.pane,w=d.openers.showOtherFace,T=f.noteOtherFace,E=(0,j.useCallback)(e=>{let t=Fn(C);t&&T(t.source,t.want===`file`?`source`:`diff`),w(C,e)},[C,T,w]);return{setPane:d.setPane,setTab:u.screen.setTab,clearPane:u.request.clearPane,maximized:b,tab:p,chooseTab:y,setMaximized:S,repoShell:r?{repository:{id:r,current:i.find(e=>e.id===r),status:u.status.value},sidebar:{tab:u.screen.tab,filter:u.screen.filter,setFilter:u.screen.setFilter,filterOpen:u.screen.filterOpen,setFilterOpen:u.screen.setFilterOpen,files:u.status.files,hotWindowMs:u.status.hotWindowMs,clockSkewMs:u.status.clockSkewMs,...d.openers,...f.asked,chooseTab:y,authed:a,handle:l,bumpPaneRequest:u.request.bumpPaneRequest,...u.log,restoreTree:t.remembered?.tree_expanded??[],restoreKnown:t.known,onTreeExpanded:f.noteTree,clearPane:f.forgetPane,touched:f.touched},filePane:{repo:r,pane:d.pane,loading:d.paneLoading,previewRendered:d.previewRendered,setPreviewRendered:d.setPreviewRendered,showOtherFace:E},layout:{...n.shell,maximized:b,setMaximized:S,mobileView:d.mobileView,setMobileView:d.setMobileView}}:null}}function ma(){let[e,t]=(0,j.useState)(0);return(0,j.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&t(e=>e+1)};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`online`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`online`,e)}},[]),e}var ha=[{name:`yellow`,color:`#d9a441`},{name:`cyan`,color:`#03c4db`},{name:`green`,color:`#77c47a`},{name:`magenta`,color:`#dc8fd5`},{name:`blue`,color:`#87acfd`}],ga=`nightcrow.viewer.accent`;function _a(e){if(!Number.isFinite(e))return 0;let t=ha.length;return(Math.trunc(e)%t+t)%t}function va(){let e=m(ga);return e===null?0:_a(Number(e))}function ya(e){h(ga,String(e))}function ba(){let[e,t]=(0,j.useState)(va);(0,j.useLayoutEffect)(()=>{document.documentElement.style.setProperty(`--color-accent`,ha[e].color)},[e]);let n=(0,j.useCallback)(()=>{t(e=>{let t=_a(e+1);return ya(t),A.setAccent(t).catch(()=>{}),t})},[]),r=(0,j.useCallback)(e=>{t(t=>{let n=_a(e);return n===t?t:(ya(n),n)})},[]);return{accent:ha[e],next:ha[_a(e+1)],cycle:n,adopt:r}}function xa(e){return Number.isFinite(e)?Math.min(Math.max(e,20),85):55}function Sa(e){return Math.round(xa(e))}function Ca(e,t,n,r){let i=n-t;return xa(i<=0?r:(e-t)/i*100)}var wa=`nightcrow.upperPct`;function Ta(){try{let e=Number(localStorage.getItem(wa));return Number.isFinite(e)&&e>0?Sa(e):55}catch{return 55}}function Ea(e){try{localStorage.setItem(wa,String(e))}catch{}}function Da(){let[e,t]=(0,j.useState)(Ta);return{pct:e,resize:(0,j.useCallback)(e=>{t(xa(e))},[]),commit:(0,j.useCallback)(e=>{let n=Sa(e);t(n),Ea(n),A.setUpperPct(n).catch(()=>{})},[]),reset:(0,j.useCallback)(()=>{t(55),Ea(55),A.setUpperPct(55).catch(()=>{})},[]),adopt:(0,j.useCallback)(e=>{t(t=>{let n=Sa(e);return n===t?t:(Ea(n),n)})},[])}}function Oa(){let[e,t]=(0,j.useState)({}),n=(0,j.useRef)(e),r=(0,j.useCallback)(e=>{n.current=e,t(e)},[]),i=(0,j.useRef)(0),a=(0,j.useRef)(new Map),o=(0,j.useCallback)(e=>{let t=a.current.get(e);if(t)return t;let n=Si(t=>A.setMaximized(e,t===`none`?null:t));return a.current.set(e,n),n},[]),s=(0,j.useCallback)((e,t)=>{if(e==null)return;let a=n.current,s=typeof t==`function`?t(a[e]??`none`):t;i.current+=1,o(e)(s);let{[e]:c,...l}=a;r(s===`none`?l:{...a,[e]:s})},[o,r]);return{panelOf:(0,j.useCallback)(t=>t!=null&&e[t]||`none`,[e]),setFor:s,adopt:(0,j.useCallback)(e=>{ka(n.current,e)||r(e)},[r]),writes:i}}function ka(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])}function Aa(){let[e,t]=(0,j.useState)({}),n=(0,j.useRef)(e),r=(0,j.useCallback)(e=>{n.current=e,t(e)},[]),i=(0,j.useRef)(0),a=(0,j.useRef)(new Map),o=(0,j.useCallback)(e=>{let t=a.current.get(e);if(t)return t;let n=Si(t=>A.setRepoView(e,t));return a.current.set(e,n),n},[]),s=(0,j.useCallback)((e,t)=>{e!=null&&(la(n.current[e],t)||(i.current+=1,o(e)(t),r({...n.current,[e]:t})))},[o,r]),c=(0,j.useCallback)(t=>t==null?void 0:e[t],[e]),l=(0,j.useCallback)(e=>n.current[e],[]),u=(0,j.useRef)(new Set),[d,f]=(0,j.useState)(0);return{viewOf:c,rememberedFor:l,remember:s,adopt:(0,j.useCallback)((e,t)=>{let i=u.current;(i.size!==t.length||t.some(e=>!i.has(e)))&&(u.current=new Set(t),f(e=>e+1)),!ja(n.current,e)&&r(e)},[r]),covers:(0,j.useCallback)(e=>e!=null&&u.current.has(e),[d]),writes:i}}function ja(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>t[n]!==void 0&&la(e[n],t[n]))}function Ma(){let{accent:e,next:t,cycle:n,adopt:r}=ba(),{width:i,resize:a,commit:o,reset:s}=Et(),{pct:c,resize:l,commit:u,reset:d,adopt:f}=Da(),p=Oa(),m=Aa(),h=(0,j.useRef)(0),g=(0,j.useRef)(0);return{accent:e,next:t,cycle:(0,j.useCallback)(()=>{h.current+=1,n()},[n]),adoptAccent:r,accentWrites:h,sidebarWidth:i,resizeSidebar:a,commitSidebarWidth:o,resetSidebarWidth:s,upperPct:c,resizeUpperPct:l,commitUpperPct:(0,j.useCallback)(e=>{g.current+=1,u(e)},[u]),resetUpperPct:(0,j.useCallback)(()=>{g.current+=1,d()},[d]),bumpUpperPctWrites:(0,j.useCallback)(()=>{g.current+=1},[]),adoptUpperPct:f,upperPctWrites:g,maximizedPanelOf:p.panelOf,setMaximizedFor:p.setFor,adoptMaximized:p.adopt,maximizedWrites:p.writes,viewOf:m.viewOf,rememberedViewFor:m.rememberedFor,rememberView:m.remember,adoptViews:m.adopt,viewCovers:m.covers,viewWrites:m.writes}}var Na=400;function Pa({value:e,valueAt:t,onGestureStart:n,resize:r,commit:i,reset:a,axis:o}){let s=(0,j.useRef)(0),c=(0,j.useRef)(0),l=(0,j.useRef)(!1),u=(0,j.useRef)(!1),d=(0,j.useRef)(0),[f,p]=(0,j.useState)(!1);return{dragging:f,onDragStart:(0,j.useCallback)(t=>{t.button===0&&t.isPrimary&&n()&&(s.current=o===`x`?t.clientX:t.clientY,c.current=e,l.current=!0,u.current=!1,p(!0),t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault())},[e,n,o]),onDragMove:(0,j.useCallback)(e=>{if(!l.current)return;let n=o===`x`?e.clientX:e.clientY;if(!u.current&&Math.abs(n-s.current)<3)return;let i=t(e);i!==null&&(u.current=!0,c.current=i,r(i))},[t,r,o]),onDragEnd:(0,j.useCallback)(()=>{if(!l.current)return;if(l.current=!1,p(!1),u.current){i(c.current),d.current=0;return}let e=Date.now();e-d.current{l.current=!1,u.current=!1,d.current=0,p(!1)},[]),draggingRef:l}}function L({sidebarRef:e,sidebarWidth:t,resizeSidebar:n,commitSidebarWidth:r,resetSidebarWidth:i}){let a=(0,j.useRef)(0),o=(0,j.useCallback)(()=>{let t=e.current?.getBoundingClientRect().left;return t!==void 0&&(a.current=t,!0)},[e]),{dragging:s,onDragStart:c,onDragMove:l,onDragEnd:u,onDragCancel:d}=Pa({value:t,valueAt:(0,j.useCallback)(e=>e.clientX-a.current,[]),onGestureStart:o,resize:n,commit:r,reset:i,axis:`x`});return{draggingSidebar:s,onSidebarDragStart:c,onSidebarDragMove:l,onSidebarDragEnd:u,onSidebarDragCancel:d}}function Fa({upperRef:e,lowerRef:t,upperPct:n,resizeUpperPct:r,commitUpperPct:i,resetUpperPct:a,bumpUpperPctWrites:o}){let s=(0,j.useRef)(0),c=(0,j.useRef)(0),l=(0,j.useCallback)(()=>{let n=e.current?.getBoundingClientRect().top,r=t.current?.getBoundingClientRect().bottom;return n===void 0||r===void 0?!1:(s.current=n,c.current=r,o(),!0)},[e,t,o]),{dragging:u,onDragStart:d,onDragMove:f,onDragEnd:p,onDragCancel:m,draggingRef:h}=Pa({value:n,valueAt:(0,j.useCallback)(e=>Ca(e.clientY,s.current,c.current,n),[n]),onGestureStart:l,resize:r,commit:i,reset:a,axis:`y`});return{draggingUpper:u,onUpperDragStart:d,onUpperDragMove:f,onUpperDragEnd:p,onUpperDragCancel:m,upperDraggingRef:h}}function Ia(){let{accent:e,next:t,cycle:n,adoptAccent:r,accentWrites:i,sidebarWidth:a,resizeSidebar:o,commitSidebarWidth:s,resetSidebarWidth:c,upperPct:l,resizeUpperPct:u,commitUpperPct:d,resetUpperPct:f,bumpUpperPctWrites:p,adoptUpperPct:m,upperPctWrites:h,maximizedPanelOf:g,setMaximizedFor:_,adoptMaximized:v,maximizedWrites:y,viewOf:b,rememberedViewFor:x,rememberView:S,adoptViews:C,viewCovers:w,viewWrites:T}=Ma(),E=(0,j.useRef)(null),ee=(0,j.useRef)(null),te=(0,j.useRef)(null),ne=L({sidebarRef:E,sidebarWidth:a,resizeSidebar:o,commitSidebarWidth:s,resetSidebarWidth:c}),re=Fa({upperRef:ee,lowerRef:te,upperPct:l,resizeUpperPct:u,commitUpperPct:d,resetUpperPct:f,bumpUpperPctWrites:p});return{accent:e,next:t,cycle:n,upperPct:l,maximizedPanelOf:g,setMaximizedFor:_,viewOf:b,rememberedViewFor:x,rememberView:S,viewCovers:w,shell:{sidebarWidth:a,sidebarRef:E,upperRef:ee,lowerRef:te,draggingSidebar:ne.draggingSidebar,onSidebarDragStart:ne.onSidebarDragStart,onSidebarDragMove:ne.onSidebarDragMove,onSidebarDragEnd:ne.onSidebarDragEnd,onSidebarDragCancel:ne.onSidebarDragCancel,draggingUpper:re.draggingUpper,onUpperDragStart:re.onUpperDragStart,onUpperDragMove:re.onUpperDragMove,onUpperDragEnd:re.onUpperDragEnd,onUpperDragCancel:re.onUpperDragCancel},guards:{adoptAccent:r,adoptUpperPct:m,adoptMaximized:v,adoptViews:C,accentWrites:i,upperPctWrites:h,maximizedWrites:y,viewWrites:T,upperDraggingRef:re.upperDraggingRef}}}var La=`nightcrow.tabStripSide`;function Ra(){return ft(m(La))??`top`}function za(e){h(La,e)}function Ba(){let[e,t]=(0,j.useState)(Ra);return{side:e,toggle:(0,j.useCallback)(()=>{t(e=>{let t=pt(e);return za(t),t})},[])}}function Va(){let[e,t]=(0,j.useState)(null),[n,r]=(0,j.useState)(!1),[i,a]=(0,j.useState)(null),o=(0,j.useCallback)(e=>{Ne(e)?t(!1):T.error(e instanceof Error?e.message:`request failed`)},[]),s=ma(),c=Ia(),l=Ba(),u=Li({authed:e,setAuthed:t,handle:o,resumeTick:s,...c.guards}),d=pa({project:{repo:u.repo,repos:u.repos,authed:e,hot:u.hot,clockSkewMs:u.clockSkewMs,resumeTick:s,handle:o},view:{known:c.viewCovers(u.repo),remembered:c.viewOf(u.repo),latest:c.rememberedViewFor,remember:c.rememberView},layout:{shell:c.shell,maximizedPanelOf:c.maximizedPanelOf,setMaximizedFor:c.setMaximizedFor}}),{selectOpenedRepo:f,closeRepo:p}=Bi({repo:u.repo,repos:u.repos,setRepos:u.setRepos,setRepo:u.setRepo,setPane:d.setPane,setTab:d.setTab,setPickerOpen:r,handle:o,orderWrites:u.orderWrites}),{busy:m,start:h}=bi(f,e===!0),g=u.repo,_=u.setRepo,v=d.clearPane,y=(0,j.useCallback)(e=>{e!==g&&(_(e),v())},[g,_,v]),b=u.repos.find(e=>e.id===i),x=(0,j.useCallback)(()=>a(null),[]),S=(0,j.useCallback)(()=>r(!0),[]),C=(0,j.useCallback)(()=>r(!1),[]),w=Ri(),E=gi({enabled:e===!0,repo:u.repo,repos:u.repos,selectRepo:y,closeRepo:p,openPicker:S,pickerOpen:n,cycleAccent:c.cycle,reloadConfig:w.reload,tab:d.tab,chooseTab:d.chooseTab,maximized:d.maximized,setMaximized:d.setMaximized,mobileView:d.repoShell?.layout.mobileView??`files`});return{authed:e,login:(0,j.useCallback)(()=>t(null),[]),reposLoaded:u.reposLoaded,rows:Br(u.repo,d.maximized),upperPct:c.upperPct,header:{repos:u.repos,repo:u.repo,onSelectRepo:y,onCloseRepo:a,onOpenPicker:S,cloning:m,accent:c.accent,next:c.next,cycle:c.cycle,draggingRepo:u.draggingRepo,dragOverRepo:u.dragOverRepo,onRepoDragStart:u.onRepoDragStart,onRepoDragMove:u.onRepoDragMove,onRepoDragEnd:u.onRepoDragEnd,onReloadConfig:w.reload,reloading:w.pending,tabStrip:l},tabStrip:l,shortcutHelp:E.shortcutHelp,leader:E.settings,hint:E.hint,repoShell:d.repoShell,closeConfirm:b?{label:b.name,detail:`Its terminals and the processes running in them will be terminated.`,onConfirm:()=>{a(null),p(b.id)},onCancel:x}:null,picker:n?{onClose:C,onOpened:f,canClone:u.canClone,cloning:m,onClone:h}:null}}function Ha(){let e=Va();return e.authed===null?(0,M.jsx)(vt,{}):e.authed?e.reposLoaded?(0,M.jsx)(g,{children:(0,M.jsx)(ae,{children:(0,M.jsx)(x,{leader:e.leader.leader,children:(0,M.jsxs)(`div`,{className:`nc-fade-in flex h-full flex-col`,children:[(0,M.jsx)(mt,{...e.header,onShowShortcuts:e.shortcutHelp.show}),(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[e.tabStrip.side===`left`&&(0,M.jsx)(`aside`,{className:`hidden w-48 shrink-0 flex-col border-r border-chrome-line bg-ink-950 md:flex`,children:(0,M.jsx)(qe,{side:`left`,...e.header})}),(0,M.jsxs)(`div`,{className:`grid min-h-0 min-w-0 flex-1 grid-cols-[minmax(0,1fr)] ${e.rows}`,style:{"--nc-upper":`${e.upperPct}fr`,"--nc-lower":`${100-e.upperPct}fr`},children:[e.repoShell?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(yr,{...e.repoShell}),(0,M.jsx)(Rr,{...e.hint})]}):(0,M.jsxs)(`div`,{className:`flex items-center justify-center p-6 text-center text-ink-400`,children:[(0,M.jsxs)(`span`,{className:`md:hidden`,children:[`No repository open. Tap`,` `,(0,M.jsx)(`span`,{className:`text-ink-200`,children:`No project`}),` above, then`,` `,(0,M.jsx)(`span`,{className:`text-ink-200`,children:`+ open`}),`, to add one.`]}),(0,M.jsxs)(`span`,{className:`hidden md:inline`,children:[`No repository open. Click`,` `,(0,M.jsx)(`span`,{className:`text-ink-200`,children:`+ open`}),` `,e.tabStrip.side===`left`?`beside`:`above`,` to add one.`]})]}),e.picker&&(0,M.jsx)(Re,{...e.picker}),e.closeConfirm&&(0,M.jsx)(Se,{...e.closeConfirm}),e.shortcutHelp.open&&(0,M.jsx)(Dr,{onClose:e.shortcutHelp.hide,leader:e.leader})]})]})]})})})}):(0,M.jsx)(vt,{}):(0,M.jsx)(yt,{onSuccess:e.login})}var Ua={error:7e3,info:5e3,success:5e3},Wa={error:`text-removed`,info:`text-accent`,success:`text-added`};function Ga(){let[e,t]=(0,j.useState)([]);return(0,j.useEffect)(()=>oe(t),[]),e.length===0?null:(0,M.jsx)(`div`,{className:`pointer-events-none fixed right-3 top-3 z-[60] flex w-80 max-w-[calc(100vw-1.5rem)] flex-col gap-2`,"aria-live":`polite`,children:e.map(e=>(0,M.jsx)(Ka,{toast:e},e.id))})}function Ka({toast:e}){let[t,n]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(t||e.sticky)return;let n=setTimeout(()=>se(e.id),Ua[e.kind]);return()=>clearTimeout(n)},[e.id,e.kind,e.bump,e.sticky,t]),(0,M.jsxs)(`div`,{role:e.kind===`error`?`alert`:`status`,className:`nc-slide-in pointer-events-auto flex items-start gap-2 rounded-md border border-ink-700 bg-ink-850 px-3 py-2 text-xs shadow-lg`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 break-words ${Wa[e.kind]}`,children:e.message}),e.action&&(0,M.jsx)(`button`,{type:`button`,onClick:e.action.run,className:`shrink-0 rounded-sm border border-ink-700 px-1.5 py-0.5 text-ink-200 hover:border-accent hover:text-accent`,children:e.action.label}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>se(e.id),"aria-label":`dismiss`,className:`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:bg-ink-700 hover:text-ink-200`,children:(0,M.jsx)(pe,{className:`h-3 w-3`})})]})}function qa(e){let t=new URLSearchParams(e),n=t.get(`notice-repo`);if(!n)return null;let r=t.get(`notice-pane`);return{repo:n,pane:r!==null&&/^\d+$/.test(r)?Number(r):null}}async function Ja(e,t,n){let r=qa(e.search);if(!r)return;let i=new URL(e.href);i.searchParams.delete(`notice-repo`),i.searchParams.delete(`notice-pane`),t.replaceState(t.state,``,i.pathname+i.search+i.hash),r.pane!==null&&_e(r.repo,r.pane),await n(r.repo).catch(()=>void 0)}ce(document.documentElement,window),de(i()),Ai(document.querySelector(`meta[name="nightcrow-build"]`)?.getAttribute(`content`)||null),Ze(Ye()),await Ja(window.location,window.history,A.setActiveRepo);var Ya=1500;await Promise.race([document.fonts?.load(`400 12px "JetBrains Mono"`).catch(()=>void 0),new Promise(e=>setTimeout(e,Ya))]),(0,Le.createRoot)(document.getElementById(`root`)).render((0,M.jsxs)(j.StrictMode,{children:[(0,M.jsx)(tr,{children:(0,M.jsx)(O,{children:(0,M.jsx)(Ha,{})})}),(0,M.jsx)(Ga,{})]})); \ No newline at end of file +`)}function jn(e,t=0){if(new Set(e.hunks.map(t=>t.file_path??e.path)).size>1)return null;for(let n of e.hunks.slice(Math.max(0,t)))for(let e of n.lines)if(e.new_lineno!==void 0)return e.new_lineno;return null}function Mn(e){return Math.max(0,e-1-2)}function Nn(e,t){return t<=0?null:Math.min(e,t)}function Pn(e,t){let n=0;return e.forEach((e,r)=>{e<=t&&(n=r)}),n}function Fn(e){return e.kind===`empty`||!e.source?null:{want:e.kind===`diff`?`file`:`diff`,source:e.source}}function In(e){return e.index!==`D`&&e.worktree!==`D`}function Ln(e){return e.hunks.some(e=>e.lines.some(e=>e.old_lineno!==void 0||e.new_lineno!==void 0))}function Rn(e){return e.kind===`workdir`?`workdir:${e.path}`:`commit:${e.oid}:${e.path}`}function zn({pane:e,previewRendered:t,setPreviewRendered:n,filesMax:r,setMaximized:i,onShowOtherFace:a,canEdit:o,editing:s,onToggleEdit:c}){let l=wn(),d=f();return(0,M.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[Fn(e)&&(0,M.jsx)(`button`,{onClick:a,"aria-pressed":e.kind===`file`,title:e.kind===`file`?`Back to the diff`:`Open the whole file at this change`,"aria-label":e.kind===`file`?`Back to the diff`:`Open the whole file at this change`,className:`flex shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent ${e.kind===`file`?`text-accent`:``}`,children:(0,M.jsx)(b,{})}),e.kind===`diff`&&(0,M.jsx)(`button`,{onClick:l.toggle,"aria-pressed":l.layout===`split`,title:l.layout===`split`?`Switch to unified diff`:`Switch to split diff`,"aria-label":l.layout===`split`?`Switch to unified diff`:`Switch to split diff`,className:`flex shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent ${l.layout===`split`?`text-accent`:``}`,children:(0,M.jsx)(v,{})}),o&&(0,M.jsx)(`button`,{onClick:c,"aria-pressed":s,title:s?`Stop editing`:`Edit this page's text`,"aria-label":s?`Stop editing`:`Edit this page's text`,className:`flex shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent ${s?`text-accent`:``}`,children:(0,M.jsx)(fe,{})}),e.kind===`file`&&kn(e.value.path)&&!s&&(0,M.jsx)(`button`,{onClick:()=>n(e=>!e),"aria-pressed":t,title:t?`Show raw source`:`Show the rendered page`,"aria-label":t?`Show raw source`:`Show the rendered page`,className:`flex shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent ${t?`text-accent`:``}`,children:(0,M.jsx)(p,{})}),(0,M.jsx)(`button`,{onClick:()=>i(r?`none`:`files`),"aria-pressed":r,...d(`view.toggleMaximize`,r?`Restore the layout`:`Maximize the file pane`),"aria-label":r?`Restore the layout`:`Maximize the file pane`,className:`hidden shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent md:flex`,children:(0,M.jsx)(u,{maximized:r})})]})}var Bn=3;function Vn(e){let t=e<1?1:String(Math.floor(e)).length;return Math.max(t,Bn)}function Hn(e){let t=0;for(let n of e)for(let e of n.lines)t=Math.max(t,e.old_lineno??0,e.new_lineno??0);return Vn(t)}function P({nos:e,digits:t,tint:n=``,stickyClass:r=`sticky left-0`}){return(0,M.jsx)(`span`,{className:`${r} shrink-0 select-none bg-ink-950`,children:(0,M.jsx)(`span`,{className:`flex gap-[1ch] px-[1ch] text-ink-400 ${n}`,children:e.map((e,n)=>(0,M.jsx)(`span`,{className:`text-right`,style:{width:`${t}ch`},children:e??``},n))})})}function Un(){let e=`(min-width: 768px)`,[t,n]=(0,j.useState)(()=>window.matchMedia(e).matches);return(0,j.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[]),t}function Wn(e,t,n){return e.hunks.flatMap((e,r)=>{let i={kind:`header`,hunk:r,text:`${e.file_path?`${e.file_path} `:``}${e.header}`};if(!t)return[i,...e.lines.map(e=>({kind:`unified`,hunk:r,line:e}))];let a=Cn(e.lines);return n?[i,...a.map(({left:e,right:t})=>({kind:`pair`,hunk:r,left:e,right:t}))]:[i,...a.map(({left:e})=>({kind:`side`,hunk:r,line:e,side:`old`,border:!1})),...a.map(({right:e},t)=>({kind:`side`,hunk:r,line:e,side:`new`,border:t===0}))]})}function Gn({line:e}){return(0,M.jsxs)(`span`,{className:`whitespace-pre pr-3`,children:[(0,M.jsx)(`span`,{className:`select-none text-ink-400`,children:e.kind}),e.spans.map((e,t)=>(0,M.jsx)(`span`,{style:{color:e.c},children:e.t},t))]})}function Kn({line:e,side:t,digits:n,stickyClass:r}){let i=e?dn(e.kind):`bg-ink-900/40`;return(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-1 ${i}`,children:[(0,M.jsx)(P,{nos:[e?t===`old`?e.old_lineno:e.new_lineno:void 0],digits:n,tint:i,stickyClass:r}),e?(0,M.jsx)(Gn,{line:e}):(0,M.jsx)(`span`,{className:`pr-3`,children:` `})]})}function qn({diff:e,split:t,viewport:n}){let r=Un(),i=(0,j.useMemo)(()=>Wn(e,t,r),[e,t,r]),a=Hn(e.hunks),o=pn(i.length,n.scrollTop,n.height);return(0,M.jsxs)(`div`,{className:`min-w-full py-1`,"data-virtual-count":i.length,children:[(0,M.jsx)(`div`,{"aria-hidden":`true`,style:{height:o.before}}),i.slice(o.start,o.end).map((e,t)=>{let n=o.start+t,r={"data-hunk":e.hunk,"data-virtual-row":n};if(e.kind===`header`)return(0,M.jsx)(`div`,{...r,className:`h-5 bg-ink-850 px-3 text-ink-400`,children:e.text},n);if(e.kind===`unified`){let t=dn(e.line.kind);return(0,M.jsxs)(`div`,{...r,className:`flex h-5 w-max min-w-full ${t}`,children:[(0,M.jsx)(P,{nos:[e.line.old_lineno,e.line.new_lineno],digits:a,tint:t}),(0,M.jsx)(Gn,{line:e.line})]},n)}return e.kind===`pair`?(0,M.jsxs)(`div`,{...r,className:`flex h-5 min-w-full`,children:[(0,M.jsx)(Kn,{line:e.left,side:`old`,digits:a}),(0,M.jsx)(`div`,{className:`flex min-w-0 flex-1 border-l border-ink-800`,children:(0,M.jsx)(Kn,{line:e.right,side:`new`,digits:a,stickyClass:`sticky left-1/2`})})]},n):(0,M.jsx)(`div`,{...r,className:`flex h-5 min-w-full ${e.border?`border-t border-ink-800`:``}`,children:(0,M.jsx)(Kn,{line:e.line,side:e.side,digits:a})},n)}),(0,M.jsx)(`div`,{"aria-hidden":`true`,style:{height:o.after}})]})}function Jn({line:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`text-ink-400 select-none`,children:e.kind}),e.spans.map((e,t)=>(0,M.jsx)(`span`,{style:{color:e.c},children:e.t},t))]})}function Yn({line:e,digits:t,side:n}){if(e===null)return(0,M.jsxs)(`div`,{className:`flex bg-ink-900/40`,children:[(0,M.jsx)(P,{nos:[void 0],digits:t,tint:`bg-ink-900/40`}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:` `})]});let r=dn(e.kind);return(0,M.jsxs)(`div`,{className:`flex ${r}`,children:[(0,M.jsx)(P,{nos:[n===`old`?e.old_lineno:e.new_lineno],digits:t,tint:r}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:(0,M.jsx)(Jn,{line:e})})]})}function Xn({cells:e,digits:t,side:n,border:r}){return(0,M.jsx)(`div`,{className:`min-w-0 flex-none overflow-x-auto md:flex-1 md:basis-1/2 ${r?`border-t border-ink-800 md:border-t-0 md:border-l`:``}`,children:(0,M.jsx)(`div`,{className:`w-max min-w-full`,children:e.map((e,r)=>(0,M.jsx)(Yn,{line:e,digits:t,side:n},r))})})}function Zn({lines:e,digits:t}){let n=Cn(e);return(0,M.jsxs)(`div`,{className:`flex flex-col md:flex-row`,children:[(0,M.jsx)(Xn,{cells:n.map(e=>e.left),digits:t,side:`old`,border:!1}),(0,M.jsx)(Xn,{cells:n.map(e=>e.right),digits:t,side:`new`,border:!0})]})}function Qn({diff:e,split:t,viewport:n={scrollTop:0,height:600}}){if(e.hunks.reduce((e,t)=>e+t.lines.length,0)>200)return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(qn,{diff:e,split:t,viewport:n}),e.truncated&&(0,M.jsx)(`p`,{className:`p-3 text-accent`,children:`Diff truncated — it exceeded the server's size ceiling.`})]});let r=Hn(e.hunks);return(0,M.jsxs)(`div`,{className:`p-1`,children:[e.hunks.length===0&&(0,M.jsx)(`p`,{className:`p-3 text-ink-400`,children:`No changes.`}),e.hunks.map((e,n)=>{let i=(0,M.jsxs)(`div`,{className:`bg-ink-850 px-3 py-0.5 text-ink-400`,children:[e.file_path?`${e.file_path} `:``,e.header]});return(0,M.jsx)(`div`,{"data-hunk":n,className:`mb-2`,children:t?(0,M.jsxs)(M.Fragment,{children:[i,(0,M.jsx)(Zn,{lines:e.lines,digits:r})]}):(0,M.jsxs)(`div`,{className:`w-max min-w-full`,children:[i,e.lines.map((e,t)=>{let n=dn(e.kind);return(0,M.jsxs)(`div`,{className:`flex ${n}`,children:[(0,M.jsx)(P,{nos:[e.old_lineno,e.new_lineno],digits:r,tint:n}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:(0,M.jsx)(Jn,{line:e})})]},t)})]})},n)}),e.truncated&&(0,M.jsx)(`p`,{className:`p-3 text-accent`,children:`Diff truncated — it exceeded the server's size ceiling.`})]})}var $n=[`failed to fetch dynamically imported module`,`error loading dynamically imported module`,`importing a module script failed`,`unable to preload css`];function er(e){let t=e instanceof Error?e.message:typeof e==`string`?e:``;if(!t)return!1;let n=t.toLowerCase();return $n.some(e=>n.includes(e))}var tr=class extends j.Component{state={error:null,failed:!1};static getDerivedStateFromError(e){return{error:e,failed:!0}}componentDidCatch(e,t){console.error(`nightcrow: a subtree failed to render`,e,t)}render(){return this.state.failed?(0,M.jsx)(nr,{chunk:er(this.state.error),region:this.props.region,className:this.props.className}):this.props.children}};function nr({chunk:e,region:t,className:n}){return(0,M.jsxs)(`div`,{role:`alert`,className:`h-full min-h-0 flex-col items-start gap-3 p-4 text-ink-400 ${n??`flex`}`,children:[e?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{className:`text-accent`,children:`Part of the app could not be loaded.`}),(0,M.jsx)(`p`,{children:`Most likely the server was updated while this tab was open, and reloading picks up the current version. If the reload fails too, the server is not reachable from here. Either way nothing on the server is affected — the session, its repositories, and its terminals are untouched.`})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{className:`text-removed`,children:t?`The ${t} could not be rendered.`:`Something went wrong.`}),(0,M.jsx)(`p`,{children:`The details are in the browser console.`})]}),(0,M.jsx)(`button`,{onClick:()=>window.location.reload(),className:`rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:border-accent hover:text-accent`,children:`Reload`})]})}function rr({lines:e}){let t=Vn(e.length);return(0,M.jsx)(`pre`,{className:`w-max min-w-full py-2 text-ink-200`,children:e.map((e,n)=>(0,M.jsxs)(`div`,{"data-line":n+1,className:`flex`,children:[(0,M.jsx)(P,{nos:[n+1],digits:t}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:e.length===0?` `:e.map((e,t)=>(0,M.jsx)(`span`,{style:{color:e.c},children:e.t},t))})]},n))})}function ir({lines:e,viewport:t}){let n=Vn(e.length),r=pn(e.length,t.scrollTop,t.height);return(0,M.jsxs)(`pre`,{className:`w-max min-w-full`,"data-virtual-count":e.length,children:[(0,M.jsx)(`div`,{"aria-hidden":`true`,style:{height:r.before}}),e.slice(r.start,r.end).map((e,t)=>{let i=r.start+t;return(0,M.jsxs)(`div`,{"data-line":i+1,"data-virtual-row":i,className:`flex h-5 text-ink-200`,children:[(0,M.jsx)(P,{nos:[i+1],digits:n}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:e.length===0?` `:e.map((e,t)=>(0,M.jsx)(`span`,{style:{color:e.c},children:e.t},t))})]},i)}),(0,M.jsx)(`div`,{"aria-hidden":`true`,style:{height:r.after}})]})}var ar=`modulepreload`,or=function(e,t){return new URL(e,t).href},sr={},cr=function(e){return e.pathname.endsWith(`.css`)},lr=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},ur=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=or(t,n);let r=s(t),i=cr(r);return lr(sr,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:ar,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function dr(e,t){return`${e??``}\u0000${Rn(t)}`}var fr=(0,j.lazy)(()=>ur(()=>import(`./Markdown-DEJAds14.js`).then(e=>({default:e.MarkdownView})),__vite__mapDeps([0,1,2,3]),import.meta.url)),pr=(0,j.lazy)(()=>ur(()=>import(`./Html-DGFy4jGa.js`).then(e=>({default:e.HtmlView})),__vite__mapDeps([4,1]),import.meta.url)),mr=(0,j.lazy)(()=>ur(()=>import(`./HtmlEditor-DzgQSTDx.js`).then(e=>({default:e.HtmlEditor})),__vite__mapDeps([5,1,2,6,7]),import.meta.url));function hr({repo:e,pane:t,loading:n=!1,previewRendered:r,setPreviewRendered:i,filesMax:a,setMaximized:o,showOtherFace:s,status:c,className:l=``}){let u=wn(),[d,f]=(0,j.useState)(!1),p=t.kind===`file`?t.value.path:null,m=t.kind===`file`&&t.source?.kind===`commit`,h=e!==null&&p!==null&&!m&&On(p),g=(0,j.useRef)(null),{viewport:_,refresh:v}=zt(g),y=t.kind===`file`?t.anchor:void 0,b=(0,j.useRef)(null),x=()=>{let n=g.current;if(!n)return 0;let r=n.getBoundingClientRect().top,i=Array.from(n.querySelectorAll(`[data-hunk]`),e=>({offset:e.getBoundingClientRect().top-r+n.scrollTop,hunk:Number(e.dataset.hunk??0)}));return t.kind===`diff`&&t.source&&(b.current={key:dr(e,t.source),top:n.scrollTop,left:n.scrollLeft}),i[Pn(i.map(e=>e.offset),n.scrollTop)]?.hunk??0};return(0,j.useEffect)(()=>{let n=g.current;if(!n)return;if(t.kind===`diff`&&t.source){let r=b.current;r&&r.key===dr(e,t.source)&&(n.scrollTop=r.top,n.scrollLeft=r.left,b.current=null,v());return}if(y===void 0||t.kind!==`file`)return;let r=Nn(y,t.value.lines.length);if(r===null)return;if(t.value.lines.length>200){n.scrollTop=mn(r),v();return}let i=n.querySelector(`[data-line="${r}"]`);i&&(n.scrollTop+=i.getBoundingClientRect().top-n.getBoundingClientRect().top,v())},[t,y,e,v]),(0,j.useEffect)(()=>{f(!1)},[e,p,m]),(0,M.jsxs)(`section`,{...jt(`content`),className:`min-h-0 min-w-0 flex-col ${l}`,children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 bg-ink-850 px-3 py-0.5 text-ink-400`,children:[t.kind===`file`&&(0,M.jsx)(en,{path:t.value.path,className:`min-w-0 truncate`}),(0,M.jsx)(zn,{pane:t,previewRendered:r,setPreviewRendered:i,filesMax:a,setMaximized:o,onShowOtherFace:()=>s(x()),canEdit:h,editing:d&&h,onToggleEdit:()=>f(e=>!e)})]}),(0,M.jsx)(`div`,{ref:g,onScroll:v,className:`nc-content min-h-0 flex-1 overflow-auto`,children:n?(0,M.jsx)(`div`,{"aria-busy":`true`,"aria-label":`Loading`,className:`py-2`,children:(0,M.jsx)(_t,{rows:12})}):(0,M.jsxs)(M.Fragment,{children:[t.kind===`empty`&&(c===null?(0,M.jsx)(`div`,{"aria-busy":`true`,"aria-label":`Loading`,className:`py-2`,children:(0,M.jsx)(_t,{rows:12})}):c.unavailable===void 0?(0,M.jsx)(`p`,{className:`nc-fade-in p-4 text-ink-400`,children:`Select a file or commit.`}):(0,M.jsx)(`p`,{className:`nc-fade-in p-4 text-ink-400`,children:ln(c.unavailable)})),t.kind===`file`&&(0,M.jsxs)(M.Fragment,{children:[d&&h&&e!==null&&p!==null?(0,M.jsx)(tr,{region:`preview`,children:(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(`div`,{"aria-busy":`true`,"aria-label":`Opening the editor`,className:`py-2`,children:(0,M.jsx)(_t,{rows:12})}),children:(0,M.jsx)(mr,{repo:e,path:p})})},`edit:${p}`):kn(t.value.path)&&r?(0,M.jsx)(tr,{region:`preview`,children:(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(`div`,{"aria-busy":`true`,"aria-label":`Rendering`,className:`py-2`,children:(0,M.jsx)(_t,{rows:12})}),children:On(t.value.path)&&e!==null?(0,M.jsx)(pr,{src:A.previewUrl(e,t.value.path,t.source?.kind===`commit`?t.source.oid:void 0)}):(0,M.jsx)(fr,{source:An(t.value.lines)})})},t.value.path):t.value.lines.length>200?(0,M.jsx)(ir,{lines:t.value.lines,viewport:_}):(0,M.jsx)(rr,{lines:t.value.lines}),t.value.truncated&&(0,M.jsx)(`p`,{className:`p-3 text-accent`,children:`File truncated — it exceeded the server's size ceiling.`})]}),t.kind===`diff`&&(0,M.jsx)(Qn,{diff:t.value,split:u.layout===`split`,viewport:_})]})})]})}var gr=[{key:`files`,label:`Repo`,icon:Ue},{key:`diff`,label:`Content`,icon:We},{key:`terminal`,label:`Terminal`,icon:Ge}];function _r({view:e,onSelect:t}){return(0,M.jsx)(`nav`,{"aria-label":`Switch view`,className:`flex shrink-0 items-stretch border-t border-chrome-line bg-ink-900 md:hidden`,children:gr.map(({key:n,label:r,icon:i})=>(0,M.jsxs)(`button`,{onClick:()=>t(n),"aria-current":e===n?`page`:void 0,className:`flex min-h-11 flex-1 flex-col items-center justify-center gap-0.5 py-1 text-xs ${e===n?`text-accent`:`text-ink-400`}`,children:[(0,M.jsx)(i,{className:`h-5 w-5`}),r]},n))})}var vr=(0,j.lazy)(()=>ur(()=>import(`./Terminal-DiFTvhqh.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([8,1,2,9,7]),import.meta.url));function yr({repository:{id:e,current:t,status:n},sidebar:r,filePane:i,layout:{sidebarWidth:a,sidebarRef:o,draggingSidebar:s,onSidebarDragStart:c,onSidebarDragMove:l,onSidebarDragEnd:u,onSidebarDragCancel:d,upperRef:f,lowerRef:p,draggingUpper:m,onUpperDragStart:h,onUpperDragMove:g,onUpperDragEnd:_,onUpperDragCancel:v,maximized:y,setMaximized:b,mobileView:x,setMobileView:S}}){let C=y===`files`;(0,j.useEffect)(()=>d,[e,d]),(0,j.useEffect)(()=>v,[v]);let w=(0,j.useCallback)(()=>b(e=>e===`terminal`?`none`:`terminal`),[b]);return(0,M.jsxs)(M.Fragment,{children:[s&&(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 cursor-col-resize`}),m&&(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 cursor-row-resize`}),(0,M.jsxs)(`main`,{ref:f,className:`grid min-h-0 grid-cols-1 md:grid-cols-[var(--nc-sidebar)_minmax(0,1fr)] ${x===`terminal`?`hidden md:grid`:``} ${s||m?`select-none`:``}`,style:{"--nc-sidebar":C?`0px`:`min(${a}px, ${xt*100}vw)`},children:[(0,M.jsx)(Sn,{...r,repo:e,status:n,sidebarRef:o,draggingSidebar:s,onSidebarDragStart:c,onSidebarDragMove:l,onSidebarDragEnd:u,onSidebarDragCancel:d,filesMax:C,mobileView:x},e),(0,M.jsx)(hr,{...i,filesMax:C,setMaximized:b,status:n,className:`nc-fade-in ${x===`diff`?`flex`:`hidden md:flex`}`})]}),(0,M.jsx)(tr,{region:`terminal panel`,className:x===`terminal`?`flex`:`hidden md:flex`,children:(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(`div`,{className:`min-h-0 border-t border-chrome-line ${x===`terminal`?`block`:`hidden md:block`}`}),children:(0,M.jsx)(vr,{repo:e,maximized:y===`terminal`,onToggleMaximized:w,className:`nc-fade-in ${x===`terminal`?`flex`:`hidden md:flex`} ${y===`files`?`overflow-hidden`:``}`,sectionRef:p,showDivider:y===`none`,draggingUpper:m,onUpperDragStart:h,onUpperDragMove:g,onUpperDragEnd:_,onUpperDragCancel:v})})}),(0,M.jsx)(_r,{view:x,onSelect:S}),(0,M.jsxs)(`footer`,{className:`flex shrink-0 items-center gap-3 border-t border-chrome-line bg-ink-900 px-3 py-1 text-ink-400`,children:[(0,M.jsx)(`span`,{className:`min-w-0 shrink-[1000] truncate`,children:t?.display_path}),n?.branch&&(0,M.jsx)(`span`,{className:`max-w-[50%] shrink-0 truncate text-accent`,children:n.branch}),_n(n)&&(0,M.jsx)(`span`,{className:`shrink-0 font-medium text-removed`,role:`status`,children:_n(n)}),n?.tracking&&(0,M.jsxs)(`span`,{className:`shrink-0`,children:[`↑`,n.tracking.ahead,` ↓`,n.tracking.behind]}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0`,children:n?(0,M.jsx)(`span`,{className:`text-added`,children:`● live`}):`connecting…`})]})]})}var br=`0.1.29`;function xr({settings:e}){let{leaderText:t,conflict:n,setLeader:r,disable:i,reset:a}=e,[o,s]=(0,j.useState)(t),[c,l]=(0,j.useState)(null);(0,j.useEffect)(()=>{s(t),l(null)},[t]);let u=()=>{r(o)?l(null):l(`"${o}" is not a chord. Write it as Ctrl+F, Alt+Space or Ctrl+Shift+ArrowLeft.`)};return(0,M.jsxs)(`section`,{className:`shrink-0 border-b border-ink-700 px-3 py-2`,children:[(0,M.jsxs)(`p`,{className:`text-ink-400`,children:[`Leader chord:`,` `,t?(0,M.jsx)(`kbd`,{className:`rounded-sm border border-ink-600 bg-ink-850 px-1.5 py-0.5 font-mono text-ink-50`,children:t}):(0,M.jsx)(`span`,{className:`text-ink-200`,children:`switched off`})]}),(0,M.jsxs)(`div`,{className:`mt-1.5 flex items-stretch gap-2`,children:[(0,M.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u()},placeholder:`Ctrl+F`,"aria-label":`leader chord`,spellCheck:!1,autoCapitalize:`none`,autoCorrect:`off`,className:`min-w-0 flex-1 rounded-sm border border-ink-700 bg-ink-950 px-2 py-1 font-mono text-ink-50 placeholder:text-ink-400 focus:border-ink-600 focus:outline-none`}),(0,M.jsx)(`button`,{type:`button`,onClick:u,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850`,children:`Rebind`}),(0,M.jsx)(`button`,{type:`button`,onClick:i,title:`Leave the leader unbound. Standalone chords keep working.`,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850`,children:`Switch off`}),(0,M.jsx)(`button`,{type:`button`,onClick:a,title:`Back to the leader the TUI ships with`,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850`,children:`Reset`})]}),c&&(0,M.jsx)(`p`,{role:`alert`,className:`mt-1 text-removed`,children:c}),n&&(0,M.jsxs)(`p`,{role:`status`,className:`mt-1 text-accent`,children:[n,` Rebind it above if you would rather keep that key.`]})]})}function Sr({keys:e}){return e?(0,M.jsx)(`span`,{className:`flex shrink-0 items-center gap-1`,children:e.map((e,t)=>(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t>0&&(0,M.jsx)(`span`,{className:`text-ink-400`,children:`then`}),(0,M.jsx)(`kbd`,{className:`rounded-sm border border-ink-600 bg-ink-850 px-1.5 py-0.5 font-mono text-ink-50`,children:e})]},e))}):(0,M.jsx)(`span`,{className:`shrink-0 text-ink-400`,children:`no key — the leader is switched off`})}function Cr({action:e,keys:t,ariaKeys:n,available:r,onRun:i}){let a=`flex w-full flex-col gap-0.5 rounded-sm px-3 py-1.5 text-left ${r?``:`opacity-50`}`,o=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`span`,{className:`flex w-full items-baseline gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-ink-50`,children:e.label}),e.support===`reinterpreted`&&(0,M.jsx)(`span`,{className:`shrink-0 rounded-sm bg-ink-700 px-1 text-2xs uppercase tracking-wide text-ink-200`,children:`reinterpreted`}),e.support===`browserOnly`&&(0,M.jsx)(`span`,{className:`shrink-0 rounded-sm bg-ink-700 px-1 text-2xs uppercase tracking-wide text-ink-200`,children:`browser only`}),!r&&(0,M.jsx)(`span`,{className:`shrink-0 text-2xs uppercase tracking-wide text-ink-400`,children:`not available here`}),(0,M.jsx)(Sr,{keys:t})]}),e.note&&(0,M.jsx)(`span`,{className:`text-ink-400`,children:e.note})]}),s={"data-shortcut-action":e.id,"aria-disabled":!r||void 0,"aria-keyshortcuts":n??void 0};return e.keyboardOnly?(0,M.jsx)(`li`,{children:(0,M.jsx)(`div`,{...s,className:a,children:o})}):(0,M.jsx)(`li`,{children:(0,M.jsx)(`button`,{type:`button`,...s,onClick:()=>{r&&i()},className:`${a} ${r?`hover:bg-ink-850`:``}`,children:o})})}var wr={terminal:`Terminal`,project:`Projects`,view:`Layout and views`,focus:`Focus`,session:`Session`,help:`Help`},Tr=(()=>{let e=[];for(let t of S){let n=e.find(e=>e.group===t.group);n?n.actions.push(t):e.push({group:t.group,actions:[t]})}return e})(),Er=`nc-shortcut-help-title`;function Dr({onClose:e,leader:t}){let n=we(),r=ee(),i=(0,j.useRef)(null),a=(0,j.useRef)(!1);(0,j.useEffect)(()=>{let e=document.activeElement;return i.current?.focus(),()=>{a.current||e instanceof HTMLElement&&e.isConnected&&e.focus()}},[]),(0,j.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e]);let o=t=>{a.current=!0,n?.runAction(t.id),e()};return(0,M.jsx)(`div`,{className:`nc-fade-in fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e,children:(0,M.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-labelledby":Er,tabIndex:-1,className:`nc-rise-in flex max-h-[85vh] w-[40rem] max-w-full flex-col rounded-lg border border-ink-700 bg-ink-900 focus:outline-none`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-ink-700 px-3 py-2`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{id:Er,className:`block font-medium text-ink-50`,children:`Keyboard shortcuts`}),(0,M.jsxs)(`span`,{className:`block text-caption text-ink-400`,children:[`nightcrow v`,br]})]}),(0,M.jsx)(`button`,{type:`button`,onClick:e,"aria-label":`close`,className:`ml-auto flex h-6 w-6 items-center justify-center rounded-sm text-ink-400 hover:text-ink-200`,children:(0,M.jsx)(pe,{})})]}),(0,M.jsx)(xr,{settings:t}),(0,M.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-1`,children:[Tr.map(({group:e,actions:n})=>(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h3`,{className:`px-3 py-1 text-caption uppercase text-ink-400`,children:wr[e]}),(0,M.jsx)(`ul`,{children:n.map(e=>(0,M.jsx)(Cr,{action:e,keys:C(e.id,t.leader),ariaKeys:ge(e.id,t.leader),available:r(e.id),onRun:()=>o(e)},e.id))})]},e)),(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h3`,{className:`px-3 py-1 text-caption uppercase text-ink-400`,children:`Not bound in the browser`}),(0,M.jsx)(`ul`,{children:w.map(e=>(0,M.jsxs)(`li`,{className:`px-3 py-1.5`,children:[(0,M.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-ink-200`,children:e.label}),(0,M.jsx)(`kbd`,{className:`shrink-0 rounded-sm border border-ink-700 bg-ink-850 px-1.5 py-0.5 font-mono text-ink-400`,children:e.leader})]}),(0,M.jsx)(`span`,{className:`text-ink-400`,children:e.reason})]},e.leader))})]})]})]})})}var Or=[`terminal.newPane`,`terminal.closePane`,`view.toggleMaximize`,`project.openDialog`,`help.shortcuts`],kr={keys:`3-9,0`,label:`pane 1-8`,click:null},Ar={keys:`3-9,0`,label:`swap active pane with this pane`,click:null},jr={keys:`esc`,label:`cancel`,click:null};function Mr(e,t,n){return e.armed&&e.swapPending?{chip:`SWAP`,segments:[Ar,jr]}:e.armed?{chip:`PREFIX`,segments:Pr(n)}:t?{chip:null,segments:Nr(t,n)}:{chip:null,segments:Fr(n)}}function Nr(e,t){let n=me(e),r=[{keys:n,label:`leader`,click:{kind:`arm`}}];for(let e of S)Or.includes(e.id)&&t(e.id)&&r.push(Ir(e,`${n} ${e.leader}`));return r}function Pr(e){let t=[],n=!1;for(let i of S)i.leader!==void 0&&e(i.id)&&(r(i.id)===null?t.push(Ir(i,i.leader)):(n||t.push(kr),n=!0));return t.push(jr),t}function Fr(e){let t=[{keys:`leader`,label:`switched off`,click:{kind:`run`,action:`help.shortcuts`}}];for(let n of S)n.chord!==void 0&&e(n.id)&&t.push(Ir(n,n.chord));return t}function Ir(e,t){return{keys:t,label:e.hint,click:{kind:`run`,action:e.id}}}var Lr=`shrink-0 whitespace-nowrap`;function Rr({state:e,onClick:t}){let n=Mr(e,c(),ee());return(0,M.jsxs)(`div`,{role:`toolbar`,"aria-label":`Keyboard hints`,className:`hidden shrink-0 items-center gap-1 overflow-hidden border-t border-chrome-line bg-ink-900 px-2 py-0.5 text-xs text-ink-400 md:flex`,children:[n.chip&&(0,M.jsx)(`span`,{"data-hint-chip":n.chip,className:`shrink-0 bg-accent px-1 font-bold text-ink-950`,children:n.chip}),n.segments.map((e,n)=>(0,M.jsxs)(j.Fragment,{children:[n>0&&(0,M.jsx)(`span`,{className:`shrink-0 text-ink-600`,children:`|`}),(0,M.jsx)(zr,{segment:e,onClick:t})]},`${e.keys} ${e.label}`))]})}function zr({segment:e,onClick:t}){let n=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`text-ink-200`,children:e.keys}),`: `,e.label]});if(!e.click)return(0,M.jsx)(`span`,{className:Lr,children:n});let r=e.click;return(0,M.jsx)(`button`,{type:`button`,"data-hint-action":r.kind===`run`?r.action:`arm`,onPointerDown:e=>e.preventDefault(),onClick:()=>t(r),className:`${Lr} rounded-sm hover:text-accent`,children:n})}function Br(e,t){return e?`grid-rows-[minmax(0,1fr)_auto_auto] ${t===`terminal`?`md:grid-rows-[minmax(0,0fr)_minmax(0,1fr)_auto_auto]`:t===`files`?`md:grid-rows-[minmax(0,1fr)_minmax(0,0fr)_auto_auto]`:`md:grid-rows-[minmax(0,var(--nc-upper))_minmax(0,var(--nc-lower))_auto_auto]`}`:`grid-rows-[1fr]`}function Vr(e,t){let n=Hr(e);if(n.length===0)return null;let r=e.at,i=r===null?-1:n.findIndex(e=>Ur(e,r)),a;return a=i===-1?t>0?n[0]:n[n.length-1]:n[(i+t+n.length)%n.length],r!==null&&Ur(a,r)?null:a}function Hr({paneCount:e,maximized:t,narrow:n,mobileView:r}){let i={kind:`list`},a={kind:`content`},o=Array.from({length:e},(e,t)=>({kind:`pane`,index:t}));if(n)switch(r){case`files`:return[i];case`diff`:return[a];case`terminal`:return o}switch(t){case`terminal`:return o;case`files`:return[i,a];case`none`:return[i,a,...o]}}function Ur(e,t){return e.kind===t.kind?e.kind!==`pane`||t.kind!==`pane`||e.index===t.index:!1}function Wr(e,t,n){if(e.length<=1||t===null)return null;let r=e.indexOf(t);return r<0?null:e[(r+n+e.length)%e.length]}var Gr={armed:!1},Kr={kind:`none`};function qr(e=Kr){return{state:Gr,effect:e}}function Jr(e,t){switch(t.kind){case`blur`:case`focusChange`:case`dialogOpen`:case`repoChange`:case`socketReconnect`:case`disabled`:case`suppressed`:case`cancel`:return qr();case`consumed`:return qr();case`arm`:return{state:{armed:!0,swapPending:!1},effect:Kr};case`literalLeader`:return qr({kind:`sendLiteralLeader`,data:t.data});case`action`:return Yr(e,t.action.id);case`ignore`:return{state:e,effect:Kr}}}function Yr(e,t){if(e.armed&&e.swapPending){let e=r(t);return e===null?qr():qr({kind:`swapWith`,pane:e})}return t===`terminal.swapPanePrompt`?{state:{armed:!0,swapPending:!0},effect:Kr}:qr({kind:`run`,action:t})}var Xr=S.flatMap(e=>{if(!e.chord)return[];let t=E(e.chord);return t?[{spec:t,action:e}]:[]}),Zr=new Set([`Shift`,`Control`,`Alt`,`Meta`]),Qr=229,$r=new Set([`Process`,`Unidentified`]),ei={kind:`ignore`};function ti(e){return e.isComposing===!0||e.keyCode===Qr||$r.has(e.key)}function ni(e){return e.key===`Escape`||e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&e.key.toLowerCase()===`c`}function ri(e,t){if(e.type!==`keydown`||ti(e)||e.repeat===!0||t.suppressed)return ei;if(t.armed){if(ni(e))return{kind:`cancel`};if(t.leader&&xe(t.leader,e))return{kind:`literalLeader`,data:le(t.leader)??``};if(e.key.length===1){let t=_(e.key);if(t)return{kind:`action`,action:t}}return Zr.has(e.key)?ei:{kind:`consumed`}}if(t.leader&&xe(t.leader,e))return{kind:`arm`};for(let{spec:t,action:n}of Xr)if(xe(t,e))return{kind:`action`,action:n};return ei}var ii=new Set([`checkbox`,`radio`,`button`,`submit`,`reset`,`image`,`range`,`color`,`file`]),ai=new Set([`textbox`,`searchbox`,`combobox`]);function oi(e){if(!e)return!1;if(e.isContentEditable===!0)return!0;let t=e.role?.toLowerCase()??``;if(ai.has(t))return!0;switch(e.tagName.toUpperCase()){case`INPUT`:return!ii.has(e.type?.toLowerCase()??`text`);case`TEXTAREA`:case`SELECT`:return!0;default:return!1}}function si(e){return e.dialogOpen||e.composing||e.target?.inDialog===!0?!0:oi(e.target)}function ci(e,t=!0){let n=(0,j.useRef)(e);n.current=e,(0,j.useEffect)(()=>{if(!t)return;let e=e=>{n.current(e)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())};return document.addEventListener(`keydown`,e,{capture:!0}),()=>document.removeEventListener(`keydown`,e,{capture:!0})},[t])}function li({enabled:e,leader:t,dialogOpen:n,repo:r}){let i=we(),a=(0,j.useRef)(Gr),[o,s]=(0,j.useState)(Gr),c=(0,j.useRef)(i);c.current=i;let l=(0,j.useCallback)(e=>{let t=Jr(a.current,e);a.current=t.state,s(t.state);let n=c.current;n&&ui(t.effect,n)},[]);ci((0,j.useCallback)(e=>{let r=si({target:Mt(e.target),dialogOpen:n,composing:e.isComposing===!0}),i=ri(e,{leader:t,armed:a.current.armed,suppressed:r});return r?(l({kind:`suppressed`}),!1):(l(i),i.kind!==`ignore`)},[n,t,l]),e&&i!==null),(0,j.useEffect)(()=>{if(!e)return;let t=()=>l({kind:`blur`}),n=e=>{let t=Mt(e.target);(oi(t)||t?.inDialog===!0)&&l({kind:`focusChange`})};return window.addEventListener(`blur`,t),document.addEventListener(`focusin`,n,{capture:!0}),()=>{window.removeEventListener(`blur`,t),document.removeEventListener(`focusin`,n,{capture:!0})}},[e,l]),(0,j.useEffect)(()=>{n&&l({kind:`dialogOpen`})},[n,l]),(0,j.useEffect)(()=>{e||l({kind:`disabled`})},[e,l]);let u=(0,j.useRef)(r);return(0,j.useEffect)(()=>{u.current!==r&&(u.current=r,l({kind:`repoChange`}))},[r,l]),(0,j.useEffect)(()=>{if(i)return i.onDisarm(()=>l({kind:`socketReconnect`}))},[i,l]),(0,j.useEffect)(()=>{l({kind:`cancel`})},[t,l]),{state:o,arm:(0,j.useCallback)(()=>l({kind:`arm`}),[l]),disarm:(0,j.useCallback)(()=>l({kind:`cancel`}),[l])}}function ui(e,t){switch(e.kind){case`none`:return;case`run`:t.runAction(e.action);return;case`swapWith`:t.swapPanes(e.pane);return;case`sendLiteralLeader`:e.data&&t.sendLiteralLeader(e.data);return}}var di=`nightcrow.shortcut.leader`;function fi(){let[e,t]=(0,j.useState)(pi),n=(0,j.useCallback)(e=>{t(e),hi(e===null?null:me(e))},[]),r=(0,j.useCallback)(e=>{let t=E(e);return t?(n(t),!0):!1},[n]),i=(0,j.useCallback)(()=>n(null),[n]),a=(0,j.useCallback)(()=>n(re),[n]);return{leader:e,leaderText:e?me(e):``,conflict:e?ve(e):null,setLeader:r,disable:i,reset:a}}function pi(){let e=mi();return e?e.leader===null?null:E(e.leader)??re:re}function mi(){try{let e=localStorage.getItem(di);if(!e)return null;let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.leader;return n===null?{leader:null}:typeof n==`string`?{leader:n}:null}catch{return null}}function hi(e){try{localStorage.setItem(di,JSON.stringify({leader:e}))}catch{}}function gi({enabled:e,repo:t,repos:n,selectRepo:r,closeRepo:i,openPicker:a,pickerOpen:o,cycleAccent:s,reloadConfig:c,tab:l,chooseTab:u,maximized:d,setMaximized:f,mobileView:p}){let m=we(),h=fi(),[g,_]=(0,j.useState)(!1),v=(0,j.useCallback)(()=>_(!0),[]),y=(0,j.useCallback)(()=>_(!1),[]),b=(0,j.useCallback)(e=>{let i=Wr(n.map(e=>e.id),t,e);i!==null&&r(i)},[n,t,r]),x=m?.zoomActivePane,S=(0,j.useCallback)(()=>{Nt()?(f(e=>e===`terminal`?`none`:`terminal`),x?.()):f(e=>e===`files`?`none`:`files`)},[f,x]),C=(0,j.useCallback)(e=>{let t=m?.paneCursor()??null,n=Pt(),r=null;n===`terminal`?t&&t.index>=0&&(r={kind:`pane`,index:t.index}):n!==null&&(r={kind:n});let i=Vr({at:r,paneCount:t?.count??0,maximized:d,narrow:window.innerWidth<768,mobileView:p},e);i!==null&&(i.kind===`pane`?m?.focusPaneAt(i.index):Ft(i.kind))},[m,d,p]),w=(0,j.useMemo)(()=>{let e={"project.openDialog":a,"session.cycleAccent":s,"session.reloadConfig":c,"help.shortcuts":v};return n.length>1&&(e[`project.previous`]=()=>b(-1),e[`project.next`]=()=>b(1)),t===null||(e[`project.close`]=()=>i(t),e[`view.toggleLog`]=()=>u(l===`log`?`status`:`log`),e[`view.toggleTree`]=()=>u(l===`tree`?`status`:`tree`),e[`view.toggleMaximize`]=S,e[`focus.list`]=()=>void Ft(`list`),e[`focus.content`]=()=>void Ft(`content`),e[`focus.previous`]=()=>C(-1),e[`focus.next`]=()=>C(1)),e},[a,s,c,v,n.length,b,t,l,i,u,S,C]);Te(w);let T=li({enabled:e,leader:h.leader,dialogOpen:o||g,repo:t}),{arm:E,disarm:ee}=T,te=(0,j.useCallback)(e=>{e.kind===`arm`?E():(ee(),m?.runAction(e.action))},[E,ee,m]);return{shortcutHelp:{open:g,show:v,hide:y},settings:h,hint:{state:T.state,onClick:te}}}var _i=1e3,vi=3,yi=2e3;function bi(e,t){let[n,r]=(0,j.useState)(!1),i=(0,j.useRef)(!1),a=(0,j.useRef)(!1);(0,j.useEffect)(()=>(a.current=!1,()=>{a.current=!0}),[]);let o=(0,j.useCallback)(async t=>{for(;!a.current;){if(await new Promise(e=>setTimeout(e,_i)),a.current)return;let n;try{n=await A.cloneStatus(t)}catch(e){if(Ne(e)){i.current=!1,a.current||r(!1);return}if(e instanceof Oe&&e.status===404){if(a.current)return;T.error(`the clone's progress is no longer available`),i.current=!1,r(!1);return}continue}if(a.current)return;if(n.state===`done`){try{let t=await A.open(n.path);if(a.current)return;e(t)}catch(e){if(a.current)return;T.error(e instanceof Error?e.message:`could not open`)}finally{i.current=!1,a.current||r(!1)}return}if(n.state===`failed`){T.error(n.message),i.current=!1,r(!1);return}}},[e]),s=(0,j.useCallback)(async(e=()=>!1)=>{for(let t=0;t0&&await new Promise(e=>setTimeout(e,yi)),i.current||e()||a.current)return;let n;try{({job:n}=await A.runningClone())}catch(e){if(Ne(e))return;continue}if(n===null||e()||a.current||i.current)return;i.current=!0,r(!0),o(n);return}},[o]);return(0,j.useEffect)(()=>{if(!t)return;let e=!1;return s(()=>e),()=>{e=!0}},[t,s]),{busy:n,start:(0,j.useCallback)(async(e,t)=>{if(t.trim()&&!i.current){i.current=!0,r(!0);try{let{job:n}=await A.clone(e,t.trim());await o(n)}catch(e){if(i.current=!1,a.current)return;let t=e instanceof Oe&&e.status>=400;T.error(t?e.message:`could not confirm the clone started — check this folder before retrying`),r(!1),s()}}},[o,s])}}function xi(e,t,n,r=!1){return r&&n&&t.includes(n)?n:e&&t.includes(e)?e:n&&t.includes(n)?n:t[0]??null}function Si(e){let t=!1,n=null,r=()=>{if(t||n===null)return;let i=n;n=null,t=!0,e(i).catch(()=>{}).finally(()=>{t=!1,r()})};return e=>{n=e,r()}}function Ci(e,t){return e?.enabled===t.enabled&&e.window_secs===t.window_secs?e:t}function wi(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.id===r.id&&e.name===r.name&&e.display_path===r.display_path})?e:t}var Ti=`The viewer was updated on the server.`,Ei=null,Di=null,Oi=null;function ki(e,t){return e===null||t===null?!1:e!==t}function Ai(e){Ei=e}function ji(e){ki(Ei,e)?Di!==e&&(Di=e,Oi=T.info(Ti,{sticky:!0,action:{label:`Reload`,run:()=>window.location.reload()}})):e===Ei&&Di!==null&&(Oi!==null&&se(Oi),Di=null,Oi=null)}var Mi=3e3;function Ni({authed:e,setAuthed:t,handle:n,adoptAccent:r,adoptUpperPct:i,adoptMaximized:a,adoptViews:o,upperDraggingRef:s,accentWrites:c,upperPctWrites:l,maximizedWrites:u,viewWrites:d,resumeTick:f,orderWrites:p,repoDraggingRef:m,reorderInFlightRef:h,pendingReorderRef:g}){let[_,v]=(0,j.useState)([]),[y,b]=(0,j.useState)(null),[x,S]=(0,j.useState)(null),[C,w]=(0,j.useState)(null),[T,E]=(0,j.useState)(!1),[ee,te]=(0,j.useState)(!0),{current:ne}=(0,j.useRef)(Si(A.setActiveRepo)),re=(0,j.useRef)(null),ie=(0,j.useRef)(null);return(0,j.useEffect)(()=>{if(e===!1)return;let f=!1,_,y=new AbortController,x=()=>{let e=c.current,C=l.current,T=u.current,ee=d.current,ne=p.current;return A.repos(y.signal).then(n=>{let{repos:y,hot:ae,accent:oe,upper_pct:se,active_repo:ce,maximized:le,last_view:ue,now_ms:de,can_clone:fe,viewer_build:pe}=n;if(f)return;ji(pe),S(e=>Ci(e,ae)),te(fe),w(e=>rn(e,de,Date.now())),c.current===e&&r(oe),l.current===C&&!s.current&&i(se),u.current===T&&a(le),d.current===ee&&o(ue??{},y.map(e=>e.id)),t(!0),E(!0);let me=h.current||g.current!==null;p.current===ne&&!m.current&&!me?v(e=>wi(e,y)):v(e=>{let t=ye(y.map(e=>e.id),e.map(e=>e.id)),n=new Map(y.map(e=>[e.id,e]));return wi(e,t.map(e=>n.get(e)).filter(Boolean))});let he=y.map(e=>e.id),ge=ce!==re.current;re.current=ce??null,ge&&ce&&he.includes(ce)&&(ie.current=ce),b(e=>xi(e,he,ce,ge)),f||(_=setTimeout(x,Mi))}).catch(e=>{f||(Ne(e)?(t(!1),E(!1)):(je(e)||n(e),_=setTimeout(x,Mi)))})};return x(),()=>{f=!0,y.abort(),_&&clearTimeout(_)}},[e,t,n,r,i,f,c,l,u,d,s,a,o,p,m,h,g]),(0,j.useEffect)(()=>{y?y!==ie.current&&(ie.current=null,ne(y)):ie.current=null},[y,ne]),{repos:_,setRepos:v,repo:y,setRepo:b,hot:x,clockSkewMs:C,reposLoaded:T,canClone:ee}}var Pi=4;function Fi({ids:e,onReorder:t,draggingRef:n}){let r=(0,j.useRef)(null),i=(0,j.useRef)(null),a=(0,j.useRef)(null),[o,s]=(0,j.useState)(null),[c,l]=(0,j.useState)(null);return{dragging:o,target:c,onStart:(t,a)=>{t.target.closest(`button[data-tab-close]`)||t.button!==0||e.length<2||(r.current=a,i.current={x:t.clientX,y:t.clientY},n.current=!1)},onMove:e=>{let t=r.current,o=i.current;if(t===null||o===null)return;if(!n.current&&e.buttons===0){r.current=null,i.current=null;return}if(!n.current&&Math.hypot(e.clientX-o.x,e.clientY-o.y){let o=r.current,c=a.current;o!==null&&n.current&&c!==null&&t(te(e,o,c)),r.current=null,i.current=null,a.current=null,n.current=!1,s(null),l(null)}}}function Ii({repos:e,setRepos:t,handle:n,writesRef:r,draggingRef:i,inFlightRef:a,pendingRef:o}){let s=(0,j.useCallback)(()=>{if(a.current||o.current===null)return;let e=o.current;o.current=null,a.current=!0;let i=r.current;A.reorderRepos(e).then(e=>{r.current===i&&t(e)}).catch(n).finally(()=>{a.current=!1,s()})},[n,t,a,o,r]),c=(0,j.useCallback)(e=>{r.current+=1,t(t=>{let n=ye(t.map(e=>e.id),e),r=new Map(t.map(e=>[e.id,e]));return n.map(e=>r.get(e)).filter(Boolean)}),o.current=e,s()},[s,t,o,r]);return{...Fi({ids:e.map(e=>e.id),onReorder:c,draggingRef:i}),writesRef:r,draggingRef:i,inFlightRef:a,pendingRef:o}}function Li({authed:e,setAuthed:t,handle:n,resumeTick:r,adoptAccent:i,adoptUpperPct:a,adoptMaximized:o,adoptViews:s,accentWrites:c,upperPctWrites:l,maximizedWrites:u,viewWrites:d,upperDraggingRef:f}){let p=(0,j.useRef)(0),m=(0,j.useRef)(!1),h=(0,j.useRef)(!1),g=(0,j.useRef)(null),_=Ni({authed:e,setAuthed:t,handle:n,adoptAccent:i,adoptUpperPct:a,adoptMaximized:o,adoptViews:s,upperDraggingRef:f,accentWrites:c,upperPctWrites:l,maximizedWrites:u,viewWrites:d,resumeTick:r,orderWrites:p,repoDraggingRef:m,reorderInFlightRef:h,pendingReorderRef:g}),{dragging:v,target:y,onStart:b,onMove:x,onEnd:S}=Ii({repos:_.repos,setRepos:_.setRepos,handle:n,writesRef:p,draggingRef:m,inFlightRef:h,pendingRef:g});return{..._,orderWrites:p,draggingRepo:v,dragOverRepo:y,onRepoDragStart:b,onRepoDragMove:x,onRepoDragEnd:S}}function Ri(){let[e,t]=(0,j.useState)(!1),n=(0,j.useRef)(!1);return{reload:(0,j.useCallback)(async()=>{if(!n.current){n.current=!0,t(!0);try{T.success(await A.reloadConfig())}catch(e){T.error(e instanceof Error?e.message:`could not reload the config`)}finally{n.current=!1,t(!1)}}},[]),pending:e}}function zi(e,t){let n=e.indexOf(t);return n===-1?e[0]??null:e[n+1]??e[n-1]??null}function Bi({repo:e,repos:t,setRepos:n,setRepo:r,setPane:i,setTab:a,setPickerOpen:o,handle:s,orderWrites:c}){let l=(0,j.useRef)(t);l.current=t;let u=(0,j.useRef)(e);return u.current=e,{selectOpenedRepo:(0,j.useCallback)(e=>{c.current+=1,n(t=>t.some(t=>t.id===e.id)?t:[...t,e]),r(e.id),e.id!==u.current&&(i({kind:`empty`}),a(`status`)),o(!1)},[n,r,i,a,o,c]),closeRepo:(0,j.useCallback)(async e=>{try{await A.close(e),c.current+=1;let t=zi(l.current.map(e=>e.id),e);n(t=>t.filter(t=>t.id!==e)),r(n=>n===e?t:n)}catch(e){s(e)}},[n,r,s,c])}}function Vi(e,t,n){return t!==e&&(n.bumpPaneRequest(),e===`log`&&n.leaveLog(),n.recordTab(t),n.forgetPane(),!0)}function Hi(e,t,n,r,i){(0,j.useLayoutEffect)(()=>{t&&(e.some(e=>e.oid===t.commit.oid)||(r(),n(null),i()))},[e,t,n,r,i])}var Ui=5e3,Wi={refs:{},ahead:[],behind:[],truncated:!1};function Gi({repo:e,authed:t,tab:n,head:r,branch:i,refs:a,upstream:o}){let[s,c]=(0,j.useState)({key:``,value:Wi}),[l,u]=(0,j.useState)(0),d=e&&r!==void 0?`${e}|${r??``}|${i??``}|${a??``}|${o??``}`:``,f=(0,j.useRef)(s.key);f.current=s.key,(0,j.useEffect)(()=>{if(!e||!t||n!==`log`||d===``||f.current===d)return;let r=new AbortController,i;return A.logDecorations(e,r.signal).then(e=>c({key:d,value:e})).catch(()=>{r.signal.aborted||(i=setTimeout(()=>u(e=>e+1),Ui))}),()=>{r.abort(),i&&clearTimeout(i)}},[e,t,n,d,l]);let p=s.key.startsWith(`${e}|`)?s.value:Wi;return(0,j.useMemo)(()=>{let e=new Set(p.ahead),t=new Set(p.behind);return{refsOf:e=>p.refs[e],divergenceOf:n=>e.has(n)?`ahead`:t.has(n)?`behind`:void 0,truncated:p.truncated}},[p])}function Ki(e,t,n){let r=!e.truncated||e.head===void 0,i=t[0]?.oid,a=i===void 0?-1:e.commits.findIndex(e=>e.oid===i),o=a<0?[]:e.commits.slice(a);return a>=0&&o.length<=t.length&&o.every((e,n)=>e.oid===t[n].oid)?{commits:a===0?t:[...e.commits.slice(0,a),...t],anchor:e.head??null,done:n||r,mode:`prepend`}:{commits:e.commits,anchor:e.head??null,done:r,mode:`replace`}}function qi({repo:e,authed:t,tab:n,filter:r,head:i,handle:a}){let o=(0,j.useRef)([]),[,s]=(0,j.useState)(0),c=(0,j.useCallback)(()=>s(e=>e+1),[]),l=o.current,[u,d]=(0,j.useState)(!1),[f,p]=(0,j.useState)(!1),m=(0,j.useRef)(null),h=(0,j.useRef)(!1),g=(0,j.useRef)(!1),_=(0,j.useRef)(0),v=(0,j.useRef)(void 0),y=(0,j.useRef)(void 0),b=(0,j.useCallback)(()=>{_.current+=1,h.current=!1,g.current=!1,o.current=[],c(),m.current=null,d(!1),p(!1),v.current=void 0,y.current=void 0},[c]),[x,S]=(0,j.useState)(null),C=(0,j.useRef)(u);C.current=u;let w=(0,j.useRef)(i);w.current=i;let T=(0,j.useCallback)(async t=>{if(!e)return;y.current=w.current,_.current+=1;let n=_.current;h.current=!0,g.current=!0;try{let r=await A.log(e);if(n!==_.current)return;let i=t??{commits:o.current,done:C.current},a=Ki(r,i.commits,i.done);o.current=a.commits,c(),m.current=a.anchor,v.current=a.anchor,a.anchor===w.current&&(y.current=void 0),d(a.done),p(!1)}catch(e){n===_.current&&(y.current=void 0,a(e),p(!0))}finally{n===_.current&&(h.current=!1,g.current=!1)}},[e,a,c]),E=(0,j.useCallback)(async()=>{if(!e||h.current)return;h.current=!0;let t=_.current;try{let n=m.current,r=await A.log(e,n===null?void 0:{from:n,skip:o.current.length});if(t!==_.current)return;if(o.current.push(...r.commits),c(),m.current=r.head??null,d(!r.truncated||r.head===void 0),n===null){v.current=r.head??null;let e=w.current;e!==void 0&&e!==(r.head??null)&&T({commits:r.commits,done:!r.truncated||r.head===void 0})}}catch(e){t===_.current&&(a(e),p(!0))}finally{t===_.current&&(h.current=!1)}},[e,a,T,c]);(0,j.useEffect)(()=>{e&&t&&n===`log`&&l.length===0&&!u&&!f&&E()},[e,t,n,l.length,u,f,E]),(0,j.useEffect)(()=>{if(!e||!t||n!==`log`||i===void 0||f)return;let r=v.current;r!==void 0&&(r===i?g.current||(y.current=void 0):y.current!==i&&T())},[e,t,n,i,f,T]);let ee=r.toLowerCase(),te=ee===``?l:l.filter(e=>e.summary.toLowerCase().includes(ee)),ne=r!==``,re=(0,j.useRef)(null);return(0,j.useEffect)(()=>{let e=re.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&E()},{root:e.closest(`ul`),rootMargin:`400px`});return t.observe(e),()=>t.disconnect()},[E,u,f,ne,x,n,te.length]),{commits:l,logDone:u,logStalled:f,setLogStalled:p,commitDrillDown:x,setCommitDrillDown:S,resetLog:b,logSentinelRef:re,visibleCommits:te,logPagingPaused:ne}}function Ji(e,t){return[t??``,e.index,e.worktree,e.mtime??``,e.old_path??``].join(`\0`)}function Yi({repo:e,authed:t,resumeTick:n,tab:r,pane:i,setPane:a,handle:o,paneRequestRef:s}){let[c,l]=(0,j.useState)(null),u=(0,j.useRef)(i);u.current=i;let d=(0,j.useRef)(r);d.current=r;let f=(0,j.useRef)(null),p=(0,j.useRef)(null);return(0,j.useLayoutEffect)(()=>{l(null),p.current=null},[e,t]),(0,j.useEffect)(()=>{if(e&&t)return Ae(e,l,({reason:e})=>l({files:[],truncated:!1,unavailable:e}))},[e,t,n]),(0,j.useEffect)(()=>{if(!e||!c)return;let t=p.current;p.current=new Map(c.files.map(e=>[e.path,Ji(e,c.head)]));let n=u.current;if(d.current!==`status`||n.kind!==`diff`){f.current=null;return}let r=n.value.path,i=c.files.find(e=>e.path===r);if(!i){f.current=null,a({kind:`empty`});return}let l=Ji(i,c.head),m=f.current;if(m?.path===r&&m.key===l)return;if(m?.path!==r&&t?.get(r)===l){f.current={path:r,key:l};return}let h=s.current,g=!0,_=()=>{let e=u.current;return g&&h===s.current&&e.kind===`diff`&&e.value.path===r};return A.diff(e,r).then(e=>{_()&&(f.current={path:r,key:l},a({kind:`diff`,value:e,source:In(i)&&Ln(e)?{kind:`workdir`,path:r}:void 0}))}).catch(e=>{_()&&o(e)}),()=>{g=!1}},[c,e,o,u,d,s,a]),{status:c,paneRef:u,tabRef:d}}function Xi({repo:e,authed:t,hot:n,clockSkewMs:r,resumeTick:i,handle:a}){let[o,s]=(0,j.useState)(`status`),[c,l]=(0,j.useState)(``),[u,d]=(0,j.useState)(!1),[f,p]=(0,j.useState)({kind:`empty`}),[m,h]=(0,j.useState)(e);m!==e&&(h(e),p({kind:`empty`}),s(`status`));let g=(0,j.useRef)(0),_=(0,j.useCallback)(()=>{g.current+=1},[]),v=(0,j.useCallback)(()=>p({kind:`empty`}),[]),{status:y}=Yi({repo:e,authed:t,resumeTick:i,tab:o,pane:f,setPane:p,handle:a,paneRequestRef:g}),b=n?.enabled?n.window_secs*1e3:0,x=qi({repo:e,authed:t,tab:o,filter:c,head:y?y.head??null:void 0,handle:a}),S=Gi({repo:e,authed:t,tab:o,head:y?y.head??null:void 0,branch:y?.branch,refs:y?.refs,upstream:y?.tracking?.upstream}),C=x.setCommitDrillDown,w=x.resetLog;(0,j.useLayoutEffect)(()=>{_(),C(null),w()},[e,_,C,w]);let T=c.toLowerCase(),E=(0,j.useMemo)(()=>(y?.files??[]).filter(e=>e.path.toLowerCase().includes(T)),[y?.files,T]),ee=(0,j.useMemo)(()=>(x.commitDrillDown?.files??[]).filter(e=>e.path.toLowerCase().includes(T)||e.old_path?.toLowerCase().includes(T)),[x.commitDrillDown?.files,T]);return{screen:{tab:o,setTab:s,filter:c,setFilter:l,filterOpen:u,setFilterOpen:d,pane:f,setPane:p},request:{paneRequestRef:g,bumpPaneRequest:_,clearPane:v},status:{value:y,files:E,hotWindowMs:b,clockSkewMs:r??0},log:{...x,decorations:S,visibleCommitFiles:ee}}}var Zi=`nightcrow.mobileView`;function Qi(e){return e===`diff`||e===`terminal`||e===`files`?e:`files`}function $i(){return Qi(m(Zi))}function ea(){let[e,t]=(0,j.useState)($i);return{mobileView:e,setMobileView:(0,j.useCallback)(e=>{h(Zi,e),t(e)},[])}}function ta({repo:e,handle:t,setPane:n,paneRequestRef:r,setCommitDrillDown:i,setMobileView:a,setPreviewRendered:o,statusRef:s,track:c}){let l=(0,j.useCallback)(e=>{let t=s.current?.files.find(t=>t.path===e);return t?In(t):!1},[s]);return{openDiff:(0,j.useCallback)((i,o)=>{if(!e)return;o?.restoring||a(`diff`);let s=r.current+=1;c(s,A.diff(e,i)).then(e=>{s===r.current&&n({kind:`diff`,value:e,source:l(i)&&Ln(e)?{kind:`workdir`,path:i}:void 0})}).catch(e=>{if(s!==r.current)return Ne(e)?t(e):void 0;if(!o?.restoring)return t(e);Ne(e)&&t(e),n({kind:`empty`})})},[e,t,n,r,a,l,c]),openFile:(0,j.useCallback)((i,s)=>{if(!e)return;s?.restoring||a(`diff`),o(!0);let l=r.current+=1;c(l,A.file(e,i)).then(e=>{l===r.current&&n({kind:`file`,value:e})}).catch(e=>{if(l!==r.current)return Ne(e)?t(e):void 0;if(!s?.restoring)return t(e);Ne(e)&&t(e),n({kind:`empty`})})},[e,t,n,r,a,o,c]),openCommit:(0,j.useCallback)(i=>{if(!e)return;a(`diff`);let o=r.current+=1;c(o,A.commit(e,i)).then(e=>{o===r.current&&n({kind:`diff`,value:e})}).catch(e=>{o===r.current&&t(e)})},[e,t,n,r,a,c]),openCommitFileDiff:(0,j.useCallback)((i,o,s)=>{if(!e)return;s?.restoring||a(`diff`);let l=r.current+=1;c(l,A.commitFileDiff(e,i,o)).then(e=>{l===r.current&&n({kind:`diff`,value:e,source:Ln(e)?{kind:`commit`,oid:i,path:o}:void 0})}).catch(e=>{if(l!==r.current)return Ne(e)?t(e):void 0;if(!s?.restoring)return t(e);Ne(e)&&t(e),n({kind:`empty`})})},[e,t,n,r,a,c]),openCommitFiles:(0,j.useCallback)(async o=>{if(!e)return;a(`diff`);let s=r.current+=1;try{let t=await c(s,A.commitFiles(e,o.oid));if(s!==r.current)return;if(i({commit:o,...t}),t.files.length===0){n({kind:`empty`});return}let a=await c(s,A.commit(e,o.oid));s===r.current&&n({kind:`diff`,value:a})}catch(e){s===r.current&&t(e)}},[e,t,n,r,i,a,c]),showOtherFace:(0,j.useCallback)((i,a=0)=>{let s=Fn(i);if(!e||!s)return;let{source:u}=s,d=s.want===`file`,f=d&&i.kind===`diff`?jn(i.value,a):null,p=r.current+=1,m=u.kind===`workdir`?d?A.file(e,u.path):A.diff(e,u.path):d?A.commitFile(e,u.oid,u.path):A.commitFileDiff(e,u.oid,u.path);d&&o(!1),c(p,m).then(e=>{p===r.current&&n(d?{kind:`file`,value:e,source:u,anchor:f===null?void 0:Mn(f)+1}:{kind:`diff`,value:e,source:Ln(e)&&(u.kind!==`workdir`||l(u.path))?u:void 0})}).catch(e=>{p===r.current&&t(e)})},[e,t,n,r,o,l,c])}}function na(){let[e,t]=(0,j.useState)(null),n=(0,j.useCallback)((e,n)=>{t(e);let r=()=>t(t=>t===e?null:t);return n.then(r,r),n},[]);return{loading:e!==null,track:n}}function ra({repo:e,handle:t,pane:n,setPane:r,paneRequestRef:i,setCommitDrillDown:a,status:o}){let{mobileView:s,setMobileView:c}=ea(),[l,u]=(0,j.useState)(!0),{loading:d,track:f}=na(),p=(0,j.useRef)(o);p.current=o;let{openDiff:m,openFile:h,openCommit:g,openCommitFileDiff:_,openCommitFiles:v,showOtherFace:y}=ta({repo:e,handle:t,setPane:r,paneRequestRef:i,setCommitDrillDown:a,setMobileView:c,setPreviewRendered:u,statusRef:p,track:f}),b=(0,j.useMemo)(()=>({openDiff:m,openFile:h,openCommit:g,openCommitFileDiff:_,openCommitFiles:v,showOtherFace:y}),[m,h,g,_,v,y]);return(0,j.useMemo)(()=>({openers:b,pane:n,setPane:r,paneLoading:d,previewRendered:l,setPreviewRendered:u,mobileView:s,setMobileView:c}),[b,n,r,d,l,s,c])}var ia=[`status`,`log`,`tree`];function aa(){return{tab:`status`,file:null,tree_expanded:[]}}function oa(e,t){return{path:e,commit:null,face:t}}function sa(e,t,n){return{path:t,commit:e,face:n}}function ca(e){return[...e].sort().slice(0,200)}function F(e){let t=e?.file;return!t||!t.path?{kind:`none`}:t.commit?{kind:`commitDiff`,oid:t.commit,path:t.path}:t.face===`source`?{kind:`file`,path:t.path}:{kind:`diff`,path:t.path}}function I(e){let t=e?.tab;return t&&ia.includes(t)?t:`status`}function la(e,t){return e?e.tab===t.tab&&e.tree_expanded.length===t.tree_expanded.length&&e.tree_expanded.every((e,n)=>e===t.tree_expanded[n])&&ua(e.file,t.file):!1}function ua(e,t){return!e||!t?e===t:e.path===t.path&&e.commit===t.commit&&e.face===t.face}function da({repo:e,known:t,remembered:n,latest:r,remember:i,setTab:a,openDiff:o,openFile:s,openCommitFileDiff:c}){let l=(0,j.useRef)(null),u=(0,j.useRef)(null),d=(0,j.useRef)(new Map),[f,p]=(0,j.useState)(!1),m=(0,j.useRef)(!1);(0,j.useEffect)(()=>{if(u.current!==e&&(u.current=e,l.current=null,m.current=!1,p(!1)),!e||!t||l.current===e)return;l.current=e;let r=d.current.get(e);d.current.delete(e);let f=r?{...n??aa(),...r}:n;if(r&&i(e,f),m.current)return;a(I(f));let h=F(f);if(h.kind===`none`)return;let g={restoring:!0};h.kind===`diff`?o(h.path,g):h.kind===`file`?s(h.path,g):c(h.oid,h.path,g)},[e,t,n,i,a,o,s,c]);let h=(0,j.useCallback)(t=>{if(e){if(m.current=!0,p(!0),l.current!==e){let n=d.current.get(e);d.current.set(e,{...n,...t})}else i(e,{...r(e)??aa(),...t})}},[e,r,i]);return{touched:f,noteTab:(0,j.useCallback)(e=>h({tab:e}),[h]),noteFile:(0,j.useCallback)(e=>h({file:e}),[h]),noteTree:(0,j.useCallback)(e=>h({tree_expanded:ca(e)}),[h])}}function fa({repo:e,known:t,remembered:n,latest:r,remember:i,setTab:a,clearPane:o,openers:s}){let c=da({repo:e,known:t,remembered:n,latest:r,remember:i,setTab:a,openDiff:s.openDiff,openFile:s.openFile,openCommitFileDiff:s.openCommitFileDiff}),{noteFile:l,noteTab:u,noteTree:d}=c,f=(0,j.useCallback)(e=>{u(e),a(e)},[u,a]),p=(0,j.useCallback)(()=>{l(null),o()},[l,o]),m=(0,j.useMemo)(()=>({openDiff:e=>{l(oa(e,`diff`)),s.openDiff(e)},openFile:e=>{l(oa(e,`source`)),s.openFile(e)},openCommit:e=>{l(null),s.openCommit(e)},openCommitFiles:e=>(l(null),s.openCommitFiles(e)),openCommitFileDiff:(e,t)=>{l(sa(e,t,`diff`)),s.openCommitFileDiff(e,t)}}),[s,l]),h=(0,j.useCallback)((e,t)=>{l(e.kind===`commit`?sa(e.oid,e.path,t):oa(e.path,t))},[l]);return{...c,noteTree:d,chooseTab:f,forgetPane:p,asked:m,noteOtherFace:h}}function pa({project:e,view:t,layout:n}){let{repo:r,repos:i,authed:a,hot:o,clockSkewMs:s,resumeTick:c,handle:l}=e,u=Xi({repo:r,authed:a,hot:o,clockSkewMs:s,resumeTick:c,handle:l}),d=ra({repo:r,handle:l,pane:u.screen.pane,setPane:u.screen.setPane,paneRequestRef:u.request.paneRequestRef,setCommitDrillDown:u.log.setCommitDrillDown,status:u.status.value}),f=fa({repo:r,known:t.known,remembered:t.remembered,latest:t.latest,remember:t.remember,setTab:u.screen.setTab,clearPane:u.request.clearPane,openers:d.openers}),p=u.screen.tab,{bumpPaneRequest:m}=u.request,{setCommitDrillDown:h,resetLog:g}=u.log,{chooseTab:_,forgetPane:v}=f,y=(0,j.useCallback)(e=>void Vi(p,e,{bumpPaneRequest:m,leaveLog:()=>{h(null),g()},recordTab:_,forgetPane:v}),[p,m,h,g,_,v]);Hi(u.log.commits,u.log.commitDrillDown,u.log.setCommitDrillDown,u.request.bumpPaneRequest,f.forgetPane);let b=n.maximizedPanelOf(r),x=n.setMaximizedFor,S=(0,j.useCallback)(e=>x(r,e),[r,x]),C=d.pane,w=d.openers.showOtherFace,T=f.noteOtherFace,E=(0,j.useCallback)(e=>{let t=Fn(C);t&&T(t.source,t.want===`file`?`source`:`diff`),w(C,e)},[C,T,w]);return{setPane:d.setPane,setTab:u.screen.setTab,clearPane:u.request.clearPane,maximized:b,tab:p,chooseTab:y,setMaximized:S,repoShell:r?{repository:{id:r,current:i.find(e=>e.id===r),status:u.status.value},sidebar:{tab:u.screen.tab,filter:u.screen.filter,setFilter:u.screen.setFilter,filterOpen:u.screen.filterOpen,setFilterOpen:u.screen.setFilterOpen,files:u.status.files,hotWindowMs:u.status.hotWindowMs,clockSkewMs:u.status.clockSkewMs,...d.openers,...f.asked,chooseTab:y,authed:a,handle:l,bumpPaneRequest:u.request.bumpPaneRequest,...u.log,restoreTree:t.remembered?.tree_expanded??[],restoreKnown:t.known,onTreeExpanded:f.noteTree,clearPane:f.forgetPane,touched:f.touched},filePane:{repo:r,pane:d.pane,loading:d.paneLoading,previewRendered:d.previewRendered,setPreviewRendered:d.setPreviewRendered,showOtherFace:E},layout:{...n.shell,maximized:b,setMaximized:S,mobileView:d.mobileView,setMobileView:d.setMobileView}}:null}}function ma(){let[e,t]=(0,j.useState)(0);return(0,j.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&t(e=>e+1)};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`online`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`online`,e)}},[]),e}var ha=[{name:`yellow`,color:`#d9a441`},{name:`cyan`,color:`#03c4db`},{name:`green`,color:`#77c47a`},{name:`magenta`,color:`#dc8fd5`},{name:`blue`,color:`#87acfd`}],ga=`nightcrow.viewer.accent`;function _a(e){if(!Number.isFinite(e))return 0;let t=ha.length;return(Math.trunc(e)%t+t)%t}function va(){let e=m(ga);return e===null?0:_a(Number(e))}function ya(e){h(ga,String(e))}function ba(){let[e,t]=(0,j.useState)(va);(0,j.useLayoutEffect)(()=>{document.documentElement.style.setProperty(`--color-accent`,ha[e].color)},[e]);let n=(0,j.useCallback)(()=>{t(e=>{let t=_a(e+1);return ya(t),A.setAccent(t).catch(()=>{}),t})},[]),r=(0,j.useCallback)(e=>{t(t=>{let n=_a(e);return n===t?t:(ya(n),n)})},[]);return{accent:ha[e],next:ha[_a(e+1)],cycle:n,adopt:r}}function xa(e){return Number.isFinite(e)?Math.min(Math.max(e,20),85):55}function Sa(e){return Math.round(xa(e))}function Ca(e,t,n,r){let i=n-t;return xa(i<=0?r:(e-t)/i*100)}var wa=`nightcrow.upperPct`;function Ta(){try{let e=Number(localStorage.getItem(wa));return Number.isFinite(e)&&e>0?Sa(e):55}catch{return 55}}function Ea(e){try{localStorage.setItem(wa,String(e))}catch{}}function Da(){let[e,t]=(0,j.useState)(Ta);return{pct:e,resize:(0,j.useCallback)(e=>{t(xa(e))},[]),commit:(0,j.useCallback)(e=>{let n=Sa(e);t(n),Ea(n),A.setUpperPct(n).catch(()=>{})},[]),reset:(0,j.useCallback)(()=>{t(55),Ea(55),A.setUpperPct(55).catch(()=>{})},[]),adopt:(0,j.useCallback)(e=>{t(t=>{let n=Sa(e);return n===t?t:(Ea(n),n)})},[])}}function Oa(){let[e,t]=(0,j.useState)({}),n=(0,j.useRef)(e),r=(0,j.useCallback)(e=>{n.current=e,t(e)},[]),i=(0,j.useRef)(0),a=(0,j.useRef)(new Map),o=(0,j.useCallback)(e=>{let t=a.current.get(e);if(t)return t;let n=Si(t=>A.setMaximized(e,t===`none`?null:t));return a.current.set(e,n),n},[]),s=(0,j.useCallback)((e,t)=>{if(e==null)return;let a=n.current,s=typeof t==`function`?t(a[e]??`none`):t;i.current+=1,o(e)(s);let{[e]:c,...l}=a;r(s===`none`?l:{...a,[e]:s})},[o,r]);return{panelOf:(0,j.useCallback)(t=>t!=null&&e[t]||`none`,[e]),setFor:s,adopt:(0,j.useCallback)(e=>{ka(n.current,e)||r(e)},[r]),writes:i}}function ka(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])}function Aa(){let[e,t]=(0,j.useState)({}),n=(0,j.useRef)(e),r=(0,j.useCallback)(e=>{n.current=e,t(e)},[]),i=(0,j.useRef)(0),a=(0,j.useRef)(new Map),o=(0,j.useCallback)(e=>{let t=a.current.get(e);if(t)return t;let n=Si(t=>A.setRepoView(e,t));return a.current.set(e,n),n},[]),s=(0,j.useCallback)((e,t)=>{e!=null&&(la(n.current[e],t)||(i.current+=1,o(e)(t),r({...n.current,[e]:t})))},[o,r]),c=(0,j.useCallback)(t=>t==null?void 0:e[t],[e]),l=(0,j.useCallback)(e=>n.current[e],[]),u=(0,j.useRef)(new Set),[d,f]=(0,j.useState)(0);return{viewOf:c,rememberedFor:l,remember:s,adopt:(0,j.useCallback)((e,t)=>{let i=u.current;(i.size!==t.length||t.some(e=>!i.has(e)))&&(u.current=new Set(t),f(e=>e+1)),!ja(n.current,e)&&r(e)},[r]),covers:(0,j.useCallback)(e=>e!=null&&u.current.has(e),[d]),writes:i}}function ja(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>t[n]!==void 0&&la(e[n],t[n]))}function Ma(){let{accent:e,next:t,cycle:n,adopt:r}=ba(),{width:i,resize:a,commit:o,reset:s}=Et(),{pct:c,resize:l,commit:u,reset:d,adopt:f}=Da(),p=Oa(),m=Aa(),h=(0,j.useRef)(0),g=(0,j.useRef)(0);return{accent:e,next:t,cycle:(0,j.useCallback)(()=>{h.current+=1,n()},[n]),adoptAccent:r,accentWrites:h,sidebarWidth:i,resizeSidebar:a,commitSidebarWidth:o,resetSidebarWidth:s,upperPct:c,resizeUpperPct:l,commitUpperPct:(0,j.useCallback)(e=>{g.current+=1,u(e)},[u]),resetUpperPct:(0,j.useCallback)(()=>{g.current+=1,d()},[d]),bumpUpperPctWrites:(0,j.useCallback)(()=>{g.current+=1},[]),adoptUpperPct:f,upperPctWrites:g,maximizedPanelOf:p.panelOf,setMaximizedFor:p.setFor,adoptMaximized:p.adopt,maximizedWrites:p.writes,viewOf:m.viewOf,rememberedViewFor:m.rememberedFor,rememberView:m.remember,adoptViews:m.adopt,viewCovers:m.covers,viewWrites:m.writes}}var Na=400;function Pa({value:e,valueAt:t,onGestureStart:n,resize:r,commit:i,reset:a,axis:o}){let s=(0,j.useRef)(0),c=(0,j.useRef)(0),l=(0,j.useRef)(!1),u=(0,j.useRef)(!1),d=(0,j.useRef)(0),[f,p]=(0,j.useState)(!1);return{dragging:f,onDragStart:(0,j.useCallback)(t=>{t.button===0&&t.isPrimary&&n()&&(s.current=o===`x`?t.clientX:t.clientY,c.current=e,l.current=!0,u.current=!1,p(!0),t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault())},[e,n,o]),onDragMove:(0,j.useCallback)(e=>{if(!l.current)return;let n=o===`x`?e.clientX:e.clientY;if(!u.current&&Math.abs(n-s.current)<3)return;let i=t(e);i!==null&&(u.current=!0,c.current=i,r(i))},[t,r,o]),onDragEnd:(0,j.useCallback)(()=>{if(!l.current)return;if(l.current=!1,p(!1),u.current){i(c.current),d.current=0;return}let e=Date.now();e-d.current{l.current=!1,u.current=!1,d.current=0,p(!1)},[]),draggingRef:l}}function L({sidebarRef:e,sidebarWidth:t,resizeSidebar:n,commitSidebarWidth:r,resetSidebarWidth:i}){let a=(0,j.useRef)(0),o=(0,j.useCallback)(()=>{let t=e.current?.getBoundingClientRect().left;return t!==void 0&&(a.current=t,!0)},[e]),{dragging:s,onDragStart:c,onDragMove:l,onDragEnd:u,onDragCancel:d}=Pa({value:t,valueAt:(0,j.useCallback)(e=>e.clientX-a.current,[]),onGestureStart:o,resize:n,commit:r,reset:i,axis:`x`});return{draggingSidebar:s,onSidebarDragStart:c,onSidebarDragMove:l,onSidebarDragEnd:u,onSidebarDragCancel:d}}function Fa({upperRef:e,lowerRef:t,upperPct:n,resizeUpperPct:r,commitUpperPct:i,resetUpperPct:a,bumpUpperPctWrites:o}){let s=(0,j.useRef)(0),c=(0,j.useRef)(0),l=(0,j.useCallback)(()=>{let n=e.current?.getBoundingClientRect().top,r=t.current?.getBoundingClientRect().bottom;return n===void 0||r===void 0?!1:(s.current=n,c.current=r,o(),!0)},[e,t,o]),{dragging:u,onDragStart:d,onDragMove:f,onDragEnd:p,onDragCancel:m,draggingRef:h}=Pa({value:n,valueAt:(0,j.useCallback)(e=>Ca(e.clientY,s.current,c.current,n),[n]),onGestureStart:l,resize:r,commit:i,reset:a,axis:`y`});return{draggingUpper:u,onUpperDragStart:d,onUpperDragMove:f,onUpperDragEnd:p,onUpperDragCancel:m,upperDraggingRef:h}}function Ia(){let{accent:e,next:t,cycle:n,adoptAccent:r,accentWrites:i,sidebarWidth:a,resizeSidebar:o,commitSidebarWidth:s,resetSidebarWidth:c,upperPct:l,resizeUpperPct:u,commitUpperPct:d,resetUpperPct:f,bumpUpperPctWrites:p,adoptUpperPct:m,upperPctWrites:h,maximizedPanelOf:g,setMaximizedFor:_,adoptMaximized:v,maximizedWrites:y,viewOf:b,rememberedViewFor:x,rememberView:S,adoptViews:C,viewCovers:w,viewWrites:T}=Ma(),E=(0,j.useRef)(null),ee=(0,j.useRef)(null),te=(0,j.useRef)(null),ne=L({sidebarRef:E,sidebarWidth:a,resizeSidebar:o,commitSidebarWidth:s,resetSidebarWidth:c}),re=Fa({upperRef:ee,lowerRef:te,upperPct:l,resizeUpperPct:u,commitUpperPct:d,resetUpperPct:f,bumpUpperPctWrites:p});return{accent:e,next:t,cycle:n,upperPct:l,maximizedPanelOf:g,setMaximizedFor:_,viewOf:b,rememberedViewFor:x,rememberView:S,viewCovers:w,shell:{sidebarWidth:a,sidebarRef:E,upperRef:ee,lowerRef:te,draggingSidebar:ne.draggingSidebar,onSidebarDragStart:ne.onSidebarDragStart,onSidebarDragMove:ne.onSidebarDragMove,onSidebarDragEnd:ne.onSidebarDragEnd,onSidebarDragCancel:ne.onSidebarDragCancel,draggingUpper:re.draggingUpper,onUpperDragStart:re.onUpperDragStart,onUpperDragMove:re.onUpperDragMove,onUpperDragEnd:re.onUpperDragEnd,onUpperDragCancel:re.onUpperDragCancel},guards:{adoptAccent:r,adoptUpperPct:m,adoptMaximized:v,adoptViews:C,accentWrites:i,upperPctWrites:h,maximizedWrites:y,viewWrites:T,upperDraggingRef:re.upperDraggingRef}}}var La=`nightcrow.tabStripSide`;function Ra(){return ft(m(La))??`top`}function za(e){h(La,e)}function Ba(){let[e,t]=(0,j.useState)(Ra);return{side:e,toggle:(0,j.useCallback)(()=>{t(e=>{let t=pt(e);return za(t),t})},[])}}function Va(){let[e,t]=(0,j.useState)(null),[n,r]=(0,j.useState)(!1),[i,a]=(0,j.useState)(null),o=(0,j.useCallback)(e=>{Ne(e)?t(!1):T.error(e instanceof Error?e.message:`request failed`)},[]),s=ma(),c=Ia(),l=Ba(),u=Li({authed:e,setAuthed:t,handle:o,resumeTick:s,...c.guards}),d=pa({project:{repo:u.repo,repos:u.repos,authed:e,hot:u.hot,clockSkewMs:u.clockSkewMs,resumeTick:s,handle:o},view:{known:c.viewCovers(u.repo),remembered:c.viewOf(u.repo),latest:c.rememberedViewFor,remember:c.rememberView},layout:{shell:c.shell,maximizedPanelOf:c.maximizedPanelOf,setMaximizedFor:c.setMaximizedFor}}),{selectOpenedRepo:f,closeRepo:p}=Bi({repo:u.repo,repos:u.repos,setRepos:u.setRepos,setRepo:u.setRepo,setPane:d.setPane,setTab:d.setTab,setPickerOpen:r,handle:o,orderWrites:u.orderWrites}),{busy:m,start:h}=bi(f,e===!0),g=u.repo,_=u.setRepo,v=d.clearPane,y=(0,j.useCallback)(e=>{e!==g&&(_(e),v())},[g,_,v]),b=u.repos.find(e=>e.id===i),x=(0,j.useCallback)(()=>a(null),[]),S=(0,j.useCallback)(()=>r(!0),[]),C=(0,j.useCallback)(()=>r(!1),[]),w=Ri(),E=gi({enabled:e===!0,repo:u.repo,repos:u.repos,selectRepo:y,closeRepo:p,openPicker:S,pickerOpen:n,cycleAccent:c.cycle,reloadConfig:w.reload,tab:d.tab,chooseTab:d.chooseTab,maximized:d.maximized,setMaximized:d.setMaximized,mobileView:d.repoShell?.layout.mobileView??`files`});return{authed:e,login:(0,j.useCallback)(()=>t(null),[]),reposLoaded:u.reposLoaded,rows:Br(u.repo,d.maximized),upperPct:c.upperPct,header:{repos:u.repos,repo:u.repo,onSelectRepo:y,onCloseRepo:a,onOpenPicker:S,cloning:m,accent:c.accent,next:c.next,cycle:c.cycle,draggingRepo:u.draggingRepo,dragOverRepo:u.dragOverRepo,onRepoDragStart:u.onRepoDragStart,onRepoDragMove:u.onRepoDragMove,onRepoDragEnd:u.onRepoDragEnd,onReloadConfig:w.reload,reloading:w.pending,tabStrip:l},tabStrip:l,shortcutHelp:E.shortcutHelp,leader:E.settings,hint:E.hint,repoShell:d.repoShell,closeConfirm:b?{label:b.name,detail:`Its terminals and the processes running in them will be terminated.`,onConfirm:()=>{a(null),p(b.id)},onCancel:x}:null,picker:n?{onClose:C,onOpened:f,canClone:u.canClone,cloning:m,onClone:h}:null}}function Ha(){let e=Va();return e.authed===null?(0,M.jsx)(vt,{}):e.authed?e.reposLoaded?(0,M.jsx)(g,{children:(0,M.jsx)(ae,{children:(0,M.jsx)(x,{leader:e.leader.leader,children:(0,M.jsxs)(`div`,{className:`nc-fade-in flex h-full flex-col`,children:[(0,M.jsx)(mt,{...e.header,onShowShortcuts:e.shortcutHelp.show}),(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[e.tabStrip.side===`left`&&(0,M.jsx)(`aside`,{className:`hidden w-48 shrink-0 flex-col border-r border-chrome-line bg-ink-950 md:flex`,children:(0,M.jsx)(qe,{side:`left`,...e.header})}),(0,M.jsxs)(`div`,{className:`grid min-h-0 min-w-0 flex-1 grid-cols-[minmax(0,1fr)] ${e.rows}`,style:{"--nc-upper":`${e.upperPct}fr`,"--nc-lower":`${100-e.upperPct}fr`},children:[e.repoShell?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(yr,{...e.repoShell}),(0,M.jsx)(Rr,{...e.hint})]}):(0,M.jsxs)(`div`,{className:`flex items-center justify-center p-6 text-center text-ink-400`,children:[(0,M.jsxs)(`span`,{className:`md:hidden`,children:[`No repository open. Tap`,` `,(0,M.jsx)(`span`,{className:`text-ink-200`,children:`No project`}),` above, then`,` `,(0,M.jsx)(`span`,{className:`text-ink-200`,children:`+ open`}),`, to add one.`]}),(0,M.jsxs)(`span`,{className:`hidden md:inline`,children:[`No repository open. Click`,` `,(0,M.jsx)(`span`,{className:`text-ink-200`,children:`+ open`}),` `,e.tabStrip.side===`left`?`beside`:`above`,` to add one.`]})]}),e.picker&&(0,M.jsx)(Re,{...e.picker}),e.closeConfirm&&(0,M.jsx)(Se,{...e.closeConfirm}),e.shortcutHelp.open&&(0,M.jsx)(Dr,{onClose:e.shortcutHelp.hide,leader:e.leader})]})]})]})})})}):(0,M.jsx)(vt,{}):(0,M.jsx)(yt,{onSuccess:e.login})}var Ua={error:7e3,info:5e3,success:5e3},Wa={error:`text-removed`,info:`text-accent`,success:`text-added`};function Ga(){let[e,t]=(0,j.useState)([]);return(0,j.useEffect)(()=>oe(t),[]),e.length===0?null:(0,M.jsx)(`div`,{className:`pointer-events-none fixed right-3 top-3 z-[60] flex w-80 max-w-[calc(100vw-1.5rem)] flex-col gap-2`,"aria-live":`polite`,children:e.map(e=>(0,M.jsx)(Ka,{toast:e},e.id))})}function Ka({toast:e}){let[t,n]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(t||e.sticky)return;let n=setTimeout(()=>se(e.id),Ua[e.kind]);return()=>clearTimeout(n)},[e.id,e.kind,e.bump,e.sticky,t]),(0,M.jsxs)(`div`,{role:e.kind===`error`?`alert`:`status`,className:`nc-slide-in pointer-events-auto flex items-start gap-2 rounded-md border border-ink-700 bg-ink-850 px-3 py-2 text-xs shadow-lg`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 break-words ${Wa[e.kind]}`,children:e.message}),e.action&&(0,M.jsx)(`button`,{type:`button`,onClick:e.action.run,className:`shrink-0 rounded-sm border border-ink-700 px-1.5 py-0.5 text-ink-200 hover:border-accent hover:text-accent`,children:e.action.label}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>se(e.id),"aria-label":`dismiss`,className:`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:bg-ink-700 hover:text-ink-200`,children:(0,M.jsx)(pe,{className:`h-3 w-3`})})]})}function qa(e){let t=new URLSearchParams(e),n=t.get(`notice-repo`);if(!n)return null;let r=t.get(`notice-pane`);return{repo:n,pane:r!==null&&/^\d+$/.test(r)?Number(r):null}}async function Ja(e,t,n){let r=qa(e.search);if(!r)return;let i=new URL(e.href);i.searchParams.delete(`notice-repo`),i.searchParams.delete(`notice-pane`),t.replaceState(t.state,``,i.pathname+i.search+i.hash),r.pane!==null&&_e(r.repo,r.pane),await n(r.repo).catch(()=>void 0)}ce(document.documentElement,window),de(i()),Ai(document.querySelector(`meta[name="nightcrow-build"]`)?.getAttribute(`content`)||null),Ze(Ye()),await Ja(window.location,window.history,A.setActiveRepo);var Ya=1500;await Promise.race([document.fonts?.load(`400 12px "JetBrains Mono"`).catch(()=>void 0),new Promise(e=>setTimeout(e,Ya))]),(0,Le.createRoot)(document.getElementById(`root`)).render((0,M.jsxs)(j.StrictMode,{children:[(0,M.jsx)(tr,{children:(0,M.jsx)(O,{children:(0,M.jsx)(Ha,{})})}),(0,M.jsx)(Ga,{})]})); \ No newline at end of file diff --git a/viewer-ui/dist/index.html b/viewer-ui/dist/index.html index ffe2403c..0c02678c 100644 --- a/viewer-ui/dist/index.html +++ b/viewer-ui/dist/index.html @@ -14,13 +14,13 @@ nightcrow - + - +
diff --git a/viewer-ui/package-lock.json b/viewer-ui/package-lock.json index 7a0f700e..65ae6877 100644 --- a/viewer-ui/package-lock.json +++ b/viewer-ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "nightcrow-viewer-ui", - "version": "0.1.28", + "version": "0.1.29", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nightcrow-viewer-ui", - "version": "0.1.28", + "version": "0.1.29", "dependencies": { "@xterm/addon-fit": "^0.11.0", "@xterm/addon-webgl": "^0.19.0", diff --git a/viewer-ui/package.json b/viewer-ui/package.json index c0206011..44bb5159 100644 --- a/viewer-ui/package.json +++ b/viewer-ui/package.json @@ -1,7 +1,7 @@ { "name": "nightcrow-viewer-ui", "private": true, - "version": "0.1.28", + "version": "0.1.29", "type": "module", "scripts": { "dev": "vite", diff --git a/viewer-ui/src/components/terminal/ComposeDialog.test.tsx b/viewer-ui/src/components/terminal/ComposeDialog.test.tsx index 9dd249e8..60bd2463 100644 --- a/viewer-ui/src/components/terminal/ComposeDialog.test.tsx +++ b/viewer-ui/src/components/terminal/ComposeDialog.test.tsx @@ -4,8 +4,17 @@ import { cleanup, fireEvent, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, it, vi } from "vitest"; import { useState } from "react"; import { ComposeDialog } from "./ComposeDialog"; - -afterEach(cleanup); +import { dismissToast, subscribeToasts } from "../../lib/runtime/toast"; + +afterEach(() => { + cleanup(); + // Toasts are a module singleton; clear them so one test's errors stay its own. + let left: { id: number }[] = []; + subscribeToasts((all) => { + left = all; + })(); + left.forEach((t) => dismissToast(t.id)); +}); function mount(initial = "", sendResult = true, upload: { busy?: boolean } = {}) { const onSend = vi.fn(() => sendResult); @@ -80,7 +89,9 @@ describe("ComposeDialog", () => { it("a_failed_send_says_nothing_went_out", () => { mount("hi", false); fireEvent.click(screen.getByRole("button", { name: /send/i })); + // Said in a toast, echoed inside the dialog for screen readers. expect(screen.getByRole("alert").textContent).toMatch(/nothing was sent/); + expect(screen.getByRole("alert").closest(".sr-only")).not.toBeNull(); }); it("escape_closes_the_dialog", () => { diff --git a/viewer-ui/src/components/terminal/ComposeDialog.tsx b/viewer-ui/src/components/terminal/ComposeDialog.tsx index 0a3aec80..de72e43f 100644 --- a/viewer-ui/src/components/terminal/ComposeDialog.tsx +++ b/viewer-ui/src/components/terminal/ComposeDialog.tsx @@ -12,6 +12,7 @@ import { } from "../../lib/terminal/dictation"; import { DictationButton, FORM_ICON_BUTTON } from "./DictationButton"; import { ToastEcho } from "../feedback/ToastEcho"; +import { toast } from "../../lib/runtime/toast"; const TITLE_ID = "nc-compose-title"; @@ -54,7 +55,6 @@ export function ComposeDialog({ }) { const fieldRef = useRef(null); const imageRef = useRef(null); - const [failed, setFailed] = useState(false); const sendable = isSendable(draft); const canSend = sendable && !uploading; const chord = sendChordLabel(platform()); @@ -80,12 +80,12 @@ export function ComposeDialog({ }, [onClose]); const send = () => { - if (canSend) setFailed(!onSend()); + // A toast, not a line in the form, so nothing moves; the draft stays. + if (canSend && !onSend()) toast.error("Not connected — nothing was sent."); }; const clear = () => { onChange(""); - setFailed(false); fieldRef.current?.focus(); }; @@ -103,7 +103,7 @@ export function ComposeDialog({ className="nc-rise-in flex w-[56rem] max-w-full flex-col rounded-lg border border-ink-700 bg-ink-900" onClick={(e) => e.stopPropagation()} > - {/* Upload and microphone errors are toasts, outside this modal. */} + {/* Send, upload and microphone errors are toasts, outside this modal. */}
@@ -123,7 +123,6 @@ export function ComposeDialog({ value={draft} onChange={(e) => { onChange(e.target.value); - setFailed(false); }} onKeyDown={(e) => { if (e.key !== "Enter" || e.nativeEvent.isComposing) return; @@ -166,7 +165,6 @@ export function ComposeDialog({ factory={voice.factory} onText={(text) => { onChange(appendDictation(draft, text)); - setFailed(false); }} /> {uploading && ( @@ -174,11 +172,6 @@ export function ComposeDialog({ Uploading image… )} - {failed && ( - - Not connected — nothing was sent. - - )} {/* Together, so a narrow screen wraps them as one group and Send never lands alone on the left. */}
diff --git a/viewer-ui/src/hooks/terminal/useTerminalViews.ts b/viewer-ui/src/hooks/terminal/useTerminalViews.ts index 6c903fa3..053c789f 100644 --- a/viewer-ui/src/hooks/terminal/useTerminalViews.ts +++ b/viewer-ui/src/hooks/terminal/useTerminalViews.ts @@ -20,6 +20,7 @@ import type { ScreenScale } from "../ui/screenScale"; import { createTitleThrottle } from "../../lib/terminal/titleThrottle"; import type { TitleThrottle } from "../../lib/terminal/titleThrottle"; import { enableWebglRenderer } from "../../lib/terminal/webglRenderer"; +import { atlasRefreshAddon } from "../../lib/terminal/atlasRefresh"; import { installImeInputGuard, type ImeInputGuard } from "../../lib/terminal/imeInputGuard"; import { queueTerminalBarrier, @@ -95,6 +96,10 @@ export function useTerminalViews({ const term = new Terminal({ ...font, theme: { background: "#111112", foreground: "#f2f2f3" }, + // An opaque WebGL canvas shows an undefined (often white on Android) + // buffer until its first frame; a transparent one shows the dark page + // beneath. Every painted cell is still the opaque theme background. + allowTransparency: true, cursorBlink: true, // The IME guard follows xterm's early finalize path, which is skipped // when Option is treated as Meta. @@ -195,6 +200,7 @@ export function useTerminalViews({ // budget can still afford. `enableWebglRenderer` leaves this pane on the // renderer it already has when WebGL is unavailable or later lost. enableWebglRenderer(term, () => new WebglAddon()); + term.loadAddon(atlasRefreshAddon(term)); // Before a byte is written: what follows was drawn against the PTY's // grid. An opened xterm starts at 80×24, and a hidden parser also needs // the confirmed grid before it consumes output; parsing at the default diff --git a/viewer-ui/src/lib/terminal/atlasRefresh.test.ts b/viewer-ui/src/lib/terminal/atlasRefresh.test.ts new file mode 100644 index 00000000..05829fc4 --- /dev/null +++ b/viewer-ui/src/lib/terminal/atlasRefresh.test.ts @@ -0,0 +1,40 @@ +import { describe, expect, it, vi } from "vitest"; +import { atlasRefreshAddon } from "./atlasRefresh"; + +function fakeDocument() { + const target = new EventTarget(); + const doc = { + visibilityState: "visible" as DocumentVisibilityState, + addEventListener: target.addEventListener.bind(target), + removeEventListener: target.removeEventListener.bind(target), + }; + const become = (state: DocumentVisibilityState) => { + doc.visibilityState = state; + target.dispatchEvent(new Event("visibilitychange")); + }; + return { doc, become }; +} + +describe("atlasRefreshAddon", () => { + it("rebuilds the glyph atlas when the page becomes visible again", () => { + const { doc, become } = fakeDocument(); + const term = { clearTextureAtlas: vi.fn() }; + atlasRefreshAddon(term, doc).activate(term as never); + + become("hidden"); + expect(term.clearTextureAtlas).not.toHaveBeenCalled(); + become("visible"); + expect(term.clearTextureAtlas).toHaveBeenCalledOnce(); + }); + + it("stops listening once the pane is disposed", () => { + const { doc, become } = fakeDocument(); + const term = { clearTextureAtlas: vi.fn() }; + const addon = atlasRefreshAddon(term, doc); + addon.activate(term as never); + addon.dispose(); + + become("visible"); + expect(term.clearTextureAtlas).not.toHaveBeenCalled(); + }); +}); diff --git a/viewer-ui/src/lib/terminal/atlasRefresh.ts b/viewer-ui/src/lib/terminal/atlasRefresh.ts new file mode 100644 index 00000000..b2e40f52 --- /dev/null +++ b/viewer-ui/src/lib/terminal/atlasRefresh.ts @@ -0,0 +1,29 @@ +import type { ITerminalAddon, Terminal } from "@xterm/xterm"; + +/** + * Rebuild a pane's glyph atlas each time the page becomes visible again. + * + * A mobile browser that sleeps for a while can reclaim GPU memory behind a + * WebGL context without firing `webglcontextlost`: the context stays usable, + * but the glyph textures it held are gone, so the pane paints only the few + * glyphs drawn again since. A resize reuses the same atlas and stays broken; + * only a reload recovered it. Clearing the atlas on return makes xterm + * rasterize every glyph again and repaint the whole screen. With the DOM + * renderer there is no atlas, and xterm only repaints. + */ +export function atlasRefreshAddon( + term: Pick, + doc: Pick = document, +): ITerminalAddon { + const onVisibility = () => { + if (doc.visibilityState === "visible") term.clearTextureAtlas(); + }; + return { + activate() { + doc.addEventListener("visibilitychange", onVisibility); + }, + dispose() { + doc.removeEventListener("visibilitychange", onVisibility); + }, + }; +}