@pi-chamber/web 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/assets/{CommitSection-LewzHfDH.js → CommitSection-DPjTv8fA.js} +1 -1
- package/dist/assets/{DiagramEditor-BOIJVnh3.js → DiagramEditor-ChOor9l9.js} +1 -1
- package/dist/assets/{DiagramView-CdNHezna.js → DiagramView-3hAT86v_.js} +1 -1
- package/dist/assets/{DiffView-Cmw-RHIH.js → DiffView-D1dyOiw2.js} +2 -2
- package/dist/assets/FilesView-BCzghrc7.js +14 -0
- package/dist/assets/{GitView-DqYF-n_h.js → GitView-CYF1E1p4.js} +4 -4
- package/dist/assets/{JsonTreeView-DzEjA1ht.js → JsonTreeView-CrJO6LNu.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-Bfq0bOSM.js → MarkdownRendererImpl-BmKjrkGD.js} +2 -2
- package/dist/assets/{PatchDiff-CtVByTC4.js → PatchDiff-DgvPLx6x.js} +1 -1
- package/dist/assets/{PierreDiffViewer-Cwoewmiu.js → PierreDiffViewer-InnT0JVA.js} +2 -2
- package/dist/assets/{SessionSwitcherDropdown-DNjCJjzF.js → SessionSwitcherDropdown-C0OdvirK.js} +102 -102
- package/dist/assets/{SettingsView-BtLvHlj4.js → SettingsView-JAfC_cBL.js} +1 -1
- package/dist/assets/{SettingsWindow-CPd7JmJs.js → SettingsWindow-BBEsjcJE.js} +1 -1
- package/dist/assets/{ToolOutputDialog-CFFC5eI-.js → ToolOutputDialog-gzwcb8nI.js} +4 -4
- package/dist/assets/{ToolPartDiffPreview-yFq1DKSA.js → ToolPartDiffPreview-C45V5bhy.js} +1 -1
- package/dist/assets/{VirtualizedFileDiff-CC5lTPJS.js → VirtualizedFileDiff-uKfnkQWb.js} +1 -1
- package/dist/assets/{collapsible-D_555Hw_.js → collapsible-Bq8sDiKS.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-BcVuV0Ic.js → computeVirtualFileMetrics-BPgZ_RSe.js} +2 -2
- package/dist/assets/{contextFileOpenGuard-BygvjHuE.js → contextFileOpenGuard-CydO7PkI.js} +1 -1
- package/dist/assets/{index-C9CLY-is.js → index-BSuNNtBh.js} +1 -1
- package/dist/assets/{index-DQr8-8RF.js → index-CH7o4-_q.js} +1 -1
- package/dist/assets/index-o4Eea60G.css +1 -0
- package/dist/assets/{isDiffPlainText-Bher0UxW.js → isDiffPlainText-f9b4cKNo.js} +1 -1
- package/dist/assets/{isFilePlainText-EIViqOlI.js → isFilePlainText-BjESb-gU.js} +1 -1
- package/dist/assets/{main-1bIgjP48.js → main-B508FBXr.js} +2 -2
- package/dist/assets/main-nG4uFyAy.js +133 -0
- package/dist/assets/{markdownCore-Bm4FxtK1.js → markdownCore-BFmf8a-O.js} +2 -2
- package/dist/assets/{miniChat-B7kKqKHH.js → miniChat-BTlz8IPL.js} +2 -2
- package/dist/assets/{mobile-DZPRce5z.js → mobile-DBkrRt80.js} +2 -2
- package/dist/assets/renderElectronMiniChatApp-DW3fSR5w.js +1 -0
- package/dist/assets/renderMobileApp-9qkroKty.js +14 -0
- package/dist/assets/{runtimeSurface-B6sKTjo7.js → runtimeSurface-Bec4O8FD.js} +1 -1
- package/dist/assets/{useInlineCommentController-CSR_Ju0a.js → useInlineCommentController-CHmIm0Rr.js} +2 -2
- package/dist/assets/usePanelSlide-DCX8qQ4K.js +56 -0
- package/dist/assets/{useWindowTitle-rt_8xbd9.js → useWindowTitle-CE5N_NeU.js} +3 -3
- package/dist/assets/{vendor-codemirror-autocomplete-3xMyV7a2.js → vendor-codemirror-autocomplete-BS2SpSAZ.js} +1 -1
- package/dist/assets/{vendor-codemirror-commands-Bzf12ODH.js → vendor-codemirror-commands-RrgJ8H_6.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-angular-0K6s6cvb.js → vendor-codemirror-lang-angular-ADhO_TUK.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-cpp-B0aL03z-.js → vendor-codemirror-lang-cpp-BGCWj7Om.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-css-C4jEScp7.js → vendor-codemirror-lang-css-Ba8JZ6fp.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-go-CgrfVBPr.js → vendor-codemirror-lang-go-DyTiHXo4.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-html-C1Svvdey.js → vendor-codemirror-lang-html-DK27qQri.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-java-DNPz7_Bx.js → vendor-codemirror-lang-java-CvFfnhPQ.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-javascript-CrbeaEAU.js → vendor-codemirror-lang-javascript-BUlYhQ3o.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-jinja-DL8BR_RG.js → vendor-codemirror-lang-jinja-wBMtAEvT.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-json-BTvAjwkJ.js → vendor-codemirror-lang-json-CqayksDf.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-less-CPABt6NZ.js → vendor-codemirror-lang-less-Ct3-H1PB.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-liquid-BLOLOBMg.js → vendor-codemirror-lang-liquid-XspREksq.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-markdown-BloD9GN-.js → vendor-codemirror-lang-markdown-CvO36Y1p.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-php-FIZMTuWM.js → vendor-codemirror-lang-php-BlUF9cCe.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-python-CR2g6ukK.js → vendor-codemirror-lang-python-_2bIYTiJ.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-rust-lsPqn4k4.js → vendor-codemirror-lang-rust-BdTYih_U.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sass-CtECMwzH.js → vendor-codemirror-lang-sass-E6MhfOFk.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sql-BtmZrrZH.js → vendor-codemirror-lang-sql-B1BRhQSF.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-vue-Br6DrntY.js → vendor-codemirror-lang-vue-BYQJRa1Q.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-wast-DT7IlCnb.js → vendor-codemirror-lang-wast-D706yuyC.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-xml-wNr-LZOf.js → vendor-codemirror-lang-xml--MfWU6Dj.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-yaml-BTKFwfc2.js → vendor-codemirror-lang-yaml-CRUFIbRX.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-BuDklWi8.js → vendor-codemirror-language-E2vgV9K3.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-Be-zDX0u.js → vendor-codemirror-language-data-q1yHU1R9.js} +2 -2
- package/dist/assets/{vendor-codemirror-search-BzyfPoRb.js → vendor-codemirror-search-8kyQdB3f.js} +1 -1
- package/dist/assets/{vendor-codemirror-state-Wdz6Qsow.js → vendor-codemirror-state-CNWM3Q8V.js} +1 -1
- package/dist/assets/{vendor-codemirror-view-pXtfpqbT.js → vendor-codemirror-view-DSzLbZiS.js} +1 -1
- package/dist/assets/{vendor-replit-codemirror-vim-BUqe2Slv.js → vendor-replit-codemirror-vim-BJY5fGLS.js} +1 -1
- package/dist/assets/{web-components-DgFD1Jms.js → web-components-CLirSfwt.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/mini-chat.html +3 -3
- package/dist/mobile.html +3 -3
- package/package.json +1 -1
- package/server/index.js +6 -1
- package/server/lib/pi/routes.js +13 -1
- package/server/lib/pi/routes.test.js +4 -0
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +6 -5
- package/server/lib/pi/session-daemon/daemon-process.js +4 -1
- package/server/lib/pi/session-daemon/session-daemon.js +138 -20
- package/server/lib/pi/session-daemon/session-daemon.test.js +208 -0
- package/server/lib/pi/session-daemon/session-jsonl.js +258 -6
- package/server/lib/pi/session-daemon/session-jsonl.test.js +69 -1
- package/server/lib/pi/session-daemon/supervisor.js +41 -21
- package/server/lib/pi/session-daemon/supervisor.test.js +28 -0
- package/dist/assets/FilesView-BODbL0Xm.js +0 -14
- package/dist/assets/index-DYrJXRkU.css +0 -1
- package/dist/assets/main-JDtt2bQS.js +0 -133
- package/dist/assets/renderElectronMiniChatApp-Dq0GdThJ.js +0 -1
- package/dist/assets/renderMobileApp-DlKnjObC.js +0 -23
- package/dist/assets/usePanelSlide-BkonU4LS.js +0 -47
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{k as cn,P as hn,i as dn,a as Ce,M as rr,S as vn}from"./vendor-codemirror-state-Wdz6Qsow.js";import{u as pn,r as Gt,i as Yt,v as nr,w as gn}from"./vendor-codemirror-language-BuDklWi8.js";import{s as ir,E as Ye,V as yn,D as ht,c as mn,a as Cn,r as He}from"./vendor-codemirror-view-pXtfpqbT.js";import{s as dt,S as kn,R as wn}from"./vendor-codemirror-search-BzyfPoRb.js";import{i as Sn,a as xn,c as Mn,b as Ln,d as bn,e as Tn,f as An,g as En,u as On,r as Rn}from"./vendor-codemirror-commands-Bzf12ODH.js";function In(f){var a=f.Pos;function c(e,t,r){if(t.line===r.line&&t.ch>=r.ch-1){var n=e.getLine(t.line),i=n.charCodeAt(t.ch);55296<=i&&i<=55551&&(r.ch+=1)}return{start:t,end:r}}var v=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"g<Up>",type:"keyToKey",toKeys:"gk"},{keys:"g<Down>",type:"keyToKey",toKeys:"gj"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h"},{keys:"<Del>",type:"keyToKey",toKeys:"x"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"gq",type:"operator",operator:"hardWrap"},{keys:"gw",type:"operator",operator:"hardWrap",operatorArgs:{keepCursor:!0}},{keys:"g?",type:"operator",operator:"rot13"},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-u>",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-w>",type:"idle",context:"normal"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<register>",type:"action",action:"replayMacro"},{keys:"q<register>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<register>",type:"action",action:"setMark"},{keys:'"<register>',type:"action",action:"setRegister"},{keys:"<C-r><register>",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"<C-o>",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<register>",type:"motion",motion:"textObjectManipulation"},{keys:"i<register>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],y=Object.create(null),k=v.length,L=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"startinsert",shortName:"start"},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"marks",excludeFromCommandHistory:!0},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}],x=Ct("");function b(e){e.setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),f.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",Ut),Ne(e),f.on(e.getInputField(),"paste",D(e))}function F(e){e.setOption("disableInput",!1),e.off("cursorActivity",Ut),f.off(e.getInputField(),"paste",D(e)),e.state.vim=null,Ue&&clearTimeout(Ue)}function D(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(G(e.getCursor(),0,1)),De.enterInsertMode(e,{},t))}),t.onPasteFn}var H=/[\d]/,j=[f.isWordChar,function(e){return e&&!f.isWordChar(e)&&!/\s/.test(e)}],B=[function(e){return/\S/.test(e)}],_=["<",">"],Q=["-",'"',".",":","_","/","+"],W=/^\w$/,z=/^[A-Z]$/;try{z=new RegExp("^[\\p{Lu}]$","u")}catch{}function ie(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function oe(e){return/^[a-z]$/.test(e)}function ce(e){return"()[]{}".indexOf(e)!=-1}function ae(e){return H.test(e)}function ge(e){return z.test(e)}function Z(e){return/^\s*$/.test(e)}function Ie(e){return".?!".indexOf(e)!=-1}function Ze(e,t){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}var Le={};function Be(e,t,r,n,i){if(t===void 0&&!i)throw Error("defaultValue is required unless callback is provided");if(r||(r="string"),Le[e]={type:r,defaultValue:t,callback:i},n)for(var o=0;o<n.length;o++)Le[n[o]]=Le[e];t&&Je(e,t)}function Je(e,t,r,n){var i=Le[e];n=n||{};var o=n.scope;if(!i)return new Error("Unknown option: "+e);if(i.type=="boolean"){if(t&&t!==!0)return new Error("Invalid argument: "+e+"="+t);t!==!1&&(t=!0)}i.callback?(o!=="local"&&i.callback(t,void 0),o!=="global"&&r&&i.callback(t,r)):(o!=="local"&&(i.value=i.type=="boolean"?!!t:t),o!=="global"&&r&&(r.state.vim.options[e]={value:t}))}function le(e,t,r){var n=Le[e];r=r||{};var i=r.scope;if(!n)return new Error("Unknown option: "+e);if(n.callback){let o=t&&n.callback(void 0,t);return i!=="global"&&o!==void 0?o:i!=="local"?n.callback():void 0}else return(i!=="global"&&t&&t.state.vim.options[e]||i!=="local"&&n||{}).value}Be("filetype",void 0,"string",["ft"],function(e,t){if(t!==void 0)if(e===void 0){let r=t.getOption("mode");return r=="null"?"":r}else{let r=e==""?"null":e;t.setOption("mode",r)}}),Be("textwidth",80,"number",["tw"],function(e,t){if(t!==void 0)if(e===void 0){var r=t.getOption("textwidth");return r}else{var n=Math.round(e);n>1&&t.setOption("textwidth",n)}});var dr=function(){var e=100,t=-1,r=0,n=0,i=new Array(e);function o(u,d,h){var g=t%e,m=i[g];function C(w){var S=++t%e,A=i[S];A&&A.clear(),i[S]=u.setBookmark(w)}if(m){var p=m.find();p&&!he(p,d)&&C(d)}else C(d);C(h),r=t,n=t-e+1,n<0&&(n=0)}function s(u,d){t+=d,t>r?t=r:t<n&&(t=n);var h=i[(e+t)%e];if(h&&!h.find()){var g=d>0?1:-1,m,C=u.getCursor();do if(t+=g,h=i[(e+t)%e],h&&(m=h.find())&&!he(C,m))break;while(t<r&&t>n)}return h}function l(u,d){var h=t,g=s(u,d);return t=h,g&&g.find()}return{cachedCursor:void 0,add:o,find:l,move:s}},gt=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class vr{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=gt()}exitMacroRecordMode(){var t=T.macroModeState;t.onRecordingDone&&t.onRecordingDone(),t.onRecordingDone=void 0,t.isRecording=!1}enterMacroRecordMode(t,r){var n=T.registerController.getRegister(r);if(n){if(n.clear(),this.latestRegister=r,t.openDialog){var i=me("span",{class:"cm-vim-message"},"recording @"+r);this.onRecordingDone=t.openDialog(i,function(){},{bottom:!0})}this.isRecording=!0}}}function Ne(e){return e.state.vim||(e.state.vim={inputState:new kt,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new a(0,0),head:new a(0,0)},options:{},expectLiteralNext:!1,status:""}),e.state.vim}var T;function yt(){T={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:dr(),macroModeState:new vr,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new Cr({}),searchHistoryController:new wt,exCommandHistoryController:new wt};for(var e in Le){var t=Le[e];t.value=t.defaultValue}}class et{constructor(t,r){this.keyName=t,this.key=r.key,this.ctrlKey=r.ctrlKey,this.altKey=r.altKey,this.metaKey=r.metaKey,this.shiftKey=r.shiftKey}}var Ve,ue={enterVimMode:b,leaveVimMode:F,buildKeyMap:function(){},getRegisterController:function(){return T.registerController},resetVimGlobalState_:yt,getVimGlobalState_:function(){return T},maybeInitVimState_:Ne,suppressErrorLogging:!1,InsertModeKey:et,map:function(e,t,r){se.map(e,t,r)},unmap:function(e,t){return se.unmap(e,t)},noremap:function(e,t,r){se.map(e,t,r,!0)},mapclear:function(e){var t=v.length,r=k,n=v.slice(0,t-r);if(v=v.slice(t-r),e)for(var i=n.length-1;i>=0;i--){var o=n[i];if(e!==o.context)if(o.context)this._mapCommand(o);else{var s=["normal","insert","visual"];for(var l in s)if(s[l]!==e){var u=Object.assign({},o);u.context=s[l],this._mapCommand(u)}}}},langmap:mt,vimKeyFromEvent:We,setOption:Je,getOption:le,defineOption:Be,defineEx:function(e,t,r){if(!t)t=e;else if(e.indexOf(t)!==0)throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered');Wt[e]=r,se.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);if(typeof n=="function")return n()},multiSelectHandleKey:un,findKey:function(e,t,r){var n=Ne(e),i=e;function o(){var h=T.macroModeState;if(h.isRecording){if(t=="q")return h.exitMacroRecordMode(),Y(i),!0;r!="mapping"&&an(h,t)}}function s(){if(t=="<Esc>"){if(n.visualMode)Se(i);else if(n.insertMode)Ae(i);else return;return Y(i),!0}}function l(){if(s())return!0;n.inputState.keyBuffer.push(t);var h=n.inputState.keyBuffer.join(""),g=t.length==1,m=Ee.matchCommand(h,v,n.inputState,"insert"),C=n.inputState.changeQueue;if(m.type=="none")return Y(i),!1;if(m.type=="partial"){if(m.expectLiteralNext&&(n.expectLiteralNext=!0),Ve&&window.clearTimeout(Ve),Ve=g&&window.setTimeout(function(){n.insertMode&&n.inputState.keyBuffer.length&&Y(i)},le("insertModeEscKeysTimeout")),g){var p=i.listSelections();(!C||C.removed.length!=p.length)&&(C=n.inputState.changeQueue=new yr),C.inserted+=t;for(var w=0;w<p.length;w++){var S=ne(p[w].anchor,p[w].head),A=Te(p[w].anchor,p[w].head),M=i.getRange(S,i.state.overwrite?G(A,0,1):A);C.removed[w]=(C.removed[w]||"")+M}}return!g}else m.type=="full"&&(n.inputState.keyBuffer.length=0);if(n.expectLiteralNext=!1,Ve&&window.clearTimeout(Ve),m.command&&C){for(var p=i.listSelections(),w=0;w<p.length;w++){var O=p[w].head;i.replaceRange(C.removed[w]||"",G(O,0,-C.inserted.length),O,"+input")}T.macroModeState.lastInsertModeChanges.changes.pop()}return m.command||Y(i),m.command}function u(){if(o()||s())return!0;n.inputState.keyBuffer.push(t);var h=n.inputState.keyBuffer.join("");if(/^[1-9]\d*$/.test(h))return!0;var g=/^(\d*)(.*)$/.exec(h);if(!g)return Y(i),!1;var m=n.visualMode?"visual":"normal",C=g[2]||g[1];n.inputState.operatorShortcut&&n.inputState.operatorShortcut.slice(-1)==C&&(C=n.inputState.operatorShortcut);var p=Ee.matchCommand(C,v,n.inputState,m);return p.type=="none"?(Y(i),!1):p.type=="partial"?(p.expectLiteralNext&&(n.expectLiteralNext=!0),!0):p.type=="clear"?(Y(i),!0):(n.expectLiteralNext=!1,n.inputState.keyBuffer.length=0,g=/^(\d*)(.*)$/.exec(h),g&&g[1]&&g[1]!="0"&&n.inputState.pushRepeatDigit(g[1]),p.command)}var d=n.insertMode?l():u();if(d===!1)return!n.insertMode&&(t.length===1||f.isMac&&/<A-.>/.test(t))?function(){return!0}:void 0;if(d===!0)return function(){return!0};if(d)return function(){return i.operation(function(){i.curOp.isVimOp=!0;try{if(typeof d!="object")return;d.type=="keyToKey"?$e(i,d.toKeys,d):Ee.processCommand(i,n,d)}catch(h){throw i.state.vim=void 0,Ne(i),ue.suppressErrorLogging||console.log(h),h}return!0})}},handleEx:function(e,t){se.processCommand(e,t)},defineMotion:kr,defineAction:Sr,defineOperator:wr,mapCommand:nn,_mapCommand:ut,defineRegister:mr,exitVisualMode:Se,exitInsertMode:Ae},Pe=[],ze=!1,X;function pr(e){if(!X)throw new Error("No prompt to send key to");if(e[0]=="<"){var t=e.toLowerCase().slice(1,-1),r=t.split("-");if(t=r.pop()||"",t=="lt")e="<";else if(t=="space")e=" ";else if(t=="cr")e=`
|
|
1
|
+
import{k as cn,P as hn,i as dn,a as Ce,M as rr,S as vn}from"./vendor-codemirror-state-CNWM3Q8V.js";import{u as pn,r as Gt,i as Yt,v as nr,w as gn}from"./vendor-codemirror-language-E2vgV9K3.js";import{s as ir,E as Ye,V as yn,D as ht,c as mn,a as Cn,r as He}from"./vendor-codemirror-view-DSzLbZiS.js";import{s as dt,S as kn,R as wn}from"./vendor-codemirror-search-8kyQdB3f.js";import{i as Sn,a as xn,c as Mn,b as Ln,d as bn,e as Tn,f as An,g as En,u as On,r as Rn}from"./vendor-codemirror-commands-RrgJ8H_6.js";function In(f){var a=f.Pos;function c(e,t,r){if(t.line===r.line&&t.ch>=r.ch-1){var n=e.getLine(t.line),i=n.charCodeAt(t.ch);55296<=i&&i<=55551&&(r.ch+=1)}return{start:t,end:r}}var v=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"g<Up>",type:"keyToKey",toKeys:"gk"},{keys:"g<Down>",type:"keyToKey",toKeys:"gj"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h"},{keys:"<Del>",type:"keyToKey",toKeys:"x"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"gq",type:"operator",operator:"hardWrap"},{keys:"gw",type:"operator",operator:"hardWrap",operatorArgs:{keepCursor:!0}},{keys:"g?",type:"operator",operator:"rot13"},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-u>",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-w>",type:"idle",context:"normal"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<register>",type:"action",action:"replayMacro"},{keys:"q<register>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<register>",type:"action",action:"setMark"},{keys:'"<register>',type:"action",action:"setRegister"},{keys:"<C-r><register>",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"<C-o>",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<register>",type:"motion",motion:"textObjectManipulation"},{keys:"i<register>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],y=Object.create(null),k=v.length,L=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"startinsert",shortName:"start"},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"marks",excludeFromCommandHistory:!0},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}],x=Ct("");function b(e){e.setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),f.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",Ut),Ne(e),f.on(e.getInputField(),"paste",D(e))}function F(e){e.setOption("disableInput",!1),e.off("cursorActivity",Ut),f.off(e.getInputField(),"paste",D(e)),e.state.vim=null,Ue&&clearTimeout(Ue)}function D(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(G(e.getCursor(),0,1)),De.enterInsertMode(e,{},t))}),t.onPasteFn}var H=/[\d]/,j=[f.isWordChar,function(e){return e&&!f.isWordChar(e)&&!/\s/.test(e)}],B=[function(e){return/\S/.test(e)}],_=["<",">"],Q=["-",'"',".",":","_","/","+"],W=/^\w$/,z=/^[A-Z]$/;try{z=new RegExp("^[\\p{Lu}]$","u")}catch{}function ie(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function oe(e){return/^[a-z]$/.test(e)}function ce(e){return"()[]{}".indexOf(e)!=-1}function ae(e){return H.test(e)}function ge(e){return z.test(e)}function Z(e){return/^\s*$/.test(e)}function Ie(e){return".?!".indexOf(e)!=-1}function Ze(e,t){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}var Le={};function Be(e,t,r,n,i){if(t===void 0&&!i)throw Error("defaultValue is required unless callback is provided");if(r||(r="string"),Le[e]={type:r,defaultValue:t,callback:i},n)for(var o=0;o<n.length;o++)Le[n[o]]=Le[e];t&&Je(e,t)}function Je(e,t,r,n){var i=Le[e];n=n||{};var o=n.scope;if(!i)return new Error("Unknown option: "+e);if(i.type=="boolean"){if(t&&t!==!0)return new Error("Invalid argument: "+e+"="+t);t!==!1&&(t=!0)}i.callback?(o!=="local"&&i.callback(t,void 0),o!=="global"&&r&&i.callback(t,r)):(o!=="local"&&(i.value=i.type=="boolean"?!!t:t),o!=="global"&&r&&(r.state.vim.options[e]={value:t}))}function le(e,t,r){var n=Le[e];r=r||{};var i=r.scope;if(!n)return new Error("Unknown option: "+e);if(n.callback){let o=t&&n.callback(void 0,t);return i!=="global"&&o!==void 0?o:i!=="local"?n.callback():void 0}else return(i!=="global"&&t&&t.state.vim.options[e]||i!=="local"&&n||{}).value}Be("filetype",void 0,"string",["ft"],function(e,t){if(t!==void 0)if(e===void 0){let r=t.getOption("mode");return r=="null"?"":r}else{let r=e==""?"null":e;t.setOption("mode",r)}}),Be("textwidth",80,"number",["tw"],function(e,t){if(t!==void 0)if(e===void 0){var r=t.getOption("textwidth");return r}else{var n=Math.round(e);n>1&&t.setOption("textwidth",n)}});var dr=function(){var e=100,t=-1,r=0,n=0,i=new Array(e);function o(u,d,h){var g=t%e,m=i[g];function C(w){var S=++t%e,A=i[S];A&&A.clear(),i[S]=u.setBookmark(w)}if(m){var p=m.find();p&&!he(p,d)&&C(d)}else C(d);C(h),r=t,n=t-e+1,n<0&&(n=0)}function s(u,d){t+=d,t>r?t=r:t<n&&(t=n);var h=i[(e+t)%e];if(h&&!h.find()){var g=d>0?1:-1,m,C=u.getCursor();do if(t+=g,h=i[(e+t)%e],h&&(m=h.find())&&!he(C,m))break;while(t<r&&t>n)}return h}function l(u,d){var h=t,g=s(u,d);return t=h,g&&g.find()}return{cachedCursor:void 0,add:o,find:l,move:s}},gt=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class vr{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=gt()}exitMacroRecordMode(){var t=T.macroModeState;t.onRecordingDone&&t.onRecordingDone(),t.onRecordingDone=void 0,t.isRecording=!1}enterMacroRecordMode(t,r){var n=T.registerController.getRegister(r);if(n){if(n.clear(),this.latestRegister=r,t.openDialog){var i=me("span",{class:"cm-vim-message"},"recording @"+r);this.onRecordingDone=t.openDialog(i,function(){},{bottom:!0})}this.isRecording=!0}}}function Ne(e){return e.state.vim||(e.state.vim={inputState:new kt,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new a(0,0),head:new a(0,0)},options:{},expectLiteralNext:!1,status:""}),e.state.vim}var T;function yt(){T={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:dr(),macroModeState:new vr,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new Cr({}),searchHistoryController:new wt,exCommandHistoryController:new wt};for(var e in Le){var t=Le[e];t.value=t.defaultValue}}class et{constructor(t,r){this.keyName=t,this.key=r.key,this.ctrlKey=r.ctrlKey,this.altKey=r.altKey,this.metaKey=r.metaKey,this.shiftKey=r.shiftKey}}var Ve,ue={enterVimMode:b,leaveVimMode:F,buildKeyMap:function(){},getRegisterController:function(){return T.registerController},resetVimGlobalState_:yt,getVimGlobalState_:function(){return T},maybeInitVimState_:Ne,suppressErrorLogging:!1,InsertModeKey:et,map:function(e,t,r){se.map(e,t,r)},unmap:function(e,t){return se.unmap(e,t)},noremap:function(e,t,r){se.map(e,t,r,!0)},mapclear:function(e){var t=v.length,r=k,n=v.slice(0,t-r);if(v=v.slice(t-r),e)for(var i=n.length-1;i>=0;i--){var o=n[i];if(e!==o.context)if(o.context)this._mapCommand(o);else{var s=["normal","insert","visual"];for(var l in s)if(s[l]!==e){var u=Object.assign({},o);u.context=s[l],this._mapCommand(u)}}}},langmap:mt,vimKeyFromEvent:We,setOption:Je,getOption:le,defineOption:Be,defineEx:function(e,t,r){if(!t)t=e;else if(e.indexOf(t)!==0)throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered');Wt[e]=r,se.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);if(typeof n=="function")return n()},multiSelectHandleKey:un,findKey:function(e,t,r){var n=Ne(e),i=e;function o(){var h=T.macroModeState;if(h.isRecording){if(t=="q")return h.exitMacroRecordMode(),Y(i),!0;r!="mapping"&&an(h,t)}}function s(){if(t=="<Esc>"){if(n.visualMode)Se(i);else if(n.insertMode)Ae(i);else return;return Y(i),!0}}function l(){if(s())return!0;n.inputState.keyBuffer.push(t);var h=n.inputState.keyBuffer.join(""),g=t.length==1,m=Ee.matchCommand(h,v,n.inputState,"insert"),C=n.inputState.changeQueue;if(m.type=="none")return Y(i),!1;if(m.type=="partial"){if(m.expectLiteralNext&&(n.expectLiteralNext=!0),Ve&&window.clearTimeout(Ve),Ve=g&&window.setTimeout(function(){n.insertMode&&n.inputState.keyBuffer.length&&Y(i)},le("insertModeEscKeysTimeout")),g){var p=i.listSelections();(!C||C.removed.length!=p.length)&&(C=n.inputState.changeQueue=new yr),C.inserted+=t;for(var w=0;w<p.length;w++){var S=ne(p[w].anchor,p[w].head),A=Te(p[w].anchor,p[w].head),M=i.getRange(S,i.state.overwrite?G(A,0,1):A);C.removed[w]=(C.removed[w]||"")+M}}return!g}else m.type=="full"&&(n.inputState.keyBuffer.length=0);if(n.expectLiteralNext=!1,Ve&&window.clearTimeout(Ve),m.command&&C){for(var p=i.listSelections(),w=0;w<p.length;w++){var O=p[w].head;i.replaceRange(C.removed[w]||"",G(O,0,-C.inserted.length),O,"+input")}T.macroModeState.lastInsertModeChanges.changes.pop()}return m.command||Y(i),m.command}function u(){if(o()||s())return!0;n.inputState.keyBuffer.push(t);var h=n.inputState.keyBuffer.join("");if(/^[1-9]\d*$/.test(h))return!0;var g=/^(\d*)(.*)$/.exec(h);if(!g)return Y(i),!1;var m=n.visualMode?"visual":"normal",C=g[2]||g[1];n.inputState.operatorShortcut&&n.inputState.operatorShortcut.slice(-1)==C&&(C=n.inputState.operatorShortcut);var p=Ee.matchCommand(C,v,n.inputState,m);return p.type=="none"?(Y(i),!1):p.type=="partial"?(p.expectLiteralNext&&(n.expectLiteralNext=!0),!0):p.type=="clear"?(Y(i),!0):(n.expectLiteralNext=!1,n.inputState.keyBuffer.length=0,g=/^(\d*)(.*)$/.exec(h),g&&g[1]&&g[1]!="0"&&n.inputState.pushRepeatDigit(g[1]),p.command)}var d=n.insertMode?l():u();if(d===!1)return!n.insertMode&&(t.length===1||f.isMac&&/<A-.>/.test(t))?function(){return!0}:void 0;if(d===!0)return function(){return!0};if(d)return function(){return i.operation(function(){i.curOp.isVimOp=!0;try{if(typeof d!="object")return;d.type=="keyToKey"?$e(i,d.toKeys,d):Ee.processCommand(i,n,d)}catch(h){throw i.state.vim=void 0,Ne(i),ue.suppressErrorLogging||console.log(h),h}return!0})}},handleEx:function(e,t){se.processCommand(e,t)},defineMotion:kr,defineAction:Sr,defineOperator:wr,mapCommand:nn,_mapCommand:ut,defineRegister:mr,exitVisualMode:Se,exitInsertMode:Ae},Pe=[],ze=!1,X;function pr(e){if(!X)throw new Error("No prompt to send key to");if(e[0]=="<"){var t=e.toLowerCase().slice(1,-1),r=t.split("-");if(t=r.pop()||"",t=="lt")e="<";else if(t=="space")e=" ";else if(t=="cr")e=`
|
|
2
2
|
`;else if(Ke[t]){var n=X.value||"",i={key:Ke[t],target:{value:n,selectionEnd:n.length,selectionStart:n.length}};X.onKeyDown&&X.onKeyDown(i,X.value,s),X&&X.onKeyUp&&X.onKeyUp(i,X.value,s);return}}if(e==`
|
|
3
3
|
`){var o=X;X=null,o.onClose&&o.onClose(o.value)}else X.value=(X.value||"")+e;function s(l){X&&(typeof l=="string"?X.value=l:X=null)}}function $e(e,t,r){var n=ze;if(r){if(Pe.indexOf(r)!=-1)return;Pe.push(r),ze=r.noremap!=!1}try{for(var i=Ne(e),o=/<(?:[CSMA]-)*\w+>|./gi,s;s=o.exec(t);){var l=s[0],u=i.insertMode;if(X){pr(l);continue}var d=ue.handleKey(e,l,"mapping");if(!d&&u&&i.insertMode){if(l[0]=="<"){var h=l.toLowerCase().slice(1,-1),g=h.split("-");if(h=g.pop()||"",h=="lt")l="<";else if(h=="space")l=" ";else if(h=="cr")l=`
|
|
4
4
|
`;else if(Ke.hasOwnProperty(h)){l=Ke[h],qt(e,l);continue}else l=l[0],o.lastIndex=s.index+1}e.replaceSelection(l)}}}finally{if(Pe.pop(),ze=Pe.length?n:!1,!Pe.length&&X){var m=X;X=null,Xe(e,m)}}}var tt={Return:"CR",Backspace:"BS",Delete:"Del",Escape:"Esc",Insert:"Ins",ArrowLeft:"Left",ArrowRight:"Right",ArrowUp:"Up",ArrowDown:"Down",Enter:"CR"," ":"Space"},gr={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1},Ke={};"Left|Right|Up|Down|End|Home".split("|").concat(Object.keys(tt)).forEach(function(e){Ke[(tt[e]||"").toLowerCase()]=Ke[e.toLowerCase()]=e});function We(e,t){var r=e.key;if(!gr[r]){r.length>1&&r[0]=="n"&&(r=r.replace("Numpad","")),r=tt[r]||r;var n="";if(e.ctrlKey&&(n+="C-"),e.altKey&&(n+="A-"),e.metaKey&&(n+="M-"),f.isMac&&n=="A-"&&r.length==1&&(n=n.slice(2)),(n||r.length>1)&&e.shiftKey&&(n+="S-"),t&&!t.expectLiteralNext&&r.length==1){if(x.keymap&&r in x.keymap)(x.remapCtrl!=!1||!n)&&(r=x.keymap[r]);else if(r.charCodeAt(0)>128&&!y[r]){var i=e.code?.slice(-1)||"";e.shiftKey||(i=i.toLowerCase()),i&&(r=i,!n&&e.altKey&&(n="A-"))}}return n+=r,n.length>1&&(n="<"+n+">"),n}}function mt(e,t){x.string!==e&&(x=Ct(e)),x.remapCtrl=t}function Ct(e){let t={};if(!e)return{keymap:t,string:""};function r(n){return n.split(/\\?(.)/).filter(Boolean)}return e.split(/((?:[^\\,]|\\.)+),/).map(n=>{if(!n)return;const i=n.split(/((?:[^\\;]|\\.)+);/);if(i.length==3){const o=r(i[1]),s=r(i[2]);if(o.length!==s.length)return;for(let l=0;l<o.length;++l)t[o[l]]=s[l]}else if(i.length==1){const o=r(n);if(o.length%2!==0)return;for(let s=0;s<o.length;s+=2)t[o[s]]=o[s+1]}}),{keymap:t,string:e}}Be("langmap",void 0,"string",["lmap"],function(e,t){if(e===void 0)return x.string;mt(e)});class kt{constructor(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=void 0,this.changeQueue=null}pushRepeatDigit(t){this.operator?this.motionRepeat=this.motionRepeat.concat(t):this.prefixRepeat=this.prefixRepeat.concat(t)}getRepeat(){var t=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(t=1,this.prefixRepeat.length>0&&(t*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(t*=parseInt(this.motionRepeat.join(""),10))),t}}function Y(e,t){e.state.vim.inputState=new kt,e.state.vim.expectLiteralNext=!1,f.signal(e,"vim-command-done",t)}function yr(){this.removed=[],this.inserted=""}class ke{constructor(t,r,n){this.clear(),this.keyBuffer=[t||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!r,this.blockwise=!!n}setText(t,r,n){this.keyBuffer=[t||""],this.linewise=!!r,this.blockwise=!!n}pushText(t,r){r&&(this.linewise||this.keyBuffer.push(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{dg as M,dX as V,dY as Y,dZ as X,d_ as j,eB as K,eC as Z,eD as $,eE as J,e0 as Q}from"./SessionSwitcherDropdown-DNjCJjzF.js";import{b as ee,m as p,x as I,A as ne,a as G,y as te,z as C}from"./computeVirtualFileMetrics-BcVuV0Ic.js";import{t as ie}from"./vendor-hast-util-to-html-BKBhbTDb.js";function U(e,n,t){if(e===n||e==null||n==null)return e===n;const i=new Set(t),a=Object.keys(e),r=new Set(Object.keys(n));for(const s of a)if(r.delete(s),!i.has(s)&&(!(s in n)||e[s]!==n[s]))return!1;for(const s of Array.from(r))if(!i.has(s))return!1;return!0}function Te(e,n){const t=e?.theme??M,i=n?.theme??M,a=R(e),r=R(n);return ee(t,i)&&U(e,n,["theme","parseDiffOptions"])&&U(a,r)}function R(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function H(e,n){return e?.start===n?.start&&e?.end===n?.end&&e?.side===n?.side&&e?.endSide===n?.endSide}function ae(){return p({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[I({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function re(e,n){return e.lineNumber===n.lineNumber&&e.side===n.side}var Ie=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;activeLineHighlightSide;activeLineNumberOnly=!1;editorAttached=!1;proposedSelectedRange;renderedSelectionRange;selectionAnchor;queuedSelectionRender;pointerSession={mode:"idle"};constructor(e,n){this.mode=e,this.options=n}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();const{usesCustomGutterUtility:n=!1,enableGutterUtility:t=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),t?this.ensureGutterUtilityNode(n):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode==="gutterSelecting"&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectionRange=void 0}setEditorAttached(e){this.editorAttached!==e&&(this.editorAttached=e,this.setSelectionDirty(),this.renderSelection())}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e,n){const t=!(e===this.selectedRange||H(e??void 0,this.selectedRange??void 0));!this.isSelectionDirty()&&!t||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.activeLineHighlightSide=n?.activeLineSide,this.activeLineNumberOnly=n?.lineNumberOnly??!1,this.renderSelection(),this.placeUtility(),t&&n?.notify!==!1&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{const e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode==="diff"&&e.type==="diff-line")return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode==="file"&&e.type==="line")return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{const{onHunkExpand:n,onLineClick:t,onLineNumberClick:i,onTokenClick:a,onMergeConflictActionClick:r}=this.options;n==null&&t==null&&i==null&&r==null&&a==null||this.options.onGutterUtilityClick!=null&&E(e.composedPath())||(k(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:n="disabled",onLineEnter:t,onLineLeave:i,onTokenEnter:a,onTokenLeave:r,enableGutterUtility:s=!1}=this.options;n==="disabled"&&!s&&t==null&&i==null&&a==null&&r==null||(k(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{const{__debugPointerEvents:n}=this.options;if(k(n,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){k(n,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:n}){const{__debugPointerEvents:t}=this.options,i=n.composedPath();k(t,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const a=this.resolvePointerTarget(i);k(t,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",a);const{onLineClick:r,onLineNumberClick:s,onLineEnter:l,onLineLeave:o,onTokenClick:d,onTokenEnter:c,onTokenLeave:m,onHunkExpand:h,onMergeConflictActionClick:f}=this.options;switch(e){case"move":{const u=T(a)&&this.hoveredLine?.lineElement===a.lineElement;A(a)&&this.hoveredToken?.tokenElement===a.tokenElement||(this.hoveredToken!=null&&(m?.(this.hoveredToken,n),this.clearHoveredToken()),A(a)&&(this.setHoveredToken(this.toTokenEventBaseProps(a)),c?.(this.hoveredToken,n))),u||(this.hoveredLine!=null&&(o?.({...this.hoveredLine,event:n}),this.clearHoveredLine()),T(a)?(this.setHoveredLine(this.toEventBaseProps(a)),this.placeUtility(),l?.({...this.hoveredLine,event:n})):this.placeUtility());break}case"click":{if(a==null)break;if(de(a)&&f!=null){f(a);break}if(se(a)&&h!=null){h(a.hunkIndex,a.all||n.shiftKey?"both":a.direction,a.all||n.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!T(a))break;A(a)&&d!=null&&d(this.toTokenEventBaseProps(a),n);const u=this.toEventBaseProps(a);s!=null&&a.numberColumn?s({...u,event:n}):r?.({...u,event:n});break}}}syncPointerListeners(e){const{__debugPointerEvents:n,lineHoverHighlight:t="disabled",onLineClick:i,onLineNumberClick:a,onLineEnter:r,onLineLeave:s,onTokenClick:l,onTokenEnter:o,onTokenLeave:d,onHunkExpand:c,onMergeConflictActionClick:m,enableGutterUtility:h=!1,enableLineSelection:f=!1,onGutterUtilityClick:u}=this.options,v=u!=null,b=t!=="disabled"||i!=null||a!=null||r!=null||s!=null||l!=null||o!=null||d!=null||c!=null||m!=null||h||f||v;b&&!this.hasPointerListeners?(e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,k(n,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const x=[];return(n==="both"||n==="click")&&(i!=null&&x.push("onLineClick"),a!=null&&x.push("onLineNumberClick"),c!=null&&x.push("expandable hunk separators"),m!=null&&x.push("merge conflict actions")),x})()),k(n,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),k(n,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!b&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);const g=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",y=this.pointerSession.mode==="gutterSelecting";(!f&&g||!v&&y)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:n,enableLineSelection:t=!1}=this.options,i=e!=null,a=n!=null||t;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),a&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!a&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType==="mouse"&&e.button!==0||this.pre==null||this.pointerSession.mode!=="idle")return;const n=e.composedPath();E(n)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(n),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){const{enableLineSelection:n=!1}=this.options;if(!n)return;const t=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(t==null)return;const{pre:i}=this;if(i==null)return;e.preventDefault();const{lineNumber:a,eventSide:r,lineIndex:s}=t;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(l==null)return;const o=l.start<=l.end?s>=l.start:s<=l.end;this.selectionAnchor={lineNumber:o?this.selectedRange.start:this.selectedRange.end,side:o?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(a,r,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===a&&this.selectedRange?.end===a){const l={lineNumber:a,side:r};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:a,side:r},this.updateSelection(a,r,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{enableLineSelection:n=!1,onGutterUtilityClick:t}=this.options;if(t==null)return;const i=this.currentSelectionEnds(),a=i?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),r=i?.top??a;a==null||r==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:r,current:a},n&&(this.selectionAnchor={lineNumber:r.lineNumber,side:r.side},this.updateSelection(a.lineNumber,a.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{const{enableLineSelection:n=!1}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(t==null)return;this.pointerSession.current=t,n===!0&&this.updateSelection(t.lineNumber,t.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;const i={lineNumber:t.lineNumber,side:t.eventSide};if(re(this.pointerSession.pending,i))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{const{enableLineSelection:n=!1,onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(this.pointerSession.current=i,n&&this.updateSelection(i.lineNumber,i.side)),t?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,n&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){const{lineHoverHighlight:n="disabled"}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,n!=="disabled"&&((n==="both"||n==="line")&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),(n==="both"||n==="number")&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer==null&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot==null&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){const n=document.createElement("div");n.innerHTML=ie(ae());const t=n.firstElementChild;if(!(t instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const n=this.resolvePointerTarget(e);w(n)&&n.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(n))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const n=this.targetForSelectionPoint(e.bottom);return n==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(n)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const n={lineNumber:e.start,side:e.side},t={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(n),a=this.selectionPointRowIndex(t);if(!(i==null||a==null))return i>a?{top:t,bottom:n}:{top:n,bottom:t}}selectionPointRowIndex(e){const n=this.getLineIndex(e.lineNumber,e.side);if(n!=null)return this.isSplitDiff()?n[1]:n[0]}targetForSelectionPoint(e){if(this.pre==null)return;const n=this.getLineIndex(e.lineNumber,e.side);if(n==null)return;const t=this.mode==="diff"?`${n[0]},${n[1]}`:`${n[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${t}"]`);for(const a of i){if(!(a instanceof HTMLElement))continue;const r=this.resolvePointerTarget(L(a));if(w(r)&&!(this.mode==="diff"&&e.side!=null&&r.side!==e.side))return r}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,n){const t=this.resolvePointerTarget(e);if(w(t)&&!(n&&!t.numberColumn)&&t.splitLineIndex!=null)return{lineIndex:t.splitLineIndex,lineNumber:t.lineNumber,eventSide:this.mode==="diff"?t.side:void 0}}resolveSelectionInfo(e,n){const t=this.resolveSelectionPath(e,n);return t!=null?this.selectionInfoFromPath(t,n.requireNumberColumn):void 0}selectionPointFromPath(e){const n=this.resolvePointerTarget(e);if(w(n))return{lineNumber:n.lineNumber,side:this.mode==="diff"?n.side:void 0}}resolveSelectionPoint(e,n){const t=this.resolveSelectionPath(e,n);return t!=null?this.selectionPointFromPath(t):void 0}resolveSelectionPath(e,n){const t=n.excludeUtility!==!1;switch(n.source){case"event-path":return this.pathFromEventPath(e.composedPath(),t);case"coordinates-first":{const i=this.pathFromCoordinates(e,t);return i!==void 0?i??void 0:this.pathFromEventPath(e.composedPath(),t)}}}pathFromCoordinates(e,n){const t=this.hitTest(e);if(t!==void 0)return t===null?null:this.pathFromElement(t,n)??null}pathFromEventPath(e,n){if(!(n&&E(e))){for(const t of e)if(t instanceof Element)return this.pathFromElement(t,n)}}pathFromElement(e,n){const t=L(e);if(n&&E(t))return;const i=fe(e);return i!=null?L(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const n=ue(ce(e));if(n==null)return;const t=this.targetForSelectionPoint(n);return t!=null?L(t.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const n=this.pre?.getRootNode(),t=z(n)?n:z(document)?document:void 0;if(t!=null)return t.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,n){const{getLineIndex:t}=this.options;return t!=null?t(e,n):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,n,t=!0){const i=this.getCurrentSelectionRange();let a;if(e==null)a=null;else{const r=this.selectionAnchor?.side??n,s=this.selectionAnchor?.lineNumber??e;a=this.buildSelectionRange(s,e,r,n)}H(i??void 0,a??void 0)||(this.activeLineHighlightSide=void 0,this.activeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=a:(this.selectedRange=a,this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection)),this.placeUtility(),t&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,n){if(this.pre==null)return;const t=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return t!=null&&i!=null?{start:n?t[1]:t[0],end:n?i[1]:i[0]}:void 0}highlightLineNumberOnly(){return this.activeLineHighlightSide!=null?this.activeLineNumberOnly:this.activeLineNumberOnly||this.editorAttached}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;const e=this.pre.querySelectorAll("[data-selected-line]");for(const o of e)o.removeAttribute("data-selected-line");if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;const{children:n}=this.pre;if(n.length===0)return;if(n.length>2)throw console.error(n),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const t=this.pre.getAttribute("data-diff-type")==="split",i=this.getIndexesFromSelection(this.selectedRange,t);if(i==null)throw console.error({rowRange:i,selectedRange:this.selectedRange}),new Error("InteractionManager.renderSelection: No valid rowRange");const a=i.start===i.end,r=Math.min(i.start,i.end),s=Math.max(i.start,i.end),l=this.highlightLineNumberOnly();for(const o of n){const d=this.activeLineHighlightSide;if(d!=null&&(d==="additions"&&o.hasAttribute("data-deletions")||d==="deletions"&&o.hasAttribute("data-additions")))continue;const[c,m]=o.children,h=m.children.length;if(h!==c.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");for(let f=0;f<h;f++){const u=m.children[f],v=c.children[f];if(!(u instanceof HTMLElement)||!(v instanceof HTMLElement))continue;const b=this.parseLineIndex(u,t);if((b??0)>s)break;if(b==null||b<r)continue;let g=a?"single":b===r?"first":b===s?"last":"";v.setAttribute("data-selected-line",g),!l&&(u.setAttribute("data-selected-line",g),v.nextSibling instanceof HTMLElement&&u.nextSibling instanceof HTMLElement&&(u.nextSibling.hasAttribute("data-line-annotation")||u.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(a?(g="last",u.setAttribute("data-selected-line","first")):b===r?g="":b===s&&u.setAttribute("data-selected-line",""),u.nextSibling.setAttribute("data-selected-line",g),v.nextSibling.setAttribute("data-selected-line",g)))}}};notifySelectionCommitted(){this.options.onLineSelected?.(this.getCurrentSelectionRange()??null)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode==="file"?{type:"line",lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:"diff-line",annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:n,lineNumber:t,side:i,tokenElement:a,tokenText:r}){return this.mode==="file"?{type:"token",lineCharEnd:e,lineCharStart:n,lineNumber:t,tokenElement:a,tokenText:r}:{type:"token",lineCharEnd:e,lineCharStart:n,lineNumber:t,side:i,tokenElement:a,tokenText:r}}buildSelectedLineRange(e,n){return this.buildSelectionRange(e.lineNumber,n.lineNumber,e.side,n.side)}buildSelectionRange(e,n,t,i){return{start:e,end:n,...t!=null?{side:t}:{},...t!==i&&i!=null?{endSide:i}:{}}}resolvePointerTarget(e){let n=!1,t,i,a,r,s,l,o,d,c,m;for(const f of e){if(!(f instanceof HTMLElement))continue;if(m==null&&f.hasAttribute("data-merge-conflict-action")){const g=f.getAttribute("data-merge-conflict-action")??void 0,y=f.getAttribute("data-merge-conflict-conflict-index")??void 0,x=y!=null?Number.parseInt(y,10):NaN;le(g)&&Number.isFinite(x)&&(m={kind:"merge-conflict-action",resolution:g,conflictIndex:x})}if(l==null&&f.hasAttribute("data-char")){l=f;const g=f.getAttribute("data-char");if(g!=null){const y=Number.parseInt(g,10);if(!Number.isNaN(y)){const x=f.textContent??"",N=y+x.length;(x.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)&&(o={tokenElement:l,lineCharStart:y,lineCharEnd:N,tokenText:x});continue}}}const u=s==null?f.getAttribute("data-column-number")??void 0:void 0;if(u!=null){s=f,c=Number.parseInt(u,10),n=!0,t=O(f),r=f.getAttribute("data-line-index")??void 0;continue}const v=a==null?f.getAttribute("data-line")??void 0:void 0;if(v!=null){a=f,c=Number.parseInt(v,10),t=O(f),r=f.getAttribute("data-line-index")??void 0;continue}if(d==null&&(f.hasAttribute("data-expand-button")||f.hasAttribute("data-unmodified-lines"))){d={hunkIndex:void 0,direction:f.hasAttribute("data-expand-up")?"up":f.hasAttribute("data-expand-down")?"down":"both",all:f.hasAttribute("data-expand-all-button")};continue}const b=d!=null?f.getAttribute("data-expand-index")??void 0:void 0;if(d!=null&&b!=null){const g=Number.parseInt(b,10);Number.isNaN(g)||(d.hunkIndex=g);continue}if(i==null&&f.hasAttribute("data-code")){i=f;break}}if(m!=null)return m;if(d?.hunkIndex!=null)return{type:"line-info",hunkIndex:d.hunkIndex,direction:d.direction,all:d.all};if(a??=r!=null?D(i,`[data-line][data-line-index="${r}"]`):void 0,s??=r!=null?D(i,`[data-column-number][data-line-index="${r}"]`):void 0,i==null||a==null||s==null||t==null||c==null||Number.isNaN(c))return;const h=this.parseLineIndex(a,this.isSplitDiff());return o!=null?this.mode==="file"?{kind:"token",lineType:t,lineElement:a,lineNumber:c,numberColumn:n,numberElement:s,side:void 0,splitLineIndex:h,...o}:{kind:"token",lineType:t,lineElement:a,lineNumber:c,numberColumn:n,numberElement:s,side:F(t,i),splitLineIndex:h,...o}:this.mode==="file"?{kind:"line",lineType:t,lineElement:a,lineNumber:c,numberColumn:n,numberElement:s,side:void 0,splitLineIndex:h}:{kind:"line",lineType:t,lineElement:a,lineNumber:c,numberColumn:n,numberElement:s,side:F(t,i),splitLineIndex:h}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(e,n){const t=(e.getAttribute("data-line-index")??"").split(",").map(i=>Number.parseInt(i,10)).filter(i=>!Number.isNaN(i));if(n&&t.length===2)return t[1];if(!n)return t[0]}};function Me({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:n,lineHoverHighlight:t,onGutterUtilityClick:i,onLineClick:a,onLineEnter:r,onLineLeave:s,onLineNumberClick:l,onTokenClick:o,onTokenEnter:d,onTokenLeave:c,renderGutterUtility:m,__debugPointerEvents:h,enableLineSelection:f,controlledSelection:u,onLineSelected:v,onLineSelectionStart:b,onLineSelectionChange:g,onLineSelectionEnd:y},x,N,W){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:oe({enableGutterUtility:n,renderGutterUtility:m,onGutterUtilityClick:i}),usesCustomGutterUtility:m!=null,lineHoverHighlight:t,onGutterUtilityClick:i,onHunkExpand:x,onMergeConflictActionClick:W,onLineClick:a,onLineEnter:r,onLineLeave:s,onLineNumberClick:l,onTokenClick:o,onTokenEnter:d,onTokenLeave:c,__debugPointerEvents:h,enableLineSelection:f,controlledSelection:u,onLineSelected:v,onLineSelectionStart:b,onLineSelectionChange:g,onLineSelectionEnd:y,getLineIndex:N}}function oe({enableGutterUtility:e,renderGutterUtility:n,onGutterUtilityClick:t}){if(t!=null&&n!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function w(e){return e!=null&&"kind"in e&&e.kind==="line"}function A(e){return e!=null&&"kind"in e&&e.kind==="token"}function T(e){return w(e)||A(e)}function se(e){return"type"in e&&e.type==="line-info"}function de(e){return"kind"in e&&e.kind==="merge-conflict-action"}function le(e){return e==="current"||e==="incoming"||e==="both"}function D(e,n){const t=e?.querySelector(n);return t instanceof HTMLElement?t:void 0}function L(e){const n=[];let t=e;for(;t!=null;)n.push(t),t=t.parentNode;return n}function fe(e){const n=e.closest("[data-line], [data-column-number]");if(n instanceof HTMLElement)return n;const t=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(t instanceof HTMLElement))return;const i=t.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}function ce(e){const n=e.closest('[slot^="annotation-"]');if(n instanceof HTMLElement)return n.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const t=e.getAttribute("name")??void 0;return t!=null&&t.startsWith("annotation-")?t:void 0}}function ue(e){if(e==null)return;const n=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(n==null)return;const t=Number.parseInt(n[2],10);if(!(!Number.isFinite(t)||t<=0))return{lineNumber:t,side:n[1]}}function z(e){return e!=null&&typeof e.elementFromPoint=="function"}function F(e,n){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return n.hasAttribute("data-deletions")?"deletions":"additions"}}function O(e){const n=e.getAttribute("data-line-type");if(n!=null)switch(n){case"change-deletion":case"change-addition":case"context":case"context-expanded":return n;default:return}}function E(e){for(const n of e)if(n instanceof HTMLElement&&(n.hasAttribute("data-utility-button")||n.hasAttribute("data-gutter-utility-slot")||n.getAttribute("slot")==="gutter-utility-slot"||n.getAttribute("name")==="gutter-utility-slot"))return!0;return!1}function k(e="none",n,...t){switch(e){case"none":return;case"both":break;case"click":if(n!=="click")return;break;case"move":if(n!=="move")return;break}console.log(...t)}var Ue=class S{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){const n=S.resizeObserver??new ResizeObserver(S.handleSharedResizeEntries);return S.resizeObserver=n,n}static handleSharedResizeEntries(n){const t=new Map;for(const i of n){const a=S.managersByElement.get(i.target);if(a==null)continue;const r=t.get(a);r==null?t.set(a,[i]):r.push(i)}for(const[i,a]of t)i.handleResizeEntries(a)}observedNodes=new Map;setup(n,t){const i=new Set;let a=0;const r=new Map(this.observedNodes);this.observedNodes.clear();for(const s of n.children){if(a===2)break;const l=(()=>{if(s instanceof HTMLElement&&s.tagName==="CODE")return s})();if(l==null)continue;a++;let o=r.get(l);if(o!=null&&o.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let d=l.firstElementChild;d instanceof HTMLElement||(d=null),o!=null?(this.observedNodes.set(l,o),r.delete(l),o.numberElement!==d?(o.numberElement!=null&&(this.unobserve(o.numberElement),r.delete(o.numberElement)),d!=null&&(this.observe(d),r.delete(d),this.observedNodes.set(d,o)),o.numberElement=d,o.numberWidth=0):o.numberElement!=null?(r.delete(o.numberElement),this.observedNodes.set(o.numberElement,o)):o.numberWidth=0):(o={type:"code",codeElement:l,numberElement:d,codeWidth:"auto",numberWidth:0},this.observedNodes.set(l,o),this.observe(l),d!=null&&(this.observedNodes.set(d,o),this.observe(d)))}if(a>1&&!t){const s=n.querySelectorAll('[data-line-annotation*=","]'),l=new Map;for(const o of s){if(!(o instanceof HTMLElement))continue;const d=o.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(d)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:d,element:o});continue}let c=l.get(d);c==null&&(c=[],l.set(d,c)),c.push(o)}for(const[o,d]of l){if(d.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",o,d);continue}const[c,m]=d,h=c.firstElementChild,f=m.firstElementChild;if(!(c instanceof HTMLElement)||!(m instanceof HTMLElement)||!(h instanceof HTMLElement)||!(f instanceof HTMLElement))continue;let u=r.get(h);if(u!=null){this.observedNodes.set(h,u),this.observedNodes.set(f,u),r.delete(h),r.delete(f);continue}const v=h.getBoundingClientRect().height,b=f.getBoundingClientRect().height;u={type:"annotations",column1:{container:c,child:h,childHeight:v},column2:{container:m,child:f,childHeight:b},currentHeight:"auto"},i.add({child1:h,child2:f,item:u,newHeight:Math.max(v,b)})}for(const o of i)this.applyNewHeight(o.item,o.newHeight),this.observedNodes.set(o.child1,o.item),this.observedNodes.set(o.child2,o.item),this.observe(o.child1),this.observe(o.child2);i.clear()}for(const[s,l]of r)this.unobserve(s),l.type==="code"?ge(l):pe(l);r.clear()}cleanUp(){for(const n of this.observedNodes.keys())this.unobserve(n);this.observedNodes.clear()}observe(n){const{managersByElement:t}=S,i=t.get(n);if(i!==this){if(i!=null&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");t.set(n,this),S.getResizeObserver().observe(n)}}unobserve(n){const{managersByElement:t,resizeObserver:i}=S,a=t.get(n);if(a!=null){if(a!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");t.delete(n),i?.unobserve(n),i!=null&&t.size===0&&(i.disconnect(),S.resizeObserver=void 0)}}handleResizeEntries(n){const t=new Map,i=new Set;for(const a of n){const{target:r,borderBoxSize:s,contentBoxSize:l}=a;if(!(r instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",a);continue}const o=this.observedNodes.get(r);if(o==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",a);continue}if(o.type==="annotations"){const d=(()=>{if(r===o.column1.child)return o.column1;if(r===o.column2.child)return o.column2})();if(d==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:o,target:r});continue}d.childHeight=s[0].blockSize,i.add(o)}else if(o.type==="code"){const d=t.get(o)??{},c=l[0].inlineSize;r===o.codeElement?d.codeInlineSize=c:r===o.numberElement&&(d.numberInlineSize=c),t.set(o,d)}}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(n){for(const t of n)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=n=>{for(const[t,i]of n){const a=i.codeInlineSize!=null?he(i.codeInlineSize):t.codeWidth,r=i.numberInlineSize!=null?me(i.numberInlineSize):t.numberWidth,s=a!==t.codeWidth,l=r!==t.numberWidth;if(!(!s&&!l)&&(t.codeWidth=a,t.numberWidth=r,s&&t.codeElement.style.setProperty("--diffs-column-width",`${typeof a=="number"?`${a}px`:"auto"}`),l&&t.codeElement.style.setProperty("--diffs-column-number-width",`${r===0?"auto":`${r}px`}`),s||l&&a!=="auto")){const o=typeof a=="number"?Math.max(a-r,0):0;t.codeElement.style.setProperty("--diffs-column-content-width",`${o>0?`${o}px`:"auto"}`)}}};applyNewHeight(n,t){t!==n.currentHeight&&(n.currentHeight=Math.max(t,0),n.column1.container.style.setProperty("--diffs-annotation-min-height",`${n.currentHeight}px`),n.column2.container.style.setProperty("--diffs-annotation-min-height",`${n.currentHeight}px`))}};function he(e){const n=Math.max(Math.floor(e),0);return n===0?"auto":n}function me(e){return Math.max(Math.ceil(e),0)}function ge(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width"))}function pe(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}function Re(e){for(const n of Array.isArray(e)?e:[e])if(!(n==="text"||n==="ansi")&&!ne.has(n))return!1;return!0}function He(e){for(const n of G(e))if(!te.has(n))return!1;return!0}function De(e,n){return e==null||n==null?e===n:e.startingLine===n.startingLine&&e.totalLines===n.totalLines&&e.bufferBefore===n.bufferBefore&&e.bufferAfter===n.bufferAfter}function ze(e){return p({tagName:"div",children:[p({tagName:"div",children:e.annotations?.map(n=>p({tagName:"slot",properties:{name:n}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function be(e){switch(e){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}function Fe({fileOrDiff:e,mode:n,stickyHeader:t}){const i="type"in e?e:void 0,a={"data-diffs-header":n,"data-change-type":i?.type,"data-sticky":t?"":void 0};return p({tagName:"div",children:[n==="custom"?p({tagName:"slot",properties:{name:V}}):ve({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),...n==="custom"?[]:[xe(i)]],properties:a})}function ve({name:e,prevName:n,iconType:t}){const i=[p({tagName:"slot",properties:{name:Y}}),I({name:be(t),properties:{"data-change-icon":t}})];return n!=null&&(i.push(p({tagName:"div",children:[p({tagName:"bdi",children:[C(n)]})],properties:{"data-prev-name":""}})),i.push(I({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(p({tagName:"div",children:[p({tagName:"bdi",children:[C(e)]})],properties:{"data-title":""}})),i.push(p({tagName:"slot",properties:{name:X}})),p({tagName:"div",children:i,properties:{"data-header-content":""}})}function xe(e){const n=[];if(e!=null){let t=0,i=0;for(const a of e.hunks)t+=a.additionLines,i+=a.deletionLines;(i>0||t===0)&&n.push(p({tagName:"span",children:[C(`-${i}`)],properties:{"data-deletions-count":""}})),(t>0||i===0)&&n.push(p({tagName:"span",children:[C(`+${t}`)],properties:{"data-additions-count":""}}))}return n.push(p({tagName:"slot",properties:{name:j}})),p({tagName:"div",children:n,properties:{"data-metadata":""}})}function Oe(e){return p({tagName:"pre",properties:ye(e)})}function ye({diffIndicators:e,disableBackground:n,disableLineNumbers:t,overflow:i,split:a,totalLines:r,type:s,customProperties:l}){return{...l,"data-diff":s==="diff"?"":void 0,"data-file":s==="file"?"":void 0,"data-diff-type":s==="diff"?a?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":t?"":void 0,"data-background":n?void 0:"","data-indicators":e==="bars"||e==="classic"?e:void 0,tabIndex:0,style:`--diffs-min-number-column-width-default:${`${r}`.length}ch;`}}function Be(e,{theme:n,preferredHighlighter:t="shiki-js"}){return{langs:[e??"text"],themes:G(n),preferredHighlighter:t}}function $e(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}const Ge="-1,-1";function _e(e){return e?.some(n=>n.lineNumber===0)??!1}function qe(e){const n=e[0];return n!=null&&n.length>0?n:void 0}function We(e){return e.startingLine===0&&e.totalLines>0}function Ve(e,n){return p({tagName:"div",children:e,properties:{"data-content":"",style:`grid-row: span ${n}`}})}function Ye(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}const Xe=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1
|
+
import{dd as M,dU as V,dV as Y,dW as X,dX as j,ey as K,ez as Z,eA as $,eB as J,dZ as Q}from"./SessionSwitcherDropdown-C0OdvirK.js";import{b as ee,m as p,x as I,A as ne,a as G,y as te,z as C}from"./computeVirtualFileMetrics-BPgZ_RSe.js";import{t as ie}from"./vendor-hast-util-to-html-BKBhbTDb.js";function U(e,n,t){if(e===n||e==null||n==null)return e===n;const i=new Set(t),a=Object.keys(e),r=new Set(Object.keys(n));for(const s of a)if(r.delete(s),!i.has(s)&&(!(s in n)||e[s]!==n[s]))return!1;for(const s of Array.from(r))if(!i.has(s))return!1;return!0}function Te(e,n){const t=e?.theme??M,i=n?.theme??M,a=R(e),r=R(n);return ee(t,i)&&U(e,n,["theme","parseDiffOptions"])&&U(a,r)}function R(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function H(e,n){return e?.start===n?.start&&e?.end===n?.end&&e?.side===n?.side&&e?.endSide===n?.endSide}function ae(){return p({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[I({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function re(e,n){return e.lineNumber===n.lineNumber&&e.side===n.side}var Ie=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;activeLineHighlightSide;activeLineNumberOnly=!1;editorAttached=!1;proposedSelectedRange;renderedSelectionRange;selectionAnchor;queuedSelectionRender;pointerSession={mode:"idle"};constructor(e,n){this.mode=e,this.options=n}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();const{usesCustomGutterUtility:n=!1,enableGutterUtility:t=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),t?this.ensureGutterUtilityNode(n):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode==="gutterSelecting"&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectionRange=void 0}setEditorAttached(e){this.editorAttached!==e&&(this.editorAttached=e,this.setSelectionDirty(),this.renderSelection())}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e,n){const t=!(e===this.selectedRange||H(e??void 0,this.selectedRange??void 0));!this.isSelectionDirty()&&!t||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.activeLineHighlightSide=n?.activeLineSide,this.activeLineNumberOnly=n?.lineNumberOnly??!1,this.renderSelection(),this.placeUtility(),t&&n?.notify!==!1&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{const e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode==="diff"&&e.type==="diff-line")return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode==="file"&&e.type==="line")return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{const{onHunkExpand:n,onLineClick:t,onLineNumberClick:i,onTokenClick:a,onMergeConflictActionClick:r}=this.options;n==null&&t==null&&i==null&&r==null&&a==null||this.options.onGutterUtilityClick!=null&&E(e.composedPath())||(k(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:n="disabled",onLineEnter:t,onLineLeave:i,onTokenEnter:a,onTokenLeave:r,enableGutterUtility:s=!1}=this.options;n==="disabled"&&!s&&t==null&&i==null&&a==null&&r==null||(k(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{const{__debugPointerEvents:n}=this.options;if(k(n,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){k(n,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:n}){const{__debugPointerEvents:t}=this.options,i=n.composedPath();k(t,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const a=this.resolvePointerTarget(i);k(t,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",a);const{onLineClick:r,onLineNumberClick:s,onLineEnter:l,onLineLeave:o,onTokenClick:d,onTokenEnter:c,onTokenLeave:m,onHunkExpand:h,onMergeConflictActionClick:f}=this.options;switch(e){case"move":{const u=T(a)&&this.hoveredLine?.lineElement===a.lineElement;A(a)&&this.hoveredToken?.tokenElement===a.tokenElement||(this.hoveredToken!=null&&(m?.(this.hoveredToken,n),this.clearHoveredToken()),A(a)&&(this.setHoveredToken(this.toTokenEventBaseProps(a)),c?.(this.hoveredToken,n))),u||(this.hoveredLine!=null&&(o?.({...this.hoveredLine,event:n}),this.clearHoveredLine()),T(a)?(this.setHoveredLine(this.toEventBaseProps(a)),this.placeUtility(),l?.({...this.hoveredLine,event:n})):this.placeUtility());break}case"click":{if(a==null)break;if(de(a)&&f!=null){f(a);break}if(se(a)&&h!=null){h(a.hunkIndex,a.all||n.shiftKey?"both":a.direction,a.all||n.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!T(a))break;A(a)&&d!=null&&d(this.toTokenEventBaseProps(a),n);const u=this.toEventBaseProps(a);s!=null&&a.numberColumn?s({...u,event:n}):r?.({...u,event:n});break}}}syncPointerListeners(e){const{__debugPointerEvents:n,lineHoverHighlight:t="disabled",onLineClick:i,onLineNumberClick:a,onLineEnter:r,onLineLeave:s,onTokenClick:l,onTokenEnter:o,onTokenLeave:d,onHunkExpand:c,onMergeConflictActionClick:m,enableGutterUtility:h=!1,enableLineSelection:f=!1,onGutterUtilityClick:u}=this.options,v=u!=null,b=t!=="disabled"||i!=null||a!=null||r!=null||s!=null||l!=null||o!=null||d!=null||c!=null||m!=null||h||f||v;b&&!this.hasPointerListeners?(e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,k(n,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const x=[];return(n==="both"||n==="click")&&(i!=null&&x.push("onLineClick"),a!=null&&x.push("onLineNumberClick"),c!=null&&x.push("expandable hunk separators"),m!=null&&x.push("merge conflict actions")),x})()),k(n,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),k(n,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!b&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);const g=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",y=this.pointerSession.mode==="gutterSelecting";(!f&&g||!v&&y)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:n,enableLineSelection:t=!1}=this.options,i=e!=null,a=n!=null||t;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),a&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!a&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType==="mouse"&&e.button!==0||this.pre==null||this.pointerSession.mode!=="idle")return;const n=e.composedPath();E(n)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(n),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){const{enableLineSelection:n=!1}=this.options;if(!n)return;const t=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(t==null)return;const{pre:i}=this;if(i==null)return;e.preventDefault();const{lineNumber:a,eventSide:r,lineIndex:s}=t;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(l==null)return;const o=l.start<=l.end?s>=l.start:s<=l.end;this.selectionAnchor={lineNumber:o?this.selectedRange.start:this.selectedRange.end,side:o?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(a,r,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===a&&this.selectedRange?.end===a){const l={lineNumber:a,side:r};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:a,side:r},this.updateSelection(a,r,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{enableLineSelection:n=!1,onGutterUtilityClick:t}=this.options;if(t==null)return;const i=this.currentSelectionEnds(),a=i?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),r=i?.top??a;a==null||r==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:r,current:a},n&&(this.selectionAnchor={lineNumber:r.lineNumber,side:r.side},this.updateSelection(a.lineNumber,a.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{const{enableLineSelection:n=!1}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(t==null)return;this.pointerSession.current=t,n===!0&&this.updateSelection(t.lineNumber,t.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;const i={lineNumber:t.lineNumber,side:t.eventSide};if(re(this.pointerSession.pending,i))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{const{enableLineSelection:n=!1,onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(this.pointerSession.current=i,n&&this.updateSelection(i.lineNumber,i.side)),t?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,n&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){const{lineHoverHighlight:n="disabled"}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,n!=="disabled"&&((n==="both"||n==="line")&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),(n==="both"||n==="number")&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer==null&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot==null&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){const n=document.createElement("div");n.innerHTML=ie(ae());const t=n.firstElementChild;if(!(t instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const n=this.resolvePointerTarget(e);w(n)&&n.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(n))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const n=this.targetForSelectionPoint(e.bottom);return n==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(n)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const n={lineNumber:e.start,side:e.side},t={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(n),a=this.selectionPointRowIndex(t);if(!(i==null||a==null))return i>a?{top:t,bottom:n}:{top:n,bottom:t}}selectionPointRowIndex(e){const n=this.getLineIndex(e.lineNumber,e.side);if(n!=null)return this.isSplitDiff()?n[1]:n[0]}targetForSelectionPoint(e){if(this.pre==null)return;const n=this.getLineIndex(e.lineNumber,e.side);if(n==null)return;const t=this.mode==="diff"?`${n[0]},${n[1]}`:`${n[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${t}"]`);for(const a of i){if(!(a instanceof HTMLElement))continue;const r=this.resolvePointerTarget(L(a));if(w(r)&&!(this.mode==="diff"&&e.side!=null&&r.side!==e.side))return r}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,n){const t=this.resolvePointerTarget(e);if(w(t)&&!(n&&!t.numberColumn)&&t.splitLineIndex!=null)return{lineIndex:t.splitLineIndex,lineNumber:t.lineNumber,eventSide:this.mode==="diff"?t.side:void 0}}resolveSelectionInfo(e,n){const t=this.resolveSelectionPath(e,n);return t!=null?this.selectionInfoFromPath(t,n.requireNumberColumn):void 0}selectionPointFromPath(e){const n=this.resolvePointerTarget(e);if(w(n))return{lineNumber:n.lineNumber,side:this.mode==="diff"?n.side:void 0}}resolveSelectionPoint(e,n){const t=this.resolveSelectionPath(e,n);return t!=null?this.selectionPointFromPath(t):void 0}resolveSelectionPath(e,n){const t=n.excludeUtility!==!1;switch(n.source){case"event-path":return this.pathFromEventPath(e.composedPath(),t);case"coordinates-first":{const i=this.pathFromCoordinates(e,t);return i!==void 0?i??void 0:this.pathFromEventPath(e.composedPath(),t)}}}pathFromCoordinates(e,n){const t=this.hitTest(e);if(t!==void 0)return t===null?null:this.pathFromElement(t,n)??null}pathFromEventPath(e,n){if(!(n&&E(e))){for(const t of e)if(t instanceof Element)return this.pathFromElement(t,n)}}pathFromElement(e,n){const t=L(e);if(n&&E(t))return;const i=fe(e);return i!=null?L(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const n=ue(ce(e));if(n==null)return;const t=this.targetForSelectionPoint(n);return t!=null?L(t.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const n=this.pre?.getRootNode(),t=z(n)?n:z(document)?document:void 0;if(t!=null)return t.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,n){const{getLineIndex:t}=this.options;return t!=null?t(e,n):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,n,t=!0){const i=this.getCurrentSelectionRange();let a;if(e==null)a=null;else{const r=this.selectionAnchor?.side??n,s=this.selectionAnchor?.lineNumber??e;a=this.buildSelectionRange(s,e,r,n)}H(i??void 0,a??void 0)||(this.activeLineHighlightSide=void 0,this.activeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=a:(this.selectedRange=a,this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection)),this.placeUtility(),t&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,n){if(this.pre==null)return;const t=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return t!=null&&i!=null?{start:n?t[1]:t[0],end:n?i[1]:i[0]}:void 0}highlightLineNumberOnly(){return this.activeLineHighlightSide!=null?this.activeLineNumberOnly:this.activeLineNumberOnly||this.editorAttached}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;const e=this.pre.querySelectorAll("[data-selected-line]");for(const o of e)o.removeAttribute("data-selected-line");if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;const{children:n}=this.pre;if(n.length===0)return;if(n.length>2)throw console.error(n),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const t=this.pre.getAttribute("data-diff-type")==="split",i=this.getIndexesFromSelection(this.selectedRange,t);if(i==null)throw console.error({rowRange:i,selectedRange:this.selectedRange}),new Error("InteractionManager.renderSelection: No valid rowRange");const a=i.start===i.end,r=Math.min(i.start,i.end),s=Math.max(i.start,i.end),l=this.highlightLineNumberOnly();for(const o of n){const d=this.activeLineHighlightSide;if(d!=null&&(d==="additions"&&o.hasAttribute("data-deletions")||d==="deletions"&&o.hasAttribute("data-additions")))continue;const[c,m]=o.children,h=m.children.length;if(h!==c.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");for(let f=0;f<h;f++){const u=m.children[f],v=c.children[f];if(!(u instanceof HTMLElement)||!(v instanceof HTMLElement))continue;const b=this.parseLineIndex(u,t);if((b??0)>s)break;if(b==null||b<r)continue;let g=a?"single":b===r?"first":b===s?"last":"";v.setAttribute("data-selected-line",g),!l&&(u.setAttribute("data-selected-line",g),v.nextSibling instanceof HTMLElement&&u.nextSibling instanceof HTMLElement&&(u.nextSibling.hasAttribute("data-line-annotation")||u.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(a?(g="last",u.setAttribute("data-selected-line","first")):b===r?g="":b===s&&u.setAttribute("data-selected-line",""),u.nextSibling.setAttribute("data-selected-line",g),v.nextSibling.setAttribute("data-selected-line",g)))}}};notifySelectionCommitted(){this.options.onLineSelected?.(this.getCurrentSelectionRange()??null)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode==="file"?{type:"line",lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:"diff-line",annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:n,lineNumber:t,side:i,tokenElement:a,tokenText:r}){return this.mode==="file"?{type:"token",lineCharEnd:e,lineCharStart:n,lineNumber:t,tokenElement:a,tokenText:r}:{type:"token",lineCharEnd:e,lineCharStart:n,lineNumber:t,side:i,tokenElement:a,tokenText:r}}buildSelectedLineRange(e,n){return this.buildSelectionRange(e.lineNumber,n.lineNumber,e.side,n.side)}buildSelectionRange(e,n,t,i){return{start:e,end:n,...t!=null?{side:t}:{},...t!==i&&i!=null?{endSide:i}:{}}}resolvePointerTarget(e){let n=!1,t,i,a,r,s,l,o,d,c,m;for(const f of e){if(!(f instanceof HTMLElement))continue;if(m==null&&f.hasAttribute("data-merge-conflict-action")){const g=f.getAttribute("data-merge-conflict-action")??void 0,y=f.getAttribute("data-merge-conflict-conflict-index")??void 0,x=y!=null?Number.parseInt(y,10):NaN;le(g)&&Number.isFinite(x)&&(m={kind:"merge-conflict-action",resolution:g,conflictIndex:x})}if(l==null&&f.hasAttribute("data-char")){l=f;const g=f.getAttribute("data-char");if(g!=null){const y=Number.parseInt(g,10);if(!Number.isNaN(y)){const x=f.textContent??"",N=y+x.length;(x.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)&&(o={tokenElement:l,lineCharStart:y,lineCharEnd:N,tokenText:x});continue}}}const u=s==null?f.getAttribute("data-column-number")??void 0:void 0;if(u!=null){s=f,c=Number.parseInt(u,10),n=!0,t=O(f),r=f.getAttribute("data-line-index")??void 0;continue}const v=a==null?f.getAttribute("data-line")??void 0:void 0;if(v!=null){a=f,c=Number.parseInt(v,10),t=O(f),r=f.getAttribute("data-line-index")??void 0;continue}if(d==null&&(f.hasAttribute("data-expand-button")||f.hasAttribute("data-unmodified-lines"))){d={hunkIndex:void 0,direction:f.hasAttribute("data-expand-up")?"up":f.hasAttribute("data-expand-down")?"down":"both",all:f.hasAttribute("data-expand-all-button")};continue}const b=d!=null?f.getAttribute("data-expand-index")??void 0:void 0;if(d!=null&&b!=null){const g=Number.parseInt(b,10);Number.isNaN(g)||(d.hunkIndex=g);continue}if(i==null&&f.hasAttribute("data-code")){i=f;break}}if(m!=null)return m;if(d?.hunkIndex!=null)return{type:"line-info",hunkIndex:d.hunkIndex,direction:d.direction,all:d.all};if(a??=r!=null?D(i,`[data-line][data-line-index="${r}"]`):void 0,s??=r!=null?D(i,`[data-column-number][data-line-index="${r}"]`):void 0,i==null||a==null||s==null||t==null||c==null||Number.isNaN(c))return;const h=this.parseLineIndex(a,this.isSplitDiff());return o!=null?this.mode==="file"?{kind:"token",lineType:t,lineElement:a,lineNumber:c,numberColumn:n,numberElement:s,side:void 0,splitLineIndex:h,...o}:{kind:"token",lineType:t,lineElement:a,lineNumber:c,numberColumn:n,numberElement:s,side:F(t,i),splitLineIndex:h,...o}:this.mode==="file"?{kind:"line",lineType:t,lineElement:a,lineNumber:c,numberColumn:n,numberElement:s,side:void 0,splitLineIndex:h}:{kind:"line",lineType:t,lineElement:a,lineNumber:c,numberColumn:n,numberElement:s,side:F(t,i),splitLineIndex:h}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(e,n){const t=(e.getAttribute("data-line-index")??"").split(",").map(i=>Number.parseInt(i,10)).filter(i=>!Number.isNaN(i));if(n&&t.length===2)return t[1];if(!n)return t[0]}};function Me({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:n,lineHoverHighlight:t,onGutterUtilityClick:i,onLineClick:a,onLineEnter:r,onLineLeave:s,onLineNumberClick:l,onTokenClick:o,onTokenEnter:d,onTokenLeave:c,renderGutterUtility:m,__debugPointerEvents:h,enableLineSelection:f,controlledSelection:u,onLineSelected:v,onLineSelectionStart:b,onLineSelectionChange:g,onLineSelectionEnd:y},x,N,W){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:oe({enableGutterUtility:n,renderGutterUtility:m,onGutterUtilityClick:i}),usesCustomGutterUtility:m!=null,lineHoverHighlight:t,onGutterUtilityClick:i,onHunkExpand:x,onMergeConflictActionClick:W,onLineClick:a,onLineEnter:r,onLineLeave:s,onLineNumberClick:l,onTokenClick:o,onTokenEnter:d,onTokenLeave:c,__debugPointerEvents:h,enableLineSelection:f,controlledSelection:u,onLineSelected:v,onLineSelectionStart:b,onLineSelectionChange:g,onLineSelectionEnd:y,getLineIndex:N}}function oe({enableGutterUtility:e,renderGutterUtility:n,onGutterUtilityClick:t}){if(t!=null&&n!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function w(e){return e!=null&&"kind"in e&&e.kind==="line"}function A(e){return e!=null&&"kind"in e&&e.kind==="token"}function T(e){return w(e)||A(e)}function se(e){return"type"in e&&e.type==="line-info"}function de(e){return"kind"in e&&e.kind==="merge-conflict-action"}function le(e){return e==="current"||e==="incoming"||e==="both"}function D(e,n){const t=e?.querySelector(n);return t instanceof HTMLElement?t:void 0}function L(e){const n=[];let t=e;for(;t!=null;)n.push(t),t=t.parentNode;return n}function fe(e){const n=e.closest("[data-line], [data-column-number]");if(n instanceof HTMLElement)return n;const t=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(t instanceof HTMLElement))return;const i=t.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}function ce(e){const n=e.closest('[slot^="annotation-"]');if(n instanceof HTMLElement)return n.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const t=e.getAttribute("name")??void 0;return t!=null&&t.startsWith("annotation-")?t:void 0}}function ue(e){if(e==null)return;const n=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(n==null)return;const t=Number.parseInt(n[2],10);if(!(!Number.isFinite(t)||t<=0))return{lineNumber:t,side:n[1]}}function z(e){return e!=null&&typeof e.elementFromPoint=="function"}function F(e,n){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return n.hasAttribute("data-deletions")?"deletions":"additions"}}function O(e){const n=e.getAttribute("data-line-type");if(n!=null)switch(n){case"change-deletion":case"change-addition":case"context":case"context-expanded":return n;default:return}}function E(e){for(const n of e)if(n instanceof HTMLElement&&(n.hasAttribute("data-utility-button")||n.hasAttribute("data-gutter-utility-slot")||n.getAttribute("slot")==="gutter-utility-slot"||n.getAttribute("name")==="gutter-utility-slot"))return!0;return!1}function k(e="none",n,...t){switch(e){case"none":return;case"both":break;case"click":if(n!=="click")return;break;case"move":if(n!=="move")return;break}console.log(...t)}var Ue=class S{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){const n=S.resizeObserver??new ResizeObserver(S.handleSharedResizeEntries);return S.resizeObserver=n,n}static handleSharedResizeEntries(n){const t=new Map;for(const i of n){const a=S.managersByElement.get(i.target);if(a==null)continue;const r=t.get(a);r==null?t.set(a,[i]):r.push(i)}for(const[i,a]of t)i.handleResizeEntries(a)}observedNodes=new Map;setup(n,t){const i=new Set;let a=0;const r=new Map(this.observedNodes);this.observedNodes.clear();for(const s of n.children){if(a===2)break;const l=(()=>{if(s instanceof HTMLElement&&s.tagName==="CODE")return s})();if(l==null)continue;a++;let o=r.get(l);if(o!=null&&o.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let d=l.firstElementChild;d instanceof HTMLElement||(d=null),o!=null?(this.observedNodes.set(l,o),r.delete(l),o.numberElement!==d?(o.numberElement!=null&&(this.unobserve(o.numberElement),r.delete(o.numberElement)),d!=null&&(this.observe(d),r.delete(d),this.observedNodes.set(d,o)),o.numberElement=d,o.numberWidth=0):o.numberElement!=null?(r.delete(o.numberElement),this.observedNodes.set(o.numberElement,o)):o.numberWidth=0):(o={type:"code",codeElement:l,numberElement:d,codeWidth:"auto",numberWidth:0},this.observedNodes.set(l,o),this.observe(l),d!=null&&(this.observedNodes.set(d,o),this.observe(d)))}if(a>1&&!t){const s=n.querySelectorAll('[data-line-annotation*=","]'),l=new Map;for(const o of s){if(!(o instanceof HTMLElement))continue;const d=o.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(d)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:d,element:o});continue}let c=l.get(d);c==null&&(c=[],l.set(d,c)),c.push(o)}for(const[o,d]of l){if(d.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",o,d);continue}const[c,m]=d,h=c.firstElementChild,f=m.firstElementChild;if(!(c instanceof HTMLElement)||!(m instanceof HTMLElement)||!(h instanceof HTMLElement)||!(f instanceof HTMLElement))continue;let u=r.get(h);if(u!=null){this.observedNodes.set(h,u),this.observedNodes.set(f,u),r.delete(h),r.delete(f);continue}const v=h.getBoundingClientRect().height,b=f.getBoundingClientRect().height;u={type:"annotations",column1:{container:c,child:h,childHeight:v},column2:{container:m,child:f,childHeight:b},currentHeight:"auto"},i.add({child1:h,child2:f,item:u,newHeight:Math.max(v,b)})}for(const o of i)this.applyNewHeight(o.item,o.newHeight),this.observedNodes.set(o.child1,o.item),this.observedNodes.set(o.child2,o.item),this.observe(o.child1),this.observe(o.child2);i.clear()}for(const[s,l]of r)this.unobserve(s),l.type==="code"?ge(l):pe(l);r.clear()}cleanUp(){for(const n of this.observedNodes.keys())this.unobserve(n);this.observedNodes.clear()}observe(n){const{managersByElement:t}=S,i=t.get(n);if(i!==this){if(i!=null&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");t.set(n,this),S.getResizeObserver().observe(n)}}unobserve(n){const{managersByElement:t,resizeObserver:i}=S,a=t.get(n);if(a!=null){if(a!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");t.delete(n),i?.unobserve(n),i!=null&&t.size===0&&(i.disconnect(),S.resizeObserver=void 0)}}handleResizeEntries(n){const t=new Map,i=new Set;for(const a of n){const{target:r,borderBoxSize:s,contentBoxSize:l}=a;if(!(r instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",a);continue}const o=this.observedNodes.get(r);if(o==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",a);continue}if(o.type==="annotations"){const d=(()=>{if(r===o.column1.child)return o.column1;if(r===o.column2.child)return o.column2})();if(d==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:o,target:r});continue}d.childHeight=s[0].blockSize,i.add(o)}else if(o.type==="code"){const d=t.get(o)??{},c=l[0].inlineSize;r===o.codeElement?d.codeInlineSize=c:r===o.numberElement&&(d.numberInlineSize=c),t.set(o,d)}}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(n){for(const t of n)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=n=>{for(const[t,i]of n){const a=i.codeInlineSize!=null?he(i.codeInlineSize):t.codeWidth,r=i.numberInlineSize!=null?me(i.numberInlineSize):t.numberWidth,s=a!==t.codeWidth,l=r!==t.numberWidth;if(!(!s&&!l)&&(t.codeWidth=a,t.numberWidth=r,s&&t.codeElement.style.setProperty("--diffs-column-width",`${typeof a=="number"?`${a}px`:"auto"}`),l&&t.codeElement.style.setProperty("--diffs-column-number-width",`${r===0?"auto":`${r}px`}`),s||l&&a!=="auto")){const o=typeof a=="number"?Math.max(a-r,0):0;t.codeElement.style.setProperty("--diffs-column-content-width",`${o>0?`${o}px`:"auto"}`)}}};applyNewHeight(n,t){t!==n.currentHeight&&(n.currentHeight=Math.max(t,0),n.column1.container.style.setProperty("--diffs-annotation-min-height",`${n.currentHeight}px`),n.column2.container.style.setProperty("--diffs-annotation-min-height",`${n.currentHeight}px`))}};function he(e){const n=Math.max(Math.floor(e),0);return n===0?"auto":n}function me(e){return Math.max(Math.ceil(e),0)}function ge(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width"))}function pe(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}function Re(e){for(const n of Array.isArray(e)?e:[e])if(!(n==="text"||n==="ansi")&&!ne.has(n))return!1;return!0}function He(e){for(const n of G(e))if(!te.has(n))return!1;return!0}function De(e,n){return e==null||n==null?e===n:e.startingLine===n.startingLine&&e.totalLines===n.totalLines&&e.bufferBefore===n.bufferBefore&&e.bufferAfter===n.bufferAfter}function ze(e){return p({tagName:"div",children:[p({tagName:"div",children:e.annotations?.map(n=>p({tagName:"slot",properties:{name:n}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function be(e){switch(e){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}function Fe({fileOrDiff:e,mode:n,stickyHeader:t}){const i="type"in e?e:void 0,a={"data-diffs-header":n,"data-change-type":i?.type,"data-sticky":t?"":void 0};return p({tagName:"div",children:[n==="custom"?p({tagName:"slot",properties:{name:V}}):ve({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),...n==="custom"?[]:[xe(i)]],properties:a})}function ve({name:e,prevName:n,iconType:t}){const i=[p({tagName:"slot",properties:{name:Y}}),I({name:be(t),properties:{"data-change-icon":t}})];return n!=null&&(i.push(p({tagName:"div",children:[p({tagName:"bdi",children:[C(n)]})],properties:{"data-prev-name":""}})),i.push(I({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(p({tagName:"div",children:[p({tagName:"bdi",children:[C(e)]})],properties:{"data-title":""}})),i.push(p({tagName:"slot",properties:{name:X}})),p({tagName:"div",children:i,properties:{"data-header-content":""}})}function xe(e){const n=[];if(e!=null){let t=0,i=0;for(const a of e.hunks)t+=a.additionLines,i+=a.deletionLines;(i>0||t===0)&&n.push(p({tagName:"span",children:[C(`-${i}`)],properties:{"data-deletions-count":""}})),(t>0||i===0)&&n.push(p({tagName:"span",children:[C(`+${t}`)],properties:{"data-additions-count":""}}))}return n.push(p({tagName:"slot",properties:{name:j}})),p({tagName:"div",children:n,properties:{"data-metadata":""}})}function Oe(e){return p({tagName:"pre",properties:ye(e)})}function ye({diffIndicators:e,disableBackground:n,disableLineNumbers:t,overflow:i,split:a,totalLines:r,type:s,customProperties:l}){return{...l,"data-diff":s==="diff"?"":void 0,"data-file":s==="file"?"":void 0,"data-diff-type":s==="diff"?a?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":t?"":void 0,"data-background":n?void 0:"","data-indicators":e==="bars"||e==="classic"?e:void 0,tabIndex:0,style:`--diffs-min-number-column-width-default:${`${r}`.length}ch;`}}function Be(e,{theme:n,preferredHighlighter:t="shiki-js"}){return{langs:[e??"text"],themes:G(n),preferredHighlighter:t}}function $e(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}const Ge="-1,-1";function _e(e){return e?.some(n=>n.lineNumber===0)??!1}function qe(e){const n=e[0];return n!=null&&n.length>0?n:void 0}function We(e){return e.startingLine===0&&e.totalLines>0}function Ve(e,n){return p({tagName:"div",children:e,properties:{"data-content":"",style:`grid-row: span ${n}`}})}function Ye(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}const Xe=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
2
2
|
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
3
3
|
<path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
|
|
4
4
|
</symbol>
|
package/dist/index.html
CHANGED
|
@@ -540,15 +540,15 @@
|
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
</style>
|
|
543
|
-
<script type="module" crossorigin src="/assets/main-
|
|
543
|
+
<script type="module" crossorigin src="/assets/main-B508FBXr.js"></script>
|
|
544
544
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
545
545
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
546
546
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-DYyjh7Q0.js">
|
|
547
547
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-CnsBKjP5.js">
|
|
548
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
549
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeSurface-
|
|
548
|
+
<link rel="modulepreload" crossorigin href="/assets/index-CH7o4-_q.js">
|
|
549
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeSurface-Bec4O8FD.js">
|
|
550
550
|
<link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
|
|
551
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
551
|
+
<link rel="stylesheet" crossorigin href="/assets/index-o4Eea60G.css">
|
|
552
552
|
<link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
|
|
553
553
|
</head>
|
|
554
554
|
<body class="h-full bg-background text-foreground">
|
package/dist/mini-chat.html
CHANGED
|
@@ -89,14 +89,14 @@
|
|
|
89
89
|
}
|
|
90
90
|
</style>
|
|
91
91
|
|
|
92
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
92
|
+
<script type="module" crossorigin src="/assets/miniChat-BTlz8IPL.js"></script>
|
|
93
93
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
94
94
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
95
95
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-DYyjh7Q0.js">
|
|
96
96
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-CnsBKjP5.js">
|
|
97
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
97
|
+
<link rel="modulepreload" crossorigin href="/assets/index-CH7o4-_q.js">
|
|
98
98
|
<link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
|
|
99
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
99
|
+
<link rel="stylesheet" crossorigin href="/assets/index-o4Eea60G.css">
|
|
100
100
|
<link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
|
|
101
101
|
</head>
|
|
102
102
|
<body class="h-full bg-background text-foreground">
|
package/dist/mobile.html
CHANGED
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
66
|
+
<script type="module" crossorigin src="/assets/mobile-DBkrRt80.js"></script>
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-DYyjh7Q0.js">
|
|
70
70
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-CnsBKjP5.js">
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/index-CH7o4-_q.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
|
|
73
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
73
|
+
<link rel="stylesheet" crossorigin href="/assets/index-o4Eea60G.css">
|
|
74
74
|
<link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
|
|
75
75
|
</head>
|
|
76
76
|
<body class="h-full bg-background text-foreground">
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -163,7 +163,12 @@ export async function startWebUiServer(options = {}) {
|
|
|
163
163
|
await listen(server, port, host);
|
|
164
164
|
const resolvedPort = typeof server.address() === 'object' && server.address() ? server.address().port : null;
|
|
165
165
|
if (typeof resolvedPort === 'number') process.send?.({ type: 'pichamber:ready', port: resolvedPort });
|
|
166
|
-
|
|
166
|
+
// Warm the detached daemon as soon as HTTP is listening. Requests arriving
|
|
167
|
+
// during cold start share the supervisor's startPromise; server readiness
|
|
168
|
+
// itself never waits for provider/model initialization in the child.
|
|
169
|
+
void piSessionDaemonRuntime.start().catch((error) => {
|
|
170
|
+
console.warn(`[PiSessionDaemon] unavailable: ${error?.code ?? 'DAEMON_UNAVAILABLE'}`);
|
|
171
|
+
});
|
|
167
172
|
const controller = {
|
|
168
173
|
expressApp: app,
|
|
169
174
|
httpServer: server,
|
package/server/lib/pi/routes.js
CHANGED
|
@@ -181,7 +181,17 @@ const projectSessionDetail = (value) => {
|
|
|
181
181
|
});
|
|
182
182
|
return { message: projected, parts };
|
|
183
183
|
});
|
|
184
|
-
|
|
184
|
+
const isStreaming = value.isStreaming === true;
|
|
185
|
+
const lifecycle = ['idle', 'busy', 'retry', 'error', 'interrupted'].includes(value.lifecycle)
|
|
186
|
+
? value.lifecycle
|
|
187
|
+
: (isStreaming ? 'busy' : 'idle');
|
|
188
|
+
return {
|
|
189
|
+
session: projectSession(value.session),
|
|
190
|
+
messages,
|
|
191
|
+
lastSequence: value.lastSequence,
|
|
192
|
+
isStreaming,
|
|
193
|
+
lifecycle,
|
|
194
|
+
};
|
|
185
195
|
};
|
|
186
196
|
|
|
187
197
|
const projectProviders = (value) => {
|
|
@@ -952,6 +962,8 @@ export const registerPiRuntimeRoutes = (app, {
|
|
|
952
962
|
session: projectSession(result.session),
|
|
953
963
|
messages: [],
|
|
954
964
|
lastSequence: result.lastSequence,
|
|
965
|
+
isStreaming: result.isStreaming === true,
|
|
966
|
+
lifecycle: result.isStreaming === true ? 'busy' : 'idle',
|
|
955
967
|
});
|
|
956
968
|
} catch (error) {
|
|
957
969
|
writeDaemonError(res, error);
|
|
@@ -429,6 +429,8 @@ describe('Pi runtime route', () => {
|
|
|
429
429
|
},
|
|
430
430
|
messages: [],
|
|
431
431
|
lastSequence: 7,
|
|
432
|
+
isStreaming: false,
|
|
433
|
+
lifecycle: 'idle',
|
|
432
434
|
});
|
|
433
435
|
});
|
|
434
436
|
|
|
@@ -465,6 +467,8 @@ describe('Pi runtime route', () => {
|
|
|
465
467
|
parts: [{ type: 'text', id: 'entry-1:0', index: 0, text: 'hello' }],
|
|
466
468
|
}],
|
|
467
469
|
lastSequence: 9,
|
|
470
|
+
isStreaming: false,
|
|
471
|
+
lifecycle: 'idle',
|
|
468
472
|
});
|
|
469
473
|
const promptResponse = await fetch(`http://127.0.0.1:${server.address().port}/api/pi/sessions/pi-session-4/prompt`, {
|
|
470
474
|
method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ sessionId: 'other', text: 'hello' }),
|
|
@@ -7,13 +7,13 @@ This module is the Pi-owned session-daemon foundation. A detached local daemon p
|
|
|
7
7
|
## Entrypoints
|
|
8
8
|
|
|
9
9
|
- `session-daemon.js`
|
|
10
|
-
- `createPiSessionRuntime({ cwd, agentDir })` creates a persistent Pi runtime using the selected server-side cwd and Pi agent directory. It uses Pi's normal settings, credentials, models, sessions, skills, prompts, and context discovery, with native extensions explicitly disabled for the core milestone. Sessions created outside PiChamber (Pi CLI or any other writer of the cwd-scoped JSONL directory) are the same records: `sessions.list`/`open` hydrate from `getEntries()`,
|
|
10
|
+
- `createPiSessionRuntime({ cwd, agentDir })` creates a persistent Pi runtime using the selected server-side cwd and Pi agent directory. It uses Pi's normal settings, credentials, models, sessions, skills, prompts, and context discovery, with native extensions explicitly disabled for the core milestone. Sessions created outside PiChamber (Pi CLI or any other writer of the cwd-scoped JSONL directory) are the same records: `sessions.list`/`open` hydrate from `getEntries()`, then overlay the live `session.messages` / `state.streamingMessage` turn while `isStreaming` is true, including an unpersisted user prompt that has not flushed to JSONL yet. A later prompt must overlay live turns onto that log rather than replace it. An unmatched `toolCall` projects as `running` only while `isStreaming` is authoritative; the same unmatched call in an idle persisted turn projects as a timestamped interruption error instead of malformed `completed` state. `getSession` also reports `isStreaming` and `lifecycle` so a restarted UI can restore the working/tooling state without waiting for the next token.
|
|
11
11
|
- `createSessionDaemon(options)` starts/stops the authenticated local socket daemon and validates its endpoint and setup inputs.
|
|
12
12
|
- `daemon-process.js` is the detached private-process entrypoint. It reads the daemon credential from its owner-only sidecar, starts the socket, writes non-secret identity state only after readiness, and removes only its own state on signal shutdown.
|
|
13
13
|
- `ipc-client.js` is the server-only authenticated request client. It owns JSONL framing and never exposes endpoint or credential values to callers.
|
|
14
14
|
- `runtime-registry.js` owns active runtime identities and session-local subscriptions. It rebinds the subscription after an SDK session replacement, rejects identity conflicts rather than displacing another runtime, and attempts every tracked disposal even when another disposal fails.
|
|
15
|
-
- `session-jsonl.js` validates
|
|
16
|
-
- `supervisor.js` resolves server-only overrides, creates the credential, serializes start/reuse/stop through an owner-only lock, validates daemon identity through `runtime.health`, forwards server-owned commands only after that identity check, and starts or stops the detached process. When the parent is Electron, the child is spawned with `ELECTRON_RUN_AS_NODE=1` so packaged Windows/macOS/Linux apps run the daemon as Node instead of a hidden second Electron GUI process.
|
|
15
|
+
- `session-jsonl.js` validates cwd-scoped Pi JSONL before discovery. List, create, and daemon startup require a valid session header per file; they do not read whole transcripts. `sessions.list` uses `listPiSessionJsonlDirectory` (header, first user prompt, latest rename from the file tail). Full-file validation remains on open of a specific session so a malformed body still fails that chat. Pi's SDK list is not the production list path because it scans every line of every log. Directory names match Pi's SessionManager encoding, including Windows drive letters and Git Bash/MSYS/Cygwin/WSL `/c/...` paths so PiChamber and the Pi CLI share the same JSONL sessions.
|
|
16
|
+
- `supervisor.js` resolves server-only overrides, creates the credential, serializes start/reuse/stop through an owner-only lock, validates daemon identity through `runtime.health`, forwards server-owned commands only after that identity check, and starts or stops the detached process. Reuse requires the ready-state sidecar `entrypoint` to match this checkout's `daemon-process.js`; a healthy daemon from another install (or an older daemon that never recorded an entrypoint) is stopped and replaced so local `bun run dev` cannot keep answering `getSession` without the live-turn overlay. When the parent is Electron, the child is spawned with `ELECTRON_RUN_AS_NODE=1` so packaged Windows/macOS/Linux apps run the daemon as Node instead of a hidden second Electron GUI process.
|
|
17
17
|
- `../routes.js` registers authenticated public adapters before the generic proxy. It exposes only whitelisted runtime, project, session, provider-auth/configuration, settings, resource, and SSE event shapes; no browser response contains daemon paths, credentials, PIDs, headers, or socket framing. Session actions are path-selected, so an identity supplied in a request body cannot redirect a mutation. `archive-store.js` persists PiChamber-only opaque session archive metadata atomically beneath the PiChamber data root and never edits Pi JSONL. `settings-store.js` keeps PiChamber new-session defaults separate from Pi settings.json. `GET /api/pi/settings` copies leftover UI/desktop `defaultModel` / small / walkthrough strings into that sidecar when those sidecar fields are unset, then Sessions settings is the only editor. Sidecar `defaultThinkingByModel` is the per-model thinking map (`provider/model` keys). A stored global `defaultThinking` with a default model is copied onto that map key and dropped; global thinking without a default model remains a clamp-only fallback. `ui-settings-store.js` atomically owns shared PiChamber UI preferences at the data-root `settings.json`; it is exposed as `/api/pi/ui-settings`, not through removed `/api/config/*` aliases. `session-folders-store.js` validates and atomically persists the restored sidebar's folder snapshot at `/api/pi/session-folders`; a missing snapshot is distinct from an empty one. `custom-themes.js` serves validated custom-theme candidates from `/api/pi/themes` with per-file partial-failure isolation. `model-config-store.js` atomically updates Pi's credential-blind `models.json`; literal keys continue through Pi auth and headers are write-only. `providers.config.get` returns `config: null` for a provider that is not in `models.json` (built-in catalog entries) and fails only when that file is present but malformed.
|
|
18
18
|
- `*.test.js` uses temporary cwd, agent, data, and runtime directories; it never loads a developer's Pi home, credentials, or sessions. On Windows the private endpoint is a named pipe, not a `.sock` file, and POSIX mode-bit assertions are skipped.
|
|
19
19
|
|
|
@@ -21,17 +21,18 @@ This module is the Pi-owned session-daemon foundation. A detached local daemon p
|
|
|
21
21
|
|
|
22
22
|
- The endpoint is a Unix domain socket on POSIX or a Windows named pipe. TCP endpoints are rejected. Listeners and clients connect with IPC `path` options so Windows `\\.\pipe\pichamber-pi-session-daemon-<owner-key>` works the same as a POSIX socket path.
|
|
23
23
|
- POSIX socket parent directories are mode `0700`; the socket is created mode `0600`. An existing endpoint fails startup rather than being unlinked without daemon-identity verification. Windows named-pipe ACLs are not yet equivalent owner-only OS permissions; credential authentication remains mandatory.
|
|
24
|
-
- The daemon credential and non-secret state sidecars are mode `0600`; their PiChamber parent directory and the operation lock serialize start/reuse/stop. Exclusive lock create writes the owner pid in the same step. A leftover empty or malformed lock, a dead owner pid, or Windows `EPERM`/`EACCES` on exclusive create is retried and stolen after a short freshness window instead of failing as `DAEMON_LOCK_UNAVAILABLE`. Sidecar `chmod` failures on Windows are ignored after the file exists so readiness is still recorded. Health identity includes the daemon PID and must match the state sidecar before the supervisor reuses or signals a process.
|
|
24
|
+
- The daemon credential and non-secret state sidecars are mode `0600`; their PiChamber parent directory and the operation lock serialize start/reuse/stop. Exclusive lock create writes the owner pid in the same step. A leftover empty or malformed lock, a dead owner pid, or Windows `EPERM`/`EACCES` on exclusive create is retried and stolen after a short freshness window instead of failing as `DAEMON_LOCK_UNAVAILABLE`. Sidecar `chmod` failures on Windows are ignored after the file exists so readiness is still recorded. Health identity includes the daemon PID and must match the state sidecar before the supervisor reuses or signals a process. Reuse also requires the ready-state `entrypoint` to equal this host's `daemon-process.js`; a missing or different path is not identity-compatible and is replaced.
|
|
25
25
|
- The public health route deliberately whitelists its response fields. It never returns a daemon endpoint, credential, PID, cwd, agent directory, or transcript data. Public transcript and event projections preserve daemon-redacted assistant error messages so the UI can distinguish provider/runtime failures instead of reducing every failure to `ASSISTANT_ERROR`.
|
|
26
26
|
- A client must send an `authenticate` frame carrying the host-private daemon credential before it can issue a request. Credentials are never logged or returned.
|
|
27
27
|
- Frames are LF-delimited JSON. They have a 1 MiB maximum buffered size. A malformed, oversized, unauthenticated, or invalid request closes the connection.
|
|
28
|
-
- The private core commands are `runtime.health`, `projects.list/select`, `providers.list/config.get/models.set/status/login/login.respond/login.status/logout`, `settings.get/set`, `resources.list/update/prompts.create/prompts.delete`, and session list/create/open/rename/delete/tree/navigate/fork/clone/prompt/steer/followUp/abort/model/thinking/compact operations. Resource lists use opaque IDs and never disclose server paths. Only top-level Pi prompt templates and applicable AGENTS.md sources are editable; package/path resources and skills are browse-only. Resource writes are rejected while a session streams, use an atomic replace, then recreate the idle runtime. Project trust changes are persisted in Pi trust.json and likewise recreate an idle runtime; extensions remain disabled regardless of trust. Provider login submits API keys only across authenticated private IPC or brokers Pi's OAuth/device/manual-code interaction; public projections contain only opaque login IDs, prompts, URLs/device codes, model catalog/configuration, and stable states, never credentials or write-only headers. `providers.models.set` is rejected while a session streams, atomically persists Pi's `models.json`, then rehydrates the idle runtime so the catalog is authoritative immediately. `providers.list` projects only catalog and authentication-status metadata, including Pi-supported `thinkingLevels` (`null` map entries hidden, `xhigh`/`max` opt-in). Session thinking overrides are clamped to the live model's supported levels. `sessions.list`
|
|
28
|
+
- The private core commands are `runtime.health`, `projects.list/select`, `providers.list/config.get/models.set/status/login/login.respond/login.status/logout`, `settings.get/set`, `resources.list/update/prompts.create/prompts.delete`, and session list/create/open/rename/delete/tree/navigate/fork/clone/prompt/steer/followUp/abort/model/thinking/compact operations. Resource lists use opaque IDs and never disclose server paths. Only top-level Pi prompt templates and applicable AGENTS.md sources are editable; package/path resources and skills are browse-only. Resource writes are rejected while a session streams, use an atomic replace, then recreate the idle runtime. Project trust changes are persisted in Pi trust.json and likewise recreate an idle runtime; extensions remain disabled regardless of trust. Provider login submits API keys only across authenticated private IPC or brokers Pi's OAuth/device/manual-code interaction; public projections contain only opaque login IDs, prompts, URLs/device codes, model catalog/configuration, and stable states, never credentials or write-only headers. `providers.models.set` is rejected while a session streams, atomically persists Pi's `models.json`, then rehydrates the idle runtime so the catalog is authoritative immediately. `providers.list` projects only catalog and authentication-status metadata, including Pi-supported `thinkingLevels` (`null` map entries hidden, `xhigh`/`max` opt-in). Session thinking overrides are clamped to the live model's supported levels. `sessions.list` checks each cwd JSONL header (not the full transcript) so a project with large session logs cannot spend tens of seconds on startup. SDK `SessionManager.list` is not used for that path; `listPiSessionJsonlDirectory` reads a header, a bounded prefix for the first user prompt, and a tail for the latest rename. Concurrent lists of the same directory share one in-flight result. Concurrent `sessions.open` of the same id share one in-flight runtime create; a duplicate that finishes later disposes itself and returns the registered runtime instead of `SESSION_RUNTIME_CONFLICT`. Full-file JSONL validation stays on open of a chosen session. The browser explicitly selects an existing user-chosen project directory before listing it; the daemon's startup cwd is an internal fallback, not a user-visible default project. Unnamed persisted sessions use their first prompt as a readable list title when available. `sessions.open` and `getSession` project the last assistant `provider`/`model`/`thinkingLevel` onto the session record so reopening a chat keeps that cache identity. Session selection validates a persisted JSONL path before Pi opens it; inactive mutations are never directed by a browser-supplied path. `sessions.open` resolves an id by Pi's `timestamp_<id>.jsonl` filename first so a missing deep link 404s without listing or fully reading every transcript in every cwd; SDK list and header scan remain the fallback for non-standard names. Directory-wide JSONL checks on list/create/startup are header-only; full-file validation stays on open of a chosen transcript. Attachment paths originate in the server-local upload map and cross only private IPC into Pi's tool context. Pi may persist or echo those paths in its authoritative JSONL transcript, so every public projection redacts them recursively: session titles/previews, user and assistant text/thinking, tool arguments, errors, snapshots, and live message events never expose the server-local path. The daemon maps Pi message lifecycle, deltas, tools, queue changes, model/thinking, compaction, interruption state, and session title updates (`session.updated` on create-with-title, first-prompt auto-title, and rename) to canonical events. Tool events carry redacted input arguments, cumulative partial-output snapshots, final output, error text, renderer metadata (edit diffs, truncation notes), and start/end timestamps. Persisted `toolResult` entries merge into their assistant `toolCall` parts as output/error/end time so hydrated sessions render complete tool cards; tool-result entries never surface as standalone messages. Assistant message projections and start events carry the owning user-message id so the restored turn renderer can group and display replies; all assistant entries in a tool loop remain attached to the latest user turn. Assistant message projections also pass through Pi's per-turn `Usage` (input, output, cacheRead, cacheWrite, totalTokens, and the same five numeric cost fields). The daemon sanitizes the raw payload through `projectUsage` before publication: every numeric must be finite and non-negative, the whole object is omitted when any field is missing or wrong type, and unknown keys are never copied. The `assistant.message.end` event carries the same sanitized usage so the last turn updates without waiting for a full `getSession` refetch. The public route whitelist re-applies the same sanitizer on each projection so a stale or malformed payload from a different daemon version cannot surface as `NaN` or `Infinity` in the reducer.
|
|
29
29
|
- Each event and reconnect snapshot has a monotonic sequence. A reconnect receives a bounded contiguous replay after its cursor when available, otherwise an authoritative `session.snapshot`; unavailable runtimes are not represented as empty sessions.
|
|
30
30
|
- Prompt, steer, and follow-up requests acknowledge acceptance immediately after Pi accepts the call; the daemon owns the still-running send promise and publishes any asynchronous rejection as `session.error`. A later prompt on the same session invalidates that rejection so it cannot error the new turn. If the rejected send left Pi streaming, the daemon aborts it. Steer/follow-up against an idle session starts a new prompt instead of `SESSION_NOT_RUNNING`. Agent completion is never held behind the 30-second public/private request budgets.
|
|
31
31
|
- Registry keys combine the SDK session ID with its cwd. A replacement subscription is rebound to the replacement session so old-session events cannot be published under the new identity. A collision is a visible error; it never replaces or disposes an unrelated runtime.
|
|
32
32
|
- After `agent_settled`, the daemon disposes an idle runtime after five minutes (injectable for tests). Disposal never deletes Pi JSONL; the daemon remembers the selected session file and recreates that runtime on the next private prompt. A new agent start cancels a pending disposal.
|
|
33
33
|
- A startup validation failure writes only a stable failure code to the owner-only non-secret state sidecar. It never records a transcript, session path, or credential. The supervisor surfaces that code as unavailable instead of claiming an empty or idle session.
|
|
34
34
|
- After a forced crash, the next health, request, or subscription probe re-runs supervised startup. Daemon readiness has its own 15-second bounded budget, separate from the shorter lock and shutdown budget, because loading Pi settings and provider/model catalogs can legitimately exceed five seconds. The supervisor removes an existing POSIX socket only when its recorded daemon PID is dead, the endpoint is a socket, and authenticated IPC deterministically refuses or times out. An endpoint that responds, authenticates incorrectly, returns malformed protocol data, or cannot be classified remains `DAEMON_ENDPOINT_UNVERIFIED`.
|
|
35
|
+
- The web server starts warming the supervisor immediately after HTTP listen without awaiting Pi provider/model initialization. A first request arriving during that warmup shares the supervisor's `startPromise`.
|
|
35
36
|
- The daemon owns the runtime after clients disconnect. Disconnecting the web-server client cannot stop active Pi work.
|
|
36
37
|
|
|
37
38
|
## Deliberate limits
|