@salilvnair/dui 1.0.11 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +730 -96
- package/dist/index.js +3726 -3713
- package/dist/index.js.map +1 -1
- package/dist/lib/components/input/select-position.d.ts +54 -0
- package/dist/monaco-setup.core.d.ts +4 -0
- package/dist/monaco-setup.d.ts +1 -4
- package/dist/monaco-setup.js +19 -19
- package/dist/monaco-setup.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +20 -3
- package/dist/assets/DuiShowcase-BOtwgwbq.css +0 -1
- package/dist/assets/DuiShowcase-Bl4Oi2Vw.js +0 -74723
- package/dist/assets/abap-DLDM7-KI.js +0 -1
- package/dist/assets/apex-DNDY2TF8.js +0 -1
- package/dist/assets/azcli-Y6nb8tq_.js +0 -1
- package/dist/assets/bat-BwHxbl9M.js +0 -1
- package/dist/assets/bicep-CFznDFnq.js +0 -2
- package/dist/assets/cameligo-Bf6VGUru.js +0 -1
- package/dist/assets/clojure-Dnu-v4kV.js +0 -1
- package/dist/assets/codicon-ngg6Pgfi.ttf +0 -0
- package/dist/assets/coffee-Bd8akH9Z.js +0 -1
- package/dist/assets/cpp-BbWJElDN.js +0 -1
- package/dist/assets/csharp-Co3qMtFm.js +0 -1
- package/dist/assets/csp-D-4FJmMZ.js +0 -1
- package/dist/assets/css-DdJfP1eB.js +0 -3
- package/dist/assets/css.worker-B4z49cGk.js +0 -93
- package/dist/assets/cssMode-CZYOZ1AO.js +0 -1
- package/dist/assets/cypher-cTPe9QuQ.js +0 -1
- package/dist/assets/dart-BOtBlQCF.js +0 -1
- package/dist/assets/dockerfile-BG73LgW2.js +0 -1
- package/dist/assets/ecl-BEgZUVRK.js +0 -1
- package/dist/assets/elixir-BkW5O-1t.js +0 -1
- package/dist/assets/flow9-BeJ5waoc.js +0 -1
- package/dist/assets/freemarker2-CGSa1nHJ.js +0 -3
- package/dist/assets/fsharp-PahG7c26.js +0 -1
- package/dist/assets/go-acbASCJo.js +0 -1
- package/dist/assets/graphql-BxJiqAUM.js +0 -1
- package/dist/assets/handlebars-mB8dxbcs.js +0 -1
- package/dist/assets/hcl-DtV1sZF8.js +0 -1
- package/dist/assets/html-l7YRKuHI.js +0 -1
- package/dist/assets/html.worker-DtiGdgqp.js +0 -470
- package/dist/assets/htmlMode-CuoiFE2t.js +0 -1
- package/dist/assets/index-Dylj6yGs.css +0 -10
- package/dist/assets/index-ROymQLGX.js +0 -50
- package/dist/assets/ini-Kd9XrMLS.js +0 -1
- package/dist/assets/java-CXBNlu9o.js +0 -1
- package/dist/assets/javascript-9UYwmKgx.js +0 -1
- package/dist/assets/json.worker-leyajbqV.js +0 -58
- package/dist/assets/jsonMode-6uegdfHj.js +0 -7
- package/dist/assets/julia-cl7-CwDS.js +0 -1
- package/dist/assets/kotlin-s7OhZKlX.js +0 -1
- package/dist/assets/less-9HpZscsL.js +0 -2
- package/dist/assets/lexon-OrD6JF1K.js +0 -1
- package/dist/assets/liquid-C8P3CEDc.js +0 -1
- package/dist/assets/lspLanguageFeatures-Ju8ugRgx.js +0 -4
- package/dist/assets/lua-Cyyb5UIc.js +0 -1
- package/dist/assets/m3-B8OfTtLu.js +0 -1
- package/dist/assets/markdown-BFxVWTOG.js +0 -1
- package/dist/assets/mdx-D4_p5PzA.js +0 -1
- package/dist/assets/mips-CiqrrVzr.js +0 -1
- package/dist/assets/monaco-editor-CN2OOCze.js +0 -908
- package/dist/assets/monaco-editor-qiF_U8vl.css +0 -1
- package/dist/assets/msdax-DmeGPVcC.js +0 -1
- package/dist/assets/mysql-C_tMU-Nz.js +0 -1
- package/dist/assets/objective-c-BDtDVThU.js +0 -1
- package/dist/assets/pascal-vHIfCaH5.js +0 -1
- package/dist/assets/pascaligo-DtZ0uQbO.js +0 -1
- package/dist/assets/perl-Ub6l9XKa.js +0 -1
- package/dist/assets/pgsql-BlNEE0v7.js +0 -1
- package/dist/assets/php-BBUBE1dy.js +0 -1
- package/dist/assets/pla-DSh2-awV.js +0 -1
- package/dist/assets/postiats-CocnycG-.js +0 -1
- package/dist/assets/powerquery-tScXyioY.js +0 -1
- package/dist/assets/powershell-COWaemsV.js +0 -1
- package/dist/assets/protobuf-Brw8urJB.js +0 -2
- package/dist/assets/pug-8SOpv6rk.js +0 -1
- package/dist/assets/python-BDvE0baC.js +0 -1
- package/dist/assets/qsharp-Bw9ernYp.js +0 -1
- package/dist/assets/r-j7ic8hl3.js +0 -1
- package/dist/assets/razor-3AZt1jFw.js +0 -1
- package/dist/assets/redis-Bu5POkcn.js +0 -1
- package/dist/assets/redshift-Bs9aos_-.js +0 -1
- package/dist/assets/restructuredtext-CqXO7rUv.js +0 -1
- package/dist/assets/ruby-zBfavPgS.js +0 -1
- package/dist/assets/rust-BzKRNQWT.js +0 -1
- package/dist/assets/sb-BBc9UKZt.js +0 -1
- package/dist/assets/scala-D9hQfWCl.js +0 -1
- package/dist/assets/scheme-BPhDTwHR.js +0 -1
- package/dist/assets/scss-CBJaRo0y.js +0 -3
- package/dist/assets/shell-DiJ1NA_G.js +0 -1
- package/dist/assets/solidity-Db0IVjzk.js +0 -1
- package/dist/assets/sophia-CnS9iZB_.js +0 -1
- package/dist/assets/sparql-CJmd_6j2.js +0 -1
- package/dist/assets/sql-ClhHkBeG.js +0 -1
- package/dist/assets/st-CHwy0fLd.js +0 -1
- package/dist/assets/swift-Bqt4WxQ4.js +0 -3
- package/dist/assets/systemverilog-Bs9z6M-B.js +0 -1
- package/dist/assets/tcl-Dm6ycUr_.js +0 -1
- package/dist/assets/ts.worker-59MjiAqk.js +0 -67731
- package/dist/assets/tsMode-2fAJOXuF.js +0 -11
- package/dist/assets/twig-Csy3S7wG.js +0 -1
- package/dist/assets/typescript-Bv1W4NlY.js +0 -1
- package/dist/assets/typespec-Btyra-wh.js +0 -1
- package/dist/assets/vb-Db0cS2oM.js +0 -1
- package/dist/assets/wgsl-BTesnYfV.js +0 -298
- package/dist/assets/xml-CR03X85Q.js +0 -1
- package/dist/assets/yaml-Qi3RsNvX.js +0 -1
- package/dist/index.html +0 -15
package/dist/monaco-setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monaco-setup.js","sources":["../src/hooks/useAppTheme.ts","../src/services/dk-repl.ts","../src/hooks/useBreakpointGutter.ts","../src/store/debug-store.ts","../src/lib/components/input/EditorView.monaco.tsx","../src/lib/components/input/DiffEditorView.monaco.tsx","../src/monaco-setup.ts"],"sourcesContent":["/**\n * useAppTheme — returns 'dark' | 'light' and re-renders on change.\n *\n * Detects theme from (in priority order):\n * 1. VS Code webview: data-vscode-theme-kind on <body> (set by VS Code host)\n * 2. Generic: data-theme on <html> (daakia / other web apps)\n * 3. Fallback: 'dark'\n */\nimport { useState, useEffect } from 'react';\n\nfunction resolveTheme(): 'dark' | 'light' {\n const vsKind =\n document.body?.getAttribute('data-vscode-theme-kind') ||\n document.documentElement.getAttribute('data-vscode-theme-kind');\n if (vsKind) return vsKind === 'vscode-light' ? 'light' : 'dark';\n return (document.documentElement.getAttribute('data-theme') as 'dark' | 'light') || 'dark';\n}\n\nexport function useAppTheme(): 'dark' | 'light' {\n const [theme, setTheme] = useState<'dark' | 'light'>(resolveTheme);\n\n useEffect(() => {\n const update = () => setTheme(resolveTheme());\n const htmlObs = new MutationObserver(update);\n htmlObs.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme', 'data-vscode-theme-kind'] });\n const bodyObs = new MutationObserver(update);\n if (document.body) bodyObs.observe(document.body, { attributes: true, attributeFilter: ['data-vscode-theme-kind'] });\n return () => { htmlObs.disconnect(); bodyObs.disconnect(); };\n }, []);\n\n return theme;\n}\n","// Stub — dk-repl completions are daakia-specific and not used in standalone DUI.\nexport const DK_TYPE_DEFS = '';\nexport function getDkCompletions(_text: string, _monaco: unknown, _pos: unknown): unknown[] {\n return [];\n}\n","import { useRef, useEffect, useCallback, MutableRefObject } from 'react';\n\nexport interface BreakpointGutterOptions {\n breakpoints?: number[];\n disabledBreakpoints?: number[];\n conditionalBreakpointLines?: number[];\n /** Currently paused line (1-based) — shows yellow highlight */\n pausedLine?: number | null;\n onToggleBreakpoint?: (line: number) => void;\n onGlyphContextMenu?: (line: number, pos: { x: number; y: number }) => void;\n}\n\n/**\n * Encapsulates all breakpoint gutter logic for a Monaco editor:\n * - Line validation (only skips empty lines)\n * - Breakpoint dot decorations (red/disabled/conditional)\n * - Glyph margin click & context-menu handlers\n * - Hover hint (faded dot on valid, non-breakpointed lines)\n *\n * Returns `attach(editor, monaco)` to be called in onMount,\n * and handles cleanup/decoration updates via effects.\n */\nexport function useBreakpointGutter(options: BreakpointGutterOptions) {\n const {\n breakpoints,\n disabledBreakpoints,\n conditionalBreakpointLines,\n pausedLine,\n onToggleBreakpoint,\n onGlyphContextMenu,\n } = options;\n\n const editorRef = useRef<any>(null);\n const monacoRef = useRef<any>(null);\n const decorationsRef = useRef<string[]>([]);\n const pausedDecoRef = useRef<string[]>([]);\n const hoverDecoRef = useRef<string[]>([]);\n const disposablesRef = useRef<any[]>([]);\n\n const isBreakpointableLine = useCallback((lineNo: number): boolean => {\n const editor = editorRef.current;\n if (!editor) return true;\n const model = editor.getModel();\n if (!model || lineNo > model.getLineCount()) return false;\n const lineContent = model.getLineContent(lineNo).trim();\n return !!lineContent;\n }, []);\n\n // Sync breakpoint decorations when breakpoints change\n useEffect(() => {\n const editor = editorRef.current;\n const monaco = monacoRef.current;\n if (!editor || !monaco) return;\n\n const decos: any[] = [];\n\n if (breakpoints) {\n for (const line of breakpoints) {\n // Skip breakpoint glyph on the paused line — the arrow \"gulps\" it\n if (pausedLine && line === pausedLine) continue;\n\n const isDisabled = disabledBreakpoints?.includes(line);\n const isConditional = conditionalBreakpointLines?.includes(line);\n let glyphClass = 'daakia-bp-glyph';\n if (isDisabled) glyphClass = 'daakia-bp-glyph--disabled';\n else if (isConditional) glyphClass = 'daakia-bp-glyph--conditional';\n\n decos.push({\n range: new monaco.Range(line, 1, line, 1),\n options: {\n isWholeLine: true,\n className: isDisabled ? '' : 'daakia-bp-line',\n stickiness: monaco.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n glyphMarginClassName: glyphClass,\n glyphMarginHoverMessage: {\n value: isConditional ? 'Conditional Breakpoint' : isDisabled ? 'Disabled Breakpoint' : 'Breakpoint',\n },\n },\n });\n }\n }\n\n decorationsRef.current = editor.deltaDecorations(decorationsRef.current, decos);\n }, [breakpoints, disabledBreakpoints, conditionalBreakpointLines, pausedLine]);\n\n // Sync paused-line highlight (yellow background + arrow in glyph margin)\n useEffect(() => {\n const editor = editorRef.current;\n const monaco = monacoRef.current;\n if (!editor || !monaco) return;\n\n if (pausedLine) {\n // Use combined class when paused line is also a breakpoint line\n const isOnBreakpoint = breakpoints?.includes(pausedLine);\n const glyphClass = isOnBreakpoint\n ? 'daakia-paused-line__arrow daakia-paused-line__arrow--with-bp'\n : 'daakia-paused-line__arrow';\n\n pausedDecoRef.current = editor.deltaDecorations(pausedDecoRef.current, [{\n range: new monaco.Range(pausedLine, 1, pausedLine, 1),\n options: {\n isWholeLine: true,\n className: 'daakia-paused-line',\n glyphMarginClassName: glyphClass,\n stickiness: monaco.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n },\n }]);\n // Scroll to the paused line\n editor.revealLineInCenter(pausedLine);\n } else {\n pausedDecoRef.current = editor.deltaDecorations(pausedDecoRef.current, []);\n }\n }, [pausedLine, breakpoints]);\n\n // Cleanup disposables on unmount\n useEffect(() => {\n return () => {\n disposablesRef.current.forEach(d => d?.dispose?.());\n disposablesRef.current = [];\n };\n }, []);\n\n /**\n * Call this inside Monaco's onMount handler to attach all gutter interactions.\n * Returns the disposables (also tracked internally for auto-cleanup).\n */\n const attach = useCallback((editor: any, monaco: any) => {\n editorRef.current = editor;\n monacoRef.current = monaco;\n\n // Mark the entire margin container so RightClickMenu can detect gutter clicks\n const domNode = editor.getDomNode();\n if (domNode) {\n const marginContainer = domNode.querySelector('.margin');\n if (marginContainer) marginContainer.setAttribute('data-daakia-bp-gutter', '');\n }\n\n // Left-click to toggle breakpoint (right-click is handled separately for context menu)\n if (onToggleBreakpoint) {\n const d1 = editor.onMouseDown((e: any) => {\n if (e.event.leftButton && e.target.type === monaco.editor.MouseTargetType.GUTTER_GLYPH_MARGIN) {\n const line = e.target.position?.lineNumber;\n if (line && isBreakpointableLine(line)) onToggleBreakpoint(line);\n }\n });\n disposablesRef.current.push(d1);\n }\n\n // Right-click context menu — use DOM-level listener to intercept BEFORE Monaco shows its own menu\n if (onGlyphContextMenu) {\n let glyphRightClick: { line: number; x: number; y: number } | null = null;\n\n // Detect right-click on any gutter zone (glyph margin, line numbers, line decorations)\n const d2a = editor.onMouseDown((e: any) => {\n if (\n e.event.rightButton &&\n (e.target.type === monaco.editor.MouseTargetType.GUTTER_GLYPH_MARGIN ||\n e.target.type === monaco.editor.MouseTargetType.GUTTER_LINE_NUMBERS ||\n e.target.type === monaco.editor.MouseTargetType.GUTTER_LINE_DECORATIONS)\n ) {\n const line = e.target.position?.lineNumber;\n if (line && isBreakpointableLine(line)) {\n glyphRightClick = { line, x: e.event.posx, y: e.event.posy };\n }\n }\n });\n disposablesRef.current.push(d2a);\n\n // DOM-level contextmenu intercept — prevents Monaco's built-in menu on gutter area\n const domNode = editor.getDomNode();\n if (domNode) {\n const domHandler = (ev: MouseEvent) => {\n if (glyphRightClick) {\n ev.preventDefault();\n ev.stopPropagation();\n onGlyphContextMenu(glyphRightClick.line, { x: glyphRightClick.x, y: glyphRightClick.y });\n glyphRightClick = null;\n } else if ((ev.target as HTMLElement).closest('[data-daakia-bp-gutter]')) {\n // Fallback: block Monaco's default menu for any gutter right-click\n ev.preventDefault();\n ev.stopPropagation();\n }\n };\n domNode.addEventListener('contextmenu', domHandler, true); // capture phase\n disposablesRef.current.push({ dispose: () => domNode.removeEventListener('contextmenu', domHandler, true) });\n }\n }\n\n // Hover hint: faded dot on valid non-breakpointed lines\n if (onToggleBreakpoint) {\n const d3 = editor.onMouseMove((e: any) => {\n if (e.target.type === monaco.editor.MouseTargetType.GUTTER_GLYPH_MARGIN) {\n const line = e.target.position?.lineNumber;\n if (line && isBreakpointableLine(line)) {\n const model = editor.getModel();\n if (model) {\n const lineDecos = model.getLineDecorations(line);\n const hasBpDeco = lineDecos?.some((d: any) =>\n d.options?.glyphMarginClassName?.startsWith('daakia-bp-glyph') &&\n !d.options?.glyphMarginClassName?.includes('hover')\n );\n if (!hasBpDeco) {\n hoverDecoRef.current = editor.deltaDecorations(hoverDecoRef.current, [{\n range: new monaco.Range(line, 1, line, 1),\n options: {\n isWholeLine: false,\n stickiness: monaco.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n glyphMarginClassName: 'daakia-bp-glyph--hover',\n glyphMarginHoverMessage: { value: 'Left-click to add a breakpoint' },\n },\n }]);\n return;\n }\n }\n }\n }\n // Clear hover when not on glyph margin\n if (hoverDecoRef.current.length) {\n hoverDecoRef.current = editor.deltaDecorations(hoverDecoRef.current, []);\n }\n });\n disposablesRef.current.push(d3);\n\n const d4 = editor.onMouseLeave(() => {\n if (hoverDecoRef.current.length) {\n hoverDecoRef.current = editor.deltaDecorations(hoverDecoRef.current, []);\n }\n });\n disposablesRef.current.push(d4);\n }\n\n // Apply breakpoint decorations immediately after attach (fixes disappearing on remount)\n if (breakpoints) {\n const decos: any[] = [];\n for (const line of breakpoints) {\n const isDisabled = disabledBreakpoints?.includes(line);\n const isConditional = conditionalBreakpointLines?.includes(line);\n let glyphClass = 'daakia-bp-glyph';\n if (isDisabled) glyphClass = 'daakia-bp-glyph--disabled';\n else if (isConditional) glyphClass = 'daakia-bp-glyph--conditional';\n\n decos.push({\n range: new monaco.Range(line, 1, line, 1),\n options: {\n isWholeLine: true,\n className: isDisabled ? '' : 'daakia-bp-line',\n stickiness: monaco.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n glyphMarginClassName: glyphClass,\n glyphMarginHoverMessage: {\n value: isConditional ? 'Conditional Breakpoint' : isDisabled ? 'Disabled Breakpoint' : 'Breakpoint',\n },\n },\n });\n }\n decorationsRef.current = editor.deltaDecorations(decorationsRef.current, decos);\n }\n }, [onToggleBreakpoint, onGlyphContextMenu, isBreakpointableLine, breakpoints, disabledBreakpoints, conditionalBreakpointLines]);\n\n return { attach };\n}\n","// Stub — debug store is daakia-specific.\ninterface DebugState {\n navigateLine: number | null;\n setNavigateLine: (line: number | null) => void;\n active: boolean;\n status: 'idle' | 'running' | 'paused';\n variables: { name: string; value: unknown; type: string }[];\n}\n\nconst state: DebugState = {\n navigateLine: null,\n setNavigateLine: () => {},\n active: false,\n status: 'idle',\n variables: [],\n};\n\nexport function useDebugStore<T>(selector: (s: DebugState) => T): T {\n return selector(state);\n}\nuseDebugStore.getState = () => state;\n","import Editor, { type OnMount } from '@monaco-editor/react';\nimport { useRef, useMemo, useEffect } from 'react';\nimport { useAppTheme } from '../../../hooks/useAppTheme';\nimport { getDkCompletions, DK_TYPE_DEFS } from '../../../services/dk-repl';\nimport { initGraphQLCompletionProvider } from '../../../services/graphql-completion';\nimport { jsonPathLevels, xPathLevels } from './doc-path';\nimport { useEditorBase } from '../../core/EditorBase';\nimport { EditorShell } from './EditorView.shell';\nimport type { ContextMenuItem } from '../modal/ContextMenuView';\nimport type { EditorViewProps, EditorLanguage, EditorOptions, EditorContextMenuMode } from './EditorView';\n\n// ─── Debug-only imports — only loaded when debugSupported=true ─────────────────\nimport { useBreakpointGutter } from '../../../hooks/useBreakpointGutter';\nimport { useDebugVariableHover } from '../../../hooks/useDebugVariableHover';\nimport { useDebugStore } from '../../../store/debug-store';\n\n// This file is only ever reached by '@salilvnair/dui/monaco-setup' — a\n// separate, explicit opt-in subpath, never referenced (statically or via\n// lazy()) from the main package entry. That's what makes a plain top-level\n// import safe here: importing monaco-setup already requires Monaco installed.\n// See monaco-runtime.ts for why an in-place lazy()/dynamic-import approach\n// inside the always-loaded EditorView.tsx does not work.\n\nlet dkLibRegistered = false;\n\n// Monaco's language configuration and completion providers are GLOBAL per\n// language id, not per editor — registering them inside every mount stacked a\n// fresh provider on each remount (N editors open → the same suggestion N times).\nconst tagLangConfigured = new Set<string>();\nconst plainLangConfigured = new Set<string>();\n\n// HTML elements that never take a closing tag. XML has no such concept — every\n// element there is closed or self-closed — so this only applies to language 'html'.\nconst VOID_TAGS = new Set([\n 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input',\n 'link', 'meta', 'param', 'source', 'track', 'wbr',\n]);\n\n// An opening tag ending exactly at the caret. The attribute group tolerates\n// quoted '>' (e.g. <a title=\"a > b\">) by consuming whole quoted strings first.\nconst OPEN_TAG_AT_CARET = /<([_:a-zA-Z][-_:.\\w]*)((?:\"[^\"]*\"|'[^']*'|[^'\">])*)>$/;\nconst ANY_TAG = /<\\/?([_:a-zA-Z][-_:.\\w]*)((?:\"[^\"]*\"|'[^']*'|[^'\">])*)>/g;\n\nfunction escapeRe(s: string) { return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); }\n\n/** Innermost still-open tag in `text`, or null. Used to complete `</`. */\nfunction innermostOpenTag(text: string): string | null {\n const scrubbed = text.replace(/<!--[\\s\\S]*?-->/g, '').replace(/<!\\[CDATA\\[[\\s\\S]*?\\]\\]>/g, '');\n const stack: string[] = [];\n ANY_TAG.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = ANY_TAG.exec(scrubbed)) !== null) {\n const [full, name, attrs] = m;\n if (full.startsWith('</')) {\n const at = stack.lastIndexOf(name);\n if (at !== -1) stack.length = at; else stack.pop();\n } else if (!attrs.trimEnd().endsWith('/')) {\n stack.push(name);\n }\n }\n return stack.length ? stack[stack.length - 1] : null;\n}\n\nfunction configureTagLanguage(monacoInstance: any, langId: 'xml' | 'html') {\n if (tagLangConfigured.has(langId)) return;\n tagLangConfigured.add(langId);\n const config = {\n // Deliberately no { open: '<', close: '>' } here — matching VS Code's own\n // html/xml language configuration. Auto-inserting '>' would mean the user's\n // own '>' keystroke merely skips over it, producing no model change, and\n // tag auto-closing (which is what people actually expect) could never fire.\n autoClosingPairs: [\n { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' },\n { open: '\"', close: '\"', notIn: ['string'] },\n { open: \"'\", close: \"'\", notIn: ['string', 'comment'] },\n { open: '<!--', close: '-->', notIn: ['comment', 'string'] },\n ],\n brackets: [['{', '}'], ['[', ']'], ['(', ')'], ['<', '>']],\n surroundingPairs: [\n { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' },\n { open: '\"', close: '\"' }, { open: \"'\", close: \"'\" }, { open: '<', close: '>' },\n ],\n comments: { blockComment: ['<!--', '-->'] },\n onEnterRules: [\n {\n // Enter between <a>|</a> — open the pair onto three lines, caret indented.\n beforeText: /<([_:\\w][_:\\w\\-.\\d]*)([^/>]*(?!\\/)>)\\s*$/i,\n afterText: /^<\\/([_:\\w][_:\\w\\-.\\d]*)\\s*>$/i,\n action: { indentAction: monacoInstance.languages.IndentAction.IndentOutdent },\n },\n {\n beforeText: /<([_:\\w][_:\\w\\-.\\d]*)([^/>]*(?!\\/)>)\\s*$/i,\n action: { indentAction: monacoInstance.languages.IndentAction.Indent },\n },\n ],\n wordPattern: /(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)/g,\n };\n\n // Monaco registers its own xml/html language configuration from a LAZILY\n // IMPORTED module, and among equal-priority registrations the last one wins.\n // A plain synchronous call here therefore loses the race and their config —\n // which auto-closes '<' with '>' — stays in force, so typing '<' produced\n // '<>' and a completed '</tag' left a stray '>' behind. Re-apply on a short\n // bounded schedule (disposing the previous registration so only one of ours\n // is ever live) to land after their import resolves, whenever that is.\n let live = monacoInstance.languages.setLanguageConfiguration(langId, config);\n for (const delay of [50, 250, 1000]) {\n setTimeout(() => {\n const next = monacoInstance.languages.setLanguageConfiguration(langId, config);\n live?.dispose?.();\n live = next;\n }, delay);\n }\n}\n\n/**\n * VS Code-style tag auto-closing for XML/HTML.\n *\n * Monaco's basic-languages XML support has no tag awareness at all — that lives\n * in VS Code's HTML language service, which isn't bundled here. So we do it\n * ourselves: typing '>' completes the element, and typing '/' after '<' fills\n * in the innermost open tag. Both are plain model edits, so undo/redo and the\n * {{var}} decorations keep working normally.\n *\n * This relies on '<' NOT being an auto-closing pair (see configureTagLanguage):\n * if Monaco auto-inserted '>', typing '>' would only skip over the existing one\n * and produce no content change for us to react to.\n */\nfunction installTagAutoClose(editor: any, monacoInstance: any) {\n let reentrant = false;\n const sub = editor.onDidChangeModelContent((e: any) => {\n if (reentrant || e.isUndoing || e.isRedoing) return;\n const model = editor.getModel();\n if (!model) return;\n const langId = model.getLanguageId();\n if (langId !== 'xml' && langId !== 'html') return;\n /*\n Somebody who has turned bracket auto-closing off has said what they want.\n Completing their tags for them is the same favour they just declined, and\n doing it anyway is how `</Currency>` came out as `</Currency>Currency>`\n for anything driving this editor a character at a time.\n */\n if (editor.getOption?.(monacoInstance.editor.EditorOption.autoClosingBrackets) === 'never') return;\n // Only react to a single typed character — never to paste, multi-cursor or\n // a programmatic setValue, where guessing the user's intent is wrong.\n if (e.changes.length !== 1) return;\n const change = e.changes[0];\n if (change.text !== '>' && change.text !== '/') return;\n\n const line = change.range.startLineNumber;\n const column = change.range.startColumn + change.text.length;\n const before = model.getValueInRange({\n startLineNumber: 1, startColumn: 1, endLineNumber: line, endColumn: column,\n });\n\n let insert: string;\n let caretShift: number;\n let consumeNext = 0; // characters after the caret this edit should replace\n\n if (change.text === '>') {\n const open = OPEN_TAG_AT_CARET.exec(before);\n if (!open) return;\n if (open[2].trimEnd().endsWith('/')) return; // <br/> — already self-closed\n if (langId === 'html' && VOID_TAGS.has(open[1].toLowerCase())) return;\n const rest = model.getValueInRange({\n startLineNumber: line, startColumn: column,\n endLineNumber: line, endColumn: model.getLineMaxColumn(line),\n });\n if (new RegExp(`^\\\\s*</${escapeRe(open[1])}\\\\s*>`).test(rest)) return; // closing tag already sits here\n insert = `</${open[1]}>`;\n caretShift = 0; // caret stays between the tags\n } else {\n if (!/<\\/$/.test(before)) return;\n const tag = innermostOpenTag(before.slice(0, -2));\n if (!tag) return;\n insert = `${tag}>`;\n caretShift = insert.length; // caret lands after the completed tag\n // Swallow a '>' sitting right at the caret. It can only be one Monaco\n // auto-inserted when '<' was typed — '</>' is not valid markup — and\n // leaving it behind produced '</tag>>'. Defensive: the language config\n // above normally prevents that pair from existing at all.\n if (model.getLineContent(line).charAt(column - 1) === '>') consumeNext = 1;\n }\n\n reentrant = true;\n try {\n editor.executeEdits(\n 'daakia.autoCloseTag',\n [{ range: new monacoInstance.Range(line, column, line, column + consumeNext), text: insert, forceMoveMarkers: false }],\n [new monacoInstance.Selection(line, column + caretShift, line, column + caretShift)],\n );\n } finally {\n reentrant = false;\n }\n });\n editor.onDidDispose(() => sub.dispose());\n}\n\nconst EXT_MAP: Partial<Record<EditorLanguage, string>> = {\n javascript: '.js', typescript: '.ts', json: '.json', xml: '.xml',\n html: '.html', css: '.css', graphql: '.graphql', python: '.py',\n yaml: '.yaml', sql: '.sql', markdown: '.md', plaintext: '.txt', proto: '.proto',\n};\n\nfunction formatXml(xml: string): string {\n const INDENT = ' ';\n let depth = 0;\n let result = '';\n const tokens = xml.replace(/>\\s*</g, '><').split(/(?<=>)(?=<)/);\n for (const token of tokens) {\n const isClosing = /^<\\//.test(token);\n const isSelfClosing = /\\/>$/.test(token) || /^<!/.test(token) || /^<\\?/.test(token);\n if (isClosing) depth = Math.max(0, depth - 1);\n result += INDENT.repeat(depth) + token.trim() + '\\n';\n if (!isClosing && !isSelfClosing && /^<[^/!?]/.test(token)) depth++;\n }\n return result.trimEnd();\n}\n\nfunction formatYaml(yaml: string): string {\n return yaml\n .split('\\n')\n .map(line => line.trimEnd())\n .join('\\n')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim();\n}\n\nfunction formatSql(sql: string): string {\n const CLAUSE_RE = /\\b(SELECT|DISTINCT|FROM|WHERE|INNER JOIN|LEFT JOIN|RIGHT JOIN|FULL OUTER JOIN|FULL JOIN|CROSS JOIN|JOIN|ON|AND|OR|NOT|ORDER BY|GROUP BY|HAVING|LIMIT|OFFSET|UNION ALL|UNION|INTERSECT|EXCEPT|INSERT INTO|VALUES|UPDATE|SET|DELETE FROM|CREATE TABLE|DROP TABLE|ALTER TABLE|WITH)\\b/gi;\n return sql\n .replace(/\\s+/g, ' ')\n .replace(CLAUSE_RE, '\\n$1')\n .split('\\n')\n .map(line => line.trim())\n .filter(line => line.length > 0)\n .join('\\n');\n}\n\n// ─── Simple variant — no debug hooks at all ───────────────────────────────────\n\nfunction EditorViewSimple({\n value, onChange, language = 'json', height = '200px', minHeight,\n readOnly = false, placeholder, wordWrap = true, size, fontSize,\n className = '', bordered = false, onEditorMount, contextMenuMode = 'native', contextMenuItems, editorOptions, accentColor,\n}: EditorViewProps) {\n const base = useEditorBase(size);\n const resolvedFontSize = fontSize ?? base.fontSize;\n const theme = useAppTheme();\n const editorRef = useRef<any>(null);\n const disposablesRef = useRef<any[]>([]);\n const modelPath = useMemo(\n () => `inmemory://daakia/${crypto.randomUUID()}${EXT_MAP[language] || '.txt'}`,\n [language],\n );\n const resolvedHeight = typeof height === 'number' ? `${height}px` : height;\n const containerHeight = minHeight ? `max(${resolvedHeight}, ${minHeight}px)` : resolvedHeight;\n\n useEffect(() => {\n return () => {\n disposablesRef.current.forEach(d => d?.dispose?.());\n disposablesRef.current = [];\n const editor = editorRef.current;\n if (editor) { const m = editor.getModel(); if (m) m.dispose(); }\n };\n }, []);\n\n // Placeholder is otherwise only applied inside mountCommon, i.e. once at mount — so a\n // parent that swaps it later (e.g. changing Content Type from JSON to form-urlencoded)\n // kept showing the original example. Keep it in sync with the prop.\n useEffect(() => {\n editorRef.current?.updateOptions({ placeholder } as any);\n }, [placeholder]);\n\n // No manual model.setValue() sync here — the controlled `value` prop on\n // <Editor> below already keeps the model in sync on every change (that's\n // what \"controlled\" means for @monaco-editor/react, readOnly or not). A\n // redundant manual setValue() bypass used to live here; it fired in a\n // separate, later effect than the library's own internal sync, triggering\n // a second, out-of-band re-tokenization pass — which is what caused\n // readOnly editors (e.g. Daakia's response JSON viewer) to briefly render\n // monochrome and only pick up real syntax colors a moment later.\n\n const handleMount: OnMount = (editor, monacoInstance) => {\n editorRef.current = editor;\n disposablesRef.current = [];\n mountCommon(editor, monacoInstance, { language, value, placeholder, onEditorMount, contextMenuMode, autoClosing: autoCloses(editorOptions ?? {}) });\n };\n\n const resolvedTheme = theme === 'light' ? 'daakia-light' : 'daakia-dark';\n\n return (\n <EditorShell bordered={bordered} containerHeight={containerHeight} contextMenuMode={contextMenuMode} contextMenuItems={contextMenuItems}\n itemsAt={(x, y) => menuItemsAt(editorRef.current, x, y, !!readOnly)} accentColor={accentColor}>\n <Editor\n height=\"100%\"\n language={language}\n path={modelPath}\n value={value}\n theme={resolvedTheme}\n onChange={v => onChange?.(v ?? '')}\n onMount={handleMount}\n options={buildOptions({ readOnly, fontSize: resolvedFontSize, wordWrap, glyphMargin: false, contextMenuMode, editorOptions, theme: resolvedTheme })}\n />\n </EditorShell>\n );\n}\n\n// ─── Debug variant — subscribes to debug store + breakpoint hooks ─────────────\n\nfunction EditorViewDebug({\n value, onChange, language = 'json', height = '200px', minHeight,\n readOnly = false, placeholder, wordWrap = true, size, fontSize,\n className = '', bordered = false,\n breakpoints, disabledBreakpoints, conditionalBreakpointLines, pausedLine,\n onToggleBreakpoint, onGlyphContextMenu, onEditorMount, contextMenuMode = 'native', contextMenuItems, editorOptions, accentColor,\n}: EditorViewProps) {\n const base = useEditorBase(size);\n const resolvedFontSize = fontSize ?? base.fontSize;\n const theme = useAppTheme();\n const editorRef = useRef<any>(null);\n const disposablesRef = useRef<any[]>([]);\n const modelPath = useMemo(\n () => `inmemory://daakia/${crypto.randomUUID()}${EXT_MAP[language] || '.txt'}`,\n [language],\n );\n const resolvedHeight = typeof height === 'number' ? `${height}px` : height;\n const containerHeight = minHeight ? `max(${resolvedHeight}, ${minHeight}px)` : resolvedHeight;\n\n // Debug hooks — always called here (React rules), never called in Simple variant\n const { attach: attachBreakpointGutter } = useBreakpointGutter({\n breakpoints, disabledBreakpoints, conditionalBreakpointLines, pausedLine,\n onToggleBreakpoint, onGlyphContextMenu,\n });\n const { attach: attachDebugHover } = useDebugVariableHover();\n const navigateLine = useDebugStore(s => s.navigateLine);\n\n useEffect(() => {\n return () => {\n disposablesRef.current.forEach(d => d?.dispose?.());\n disposablesRef.current = [];\n const editor = editorRef.current;\n if (editor) { const m = editor.getModel(); if (m) m.dispose(); }\n };\n }, []);\n\n // Placeholder is otherwise only applied inside mountCommon, i.e. once at mount — so a\n // parent that swaps it later (e.g. changing Content Type from JSON to form-urlencoded)\n // kept showing the original example. Keep it in sync with the prop.\n useEffect(() => {\n editorRef.current?.updateOptions({ placeholder } as any);\n }, [placeholder]);\n\n // See EditorViewSimple above — no manual model.setValue() sync needed;\n // the controlled `value` prop on <Editor> below already handles it, and a\n // redundant bypass here caused the same delayed-tokenization symptom.\n\n useEffect(() => {\n if (!navigateLine || !editorRef.current || !breakpoints) return;\n editorRef.current.revealLineInCenter(navigateLine);\n editorRef.current.setPosition({ lineNumber: navigateLine, column: 1 });\n useDebugStore.getState().setNavigateLine(null);\n }, [navigateLine, breakpoints]);\n\n const handleMount: OnMount = (editor, monacoInstance) => {\n editorRef.current = editor;\n disposablesRef.current = [];\n // Attach debug features\n attachBreakpointGutter(editor, monacoInstance);\n attachDebugHover(editor, monacoInstance);\n mountCommon(editor, monacoInstance, { language, value, placeholder, onEditorMount, contextMenuMode, autoClosing: autoCloses(editorOptions ?? {}) });\n };\n\n const resolvedTheme = theme === 'light' ? 'daakia-light' : 'daakia-dark';\n\n return (\n <EditorShell bordered={bordered} containerHeight={containerHeight} contextMenuMode={contextMenuMode} contextMenuItems={contextMenuItems}\n itemsAt={(x, y) => menuItemsAt(editorRef.current, x, y, !!readOnly)} accentColor={accentColor}>\n <Editor\n height=\"100%\"\n language={language}\n path={modelPath}\n value={value}\n theme={resolvedTheme}\n onChange={v => onChange?.(v ?? '')}\n onMount={handleMount}\n options={buildOptions({ readOnly, fontSize: resolvedFontSize, wordWrap, glyphMargin: !!onToggleBreakpoint, contextMenuMode, editorOptions, theme: resolvedTheme })}\n />\n </EditorShell>\n );\n}\n\n// ─── Public export — registered into monaco-runtime by monaco-setup.ts ──────\n\nexport function EditorViewMonacoImpl({ debugSupported = false, className = '', ...rest }: EditorViewProps) {\n if (debugSupported) return <EditorViewDebug className={className} {...rest} />;\n return <EditorViewSimple className={className} {...rest} />;\n}\n\n// ─── Shared Monaco options builder ───────────────────────────────────────────\n\n/**\n * Should this editor close brackets, quotes and tags as you type?\n *\n * Yes, unless the caller passed `autoClosing: false` — or unless something\n * other than a person is typing, which the page says by setting\n * `window.__DUI_NO_AUTOCLOSE__ = true` before the app loads.\n *\n * The global exists because the answer has to hold across re-renders. These\n * options are construction options: every render hands Monaco the same object\n * again, so an `updateOptions({ autoClosingBrackets: 'never' })` from outside\n * survives only until the next keystroke re-renders the component and puts\n * 'always' back. A test driving the editor a character at a time would get a\n * few characters in and then start typing its closing braces onto the ones\n * Monaco had inserted — `{\"a\": 1}}`, a SOAP envelope with every tag doubled.\n *\n * Reading it here rather than at each of the dozens of call sites is the point:\n * one line makes every editor in every consuming app drivable.\n */\nfunction autoCloses(o: EditorOptions): boolean {\n if (o.autoClosing === false) return false;\n if (typeof window !== 'undefined' && (window as unknown as Record<string, unknown>).__DUI_NO_AUTOCLOSE__ === true) return false;\n return true;\n}\n\nfunction buildOptions({ readOnly, fontSize, wordWrap, glyphMargin, contextMenuMode = 'native', editorOptions, theme }: {\n readOnly: boolean;\n fontSize: number;\n wordWrap: boolean;\n glyphMargin: boolean;\n contextMenuMode?: EditorContextMenuMode;\n editorOptions?: EditorOptions;\n theme: string;\n}) {\n const o = editorOptions ?? {};\n const closes = autoCloses(o);\n return {\n // Baked into construction options (not just the top-level <Editor theme=\"\"> prop)\n // so Monaco applies it before its first paint — @monaco-editor/react creates the\n // editor first and only calls the global setTheme() afterward as a separate step,\n // which is what caused a flash of the default white 'vs' theme on every remount\n // (tab switch, subtab switch, new-tab-then-close) before this fix.\n theme,\n // ── Consumer-overridable defaults ────────────────────────────────────────\n lineNumbers: (o.lineNumbers ?? 'on') as 'on' | 'off' | 'relative' | 'interval',\n minimap: { enabled: o.minimap ?? false },\n scrollBeyondLastLine: o.scrollBeyondLastLine ?? false,\n smoothScrolling: o.smoothScrolling ?? false,\n mouseWheelZoom: o.mouseWheelZoom ?? false,\n folding: o.folding ?? true,\n showFoldingControls: (o.showFoldingControls ?? 'mouseover') as 'always' | 'never' | 'mouseover',\n tabSize: o.tabSize ?? 2,\n formatOnPaste: o.formatOnPaste ?? true,\n formatOnType: o.formatOnType ?? true,\n autoIndent: (o.autoIndent ?? 'full') as 'none' | 'keep' | 'brackets' | 'advanced' | 'full',\n renderWhitespace: (o.renderWhitespace ?? 'selection') as 'none' | 'boundary' | 'selection' | 'trailing' | 'all',\n matchBrackets: (o.matchBrackets ?? 'always') as 'never' | 'near' | 'always',\n bracketPairColorization: { enabled: o.bracketPairColorization ?? true },\n colorDecorators: o.colorDecorators ?? true,\n linkedEditing: o.linkedEditing ?? true,\n copyWithSyntaxHighlighting: o.copyWithSyntaxHighlighting ?? true,\n quickSuggestions: o.quickSuggestions ?? true,\n suggestOnTriggerCharacters: o.suggestOnTriggerCharacters ?? true,\n acceptSuggestionOnEnter: (o.acceptSuggestionOnEnter ?? 'on') as 'on' | 'off' | 'smart',\n hover: { enabled: o.hover ?? true },\n parameterHints: { enabled: o.parameterHints ?? true },\n codeLens: o.codeLens ?? false,\n inlayHints: { enabled: (o.inlayHints ?? false) ? 'on' as const : 'off' as const },\n padding: { top: o.padding?.top ?? 8, bottom: o.padding?.bottom ?? 8 },\n ...(o.cursorStyle && { cursorStyle: o.cursorStyle as any }),\n ...(o.cursorBlinking && { cursorBlinking: o.cursorBlinking as any }),\n ...(o.lineHeight && { lineHeight: o.lineHeight }),\n ...(o.letterSpacing && { letterSpacing: o.letterSpacing }),\n ...(o.rulers && { rulers: o.rulers }),\n ...(o.lineDecorationsWidth !== undefined && { lineDecorationsWidth: o.lineDecorationsWidth }),\n ...(o.lineNumbersMinChars !== undefined && { lineNumbersMinChars: o.lineNumbersMinChars }),\n // ── Prop-level overrides (top-level EditorView props win over editorOptions) ─\n readOnly,\n fontSize,\n wordWrap: (o.wordWrap ?? (wordWrap ? 'on' : 'off')) as 'off' | 'on' | 'wordWrapColumn' | 'bounded',\n // ── DUI structural — never overridable ──────────────────────────────────\n automaticLayout: true,\n glyphMargin,\n renderLineHighlight: (o.renderLineHighlight ?? (glyphMargin ? 'line' : 'none')) as 'none' | 'gutter' | 'line' | 'all',\n fixedOverflowWidgets: true,\n contextmenu: contextMenuMode === 'native',\n overviewRulerLanes: 0,\n hideCursorInOverviewRuler: true,\n overviewRulerBorder: false,\n scrollbar: {\n vertical: o.scrollbar?.vertical ?? 'auto',\n horizontal: o.scrollbar?.horizontal ?? 'auto',\n verticalScrollbarSize: o.scrollbar?.verticalScrollbarSize ?? 6,\n horizontalScrollbarSize: o.scrollbar?.horizontalScrollbarSize ?? 6,\n },\n fontFamily: o.fontFamily ?? 'Menlo, Monaco, \"Courier New\", monospace',\n /*\n Closing brackets, quotes and tags for you — on by default, and off when\n the caller says so.\n\n These were hard-coded to 'always' in two places, one of them an\n `updateOptions` that runs after mount, so a consumer setting them to\n 'never' on the instance had them set straight back. Anything driving this\n editor a character at a time then typed its own closing brace onto the\n one Monaco had already inserted: `{\"a\": 1}}`, and a SOAP envelope with\n every tag doubled.\n */\n autoClosingBrackets: (closes ? 'always' : 'never') as 'never' | 'always',\n autoClosingQuotes: (closes ? 'always' : 'never') as 'never' | 'always',\n autoClosingDelete: (closes ? 'always' : 'never') as 'never' | 'always',\n autoSurround: (closes ? 'languageDefined' : 'never') as 'never' | 'languageDefined',\n guides: { bracketPairs: true, indentation: true },\n suggest: {\n showKeywords: o.suggest?.showKeywords ?? true,\n showSnippets: o.suggest?.showSnippets ?? true,\n showValues: o.suggest?.showValues ?? true,\n showProperties: o.suggest?.showProperties ?? true,\n ...(o.suggest?.showIcons !== undefined && { showIcons: o.suggest.showIcons }),\n },\n };\n}\n\n// ─── Shared mount logic (everything that isn't debug-specific) ────────────────\n\n/*\n Copy the path to whatever was right-clicked.\n\n Reading a value out of a document and then writing the expression that\n selects it is a transcription job: you can see `id` on screen and still have\n to count array indices and retype four ancestor names to say where it lives.\n\n ── Why this is a menu item and not a Monaco action ──\n\n It was an `editor.addAction`, which registers cleanly and runs correctly, and\n never appeared in Monaco's context menu — not in `9_cutcopypaste`, which\n draws as an icon bar and has nowhere to put a label; not in a group of its\n own; not in `navigation`. The action was enabled and invocable the whole\n time, which is exactly what made it hard to see: nothing was broken except\n the one thing that mattered.\n\n DUI's own menu renders it, and gets something Monaco's could not offer\n anyway — a submenu, so every enclosing level is one click away rather than\n only the leaf you happened to hit.\n*/\nfunction pathItemsAt(editor: any, x: number, y: number): ContextMenuItem[] {\n const model = editor?.getModel?.();\n const position = editor?.getTargetAtClientPoint?.(x, y)?.position;\n if (!model || !position) return [];\n\n const language = model.getLanguageId();\n const text = model.getValue();\n const offset = model.getOffsetAt(position);\n\n const levels = language === 'json' ? jsonPathLevels(text, offset)\n : language === 'xml' ? xPathLevels(text, offset)\n : [];\n if (!levels.length) return [];\n\n /*\n Innermost first. The thing you clicked is the thing you asked about, so it\n is the first entry and every ancestor follows it outward — the reverse\n reads as a list you have to scan to the end of.\n */\n const inner = [...levels].reverse();\n return [{\n id: 'dui.copyPath',\n label: language === 'json' ? 'Copy JSON path' : 'Copy XPath',\n children: inner.map((path, i) => ({\n id: `dui.copyPath.${i}`,\n label: path,\n // The one you are most likely to want, named as such rather than left\n // to be inferred from its position.\n description: i === 0 ? 'what you clicked' : undefined,\n onClick: () => { void navigator.clipboard?.writeText(path); },\n })),\n }];\n}\n\n/*\n The editing basics, so choosing DUI's menu is not a downgrade.\n\n Monaco's own menu carries cut, copy, paste and select-all for free; a\n consumer that switches to the DUI menu to gain the path submenu would\n otherwise lose them, and a right-click that cannot copy is a worse menu than\n the one it replaced.\n*/\nfunction editItemsAt(editor: any, readOnly: boolean): ContextMenuItem[] {\n const model = editor?.getModel?.();\n if (!model) return [];\n const selection = editor.getSelection?.();\n const selected = selection && !selection.isEmpty() ? model.getValueInRange(selection) : '';\n\n const items: ContextMenuItem[] = [\n {\n id: 'dui.copy',\n label: 'Copy',\n shortcut: 'Ctrl+C',\n disabled: !selected,\n onClick: () => { if (selected) void navigator.clipboard?.writeText(selected); },\n },\n {\n id: 'dui.selectAll',\n label: 'Select all',\n shortcut: 'Ctrl+A',\n onClick: () => {\n editor.setSelection(model.getFullModelRange());\n editor.focus();\n },\n },\n ];\n\n if (!readOnly) {\n items.unshift({\n id: 'dui.cut',\n label: 'Cut',\n shortcut: 'Ctrl+X',\n disabled: !selected,\n onClick: () => {\n if (!selected) return;\n void navigator.clipboard?.writeText(selected);\n editor.executeEdits('dui.cut', [{ range: selection, text: '' }]);\n editor.focus();\n },\n });\n items.push({\n id: 'dui.paste',\n label: 'Paste',\n shortcut: 'Ctrl+V',\n onClick: async () => {\n const text = await navigator.clipboard?.readText?.();\n if (text == null) return;\n const range = editor.getSelection() ?? model.getFullModelRange();\n editor.executeEdits('dui.paste', [{ range, text }]);\n editor.focus();\n },\n });\n }\n return items;\n}\n\n/*\n Everything the DUI menu shows: what you clicked on, then the basics.\n\n `readOnly` comes from the component's own prop rather than from\n `editor.getOption(...)`, whose option ids are a numeric enum that shifts\n between Monaco releases — pinning one here would silently offer Paste on a\n response viewer the day the enum moved.\n*/\nfunction menuItemsAt(editor: any, x: number, y: number, readOnly: boolean): ContextMenuItem[] {\n const path = pathItemsAt(editor, x, y);\n const edit = editItemsAt(editor, readOnly);\n if (!path.length) return edit;\n return [...path, { id: 'dui.sep', label: '', separator: true }, ...edit];\n}\n\nfunction mountCommon(\n editor: any,\n monacoInstance: any,\n { language, value, placeholder, onEditorMount, contextMenuMode = 'native', autoClosing = true }: {\n language: EditorLanguage;\n value: string;\n placeholder?: string;\n onEditorMount?: (editor: any, monaco: any) => void;\n contextMenuMode?: EditorContextMenuMode;\n autoClosing?: boolean;\n },\n) {\n // Layout fixes for flex/overflow containers\n const relayout = () => editor.layout();\n relayout();\n requestAnimationFrame(relayout);\n setTimeout(relayout, 50);\n setTimeout(relayout, 200);\n const parent = editor.getContainerDomNode().parentElement;\n if (parent) {\n const ro = new ResizeObserver(relayout);\n ro.observe(parent);\n editor.onDidDispose(() => ro.disconnect());\n }\n\n editor.updateOptions({\n autoClosingBrackets: autoClosing ? 'always' : 'never',\n autoClosingQuotes: autoClosing ? 'always' : 'never',\n autoClosingDelete: autoClosing ? 'always' : 'never',\n autoSurround: autoClosing ? 'languageDefined' : 'never',\n autoIndent: 'full',\n });\n\n // Clipboard overrides — modern Clipboard API (webview-compatible)\n const KM = monacoInstance.KeyMod;\n const KC = monacoInstance.KeyCode;\n\n editor.addAction({\n id: 'daakia.clipboard.copy', label: 'Copy',\n keybindings: [KM.CtrlCmd | KC.KeyC],\n run: (ed: any) => {\n const sel = ed.getSelection();\n if (sel && !sel.isEmpty()) {\n navigator.clipboard.writeText(ed.getModel()?.getValueInRange(sel) || '');\n } else {\n const pos = ed.getPosition();\n if (pos) navigator.clipboard.writeText((ed.getModel()?.getLineContent(pos.lineNumber) || '') + '\\n');\n }\n },\n });\n\n editor.addAction({\n id: 'daakia.clipboard.cut', label: 'Cut',\n keybindings: [KM.CtrlCmd | KC.KeyX],\n run: (ed: any) => {\n const sel = ed.getSelection();\n if (sel && !sel.isEmpty()) {\n navigator.clipboard.writeText(ed.getModel()?.getValueInRange(sel) || '');\n ed.executeEdits('cut', [{ range: sel, text: '' }]);\n } else {\n const pos = ed.getPosition();\n if (pos) {\n const model = ed.getModel();\n if (model) {\n navigator.clipboard.writeText(model.getLineContent(pos.lineNumber) + '\\n');\n ed.executeEdits('cut', [{ range: new monacoInstance.Range(pos.lineNumber, 1, pos.lineNumber + 1, 1), text: '' }]);\n }\n }\n }\n },\n });\n\n /*\n Ctrl+V is deliberately NOT bound.\n\n It was, to an action calling `navigator.clipboard.readText()` — which needs\n the `clipboard-read` permission, and a webview denies it. The read threw,\n an empty catch swallowed it, and paste did nothing at all: no error, no\n text, no way to tell it apart from an empty clipboard. Binding the key also\n preempted the browser's own paste, so the one mechanism that does work was\n the one being replaced.\n\n A real Ctrl+V is a user gesture that carries the clipboard contents with\n it, so Monaco's built-in handling needs no permission and always works.\n Reading the clipboard out of band is the thing that needs privileges, and\n it is only worth attempting where there is no gesture to ride on — which\n is why the context menu still tries it, with a fallback.\n */\n\n editor.addAction({\n id: 'daakia.clipboard.selectAll', label: 'Select All',\n keybindings: [KM.CtrlCmd | KC.KeyA],\n run: (ed: any) => { const m = ed.getModel(); if (m) ed.setSelection(m.getFullModelRange()); },\n });\n\n // Format Document — Shift+Alt+F\n editor.addAction({\n id: 'daakia.format.document', label: 'Format Document',\n keybindings: [KM.Shift | KM.Alt | KC.KeyF],\n contextMenuGroupId: 'modification', contextMenuOrder: 1.5,\n run: async (ed: any) => {\n const model = ed.getModel();\n if (!model) return;\n const langId = model.getLanguageId();\n if (langId === 'xml' || langId === 'html') {\n try {\n const raw = model.getValue();\n const formatted = formatXml(raw);\n if (formatted !== raw) ed.executeEdits('daakia.format', [{ range: model.getFullModelRange(), text: formatted }]);\n } catch { /* malformed XML */ }\n } else if (langId === 'yaml') {\n try {\n const raw = model.getValue();\n const formatted = formatYaml(raw);\n if (formatted !== raw) ed.executeEdits('daakia.format', [{ range: model.getFullModelRange(), text: formatted }]);\n } catch { /* malformed YAML */ }\n } else if (langId === 'sql') {\n try {\n const raw = model.getValue();\n const formatted = formatSql(raw);\n if (formatted !== raw) ed.executeEdits('daakia.format', [{ range: model.getFullModelRange(), text: formatted }]);\n } catch { /* malformed SQL */ }\n } else {\n await ed.getAction('editor.action.formatDocument')?.run();\n }\n },\n });\n\n // Find & Replace — Ctrl+Shift+H\n editor.addAction({\n id: 'daakia.findAndReplace', label: 'Find and Replace',\n keybindings: [KM.CtrlCmd | KM.Shift | KC.KeyH],\n contextMenuGroupId: 'navigation', contextMenuOrder: 1.5,\n run: () => editor.getAction('editor.action.startFindReplaceAction')?.run(),\n });\n\n // Auto-closing config. XML/HTML is registered unconditionally rather than\n // only when the editor currently holds that language — a Content Type switch\n // (JSON → application/xml) swaps the model in place without re-running mount,\n // so a lazily-registered xml config would never arrive.\n configureTagLanguage(monacoInstance, 'xml');\n configureTagLanguage(monacoInstance, 'html');\n const model = editor.getModel();\n if (model) {\n const langId = model.getLanguageId();\n if (langId !== 'xml' && langId !== 'html' && !plainLangConfigured.has(langId)) {\n plainLangConfigured.add(langId);\n monacoInstance.languages.setLanguageConfiguration(langId, {\n autoClosingPairs: [\n { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' },\n { open: '\"', close: '\"', notIn: ['string'] },\n { open: \"'\", close: \"'\", notIn: ['string', 'comment'] },\n ],\n brackets: [['{', '}'], ['[', ']'], ['(', ')']],\n surroundingPairs: [\n { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' },\n { open: '\"', close: '\"' }, { open: \"'\", close: \"'\" },\n ],\n });\n }\n }\n installTagAutoClose(editor, monacoInstance);\n\n // GraphQL tokenizer + completion\n const langs = monacoInstance.languages.getLanguages();\n if (!langs.some((l: any) => l.id === 'graphql')) {\n monacoInstance.languages.register({ id: 'graphql' });\n monacoInstance.languages.setMonarchTokensProvider('graphql', {\n keywords: ['type', 'input', 'enum', 'union', 'interface', 'scalar', 'schema', 'query', 'mutation', 'subscription', 'fragment', 'on', 'extend', 'implements', 'directive', 'repeatable'],\n typeKeywords: ['String', 'Int', 'Float', 'Boolean', 'ID'],\n operators: ['!', '=', '|', '&', '...'],\n symbols: /[=!|&]+/,\n tokenizer: {\n root: [\n [/#.*$/, 'comment'], [/\"([^\"\\\\]|\\\\.)*\"/, 'string'], [/\"\"\"[\\s\\S]*?\"\"\"/, 'string'],\n [/\\b(type|input|enum|union|interface|scalar|schema|extend|implements|directive|repeatable)\\b/, 'keyword'],\n [/\\b(query|mutation|subscription|fragment|on)\\b/, 'keyword.control'],\n [/\\b(String|Int|Float|Boolean|ID)\\b/, 'type.identifier'],\n [/\\b[A-Z][a-zA-Z0-9_]*\\b/, 'type.identifier'],\n [/\\b[a-z_][a-zA-Z0-9_]*(?=\\s*[:(])/, 'variable'],\n [/\\b[a-z_][a-zA-Z0-9_]*\\b/, 'identifier'],\n [/[{}()\\[\\]]/, '@brackets'], [/[!:=|&]/, 'operator'],\n [/\\$[a-zA-Z_]\\w*/, 'variable'], [/@[a-zA-Z_]\\w*/, 'annotation'],\n ],\n },\n } as any);\n }\n if (language === 'graphql') initGraphQLCompletionProvider(monacoInstance);\n\n // dk + console intellisense — JavaScript editors only\n if (language === 'javascript') {\n if (!dkLibRegistered) {\n monacoInstance.languages.typescript.javascriptDefaults.addExtraLib(DK_TYPE_DEFS, 'dk-globals.d.ts');\n dkLibRegistered = true;\n }\n monacoInstance.languages.registerCompletionItemProvider('javascript', {\n triggerCharacters: ['.'],\n provideCompletionItems: (mdl: any, pos: any) => {\n const textUntilPosition = mdl.getValueInRange({\n startLineNumber: pos.lineNumber, startColumn: 1,\n endLineNumber: pos.lineNumber, endColumn: pos.column,\n });\n const suggestions = getDkCompletions(textUntilPosition, monacoInstance, pos);\n if (suggestions.length > 0) return { suggestions };\n const range = { startLineNumber: pos.lineNumber, endLineNumber: pos.lineNumber, startColumn: pos.column, endColumn: pos.column };\n if (/\\bconsole\\.\\s*$/.test(textUntilPosition)) {\n return {\n suggestions: [\n { label: 'log', kind: monacoInstance.languages.CompletionItemKind.Function, insertText: 'log(${1})', insertTextRules: monacoInstance.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: 'Log output', range },\n { label: 'info', kind: monacoInstance.languages.CompletionItemKind.Function, insertText: 'info(${1})', insertTextRules: monacoInstance.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: 'Info output', range },\n { label: 'warn', kind: monacoInstance.languages.CompletionItemKind.Function, insertText: 'warn(${1})', insertTextRules: monacoInstance.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: 'Warning output', range },\n { label: 'error', kind: monacoInstance.languages.CompletionItemKind.Function, insertText: 'error(${1})', insertTextRules: monacoInstance.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: 'Error output', range },\n { label: 'debug', kind: monacoInstance.languages.CompletionItemKind.Function, insertText: 'debug(${1})', insertTextRules: monacoInstance.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: 'Debug output', range },\n ],\n };\n }\n return { suggestions: [] };\n },\n });\n }\n\n if (!value && placeholder) editor.updateOptions({ placeholder });\n onEditorMount?.(editor, monacoInstance);\n editor.updateOptions({ contextmenu: contextMenuMode === 'native' });\n}\n","import { DiffEditor, type DiffOnMount } from '@monaco-editor/react';\nimport { useAppTheme } from '../../../hooks/useAppTheme';\nimport type { DiffEditorViewProps } from './DiffEditorView';\n\n// This file is only ever reached by '@salilvnair/dui/monaco-setup' — see\n// EditorView.monaco.tsx for why that makes a plain top-level import safe.\n\nexport function DiffEditorViewMonacoImpl({\n original,\n modified,\n language = 'sql',\n height = 300,\n readOnly = true,\n renderSideBySide = true,\n wordWrap = false,\n fontSize = 12,\n theme,\n onMount,\n}: DiffEditorViewProps) {\n const appTheme = useAppTheme();\n const resolvedTheme = theme ?? (appTheme === 'light' ? 'vs' : 'vs-dark');\n const h = typeof height === 'number' ? `${height}px` : height;\n\n return (\n <DiffEditor\n height={h}\n language={language}\n theme={resolvedTheme}\n original={original}\n modified={modified}\n onMount={onMount as DiffOnMount | undefined}\n options={{\n readOnly,\n renderSideBySide,\n // Monaco silently drops to inline/unified rendering below its own\n // width threshold regardless of renderSideBySide — this diff editor\n // is often mounted inside narrow panels (e.g. Merkle's expanded\n // table row), so pin side-by-side explicitly instead of letting it\n // auto-collapse.\n useInlineViewWhenSpaceIsLimited: false,\n wordWrap: wordWrap ? 'on' : 'off',\n fontSize,\n automaticLayout: true,\n minimap: { enabled: false },\n scrollBeyondLastLine: false,\n lineNumbers: 'on',\n folding: true,\n ignoreTrimWhitespace: false,\n }}\n />\n );\n}\n","/**\n * Self-host Monaco Editor — no CDN required.\n * This configures workers inline so the webview CSP doesn't need external access.\n * Also defines a custom \"vscode-dark+\" theme to match real VS Code colors.\n */\nimport { loader } from '@monaco-editor/react';\nimport * as monaco from 'monaco-editor';\nimport { markMonacoReady, registerMonacoEditorImpl, registerMonacoDiffEditorImpl } from './lib/monaco-runtime';\nimport { EditorViewMonacoImpl } from './lib/components/input/EditorView.monaco';\nimport { DiffEditorViewMonacoImpl } from './lib/components/input/DiffEditorView.monaco';\nimport editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker&inline';\nimport jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker&inline';\nimport htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker&inline';\nimport tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker&inline';\nimport {\n javascriptDefaults,\n typescriptDefaults,\n ScriptTarget,\n ModuleKind,\n ModuleResolutionKind,\n JsxEmit,\n} from 'monaco-editor/esm/vs/language/typescript/monaco.contribution';\n\n(window as any).MonacoEnvironment = {\n getWorker(_: string, label: string) {\n if (label === 'json') return new jsonWorker();\n if (label === 'html' || label === 'handlebars' || label === 'razor') return new htmlWorker();\n if (label === 'typescript' || label === 'javascript') return new tsWorker();\n return new editorWorker();\n },\n};\n\n// Define VS Code \"Dark+\" matching theme\nmonaco.editor.defineTheme('daakia-dark', {\n base: 'vs-dark',\n inherit: true,\n rules: [\n // JSON\n { token: 'string.key.json', foreground: '9CDCFE' },\n { token: 'string.value.json', foreground: 'CE9178' },\n { token: 'number', foreground: 'B5CEA8' },\n { token: 'keyword.json', foreground: '569CD6' }, // true/false/null\n // General\n { token: 'string', foreground: 'CE9178' },\n { token: 'keyword', foreground: '569CD6' },\n { token: 'comment', foreground: '6A9955' },\n { token: 'type', foreground: '4EC9B0' },\n { token: 'identifier', foreground: '9CDCFE' },\n { token: 'variable', foreground: '9CDCFE' },\n { token: 'constant', foreground: '4FC1FF' },\n // JS/TS\n { token: 'keyword.js', foreground: 'C586C0' },\n { token: 'keyword.ts', foreground: 'C586C0' },\n { token: 'string.js', foreground: 'CE9178' },\n { token: 'string.ts', foreground: 'CE9178' },\n { token: 'number.js', foreground: 'B5CEA8' },\n { token: 'number.ts', foreground: 'B5CEA8' },\n { token: 'regexp', foreground: 'D16969' },\n { token: 'delimiter', foreground: 'D4D4D4' },\n { token: 'delimiter.bracket', foreground: 'FFD700' },\n // XML/HTML\n { token: 'tag', foreground: '569CD6' },\n { token: 'attribute.name', foreground: '9CDCFE' },\n { token: 'attribute.value', foreground: 'CE9178' },\n // GraphQL\n { token: 'keyword.graphql', foreground: 'C586C0' },\n { token: 'keyword.control.graphql', foreground: 'C586C0' },\n { token: 'type.identifier.graphql', foreground: 'E5C07B' },\n { token: 'variable.graphql', foreground: '9CDCFE' },\n { token: 'string.graphql', foreground: 'CE9178' },\n { token: 'comment.graphql', foreground: '6A9955' },\n { token: 'annotation.graphql', foreground: 'DCDCAA' },\n { token: 'operator.graphql', foreground: 'D4D4D4' },\n { token: 'identifier.graphql', foreground: 'D4D4D4' },\n ],\n colors: {\n 'editor.background': '#1e1e1e',\n 'editor.foreground': '#D4D4D4',\n 'editor.lineHighlightBackground': '#2a2a2a',\n 'editor.selectionBackground': '#264f78',\n 'editor.inactiveSelectionBackground': '#3a3d41',\n 'editorLineNumber.foreground': '#858585',\n 'editorLineNumber.activeForeground': '#C6C6C6',\n 'editorCursor.foreground': '#AEAFAD',\n 'editor.selectionHighlightBackground': '#ADD6FF26',\n 'editorIndentGuide.background': '#404040',\n 'editorIndentGuide.activeBackground': '#707070',\n 'editorBracketMatch.background': '#0064001a',\n 'editorBracketMatch.border': '#888888',\n 'editorGutter.background': '#1e1e1e',\n 'editorWidget.background': '#252526',\n 'editorSuggestWidget.background': '#252526',\n 'editorSuggestWidget.border': '#454545',\n 'editorSuggestWidget.selectedBackground': '#04395e',\n 'list.hoverBackground': '#2a2d2e',\n 'input.background': '#3c3c3c',\n 'focusBorder': '#6366f1',\n },\n});\n\n// Configure TypeScript/JavaScript language service for full IntelliSense\n// allowNonTsExtensions is critical — without it, in-memory models (no .js/.ts extension)\n// won't get definition/reference/rename support from the TypeScript worker.\njavascriptDefaults.setCompilerOptions({\n target: ScriptTarget.ESNext,\n module: ModuleKind.ESNext,\n allowNonTsExtensions: true,\n allowJs: true,\n checkJs: true,\n strict: false,\n noEmit: true,\n esModuleInterop: true,\n moduleResolution: ModuleResolutionKind.NodeJs,\n jsx: JsxEmit.React,\n});\n\njavascriptDefaults.setDiagnosticsOptions({\n noSemanticValidation: false,\n noSyntaxValidation: false,\n});\n\n// Ensure all models are immediately synced to the TypeScript worker\n// (required for Go to Definition, Peek, etc. to work)\njavascriptDefaults.setEagerModelSync(true);\ntypescriptDefaults.setEagerModelSync(true);\n\ntypescriptDefaults.setCompilerOptions({\n target: ScriptTarget.ESNext,\n module: ModuleKind.ESNext,\n allowNonTsExtensions: true,\n allowJs: true,\n strict: false,\n noEmit: true,\n esModuleInterop: true,\n moduleResolution: ModuleResolutionKind.NodeJs,\n jsx: JsxEmit.React,\n});\n\n// Define VS Code \"Light+\" matching theme\nmonaco.editor.defineTheme('daakia-light', {\n base: 'vs',\n inherit: true,\n rules: [\n { token: 'string.key.json', foreground: '0451a5' },\n { token: 'string.value.json', foreground: 'a31515' },\n { token: 'number', foreground: '09885a' },\n { token: 'keyword.json', foreground: '0000ff' },\n { token: 'string', foreground: 'a31515' },\n { token: 'keyword', foreground: '0000ff' },\n { token: 'comment', foreground: '008000' },\n { token: 'type', foreground: '267f99' },\n { token: 'identifier', foreground: '001080' },\n { token: 'variable', foreground: '001080' },\n { token: 'constant', foreground: '0070c1' },\n { token: 'keyword.js', foreground: 'af00db' },\n { token: 'keyword.ts', foreground: 'af00db' },\n { token: 'string.js', foreground: 'a31515' },\n { token: 'string.ts', foreground: 'a31515' },\n { token: 'number.js', foreground: '09885a' },\n { token: 'number.ts', foreground: '09885a' },\n { token: 'regexp', foreground: 'c41a16' },\n { token: 'delimiter', foreground: '000000' },\n { token: 'delimiter.bracket', foreground: '000000' },\n { token: 'tag', foreground: '800000' },\n { token: 'attribute.name', foreground: 'ff0000' },\n { token: 'attribute.value', foreground: '0451a5' },\n { token: 'keyword.graphql', foreground: 'af00db' },\n { token: 'type.identifier.graphql', foreground: '267f99' },\n { token: 'variable.graphql', foreground: '001080' },\n { token: 'string.graphql', foreground: 'a31515' },\n { token: 'comment.graphql', foreground: '008000' },\n { token: 'operator.graphql', foreground: '000000' },\n { token: 'identifier.graphql', foreground: '000000' },\n ],\n colors: {\n 'editor.background': '#ffffff',\n 'editor.foreground': '#000000',\n 'editor.lineHighlightBackground': '#f5f5f5',\n 'editor.selectionBackground': '#add6ff',\n 'editor.inactiveSelectionBackground': '#e5ebf1',\n 'editorLineNumber.foreground': '#237893',\n 'editorLineNumber.activeForeground': '#0b216f',\n 'editorCursor.foreground': '#000000',\n 'editor.selectionHighlightBackground': '#add6ff4d',\n 'editorIndentGuide.background1': '#d3d3d3',\n 'editorIndentGuide.activeBackground1': '#939393',\n 'editorGutter.background': '#ffffff',\n 'editorWidget.background': '#f3f3f3',\n 'editorSuggestWidget.background': '#f3f3f3',\n 'editorSuggestWidget.border': '#c8c8c8',\n 'editorSuggestWidget.selectedBackground': '#0060c0',\n 'list.hoverBackground': '#f0f0f0',\n 'input.background': '#ffffff',\n 'input.border': '#d1d5db',\n 'focusBorder': '#6366f1',\n },\n});\n\nloader.config({ monaco });\n\n// Expose monaco globally for context menu access to editor instances\n(window as any).monaco = monaco;\n\n// Register the real Monaco-backed implementations, then flip the shared\n// readiness gate — EditorView/DiffEditorView now render these instead of\n// their lightweight fallback.\nregisterMonacoEditorImpl(EditorViewMonacoImpl);\nregisterMonacoDiffEditorImpl(DiffEditorViewMonacoImpl);\nmarkMonacoReady();\n\n/** Call this whenever the app theme changes to re-theme all open Monaco editors */\nexport function applyMonacoTheme(theme: 'dark' | 'light') {\n monaco.editor.setTheme(theme === 'dark' ? 'daakia-dark' : 'daakia-light');\n}\n\nexport { monaco };\n"],"names":["resolveTheme","vsKind","_a","useAppTheme","theme","setTheme","useState","useEffect","update","htmlObs","bodyObs","DK_TYPE_DEFS","getDkCompletions","_text","_monaco","_pos","useBreakpointGutter","options","breakpoints","disabledBreakpoints","conditionalBreakpointLines","pausedLine","onToggleBreakpoint","onGlyphContextMenu","editorRef","useRef","monacoRef","decorationsRef","pausedDecoRef","hoverDecoRef","disposablesRef","isBreakpointableLine","useCallback","lineNo","editor","model","monaco","decos","line","isDisabled","isConditional","glyphClass","d","domNode","marginContainer","d1","e","glyphRightClick","d2a","domHandler","ev","d3","lineDecos","_b","_d","_c","d4","state","useDebugStore","selector","dkLibRegistered","tagLangConfigured","plainLangConfigured","VOID_TAGS","OPEN_TAG_AT_CARET","ANY_TAG","escapeRe","s","innermostOpenTag","text","scrubbed","stack","m","full","name","attrs","at","configureTagLanguage","monacoInstance","langId","config","live","delay","next","installTagAutoClose","reentrant","sub","change","column","before","insert","caretShift","consumeNext","open","rest","tag","EXT_MAP","formatXml","xml","depth","result","tokens","token","isClosing","isSelfClosing","formatYaml","yaml","formatSql","sql","CLAUSE_RE","EditorViewSimple","value","onChange","language","height","minHeight","readOnly","placeholder","wordWrap","size","fontSize","className","bordered","onEditorMount","contextMenuMode","contextMenuItems","editorOptions","accentColor","base","useEditorBase","resolvedFontSize","modelPath","useMemo","resolvedHeight","containerHeight","handleMount","mountCommon","autoCloses","resolvedTheme","jsx","EditorShell","x","y","menuItemsAt","Editor","v","buildOptions","EditorViewDebug","attachBreakpointGutter","navigateLine","EditorViewMonacoImpl","debugSupported","o","glyphMargin","closes","_e","_f","_g","_h","_i","_j","_k","pathItemsAt","position","offset","levels","jsonPathLevels","xPathLevels","inner","path","i","editItemsAt","selection","selected","items","range","edit","autoClosing","relayout","parent","ro","KM","KC","ed","sel","pos","raw","formatted","l","mdl","textUntilPosition","suggestions","DiffEditorViewMonacoImpl","original","modified","renderSideBySide","onMount","appTheme","h","DiffEditor","_","label","jsonWorker","htmlWorker","tsWorker","editorWorker","javascriptDefaults","ScriptTarget","ModuleKind","ModuleResolutionKind","JsxEmit","typescriptDefaults","loader","registerMonacoEditorImpl","registerMonacoDiffEditorImpl","markMonacoReady","applyMonacoTheme"],"mappings":";;;;;;;;;;AAUA,SAASA,IAAiC;;AACxC,QAAMC,MACJC,IAAA,SAAS,SAAT,gBAAAA,EAAe,aAAa,8BAC5B,SAAS,gBAAgB,aAAa,wBAAwB;AAChE,SAAID,IAAeA,MAAW,iBAAiB,UAAU,SACjD,SAAS,gBAAgB,aAAa,YAAY,KAA0B;AACtF;AAEO,SAASE,IAAgC;AAC9C,QAAM,CAACC,GAAOC,CAAQ,IAAIC,GAA2BN,CAAY;AAEjE,SAAAO,EAAU,MAAM;AACd,UAAMC,IAAS,MAAMH,EAASL,GAAc,GACtCS,IAAU,IAAI,iBAAiBD,CAAM;AAC3C,IAAAC,EAAQ,QAAQ,SAAS,iBAAiB,EAAE,YAAY,IAAM,iBAAiB,CAAC,cAAc,wBAAwB,EAAA,CAAG;AACzH,UAAMC,IAAU,IAAI,iBAAiBF,CAAM;AAC3C,WAAI,SAAS,QAAME,EAAQ,QAAQ,SAAS,MAAM,EAAE,YAAY,IAAM,iBAAiB,CAAC,wBAAwB,GAAG,GAC5G,MAAM;AAAE,MAAAD,EAAQ,WAAA,GAAcC,EAAQ,WAAA;AAAA,IAAc;AAAA,EAC7D,GAAG,CAAA,CAAE,GAEEN;AACT;AC9BO,MAAMO,KAAe;AACrB,SAASC,GAAiBC,GAAeC,GAAkBC,GAA0B;AAC1F,SAAO,CAAA;AACT;ACkBO,SAASC,GAAoBC,GAAkC;AACpE,QAAM;AAAA,IACJ,aAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,4BAAAC;AAAA,IACA,YAAAC;A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GAAiBpN,GAAyB;AACxD,EAAAgC,EAAO,OAAO,SAAShC,MAAU,SAAS,gBAAgB,cAAc;AAC1E;"}
|
|
1
|
+
{"version":3,"file":"monaco-setup.js","sources":["../src/hooks/useAppTheme.ts","../src/services/dk-repl.ts","../src/hooks/useBreakpointGutter.ts","../src/store/debug-store.ts","../src/lib/components/input/EditorView.monaco.tsx","../src/lib/components/input/DiffEditorView.monaco.tsx","../src/monaco-setup.core.ts","../src/monaco-setup.ts"],"sourcesContent":["/**\n * useAppTheme — returns 'dark' | 'light' and re-renders on change.\n *\n * Detects theme from (in priority order):\n * 1. VS Code webview: data-vscode-theme-kind on <body> (set by VS Code host)\n * 2. Generic: data-theme on <html> (daakia / other web apps)\n * 3. Fallback: 'dark'\n */\nimport { useState, useEffect } from 'react';\n\nfunction resolveTheme(): 'dark' | 'light' {\n const vsKind =\n document.body?.getAttribute('data-vscode-theme-kind') ||\n document.documentElement.getAttribute('data-vscode-theme-kind');\n if (vsKind) return vsKind === 'vscode-light' ? 'light' : 'dark';\n return (document.documentElement.getAttribute('data-theme') as 'dark' | 'light') || 'dark';\n}\n\nexport function useAppTheme(): 'dark' | 'light' {\n const [theme, setTheme] = useState<'dark' | 'light'>(resolveTheme);\n\n useEffect(() => {\n const update = () => setTheme(resolveTheme());\n const htmlObs = new MutationObserver(update);\n htmlObs.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme', 'data-vscode-theme-kind'] });\n const bodyObs = new MutationObserver(update);\n if (document.body) bodyObs.observe(document.body, { attributes: true, attributeFilter: ['data-vscode-theme-kind'] });\n return () => { htmlObs.disconnect(); bodyObs.disconnect(); };\n }, []);\n\n return theme;\n}\n","// Stub — dk-repl completions are daakia-specific and not used in standalone DUI.\nexport const DK_TYPE_DEFS = '';\nexport function getDkCompletions(_text: string, _monaco: unknown, _pos: unknown): unknown[] {\n return [];\n}\n","import { useRef, useEffect, useCallback, MutableRefObject } from 'react';\n\nexport interface BreakpointGutterOptions {\n breakpoints?: number[];\n disabledBreakpoints?: number[];\n conditionalBreakpointLines?: number[];\n /** Currently paused line (1-based) — shows yellow highlight */\n pausedLine?: number | null;\n onToggleBreakpoint?: (line: number) => void;\n onGlyphContextMenu?: (line: number, pos: { x: number; y: number }) => void;\n}\n\n/**\n * Encapsulates all breakpoint gutter logic for a Monaco editor:\n * - Line validation (only skips empty lines)\n * - Breakpoint dot decorations (red/disabled/conditional)\n * - Glyph margin click & context-menu handlers\n * - Hover hint (faded dot on valid, non-breakpointed lines)\n *\n * Returns `attach(editor, monaco)` to be called in onMount,\n * and handles cleanup/decoration updates via effects.\n */\nexport function useBreakpointGutter(options: BreakpointGutterOptions) {\n const {\n breakpoints,\n disabledBreakpoints,\n conditionalBreakpointLines,\n pausedLine,\n onToggleBreakpoint,\n onGlyphContextMenu,\n } = options;\n\n const editorRef = useRef<any>(null);\n const monacoRef = useRef<any>(null);\n const decorationsRef = useRef<string[]>([]);\n const pausedDecoRef = useRef<string[]>([]);\n const hoverDecoRef = useRef<string[]>([]);\n const disposablesRef = useRef<any[]>([]);\n\n const isBreakpointableLine = useCallback((lineNo: number): boolean => {\n const editor = editorRef.current;\n if (!editor) return true;\n const model = editor.getModel();\n if (!model || lineNo > model.getLineCount()) return false;\n const lineContent = model.getLineContent(lineNo).trim();\n return !!lineContent;\n }, []);\n\n // Sync breakpoint decorations when breakpoints change\n useEffect(() => {\n const editor = editorRef.current;\n const monaco = monacoRef.current;\n if (!editor || !monaco) return;\n\n const decos: any[] = [];\n\n if (breakpoints) {\n for (const line of breakpoints) {\n // Skip breakpoint glyph on the paused line — the arrow \"gulps\" it\n if (pausedLine && line === pausedLine) continue;\n\n const isDisabled = disabledBreakpoints?.includes(line);\n const isConditional = conditionalBreakpointLines?.includes(line);\n let glyphClass = 'daakia-bp-glyph';\n if (isDisabled) glyphClass = 'daakia-bp-glyph--disabled';\n else if (isConditional) glyphClass = 'daakia-bp-glyph--conditional';\n\n decos.push({\n range: new monaco.Range(line, 1, line, 1),\n options: {\n isWholeLine: true,\n className: isDisabled ? '' : 'daakia-bp-line',\n stickiness: monaco.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n glyphMarginClassName: glyphClass,\n glyphMarginHoverMessage: {\n value: isConditional ? 'Conditional Breakpoint' : isDisabled ? 'Disabled Breakpoint' : 'Breakpoint',\n },\n },\n });\n }\n }\n\n decorationsRef.current = editor.deltaDecorations(decorationsRef.current, decos);\n }, [breakpoints, disabledBreakpoints, conditionalBreakpointLines, pausedLine]);\n\n // Sync paused-line highlight (yellow background + arrow in glyph margin)\n useEffect(() => {\n const editor = editorRef.current;\n const monaco = monacoRef.current;\n if (!editor || !monaco) return;\n\n if (pausedLine) {\n // Use combined class when paused line is also a breakpoint line\n const isOnBreakpoint = breakpoints?.includes(pausedLine);\n const glyphClass = isOnBreakpoint\n ? 'daakia-paused-line__arrow daakia-paused-line__arrow--with-bp'\n : 'daakia-paused-line__arrow';\n\n pausedDecoRef.current = editor.deltaDecorations(pausedDecoRef.current, [{\n range: new monaco.Range(pausedLine, 1, pausedLine, 1),\n options: {\n isWholeLine: true,\n className: 'daakia-paused-line',\n glyphMarginClassName: glyphClass,\n stickiness: monaco.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n },\n }]);\n // Scroll to the paused line\n editor.revealLineInCenter(pausedLine);\n } else {\n pausedDecoRef.current = editor.deltaDecorations(pausedDecoRef.current, []);\n }\n }, [pausedLine, breakpoints]);\n\n // Cleanup disposables on unmount\n useEffect(() => {\n return () => {\n disposablesRef.current.forEach(d => d?.dispose?.());\n disposablesRef.current = [];\n };\n }, []);\n\n /**\n * Call this inside Monaco's onMount handler to attach all gutter interactions.\n * Returns the disposables (also tracked internally for auto-cleanup).\n */\n const attach = useCallback((editor: any, monaco: any) => {\n editorRef.current = editor;\n monacoRef.current = monaco;\n\n // Mark the entire margin container so RightClickMenu can detect gutter clicks\n const domNode = editor.getDomNode();\n if (domNode) {\n const marginContainer = domNode.querySelector('.margin');\n if (marginContainer) marginContainer.setAttribute('data-daakia-bp-gutter', '');\n }\n\n // Left-click to toggle breakpoint (right-click is handled separately for context menu)\n if (onToggleBreakpoint) {\n const d1 = editor.onMouseDown((e: any) => {\n if (e.event.leftButton && e.target.type === monaco.editor.MouseTargetType.GUTTER_GLYPH_MARGIN) {\n const line = e.target.position?.lineNumber;\n if (line && isBreakpointableLine(line)) onToggleBreakpoint(line);\n }\n });\n disposablesRef.current.push(d1);\n }\n\n // Right-click context menu — use DOM-level listener to intercept BEFORE Monaco shows its own menu\n if (onGlyphContextMenu) {\n let glyphRightClick: { line: number; x: number; y: number } | null = null;\n\n // Detect right-click on any gutter zone (glyph margin, line numbers, line decorations)\n const d2a = editor.onMouseDown((e: any) => {\n if (\n e.event.rightButton &&\n (e.target.type === monaco.editor.MouseTargetType.GUTTER_GLYPH_MARGIN ||\n e.target.type === monaco.editor.MouseTargetType.GUTTER_LINE_NUMBERS ||\n e.target.type === monaco.editor.MouseTargetType.GUTTER_LINE_DECORATIONS)\n ) {\n const line = e.target.position?.lineNumber;\n if (line && isBreakpointableLine(line)) {\n glyphRightClick = { line, x: e.event.posx, y: e.event.posy };\n }\n }\n });\n disposablesRef.current.push(d2a);\n\n // DOM-level contextmenu intercept — prevents Monaco's built-in menu on gutter area\n const domNode = editor.getDomNode();\n if (domNode) {\n const domHandler = (ev: MouseEvent) => {\n if (glyphRightClick) {\n ev.preventDefault();\n ev.stopPropagation();\n onGlyphContextMenu(glyphRightClick.line, { x: glyphRightClick.x, y: glyphRightClick.y });\n glyphRightClick = null;\n } else if ((ev.target as HTMLElement).closest('[data-daakia-bp-gutter]')) {\n // Fallback: block Monaco's default menu for any gutter right-click\n ev.preventDefault();\n ev.stopPropagation();\n }\n };\n domNode.addEventListener('contextmenu', domHandler, true); // capture phase\n disposablesRef.current.push({ dispose: () => domNode.removeEventListener('contextmenu', domHandler, true) });\n }\n }\n\n // Hover hint: faded dot on valid non-breakpointed lines\n if (onToggleBreakpoint) {\n const d3 = editor.onMouseMove((e: any) => {\n if (e.target.type === monaco.editor.MouseTargetType.GUTTER_GLYPH_MARGIN) {\n const line = e.target.position?.lineNumber;\n if (line && isBreakpointableLine(line)) {\n const model = editor.getModel();\n if (model) {\n const lineDecos = model.getLineDecorations(line);\n const hasBpDeco = lineDecos?.some((d: any) =>\n d.options?.glyphMarginClassName?.startsWith('daakia-bp-glyph') &&\n !d.options?.glyphMarginClassName?.includes('hover')\n );\n if (!hasBpDeco) {\n hoverDecoRef.current = editor.deltaDecorations(hoverDecoRef.current, [{\n range: new monaco.Range(line, 1, line, 1),\n options: {\n isWholeLine: false,\n stickiness: monaco.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n glyphMarginClassName: 'daakia-bp-glyph--hover',\n glyphMarginHoverMessage: { value: 'Left-click to add a breakpoint' },\n },\n }]);\n return;\n }\n }\n }\n }\n // Clear hover when not on glyph margin\n if (hoverDecoRef.current.length) {\n hoverDecoRef.current = editor.deltaDecorations(hoverDecoRef.current, []);\n }\n });\n disposablesRef.current.push(d3);\n\n const d4 = editor.onMouseLeave(() => {\n if (hoverDecoRef.current.length) {\n hoverDecoRef.current = editor.deltaDecorations(hoverDecoRef.current, []);\n }\n });\n disposablesRef.current.push(d4);\n }\n\n // Apply breakpoint decorations immediately after attach (fixes disappearing on remount)\n if (breakpoints) {\n const decos: any[] = [];\n for (const line of breakpoints) {\n const isDisabled = disabledBreakpoints?.includes(line);\n const isConditional = conditionalBreakpointLines?.includes(line);\n let glyphClass = 'daakia-bp-glyph';\n if (isDisabled) glyphClass = 'daakia-bp-glyph--disabled';\n else if (isConditional) glyphClass = 'daakia-bp-glyph--conditional';\n\n decos.push({\n range: new monaco.Range(line, 1, line, 1),\n options: {\n isWholeLine: true,\n className: isDisabled ? '' : 'daakia-bp-line',\n stickiness: monaco.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n glyphMarginClassName: glyphClass,\n glyphMarginHoverMessage: {\n value: isConditional ? 'Conditional Breakpoint' : isDisabled ? 'Disabled Breakpoint' : 'Breakpoint',\n },\n },\n });\n }\n decorationsRef.current = editor.deltaDecorations(decorationsRef.current, decos);\n }\n }, [onToggleBreakpoint, onGlyphContextMenu, isBreakpointableLine, breakpoints, disabledBreakpoints, conditionalBreakpointLines]);\n\n return { attach };\n}\n","// Stub — debug store is daakia-specific.\ninterface DebugState {\n navigateLine: number | null;\n setNavigateLine: (line: number | null) => void;\n active: boolean;\n status: 'idle' | 'running' | 'paused';\n variables: { name: string; value: unknown; type: string }[];\n}\n\nconst state: DebugState = {\n navigateLine: null,\n setNavigateLine: () => {},\n active: false,\n status: 'idle',\n variables: [],\n};\n\nexport function useDebugStore<T>(selector: (s: DebugState) => T): T {\n return selector(state);\n}\nuseDebugStore.getState = () => state;\n","import Editor, { type OnMount } from '@monaco-editor/react';\nimport { useRef, useMemo, useEffect } from 'react';\nimport { useAppTheme } from '../../../hooks/useAppTheme';\nimport { getDkCompletions, DK_TYPE_DEFS } from '../../../services/dk-repl';\nimport { initGraphQLCompletionProvider } from '../../../services/graphql-completion';\nimport { jsonPathLevels, xPathLevels } from './doc-path';\nimport { useEditorBase } from '../../core/EditorBase';\nimport { EditorShell } from './EditorView.shell';\nimport type { ContextMenuItem } from '../modal/ContextMenuView';\nimport type { EditorViewProps, EditorLanguage, EditorOptions, EditorContextMenuMode } from './EditorView';\n\n// ─── Debug-only imports — only loaded when debugSupported=true ─────────────────\nimport { useBreakpointGutter } from '../../../hooks/useBreakpointGutter';\nimport { useDebugVariableHover } from '../../../hooks/useDebugVariableHover';\nimport { useDebugStore } from '../../../store/debug-store';\n\n// This file is only ever reached by '@salilvnair/dui/monaco-setup' — a\n// separate, explicit opt-in subpath, never referenced (statically or via\n// lazy()) from the main package entry. That's what makes a plain top-level\n// import safe here: importing monaco-setup already requires Monaco installed.\n// See monaco-runtime.ts for why an in-place lazy()/dynamic-import approach\n// inside the always-loaded EditorView.tsx does not work.\n\nlet dkLibRegistered = false;\n\n// Monaco's language configuration and completion providers are GLOBAL per\n// language id, not per editor — registering them inside every mount stacked a\n// fresh provider on each remount (N editors open → the same suggestion N times).\nconst tagLangConfigured = new Set<string>();\nconst plainLangConfigured = new Set<string>();\n\n// HTML elements that never take a closing tag. XML has no such concept — every\n// element there is closed or self-closed — so this only applies to language 'html'.\nconst VOID_TAGS = new Set([\n 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input',\n 'link', 'meta', 'param', 'source', 'track', 'wbr',\n]);\n\n// An opening tag ending exactly at the caret. The attribute group tolerates\n// quoted '>' (e.g. <a title=\"a > b\">) by consuming whole quoted strings first.\nconst OPEN_TAG_AT_CARET = /<([_:a-zA-Z][-_:.\\w]*)((?:\"[^\"]*\"|'[^']*'|[^'\">])*)>$/;\nconst ANY_TAG = /<\\/?([_:a-zA-Z][-_:.\\w]*)((?:\"[^\"]*\"|'[^']*'|[^'\">])*)>/g;\n\nfunction escapeRe(s: string) { return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); }\n\n/** Innermost still-open tag in `text`, or null. Used to complete `</`. */\nfunction innermostOpenTag(text: string): string | null {\n const scrubbed = text.replace(/<!--[\\s\\S]*?-->/g, '').replace(/<!\\[CDATA\\[[\\s\\S]*?\\]\\]>/g, '');\n const stack: string[] = [];\n ANY_TAG.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = ANY_TAG.exec(scrubbed)) !== null) {\n const [full, name, attrs] = m;\n if (full.startsWith('</')) {\n const at = stack.lastIndexOf(name);\n if (at !== -1) stack.length = at; else stack.pop();\n } else if (!attrs.trimEnd().endsWith('/')) {\n stack.push(name);\n }\n }\n return stack.length ? stack[stack.length - 1] : null;\n}\n\nfunction configureTagLanguage(monacoInstance: any, langId: 'xml' | 'html') {\n if (tagLangConfigured.has(langId)) return;\n tagLangConfigured.add(langId);\n const config = {\n // Deliberately no { open: '<', close: '>' } here — matching VS Code's own\n // html/xml language configuration. Auto-inserting '>' would mean the user's\n // own '>' keystroke merely skips over it, producing no model change, and\n // tag auto-closing (which is what people actually expect) could never fire.\n autoClosingPairs: [\n { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' },\n { open: '\"', close: '\"', notIn: ['string'] },\n { open: \"'\", close: \"'\", notIn: ['string', 'comment'] },\n { open: '<!--', close: '-->', notIn: ['comment', 'string'] },\n ],\n brackets: [['{', '}'], ['[', ']'], ['(', ')'], ['<', '>']],\n surroundingPairs: [\n { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' },\n { open: '\"', close: '\"' }, { open: \"'\", close: \"'\" }, { open: '<', close: '>' },\n ],\n comments: { blockComment: ['<!--', '-->'] },\n onEnterRules: [\n {\n // Enter between <a>|</a> — open the pair onto three lines, caret indented.\n beforeText: /<([_:\\w][_:\\w\\-.\\d]*)([^/>]*(?!\\/)>)\\s*$/i,\n afterText: /^<\\/([_:\\w][_:\\w\\-.\\d]*)\\s*>$/i,\n action: { indentAction: monacoInstance.languages.IndentAction.IndentOutdent },\n },\n {\n beforeText: /<([_:\\w][_:\\w\\-.\\d]*)([^/>]*(?!\\/)>)\\s*$/i,\n action: { indentAction: monacoInstance.languages.IndentAction.Indent },\n },\n ],\n wordPattern: /(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)/g,\n };\n\n // Monaco registers its own xml/html language configuration from a LAZILY\n // IMPORTED module, and among equal-priority registrations the last one wins.\n // A plain synchronous call here therefore loses the race and their config —\n // which auto-closes '<' with '>' — stays in force, so typing '<' produced\n // '<>' and a completed '</tag' left a stray '>' behind. Re-apply on a short\n // bounded schedule (disposing the previous registration so only one of ours\n // is ever live) to land after their import resolves, whenever that is.\n let live = monacoInstance.languages.setLanguageConfiguration(langId, config);\n for (const delay of [50, 250, 1000]) {\n setTimeout(() => {\n const next = monacoInstance.languages.setLanguageConfiguration(langId, config);\n live?.dispose?.();\n live = next;\n }, delay);\n }\n}\n\n/**\n * VS Code-style tag auto-closing for XML/HTML.\n *\n * Monaco's basic-languages XML support has no tag awareness at all — that lives\n * in VS Code's HTML language service, which isn't bundled here. So we do it\n * ourselves: typing '>' completes the element, and typing '/' after '<' fills\n * in the innermost open tag. Both are plain model edits, so undo/redo and the\n * {{var}} decorations keep working normally.\n *\n * This relies on '<' NOT being an auto-closing pair (see configureTagLanguage):\n * if Monaco auto-inserted '>', typing '>' would only skip over the existing one\n * and produce no content change for us to react to.\n */\nfunction installTagAutoClose(editor: any, monacoInstance: any) {\n let reentrant = false;\n const sub = editor.onDidChangeModelContent((e: any) => {\n if (reentrant || e.isUndoing || e.isRedoing) return;\n const model = editor.getModel();\n if (!model) return;\n const langId = model.getLanguageId();\n if (langId !== 'xml' && langId !== 'html') return;\n /*\n Somebody who has turned bracket auto-closing off has said what they want.\n Completing their tags for them is the same favour they just declined, and\n doing it anyway is how `</Currency>` came out as `</Currency>Currency>`\n for anything driving this editor a character at a time.\n */\n if (editor.getOption?.(monacoInstance.editor.EditorOption.autoClosingBrackets) === 'never') return;\n // Only react to a single typed character — never to paste, multi-cursor or\n // a programmatic setValue, where guessing the user's intent is wrong.\n if (e.changes.length !== 1) return;\n const change = e.changes[0];\n if (change.text !== '>' && change.text !== '/') return;\n\n const line = change.range.startLineNumber;\n const column = change.range.startColumn + change.text.length;\n const before = model.getValueInRange({\n startLineNumber: 1, startColumn: 1, endLineNumber: line, endColumn: column,\n });\n\n let insert: string;\n let caretShift: number;\n let consumeNext = 0; // characters after the caret this edit should replace\n\n if (change.text === '>') {\n const open = OPEN_TAG_AT_CARET.exec(before);\n if (!open) return;\n if (open[2].trimEnd().endsWith('/')) return; // <br/> — already self-closed\n if (langId === 'html' && VOID_TAGS.has(open[1].toLowerCase())) return;\n const rest = model.getValueInRange({\n startLineNumber: line, startColumn: column,\n endLineNumber: line, endColumn: model.getLineMaxColumn(line),\n });\n if (new RegExp(`^\\\\s*</${escapeRe(open[1])}\\\\s*>`).test(rest)) return; // closing tag already sits here\n insert = `</${open[1]}>`;\n caretShift = 0; // caret stays between the tags\n } else {\n if (!/<\\/$/.test(before)) return;\n const tag = innermostOpenTag(before.slice(0, -2));\n if (!tag) return;\n insert = `${tag}>`;\n caretShift = insert.length; // caret lands after the completed tag\n // Swallow a '>' sitting right at the caret. It can only be one Monaco\n // auto-inserted when '<' was typed — '</>' is not valid markup — and\n // leaving it behind produced '</tag>>'. Defensive: the language config\n // above normally prevents that pair from existing at all.\n if (model.getLineContent(line).charAt(column - 1) === '>') consumeNext = 1;\n }\n\n reentrant = true;\n try {\n editor.executeEdits(\n 'daakia.autoCloseTag',\n [{ range: new monacoInstance.Range(line, column, line, column + consumeNext), text: insert, forceMoveMarkers: false }],\n [new monacoInstance.Selection(line, column + caretShift, line, column + caretShift)],\n );\n } finally {\n reentrant = false;\n }\n });\n editor.onDidDispose(() => sub.dispose());\n}\n\nconst EXT_MAP: Partial<Record<EditorLanguage, string>> = {\n javascript: '.js', typescript: '.ts', json: '.json', xml: '.xml',\n html: '.html', css: '.css', graphql: '.graphql', python: '.py',\n yaml: '.yaml', sql: '.sql', markdown: '.md', plaintext: '.txt', proto: '.proto',\n};\n\nfunction formatXml(xml: string): string {\n const INDENT = ' ';\n let depth = 0;\n let result = '';\n const tokens = xml.replace(/>\\s*</g, '><').split(/(?<=>)(?=<)/);\n for (const token of tokens) {\n const isClosing = /^<\\//.test(token);\n const isSelfClosing = /\\/>$/.test(token) || /^<!/.test(token) || /^<\\?/.test(token);\n if (isClosing) depth = Math.max(0, depth - 1);\n result += INDENT.repeat(depth) + token.trim() + '\\n';\n if (!isClosing && !isSelfClosing && /^<[^/!?]/.test(token)) depth++;\n }\n return result.trimEnd();\n}\n\nfunction formatYaml(yaml: string): string {\n return yaml\n .split('\\n')\n .map(line => line.trimEnd())\n .join('\\n')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim();\n}\n\nfunction formatSql(sql: string): string {\n const CLAUSE_RE = /\\b(SELECT|DISTINCT|FROM|WHERE|INNER JOIN|LEFT JOIN|RIGHT JOIN|FULL OUTER JOIN|FULL JOIN|CROSS JOIN|JOIN|ON|AND|OR|NOT|ORDER BY|GROUP BY|HAVING|LIMIT|OFFSET|UNION ALL|UNION|INTERSECT|EXCEPT|INSERT INTO|VALUES|UPDATE|SET|DELETE FROM|CREATE TABLE|DROP TABLE|ALTER TABLE|WITH)\\b/gi;\n return sql\n .replace(/\\s+/g, ' ')\n .replace(CLAUSE_RE, '\\n$1')\n .split('\\n')\n .map(line => line.trim())\n .filter(line => line.length > 0)\n .join('\\n');\n}\n\n// ─── Simple variant — no debug hooks at all ───────────────────────────────────\n\nfunction EditorViewSimple({\n value, onChange, language = 'json', height = '200px', minHeight,\n readOnly = false, placeholder, wordWrap = true, size, fontSize,\n className = '', bordered = false, onEditorMount, contextMenuMode = 'native', contextMenuItems, editorOptions, accentColor,\n}: EditorViewProps) {\n const base = useEditorBase(size);\n const resolvedFontSize = fontSize ?? base.fontSize;\n const theme = useAppTheme();\n const editorRef = useRef<any>(null);\n const disposablesRef = useRef<any[]>([]);\n const modelPath = useMemo(\n () => `inmemory://daakia/${crypto.randomUUID()}${EXT_MAP[language] || '.txt'}`,\n [language],\n );\n const resolvedHeight = typeof height === 'number' ? `${height}px` : height;\n const containerHeight = minHeight ? `max(${resolvedHeight}, ${minHeight}px)` : resolvedHeight;\n\n useEffect(() => {\n return () => {\n disposablesRef.current.forEach(d => d?.dispose?.());\n disposablesRef.current = [];\n const editor = editorRef.current;\n if (editor) { const m = editor.getModel(); if (m) m.dispose(); }\n };\n }, []);\n\n // Placeholder is otherwise only applied inside mountCommon, i.e. once at mount — so a\n // parent that swaps it later (e.g. changing Content Type from JSON to form-urlencoded)\n // kept showing the original example. Keep it in sync with the prop.\n useEffect(() => {\n editorRef.current?.updateOptions({ placeholder } as any);\n }, [placeholder]);\n\n // No manual model.setValue() sync here — the controlled `value` prop on\n // <Editor> below already keeps the model in sync on every change (that's\n // what \"controlled\" means for @monaco-editor/react, readOnly or not). A\n // redundant manual setValue() bypass used to live here; it fired in a\n // separate, later effect than the library's own internal sync, triggering\n // a second, out-of-band re-tokenization pass — which is what caused\n // readOnly editors (e.g. Daakia's response JSON viewer) to briefly render\n // monochrome and only pick up real syntax colors a moment later.\n\n const handleMount: OnMount = (editor, monacoInstance) => {\n editorRef.current = editor;\n disposablesRef.current = [];\n mountCommon(editor, monacoInstance, { language, value, placeholder, onEditorMount, contextMenuMode, autoClosing: autoCloses(editorOptions ?? {}) });\n };\n\n const resolvedTheme = theme === 'light' ? 'daakia-light' : 'daakia-dark';\n\n return (\n <EditorShell bordered={bordered} containerHeight={containerHeight} contextMenuMode={contextMenuMode} contextMenuItems={contextMenuItems}\n itemsAt={(x, y) => menuItemsAt(editorRef.current, x, y, !!readOnly)} accentColor={accentColor}>\n <Editor\n height=\"100%\"\n language={language}\n path={modelPath}\n value={value}\n theme={resolvedTheme}\n onChange={v => onChange?.(v ?? '')}\n onMount={handleMount}\n options={buildOptions({ readOnly, fontSize: resolvedFontSize, wordWrap, glyphMargin: false, contextMenuMode, editorOptions, theme: resolvedTheme })}\n />\n </EditorShell>\n );\n}\n\n// ─── Debug variant — subscribes to debug store + breakpoint hooks ─────────────\n\nfunction EditorViewDebug({\n value, onChange, language = 'json', height = '200px', minHeight,\n readOnly = false, placeholder, wordWrap = true, size, fontSize,\n className = '', bordered = false,\n breakpoints, disabledBreakpoints, conditionalBreakpointLines, pausedLine,\n onToggleBreakpoint, onGlyphContextMenu, onEditorMount, contextMenuMode = 'native', contextMenuItems, editorOptions, accentColor,\n}: EditorViewProps) {\n const base = useEditorBase(size);\n const resolvedFontSize = fontSize ?? base.fontSize;\n const theme = useAppTheme();\n const editorRef = useRef<any>(null);\n const disposablesRef = useRef<any[]>([]);\n const modelPath = useMemo(\n () => `inmemory://daakia/${crypto.randomUUID()}${EXT_MAP[language] || '.txt'}`,\n [language],\n );\n const resolvedHeight = typeof height === 'number' ? `${height}px` : height;\n const containerHeight = minHeight ? `max(${resolvedHeight}, ${minHeight}px)` : resolvedHeight;\n\n // Debug hooks — always called here (React rules), never called in Simple variant\n const { attach: attachBreakpointGutter } = useBreakpointGutter({\n breakpoints, disabledBreakpoints, conditionalBreakpointLines, pausedLine,\n onToggleBreakpoint, onGlyphContextMenu,\n });\n const { attach: attachDebugHover } = useDebugVariableHover();\n const navigateLine = useDebugStore(s => s.navigateLine);\n\n useEffect(() => {\n return () => {\n disposablesRef.current.forEach(d => d?.dispose?.());\n disposablesRef.current = [];\n const editor = editorRef.current;\n if (editor) { const m = editor.getModel(); if (m) m.dispose(); }\n };\n }, []);\n\n // Placeholder is otherwise only applied inside mountCommon, i.e. once at mount — so a\n // parent that swaps it later (e.g. changing Content Type from JSON to form-urlencoded)\n // kept showing the original example. Keep it in sync with the prop.\n useEffect(() => {\n editorRef.current?.updateOptions({ placeholder } as any);\n }, [placeholder]);\n\n // See EditorViewSimple above — no manual model.setValue() sync needed;\n // the controlled `value` prop on <Editor> below already handles it, and a\n // redundant bypass here caused the same delayed-tokenization symptom.\n\n useEffect(() => {\n if (!navigateLine || !editorRef.current || !breakpoints) return;\n editorRef.current.revealLineInCenter(navigateLine);\n editorRef.current.setPosition({ lineNumber: navigateLine, column: 1 });\n useDebugStore.getState().setNavigateLine(null);\n }, [navigateLine, breakpoints]);\n\n const handleMount: OnMount = (editor, monacoInstance) => {\n editorRef.current = editor;\n disposablesRef.current = [];\n // Attach debug features\n attachBreakpointGutter(editor, monacoInstance);\n attachDebugHover(editor, monacoInstance);\n mountCommon(editor, monacoInstance, { language, value, placeholder, onEditorMount, contextMenuMode, autoClosing: autoCloses(editorOptions ?? {}) });\n };\n\n const resolvedTheme = theme === 'light' ? 'daakia-light' : 'daakia-dark';\n\n return (\n <EditorShell bordered={bordered} containerHeight={containerHeight} contextMenuMode={contextMenuMode} contextMenuItems={contextMenuItems}\n itemsAt={(x, y) => menuItemsAt(editorRef.current, x, y, !!readOnly)} accentColor={accentColor}>\n <Editor\n height=\"100%\"\n language={language}\n path={modelPath}\n value={value}\n theme={resolvedTheme}\n onChange={v => onChange?.(v ?? '')}\n onMount={handleMount}\n options={buildOptions({ readOnly, fontSize: resolvedFontSize, wordWrap, glyphMargin: !!onToggleBreakpoint, contextMenuMode, editorOptions, theme: resolvedTheme })}\n />\n </EditorShell>\n );\n}\n\n// ─── Public export — registered into monaco-runtime by monaco-setup.ts ──────\n\nexport function EditorViewMonacoImpl({ debugSupported = false, className = '', ...rest }: EditorViewProps) {\n if (debugSupported) return <EditorViewDebug className={className} {...rest} />;\n return <EditorViewSimple className={className} {...rest} />;\n}\n\n// ─── Shared Monaco options builder ───────────────────────────────────────────\n\n/**\n * Should this editor close brackets, quotes and tags as you type?\n *\n * Yes, unless the caller passed `autoClosing: false` — or unless something\n * other than a person is typing, which the page says by setting\n * `window.__DUI_NO_AUTOCLOSE__ = true` before the app loads.\n *\n * The global exists because the answer has to hold across re-renders. These\n * options are construction options: every render hands Monaco the same object\n * again, so an `updateOptions({ autoClosingBrackets: 'never' })` from outside\n * survives only until the next keystroke re-renders the component and puts\n * 'always' back. A test driving the editor a character at a time would get a\n * few characters in and then start typing its closing braces onto the ones\n * Monaco had inserted — `{\"a\": 1}}`, a SOAP envelope with every tag doubled.\n *\n * Reading it here rather than at each of the dozens of call sites is the point:\n * one line makes every editor in every consuming app drivable.\n */\nfunction autoCloses(o: EditorOptions): boolean {\n if (o.autoClosing === false) return false;\n if (typeof window !== 'undefined' && (window as unknown as Record<string, unknown>).__DUI_NO_AUTOCLOSE__ === true) return false;\n return true;\n}\n\nfunction buildOptions({ readOnly, fontSize, wordWrap, glyphMargin, contextMenuMode = 'native', editorOptions, theme }: {\n readOnly: boolean;\n fontSize: number;\n wordWrap: boolean;\n glyphMargin: boolean;\n contextMenuMode?: EditorContextMenuMode;\n editorOptions?: EditorOptions;\n theme: string;\n}) {\n const o = editorOptions ?? {};\n const closes = autoCloses(o);\n return {\n // Baked into construction options (not just the top-level <Editor theme=\"\"> prop)\n // so Monaco applies it before its first paint — @monaco-editor/react creates the\n // editor first and only calls the global setTheme() afterward as a separate step,\n // which is what caused a flash of the default white 'vs' theme on every remount\n // (tab switch, subtab switch, new-tab-then-close) before this fix.\n theme,\n // ── Consumer-overridable defaults ────────────────────────────────────────\n lineNumbers: (o.lineNumbers ?? 'on') as 'on' | 'off' | 'relative' | 'interval',\n minimap: { enabled: o.minimap ?? false },\n scrollBeyondLastLine: o.scrollBeyondLastLine ?? false,\n smoothScrolling: o.smoothScrolling ?? false,\n mouseWheelZoom: o.mouseWheelZoom ?? false,\n folding: o.folding ?? true,\n showFoldingControls: (o.showFoldingControls ?? 'mouseover') as 'always' | 'never' | 'mouseover',\n tabSize: o.tabSize ?? 2,\n formatOnPaste: o.formatOnPaste ?? true,\n formatOnType: o.formatOnType ?? true,\n autoIndent: (o.autoIndent ?? 'full') as 'none' | 'keep' | 'brackets' | 'advanced' | 'full',\n renderWhitespace: (o.renderWhitespace ?? 'selection') as 'none' | 'boundary' | 'selection' | 'trailing' | 'all',\n matchBrackets: (o.matchBrackets ?? 'always') as 'never' | 'near' | 'always',\n bracketPairColorization: { enabled: o.bracketPairColorization ?? true },\n colorDecorators: o.colorDecorators ?? true,\n linkedEditing: o.linkedEditing ?? true,\n copyWithSyntaxHighlighting: o.copyWithSyntaxHighlighting ?? true,\n quickSuggestions: o.quickSuggestions ?? true,\n suggestOnTriggerCharacters: o.suggestOnTriggerCharacters ?? true,\n acceptSuggestionOnEnter: (o.acceptSuggestionOnEnter ?? 'on') as 'on' | 'off' | 'smart',\n hover: { enabled: o.hover ?? true },\n parameterHints: { enabled: o.parameterHints ?? true },\n codeLens: o.codeLens ?? false,\n inlayHints: { enabled: (o.inlayHints ?? false) ? 'on' as const : 'off' as const },\n padding: { top: o.padding?.top ?? 8, bottom: o.padding?.bottom ?? 8 },\n ...(o.cursorStyle && { cursorStyle: o.cursorStyle as any }),\n ...(o.cursorBlinking && { cursorBlinking: o.cursorBlinking as any }),\n ...(o.lineHeight && { lineHeight: o.lineHeight }),\n ...(o.letterSpacing && { letterSpacing: o.letterSpacing }),\n ...(o.rulers && { rulers: o.rulers }),\n ...(o.lineDecorationsWidth !== undefined && { lineDecorationsWidth: o.lineDecorationsWidth }),\n ...(o.lineNumbersMinChars !== undefined && { lineNumbersMinChars: o.lineNumbersMinChars }),\n // ── Prop-level overrides (top-level EditorView props win over editorOptions) ─\n readOnly,\n fontSize,\n wordWrap: (o.wordWrap ?? (wordWrap ? 'on' : 'off')) as 'off' | 'on' | 'wordWrapColumn' | 'bounded',\n // ── DUI structural — never overridable ──────────────────────────────────\n automaticLayout: true,\n glyphMargin,\n renderLineHighlight: (o.renderLineHighlight ?? (glyphMargin ? 'line' : 'none')) as 'none' | 'gutter' | 'line' | 'all',\n fixedOverflowWidgets: true,\n contextmenu: contextMenuMode === 'native',\n overviewRulerLanes: 0,\n hideCursorInOverviewRuler: true,\n overviewRulerBorder: false,\n scrollbar: {\n vertical: o.scrollbar?.vertical ?? 'auto',\n horizontal: o.scrollbar?.horizontal ?? 'auto',\n verticalScrollbarSize: o.scrollbar?.verticalScrollbarSize ?? 6,\n horizontalScrollbarSize: o.scrollbar?.horizontalScrollbarSize ?? 6,\n },\n fontFamily: o.fontFamily ?? 'Menlo, Monaco, \"Courier New\", monospace',\n /*\n Closing brackets, quotes and tags for you — on by default, and off when\n the caller says so.\n\n These were hard-coded to 'always' in two places, one of them an\n `updateOptions` that runs after mount, so a consumer setting them to\n 'never' on the instance had them set straight back. Anything driving this\n editor a character at a time then typed its own closing brace onto the\n one Monaco had already inserted: `{\"a\": 1}}`, and a SOAP envelope with\n every tag doubled.\n */\n autoClosingBrackets: (closes ? 'always' : 'never') as 'never' | 'always',\n autoClosingQuotes: (closes ? 'always' : 'never') as 'never' | 'always',\n autoClosingDelete: (closes ? 'always' : 'never') as 'never' | 'always',\n autoSurround: (closes ? 'languageDefined' : 'never') as 'never' | 'languageDefined',\n guides: { bracketPairs: true, indentation: true },\n suggest: {\n showKeywords: o.suggest?.showKeywords ?? true,\n showSnippets: o.suggest?.showSnippets ?? true,\n showValues: o.suggest?.showValues ?? true,\n showProperties: o.suggest?.showProperties ?? true,\n ...(o.suggest?.showIcons !== undefined && { showIcons: o.suggest.showIcons }),\n },\n };\n}\n\n// ─── Shared mount logic (everything that isn't debug-specific) ────────────────\n\n/*\n Copy the path to whatever was right-clicked.\n\n Reading a value out of a document and then writing the expression that\n selects it is a transcription job: you can see `id` on screen and still have\n to count array indices and retype four ancestor names to say where it lives.\n\n ── Why this is a menu item and not a Monaco action ──\n\n It was an `editor.addAction`, which registers cleanly and runs correctly, and\n never appeared in Monaco's context menu — not in `9_cutcopypaste`, which\n draws as an icon bar and has nowhere to put a label; not in a group of its\n own; not in `navigation`. The action was enabled and invocable the whole\n time, which is exactly what made it hard to see: nothing was broken except\n the one thing that mattered.\n\n DUI's own menu renders it, and gets something Monaco's could not offer\n anyway — a submenu, so every enclosing level is one click away rather than\n only the leaf you happened to hit.\n*/\nfunction pathItemsAt(editor: any, x: number, y: number): ContextMenuItem[] {\n const model = editor?.getModel?.();\n const position = editor?.getTargetAtClientPoint?.(x, y)?.position;\n if (!model || !position) return [];\n\n const language = model.getLanguageId();\n const text = model.getValue();\n const offset = model.getOffsetAt(position);\n\n const levels = language === 'json' ? jsonPathLevels(text, offset)\n : language === 'xml' ? xPathLevels(text, offset)\n : [];\n if (!levels.length) return [];\n\n /*\n Innermost first. The thing you clicked is the thing you asked about, so it\n is the first entry and every ancestor follows it outward — the reverse\n reads as a list you have to scan to the end of.\n */\n const inner = [...levels].reverse();\n return [{\n id: 'dui.copyPath',\n label: language === 'json' ? 'Copy JSON path' : 'Copy XPath',\n children: inner.map((path, i) => ({\n id: `dui.copyPath.${i}`,\n label: path,\n // The one you are most likely to want, named as such rather than left\n // to be inferred from its position.\n description: i === 0 ? 'what you clicked' : undefined,\n onClick: () => { void navigator.clipboard?.writeText(path); },\n })),\n }];\n}\n\n/*\n The editing basics, so choosing DUI's menu is not a downgrade.\n\n Monaco's own menu carries cut, copy, paste and select-all for free; a\n consumer that switches to the DUI menu to gain the path submenu would\n otherwise lose them, and a right-click that cannot copy is a worse menu than\n the one it replaced.\n*/\nfunction editItemsAt(editor: any, readOnly: boolean): ContextMenuItem[] {\n const model = editor?.getModel?.();\n if (!model) return [];\n const selection = editor.getSelection?.();\n const selected = selection && !selection.isEmpty() ? model.getValueInRange(selection) : '';\n\n const items: ContextMenuItem[] = [\n {\n id: 'dui.copy',\n label: 'Copy',\n shortcut: 'Ctrl+C',\n disabled: !selected,\n onClick: () => { if (selected) void navigator.clipboard?.writeText(selected); },\n },\n {\n id: 'dui.selectAll',\n label: 'Select all',\n shortcut: 'Ctrl+A',\n onClick: () => {\n editor.setSelection(model.getFullModelRange());\n editor.focus();\n },\n },\n ];\n\n if (!readOnly) {\n items.unshift({\n id: 'dui.cut',\n label: 'Cut',\n shortcut: 'Ctrl+X',\n disabled: !selected,\n onClick: () => {\n if (!selected) return;\n void navigator.clipboard?.writeText(selected);\n editor.executeEdits('dui.cut', [{ range: selection, text: '' }]);\n editor.focus();\n },\n });\n items.push({\n id: 'dui.paste',\n label: 'Paste',\n shortcut: 'Ctrl+V',\n onClick: async () => {\n const text = await navigator.clipboard?.readText?.();\n if (text == null) return;\n const range = editor.getSelection() ?? model.getFullModelRange();\n editor.executeEdits('dui.paste', [{ range, text }]);\n editor.focus();\n },\n });\n }\n return items;\n}\n\n/*\n Everything the DUI menu shows: what you clicked on, then the basics.\n\n `readOnly` comes from the component's own prop rather than from\n `editor.getOption(...)`, whose option ids are a numeric enum that shifts\n between Monaco releases — pinning one here would silently offer Paste on a\n response viewer the day the enum moved.\n*/\nfunction menuItemsAt(editor: any, x: number, y: number, readOnly: boolean): ContextMenuItem[] {\n const path = pathItemsAt(editor, x, y);\n const edit = editItemsAt(editor, readOnly);\n if (!path.length) return edit;\n return [...path, { id: 'dui.sep', label: '', separator: true }, ...edit];\n}\n\nfunction mountCommon(\n editor: any,\n monacoInstance: any,\n { language, value, placeholder, onEditorMount, contextMenuMode = 'native', autoClosing = true }: {\n language: EditorLanguage;\n value: string;\n placeholder?: string;\n onEditorMount?: (editor: any, monaco: any) => void;\n contextMenuMode?: EditorContextMenuMode;\n autoClosing?: boolean;\n },\n) {\n // Layout fixes for flex/overflow containers\n const relayout = () => editor.layout();\n relayout();\n requestAnimationFrame(relayout);\n setTimeout(relayout, 50);\n setTimeout(relayout, 200);\n const parent = editor.getContainerDomNode().parentElement;\n if (parent) {\n const ro = new ResizeObserver(relayout);\n ro.observe(parent);\n editor.onDidDispose(() => ro.disconnect());\n }\n\n editor.updateOptions({\n autoClosingBrackets: autoClosing ? 'always' : 'never',\n autoClosingQuotes: autoClosing ? 'always' : 'never',\n autoClosingDelete: autoClosing ? 'always' : 'never',\n autoSurround: autoClosing ? 'languageDefined' : 'never',\n autoIndent: 'full',\n });\n\n // Clipboard overrides — modern Clipboard API (webview-compatible)\n const KM = monacoInstance.KeyMod;\n const KC = monacoInstance.KeyCode;\n\n editor.addAction({\n id: 'daakia.clipboard.copy', label: 'Copy',\n keybindings: [KM.CtrlCmd | KC.KeyC],\n run: (ed: any) => {\n const sel = ed.getSelection();\n if (sel && !sel.isEmpty()) {\n navigator.clipboard.writeText(ed.getModel()?.getValueInRange(sel) || '');\n } else {\n const pos = ed.getPosition();\n if (pos) navigator.clipboard.writeText((ed.getModel()?.getLineContent(pos.lineNumber) || '') + '\\n');\n }\n },\n });\n\n editor.addAction({\n id: 'daakia.clipboard.cut', label: 'Cut',\n keybindings: [KM.CtrlCmd | KC.KeyX],\n run: (ed: any) => {\n const sel = ed.getSelection();\n if (sel && !sel.isEmpty()) {\n navigator.clipboard.writeText(ed.getModel()?.getValueInRange(sel) || '');\n ed.executeEdits('cut', [{ range: sel, text: '' }]);\n } else {\n const pos = ed.getPosition();\n if (pos) {\n const model = ed.getModel();\n if (model) {\n navigator.clipboard.writeText(model.getLineContent(pos.lineNumber) + '\\n');\n ed.executeEdits('cut', [{ range: new monacoInstance.Range(pos.lineNumber, 1, pos.lineNumber + 1, 1), text: '' }]);\n }\n }\n }\n },\n });\n\n /*\n Ctrl+V is deliberately NOT bound.\n\n It was, to an action calling `navigator.clipboard.readText()` — which needs\n the `clipboard-read` permission, and a webview denies it. The read threw,\n an empty catch swallowed it, and paste did nothing at all: no error, no\n text, no way to tell it apart from an empty clipboard. Binding the key also\n preempted the browser's own paste, so the one mechanism that does work was\n the one being replaced.\n\n A real Ctrl+V is a user gesture that carries the clipboard contents with\n it, so Monaco's built-in handling needs no permission and always works.\n Reading the clipboard out of band is the thing that needs privileges, and\n it is only worth attempting where there is no gesture to ride on — which\n is why the context menu still tries it, with a fallback.\n */\n\n editor.addAction({\n id: 'daakia.clipboard.selectAll', label: 'Select All',\n keybindings: [KM.CtrlCmd | KC.KeyA],\n run: (ed: any) => { const m = ed.getModel(); if (m) ed.setSelection(m.getFullModelRange()); },\n });\n\n // Format Document — Shift+Alt+F\n editor.addAction({\n id: 'daakia.format.document', label: 'Format Document',\n keybindings: [KM.Shift | KM.Alt | KC.KeyF],\n contextMenuGroupId: 'modification', contextMenuOrder: 1.5,\n run: async (ed: any) => {\n const model = ed.getModel();\n if (!model) return;\n const langId = model.getLanguageId();\n if (langId === 'xml' || langId === 'html') {\n try {\n const raw = model.getValue();\n const formatted = formatXml(raw);\n if (formatted !== raw) ed.executeEdits('daakia.format', [{ range: model.getFullModelRange(), text: formatted }]);\n } catch { /* malformed XML */ }\n } else if (langId === 'yaml') {\n try {\n const raw = model.getValue();\n const formatted = formatYaml(raw);\n if (formatted !== raw) ed.executeEdits('daakia.format', [{ range: model.getFullModelRange(), text: formatted }]);\n } catch { /* malformed YAML */ }\n } else if (langId === 'sql') {\n try {\n const raw = model.getValue();\n const formatted = formatSql(raw);\n if (formatted !== raw) ed.executeEdits('daakia.format', [{ range: model.getFullModelRange(), text: formatted }]);\n } catch { /* malformed SQL */ }\n } else {\n await ed.getAction('editor.action.formatDocument')?.run();\n }\n },\n });\n\n // Find & Replace — Ctrl+Shift+H\n editor.addAction({\n id: 'daakia.findAndReplace', label: 'Find and Replace',\n keybindings: [KM.CtrlCmd | KM.Shift | KC.KeyH],\n contextMenuGroupId: 'navigation', contextMenuOrder: 1.5,\n run: () => editor.getAction('editor.action.startFindReplaceAction')?.run(),\n });\n\n // Auto-closing config. XML/HTML is registered unconditionally rather than\n // only when the editor currently holds that language — a Content Type switch\n // (JSON → application/xml) swaps the model in place without re-running mount,\n // so a lazily-registered xml config would never arrive.\n configureTagLanguage(monacoInstance, 'xml');\n configureTagLanguage(monacoInstance, 'html');\n const model = editor.getModel();\n if (model) {\n const langId = model.getLanguageId();\n if (langId !== 'xml' && langId !== 'html' && !plainLangConfigured.has(langId)) {\n plainLangConfigured.add(langId);\n monacoInstance.languages.setLanguageConfiguration(langId, {\n autoClosingPairs: [\n { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' },\n { open: '\"', close: '\"', notIn: ['string'] },\n { open: \"'\", close: \"'\", notIn: ['string', 'comment'] },\n ],\n brackets: [['{', '}'], ['[', ']'], ['(', ')']],\n surroundingPairs: [\n { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' },\n { open: '\"', close: '\"' }, { open: \"'\", close: \"'\" },\n ],\n });\n }\n }\n installTagAutoClose(editor, monacoInstance);\n\n // GraphQL tokenizer + completion\n const langs = monacoInstance.languages.getLanguages();\n if (!langs.some((l: any) => l.id === 'graphql')) {\n monacoInstance.languages.register({ id: 'graphql' });\n monacoInstance.languages.setMonarchTokensProvider('graphql', {\n keywords: ['type', 'input', 'enum', 'union', 'interface', 'scalar', 'schema', 'query', 'mutation', 'subscription', 'fragment', 'on', 'extend', 'implements', 'directive', 'repeatable'],\n typeKeywords: ['String', 'Int', 'Float', 'Boolean', 'ID'],\n operators: ['!', '=', '|', '&', '...'],\n symbols: /[=!|&]+/,\n tokenizer: {\n root: [\n [/#.*$/, 'comment'], [/\"([^\"\\\\]|\\\\.)*\"/, 'string'], [/\"\"\"[\\s\\S]*?\"\"\"/, 'string'],\n [/\\b(type|input|enum|union|interface|scalar|schema|extend|implements|directive|repeatable)\\b/, 'keyword'],\n [/\\b(query|mutation|subscription|fragment|on)\\b/, 'keyword.control'],\n [/\\b(String|Int|Float|Boolean|ID)\\b/, 'type.identifier'],\n [/\\b[A-Z][a-zA-Z0-9_]*\\b/, 'type.identifier'],\n [/\\b[a-z_][a-zA-Z0-9_]*(?=\\s*[:(])/, 'variable'],\n [/\\b[a-z_][a-zA-Z0-9_]*\\b/, 'identifier'],\n [/[{}()\\[\\]]/, '@brackets'], [/[!:=|&]/, 'operator'],\n [/\\$[a-zA-Z_]\\w*/, 'variable'], [/@[a-zA-Z_]\\w*/, 'annotation'],\n ],\n },\n } as any);\n }\n if (language === 'graphql') initGraphQLCompletionProvider(monacoInstance);\n\n // dk + console intellisense — JavaScript editors only\n if (language === 'javascript') {\n if (!dkLibRegistered) {\n monacoInstance.languages.typescript.javascriptDefaults.addExtraLib(DK_TYPE_DEFS, 'dk-globals.d.ts');\n dkLibRegistered = true;\n }\n monacoInstance.languages.registerCompletionItemProvider('javascript', {\n triggerCharacters: ['.'],\n provideCompletionItems: (mdl: any, pos: any) => {\n const textUntilPosition = mdl.getValueInRange({\n startLineNumber: pos.lineNumber, startColumn: 1,\n endLineNumber: pos.lineNumber, endColumn: pos.column,\n });\n const suggestions = getDkCompletions(textUntilPosition, monacoInstance, pos);\n if (suggestions.length > 0) return { suggestions };\n const range = { startLineNumber: pos.lineNumber, endLineNumber: pos.lineNumber, startColumn: pos.column, endColumn: pos.column };\n if (/\\bconsole\\.\\s*$/.test(textUntilPosition)) {\n return {\n suggestions: [\n { label: 'log', kind: monacoInstance.languages.CompletionItemKind.Function, insertText: 'log(${1})', insertTextRules: monacoInstance.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: 'Log output', range },\n { label: 'info', kind: monacoInstance.languages.CompletionItemKind.Function, insertText: 'info(${1})', insertTextRules: monacoInstance.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: 'Info output', range },\n { label: 'warn', kind: monacoInstance.languages.CompletionItemKind.Function, insertText: 'warn(${1})', insertTextRules: monacoInstance.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: 'Warning output', range },\n { label: 'error', kind: monacoInstance.languages.CompletionItemKind.Function, insertText: 'error(${1})', insertTextRules: monacoInstance.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: 'Error output', range },\n { label: 'debug', kind: monacoInstance.languages.CompletionItemKind.Function, insertText: 'debug(${1})', insertTextRules: monacoInstance.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: 'Debug output', range },\n ],\n };\n }\n return { suggestions: [] };\n },\n });\n }\n\n if (!value && placeholder) editor.updateOptions({ placeholder });\n onEditorMount?.(editor, monacoInstance);\n editor.updateOptions({ contextmenu: contextMenuMode === 'native' });\n}\n","import { DiffEditor, type DiffOnMount } from '@monaco-editor/react';\nimport { useAppTheme } from '../../../hooks/useAppTheme';\nimport type { DiffEditorViewProps } from './DiffEditorView';\n\n// This file is only ever reached by '@salilvnair/dui/monaco-setup' — see\n// EditorView.monaco.tsx for why that makes a plain top-level import safe.\n\nexport function DiffEditorViewMonacoImpl({\n original,\n modified,\n language = 'sql',\n height = 300,\n readOnly = true,\n renderSideBySide = true,\n wordWrap = false,\n fontSize = 12,\n theme,\n onMount,\n}: DiffEditorViewProps) {\n const appTheme = useAppTheme();\n const resolvedTheme = theme ?? (appTheme === 'light' ? 'vs' : 'vs-dark');\n const h = typeof height === 'number' ? `${height}px` : height;\n\n return (\n <DiffEditor\n height={h}\n language={language}\n theme={resolvedTheme}\n original={original}\n modified={modified}\n onMount={onMount as DiffOnMount | undefined}\n options={{\n readOnly,\n renderSideBySide,\n // Monaco silently drops to inline/unified rendering below its own\n // width threshold regardless of renderSideBySide — this diff editor\n // is often mounted inside narrow panels (e.g. Merkle's expanded\n // table row), so pin side-by-side explicitly instead of letting it\n // auto-collapse.\n useInlineViewWhenSpaceIsLimited: false,\n wordWrap: wordWrap ? 'on' : 'off',\n fontSize,\n automaticLayout: true,\n minimap: { enabled: false },\n scrollBeyondLastLine: false,\n lineNumbers: 'on',\n folding: true,\n ignoreTrimWhitespace: false,\n }}\n />\n );\n}\n","/**\n * Everything about self-hosting Monaco except *where the workers come from*.\n *\n * The themes, the TypeScript language-service configuration and the\n * registration of the real editor implementations are the same wherever Monaco\n * runs. How its four web workers are delivered is not, and that one decision\n * costs about nine megabytes:\n *\n * • A consumer inside a VS Code webview cannot fetch a worker script over\n * the network — the CSP forbids it — so the workers have to be inlined\n * into the bundle as blobs. That is what `monaco-setup.ts` does, and it is\n * the published contract.\n *\n * • A page on the open web can just fetch them, and should: inlining puts\n * the whole TypeScript compiler, base64-encoded, into the chunk that has\n * to arrive before anything renders. That is what `showcase/monacoSetup.ts`\n * does.\n *\n * So the workers live in those two files and everything else lives here.\n * Nothing in this module reads or writes `MonacoEnvironment`; both wrappers set\n * it before importing this, and Monaco only reads it when the first editor\n * mounts.\n *\n * This file is not a public entry point. Consumers import\n * `@salilvnair/dui/monaco-setup`, whose behaviour is unchanged.\n */\nimport { loader } from '@monaco-editor/react';\nimport * as monaco from 'monaco-editor';\nimport { markMonacoReady, registerMonacoEditorImpl, registerMonacoDiffEditorImpl } from './lib/monaco-runtime';\nimport { EditorViewMonacoImpl } from './lib/components/input/EditorView.monaco';\nimport { DiffEditorViewMonacoImpl } from './lib/components/input/DiffEditorView.monaco';\nimport {\n javascriptDefaults,\n typescriptDefaults,\n ScriptTarget,\n ModuleKind,\n ModuleResolutionKind,\n JsxEmit,\n} from 'monaco-editor/esm/vs/language/typescript/monaco.contribution';\n\n// Define VS Code \"Dark+\" matching theme\nmonaco.editor.defineTheme('daakia-dark', {\n base: 'vs-dark',\n inherit: true,\n rules: [\n // JSON\n { token: 'string.key.json', foreground: '9CDCFE' },\n { token: 'string.value.json', foreground: 'CE9178' },\n { token: 'number', foreground: 'B5CEA8' },\n { token: 'keyword.json', foreground: '569CD6' }, // true/false/null\n // General\n { token: 'string', foreground: 'CE9178' },\n { token: 'keyword', foreground: '569CD6' },\n { token: 'comment', foreground: '6A9955' },\n { token: 'type', foreground: '4EC9B0' },\n { token: 'identifier', foreground: '9CDCFE' },\n { token: 'variable', foreground: '9CDCFE' },\n { token: 'constant', foreground: '4FC1FF' },\n // JS/TS\n { token: 'keyword.js', foreground: 'C586C0' },\n { token: 'keyword.ts', foreground: 'C586C0' },\n { token: 'string.js', foreground: 'CE9178' },\n { token: 'string.ts', foreground: 'CE9178' },\n { token: 'number.js', foreground: 'B5CEA8' },\n { token: 'number.ts', foreground: 'B5CEA8' },\n { token: 'regexp', foreground: 'D16969' },\n { token: 'delimiter', foreground: 'D4D4D4' },\n { token: 'delimiter.bracket', foreground: 'FFD700' },\n // XML/HTML\n { token: 'tag', foreground: '569CD6' },\n { token: 'attribute.name', foreground: '9CDCFE' },\n { token: 'attribute.value', foreground: 'CE9178' },\n // GraphQL\n { token: 'keyword.graphql', foreground: 'C586C0' },\n { token: 'keyword.control.graphql', foreground: 'C586C0' },\n { token: 'type.identifier.graphql', foreground: 'E5C07B' },\n { token: 'variable.graphql', foreground: '9CDCFE' },\n { token: 'string.graphql', foreground: 'CE9178' },\n { token: 'comment.graphql', foreground: '6A9955' },\n { token: 'annotation.graphql', foreground: 'DCDCAA' },\n { token: 'operator.graphql', foreground: 'D4D4D4' },\n { token: 'identifier.graphql', foreground: 'D4D4D4' },\n ],\n colors: {\n 'editor.background': '#1e1e1e',\n 'editor.foreground': '#D4D4D4',\n 'editor.lineHighlightBackground': '#2a2a2a',\n 'editor.selectionBackground': '#264f78',\n 'editor.inactiveSelectionBackground': '#3a3d41',\n 'editorLineNumber.foreground': '#858585',\n 'editorLineNumber.activeForeground': '#C6C6C6',\n 'editorCursor.foreground': '#AEAFAD',\n 'editor.selectionHighlightBackground': '#ADD6FF26',\n 'editorIndentGuide.background': '#404040',\n 'editorIndentGuide.activeBackground': '#707070',\n 'editorBracketMatch.background': '#0064001a',\n 'editorBracketMatch.border': '#888888',\n 'editorGutter.background': '#1e1e1e',\n 'editorWidget.background': '#252526',\n 'editorSuggestWidget.background': '#252526',\n 'editorSuggestWidget.border': '#454545',\n 'editorSuggestWidget.selectedBackground': '#04395e',\n 'list.hoverBackground': '#2a2d2e',\n 'input.background': '#3c3c3c',\n 'focusBorder': '#6366f1',\n },\n});\n\n// Configure TypeScript/JavaScript language service for full IntelliSense\n// allowNonTsExtensions is critical — without it, in-memory models (no .js/.ts extension)\n// won't get definition/reference/rename support from the TypeScript worker.\njavascriptDefaults.setCompilerOptions({\n target: ScriptTarget.ESNext,\n module: ModuleKind.ESNext,\n allowNonTsExtensions: true,\n allowJs: true,\n checkJs: true,\n strict: false,\n noEmit: true,\n esModuleInterop: true,\n moduleResolution: ModuleResolutionKind.NodeJs,\n jsx: JsxEmit.React,\n});\n\njavascriptDefaults.setDiagnosticsOptions({\n noSemanticValidation: false,\n noSyntaxValidation: false,\n});\n\n// Ensure all models are immediately synced to the TypeScript worker\n// (required for Go to Definition, Peek, etc. to work)\njavascriptDefaults.setEagerModelSync(true);\ntypescriptDefaults.setEagerModelSync(true);\n\ntypescriptDefaults.setCompilerOptions({\n target: ScriptTarget.ESNext,\n module: ModuleKind.ESNext,\n allowNonTsExtensions: true,\n allowJs: true,\n strict: false,\n noEmit: true,\n esModuleInterop: true,\n moduleResolution: ModuleResolutionKind.NodeJs,\n jsx: JsxEmit.React,\n});\n\n// Define VS Code \"Light+\" matching theme\nmonaco.editor.defineTheme('daakia-light', {\n base: 'vs',\n inherit: true,\n rules: [\n { token: 'string.key.json', foreground: '0451a5' },\n { token: 'string.value.json', foreground: 'a31515' },\n { token: 'number', foreground: '09885a' },\n { token: 'keyword.json', foreground: '0000ff' },\n { token: 'string', foreground: 'a31515' },\n { token: 'keyword', foreground: '0000ff' },\n { token: 'comment', foreground: '008000' },\n { token: 'type', foreground: '267f99' },\n { token: 'identifier', foreground: '001080' },\n { token: 'variable', foreground: '001080' },\n { token: 'constant', foreground: '0070c1' },\n { token: 'keyword.js', foreground: 'af00db' },\n { token: 'keyword.ts', foreground: 'af00db' },\n { token: 'string.js', foreground: 'a31515' },\n { token: 'string.ts', foreground: 'a31515' },\n { token: 'number.js', foreground: '09885a' },\n { token: 'number.ts', foreground: '09885a' },\n { token: 'regexp', foreground: 'c41a16' },\n { token: 'delimiter', foreground: '000000' },\n { token: 'delimiter.bracket', foreground: '000000' },\n { token: 'tag', foreground: '800000' },\n { token: 'attribute.name', foreground: 'ff0000' },\n { token: 'attribute.value', foreground: '0451a5' },\n { token: 'keyword.graphql', foreground: 'af00db' },\n { token: 'type.identifier.graphql', foreground: '267f99' },\n { token: 'variable.graphql', foreground: '001080' },\n { token: 'string.graphql', foreground: 'a31515' },\n { token: 'comment.graphql', foreground: '008000' },\n { token: 'operator.graphql', foreground: '000000' },\n { token: 'identifier.graphql', foreground: '000000' },\n ],\n colors: {\n 'editor.background': '#ffffff',\n 'editor.foreground': '#000000',\n 'editor.lineHighlightBackground': '#f5f5f5',\n 'editor.selectionBackground': '#add6ff',\n 'editor.inactiveSelectionBackground': '#e5ebf1',\n 'editorLineNumber.foreground': '#237893',\n 'editorLineNumber.activeForeground': '#0b216f',\n 'editorCursor.foreground': '#000000',\n 'editor.selectionHighlightBackground': '#add6ff4d',\n 'editorIndentGuide.background1': '#d3d3d3',\n 'editorIndentGuide.activeBackground1': '#939393',\n 'editorGutter.background': '#ffffff',\n 'editorWidget.background': '#f3f3f3',\n 'editorSuggestWidget.background': '#f3f3f3',\n 'editorSuggestWidget.border': '#c8c8c8',\n 'editorSuggestWidget.selectedBackground': '#0060c0',\n 'list.hoverBackground': '#f0f0f0',\n 'input.background': '#ffffff',\n 'input.border': '#d1d5db',\n 'focusBorder': '#6366f1',\n },\n});\n\nloader.config({ monaco });\n\n// Expose monaco globally for context menu access to editor instances\n(window as any).monaco = monaco;\n\n// Register the real Monaco-backed implementations, then flip the shared\n// readiness gate — EditorView/DiffEditorView now render these instead of\n// their lightweight fallback.\nregisterMonacoEditorImpl(EditorViewMonacoImpl);\nregisterMonacoDiffEditorImpl(DiffEditorViewMonacoImpl);\nmarkMonacoReady();\n\n/** Call this whenever the app theme changes to re-theme all open Monaco editors */\nexport function applyMonacoTheme(theme: 'dark' | 'light') {\n monaco.editor.setTheme(theme === 'dark' ? 'daakia-dark' : 'daakia-light');\n}\n\nexport { monaco };\n","/**\n * Self-host Monaco Editor — no CDN required.\n *\n * This is the published entry point: `import '@salilvnair/dui/monaco-setup'`.\n * Its behaviour has not changed. It wires Monaco's four web workers **inline**,\n * as blobs built into the bundle, so a consumer running inside a VS Code\n * webview — where the CSP forbids fetching a worker script over the network —\n * gets a working editor with no external requests at all.\n *\n * Everything else about self-hosting Monaco (the two themes, the TypeScript\n * language-service configuration, registering the real editor implementations)\n * lives in `./monaco-setup.core`, because none of it depends on how the\n * workers arrive. The showcase pairs that same core with ordinary fetched\n * workers instead — see `showcase/monacoSetup.ts` for why.\n *\n * ── On the cost, and who pays it ──\n *\n * Inlining is not free: `ts.worker` alone is close to seven megabytes, and\n * base64 makes it larger still. The library build never pays it, because\n * `vite.publish.config.ts` externalises everything matching `monaco-editor/`\n * — the `?worker&inline` query is a directive the *consumer's* bundler\n * honours, not something baked into `dist/`. So the choice stays where it\n * belongs: with the app doing the bundling.\n */\nimport editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker&inline';\nimport jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker&inline';\nimport htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker&inline';\nimport tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker&inline';\n\n/* Set before the core is imported, though the ordering is not load-bearing:\n Monaco reads MonacoEnvironment when the first editor mounts, not when its\n module is evaluated. */\n(window as any).MonacoEnvironment = {\n getWorker(_: string, label: string) {\n if (label === 'json') return new jsonWorker();\n if (label === 'html' || label === 'handlebars' || label === 'razor') return new htmlWorker();\n if (label === 'typescript' || label === 'javascript') return new tsWorker();\n return new editorWorker();\n },\n};\n\nexport * from './monaco-setup.core';\n"],"names":["resolveTheme","vsKind","_a","useAppTheme","theme","setTheme","useState","useEffect","update","htmlObs","bodyObs","DK_TYPE_DEFS","getDkCompletions","_text","_monaco","_pos","useBreakpointGutter","options","breakpoints","disabledBreakpoints","conditionalBreakpointLines","pausedLine","onToggleBreakpoint","onGlyphContextMenu","editorRef","useRef","monacoRef","decorationsRef","pausedDecoRef","hoverDecoRef","disposablesRef","isBreakpointableLine","useCallback","lineNo","editor","model","monaco","decos","line","isDisabled","isConditional","glyphClass","d","domNode","marginContainer","d1","e","glyphRightClick","d2a","domHandler","ev","d3","lineDecos","_b","_d","_c","d4","state","useDebugStore","selector","dkLibRegistered","tagLangConfigured","plainLangConfigured","VOID_TAGS","OPEN_TAG_AT_CARET","ANY_TAG","escapeRe","s","innermostOpenTag","text","scrubbed","stack","m","full","name","attrs","at","configureTagLanguage","monacoInstance","langId","config","live","delay","next","installTagAutoClose","reentrant","sub","change","column","before","insert","caretShift","consumeNext","open","rest","tag","EXT_MAP","formatXml","xml","depth","result","tokens","token","isClosing","isSelfClosing","formatYaml","yaml","formatSql","sql","CLAUSE_RE","EditorViewSimple","value","onChange","language","height","minHeight","readOnly","placeholder","wordWrap","size","fontSize","className","bordered","onEditorMount","contextMenuMode","contextMenuItems","editorOptions","accentColor","base","useEditorBase","resolvedFontSize","modelPath","useMemo","resolvedHeight","containerHeight","handleMount","mountCommon","autoCloses","resolvedTheme","jsx","EditorShell","x","y","menuItemsAt","Editor","v","buildOptions","EditorViewDebug","attachBreakpointGutter","navigateLine","EditorViewMonacoImpl","debugSupported","o","glyphMargin","closes","_e","_f","_g","_h","_i","_j","_k","pathItemsAt","position","offset","levels","jsonPathLevels","xPathLevels","inner","path","i","editItemsAt","selection","selected","items","range","edit","autoClosing","relayout","parent","ro","KM","KC","ed","sel","pos","raw","formatted","l","mdl","textUntilPosition","suggestions","DiffEditorViewMonacoImpl","original","modified","renderSideBySide","onMount","appTheme","h","DiffEditor","javascriptDefaults","ScriptTarget","ModuleKind","ModuleResolutionKind","JsxEmit","typescriptDefaults","loader","registerMonacoEditorImpl","registerMonacoDiffEditorImpl","markMonacoReady","applyMonacoTheme","_","label","jsonWorker","htmlWorker","tsWorker","editorWorker"],"mappings":";;;;;;;;;;AAUA,SAASA,IAAiC;;AACxC,QAAMC,MACJC,IAAA,SAAS,SAAT,gBAAAA,EAAe,aAAa,8BAC5B,SAAS,gBAAgB,aAAa,wBAAwB;AAChE,SAAID,IAAeA,MAAW,iBAAiB,UAAU,SACjD,SAAS,gBAAgB,aAAa,YAAY,KAA0B;AACtF;AAEO,SAASE,IAAgC;AAC9C,QAAM,CAACC,GAAOC,CAAQ,IAAIC,GAA2BN,CAAY;AAEjE,SAAAO,EAAU,MAAM;AACd,UAAMC,IAAS,MAAMH,EAASL,GAAc,GACtCS,IAAU,IAAI,iBAAiBD,CAAM;AAC3C,IAAAC,EAAQ,QAAQ,SAAS,iBAAiB,EAAE,YAAY,IAAM,iBAAiB,CAAC,cAAc,wBAAwB,EAAA,CAAG;AACzH,UAAMC,IAAU,IAAI,iBAAiBF,CAAM;AAC3C,WAAI,SAAS,QAAME,EAAQ,QAAQ,SAAS,MAAM,EAAE,YAAY,IAAM,iBAAiB,CAAC,wBAAwB,GAAG,GAC5G,MAAM;AAAE,MAAAD,EAAQ,WAAA,GAAcC,EAAQ,WAAA;AAAA,IAAc;AAAA,EAC7D,GAAG,CAAA,CAAE,GAEEN;AACT;AC9BO,MAAMO,KAAe;AACrB,SAASC,GAAiBC,GAAeC,GAAkBC,GAA0B;AAC1F,SAAO,CAAA;AACT;ACkBO,SAASC,GAAoBC,GAAkC;AACpE,QAAM;AAAA,IACJ,aAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,4BAAAC;AAAA,IACA,YAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,oBAAAC;AAAA,EAAA,IACEN,GAEEO,IAAYC,EAAY,IAAI,GAC5BC,IAAYD,EAAY,IAAI,GAC5BE,I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