@e-llm-studio/citation 0.0.250 → 0.0.251-beta.1
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/dist/cjs/features/SPBAnalysisPanel/Internaleditor.js +1 -1
- package/dist/cjs/features/SPBAnalysisPanel/Internaleditor.js.map +1 -1
- package/dist/cjs/features/SPBAnalysisPanel/Spbanalysispanel.js +1 -1
- package/dist/cjs/features/SPBAnalysisPanel/Spbanalysispanel.js.map +1 -1
- package/dist/cjs/utils/helper.js +2 -0
- package/dist/cjs/utils/helper.js.map +1 -0
- package/dist/features/SPBAnalysisPanel/Internaleditor.js +1 -1
- package/dist/features/SPBAnalysisPanel/Internaleditor.js.map +1 -1
- package/dist/features/SPBAnalysisPanel/Spbanalysispanel.js +1 -1
- package/dist/features/SPBAnalysisPanel/Spbanalysispanel.js.map +1 -1
- package/dist/types/features/SPBAnalysisPanel/Internaleditor.d.ts +3 -2
- package/dist/types/features/SPBAnalysisPanel/Internaleditor.d.ts.map +1 -1
- package/dist/types/features/SPBAnalysisPanel/Spbanalysispanel.d.ts.map +1 -1
- package/dist/types/utils/helper.d.ts +5 -0
- package/dist/types/utils/helper.d.ts.map +1 -0
- package/dist/utils/helper.js +2 -0
- package/dist/utils/helper.js.map +1 -0
- package/package.json +1 -1
- package/dist/cjs/features/Bookemon/BookemonStyles.js +0 -2
- package/dist/cjs/features/Bookemon/BookemonStyles.js.map +0 -1
- package/dist/cjs/lib/ui/icons.js +0 -2
- package/dist/cjs/lib/ui/icons.js.map +0 -1
- package/dist/cjs/lib/ui/materialCompat.js +0 -2
- package/dist/cjs/lib/ui/materialCompat.js.map +0 -1
- package/dist/features/Bookemon/BookemonStyles.js +0 -2
- package/dist/features/Bookemon/BookemonStyles.js.map +0 -1
- package/dist/lib/ui/icons.js +0 -2
- package/dist/lib/ui/icons.js.map +0 -1
- package/dist/lib/ui/materialCompat.js +0 -2
- package/dist/lib/ui/materialCompat.js.map +0 -1
- package/dist/types/features/Bookemon/BookemonStyles.d.ts +0 -6
- package/dist/types/features/Bookemon/BookemonStyles.d.ts.map +0 -1
- package/dist/types/lib/ui/icons.d.ts +0 -46
- package/dist/types/lib/ui/icons.d.ts.map +0 -1
- package/dist/types/lib/ui/materialCompat.d.ts +0 -117
- package/dist/types/lib/ui/materialCompat.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material"),n=require("@monaco-editor/react"),o=require("../../utils/helper.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(n);const l={base:"vs-dark",inherit:!0,rules:[{token:"tag",foreground:"714be3",fontStyle:"bold"},{token:"attribute.name",foreground:"87CEFA"},{token:"attribute.value",foreground:"98FB98"},{token:"variable",foreground:"00FFFF"},{token:"delimiter",foreground:"888888"},{token:"white",foreground:"AAAAAA"}],colors:{"editor.foreground":"#FFFFFF","editor.background":"#030202","editorLineNumber.foreground":"#858585","editorCursor.foreground":"#FFFFFF","editorIndentGuide.background":"#404040","editorIndentGuide.activeBackground":"#707070"}},s={base:"vs",inherit:!0,rules:[{token:"tag",foreground:"5928ED",fontStyle:"bold"},{token:"attribute.name",foreground:"AF00DB"},{token:"attribute.value",foreground:"008000"},{token:"variable",foreground:"B000B0"},{token:"delimiter",foreground:"808080"},{token:"white",foreground:"000000"}],colors:{"editor.foreground":"#000000","editor.background":"#FFFFFF","editorLineNumber.foreground":"#999999","editorCursor.foreground":"#000000","editorIndentGuide.background":"#CCCCCC","editorIndentGuide.activeBackground":"#999999"}},d=({content:n,selectedTag:i,highlightVariable:d,highlightNonce:u,isDarkMode:g,height:c=250,fontSize:h=12})=>{const m=r.useRef(),f=r.useRef(),p=r.useRef([]);return r.useEffect(()=>{if(!i||!m.current||!f.current)return;const e=m.current,r=e.getModel();if(!r)return;const t=r.getValue().split("\n");let n=-1;for(let e=0;e<t.length;e++){const r=t[e].match(/<([^\s>\/]+(?:\s[^\s>\/]+)*)/);if(r&&r[1].trim().toLowerCase()===i.toLowerCase()){n=e+1;break}}if(n>0){let r=n;const o=`</${i.toLowerCase()}>`;for(let e=n;e<t.length;e++)if(t[e].toLowerCase().includes(o)){r=e+1;break}e.setSelection(new f.current.Selection(n,1,n,1)),e.trigger(null,"editor.unfold",{}),e.revealLineInCenterIfOutsideViewport(n);const a=e.deltaDecorations([],[{range:new f.current.Range(n,1,r,t[r-1].length+1),options:{isWholeLine:!0,className:"promptemon-viewer-highlight",inlineClassName:"promptemon-viewer-highlight"}}]);setTimeout(()=>e.deltaDecorations(a,[]),2e3)}},[i,n]),r.useEffect(()=>{if(!d||!m.current||!f.current)return;const e=m.current,r=e.getModel();if(!r)return;const t=r.getValue(),n=e=>o.buildNormalizedMap(e).normalized,i=Array.isArray(d)?d:[d],a=[];for(const e of i){if(!e)continue;const r=n(e);if(!r)continue;const i=[],l=t.indexOf(e);if(-1!==l){const r=t.slice(0,l),n=r.split("\n").length,o=-1===r.lastIndexOf("\n")?l+1:l-r.lastIndexOf("\n"),a=e.split("\n"),s=n+a.length-1,d=1===a.length?o+e.length:a[a.length-1].length+1;i.push(new f.current.Range(n,o,s,d))}if(0===i.length){const{normalized:e,map:n}=o.buildNormalizedMap(t),a=e.indexOf(r);if(-1!==a&&n.length>0){const e=n[a],o=n[Math.min(a+r.length-1,n.length-1)]+1,l=t.slice(0,e),s=l.split("\n").length,d=-1===l.lastIndexOf("\n")?e+1:e-l.lastIndexOf("\n"),u=t.slice(0,o),g=u.split("\n").length,c=-1===u.lastIndexOf("\n")?o+1:o-u.lastIndexOf("\n");i.push(new f.current.Range(s,d,g,c))}}if(0===i.length){const r=e.split("\n").map(e=>n(e)).filter(e=>e.length>10);let o={line:-1,score:0};const a=t.split("\n");if(a.forEach((e,t)=>{const i=n(e);if(!i)return;let a=0;r.forEach(e=>{i.includes(e)&&(a=Math.max(a,e.length/i.length))}),a>o.score&&(o={line:t,score:a})}),o.score>=.5){const e=a[o.line];i.push(new f.current.Range(o.line+1,1,o.line+1,e.length+1))}}a.push(...i)}0!==a.length&&(e.revealLineInCenterIfOutsideViewport(a[0].startLineNumber),p.current=e.deltaDecorations(p.current,a.map(e=>({range:e,options:{inlineClassName:g?"promptemon-viewer-variable-highlight-dark":"promptemon-viewer-variable-highlight"}}))))},[d,u,n,g]),r.useEffect(()=>{f.current&&f.current.editor.setTheme(g?"promptemonViewerDark":"promptemonViewerLight")},[g]),e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"\n .promptemon-viewer-highlight { background-color: rgba(89, 40, 237, 0.15); }\n .promptemon-viewer-variable-highlight { background-color: rgba(173, 214, 255); border-radius: 2px; }\n.promptemon-viewer-variable-highlight-dark { background-color: rgba(38, 79, 120, 0.55); border-radius: 2px; }\n "}),e.jsxs(t.Box,{sx:{width:"100%",height:c,display:"flex",flexDirection:"column"},children:[e.jsx(t.Box,{sx:{width:"100%",height:20,bgcolor:g?"#030202":"#fff",borderTopLeftRadius:8,borderTopRightRadius:8}}),e.jsx(t.Box,{sx:{flex:1,minHeight:0,overflow:"hidden"},children:e.jsx(a.default,{onMount:(e,r)=>{m.current=e,f.current=r,r.editor.defineTheme("promptemonViewerDark",l),r.editor.defineTheme("promptemonViewerLight",s),r.editor.setTheme(g?"promptemonViewerDark":"promptemonViewerLight"),r.languages.register({id:"promptemonViewerLang"}),r.languages.setMonarchTokensProvider("promptemonViewerLang",{tokenizer:{root:[[/(<)([a-zA-Z0-9\-]+)(\s*)/,["delimiter","tag","white"],"@tagBody"],[/(<\/)([a-zA-Z0-9\-]+)(\s*)(>)/,["delimiter","tag","white","delimiter"]],[/{{[^}]+}}/,"variable"]],tagBody:[[/[a-zA-Z0-9\:\-]+(?=\=)/,"attribute.name"],[/=/,"delimiter"],[/(".*?"|'.*?')/,"attribute.value"],[/\s+/,"white"],[/(\/?>)/,{token:"delimiter",next:"@pop"}]]}}),r.languages.registerFoldingRangeProvider("promptemonViewerLang",{provideFoldingRanges:e=>{const r=e.getLinesContent(),t=[],n=[];return r.forEach((e,r)=>{const o=r+1,i=e.match(/<([a-zA-Z0-9\-]+)(\s[^>]*)?>/),a=e.match(/<\/([a-zA-Z0-9\-]+)>/);if(i&&!e.includes("/>")&&n.push({tag:i[1],start:o}),a){const e=a[1];for(let r=n.length-1;r>=0;r--)if(n[r].tag===e){t.push({start:n[r].start,end:o}),n.splice(r,1);break}}}),t}})},beforeMount:e=>{e.editor.defineTheme("promptemonViewerDark",l),e.editor.defineTheme("promptemonViewerLight",s),e.editor.setTheme(g?"promptemonViewerDark":"promptemonViewerLight")},theme:g?"promptemonViewerDark":"promptemonViewerLight",value:n,language:"promptemonViewerLang",onChange:()=>{},options:{fontSize:h,minimap:{enabled:!1},wordWrap:"on",lineNumbers:"on",readOnly:!0,domReadOnly:!0,scrollBeyondLastLine:!1,padding:{top:4,bottom:12},folding:!0,automaticLayout:!0,scrollbar:{vertical:"visible",horizontal:"visible",verticalScrollbarSize:8}}})}),e.jsx(t.Box,{sx:{width:"100%",height:20,bgcolor:g?"#030202":"#fff",borderBottomLeftRadius:8,borderBottomRightRadius:8}})]})]})};exports.InternalEditor=d,exports.default=d;
|
|
2
2
|
//# sourceMappingURL=Internaleditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Internaleditor.js","sources":["../../../../src/features/SPBAnalysisPanel/Internaleditor.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { Box } from \"@mui/material\";\nimport Editor, { OnMount, Monaco } from \"@monaco-editor/react\";\nimport type * as monaco from \"monaco-editor\";\n\n// ─── NOTE ────────────────────────────────────────────────────────────────────\n// Extracted verbatim from PromptemonViewer.tsx's local `InternalEditor` so it can\n// be shared between PromptemonViewer (FPB) and SPBAnalysisPanel (SPB) without\n// duplicating the Monaco tokenizer/theme/highlight logic. If you already have\n// InternalEditor living inline in PromptemonViewer.tsx, delete that local copy\n// and import from here instead — the props are unchanged.\n\nconst DARK_THEME = {\n base: \"vs-dark\" as const,\n inherit: true,\n rules: [\n { token: \"tag\", foreground: \"714be3\", fontStyle: \"bold\" },\n { token: \"attribute.name\", foreground: \"87CEFA\" },\n { token: \"attribute.value\", foreground: \"98FB98\" },\n { token: \"variable\", foreground: \"00FFFF\" },\n { token: \"delimiter\", foreground: \"888888\" },\n { token: \"white\", foreground: \"AAAAAA\" },\n ],\n colors: {\n \"editor.foreground\": \"#FFFFFF\",\n \"editor.background\": \"#030202\",\n \"editorLineNumber.foreground\": \"#858585\",\n \"editorCursor.foreground\": \"#FFFFFF\",\n \"editorIndentGuide.background\": \"#404040\",\n \"editorIndentGuide.activeBackground\": \"#707070\",\n },\n};\n\nconst LIGHT_THEME = {\n base: \"vs\" as const,\n inherit: true,\n rules: [\n { token: \"tag\", foreground: \"5928ED\", fontStyle: \"bold\" },\n { token: \"attribute.name\", foreground: \"AF00DB\" },\n { token: \"attribute.value\", foreground: \"008000\" },\n { token: \"variable\", foreground: \"B000B0\" },\n { token: \"delimiter\", foreground: \"808080\" },\n { token: \"white\", foreground: \"000000\" },\n ],\n colors: {\n \"editor.foreground\": \"#000000\",\n \"editor.background\": \"#FFFFFF\",\n \"editorLineNumber.foreground\": \"#999999\",\n \"editorCursor.foreground\": \"#000000\",\n \"editorIndentGuide.background\": \"#CCCCCC\",\n \"editorIndentGuide.activeBackground\": \"#999999\",\n },\n};\n\nexport interface InternalEditorProps {\n content: string;\n selectedTag?: string;\n highlightVariable?: string;\n isDarkMode: boolean;\n height?: number | string;\n fontSize?: number;\n}\n\nexport const InternalEditor = ({\n content,\n selectedTag,\n highlightVariable,\n isDarkMode,\n height = 250,\n fontSize = 12,\n}: InternalEditorProps) => {\n const editorRef = useRef<monaco.editor.IStandaloneCodeEditor>();\n const monacoRef = useRef<Monaco>();\n const decorationIdsRef = useRef<string[]>([]);\n\n const handleBeforeMount = (monacoInstance: Monaco) => {\n // @ts-ignore\n monacoInstance.editor.defineTheme(\"promptemonViewerDark\", DARK_THEME);\n // @ts-ignore\n monacoInstance.editor.defineTheme(\"promptemonViewerLight\", LIGHT_THEME);\n monacoInstance.editor.setTheme(isDarkMode ? \"promptemonViewerDark\" : \"promptemonViewerLight\");\n };\n\n const handleEditorMount: OnMount = (editor, monacoInstance) => {\n editorRef.current = editor;\n monacoRef.current = monacoInstance;\n\n // @ts-ignore\n monacoInstance.editor.defineTheme(\"promptemonViewerDark\", DARK_THEME);\n // @ts-ignore\n monacoInstance.editor.defineTheme(\"promptemonViewerLight\", LIGHT_THEME);\n monacoInstance.editor.setTheme(isDarkMode ? \"promptemonViewerDark\" : \"promptemonViewerLight\");\n\n monacoInstance.languages.register({ id: \"promptemonViewerLang\" });\n monacoInstance.languages.setMonarchTokensProvider(\"promptemonViewerLang\", {\n tokenizer: {\n root: [\n [/(<)([a-zA-Z0-9\\-]+)(\\s*)/, [\"delimiter\", \"tag\", \"white\"], \"@tagBody\"],\n [/(<\\/)([a-zA-Z0-9\\-]+)(\\s*)(>)/, [\"delimiter\", \"tag\", \"white\", \"delimiter\"]],\n [/{{[^}]+}}/, \"variable\"],\n ],\n tagBody: [\n [/[a-zA-Z0-9\\:\\-]+(?=\\=)/, \"attribute.name\"],\n [/=/, \"delimiter\"],\n [/(\".*?\"|'.*?')/, \"attribute.value\"],\n [/\\s+/, \"white\"],\n [/(\\/?>)/, { token: \"delimiter\", next: \"@pop\" }],\n ],\n },\n });\n\n monacoInstance.languages.registerFoldingRangeProvider(\"promptemonViewerLang\", {\n provideFoldingRanges: (model) => {\n const lines = model.getLinesContent();\n const foldingRanges: any[] = [];\n const stack: { tag: string; start: number }[] = [];\n lines.forEach((line, index) => {\n const lineNumber = index + 1;\n const openTagMatch = line.match(/<([a-zA-Z0-9\\-]+)(\\s[^>]*)?>/);\n const closeTagMatch = line.match(/<\\/([a-zA-Z0-9\\-]+)>/);\n if (openTagMatch && !line.includes(\"/>\")) {\n stack.push({ tag: openTagMatch[1], start: lineNumber });\n }\n if (closeTagMatch) {\n const tag = closeTagMatch[1];\n for (let i = stack.length - 1; i >= 0; i--) {\n if (stack[i].tag === tag) {\n foldingRanges.push({ start: stack[i].start, end: lineNumber });\n stack.splice(i, 1);\n break;\n }\n }\n }\n });\n return foldingRanges;\n },\n });\n };\n\n useEffect(() => {\n if (!selectedTag || !editorRef.current || !monacoRef.current) return;\n const editor = editorRef.current;\n const model = editor.getModel();\n if (!model) return;\n const lines = model.getValue().split(\"\\n\");\n let targetLine = -1;\n for (let i = 0; i < lines.length; i++) {\n const tagMatch = lines[i].match(/<([^\\s>\\/]+(?:\\s[^\\s>\\/]+)*)/);\n if (tagMatch && tagMatch[1].trim().toLowerCase() === selectedTag.toLowerCase()) {\n targetLine = i + 1;\n break;\n }\n }\n if (targetLine > 0) {\n let closingLine = targetLine;\n const closingTagLower = `</${selectedTag.toLowerCase()}>`;\n for (let i = targetLine; i < lines.length; i++) {\n if (lines[i].toLowerCase().includes(closingTagLower)) {\n closingLine = i + 1;\n break;\n }\n }\n editor.setSelection(new monacoRef.current.Selection(targetLine, 1, targetLine, 1));\n editor.trigger(null, \"editor.unfold\", {});\n editor.revealLineInCenterIfOutsideViewport(targetLine);\n const decorations = editor.deltaDecorations([], [{\n range: new monacoRef.current.Range(targetLine, 1, closingLine, lines[closingLine - 1].length + 1),\n options: { isWholeLine: true, className: \"promptemon-viewer-highlight\", inlineClassName: \"promptemon-viewer-highlight\" },\n }]);\n setTimeout(() => editor.deltaDecorations(decorations, []), 2000);\n }\n }, [selectedTag,content]);\n\n useEffect(() => {\n if (!highlightVariable || !editorRef.current || !monacoRef.current) {\n return;\n }\n\n const editor = editorRef.current;\n const model = editor.getModel();\n\n if (!model) return;\n\n const content = model.getValue();\n\n const normalize = (value: string) =>\n value\n .replace(/\\r\\n/g, \"\\n\")\n .replace(/\\\\([<>])/g, \"$1\")\n .replace(/\\*\\*/g, \"\")\n .replace(/\\s+/g, \" \")\n .trim()\n .toLowerCase();\n\n const target = normalize(highlightVariable);\n\n if (!target) return;\n\n const ranges: monaco.Range[] = [];\n\n // --------------------------------------------------\n // 1. Exact match\n // --------------------------------------------------\n\n const exactIndex = content.indexOf(highlightVariable);\n\n if (exactIndex !== -1) {\n const before = content.slice(0, exactIndex);\n\n const startLine = before.split(\"\\n\").length;\n const startColumn =\n before.lastIndexOf(\"\\n\") === -1\n ? exactIndex + 1\n : exactIndex - before.lastIndexOf(\"\\n\");\n\n const matchedText = highlightVariable;\n const matchLines = matchedText.split(\"\\n\");\n\n const endLine = startLine + matchLines.length - 1;\n\n const endColumn =\n matchLines.length === 1\n ? startColumn + matchedText.length\n : matchLines[matchLines.length - 1].length + 1;\n\n ranges.push(\n new monacoRef.current.Range(\n startLine,\n startColumn,\n endLine,\n endColumn\n )\n );\n }\n\n // --------------------------------------------------\n // 2. Normalized multiline match\n // --------------------------------------------------\n\n if (ranges.length === 0) {\n const normalizedContent = normalize(content);\n\n const normalizedIndex = normalizedContent.indexOf(target);\n\n if (normalizedIndex !== -1) {\n const lines = content.split(\"\\n\");\n\n let accumulated = 0;\n\n for (let i = 0; i < lines.length; i++) {\n const normalizedLine = normalize(lines[i]);\n\n if (!normalizedLine) {\n accumulated += 1;\n continue;\n }\n\n const lineStart = accumulated;\n const lineEnd =\n accumulated + normalizedLine.length;\n\n if (\n normalizedIndex < lineEnd &&\n normalizedIndex + target.length > lineStart\n ) {\n ranges.push(\n new monacoRef.current.Range(\n i + 1,\n 1,\n i + 1,\n lines[i].length + 1\n )\n );\n\n break;\n }\n\n accumulated += normalizedLine.length + 1;\n }\n }\n }\n\n // --------------------------------------------------\n // 3. Safe string fallback\n // --------------------------------------------------\n\n if (ranges.length === 0) {\n const targetLines = highlightVariable\n .split(\"\\n\")\n .map((line) => normalize(line))\n .filter((line) => line.length > 10);\n\n let bestMatch = {\n line: -1,\n score: 0,\n };\n\n const lines = content.split(\"\\n\");\n\n lines.forEach((line, index) => {\n const normalizedLine = normalize(line);\n\n if (!normalizedLine) return;\n\n let score = 0;\n\n targetLines.forEach((targetLine) => {\n if (normalizedLine.includes(targetLine)) {\n score = Math.max(\n score,\n targetLine.length / normalizedLine.length\n );\n }\n });\n\n if (score > bestMatch.score) {\n bestMatch = {\n line: index,\n score,\n };\n }\n });\n\n // Only accept a reasonably strong match.\n if (bestMatch.score >= 0.5) {\n const line = lines[bestMatch.line];\n\n ranges.push(\n new monacoRef.current.Range(\n bestMatch.line + 1,\n 1,\n bestMatch.line + 1,\n line.length + 1\n )\n );\n }\n }\n\n // --------------------------------------------------\n // No reliable match\n // --------------------------------------------------\n\n if (ranges.length === 0) {\n return;\n }\n\n editor.revealLineInCenterIfOutsideViewport(\n ranges[0].startLineNumber\n );\n\n decorationIdsRef.current = editor.deltaDecorations(\n decorationIdsRef.current,\n ranges.map((range) => ({\n range,\n options: {\n inlineClassName: \"promptemon-viewer-variable-highlight\",\n },\n }))\n );\n\n const timeout = setTimeout(() => {\n if (editorRef.current) {\n decorationIdsRef.current = editorRef.current.deltaDecorations(\n decorationIdsRef.current,\n []\n );\n }\n }, 2000);\n\n return () => clearTimeout(timeout);\n }, [highlightVariable, content]);\n\n useEffect(() => {\n if (!monacoRef.current) return;\n monacoRef.current.editor.setTheme(isDarkMode ? \"promptemonViewerDark\" : \"promptemonViewerLight\");\n }, [isDarkMode]);\n\n return (\n <>\n <style>{`\n .promptemon-viewer-highlight { background-color: rgba(89, 40, 237, 0.15); }\n .promptemon-viewer-variable-highlight { background-color: rgba(0, 255, 255, 0.2); border-radius: 2px; }\n `}</style>\n <Box sx={{ width: \"100%\", height, display: \"flex\", flexDirection: \"column\" }}>\n <Box sx={{ width: \"100%\", height: 20, bgcolor: isDarkMode ? \"#030202\" : \"#fff\", borderTopLeftRadius: 8, borderTopRightRadius: 8 }} />\n <Box sx={{ flex: 1, minHeight: 0, overflow: \"hidden\" }}>\n <Editor\n onMount={handleEditorMount}\n beforeMount={handleBeforeMount}\n theme={isDarkMode ? \"promptemonViewerDark\" : \"promptemonViewerLight\"}\n value={content}\n language=\"promptemonViewerLang\"\n onChange={() => {}}\n options={{\n fontSize,\n minimap: { enabled: false },\n wordWrap: \"on\",\n lineNumbers: \"on\",\n readOnly: true,\n domReadOnly: true,\n scrollBeyondLastLine: false,\n padding: { top: 4, bottom: 12 },\n folding: true,\n automaticLayout: true,\n scrollbar: { vertical: \"visible\", horizontal: \"visible\", verticalScrollbarSize: 8 },\n }}\n />\n </Box>\n <Box sx={{ width: \"100%\", height: 20, bgcolor: isDarkMode ? \"#030202\" : \"#fff\", borderBottomLeftRadius: 8, borderBottomRightRadius: 8 }} />\n </Box>\n </>\n );\n};\n\nexport default InternalEditor;"],"names":["DARK_THEME","base","inherit","rules","token","foreground","fontStyle","colors","LIGHT_THEME","InternalEditor","content","selectedTag","highlightVariable","isDarkMode","height","fontSize","editorRef","useRef","monacoRef","decorationIdsRef","useEffect","current","editor","model","getModel","lines","getValue","split","targetLine","i","length","tagMatch","match","trim","toLowerCase","closingLine","closingTagLower","includes","setSelection","Selection","trigger","revealLineInCenterIfOutsideViewport","decorations","deltaDecorations","range","Range","options","isWholeLine","className","inlineClassName","setTimeout","normalize","value","replace","target","ranges","exactIndex","indexOf","before","slice","startLine","startColumn","lastIndexOf","matchedText","matchLines","endLine","endColumn","push","normalizedIndex","accumulated","normalizedLine","lineStart","targetLines","map","line","filter","bestMatch","score","forEach","index","Math","max","startLineNumber","timeout","clearTimeout","setTheme","jsxs","Fragment","children","jsx","Box","sx","width","display","flexDirection","bgcolor","borderTopLeftRadius","borderTopRightRadius","flex","minHeight","overflow","Editor","onMount","monacoInstance","defineTheme","languages","register","id","setMonarchTokensProvider","tokenizer","root","tagBody","next","registerFoldingRangeProvider","provideFoldingRanges","getLinesContent","foldingRanges","stack","lineNumber","openTagMatch","closeTagMatch","tag","start","end","splice","beforeMount","theme","language","onChange","minimap","enabled","wordWrap","lineNumbers","readOnly","domReadOnly","scrollBeyondLastLine","padding","top","bottom","folding","automaticLayout","scrollbar","vertical","horizontal","verticalScrollbarSize","borderBottomLeftRadius","borderBottomRightRadius"],"mappings":"sQAYA,MAAMA,EAAa,CACfC,KAAM,UACNC,SAAS,EACTC,MAAO,CACH,CAAEC,MAAO,MAAOC,WAAY,SAAUC,UAAW,QACjD,CAAEF,MAAO,iBAAkBC,WAAY,UACvC,CAAED,MAAO,kBAAmBC,WAAY,UACxC,CAAED,MAAO,WAAYC,WAAY,UACjC,CAAED,MAAO,YAAaC,WAAY,UAClC,CAAED,MAAO,QAASC,WAAY,WAElCE,OAAQ,CACJ,oBAAqB,UACrB,oBAAqB,UACrB,8BAA+B,UAC/B,0BAA2B,UAC3B,+BAAgC,UAChC,qCAAsC,YAIxCC,EAAc,CAChBP,KAAM,KACNC,SAAS,EACTC,MAAO,CACH,CAAEC,MAAO,MAAOC,WAAY,SAAUC,UAAW,QACjD,CAAEF,MAAO,iBAAkBC,WAAY,UACvC,CAAED,MAAO,kBAAmBC,WAAY,UACxC,CAAED,MAAO,WAAYC,WAAY,UACjC,CAAED,MAAO,YAAaC,WAAY,UAClC,CAAED,MAAO,QAASC,WAAY,WAElCE,OAAQ,CACJ,oBAAqB,UACrB,oBAAqB,UACrB,8BAA+B,UAC/B,0BAA2B,UAC3B,+BAAgC,UAChC,qCAAsC,YAajCE,EAAiB,EAC1BC,UACAC,cACAC,oBACAC,aACAC,SAAS,IACTC,WAAW,OAEX,MAAMC,EAAYC,EAAAA,SACZC,EAAYD,EAAAA,SACZE,EAAmBF,SAAiB,IAgT1C,OA9OAG,EAAAA,UAAU,KACN,IAAKT,IAAgBK,EAAUK,UAAYH,EAAUG,QAAS,OAC9D,MAAMC,EAASN,EAAUK,QACnBE,EAAQD,EAAOE,WACrB,IAAKD,EAAO,OACZ,MAAME,EAAQF,EAAMG,WAAWC,MAAM,MACrC,IAAIC,GAAa,EACjB,IAAA,IAASC,EAAI,EAAGA,EAAIJ,EAAMK,OAAQD,IAAK,CACnC,MAAME,EAAWN,EAAMI,GAAGG,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ChB,KACJ,CAER,IAEGuF,MA8PCS,YAzTOtB,IAERA,EAAAjF,OAAOkF,YAAY,uBAAwBxG,GAE3CuG,EAAAjF,OAAOkF,YAAY,wBAAyBhG,GAC3D+F,EAAejF,OAAO+D,SAASxE,EAAa,uBAAyB,0BAqTrDiH,MAAOjH,EAAa,uBAAyB,wBAC7CuC,MAAO1C,EACPqH,SAAS,uBACTC,SAAU,OACVlF,QAAS,CACL/B,WACAkH,QAAS,CAAEC,SAAS,GACpBC,SAAU,KACVC,YAAa,KACbC,UAAU,EACVC,aAAa,EACbC,sBAAsB,EACtBC,QAAS,CAAEC,IAAK,EAAGC,OAAQ,IAC3BC,SAAS,EACTC,iBAAiB,EACjBC,UAAW,CAAEC,SAAU,UAAWC,WAAY,UAAWC,sBAAuB,cAI3FtD,EAAIA,IAAA,CAAAC,GAAI,CAAEC,MAAO,OAAQ9E,OAAQ,GAAIiF,QAASlF,EAAa,UAAY,OAAQoI,uBAAwB,EAAGC,wBAAyB"}
|
|
1
|
+
{"version":3,"file":"Internaleditor.js","sources":["../../../../src/features/SPBAnalysisPanel/Internaleditor.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { Box } from \"@mui/material\";\nimport Editor, { OnMount, Monaco } from \"@monaco-editor/react\";\nimport type * as monaco from \"monaco-editor\";\nimport { buildNormalizedMap } from '../../utils/helper'\n\n// ─── NOTE ────────────────────────────────────────────────────────────────────\n// Extracted verbatim from PromptemonViewer.tsx's local `InternalEditor` so it can\n// be shared between PromptemonViewer (FPB) and SPBAnalysisPanel (SPB) without\n// duplicating the Monaco tokenizer/theme/highlight logic. If you already have\n// InternalEditor living inline in PromptemonViewer.tsx, delete that local copy\n// and import from here instead — the props are unchanged.\n\nconst DARK_THEME = {\n base: \"vs-dark\" as const,\n inherit: true,\n rules: [\n { token: \"tag\", foreground: \"714be3\", fontStyle: \"bold\" },\n { token: \"attribute.name\", foreground: \"87CEFA\" },\n { token: \"attribute.value\", foreground: \"98FB98\" },\n { token: \"variable\", foreground: \"00FFFF\" },\n { token: \"delimiter\", foreground: \"888888\" },\n { token: \"white\", foreground: \"AAAAAA\" },\n ],\n colors: {\n \"editor.foreground\": \"#FFFFFF\",\n \"editor.background\": \"#030202\",\n \"editorLineNumber.foreground\": \"#858585\",\n \"editorCursor.foreground\": \"#FFFFFF\",\n \"editorIndentGuide.background\": \"#404040\",\n \"editorIndentGuide.activeBackground\": \"#707070\",\n },\n};\n\nconst LIGHT_THEME = {\n base: \"vs\" as const,\n inherit: true,\n rules: [\n { token: \"tag\", foreground: \"5928ED\", fontStyle: \"bold\" },\n { token: \"attribute.name\", foreground: \"AF00DB\" },\n { token: \"attribute.value\", foreground: \"008000\" },\n { token: \"variable\", foreground: \"B000B0\" },\n { token: \"delimiter\", foreground: \"808080\" },\n { token: \"white\", foreground: \"000000\" },\n ],\n colors: {\n \"editor.foreground\": \"#000000\",\n \"editor.background\": \"#FFFFFF\",\n \"editorLineNumber.foreground\": \"#999999\",\n \"editorCursor.foreground\": \"#000000\",\n \"editorIndentGuide.background\": \"#CCCCCC\",\n \"editorIndentGuide.activeBackground\": \"#999999\",\n },\n};\n\nexport interface InternalEditorProps {\n content: string;\n selectedTag?: string;\n highlightVariable?: string | string[]; // CHANGED: now accepts array of segments\n highlightNonce?: number;\n\n isDarkMode: boolean;\n height?: number | string;\n fontSize?: number;\n}\n\nexport const InternalEditor = ({\n content,\n selectedTag,\n highlightVariable,\n highlightNonce,\n isDarkMode,\n height = 250,\n fontSize = 12,\n}: InternalEditorProps) => {\n const editorRef = useRef<monaco.editor.IStandaloneCodeEditor>();\n const monacoRef = useRef<Monaco>();\n const decorationIdsRef = useRef<string[]>([]);\n\n const handleBeforeMount = (monacoInstance: Monaco) => {\n // @ts-ignore\n monacoInstance.editor.defineTheme(\"promptemonViewerDark\", DARK_THEME);\n // @ts-ignore\n monacoInstance.editor.defineTheme(\"promptemonViewerLight\", LIGHT_THEME);\n monacoInstance.editor.setTheme(isDarkMode ? \"promptemonViewerDark\" : \"promptemonViewerLight\");\n };\n\n const handleEditorMount: OnMount = (editor, monacoInstance) => {\n editorRef.current = editor;\n monacoRef.current = monacoInstance;\n\n // @ts-ignore\n monacoInstance.editor.defineTheme(\"promptemonViewerDark\", DARK_THEME);\n // @ts-ignore\n monacoInstance.editor.defineTheme(\"promptemonViewerLight\", LIGHT_THEME);\n monacoInstance.editor.setTheme(isDarkMode ? \"promptemonViewerDark\" : \"promptemonViewerLight\");\n\n monacoInstance.languages.register({ id: \"promptemonViewerLang\" });\n monacoInstance.languages.setMonarchTokensProvider(\"promptemonViewerLang\", {\n tokenizer: {\n root: [\n [/(<)([a-zA-Z0-9\\-]+)(\\s*)/, [\"delimiter\", \"tag\", \"white\"], \"@tagBody\"],\n [/(<\\/)([a-zA-Z0-9\\-]+)(\\s*)(>)/, [\"delimiter\", \"tag\", \"white\", \"delimiter\"]],\n [/{{[^}]+}}/, \"variable\"],\n ],\n tagBody: [\n [/[a-zA-Z0-9\\:\\-]+(?=\\=)/, \"attribute.name\"],\n [/=/, \"delimiter\"],\n [/(\".*?\"|'.*?')/, \"attribute.value\"],\n [/\\s+/, \"white\"],\n [/(\\/?>)/, { token: \"delimiter\", next: \"@pop\" }],\n ],\n },\n });\n\n monacoInstance.languages.registerFoldingRangeProvider(\"promptemonViewerLang\", {\n provideFoldingRanges: (model) => {\n const lines = model.getLinesContent();\n const foldingRanges: any[] = [];\n const stack: { tag: string; start: number }[] = [];\n lines.forEach((line, index) => {\n const lineNumber = index + 1;\n const openTagMatch = line.match(/<([a-zA-Z0-9\\-]+)(\\s[^>]*)?>/);\n const closeTagMatch = line.match(/<\\/([a-zA-Z0-9\\-]+)>/);\n if (openTagMatch && !line.includes(\"/>\")) {\n stack.push({ tag: openTagMatch[1], start: lineNumber });\n }\n if (closeTagMatch) {\n const tag = closeTagMatch[1];\n for (let i = stack.length - 1; i >= 0; i--) {\n if (stack[i].tag === tag) {\n foldingRanges.push({ start: stack[i].start, end: lineNumber });\n stack.splice(i, 1);\n break;\n }\n }\n }\n });\n return foldingRanges;\n },\n });\n };\n\n useEffect(() => {\n if (!selectedTag || !editorRef.current || !monacoRef.current) return;\n const editor = editorRef.current;\n const model = editor.getModel();\n if (!model) return;\n const lines = model.getValue().split(\"\\n\");\n let targetLine = -1;\n for (let i = 0; i < lines.length; i++) {\n const tagMatch = lines[i].match(/<([^\\s>\\/]+(?:\\s[^\\s>\\/]+)*)/);\n if (tagMatch && tagMatch[1].trim().toLowerCase() === selectedTag.toLowerCase()) {\n targetLine = i + 1;\n break;\n }\n }\n if (targetLine > 0) {\n let closingLine = targetLine;\n const closingTagLower = `</${selectedTag.toLowerCase()}>`;\n for (let i = targetLine; i < lines.length; i++) {\n if (lines[i].toLowerCase().includes(closingTagLower)) {\n closingLine = i + 1;\n break;\n }\n }\n editor.setSelection(new monacoRef.current.Selection(targetLine, 1, targetLine, 1));\n editor.trigger(null, \"editor.unfold\", {});\n editor.revealLineInCenterIfOutsideViewport(targetLine);\n const decorations = editor.deltaDecorations([], [{\n range: new monacoRef.current.Range(targetLine, 1, closingLine, lines[closingLine - 1].length + 1),\n options: { isWholeLine: true, className: \"promptemon-viewer-highlight\", inlineClassName: \"promptemon-viewer-highlight\" },\n }]);\n setTimeout(() => editor.deltaDecorations(decorations, []), 2000);\n }\n }, [selectedTag,content]);\n\n useEffect(() => {\n if (!highlightVariable || !editorRef.current || !monacoRef.current) {\n return;\n }\n\n const editor = editorRef.current;\n const model = editor.getModel();\n if (!model) return;\n\n const content = model.getValue();\n\n const normalize = (value: string) => buildNormalizedMap(value).normalized;\n\n // Normalize input to always be an array of segments to highlight.\n const segments = Array.isArray(highlightVariable) ? highlightVariable : [highlightVariable];\n const allRanges: monaco.Range[] = [];\n\n for (const segment of segments) {\n if (!segment) continue;\n const target = normalize(segment);\n if (!target) continue;\n\n const ranges: monaco.Range[] = [];\n\n // 1. Exact match\n const exactIndex = content.indexOf(segment);\n if (exactIndex !== -1) {\n const before = content.slice(0, exactIndex);\n const startLine = before.split(\"\\n\").length;\n const startColumn =\n before.lastIndexOf(\"\\n\") === -1\n ? exactIndex + 1\n : exactIndex - before.lastIndexOf(\"\\n\");\n\n const matchLines = segment.split(\"\\n\");\n const endLine = startLine + matchLines.length - 1;\n const endColumn =\n matchLines.length === 1\n ? startColumn + segment.length\n : matchLines[matchLines.length - 1].length + 1;\n\n ranges.push(new monacoRef.current.Range(startLine, startColumn, endLine, endColumn));\n }\n\n // 2. Normalized offset-mapped match (no drift)\n if (ranges.length === 0) {\n const { normalized: normalizedContent, map } = buildNormalizedMap(content);\n const normalizedIndex = normalizedContent.indexOf(target);\n\n if (normalizedIndex !== -1 && map.length > 0) {\n const startOffset = map[normalizedIndex];\n const endOffset =\n map[Math.min(normalizedIndex + target.length - 1, map.length - 1)] + 1;\n\n const before = content.slice(0, startOffset);\n const startLine = before.split(\"\\n\").length;\n const startColumn =\n before.lastIndexOf(\"\\n\") === -1\n ? startOffset + 1\n : startOffset - before.lastIndexOf(\"\\n\");\n\n const upToEnd = content.slice(0, endOffset);\n const endLine = upToEnd.split(\"\\n\").length;\n const endColumn =\n upToEnd.lastIndexOf(\"\\n\") === -1\n ? endOffset + 1\n : endOffset - upToEnd.lastIndexOf(\"\\n\");\n\n ranges.push(new monacoRef.current.Range(startLine, startColumn, endLine, endColumn));\n }\n }\n\n // 3. Safe fuzzy fallback\n if (ranges.length === 0) {\n const targetLines = segment\n .split(\"\\n\")\n .map((line) => normalize(line))\n .filter((line) => line.length > 10);\n\n let bestMatch = { line: -1, score: 0 };\n const lines = content.split(\"\\n\");\n\n lines.forEach((line, index) => {\n const normalizedLine = normalize(line);\n if (!normalizedLine) return;\n\n let score = 0;\n targetLines.forEach((targetLine) => {\n if (normalizedLine.includes(targetLine)) {\n score = Math.max(score, targetLine.length / normalizedLine.length);\n }\n });\n\n if (score > bestMatch.score) {\n bestMatch = { line: index, score };\n }\n });\n\n if (bestMatch.score >= 0.5) {\n const line = lines[bestMatch.line];\n ranges.push(\n new monacoRef.current.Range(bestMatch.line + 1, 1, bestMatch.line + 1, line.length + 1)\n );\n }\n }\n\n allRanges.push(...ranges);\n }\n\n if (allRanges.length === 0) return;\n\n editor.revealLineInCenterIfOutsideViewport(allRanges[0].startLineNumber);\n\n decorationIdsRef.current = editor.deltaDecorations(\n decorationIdsRef.current,\n allRanges.map((range) => ({\n range,\n options: {\n inlineClassName: isDarkMode\n ? \"promptemon-viewer-variable-highlight-dark\"\n : \"promptemon-viewer-variable-highlight\",\n },\n }))\n );\n }, [highlightVariable, highlightNonce, content, isDarkMode]);\n\n useEffect(() => {\n if (!monacoRef.current) return;\n monacoRef.current.editor.setTheme(isDarkMode ? \"promptemonViewerDark\" : \"promptemonViewerLight\");\n }, [isDarkMode]);\n\n return (\n <>\n <style>{`\n .promptemon-viewer-highlight { background-color: rgba(89, 40, 237, 0.15); }\n .promptemon-viewer-variable-highlight { background-color: rgba(173, 214, 255); border-radius: 2px; }\n.promptemon-viewer-variable-highlight-dark { background-color: rgba(38, 79, 120, 0.55); border-radius: 2px; }\n `}</style>\n <Box sx={{ width: \"100%\", height, display: \"flex\", flexDirection: \"column\" }}>\n <Box sx={{ width: \"100%\", height: 20, bgcolor: isDarkMode ? \"#030202\" : \"#fff\", borderTopLeftRadius: 8, borderTopRightRadius: 8 }} />\n <Box sx={{ flex: 1, minHeight: 0, overflow: \"hidden\" }}>\n <Editor\n onMount={handleEditorMount}\n beforeMount={handleBeforeMount}\n theme={isDarkMode ? \"promptemonViewerDark\" : \"promptemonViewerLight\"}\n value={content}\n language=\"promptemonViewerLang\"\n onChange={() => {}}\n options={{\n fontSize,\n minimap: { enabled: false },\n wordWrap: \"on\",\n lineNumbers: \"on\",\n readOnly: true,\n domReadOnly: true,\n scrollBeyondLastLine: false,\n padding: { top: 4, bottom: 12 },\n folding: true,\n automaticLayout: true,\n scrollbar: { vertical: \"visible\", horizontal: \"visible\", verticalScrollbarSize: 8 },\n }}\n />\n </Box>\n <Box sx={{ width: \"100%\", height: 20, bgcolor: isDarkMode ? \"#030202\" : \"#fff\", borderBottomLeftRadius: 8, borderBottomRightRadius: 8 }} />\n </Box>\n </>\n );\n};\n\nexport default InternalEditor;"],"names":["DARK_THEME","base","inherit","rules","token","foreground","fontStyle","colors","LIGHT_THEME","InternalEditor","content","selectedTag","highlightVariable","highlightNonce","isDarkMode","height","fontSize","editorRef","useRef","monacoRef","decorationIdsRef","useEffect","current","editor","model","getModel","lines","getValue","split","targetLine","i","length","tagMatch","match","trim","toLowerCase","closingLine","closingTagLower","includes","setSelection","Selection","trigger","revealLineInCenterIfOutsideViewport","decorations","deltaDecorations","range","Range","options","isWholeLine","className","inlineClassName","setTimeout","normalize","value","buildNormalizedMap","normalized","segments","Array","isArray","allRanges","segment","target","ranges","exactIndex","indexOf","before","slice","startLine","startColumn","lastIndexOf","matchLines","endLine","endColumn","push","normalizedContent","map","normalizedIndex","startOffset","endOffset","Math","min","upToEnd","targetLines","line","filter","bestMatch","score","forEach","index","normalizedLine","max","startLineNumber","setTheme","jsxs","Fragment","children","jsx","Box","sx","width","display","flexDirection","bgcolor","borderTopLeftRadius","borderTopRightRadius","flex","minHeight","overflow","Editor","onMount","monacoInstance","defineTheme","languages","register","id","setMonarchTokensProvider","tokenizer","root","tagBody","next","registerFoldingRangeProvider","provideFoldingRanges","getLinesContent","foldingRanges","stack","lineNumber","openTagMatch","closeTagMatch","tag","start","end","splice","beforeMount","theme","language","onChange","minimap","enabled","wordWrap","lineNumbers","readOnly","domReadOnly","scrollBeyondLastLine","padding","top","bottom","folding","automaticLayout","scrollbar","vertical","horizontal","verticalScrollbarSize","borderBottomLeftRadius","borderBottomRightRadius"],"mappings":"6SAaA,MAAMA,EAAa,CACfC,KAAM,UACNC,SAAS,EACTC,MAAO,CACH,CAAEC,MAAO,MAAOC,WAAY,SAAUC,UAAW,QACjD,CAAEF,MAAO,iBAAkBC,WAAY,UACvC,CAAED,MAAO,kBAAmBC,WAAY,UACxC,CAAED,MAAO,WAAYC,WAAY,UACjC,CAAED,M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CuC,MAAO3C,EACP4H,SAAS,uBACTC,SAAU,OACVxF,QAAS,CACL/B,WACAwH,QAAS,CAAEC,SAAS,GACpBC,SAAU,KACVC,YAAa,KACbC,UAAU,EACVC,aAAa,EACbC,sBAAsB,EACtBC,QAAS,CAAEC,IAAK,EAAGC,OAAQ,IAC3BC,SAAS,EACTC,iBAAiB,EACjBC,UAAW,CAAEC,SAAU,UAAWC,WAAY,UAAWC,sBAAuB,cAI3FtD,EAAIA,IAAA,CAAAC,GAAI,CAAEC,MAAO,OAAQpF,OAAQ,GAAIuF,QAASxF,EAAa,UAAY,OAAQ0I,uBAAwB,EAAGC,wBAAyB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),o=require("@mui/material"),t=require("@mui/icons-material/ExpandMore"),r=require("@mui/icons-material/Fullscreen"),n=require("@mui/icons-material/Close"),s=require("@mui/icons-material/NearMeOutlined"),l=require("@mui/icons-material/ChevronLeft"),a=require("@mui/icons-material/ChevronRight"),c=require("./DependencyGraph.js"),d=require("./Markdownrenderer.js"),x=require("./Internaleditor.js"),p=require("@e-llm-studio/prompt-block-tree");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=h(t),u=h(r),g=h(n),m=h(s),y=h(l),j=h(a);const b=({text:t,detailedSummary:r,extraMetaData:n,isDarkMode:s=!1,markdownRendererStyle:l,cognitiveDecisioningStyles:a})=>{const[c,x]=i.useState(!1),{preview:p,truncated:h}=((e,i=220)=>{const o=e.replace(/<!--\s*<ai_reasoning>[\s\S]*?<\/ai_reasoning>\s*-->/g,"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();if(o.length<=i)return{preview:o,truncated:!1};const t=o.slice(0,i),r=t.lastIndexOf(" ");return{preview:(r>0?t.slice(0,r):t).trim(),truncated:!0}})(t);return e.jsx(o.Box,{children:c?e.jsxs(o.Box,{children:[e.jsx(d.MarkdownRenderer,{message:t,fontSize:"0.8rem",extraMetaData:n,isDarkMode:s,cognitiveDecisioningStyles:a,style:l}),r?.trim()&&e.jsx(d.MarkdownRenderer,{message:r,fontSize:"0.8rem",extraMetaData:n,isDarkMode:s,cognitiveDecisioningStyles:a,style:l}),e.jsx(o.Typography,{component:"span",onClick:()=>x(!1),sx:{fontSize:"0.72rem",color:s?"#a78bfa":"#5928ed",fontWeight:600,cursor:"pointer"},children:"view less"})]}):e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(o.Typography,{sx:{fontSize:"0.8rem",color:s?"#cbd5e1":"#4B5563",lineHeight:1.6},children:[p,h&&"…"]}),(h||r?.trim())&&e.jsx(o.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:e.jsx(o.Typography,{component:"span",onClick:()=>x(!0),sx:{fontSize:"0.72rem",color:s?"#a78bfa":"#5928ed",fontWeight:600,cursor:"pointer"},children:"...view more"})})]})})},S=({text:t,extraMetaData:r,cognitiveDecisioningStyles:n})=>{const[s,l]=i.useState(!1),[a,c]=i.useState(!1),x=i.useRef(null);return i.useEffect(()=>{const e=x.current;e&&c(e.scrollWidth>e.clientWidth)},[t]),e.jsx(o.Box,{sx:{pl:1},children:s?e.jsxs(o.Box,{sx:{fontSize:"0.68rem",color:"#9CA3AF",lineHeight:1.4},children:[e.jsx(d.MarkdownRenderer,{message:t,fontSize:"0.68rem",extraMetaData:r,cognitiveDecisioningStyles:n}),e.jsx(o.Typography,{component:"span",onClick:()=>l(!1),sx:{fontSize:"0.65rem",color:"#5928ed",cursor:"pointer",fontWeight:600},children:"view less"})]}):e.jsxs(o.Box,{sx:{display:"flex",alignItems:"baseline",gap:.5},children:[e.jsx(o.Typography,{ref:x,sx:{fontSize:"0.68rem",color:"#9CA3AF",lineHeight:1.4,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",flex:1,minWidth:0},children:t}),a&&e.jsx(o.Typography,{component:"span",onClick:()=>l(!0),sx:{fontSize:"0.65rem",color:"#5928ed",cursor:"pointer",fontWeight:600,flexShrink:0},children:"view more"})]})})};exports.default=({promptContent:t,promptTitle:r,isLoading:n=!1,overviewSummary:s,functionalityOfSPB:l=[],functionalityOfFPB:a,showfunctionalityofFPB:h=!1,spbAdditionalInfo:w,lastAnalyzedAt:v,extraMetaData:B,showCodePanel:D=!0,showInlineApbEditor:k=!0,disableApbNavigation:E=!1,showCollapseStrip:z=!0,showFullscreenButton:A=!0,showFullscreenModal:T=!0,showThemeToggle:M=!0,isDarkMode:R=!0,styles:C,className:F,style:I,sx:W})=>{const[P,H]=i.useState(null),[_,O]=i.useState(null),[L,q]=i.useState(""),[G,N]=i.useState(""),X=void 0!==C?.isDarkMode?C.isDarkMode:R,[Y,$]=i.useState(X),[V,J]=i.useState(null);i.useEffect(()=>{void 0!==C?.isDarkMode&&$(C.isDarkMode)},[C?.isDarkMode]);const[K,Q]=i.useState(!1),[U,Z]=i.useState(480),ee=i.useRef(!1),ie=i.useRef(null);i.useEffect(()=>{var e;v?H(v):l.length>0&&H(`${(e=new Date).toLocaleTimeString("en-IN",{hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0})||""} | ${e.toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"})||""}`)},[l,v]),i.useEffect(()=>{n&&H(null)},[n]),i.useEffect(()=>{V&&(q(""),setTimeout(()=>q(V.ref),500))},[V]);return e.jsxs(o.Box,{className:F,style:{...C?.root,...I},sx:{height:"100%",display:"flex",flexDirection:"column",width:"100%",minHeight:0,overflow:"hidden",...W},children:[e.jsx(o.Box,{sx:{px:2.5,py:1.5,borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#fff",flexShrink:0,...C?.header},children:e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.25},children:[e.jsx(o.Typography,{sx:{fontWeight:700,fontSize:"0.9rem",color:"#111827",...C?.headerTitle},children:r||"SPB Analysis"}),e.jsx(o.Typography,{sx:{fontSize:"0.7rem",color:"#9CA3AF",...C?.headerSubtitle},children:P?`Last Analyzed at ${P}`:""})]})}),e.jsxs(o.Box,{ref:ie,sx:{display:"flex",flex:1,minHeight:0,overflow:"hidden",position:"relative"},children:[e.jsx(o.Box,{sx:{width:D?K&&z?0:U:"100%",flexShrink:0,minHeight:0,overflow:"hidden",transition:ee.current?"none":"width 0.15s",borderRight:!D||K&&z?"none":"1px solid #e5e7eb",...C?.leftPanel},children:e.jsxs(o.Box,{sx:{width:"100%",height:"100%",minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",gap:1,px:1.25,py:1.25,pb:2},children:[e.jsxs(o.Box,{sx:{border:"1px solid #E5E7EB",borderRadius:"8px",bgcolor:"#F8FAFC",p:1.5,...C?.overviewSection},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827",mb:1,...C?.overviewTitle},children:"Overview"}),e.jsx(o.Box,{sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5,...C?.overviewContent},children:s?.overallSummary?.trim()?e.jsx(b,{text:s.overallSummary,detailedSummary:s.detailedSummary,extraMetaData:B,isDarkMode:Y,markdownRendererStyle:C?.markdownRenderer,cognitiveDecisioningStyles:C?.cognitiveDecisioning}):e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"text",width:"100%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"90%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"95%",height:14})]})})]}),e.jsxs(o.Accordion,{disableGutters:!0,elevation:0,sx:{border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff",...C?.functionalitySection},children:[e.jsx(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75}},children:e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827",...C?.functionalityTitle},children:"Functionality of SPB"})}),e.jsx(o.AccordionDetails,{sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"column",gap:1},children:l.length>0?l.map((i,r)=>e.jsxs(o.Accordion,{disableGutters:!0,elevation:0,defaultExpanded:0===r,sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},overflow:"hidden",...C?.functionalityItem},children:[e.jsx(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:38,"& .MuiAccordionSummary-content":{my:.5}},children:e.jsxs(o.Typography,{sx:{fontWeight:600,fontSize:"0.8rem",color:"#111827"},children:[r+1,". ",i.name||i.section_name]})}),e.jsxs(o.AccordionDetails,{sx:{px:1.5,pb:1.5,pt:0,display:"flex",flexDirection:"column",gap:.75},children:[e.jsx(d.MarkdownRenderer,{fontSize:"0.74rem",message:i.description||i.reason_for_inclusion||"",extraMetaData:B,cognitiveDecisioningStyles:C?.cognitiveDecisioning}),e.jsx(o.Typography,{sx:{fontSize:"0.72rem",color:"#9CA3AF",fontWeight:500,mt:.25},children:"APB References"}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.75},children:i.apb_references.map((i,r)=>{const n="string"==typeof i?i:i.apb_name,s=_===n;return e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.15},children:[e.jsxs(o.Box,{onClick:E?void 0:()=>(e=>{_===e?(O(null),q("")):(O(e),q(""),setTimeout(()=>q(e),50))})(n),sx:{display:"flex",alignItems:"center",gap:.25,cursor:E?"default":"pointer"},children:[e.jsxs(o.Typography,{sx:{fontSize:"0.78rem",color:s?"#5928ed":"#DB2877",fontWeight:500},children:[r+1,". ",n]}),!E&&e.jsx(m.default,{sx:{fontSize:"0.75rem",color:s?"#5928ed":"#DB2877"}})]}),"string"!=typeof i&&(i.description||i.context)&&e.jsx(S,{text:i.description||i.context||"",extraMetaData:B,cognitiveDecisioningStyles:C?.cognitiveDecisioning}),k&&s&&e.jsx(o.Box,{sx:{mt:1,height:260,border:"1px solid #e5e7eb",borderRadius:"8px",overflow:"hidden"},children:e.jsx(x.InternalEditor,{content:t,selectedTag:L,isDarkMode:Y,height:"100%",fontSize:12})})]},r)})})]})]},r)):e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[1,2,3].map(i=>e.jsxs(o.Box,{sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5,display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"text",width:"40%",height:16}),e.jsx(o.Skeleton,{variant:"text",width:"90%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"80%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"30%",height:14})]},i))})})]}),h&&e.jsxs(o.Accordion,{disableGutters:!0,elevation:0,sx:{border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff",...C?.fpbSection},children:[e.jsxs(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75,alignItems:"center",gap:1}},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827",...C?.fpbTitle},children:a?.fpbTitle||"Functionality of FPB"}),e.jsx(o.Typography,{sx:{fontSize:"0.7rem",color:"#9CA3AF"}})]}),e.jsx(o.AccordionDetails,{sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC"},children:a?.treeProps?e.jsx(p.PromptBlockTree,{...a.treeProps,onNodeOpen:e=>{const i=e.meta?.rawPrompt;"string"==typeof i&&i.trim()&&N(i),a?.treeProps.onNodeOpen?.(e)}}):e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[1,2,3].map(i=>e.jsxs(o.Box,{sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5,display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"text",width:"40%",height:16}),e.jsx(o.Skeleton,{variant:"text",width:"90%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"80%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"30%",height:14})]},i))})})]}),e.jsxs(o.Accordion,{disableGutters:!0,elevation:0,sx:{border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff",...C?.applicabilitySection},children:[e.jsxs(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75,alignItems:"center",gap:1}},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827",...C?.applicabilityTitle},children:"Applicability"}),e.jsx(o.Typography,{sx:{fontSize:"0.7rem",color:"#9CA3AF"},children:"When to Apply this SPB / When Not Apply"})]}),e.jsx(o.AccordionDetails,{sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC"},children:e.jsx(o.Box,{sx:{display:"flex",gap:1},children:[{label:"When to apply",content:w?.when_to_apply},{label:"When NOT to apply",content:w?.when_not_to_apply}].map(({label:i,content:t})=>e.jsxs(o.Box,{sx:{flex:1,bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"6px",p:1.25},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.76rem",color:"#374151",mb:.75},children:i}),t?e.jsx(d.MarkdownRenderer,{fontSize:"0.8rem",message:t,isDarkMode:Y,style:C?.markdownRenderer,extraMetaData:B,cognitiveDecisioningStyles:C?.cognitiveDecisioning}):n?e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"text",width:"100%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"80%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"90%",height:14})]}):e.jsx(o.Typography,{sx:{fontSize:"0.8rem",color:"#6B7280",lineHeight:1.5},children:"— Not yet available"})]},i))})})]}),e.jsxs(o.Accordion,{disableGutters:!0,elevation:0,sx:{border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff",...C?.specificationsSection},children:[e.jsxs(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75,alignItems:"center",gap:1}},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827",...C?.specificationsTitle},children:"Specifications"}),e.jsx(o.Typography,{sx:{fontSize:"0.7rem",color:"#9CA3AF"},children:"Strict Rules / Input / Output"})]}),e.jsx(o.AccordionDetails,{sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"column",gap:1},children:[{label:"Strict Rules",tooltip:null,content:w?.constraints_and_rules},{label:"Input",tooltip:"Input specification for this SPB",content:w?.input_analysis},{label:"Output",tooltip:"Output specification for this SPB",content:w?.output_analysis}].map(({label:i,tooltip:t,content:r})=>{const s="Output"===i,l=s&&r?(e=>{const i=[];return{text:e.replace(/<code>([\s\S]*?)<\/code>/g,(e,o)=>(i.push(o.trim()),"")).trim(),code:i.join("\n\n")}})(r):null,a=l?l.text:r,c=l?l.code:"";return e.jsxs(o.Accordion,{disableGutters:!0,elevation:0,defaultExpanded:"Strict Rules"===i,sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"6px !important","&:before":{display:"none"},overflow:"hidden"},children:[e.jsx(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem"}}),sx:{minHeight:34,px:1.25,"& .MuiAccordionSummary-content":{my:.4}},children:e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.76rem",color:"#374151"},children:i}),t&&e.jsx(o.Tooltip,{title:t,placement:"top",children:e.jsx(o.Box,{component:"span",sx:{width:13,height:13,borderRadius:"50%",background:"#E5E7EB",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"0.58rem",color:"#6B7280",fontWeight:700,cursor:"default",flexShrink:0},children:"i"})})]})}),e.jsx(o.AccordionDetails,{sx:{px:1.25,pb:1.25,pt:0},children:r?e.jsxs(e.Fragment,{children:[a&&e.jsx(d.MarkdownRenderer,{fontSize:"0.8rem",message:a,isDarkMode:Y,style:C?.markdownRenderer,extraMetaData:B,cognitiveDecisioningStyles:C?.cognitiveDecisioning}),s&&c&&e.jsxs(o.Box,{sx:{width:"100%",height:"35vh",mt:1.5},children:[e.jsxs(o.Box,{sx:{display:"flex",gap:.1,backgroundColor:"black",flexDirection:"row",alignItems:"center",justifyContent:"space-between",p:1,borderTopLeftRadius:"8px",borderTopRightRadius:"8px"},children:[e.jsx(o.Typography,{sx:{color:"white",fontWeight:500,fontSize:"0.8rem"},children:"Output preview"}),e.jsx(o.Tooltip,{title:"Copy Code to clipboard",children:e.jsx(o.IconButton,{size:"small",onClick:()=>{return e=c,navigator.clipboard.writeText(e);var e},children:e.jsx(o.Typography,{sx:{fontSize:"0.7rem",color:"white"},children:"Copy"})})})]}),e.jsx(o.Box,{sx:{mt:-1,height:"calc(100% - 40px)",borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px",overflow:"hidden"},children:e.jsx(x.InternalEditor,{content:c,isDarkMode:Y,height:"100%",fontSize:10})})]})]}):n?e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"text",width:"100%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"90%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"75%",height:14})]}):e.jsx(o.Typography,{sx:{fontSize:"0.74rem",color:"#6B7280",lineHeight:1.5},children:"— Not yet available"})})]},i)})})]}),e.jsxs(o.Accordion,{defaultExpanded:!0,disableGutters:!0,elevation:0,sx:{border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},bgcolor:"#fff",...C?.dependencyGraphSection},children:[e.jsx(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75},"&.Mui-expanded":{bgcolor:"#F8FAFC",borderRadius:"8px 8px 0 0"}},children:e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827",...C?.dependencyGraphTitle},children:"Dependency Graph"})}),e.jsx(o.AccordionDetails,{sx:{px:0,pb:0,pt:0},children:w?.dependency_graph?e.jsxs(o.Box,{sx:{bgcolor:"#F8FAFC",borderRadius:"0 0 8px 8px",p:1.5,display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx(o.Box,{sx:{height:500,borderRadius:"8px",overflow:"hidden"},children:e.jsx(c.default,{data:w.dependency_graph,isDarkMode:Y,style:C?.dependencyGraph})}),e.jsx(o.Typography,{sx:{fontSize:"0.72rem",color:"#64748B",lineHeight:1.6},children:"This graph visualises how Atomic Prompt Blocks (APBs) depend on, influence, or exchange information with one another within the prompt architecture."})]}):e.jsxs(o.Box,{sx:{bgcolor:"#fff",borderRadius:"0 0 8px 8px",p:1.5,display:"flex",flexDirection:"column",gap:1},children:[e.jsx(o.Skeleton,{variant:"rectangular",width:"100%",height:400,sx:{borderRadius:"8px"}}),e.jsx(o.Skeleton,{variant:"text",width:"100%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"80%",height:14})]})})]})]})}),D&&z&&e.jsx(o.Box,{onClick:()=>Q(e=>!e),sx:{width:20,flexShrink:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",borderRight:"1px solid #e5e7eb",borderLeft:"1px solid #e5e7eb",bgcolor:"#f9fafb",position:"relative",py:2,"&:hover":{bgcolor:"#f0f0f0"},...C?.collapseStrip},children:e.jsx(o.Typography,{sx:{fontSize:10,fontWeight:600,color:"#6b7280",writingMode:"vertical-rl",textOrientation:"mixed",transform:"rotate(180deg)",letterSpacing:"0.05em",userSelect:"none"},children:"SPB Details"})}),D&&z&&e.jsx(o.Box,{onClick:()=>Q(e=>!e),onMouseDown:e=>{e.preventDefault(),ee.current=!0;const i=e=>{if(!ee.current||!ie.current)return;const t=ie.current.getBoundingClientRect(),r=t.left,n=t.width,s=e.clientX-r;if(s<200)return Q(!0),ee.current=!1,document.removeEventListener("mousemove",i),void document.removeEventListener("mouseup",o);s>.7*n||(Q(!1),Z(s))},o=()=>{ee.current=!1,document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",o)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",o)},sx:{position:"absolute",left:K?20:U+20,top:"50%",transform:"translateY(-50%)",width:18,height:28,bgcolor:"#fff",border:"1px solid #e5e7eb",borderRadius:"0 6px 6px 0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"col-resize",zIndex:5,boxShadow:"2px 0 4px rgba(0,0,0,0.06)","&:hover":{bgcolor:"#f9fafb"},...C?.dragHandle},children:K?e.jsx(j.default,{sx:{fontSize:12,color:"#6b7280"}}):e.jsx(y.default,{sx:{fontSize:12,color:"#6b7280"}})}),D&&e.jsxs(o.Box,{sx:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden",p:2,gap:1.5,bgcolor:"#f8fafc",...C?.codePanel},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0,...C?.codePanelHeader},children:[e.jsx(o.Typography,{sx:{fontSize:13,fontWeight:600,color:"#374151",...C?.codePanelTitle},children:r||"SPB Analysis"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[M&&e.jsx(o.Switch,{checked:Y,onChange:e=>$(e.target.checked),size:"small",sx:{width:36,height:20,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"2px","&.Mui-checked":{transform:"translateX(16px)",color:"#fff","& + .MuiSwitch-track":{bgcolor:"#5928ed",opacity:1}}},"& .MuiSwitch-thumb":{width:16,height:16,bgcolor:"#fff"},"& .MuiSwitch-track":{borderRadius:10,bgcolor:"#d1d5db",opacity:1}}}),A&&T&&e.jsx(o.Tooltip,{title:"Fullscreen",placement:"top",children:e.jsx(o.IconButton,{size:"small",onClick:()=>J({ref:L||"",description:""}),sx:{color:"#6b7280"},children:e.jsx(u.default,{sx:{fontSize:16}})})})]})]}),e.jsx(o.Box,{sx:{flex:1,minHeight:0,border:"1px solid #30363d",borderRadius:1,overflow:"hidden",...C?.editorContainer},children:e.jsx(x.InternalEditor,{content:t,selectedTag:L,isDarkMode:Y,height:"100%",fontSize:13,highlightVariable:G})})]})]}),T&&e.jsxs(o.Dialog,{open:!!V,onClose:()=>J(null),maxWidth:!1,PaperProps:{sx:{width:"82vw",height:"80vh",maxWidth:"none",borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column",...C?.fullscreenModal}},children:[e.jsxs(o.Box,{sx:{px:2.5,py:1.5,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},children:[e.jsx(o.Typography,{sx:{fontWeight:700,fontSize:"1rem",color:"#111827"},children:"Promptemon"}),e.jsx(o.IconButton,{size:"small",onClick:()=>J(null),children:e.jsx(g.default,{sx:{fontSize:"1.1rem",color:"#6B7280"}})})]}),e.jsxs(o.Box,{sx:{flex:1,display:"flex",overflow:"hidden",minHeight:0},children:[e.jsxs(o.Box,{sx:{width:"40%",flexShrink:0,borderRight:"1px solid #E5E7EB",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs(o.Box,{sx:{px:2,py:1.25,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",gap:1},children:[e.jsx(o.Tooltip,{title:"Atomic Prompt Block",placement:"top",children:e.jsx(o.Chip,{label:"APB",size:"small",sx:{bgcolor:"#f1f5f9",color:"#475569",fontWeight:700,fontSize:10,height:20,borderRadius:1}})}),e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.9rem",color:"#111827"},children:V?.ref})]}),e.jsxs(o.Box,{sx:{flex:1,p:2,display:"flex",flexDirection:"column",gap:1.5,overflowY:"auto"},children:[e.jsxs(o.Box,{sx:{border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.8rem",color:"#111827",mb:.75},children:"Description"}),e.jsx(o.Typography,{sx:{fontSize:"0.73rem",color:"#6B7280",lineHeight:1.6},children:V?.description})]}),e.jsxs(o.Box,{sx:{border:"1px solid #E5E7EB",borderRadius:"8px",p:1.25,display:"flex",alignItems:"center",gap:.5},children:[e.jsx(o.Typography,{sx:{fontSize:"0.73rem",color:"#6B7280"},children:"Total Lines"}),e.jsx(o.Typography,{sx:{fontSize:"0.73rem",fontWeight:700,color:"#111827"},children:t.split("\n").length})]})]})]}),e.jsxs(o.Box,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs(o.Box,{sx:{px:2,py:1.25,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827"},children:"Prompt Preview"}),e.jsx(o.Switch,{checked:Y,onChange:e=>$(e.target.checked),size:"small",sx:{width:36,height:20,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"2px","&.Mui-checked":{transform:"translateX(16px)",color:"#fff","& + .MuiSwitch-track":{bgcolor:"#5928ed",opacity:1}}},"& .MuiSwitch-thumb":{width:16,height:16,bgcolor:"#fff"},"& .MuiSwitch-track":{borderRadius:10,bgcolor:"#d1d5db",opacity:1}}})]}),e.jsx(o.Box,{sx:{flex:1,minHeight:0,p:1.5},children:e.jsx(x.InternalEditor,{content:t,selectedTag:L,isDarkMode:Y,highlightVariable:G,height:"100%",fontSize:13})})]})]})]})]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),o=require("@mui/material"),t=require("@mui/icons-material/ExpandMore"),r=require("@mui/icons-material/Fullscreen"),n=require("@mui/icons-material/Close"),s=require("@mui/icons-material/NearMeOutlined"),l=require("@mui/icons-material/ChevronLeft"),a=require("@mui/icons-material/ChevronRight"),c=require("./DependencyGraph.js"),d=require("./Markdownrenderer.js"),x=require("./Internaleditor.js"),p=require("@e-llm-studio/prompt-block-tree");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=h(t),g=h(r),u=h(n),m=h(s),y=h(l),j=h(a);const b=({text:t,detailedSummary:r,extraMetaData:n,isDarkMode:s=!1,markdownRendererStyle:l,cognitiveDecisioningStyles:a})=>{const[c,x]=i.useState(!1),{preview:p,truncated:h}=((e,i=220)=>{const o=e.replace(/<!--\s*<ai_reasoning>[\s\S]*?<\/ai_reasoning>\s*-->/g,"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();if(o.length<=i)return{preview:o,truncated:!1};const t=o.slice(0,i),r=t.lastIndexOf(" ");return{preview:(r>0?t.slice(0,r):t).trim(),truncated:!0}})(t);return e.jsx(o.Box,{children:c?e.jsxs(o.Box,{children:[e.jsx(d.MarkdownRenderer,{message:t,fontSize:"0.8rem",extraMetaData:n,isDarkMode:s,cognitiveDecisioningStyles:a,style:l}),r?.trim()&&e.jsx(d.MarkdownRenderer,{message:r,fontSize:"0.8rem",extraMetaData:n,isDarkMode:s,cognitiveDecisioningStyles:a,style:l}),e.jsx(o.Typography,{component:"span",onClick:()=>x(!1),sx:{fontSize:"0.72rem",color:s?"#a78bfa":"#5928ed",fontWeight:600,cursor:"pointer"},children:"view less"})]}):e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(o.Typography,{sx:{fontSize:"0.8rem",color:s?"#cbd5e1":"#4B5563",lineHeight:1.6},children:[p,h&&"…"]}),(h||r?.trim())&&e.jsx(o.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:e.jsx(o.Typography,{component:"span",onClick:()=>x(!0),sx:{fontSize:"0.72rem",color:s?"#a78bfa":"#5928ed",fontWeight:600,cursor:"pointer"},children:"...view more"})})]})})},S=({text:t,extraMetaData:r,cognitiveDecisioningStyles:n})=>{const[s,l]=i.useState(!1),[a,c]=i.useState(!1),x=i.useRef(null);return i.useEffect(()=>{const e=x.current;e&&c(e.scrollWidth>e.clientWidth)},[t]),e.jsx(o.Box,{sx:{pl:1},children:s?e.jsxs(o.Box,{sx:{fontSize:"0.68rem",color:"#9CA3AF",lineHeight:1.4},children:[e.jsx(d.MarkdownRenderer,{message:t,fontSize:"0.68rem",extraMetaData:r,cognitiveDecisioningStyles:n}),e.jsx(o.Typography,{component:"span",onClick:()=>l(!1),sx:{fontSize:"0.65rem",color:"#5928ed",cursor:"pointer",fontWeight:600},children:"view less"})]}):e.jsxs(o.Box,{sx:{display:"flex",alignItems:"baseline",gap:.5},children:[e.jsx(o.Typography,{ref:x,sx:{fontSize:"0.68rem",color:"#9CA3AF",lineHeight:1.4,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",flex:1,minWidth:0},children:t}),a&&e.jsx(o.Typography,{component:"span",onClick:()=>l(!0),sx:{fontSize:"0.65rem",color:"#5928ed",cursor:"pointer",fontWeight:600,flexShrink:0},children:"view more"})]})})};exports.default=({promptContent:t,promptTitle:r,isLoading:n=!1,overviewSummary:s,functionalityOfSPB:l=[],functionalityOfFPB:a,showfunctionalityofFPB:h=!1,spbAdditionalInfo:v,lastAnalyzedAt:w,extraMetaData:B,showCodePanel:D=!0,showInlineApbEditor:k=!0,disableApbNavigation:E=!1,showCollapseStrip:z=!0,showFullscreenButton:A=!0,showFullscreenModal:T=!0,showThemeToggle:M=!0,isDarkMode:R=!0,styles:C,className:F,style:I,sx:W})=>{const[P,H]=i.useState(null),[_,O]=i.useState(null),[L,N]=i.useState(""),[q,G]=i.useState(void 0),[X,Y]=i.useState(0),$=void 0!==C?.isDarkMode?C.isDarkMode:R,[V,J]=i.useState($),[K,Q]=i.useState(null);i.useEffect(()=>{void 0!==C?.isDarkMode&&J(C.isDarkMode)},[C?.isDarkMode]);const[U,Z]=i.useState(!1),[ee,ie]=i.useState(480),oe=i.useRef(!1),te=i.useRef(null);i.useEffect(()=>{var e;w?H(w):l.length>0&&H(`${(e=new Date).toLocaleTimeString("en-IN",{hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0})||""} | ${e.toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"})||""}`)},[l,w]),i.useEffect(()=>{n&&H(null)},[n]),i.useEffect(()=>{K&&(N(""),setTimeout(()=>N(K.ref),500))},[K]);return e.jsxs(o.Box,{className:F,style:{...C?.root,...I},sx:{height:"100%",display:"flex",flexDirection:"column",width:"100%",minHeight:0,overflow:"hidden",...W},children:[e.jsx(o.Box,{sx:{px:2.5,py:1.5,borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#fff",flexShrink:0,...C?.header},children:e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.25},children:[e.jsx(o.Typography,{sx:{fontWeight:700,fontSize:"0.9rem",color:"#111827",...C?.headerTitle},children:r||"SPB Analysis"}),e.jsx(o.Typography,{sx:{fontSize:"0.7rem",color:"#9CA3AF",...C?.headerSubtitle},children:P?`Last Analyzed at ${P}`:""})]})}),e.jsxs(o.Box,{ref:te,sx:{display:"flex",flex:1,minHeight:0,overflow:"hidden",position:"relative"},children:[e.jsx(o.Box,{sx:{width:D?U&&z?0:ee:"100%",flexShrink:0,minHeight:0,overflow:"hidden",transition:oe.current?"none":"width 0.15s",borderRight:!D||U&&z?"none":"1px solid #e5e7eb",...C?.leftPanel},children:e.jsxs(o.Box,{sx:{width:"100%",height:"100%",minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",gap:1,px:1.25,py:1.25,pb:2},children:[e.jsxs(o.Box,{sx:{border:"1px solid #E5E7EB",borderRadius:"8px",bgcolor:"#F8FAFC",p:1.5,...C?.overviewSection},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827",mb:1,...C?.overviewTitle},children:"Overview"}),e.jsx(o.Box,{sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5,...C?.overviewContent},children:s?.overallSummary?.trim()?e.jsx(b,{text:s.overallSummary,detailedSummary:s.detailedSummary,extraMetaData:B,isDarkMode:V,markdownRendererStyle:C?.markdownRenderer,cognitiveDecisioningStyles:C?.cognitiveDecisioning}):e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"text",width:"100%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"90%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"95%",height:14})]})})]}),e.jsxs(o.Accordion,{disableGutters:!0,elevation:0,sx:{border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff",...C?.functionalitySection},children:[e.jsx(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75}},children:e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827",...C?.functionalityTitle},children:"Functionality of SPB"})}),e.jsx(o.AccordionDetails,{sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"column",gap:1},children:l.length>0?l.map((i,r)=>e.jsxs(o.Accordion,{disableGutters:!0,elevation:0,defaultExpanded:0===r,sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},overflow:"hidden",...C?.functionalityItem},children:[e.jsx(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:38,"& .MuiAccordionSummary-content":{my:.5}},children:e.jsxs(o.Typography,{sx:{fontWeight:600,fontSize:"0.8rem",color:"#111827"},children:[r+1,". ",i.name||i.section_name]})}),e.jsxs(o.AccordionDetails,{sx:{px:1.5,pb:1.5,pt:0,display:"flex",flexDirection:"column",gap:.75},children:[e.jsx(d.MarkdownRenderer,{fontSize:"0.74rem",message:i.description||i.reason_for_inclusion||"",extraMetaData:B,cognitiveDecisioningStyles:C?.cognitiveDecisioning}),e.jsx(o.Typography,{sx:{fontSize:"0.72rem",color:"#9CA3AF",fontWeight:500,mt:.25},children:"APB References"}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.75},children:i.apb_references.map((i,r)=>{const n="string"==typeof i?i:i.apb_name,s=_===n;return e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.15},children:[e.jsxs(o.Box,{onClick:E?void 0:()=>(e=>{_===e?(O(null),N("")):(O(e),N(""),setTimeout(()=>N(e),50))})(n),sx:{display:"flex",alignItems:"center",gap:.25,cursor:E?"default":"pointer"},children:[e.jsxs(o.Typography,{sx:{fontSize:"0.78rem",color:s?"#5928ed":"#DB2877",fontWeight:500},children:[r+1,". ",n]}),!E&&e.jsx(m.default,{sx:{fontSize:"0.75rem",color:s?"#5928ed":"#DB2877"}})]}),"string"!=typeof i&&(i.description||i.context)&&e.jsx(S,{text:i.description||i.context||"",extraMetaData:B,cognitiveDecisioningStyles:C?.cognitiveDecisioning}),k&&s&&e.jsx(o.Box,{sx:{mt:1,height:260,border:"1px solid #e5e7eb",borderRadius:"8px",overflow:"hidden"},children:e.jsx(x.InternalEditor,{content:t,selectedTag:L,isDarkMode:V,height:"100%",fontSize:12})})]},r)})})]})]},r)):e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[1,2,3].map(i=>e.jsxs(o.Box,{sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5,display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"text",width:"40%",height:16}),e.jsx(o.Skeleton,{variant:"text",width:"90%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"80%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"30%",height:14})]},i))})})]}),h&&e.jsxs(o.Accordion,{disableGutters:!0,elevation:0,sx:{border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff",...C?.fpbSection},children:[e.jsxs(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75,alignItems:"center",gap:1}},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827",...C?.fpbTitle},children:a?.fpbTitle||"Functionality of FPB"}),e.jsx(o.Typography,{sx:{fontSize:"0.7rem",color:"#9CA3AF"}})]}),e.jsx(o.AccordionDetails,{sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC"},children:a?.treeProps?e.jsx(p.PromptBlockTree,{...a.treeProps,onNodeOpen:e=>{const i=e.meta?.rawPromptSegments,o=e.meta?.rawPrompt;Array.isArray(i)&&i.length>0?(G(i),Y(e=>e+1)):"string"==typeof o&&o.trim()?(G(o),Y(e=>e+1)):(G(void 0),Y(e=>e+1)),a?.treeProps.onNodeOpen?.(e)}}):e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[1,2,3].map(i=>e.jsxs(o.Box,{sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5,display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"text",width:"40%",height:16}),e.jsx(o.Skeleton,{variant:"text",width:"90%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"80%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"30%",height:14})]},i))})})]}),e.jsxs(o.Accordion,{disableGutters:!0,elevation:0,sx:{border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff",...C?.applicabilitySection},children:[e.jsxs(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75,alignItems:"center",gap:1}},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827",...C?.applicabilityTitle},children:"Applicability"}),e.jsx(o.Typography,{sx:{fontSize:"0.7rem",color:"#9CA3AF"},children:"When to Apply this SPB / When Not Apply"})]}),e.jsx(o.AccordionDetails,{sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC"},children:e.jsx(o.Box,{sx:{display:"flex",gap:1},children:[{label:"When to apply",content:v?.when_to_apply},{label:"When NOT to apply",content:v?.when_not_to_apply}].map(({label:i,content:t})=>e.jsxs(o.Box,{sx:{flex:1,bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"6px",p:1.25},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.76rem",color:"#374151",mb:.75},children:i}),t?e.jsx(d.MarkdownRenderer,{fontSize:"0.8rem",message:t,isDarkMode:V,style:C?.markdownRenderer,extraMetaData:B,cognitiveDecisioningStyles:C?.cognitiveDecisioning}):n?e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"text",width:"100%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"80%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"90%",height:14})]}):e.jsx(o.Typography,{sx:{fontSize:"0.8rem",color:"#6B7280",lineHeight:1.5},children:"— Not yet available"})]},i))})})]}),e.jsxs(o.Accordion,{disableGutters:!0,elevation:0,sx:{border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff",...C?.specificationsSection},children:[e.jsxs(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75,alignItems:"center",gap:1}},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827",...C?.specificationsTitle},children:"Specifications"}),e.jsx(o.Typography,{sx:{fontSize:"0.7rem",color:"#9CA3AF"},children:"Strict Rules / Input / Output"})]}),e.jsx(o.AccordionDetails,{sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"column",gap:1},children:[{label:"Strict Rules",tooltip:null,content:v?.constraints_and_rules},{label:"Input",tooltip:"Input specification for this SPB",content:v?.input_analysis},{label:"Output",tooltip:"Output specification for this SPB",content:v?.output_analysis}].map(({label:i,tooltip:t,content:r})=>{const s="Output"===i,l=s&&r?(e=>{const i=[];return{text:e.replace(/<code>([\s\S]*?)<\/code>/g,(e,o)=>(i.push(o.trim()),"")).trim(),code:i.join("\n\n")}})(r):null,a=l?l.text:r,c=l?l.code:"";return e.jsxs(o.Accordion,{disableGutters:!0,elevation:0,defaultExpanded:"Strict Rules"===i,sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"6px !important","&:before":{display:"none"},overflow:"hidden"},children:[e.jsx(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem"}}),sx:{minHeight:34,px:1.25,"& .MuiAccordionSummary-content":{my:.4}},children:e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.76rem",color:"#374151"},children:i}),t&&e.jsx(o.Tooltip,{title:t,placement:"top",children:e.jsx(o.Box,{component:"span",sx:{width:13,height:13,borderRadius:"50%",background:"#E5E7EB",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"0.58rem",color:"#6B7280",fontWeight:700,cursor:"default",flexShrink:0},children:"i"})})]})}),e.jsx(o.AccordionDetails,{sx:{px:1.25,pb:1.25,pt:0},children:r?e.jsxs(e.Fragment,{children:[a&&e.jsx(d.MarkdownRenderer,{fontSize:"0.8rem",message:a,isDarkMode:V,style:C?.markdownRenderer,extraMetaData:B,cognitiveDecisioningStyles:C?.cognitiveDecisioning}),s&&c&&e.jsxs(o.Box,{sx:{width:"100%",height:"35vh",mt:1.5},children:[e.jsxs(o.Box,{sx:{display:"flex",gap:.1,backgroundColor:"black",flexDirection:"row",alignItems:"center",justifyContent:"space-between",p:1,borderTopLeftRadius:"8px",borderTopRightRadius:"8px"},children:[e.jsx(o.Typography,{sx:{color:"white",fontWeight:500,fontSize:"0.8rem"},children:"Output preview"}),e.jsx(o.Tooltip,{title:"Copy Code to clipboard",children:e.jsx(o.IconButton,{size:"small",onClick:()=>{return e=c,navigator.clipboard.writeText(e);var e},children:e.jsx(o.Typography,{sx:{fontSize:"0.7rem",color:"white"},children:"Copy"})})})]}),e.jsx(o.Box,{sx:{mt:-1,height:"calc(100% - 40px)",borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px",overflow:"hidden"},children:e.jsx(x.InternalEditor,{content:c,isDarkMode:V,height:"100%",fontSize:10})})]})]}):n?e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"text",width:"100%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"90%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"75%",height:14})]}):e.jsx(o.Typography,{sx:{fontSize:"0.74rem",color:"#6B7280",lineHeight:1.5},children:"— Not yet available"})})]},i)})})]}),e.jsxs(o.Accordion,{defaultExpanded:!0,disableGutters:!0,elevation:0,sx:{border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},bgcolor:"#fff",...C?.dependencyGraphSection},children:[e.jsx(o.AccordionSummary,{expandIcon:e.jsx(f.default,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75},"&.Mui-expanded":{bgcolor:"#F8FAFC",borderRadius:"8px 8px 0 0"}},children:e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827",...C?.dependencyGraphTitle},children:"Dependency Graph"})}),e.jsx(o.AccordionDetails,{sx:{px:0,pb:0,pt:0},children:v?.dependency_graph?e.jsxs(o.Box,{sx:{bgcolor:"#F8FAFC",borderRadius:"0 0 8px 8px",p:1.5,display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx(o.Box,{sx:{height:500,borderRadius:"8px",overflow:"hidden"},children:e.jsx(c.default,{data:v.dependency_graph,isDarkMode:V,style:C?.dependencyGraph})}),e.jsx(o.Typography,{sx:{fontSize:"0.72rem",color:"#64748B",lineHeight:1.6},children:"This graph visualises how Atomic Prompt Blocks (APBs) depend on, influence, or exchange information with one another within the prompt architecture."})]}):e.jsxs(o.Box,{sx:{bgcolor:"#fff",borderRadius:"0 0 8px 8px",p:1.5,display:"flex",flexDirection:"column",gap:1},children:[e.jsx(o.Skeleton,{variant:"rectangular",width:"100%",height:400,sx:{borderRadius:"8px"}}),e.jsx(o.Skeleton,{variant:"text",width:"100%",height:14}),e.jsx(o.Skeleton,{variant:"text",width:"80%",height:14})]})})]})]})}),D&&z&&e.jsx(o.Box,{onClick:()=>Z(e=>!e),sx:{width:20,flexShrink:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",borderRight:"1px solid #e5e7eb",borderLeft:"1px solid #e5e7eb",bgcolor:"#f9fafb",position:"relative",py:2,"&:hover":{bgcolor:"#f0f0f0"},...C?.collapseStrip},children:e.jsx(o.Typography,{sx:{fontSize:10,fontWeight:600,color:"#6b7280",writingMode:"vertical-rl",textOrientation:"mixed",transform:"rotate(180deg)",letterSpacing:"0.05em",userSelect:"none"},children:"SPB Details"})}),D&&z&&e.jsx(o.Box,{onClick:()=>Z(e=>!e),onMouseDown:e=>{e.preventDefault(),oe.current=!0;const i=e=>{if(!oe.current||!te.current)return;const t=te.current.getBoundingClientRect(),r=t.left,n=t.width,s=e.clientX-r;if(s<200)return Z(!0),oe.current=!1,document.removeEventListener("mousemove",i),void document.removeEventListener("mouseup",o);s>.7*n||(Z(!1),ie(s))},o=()=>{oe.current=!1,document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",o)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",o)},sx:{position:"absolute",left:U?20:ee+20,top:"50%",transform:"translateY(-50%)",width:18,height:28,bgcolor:"#fff",border:"1px solid #e5e7eb",borderRadius:"0 6px 6px 0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"col-resize",zIndex:5,boxShadow:"2px 0 4px rgba(0,0,0,0.06)","&:hover":{bgcolor:"#f9fafb"},...C?.dragHandle},children:U?e.jsx(j.default,{sx:{fontSize:12,color:"#6b7280"}}):e.jsx(y.default,{sx:{fontSize:12,color:"#6b7280"}})}),D&&e.jsxs(o.Box,{sx:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden",p:2,gap:1.5,bgcolor:"#f8fafc",...C?.codePanel},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0,...C?.codePanelHeader},children:[e.jsx(o.Typography,{sx:{fontSize:13,fontWeight:600,color:"#374151",...C?.codePanelTitle},children:r||"SPB Analysis"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[M&&e.jsx(o.Switch,{checked:V,onChange:e=>J(e.target.checked),size:"small",sx:{width:36,height:20,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"2px","&.Mui-checked":{transform:"translateX(16px)",color:"#fff","& + .MuiSwitch-track":{bgcolor:"#5928ed",opacity:1}}},"& .MuiSwitch-thumb":{width:16,height:16,bgcolor:"#fff"},"& .MuiSwitch-track":{borderRadius:10,bgcolor:"#d1d5db",opacity:1}}}),A&&T&&e.jsx(o.Tooltip,{title:"Fullscreen",placement:"top",children:e.jsx(o.IconButton,{size:"small",onClick:()=>Q({ref:L||"",description:""}),sx:{color:"#6b7280"},children:e.jsx(g.default,{sx:{fontSize:16}})})})]})]}),e.jsx(o.Box,{sx:{flex:1,minHeight:0,border:"1px solid #30363d",borderRadius:1,overflow:"hidden",...C?.editorContainer},children:e.jsx(x.InternalEditor,{content:t,selectedTag:L,isDarkMode:V,height:"100%",fontSize:13,highlightVariable:q,highlightNonce:X})})]})]}),T&&e.jsxs(o.Dialog,{open:!!K,onClose:()=>Q(null),maxWidth:!1,PaperProps:{sx:{width:"82vw",height:"80vh",maxWidth:"none",borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column",...C?.fullscreenModal}},children:[e.jsxs(o.Box,{sx:{px:2.5,py:1.5,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},children:[e.jsx(o.Typography,{sx:{fontWeight:700,fontSize:"1rem",color:"#111827"},children:"Promptemon"}),e.jsx(o.IconButton,{size:"small",onClick:()=>Q(null),children:e.jsx(u.default,{sx:{fontSize:"1.1rem",color:"#6B7280"}})})]}),e.jsxs(o.Box,{sx:{flex:1,display:"flex",overflow:"hidden",minHeight:0},children:[e.jsxs(o.Box,{sx:{width:"40%",flexShrink:0,borderRight:"1px solid #E5E7EB",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs(o.Box,{sx:{px:2,py:1.25,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",gap:1},children:[e.jsx(o.Tooltip,{title:"Atomic Prompt Block",placement:"top",children:e.jsx(o.Chip,{label:"APB",size:"small",sx:{bgcolor:"#f1f5f9",color:"#475569",fontWeight:700,fontSize:10,height:20,borderRadius:1}})}),e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.9rem",color:"#111827"},children:K?.ref})]}),e.jsxs(o.Box,{sx:{flex:1,p:2,display:"flex",flexDirection:"column",gap:1.5,overflowY:"auto"},children:[e.jsxs(o.Box,{sx:{border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.8rem",color:"#111827",mb:.75},children:"Description"}),e.jsx(o.Typography,{sx:{fontSize:"0.73rem",color:"#6B7280",lineHeight:1.6},children:K?.description})]}),e.jsxs(o.Box,{sx:{border:"1px solid #E5E7EB",borderRadius:"8px",p:1.25,display:"flex",alignItems:"center",gap:.5},children:[e.jsx(o.Typography,{sx:{fontSize:"0.73rem",color:"#6B7280"},children:"Total Lines"}),e.jsx(o.Typography,{sx:{fontSize:"0.73rem",fontWeight:700,color:"#111827"},children:t.split("\n").length})]})]})]}),e.jsxs(o.Box,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs(o.Box,{sx:{px:2,py:1.25,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(o.Typography,{sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827"},children:"Prompt Preview"}),e.jsx(o.Switch,{checked:V,onChange:e=>J(e.target.checked),size:"small",sx:{width:36,height:20,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"2px","&.Mui-checked":{transform:"translateX(16px)",color:"#fff","& + .MuiSwitch-track":{bgcolor:"#5928ed",opacity:1}}},"& .MuiSwitch-thumb":{width:16,height:16,bgcolor:"#fff"},"& .MuiSwitch-track":{borderRadius:10,bgcolor:"#d1d5db",opacity:1}}})]}),e.jsx(o.Box,{sx:{flex:1,minHeight:0,p:1.5},children:e.jsx(x.InternalEditor,{content:t,selectedTag:L,isDarkMode:V,highlightVariable:q,height:"100%",fontSize:13,highlightNonce:X})})]})]})]})]})};
|
|
2
2
|
//# sourceMappingURL=Spbanalysispanel.js.map
|