@aiquants/governance-react 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +32 -0
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +288 -0
- package/dist/index.d.ts +288 -0
- package/dist/index.js +7 -0
- package/package.json +87 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{useState as Ue}from"react";import{jsx as G,jsxs as V}from"react/jsx-runtime";function He(e){return!e||e.length<16?e??"N/A":`${e.slice(0,8)}...${e.slice(-8)}`}function Et({proof:e,verificationState:a="verified",onVerify:i,isVerifying:d=!1}){let[l,n]=Ue(!1),c={verified:{bg:"#ecfdf5",text:"#065f46",label:"\u691C\u8A3C\u6E08\u307F (Verified)"},degraded:{bg:"#fffbeb",text:"#92400e",label:"\u7E2E\u9000\u30E2\u30FC\u30C9 (Degraded)"},invalid:{bg:"#fef2f2",text:"#991b1b",label:"\u6539\u3056\u3093\u691C\u77E5 (Invalid)"},pending:{bg:"#f1f5f9",text:"#475569",label:"\u672A\u691C\u8A3C (Pending)"}},{bg:o,text:b,label:x}=c[a];return V("div",{"data-testid":"citation-proof-badge","data-verification-state":a,"data-leaf-count":e.leaf_count,"data-grounded":String(e.is_fully_grounded),style:{display:"inline-block",border:"1px solid #cbd5e1",borderRadius:"6px",padding:"8px 12px",backgroundColor:"#ffffff",fontSize:"13px"},children:[V("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[G("span",{"data-testid":"proof-state-label",style:{padding:"2px 8px",borderRadius:"12px",backgroundColor:o,color:b,fontWeight:600,fontSize:"12px"},children:x}),V("span",{style:{color:"#64748b"},children:["\u30EA\u30FC\u30D5\u6570: ",G("strong",{"data-testid":"merkle-leaf-count",children:e.leaf_count})]}),V("span",{style:{color:"#64748b"},children:["\u6839\u30CF\u30C3\u30B7\u30E5:"," ",G("code",{"data-testid":"merkle-root-hash",style:{backgroundColor:"#f8fafc",padding:"2px 4px",borderRadius:"3px"},children:He(e.root_hash)})]}),G("span",{"data-testid":"grounded-status",style:{fontSize:"12px",fontWeight:500,color:e.is_fully_grounded?"#059669":"#d97706"},children:e.is_fully_grounded?"\u5B8C\u5168\u88CF\u4ED8":"\u90E8\u5206\u88CF\u4ED8"}),i&&G("button",{type:"button","data-testid":"verify-citation-button","aria-label":"\u6697\u53F7\u5B66\u7684\u5F15\u7528\u8A3C\u660E\u3092\u518D\u691C\u8A3C",disabled:d,onClick:()=>i(),style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:d?"not-allowed":"pointer",fontSize:"12px"},children:d?"\u691C\u8A3C\u4E2D...":"\u518D\u691C\u8A3C"}),G("button",{type:"button","data-testid":"toggle-proof-details","aria-label":"\u8A3C\u660E\u8A73\u7D30\u306E\u8868\u793A\u5207\u308A\u66FF\u3048","aria-expanded":l,"aria-controls":"proof-details-panel",onClick:()=>n(!l),style:{background:"none",border:"none",cursor:"pointer",color:"#2563eb",fontSize:"12px",textDecoration:"underline",padding:"2px 4px"},children:l?"\u8A73\u7D30\u3092\u9589\u3058\u308B":"\u8A73\u7D30"})]}),l&&V("div",{id:"proof-details-panel","data-testid":"proof-details-panel",style:{marginTop:"8px",paddingTop:"8px",borderTop:"1px dashed #e2e8f0",fontSize:"12px",color:"#334155"},children:[V("div",{children:[G("strong",{children:"\u5B8C\u5168\u6839\u30CF\u30C3\u30B7\u30E5: "}),G("span",{"data-testid":"full-root-hash",style:{wordBreak:"break-all",fontFamily:"monospace"},children:e.root_hash??"null"})]}),V("div",{children:[G("strong",{children:"\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0: "}),G("span",{children:e.algorithm})]}),e.as_of&&V("div",{children:[G("strong",{children:"\u6709\u52B9\u6642\u70B9 (AsOf): "}),G("span",{"data-testid":"proof-as-of",children:e.as_of})]}),e.signature&&V("div",{children:[G("strong",{children:"\u30C7\u30B8\u30BF\u30EB\u7F72\u540D: "}),G("span",{"data-testid":"proof-signature",style:{wordBreak:"break-all",fontFamily:"monospace"},children:e.signature})]})]})]})}import{useState as le}from"react";import{Fragment as Je,jsx as C,jsxs as O}from"react/jsx-runtime";function At({rules:e,onReorderRules:a,onUpdateRule:i,onDeleteRule:d,onCreateRule:l,isSubmitting:n=!1,consultedBy:c}){let[o,b]=le(!1),[x,k]=le(""),[S,y]=le(""),[w,r]=le("CONTRACT_LEGAL"),s=[...e].sort((t,m)=>t.priority-m.priority),h=(t,m)=>{let g=m==="up"?t-1:t+1,v=[...s],E=v[t];v[t]=v[g],v[g]=E,a?.(v.map(X=>X.id))};return O("div",{"data-testid":"classification-rule-editor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[O("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[O("div",{children:[C("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u52D5\u7684\u30C9\u30E1\u30A4\u30F3\u5206\u985E\u30EB\u30FC\u30EB\u7BA1\u7406"}),C("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:"\u4E0A\u304B\u3089\u9806\u306B\u8A55\u4FA1\u3055\u308C\u3001\u6700\u521D\u306B\u4E00\u81F4\u3057\u305F\u30EB\u30FC\u30EB\u304C\u9069\u7528\u3055\u308C\u308B\u8A2D\u8A08\u3067\u3059 (\u512A\u5148\u5EA6\u9806)\u3002"}),c===null?C("p",{"data-testid":"rule-consumer-unknown",style:{margin:"4px 0 0 0",fontSize:"12px",color:"#92400e"},children:"\u3053\u306E\u914D\u5099\u3067\u8AB0\u304C\u3053\u306E\u8868\u3092\u8AAD\u3080\u304B\u306F\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}):O("p",{"data-testid":"rule-consumer",style:{margin:"4px 0 0 0",fontSize:"12px",color:"#64748b"},children:["\u8AAD\u307F\u624B: ",c]})]}),l&&C("button",{type:"button","data-testid":"add-rule-button","aria-expanded":o,"aria-controls":"create-rule-form","aria-label":o?"\u65B0\u898F\u5206\u985E\u30EB\u30FC\u30EB\u306E\u8FFD\u52A0\u30D5\u30A9\u30FC\u30E0\u3092\u9589\u3058\u308B":"\u65B0\u898F\u5206\u985E\u30EB\u30FC\u30EB\u306E\u8FFD\u52A0\u30D5\u30A9\u30FC\u30E0\u3092\u958B\u304F",onClick:()=>b(!o),style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:"#2563eb",color:"#ffffff",fontSize:"13px",fontWeight:500,cursor:"pointer"},children:o?"\u9589\u3058\u308B":"\u30EB\u30FC\u30EB\u8FFD\u52A0"})]}),o&&O("form",{id:"create-rule-form","data-testid":"create-rule-form",onSubmit:t=>{t.preventDefault();let m=x.trim();m&&(l?.({rule_name:m,uri_pattern:S.trim()||null,target_domain_key:w,is_active:!0}),k(""),y(""),b(!1))},style:{padding:"12px",backgroundColor:"#f8fafc",borderRadius:"6px",marginBottom:"16px",border:"1px solid #cbd5e1"},children:[C("h3",{style:{margin:"0 0 10px 0",fontSize:"14px",color:"#1e293b"},children:"\u65B0\u898F\u30EB\u30FC\u30EB\u4F5C\u6210"}),O("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"10px",marginBottom:"10px"},children:[O("div",{children:[C("label",{htmlFor:"new-rule-name-input",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u30EB\u30FC\u30EB\u540D"}),C("input",{id:"new-rule-name-input",type:"text","data-testid":"new-rule-name-input",placeholder:"\u4F8B: \u5951\u7D04\u66F8\u30D5\u30A9\u30EB\u30C0\u81EA\u52D5\u5206\u985E",value:x,onChange:t=>k(t.target.value),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"},required:!0})]}),O("div",{children:[C("label",{htmlFor:"new-rule-uri-input",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"URI \u30D1\u30BF\u30FC\u30F3 (glob / \u6B63\u898F\u8868\u73FE)"}),C("input",{id:"new-rule-uri-input",type:"text","data-testid":"new-rule-uri-input",placeholder:"\u4F8B: storage://contracts/**",value:S,onChange:t=>y(t.target.value),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"}})]}),O("div",{children:[C("label",{htmlFor:"new-rule-domain-select",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u5224\u5B9A\u5148\u30C9\u30E1\u30A4\u30F3"}),O("select",{id:"new-rule-domain-select","data-testid":"new-rule-domain-select",value:w,onChange:t=>r(t.target.value),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"},children:[C("option",{value:"CONTRACT_LEGAL",children:"CONTRACT_LEGAL (\u5951\u7D04\u30FB\u898F\u7A0B)"}),C("option",{value:"FINANCIAL_REPORT",children:"FINANCIAL_REPORT (\u8CA1\u52D9\u8AF8\u8868)"}),C("option",{value:"TECHNICAL_SPEC",children:"TECHNICAL_SPEC (\u6280\u8853\u4ED5\u69D8)"}),C("option",{value:"GENERAL_DOCUMENT",children:"GENERAL_DOCUMENT (\u4E00\u822C\u6587\u66F8)"})]})]})]}),C("button",{type:"submit","data-testid":"submit-new-rule",disabled:n||!x.trim(),style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:"#10b981",color:"#ffffff",fontSize:"13px",fontWeight:500,cursor:n||!x.trim()?"not-allowed":"pointer"},children:"\u4F5C\u6210\u767B\u9332"})]}),C("div",{style:{overflowX:"auto"},children:O("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[C("thead",{children:O("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[C("th",{style:{padding:"6px 8px"},children:"\u512A\u5148\u9806\u4F4D"}),C("th",{style:{padding:"6px 8px"},children:"\u30EB\u30FC\u30EB\u540D"}),C("th",{style:{padding:"6px 8px"},children:"URI \u30D1\u30BF\u30FC\u30F3"}),C("th",{style:{padding:"6px 8px"},children:"\u5224\u5B9A\u30C9\u30E1\u30A4\u30F3"}),C("th",{style:{padding:"6px 8px"},children:"\u6709\u52B9\u5316"}),d&&C("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),C("tbody",{children:s.map((t,m)=>O("tr",{"data-testid":`rule-row-${t.id}`,style:{borderBottom:"1px solid #f1f5f9"},children:[C("td",{style:{padding:"8px"},children:O("div",{style:{display:"flex",gap:"4px",alignItems:"center"},children:[C("span",{style:{fontWeight:700,width:"20px"},children:m+1}),a&&O(Je,{children:[C("button",{type:"button","data-testid":`rule-move-up-${t.id}`,"aria-label":`${t.rule_name} \u306E\u512A\u5148\u5EA6\u3092\u4E0A\u3052\u308B`,disabled:m===0||n,onClick:()=>h(m,"up"),style:{padding:"1px 6px",borderRadius:"3px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:m===0||n?"not-allowed":"pointer",fontSize:"11px"},children:"\u25B2"}),C("button",{type:"button","data-testid":`rule-move-down-${t.id}`,"aria-label":`${t.rule_name} \u306E\u512A\u5148\u5EA6\u3092\u4E0B\u3052\u308B`,disabled:m===s.length-1||n,onClick:()=>h(m,"down"),style:{padding:"1px 6px",borderRadius:"3px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:m===s.length-1||n?"not-allowed":"pointer",fontSize:"11px"},children:"\u25BC"})]})]})}),C("td",{style:{padding:"8px",fontWeight:600},children:t.rule_name}),C("td",{style:{padding:"8px",color:"#64748b"},children:C("code",{children:t.uri_pattern??"\u4EFB\u610F (*)"})}),C("td",{style:{padding:"8px"},children:t.target_domain_key===null?C("span",{"data-testid":`rule-domain-unset-${t.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#f1f5f9",color:"#64748b",fontWeight:500},children:"\u5224\u5B9A\u5148\u306A\u3057"}):C("span",{style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#e0e7ff",color:"#3730a3",fontWeight:500},children:t.target_domain_key})}),O("td",{style:{padding:"8px"},children:[!i&&C("span",{"data-testid":`rule-active-state-${t.id}`,"data-active":t.is_active,style:{fontSize:"11px",padding:"2px 8px",borderRadius:"12px",backgroundColor:t.is_active?"#d1fae5":"#e2e8f0",color:t.is_active?"#065f46":"#475569",fontWeight:600},children:t.is_active?"\u6709\u52B9":"\u7121\u52B9"}),i&&C("button",{type:"button",role:"switch","aria-checked":t.is_active,"aria-label":`${t.rule_name} \u306E\u6709\u52B9\u5316\u5207\u308A\u66FF\u3048`,"data-testid":`rule-active-toggle-${t.id}`,onClick:()=>i(t.id,{is_active:!t.is_active}),style:{padding:"2px 8px",borderRadius:"12px",border:"none",backgroundColor:t.is_active?"#10b981":"#cbd5e1",color:"#ffffff",cursor:"pointer",fontSize:"11px",fontWeight:600},children:t.is_active?"\u6709\u52B9":"\u7121\u52B9"})]}),d&&C("td",{style:{padding:"8px",textAlign:"right"},children:C("button",{type:"button","data-testid":`rule-delete-${t.id}`,"aria-label":`${t.rule_name} \u3092\u524A\u9664`,disabled:n,onClick:()=>d(t.id),style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #ef4444",backgroundColor:"#ffffff",color:"#ef4444",cursor:n?"not-allowed":"pointer",fontSize:"12px"},children:"\u524A\u9664"})})]},t.id))})]})})]})}import{CLOUD_CAPABLE_CAPABILITIES as Xe,ConfidentialityLevelSchema as Ve,GovernedCapabilitySchema as Ye}from"@aiquants/governance-core";import{useEffect as Qe,useRef as ye,useState as Ze}from"react";import{jsx as $,jsxs as W}from"react/jsx-runtime";var et=new Set(["CONFIDENTIAL","RESTRICTED"]),se=Ve.options,me=Ye.options,tt=new Set(Xe);function pe(e,a){return`${e}:${a}`}function ot(e,a){let i=[...e??[]];return a&&!i.includes(a)&&i.push(a),i}function Ot({policies:e,promptKeys:a,onChangePolicy:i,isUpdating:d=!1,readOnly:l=!1}){let[n,c]=Ze(null),o=ye(null),b=ye(null),x=ye(null);Qe(()=>{if(!n)return;b.current?.focus();let t=m=>{if(m.key==="Escape"){c(null),o.current?.focus();return}m.key==="Tab"&&(m.shiftKey&&document.activeElement===b.current?(m.preventDefault(),x.current?.focus()):!m.shiftKey&&document.activeElement===x.current&&(m.preventDefault(),b.current?.focus()))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[n]);let k=new Map(e.map(t=>[pe(t.confidentialityLevel,t.capability),t])),S=t=>{i&&i(t)},y=t=>{S({...t,isEnabled:!t.isEnabled})},w=(t,m)=>{let g={...t,allowCloudProvider:!t.allowCloudProvider};if(g.allowCloudProvider&&et.has(t.confidentialityLevel)){o.current=m,c(g);return}S(g)},r=(t,m)=>{S({...t,promptKey:m===""?null:m})},s=()=>{n&&S(n),c(null),o.current?.focus()},h=()=>{c(null),o.current?.focus()},T=se.flatMap(t=>me.filter(m=>!k.has(pe(t,m))).map(m=>pe(t,m)));return W("div",{"data-testid":"confidentiality-policy-board",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[W("div",{style:{marginBottom:"16px"},children:[$("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u6A5F\u5BC6\u533A\u5206\u5225 \u6A5F\u80FD\u30DD\u30EA\u30B7\u30FC"}),W("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u533A\u5206\u3054\u3068\u306B\u3001\u6A5F\u80FD\u3092\u52D5\u304B\u3057\u3066\u3088\u3044\u304B\u3001\u914D\u5099\u306E\u5916\u3078\u51FA\u3057\u3066\u3088\u3044\u304B\u3092\u6C7A\u3081\u307E\u3059\u3002",se.length," \u533A\u5206 \xD7 ",me.length," \u6A5F\u80FD\u3002"]})]}),T.length>0&&W("div",{"data-testid":"policy-missing-rows",style:{marginBottom:"12px",padding:"8px 12px",borderRadius:"6px",backgroundColor:"#fef2f2",color:"#b91c1c",fontSize:"12px"},children:["\u672A\u8A2D\u5B9A\u306E\u7D44\u307F\u5408\u308F\u305B\u304C ",T.length," \u4EF6\u3042\u308A\u307E\u3059 (",T.join(", "),")\u3002\u8A72\u5F53\u3059\u308B\u6587\u66F8\u306E\u51E6\u7406\u306F\u8A2D\u5B9A\u304C\u89E3\u6C7A\u3067\u304D\u305A\u5931\u6557\u3057\u307E\u3059\u3002"]}),W("table",{"data-testid":"policy-grid",style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[$("thead",{children:W("tr",{children:[$("th",{style:{textAlign:"left",padding:"6px 8px",color:"#475569",borderBottom:"1px solid #e2e8f0"},children:"\u6A5F\u80FD"}),se.map(t=>$("th",{"data-testid":`policy-column-${t}`,style:{textAlign:"left",padding:"6px 8px",color:"#475569",borderBottom:"1px solid #e2e8f0"},children:t},t))]})}),$("tbody",{children:me.map(t=>{let m=tt.has(t);return W("tr",{"data-testid":`policy-row-${t}`,children:[W("th",{scope:"row",style:{textAlign:"left",padding:"8px",fontWeight:600,color:"#1e293b",borderBottom:"1px solid #f1f5f9"},children:[$("code",{children:t}),!m&&$("span",{"data-testid":`policy-no-destination-${t}`,style:{display:"block",fontSize:"10px",color:"#64748b",fontWeight:400},children:"\u914D\u5099\u5185\u3067\u5B8C\u7D50"})]}),se.map(g=>{let v=k.get(pe(g,t));return v?W("td",{"data-testid":`policy-cell-${g}-${t}`,style:{padding:"8px",borderBottom:"1px solid #f1f5f9"},children:[$("button",{type:"button",role:"switch","aria-checked":v.isEnabled,"aria-label":`${g} \u306E ${t} \u306E\u5B9F\u884C\u53EF\u5426`,"data-testid":`policy-enabled-${g}-${t}`,"data-enabled":String(v.isEnabled),disabled:l||d,onClick:()=>y(v),style:{padding:"2px 8px",borderRadius:"12px",border:"none",backgroundColor:v.isEnabled?"#10b981":"#94a3b8",color:"#ffffff",cursor:l||d?"not-allowed":"pointer",fontSize:"11px",fontWeight:600},children:v.isEnabled?"\u5B9F\u884C":"\u505C\u6B62"}),m?$("button",{type:"button",role:"switch","aria-checked":v.allowCloudProvider,"aria-label":`${g} \u306E ${t} \u306E\u914D\u5099\u5916\u9001\u4FE1\u306E\u53EF\u5426`,"data-testid":`policy-cloud-${g}-${t}`,"data-enabled":String(v.allowCloudProvider),disabled:l||d,onClick:E=>w(v,E.currentTarget),style:{marginLeft:"6px",padding:"2px 8px",borderRadius:"12px",border:`1px solid ${v.allowCloudProvider?"#f59e0b":"#cbd5e1"}`,backgroundColor:v.allowCloudProvider?"#fffbeb":"#f8fafc",color:v.allowCloudProvider?"#b45309":"#475569",cursor:l||d?"not-allowed":"pointer",fontSize:"11px"},children:v.allowCloudProvider?"\u914D\u5099\u5916\u53EF":"\u914D\u5099\u5185\u306E\u307F"}):$("span",{"data-testid":`policy-cloud-unavailable-${g}-${t}`,style:{marginLeft:"6px",fontSize:"11px",color:"#94a3b8"},children:"\u9001\u4FE1\u306A\u3057"}),$("div",{style:{marginTop:"4px"},children:W("select",{"data-testid":`policy-prompt-${g}-${t}`,"aria-label":`${g} \u306E ${t} \u304C\u7528\u3044\u308B\u30D7\u30ED\u30F3\u30D7\u30C8\u884C`,value:v.promptKey??"",disabled:l||d,onChange:E=>r(v,E.target.value),style:{fontSize:"10px",maxWidth:"100%",color:"#475569"},children:[$("option",{value:"",children:"\u65E2\u5B9A\u306E\u884C"}),ot(a,v.promptKey).map(E=>$("option",{value:E,children:E},E))]})})]},g):$("td",{"data-testid":`policy-cell-${g}-${t}`,"data-missing":"true",style:{padding:"8px",color:"#b91c1c",borderBottom:"1px solid #f1f5f9"},children:"\u672A\u8A2D\u5B9A"},g)})]},t)})})]}),n&&$("div",{"data-testid":"policy-confirm-modal",role:"dialog","aria-modal":"true","aria-label":"\u914D\u5099\u5916\u9001\u4FE1\u306E\u78BA\u8A8D",style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(15, 23, 42, 0.45)"},children:W("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",padding:"20px",maxWidth:"420px"},children:[$("h3",{style:{margin:0,fontSize:"15px",color:"#b45309"},children:"\u914D\u5099\u306E\u5916\u3078\u9001\u4FE1\u3059\u308B\u3053\u3068\u3092\u8A31\u53EF\u3057\u307E\u3059\u304B"}),W("p",{style:{margin:"8px 0 16px 0",fontSize:"13px",color:"#334155"},children:[$("code",{children:n.confidentialityLevel})," \u306E\u6587\u66F8\u306E ",$("code",{children:n.capability})," \u304C\u3001\u914D\u5099\u306E\u5916\u306E\u30D7\u30ED\u30D0\u30A4\u30C0\u3078\u672C\u6587\u3092\u9001\u308C\u308B\u3088\u3046\u306B\u306A\u308A\u307E\u3059\u3002"]}),W("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[$("button",{ref:b,type:"button","data-testid":"policy-confirm-cancel",onClick:h,style:{padding:"6px 14px",borderRadius:"6px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:"\u53D6\u308A\u6D88\u3059"}),$("button",{ref:x,type:"button","data-testid":"policy-confirm-accept",onClick:s,style:{padding:"6px 14px",borderRadius:"6px",border:"none",backgroundColor:"#b45309",color:"#ffffff",cursor:"pointer"},children:"\u8A31\u53EF\u3059\u308B"})]})]})})]})}import{useEffect as rt,useRef as ve,useState as nt}from"react";import{jsx as q,jsxs as H}from"react/jsx-runtime";var it=["ENABLE_MERKLE_CITATION_PROOF","ENABLE_GRAPH_INDEXING","ENABLE_VECTOR_INDEXING","ENABLE_REALTIME_CDC_INGESTION"],at=new Set(it);function Ft({flags:e,onToggleFlag:a,isCriticalFlag:i=n=>at.has(n),isUpdating:d=!1,readOnly:l=!1}){let[n,c]=nt(null),o=ve(null),b=ve(null),x=ve(null);rt(()=>{if(!n)return;b.current?.focus();let r=s=>{if(s.key==="Escape"){c(null),o.current?.focus();return}s.key==="Tab"&&(s.shiftKey&&document.activeElement===b.current?(s.preventDefault(),x.current?.focus()):!s.shiftKey&&document.activeElement===x.current&&(s.preventDefault(),b.current?.focus()))};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[n]);let k=(r,s,h)=>{let T=!s;i(r)?(o.current=h,c({key:r,targetValue:T})):a&&a(r,T)},S=()=>{c(null),o.current?.focus()},y=()=>{n&&a&&a(n.key,n.targetValue),c(null),o.current?.focus()},w=Object.keys(e);return H("div",{"data-testid":"feature-flag-board",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[H("div",{style:{marginBottom:"16px"},children:[q("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u6A5F\u80FD\u30D5\u30E9\u30B0\u64CD\u4F5C\u30B9\u30A4\u30C3\u30C1\u30DC\u30FC\u30C9"}),H("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u5168 ",w.length," \u4EF6\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u72B6\u614B\u3002\u91CD\u8981\u30D5\u30E9\u30B0\u306E\u5207\u308A\u66FF\u3048\u306B\u306F 2 \u6BB5\u968E\u78BA\u8A8D\u304C\u5FC5\u8981\u3067\u3059\u3002"]})]}),q("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))",gap:"12px"},children:w.map(r=>{let s=!!e[r],h=i(r);return H("div",{"data-testid":`flag-card-${r}`,style:{border:`1px solid ${s?"#10b981":"#cbd5e1"}`,borderRadius:"6px",padding:"12px",backgroundColor:s?"#ecfdf5":"#f8fafc",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[H("div",{children:[H("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[q("code",{style:{fontSize:"12px",fontWeight:600,color:"#1e293b"},children:r}),h&&q("span",{"data-testid":`critical-badge-${r}`,style:{fontSize:"10px",padding:"1px 4px",borderRadius:"4px",backgroundColor:"#fef2f2",color:"#dc2626",fontWeight:600},children:"\u91CD\u8981"})]}),H("div",{style:{fontSize:"11px",color:"#64748b",marginTop:"4px"},children:["\u72B6\u614B: ",s?"\u6709\u52B9 (ENABLED)":"\u7121\u52B9 (DISABLED)"]})]}),q("button",{type:"button",role:"switch","aria-checked":s,"aria-label":`${r} \u30D5\u30E9\u30B0\u306E\u5207\u308A\u66FF\u3048`,"data-testid":`flag-switch-${r}`,"data-enabled":String(s),disabled:l||d,onClick:T=>k(r,s,T.currentTarget),style:{padding:"4px 12px",borderRadius:"16px",border:"none",backgroundColor:s?"#10b981":"#94a3b8",color:"#ffffff",cursor:l||d?"not-allowed":"pointer",fontSize:"12px",fontWeight:600},children:s?"ON":"OFF"})]},r)})}),n&&q("div",{role:"dialog","aria-modal":"true","aria-labelledby":"critical-flag-modal-title","aria-describedby":"critical-flag-modal-desc","data-testid":"critical-flag-confirm-modal",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:H("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",padding:"20px",maxWidth:"420px",width:"90%",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[q("h3",{id:"critical-flag-modal-title",style:{margin:"0 0 10px 0",color:"#dc2626",fontSize:"16px"},children:"\u26A0\uFE0F \u91CD\u8981\u6A5F\u80FD\u30D5\u30E9\u30B0\u306E\u5909\u66F4\u78BA\u8A8D"}),H("p",{id:"critical-flag-modal-desc",style:{fontSize:"13px",color:"#475569",lineHeight:1.5,margin:"0 0 16px 0"},children:["\u30D5\u30E9\u30B0 ",q("code",{children:n.key})," \u3092 ",q("strong",{children:n.targetValue?"\u6709\u52B9":"\u7121\u52B9"})," \u306B\u5207\u308A\u66FF\u3048\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059\u3002\u3053\u306E\u64CD\u4F5C\u306F\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u3084\u30C7\u30FC\u30BF\u6574\u5408\u6027\u306B\u76F4\u63A5\u5F71\u97FF\u3092\u53CA\u307C\u3059\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002"]}),H("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[q("button",{ref:b,type:"button","data-testid":"cancel-flag-toggle",onClick:S,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u30AD\u30E3\u30F3\u30BB\u30EB"}),q("button",{ref:x,type:"button","data-testid":"confirm-flag-toggle",onClick:y,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:"#dc2626",color:"#ffffff",cursor:"pointer",fontSize:"13px",fontWeight:600},children:"\u5909\u66F4\u3092\u5B9F\u884C\u3059\u308B"})]})]})})]})}import{useId as dt,useState as te}from"react";import{jsx as _,jsxs as M}from"react/jsx-runtime";var lt=[{field:"context_relevance",label:"\u6587\u8108\u9069\u5408\u5EA6"},{field:"groundedness",label:"\u6839\u62E0\u59A5\u5F53\u6027"},{field:"answer_relevance",label:"\u56DE\u7B54\u9069\u5408\u5EA6"},{field:"mean_answer_chars",label:"\u5E73\u5747\u56DE\u7B54\u6587\u5B57\u6570"},{field:"mean_latency_ms",label:"\u5E73\u5747\u5FDC\u7B54\u6642\u9593 (ms)"}];function _e(e){let a=e.filter(i=>i.key.trim()!=="").map(i=>[i.key.trim(),i.value]);return a.length===0?void 0:Object.fromEntries(a)}function st(e){let a=e.filter(i=>i.key.trim()!=="").map(i=>[i.key.trim(),i.value==="on"]);return a.length===0?void 0:Object.fromEntries(a)}function he(e,a){let i=Math.abs(e)>=100?e.toFixed(0):e.toFixed(3);return a&&e>=0?`+${i}`:i}function Se({title:e,hint:a,testId:i,rows:d,onChange:l,valueKind:n}){return M("div",{"data-testid":i,style:{marginBottom:"12px"},children:[_("h3",{style:{margin:"0 0 2px 0",fontSize:"12px",color:"#334155"},children:e}),_("p",{style:{margin:"0 0 6px 0",fontSize:"11px",color:"#64748b"},children:a}),d.map((c,o)=>M("div",{style:{display:"flex",gap:"6px",marginBottom:"4px"},children:[_("input",{type:"text","aria-label":`${e} \u306E\u9375 ${o+1}`,"data-testid":`${i}-key-${o}`,value:c.key,onChange:b=>l(d.map((x,k)=>k===o?{...x,key:b.target.value}:x)),style:{width:"220px",padding:"5px 7px",fontSize:"12px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),n==="flag"?M("select",{"aria-label":`${e} \u306E\u5024 ${o+1}`,"data-testid":`${i}-value-${o}`,value:c.value,onChange:b=>l(d.map((x,k)=>k===o?{...x,value:b.target.value}:x)),style:{padding:"5px 7px",fontSize:"12px",border:"1px solid #cbd5e1",borderRadius:"4px"},children:[_("option",{value:"on",children:"\u6709\u52B9"}),_("option",{value:"off",children:"\u7121\u52B9"})]}):_("input",{type:"text","aria-label":`${e} \u306E\u5024 ${o+1}`,"data-testid":`${i}-value-${o}`,value:c.value,onChange:b=>l(d.map((x,k)=>k===o?{...x,value:b.target.value}:x)),style:{flex:1,padding:"5px 7px",fontSize:"12px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),_("button",{type:"button","data-testid":`${i}-remove-${o}`,onClick:()=>l(d.filter((b,x)=>x!==o)),style:{padding:"4px 8px",fontSize:"12px",border:"1px solid #cbd5e1",borderRadius:"4px",backgroundColor:"#ffffff",cursor:"pointer"},children:"\u524A\u9664"})]},o)),_("button",{type:"button","data-testid":`${i}-add`,onClick:()=>l([...d,{key:"",value:n==="flag"?"on":""}]),style:{padding:"4px 10px",fontSize:"12px",border:"1px solid #cbd5e1",borderRadius:"4px",backgroundColor:"#ffffff",cursor:"pointer"},children:"\u884C\u3092\u8FFD\u52A0"})]})}function qt({onSimulate:e}){let a=dt(),[i,d]=te([]),[l,n]=te([]),[c,o]=te([]),[b,x]=te(""),[k,S]=te(!1),[y,w]=te(null);if(!e)return null;let r=_e(i),s=_e(l),h=st(c),T=b.split(",").map(v=>v.trim()).filter(v=>v!==""),t=r!==void 0||s!==void 0||h!==void 0,m=k||!t;return M("div",{"data-testid":"governance-dry-run-console",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[_("h2",{style:{margin:"0 0 4px 0",fontSize:"16px",color:"#1e293b"},children:"\u30AC\u30D0\u30CA\u30F3\u30B9 \u30C9\u30E9\u30A4\u30E9\u30F3"}),_("p",{style:{margin:"0 0 12px 0",fontSize:"13px",color:"#64748b"},children:"\u5019\u88DC\u306E\u4E0A\u66F8\u304D\u3092\u9069\u7528\u3057\u305F\u5834\u5408\u306E\u30B4\u30FC\u30EB\u30C7\u30F3\u30D9\u30F3\u30C1\u30DE\u30FC\u30AF\u306E\u6210\u7E3E\u3092\u3001\u4FDD\u5B58\u305B\u305A\u306B\u6E2C\u308A\u307E\u3059\u3002"}),_("div",{"data-testid":"dry-run-cost-notice",style:{marginBottom:"12px",border:"1px solid #f59e0b",borderRadius:"6px",padding:"10px",backgroundColor:"#fffbeb",fontSize:"12px",color:"#92400e"},children:"\u5B9F\u884C\u3059\u308B\u3068\u3001\u30B4\u30FC\u30EB\u30C7\u30F3\u30D9\u30F3\u30C1\u30DE\u30FC\u30AF\u306E\u5168\u8A2D\u554F\u304C\u5B9F\u969B\u306E\u30E2\u30C7\u30EB\u30D7\u30ED\u30D0\u30A4\u30C0\u3078\u9001\u3089\u308C\u307E\u3059\u3002\u8CBB\u7528\u3068\u5B9F\u884C\u6642\u9593\u304C\u767A\u751F\u3057\u3001\u9014\u4E2D\u3067\u53D6\u308A\u6D88\u3057\u3066\u3082\u9001\u4FE1\u6E08\u307F\u306E\u5206\u306F\u623B\u308A\u307E\u305B\u3093\u3002"}),_(Se,{title:"\u30D7\u30ED\u30F3\u30D7\u30C8\u306E\u4E0A\u66F8\u304D",hint:"\u30D7\u30ED\u30F3\u30D7\u30C8\u30AD\u30FC\u3068\u3001\u305D\u306E\u5019\u88DC\u672C\u6587\u3002",testId:"dry-run-prompt-overrides",rows:i,onChange:d,valueKind:"text"}),_(Se,{title:"\u30D1\u30E9\u30E1\u30FC\u30BF\u306E\u4E0A\u66F8\u304D",hint:"\u30D1\u30E9\u30E1\u30FC\u30BF\u30AD\u30FC\u3068\u5019\u88DC\u5024\u3002\u5024\u306F\u6587\u5B57\u5217\u3068\u3057\u3066\u9001\u3089\u308C\u307E\u3059\u3002",testId:"dry-run-parameter-overrides",rows:l,onChange:n,valueKind:"text"}),_(Se,{title:"\u6A5F\u80FD\u30D5\u30E9\u30B0\u306E\u4E0A\u66F8\u304D",hint:"\u30D5\u30E9\u30B0\u30AD\u30FC\u3068\u3001\u6709\u52B9\u30FB\u7121\u52B9\u306E\u3044\u305A\u308C\u304B\u3002",testId:"dry-run-flag-overrides",rows:c,onChange:o,valueKind:"flag"}),M("div",{style:{marginBottom:"12px"},children:[_("label",{htmlFor:a,style:{display:"block",fontSize:"12px",color:"#334155",marginBottom:"2px"},children:"\u5BFE\u8C61\u306E\u610F\u56F3\u7A2E\u5225 (\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3001\u672A\u5165\u529B\u306A\u3089\u5168\u4EF6)"}),_("input",{id:a,"data-testid":"dry-run-intent-types",type:"text",value:b,onChange:v=>x(v.target.value),style:{width:"100%",padding:"5px 7px",fontSize:"12px",border:"1px solid #cbd5e1",borderRadius:"4px"}})]}),M("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"12px"},children:[_("button",{type:"button","data-testid":"dry-run-submit",onClick:async()=>{S(!0),w(null);try{w(await e({...r?{promptOverrides:r}:{},...s?{parameterOverrides:s}:{},...h?{featureFlagOverrides:h}:{},...T.length>0?{intentTypes:T}:{}}))}finally{S(!1)}},disabled:m,style:{padding:"7px 14px",fontSize:"13px",borderRadius:"4px",border:"none",cursor:m?"not-allowed":"pointer",backgroundColor:m?"#cbd5e1":"#2563eb",color:"#ffffff"},children:k?"\u5B9F\u884C\u4E2D...":"\u30C9\u30E9\u30A4\u30E9\u30F3\u3092\u5B9F\u884C"}),!t&&_("span",{"data-testid":"dry-run-no-override-note",style:{fontSize:"12px",color:"#64748b"},children:"\u4E0A\u66F8\u304D\u304C 1 \u4EF6\u3082\u7121\u3044\u5B9F\u884C\u306F\u3001\u57FA\u6E96\u3092\u57FA\u6E96\u3068\u6BD4\u3079\u308B\u3060\u3051\u3067\u3059\u3002\u4E0A\u66F8\u304D\u3092 1 \u4EF6\u4EE5\u4E0A\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002"})]}),y?.ok===!1&&_("div",{"data-testid":"dry-run-failure",style:{border:"1px solid #f59e0b",borderRadius:"6px",padding:"10px",backgroundColor:"#fffbeb",fontSize:"13px",color:"#92400e"},children:y.reason}),y?.ok===!0&&M("div",{"data-testid":"dry-run-result",children:[M("p",{style:{margin:"0 0 8px 0",fontSize:"12px",color:"#334155"},children:["\u30B7\u30DF\u30E5\u30EC\u30FC\u30B7\u30E7\u30F3 ",_("span",{"data-testid":"dry-run-simulation-id",children:y.result.simulation_id})," / \u8A55\u4FA1\u8A2D\u554F ",_("span",{"data-testid":"dry-run-evaluated-count",children:y.result.evaluated_questions_count.toLocaleString()})," \u4EF6 / \u5B9F\u884C\u6642\u9593"," ",Math.round(y.result.execution_time_ms).toLocaleString()," ms"]}),M("table",{"data-testid":"dry-run-score-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"12px",marginBottom:"12px"},children:[_("thead",{children:M("tr",{children:[_("th",{style:{textAlign:"left",padding:"4px 6px",borderBottom:"1px solid #cbd5e1",color:"#334155"},children:"\u6307\u6A19"}),_("th",{style:{textAlign:"right",padding:"4px 6px",borderBottom:"1px solid #cbd5e1",color:"#334155"},children:"\u9069\u7528\u524D"}),_("th",{style:{textAlign:"right",padding:"4px 6px",borderBottom:"1px solid #cbd5e1",color:"#334155"},children:"\u9069\u7528\u5F8C"}),_("th",{style:{textAlign:"right",padding:"4px 6px",borderBottom:"1px solid #cbd5e1",color:"#334155"},children:"\u5DEE\u5206"})]})}),_("tbody",{children:lt.map(({field:v,label:E})=>M("tr",{"data-testid":`dry-run-score-${v}`,children:[_("td",{style:{padding:"4px 6px",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:E}),_("td",{style:{padding:"4px 6px",borderBottom:"1px solid #e2e8f0",color:"#475569",textAlign:"right"},children:he(y.result.before[v],!1)}),_("td",{style:{padding:"4px 6px",borderBottom:"1px solid #e2e8f0",color:"#475569",textAlign:"right"},children:he(y.result.after[v],!1)}),_("td",{"data-delta-direction":y.result.delta[v]>0?"up":y.result.delta[v]<0?"down":"flat",style:{padding:"4px 6px",borderBottom:"1px solid #e2e8f0",textAlign:"right",color:y.result.delta[v]<0?"#b91c1c":"#047857"},children:he(y.result.delta[v],!0)})]},v))})]}),y.result.regressions.length===0&&y.result.improvements.length===0?_("p",{"data-testid":"dry-run-no-flips",style:{margin:0,fontSize:"12px",color:"#64748b"},children:"\u5408\u5426\u304C\u53CD\u8EE2\u3057\u305F\u8A2D\u554F\u306F\u3042\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002"}):M("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[_(Re,{testId:"dry-run-regressions",title:"\u60AA\u5316 (\u5408\u683C \u2192 \u4E0D\u5408\u683C)",flips:y.result.regressions,tone:"#b91c1c"}),_(Re,{testId:"dry-run-improvements",title:"\u6539\u5584 (\u4E0D\u5408\u683C \u2192 \u5408\u683C)",flips:y.result.improvements,tone:"#047857"})]})]})]})}function Re({testId:e,title:a,flips:i,tone:d}){return M("div",{"data-testid":e,children:[M("h3",{style:{margin:"0 0 6px 0",fontSize:"12px",color:d},children:[a," (",i.length," \u4EF6)"]}),i.length===0?_("p",{style:{margin:0,fontSize:"12px",color:"#64748b"},children:"\u8A72\u5F53\u306A\u3057"}):_("ul",{style:{margin:0,paddingLeft:"18px",fontSize:"12px",color:"#475569"},children:i.map(l=>M("li",{"data-testid":`${e}-${l.case_id}`,children:[l.case_id," (",l.intent_type,"): ",l.before_passed?"\u5408\u683C":"\u4E0D\u5408\u683C"," \u2192 ",l.after_passed?"\u5408\u683C":"\u4E0D\u5408\u683C"]},l.case_id))})]})}import{useId as Ie,useState as re}from"react";import{useId as pt}from"react";import{Fragment as ct,jsx as F,jsxs as oe}from"react/jsx-runtime";function ze({page:e,isLoading:a=!1,failure:i=null,onChangePage:d,onSelectNode:l}){let n=pt(),c=e===null||e.pageSize<=0?0:e.pageSize,o=e===null||c===0?1:Math.max(1,Math.ceil(e.totalCount/c)),b=e===null?0:Math.min(Math.max(e.pageIndex,0),o-1),x=e===null||e.nodes.length===0?0:b*c+1,k=e===null||x===0?0:b*c+e.nodes.length;return oe("div",{"data-testid":"graph-node-index",style:{marginBottom:"20px",border:"1px solid #cbd5e1",borderRadius:"6px",padding:"12px",backgroundColor:"#f8fafc"},children:[F("h3",{style:{margin:"0 0 8px 0",fontSize:"13px",color:"#334155"},children:"\u30CE\u30FC\u30C9\u7D22\u5F15"}),i!==null?F("p",{"data-testid":"node-index-failure",style:{margin:0,fontSize:"12px",color:"#b45309"},children:i}):e===null?F("p",{"data-testid":"node-index-unselected",style:{margin:0,fontSize:"12px",color:"#64748b"},children:"\u30E9\u30D9\u30EB\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u30E9\u30D9\u30EB\u3092\u6301\u3064\u30CE\u30FC\u30C9\u3092\u5217\u6319\u3057\u307E\u3059\u3002"}):oe(ct,{children:[oe("p",{"data-testid":"node-index-range",id:n,"aria-live":"polite",style:{margin:"0 0 6px 0",fontSize:"11px",color:"#64748b"},children:[F("code",{children:e.label})," \u306E ",e.totalCount," \u4EF6\u4E2D ",x,"\u2013",k," \u4EF6\u76EE (",o," \u9801\u4E2D ",b+1," \u9801\u76EE)"]}),e.nodes.length===0?F("p",{"data-testid":"node-index-empty",style:{margin:0,fontSize:"12px",color:"#64748b"},children:e.totalCount===0?"\u3053\u306E\u30E9\u30D9\u30EB\u3092\u6301\u3064\u30CE\u30FC\u30C9\u306F\u3042\u308A\u307E\u305B\u3093\u3002":"\u3053\u306E\u9801\u306B\u306F\u884C\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):F("ul",{"data-testid":"node-index-list",style:{margin:0,paddingLeft:0,listStyle:"none"},children:e.nodes.map(S=>oe("li",{"data-testid":`node-index-item-${S.key}`,style:{borderBottom:"1px solid #e2e8f0",padding:"4px 0",fontSize:"12px"},children:[F("span",{style:{color:"#0f172a"},children:S.displayName===null?F("span",{"data-testid":`node-index-unnamed-${S.key}`,style:{color:"#64748b"},children:"(\u540D\u524D\u306A\u3057)"}):S.displayName}),oe("span",{style:{marginLeft:"6px",color:"#64748b",fontSize:"11px"},children:[F("code",{children:S.canonicalId??S.key})," / ",S.labels.join(", ")]}),l!==void 0&&S.canonicalId===null&&F("span",{"data-testid":`node-index-not-startable-${S.key}`,style:{marginLeft:"8px",color:"#64748b",fontSize:"11px"},children:"\u63A2\u7D22\u306E\u59CB\u70B9\u306B\u306F\u3067\u304D\u307E\u305B\u3093 (\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u3067\u306F\u3042\u308A\u307E\u305B\u3093)"}),l!==void 0&&S.canonicalId!==null&&F("button",{type:"button","data-testid":`node-index-start-${S.key}`,onClick:()=>l(S.canonicalId),style:{marginLeft:"8px",padding:"1px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"11px",cursor:"pointer"},children:"\u63A2\u7D22\u306E\u59CB\u70B9\u306B\u3059\u308B"})]},S.key))}),d!==void 0&&oe("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"8px"},children:[F("button",{type:"button","data-testid":"node-index-prev","aria-describedby":n,disabled:a||e.pageIndex===0,onClick:()=>d(e.pageIndex-1),style:{padding:"2px 10px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"11px"},children:"\u524D\u306E\u9801"}),F("button",{type:"button","data-testid":"node-index-next","aria-describedby":n,disabled:a||e.pageIndex+1>=o,onClick:()=>d(e.pageIndex+1),style:{padding:"2px 10px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"11px"},children:"\u6B21\u306E\u9801"})]})]})]})}var ut={size:640,nodeRadius:{min:10,max:34},padding:18,bundleStrength:.35,selfLoopExtent:(1+Math.sqrt(5))/2},ft=3;function U(e){let a=10**ft;return Object.is(Math.round(e*a)/a,-0)?0:Math.round(e*a)/a}function Te(e,a,i,d=ut){let l=Number.isInteger(i)&&i>0?i:e.length,n=e.slice(0,l),c=e.slice(l).map(r=>r.label),o=d.size/2,b=o-d.nodeRadius.max-d.padding,x=n.reduce((r,s)=>Math.max(r,s.count),0),k=n.map((r,s)=>{let h=-Math.PI/2+2*Math.PI*s/n.length,T=x===0?0:Math.sqrt(r.count/x);return{...r,angle:h,x:U(o+b*Math.cos(h)),y:U(o+b*Math.sin(h)),radius:U(d.nodeRadius.min+(d.nodeRadius.max-d.nodeRadius.min)*T)}}),S=new Map(k.map(r=>[r.label,r])),y=[],w=0;for(let r of a){let s=S.get(r.from),h=S.get(r.to);if(s===void 0||h===void 0){w+=1;continue}y.push({...r,isSelfLoop:s.label===h.label,path:s.label===h.label?xt(s,o,d):bt(s,h,o,d)})}return{size:d.size,center:o,nodes:k,edges:y,omittedLabels:c,omittedEdgeCount:w}}function bt(e,a,i,d){let l=(e.x+a.x)/2,n=(e.y+a.y)/2,c=i+(l-i)*(1-d.bundleStrength),o=i+(n-i)*(1-d.bundleStrength);return`M ${e.x} ${e.y} Q ${U(c)} ${U(o)} ${a.x} ${a.y}`}function xt(e,a,i){let d=Math.atan2(e.y-a,e.x-a),l=Math.PI/6,n=e.radius*i.selfLoopExtent,c={x:e.x+e.radius*Math.cos(d-l),y:e.y+e.radius*Math.sin(d-l)},o={x:e.x+e.radius*Math.cos(d+l),y:e.y+e.radius*Math.sin(d+l)},b={x:e.x+(e.radius+n)*Math.cos(d),y:e.y+(e.radius+n)*Math.sin(d)};return`M ${U(c.x)} ${U(c.y)} Q ${U(b.x)} ${U(b.y)} ${U(o.x)} ${U(o.y)}`}import{Fragment as gt,jsx as B,jsxs as j}from"react/jsx-runtime";var ce={min:1,max:4};function Ee({nodes:e,edges:a,maxLabels:i,probeFailure:d,onSelectLabel:l}){let n=Te(e,a,i),c=n.edges.reduce((o,b)=>Math.max(o,b.count),0);return j("div",{"data-testid":"graph-topology-map",style:{marginBottom:"20px",border:"1px solid #cbd5e1",borderRadius:"6px",padding:"12px",backgroundColor:"#f8fafc"},children:[B("h3",{style:{margin:"0 0 8px 0",fontSize:"13px",color:"#334155"},children:"\u5168\u4F53\u30C8\u30DD\u30ED\u30B8 (\u30E9\u30D9\u30EB\u3068\u95A2\u4FC2)"}),d!==null?B("p",{"data-testid":"topology-probe-failure",style:{margin:0,fontSize:"12px",color:"#b45309"},children:d}):n.nodes.length===0?B("p",{"data-testid":"topology-empty",style:{margin:0,fontSize:"12px",color:"#64748b"},children:"\u6295\u5F71\u3055\u308C\u305F\u30CE\u30FC\u30C9\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):j(gt,{children:[j("svg",{"data-testid":"topology-svg",viewBox:`0 0 ${n.size} ${n.size}`,"aria-hidden":"true",focusable:"false",style:{width:"100%",maxWidth:`${n.size}px`,height:"auto"},children:[n.edges.map(o=>B("path",{"data-testid":`topology-edge-${o.from}-${o.type}-${o.to}`,"data-self-loop":String(o.isSelfLoop),d:o.path,fill:"none",stroke:"#94a3b8",strokeWidth:c===0?ce.min:ce.min+(ce.max-ce.min)*Math.sqrt(o.count/c),strokeOpacity:.55},`${o.from}->${o.type}->${o.to}`)),n.nodes.map(o=>j("g",{"data-testid":`topology-node-${o.label}`,"data-count":String(o.count),children:[B("circle",{cx:o.x,cy:o.y,r:o.radius,fill:"#e0e7ff",stroke:"#4338ca",strokeWidth:1.5}),B("text",{x:o.x,y:o.y+o.radius+12,textAnchor:"middle",fontSize:"11",fill:"#334155",children:o.label})]},o.label))]}),n.omittedLabels.length>0&&j("p",{"data-testid":"topology-omitted",style:{margin:"6px 0 0 0",fontSize:"11px",color:"#b45309"},children:["\u5186\u5468\u304C\u8AAD\u3081\u306A\u304F\u306A\u308B\u305F\u3081 ",n.omittedLabels.length," \u30E9\u30D9\u30EB\u3092\u56F3\u304B\u3089\u5916\u3057\u307E\u3057\u305F: ",n.omittedLabels.join(", ")]}),n.omittedEdgeCount>0&&j("p",{"data-testid":"topology-omitted-edges",style:{margin:"2px 0 0 0",fontSize:"11px",color:"#b45309"},children:["\u7AEF\u70B9\u304C\u56F3\u306B\u7121\u3044\u305F\u3081 ",n.omittedEdgeCount," \u672C\u306E\u95A2\u4FC2\u3092\u63CF\u3044\u3066\u3044\u307E\u305B\u3093\u3002"]}),j("table",{"data-testid":"topology-adjacency","aria-label":"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u5168\u4F53\u30C8\u30DD\u30ED\u30B8",style:{width:"100%",borderCollapse:"collapse",fontSize:"11px",marginTop:"8px"},children:[B("caption",{style:{captionSide:"top",textAlign:"left",color:"#64748b",paddingBottom:"4px"},children:"\u30E9\u30D9\u30EB\u3068\u3001\u305D\u306E\u9593\u306E\u95A2\u4FC2"}),B("thead",{children:j("tr",{children:[B("th",{scope:"col",style:{textAlign:"left",borderBottom:"1px solid #e2e8f0",padding:"3px"},children:"\u59CB\u70B9"}),B("th",{scope:"col",style:{textAlign:"left",borderBottom:"1px solid #e2e8f0",padding:"3px"},children:"\u95A2\u4FC2"}),B("th",{scope:"col",style:{textAlign:"left",borderBottom:"1px solid #e2e8f0",padding:"3px"},children:"\u7D42\u70B9"}),B("th",{scope:"col",style:{textAlign:"right",borderBottom:"1px solid #e2e8f0",padding:"3px"},children:"\u672C\u6570"})]})}),j("tbody",{children:[n.nodes.map(o=>j("tr",{"data-testid":`topology-row-${o.label}`,children:[B("th",{scope:"row",style:{textAlign:"left",padding:"3px",fontWeight:600},children:l===void 0?o.label:B("button",{type:"button","data-testid":`topology-select-${o.label}`,onClick:()=>l(o.label),style:{padding:"1px 6px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"11px",cursor:"pointer"},children:o.label})}),j("td",{colSpan:2,style:{padding:"3px",color:"#64748b"},children:["\u30CE\u30FC\u30C9 ",o.count," \u4EF6"]}),B("td",{style:{padding:"3px",textAlign:"right",color:"#64748b"}})]},`node:${o.label}`)),n.edges.map(o=>j("tr",{"data-testid":`topology-adjacency-${o.from}-${o.type}-${o.to}`,children:[B("td",{style:{padding:"3px"},children:o.from}),B("td",{style:{padding:"3px"},children:B("code",{children:o.type})}),B("td",{style:{padding:"3px"},children:o.to}),B("td",{style:{padding:"3px",textAlign:"right"},children:o.count})]},`${o.from}->${o.type}->${o.to}`))]})]})]})]})}import{Fragment as Ct,jsx as f,jsxs as I}from"react/jsx-runtime";var yt="Domain_";function mt(e,a,i){let d=new Date(a).getTime(),l=new Date(i).getTime();if(Number.isNaN(d)||Number.isNaN(l)||l<=d)return a;let n=d+(l-d)*(e/100);return new Date(n).toISOString().split("T")[0]}function vt({validTimeRange:e,onTimeTravelChange:a}){let[i,d]=re(e.current_simulated_time);return I("div",{"data-testid":"bitemporal-time-slider",style:{border:"1px solid #93c5fd",borderRadius:"6px",padding:"12px",backgroundColor:"#eff6ff",marginBottom:"20px"},children:[I("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[f("h3",{style:{margin:0,fontSize:"14px",color:"#1e40af"},children:"\u30D0\u30A4\u30C6\u30F3\u30DD\u30E9\u30EB\u30FB\u30BF\u30A4\u30E0\u30C8\u30E9\u30D9\u30EB\u30B7\u30DF\u30E5\u30EC\u30FC\u30B7\u30E7\u30F3"}),I("span",{"data-testid":"simulated-time-display",style:{fontWeight:600,fontSize:"13px",color:"#1d4ed8"},children:["\u30B7\u30DF\u30E5\u30EC\u30FC\u30B7\u30E7\u30F3\u6642\u70B9: ",i]})]}),f("input",{type:"range","data-testid":"time-travel-slider-input","aria-label":"\u6709\u52B9\u6642\u70B9\u30BF\u30A4\u30E0\u30C8\u30E9\u30D9\u30EB\u30B9\u30E9\u30A4\u30C0\u30FC",min:"0",max:"100",defaultValue:"50",onChange:n=>{let c=Number.parseFloat(n.target.value),o=mt(c,e.valid_from,e.valid_until);d(o),a?.(o)},style:{width:"100%",cursor:"pointer"}}),I("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"11px",color:"#64748b",marginTop:"4px"},children:[I("span",{children:["\u904E\u53BB (\u5EC3\u6B62\u898F\u7A0B):"," ",f("strong",{"data-temporal-state":"superseded",style:{color:"#ef4444"},children:"\u8D64"})]}),I("span",{children:["\u73FE\u5728\u6709\u52B9 (Active):"," ",f("strong",{"data-temporal-state":"active",style:{color:"#10b981"},children:"\u7DD1"})]}),I("span",{children:["\u672A\u6765\u6539\u5B9A\u4E88\u5B9A (Pending):"," ",f("strong",{"data-temporal-state":"pending",style:{color:"#3b82f6"},children:"\u9752"})]})]})]})}function we(e){return e===null?"\u672A\u6E2C\u5B9A":e.toLocaleString()}var ue=1,fe=10;function ht(e){return e===void 0?"":typeof e=="string"?e:JSON.stringify(e)}function Pe(e){let a=[];for(let i of e)for(let d of Object.keys(i))a.includes(d)||a.push(d);return a}function St({relationshipTypes:e,onTraverse:a,startNodeId:i,onStartNodeIdChange:d}){let l=Ie(),n=Ie(),[c,o]=re([]),[b,x]=re(""),[k,S]=re(!1),[y,w]=re(null),r=i.trim(),s=b.trim()===""?void 0:Number(b),h=s!==void 0&&(!Number.isInteger(s)||s<ue||s>fe),T=k||r===""||h,t=g=>{o(v=>v.includes(g)?v.filter(E=>E!==g):[...v,g])};return I("div",{"data-testid":"kg-traversal-panel",style:{marginBottom:"20px",border:"1px solid #cbd5e1",borderRadius:"6px",padding:"12px",backgroundColor:"#f8fafc"},children:[f("h3",{style:{margin:"0 0 8px 0",fontSize:"13px",color:"#334155"},children:"\u95A2\u4FC2\u306E\u8FBF\u308A (\u30B0\u30E9\u30D5\u63A2\u7D22)"}),I("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px",alignItems:"flex-end",marginBottom:"10px"},children:[I("label",{htmlFor:l,style:{display:"flex",flexDirection:"column",gap:"4px",fontSize:"12px",color:"#475569"},children:["\u8D77\u70B9\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u306E\u6B63\u6E96 ID",f("input",{id:l,"data-testid":"kg-traversal-start-input",type:"text",value:i,onChange:g=>d(g.target.value),placeholder:"canonicalId",style:{width:"280px",padding:"6px 8px",fontSize:"13px",border:"1px solid #cbd5e1",borderRadius:"4px"}})]}),I("label",{htmlFor:n,style:{display:"flex",flexDirection:"column",gap:"4px",fontSize:"12px",color:"#475569"},children:["\u6DF1\u3055 (",ue,"-",fe,"\u3001\u672A\u5165\u529B\u53EF)",f("input",{id:n,"data-testid":"kg-traversal-hops-input",type:"number",min:ue,max:fe,value:b,onChange:g=>x(g.target.value),style:{width:"120px",padding:"6px 8px",fontSize:"13px",border:`1px solid ${h?"#dc2626":"#cbd5e1"}`,borderRadius:"4px"}})]}),f("button",{type:"button","data-testid":"kg-traversal-submit",onClick:async()=>{S(!0),w(null);try{w(await a({startNodeId:r,...c.length>0?{edgeTypes:c}:{},...s===void 0?{}:{maxHops:s}}))}finally{S(!1)}},disabled:T,style:{padding:"7px 14px",fontSize:"13px",borderRadius:"4px",border:"none",cursor:T?"not-allowed":"pointer",backgroundColor:T?"#cbd5e1":"#2563eb",color:"#ffffff"},children:k?"\u63A2\u7D22\u4E2D...":"\u8FBF\u308B"})]}),h&&I("p",{"data-testid":"kg-traversal-hops-error",style:{margin:"0 0 8px 0",fontSize:"12px",color:"#b91c1c"},children:["\u6DF1\u3055\u306F ",ue," \u304B\u3089 ",fe," \u307E\u3067\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002"]}),e.length>0?f("div",{"data-testid":"kg-traversal-edge-types",style:{display:"flex",flexWrap:"wrap",gap:"8px",marginBottom:"8px"},children:e.map(g=>I("label",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",color:"#475569"},children:[f("input",{type:"checkbox","data-testid":`kg-traversal-edge-${g.type}`,checked:c.includes(g.type),onChange:()=>t(g.type)}),g.type]},g.type))}):f("p",{"data-testid":"kg-traversal-no-edge-types",style:{margin:"0 0 8px 0",fontSize:"12px",color:"#64748b"},children:"\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u306E\u30B0\u30E9\u30D5\u306B\u73FE\u5B58\u3059\u308B\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u578B\u3092\u6E2C\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u8FBF\u308B\u578B\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002\u578B\u3092\u7701\u7565\u3057\u305F\u63A2\u7D22\u306F\u3001\u5B9F\u884C\u5074\u306E\u65E2\u5B9A\u306B\u5F93\u3044\u307E\u3059\u3002"}),f("p",{style:{margin:"0 0 8px 0",fontSize:"12px",color:"#64748b"},children:"\u6307\u5B9A\u3057\u305F\u6DF1\u3055\u306F\u3001\u914D\u5099\u306E\u4E0A\u9650 (\u30B7\u30B9\u30C6\u30E0\u30D1\u30E9\u30E1\u30FC\u30BF GRAPH_MAX_HOPS) \u307E\u3067\u306B\u5207\u308A\u4E0B\u3052\u3089\u308C\u307E\u3059\u3002\u3057\u305F\u304C\u3063\u3066\u7D50\u679C\u306E\u6DF1\u3055\u306F\u3001\u6307\u5B9A\u5024\u3088\u308A\u6D45\u3044\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002"}),y?.ok===!1&&f("div",{"data-testid":"kg-traversal-failure",style:{border:"1px solid #f59e0b",borderRadius:"6px",padding:"10px",backgroundColor:"#fffbeb",fontSize:"13px",color:"#92400e"},children:y.reason}),y?.ok===!0&&I("div",{"data-testid":"kg-traversal-results",children:[I("p",{style:{margin:"0 0 6px 0",fontSize:"12px",color:"#334155"},children:[f("span",{"data-testid":"kg-traversal-count",children:y.count.toLocaleString()})," \u4EF6"]}),y.results.length===0?f("p",{"data-testid":"kg-traversal-empty",style:{margin:0,fontSize:"12px",color:"#64748b"},children:"\u8D77\u70B9\u304B\u3089\u8FBF\u308C\u308B\u95A2\u4FC2\u306F\u3042\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002"}):I("table",{"data-testid":"kg-traversal-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[f("thead",{children:f("tr",{children:Pe(y.results).map(g=>f("th",{scope:"col",style:{textAlign:"left",padding:"4px 6px",borderBottom:"1px solid #cbd5e1",color:"#334155"},children:g},g))})}),f("tbody",{children:y.results.map((g,v)=>f("tr",{"data-testid":`kg-traversal-row-${v}`,children:Pe(y.results).map(E=>f("td",{style:{padding:"4px 6px",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:ht(g[E])},E))},v))})]})]})]})}function no({schema:e,tenantId:a,unresolvedEntities:i=[],validTimeRange:d,onTimeTravelChange:l,onResolveEntity:n,isResolving:c=!1,onTraverse:o,topologyMaxLabels:b,nodeIndexPage:x=null,nodeIndexFailure:k=null,isNodeIndexLoading:S=!1,onBrowseLabel:y}){let[w,r]=re(""),s=e.probe_failure===null,h=s?e.node_labels.reduce((t,m)=>t+m.count,0):null,T=s?e.relationship_types.reduce((t,m)=>t+m.count,0):null;return I("div",{"data-testid":"knowledge-graph-explorer",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[f("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:I("div",{children:[f("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"Neo4j \u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u63A2\u7D22"}),I("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u30C6\u30CA\u30F3\u30C8:"," ",f("span",{"data-testid":"kg-tenant-id",style:{fontWeight:600},children:a})," ","| \u7DCF\u30E9\u30D9\u30EB\u4ED8\u4E0E\u6570: ",we(h)," | \u7DCF\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u6570: ",we(T)]}),f("p",{"data-testid":"kg-count-basis",style:{margin:"2px 0 0 0",fontSize:"11px",color:"#94a3b8"},children:"\u30E9\u30D9\u30EB\u4ED8\u4E0E\u6570\u306F\u30CE\u30FC\u30C9\u6570\u3068\u7570\u306A\u308A\u307E\u3059 (\u8907\u6570\u30E9\u30D9\u30EB\u3092\u5E2F\u3073\u308B\u30CE\u30FC\u30C9\u306F\u30E9\u30D9\u30EB\u306E\u6570\u3060\u3051\u6570\u3048\u3089\u308C\u307E\u3059)\u3002"})]})}),e.probe_failure!==null&&f("div",{"data-testid":"kg-probe-failure",style:{marginBottom:"16px",border:"1px solid #f59e0b",borderRadius:"6px",padding:"10px",backgroundColor:"#fffbeb",fontSize:"13px",color:"#92400e"},children:e.probe_failure}),I("div",{"data-testid":"kg-schema-stats",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px",marginBottom:"20px"},children:[I("div",{style:{border:"1px solid #cbd5e1",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[f("h3",{style:{margin:"0 0 8px 0",fontSize:"13px",color:"#334155"},children:"\u30CE\u30FC\u30C9\u30E9\u30D9\u30EB\u5185\u8A33"}),f("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:e.node_labels.map(t=>I("span",{"data-testid":`node-label-stat-${t.label}`,style:{fontSize:"12px",padding:"2px 8px",borderRadius:"12px",backgroundColor:"#e0e7ff",color:"#3730a3",fontWeight:500},children:[":",t.label," (",t.count,")"]},t.label))})]}),I("div",{style:{border:"1px solid #cbd5e1",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[f("h3",{style:{margin:"0 0 8px 0",fontSize:"13px",color:"#334155"},children:"\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u5185\u8A33"}),f("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:e.relationship_types.map(t=>I("span",{"data-testid":`rel-type-stat-${t.type}`,style:{fontSize:"12px",padding:"2px 8px",borderRadius:"12px",backgroundColor:"#fef3c7",color:"#92400e",fontWeight:500},children:[":",t.type," (",t.count,")"]},t.type))})]})]}),f(Ee,{nodes:e.node_labels.filter(t=>!t.label.startsWith(yt)).map(t=>({label:t.label,count:t.count})),edges:e.adjacency,maxLabels:b,probeFailure:e.probe_failure,onSelectLabel:y===void 0?void 0:t=>y(t,0)}),y&&f(ze,{page:x,failure:k,isLoading:S,onChangePage:x===null?void 0:t=>y(x.label,t),onSelectNode:r}),o&&f(St,{relationshipTypes:e.relationship_types,onTraverse:o,startNodeId:w,onStartNodeIdChange:r}),d&&f(vt,{validTimeRange:d,onTimeTravelChange:l}),I("div",{"data-testid":"unresolved-entities-section",children:[I("h3",{style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["HITL \u672A\u89E3\u6C7A\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u627F\u8A8D\u30AD\u30E5\u30FC (",i.length," \u4EF6)"]}),i.length===0?f("p",{"data-testid":"no-unresolved-entities",style:{margin:0,fontSize:"13px",color:"#64748b"},children:"\u73FE\u5728\u3001\u672A\u89E3\u6C7A\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u5019\u88DC\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):f("div",{style:{overflowX:"auto"},children:I("table",{"data-testid":"unresolved-entities-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[f("thead",{children:I("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[f("th",{scope:"col",style:{padding:"6px 8px"},children:"\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u540D"}),f("th",{scope:"col",style:{padding:"6px 8px"},children:"\u30AB\u30C6\u30B4\u30EA"}),f("th",{scope:"col",style:{padding:"6px 8px"},children:"\u51FA\u73FE\u6570"}),f("th",{scope:"col",style:{padding:"6px 8px"},children:"\u5171\u8D77\u6570"}),f("th",{scope:"col",style:{padding:"6px 8px"},children:"\u63A8\u5968"}),f("th",{scope:"col",style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),f("tbody",{children:i.map(t=>I("tr",{"data-testid":`entity-row-${t.id}`,style:{borderBottom:"1px solid #f1f5f9"},children:[f("td",{style:{padding:"8px",fontWeight:600},children:t.name}),f("td",{style:{padding:"8px",color:"#475569"},children:t.category}),f("td",{style:{padding:"8px"},children:t.occurrences}),f("td",{style:{padding:"8px"},children:t.co_occurrences}),f("td",{style:{padding:"8px"},children:f("span",{style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:t.suggested_action==="promote"?"#d1fae5":"#e0e7ff",color:t.suggested_action==="promote"?"#065f46":"#3730a3"},children:t.suggested_action==="promote"?"\u6607\u683C\u63A8\u5968":"\u7D71\u5408\u63A8\u5968"})}),f("td",{style:{padding:"8px",textAlign:"right"},children:f("div",{style:{display:"flex",gap:"6px",justifyContent:"flex-end"},children:n&&I(Ct,{children:[f("button",{type:"button","data-testid":`merge-entity-${t.id}`,"aria-label":`${t.name} \u3092\u65E2\u5B58\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u306B\u7D71\u5408`,disabled:c,onClick:()=>n(t.id,"merge"),style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:c?"not-allowed":"pointer",fontSize:"12px"},children:"\u7D71\u5408"}),f("button",{type:"button","data-testid":`promote-entity-${t.id}`,"aria-label":`${t.name} \u3092\u65B0\u6982\u5FF5\u3068\u3057\u3066\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u6607\u683C`,disabled:c,onClick:()=>n(t.id,"promote"),style:{padding:"3px 8px",borderRadius:"4px",border:"none",backgroundColor:"#10b981",color:"#ffffff",cursor:c?"not-allowed":"pointer",fontSize:"12px",fontWeight:500},children:"\u6607\u683C"})]})})})]},t.id))})]})})]})]})}import{useId as kt,useMemo as Ae,useState as Z}from"react";import{jsx as z,jsxs as L}from"react/jsx-runtime";var $e=[{key:"summary_entities",name:"\u6C4E\u7528\u6587\u66F8\u8981\u7D04 & \u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u62BD\u51FA",description:"\u6587\u66F8\u306E\u30BF\u30A4\u30C8\u30EB\u3001\u8981\u7D04\u6587\u3001\u4E3B\u8981\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u3001\u30BF\u30B0\u3092\u62BD\u51FA\u3059\u308B\u6A19\u6E96\u30B9\u30AD\u30FC\u30DE",schema:{type:"object",properties:{title:{type:"string",description:"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u6B63\u898F\u5316\u30BF\u30A4\u30C8\u30EB"},summary:{type:"string",description:"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u5168\u4F53\u306E\u8981\u7D04"},key_entities:{type:"array",items:{type:"string"},description:"\u62BD\u51FA\u3055\u308C\u305F\u91CD\u8981\u56FA\u6709\u8868\u73FE\u30FB\u7D44\u7E54\u30FB\u4EBA\u7269\u30FB\u88FD\u54C1\u540D"},tags:{type:"array",items:{type:"string"},description:"\u5206\u985E\u30BF\u30B0\u4E00\u89A7"}},required:["title","summary","key_entities"]}},{key:"daily_report",name:"\u696D\u52D9\u65E5\u5831\u69CB\u9020\u5316\u62BD\u51FA",description:"\u696D\u52D9\u5B9F\u7E3E\u3001\u8AB2\u984C\u30FB\u6DF1\u523B\u5EA6\u30FB\u5BFE\u7B56\u3001\u7FCC\u65E5\u884C\u52D5\u4E88\u5B9A\u3092\u69CB\u9020\u5316\u62BD\u51FA\u3059\u308B\u30B9\u30AD\u30FC\u30DE",schema:{type:"object",properties:{report_date:{type:"string",description:"\u65E5\u5831\u5BFE\u8C61\u65E5 (YYYY-MM-DD)"},achievements:{type:"array",items:{type:"string"},description:"\u5F53\u65E5\u306E\u696D\u52D9\u5B9F\u7E3E\u30FB\u9032\u6357"},issues:{type:"array",items:{type:"object",properties:{issue:{type:"string",description:"\u8AB2\u984C\u30FB\u554F\u984C\u70B9"},severity:{type:"string",enum:["LOW","MEDIUM","HIGH","CRITICAL"],description:"\u6DF1\u523B\u5EA6"},countermeasure:{type:"string",description:"\u5BFE\u5FDC\u65B9\u91DD\u30FB\u5BFE\u7B56"}},required:["issue","severity"]},description:"\u8AB2\u984C\u304A\u3088\u3073\u5BFE\u5FDC\u7B56"},next_day_plans:{type:"array",items:{type:"string"},description:"\u7FCC\u65E5\u306E\u884C\u52D5\u4E88\u5B9A"}},required:["achievements","issues","next_day_plans"]}},{key:"email_thread",name:"\u30E1\u30FC\u30EB\u30B9\u30EC\u30C3\u30C9\u8981\u7D04 & \u6C7A\u5B9A\u4E8B\u9805",description:"\u30B9\u30EC\u30C3\u30C9\u8981\u7D04\u3001\u5408\u610F\u4E8B\u9805\u3001\u62C5\u5F53\u8005\u4ED8\u304D\u30A2\u30AF\u30B7\u30E7\u30F3\u30A2\u30A4\u30C6\u30E0\u3001\u672A\u6C7A\u4E8B\u9805\u306E\u30B9\u30AD\u30FC\u30DE",schema:{type:"object",properties:{thread_summary:{type:"string",description:"\u30B9\u30EC\u30C3\u30C9\u5168\u4F53\u306E\u6587\u8108\u30FB\u7D4C\u7DEF\u8981\u7D04"},decisions:{type:"array",items:{type:"string"},description:"\u30B9\u30EC\u30C3\u30C9\u5185\u3067\u5408\u610F\u30FB\u6C7A\u5B9A\u3055\u308C\u305F\u4E8B\u9805"},action_items:{type:"array",items:{type:"object",properties:{task:{type:"string",description:"\u30BF\u30B9\u30AF\u5185\u5BB9"},assignee:{type:"string",description:"\u62C5\u5F53\u8005"},deadline:{type:"string",description:"\u671F\u65E5 (YYYY-MM-DD \u307E\u305F\u306F\u672A\u5B9A)"}},required:["task"]},description:"\u30A2\u30AF\u30B7\u30E7\u30F3\u30A2\u30A4\u30C6\u30E0\u4E00\u89A7"},open_questions:{type:"array",items:{type:"string"},description:"\u672A\u89E3\u6C7A\u306E\u8CEA\u554F\u30FB\u78BA\u8A8D\u5F85\u3061\u4E8B\u9805"}},required:["thread_summary","decisions","action_items"]}},{key:"legal_terms",name:"\u5951\u7D04\u66F8\u30FB\u6CD5\u52D9\u6761\u9805\u62BD\u51FA",description:"\u5951\u7D04\u4EF6\u540D\u3001\u5F53\u4E8B\u8005\u3001\u767A\u52B9\u30FB\u7D42\u4E86\u65E5\u3001\u5F53\u4E8B\u8005\u5225\u7FA9\u52D9\u6761\u9805\u306E\u6CD5\u52D9\u62BD\u51FA\u30B9\u30AD\u30FC\u30DE",schema:{type:"object",properties:{contract_title:{type:"string",description:"\u5951\u7D04\u4EF6\u540D"},effective_date:{type:"string",description:"\u767A\u52B9\u65E5"},expiration_date:{type:"string",description:"\u7D42\u4E86\u65E5\u30FB\u6E80\u4E86\u65E5"},parties:{type:"array",items:{type:"string"},description:"\u5951\u7D04\u5F53\u4E8B\u8005\u4E00\u89A7"},obligations:{type:"array",items:{type:"object",properties:{clause:{type:"string",description:"\u6761\u9805\u540D\u307E\u305F\u306F\u756A\u53F7"},party:{type:"string",description:"\u7FA9\u52D9\u3092\u8CA0\u3046\u5F53\u4E8B\u8005"},obligation_text:{type:"string",description:"\u7FA9\u52D9\u5185\u5BB9\u306E\u8A73\u7D30"}},required:["clause","obligation_text"]},description:"\u5F53\u4E8B\u8005\u7FA9\u52D9\u4E00\u89A7"}},required:["contract_title","parties","obligations"]}},{key:"citation_proof",name:"\u5F15\u7528\u691C\u8A3C\u30FB\u53CD\u8A3C\u30B9\u30B3\u30A2",description:"\u5168\u4F53\u63A5\u5730\u5EA6\u30B9\u30B3\u30A2\u3001\u6839\u62E0\u30C1\u30E3\u30F3\u30AF\u4ED8\u304D\u80AF\u5B9A\u4E3B\u5F35\u3001\u53CD\u8A3C\u30FB\u672A\u63A5\u5730\u4E3B\u5F35\u306E\u30B9\u30AD\u30FC\u30DE",schema:{type:"object",properties:{overall_groundedness:{type:"number",minimum:0,maximum:1,description:"\u8A3C\u62E0\u63A5\u5730\u30B9\u30B3\u30A2 (0-1)"},supported_claims:{type:"array",items:{type:"object",properties:{claim:{type:"string",description:"\u4E3B\u5F35\u6587"},chunk_id:{type:"string",description:"\u6839\u62E0\u30C1\u30E3\u30F3\u30AF UID"},confidence:{type:"number",description:"\u78BA\u4FE1\u5EA6"}},required:["claim","chunk_id"]}},unsupported_claims:{type:"array",items:{type:"string"},description:"\u6839\u62E0\u4E0D\u5341\u5206\u307E\u305F\u306F\u53CD\u8A3C\u3055\u308C\u305F\u4E3B\u5F35\u6587"}},required:["overall_groundedness","supported_claims"]}}],Be=0,Ne=2,Le=1;function _t(e){try{let a=new URL(e);return a.protocol==="http:"||a.protocol==="https:"}catch{return!1}}function Oe(e){return e?typeof e=="string"?e:JSON.stringify(e,null,2):""}function so({templates:e,onSaveTemplate:a,isSaving:i=!1}){let d=kt(),l=e[0],[n,c]=Z(l?l.template_key:""),o=e.find(u=>u.template_key===n)??l,[b,x]=Z(o?o.template_text:""),[k,S]=Z(o?o.model_name:""),[y,w]=Z(o?o.temperature:0),[r,s]=Z(o?o.max_output_tokens:0),[h,T]=Z(Oe(o?.response_schema)),[t,m]=Z(o?.endpoint_base_url??""),[g,v]=Z("prompt"),E=Ae(()=>{let u=h.trim();if(!u)return{valid:!0,error:null,parsed:null};try{let D=JSON.parse(u);return typeof D!="object"||D===null||Array.isArray(D)?{valid:!1,error:"JSON Schema \u306E\u30EB\u30FC\u30C8\u306F JSON \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8 (Object) \u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002",parsed:null}:{valid:!0,error:null,parsed:D}}catch(D){return{valid:!1,error:D.message,parsed:null}}},[h]),X=Ae(()=>{if(k.trim()==="")return{valid:!1,error:"\u63A8\u8AD6\u30E2\u30C7\u30EB\u540D\u306F\u5FC5\u9808\u3067\u3059\u3002"};if(!Number.isFinite(y)||y<Be||y>Ne)return{valid:!1,error:`\u6E29\u5EA6\u306F ${Be} \u4EE5\u4E0A ${Ne} \u4EE5\u4E0B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002`};if(!Number.isInteger(r)||r<Le)return{valid:!1,error:`\u6700\u5927\u30C8\u30FC\u30AF\u30F3\u6570\u306F ${Le} \u4EE5\u4E0A\u306E\u6574\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002`};let u=t.trim();return u!==""&&!_t(u)?{valid:!1,error:"\u5B9B\u5148\u306F http:// \u307E\u305F\u306F https:// \u3067\u59CB\u307E\u308B\u7D76\u5BFE URL \u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002"}:{valid:!0,error:null}},[k,y,r,t]),de=u=>{c(u.template_key),x(u.template_text),S(u.model_name),w(u.temperature),s(u.max_output_tokens),T(Oe(u.response_schema)),m(u.endpoint_base_url??"")};if(!o)return L("div",{"data-testid":"prompt-template-console",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[L("div",{style:{marginBottom:"16px"},children:[z("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u30D7\u30ED\u30F3\u30D7\u30C8\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u904B\u7528\u30B3\u30F3\u30BD\u30FC\u30EB"}),z("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:"\u30B7\u30B9\u30C6\u30E0\u30D7\u30ED\u30F3\u30D7\u30C8\u304A\u3088\u3073\u69CB\u9020\u5316\u51FA\u529B\u30B9\u30AD\u30FC\u30DE\u306E\u7DE8\u96C6\u3068 Golden Benchmark \u30C9\u30E9\u30A4\u30E9\u30F3\u4E8B\u524D\u691C\u8A3C"})]}),z("p",{"data-testid":"no-templates-message",style:{color:"#64748b",fontSize:"13px"},children:"\u767B\u9332\u3055\u308C\u3066\u3044\u308B\u30D7\u30ED\u30F3\u30D7\u30C8\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306F\u3042\u308A\u307E\u305B\u3093\u3002"})]});let ne=u=>{let D=$e.find(ge=>ge.key===u);D?T(JSON.stringify(D.schema,null,2)):u==="empty_object"?T(JSON.stringify({type:"object",properties:{},required:[]},null,2)):u==="clear"&&T("")},ie=i||!E.valid||!X.valid,xe=()=>{E.valid&&X.valid&&a?.({...o,template_text:b,model_name:k.trim(),temperature:y,max_output_tokens:r,response_schema:E.parsed,endpoint_base_url:t.trim()===""?null:t.trim()})};return L("div",{"data-testid":"prompt-template-console",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[L("div",{style:{marginBottom:"16px"},children:[z("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u30D7\u30ED\u30F3\u30D7\u30C8\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u904B\u7528\u30B3\u30F3\u30BD\u30FC\u30EB"}),z("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:"\u30B7\u30B9\u30C6\u30E0\u30D7\u30ED\u30F3\u30D7\u30C8\u304A\u3088\u3073\u69CB\u9020\u5316\u51FA\u529B\u30B9\u30AD\u30FC\u30DE\u306E\u7DE8\u96C6\u3068 Golden Benchmark \u30C9\u30E9\u30A4\u30E9\u30F3\u4E8B\u524D\u691C\u8A3C"})]}),z("div",{role:"tablist","aria-label":"\u30D7\u30ED\u30F3\u30D7\u30C8\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u4E00\u89A7",style:{display:"flex",gap:"6px",marginBottom:"16px",flexWrap:"wrap"},children:e.map(u=>z("button",{id:`template-tab-${u.template_key}`,type:"button",role:"tab","data-testid":`template-tab-${u.template_key}`,"aria-selected":u.template_key===n,"aria-controls":"prompt-editor-panel",onClick:()=>de(u),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:u.template_key===n?"#2563eb":"#f8fafc",color:u.template_key===n?"#ffffff":"#475569",fontSize:"12px",cursor:"pointer",fontWeight:u.template_key===n?600:400},children:u.name},u.template_key))}),L("div",{id:"prompt-editor-panel",role:"tabpanel","aria-labelledby":`template-tab-${o.template_key}`,children:[L("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(160px, 1fr))",gap:"10px",marginBottom:"16px"},children:[L("div",{children:[z("label",{htmlFor:"prompt-model-input",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u63A8\u8AD6\u30E2\u30C7\u30EB"}),z("input",{id:"prompt-model-input",type:"text","data-testid":"prompt-model-input",value:k,onChange:u=>S(u.target.value),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"}})]}),L("div",{children:[z("label",{htmlFor:"prompt-temperature-input",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u6E29\u5EA6 (Temperature)"}),z("input",{id:"prompt-temperature-input",type:"number",step:"0.1",min:"0",max:"2","data-testid":"prompt-temperature-input",value:y,onChange:u=>w(Number(u.target.value)),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"}})]}),L("div",{children:[z("label",{htmlFor:"prompt-tokens-input",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u6700\u5927\u30C8\u30FC\u30AF\u30F3\u6570"}),z("input",{id:"prompt-tokens-input",type:"number",step:"128",min:"128",max:"8192","data-testid":"prompt-tokens-input",value:r,onChange:u=>s(Number(u.target.value)),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"}})]}),L("div",{children:[z("label",{htmlFor:"prompt-endpoint-input",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u5B9B\u5148 (\u914D\u5099\u5185\u30D7\u30ED\u30D0\u30A4\u30C0)"}),z("input",{id:"prompt-endpoint-input",type:"url",placeholder:"https://sidecar.example:48001","data-testid":"prompt-endpoint-input",value:t,onChange:u=>m(u.target.value),style:{width:"100%",padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px"}})]})]}),X.error!==null&&z("div",{"data-testid":"prompt-field-error",role:"alert",style:{marginBottom:"12px",padding:"8px 10px",borderRadius:"6px",backgroundColor:"#fef2f2",border:"1px solid #ef4444",color:"#b91c1c",fontSize:"12px"},children:X.error}),L("div",{style:{display:"flex",gap:"8px",borderBottom:"1px solid #e2e8f0",marginBottom:"12px",paddingBottom:"4px"},children:[z("button",{type:"button",onClick:()=>v("prompt"),"data-testid":"editor-tab-prompt",style:{padding:"6px 14px",border:"none",borderRadius:"4px",backgroundColor:g==="prompt"?"#e0e7ff":"transparent",color:g==="prompt"?"#3730a3":"#64748b",fontWeight:g==="prompt"?600:400,fontSize:"13px",cursor:"pointer"},children:"\u30D7\u30ED\u30F3\u30D7\u30C8\u672C\u6587 (Prompt Text)"}),L("button",{type:"button",onClick:()=>v("schema"),"data-testid":"editor-tab-schema",style:{padding:"6px 14px",border:"none",borderRadius:"4px",backgroundColor:g==="schema"?"#e0e7ff":"transparent",color:g==="schema"?"#3730a3":"#64748b",fontWeight:g==="schema"?600:400,fontSize:"13px",cursor:"pointer"},children:["\u69CB\u9020\u5316\u51FA\u529B\u30B9\u30AD\u30FC\u30DE (JSON Schema)",E.valid&&h.trim()&&z("span",{style:{marginLeft:"6px",fontSize:"11px",backgroundColor:"#10b981",color:"#ffffff",padding:"1px 5px",borderRadius:"10px"},children:"\u8A2D\u5B9A\u6E08"}),!E.valid&&z("span",{style:{marginLeft:"6px",fontSize:"11px",backgroundColor:"#ef4444",color:"#ffffff",padding:"1px 5px",borderRadius:"10px"},children:"\u30A8\u30E9\u30FC"})]})]}),g==="prompt"&&L("div",{style:{marginBottom:"16px"},children:[z("label",{htmlFor:"prompt-template-textarea",style:{fontSize:"12px",color:"#64748b",display:"block",marginBottom:"4px"},children:"\u30D7\u30ED\u30F3\u30D7\u30C8\u672C\u6587 (\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC: {{variable}})"}),z("textarea",{id:"prompt-template-textarea","data-testid":"prompt-template-textarea",value:b,onChange:u=>x(u.target.value),rows:12,style:{width:"100%",padding:"8px",borderRadius:"4px",border:"1px solid #cbd5e1",fontFamily:"monospace",fontSize:"13px",lineHeight:1.5}})]}),g==="schema"&&L("div",{style:{marginBottom:"16px"},children:[L("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px",flexWrap:"wrap",gap:"8px"},children:[z("label",{htmlFor:"prompt-schema-textarea",style:{fontSize:"12px",color:"#64748b",display:"block"},children:"\u30EC\u30B9\u30DD\u30F3\u30B9\u69CB\u9020\u5316 JSON Schema (Structured Outputs / JSON Mode \u5236\u7D04\u5B9A\u7FA9)"}),L("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[z("label",{htmlFor:d,style:{fontSize:"12px",color:"#64748b"},children:"\u30D7\u30EA\u30BB\u30C3\u30C8\u9069\u7528:"}),L("select",{id:d,"data-testid":"schema-preset-select",defaultValue:"",onChange:u=>{u.target.value&&(ne(u.target.value),u.target.value="")},style:{fontSize:"12px",padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff"},children:[z("option",{value:"",disabled:!0,children:"\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"}),$e.map(u=>z("option",{value:u.key,children:u.name},u.key)),z("option",{value:"empty_object",children:"\u7A7A\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8 ({})"}),z("option",{value:"clear",children:"\u30AF\u30EA\u30A2 (\u30B9\u30AD\u30FC\u30DE\u89E3\u9664)"})]})]})]}),z("textarea",{id:"prompt-schema-textarea","data-testid":"prompt-schema-textarea",value:h,onChange:u=>T(u.target.value),rows:12,placeholder:`{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"summary": { "type": "string" }
|
|
5
|
+
},
|
|
6
|
+
"required": ["summary"]
|
|
7
|
+
}`,style:{width:"100%",padding:"8px",borderRadius:"4px",border:E.valid?"1px solid #cbd5e1":"1px solid #f87171",fontFamily:"monospace",fontSize:"13px",lineHeight:1.5,backgroundColor:E.valid?"#ffffff":"#fff5f5"}}),L("div",{style:{marginTop:"6px"},"data-testid":"schema-validation-status",children:[!h.trim()&&z("p",{"data-testid":"schema-empty-banner",style:{margin:0,fontSize:"12px",color:"#64748b"},children:"\u69CB\u9020\u5316\u30B9\u30AD\u30FC\u30DE\u672A\u8A2D\u5B9A\uFF08\u81EA\u7531\u5F62\u5F0F\u30C6\u30AD\u30B9\u30C8\u307E\u305F\u306F\u30E2\u30C7\u30EB\u6A19\u6E96\u5F62\u5F0F\u3067\u51FA\u529B\uFF09"}),h.trim()&&E.valid&&z("p",{"data-testid":"schema-valid-banner",style:{margin:0,fontSize:"12px",color:"#16a34a",fontWeight:500},children:"\u2713 \u69CB\u6587\u30C1\u30A7\u30C3\u30AF\u6B63\u5E38: \u6709\u52B9\u306A JSON Schema \u3067\u3059"}),h.trim()&&!E.valid&&L("p",{"data-testid":"schema-error-banner",style:{margin:0,fontSize:"12px",color:"#dc2626",fontWeight:500},children:["\u26A0 JSON \u69CB\u6587\u30A8\u30E9\u30FC: ",E.error]})]})]}),z("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"},children:a&&z("button",{type:"button","data-testid":"save-template-button","aria-label":"\u30D7\u30ED\u30F3\u30D7\u30C8\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3092\u4FDD\u5B58",disabled:ie,onClick:xe,style:{padding:"8px 18px",borderRadius:"4px",border:"none",backgroundColor:ie?"#94a3b8":"#10b981",color:"#ffffff",fontSize:"13px",fontWeight:600,cursor:ie?"not-allowed":"pointer"},children:i?"\u4FDD\u5B58\u4E2D...":"\u672C\u756A\u66F4\u65B0\u4FDD\u5B58"})})]})]})}import{useState as Ce}from"react";import{jsx as P,jsxs as J}from"react/jsx-runtime";function Rt(e,a){if(a==="int"){let i=Number.parseInt(String(e),10);return Number.isNaN(i)?e:i}if(a==="float"){let i=Number.parseFloat(String(e));return Number.isNaN(i)?e:i}return a==="bool"?!!e:e}function fo({parameters:e,onSaveParameter:a,onResetToDefault:i,readOnly:d=!1,isSaving:l=!1}){let[n,c]=Ce("all"),[o,b]=Ce(""),[x,k]=Ce({}),S=Array.from(new Set(e.map(r=>r.category))),y=e.filter(r=>{let s=n==="all"||r.category===n,h=o===""||r.key.toLowerCase().includes(o.toLowerCase())||r.description.toLowerCase().includes(o.toLowerCase());return s&&h}),w=(r,s)=>{k(h=>({...h,[r]:s}))};return J("div",{"data-testid":"system-parameter-table",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[J("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[J("div",{children:[P("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u30B7\u30B9\u30C6\u30E0\u30D1\u30E9\u30E1\u30FC\u30BF\u7BA1\u7406"}),J("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u5168 ",e.length," \u4EF6\u306E\u30B7\u30B9\u30C6\u30E0\u30D1\u30E9\u30E1\u30FC\u30BF\u8A2D\u5B9A"]})]}),P("input",{type:"text","data-testid":"param-search-input","aria-label":"\u30B7\u30B9\u30C6\u30E0\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u30AD\u30FC\u307E\u305F\u306F\u8AAC\u660E\u3067\u691C\u7D22",placeholder:"\u30AD\u30FC\u307E\u305F\u306F\u8AAC\u660E\u3067\u691C\u7D22...",value:o,onChange:r=>b(r.target.value),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",fontSize:"13px",width:"220px"}})]}),J("div",{"data-testid":"param-category-tabs",style:{display:"flex",gap:"6px",marginBottom:"16px",flexWrap:"wrap"},children:[J("button",{type:"button","data-testid":"param-category-tab-all","aria-pressed":n==="all",onClick:()=>c("all"),style:{padding:"4px 10px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:n==="all"?"#2563eb":"#ffffff",color:n==="all"?"#ffffff":"#475569",fontSize:"12px",cursor:"pointer"},children:["\u3059\u3079\u3066 (",e.length,")"]}),S.map(r=>P("button",{type:"button","data-testid":`param-category-tab-${r}`,"aria-pressed":n===r,onClick:()=>c(r),style:{padding:"4px 10px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:n===r?"#2563eb":"#ffffff",color:n===r?"#ffffff":"#475569",fontSize:"12px",cursor:"pointer"},children:r},r))]}),P("div",{style:{overflowX:"auto"},children:J("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[P("thead",{children:J("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[P("th",{style:{padding:"6px 8px"},children:"\u30D1\u30E9\u30E1\u30FC\u30BF\u30AD\u30FC"}),P("th",{style:{padding:"6px 8px"},children:"\u578B"}),P("th",{style:{padding:"6px 8px"},children:"\u73FE\u5728\u5024 / \u8A2D\u5B9A\u5024"}),P("th",{style:{padding:"6px 8px"},children:"\u8AAC\u660E"}),!d&&P("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),P("tbody",{children:y.map(r=>{let s=x[r.key]!==void 0?x[r.key]:r.value,h=x[r.key]!==void 0&&x[r.key]!==r.value;return J("tr",{"data-testid":`param-row-${r.key}`,style:{borderBottom:"1px solid #f1f5f9"},children:[P("td",{style:{padding:"8px",fontWeight:600,color:"#1e293b"},children:P("code",{children:r.key})}),P("td",{style:{padding:"8px",color:"#64748b"},children:r.data_type}),P("td",{style:{padding:"8px"},children:r.data_type==="bool"?P("button",{type:"button",role:"switch","aria-checked":!!s,"aria-label":`${r.key} \u306E\u5207\u308A\u66FF\u3048`,"data-testid":`param-input-${r.key}`,disabled:d,onClick:()=>w(r.key,!s),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:s?"#10b981":"#e2e8f0",color:s?"#ffffff":"#475569",cursor:d?"not-allowed":"pointer",fontSize:"12px"},children:String(s)}):P("input",{type:r.is_secret?"password":r.data_type==="int"||r.data_type==="float"?"number":"text","data-testid":`param-input-${r.key}`,"aria-label":`${r.key} \u306E\u5024`,disabled:d,value:String(s),onChange:T=>w(r.key,T.target.value),style:{padding:"4px 8px",borderRadius:"4px",border:h?"1px solid #2563eb":"1px solid #cbd5e1",fontSize:"13px",width:"180px"}})}),P("td",{style:{padding:"8px",color:"#64748b"},children:r.description}),!d&&P("td",{style:{padding:"8px",textAlign:"right"},children:J("div",{style:{display:"flex",gap:"6px",justifyContent:"flex-end"},children:[a&&P("button",{type:"button","data-testid":`save-param-${r.key}`,"aria-label":`${r.key} \u306E\u8A2D\u5B9A\u3092\u4FDD\u5B58`,disabled:l||!h,onClick:()=>a(r.key,Rt(s,r.data_type)),style:{padding:"4px 8px",borderRadius:"4px",border:"none",backgroundColor:h?"#2563eb":"#cbd5e1",color:"#ffffff",cursor:l||!h?"not-allowed":"pointer",fontSize:"12px"},children:"\u4FDD\u5B58"}),i&&P("button",{type:"button","data-testid":`reset-param-${r.key}`,"aria-label":`${r.key} \u3092\u65E2\u5B9A\u5024\u306B\u623B\u3059`,disabled:l,onClick:()=>i(r.key),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",color:"#64748b",cursor:l?"not-allowed":"pointer",fontSize:"12px"},children:"\u30EA\u30BB\u30C3\u30C8"})]})})]},r.key)})})]})})]})}import{useId as Me,useState as Y}from"react";import{jsx as R,jsxs as Q}from"react/jsx-runtime";var Ge="\u5168\u4F53",We="\u7A7A\u6B04\u3067\u5168\u4F53",Fe="\u505C\u6B62\u4E2D",be="#64748b";function zt(e){let a=e.trim();if(a==="")return null;let i=Number(a);if(!(!Number.isFinite(i)||i<=0))return i}function De(e){let a=e.trim();return a===""?null:a}function yo({vocabulary:e,references:a,unresolvedUris:i,onSaveTerm:d,onSaveReference:l,isUpdating:n=!1,readOnly:c=!1}){let[o,b]=Y(""),[x,k]=Y(""),[S,y]=Y(""),[w,r]=Y(""),[s,h]=Y(""),[T,t]=Y(""),[m,g]=Y(null),[v,E]=Y(null),[X,de]=Y(null),ne=Me(),ie=Me(),xe=new Set(i??[]),u=c||n,D=async(p,ae,Ke,qe)=>{de(p);try{await ae(),Ke()}catch(ke){qe(ke instanceof Error?ke.message:"\u4FDD\u5B58\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002")}finally{de(null)}},ge=()=>{g(null);let p=zt(S);if(o.trim()===""){g("\u8A9E\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");return}if(p===void 0){g("\u91CD\u307F\u306F 0 \u3088\u308A\u5927\u304D\u3044\u6570\u3092\u5165\u308C\u3066\u304F\u3060\u3055\u3044\u3002\u7A7A\u6B04\u306B\u3059\u308B\u3068\u30B5\u30FC\u30D3\u30B9\u5074\u306E\u65E2\u5B9A\u306B\u59D4\u306D\u307E\u3059\u3002");return}D("term",()=>d?.({id:null,term:o.trim(),reading:x.trim()===""?null:x.trim(),boost:p,domainKey:De(w),isActive:!0}),()=>{b(""),k(""),y(""),r("")},g)},je=()=>{if(E(null),s.trim()===""){E("\u8CC7\u6599\u306E\u5728\u51E6\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");return}D("reference",()=>l?.({id:null,fileUri:s.trim(),domainKey:De(T),isActive:!0}),()=>{h(""),t("")},E)};return Q("div",{"data-testid":"transcription-adaptation-board",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[R("h2",{style:{margin:"0 0 4px",fontSize:"14px",fontWeight:600,color:"#0f172a"},children:"\u8EE2\u5199\u306E\u9069\u5FDC\u60C5\u5831"}),R("p",{style:{margin:"0 0 12px",fontSize:"11px",color:"#64748b"},children:"\u9332\u97F3\u3092\u805E\u304F\u524D\u306B\u8A8D\u8B58\u5668\u3078\u6E21\u3059\u4E88\u5099\u77E5\u8B58\u3067\u3059\u3002\u6B04\u3092\u6301\u305F\u306A\u3044\u30D7\u30ED\u30D0\u30A4\u30C0\u3078\u6E21\u3059\u3068\u3001\u305D\u306E\u533A\u5206\u306E\u8EE2\u5199\u306F\u7121\u8996\u3055\u308C\u305A\u306B\u62D2\u5426\u3055\u308C\u307E\u3059\u3002"}),R("h3",{style:{margin:"0 0 6px",fontSize:"12px",fontWeight:600,color:"#334155"},children:"\u8A9E\u5F59"}),Q("table",{"data-testid":"vocabulary-grid","aria-label":"\u8A9E\u5F59",style:{width:"100%",borderCollapse:"collapse",fontSize:"12px",marginBottom:"12px"},children:[R("thead",{children:R("tr",{children:["\u8A9E","\u8AAD\u307F","\u91CD\u307F","\u9818\u57DF","\u64CD\u4F5C"].map(p=>R("th",{scope:"col",style:{textAlign:"left",padding:"6px 8px",color:"#475569",borderBottom:"1px solid #e2e8f0"},children:p},p))})}),R("tbody",{children:e.map(p=>Q("tr",{"data-testid":`vocabulary-row-${p.id}`,"data-inactive":p.isActive?void 0:"true",children:[Q("th",{scope:"row",style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9",color:"#0f172a",fontWeight:400,textAlign:"left"},children:[p.term,!p.isActive&&R("span",{"data-testid":`vocabulary-inactive-${p.id}`,style:{marginInlineStart:"6px",padding:"1px 5px",borderRadius:"3px",backgroundColor:"#f1f5f9",color:be,fontSize:"10px"},children:Fe})]}),R("td",{"data-testid":`vocabulary-reading-${p.id}`,style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9",color:p.reading?"#0f172a":be},children:p.reading??"\u2014"}),R("td",{"data-testid":`vocabulary-boost-${p.id}`,style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9",color:p.boost===null?be:"#0f172a"},children:p.boost===null?"\u65E2\u5B9A":p.boost}),R("td",{style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9"},children:p.domainKey??Ge}),R("td",{style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9"},children:R("button",{type:"button","data-testid":`vocabulary-toggle-${p.id}`,"aria-label":`${p.term} \u3092${p.isActive?"\u7121\u52B9\u5316":"\u6709\u52B9\u5316"}`,disabled:u,onClick:()=>{d?.({...p,isActive:!p.isActive})},style:{fontSize:"11px",padding:"2px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#f8fafc",cursor:u?"not-allowed":"pointer"},children:p.isActive?"\u7121\u52B9\u5316":"\u6709\u52B9\u5316"})})]},p.id))})]}),!c&&Q("form",{style:{display:"flex",gap:"6px",alignItems:"flex-start",marginBottom:"6px"},onSubmit:p=>{p.preventDefault(),ge()},children:[R("input",{"data-testid":"vocabulary-term-input","aria-label":"\u8A9E","aria-invalid":!!m,"aria-describedby":m?ne:void 0,value:o,onChange:p=>b(p.target.value),placeholder:"\u56FA\u6709\u540D\u8A5E",style:{flex:2,fontSize:"12px",padding:"4px 6px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),R("input",{"data-testid":"vocabulary-reading-input","aria-label":"\u8AAD\u307F",value:x,onChange:p=>k(p.target.value),placeholder:"\u3053\u3086\u3046\u3081\u3044\u3057",style:{flex:2,fontSize:"12px",padding:"4px 6px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),R("input",{"data-testid":"vocabulary-boost-input","aria-label":"\u91CD\u307F",inputMode:"decimal","aria-invalid":!!m,"aria-describedby":m?ne:void 0,value:S,onChange:p=>y(p.target.value),placeholder:"\u65E2\u5B9A",style:{flex:1,fontSize:"12px",padding:"4px 6px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),R("input",{"data-testid":"vocabulary-domain-input","aria-label":"\u9818\u57DF",value:w,onChange:p=>r(p.target.value),placeholder:We,style:{flex:1,fontSize:"12px",padding:"4px 6px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),R("button",{type:"submit","data-testid":"vocabulary-add",disabled:u||X==="term",style:{fontSize:"12px",padding:"5px 12px",borderRadius:"4px",border:"1px solid #0f172a",backgroundColor:"#0f172a",color:"#ffffff",cursor:u?"not-allowed":"pointer"},children:"\u8FFD\u52A0"})]}),m&&R("p",{"data-testid":"vocabulary-term-error",id:ne,role:"alert",style:{margin:"0 0 16px",fontSize:"11px",color:"#b91c1c"},children:m}),R("h3",{style:{margin:"0 0 6px",fontSize:"12px",fontWeight:600,color:"#334155"},children:"\u53C2\u8003\u8CC7\u6599"}),R("p",{style:{margin:"0 0 6px",fontSize:"11px",color:"#64748b"},children:"\u672C\u6587\u306F\u53D6\u308A\u8FBC\u307F\u6E08\u307F\u306E\u6587\u66F8\u304B\u3089\u8AAD\u307F\u307E\u3059\u3002\u8CC7\u6599\u81EA\u8EAB\u306E\u6A5F\u5BC6\u533A\u5206\u3082\u3001\u9001\u4FE1\u5148\u306E\u53EF\u5426\u3068\u3057\u3066\u8A55\u4FA1\u3055\u308C\u307E\u3059\u3002"}),Q("table",{"data-testid":"reference-grid","aria-label":"\u53C2\u8003\u8CC7\u6599",style:{width:"100%",borderCollapse:"collapse",fontSize:"12px",marginBottom:"12px"},children:[R("thead",{children:R("tr",{children:["\u8CC7\u6599\u306E\u5728\u51E6","\u9818\u57DF","\u64CD\u4F5C"].map(p=>R("th",{scope:"col",style:{textAlign:"left",padding:"6px 8px",color:"#475569",borderBottom:"1px solid #e2e8f0"},children:p},p))})}),R("tbody",{children:a.map(p=>{let ae=p.isActive&&xe.has(p.fileUri);return Q("tr",{"data-testid":`reference-row-${p.id}`,"data-unresolved":ae?"true":void 0,"data-inactive":p.isActive?void 0:"true",children:[Q("th",{scope:"row",style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9",color:ae?"#b91c1c":"#0f172a",fontWeight:400,textAlign:"left"},children:[p.fileUri,!p.isActive&&R("span",{"data-testid":`reference-inactive-${p.id}`,style:{marginInlineStart:"6px",padding:"1px 5px",borderRadius:"3px",backgroundColor:"#f1f5f9",color:be,fontSize:"10px"},children:Fe}),ae&&R("span",{"data-testid":`reference-unresolved-${p.id}`,style:{display:"block",fontSize:"11px"},children:"\u3053\u306E\u8CC7\u6599\u306B\u306F\u53D6\u308A\u8FBC\u307F\u6E08\u307F\u306E\u672C\u6587\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u3053\u306E\u72B6\u614B\u3067\u306F\u8EE2\u5199\u304C\u5B9F\u884C\u3055\u308C\u307E\u305B\u3093\u3002"})]}),R("td",{style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9"},children:p.domainKey??Ge}),R("td",{style:{padding:"6px 8px",borderBottom:"1px solid #f1f5f9"},children:R("button",{type:"button","data-testid":`reference-toggle-${p.id}`,"aria-label":`${p.fileUri} \u3092${p.isActive?"\u7121\u52B9\u5316":"\u6709\u52B9\u5316"}`,disabled:u,onClick:()=>{l?.({...p,isActive:!p.isActive})},style:{fontSize:"11px",padding:"2px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#f8fafc",cursor:u?"not-allowed":"pointer"},children:p.isActive?"\u7121\u52B9\u5316":"\u6709\u52B9\u5316"})})]},p.id)})})]}),!c&&Q("form",{style:{display:"flex",gap:"6px"},onSubmit:p=>{p.preventDefault(),je()},children:[R("input",{"data-testid":"reference-uri-input","aria-label":"\u8CC7\u6599\u306E\u5728\u51E6",value:s,onChange:p=>h(p.target.value),placeholder:"gdrive://minutes.pdf",style:{flex:4,fontSize:"12px",padding:"4px 6px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),R("input",{"data-testid":"reference-domain-input","aria-label":"\u8CC7\u6599\u306E\u9818\u57DF",value:T,onChange:p=>t(p.target.value),placeholder:We,style:{flex:1,fontSize:"12px",padding:"4px 6px",border:"1px solid #cbd5e1",borderRadius:"4px"}}),R("button",{type:"submit","data-testid":"reference-add",disabled:u||X==="reference",style:{fontSize:"12px",padding:"5px 12px",borderRadius:"4px",border:"1px solid #0f172a",backgroundColor:"#0f172a",color:"#ffffff",cursor:u?"not-allowed":"pointer"},children:"\u8FFD\u52A0"})]}),v&&R("p",{"data-testid":"reference-error",id:ie,role:"alert",style:{margin:"6px 0 0",fontSize:"11px",color:"#b91c1c"},children:v})]})}import{jsx as A,jsxs as N}from"react/jsx-runtime";function ee(e){return e===null?"\u672A\u6E2C\u5B9A":e.toLocaleString()}function K(e){return e!==null&&e>0}function ho({auditData:e,onTriggerReconcile:a,isReconciling:i=!1,reconcileResult:d=null,onRefresh:l,isRefreshing:n=!1}){let c=e.is_consistent,o=c===null?{text:"\u5224\u5B9A\u4E0D\u80FD",background:"#fef3c7",color:"#92400e"}:c?{text:"\u6574\u5408\u6027\u6B63\u5E38",background:"#d1fae5",color:"#065f46"}:{text:"\u4E0D\u6574\u5408\u691C\u77E5",background:"#fee2e2",color:"#991b1b"},b=i||c!==!1;return N("div",{"data-testid":"tri-store-integrity-audit",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[N("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[N("div",{children:[N("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[A("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"Tri-Store \u30C7\u30FC\u30BF\u6574\u5408\u6027\u76E3\u67FB"}),A("span",{"data-testid":"audit-integrity-badge","data-consistent":String(c),style:{fontSize:"12px",padding:"2px 8px",borderRadius:"12px",backgroundColor:o.background,color:o.color,fontWeight:600},children:o.text})]}),N("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u6700\u7D42\u76E3\u67FB\u65E5\u6642: ",A("span",{"data-testid":"last-audit-time",children:e.last_audit_time})]})]}),N("div",{style:{display:"flex",gap:"8px"},children:[l&&A("button",{type:"button","data-testid":"audit-refresh-button","aria-label":"\u6574\u5408\u6027\u76E3\u67FB\u30C7\u30FC\u30BF\u3092\u66F4\u65B0",disabled:n,onClick:l,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:n?"not-allowed":"pointer",fontSize:"13px"},children:n?"\u66F4\u65B0\u4E2D...":"\u66F4\u65B0"}),a&&A("button",{type:"button","data-testid":"trigger-reconciliation-button","aria-label":"\u5DEE\u5206\u6574\u5408\u6027\u4FEE\u5FA9\u3092\u5B9F\u884C",disabled:b,onClick:a,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:b?"#cbd5e1":"#2563eb",color:"#ffffff",cursor:b?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:i?"\u4FEE\u5FA9\u4E2D...":"\u5DEE\u5206\u6574\u5408\u6027\u4FEE\u5FA9"})]})]}),N("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"10px"},children:[N("div",{style:{border:"1px solid #cbd5e1",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[A("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30DE\u30B9\u30BF\u30FC\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570 (MSSQL)"}),A("div",{"data-testid":"audit-total-files",style:{fontSize:"20px",fontWeight:700,color:"#0f172a"},children:e.total_files.toLocaleString()})]}),N("div",{style:{border:"1px solid #cbd5e1",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[A("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30D9\u30AF\u30C8\u30EB\u767B\u9332\u6570 (Qdrant\u30FB\u30C1\u30E3\u30F3\u30AF)"}),A("div",{"data-testid":"audit-vector-count",style:{fontSize:"20px",fontWeight:700,color:"#0f172a"},children:ee(e.vector_indexed_count)}),N("div",{"data-testid":"audit-vector-expected",style:{fontSize:"12px",color:"#64748b"},children:["\u6295\u5F71\u8A18\u9332: ",ee(e.expected_vector_count)]})]}),N("div",{style:{border:"1px solid #cbd5e1",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[A("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30B0\u30E9\u30D5\u6295\u5F71\u30CE\u30FC\u30C9\u6570 (Neo4j\u30FB\u6587\u66F8)"}),A("div",{"data-testid":"audit-graph-count",style:{fontSize:"20px",fontWeight:700,color:"#0f172a"},children:ee(e.graph_projected_count)}),N("div",{"data-testid":"audit-graph-expected",style:{fontSize:"12px",color:"#64748b"},children:["\u6295\u5F71\u8A18\u9332: ",ee(e.expected_graph_count)]})]}),N("div",{style:{border:`1px solid ${K(e.orphan_vectors_count)?"#ef4444":"#cbd5e1"}`,borderRadius:"6px",padding:"10px",backgroundColor:K(e.orphan_vectors_count)?"#fef2f2":"#f8fafc"},children:[A("div",{style:{fontSize:"12px",color:K(e.orphan_vectors_count)?"#991b1b":"#64748b"},children:"\u5B64\u5150\u30D9\u30AF\u30C8\u30EB\u4EF6\u6570"}),A("div",{"data-testid":"audit-orphan-vectors",style:{fontSize:"20px",fontWeight:700,color:K(e.orphan_vectors_count)?"#b91c1c":"#0f172a"},children:ee(e.orphan_vectors_count)})]}),N("div",{style:{border:`1px solid ${K(e.orphan_nodes_count)?"#ef4444":"#cbd5e1"}`,borderRadius:"6px",padding:"10px",backgroundColor:K(e.orphan_nodes_count)?"#fef2f2":"#f8fafc"},children:[A("div",{style:{fontSize:"12px",color:K(e.orphan_nodes_count)?"#991b1b":"#64748b"},children:"\u5B64\u5150\u30B0\u30E9\u30D5\u30CE\u30FC\u30C9\u4EF6\u6570"}),A("div",{"data-testid":"audit-orphan-nodes",style:{fontSize:"20px",fontWeight:700,color:K(e.orphan_nodes_count)?"#b91c1c":"#0f172a"},children:ee(e.orphan_nodes_count)})]}),N("div",{style:{border:`1px solid ${K(e.unresolved_policy_conflicts)?"#f59e0b":"#cbd5e1"}`,borderRadius:"6px",padding:"10px",backgroundColor:K(e.unresolved_policy_conflicts)?"#fffbeb":"#f8fafc"},children:[A("div",{style:{fontSize:"12px",color:K(e.unresolved_policy_conflicts)?"#92400e":"#64748b"},children:"\u898F\u7A0B\u885D\u7A81\u672A\u89E3\u6C7A\u4EF6\u6570"}),A("div",{"data-testid":"audit-policy-conflicts",style:{fontSize:"20px",fontWeight:700,color:K(e.unresolved_policy_conflicts)?"#b45309":"#0f172a"},children:ee(e.unresolved_policy_conflicts)})]})]}),d&&N("div",{"data-testid":"audit-reconcile-result",style:{marginTop:"12px",border:"1px solid #cbd5e1",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc",fontSize:"13px",color:"#334155"},children:[A("div",{style:{fontWeight:600,marginBottom:"4px"},children:"\u76F4\u524D\u306E\u4FEE\u5FA9"}),N("div",{"data-testid":"reconcile-purged-points",children:["\u9664\u53BB\u3057\u305F\u5B64\u5150\u30D9\u30AF\u30C8\u30EB\u70B9: ",d.purgedVectorPoints.toLocaleString()," \u4EF6"]}),N("div",{"data-testid":"reconcile-reprojected-chunks",children:["\u518D\u6295\u5F71\u3057\u305F\u30C1\u30E3\u30F3\u30AF: ",d.reprojectedChunks.toLocaleString()," \u4EF6"]}),N("div",{"data-testid":"reconcile-run-id",style:{fontSize:"11px",color:"#64748b"},children:["\u5B9F\u884C ID: ",d.runId||"\u672A\u6E2C\u5B9A"]})]}),e.probe_failures.length>0&&N("div",{"data-testid":"audit-probe-failures",style:{marginTop:"12px",border:"1px solid #f59e0b",borderRadius:"6px",padding:"10px",backgroundColor:"#fffbeb"},children:[A("div",{style:{fontSize:"12px",fontWeight:600,color:"#92400e",marginBottom:"4px"},children:"\u6E2C\u5B9A\u3067\u304D\u306A\u304B\u3063\u305F\u9805\u76EE"}),A("ul",{style:{margin:0,paddingLeft:"18px",fontSize:"13px",color:"#92400e"},children:e.probe_failures.map(x=>A("li",{children:x},x))})]})]})}export{Et as CitationProofBadge,At as ClassificationRuleEditor,Ot as ConfidentialityPolicyBoard,Ft as FeatureFlagBoard,qt as GovernanceDryRunConsole,no as KnowledgeGraphExplorer,so as PromptTemplateConsole,$e as SCHEMA_PRESETS,fo as SystemParameterTable,yo as TranscriptionAdaptationBoard,ho as TriStoreIntegrityAudit,mt as computeDateFromPercent,De as normalizeDomain,zt as parseBoost,Rt as parseParameterValue};
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aiquants/governance-react",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "React UI components for enterprise knowledge governance: CitationProofBadge, DryRunDiffViewer, KnowledgeGraphExplorer, SystemParameterTable, FeatureFlagBoard, PromptTemplateConsole, ClassificationRuleEditor, and TriStoreIntegrityAudit.",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.cts",
|
|
18
|
+
"default": "./dist/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"keywords": [
|
|
28
|
+
"react",
|
|
29
|
+
"governance",
|
|
30
|
+
"citation-proof",
|
|
31
|
+
"dry-run",
|
|
32
|
+
"knowledge-graph",
|
|
33
|
+
"system-parameters",
|
|
34
|
+
"feature-flags",
|
|
35
|
+
"prompt-templates",
|
|
36
|
+
"classification-rules",
|
|
37
|
+
"tri-store-audit",
|
|
38
|
+
"typescript"
|
|
39
|
+
],
|
|
40
|
+
"author": "AI Quants",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@aiquants/enrichment-core": "^0.1.1",
|
|
44
|
+
"@aiquants/governance-core": "^0.1.0",
|
|
45
|
+
"react": ">=18",
|
|
46
|
+
"react-dom": ">=18"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@aiquants/enrichment-core": "0.1.1",
|
|
50
|
+
"@aiquants/governance-core": "0.1.0",
|
|
51
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
52
|
+
"@testing-library/react": "^16.3.2",
|
|
53
|
+
"@testing-library/user-event": "^14.6.1",
|
|
54
|
+
"@types/react": "^19.2.7",
|
|
55
|
+
"@types/react-dom": "^19.2.3",
|
|
56
|
+
"@vitest/coverage-v8": "^4.1.8",
|
|
57
|
+
"jsdom": "^27.4.0",
|
|
58
|
+
"react": "^19.2.7",
|
|
59
|
+
"react-dom": "^19.2.7",
|
|
60
|
+
"rimraf": "^6.1.2",
|
|
61
|
+
"tsup": "^8.5.1",
|
|
62
|
+
"typescript": "^5.9.3",
|
|
63
|
+
"vitest": "^4.1.10"
|
|
64
|
+
},
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": ">=18.0.0",
|
|
67
|
+
"pnpm": ">=8.0.0"
|
|
68
|
+
},
|
|
69
|
+
"publishConfig": {
|
|
70
|
+
"access": "public"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "tsup && node ../../.config/scripts/strip-dts-comments.mjs dist",
|
|
74
|
+
"build:watch": "tsup --watch",
|
|
75
|
+
"dev": "tsup --watch",
|
|
76
|
+
"publish:patch": "pnpm run typecheck && pnpm run --if-present test && pnpm version patch --no-git-tag-version --no-git-checks && pnpm publish --no-git-checks",
|
|
77
|
+
"publish:minor": "pnpm run typecheck && pnpm run --if-present test && pnpm version minor --no-git-tag-version --no-git-checks && pnpm publish --no-git-checks",
|
|
78
|
+
"publish:major": "pnpm run typecheck && pnpm run --if-present test && pnpm version major --no-git-tag-version --no-git-checks && pnpm publish --no-git-checks",
|
|
79
|
+
"typecheck": "tsc --noEmit",
|
|
80
|
+
"clean": "rimraf dist",
|
|
81
|
+
"lint": "biome lint src/",
|
|
82
|
+
"check": "biome check src/ tests/",
|
|
83
|
+
"check:fix": "biome check --write src/ tests/",
|
|
84
|
+
"test": "vitest run",
|
|
85
|
+
"test:coverage": "vitest run --coverage"
|
|
86
|
+
}
|
|
87
|
+
}
|