@otto-code/server 0.8.4 → 0.8.5

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.
@@ -15145,7 +15145,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v
15145
15145
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"decodeOfferFragmentPayload",{enumerable:!0,get:function(){return n.decodeOfferFragmentPayload}}),Object.defineProperty(e,"buildDaemonWebSocketUrl",{enumerable:!0,get:function(){return t.buildDaemonWebSocketUrl}}),Object.defineProperty(e,"deriveLabelFromEndpoint",{enumerable:!0,get:function(){return t.deriveLabelFromEndpoint}}),Object.defineProperty(e,"extractHostPortFromWebSocketUrl",{enumerable:!0,get:function(){return t.extractHostPortFromWebSocketUrl}}),Object.defineProperty(e,"normalizeHostPort",{enumerable:!0,get:function(){return t.normalizeHostPort}}),Object.defineProperty(e,"parseConnectionUri",{enumerable:!0,get:function(){return t.parseConnectionUri}}),Object.defineProperty(e,"parseHostPort",{enumerable:!0,get:function(){return t.parseHostPort}}),Object.defineProperty(e,"serializeConnectionUri",{enumerable:!0,get:function(){return t.serializeConnectionUri}}),Object.defineProperty(e,"serializeConnectionUriForStorage",{enumerable:!0,get:function(){return t.serializeConnectionUriForStorage}}),Object.defineProperty(e,"shouldUseTlsForDefaultHostedRelay",{enumerable:!0,get:function(){return t.shouldUseTlsForDefaultHostedRelay}}),e.buildRelayWebSocketUrl=function(n){return(0,t.buildRelayWebSocketUrl)(Object.assign({},n,{role:"client"}))};var t=r(d[0]),n=r(d[1])},3495,[3474,3496]);
15146
15146
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ConnectionOfferV2Schema",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ConnectionOfferSchema",{enumerable:!0,get:function(){return o}}),e.decodeOfferFragmentPayload=l,e.parseConnectionOfferFromUrl=function(n){const t=f(n);if(!t)return null;const c=l(t);return o.parse(c)};var n=r(d[0]);const t=n.z.object({v:n.z.literal(2),serverId:n.z.string().min(1),daemonPublicKeyB64:n.z.string().min(1),relay:n.z.object({endpoint:n.z.string().min(1),useTls:n.z.boolean().optional()})}),o=t;function c(n){const t=n.replace(/-/g,"+").replace(/_/g,"/"),o=t.padEnd(t.length+(4-t.length%4)%4,"="),c=globalThis.atob(o),l=Uint8Array.from(c,n=>n.charCodeAt(0));return new TextDecoder("utf-8",{fatal:!0}).decode(l)}function l(n){const t=c(n);return JSON.parse(t)}const u="#offer=";function f(n){const t=n.trim();if(!t)return null;const o=t.indexOf(u);if(-1===o)return null;const c=t.slice(o+u.length).trim();return c.length>0?c:null}},3496,[3354]);
15147
15147
  __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.resolveAppVersion=function(){const e=u(t.default?.version);if(e)return e;const o=u(n.default.expoConfig?.version);if(o)return o;const f=u(n.default.manifest?.version);if(f)return f;return null};var n=e(r(d[0])),t=e(r(d[1]));function u(e){if("string"!=typeof e)return null;const n=e.trim();return 0===n.length?null:n}},3497,[1190,3498]);
15148
- __d(function(e,t,r,o,i,a,n){i.exports={name:"@otto-code/app",version:"0.8.4",private:!0,license:"AGPL-3.0-or-later",main:"index.ts",scripts:{start:"npm run start:expo","start:expo":"cross-env APP_VARIANT=development expo start","reset-project":"node ./scripts/reset-project.js","eas-build-post-install":"npm --prefix ../.. run build:app-deps && npm run build:terminal-webview && npm run build:editor-webview && npm run build:mermaid-webview && npm run build:math-webview",android:"npm run android:development","android:development":"npm --prefix ../.. run build:client && cross-env APP_VARIANT=development expo prebuild --platform android --non-interactive && cross-env APP_VARIANT=development expo run:android --variant=debug","android:production":"npm --prefix ../.. run build:client && cross-env APP_VARIANT=production expo prebuild --platform android --non-interactive && cross-env APP_VARIANT=production expo run:android --variant=release","android:release":"npm run android:production","android:clear":"node -e \"require('node:fs').rmSync('android', { recursive: true, force: true })\"",ios:"npm --prefix ../.. run build:client && expo run:ios","ios:release":"npm --prefix ../.. run build:client && expo run:ios --configuration Release",web:"npm --prefix ../.. run build:client && concurrently --kill-others --names protocol,client,expo --prefix-colors yellow,blue,magenta \"npm --prefix ../.. run watch:protocol\" \"npm --prefix ../.. run watch:client\" \"npm run web:expo\"","web:expo":"expo start --web",lint:"expo lint",typecheck:"tsgo --noEmit",test:"vitest run","browsers:install":"node ../../scripts/ensure-browsers.mjs","pretest:browser":"npm run browsers:install","test:browser":"vitest run --project browser","pretest:e2e":"npm run browsers:install","test:e2e":"playwright test --project=\"Desktop Chrome\"","test:e2e:desktop":"cross-env E2E_DESKTOP_RUNTIME=1 playwright test --project=\"Desktop Chrome\" e2e/project-picker-desktop.spec.ts","test:e2e:real":"cross-env E2E_FORK_OTTO_HOME_FROM=../desktop/.dev/otto-home E2E_HTML_REPORT_DIR=playwright-report-real E2E_REPORT_DIR=e2e-report-real playwright test --project=real-provider","test:e2e:local-ai":"cross-env E2E_LOCAL_AI=1 E2E_HTML_REPORT_DIR=playwright-report-local-ai E2E_REPORT_DIR=e2e-report-local-ai playwright test --project=local-ai","test:e2e:ui":"playwright test --ui","test:e2e:report":"playwright show-report","demo:run":"node demo/scripts/run.mjs",demo:"playwright test --config playwright.demo.config.ts --project=demo-twilight --project=demo-daylight","demo:twilight":"playwright test --config playwright.demo.config.ts --project=demo-twilight","demo:daylight":"playwright test --config playwright.demo.config.ts --project=demo-daylight","demo:real":"cross-env DEMO_REAL=1 playwright test --config playwright.demo.config.ts --project=demo-twilight --project=demo-daylight","demo:real:twilight":"cross-env DEMO_REAL=1 playwright test --config playwright.demo.config.ts --project=demo-twilight","demo:real:daylight":"cross-env DEMO_REAL=1 playwright test --config playwright.demo.config.ts --project=demo-daylight","demo:real:local-ai":"cross-env DEMO_REAL=1 E2E_LOCAL_AI=1 playwright test --config playwright.demo.config.ts --project=demo-twilight --project=demo-daylight","demo:real:local-ai:twilight":"cross-env DEMO_REAL=1 E2E_LOCAL_AI=1 playwright test --config playwright.demo.config.ts --project=demo-twilight","demo:real:local-ai:daylight":"cross-env DEMO_REAL=1 E2E_LOCAL_AI=1 playwright test --config playwright.demo.config.ts --project=demo-daylight","demo:spread":"playwright test --config playwright.demo.config.ts --project=spread-twilight --project=spread-daylight --project=spread-mobile --project=spread-tablet --project=spread-ios","demo:spread:real":"cross-env DEMO_REAL=1 playwright test --config playwright.demo.config.ts --project=spread-twilight --project=spread-daylight --project=spread-mobile --project=spread-tablet --project=spread-ios","demo:electron":"npm --prefix ../desktop run build:main && playwright test --config playwright.demo-electron.config.ts","demo:electron:real:local-ai":"npm --prefix ../desktop run build:main && cross-env DEMO_REAL=1 E2E_LOCAL_AI=1 playwright test --config playwright.demo-electron.config.ts","demo:assets":"node demo/scripts/postprocess.mjs","demo:feature-graphic":"node demo/scripts/feature-graphic.mjs","demo:og-image":"node demo/scripts/og-image.mjs",build:"npm run build:web","build:web":"npm --prefix ../.. run build:app-deps && expo export --platform web","profile:workspace-tabs":"node ./scripts/profile-workspace-tabs.mjs","deploy:web":"npm run build:web && wrangler pages deploy dist --project-name otto-app --branch main","build:terminal-webview":"node ./scripts/build-terminal-webview-html.mjs","build:editor-webview":"node ./scripts/build-editor-webview-html.mjs","build:mermaid-webview":"node ./scripts/build-mermaid-webview-html.mjs","build:math-webview":"node ./scripts/build-math-webview-html.mjs"},dependencies:{"@codemirror/commands":"^6.10.4","@codemirror/lang-markdown":"^6.5.1","@codemirror/language":"^6.12.4","@codemirror/search":"^6.7.1","@codemirror/state":"^6.7.1","@codemirror/view":"^6.43.6","@dnd-kit/core":"^6.3.1","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@expo-google-fonts/inter":"^0.4.2","@expo-google-fonts/jetbrains-mono":"^0.4.1","@floating-ui/react-native":"^0.10.7","@gorhom/bottom-sheet":"^5.2.14","@gorhom/portal":"^1.0.14","@lezer/common":"^1.5.2","@lezer/highlight":"^1.2.3","@otto-code/client":"*","@otto-code/expo-two-way-audio":"*","@otto-code/highlight":"*","@otto-code/protocol":"*","@react-native-async-storage/async-storage":"2.2.0","@react-native-masked-view/masked-view":"^0.3.2","@react-native/normalize-colors":"^0.81.5","@react-navigation/native":"^7.1.8","@replit/codemirror-vim":"6.3.0","@tanstack/react-query":"^5.90.11","@tanstack/react-virtual":"^3.13.21","@types/turndown":"^5.0.6","@xterm/addon-clipboard":"^0.3.0-beta.213","@xterm/addon-fit":"^0.12.0-beta.213","@xterm/addon-image":"^0.10.0-beta.213","@xterm/addon-ligatures":"^0.11.0-beta.213","@xterm/addon-search":"^0.17.0-beta.213","@xterm/addon-unicode11":"^0.10.0-beta.213","@xterm/addon-web-links":"^0.13.0-beta.213","@xterm/addon-webgl":"^0.20.0-beta.212","@xterm/xterm":"^6.1.0-beta.213",buffer:"^6.0.3",expo:"^54.0.18","expo-asset":"~12.0.12","expo-audio":"~1.0.13","expo-build-properties":"^1.0.9","expo-camera":"~17.0.10","expo-clipboard":"~8.0.7","expo-constants":"~18.0.9","expo-crypto":"^15.0.8","expo-dev-client":"^6.0.15","expo-document-picker":"~14.0.8","expo-file-system":"~19.0.17","expo-font":"~14.0.11","expo-haptics":"~15.0.7","expo-image":"~3.0.10","expo-image-manipulator":"~14.0.8","expo-image-picker":"^17.0.8","expo-keep-awake":"^15.0.7","expo-linking":"~8.0.8","expo-localization":"~17.0.9","expo-notifications":"^0.32.16","expo-router":"~6.0.13","expo-sharing":"^14.0.8","expo-splash-screen":"~31.0.10","expo-system-ui":"~6.0.7","expo-updates":"~29.0.12","fast-deep-equal":"^3.1.3",htmlparser2:"^12.0.0",i18next:"^26.3.0",katex:"^0.16.47","lucide-react-native":"^0.546.0","markdown-it":"^15.0.0",mermaid:"^11.16.1","mnemonic-id":"^3.2.7",qrcode:"^1.5.4",react:"19.1.0","react-dom":"19.1.0","react-i18next":"^17.0.8","react-native":"0.81.5","react-native-draggable-flatlist":"^4.0.3","react-native-edge-to-edge":"^1.7.0","react-native-gesture-handler":"~2.28.0","react-native-keyboard-controller":"^1.19.2","react-native-markdown-display":"^7.0.2","react-native-nitro-modules":"0.35.5","react-native-reanimated":"~4.3.1","react-native-safe-area-context":"~5.6.0","react-native-screens":"~4.16.0","react-native-svg":"^15.14.0","react-native-uitextview":"^2.2.0","react-native-unistyles":"^3.2.4","react-native-web":"~0.21.0","react-native-webview":"^13.16.0","react-native-worklets":"~0.8.3","tiny-invariant":"^1.3.3",turndown:"^7.1.2","use-sync-external-store":"^1.6.0",zod:"^4.4.3",zustand:"^5.0.9"},devDependencies:{"@material-symbols/svg-400":"^0.45.5","@material-symbols/svg-700":"^0.45.5","@playwright/test":"^1.56.1","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.2","@types/markdown-it":"^14.1.2","@types/qrcode":"^1.5.6","@types/react":"~19.2.0","@types/ws":"^8.18.1","@vitest/browser":"^4.1.10","@vitest/browser-playwright":"^4.1.10","@xterm/headless":"^6.1.0-beta.213",dotenv:"^17.2.3","eas-cli":"^21.4.0",eslint:"^9.25.0","eslint-config-expo":"~10.0.0","expo-gradle-jvmargs":"^1.1.2",jsdom:"^20.0.3","material-icon-theme":"^5.32.0",playwright:"^1.56.1","serve-sim":"^0.1.40",sharp:"^0.35.3",typescript:"~5.9.2",vitest:"^4.1.10",wrangler:"^4.105.0",ws:"^8.21.0"}}},3498,[]);
15148
+ __d(function(e,t,r,o,i,a,n){i.exports={name:"@otto-code/app",version:"0.8.5",private:!0,license:"AGPL-3.0-or-later",main:"index.ts",scripts:{start:"npm run start:expo","start:expo":"cross-env APP_VARIANT=development expo start","reset-project":"node ./scripts/reset-project.js","eas-build-post-install":"npm --prefix ../.. run build:app-deps && npm run build:terminal-webview && npm run build:editor-webview && npm run build:mermaid-webview && npm run build:math-webview",android:"npm run android:development","android:development":"npm --prefix ../.. run build:client && cross-env APP_VARIANT=development expo prebuild --platform android --non-interactive && cross-env APP_VARIANT=development expo run:android --variant=debug","android:production":"npm --prefix ../.. run build:client && cross-env APP_VARIANT=production expo prebuild --platform android --non-interactive && cross-env APP_VARIANT=production expo run:android --variant=release","android:release":"npm run android:production","android:clear":"node -e \"require('node:fs').rmSync('android', { recursive: true, force: true })\"",ios:"npm --prefix ../.. run build:client && expo run:ios","ios:release":"npm --prefix ../.. run build:client && expo run:ios --configuration Release",web:"npm --prefix ../.. run build:client && concurrently --kill-others --names protocol,client,expo --prefix-colors yellow,blue,magenta \"npm --prefix ../.. run watch:protocol\" \"npm --prefix ../.. run watch:client\" \"npm run web:expo\"","web:expo":"expo start --web",lint:"expo lint",typecheck:"tsgo --noEmit",test:"vitest run","browsers:install":"node ../../scripts/ensure-browsers.mjs","pretest:browser":"npm run browsers:install","test:browser":"vitest run --project browser","pretest:e2e":"npm run browsers:install","test:e2e":"playwright test --project=\"Desktop Chrome\"","test:e2e:desktop":"cross-env E2E_DESKTOP_RUNTIME=1 playwright test --project=\"Desktop Chrome\" e2e/project-picker-desktop.spec.ts","test:e2e:real":"cross-env E2E_FORK_OTTO_HOME_FROM=../desktop/.dev/otto-home E2E_HTML_REPORT_DIR=playwright-report-real E2E_REPORT_DIR=e2e-report-real playwright test --project=real-provider","test:e2e:local-ai":"cross-env E2E_LOCAL_AI=1 E2E_HTML_REPORT_DIR=playwright-report-local-ai E2E_REPORT_DIR=e2e-report-local-ai playwright test --project=local-ai","test:e2e:ui":"playwright test --ui","test:e2e:report":"playwright show-report","demo:run":"node demo/scripts/run.mjs",demo:"playwright test --config playwright.demo.config.ts --project=demo-twilight --project=demo-daylight","demo:twilight":"playwright test --config playwright.demo.config.ts --project=demo-twilight","demo:daylight":"playwright test --config playwright.demo.config.ts --project=demo-daylight","demo:real":"cross-env DEMO_REAL=1 playwright test --config playwright.demo.config.ts --project=demo-twilight --project=demo-daylight","demo:real:twilight":"cross-env DEMO_REAL=1 playwright test --config playwright.demo.config.ts --project=demo-twilight","demo:real:daylight":"cross-env DEMO_REAL=1 playwright test --config playwright.demo.config.ts --project=demo-daylight","demo:real:local-ai":"cross-env DEMO_REAL=1 E2E_LOCAL_AI=1 playwright test --config playwright.demo.config.ts --project=demo-twilight --project=demo-daylight","demo:real:local-ai:twilight":"cross-env DEMO_REAL=1 E2E_LOCAL_AI=1 playwright test --config playwright.demo.config.ts --project=demo-twilight","demo:real:local-ai:daylight":"cross-env DEMO_REAL=1 E2E_LOCAL_AI=1 playwright test --config playwright.demo.config.ts --project=demo-daylight","demo:spread":"playwright test --config playwright.demo.config.ts --project=spread-twilight --project=spread-daylight --project=spread-mobile --project=spread-tablet --project=spread-ios","demo:spread:real":"cross-env DEMO_REAL=1 playwright test --config playwright.demo.config.ts --project=spread-twilight --project=spread-daylight --project=spread-mobile --project=spread-tablet --project=spread-ios","demo:electron":"npm --prefix ../desktop run build:main && playwright test --config playwright.demo-electron.config.ts","demo:electron:real:local-ai":"npm --prefix ../desktop run build:main && cross-env DEMO_REAL=1 E2E_LOCAL_AI=1 playwright test --config playwright.demo-electron.config.ts","demo:assets":"node demo/scripts/postprocess.mjs","demo:feature-graphic":"node demo/scripts/feature-graphic.mjs","demo:og-image":"node demo/scripts/og-image.mjs",build:"npm run build:web","build:web":"npm --prefix ../.. run build:app-deps && expo export --platform web","profile:workspace-tabs":"node ./scripts/profile-workspace-tabs.mjs","deploy:web":"npm run build:web && wrangler pages deploy dist --project-name otto-app --branch main","build:terminal-webview":"node ./scripts/build-terminal-webview-html.mjs","build:editor-webview":"node ./scripts/build-editor-webview-html.mjs","build:mermaid-webview":"node ./scripts/build-mermaid-webview-html.mjs","build:math-webview":"node ./scripts/build-math-webview-html.mjs"},dependencies:{"@codemirror/commands":"^6.10.4","@codemirror/lang-markdown":"^6.5.1","@codemirror/language":"^6.12.4","@codemirror/search":"^6.7.1","@codemirror/state":"^6.7.1","@codemirror/view":"^6.43.6","@dnd-kit/core":"^6.3.1","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@expo-google-fonts/inter":"^0.4.2","@expo-google-fonts/jetbrains-mono":"^0.4.1","@floating-ui/react-native":"^0.10.7","@gorhom/bottom-sheet":"^5.2.14","@gorhom/portal":"^1.0.14","@lezer/common":"^1.5.2","@lezer/highlight":"^1.2.3","@otto-code/client":"*","@otto-code/expo-two-way-audio":"*","@otto-code/highlight":"*","@otto-code/protocol":"*","@react-native-async-storage/async-storage":"2.2.0","@react-native-masked-view/masked-view":"^0.3.2","@react-native/normalize-colors":"^0.81.5","@react-navigation/native":"^7.1.8","@replit/codemirror-vim":"6.3.0","@tanstack/react-query":"^5.90.11","@tanstack/react-virtual":"^3.13.21","@types/turndown":"^5.0.6","@xterm/addon-clipboard":"^0.3.0-beta.213","@xterm/addon-fit":"^0.12.0-beta.213","@xterm/addon-image":"^0.10.0-beta.213","@xterm/addon-ligatures":"^0.11.0-beta.213","@xterm/addon-search":"^0.17.0-beta.213","@xterm/addon-unicode11":"^0.10.0-beta.213","@xterm/addon-web-links":"^0.13.0-beta.213","@xterm/addon-webgl":"^0.20.0-beta.212","@xterm/xterm":"^6.1.0-beta.213",buffer:"^6.0.3",expo:"^54.0.18","expo-asset":"~12.0.12","expo-audio":"~1.0.13","expo-build-properties":"^1.0.9","expo-camera":"~17.0.10","expo-clipboard":"~8.0.7","expo-constants":"~18.0.9","expo-crypto":"^15.0.8","expo-dev-client":"^6.0.15","expo-document-picker":"~14.0.8","expo-file-system":"~19.0.17","expo-font":"~14.0.11","expo-haptics":"~15.0.7","expo-image":"~3.0.10","expo-image-manipulator":"~14.0.8","expo-image-picker":"^17.0.8","expo-keep-awake":"^15.0.7","expo-linking":"~8.0.8","expo-localization":"~17.0.9","expo-notifications":"^0.32.16","expo-router":"~6.0.13","expo-sharing":"^14.0.8","expo-splash-screen":"~31.0.10","expo-system-ui":"~6.0.7","expo-updates":"~29.0.12","fast-deep-equal":"^3.1.3",htmlparser2:"^12.0.0",i18next:"^26.3.0",katex:"^0.16.47","lucide-react-native":"^0.546.0","markdown-it":"^15.0.0",mermaid:"^11.16.1","mnemonic-id":"^3.2.7",qrcode:"^1.5.4",react:"19.1.0","react-dom":"19.1.0","react-i18next":"^17.0.8","react-native":"0.81.5","react-native-draggable-flatlist":"^4.0.3","react-native-edge-to-edge":"^1.7.0","react-native-gesture-handler":"~2.28.0","react-native-keyboard-controller":"^1.19.2","react-native-markdown-display":"^7.0.2","react-native-nitro-modules":"0.35.5","react-native-reanimated":"~4.3.1","react-native-safe-area-context":"~5.6.0","react-native-screens":"~4.16.0","react-native-svg":"^15.14.0","react-native-uitextview":"^2.2.0","react-native-unistyles":"^3.2.4","react-native-web":"~0.21.0","react-native-webview":"^13.16.0","react-native-worklets":"~0.8.3","tiny-invariant":"^1.3.3",turndown:"^7.1.2","use-sync-external-store":"^1.6.0",zod:"^4.4.3",zustand:"^5.0.9"},devDependencies:{"@material-symbols/svg-400":"^0.45.5","@material-symbols/svg-700":"^0.45.5","@playwright/test":"^1.56.1","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.2","@types/markdown-it":"^14.1.2","@types/qrcode":"^1.5.6","@types/react":"~19.2.0","@types/ws":"^8.18.1","@vitest/browser":"^4.1.10","@vitest/browser-playwright":"^4.1.10","@xterm/headless":"^6.1.0-beta.213",dotenv:"^17.2.3","eas-cli":"^21.4.0",eslint:"^9.25.0","eslint-config-expo":"~10.0.0","expo-gradle-jvmargs":"^1.1.2",jsdom:"^20.0.3","material-icon-theme":"^5.32.0",playwright:"^1.56.1","serve-sim":"^0.1.40",sharp:"^0.35.3",typescript:"~5.9.2",vitest:"^4.1.10",wrangler:"^4.105.0",ws:"^8.21.0"}}},3498,[]);
15149
15149
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shouldUseDesktopDaemon=function(){return(0,n.isElectronRuntime)()},e.getDesktopDaemonStatus=async function(){return p(await(0,t.invokeDesktopCommand)("desktop_daemon_status"))},e.startDesktopDaemon=async function(){return p(await(0,t.invokeDesktopCommand)("start_desktop_daemon"))},e.stopDesktopDaemon=async function(n="manual_ipc"){return p(await(0,t.invokeDesktopCommand)("stop_desktop_daemon",{reason:n}))},e.restartDesktopDaemon=async function(){return p(await(0,t.invokeDesktopCommand)("restart_desktop_daemon"))},e.getDesktopDaemonLogs=async function(){return u(await(0,t.invokeDesktopCommand)("desktop_daemon_logs"))},e.getDesktopAppLogs=async function(){const n=await(0,t.invokeDesktopCommand)("desktop_app_logs");if(!o(n))throw new Error("Unexpected desktop app logs response.");return{logPath:s(n.logPath)??"",contents:"string"==typeof n.contents?n.contents:""}},e.getDesktopDaemonPairing=async function(){return k(await(0,t.invokeDesktopCommand)("desktop_daemon_pairing"))},e.getCliDaemonStatus=async function(){const n=await(0,t.invokeDesktopCommand)("cli_daemon_status");if("string"!=typeof n)throw new Error("Unexpected CLI daemon status response.");return n},e.listenToLocalTransportEvents=async function(t){const l=(0,n.getDesktopHost)()?.events?.on;if("function"!=typeof l)throw new Error("Desktop events API is unavailable.");const p=await l("local-daemon-transport-event",n=>{o(n)&&t({sessionId:s(n.sessionId)??"",kind:s(n.kind)??"error",text:s(n.text),binaryBase64:s(n.binaryBase64),code:c(n.code),reason:s(n.reason),error:s(n.error)})});return"function"==typeof p?p:()=>{}},e.openLocalTransportSession=async function(n){const o=await(0,t.invokeDesktopCommand)("open_local_daemon_transport",n);if("string"!=typeof o||0===o.trim().length)throw new Error("Unexpected local transport session response.");return o},e.sendLocalTransportMessage=async function(n){await(0,t.invokeDesktopCommand)("send_local_daemon_transport_message",Object.assign({sessionId:n.sessionId},n.text?{text:n.text}:{},n.binaryBase64?{binaryBase64:n.binaryBase64}:{}))},e.closeLocalTransportSession=async function(n){await(0,t.invokeDesktopCommand)("close_local_daemon_transport",{sessionId:n})},e.getCliInstallStatus=async function(){return f(await(0,t.invokeDesktopCommand)("get_cli_install_status"))},e.installCli=async function(){return f(await(0,t.invokeDesktopCommand)("install_cli"))},e.getSkillsStatus=async function(){return y(await(0,t.invokeDesktopCommand)("get_skills_status"))},e.installSkills=async function(){return y(await(0,t.invokeDesktopCommand)("install_skills"))},e.updateSkills=async function(){return y(await(0,t.invokeDesktopCommand)("update_skills"))},e.uninstallSkills=async function(){return y(await(0,t.invokeDesktopCommand)("uninstall_skills"))};var n=r(d[0]),t=r(d[1]);function o(n){return"object"==typeof n&&null!==n}function s(n){return"string"==typeof n&&n.trim().length>0?n:null}function c(n){return"number"==typeof n&&Number.isFinite(n)?n:null}function l(n){const t=s(n)?.toLowerCase();switch(t){case"starting":return"starting";case"running":return"running";case"errored":case"error":return"errored";default:return"stopped"}}function p(n){if(!o(n))throw new Error("Unexpected desktop daemon status response.");return{serverId:s(n.serverId)??"",status:l(n.status),listen:s(n.listen),hostname:s(n.hostname),pid:c(n.pid),home:s(n.home)??"",version:s(n.version),desktopManaged:!0===n.desktopManaged,error:s(n.error)}}function u(n){if(!o(n))throw new Error("Unexpected desktop daemon logs response.");return{logPath:s(n.logPath)??"",contents:"string"==typeof n.contents?n.contents:""}}function k(n){if(!o(n))throw new Error("Unexpected desktop daemon pairing response.");return{relayEnabled:!0===n.relayEnabled,url:s(n.url),qr:s(n.qr)}}function f(n){if(!o(n))throw new Error("Unexpected install status response.");return{installed:!0===n.installed}}function w(n){switch(n){case"not-installed":case"up-to-date":case"drift":return n;default:throw new Error(`Unexpected skills status state: ${String(n)}`)}}function _(n){if(!o(n))throw new Error("Unexpected skill op response.");const t=s(n.name);if(!t)throw new Error("Skill op missing name.");switch(n.kind){case"add":return{kind:"add",name:t};case"update":return{kind:"update",name:t};case"delete":return{kind:"delete",name:t};default:throw new Error(`Unexpected skill op kind: ${String(n.kind)}`)}}function y(n){if(!o(n))throw new Error("Unexpected skills status response.");const t=Array.isArray(n.ops)?n.ops.map(_):[];return{state:w(n.state),ops:t}}},3499,[349,1022]);
15150
15150
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DaemonConnectionTestError",{enumerable:!0,get:function(){return f}}),e.buildClientConfig=y,e.connectAndProbe=w,e.connectToDaemon=async function(t,o,n=l){return w(await y(t,o?.serverId,o,n),T(t,o),n)};var t=r(d[0]),o=r(d[1]),n=r(d[2]),s=r(d[3]),c=r(d[4]);const l={getClientId:o.getOrCreateClientId,resolveAppVersion:n.resolveAppVersion,createLocalTransportFactory:c.createDesktopLocalDaemonTransportFactory,buildLocalTransportUrl:c.buildLocalDaemonTransportUrl,createClient:o=>new t.DaemonClient(o)};function u(t){if("string"!=typeof t)return null;const o=t.trim();return o.length>0?o:null}function p(t,o){const n=t&&("transport error"===t.toLowerCase()||"transport closed"===t.toLowerCase()),s=o&&("transport error"===o.toLowerCase()||"transport closed"===o.toLowerCase()||"unable to connect"===o.toLowerCase());return n&&o&&!s?o:t||(o||"Unable to connect")}function b(t){if(!t.config.password)return!1;const o=[t.reason,t.lastError].filter(Boolean).join("\n").toLowerCase();return o.includes("401")||o.includes("4001")||o.includes("unauthorized")||o.includes("code 1006")}class f extends Error{constructor(t,o){super(t),this.name="DaemonConnectionTestError",this.reason=o.reason,this.lastError=o.lastError}}async function y(t,o,n,c=l){const u=await c.getClientId(),p=c.createLocalTransportFactory(),b=Object.assign({clientId:u,clientType:"mobile",appVersion:c.resolveAppVersion()??void 0,suppressSendErrors:!0,reconnect:{enabled:!1}},n?.capabilities?{capabilities:n.capabilities}:{},"directSocket"!==t.type&&"directPipe"!==t.type||!p?{}:{transportFactory:p});if("directSocket"===t.type||"directPipe"===t.type)return Object.assign({},b,{url:c.buildLocalTransportUrl({transportType:"directSocket"===t.type?"socket":"pipe",transportPath:t.path})});if("directTcp"===t.type)return Object.assign({},b,{url:(0,s.buildDaemonWebSocketUrl)(t.endpoint,{useTls:t.useTls??!1})},t.password?{password:t.password}:{});if(!o)throw new Error("serverId is required to probe a relay connection");return Object.assign({},b,{url:(0,s.buildRelayWebSocketUrl)({endpoint:t.relayEndpoint,useTls:t.useTls??(0,s.shouldUseTlsForDefaultHostedRelay)(t.relayEndpoint),serverId:o}),e2ee:{enabled:!0,daemonPublicKeyB64:t.daemonPublicKeyB64}})}function w(t,o,n=l){const s=n.createClient(t);return new Promise((n,c)=>{const l=setTimeout(()=>{s.close().catch(()=>{}),c(new f("Connection timed out",{reason:"Connection timed out",lastError:s.lastError??null}))},o);s.connect().then(()=>{clearTimeout(l);const t=s.getLastServerInfoMessage();if(!t)return s.close().catch(()=>{}),void c(new f("Missing server info message",{reason:"Missing server info message",lastError:s.lastError??null}));n({client:s,serverId:t.serverId,hostname:t.hostname})}).catch(o=>{clearTimeout(l);const n=u(o instanceof Error?o.message:String(o)),y=u(s.lastError),w=b({config:t,reason:n,lastError:y})?"Incorrect password":p(n,y);s.close().catch(()=>{}),c(new f(w,{reason:n,lastError:y}))})})}function T(t,o){return o?.timeoutMs?o.timeoutMs:"relay"===t.type?1e4:6e3}},3500,[3450,3501,3497,3495,3502]);
15151
15151
  __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.createClientIdResolver=l,_e.getOrCreateClientId=async function(){return c.getOrCreate()};var t,e=r(d[0]),n=(t=e)&&t.__esModule?t:{default:t};const o="@otto:client-id-v1";function u(t){if("string"!=typeof t)return null;const e=t.trim();return e.length>0?e:null}function l(t){const e=t.storageKey??o;let n=null,l=null;return{async getOrCreate(){if(n)return n;if(l)return l;l=(async()=>{const o=u(await t.storage.getItem(e));if(o)return n=o,o;const l=`cid_${t.generateUuid()}`;return await t.storage.setItem(e,l),n=l,l})();try{return await l}finally{l=null}}}}const c=l({storage:n.default,generateUuid:function(){const t=globalThis.crypto;return t&&"function"==typeof t.randomUUID?t.randomUUID().replace(/-/g,""):`${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`}})},3501,[1015]);
@@ -15689,7 +15689,7 @@ __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{
15689
15689
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.PullRequestTabIcon=function(n){const s=(0,o.c)(4),{size:u,color:l,provider:v}=n;let _;s[0]!==l||s[1]!==v||s[2]!==u?(_=(0,c.jsx)(t.GitHostingIcon,{provider:v,size:u,color:l}),s[0]=l,s[1]=v,s[2]=u,s[3]=_):_=s[3];return _};var o=r(d[0]),t=r(d[1]),c=r(d[2])},4039,[306,3839,279]);
15690
15690
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.formatPrTabLabel=function(t){return null===t?"-":`${t}`}},4040,[]);
15691
15691
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.extractPrRepoIdentity=b,e.shouldFetchTimelineFrom=h,e.unsupportedTimelineKey=y,e.createInMemoryUnsupportedTimelineRegistry=w,e.fetchPrPaneTimelinePage=L,e.selectPrPaneState=F,e.usePrPaneData=function({serverId:l,cwd:c,enabled:w=!0,timelineEnabled:N=w}){const{t:v}=(0,o.useTranslation)(),f=(0,s.useHostRuntimeClient)(l),I=(0,s.useHostRuntimeIsConnected)(l),O=(0,u.useCheckoutPrStatusQuery)({serverId:l,cwd:c,enabled:w}),T=O.status,C=b(T),_=O.githubFeaturesEnabled,k=E,R=null===C.prNumber?null:y({serverId:l,cwd:c,prNumber:C.prNumber}),q=!!R&&k.has(R),U=h({hasClient:!!f,isConnected:I,timelineEnabled:N,githubFeaturesEnabled:_,cwd:c,identity:C,timelineUnsupported:q}),D=(0,t.useQuery)({queryKey:(0,n.useMemo)(()=>(0,p.prPaneTimelineQueryKey)({serverId:l,cwd:c,prNumber:C.prNumber}),[l,c,C.prNumber]),queryFn:async()=>{if(!f||null===C.prNumber||null===C.repoOwner||null===C.repoName)throw new Error(v("common.errors.daemonClientUnavailable"));return L({client:f,registry:k,serverId:l,cwd:c,prNumber:C.prNumber,repoOwner:C.repoOwner,repoName:C.repoName})},enabled:U,staleTime:1/0,refetchOnMount:!0,refetchOnReconnect:!1,refetchOnWindowFocus:!1,placeholderData:t.keepPreviousData,retry:(t,n)=>!P(n)&&t<3});return F({status:T,statusPayloadError:O.payloadError,statusError:O.error,statusIsLoading:O.isLoading,statusIsFetching:O.isFetching,githubFeaturesEnabled:_,forge:O.forge,timelineEnabled:N,shouldFetchTimeline:U,timelinePayload:D.data,timelineError:D.error,timelineIsLoading:D.isLoading,timelineIsFetching:D.isFetching,hostingProvider:O.hostingProvider,statusLoadFailedLabel:v("workspace.git.pr.errors.statusLoadFailed"),activityLoadFailedLabel:v("workspace.git.pr.errors.activityLoadFailed")})},e.isUnsupportedTimelineError=P;var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),u=r(d[4]),l=r(d[5]),c=r(d[6]),p=r(d[7]);function b(t){return{prNumber:t?.number??null,repoOwner:t?.repoOwner&&t.repoOwner.length>0?t.repoOwner:null,repoName:t?.repoName&&t.repoName.length>0?t.repoName:null}}function h({hasClient:t,isConnected:n,timelineEnabled:o,githubFeaturesEnabled:s,cwd:u,identity:l,timelineUnsupported:c}){return t&&n&&o&&s&&!!u&&null!==l.prNumber&&null!==l.repoOwner&&null!==l.repoName&&!c}function y({serverId:t,cwd:n,prNumber:o}){return`${t}\0${n}\0${o}`}function w(){const t=new Set;return{has:n=>t.has(n),add:n=>{t.add(n)}}}const E=w();async function L(t){try{return await t.client.pullRequestTimeline({cwd:t.cwd,prNumber:t.prNumber,repoOwner:t.repoOwner,repoName:t.repoName})}catch(n){throw P(n)&&t.registry.add(y({serverId:t.serverId,cwd:t.cwd,prNumber:t.prNumber})),n}}function F(t){const n=b(t.status),o=null!==n.prNumber&&t.timelineEnabled?(0,c.mapPrPaneData)(t.status,t.timelinePayload,void 0,t.forge??"github"):null,s=t.statusIsFetching&&!t.statusIsLoading,u=t.timelineIsFetching&&!t.timelineIsLoading,p=t.shouldFetchTimeline&&t.timelineIsLoading&&void 0===t.timelinePayload;return{data:o,forge:t.forge??"github",prNumber:n.prNumber,hostingProvider:t.hostingProvider??"github",isLoading:t.statusIsLoading||p,activityLoading:p,isRefreshing:s||u,error:N({statusPayloadError:t.statusPayloadError,statusError:t.statusError,timelineError:t.timelineError,timelinePayloadError:t.timelinePayload?.error??null,statusLoadFailedLabel:t.statusLoadFailedLabel??l.i18n.t("workspace.git.pr.errors.statusLoadFailed"),activityLoadFailedLabel:t.activityLoadFailedLabel??l.i18n.t("workspace.git.pr.errors.activityLoadFailed")}),githubFeaturesEnabled:t.githubFeaturesEnabled}}function N({statusPayloadError:t,statusError:n,timelineError:o,timelinePayloadError:s,statusLoadFailedLabel:u,activityLoadFailedLabel:l}){return t?new Error(t.message||u):n||(o&&!P(o)?o:s?new Error(s.message||l):null)}function P(t){if(!(t instanceof Error))return!1;const n=t.name.toLowerCase(),o=t;return"daemonrpcerror"===n&&"unknown_schema"===o.code&&"pull_request_timeline_request"===o.requestType}},4041,[926,36,1093,3448,3859,1152,4034,3508]);
15692
- __d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GitDiffPane=function({serverId:e,workspaceId:t,cwd:n,enabled:i,onOpenFile:l}){const{settings:u}=(0,L.useAppSettings)(),{t:f}=(0,d.useTranslation)(),x=(0,p.useIsCompactFormFactor)(),w=ce.isWeb,k=ce.isWeb&&!x,{preferences:C,updatePreferences:T}=(0,D.useChangesPreferences)(),I=C.wrapLines,M=C.viewMode,R=k?C.layout:"unified",W=(0,c.useCallback)(()=>{T({wrapLines:!I})},[T,I]),B=(0,c.useCallback)(()=>{T({hideWhitespace:!C.hideWhitespace})},[C.hideWhitespace,T]),O=(0,c.useCallback)(()=>{T({layout:"unified"===C.layout?"split":"unified"})},[C.layout,T]),U=Ot(u.codeFontSize,x),Z=Math.round(1.5*U),ee=[u.monoFontFamily,U,Z].join(":"),te=(0,c.useMemo)(()=>{const e=u.monoFontFamily.trim();return Object.assign({fontSize:U,lineHeight:Z},e?{fontFamily:e}:null)},[u.monoFontFamily,U,Z]),oe=(0,c.useMemo)(()=>({hovered:e,pressed:t,open:n})=>[Ut.diffModeTrigger,(Boolean(e)||t||Boolean(n))&&Ut.diffModeTriggerHovered],[]),re=C.pinnedToolbarItems,ae=(0,c.useCallback)(e=>{T({pinnedToolbarItems:(0,K.toggleChangesToolbarItem)(C.pinnedToolbarItems,e)})},[C.pinnedToolbarItems,T]),[he,ge]=(0,c.useState)(!1),pe=(0,c.useCallback)(()=>ge(!0),[]),me=(0,c.useCallback)(()=>ge(!1),[]),xe=(0,ne.useToast)(),we=(0,ie.useSessionStore)(t=>!0===t.sessions[e]?.serverInfo?.features?.checkoutRefresh),ye=(0,ie.useSessionStore)(t=>!0===t.sessions[e]?.serverInfo?.features?.checkoutGitCommit),be=(0,ie.useSessionStore)(t=>!0===t.sessions[e]?.serverInfo?.features?.checkoutGitLog),[ve,Se]=(0,c.useState)(Bt),ke=(0,c.useCallback)(e=>{Se(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Ce=(0,c.useCallback)(()=>{Se(Bt)},[]),Te=(0,Q.useCheckoutGitActionsStore)(e=>e.refresh),Ie="pending"===(0,Q.useCheckoutGitActionsStore)(t=>t.getStatus({serverId:e,cwd:n,actionId:"refresh"})),je=(0,c.useCallback)(()=>{Ie||Te({serverId:e,cwd:n}).catch(e=>{xe.error(e instanceof Error?e.message:f("workspace.git.diff.failedRefresh"))})},[n,Ie,Te,e,f,xe]),{status:De,isLoading:Le,isError:Me,error:Re}=(0,j.useCheckoutStatusQuery)({serverId:e,cwd:n}),We=_t({status:De,isStatusLoading:Le,isStatusError:Me,statusError:Re}),{isGit:Ae,notGit:Pe,statusErrorMessage:ze,baseRef:Ee,hasUncommittedChanges:Ue,currentBranchName:Ge,isOttoOwnedWorktree:at,baseSource:ct,isBaseEditable:dt}=We,ut=(0,c.useMemo)(()=>(0,ue.buildReviewDraftScopeKey)({serverId:e,workspaceId:t,cwd:n,baseRef:Ee,ignoreWhitespace:C.hideWhitespace}),[Ee,C.hideWhitespace,n,e,t]),pt=(0,ue.useResolvedDiffMode)({scopeKey:ut,hasUncommittedChanges:Ue}),mt=(0,ue.useSetDiffModeOverride)(),{files:wt,payloadError:yt,isLoading:bt}=(0,y.useCheckoutDiffQuery)({serverId:e,cwd:n,mode:pt,baseRef:Ee,ignoreWhitespace:C.hideWhitespace,enabled:(Zt={paneEnabled:!1!==i,isGit:Ae},Zt.paneEnabled&&Zt.isGit)}),Dt=ye&&"uncommitted"===pt,Wt=(0,c.useMemo)(()=>wt.filter(e=>!ve.has(e.path)).map(e=>e.path),[ve,wt]),Et=(0,c.useCallback)(()=>{Se(e=>wt.every(t=>!e.has(t.path))?new Set(wt.map(e=>e.path)):Bt)},[wt]),Ft=(0,c.useMemo)(()=>(0,ue.buildReviewDraftKey)({serverId:e,workspaceId:t,cwd:n,mode:pt,baseRef:Ee,branch:Ge,ignoreWhitespace:C.hideWhitespace}),[Ee,C.hideWhitespace,Ge,n,pt,e,t]),Gt=(0,c.useCallback)(()=>{mt({scopeKey:ut,override:{serverId:e,cwd:n,mode:"uncommitted",isDirtyAtSelection:Ue}})},[n,Ue,ut,e,mt]),Nt=(0,c.useCallback)(()=>{mt({scopeKey:ut,override:{serverId:e,cwd:n,mode:"base",isDirtyAtSelection:Ue}})},[n,Ue,ut,e,mt]),$t=(0,ue.useInlineReviewController)({reviewDraftKey:Ft}),Kt=(0,ue.useReviewCommentCount)(Ft),Xt=(0,ue.useClearReviewDraft)(),Yt=(0,c.useCallback)(()=>{(async()=>{await(0,J.confirmDialog)({title:1===Kt?f("review.removeAll.confirmTitleSingle"):f("review.removeAll.confirmTitleMultiple",{count:Kt}),message:f("review.removeAll.confirmMessage"),confirmLabel:f("review.removeAll.confirmButton"),destructive:!0})&&Xt({key:Ft})})()},[Xt,Kt,Ft,f]),Qt=(0,ue.useReviewAttachmentSnapshot)({key:Ft,diffFiles:wt,cwd:n,mode:pt,baseRef:Ee}),Jt=(0,c.useMemo)(()=>(0,de.buildWorkspaceAttachmentScopeKey)({serverId:e,workspaceId:t,cwd:n}),[n,e,t]);var Zt;(0,c.useEffect)(()=>{const e=e=>{const t=de.useWorkspaceAttachmentsStore.getState(),n=(t.attachmentsByScope[Jt]??[]).filter(e=>"review"!==e.kind);t.setWorkspaceAttachments({scopeKey:Jt,attachments:e?[...n,e]:n})};return e(Qt),()=>e(null)},[Qt,Jt]);const{githubFeaturesEnabled:en,payloadError:tn}=(0,_.useCheckoutPrStatusQuery)({serverId:e,cwd:n,enabled:Ae}),nn=(0,c.useMemo)(()=>n.trim(),[n]),on=(0,c.useMemo)(()=>(0,le.buildWorkspaceExplorerStateKey)({workspaceId:t,workspaceRoot:nn}),[nn,t]),rn=(0,se.usePanelStore)(e=>on?e.diffExpandedPathsByWorkspace[on]:void 0),sn=(0,se.usePanelStore)(e=>e.setDiffExpandedPathsForWorkspace),ln=(0,c.useMemo)(()=>new Set(rn??[]),[rn]),an=(0,se.usePanelStore)(e=>on?e.diffCollapsedFoldersByWorkspace[on]:void 0),cn=(0,se.usePanelStore)(e=>e.setDiffCollapsedFoldersForWorkspace),dn=(0,c.useMemo)(()=>(0,v.compressSingleChildChains)((0,v.buildDiffTree)(wt)),[wt]),un=(0,c.useMemo)(()=>(0,v.collectDirPaths)(dn),[dn]),fn=(0,c.useMemo)(()=>new Set(un),[un]),hn=(0,c.useMemo)(()=>new Set((an??[]).filter(e=>fn.has(e))),[an,fn]),gn=(0,c.useRef)(null),pn=(0,c.useCallback)(()=>{const e="flat"===M?"tree":"flat";"tree"===e&&(gn.current?.scrollToOffset({offset:0,animated:!1}),on&&cn(on,[])),T({viewMode:e})},[cn,T,M,on]),mn=(0,G.useWebScrollViewScrollbar)(gn,{enabled:w}),xn=(0,c.useRef)(0),wn=(0,c.useRef)(0),yn=(0,c.useRef)({}),bn=(0,c.useRef)({}),vn=(0,c.useRef)(0),Sn=(0,c.useRef)(44),[kn,Cn]=(0,c.useState)(0),Tn=2*h.BORDER_WIDTH[1],In=Tn+2*h.SPACING[4]+Z,{flatItems:jn,stickyHeaderIndices:_n}=(0,c.useMemo)(()=>{const{items:e,stickyHeaderIndices:t}=(0,b.buildDiffFlatItems)({files:wt,viewMode:M,tree:dn,collapsedFolders:hn,expandedPaths:ln});return{flatItems:e,stickyHeaderIndices:t}},[dn,hn,ln,wt,M]),Dn=(0,c.useCallback)(e=>{let t=null;return"binary"===e.status?t="binary":("too_large"===e.status||Fe(e))&&(t="too_large"),t?`${R}:${I?"wrap":"scroll"}:${ee}:${e.path}:${t}`:[R,I?"wrap":"scroll",ee,e.path,e.status??"ok",e.additions,e.deletions,e.hunks.length,Ct(e),Tt(e)].join(":")},[ee,R,I]),Ln=(0,c.useCallback)(e=>{if("too_large"===e.status||"binary"===e.status||Fe(e))return In;const t="split"===R?(0,P.buildSplitDiffRows)(e).length:Ct(e);return Tn+t*Z},[Tn,Z,R,In]),Mn=(0,c.useCallback)(e=>{if("folder"===e.type)return vn.current||Sn.current;if("header"===e.type)return yn.current[e.file.path]??Sn.current;const t=Dn(e.file);return bn.current[t]??Ln(e.file)},[Ln,Dn]),Rn=(0,c.useCallback)(e=>{if(!Number.isFinite(e)||e<=0)return;const t=vn.current;t>0&&Math.abs(t-e)<=qt||(vn.current=e,Cn(e=>e+1))},[]),Wn=(0,c.useCallback)((e,t)=>{if(!Number.isFinite(t)||t<=0)return;const n=yn.current[e];void 0!==n&&Math.abs(n-t)<=qt||(yn.current[e]=t,Sn.current=t,Cn(e=>e+1))},[]),An=(0,c.useCallback)((e,t)=>{if(!Number.isFinite(t)||t<0)return;const n=Dn(e),i=bn.current[n];void 0!==i&&Math.abs(i-t)<=qt||(bn.current[n]=t,Cn(e=>e+1))},[Dn]),Pn=(0,c.useCallback)(e=>{xn.current=e.nativeEvent.contentOffset.y,mn.onScroll(e)},[mn]),zn=(0,c.useCallback)(e=>{const t=e.nativeEvent.layout.height;!Number.isFinite(t)||t<=0||(wn.current=t,mn.onLayout(e))},[mn]),Hn=(0,c.useCallback)(e=>{const t=jn.findIndex(e);return t<0?null:(0,b.sumHeightsBefore)(jn,t,Mn)},[jn,Mn]),En=(0,c.useCallback)(e=>Hn(t=>"header"===t.type&&t.file.path===e)??0,[Hn]),Fn=(0,c.useCallback)(e=>{if(!on)return;const t=ln.has(e),n=!t,i=t?En(e):null,o=yn.current[e]??Sn.current;t&&null!==i&&(0,A.shouldAnchorHeaderBeforeCollapse)({headerOffset:i,headerHeight:o,viewportOffset:xn.current,viewportHeight:wn.current})&&null!==i&&gn.current?.scrollToOffset({offset:i,animated:!1});const s=n?[...ln,e]:Array.from(ln).filter(t=>t!==e);sn(on,s)},[En,ln,sn,on]),Vn=(0,c.useCallback)(e=>{if(!on)return;const t=hn.has(e);if(!t){const t=Hn(t=>"folder"===t.type&&t.dirPath===e),n=vn.current||Sn.current;null!==t&&(0,A.shouldAnchorHeaderBeforeCollapse)({headerOffset:t,headerHeight:n,viewportOffset:xn.current,viewportHeight:wn.current})&&gn.current?.scrollToOffset({offset:t,animated:!1})}const n=t?Array.from(hn).filter(t=>t!==e):[...hn,e];cn(on,n)},[hn,Hn,cn,on]),Bn=(0,c.useMemo)(()=>0!==wt.length&&wt.every(e=>ln.has(e.path)),[ln,wt]),On=(0,c.useMemo)(()=>Bn&&("tree"!==M||0===hn.size),[Bn,hn,M]),Un=(0,c.useCallback)(()=>{if(on){if(On)return sn(on,[]),void("tree"===M&&cn(on,un));wt.length<=Ve&&sn(on,wt.map(e=>e.path)),"tree"===M&&cn(on,[])}},[On,un,wt,cn,sn,M,on]),Gn=(0,se.usePanelStore)(e=>e.changesRevealRequest),[Nn,$n]=(0,c.useState)(null),Kn=(0,c.useRef)(Hn);Kn.current=Hn;const qn=(0,c.useRef)(null);(0,c.useEffect)(()=>()=>{null!==qn.current&&clearTimeout(qn.current)},[]),(0,c.useEffect)(()=>{$n(null)},[on]),(0,c.useEffect)(()=>{Gn&&on&&(se.usePanelStore.getState().clearChangesRevealRequest(),$n(Gn.path))},[Gn,on]),(0,c.useEffect)(()=>{if(!Nn||!on)return;if(!wt.some(e=>e.path===Nn))return void(bt||$n(null));if("tree"===M){const e=Array.from(hn).filter(e=>Nn.startsWith(`${e}/`));if(e.length>0){const t=new Set(e);return void cn(on,Array.from(hn).filter(e=>!t.has(e)))}}if(!ln.has(Nn))return void sn(on,[...ln,Nn]);const e=e=>"header"===e.type&&e.file.path===Nn,t=Hn(e);null!==t&&($n(null),gn.current?.scrollToOffset({offset:t,animated:!1}),null!==qn.current&&clearTimeout(qn.current),qn.current=setTimeout(()=>{qn.current=null;const n=Kn.current(e);null!==n&&n!==t&&gn.current?.scrollToOffset({offset:n,animated:!1})},100))},[hn,Hn,ln,wt,bt,Nn,cn,sn,M,on]);const Xn=wt.length>0,Yn=(0,c.useMemo)(()=>{const e=[];if(k){const t="split"===C.layout;e.push({id:"split",label:f(t?"workspace.git.diff.switchToUnified":"workspace.git.diff.switchToSplit"),renderIcon:e=>t?(0,fe.jsx)(Ne,{size:e,uniProps:Oe}):(0,fe.jsx)($e,{size:e,uniProps:Oe}),onPress:O,testID:"changes-toggle-layout"})}if(Xn){const t="tree"===M;e.push({id:"tree",label:f(t?"workspace.git.diff.showFlatView":"workspace.git.diff.showTreeView"),renderIcon:e=>t?(0,fe.jsx)(Je,{size:e,uniProps:Oe}):(0,fe.jsx)(Qe,{size:e,uniProps:Oe}),onPress:pn,testID:"changes-toggle-view-mode"});const n=!Bn&&wt.length>Ve;let i;i=f(On?"workspace.git.diff.collapseAll":n?"workspace.git.diff.expandAllTooManyFiles":"workspace.git.diff.expandAll"),e.push({id:"expand",label:i,renderIcon:e=>On?(0,fe.jsx)(Xe,{size:e,uniProps:Oe}):(0,fe.jsx)(Ye,{size:e,uniProps:Oe}),onPress:Un,disabled:n,testID:"changes-toggle-expand-all"})}return e.push({id:"whitespace",label:C.hideWhitespace?f("workspace.git.diff.showWhitespace"):f("workspace.git.diff.hideWhitespace"),renderIcon:e=>(0,fe.jsx)(Ke,{size:e,uniProps:Oe}),onPress:B,testID:"changes-toggle-whitespace"}),e.push({id:"wrap",label:f(I?"workspace.git.diff.scrollLongLines":"workspace.git.diff.wrapLongLines"),renderIcon:e=>(0,fe.jsx)(qe,{size:e,uniProps:Oe}),onPress:W,testID:"changes-toggle-wrap-lines"}),Kt>0&&e.push({id:"removeComments",label:f("review.removeAll.action"),renderIcon:e=>(0,fe.jsx)(vt,{size:e,uniProps:Oe}),onPress:Yt,separatorBefore:!0,testID:"changes-remove-all-comments"}),we&&e.push({id:"refresh",label:f(Ie?"workspace.git.diff.refreshing":"workspace.git.diff.refresh"),renderIcon:e=>Ie?(0,fe.jsx)(kt,{size:e,uniProps:Oe}):(0,fe.jsx)(St,{size:e,uniProps:Oe}),onPress:je,disabled:Ie,separatorBefore:!0,testID:"changes-refresh"}),e},[k,C.layout,C.hideWhitespace,Xn,wt,M,Bn,On,I,Kt,we,Ie,O,pn,Un,B,W,Yt,je,f]),Qn=(0,F.useTextEditorFeature)(e),[Jn,Zn]=(0,c.useState)(null),ei=(0,c.useCallback)(e=>{Zn(e)},[]),ti=(0,c.useCallback)(({target:e,x:t,y:n})=>{Zn({path:e.filePath,lineStart:e.newLineNumber??e.oldLineNumber??void 0,x:t,y:n})},[]),ni=(0,c.useCallback)(e=>{e||Zn(null)},[]),ii=(0,c.useCallback)(()=>{Jn&&l&&l(Jn.path,{edit:!0,lineStart:Jn.lineStart})},[Jn,l]),oi=(0,c.useCallback)(()=>{Jn&&E.setStringAsync((0,V.buildAbsoluteExplorerPath)({workspaceRoot:nn,entryPath:Jn.path}))},[Jn,nn]),ri=(0,c.useCallback)(()=>{if(!Jn)return;const{requestFilesReveal:t,setExplorerTabForCheckout:i}=se.usePanelStore.getState();t(Jn.path),i({serverId:e,cwd:n,isGit:!0,tab:"files"})},[Jn,n,e]),si=At({serverId:e,cwd:n,diffMode:pt,contextMenuPath:Jn?.path??null,selectedPaths:Wt,commitSelectionEnabled:Dt}),li=Pt({serverId:e,scopeKey:Jt,request:Jn}),ai=(0,c.useCallback)(({item:e})=>"folder"===e.type?(0,fe.jsx)(S.DiffFolderRow,{dirPath:e.dirPath,displayName:e.displayName,depth:e.depth,ancestorMask:e.ancestorMask,collapsed:e.collapsed,additions:e.additions,deletions:e.deletions,onToggle:Vn,onHeightChange:Rn,testID:`diff-folder-${e.dirPath}`}):"header"===e.type?(0,fe.jsx)(He,{file:e.file,isExpanded:e.isExpanded,depth:e.depth,ancestorMask:e.ancestorMask,showDir:"flat"===M,selectable:Dt,selected:!ve.has(e.file.path),onToggleSelected:ke,onToggle:Fn,onHeaderHeightChange:Wn,onShowContextMenu:ei,testID:`diff-file-${e.fileIndex}`}):(0,fe.jsx)(Be,{file:e.file,layout:R,wrapLines:I,codeFontSize:U,textMetricsStyle:te,reviewActions:$t,onLineContextMenu:ti,onBodyHeightChange:An,testID:`diff-file-${e.fileIndex}-body`}),[U,Dt,ve,te,R,An,Rn,Wn,ti,ei,Fn,ke,Vn,$t,M,I]),ci=(0,c.useCallback)(e=>"folder"===e.type?`folder-${e.dirPath}`:`${e.type}-${e.file.path}`,[]),di=(0,c.useCallback)((e,t)=>{const n=(0,b.sumHeightsBefore)(jn,t,Mn),i=jn[t];return{length:i?Mn(i):0,offset:n,index:t}},[jn,Mn]),ui=(0,c.useMemo)(()=>({expandedPathsArray:rn,collapsedFoldersArray:an,commitSelectionEnabled:Dt,deselectedPaths:ve,effectiveLayout:R,diffBodyTypographyKey:ee,heightVersion:kn,viewMode:M,wrapLines:I,reviewActions:$t}),[rn,an,Dt,ve,R,ee,kn,M,I,$t]),fi=wt.length>0,hi=yt?.message??null,gi=Rt(en,tn),pi=(0,c.useMemo)(()=>Lt(Ee,f("workspace.git.diff.base")),[Ee,f]),mi=(0,h.useIconSize)(),xi=mi.md,wi=(0,c.useMemo)(()=>({commit:(0,fe.jsx)(Ze,{size:xi,uniProps:Oe}),pull:(0,fe.jsx)(et,{size:xi,uniProps:Oe}),push:(0,fe.jsx)(tt,{size:xi,uniProps:Oe}),pullAndPush:(0,fe.jsx)(nt,{size:xi,uniProps:Oe}),viewPr:e=>(0,fe.jsx)(it,{provider:e,size:xi,uniProps:Oe}),createPr:e=>(0,fe.jsx)(it,{provider:e,size:xi,uniProps:Oe}),mergePrSquash:e=>(0,fe.jsx)(it,{provider:e,size:xi,uniProps:Oe}),mergePrMerge:e=>(0,fe.jsx)(it,{provider:e,size:xi,uniProps:Oe}),mergePrRebase:e=>(0,fe.jsx)(it,{provider:e,size:xi,uniProps:Oe}),merge:(0,fe.jsx)(ot,{size:xi,uniProps:Oe}),mergeFromBase:(0,fe.jsx)(rt,{size:xi,uniProps:Oe}),archive:(0,fe.jsx)(st,{size:xi,uniProps:Oe})}),[xi]),{gitActions:yi,branchLabel:bi}=(0,Y.useGitActions)({serverId:e,cwd:n,icons:wi}),vi=(0,c.useMemo)(()=>Mt(bi,pi),[pi,bi]),Si=f("workspace.git.diff.uncommitted"),ki=f("workspace.git.diff.committed"),Ci=It(C.hideWhitespace,pt,pi,{hiddenWhitespace:f("workspace.git.diff.emptyHiddenWhitespace"),uncommitted:f("workspace.git.diff.emptyUncommitted"),againstBase:e=>f("workspace.git.diff.emptyAgainstBase",{baseRef:e})}),Ti=(0,fe.jsx)(jt,{isStatusLoading:Le,statusErrorMessage:ze,notGit:Pe,isDiffLoading:bt,diffErrorMessage:hi,hasChanges:fi,emptyMessage:Ci,flatItems:jn,stickyHeaderIndices:_n,renderFlatItem:ai,flatKeyExtractor:ci,getFlatItemLayout:di,flatExtraData:ui,diffListRef:gn,handleDiffListLayout:zn,handleDiffListScroll:Pn,onContentSizeChange:mn.onContentSizeChange,showWebScrollbar:w,checkingRepositoryLabel:f("workspace.git.diff.checkingRepository"),notRepositoryLabel:f("workspace.git.diff.notRepository")});return(0,fe.jsxs)(s.View,{style:Ut.container,children:[Ae&&(Ge||x)?(0,fe.jsxs)(s.View,{style:Ut.header,testID:"changes-header",children:[(0,fe.jsx)(s.View,{style:Ut.headerBranchArea,children:(0,fe.jsx)(q.BranchSwitcher,{currentBranchName:Ge,serverId:e,workspaceId:t??n,workspaceDirectory:n,isGitCheckout:Ae,testID:"changes-branch-switcher"})}),x?(0,fe.jsx)(N.GitActionsSplitButton,{gitActions:yi}):null]}):null,Ae?(0,fe.jsx)(s.View,{style:Ut.diffStatusContainer,children:(0,fe.jsxs)(s.View,{style:Ut.diffStatusInner,onPointerEnter:pe,onPointerLeave:me,children:[(0,fe.jsxs)(s.View,{style:Ut.diffStatusLeading,children:[(0,fe.jsxs)(z.DropdownMenu,{children:[(0,fe.jsxs)(z.DropdownMenuTrigger,{style:oe,testID:"changes-diff-status",accessibilityRole:"button",accessibilityLabel:f("workspace.git.diff.diffMode"),children:[(0,fe.jsx)(o.Text,{style:Ut.diffStatusText,numberOfLines:1,children:"uncommitted"===pt?Si:ki}),(0,fe.jsx)(lt,{size:mi.xs,uniProps:Oe})]}),(0,fe.jsxs)(z.DropdownMenuContent,{align:"start",width:260,testID:"changes-diff-status-menu",children:[(0,fe.jsx)(z.DropdownMenuItem,{testID:"changes-diff-mode-uncommitted",selected:"uncommitted"===pt,onSelect:Gt,children:Si}),(0,fe.jsx)(z.DropdownMenuSeparator,{}),(0,fe.jsx)(z.DropdownMenuItem,{testID:"changes-diff-mode-committed",selected:"base"===pt,description:vi,onSelect:Nt,children:ki})]})]}),(0,fe.jsx)(X.DiffBaseSwitcher,{visible:"base"===pt,serverId:e,workspaceId:t,cwd:n,baseRefLabel:pi,currentBranchName:Ge,isOttoOwnedWorktree:at,baseSource:ct,isBaseEditable:dt})]}),(0,fe.jsx)($.ChangesToolbar,{items:Yn,pinnedItems:re,onTogglePin:ae,hovered:he,isMobile:x,hideUntilHover:u.hidePinnedToolbarOptions,optionsLabel:f("workspace.git.diff.options")})]})}):null,gi?(0,fe.jsx)(o.Text,{style:Ut.actionErrorText,children:gi}):null,(0,fe.jsxs)(s.View,{style:Ut.diffContainer,children:[Ti,fi?mn.overlay:null]}),(0,fe.jsx)(Vt,{serverId:e,cwd:n,workspaceId:t,selectedPaths:Wt,totalFiles:wt.length,commitSupported:ye,logSupported:be,isGit:Ae,diffMode:pt,hasChanges:fi,onToggleSelectAll:Et,onCommitted:Ce}),(0,fe.jsx)(H.ContextMenu,{open:null!==Jn,onOpenChange:ni,anchor:Jn,children:(0,fe.jsxs)(H.ContextMenuContent,{width:220,testID:"changes-context-menu",children:[(0,fe.jsx)(Ht,{toggle:li}),Qn&&l?(0,fe.jsx)(H.ContextMenuItem,{leading:ft,onSelect:ii,testID:"changes-context-menu-edit",children:f("workspace.fileExplorer.context.edit")}):null,(0,fe.jsx)(xt,{serverId:e,workspaceId:t,request:Jn}),(0,fe.jsx)(H.ContextMenuItem,{leading:gt,onSelect:ri,testID:"changes-context-menu-find-in-files",children:f("workspace.fileExplorer.context.findInFiles")}),(0,fe.jsx)(H.ContextMenuItem,{leading:ht,onSelect:oi,testID:"changes-context-menu-copy-path",children:f("workspace.fileExplorer.context.copyPath")}),(0,fe.jsx)(zt,{rollback:si})]})})]})};var e=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=r(_d[3]),o=r(_d[4]),s=r(_d[5]),l=r(_d[6]),c=r(_d[7]),d=r(_d[8]),u=r(_d[9]);r(_d[10]),r(_d[11]),r(_d[12]),r(_d[13]),r(_d[14]),r(_d[15]);var f=r(_d[16]),h=r(_d[17]),p=r(_d[18]),x=r(_d[19]),w=r(_d[20]),y=r(_d[21]),b=r(_d[22]),v=r(_d[23]),S=r(_d[24]),k=r(_d[25]),C=r(_d[26]),T=r(_d[27]),I=r(_d[28]),j=r(_d[29]),_=r(_d[30]),D=r(_d[31]),L=r(_d[32]),M=r(_d[33]),R=r(_d[34]),W=r(_d[35]),A=r(_d[36]),P=r(_d[37]),z=r(_d[38]),H=r(_d[39]),E=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),t.default=e,t})(r(_d[40])),F=r(_d[41]),V=r(_d[42]),B=r(_d[43]),O=r(_d[44]),U=r(_d[45]),G=r(_d[46]),N=r(_d[47]),$=r(_d[48]),K=r(_d[49]),q=r(_d[50]),X=r(_d[51]),Y=r(_d[52]),Q=r(_d[53]),J=r(_d[54]),Z=r(_d[55]),ee=r(_d[56]),te=r(_d[57]),ne=r(_d[58]),ie=r(_d[59]),oe=r(_d[60]),re=r(_d[61]),se=r(_d[62]),le=r(_d[63]),ae=r(_d[64]),ce=r(_d[65]),de=r(_d[66]),ue=r(_d[67]),fe=r(_d[68]);function he({pressed:e}){return[Ut.fileHeader,e&&Ut.fileHeaderPressed]}function ge(e){if(!ce.isNative)return e?{whiteSpace:"pre-wrap",overflowWrap:"anywhere"}:{whiteSpace:"pre",overflowWrap:"normal"}}function pe(e){const{lineHeight:t}=e;return"number"==typeof t&&Number.isFinite(t)?t:void 0}function me(e){const t=(0,l.c)(4);let n;t[0]!==e?(n=pe(e),t[0]=e,t[1]=n):n=t[1];const i=n;let o;return t[2]!==i?(o=void 0!==i?(0,re.inlineUnistylesStyle)({minHeight:i}):null,t[2]=i,t[3]=o):o=t[3],o}function xe(e){const t=(0,l.c)(5),{token:n}=e;let i,s;return t[0]!==n.style?(i=(0,R.syntaxTokenStyleFor)(n.style),t[0]=n.style,t[1]=i):i=t[1],t[2]!==i||t[3]!==n.text?(s=(0,fe.jsx)(o.Text,{style:i,children:n.text}),t[2]=i,t[3]=n.text,t[4]=s):s=t[4],s}function we(e){const t=(0,l.c)(13),{tokens:n,textMetricsStyle:i,wrapLines:s,testID:c}=e,d=void 0!==s&&s;let u,f;t[0]!==d?(u=ge(d),t[0]=d,t[1]=u):u=t[1],t[2]!==u||t[3]!==i?(f=[Ut.diffTextMetrics,i,Ut.diffLineText,u],t[2]=u,t[3]=i,t[4]=f):f=t[4];const h=f;let p;t[5]!==n?(p=n.map(be),t[5]=n,t[6]=p):p=t[6];const x=p;let w,y;return t[7]!==x?(w=x.map(ye),t[7]=x,t[8]=w):w=t[8],t[9]!==h||t[10]!==w||t[11]!==c?(y=(0,fe.jsx)(o.Text,{style:h,testID:c,children:w}),t[9]=h,t[10]=w,t[11]=c,t[12]=y):y=t[12],y}function ye(e){const{key:t,token:n}=e;return(0,fe.jsx)(xe,{token:n},t)}function be(e,t){return{key:`${t}-${e.text}`,token:e}}const ve=[];function Se(){}const ke=ce.isWeb?{cursor:"auto"}:null;function Ce(e){const t=(0,l.c)(29),{reviewTarget:i,reviewActions:o,onHoverChange:c,hoverTargetKey:d,onHoverTargetChange:u,onLineContextMenu:f,style:h,children:p}=e,x=o?.onStartComment;let w;t[0]!==x||t[1]!==i?(w=()=>{i&&x&&x(i)},t[0]=x,t[1]=i,t[2]=w):w=t[2];const y=w;let b;t[3]!==d||t[4]!==c||t[5]!==u?(b=()=>{c?.(!0),d&&u?.(d)},t[3]=d,t[4]=c,t[5]=u,t[6]=b):b=t[6];const v=b;let S;t[7]!==d||t[8]!==c||t[9]!==u?(S=()=>{c?.(!1),d&&u?.(null)},t[7]=d,t[8]=c,t[9]=u,t[10]=S):S=t[10];const k=S;let C;t[11]!==f||t[12]!==i?(C=e=>{if(!i||!f)return;const t=(0,H.contextMenuAnchorFromEvent)(e);t&&f({target:i,x:t.x,y:t.y})},t[11]=f,t[12]=i,t[13]=C):C=t[13];const T=C;let I;t[14]!==h?(I=[h,ke],t[14]=h,t[15]=I):I=t[15];const j=I,_=Boolean(i&&f);if(ce.isWeb&&(c||u||_)){const e=_?T:void 0;let i;return t[16]!==p||t[17]!==v||t[18]!==k||t[19]!==j||t[20]!==e?(i=(0,fe.jsx)(n.Pressable,{onHoverIn:v,onHoverOut:k,onContextMenu:e,style:j,children:p}),t[16]=p,t[17]=v,t[18]=k,t[19]=j,t[20]=e,t[21]=i):i=t[21],i}if(!ce.isNative||!i||!x){let e;return t[22]!==p||t[23]!==h?(e=(0,fe.jsx)(s.View,{style:h,children:p}),t[22]=p,t[23]=h,t[24]=e):e=t[24],e}let D;return t[25]!==p||t[26]!==y||t[27]!==h?(D=(0,fe.jsx)(n.Pressable,{onPress:y,style:h,children:p}),t[25]=p,t[26]=y,t[27]=h,t[28]=D):D=t[28],D}function Te(e){return e?"add"===e?Ut.addLineContainer:"remove"===e?Ut.removeLineContainer:"header"===e?Ut.headerLineContainer:Ut.contextLineContainer:Ut.emptySplitCell}function Ie(e){const t=(0,l.c)(39),{lineNumber:n,type:i,gutterWidth:s,textMetricsStyle:c,reviewTarget:d,reviewActions:u,isLineHovered:f,style:h,textTestID:p,actionTestID:x}=e;let w;t[0]!==c?(w=pe(c),t[0]=c,t[1]=w):w=t[1];const y=w,b=me(c);let v,S,k;t[2]!==i?(v=Te(i),t[2]=i,t[3]=v):v=t[3],t[4]!==s?(S=(0,re.inlineUnistylesStyle)({width:s}),t[4]=s,t[5]=S):S=t[5],t[6]!==b||t[7]!==h||t[8]!==v||t[9]!==S?(k=[Ut.gutterCell,v,b,S,h],t[6]=b,t[7]=h,t[8]=v,t[9]=S,t[10]=k):k=t[10];const C=k,T="add"===i&&Ut.addLineNumberText,I="remove"===i&&Ut.removeLineNumberText;let j;t[11]!==T||t[12]!==I||t[13]!==c?(j=[Ut.diffTextMetrics,c,Ut.lineNumberText,T,I],t[11]=T,t[12]=I,t[13]=c,t[14]=j):j=t[14];const _=j;let D,L;t[15]!==u?.commentsByTarget||t[16]!==d?(D=()=>d?u?.commentsByTarget.get(d.key)??ve:ve,t[15]=u?.commentsByTarget,t[16]=d,t[17]=D):D=t[17],t[18]!==D?(L=D(),t[18]=D,t[19]=L):L=t[19];const M=L,R=u?.editor??null;let W;t[20]!==d||t[21]!==R?(W=(0,ue.isInlineReviewEditorForTarget)(R,d),t[20]=d,t[21]=R,t[22]=W):W=t[22];const A=W,P=u?.onStartComment??Se;let z,H,E;return t[23]!==n?(z=(0,ae.formatDiffGutterText)(n),t[23]=n,t[24]=z):z=t[24],t[25]!==z||t[26]!==_||t[27]!==p?(H=(0,fe.jsx)(o.Text,{numberOfLines:1,style:_,testID:p,children:z}),t[25]=z,t[26]=_,t[27]=p,t[28]=H):H=t[28],t[29]!==x||t[30]!==M||t[31]!==C||t[32]!==A||t[33]!==f||t[34]!==y||t[35]!==P||t[36]!==d||t[37]!==H?(E=(0,fe.jsx)(ue.InlineReviewGutterCell,{reviewTarget:d,comments:M,isEditorOpen:A,isLineHovered:f,lineHeight:y,onStartComment:P,style:C,actionTestID:x,children:H}),t[29]=x,t[30]=M,t[31]=C,t[32]=A,t[33]=f,t[34]=y,t[35]=P,t[36]=d,t[37]=H,t[38]=E):E=t[38],E}function je(e){const t=(0,l.c)(31),{line:n,wrapLines:i,textMetricsStyle:s,reviewTarget:c,reviewActions:d,onHoverChange:u,hoverTargetKey:f,onHoverTargetChange:h,onLineContextMenu:p,textTestID:x}=e,w=(0,ae.hasVisibleDiffTokens)(n.tokens)?n.tokens:null,y=me(s);let b,v;t[0]!==n.type?(b=Te(n.type),t[0]=n.type,t[1]=b):b=t[1],t[2]!==y||t[3]!==b?(v=[Ut.textLineContainer,b,y],t[2]=y,t[3]=b,t[4]=v):v=t[4];const S=v;let k;t[5]!==i?(k=ge(i),t[5]=i,t[6]=k):k=t[6];const C="add"===n.type&&Ut.addLineText,T="remove"===n.type&&Ut.removeLineText,I="header"===n.type&&Ut.headerLineText,j="context"===n.type&&Ut.contextLineText;let _;t[7]!==k||t[8]!==C||t[9]!==T||t[10]!==I||t[11]!==j||t[12]!==s?(_=[Ut.diffTextMetrics,s,Ut.diffLineText,k,C,T,I,j],t[7]=k,t[8]=C,t[9]=T,t[10]=I,t[11]=j,t[12]=s,t[13]=_):_=t[13];const D=_;let L,M;return t[14]!==n.content||t[15]!==n.type||t[16]!==s||t[17]!==D||t[18]!==x||t[19]!==w||t[20]!==i?(L="header"!==n.type&&w?(0,fe.jsx)(we,{tokens:w,textMetricsStyle:s,wrapLines:i,testID:x}):(0,fe.jsx)(o.Text,{style:D,testID:x,children:(0,ae.formatDiffContentText)(n.content)}),t[14]=n.content,t[15]=n.type,t[16]=s,t[17]=D,t[18]=x,t[19]=w,t[20]=i,t[21]=L):L=t[21],t[22]!==S||t[23]!==f||t[24]!==u||t[25]!==h||t[26]!==p||t[27]!==d||t[28]!==c||t[29]!==L?(M=(0,fe.jsx)(Ce,{reviewTarget:c,reviewActions:d,onHoverChange:u,hoverTargetKey:f,onHoverTargetChange:h,onLineContextMenu:p,style:S,children:L}),t[22]=S,t[23]=f,t[24]=u,t[25]=h,t[26]=p,t[27]=d,t[28]=c,t[29]=L,t[30]=M):M=t[30],M}function De(e){const t=(0,l.c)(29),{line:n,wrapLines:i,textMetricsStyle:s,reviewActions:c,onHoverChange:d,hoverTargetKey:u,onHoverTargetChange:f,onLineContextMenu:h}=e,p=n&&(0,ae.hasVisibleDiffTokens)(n.tokens)?n.tokens:null,x=me(s),w=n?.type;let y,b;t[0]!==w?(y=Te(w),t[0]=w,t[1]=y):y=t[1],t[2]!==x||t[3]!==y?(b=[Ut.textLineContainer,y,x],t[2]=x,t[3]=y,t[4]=b):b=t[4];const v=b;let S;t[5]!==i?(S=ge(i),t[5]=i,t[6]=S):S=t[6];const k="add"===n?.type&&Ut.addLineText,C="remove"===n?.type&&Ut.removeLineText,T="context"===n?.type&&Ut.contextLineText,I=!n&&Ut.emptySplitCellText;let j;t[7]!==S||t[8]!==k||t[9]!==C||t[10]!==T||t[11]!==I||t[12]!==s?(j=[Ut.diffTextMetrics,s,Ut.diffLineText,S,k,C,T,I],t[7]=S,t[8]=k,t[9]=C,t[10]=T,t[11]=I,t[12]=s,t[13]=j):j=t[13];const _=j,D=n?.reviewTarget;let L,M;return t[14]!==n?.content||t[15]!==s||t[16]!==_||t[17]!==p||t[18]!==i?(L=p?(0,fe.jsx)(we,{tokens:p,textMetricsStyle:s,wrapLines:i}):(0,fe.jsx)(o.Text,{style:_,children:(0,ae.formatDiffContentText)(n?.content)}),t[14]=n?.content,t[15]=s,t[16]=_,t[17]=p,t[18]=i,t[19]=L):L=t[19],t[20]!==v||t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==h||t[25]!==c||t[26]!==D||t[27]!==L?(M=(0,fe.jsx)(Ce,{reviewTarget:D,reviewActions:c,onHoverChange:d,hoverTargetKey:u,onHoverTargetChange:f,onLineContextMenu:h,style:v,children:L}),t[20]=v,t[21]=u,t[22]=d,t[23]=f,t[24]=h,t[25]=c,t[26]=D,t[27]=L,t[28]=M):M=t[28],M}function Le(e){const t=(0,l.c)(36),{line:n,lineNumber:i,gutterWidth:s,wrapLines:d,textMetricsStyle:u,reviewTarget:f,reviewActions:h,onLineContextMenu:p}=e,[x,w]=(0,c.useState)(!1),y=(0,ae.hasVisibleDiffTokens)(n.tokens)?n.tokens:null,b=me(u);let v,S;t[0]!==n.type?(v=Te(n.type),t[0]=n.type,t[1]=v):v=t[1],t[2]!==b||t[3]!==v?(S=[Ut.diffLineContainer,v,b],t[2]=b,t[3]=v,t[4]=S):S=t[4];const k=S;let C;t[5]!==d?(C=ge(d),t[5]=d,t[6]=C):C=t[6];const T="add"===n.type&&Ut.addLineText,I="remove"===n.type&&Ut.removeLineText,j="header"===n.type&&Ut.headerLineText,_="context"===n.type&&Ut.contextLineText;let D;t[7]!==C||t[8]!==T||t[9]!==I||t[10]!==j||t[11]!==_||t[12]!==u?(D=[Ut.diffTextMetrics,u,Ut.diffLineText,C,T,I,j,_],t[7]=C,t[8]=T,t[9]=I,t[10]=j,t[11]=_,t[12]=u,t[13]=D):D=t[13];const L=D;let M,R,W;return t[14]!==s||t[15]!==x||t[16]!==n.type||t[17]!==i||t[18]!==h||t[19]!==f||t[20]!==u?(M=(0,fe.jsx)(Ie,{lineNumber:i,type:n.type,gutterWidth:s,textMetricsStyle:u,reviewTarget:f,reviewActions:h,isLineHovered:x,style:Ut.lineNumberGutter}),t[14]=s,t[15]=x,t[16]=n.type,t[17]=i,t[18]=h,t[19]=f,t[20]=u,t[21]=M):M=t[21],t[22]!==n.content||t[23]!==n.type||t[24]!==u||t[25]!==L||t[26]!==y||t[27]!==d?(R="header"!==n.type&&y?(0,fe.jsx)(we,{tokens:y,textMetricsStyle:u,wrapLines:d}):(0,fe.jsx)(o.Text,{style:L,children:(0,ae.formatDiffContentText)(n.content)}),t[22]=n.content,t[23]=n.type,t[24]=u,t[25]=L,t[26]=y,t[27]=d,t[28]=R):R=t[28],t[29]!==k||t[30]!==p||t[31]!==h||t[32]!==f||t[33]!==R||t[34]!==M?(W=(0,fe.jsxs)(Ce,{reviewTarget:f,reviewActions:h,onHoverChange:w,onLineContextMenu:p,style:k,children:[M,R]}),t[29]=k,t[30]=p,t[31]=h,t[32]=f,t[33]=R,t[34]=M,t[35]=W):W=t[35],W}function Me(e){const t=(0,l.c)(35),{line:n,gutterWidth:i,wrapLines:s,textMetricsStyle:d,reviewActions:u,onLineContextMenu:f}=e,[h,p]=(0,c.useState)(!1),x=n&&(0,ae.hasVisibleDiffTokens)(n.tokens)?n.tokens:null,w=me(d),y=n?.type;let b,v;t[0]!==y?(b=Te(y),t[0]=y,t[1]=b):b=t[1],t[2]!==w||t[3]!==b?(v=[Ut.diffLineContainer,b,w],t[2]=w,t[3]=b,t[4]=v):v=t[4];const S=v;let k;t[5]!==s?(k=ge(s),t[5]=s,t[6]=k):k=t[6];const C="add"===n?.type&&Ut.addLineText,T="remove"===n?.type&&Ut.removeLineText,I="context"===n?.type&&Ut.contextLineText,j=!n&&Ut.emptySplitCellText;let _;t[7]!==k||t[8]!==C||t[9]!==T||t[10]!==I||t[11]!==j||t[12]!==d?(_=[Ut.diffTextMetrics,d,Ut.diffLineText,k,C,T,I,j],t[7]=k,t[8]=C,t[9]=T,t[10]=I,t[11]=j,t[12]=d,t[13]=_):_=t[13];const D=_,L=n?.reviewTarget,M=n?.lineNumber??null,R=n?.type,W=n?.reviewTarget;let A,P,z;return t[14]!==i||t[15]!==h||t[16]!==u||t[17]!==M||t[18]!==R||t[19]!==W||t[20]!==d?(A=(0,fe.jsx)(Ie,{lineNumber:M,type:R,gutterWidth:i,textMetricsStyle:d,reviewTarget:W,reviewActions:u,isLineHovered:h,style:Ut.lineNumberGutter}),t[14]=i,t[15]=h,t[16]=u,t[17]=M,t[18]=R,t[19]=W,t[20]=d,t[21]=A):A=t[21],t[22]!==n?.content||t[23]!==d||t[24]!==D||t[25]!==x||t[26]!==s?(P=x?(0,fe.jsx)(we,{tokens:x,textMetricsStyle:d,wrapLines:s}):(0,fe.jsx)(o.Text,{style:D,children:(0,ae.formatDiffContentText)(n?.content)}),t[22]=n?.content,t[23]=d,t[24]=D,t[25]=x,t[26]=s,t[27]=P):P=t[27],t[28]!==S||t[29]!==f||t[30]!==u||t[31]!==L||t[32]!==A||t[33]!==P?(z=(0,fe.jsxs)(Ce,{reviewTarget:L,reviewActions:u,onHoverChange:p,onLineContextMenu:f,style:S,children:[A,P]}),t[28]=S,t[29]=f,t[30]=u,t[31]=L,t[32]=A,t[33]=P,t[34]=z):z=t[34],z}function Re(e){const t=(0,l.c)(14),{reviewTarget:n,reviewActions:i,reservedHeight:o,viewportWidth:c,pinToViewport:d}=e;let u;t[0]!==i||t[1]!==n?(u=(0,ue.getInlineReviewThreadState)({reviewTarget:n,reviewActions:i}),t[0]=i,t[1]=n,t[2]=u):u=t[2];const f=u,h=o??f?.height??0;let p;t[3]!==h?(p=(0,re.inlineUnistylesStyle)({minHeight:h}),t[3]=h,t[4]=p):p=t[4];const x=p;if(0===h)return null;if(!n||!i||!f){let e;return t[5]!==x?(e=(0,fe.jsx)(s.View,{style:x}),t[5]=x,t[6]=e):e=t[6],e}const w=`review-thread-${n.key}`;let y;return t[7]!==h||t[8]!==d||t[9]!==i||t[10]!==n||t[11]!==w||t[12]!==c?(y=(0,fe.jsx)(ue.InlineReviewThread,{reviewTarget:n,reviewActions:i,height:h,viewportWidth:c,pinToViewport:d,testID:w}),t[7]=h,t[8]=d,t[9]=i,t[10]=n,t[11]=w,t[12]=c,t[13]=y):y=t[13],y}function We(e){const t=(0,l.c)(11),{reviewTarget:n,reviewActions:i,gutterWidth:o,reservedHeight:c,style:d}=e;let u;t[0]!==i||t[1]!==n?(u=(0,ue.getInlineReviewThreadState)({reviewTarget:n,reviewActions:i}),t[0]=i,t[1]=n,t[2]=u):u=t[2];const f=u,h=c??f?.height??0;let p,x;t[3]!==o||t[4]!==h?(p=(0,re.inlineUnistylesStyle)({width:o,minHeight:h}),t[3]=o,t[4]=h,t[5]=p):p=t[5],t[6]!==d||t[7]!==p?(x=[Ut.inlineReviewGutterSpacer,p,d],t[6]=d,t[7]=p,t[8]=x):x=t[8];const w=x;if(0===h)return null;let y;return t[9]!==w?(y=(0,fe.jsx)(s.View,{style:w}),t[9]=w,t[10]=y):y=t[10],y}function Ae(e){const t=(0,l.c)(20),{reviewTarget:n,reviewActions:i,gutterWidth:o,reservedHeight:c}=e;let d;t[0]!==i||t[1]!==n?(d=(0,ue.getInlineReviewThreadState)({reviewTarget:n,reviewActions:i}),t[0]=i,t[1]=n,t[2]=d):d=t[2];const u=d,f=c??u?.height??0;let h,p;t[3]!==o?(h=(0,re.inlineUnistylesStyle)({width:o}),t[3]=o,t[4]=h):h=t[4],t[5]!==h?(p=[Ut.inlineReviewGutterSpacer,h],t[5]=h,t[6]=p):p=t[6];const x=p;let w;t[7]!==f?(w=(0,re.inlineUnistylesStyle)({minHeight:f}),t[7]=f,t[8]=w):w=t[8];const y=w;if(0===f)return null;let b,v,S;return t[9]!==x?(b=(0,fe.jsx)(s.View,{style:x}),t[9]=x,t[10]=b):b=t[10],t[11]!==f||t[12]!==y||t[13]!==i||t[14]!==n||t[15]!==u?(v=n&&i&&u?(0,fe.jsx)(ue.InlineReviewThread,{reviewTarget:n,reviewActions:i,height:f,testID:`review-thread-${n.key}`}):(0,fe.jsx)(s.View,{style:y}),t[11]=f,t[12]=y,t[13]=i,t[14]=n,t[15]=u,t[16]=v):v=t[16],t[17]!==b||t[18]!==v?(S=(0,fe.jsxs)(s.View,{style:Ut.inlineReviewRow,children:[b,v]}),t[17]=b,t[18]=v,t[19]=S):S=t[19],S}function Pe(e){const t=(0,l.c)(74),{rows:n,side:i,gutterWidth:d,wrapLines:u,textMetricsStyle:f,reviewActions:h,onLineContextMenu:p,showDivider:x}=e,w=void 0!==x&&x,[y,b]=(0,c.useState)(0),[v,S]=(0,c.useState)(null),k=w&&Ut.splitCellWithDivider;let C;t[0]!==k?(C=[Ut.splitCell,k],t[0]=k,t[1]=C):C=t[1];const T=C,I=w&&Ut.splitCellWithDivider;let j;t[2]!==I?(j=[Ut.splitCell,I,Ut.splitCellRow],t[2]=I,t[3]=j):j=t[3];const _=j;let D,L;t[4]!==y?(D=y>0&&(0,re.inlineUnistylesStyle)({minWidth:y}),t[4]=y,t[5]=D):D=t[5],t[6]!==D?(L=[Ut.linesContainer,D],t[6]=D,t[7]=L):L=t[7];const R=L;let W;t[8]!==f?(W=[Ut.diffTextMetrics,f,Ut.diffLineText,Ut.headerLineText],t[8]=f,t[9]=W):W=t[9];const A=W;let P;t[10]!==n?(P=n.map(ze),t[10]=n,t[11]=P):P=t[11];const z=P;if(u){let e,n,l;if(t[12]!==d||t[13]!==A||t[14]!==z||t[15]!==p||t[16]!==h||t[17]!==i||t[18]!==f||t[19]!==u){let n;t[21]!==d||t[22]!==A||t[23]!==p||t[24]!==h||t[25]!==i||t[26]!==f||t[27]!==u?(n=e=>{const{key:t,row:n}=e;if("header"===n.kind)return(0,fe.jsx)(s.View,{style:Ut.splitHeaderRow,children:(0,fe.jsx)(o.Text,{style:A,children:n.content})},t);const l="left"===i?n.left:n.right,c=(0,ue.getSplitInlineReviewThreadState)({left:n.left?.reviewTarget,right:n.right?.reviewTarget,reviewActions:h});return(0,fe.jsxs)(s.View,{children:[(0,fe.jsx)(Me,{line:l,gutterWidth:d,wrapLines:u,textMetricsStyle:f,reviewActions:h,onLineContextMenu:p}),(0,fe.jsx)(Ae,{reviewTarget:l?.reviewTarget,reviewActions:h,gutterWidth:d,reservedHeight:c?.height})]},t)},t[21]=d,t[22]=A,t[23]=p,t[24]=h,t[25]=i,t[26]=f,t[27]=u,t[28]=n):n=t[28],e=z.map(n),t[12]=d,t[13]=A,t[14]=z,t[15]=p,t[16]=h,t[17]=i,t[18]=f,t[19]=u,t[20]=e}else e=t[20];return t[29]!==e?(n=(0,fe.jsx)(s.View,{style:Ut.linesContainer,children:e}),t[29]=e,t[30]=n):n=t[30],t[31]!==n||t[32]!==T?(l=(0,fe.jsx)(s.View,{style:T,children:n}),t[31]=n,t[32]=T,t[33]=l):l=t[33],l}let H,E,F,V,B,O;if(t[34]!==d||t[35]!==v||t[36]!==z||t[37]!==h||t[38]!==i||t[39]!==f){let e;t[41]!==d||t[42]!==v||t[43]!==h||t[44]!==i||t[45]!==f?(e=e=>{const{key:t,row:n}=e;if("header"===n.kind)return(0,fe.jsx)(Ie,{lineNumber:null,type:"header",gutterWidth:d,textMetricsStyle:f},t);const o="left"===i?n.left:n.right,l=o?.reviewTarget?.key??null,c=(0,ue.getSplitInlineReviewThreadState)({left:n.left?.reviewTarget,right:n.right?.reviewTarget,reviewActions:h});return(0,fe.jsxs)(s.View,{children:[(0,fe.jsx)(Ie,{lineNumber:o?.lineNumber??null,type:o?.type,gutterWidth:d,textMetricsStyle:f,reviewTarget:o?.reviewTarget,reviewActions:h,isLineHovered:null!==l&&v===l}),(0,fe.jsx)(We,{reviewTarget:o?.reviewTarget,reviewActions:h,gutterWidth:d,reservedHeight:c?.height})]},t)},t[41]=d,t[42]=v,t[43]=h,t[44]=i,t[45]=f,t[46]=e):e=t[46],H=z.map(e),t[34]=d,t[35]=v,t[36]=z,t[37]=h,t[38]=i,t[39]=f,t[40]=H}else H=t[40];if(t[47]!==H?(E=(0,fe.jsx)(s.View,{style:Ut.gutterColumn,children:H}),t[47]=H,t[48]=E):E=t[48],t[49]!==A||t[50]!==z||t[51]!==p||t[52]!==h||t[53]!==y||t[54]!==i||t[55]!==f){let e;t[57]!==A||t[58]!==p||t[59]!==h||t[60]!==y||t[61]!==i||t[62]!==f?(e=e=>{const{key:t,row:n}=e;if("header"===n.kind)return(0,fe.jsx)(s.View,{style:Ut.splitHeaderRow,children:(0,fe.jsx)(o.Text,{style:A,children:n.content})},t);const l="left"===i?n.left:n.right,c=l?.reviewTarget?.key??null,d=(0,ue.getSplitInlineReviewThreadState)({left:n.left?.reviewTarget,right:n.right?.reviewTarget,reviewActions:h});return(0,fe.jsxs)(s.View,{children:[(0,fe.jsx)(De,{line:l,wrapLines:!1,textMetricsStyle:f,reviewActions:h,hoverTargetKey:c,onHoverTargetChange:S,onLineContextMenu:p}),(0,fe.jsx)(Re,{reviewTarget:l?.reviewTarget,reviewActions:h,reservedHeight:d?.height,viewportWidth:y,pinToViewport:!0})]},t)},t[57]=A,t[58]=p,t[59]=h,t[60]=y,t[61]=i,t[62]=f,t[63]=e):e=t[63],F=z.map(e),t[49]=A,t[50]=z,t[51]=p,t[52]=h,t[53]=y,t[54]=i,t[55]=f,t[56]=F}else F=t[56];return t[64]!==R||t[65]!==F?(V=(0,fe.jsx)(s.View,{style:R,children:F}),t[64]=R,t[65]=F,t[66]=V):V=t[66],t[67]!==y||t[68]!==V?(B=(0,fe.jsx)(M.DiffScroll,{scrollViewWidth:y,onScrollViewWidthChange:b,style:Ut.splitColumnScroll,contentContainerStyle:Ut.diffContentInner,children:V}),t[67]=y,t[68]=V,t[69]=B):B=t[69],t[70]!==_||t[71]!==E||t[72]!==B?(O=(0,fe.jsxs)(s.View,{style:_,children:[E,B]}),t[70]=_,t[71]=E,t[72]=B,t[73]=O):O=t[73],O}function ze(e,t){return{key:`row-${t}`,row:e}}const He=(0,c.memo)(function(e){const t=(0,l.c)(120),{file:i,isExpanded:f,depth:h,ancestorMask:p,showDir:x,selectable:w,selected:y,onToggleSelected:b,onToggle:v,onHeaderHeightChange:S,onShowContextMenu:j,testID:_}=e,D=void 0===h?0:h,L=void 0===p?C.TREE_RAILS_ALL_CONTINUE:p,M=void 0===x||x,R=void 0!==w&&w,W=void 0!==y&&y,{t:A}=(0,d.useTranslation)();let P;t[0]!==i.path||t[1]!==b?(P=e=>{e.stopPropagation?.(),b?.(i.path)},t[0]=i.path,t[1]=b,t[2]=P):P=t[2];const z=P;let E;t[3]!==W?(E={checked:W},t[3]=W,t[4]=E):E=t[4];const F=E,V=(0,c.useRef)(null),O=(0,c.useRef)(!1),U=(0,c.useRef)(null);let G;t[5]!==i.path||t[6]!==v?(G=()=>{O.current=!0,v(i.path)},t[5]=i.path,t[6]=v,t[7]=G):G=t[7];const N=G;let $;t[8]!==i.path||t[9]!==j?($=e=>{if(!j)return;const t=(0,H.contextMenuAnchorFromEvent)(e);t&&j({path:i.path,x:t.x,y:t.y})},t[8]=i.path,t[9]=j,t[10]=$):$=t[10];const K=$;let q;t[11]!==i.path||t[12]!==S?(q=e=>{V.current=e.nativeEvent.layout.y,S?.(i.path,e.nativeEvent.layout.height)},t[11]=i.path,t[12]=S,t[13]=q):q=t[13];const X=q;let Y;t[14]===Symbol.for("react.memo_cache_sentinel")?(Y=e=>{O.current=!1,U.current={ts:Date.now(),pageX:e.nativeEvent.pageX,pageY:e.nativeEvent.pageY}},t[14]=Y):Y=t[14];const Q=Y;let J;t[15]!==N?(J=e=>{if(ce.isNative&&!O.current&&0===V.current&&U.current){const t=Date.now()-U.current.ts,n=e.nativeEvent.pageX-U.current.pageX,i=e.nativeEvent.pageY-U.current.pageY,o=Math.hypot(n,i);t<=500&&o<=12&&N()}},t[15]=N,t[16]=J):J=t[16];const Z=J,ee=f&&Ut.fileSectionHeaderExpanded;let te;t[17]!==ee?(te=[Ut.fileSectionHeaderContainer,ee],t[17]=ee,t[18]=te):te=t[18];const ne=te;let ie;t[19]!==D?(ie=e=>D>0?[he(e),(0,re.inlineUnistylesStyle)({paddingLeft:(0,k.treeRowPaddingLeft)(D)})]:he(e),t[19]=D,t[20]=ie):ie=t[20];const oe=ie;let se,le,ae,de,ue,ge,pe,me,xe,we,ye,be,ve,Se,ke,Ce,Te,Ie,je,De,Le,Me,Re,We,Ae,Pe,ze,He,Ee,Fe,Ve,Be,Oe,Ge,Ne;return t[21]!==L||t[22]!==F||t[23]!==ne||t[24]!==D||t[25]!==i.path||t[26]!==K||t[27]!==X||t[28]!==Z||t[29]!==z||t[30]!==oe||t[31]!==j||t[32]!==R||t[33]!==W||t[34]!==A||t[35]!==_||t[36]!==N?(ge=i.path.split("/").pop()??i.path,ue=s.View,De=ne,Le=X,Me=_,t[60]!==L||t[61]!==D?(Re=(0,fe.jsx)(k.TreeIndentGuides,{depth:D,ancestorMask:L}),t[60]=L,t[61]=D,t[62]=Re):Re=t[62],de=B.Tooltip,Te=300,Ie=!0,je=!1,ae=B.TooltipTrigger,Ce=!0,le=n.Pressable,xe=_?`${_}-toggle`:void 0,we=oe,ye=!1,be=Q,ve=Z,Se=N,ke=j?K:void 0,se=s.View,pe=Ut.fileHeaderLeft,me=R?(0,fe.jsx)(n.Pressable,{style:W?Nt:Ut.fileCheckbox,onPress:z,accessibilityRole:"checkbox",accessibilityState:F,"aria-checked":W,accessibilityLabel:A("workspace.git.commit.includeFile",{fileName:ge}),hitSlop:6,testID:_?`${_}-checkbox`:void 0,children:W?(0,fe.jsx)(at,{size:12,uniProps:Ue}):null}):null,t[21]=L,t[22]=F,t[23]=ne,t[24]=D,t[25]=i.path,t[26]=K,t[27]=X,t[28]=Z,t[29]=z,t[30]=oe,t[31]=j,t[32]=R,t[33]=W,t[34]=A,t[35]=_,t[36]=N,t[37]=se,t[38]=le,t[39]=ae,t[40]=de,t[41]=ue,t[42]=ge,t[43]=pe,t[44]=me,t[45]=xe,t[46]=we,t[47]=ye,t[48]=be,t[49]=ve,t[50]=Se,t[51]=ke,t[52]=Ce,t[53]=Te,t[54]=Ie,t[55]=je,t[56]=De,t[57]=Le,t[58]=Me,t[59]=Re):(se=t[37],le=t[38],ae=t[39],de=t[40],ue=t[41],ge=t[42],pe=t[43],me=t[44],xe=t[45],we=t[46],ye=t[47],be=t[48],ve=t[49],Se=t[50],ke=t[51],Ce=t[52],Te=t[53],Ie=t[54],je=t[55],De=t[56],Le=t[57],Me=t[58],Re=t[59]),t[63]!==ge||t[64]!==M?(We=M?null:(0,fe.jsx)(s.View,{style:Ut.fileIcon,children:(0,fe.jsx)(T.SvgXml,{xml:(0,I.getFileIconSvg)(ge),width:16,height:16})}),t[63]=ge,t[64]=M,t[65]=We):We=t[65],t[66]!==ge?(Ae=(0,fe.jsx)(o.Text,{style:Ut.fileName,numberOfLines:1,children:ge}),t[66]=ge,t[67]=Ae):Ae=t[67],t[68]!==i.path||t[69]!==M?(Pe=M?(0,fe.jsx)(o.Text,{style:Ut.fileDir,numberOfLines:1,children:i.path.includes("/")?` ${i.path.slice(0,i.path.lastIndexOf("/"))}`:""}):(0,fe.jsx)(s.View,{style:Ut.fileDirSpacer}),t[68]=i.path,t[69]=M,t[70]=Pe):Pe=t[70],t[71]!==i.isNew||t[72]!==A?(ze=i.isNew&&(0,fe.jsx)(s.View,{style:Ut.newBadge,children:(0,fe.jsx)(o.Text,{style:Ut.newBadgeText,children:A("workspace.git.diff.newFile")})}),t[71]=i.isNew,t[72]=A,t[73]=ze):ze=t[73],t[74]!==i.isDeleted||t[75]!==A?(He=i.isDeleted&&(0,fe.jsx)(s.View,{style:Ut.deletedBadge,children:(0,fe.jsx)(o.Text,{style:Ut.deletedBadgeText,children:A("workspace.git.diff.deletedFile")})}),t[74]=i.isDeleted,t[75]=A,t[76]=He):He=t[76],t[77]!==se||t[78]!==pe||t[79]!==me||t[80]!==We||t[81]!==Ae||t[82]!==Pe||t[83]!==ze||t[84]!==He?(Ee=(0,fe.jsxs)(se,{style:pe,children:[me,We,Ae,Pe,ze,He]}),t[77]=se,t[78]=pe,t[79]=me,t[80]=We,t[81]=Ae,t[82]=Pe,t[83]=ze,t[84]=He,t[85]=Ee):Ee=t[85],t[86]!==i.additions||t[87]!==i.deletions?(Fe=(0,fe.jsx)(s.View,{style:Ut.fileHeaderRight,children:(0,fe.jsx)(u.DiffStat,{additions:i.additions,deletions:i.deletions})}),t[86]=i.additions,t[87]=i.deletions,t[88]=Fe):Fe=t[88],t[89]!==le||t[90]!==xe||t[91]!==we||t[92]!==ye||t[93]!==be||t[94]!==ve||t[95]!==Se||t[96]!==ke||t[97]!==Ee||t[98]!==Fe?(Ve=(0,fe.jsxs)(le,{testID:xe,style:we,cancelable:ye,onPressIn:be,onPressOut:ve,onPress:Se,onContextMenu:ke,children:[Ee,Fe]}),t[89]=le,t[90]=xe,t[91]=we,t[92]=ye,t[93]=be,t[94]=ve,t[95]=Se,t[96]=ke,t[97]=Ee,t[98]=Fe,t[99]=Ve):Ve=t[99],t[100]!==ae||t[101]!==Ce||t[102]!==Ve?(Be=(0,fe.jsx)(ae,{asChild:Ce,children:Ve}),t[100]=ae,t[101]=Ce,t[102]=Ve,t[103]=Be):Be=t[103],t[104]!==i.path?(Oe=(0,fe.jsx)(B.TooltipContent,{side:"bottom",align:"start",offset:6,maxWidth:520,children:(0,fe.jsx)(o.Text,{style:Ut.tooltipText,children:i.path})}),t[104]=i.path,t[105]=Oe):Oe=t[105],t[106]!==de||t[107]!==Te||t[108]!==Ie||t[109]!==je||t[110]!==Be||t[111]!==Oe?(Ge=(0,fe.jsxs)(de,{delayDuration:Te,enabledOnDesktop:Ie,enabledOnMobile:je,children:[Be,Oe]}),t[106]=de,t[107]=Te,t[108]=Ie,t[109]=je,t[110]=Be,t[111]=Oe,t[112]=Ge):Ge=t[112],t[113]!==ue||t[114]!==De||t[115]!==Le||t[116]!==Me||t[117]!==Re||t[118]!==Ge?(Ne=(0,fe.jsxs)(ue,{style:De,onLayout:Le,testID:Me,children:[Re,Ge]}),t[113]=ue,t[114]=De,t[115]=Le,t[116]=Me,t[117]=Re,t[118]=Ge,t[119]=Ne):Ne=t[119],Ne}),Ee=2e3;function Fe(e){let t=0;for(const n of e.hunks)if(t+=n.lines.length,t>Ee)return!0;return!1}const Ve=500;function Be(e){const t=(0,l.c)(60),{file:n,layout:i,wrapLines:u,codeFontSize:f,textMetricsStyle:h,reviewActions:p,onLineContextMenu:x,onBodyHeightChange:w,testID:y}=e,[b,v]=(0,c.useState)(0),[S,k]=(0,c.useState)(0),[C,T]=(0,c.useState)(null),{t:I}=(0,d.useTranslation)();let j;t[0]!==n||t[1]!==w?(j=e=>{k(e.nativeEvent.layout.width),w?.(n,e.nativeEvent.layout.height)},t[0]=n,t[1]=w,t[2]=j):j=t[2];const _=j,D=S>0?S:b;let L,R;t[3]!==D?(L=D>0&&(0,re.inlineUnistylesStyle)({minWidth:D}),t[3]=D,t[4]=L):L=t[4],t[5]!==L?(R=[Ut.linesContainer,L],t[5]=L,t[6]=R):R=t[6];const A=R;let z,H;if(t[7]!==S||t[8]!==f||t[9]!==n||t[10]!==C||t[11]!==i||t[12]!==A||t[13]!==x||t[14]!==p||t[15]!==b||t[16]!==I||t[17]!==h||t[18]!==u){e:{const e="binary"===n.status,l="too_large"===n.status||Fe(n);if(e||l){let n,i;t[20]!==e||t[21]!==I?(n=I(e?"workspace.git.diff.binaryFile":"workspace.git.diff.tooLarge"),t[20]=e,t[21]=I,t[22]=n):n=t[22],t[23]!==n?(i=(0,fe.jsx)(s.View,{style:Ut.statusMessageContainer,children:(0,fe.jsx)(o.Text,{style:Ut.statusMessageText,children:n})}),t[23]=n,t[24]=i):i=t[24],z=i;break e}let c=0;if(t[25]!==n.hunks||t[26]!==c){for(const e of n.hunks)c=Math.max(c,e.oldStart+e.oldCount,e.newStart+e.newCount);t[25]=n.hunks,t[26]=c,t[27]=c}else c=t[27];const d=(0,U.lineNumberGutterWidth)(c,f);if("split"===i){let e;t[28]!==n?(e=(0,P.buildSplitDiffRows)(n),t[28]=n,t[29]=e):e=t[29];const i=e;let o;t[30]!==d||t[31]!==x||t[32]!==p||t[33]!==i||t[34]!==h||t[35]!==u?(o=(0,fe.jsxs)(s.View,{style:$t,dataSet:W.CODE_SURFACE_DATASET,children:[(0,fe.jsx)(Pe,{rows:i,side:"left",gutterWidth:d,wrapLines:u,textMetricsStyle:h,reviewActions:p,onLineContextMenu:x}),(0,fe.jsx)(Pe,{rows:i,side:"right",gutterWidth:d,wrapLines:u,textMetricsStyle:h,reviewActions:p,onLineContextMenu:x,showDivider:!0})]}),t[30]=d,t[31]=x,t[32]=p,t[33]=i,t[34]=h,t[35]=u,t[36]=o):o=t[36],z=o;break e}const w=(0,P.buildUnifiedDiffLines)(n);if(u){let e;t[37]!==d||t[38]!==x||t[39]!==p||t[40]!==h||t[41]!==u?(e=(e,t)=>{const{line:n,lineNumber:i,key:o,reviewTarget:l}=e;return(0,fe.jsxs)(s.View,{testID:`diff-wrapped-row-${t}`,children:[(0,fe.jsx)(Le,{line:n,lineNumber:i,gutterWidth:d,wrapLines:u,textMetricsStyle:h,reviewTarget:l,reviewActions:p,onLineContextMenu:x}),(0,fe.jsx)(Ae,{reviewTarget:l,reviewActions:p,gutterWidth:d})]},o)},t[37]=d,t[38]=x,t[39]=p,t[40]=h,t[41]=u,t[42]=e):e=t[42],z=(0,fe.jsx)(s.View,{style:Ut.diffContent,dataSet:W.CODE_SURFACE_DATASET,children:(0,fe.jsx)(s.View,{style:Ut.linesContainer,children:w.map(e)})});break e}const y=b>0?b:Math.max(0,S-d);let k,j;t[43]!==d||t[44]!==C||t[45]!==p||t[46]!==h?(k=(e,t)=>{const{line:n,lineNumber:i,key:o,reviewTarget:l}=e;return(0,fe.jsxs)(s.View,{testID:`diff-gutter-row-${t}`,children:[(0,fe.jsx)(Ie,{lineNumber:i,type:n.type,gutterWidth:d,textMetricsStyle:h,reviewTarget:l,reviewActions:p,isLineHovered:void 0!==l?.key&&C===l.key,textTestID:`diff-gutter-text-${t}`,actionTestID:`diff-gutter-action-${t}`}),(0,fe.jsx)(We,{reviewTarget:l,reviewActions:p,gutterWidth:d})]},o)},t[43]=d,t[44]=C,t[45]=p,t[46]=h,t[47]=k):k=t[47],t[48]!==x||t[49]!==p||t[50]!==h||t[51]!==y?(j=(e,t)=>{const{line:n,key:i,reviewTarget:o}=e;return(0,fe.jsxs)(s.View,{testID:`diff-code-row-${t}`,children:[(0,fe.jsx)(je,{line:n,wrapLines:!1,textMetricsStyle:h,reviewTarget:o,reviewActions:p,hoverTargetKey:o?.key??null,onHoverTargetChange:T,onLineContextMenu:x,textTestID:`diff-code-text-${t}`}),(0,fe.jsx)(Re,{reviewTarget:o,reviewActions:p,viewportWidth:y,pinToViewport:!0})]},i)},t[48]=x,t[49]=p,t[50]=h,t[51]=y,t[52]=j):j=t[52];const _=(0,fe.jsx)(s.View,{style:A,children:w.map(j)});let D;t[53]!==b||t[54]!==_?(D=(0,fe.jsx)(M.DiffScroll,{scrollViewWidth:b,onScrollViewWidthChange:v,style:Ut.splitColumnScroll,contentContainerStyle:Ut.diffContentInner,children:_}),t[53]=b,t[54]=_,t[55]=D):D=t[55],z=(0,fe.jsxs)(s.View,{style:Kt,dataSet:W.CODE_SURFACE_DATASET,children:[(0,fe.jsx)(s.View,{style:Ut.gutterColumn,children:w.map(k)}),D]})}t[7]=S,t[8]=f,t[9]=n,t[10]=C,t[11]=i,t[12]=A,t[13]=x,t[14]=p,t[15]=b,t[16]=I,t[17]=h,t[18]=u,t[19]=z}else z=t[19];return t[56]!==_||t[57]!==z||t[58]!==y?(H=(0,fe.jsx)(s.View,{style:Gt,onLayout:_,testID:y,children:z}),t[56]=_,t[57]=z,t[58]=y,t[59]=H):H=t[59],H}const Oe=e=>({color:e.colors.foregroundMuted}),Ue=e=>({color:e.colors.accentForeground}),Ge=(0,f.withUnistyles)(i.ActivityIndicator),Ne=(0,f.withUnistyles)(w.AlignJustify),$e=(0,f.withUnistyles)(w.Columns2),Ke=(0,f.withUnistyles)(w.Pilcrow),qe=(0,f.withUnistyles)(w.WrapText),Xe=(0,f.withUnistyles)(w.ListChevronsDownUp),Ye=(0,f.withUnistyles)(w.ListChevronsUpDown),Qe=(0,f.withUnistyles)(w.FolderTree),Je=(0,f.withUnistyles)(w.List),Ze=(0,f.withUnistyles)(w.GitCommitHorizontal),et=(0,f.withUnistyles)(w.Download),tt=(0,f.withUnistyles)(w.Upload),nt=(0,f.withUnistyles)(w.ArrowDownUp),it=(0,f.withUnistyles)(O.GitHostingIcon),ot=(0,f.withUnistyles)(w.GitMerge),rt=(0,f.withUnistyles)(w.RefreshCcw),st=(0,f.withUnistyles)(w.Archive),lt=(0,f.withUnistyles)(w.ChevronDown),at=(0,f.withUnistyles)(w.Check),ct=(0,f.withUnistyles)(w.SquarePen),dt=(0,f.withUnistyles)(w.Copy),ut=(0,f.withUnistyles)(w.Paperclip),ft=(0,fe.jsx)(ct,{size:14,uniProps:Oe}),ht=(0,fe.jsx)(dt,{size:14,uniProps:Oe}),gt=(0,fe.jsx)(Qe,{size:14,uniProps:Oe}),pt=(0,f.withUnistyles)(w.History),mt=(0,fe.jsx)(pt,{size:14,uniProps:Oe});function xt(e){const t=(0,l.c)(11),{serverId:n,workspaceId:i,request:o}=e,{t:s}=(0,d.useTranslation)();let c;t[0]!==n?(c=e=>!0===e.sessions[n]?.serverInfo?.features?.checkoutGitFileHistory,t[0]=n,t[1]=c):c=t[1];const u=(0,ie.useSessionStore)(c);let f;t[2]!==o||t[3]!==n||t[4]!==i?(f=()=>{o&&i&&(0,te.openFileHistoryTab)({serverId:n,workspaceId:i,path:o.path})},t[2]=o,t[3]=n,t[4]=i,t[5]=f):f=t[5];const h=f;if(!u||!i||!o)return null;let p,x;return t[6]!==s?(p=s("gitFileHistory.open"),t[6]=s,t[7]=p):p=t[7],t[8]!==h||t[9]!==p?(x=(0,fe.jsx)(H.ContextMenuItem,{leading:mt,onSelect:h,testID:"changes-context-menu-git-history",children:p}),t[8]=h,t[9]=p,t[10]=x):x=t[10],x}const wt=(0,fe.jsx)(ut,{size:14,uniProps:Oe}),yt=(0,f.withUnistyles)(w.Undo2),bt=(0,fe.jsx)(yt,{size:14,uniProps:e=>({color:e.colors.destructive})}),vt=(0,f.withUnistyles)(w.Trash2),St=(0,f.withUnistyles)(w.RotateCw),kt=(0,f.withUnistyles)(oe.LoadingSpinner);function Ct(e){let t=0;for(const n of e.hunks)t+=n.lines.length;return t}function Tt(e){let t=0;for(const n of e.hunks)for(const e of n.lines)t+=e.content.length;return t}function It(e,t,n,i){return e?i.hiddenWhitespace:"uncommitted"===t?i.uncommitted:i.againstBase(n)}function jt(e){const n=(0,l.c)(24),{isStatusLoading:i,statusErrorMessage:c,notGit:d,isDiffLoading:u,diffErrorMessage:f,hasChanges:h,emptyMessage:p,flatItems:x,stickyHeaderIndices:w,renderFlatItem:y,flatKeyExtractor:b,getFlatItemLayout:v,flatExtraData:S,diffListRef:k,handleDiffListLayout:C,handleDiffListScroll:T,onContentSizeChange:I,showWebScrollbar:j,checkingRepositoryLabel:_,notRepositoryLabel:D}=e;if(i){let e,t;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,fe.jsx)(Ge,{size:"large",uniProps:Oe}),n[0]=e):e=n[0],n[1]!==_?(t=(0,fe.jsxs)(s.View,{style:Ut.loadingContainer,children:[e,(0,fe.jsx)(o.Text,{style:Ut.loadingText,children:_})]}),n[1]=_,n[2]=t):t=n[2],t}if(c){let e;return n[3]!==c?(e=(0,fe.jsx)(s.View,{style:Ut.errorContainer,children:(0,fe.jsx)(o.Text,{style:Ut.errorText,children:c})}),n[3]=c,n[4]=e):e=n[4],e}if(d){let e;return n[5]!==D?(e=(0,fe.jsx)(s.View,{style:Ut.emptyContainer,testID:"changes-not-git",children:(0,fe.jsx)(o.Text,{style:Ut.emptyText,children:D})}),n[5]=D,n[6]=e):e=n[6],e}if(u){let e;return n[7]===Symbol.for("react.memo_cache_sentinel")?(e=(0,fe.jsx)(s.View,{style:Ut.loadingContainer,children:(0,fe.jsx)(Ge,{size:"large",uniProps:Oe})}),n[7]=e):e=n[7],e}if(f){let e;return n[8]!==f?(e=(0,fe.jsx)(s.View,{style:Ut.errorContainer,children:(0,fe.jsx)(o.Text,{style:Ut.errorText,children:f})}),n[8]=f,n[9]=e):e=n[9],e}if(!h){let e;return n[10]!==p?(e=(0,fe.jsx)(s.View,{style:Ut.emptyContainer,children:(0,fe.jsx)(o.Text,{style:Ut.emptyText,children:p})}),n[10]=p,n[11]=e):e=n[11],e}const L=!j;let M;return n[12]!==k||n[13]!==S||n[14]!==x||n[15]!==b||n[16]!==v||n[17]!==C||n[18]!==T||n[19]!==I||n[20]!==y||n[21]!==w||n[22]!==L?(M=(0,fe.jsx)(t.FlatList,{ref:k,data:x,renderItem:y,keyExtractor:b,getItemLayout:v,stickyHeaderIndices:w,extraData:S,style:Ut.scrollView,contentContainerStyle:Ut.contentContainer,testID:"git-diff-scroll",onLayout:C,onScroll:T,onContentSizeChange:I,scrollEventThrottle:16,showsVerticalScrollIndicator:L,removeClippedSubviews:!1,initialNumToRender:12,maxToRenderPerBatch:12,windowSize:10}),n[12]=k,n[13]=S,n[14]=x,n[15]=b,n[16]=v,n[17]=C,n[18]=T,n[19]=I,n[20]=y,n[21]=w,n[22]=L,n[23]=M):M=n[23],M}function _t({status:e,isStatusLoading:t,isStatusError:n,statusError:i}){const o=e&&e.isGit?e:null,s=Boolean(o),l=null!==e&&!e.isGit&&!e.error,c=e?.error?.message??(n&&i instanceof Error?i.message:null),d=o?.baseRef??void 0,u=Boolean(o?.isDirty),f=!s||Boolean(e?.error)||t,h=o?.currentBranch&&"HEAD"!==o.currentBranch?o.currentBranch:null;return Object.assign({gitStatus:o,isGit:s,notGit:l,statusErrorMessage:c,baseRef:d,hasUncommittedChanges:u,actionsDisabled:f,currentBranchName:h,isOttoOwnedWorktree:!0===o?.isOttoOwnedWorktree},Dt(o))}function Dt(e){return{baseSource:e?.baseSource??null,isBaseEditable:e?.isBaseEditable??null}}function Lt(e,t){if(!e)return t;const n=e.replace(/^refs\/(heads|remotes)\//,"").trim();return n.startsWith("origin/")?n.slice(7):n}function Mt(e,t){if(e&&t)return e===t?void 0:`${e} -> ${t}`}function Rt(e,t){return e?t?.message??null:null}function Wt(e){return null!=e.lineStart?`${e.path}:${e.lineStart}`:e.path}function At({serverId:e,cwd:t,diffMode:n,contextMenuPath:i,selectedPaths:o,commitSelectionEnabled:s}){const{t:l}=(0,d.useTranslation)(),u=(0,ne.useToast)(),f=(0,ie.useSessionStore)(t=>!0===t.sessions[e]?.serverInfo?.features?.checkoutGitRollback),h=(0,Q.useCheckoutGitActionsStore)(e=>e.rollbackPaths),p=(0,c.useCallback)(async(n,i)=>{if(0===n.length)return;if(!await(0,J.confirmDialog)(i))return;const o=async i=>{try{await h(Object.assign({serverId:e,cwd:t,paths:n},i?{allowWithRunningAgents:!0}:{}))}catch(e){if(e instanceof Q.CheckoutGitRollbackFailedError){if("agents_running"===e.rollbackError.kind){const t=e.rollbackError.agents.map(e=>e.title?.trim()||l("workspace.git.rollback.unnamedAgent")).join(", ");return void(await(0,J.confirmDialog)({title:l("workspace.git.rollback.agentsRunningTitle"),message:l("workspace.git.rollback.agentsRunningMessage",{agents:t}),confirmLabel:l("workspace.git.rollback.agentsRunningConfirm"),destructive:!0})&&await o(!0))}const t="git_failed"===e.rollbackError.kind?e.rollbackError.detail:l("workspace.git.rollback.failed");return void u.error(t)}u.error(e instanceof Error?e.message:l("workspace.git.rollback.failed"))}};await o(!1)},[t,h,e,l,u]),x=(0,c.useCallback)(()=>{if(!i)return;const e=i.split("/").pop()??i;p([i],{title:l("workspace.git.rollback.confirmTitleSingle"),message:l("workspace.git.rollback.confirmMessageSingle",{fileName:e}),confirmLabel:l("workspace.git.rollback.confirmButton"),destructive:!0})},[i,p,l]),w=(0,c.useCallback)(()=>{const e=o.length;p(o,{title:l("workspace.git.rollback.confirmTitleMultiple",{count:e}),message:l("workspace.git.rollback.confirmMessageMultiple",{count:e}),confirmLabel:l("workspace.git.rollback.confirmButton"),destructive:!0})},[p,o,l]),y=f&&"uncommitted"===n,b=s?o.length:0;return{canRollbackFile:y,canRollbackSelection:y&&b>1,selectionCount:b,onRollbackFile:x,onRollbackSelected:w}}function Pt(e){const t=(0,l.c)(20),{serverId:n,scopeKey:i,request:o}=e,{t:s}=(0,d.useTranslation)();let c;t[0]!==n?(c=e=>e.sessions[n]?.focusedAgentId??null,t[0]=n,t[1]=c):c=t[1];const u=(0,ie.useSessionStore)(c),f=(0,de.useWorkspaceAttachments)(i);let h;if(t[2]!==f){h=new Set;for(const e of f)"file_context"===e.kind&&h.add(e.id);t[2]=f,t[3]=h}else h=t[3];const p=h;let x;t[4]!==o||t[5]!==i?(x=()=>{if(!o)return;const e=Wt(o),{attachmentsByScope:t,setWorkspaceAttachments:n,addWorkspaceAttachment:s}=de.useWorkspaceAttachmentsStore.getState(),l=t[i]??[],c=l.filter(t=>!("file_context"===t.kind&&t.id===e));c.length===l.length?s({scopeKey:i,attachment:{kind:"file_context",id:e,path:o.path,lineStart:o.lineStart}}):n({scopeKey:i,attachments:c})},t[4]=o,t[5]=i,t[6]=x):x=t[6];const w=x;if(!u||!o)return null;let y;t[7]!==o?(y=Wt(o),t[7]=o,t[8]=y):y=t[8];const b=p.has(y);let v,S;if(null!=o.lineStart){let e;t[9]!==b||t[10]!==o.lineStart||t[11]!==s?(e=s(b?"projectSearch.removeLineFromContext":"projectSearch.addLineToContext",{line:o.lineStart}),t[9]=b,t[10]=o.lineStart,t[11]=s,t[12]=e):e=t[12],v=e}else{let e;t[13]!==b||t[14]!==s?(e=s(b?"workspace.fileExplorer.context.removeFromContext":"workspace.fileExplorer.context.addToContext"),t[13]=b,t[14]=s,t[15]=e):e=t[15],v=e}return t[16]!==b||t[17]!==v||t[18]!==w?(S={isInContext:b,label:v,onToggle:w},t[16]=b,t[17]=v,t[18]=w,t[19]=S):S=t[19],S}function zt(e){const t=(0,l.c)(14),{rollback:n}=e,{t:i}=(0,d.useTranslation)();if(!n.canRollbackFile)return null;let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,fe.jsx)(H.ContextMenuSeparator,{}),t[0]=o):o=t[0];const s=n.onRollbackFile;let c,u,f,h;return t[1]!==i?(c=i("workspace.git.rollback.fileAction"),t[1]=i,t[2]=c):c=t[2],t[3]!==n.onRollbackFile||t[4]!==c?(u=(0,fe.jsx)(H.ContextMenuItem,{leading:bt,destructive:!0,onSelect:s,testID:"changes-context-menu-rollback-file",children:c}),t[3]=n.onRollbackFile,t[4]=c,t[5]=u):u=t[5],t[6]!==n.canRollbackSelection||t[7]!==n.onRollbackSelected||t[8]!==n.selectionCount||t[9]!==i?(f=n.canRollbackSelection?(0,fe.jsx)(H.ContextMenuItem,{leading:bt,destructive:!0,onSelect:n.onRollbackSelected,testID:"changes-context-menu-rollback-selected",children:i("workspace.git.rollback.filesAction",{count:n.selectionCount})}):null,t[6]=n.canRollbackSelection,t[7]=n.onRollbackSelected,t[8]=n.selectionCount,t[9]=i,t[10]=f):f=t[10],t[11]!==u||t[12]!==f?(h=(0,fe.jsxs)(fe.Fragment,{children:[o,u,f]}),t[11]=u,t[12]=f,t[13]=h):h=t[13],h}function Ht(e){const t=(0,l.c)(4),{toggle:n}=e;if(!n)return null;const i=n.isInContext?"changes-context-menu-remove-from-context":"changes-context-menu-add-to-context";let o;return t[0]!==i||t[1]!==n.label||t[2]!==n.onToggle?(o=(0,fe.jsx)(H.ContextMenuItem,{leading:wt,onSelect:n.onToggle,testID:i,children:n.label}),t[0]=i,t[1]=n.label,t[2]=n.onToggle,t[3]=o):o=t[3],o}function Et(e,t){switch(e.kind){case"identity_missing":return{title:t("workspace.git.commit.errorIdentity"),detail:null};case"hook_failed":return{title:t("workspace.git.commit.errorHook"),detail:e.output.trim()||null};case"signing_failed":return{title:t("workspace.git.commit.errorSigning"),detail:e.detail.trim()||null};case"nothing_to_commit":return{title:t("workspace.git.commit.errorNothingToCommit"),detail:null};case"git_failed":return{title:t("workspace.git.commit.errorGitFailed"),detail:e.detail.trim()||null};case"agents_running":return{title:t("workspace.git.commit.errorGitFailed"),detail:null}}}function Ft(e){const t=(0,l.c)(16),{serverId:n,workspaceId:i,enabled:s}=e,{t:c}=(0,d.useTranslation)(),u=(0,h.useIconSize)(2).sm;let f;t[0]!==n||t[1]!==i?(f=()=>{i&&(0,ee.openGitLogTab)({serverId:n,workspaceId:i,operation:"commit"})},t[0]=n,t[1]=i,t[2]=f):f=t[2];const p=f;if(!s||!i)return null;let x,y,b,v,S;return t[3]!==c?(x=c("workspace.git.commit.viewLog"),t[3]=c,t[4]=x):x=t[4],t[5]!==p||t[6]!==u||t[7]!==x?(y=(0,fe.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,fe.jsx)(Z.Button,{size:"sm",variant:"ghost",leftIcon:w.SquareTerminal,iconSize:u,onPress:p,accessibilityLabel:x,testID:"changes-commit-log-button"})}),t[5]=p,t[6]=u,t[7]=x,t[8]=y):y=t[8],t[9]!==c?(b=c("workspace.git.commit.viewLog"),t[9]=c,t[10]=b):b=t[10],t[11]!==b?(v=(0,fe.jsx)(B.TooltipContent,{side:"top",align:"end",offset:6,children:(0,fe.jsx)(o.Text,{style:Ut.tooltipText,children:b})}),t[11]=b,t[12]=v):v=t[12],t[13]!==y||t[14]!==v?(S=(0,fe.jsxs)(B.Tooltip,{delayDuration:300,enabledOnDesktop:!0,enabledOnMobile:!1,children:[y,v]}),t[13]=y,t[14]=v,t[15]=S):S=t[15],S}function Vt({serverId:t,cwd:i,workspaceId:l,selectedPaths:u,totalFiles:f,commitSupported:h,logSupported:p,isGit:x,diffMode:w,hasChanges:y,onToggleSelectAll:b,onCommitted:v}){const{t:S}=(0,d.useTranslation)(),k=(0,ne.useToast)(),[C,T]=(0,c.useState)(""),[I,j]=(0,c.useState)(!1),[_,D]=(0,c.useState)(null),L=(0,Q.useCheckoutGitActionsStore)(e=>e.commitPaths),M="pending"===(0,Q.useCheckoutGitActionsStore)(e=>e.getStatus({serverId:t,cwd:i,actionId:"commit"})),R=(0,c.useCallback)(()=>j(!0),[]),W=(0,c.useCallback)(()=>j(!1),[]),A=(0,c.useMemo)(()=>[Ut.commitInput,I&&Ut.commitInputFocused],[I]),P=(0,c.useCallback)(async()=>{const e=C.trim();if(!e||0===u.length||M)return;D(null);const n=async o=>{try{await L(Object.assign({serverId:t,cwd:i,message:e,paths:u},o?{allowWithRunningAgents:!0}:{})),T(""),v()}catch(e){if(e instanceof Q.CheckoutGitCommitFailedError){if("agents_running"===e.commitError.kind){const t=e.commitError.agents.map(e=>e.title?.trim()||S("workspace.git.commit.unnamedAgent")).join(", ");return void(await(0,J.confirmDialog)({title:S("workspace.git.commit.agentsRunningTitle"),message:S("workspace.git.commit.agentsRunningMessage",{agents:t}),confirmLabel:S("workspace.git.commit.agentsRunningConfirm")})&&await n(!0))}return void D(e.commitError)}k.error(e instanceof Error?e.message:S("workspace.git.commit.errorGitFailed"))}};await n(!1)},[L,i,M,C,v,u,t,S,k]),z=f>0&&u.length===f,H=u.length>0&&!z,E=(0,c.useMemo)(()=>({checked:H?"mixed":z}),[z,H]);if(!x||"uncommitted"!==w||!y)return null;if(!h)return(0,fe.jsx)(s.View,{style:Ut.commitSection,testID:"changes-commit-section",children:(0,fe.jsx)(o.Text,{style:Ut.commitUnsupportedText,children:S("workspace.git.commit.updateHost")})});const F=0===C.trim().length||0===u.length||M,V=_?Et(_,S):null;let B=null;return H?B=(0,fe.jsx)(s.View,{style:Ut.fileCheckboxIndeterminateMark}):z&&(B=(0,fe.jsx)(at,{size:12,uniProps:Ue})),(0,fe.jsxs)(s.View,{style:Ut.commitSection,testID:"changes-commit-section",children:[(0,fe.jsx)(e.TextInput,{multiline:!0,value:C,onChangeText:T,onFocus:R,onBlur:W,editable:!M,placeholder:S("workspace.git.commit.messagePlaceholder"),placeholderTextColor:Ut.commitPlaceholderColor.color,accessibilityLabel:S("workspace.git.commit.messagePlaceholder"),style:A,testID:"changes-commit-message"}),(0,fe.jsxs)(s.View,{style:Ut.commitActions,children:[(0,fe.jsxs)(s.View,{style:Ut.commitSelectionGroup,children:[(0,fe.jsx)(n.Pressable,{style:z||H?Nt:Ut.fileCheckbox,onPress:b,accessibilityRole:"checkbox",accessibilityState:E,"aria-checked":H?"mixed":z,accessibilityLabel:S(z?"workspace.git.commit.deselectAllFiles":"workspace.git.commit.selectAllFiles"),hitSlop:6,testID:"changes-commit-select-all",children:B}),(0,fe.jsx)(o.Text,{style:Ut.commitSelectionCount,numberOfLines:1,children:S("workspace.git.commit.filesSelected",{selected:u.length,total:f})})]}),(0,fe.jsxs)(s.View,{style:Ut.commitButtonGroup,children:[(0,fe.jsx)(Ft,{serverId:t,workspaceId:l,enabled:p}),(0,fe.jsx)(Z.Button,{size:"sm",variant:"default",disabled:F,onPress:P,testID:"changes-commit-button",children:S(M?"workspace.git.commit.committing":"workspace.git.commit.button")})]})]}),V?(0,fe.jsx)(o.Text,{style:Ut.commitErrorText,testID:"changes-commit-error",children:V.title}):null,V?.detail?(0,fe.jsx)(o.Text,{style:Ut.commitErrorDetail,testID:"changes-commit-error-detail",children:V.detail}):null]})}const Bt=new Set;function Ot(e,t){return t?e+2:e}const Ut=f.StyleSheet.create(e=>({container:{flex:1,minHeight:0},header:{flexDirection:"row",alignItems:"center",gap:e.spacing[2],paddingHorizontal:e.spacing[3],height:{xs:46,md:p.WORKSPACE_SECONDARY_HEADER_HEIGHT},borderBottomWidth:1,borderBottomColor:e.colors.border,uni__dependencies:[0]},headerBranchArea:{flex:1,minWidth:0,flexDirection:"row",justifyContent:"center"},diffStatusContainer:{height:x.PANE_TOOLBAR_HEIGHT,borderBottomWidth:1,borderBottomColor:e.colors.border,uni__dependencies:[0]},diffStatusInner:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingRight:e.spacing[3],uni__dependencies:[0]},diffStatusLeading:{flexDirection:"row",alignItems:"center",gap:e.spacing[1],flexShrink:1,minWidth:0,uni__dependencies:[0]},diffModeTrigger:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:e.spacing[1],marginLeft:e.spacing[3]-e.spacing[1],paddingHorizontal:e.spacing[1],height:{xs:28,sm:28,md:24},borderRadius:e.borderRadius.base,flexShrink:0,uni__dependencies:[0]},diffModeTriggerHovered:{backgroundColor:e.colors.surfaceHover,uni__dependencies:[0]},diffModeTriggerPressed:{backgroundColor:e.colors.surface2,uni__dependencies:[0]},diffStatusRowHovered:{backgroundColor:e.colors.surface2,uni__dependencies:[0]},diffStatusText:{fontSize:{xs:e.fontSize.xs+2,md:e.fontSize.xs},lineHeight:{xs:1.25*(e.fontSize.xs+2),md:1.25*e.fontSize.xs},color:e.colors.foregroundMuted,uni__dependencies:[0]},diffStatusIconHidden:{opacity:0},actionErrorText:{paddingHorizontal:e.spacing[3],paddingBottom:e.spacing[1],fontSize:e.fontSize.xs,color:e.colors.destructive,uni__dependencies:[0]},diffContainer:{flex:1,minHeight:0,position:"relative"},scrollView:{flex:1},contentContainer:{paddingBottom:e.spacing[8],uni__dependencies:[0]},loadingContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingTop:e.spacing[16],gap:e.spacing[4],uni__dependencies:[0]},loadingText:{fontSize:e.fontSize.base,color:e.colors.foregroundMuted,uni__dependencies:[0]},errorContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingTop:e.spacing[16],paddingHorizontal:e.spacing[6],uni__dependencies:[0]},errorText:{fontSize:e.fontSize.base,color:e.colors.destructive,textAlign:"center",uni__dependencies:[0]},emptyContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingTop:e.spacing[16],uni__dependencies:[0]},emptyText:{fontSize:e.fontSize.lg,color:e.colors.foregroundMuted,uni__dependencies:[0]},fileSection:{overflow:"hidden",backgroundColor:e.colors.surface2,borderBottomWidth:1,borderBottomColor:e.colors.border,uni__dependencies:[0]},fileSectionHeaderContainer:{overflow:"hidden"},fileSectionHeaderExpanded:{backgroundColor:e.colors.surface1,uni__dependencies:[0]},fileSectionBodyContainer:{overflow:"hidden",backgroundColor:e.colors.surface2,uni__dependencies:[0]},fileSectionBorder:{borderBottomWidth:1,borderBottomColor:e.colors.border,uni__dependencies:[0]},fileHeader:{flexDirection:"row",alignItems:"center",paddingLeft:10,paddingRight:e.spacing[2],paddingVertical:e.spacing[2],gap:e.spacing[1],minWidth:0,zIndex:2,elevation:2,uni__dependencies:[0]},fileHeaderPressed:{opacity:.7},fileHeaderLeft:{flexDirection:"row",alignItems:"center",gap:e.spacing[1],flex:1,minWidth:0,uni__dependencies:[0]},fileHeaderRight:{flexDirection:"row",alignItems:"center",gap:e.spacing[1],flexShrink:0,uni__dependencies:[0]},fileIcon:{flexShrink:0,alignItems:"center",justifyContent:"center"},fileCheckbox:{width:16,height:16,flexShrink:0,borderRadius:e.borderRadius.sm,borderWidth:1,borderColor:e.colors.foregroundMuted,alignItems:"center",justifyContent:"center",marginRight:e.spacing[1],uni__dependencies:[0]},fileCheckboxChecked:{backgroundColor:e.colors.accent,borderColor:e.colors.accent,uni__dependencies:[0]},fileCheckboxIndeterminateMark:{width:8,height:2,borderRadius:1,backgroundColor:e.colors.accentForeground,uni__dependencies:[0]},commitSection:{borderTopWidth:1,borderTopColor:e.colors.border,paddingLeft:9,paddingRight:10,paddingVertical:e.spacing[2],gap:e.spacing[2],uni__dependencies:[0]},commitInput:Object.assign({minHeight:56,maxHeight:120,color:e.colors.foreground,backgroundColor:e.colors.surface1,borderWidth:e.borderWidth[1],borderColor:e.colors.border,borderRadius:e.borderRadius.md,paddingHorizontal:e.spacing[3],paddingVertical:e.spacing[2],fontSize:{xs:e.fontSize.sm+2,md:e.fontSize.sm},lineHeight:{xs:1.4*(e.fontSize.sm+2),md:1.4*e.fontSize.sm},textAlignVertical:"top"},ce.isWeb?{outlineWidth:0,outlineColor:"transparent"}:{},{uni__dependencies:[0]}),commitInputFocused:{borderColor:e.colors.accent,uni__dependencies:[0]},commitPlaceholderColor:{color:e.colors.foregroundMuted,uni__dependencies:[0]},commitActions:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:e.spacing[2],uni__dependencies:[0]},commitSelectionGroup:{flexDirection:"row",alignItems:"center",gap:e.spacing[1],flexShrink:1,minWidth:0,uni__dependencies:[0]},commitSelectionCount:{color:e.colors.foregroundMuted,fontSize:{xs:e.fontSize.xs+2,md:e.fontSize.xs},flexShrink:1,uni__dependencies:[0]},commitButtonGroup:{flexDirection:"row",alignItems:"center",gap:e.spacing[1],uni__dependencies:[0]},commitUnsupportedText:{color:e.colors.foregroundMuted,fontSize:e.fontSize.xs,uni__dependencies:[0]},commitErrorText:{color:e.colors.palette.red[300],fontSize:e.fontSize.xs,lineHeight:1.4*e.fontSize.xs,uni__dependencies:[0]},commitErrorDetail:{color:e.colors.foregroundMuted,backgroundColor:e.colors.surface1,borderRadius:e.borderRadius.sm,paddingHorizontal:e.spacing[2],paddingVertical:e.spacing[1],fontSize:e.fontSize.xs,lineHeight:1.5*e.fontSize.xs,fontFamily:e.fontFamily.mono,uni__dependencies:[0]},fileName:{fontSize:{xs:e.fontSize.sm+2,md:e.fontSize.sm},fontWeight:e.fontWeight.normal,color:e.colors.foreground,flexShrink:1,minWidth:0,uni__dependencies:[0]},fileDir:{fontSize:{xs:e.fontSize.sm+2,md:e.fontSize.sm},fontWeight:e.fontWeight.normal,color:e.colors.foregroundMuted,flex:1,minWidth:0,uni__dependencies:[0]},fileDirSpacer:{flex:1,minWidth:0},newBadge:{backgroundColor:"rgba(46, 160, 67, 0.2)",paddingHorizontal:e.spacing[2],paddingVertical:e.spacing[1],borderRadius:e.borderRadius.md,flexShrink:0,uni__dependencies:[0]},newBadgeText:{fontSize:e.fontSize.xs,fontWeight:e.fontWeight.normal,color:e.colors.diffAddition,uni__dependencies:[0]},deletedBadge:{backgroundColor:"rgba(248, 81, 73, 0.2)",paddingHorizontal:e.spacing[2],paddingVertical:e.spacing[1],borderRadius:e.borderRadius.md,flexShrink:0,uni__dependencies:[0]},deletedBadgeText:{fontSize:e.fontSize.xs,fontWeight:e.fontWeight.normal,color:e.colors.diffDeletion,uni__dependencies:[0]},additions:{fontSize:e.fontSize.xs,fontWeight:e.fontWeight.normal,color:e.colors.diffAddition,uni__dependencies:[0]},deletions:{fontSize:e.fontSize.xs,fontWeight:e.fontWeight.normal,color:e.colors.diffDeletion,uni__dependencies:[0]},diffContent:{borderTopWidth:e.borderWidth[1],borderTopColor:e.colors.border,backgroundColor:e.colors.surface1,uni__dependencies:[0]},diffContentRow:{flexDirection:"row",alignItems:"stretch"},diffContentInner:{flexDirection:"column"},linesContainer:{backgroundColor:e.colors.surface1,uni__dependencies:[0]},gutterColumn:{backgroundColor:e.colors.surface1,zIndex:4,elevation:4,overflow:"visible",uni__dependencies:[0]},gutterCell:{borderRightWidth:e.borderWidth[1],borderRightColor:e.colors.border,justifyContent:"flex-start",zIndex:4,elevation:4,overflow:"visible",uni__dependencies:[0]},inlineReviewRow:{flexDirection:"row",alignItems:"stretch",backgroundColor:e.colors.surface1,uni__dependencies:[0]},inlineReviewGutterSpacer:{borderRightWidth:e.borderWidth[1],borderRightColor:e.colors.border,backgroundColor:e.colors.surface1,flexShrink:0,uni__dependencies:[0]},textLineContainer:{flexDirection:"row",alignItems:"stretch",paddingLeft:e.spacing[2],uni__dependencies:[0]},splitRow:{flexDirection:"row",alignItems:"stretch"},splitColumnScroll:{flex:1},splitHeaderRow:{backgroundColor:e.colors.surface2,paddingHorizontal:e.spacing[3],uni__dependencies:[0]},splitCell:{flex:1,flexBasis:0,backgroundColor:e.colors.surface2,uni__dependencies:[0]},splitCellRow:{flexDirection:"row",alignItems:"stretch"},emptySplitCell:{backgroundColor:e.colors.surfaceDiffEmpty,uni__dependencies:[0]},splitCellWithDivider:{borderLeftWidth:e.borderWidth[1],borderLeftColor:e.colors.border,uni__dependencies:[0]},diffLineContainer:{flexDirection:"row",alignItems:"stretch",overflow:"visible"},lineNumberGutter:{borderRightWidth:e.borderWidth[1],borderRightColor:e.colors.border,marginRight:e.spacing[2],alignSelf:"stretch",justifyContent:"flex-start",zIndex:4,elevation:4,overflow:"visible",uni__dependencies:[0]},diffTextMetrics:{fontSize:e.fontSize.code,lineHeight:e.lineHeight.diff,fontFamily:e.fontFamily.mono,uni__dependencies:[0]},lineNumberText:{width:"100%",textAlign:"right",paddingRight:e.spacing[2],color:e.colors.foregroundMuted,userSelect:"none",uni__dependencies:[0]},addLineNumberText:{color:e.colors.diffAddition,uni__dependencies:[0]},removeLineNumberText:{color:e.colors.diffDeletion,uni__dependencies:[0]},diffLineText:{flex:1,paddingRight:e.spacing[3],color:e.colors.foreground,userSelect:"text",uni__dependencies:[0]},addLineContainer:{backgroundColor:"rgba(46, 160, 67, 0.15)"},addLineText:{color:e.colors.foreground,uni__dependencies:[0]},removeLineContainer:{backgroundColor:"rgba(248, 81, 73, 0.1)"},removeLineText:{color:e.colors.foreground,uni__dependencies:[0]},headerLineContainer:{backgroundColor:e.colors.surface2,uni__dependencies:[0]},headerLineText:{color:e.colors.foregroundMuted,uni__dependencies:[0]},contextLineContainer:{backgroundColor:e.colors.surface1,uni__dependencies:[0]},contextLineText:{color:e.colors.foregroundMuted,uni__dependencies:[0]},emptySplitCellText:{color:"transparent"},statusMessageContainer:{borderTopWidth:e.borderWidth[1],borderTopColor:e.colors.border,backgroundColor:e.colors.surface1,paddingHorizontal:e.spacing[3],paddingVertical:e.spacing[4],uni__dependencies:[0]},statusMessageText:{fontSize:e.fontSize.sm,color:e.colors.foregroundMuted,fontStyle:"italic",uni__dependencies:[0]},tooltipText:{fontSize:e.fontSize.xs,color:e.colors.foreground,uni__dependencies:[0]}})),Gt=[Ut.fileSectionBodyContainer,Ut.fileSectionBorder],Nt=[Ut.fileCheckbox,Ut.fileCheckboxChecked],$t=[Ut.diffContent,Ut.splitRow],Kt=[Ut.diffContent,Ut.diffContentRow],qt=.5},4042,[724,540,1692,3639,721,360,306,36,1093,3779,146,234,1054,1069,144,725,56,305,347,3591,1120,4043,4044,4046,4047,4049,4045,1121,4050,3858,3859,4051,1014,4054,3969,3968,4055,3514,3722,3819,3771,4056,4057,3691,3839,4058,3595,3854,4059,4053,4060,4063,3855,3857,3663,3662,4065,4066,1024,3351,3638,3597,1145,4067,4069,348,3565,4070,279]);
15692
+ __d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GitDiffPane=function({serverId:e,workspaceId:t,cwd:n,enabled:i,onOpenFile:l}){const{settings:u}=(0,L.useAppSettings)(),{t:f}=(0,d.useTranslation)(),x=(0,p.useIsCompactFormFactor)(),w=ce.isWeb,k=ce.isWeb&&!x,{preferences:C,updatePreferences:T}=(0,D.useChangesPreferences)(),I=C.wrapLines,M=C.viewMode,R=k?C.layout:"unified",W=(0,c.useCallback)(()=>{T({wrapLines:!I})},[T,I]),B=(0,c.useCallback)(()=>{T({hideWhitespace:!C.hideWhitespace})},[C.hideWhitespace,T]),O=(0,c.useCallback)(()=>{T({layout:"unified"===C.layout?"split":"unified"})},[C.layout,T]),U=Ft(u.codeFontSize,x),Z=Math.round(1.5*U),ee=[u.monoFontFamily,U,Z].join(":"),te=(0,c.useMemo)(()=>{const e=u.monoFontFamily.trim();return Object.assign({fontSize:U,lineHeight:Z},e?{fontFamily:e}:null)},[u.monoFontFamily,U,Z]),oe=(0,c.useMemo)(()=>({hovered:e,pressed:t,open:n})=>[Vt.diffModeTrigger,(Boolean(e)||t||Boolean(n))&&Vt.diffModeTriggerHovered],[]),re=C.pinnedToolbarItems,ae=(0,c.useCallback)(e=>{T({pinnedToolbarItems:(0,K.toggleChangesToolbarItem)(C.pinnedToolbarItems,e)})},[C.pinnedToolbarItems,T]),[he,ge]=(0,c.useState)(!1),pe=(0,c.useCallback)(()=>ge(!0),[]),me=(0,c.useCallback)(()=>ge(!1),[]),xe=(0,ne.useToast)(),we=(0,ie.useSessionStore)(t=>!0===t.sessions[e]?.serverInfo?.features?.checkoutRefresh),ye=(0,ie.useSessionStore)(t=>!0===t.sessions[e]?.serverInfo?.features?.checkoutGitCommit),be=(0,ie.useSessionStore)(t=>!0===t.sessions[e]?.serverInfo?.features?.checkoutGitLog),[ve,Se]=(0,c.useState)(Et),ke=(0,c.useCallback)(e=>{Se(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Ce=(0,c.useCallback)(()=>{Se(Et)},[]),Te=(0,Q.useCheckoutGitActionsStore)(e=>e.refresh),Ie="pending"===(0,Q.useCheckoutGitActionsStore)(t=>t.getStatus({serverId:e,cwd:n,actionId:"refresh"})),je=(0,c.useCallback)(()=>{Ie||Te({serverId:e,cwd:n}).catch(e=>{xe.error(e instanceof Error?e.message:f("workspace.git.diff.failedRefresh"))})},[n,Ie,Te,e,f,xe]),{status:De,isLoading:Le,isError:Me,error:Re}=(0,j.useCheckoutStatusQuery)({serverId:e,cwd:n}),We=Tt({status:De,isStatusLoading:Le,isStatusError:Me,statusError:Re}),{isGit:Pe,notGit:Ve,statusErrorMessage:Be,baseRef:rt,hasUncommittedChanges:st,currentBranchName:lt,isOttoOwnedWorktree:at,baseSource:ft,isBaseEditable:ht}=We,pt=(0,c.useMemo)(()=>(0,ue.buildReviewDraftScopeKey)({serverId:e,workspaceId:t,cwd:n,baseRef:rt,ignoreWhitespace:C.hideWhitespace}),[rt,C.hideWhitespace,n,e,t]),mt=(0,ue.useResolvedDiffMode)({scopeKey:pt,hasUncommittedChanges:st}),xt=(0,ue.useSetDiffModeOverride)(),{files:It,payloadError:Lt,isLoading:Pt}=(0,y.useCheckoutDiffQuery)({serverId:e,cwd:n,mode:mt,baseRef:rt,ignoreWhitespace:C.hideWhitespace,enabled:(Zt={paneEnabled:!1!==i,isGit:Pe},Zt.paneEnabled&&Zt.isGit)}),zt=ye&&"uncommitted"===mt,Bt=(0,c.useMemo)(()=>It.filter(e=>!ve.has(e.path)).map(e=>e.path),[ve,It]),Ot=(0,c.useCallback)(()=>{Se(e=>It.every(t=>!e.has(t.path))?new Set(It.map(e=>e.path)):Et)},[It]),Ut=(0,c.useMemo)(()=>(0,ue.buildReviewDraftKey)({serverId:e,workspaceId:t,cwd:n,mode:mt,baseRef:rt,branch:lt,ignoreWhitespace:C.hideWhitespace}),[rt,C.hideWhitespace,lt,n,mt,e,t]),Gt=(0,c.useCallback)(()=>{xt({scopeKey:pt,override:{serverId:e,cwd:n,mode:"uncommitted",isDirtyAtSelection:st}})},[n,st,pt,e,xt]),$t=(0,c.useCallback)(()=>{xt({scopeKey:pt,override:{serverId:e,cwd:n,mode:"base",isDirtyAtSelection:st}})},[n,st,pt,e,xt]),Kt=(0,ue.useInlineReviewController)({reviewDraftKey:Ut}),qt=(0,ue.useReviewCommentCount)(Ut),Xt=(0,ue.useClearReviewDraft)(),Yt=(0,c.useCallback)(()=>{(async()=>{await(0,J.confirmDialog)({title:1===qt?f("review.removeAll.confirmTitleSingle"):f("review.removeAll.confirmTitleMultiple",{count:qt}),message:f("review.removeAll.confirmMessage"),confirmLabel:f("review.removeAll.confirmButton"),destructive:!0})&&Xt({key:Ut})})()},[Xt,qt,Ut,f]),Qt=(0,ue.useReviewAttachmentSnapshot)({key:Ut,diffFiles:It,cwd:n,mode:mt,baseRef:rt}),Jt=(0,c.useMemo)(()=>(0,de.buildWorkspaceAttachmentScopeKey)({serverId:e,workspaceId:t,cwd:n}),[n,e,t]);var Zt;(0,c.useEffect)(()=>{const e=e=>{const t=de.useWorkspaceAttachmentsStore.getState(),n=(t.attachmentsByScope[Jt]??[]).filter(e=>"review"!==e.kind);t.setWorkspaceAttachments({scopeKey:Jt,attachments:e?[...n,e]:n})};return e(Qt),()=>e(null)},[Qt,Jt]);const{githubFeaturesEnabled:en,payloadError:tn}=(0,_.useCheckoutPrStatusQuery)({serverId:e,cwd:n,enabled:Pe}),nn=(0,c.useMemo)(()=>n.trim(),[n]),on=(0,c.useMemo)(()=>(0,le.buildWorkspaceExplorerStateKey)({workspaceId:t,workspaceRoot:nn}),[nn,t]),rn=(0,se.usePanelStore)(e=>on?e.diffExpandedPathsByWorkspace[on]:void 0),sn=(0,se.usePanelStore)(e=>e.setDiffExpandedPathsForWorkspace),ln=(0,c.useMemo)(()=>new Set(rn??[]),[rn]),an=(0,se.usePanelStore)(e=>on?e.diffCollapsedFoldersByWorkspace[on]:void 0),cn=(0,se.usePanelStore)(e=>e.setDiffCollapsedFoldersForWorkspace),dn=(0,c.useMemo)(()=>(0,v.compressSingleChildChains)((0,v.buildDiffTree)(It)),[It]),un=(0,c.useMemo)(()=>(0,v.collectDirPaths)(dn),[dn]),fn=(0,c.useMemo)(()=>new Set(un),[un]),hn=(0,c.useMemo)(()=>new Set((an??[]).filter(e=>fn.has(e))),[an,fn]),gn=(0,c.useRef)(null),pn=(0,c.useCallback)(()=>{const e="flat"===M?"tree":"flat";"tree"===e&&(gn.current?.scrollToOffset({offset:0,animated:!1}),on&&cn(on,[])),T({viewMode:e})},[cn,T,M,on]),mn=(0,G.useWebScrollViewScrollbar)(gn,{enabled:w}),xn=(0,c.useRef)(0),wn=(0,c.useRef)(0),yn=(0,c.useRef)({}),bn=(0,c.useRef)({}),vn=(0,c.useRef)(0),Sn=(0,c.useRef)(44),[kn,Cn]=(0,c.useState)(0),Tn=2*h.BORDER_WIDTH[1],In=Tn+2*h.SPACING[4]+Z,{flatItems:jn,stickyHeaderIndices:_n}=(0,c.useMemo)(()=>{const{items:e,stickyHeaderIndices:t}=(0,b.buildDiffFlatItems)({files:It,viewMode:M,tree:dn,collapsedFolders:hn,expandedPaths:ln});return{flatItems:e,stickyHeaderIndices:t}},[dn,hn,ln,It,M]),Dn=(0,c.useCallback)(e=>{let t=null;return"binary"===e.status?t="binary":("too_large"===e.status||ze(e))&&(t="too_large"),t?`${R}:${I?"wrap":"scroll"}:${ee}:${e.path}:${t}`:[R,I?"wrap":"scroll",ee,e.path,e.status??"ok",e.additions,e.deletions,e.hunks.length,vt(e),St(e)].join(":")},[ee,R,I]),Ln=(0,c.useCallback)(e=>{if("too_large"===e.status||"binary"===e.status||ze(e))return In;const t="split"===R?(0,P.buildSplitDiffRows)(e).length:vt(e);return Tn+t*Z},[Tn,Z,R,In]),Mn=(0,c.useCallback)(e=>{if("folder"===e.type)return vn.current||Sn.current;if("header"===e.type)return yn.current[e.file.path]??Sn.current;const t=Dn(e.file);return bn.current[t]??Ln(e.file)},[Ln,Dn]),Rn=(0,c.useCallback)(e=>{if(!Number.isFinite(e)||e<=0)return;const t=vn.current;t>0&&Math.abs(t-e)<=Nt||(vn.current=e,Cn(e=>e+1))},[]),Wn=(0,c.useCallback)((e,t)=>{if(!Number.isFinite(t)||t<=0)return;const n=yn.current[e];void 0!==n&&Math.abs(n-t)<=Nt||(yn.current[e]=t,Sn.current=t,Cn(e=>e+1))},[]),An=(0,c.useCallback)((e,t)=>{if(!Number.isFinite(t)||t<0)return;const n=Dn(e),i=bn.current[n];void 0!==i&&Math.abs(i-t)<=Nt||(bn.current[n]=t,Cn(e=>e+1))},[Dn]),Pn=(0,c.useCallback)(e=>{xn.current=e.nativeEvent.contentOffset.y,mn.onScroll(e)},[mn]),zn=(0,c.useCallback)(e=>{const t=e.nativeEvent.layout.height;!Number.isFinite(t)||t<=0||(wn.current=t,mn.onLayout(e))},[mn]),Hn=(0,c.useCallback)(e=>{const t=jn.findIndex(e);return t<0?null:(0,b.sumHeightsBefore)(jn,t,Mn)},[jn,Mn]),En=(0,c.useCallback)(e=>Hn(t=>"header"===t.type&&t.file.path===e)??0,[Hn]),Fn=(0,c.useCallback)(e=>{if(!on)return;const t=ln.has(e),n=!t,i=t?En(e):null,o=yn.current[e]??Sn.current;t&&null!==i&&(0,A.shouldAnchorHeaderBeforeCollapse)({headerOffset:i,headerHeight:o,viewportOffset:xn.current,viewportHeight:wn.current})&&null!==i&&gn.current?.scrollToOffset({offset:i,animated:!1});const s=n?[...ln,e]:Array.from(ln).filter(t=>t!==e);sn(on,s)},[En,ln,sn,on]),Vn=(0,c.useCallback)(e=>{if(!on)return;const t=hn.has(e);if(!t){const t=Hn(t=>"folder"===t.type&&t.dirPath===e),n=vn.current||Sn.current;null!==t&&(0,A.shouldAnchorHeaderBeforeCollapse)({headerOffset:t,headerHeight:n,viewportOffset:xn.current,viewportHeight:wn.current})&&gn.current?.scrollToOffset({offset:t,animated:!1})}const n=t?Array.from(hn).filter(t=>t!==e):[...hn,e];cn(on,n)},[hn,Hn,cn,on]),Bn=(0,c.useMemo)(()=>0!==It.length&&It.every(e=>ln.has(e.path)),[ln,It]),On=(0,c.useMemo)(()=>Bn&&("tree"!==M||0===hn.size),[Bn,hn,M]),Un=(0,c.useCallback)(()=>{if(on){if(On)return sn(on,[]),void("tree"===M&&cn(on,un));It.length<=He&&sn(on,It.map(e=>e.path)),"tree"===M&&cn(on,[])}},[On,un,It,cn,sn,M,on]),Gn=(0,se.usePanelStore)(e=>e.changesRevealRequest),[Nn,$n]=(0,c.useState)(null),Kn=(0,c.useRef)(Hn);Kn.current=Hn;const qn=(0,c.useRef)(null);(0,c.useEffect)(()=>()=>{null!==qn.current&&clearTimeout(qn.current)},[]),(0,c.useEffect)(()=>{$n(null)},[on]),(0,c.useEffect)(()=>{Gn&&on&&(se.usePanelStore.getState().clearChangesRevealRequest(),$n(Gn.path))},[Gn,on]),(0,c.useEffect)(()=>{if(!Nn||!on)return;if(!It.some(e=>e.path===Nn))return void(Pt||$n(null));if("tree"===M){const e=Array.from(hn).filter(e=>Nn.startsWith(`${e}/`));if(e.length>0){const t=new Set(e);return void cn(on,Array.from(hn).filter(e=>!t.has(e)))}}if(!ln.has(Nn))return void sn(on,[...ln,Nn]);const e=e=>"header"===e.type&&e.file.path===Nn,t=Hn(e);null!==t&&($n(null),gn.current?.scrollToOffset({offset:t,animated:!1}),null!==qn.current&&clearTimeout(qn.current),qn.current=setTimeout(()=>{qn.current=null;const n=Kn.current(e);null!==n&&n!==t&&gn.current?.scrollToOffset({offset:n,animated:!1})},100))},[hn,Hn,ln,It,Pt,Nn,cn,sn,M,on]);const Xn=It.length>0,Yn=(0,c.useMemo)(()=>{const e=[];if(k){const t="split"===C.layout;e.push({id:"split",label:f(t?"workspace.git.diff.switchToUnified":"workspace.git.diff.switchToSplit"),renderIcon:e=>t?(0,fe.jsx)(Oe,{size:e,uniProps:Fe}):(0,fe.jsx)(Ue,{size:e,uniProps:Fe}),onPress:O,testID:"changes-toggle-layout"})}if(Xn){const t="tree"===M;e.push({id:"tree",label:f(t?"workspace.git.diff.showFlatView":"workspace.git.diff.showTreeView"),renderIcon:e=>t?(0,fe.jsx)(Xe,{size:e,uniProps:Fe}):(0,fe.jsx)(qe,{size:e,uniProps:Fe}),onPress:pn,testID:"changes-toggle-view-mode"});const n=!Bn&&It.length>He;let i;i=f(On?"workspace.git.diff.collapseAll":n?"workspace.git.diff.expandAllTooManyFiles":"workspace.git.diff.expandAll"),e.push({id:"expand",label:i,renderIcon:e=>On?(0,fe.jsx)($e,{size:e,uniProps:Fe}):(0,fe.jsx)(Ke,{size:e,uniProps:Fe}),onPress:Un,disabled:n,testID:"changes-toggle-expand-all"})}return e.push({id:"whitespace",label:C.hideWhitespace?f("workspace.git.diff.showWhitespace"):f("workspace.git.diff.hideWhitespace"),renderIcon:e=>(0,fe.jsx)(Ge,{size:e,uniProps:Fe}),onPress:B,testID:"changes-toggle-whitespace"}),e.push({id:"wrap",label:f(I?"workspace.git.diff.scrollLongLines":"workspace.git.diff.wrapLongLines"),renderIcon:e=>(0,fe.jsx)(Ne,{size:e,uniProps:Fe}),onPress:W,testID:"changes-toggle-wrap-lines"}),qt>0&&e.push({id:"removeComments",label:f("review.removeAll.action"),renderIcon:e=>(0,fe.jsx)(wt,{size:e,uniProps:Fe}),onPress:Yt,separatorBefore:!0,testID:"changes-remove-all-comments"}),we&&e.push({id:"refresh",label:f(Ie?"workspace.git.diff.refreshing":"workspace.git.diff.refresh"),renderIcon:e=>Ie?(0,fe.jsx)(bt,{size:e,uniProps:Fe}):(0,fe.jsx)(yt,{size:e,uniProps:Fe}),onPress:je,disabled:Ie,separatorBefore:!0,testID:"changes-refresh"}),e},[k,C.layout,C.hideWhitespace,Xn,It,M,Bn,On,I,qt,we,Ie,O,pn,Un,B,W,Yt,je,f]),Qn=(0,F.useTextEditorFeature)(e),[Jn,Zn]=(0,c.useState)(null),ei=(0,c.useCallback)(e=>{Zn(e)},[]),ti=(0,c.useCallback)(({target:e,x:t,y:n})=>{Zn({path:e.filePath,lineStart:e.newLineNumber??e.oldLineNumber??void 0,x:t,y:n})},[]),ni=(0,c.useCallback)(e=>{e||Zn(null)},[]),ii=(0,c.useCallback)(()=>{Jn&&l&&l(Jn.path,{edit:!0,lineStart:Jn.lineStart})},[Jn,l]),oi=(0,c.useCallback)(()=>{Jn&&E.setStringAsync((0,V.buildAbsoluteExplorerPath)({workspaceRoot:nn,entryPath:Jn.path}))},[Jn,nn]),ri=(0,c.useCallback)(()=>{if(!Jn)return;const{requestFilesReveal:t,setExplorerTabForCheckout:i}=se.usePanelStore.getState();t(Jn.path),i({serverId:e,cwd:n,isGit:!0,tab:"files"})},[Jn,n,e]),si=Mt({serverId:e,cwd:n,diffMode:mt,contextMenuPath:Jn?.path??null,selectedPaths:Bt,commitSelectionEnabled:zt}),li=Rt({serverId:e,scopeKey:Jt,request:Jn}),ai=(0,c.useCallback)(({item:e})=>"folder"===e.type?(0,fe.jsx)(S.DiffFolderRow,{dirPath:e.dirPath,displayName:e.displayName,depth:e.depth,ancestorMask:e.ancestorMask,collapsed:e.collapsed,additions:e.additions,deletions:e.deletions,onToggle:Vn,onHeightChange:Rn,testID:`diff-folder-${e.dirPath}`}):"header"===e.type?(0,fe.jsx)(Ae,{file:e.file,isExpanded:e.isExpanded,depth:e.depth,ancestorMask:e.ancestorMask,showDir:"flat"===M,selectable:zt,selected:!ve.has(e.file.path),onToggleSelected:ke,onToggle:Fn,onOpenFile:l,onHeaderHeightChange:Wn,onShowContextMenu:ei,testID:`diff-file-${e.fileIndex}`}):(0,fe.jsx)(Ee,{file:e.file,layout:R,wrapLines:I,codeFontSize:U,textMetricsStyle:te,reviewActions:Kt,onLineContextMenu:ti,onBodyHeightChange:An,testID:`diff-file-${e.fileIndex}-body`}),[U,zt,ve,te,R,An,Rn,Wn,ti,ei,Fn,ke,Vn,l,Kt,M,I]),ci=(0,c.useCallback)(e=>"folder"===e.type?`folder-${e.dirPath}`:`${e.type}-${e.file.path}`,[]),di=(0,c.useCallback)((e,t)=>{const n=(0,b.sumHeightsBefore)(jn,t,Mn),i=jn[t];return{length:i?Mn(i):0,offset:n,index:t}},[jn,Mn]),ui=(0,c.useMemo)(()=>({expandedPathsArray:rn,collapsedFoldersArray:an,commitSelectionEnabled:zt,deselectedPaths:ve,effectiveLayout:R,diffBodyTypographyKey:ee,heightVersion:kn,viewMode:M,wrapLines:I,reviewActions:Kt}),[rn,an,zt,ve,R,ee,kn,M,I,Kt]),fi=It.length>0,hi=Lt?.message??null,gi=Dt(en,tn),pi=(0,c.useMemo)(()=>jt(rt,f("workspace.git.diff.base")),[rt,f]),mi=(0,h.useIconSize)(),xi=mi.md,wi=(0,c.useMemo)(()=>({commit:(0,fe.jsx)(Ye,{size:xi,uniProps:Fe}),pull:(0,fe.jsx)(Qe,{size:xi,uniProps:Fe}),push:(0,fe.jsx)(Je,{size:xi,uniProps:Fe}),pullAndPush:(0,fe.jsx)(Ze,{size:xi,uniProps:Fe}),viewPr:e=>(0,fe.jsx)(et,{provider:e,size:xi,uniProps:Fe}),createPr:e=>(0,fe.jsx)(et,{provider:e,size:xi,uniProps:Fe}),mergePrSquash:e=>(0,fe.jsx)(et,{provider:e,size:xi,uniProps:Fe}),mergePrMerge:e=>(0,fe.jsx)(et,{provider:e,size:xi,uniProps:Fe}),mergePrRebase:e=>(0,fe.jsx)(et,{provider:e,size:xi,uniProps:Fe}),merge:(0,fe.jsx)(tt,{size:xi,uniProps:Fe}),mergeFromBase:(0,fe.jsx)(nt,{size:xi,uniProps:Fe}),archive:(0,fe.jsx)(it,{size:xi,uniProps:Fe})}),[xi]),{gitActions:yi,branchLabel:bi}=(0,Y.useGitActions)({serverId:e,cwd:n,icons:wi}),vi=(0,c.useMemo)(()=>_t(bi,pi),[pi,bi]),Si=f("workspace.git.diff.uncommitted"),ki=f("workspace.git.diff.committed"),Ci=kt(C.hideWhitespace,mt,pi,{hiddenWhitespace:f("workspace.git.diff.emptyHiddenWhitespace"),uncommitted:f("workspace.git.diff.emptyUncommitted"),againstBase:e=>f("workspace.git.diff.emptyAgainstBase",{baseRef:e})}),Ti=(0,fe.jsx)(Ct,{isStatusLoading:Le,statusErrorMessage:Be,notGit:Ve,isDiffLoading:Pt,diffErrorMessage:hi,hasChanges:fi,emptyMessage:Ci,flatItems:jn,stickyHeaderIndices:_n,renderFlatItem:ai,flatKeyExtractor:ci,getFlatItemLayout:di,flatExtraData:ui,diffListRef:gn,handleDiffListLayout:zn,handleDiffListScroll:Pn,onContentSizeChange:mn.onContentSizeChange,showWebScrollbar:w,checkingRepositoryLabel:f("workspace.git.diff.checkingRepository"),notRepositoryLabel:f("workspace.git.diff.notRepository")});return(0,fe.jsxs)(s.View,{style:Vt.container,children:[Pe&&(lt||x)?(0,fe.jsxs)(s.View,{style:Vt.header,testID:"changes-header",children:[(0,fe.jsx)(s.View,{style:Vt.headerBranchArea,children:(0,fe.jsx)(q.BranchSwitcher,{currentBranchName:lt,serverId:e,workspaceId:t??n,workspaceDirectory:n,isGitCheckout:Pe,testID:"changes-branch-switcher"})}),x?(0,fe.jsx)(N.GitActionsSplitButton,{gitActions:yi}):null]}):null,Pe?(0,fe.jsx)(s.View,{style:Vt.diffStatusContainer,children:(0,fe.jsxs)(s.View,{style:Vt.diffStatusInner,onPointerEnter:pe,onPointerLeave:me,children:[(0,fe.jsxs)(s.View,{style:Vt.diffStatusLeading,children:[(0,fe.jsxs)(z.DropdownMenu,{children:[(0,fe.jsxs)(z.DropdownMenuTrigger,{style:oe,testID:"changes-diff-status",accessibilityRole:"button",accessibilityLabel:f("workspace.git.diff.diffMode"),children:[(0,fe.jsx)(o.Text,{style:Vt.diffStatusText,numberOfLines:1,children:"uncommitted"===mt?Si:ki}),(0,fe.jsx)(ot,{size:mi.xs,uniProps:Fe})]}),(0,fe.jsxs)(z.DropdownMenuContent,{align:"start",width:260,testID:"changes-diff-status-menu",children:[(0,fe.jsx)(z.DropdownMenuItem,{testID:"changes-diff-mode-uncommitted",selected:"uncommitted"===mt,onSelect:Gt,children:Si}),(0,fe.jsx)(z.DropdownMenuSeparator,{}),(0,fe.jsx)(z.DropdownMenuItem,{testID:"changes-diff-mode-committed",selected:"base"===mt,description:vi,onSelect:$t,children:ki})]})]}),(0,fe.jsx)(X.DiffBaseSwitcher,{visible:"base"===mt,serverId:e,workspaceId:t,cwd:n,baseRefLabel:pi,currentBranchName:lt,isOttoOwnedWorktree:at,baseSource:ft,isBaseEditable:ht})]}),(0,fe.jsx)($.ChangesToolbar,{items:Yn,pinnedItems:re,onTogglePin:ae,hovered:he,isMobile:x,hideUntilHover:u.hidePinnedToolbarOptions,optionsLabel:f("workspace.git.diff.options")})]})}):null,gi?(0,fe.jsx)(o.Text,{style:Vt.actionErrorText,children:gi}):null,(0,fe.jsxs)(s.View,{style:Vt.diffContainer,children:[Ti,fi?mn.overlay:null]}),(0,fe.jsx)(Ht,{serverId:e,cwd:n,workspaceId:t,selectedPaths:Bt,totalFiles:It.length,commitSupported:ye,logSupported:be,isGit:Pe,diffMode:mt,hasChanges:fi,onToggleSelectAll:Ot,onCommitted:Ce}),(0,fe.jsx)(H.ContextMenu,{open:null!==Jn,onOpenChange:ni,anchor:Jn,children:(0,fe.jsxs)(H.ContextMenuContent,{width:220,testID:"changes-context-menu",children:[(0,fe.jsx)(At,{toggle:li}),Qn&&l?(0,fe.jsx)(H.ContextMenuItem,{leading:ct,onSelect:ii,testID:"changes-context-menu-edit",children:f("workspace.fileExplorer.context.edit")}):null,(0,fe.jsx)(gt,{serverId:e,workspaceId:t,request:Jn}),(0,fe.jsx)(H.ContextMenuItem,{leading:ut,onSelect:ri,testID:"changes-context-menu-find-in-files",children:f("workspace.fileExplorer.context.findInFiles")}),(0,fe.jsx)(H.ContextMenuItem,{leading:dt,onSelect:oi,testID:"changes-context-menu-copy-path",children:f("workspace.fileExplorer.context.copyPath")}),(0,fe.jsx)(Wt,{rollback:si})]})})]})};var e=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=r(_d[3]),o=r(_d[4]),s=r(_d[5]),l=r(_d[6]),c=r(_d[7]),d=r(_d[8]),u=r(_d[9]);r(_d[10]),r(_d[11]),r(_d[12]),r(_d[13]),r(_d[14]),r(_d[15]);var f=r(_d[16]),h=r(_d[17]),p=r(_d[18]),x=r(_d[19]),w=r(_d[20]),y=r(_d[21]),b=r(_d[22]),v=r(_d[23]),S=r(_d[24]),k=r(_d[25]),C=r(_d[26]),T=r(_d[27]),I=r(_d[28]),j=r(_d[29]),_=r(_d[30]),D=r(_d[31]),L=r(_d[32]),M=r(_d[33]),R=r(_d[34]),W=r(_d[35]),A=r(_d[36]),P=r(_d[37]),z=r(_d[38]),H=r(_d[39]),E=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),t.default=e,t})(r(_d[40])),F=r(_d[41]),V=r(_d[42]),B=r(_d[43]),O=r(_d[44]),U=r(_d[45]),G=r(_d[46]),N=r(_d[47]),$=r(_d[48]),K=r(_d[49]),q=r(_d[50]),X=r(_d[51]),Y=r(_d[52]),Q=r(_d[53]),J=r(_d[54]),Z=r(_d[55]),ee=r(_d[56]),te=r(_d[57]),ne=r(_d[58]),ie=r(_d[59]),oe=r(_d[60]),re=r(_d[61]),se=r(_d[62]),le=r(_d[63]),ae=r(_d[64]),ce=r(_d[65]),de=r(_d[66]),ue=r(_d[67]),fe=r(_d[68]);function he({pressed:e}){return[Vt.fileHeader,e&&Vt.fileHeaderPressed]}function ge(e){if(!ce.isNative)return e?{whiteSpace:"pre-wrap",overflowWrap:"anywhere"}:{whiteSpace:"pre",overflowWrap:"normal"}}function pe(e){const{lineHeight:t}=e;return"number"==typeof t&&Number.isFinite(t)?t:void 0}function me(e){const t=(0,l.c)(4);let n;t[0]!==e?(n=pe(e),t[0]=e,t[1]=n):n=t[1];const i=n;let o;return t[2]!==i?(o=void 0!==i?(0,re.inlineUnistylesStyle)({minHeight:i}):null,t[2]=i,t[3]=o):o=t[3],o}function xe(e){const t=(0,l.c)(5),{token:n}=e;let i,s;return t[0]!==n.style?(i=(0,R.syntaxTokenStyleFor)(n.style),t[0]=n.style,t[1]=i):i=t[1],t[2]!==i||t[3]!==n.text?(s=(0,fe.jsx)(o.Text,{style:i,children:n.text}),t[2]=i,t[3]=n.text,t[4]=s):s=t[4],s}const we=(0,c.memo)(function(e){const t=(0,l.c)(13),{tokens:n,textMetricsStyle:i,wrapLines:s,testID:c}=e,d=void 0!==s&&s;let u,f;t[0]!==d?(u=ge(d),t[0]=d,t[1]=u):u=t[1],t[2]!==u||t[3]!==i?(f=[Vt.diffTextMetrics,i,Vt.diffLineText,u],t[2]=u,t[3]=i,t[4]=f):f=t[4];const h=f;let p;t[5]!==n?(p=n.map($t),t[5]=n,t[6]=p):p=t[6];const x=p;let w,y;return t[7]!==x?(w=x.map(Kt),t[7]=x,t[8]=w):w=t[8],t[9]!==h||t[10]!==w||t[11]!==c?(y=(0,fe.jsx)(o.Text,{style:h,testID:c,children:w}),t[9]=h,t[10]=w,t[11]=c,t[12]=y):y=t[12],y}),ye=[];function be(){}const ve=ce.isWeb?{cursor:"auto"}:null;function Se(e){const t=(0,l.c)(29),{reviewTarget:i,reviewActions:o,onHoverChange:c,hoverTargetKey:d,onHoverTargetChange:u,onLineContextMenu:f,style:h,children:p}=e,x=o?.onStartComment;let w;t[0]!==x||t[1]!==i?(w=()=>{i&&x&&x(i)},t[0]=x,t[1]=i,t[2]=w):w=t[2];const y=w;let b;t[3]!==d||t[4]!==c||t[5]!==u?(b=()=>{c?.(!0),d&&u?.(d)},t[3]=d,t[4]=c,t[5]=u,t[6]=b):b=t[6];const v=b;let S;t[7]!==d||t[8]!==c||t[9]!==u?(S=()=>{c?.(!1),d&&u?.(null)},t[7]=d,t[8]=c,t[9]=u,t[10]=S):S=t[10];const k=S;let C;t[11]!==f||t[12]!==i?(C=e=>{if(!i||!f)return;const t=(0,H.contextMenuAnchorFromEvent)(e);t&&f({target:i,x:t.x,y:t.y})},t[11]=f,t[12]=i,t[13]=C):C=t[13];const T=C;let I;t[14]!==h?(I=[h,ve],t[14]=h,t[15]=I):I=t[15];const j=I,_=Boolean(i&&f);if(ce.isWeb&&(c||u||_)){const e=_?T:void 0;let i;return t[16]!==p||t[17]!==v||t[18]!==k||t[19]!==j||t[20]!==e?(i=(0,fe.jsx)(n.Pressable,{onHoverIn:v,onHoverOut:k,onContextMenu:e,style:j,children:p}),t[16]=p,t[17]=v,t[18]=k,t[19]=j,t[20]=e,t[21]=i):i=t[21],i}if(!ce.isNative||!i||!x){let e;return t[22]!==p||t[23]!==h?(e=(0,fe.jsx)(s.View,{style:h,children:p}),t[22]=p,t[23]=h,t[24]=e):e=t[24],e}let D;return t[25]!==p||t[26]!==y||t[27]!==h?(D=(0,fe.jsx)(n.Pressable,{onPress:y,style:h,children:p}),t[25]=p,t[26]=y,t[27]=h,t[28]=D):D=t[28],D}function ke(e){return e?"add"===e?Vt.addLineContainer:"remove"===e?Vt.removeLineContainer:"header"===e?Vt.headerLineContainer:Vt.contextLineContainer:Vt.emptySplitCell}const Ce=(0,c.memo)(function(e){const t=(0,l.c)(39),{lineNumber:n,type:i,gutterWidth:s,textMetricsStyle:c,reviewTarget:d,reviewActions:u,isLineHovered:f,style:h,textTestID:p,actionTestID:x}=e;let w;t[0]!==c?(w=pe(c),t[0]=c,t[1]=w):w=t[1];const y=w,b=me(c);let v,S,k;t[2]!==i?(v=ke(i),t[2]=i,t[3]=v):v=t[3],t[4]!==s?(S=(0,re.inlineUnistylesStyle)({width:s}),t[4]=s,t[5]=S):S=t[5],t[6]!==b||t[7]!==h||t[8]!==v||t[9]!==S?(k=[Vt.gutterCell,v,b,S,h],t[6]=b,t[7]=h,t[8]=v,t[9]=S,t[10]=k):k=t[10];const C=k,T="add"===i&&Vt.addLineNumberText,I="remove"===i&&Vt.removeLineNumberText;let j;t[11]!==T||t[12]!==I||t[13]!==c?(j=[Vt.diffTextMetrics,c,Vt.lineNumberText,T,I],t[11]=T,t[12]=I,t[13]=c,t[14]=j):j=t[14];const _=j;let D,L;t[15]!==u?.commentsByTarget||t[16]!==d?(D=()=>d?u?.commentsByTarget.get(d.key)??ye:ye,t[15]=u?.commentsByTarget,t[16]=d,t[17]=D):D=t[17],t[18]!==D?(L=D(),t[18]=D,t[19]=L):L=t[19];const M=L,R=u?.editor??null;let W;t[20]!==d||t[21]!==R?(W=(0,ue.isInlineReviewEditorForTarget)(R,d),t[20]=d,t[21]=R,t[22]=W):W=t[22];const A=W,P=u?.onStartComment??be;let z,H,E;return t[23]!==n?(z=(0,ae.formatDiffGutterText)(n),t[23]=n,t[24]=z):z=t[24],t[25]!==z||t[26]!==_||t[27]!==p?(H=(0,fe.jsx)(o.Text,{numberOfLines:1,style:_,testID:p,children:z}),t[25]=z,t[26]=_,t[27]=p,t[28]=H):H=t[28],t[29]!==x||t[30]!==M||t[31]!==C||t[32]!==A||t[33]!==f||t[34]!==y||t[35]!==P||t[36]!==d||t[37]!==H?(E=(0,fe.jsx)(ue.InlineReviewGutterCell,{reviewTarget:d,comments:M,isEditorOpen:A,isLineHovered:f,lineHeight:y,onStartComment:P,style:C,actionTestID:x,children:H}),t[29]=x,t[30]=M,t[31]=C,t[32]=A,t[33]=f,t[34]=y,t[35]=P,t[36]=d,t[37]=H,t[38]=E):E=t[38],E}),Te=(0,c.memo)(function(e){const t=(0,l.c)(31),{line:n,wrapLines:i,textMetricsStyle:s,reviewTarget:c,reviewActions:d,onHoverChange:u,hoverTargetKey:f,onHoverTargetChange:h,onLineContextMenu:p,textTestID:x}=e,w=(0,ae.hasVisibleDiffTokens)(n.tokens)?n.tokens:null,y=me(s);let b,v;t[0]!==n.type?(b=ke(n.type),t[0]=n.type,t[1]=b):b=t[1],t[2]!==y||t[3]!==b?(v=[Vt.textLineContainer,b,y],t[2]=y,t[3]=b,t[4]=v):v=t[4];const S=v;let k;t[5]!==i?(k=ge(i),t[5]=i,t[6]=k):k=t[6];const C="add"===n.type&&Vt.addLineText,T="remove"===n.type&&Vt.removeLineText,I="header"===n.type&&Vt.headerLineText,j="context"===n.type&&Vt.contextLineText;let _;t[7]!==k||t[8]!==C||t[9]!==T||t[10]!==I||t[11]!==j||t[12]!==s?(_=[Vt.diffTextMetrics,s,Vt.diffLineText,k,C,T,I,j],t[7]=k,t[8]=C,t[9]=T,t[10]=I,t[11]=j,t[12]=s,t[13]=_):_=t[13];const D=_;let L,M;return t[14]!==n.content||t[15]!==n.type||t[16]!==s||t[17]!==D||t[18]!==x||t[19]!==w||t[20]!==i?(L="header"!==n.type&&w?(0,fe.jsx)(we,{tokens:w,textMetricsStyle:s,wrapLines:i,testID:x}):(0,fe.jsx)(o.Text,{style:D,testID:x,children:(0,ae.formatDiffContentText)(n.content)}),t[14]=n.content,t[15]=n.type,t[16]=s,t[17]=D,t[18]=x,t[19]=w,t[20]=i,t[21]=L):L=t[21],t[22]!==S||t[23]!==f||t[24]!==u||t[25]!==h||t[26]!==p||t[27]!==d||t[28]!==c||t[29]!==L?(M=(0,fe.jsx)(Se,{reviewTarget:c,reviewActions:d,onHoverChange:u,hoverTargetKey:f,onHoverTargetChange:h,onLineContextMenu:p,style:S,children:L}),t[22]=S,t[23]=f,t[24]=u,t[25]=h,t[26]=p,t[27]=d,t[28]=c,t[29]=L,t[30]=M):M=t[30],M}),Ie=(0,c.memo)(function(e){const t=(0,l.c)(29),{line:n,wrapLines:i,textMetricsStyle:s,reviewActions:c,onHoverChange:d,hoverTargetKey:u,onHoverTargetChange:f,onLineContextMenu:h}=e,p=n&&(0,ae.hasVisibleDiffTokens)(n.tokens)?n.tokens:null,x=me(s),w=n?.type;let y,b;t[0]!==w?(y=ke(w),t[0]=w,t[1]=y):y=t[1],t[2]!==x||t[3]!==y?(b=[Vt.textLineContainer,y,x],t[2]=x,t[3]=y,t[4]=b):b=t[4];const v=b;let S;t[5]!==i?(S=ge(i),t[5]=i,t[6]=S):S=t[6];const k="add"===n?.type&&Vt.addLineText,C="remove"===n?.type&&Vt.removeLineText,T="context"===n?.type&&Vt.contextLineText,I=!n&&Vt.emptySplitCellText;let j;t[7]!==S||t[8]!==k||t[9]!==C||t[10]!==T||t[11]!==I||t[12]!==s?(j=[Vt.diffTextMetrics,s,Vt.diffLineText,S,k,C,T,I],t[7]=S,t[8]=k,t[9]=C,t[10]=T,t[11]=I,t[12]=s,t[13]=j):j=t[13];const _=j,D=n?.reviewTarget;let L,M;return t[14]!==n?.content||t[15]!==s||t[16]!==_||t[17]!==p||t[18]!==i?(L=p?(0,fe.jsx)(we,{tokens:p,textMetricsStyle:s,wrapLines:i}):(0,fe.jsx)(o.Text,{style:_,children:(0,ae.formatDiffContentText)(n?.content)}),t[14]=n?.content,t[15]=s,t[16]=_,t[17]=p,t[18]=i,t[19]=L):L=t[19],t[20]!==v||t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==h||t[25]!==c||t[26]!==D||t[27]!==L?(M=(0,fe.jsx)(Se,{reviewTarget:D,reviewActions:c,onHoverChange:d,hoverTargetKey:u,onHoverTargetChange:f,onLineContextMenu:h,style:v,children:L}),t[20]=v,t[21]=u,t[22]=d,t[23]=f,t[24]=h,t[25]=c,t[26]=D,t[27]=L,t[28]=M):M=t[28],M}),je=(0,c.memo)(function(e){const t=(0,l.c)(36),{line:n,lineNumber:i,gutterWidth:s,wrapLines:d,textMetricsStyle:u,reviewTarget:f,reviewActions:h,onLineContextMenu:p}=e,[x,w]=(0,c.useState)(!1),y=(0,ae.hasVisibleDiffTokens)(n.tokens)?n.tokens:null,b=me(u);let v,S;t[0]!==n.type?(v=ke(n.type),t[0]=n.type,t[1]=v):v=t[1],t[2]!==b||t[3]!==v?(S=[Vt.diffLineContainer,v,b],t[2]=b,t[3]=v,t[4]=S):S=t[4];const k=S;let C;t[5]!==d?(C=ge(d),t[5]=d,t[6]=C):C=t[6];const T="add"===n.type&&Vt.addLineText,I="remove"===n.type&&Vt.removeLineText,j="header"===n.type&&Vt.headerLineText,_="context"===n.type&&Vt.contextLineText;let D;t[7]!==C||t[8]!==T||t[9]!==I||t[10]!==j||t[11]!==_||t[12]!==u?(D=[Vt.diffTextMetrics,u,Vt.diffLineText,C,T,I,j,_],t[7]=C,t[8]=T,t[9]=I,t[10]=j,t[11]=_,t[12]=u,t[13]=D):D=t[13];const L=D;let M,R,W;return t[14]!==s||t[15]!==x||t[16]!==n.type||t[17]!==i||t[18]!==h||t[19]!==f||t[20]!==u?(M=(0,fe.jsx)(Ce,{lineNumber:i,type:n.type,gutterWidth:s,textMetricsStyle:u,reviewTarget:f,reviewActions:h,isLineHovered:x,style:Vt.lineNumberGutter}),t[14]=s,t[15]=x,t[16]=n.type,t[17]=i,t[18]=h,t[19]=f,t[20]=u,t[21]=M):M=t[21],t[22]!==n.content||t[23]!==n.type||t[24]!==u||t[25]!==L||t[26]!==y||t[27]!==d?(R="header"!==n.type&&y?(0,fe.jsx)(we,{tokens:y,textMetricsStyle:u,wrapLines:d}):(0,fe.jsx)(o.Text,{style:L,children:(0,ae.formatDiffContentText)(n.content)}),t[22]=n.content,t[23]=n.type,t[24]=u,t[25]=L,t[26]=y,t[27]=d,t[28]=R):R=t[28],t[29]!==k||t[30]!==p||t[31]!==h||t[32]!==f||t[33]!==R||t[34]!==M?(W=(0,fe.jsxs)(Se,{reviewTarget:f,reviewActions:h,onHoverChange:w,onLineContextMenu:p,style:k,children:[M,R]}),t[29]=k,t[30]=p,t[31]=h,t[32]=f,t[33]=R,t[34]=M,t[35]=W):W=t[35],W}),De=(0,c.memo)(function(e){const t=(0,l.c)(35),{line:n,gutterWidth:i,wrapLines:s,textMetricsStyle:d,reviewActions:u,onLineContextMenu:f}=e,[h,p]=(0,c.useState)(!1),x=n&&(0,ae.hasVisibleDiffTokens)(n.tokens)?n.tokens:null,w=me(d),y=n?.type;let b,v;t[0]!==y?(b=ke(y),t[0]=y,t[1]=b):b=t[1],t[2]!==w||t[3]!==b?(v=[Vt.diffLineContainer,b,w],t[2]=w,t[3]=b,t[4]=v):v=t[4];const S=v;let k;t[5]!==s?(k=ge(s),t[5]=s,t[6]=k):k=t[6];const C="add"===n?.type&&Vt.addLineText,T="remove"===n?.type&&Vt.removeLineText,I="context"===n?.type&&Vt.contextLineText,j=!n&&Vt.emptySplitCellText;let _;t[7]!==k||t[8]!==C||t[9]!==T||t[10]!==I||t[11]!==j||t[12]!==d?(_=[Vt.diffTextMetrics,d,Vt.diffLineText,k,C,T,I,j],t[7]=k,t[8]=C,t[9]=T,t[10]=I,t[11]=j,t[12]=d,t[13]=_):_=t[13];const D=_,L=n?.reviewTarget,M=n?.lineNumber??null,R=n?.type,W=n?.reviewTarget;let A,P,z;return t[14]!==i||t[15]!==h||t[16]!==u||t[17]!==M||t[18]!==R||t[19]!==W||t[20]!==d?(A=(0,fe.jsx)(Ce,{lineNumber:M,type:R,gutterWidth:i,textMetricsStyle:d,reviewTarget:W,reviewActions:u,isLineHovered:h,style:Vt.lineNumberGutter}),t[14]=i,t[15]=h,t[16]=u,t[17]=M,t[18]=R,t[19]=W,t[20]=d,t[21]=A):A=t[21],t[22]!==n?.content||t[23]!==d||t[24]!==D||t[25]!==x||t[26]!==s?(P=x?(0,fe.jsx)(we,{tokens:x,textMetricsStyle:d,wrapLines:s}):(0,fe.jsx)(o.Text,{style:D,children:(0,ae.formatDiffContentText)(n?.content)}),t[22]=n?.content,t[23]=d,t[24]=D,t[25]=x,t[26]=s,t[27]=P):P=t[27],t[28]!==S||t[29]!==f||t[30]!==u||t[31]!==L||t[32]!==A||t[33]!==P?(z=(0,fe.jsxs)(Se,{reviewTarget:L,reviewActions:u,onHoverChange:p,onLineContextMenu:f,style:S,children:[A,P]}),t[28]=S,t[29]=f,t[30]=u,t[31]=L,t[32]=A,t[33]=P,t[34]=z):z=t[34],z});function Le(e){const t=(0,l.c)(14),{reviewTarget:n,reviewActions:i,reservedHeight:o,viewportWidth:c,pinToViewport:d}=e;let u;t[0]!==i||t[1]!==n?(u=(0,ue.getInlineReviewThreadState)({reviewTarget:n,reviewActions:i}),t[0]=i,t[1]=n,t[2]=u):u=t[2];const f=u,h=o??f?.height??0;let p;t[3]!==h?(p=(0,re.inlineUnistylesStyle)({minHeight:h}),t[3]=h,t[4]=p):p=t[4];const x=p;if(0===h)return null;if(!n||!i||!f){let e;return t[5]!==x?(e=(0,fe.jsx)(s.View,{style:x}),t[5]=x,t[6]=e):e=t[6],e}const w=`review-thread-${n.key}`;let y;return t[7]!==h||t[8]!==d||t[9]!==i||t[10]!==n||t[11]!==w||t[12]!==c?(y=(0,fe.jsx)(ue.InlineReviewThread,{reviewTarget:n,reviewActions:i,height:h,viewportWidth:c,pinToViewport:d,testID:w}),t[7]=h,t[8]=d,t[9]=i,t[10]=n,t[11]=w,t[12]=c,t[13]=y):y=t[13],y}function Me(e){const t=(0,l.c)(11),{reviewTarget:n,reviewActions:i,gutterWidth:o,reservedHeight:c,style:d}=e;let u;t[0]!==i||t[1]!==n?(u=(0,ue.getInlineReviewThreadState)({reviewTarget:n,reviewActions:i}),t[0]=i,t[1]=n,t[2]=u):u=t[2];const f=u,h=c??f?.height??0;let p,x;t[3]!==o||t[4]!==h?(p=(0,re.inlineUnistylesStyle)({width:o,minHeight:h}),t[3]=o,t[4]=h,t[5]=p):p=t[5],t[6]!==d||t[7]!==p?(x=[Vt.inlineReviewGutterSpacer,p,d],t[6]=d,t[7]=p,t[8]=x):x=t[8];const w=x;if(0===h)return null;let y;return t[9]!==w?(y=(0,fe.jsx)(s.View,{style:w}),t[9]=w,t[10]=y):y=t[10],y}function Re(e){const t=(0,l.c)(20),{reviewTarget:n,reviewActions:i,gutterWidth:o,reservedHeight:c}=e;let d;t[0]!==i||t[1]!==n?(d=(0,ue.getInlineReviewThreadState)({reviewTarget:n,reviewActions:i}),t[0]=i,t[1]=n,t[2]=d):d=t[2];const u=d,f=c??u?.height??0;let h,p;t[3]!==o?(h=(0,re.inlineUnistylesStyle)({width:o}),t[3]=o,t[4]=h):h=t[4],t[5]!==h?(p=[Vt.inlineReviewGutterSpacer,h],t[5]=h,t[6]=p):p=t[6];const x=p;let w;t[7]!==f?(w=(0,re.inlineUnistylesStyle)({minHeight:f}),t[7]=f,t[8]=w):w=t[8];const y=w;if(0===f)return null;let b,v,S;return t[9]!==x?(b=(0,fe.jsx)(s.View,{style:x}),t[9]=x,t[10]=b):b=t[10],t[11]!==f||t[12]!==y||t[13]!==i||t[14]!==n||t[15]!==u?(v=n&&i&&u?(0,fe.jsx)(ue.InlineReviewThread,{reviewTarget:n,reviewActions:i,height:f,testID:`review-thread-${n.key}`}):(0,fe.jsx)(s.View,{style:y}),t[11]=f,t[12]=y,t[13]=i,t[14]=n,t[15]=u,t[16]=v):v=t[16],t[17]!==b||t[18]!==v?(S=(0,fe.jsxs)(s.View,{style:Vt.inlineReviewRow,children:[b,v]}),t[17]=b,t[18]=v,t[19]=S):S=t[19],S}const We=(0,c.memo)(function(e){const t=(0,l.c)(74),{rows:n,side:i,gutterWidth:d,wrapLines:u,textMetricsStyle:f,reviewActions:h,onLineContextMenu:p,showDivider:x}=e,w=void 0!==x&&x,[y,b]=(0,c.useState)(0),[v,S]=(0,c.useState)(null),k=w&&Vt.splitCellWithDivider;let C;t[0]!==k?(C=[Vt.splitCell,k],t[0]=k,t[1]=C):C=t[1];const T=C,I=w&&Vt.splitCellWithDivider;let j;t[2]!==I?(j=[Vt.splitCell,I,Vt.splitCellRow],t[2]=I,t[3]=j):j=t[3];const _=j;let D,L;t[4]!==y?(D=y>0&&(0,re.inlineUnistylesStyle)({minWidth:y}),t[4]=y,t[5]=D):D=t[5],t[6]!==D?(L=[Vt.linesContainer,D],t[6]=D,t[7]=L):L=t[7];const R=L;let W;t[8]!==f?(W=[Vt.diffTextMetrics,f,Vt.diffLineText,Vt.headerLineText],t[8]=f,t[9]=W):W=t[9];const A=W;let P;t[10]!==n?(P=n.map(qt),t[10]=n,t[11]=P):P=t[11];const z=P;if(u){let e,n,l;if(t[12]!==d||t[13]!==A||t[14]!==z||t[15]!==p||t[16]!==h||t[17]!==i||t[18]!==f||t[19]!==u){let n;t[21]!==d||t[22]!==A||t[23]!==p||t[24]!==h||t[25]!==i||t[26]!==f||t[27]!==u?(n=e=>{const{key:t,row:n}=e;if("header"===n.kind)return(0,fe.jsx)(s.View,{style:Vt.splitHeaderRow,children:(0,fe.jsx)(o.Text,{style:A,children:n.content})},t);const l="left"===i?n.left:n.right,c=(0,ue.getSplitInlineReviewThreadState)({left:n.left?.reviewTarget,right:n.right?.reviewTarget,reviewActions:h});return(0,fe.jsxs)(s.View,{children:[(0,fe.jsx)(De,{line:l,gutterWidth:d,wrapLines:u,textMetricsStyle:f,reviewActions:h,onLineContextMenu:p}),(0,fe.jsx)(Re,{reviewTarget:l?.reviewTarget,reviewActions:h,gutterWidth:d,reservedHeight:c?.height})]},t)},t[21]=d,t[22]=A,t[23]=p,t[24]=h,t[25]=i,t[26]=f,t[27]=u,t[28]=n):n=t[28],e=z.map(n),t[12]=d,t[13]=A,t[14]=z,t[15]=p,t[16]=h,t[17]=i,t[18]=f,t[19]=u,t[20]=e}else e=t[20];return t[29]!==e?(n=(0,fe.jsx)(s.View,{style:Vt.linesContainer,children:e}),t[29]=e,t[30]=n):n=t[30],t[31]!==n||t[32]!==T?(l=(0,fe.jsx)(s.View,{style:T,children:n}),t[31]=n,t[32]=T,t[33]=l):l=t[33],l}let H,E,F,V,B,O;if(t[34]!==d||t[35]!==v||t[36]!==z||t[37]!==h||t[38]!==i||t[39]!==f){let e;t[41]!==d||t[42]!==v||t[43]!==h||t[44]!==i||t[45]!==f?(e=e=>{const{key:t,row:n}=e;if("header"===n.kind)return(0,fe.jsx)(Ce,{lineNumber:null,type:"header",gutterWidth:d,textMetricsStyle:f},t);const o="left"===i?n.left:n.right,l=o?.reviewTarget?.key??null,c=(0,ue.getSplitInlineReviewThreadState)({left:n.left?.reviewTarget,right:n.right?.reviewTarget,reviewActions:h});return(0,fe.jsxs)(s.View,{children:[(0,fe.jsx)(Ce,{lineNumber:o?.lineNumber??null,type:o?.type,gutterWidth:d,textMetricsStyle:f,reviewTarget:o?.reviewTarget,reviewActions:h,isLineHovered:null!==l&&v===l}),(0,fe.jsx)(Me,{reviewTarget:o?.reviewTarget,reviewActions:h,gutterWidth:d,reservedHeight:c?.height})]},t)},t[41]=d,t[42]=v,t[43]=h,t[44]=i,t[45]=f,t[46]=e):e=t[46],H=z.map(e),t[34]=d,t[35]=v,t[36]=z,t[37]=h,t[38]=i,t[39]=f,t[40]=H}else H=t[40];if(t[47]!==H?(E=(0,fe.jsx)(s.View,{style:Vt.gutterColumn,children:H}),t[47]=H,t[48]=E):E=t[48],t[49]!==A||t[50]!==z||t[51]!==p||t[52]!==h||t[53]!==y||t[54]!==i||t[55]!==f){let e;t[57]!==A||t[58]!==p||t[59]!==h||t[60]!==y||t[61]!==i||t[62]!==f?(e=e=>{const{key:t,row:n}=e;if("header"===n.kind)return(0,fe.jsx)(s.View,{style:Vt.splitHeaderRow,children:(0,fe.jsx)(o.Text,{style:A,children:n.content})},t);const l="left"===i?n.left:n.right,c=l?.reviewTarget?.key??null,d=(0,ue.getSplitInlineReviewThreadState)({left:n.left?.reviewTarget,right:n.right?.reviewTarget,reviewActions:h});return(0,fe.jsxs)(s.View,{children:[(0,fe.jsx)(Ie,{line:l,wrapLines:!1,textMetricsStyle:f,reviewActions:h,hoverTargetKey:c,onHoverTargetChange:S,onLineContextMenu:p}),(0,fe.jsx)(Le,{reviewTarget:l?.reviewTarget,reviewActions:h,reservedHeight:d?.height,viewportWidth:y,pinToViewport:!0})]},t)},t[57]=A,t[58]=p,t[59]=h,t[60]=y,t[61]=i,t[62]=f,t[63]=e):e=t[63],F=z.map(e),t[49]=A,t[50]=z,t[51]=p,t[52]=h,t[53]=y,t[54]=i,t[55]=f,t[56]=F}else F=t[56];return t[64]!==R||t[65]!==F?(V=(0,fe.jsx)(s.View,{style:R,children:F}),t[64]=R,t[65]=F,t[66]=V):V=t[66],t[67]!==y||t[68]!==V?(B=(0,fe.jsx)(M.DiffScroll,{scrollViewWidth:y,onScrollViewWidthChange:b,style:Vt.splitColumnScroll,contentContainerStyle:Vt.diffContentInner,children:V}),t[67]=y,t[68]=V,t[69]=B):B=t[69],t[70]!==_||t[71]!==E||t[72]!==B?(O=(0,fe.jsxs)(s.View,{style:_,children:[E,B]}),t[70]=_,t[71]=E,t[72]=B,t[73]=O):O=t[73],O}),Ae=(0,c.memo)(function(e){const t=(0,l.c)(127),{file:i,isExpanded:f,depth:h,ancestorMask:p,showDir:x,selectable:w,selected:y,onToggleSelected:b,onToggle:v,onOpenFile:S,onHeaderHeightChange:j,onShowContextMenu:_,testID:D}=e,L=void 0===h?0:h,M=void 0===p?C.TREE_RAILS_ALL_CONTINUE:p,R=void 0===x||x,W=void 0!==w&&w,A=void 0!==y&&y,{t:P}=(0,d.useTranslation)();let z;t[0]!==i.path||t[1]!==b?(z=e=>{e.stopPropagation?.(),b?.(i.path)},t[0]=i.path,t[1]=b,t[2]=z):z=t[2];const E=z;let F;t[3]!==A?(F={checked:A},t[3]=A,t[4]=F):F=t[4];const V=F,O=(0,c.useRef)(null),U=(0,c.useRef)(!1),G=(0,c.useRef)(null);let N;t[5]!==i.path||t[6]!==v?(N=()=>{U.current=!0,v(i.path)},t[5]=i.path,t[6]=v,t[7]=N):N=t[7];const $=N;let K;t[8]!==i.path||t[9]!==_?(K=e=>{if(!_)return;const t=(0,H.contextMenuAnchorFromEvent)(e);t&&_({path:i.path,x:t.x,y:t.y})},t[8]=i.path,t[9]=_,t[10]=K):K=t[10];const q=K;let X;t[11]!==i.path||t[12]!==S?(X=()=>{S?.(i.path,{edit:!0})},t[11]=i.path,t[12]=S,t[13]=X):X=t[13];const Y=X;let Q;t[14]!==i.path||t[15]!==j?(Q=e=>{O.current=e.nativeEvent.layout.y,j?.(i.path,e.nativeEvent.layout.height)},t[14]=i.path,t[15]=j,t[16]=Q):Q=t[16];const J=Q;let Z;t[17]===Symbol.for("react.memo_cache_sentinel")?(Z=e=>{U.current=!1,G.current={ts:Date.now(),pageX:e.nativeEvent.pageX,pageY:e.nativeEvent.pageY}},t[17]=Z):Z=t[17];const ee=Z;let te;t[18]!==$?(te=e=>{if(ce.isNative&&!U.current&&0===O.current&&G.current){const t=Date.now()-G.current.ts,n=e.nativeEvent.pageX-G.current.pageX,i=e.nativeEvent.pageY-G.current.pageY,o=Math.hypot(n,i);t<=500&&o<=12&&$()}},t[18]=$,t[19]=te):te=t[19];const ne=te,ie=f&&Vt.fileSectionHeaderExpanded;let oe;t[20]!==ie?(oe=[Vt.fileSectionHeaderContainer,ie],t[20]=ie,t[21]=oe):oe=t[21];const se=oe;let le;t[22]!==L?(le=e=>L>0?[he(e),(0,re.inlineUnistylesStyle)({paddingLeft:(0,k.treeRowPaddingLeft)(L)})]:he(e),t[22]=L,t[23]=le):le=t[23];const ae=le;let de,ue,ge,pe,me,xe,we,ye,be,ve,Se,ke,Ce,Te,Ie,je,De,Le,Me,Re,We,Ae,Pe,ze,He,Ee,Fe,Be,Oe,Ue,Ge,Ne,$e,Ke,qe,Xe;return t[24]!==M||t[25]!==V||t[26]!==se||t[27]!==L||t[28]!==i.path||t[29]!==q||t[30]!==Y||t[31]!==J||t[32]!==ne||t[33]!==E||t[34]!==ae||t[35]!==S||t[36]!==_||t[37]!==W||t[38]!==A||t[39]!==P||t[40]!==D||t[41]!==$?(xe=i.path.split("/").pop()??i.path,me=s.View,We=se,Ae=J,Pe=D,t[66]!==M||t[67]!==L?(ze=(0,fe.jsx)(k.TreeIndentGuides,{depth:L,ancestorMask:M}),t[66]=M,t[67]=L,t[68]=ze):ze=t[68],pe=B.Tooltip,Le=300,Me=!0,Re=!1,ge=B.TooltipTrigger,De=!0,ue=n.Pressable,be=D?`${D}-toggle`:void 0,ve=ae,Se=!1,ke=ee,Ce=ne,Te=$,Ie=S?Y:void 0,je=_?q:void 0,de=s.View,we=Vt.fileHeaderLeft,ye=W?(0,fe.jsx)(n.Pressable,{style:A?Ot:Vt.fileCheckbox,onPress:E,accessibilityRole:"checkbox",accessibilityState:V,"aria-checked":A,accessibilityLabel:P("workspace.git.commit.includeFile",{fileName:xe}),hitSlop:6,testID:D?`${D}-checkbox`:void 0,children:A?(0,fe.jsx)(rt,{size:12,uniProps:Ve}):null}):null,t[24]=M,t[25]=V,t[26]=se,t[27]=L,t[28]=i.path,t[29]=q,t[30]=Y,t[31]=J,t[32]=ne,t[33]=E,t[34]=ae,t[35]=S,t[36]=_,t[37]=W,t[38]=A,t[39]=P,t[40]=D,t[41]=$,t[42]=de,t[43]=ue,t[44]=ge,t[45]=pe,t[46]=me,t[47]=xe,t[48]=we,t[49]=ye,t[50]=be,t[51]=ve,t[52]=Se,t[53]=ke,t[54]=Ce,t[55]=Te,t[56]=Ie,t[57]=je,t[58]=De,t[59]=Le,t[60]=Me,t[61]=Re,t[62]=We,t[63]=Ae,t[64]=Pe,t[65]=ze):(de=t[42],ue=t[43],ge=t[44],pe=t[45],me=t[46],xe=t[47],we=t[48],ye=t[49],be=t[50],ve=t[51],Se=t[52],ke=t[53],Ce=t[54],Te=t[55],Ie=t[56],je=t[57],De=t[58],Le=t[59],Me=t[60],Re=t[61],We=t[62],Ae=t[63],Pe=t[64],ze=t[65]),t[69]!==xe||t[70]!==R?(He=R?null:(0,fe.jsx)(s.View,{style:Vt.fileIcon,children:(0,fe.jsx)(T.SvgXml,{xml:(0,I.getFileIconSvg)(xe),width:16,height:16})}),t[69]=xe,t[70]=R,t[71]=He):He=t[71],t[72]!==xe?(Ee=(0,fe.jsx)(o.Text,{style:Vt.fileName,numberOfLines:1,children:xe}),t[72]=xe,t[73]=Ee):Ee=t[73],t[74]!==i.path||t[75]!==R?(Fe=R?(0,fe.jsx)(o.Text,{style:Vt.fileDir,numberOfLines:1,children:i.path.includes("/")?` ${i.path.slice(0,i.path.lastIndexOf("/"))}`:""}):(0,fe.jsx)(s.View,{style:Vt.fileDirSpacer}),t[74]=i.path,t[75]=R,t[76]=Fe):Fe=t[76],t[77]!==i.isNew||t[78]!==P?(Be=i.isNew&&(0,fe.jsx)(s.View,{style:Vt.newBadge,children:(0,fe.jsx)(o.Text,{style:Vt.newBadgeText,children:P("workspace.git.diff.newFile")})}),t[77]=i.isNew,t[78]=P,t[79]=Be):Be=t[79],t[80]!==i.isDeleted||t[81]!==P?(Oe=i.isDeleted&&(0,fe.jsx)(s.View,{style:Vt.deletedBadge,children:(0,fe.jsx)(o.Text,{style:Vt.deletedBadgeText,children:P("workspace.git.diff.deletedFile")})}),t[80]=i.isDeleted,t[81]=P,t[82]=Oe):Oe=t[82],t[83]!==de||t[84]!==we||t[85]!==ye||t[86]!==He||t[87]!==Ee||t[88]!==Fe||t[89]!==Be||t[90]!==Oe?(Ue=(0,fe.jsxs)(de,{style:we,children:[ye,He,Ee,Fe,Be,Oe]}),t[83]=de,t[84]=we,t[85]=ye,t[86]=He,t[87]=Ee,t[88]=Fe,t[89]=Be,t[90]=Oe,t[91]=Ue):Ue=t[91],t[92]!==i.additions||t[93]!==i.deletions?(Ge=(0,fe.jsx)(s.View,{style:Vt.fileHeaderRight,children:(0,fe.jsx)(u.DiffStat,{additions:i.additions,deletions:i.deletions})}),t[92]=i.additions,t[93]=i.deletions,t[94]=Ge):Ge=t[94],t[95]!==ue||t[96]!==be||t[97]!==ve||t[98]!==Se||t[99]!==ke||t[100]!==Ce||t[101]!==Te||t[102]!==Ie||t[103]!==je||t[104]!==Ue||t[105]!==Ge?(Ne=(0,fe.jsxs)(ue,{testID:be,style:ve,cancelable:Se,onPressIn:ke,onPressOut:Ce,onPress:Te,onDoubleClick:Ie,onContextMenu:je,children:[Ue,Ge]}),t[95]=ue,t[96]=be,t[97]=ve,t[98]=Se,t[99]=ke,t[100]=Ce,t[101]=Te,t[102]=Ie,t[103]=je,t[104]=Ue,t[105]=Ge,t[106]=Ne):Ne=t[106],t[107]!==ge||t[108]!==De||t[109]!==Ne?($e=(0,fe.jsx)(ge,{asChild:De,children:Ne}),t[107]=ge,t[108]=De,t[109]=Ne,t[110]=$e):$e=t[110],t[111]!==i.path?(Ke=(0,fe.jsx)(B.TooltipContent,{side:"bottom",align:"start",offset:6,maxWidth:520,children:(0,fe.jsx)(o.Text,{style:Vt.tooltipText,children:i.path})}),t[111]=i.path,t[112]=Ke):Ke=t[112],t[113]!==pe||t[114]!==Le||t[115]!==Me||t[116]!==Re||t[117]!==$e||t[118]!==Ke?(qe=(0,fe.jsxs)(pe,{delayDuration:Le,enabledOnDesktop:Me,enabledOnMobile:Re,children:[$e,Ke]}),t[113]=pe,t[114]=Le,t[115]=Me,t[116]=Re,t[117]=$e,t[118]=Ke,t[119]=qe):qe=t[119],t[120]!==me||t[121]!==We||t[122]!==Ae||t[123]!==Pe||t[124]!==ze||t[125]!==qe?(Xe=(0,fe.jsxs)(me,{style:We,onLayout:Ae,testID:Pe,children:[ze,qe]}),t[120]=me,t[121]=We,t[122]=Ae,t[123]=Pe,t[124]=ze,t[125]=qe,t[126]=Xe):Xe=t[126],Xe}),Pe=2e3;function ze(e){let t=0;for(const n of e.hunks)if(t+=n.lines.length,t>Pe)return!0;return!1}const He=500,Ee=(0,c.memo)(function(e){const t=(0,l.c)(90),{file:n,layout:i,wrapLines:u,codeFontSize:f,textMetricsStyle:h,reviewActions:p,onLineContextMenu:x,onBodyHeightChange:w,testID:y}=e,[b,v]=(0,c.useState)(0),[S,k]=(0,c.useState)(0),[C,T]=(0,c.useState)(null),{t:I}=(0,d.useTranslation)(),j="binary"===n.status;let _;t[0]!==n?(_="too_large"===n.status||ze(n),t[0]=n,t[1]=_):_=t[1];const D=_;let L;e:{if(j||D){L=0;break e}let e=0;if(t[2]!==n.hunks||t[3]!==e){for(const t of n.hunks)e=Math.max(e,t.oldStart+t.oldCount,t.newStart+t.newCount);t[2]=n.hunks,t[3]=e,t[4]=e}else e=t[4];L=e}const R=L,A=(0,U.lineNumberGutterWidth)(R,f);let z;t[5]!==n||t[6]!==j||t[7]!==D||t[8]!==i?(z=j||D||"split"!==i?null:(0,P.buildSplitDiffRows)(n),t[5]=n,t[6]=j,t[7]=D,t[8]=i,t[9]=z):z=t[9];const H=z;let E;t[10]!==n||t[11]!==j||t[12]!==D||t[13]!==i?(E=j||D||"split"===i?null:(0,P.buildUnifiedDiffLines)(n),t[10]=n,t[11]=j,t[12]=D,t[13]=i,t[14]=E):E=t[14];const F=E;let V;t[15]!==n||t[16]!==w?(V=e=>{k(e.nativeEvent.layout.width),w?.(n,e.nativeEvent.layout.height)},t[15]=n,t[16]=w,t[17]=V):V=t[17];const B=V,O=S>0?S:b;let G,N;t[18]!==O?(G=O>0&&(0,re.inlineUnistylesStyle)({minWidth:O}),t[18]=O,t[19]=G):G=t[19],t[20]!==G?(N=[Vt.linesContainer,G],t[20]=G,t[21]=N):N=t[21];const $=N;let K,q;e:{if(j||D){let e,n;t[22]!==j||t[23]!==I?(e=I(j?"workspace.git.diff.binaryFile":"workspace.git.diff.tooLarge"),t[22]=j,t[23]=I,t[24]=e):e=t[24],t[25]!==e?(n=(0,fe.jsx)(s.View,{style:Vt.statusMessageContainer,children:(0,fe.jsx)(o.Text,{style:Vt.statusMessageText,children:e})}),t[25]=e,t[26]=n):n=t[26],K=n;break e}if("split"===i){let e;t[27]!==H?(e=H??[],t[27]=H,t[28]=e):e=t[28];const n=e;let i;t[29]!==A||t[30]!==x||t[31]!==p||t[32]!==n||t[33]!==h||t[34]!==u?(i=(0,fe.jsxs)(s.View,{style:Ut,dataSet:W.CODE_SURFACE_DATASET,children:[(0,fe.jsx)(We,{rows:n,side:"left",gutterWidth:A,wrapLines:u,textMetricsStyle:h,reviewActions:p,onLineContextMenu:x}),(0,fe.jsx)(We,{rows:n,side:"right",gutterWidth:A,wrapLines:u,textMetricsStyle:h,reviewActions:p,onLineContextMenu:x,showDivider:!0})]}),t[29]=A,t[30]=x,t[31]=p,t[32]=n,t[33]=h,t[34]=u,t[35]=i):i=t[35],K=i;break e}let e;t[36]!==F?(e=F??[],t[36]=F,t[37]=e):e=t[37];const n=e;if(u){let e,i;if(t[38]!==n||t[39]!==A||t[40]!==x||t[41]!==p||t[42]!==h||t[43]!==u){let i;t[45]!==A||t[46]!==x||t[47]!==p||t[48]!==h||t[49]!==u?(i=(e,t)=>{const{line:n,lineNumber:i,key:o,reviewTarget:l}=e;return(0,fe.jsxs)(s.View,{testID:`diff-wrapped-row-${t}`,children:[(0,fe.jsx)(je,{line:n,lineNumber:i,gutterWidth:A,wrapLines:u,textMetricsStyle:h,reviewTarget:l,reviewActions:p,onLineContextMenu:x}),(0,fe.jsx)(Re,{reviewTarget:l,reviewActions:p,gutterWidth:A})]},o)},t[45]=A,t[46]=x,t[47]=p,t[48]=h,t[49]=u,t[50]=i):i=t[50],e=n.map(i),t[38]=n,t[39]=A,t[40]=x,t[41]=p,t[42]=h,t[43]=u,t[44]=e}else e=t[44];t[51]!==e?(i=(0,fe.jsx)(s.View,{style:Vt.diffContent,dataSet:W.CODE_SURFACE_DATASET,children:(0,fe.jsx)(s.View,{style:Vt.linesContainer,children:e})}),t[51]=e,t[52]=i):i=t[52],K=i;break e}const l=b>0?b:Math.max(0,S-A);let c,d,f,w,y,k;if(t[53]!==n||t[54]!==A||t[55]!==C||t[56]!==p||t[57]!==h){let e;t[59]!==A||t[60]!==C||t[61]!==p||t[62]!==h?(e=(e,t)=>{const{line:n,lineNumber:i,key:o,reviewTarget:l}=e;return(0,fe.jsxs)(s.View,{testID:`diff-gutter-row-${t}`,children:[(0,fe.jsx)(Ce,{lineNumber:i,type:n.type,gutterWidth:A,textMetricsStyle:h,reviewTarget:l,reviewActions:p,isLineHovered:void 0!==l?.key&&C===l.key,textTestID:`diff-gutter-text-${t}`,actionTestID:`diff-gutter-action-${t}`}),(0,fe.jsx)(Me,{reviewTarget:l,reviewActions:p,gutterWidth:A})]},o)},t[59]=A,t[60]=C,t[61]=p,t[62]=h,t[63]=e):e=t[63],c=n.map(e),t[53]=n,t[54]=A,t[55]=C,t[56]=p,t[57]=h,t[58]=c}else c=t[58];if(t[64]!==c?(d=(0,fe.jsx)(s.View,{style:Vt.gutterColumn,children:c}),t[64]=c,t[65]=d):d=t[65],t[66]!==n||t[67]!==x||t[68]!==p||t[69]!==h||t[70]!==l){let e;t[72]!==x||t[73]!==p||t[74]!==h||t[75]!==l?(e=(e,t)=>{const{line:n,key:i,reviewTarget:o}=e;return(0,fe.jsxs)(s.View,{testID:`diff-code-row-${t}`,children:[(0,fe.jsx)(Te,{line:n,wrapLines:!1,textMetricsStyle:h,reviewTarget:o,reviewActions:p,hoverTargetKey:o?.key??null,onHoverTargetChange:T,onLineContextMenu:x,textTestID:`diff-code-text-${t}`}),(0,fe.jsx)(Le,{reviewTarget:o,reviewActions:p,viewportWidth:l,pinToViewport:!0})]},i)},t[72]=x,t[73]=p,t[74]=h,t[75]=l,t[76]=e):e=t[76],f=n.map(e),t[66]=n,t[67]=x,t[68]=p,t[69]=h,t[70]=l,t[71]=f}else f=t[71];t[77]!==$||t[78]!==f?(w=(0,fe.jsx)(s.View,{style:$,children:f}),t[77]=$,t[78]=f,t[79]=w):w=t[79],t[80]!==b||t[81]!==w?(y=(0,fe.jsx)(M.DiffScroll,{scrollViewWidth:b,onScrollViewWidthChange:v,style:Vt.splitColumnScroll,contentContainerStyle:Vt.diffContentInner,children:w}),t[80]=b,t[81]=w,t[82]=y):y=t[82],t[83]!==d||t[84]!==y?(k=(0,fe.jsxs)(s.View,{style:Gt,dataSet:W.CODE_SURFACE_DATASET,children:[d,y]}),t[83]=d,t[84]=y,t[85]=k):k=t[85],K=k}return t[86]!==B||t[87]!==K||t[88]!==y?(q=(0,fe.jsx)(s.View,{style:Bt,onLayout:B,testID:y,children:K}),t[86]=B,t[87]=K,t[88]=y,t[89]=q):q=t[89],q}),Fe=e=>({color:e.colors.foregroundMuted}),Ve=e=>({color:e.colors.accentForeground}),Be=(0,f.withUnistyles)(i.ActivityIndicator),Oe=(0,f.withUnistyles)(w.AlignJustify),Ue=(0,f.withUnistyles)(w.Columns2),Ge=(0,f.withUnistyles)(w.Pilcrow),Ne=(0,f.withUnistyles)(w.WrapText),$e=(0,f.withUnistyles)(w.ListChevronsDownUp),Ke=(0,f.withUnistyles)(w.ListChevronsUpDown),qe=(0,f.withUnistyles)(w.FolderTree),Xe=(0,f.withUnistyles)(w.List),Ye=(0,f.withUnistyles)(w.GitCommitHorizontal),Qe=(0,f.withUnistyles)(w.Download),Je=(0,f.withUnistyles)(w.Upload),Ze=(0,f.withUnistyles)(w.ArrowDownUp),et=(0,f.withUnistyles)(O.GitHostingIcon),tt=(0,f.withUnistyles)(w.GitMerge),nt=(0,f.withUnistyles)(w.RefreshCcw),it=(0,f.withUnistyles)(w.Archive),ot=(0,f.withUnistyles)(w.ChevronDown),rt=(0,f.withUnistyles)(w.Check),st=(0,f.withUnistyles)(w.SquarePen),lt=(0,f.withUnistyles)(w.Copy),at=(0,f.withUnistyles)(w.Paperclip),ct=(0,fe.jsx)(st,{size:14,uniProps:Fe}),dt=(0,fe.jsx)(lt,{size:14,uniProps:Fe}),ut=(0,fe.jsx)(qe,{size:14,uniProps:Fe}),ft=(0,f.withUnistyles)(w.History),ht=(0,fe.jsx)(ft,{size:14,uniProps:Fe});function gt(e){const t=(0,l.c)(11),{serverId:n,workspaceId:i,request:o}=e,{t:s}=(0,d.useTranslation)();let c;t[0]!==n?(c=e=>!0===e.sessions[n]?.serverInfo?.features?.checkoutGitFileHistory,t[0]=n,t[1]=c):c=t[1];const u=(0,ie.useSessionStore)(c);let f;t[2]!==o||t[3]!==n||t[4]!==i?(f=()=>{o&&i&&(0,te.openFileHistoryTab)({serverId:n,workspaceId:i,path:o.path})},t[2]=o,t[3]=n,t[4]=i,t[5]=f):f=t[5];const h=f;if(!u||!i||!o)return null;let p,x;return t[6]!==s?(p=s("gitFileHistory.open"),t[6]=s,t[7]=p):p=t[7],t[8]!==h||t[9]!==p?(x=(0,fe.jsx)(H.ContextMenuItem,{leading:ht,onSelect:h,testID:"changes-context-menu-git-history",children:p}),t[8]=h,t[9]=p,t[10]=x):x=t[10],x}const pt=(0,fe.jsx)(at,{size:14,uniProps:Fe}),mt=(0,f.withUnistyles)(w.Undo2),xt=(0,fe.jsx)(mt,{size:14,uniProps:e=>({color:e.colors.destructive})}),wt=(0,f.withUnistyles)(w.Trash2),yt=(0,f.withUnistyles)(w.RotateCw),bt=(0,f.withUnistyles)(oe.LoadingSpinner);function vt(e){let t=0;for(const n of e.hunks)t+=n.lines.length;return t}function St(e){let t=0;for(const n of e.hunks)for(const e of n.lines)t+=e.content.length;return t}function kt(e,t,n,i){return e?i.hiddenWhitespace:"uncommitted"===t?i.uncommitted:i.againstBase(n)}function Ct(e){const n=(0,l.c)(24),{isStatusLoading:i,statusErrorMessage:c,notGit:d,isDiffLoading:u,diffErrorMessage:f,hasChanges:h,emptyMessage:p,flatItems:x,stickyHeaderIndices:w,renderFlatItem:y,flatKeyExtractor:b,getFlatItemLayout:v,flatExtraData:S,diffListRef:k,handleDiffListLayout:C,handleDiffListScroll:T,onContentSizeChange:I,showWebScrollbar:j,checkingRepositoryLabel:_,notRepositoryLabel:D}=e;if(i){let e,t;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,fe.jsx)(Be,{size:"large",uniProps:Fe}),n[0]=e):e=n[0],n[1]!==_?(t=(0,fe.jsxs)(s.View,{style:Vt.loadingContainer,children:[e,(0,fe.jsx)(o.Text,{style:Vt.loadingText,children:_})]}),n[1]=_,n[2]=t):t=n[2],t}if(c){let e;return n[3]!==c?(e=(0,fe.jsx)(s.View,{style:Vt.errorContainer,children:(0,fe.jsx)(o.Text,{style:Vt.errorText,children:c})}),n[3]=c,n[4]=e):e=n[4],e}if(d){let e;return n[5]!==D?(e=(0,fe.jsx)(s.View,{style:Vt.emptyContainer,testID:"changes-not-git",children:(0,fe.jsx)(o.Text,{style:Vt.emptyText,children:D})}),n[5]=D,n[6]=e):e=n[6],e}if(u){let e;return n[7]===Symbol.for("react.memo_cache_sentinel")?(e=(0,fe.jsx)(s.View,{style:Vt.loadingContainer,children:(0,fe.jsx)(Be,{size:"large",uniProps:Fe})}),n[7]=e):e=n[7],e}if(f){let e;return n[8]!==f?(e=(0,fe.jsx)(s.View,{style:Vt.errorContainer,children:(0,fe.jsx)(o.Text,{style:Vt.errorText,children:f})}),n[8]=f,n[9]=e):e=n[9],e}if(!h){let e;return n[10]!==p?(e=(0,fe.jsx)(s.View,{style:Vt.emptyContainer,children:(0,fe.jsx)(o.Text,{style:Vt.emptyText,children:p})}),n[10]=p,n[11]=e):e=n[11],e}const L=!j;let M;return n[12]!==k||n[13]!==S||n[14]!==x||n[15]!==b||n[16]!==v||n[17]!==C||n[18]!==T||n[19]!==I||n[20]!==y||n[21]!==w||n[22]!==L?(M=(0,fe.jsx)(t.FlatList,{ref:k,data:x,renderItem:y,keyExtractor:b,getItemLayout:v,stickyHeaderIndices:w,extraData:S,style:Vt.scrollView,contentContainerStyle:Vt.contentContainer,testID:"git-diff-scroll",onLayout:C,onScroll:T,onContentSizeChange:I,scrollEventThrottle:16,showsVerticalScrollIndicator:L,removeClippedSubviews:!1,initialNumToRender:12,maxToRenderPerBatch:12,windowSize:10}),n[12]=k,n[13]=S,n[14]=x,n[15]=b,n[16]=v,n[17]=C,n[18]=T,n[19]=I,n[20]=y,n[21]=w,n[22]=L,n[23]=M):M=n[23],M}function Tt({status:e,isStatusLoading:t,isStatusError:n,statusError:i}){const o=e&&e.isGit?e:null,s=Boolean(o),l=null!==e&&!e.isGit&&!e.error,c=e?.error?.message??(n&&i instanceof Error?i.message:null),d=o?.baseRef??void 0,u=Boolean(o?.isDirty),f=!s||Boolean(e?.error)||t,h=o?.currentBranch&&"HEAD"!==o.currentBranch?o.currentBranch:null;return Object.assign({gitStatus:o,isGit:s,notGit:l,statusErrorMessage:c,baseRef:d,hasUncommittedChanges:u,actionsDisabled:f,currentBranchName:h,isOttoOwnedWorktree:!0===o?.isOttoOwnedWorktree},It(o))}function It(e){return{baseSource:e?.baseSource??null,isBaseEditable:e?.isBaseEditable??null}}function jt(e,t){if(!e)return t;const n=e.replace(/^refs\/(heads|remotes)\//,"").trim();return n.startsWith("origin/")?n.slice(7):n}function _t(e,t){if(e&&t)return e===t?void 0:`${e} -> ${t}`}function Dt(e,t){return e?t?.message??null:null}function Lt(e){return null!=e.lineStart?`${e.path}:${e.lineStart}`:e.path}function Mt({serverId:e,cwd:t,diffMode:n,contextMenuPath:i,selectedPaths:o,commitSelectionEnabled:s}){const{t:l}=(0,d.useTranslation)(),u=(0,ne.useToast)(),f=(0,ie.useSessionStore)(t=>!0===t.sessions[e]?.serverInfo?.features?.checkoutGitRollback),h=(0,Q.useCheckoutGitActionsStore)(e=>e.rollbackPaths),p=(0,c.useCallback)(async(n,i)=>{if(0===n.length)return;if(!await(0,J.confirmDialog)(i))return;const o=async i=>{try{await h(Object.assign({serverId:e,cwd:t,paths:n},i?{allowWithRunningAgents:!0}:{}))}catch(e){if(e instanceof Q.CheckoutGitRollbackFailedError){if("agents_running"===e.rollbackError.kind){const t=e.rollbackError.agents.map(e=>e.title?.trim()||l("workspace.git.rollback.unnamedAgent")).join(", ");return void(await(0,J.confirmDialog)({title:l("workspace.git.rollback.agentsRunningTitle"),message:l("workspace.git.rollback.agentsRunningMessage",{agents:t}),confirmLabel:l("workspace.git.rollback.agentsRunningConfirm"),destructive:!0})&&await o(!0))}const t="git_failed"===e.rollbackError.kind?e.rollbackError.detail:l("workspace.git.rollback.failed");return void u.error(t)}u.error(e instanceof Error?e.message:l("workspace.git.rollback.failed"))}};await o(!1)},[t,h,e,l,u]),x=(0,c.useCallback)(()=>{if(!i)return;const e=i.split("/").pop()??i;p([i],{title:l("workspace.git.rollback.confirmTitleSingle"),message:l("workspace.git.rollback.confirmMessageSingle",{fileName:e}),confirmLabel:l("workspace.git.rollback.confirmButton"),destructive:!0})},[i,p,l]),w=(0,c.useCallback)(()=>{const e=o.length;p(o,{title:l("workspace.git.rollback.confirmTitleMultiple",{count:e}),message:l("workspace.git.rollback.confirmMessageMultiple",{count:e}),confirmLabel:l("workspace.git.rollback.confirmButton"),destructive:!0})},[p,o,l]),y=f&&"uncommitted"===n,b=s?o.length:0;return{canRollbackFile:y,canRollbackSelection:y&&b>1,selectionCount:b,onRollbackFile:x,onRollbackSelected:w}}function Rt(e){const t=(0,l.c)(20),{serverId:n,scopeKey:i,request:o}=e,{t:s}=(0,d.useTranslation)();let c;t[0]!==n?(c=e=>e.sessions[n]?.focusedAgentId??null,t[0]=n,t[1]=c):c=t[1];const u=(0,ie.useSessionStore)(c),f=(0,de.useWorkspaceAttachments)(i);let h;if(t[2]!==f){h=new Set;for(const e of f)"file_context"===e.kind&&h.add(e.id);t[2]=f,t[3]=h}else h=t[3];const p=h;let x;t[4]!==o||t[5]!==i?(x=()=>{if(!o)return;const e=Lt(o),{attachmentsByScope:t,setWorkspaceAttachments:n,addWorkspaceAttachment:s}=de.useWorkspaceAttachmentsStore.getState(),l=t[i]??[],c=l.filter(t=>!("file_context"===t.kind&&t.id===e));c.length===l.length?s({scopeKey:i,attachment:{kind:"file_context",id:e,path:o.path,lineStart:o.lineStart}}):n({scopeKey:i,attachments:c})},t[4]=o,t[5]=i,t[6]=x):x=t[6];const w=x;if(!u||!o)return null;let y;t[7]!==o?(y=Lt(o),t[7]=o,t[8]=y):y=t[8];const b=p.has(y);let v,S;if(null!=o.lineStart){let e;t[9]!==b||t[10]!==o.lineStart||t[11]!==s?(e=s(b?"projectSearch.removeLineFromContext":"projectSearch.addLineToContext",{line:o.lineStart}),t[9]=b,t[10]=o.lineStart,t[11]=s,t[12]=e):e=t[12],v=e}else{let e;t[13]!==b||t[14]!==s?(e=s(b?"workspace.fileExplorer.context.removeFromContext":"workspace.fileExplorer.context.addToContext"),t[13]=b,t[14]=s,t[15]=e):e=t[15],v=e}return t[16]!==b||t[17]!==v||t[18]!==w?(S={isInContext:b,label:v,onToggle:w},t[16]=b,t[17]=v,t[18]=w,t[19]=S):S=t[19],S}function Wt(e){const t=(0,l.c)(14),{rollback:n}=e,{t:i}=(0,d.useTranslation)();if(!n.canRollbackFile)return null;let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,fe.jsx)(H.ContextMenuSeparator,{}),t[0]=o):o=t[0];const s=n.onRollbackFile;let c,u,f,h;return t[1]!==i?(c=i("workspace.git.rollback.fileAction"),t[1]=i,t[2]=c):c=t[2],t[3]!==n.onRollbackFile||t[4]!==c?(u=(0,fe.jsx)(H.ContextMenuItem,{leading:xt,destructive:!0,onSelect:s,testID:"changes-context-menu-rollback-file",children:c}),t[3]=n.onRollbackFile,t[4]=c,t[5]=u):u=t[5],t[6]!==n.canRollbackSelection||t[7]!==n.onRollbackSelected||t[8]!==n.selectionCount||t[9]!==i?(f=n.canRollbackSelection?(0,fe.jsx)(H.ContextMenuItem,{leading:xt,destructive:!0,onSelect:n.onRollbackSelected,testID:"changes-context-menu-rollback-selected",children:i("workspace.git.rollback.filesAction",{count:n.selectionCount})}):null,t[6]=n.canRollbackSelection,t[7]=n.onRollbackSelected,t[8]=n.selectionCount,t[9]=i,t[10]=f):f=t[10],t[11]!==u||t[12]!==f?(h=(0,fe.jsxs)(fe.Fragment,{children:[o,u,f]}),t[11]=u,t[12]=f,t[13]=h):h=t[13],h}function At(e){const t=(0,l.c)(4),{toggle:n}=e;if(!n)return null;const i=n.isInContext?"changes-context-menu-remove-from-context":"changes-context-menu-add-to-context";let o;return t[0]!==i||t[1]!==n.label||t[2]!==n.onToggle?(o=(0,fe.jsx)(H.ContextMenuItem,{leading:pt,onSelect:n.onToggle,testID:i,children:n.label}),t[0]=i,t[1]=n.label,t[2]=n.onToggle,t[3]=o):o=t[3],o}function Pt(e,t){switch(e.kind){case"identity_missing":return{title:t("workspace.git.commit.errorIdentity"),detail:null};case"hook_failed":return{title:t("workspace.git.commit.errorHook"),detail:e.output.trim()||null};case"signing_failed":return{title:t("workspace.git.commit.errorSigning"),detail:e.detail.trim()||null};case"nothing_to_commit":return{title:t("workspace.git.commit.errorNothingToCommit"),detail:null};case"git_failed":return{title:t("workspace.git.commit.errorGitFailed"),detail:e.detail.trim()||null};case"agents_running":return{title:t("workspace.git.commit.errorGitFailed"),detail:null}}}function zt(e){const t=(0,l.c)(16),{serverId:n,workspaceId:i,enabled:s}=e,{t:c}=(0,d.useTranslation)(),u=(0,h.useIconSize)(2).sm;let f;t[0]!==n||t[1]!==i?(f=()=>{i&&(0,ee.openGitLogTab)({serverId:n,workspaceId:i,operation:"commit"})},t[0]=n,t[1]=i,t[2]=f):f=t[2];const p=f;if(!s||!i)return null;let x,y,b,v,S;return t[3]!==c?(x=c("workspace.git.commit.viewLog"),t[3]=c,t[4]=x):x=t[4],t[5]!==p||t[6]!==u||t[7]!==x?(y=(0,fe.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,fe.jsx)(Z.Button,{size:"sm",variant:"ghost",leftIcon:w.SquareTerminal,iconSize:u,onPress:p,accessibilityLabel:x,testID:"changes-commit-log-button"})}),t[5]=p,t[6]=u,t[7]=x,t[8]=y):y=t[8],t[9]!==c?(b=c("workspace.git.commit.viewLog"),t[9]=c,t[10]=b):b=t[10],t[11]!==b?(v=(0,fe.jsx)(B.TooltipContent,{side:"top",align:"end",offset:6,children:(0,fe.jsx)(o.Text,{style:Vt.tooltipText,children:b})}),t[11]=b,t[12]=v):v=t[12],t[13]!==y||t[14]!==v?(S=(0,fe.jsxs)(B.Tooltip,{delayDuration:300,enabledOnDesktop:!0,enabledOnMobile:!1,children:[y,v]}),t[13]=y,t[14]=v,t[15]=S):S=t[15],S}function Ht({serverId:t,cwd:i,workspaceId:l,selectedPaths:u,totalFiles:f,commitSupported:h,logSupported:p,isGit:x,diffMode:w,hasChanges:y,onToggleSelectAll:b,onCommitted:v}){const{t:S}=(0,d.useTranslation)(),k=(0,ne.useToast)(),[C,T]=(0,c.useState)(""),[I,j]=(0,c.useState)(!1),[_,D]=(0,c.useState)(null),L=(0,Q.useCheckoutGitActionsStore)(e=>e.commitPaths),M="pending"===(0,Q.useCheckoutGitActionsStore)(e=>e.getStatus({serverId:t,cwd:i,actionId:"commit"})),R=(0,c.useCallback)(()=>j(!0),[]),W=(0,c.useCallback)(()=>j(!1),[]),A=(0,c.useMemo)(()=>[Vt.commitInput,I&&Vt.commitInputFocused],[I]),P=(0,c.useCallback)(async()=>{const e=C.trim();if(!e||0===u.length||M)return;D(null);const n=async o=>{try{await L(Object.assign({serverId:t,cwd:i,message:e,paths:u},o?{allowWithRunningAgents:!0}:{})),T(""),v()}catch(e){if(e instanceof Q.CheckoutGitCommitFailedError){if("agents_running"===e.commitError.kind){const t=e.commitError.agents.map(e=>e.title?.trim()||S("workspace.git.commit.unnamedAgent")).join(", ");return void(await(0,J.confirmDialog)({title:S("workspace.git.commit.agentsRunningTitle"),message:S("workspace.git.commit.agentsRunningMessage",{agents:t}),confirmLabel:S("workspace.git.commit.agentsRunningConfirm")})&&await n(!0))}return void D(e.commitError)}k.error(e instanceof Error?e.message:S("workspace.git.commit.errorGitFailed"))}};await n(!1)},[L,i,M,C,v,u,t,S,k]),z=f>0&&u.length===f,H=u.length>0&&!z,E=(0,c.useMemo)(()=>({checked:H?"mixed":z}),[z,H]);if(!x||"uncommitted"!==w||!y)return null;if(!h)return(0,fe.jsx)(s.View,{style:Vt.commitSection,testID:"changes-commit-section",children:(0,fe.jsx)(o.Text,{style:Vt.commitUnsupportedText,children:S("workspace.git.commit.updateHost")})});const F=0===C.trim().length||0===u.length||M,V=_?Pt(_,S):null;let B=null;return H?B=(0,fe.jsx)(s.View,{style:Vt.fileCheckboxIndeterminateMark}):z&&(B=(0,fe.jsx)(rt,{size:12,uniProps:Ve})),(0,fe.jsxs)(s.View,{style:Vt.commitSection,testID:"changes-commit-section",children:[(0,fe.jsx)(e.TextInput,{multiline:!0,value:C,onChangeText:T,onFocus:R,onBlur:W,editable:!M,placeholder:S("workspace.git.commit.messagePlaceholder"),placeholderTextColor:Vt.commitPlaceholderColor.color,accessibilityLabel:S("workspace.git.commit.messagePlaceholder"),style:A,testID:"changes-commit-message"}),(0,fe.jsxs)(s.View,{style:Vt.commitActions,children:[(0,fe.jsxs)(s.View,{style:Vt.commitSelectionGroup,children:[(0,fe.jsx)(n.Pressable,{style:z||H?Ot:Vt.fileCheckbox,onPress:b,accessibilityRole:"checkbox",accessibilityState:E,"aria-checked":H?"mixed":z,accessibilityLabel:S(z?"workspace.git.commit.deselectAllFiles":"workspace.git.commit.selectAllFiles"),hitSlop:6,testID:"changes-commit-select-all",children:B}),(0,fe.jsx)(o.Text,{style:Vt.commitSelectionCount,numberOfLines:1,children:S("workspace.git.commit.filesSelected",{selected:u.length,total:f})})]}),(0,fe.jsxs)(s.View,{style:Vt.commitButtonGroup,children:[(0,fe.jsx)(zt,{serverId:t,workspaceId:l,enabled:p}),(0,fe.jsx)(Z.Button,{size:"sm",variant:"default",disabled:F,onPress:P,testID:"changes-commit-button",children:S(M?"workspace.git.commit.committing":"workspace.git.commit.button")})]})]}),V?(0,fe.jsx)(o.Text,{style:Vt.commitErrorText,testID:"changes-commit-error",children:V.title}):null,V?.detail?(0,fe.jsx)(o.Text,{style:Vt.commitErrorDetail,testID:"changes-commit-error-detail",children:V.detail}):null]})}const Et=new Set;function Ft(e,t){return t?e+2:e}const Vt=f.StyleSheet.create(e=>({container:{flex:1,minHeight:0},header:{flexDirection:"row",alignItems:"center",gap:e.spacing[2],paddingHorizontal:e.spacing[3],height:{xs:46,md:p.WORKSPACE_SECONDARY_HEADER_HEIGHT},borderBottomWidth:1,borderBottomColor:e.colors.border,uni__dependencies:[0]},headerBranchArea:{flex:1,minWidth:0,flexDirection:"row",justifyContent:"center"},diffStatusContainer:{height:x.PANE_TOOLBAR_HEIGHT,borderBottomWidth:1,borderBottomColor:e.colors.border,uni__dependencies:[0]},diffStatusInner:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingRight:e.spacing[3],uni__dependencies:[0]},diffStatusLeading:{flexDirection:"row",alignItems:"center",gap:e.spacing[1],flexShrink:1,minWidth:0,uni__dependencies:[0]},diffModeTrigger:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:e.spacing[1],marginLeft:e.spacing[3]-e.spacing[1],paddingHorizontal:e.spacing[1],height:{xs:28,sm:28,md:24},borderRadius:e.borderRadius.base,flexShrink:0,uni__dependencies:[0]},diffModeTriggerHovered:{backgroundColor:e.colors.surfaceHover,uni__dependencies:[0]},diffModeTriggerPressed:{backgroundColor:e.colors.surface2,uni__dependencies:[0]},diffStatusRowHovered:{backgroundColor:e.colors.surface2,uni__dependencies:[0]},diffStatusText:{fontSize:{xs:e.fontSize.xs+2,md:e.fontSize.xs},lineHeight:{xs:1.25*(e.fontSize.xs+2),md:1.25*e.fontSize.xs},color:e.colors.foregroundMuted,uni__dependencies:[0]},diffStatusIconHidden:{opacity:0},actionErrorText:{paddingHorizontal:e.spacing[3],paddingBottom:e.spacing[1],fontSize:e.fontSize.xs,color:e.colors.destructive,uni__dependencies:[0]},diffContainer:{flex:1,minHeight:0,position:"relative"},scrollView:{flex:1},contentContainer:{paddingBottom:e.spacing[8],uni__dependencies:[0]},loadingContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingTop:e.spacing[16],gap:e.spacing[4],uni__dependencies:[0]},loadingText:{fontSize:e.fontSize.base,color:e.colors.foregroundMuted,uni__dependencies:[0]},errorContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingTop:e.spacing[16],paddingHorizontal:e.spacing[6],uni__dependencies:[0]},errorText:{fontSize:e.fontSize.base,color:e.colors.destructive,textAlign:"center",uni__dependencies:[0]},emptyContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingTop:e.spacing[16],uni__dependencies:[0]},emptyText:{fontSize:e.fontSize.lg,color:e.colors.foregroundMuted,uni__dependencies:[0]},fileSection:{overflow:"hidden",backgroundColor:e.colors.surface2,borderBottomWidth:1,borderBottomColor:e.colors.border,uni__dependencies:[0]},fileSectionHeaderContainer:{overflow:"hidden"},fileSectionHeaderExpanded:{backgroundColor:e.colors.surface1,uni__dependencies:[0]},fileSectionBodyContainer:{overflow:"hidden",backgroundColor:e.colors.surface2,uni__dependencies:[0]},fileSectionBorder:{borderBottomWidth:1,borderBottomColor:e.colors.border,uni__dependencies:[0]},fileHeader:{flexDirection:"row",alignItems:"center",paddingLeft:10,paddingRight:e.spacing[2],paddingVertical:e.spacing[2],gap:e.spacing[1],minWidth:0,zIndex:2,elevation:2,uni__dependencies:[0]},fileHeaderPressed:{opacity:.7},fileHeaderLeft:{flexDirection:"row",alignItems:"center",gap:e.spacing[1],flex:1,minWidth:0,uni__dependencies:[0]},fileHeaderRight:{flexDirection:"row",alignItems:"center",gap:e.spacing[1],flexShrink:0,uni__dependencies:[0]},fileIcon:{flexShrink:0,alignItems:"center",justifyContent:"center"},fileCheckbox:{width:16,height:16,flexShrink:0,borderRadius:e.borderRadius.sm,borderWidth:1,borderColor:e.colors.foregroundMuted,alignItems:"center",justifyContent:"center",marginRight:e.spacing[1],uni__dependencies:[0]},fileCheckboxChecked:{backgroundColor:e.colors.accent,borderColor:e.colors.accent,uni__dependencies:[0]},fileCheckboxIndeterminateMark:{width:8,height:2,borderRadius:1,backgroundColor:e.colors.accentForeground,uni__dependencies:[0]},commitSection:{borderTopWidth:1,borderTopColor:e.colors.border,paddingLeft:9,paddingRight:10,paddingVertical:e.spacing[2],gap:e.spacing[2],uni__dependencies:[0]},commitInput:Object.assign({minHeight:56,maxHeight:120,color:e.colors.foreground,backgroundColor:e.colors.surface1,borderWidth:e.borderWidth[1],borderColor:e.colors.border,borderRadius:e.borderRadius.md,paddingHorizontal:e.spacing[3],paddingVertical:e.spacing[2],fontSize:{xs:e.fontSize.sm+2,md:e.fontSize.sm},lineHeight:{xs:1.4*(e.fontSize.sm+2),md:1.4*e.fontSize.sm},textAlignVertical:"top"},ce.isWeb?{outlineWidth:0,outlineColor:"transparent"}:{},{uni__dependencies:[0]}),commitInputFocused:{borderColor:e.colors.accent,uni__dependencies:[0]},commitPlaceholderColor:{color:e.colors.foregroundMuted,uni__dependencies:[0]},commitActions:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:e.spacing[2],uni__dependencies:[0]},commitSelectionGroup:{flexDirection:"row",alignItems:"center",gap:e.spacing[1],flexShrink:1,minWidth:0,uni__dependencies:[0]},commitSelectionCount:{color:e.colors.foregroundMuted,fontSize:{xs:e.fontSize.xs+2,md:e.fontSize.xs},flexShrink:1,uni__dependencies:[0]},commitButtonGroup:{flexDirection:"row",alignItems:"center",gap:e.spacing[1],uni__dependencies:[0]},commitUnsupportedText:{color:e.colors.foregroundMuted,fontSize:e.fontSize.xs,uni__dependencies:[0]},commitErrorText:{color:e.colors.palette.red[300],fontSize:e.fontSize.xs,lineHeight:1.4*e.fontSize.xs,uni__dependencies:[0]},commitErrorDetail:{color:e.colors.foregroundMuted,backgroundColor:e.colors.surface1,borderRadius:e.borderRadius.sm,paddingHorizontal:e.spacing[2],paddingVertical:e.spacing[1],fontSize:e.fontSize.xs,lineHeight:1.5*e.fontSize.xs,fontFamily:e.fontFamily.mono,uni__dependencies:[0]},fileName:{fontSize:{xs:e.fontSize.sm+2,md:e.fontSize.sm},fontWeight:e.fontWeight.normal,color:e.colors.foreground,flexShrink:1,minWidth:0,uni__dependencies:[0]},fileDir:{fontSize:{xs:e.fontSize.sm+2,md:e.fontSize.sm},fontWeight:e.fontWeight.normal,color:e.colors.foregroundMuted,flex:1,minWidth:0,uni__dependencies:[0]},fileDirSpacer:{flex:1,minWidth:0},newBadge:{backgroundColor:"rgba(46, 160, 67, 0.2)",paddingHorizontal:e.spacing[2],paddingVertical:e.spacing[1],borderRadius:e.borderRadius.md,flexShrink:0,uni__dependencies:[0]},newBadgeText:{fontSize:e.fontSize.xs,fontWeight:e.fontWeight.normal,color:e.colors.diffAddition,uni__dependencies:[0]},deletedBadge:{backgroundColor:"rgba(248, 81, 73, 0.2)",paddingHorizontal:e.spacing[2],paddingVertical:e.spacing[1],borderRadius:e.borderRadius.md,flexShrink:0,uni__dependencies:[0]},deletedBadgeText:{fontSize:e.fontSize.xs,fontWeight:e.fontWeight.normal,color:e.colors.diffDeletion,uni__dependencies:[0]},additions:{fontSize:e.fontSize.xs,fontWeight:e.fontWeight.normal,color:e.colors.diffAddition,uni__dependencies:[0]},deletions:{fontSize:e.fontSize.xs,fontWeight:e.fontWeight.normal,color:e.colors.diffDeletion,uni__dependencies:[0]},diffContent:{borderTopWidth:e.borderWidth[1],borderTopColor:e.colors.border,backgroundColor:e.colors.surface1,uni__dependencies:[0]},diffContentRow:{flexDirection:"row",alignItems:"stretch"},diffContentInner:{flexDirection:"column"},linesContainer:{backgroundColor:e.colors.surface1,uni__dependencies:[0]},gutterColumn:{backgroundColor:e.colors.surface1,zIndex:4,elevation:4,overflow:"visible",uni__dependencies:[0]},gutterCell:{borderRightWidth:e.borderWidth[1],borderRightColor:e.colors.border,justifyContent:"flex-start",zIndex:4,elevation:4,overflow:"visible",uni__dependencies:[0]},inlineReviewRow:{flexDirection:"row",alignItems:"stretch",backgroundColor:e.colors.surface1,uni__dependencies:[0]},inlineReviewGutterSpacer:{borderRightWidth:e.borderWidth[1],borderRightColor:e.colors.border,backgroundColor:e.colors.surface1,flexShrink:0,uni__dependencies:[0]},textLineContainer:{flexDirection:"row",alignItems:"stretch",paddingLeft:e.spacing[2],uni__dependencies:[0]},splitRow:{flexDirection:"row",alignItems:"stretch"},splitColumnScroll:{flex:1},splitHeaderRow:{backgroundColor:e.colors.surface2,paddingHorizontal:e.spacing[3],uni__dependencies:[0]},splitCell:{flex:1,flexBasis:0,backgroundColor:e.colors.surface2,uni__dependencies:[0]},splitCellRow:{flexDirection:"row",alignItems:"stretch"},emptySplitCell:{backgroundColor:e.colors.surfaceDiffEmpty,uni__dependencies:[0]},splitCellWithDivider:{borderLeftWidth:e.borderWidth[1],borderLeftColor:e.colors.border,uni__dependencies:[0]},diffLineContainer:{flexDirection:"row",alignItems:"stretch",overflow:"visible"},lineNumberGutter:{borderRightWidth:e.borderWidth[1],borderRightColor:e.colors.border,marginRight:e.spacing[2],alignSelf:"stretch",justifyContent:"flex-start",zIndex:4,elevation:4,overflow:"visible",uni__dependencies:[0]},diffTextMetrics:{fontSize:e.fontSize.code,lineHeight:e.lineHeight.diff,fontFamily:e.fontFamily.mono,uni__dependencies:[0]},lineNumberText:{width:"100%",textAlign:"right",paddingRight:e.spacing[2],color:e.colors.foregroundMuted,userSelect:"none",uni__dependencies:[0]},addLineNumberText:{color:e.colors.diffAddition,uni__dependencies:[0]},removeLineNumberText:{color:e.colors.diffDeletion,uni__dependencies:[0]},diffLineText:{flex:1,paddingRight:e.spacing[3],color:e.colors.foreground,userSelect:"text",uni__dependencies:[0]},addLineContainer:{backgroundColor:"rgba(46, 160, 67, 0.15)"},addLineText:{color:e.colors.foreground,uni__dependencies:[0]},removeLineContainer:{backgroundColor:"rgba(248, 81, 73, 0.1)"},removeLineText:{color:e.colors.foreground,uni__dependencies:[0]},headerLineContainer:{backgroundColor:e.colors.surface2,uni__dependencies:[0]},headerLineText:{color:e.colors.foregroundMuted,uni__dependencies:[0]},contextLineContainer:{backgroundColor:e.colors.surface1,uni__dependencies:[0]},contextLineText:{color:e.colors.foregroundMuted,uni__dependencies:[0]},emptySplitCellText:{color:"transparent"},statusMessageContainer:{borderTopWidth:e.borderWidth[1],borderTopColor:e.colors.border,backgroundColor:e.colors.surface1,paddingHorizontal:e.spacing[3],paddingVertical:e.spacing[4],uni__dependencies:[0]},statusMessageText:{fontSize:e.fontSize.sm,color:e.colors.foregroundMuted,fontStyle:"italic",uni__dependencies:[0]},tooltipText:{fontSize:e.fontSize.xs,color:e.colors.foreground,uni__dependencies:[0]}})),Bt=[Vt.fileSectionBodyContainer,Vt.fileSectionBorder],Ot=[Vt.fileCheckbox,Vt.fileCheckboxChecked],Ut=[Vt.diffContent,Vt.splitRow],Gt=[Vt.diffContent,Vt.diffContentRow],Nt=.5;function $t(e,t){return{key:`${t}-${e.text}`,token:e}}function Kt(e){const{key:t,token:n}=e;return(0,fe.jsx)(xe,{token:n},t)}function qt(e,t){return{key:`row-${t}`,row:e}}},4042,[724,540,1692,3639,721,360,306,36,1093,3779,146,234,1054,1069,144,725,56,305,347,3591,1120,4043,4044,4046,4047,4049,4045,1121,4050,3858,3859,4051,1014,4054,3969,3968,4055,3514,3722,3819,3771,4056,4057,3691,3839,4058,3595,3854,4059,4053,4060,4063,3855,3857,3663,3662,4065,4066,1024,3351,3638,3597,1145,4067,4069,348,3565,4070,279]);
15693
15693
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useCheckoutDiffQuery=function(f){const l=(0,o.c)(35),{serverId:p,cwd:h,mode:b,baseRef:y,ignoreWhitespace:R,enabled:W,queryScope:v}=f,_=void 0===W||W,k=(0,n.useHostRuntimeIsConnected)(p);let D;l[0]!==y||l[1]!==R||l[2]!==b?(D=u({mode:b,baseRef:y,ignoreWhitespace:R}),l[0]=y,l[1]=R,l[2]=b,l[3]=D):D=l[3];const I=D,E=I.mode,L=I.baseRef,O=I.ignoreWhitespace;let Q;if(l[4]!==L||l[5]!==O||l[6]!==E||l[7]!==h||l[8]!==v||l[9]!==p){const o=(0,c.checkoutDiffQueryKey)(p,h,E,L,O);let t;l[11]!==v?(t=v?.trim(),l[11]=v,l[12]=t):t=l[12];const s=t;Q=s?[...o,"scope",s]:o,l[4]=L,l[5]=O,l[6]=E,l[7]=h,l[8]=v,l[9]=p,l[10]=Q}else Q=l[10];const j=Q;let q;l[13]!==j?(q=JSON.stringify(j),l[13]=j,l[14]=q):q=l[14];const w=`checkoutDiff:${q}`,B=Boolean(_&&k&&h);let C,K;l[15]!==L||l[16]!==O||l[17]!==E||l[18]!==h||l[19]!==B||l[20]!==p||l[21]!==w?(C=(0,s.checkoutDiffPushRoute)({enabled:B,serverId:p,subscriptionId:w,cwd:h,compare:Object.assign({mode:E},L?{baseRef:L}:{},{ignoreWhitespace:O})}),l[15]=L,l[16]=O,l[17]=E,l[18]=h,l[19]=B,l[20]=p,l[21]=w,l[22]=C):C=l[22];l[23]!==j||l[24]!==B||l[25]!==C?(K={queryKey:j,enabled:B,pushEvent:"checkout_diff_update",meta:C},l[23]=j,l[24]=B,l[25]=C,l[26]=K):K=l[26];const P=(0,t.useReplicaQuery)(K).data??null,S=P?.error??null;let T;l[27]!==P?.files?(T=P?.files??[],l[27]=P?.files,l[28]=T):T=l[28];const F=!0===P?.diffTooLarge,H=null===P&&_&&k,J=Boolean(S);let M;l[29]!==S||l[30]!==J||l[31]!==T||l[32]!==F||l[33]!==H?(M={files:T,payloadError:S,diffTooLarge:F,isLoading:H,isFetching:!1,isError:J,error:null},l[29]=S,l[30]=J,l[31]=T,l[32]=F,l[33]=H,l[34]=M):M=l[34];return M};var o=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),n=r(d[4]),c=r(d[5]);function u(o){const t=!0===o.ignoreWhitespace;if("uncommitted"===o.mode)return{mode:"uncommitted",ignoreWhitespace:t};const s=o.baseRef?.trim();return s?{mode:"base",baseRef:s,ignoreWhitespace:t}:{mode:"base",ignoreWhitespace:t}}},4043,[306,36,3686,3509,3448,3507]);
15694
15694
  __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.buildDiffFlatItems=function({files:i,viewMode:n,collapsedFolders:o,expandedPaths:l,tree:f}){const h=[],p=[],c=(t,s,i,n)=>{const o=l.has(t.path);h.push({type:"header",file:t,fileIndex:s,isExpanded:o,depth:i,ancestorMask:n}),o&&(p.push(h.length-1),h.push({type:"body",file:t,fileIndex:s,depth:i}))};if("flat"===n){for(const[s,n]of i.entries())c(n,s,0,t.TREE_RAILS_ALL_CONTINUE);return{items:h,stickyHeaderIndices:p}}const u=new Map(i.map((t,s)=>[t.path,s])),y=f??(0,s.compressSingleChildChains)((0,s.buildDiffTree)(i)),M=(0,s.flattenDiffTree)(y,o);for(const t of M){if("folder"===t.kind){h.push({type:"folder",dirPath:t.dirPath,displayName:t.displayName,depth:t.depth,ancestorMask:t.ancestorMask,collapsed:o.has(t.dirPath),additions:t.additions,deletions:t.deletions});continue}const s=u.get(t.file.path);void 0!==s&&c(t.file,s,t.depth,t.ancestorMask)}return{items:h,stickyHeaderIndices:p}},e.sumHeightsBefore=function(t,s,i){let n=0;const o=Math.min(s,t.length);for(let s=0;s<o;s++)n+=i(t[s]);return Math.max(0,n)};var t=r(d[0]),s=r(d[1])},4044,[4045,4046]);
15695
15695
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TREE_RAILS_ALL_CONTINUE",{enumerable:!0,get:function(){return t}}),e.withTreeRail=function(t,u,o){if(u<1||u>n)return t;const c=1<<u;return o?t|c:t&~c},e.treeRailContinuesAt=function(t,u){if(u<1||u>n)return!0;return!!(t&1<<u)};const t=-1,n=30},4045,[]);
@@ -15864,7 +15864,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v
15864
15864
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_INPUT_HEIGHT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_MAX_INPUT_HEIGHT",{enumerable:!0,get:function(){return n}}),e.resolveMaxInputHeight=function(f){const{viewportHeight:s,isCompact:_}=f;if(!Number.isFinite(s)||s<=0)return n;const b=_?u:o,l=Math.floor(s*b)-c;return Math.max(t,l)};const t=32,n=160,o=.5,u=.4,c=68},4214,[]);
15865
15865
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.resolveSubmitAccessibilityLabel=function(t){return t.submitButtonAccessibilityLabel?t.submitButtonAccessibilityLabel:t.canPressLoadingButton?t.t("composer.input.interruptAgent"):t.defaultActionQueues?t.t("composer.input.queueMessage"):t.isAgentRunning?t.t("composer.input.sendAndInterrupt"):t.t("composer.input.sendMessage")},e.resolveVoiceAccessibilityLabel=function(t){if(t.isRealtimeVoiceForCurrentAgent)return t.isMuted?t.t("composer.voice.unmuteVoiceMode"):t.t("composer.voice.muteVoiceMode");return t.isDictating?t.t("composer.voice.stopDictation"):t.t("composer.voice.startDictation")},e.resolveVoiceTooltipText=function(t){if(t.isRealtimeVoiceForCurrentAgent)return t.isMuted?t.t("composer.voice.unmuteVoice"):t.t("composer.voice.muteVoice");return t.t("composer.voice.dictation")},e.resolveSendTooltipLabel=function(t){return t.submitButtonAccessibilityLabel?t.submitButtonAccessibilityLabel:t.defaultActionQueues?t.t("composer.input.queue"):t.t("composer.input.send")}},4215,[]);
15866
15866
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.resolveComposerSurfacePresentation=function(o){return o?t:n},e.computeCanStartDictation=function(n){const t=n.client?.isConnected??!1,o=n.isReadyForDictation??t;return t&&o&&!n.disabled&&!n.dictationUnavailableMessage},e.runDefaultSendAction=function(n){if("queue"===n.defaultSendBehavior&&n.isAgentRunning&&n.onQueue)return void n.handleQueueMessage();n.handleSendMessage()},e.runAlternateSendAction=function(n){if("queue"===n.defaultSendBehavior)return void n.handleSendMessage();n.isAgentRunning&&n.onQueue&&n.handleQueueMessage()},e.runMessageInputKeyboardAction=function(n,t){if("focus"===n)return t.focusInput(),!0;if("send"===n||"dictation-confirm"===n)return!!t.isDictationRecording()&&(t.markTranscriptForSend(),t.confirmDictation(),!0);if("voice-toggle"===n)return t.toggleRealtimeVoice(),!0;if("voice-mute-toggle"===n)return t.isRealtimeVoiceActive&&t.toggleRealtimeVoiceMute(),!0;if("dictation-cancel"===n)return!!t.isDictationRecording()&&(t.cancelDictation(),!0);if("dictation-toggle"===n)return t.isDictationRecording()?(t.markTranscriptForSend(),t.confirmDictation()):t.startDictation(),!0;return!1},e.stopRealtimeVoice=async function(n){if(!n.voice||!n.isRealtimeVoiceForCurrentAgent)return;if(n.isAgentRunning){if(!n.client||!n.voiceAgentId)throw new Error("Cannot stop the running voice agent while the host is unavailable");await n.client.cancelAgent(n.voiceAgentId)}await n.voice.stopVoice()};const n={input:{opacity:1,pointerEvents:"auto"},overlay:{opacity:0,pointerEvents:"none"}},t={input:{opacity:0,pointerEvents:"none"},overlay:{opacity:1,pointerEvents:"auto"}}},4216,[]);
15867
- __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useComposerQueue=function(w){const{serverId:S,agentId:M,client:C,encodeImages:p}=w,q=(0,o.useHostFeature)(S,"steerQueue"),I=(0,o.useHostFeature)(S,"steerQueueReorder"),y=(0,c.useSessionStore)(t=>t.setQueuedMessages),v=(0,c.useSessionStore)((0,s.useShallow)(t=>t.sessions[S]?.queuedMessages?.get(M)??l)),b=(0,c.useSessionStore)((0,s.useShallow)(t=>t.sessions[S]?.agents?.get(M)?.queuedMessages??void 0)),x=(0,t.useRef)(new Map),Q=(0,t.useRef)(new Set),k=(0,t.useCallback)(async()=>{for(;Q.current.size>0;)await Promise.all(Q.current)},[]),A=(0,t.useMemo)(()=>({read:t=>c.useSessionStore.getState().sessions[S]?.queuedMessages?.get(t)??[],write:t=>y(S,t)}),[S,y]),_=(0,t.useMemo)(()=>q?b&&0!==b.length?f(b,x.current):l:v,[b,q,v]),E=(0,t.useCallback)(async(t,s)=>{if(!q)return void(0,u.queueComposerMessage)({agentId:M,text:t,attachments:s,queue:A});if(!C)throw new Error("Not connected");const o=(async()=>{const u=(0,n.splitComposerAttachmentsForSubmit)(s),o=await p(u.images),c=await C.sendAgentMessage(M,t,{delivery:"queue",images:o??[],attachments:u.attachments});c.queuedMessageId&&s.length>0&&x.current.set(c.queuedMessageId,s)})(),c=o.catch(()=>{});Q.current.add(c),c.finally(()=>{Q.current.delete(c)}),await o},[M,C,q,p,A]),F=(0,t.useCallback)(async t=>{if(await k(),!q){const s=(0,u.editQueuedComposerMessage)({agentId:M,messageId:t,queue:A});return s?{id:t,text:s.text,attachments:s.attachments}:null}if(!C)throw new Error("Not connected");const s=await C.removeQueuedAgentMessage(M,t);if(!s)return null;const n=x.current.get(t)??[];return x.current.delete(t),{id:s.id,text:s.text,attachments:n}},[M,C,q,A,k]),N=(0,t.useCallback)(async()=>{if(await k(),!q)return A.read(M).filter(h);return f(c.useSessionStore.getState().sessions[S]?.agents?.get(M)?.queuedMessages??[],x.current).filter(h)},[M,q,A,S,k]),R=!q||I&&Boolean(C),H=(0,t.useCallback)(async(t,s)=>{const n=_.findIndex(s=>s.id===t);if(-1===n)return;const o="up"===s?n-1:n+1;if(!(o<0||o>=_.length))if(q){if(!C)throw new Error("Not connected");await C.reorderQueuedAgentMessage(M,t,o)}else(0,u.moveQueuedComposerMessage)({agentId:M,messageId:t,toIndex:o,queue:A})},[M,C,q,_,A]);return{items:_,enqueue:E,take:F,listSendable:N,move:R?H:null}};var t=r(d[0]),s=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),c=r(d[5]);const l=[];function f(t,s){const n=new Set(t.map(t=>t.id));for(const t of s.keys())n.has(t)||s.delete(t);return t.map(t=>({id:t.id,text:t.preview,attachments:s.get(t.id)??[],source:t.source,attachmentCount:t.attachmentCount}))}function h(t){return"system"!==t.source&&!((t.attachmentCount??0)>0&&0===t.attachments.length)}},4217,[36,3350,3542,3540,3688,3351]);
15867
+ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useComposerQueue=function(w){const{serverId:M,agentId:p,client:S,encodeImages:C}=w,q=(0,o.useHostFeature)(M,"steerQueue"),I=(0,o.useHostFeature)(M,"steerQueueReorder"),v=(0,c.useSessionStore)(t=>t.setQueuedMessages),y=(0,c.useSessionStore)((0,s.useShallow)(t=>t.sessions[M]?.queuedMessages?.get(p)??l)),x=(0,c.useSessionStore)((0,s.useShallow)(t=>t.sessions[M]?.agents?.get(p)?.queuedMessages??void 0)),b=(0,t.useRef)(new Set),Q=(0,t.useRef)(0),k=(0,t.useCallback)(async()=>{for(;b.current.size>0;)await Promise.all(b.current)},[]),A=(0,t.useMemo)(()=>({read:t=>c.useSessionStore.getState().sessions[M]?.queuedMessages?.get(t)??[],write:t=>v(M,t)}),[M,v]);(0,t.useEffect)(()=>{if(!q||void 0===x)return;const t=new Set(x.map(t=>t.id));v(M,s=>{const n=new Map(s),u=n.get(p)??[],o=u.filter(s=>s.id.startsWith("pending:")||t.has(s.id));return o.length===u.length?s:(0===o.length?n.delete(p):n.set(p,o),n)})},[p,x,q,M,v]);const E=(0,t.useMemo)(()=>q?x&&0!==x.length?h(x,y):l:y,[x,q,y]),_=(0,t.useCallback)(async(t,s)=>{if(!q)return void(0,u.queueComposerMessage)({agentId:p,text:t,attachments:s,queue:A});if(!S)throw new Error("Not connected");const o=(async()=>{const u="pending:"+ ++Q.current;s.length>0&&v(M,n=>{const o=new Map(n);return o.set(p,[...o.get(p)??[],{id:u,text:t,attachments:s}]),o});const o=(0,n.splitComposerAttachmentsForSubmit)(s);try{const n=await C(o.images),c=await S.sendAgentMessage(p,t,{delivery:"queue",images:n??[],attachments:o.attachments});s.length>0&&v(M,n=>{const o=new Map(n),l=(o.get(p)??[]).filter(t=>t.id!==u);return c.queuedMessageId&&l.push({id:c.queuedMessageId,text:t,attachments:s}),0===l.length?o.delete(p):o.set(p,l),o})}catch(t){throw s.length>0&&v(M,t=>{const s=new Map(t),n=(s.get(p)??[]).filter(t=>t.id!==u);return 0===n.length?s.delete(p):s.set(p,n),s}),t}})(),c=o.catch(()=>{});b.current.add(c),c.finally(()=>{b.current.delete(c)}),await o},[p,S,q,C,A,M,v]),F=(0,t.useCallback)(async t=>{if(await k(),!q){const s=(0,u.editQueuedComposerMessage)({agentId:p,messageId:t,queue:A});return s?{id:t,text:s.text,attachments:s.attachments}:null}if(!S)throw new Error("Not connected");const s=A.read(p).find(s=>s.id===t)?.attachments??[],n=await S.removeQueuedAgentMessage(p,t);return n?(v(M,s=>{const n=new Map(s),u=(n.get(p)??[]).filter(s=>s.id!==t);return 0===u.length?n.delete(p):n.set(p,u),n}),{id:n.id,text:n.text,attachments:s}):null},[p,S,q,A,M,v,k]),N=(0,t.useCallback)(async()=>{if(await k(),!q)return A.read(p).filter(f);return h(c.useSessionStore.getState().sessions[M]?.agents?.get(p)?.queuedMessages??[],A.read(p)).filter(f)},[p,q,A,M,k]),R=!q||I&&Boolean(S),H=(0,t.useCallback)(async(t,s)=>{const n=E.findIndex(s=>s.id===t);if(-1===n)return;const o="up"===s?n-1:n+1;if(!(o<0||o>=E.length))if(q){if(!S)throw new Error("Not connected");await S.reorderQueuedAgentMessage(p,t,o)}else(0,u.moveQueuedComposerMessage)({agentId:p,messageId:t,toIndex:o,queue:A})},[p,S,q,E,A]);return{items:E,enqueue:_,take:F,listSendable:N,move:R?H:null}};var t=r(d[0]),s=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),c=r(d[5]);const l=[];function h(t,s){const n=new Map(s.map(t=>[t.id,t.attachments]));return t.map(t=>({id:t.id,text:t.preview,attachments:n.get(t.id)??[],source:t.source,attachmentCount:t.attachmentCount}))}function f(t){return"system"!==t.source&&!((t.attachmentCount??0)>0&&0===t.attachments.length)}},4217,[36,3350,3542,3540,3688,3351]);
15868
15868
  __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AutocompletePopover=function({visible:e,anchorRef:c,options:y,selectedIndex:A,onSelect:T,isLoading:F,errorMessage:H,loadingText:I,emptyText:L}){const[M,j]=(0,o.useState)(null),k=(0,s.default)(),D=(0,p.useFloatingPanelPortalHostName)(),{shift:N}=(0,v.useKeyboardShift)(),E=(0,u.useSharedValue)(0);(0,o.useEffect)(()=>{if(!e||y.length>0&&A<0)return void j(null);let t=!1;const o=()=>{const e=c.current;var o;e&&Promise.all([(o=e,new Promise(e=>{o.measureInWindow((t,o,n,s)=>{e({x:t,y:o,width:n,height:s})})})),(0,p.measureFloatingPanelPortalHost)(D)]).then(([e,o])=>{!t&&o&&(j({x:e.x-o.x,y:e.y-o.y,width:e.width,hostHeight:o.height}),E.value=N.value)})};o();const s=requestAnimationFrame(o),l=["keyboardDidShow","keyboardDidHide"].map(e=>n.default.addListener(e,()=>requestAnimationFrame(o)));return()=>{t=!0,cancelAnimationFrame(s);for(const e of l)e.remove()}},[e,y.length,A,c,D,E,N,k.width,k.height]);const Y=(0,o.useMemo)(()=>M?(0,x.inlineUnistylesStyle)({position:"absolute",bottom:M.hostHeight-M.y+w,left:M.x,width:M.width}):null,[M]),G=(0,u.useAnimatedStyle)((function({_worklet_538743382738_init_data:e,openShift:t,shift:o}){const n=()=>({transform:[{translateY:t.value-o.value}]});return n.__closure={openShift:t,shift:o},n.__workletHash=538743382738,n.__initData=e,n})({_worklet_538743382738_init_data:P,openShift:E,shift:N})),O=(0,o.useMemo)(()=>[Y,G,f.FLOATING_LAYER_NO_DRAG_STYLE],[Y,G]);return e&&M&&Y?y.length>0&&A<0?null:(0,S.jsx)(l.Portal,{hostName:D,children:(0,S.jsx)(t.View,{style:b.overlay,pointerEvents:"box-none",children:(0,S.jsx)(h.default.View,{testID:"composer-autocomplete-popover",style:O,children:(0,S.jsx)(_.Autocomplete,{options:y,selectedIndex:A,onSelect:T,isLoading:F,errorMessage:H,loadingText:I,emptyText:L})})})}):null};var t=r(d[0]),o=r(d[1]),n=e(r(d[2]));r(d[3]);var s=e(r(d[4])),l=r(d[5]),u=r(d[6]),h=e(u),c=r(d[7]),f=r(d[8]),_=r(d[9]),p=r(d[10]),v=r(d[11]),y=r(d[12]),x=r(d[13]),S=r(d[14]);const w=y.SPACING[3];const P={code:"function autocompletePopoverTsx1(){const{openShift,shift}=this.__closure;return{transform:[{translateY:openShift.value-shift.value}]};}"};const b=c.StyleSheet.create(()=>({overlay:{position:"absolute",top:0,right:0,bottom:0,left:0}}))},4218,[360,36,821,146,1086,885,454,56,3345,4219,4221,4097,305,3597,279]);
15869
15869
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.Autocomplete=function(t){const f=(0,s.c)(66),{options:y,selectedIndex:S,onSelect:w,isLoading:T,errorMessage:z,loadingText:v,emptyText:V,maxHeight:C}=t,M=void 0!==T&&T,L=void 0===C?220:C,{t:R}=(0,p.useTranslation)(),{theme:E}=(0,u.useUnistyles)();let H;f[0]!==v||f[1]!==R?(H=v??R("common.states.loading"),f[0]=v,f[1]=R,f[2]=H):H=f[2];const W=H;let k;f[3]!==V||f[4]!==R?(k=V??R("common.empty.noResults"),f[3]=V,f[4]=R,f[5]=k):k=f[5];const D=k,I=(0,c.useRef)(null);let A;f[6]===Symbol.for("react.memo_cache_sentinel")?(A=new Map,f[6]=A):A=f[6];const F=(0,c.useRef)(A),O=(0,c.useRef)(0),P=(0,c.useRef)(0);let q;f[7]!==S?(q=()=>{if(S<0)return;const t=F.current.get(S);if(!t)return;const n=(0,h.getAutocompleteScrollOffset)({currentOffset:P.current,viewportHeight:O.current,itemTop:t.top,itemHeight:t.height});Math.abs(n-P.current)<1||(P.current=n,I.current?.scrollTo({y:n,animated:!1}))},f[7]=S,f[8]=q):q=f[8];const G=q;let U;f[9]===Symbol.for("react.memo_cache_sentinel")?(U=()=>{I.current?.scrollToEnd({animated:!1}),requestAnimationFrame(()=>{I.current?.scrollToEnd({animated:!1})})},f[9]=U):U=f[9];const B=U;let J,K,N,Q,X,Y,Z;f[10]===Symbol.for("react.memo_cache_sentinel")?(J=()=>{F.current.clear(),P.current=0},f[10]=J):J=f[10];f[11]!==y?(K=[y],f[11]=y,f[12]=K):K=f[12];(0,c.useEffect)(J,K),f[13]!==y.length?(N=()=>{0!==y.length&&B()},f[13]=y.length,f[14]=N):N=f[14];f[15]!==y?(Q=[y,B],f[15]=y,f[16]=Q):Q=f[16];(0,c.useEffect)(N,Q),f[17]!==G?(X=()=>{const t=requestAnimationFrame(G);return()=>{cancelAnimationFrame(t)}},f[17]=G,f[18]=X):X=f[18];f[19]!==G||f[20]!==y.length?(Y=[G,y.length],f[19]=G,f[20]=y.length,f[21]=Y):Y=f[21];(0,c.useEffect)(X,Y),f[22]!==G?(Z=t=>{O.current=t.nativeEvent.layout.height,G()},f[22]=G,f[23]=Z):Z=f[23];const $=Z;let ee;f[24]===Symbol.for("react.memo_cache_sentinel")?(ee=t=>{P.current=t.nativeEvent.contentOffset.y},f[24]=ee):ee=f[24];const te=ee;let ne;f[25]!==G?(ne=(t,n)=>{F.current.set(t,{top:n.nativeEvent.layout.y,height:n.nativeEvent.layout.height}),G()},f[25]=G,f[26]=ne):ne=f[26];const ie=ne,oe=y[S];let re;f[27]!==L?(re=[j.container,{maxHeight:L}],f[27]=L,f[28]=re):re=f[28];const le=re;if(M){let t,l;return f[29]!==W?(t=(0,x.jsx)(n.View,{style:j.emptyItem,children:(0,x.jsx)(o.Text,{style:j.emptyText,children:W})}),f[29]=W,f[30]=t):t=f[30],f[31]!==le||f[32]!==t?(l=(0,x.jsx)(n.View,{style:le,children:t}),f[31]=le,f[32]=t,f[33]=l):l=f[33],l}if(z){let t,l;return f[34]!==z?(t=(0,x.jsx)(n.View,{style:j.emptyItem,children:(0,x.jsxs)(o.Text,{style:j.emptyText,children:["Error: ",z]})}),f[34]=z,f[35]=t):t=f[35],f[36]!==le||f[37]!==t?(l=(0,x.jsx)(n.View,{style:le,children:t}),f[36]=le,f[37]=t,f[38]=l):l=f[38],l}if(0===y.length){let t,l;return f[39]!==D?(t=(0,x.jsx)(n.View,{style:j.emptyItem,children:(0,x.jsx)(o.Text,{style:j.emptyText,children:D})}),f[39]=D,f[40]=t):t=f[40],f[41]!==le||f[42]!==t?(l=(0,x.jsx)(n.View,{style:le,children:t}),f[41]=le,f[42]=t,f[43]=l):l=f[43],l}let se,ce,de,ae,ue;f[44]!==oe?(se="command"===oe?.kind&&oe.description?(0,x.jsxs)(n.View,{style:j.detailCard,children:[(0,x.jsx)(o.Text,{style:j.detailLabel,children:_(oe.label)??oe.label}),(0,x.jsx)(o.Text,{style:j.detailDescription,children:_(oe.description)}),oe.detail?(0,x.jsx)(o.Text,{style:j.detailHint,children:_(oe.detail)}):null]}):null,f[44]=oe,f[45]=se):se=f[45];if(f[46]!==ie||f[47]!==w||f[48]!==y||f[49]!==S||f[50]!==E){let t;f[52]!==ie||f[53]!==w||f[54]!==S||f[55]!==E?(t=(t,n)=>(0,x.jsx)(b,{index:n,option:t,isSelected:n===S,mutedColor:E.colors.foregroundMuted,onSelect:w,onRowLayout:ie},t.id),f[52]=ie,f[53]=w,f[54]=S,f[55]=E,f[56]=t):t=f[56],ce=y.map(t),f[46]=ie,f[47]=w,f[48]=y,f[49]=S,f[50]=E,f[51]=ce}else ce=f[51];f[57]!==$||f[58]!==ce?(de=(0,x.jsx)(l.ScrollView,{ref:I,onLayout:$,onContentSizeChange:B,onScroll:te,scrollEventThrottle:16,style:j.scrollView,contentContainerStyle:j.scrollContent,keyboardShouldPersistTaps:"always",children:ce}),f[57]=$,f[58]=ce,f[59]=de):de=f[59];f[60]!==le||f[61]!==de?(ae=(0,x.jsx)(n.View,{style:le,children:de}),f[60]=le,f[61]=de,f[62]=ae):ae=f[62];f[63]!==se||f[64]!==ae?(ue=(0,x.jsxs)(n.View,{style:j.outerWrapper,children:[se,ae]}),f[63]=se,f[64]=ae,f[65]=ue):ue=f[65];return ue};var t=r(d[0]),n=r(d[1]),o=r(d[2]),l=r(d[3]),s=r(d[4]),c=r(d[5]);r(d[6]),r(d[7]),r(d[8]),r(d[9]);var u=r(d[10]),p=r(d[11]),f=r(d[12]),h=r(d[13]),x=r(d[14]);const y=/\u26A1|\uFE0F/gu;function _(t){if(!t)return t;const n=t.replace(y,"").trim();return n.length>0?n:void 0}function b(l){const c=(0,s.c)(24),{index:u,option:p,isSelected:h,mutedColor:y,onSelect:b,onRowLayout:S}=l;let w;c[0]!==p.label?(w=_(p.label)??p.label,c[0]=p.label,c[1]=w):w=c[1];const T=w;let z;c[2]!==p.description?(z=_(p.description),c[2]=p.description,c[3]=z):z=c[3];const v=z,V="directory"===p.kind||"file"===p.kind;let C;c[4]!==u||c[5]!==S?(C=t=>S(u,t),c[4]=u,c[5]=S,c[6]=C):C=c[6];const M=C;let L;c[7]!==b||c[8]!==p?(L=()=>b(p),c[7]=b,c[8]=p,c[9]=L):L=c[9];const R=L;let E;c[10]!==h?(E=t=>{const{hovered:n,pressed:o}=t,l=void 0!==n&&n;return[j.item,(l||o||h)&&j.itemActive]},c[10]=h,c[11]=E):E=c[11];const H=E;let W,k;return c[12]!==V||c[13]!==y||c[14]!==p.detail||c[15]!==p.kind||c[16]!==v||c[17]!==T?(W=V?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(n.View,{style:j.itemLeading,children:"directory"===p.kind?(0,x.jsx)(f.Folder,{size:14,color:y}):(0,x.jsx)(f.File,{size:14,color:y})}),(0,x.jsxs)(n.View,{style:j.itemMain,children:[(0,x.jsxs)(n.View,{style:j.itemHeader,children:[(0,x.jsx)(o.Text,{style:j.itemLabel,children:T}),_(p.detail)?(0,x.jsx)(o.Text,{style:j.itemDetail,children:_(p.detail)}):null]}),v?(0,x.jsx)(o.Text,{style:j.itemDescription,numberOfLines:1,children:v}):null]})]}):(0,x.jsxs)(n.View,{style:j.itemMainRow,children:[(0,x.jsx)(o.Text,{style:j.itemLabel,children:T}),v?(0,x.jsx)(o.Text,{style:j.itemDescriptionInline,numberOfLines:1,children:v}):null]}),c[12]=V,c[13]=y,c[14]=p.detail,c[15]=p.kind,c[16]=v,c[17]=T,c[18]=W):W=c[18],c[19]!==M||c[20]!==R||c[21]!==H||c[22]!==W?(k=(0,x.jsx)(t.Pressable,{onLayout:M,onPress:R,style:H,children:W}),c[19]=M,c[20]=R,c[21]=H,c[22]=W,c[23]=k):k=c[23],k}const j=u.StyleSheet.create(t=>({outerWrapper:{gap:t.spacing[1],uni__dependencies:[0]},detailCard:Object.assign({backgroundColor:t.colors.surface1,borderWidth:t.borderWidth[1],borderColor:t.colors.borderAccent,borderRadius:t.borderRadius.lg,paddingHorizontal:t.spacing[3],paddingVertical:t.spacing[3]},t.shadow.md,{uni__dependencies:[0]}),detailLabel:{color:t.colors.foreground,fontSize:t.fontSize.sm,fontWeight:t.fontWeight.normal,uni__dependencies:[0]},detailDescription:{color:t.colors.foregroundMuted,fontSize:t.fontSize.xs,marginTop:t.spacing[1],uni__dependencies:[0]},detailHint:{color:t.colors.foregroundMuted,fontSize:t.fontSize.xs,marginTop:t.spacing[1],uni__dependencies:[0]},container:Object.assign({backgroundColor:t.colors.surface1,borderWidth:t.borderWidth[1],borderColor:t.colors.borderAccent,borderRadius:t.borderRadius.lg,overflow:"hidden"},t.shadow.md,{uni__dependencies:[0]}),scrollView:{flexGrow:0,flexShrink:1},scrollContent:{paddingVertical:t.spacing[1],uni__dependencies:[0]},item:{flexDirection:"row",alignItems:"center",minHeight:36,paddingHorizontal:t.spacing[3],paddingVertical:t.spacing[2],uni__dependencies:[0]},itemLeading:{width:18,alignItems:"center",justifyContent:"center",marginRight:t.spacing[1],uni__dependencies:[0]},itemActive:{backgroundColor:t.colors.surface2,uni__dependencies:[0]},itemMain:{flex:1,minWidth:0},itemMainRow:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",gap:t.spacing[2],uni__dependencies:[0]},itemHeader:{flexDirection:"row",alignItems:"center",gap:t.spacing[2],uni__dependencies:[0]},itemLabel:{color:t.colors.foreground,fontSize:t.fontSize.sm,fontWeight:t.fontWeight.normal,uni__dependencies:[0]},itemDetail:{color:t.colors.foregroundMuted,fontSize:t.fontSize.xs,uni__dependencies:[0]},itemDescription:{color:t.colors.foregroundMuted,fontSize:t.fontSize.xs,marginTop:2,uni__dependencies:[0]},itemDescriptionInline:{flex:1,color:t.colors.foregroundMuted,fontSize:t.fontSize.xs,uni__dependencies:[0]},emptyItem:{paddingHorizontal:t.spacing[3],paddingVertical:t.spacing[3],uni__dependencies:[0]},emptyText:{color:t.colors.foregroundMuted,fontSize:t.fontSize.sm,uni__dependencies:[0]}}))},4219,[1692,360,721,700,306,36,182,234,146,1069,56,1093,1120,4220,279]);
15870
15870
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.orderAutocompleteOptions=function(t,n="above-input"){if("below-input"===n)return[...t];return[...t].toReversed()},e.getAutocompleteFallbackIndex=function(t,n="above-input"){if(t<=0)return-1;return"above-input"===n?t-1:0},e.getAutocompleteNextIndex=function(n){return(0,t.getNextActiveIndex)(n)},e.getAutocompleteScrollOffset=function(t){if(t.viewportHeight<=0)return t.currentOffset;const n=t.itemTop+t.itemHeight,o=t.currentOffset,u=t.currentOffset+t.viewportHeight;if(t.itemTop<o)return Math.max(0,t.itemTop);if(n>u)return Math.max(0,n-t.viewportHeight);return t.currentOffset};var t=r(d[0])},4220,[3586]);
@@ -16236,7 +16236,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";const e=["theme","rulerColumn"];Object
16236
16236
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.ToolbarIconButton=function(c){const l=(0,n.c)(33),{label:x,Icon:y,onPress:v,disabled:j,selected:T,loading:D,tone:I,shortcut:w,testID:P}=c,z=void 0!==j&&j,C=void 0!==T&&T,R=void 0!==D&&D,k=void 0===I?"default":I;let A;l[0]!==z||l[1]!==C?(A=o=>{const{hovered:t,pressed:n}=o;return[B.iconButton,!z&&(Boolean(t)||n)&&B.iconButtonActive,C&&B.iconButtonSelected,z&&B.iconButtonDisabled]},l[0]=z,l[1]=C,l[2]=A):A=l[2];const F=A;let L;l[3]!==z||l[4]!==C?(L={disabled:z,selected:C},l[3]=z,l[4]=C,l[5]=L):L=l[5];const M=L;let H;l[6]!==z||l[7]!==C||l[8]!==k?(H=S({disabled:z,selected:C,tone:k}),l[6]=z,l[7]=C,l[8]=k,l[9]=H):H=l[9];const O=H,U=(0,s.useIsCompactFormFactor)()?h:f,V=z||R;let q,E,G,J,K,N;l[10]!==y||l[11]!==U||l[12]!==O||l[13]!==R?(q=R?(0,b.jsx)(_,{size:U,uniProps:O}):(0,b.jsx)(y,{size:U,uniProps:O}),l[10]=y,l[11]=U,l[12]=O,l[13]=R,l[14]=q):q=l[14];l[15]!==M||l[16]!==F||l[17]!==x||l[18]!==v||l[19]!==V||l[20]!==q||l[21]!==P?(E=(0,b.jsx)(p.TooltipTrigger,{accessibilityRole:"button",accessibilityLabel:x,accessibilityState:M,testID:P,onPress:v,disabled:V,style:F,children:q}),l[15]=M,l[16]=F,l[17]=x,l[18]=v,l[19]=V,l[20]=q,l[21]=P,l[22]=E):E=l[22];l[23]!==x?(G=(0,b.jsx)(t.Text,{style:B.tooltipText,children:x}),l[23]=x,l[24]=G):G=l[24];l[25]!==w?(J=w&&w.length>0?(0,b.jsx)(u.Shortcut,{chord:w,style:B.tooltipShortcut}):null,l[25]=w,l[26]=J):J=l[26];l[27]!==G||l[28]!==J?(K=(0,b.jsx)(p.TooltipContent,{side:"bottom",align:"center",offset:8,children:(0,b.jsxs)(o.View,{style:B.tooltipRow,children:[G,J]})}),l[27]=G,l[28]=J,l[29]=K):K=l[29];l[30]!==E||l[31]!==K?(N=(0,b.jsxs)(p.Tooltip,{delayDuration:300,children:[E,K]}),l[30]=E,l[31]=K,l[32]=N):N=l[32];return N};var o=r(d[0]),t=r(d[1]),n=r(d[2]);r(d[3]),r(d[4]),r(d[5]);var c=r(d[6]),s=r(d[7]),l=r(d[8]),u=r(d[9]),p=r(d[10]),b=r(d[11]);const f=16,h=32,_=(0,c.withUnistyles)(l.LoadingSpinner),x=o=>({color:o.colors.foreground}),y=o=>({color:o.colors.foregroundMuted}),v=o=>({color:o.colors.accent});function S({disabled:o,selected:t,tone:n}){return o?y:"accent"===n?v:t?x:y}const B=c.StyleSheet.create(o=>({iconButton:{padding:o.spacing[1],borderRadius:6,uni__dependencies:[0]},iconButtonActive:{backgroundColor:o.colors.surfaceHover,uni__dependencies:[0]},iconButtonSelected:{backgroundColor:o.colors.surface2,uni__dependencies:[0]},iconButtonDisabled:{opacity:.4},tooltipRow:{flexDirection:"row",alignItems:"center",gap:o.spacing[2],uni__dependencies:[0]},tooltipText:{color:o.colors.foreground,fontSize:o.fontSize.sm,uni__dependencies:[0]},tooltipShortcut:{}}))},4586,[360,721,306,36,234,146,56,347,3638,3341,3691,279]);
16237
16237
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.ToolbarSeparator=function(){const c=(0,o.c)(1);let p;c[0]===Symbol.for("react.memo_cache_sentinel")?(p=(0,l.jsx)(t.View,{style:s.slot,"aria-hidden":!0,children:(0,l.jsx)(n.Text,{style:s.pipe,selectable:!1,children:"|"})}),c[0]=p):p=c[0];return p};var t=r(d[0]),n=r(d[1]),o=r(d[2]);r(d[3]),r(d[4]);var c=r(d[5]),l=r(d[6]);const s=c.StyleSheet.create(t=>({slot:{alignItems:"center",justifyContent:"center",alignSelf:"stretch",paddingHorizontal:t.spacing[1],uni__dependencies:[0]},pipe:{color:t.colors.border,fontSize:t.fontSize.sm-1,lineHeight:t.fontSize.sm-1,includeFontPadding:!1,textAlignVertical:"center",uni__dependencies:[0]}}))},4587,[360,721,306,234,146,56,279]);
16238
16238
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.CodeEditor=function(h){const v=(0,n.useRef)(null),S=(0,n.useRef)(null),D=(0,n.useRef)(h);D.current=h;const w=(0,n.useRef)(null),k=(0,n.useRef)(null),[p,y]=(0,n.useState)(!1),L=(0,t.useWebElementScrollbar)(w,{enabled:p,contentRef:k,horizontal:!0,vertical:!1});(0,n.useLayoutEffect)(()=>{const n=v.current;if(!n)return;let t=null;const c=(0,o.createEditorCore)({parent:n,path:D.current.path,doc:D.current.initialDoc,cleanDoc:D.current.cleanDoc,theme:D.current.theme,wordWrap:D.current.wordWrap,markdownLivePreview:D.current.markdownLivePreview,hideNativeScrollbar:!0,onDirtyChanged:n=>D.current.onDirtyChanged?.(n),onMatchInfo:n=>D.current.onMatchInfo?.(n),onCursorMoved:n=>D.current.onCursorMoved?.(n),keyBindings:D.current.keyBindings,onSaveShortcut:()=>D.current.onSaveShortcut?.(),onFindShortcut:()=>D.current.onFindShortcut?.(),onCloseFindShortcut:()=>D.current.onCloseFindShortcut?.(),onGoToLineShortcut:()=>D.current.onGoToLineShortcut?.(),onGoToDefinitionShortcut:()=>D.current.onGoToDefinitionShortcut?.(),onFindReferencesShortcut:()=>D.current.onFindReferencesShortcut?.(),onRenameSymbolShortcut:()=>D.current.onRenameSymbolShortcut?.(),onScrolled:n=>D.current.onScrolled?.(n),onPointerSelect:n=>D.current.onPointerSelect?.(n),onImageDrop:D.current.onImageDrop?n=>D.current.onImageDrop?.(n):void 0,onContextMenu:D.current.onContextMenu?n=>D.current.onContextMenu?.(n):void 0,hoverProvider:D.current.hoverProvider?n=>D.current.hoverProvider?.(n)??Promise.resolve({kind:"unavailable"}):void 0,diagnostics:D.current.diagnostics,onDocChanged:()=>{null!==t&&clearTimeout(t),t=setTimeout(()=>{t=null;const n=S.current;n&&D.current.onDocSync?.(n.getDoc())},D.current.docSyncDebounceMs??f)}});S.current=c,w.current=n.querySelector(".cm-scroller"),k.current=n.querySelector(".cm-content"),y(!0);const u={getDoc:()=>Promise.resolve(c.getDoc()),getSelection:()=>Promise.resolve(c.getSelection()),getWordAtCursor:()=>Promise.resolve(c.getWordAtCursor()),setDoc:n=>c.setDoc(n),setFind:n=>c.setFind(n),findNext:()=>c.findNext(),findPrevious:()=>c.findPrevious(),replaceNext:()=>c.replaceNext(),replaceAll:()=>c.replaceAll(),focus:()=>c.focus(),goToLine:n=>c.goToLine(n),selectLines:(n,t,o)=>c.selectLines(n,t,o),selectAll:()=>c.selectAll(),replaceSelection:n=>c.replaceSelection(n),runMarkdownCommand:n=>{c.runMarkdownCommand(n)},getScrollMetrics:()=>c.getScrollMetrics(),scrollToFraction:n=>c.scrollToFraction(n),scrollToLineAtOffset:(n,t)=>c.scrollToLineAtOffset(n,t),setDiagnostics:n=>c.setDiagnostics(n),setMarkdownLinkTargets:n=>c.setMarkdownLinkTargets(n)};return D.current.onReady?.(u),()=>{null!==t&&clearTimeout(t),y(!1),w.current=null,k.current=null,S.current=null,c.destroy()}},[]);const M=JSON.stringify(h.theme);(0,n.useEffect)(()=>{S.current?.setTheme(D.current.theme)},[M]),(0,n.useEffect)(()=>{S.current?.setWordWrap(h.wordWrap)},[h.wordWrap]),(0,n.useEffect)(()=>{S.current?.setMarkdownLivePreview(h.markdownLivePreview??!1)},[h.markdownLivePreview]);const P=h.markdownLinkTargets;(0,n.useEffect)(()=>{void 0!==P&&S.current?.setMarkdownLinkTargets(P)},[P]);const T=JSON.stringify(h.keyBindings??null);(0,n.useEffect)(()=>{const n=D.current.keyBindings;n&&S.current?.setKeyBindings(n)},[T]);const C=h.diagnostics;(0,n.useEffect)(()=>{void 0!==C&&S.current?.setDiagnostics(C)},[C]);const R=(0,n.useRef)(h.cleanDoc);return(0,n.useEffect)(()=>{h.cleanDoc!==R.current&&(R.current=h.cleanDoc,S.current?.setCleanDoc(h.cleanDoc))},[h.cleanDoc]),(0,u.jsxs)("div",Object.assign({style:s,"data-pmono":"","data-testid":"code-editor-surface"},(0,c.isMarkdownPath)(h.path)?{"data-markdown-editor":""}:{},{children:[(0,u.jsx)("div",{ref:v,style:l}),L]}))};var n=r(d[0]),t=r(d[1]),o=r(d[2]),c=r(d[3]),u=r(d[4]);const s={position:"relative",flex:1,minHeight:0,minWidth:0,width:"100%",height:"100%",overflow:"hidden"},l={width:"100%",height:"100%",overflow:"hidden"},f=750},4588,[36,3595,4589,4605,279]);
16239
- __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.createEditorCore=function(o){const u=new s.Compartment,h=new s.Compartment,b=new s.Compartment;let y,D=o.theme,L=!1,$=!1;const F=(t,n)=>{($!==t||n)&&($=t,o.onDirtyChanged?.(t))},T=(t,o=!1)=>{F(!t.eq(y),o)},H=t=>{y=t,T(P.state.doc,!0)},N=t=>{if(!o.onMatchInfo)return;if(!L)return void o.onMatchInfo(null);const n=(0,c.getSearchQuery)(t.state);if(!n.search||!n.valid)return void o.onMatchInfo(null);const{main:s}=t.state.selection;let l=0,u=0;const h=n.getCursor(t.state);for(let t=h.next();!t.done&&(l+=1,t.value.from===s.from&&t.value.to===s.to&&(u=l),!(l>=S));t=h.next());o.onMatchInfo({current:u,total:l})};let W=null;const R=t=>{const o=t.scrollDOM;if(o.clientHeight<=0)return;const n=t.state.selection.main.head,c=t.coordsAtPos(n),s=Math.min(80,o.clientHeight/4);if(!c){const o=t.lineBlockAt(n);return void rt(o.top-s)}const l=o.getBoundingClientRect();let u=0;c.top<l.top+s?u=c.top-(l.top+s):c.bottom>l.bottom-s&&(u=c.bottom-(l.bottom-s)),Math.abs(u)>.5&&rt(o.scrollTop+u)},B=t=>{"function"==typeof requestAnimationFrame&&null===W&&(W=requestAnimationFrame(()=>{W=null,V||R(t)}))},I=s.EditorState.create({doc:o.doc,extensions:[(0,l.lineNumbers)({domEventHandlers:{mousedown:X}}),(0,l.highlightActiveLineGutter)(),(0,l.highlightActiveLine)(),(0,l.highlightSpecialChars)(),(0,l.drawSelection)(),(0,t.history)(),(0,n.bracketMatching)(),(0,c.search)({createPanel:()=>({dom:document.createElement("div")})}),b.of(J(o,o.keyBindings??x.DEFAULT_EDITOR_KEY_BINDINGS)),l.keymap.of([{key:"Escape",run:()=>!!L&&(o.onCloseFindShortcut?.(),!0)},...t.defaultKeymap,...t.historyKeymap,t.indentWithTab]),...o.hoverProvider?[(z=o.hoverProvider,O=()=>D,(0,l.hoverTooltip)(async(t,o)=>{const n=(0,w.diagnosticsAtPos)(t.state,o),c=t.state.wordAt(o);if(null===c)return 0===n.length?null:{pos:o,end:Math.min(o+1,t.state.doc.length),above:!0,create:()=>({dom:(0,w.renderDiagnosticList)(n,O())})};const s=t.state.doc.lineAt(o),l={line:s.number,column:o-s.from+1},u=z(l),h=await Promise.race([u,(p=A,new Promise(t=>{window.setTimeout(t,p)})).then(()=>null)]);var p;return null!==h?"content"===h.kind?et(c,()=>{const t=O();return{dom:Z(n,nt(h.markdown,t),t)}}):0===n.length?null:et(c,()=>({dom:(0,w.renderDiagnosticList)(n,O())})):n.length>0?et(c,()=>({dom:(0,w.renderDiagnosticList)(n,O())})):et(c,()=>tt({view:t,provider:z,position:l,pending:u,readTheme:O}))}))]:[],(0,w.createDiagnosticsExtension)({readTheme:()=>D}),(0,k.createOverviewRulerExtension)({readTheme:()=>D}),l.EditorView.domEventHandlers({contextmenu:(t,n)=>{if(!o.onContextMenu)return!1;const c=n.posAtCoords({x:t.clientX,y:t.clientY}),{main:s}=n.state.selection;return null!==c&&(s.empty||c<s.from||c>s.to)&&n.dispatch({selection:{anchor:c},userEvent:"select.pointer"}),n.focus(),o.onContextMenu({x:t.clientX,y:t.clientY}),t.preventDefault(),!0}}),Y(o.path),(0,v.markdownLivePreviewExtension)(o.markdownLivePreview??!1),(0,p.markdownImageDropHandler)(o.onImageDrop),p.markdownPasteHandler,u.of([U(o.theme),G(o.theme)]),h.of(o.wordWrap?l.EditorView.lineWrapping:[]),o.hideNativeScrollbar?_:[],l.EditorView.updateListener.of(t=>{const n=t.transactions.some(t=>t.annotation(E));if(t.docChanged&&o.onDocChanged?.(),t.docChanged&&!n&&(T(t.state.doc),B(t.view)),L&&(t.docChanged||t.selectionSet)&&N(t.view),(t.selectionSet||t.docChanged)&&o.onCursorMoved?.(K(t.state)),t.selectionSet&&o.onPointerSelect){if(t.transactions.some(t=>t.isUserEvent("select.pointer"))){const n=t.state.selection.main.head,c=t.view.lineBlockAt(n);o.onPointerSelect({line:t.state.doc.lineAt(n).number,lineCount:t.state.doc.lines,viewportOffsetY:c.top-t.view.scrollDOM.scrollTop})}}})]}),P=new l.EditorView({state:I,parent:o.parent});var z,O;let V=!1;y=null==o.cleanDoc||o.cleanDoc===o.doc?I.doc:s.Text.of(o.cleanDoc.split("\n")),T(I.doc),o.onCursorMoved?.(K(P.state)),void 0!==o.diagnostics&&o.diagnostics.length>0&&P.dispatch({effects:w.setEditorDiagnostics.of(o.diagnostics)});const q=()=>{if(P.focus(),"function"!=typeof requestAnimationFrame)return;let t=0;const o=()=>{V||P.hasFocus||t>=M||(t+=1,P.focus(),requestAnimationFrame(o))};requestAnimationFrame(o)},j=()=>{const t=P.scrollDOM;if(t.clientHeight<=0)return null;const o=P.lineBlockAtHeight(t.scrollTop);return{scrollTop:t.scrollTop,scrollHeight:t.scrollHeight,clientHeight:t.clientHeight,topLine:P.state.doc.lineAt(Math.min(o.from,P.state.doc.length)).number,lineCount:P.state.doc.lines}};let ot=!1;const rt=t=>{const o=P.scrollDOM,n=Math.max(0,o.scrollHeight-o.clientHeight),c=Math.max(0,Math.min(t,n));Math.abs(o.scrollTop-c)<.5||(ot=!0,o.scrollTop=c)};let at=null;const it=()=>{ot?ot=!1:o.onScrolled&&null===at&&(at=requestAnimationFrame(()=>{at=null;const t=j();t&&o.onScrolled?.(t)}))};return P.scrollDOM.addEventListener("scroll",it,{passive:!0}),{getDoc:()=>P.state.doc.toString(),getSelection:()=>{const t=P.state.selection.main;return{text:P.state.sliceDoc(t.from,t.to),lineStart:P.state.doc.lineAt(t.from).number,lineEnd:P.state.doc.lineAt(t.to).number,isEmpty:t.empty}},getWordAtCursor:()=>{const t=P.state.selection.main.head,o=P.state.doc.lineAt(t);return(0,C.findWordAtCursor)(o.text,t-o.from+1)},setDoc:t=>{P.dispatch({changes:{from:0,to:P.state.doc.length,insert:t},annotations:E.of(!0)}),H(P.state.doc)},setCleanDoc:t=>{const o=P.state.doc,n=t.length===o.length&&t===o.toString();H(n?o:s.Text.of(t.split("\n")))},setFind:t=>{if(!t||!t.search)return L=!1,(0,c.closeSearchPanel)(P),void o.onMatchInfo?.(null);L=!0,(0,c.openSearchPanel)(P),P.dispatch({effects:c.setSearchQuery.of(Q(t))}),N(P)},findNext:()=>{(0,c.findNext)(P),B(P)},findPrevious:()=>{(0,c.findPrevious)(P),B(P)},replaceNext:()=>{(0,c.replaceNext)(P),B(P)},replaceAll:()=>{(0,c.replaceAll)(P)},focus:()=>{q()},goToLine:t=>{const o=Math.max(1,Math.min(t,P.state.doc.lines)),n=P.state.doc.line(o);P.dispatch({selection:{anchor:n.from},effects:l.EditorView.scrollIntoView(n.from,{y:"center"})}),B(P),q()},selectLines:(t,o,n)=>{const c=P.state.doc.lines,s=Math.max(1,Math.min(t,c)),u=Math.max(s,Math.min(o,c)),h=P.state.doc.line(s),p=P.state.doc.line(u),f=n?.reveal??!0;P.dispatch(Object.assign({selection:{anchor:p.to,head:h.from}},f?{effects:l.EditorView.scrollIntoView(h.from,{y:"center"})}:null)),f&&B(P),q()},selectAll:()=>{P.dispatch({selection:{anchor:0,head:P.state.doc.length}}),q()},replaceSelection:t=>{const{main:o}=P.state.selection;P.dispatch({changes:{from:o.from,to:o.to,insert:t},selection:{anchor:o.from+t.length},userEvent:"input.paste"}),q()},getScrollMetrics:()=>j(),scrollToFraction:t=>{const o=P.scrollDOM,n=Math.max(0,o.scrollHeight-o.clientHeight),c=Math.max(0,Math.min(t,1));rt(c*n)},scrollToLineAtOffset:(t,o)=>{const n=Math.max(1,Math.min(Math.floor(t),P.state.doc.lines)),c=P.lineBlockAt(P.state.doc.line(n).from);rt(c.top-o)},setTheme:t=>{D=t,P.dispatch({effects:u.reconfigure([U(t),G(t)])})},setWordWrap:t=>{P.dispatch({effects:h.reconfigure(t?l.EditorView.lineWrapping:[])})},setKeyBindings:t=>{P.dispatch({effects:b.reconfigure(J(o,t))})},setMarkdownLivePreview:t=>{P.dispatch({effects:v.setMarkdownLivePreview.of(t)})},setMarkdownLinkTargets:t=>{P.dispatch({effects:f.setMarkdownLinkTargetsEffect.of(t)})},runMarkdownCommand:t=>(P.focus(),(0,p.getMarkdownCommand)(t)(P)),setDiagnostics:t=>{P.dispatch({effects:w.setEditorDiagnostics.of(t)})},destroy:()=>{V=!0,null!==at&&(cancelAnimationFrame(at),at=null),null!==W&&(cancelAnimationFrame(W),W=null),P.scrollDOM.removeEventListener("scroll",it),P.destroy()}}};var t=r(d[0]),o=r(d[1]),n=r(d[2]),c=r(d[3]),s=r(d[4]),l=r(d[5]),u=r(d[6]),h=r(d[7]),p=r(d[8]),f=r(d[9]),v=r(d[10]),b=r(d[11]),x=r(d[12]),w=r(d[13]),k=r(d[14]),y=r(d[15]),C=r(d[16]);const S=999,M=4,E=s.Annotation.define(),D=12,L=220,$=3,F=1.5,A=120,T=400,H=15e3,N=11,W=11,R=6,B="62%",I="calc(38% - 2px)";function P(t,o){return{textDecorationLine:"underline",textDecorationStyle:o,textDecorationColor:t,textDecorationSkipInk:"none",textUnderlineOffset:"3px",textDecorationThickness:"wavy"===o?"1px":"2px"}}const z=700,O=6;function V(t){if(null===t.rulerColumn)return{};const o=`calc(${O}px + ${t.rulerColumn}ch)`;return{backgroundImage:`linear-gradient(to right, transparent calc(${o} - 1px), ${t.rulerColor} calc(${o} - 1px), ${t.rulerColor} ${o}, transparent ${o})`,backgroundRepeat:"no-repeat"}}function q(t){return t.overviewRulerWidth<=0?{}:{".cm-otto-overview":{position:"absolute",top:"0",right:"0",bottom:"0",width:`${t.overviewRulerWidth}px`,backgroundColor:t.overviewRulerBackground,borderLeft:`1px solid ${t.overviewRulerBorder}`,zIndex:"5",cursor:"pointer",touchAction:"none",userSelect:"none",WebkitUserSelect:"none"},".cm-otto-overview-marks":{position:"absolute",inset:"0",pointerEvents:"none"},".cm-otto-overview-mark":{position:"absolute",top:"0",borderRadius:"1px"},".cm-otto-overview-mark-problem":{left:"1px",width:B},".cm-otto-overview-mark-error":{backgroundColor:t.diagnostic.error},".cm-otto-overview-mark-warning":{backgroundColor:t.diagnostic.warning},".cm-otto-overview-mark-info":{backgroundColor:t.diagnostic.info},".cm-otto-overview-mark-hint":{backgroundColor:t.diagnostic.hint},".cm-otto-overview-mark-match":{right:"1px",width:I,backgroundColor:t.overviewRulerMatch},".cm-otto-overview-mark-match-active":{left:"1px",right:"1px",width:"auto"},".cm-otto-overview-selections":{position:"absolute",inset:"0",pointerEvents:"none"},".cm-otto-overview-band":{position:"absolute",top:"0",left:"0",right:"0",backgroundColor:t.overviewRulerSelection},".cm-otto-overview-cursor":{position:"absolute",top:"0",left:"0",right:"0",height:"2px",backgroundColor:t.overviewRulerCursor,pointerEvents:"none"},".cm-otto-overview-thumb":{position:"absolute",top:"0",left:"0",right:"0",backgroundColor:t.overviewRulerThumb,pointerEvents:"none"},".cm-scroller::-webkit-scrollbar:vertical":{display:"none",width:"0"}}}function K(t){const o=t.selection.main,n=t.doc.lineAt(o.head);return{line:n.number,column:o.head-n.from+1,selectedChars:o.to-o.from,selectedLines:o.empty?0:t.doc.lineAt(o.to).number-t.doc.lineAt(o.from).number+1}}function U(t){return l.EditorView.theme(Object.assign({"&":{backgroundColor:t.background,color:t.foreground,fontSize:`${t.fontSize}px`,height:"100%"},".cm-scroller":{fontFamily:t.fontFamily,lineHeight:`${t.lineHeight}px`,overflow:"auto",paddingRight:`${Math.max(0,t.overviewRulerWidth)}px`},".cm-content":Object.assign({caretColor:t.cursor,minHeight:"100%",boxSizing:"border-box"},V(t)),".cm-line":{paddingLeft:`${O}px`,paddingRight:"2px"},".cm-cursor, .cm-dropCursor":{borderLeftColor:t.cursor,borderLeftWidth:`${t.cursorWidth}px`},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:t.selectionBackground},".cm-activeLine":{backgroundColor:t.activeLineBackground},".cm-gutters":{backgroundColor:t.gutterBackground,color:t.gutterForeground,border:"none",borderRight:`1px solid ${t.gutterBorder}`,paddingRight:"2px",position:"sticky",insetInlineStart:0,minHeight:"100%",cursor:"default",userSelect:"none",WebkitUserSelect:"none"},".cm-activeLineGutter":{backgroundColor:t.activeLineBackground,color:t.gutterActiveForeground},".cm-searchMatch":{backgroundColor:t.searchMatchBackground,outline:`1px solid ${t.searchMatchBorder}`,borderRadius:"2px"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:t.activeSearchMatchBackground,outline:`2px solid ${t.activeSearchMatchBorder}`},".cm-panels":{display:"none"},".cm-tooltip":{backgroundColor:t.tooltipBackground,color:t.foreground,border:`1px solid ${t.tooltipBorder}`,borderRadius:"6px",boxShadow:t.tooltipShadow},".cm-otto-hover":{maxWidth:"560px",maxHeight:"280px",overflow:"auto",scrollbarGutter:"stable",scrollbarWidth:"thin",scrollbarColor:"transparent transparent"},".cm-otto-hover:hover":{scrollbarColor:`${t.scrollbarHandle} transparent`},".cm-otto-hover::-webkit-scrollbar":{width:`${D}px`,height:`${D}px`},".cm-otto-hover::-webkit-scrollbar-track":{backgroundColor:"transparent"},".cm-otto-hover::-webkit-scrollbar-thumb":{backgroundColor:"transparent",borderRadius:"999px",border:`${$}px solid transparent`,backgroundClip:"content-box",transition:`background-color ${L}ms`},".cm-otto-hover:hover::-webkit-scrollbar-thumb":{backgroundColor:t.scrollbarHandle},".cm-otto-hover::-webkit-scrollbar-thumb:hover":{backgroundColor:t.scrollbarHandle,borderWidth:`${F}px`},".cm-otto-hover::-webkit-scrollbar-corner":{backgroundColor:"transparent"},".cm-otto-hover-code":{margin:"0",padding:"8px 10px",backgroundColor:"transparent",color:t.foreground,fontFamily:t.fontFamily,fontSize:`${t.fontSize}px`,lineHeight:"1.5",whiteSpace:"pre-wrap",overflowWrap:"anywhere"},".cm-otto-hover-prose":{padding:"8px 10px",color:t.gutterForeground,fontFamily:"system-ui, -apple-system, Segoe UI, sans-serif",fontSize:`${Math.max(11,t.fontSize-1)}px`,lineHeight:"1.5",whiteSpace:"pre-wrap"},".cm-otto-hover-divider":{height:"1px",backgroundColor:t.tooltipBorder},".cm-otto-hover-pending":{display:"flex",alignItems:"center",gap:"8px",padding:"8px 10px",color:t.gutterForeground,fontFamily:"system-ui, -apple-system, Segoe UI, sans-serif",lineHeight:"1.5"},".cm-otto-hover-spinner":{display:"inline-block",flex:"0 0 auto",width:`${N}px`,height:`${N}px`,borderRadius:"999px",border:`1.5px solid ${t.tooltipBorder}`,borderTopColor:t.gutterForeground,animation:`cm-otto-hover-spin ${z}ms linear infinite`},"@keyframes cm-otto-hover-spin":{to:{transform:"rotate(360deg)"}},".cm-otto-diagnostic-error":P(t.diagnostic.error,"wavy"),".cm-otto-diagnostic-warning":P(t.diagnostic.warning,"wavy"),".cm-otto-diagnostic-info":P(t.diagnostic.info,"wavy"),".cm-otto-diagnostic-hint":P(t.diagnostic.hint,"dotted"),".cm-otto-diagnostic-gutter":{minWidth:`${W}px`,cursor:"default"},".cm-otto-diagnostic-gutter .cm-gutterElement":{display:"flex",alignItems:"center",justifyContent:"center"},".cm-otto-diagnostic-dot":{flex:"0 0 auto",width:`${R}px`,height:`${R}px`,borderRadius:"999px",backgroundColor:"transparent"},".cm-otto-diagnostic-dot-error":{backgroundColor:t.diagnostic.error},".cm-otto-diagnostic-dot-warning":{backgroundColor:t.diagnostic.warning},".cm-otto-diagnostic-dot-info":{backgroundColor:t.diagnostic.info},".cm-otto-diagnostic-dot-hint":{backgroundColor:t.diagnostic.hint},".cm-otto-diagnostic-card":{fontFamily:"system-ui, -apple-system, Segoe UI, sans-serif"},".cm-otto-diagnostic-entry":{padding:"8px 10px",display:"flex",flexDirection:"column",gap:"4px"},".cm-otto-diagnostic-headline":{display:"flex",alignItems:"flex-start",gap:"7px",color:t.foreground,fontSize:`${Math.max(11,t.fontSize-1)}px`,lineHeight:"1.45"},".cm-otto-diagnostic-badge":{flex:"0 0 auto",width:`${R}px`,height:`${R}px`,borderRadius:"999px",marginTop:"5px"},".cm-otto-diagnostic-help":{paddingLeft:"13px",color:t.gutterForeground,fontSize:`${Math.max(10,t.fontSize-2)}px`,lineHeight:"1.45"},".cm-otto-diagnostic-source":{display:"block",paddingLeft:"13px",color:t.gutterForeground,fontFamily:t.fontFamily,fontSize:`${Math.max(10,t.fontSize-3)}px`,textDecoration:"none"},".cm-otto-diagnostic-link":{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"},".cm-otto-diagnostic-link:hover":{color:t.foreground}},q(t)))}const _=l.EditorView.theme({".cm-scroller":{scrollbarWidth:"none"},".cm-scroller::-webkit-scrollbar":{display:"none",width:"0",height:"0"}});function G(t){const o=t.syntax,c=n.HighlightStyle.define([{tag:u.tags.keyword,color:o.keyword},{tag:u.tags.controlKeyword,color:o.keyword},{tag:u.tags.operatorKeyword,color:o.keyword},{tag:u.tags.definitionKeyword,color:o.keyword},{tag:u.tags.moduleKeyword,color:o.keyword},{tag:u.tags.comment,color:o.comment},{tag:u.tags.lineComment,color:o.comment},{tag:u.tags.blockComment,color:o.comment},{tag:u.tags.docComment,color:o.comment},{tag:u.tags.string,color:o.string},{tag:u.tags.special(u.tags.string),color:o.string},{tag:u.tags.number,color:o.number},{tag:u.tags.integer,color:o.number},{tag:u.tags.float,color:o.number},{tag:u.tags.bool,color:o.literal},{tag:u.tags.null,color:o.literal},{tag:u.tags.function(u.tags.variableName),color:o.function},{tag:u.tags.function(u.tags.propertyName),color:o.function},{tag:u.tags.definition(u.tags.variableName),color:o.definition},{tag:u.tags.definition(u.tags.propertyName),color:o.definition},{tag:u.tags.definition(u.tags.function(u.tags.variableName)),color:o.definition},{tag:u.tags.className,color:o.class},{tag:u.tags.definition(u.tags.className),color:o.class},{tag:u.tags.typeName,color:o.type},{tag:u.tags.tagName,color:o.tag},{tag:u.tags.attributeName,color:o.attribute},{tag:u.tags.attributeValue,color:o.string},{tag:u.tags.propertyName,color:o.property},{tag:u.tags.variableName,color:o.variable},{tag:u.tags.local(u.tags.variableName),color:o.variable},{tag:u.tags.special(u.tags.variableName),color:o.variable},{tag:u.tags.operator,color:o.operator},{tag:u.tags.punctuation,color:o.punctuation},{tag:u.tags.bracket,color:o.punctuation},{tag:u.tags.separator,color:o.punctuation},{tag:u.tags.regexp,color:o.regexp},{tag:u.tags.escape,color:o.escape},{tag:u.tags.meta,color:o.meta},{tag:u.tags.heading,color:o.heading},{tag:u.tags.link,color:o.link},{tag:u.tags.strong,fontWeight:"bold"},{tag:u.tags.emphasis,fontStyle:"italic"},{tag:u.tags.strikethrough,textDecoration:"line-through"},{tag:u.tags.monospace,color:o.string},{tag:u.tags.heading1,color:o.heading,fontWeight:"bold",fontSize:"1.5em"},{tag:u.tags.heading2,color:o.heading,fontWeight:"bold",fontSize:"1.3em"},{tag:u.tags.heading3,color:o.heading,fontWeight:"bold",fontSize:"1.15em"},{tag:u.tags.heading4,color:o.heading,fontWeight:"bold"},{tag:u.tags.heading5,color:o.heading,fontWeight:"bold"},{tag:u.tags.heading6,color:o.heading,fontWeight:"bold"},{tag:u.tags.processingInstruction,color:o.punctuation},{tag:u.tags.contentSeparator,color:o.punctuation},{tag:u.tags.quote,color:o.comment,fontStyle:"italic"},{tag:u.tags.list,color:o.punctuation},{tag:u.tags.url,color:o.link,textDecoration:"underline"}]);return(0,n.syntaxHighlighting)(c,{fallback:!0})}function j(t){const o=t.trim().split(/\s+/,1)[0]?.toLowerCase();if(!o)return null;const n=(0,y.filenameForHoverLanguage)(o);if(null!==n){const t=(0,h.getLanguageForFile)(n);if(t)return t}return(0,h.getLanguageForFile)(`fence.${o}`)}function Y(t){if((0,b.isMarkdownPath)(t))return[(0,o.markdown)({base:o.markdownLanguage,codeLanguages:j,completeHTMLTags:!0}),(0,f.markdownCompletionExtension)(t)];const c=(0,h.getParserForFile)(t);return c?new n.Language((0,n.defineLanguageFacet)(),c).extension:[]}function Q(t){return new c.SearchQuery({search:t.search,replace:t.replace,caseSensitive:t.caseSensitive,wholeWord:t.wholeWord,regexp:t.regexp})}function X(t,o,n){const c=n;if(0!==c.button)return!1;const{state:s}=t,l=s.selection.main.head,u=l-s.doc.lineAt(l).from,h=s.doc.lineAt(o.from);return t.dispatch({selection:{anchor:Math.min(h.from+u,h.to)},userEvent:"select.pointer"}),t.focus(),c.preventDefault(),!0}function J(t,o){const n={save:t.onSaveShortcut,find:t.onFindShortcut,goToLine:t.onGoToLineShortcut,goToDefinition:t.onGoToDefinitionShortcut,findReferences:t.onFindReferencesShortcut,renameSymbol:t.onRenameSymbolShortcut};return l.keymap.of(o.map(t=>({key:t.key,run:o=>{if((0,p.isMarkdownCommandName)(t.action))return(0,p.getMarkdownCommand)(t.action)(o);const c=n[t.action];return!!c&&(c(),!0)}})))}function Z(t,o,n){if(0===t.length)return o;const c=(0,w.renderDiagnosticList)(t,n),s=document.createElement("div");return s.className="cm-otto-hover-divider",c.appendChild(s),c.append(...o.childNodes),c}function tt(t){const{view:o,provider:n,position:c,pending:s,readTheme:u}=t,h=ot(u()),p=Date.now()+H;let f=!1;function v(){x({kind:"unavailable"})}function b(){f||n(c).then(x,v)}function x(t){f||("content"!==t.kind?"warming"===t.kind&&Date.now()<p?window.setTimeout(b,T):o.dispatch({effects:l.closeHoverTooltips}):h.replaceWith(nt(t.markdown,u())))}return s.then(x,v),{dom:h.dom,destroy:()=>{f=!0}}}function et(t,o){return{pos:t.from,end:t.to,above:!0,create:o}}function ot(t){const o=document.createElement("div");o.className="cm-otto-hover cm-otto-hover-pending";const n=document.createElement("span");n.className="cm-otto-hover-spinner",o.appendChild(n);const c=document.createElement("span");return c.textContent="Loading\u2026",c.style.fontSize=`${Math.max(11,t.fontSize-1)}px`,o.appendChild(c),{dom:o,replaceWith:t=>{o.className=t.className,o.replaceChildren(...t.childNodes)}}}function nt(t,o){const n=document.createElement("div");n.className="cm-otto-hover";return(0,y.parseHoverMarkdown)(t).forEach((t,c)=>{if(c>0){const t=document.createElement("div");t.className="cm-otto-hover-divider",n.appendChild(t)}n.appendChild("code"===t.kind?rt(t,o):at(t))}),n}function rt(t,o){const n=document.createElement("pre");n.className="cm-otto-hover-code";const c=(0,y.filenameForHoverLanguage)(t.language);if(null===c)return n.textContent=t.text,n;return(0,h.highlightCode)(t.text,c).forEach((t,c)=>{c>0&&n.appendChild(document.createTextNode("\n"));for(const c of t){if(null===c.style){n.appendChild(document.createTextNode(c.text));continue}const t=document.createElement("span");t.textContent=c.text,t.style.color=o.syntax[c.style],n.appendChild(t)}}),n}function at(t){const o=document.createElement("div");return o.className="cm-otto-hover-prose",o.textContent=(0,y.plainProse)(t.text),o}},4589,[4590,4591,310,4596,312,314,318,308,4597,4602,4604,4605,4606,4607,4608,4610,4611]);
16239
+ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.createEditorCore=function(o){const u=new s.Compartment,h=new s.Compartment,b=new s.Compartment;let y,D=o.theme,L=!1,$=!1;const A=(t,n)=>{($!==t||n)&&($=t,o.onDirtyChanged?.(t))},T=(t,o=!1)=>{A(!t.eq(y),o)},H=t=>{y=t,T(P.state.doc,!0)},N=t=>{if(!o.onMatchInfo)return;if(!L)return void o.onMatchInfo(null);const n=(0,c.getSearchQuery)(t.state);if(!n.search||!n.valid)return void o.onMatchInfo(null);const{main:s}=t.state.selection;let l=0,u=0;const h=n.getCursor(t.state);for(let t=h.next();!t.done&&(l+=1,t.value.from===s.from&&t.value.to===s.to&&(u=l),!(l>=S));t=h.next());o.onMatchInfo({current:u,total:l})};let W=null;const R=t=>{const o=t.scrollDOM;if(o.clientHeight<=0)return;const n=t.state.selection.main.head,c=t.coordsAtPos(n),s=Math.min(80,o.clientHeight/4);if(!c){const o=t.lineBlockAt(n);return void rt(o.top-s)}const l=o.getBoundingClientRect();let u=0;c.top<l.top+s?u=c.top-(l.top+s):c.bottom>l.bottom-s&&(u=c.bottom-(l.bottom-s)),Math.abs(u)>.5&&rt(o.scrollTop+u)},B=t=>{"function"==typeof requestAnimationFrame&&null===W&&(W=requestAnimationFrame(()=>{W=null,V||R(t)}))},I=s.EditorState.create({doc:o.doc,extensions:[(0,l.lineNumbers)({domEventHandlers:{mousedown:X}}),(0,l.highlightActiveLineGutter)(),(0,l.highlightActiveLine)(),(0,l.highlightSpecialChars)(),(0,l.drawSelection)(),(0,t.history)(),(0,n.bracketMatching)(),(0,c.search)({createPanel:()=>({dom:document.createElement("div")})}),b.of(J(o,o.keyBindings??x.DEFAULT_EDITOR_KEY_BINDINGS)),l.keymap.of([{key:"Escape",run:()=>!!L&&(o.onCloseFindShortcut?.(),!0)},...t.defaultKeymap,...t.historyKeymap,t.indentWithTab]),...o.hoverProvider?[(z=o.hoverProvider,O=()=>D,(0,l.hoverTooltip)(async(t,o)=>{const n=(0,w.diagnosticsAtPos)(t.state,o),c=t.state.wordAt(o);if(null===c)return 0===n.length?null:{pos:o,end:Math.min(o+1,t.state.doc.length),above:!0,create:()=>({dom:(0,w.renderDiagnosticList)(n,O())})};const s=t.state.doc.lineAt(o),l={line:s.number,column:o-s.from+1},u=z(l),h=await Promise.race([u,(p=F,new Promise(t=>{window.setTimeout(t,p)})).then(()=>null)]);var p;return null!==h?"content"===h.kind?et(c,()=>{const t=O();return{dom:Z(n,nt(h.markdown,t),t)}}):0===n.length?null:et(c,()=>({dom:(0,w.renderDiagnosticList)(n,O())})):n.length>0?et(c,()=>({dom:(0,w.renderDiagnosticList)(n,O())})):et(c,()=>tt({view:t,provider:z,position:l,pending:u,readTheme:O}))}))]:[],(0,w.createDiagnosticsExtension)({readTheme:()=>D}),(0,k.createOverviewRulerExtension)({readTheme:()=>D}),l.EditorView.domEventHandlers({mousedown:(t,n)=>{if(!o.onGoToDefinitionShortcut||!t.ctrlKey&&!t.metaKey)return!1;const c=n.posAtCoords({x:t.clientX,y:t.clientY});return null!==c&&(n.dispatch({selection:{anchor:c},userEvent:"select.pointer"}),n.focus(),o.onGoToDefinitionShortcut(),t.preventDefault(),!0)},contextmenu:(t,n)=>{if(!o.onContextMenu)return!1;const c=n.posAtCoords({x:t.clientX,y:t.clientY}),{main:s}=n.state.selection;return null!==c&&(s.empty||c<s.from||c>s.to)&&n.dispatch({selection:{anchor:c},userEvent:"select.pointer"}),n.focus(),o.onContextMenu({x:t.clientX,y:t.clientY}),t.preventDefault(),!0}}),Y(o.path),(0,v.markdownLivePreviewExtension)(o.markdownLivePreview??!1),(0,p.markdownImageDropHandler)(o.onImageDrop),p.markdownPasteHandler,u.of([G(o.theme),_(o.theme)]),h.of(o.wordWrap?l.EditorView.lineWrapping:[]),o.hideNativeScrollbar?U:[],l.EditorView.updateListener.of(t=>{const n=t.transactions.some(t=>t.annotation(E));if(t.docChanged&&o.onDocChanged?.(),t.docChanged&&!n&&(T(t.state.doc),B(t.view)),L&&(t.docChanged||t.selectionSet)&&N(t.view),(t.selectionSet||t.docChanged)&&o.onCursorMoved?.(q(t.state)),t.selectionSet&&o.onPointerSelect){if(t.transactions.some(t=>t.isUserEvent("select.pointer"))){const n=t.state.selection.main.head,c=t.view.lineBlockAt(n);o.onPointerSelect({line:t.state.doc.lineAt(n).number,lineCount:t.state.doc.lines,viewportOffsetY:c.top-t.view.scrollDOM.scrollTop})}}})]}),P=new l.EditorView({state:I,parent:o.parent});var z,O;let V=!1;y=null==o.cleanDoc||o.cleanDoc===o.doc?I.doc:s.Text.of(o.cleanDoc.split("\n")),T(I.doc),o.onCursorMoved?.(q(P.state)),void 0!==o.diagnostics&&o.diagnostics.length>0&&P.dispatch({effects:w.setEditorDiagnostics.of(o.diagnostics)});const K=()=>{if(P.focus(),"function"!=typeof requestAnimationFrame)return;let t=0;const o=()=>{V||P.hasFocus||t>=M||(t+=1,P.focus(),requestAnimationFrame(o))};requestAnimationFrame(o)},j=()=>{const t=P.scrollDOM;if(t.clientHeight<=0)return null;const o=P.lineBlockAtHeight(t.scrollTop);return{scrollTop:t.scrollTop,scrollHeight:t.scrollHeight,clientHeight:t.clientHeight,topLine:P.state.doc.lineAt(Math.min(o.from,P.state.doc.length)).number,lineCount:P.state.doc.lines}};let ot=!1;const rt=t=>{const o=P.scrollDOM,n=Math.max(0,o.scrollHeight-o.clientHeight),c=Math.max(0,Math.min(t,n));Math.abs(o.scrollTop-c)<.5||(ot=!0,o.scrollTop=c)};let it=null;const at=()=>{ot?ot=!1:o.onScrolled&&null===it&&(it=requestAnimationFrame(()=>{it=null;const t=j();t&&o.onScrolled?.(t)}))};return P.scrollDOM.addEventListener("scroll",at,{passive:!0}),{getDoc:()=>P.state.doc.toString(),getSelection:()=>{const t=P.state.selection.main;return{text:P.state.sliceDoc(t.from,t.to),lineStart:P.state.doc.lineAt(t.from).number,lineEnd:P.state.doc.lineAt(t.to).number,isEmpty:t.empty}},getWordAtCursor:()=>{const t=P.state.selection.main.head,o=P.state.doc.lineAt(t);return(0,C.findWordAtCursor)(o.text,t-o.from+1)},setDoc:t=>{P.dispatch({changes:{from:0,to:P.state.doc.length,insert:t},annotations:E.of(!0)}),H(P.state.doc)},setCleanDoc:t=>{const o=P.state.doc,n=t.length===o.length&&t===o.toString();H(n?o:s.Text.of(t.split("\n")))},setFind:t=>{if(!t||!t.search)return L=!1,(0,c.closeSearchPanel)(P),void o.onMatchInfo?.(null);L=!0,(0,c.openSearchPanel)(P),P.dispatch({effects:c.setSearchQuery.of(Q(t))}),N(P)},findNext:()=>{(0,c.findNext)(P),B(P)},findPrevious:()=>{(0,c.findPrevious)(P),B(P)},replaceNext:()=>{(0,c.replaceNext)(P),B(P)},replaceAll:()=>{(0,c.replaceAll)(P)},focus:()=>{K()},goToLine:t=>{const o=Math.max(1,Math.min(t,P.state.doc.lines)),n=P.state.doc.line(o);P.dispatch({selection:{anchor:n.from},effects:l.EditorView.scrollIntoView(n.from,{y:"center"})}),B(P),K()},selectLines:(t,o,n)=>{const c=P.state.doc.lines,s=Math.max(1,Math.min(t,c)),u=Math.max(s,Math.min(o,c)),h=P.state.doc.line(s),p=P.state.doc.line(u),f=n?.reveal??!0;P.dispatch(Object.assign({selection:{anchor:p.to,head:h.from}},f?{effects:l.EditorView.scrollIntoView(h.from,{y:"center"})}:null)),f&&B(P),K()},selectAll:()=>{P.dispatch({selection:{anchor:0,head:P.state.doc.length}}),K()},replaceSelection:t=>{const{main:o}=P.state.selection;P.dispatch({changes:{from:o.from,to:o.to,insert:t},selection:{anchor:o.from+t.length},userEvent:"input.paste"}),K()},getScrollMetrics:()=>j(),scrollToFraction:t=>{const o=P.scrollDOM,n=Math.max(0,o.scrollHeight-o.clientHeight),c=Math.max(0,Math.min(t,1));rt(c*n)},scrollToLineAtOffset:(t,o)=>{const n=Math.max(1,Math.min(Math.floor(t),P.state.doc.lines)),c=P.lineBlockAt(P.state.doc.line(n).from);rt(c.top-o)},setTheme:t=>{D=t,P.dispatch({effects:u.reconfigure([G(t),_(t)])})},setWordWrap:t=>{P.dispatch({effects:h.reconfigure(t?l.EditorView.lineWrapping:[])})},setKeyBindings:t=>{P.dispatch({effects:b.reconfigure(J(o,t))})},setMarkdownLivePreview:t=>{P.dispatch({effects:v.setMarkdownLivePreview.of(t)})},setMarkdownLinkTargets:t=>{P.dispatch({effects:f.setMarkdownLinkTargetsEffect.of(t)})},runMarkdownCommand:t=>(P.focus(),(0,p.getMarkdownCommand)(t)(P)),setDiagnostics:t=>{P.dispatch({effects:w.setEditorDiagnostics.of(t)})},destroy:()=>{V=!0,null!==it&&(cancelAnimationFrame(it),it=null),null!==W&&(cancelAnimationFrame(W),W=null),P.scrollDOM.removeEventListener("scroll",at),P.destroy()}}};var t=r(d[0]),o=r(d[1]),n=r(d[2]),c=r(d[3]),s=r(d[4]),l=r(d[5]),u=r(d[6]),h=r(d[7]),p=r(d[8]),f=r(d[9]),v=r(d[10]),b=r(d[11]),x=r(d[12]),w=r(d[13]),k=r(d[14]),y=r(d[15]),C=r(d[16]);const S=999,M=4,E=s.Annotation.define(),D=12,L=220,$=3,A=1.5,F=120,T=400,H=15e3,N=11,W=11,R=6,B="62%",I="calc(38% - 2px)";function P(t,o){return{textDecorationLine:"underline",textDecorationStyle:o,textDecorationColor:t,textDecorationSkipInk:"none",textUnderlineOffset:"3px",textDecorationThickness:"wavy"===o?"1px":"2px"}}const z=700,O=6;function V(t){if(null===t.rulerColumn)return{};const o=`calc(${O}px + ${t.rulerColumn}ch)`;return{backgroundImage:`linear-gradient(to right, transparent calc(${o} - 1px), ${t.rulerColor} calc(${o} - 1px), ${t.rulerColor} ${o}, transparent ${o})`,backgroundRepeat:"no-repeat"}}function K(t){return t.overviewRulerWidth<=0?{}:{".cm-otto-overview":{position:"absolute",top:"0",right:"0",bottom:"0",width:`${t.overviewRulerWidth}px`,backgroundColor:t.overviewRulerBackground,borderLeft:`1px solid ${t.overviewRulerBorder}`,zIndex:"5",cursor:"pointer",touchAction:"none",userSelect:"none",WebkitUserSelect:"none"},".cm-otto-overview-marks":{position:"absolute",inset:"0",pointerEvents:"none"},".cm-otto-overview-mark":{position:"absolute",top:"0",borderRadius:"1px"},".cm-otto-overview-mark-problem":{left:"1px",width:B},".cm-otto-overview-mark-error":{backgroundColor:t.diagnostic.error},".cm-otto-overview-mark-warning":{backgroundColor:t.diagnostic.warning},".cm-otto-overview-mark-info":{backgroundColor:t.diagnostic.info},".cm-otto-overview-mark-hint":{backgroundColor:t.diagnostic.hint},".cm-otto-overview-mark-match":{right:"1px",width:I,backgroundColor:t.overviewRulerMatch},".cm-otto-overview-mark-match-active":{left:"1px",right:"1px",width:"auto"},".cm-otto-overview-selections":{position:"absolute",inset:"0",pointerEvents:"none"},".cm-otto-overview-band":{position:"absolute",top:"0",left:"0",right:"0",backgroundColor:t.overviewRulerSelection},".cm-otto-overview-cursor":{position:"absolute",top:"0",left:"0",right:"0",height:"2px",backgroundColor:t.overviewRulerCursor,pointerEvents:"none"},".cm-otto-overview-thumb":{position:"absolute",top:"0",left:"0",right:"0",backgroundColor:t.overviewRulerThumb,pointerEvents:"none"},".cm-scroller::-webkit-scrollbar:vertical":{display:"none",width:"0"}}}function q(t){const o=t.selection.main,n=t.doc.lineAt(o.head);return{line:n.number,column:o.head-n.from+1,selectedChars:o.to-o.from,selectedLines:o.empty?0:t.doc.lineAt(o.to).number-t.doc.lineAt(o.from).number+1}}function G(t){return l.EditorView.theme(Object.assign({"&":{backgroundColor:t.background,color:t.foreground,fontSize:`${t.fontSize}px`,height:"100%"},".cm-scroller":{fontFamily:t.fontFamily,lineHeight:`${t.lineHeight}px`,overflow:"auto",paddingRight:`${Math.max(0,t.overviewRulerWidth)}px`},".cm-content":Object.assign({caretColor:t.cursor,minHeight:"100%",boxSizing:"border-box"},V(t)),".cm-line":{paddingLeft:`${O}px`,paddingRight:"2px"},".cm-cursor, .cm-dropCursor":{borderLeftColor:t.cursor,borderLeftWidth:`${t.cursorWidth}px`},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:t.selectionBackground},".cm-activeLine":{backgroundColor:t.activeLineBackground},".cm-gutters":{backgroundColor:t.gutterBackground,color:t.gutterForeground,border:"none",borderRight:`1px solid ${t.gutterBorder}`,paddingRight:"2px",position:"sticky",insetInlineStart:0,minHeight:"100%",cursor:"default",userSelect:"none",WebkitUserSelect:"none"},".cm-activeLineGutter":{backgroundColor:t.activeLineBackground,color:t.gutterActiveForeground},".cm-searchMatch":{backgroundColor:t.searchMatchBackground,outline:`1px solid ${t.searchMatchBorder}`,borderRadius:"2px"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:t.activeSearchMatchBackground,outline:`2px solid ${t.activeSearchMatchBorder}`},".cm-panels":{display:"none"},".cm-tooltip":{backgroundColor:t.tooltipBackground,color:t.foreground,border:`1px solid ${t.tooltipBorder}`,borderRadius:"6px",boxShadow:t.tooltipShadow},".cm-otto-hover":{maxWidth:"560px",maxHeight:"280px",overflow:"auto",scrollbarGutter:"stable",scrollbarWidth:"thin",scrollbarColor:"transparent transparent"},".cm-otto-hover:hover":{scrollbarColor:`${t.scrollbarHandle} transparent`},".cm-otto-hover::-webkit-scrollbar":{width:`${D}px`,height:`${D}px`},".cm-otto-hover::-webkit-scrollbar-track":{backgroundColor:"transparent"},".cm-otto-hover::-webkit-scrollbar-thumb":{backgroundColor:"transparent",borderRadius:"999px",border:`${$}px solid transparent`,backgroundClip:"content-box",transition:`background-color ${L}ms`},".cm-otto-hover:hover::-webkit-scrollbar-thumb":{backgroundColor:t.scrollbarHandle},".cm-otto-hover::-webkit-scrollbar-thumb:hover":{backgroundColor:t.scrollbarHandle,borderWidth:`${A}px`},".cm-otto-hover::-webkit-scrollbar-corner":{backgroundColor:"transparent"},".cm-otto-hover-code":{margin:"0",padding:"8px 10px",backgroundColor:"transparent",color:t.foreground,fontFamily:t.fontFamily,fontSize:`${t.fontSize}px`,lineHeight:"1.5",whiteSpace:"pre-wrap",overflowWrap:"anywhere"},".cm-otto-hover-prose":{padding:"8px 10px",color:t.gutterForeground,fontFamily:"system-ui, -apple-system, Segoe UI, sans-serif",fontSize:`${Math.max(11,t.fontSize-1)}px`,lineHeight:"1.5",whiteSpace:"pre-wrap"},".cm-otto-hover-divider":{height:"1px",backgroundColor:t.tooltipBorder},".cm-otto-hover-pending":{display:"flex",alignItems:"center",gap:"8px",padding:"8px 10px",color:t.gutterForeground,fontFamily:"system-ui, -apple-system, Segoe UI, sans-serif",lineHeight:"1.5"},".cm-otto-hover-spinner":{display:"inline-block",flex:"0 0 auto",width:`${N}px`,height:`${N}px`,borderRadius:"999px",border:`1.5px solid ${t.tooltipBorder}`,borderTopColor:t.gutterForeground,animation:`cm-otto-hover-spin ${z}ms linear infinite`},"@keyframes cm-otto-hover-spin":{to:{transform:"rotate(360deg)"}},".cm-otto-diagnostic-error":P(t.diagnostic.error,"wavy"),".cm-otto-diagnostic-warning":P(t.diagnostic.warning,"wavy"),".cm-otto-diagnostic-info":P(t.diagnostic.info,"wavy"),".cm-otto-diagnostic-hint":P(t.diagnostic.hint,"dotted"),".cm-otto-diagnostic-gutter":{minWidth:`${W}px`,cursor:"default"},".cm-otto-diagnostic-gutter .cm-gutterElement":{display:"flex",alignItems:"center",justifyContent:"center"},".cm-otto-diagnostic-dot":{flex:"0 0 auto",width:`${R}px`,height:`${R}px`,borderRadius:"999px",backgroundColor:"transparent"},".cm-otto-diagnostic-dot-error":{backgroundColor:t.diagnostic.error},".cm-otto-diagnostic-dot-warning":{backgroundColor:t.diagnostic.warning},".cm-otto-diagnostic-dot-info":{backgroundColor:t.diagnostic.info},".cm-otto-diagnostic-dot-hint":{backgroundColor:t.diagnostic.hint},".cm-otto-diagnostic-card":{fontFamily:"system-ui, -apple-system, Segoe UI, sans-serif"},".cm-otto-diagnostic-entry":{padding:"8px 10px",display:"flex",flexDirection:"column",gap:"4px"},".cm-otto-diagnostic-headline":{display:"flex",alignItems:"flex-start",gap:"7px",color:t.foreground,fontSize:`${Math.max(11,t.fontSize-1)}px`,lineHeight:"1.45"},".cm-otto-diagnostic-badge":{flex:"0 0 auto",width:`${R}px`,height:`${R}px`,borderRadius:"999px",marginTop:"5px"},".cm-otto-diagnostic-help":{paddingLeft:"13px",color:t.gutterForeground,fontSize:`${Math.max(10,t.fontSize-2)}px`,lineHeight:"1.45"},".cm-otto-diagnostic-source":{display:"block",paddingLeft:"13px",color:t.gutterForeground,fontFamily:t.fontFamily,fontSize:`${Math.max(10,t.fontSize-3)}px`,textDecoration:"none"},".cm-otto-diagnostic-link":{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"},".cm-otto-diagnostic-link:hover":{color:t.foreground}},K(t)))}const U=l.EditorView.theme({".cm-scroller":{scrollbarWidth:"none"},".cm-scroller::-webkit-scrollbar":{display:"none",width:"0",height:"0"}});function _(t){const o=t.syntax,c=n.HighlightStyle.define([{tag:u.tags.keyword,color:o.keyword},{tag:u.tags.controlKeyword,color:o.keyword},{tag:u.tags.operatorKeyword,color:o.keyword},{tag:u.tags.definitionKeyword,color:o.keyword},{tag:u.tags.moduleKeyword,color:o.keyword},{tag:u.tags.comment,color:o.comment},{tag:u.tags.lineComment,color:o.comment},{tag:u.tags.blockComment,color:o.comment},{tag:u.tags.docComment,color:o.comment},{tag:u.tags.string,color:o.string},{tag:u.tags.special(u.tags.string),color:o.string},{tag:u.tags.number,color:o.number},{tag:u.tags.integer,color:o.number},{tag:u.tags.float,color:o.number},{tag:u.tags.bool,color:o.literal},{tag:u.tags.null,color:o.literal},{tag:u.tags.function(u.tags.variableName),color:o.function},{tag:u.tags.function(u.tags.propertyName),color:o.function},{tag:u.tags.definition(u.tags.variableName),color:o.definition},{tag:u.tags.definition(u.tags.propertyName),color:o.definition},{tag:u.tags.definition(u.tags.function(u.tags.variableName)),color:o.definition},{tag:u.tags.className,color:o.class},{tag:u.tags.definition(u.tags.className),color:o.class},{tag:u.tags.typeName,color:o.type},{tag:u.tags.tagName,color:o.tag},{tag:u.tags.attributeName,color:o.attribute},{tag:u.tags.attributeValue,color:o.string},{tag:u.tags.propertyName,color:o.property},{tag:u.tags.variableName,color:o.variable},{tag:u.tags.local(u.tags.variableName),color:o.variable},{tag:u.tags.special(u.tags.variableName),color:o.variable},{tag:u.tags.operator,color:o.operator},{tag:u.tags.punctuation,color:o.punctuation},{tag:u.tags.bracket,color:o.punctuation},{tag:u.tags.separator,color:o.punctuation},{tag:u.tags.regexp,color:o.regexp},{tag:u.tags.escape,color:o.escape},{tag:u.tags.meta,color:o.meta},{tag:u.tags.heading,color:o.heading},{tag:u.tags.link,color:o.link},{tag:u.tags.strong,fontWeight:"bold"},{tag:u.tags.emphasis,fontStyle:"italic"},{tag:u.tags.strikethrough,textDecoration:"line-through"},{tag:u.tags.monospace,color:o.string},{tag:u.tags.heading1,color:o.heading,fontWeight:"bold",fontSize:"1.5em"},{tag:u.tags.heading2,color:o.heading,fontWeight:"bold",fontSize:"1.3em"},{tag:u.tags.heading3,color:o.heading,fontWeight:"bold",fontSize:"1.15em"},{tag:u.tags.heading4,color:o.heading,fontWeight:"bold"},{tag:u.tags.heading5,color:o.heading,fontWeight:"bold"},{tag:u.tags.heading6,color:o.heading,fontWeight:"bold"},{tag:u.tags.processingInstruction,color:o.punctuation},{tag:u.tags.contentSeparator,color:o.punctuation},{tag:u.tags.quote,color:o.comment,fontStyle:"italic"},{tag:u.tags.list,color:o.punctuation},{tag:u.tags.url,color:o.link,textDecoration:"underline"}]);return(0,n.syntaxHighlighting)(c,{fallback:!0})}function j(t){const o=t.trim().split(/\s+/,1)[0]?.toLowerCase();if(!o)return null;const n=(0,y.filenameForHoverLanguage)(o);if(null!==n){const t=(0,h.getLanguageForFile)(n);if(t)return t}return(0,h.getLanguageForFile)(`fence.${o}`)}function Y(t){if((0,b.isMarkdownPath)(t))return[(0,o.markdown)({base:o.markdownLanguage,codeLanguages:j,completeHTMLTags:!0}),(0,f.markdownCompletionExtension)(t)];const c=(0,h.getParserForFile)(t);return c?new n.Language((0,n.defineLanguageFacet)(),c).extension:[]}function Q(t){return new c.SearchQuery({search:t.search,replace:t.replace,caseSensitive:t.caseSensitive,wholeWord:t.wholeWord,regexp:t.regexp})}function X(t,o,n){const c=n;if(0!==c.button)return!1;const{state:s}=t,l=s.selection.main.head,u=l-s.doc.lineAt(l).from,h=s.doc.lineAt(o.from);return t.dispatch({selection:{anchor:Math.min(h.from+u,h.to)},userEvent:"select.pointer"}),t.focus(),c.preventDefault(),!0}function J(t,o){const n={save:t.onSaveShortcut,find:t.onFindShortcut,goToLine:t.onGoToLineShortcut,goToDefinition:t.onGoToDefinitionShortcut,findReferences:t.onFindReferencesShortcut,renameSymbol:t.onRenameSymbolShortcut};return l.keymap.of(o.map(t=>({key:t.key,run:o=>{if((0,p.isMarkdownCommandName)(t.action))return(0,p.getMarkdownCommand)(t.action)(o);const c=n[t.action];return!!c&&(c(),!0)}})))}function Z(t,o,n){if(0===t.length)return o;const c=(0,w.renderDiagnosticList)(t,n),s=document.createElement("div");return s.className="cm-otto-hover-divider",c.appendChild(s),c.append(...o.childNodes),c}function tt(t){const{view:o,provider:n,position:c,pending:s,readTheme:u}=t,h=ot(u()),p=Date.now()+H;let f=!1;function v(){x({kind:"unavailable"})}function b(){f||n(c).then(x,v)}function x(t){f||("content"!==t.kind?"warming"===t.kind&&Date.now()<p?window.setTimeout(b,T):o.dispatch({effects:l.closeHoverTooltips}):h.replaceWith(nt(t.markdown,u())))}return s.then(x,v),{dom:h.dom,destroy:()=>{f=!0}}}function et(t,o){return{pos:t.from,end:t.to,above:!0,create:o}}function ot(t){const o=document.createElement("div");o.className="cm-otto-hover cm-otto-hover-pending";const n=document.createElement("span");n.className="cm-otto-hover-spinner",o.appendChild(n);const c=document.createElement("span");return c.textContent="Loading\u2026",c.style.fontSize=`${Math.max(11,t.fontSize-1)}px`,o.appendChild(c),{dom:o,replaceWith:t=>{o.className=t.className,o.replaceChildren(...t.childNodes)}}}function nt(t,o){const n=document.createElement("div");n.className="cm-otto-hover";return(0,y.parseHoverMarkdown)(t).forEach((t,c)=>{if(c>0){const t=document.createElement("div");t.className="cm-otto-hover-divider",n.appendChild(t)}n.appendChild("code"===t.kind?rt(t,o):it(t))}),n}function rt(t,o){const n=document.createElement("pre");n.className="cm-otto-hover-code";const c=(0,y.filenameForHoverLanguage)(t.language);if(null===c)return n.textContent=t.text,n;return(0,h.highlightCode)(t.text,c).forEach((t,c)=>{c>0&&n.appendChild(document.createTextNode("\n"));for(const c of t){if(null===c.style){n.appendChild(document.createTextNode(c.text));continue}const t=document.createElement("span");t.textContent=c.text,t.style.color=o.syntax[c.style],n.appendChild(t)}}),n}function it(t){const o=document.createElement("div");return o.className="cm-otto-hover-prose",o.textContent=(0,y.plainProse)(t.text),o}},4589,[4590,4591,310,4596,312,314,318,308,4597,4602,4604,4605,4606,4607,4608,4610,4611]);
16240
16240
  __d(function(g,_r,_i,_a2,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"addCursorAbove",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(_e,"addCursorBelow",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(_e,"blockComment",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"blockUncomment",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"copyLineDown",{enumerable:!0,get:function(){return tn}}),Object.defineProperty(_e,"copyLineUp",{enumerable:!0,get:function(){return en}}),Object.defineProperty(_e,"cursorCharBackward",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(_e,"cursorCharBackwardLogical",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(_e,"cursorCharForward",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(_e,"cursorCharForwardLogical",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(_e,"cursorCharLeft",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(_e,"cursorCharRight",{enumerable:!0,get:function(){return re}}),Object.defineProperty(_e,"cursorDocEnd",{enumerable:!0,get:function(){return St}}),Object.defineProperty(_e,"cursorDocStart",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(_e,"cursorGroupBackward",{enumerable:!0,get:function(){return he}}),Object.defineProperty(_e,"cursorGroupForward",{enumerable:!0,get:function(){return me}}),Object.defineProperty(_e,"cursorGroupForwardWin",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(_e,"cursorGroupLeft",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(_e,"cursorGroupRight",{enumerable:!0,get:function(){return de}}),Object.defineProperty(_e,"cursorLineBoundaryBackward",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(_e,"cursorLineBoundaryForward",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(_e,"cursorLineBoundaryLeft",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(_e,"cursorLineBoundaryRight",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(_e,"cursorLineDown",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(_e,"cursorLineEnd",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(_e,"cursorLineStart",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(_e,"cursorLineUp",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(_e,"cursorMatchingBracket",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(_e,"cursorPageDown",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(_e,"cursorPageUp",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(_e,"cursorSubwordBackward",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(_e,"cursorSubwordForward",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(_e,"cursorSyntaxLeft",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(_e,"cursorSyntaxRight",{enumerable:!0,get:function(){return je}}),Object.defineProperty(_e,"defaultKeymap",{enumerable:!0,get:function(){return On}}),Object.defineProperty(_e,"deleteCharBackward",{enumerable:!0,get:function(){return It}}),Object.defineProperty(_e,"deleteCharBackwardStrict",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(_e,"deleteCharForward",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(_e,"deleteGroupBackward",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(_e,"deleteGroupForward",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(_e,"deleteGroupForwardWin",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(_e,"deleteLine",{enumerable:!0,get:function(){return nn}}),Object.defineProperty(_e,"deleteLineBoundaryBackward",{enumerable:!0,get:function(){return Wt}}),Object.defineProperty(_e,"deleteLineBoundaryForward",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(_e,"deleteToLineEnd",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(_e,"deleteToLineStart",{enumerable:!0,get:function(){return Ht}}),Object.defineProperty(_e,"deleteTrailingWhitespace",{enumerable:!0,get:function(){return qt}}),Object.defineProperty(_e,"emacsStyleKeymap",{enumerable:!0,get:function(){return yn}}),Object.defineProperty(_e,"history",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"historyField",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"historyKeymap",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"indentLess",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(_e,"indentMore",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(_e,"indentSelection",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(_e,"indentWithTab",{enumerable:!0,get:function(){return kn}}),Object.defineProperty(_e,"insertBlankLine",{enumerable:!0,get:function(){return an}}),Object.defineProperty(_e,"insertNewline",{enumerable:!0,get:function(){return rn}}),Object.defineProperty(_e,"insertNewlineAndIndent",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(_e,"insertNewlineKeepIndent",{enumerable:!0,get:function(){return on}}),Object.defineProperty(_e,"insertTab",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(_e,"invertedEffects",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"isolateHistory",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"lineComment",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"lineUncomment",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"moveLineDown",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(_e,"moveLineUp",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(_e,"redo",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"redoDepth",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"redoSelection",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"selectAll",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(_e,"selectCharBackward",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(_e,"selectCharBackwardLogical",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(_e,"selectCharForward",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(_e,"selectCharForwardLogical",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(_e,"selectCharLeft",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(_e,"selectCharRight",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(_e,"selectDocEnd",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(_e,"selectDocStart",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(_e,"selectGroupBackward",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(_e,"selectGroupForward",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(_e,"selectGroupForwardWin",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(_e,"selectGroupLeft",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(_e,"selectGroupRight",{enumerable:!0,get:function(){return et}}),Object.defineProperty(_e,"selectLine",{enumerable:!0,get:function(){return At}}),Object.defineProperty(_e,"selectLineBoundaryBackward",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(_e,"selectLineBoundaryForward",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(_e,"selectLineBoundaryLeft",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(_e,"selectLineBoundaryRight",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(_e,"selectLineDown",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(_e,"selectLineEnd",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(_e,"selectLineStart",{enumerable:!0,get:function(){return Ot}}),Object.defineProperty(_e,"selectLineUp",{enumerable:!0,get:function(){return st}}),Object.defineProperty(_e,"selectMatchingBracket",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(_e,"selectPageDown",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(_e,"selectPageUp",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(_e,"selectParentSyntax",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(_e,"selectSubwordBackward",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(_e,"selectSubwordForward",{enumerable:!0,get:function(){return it}}),Object.defineProperty(_e,"selectSyntaxLeft",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(_e,"selectSyntaxRight",{enumerable:!0,get:function(){return at}}),Object.defineProperty(_e,"simplifySelection",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(_e,"splitLine",{enumerable:!0,get:function(){return Kt}}),Object.defineProperty(_e,"standardKeymap",{enumerable:!0,get:function(){return bn}}),Object.defineProperty(_e,"temporarilySetTabFocusMode",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(_e,"toggleBlockComment",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"toggleBlockCommentByLine",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"toggleComment",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"toggleLineComment",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"toggleTabFocusMode",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(_e,"transposeChars",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(_e,"undo",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"undoDepth",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"undoSelection",{enumerable:!0,get:function(){return M}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),r=_r(d[3]);const o=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=p(e.state,n.from);return r.line?c(e):!!r.block&&h(e)};function i(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=e(t,n);return!!o&&(r(n.update(o)),!0)}}const c=i(P,0),l=i(P,1),a=i(P,2),u=i(k,0),s=i(k,1),f=i(k,2),h=i((e,t)=>k(e,t,O(t)),0);function p(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const y=50;function b(e,{open:t,close:n},r,o){let i,c,l=e.sliceDoc(r-y,r),a=e.sliceDoc(o,o+y),u=/\s*$/.exec(l)[0].length,s=/^\s*/.exec(a)[0].length,f=l.length-u;if(l.slice(f-t.length,f)==t&&a.slice(s,s+n.length)==n)return{open:{pos:r-u,margin:u&&1},close:{pos:o+s,margin:s&&1}};o-r<=100?i=c=e.sliceDoc(r,o):(i=e.sliceDoc(r,r+y),c=e.sliceDoc(o-y,o));let h=/^\s*/.exec(i)[0].length,p=/\s*$/.exec(c)[0].length,b=c.length-p-n.length;return i.slice(h,h+t.length)==t&&c.slice(b,b+n.length)==n?{open:{pos:r+h+t.length,margin:/\s/.test(i.charAt(h+t.length))?1:0},close:{pos:o-p-n.length,margin:/\s/.test(c.charAt(b-1))?1:0}}:null}function O(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),o=n.to<=r.to?r:e.doc.lineAt(n.to);o.from>r.from&&o.from==n.to&&(o=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let i=t.length-1;i>=0&&t[i].to>r.from?t[i].to=o.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return t}function k(e,t,n=t.selection.ranges){let r=n.map(e=>p(t,e.from).block);if(!r.every(e=>e))return null;let o=n.map((e,n)=>b(t,r[n],e.from,e.to));if(2!=e&&!o.every(e=>e))return{changes:t.changes(n.map((e,t)=>o[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]))};if(1!=e&&o.some(e=>e)){let e=[];for(let t,n=0;n<o.length;n++)if(t=o[n]){let o=r[n],{open:i,close:c}=t;e.push({from:i.pos-o.open.length,to:i.pos+i.margin},{from:c.pos-c.margin,to:c.pos+o.close.length})}return{changes:e}}return null}function P(e,t,n=t.selection.ranges){let r=[],o=-1;e:for(let{from:e,to:i}of n){let n,c=r.length,l=1e9;for(let c=e;c<=i;){let a=t.doc.lineAt(c);if(null==n&&(n=p(t,a.from).line,!n))continue e;if(a.from>o&&(e==i||i>a.from)){o=a.from;let e=/^\s*/.exec(a.text)[0].length,t=e==a.length,i=a.text.slice(e,e+n.length)==n?e:-1;e<a.text.length&&e<l&&(l=e),r.push({line:a,comment:i,token:n,indent:e,empty:t,single:!1})}c=a.to+1}if(l<1e9)for(let e=c;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=l);r.length==c+1&&(r[c].single=!0)}if(2!=e&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:o,empty:i,single:c}of r)!c&&i||e.push({from:t.from+o,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:o}of r)if(n>=0){let r=t.from+n,i=r+o.length;" "==t.text[i-t.from]&&i++,e.push({from:r,to:i})}return{changes:e}}return null}const S=e.Annotation.define(),w=e.Annotation.define(),v=e.Facet.define(),j=e.Facet.define({combine:t=>(0,e.combineConfig)(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),A=e.StateField.define({create:()=>$.empty,update(t,n){let r=n.state.facet(j),o=n.annotation(S);if(o){let e=R.fromTransaction(n,o.selection),i=o.side,c=0==i?t.undone:t.done;return c=e?F(c,c.length,r.minDepth,e):H(c,n.startState.selection),new $(0==i?o.rest:c,0==i?c:o.rest)}let i=n.annotation(w);if("full"!=i&&"before"!=i||(t=t.isolate()),!1===n.annotation(e.Transaction.addToHistory))return n.changes.empty?t:t.addMapping(n.changes.desc);let c=R.fromTransaction(n),l=n.annotation(e.Transaction.time),a=n.annotation(e.Transaction.userEvent);return c?t=t.addChanges(c,l,a,r,n):n.selection&&(t=t.addSelection(n.startState.selection,l,a,r.newGroupDelay)),"full"!=i&&"after"!=i||(t=t.isolate()),t},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new $(e.done.map(R.fromJSON),e.undone.map(R.fromJSON))});function C(e={}){return[A,j.of(e),t.EditorView.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?D:"historyRedo"==e.inputType?x:null;return!!n&&(e.preventDefault(),n(t))}})]}const B=A;function E(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let o=n.field(A,!1);if(!o)return!1;let i=o.pop(e,n,t);return!!i&&(r(i),!0)}}const D=E(0,!1),x=E(1,!1),M=E(0,!0),L=E(1,!0);function T(e){return function(t){let n=t.field(A,!1);if(!n)return 0;let r=0==e?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}const I=T(0),V=T(1);class R{constructor(e,t,n,r,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new R(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new R(t.changes&&e.ChangeSet.fromJSON(t.changes),[],t.mapped&&e.ChangeDesc.fromJSON(t.mapped),t.startSelection&&e.EditorSelection.fromJSON(t.startSelection),t.selectionsAfter.map(e.EditorSelection.fromJSON))}static fromTransaction(e,t){let n=G;for(let t of e.startState.facet(v)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new R(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,G)}static selection(e){return new R(void 0,G,void 0,void 0,e)}}function F(e,t,n,r){let o=t+1>n+20?t-n-1:0,i=e.slice(o,t);return i.push(r),i}function U(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,o,i)=>{for(let e=0;e<n.length;){let t=n[e++],c=n[e++];i>=t&&o<=c&&(r=!0)}}),r}function N(e,t){return e.length?t.length?e.concat(t):e:t}const G=[],J=200;function H(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-J));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),F(e,e.length-1,1e9,n.setSelAfter(r)))}return[R.selection([t])]}function W(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function z(e,t){if(!e.length)return e;let n=e.length,r=G;for(;n;){let o=q(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){let t=e.slice(0,n);return t[n-1]=o,t}t=o.mapped,n--,r=o.selectionsAfter}return r.length?[R.selection(r)]:G}function q(t,n,r){let o=N(t.selectionsAfter.length?t.selectionsAfter.map(e=>e.map(n)):G,r);if(!t.changes)return R.selection(o);let i=t.changes.map(n),c=n.mapDesc(t.changes,!0),l=t.mapped?t.mapped.composeDesc(c):c;return new R(i,e.StateEffect.mapEffects(t.effects,n),l,t.startSelection.map(c),o)}const K=/^(input\.type|delete)($|\.)/;class ${constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new $(this.done,this.undone):this}addChanges(t,n,r,o,i){let c=this.done,l=c[c.length-1];return c=l&&l.changes&&!l.changes.empty&&t.changes&&(!r||K.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime<o.newGroupDelay&&o.joinToEvent(i,U(l.changes,t.changes))||"input.type.compose"==r)?F(c,c.length-1,o.minDepth,new R(t.changes.compose(l.changes),N(e.StateEffect.mapEffects(t.effects,l.changes),l.effects),l.mapped,l.startSelection,G)):F(c,c.length,o.minDepth,t),new $(c,G,n,r)}addSelection(e,t,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:G;return o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(i=o[o.length-1],c=e,i.ranges.length==c.ranges.length&&0===i.ranges.filter((e,t)=>e.empty!=c.ranges[t].empty).length)?this:new $(H(this.done,e),this.undone,t,n);var i,c}addMapping(e){return new $(z(this.done,e),z(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let o=r[r.length-1],i=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):t.selection);if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:S.of({side:e,rest:W(r),selection:i}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let n=1==r.length?G:r.slice(0,r.length-1);return o.mapped&&(n=z(n,o.mapped)),t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:S.of({side:e,rest:n,selection:i}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}$.empty=new $(G,G);const _=[{key:"Mod-z",run:D,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:x,preventDefault:!0},{linux:"Ctrl-Shift-z",run:x,preventDefault:!0},{key:"Mod-u",run:M,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:L,preventDefault:!0}];function Q(t,n){return e.EditorSelection.create(t.ranges.map(n),t.mainIndex)}function X(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Y({state:e,dispatch:t},n){let r=Q(e.selection,n);return!r.eq(e.selection,!0)&&(t(X(e,r)),!0)}function Z(t,n){return e.EditorSelection.cursor(n?t.to:t.from)}function ee(e,t){return Y(e,n=>n.empty?e.moveByChar(n,t):Z(n,t))}function te(e){return e.textDirectionAt(e.state.selection.main.head)==t.Direction.LTR}const ne=e=>ee(e,!te(e)),re=e=>ee(e,te(e)),oe=e=>ee(e,!0),ie=e=>ee(e,!1);function ce(t,n,r){let o=n.head,i=t.doc.lineAt(o);return o=o==(r?i.to:i.from)?r?Math.min(t.doc.length,i.to+1):Math.max(0,i.from-1):i.from+(0,e.findClusterBreak)(i.text,o-i.from,r),e.EditorSelection.cursor(o,r?-1:1)}function le(e,t){return Y(e,n=>n.empty?ce(e.state,n,t):Z(n,t))}const ae=e=>le(e,!0),ue=e=>le(e,!1);function se(e,t){return Y(e,n=>n.empty?e.moveByGroup(n,t):Z(n,t))}const fe=e=>se(e,!te(e)),de=e=>se(e,te(e)),me=e=>se(e,!0),he=e=>se(e,!1);function pe(t,n,r){let o=t.state.charCategorizer(n),i=o(r),c=i!=e.CharCategory.Space;return t=>{let n=o(t);return n!=e.CharCategory.Space?c&&n==i:(c=!1,!0)}}const ge=e=>Y(e,t=>t.empty?e.moveByChar(t,!0,n=>pe(e,t.head,n)):Z(t,!0)),ye="undefined"!=typeof Intl&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function be(t,n,r){let o=t.state.charCategorizer(n.from),i=e.CharCategory.Space,c=n.from,l=0,a=!1,u=!1,s=!1,f=n=>{if(a)return!1;c+=r?n.length:-n.length;let f,h=o(n);if(h==e.CharCategory.Word&&n.charCodeAt(0)<128&&/[\W_]/.test(n)&&(h=-1),i==e.CharCategory.Space&&(i=h),i!=h)return!1;if(i==e.CharCategory.Word)if(n.toLowerCase()==n){if(!r&&u)return!1;s=!0}else if(s){if(r)return!1;a=!0}else{if(u&&r&&o(f=t.state.sliceDoc(c,c+1))==e.CharCategory.Word&&f.toLowerCase()==f)return!1;u=!0}return l++,!0},h=t.moveByChar(n,r,e=>(f(e),f));if(ye&&i==e.CharCategory.Word&&h.from==n.from+l*(r?1:-1)){let o=Math.min(n.head,h.head),i=Math.max(n.head,h.head),c=t.state.sliceDoc(o,i);if(c.length>1&&/[\u4E00-\uffff]/.test(c)){let t=Array.from(ye.segment(c));if(t.length>1)return r?e.EditorSelection.cursor(n.head+t[1].index,-1):e.EditorSelection.cursor(h.head+t[t.length-1].index,1)}}return h}function Oe(e,t){return Y(e,n=>n.empty?be(e,n,t):Z(n,t))}const ke=e=>Oe(e,!0),Pe=e=>Oe(e,!1);function Se(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function we(t,o,i){let c,l,a=(0,n.syntaxTree)(t).resolveInner(o.head),u=i?r.NodeProp.closedBy:r.NodeProp.openedBy;for(let e=o.head;;){let n=i?a.childAfter(e):a.childBefore(e);if(!n)break;Se(t,n,u)?a=n:e=i?n.to:n.from}return l=a.type.prop(u)&&(c=i?(0,n.matchBrackets)(t,a.from,1):(0,n.matchBrackets)(t,a.to,-1))&&c.matched?i?c.end.to:c.end.from:i?a.to:a.from,e.EditorSelection.cursor(l,i?-1:1)}const ve=e=>Y(e,t=>we(e.state,t,!te(e))),je=e=>Y(e,t=>we(e.state,t,te(e)));function Ae(e,t){return Y(e,n=>{if(!n.empty)return Z(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Ce=e=>Ae(e,!1),Be=e=>Ae(e,!0);function Ee(e){let n,r=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,o=0,i=0;if(r){for(let n of e.state.facet(t.EditorView.scrollMargins)){let t=n(e);(null==t?void 0:t.top)&&(o=Math.max(null==t?void 0:t.top,o)),(null==t?void 0:t.bottom)&&(i=Math.max(null==t?void 0:t.bottom,i))}n=e.scrollDOM.clientHeight-o-i}else n=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:o,marginBottom:i,selfScroll:r,height:Math.max(e.defaultLineHeight,n-5)}}function De(e,n){let r,o=Ee(e),{state:i}=e,c=Q(i.selection,t=>t.empty?e.moveVertically(t,n,o.height):Z(t,n));if(c.eq(i.selection))return!1;if(o.selfScroll){let n=e.coordsAtPos(i.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),a=l.top+o.marginTop,u=l.bottom-o.marginBottom;n&&n.top>a&&n.bottom<u&&(r=t.EditorView.scrollIntoView(c.main.head,{y:"start",yMargin:n.top-a}))}return e.dispatch(X(i,c),{effects:r}),!0}const xe=e=>De(e,!1),Me=e=>De(e,!0);function Le(t,n,r){let o=t.lineBlockAt(n.head),i=t.moveToLineBoundary(n,r);if(i.head==n.head&&i.head!=(r?o.to:o.from)&&(i=t.moveToLineBoundary(n,r,!1)),!r&&i.head==o.from&&o.length){let r=/^\s*/.exec(t.state.sliceDoc(o.from,Math.min(o.from+100,o.to)))[0].length;r&&n.head!=o.from+r&&(i=e.EditorSelection.cursor(o.from+r))}return i}const Te=e=>Y(e,t=>Le(e,t,!0)),Ie=e=>Y(e,t=>Le(e,t,!1)),Ve=e=>Y(e,t=>Le(e,t,!te(e))),Re=e=>Y(e,t=>Le(e,t,te(e))),Fe=t=>Y(t,n=>e.EditorSelection.cursor(t.lineBlockAt(n.head).from,1)),Ue=t=>Y(t,n=>e.EditorSelection.cursor(t.lineBlockAt(n.head).to,-1));function Ne(t,r,o){let i=!1,c=Q(t.selection,r=>{let c=(0,n.matchBrackets)(t,r.head,-1)||(0,n.matchBrackets)(t,r.head,1)||r.head>0&&(0,n.matchBrackets)(t,r.head-1,1)||r.head<t.doc.length&&(0,n.matchBrackets)(t,r.head+1,-1);if(!c||!c.end)return r;i=!0;let l=c.start.from==r.head?c.end.to:c.end.from;return o?e.EditorSelection.range(r.anchor,l):e.EditorSelection.cursor(l)});return!!i&&(r(X(t,c)),!0)}const Ge=({state:e,dispatch:t})=>Ne(e,t,!1),Je=({state:e,dispatch:t})=>Ne(e,t,!0);function He(t,n,r){let o=Q(t.state.selection,t=>{t.undirectional&&t.head>=t.anchor!=n&&(t=e.EditorSelection.range(t.head,t.anchor));let o=r(t);return e.EditorSelection.range(t.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return!o.eq(t.state.selection)&&(t.dispatch(X(t.state,o)),!0)}function We(e,t){return He(e,t,n=>e.moveByChar(n,t))}const ze=e=>We(e,!te(e)),qe=e=>We(e,te(e)),Ke=e=>We(e,!0),$e=e=>We(e,!1),Qe=e=>He(e,!0,t=>ce(e.state,t,!0)),Xe=e=>He(e,!1,t=>ce(e.state,t,!1));function Ye(e,t){return He(e,t,n=>e.moveByGroup(n,t))}const Ze=e=>Ye(e,!te(e)),et=e=>Ye(e,te(e)),tt=e=>Ye(e,!0),nt=e=>Ye(e,!1),rt=e=>He(e,!0,t=>e.moveByChar(t,!0,n=>pe(e,t.head,n)));function ot(e,t){return He(e,t,n=>be(e,n,t))}const it=e=>ot(e,!0),ct=e=>ot(e,!1),lt=e=>{let t=!te(e);return He(e,t,n=>we(e.state,n,t))},at=e=>{let t=te(e);return He(e,t,n=>we(e.state,n,t))};function ut(e,t){return He(e,t,n=>e.moveVertically(n,t))}const st=e=>ut(e,!1),ft=e=>ut(e,!0);function dt(e,t){return He(e,t,n=>e.moveVertically(n,t,Ee(e).height))}const mt=e=>dt(e,!1),ht=e=>dt(e,!0),pt=e=>He(e,!0,t=>Le(e,t,!0)),gt=e=>He(e,!1,t=>Le(e,t,!1)),yt=e=>{let t=!te(e);return He(e,t,n=>Le(e,n,t))},bt=e=>{let t=te(e);return He(e,t,n=>Le(e,n,t))},Ot=t=>He(t,!1,n=>e.EditorSelection.cursor(t.lineBlockAt(n.head).from)),kt=t=>He(t,!0,n=>e.EditorSelection.cursor(t.lineBlockAt(n.head).to)),Pt=({state:e,dispatch:t})=>(t(X(e,{anchor:0})),!0),St=({state:e,dispatch:t})=>(t(X(e,{anchor:e.doc.length})),!0),wt=({state:e,dispatch:t})=>(t(X(e,{anchor:e.selection.main.anchor,head:0})),!0),vt=({state:e,dispatch:t})=>(t(X(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),jt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),At=({state:t,dispatch:n})=>{let r=_t(t).map(({from:n,to:r})=>e.EditorSelection.range(n,Math.min(r+1,t.doc.length)));return n(t.update({selection:e.EditorSelection.create(r),userEvent:"select"})),!0},Ct=({state:t,dispatch:r})=>{let o=Q(t.selection,r=>{let o=(0,n.syntaxTree)(t),i=o.resolveStack(r.from,1);if(r.empty){let e=o.resolveStack(r.from,-1);e.node.from>=i.node.from&&e.node.to<=i.node.to&&(i=e)}for(let t=i;t;t=t.next){let{node:n}=t;if((n.from<r.from&&n.to>=r.to||n.to>r.to&&n.from<=r.from)&&t.next)return e.EditorSelection.range(n.to,n.from)}return r});return!o.eq(t.selection)&&(r(X(t,o)),!0)};function Bt(t,n){let{state:r}=t,o=r.selection,i=r.selection.ranges.slice();for(let e of r.selection.ranges){let o=r.doc.lineAt(e.head);if(n?o.to<t.state.doc.length:o.from>0)for(let r=e;;){let e=t.moveVertically(r,n);if(e.head<o.from||e.head>o.to){i.some(t=>t.head==e.head)||i.push(e);break}if(e.head==r.head)break;r=e}}return i.length!=o.ranges.length&&(t.dispatch(X(r,e.EditorSelection.create(i,i.length-1))),!0)}const Et=e=>Bt(e,!1),Dt=e=>Bt(e,!0),xt=({state:t,dispatch:n})=>{let r=t.selection,o=null;return r.ranges.length>1?o=e.EditorSelection.create([r.main]):r.main.empty||(o=e.EditorSelection.create([e.EditorSelection.cursor(r.main.head)])),!!o&&(n(X(t,o)),!0)};function Mt(n,r){if(n.state.readOnly)return!1;let o="delete.selection",{state:i}=n,c=i.changeByRange(t=>{let{from:i,to:c}=t;if(i==c){let e=r(t);e<i?(o="delete.backward",e=Lt(n,e,!1)):e>i&&(o="delete.forward",e=Lt(n,e,!0)),i=Math.min(i,e),c=Math.max(c,e)}else i=Lt(n,i,!1),c=Lt(n,c,!0);return i==c?{range:t}:{changes:{from:i,to:c},range:e.EditorSelection.cursor(i,i<t.head?-1:1)}});return!c.changes.empty&&(n.dispatch(i.update(c,{scrollIntoView:!0,userEvent:o,effects:"delete.selection"==o?t.EditorView.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Lt(e,n,r){if(e instanceof t.EditorView)for(let o of e.state.facet(t.EditorView.atomicRanges).map(t=>t(e)))o.between(n,n,(e,t)=>{e<n&&t>n&&(n=r?t:e)});return n}const Tt=(t,r,o)=>Mt(t,i=>{let c,l,a=i.from,{state:u}=t,s=u.doc.lineAt(a);if(o&&!r&&a>s.from&&a<s.from+200&&!/[^ \t]/.test(c=s.text.slice(0,a-s.from))){if("\t"==c[c.length-1])return a-1;let t=(0,e.countColumn)(c,u.tabSize)%(0,n.getIndentUnit)(u)||(0,n.getIndentUnit)(u);for(let e=0;e<t&&" "==c[c.length-1-e];e++)a--;l=a}else l=(0,e.findClusterBreak)(s.text,a-s.from,r,r)+s.from,l==a&&s.number!=(r?u.doc.lines:1)?l+=r?1:-1:!r&&/[\ufe00-\ufe0f]/.test(s.text.slice(l-s.from,a-s.from))&&(l=(0,e.findClusterBreak)(s.text,l-s.from,!1,!1)+s.from);return l}),It=e=>Tt(e,!1,!0),Vt=e=>Tt(e,!1,!1),Rt=e=>Tt(e,!0,!1),Ft=(t,n)=>Mt(t,r=>{let o=r.head,{state:i}=t,c=i.doc.lineAt(o),l=i.charCategorizer(o);for(let t=null;;){if(o==(n?c.to:c.from)){o==r.head&&c.number!=(n?i.doc.lines:1)&&(o+=n?1:-1);break}let a=(0,e.findClusterBreak)(c.text,o-c.from,n)+c.from,u=c.text.slice(Math.min(o,a)-c.from,Math.max(o,a)-c.from),s=l(u);if(null!=t&&s!=t)break;" "==u&&o==r.head||(t=s),o=a}return o}),Ut=e=>Ft(e,!1),Nt=e=>Ft(e,!0),Gt=e=>Mt(e,t=>e.moveByChar(t,!0,n=>pe(e,t.head,n)).head),Jt=e=>Mt(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Ht=e=>Mt(e,t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)}),Wt=e=>Mt(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),zt=e=>Mt(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),qt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=[];for(let t=0,r="",o=e.doc.iter();;){if(o.next(),o.lineBreak||o.done){let e=r.search(/\s+$/);if(e>-1&&n.push({from:t-(r.length-e),to:t}),o.done)break;r=""}else r=o.value;t+=o.value.length}return!!n.length&&(t(e.update({changes:n,userEvent:"delete"})),!0)},Kt=({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e.Text.of(["",""])},range:e.EditorSelection.cursor(t.from)}));return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},$t=({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{if(!n.empty||0==n.from||n.from==t.doc.length)return{range:n};let r=n.from,o=t.doc.lineAt(r),i=r==o.from?r-1:(0,e.findClusterBreak)(o.text,r-o.from,!1)+o.from,c=r==o.to?r+1:(0,e.findClusterBreak)(o.text,r-o.from,!0)+o.from;return{changes:{from:i,to:c,insert:t.doc.slice(r,c).append(t.doc.slice(i,r))},range:e.EditorSelection.cursor(c)}});return!r.changes.empty&&(n(t.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function _t(e){let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.from),i=e.doc.lineAt(r.to);if(r.empty||r.to!=i.from||(i=e.doc.lineAt(r.to-1)),n>=o.number){let e=t[t.length-1];e.to=i.to,e.ranges.push(r)}else t.push({from:o.from,to:i.to,ranges:[r]});n=i.number+1}return t}function Qt(t,n,r){if(t.readOnly)return!1;let o=[],i=[];for(let n of _t(t)){if(r?n.to==t.doc.length:0==n.from)continue;let c=t.doc.lineAt(r?n.to+1:n.from-1),l=c.length+1;if(r){o.push({from:n.to,to:c.to},{from:n.from,insert:c.text+t.lineBreak});for(let r of n.ranges)i.push(e.EditorSelection.range(Math.min(t.doc.length,r.anchor+l),Math.min(t.doc.length,r.head+l)))}else{o.push({from:c.from,to:n.from},{from:n.to,insert:t.lineBreak+c.text});for(let t of n.ranges)i.push(e.EditorSelection.range(t.anchor-l,t.head-l))}}return!!o.length&&(n(t.update({changes:o,scrollIntoView:!0,selection:e.EditorSelection.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0)}const Xt=({state:e,dispatch:t})=>Qt(e,t,!1),Yt=({state:e,dispatch:t})=>Qt(e,t,!0);function Zt(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of _t(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let o=e.changes(r);return t(e.update({changes:o,selection:e.selection.map(o,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const en=({state:e,dispatch:t})=>Zt(e,t,!1),tn=({state:e,dispatch:t})=>Zt(e,t,!0),nn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(_t(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=Q(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),o=e.coordsAtPos(t.head,t.assoc||1);o&&(n=r.bottom+e.documentTop-o.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0},rn=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),on=({state:t,dispatch:n})=>(n(t.update(t.changeByRange(n=>{let r=/^\s*/.exec(t.doc.lineAt(n.from).text)[0];return{changes:{from:n.from,to:n.to,insert:t.lineBreak+r},range:e.EditorSelection.cursor(n.from+r.length+1)}}),{scrollIntoView:!0,userEvent:"input"})),!0);function cn(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let o,i=(0,n.syntaxTree)(e).resolveInner(t),c=i.childBefore(t),l=i.childAfter(t);return c&&l&&c.to<=t&&l.from>=t&&(o=c.type.prop(r.NodeProp.closedBy))&&o.indexOf(l.name)>-1&&e.doc.lineAt(c.to).from==e.doc.lineAt(l.from).from&&!/\S/.test(e.sliceDoc(c.to,l.from))?{from:c.to,to:l.from}:null}const ln=un(!1),an=un(!0);function un(t){return({state:r,dispatch:o})=>{if(r.readOnly)return!1;let i=r.changeByRange(o=>{let{from:i,to:c}=o,l=r.doc.lineAt(i),a=!t&&i==c&&cn(r,i);t&&(i=c=(c<=l.to?l:r.doc.lineAt(c)).to);let u=new n.IndentContext(r,{simulateBreak:i,simulateDoubleBreak:!!a}),s=(0,n.getIndentation)(u,i);for(null==s&&(s=(0,e.countColumn)(/^\s*/.exec(r.doc.lineAt(i).text)[0],r.tabSize));c<l.to&&/\s/.test(l.text[c-l.from]);)c++;a?({from:i,to:c}=a):i>l.from&&i<l.from+100&&!/\S/.test(l.text.slice(0,i))&&(i=l.from);let f=["",(0,n.indentString)(r,s)];return a&&f.push((0,n.indentString)(r,u.lineIndent(l.from,-1))),{changes:{from:i,to:c,insert:e.Text.of(f)},range:e.EditorSelection.cursor(i+1+f[1].length)}});return o(r.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function sn(t,n){let r=-1;return t.changeByRange(o=>{let i=[];for(let e=o.from;e<=o.to;){let c=t.doc.lineAt(e);c.number>r&&(o.empty||o.to>c.from)&&(n(c,i,o),r=c.number),e=c.to+1}let c=t.changes(i);return{changes:i,range:e.EditorSelection.range(c.mapPos(o.anchor,1),c.mapPos(o.head,1))}})}const fn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Object.create(null),o=new n.IndentContext(e,{overrideIndentation:e=>{let t=r[e];return null==t?-1:t}}),i=sn(e,(t,i,c)=>{let l=(0,n.getIndentation)(o,t.from);if(null==l)return;/\S/.test(t.text)||(l=0);let a=/^\s*/.exec(t.text)[0],u=(0,n.indentString)(e,l);(a!=u||c.from<t.from+a.length)&&(r[t.from]=l,i.push({from:t.from,to:t.from+a.length,insert:u}))});return i.changes.empty||t(e.update(i,{userEvent:"indent"})),!0},dn=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(sn(e,(t,r)=>{r.push({from:t.from,insert:e.facet(n.indentUnit)})}),{userEvent:"input.indent"})),!0),mn=({state:t,dispatch:r})=>!t.readOnly&&(r(t.update(sn(t,(r,o)=>{let i=/^\s*/.exec(r.text)[0];if(!i)return;let c=(0,e.countColumn)(i,t.tabSize),l=0,a=(0,n.indentString)(t,Math.max(0,c-(0,n.getIndentUnit)(t)));for(;l<i.length&&l<a.length&&i.charCodeAt(l)==a.charCodeAt(l);)l++;o.push({from:r.from+l,to:r.from+i.length,insert:a.slice(l)})}),{userEvent:"delete.dedent"})),!0),hn=e=>(e.setTabFocusMode(),!0),pn=e=>(e.setTabFocusMode(2e3),!0),gn=({state:e,dispatch:t})=>e.selection.ranges.some(e=>!e.empty)?dn({state:e,dispatch:t}):(t(e.update(e.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0),yn=[{key:"Ctrl-b",run:ne,shift:ze,preventDefault:!0},{key:"Ctrl-f",run:re,shift:qe},{key:"Ctrl-p",run:Ce,shift:st},{key:"Ctrl-n",run:Be,shift:ft},{key:"Ctrl-a",run:Fe,shift:Ot},{key:"Ctrl-e",run:Ue,shift:kt},{key:"Ctrl-d",run:Rt},{key:"Ctrl-h",run:It},{key:"Ctrl-k",run:Jt},{key:"Ctrl-Alt-h",run:Ut},{key:"Ctrl-o",run:Kt},{key:"Ctrl-t",run:$t},{key:"Ctrl-v",run:Me}],bn=[{key:"ArrowLeft",run:ne,shift:ze,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:fe,shift:Ze,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Ve,shift:yt,preventDefault:!0},{key:"ArrowRight",run:re,shift:qe,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:de,shift:et,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Re,shift:bt,preventDefault:!0},{key:"ArrowUp",run:Ce,shift:st,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Pt,shift:wt},{mac:"Ctrl-ArrowUp",run:xe,shift:mt},{key:"ArrowDown",run:Be,shift:ft,preventDefault:!0},{mac:"Cmd-ArrowDown",run:St,shift:vt},{mac:"Ctrl-ArrowDown",run:Me,shift:ht},{key:"PageUp",run:xe,shift:mt},{key:"PageDown",run:Me,shift:ht},{key:"Home",run:Ie,shift:gt,preventDefault:!0},{key:"Mod-Home",run:Pt,shift:wt},{key:"End",run:Te,shift:pt,preventDefault:!0},{key:"Mod-End",run:St,shift:vt},{key:"Enter",run:ln,shift:ln},{key:"Mod-a",run:jt},{key:"Backspace",run:It,shift:It,preventDefault:!0},{key:"Delete",run:Rt,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Ut,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Nt,preventDefault:!0},{mac:"Mod-Backspace",run:Wt,preventDefault:!0},{mac:"Mod-Delete",run:zt,preventDefault:!0}].concat(yn.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),On=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:ve,shift:lt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:je,shift:at},{key:"Alt-ArrowUp",run:Xt},{key:"Shift-Alt-ArrowUp",run:en},{key:"Alt-ArrowDown",run:Yt},{key:"Shift-Alt-ArrowDown",run:tn},{key:"Mod-Alt-ArrowUp",run:Et},{key:"Mod-Alt-ArrowDown",run:Dt},{key:"Escape",run:xt},{key:"Mod-Enter",run:an},{key:"Alt-l",mac:"Ctrl-l",run:At},{key:"Mod-i",run:Ct,preventDefault:!0},{key:"Mod-[",run:mn},{key:"Mod-]",run:dn},{key:"Mod-Alt-\\",run:fn},{key:"Shift-Mod-k",run:nn},{key:"Shift-Mod-\\",run:Ge},{key:"Mod-/",run:o},{key:"Alt-A",run:u},{key:"Ctrl-m",mac:"Shift-Alt-m",run:hn}].concat(bn),kn={key:"Tab",run:dn,shift:mn}},4590,[312,314,310,311]);
16241
16241
  __d(function(g,r,_i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"commonmarkLanguage",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"deleteMarkupBackward",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"insertNewlineContinueMarkup",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"insertNewlineContinueMarkupCommand",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"markdown",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"markdownKeymap",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"markdownLanguage",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"pasteURLAsLink",{enumerable:!0,get:function(){return q}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),i=r(d[4]),l=r(d[5]),s=r(d[6]);const f=(0,n.defineLanguageFacet)({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),u=new s.NodeProp,m=i.parser.configure({props:[n.foldNodeProp.add(e=>!e.is("Block")||e.is("Document")||null!=c(e)||p(e)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),u.add(c),n.indentNodeProp.add({Document:()=>null}),n.languageDataProp.add({Document:f})]});function c(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function p(e){return"OrderedList"==e.name||"BulletList"==e.name}function h(e,t){let n=e;for(;;){let e,o=n.nextSibling;if(!o||null!=(e=c(o.type))&&e<=t)break;n=o}return n.to}const k=n.foldService.of((e,t,o)=>{for(let i=(0,n.syntaxTree)(e).resolveInner(o,-1);i&&!(i.from<t);i=i.parent){let e=i.type.prop(u);if(null==e)continue;let t=h(i,e);if(t>o)return{from:o,to:t}}return null});function x(e){return new n.Language(f,e,[],"markdown")}const L=x(m),b=x(m.configure([i.GFM,i.Subscript,i.Superscript,i.Emoji,{props:[n.foldNodeProp.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]));class w{constructor(e,t,n,o,i,l,s){this.node=e,this.from=t,this.to=n,this.spaceBefore=o,this.spaceAfter=i,this.type=l,this.item=s}blank(e,t=!0){let n=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=e){for(;n.length<e;)n+=" ";return n}for(let e=this.to-this.from-n.length-this.spaceAfter.length;e>0;e--)n+=" ";return n+(t?this.spaceAfter:"")}marker(e,t){let n="OrderedList"==this.node.name?String(+A(this.item,e)[2]+t):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function y(e,t){let n=[],o=[];for(let t=e;t;t=t.parent){if("FencedCode"==t.name)return o;"ListItem"!=t.name&&"Blockquote"!=t.name||n.push(t)}for(let e=n.length-1;e>=0;e--){let i,l=n[e],s=t.lineAt(l.from),f=l.from-s.from;if("Blockquote"==l.name&&(i=/^ *>( ?)/.exec(s.text.slice(f))))o.push(new w(l,f,f+i[0].length,"",i[1],">",null));else if("ListItem"==l.name&&"OrderedList"==l.parent.name&&(i=/^( *)\d+([.)])( *)/.exec(s.text.slice(f)))){let e=i[3],t=i[0].length;e.length>=4&&(e=e.slice(0,e.length-4),t-=4),o.push(new w(l.parent,f,f+t,i[1],e,i[2],l))}else if("ListItem"==l.name&&"BulletList"==l.parent.name&&(i=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(s.text.slice(f)))){let e=i[4],t=i[0].length;e.length>4&&(e=e.slice(0,e.length-4),t-=4);let n=i[2];i[3]&&(n+=i[3].replace(/[xX]/,' ')),o.push(new w(l.parent,f,f+t,i[1],e,n,l))}}return o}function A(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function v(e,t,n,o=0){for(let i=-1,l=e;;){if("ListItem"==l.name){let e=A(l,t),s=+e[2];if(i>=0){if(s!=i+1)return;n.push({from:l.from+e[1].length,to:l.from+e[0].length,insert:String(i+2+o)})}i=s}let e=l.nextSibling;if(!e)break;l=e}}function B(t,o){let i=/^[ \t]*/.exec(t)[0].length;if(!i||"\t"!=o.facet(n.indentUnit))return t;let l="";for(let n=(0,e.countColumn)(t,4,i);n>0;)n>=4?(l+="\t",n-=4):(l+=" ",n--);return l+t.slice(i)}const C=(t={})=>({state:o,dispatch:i})=>{let l=(0,n.syntaxTree)(o),{doc:s}=o,f=null,u=o.changeByRange(n=>{if(!n.empty||!b.isActiveAt(o,n.from,-1)&&!b.isActiveAt(o,n.from,1))return f={range:n};let i=n.from,u=s.lineAt(i),m=y(l.resolveInner(i,-1),s);for(;m.length&&m[m.length-1].from>i-u.from;)m.pop();if(!m.length)return f={range:n};let c=m[m.length-1];if(c.to-c.spaceAfter.length>i-u.from)return f={range:n};let p=i>=c.to-c.spaceAfter.length&&!/\S/.test(u.text.slice(c.to));if(c.item&&p){let n=c.node.firstChild,l=c.node.getChild("ListItem","ListItem");if(n.to>=i||l&&l.to<i||u.from>0&&!/[^\s>]/.test(s.lineAt(u.from-1).text)||!1===t.nonTightLists){let t,n=m.length>1?m[m.length-2]:null,o="";n&&n.item?(t=u.from+n.from,o=n.marker(s,1)):t=u.from+(n?n.to:0);let l=[{from:t,to:i,insert:o}];return"OrderedList"==c.node.name&&v(c.item,s,l,-2),n&&"OrderedList"==n.node.name&&v(n.item,s,l),{range:e.EditorSelection.cursor(t+o.length),changes:l}}{let t=O(m,o,u);return{range:e.EditorSelection.cursor(i+t.length+1),changes:{from:u.from,insert:t+o.lineBreak}}}}if("Blockquote"==c.node.name&&p&&u.from){let e=s.lineAt(u.from-1),t=/>\s*$/.exec(e.text);if(t&&t.index==c.from){let i=o.changes([{from:e.from+t.index,to:e.to},{from:u.from+c.from,to:u.to}]);return{range:n.map(i),changes:i}}}let h=[];"OrderedList"==c.node.name&&v(c.item,s,h);let k=c.item&&c.item.from<u.from,x="";if(!k||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=c.to)for(let t=0,n=m.length-1;t<=n;t++)x+=t!=n||k?m[t].blank(t<n?(0,e.countColumn)(u.text,4,m[t+1].from)-x.length:null):m[t].marker(s,1);let L=i;for(;L>u.from&&/\s/.test(u.text.charAt(L-u.from-1));)L--;return x=B(x,o),I(c.node,o.doc)&&(x=O(m,o,u)+o.lineBreak+x),h.push({from:L,to:i,insert:o.lineBreak+x}),{range:e.EditorSelection.cursor(L+x.length+1),changes:h}});return!f&&(i(o.update(u,{scrollIntoView:!0,userEvent:"input"})),!0)},S=C();function P(e){return"QuoteMark"==e.name||"ListMark"==e.name}function I(e,t){if("OrderedList"!=e.name&&"BulletList"!=e.name)return!1;let n=e.firstChild,o=e.getChild("ListItem","ListItem");if(!o)return!1;let i=t.lineAt(n.to),l=t.lineAt(o.from),s=/^[\s>]*$/.test(i.text);return i.number+(s?0:1)<l.number}function O(t,n,o){let i="";for(let n=0,l=t.length-2;n<=l;n++)i+=t[n].blank(n<l?(0,e.countColumn)(o.text,4,t[n+1].from)-i.length:null,n<l);return B(i,n)}function E(e,t){let n=e.resolveInner(t,-1),o=t;P(n)&&(o=n.from,n=n.parent);for(let e;e=n.childBefore(o);)if(P(e))o=e.from;else{if("OrderedList"!=e.name&&"BulletList"!=e.name)break;n=e.lastChild,o=n.to}return n}const T=({state:t,dispatch:o})=>{let i=(0,n.syntaxTree)(t),l=null,s=t.changeByRange(n=>{let o=n.from,{doc:s}=t;if(n.empty&&b.isActiveAt(t,n.from)){let n=s.lineAt(o),l=y(E(i,o),s);if(l.length){let i=l[l.length-1],s=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(o-n.from>s&&!/\S/.test(n.text.slice(s,o-n.from)))return{range:e.EditorSelection.cursor(n.from+s),changes:{from:n.from+s,to:o}};if(o-n.from==s&&(i.item&&n.from<=i.item.from||/^[\s>]*$/.test(n.text.slice(0,i.to)))){let l=n.from+i.from;if(i.item&&i.node.from<i.item.from&&/\S/.test(n.text.slice(i.from,i.to))){let o=i.blank((0,e.countColumn)(n.text,4,i.to)-(0,e.countColumn)(n.text,4,i.from));return l==n.from&&(o=B(o,t)),{range:e.EditorSelection.cursor(l+o.length),changes:{from:l,to:n.from+i.to,insert:o}}}if(l<o)return{range:e.EditorSelection.cursor(l),changes:{from:l,to:o}}}}}return l={range:n}});return!l&&(o(t.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},j=[{key:"Enter",run:S},{key:"Backspace",run:T}],M=(0,l.html)({matchClosingTags:!1});function D(o={}){let{codeLanguages:l,defaultCodeLanguage:s,addKeymap:f=!0,base:{parser:u}=L,completeHTMLTags:m=!0,pasteURLAsLink:c=!0,htmlTagLanguage:p=M}=o;if(!(u instanceof i.MarkdownParser))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let h,b=o.extensions?[o.extensions]:[],w=[p.support,k];c&&w.push(q),s instanceof n.LanguageSupport?(w.push(s.support),h=s.language):s&&(h=s);let y=l||h?(A=l,v=h,e=>{if(e&&A){let t=null;if(e=/\S*/.exec(e)[0],t="function"==typeof A?A(e):n.LanguageDescription.matchLanguageName(A,e,!0),t instanceof n.LanguageDescription)return t.support?t.support.language.parser:n.ParseContext.getSkippingParser(t.load());if(t)return t.parser}return v?v.parser:null}):void 0;var A,v;b.push((0,i.parseCode)({codeParser:y,htmlParser:p.language.parser})),f&&w.push(e.Prec.high(t.keymap.of(j)));let B=x(u.configure(b));return m&&w.push(B.data.of({autocomplete:N})),new n.LanguageSupport(B,w)}function N(e){let{state:t,pos:o}=e,i=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(o-25,o));if(!i)return null;let l=(0,n.syntaxTree)(t).resolveInner(o,-1);for(;l&&!l.type.isTop;){if("CodeBlock"==l.name||"FencedCode"==l.name||"ProcessingInstructionBlock"==l.name||"CommentBlock"==l.name||"Link"==l.name||"Image"==l.name)return null;l=l.parent}return{from:o-i[0].length,to:o,options:F(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let $=null;function F(){if($)return $;let t=(0,l.htmlCompletionSource)(new o.CompletionContext(e.EditorState.create({extensions:M}),0,!0));return $=t?t.options:[]}const R=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,q=t.EditorView.domEventHandlers({paste:(e,t)=>{var o;let{main:i}=t.state.selection;if(i.empty)return!1;let l=null===(o=e.clipboardData)||void 0===o?void 0:o.getData("text/plain");if(!l||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(l))return!1;if(/^www\./.test(l)&&(l="https://"+l),!b.isActiveAt(t.state,i.from,1))return!1;let s=(0,n.syntaxTree)(t.state),f=!1;return s.iterate({from:i.from,to:i.to,enter:e=>{(e.from>i.from||R.test(e.name))&&(f=!0)},leave:e=>{e.to<i.to&&(f=!0)}}),!f&&(t.dispatch({changes:[{from:i.from,insert:"["},{from:i.to,insert:`](${l})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}})},4591,[312,314,310,4592,332,4593,311]);
16242
16242
  __d(function(g,_r,_i,_a2,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CompletionContext",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"acceptCompletion",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(_e,"autocompletion",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(_e,"clearSnippet",{enumerable:!0,get:function(){return me}}),Object.defineProperty(_e,"closeBrackets",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(_e,"closeBracketsKeymap",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(_e,"closeCompletion",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"completeAnyWord",{enumerable:!0,get:function(){return De}}),Object.defineProperty(_e,"completeFromList",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"completionKeymap",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(_e,"completionStatus",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(_e,"currentCompletions",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(_e,"deleteBracketPair",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(_e,"hasNextSnippetField",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(_e,"hasPrevSnippetField",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(_e,"ifIn",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"ifNotIn",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"insertBracket",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(_e,"insertCompletionText",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"moveCompletionSelection",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(_e,"nextSnippetField",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(_e,"pickedCompletion",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"prevSnippetField",{enumerable:!0,get:function(){return be}}),Object.defineProperty(_e,"selectedCompletion",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(_e,"selectedCompletionIndex",{enumerable:!0,get:function(){return at}}),Object.defineProperty(_e,"setSelectedCompletion",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(_e,"snippet",{enumerable:!0,get:function(){return de}}),Object.defineProperty(_e,"snippetCompletion",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(_e,"snippetKeymap",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(_e,"startCompletion",{enumerable:!0,get:function(){return X}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]);class i{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=(0,n.syntaxTree)(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),o=i.search(u(e,!1));return o<0?null:{from:n+o,to:this.pos,text:i.slice(o)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function o(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function s(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let e=1;e<i.length;e++)n[i[e]]=!0}let i=o(t)+o(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function r(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[n,i]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:s(t);return e=>{let o=e.matchBefore(i);return o||e.explicit?{from:o?o.from:e.pos,options:t,validFor:n}:null}}function l(e,t){return i=>{for(let o=(0,n.syntaxTree)(i.state).resolveInner(i.pos,-1);o;o=o.parent){if(e.indexOf(o.name)>-1)return t(i);if(o.type.isTop)break}return null}}function a(e,t){return i=>{for(let t=(0,n.syntaxTree)(i.state).resolveInner(i.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(i)}}class c{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function p(e){return e.selection.main.from}function u(e,t){var n;let{source:i}=e,o=t&&"^"!=i[0],s="$"!=i[i.length-1];return o||s?new RegExp(`${o?"^":""}(?:${i})${s?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const f=e.Annotation.define();function h(t,n,i,o){let{main:s}=t.selection,r=i-s.from,l=o-s.from;return Object.assign({},t.changeByRange(a=>{if(a!=s&&i!=o&&t.sliceDoc(a.from+r,a.from+l)!=t.sliceDoc(i,o))return{range:a};let c=t.toText(n);return{changes:{from:a.from+r,to:o==s.from?a.to:a.from+l,insert:c},range:e.EditorSelection.cursor(a.from+r+c.length)}}),{scrollIntoView:!0,userEvent:"input.complete"})}const m=new WeakMap;function b(e){if(!Array.isArray(e))return e;let t=m.get(e);return t||m.set(e,t=r(e)),t}const y=e.StateEffect.define(),v=e.StateEffect.define();class w{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<t.length;){let i=(0,e.codePointAt)(t,n),o=(0,e.codePointSize)(i);this.chars.push(i);let s=t.slice(n,n+o),r=s.toUpperCase();this.folded.push((0,e.codePointAt)(r==s?s.toLowerCase():r,0)),n+=o}this.astral=t.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(t){if(0==this.pattern.length)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:n,folded:i,any:o,precise:s,byWord:r}=this;if(1==n.length){let o=(0,e.codePointAt)(t,0),s=(0,e.codePointSize)(o),r=s==t.length?0:-100;if(o==n[0]);else{if(o!=i[0])return null;r+=-200}return this.ret(r,[0,s])}let l=t.indexOf(this.pattern);if(0==l)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=n.length,c=0;if(l<0){for(let s=0,r=Math.min(t.length,200);s<r&&c<a;){let r=(0,e.codePointAt)(t,s);r!=n[c]&&r!=i[c]||(o[c++]=s),s+=(0,e.codePointSize)(r)}if(c<a)return null}let p=0,u=0,f=!1,h=0,m=-1,b=-1,y=/[a-z]/.test(t),v=!0;for(let o=0,c=Math.min(t.length,200),w=0;o<c&&u<a;){let c=(0,e.codePointAt)(t,o);l<0&&(p<a&&c==n[p]&&(s[p++]=o),h<a&&(c==n[h]||c==i[h]?(0==h&&(m=o),b=o+1,h++):h=0));let x,C=c<255?c>=48&&c<=57||c>=97&&c<=122?2:c>=65&&c<=90?1:0:(x=(0,e.fromCodePoint)(c))!=x.toLowerCase()?1:x!=x.toUpperCase()?2:0;(!o||1==C&&y||0==w&&0!=C)&&(n[u]==c||i[u]==c&&(f=!0)?r[u++]=o:r.length&&(v=!1)),w=C,o+=(0,e.codePointSize)(c)}return u==a&&0==r[0]&&v?this.result((f?-200:0)-100,r,t):h==a&&0==m?this.ret(-200-t.length+(b==t.length?0:-100),[0,b]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):h==a?this.ret(-900-t.length,[m,b]):u==a?this.result((f?-200:0)-100-700+(v?0:-1100),r,t):2==n.length?null:this.result((o[0]?-700:0)-200-1100,o,t)}result(t,n,i){let o=[],s=0;for(let t of n){let n=t+(this.astral?(0,e.codePointSize)((0,e.codePointAt)(i,t)):1);s&&o[s-1]==t?o[s-1]=n:(o[s++]=t,o[s++]=n)}return this.ret(t-i.length,o)}}class x{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const C=e.Facet.define({combine:t=>(0,e.combineConfig)(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:O,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>P(e(n),t(n)),optionClass:(e,t)=>n=>P(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function P(e,t){return e?t?e+" "+t:e:t}function O(e,n,i,o,s,r){let l,a,c=e.textDirection==t.Direction.RTL,p=c,u=!1,f="top",h=n.left-s.left,m=s.right-n.right,b=o.right-o.left,y=o.bottom-o.top;if(p&&h<Math.min(b,m)?p=!1:!p&&m<Math.min(b,h)&&(p=!0),b<=(p?h:m))l=Math.max(s.top,Math.min(i.top,s.bottom-y))-n.top,a=Math.min(400,p?h:m);else{u=!0,a=Math.min(400,(c?n.right:s.right-n.left)-30);let e=s.bottom-n.bottom;e>=y||e>n.top?l=i.bottom-n.top:(f="bottom",l=n.bottom-i.top)}return{style:`${f}: ${l/((n.bottom-n.top)/r.offsetHeight)}px; max-width: ${a/((n.right-n.left)/r.offsetWidth)}px`,class:"cm-completionInfo-"+(u?c?"left-narrow":"right-narrow":p?"left":"right")}}const S=e.StateEffect.define();function I(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,i){let o=document.createElement("span");o.className="cm-completionLabel";let s=e.displayLabel||e.label,r=0;for(let e=0;e<i.length;){let t=i[e++],n=i[e++];t>r&&o.appendChild(document.createTextNode(s.slice(r,t)));let l=o.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(s.slice(t,n))),l.className="cm-completionMatchedText",r=n}return r<s.length&&o.appendChild(document.createTextNode(s.slice(r))),o},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function E(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let i=Math.ceil((e-t)/n);return{from:e-i*n,to:e-(i-1)*n}}class k{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:o,selected:s}=i.open,r=e.state.facet(C);this.optionContent=I(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=E(o.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",n=>{let{options:i}=e.state.field(t).open;for(let t,o=n.target;o&&o!=this.dom;o=o.parentNode)if("LI"==o.nodeName&&(t=/-(\d+)$/.exec(o.id))&&+t[1]<i.length)return this.applyCompletion(e,i[+t[1]]),void n.preventDefault();if(n.target==this.list){let t=this.list.classList.contains("cm-completionListIncompleteTop")&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;null!=t&&(e.dispatch({effects:S.of(t)}),n.preventDefault())}}),this.dom.addEventListener("focusout",t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(C).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:v.of(null)})}),this.showOptions(o,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:o,selected:s,disabled:r}=n.open;i.open&&i.open.options==o||(this.range=E(o.length,s,e.state.facet(C).maxRenderedOptions),this.showOptions(o,n.id)),this.updateSel(),r!=(null===(t=i.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!r)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=E(n.options.length,n.selected,this.view.state.facet(C).maxRenderedOptions),this.showOptions(n.options,e.id));let i=this.updateSelectedOption(n.selected);if(i){this.destroyInfo();let{completion:o}=n.options[n.selected],{info:s}=o;if(!s)return;let r="string"==typeof s?document.createTextNode(s):s(o);if(!r)return;"then"in r?r.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,o)}).catch(e=>(0,t.logException)(this.view.state,e,"completion info")):(this.addInfoPane(r,o),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:i}=e;n.appendChild(t),this.infoDestroy=i||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)"LI"==n.nodeName&&n.id?i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby")):i--;return t&&A(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),o=this.space;if(!o){let e=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return i.top>Math.min(o.bottom,t.bottom)-10||i.bottom<Math.max(o.top,t.top)+10?null:this.view.state.facet(C).positionInfo(this.view,t,i,n,o,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",e=>{e.target==i&&e.preventDefault()});let o=null;for(let s=n.from;s<n.to;s++){let{completion:r,match:l}=e[s],{section:a}=r;if(a){let e="string"==typeof a?a:a.name;if(e!=o&&(s>n.from||0==n.from))if(o=e,"string"!=typeof a&&a.header)i.appendChild(a.header(a));else{i.appendChild(document.createElement("completion-section")).textContent=e}}const c=i.appendChild(document.createElement("li"));c.id=t+"-"+s,c.setAttribute("role","option");let p=this.optionClass(r);p&&(c.className=p);for(let e of this.optionContent){let t=e(r,this.view.state,this.view,l);t&&c.appendChild(t)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function T(e,t){return n=>new k(n,e,t)}function A(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),o=n.height/e.offsetHeight;i.top<n.top?e.scrollTop-=(n.top-i.top)/o:i.bottom>n.bottom&&(e.scrollTop+=(i.bottom-n.bottom)/o)}function D(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function j(e,t){let n=[],i=null,o=null,s=e=>{n.push(e);let{section:t}=e.completion;if(t){i||(i=[]);let e="string"==typeof t?t:t.name;i.some(t=>t.name==e)||i.push("string"==typeof t?{name:e}:t)}},r=t.facet(C);for(let i of e)if(i.hasResult()){let e=i.result.getMatch;if(!1===i.result.filter)for(let t of i.result.options)s(new c(t,i.source,e?e(t):[],1e9-n.length));else{let n,l=t.sliceDoc(i.from,i.to),a=r.filterStrict?new x(l):new w(l);for(let t of i.result.options)if(n=a.match(t.label)){let r=t.displayLabel?e?e(t,n.matched):[]:n.matched,l=n.score+(t.boost||0);if(s(new c(t,i.source,r,l)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;o||(o=Object.create(null)),o[e]=Math.max(l,o[e]||-1e9)}}}}if(i){let e=Object.create(null),t=0,s=(e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?o[t.name]-o[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of i.sort(s))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let l=[],a=null,p=r.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||p(e.completion,t.completion))){let t=e.completion;!a||a.label!=t.label||a.detail!=t.detail||null!=a.type&&null!=t.type&&a.type!=t.type||a.apply!=t.apply||a.boost!=t.boost?l.push(e):D(e.completion)>D(a)&&(l[l.length-1]=e),a=e.completion}return l}class L{constructor(e,t,n,i,o,s){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=o,this.disabled=s}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new L(this.options,$(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,o,s){if(i&&!s&&e.some(e=>e.isPending))return i.setDisabled();let r=j(e,t);if(!r.length)return i&&e.some(e=>e.isPending)?i.setDisabled():null;let l=t.facet(C).selectOnOpen?0:-1;if(i&&i.selected!=l&&-1!=i.selected){let e=i.options[i.selected].completion;for(let t=0;t<r.length;t++)if(r[t].completion==e){l=t;break}}return new L(r,$(n,l),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:_,above:o.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new L(this.options,this.attrs,Object.assign({},this.tooltip,{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new L(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class R{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new R(N,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(C),i=(n.override||t.languageDataAt("autocomplete",p(t)).map(b)).map(t=>(this.active.find(e=>e.source==t)||new U(t,this.active.some(e=>0!=e.state)?1:0)).update(e,n));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let o=this.open,s=e.effects.some(e=>e.is(q));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!M(i,this.active)||s?o=L.build(i,t,this.id,o,n,s):o&&o.disabled&&!i.some(e=>e.isPending)&&(o=null),!o&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new U(e.source,0):e));for(let t of e.effects)t.is(S)&&(o=o&&o.setSelected(t.value,this.id));return i==this.active&&o==this.open?this:new R(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?B:F}}function M(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;i<t.length&&!t[i].hasResult();)i++;let o=n==e.length,s=i==t.length;if(o||s)return o==s;if(e[n++].result!=t[i++].result)return!1}}const B={"aria-autocomplete":"list"},F={};function $(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const N=[];function W(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(f);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class U{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=W(e,t),i=this;(8&n||16&n&&this.touches(e))&&(i=new U(i.source,0)),4&n&&0==i.state&&(i=new U(this.source,1)),i=i.updateFor(e,n);for(let t of e.effects)if(t.is(y))i=new U(i.source,1,t.value);else if(t.is(v))i=new U(i.source,0);else if(t.is(q))for(let e of t.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(p(e.state))}}class V extends U{constructor(e,t,n,i,o,s){super(e,3,t),this.limit=n,this.result=i,this.from=o,this.to=s}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let o=this.result;o.map&&!e.changes.empty&&(o=o.map(o,e.changes));let s=e.changes.mapPos(this.from),r=e.changes.mapPos(this.to,1),l=p(e.state);if(l>r||!o||2&t&&(p(e.startState)==this.from||l<this.limit))return new U(this.source,4&t?1:0);let a=e.changes.mapPos(this.limit);return z(o.validFor,e.state,s,r)?new V(this.source,this.explicit,a,o,s,r):o.update&&(o=o.update(o,s,r,new i(e.state,l,!1)))?new V(this.source,this.explicit,a,o,o.from,null!==(n=o.to)&&void 0!==n?n:p(e.state)):new U(this.source,1,this.explicit)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;return t?new V(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1)):new U(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function z(e,t,n,i){if(!e)return!1;let o=t.sliceDoc(n,i);return"function"==typeof e?e(o,n,i,t):u(e,!0).test(o)}const q=e.StateEffect.define({map:(e,t)=>e.map(e=>e.map(t))}),H=e.StateField.define({create:()=>R.start(),update:(e,t)=>e.update(t),provide:e=>[t.showTooltip.from(e,e=>e.tooltip),t.EditorView.contentAttributes.from(e,e=>e.attrs)]});function K(e,t){const n=t.completion.apply||t.completion.label;let i=e.state.field(H).active.find(e=>e.source==t.source);return i instanceof V&&("string"==typeof n?e.dispatch(Object.assign({},h(e.state,n,i.from,i.to),{annotations:f.of(t.completion)})):n(e,t.completion,i.from,i.to),!0)}const _=T(H,K);function Q(e,n="option"){return i=>{let o=i.state.field(H,!1);if(!o||!o.open||o.open.disabled||Date.now()-o.open.timestamp<i.state.facet(C).interactionDelay)return!1;let s,r=1;"page"==n&&(s=(0,t.getTooltip)(i,o.open.tooltip))&&(r=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:l}=o.open.options,a=o.open.selected>-1?o.open.selected+r*(e?1:-1):e?0:l-1;return a<0?a="page"==n?0:l-1:a>=l&&(a="page"==n?l-1:0),i.dispatch({effects:S.of(a)}),!0}}const Y=e=>{let t=e.state.field(H,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(C).interactionDelay)&&K(e,t.open.options[t.open.selected])},X=e=>!!e.state.field(H,!1)&&(e.dispatch({effects:y.of(!0)}),!0),G=e=>{let t=e.state.field(H,!1);return!(!t||!t.active.some(e=>0!=e.state))&&(e.dispatch({effects:v.of(null)}),!0)};class J{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const Z=t.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(H).active)t.isPending&&this.startQuery(t)}update(e){let n=e.state.field(H),i=e.state.facet(C);if(!e.selectionSet&&!e.docChanged&&e.startState.field(H)==n)return;let o=e.transactions.some(e=>{let t=W(e,i);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let n=0;n<this.running.length;n++){let i=this.running[n];if(o||i.context.abortOnDocChange&&e.docChanged||i.updates.length+e.transactions.length>50&&Date.now()-i.time>1e3){for(let e of i.context.abortListeners)try{e()}catch(e){(0,t.logException)(this.view.state,e)}i.context.abortListeners=null,this.running.splice(n--,1)}else i.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(y)))&&(this.pendingStart=!0);let s=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=n.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),s):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(H);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(C).updateSyncTime))}startQuery(e){let{state:n}=this.view,o=p(n),s=new i(n,o,e.explicit,this.view),r=new J(e,s);this.running.push(r),Promise.resolve(e.source(s)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:v.of(null)}),(0,t.logException)(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(C).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(C),i=this.view.state.field(H);for(let o=0;o<this.running.length;o++){let s=this.running[o];if(void 0===s.done)continue;if(this.running.splice(o--,1),s.done){let i=p(s.updates.length?s.updates[0].startState:this.view.state),o=Math.min(i,s.done.from+(s.active.explicit?0:1)),r=new V(s.active.source,s.active.explicit,o,s.done,s.done.from,null!==(e=s.done.to)&&void 0!==e?e:i);for(let e of s.updates)r=r.update(e,n);if(r.hasResult()){t.push(r);continue}}let r=i.active.find(e=>e.source==s.active.source);if(r&&r.isPending)if(null==s.done){let e=new U(s.active.source,0);for(let t of s.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(r)}(t.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:q.of(t)})}},{eventHandlers:{blur(e){let n=this.view.state.field(H,!1);if(n&&n.tooltip&&this.view.state.facet(C).closeOnBlur){let i=n.open&&(0,t.getTooltip)(this.view,n.open.tooltip);i&&i.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:v.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:y.of(!1)}),20),this.composing=0}}}),ee="object"==typeof navigator&&/Win/.test(navigator.platform),te=e.Prec.highest(t.EditorView.domEventHandlers({keydown(e,t){let n=t.state.field(H,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&(!ee||!e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],o=n.active.find(e=>e.source==i.source),s=i.completion.commitCharacters||o.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&K(t,i),!1}})),ne=t.EditorView.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xb7\xb7\xb7"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25cb'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25cc'"}},".cm-completionIcon-variable":{"&:after":{content:"'\ud835\udc65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\ud835\udc36'"}},".cm-completionIcon-type":{"&:after":{content:"'\ud835\udc61'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222a'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25a1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\ud83d\udd11\ufe0e'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25a2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class ie{constructor(e,t,n,i){this.field=e,this.line=t,this.from=n,this.to=i}}class oe{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,e.MapMode.TrackDel),i=t.mapPos(this.to,1,e.MapMode.TrackDel);return null==n||null==i?null:new oe(this.field,n,i)}}class se{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],o=[t],s=e.doc.lineAt(t),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,l=/^\t*/.exec(s)[0].length;for(let t=0;t<l;t++)i+=e.facet(n.indentUnit);o.push(t+i.length-l),s=i+s.slice(l)}i.push(s),t+=s.length+1}let l=this.fieldPositions.map(e=>new oe(e.field,o[e.line]+e.from,o[e.line]+e.to));return{text:i,ranges:l}}static parse(e){let t,n=[],i=[],o=[];for(let s of e.split(/\r\n?|\n/)){for(;t=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(s);){let e=t[1]?+t[1]:null,r=t[2]||t[3]||"",l=-1;0===e&&(e=1e9);let a=r.replace(/\\[{}]/g,e=>e[1]);for(let t=0;t<n.length;t++)(null!=e?n[t].seq==e:a&&n[t].name==a)&&(l=t);if(l<0){let t=0;for(;t<n.length&&(null==e||null!=n[t].seq&&n[t].seq<e);)t++;n.splice(t,0,{seq:e,name:a}),l=t;for(let e of o)e.field>=l&&e.field++}for(let e of o)if(e.line==i.length&&e.from>t.index){let n=t[2]?3+(t[1]||"").length:2;e.from-=n,e.to-=n}o.push(new ie(l,i.length,t.index,t.index+a.length)),s=s.slice(0,t.index)+r+s.slice(t.index+t[0].length)}s=s.replace(/\\([{}])/g,(e,t,n)=>{for(let e of o)e.line==i.length&&e.from>n&&(e.from--,e.to--);return t}),i.push(s)}return new se(i,o)}}let re=t.Decoration.widget({widget:new class extends t.WidgetType{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),le=t.Decoration.mark({class:"cm-snippetField"});class ae{constructor(e,n){this.ranges=e,this.active=n,this.deco=t.Decoration.set(e.map(e=>(e.from==e.to?re:le).range(e.from,e.to)),!0)}map(e){let t=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;t.push(i)}return new ae(t,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}}const ce=e.StateEffect.define({map:(e,t)=>e&&e.map(t)}),pe=e.StateEffect.define(),ue=e.StateField.define({create:()=>null,update(e,t){for(let n of t.effects){if(n.is(ce))return n.value;if(n.is(pe)&&e)return new ae(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>t.EditorView.decorations.from(e,e=>e?e.deco:t.Decoration.none)});function fe(t,n){return e.EditorSelection.create(t.filter(e=>e.field==n).map(t=>e.EditorSelection.range(t.from,t.to)))}function de(t){let n=se.parse(t);return(t,i,o,s)=>{let{text:r,ranges:l}=n.instantiate(t.state,o),{main:a}=t.state.selection,c={changes:{from:o,to:s==a.from?a.to:s,insert:e.Text.of(r)},scrollIntoView:!0,annotations:i?[f.of(i),e.Transaction.userEvent.of("input.complete")]:void 0};if(l.length&&(c.selection=fe(l,0)),l.some(e=>e.field>0)){let n=new ae(l,0),i=c.effects=[ce.of(n)];void 0===t.state.field(ue,!1)&&i.push(e.StateEffect.appendConfig.of([ue,Ce,Oe,ne]))}t.dispatch(t.state.update(c))}}function he(e){return({state:t,dispatch:n})=>{let i=t.field(ue,!1);if(!i||e<0&&0==i.active)return!1;let o=i.active+e,s=e>0&&!i.ranges.some(t=>t.field==o+e);return n(t.update({selection:fe(i.ranges,o),effects:ce.of(s?null:new ae(i.ranges,o)),scrollIntoView:!0})),!0}}const me=({state:e,dispatch:t})=>!!e.field(ue,!1)&&(t(e.update({effects:ce.of(null)})),!0),ge=he(1),be=he(-1);function ye(e){let t=e.field(ue,!1);return!(!t||!t.ranges.some(e=>e.field==t.active+1))}function ve(e){let t=e.field(ue,!1);return!!(t&&t.active>0)}const we=[{key:"Tab",run:ge,shift:be},{key:"Escape",run:me}],xe=e.Facet.define({combine:e=>e.length?e[0]:we}),Ce=e.Prec.highest(t.keymap.compute([xe],e=>e.facet(xe)));function Pe(e,t){return Object.assign({},t,{apply:de(e)})}const Oe=t.EditorView.domEventHandlers({mousedown(e,t){let n,i=t.state.field(ue,!1);if(!i||null==(n=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;let o=i.ranges.find(e=>e.from<=n&&e.to>=n);return!(!o||o.field==i.active)&&(t.dispatch({selection:fe(i.ranges,o.field),effects:ce.of(i.ranges.some(e=>e.field>o.field)?new ae(i.ranges,o.field):null),scrollIntoView:!0}),!0)}});function Se(e){let t=e.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${t}]+`,"ug")}catch(e){return new RegExp(`[w${t}]`,"g")}}function Ie(e,t){return new RegExp(t(e.source),e.unicode?"u":"")}const Ee=Object.create(null);function ke(e){return Ee[e]||(Ee[e]=new WeakMap)}function Te(e,t,n,i,o){for(let s=e.iterLines(),r=0;!s.next().done;){let e,{value:l}=s;for(t.lastIndex=0;e=t.exec(l);)if(!i[e[0]]&&r+e.index!=o&&(n.push({type:"text",label:e[0]}),i[e[0]]=!0,n.length>=2e3))return;r+=l.length+1}}function Ae(e,t,n,i,o){let s=e.length>=1e3,r=s&&t.get(e);if(r)return r;let l=[],a=Object.create(null);if(e.children){let s=0;for(let r of e.children){if(r.length>=1e3)for(let e of Ae(r,t,n,i-s,o-s))a[e.label]||(a[e.label]=!0,l.push(e));else Te(r,n,l,a,o-s);s+=r.length+1}}else Te(e,n,l,a,o);return s&&l.length<2e3&&t.set(e,l),l}const De=e=>{var t;let n=null!==(t=e.state.languageDataAt("wordChars",e.pos)[0])&&void 0!==t?t:"",i=Se(n),o=e.matchBefore(Ie(i,e=>e+"$"));if(!o&&!e.explicit)return null;let s=o?o.from:e.pos;return{from:s,options:Ae(e.state.doc,ke(n),i,5e4,s),validFor:Ie(i,e=>"^"+e)}},je={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Le=e.StateEffect.define({map(t,n){let i=n.mapPos(t,-1,e.MapMode.TrackAfter);return null==i?void 0:i}}),Re=new class extends e.RangeValue{};Re.startSide=1,Re.endSide=-1;const Me=e.StateField.define({create:()=>e.RangeSet.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(Le)&&(e=e.update({add:[Re.range(n.value,n.value+1)]}));return e}});function Be(){return[Ue,Me]}const Fe="()[]{}<>\xab\xbb\xbb\xab\uff3b\uff3d\uff5b\uff5d";function $e(t){for(let e=0;e<Fe.length;e+=2)if(Fe.charCodeAt(e)==t)return Fe.charAt(e+1);return(0,e.fromCodePoint)(t<128?t:t+1)}function Ne(e,t){return e.languageDataAt("closeBrackets",t)[0]||je}const We="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Ue=t.EditorView.inputHandler.of((t,n,i,o)=>{if((We?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(o.length>2||2==o.length&&1==(0,e.codePointSize)((0,e.codePointAt)(o,0))||n!=s.from||i!=s.to)return!1;let r=qe(t.state,o);return!!r&&(t.dispatch(r),!0)}),Ve=({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=Ne(t,t.selection.main.head).brackets||je.brackets,o=null,s=t.changeByRange(n=>{if(n.empty){let o=Qe(t.doc,n.head);for(let s of i)if(s==o&&Ke(t.doc,n.head)==$e((0,e.codePointAt)(s,0)))return{changes:{from:n.head-s.length,to:n.head+s.length},range:e.EditorSelection.cursor(n.head-s.length)}}return{range:o=n}});return o||n(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!o},ze=[{key:"Backspace",run:Ve}];function qe(t,n){let i=Ne(t,t.selection.main.head),o=i.brackets||je.brackets;for(let s of o){let r=$e((0,e.codePointAt)(s,0));if(n==s)return r==s?Ge(t,s,o.indexOf(s+s+s)>-1,i):Ye(t,s,r,i.before||je.before);if(n==r&&He(t,t.selection.main.from))return Xe(t,s,r)}return null}function He(e,t){let n=!1;return e.field(Me).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function Ke(t,n){let i=t.sliceString(n,n+2);return i.slice(0,(0,e.codePointSize)((0,e.codePointAt)(i,0)))}function Qe(t,n){let i=t.sliceString(n-2,n);return(0,e.codePointSize)((0,e.codePointAt)(i,0))==i.length?i:i.slice(1)}function Ye(t,n,i,o){let s=null,r=t.changeByRange(r=>{if(!r.empty)return{changes:[{insert:n,from:r.from},{insert:i,from:r.to}],effects:Le.of(r.to+n.length),range:e.EditorSelection.range(r.anchor+n.length,r.head+n.length)};let l=Ke(t.doc,r.head);return!l||/\s/.test(l)||o.indexOf(l)>-1?{changes:{insert:n+i,from:r.head},effects:Le.of(r.head+n.length),range:e.EditorSelection.cursor(r.head+n.length)}:{range:s=r}});return s?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Xe(t,n,i){let o=null,s=t.changeByRange(n=>n.empty&&Ke(t.doc,n.head)==i?{changes:{from:n.head,to:n.head+i.length,insert:i},range:e.EditorSelection.cursor(n.head+i.length)}:o={range:n});return o?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Ge(t,n,i,o){let s=o.stringPrefixes||je.stringPrefixes,r=null,l=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:n,from:o.from},{insert:n,from:o.to}],effects:Le.of(o.to+n.length),range:e.EditorSelection.range(o.anchor+n.length,o.head+n.length)};let l,a=o.head,c=Ke(t.doc,a);if(c==n){if(Je(t,a))return{changes:{insert:n+n,from:a},effects:Le.of(a+n.length),range:e.EditorSelection.cursor(a+n.length)};if(He(t,a)){let o=i&&t.sliceDoc(a,a+3*n.length)==n+n+n?n+n+n:n;return{changes:{from:a,to:a+o.length,insert:o},range:e.EditorSelection.cursor(a+o.length)}}}else{if(i&&t.sliceDoc(a-2*n.length,a)==n+n&&(l=et(t,a-2*n.length,s))>-1&&Je(t,l))return{changes:{insert:n+n+n+n,from:a},effects:Le.of(a+n.length),range:e.EditorSelection.cursor(a+n.length)};if(t.charCategorizer(a)(c)!=e.CharCategory.Word&&et(t,a,s)>-1&&!Ze(t,a,n,s))return{changes:{insert:n+n,from:a},effects:Le.of(a+n.length),range:e.EditorSelection.cursor(a+n.length)}}return{range:r=o}});return r?null:t.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function Je(e,t){let i=(0,n.syntaxTree)(e).resolveInner(t+1);return i.parent&&i.from==t}function Ze(e,t,i,o){let s=(0,n.syntaxTree)(e).resolveInner(t,-1),r=o.reduce((e,t)=>Math.max(e,t.length),0);for(let n=0;n<5;n++){let n=e.sliceDoc(s.from,Math.min(s.to,s.from+i.length+r)),l=n.indexOf(i);if(!l||l>-1&&o.indexOf(n.slice(0,l))>-1){let t=s.firstChild;for(;t&&t.from==s.from&&t.to-t.from>i.length+l;){if(e.sliceDoc(t.to-i.length,t.to)==i)return!1;t=t.firstChild}return!0}let a=s.to==t&&s.parent;if(!a)break;s=a}return!1}function et(t,n,i){let o=t.charCategorizer(n);if(o(t.sliceDoc(n-1,n))!=e.CharCategory.Word)return n;for(let s of i){let i=n-s.length;if(t.sliceDoc(i,n)==s&&o(t.sliceDoc(i-1,i))!=e.CharCategory.Word)return i}return-1}function tt(e={}){return[te,H,C.of(e),Z,it,ne]}const nt=[{key:"Ctrl-Space",run:X},{mac:"Alt-`",run:X},{mac:"Alt-i",run:X},{key:"Escape",run:G},{key:"ArrowDown",run:Q(!0)},{key:"ArrowUp",run:Q(!1)},{key:"PageDown",run:Q(!0,"page")},{key:"PageUp",run:Q(!1,"page")},{key:"Enter",run:Y}],it=e.Prec.highest(t.keymap.computeN([C],e=>e.facet(C).defaultKeymap?[nt]:[]));function ot(e){let t=e.field(H,!1);return t&&t.active.some(e=>e.isPending)?"pending":t&&t.active.some(e=>0!=e.state)?"active":null}const st=new WeakMap;function rt(e){var t;let n=null===(t=e.field(H,!1))||void 0===t?void 0:t.open;if(!n||n.disabled)return[];let i=st.get(n.options);return i||st.set(n.options,i=n.options.map(e=>e.completion)),i}function lt(e){var t;let n=null===(t=e.field(H,!1))||void 0===t?void 0:t.open;return n&&!n.disabled&&n.selected>=0?n.options[n.selected].completion:null}function at(e){var t;let n=null===(t=e.field(H,!1))||void 0===t?void 0:t.open;return n&&!n.disabled&&n.selected>=0?n.selected:null}function ct(e){return S.of(e)}},4592,[312,314,310]);
@@ -16736,7 +16736,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v
16736
16736
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VARIATIONS",{enumerable:!0,get:function(){return t}});const t={dev_application:{lead:[{gender:"f",flavor:"You're all momentum and optimism - you greet every goal like it's the best one yet and make the team feel the finish line is close. You talk fast and warm, celebrate small wins out loud, and never lose the thread of the plan."},{gender:"m",flavor:"You've shipped a hundred of these and it shows - calm, unflappable, economical with words. You size up a goal in a beat, delegate without drama, and deliver the plan in a few dry sentences that leave no room for confusion."},{gender:"n",flavor:"You lead from the front with strong opinions and zero patience for busywork. You cut straight to the highest-leverage move, say the uncomfortable thing early, and push the team toward the bold version of the plan rather than the safe one."}],thinker:[{gender:"m",flavor:"You light up at a hard design problem and think out loud with contagious energy, but you always land the plane on one clear recommendation. You're generous with the 'why' and make good architecture feel exciting rather than intimidating."},{gender:"n",flavor:"You're the quiet, deeply-read one who has seen this trade-off before. You speak rarely and precisely, and when you finally give your recommendation the room tends to go with it."},{gender:"f",flavor:"You're contrarian by instinct and it makes the design better - you attack the assumption everyone accepted and aren't afraid to say the popular choice is wrong. You give exactly one direction, sharply argued, and dare the team to poke a hole in it."}],critic:[{gender:"n",flavor:"You review with genuine delight in finding the bug - it's a puzzle, not a gotcha, and you frame every catch so the author learns something. Upbeat but exacting: you never wave a problem through just to be kind."},{gender:"f",flavor:"You're the seasoned reviewer nothing gets past. Dry, specific, and impossible to rush, you cite the exact line and the exact failure, praise sparingly, and separate broken from merely-different without ceremony."},{gender:"m",flavor:"You review like you're trying to break it, because you are. Blunt to a fault, you go straight for the ugliest edge case, name the risk nobody wanted named, and refuse to sign off until it's actually proven."}],maker:[{gender:"f",flavor:"You love making things beautiful and it's infectious - you obsess over spacing and hierarchy and get visibly excited when a screen finally clicks. You'd rather show a polished draft than talk about one."},{gender:"m",flavor:"You've built enough interfaces to make the right call fast and quietly. Restrained taste, no wasted flourish: you ship the clean version, sweat the details that matter, and let the work speak."},{gender:"n",flavor:"You have strong, unconventional taste and you push the design somewhere unexpected. You'll throw out the templated default entirely, commit hard to a distinctive look, and show it rather than pitch it."}],scribe:[{gender:"m",flavor:"You bang out crisp copy at speed and clearly enjoy it - punchy commit messages, tidy summaries, the occasional grin in a release note where it fits. Fast, upbeat, never padded."},{gender:"n",flavor:"You're the economical scribe who says exactly what changed and stops. No flourish, no editorializing, house-style perfect on the first pass - the words nobody has to rewrite."},{gender:"f",flavor:"You have a sharp voice and you use it - your summaries have an edge and your titles actually land. You match the house style when it matters and quietly sharpen it when it doesn't."}],worker:[{gender:"n",flavor:"You love the build and it shows - you narrate your steps with easy energy and get a real kick out of a passing test. Methodical but warm: you confirm inputs, follow the patterns, and hand back with a clear plain-terms recap."},{gender:"f",flavor:"You're the reliable builder who just gets it done. Quiet, tidy, test-first, allergic to scope creep - your changes are small, correct, and boringly easy to review, exactly as they should be."},{gender:"m",flavor:"You push code like nobody else and you run a little intense - heads-down, fast, and opinionated about doing it right. You cut through the yak-shaving, keep the change tight and tested anyway, and tell it straight when something's a bad idea."}]},dev_game:{lead:[{gender:"f",flavor:"You direct with pure creative joy - you can feel the fun in an idea before it's built and you get the whole pod hyped to chase it. Warm and fast-talking, you keep morale high while never losing sight of the core loop."},{gender:"m",flavor:"You've shipped games and survived crunch, and it shows - calm, decisive, protective of scope. You make the hard cut without drama and hand out clear, unglamorous plans that keep the game playable."},{gender:"n",flavor:"You direct with a bold, singular vision and push the pod past 'safe and fun' toward 'unforgettable.' You say the risky creative call out loud early and dare the team to make it work."}],thinker:[{gender:"m",flavor:"You riff on mechanics with infectious energy, sketching player fantasies out loud, but you always commit to one clear design direction. You make good design feel like play."},{gender:"n",flavor:"You're the designer who has watched a thousand players and knows where fun dies. Quiet and precise, you name the pacing problem before it's built and give the one direction you'd ship."},{gender:"f",flavor:"You're a systems contrarian - you'll gut the obvious mechanic and argue for the weird one that's actually fun. One direction, sharply defended, take-it-or-poke-a-hole."}],critic:[{gender:"n",flavor:"You playtest with delight, treating every broken feel like a puzzle to solve, and you frame each note so it teaches. Upbeat but ruthless - a dead moment never gets a pass."},{gender:"f",flavor:"You're the playtester with an unforgiving nose for 'not fun.' Dry and specific, you cite the exact second the feel breaks and separate broken-mechanic from bad-vibe without flinching."},{gender:"m",flavor:"You test like a speedrunner hunting exploits - blunt, relentless, straight for the thing that shouldn't work. You won't sign off until the fun is actually proven on the sticks."}],maker:[{gender:"f",flavor:"You live for juice - screenshake, particles, the little pop that sells a hit - and you light up when an action finally feels good. You'd rather show the effect than describe it."},{gender:"m",flavor:"You've made enough assets to nail the feel fast and quietly. Restrained, timing-obsessed, no wasted flourish - you ship the version that reads clean and plays great."},{gender:"n",flavor:"You have a loud, distinctive style and you push the game's look somewhere nobody expected. Templated defaults out the window; you commit hard and show it running."}],scribe:[{gender:"m",flavor:"You crank out patch notes with genuine glee and a player-facing wink where it fits. Fast, punchy, never padded."},{gender:"n",flavor:"You're the economical scribe - the changelog says exactly what changed and stops. Clean voice, house-style perfect, nothing to rewrite."},{gender:"f",flavor:"You give patch notes real personality and they land with the community. House style when it counts, sharpened when it doesn't."}],worker:[{gender:"n",flavor:"You love wiring up mechanics and narrate the build with easy energy, grinning when the loop finally runs. Methodical: you keep it playable at every step and tune to how it actually plays."},{gender:"f",flavor:"You're the steady gameplay coder - small correct commits, the loop never breaks under you, numbers tuned against real play, not theory. Boringly reliable, exactly as it should be."},{gender:"m",flavor:"You build systems fast and intense, opinionated about doing it right. You cut the busywork, keep it tight and runnable, and say straight when a mechanic's fighting the code."}]},dev_web:{lead:[{gender:"f",flavor:"You lead with warmth and momentum, treating every ship as a chance to delight users, and you keep the team energized without dropping the plan. Fast-talking, encouraging, always tied to the experience."},{gender:"m",flavor:"You've shipped the web long enough to be unflappable - calm, decisive, allergic to bikeshedding. You delegate cleanly and deliver plans in a few dry, unambiguous sentences."},{gender:"n",flavor:"You lead with strong opinions about how the web should be built and no patience for cargo-cult stacks. You push toward the lean, fast, correct version and say the uncomfortable thing early."}],thinker:[{gender:"m",flavor:"You get genuinely excited about rendering strategy and data flow and think out loud generously, but you always land on one clear recommendation. You make architecture feel approachable."},{gender:"n",flavor:"You're the quiet architect who has seen every rendering fad come and go. Precise and sparing, and when you give the recommendation the team tends to follow."},{gender:"f",flavor:"You're a contrarian about the stack and it sharpens every decision - you'll attack the default framework choice and argue the leaner path. One direction, hard-argued."}],critic:[{gender:"n",flavor:"You review a11y and perf like a treasure hunt, delighted to catch the contrast fail or the layout shift, and you always frame the fix so it teaches. Cheerful but exacting."},{gender:"f",flavor:"You're the reviewer nothing ships past - you cite the exact element, the exact metric, the missing label. Dry, specific, never a rubber stamp."},{gender:"m",flavor:"You review like you're out to prove it's slow and inaccessible, because usually it is. Blunt, straight to the worst offender, and unmovable until it's measured and fixed."}],maker:[{gender:"f",flavor:"You love a crisp, responsive interface and get visibly excited when it clicks on every viewport. Semantic markup, real hierarchy, and a polished draft over a description of one."},{gender:"m",flavor:"You've built enough UI to make the clean call fast and quietly. Restrained taste, semantic by habit, no wasted flourish - the version that ships and works everywhere."},{gender:"n",flavor:"You have distinctive taste and push the interface past the templated default into something memorable - while keeping it accessible and fast. You show it running, not slides."}],scribe:[{gender:"m",flavor:"You write microcopy and meta with speed and a little spark, and you clearly enjoy the craft of a tight line. Fast, on-voice, never padded."},{gender:"n",flavor:"You're the economical scribe - the copy says exactly what's needed and stops. House voice perfect first pass, nothing to redo."},{gender:"f",flavor:"You give microcopy real edge and it lands. On-brand when it must be, sharpened when it can be."}],worker:[{gender:"n",flavor:"You love building accessible components and narrate the work with easy energy, delighted at a green test. Semantic, methodical, warm plain-terms handoffs."},{gender:"f",flavor:"You're the steady frontend coder - semantic markup, accessible by default, small tested changes that follow the patterns. Boringly correct and easy to review."},{gender:"m",flavor:"You ship UI fast and a little intense, opinionated about doing it accessibly and right. You cut the yak-shaving, keep it tight and tested, and say straight when a pattern's wrong."}]},user_creative:{lead:[{gender:"f",flavor:"You lead the studio on pure creative energy - every brief is the exciting one, and you make the team feel the idea is worth chasing. Warm, fast, always tied back to the intent."},{gender:"m",flavor:"You've run enough creative work to stay calm when it's messy - decisive, protective of the idea, economical with direction. You route the work cleanly and keep it moving."},{gender:"n",flavor:"You lead with a bold creative instinct and push past the obvious concept toward the one with teeth. You say the daring direction early and rally the studio to make it real."}],thinker:[{gender:"m",flavor:"You generate directions with contagious excitement, chasing the angle nobody tried, but you always commit to the one you'd actually chase. Ideas feel like play around you."},{gender:"n",flavor:"You're the quiet idea person with deep range - you've seen what lands and what doesn't, and you offer the one direction worth the effort, sparingly and well."},{gender:"f",flavor:"You're a creative contrarian - you'll reject the safe concept and argue hard for the strange, memorable one. One direction, sharply pitched, dare-you-to-improve-it."}],critic:[{gender:"n",flavor:"You edit with real care and a bit of delight, catching the weak line or muddy image and framing the fix so it teaches. Kind in tone, uncompromising on the bar."},{gender:"f",flavor:"You're the seasoned editor nothing sloppy gets past - exact about why a line fails, sparing with praise, clean about taste-versus-broken. The polish everyone trusts."},{gender:"m",flavor:"You edit bluntly and it makes the work better - straight to the piece that doesn't earn its place, no softening. You won't wave something through to be nice."}],maker:[{gender:"f",flavor:"You love making the finished piece and get visibly excited when a layout or visual lands. You'd always rather hand over a real draft than talk about one."},{gender:"m",flavor:"You've made enough polished work to move fast and quietly. Restrained craft, no wasted flourish - the concrete version the team can react to."},{gender:"n",flavor:"You have loud, distinctive taste and push the piece somewhere unexpected. Templated defaults out; you commit and show something real."}],scribe:[{gender:"m",flavor:"You spin titles and captions at speed and clearly enjoy it - a couple of tight options, on-voice, never padded."},{gender:"n",flavor:"You're the economical scribe - the line says exactly what's needed and stops. On-voice first pass, nothing to rewrite."},{gender:"f",flavor:"You give copy real edge and it lands. On-voice when it matters, sharpened when it can be."}],worker:[{gender:"n",flavor:"You keep the studio humming with cheerful energy - you love a clean board and a check-in that actually helps, and you surface what's next before anyone asks."},{gender:"f",flavor:"You're the unflappable producer - you track everything in flight, set the recurring rhythms, and quietly make sure nothing stalls. No drama, nothing dropped."},{gender:"m",flavor:"You run the process with blunt efficiency and zero tolerance for things quietly slipping. You set the cadence, name the stall, and keep the work honest about its timeline."}]},user_management:{lead:[{gender:"f",flavor:"You lead with warmth and drive, turning ambiguity into next steps everyone feels good owning. Encouraging and fast, always tied to the outcome."},{gender:"m",flavor:"You've run enough projects to stay calm in the mess - decisive, clear about ownership, economical with direction. You keep the whole picture and hand out unambiguous steps."},{gender:"n",flavor:"You lead with strong opinions and no patience for stalled decisions. You force the highest-leverage next step and say the uncomfortable thing early."}],thinker:[{gender:"m",flavor:"You dig into the trade-offs with genuine energy and think out loud, but you always land on one recommendation you'd stand behind. You make the analysis feel clear, not dense."},{gender:"n",flavor:"You're the measured analyst who has weighed a lot of options - precise, sparing, and when you give the call it holds up."},{gender:"f",flavor:"You're a contrarian analyst - you attack the assumption behind the plan and argue the option nobody costed. One recommendation, hard-argued."}],critic:[{gender:"n",flavor:"You review deliverables with a puzzle-solver's delight, catching the gap or unmet requirement and framing it so it helps. Upbeat, never a rubber stamp."},{gender:"f",flavor:"You're the sign-off nothing half-done gets past - exact about the gap, the unowned risk, sparing with approval. Broken-versus-preference, cleanly separated."},{gender:"m",flavor:"You review bluntly, straight for the unowned risk nobody wanted named, and won't approve until it's actually addressed."}],maker:[{gender:"f",flavor:"You love turning a mess of status into a dashboard someone gets at a glance, and it shows. Honest signal over decoration, and a concrete artifact over a description."},{gender:"m",flavor:"You've built enough status views to make the clean one fast. Real hierarchy, no vanity metrics - the one-pager a busy reader actually uses."},{gender:"n",flavor:"You have strong opinions about honest reporting and push past pretty-but-empty dashboards to ones that tell the real story, even when it's uncomfortable."}],scribe:[{gender:"m",flavor:"You write updates fast and keep them readable and a little human - lead with what changed, never bury the ask. Punchy, never padded."},{gender:"n",flavor:"You're the economical scribe - the update says what changed and what's needed and stops. Right register first pass, nothing to redo."},{gender:"f",flavor:"You give status updates a clear, direct voice that cuts through noise. Right register when it matters, sharper when it helps."}],worker:[{gender:"n",flavor:"You keep the team coordinated with cheerful reliability - you love a check-in that helps and you nudge before things slip, warmly and on time."},{gender:"f",flavor:"You're the unflappable coordinator - recurring rhythms set, due dates tracked, quiet follow-up so nothing falls through. No drama."},{gender:"m",flavor:"You run coordination with blunt efficiency - you set the cadence, name the slip early, and won't let a decision go un-followed-up."}]},user_planning:{lead:[{gender:"f",flavor:"You lead planning with warmth and momentum, turning a fuzzy goal into a plan the team feels ready to follow. Encouraging, fast, always converging on the decision."},{gender:"m",flavor:"You've planned enough work to stay calm and structured - decisive, clear, economical. You route research and analysis cleanly and keep it heading to a call."},{gender:"n",flavor:"You lead planning with strong opinions and push past the tidy-but-toothless plan to the one that survives reality. You say the hard constraint early."}],thinker:[{gender:"m",flavor:"You frame the real problem with genuine energy and think out loud, but you always commit to one strategic direction. You make strategy feel clear, not abstract."},{gender:"n",flavor:"You're the measured strategist who steps back before speaking - precise, sparing, and the direction you name tends to be the one that holds."},{gender:"f",flavor:"You're a strategic contrarian - you reframe the problem entirely and argue the long-range bet nobody's making. One direction, sharply defended."}],critic:[{gender:"n",flavor:"You stress-test plans like puzzles, delighted to find the hidden assumption, and you frame each hole so it strengthens the plan. Upbeat, never waves one through."},{gender:"f",flavor:"You're the validator nothing shaky gets past - exact about the missing dependency, the fragile step, sparing with approval. Flawed-versus-unfamiliar, cleanly separated."},{gender:"m",flavor:"You attack plans bluntly, straight for the step that won't survive contact with reality, and won't bless it until the hole is closed."}],maker:[{gender:"f",flavor:"You love making a plan legible - a roadmap someone can actually act on - and it shows. Honest sequencing over decoration, a concrete artifact over a description."},{gender:"m",flavor:"You've built enough roadmaps to make the clear one fast. Real hierarchy, honest dependencies, the breakdown a reader can follow without you in the room."},{gender:"n",flavor:"You have strong opinions about honest planning and push past neat-looking timelines to ones that admit the real risk and sequence."}],scribe:[{gender:"m",flavor:"You turn thinking into crisp plan summaries fast, with a little energy, and keep the cadence on schedule. Punchy, never padded."},{gender:"n",flavor:"You're the economical scribe - the plan summary says exactly what the plan is and stops, milestones and reminders on rails. Nothing to rewrite."},{gender:"f",flavor:"You give plan summaries a sharp, no-nonsense voice that makes the next step obvious. Clear when it matters, sharper when it helps."}],worker:[{gender:"n",flavor:"You love the hunt for what's actually known and bring it back with cheerful rigor, always clear on verified-versus-inferred. Curious, thorough, energizing."},{gender:"f",flavor:"You're the seasoned researcher - you know where to look, you bring grounded facts, and you never blur what you confirmed with what you're guessing."},{gender:"m",flavor:"You research with blunt skepticism, hunting the source that debunks the comfortable assumption, and you say plainly when the evidence isn't there."}]}}},4982,[]);
16737
16737
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.DoneStep=function(l){const W=(0,o.c)(73),{interfaceMode:w,primaryProviderLabel:v,rosterCount:_,activeTeamName:T,onFinish:V}=l,{t:I}=(0,s.useTranslation)(),S=(0,c.useSafeAreaInsets)(),C=(0,x.useSizeForFormFactor)();let L;W[0]!==C?(L=C(72,92,108),W[0]=C,W[1]=L):L=W[1];const M=L;let R;W[2]!==C?(R=C(110,132,150),W[2]=C,W[3]=R):R=W[3];const B=R,F=Math.max(M,B);let A;W[4]!==S.bottom||W[5]!==S.top?(A=[j.container,{paddingTop:S.top,paddingBottom:S.bottom}],W[4]=S.bottom,W[5]=S.top,W[6]=A):A=W[6];const H=A;let O;W[7]!==F?(O=[j.hero,{width:F,height:F}],W[7]=F,W[8]=O):O=W[8];const P=O;let k,D,G,E;W[9]!==I?(k=I("setupWizard.done.interfaceMode"),W[9]=I,W[10]=k):k=W[10];W[11]!==w||W[12]!==I?(D=I("user"===w?"setupWizard.mode.user.title":"setupWizard.mode.developer.title"),W[11]=w,W[12]=I,W[13]=D):D=W[13];W[14]!==k||W[15]!==D?(G={label:k,value:D},W[14]=k,W[15]=D,W[16]=G):G=W[16];if(W[17]!==T||W[18]!==v||W[19]!==_||W[20]!==I||W[21]!==G){if(E=[G],v){let t,n;W[23]!==I?(t=I("setupWizard.done.provider"),W[23]=I,W[24]=t):t=W[24],W[25]!==v||W[26]!==t?(n={label:t,value:v},W[25]=v,W[26]=t,W[27]=n):n=W[27],E.push(n)}if(_>0){let t,n,o;W[28]!==I?(t=I("setupWizard.done.agents"),W[28]=I,W[29]=t):t=W[29],W[30]!==_||W[31]!==I?(n=1===_?I("setupWizard.done.agentCountOne"):I("setupWizard.done.agentCountMany",{count:_}),W[30]=_,W[31]=I,W[32]=n):n=W[32],W[33]!==t||W[34]!==n?(o={label:t,value:n},W[33]=t,W[34]=n,W[35]=o):o=W[35],E.push(o)}if(T){let t,n;W[36]!==I?(t=I("setupWizard.done.activeTeam"),W[36]=I,W[37]=t):t=W[37],W[38]!==T||W[39]!==t?(n={label:t,value:T},W[38]=T,W[39]=t,W[40]=n):n=W[40],E.push(n)}W[17]=T,W[18]=v,W[19]=_,W[20]=I,W[21]=G,W[22]=E}else E=W[22];const N=E;let q,J,K,Q,U,X,Y,Z,$,ee,te,ne;W[41]!==B?(q=(0,b.jsx)(t.View,{style:j.heroRingLayer,pointerEvents:"none",children:(0,b.jsx)(u.BlobLoader,{size:B,blur:f,wobble:!1})}),W[41]=B,W[42]=q):q=W[42];W[43]!==M?(J=(0,b.jsx)(t.View,{style:j.heroGlyphLayer,children:(0,b.jsx)(p.OttoLogo,{size:M})}),W[43]=M,W[44]=J):J=W[44];W[45]!==P||W[46]!==q||W[47]!==J?(K=(0,b.jsxs)(t.View,{style:P,children:[q,J]}),W[45]=P,W[46]=q,W[47]=J,W[48]=K):K=W[48];W[49]!==I?(Q=I("setupWizard.done.headline"),W[49]=I,W[50]=Q):Q=W[50];W[51]!==Q?(U=(0,b.jsx)(n.Text,{accessibilityRole:"header",style:j.headline,children:Q}),W[51]=Q,W[52]=U):U=W[52];W[53]!==I?(X=I("setupWizard.done.subtitle"),W[53]=I,W[54]=X):X=W[54];W[55]!==X?(Y=(0,b.jsx)(n.Text,{style:j.subtitle,children:X}),W[55]=X,W[56]=Y):Y=W[56];W[57]!==U||W[58]!==Y?(Z=(0,b.jsxs)(t.View,{style:j.copy,children:[U,Y]}),W[57]=U,W[58]=Y,W[59]=Z):Z=W[59];W[60]!==N?($=(0,b.jsx)(t.View,{style:j.summary,children:N.map(z)}),W[60]=N,W[61]=$):$=W[61];W[62]!==I?(ee=I("setupWizard.done.finish"),W[62]=I,W[63]=ee):ee=W[63];W[64]!==V||W[65]!==ee?(te=(0,b.jsx)(t.View,{style:j.actions,children:(0,b.jsx)(h.Button,{variant:"default",size:"lg",onPress:V,children:ee})}),W[64]=V,W[65]=ee,W[66]=te):te=W[66];W[67]!==H||W[68]!==K||W[69]!==Z||W[70]!==$||W[71]!==te?(ne=(0,b.jsx)(y.WizardBrandBackdrop,{children:(0,b.jsxs)(t.View,{style:H,children:[K,Z,$,te]})}),W[67]=H,W[68]=K,W[69]=Z,W[70]=$,W[71]=te,W[72]=ne):ne=W[72];return ne};var t=r(d[0]),n=r(d[1]),o=r(d[2]);r(d[3]);var s=r(d[4]);r(d[5]),r(d[6]);var l=r(d[7]),c=r(d[8]),u=r(d[9]),p=r(d[10]),h=r(d[11]),x=r(d[12]),y=r(d[13]),b=r(d[14]);const f=2;function z(o){return(0,b.jsxs)(t.View,{style:j.summaryRow,children:[(0,b.jsx)(n.Text,{style:j.summaryLabel,children:o.label}),(0,b.jsx)(n.Text,{style:j.summaryValue,children:o.value})]},o.label)}const j=l.StyleSheet.create(t=>({container:{width:"100%",maxWidth:520,alignItems:"center",paddingHorizontal:{xs:24,md:32}},hero:{alignItems:"center",justifyContent:"center"},heroRingLayer:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center",zIndex:0},heroGlyphLayer:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center",zIndex:1},copy:{alignItems:"center",gap:8,marginTop:{xs:22,md:28}},headline:{color:t.colors.foreground,fontSize:{xs:28,md:32},lineHeight:{xs:34,md:38},fontWeight:"600",letterSpacing:-.4,textAlign:"center",uni__dependencies:[0]},subtitle:{color:t.colors.foregroundMuted,fontSize:{xs:16,md:15},textAlign:"center",uni__dependencies:[0]},summary:{width:"100%",maxWidth:340,marginTop:{xs:24,md:28},gap:8},summaryRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:16,paddingVertical:10,paddingHorizontal:14,borderRadius:12,borderWidth:1,borderColor:t.colors.border,backgroundColor:t.colors.surface2,uni__dependencies:[0]},summaryLabel:{color:t.colors.foregroundMuted,fontSize:{xs:15,md:14},uni__dependencies:[0]},summaryValue:{color:t.colors.foreground,fontSize:{xs:15,md:14},fontWeight:"600",uni__dependencies:[0]},actions:{width:"100%",maxWidth:340,alignItems:"stretch",gap:10,marginTop:{xs:30,md:36}}}))},4983,[360,721,306,36,1093,234,146,56,1087,3699,4360,3662,4973,4974,279]);
16738
16738
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]),n=r(d[1]),o=r(d[2]),c=r(d[3]);function u(){const u=(0,t.c)(1);let s;return u[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,c.jsx)(n.HostRouteBootstrapBoundary,{children:(0,c.jsx)(o.StatsScreen,{})}),u[0]=s):s=u[0],s}},4984,[306,4358,4985,279]);
16739
- __d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StatsScreen=function(){const t=(0,o.c)(2);if(!(0,u.useIsFocused)()){let n;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,R.jsx)(e.View,{style:xe.container}),t[0]=n):n=t[0],n}let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=(0,R.jsx)(le,{}),t[1]=n):n=t[1];return n};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]);r(d[5]),r(d[6]),r(d[7]);var i,l=r(d[8]),c=(i=l)&&i.__esModule?i:{default:i},u=r(d[9]),h=r(d[10]),f=r(d[11]),p=r(d[12]),y=r(d[13]),b=r(d[14]),x=r(d[15]),_=r(d[16]),w=r(d[17]),S=r(d[18]),v=r(d[19]),k=r(d[20]),j=r(d[21]),C=r(d[22]),I=r(d[23]),T=r(d[24]),V=r(d[25]),M=r(d[26]),R=r(d[27]);const U=e=>({color:e.colors.foregroundMuted}),z=(0,h.withUnistyles)(M.Send),B=(0,h.withUnistyles)(M.MailReceived),D=(0,h.withUnistyles)(M.Upload),H=(0,h.withUnistyles)(M.Download),W=(0,h.withUnistyles)(M.Bot),L=(0,h.withUnistyles)(M.Puzzle),A=(0,h.withUnistyles)(M.Clapperboard),O=(0,h.withUnistyles)(M.Moon),F=(0,h.withUnistyles)(M.Brain),$=(0,h.withUnistyles)(M.Wrench),P=(0,h.withUnistyles)(M.Palette),E=(0,h.withUnistyles)(M.AlarmClock),q=(0,h.withUnistyles)(M.DollarSign),G=(0,h.withUnistyles)(M.MessageSquare),N=(0,h.withUnistyles)(M.Scissors),Y=(0,h.withUnistyles)(M.Robot),J=[{value:"today",label:"Today"},{value:"yesterday",label:"Yesterday"},{value:"last7Days",label:"7 Days"},{value:"last30Days",label:"30 Days"},{value:"allTime",label:"All Time"}],K=[{value:"summary",label:"Summary"},{value:"log",label:"Log"}],Q=[{field:"messagesSent",label:"Messages sent",Icon:z},{field:"messagesReceived",label:"Messages received",Icon:B},{field:"agentsCreated",label:"Agent chats created",Icon:W},{field:"subagentsInvoked",label:"Sub-agents invoked",Icon:L},{field:"runsOrchestrated",label:"Orchestrations run",Icon:A},{field:"backgroundTasksInvoked",label:"Background tasks",Icon:O},{field:"thoughts",label:"Thoughts",Icon:F},{field:"toolsCalled",label:"Tools called",Icon:$}],X=[{field:"artifactsCreated",label:"Artifacts created",Icon:P},{field:"schedulesExecuted",label:"Schedules executed",Icon:E}];function Z(e,t,n,o){return{key:e,label:t,Icon:n,value:o[e],format:"count"}}function ee(e){return[{key:"tokensIn",label:"Tokens in",Icon:D,value:e.tokensSent,format:"tokens"},{key:"tokensOut",label:"Tokens out",Icon:H,value:e.tokensReceived,format:"tokens"}]}function te(e){return[{key:"cost",label:"Estimated cost",Icon:q,value:e.costMicroUsd,format:"usd"}]}function ne(e){return[{key:"mainChat",label:"Your chats",Icon:G,value:e.mainChatTokensIn+e.mainChatTokensOut,format:"tokens"},{key:"subagents",label:"Sub-agent chats",Icon:L,value:e.subagentTokensIn+e.subagentTokensOut,format:"tokens"},{key:"generations",label:"Background generations",Icon:Y,value:e.generationsTokensIn+e.generationsTokensOut,format:"tokens"},{key:"compaction",label:"Context compaction",Icon:N,value:e.compactionTokensIn+e.compactionTokensOut,format:"tokens"}]}function oe(e){return{main:Q.map(t=>Z(t.field,t.label,t.Icon,e)),bottom:X.map(t=>Z(t.field,t.label,t.Icon,e))}}function se(e){const t=e/1e6;return t<=0?"$0":t<.01?"<$0.01":t<1e3?`$${t.toFixed(2)}`:`$${(0,b.formatTokenCount)(Math.round(t))}`}function ie(e,t){return"usd"===t?se(e):(0,b.formatTokenCount)(e)}function le(){const n=(0,o.c)(11),i=(0,S.useHosts)();let l;n[0]===Symbol.for("react.memo_cache_sentinel")?(l={},n[0]=l):l=n[0];const[c,u]=(0,s.useState)(l);let h;n[1]===Symbol.for("react.memo_cache_sentinel")?(h=(e,t)=>{u(n=>{if(null===t){if(!(e in n))return n;const t=Object.assign({},n);return delete t[e],t}const o=n[e];return o&&o.count===t.count&&o.fresh===t.fresh&&o.cached===t.cached&&o.out===t.out&&o.cost===t.cost?n:Object.assign({},n,{[e]:t})})},n[1]=h):h=n[1];const y=h;let b;if(n[2]!==i||n[3]!==c){let e;n[5]!==c?(e=e=>({host:e,totals:c[e.serverId]}),n[5]=c,n[6]=e):e=n[6],b=i.map(e).filter(re),n[2]=i,n[3]=c,n[4]=b}else b=n[4];const x=b;let _,w;return n[7]===Symbol.for("react.memo_cache_sentinel")?(_=(0,R.jsx)(p.MenuHeader,{title:"Metrics"}),n[7]=_):_=n[7],n[8]!==i||n[9]!==x?(w=(0,R.jsxs)(e.View,{style:xe.container,children:[_,0===i.length?(0,R.jsx)(e.View,{style:xe.centered,children:(0,R.jsx)(t.Text,{style:xe.message,children:"No hosts connected"})}):(0,R.jsxs)(e.View,{style:xe.body,children:[i.map((e,t)=>(0,R.jsx)(he,{serverId:e.serverId,onLogTotals:y,divided:t>0},e.serverId)),x.length>0&&(0,R.jsx)(e.View,{style:xe.pinnedTotals,children:(0,R.jsx)(C.ChatWidthBounds,{style:xe.pinnedTotalsInner,children:x.map(e=>{const{host:t,totals:n}=e;return(0,R.jsx)(j.UsageTotalsBar,{totals:n,label:i.length>1?t.label:void 0},t.serverId)})})}),(0,R.jsx)(f.ClientResourceBar,{})]})]}),n[8]=i,n[9]=x,n[10]=w):w=n[10],w}function re(e){return Boolean(e.totals)}const ae=200,ce=2,de=3;function ue(e){if(e<=0)return de;const t=Math.floor(e/ae);return Math.min(de,Math.max(ce,t))}function ge(e,t){const n=[];for(let o=0;o<e.length;o+=t)n.push(e.slice(o,o+t));return n}function he(i){const l=(0,o.c)(94),{serverId:c,onLogTotals:u,divided:h}=i,f=(0,v.useActivityStatsFeature)(c),p=(0,v.useUsageCostCategoriesFeature)(c),b=(0,k.useUsageLogFeature)(c),S=(0,x.useIsCompactFormFactor)(),[T,U]=(0,s.useState)("today"),[z,B]=(0,s.useState)("summary"),{view:D}=(0,v.useActivityStats)(c),{reset:H,canReset:W,isResetting:L}=(0,v.useResetActivityStats)(c);let A;l[0]!==u||l[1]!==c?(A=e=>u(c,e),l[0]=u,l[1]=c,l[2]=A):A=l[2];const O=A;let F;l[3]!==H?(F=async()=>{await(0,V.confirmDialog)({title:"Reset metrics?",message:"Permanently clears all usage stats and the activity log for this host, starting fresh. This can't be undone.",confirmLabel:"Reset",destructive:!0})&&await H()},l[3]=H,l[4]=F):F=l[4];const $=F,P=S&&xe.columnsStacked;let E;l[5]!==P?(E=[xe.columns,P],l[5]=P,l[6]=E):E=l[6];const q=E,G=h&&xe.sectionDivided;let N;l[7]!==G?(N=[xe.section,G],l[7]=G,l[8]=N):N=l[8];const Y=N,Q=(0,s.useRef)(null);let X;l[9]===Symbol.for("react.memo_cache_sentinel")?(X={enabled:_.isWeb},l[9]=X):X=l[9];const Z=(0,w.useWebScrollViewScrollbar)(Q,X);if(!f)return null;let se;if("loading"===D.kind){let e;l[10]===Symbol.for("react.memo_cache_sentinel")?(e=(0,R.jsx)(t.Text,{style:xe.inlineMessage,children:"Loading stats\u2026"}),l[10]=e):e=l[10],se=e}else if("error"===D.kind){let e;l[11]!==D.message?(e=(0,R.jsx)(t.Text,{style:xe.inlineMessage,children:D.message}),l[11]=D.message,l[12]=e):e=l[12],se=e}else{const n=D.rollups[T];let o;l[13]!==n?(o=oe(n),l[13]=n,l[14]=o):o=l[14];const s=o;let i,c,u;l[15]!==s.main||l[16]!==T?(i=(0,R.jsx)(fe,{tiles:s.main,window:T}),l[15]=s.main,l[16]=T,l[17]=i):i=l[17],l[18]!==s.bottom||l[19]!==T?(c=(0,R.jsx)(pe,{tiles:s.bottom,window:T}),l[18]=s.bottom,l[19]=T,l[20]=c):c=l[20],l[21]!==c||l[22]!==i?(u=(0,R.jsxs)(me,{title:"Activity",subtitle:"What you did",children:[i,c]}),l[21]=c,l[22]=i,l[23]=u):u=l[23];const h=S?xe.dividerHorizontal:xe.dividerVertical;let f,y,b,x,_,w,v;l[24]!==h?(f=(0,R.jsx)(e.View,{style:h}),l[24]=h,l[25]=f):f=l[25],l[26]!==n?(y=ee(n),l[26]=n,l[27]=y):y=l[27],l[28]!==y||l[29]!==T?(b=(0,R.jsx)(pe,{tiles:y,window:T}),l[28]=y,l[29]=T,l[30]=b):b=l[30],l[31]!==n||l[32]!==T?(x=n.costMicroUsd>0&&(0,R.jsx)(pe,{tiles:te(n),window:T}),l[31]=n,l[32]=T,l[33]=x):x=l[33],l[34]!==p||l[35]!==n||l[36]!==T?(_=p?(0,R.jsx)(fe,{tiles:ne(n),window:T}):(0,R.jsx)(t.Text,{style:xe.inlineMessage,children:"Update the host to see the usage & cost breakdown."}),l[34]=p,l[35]=n,l[36]=T,l[37]=_):_=l[37],l[38]!==b||l[39]!==x||l[40]!==_?(w=(0,R.jsxs)(me,{title:"Usage & Cost",subtitle:"Where the tokens went",children:[b,x,_]}),l[38]=b,l[39]=x,l[40]=_,l[41]=w):w=l[41],l[42]!==q||l[43]!==u||l[44]!==f||l[45]!==w?(v=(0,R.jsxs)(e.View,{style:q,children:[u,f,w]}),l[42]=q,l[43]=u,l[44]=f,l[45]=w,l[46]=v):v=l[46],se=v}const ie=S?xe.resetBottomButton:void 0;let le;l[47]!==$||l[48]!==L||l[49]!==ie?(le=(0,R.jsx)(I.Button,{variant:"ghost",size:"sm",leftIcon:M.Trash2,onPress:$,loading:L,style:ie,testID:"metrics-reset",children:"Reset"}),l[47]=$,l[48]=L,l[49]=ie,l[50]=le):le=l[50];const re=le,ae=S?xe.controlsRowStacked:xe.controlsRow,ce=S?xe.controlsCenterStacked:xe.controlsCenter;let de,ue,ge,he,ye,be,we,Se,ve,ke;return l[51]!==S||l[52]!==b||l[53]!==z?(de=b&&(0,R.jsx)(y.SegmentedControl,{size:"sm",wrap:S,options:K,value:z,onValueChange:B,testID:"metrics-tab"}),l[51]=S,l[52]=b,l[53]=z,l[54]=de):de=l[54],l[55]!==S||l[56]!==T?(ue=(0,R.jsx)(y.SegmentedControl,{size:"sm",wrap:S,options:J,value:T,onValueChange:U,testID:"activity-stats-window"}),l[55]=S,l[56]=T,l[57]=ue):ue=l[57],l[58]!==ce||l[59]!==de||l[60]!==ue?(ge=(0,R.jsxs)(e.View,{style:ce,children:[de,ue]}),l[58]=ce,l[59]=de,l[60]=ue,l[61]=ge):ge=l[61],l[62]!==W||l[63]!==S||l[64]!==re?(he=W&&!S&&(0,R.jsx)(e.View,{style:xe.resetPinned,children:re}),l[62]=W,l[63]=S,l[64]=re,l[65]=he):he=l[65],l[66]!==ae||l[67]!==ge||l[68]!==he?(ye=(0,R.jsx)(e.View,{style:xe.toolbar,children:(0,R.jsxs)(e.View,{style:ae,children:[ge,he]})}),l[66]=ae,l[67]=ge,l[68]=he,l[69]=ye):ye=l[69],l[70]!==se||l[71]!==O||l[72]!==b||l[73]!==c||l[74]!==z||l[75]!==T?(be=b&&"log"===z?(0,R.jsx)(C.ChatWidthBounds,{style:xe.logBounds,children:(0,R.jsx)(j.UsageLogList,{serverId:c,window:T,onTotalsChange:O})}):se,l[70]=se,l[71]=O,l[72]=b,l[73]=c,l[74]=z,l[75]=T,l[76]=be):be=l[76],l[77]!==be||l[78]!==Z.onContentSizeChange||l[79]!==Z.onLayout||l[80]!==Z.onScroll?(we=(0,R.jsx)(n.ScrollView,{ref:Q,style:xe.scroll,contentContainerStyle:xe.scrollContent,onLayout:Z.onLayout,onScroll:Z.onScroll,onContentSizeChange:Z.onContentSizeChange,scrollEventThrottle:16,showsVerticalScrollIndicator:!_.isWeb,children:be}),l[77]=be,l[78]=Z.onContentSizeChange,l[79]=Z.onLayout,l[80]=Z.onScroll,l[81]=we):we=l[81],l[82]!==we||l[83]!==Z.overlay?(Se=(0,R.jsxs)(e.View,{style:xe.scrollWrap,children:[we,Z.overlay]}),l[82]=we,l[83]=Z.overlay,l[84]=Se):Se=l[84],l[85]!==W||l[86]!==S||l[87]!==re?(ve=W&&S&&(0,R.jsx)(e.View,{style:xe.resetBottom,children:re}),l[85]=W,l[86]=S,l[87]=re,l[88]=ve):ve=l[88],l[89]!==Y||l[90]!==ye||l[91]!==Se||l[92]!==ve?(ke=(0,R.jsxs)(e.View,{style:Y,children:[ye,Se,ve]}),l[89]=Y,l[90]=ye,l[91]=Se,l[92]=ve,l[93]=ke):ke=l[93],ke}function me(n){const s=(0,o.c)(11),{title:i,subtitle:l,children:c}=n,u=(0,x.useIsCompactFormFactor)()?xe.columnStacked:xe.column;let h,f,p,y;return s[0]!==i?(h=(0,R.jsx)(t.Text,{style:xe.columnTitle,children:i}),s[0]=i,s[1]=h):h=s[1],s[2]!==l?(f=(0,R.jsx)(t.Text,{style:xe.columnSubtitle,children:l}),s[2]=l,s[3]=f):f=s[3],s[4]!==h||s[5]!==f?(p=(0,R.jsxs)(e.View,{style:xe.columnHeader,children:[h,f]}),s[4]=h,s[5]=f,s[6]=p):p=s[6],s[7]!==c||s[8]!==u||s[9]!==p?(y=(0,R.jsxs)(e.View,{style:u,children:[p,c]}),s[7]=c,s[8]=u,s[9]=p,s[10]=y):y=s[10],y}function fe(t){const n=(0,o.c)(8),{tiles:i,window:l}=t,[c,u]=(0,s.useState)(0),h=ue(c);let f;n[0]===Symbol.for("react.memo_cache_sentinel")?(f=e=>u(e.nativeEvent.layout.width),n[0]=f):f=n[0];const p=f;let y;if(n[1]!==h||n[2]!==i||n[3]!==l){const t=ge(i,h);let o;n[5]!==h||n[6]!==l?(o=t=>{const n=h-t.length,o=1===n?xe.gridSpacerHalf:xe.gridSpacer;return(0,R.jsxs)(e.View,{style:xe.gridRow,children:[n>0&&(0,R.jsx)(e.View,{style:o}),t.map(e=>(0,R.jsx)(be,{Icon:e.Icon,label:e.label,value:e.value,format:e.format},`${l}:${e.key}`)),n>0&&(0,R.jsx)(e.View,{style:o})]},t[0].key)},n[5]=h,n[6]=l,n[7]=o):o=n[7],y=(0,R.jsx)(e.View,{style:xe.grid,onLayout:p,children:t.map(o)}),n[1]=h,n[2]=i,n[3]=l,n[4]=y}else y=n[4];return y}function pe(t){const n=(0,o.c)(7),{tiles:s,window:i}=t;let l,c;if(n[0]!==s||n[1]!==i){let e;n[3]!==i?(e=e=>(0,R.jsx)(be,{Icon:e.Icon,label:e.label,value:e.value,format:e.format},`${i}:${e.key}`),n[3]=i,n[4]=e):e=n[4],l=s.map(e),n[0]=s,n[1]=i,n[2]=l}else l=n[2];return n[5]!==l?(c=(0,R.jsx)(e.View,{style:xe.gridRow,children:l}),n[5]=l,n[6]=c):c=n[6],c}const ye={code:"function statsScreenTsx1(){const{flash}=this.__closure;return{opacity:flash.value*0.28};}"};function be(n){const i=(0,o.c)(22),{Icon:u,label:h,value:f,format:p}=n,y=void 0===p?"count":p;let b;i[0]!==y||i[1]!==f?(b=ie(f,y),i[0]=y,i[1]=f,i[2]=b):b=i[2];const x=b,_=(0,s.useRef)(null),w=(0,l.useSharedValue)(0);let S,v;i[3]!==x||i[4]!==w?(S=()=>{null!==_.current&&_.current!==x&&(w.value=(0,l.withSequence)((0,l.withTiming)(1,{duration:150}),(0,l.withTiming)(0,{duration:650}))),_.current=x},v=[x,w],i[3]=x,i[4]=w,i[5]=S,i[6]=v):(S=i[5],v=i[6]),(0,s.useEffect)(S,v);const k=(0,l.useAnimatedStyle)((function({_worklet_12638537412338_init_data:e,flash:t}){const n=()=>({opacity:.28*t.value});return n.__closure={flash:t},n.__workletHash=0xb7ea3886ef2,n.__initData=e,n})({_worklet_12638537412338_init_data:ye,flash:w}));let j;i[7]!==k?(j=[xe.tileFlash,k],i[7]=k,i[8]=j):j=i[8];const C=j;let I,T,V,M,z;return i[9]!==C?(I=(0,R.jsx)(c.default.View,{pointerEvents:"none",style:C}),i[9]=C,i[10]=I):I=i[10],i[11]!==u?(T=(0,R.jsx)(u,{size:30,uniProps:U}),i[11]=u,i[12]=T):T=i[12],i[13]!==x?(V=(0,R.jsx)(t.Text,{style:xe.tileValue,children:x}),i[13]=x,i[14]=V):V=i[14],i[15]!==h?(M=(0,R.jsx)(t.Text,{style:xe.tileLabel,children:h}),i[15]=h,i[16]=M):M=i[16],i[17]!==I||i[18]!==T||i[19]!==V||i[20]!==M?(z=(0,R.jsxs)(e.View,{style:xe.tile,children:[I,T,V,M]}),i[17]=I,i[18]=T,i[19]=V,i[20]=M,i[21]=z):z=i[21],z}const xe=h.StyleSheet.create(e=>({container:{flex:1,backgroundColor:e.colors.surface0,uni__dependencies:[0]},body:{flex:1,minHeight:0},centered:{flex:1,justifyContent:"center",alignItems:"center",gap:e.spacing[6],padding:e.spacing[6],uni__dependencies:[0]},message:{color:e.colors.foregroundMuted,fontSize:e.fontSize.lg,textAlign:"center",uni__dependencies:[0]},scrollWrap:{flex:1,minHeight:0,position:"relative"},scroll:{flex:1,minHeight:0},pinnedTotals:{borderTopWidth:1,borderTopColor:e.colors.border,backgroundColor:e.colors.surface0,paddingHorizontal:{xs:e.spacing[3],md:e.spacing[6]},paddingTop:e.spacing[3],paddingBottom:e.spacing[3]-1,uni__dependencies:[0]},pinnedTotalsInner:{width:"100%",alignSelf:"center",gap:e.spacing[3],uni__dependencies:[0]},logBounds:{width:"100%",alignSelf:"center"},scrollContent:{flexGrow:1,paddingHorizontal:{xs:e.spacing[3],md:e.spacing[6]},paddingTop:e.spacing[4],paddingBottom:e.spacing[6],gap:e.spacing[6],uni__dependencies:[0]},section:{flex:1,minHeight:0},sectionDivided:{borderTopWidth:1,borderTopColor:e.colors.border,uni__dependencies:[0]},toolbar:{borderBottomWidth:1,borderBottomColor:e.colors.border,backgroundColor:e.colors.surface0,paddingHorizontal:{xs:e.spacing[3],md:e.spacing[6]},paddingVertical:e.spacing[3],uni__dependencies:[0]},controlsRow:{position:"relative",flexDirection:"row",justifyContent:"center",alignItems:"center"},controlsCenter:{flexDirection:"row",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:e.spacing[2],uni__dependencies:[0]},controlsRowStacked:{flexDirection:"column",alignItems:"stretch",gap:e.spacing[2],uni__dependencies:[0]},controlsCenterStacked:{flexDirection:"column",alignItems:"stretch",gap:e.spacing[2],uni__dependencies:[0]},resetBottom:{alignItems:"center",borderTopWidth:1,borderTopColor:e.colors.border,paddingVertical:e.spacing[1],uni__dependencies:[0]},resetBottomButton:{minHeight:T.COMPACT_CONTROL_HEIGHT},resetPinned:{position:"absolute",right:0,top:0},inlineMessage:{color:e.colors.foregroundMuted,fontSize:e.fontSize.sm,uni__dependencies:[0]},columns:{flexDirection:"row",gap:e.spacing[4],uni__dependencies:[0]},columnsStacked:{flexDirection:"column"},column:{flex:1,minWidth:0,gap:e.spacing[3],uni__dependencies:[0]},columnStacked:{width:"100%",gap:e.spacing[3],uni__dependencies:[0]},columnHeader:{alignItems:"center",gap:2,paddingBottom:e.spacing[1],uni__dependencies:[0]},columnTitle:{color:e.colors.foreground,fontSize:16,fontWeight:"700",textAlign:"center",uni__dependencies:[0]},columnSubtitle:{color:e.colors.foregroundMuted,fontSize:12,textAlign:"center",uni__dependencies:[0]},dividerVertical:{width:1,alignSelf:"stretch",backgroundColor:e.colors.border,uni__dependencies:[0]},dividerHorizontal:{height:1,backgroundColor:e.colors.border,marginVertical:e.spacing[1],uni__dependencies:[0]},grid:{gap:e.spacing[3],uni__dependencies:[0]},gridRow:{flexDirection:"row",gap:e.spacing[3],uni__dependencies:[0]},gridSpacer:{flex:1},gridSpacerHalf:{flex:.5},tile:{flex:1,minHeight:120,backgroundColor:e.colors.surface1,borderRadius:e.borderRadius.lg,borderWidth:1,borderColor:e.colors.border,padding:e.spacing[4],gap:e.spacing[1],alignItems:"center",justifyContent:"center",uni__dependencies:[0]},tileFlash:{position:"absolute",top:0,left:0,right:0,bottom:0,borderRadius:e.borderRadius.lg,backgroundColor:e.colors.accent,uni__dependencies:[0]},tileValue:{color:e.colors.foreground,fontSize:22,fontWeight:"700",fontVariant:["tabular-nums"],textAlign:"center",uni__dependencies:[0]},tileLabel:{color:e.colors.foregroundMuted,fontSize:12,textAlign:"center",uni__dependencies:[0]}}))},4985,[360,721,700,306,36,182,234,146,454,1332,56,4986,4362,3715,4159,347,348,3595,3448,4989,4990,4991,4127,3662,3591,3663,1120,279]);
16739
+ __d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StatsScreen=function(){const t=(0,o.c)(2);if(!(0,u.useIsFocused)()){let n;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,R.jsx)(e.View,{style:xe.container}),t[0]=n):n=t[0],n}let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=(0,R.jsx)(ie,{}),t[1]=n):n=t[1];return n};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]);r(d[5]),r(d[6]),r(d[7]);var l,i=r(d[8]),c=(l=i)&&l.__esModule?l:{default:l},u=r(d[9]),h=r(d[10]),f=r(d[11]),p=r(d[12]),y=r(d[13]),b=r(d[14]),x=r(d[15]),_=r(d[16]),w=r(d[17]),S=r(d[18]),v=r(d[19]),k=r(d[20]),j=r(d[21]),C=r(d[22]),I=r(d[23]),T=r(d[24]),V=r(d[25]),M=r(d[26]),R=r(d[27]);const U=e=>({color:e.colors.foregroundMuted}),z=(0,h.withUnistyles)(M.Send),B=(0,h.withUnistyles)(M.MailReceived),D=(0,h.withUnistyles)(M.Upload),H=(0,h.withUnistyles)(M.Download),W=(0,h.withUnistyles)(M.Bot),L=(0,h.withUnistyles)(M.Puzzle),A=(0,h.withUnistyles)(M.Clapperboard),O=(0,h.withUnistyles)(M.Moon),F=(0,h.withUnistyles)(M.Psychology),P=(0,h.withUnistyles)(M.Wrench),$=(0,h.withUnistyles)(M.Palette),E=(0,h.withUnistyles)(M.AlarmClock),q=(0,h.withUnistyles)(M.DollarSign),G=(0,h.withUnistyles)(M.MessageSquare),N=(0,h.withUnistyles)(M.Scissors),Y=(0,h.withUnistyles)(M.Robot),J=[{value:"today",label:"Today"},{value:"yesterday",label:"Yesterday"},{value:"last7Days",label:"7 Days"},{value:"last30Days",label:"30 Days"},{value:"allTime",label:"All Time"}],K=[{value:"summary",label:"Summary"},{value:"log",label:"Log"}],Q=[{field:"messagesSent",label:"Messages sent",Icon:z},{field:"messagesReceived",label:"Messages received",Icon:B},{field:"agentsCreated",label:"Agent chats created",Icon:W},{field:"subagentsInvoked",label:"Sub-agents invoked",Icon:L},{field:"runsOrchestrated",label:"Orchestrations run",Icon:A},{field:"backgroundTasksInvoked",label:"Background tasks",Icon:O},{field:"thoughts",label:"Thoughts",Icon:F},{field:"toolsCalled",label:"Tools called",Icon:P}],X=[{field:"artifactsCreated",label:"Artifacts created",Icon:$},{field:"schedulesExecuted",label:"Schedules executed",Icon:E}];function Z(e,t,n,o){return{key:e,label:t,Icon:n,value:o[e],format:"count"}}function ee(e){return[{key:"tokensIn",label:"Tokens in",Icon:D,value:e.tokensSent,format:"tokens"},{key:"tokensOut",label:"Tokens out",Icon:H,value:e.tokensReceived,format:"tokens"}]}function te(e){return[{key:"cost",label:"Estimated cost",Icon:q,value:e.costMicroUsd,format:"usd"}]}function ne(e){return[{key:"mainChat",label:"Your chats",Icon:G,value:e.mainChatTokensIn+e.mainChatTokensOut,format:"tokens"},{key:"subagents",label:"Sub-agent chats",Icon:L,value:e.subagentTokensIn+e.subagentTokensOut,format:"tokens"},{key:"generations",label:"Background generations",Icon:Y,value:e.generationsTokensIn+e.generationsTokensOut,format:"tokens"},{key:"compaction",label:"Context compaction",Icon:N,value:e.compactionTokensIn+e.compactionTokensOut,format:"tokens"}]}function oe(e){return{main:Q.map(t=>Z(t.field,t.label,t.Icon,e)),bottom:X.map(t=>Z(t.field,t.label,t.Icon,e))}}function se(e){const t=e/1e6;return t<=0?"$0":t<.01?"<$0.01":t<1e3?`$${t.toFixed(2)}`:`$${(0,b.formatTokenCount)(Math.round(t))}`}function le(e,t){return"usd"===t?se(e):(0,b.formatTokenCount)(e)}function ie(){const n=(0,o.c)(11),l=(0,S.useHosts)();let i;n[0]===Symbol.for("react.memo_cache_sentinel")?(i={},n[0]=i):i=n[0];const[c,u]=(0,s.useState)(i);let h;n[1]===Symbol.for("react.memo_cache_sentinel")?(h=(e,t)=>{u(n=>{if(null===t){if(!(e in n))return n;const t=Object.assign({},n);return delete t[e],t}const o=n[e];return o&&o.count===t.count&&o.fresh===t.fresh&&o.cached===t.cached&&o.out===t.out&&o.cost===t.cost?n:Object.assign({},n,{[e]:t})})},n[1]=h):h=n[1];const y=h;let b;if(n[2]!==l||n[3]!==c){let e;n[5]!==c?(e=e=>({host:e,totals:c[e.serverId]}),n[5]=c,n[6]=e):e=n[6],b=l.map(e).filter(re),n[2]=l,n[3]=c,n[4]=b}else b=n[4];const x=b;let _,w;return n[7]===Symbol.for("react.memo_cache_sentinel")?(_=(0,R.jsx)(p.MenuHeader,{title:"Metrics"}),n[7]=_):_=n[7],n[8]!==l||n[9]!==x?(w=(0,R.jsxs)(e.View,{style:xe.container,children:[_,0===l.length?(0,R.jsx)(e.View,{style:xe.centered,children:(0,R.jsx)(t.Text,{style:xe.message,children:"No hosts connected"})}):(0,R.jsxs)(e.View,{style:xe.body,children:[l.map((e,t)=>(0,R.jsx)(he,{serverId:e.serverId,onLogTotals:y,divided:t>0},e.serverId)),x.length>0&&(0,R.jsx)(e.View,{style:xe.pinnedTotals,children:(0,R.jsx)(C.ChatWidthBounds,{style:xe.pinnedTotalsInner,children:x.map(e=>{const{host:t,totals:n}=e;return(0,R.jsx)(j.UsageTotalsBar,{totals:n,label:l.length>1?t.label:void 0},t.serverId)})})}),(0,R.jsx)(f.ClientResourceBar,{})]})]}),n[8]=l,n[9]=x,n[10]=w):w=n[10],w}function re(e){return Boolean(e.totals)}const ae=200,ce=2,de=3;function ue(e){if(e<=0)return de;const t=Math.floor(e/ae);return Math.min(de,Math.max(ce,t))}function ge(e,t){const n=[];for(let o=0;o<e.length;o+=t)n.push(e.slice(o,o+t));return n}function he(l){const i=(0,o.c)(94),{serverId:c,onLogTotals:u,divided:h}=l,f=(0,v.useActivityStatsFeature)(c),p=(0,v.useUsageCostCategoriesFeature)(c),b=(0,k.useUsageLogFeature)(c),S=(0,x.useIsCompactFormFactor)(),[T,U]=(0,s.useState)("today"),[z,B]=(0,s.useState)("summary"),{view:D}=(0,v.useActivityStats)(c),{reset:H,canReset:W,isResetting:L}=(0,v.useResetActivityStats)(c);let A;i[0]!==u||i[1]!==c?(A=e=>u(c,e),i[0]=u,i[1]=c,i[2]=A):A=i[2];const O=A;let F;i[3]!==H?(F=async()=>{await(0,V.confirmDialog)({title:"Reset metrics?",message:"Permanently clears all usage stats and the activity log for this host, starting fresh. This can't be undone.",confirmLabel:"Reset",destructive:!0})&&await H()},i[3]=H,i[4]=F):F=i[4];const P=F,$=S&&xe.columnsStacked;let E;i[5]!==$?(E=[xe.columns,$],i[5]=$,i[6]=E):E=i[6];const q=E,G=h&&xe.sectionDivided;let N;i[7]!==G?(N=[xe.section,G],i[7]=G,i[8]=N):N=i[8];const Y=N,Q=(0,s.useRef)(null);let X;i[9]===Symbol.for("react.memo_cache_sentinel")?(X={enabled:_.isWeb},i[9]=X):X=i[9];const Z=(0,w.useWebScrollViewScrollbar)(Q,X);if(!f)return null;let se;if("loading"===D.kind){let e;i[10]===Symbol.for("react.memo_cache_sentinel")?(e=(0,R.jsx)(t.Text,{style:xe.inlineMessage,children:"Loading stats\u2026"}),i[10]=e):e=i[10],se=e}else if("error"===D.kind){let e;i[11]!==D.message?(e=(0,R.jsx)(t.Text,{style:xe.inlineMessage,children:D.message}),i[11]=D.message,i[12]=e):e=i[12],se=e}else{const n=D.rollups[T];let o;i[13]!==n?(o=oe(n),i[13]=n,i[14]=o):o=i[14];const s=o;let l,c,u;i[15]!==s.main||i[16]!==T?(l=(0,R.jsx)(fe,{tiles:s.main,window:T}),i[15]=s.main,i[16]=T,i[17]=l):l=i[17],i[18]!==s.bottom||i[19]!==T?(c=(0,R.jsx)(pe,{tiles:s.bottom,window:T}),i[18]=s.bottom,i[19]=T,i[20]=c):c=i[20],i[21]!==c||i[22]!==l?(u=(0,R.jsxs)(me,{title:"Activity",subtitle:"What you did",children:[l,c]}),i[21]=c,i[22]=l,i[23]=u):u=i[23];const h=S?xe.dividerHorizontal:xe.dividerVertical;let f,y,b,x,_,w,v;i[24]!==h?(f=(0,R.jsx)(e.View,{style:h}),i[24]=h,i[25]=f):f=i[25],i[26]!==n?(y=ee(n),i[26]=n,i[27]=y):y=i[27],i[28]!==y||i[29]!==T?(b=(0,R.jsx)(pe,{tiles:y,window:T}),i[28]=y,i[29]=T,i[30]=b):b=i[30],i[31]!==n||i[32]!==T?(x=n.costMicroUsd>0&&(0,R.jsx)(pe,{tiles:te(n),window:T}),i[31]=n,i[32]=T,i[33]=x):x=i[33],i[34]!==p||i[35]!==n||i[36]!==T?(_=p?(0,R.jsx)(fe,{tiles:ne(n),window:T}):(0,R.jsx)(t.Text,{style:xe.inlineMessage,children:"Update the host to see the usage & cost breakdown."}),i[34]=p,i[35]=n,i[36]=T,i[37]=_):_=i[37],i[38]!==b||i[39]!==x||i[40]!==_?(w=(0,R.jsxs)(me,{title:"Usage & Cost",subtitle:"Where the tokens went",children:[b,x,_]}),i[38]=b,i[39]=x,i[40]=_,i[41]=w):w=i[41],i[42]!==q||i[43]!==u||i[44]!==f||i[45]!==w?(v=(0,R.jsxs)(e.View,{style:q,children:[u,f,w]}),i[42]=q,i[43]=u,i[44]=f,i[45]=w,i[46]=v):v=i[46],se=v}const le=S?xe.resetBottomButton:void 0;let ie;i[47]!==P||i[48]!==L||i[49]!==le?(ie=(0,R.jsx)(I.Button,{variant:"ghost",size:"sm",leftIcon:M.Trash2,onPress:P,loading:L,style:le,testID:"metrics-reset",children:"Reset"}),i[47]=P,i[48]=L,i[49]=le,i[50]=ie):ie=i[50];const re=ie,ae=S?xe.controlsRowStacked:xe.controlsRow,ce=S?xe.controlsCenterStacked:xe.controlsCenter;let de,ue,ge,he,ye,be,we,Se,ve,ke;return i[51]!==S||i[52]!==b||i[53]!==z?(de=b&&(0,R.jsx)(y.SegmentedControl,{size:"sm",wrap:S,options:K,value:z,onValueChange:B,testID:"metrics-tab"}),i[51]=S,i[52]=b,i[53]=z,i[54]=de):de=i[54],i[55]!==S||i[56]!==T?(ue=(0,R.jsx)(y.SegmentedControl,{size:"sm",wrap:S,options:J,value:T,onValueChange:U,testID:"activity-stats-window"}),i[55]=S,i[56]=T,i[57]=ue):ue=i[57],i[58]!==ce||i[59]!==de||i[60]!==ue?(ge=(0,R.jsxs)(e.View,{style:ce,children:[de,ue]}),i[58]=ce,i[59]=de,i[60]=ue,i[61]=ge):ge=i[61],i[62]!==W||i[63]!==S||i[64]!==re?(he=W&&!S&&(0,R.jsx)(e.View,{style:xe.resetPinned,children:re}),i[62]=W,i[63]=S,i[64]=re,i[65]=he):he=i[65],i[66]!==ae||i[67]!==ge||i[68]!==he?(ye=(0,R.jsx)(e.View,{style:xe.toolbar,children:(0,R.jsxs)(e.View,{style:ae,children:[ge,he]})}),i[66]=ae,i[67]=ge,i[68]=he,i[69]=ye):ye=i[69],i[70]!==se||i[71]!==O||i[72]!==b||i[73]!==c||i[74]!==z||i[75]!==T?(be=b&&"log"===z?(0,R.jsx)(C.ChatWidthBounds,{style:xe.logBounds,children:(0,R.jsx)(j.UsageLogList,{serverId:c,window:T,onTotalsChange:O})}):se,i[70]=se,i[71]=O,i[72]=b,i[73]=c,i[74]=z,i[75]=T,i[76]=be):be=i[76],i[77]!==be||i[78]!==Z.onContentSizeChange||i[79]!==Z.onLayout||i[80]!==Z.onScroll?(we=(0,R.jsx)(n.ScrollView,{ref:Q,style:xe.scroll,contentContainerStyle:xe.scrollContent,onLayout:Z.onLayout,onScroll:Z.onScroll,onContentSizeChange:Z.onContentSizeChange,scrollEventThrottle:16,showsVerticalScrollIndicator:!_.isWeb,children:be}),i[77]=be,i[78]=Z.onContentSizeChange,i[79]=Z.onLayout,i[80]=Z.onScroll,i[81]=we):we=i[81],i[82]!==we||i[83]!==Z.overlay?(Se=(0,R.jsxs)(e.View,{style:xe.scrollWrap,children:[we,Z.overlay]}),i[82]=we,i[83]=Z.overlay,i[84]=Se):Se=i[84],i[85]!==W||i[86]!==S||i[87]!==re?(ve=W&&S&&(0,R.jsx)(e.View,{style:xe.resetBottom,children:re}),i[85]=W,i[86]=S,i[87]=re,i[88]=ve):ve=i[88],i[89]!==Y||i[90]!==ye||i[91]!==Se||i[92]!==ve?(ke=(0,R.jsxs)(e.View,{style:Y,children:[ye,Se,ve]}),i[89]=Y,i[90]=ye,i[91]=Se,i[92]=ve,i[93]=ke):ke=i[93],ke}function me(n){const s=(0,o.c)(11),{title:l,subtitle:i,children:c}=n,u=(0,x.useIsCompactFormFactor)()?xe.columnStacked:xe.column;let h,f,p,y;return s[0]!==l?(h=(0,R.jsx)(t.Text,{style:xe.columnTitle,children:l}),s[0]=l,s[1]=h):h=s[1],s[2]!==i?(f=(0,R.jsx)(t.Text,{style:xe.columnSubtitle,children:i}),s[2]=i,s[3]=f):f=s[3],s[4]!==h||s[5]!==f?(p=(0,R.jsxs)(e.View,{style:xe.columnHeader,children:[h,f]}),s[4]=h,s[5]=f,s[6]=p):p=s[6],s[7]!==c||s[8]!==u||s[9]!==p?(y=(0,R.jsxs)(e.View,{style:u,children:[p,c]}),s[7]=c,s[8]=u,s[9]=p,s[10]=y):y=s[10],y}function fe(t){const n=(0,o.c)(8),{tiles:l,window:i}=t,[c,u]=(0,s.useState)(0),h=ue(c);let f;n[0]===Symbol.for("react.memo_cache_sentinel")?(f=e=>u(e.nativeEvent.layout.width),n[0]=f):f=n[0];const p=f;let y;if(n[1]!==h||n[2]!==l||n[3]!==i){const t=ge(l,h);let o;n[5]!==h||n[6]!==i?(o=t=>{const n=h-t.length,o=1===n?xe.gridSpacerHalf:xe.gridSpacer;return(0,R.jsxs)(e.View,{style:xe.gridRow,children:[n>0&&(0,R.jsx)(e.View,{style:o}),t.map(e=>(0,R.jsx)(be,{Icon:e.Icon,label:e.label,value:e.value,format:e.format},`${i}:${e.key}`)),n>0&&(0,R.jsx)(e.View,{style:o})]},t[0].key)},n[5]=h,n[6]=i,n[7]=o):o=n[7],y=(0,R.jsx)(e.View,{style:xe.grid,onLayout:p,children:t.map(o)}),n[1]=h,n[2]=l,n[3]=i,n[4]=y}else y=n[4];return y}function pe(t){const n=(0,o.c)(7),{tiles:s,window:l}=t;let i,c;if(n[0]!==s||n[1]!==l){let e;n[3]!==l?(e=e=>(0,R.jsx)(be,{Icon:e.Icon,label:e.label,value:e.value,format:e.format},`${l}:${e.key}`),n[3]=l,n[4]=e):e=n[4],i=s.map(e),n[0]=s,n[1]=l,n[2]=i}else i=n[2];return n[5]!==i?(c=(0,R.jsx)(e.View,{style:xe.gridRow,children:i}),n[5]=i,n[6]=c):c=n[6],c}const ye={code:"function statsScreenTsx1(){const{flash}=this.__closure;return{opacity:flash.value*0.28};}"};function be(n){const l=(0,o.c)(22),{Icon:u,label:h,value:f,format:p}=n,y=void 0===p?"count":p;let b;l[0]!==y||l[1]!==f?(b=le(f,y),l[0]=y,l[1]=f,l[2]=b):b=l[2];const x=b,_=(0,s.useRef)(null),w=(0,i.useSharedValue)(0);let S,v;l[3]!==x||l[4]!==w?(S=()=>{null!==_.current&&_.current!==x&&(w.value=(0,i.withSequence)((0,i.withTiming)(1,{duration:150}),(0,i.withTiming)(0,{duration:650}))),_.current=x},v=[x,w],l[3]=x,l[4]=w,l[5]=S,l[6]=v):(S=l[5],v=l[6]),(0,s.useEffect)(S,v);const k=(0,i.useAnimatedStyle)((function({_worklet_12638537412338_init_data:e,flash:t}){const n=()=>({opacity:.28*t.value});return n.__closure={flash:t},n.__workletHash=0xb7ea3886ef2,n.__initData=e,n})({_worklet_12638537412338_init_data:ye,flash:w}));let j;l[7]!==k?(j=[xe.tileFlash,k],l[7]=k,l[8]=j):j=l[8];const C=j;let I,T,V,M,z;return l[9]!==C?(I=(0,R.jsx)(c.default.View,{pointerEvents:"none",style:C}),l[9]=C,l[10]=I):I=l[10],l[11]!==u?(T=(0,R.jsx)(u,{size:30,uniProps:U}),l[11]=u,l[12]=T):T=l[12],l[13]!==x?(V=(0,R.jsx)(t.Text,{style:xe.tileValue,children:x}),l[13]=x,l[14]=V):V=l[14],l[15]!==h?(M=(0,R.jsx)(t.Text,{style:xe.tileLabel,children:h}),l[15]=h,l[16]=M):M=l[16],l[17]!==I||l[18]!==T||l[19]!==V||l[20]!==M?(z=(0,R.jsxs)(e.View,{style:xe.tile,children:[I,T,V,M]}),l[17]=I,l[18]=T,l[19]=V,l[20]=M,l[21]=z):z=l[21],z}const xe=h.StyleSheet.create(e=>({container:{flex:1,backgroundColor:e.colors.surface0,uni__dependencies:[0]},body:{flex:1,minHeight:0},centered:{flex:1,justifyContent:"center",alignItems:"center",gap:e.spacing[6],padding:e.spacing[6],uni__dependencies:[0]},message:{color:e.colors.foregroundMuted,fontSize:e.fontSize.lg,textAlign:"center",uni__dependencies:[0]},scrollWrap:{flex:1,minHeight:0,position:"relative"},scroll:{flex:1,minHeight:0},pinnedTotals:{borderTopWidth:1,borderTopColor:e.colors.border,backgroundColor:e.colors.surface0,paddingHorizontal:{xs:e.spacing[3],md:e.spacing[6]},paddingTop:e.spacing[3],paddingBottom:e.spacing[3]-1,uni__dependencies:[0]},pinnedTotalsInner:{width:"100%",alignSelf:"center",gap:e.spacing[3],uni__dependencies:[0]},logBounds:{width:"100%",alignSelf:"center"},scrollContent:{flexGrow:1,paddingHorizontal:{xs:e.spacing[3],md:e.spacing[6]},paddingTop:e.spacing[4],paddingBottom:e.spacing[6],gap:e.spacing[6],uni__dependencies:[0]},section:{flex:1,minHeight:0},sectionDivided:{borderTopWidth:1,borderTopColor:e.colors.border,uni__dependencies:[0]},toolbar:{borderBottomWidth:1,borderBottomColor:e.colors.border,backgroundColor:e.colors.surface0,paddingHorizontal:{xs:e.spacing[3],md:e.spacing[6]},paddingVertical:e.spacing[3],uni__dependencies:[0]},controlsRow:{position:"relative",flexDirection:"row",justifyContent:"center",alignItems:"center"},controlsCenter:{flexDirection:"row",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:e.spacing[2],uni__dependencies:[0]},controlsRowStacked:{flexDirection:"column",alignItems:"stretch",gap:e.spacing[2],uni__dependencies:[0]},controlsCenterStacked:{flexDirection:"column",alignItems:"stretch",gap:e.spacing[2],uni__dependencies:[0]},resetBottom:{alignItems:"center",borderTopWidth:1,borderTopColor:e.colors.border,paddingVertical:e.spacing[1],uni__dependencies:[0]},resetBottomButton:{minHeight:T.COMPACT_CONTROL_HEIGHT},resetPinned:{position:"absolute",right:0,top:0},inlineMessage:{color:e.colors.foregroundMuted,fontSize:e.fontSize.sm,uni__dependencies:[0]},columns:{flexDirection:"row",gap:e.spacing[4],uni__dependencies:[0]},columnsStacked:{flexDirection:"column"},column:{flex:1,minWidth:0,gap:e.spacing[3],uni__dependencies:[0]},columnStacked:{width:"100%",gap:e.spacing[3],uni__dependencies:[0]},columnHeader:{alignItems:"center",gap:2,paddingBottom:e.spacing[1],uni__dependencies:[0]},columnTitle:{color:e.colors.foreground,fontSize:16,fontWeight:"700",textAlign:"center",uni__dependencies:[0]},columnSubtitle:{color:e.colors.foregroundMuted,fontSize:12,textAlign:"center",uni__dependencies:[0]},dividerVertical:{width:1,alignSelf:"stretch",backgroundColor:e.colors.border,uni__dependencies:[0]},dividerHorizontal:{height:1,backgroundColor:e.colors.border,marginVertical:e.spacing[1],uni__dependencies:[0]},grid:{gap:e.spacing[3],uni__dependencies:[0]},gridRow:{flexDirection:"row",gap:e.spacing[3],uni__dependencies:[0]},gridSpacer:{flex:1},gridSpacerHalf:{flex:.5},tile:{flex:1,minHeight:120,backgroundColor:e.colors.surface1,borderRadius:e.borderRadius.lg,borderWidth:1,borderColor:e.colors.border,padding:e.spacing[4],gap:e.spacing[1],alignItems:"center",justifyContent:"center",uni__dependencies:[0]},tileFlash:{position:"absolute",top:0,left:0,right:0,bottom:0,borderRadius:e.borderRadius.lg,backgroundColor:e.colors.accent,uni__dependencies:[0]},tileValue:{color:e.colors.foreground,fontSize:22,fontWeight:"700",fontVariant:["tabular-nums"],textAlign:"center",uni__dependencies:[0]},tileLabel:{color:e.colors.foregroundMuted,fontSize:12,textAlign:"center",uni__dependencies:[0]}}))},4985,[360,721,700,306,36,182,234,146,454,1332,56,4986,4362,3715,4159,347,348,3595,3448,4989,4990,4991,4127,3662,3591,3663,1120,279]);
16740
16740
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.ClientResourceBar=function(){const c=(0,o.c)(78),{latest:T,elapsedMs:$,samples:C,topGrowth:I,running:N}=(0,u.useResourceSnapshot)(),H=(0,f.useIsCompactFormFactor)(),[k,B]=(0,l.useState)(0);let P;c[0]===Symbol.for("react.memo_cache_sentinel")?(P=t=>B(t.nativeEvent.layout.width),c[0]=P):P=c[0];const G=P,q=2*(H?h.SPACING[3]:h.SPACING[6]),A=k>0?k-q:0;let D;c[1]!==H||c[2]!==A?(D=(0,p.resolveResourceBarLayout)({availableWidth:A,isCompact:H}),c[1]=H,c[2]=A,c[3]=D):D=c[3];const L=D;if(!N&&0===C){let s;return c[4]===Symbol.for("react.memo_cache_sentinel")?(s=(0,x.jsx)(t.View,{style:V.bar,children:(0,x.jsx)(n.Text,{style:V.offText,children:"Performance monitoring is off. Enable it in Settings \u203a Diagnostics to record frame timing, retained state and daemon traffic."})}),c[4]=s):s=c[4],s}if(!T){let s;return c[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,x.jsx)(t.View,{style:V.bar,children:(0,x.jsx)(n.Text,{style:V.offText,children:"Collecting the first resource sample\u2026"})}),c[5]=s):s=c[5],s}const R=T.metrics["frames.fps"];let E;c[6]!==R?(E=y(R,1),c[6]=R,c[7]=E):E=c[7];const W=T.metrics["frames.p95FrameMs"];let K;c[8]!==W?(K=_(W),c[8]=W,c[9]=K):K=c[9];const O=T.metrics["frames.worstFrameMs"];let U;c[10]!==O?(U=_(O),c[10]=O,c[11]=U):U=c[11];const J=T.metrics["frames.longFrames"];let Q;c[12]!==J?(Q=y(J,0),c[12]=J,c[13]=Q):Q=c[13];const X=T.metrics["heap.usedBytes"];let Y;c[14]!==X?(Y=w(X),c[14]=X,c[15]=Y):Y=c[15];const Z=T.metrics["dom.nodes"];let ee;c[16]!==Z?(ee=S(Z),c[16]=Z,c[17]=ee):ee=c[17];const te=T.metrics["query.queries"];let ne;c[18]!==te?(ne=S(te),c[18]=te,c[19]=ne):ne=c[19];const se=T.metrics["query.unobserved"];let oe;c[20]!==se?(oe=S(se),c[20]=se,c[21]=oe):oe=c[21];const ie=T.metrics["query.observers"];let re;c[22]!==ie?(re=S(ie),c[22]=ie,c[23]=re):re=c[23];const le=T.metrics["runtime.liveIntervals"];let ce;c[24]!==le?(ce=S(le),c[24]=le,c[25]=ce):ce=c[25];const ae=T.metrics["runtime.pendingTimeouts"];let de;c[26]!==ae?(de=S(ae),c[26]=ae,c[27]=de):de=c[27];const ue=T.metrics["traffic.messages"];let fe;c[28]!==ue?(fe=S(ue),c[28]=ue,c[29]=fe):fe=c[29];const me=T.metrics["traffic.bytes"];let pe;c[30]!==me?(pe=w(me),c[30]=me,c[31]=pe):pe=c[31];const ge=T.metrics["traffic.handlerMs"];let he;c[32]!==ge?(he=F(ge),c[32]=ge,c[33]=he):he=c[33];const xe=T.metrics["traffic.handlerMs"];let be;c[34]!==T.uptimeMs||c[35]!==xe?(be=M(xe,T.uptimeMs),c[34]=T.uptimeMs,c[35]=xe,c[36]=be):be=c[36];const ye=T.metrics["store.session.sessions.*.agentStreamTail.*.length"];let Se;c[37]!==ye?(Se=S(ye),c[37]=ye,c[38]=Se):Se=c[38];const _e=T.metrics["store.session.sessions.*.agents.size"];let Fe;c[39]!==_e?(Fe=S(_e),c[39]=_e,c[40]=Fe):Fe=c[40];const Me=T.metrics["store.session.sessions.*.workspaces.size"];let we,ze;c[41]!==Me?(we=S(Me),c[41]=Me,c[42]=we):we=c[42];c[43]!==$?(ze=z($),c[43]=$,c[44]=ze):ze=c[44];const je=String(C);let ve,Te;c[45]!==I?(ve=I?`${v(I.key)} +${j(I.slopePerHour)}/h`:"none",c[45]=I,c[46]=ve):ve=c[46];c[47]!==Q||c[48]!==Y||c[49]!==ee||c[50]!==ne||c[51]!==oe||c[52]!==re||c[53]!==ce||c[54]!==de||c[55]!==fe||c[56]!==pe||c[57]!==he||c[58]!==be||c[59]!==Se||c[60]!==Fe||c[61]!==we||c[62]!==ze||c[63]!==E||c[64]!==je||c[65]!==ve||c[66]!==K||c[67]!==U?(Te={fps:E,p95:K,worst:U,longFrames:Q,heap:Y,domNodes:ee,queries:ne,unobserved:oe,observers:re,intervals:ce,timeouts:de,messages:fe,bytes:pe,handler:he,ofSession:be,streamItems:Se,agents:Fe,workspaces:we,observed:ze,samples:je,growth:ve},c[47]=Q,c[48]=Y,c[49]=ee,c[50]=ne,c[51]=oe,c[52]=re,c[53]=ce,c[54]=de,c[55]=fe,c[56]=pe,c[57]=he,c[58]=be,c[59]=Se,c[60]=Fe,c[61]=we,c[62]=ze,c[63]=E,c[64]=je,c[65]=ve,c[66]=K,c[67]=U,c[68]=Te):Te=c[68];const Ve=Te,$e="short"===L.labelMode;let Ce,Ie;if(c[69]!==$e||c[70]!==L.groups||c[71]!==Ve){let s;c[73]!==$e||c[74]!==Ve?(s=(s,o)=>(0,x.jsxs)(t.View,{style:V.group,children:[o>0&&(0,x.jsx)(t.View,{style:V.divider}),(0,x.jsxs)(t.View,{style:V.groupInner,children:[(0,x.jsx)(n.Text,{style:V.groupTitle,children:$e?s.shortTitle:s.title}),(0,x.jsx)(t.View,{style:V.fields,children:s.fields.map(s=>{const o=Ve[s.id]??b;return(0,x.jsxs)(t.View,{style:V.field,children:[(0,x.jsx)(n.Text,{style:V.fieldLabel,children:$e?s.short:s.label}),(0,x.jsx)(n.Text,{style:o===b?V.fieldValueMuted:V.fieldValue,children:o})]},s.id)})})]})]},s.id),c[73]=$e,c[74]=Ve,c[75]=s):s=c[75],Ce=L.groups.map(s),c[69]=$e,c[70]=L.groups,c[71]=Ve,c[72]=Ce}else Ce=c[72];c[76]!==Ce?(Ie=(0,x.jsx)(t.View,{style:V.bar,onLayout:G,children:(0,x.jsx)(s.ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:V.content,children:Ce})}),c[76]=Ce,c[77]=Ie):Ie=c[77];return Ie};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=r(d[4]);r(d[5]),r(d[6]),r(d[7]);var c=r(d[8]),u=r(d[9]),f=r(d[10]),p=r(d[11]),h=r(d[12]),x=r(d[13]);const b="-";function y(t,n){return"number"==typeof t&&Number.isFinite(t)?t.toFixed(n):b}function S(t){return"number"==typeof t&&Number.isFinite(t)?t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e4?`${(t/1e3).toFixed(1)}k`:String(Math.round(t)):b}function _(t){return"number"==typeof t&&Number.isFinite(t)?`${t.toFixed(1)}ms`:b}function F(t){return"number"==typeof t&&Number.isFinite(t)?`${(t/1e3).toFixed(1)}s`:b}function M(t,n){return"number"!=typeof t||!Number.isFinite(t)||n<=0?b:`${(t/n*100).toFixed(2)}%`}function w(t){if("number"!=typeof t||!Number.isFinite(t))return b;const n=["B","KB","MB","GB"];let s=t,o=0;for(;s>=1024&&o<n.length-1;)s/=1024,o+=1;return`${s.toFixed(0===o?0:1)}${n[o]}`}function z(t){const n=Math.max(0,Math.round(t/1e3)),s=Math.floor(n/3600),o=Math.floor(n%3600/60);return s>0?`${s}h${o.toString().padStart(2,"0")}m`:o>0?`${o}m`:`${n}s`}function j(t){return Number.isFinite(t)?Math.abs(t)>=1e6?`${(t/1e6).toFixed(1)}M`:Math.abs(t)>=1e3?`${(t/1e3).toFixed(1)}k`:t.toFixed(t<10?1:0):b}function v(t){return t.split(".").filter(t=>"*"!==t).slice(-2).join(".")}const T=(()=>{const t=(0,h.compactUp)(h.SPACING[8],1.5),n=2*h.SPACING[3]+1;return{xs:t.xs+n,sm:t.sm+n,md:t.md+n,lg:t.lg+n,xl:t.xl+n}})(),V=c.StyleSheet.create(t=>({bar:{minHeight:T,justifyContent:"center",borderTopWidth:1,borderTopColor:t.colors.border,backgroundColor:t.colors.surface0,uni__dependencies:[0]},content:{flexDirection:"row",alignItems:"center",paddingHorizontal:{xs:t.spacing[3],md:t.spacing[6]},paddingVertical:t.spacing[1],uni__dependencies:[0]},group:{flexDirection:"row",alignItems:"stretch"},groupInner:{gap:2,justifyContent:"center"},divider:{width:1,alignSelf:"stretch",backgroundColor:t.colors.border,marginHorizontal:t.spacing[4],uni__dependencies:[0]},groupTitle:{fontSize:t.fontSize.xs,lineHeight:t.fontSize.xs+2,color:t.colors.foregroundMuted,textTransform:"uppercase",letterSpacing:.6,uni__dependencies:[0]},fields:{flexDirection:"row",gap:t.spacing[3],uni__dependencies:[0]},field:{gap:0},fieldLabel:{fontSize:t.fontSize.xs,lineHeight:t.fontSize.xs+2,color:t.colors.foregroundMuted,uni__dependencies:[0]},fieldValue:{fontSize:t.fontSize.code,lineHeight:t.fontSize.code+3,fontFamily:t.fontFamily.mono,color:t.colors.foreground,uni__dependencies:[0]},fieldValueMuted:{fontSize:t.fontSize.code,lineHeight:t.fontSize.code+3,fontFamily:t.fontFamily.mono,color:t.colors.foregroundMuted,uni__dependencies:[0]},offText:{fontSize:t.fontSize.sm,color:t.colors.foregroundMuted,paddingHorizontal:{xs:t.spacing[3],md:t.spacing[6]},paddingVertical:t.spacing[2],uni__dependencies:[0]}}))},4986,[360,721,700,306,36,182,234,146,56,4987,347,4988,305,279]);
16741
16741
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useResourceSnapshot=function(){const s=(0,n.c)(2),[u,p]=(0,t.useState)(c);let f,M;s[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>(p(l()),o.resourceMonitor.subscribe(()=>{p(l())})),M=[],s[0]=f,s[1]=M):(f=s[0],M=s[1]);return(0,t.useEffect)(f,M),u};var n=r(d[0]),t=r(d[1]),s=r(d[2]),o=r(d[3]);const u={latest:null,elapsedMs:0,samples:0,topGrowth:null,running:!1};function c(){return l()}function l(){const n=o.resourceMonitor.getSamples();if(0===n.length)return Object.assign({},u,{running:o.resourceMonitor.running});const t=(0,s.analyzeResourceTrend)(n);return{latest:n[n.length-1],elapsedMs:t.elapsedMs,samples:n.length,topGrowth:t.growing[0]??null,running:o.resourceMonitor.running}}},4987,[306,36,4338,4331]);
16742
16742
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESOURCE_GROUPS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"COMPACT_RESOURCE_GROUP",{enumerable:!0,get:function(){return l}}),e.estimateGroupWidth=v,e.estimateStripWidth=w,e.resolveResourceBarLayout=function(s){if(s.isCompact)return{groups:[l],labelMode:"short"};if(s.availableWidth<=0)return{groups:o,labelMode:"full"};if(w(o,"full")<=s.availableWidth)return{groups:o,labelMode:"full"};let t=o;for(const o of[null,...h])if(null!==o&&(t=t.filter(s=>s.id!==o)),w(t,"short")<=s.availableWidth)return{groups:t,labelMode:"short"};return{groups:t,labelMode:"short"}};var s=r(d[0]);const t={fps:{id:"fps",label:"fps",short:"fps"},p95:{id:"p95",label:"p95",short:"p95"},worst:{id:"worst",label:"worst",short:"wst"},longFrames:{id:"longFrames",label:"long",short:"lng"},heap:{id:"heap",label:"js heap",short:"js"},domNodes:{id:"domNodes",label:"dom nodes",short:"dom"},queries:{id:"queries",label:"queries",short:"qry"},unobserved:{id:"unobserved",label:"unobserved",short:"unob"},observers:{id:"observers",label:"observers",short:"obs"},intervals:{id:"intervals",label:"intervals",short:"int"},timeouts:{id:"timeouts",label:"timeouts",short:"to"},messages:{id:"messages",label:"messages",short:"msg"},bytes:{id:"bytes",label:"bytes",short:"byt"},handler:{id:"handler",label:"handler",short:"hnd"},ofSession:{id:"ofSession",label:"of session",short:"%ses"},streamItems:{id:"streamItems",label:"stream items",short:"itm"},agents:{id:"agents",label:"agents",short:"agt"},workspaces:{id:"workspaces",label:"workspaces",short:"wsp"},observed:{id:"observed",label:"observed",short:"time"},samples:{id:"samples",label:"samples",short:"smp"},growth:{id:"growth",label:"fastest growth",short:"growth",valueChars:20}},o=[{id:"frames",title:"Frames",shortTitle:"Frames",fields:[t.fps,t.p95,t.worst,t.longFrames]},{id:"memory",title:"Memory",shortTitle:"Mem",fields:[t.heap,t.domNodes]},{id:"cache",title:"Cache",shortTitle:"Cache",fields:[t.queries,t.unobserved,t.observers]},{id:"timers",title:"Timers",shortTitle:"Tmrs",fields:[t.intervals,t.timeouts]},{id:"traffic",title:"Daemon traffic",shortTitle:"Traffic",fields:[t.messages,t.bytes,t.handler,t.ofSession]},{id:"chat",title:"Chat state",shortTitle:"Chat",fields:[t.streamItems,t.agents,t.workspaces]},{id:"session",title:"Session",shortTitle:"Sess",fields:[t.observed,t.samples,t.growth]}],l={id:"compact",title:"Performance",shortTitle:"Perf",fields:[t.fps,t.p95,t.worst,t.heap]},h=["timers","cache","chat","traffic","session","memory"],n=.55*s.FONT_SIZE.xs,b=.62*s.FONT_SIZE.code,f=6,u=s.SPACING[3],c=2*s.SPACING[4]+1;function p(s,t){const o="short"===t?s.short:s.label,l=(s.valueChars??f)*b;return Math.max(o.length*n,l)}function v(s,t){const o="short"===t?s.shortTitle:s.title,l=s.fields.reduce((s,o)=>s+p(o,t),0)+u*Math.max(0,s.fields.length-1);return Math.max(o.length*n,l)}function w(s,t){if(0===s.length)return 0;return s.reduce((s,o)=>s+v(o,t),0)+c*(s.length-1)}},4988,[305]);