diff --git a/designconfig.ts b/designconfig.ts index aee0db1..8d897e2 100644 --- a/designconfig.ts +++ b/designconfig.ts @@ -12,6 +12,10 @@ export const designConfig = { scrollbarTrackRgb: "20, 20, 20", scrollbarThumbRgb: "30, 30, 30", scrollbarThumbHoverRgb: "30, 50, 30" + }, + layout: { + modeColumnWidthPx: 440, + modeToggleWidthPx: 188 } } as const; diff --git a/llm_normalizer/frontend/dist/assets/index-BT0bMOoF.css b/llm_normalizer/frontend/dist/assets/index-BT0bMOoF.css new file mode 100644 index 0000000..c9bde29 --- /dev/null +++ b/llm_normalizer/frontend/dist/assets/index-BT0bMOoF.css @@ -0,0 +1 @@ +@import"https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&family=Space+Grotesk:wght@500;700&display=swap";:root{--rgb-background: 16, 16, 19;--rgb-surface-main: 26, 26, 31;--rgb-surface-horizontal: 32, 32, 38;--rgb-surface-focus: 40, 40, 47;--rgb-active: 228, 142, 92;--rgb-active-text: 18, 18, 18;--rgb-text-main: 240, 240, 240;--rgb-text-muted: 166, 166, 170;--rgb-danger: 255, 126, 126;--rgb-scrollbar-track: 31, 31, 36;--rgb-scrollbar-thumb: 74, 74, 82;--rgb-scrollbar-thumb-hover: 90, 90, 100;--mode-column-width: 440px;--mode-toggle-width: 188px;--bg-main: rgb(var(--rgb-background));--bg-soft: rgb(var(--rgb-surface-main));--bg-panel: rgb(var(--rgb-surface-main));--bg-panel-accent: rgb(var(--rgb-surface-horizontal));--surface-horizontal: rgb(var(--rgb-surface-horizontal));--surface-focus: rgb(var(--rgb-surface-focus));--line: transparent;--line-strong: rgba(var(--rgb-active), .48);--text-main: rgb(var(--rgb-text-main));--text-muted: rgb(var(--rgb-text-muted));--lime-main: rgb(var(--rgb-text-main));--lime-press: rgb(var(--rgb-text-main));--danger: rgb(var(--rgb-danger));--radius-lg: 20px;--radius-md: 14px;--shadow: none;--autoruns-col-width: var(--mode-column-width)}*{box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(var(--rgb-scrollbar-thumb)) rgb(var(--rgb-scrollbar-track))}*::-webkit-scrollbar{width:10px;height:10px}*::-webkit-scrollbar-track{background:rgb(var(--rgb-scrollbar-track))}*::-webkit-scrollbar-thumb{background:rgb(var(--rgb-scrollbar-thumb));border-radius:999px;border:2px solid rgb(var(--rgb-scrollbar-track))}*::-webkit-scrollbar-thumb:hover{background:rgb(var(--rgb-scrollbar-thumb-hover))}html,body,#root{margin:0;min-height:100dvh;font-family:Manrope,Segoe UI,sans-serif;background:var(--bg-main);color:var(--text-main)}.app-root{max-width:1720px;margin:0 auto;padding:12px 16px 16px}.app-root.app-root-autoruns{max-width:none;width:100%;min-height:100dvh;max-height:100dvh;display:flex;flex-direction:column;overflow:hidden}.app-topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 12px;padding:0;min-height:38px}.layout-grid{display:grid;grid-template-columns:repeat(12,1fr);gap:16px}.layout-grid.layout-grid-autoruns,.layout-grid.layout-grid-mode-columns{min-height:0;flex:1 1 auto;grid-template-columns:minmax(0,1fr)}.mode-switch-row{display:flex;gap:8px;margin:0;padding:0}.mode-switch-row.mode-switch-row-right{margin-left:auto;justify-content:flex-end;max-width:72%;overflow-x:auto;overflow-y:hidden;padding-bottom:2px}.mode-switch-row .tab{white-space:nowrap}.mode-switch-row.mode-switch-row-right .tab{width:var(--mode-toggle-width);min-width:var(--mode-toggle-width);text-align:center}.mode-columns{display:flex;gap:12px;width:100%;min-height:0;flex:1 1 auto;overflow-x:auto;overflow-y:hidden;padding-bottom:4px}.mode-col{flex:0 0 var(--mode-column-width);width:var(--mode-column-width);min-height:0;height:100%;display:flex}.mode-col.mode-col-wide,.mode-col.mode-col-xwide{flex-basis:var(--mode-column-width);width:var(--mode-column-width)}.mode-col .panel-frame{width:100%;height:100%}.mode-col .panel-body{min-height:0;overflow:auto}.mode-columns-empty{min-width:360px;border-radius:14px;background:rgb(var(--rgb-surface-main));color:var(--text-muted);padding:14px}.panel-frame{grid-column:span 12;border:none;border-radius:var(--radius-lg);background:var(--bg-panel);overflow:hidden;box-shadow:none;animation:rise .4s ease-out;display:flex;flex-direction:column;min-height:0}.panel-header{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:14px 18px 10px;border-bottom:none;background:var(--bg-panel-accent)}.panel-header h2{margin:0;font-size:1.02rem;letter-spacing:.02em}.panel-header p{margin:6px 0 0;font-size:.85rem;color:var(--text-muted)}.panel-body{padding:10px 12px 12px;min-height:0}.app-root-autoruns .autoruns-frame{height:100%}.app-root-autoruns .autoruns-frame .panel-body{flex:1 1 auto;overflow:hidden;display:flex;flex-direction:column;gap:10px;padding:10px 12px 12px;background:rgb(var(--rgb-background))}.status-chip{border:none;border-radius:999px;padding:4px 10px;color:var(--lime-main);font-size:.78rem;background:rgb(var(--rgb-surface-focus))}.assistant-panel-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px}.assistant-copy-btn{background:transparent;border-color:transparent;color:var(--text-main);box-shadow:none;transform:none}.assistant-copy-btn:hover{background:rgb(var(--rgb-surface-focus));filter:none;box-shadow:none;transform:none}.assistant-copy-feedback{font-size:.76rem;color:var(--text-muted)}.assistant-copy-feedback.success{color:var(--lime-main)}.assistant-copy-feedback.error{color:var(--danger)}input,select,textarea,button{font-family:Manrope,sans-serif}label{display:flex;flex-direction:column;gap:6px;color:var(--text-muted);font-size:.84rem}input,select,textarea{border:none;border-radius:var(--radius-md);background:rgb(var(--rgb-surface-horizontal));color:var(--text-main);padding:10px 12px;outline:none;transition:background-color .18s ease}input:focus,select:focus,textarea:focus{border-color:transparent;box-shadow:none;outline:none;background:rgb(var(--rgb-surface-focus))}textarea{resize:vertical;min-height:86px}button{border:none;border-radius:999px;background:rgb(var(--rgb-surface-horizontal));color:rgb(var(--rgb-text-main));font-weight:700;font-size:.83rem;letter-spacing:.02em;cursor:pointer;padding:9px 14px;transition:background .2s ease,color .2s ease;outline:none;box-shadow:none}button:hover{border-color:transparent;background:rgb(var(--rgb-surface-focus))}button:disabled{opacity:.52;cursor:not-allowed}.button-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:12px}.checkbox-row{flex-direction:row;align-items:center;gap:8px;color:var(--text-main)}.grid-two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.prompt-manager-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:12px}.full-width{grid-column:1 / -1}.tab-row{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}.tab{background:rgb(var(--rgb-surface-main));color:var(--text-main);border:none}.tab.active{border-color:transparent;background:rgb(var(--rgb-active));color:rgb(var(--rgb-active-text))}.assistant-chat-list{max-height:420px;overflow:auto;display:grid;gap:10px;padding:4px;border:none;border-radius:var(--radius-md);background:rgb(var(--rgb-surface-horizontal))}.assistant-empty{padding:18px;text-align:center}.assistant-msg{border:none;border-radius:12px;background:rgb(var(--rgb-surface-main));padding:10px}.assistant-msg.user{border-color:transparent;background:rgb(var(--rgb-surface-focus))}.assistant-msg.assistant{border-color:transparent}.assistant-msg-head{display:flex;justify-content:space-between;gap:8px;margin-bottom:6px;font-size:.78rem;color:var(--text-muted)}.assistant-msg-body{white-space:pre-wrap;line-height:1.45;font-size:.9rem}.assistant-trace{margin-top:6px;color:var(--text-muted);font-size:.75rem}.assistant-debug{margin-top:8px}.assistant-debug summary{cursor:pointer;color:var(--lime-main);font-size:.8rem}.assistant-compose{margin-top:12px;display:grid;gap:10px}.json-view{margin:0;width:100%;min-height:180px;max-height:420px;overflow:auto;background:rgb(var(--rgb-surface-horizontal));border:none;border-radius:var(--radius-md);padding:12px;color:rgb(var(--rgb-text-main));font-family:JetBrains Mono,Consolas,monospace;font-size:.78rem;line-height:1.45}.metrics-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}.metrics-grid div{background:rgba(var(--rgb-surface-main),.8);border:none;border-radius:12px;padding:10px;display:flex;flex-direction:column;gap:4px}.metrics-grid span{color:var(--text-muted);font-size:.75rem}.metrics-grid strong{font-size:.84rem;color:var(--lime-main)}.history-list{display:grid;gap:8px;max-height:340px;overflow:auto}.history-item{width:100%;text-align:left;border-radius:12px;border:none;background:rgb(var(--rgb-surface-main));color:var(--text-main);padding:10px}.history-item p{margin:8px 0;color:var(--text-muted);font-size:.82rem}.history-item.selected{border-color:var(--line-strong)}.history-row{display:flex;justify-content:space-between;gap:8px;font-size:.76rem;color:var(--text-muted)}.runtime-grid{display:grid;grid-template-columns:1.2fr 1fr;gap:12px}.runtime-stack{display:grid;grid-template-columns:minmax(0,1fr);gap:12px}.runtime-details{display:grid;gap:12px}.runtime-runs{max-height:360px;overflow:auto;display:grid;gap:8px}.eval-report-wrap{position:relative}.copy-cube-button{position:absolute;right:10px;bottom:10px;width:34px;height:34px;border-radius:10px;padding:0;min-width:34px;display:grid;place-items:center;font-size:.92rem;line-height:1}.muted{color:var(--text-muted)}.diff-summary{margin-top:10px;font-size:.82rem;color:var(--lime-main)}.error-text{margin-top:10px;color:var(--danger);font-size:.84rem}.autoruns-columns{display:flex;gap:12px;width:100%;min-height:0;flex:1 1 auto;overflow-x:auto;overflow-y:hidden;padding-bottom:4px}.autoruns-col{flex:0 0 var(--mode-column-width);width:var(--mode-column-width);height:100%;min-height:0;overflow:auto;border:none;border-radius:14px;background:rgb(var(--rgb-surface-main));padding:12px;scrollbar-gutter:stable}.autoruns-col h3{margin:0;font-size:.95rem}.autoruns-col h4{margin:12px 0 8px;font-size:.82rem;color:var(--text-muted)}.autoruns-col-header{position:sticky;top:-12px;z-index:8;margin:-12px -12px 10px;padding:12px 12px 10px;background:rgb(var(--rgb-surface-main))}.autoruns-col-header .tab-row{margin:8px 0 0}.autoruns-col-header .autoruns-dialog-toolbar{margin-top:8px}.autoruns-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.autoruns-meta-list{display:grid;gap:8px}.autoruns-meta-list>div{display:flex;justify-content:space-between;gap:8px;border:none;border-radius:10px;background:rgb(var(--rgb-surface-horizontal));padding:8px 9px;font-size:.79rem}.autoruns-meta-list span{color:var(--text-muted)}.autoruns-prompt-details summary{cursor:pointer;color:var(--text-main);font-size:.8rem;margin-bottom:8px}.autoruns-prompt-details textarea{min-height:68px}.autoruns-stats-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:10px}.autoruns-stats-grid>div{border:none;border-radius:10px;background:rgb(var(--rgb-surface-horizontal));padding:8px;display:grid;gap:3px}.autoruns-stats-grid span{color:var(--text-muted);font-size:.74rem}.autoruns-stats-grid strong{color:var(--lime-main);font-size:.84rem}.autoruns-run-list{display:grid;gap:8px;max-height:none;min-height:0;flex:1 1 auto;overflow:auto;padding-right:2px}.autoruns-run-item{width:100%;text-align:left;border-radius:12px;border:none;background:rgb(var(--rgb-surface-horizontal));color:var(--text-main);padding:10px;display:grid;gap:5px}.autoruns-run-item.selected{border-color:var(--line-strong)}.autoruns-run-head,.autoruns-run-foot{display:flex;justify-content:space-between;gap:8px;font-size:.76rem}.autoruns-run-meta{color:var(--text-muted);font-size:.75rem;word-break:break-word}.autoruns-dialog-toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.autoruns-case-list{margin-top:8px;display:grid;gap:6px;max-height:180px;overflow:auto}.autoruns-case-item{width:100%;text-align:left;border-radius:10px;border:none;background:rgb(var(--rgb-surface-horizontal));color:var(--text-main);padding:7px 8px;display:flex;justify-content:space-between;gap:6px;font-size:.76rem}.autoruns-case-item.selected{border-color:var(--line-strong)}.autoruns-dialog-view{margin-top:10px;border:none;border-radius:12px;background:rgb(var(--rgb-surface-horizontal));padding:10px;max-height:none;min-height:0;flex:1 1 auto;overflow:auto;display:grid;gap:8px}.autoruns-msg{border:none;border-radius:12px;background:rgb(var(--rgb-surface-focus));padding:8px 10px;display:grid;gap:6px}.autoruns-msg header,.autoruns-msg footer{display:flex;justify-content:space-between;gap:8px;font-size:.74rem;color:var(--text-muted)}.autoruns-msg-head-actions{display:flex;align-items:center;gap:8px}.autoruns-msg p{margin:0;white-space:pre-wrap;line-height:1.35;font-size:.84rem}.autoruns-comment-icon{border:none;background:rgb(var(--rgb-surface-horizontal));color:var(--text-main);border-radius:999px;min-width:28px;min-height:28px;padding:0 8px;line-height:1;box-shadow:none;transform:none}.autoruns-comment-icon:hover{border-color:var(--line-strong);box-shadow:none;transform:none}.autoruns-comment-icon.commented{border-color:var(--line-strong);color:var(--lime-main);background:rgb(var(--rgb-active));color:rgb(var(--rgb-active-text))}.autoruns-msg-annotation{display:grid;gap:4px;border:none;border-radius:10px;background:rgb(var(--rgb-surface-horizontal));padding:7px 8px;font-size:.78rem}.autoruns-comments-list{display:grid;gap:8px;max-height:none;min-height:0;flex:1 1 auto;overflow:auto;padding-right:2px}.autoruns-autogen-list{display:grid;gap:8px;max-height:none;min-height:0;overflow:auto;padding-right:2px}.autoruns-autogen-item{border:none;border-radius:10px;background:rgb(var(--rgb-surface-horizontal));padding:8px;display:grid;gap:5px}.autoruns-autogen-item header{display:flex;justify-content:space-between;gap:8px;font-size:.76rem}.autoruns-autogen-item p{margin:0;color:var(--text-muted);white-space:pre-wrap;font-size:.8rem}.autoruns-comment-item{width:100%;text-align:left;border-radius:12px;border:none;background:rgb(var(--rgb-surface-horizontal));color:var(--text-main);padding:9px;display:grid;gap:6px}.autoruns-comment-item p{margin:0;white-space:pre-wrap;color:var(--text-muted);font-size:.79rem}.autoruns-comment-item.selected{border-color:var(--line-strong)}.autoruns-comment-head{display:flex;justify-content:space-between;gap:8px;font-size:.75rem}.autoruns-msg.assistant{margin-right:12%}.autoruns-msg.user{margin-left:12%;border-color:transparent;background:rgb(var(--rgb-surface-focus))}.autoruns-decomposition-list{margin:0;padding-left:18px;display:grid;gap:7px;font-size:.8rem}.autoruns-comment-modal-backdrop{position:fixed;inset:0;background:rgba(var(--rgb-background),.74);display:grid;place-items:center;z-index:1800;padding:12px}.autoruns-comment-modal{width:min(660px,100%);border:none;border-radius:16px;background:rgb(var(--rgb-surface-horizontal));box-shadow:var(--shadow);padding:14px;display:grid;gap:10px}.autoruns-comment-modal h3{margin:0;font-size:.95rem}.autoruns-comment-quote{margin:0;border:none;border-radius:10px;background:rgb(var(--rgb-surface-focus));padding:8px;white-space:pre-wrap;max-height:150px;overflow:auto;font-size:.82rem}.autoruns-rating-row{display:flex;gap:8px}.autoruns-rating-dot{width:34px;height:34px;border-radius:999px;padding:0;border:none;background:rgb(var(--rgb-surface-focus));color:var(--text-muted);font-size:.95rem;box-shadow:none;transform:none}.autoruns-rating-dot:hover{border-color:var(--line-strong);box-shadow:none;transform:none}.autoruns-rating-dot.active{border-color:var(--line-strong);color:rgb(var(--rgb-active-text));background:rgb(var(--rgb-active))}.autoruns-coverage-list{display:grid;gap:8px}.autoruns-coverage-item{border:none;border-radius:10px;background:rgb(var(--rgb-surface-horizontal));padding:8px}.autoruns-coverage-head{display:flex;justify-content:space-between;gap:8px;font-size:.76rem;margin-bottom:5px}.autoruns-coverage-head span{color:var(--text-muted)}.autoruns-coverage-bar{height:7px;border-radius:999px;background:rgb(var(--rgb-surface-focus));overflow:hidden}.autoruns-coverage-bar>div{height:100%;border-radius:999px;background:rgb(var(--rgb-active))}@media(max-width:1200px){:root{--mode-column-width: 400px}.metrics-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(max-width:920px){:root{--mode-column-width: 360px}.grid-two,.runtime-grid,.runtime-stack{grid-template-columns:1fr}.metrics-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.autoruns-form-grid,.autoruns-dialog-toolbar,.autoruns-stats-grid{grid-template-columns:1fr}}@media(max-width:640px){:root{--mode-column-width: 320px}.app-root{padding:18px 12px 24px}.metrics-grid{grid-template-columns:1fr}}@keyframes rise{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}} diff --git a/llm_normalizer/frontend/dist/assets/index-BVc11Mnb.css b/llm_normalizer/frontend/dist/assets/index-BVc11Mnb.css deleted file mode 100644 index 9b1061f..0000000 --- a/llm_normalizer/frontend/dist/assets/index-BVc11Mnb.css +++ /dev/null @@ -1 +0,0 @@ -@import"https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&family=Space+Grotesk:wght@500;700&display=swap";:root{--rgb-background: 16, 16, 19;--rgb-surface-main: 26, 26, 31;--rgb-surface-horizontal: 32, 32, 38;--rgb-surface-focus: 40, 40, 47;--rgb-active: 228, 142, 92;--rgb-active-text: 18, 18, 18;--rgb-text-main: 240, 240, 240;--rgb-text-muted: 166, 166, 170;--rgb-danger: 255, 126, 126;--rgb-scrollbar-track: 31, 31, 36;--rgb-scrollbar-thumb: 74, 74, 82;--rgb-scrollbar-thumb-hover: 90, 90, 100;--bg-main: rgb(var(--rgb-background));--bg-soft: rgb(var(--rgb-surface-main));--bg-panel: rgb(var(--rgb-surface-main));--bg-panel-accent: rgb(var(--rgb-surface-horizontal));--surface-horizontal: rgb(var(--rgb-surface-horizontal));--surface-focus: rgb(var(--rgb-surface-focus));--line: transparent;--line-strong: rgba(var(--rgb-active), .48);--text-main: rgb(var(--rgb-text-main));--text-muted: rgb(var(--rgb-text-muted));--lime-main: rgb(var(--rgb-text-main));--lime-press: rgb(var(--rgb-text-main));--danger: rgb(var(--rgb-danger));--radius-lg: 20px;--radius-md: 14px;--shadow: none;--autoruns-col-width: 360px}*{box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(var(--rgb-scrollbar-thumb)) rgb(var(--rgb-scrollbar-track))}*::-webkit-scrollbar{width:10px;height:10px}*::-webkit-scrollbar-track{background:rgb(var(--rgb-scrollbar-track))}*::-webkit-scrollbar-thumb{background:rgb(var(--rgb-scrollbar-thumb));border-radius:999px;border:2px solid rgb(var(--rgb-scrollbar-track))}*::-webkit-scrollbar-thumb:hover{background:rgb(var(--rgb-scrollbar-thumb-hover))}html,body,#root{margin:0;min-height:100dvh;font-family:Manrope,Segoe UI,sans-serif;background:var(--bg-main);color:var(--text-main)}.app-root{max-width:1720px;margin:0 auto;padding:12px 16px 16px}.app-root.app-root-autoruns{max-width:none;width:100%;min-height:100dvh;max-height:100dvh;display:flex;flex-direction:column;overflow:hidden}.app-topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 12px;padding:0;min-height:38px}.layout-grid{display:grid;grid-template-columns:repeat(12,1fr);gap:16px}.layout-grid.layout-grid-autoruns{min-height:0;flex:1 1 auto;grid-template-columns:minmax(0,1fr)}.mode-switch-row{display:flex;gap:8px;margin:0;padding:0}.mode-switch-row.mode-switch-row-right{margin-left:auto;justify-content:flex-end}.panel-frame{grid-column:span 12;border:none;border-radius:var(--radius-lg);background:var(--bg-panel);overflow:hidden;box-shadow:none;animation:rise .4s ease-out;display:flex;flex-direction:column;min-height:0}.panel-header{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:14px 18px 10px;border-bottom:none;background:var(--bg-panel-accent)}.panel-header h2{margin:0;font-size:1.02rem;letter-spacing:.02em}.panel-header p{margin:6px 0 0;font-size:.85rem;color:var(--text-muted)}.panel-body{padding:10px 12px 12px;min-height:0}.app-root-autoruns .autoruns-frame{height:100%}.app-root-autoruns .autoruns-frame .panel-body{flex:1 1 auto;overflow:hidden;display:flex;flex-direction:column;gap:10px;padding:10px 12px 12px;background:rgb(var(--rgb-background))}.status-chip{border:none;border-radius:999px;padding:4px 10px;color:var(--lime-main);font-size:.78rem;background:rgb(var(--rgb-surface-focus))}.assistant-panel-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px}.assistant-copy-btn{background:transparent;border-color:transparent;color:var(--text-main);box-shadow:none;transform:none}.assistant-copy-btn:hover{background:rgb(var(--rgb-surface-focus));filter:none;box-shadow:none;transform:none}.assistant-copy-feedback{font-size:.76rem;color:var(--text-muted)}.assistant-copy-feedback.success{color:var(--lime-main)}.assistant-copy-feedback.error{color:var(--danger)}input,select,textarea,button{font-family:Manrope,sans-serif}label{display:flex;flex-direction:column;gap:6px;color:var(--text-muted);font-size:.84rem}input,select,textarea{border:none;border-radius:var(--radius-md);background:rgb(var(--rgb-surface-horizontal));color:var(--text-main);padding:10px 12px;outline:none;transition:background-color .18s ease}input:focus,select:focus,textarea:focus{border-color:transparent;box-shadow:none;outline:none;background:rgb(var(--rgb-surface-focus))}textarea{resize:vertical;min-height:86px}button{border:none;border-radius:999px;background:rgb(var(--rgb-surface-horizontal));color:rgb(var(--rgb-text-main));font-weight:700;font-size:.83rem;letter-spacing:.02em;cursor:pointer;padding:9px 14px;transition:background .2s ease,color .2s ease;outline:none;box-shadow:none}button:hover{border-color:transparent;background:rgb(var(--rgb-surface-focus))}button:disabled{opacity:.52;cursor:not-allowed}.button-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:12px}.checkbox-row{flex-direction:row;align-items:center;gap:8px;color:var(--text-main)}.grid-two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.full-width{grid-column:1 / -1}.tab-row{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}.tab{background:rgb(var(--rgb-surface-main));color:var(--text-main);border:none}.tab.active{border-color:transparent;background:rgb(var(--rgb-active));color:rgb(var(--rgb-active-text))}.assistant-chat-list{max-height:420px;overflow:auto;display:grid;gap:10px;padding:4px;border:none;border-radius:var(--radius-md);background:rgb(var(--rgb-surface-horizontal))}.assistant-empty{padding:18px;text-align:center}.assistant-msg{border:none;border-radius:12px;background:rgb(var(--rgb-surface-main));padding:10px}.assistant-msg.user{border-color:transparent;background:rgb(var(--rgb-surface-focus))}.assistant-msg.assistant{border-color:transparent}.assistant-msg-head{display:flex;justify-content:space-between;gap:8px;margin-bottom:6px;font-size:.78rem;color:var(--text-muted)}.assistant-msg-body{white-space:pre-wrap;line-height:1.45;font-size:.9rem}.assistant-trace{margin-top:6px;color:var(--text-muted);font-size:.75rem}.assistant-debug{margin-top:8px}.assistant-debug summary{cursor:pointer;color:var(--lime-main);font-size:.8rem}.assistant-compose{margin-top:12px;display:grid;gap:10px}.json-view{margin:0;width:100%;min-height:180px;max-height:420px;overflow:auto;background:rgb(var(--rgb-surface-horizontal));border:none;border-radius:var(--radius-md);padding:12px;color:rgb(var(--rgb-text-main));font-family:JetBrains Mono,Consolas,monospace;font-size:.78rem;line-height:1.45}.metrics-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}.metrics-grid div{background:rgba(var(--rgb-surface-main),.8);border:none;border-radius:12px;padding:10px;display:flex;flex-direction:column;gap:4px}.metrics-grid span{color:var(--text-muted);font-size:.75rem}.metrics-grid strong{font-size:.84rem;color:var(--lime-main)}.history-list{display:grid;gap:8px;max-height:340px;overflow:auto}.history-item{width:100%;text-align:left;border-radius:12px;border:none;background:rgb(var(--rgb-surface-main));color:var(--text-main);padding:10px}.history-item p{margin:8px 0;color:var(--text-muted);font-size:.82rem}.history-item.selected{border-color:var(--line-strong)}.history-row{display:flex;justify-content:space-between;gap:8px;font-size:.76rem;color:var(--text-muted)}.runtime-grid{display:grid;grid-template-columns:1.2fr 1fr;gap:12px}.runtime-runs{max-height:360px;overflow:auto;display:grid;gap:8px}.eval-report-wrap{position:relative}.copy-cube-button{position:absolute;right:10px;bottom:10px;width:34px;height:34px;border-radius:10px;padding:0;min-width:34px;display:grid;place-items:center;font-size:.92rem;line-height:1}.muted{color:var(--text-muted)}.diff-summary{margin-top:10px;font-size:.82rem;color:var(--lime-main)}.error-text{margin-top:10px;color:var(--danger);font-size:.84rem}.autoruns-columns{display:flex;gap:12px;width:100%;min-height:0;flex:1 1 auto;overflow-x:auto;overflow-y:hidden;padding-bottom:4px}.autoruns-col{flex:0 0 var(--autoruns-col-width);width:var(--autoruns-col-width);height:100%;min-height:0;overflow:auto;border:none;border-radius:14px;background:rgb(var(--rgb-surface-main));padding:12px;scrollbar-gutter:stable}.autoruns-col:nth-child(3){flex-basis:440px;width:440px}.autoruns-col h3{margin:0;font-size:.95rem}.autoruns-col h4{margin:12px 0 8px;font-size:.82rem;color:var(--text-muted)}.autoruns-col-header{position:sticky;top:-12px;z-index:8;margin:-12px -12px 10px;padding:12px 12px 10px;background:rgb(var(--rgb-surface-main))}.autoruns-col-header .tab-row{margin:8px 0 0}.autoruns-col-header .autoruns-dialog-toolbar{margin-top:8px}.autoruns-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.autoruns-meta-list{display:grid;gap:8px}.autoruns-meta-list>div{display:flex;justify-content:space-between;gap:8px;border:none;border-radius:10px;background:rgb(var(--rgb-surface-horizontal));padding:8px 9px;font-size:.79rem}.autoruns-meta-list span{color:var(--text-muted)}.autoruns-prompt-details summary{cursor:pointer;color:var(--text-main);font-size:.8rem;margin-bottom:8px}.autoruns-prompt-details textarea{min-height:68px}.autoruns-stats-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:10px}.autoruns-stats-grid>div{border:none;border-radius:10px;background:rgb(var(--rgb-surface-horizontal));padding:8px;display:grid;gap:3px}.autoruns-stats-grid span{color:var(--text-muted);font-size:.74rem}.autoruns-stats-grid strong{color:var(--lime-main);font-size:.84rem}.autoruns-run-list{display:grid;gap:8px;max-height:none;min-height:0;flex:1 1 auto;overflow:auto;padding-right:2px}.autoruns-run-item{width:100%;text-align:left;border-radius:12px;border:none;background:rgb(var(--rgb-surface-horizontal));color:var(--text-main);padding:10px;display:grid;gap:5px}.autoruns-run-item.selected{border-color:var(--line-strong)}.autoruns-run-head,.autoruns-run-foot{display:flex;justify-content:space-between;gap:8px;font-size:.76rem}.autoruns-run-meta{color:var(--text-muted);font-size:.75rem;word-break:break-word}.autoruns-dialog-toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.autoruns-case-list{margin-top:8px;display:grid;gap:6px;max-height:180px;overflow:auto}.autoruns-case-item{width:100%;text-align:left;border-radius:10px;border:none;background:rgb(var(--rgb-surface-horizontal));color:var(--text-main);padding:7px 8px;display:flex;justify-content:space-between;gap:6px;font-size:.76rem}.autoruns-case-item.selected{border-color:var(--line-strong)}.autoruns-dialog-view{margin-top:10px;border:none;border-radius:12px;background:rgb(var(--rgb-surface-horizontal));padding:10px;max-height:none;min-height:0;flex:1 1 auto;overflow:auto;display:grid;gap:8px}.autoruns-msg{border:none;border-radius:12px;background:rgb(var(--rgb-surface-focus));padding:8px 10px;display:grid;gap:6px}.autoruns-msg header,.autoruns-msg footer{display:flex;justify-content:space-between;gap:8px;font-size:.74rem;color:var(--text-muted)}.autoruns-msg-head-actions{display:flex;align-items:center;gap:8px}.autoruns-msg p{margin:0;white-space:pre-wrap;line-height:1.35;font-size:.84rem}.autoruns-comment-icon{border:none;background:rgb(var(--rgb-surface-horizontal));color:var(--text-main);border-radius:999px;min-width:28px;min-height:28px;padding:0 8px;line-height:1;box-shadow:none;transform:none}.autoruns-comment-icon:hover{border-color:var(--line-strong);box-shadow:none;transform:none}.autoruns-comment-icon.commented{border-color:var(--line-strong);color:var(--lime-main);background:rgb(var(--rgb-active));color:rgb(var(--rgb-active-text))}.autoruns-msg-annotation{display:grid;gap:4px;border:none;border-radius:10px;background:rgb(var(--rgb-surface-horizontal));padding:7px 8px;font-size:.78rem}.autoruns-comments-list{display:grid;gap:8px;max-height:none;min-height:0;flex:1 1 auto;overflow:auto;padding-right:2px}.autoruns-autogen-list{display:grid;gap:8px;max-height:none;min-height:0;overflow:auto;padding-right:2px}.autoruns-autogen-item{border:none;border-radius:10px;background:rgb(var(--rgb-surface-horizontal));padding:8px;display:grid;gap:5px}.autoruns-autogen-item header{display:flex;justify-content:space-between;gap:8px;font-size:.76rem}.autoruns-autogen-item p{margin:0;color:var(--text-muted);white-space:pre-wrap;font-size:.8rem}.autoruns-comment-item{width:100%;text-align:left;border-radius:12px;border:none;background:rgb(var(--rgb-surface-horizontal));color:var(--text-main);padding:9px;display:grid;gap:6px}.autoruns-comment-item p{margin:0;white-space:pre-wrap;color:var(--text-muted);font-size:.79rem}.autoruns-comment-item.selected{border-color:var(--line-strong)}.autoruns-comment-head{display:flex;justify-content:space-between;gap:8px;font-size:.75rem}.autoruns-msg.assistant{margin-right:12%}.autoruns-msg.user{margin-left:12%;border-color:transparent;background:rgb(var(--rgb-surface-focus))}.autoruns-decomposition-list{margin:0;padding-left:18px;display:grid;gap:7px;font-size:.8rem}.autoruns-comment-modal-backdrop{position:fixed;inset:0;background:rgba(var(--rgb-background),.74);display:grid;place-items:center;z-index:1800;padding:12px}.autoruns-comment-modal{width:min(660px,100%);border:none;border-radius:16px;background:rgb(var(--rgb-surface-horizontal));box-shadow:var(--shadow);padding:14px;display:grid;gap:10px}.autoruns-comment-modal h3{margin:0;font-size:.95rem}.autoruns-comment-quote{margin:0;border:none;border-radius:10px;background:rgb(var(--rgb-surface-focus));padding:8px;white-space:pre-wrap;max-height:150px;overflow:auto;font-size:.82rem}.autoruns-rating-row{display:flex;gap:8px}.autoruns-rating-dot{width:34px;height:34px;border-radius:999px;padding:0;border:none;background:rgb(var(--rgb-surface-focus));color:var(--text-muted);font-size:.95rem;box-shadow:none;transform:none}.autoruns-rating-dot:hover{border-color:var(--line-strong);box-shadow:none;transform:none}.autoruns-rating-dot.active{border-color:var(--line-strong);color:rgb(var(--rgb-active-text));background:rgb(var(--rgb-active))}.autoruns-coverage-list{display:grid;gap:8px}.autoruns-coverage-item{border:none;border-radius:10px;background:rgb(var(--rgb-surface-horizontal));padding:8px}.autoruns-coverage-head{display:flex;justify-content:space-between;gap:8px;font-size:.76rem;margin-bottom:5px}.autoruns-coverage-head span{color:var(--text-muted)}.autoruns-coverage-bar{height:7px;border-radius:999px;background:rgb(var(--rgb-surface-focus));overflow:hidden}.autoruns-coverage-bar>div{height:100%;border-radius:999px;background:rgb(var(--rgb-active))}@media(max-width:1200px){:root{--autoruns-col-width: 340px}.metrics-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(max-width:920px){:root{--autoruns-col-width: 320px}.grid-two,.runtime-grid{grid-template-columns:1fr}.metrics-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.autoruns-form-grid,.autoruns-dialog-toolbar,.autoruns-stats-grid{grid-template-columns:1fr}}@media(max-width:640px){:root{--autoruns-col-width: 300px}.app-root{padding:18px 12px 24px}.metrics-grid{grid-template-columns:1fr}}@keyframes rise{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}} diff --git a/llm_normalizer/frontend/dist/assets/index-BXQlrB3i.js b/llm_normalizer/frontend/dist/assets/index-BXQlrB3i.js deleted file mode 100644 index 9a161bc..0000000 --- a/llm_normalizer/frontend/dist/assets/index-BXQlrB3i.js +++ /dev/null @@ -1,13 +0,0 @@ -(function(){const h=document.createElement("link").relList;if(h&&h.supports&&h.supports("modulepreload"))return;for(const k of document.querySelectorAll('link[rel="modulepreload"]'))D(k);new MutationObserver(k=>{for(const F of k)if(F.type==="childList")for(const H of F.addedNodes)H.tagName==="LINK"&&H.rel==="modulepreload"&&D(H)}).observe(document,{childList:!0,subtree:!0});function p(k){const F={};return k.integrity&&(F.integrity=k.integrity),k.referrerPolicy&&(F.referrerPolicy=k.referrerPolicy),k.crossOrigin==="use-credentials"?F.credentials="include":k.crossOrigin==="anonymous"?F.credentials="omit":F.credentials="same-origin",F}function D(k){if(k.ep)return;k.ep=!0;const F=p(k);fetch(k.href,F)}})();function rc(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var bo={exports:{}},rl={},ei={exports:{}},se={};var Fu;function Xd(){if(Fu)return se;Fu=1;var a=Symbol.for("react.element"),h=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),H=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),te=Symbol.for("react.memo"),ce=Symbol.for("react.lazy"),z=Symbol.iterator;function L(m){return m===null||typeof m!="object"?null:(m=z&&m[z]||m["@@iterator"],typeof m=="function"?m:null)}var Le={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},me=Object.assign,re={};function G(m,_,Y){this.props=m,this.context=_,this.refs=re,this.updater=Y||Le}G.prototype.isReactComponent={},G.prototype.setState=function(m,_){if(typeof m!="object"&&typeof m!="function"&&m!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,m,_,"setState")},G.prototype.forceUpdate=function(m){this.updater.enqueueForceUpdate(this,m,"forceUpdate")};function De(){}De.prototype=G.prototype;function ye(m,_,Y){this.props=m,this.context=_,this.refs=re,this.updater=Y||Le}var We=ye.prototype=new De;We.constructor=ye,me(We,G.prototype),We.isPureReactComponent=!0;var xe=Array.isArray,ze=Object.prototype.hasOwnProperty,X={current:null},$e={key:!0,ref:!0,__self:!0,__source:!0};function Ne(m,_,Y){var J,le={},ee=null,de=null;if(_!=null)for(J in _.ref!==void 0&&(de=_.ref),_.key!==void 0&&(ee=""+_.key),_)ze.call(_,J)&&!$e.hasOwnProperty(J)&&(le[J]=_[J]);var ae=arguments.length-2;if(ae===1)le.children=Y;else if(1>>1,_=R[m];if(0>>1;mk(le,T))ee<_&&0>k(de,le)?(R[m]=de,R[ee]=T,m=ee):(R[m]=le,R[J]=T,m=J);else if(ee<_&&0>k(de,T))R[m]=de,R[ee]=T,m=ee;else break e}}return V}function k(R,V){var T=R.sortIndex-V.sortIndex;return T!==0?T:R.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var F=performance;a.unstable_now=function(){return F.now()}}else{var H=Date,Z=H.now();a.unstable_now=function(){return H.now()-Z}}var N=[],te=[],ce=1,z=null,L=3,Le=!1,me=!1,re=!1,G=typeof setTimeout=="function"?setTimeout:null,De=typeof clearTimeout=="function"?clearTimeout:null,ye=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function We(R){for(var V=p(te);V!==null;){if(V.callback===null)D(te);else if(V.startTime<=R)D(te),V.sortIndex=V.expirationTime,h(N,V);else break;V=p(te)}}function xe(R){if(re=!1,We(R),!me)if(p(N)!==null)me=!0,b(ze);else{var V=p(te);V!==null&&pe(xe,V.startTime-R)}}function ze(R,V){me=!1,re&&(re=!1,De(Ne),Ne=-1),Le=!0;var T=L;try{for(We(V),z=p(N);z!==null&&(!(z.expirationTime>V)||R&&!gt());){var m=z.callback;if(typeof m=="function"){z.callback=null,L=z.priorityLevel;var _=m(z.expirationTime<=V);V=a.unstable_now(),typeof _=="function"?z.callback=_:z===p(N)&&D(N),We(V)}else D(N);z=p(N)}if(z!==null)var Y=!0;else{var J=p(te);J!==null&&pe(xe,J.startTime-V),Y=!1}return Y}finally{z=null,L=T,Le=!1}}var X=!1,$e=null,Ne=-1,ut=5,be=-1;function gt(){return!(a.unstable_now()-beR||125m?(R.sortIndex=T,h(te,R),p(N)===null&&R===p(te)&&(re?(De(Ne),Ne=-1):re=!0,pe(xe,T-m))):(R.sortIndex=_,h(N,R),me||Le||(me=!0,b(ze))),R},a.unstable_shouldYield=gt,a.unstable_wrapCallback=function(R){var V=L;return function(){var T=L;L=V;try{return R.apply(this,arguments)}finally{L=T}}}})(ri)),ri}var Vu;function nf(){return Vu||(Vu=1,ni.exports=tf()),ni.exports}var Qu;function rf(){if(Qu)return vt;Qu=1;var a=oi(),h=nf();function p(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),N=Object.prototype.hasOwnProperty,te=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ce={},z={};function L(e){return N.call(z,e)?!0:N.call(ce,e)?!1:te.test(e)?z[e]=!0:(ce[e]=!0,!1)}function Le(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function me(e,t,n,r){if(t===null||typeof t>"u"||Le(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function re(e,t,n,r,l,s,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=i}var G={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){G[e]=new re(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];G[t]=new re(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){G[e]=new re(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){G[e]=new re(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){G[e]=new re(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){G[e]=new re(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){G[e]=new re(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){G[e]=new re(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){G[e]=new re(e,5,!1,e.toLowerCase(),null,!1,!1)});var De=/[\-:]([a-z])/g;function ye(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(De,ye);G[t]=new re(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(De,ye);G[t]=new re(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(De,ye);G[t]=new re(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){G[e]=new re(e,1,!1,e.toLowerCase(),null,!1,!1)}),G.xlinkHref=new re("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){G[e]=new re(e,1,!1,e.toLowerCase(),null,!0,!0)});function We(e,t,n,r){var l=G.hasOwnProperty(t)?G[t]:null;(l!==null?l.type!==0:r||!(2u||l[i]!==s[u]){var d=` -`+l[i].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=i&&0<=u);break}}}finally{Y=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?_(e):""}function le(e){switch(e.tag){case 5:return _(e.type);case 16:return _("Lazy");case 13:return _("Suspense");case 19:return _("SuspenseList");case 0:case 2:case 15:return e=J(e.type,!1),e;case 11:return e=J(e.type.render,!1),e;case 1:return e=J(e.type,!0),e;default:return""}}function ee(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case $e:return"Fragment";case X:return"Portal";case ut:return"Profiler";case Ne:return"StrictMode";case He:return"Suspense";case Oe:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case gt:return(e.displayName||"Context")+".Consumer";case be:return(e._context.displayName||"Context")+".Provider";case he:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ye:return t=e.displayName||null,t!==null?t:ee(e.type)||"Memo";case b:t=e._payload,e=e._init;try{return ee(e(t))}catch{}}return null}function de(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ee(t);case 8:return t===Ne?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ae(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function oe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ke(e){var t=oe(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,s.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ot(e){e._valueTracker||(e._valueTracker=ke(e))}function an(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=oe(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Gt(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function kt(e,t){var n=t.checked;return T({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Dn(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ae(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function un(e,t){t=t.checked,t!=null&&We(e,"checked",t,!1)}function ct(e,t){un(e,t);var n=ae(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?et(e,t.type,n):t.hasOwnProperty("defaultValue")&&et(e,t.type,ae(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ie(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function et(e,t,n){(t!=="number"||Gt(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Mt=Array.isArray;function yt(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Ct.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Je(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var K={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fn=["Webkit","ms","Moz","O"];Object.keys(K).forEach(function(e){fn.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),K[t]=K[e]})});function tt(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||K.hasOwnProperty(e)&&K[e]?(""+t).trim():t+"px"}function Yt(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=tt(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var pn=T({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Dt(e,t){if(t){if(pn[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(p(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(p(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(p(61))}if(t.style!=null&&typeof t.style!="object")throw Error(p(62))}}function mn(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var hn=null;function c(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var E=null,ne=null,Ee=null;function Jt(e){if(e=Hr(e)){if(typeof E!="function")throw Error(p(280));var t=e.stateNode;t&&(t=Rl(t),E(e.stateNode,e.type,t))}}function Xn(e){ne?Ee?Ee.push(e):Ee=[e]:ne=e}function Zn(){if(ne){var e=ne,t=Ee;if(Ee=ne=null,Jt(e),t)for(e=0;e>>=0,e===0?32:31-(pc(e)/mc|0)|0}var dl=64,fl=4194304;function kr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function pl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,s=e.pingedLanes,i=n&268435455;if(i!==0){var u=i&~l;u!==0?r=kr(u):(s&=i,s!==0&&(r=kr(s)))}else i=n&~l,i!==0?r=kr(i):s!==0&&(r=kr(s));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,s=t&-t,l>=s||l===16&&(s&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Cr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-It(t),e[t]=n}function yc(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Or),Li=" ",zi=!1;function Oi(e,t){switch(e){case"keyup":return Kc.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mi(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var tr=!1;function Gc(e,t){switch(e){case"compositionend":return Mi(t);case"keypress":return t.which!==32?null:(zi=!0,Li);case"textInput":return e=t.data,e===Li&&zi?null:e;default:return null}}function Yc(e,t){if(tr)return e==="compositionend"||!zs&&Oi(e,t)?(e=Ci(),yl=Ns=_n=null,tr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Bi(n)}}function Vi(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Vi(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qi(){for(var e=window,t=Gt();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Gt(e.document)}return t}function Ds(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function ld(e){var t=Qi(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Vi(n.ownerDocument.documentElement,n)){if(r!==null&&Ds(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,s=Math.min(r.start,l);r=r.end===void 0?s:Math.min(r.end,l),!e.extend&&s>r&&(l=r,r=s,s=l),l=Hi(n,s);var i=Hi(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,nr=null,Is=null,Ar=null,As=!1;function Wi(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;As||nr==null||nr!==Gt(r)||(r=nr,"selectionStart"in r&&Ds(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ar&&Ir(Ar,r)||(Ar=r,r=Nl(Is,"onSelect"),0ir||(e.current=Ys[ir],Ys[ir]=null,ir--)}function _e(e,t){ir++,Ys[ir]=e.current,e.current=t}var kn={},nt=jn(kn),dt=jn(!1),Un=kn;function ar(e,t){var n=e.type.contextTypes;if(!n)return kn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},s;for(s in n)l[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function ft(e){return e=e.childContextTypes,e!=null}function Tl(){je(dt),je(nt)}function oa(e,t,n){if(nt.current!==kn)throw Error(p(168));_e(nt,t),_e(dt,n)}function ia(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(p(108,de(e)||"Unknown",l));return T({},n,r)}function Ll(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||kn,Un=nt.current,_e(nt,e),_e(dt,dt.current),!0}function aa(e,t,n){var r=e.stateNode;if(!r)throw Error(p(169));n?(e=ia(e,t,Un),r.__reactInternalMemoizedMergedChildContext=e,je(dt),je(nt),_e(nt,e)):je(dt),_e(dt,n)}var Zt=null,zl=!1,Js=!1;function ua(e){Zt===null?Zt=[e]:Zt.push(e)}function vd(e){zl=!0,ua(e)}function Cn(){if(!Js&&Zt!==null){Js=!0;var e=0,t=ve;try{var n=Zt;for(ve=1;e>=i,l-=i,bt=1<<32-It(t)+l|n<q?(Ge=W,W=null):Ge=W.sibling;var fe=S(v,W,g[q],C);if(fe===null){W===null&&(W=Ge);break}e&&W&&fe.alternate===null&&t(v,W),f=s(fe,f,q),Q===null?$=fe:Q.sibling=fe,Q=fe,W=Ge}if(q===g.length)return n(v,W),Ce&&Bn(v,q),$;if(W===null){for(;qq?(Ge=W,W=null):Ge=W.sibling;var Mn=S(v,W,fe.value,C);if(Mn===null){W===null&&(W=Ge);break}e&&W&&Mn.alternate===null&&t(v,W),f=s(Mn,f,q),Q===null?$=Mn:Q.sibling=Mn,Q=Mn,W=Ge}if(fe.done)return n(v,W),Ce&&Bn(v,q),$;if(W===null){for(;!fe.done;q++,fe=g.next())fe=j(v,fe.value,C),fe!==null&&(f=s(fe,f,q),Q===null?$=fe:Q.sibling=fe,Q=fe);return Ce&&Bn(v,q),$}for(W=r(v,W);!fe.done;q++,fe=g.next())fe=M(W,v,q,fe.value,C),fe!==null&&(e&&fe.alternate!==null&&W.delete(fe.key===null?q:fe.key),f=s(fe,f,q),Q===null?$=fe:Q.sibling=fe,Q=fe);return e&&W.forEach(function(Jd){return t(v,Jd)}),Ce&&Bn(v,q),$}function Fe(v,f,g,C){if(typeof g=="object"&&g!==null&&g.type===$e&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case ze:e:{for(var $=g.key,Q=f;Q!==null;){if(Q.key===$){if($=g.type,$===$e){if(Q.tag===7){n(v,Q.sibling),f=l(Q,g.props.children),f.return=v,v=f;break e}}else if(Q.elementType===$||typeof $=="object"&&$!==null&&$.$$typeof===b&&ha($)===Q.type){n(v,Q.sibling),f=l(Q,g.props),f.ref=Vr(v,Q,g),f.return=v,v=f;break e}n(v,Q);break}else t(v,Q);Q=Q.sibling}g.type===$e?(f=Yn(g.props.children,v.mode,C,g.key),f.return=v,v=f):(C=os(g.type,g.key,g.props,null,v.mode,C),C.ref=Vr(v,f,g),C.return=v,v=C)}return i(v);case X:e:{for(Q=g.key;f!==null;){if(f.key===Q)if(f.tag===4&&f.stateNode.containerInfo===g.containerInfo&&f.stateNode.implementation===g.implementation){n(v,f.sibling),f=l(f,g.children||[]),f.return=v,v=f;break e}else{n(v,f);break}else t(v,f);f=f.sibling}f=Go(g,v.mode,C),f.return=v,v=f}return i(v);case b:return Q=g._init,Fe(v,f,Q(g._payload),C)}if(Mt(g))return A(v,f,g,C);if(V(g))return U(v,f,g,C);Il(v,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,f!==null&&f.tag===6?(n(v,f.sibling),f=l(f,g),f.return=v,v=f):(n(v,f),f=qo(g,v.mode,C),f.return=v,v=f),i(v)):n(v,f)}return Fe}var fr=va(!0),ga=va(!1),Al=jn(null),Fl=null,pr=null,no=null;function ro(){no=pr=Fl=null}function lo(e){var t=Al.current;je(Al),e._currentValue=t}function so(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function mr(e,t){Fl=e,no=pr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(pt=!0),e.firstContext=null)}function Rt(e){var t=e._currentValue;if(no!==e)if(e={context:e,memoizedValue:t,next:null},pr===null){if(Fl===null)throw Error(p(308));pr=e,Fl.dependencies={lanes:0,firstContext:e}}else pr=pr.next=e;return t}var Hn=null;function oo(e){Hn===null?Hn=[e]:Hn.push(e)}function ya(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,oo(t)):(n.next=l.next,l.next=n),t.interleaved=n,tn(e,r)}function tn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Nn=!1;function io(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function xa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function nn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function En(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(ue&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,tn(e,n)}return l=r.interleaved,l===null?(t.next=t,oo(r)):(t.next=l.next,l.next=t),r.interleaved=t,tn(e,n)}function Ul(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ss(e,n)}}function _a(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?l=s=i:s=s.next=i,n=n.next}while(n!==null);s===null?l=s=t:s=s.next=t}else l=s=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function $l(e,t,n,r){var l=e.updateQueue;Nn=!1;var s=l.firstBaseUpdate,i=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var d=u,y=d.next;d.next=null,i===null?s=y:i.next=y,i=d;var w=e.alternate;w!==null&&(w=w.updateQueue,u=w.lastBaseUpdate,u!==i&&(u===null?w.firstBaseUpdate=y:u.next=y,w.lastBaseUpdate=d))}if(s!==null){var j=l.baseState;i=0,w=y=d=null,u=s;do{var S=u.lane,M=u.eventTime;if((r&S)===S){w!==null&&(w=w.next={eventTime:M,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var A=e,U=u;switch(S=t,M=n,U.tag){case 1:if(A=U.payload,typeof A=="function"){j=A.call(M,j,S);break e}j=A;break e;case 3:A.flags=A.flags&-65537|128;case 0:if(A=U.payload,S=typeof A=="function"?A.call(M,j,S):A,S==null)break e;j=T({},j,S);break e;case 2:Nn=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,S=l.effects,S===null?l.effects=[u]:S.push(u))}else M={eventTime:M,lane:S,tag:u.tag,payload:u.payload,callback:u.callback,next:null},w===null?(y=w=M,d=j):w=w.next=M,i|=S;if(u=u.next,u===null){if(u=l.shared.pending,u===null)break;S=u,u=S.next,S.next=null,l.lastBaseUpdate=S,l.shared.pending=null}}while(!0);if(w===null&&(d=j),l.baseState=d,l.firstBaseUpdate=y,l.lastBaseUpdate=w,t=l.shared.interleaved,t!==null){l=t;do i|=l.lane,l=l.next;while(l!==t)}else s===null&&(l.shared.lanes=0);Wn|=i,e.lanes=i,e.memoizedState=j}}function Sa(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=po.transition;po.transition={};try{e(!1),t()}finally{ve=n,po.transition=r}}function $a(){return Tt().memoizedState}function _d(e,t,n){var r=Ln(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ba(e))Ha(t,n);else if(n=ya(e,t,n,r),n!==null){var l=it();Ht(n,e,r,l),Va(n,t,r)}}function Sd(e,t,n){var r=Ln(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ba(e))Ha(t,l);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var i=t.lastRenderedState,u=s(i,n);if(l.hasEagerState=!0,l.eagerState=u,At(u,i)){var d=t.interleaved;d===null?(l.next=l,oo(t)):(l.next=d.next,d.next=l),t.interleaved=l;return}}catch{}n=ya(e,t,l,r),n!==null&&(l=it(),Ht(n,e,r,l),Va(n,t,r))}}function Ba(e){var t=e.alternate;return e===Re||t!==null&&t===Re}function Ha(e,t){qr=Vl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Va(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ss(e,n)}}var Kl={readContext:Rt,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useInsertionEffect:rt,useLayoutEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useMutableSource:rt,useSyncExternalStore:rt,useId:rt,unstable_isNewReconciler:!1},wd={readContext:Rt,useCallback:function(e,t){return Kt().memoizedState=[e,t===void 0?null:t],e},useContext:Rt,useEffect:za,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ql(4194308,4,Da.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ql(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ql(4,2,e,t)},useMemo:function(e,t){var n=Kt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Kt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=_d.bind(null,Re,e),[r.memoizedState,e]},useRef:function(e){var t=Kt();return e={current:e},t.memoizedState=e},useState:Ta,useDebugValue:_o,useDeferredValue:function(e){return Kt().memoizedState=e},useTransition:function(){var e=Ta(!1),t=e[0];return e=xd.bind(null,e[1]),Kt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Re,l=Kt();if(Ce){if(n===void 0)throw Error(p(407));n=n()}else{if(n=t(),qe===null)throw Error(p(349));(Qn&30)!==0||Ca(r,t,n)}l.memoizedState=n;var s={value:n,getSnapshot:t};return l.queue=s,za(Ea.bind(null,r,s,e),[e]),r.flags|=2048,Jr(9,Na.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Kt(),t=qe.identifierPrefix;if(Ce){var n=en,r=bt;n=(r&~(1<<32-It(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Gr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Qt]=t,e[Br]=r,uu(e,t,!1,!1),t.stateNode=e;e:{switch(i=mn(n,r),n){case"dialog":we("cancel",e),we("close",e),l=r;break;case"iframe":case"object":case"embed":we("load",e),l=r;break;case"video":case"audio":for(l=0;lxr&&(t.flags|=128,r=!0,Xr(s,!1),t.lanes=4194304)}else{if(!r)if(e=Bl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Xr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!Ce)return lt(t),null}else 2*Ae()-s.renderingStartTime>xr&&n!==1073741824&&(t.flags|=128,r=!0,Xr(s,!1),t.lanes=4194304);s.isBackwards?(i.sibling=t.child,t.child=i):(n=s.last,n!==null?n.sibling=i:t.child=i,s.last=i)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Ae(),t.sibling=null,n=Pe.current,_e(Pe,r?n&1|2:n&1),t):(lt(t),null);case 22:case 23:return Qo(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(jt&1073741824)!==0&&(lt(t),t.subtreeFlags&6&&(t.flags|=8192)):lt(t),null;case 24:return null;case 25:return null}throw Error(p(156,t.tag))}function Td(e,t){switch(Zs(t),t.tag){case 1:return ft(t.type)&&Tl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return hr(),je(dt),je(nt),fo(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return uo(t),null;case 13:if(je(Pe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(p(340));dr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return je(Pe),null;case 4:return hr(),null;case 10:return lo(t.type._context),null;case 22:case 23:return Qo(),null;case 24:return null;default:return null}}var Jl=!1,st=!1,Ld=typeof WeakSet=="function"?WeakSet:Set,I=null;function gr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Me(e,t,r)}else n.current=null}function zo(e,t,n){try{n()}catch(r){Me(e,t,r)}}var fu=!1;function zd(e,t){if(Vs=vl,e=Qi(),Ds(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var i=0,u=-1,d=-1,y=0,w=0,j=e,S=null;t:for(;;){for(var M;j!==n||l!==0&&j.nodeType!==3||(u=i+l),j!==s||r!==0&&j.nodeType!==3||(d=i+r),j.nodeType===3&&(i+=j.nodeValue.length),(M=j.firstChild)!==null;)S=j,j=M;for(;;){if(j===e)break t;if(S===n&&++y===l&&(u=i),S===s&&++w===r&&(d=i),(M=j.nextSibling)!==null)break;j=S,S=j.parentNode}j=M}n=u===-1||d===-1?null:{start:u,end:d}}else n=null}n=n||{start:0,end:0}}else n=null;for(Qs={focusedElem:e,selectionRange:n},vl=!1,I=t;I!==null;)if(t=I,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,I=e;else for(;I!==null;){t=I;try{var A=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(A!==null){var U=A.memoizedProps,Fe=A.memoizedState,v=t.stateNode,f=v.getSnapshotBeforeUpdate(t.elementType===t.type?U:Ut(t.type,U),Fe);v.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163))}}catch(C){Me(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,I=e;break}I=t.return}return A=fu,fu=!1,A}function Zr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var s=l.destroy;l.destroy=void 0,s!==void 0&&zo(t,n,s)}l=l.next}while(l!==r)}}function Xl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Oo(e){var t=e.ref;if(t!==null){var n=e.stateNode;e.tag,e=n,typeof t=="function"?t(e):t.current=e}}function pu(e){var t=e.alternate;t!==null&&(e.alternate=null,pu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Qt],delete t[Br],delete t[Gs],delete t[md],delete t[hd])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function mu(e){return e.tag===5||e.tag===3||e.tag===4}function hu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mu(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Mo(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Pl));else if(r!==4&&(e=e.child,e!==null))for(Mo(e,t,n),e=e.sibling;e!==null;)Mo(e,t,n),e=e.sibling}function Do(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Do(e,t,n),e=e.sibling;e!==null;)Do(e,t,n),e=e.sibling}var Xe=null,$t=!1;function Pn(e,t,n){for(n=n.child;n!==null;)vu(e,t,n),n=n.sibling}function vu(e,t,n){if(Vt&&typeof Vt.onCommitFiberUnmount=="function")try{Vt.onCommitFiberUnmount(cl,n)}catch{}switch(n.tag){case 5:st||gr(n,t);case 6:var r=Xe,l=$t;Xe=null,Pn(e,t,n),Xe=r,$t=l,Xe!==null&&($t?(e=Xe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Xe.removeChild(n.stateNode));break;case 18:Xe!==null&&($t?(e=Xe,n=n.stateNode,e.nodeType===8?qs(e.parentNode,n):e.nodeType===1&&qs(e,n),Tr(e)):qs(Xe,n.stateNode));break;case 4:r=Xe,l=$t,Xe=n.stateNode.containerInfo,$t=!0,Pn(e,t,n),Xe=r,$t=l;break;case 0:case 11:case 14:case 15:if(!st&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var s=l,i=s.destroy;s=s.tag,i!==void 0&&((s&2)!==0||(s&4)!==0)&&zo(n,t,i),l=l.next}while(l!==r)}Pn(e,t,n);break;case 1:if(!st&&(gr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){Me(n,t,u)}Pn(e,t,n);break;case 21:Pn(e,t,n);break;case 22:n.mode&1?(st=(r=st)||n.memoizedState!==null,Pn(e,t,n),st=r):Pn(e,t,n);break;default:Pn(e,t,n)}}function gu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ld),t.forEach(function(r){var l=Bd.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Bt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~s}if(r=l,r=Ae()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Md(r/1960))-r,10e?16:e,Tn===null)var r=!1;else{if(e=Tn,Tn=null,ns=0,(ue&6)!==0)throw Error(p(331));var l=ue;for(ue|=4,I=e.current;I!==null;){var s=I,i=s.child;if((I.flags&16)!==0){var u=s.deletions;if(u!==null){for(var d=0;dAe()-Fo?qn(e,0):Ao|=n),ht(e,t)}function Tu(e,t){t===0&&((e.mode&1)===0?t=1:(t=fl,fl<<=1,(fl&130023424)===0&&(fl=4194304)));var n=it();e=tn(e,t),e!==null&&(Cr(e,t,n),ht(e,n))}function $d(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Tu(e,n)}function Bd(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(p(314))}r!==null&&r.delete(t),Tu(e,n)}var Lu;Lu=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||dt.current)pt=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return pt=!1,Pd(e,t,n);pt=(e.flags&131072)!==0}else pt=!1,Ce&&(t.flags&1048576)!==0&&ca(t,Ml,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Yl(e,t),e=t.pendingProps;var l=ar(t,nt.current);mr(t,n),l=ho(null,t,r,e,l,n);var s=vo();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ft(r)?(s=!0,Ll(t)):s=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,io(t),l.updater=ql,t.stateNode=l,l._reactInternals=t,wo(t,r,e,n),t=No(null,t,r,!0,s,n)):(t.tag=0,Ce&&s&&Xs(t),ot(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Yl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Vd(r),e=Ut(r,e),l){case 0:t=Co(null,t,r,e,n);break e;case 1:t=ru(null,t,r,e,n);break e;case 11:t=Za(null,t,r,e,n);break e;case 14:t=ba(null,t,r,Ut(r.type,e),n);break e}throw Error(p(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ut(r,l),Co(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ut(r,l),ru(e,t,r,l,n);case 3:e:{if(lu(t),e===null)throw Error(p(387));r=t.pendingProps,s=t.memoizedState,l=s.element,xa(e,t),$l(t,r,null,n);var i=t.memoizedState;if(r=i.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){l=vr(Error(p(423)),t),t=su(e,t,r,n,l);break e}else if(r!==l){l=vr(Error(p(424)),t),t=su(e,t,r,n,l);break e}else for(wt=wn(t.stateNode.containerInfo.firstChild),St=t,Ce=!0,Ft=null,n=ga(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(dr(),r===l){t=rn(e,t,n);break e}ot(e,t,r,n)}t=t.child}return t;case 5:return wa(t),e===null&&eo(t),r=t.type,l=t.pendingProps,s=e!==null?e.memoizedProps:null,i=l.children,Ws(r,l)?i=null:s!==null&&Ws(r,s)&&(t.flags|=32),nu(e,t),ot(e,t,i,n),t.child;case 6:return e===null&&eo(t),null;case 13:return ou(e,t,n);case 4:return ao(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=fr(t,null,r,n):ot(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ut(r,l),Za(e,t,r,l,n);case 7:return ot(e,t,t.pendingProps,n),t.child;case 8:return ot(e,t,t.pendingProps.children,n),t.child;case 12:return ot(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,s=t.memoizedProps,i=l.value,_e(Al,r._currentValue),r._currentValue=i,s!==null)if(At(s.value,i)){if(s.children===l.children&&!dt.current){t=rn(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var u=s.dependencies;if(u!==null){i=s.child;for(var d=u.firstContext;d!==null;){if(d.context===r){if(s.tag===1){d=nn(-1,n&-n),d.tag=2;var y=s.updateQueue;if(y!==null){y=y.shared;var w=y.pending;w===null?d.next=d:(d.next=w.next,w.next=d),y.pending=d}}s.lanes|=n,d=s.alternate,d!==null&&(d.lanes|=n),so(s.return,n,t),u.lanes|=n;break}d=d.next}}else if(s.tag===10)i=s.type===t.type?null:s.child;else if(s.tag===18){if(i=s.return,i===null)throw Error(p(341));i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),so(i,n,t),i=s.sibling}else i=s.child;if(i!==null)i.return=s;else for(i=s;i!==null;){if(i===t){i=null;break}if(s=i.sibling,s!==null){s.return=i.return,i=s;break}i=i.return}s=i}ot(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,mr(t,n),l=Rt(l),r=r(l),t.flags|=1,ot(e,t,r,n),t.child;case 14:return r=t.type,l=Ut(r,t.pendingProps),l=Ut(r.type,l),ba(e,t,r,l,n);case 15:return eu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ut(r,l),Yl(e,t),t.tag=1,ft(r)?(e=!0,Ll(t)):e=!1,mr(t,n),Wa(t,r,l),wo(t,r,l,n),No(null,t,r,!0,e,n);case 19:return au(e,t,n);case 22:return tu(e,t,n)}throw Error(p(156,t.tag))};function zu(e,t){return di(e,t)}function Hd(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zt(e,t,n,r){return new Hd(e,t,n,r)}function Ko(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vd(e){if(typeof e=="function")return Ko(e)?1:0;if(e!=null){if(e=e.$$typeof,e===he)return 11;if(e===Ye)return 14}return 2}function On(e,t){var n=e.alternate;return n===null?(n=zt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function os(e,t,n,r,l,s){var i=2;if(r=e,typeof e=="function")Ko(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case $e:return Yn(n.children,l,s,t);case Ne:i=8,l|=8;break;case ut:return e=zt(12,n,t,l|2),e.elementType=ut,e.lanes=s,e;case He:return e=zt(13,n,t,l),e.elementType=He,e.lanes=s,e;case Oe:return e=zt(19,n,t,l),e.elementType=Oe,e.lanes=s,e;case pe:return is(n,l,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case be:i=10;break e;case gt:i=9;break e;case he:i=11;break e;case Ye:i=14;break e;case b:i=16,r=null;break e}throw Error(p(130,e==null?e:typeof e,""))}return t=zt(i,n,t,l),t.elementType=e,t.type=r,t.lanes=s,t}function Yn(e,t,n,r){return e=zt(7,e,r,t),e.lanes=n,e}function is(e,t,n,r){return e=zt(22,e,r,t),e.elementType=pe,e.lanes=n,e.stateNode={isHidden:!1},e}function qo(e,t,n){return e=zt(6,e,null,t),e.lanes=n,e}function Go(e,t,n){return t=zt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Qd(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_s(0),this.expirationTimes=_s(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_s(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Yo(e,t,n,r,l,s,i,u,d){return e=new Qd(e,t,n,u,d),t===1?(t=1,s===!0&&(t|=8)):t=0,s=zt(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},io(s),e}function Wd(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(h){console.error(h)}}return a(),ti.exports=rf(),ti.exports}var Ku;function sf(){if(Ku)return ms;Ku=1;var a=lf();return ms.createRoot=a.createRoot,ms.hydrateRoot=a.hydrateRoot,ms}var of=sf();const af=rc(of),uf="/api";async function Te(a,h){const p=await fetch(`${uf}${a}`,{...h,headers:{"Content-Type":"application/json",...h?.headers??{}}}),D=await p.json();if(!p.ok){const k=D.error?.message??"Ошибка запроса";throw new Error(k)}return D}const Ue={async listModels(a){return Te("/llm/models",{method:"POST",body:JSON.stringify({llmProvider:a.llmProvider,apiKey:a.apiKey,model:a.model,baseUrl:a.baseUrl})})},async testConnection(a){return Te("/llm/test-connection",{method:"POST",body:JSON.stringify({llmProvider:a.llmProvider,apiKey:a.apiKey,model:a.model,baseUrl:a.baseUrl})})},async normalize(a){return Te("/normalize",{method:"POST",body:JSON.stringify({llmProvider:a.connection.llmProvider,apiKey:a.connection.apiKey,model:a.connection.model,baseUrl:a.connection.baseUrl,temperature:a.connection.temperature,maxOutputTokens:a.connection.maxOutputTokens,promptVersion:a.promptVersion,systemPrompt:a.prompts.systemPrompt,developerPrompt:a.prompts.developerPrompt,domainPrompt:a.prompts.domainPrompt,fewShotExamples:a.prompts.fewShotExamples,userQuestion:a.query.userQuestion,context:{period_hint:a.query.periodHint??"",business_context:a.query.businessContext??"",expected_route:a.query.expectedRoute??""},saveAsTestCase:!!a.saveAsTestCase,useMock:!!a.useMock})})},async loadHistory(){return Te("/history")},async loadTrace(a){return Te(`/history/${a}`)},async loadPresets(){return Te("/presets")},async savePreset(a){return Te("/presets/save",{method:"POST",body:JSON.stringify(a)})},async runEval(a){return Te("/eval/run",{method:"POST",body:JSON.stringify({normalizeConfig:{llmProvider:a.connection.llmProvider,apiKey:a.connection.apiKey,model:a.connection.model,baseUrl:a.connection.baseUrl,temperature:a.connection.temperature,maxOutputTokens:a.connection.maxOutputTokens,promptVersion:a.promptVersion,systemPrompt:a.prompts.systemPrompt,developerPrompt:a.prompts.developerPrompt,domainPrompt:a.prompts.domainPrompt,fewShotExamples:a.prompts.fewShotExamples},caseIds:a.caseIds,useMock:!!a.useMock,mode:a.mode??"standard",caseSetFile:a.caseSetFile,rawQuestions:a.rawQuestions})})},async startRun(){return Te("/accounting-agent/v1/runs/start",{method:"POST",body:JSON.stringify({initiator:"ndc_operator",source:"gui"})})},async finishRun(a){return Te("/accounting-agent/v1/runs/finish",{method:"POST",body:JSON.stringify({runId:a,status:"DONE",source:"gui",reason:"Остановлено оператором из GUI"})})},async listRuns(){return Te("/accounting-agent/v1/runs")},async listResults(){return Te("/accounting-agent/v1/results")},async runTrace(a){return Te(`/accounting-agent/v1/trace/run/${a}`)},async sendAssistantMessage(a){return Te("/assistant/message",{method:"POST",body:JSON.stringify({session_id:a.sessionId??"",mode:"assistant",message:a.userMessage,user_message:a.userMessage,llmProvider:a.connection.llmProvider,apiKey:a.connection.apiKey,model:a.connection.model,baseUrl:a.connection.baseUrl,temperature:a.connection.temperature,maxOutputTokens:a.connection.maxOutputTokens,promptVersion:a.promptVersion??"address_query_runtime_v1",systemPrompt:a.prompts.systemPrompt,developerPrompt:a.prompts.developerPrompt,domainPrompt:a.prompts.domainPrompt,fewShotExamples:a.prompts.fewShotExamples,context:{period_hint:a.context?.periodHint??"",business_context:a.context?.businessContext??""},useMock:!!a.useMock})})},async loadAssistantSession(a){return Te(`/assistant/session/${a}`)},async loadAutoRunsHistory(a){const h=new URLSearchParams;a?.from&&h.set("from",a.from),a?.to&&h.set("to",a.to),a?.target&&h.set("target",a.target),a?.mode&&h.set("mode",a.mode),a?.use_mock&&h.set("use_mock",a.use_mock),a?.prompt_contains&&h.set("prompt_contains",a.prompt_contains),typeof a?.limit=="number"&&h.set("limit",String(a.limit)),typeof a?.scan_limit=="number"&&h.set("scan_limit",String(a.scan_limit));const p=h.toString();return Te(`/autoruns/history${p?`?${p}`:""}`)},async loadAutoRunDetail(a){return Te(`/autoruns/history/${encodeURIComponent(a)}`)},async loadAutoRunCaseDialog(a,h){return Te(`/autoruns/history/${encodeURIComponent(a)}/case/${encodeURIComponent(h)}/dialog`)},async loadAutoRunAnnotations(a){const h=new URLSearchParams;a?.run_id&&h.set("run_id",a.run_id),a?.case_id&&h.set("case_id",a.case_id),typeof a?.min_rating=="number"&&h.set("min_rating",String(a.min_rating)),a?.manual_case_decision&&h.set("manual_case_decision",a.manual_case_decision),typeof a?.limit=="number"&&h.set("limit",String(a.limit));const p=h.toString();return Te(`/autoruns/annotations${p?`?${p}`:""}`)},async saveAutoRunAnnotation(a){return Te("/autoruns/annotations",{method:"POST",body:JSON.stringify(a)})},async loadAutoRunPostAnalysis(a){const h=new URLSearchParams;a?.run_id&&h.set("run_id",a.run_id),typeof a?.limit_per_queue=="number"&&h.set("limit_per_queue",String(a.limit_per_queue)),typeof a?.annotation_limit=="number"&&h.set("annotation_limit",String(a.annotation_limit)),typeof a?.scan_limit=="number"&&h.set("scan_limit",String(a.scan_limit)),a?.from&&h.set("from",a.from),a?.to&&h.set("to",a.to),a?.target&&h.set("target",a.target),a?.mode&&h.set("mode",a.mode),a?.use_mock&&h.set("use_mock",a.use_mock),a?.prompt_contains&&h.set("prompt_contains",a.prompt_contains);const p=h.toString();return Te(`/autoruns/post-analysis${p?`?${p}`:""}`)},async loadAutoRunAutogenHistory(a){const h=new URLSearchParams;a?.mode&&h.set("mode",a.mode),typeof a?.limit=="number"&&h.set("limit",String(a.limit));const p=h.toString();return Te(`/autoruns/autogen/history${p?`?${p}`:""}`)},async generateAutoRunQuestions(a){return Te("/autoruns/autogen/generate",{method:"POST",body:JSON.stringify(a)})}};function at({value:a}){return o.jsx("pre",{className:"json-view",children:JSON.stringify(a??{},null,2)})}function on({title:a,subtitle:h,actions:p,className:D,hideHeader:k,children:F}){return o.jsxs("section",{className:D?`panel-frame ${D}`:"panel-frame",children:[k?null:o.jsxs("header",{className:"panel-header",children:[o.jsxs("div",{children:[o.jsx("h2",{children:a}),h?o.jsx("p",{children:h}):null]}),p?o.jsx("div",{className:"panel-actions",children:p}):null]}),o.jsx("div",{className:"panel-body",children:F})]})}const qu={fromLocal:"",toLocal:"",target:"all",mode:"all",useMock:"any",promptContains:"",limit:120},hs="needs_dialog_policy_fix",cf={mode:"codex_creative",count:24,domain:"",persistToEvalCases:!0,generatedBy:"manual_reviewer"};function df(a){const h=a.getFullYear(),p=String(a.getMonth()+1).padStart(2,"0"),D=String(a.getDate()).padStart(2,"0"),k=String(a.getHours()).padStart(2,"0"),F=String(a.getMinutes()).padStart(2,"0");return`${h}-${p}-${D}T${k}:${F}`}function Gu(){const a=new Date;return a.setDate(a.getDate()-14),df(a)}function vs(a){if(!a.trim())return;const h=Date.parse(a);if(Number.isFinite(h))return new Date(h).toISOString()}function Sr(a){if(!a)return"нет данных";const h=Date.parse(a);return Number.isFinite(h)?new Date(h).toLocaleString("ru-RU"):a}function ff(a,h){return h<=0?0:Math.max(0,Math.min(100,Number((a/h*100).toFixed(1))))}function ll(a){return typeof a!="number"?"нет данных":`${a.toFixed(1)}%`}function pf(a){return a==="assistant_stage1"?"assistant/s1":a==="assistant_stage2"?"assistant/s2":a==="assistant_p0"?"assistant/p0":a}function Yu(a){return a==="up"?"Рост":a==="down"?"Регресс":"Без изменений"}function mf(a,h){return a.find(p=>p.case_id===h)??null}function Ju(a){const h=Math.max(1,Math.min(5,Math.round(a)));return`${"●".repeat(h)}${"○".repeat(5-h)}`}function Xu(a){return a.length===0?o.jsx("p",{className:"muted",children:"Покрытие доменов пока не сформировано."}):o.jsx("div",{className:"autoruns-coverage-list",children:a.map(h=>{const p=ff(h.closed_cases,h.total_cases);return o.jsxs("div",{className:"autoruns-coverage-item",children:[o.jsxs("div",{className:"autoruns-coverage-head",children:[o.jsx("strong",{children:h.domain}),o.jsxs("span",{children:[h.closed_cases,"/",h.total_cases," (",p,"%)"]})]}),o.jsx("div",{className:"autoruns-coverage-bar",children:o.jsx("div",{style:{width:`${p}%`}})})]},h.domain)})})}function hf({connection:a,prompts:h,assistantPromptVersion:p,decompositionPromptVersion:D,showAssistantMode:k,showDecompositionMode:F,showProgressMode:H,onLog:Z}){const[N,te]=P.useState({...qu,fromLocal:Gu()}),[ce,z]=P.useState("settings"),[L,Le]=P.useState(null),[me,re]=P.useState(null),[G,De]=P.useState(null),[ye,We]=P.useState([]),[xe,ze]=P.useState("all"),[X,$e]=P.useState(null),[Ne,ut]=P.useState([]),[be,gt]=P.useState(""),[he,He]=P.useState(""),[Oe,Ye]=P.useState(""),[b,pe]=P.useState(cf),[R,V]=P.useState([]),[T,m]=P.useState(null),[_,Y]=P.useState(!1),[J,le]=P.useState(!1),[ee,de]=P.useState(!1),[ae,oe]=P.useState(!1),[ke,Ot]=P.useState(!1),[an,Gt]=P.useState(!1),[kt,Dn]=P.useState(!1),[un,ct]=P.useState(""),[ie,et]=P.useState({open:!1,messageIndex:-1,rating:3,comment:"",manualCaseDecision:hs,annotationAuthor:"manual_reviewer",saving:!1,error:""}),Mt=P.useRef(!1),yt=L?.items.find(c=>c.run_id===he)??me?.run??null,xt=me?mf(me.cases,Oe):null,ge=ye.find(c=>c.annotation_id===be)??null,cn=G?.messages.find(c=>c.message_index===ie.messageIndex)??null,dn=P.useMemo(()=>{if(ye.length===0)return null;const c=ye.reduce((E,ne)=>E+ne.rating,0)/ye.length;return Number(c.toFixed(2))},[ye]),Jn=P.useMemo(()=>{const c=[...L?.items??[]];return he&&!c.some(E=>E.run_id===he)&&me?.run&&c.unshift(me.run),c},[L?.items,me?.run,he]),Se=P.useCallback(c=>{Z?.(`[autoruns] ${c}`)},[Z]),Ct=P.useCallback(async()=>{Dn(!0);try{const c=await Ue.loadAutoRunAnnotations({limit:800,manual_case_decision:xe});We(c.items),$e(c.manual_case_decision_schema??null),ut(c.available_manual_case_decisions??[]),gt(E=>c.items.length===0?"":c.items.some(ne=>ne.annotation_id===E)?E:c.items[0].annotation_id)}catch(c){Se(`Annotations load error: ${c instanceof Error?c.message:String(c)}`)}finally{Dn(!1)}},[xe,Se]),Nt=P.useCallback(async()=>{de(!0);try{const c=await Ue.loadAutoRunAutogenHistory({limit:180});V(c.items)}catch(c){Se(`Autogen history load error: ${c instanceof Error?c.message:String(c)}`)}finally{de(!1)}},[Se]),Je=P.useCallback(async()=>{le(!0);try{const c=await Ue.loadAutoRunPostAnalysis({run_id:he||void 0,limit_per_queue:30,annotation_limit:1500,from:vs(N.fromLocal),to:vs(N.toLocal),target:N.target,mode:N.mode,use_mock:N.useMock,prompt_contains:N.promptContains.trim()||void 0});m(c)}catch(c){Se(`Post-analysis load error: ${c instanceof Error?c.message:String(c)}`),m(null)}finally{le(!1)}},[N.fromLocal,N.mode,N.promptContains,N.target,N.toLocal,N.useMock,Se,he]),K=P.useCallback(async()=>{Y(!0),ct("");try{const c=[h.systemPrompt,h.developerPrompt,h.domainPrompt,h.schemaNotes,h.fewShotExamples].join(` -`).slice(0,900),E=await Ue.generateAutoRunQuestions({mode:b.mode,count:b.count,domain:b.domain.trim()||void 0,persist_to_eval_cases:b.persistToEvalCases,generated_by:b.generatedBy.trim()||void 0,context:{llm_provider:a.llmProvider,model:a.model,assistant_prompt_version:p,decomposition_prompt_version:D,prompt_fingerprint:c}});Se(`Generated ${E.generation.count} questions (${E.generation.mode}) id=${E.generation.generation_id}`+(E.generation.saved_case_set_file?` saved=${E.generation.saved_case_set_file}`:"")),await Nt()}catch(c){const E=c instanceof Error?c.message:String(c);ct(`Автогенерация: ${E}`),Se(`Autogen generate error: ${E}`)}finally{Y(!1)}},[p,b.count,b.domain,b.generatedBy,b.mode,b.persistToEvalCases,a.llmProvider,a.model,D,Nt,Se,h.developerPrompt,h.domainPrompt,h.fewShotExamples,h.schemaNotes,h.systemPrompt]),fn=P.useCallback(async(c,E)=>{Gt(!0);try{const ne=await Ue.loadAutoRunCaseDialog(c,E);De(ne)}catch(ne){const Ee=ne instanceof Error?ne.message:String(ne);ct(`Диалог кейса: ${Ee}`),De(null),Se(`Dialog load error for ${c}/${E}: ${Ee}`)}finally{Gt(!1)}},[Se]),tt=P.useCallback(async(c,E)=>{Ot(!0);try{const ne=await Ue.loadAutoRunDetail(c);re(ne);const Ee=(E&&ne.cases.some(Jt=>Jt.case_id===E)?E:"")||ne.cases[0]?.case_id||"";He(c),Ye(Ee),Ee?await fn(c,Ee):De(null)}catch(ne){const Ee=ne instanceof Error?ne.message:String(ne);ct(`Детализация прогона: ${Ee}`),re(null),De(null),Se(`Run detail load error for ${c}: ${Ee}`)}finally{Ot(!1)}},[fn,Se]),Yt=P.useCallback(async c=>{oe(!0),ct("");try{const E=await Ue.loadAutoRunsHistory({from:vs(N.fromLocal),to:vs(N.toLocal),target:N.target,mode:N.mode,use_mock:N.useMock,prompt_contains:N.promptContains.trim()||void 0,limit:N.limit});if(Le(E),E.items.length===0){He(""),Ye(""),re(null),De(null);return}const ne=c?.keepSelection??!0,Ee=c?.preferredRunId??"",Jt=c?.preferredCaseId??"",Xn=ne&&Ee&&E.items.some(Zn=>Zn.run_id===Ee)?Ee:E.items[0].run_id;await tt(Xn,ne?Jt:void 0),Je()}catch(E){const ne=E instanceof Error?E.message:String(E);ct(`История прогонов: ${ne}`),Se(`History load error: ${ne}`)}finally{oe(!1)}},[N.fromLocal,N.limit,N.mode,N.promptContains,N.target,N.toLocal,N.useMock,Je,tt,Se]),pn=P.useCallback(c=>{c.role==="assistant"&&et({open:!0,messageIndex:c.message_index,rating:c.annotation?.rating??3,comment:c.annotation?.comment??"",manualCaseDecision:c.annotation?.manual_case_decision??hs,annotationAuthor:c.annotation?.annotation_author??b.generatedBy,saving:!1,error:""})},[b.generatedBy]),Dt=P.useCallback(()=>{et(c=>c.saving?c:{open:!1,messageIndex:-1,rating:3,comment:"",manualCaseDecision:hs,annotationAuthor:b.generatedBy,saving:!1,error:""})},[b.generatedBy]),mn=P.useCallback(async()=>{if(!(!he||!Oe||ie.messageIndex<0)){if(!ie.comment.trim()){et(c=>({...c,error:"Добавьте комментарий."}));return}et(c=>({...c,saving:!0,error:""}));try{await Ue.saveAutoRunAnnotation({run_id:he,case_id:Oe,message_index:ie.messageIndex,rating:ie.rating,comment:ie.comment.trim(),manual_case_decision:ie.manualCaseDecision,annotation_author:ie.annotationAuthor.trim()||void 0}),await Promise.all([tt(he,Oe),Ct(),Je()]),Dt()}catch(c){et(E=>({...E,saving:!1,error:c instanceof Error?c.message:String(c)}))}}},[Dt,ie.annotationAuthor,ie.comment,ie.manualCaseDecision,ie.messageIndex,ie.rating,Ct,Je,tt,Oe,he]),hn=P.useCallback(async c=>{gt(c.annotation_id),z("settings"),await tt(c.run_id,c.case_id),L?.items.some(E=>E.run_id===c.run_id)||ct("Комментарий относится к прогону вне текущего фильтра. Детали загружены напрямую.")},[L?.items,tt]);return P.useEffect(()=>{Mt.current||(Mt.current=!0,Yt({keepSelection:!1}),Nt(),Je())},[Nt,Yt,Je]),P.useEffect(()=>{Mt.current&&Ct()},[xe,Ct]),o.jsxs(on,{className:"autoruns-frame",title:"",hideHeader:!0,children:[o.jsxs("div",{className:"autoruns-columns",children:[o.jsxs("section",{className:"autoruns-col",children:[o.jsxs("div",{className:"autoruns-col-header",children:[o.jsx("h3",{children:"Левая панель"}),o.jsxs("div",{className:"tab-row",children:[o.jsx("button",{type:"button",className:ce==="settings"?"tab active":"tab",onClick:()=>z("settings"),children:"Настройки"}),o.jsx("button",{type:"button",className:ce==="comments"?"tab active":"tab",onClick:()=>z("comments"),children:"Комментарии"})]})]}),ce==="settings"?o.jsxs(o.Fragment,{children:[o.jsx("h4",{children:"Настройки выборки"}),o.jsxs("div",{className:"autoruns-form-grid",children:[o.jsxs("label",{children:["Дата с",o.jsx("input",{type:"datetime-local",value:N.fromLocal,onChange:c=>te(E=>({...E,fromLocal:c.target.value}))})]}),o.jsxs("label",{children:["Дата по",o.jsx("input",{type:"datetime-local",value:N.toLocal,onChange:c=>te(E=>({...E,toLocal:c.target.value}))})]}),o.jsxs("label",{children:["Целевой контур",o.jsxs("select",{value:N.target,onChange:c=>te(E=>({...E,target:c.target.value})),children:[o.jsx("option",{value:"all",children:"все"}),(L?.available.targets??[]).map(c=>o.jsx("option",{value:c,children:c},c))]})]}),o.jsxs("label",{children:["Режим",o.jsxs("select",{value:N.mode,onChange:c=>te(E=>({...E,mode:c.target.value})),children:[o.jsx("option",{value:"all",children:"все"}),(L?.available.modes??[]).map(c=>o.jsx("option",{value:c,children:c},c))]})]}),o.jsxs("label",{children:["Использовать mock",o.jsxs("select",{value:N.useMock,onChange:c=>te(E=>({...E,useMock:c.target.value})),children:[o.jsx("option",{value:"any",children:"любой"}),o.jsx("option",{value:"true",children:"да"}),o.jsx("option",{value:"false",children:"нет"})]})]}),o.jsxs("label",{children:["Лимит",o.jsx("input",{type:"number",min:1,max:500,value:N.limit,onChange:c=>te(E=>({...E,limit:Number(c.target.value||120)}))})]}),o.jsxs("label",{className:"full-width",children:["Версия промпта содержит",o.jsx("input",{value:N.promptContains,onChange:c=>te(E=>({...E,promptContains:c.target.value})),placeholder:"normalizer_v2_0_2 / address_query_runtime_v1",list:"autoruns-prompt-versions"})]})]}),o.jsx("datalist",{id:"autoruns-prompt-versions",children:(L?.available.prompt_versions??[]).map(c=>o.jsx("option",{value:c},c))}),o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",disabled:ae,onClick:()=>{Yt({keepSelection:!1})},children:ae?"Обновляю...":"Применить"}),o.jsx("button",{type:"button",className:"tab",onClick:()=>{te({...qu,fromLocal:Gu()}),ct("")},children:"Сбросить фильтры"})]}),o.jsx("h4",{children:"Контур генерации"}),o.jsxs("div",{className:"autoruns-meta-list",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Провайдер:"}),o.jsx("strong",{children:a.llmProvider})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Модель:"}),o.jsx("strong",{children:a.model||"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Промпт ассистента:"}),o.jsx("strong",{children:p})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Промпт декомпозиции:"}),o.jsx("strong",{children:D})]})]}),o.jsx("h4",{children:"Автогенерация вопросов"}),o.jsxs("div",{className:"autoruns-form-grid",children:[o.jsxs("label",{children:["Режим генерации",o.jsxs("select",{value:b.mode,onChange:c=>pe(E=>({...E,mode:c.target.value})),children:[o.jsx("option",{value:"codex_creative",children:"codex_creative"}),o.jsx("option",{value:"qwen_seed",children:"qwen_seed"})]})]}),o.jsxs("label",{children:["Кол-во",o.jsx("input",{type:"number",min:1,max:200,value:b.count,onChange:c=>pe(E=>({...E,count:Math.max(1,Math.min(200,Number(c.target.value||24)))}))})]}),o.jsxs("label",{children:["Домен (опц.)",o.jsx("input",{value:b.domain,onChange:c=>pe(E=>({...E,domain:c.target.value})),placeholder:"vat / settlements / counterparties"})]}),o.jsxs("label",{children:["Кто генерирует",o.jsx("input",{value:b.generatedBy,onChange:c=>pe(E=>({...E,generatedBy:c.target.value})),placeholder:"manual_reviewer"})]}),o.jsxs("label",{className:"checkbox-row",children:[o.jsx("input",{type:"checkbox",checked:b.persistToEvalCases,onChange:c=>pe(E=>({...E,persistToEvalCases:c.target.checked}))}),"Сохранять кейс-сет в `eval_cases`"]})]}),o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",disabled:_,onClick:()=>{K()},children:_?"Генерирую...":"Сгенерировать пачку"}),o.jsx("button",{type:"button",className:"tab",disabled:ee,onClick:()=>{Nt()},children:ee?"Обновляю...":"Обновить историю"})]}),o.jsxs("div",{className:"autoruns-autogen-list",children:[ee?o.jsx("p",{className:"muted",children:"Загружаю историю автогенераций..."}):null,!ee&&R.length===0?o.jsx("p",{className:"muted",children:"История автогенераций пока пустая."}):null,R.slice(0,30).map(c=>o.jsxs("article",{className:"autoruns-autogen-item",children:[o.jsxs("header",{children:[o.jsx("strong",{children:Sr(c.created_at)}),o.jsx("span",{children:c.mode})]}),o.jsxs("div",{className:"autoruns-run-meta",children:["id=",c.generation_id," | count=",c.count]}),o.jsxs("div",{className:"autoruns-run-meta",children:["домен=",c.domain??"общий",c.generated_by?` | автор=${c.generated_by}`:""]}),c.saved_case_set_file?o.jsxs("div",{className:"autoruns-run-meta",children:["кейс-сет=",c.saved_case_set_file]}):null,(c.questions??[]).length>0?o.jsx("p",{children:c.questions[0]}):null]},c.generation_id))]}),o.jsxs("details",{className:"autoruns-prompt-details",children:[o.jsx("summary",{children:"Копия активного промпта (только чтение)"}),o.jsxs("label",{children:["Системный",o.jsx("textarea",{readOnly:!0,value:h.systemPrompt})]}),o.jsxs("label",{children:["Разработчика",o.jsx("textarea",{readOnly:!0,value:h.developerPrompt})]}),o.jsxs("label",{children:["Доменный",o.jsx("textarea",{readOnly:!0,value:h.domainPrompt})]}),o.jsxs("label",{children:["Заметки по схеме",o.jsx("textarea",{readOnly:!0,value:h.schemaNotes})]}),o.jsxs("label",{children:["Примеры few-shot",o.jsx("textarea",{readOnly:!0,value:h.fewShotExamples})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("h4",{children:"Размеченные ответы"}),o.jsx("div",{className:"autoruns-form-grid",children:o.jsxs("label",{children:["Фильтр решений",o.jsxs("select",{value:xe,onChange:c=>ze(c.target.value),children:[o.jsx("option",{value:"all",children:"все"}),(Ne.length>0?Ne:X?.enum??[]).map(c=>o.jsx("option",{value:c,children:String(X?.labels?.[c]??c)},c))]})]})}),o.jsxs("div",{className:"autoruns-stats-grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Комментариев"}),o.jsx("strong",{children:ye.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Средний рейтинг"}),o.jsx("strong",{children:dn===null?"нет данных":`${dn.toFixed(2)} / 5`})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Последний"}),o.jsx("strong",{children:ye.length>0?Sr(ye[0].updated_at):"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Статус"}),o.jsx("strong",{children:kt?"обновляю":"готово"})]})]}),o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",disabled:kt,onClick:()=>{Ct()},children:kt?"Обновляю...":"Обновить список"}),o.jsx("button",{type:"button",className:"tab",disabled:J,onClick:()=>{Je()},children:J?"Идет пост-анализ...":"Обновить пост-анализ"})]}),o.jsxs("div",{className:"autoruns-comments-list",children:[kt?o.jsx("p",{className:"muted",children:"Загружаю комментарии..."}):null,!kt&&ye.length===0?o.jsx("p",{className:"muted",children:"Пока нет откомментированных ответов."}):null,ye.map(c=>o.jsxs("button",{type:"button",className:be===c.annotation_id?"autoruns-comment-item selected":"autoruns-comment-item",onClick:()=>{hn(c)},children:[o.jsxs("div",{className:"autoruns-comment-head",children:[o.jsx("strong",{children:Ju(c.rating)}),o.jsx("span",{children:Sr(c.updated_at)})]}),o.jsx("div",{className:"autoruns-run-meta",children:c.run_id}),o.jsxs("div",{className:"autoruns-run-meta",children:["case=",c.case_id," | msg=",c.message_index]}),o.jsxs("div",{className:"autoruns-run-meta",children:["decision=",c.manual_case_decision,c.annotation_author?` | author=${c.annotation_author}`:""]}),o.jsx("p",{children:c.comment})]},c.annotation_id))]}),ge?o.jsxs(o.Fragment,{children:[o.jsx("h4",{children:"Тех-контекст брака"}),o.jsxs("div",{className:"autoruns-meta-list",children:[o.jsxs("div",{children:[o.jsx("span",{children:"trace:"}),o.jsx("strong",{children:ge.technical_context.trace_id??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"reply_type:"}),o.jsx("strong",{children:ge.technical_context.reply_type??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"domain:"}),o.jsx("strong",{children:ge.technical_context.domain??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"query_class:"}),o.jsx("strong",{children:ge.technical_context.query_class??"нет данных"})]})]}),o.jsx("h4",{children:"JSON разбор"}),o.jsx(at,{value:{annotation_id:ge.annotation_id,run_id:ge.run_id,case_id:ge.case_id,message_index:ge.message_index,rating:ge.rating,comment:ge.comment,manual_case_decision:ge.manual_case_decision,annotation_author:ge.annotation_author,context:ge.context,technical_context:ge.technical_context,case_summary:ge.case_summary?{case_id:ge.case_summary.case_id,domain:ge.case_summary.domain,query_class:ge.case_summary.query_class,checks:ge.case_summary.checks,metric_subscores:ge.case_summary.metric_subscores}:null}})]}):null]}),un?o.jsx("p",{className:"error-text",children:un}):null]}),o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Выдача прогонов"})}),o.jsxs("div",{className:"autoruns-stats-grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Всего"}),o.jsx("strong",{children:L?.stats.runs_total??0})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Средний score"}),o.jsx("strong",{children:ll(L?.stats.avg_score_index??null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Тренд"}),o.jsx("strong",{children:L?Yu(L.stats.trend):"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Блокеры"}),o.jsx("strong",{children:L?.stats.blocking_runs??0})]})]}),o.jsxs("div",{className:"autoruns-run-list",children:[(L?.items??[]).map(c=>o.jsxs("button",{type:"button",className:he===c.run_id?"autoruns-run-item selected":"autoruns-run-item",onClick:()=>{tt(c.run_id)},children:[o.jsxs("div",{className:"autoruns-run-head",children:[o.jsx("strong",{children:Sr(c.run_timestamp)}),o.jsx("span",{children:pf(c.eval_target)})]}),o.jsx("div",{className:"autoruns-run-meta",children:c.run_id}),o.jsxs("div",{className:"autoruns-run-meta",children:["режим=",c.mode??"нет данных"," | mock=",String(c.use_mock)]}),c.llm_provider||c.model?o.jsxs("div",{className:"autoruns-run-meta",children:["llm=",c.llm_provider??"нет данных"," | модель=",c.model??"нет данных"]}):null,o.jsxs("div",{className:"autoruns-run-meta",children:["промпт=",c.prompt_version??"нет данных"]}),o.jsxs("div",{className:"autoruns-run-foot",children:[o.jsxs("span",{children:["оценка: ",ll(c.score_index)]}),o.jsxs("span",{children:["закрыто/открыто: ",c.closed_cases,"/",c.open_cases]})]}),o.jsxs("div",{className:"autoruns-run-foot",children:[o.jsxs("span",{children:["блокеры: ",c.blocking_failures]}),o.jsxs("span",{children:["качество: ",c.quality_failures]})]})]},c.run_id)),(L?.items.length??0)===0?o.jsx("p",{className:"muted",children:"За выбранный диапазон прогонов нет."}):null]})]}),o.jsxs("section",{className:"autoruns-col",children:[o.jsxs("div",{className:"autoruns-col-header",children:[o.jsx("h3",{children:"Диалог прогона"}),o.jsxs("div",{className:"autoruns-dialog-toolbar",children:[o.jsxs("label",{children:["Прогон",o.jsx("select",{value:he,onChange:c=>{const E=c.target.value;tt(E)},children:Jn.map(c=>o.jsxs("option",{value:c.run_id,children:[Sr(c.run_timestamp)," | ",c.run_id]},c.run_id))})]}),o.jsxs("label",{children:["Кейс",o.jsx("select",{value:Oe,onChange:c=>{const E=c.target.value;Ye(E),he&&E&&fn(he,E)},children:(me?.cases??[]).map(c=>o.jsxs("option",{value:c.case_id,children:[c.case_id," | ",c.status]},c.case_id))})]})]})]}),o.jsx("div",{className:"autoruns-case-list",children:(me?.cases??[]).map(c=>o.jsxs("button",{type:"button",className:Oe===c.case_id?"autoruns-case-item selected":"autoruns-case-item",onClick:()=>{Ye(c.case_id),he&&fn(he,c.case_id)},children:[o.jsx("span",{children:c.case_id}),o.jsxs("span",{children:[c.status,c.commented_count>0?` | 💬${c.commented_count}`:""]})]},c.case_id))}),o.jsxs("div",{className:"autoruns-dialog-view",children:[an||ke?o.jsx("p",{className:"muted",children:"Загружаю диалог..."}):null,!an&&!ke&&(G?.messages.length??0)===0?o.jsx("p",{className:"muted",children:"Диалог для этого кейса не найден."}):null,(G?.messages??[]).map((c,E)=>{const ne=c.role==="assistant"?"assistant":"user";return o.jsxs("article",{className:`autoruns-msg ${ne}`,children:[o.jsxs("header",{children:[o.jsx("strong",{children:ne==="assistant"?"Система":"Модель/вопрос"}),o.jsxs("div",{className:"autoruns-msg-head-actions",children:[o.jsx("span",{children:c.created_at?Sr(c.created_at):"нет данных"}),ne==="assistant"?o.jsx("button",{type:"button",className:c.commented?"autoruns-comment-icon commented":"autoruns-comment-icon",onClick:()=>pn(c),title:"Комментировать ответ системы",children:"💬"}):null]})]}),o.jsx("p",{children:c.text}),ne==="assistant"&&c.annotation?o.jsxs("div",{className:"autoruns-msg-annotation",children:[o.jsx("strong",{children:Ju(c.annotation.rating)}),o.jsx("span",{children:c.annotation.comment}),o.jsxs("span",{className:"muted",children:[c.annotation.manual_case_decision,c.annotation.annotation_author?` | ${c.annotation.annotation_author}`:""]})]}):null,(c.trace_id||c.reply_type)&&o.jsxs("footer",{children:[c.trace_id?o.jsxs("span",{children:["trace=",c.trace_id]}):null,c.reply_type?o.jsxs("span",{children:["reply_type=",c.reply_type]}):null]})]},c.message_id??`${ne}-${E}`)})]})]}),k?o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Режим ассистента"})}),o.jsxs("div",{className:"autoruns-meta-list",children:[o.jsxs("div",{children:[o.jsx("span",{children:"источник:"}),o.jsx("strong",{children:G?.source??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"сессия:"}),o.jsx("strong",{children:G?.session_id??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"контур прогона:"}),o.jsx("strong",{children:yt?.eval_target??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"оценка прогона:"}),o.jsx("strong",{children:ll(yt?.score_index??null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"комментарии:"}),o.jsx("strong",{children:me?.annotations_summary?.total??0})]})]}),o.jsx("h4",{children:"Пакет режима ассистента"}),o.jsx(at,{value:G?.assistant_mode??{note:"assistant_mode недоступен"}}),o.jsx("h4",{style:{marginTop:12},children:"Проверки кейса"}),o.jsx(at,{value:xt?.checks??{note:"checks недоступен"}}),o.jsx("h4",{style:{marginTop:12},children:"Сабскор метрик"}),o.jsx(at,{value:xt?.metric_subscores??{note:"metric_subscores недоступен"}})]}):null,F?o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Режим декомпозиции"})}),o.jsxs("div",{className:"autoruns-meta-list",children:[o.jsxs("div",{children:[o.jsx("span",{children:"кейс:"}),o.jsx("strong",{children:xt?.case_id??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"домен:"}),o.jsx("strong",{children:xt?.domain??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"класс запроса:"}),o.jsx("strong",{children:xt?.query_class??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"trace:"}),o.jsx("strong",{children:xt?.trace_id??"нет данных"})]})]}),o.jsx("h4",{children:"Шаги декомпозиции"}),(G?.decomposition.length??0)>0?o.jsx("ol",{className:"autoruns-decomposition-list",children:(G?.decomposition??[]).map((c,E)=>o.jsx("li",{children:c},`${E}-${c.slice(0,24)}`))}):o.jsx("p",{className:"muted",children:"В логах кейса нет явной декомпозиции."})]}):null,H?o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Прогресс / регресс"})}),o.jsxs("div",{className:"autoruns-stats-grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Последний score"}),o.jsx("strong",{children:ll(L?.stats.latest_score_index??null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Предыдущий"}),o.jsx("strong",{children:ll(L?.stats.previous_score_index??null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Тренд"}),o.jsx("strong",{children:L?Yu(L.stats.trend):"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Пробелы качества"}),o.jsx("strong",{children:L?.stats.quality_gap_runs??0})]})]}),o.jsx("h4",{children:"Покрытие доменов (история)"}),Xu(L?.stats.domain_coverage??[]),o.jsx("h4",{style:{marginTop:14},children:"Покрытие доменов (выбранный прогон)"}),Xu(me?.coverage.domain_coverage??[]),o.jsx("h4",{style:{marginTop:14},children:"Очереди фиксов пост-анализа"}),J?o.jsx("p",{className:"muted",children:"Собираю пост-анализ..."}):null,J?null:o.jsx("div",{className:"autoruns-stats-grid",children:Object.entries(T?.post_analysis.stats.by_queue??{}).map(([c,E])=>o.jsxs("div",{children:[o.jsx("span",{children:c}),o.jsx("strong",{children:E})]},c))}),o.jsxs("div",{className:"autoruns-autogen-list",children:[(T?.post_analysis.recommended_regression_candidates??[]).slice(0,12).map(c=>o.jsxs("article",{className:"autoruns-autogen-item",children:[o.jsxs("header",{children:[o.jsx("strong",{children:c.manual_case_decision}),o.jsxs("span",{children:[c.rating,"/5"]})]}),o.jsxs("div",{className:"autoruns-run-meta",children:[c.domain??"неизвестно"," / ",c.query_class??"неизвестно"]}),o.jsx("p",{children:c.comment})]},c.annotation_id)),!J&&(T?.post_analysis.recommended_regression_candidates.length??0)===0?o.jsx("p",{className:"muted",children:"Рекомендованных кандидатов пока нет."}):null]})]}):null]}),ie.open?o.jsx("div",{className:"autoruns-comment-modal-backdrop",onClick:c=>{c.target===c.currentTarget&&Dt()},children:o.jsxs("div",{className:"autoruns-comment-modal",children:[o.jsx("h3",{children:"Комментарий к ответу системы"}),o.jsx("p",{className:"muted",children:"Оцените ответ по 5-балльной шкале и добавьте комментарий по браку."}),cn?o.jsxs("details",{className:"autoruns-prompt-details",open:!0,children:[o.jsx("summary",{children:"Ответ системы"}),o.jsx("p",{className:"autoruns-comment-quote",children:cn.text})]}):null,o.jsx("div",{className:"autoruns-rating-row",role:"group","aria-label":"Рейтинг ответа",children:[1,2,3,4,5].map(c=>o.jsx("button",{type:"button",className:ie.rating>=c?"autoruns-rating-dot active":"autoruns-rating-dot",onClick:()=>et(E=>({...E,rating:c})),disabled:ie.saving,"aria-label":`Оценка ${c}`,children:ie.rating>=c?"●":"○"},c))}),o.jsxs("div",{className:"autoruns-form-grid",children:[o.jsxs("label",{children:["Решение по кейсу",o.jsx("select",{value:ie.manualCaseDecision,onChange:c=>et(E=>({...E,manualCaseDecision:c.target.value})),disabled:ie.saving,children:(Ne.length>0?Ne:X?.enum??[hs]).map(c=>o.jsx("option",{value:c,children:String(X?.labels?.[c]??c)},c))})]}),o.jsxs("label",{children:["Автор комментария",o.jsx("input",{value:ie.annotationAuthor,onChange:c=>et(E=>({...E,annotationAuthor:c.target.value})),placeholder:"manual_reviewer",disabled:ie.saving})]})]}),o.jsxs("label",{children:["Комментарий",o.jsx("textarea",{value:ie.comment,onChange:c=>et(E=>({...E,comment:c.target.value})),placeholder:"Почему ответ бракованный, что именно пошло не так, какие технические детали проверить.",rows:4,disabled:ie.saving})]}),ie.error?o.jsx("p",{className:"error-text",children:ie.error}):null,o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",onClick:()=>{mn()},disabled:ie.saving,children:ie.saving?"Сохраняю...":"Готово"}),o.jsx("button",{type:"button",className:"tab",onClick:Dt,disabled:ie.saving,children:"Отмена"})]})]})}):null]})}const vf=/(?:^|\n)\s*#{0,6}\s*(?:debug_payload_json|technical_breakdown_json|route_summary_json|debug_payload|technical_breakdown)\b/i,gf=[/\b(?:debug_payload_json|technical_breakdown_json)\b/i,/\b(?:route_summary|semantic_profile|domain_scope|relation_patterns|account_scope)\b/i,/\b(?:coverage_report|retrieval_status|problem_unit_state|candidate_evidence)\b/i,/\b(?:graph_domain_scope|graph_runtime|selection_reason|why_included)\b/i];function yf(a){try{return JSON.stringify(a,null,2)}catch{return String(a)}}function xf(a){const h=String(a??""),p=h.match(vf);return(p?h.slice(0,p.index):h).replace(/###\s*(?:debug_payload_json|technical_breakdown_json|route_summary_json)[\s\S]*?(?:```[\s\S]*?```|$)/gi,"").replace(/(?:^|\n)\s*#{0,6}\s*(?:debug_payload_json|technical_breakdown_json|route_summary_json)\b[\s\S]*$/gi,"").split(/\r?\n/g).map(H=>H.trimEnd()).filter(H=>H.trim().length>0).filter(H=>!gf.some(Z=>Z.test(H))).join(` -`).trim()}function _f(a,h,p="default"){const D=p==="technical",k=[];k.push("# Assistant conversation export"),k.push(`session_id: ${a||"n/a"}`),k.push(`export_mode: ${p}`),k.push(`exported_at: ${new Date().toISOString()}`),k.push("");for(let F=0;F{re.current&&(re.current.scrollTop=re.current.scrollHeight)},[h,Le]),P.useEffect(()=>()=>{G.current!==null&&window.clearTimeout(G.current)},[]);async function ze(X){if(h.length===0)return;const $e=_f(a,h,X),Ne=await jf($e);xe(X==="technical"?"тех":"чат"),ye(Ne?"success":"error"),G.current!==null&&window.clearTimeout(G.current),G.current=window.setTimeout(()=>{ye("idle")},2200)}return o.jsxs(on,{title:"Режим ассистента",subtitle:"Диалоговый слой поверх normalizer, маршрутизации и factual retrieval.",actions:o.jsxs("div",{className:"assistant-panel-actions",children:[o.jsx("button",{type:"button",className:"assistant-copy-btn",onClick:()=>{ze("default")},disabled:h.length===0,title:"Экспорт только user-facing чата",children:"Скопировать чат"}),o.jsx("button",{type:"button",className:"assistant-copy-btn",onClick:()=>{ze("technical")},disabled:h.length===0,title:"Технический экспорт с debug payload",children:"Скопировать техчат"}),De==="success"?o.jsxs("span",{className:"assistant-copy-feedback success",children:["Скопировано (",We,")"]}):null,De==="error"?o.jsx("span",{className:"assistant-copy-feedback error",children:"Ошибка копирования"}):null,o.jsx("span",{className:"status-chip",children:a?`session: ${a}`:"новая сессия"})]}),children:[o.jsxs("div",{ref:re,className:"assistant-chat-list",children:[h.length===0?o.jsx("div",{className:"assistant-empty muted",children:"Диалог пуст. Отправьте первый вопрос, чтобы запустить контур ассистента."}):null,h.map(X=>o.jsxs("article",{className:`assistant-msg ${X.role}`,children:[o.jsxs("header",{className:"assistant-msg-head",children:[o.jsx("strong",{children:Sf(X.role)}),o.jsx("span",{children:wf(X.created_at)})]}),o.jsx("div",{className:"assistant-msg-body",children:X.text}),X.role==="assistant"&&X.debug?o.jsxs("details",{className:"assistant-debug",children:[o.jsx("summary",{children:"Показать технический разбор"}),o.jsx(at,{value:X.debug})]}):null]},X.message_id))]}),o.jsxs("div",{className:"assistant-compose",children:[o.jsxs("div",{className:"grid-two",children:[o.jsxs("label",{children:["Подсказка по периоду",o.jsx("input",{value:k,onChange:X=>F(X.target.value)})]}),o.jsxs("label",{children:["Бизнес-контекст",o.jsx("input",{value:H,onChange:X=>Z(X.target.value)})]})]}),o.jsxs("label",{className:"full-width",children:["Сообщение",o.jsx("textarea",{value:p,onChange:X=>D(X.target.value),rows:4,placeholder:"Введите вопрос к данным компании..."})]}),o.jsxs("div",{className:"button-row",children:[o.jsxs("label",{className:"checkbox-row",children:[o.jsx("input",{type:"checkbox",checked:N,onChange:X=>te(X.target.checked)}),"Mock-режим"]}),o.jsx("button",{type:"button",onClick:()=>ce(),disabled:L||!p.trim(),children:L?"Выполняю...":"Отправить"}),o.jsx("button",{type:"button",onClick:()=>z(),disabled:L&&h.length===0,children:"Сбросить сессию"})]}),Le?o.jsx("p",{className:"diff-summary",children:Le}):null,me?o.jsx("p",{className:"error-text",children:me}):null]})]})}function Zu({value:a,modelOptions:h,modelsBusy:p,onChange:D,onReloadModels:k,onTestConnection:F,onSaveLocalConfig:H,lastStatus:Z,busy:N}){const te=a.llmProvider==="local",ce=h.includes(a.model);return o.jsxs(on,{title:"LLM Connection",subtitle:"Switch between OpenAI cloud and local OpenAI-compatible server.",actions:o.jsx("span",{className:"status-chip",children:Z||"Status: not checked"}),children:[o.jsxs("div",{className:"grid-two",children:[o.jsxs("label",{children:["Provider",o.jsxs("select",{value:a.llmProvider,onChange:z=>{const L=z.target.value==="local"?"local":"openai";D({...a,llmProvider:L,baseUrl:L==="local"?"http://127.0.0.1:1234/v1":"https://api.openai.com/v1"})},children:[o.jsx("option",{value:"openai",children:"OpenAI (token)"}),o.jsx("option",{value:"local",children:"Local (LM Studio / OpenAI-compatible)"})]})]}),o.jsxs("label",{children:["Model",o.jsxs("select",{value:ce?a.model:"__manual__",onChange:z=>{const L=z.target.value;L!=="__manual__"&&D({...a,model:L})},children:[o.jsx("option",{value:"__manual__",children:"Manual input"}),h.map(z=>o.jsx("option",{value:z,children:z},z))]})]}),o.jsxs("label",{children:["Model ID (manual)",o.jsx("input",{value:a.model,onChange:z=>D({...a,model:z.target.value}),placeholder:"qwen2.5-14b-instruct or lmstudio loaded model id"})]}),te?null:o.jsxs("label",{className:"full-width",children:["OpenAI API Key",o.jsx("input",{type:"password",value:a.apiKey,onChange:z=>D({...a,apiKey:z.target.value}),placeholder:"sk-..."})]}),o.jsxs("label",{className:te?"full-width":void 0,children:[te?"Local server base URL":"Base URL",o.jsx("input",{value:a.baseUrl,onChange:z=>D({...a,baseUrl:z.target.value}),placeholder:te?"http://127.0.0.1:1234/v1":"https://api.openai.com/v1"})]}),o.jsxs("label",{children:["Temperature",o.jsx("input",{type:"number",step:"0.1",value:a.temperature,onChange:z=>D({...a,temperature:Number(z.target.value)})})]}),o.jsxs("label",{children:["Max output tokens",o.jsx("input",{type:"number",value:a.maxOutputTokens,onChange:z=>D({...a,maxOutputTokens:Number(z.target.value)})})]})]}),o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",onClick:()=>H(),children:"Save local config"}),o.jsx("button",{type:"button",onClick:()=>k(),disabled:N||p,children:p?"Loading models...":"Load model list"}),o.jsx("button",{type:"button",onClick:()=>F(),disabled:N,children:N?"Checking...":"Test connection"})]})]})}function Cf({items:a,onRefresh:h,onOpenTrace:p}){return o.jsx(on,{title:"История нормализаций",subtitle:"Короткий вопрос, confidence, route hint и статус валидации.",actions:o.jsx("button",{type:"button",onClick:()=>h(),children:"Обновить"}),children:o.jsxs("div",{className:"history-list",children:[a.length===0?o.jsx("p",{className:"muted",children:"История пока пустая."}):null,a.map(D=>o.jsxs("button",{type:"button",className:"history-item",onClick:()=>p(D.trace_id),children:[o.jsxs("div",{className:"history-row",children:[o.jsx("strong",{children:D.route_hint??"route: n/a"}),o.jsx("span",{children:D.validation_passed?"schema: ok":"schema: fail"})]}),o.jsx("p",{children:D.question_short}),o.jsxs("div",{className:"history-row",children:[o.jsx("span",{children:D.model}),o.jsx("span",{children:new Date(D.timestamp).toLocaleString("ru-RU")})]})]},D.trace_id))]})})}function sn(a){return a==null||a===""?"—":String(a)}function Nf({result:a}){return o.jsx(on,{title:"Runtime метрики",subtitle:"trace_id, токены, latency и статус валидации.",children:o.jsxs("div",{className:"metrics-grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"trace_id"}),o.jsx("strong",{children:sn(a?.trace_id)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"request_started_at"}),o.jsx("strong",{children:sn(a?new Date(Date.now()-a.latency_ms).toISOString():null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"request_finished_at"}),o.jsx("strong",{children:sn(a?new Date().toISOString():null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"latency_ms"}),o.jsx("strong",{children:sn(a?.latency_ms)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"input_tokens"}),o.jsx("strong",{children:sn(a?.usage?.input_tokens)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"output_tokens"}),o.jsx("strong",{children:sn(a?.usage?.output_tokens)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"total_tokens"}),o.jsx("strong",{children:sn(a?.usage?.total_tokens)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"validation_status"}),o.jsx("strong",{children:a?.validation?.passed?"passed":"failed"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"prompt_version"}),o.jsx("strong",{children:sn(a?.prompt_version)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"schema_version"}),o.jsx("strong",{children:sn(a?.schema_version)})]})]})})}const Ef={normalized:"Normalized JSON",fragments:"Fragment View",scope:"Scope View",flags:"Flags View",route:"Route Simulation",raw:"Raw model output",validation:"Validation",logs:"Logs"};function Pf(a){return a&&typeof a=="object"?a:null}function Rf({tab:a,onTabChange:h,result:p,appLogs:D}){const k=["normalized","fragments","scope","flags","route","raw","validation","logs"],F=Pf(p?.normalized),H=String(F?.schema_version??""),Z=H==="normalized_query_v2"||H==="normalized_query_v2_0_1"||H==="normalized_query_v2_0_2",N=Z?{fragments:F?.fragments??[],discarded_fragments:F?.discarded_fragments??[]}:{note:"Fragment View доступен для normalized_query_v2."},te=Z?{message_in_scope:F?.message_in_scope??null,scope_confidence:F?.scope_confidence??null,contains_multiple_tasks:F?.contains_multiple_tasks??null,global_notes:F?.global_notes??null}:{note:"Scope View доступен для normalized_query_v2."},ce=Z?Array.isArray(F?.fragments)?(F?.fragments).map(z=>({fragment_id:z.fragment_id??null,domain_relevance:z.domain_relevance??null,candidate_labels:z.candidate_labels??[],execution_readiness:z.execution_readiness??null,clarification_reason:z.clarification_reason??null,soft_assumption_used:z.soft_assumption_used??[],route_status:z.route_status??null,no_route_reason:z.no_route_reason??null,flags:z.flags??{}})):[]:{note:"Flags View доступен для normalized_query_v2."};return o.jsxs(on,{title:"Выходные данные",subtitle:"Structured output и диагностические вкладки.",children:[o.jsx("div",{className:"tab-row",children:k.map(z=>o.jsx("button",{type:"button",className:a===z?"tab active":"tab",onClick:()=>h(z),children:Ef[z]},z))}),a==="normalized"?o.jsx(at,{value:p?.normalized??{note:"Нет данных."}}):null,a==="fragments"?o.jsx(at,{value:N}):null,a==="scope"?o.jsx(at,{value:te}):null,a==="flags"?o.jsx(at,{value:ce}):null,a==="route"?o.jsx(at,{value:p?.route_hint_summary??{note:"Нет данных."}}):null,a==="raw"?o.jsx(at,{value:p?.raw_model_output??{note:"Нет данных."}}):null,a==="validation"?o.jsx(at,{value:p?.validation??{note:"Нет данных."}}):null,a==="logs"?o.jsx(at,{value:D}):null]})}function bu({value:a,onChange:h,presets:p,selectedPresetId:D,onSelectPreset:k,onLoadPreset:F,onSavePreset:H,onResetDefaults:Z,onDiffPrevious:N,presetName:te,onPresetNameChange:ce,diffSummary:z}){return o.jsxs(on,{title:"Prompt Manager",subtitle:"Системный, developer и domain уровни управляются отдельно.",children:[o.jsxs("div",{className:"grid-two",children:[o.jsxs("label",{children:["Системный prompt",o.jsx("textarea",{value:a.systemPrompt,onChange:L=>h({...a,systemPrompt:L.target.value}),rows:6})]}),o.jsxs("label",{children:["Developer / Instruction prompt",o.jsx("textarea",{value:a.developerPrompt,onChange:L=>h({...a,developerPrompt:L.target.value}),rows:6})]}),o.jsxs("label",{children:["Domain prompt",o.jsx("textarea",{value:a.domainPrompt,onChange:L=>h({...a,domainPrompt:L.target.value}),rows:6})]}),o.jsxs("label",{children:["Schema notes",o.jsx("textarea",{value:a.schemaNotes,onChange:L=>h({...a,schemaNotes:L.target.value}),rows:6})]}),o.jsxs("label",{className:"full-width",children:["Few-shot examples",o.jsx("textarea",{value:a.fewShotExamples,onChange:L=>h({...a,fewShotExamples:L.target.value}),rows:8})]})]}),o.jsxs("div",{className:"button-row",children:[o.jsxs("select",{value:D,onChange:L=>k(L.target.value),children:[o.jsx("option",{value:"",children:"Выберите preset..."}),p.map(L=>o.jsx("option",{value:L.id,children:L.name},L.id))]}),o.jsx("button",{type:"button",onClick:()=>F(),children:"Загрузить preset"}),o.jsx("input",{value:te,onChange:L=>ce(L.target.value),placeholder:"Имя для сохранения"}),o.jsx("button",{type:"button",onClick:()=>H(),children:"Сохранить preset"}),o.jsx("button",{type:"button",onClick:()=>N(),children:"Diff с предыдущим"}),o.jsx("button",{type:"button",onClick:()=>Z(),children:"Сбросить к default"})]}),z?o.jsx("p",{className:"diff-summary",children:z}):null]})}function Tf({value:a,onChange:h,onApplyBatchFormat:p,onNormalize:D,busy:k,useMock:F,onUseMockChange:H,errorMessage:Z}){return o.jsxs(on,{title:"Запрос пользователя",subtitle:"NDC semantic front-end: нормализуем, но не отвечаем за бухгалтерскую суть.",children:[o.jsxs("div",{className:"grid-two",children:[o.jsxs("label",{className:"full-width",children:["Raw user question",o.jsx("textarea",{value:a.userQuestion,onChange:N=>h({...a,userQuestion:N.target.value}),rows:6,placeholder:"Например: По каким покупателям у нас на конец июня висят отгрузки без оплаты..."})]}),o.jsxs("label",{className:"full-width",children:["Batch queries (`;` separator)",o.jsx("textarea",{value:a.batchQuestionsRaw,onChange:N=>h({...a,batchQuestionsRaw:N.target.value}),onBlur:()=>p(),rows:8,placeholder:"Вопрос 1; Вопрос 2; Вопрос 3"})]}),o.jsxs("label",{children:["Optional period context",o.jsx("input",{value:a.periodHint,onChange:N=>h({...a,periodHint:N.target.value})})]}),o.jsxs("label",{children:["Optional business context",o.jsx("input",{value:a.businessContext,onChange:N=>h({...a,businessContext:N.target.value})})]}),o.jsxs("label",{children:["Optional expected route (eval)",o.jsx("input",{value:a.expectedRoute,onChange:N=>h({...a,expectedRoute:N.target.value})})]})]}),o.jsxs("div",{className:"button-row",children:[o.jsxs("label",{className:"checkbox-row",children:[o.jsx("input",{type:"checkbox",checked:F,onChange:N=>H(N.target.checked)}),"Mock-режим (без вызова OpenAI)"]}),o.jsx("button",{type:"button",onClick:()=>p(),disabled:k||!a.batchQuestionsRaw.trim(),children:"Применить `;` в переносы"}),o.jsx("button",{type:"button",onClick:()=>D(!1),disabled:k||!a.userQuestion.trim(),children:k?"Нормализуем...":"Normalize"}),o.jsx("button",{type:"button",onClick:()=>D(!0),disabled:k||!a.userQuestion.trim(),children:k?"Сохраняем...":"Normalize + Save as test case"})]}),Z?o.jsx("p",{className:"error-text",children:Z}):null]})}function Lf({runs:a,selectedRunId:h,onSelectRun:p,onStartRun:D,onFinishRun:k,onRefreshRuns:F,onRunEval:H,onCopyEvalReport:Z,evalBusy:N,traceItems:te,evalReport:ce}){return o.jsxs(on,{title:"NDC Run Monitor",subtitle:"Важно: кнопка Запустить run создает только run-сущность. Кнопка eval запускает batch-проверку normalizer v2.0.2.",children:[o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",onClick:()=>D(),children:"Запустить run"}),o.jsx("button",{type:"button",onClick:()=>k(),disabled:!h,children:"Завершить выбранный run"}),o.jsx("button",{type:"button",onClick:()=>F(),children:"Обновить runs"}),o.jsx("button",{type:"button",onClick:()=>H(),disabled:N,children:N?"Идет eval v2.0.2...":"Запустить eval v2.0.2"})]}),o.jsxs("div",{className:"runtime-grid",children:[o.jsxs("div",{className:"runtime-runs",children:[a.map(z=>o.jsxs("button",{type:"button",className:h===z.runId?"history-item selected":"history-item",onClick:()=>p(z.runId),children:[o.jsxs("div",{className:"history-row",children:[o.jsx("strong",{children:z.status}),o.jsx("span",{children:z.runId})]}),o.jsxs("div",{className:"history-row",children:[o.jsx("span",{children:z.sessionId}),o.jsx("span",{children:new Date(z.updatedAt).toLocaleString("ru-RU")})]})]},z.runId)),a.length===0?o.jsx("p",{className:"muted",children:"Нет активных запусков."}):null]}),o.jsxs("div",{children:[o.jsx("h3",{children:"Trace выбранного run"}),o.jsx(at,{value:te}),o.jsxs("div",{className:"eval-report-wrap",children:[o.jsx("h3",{style:{marginTop:12},children:"Отчет eval"}),o.jsx(at,{value:ce??{note:"Eval пока не запускался"}}),o.jsx("button",{type:"button",className:"copy-cube-button",title:"Скопировать отчет eval",onClick:()=>Z(),children:"⧉"})]})]})]})]})}const zf={llmProvider:"openai",apiKey:"",model:"gpt-4o-mini",baseUrl:"https://api.openai.com/v1",temperature:0,maxOutputTokens:700},ec={systemPrompt:"Ты semantic-normalizer для бухгалтерского ассистента NDC. Возвращай только JSON по схеме normalized_query_v2_0_2.",developerPrompt:"Сначала делай decomposition сообщения на task fragments, затем определяй domain scope и route-critical flags. Для каждого fragment заполняй execution_readiness + route_status + no_route_reason. Если fragment routable, не оставляй его в no_route.",domainPrompt:"Контур: данные текущего предприятия в 1С/NDC. In-scope: документы, проводки, взаиморасчеты, остатки, периодное закрытие, аномалии и контрольные проверки. Out-of-scope: общая теория, законы и оффтоп.",schemaNotes:"schema_version: normalized_query_v2_0_2. Строгий JSON без дополнительных полей.",fewShotExamples:"Q: Проверь по поставщикам хвосты и разложи цепочку документов/оплат. => fragment in_scope, flags: multi_entity + chain_explanation. Q: Как вообще по ФСБУ? => out_of_scope/generic_accounting."},Of={userQuestion:"",batchQuestionsRaw:"",periodHint:"",businessContext:"",expectedRoute:""},Mf={colors:{backgroundRgb:"18, 18, 18",mainSurfaceRgb:"25, 25, 25",horizontalSurfaceRgb:"30, 30, 30",focusSurfaceRgb:"35, 35, 35",activeRgb:"167, 59, 255",activeTextRgb:"240, 240, 240",textMainRgb:"240, 240, 240",textMutedRgb:"166, 166, 166",dangerRgb:"126, 126, 126",scrollbarTrackRgb:"20, 20, 20",scrollbarThumbRgb:"30, 30, 30",scrollbarThumbHoverRgb:"30, 50, 30"}},tc="ndc_normalizer_session_config_v1",li=["Анализ запроса","Получение данных","Подготовка ответа"],Df="assistant",si="normalizer_v2_0_2",nc="address_query_runtime_v1";function If(a){return`[${new Date().toLocaleTimeString("ru-RU")}] ${a}`}function Af(a,h){if(!h)return"Previous preset is not selected.";const D=["systemPrompt","developerPrompt","domainPrompt","schemaNotes","fewShotExamples"].filter(k=>a[k]!==h[k]).map(k=>`${k}: ${Math.abs(a[k].length-h[k].length)} chars delta`);return D.length===0?"No changes against previous preset.":`Changed fields: ${D.length}. ${D.join(" | ")}`}function Ff(){const[a,h]=P.useState(zf),[p,D]=P.useState(ec),[k,F]=P.useState(Of),[H,Z]=P.useState(null),[N,te]=P.useState([]),[ce,z]=P.useState([]),[L,Le]=P.useState("normalized"),[me,re]=P.useState(!1),[G,De]=P.useState(!1),[ye,We]=P.useState([]),[xe,ze]=P.useState(""),[X,$e]=P.useState([]),[Ne,ut]=P.useState(""),[be,gt]=P.useState("NDC custom preset"),[he,He]=P.useState(null),[Oe,Ye]=P.useState(""),[b,pe]=P.useState(!1),[R,V]=P.useState([]),[T,m]=P.useState(""),[_,Y]=P.useState([]),[J,le]=P.useState(!1),[ee,de]=P.useState(null),[ae,oe]=P.useState(""),[ke,Ot]=P.useState(Df),[an,Gt]=P.useState(!0),[kt,Dn]=P.useState(!0),[un,ct]=P.useState(!0),[ie,et]=P.useState(""),[Mt,yt]=P.useState([]),[xt,ge]=P.useState(""),[cn,dn]=P.useState(!1),[Jn,Se]=P.useState(""),[Ct,Nt]=P.useState(""),Je=P.useRef(!1);P.useEffect(()=>{const x=document.documentElement,{colors:O}=Mf;x.style.setProperty("--rgb-background",O.backgroundRgb),x.style.setProperty("--rgb-surface-main",O.mainSurfaceRgb),x.style.setProperty("--rgb-surface-horizontal",O.horizontalSurfaceRgb),x.style.setProperty("--rgb-surface-focus",O.focusSurfaceRgb),x.style.setProperty("--rgb-active",O.activeRgb),x.style.setProperty("--rgb-active-text",O.activeTextRgb),x.style.setProperty("--rgb-text-main",O.textMainRgb),x.style.setProperty("--rgb-text-muted",O.textMutedRgb),x.style.setProperty("--rgb-danger",O.dangerRgb),x.style.setProperty("--rgb-scrollbar-track",O.scrollbarTrackRgb),x.style.setProperty("--rgb-scrollbar-thumb",O.scrollbarThumbRgb),x.style.setProperty("--rgb-scrollbar-thumb-hover",O.scrollbarThumbHoverRgb)},[]);const K=x=>{z(O=>[If(x),...O].slice(0,300))};function fn(){let x=0;Se(li[0]);const O=window.setInterval(()=>{x=Math.min(x+1,li.length-1),Se(li[x])},650);return()=>window.clearInterval(O)}P.useEffect(()=>{const x=localStorage.getItem(tc);if(x)try{const O=JSON.parse(x);h(B=>({...B,llmProvider:O.llmProvider==="local"?"local":"openai",model:O.model??B.model,baseUrl:O.baseUrl??B.baseUrl,temperature:O.temperature??B.temperature,maxOutputTokens:O.maxOutputTokens??B.maxOutputTokens}))}catch{}tt(),Yt(),pn()},[]);async function tt(){try{const x=await Ue.loadHistory();te(x.items??[])}catch(x){K(`History load error: ${x instanceof Error?x.message:String(x)}`)}}async function Yt(){try{const O=(await Ue.loadPresets()).presets??[];if($e(O),Je.current)return;const B=O.find(Ie=>Ie.prompt_version===si)??O.find(Ie=>Ie.id==="default-normalizer-v2_0_2");if(!B){Je.current=!0,K(`Preset autoload skipped: ${si} not found.`);return}ut(B.id),He(p),D({systemPrompt:B.systemPrompt,developerPrompt:B.developerPrompt,domainPrompt:B.domainPrompt,schemaNotes:B.schemaNotes??"",fewShotExamples:B.fewShotExamples??""}),Je.current=!0,K(`Preset autoloaded: ${B.name} (${B.prompt_version}).`)}catch(x){K(`Presets load error: ${x instanceof Error?x.message:String(x)}`)}}async function pn(){try{const x=await Ue.listRuns();V(x.items??[])}catch(x){K(`Runs load error: ${x instanceof Error?x.message:String(x)}`)}}function Dt(){localStorage.setItem(tc,JSON.stringify({model:a.model,llmProvider:a.llmProvider,baseUrl:a.baseUrl,temperature:a.temperature,maxOutputTokens:a.maxOutputTokens})),K("Local config saved (without API key).")}async function mn(){re(!0),oe("");try{const x=await Ue.testConnection(a);x.provider==="local"?x.model_found===!0?(ze(`LOCAL OK - ${x.model}`),K(`Local model is available: ${x.model} (catalog size=${x.models_count??"n/a"}).`)):x.model_found===!1?(ze(`LOCAL OK, model not loaded - ${x.model}`),K(`Local server is reachable, but model '${x.model}' is not in loaded catalog. Use 'Load model list' and select one of loaded models.`)):(ze(`LOCAL OK (model list unavailable) - ${x.model}`),K("Local server is reachable, but model catalog could not be verified.")):(ze(`OPENAI OK - ${x.model}`),K(`OpenAI connection ok: ${x.model}`))}catch(x){const O=x instanceof Error?x.message:String(x);ze("Connection error"),oe(`Test connection: ${O}`),K(`Test connection error: ${O}`)}finally{re(!1)}}async function hn(){De(!0);try{const O=(await Ue.listModels(a)).models??[];We(O),O.length>0&&h(B=>B.model&&O.includes(B.model)?B:{...B,model:O[0]}),K(`Model catalog loaded (${a.llmProvider}): ${O.length} items.`)}catch(x){const O=x instanceof Error?x.message:String(x);K(`Load model list error: ${O}`)}finally{De(!1)}}P.useEffect(()=>{We([])},[a.llmProvider,a.baseUrl]);async function c(x){re(!0),oe("");try{const O=await Ue.normalize({connection:a,prompts:p,promptVersion:"normalizer_v2_0_2",query:{userQuestion:k.userQuestion,periodHint:k.periodHint,businessContext:k.businessContext,expectedRoute:k.expectedRoute},saveAsTestCase:x,useMock:b});Z(O),Le("normalized"),K(`Normalize done: trace=${O.trace_id}, validation=${O.validation.passed?"passed":"failed"}`),tt()}catch(O){const B=O instanceof Error?O.message:String(O);oe(`Normalize: ${B}`),K(`Normalize error: ${B}`)}finally{re(!1)}}function E(){const x=X.find(O=>O.id===Ne);if(!x){K("Preset is not selected.");return}He(p),D({systemPrompt:x.systemPrompt,developerPrompt:x.developerPrompt,domainPrompt:x.domainPrompt,schemaNotes:x.schemaNotes??"",fewShotExamples:x.fewShotExamples??""}),K(`Preset loaded: ${x.name}`)}async function ne(){try{await Ue.savePreset({name:be||"NDC preset",prompt_version:"normalizer_v2_0_2",systemPrompt:p.systemPrompt,developerPrompt:p.developerPrompt,domainPrompt:p.domainPrompt,schemaNotes:p.schemaNotes,fewShotExamples:p.fewShotExamples}),K("Preset saved."),await Yt()}catch(x){K(`Preset save error: ${x instanceof Error?x.message:String(x)}`)}}function Ee(){D(ec),K("Prompt panel reset to defaults.")}function Jt(){const x=Af(p,he);Ye(x),K(x)}function Xn(){const x=k.batchQuestionsRaw.split(";").map(O=>O.trim()).filter(Boolean).join(` - -`);x&&(F(O=>({...O,batchQuestionsRaw:x})),K("Batch field formatted: `;` converted to blank-line separators."))}async function Zn(x){try{const B=(await Ue.loadTrace(x)).trace,Ie=B.parsed_normalized_json??null;Z({trace_id:String(B.trace_id??x),ok:!!B.validation_result?.passed,normalized:Ie,route_hint_summary:B.route_hint_summary??(Ie?{route_hint:Ie.route_hint??null,confidence:Ie.confidence?.route_hint??null}:null),raw_model_output:B.raw_model_response??{},validation:B.validation_result??{passed:!1,errors:["validation not found"]},usage:B.usage??{input_tokens:0,output_tokens:0,total_tokens:0},latency_ms:Number(B.latency_ms??0),prompt_version:String(B.prompt_version??"unknown"),schema_version:String(B.schema_version??"unknown")}),Le("raw"),oe(""),K(`Trace opened: ${x}`)}catch(O){const B=O instanceof Error?O.message:String(O);oe(`Trace: ${B}`),K(`Trace open error ${x}: ${B}`)}}async function sl(){try{const x=await Ue.startRun();m(x.run.runId),K(`Run started: ${x.run.runId}`),K("Tip: start run does not execute normalize by itself. Use 'Run eval v2.0.2' button."),await pn()}catch(x){K(`Run start error: ${x instanceof Error?x.message:String(x)}`)}}async function ol(){if(T)try{await Ue.finishRun(T),K(`Run finished: ${T}`),await pn()}catch(x){K(`Run finish error: ${x instanceof Error?x.message:String(x)}`)}}async function wr(){le(!0),oe("");try{K("Starting eval in v2 contour.");const x=k.batchQuestionsRaw.trim()||k.userQuestion.trim();if(!x)throw new Error("Fill batch field or Raw user question first.");const O=await Ue.runEval({connection:a,prompts:p,promptVersion:"normalizer_v2_0_2",mode:"single-pass-strict",rawQuestions:x,useMock:b});de(O.report),K("Eval v2.0.2 run finished.");const B=O.report;if(B.run_id&&K(`Eval run id: ${B.run_id}`),B.metrics){const Ie=B.metrics;K(`Eval metrics v2.0.2: schema=${Ie.schema_validation_pass_rate??"n/a"}%, route_accuracy=${Ie.route_resolution_accuracy??"n/a"}%, no_route_precision=${Ie.no_route_precision??"n/a"}%, state_consistency=${Ie.execution_state_consistency_rate??"n/a"}%`)}await tt()}catch(x){const O=x instanceof Error?x.message:String(x);O.includes("Legacy eval runner supports normalized_query_v1 only")?(de({status:"plan_only",prompt_version:"normalizer_v2",reason:"backend eval runner is still legacy-v1 only",plan_file:"reports/v2_pilot_eval_plan.md",next_steps:["run cheap mock sanity for schema/fragment/scope","run small real batch (10-15 messages, temperature=0)","run challenge-30 replay with v2 metrics"]}),K("Backend is legacy-only for eval right now. Showing v2 pilot plan.")):(oe(`Eval: ${O}`),K(`Eval run error: ${O}`))}finally{le(!1)}}async function il(){try{const x=JSON.stringify(ee??{},null,2);await navigator.clipboard.writeText(x),K("Eval report copied to clipboard.")}catch(x){K(`Eval report copy error: ${x instanceof Error?x.message:String(x)}`)}}function In(){et(""),yt([]),ge(""),Se(""),Nt(""),K("Assistant session reset.")}async function jr(){const x=xt.trim();if(!x)return;dn(!0),Nt(""),ge(""),yt(B=>[...B,{message_id:`local-${Date.now()}`,session_id:ie||"pending",role:"user",text:x,reply_type:null,created_at:new Date().toISOString(),trace_id:null,debug:null}]);const O=fn();try{const B=await Ue.sendAssistantMessage({connection:a,prompts:p,userMessage:x,sessionId:ie||void 0,promptVersion:nc,context:{periodHint:k.periodHint,businessContext:k.businessContext},useMock:b});et(B.session_id),yt(B.conversation),Se("Ответ готов"),K(`Assistant reply received: trace=${B.debug.trace_id}`)}catch(B){const Ie=B instanceof Error?B.message:String(B);Nt(Ie),Se("Ошибка ассистента"),K(`Assistant error: ${Ie}`)}finally{O(),dn(!1)}}return P.useEffect(()=>{if(!T){Y([]);return}Ue.runTrace(T).then(x=>Y(x.items)).catch(x=>K(`Run trace error: ${x instanceof Error?x.message:String(x)}`))},[T]),o.jsxs("main",{className:`app-root ${ke==="autoruns"?"app-root-autoruns":""}`,children:[o.jsxs("header",{className:"app-topbar",children:[o.jsxs("div",{className:"mode-switch-row",children:[o.jsx("button",{type:"button",className:ke==="assistant"?"tab active":"tab",onClick:()=>Ot("assistant"),children:"Ассистент"}),o.jsx("button",{type:"button",className:ke==="decomposition"?"tab active":"tab",onClick:()=>Ot("decomposition"),children:"Декомпозиция"}),o.jsx("button",{type:"button",className:ke==="autoruns"?"tab active":"tab",onClick:()=>Ot("autoruns"),children:"История автопрогонов"})]}),ke==="autoruns"?o.jsxs("div",{className:"mode-switch-row mode-switch-row-right",children:[o.jsx("button",{type:"button",className:an?"tab active":"tab",onClick:()=>Gt(x=>!x),children:"Режим ассистента"}),o.jsx("button",{type:"button",className:kt?"tab active":"tab",onClick:()=>Dn(x=>!x),children:"Режим декомпозиции"}),o.jsx("button",{type:"button",className:un?"tab active":"tab",onClick:()=>ct(x=>!x),children:"Прогресс/регресс"})]}):null]}),ke==="assistant"?o.jsxs("div",{className:"layout-grid",children:[o.jsx(Zu,{value:a,modelOptions:ye,modelsBusy:G,onChange:h,onReloadModels:hn,onSaveLocalConfig:Dt,onTestConnection:mn,lastStatus:xe,busy:me||cn}),o.jsx(bu,{value:p,onChange:D,presets:X,selectedPresetId:Ne,onSelectPreset:ut,onLoadPreset:E,onSavePreset:ne,onResetDefaults:Ee,onDiffPrevious:Jt,presetName:be,onPresetNameChange:gt,diffSummary:Oe}),o.jsx(kf,{sessionId:ie,conversation:Mt,inputValue:xt,onInputChange:ge,periodHint:k.periodHint,onPeriodHintChange:x=>F(O=>({...O,periodHint:x})),businessContext:k.businessContext,onBusinessContextChange:x=>F(O=>({...O,businessContext:x})),useMock:b,onUseMockChange:pe,onSend:jr,onClear:In,busy:cn,statusText:Jn,errorMessage:Ct})]}):ke==="decomposition"?o.jsxs("div",{className:"layout-grid",children:[o.jsx(Zu,{value:a,modelOptions:ye,modelsBusy:G,onChange:h,onReloadModels:hn,onSaveLocalConfig:Dt,onTestConnection:mn,lastStatus:xe,busy:me}),o.jsx(bu,{value:p,onChange:D,presets:X,selectedPresetId:Ne,onSelectPreset:ut,onLoadPreset:E,onSavePreset:ne,onResetDefaults:Ee,onDiffPrevious:Jt,presetName:be,onPresetNameChange:gt,diffSummary:Oe}),o.jsx(Tf,{value:k,onChange:F,onApplyBatchFormat:Xn,onNormalize:c,busy:me,useMock:b,onUseMockChange:pe,errorMessage:ae}),o.jsx(Rf,{tab:L,onTabChange:Le,result:H,appLogs:ce}),o.jsx(Nf,{result:H}),o.jsx(Cf,{items:N,onRefresh:tt,onOpenTrace:Zn}),o.jsx(Lf,{runs:R,selectedRunId:T,onSelectRun:m,onStartRun:sl,onFinishRun:ol,onRefreshRuns:pn,onRunEval:wr,onCopyEvalReport:il,evalBusy:J,traceItems:_,evalReport:ee})]}):o.jsx("div",{className:"layout-grid layout-grid-autoruns",children:o.jsx(hf,{connection:a,prompts:p,assistantPromptVersion:nc,decompositionPromptVersion:si,showAssistantMode:an,showDecompositionMode:kt,showProgressMode:un,onLog:K})})]})}af.createRoot(document.getElementById("root")).render(o.jsx(ef.StrictMode,{children:o.jsx(Ff,{})})); diff --git a/llm_normalizer/frontend/dist/assets/index-Cbn_mHUl.js b/llm_normalizer/frontend/dist/assets/index-Cbn_mHUl.js new file mode 100644 index 0000000..8b54bb7 --- /dev/null +++ b/llm_normalizer/frontend/dist/assets/index-Cbn_mHUl.js @@ -0,0 +1,13 @@ +(function(){const m=document.createElement("link").relList;if(m&&m.supports&&m.supports("modulepreload"))return;for(const P of document.querySelectorAll('link[rel="modulepreload"]'))O(P);new MutationObserver(P=>{for(const F of P)if(F.type==="childList")for(const Q of F.addedNodes)Q.tagName==="LINK"&&Q.rel==="modulepreload"&&O(Q)}).observe(document,{childList:!0,subtree:!0});function p(P){const F={};return P.integrity&&(F.integrity=P.integrity),P.referrerPolicy&&(F.referrerPolicy=P.referrerPolicy),P.crossOrigin==="use-credentials"?F.credentials="include":P.crossOrigin==="anonymous"?F.credentials="omit":F.credentials="same-origin",F}function O(P){if(P.ep)return;P.ep=!0;const F=p(P);fetch(P.href,F)}})();function gc(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var gi={exports:{}},xl={},yi={exports:{}},oe={};var Yu;function nf(){if(Yu)return oe;Yu=1;var a=Symbol.for("react.element"),m=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),Q=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),z=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),C=Symbol.iterator;function H(h){return h===null||typeof h!="object"?null:(h=C&&h[C]||h["@@iterator"],typeof h=="function"?h:null)}var pe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Te=Object.assign,te={};function re(h,S,q){this.props=h,this.context=S,this.refs=te,this.updater=q||pe}re.prototype.isReactComponent={},re.prototype.setState=function(h,S){if(typeof h!="object"&&typeof h!="function"&&h!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,h,S,"setState")},re.prototype.forceUpdate=function(h){this.updater.enqueueForceUpdate(this,h,"forceUpdate")};function Se(){}Se.prototype=re.prototype;function me(h,S,q){this.props=h,this.context=S,this.refs=te,this.updater=q||pe}var Me=me.prototype=new Se;Me.constructor=me,Te(Me,re.prototype),Me.isPureReactComponent=!0;var Ne=Array.isArray,Ae=Object.prototype.hasOwnProperty,Fe={current:null},Ue={key:!0,ref:!0,__self:!0,__source:!0};function Ke(h,S,q){var b,ne={},le=null,de=null;if(S!=null)for(b in S.ref!==void 0&&(de=S.ref),S.key!==void 0&&(le=""+S.key),S)Ae.call(S,b)&&!Ue.hasOwnProperty(b)&&(ne[b]=S[b]);var ue=arguments.length-2;if(ue===1)ne.children=q;else if(1>>1,S=T[h];if(0>>1;hP(ne,M))leP(de,ne)?(T[h]=de,T[le]=M,h=le):(T[h]=ne,T[b]=M,h=b);else if(leP(de,M))T[h]=de,T[le]=M,h=le;else break e}}return W}function P(T,W){var M=T.sortIndex-W.sortIndex;return M!==0?M:T.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var F=performance;a.unstable_now=function(){return F.now()}}else{var Q=Date,Z=Q.now();a.unstable_now=function(){return Q.now()-Z}}var U=[],z=[],ee=1,C=null,H=3,pe=!1,Te=!1,te=!1,re=typeof setTimeout=="function"?setTimeout:null,Se=typeof clearTimeout=="function"?clearTimeout:null,me=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Me(T){for(var W=p(z);W!==null;){if(W.callback===null)O(z);else if(W.startTime<=T)O(z),W.sortIndex=W.expirationTime,m(U,W);else break;W=p(z)}}function Ne(T){if(te=!1,Me(T),!Te)if(p(U)!==null)Te=!0,he(Ae);else{var W=p(z);W!==null&&ye(Ne,W.startTime-T)}}function Ae(T,W){Te=!1,te&&(te=!1,Se(Ke),Ke=-1),pe=!0;var M=H;try{for(Me(W),C=p(U);C!==null&&(!(C.expirationTime>W)||T&&!xe());){var h=C.callback;if(typeof h=="function"){C.callback=null,H=C.priorityLevel;var S=h(C.expirationTime<=W);W=a.unstable_now(),typeof S=="function"?C.callback=S:C===p(U)&&O(U),Me(W)}else O(U);C=p(U)}if(C!==null)var q=!0;else{var b=p(z);b!==null&&ye(Ne,b.startTime-W),q=!1}return q}finally{C=null,H=M,pe=!1}}var Fe=!1,Ue=null,Ke=-1,st=5,be=-1;function xe(){return!(a.unstable_now()-beT||125h?(T.sortIndex=M,m(z,T),p(U)===null&&T===p(z)&&(te?(Se(Ke),Ke=-1):te=!0,ye(Ne,M-h))):(T.sortIndex=S,m(U,T),Te||pe||(Te=!0,he(Ae))),T},a.unstable_shouldYield=xe,a.unstable_wrapCallback=function(T){var W=H;return function(){var M=H;H=W;try{return T.apply(this,arguments)}finally{H=M}}}})(Si)),Si}var ec;function af(){return ec||(ec=1,_i.exports=sf()),_i.exports}var tc;function uf(){if(tc)return _t;tc=1;var a=Ci(),m=af();function p(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),U=Object.prototype.hasOwnProperty,z=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ee={},C={};function H(e){return U.call(C,e)?!0:U.call(ee,e)?!1:z.test(e)?C[e]=!0:(ee[e]=!0,!1)}function pe(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Te(e,t,n,r){if(t===null||typeof t>"u"||pe(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function te(e,t,n,r,l,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var re={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){re[e]=new te(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];re[t]=new te(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){re[e]=new te(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){re[e]=new te(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){re[e]=new te(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){re[e]=new te(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){re[e]=new te(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){re[e]=new te(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){re[e]=new te(e,5,!1,e.toLowerCase(),null,!1,!1)});var Se=/[\-:]([a-z])/g;function me(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Se,me);re[t]=new te(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Se,me);re[t]=new te(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Se,me);re[t]=new te(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){re[e]=new te(e,1,!1,e.toLowerCase(),null,!1,!1)}),re.xlinkHref=new te("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){re[e]=new te(e,1,!1,e.toLowerCase(),null,!0,!0)});function Me(e,t,n,r){var l=re.hasOwnProperty(t)?re[t]:null;(l!==null?l.type!==0:r||!(2c||l[i]!==o[c]){var d=` +`+l[i].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=i&&0<=c);break}}}finally{q=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?S(e):""}function ne(e){switch(e.tag){case 5:return S(e.type);case 16:return S("Lazy");case 13:return S("Suspense");case 19:return S("SuspenseList");case 0:case 2:case 15:return e=b(e.type,!1),e;case 11:return e=b(e.type.render,!1),e;case 1:return e=b(e.type,!0),e;default:return""}}function le(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ue:return"Fragment";case Fe:return"Portal";case st:return"Profiler";case Ke:return"StrictMode";case Ee:return"Suspense";case Ve:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case xe:return(e.displayName||"Context")+".Consumer";case be:return(e._context.displayName||"Context")+".Provider";case it:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case X:return t=e.displayName||null,t!==null?t:le(e.type)||"Memo";case he:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}function de(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return le(t);case 8:return t===Ke?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ue(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function se(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ve(e){var t=se(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Et(e){e._valueTracker||(e._valueTracker=ve(e))}function on(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=se(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function St(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Kt(e,t){var n=t.checked;return M({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function xn(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ue(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function at(e,t){t=t.checked,t!=null&&Me(e,"checked",t,!1)}function ae(e,t){at(e,t);var n=ue(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Gt(e,t.type,n):t.hasOwnProperty("defaultValue")&&Gt(e,t.type,ue(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function et(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Gt(e,t,n){(t!=="number"||St(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ut=Array.isArray;function Pt(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=dt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ge(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},At=["Webkit","ms","Moz","O"];Object.keys(Yt).forEach(function(e){At.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Yt[t]=Yt[e]})});function mt(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Yt.hasOwnProperty(e)&&Yt[e]?(""+t).trim():t+"px"}function It(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=mt(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var nr=M({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function wt(e,t){if(t){if(nr[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(p(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(p(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(p(61))}if(t.style!=null&&typeof t.style!="object")throw Error(p(62))}}function Sn(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Jt=null;function an(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var u=null,_=null,V=null;function je(e){if(e=ll(e)){if(typeof u!="function")throw Error(p(280));var t=e.stateNode;t&&(t=Kl(t),u(e.stateNode,e.type,t))}}function Ft(e){_?V?V.push(e):V=[e]:_=e}function Ut(){if(_){var e=_,t=V;if(V=_=null,je(e),t)for(e=0;e>>=0,e===0?32:31-(yc(e)/xc|0)|0}var Pl=64,Rl=4194304;function $r(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Tl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var c=i&~l;c!==0?r=$r(c):(o&=i,o!==0&&(r=$r(o)))}else i=n&~l,i!==0?r=$r(i):o!==0&&(r=$r(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Br(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ie(t),e[t]=n}function jc(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Yr),Hi=" ",Vi=!1;function Qi(e,t){switch(e){case"keyup":return Xc.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wi(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var cr=!1;function bc(e,t){switch(e){case"compositionend":return Wi(t);case"keypress":return t.which!==32?null:(Vi=!0,Hi);case"textInput":return e=t.data,e===Hi&&Vi?null:e;default:return null}}function ed(e,t){if(cr)return e==="compositionend"||!Xo&&Qi(e,t)?(e=Ai(),Ol=Wo=Pn=null,cr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Zi(n)}}function ea(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ea(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ta(){for(var e=window,t=St();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=St(e.document)}return t}function es(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function ud(e){var t=ta(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ea(n.ownerDocument.documentElement,n)){if(r!==null&&es(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=bi(n,o);var i=bi(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,dr=null,ts=null,br=null,ns=!1;function na(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ns||dr==null||dr!==St(r)||(r=dr,"selectionStart"in r&&es(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),br&&Zr(br,r)||(br=r,r=Vl(ts,"onSelect"),0vr||(e.current=ms[vr],ms[vr]=null,vr--)}function we(e,t){vr++,ms[vr]=e.current,e.current=t}var Ln={},tt=Mn(Ln),ht=Mn(!1),Wn=Ln;function gr(e,t){var n=e.type.contextTypes;if(!n)return Ln;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function vt(e){return e=e.childContextTypes,e!=null}function Gl(){Ce(ht),Ce(tt)}function ga(e,t,n){if(tt.current!==Ln)throw Error(p(168));we(tt,t),we(ht,n)}function ya(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(p(108,de(e)||"Unknown",l));return M({},n,r)}function ql(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ln,Wn=tt.current,we(tt,e),we(ht,ht.current),!0}function xa(e,t,n){var r=e.stateNode;if(!r)throw Error(p(169));n?(e=ya(e,t,Wn),r.__reactInternalMemoizedMergedChildContext=e,Ce(ht),Ce(tt),we(tt,e)):Ce(ht),we(ht,n)}var dn=null,Yl=!1,hs=!1;function _a(e){dn===null?dn=[e]:dn.push(e)}function Sd(e){Yl=!0,_a(e)}function zn(){if(!hs&&dn!==null){hs=!0;var e=0,t=ge;try{var n=dn;for(ge=1;e>=i,l-=i,fn=1<<32-ie(t)+l|n<J?(Je=G,G=null):Je=G.sibling;var fe=w(v,G,g[J],R);if(fe===null){G===null&&(G=Je);break}e&&G&&fe.alternate===null&&t(v,G),f=o(fe,f,J),K===null?B=fe:K.sibling=fe,K=fe,G=Je}if(J===g.length)return n(v,G),Re&&Gn(v,J),B;if(G===null){for(;JJ?(Je=G,G=null):Je=G.sibling;var Hn=w(v,G,fe.value,R);if(Hn===null){G===null&&(G=Je);break}e&&G&&Hn.alternate===null&&t(v,G),f=o(Hn,f,J),K===null?B=Hn:K.sibling=Hn,K=Hn,G=Je}if(fe.done)return n(v,G),Re&&Gn(v,J),B;if(G===null){for(;!fe.done;J++,fe=g.next())fe=N(v,fe.value,R),fe!==null&&(f=o(fe,f,J),K===null?B=fe:K.sibling=fe,K=fe);return Re&&Gn(v,J),B}for(G=r(v,G);!fe.done;J++,fe=g.next())fe=D(G,v,J,fe.value,R),fe!==null&&(e&&fe.alternate!==null&&G.delete(fe.key===null?J:fe.key),f=o(fe,f,J),K===null?B=fe:K.sibling=fe,K=fe);return e&&G.forEach(function(tf){return t(v,tf)}),Re&&Gn(v,J),B}function $e(v,f,g,R){if(typeof g=="object"&&g!==null&&g.type===Ue&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Ae:e:{for(var B=g.key,K=f;K!==null;){if(K.key===B){if(B=g.type,B===Ue){if(K.tag===7){n(v,K.sibling),f=l(K,g.props.children),f.return=v,v=f;break e}}else if(K.elementType===B||typeof B=="object"&&B!==null&&B.$$typeof===he&&Na(B)===K.type){n(v,K.sibling),f=l(K,g.props),f.ref=ol(v,K,g),f.return=v,v=f;break e}n(v,K);break}else t(v,K);K=K.sibling}g.type===Ue?(f=tr(g.props.children,v.mode,R,g.key),f.return=v,v=f):(R=ko(g.type,g.key,g.props,null,v.mode,R),R.ref=ol(v,f,g),R.return=v,v=R)}return i(v);case Fe:e:{for(K=g.key;f!==null;){if(f.key===K)if(f.tag===4&&f.stateNode.containerInfo===g.containerInfo&&f.stateNode.implementation===g.implementation){n(v,f.sibling),f=l(f,g.children||[]),f.return=v,v=f;break e}else{n(v,f);break}else t(v,f);f=f.sibling}f=fi(g,v.mode,R),f.return=v,v=f}return i(v);case he:return K=g._init,$e(v,f,K(g._payload),R)}if(ut(g))return I(v,f,g,R);if(W(g))return $(v,f,g,R);bl(v,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,f!==null&&f.tag===6?(n(v,f.sibling),f=l(f,g),f.return=v,v=f):(n(v,f),f=di(g,v.mode,R),f.return=v,v=f),i(v)):n(v,f)}return $e}var Sr=Ea(!0),Pa=Ea(!1),eo=Mn(null),to=null,wr=null,Ss=null;function ws(){Ss=wr=to=null}function js(e){var t=eo.current;Ce(eo),e._currentValue=t}function ks(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function jr(e,t){to=e,Ss=wr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(gt=!0),e.firstContext=null)}function Mt(e){var t=e._currentValue;if(Ss!==e)if(e={context:e,memoizedValue:t,next:null},wr===null){if(to===null)throw Error(p(308));wr=e,to.dependencies={lanes:0,firstContext:e}}else wr=wr.next=e;return t}var qn=null;function Cs(e){qn===null?qn=[e]:qn.push(e)}function Ra(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Cs(t)):(n.next=l.next,l.next=n),t.interleaved=n,mn(e,r)}function mn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Dn=!1;function Ns(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ta(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function hn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function On(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(ce&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,mn(e,n)}return l=r.interleaved,l===null?(t.next=t,Cs(r)):(t.next=l.next,l.next=t),r.interleaved=t,mn(e,n)}function no(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$o(e,n)}}function Ma(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ro(e,t,n,r){var l=e.updateQueue;Dn=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,c=l.shared.pending;if(c!==null){l.shared.pending=null;var d=c,x=d.next;d.next=null,i===null?o=x:i.next=x,i=d;var k=e.alternate;k!==null&&(k=k.updateQueue,c=k.lastBaseUpdate,c!==i&&(c===null?k.firstBaseUpdate=x:c.next=x,k.lastBaseUpdate=d))}if(o!==null){var N=l.baseState;i=0,k=x=d=null,c=o;do{var w=c.lane,D=c.eventTime;if((r&w)===w){k!==null&&(k=k.next={eventTime:D,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var I=e,$=c;switch(w=t,D=n,$.tag){case 1:if(I=$.payload,typeof I=="function"){N=I.call(D,N,w);break e}N=I;break e;case 3:I.flags=I.flags&-65537|128;case 0:if(I=$.payload,w=typeof I=="function"?I.call(D,N,w):I,w==null)break e;N=M({},N,w);break e;case 2:Dn=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,w=l.effects,w===null?l.effects=[c]:w.push(c))}else D={eventTime:D,lane:w,tag:c.tag,payload:c.payload,callback:c.callback,next:null},k===null?(x=k=D,d=N):k=k.next=D,i|=w;if(c=c.next,c===null){if(c=l.shared.pending,c===null)break;w=c,c=w.next,w.next=null,l.lastBaseUpdate=w,l.shared.pending=null}}while(!0);if(k===null&&(d=N),l.baseState=d,l.firstBaseUpdate=x,l.lastBaseUpdate=k,t=l.shared.interleaved,t!==null){l=t;do i|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);Xn|=i,e.lanes=i,e.memoizedState=N}}function La(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ms.transition;Ms.transition={};try{e(!1),t()}finally{ge=n,Ms.transition=r}}function Xa(){return Lt().memoizedState}function Cd(e,t,n){var r=Un(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Za(e))ba(t,n);else if(n=Ra(e,t,n,r),n!==null){var l=pt();Wt(n,e,r,l),eu(n,t,r)}}function Nd(e,t,n){var r=Un(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Za(e))ba(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,c=o(i,n);if(l.hasEagerState=!0,l.eagerState=c,$t(c,i)){var d=t.interleaved;d===null?(l.next=l,Cs(t)):(l.next=d.next,d.next=l),t.interleaved=l;return}}catch{}n=Ra(e,t,l,r),n!==null&&(l=pt(),Wt(n,e,r,l),eu(n,t,r))}}function Za(e){var t=e.alternate;return e===De||t!==null&&t===De}function ba(e,t){ul=so=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function eu(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$o(e,n)}}var uo={readContext:Mt,useCallback:nt,useContext:nt,useEffect:nt,useImperativeHandle:nt,useInsertionEffect:nt,useLayoutEffect:nt,useMemo:nt,useReducer:nt,useRef:nt,useState:nt,useDebugValue:nt,useDeferredValue:nt,useTransition:nt,useMutableSource:nt,useSyncExternalStore:nt,useId:nt,unstable_isNewReconciler:!1},Ed={readContext:Mt,useCallback:function(e,t){return nn().memoizedState=[e,t===void 0?null:t],e},useContext:Mt,useEffect:Va,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,io(4194308,4,Ka.bind(null,t,e),n)},useLayoutEffect:function(e,t){return io(4194308,4,e,t)},useInsertionEffect:function(e,t){return io(4,2,e,t)},useMemo:function(e,t){var n=nn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=nn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Cd.bind(null,De,e),[r.memoizedState,e]},useRef:function(e){var t=nn();return e={current:e},t.memoizedState=e},useState:Ba,useDebugValue:Fs,useDeferredValue:function(e){return nn().memoizedState=e},useTransition:function(){var e=Ba(!1),t=e[0];return e=kd.bind(null,e[1]),nn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=De,l=nn();if(Re){if(n===void 0)throw Error(p(407));n=n()}else{if(n=t(),Ye===null)throw Error(p(349));(Jn&30)!==0||Aa(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Va(Fa.bind(null,r,o,e),[e]),r.flags|=2048,fl(9,Ia.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=nn(),t=Ye.identifierPrefix;if(Re){var n=pn,r=fn;n=(r&~(1<<32-ie(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=cl++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[en]=t,e[rl]=r,_u(e,t,!1,!1),t.stateNode=e;e:{switch(i=Sn(n,r),n){case"dialog":ke("cancel",e),ke("close",e),l=r;break;case"iframe":case"object":case"embed":ke("load",e),l=r;break;case"video":case"audio":for(l=0;lPr&&(t.flags|=128,r=!0,pl(o,!1),t.lanes=4194304)}else{if(!r)if(e=lo(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),pl(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!Re)return rt(t),null}else 2*Le()-o.renderingStartTime>Pr&&n!==1073741824&&(t.flags|=128,r=!0,pl(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Le(),t.sibling=null,n=ze.current,we(ze,r?n&1|2:n&1),t):(rt(t),null);case 22:case 23:return ai(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(Nt&1073741824)!==0&&(rt(t),t.subtreeFlags&6&&(t.flags|=8192)):rt(t),null;case 24:return null;case 25:return null}throw Error(p(156,t.tag))}function Od(e,t){switch(gs(t),t.tag){case 1:return vt(t.type)&&Gl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return kr(),Ce(ht),Ce(tt),Ts(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ps(t),null;case 13:if(Ce(ze),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(p(340));_r()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ce(ze),null;case 4:return kr(),null;case 10:return js(t.type._context),null;case 22:case 23:return ai(),null;case 24:return null;default:return null}}var mo=!1,lt=!1,Ad=typeof WeakSet=="function"?WeakSet:Set,A=null;function Nr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ie(e,t,r)}else n.current=null}function Js(e,t,n){try{n()}catch(r){Ie(e,t,r)}}var ju=!1;function Id(e,t){if(as=zl,e=ta(),es(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,c=-1,d=-1,x=0,k=0,N=e,w=null;t:for(;;){for(var D;N!==n||l!==0&&N.nodeType!==3||(c=i+l),N!==o||r!==0&&N.nodeType!==3||(d=i+r),N.nodeType===3&&(i+=N.nodeValue.length),(D=N.firstChild)!==null;)w=N,N=D;for(;;){if(N===e)break t;if(w===n&&++x===l&&(c=i),w===o&&++k===r&&(d=i),(D=N.nextSibling)!==null)break;N=w,w=N.parentNode}N=D}n=c===-1||d===-1?null:{start:c,end:d}}else n=null}n=n||{start:0,end:0}}else n=null;for(us={focusedElem:e,selectionRange:n},zl=!1,A=t;A!==null;)if(t=A,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,A=e;else for(;A!==null;){t=A;try{var I=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(I!==null){var $=I.memoizedProps,$e=I.memoizedState,v=t.stateNode,f=v.getSnapshotBeforeUpdate(t.elementType===t.type?$:Ht(t.type,$),$e);v.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163))}}catch(R){Ie(t,t.return,R)}if(e=t.sibling,e!==null){e.return=t.return,A=e;break}A=t.return}return I=ju,ju=!1,I}function ml(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&Js(t,n,o)}l=l.next}while(l!==r)}}function ho(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Xs(e){var t=e.ref;if(t!==null){var n=e.stateNode;e.tag,e=n,typeof t=="function"?t(e):t.current=e}}function ku(e){var t=e.alternate;t!==null&&(e.alternate=null,ku(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[en],delete t[rl],delete t[ps],delete t[xd],delete t[_d])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Cu(e){return e.tag===5||e.tag===3||e.tag===4}function Nu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Cu(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Zs(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Wl));else if(r!==4&&(e=e.child,e!==null))for(Zs(e,t,n),e=e.sibling;e!==null;)Zs(e,t,n),e=e.sibling}function bs(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(bs(e,t,n),e=e.sibling;e!==null;)bs(e,t,n),e=e.sibling}var Xe=null,Vt=!1;function An(e,t,n){for(n=n.child;n!==null;)Eu(e,t,n),n=n.sibling}function Eu(e,t,n){if(L&&typeof L.onCommitFiberUnmount=="function")try{L.onCommitFiberUnmount(y,n)}catch{}switch(n.tag){case 5:lt||Nr(n,t);case 6:var r=Xe,l=Vt;Xe=null,An(e,t,n),Xe=r,Vt=l,Xe!==null&&(Vt?(e=Xe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Xe.removeChild(n.stateNode));break;case 18:Xe!==null&&(Vt?(e=Xe,n=n.stateNode,e.nodeType===8?fs(e.parentNode,n):e.nodeType===1&&fs(e,n),Kr(e)):fs(Xe,n.stateNode));break;case 4:r=Xe,l=Vt,Xe=n.stateNode.containerInfo,Vt=!0,An(e,t,n),Xe=r,Vt=l;break;case 0:case 11:case 14:case 15:if(!lt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&((o&2)!==0||(o&4)!==0)&&Js(n,t,i),l=l.next}while(l!==r)}An(e,t,n);break;case 1:if(!lt&&(Nr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){Ie(n,t,c)}An(e,t,n);break;case 21:An(e,t,n);break;case 22:n.mode&1?(lt=(r=lt)||n.memoizedState!==null,An(e,t,n),lt=r):An(e,t,n);break;default:An(e,t,n)}}function Pu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ad),t.forEach(function(r){var l=Kd.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Qt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=Le()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Ud(r/1960))-r,10e?16:e,Fn===null)var r=!1;else{if(e=Fn,Fn=null,_o=0,(ce&6)!==0)throw Error(p(331));var l=ce;for(ce|=4,A=e.current;A!==null;){var o=A,i=o.child;if((A.flags&16)!==0){var c=o.deletions;if(c!==null){for(var d=0;dLe()-ni?bn(e,0):ti|=n),xt(e,t)}function Bu(e,t){t===0&&((e.mode&1)===0?t=1:(t=Rl,Rl<<=1,(Rl&130023424)===0&&(Rl=4194304)));var n=pt();e=mn(e,t),e!==null&&(Br(e,t,n),xt(e,n))}function Wd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bu(e,n)}function Kd(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(p(314))}r!==null&&r.delete(t),Bu(e,n)}var Hu;Hu=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ht.current)gt=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return gt=!1,zd(e,t,n);gt=(e.flags&131072)!==0}else gt=!1,Re&&(t.flags&1048576)!==0&&Sa(t,Xl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;po(e,t),e=t.pendingProps;var l=gr(t,tt.current);jr(t,n),l=zs(null,t,r,e,l,n);var o=Ds();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,vt(r)?(o=!0,ql(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Ns(t),l.updater=co,t.stateNode=l,l._reactInternals=t,$s(t,r,e,n),t=Qs(null,t,r,!0,o,n)):(t.tag=0,Re&&o&&vs(t),ft(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(po(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=qd(r),e=Ht(r,e),l){case 0:t=Vs(null,t,r,e,n);break e;case 1:t=mu(null,t,r,e,n);break e;case 11:t=uu(null,t,r,e,n);break e;case 14:t=cu(null,t,r,Ht(r.type,e),n);break e}throw Error(p(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ht(r,l),Vs(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ht(r,l),mu(e,t,r,l,n);case 3:e:{if(hu(t),e===null)throw Error(p(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Ta(e,t),ro(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=Cr(Error(p(423)),t),t=vu(e,t,r,n,l);break e}else if(r!==l){l=Cr(Error(p(424)),t),t=vu(e,t,r,n,l);break e}else for(Ct=Tn(t.stateNode.containerInfo.firstChild),kt=t,Re=!0,Bt=null,n=Pa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(_r(),r===l){t=vn(e,t,n);break e}ft(e,t,r,n)}t=t.child}return t;case 5:return za(t),e===null&&xs(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,cs(r,l)?i=null:o!==null&&cs(r,o)&&(t.flags|=32),pu(e,t),ft(e,t,i,n),t.child;case 6:return e===null&&xs(t),null;case 13:return gu(e,t,n);case 4:return Es(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Sr(t,null,r,n):ft(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ht(r,l),uu(e,t,r,l,n);case 7:return ft(e,t,t.pendingProps,n),t.child;case 8:return ft(e,t,t.pendingProps.children,n),t.child;case 12:return ft(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,we(eo,r._currentValue),r._currentValue=i,o!==null)if($t(o.value,i)){if(o.children===l.children&&!ht.current){t=vn(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){i=o.child;for(var d=c.firstContext;d!==null;){if(d.context===r){if(o.tag===1){d=hn(-1,n&-n),d.tag=2;var x=o.updateQueue;if(x!==null){x=x.shared;var k=x.pending;k===null?d.next=d:(d.next=k.next,k.next=d),x.pending=d}}o.lanes|=n,d=o.alternate,d!==null&&(d.lanes|=n),ks(o.return,n,t),c.lanes|=n;break}d=d.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(p(341));i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),ks(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}ft(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,jr(t,n),l=Mt(l),r=r(l),t.flags|=1,ft(e,t,r,n),t.child;case 14:return r=t.type,l=Ht(r,t.pendingProps),l=Ht(r.type,l),cu(e,t,r,l,n);case 15:return du(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ht(r,l),po(e,t),t.tag=1,vt(r)?(e=!0,ql(t)):e=!1,jr(t,n),nu(t,r,l),$s(t,r,l,n),Qs(null,t,r,!0,e,n);case 19:return xu(e,t,n);case 22:return fu(e,t,n)}throw Error(p(156,t.tag))};function Vu(e,t){return Ir(e,t)}function Gd(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dt(e,t,n,r){return new Gd(e,t,n,r)}function ci(e){return e=e.prototype,!(!e||!e.isReactComponent)}function qd(e){if(typeof e=="function")return ci(e)?1:0;if(e!=null){if(e=e.$$typeof,e===it)return 11;if(e===X)return 14}return 2}function Bn(e,t){var n=e.alternate;return n===null?(n=Dt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ko(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")ci(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Ue:return tr(n.children,l,o,t);case Ke:i=8,l|=8;break;case st:return e=Dt(12,n,t,l|2),e.elementType=st,e.lanes=o,e;case Ee:return e=Dt(13,n,t,l),e.elementType=Ee,e.lanes=o,e;case Ve:return e=Dt(19,n,t,l),e.elementType=Ve,e.lanes=o,e;case ye:return Co(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case be:i=10;break e;case xe:i=9;break e;case it:i=11;break e;case X:i=14;break e;case he:i=16,r=null;break e}throw Error(p(130,e==null?e:typeof e,""))}return t=Dt(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function tr(e,t,n,r){return e=Dt(7,e,r,t),e.lanes=n,e}function Co(e,t,n,r){return e=Dt(22,e,r,t),e.elementType=ye,e.lanes=n,e.stateNode={isHidden:!1},e}function di(e,t,n){return e=Dt(6,e,null,t),e.lanes=n,e}function fi(e,t,n){return t=Dt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Yd(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Uo(0),this.expirationTimes=Uo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uo(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function pi(e,t,n,r,l,o,i,c,d){return e=new Yd(e,t,n,c,d),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Dt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ns(o),e}function Jd(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(m){console.error(m)}}return a(),xi.exports=uf(),xi.exports}var rc;function df(){if(rc)return Lo;rc=1;var a=cf();return Lo.createRoot=a.createRoot,Lo.hydrateRoot=a.hydrateRoot,Lo}var ff=df();const pf=gc(ff),mf="/api";async function Oe(a,m){const p=await fetch(`${mf}${a}`,{...m,headers:{"Content-Type":"application/json",...m?.headers??{}}}),O=await p.json();if(!p.ok){const P=O.error?.message??"Ошибка запроса";throw new Error(P)}return O}const Be={async listModels(a){return Oe("/llm/models",{method:"POST",body:JSON.stringify({llmProvider:a.llmProvider,apiKey:a.apiKey,model:a.model,baseUrl:a.baseUrl})})},async testConnection(a){return Oe("/llm/test-connection",{method:"POST",body:JSON.stringify({llmProvider:a.llmProvider,apiKey:a.apiKey,model:a.model,baseUrl:a.baseUrl})})},async normalize(a){return Oe("/normalize",{method:"POST",body:JSON.stringify({llmProvider:a.connection.llmProvider,apiKey:a.connection.apiKey,model:a.connection.model,baseUrl:a.connection.baseUrl,temperature:a.connection.temperature,maxOutputTokens:a.connection.maxOutputTokens,promptVersion:a.promptVersion,systemPrompt:a.prompts.systemPrompt,developerPrompt:a.prompts.developerPrompt,domainPrompt:a.prompts.domainPrompt,fewShotExamples:a.prompts.fewShotExamples,userQuestion:a.query.userQuestion,context:{period_hint:a.query.periodHint??"",business_context:a.query.businessContext??"",expected_route:a.query.expectedRoute??""},saveAsTestCase:!!a.saveAsTestCase,useMock:!!a.useMock})})},async loadHistory(){return Oe("/history")},async loadTrace(a){return Oe(`/history/${a}`)},async loadPresets(){return Oe("/presets")},async savePreset(a){return Oe("/presets/save",{method:"POST",body:JSON.stringify(a)})},async runEval(a){return Oe("/eval/run",{method:"POST",body:JSON.stringify({normalizeConfig:{llmProvider:a.connection.llmProvider,apiKey:a.connection.apiKey,model:a.connection.model,baseUrl:a.connection.baseUrl,temperature:a.connection.temperature,maxOutputTokens:a.connection.maxOutputTokens,promptVersion:a.promptVersion,systemPrompt:a.prompts.systemPrompt,developerPrompt:a.prompts.developerPrompt,domainPrompt:a.prompts.domainPrompt,fewShotExamples:a.prompts.fewShotExamples},caseIds:a.caseIds,useMock:!!a.useMock,mode:a.mode??"standard",caseSetFile:a.caseSetFile,rawQuestions:a.rawQuestions})})},async startRun(){return Oe("/accounting-agent/v1/runs/start",{method:"POST",body:JSON.stringify({initiator:"ndc_operator",source:"gui"})})},async finishRun(a){return Oe("/accounting-agent/v1/runs/finish",{method:"POST",body:JSON.stringify({runId:a,status:"DONE",source:"gui",reason:"Остановлено оператором из GUI"})})},async listRuns(){return Oe("/accounting-agent/v1/runs")},async listResults(){return Oe("/accounting-agent/v1/results")},async runTrace(a){return Oe(`/accounting-agent/v1/trace/run/${a}`)},async sendAssistantMessage(a){return Oe("/assistant/message",{method:"POST",body:JSON.stringify({session_id:a.sessionId??"",mode:"assistant",message:a.userMessage,user_message:a.userMessage,llmProvider:a.connection.llmProvider,apiKey:a.connection.apiKey,model:a.connection.model,baseUrl:a.connection.baseUrl,temperature:a.connection.temperature,maxOutputTokens:a.connection.maxOutputTokens,promptVersion:a.promptVersion??"address_query_runtime_v1",systemPrompt:a.prompts.systemPrompt,developerPrompt:a.prompts.developerPrompt,domainPrompt:a.prompts.domainPrompt,fewShotExamples:a.prompts.fewShotExamples,context:{period_hint:a.context?.periodHint??"",business_context:a.context?.businessContext??""},useMock:!!a.useMock})})},async loadAssistantSession(a){return Oe(`/assistant/session/${a}`)},async loadAutoRunsHistory(a){const m=new URLSearchParams;a?.from&&m.set("from",a.from),a?.to&&m.set("to",a.to),a?.target&&m.set("target",a.target),a?.mode&&m.set("mode",a.mode),a?.use_mock&&m.set("use_mock",a.use_mock),a?.prompt_contains&&m.set("prompt_contains",a.prompt_contains),typeof a?.limit=="number"&&m.set("limit",String(a.limit)),typeof a?.scan_limit=="number"&&m.set("scan_limit",String(a.scan_limit));const p=m.toString();return Oe(`/autoruns/history${p?`?${p}`:""}`)},async loadAutoRunDetail(a){return Oe(`/autoruns/history/${encodeURIComponent(a)}`)},async loadAutoRunCaseDialog(a,m){return Oe(`/autoruns/history/${encodeURIComponent(a)}/case/${encodeURIComponent(m)}/dialog`)},async loadAutoRunAnnotations(a){const m=new URLSearchParams;a?.run_id&&m.set("run_id",a.run_id),a?.case_id&&m.set("case_id",a.case_id),typeof a?.min_rating=="number"&&m.set("min_rating",String(a.min_rating)),a?.manual_case_decision&&m.set("manual_case_decision",a.manual_case_decision),typeof a?.limit=="number"&&m.set("limit",String(a.limit));const p=m.toString();return Oe(`/autoruns/annotations${p?`?${p}`:""}`)},async saveAutoRunAnnotation(a){return Oe("/autoruns/annotations",{method:"POST",body:JSON.stringify(a)})},async loadAutoRunPostAnalysis(a){const m=new URLSearchParams;a?.run_id&&m.set("run_id",a.run_id),typeof a?.limit_per_queue=="number"&&m.set("limit_per_queue",String(a.limit_per_queue)),typeof a?.annotation_limit=="number"&&m.set("annotation_limit",String(a.annotation_limit)),typeof a?.scan_limit=="number"&&m.set("scan_limit",String(a.scan_limit)),a?.from&&m.set("from",a.from),a?.to&&m.set("to",a.to),a?.target&&m.set("target",a.target),a?.mode&&m.set("mode",a.mode),a?.use_mock&&m.set("use_mock",a.use_mock),a?.prompt_contains&&m.set("prompt_contains",a.prompt_contains);const p=m.toString();return Oe(`/autoruns/post-analysis${p?`?${p}`:""}`)},async loadAutoRunAutogenHistory(a){const m=new URLSearchParams;a?.mode&&m.set("mode",a.mode),typeof a?.limit=="number"&&m.set("limit",String(a.limit));const p=m.toString();return Oe(`/autoruns/autogen/history${p?`?${p}`:""}`)},async generateAutoRunQuestions(a){return Oe("/autoruns/autogen/generate",{method:"POST",body:JSON.stringify(a)})}};function ot({value:a}){return s.jsx("pre",{className:"json-view",children:JSON.stringify(a??{},null,2)})}function ln({title:a,subtitle:m,actions:p,className:O,hideHeader:P,children:F}){return s.jsxs("section",{className:O?`panel-frame ${O}`:"panel-frame",children:[P?null:s.jsxs("header",{className:"panel-header",children:[s.jsxs("div",{children:[s.jsx("h2",{children:a}),m?s.jsx("p",{children:m}):null]}),p?s.jsx("div",{className:"panel-actions",children:p}):null]}),s.jsx("div",{className:"panel-body",children:F})]})}function hf(a){const m=new Date(a);return Number.isNaN(m.getTime())?a:m.toLocaleString("ru-RU")}function vf({sessionId:a,conversation:m,statusText:p,errorMessage:O,useMock:P,appLogs:F}){const Q=m.filter(z=>z.role==="assistant").length,Z=m.filter(z=>z.role==="user").length,U=m.length>0?m[m.length-1]:null;return s.jsxs(ln,{title:"SAM",subtitle:"System Assistant Monitor: срез по текущей сессии и логам.",children:[s.jsxs("div",{className:"metrics-grid",children:[s.jsxs("div",{children:[s.jsx("span",{children:"session_id"}),s.jsx("strong",{children:a||"новая сессия"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"mock_mode"}),s.jsx("strong",{children:P?"on":"off"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"сообщений пользователя"}),s.jsx("strong",{children:Z})]}),s.jsxs("div",{children:[s.jsx("span",{children:"ответов ассистента"}),s.jsx("strong",{children:Q})]}),s.jsxs("div",{children:[s.jsx("span",{children:"статус"}),s.jsx("strong",{children:p||"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"ошибка"}),s.jsx("strong",{children:O||"нет"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"последнее сообщение"}),s.jsx("strong",{children:U?.created_at?hf(U.created_at):"нет данных"})]})]}),s.jsx("h3",{style:{marginTop:12},children:"Последние системные логи"}),s.jsx(ot,{value:F.slice(0,120)})]})}const lc={fromLocal:"",toLocal:"",target:"all",mode:"all",useMock:"any",promptContains:"",limit:120},zo="needs_dialog_policy_fix",oc="ndc_autoruns_ui_config_v1",sc="ndc-autoruns-save",Mr=[{id:"general",label:"Общий контур",domain:"",defaultPrompt:"Генерируй реалистичные живые вопросы бухгалтера по 1С. Добавляй разговорные формулировки и опечатки, но сохраняй бизнес-смысл."},{id:"settlements_60_62",label:"Расчеты 60/62",domain:"settlements_60_62",defaultPrompt:"Генерируй вопросы по расчетам с контрагентами (счета 60/62): закрытие задолженности, авансы, сверки, переносы остатков, цепочки документов."},{id:"month_close_costs_20_44",label:"Закрытие месяца 20/44",domain:"month_close_costs_20_44",defaultPrompt:"Генерируй вопросы по закрытию месяца и затратам на счетах 20/44: распределение, закрытие, остатки, аномалии и разницы по периодам."},{id:"vat_document_register_book",label:"НДС и регистры",domain:"vat_document_register_book",defaultPrompt:"Генерируй вопросы по НДС: начисление, вычет, книги покупок/продаж, счета-фактуры, прогноз обязательств и сверка цепочки документов."}];function gf(){return Mr.reduce((a,m)=>(a[m.id]=m.defaultPrompt,a),{})}const yf=new Set(Mr.map(a=>a.id)),xf={mode:"codex_creative",count:24,personalityId:"general",personalityPrompts:gf(),persistToEvalCases:!0,generatedBy:"manual_reviewer"};function _f(a){const m=a.getFullYear(),p=String(a.getMonth()+1).padStart(2,"0"),O=String(a.getDate()).padStart(2,"0"),P=String(a.getHours()).padStart(2,"0"),F=String(a.getMinutes()).padStart(2,"0");return`${m}-${p}-${O}T${P}:${F}`}function ic(){const a=new Date;return a.setDate(a.getDate()-14),_f(a)}function Do(a){if(!a.trim())return;const m=Date.parse(a);if(Number.isFinite(m))return new Date(m).toISOString()}function Tr(a){if(!a)return"нет данных";const m=Date.parse(a);return Number.isFinite(m)?new Date(m).toLocaleString("ru-RU"):a}function Sf(a,m){return m<=0?0:Math.max(0,Math.min(100,Number((a/m*100).toFixed(1))))}function _l(a){return typeof a!="number"?"нет данных":`${a.toFixed(1)}%`}function wf(a){return a==="assistant_stage1"?"assistant/s1":a==="assistant_stage2"?"assistant/s2":a==="assistant_p0"?"assistant/p0":a}function ac(a){return a==="up"?"Рост":a==="down"?"Регресс":"Без изменений"}function jf(a,m){return a.find(p=>p.case_id===m)??null}function uc(a){const m=Math.max(1,Math.min(5,Math.round(a)));return`${"●".repeat(m)}${"○".repeat(5-m)}`}function cc(a){return a.length===0?s.jsx("p",{className:"muted",children:"Покрытие доменов пока не сформировано."}):s.jsx("div",{className:"autoruns-coverage-list",children:a.map(m=>{const p=Sf(m.closed_cases,m.total_cases);return s.jsxs("div",{className:"autoruns-coverage-item",children:[s.jsxs("div",{className:"autoruns-coverage-head",children:[s.jsx("strong",{children:m.domain}),s.jsxs("span",{children:[m.closed_cases,"/",m.total_cases," (",p,"%)"]})]}),s.jsx("div",{className:"autoruns-coverage-bar",children:s.jsx("div",{style:{width:`${p}%`}})})]},m.domain)})})}function kf({connection:a,prompts:m,assistantPromptVersion:p,decompositionPromptVersion:O,showAssistantMode:P,showDecompositionMode:F,showProgressMode:Q,showCommentsMode:Z,onLog:U}){const[z,ee]=j.useState({...lc,fromLocal:ic()}),[C,H]=j.useState(null),[pe,Te]=j.useState(null),[te,re]=j.useState(null),[Se,me]=j.useState([]),[Me,Ne]=j.useState("all"),[Ae,Fe]=j.useState(null),[Ue,Ke]=j.useState([]),[st,be]=j.useState(""),[xe,it]=j.useState(""),[Ee,Ve]=j.useState(""),[X,he]=j.useState(xf),[ye,T]=j.useState([]),[W,M]=j.useState(null),[h,S]=j.useState(!1),[q,b]=j.useState(!1),[ne,le]=j.useState(!1),[de,ue]=j.useState(!1),[se,ve]=j.useState(!1),[Et,on]=j.useState(!1),[St,Kt]=j.useState(!1),[xn,at]=j.useState(""),[ae,et]=j.useState({open:!1,messageIndex:-1,rating:3,comment:"",manualCaseDecision:zo,annotationAuthor:"manual_reviewer",saving:!1,error:""}),Gt=j.useRef(!1),ut=j.useMemo(()=>Mr.find(u=>u.id===X.personalityId)??Mr[0],[X.personalityId]),Pt=C?.items.find(u=>u.run_id===xe)??pe?.run??null,ct=pe?jf(pe.cases,Ee):null,_e=Se.find(u=>u.annotation_id===st)??null,qt=te?.messages.find(u=>u.message_index===ae.messageIndex)??null,_n=j.useMemo(()=>{if(Se.length===0)return null;const u=Se.reduce((_,V)=>_+V.rating,0)/Se.length;return Number(u.toFixed(2))},[Se]),sn=j.useMemo(()=>{const u=[...C?.items??[]];return xe&&!u.some(_=>_.run_id===xe)&&pe?.run&&u.unshift(pe.run),u},[C?.items,pe?.run,xe]),Pe=j.useCallback(u=>{U?.(`[autoruns] ${u}`)},[U]),dt=j.useCallback(async()=>{Kt(!0);try{const u=await Be.loadAutoRunAnnotations({limit:800,manual_case_decision:Me});me(u.items),Fe(u.manual_case_decision_schema??null),Ke(u.available_manual_case_decisions??[]),be(_=>u.items.length===0?"":u.items.some(V=>V.annotation_id===_)?_:u.items[0].annotation_id)}catch(u){Pe(`Annotations load error: ${u instanceof Error?u.message:String(u)}`)}finally{Kt(!1)}},[Me,Pe]),Ot=j.useCallback(async()=>{le(!0);try{const u=await Be.loadAutoRunAutogenHistory({limit:180});T(u.items)}catch(u){Pe(`Autogen history load error: ${u instanceof Error?u.message:String(u)}`)}finally{le(!1)}},[Pe]),Ge=j.useCallback(async()=>{b(!0);try{const u=await Be.loadAutoRunPostAnalysis({run_id:xe||void 0,limit_per_queue:30,annotation_limit:1500,from:Do(z.fromLocal),to:Do(z.toLocal),target:z.target,mode:z.mode,use_mock:z.useMock,prompt_contains:z.promptContains.trim()||void 0});M(u)}catch(u){Pe(`Post-analysis load error: ${u instanceof Error?u.message:String(u)}`),M(null)}finally{b(!1)}},[z.fromLocal,z.mode,z.promptContains,z.target,z.toLocal,z.useMock,Pe,xe]),Yt=j.useCallback(async()=>{S(!0),at("");try{const u=X.personalityPrompts[X.personalityId]??"",_=[m.systemPrompt,m.developerPrompt,m.domainPrompt,m.schemaNotes,m.fewShotExamples].join(` +`).slice(0,900),V=await Be.generateAutoRunQuestions({mode:X.mode,count:X.count,domain:ut.domain||void 0,persist_to_eval_cases:X.persistToEvalCases,generated_by:X.generatedBy.trim()||void 0,context:{llm_provider:a.llmProvider,model:a.model,assistant_prompt_version:p,decomposition_prompt_version:O,prompt_fingerprint:_,autogen_personality_id:ut.id,autogen_personality_prompt:u.trim()||void 0}});Pe(`Generated ${V.generation.count} questions (${V.generation.mode}) id=${V.generation.generation_id}`+(V.generation.saved_case_set_file?` saved=${V.generation.saved_case_set_file}`:"")),await Ot()}catch(u){const _=u instanceof Error?u.message:String(u);at(`Автогенерация: ${_}`),Pe(`Autogen generate error: ${_}`)}finally{S(!1)}},[p,X.count,X.generatedBy,X.mode,X.personalityId,X.personalityPrompts,X.persistToEvalCases,a.llmProvider,a.model,O,Ot,Pe,m.developerPrompt,m.domainPrompt,m.fewShotExamples,m.schemaNotes,m.systemPrompt,ut.domain,ut.id]),At=j.useCallback(async(u,_)=>{on(!0);try{const V=await Be.loadAutoRunCaseDialog(u,_);re(V)}catch(V){const je=V instanceof Error?V.message:String(V);at(`Диалог кейса: ${je}`),re(null),Pe(`Dialog load error for ${u}/${_}: ${je}`)}finally{on(!1)}},[Pe]),mt=j.useCallback(async(u,_)=>{ve(!0);try{const V=await Be.loadAutoRunDetail(u);Te(V);const je=(_&&V.cases.some(Ft=>Ft.case_id===_)?_:"")||V.cases[0]?.case_id||"";it(u),Ve(je),je?await At(u,je):re(null)}catch(V){const je=V instanceof Error?V.message:String(V);at(`Детализация прогона: ${je}`),Te(null),re(null),Pe(`Run detail load error for ${u}: ${je}`)}finally{ve(!1)}},[At,Pe]),It=j.useCallback(async u=>{ue(!0),at("");try{const _=await Be.loadAutoRunsHistory({from:Do(z.fromLocal),to:Do(z.toLocal),target:z.target,mode:z.mode,use_mock:z.useMock,prompt_contains:z.promptContains.trim()||void 0,limit:z.limit});if(H(_),_.items.length===0){it(""),Ve(""),Te(null),re(null);return}const V=u?.keepSelection??!0,je=u?.preferredRunId??"",Ft=u?.preferredCaseId??"",Ut=V&&je&&_.items.some(Xt=>Xt.run_id===je)?je:_.items[0].run_id;await mt(Ut,V?Ft:void 0),Ge()}catch(_){const V=_ instanceof Error?_.message:String(_);at(`История прогонов: ${V}`),Pe(`History load error: ${V}`)}finally{ue(!1)}},[z.fromLocal,z.limit,z.mode,z.promptContains,z.target,z.toLocal,z.useMock,Ge,mt,Pe]),nr=j.useCallback(u=>{u.role==="assistant"&&et({open:!0,messageIndex:u.message_index,rating:u.annotation?.rating??3,comment:u.annotation?.comment??"",manualCaseDecision:u.annotation?.manual_case_decision??zo,annotationAuthor:u.annotation?.annotation_author??X.generatedBy,saving:!1,error:""})},[X.generatedBy]),wt=j.useCallback(()=>{et(u=>u.saving?u:{open:!1,messageIndex:-1,rating:3,comment:"",manualCaseDecision:zo,annotationAuthor:X.generatedBy,saving:!1,error:""})},[X.generatedBy]),Sn=j.useCallback(async()=>{if(!(!xe||!Ee||ae.messageIndex<0)){if(!ae.comment.trim()){et(u=>({...u,error:"Добавьте комментарий."}));return}et(u=>({...u,saving:!0,error:""}));try{await Be.saveAutoRunAnnotation({run_id:xe,case_id:Ee,message_index:ae.messageIndex,rating:ae.rating,comment:ae.comment.trim(),manual_case_decision:ae.manualCaseDecision,annotation_author:ae.annotationAuthor.trim()||void 0}),await Promise.all([mt(xe,Ee),dt(),Ge()]),wt()}catch(u){et(_=>({..._,saving:!1,error:u instanceof Error?u.message:String(u)}))}}},[wt,ae.annotationAuthor,ae.comment,ae.manualCaseDecision,ae.messageIndex,ae.rating,dt,Ge,mt,Ee,xe]),Jt=j.useCallback(async u=>{be(u.annotation_id),await mt(u.run_id,u.case_id),C?.items.some(_=>_.run_id===u.run_id)||at("Комментарий относится к прогону вне текущего фильтра. Детали загружены напрямую.")},[C?.items,mt]);j.useEffect(()=>{Gt.current||(Gt.current=!0,It({keepSelection:!1}),Ot(),Ge())},[Ot,It,Ge]),j.useEffect(()=>{Gt.current&&dt()},[Me,dt]),j.useEffect(()=>{const u=localStorage.getItem(oc);if(u)try{const _=JSON.parse(u);if(_.filters){const V=_.filters;ee(je=>({...je,...V,limit:typeof V.limit=="number"?Math.max(1,Math.min(500,V.limit)):je.limit}))}_.autoGenSettings&&he(V=>{const je={...V.personalityPrompts};for(const Ut of Mr){const Xt=_.autoGenSettings?.personalityPrompts?.[Ut.id];typeof Xt=="string"&&(je[Ut.id]=Xt)}const Ft=_.autoGenSettings?.personalityId&&yf.has(_.autoGenSettings.personalityId)?_.autoGenSettings.personalityId:V.personalityId;return{...V,mode:_.autoGenSettings?.mode==="codex_creative"||_.autoGenSettings?.mode==="qwen_seed"?_.autoGenSettings.mode:V.mode,count:typeof _.autoGenSettings?.count=="number"?Math.max(1,Math.min(200,_.autoGenSettings.count)):V.count,personalityId:Ft,personalityPrompts:je,persistToEvalCases:typeof _.autoGenSettings?.persistToEvalCases=="boolean"?_.autoGenSettings.persistToEvalCases:V.persistToEvalCases,generatedBy:typeof _.autoGenSettings?.generatedBy=="string"?_.autoGenSettings.generatedBy:V.generatedBy}}),(_.annotationDecisionFilter==="all"||typeof _.annotationDecisionFilter=="string"&&_.annotationDecisionFilter.length>0)&&Ne(_.annotationDecisionFilter)}catch{}},[]);const an=j.useCallback(()=>{const u={filters:z,autoGenSettings:{mode:X.mode,count:X.count,personalityId:X.personalityId,personalityPrompts:X.personalityPrompts,persistToEvalCases:X.persistToEvalCases,generatedBy:X.generatedBy},annotationDecisionFilter:Me};localStorage.setItem(oc,JSON.stringify(u))},[Me,X,z]);return j.useEffect(()=>{const u=()=>{an(),Pe("Сохранены настройки панели автопрогонов.")};return window.addEventListener(sc,u),()=>{window.removeEventListener(sc,u)}},[Pe,an]),s.jsxs(ln,{className:"autoruns-frame",title:"",hideHeader:!0,children:[s.jsxs("div",{className:"autoruns-columns",children:[s.jsxs("section",{className:"autoruns-col",children:[s.jsx("div",{className:"autoruns-col-header",children:s.jsx("h3",{children:"Настройки"})}),s.jsx("h4",{children:"Настройки выборки"}),s.jsxs("div",{className:"autoruns-form-grid",children:[s.jsxs("label",{children:["Дата с",s.jsx("input",{type:"datetime-local",value:z.fromLocal,onChange:u=>ee(_=>({..._,fromLocal:u.target.value}))})]}),s.jsxs("label",{children:["Дата по",s.jsx("input",{type:"datetime-local",value:z.toLocal,onChange:u=>ee(_=>({..._,toLocal:u.target.value}))})]}),s.jsxs("label",{children:["Целевой контур",s.jsxs("select",{value:z.target,onChange:u=>ee(_=>({..._,target:u.target.value})),children:[s.jsx("option",{value:"all",children:"все"}),(C?.available.targets??[]).map(u=>s.jsx("option",{value:u,children:u},u))]})]}),s.jsxs("label",{children:["Режим",s.jsxs("select",{value:z.mode,onChange:u=>ee(_=>({..._,mode:u.target.value})),children:[s.jsx("option",{value:"all",children:"все"}),(C?.available.modes??[]).map(u=>s.jsx("option",{value:u,children:u},u))]})]}),s.jsxs("label",{children:["Использовать mock",s.jsxs("select",{value:z.useMock,onChange:u=>ee(_=>({..._,useMock:u.target.value})),children:[s.jsx("option",{value:"any",children:"любой"}),s.jsx("option",{value:"true",children:"да"}),s.jsx("option",{value:"false",children:"нет"})]})]}),s.jsxs("label",{children:["Лимит",s.jsx("input",{type:"number",min:1,max:500,value:z.limit,onChange:u=>ee(_=>({..._,limit:Number(u.target.value||120)}))})]}),s.jsxs("label",{className:"full-width",children:["Версия промпта содержит",s.jsx("input",{value:z.promptContains,onChange:u=>ee(_=>({..._,promptContains:u.target.value})),placeholder:"normalizer_v2_0_2 / address_query_runtime_v1",list:"autoruns-prompt-versions"})]})]}),s.jsx("datalist",{id:"autoruns-prompt-versions",children:(C?.available.prompt_versions??[]).map(u=>s.jsx("option",{value:u},u))}),s.jsxs("div",{className:"button-row",children:[s.jsx("button",{type:"button",disabled:de,onClick:()=>{It({keepSelection:!1})},children:de?"Обновляю...":"Применить"}),s.jsx("button",{type:"button",className:"tab",onClick:()=>{ee({...lc,fromLocal:ic()}),at("")},children:"Сбросить фильтры"})]}),s.jsx("h4",{children:"Контур генерации"}),s.jsxs("div",{className:"autoruns-meta-list",children:[s.jsxs("div",{children:[s.jsx("span",{children:"Провайдер:"}),s.jsx("strong",{children:a.llmProvider})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Модель:"}),s.jsx("strong",{children:a.model||"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Промпт ассистента:"}),s.jsx("strong",{children:p})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Промпт декомпозиции:"}),s.jsx("strong",{children:O})]})]}),s.jsx("h4",{children:"Автогенерация вопросов"}),s.jsxs("div",{className:"autoruns-form-grid",children:[s.jsxs("label",{children:["Режим генерации",s.jsxs("select",{value:X.mode,onChange:u=>he(_=>({..._,mode:u.target.value})),children:[s.jsx("option",{value:"codex_creative",children:"codex_creative"}),s.jsx("option",{value:"qwen_seed",children:"qwen_seed"})]})]}),s.jsxs("label",{children:["Кол-во",s.jsx("input",{type:"number",min:1,max:200,value:X.count,onChange:u=>he(_=>({..._,count:Math.max(1,Math.min(200,Number(u.target.value||24)))}))})]}),s.jsxs("label",{children:["Личность автогенерации",s.jsx("select",{value:X.personalityId,onChange:u=>he(_=>({..._,personalityId:u.target.value})),children:Mr.map(u=>s.jsx("option",{value:u.id,children:u.label},u.id))})]}),s.jsxs("label",{children:["Кто генерирует",s.jsx("input",{value:X.generatedBy,onChange:u=>he(_=>({..._,generatedBy:u.target.value})),placeholder:"manual_reviewer"})]}),s.jsxs("label",{className:"full-width",children:["Промпт личности",s.jsx("textarea",{value:X.personalityPrompts[X.personalityId]??"",onChange:u=>he(_=>({..._,personalityPrompts:{..._.personalityPrompts,[_.personalityId]:u.target.value}})),placeholder:"Текст промпта для выбранной личности автогенерации"})]}),s.jsxs("label",{className:"checkbox-row",children:[s.jsx("input",{type:"checkbox",checked:X.persistToEvalCases,onChange:u=>he(_=>({..._,persistToEvalCases:u.target.checked}))}),"Сохранять кейс-сет в `eval_cases`"]})]}),s.jsxs("div",{className:"button-row",children:[s.jsx("button",{type:"button",disabled:h,onClick:()=>{Yt()},children:h?"Генерирую...":"Сгенерировать пачку"}),s.jsx("button",{type:"button",className:"tab",disabled:ne,onClick:()=>{Ot()},children:ne?"Обновляю...":"Обновить историю"})]}),s.jsxs("div",{className:"autoruns-autogen-list",children:[ne?s.jsx("p",{className:"muted",children:"Загружаю историю автогенераций..."}):null,!ne&&ye.length===0?s.jsx("p",{className:"muted",children:"История автогенераций пока пустая."}):null,ye.slice(0,30).map(u=>s.jsxs("article",{className:"autoruns-autogen-item",children:[s.jsxs("header",{children:[s.jsx("strong",{children:Tr(u.created_at)}),s.jsx("span",{children:u.mode})]}),s.jsxs("div",{className:"autoruns-run-meta",children:["id=",u.generation_id," | count=",u.count]}),s.jsxs("div",{className:"autoruns-run-meta",children:["домен=",u.domain??"общий",u.generated_by?` | автор=${u.generated_by}`:""]}),u.saved_case_set_file?s.jsxs("div",{className:"autoruns-run-meta",children:["кейс-сет=",u.saved_case_set_file]}):null,(u.questions??[]).length>0?s.jsx("p",{children:u.questions[0]}):null]},u.generation_id))]}),s.jsxs("details",{className:"autoruns-prompt-details",children:[s.jsx("summary",{children:"Копия активного промпта (только чтение)"}),s.jsxs("label",{children:["Системный",s.jsx("textarea",{readOnly:!0,value:m.systemPrompt})]}),s.jsxs("label",{children:["Разработчика",s.jsx("textarea",{readOnly:!0,value:m.developerPrompt})]}),s.jsxs("label",{children:["Доменный",s.jsx("textarea",{readOnly:!0,value:m.domainPrompt})]}),s.jsxs("label",{children:["Заметки по схеме",s.jsx("textarea",{readOnly:!0,value:m.schemaNotes})]}),s.jsxs("label",{children:["Примеры few-shot",s.jsx("textarea",{readOnly:!0,value:m.fewShotExamples})]})]}),xn?s.jsx("p",{className:"error-text",children:xn}):null]}),s.jsxs("section",{className:"autoruns-col",children:[s.jsx("div",{className:"autoruns-col-header",children:s.jsx("h3",{children:"Выдача прогонов"})}),s.jsxs("div",{className:"autoruns-stats-grid",children:[s.jsxs("div",{children:[s.jsx("span",{children:"Всего"}),s.jsx("strong",{children:C?.stats.runs_total??0})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Средний score"}),s.jsx("strong",{children:_l(C?.stats.avg_score_index??null)})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Тренд"}),s.jsx("strong",{children:C?ac(C.stats.trend):"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Блокеры"}),s.jsx("strong",{children:C?.stats.blocking_runs??0})]})]}),s.jsxs("div",{className:"autoruns-run-list",children:[(C?.items??[]).map(u=>s.jsxs("button",{type:"button",className:xe===u.run_id?"autoruns-run-item selected":"autoruns-run-item",onClick:()=>{mt(u.run_id)},children:[s.jsxs("div",{className:"autoruns-run-head",children:[s.jsx("strong",{children:Tr(u.run_timestamp)}),s.jsx("span",{children:wf(u.eval_target)})]}),s.jsx("div",{className:"autoruns-run-meta",children:u.run_id}),s.jsxs("div",{className:"autoruns-run-meta",children:["режим=",u.mode??"нет данных"," | mock=",String(u.use_mock)]}),u.llm_provider||u.model?s.jsxs("div",{className:"autoruns-run-meta",children:["llm=",u.llm_provider??"нет данных"," | модель=",u.model??"нет данных"]}):null,s.jsxs("div",{className:"autoruns-run-meta",children:["промпт=",u.prompt_version??"нет данных"]}),s.jsxs("div",{className:"autoruns-run-foot",children:[s.jsxs("span",{children:["оценка: ",_l(u.score_index)]}),s.jsxs("span",{children:["закрыто/открыто: ",u.closed_cases,"/",u.open_cases]})]}),s.jsxs("div",{className:"autoruns-run-foot",children:[s.jsxs("span",{children:["блокеры: ",u.blocking_failures]}),s.jsxs("span",{children:["качество: ",u.quality_failures]})]})]},u.run_id)),(C?.items.length??0)===0?s.jsx("p",{className:"muted",children:"За выбранный диапазон прогонов нет."}):null]})]}),s.jsxs("section",{className:"autoruns-col",children:[s.jsxs("div",{className:"autoruns-col-header",children:[s.jsx("h3",{children:"Диалог прогона"}),s.jsxs("div",{className:"autoruns-dialog-toolbar",children:[s.jsxs("label",{children:["Прогон",s.jsx("select",{value:xe,onChange:u=>{const _=u.target.value;mt(_)},children:sn.map(u=>s.jsxs("option",{value:u.run_id,children:[Tr(u.run_timestamp)," | ",u.run_id]},u.run_id))})]}),s.jsxs("label",{children:["Кейс",s.jsx("select",{value:Ee,onChange:u=>{const _=u.target.value;Ve(_),xe&&_&&At(xe,_)},children:(pe?.cases??[]).map(u=>s.jsxs("option",{value:u.case_id,children:[u.case_id," | ",u.status]},u.case_id))})]})]})]}),s.jsx("div",{className:"autoruns-case-list",children:(pe?.cases??[]).map(u=>s.jsxs("button",{type:"button",className:Ee===u.case_id?"autoruns-case-item selected":"autoruns-case-item",onClick:()=>{Ve(u.case_id),xe&&At(xe,u.case_id)},children:[s.jsx("span",{children:u.case_id}),s.jsxs("span",{children:[u.status,u.commented_count>0?` | 💬${u.commented_count}`:""]})]},u.case_id))}),s.jsxs("div",{className:"autoruns-dialog-view",children:[Et||se?s.jsx("p",{className:"muted",children:"Загружаю диалог..."}):null,!Et&&!se&&(te?.messages.length??0)===0?s.jsx("p",{className:"muted",children:"Диалог для этого кейса не найден."}):null,(te?.messages??[]).map((u,_)=>{const V=u.role==="assistant"?"assistant":"user";return s.jsxs("article",{className:`autoruns-msg ${V}`,children:[s.jsxs("header",{children:[s.jsx("strong",{children:V==="assistant"?"Система":"Модель/вопрос"}),s.jsxs("div",{className:"autoruns-msg-head-actions",children:[s.jsx("span",{children:u.created_at?Tr(u.created_at):"нет данных"}),V==="assistant"?s.jsx("button",{type:"button",className:u.commented?"autoruns-comment-icon commented":"autoruns-comment-icon",onClick:()=>nr(u),title:"Комментировать ответ системы",children:"💬"}):null]})]}),s.jsx("p",{children:u.text}),V==="assistant"&&u.annotation?s.jsxs("div",{className:"autoruns-msg-annotation",children:[s.jsx("strong",{children:uc(u.annotation.rating)}),s.jsx("span",{children:u.annotation.comment}),s.jsxs("span",{className:"muted",children:[u.annotation.manual_case_decision,u.annotation.annotation_author?` | ${u.annotation.annotation_author}`:""]})]}):null,(u.trace_id||u.reply_type)&&s.jsxs("footer",{children:[u.trace_id?s.jsxs("span",{children:["trace=",u.trace_id]}):null,u.reply_type?s.jsxs("span",{children:["reply_type=",u.reply_type]}):null]})]},u.message_id??`${V}-${_}`)})]})]}),P?s.jsxs("section",{className:"autoruns-col",children:[s.jsx("div",{className:"autoruns-col-header",children:s.jsx("h3",{children:"Режим ассистента"})}),s.jsxs("div",{className:"autoruns-meta-list",children:[s.jsxs("div",{children:[s.jsx("span",{children:"источник:"}),s.jsx("strong",{children:te?.source??"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"сессия:"}),s.jsx("strong",{children:te?.session_id??"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"контур прогона:"}),s.jsx("strong",{children:Pt?.eval_target??"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"оценка прогона:"}),s.jsx("strong",{children:_l(Pt?.score_index??null)})]}),s.jsxs("div",{children:[s.jsx("span",{children:"комментарии:"}),s.jsx("strong",{children:pe?.annotations_summary?.total??0})]})]}),s.jsx("h4",{children:"Пакет режима ассистента"}),s.jsx(ot,{value:te?.assistant_mode??{note:"assistant_mode недоступен"}}),s.jsx("h4",{style:{marginTop:12},children:"Проверки кейса"}),s.jsx(ot,{value:ct?.checks??{note:"checks недоступен"}}),s.jsx("h4",{style:{marginTop:12},children:"Сабскор метрик"}),s.jsx(ot,{value:ct?.metric_subscores??{note:"metric_subscores недоступен"}})]}):null,F?s.jsxs("section",{className:"autoruns-col",children:[s.jsx("div",{className:"autoruns-col-header",children:s.jsx("h3",{children:"Режим декомпозиции"})}),s.jsxs("div",{className:"autoruns-meta-list",children:[s.jsxs("div",{children:[s.jsx("span",{children:"кейс:"}),s.jsx("strong",{children:ct?.case_id??"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"домен:"}),s.jsx("strong",{children:ct?.domain??"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"класс запроса:"}),s.jsx("strong",{children:ct?.query_class??"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"trace:"}),s.jsx("strong",{children:ct?.trace_id??"нет данных"})]})]}),s.jsx("h4",{children:"Шаги декомпозиции"}),(te?.decomposition.length??0)>0?s.jsx("ol",{className:"autoruns-decomposition-list",children:(te?.decomposition??[]).map((u,_)=>s.jsx("li",{children:u},`${_}-${u.slice(0,24)}`))}):s.jsx("p",{className:"muted",children:"В логах кейса нет явной декомпозиции."})]}):null,Q?s.jsxs("section",{className:"autoruns-col",children:[s.jsx("div",{className:"autoruns-col-header",children:s.jsx("h3",{children:"Прогресс / регресс"})}),s.jsxs("div",{className:"autoruns-stats-grid",children:[s.jsxs("div",{children:[s.jsx("span",{children:"Последний score"}),s.jsx("strong",{children:_l(C?.stats.latest_score_index??null)})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Предыдущий"}),s.jsx("strong",{children:_l(C?.stats.previous_score_index??null)})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Тренд"}),s.jsx("strong",{children:C?ac(C.stats.trend):"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Пробелы качества"}),s.jsx("strong",{children:C?.stats.quality_gap_runs??0})]})]}),s.jsx("h4",{children:"Покрытие доменов (история)"}),cc(C?.stats.domain_coverage??[]),s.jsx("h4",{style:{marginTop:14},children:"Покрытие доменов (выбранный прогон)"}),cc(pe?.coverage.domain_coverage??[]),s.jsx("h4",{style:{marginTop:14},children:"Очереди фиксов пост-анализа"}),q?s.jsx("p",{className:"muted",children:"Собираю пост-анализ..."}):null,q?null:s.jsx("div",{className:"autoruns-stats-grid",children:Object.entries(W?.post_analysis.stats.by_queue??{}).map(([u,_])=>s.jsxs("div",{children:[s.jsx("span",{children:u}),s.jsx("strong",{children:_})]},u))}),s.jsxs("div",{className:"autoruns-autogen-list",children:[(W?.post_analysis.recommended_regression_candidates??[]).slice(0,12).map(u=>s.jsxs("article",{className:"autoruns-autogen-item",children:[s.jsxs("header",{children:[s.jsx("strong",{children:u.manual_case_decision}),s.jsxs("span",{children:[u.rating,"/5"]})]}),s.jsxs("div",{className:"autoruns-run-meta",children:[u.domain??"неизвестно"," / ",u.query_class??"неизвестно"]}),s.jsx("p",{children:u.comment})]},u.annotation_id)),!q&&(W?.post_analysis.recommended_regression_candidates.length??0)===0?s.jsx("p",{className:"muted",children:"Рекомендованных кандидатов пока нет."}):null]})]}):null,Z?s.jsxs("section",{className:"autoruns-col",children:[s.jsx("div",{className:"autoruns-col-header",children:s.jsx("h3",{children:"Комментарии"})}),s.jsx("h4",{children:"Размеченные ответы"}),s.jsx("div",{className:"autoruns-form-grid",children:s.jsxs("label",{children:["Фильтр решений",s.jsxs("select",{value:Me,onChange:u=>Ne(u.target.value),children:[s.jsx("option",{value:"all",children:"все"}),(Ue.length>0?Ue:Ae?.enum??[]).map(u=>s.jsx("option",{value:u,children:String(Ae?.labels?.[u]??u)},u))]})]})}),s.jsxs("div",{className:"autoruns-stats-grid",children:[s.jsxs("div",{children:[s.jsx("span",{children:"Комментариев"}),s.jsx("strong",{children:Se.length})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Средний рейтинг"}),s.jsx("strong",{children:_n===null?"нет данных":`${_n.toFixed(2)} / 5`})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Последний"}),s.jsx("strong",{children:Se.length>0?Tr(Se[0].updated_at):"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Статус"}),s.jsx("strong",{children:St?"обновляю":"готово"})]})]}),s.jsxs("div",{className:"button-row",children:[s.jsx("button",{type:"button",disabled:St,onClick:()=>{dt()},children:St?"Обновляю...":"Обновить список"}),s.jsx("button",{type:"button",className:"tab",disabled:q,onClick:()=>{Ge()},children:q?"Идет пост-анализ...":"Обновить пост-анализ"})]}),s.jsxs("div",{className:"autoruns-comments-list",children:[St?s.jsx("p",{className:"muted",children:"Загружаю комментарии..."}):null,!St&&Se.length===0?s.jsx("p",{className:"muted",children:"Пока нет откомментированных ответов."}):null,Se.map(u=>s.jsxs("button",{type:"button",className:st===u.annotation_id?"autoruns-comment-item selected":"autoruns-comment-item",onClick:()=>{Jt(u)},children:[s.jsxs("div",{className:"autoruns-comment-head",children:[s.jsx("strong",{children:uc(u.rating)}),s.jsx("span",{children:Tr(u.updated_at)})]}),s.jsx("div",{className:"autoruns-run-meta",children:u.run_id}),s.jsxs("div",{className:"autoruns-run-meta",children:["case=",u.case_id," | msg=",u.message_index]}),s.jsxs("div",{className:"autoruns-run-meta",children:["decision=",u.manual_case_decision,u.annotation_author?` | author=${u.annotation_author}`:""]}),s.jsx("p",{children:u.comment})]},u.annotation_id))]}),_e?s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Тех-контекст брака"}),s.jsxs("div",{className:"autoruns-meta-list",children:[s.jsxs("div",{children:[s.jsx("span",{children:"trace:"}),s.jsx("strong",{children:_e.technical_context.trace_id??"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"reply_type:"}),s.jsx("strong",{children:_e.technical_context.reply_type??"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"domain:"}),s.jsx("strong",{children:_e.technical_context.domain??"нет данных"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"query_class:"}),s.jsx("strong",{children:_e.technical_context.query_class??"нет данных"})]})]}),s.jsx("h4",{children:"JSON разбор"}),s.jsx(ot,{value:{annotation_id:_e.annotation_id,run_id:_e.run_id,case_id:_e.case_id,message_index:_e.message_index,rating:_e.rating,comment:_e.comment,manual_case_decision:_e.manual_case_decision,annotation_author:_e.annotation_author,context:_e.context,technical_context:_e.technical_context,case_summary:_e.case_summary?{case_id:_e.case_summary.case_id,domain:_e.case_summary.domain,query_class:_e.case_summary.query_class,checks:_e.case_summary.checks,metric_subscores:_e.case_summary.metric_subscores}:null}})]}):null]}):null]}),ae.open?s.jsx("div",{className:"autoruns-comment-modal-backdrop",onClick:u=>{u.target===u.currentTarget&&wt()},children:s.jsxs("div",{className:"autoruns-comment-modal",children:[s.jsx("h3",{children:"Комментарий к ответу системы"}),s.jsx("p",{className:"muted",children:"Оцените ответ по 5-балльной шкале и добавьте комментарий по браку."}),qt?s.jsxs("details",{className:"autoruns-prompt-details",open:!0,children:[s.jsx("summary",{children:"Ответ системы"}),s.jsx("p",{className:"autoruns-comment-quote",children:qt.text})]}):null,s.jsx("div",{className:"autoruns-rating-row",role:"group","aria-label":"Рейтинг ответа",children:[1,2,3,4,5].map(u=>s.jsx("button",{type:"button",className:ae.rating>=u?"autoruns-rating-dot active":"autoruns-rating-dot",onClick:()=>et(_=>({..._,rating:u})),disabled:ae.saving,"aria-label":`Оценка ${u}`,children:ae.rating>=u?"●":"○"},u))}),s.jsxs("div",{className:"autoruns-form-grid",children:[s.jsxs("label",{children:["Решение по кейсу",s.jsx("select",{value:ae.manualCaseDecision,onChange:u=>et(_=>({..._,manualCaseDecision:u.target.value})),disabled:ae.saving,children:(Ue.length>0?Ue:Ae?.enum??[zo]).map(u=>s.jsx("option",{value:u,children:String(Ae?.labels?.[u]??u)},u))})]}),s.jsxs("label",{children:["Автор комментария",s.jsx("input",{value:ae.annotationAuthor,onChange:u=>et(_=>({..._,annotationAuthor:u.target.value})),placeholder:"manual_reviewer",disabled:ae.saving})]})]}),s.jsxs("label",{children:["Комментарий",s.jsx("textarea",{value:ae.comment,onChange:u=>et(_=>({..._,comment:u.target.value})),placeholder:"Почему ответ бракованный, что именно пошло не так, какие технические детали проверить.",rows:4,disabled:ae.saving})]}),ae.error?s.jsx("p",{className:"error-text",children:ae.error}):null,s.jsxs("div",{className:"button-row",children:[s.jsx("button",{type:"button",onClick:()=>{Sn()},disabled:ae.saving,children:ae.saving?"Сохраняю...":"Готово"}),s.jsx("button",{type:"button",className:"tab",onClick:wt,disabled:ae.saving,children:"Отмена"})]})]})}):null]})}const Cf=/(?:^|\n)\s*#{0,6}\s*(?:debug_payload_json|technical_breakdown_json|route_summary_json|debug_payload|technical_breakdown)\b/i,Nf=[/\b(?:debug_payload_json|technical_breakdown_json)\b/i,/\b(?:route_summary|semantic_profile|domain_scope|relation_patterns|account_scope)\b/i,/\b(?:coverage_report|retrieval_status|problem_unit_state|candidate_evidence)\b/i,/\b(?:graph_domain_scope|graph_runtime|selection_reason|why_included)\b/i];function Ef(a){try{return JSON.stringify(a,null,2)}catch{return String(a)}}function Pf(a){const m=String(a??""),p=m.match(Cf);return(p?m.slice(0,p.index):m).replace(/###\s*(?:debug_payload_json|technical_breakdown_json|route_summary_json)[\s\S]*?(?:```[\s\S]*?```|$)/gi,"").replace(/(?:^|\n)\s*#{0,6}\s*(?:debug_payload_json|technical_breakdown_json|route_summary_json)\b[\s\S]*$/gi,"").split(/\r?\n/g).map(Q=>Q.trimEnd()).filter(Q=>Q.trim().length>0).filter(Q=>!Nf.some(Z=>Z.test(Q))).join(` +`).trim()}function Rf(a,m,p="default"){const O=p==="technical",P=[];P.push("# Assistant conversation export"),P.push(`session_id: ${a||"n/a"}`),P.push(`export_mode: ${p}`),P.push(`exported_at: ${new Date().toISOString()}`),P.push("");for(let F=0;F{C.current&&(C.current.scrollTop=C.current.scrollHeight)},[m,z]),j.useEffect(()=>()=>{H.current!==null&&window.clearTimeout(H.current)},[]);async function Se(me){if(m.length===0)return;const Me=Rf(a,m,me),Ne=await Lf(Me);re(me==="technical"?"тех":"чат"),Te(Ne?"success":"error"),H.current!==null&&window.clearTimeout(H.current),H.current=window.setTimeout(()=>{Te("idle")},2200)}return s.jsxs(ln,{title:"Режим ассистента",subtitle:"Диалоговый слой поверх normalizer, маршрутизации и factual retrieval.",actions:s.jsxs("div",{className:"assistant-panel-actions",children:[s.jsx("button",{type:"button",className:"assistant-copy-btn",onClick:()=>{Se("default")},disabled:m.length===0,title:"Экспорт только user-facing чата",children:"Скопировать чат"}),s.jsx("button",{type:"button",className:"assistant-copy-btn",onClick:()=>{Se("technical")},disabled:m.length===0,title:"Технический экспорт с debug payload",children:"Скопировать техчат"}),pe==="success"?s.jsxs("span",{className:"assistant-copy-feedback success",children:["Скопировано (",te,")"]}):null,pe==="error"?s.jsx("span",{className:"assistant-copy-feedback error",children:"Ошибка копирования"}):null,s.jsx("span",{className:"status-chip",children:a?`session: ${a}`:"новая сессия"})]}),children:[s.jsxs("div",{ref:C,className:"assistant-chat-list",children:[m.length===0?s.jsx("div",{className:"assistant-empty muted",children:"Диалог пуст. Отправьте первый вопрос, чтобы запустить контур ассистента."}):null,m.map(me=>s.jsxs("article",{className:`assistant-msg ${me.role}`,children:[s.jsxs("header",{className:"assistant-msg-head",children:[s.jsx("strong",{children:Tf(me.role)}),s.jsx("span",{children:Mf(me.created_at)})]}),s.jsx("div",{className:"assistant-msg-body",children:me.text}),me.role==="assistant"&&me.debug?s.jsxs("details",{className:"assistant-debug",children:[s.jsx("summary",{children:"Показать технический разбор"}),s.jsx(ot,{value:me.debug})]}):null]},me.message_id))]}),s.jsxs("div",{className:"assistant-compose",children:[s.jsxs("label",{className:"full-width",children:["Сообщение",s.jsx("textarea",{value:p,onChange:me=>O(me.target.value),rows:4,placeholder:"Введите вопрос к данным компании..."})]}),s.jsxs("div",{className:"button-row",children:[s.jsxs("label",{className:"checkbox-row",children:[s.jsx("input",{type:"checkbox",checked:P,onChange:me=>F(me.target.checked)}),"Mock-режим"]}),s.jsx("button",{type:"button",onClick:()=>Q(),disabled:U||!p.trim(),children:U?"Выполняю...":"Отправить"}),s.jsx("button",{type:"button",onClick:()=>Z(),disabled:U&&m.length===0,children:"Сбросить сессию"})]}),z?s.jsx("p",{className:"diff-summary",children:z}):null,ee?s.jsx("p",{className:"error-text",children:ee}):null]})]})}function dc({value:a,modelOptions:m,modelsBusy:p,onChange:O,onReloadModels:P,onTestConnection:F,onSaveLocalConfig:Q,lastStatus:Z,busy:U}){const z=a.llmProvider==="local",ee=m.includes(a.model);return s.jsxs(ln,{title:"LLM Connection",subtitle:"Switch between OpenAI cloud and local OpenAI-compatible server.",actions:s.jsx("span",{className:"status-chip",children:Z||"Status: not checked"}),children:[s.jsxs("div",{className:"grid-two",children:[s.jsxs("label",{children:["Provider",s.jsxs("select",{value:a.llmProvider,onChange:C=>{const H=C.target.value==="local"?"local":"openai";O({...a,llmProvider:H,baseUrl:H==="local"?"http://127.0.0.1:1234/v1":"https://api.openai.com/v1"})},children:[s.jsx("option",{value:"openai",children:"OpenAI (token)"}),s.jsx("option",{value:"local",children:"Local (LM Studio / OpenAI-compatible)"})]})]}),s.jsxs("label",{children:["Model",s.jsxs("select",{value:ee?a.model:"__manual__",onChange:C=>{const H=C.target.value;H!=="__manual__"&&O({...a,model:H})},children:[s.jsx("option",{value:"__manual__",children:"Manual input"}),m.map(C=>s.jsx("option",{value:C,children:C},C))]})]}),s.jsxs("label",{children:["Model ID (manual)",s.jsx("input",{value:a.model,onChange:C=>O({...a,model:C.target.value}),placeholder:"qwen2.5-14b-instruct or lmstudio loaded model id"})]}),z?null:s.jsxs("label",{className:"full-width",children:["OpenAI API Key",s.jsx("input",{type:"password",value:a.apiKey,onChange:C=>O({...a,apiKey:C.target.value}),placeholder:"sk-..."})]}),s.jsxs("label",{className:z?"full-width":void 0,children:[z?"Local server base URL":"Base URL",s.jsx("input",{value:a.baseUrl,onChange:C=>O({...a,baseUrl:C.target.value}),placeholder:z?"http://127.0.0.1:1234/v1":"https://api.openai.com/v1"})]}),s.jsxs("label",{children:["Temperature",s.jsx("input",{type:"number",step:"0.1",value:a.temperature,onChange:C=>O({...a,temperature:Number(C.target.value)})})]}),s.jsxs("label",{children:["Max output tokens",s.jsx("input",{type:"number",value:a.maxOutputTokens,onChange:C=>O({...a,maxOutputTokens:Number(C.target.value)})})]})]}),s.jsxs("div",{className:"button-row",children:[s.jsx("button",{type:"button",onClick:()=>Q(),children:"Save local config"}),s.jsx("button",{type:"button",onClick:()=>P(),disabled:U||p,children:p?"Loading models...":"Load model list"}),s.jsx("button",{type:"button",onClick:()=>F(),disabled:U,children:U?"Checking...":"Test connection"})]})]})}function Df({items:a,onRefresh:m,onOpenTrace:p}){return s.jsx(ln,{title:"История нормализаций",subtitle:"Короткий вопрос, confidence, route hint и статус валидации.",actions:s.jsx("button",{type:"button",onClick:()=>m(),children:"Обновить"}),children:s.jsxs("div",{className:"history-list",children:[a.length===0?s.jsx("p",{className:"muted",children:"История пока пустая."}):null,a.map(O=>s.jsxs("button",{type:"button",className:"history-item",onClick:()=>p(O.trace_id),children:[s.jsxs("div",{className:"history-row",children:[s.jsx("strong",{children:O.route_hint??"route: n/a"}),s.jsx("span",{children:O.validation_passed?"schema: ok":"schema: fail"})]}),s.jsx("p",{children:O.question_short}),s.jsxs("div",{className:"history-row",children:[s.jsx("span",{children:O.model}),s.jsx("span",{children:new Date(O.timestamp).toLocaleString("ru-RU")})]})]},O.trace_id))]})})}function yn(a){return a==null||a===""?"—":String(a)}function Of({result:a}){return s.jsx(ln,{title:"Runtime метрики",subtitle:"trace_id, токены, latency и статус валидации.",children:s.jsxs("div",{className:"metrics-grid",children:[s.jsxs("div",{children:[s.jsx("span",{children:"trace_id"}),s.jsx("strong",{children:yn(a?.trace_id)})]}),s.jsxs("div",{children:[s.jsx("span",{children:"request_started_at"}),s.jsx("strong",{children:yn(a?new Date(Date.now()-a.latency_ms).toISOString():null)})]}),s.jsxs("div",{children:[s.jsx("span",{children:"request_finished_at"}),s.jsx("strong",{children:yn(a?new Date().toISOString():null)})]}),s.jsxs("div",{children:[s.jsx("span",{children:"latency_ms"}),s.jsx("strong",{children:yn(a?.latency_ms)})]}),s.jsxs("div",{children:[s.jsx("span",{children:"input_tokens"}),s.jsx("strong",{children:yn(a?.usage?.input_tokens)})]}),s.jsxs("div",{children:[s.jsx("span",{children:"output_tokens"}),s.jsx("strong",{children:yn(a?.usage?.output_tokens)})]}),s.jsxs("div",{children:[s.jsx("span",{children:"total_tokens"}),s.jsx("strong",{children:yn(a?.usage?.total_tokens)})]}),s.jsxs("div",{children:[s.jsx("span",{children:"validation_status"}),s.jsx("strong",{children:a?.validation?.passed?"passed":"failed"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"prompt_version"}),s.jsx("strong",{children:yn(a?.prompt_version)})]}),s.jsxs("div",{children:[s.jsx("span",{children:"schema_version"}),s.jsx("strong",{children:yn(a?.schema_version)})]})]})})}const Af={normalized:"Normalized JSON",fragments:"Fragment View",scope:"Scope View",flags:"Flags View",route:"Route Simulation",raw:"Raw model output",validation:"Validation",logs:"Logs"};function If(a){return a&&typeof a=="object"?a:null}function Ff({tab:a,onTabChange:m,result:p,appLogs:O}){const P=["normalized","fragments","scope","flags","route","raw","validation","logs"],F=If(p?.normalized),Q=String(F?.schema_version??""),Z=Q==="normalized_query_v2"||Q==="normalized_query_v2_0_1"||Q==="normalized_query_v2_0_2",U=Z?{fragments:F?.fragments??[],discarded_fragments:F?.discarded_fragments??[]}:{note:"Fragment View доступен для normalized_query_v2."},z=Z?{message_in_scope:F?.message_in_scope??null,scope_confidence:F?.scope_confidence??null,contains_multiple_tasks:F?.contains_multiple_tasks??null,global_notes:F?.global_notes??null}:{note:"Scope View доступен для normalized_query_v2."},ee=Z?Array.isArray(F?.fragments)?(F?.fragments).map(C=>({fragment_id:C.fragment_id??null,domain_relevance:C.domain_relevance??null,candidate_labels:C.candidate_labels??[],execution_readiness:C.execution_readiness??null,clarification_reason:C.clarification_reason??null,soft_assumption_used:C.soft_assumption_used??[],route_status:C.route_status??null,no_route_reason:C.no_route_reason??null,flags:C.flags??{}})):[]:{note:"Flags View доступен для normalized_query_v2."};return s.jsxs(ln,{title:"Выходные данные",subtitle:"Structured output и диагностические вкладки.",children:[s.jsx("div",{className:"tab-row",children:P.map(C=>s.jsx("button",{type:"button",className:a===C?"tab active":"tab",onClick:()=>m(C),children:Af[C]},C))}),a==="normalized"?s.jsx(ot,{value:p?.normalized??{note:"Нет данных."}}):null,a==="fragments"?s.jsx(ot,{value:U}):null,a==="scope"?s.jsx(ot,{value:z}):null,a==="flags"?s.jsx(ot,{value:ee}):null,a==="route"?s.jsx(ot,{value:p?.route_hint_summary??{note:"Нет данных."}}):null,a==="raw"?s.jsx(ot,{value:p?.raw_model_output??{note:"Нет данных."}}):null,a==="validation"?s.jsx(ot,{value:p?.validation??{note:"Нет данных."}}):null,a==="logs"?s.jsx(ot,{value:O}):null]})}function fc({value:a,onChange:m,presets:p,selectedPresetId:O,onSelectPreset:P,onLoadPreset:F,onSavePreset:Q,onResetDefaults:Z,onDiffPrevious:U,presetName:z,onPresetNameChange:ee,diffSummary:C}){return s.jsxs(ln,{title:"Prompt Manager",subtitle:"Системный, developer и domain уровни управляются отдельно.",children:[s.jsxs("div",{className:"prompt-manager-grid",children:[s.jsxs("label",{children:["Системный prompt",s.jsx("textarea",{value:a.systemPrompt,onChange:H=>m({...a,systemPrompt:H.target.value}),rows:6})]}),s.jsxs("label",{children:["Developer / Instruction prompt",s.jsx("textarea",{value:a.developerPrompt,onChange:H=>m({...a,developerPrompt:H.target.value}),rows:6})]}),s.jsxs("label",{children:["Domain prompt",s.jsx("textarea",{value:a.domainPrompt,onChange:H=>m({...a,domainPrompt:H.target.value}),rows:6})]}),s.jsxs("label",{children:["Schema notes",s.jsx("textarea",{value:a.schemaNotes,onChange:H=>m({...a,schemaNotes:H.target.value}),rows:6})]}),s.jsxs("label",{className:"full-width",children:["Few-shot examples",s.jsx("textarea",{value:a.fewShotExamples,onChange:H=>m({...a,fewShotExamples:H.target.value}),rows:8})]})]}),s.jsxs("div",{className:"button-row",children:[s.jsxs("select",{value:O,onChange:H=>P(H.target.value),children:[s.jsx("option",{value:"",children:"Выберите preset..."}),p.map(H=>s.jsx("option",{value:H.id,children:H.name},H.id))]}),s.jsx("button",{type:"button",onClick:()=>F(),children:"Загрузить preset"}),s.jsx("input",{value:z,onChange:H=>ee(H.target.value),placeholder:"Имя для сохранения"}),s.jsx("button",{type:"button",onClick:()=>Q(),children:"Сохранить preset"}),s.jsx("button",{type:"button",onClick:()=>U(),children:"Diff с предыдущим"}),s.jsx("button",{type:"button",onClick:()=>Z(),children:"Сбросить к default"})]}),C?s.jsx("p",{className:"diff-summary",children:C}):null]})}function Uf({value:a,onChange:m,onApplyBatchFormat:p,onNormalize:O,busy:P,useMock:F,onUseMockChange:Q,errorMessage:Z}){return s.jsxs(ln,{title:"Запрос пользователя",subtitle:"NDC semantic front-end: нормализуем, но не отвечаем за бухгалтерскую суть.",children:[s.jsxs("div",{className:"grid-two",children:[s.jsxs("label",{className:"full-width",children:["Raw user question",s.jsx("textarea",{value:a.userQuestion,onChange:U=>m({...a,userQuestion:U.target.value}),rows:6,placeholder:"Например: По каким покупателям у нас на конец июня висят отгрузки без оплаты..."})]}),s.jsxs("label",{className:"full-width",children:["Batch queries (`;` separator)",s.jsx("textarea",{value:a.batchQuestionsRaw,onChange:U=>m({...a,batchQuestionsRaw:U.target.value}),onBlur:()=>p(),rows:8,placeholder:"Вопрос 1; Вопрос 2; Вопрос 3"})]}),s.jsxs("label",{children:["Optional period context",s.jsx("input",{value:a.periodHint,onChange:U=>m({...a,periodHint:U.target.value})})]}),s.jsxs("label",{children:["Optional business context",s.jsx("input",{value:a.businessContext,onChange:U=>m({...a,businessContext:U.target.value})})]}),s.jsxs("label",{children:["Optional expected route (eval)",s.jsx("input",{value:a.expectedRoute,onChange:U=>m({...a,expectedRoute:U.target.value})})]})]}),s.jsxs("div",{className:"button-row",children:[s.jsxs("label",{className:"checkbox-row",children:[s.jsx("input",{type:"checkbox",checked:F,onChange:U=>Q(U.target.checked)}),"Mock-режим (без вызова OpenAI)"]}),s.jsx("button",{type:"button",onClick:()=>p(),disabled:P||!a.batchQuestionsRaw.trim(),children:"Применить `;` в переносы"}),s.jsx("button",{type:"button",onClick:()=>O(!1),disabled:P||!a.userQuestion.trim(),children:P?"Нормализуем...":"Normalize"}),s.jsx("button",{type:"button",onClick:()=>O(!0),disabled:P||!a.userQuestion.trim(),children:P?"Сохраняем...":"Normalize + Save as test case"})]}),Z?s.jsx("p",{className:"error-text",children:Z}):null]})}function $f({runs:a,selectedRunId:m,onSelectRun:p,onStartRun:O,onFinishRun:P,onRefreshRuns:F,onRunEval:Q,onCopyEvalReport:Z,evalBusy:U,traceItems:z,evalReport:ee}){return s.jsxs(ln,{title:"NDC Run Monitor",subtitle:"Важно: кнопка Запустить run создает только run-сущность. Кнопка eval запускает batch-проверку normalizer v2.0.2.",children:[s.jsxs("div",{className:"button-row",children:[s.jsx("button",{type:"button",onClick:()=>O(),children:"Запустить run"}),s.jsx("button",{type:"button",onClick:()=>P(),disabled:!m,children:"Завершить выбранный run"}),s.jsx("button",{type:"button",onClick:()=>F(),children:"Обновить runs"}),s.jsx("button",{type:"button",onClick:()=>Q(),disabled:U,children:U?"Идет eval v2.0.2...":"Запустить eval v2.0.2"})]}),s.jsxs("div",{className:"runtime-stack",children:[s.jsxs("div",{className:"runtime-runs",children:[a.map(C=>s.jsxs("button",{type:"button",className:m===C.runId?"history-item selected":"history-item",onClick:()=>p(C.runId),children:[s.jsxs("div",{className:"history-row",children:[s.jsx("strong",{children:C.status}),s.jsx("span",{children:C.runId})]}),s.jsxs("div",{className:"history-row",children:[s.jsx("span",{children:C.sessionId}),s.jsx("span",{children:new Date(C.updatedAt).toLocaleString("ru-RU")})]})]},C.runId)),a.length===0?s.jsx("p",{className:"muted",children:"Нет активных запусков."}):null]}),s.jsxs("div",{className:"runtime-details",children:[s.jsx("h3",{children:"Trace выбранного run"}),s.jsx(ot,{value:z}),s.jsxs("div",{className:"eval-report-wrap",children:[s.jsx("h3",{style:{marginTop:12},children:"Отчет eval"}),s.jsx(ot,{value:ee??{note:"Eval пока не запускался"}}),s.jsx("button",{type:"button",className:"copy-cube-button",title:"Скопировать отчет eval",onClick:()=>Z(),children:"⧉"})]})]})]})]})}const Bf={llmProvider:"openai",apiKey:"",model:"gpt-4o-mini",baseUrl:"https://api.openai.com/v1",temperature:0,maxOutputTokens:700},pc={systemPrompt:"Ты semantic-normalizer для бухгалтерского ассистента NDC. Возвращай только JSON по схеме normalized_query_v2_0_2.",developerPrompt:"Сначала делай decomposition сообщения на task fragments, затем определяй domain scope и route-critical flags. Для каждого fragment заполняй execution_readiness + route_status + no_route_reason. Если fragment routable, не оставляй его в no_route.",domainPrompt:"Контур: данные текущего предприятия в 1С/NDC. In-scope: документы, проводки, взаиморасчеты, остатки, периодное закрытие, аномалии и контрольные проверки. Out-of-scope: общая теория, законы и оффтоп.",schemaNotes:"schema_version: normalized_query_v2_0_2. Строгий JSON без дополнительных полей.",fewShotExamples:"Q: Проверь по поставщикам хвосты и разложи цепочку документов/оплат. => fragment in_scope, flags: multi_entity + chain_explanation. Q: Как вообще по ФСБУ? => out_of_scope/generic_accounting."},Hf={userQuestion:"",batchQuestionsRaw:"",periodHint:"",businessContext:"",expectedRoute:""},wi={colors:{backgroundRgb:"18, 18, 18",mainSurfaceRgb:"25, 25, 25",horizontalSurfaceRgb:"30, 30, 30",focusSurfaceRgb:"35, 35, 35",activeRgb:"167, 59, 255",activeTextRgb:"240, 240, 240",textMainRgb:"240, 240, 240",textMutedRgb:"166, 166, 166",dangerRgb:"126, 126, 126",scrollbarTrackRgb:"20, 20, 20",scrollbarThumbRgb:"30, 30, 30",scrollbarThumbHoverRgb:"30, 50, 30"},layout:{modeColumnWidthPx:440,modeToggleWidthPx:188}},mc="ndc_normalizer_session_config_v1",hc="ndc_autoruns_layout_config_v1",Vf="ndc-autoruns-save",ji=["Анализ запроса","Получение данных","Подготовка ответа"],Qf="assistant",ki="normalizer_v2_0_2",vc="address_query_runtime_v1",Wf=["normalized","fragments","scope","flags","route","raw","validation","logs"];function Kf(a){return`[${new Date().toLocaleTimeString("ru-RU")}] ${a}`}function Gf(a,m){if(!m)return"Previous preset is not selected.";const O=["systemPrompt","developerPrompt","domainPrompt","schemaNotes","fewShotExamples"].filter(P=>a[P]!==m[P]).map(P=>`${P}: ${Math.abs(a[P].length-m[P].length)} chars delta`);return O.length===0?"No changes against previous preset.":`Changed fields: ${O.length}. ${O.join(" | ")}`}function qf(){const[a,m]=j.useState(Bf),[p,O]=j.useState(pc),[P,F]=j.useState(Hf),[Q,Z]=j.useState(null),[U,z]=j.useState([]),[ee,C]=j.useState([]),[H,pe]=j.useState("normalized"),[Te,te]=j.useState(!1),[re,Se]=j.useState(!1),[me,Me]=j.useState([]),[Ne,Ae]=j.useState(""),[Fe,Ue]=j.useState([]),[Ke,st]=j.useState(""),[be,xe]=j.useState("NDC custom preset"),[it,Ee]=j.useState(null),[Ve,X]=j.useState(""),[he,ye]=j.useState(!1),[T,W]=j.useState([]),[M,h]=j.useState(""),[S,q]=j.useState([]),[b,ne]=j.useState(!1),[le,de]=j.useState(null),[ue,se]=j.useState(""),[ve,Et]=j.useState(Qf),[on,St]=j.useState(!0),[Kt,xn]=j.useState(!0),[at,ae]=j.useState(!0),[et,Gt]=j.useState(!0),[ut,Pt]=j.useState(!0),[ct,_e]=j.useState(!0),[qt,_n]=j.useState(!0),[sn,Pe]=j.useState(!0),[dt,Ot]=j.useState(!0),[Ge,Yt]=j.useState(!0),[At,mt]=j.useState(!0),[It,nr]=j.useState(!0),[wt,Sn]=j.useState(!0),[Jt,an]=j.useState(!0),[u,_]=j.useState(!0),[V,je]=j.useState(""),[Ft,Ut]=j.useState([]),[Xt,rr]=j.useState(""),[lr,Lr]=j.useState(!1),[wn,un]=j.useState(""),[jn,zr]=j.useState(""),Zt=j.useRef(!1),Vn=j.useRef(!1);j.useEffect(()=>{const y=document.documentElement,{colors:L}=wi;y.style.setProperty("--rgb-background",L.backgroundRgb),y.style.setProperty("--rgb-surface-main",L.mainSurfaceRgb),y.style.setProperty("--rgb-surface-horizontal",L.horizontalSurfaceRgb),y.style.setProperty("--rgb-surface-focus",L.focusSurfaceRgb),y.style.setProperty("--rgb-active",L.activeRgb),y.style.setProperty("--rgb-active-text",L.activeTextRgb),y.style.setProperty("--rgb-text-main",L.textMainRgb),y.style.setProperty("--rgb-text-muted",L.textMutedRgb),y.style.setProperty("--rgb-danger",L.dangerRgb),y.style.setProperty("--rgb-scrollbar-track",L.scrollbarTrackRgb),y.style.setProperty("--rgb-scrollbar-thumb",L.scrollbarThumbRgb),y.style.setProperty("--rgb-scrollbar-thumb-hover",L.scrollbarThumbHoverRgb),y.style.setProperty("--mode-column-width",`${wi.layout.modeColumnWidthPx}px`),y.style.setProperty("--mode-toggle-width",`${wi.layout.modeToggleWidthPx}px`)},[]);const Y=y=>{C(L=>[Kf(y),...L].slice(0,300))};function Dr(){let y=0;un(ji[0]);const L=window.setInterval(()=>{y=Math.min(y+1,ji.length-1),un(ji[y])},650);return()=>window.clearInterval(L)}j.useEffect(()=>{const y=localStorage.getItem(mc);if(y)try{const E=JSON.parse(y);m(ie=>({...ie,llmProvider:E.llmProvider==="local"?"local":"openai",model:E.model??ie.model,baseUrl:E.baseUrl??ie.baseUrl,temperature:E.temperature??ie.temperature,maxOutputTokens:E.maxOutputTokens??ie.maxOutputTokens}))}catch{}const L=localStorage.getItem(hc);if(L)try{const E=JSON.parse(L);(E.uiMode==="assistant"||E.uiMode==="decomposition"||E.uiMode==="autoruns")&&Et(E.uiMode),E.activeTab&&Wf.includes(E.activeTab)&&pe(E.activeTab),typeof E.showAutorunsAssistantMode=="boolean"&&St(E.showAutorunsAssistantMode),typeof E.showAutorunsDecompositionMode=="boolean"&&xn(E.showAutorunsDecompositionMode),typeof E.showAutorunsProgressMode=="boolean"&&ae(E.showAutorunsProgressMode),typeof E.showAutorunsCommentsMode=="boolean"&&Gt(E.showAutorunsCommentsMode),typeof E.showAssistantConnectionMode=="boolean"&&Pt(E.showAssistantConnectionMode),typeof E.showAssistantPromptMode=="boolean"&&_e(E.showAssistantPromptMode),typeof E.showAssistantChatMode=="boolean"&&_n(E.showAssistantChatMode),typeof E.showAssistantSamMode=="boolean"&&Pe(E.showAssistantSamMode),typeof E.showDecompositionConnectionMode=="boolean"&&Ot(E.showDecompositionConnectionMode),typeof E.showDecompositionPromptMode=="boolean"&&Yt(E.showDecompositionPromptMode),typeof E.showDecompositionQueryMode=="boolean"&&mt(E.showDecompositionQueryMode),typeof E.showDecompositionOutputMode=="boolean"&&nr(E.showDecompositionOutputMode),typeof E.showDecompositionMetricsMode=="boolean"&&Sn(E.showDecompositionMetricsMode),typeof E.showDecompositionHistoryMode=="boolean"&&an(E.showDecompositionHistoryMode),typeof E.showDecompositionRuntimeMode=="boolean"&&_(E.showDecompositionRuntimeMode),E.prompts&&(O(ie=>({...ie,...E.prompts})),Vn.current=!0)}catch{}or(),Sl(),sr()},[]);async function or(){try{const y=await Be.loadHistory();z(y.items??[])}catch(y){Y(`History load error: ${y instanceof Error?y.message:String(y)}`)}}async function Sl(){try{const L=(await Be.loadPresets()).presets??[];if(Ue(L),Vn.current){Zt.current=!0;return}if(Zt.current)return;const E=L.find(ie=>ie.prompt_version===ki)??L.find(ie=>ie.id==="default-normalizer-v2_0_2");if(!E){Zt.current=!0,Y(`Preset autoload skipped: ${ki} not found.`);return}st(E.id),Ee(p),O({systemPrompt:E.systemPrompt,developerPrompt:E.developerPrompt,domainPrompt:E.domainPrompt,schemaNotes:E.schemaNotes??"",fewShotExamples:E.fewShotExamples??""}),Zt.current=!0,Y(`Preset autoloaded: ${E.name} (${E.prompt_version}).`)}catch(y){Y(`Presets load error: ${y instanceof Error?y.message:String(y)}`)}}async function sr(){try{const y=await Be.listRuns();W(y.items??[])}catch(y){Y(`Runs load error: ${y instanceof Error?y.message:String(y)}`)}}function bt(){localStorage.setItem(mc,JSON.stringify({model:a.model,llmProvider:a.llmProvider,baseUrl:a.baseUrl,temperature:a.temperature,maxOutputTokens:a.maxOutputTokens})),Y("Local config saved (without API key).")}function wl(){localStorage.setItem(hc,JSON.stringify({uiMode:ve,activeTab:H,showAutorunsAssistantMode:on,showAutorunsDecompositionMode:Kt,showAutorunsProgressMode:at,showAutorunsCommentsMode:et,showAssistantConnectionMode:ut,showAssistantPromptMode:ct,showAssistantChatMode:qt,showAssistantSamMode:sn,showDecompositionConnectionMode:dt,showDecompositionPromptMode:Ge,showDecompositionQueryMode:At,showDecompositionOutputMode:It,showDecompositionMetricsMode:wt,showDecompositionHistoryMode:Jt,showDecompositionRuntimeMode:u,prompts:p})),window.dispatchEvent(new CustomEvent(Vf)),Y("UI layout and prompts saved.")}async function Or(){te(!0),se("");try{const y=await Be.testConnection(a);y.provider==="local"?y.model_found===!0?(Ae(`LOCAL OK - ${y.model}`),Y(`Local model is available: ${y.model} (catalog size=${y.models_count??"n/a"}).`)):y.model_found===!1?(Ae(`LOCAL OK, model not loaded - ${y.model}`),Y(`Local server is reachable, but model '${y.model}' is not in loaded catalog. Use 'Load model list' and select one of loaded models.`)):(Ae(`LOCAL OK (model list unavailable) - ${y.model}`),Y("Local server is reachable, but model catalog could not be verified.")):(Ae(`OPENAI OK - ${y.model}`),Y(`OpenAI connection ok: ${y.model}`))}catch(y){const L=y instanceof Error?y.message:String(y);Ae("Connection error"),se(`Test connection: ${L}`),Y(`Test connection error: ${L}`)}finally{te(!1)}}async function jl(){Se(!0);try{const L=(await Be.listModels(a)).models??[];Me(L),L.length>0&&m(E=>E.model&&L.includes(E.model)?E:{...E,model:L[0]}),Y(`Model catalog loaded (${a.llmProvider}): ${L.length} items.`)}catch(y){const L=y instanceof Error?y.message:String(y);Y(`Load model list error: ${L}`)}finally{Se(!1)}}j.useEffect(()=>{Me([])},[a.llmProvider,a.baseUrl]);async function kl(y){te(!0),se("");try{const L=await Be.normalize({connection:a,prompts:p,promptVersion:"normalizer_v2_0_2",query:{userQuestion:P.userQuestion,periodHint:P.periodHint,businessContext:P.businessContext,expectedRoute:P.expectedRoute},saveAsTestCase:y,useMock:he});Z(L),pe("normalized"),Y(`Normalize done: trace=${L.trace_id}, validation=${L.validation.passed?"passed":"failed"}`),or()}catch(L){const E=L instanceof Error?L.message:String(L);se(`Normalize: ${E}`),Y(`Normalize error: ${E}`)}finally{te(!1)}}function Ar(){const y=Fe.find(L=>L.id===Ke);if(!y){Y("Preset is not selected.");return}Ee(p),O({systemPrompt:y.systemPrompt,developerPrompt:y.developerPrompt,domainPrompt:y.domainPrompt,schemaNotes:y.schemaNotes??"",fewShotExamples:y.fewShotExamples??""}),Y(`Preset loaded: ${y.name}`)}async function Ir(){try{await Be.savePreset({name:be||"NDC preset",prompt_version:"normalizer_v2_0_2",systemPrompt:p.systemPrompt,developerPrompt:p.developerPrompt,domainPrompt:p.domainPrompt,schemaNotes:p.schemaNotes,fewShotExamples:p.fewShotExamples}),Y("Preset saved."),await Sl()}catch(y){Y(`Preset save error: ${y instanceof Error?y.message:String(y)}`)}}function Fr(){O(pc),Y("Prompt panel reset to defaults.")}function Cl(){const y=Gf(p,it);X(y),Y(y)}function Oo(){const y=P.batchQuestionsRaw.split(";").map(L=>L.trim()).filter(Boolean).join(` + +`);y&&(F(L=>({...L,batchQuestionsRaw:y})),Y("Batch field formatted: `;` converted to blank-line separators."))}async function Le(y){try{const E=(await Be.loadTrace(y)).trace,ie=E.parsed_normalized_json??null;Z({trace_id:String(E.trace_id??y),ok:!!E.validation_result?.passed,normalized:ie,route_hint_summary:E.route_hint_summary??(ie?{route_hint:ie.route_hint??null,confidence:ie.confidence?.route_hint??null}:null),raw_model_output:E.raw_model_response??{},validation:E.validation_result??{passed:!1,errors:["validation not found"]},usage:E.usage??{input_tokens:0,output_tokens:0,total_tokens:0},latency_ms:Number(E.latency_ms??0),prompt_version:String(E.prompt_version??"unknown"),schema_version:String(E.schema_version??"unknown")}),pe("raw"),se(""),Y(`Trace opened: ${y}`)}catch(L){const E=L instanceof Error?L.message:String(L);se(`Trace: ${E}`),Y(`Trace open error ${y}: ${E}`)}}async function Ao(){try{const y=await Be.startRun();h(y.run.runId),Y(`Run started: ${y.run.runId}`),Y("Tip: start run does not execute normalize by itself. Use 'Run eval v2.0.2' button."),await sr()}catch(y){Y(`Run start error: ${y instanceof Error?y.message:String(y)}`)}}async function Ur(){if(M)try{await Be.finishRun(M),Y(`Run finished: ${M}`),await sr()}catch(y){Y(`Run finish error: ${y instanceof Error?y.message:String(y)}`)}}async function Nl(){ne(!0),se("");try{Y("Starting eval in v2 contour.");const y=P.batchQuestionsRaw.trim()||P.userQuestion.trim();if(!y)throw new Error("Fill batch field or Raw user question first.");const L=await Be.runEval({connection:a,prompts:p,promptVersion:"normalizer_v2_0_2",mode:"single-pass-strict",rawQuestions:y,useMock:he});de(L.report),Y("Eval v2.0.2 run finished.");const E=L.report;if(E.run_id&&Y(`Eval run id: ${E.run_id}`),E.metrics){const ie=E.metrics;Y(`Eval metrics v2.0.2: schema=${ie.schema_validation_pass_rate??"n/a"}%, route_accuracy=${ie.route_resolution_accuracy??"n/a"}%, no_route_precision=${ie.no_route_precision??"n/a"}%, state_consistency=${ie.execution_state_consistency_rate??"n/a"}%`)}await or()}catch(y){const L=y instanceof Error?y.message:String(y);L.includes("Legacy eval runner supports normalized_query_v1 only")?(de({status:"plan_only",prompt_version:"normalizer_v2",reason:"backend eval runner is still legacy-v1 only",plan_file:"reports/v2_pilot_eval_plan.md",next_steps:["run cheap mock sanity for schema/fragment/scope","run small real batch (10-15 messages, temperature=0)","run challenge-30 replay with v2 metrics"]}),Y("Backend is legacy-only for eval right now. Showing v2 pilot plan.")):(se(`Eval: ${L}`),Y(`Eval run error: ${L}`))}finally{ne(!1)}}async function ir(){try{const y=JSON.stringify(le??{},null,2);await navigator.clipboard.writeText(y),Y("Eval report copied to clipboard.")}catch(y){Y(`Eval report copy error: ${y instanceof Error?y.message:String(y)}`)}}function Io(){je(""),Ut([]),rr(""),un(""),zr(""),Y("Assistant session reset.")}async function El(){const y=Xt.trim();if(!y)return;Lr(!0),zr(""),rr(""),Ut(E=>[...E,{message_id:`local-${Date.now()}`,session_id:V||"pending",role:"user",text:y,reply_type:null,created_at:new Date().toISOString(),trace_id:null,debug:null}]);const L=Dr();try{const E=await Be.sendAssistantMessage({connection:a,prompts:p,userMessage:y,sessionId:V||void 0,promptVersion:vc,useMock:he});je(E.session_id),Ut(E.conversation),un("Ответ готов"),Y(`Assistant reply received: trace=${E.debug.trace_id}`)}catch(E){const ie=E instanceof Error?E.message:String(E);zr(ie),un("Ошибка ассистента"),Y(`Assistant error: ${ie}`)}finally{L(),Lr(!1)}}return j.useEffect(()=>{if(!M){q([]);return}Be.runTrace(M).then(y=>q(y.items)).catch(y=>Y(`Run trace error: ${y instanceof Error?y.message:String(y)}`))},[M]),s.jsxs("main",{className:`app-root ${ve==="assistant"||ve==="decomposition"||ve==="autoruns"?"app-root-autoruns":""}`,children:[s.jsxs("header",{className:"app-topbar",children:[s.jsxs("div",{className:"mode-switch-row",children:[s.jsx("button",{type:"button",className:ve==="assistant"?"tab active":"tab",onClick:()=>Et("assistant"),children:"Ассистент"}),s.jsx("button",{type:"button",className:ve==="decomposition"?"tab active":"tab",onClick:()=>Et("decomposition"),children:"Декомпозиция"}),s.jsx("button",{type:"button",className:ve==="autoruns"?"tab active":"tab",onClick:()=>Et("autoruns"),children:"История автопрогонов"}),s.jsx("button",{type:"button",className:"tab",onClick:wl,children:"Сохранить"})]}),ve==="assistant"?s.jsxs("div",{className:"mode-switch-row mode-switch-row-right",children:[s.jsx("button",{type:"button",className:ut?"tab active":"tab",onClick:()=>Pt(y=>!y),children:"LLM Connector"}),s.jsx("button",{type:"button",className:ct?"tab active":"tab",onClick:()=>_e(y=>!y),children:"Prompt Manager"}),s.jsx("button",{type:"button",className:qt?"tab active":"tab",onClick:()=>_n(y=>!y),children:"Режим ассистента"}),s.jsx("button",{type:"button",className:sn?"tab active":"tab",onClick:()=>Pe(y=>!y),children:"SAM"})]}):ve==="decomposition"?s.jsxs("div",{className:"mode-switch-row mode-switch-row-right",children:[s.jsx("button",{type:"button",className:dt?"tab active":"tab",onClick:()=>Ot(y=>!y),children:"LLM"}),s.jsx("button",{type:"button",className:Ge?"tab active":"tab",onClick:()=>Yt(y=>!y),children:"Prompt"}),s.jsx("button",{type:"button",className:At?"tab active":"tab",onClick:()=>mt(y=>!y),children:"Запрос"}),s.jsx("button",{type:"button",className:It?"tab active":"tab",onClick:()=>nr(y=>!y),children:"Выход"}),s.jsx("button",{type:"button",className:wt?"tab active":"tab",onClick:()=>Sn(y=>!y),children:"Метрики"}),s.jsx("button",{type:"button",className:Jt?"tab active":"tab",onClick:()=>an(y=>!y),children:"История"}),s.jsx("button",{type:"button",className:u?"tab active":"tab",onClick:()=>_(y=>!y),children:"NDC Run Monitor"})]}):ve==="autoruns"?s.jsxs("div",{className:"mode-switch-row mode-switch-row-right",children:[s.jsx("button",{type:"button",className:on?"tab active":"tab",onClick:()=>St(y=>!y),children:"Режим ассистента"}),s.jsx("button",{type:"button",className:Kt?"tab active":"tab",onClick:()=>xn(y=>!y),children:"Режим декомпозиции"}),s.jsx("button",{type:"button",className:at?"tab active":"tab",onClick:()=>ae(y=>!y),children:"Прогресс/регресс"}),s.jsx("button",{type:"button",className:et?"tab active":"tab",onClick:()=>Gt(y=>!y),children:"Комментарии"})]}):null]}),ve==="assistant"?s.jsx("div",{className:"layout-grid layout-grid-mode-columns",children:s.jsxs("div",{className:"mode-columns",children:[ut?s.jsx("div",{className:"mode-col",children:s.jsx(dc,{value:a,modelOptions:me,modelsBusy:re,onChange:m,onReloadModels:jl,onSaveLocalConfig:bt,onTestConnection:Or,lastStatus:Ne,busy:Te||lr})}):null,ct?s.jsx("div",{className:"mode-col mode-col-wide",children:s.jsx(fc,{value:p,onChange:O,presets:Fe,selectedPresetId:Ke,onSelectPreset:st,onLoadPreset:Ar,onSavePreset:Ir,onResetDefaults:Fr,onDiffPrevious:Cl,presetName:be,onPresetNameChange:xe,diffSummary:Ve})}):null,qt?s.jsx("div",{className:"mode-col mode-col-xwide",children:s.jsx(zf,{sessionId:V,conversation:Ft,inputValue:Xt,onInputChange:rr,useMock:he,onUseMockChange:ye,onSend:El,onClear:Io,busy:lr,statusText:wn,errorMessage:jn})}):null,sn?s.jsx("div",{className:"mode-col",children:s.jsx(vf,{sessionId:V,conversation:Ft,statusText:wn,errorMessage:jn,useMock:he,appLogs:ee})}):null,!ut&&!ct&&!qt&&!sn?s.jsx("div",{className:"mode-columns-empty",children:"Все панели режима ассистента скрыты. Включите нужные блоки справа в шапке."}):null]})}):ve==="decomposition"?s.jsx("div",{className:"layout-grid layout-grid-mode-columns",children:s.jsxs("div",{className:"mode-columns",children:[dt?s.jsx("div",{className:"mode-col",children:s.jsx(dc,{value:a,modelOptions:me,modelsBusy:re,onChange:m,onReloadModels:jl,onSaveLocalConfig:bt,onTestConnection:Or,lastStatus:Ne,busy:Te})}):null,Ge?s.jsx("div",{className:"mode-col mode-col-wide",children:s.jsx(fc,{value:p,onChange:O,presets:Fe,selectedPresetId:Ke,onSelectPreset:st,onLoadPreset:Ar,onSavePreset:Ir,onResetDefaults:Fr,onDiffPrevious:Cl,presetName:be,onPresetNameChange:xe,diffSummary:Ve})}):null,At?s.jsx("div",{className:"mode-col",children:s.jsx(Uf,{value:P,onChange:F,onApplyBatchFormat:Oo,onNormalize:kl,busy:Te,useMock:he,onUseMockChange:ye,errorMessage:ue})}):null,It?s.jsx("div",{className:"mode-col mode-col-xwide",children:s.jsx(Ff,{tab:H,onTabChange:pe,result:Q,appLogs:ee})}):null,wt?s.jsx("div",{className:"mode-col",children:s.jsx(Of,{result:Q})}):null,Jt?s.jsx("div",{className:"mode-col",children:s.jsx(Df,{items:U,onRefresh:or,onOpenTrace:Le})}):null,u?s.jsx("div",{className:"mode-col mode-col-xwide",children:s.jsx($f,{runs:T,selectedRunId:M,onSelectRun:h,onStartRun:Ao,onFinishRun:Ur,onRefreshRuns:sr,onRunEval:Nl,onCopyEvalReport:ir,evalBusy:b,traceItems:S,evalReport:le})}):null,!dt&&!Ge&&!At&&!It&&!wt&&!Jt&&!u?s.jsx("div",{className:"mode-columns-empty",children:"Все панели режима декомпозиции скрыты. Включите нужные блоки справа в шапке."}):null]})}):s.jsx("div",{className:"layout-grid layout-grid-autoruns",children:s.jsx(kf,{connection:a,prompts:p,assistantPromptVersion:vc,decompositionPromptVersion:ki,showAssistantMode:on,showDecompositionMode:Kt,showProgressMode:at,showCommentsMode:et,onLog:Y})})]})}pf.createRoot(document.getElementById("root")).render(s.jsx(of.StrictMode,{children:s.jsx(qf,{})})); diff --git a/llm_normalizer/frontend/dist/index.html b/llm_normalizer/frontend/dist/index.html index 3364b41..39f7156 100644 --- a/llm_normalizer/frontend/dist/index.html +++ b/llm_normalizer/frontend/dist/index.html @@ -4,8 +4,8 @@ NDC AI Normalizer Playground - - + +
diff --git a/llm_normalizer/frontend/src/App.tsx b/llm_normalizer/frontend/src/App.tsx index 32e3848..b69c118 100644 --- a/llm_normalizer/frontend/src/App.tsx +++ b/llm_normalizer/frontend/src/App.tsx @@ -1,5 +1,6 @@ import { useEffect, useRef, useState } from "react"; import { apiClient } from "./api/client"; +import { AssistantSamPanel } from "./components/AssistantSamPanel"; import { AutoRunsHistoryPanel } from "./components/AutoRunsHistoryPanel"; import { AssistantPanel } from "./components/AssistantPanel"; import { ConnectionPanel } from "./components/ConnectionPanel"; @@ -24,10 +25,13 @@ import type { } from "./state/types"; const SESSION_CONFIG_KEY = "ndc_normalizer_session_config_v1"; +const AUTORUNS_LAYOUT_CONFIG_KEY = "ndc_autoruns_layout_config_v1"; +const AUTORUNS_SAVE_EVENT = "ndc-autoruns-save"; const ASSISTANT_STAGES = ["Анализ запроса", "Получение данных", "Подготовка ответа"]; const DEFAULT_UI_MODE: UiMode = "assistant"; const AUTOLOAD_PROMPT_VERSION = "normalizer_v2_0_2"; const ASSISTANT_PROMPT_VERSION = "address_query_runtime_v1"; +const TAB_KEYS: TabKey[] = ["normalized", "fragments", "scope", "flags", "route", "raw", "validation", "logs"]; function withTs(message: string): string { return `[${new Date().toLocaleTimeString("ru-RU")}] ${message}`; @@ -83,6 +87,18 @@ export default function App() { const [showAutorunsAssistantMode, setShowAutorunsAssistantMode] = useState(true); const [showAutorunsDecompositionMode, setShowAutorunsDecompositionMode] = useState(true); const [showAutorunsProgressMode, setShowAutorunsProgressMode] = useState(true); + const [showAutorunsCommentsMode, setShowAutorunsCommentsMode] = useState(true); + const [showAssistantConnectionMode, setShowAssistantConnectionMode] = useState(true); + const [showAssistantPromptMode, setShowAssistantPromptMode] = useState(true); + const [showAssistantChatMode, setShowAssistantChatMode] = useState(true); + const [showAssistantSamMode, setShowAssistantSamMode] = useState(true); + const [showDecompositionConnectionMode, setShowDecompositionConnectionMode] = useState(true); + const [showDecompositionPromptMode, setShowDecompositionPromptMode] = useState(true); + const [showDecompositionQueryMode, setShowDecompositionQueryMode] = useState(true); + const [showDecompositionOutputMode, setShowDecompositionOutputMode] = useState(true); + const [showDecompositionMetricsMode, setShowDecompositionMetricsMode] = useState(true); + const [showDecompositionHistoryMode, setShowDecompositionHistoryMode] = useState(true); + const [showDecompositionRuntimeMode, setShowDecompositionRuntimeMode] = useState(true); const [assistantSessionId, setAssistantSessionId] = useState(""); const [assistantConversation, setAssistantConversation] = useState([]); const [assistantInput, setAssistantInput] = useState(""); @@ -90,6 +106,7 @@ export default function App() { const [assistantStatus, setAssistantStatus] = useState(""); const [assistantError, setAssistantError] = useState(""); const presetAutoloadDoneRef = useRef(false); + const skipPresetAutoloadRef = useRef(false); useEffect(() => { const root = document.documentElement; @@ -106,6 +123,8 @@ export default function App() { root.style.setProperty("--rgb-scrollbar-track", colors.scrollbarTrackRgb); root.style.setProperty("--rgb-scrollbar-thumb", colors.scrollbarThumbRgb); root.style.setProperty("--rgb-scrollbar-thumb-hover", colors.scrollbarThumbHoverRgb); + root.style.setProperty("--mode-column-width", `${designConfig.layout.modeColumnWidthPx}px`); + root.style.setProperty("--mode-toggle-width", `${designConfig.layout.modeToggleWidthPx}px`); }, []); const log = (message: string) => { @@ -140,6 +159,92 @@ export default function App() { } } + const cachedAutorunsLayout = localStorage.getItem(AUTORUNS_LAYOUT_CONFIG_KEY); + if (cachedAutorunsLayout) { + try { + const parsed = JSON.parse(cachedAutorunsLayout) as { + uiMode?: UiMode; + activeTab?: TabKey; + showAutorunsAssistantMode?: boolean; + showAutorunsDecompositionMode?: boolean; + showAutorunsProgressMode?: boolean; + showAutorunsCommentsMode?: boolean; + showAssistantConnectionMode?: boolean; + showAssistantPromptMode?: boolean; + showAssistantChatMode?: boolean; + showAssistantSamMode?: boolean; + showDecompositionConnectionMode?: boolean; + showDecompositionPromptMode?: boolean; + showDecompositionQueryMode?: boolean; + showDecompositionOutputMode?: boolean; + showDecompositionMetricsMode?: boolean; + showDecompositionHistoryMode?: boolean; + showDecompositionRuntimeMode?: boolean; + prompts?: PromptState; + }; + if (parsed.uiMode === "assistant" || parsed.uiMode === "decomposition" || parsed.uiMode === "autoruns") { + setUiMode(parsed.uiMode); + } + if (parsed.activeTab && TAB_KEYS.includes(parsed.activeTab)) { + setActiveTab(parsed.activeTab); + } + if (typeof parsed.showAutorunsAssistantMode === "boolean") { + setShowAutorunsAssistantMode(parsed.showAutorunsAssistantMode); + } + if (typeof parsed.showAutorunsDecompositionMode === "boolean") { + setShowAutorunsDecompositionMode(parsed.showAutorunsDecompositionMode); + } + if (typeof parsed.showAutorunsProgressMode === "boolean") { + setShowAutorunsProgressMode(parsed.showAutorunsProgressMode); + } + if (typeof parsed.showAutorunsCommentsMode === "boolean") { + setShowAutorunsCommentsMode(parsed.showAutorunsCommentsMode); + } + if (typeof parsed.showAssistantConnectionMode === "boolean") { + setShowAssistantConnectionMode(parsed.showAssistantConnectionMode); + } + if (typeof parsed.showAssistantPromptMode === "boolean") { + setShowAssistantPromptMode(parsed.showAssistantPromptMode); + } + if (typeof parsed.showAssistantChatMode === "boolean") { + setShowAssistantChatMode(parsed.showAssistantChatMode); + } + if (typeof parsed.showAssistantSamMode === "boolean") { + setShowAssistantSamMode(parsed.showAssistantSamMode); + } + if (typeof parsed.showDecompositionConnectionMode === "boolean") { + setShowDecompositionConnectionMode(parsed.showDecompositionConnectionMode); + } + if (typeof parsed.showDecompositionPromptMode === "boolean") { + setShowDecompositionPromptMode(parsed.showDecompositionPromptMode); + } + if (typeof parsed.showDecompositionQueryMode === "boolean") { + setShowDecompositionQueryMode(parsed.showDecompositionQueryMode); + } + if (typeof parsed.showDecompositionOutputMode === "boolean") { + setShowDecompositionOutputMode(parsed.showDecompositionOutputMode); + } + if (typeof parsed.showDecompositionMetricsMode === "boolean") { + setShowDecompositionMetricsMode(parsed.showDecompositionMetricsMode); + } + if (typeof parsed.showDecompositionHistoryMode === "boolean") { + setShowDecompositionHistoryMode(parsed.showDecompositionHistoryMode); + } + if (typeof parsed.showDecompositionRuntimeMode === "boolean") { + setShowDecompositionRuntimeMode(parsed.showDecompositionRuntimeMode); + } + if (parsed.prompts) { + setPrompts((prev) => ({ + ...prev, + ...parsed.prompts + })); + skipPresetAutoloadRef.current = true; + } + } catch { + // ignore broken local cache + } + } + void refreshHistory(); void refreshPresets(); void refreshRuns(); @@ -159,6 +264,10 @@ export default function App() { const payload = await apiClient.loadPresets(); const presets = payload.presets ?? []; setPresetList(presets); + if (skipPresetAutoloadRef.current) { + presetAutoloadDoneRef.current = true; + return; + } if (presetAutoloadDoneRef.current) { return; } @@ -209,6 +318,34 @@ export default function App() { log("Local config saved (without API key)."); } + function saveAutorunsLayout() { + localStorage.setItem( + AUTORUNS_LAYOUT_CONFIG_KEY, + JSON.stringify({ + uiMode, + activeTab, + showAutorunsAssistantMode, + showAutorunsDecompositionMode, + showAutorunsProgressMode, + showAutorunsCommentsMode, + showAssistantConnectionMode, + showAssistantPromptMode, + showAssistantChatMode, + showAssistantSamMode, + showDecompositionConnectionMode, + showDecompositionPromptMode, + showDecompositionQueryMode, + showDecompositionOutputMode, + showDecompositionMetricsMode, + showDecompositionHistoryMode, + showDecompositionRuntimeMode, + prompts + }) + ); + window.dispatchEvent(new CustomEvent(AUTORUNS_SAVE_EVENT)); + log("UI layout and prompts saved."); + } + async function testConnection() { setBusy(true); setLastError(""); @@ -522,10 +659,6 @@ export default function App() { userMessage, sessionId: assistantSessionId || undefined, promptVersion: ASSISTANT_PROMPT_VERSION, - context: { - periodHint: query.periodHint, - businessContext: query.businessContext - }, useMock }); setAssistantSessionId(response.session_id); @@ -555,7 +688,11 @@ export default function App() { }, [selectedRunId]); return ( -
+
+
- {uiMode === "autoruns" ? ( + {uiMode === "assistant" ? ( +
+ + + + +
+ ) : uiMode === "decomposition" ? ( +
+ + + + + + + +
+ ) : uiMode === "autoruns" ? (
+
) : null}
{uiMode === "assistant" ? ( -
- +
+
+ {showAssistantConnectionMode ? ( +
+ +
+ ) : null} - + {showAssistantPromptMode ? ( +
+ +
+ ) : null} - setQuery((prev) => ({ ...prev, periodHint: value }))} - businessContext={query.businessContext} - onBusinessContextChange={(value) => setQuery((prev) => ({ ...prev, businessContext: value }))} - useMock={useMock} - onUseMockChange={setUseMock} - onSend={sendAssistantMessage} - onClear={resetAssistantSession} - busy={assistantBusy} - statusText={assistantStatus} - errorMessage={assistantError} - /> + {showAssistantChatMode ? ( +
+ +
+ ) : null} + + {showAssistantSamMode ? ( +
+ +
+ ) : null} + + {!showAssistantConnectionMode && !showAssistantPromptMode && !showAssistantChatMode && !showAssistantSamMode ? ( +
Все панели режима ассистента скрыты. Включите нужные блоки справа в шапке.
+ ) : null} +
) : uiMode === "decomposition" ? ( -
- +
+
+ {showDecompositionConnectionMode ? ( +
+ +
+ ) : null} - + {showDecompositionPromptMode ? ( +
+ +
+ ) : null} - + {showDecompositionQueryMode ? ( +
+ +
+ ) : null} - + {showDecompositionOutputMode ? ( +
+ +
+ ) : null} - + {showDecompositionMetricsMode ? ( +
+ +
+ ) : null} - + {showDecompositionHistoryMode ? ( +
+ +
+ ) : null} - + {showDecompositionRuntimeMode ? ( +
+ +
+ ) : null} + + {!showDecompositionConnectionMode && + !showDecompositionPromptMode && + !showDecompositionQueryMode && + !showDecompositionOutputMode && + !showDecompositionMetricsMode && + !showDecompositionHistoryMode && + !showDecompositionRuntimeMode ? ( +
Все панели режима декомпозиции скрыты. Включите нужные блоки справа в шапке.
+ ) : null} +
) : (
@@ -713,6 +994,7 @@ export default function App() { showAssistantMode={showAutorunsAssistantMode} showDecompositionMode={showAutorunsDecompositionMode} showProgressMode={showAutorunsProgressMode} + showCommentsMode={showAutorunsCommentsMode} onLog={log} />
@@ -720,4 +1002,3 @@ export default function App() {
); } - diff --git a/llm_normalizer/frontend/src/api/client.ts b/llm_normalizer/frontend/src/api/client.ts index 35d30d7..d505042 100644 --- a/llm_normalizer/frontend/src/api/client.ts +++ b/llm_normalizer/frontend/src/api/client.ts @@ -371,6 +371,8 @@ export const apiClient = { assistant_prompt_version?: string; decomposition_prompt_version?: string; prompt_fingerprint?: string; + autogen_personality_id?: string; + autogen_personality_prompt?: string; }; }): Promise<{ ok: boolean; generation: { generation_id: string; created_at: string; mode: AutoGenMode; count: number; domain: string | null; questions: string[]; generated_by: string | null; saved_case_set_file: string | null; context: Record | null } }> { return request("/autoruns/autogen/generate", { diff --git a/llm_normalizer/frontend/src/components/AssistantPanel.tsx b/llm_normalizer/frontend/src/components/AssistantPanel.tsx index 4c577a1..18f105c 100644 --- a/llm_normalizer/frontend/src/components/AssistantPanel.tsx +++ b/llm_normalizer/frontend/src/components/AssistantPanel.tsx @@ -9,10 +9,6 @@ interface AssistantPanelProps { conversation: AssistantConversationItem[]; inputValue: string; onInputChange: (value: string) => void; - periodHint: string; - onPeriodHintChange: (value: string) => void; - businessContext: string; - onBusinessContextChange: (value: string) => void; useMock: boolean; onUseMockChange: (value: boolean) => void; onSend: () => Promise | void; @@ -70,10 +66,6 @@ export function AssistantPanel({ conversation, inputValue, onInputChange, - periodHint, - onPeriodHintChange, - businessContext, - onBusinessContextChange, useMock, onUseMockChange, onSend, @@ -175,16 +167,6 @@ export function AssistantPanel({
-
- - -