@aiquants/enrichment-react 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- var Ft="\u975E\u8868\u793A (\u5217\u306E\u30B9\u30B3\u30FC\u30D7)",ft={KEYWORD:{label:"\u30AD\u30FC\u30EF\u30FC\u30C9",description:"SQL Server \u306E\u8A9E\u53E5\u306E\u4E00\u81F4\u3060\u3051\u3067\u63A2\u3057\u307E\u3059\u3002\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u547C\u3070\u306A\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},SPARSE:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u306E\u8A9E\u5F59\u306E\u30D9\u30AF\u30C8\u30EB\u3067\u63A2\u3057\u307E\u3059\u3002\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u4E00\u81F4\u306B\u5F37\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},DENSE:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",description:"\u57CB\u3081\u8FBC\u307F\u306E\u610F\u5473\u306E\u30D9\u30AF\u30C8\u30EB\u3067\u63A2\u3057\u307E\u3059\u3002\u8A00\u3044\u63DB\u3048\u3084\u6587\u610F\u306E\u8FD1\u3055\u3092\u62FE\u3046\u7D4C\u8DEF\u3067\u3059\u3002"},HYBRID:{label:"\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9",description:"\u758E\u30FB\u5BC6\u30FB\u30B0\u30E9\u30D5\u30FB\u8A9E\u53E5\u306E\u4E00\u81F4\u306E\u9806\u4F4D\u3092\u878D\u5408\u3057\u307E\u3059\u3002\u65E2\u5B9A\u306E\u7D4C\u8DEF\u3067\u3059\u3002"},GRAPH_TRAVERSE:{label:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u3092\u305F\u3069\u3063\u3066\u63A2\u3057\u307E\u3059\u3002\u6587\u66F8\u306E\u9593\u306E\u3064\u306A\u304C\u308A\u3092\u4E3B\u306B\u3059\u308B\u7D4C\u8DEF\u3067\u3059\u3002"}},Oa={rrf:"RRF (\u9806\u4F4D\u306E\u9006\u6570\u306E\u548C)",linear:"\u7DDA\u5F62 (\u03B1 \u3067\u91CD\u307F\u4ED8\u3051)"},Zt={FULL:"\u5B8C\u5168",DEGRADED_LEXICAL_ONLY:"\u7E2E\u9000 (\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u8D70\u3089\u305A)",DEGRADED_PARTIAL:"\u7E2E\u9000 (\u4E00\u90E8\u306E\u5C64\u3060\u3051)"},en={CLOSED:"\u9589 (\u901A\u5E38)",OPEN:"\u958B (\u906E\u65AD\u4E2D)",HALF_OPEN:"\u534A\u958B (\u8A66\u3057\u306E 1 \u56DE)"},Aa={vector_search_disabled:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u306B\u3055\u308C\u3066\u3044\u307E\u3059\u3002",graph_search_disabled:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u306B\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:vector":"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5931\u6557\u304C\u7D9A\u3044\u305F\u305F\u3081\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:graph":"\u30B0\u30E9\u30D5\u691C\u7D22\u306F\u5931\u6557\u304C\u7D9A\u3044\u305F\u305F\u3081\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002",vector_tier_not_configured:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",graph_tier_not_configured:"\u30B0\u30E9\u30D5\u691C\u7D22\u306F\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",no_active_vector_collection:"\u6709\u52B9\u306A\u7D22\u5F15\u306E\u6226\u7565\u304C 1 \u3064\u3082\u7121\u3044\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_collections_missing:"\u30D9\u30AF\u30C8\u30EB\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u304C\u307E\u3060\u7121\u3044\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u6587\u66F8\u306E\u6295\u5F71\u304C\u7D42\u308F\u308B\u3068\u89E3\u6D88\u3057\u307E\u3059\u3002",row_scope_permits_no_rows:"\u8AAD\u3081\u308B\u6587\u66F8\u304C 1 \u3064\u3082\u7121\u3044\u6A29\u9650\u306E\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u306E\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_tier_unavailable:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306E\u57FA\u76E4\u306B\u5C4A\u304B\u306A\u3044\u304B\u3001\u57FA\u76E4\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002",graph_tier_unavailable:"\u30B0\u30E9\u30D5\u691C\u7D22\u306E\u57FA\u76E4\u306B\u5C4A\u304B\u306A\u3044\u304B\u3001\u57FA\u76E4\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002",vector_tier_timed_out:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u671F\u9650\u307E\u3067\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002",graph_tier_timed_out:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u671F\u9650\u307E\u3067\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002",tiers_not_executed:"\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u306E\u691C\u7D22\u304C\u5B9F\u884C\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F (\u7406\u7531\u306F\u5831\u544A\u3055\u308C\u3066\u3044\u307E\u305B\u3093)\u3002"};function gn(e){return Object.hasOwn(Aa,e)?Aa[e]:e}var Ut=3;function Ma(e){return e.kind==="cosine"?`${(e.value*100).toFixed(1)}% (\u30B3\u30B5\u30A4\u30F3)`:`${e.value.toFixed(Ut)} (${e.kind==="bm25"?"BM25":"\u5BC6\u3068\u758E\u306E\u6DF7\u3056\u3063\u305F\u5024"})`}function Fa(e,t){let n=d=>{let o=new Map;return d.forEach((b,$)=>{o.has(b)||o.set(b,$+1)}),o},a=n(e),s=n(t),r=[...a.keys()].filter(d=>s.has(d)),l=new Set([...a.keys(),...s.keys()]).size;return{sharedCount:r.length,overlapRatio:l===0?null:r.length/l,meanAbsoluteRankDifference:r.length===0?null:r.reduce((d,o)=>d+Math.abs(a.get(o)-s.get(o)),0)/r.length}}function Gn(e){return`${e.metadata_id}:${e.chunk_index}`}import{AlertMessage as _s,Button as Cs,Card as Ts,CardSection as ks,Cluster as Ps,CodeBlock as ws,ComparisonGrid as Ls,DataTable as $s,DescriptionList as Ds,Disclosure as As,Link as Os,LoadMore as Ms,MasterDetail as Fs,Measured as Us,Meter as Bs,Notice as Hs,Pill as Ks,ResourceFailed as Vs,RowButton as Gs,SegmentedControl as js,Select as qs,SelectableList as zs,Slider as Xs,Stack as Ys,Text as Ws,TextInput as Js,VisuallyHidden as Qs,useConsoleUi as Zs,useAnnounce as eo,useFocusRescue as to,usePagedResource as no,useResource as ao}from"@aiquants/console-ui";import{createElement as le}from"react";var tn="ja-JP";function I(){let e=Zs();if(e.locale!=="ja"||e.formatLocale!==tn)throw new RangeError(`The ConsoleUiRoot must be locale "${"ja"}" and formatLocale "${tn}", the language and format of this package's text (got locale "${e.locale}" and formatLocale "${e.formatLocale}")`);return e}function te(e){return I(),le(Us,e)}function Ba(e){return I(),le(Gs,e)}function bn(e){return I(),le(Fs,e)}function xn(e){return I(),le(Ls,e)}function Ue(e){return I(),le(Ks,e)}function at(e){return I(),le(Ts,e)}function xe(e){return I(),le(Cs,e)}function Xe(e){return I(),le(Hs,e)}function Be(e){return I(),le(_s,e)}function ct(e){return I(),le(Vs,e)}function Bt(e){return I(),le(Ms,e)}function hn(e){return I(),le(Os,e)}function Sn(e){return I(),le(Qs,e)}function yt(e){return I(),le($s,e)}function vn(e){return I(),le(zs,e)}function jn(e,t,n){return I(),ao(e,t,n)}function Ht(e,t,n){return I(),no(e,t,n)}function Ye(e){return I(),to(e)}function qn(e){return I(),le(ks,e)}function zn(e){return I(),le(ws,e)}function Kt(e){return I(),le(Ds,e)}function En(e){return I(),le(As,e)}function Xn(e){return I(),le(Bs,e)}function gt(e){return I(),le(js,e)}function Tt(e){return I(),le(qs,e)}function kt(e){return I(),le(Xs,e)}function Se(e){return I(),le(Ys,e)}function We(e){return I(),le(Ps,e)}function K(e){return I(),le(Ws,e)}function ut(e){return I(),le(Js,e)}function bt(){return I(),eo()}import{jsx as nn,jsxs as ro}from"react/jsx-runtime";function Ha({metadata:e,testId:t}){if(I(),!e.is_degraded)return null;let n=e.executed_tiers,a=ft[e.requested_mode].label,s=Zt[e.quality_tier],l=!(n.lexical||n.dense||n.sparse||n.graph)?`\u7E2E\u9000\u3057\u3066\u7B54\u3048\u3066\u3044\u307E\u3059: ${a} \u3092\u6C42\u3081\u307E\u3057\u305F\u304C\u3001\u8D70\u3063\u305F\u5C64\u306F\u3042\u308A\u307E\u305B\u3093 (\u54C1\u8CEA: ${s})\u3002`:`\u7E2E\u9000\u3057\u3066\u7B54\u3048\u3066\u3044\u307E\u3059: ${a} \u3092\u6C42\u3081\u3001${ft[e.search_mode].label} \u3067\u7B54\u3048\u307E\u3057\u305F (\u54C1\u8CEA: ${s})\u3002`;return nn(Xe,{tone:"warning",testId:t,children:ro(Se,{gap:"space-2",testId:`${t}-body`,children:[nn(K,{as:"p",fg:"fg",type:"prose",testId:`${t}-summary`,children:l}),e.degradation_reasons.length>0&&nn("ul",{"data-testid":`${t}-reasons`,children:e.degradation_reasons.map((d,o)=>nn("li",{"data-reason":d,children:nn(K,{fg:"fg",type:"prose",testId:`${t}-reason-${o}`,children:gn(d)})},`${o}-${d}`))})]})})}import{HTTP_FORBIDDEN as Eo,mapOutcome as fr}from"@aiquants/console-ui/core";import{DOCUMENT_CHANGE_FEED_PAGE_SIZE as No}from"@aiquants/enrichment-core";import{useRef as yr}from"react";import{reasonAside as so}from"@aiquants/console-ui/core";var Pt={classification:"\u5206\u985E",metadata:"\u30E1\u30BF\u30C7\u30FC\u30BF",labels:"\u30E9\u30D9\u30EB",tags:"\u30BF\u30B0",structured_data:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF",text:"\u672C\u6587",summary:"\u8981\u7D04",chunks:"\u30C1\u30E3\u30F3\u30AF",assets:"\u6DFB\u4ED8"},Vt={RUN:"\u5B9F\u884C\u306E\u5F8C\u306E\u8A18\u9332",PRE_WRITE:"\u4E0A\u66F8\u304D\u306E\u524D\u306E\u8A18\u9332",MANUAL:"\u624B\u52D5\u306E\u8A18\u9332",BACKFILL:"\u8A18\u9332\u306E\u8D77\u70B9"},Yn={ADDED:"\u8FFD\u52A0",REMOVED:"\u524A\u9664",MODIFIED:"\u5909\u66F4",MOVED:"\u79FB\u52D5"},Ka={EXACT:"\u305D\u306E\u307E\u307E\u518D\u73FE",WHITESPACE_NORMALIZED:"\u7A7A\u767D\u3092\u7E4B\u304E\u76F4\u3057\u3066\u518D\u73FE",UNVERIFIED:"\u518D\u73FE\u3067\u304D\u306A\u3044"},Va="\u30C1\u30E3\u30F3\u30AF\u306E\u672C\u6587\u306F\u3053\u306E\u533A\u9593\u306E\u6587\u3092\u7A7A\u767D\u3067\u7E4B\u304E\u76F4\u3057\u305F\u5F62\u3067\u3059\u3002",Ga="\u3053\u306E\u65AD\u7247\u306F\u3053\u306E\u72B6\u614B\u306E\u62BD\u51FA\u672C\u6587\u3068\u5BFE\u5FDC\u3057\u307E\u305B\u3093\u3002",ja="\u672C\u6587\u306F\u540C\u3058\u3067\u3001\u30C1\u30E3\u30F3\u30AF\u306E\u5207\u308A\u65B9\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F\u3002",Nn={confidentialityLevel:"\u6A5F\u5BC6\u533A\u5206",departmentId:"\u90E8\u9580",folderPath:"\u30D5\u30A9\u30EB\u30C0",createdBy:"\u4F5C\u6210\u8005",fileName:"\u767B\u9332\u540D",filePath:"\u30D1\u30B9",fileId:"\u30D5\u30A1\u30A4\u30EB ID",revision:"\u7248",revisionId:"\u7248\u306E ID",fileSize:"\u5927\u304D\u3055",mimeType:"MIME",fileHash:"\u30CF\u30C3\u30B7\u30E5",mtime:"\u66F4\u65B0\u6642\u523B",present:"\u672C\u6587\u306E\u6709\u7121",lineEnding:"\u6539\u884C",finalNewline:"\u6700\u5F8C\u306E\u6539\u884C",mime:"\u672C\u6587\u306E MIME",source:"\u672C\u6587\u306E\u51FA\u6240",isTruncated:"\u5207\u308A\u8A70\u3081",pageOffsets:"\u9801\u306E\u533A\u5207\u308A",assignedBy:"\u4ED8\u3051\u305F\u8005",confidenceScore:"\u78BA\u4FE1\u5EA6",textSha256:"\u672C\u6587\u306E\u30CF\u30C3\u30B7\u30E5"};function an(e){return Object.hasOwn(Nn,e)?Nn[e]:e}var xt="\u9694\u96E2 (RESTRICTED) \u306E\u6587\u66F8",qa="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u72B6\u614B",Rn="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u5B9F\u884C",za="\u76F4\u524D\u306E\u8A18\u9332\u3068\u306E\u6BD4\u8F03\u306F\u3042\u308A\u307E\u305B\u3093\u3002",Xa="\u5931\u6557\u3057\u305F\u5B9F\u884C\u306E\u5F8C\u306E\u72B6\u614B",Wn="\u8A18\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093",Ya="\u30BD\u30FC\u30B9\u306F\u540C\u3058\u3067\u3001\u30E2\u30C7\u30EB\u306E\u51FA\u529B\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F";function Wa(e){return`\u3053\u306E\u5909\u5316\u306B\u306F\u8A18\u9332\u3055\u308C\u306A\u304B\u3063\u305F\u5B9F\u884C ${e.map(t=>`#${t}`).join("\u3001")} \u306E\u5909\u5316\u3082\u542B\u307E\u308C\u307E\u3059`}function Ge(e){return`r${e}`}function Jn(e,t){return e===t?`${Ge(t)} (\u540C\u3058\u7248)`:`${Ge(e)} \u2192 ${Ge(t)}`}function In(e){let t=Pt[e.facet];if(e.facet==="classification"||e.facet==="metadata")return`${t} \u5909\u66F4`;let a=[[e.addedCount,"+"],[e.removedCount,"\u2212"],[e.modifiedCount,"~"],[e.movedCount,"\u79FB\u52D5 "]].flatMap(([s,r])=>s===null||s===0?[]:[`${r}${s}`]);return a.length===0?`${t} \u5909\u66F4`:`${t} ${a.join(" ")}`}function wt(e){return e===null?"(\u306A\u3057)":typeof e=="string"?e:JSON.stringify(e)}var ht="\u6587\u66F8\u306E\u5C65\u6B74\u3092\u95B2\u89A7\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002";function _n(e,t,n){return e.failureSentence(t,ht,St(n))}function St(e){return t=>`${e}\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F${so(t)}\u3002`}import{RUN_TERMINAL_STEP_KEY as Qa}from"@aiquants/enrichment-core";var Ja=(e,t)=>Date.parse(t.time)-Date.parse(e.time);function Za(e){let t=e.states.flatMap(o=>o.kind==="readable"?[o.item]:[]),n=e.runs.flatMap(o=>o.kind==="readable"?[o.item]:[]),a=new Set(n.map(o=>o.id)),s=[...n.map(o=>({kind:"run",key:`run:${o.id}`,time:o.startedAt,run:o,state:t.find(b=>b.runId===o.id)??null})),...t.filter(o=>o.runId===null||!a.has(o.runId)).map(o=>({kind:"state",key:`state:${o.stateId}`,time:o.settledAt,state:o}))].sort(Ja),l=[...new Set([...e.revisions.map(o=>o.revision),...s.map(o=>o.kind==="run"?o.run.revision:o.state.revision)])].sort((o,b)=>b-o).map(o=>({revision:o,isCurrent:e.revisions.some(b=>b.revision===o&&b.isCurrent),items:s.filter(b=>(b.kind==="run"?b.run.revision:b.state.revision)===o)})),d=[...e.states.flatMap((o,b)=>o.kind==="restricted"?[{key:`restricted:state:${b}`,time:o.settledAt,mark:o}]:[]),...e.runs.flatMap((o,b)=>o.kind==="restricted"?[{key:`restricted:run:${b}`,time:o.startedAt,mark:o}]:[])].sort(Ja);return{groups:l,marks:d,states:t,runs:n}}function Qn(e){if(e.status==="RUNNING")return!1;let t=e.steps.find(n=>n.stepKey===Qa);return t===void 0||t.status==="FAILED"}function er(e,t){let n=t.states.find(r=>r.stateId===e.previousStateId);if(n===void 0)return[];let a=Date.parse(n.settledAt),s=Date.parse(e.settledAt);return t.runs.filter(r=>{let l=Date.parse(r.startedAt);return r.status!=="RUNNING"&&r.id!==e.runId&&l>=a&&l<s&&!t.states.some(d=>d.runId===r.id)&&!r.steps.some(d=>d.stepKey===Qa&&d.status==="SUCCEEDED")}).map(r=>r.id)}function tr(e,t){switch(e.kind){case"latest_state":{let n=t.states[0];return n===void 0?null:t.runs.some(a=>a.id===n.runId)?`run:${n.runId}`:`state:${n.stateId}`}case"run":return`run:${e.runId}`;case"state":{let n=t.states.find(a=>a.stateId===e.stateId);return n!==void 0&&t.runs.some(a=>a.id===n.runId)?`run:${n.runId}`:`state:${e.stateId}`}}}function nr(e,t){return e.kind==="readable"?`readable:${e.item.stateId}`:`restricted:${t}`}import{useState as oo}from"react";function vt(e){let[t,n]=oo({failure:null,count:0});return e!==null&&e!==t.failure?(n({failure:e,count:t.count+1}),t.count+1):t.count}import{ceil8 as Cn,monoTextWidthEm as Zn,TOKENS as ea,textWidthEm as ta}from"@aiquants/console-ui/core";var Et=ea.type.body.size,na=ea.space["space-3"],io=20,ar=Cn(Et*ta("\u3042".repeat(io))+2*na),rr=448,lo=40,co=2,uo="+ ",po=ea.space["space-4"];function mo(e){if(!(Number.isSafeInteger(e)&&e>=0))throw new RangeError(`A line number is a non-negative safe integer: ${e}`);return String(e).length}function sr(e){let n=Zn("0".repeat(mo(e)+co))+Zn(uo)+Zn("0".repeat(lo));return Cn(Et*2*n+po)}function rt(e){return Cn(Et*ta(e)+2*na)}function Lt(e){if(e.length===0)throw new RangeError("A column needs at least one sample text");return Math.max(...e.map(rt))}function Gt(e){return Cn(Et*ta(e)+4*na)}var Tn="0000/00/00 00:00:00",Ne=rt("\u3042".repeat(10));import{jsx as kn}from"react/jsx-runtime";var rn=/[^\s\x1c-\x1f\x85\ufeff]/,fo={fontVariantNumeric:"tabular-nums"},yo={fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};function or({text:e,testId:t,slot:n}){if(I(),e===null)return kn(te,{value:null,testId:t});if(!rn.test(e))throw new RangeError(`${t}: a measured text must not be empty or only white space (pass null when the value was not measured)`);return kn("span",{"data-cui-migration":"pending","data-measured":"true","data-testid":t,style:n,children:e})}function sn({text:e,testId:t}){return kn(or,{text:e,testId:t,slot:fo})}function je({text:e,testId:t}){return kn(or,{text:e,testId:t,slot:yo})}import{DOCUMENT_KIND_LABELS as go,isUnknownTerm as ir,PIPELINE_STEPS as dr,parseSkipReason as bo,RUN_TERMINAL_STEP_KEY as xo}from"@aiquants/enrichment-core";var pt={RUNNING:{label:"\u5B9F\u884C\u4E2D",className:"bg-blue-100 text-blue-800"},SUCCEEDED:{label:"\u6210\u529F",className:"bg-emerald-100 text-emerald-800"},FAILED:{label:"\u5931\u6557",className:"bg-red-100 text-red-800"},FAILED_RETRY_SCHEDULED:{label:"\u5931\u6557 (\u518D\u8A66\u884C\u4E88\u5B9A)",className:"bg-amber-100 text-amber-800"}},on={RUNNING:{label:"\u5B9F\u884C\u4E2D",className:"bg-blue-100 text-blue-800",bar:"bg-blue-400"},SUCCEEDED:{label:"\u6210\u529F",className:"bg-emerald-100 text-emerald-800",bar:"bg-emerald-500"},SKIPPED:{label:"\u7701\u7565",className:"bg-slate-100 text-slate-700",bar:"bg-slate-300"},FAILED:{label:"\u5931\u6557",className:"bg-red-100 text-red-800",bar:"bg-red-500"}},aa={ingest:"\u53D6\u308A\u8FBC\u307F",retry:"\u518D\u8A66\u884C",resync:"\u518D\u540C\u671F"},ho="\u6587\u66F8\u306E\u72B6\u614B\u306E\u8A18\u9332";function $t(e){return ir(e)?`\u77E5\u3089\u306A\u3044\u6BB5 (${e.raw})`:e===xo?ho:dr[e].label}function lr(e){return ir(e)?`\u77E5\u3089\u306A\u3044\u7A2E\u985E (${e.raw})`:go[e]}var cr={RECORDED:"\u72B6\u614B\u3092\u8A18\u9332\u3057\u307E\u3057\u305F",UNCHANGED:"\u524D\u306E\u8A18\u9332\u304B\u3089\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093",ALREADY_RECORDED:"\u3053\u306E\u5B9F\u884C\u306E\u72B6\u614B\u306F\u8A18\u9332\u6E08\u307F\u3067\u3059"},ur="\u672A\u5B8C\u4E86";function Nt(e){return e.status==="FAILED"&&e.retryScheduled?"FAILED_RETRY_SCHEDULED":e.status}var So={no_pages:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u30DA\u30FC\u30B8\u306A\u3057)",no_pages_rendered:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u63CF\u753B\u3067\u304D\u305F\u30DA\u30FC\u30B8\u306A\u3057)",covered_by_page_recognition:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u89AA\u306E\u7248\u9762\u306E\u8A8D\u8B58\u304C\u8AAD\u3093\u3060\u30DA\u30FC\u30B8\u306E\u753B\u50CF)"};function Pn(e){let t=bo(e);if(t===null)return e;switch(t.kind){case"gate_closed":return`${t.featureFlagKey} \u304C\u7121\u52B9`;case"no_children":return"\u5B50\u30A2\u30BB\u30C3\u30C8\u306A\u3057";case"source_skipped":return`${dr[t.stepKey].label} \u304C\u5B9F\u884C\u3055\u308C\u306A\u304B\u3063\u305F`;case"nothing_to_read":return So[t.token];case"superseded":return"\u5B9F\u884C\u306E\u7248\u304C\u73FE\u5728\u306E\u7248\u3067\u306A\u304F\u306A\u3063\u305F";case"recording_disabled":return"\u8A18\u9332\u306E\u5207\u66FF\u304C\u7121\u52B9";case"recording_misconfigured":return"\u8A18\u9332\u306E\u5207\u66FF\u306E\u8A2D\u5B9A\u306E\u8AA4\u308A";case"not_protected":return"\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4ED8\u3044\u3066\u3044\u306A\u3044"}}import{formatInstant as vo}from"@aiquants/console-ui/core";function pr(e,t){return vo(e,tn,t)}import{jsx as mr}from"react/jsx-runtime";function pe({iso:e,testId:t}){let{timeZone:n}=I();return mr(je,{text:e===null?null:pr(e,n),testId:t})}function jt({iso:e,testId:t}){return I(),e===null?ur:mr(pe,{iso:e,testId:t})}import{Fragment as gr,jsx as Je,jsxs as ra}from"react/jsx-runtime";var Ro="document-changes";function Wl({host:e,onOpen:t}){let{labels:n}=I(),a=yr(null),s=yr(null),r=Ht(Ro,{first:$=>e.loadChanges(null,$).then(P=>fr(P,i=>({rows:i.rows,next:i.next,meta:null}))),next:($,P)=>e.loadChanges($,P).then(i=>(!i.ok&&i.status===Eo&&r.reload(),fr(i,L=>({rows:L.rows,next:L.next}))))},0),l=Ye(()=>a.current),d=r.state.kind==="ready"?r.state.refreshFailure:null,o=vt(d);return Je(at,{title:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",headingRef:a,testId:"change-feed",children:(()=>{if(r.state.kind==="failed")return Je(ct,{failure:r.state,onReload:r.reload,forbiddenMessage:ht,failureMessage:St("\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316"),rescueRef:l,testId:"change-feed-failed"});if(r.state.kind!=="ready")return Je("p",{"aria-busy":"true","data-testid":"change-feed-loading",children:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:$}=r.state,P=$.rows.map((i,L)=>({row:i,position:L}));return ra(gr,{children:[d!==null&&Je(Be,{occurrence:o,testId:"change-feed-refresh-failed",children:_n(n,d,"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316")}),Je(yt,{caption:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",captionHidden:!0,columns:[{key:"time",header:"\u6642\u523B",width:{fixedPx:rt(Tn)},align:"start",cell:({row:i,position:L})=>Je(pe,{iso:i.kind==="readable"?i.item.settledAt:i.settledAt,testId:`change-feed-time-value-${L}`})},{key:"document",header:"\u6587\u66F8",width:{minPx:Ne},align:"start",cell:({row:i})=>i.kind==="readable"?ra(gr,{children:[Je("span",{children:i.item.fileName})," ",Je("span",{children:i.item.fileUri})]}):Je("span",{"data-restricted-mark":"change",children:xt})},{key:"revision",header:"\u7248",width:{fixedPx:rt("r00000 \u2192 r00000")},align:"start",cell:({row:i})=>i.kind==="readable"?Jn(i.item.previousRevision,i.item.revision):null},{key:"cause",header:"\u5951\u6A5F",width:{fixedPx:Lt(Object.values(Vt))},align:"start",cell:({row:i})=>i.kind==="readable"?Vt[i.item.cause]:null},{key:"actor",header:"\u64CD\u4F5C\u8005",width:{minPx:Ne},align:"start",cell:({row:i})=>i.kind==="readable"?i.item.actor:null},{key:"facets",header:"\u5909\u308F\u3063\u305F\u9762",width:{minPx:Ne},align:"start",cell:({row:i,position:L})=>i.kind==="readable"?i.item.changes.map(A=>Je(Ue,{tone:"neutral",variant:"tint",testId:`change-feed-badge-${L}-${A.facet}`,children:In(A)},A.facet)):null},...t===void 0?[]:[{key:"open",header:"\u958B\u304F",width:{fixedPx:Gt("\u958B\u304F")},align:"start",cell:({row:i})=>i.kind==="readable"?ra(xe,{variant:"secondary",onClick:()=>t(i.item.metadataId,i.item.stateId),testId:`change-feed-open-${i.item.stateId}`,children:["\u958B\u304F ",Je(Sn,{testId:`change-feed-open-name-${i.item.stateId}`,children:`${i.item.fileName} ${Jn(i.item.previousRevision,i.item.revision)} \u306E\u5909\u5316`})]}):null}]],rows:P,rowKey:({row:i,position:L})=>nr(i,L),rowTestId:"change-feed-row",rowData:({row:i})=>({"data-row-kind":i.kind}),rowSize:t===void 0?"row":"row-control",empty:"\u76F4\u8FD1\u306E\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:"change-feed-table",ref:s}),Je(Bt,{onLoad:r.loadMore,busy:$.loadingMore||r.state.refreshing,done:$.next===null,failure:$.moreFailure,limit:No,rows:{count:P.length,ref:s},testId:"change-feed-more"})]})})()})}import{reasonAside as bi,TOKENS as ba}from"@aiquants/console-ui/core";import{useCallback as xi,useEffect as An,useId as fa,useRef as ot,useState as Xt}from"react";import{TOKENS as Uo}from"@aiquants/console-ui/core";import{DOCUMENT_FACETS as Bo}from"@aiquants/enrichment-core";import{useCallback as Ho,useEffect as Ko,useId as Vo,useMemo as Go,useState as jo}from"react";import{useState as Lo}from"react";import{mapOutcome as br}from"@aiquants/console-ui/core";import{DIFF_LINE_PAGE_MAX as sa}from"@aiquants/enrichment-core";import{useCallback as hr,useEffect as ia,useId as Io,useRef as Sr,useState as wn}from"react";import{Fragment as Rr,jsx as B,jsxs as Te}from"react/jsx-runtime";var da="\u5E45\u304C\u8DB3\u308A\u306A\u3044\u305F\u3081 1 \u5217\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059",vr={context:"",removed:"\u2212",added:"+"},Er={whiteSpace:"pre-wrap",overflowWrap:"anywhere"};function oa(e){let t=e.newLines>0?e.newStart:e.oldStart,n=e.firstPage===null?"":` (p.${e.firstPage})`;return`${t} \u884C\u76EE${n} +${e.linesAdded} \u2212${e.linesRemoved}`}function _o(e){return e.reduce((t,n)=>Math.max(t,n.oldStart+n.oldLines-1,n.newStart+n.newLines-1),0)}function Co(e){return e.reduce((t,{line:n})=>Math.max(t,n.oldNumber??0,n.newNumber??0),0)}function To(e){let t=[],n=0;for(let a=1;a<=e.length;a++)(a===e.length||e[a].page!==e[n].page)&&(t.push(...ko(e.slice(n,a).map(({line:s})=>s))),n=a);return t}function ko(e){let t=[],n=[],a=[],s=()=>{for(let r=0;r<Math.max(n.length,a.length);r++)t.push({left:n[r]??null,right:a[r]??null});n=[],a=[]};for(let r of e)r.kind==="context"?(s(),t.push({left:r,right:r})):r.kind==="removed"?(a.length>0&&s(),n.push(r)):a.push(r);return s(),t}function Nr(e){return e.segments.map((t,n)=>{let a=`${n}`;return t.kind==="removed"?B("del",{"data-cui-surface":"danger-tint","data-cui-fg":"fg","data-segment":"removed",children:t.text},a):t.kind==="added"?B("ins",{"data-cui-surface":"success-tint","data-cui-fg":"fg","data-segment":"added",children:t.text},a):B("span",{children:t.text},a)})}function xr(e,t){return Te(Rr,{children:[B("td",{"data-line-number":t,children:e===null?"":t==="old"?e.oldNumber:e.newNumber}),B("td",{"data-line-sign":!0,children:e===null?"":vr[e.kind]}),B("td",{style:Er,"data-line-text":t,children:e===null?null:Nr(e)})]})}function Po({states:e,target:t,hunk:n,layout:a,tableLabel:s,readLines:r,rescueTarget:l,onLines:d,testId:o}){let b={...e,...t,hunk:n},$=JSON.stringify([e.fromStateId,e.toStateId,t,n]),P=Ht($,{first:v=>r({...b,offset:0,limit:sa},v).then(D=>br(D,C=>({rows:C.lines.map(G=>({line:G,page:0})),next:C.next,meta:null}))),next:(v,D)=>r({...b,offset:v,limit:sa},D).then(C=>br(C,G=>({rows:G.lines.map(h=>({line:h,page:v})),next:G.next})))},0),i=Ye(l),L=Sr(null),A=P.state.kind==="ready"?P.state.value.rows:null;if(ia(()=>{A!==null&&d(Co(A))},[A,d]),P.state.kind==="failed")return B(ct,{failure:P.state,onReload:P.reload,forbiddenMessage:ht,failureMessage:St("\u5DEE\u5206\u306E\u884C"),rescueRef:i,testId:`${o}-failed`});if(P.state.kind!=="ready")return B("p",{"aria-busy":"true","data-testid":`${o}-loading`,children:"\u5DEE\u5206\u306E\u884C\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:m}=P.state,y=a==="split"?To(m.rows):null;return Te("div",{"data-testid":o,"data-layout":a,children:[Te("table",{"aria-label":s,"data-testid":`${o}-lines`,"data-cui-type":"body","data-cui-face":"mono",children:[B("thead",{children:a==="split"?Te("tr",{children:[B("th",{scope:"col",children:"\u65E7"}),B("th",{scope:"col",children:"\u7B26\u53F7"}),B("th",{scope:"col",children:"\u53E4\u3044\u672C\u6587"}),B("th",{scope:"col",children:"\u65B0"}),B("th",{scope:"col",children:"\u7B26\u53F7"}),B("th",{scope:"col",children:"\u65B0\u3057\u3044\u672C\u6587"})]}):Te("tr",{children:[B("th",{scope:"col",children:"\u65E7"}),B("th",{scope:"col",children:"\u65B0"}),B("th",{scope:"col",children:"\u7B26\u53F7"}),B("th",{scope:"col",children:"\u672C\u6587"})]})}),B("tbody",{ref:L,children:y===null?m.rows.map(({line:v},D)=>Te("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":v.kind,children:[B("td",{"data-line-number":"old",children:v.oldNumber}),B("td",{"data-line-number":"new",children:v.newNumber}),B("td",{"data-line-sign":!0,children:vr[v.kind]}),B("td",{style:Er,"data-line-text":"unified",children:Nr(v)})]},D)):y.map(v=>Te("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":v.left===v.right?"context":"changed",children:[xr(v.left,"old"),xr(v.right,"new")]},`${v.left?.oldNumber??""}:${v.right?.newNumber??""}`))})]}),B(Bt,{onLoad:P.loadMore,busy:m.loadingMore||P.state.refreshing,done:m.next===null,failure:m.moreFailure,limit:sa,rows:{count:y===null?m.rows.length:y.length,ref:L},testId:`${o}-more`})]})}function wo(){let[e,t]=wn(null);return[hr((a=>{let s=new ResizeObserver(r=>{for(let l of r)t(l.contentRect.width)});return s.observe(a),()=>s.disconnect()}),[]),e]}function Ln({states:e,target:t,index:n,readLines:a,label:s,rescueTarget:r,onNarrowChange:l,testId:d}){I();let o=Io(),[b,$]=wn("split"),[P,i]=wn(()=>new Set(n===null?[0]:[])),[L,A]=wn(0),[m,y]=wo(),v=Sr(new Map),D=hr(T=>A(ae=>Math.max(ae,T)),[]),C=sr(Math.max(n===null?0:_o(n.hunks),L)),G=y!==null&&y>=C,h=b==="split"&&G?"split":"unified",M=b==="split"&&y!==null&&!G;ia(()=>{l(o,M)},[o,M,l]),ia(()=>()=>l(o,!1),[o,l]);let O=(T,ae)=>i(J=>{let Le=new Set(J);return ae?Le.add(T):Le.delete(T),Le}),re=T=>`${o}-hunk-${T}`,Ee=(T,ae)=>B(Po,{states:e,target:t,hunk:T,layout:h,tableLabel:ae,readLines:a,rescueTarget:()=>v.current.get(T)??r(),onLines:D,testId:`${d}-hunk-${T}-body`});return Te("div",{"data-cui-migration":"pending",ref:m,"data-testid":d,"data-layout":h,"data-split-min-px":C,children:[n!==null&&Te(Rr,{children:[Te("dl",{"data-testid":`${d}-stats`,children:[Te("div",{children:[B("dt",{children:"\u8FFD\u52A0\u3057\u305F\u884C"}),B("dd",{children:B(te,{value:n.stats.linesAdded,testId:`${d}-lines-added`})})]}),Te("div",{children:[B("dt",{children:"\u524A\u9664\u3057\u305F\u884C"}),B("dd",{children:B(te,{value:n.stats.linesRemoved,testId:`${d}-lines-removed`})})]}),Te("div",{children:[B("dt",{children:"\u5909\u308F\u3089\u306A\u3044\u884C"}),B("dd",{children:B(te,{value:n.stats.linesUnchanged,testId:`${d}-lines-unchanged`})})]}),Te("div",{children:[B("dt",{children:"\u8FFD\u52A0\u3057\u305F\u5B57"}),B("dd",{children:B(te,{value:n.stats.charsAdded,testId:`${d}-chars-added`})})]}),Te("div",{children:[B("dt",{children:"\u524A\u9664\u3057\u305F\u5B57"}),B("dd",{children:B(te,{value:n.stats.charsRemoved,testId:`${d}-chars-removed`})})]}),Te("div",{children:[B("dt",{children:"\u985E\u4F3C\u5EA6"}),B("dd",{children:B(je,{text:n.stats.similarity===null?null:`${(n.stats.similarity*100).toFixed(1)}%`,testId:`${d}-similarity`})})]})]}),n.attributes.length>0&&B("ul",{"data-testid":`${d}-attributes`,children:n.attributes.map(T=>Te("li",{"data-field":T.field,children:[an(T.field)," ",wt(T.before)," \u2192 ",wt(T.after)]},T.field))}),n.hunks.length>0&&B("ol",{"aria-label":"\u5909\u5316\u306E\u584A","data-testid":`${d}-hunk-index`,children:n.hunks.map(T=>B("li",{children:B("a",{href:`#${re(T.hunk)}`,onClick:()=>O(T.hunk,!0),"data-hunk":T.hunk,children:oa(T)})},T.hunk))})]}),B(xe,{variant:"secondary",onClick:()=>$(b==="split"?"unified":"split"),dataAttributes:{"data-preferred":b},testId:`${d}-layout-toggle`,children:b==="split"?"1 \u5217\u3067\u8868\u793A":"\u4E26\u3079\u3066\u8868\u793A"}),M&&B("p",{"data-testid":`${d}-narrow`,children:da}),n===null?Ee(0,s):n.hunks.map(T=>{let ae=P.has(T.hunk);return Te("div",{id:re(T.hunk),"data-testid":`${d}-hunk-${T.hunk}`,"data-open":ae,children:[B(xe,{variant:"secondary",expanded:ae,controls:`${re(T.hunk)}-body`,onClick:()=>O(T.hunk,!ae),ref:J=>{J===null?v.current.delete(T.hunk):v.current.set(T.hunk,J)},testId:`${d}-hunk-${T.hunk}-toggle`,children:oa(T)}),B("div",{id:`${re(T.hunk)}-body`,children:ae&&Ee(T.hunk,`${s} ${oa(T)}`)})]},T.hunk)})]})}import{Fragment as Do,jsx as qt,jsxs as $n}from"react/jsx-runtime";function $o(e){let t=[e.page===null?null:`p.${e.page}`,e.sheet===null?null:`\u30B7\u30FC\u30C8 ${e.sheet}`,e.slide===null?null:`\u30B9\u30E9\u30A4\u30C9 ${e.slide}`,e.startSec===null?null:`${e.startSec}${e.endSec===null?"":`\u2013${e.endSec}`} \u79D2`].filter(n=>n!==null);return t.length===0?"\u4F4D\u7F6E\u306A\u3057":t.join("\u30FB")}function Ir(e){return e.new??e.old}function _r(e){return e.kind==="MODIFIED"&&e.old?.fidelity!=="UNVERIFIED"&&e.new?.fidelity!=="UNVERIFIED"}function Cr({states:e,stats:t,entries:n,textUnchangedChunkingChanged:a,readLines:s,rescueTarget:r,onNarrowChange:l,testId:d}){I();let[o,b]=Lo(()=>new Set),$=i=>b(L=>{let A=new Set(L);return A.delete(i)||A.add(i),A}),P=i=>{let L=[i.old===null?null:["\u65E7",i.old],i.new===null?null:["\u65B0",i.new]].filter(m=>m!==null),A=new Set(L.flatMap(([,m])=>m.fidelity==="UNVERIFIED"?[Ga]:m.fidelity==="WHITESPACE_NORMALIZED"?[Va]:[]));return $n(Do,{children:[L.map(([m,y])=>$n("span",{"data-fidelity":y.fidelity,"data-side":m,children:[m," ",Ka[y.fidelity]," "]},m)),[...A].map(m=>qt("span",{"data-chunk-note":!0,children:m},m))]})};return $n("div",{"data-testid":d,children:[a&&qt(Xe,{tone:"info",testId:`${d}-chunking-only`,children:ja}),$n("p",{"data-testid":`${d}-stats`,children:["\u8FFD\u52A0 ",t.added,"\u30FB\u524A\u9664 ",t.removed,"\u30FB\u5909\u66F4 ",t.modified,"\u30FB\u79FB\u52D5 ",t.moved,"\u30FB\u5909\u308F\u3089\u306A\u3044 ",t.unchanged]}),qt(yt,{caption:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF",captionHidden:!0,columns:[{key:"kind",header:"\u7A2E\u985E",width:{fixedPx:Lt(Object.values(Yn))},align:"start",cell:i=>Yn[i.kind]},{key:"position",header:"\u4F4D\u7F6E",width:{minPx:Ne},align:"start",cell:i=>$o(Ir(i))},{key:"heading",header:"\u898B\u51FA\u3057",width:{minPx:Ne},align:"start",cell:i=>Ir(i).breadcrumbs},{key:"numbers",header:"\u65E7 # \u2192 \u65B0 #",width:{fixedPx:rt("#00000 \u2192 #00000")},align:"start",cell:i=>`${i.old===null?"(\u306A\u3057)":`#${i.old.index}`} \u2192 ${i.new===null?"(\u306A\u3057)":`#${i.new.index}`}`},{key:"fidelity",header:"\u672C\u6587\u306E\u518D\u73FE",width:{minPx:Ne},align:"start",cell:P},{key:"diff",header:"\u5DEE\u5206",width:{fixedPx:Gt("\u5DEE\u5206\u3092\u9589\u3058\u308B")},align:"start",cell:i=>_r(i)?qt(xe,{variant:"secondary",expanded:o.has(i.entry),controls:`${d}-diff-${i.entry}`,onClick:()=>$(i.entry),testId:`${d}-diff-toggle-${i.entry}`,children:o.has(i.entry)?"\u5DEE\u5206\u3092\u9589\u3058\u308B":"\u5DEE\u5206\u3092\u958B\u304F"}):null}],rows:n,rowKey:i=>`${i.entry}`,rowTestId:`${d}-row`,rowData:i=>({"data-entry":i.entry,"data-kind":i.kind}),rowSize:"row-control",empty:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${d}-table`}),n.filter(i=>_r(i)&&o.has(i.entry)).map(i=>{let L=`\u30C1\u30E3\u30F3\u30AF #${i.old?.index} \u2192 #${i.new?.index} \u306E\u5DEE\u5206`;return qt("section",{id:`${d}-diff-${i.entry}`,"aria-label":L,"data-testid":`${d}-diff-${i.entry}`,children:qt(Ln,{states:e,target:{facet:"chunks",entry:i.entry},index:null,readLines:s,label:L,rescueTarget:r,onNarrowChange:l,testId:`${d}-diff-${i.entry}-view`})},i.entry)})]})}import{compareTreePaths as Ao,treePathLabel as Oo}from"@aiquants/enrichment-core";import{useMemo as Mo}from"react";import{jsx as Tr}from"react/jsx-runtime";function Fo(e){let t=new Set;for(let{path:n}of e){if(t.has(n))throw new RangeError(`A tree path list holds the path ${JSON.stringify(n)} more than once.`);t.add(n)}return e.map(({path:n,item:a})=>({path:n,label:Oo(n),item:a})).sort((n,a)=>Ao(n.path,a.path))}function Dn({items:e,renderItem:t,testId:n}){I();let a=Mo(()=>Fo(e),[e]);return Tr("ol",{role:"list","data-testid":n,children:a.map(({path:s,label:r,item:l})=>Tr("li",{"data-testid":`${n}-item-${s}`,children:t(l,r,s)},s))})}import{Fragment as ua,jsx as Oe,jsxs as st}from"react/jsx-runtime";var qo={fontSize:`${Et}px`,fontWeight:Uo.weight.bold},kr={whiteSpace:"pre-wrap",overflowWrap:"anywhere",margin:0},Pr={add:"\u8FFD\u52A0",remove:"\u524A\u9664",replace:"\u7F6E\u63DB"},zo=Lt(Object.values(Nn));function Xo(e,t,n){let a=s=>Object.fromEntries(t.map(r=>[r.field,l=>Oe("span",{"data-testid":`${n}-${r.field}-${s}-${l}`,children:wt(r[s])})]));return Oe(xn,{caption:`${e}\u306E\u5909\u5316`,attributes:t.map(s=>({key:s.field,label:an(s.field)})),columns:[{key:"before",heading:"\u5909\u66F4\u524D",cells:a("before")},{key:"after",heading:"\u5909\u66F4\u5F8C",cells:a("after")}],attributePx:zo,columnMinPx:Ne,testId:n})}function dn(e,t,n){return t.length===0?null:st("div",{"data-testid":n,children:[st("p",{children:[e," (",t.length,")"]}),Oe("ul",{children:t.map(([a,s])=>Oe("li",{children:s},a))})]})}function la(e,t,n){return t.length===0?null:st("div",{"data-testid":n,children:[st("p",{children:[e," (",t.length,")"]}),Oe(Dn,{items:t,renderItem:(a,s)=>`${s}: ${a}`,testId:`${n}-tree`})]})}var ca=e=>JSON.stringify(e.value),Lr=e=>e.fields.map(t=>`${an(t.field)} ${wt(t.before)} \u2192 ${wt(t.after)}`).join("\u3001"),wr=e=>[e.key,`${e.key}: ${ca(e)}`],Yo=e=>[e.key,`${e.key}: ${Lr(e)}`];function Wo({diff:e,testId:t}){let n=Go(()=>({added:e.added.map(a=>({path:a.key,item:ca(a)})),removed:e.removed.map(a=>({path:a.key,item:ca(a)})),modified:e.modified.map(a=>({path:a.key,item:Lr(a)}))}),[e]);return st(ua,{children:[la("\u8FFD\u52A0",n.added,`${t}-added`),la("\u524A\u9664",n.removed,`${t}-removed`),la("\u5909\u66F4",n.modified,`${t}-modified`)]})}function $r({states:e,comparison:t,readLines:n,rescueTarget:a,testId:s}){let{announce:r}=I(),l=Vo(),[d,o]=jo(()=>new Set),b=Ho((m,y)=>o(v=>{if(v.has(m)===y)return v;let D=new Set(v);return y?D.add(m):D.delete(m),D}),[]),$=d.size>0;Ko(()=>{$&&r(da)},[$,r]);let P=t.facets.filter(m=>m.change==="CHANGED"),i=Bo.filter(m=>!P.some(y=>y.facet===m)),L=m=>`${l}-${m}`,A=m=>{let y=`${s}-${m.facet}`;switch(m.facet){case"classification":case"metadata":return Xo(Pt[m.facet],m.fields,`${y}-grid`);case"labels":return st(ua,{children:[dn("\u8FFD\u52A0",m.added.map(wr),`${y}-added`),dn("\u524A\u9664",m.removed.map(wr),`${y}-removed`),dn("\u5909\u66F4",m.modified.map(Yo),`${y}-modified`)]});case"assets":return Oe(Wo,{diff:m,testId:y});case"tags":return st(ua,{children:[dn("\u8FFD\u52A0",m.added.map(v=>[v,v]),`${y}-added`),dn("\u524A\u9664",m.removed.map(v=>[v,v]),`${y}-removed`)]});case"structured_data":return Oe(yt,{caption:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF\u306E\u64CD\u4F5C",captionHidden:!0,columns:[{key:"op",header:"\u64CD\u4F5C",width:{fixedPx:Lt(Object.values(Pr))},align:"start",cell:({operation:v})=>Pr[v.op]},{key:"path",header:"\u9053",width:{minPx:Ne},align:"start",cell:({operation:v})=>v.path===""?"(\u6839)":v.path},{key:"before",header:"\u5909\u66F4\u524D",width:{minPx:Ne},align:"start",cell:({operation:v})=>v.op==="add"?null:Oe("pre",{style:kr,children:JSON.stringify(v.previous,null,2)})},{key:"after",header:"\u5909\u66F4\u5F8C",width:{minPx:Ne},align:"start",cell:({operation:v})=>v.op==="remove"?null:Oe("pre",{style:kr,children:JSON.stringify(v.value,null,2)})}],rows:m.operations.map((v,D)=>({operation:v,position:D})),rowKey:({position:v})=>`${v}`,rowTestId:`${y}-operation`,rowData:({operation:v})=>({"data-op":v.op}),rowSize:"row",empty:"\u64CD\u4F5C\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${y}-operations`});case"text":case"summary":return Oe(Ln,{states:e,target:{facet:m.facet},index:m,readLines:n,label:Pt[m.facet],rescueTarget:a,onNarrowChange:b,testId:`${y}-diff`});case"chunks":return Oe(Cr,{states:e,stats:m.stats,entries:m.entries,textUnchangedChunkingChanged:m.textUnchangedChunkingChanged,readLines:n,rescueTarget:a,onNarrowChange:b,testId:`${y}-table`})}};return st("div",{"data-cui-migration":"pending","data-testid":s,children:[P.length>0&&Oe("nav",{"aria-label":"\u5909\u308F\u3063\u305F\u9762","data-testid":`${s}-nav`,children:Oe("ul",{children:P.map(m=>Oe("li",{children:Oe("a",{href:`#${L(m.facet)}`,"data-facet":m.facet,children:Pt[m.facet]})},m.facet))})}),P.map(m=>st("section",{id:L(m.facet),"aria-labelledby":`${L(m.facet)}-heading`,"data-testid":`${s}-${m.facet}`,"data-facet":m.facet,children:[Oe("h4",{id:`${L(m.facet)}-heading`,style:qo,children:Pt[m.facet]}),A(m)]},m.facet)),i.length>0&&st("p",{"data-testid":`${s}-unchanged`,children:["\u5909\u5316\u306A\u3057: ",i.map(m=>Pt[m]).join("\u30FB")]})]})}import{isUnknownTerm as Jo,PIPELINE_STEPS as Qo,RUN_TERMINAL_STEP_KEY as Dr,RunTerminalStepDetailSchema as Zo,storedTermText as ei}from"@aiquants/enrichment-core";import{useMemo as ti}from"react";import{Fragment as ma,jsx as Q,jsxs as ke}from"react/jsx-runtime";var ni=8,ai={text_layer:"\u6587\u5B57\u5C64",ocr:"OCR",transcript:"\u8EE2\u5199"},ri={provider:"\u30D7\u30ED\u30D0\u30A4\u30C0",model:"\u30E2\u30C7\u30EB",engine:"\u30A8\u30F3\u30B8\u30F3",prompt_key:"\u30D7\u30ED\u30F3\u30D7\u30C8",prompt_version:"\u7248",duration_ms:"\u51E6\u7406\u6642\u9593",input_chars:"\u5165\u529B\u6587\u5B57\u6570",output_chars:"\u51FA\u529B\u6587\u5B57\u6570",chunk_count:"\u30C1\u30E3\u30F3\u30AF",points_upserted:"\u6295\u5165\u70B9\u6570",collection:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3",embedding_model:"\u57CB\u3081\u8FBC\u307F\u30E2\u30C7\u30EB",graph_nodes:"\u30B0\u30E9\u30D5\u30CE\u30FC\u30C9"},Ar={duration_ms:"ms",input_chars:void 0,output_chars:void 0,chunk_count:void 0,points_upserted:void 0,graph_nodes:void 0},si=["provider","model","engine","prompt_key","prompt_version","duration_ms","input_chars","output_chars","chunk_count","points_upserted","collection","embedding_model","graph_nodes"],oi=["FAILED","RUNNING","SUCCEEDED","SKIPPED"],ii="\u6728\u306E\u9053\u3092\u6301\u305F\u306A\u3044\u8A18\u9332 (\u79FB\u884C\u306E\u9014\u4E2D)",di={atomic:"whitespace-nowrap",anywhere:"wrap-anywhere"};function Or(e){return Object.hasOwn(Ar,e)}function ln(e,t){return`run-step-provenance-value-${e}-${t}`}function li(e,t,n){if(Or(t)){let s=e[t];return s===null?null:Q(te,{value:s,unit:Ar[t],testId:ln(n,t)})}let a=e[t];return a===null?null:Q(sn,{text:String(a),testId:ln(n,t)})}function ci(e,t){let n=si.map(r=>({key:r,label:ri[r],value:li(e,r,t),breaks:Or(r)?"atomic":"anywhere"})),a=e.pages_read!==null||e.pages_total!==null,s=ke(ma,{children:[Q(te,{value:e.pages_read,testId:ln(t,"pages_read")})," / ",Q(te,{value:e.pages_total,testId:ln(t,"pages_total")})]});return[...n,{key:"pages",label:"\u8AAD\u3093\u3060\u30DA\u30FC\u30B8",value:a?s:null,breaks:"atomic"},{key:"body_source",label:"\u672C\u6587\u306E\u51FA\u6240",value:e.body_source===null?null:Q(sn,{text:ai[e.body_source],testId:ln(t,"body_source")}),breaks:"anywhere"}]}function ui(e,t){let n=new Map,a=[];for(let r of t){if(r.targetTreePath===null){a.push(r);continue}let l=n.get(r.targetTreePath);l===void 0?n.set(r.targetTreePath,[r]):l.push(r)}let s=Array.from(n,([r,l])=>({path:r,item:l}));return{kind:"fan_out",stepKey:e,steps:t,placed:s,pathless:a}}function pi(e){let t=[],n=new Map;for(let a of[...e.steps].sort((s,r)=>s.sequence-r.sequence)){let s=a.stepKey;if(s===Dr||Jo(s)||Qo[s].fanOut!=="children"||a.targetMetadataId===e.metadataId){t.push({kind:"step",step:a});continue}let r=n.get(s);if(r!==void 0){r.push(a);continue}let l=[a];n.set(s,l),t.push({kind:"fan_out",stepKey:s,steps:l})}return t.map(a=>a.kind==="step"?a:ui(a.stepKey,a.steps))}function mi(e){if(e.skipReason===null)throw new RangeError(`Step record #${e.id} is SKIPPED without a skip reason, which the pipeline record schema refuses.`);return e.skipReason}function fi({step:e}){let{labels:t}=I();if(e.status==="SKIPPED")return ke("p",{className:"text-[13px] text-slate-600","data-testid":`run-step-skip-reason-${e.sequence}`,children:["\u7701\u7565: ",Pn(mi(e))]});if(e.stepKey===Dr&&e.status==="SUCCEEDED"){let{outcome:l}=Zo.parse(e.provenance?.detail);return Q("p",{className:"text-[13px] text-slate-700","data-testid":`run-step-terminal-outcome-${e.sequence}`,"data-outcome":l,children:cr[l]})}if(e.provenance===null)return Q("p",{className:"text-[13px] text-slate-500","data-testid":`run-step-provenance-missing-${e.sequence}`,children:"\u6BB5\u306E\u5831\u544A\u306F\u3042\u308A\u307E\u305B\u3093\u3002"});let n=e.provenance,a=ci(n,e.sequence),s=a.filter(l=>l.value!==null),r=a.filter(l=>l.value===null);return ke(ma,{children:[s.length>0&&Q("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[13px] sm:grid-cols-3","data-testid":`run-step-provenance-${e.sequence}`,children:s.map(l=>ke("div",{className:"border-slate-100 border-b border-solid py-0.5",children:[Q("dt",{className:"text-slate-500",children:l.label}),Q("dd",{className:`text-slate-800 ${di[l.breaks]}`,"data-provenance-key":l.key,children:l.value})]},l.key))}),r.length>0&&ke("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":`run-step-unmeasured-${e.sequence}`,"data-unmeasured-note":!0,children:[t.unmeasured,": ",r.map(l=>l.label).join("\u3001")]}),Object.keys(n.detail).length>0&&ke("details",{className:"mt-2 text-[13px]","data-testid":`run-step-detail-${e.sequence}`,children:[Q("summary",{className:"cursor-pointer text-slate-600",children:"\u8A73\u7D30"}),Q("pre",{className:"mt-1 overflow-auto rounded-lg bg-slate-900 p-4 font-mono text-[11px] text-slate-100",children:JSON.stringify(n.detail,null,2)})]})]})}function pa(e,t,n,a,s){let r=on[e.status],l=s==="tree"?"div":"li",d=s==="alert"?{"data-cui-surface":"surface","data-cui-fg":"fg"}:void 0;return Q(l,{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-${e.sequence}`,"data-status":e.status,"data-step-key":ei(e.stepKey),...d,children:ke("details",{open:a,className:"group/step","data-testid":`run-step-card-${e.sequence}`,children:[ke("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[Q("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/step:rotate-90",children:"\u25B6"}),Q("span",{className:"font-semibold text-[13px] text-slate-900",children:t}),e.strategyId!==null&&ke("span",{className:"rounded-sm bg-indigo-50 px-1.5 py-0.5 text-[11px] text-indigo-800","data-testid":`run-step-strategy-${e.sequence}`,children:["\u6226\u7565 #",e.strategyId]}),Q("span",{className:`inline-flex rounded-full px-2 py-0.5 font-semibold text-[11px] ${r.className}`,"data-testid":`run-step-status-${e.sequence}`,"data-status":e.status,children:r.label}),Q("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-step-duration-${e.sequence}`,children:Q(te,{value:e.durationMs,unit:"ms",testId:`run-step-duration-value-${e.sequence}`})})]}),ke("div",{className:"space-y-2 px-4 pb-4",children:[e.durationMs!==null&&n>0&&Q("div",{className:"h-2 rounded-full bg-slate-100",children:Q("div",{className:`h-2 rounded-full ${r.bar}`,style:{width:`${e.durationMs/n*100}%`},"data-testid":`run-step-bar-${e.sequence}`})}),e.errorMessage!==null&&ke("p",{className:"wrap-anywhere text-[13px] text-red-700","data-testid":`run-step-error-${e.sequence}`,children:[e.errorCode===null?"":`${e.errorCode}: `,e.errorMessage,e.httpStatus===null?"":` (HTTP ${e.httpStatus})`]}),Q(fi,{step:e})]})]})},e.id)}var yi=`${ii}: \u6728\u306E\u4E2D\u306E\u5834\u6240\u3092\u793A\u305B\u306A\u3044\u305F\u3081\u3001\u6BB5\u306E\u8A18\u9332\u306E ID \u3068\u5BFE\u8C61\u306E ID (#<\u6BB5\u306E\u8A18\u9332> \u2192 #<\u5BFE\u8C61>) \u3067\u540D\u6307\u3057\u307E\u3059\u3002`;function gi({steps:e,longestDuration:t,opensEverything:n,testId:a}){let s=vt(e);return Q(Be,{occurrence:s,testId:a,children:ke("div",{className:"space-y-3",children:[Q("p",{"data-testid":`${a}-reason`,children:yi}),Q("ol",{role:"list","data-testid":`${a}-list`,children:e.map(r=>pa(r,Q("span",{"data-testid":`run-step-target-${r.sequence}`,children:`#${r.id} \u2192 #${r.targetMetadataId}`}),t,r.status==="FAILED"||n,"alert"))})]})})}function Mr({run:e}){I();let t=e.steps.reduce((s,r)=>r.durationMs===null?s:Math.max(s,r.durationMs),0),n=e.steps.length<=ni,a=ti(()=>pi(e),[e]);return Q("ol",{"data-cui-migration":"pending",className:"space-y-3","data-testid":"run-steps",children:a.map(s=>{if(s.kind==="step"){let d=s.step,o=ke(ma,{children:[$t(d.stepKey),d.targetMetadataId!==e.metadataId&&ke("span",{className:"ml-2 rounded-sm bg-slate-100 px-1.5 py-0.5 font-normal text-[11px] text-slate-600","data-testid":`run-step-target-${d.sequence}`,children:["\u5BFE\u8C61 #",d.targetMetadataId]})]});return pa(d,o,t,d.status==="FAILED"||n,"timeline")}let r=s.steps.some(d=>d.status==="FAILED"),l=oi.map(d=>({status:d,count:s.steps.filter(o=>o.status===d).length})).filter(({count:d})=>d>0);return Q("li",{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-group-${s.stepKey}`,"data-count":s.steps.length,children:ke("details",{open:r||s.pathless.length>0||n,className:"group/fanout","data-testid":`run-step-group-card-${s.stepKey}`,children:[ke("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[Q("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/fanout:rotate-90",children:"\u25B6"}),Q("span",{className:"font-semibold text-[13px] text-slate-900",children:$t(s.stepKey)}),ke("span",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 text-[11px] text-slate-600","data-testid":`run-step-group-count-${s.stepKey}`,children:["\u5BFE\u8C61 ",s.steps.length," \u4EF6"]}),Q("span",{className:"text-[11px] text-slate-600","data-testid":`run-step-group-statuses-${s.stepKey}`,children:l.map(({status:d,count:o})=>`${on[d].label} ${o}`).join(" \xB7 ")})]}),ke("div",{className:"space-y-3 px-4 pb-4 [&_li+li]:mt-3 [&_li>div+div]:mt-3",children:[s.pathless.length>0&&Q(gi,{steps:s.pathless,longestDuration:t,opensEverything:n,testId:`run-step-group-pathless-${s.stepKey}`}),s.placed.length>0&&Q(Dn,{items:s.placed,renderItem:(d,o)=>d.map(b=>pa(b,Q("span",{"data-testid":`run-step-target-${b.sequence}`,children:`${o} (#${b.targetMetadataId})`}),t,b.status==="FAILED"||n,"tree")),testId:`run-step-tree-${s.steps[0].sequence}`})]})]})},`group-${s.stepKey}`)})})}import{Fragment as zt,jsx as g,jsxs as Y}from"react/jsx-runtime";var hi={fontSize:`${ba.type.title.size}px`,fontWeight:ba.weight.bold},Si={fontSize:`${Et}px`,fontWeight:ba.weight.bold},ya={RUNNING:"info",SUCCEEDED:"success",FAILED:"danger",FAILED_RETRY_SCHEDULED:"warning"};function Fr({host:e,fromStateId:t,toStateId:n,rescueTarget:a}){let s={fromStateId:t,toStateId:n},r=jn(`${t}:${n}`,d=>e.compare(s,d),0),l=Ye(a);return r.state.kind==="failed"?g(ct,{failure:r.state,onReload:r.reload,forbiddenMessage:ht,failureMessage:St("\u6BD4\u8F03"),rescueRef:l,testId:"history-comparison-failed"}):r.state.kind!=="ready"?g("p",{"aria-busy":"true","data-testid":"history-comparison-loading",children:"\u6BD4\u8F03\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"}):g($r,{states:s,comparison:r.state.value,readLines:e.readLines,rescueTarget:a,testId:"history-change"})}function ga(e,t,n){let a=er(e,t);return[e.runOutcome==="FAILED"?g("span",{"data-testid":`${n}-failed-run`,"data-state-mark":"failed_run",children:Xa},"failed"):null,a.length>0?g("span",{"data-testid":`${n}-unrecorded-runs`,"data-state-mark":"unrecorded_runs",children:Wa(a)},"unrecorded"):null,e.modelOnlyChange?g("span",{"data-testid":`${n}-model-only`,"data-state-mark":"model_only",children:Ya},"model"):null].filter(s=>s!==null)}function vi(e,t){return e.changes===null?null:g("span",{"data-testid":`${t}-badges`,children:e.changes.map(n=>g(Ue,{tone:"neutral",variant:"tint",testId:`${t}-badge-${n.facet}`,children:In(n)},n.facet))})}function Ei({pinned:e,shown:t,onPin:n,onUnpin:a,fallback:s}){let r=ot(null),l=ot(null),d=Ye(()=>l.current??r.current??s()),o=xi(P=>(i=>{P.current=i;let L=d(i);return()=>{P.current=null,L()}}),[d]),[b]=Xt(()=>o(r)),[$]=Xt(()=>o(l));return e!==null?Y("p",{"data-testid":"history-pin",children:[g(Ue,{tone:"info",variant:"tint",testId:"history-pin-badge",children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})," ",Ge(e.revision)," ",g(pe,{iso:e.settledAt,testId:"history-pin-settled-at-value"})," ",g(xe,{variant:"secondary",onClick:a,ref:$,testId:"history-unpin",children:"\u5916\u3059"})]}):t===null?null:g("p",{"data-testid":"history-pin",children:g(xe,{variant:"secondary",onClick:()=>n(t.stateId),ref:b,testId:"history-pin-button",children:"\u6BD4\u8F03\u306E\u8D77\u70B9\u306B\u3059\u308B"})})}function Jc({host:e,metadataId:t,target:n,openRequest:a,onClose:s,returnFocusFallback:r,captureState:l}){let{labels:d,announce:o}=I(),b=fa(),$=fa(),P=fa(),i=ot(null),L=ot(null),A=ot(null),m=ot(null),y=ot(null),v=ot(null),D=ot(r),C=ot(0),[G,h]=Xt(null),[M,O]=Xt(null),[re,Ee]=Xt({metadataId:t,groups:{}});re.metadataId!==t&&Ee({metadataId:t,groups:{}});let[T,ae]=Xt(null),J=jn(t,x=>e.loadHistory(t,x),a),Le=Ye(()=>L.current),Ze=Ye(()=>L.current),He=J.state.kind==="ready"?J.state.refreshFailure:null,$e=vt(He),De=J.state.kind==="ready"&&J.state.refreshing,se=J.state.kind==="ready"?J.state.value:null,S=se===null?null:Za(se),ee=G!==null&&G.request===a?G.key:S===null?null:tr(n,S),F=S?.groups.flatMap(x=>x.items).find(x=>x.key===ee),oe=F===void 0||De?null:`revision:${F.kind==="run"?F.run.revision:F.state.revision}`,ge=Ye(()=>ee===null?L.current:A.current);An(()=>{D.current=r},[r]),An(()=>{if(y.current!==a){y.current=a,v.current=null;let x=document.activeElement;i.current?.contains(x)!==!0&&(m.current=(x instanceof HTMLElement||x instanceof SVGElement)&&x!==document.body?x:null),L.current?.focus();return}ee!==null&&ee===v.current&&(v.current=null,A.current?.focus())},[a,ee]),An(()=>{oe!==null&&Ee(x=>x.groups[oe]===!0?x:{metadataId:x.metadataId,groups:{...x.groups,[oe]:!0}})},[oe,a]),An(()=>()=>{y.current=null,C.current+=1;let x=m.current;if(x?.isConnected){x.focus();return}D.current()?.focus()},[]);let ie=x=>{x.key==="Escape"&&(x.stopPropagation(),s())},Me=x=>{if(x===ee){A.current?.focus();return}v.current=x,h({request:a,key:x})},p=x=>{C.current+=1;let E=C.current,U=T?.metadataId===t?T.failure:null;ae({metadataId:t,busy:!0,failure:U}),x(t).then(V=>{if(C.current===E){if(V.ok){ae({metadataId:t,busy:!1,failure:null}),o(V.value.outcome==="RECORDED"?"\u8A18\u9332\u3057\u307E\u3057\u305F":"\u524D\u306E\u8A18\u9332\u304B\u3089\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093"),J.refresh();return}ae({metadataId:t,busy:!1,failure:{status:V.status,reason:V.reason,occurrence:(U?.occurrence??0)+1}})}})},H=()=>{if(J.state.kind==="failed")return g(ct,{failure:J.state,onReload:J.reload,forbiddenMessage:ht,failureMessage:St("\u6587\u66F8\u306E\u5C65\u6B74"),rescueRef:Le,testId:"history-failed"});if(se===null||S===null)return g("p",{"aria-busy":"true","data-testid":"history-loading",children:"\u6587\u66F8\u306E\u5C65\u6B74\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let x=S.states,E=S.runs[0],U=l!==void 0&&E!==void 0&&!x.some(X=>X.runId===E.id),V=T?.metadataId===t?T:null,me=x[0];return Y("div",{ref:Ze,"data-testid":"history-content",children:[Y("dl",{"data-testid":"history-document",children:[Y("div",{children:[g("dt",{children:"URI"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-document-uri",children:se.document.fileUri})]}),Y("div",{children:[g("dt",{children:"\u73FE\u5728\u306E\u7248"}),g("dd",{"data-testid":"history-document-revision",children:Ge(se.document.revision)})]}),Y("div",{children:[g("dt",{children:"\u6A5F\u5BC6\u533A\u5206"}),g("dd",{"data-testid":"history-document-confidentiality",children:se.document.confidentialityLevel})]}),Y("div",{children:[g("dt",{children:"\u7248\u306E\u6570"}),g("dd",{"data-testid":"history-document-revisions",children:S.groups.length})]}),Y("div",{children:[g("dt",{children:"\u6700\u5F8C\u306E\u5909\u5316"}),g("dd",{"data-testid":"history-document-last-change",children:me===void 0?"\u8A18\u9332\u306A\u3057":g(pe,{iso:me.settledAt,testId:"history-document-last-change-value"})})]})]}),He!==null&&g(Be,{occurrence:$e,testId:"history-refresh-failed",children:_n(d,He,"\u6587\u66F8\u306E\u5C65\u6B74")}),U&&g("p",{"data-testid":"history-capture",children:g(xe,{variant:"primary",busy:V?.busy===!0,busyLabel:d.loading,onClick:()=>p(l),ref:ge,testId:"history-capture-button",children:"\u4ECA\u306E\u72B6\u614B\u3092\u8A18\u9332"})}),V!==null&&V.failure!==null&&g(Be,{occurrence:V.failure.occurrence,testId:"history-capture-failed",children:d.failureSentence(V.failure,"\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",X=>`\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F${bi(X)}\u3002`)}),x.length===0&&S.runs.length===0&&S.marks.length===0?g("p",{role:"status","data-testid":"history-empty",children:"\u3053\u306E\u6587\u66F8\u306B\u306F\u307E\u3060\u8A18\u9332\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):g(bn,{master:lt(S),detail:Ae(S),masterMinPx:ar,detailMinPx:rr,testId:"history-master-detail"})]})},de=re.groups,ue=(x,E)=>de[x]??E,Pe=(x,E)=>Ee({metadataId:t,groups:{...de,[x]:!ue(x,E)}}),Ke=M!==null&&M.request===a?M.stateId:null,lt=x=>Y("div",{"data-testid":"history-timeline",children:[x.marks.length>0&&Y("div",{"data-testid":"history-restricted-group",children:[Y(xe,{variant:"secondary",expanded:ue("restricted",!1),controls:`${$}-restricted`,onClick:()=>Pe("restricted",!1),testId:"history-restricted-toggle",children:["\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332 (",x.marks.length," \u4EF6)"]}),g("ul",{role:"list",id:`${$}-restricted`,hidden:!ue("restricted",!1),"aria-label":"\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332",children:x.marks.map(({key:E,mark:U})=>g("li",{"data-restricted-mark":U.subject,"data-testid":"history-restricted-mark",children:U.subject==="state"?Y(zt,{children:[g("span",{children:qa})," ",g(pe,{iso:U.settledAt,testId:`history-${E}-settled-at-value`})]}):Y(zt,{children:[g("span",{children:Rn})," ",g(Ue,{tone:ya[U.status],variant:"tint",testId:`history-${E}-status`,children:pt[U.status].label})," ",g(pe,{iso:U.startedAt,testId:`history-${E}-started-at-value`})," \u301C ",g(jt,{iso:U.finishedAt,testId:`history-${E}-finished-at-value`})]})},E))})]}),x.groups.map(E=>{let U=`revision:${E.revision}`,V=ue(U,E.isCurrent),me=`${Ge(E.revision)}${E.isCurrent?" (\u73FE\u5728\u306E\u7248)":""}`;return Y("div",{"data-testid":"history-revision-group","data-revision":E.revision,"data-current":E.isCurrent,children:[g(xe,{variant:"secondary",expanded:V,controls:`${$}-${U}`,onClick:()=>Pe(U,E.isCurrent),testId:`history-revision-toggle-${E.revision}`,children:`${me} \u2014 ${E.items.length} \u4EF6`}),g("div",{id:`${$}-${U}`,hidden:!V,children:g(vn,{label:me,items:E.items,itemKey:X=>X.key,selectedKey:ee,onSelect:X=>Me(X.key),detailId:$,renderRow:X=>Ve(X,x),rowTestId:"history-item",rowData:X=>({"data-item-key":X.key,"data-pinned":X.state!==null&&X.state.stateId===Ke}),empty:"\u3053\u306E\u7248\u306E\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`history-revision-list-${E.revision}`})})]},U)})]}),Ve=(x,E)=>{let U=x.state,V=`history-row-${x.key}`,me=U===null?[]:ga(U,E,V);return Y(zt,{children:[x.kind==="run"?Y("span",{children:["\u5B9F\u884C #",x.run.id," \xB7 ",aa[x.run.trigger]," ",g(Ue,{tone:ya[Nt(x.run)],variant:"tint",testId:`${V}-status`,children:pt[Nt(x.run)].label})]}):g("span",{children:Vt[x.state.cause]}),g("span",{children:g(pe,{iso:x.time,testId:`${V}-time-value`})}),U!==null&&vi(U,V),x.kind==="run"&&Qn(x.run)&&g("span",{"data-testid":`${V}-unrecorded`,children:Wn}),me,U!==null&&U.stateId===Ke&&g(Ue,{tone:"info",variant:"tint",testId:`${V}-pinned`,children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})]})},Fe=(x,E)=>{let U=E.states.find(be=>be.stateId===Ke)??null,V=g(Ei,{pinned:U,shown:x,onPin:be=>O({request:a,stateId:be}),onUnpin:()=>O(null),fallback:()=>A.current});if(x===null)return V;let me=()=>A.current,X;if(U!==null&&U.stateId!==x.stateId){let[be,Mt]=E.states.indexOf(U)>E.states.indexOf(x)?[U,x]:[x,U];X=g(Fr,{host:e,fromStateId:be.stateId,toStateId:Mt.stateId,rescueTarget:me})}else x.previousStateId===null?X=g("p",{"data-testid":"history-no-previous",children:za}):X=g(Fr,{host:e,fromStateId:x.previousStateId,toStateId:x.stateId,rescueTarget:me});return Y(zt,{children:[V,X]})},et=x=>{if(F===void 0)return"\u8A18\u9332\u306E\u8A73\u7D30";let E=F.state,U=x.states.find(V=>V.stateId===Ke);if(U!==void 0&&E!==null&&U.stateId!==E.stateId){let[V,me]=x.states.indexOf(U)>x.states.indexOf(E)?[U,E]:[E,U];return`\u6BD4\u8F03: ${Ge(V.revision)} \u2192 ${Ge(me.revision)}`}return F.kind==="run"?`${Ge(F.run.revision)} \u306E\u5B9F\u884C #${F.run.id}`:`${Ge(F.state.revision)} \u306E\u5909\u5316`},tt=x=>{if(ee===null)return x.groups.some(me=>me.items.length>0)?g("p",{"data-testid":"history-select-prompt",children:"\u6642\u7CFB\u5217\u304B\u3089\u8A18\u9332\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u5909\u5316\u3092\u793A\u3057\u307E\u3059\u3002"}):g("p",{role:"status","data-testid":"history-no-selectable",children:"\u9078\u3079\u308B\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002"});if(F===void 0&&De)return g("p",{"aria-busy":"true","data-testid":"history-detail-loading",children:"\u6587\u66F8\u306E\u5C65\u6B74\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});if(F===void 0)return Y("p",{role:"status","data-testid":"history-selection-missing",children:[ee.startsWith("run:")?`\u5B9F\u884C #${ee.slice(4)} \u306F`:"\u9078\u3093\u3060\u72B6\u614B\u306F","\u3053\u306E\u6587\u66F8\u306E\u5C65\u6B74\u306B\u3042\u308A\u307E\u305B\u3093\u3002"]});if(F.kind==="state"){let{state:me}=F;return Y(zt,{children:[Y("dl",{"data-testid":"history-state-summary",children:[Y("div",{children:[g("dt",{children:"\u5951\u6A5F"}),g("dd",{"data-testid":"history-state-cause",children:Vt[me.cause]})]}),Y("div",{children:[g("dt",{children:"\u6642\u523B"}),g("dd",{children:g(pe,{iso:me.settledAt,testId:"history-state-settled-at-value"})})]}),Y("div",{children:[g("dt",{children:"\u64CD\u4F5C\u8005"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-state-actor",children:me.actor})]}),Y("div",{children:[g("dt",{children:"\u6A5F\u5BC6\u533A\u5206"}),g("dd",{"data-testid":"history-state-confidentiality",children:me.classification.confidentialityLevel})]})]}),ga(me,x,"history-detail"),Fe(me,x)]})}let{run:E,state:U}=F,V=Nt(E);return Y(zt,{children:[Y("dl",{"data-testid":"history-run-summary","data-run-id":E.id,children:[Y("div",{children:[g("dt",{children:"\u304D\u3063\u304B\u3051"}),g("dd",{"data-testid":"history-run-trigger","data-trigger":E.trigger,children:aa[E.trigger]})]}),Y("div",{children:[g("dt",{children:"\u8A66\u884C"}),g("dd",{"data-testid":"history-run-attempt",children:E.attempt})]}),Y("div",{children:[g("dt",{children:"\u72B6\u614B"}),g("dd",{children:g(Ue,{tone:ya[V],variant:"tint",testId:"history-run-status",dataAttributes:{"data-status":E.status,"data-presentation":V},children:pt[V].label})})]}),Y("div",{children:[g("dt",{children:"\u7A2E\u985E"}),g("dd",{"data-testid":"history-run-kind",children:lr(E.documentKind)})]}),Y("div",{children:[g("dt",{children:"\u8981\u6C42\u8005"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-requested-by",children:E.requestedBy})]}),Y("div",{children:[g("dt",{children:"\u958B\u59CB"}),g("dd",{children:g(pe,{iso:E.startedAt,testId:"history-run-started-at-value"})})]}),Y("div",{children:[g("dt",{children:"\u7D42\u4E86"}),g("dd",{"data-testid":"history-run-finished-at",children:g(jt,{iso:E.finishedAt,testId:"history-run-finished-at-value"})})]}),Y("div",{children:[g("dt",{children:"\u30B8\u30E7\u30D6"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-job-id",children:E.jobId})]})]}),E.errorMessage!==null&&g("p",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-error",children:E.errorMessage}),Qn(E)&&g("p",{"data-testid":"history-run-unrecorded",children:Wn}),U===null?g("p",{"data-testid":"history-run-no-state",children:"\u3053\u306E\u5B9F\u884C\u304C\u4F5C\u3063\u305F\u72B6\u614B\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):ga(U,x,"history-detail"),Fe(U,x),Y("details",{"data-testid":"history-run-steps",children:[g("summary",{children:"\u6BB5\u306E\u6642\u7CFB\u5217"}),g(Mr,{run:E})]})]})},Ae=x=>Y("section",{id:$,"aria-labelledby":P,"data-testid":"history-detail","data-selected-key":ee??"",children:[g("h3",{ref:A,id:P,tabIndex:-1,style:Si,"data-testid":"history-detail-heading",children:et(x)}),tt(x)]});return Y("section",{"data-cui-migration":"pending",ref:i,role:"dialog","aria-labelledby":b,onKeyDown:ie,"data-testid":"history-inspector","data-metadata-id":t,"data-cui-surface":"surface","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"sans",children:[Y("div",{children:[g("h2",{ref:L,id:b,tabIndex:-1,style:hi,"data-testid":"history-heading",children:se===null?"\u6587\u66F8\u306E\u5C65\u6B74":`\u6587\u66F8\u306E\u5C65\u6B74 \u2014 ${se.document.fileName}`}),g(xe,{variant:"secondary",onClick:s,testId:"history-close",children:d.close})]}),H()]})}import{COPY_REASON_LABELS as _i,ConfidentialityLevelSchema as Ci,EnrichmentSyncStatusSchema as Ti,identifierMatches as Vr,isPromotable as ki,PIPELINE_FAILURE_STATUSES as Pi,PROTECTION_SCHEME_LABELS as wi,pastedIdentifier as Li,QUARANTINED_CONFIDENTIALITY_LEVEL as Gr,sourceOfUri as xa,UNLOCK_DISPOSITION_LABELS as $i}from"@aiquants/enrichment-core";import{useId as It,useLayoutEffect as Di,useMemo as jr,useRef as qr,useState as Qe}from"react";import{formatCount as Ur}from"@aiquants/console-ui/core";function Rt(e,t,n){try{Ur(e,n)}catch(a){throw new RangeError(`${t}: ${a.message}`,{cause:a})}return e}function On(e,t,n){return Ur(Rt(e,t,n),n)}var Hr=1024,Ni=[{name:"B",power:0,fractionDigits:0},{name:"KiB",power:1,fractionDigits:1},{name:"MiB",power:2,fractionDigits:1},{name:"GiB",power:3,fractionDigits:2},{name:"TiB",power:4,fractionDigits:2}];function Br(e,t){return Number((e/Hr**t.power).toFixed(t.fractionDigits))}function Mn(e,t,n){Rt(e,t,n);let[a,...s]=Ni,r=a,l=Br(e,r);for(let d of s){if(l<Hr)break;r=d,l=Br(e,r)}return`${new Intl.NumberFormat(n,{minimumFractionDigits:r.fractionDigits,maximumFractionDigits:r.fractionDigits,useGrouping:!0}).format(l)} ${r.name}`}import{PIPELINE_FAILURE_STATUSES as Ri}from"@aiquants/enrichment-core";var mt={PENDING:"\u5F85\u6A5F\u4E2D",EXTRACTING:"\u672C\u6587\u62BD\u51FA\u4E2D",ENRICHING:"AI \u8981\u7D04\u30FB\u69CB\u9020\u5316\u4E2D",PROJECTING:"\u30D9\u30AF\u30C8\u30EB/\u30B0\u30E9\u30D5\u6295\u5F71\u4E2D",SYNCED:"\u540C\u671F\u5B8C\u4E86",FAILED_EXTRACT:"\u5931\u6557: FAILED_EXTRACT",FAILED_ENRICH:"\u5931\u6557: FAILED_ENRICH",FAILED_VECTOR:"\u5931\u6557: FAILED_VECTOR",FAILED_GRAPH:"\u5931\u6557: FAILED_GRAPH"},cn="\u53D6\u308A\u8FBC\u307F\u306E\u8A18\u9332\u306A\u3057",Ii=new Set(Ri);function Kr(e){return Ii.has(e)?"danger":e==="SYNCED"?"success":"info"}import{Fragment as Hi,jsx as c,jsxs as R}from"react/jsx-runtime";var Ai=new Set(Pi),Xr=e=>Ai.has(e),Oi=new Set(Ti.options);function Mi(e){return e.isCurrent===!1?{kind:"blocked",reason:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF"}:e.syncStatus==="SYNCED"?{kind:"resync"}:Xr(e.syncStatus)?{kind:"retry"}:Oi.has(e.syncStatus)?{kind:"blocked",reason:"\u51E6\u7406\u4E2D"}:{kind:"blocked",reason:"\u4E0D\u660E\u306A\u72B6\u614B"}}function zr(e,t,n){let a=e?.find(s=>s.confidentialityLevel===t&&s.capability===n);return a?a.isEnabled:null}var Fi={PUBLIC:"\u5168\u516C\u958B",INTERNAL:"\u793E\u5185\u5171\u6709",DEPARTMENT:"\u90E8\u9580\u9650\u5B9A",CONFIDENTIAL:"\u6A5F\u5BC6 - \u65E2\u5B9A",RESTRICTED:"\u691C\u7D22\u5B8C\u5168\u9664\u5916\u30FB\u4FDD\u8B77"},Ui=["\u5951\u7D04\u66F8","\u6C7A\u7B97\u77ED\u4FE1","\u6280\u8853\u4ED5\u69D8\u66F8","\u793E\u5185\u898F\u7A0B","\u8B70\u4E8B\u9332","\u4EBA\u4E8B\u65B9\u91DD"];function Bi(e){return/[A-Za-z0-9]$/.test(e)?`${e} `:e}function ha({field:e}){return c("span",{className:"text-red-700","data-testid":`ingest-required-mark-${e}`,children:"*"})}function yu({policies:e,tenantId:t,sources:n,domainOptions:a,recentItems:s=[],inspectionResult:r=null,isSubmitting:l=!1,isInspecting:d=!1,isBusy:o=!1,promotingId:b=null,onInspectUri:$,onIngestDocument:P,onRetryItem:i,onShowHistory:L,onPromoteUnlockedCopy:A,listRefusal:m,onShowAllObjects:y}){let{formatLocale:v}=I(),D=bt(),C=qr(new Map),G=qr(null),h=It(),M=It(),O=It(),re=It(),Ee=It(),T=It(),ae=It(),J=It(),[Le,Ze]=Qe(null),[He,$e]=Qe(""),[De,se]=Qe(""),[S,ee]=Qe("CONFIDENTIAL"),[F,oe]=Qe(null),[ge,ie]=Qe(""),[Me,p]=Qe(""),[H,de]=Qe([]),[ue,Pe]=Qe(""),[Ke,lt]=Qe("user"),[Ve,Fe]=Qe(1),[et,tt]=Qe(!1),Ae=F!==null&&a.some(u=>u.key===F)?F:a.length>0?a[0].key:null,x=Le===null?void 0:n.find(u=>u.uri_prefix===Le),E=x!==void 0?x:n.length>0?n[0]:null,U=jr(()=>({vectorEnabled:zr(e,S,"vector_indexing"),graphEnabled:zr(e,S,"graph_indexing")}),[e,S]),V=jr(()=>{let u=De.trim();if(!u||n.length===0)return{valid:!1,error:null};let w=xa(n,u);if(w===void 0)return{valid:!1,error:`\u8A31\u53EF\u3055\u308C\u305F\u30B9\u30AD\u30FC\u30E0 (${n.map(ze=>ze.uri_prefix).join(", ")}) \u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002`};let N=u.slice(w.uri_prefix.length);return N.trim()?u.includes("..")?{valid:!1,error:"\u76F8\u5BFE\u30D1\u30B9\u8A18\u53F7 (..) \u306B\u3088\u308B\u30D1\u30B9\u30C8\u30E9\u30D0\u30FC\u30B5\u30EB\u306F\u7981\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002"}:Vr(w,N)?{valid:!0,error:null}:{valid:!1,error:`${Bi(w.title.ja)}\u306E\u8B58\u5225\u5B50\u306E\u5F62\u3067\u306F\u3042\u308A\u307E\u305B\u3093 (\u4F8B: ${w.input_example})\u3002`}:{valid:!1,error:"URI \u306E\u30D1\u30B9\u90E8\u5206\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}},[De,n]),me=u=>{if(Ze(u),He.trim()){let w=He.trim(),N=xa(n,w),ze=N===void 0?w:w.slice(N.uri_prefix.length);se(`${u}${ze}`)}else se("")},X=u=>{let w=u.trim();if(!w){$e(""),se("");return}let N=xa(n,w);if(N!==void 0){Ze(N.uri_prefix),$e(w.slice(N.uri_prefix.length)),se(w);return}if(E!==null&&Vr(E,w)){$e(u),se(`${E.uri_prefix}${w}`);return}let ze=Li(n,w);if(ze!==void 0){Ze(ze.source.uri_prefix),$e(ze.identifier),se(`${ze.source.uri_prefix}${ze.identifier}`);return}if(w.includes("://")){$e(u),se(w);return}$e(u),se(E===null?w:`${E.uri_prefix}${w}`)},be=()=>{let u=ue.trim();u&&(H.some(w=>w.labelKey===u)||(de(w=>[...w,{labelKey:u,category:Ke,confidenceScore:Number(Ve.toFixed(2))}]),Pe("")))},Mt=u=>{H.some(w=>w.labelKey===u)||de(w=>[...w,{labelKey:u,category:"domain",confidenceScore:1}])},Qt=u=>{de(w=>w.filter(N=>N.labelKey!==u))},Vn=u=>{if(u.preventDefault(),!V.valid||Ae===null)return;let w={fileUri:De.trim(),confidentialityLevel:S,targetDomainKey:Ae,departmentId:ge.trim()?Number(ge):null,titleOverride:Me.trim()?Me.trim():null,labels:H};P?.(w)};Di(()=>{let u=G.current;if(u===null)return;let w=s.find(N=>N.kind==="readable"&&N.item.id===u)?.item;w?.unlock?.disposition==="copy_promoted"&&(G.current=null,document.activeElement===document.body&&C.current.get(u)?.focus(),D(`${w.fileName} \u306E\u6E90\u3092\u89E3\u3044\u305F\u5199\u3057\u3067\u4E0A\u66F8\u304D\u3057\u307E\u3057\u305F\u3002`))},[s,D]);let f=u=>{let w=u.unlock;if(w===null)return null;let N=w.disposition==="copy_original"&&w.copyReason!==null&&ki(w.copyReason)&&u.isCurrent!==!1,ze=b===u.id,$a=ze?"\u6E90\u3092\u5199\u3057\u3067\u4E0A\u66F8\u304D\u4E2D...":"\u6E90\u3092\u5199\u3057\u3067\u4E0A\u66F8\u304D";return R("div",{ref:Da=>{Da===null?C.current.delete(u.id):C.current.set(u.id,Da)},tabIndex:-1,className:"mt-1 max-w-xs space-y-1 text-[11px] text-slate-700","data-testid":`ingest-unlock-${u.id}`,"data-disposition":w.disposition,"data-protection":w.protectionScheme,children:[R("div",{children:["\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5916\u3057\u305F: ",wi[w.protectionScheme]]}),R("div",{"data-testid":`ingest-unlock-disposition-${u.id}`,children:[$i[w.disposition],w.copyReason!==null&&` (${_i[w.copyReason]})`]}),N&&A!==void 0&&c("button",{type:"button",onClick:()=>{G.current=u.id,A(u.id)},disabled:o,"aria-busy":ze,"aria-label":`${u.fileName} \u306E${$a}`,className:"min-h-11 rounded-sm border border-slate-300 border-solid bg-white px-2 py-0.5 font-semibold text-[11px] text-slate-700 hover:bg-slate-50 disabled:cursor-not-allowed disabled:bg-slate-100","data-testid":`ingest-promote-button-${u.id}`,children:$a})]})},Ce=u=>{let w=Mi(u);if(w.kind==="blocked")return c("span",{className:"font-sans text-[11px] text-slate-500","data-testid":`ingest-action-blocked-${u.id}`,"data-reason":w.reason,children:w.reason});let N=w.kind==="retry";return c("button",{type:"button",onClick:()=>i?.(u.id),disabled:o,"aria-label":`${u.fileName} \u3092${N?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"}`,className:N?"min-h-11 rounded-sm border border-red-200 border-solid bg-red-50 px-2 py-1 font-semibold text-red-700 text-xs hover:bg-red-100 disabled:cursor-not-allowed":"min-h-11 rounded-sm border border-emerald-200 border-solid bg-emerald-50 px-2 py-1 font-semibold text-emerald-700 text-xs hover:bg-emerald-100 disabled:cursor-not-allowed","data-testid":`ingest-${w.kind}-button-${u.id}`,children:N?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"})},he=u=>{switch(u){case"SYNCED":return c("span",{className:"inline-flex items-center rounded-full bg-emerald-100 px-2.5 py-0.5 font-semibold text-emerald-800 text-xs",children:mt.SYNCED});case"PENDING":return c("span",{className:"inline-flex items-center rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-800 text-xs",children:mt.PENDING});case"EXTRACTING":return c("span",{className:"inline-flex items-center rounded-full bg-blue-100 px-2.5 py-0.5 font-medium text-blue-800 text-xs",children:mt.EXTRACTING});case"ENRICHING":return c("span",{className:"inline-flex items-center rounded-full bg-purple-100 px-2.5 py-0.5 font-medium text-purple-800 text-xs",children:mt.ENRICHING});case"PROJECTING":return c("span",{className:"inline-flex items-center rounded-full bg-indigo-100 px-2.5 py-0.5 font-medium text-indigo-800 text-xs",children:mt.PROJECTING});default:return Xr(u)?c("span",{className:"inline-flex items-center rounded-full bg-red-100 px-2.5 py-0.5 font-semibold text-red-800 text-xs",children:mt[u]}):c("span",{className:"inline-flex items-center rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-800 text-xs",children:u})}};return R("div",{"data-cui-migration":"pending",className:"space-y-6","data-testid":"document-ingest-console",children:[R("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[R("div",{className:"flex flex-col justify-between gap-2 md:flex-row md:items-center",children:[R("div",{children:[c("h2",{className:"font-bold text-base text-slate-900",children:"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u53D6\u308A\u8FBC\u307F & \u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210"}),c("p",{className:"mt-1 text-slate-500 text-sm",children:"\u5BFE\u8C61 URI \u3092\u6307\u5B9A\u3057\u3066\u672C\u6587\u62BD\u51FA\u30FBAI \u8981\u7D04\u30FB\u69CB\u9020\u5316\u30E1\u30BF\u30C7\u30FC\u30BF\u4ED8\u4E0E\u30FBQdrant \u30D9\u30AF\u30C8\u30EB\u304A\u3088\u3073 Neo4j \u30B0\u30E9\u30D5\u3078\u306E\u6295\u5F71\u3092\u5B9F\u884C\u3057\u307E\u3059\u3002"})]}),R("div",{className:"inline-flex items-center rounded-lg border border-slate-200 border-solid bg-slate-50 px-3 py-1.5 font-medium text-slate-600 text-xs",children:["\u30C6\u30CA\u30F3\u30C8: ",c("span",{className:"ml-1.5 font-bold text-slate-800",children:t})]})]}),R("form",{onSubmit:Vn,className:"mt-6 space-y-6",children:[R("div",{className:"space-y-3","data-testid":"document-uri-input-group",children:[R("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[R("label",{htmlFor:h,className:"block font-semibold text-slate-800 text-sm",children:["\u30D5\u30A1\u30A4\u30EB URI / \u30EA\u30BD\u30FC\u30B9\u8B58\u5225\u5B50 ",c(ha,{field:"uri"})]}),E!==null&&R("span",{className:"font-mono text-slate-500 text-xs",children:["\u9078\u629E\u30B9\u30AD\u30FC\u30E0: ",c("strong",{className:"font-semibold text-indigo-600",children:E.uri_prefix})]})]}),E===null&&c(Xe,{tone:"warning",testId:"ingest-no-sources",children:"\u53D6\u308A\u8FBC\u3081\u308B\u6E90\u304C\u914D\u5099\u306B\u3042\u308A\u307E\u305B\u3093\u3002"}),R("div",{className:"flex flex-wrap items-center gap-2",children:[c("span",{className:"font-medium text-slate-500 text-xs",children:"\u30B9\u30AD\u30FC\u30E0\u6307\u5B9A:"}),n.map(u=>c("button",{type:"button",onClick:()=>me(u.uri_prefix),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${E?.uri_prefix===u.uri_prefix?"border-indigo-600 bg-indigo-50 font-semibold text-indigo-700 shadow-sm":"border-slate-200 bg-slate-100 text-slate-700 hover:bg-slate-200"}`,"data-testid":`scheme-select-${u.scheme}`,children:`${u.scheme}:// (${u.title.ja})`},u.scheme))]}),R("div",{className:"space-y-1.5",children:[R("div",{className:"flex flex-wrap gap-2 sm:flex-nowrap",children:[R("div",{className:`flex min-w-0 grow basis-full rounded-lg border border-solid shadow-sm transition-colors focus-within:ring-2 sm:basis-0 ${V.error?"border-red-300 focus-within:border-red-500 focus-within:ring-red-200":"border-slate-300 focus-within:border-indigo-500 focus-within:ring-indigo-100"}`,children:[c("span",{className:"inline-flex select-none items-center rounded-l-lg border-slate-200 border-r border-solid bg-slate-50 px-3.5 font-mono font-semibold text-slate-700 text-sm","data-testid":"scheme-prefix-badge",children:E?.uri_prefix}),c("input",{id:h,type:"text",value:He,onChange:u=>X(u.target.value),placeholder:E?.input_hint.ja,disabled:E===null,"aria-invalid":!!V.error,"aria-describedby":V.error?"ingest-uri-error":void 0,className:"min-w-0 flex-1 rounded-r-lg px-3.5 py-2 font-mono text-sm focus:outline-none","data-testid":"ingest-file-uri-input",required:!0})]}),c("button",{type:"button",onClick:()=>$?.(De.trim()),disabled:!V.valid||d||o,className:"inline-flex items-center justify-center rounded-lg border border-slate-300 border-solid bg-white px-4 py-2 font-medium text-slate-700 text-sm shadow-sm hover:bg-slate-50 disabled:opacity-50","data-testid":"ingest-inspect-uri-button",children:d?"\u691C\u8A3C\u4E2D...":"URI \u4E8B\u524D\u691C\u8A3C"})]}),R("div",{className:"flex flex-wrap items-center justify-between gap-1 text-xs",children:[E!==null&&c("p",{className:"text-slate-500",children:E.guidance.ja}),De&&R("div",{className:"flex items-center gap-1 font-mono text-slate-500",children:[c("span",{children:"\u89E3\u6C7A URI:"}),c("code",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 font-bold text-indigo-700","data-testid":"resolved-uri-code",children:De})]})]})]}),V.error&&c("p",{id:"ingest-uri-error",className:"text-red-600 text-xs",role:"alert","data-testid":"ingest-uri-error",children:V.error})]}),r&&r.fileUri===De.trim()&&R("section",{"aria-live":"polite","aria-label":"\u30EA\u30BD\u30FC\u30B9\u691C\u8A3C\u7D50\u679C",className:`rounded-lg border border-solid p-4 text-sm transition-all ${r.exists?"border-emerald-200 bg-emerald-50/60 text-emerald-950":"border-red-200 bg-red-50/60 text-red-950"}`,"data-testid":"inspection-result-card",children:[R("div",{className:"flex items-center justify-between",children:[c("span",{className:"font-semibold",children:r.exists?"\u2713 \u30EA\u30BD\u30FC\u30B9\u78BA\u8A8D\u5B8C\u4E86 (\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD)":"\u26A0 \u30EA\u30BD\u30FC\u30B9\u4E0D\u9054 (\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093)"}),c("span",{className:"font-mono text-slate-500 text-xs",children:r.fileUri})]}),r.exists&&R("div",{className:"mt-2 grid grid-cols-2 gap-4 font-mono text-xs md:grid-cols-4",children:[R("div",{children:[c("span",{className:"block text-slate-500",children:"\u30D5\u30A1\u30A4\u30EB\u540D:"}),c("span",{className:"font-semibold text-slate-800",children:r.fileName})]}),R("div",{children:[c("span",{className:"block text-slate-500",children:"\u30B5\u30A4\u30BA:"}),c("span",{className:"font-semibold text-slate-800",children:c(je,{text:Mn(r.fileSize,"fileSize",v),testId:"inspection-file-size-value"})})]}),R("div",{children:[c("span",{className:"block text-slate-500",children:"MIME:"}),c("span",{className:"font-semibold text-slate-800",children:r.mimeType})]}),R("div",{children:[c("span",{className:"block text-slate-500",children:"\u30EA\u30D3\u30B8\u30E7\u30F3:"}),c("span",{className:"font-semibold text-slate-800",children:r.revisionId?.slice(0,8)??"N/A"})]})]})]}),R("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[R("div",{className:"space-y-1",children:[R("label",{htmlFor:M,className:"block font-semibold text-slate-700 text-xs",children:["\u6A5F\u5BC6\u533A\u5206 (Confidentiality Level) ",c(ha,{field:"confidentiality"})]}),c("select",{id:M,value:S,onChange:u=>ee(u.target.value),className:"w-full rounded-lg border border-slate-300 border-solid bg-white px-3 py-2 text-slate-800 text-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-confidentiality-select",children:Ci.options.map(u=>R("option",{value:u,children:[u," (",Fi[u],")"]},u))})]}),R("div",{className:"space-y-1",children:[R("label",{htmlFor:O,className:"block font-semibold text-slate-700 text-xs",children:["\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ",c(ha,{field:"domain"})]}),c("select",{id:O,value:Ae===null?"":Ae,onChange:u=>oe(u.target.value),disabled:a.length===0,className:"w-full rounded-lg border border-slate-300 border-solid bg-white px-3 py-2 text-slate-800 text-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 disabled:cursor-not-allowed disabled:bg-slate-100","data-testid":"ingest-domain-select",children:a.map(u=>c("option",{value:u.key,children:u.label},u.key))}),a.length===0&&c("p",{className:"text-[11px] text-amber-800","data-testid":"ingest-domain-empty",children:"\u9078\u3079\u308B\u30C9\u30E1\u30A4\u30F3\u304C\u6E21\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u30C9\u30E1\u30A4\u30F3\u304C\u7121\u3044\u3068\u53D6\u308A\u8FBC\u307F\u306F\u6295\u5165\u3067\u304D\u307E\u305B\u3093\u3002"})]})]}),S===Gr&&R("div",{className:"rounded-lg border border-amber-300 border-solid bg-amber-50 p-3 text-amber-900 text-xs",role:"alert","data-testid":"restricted-warning-banner",children:[c("span",{className:"font-bold",children:"\u3010\u9694\u96E2\u6CE8\u610F\u3011"})," ",Gr," \u306B\u8A2D\u5B9A\u3055\u308C\u305F\u6587\u66F8\u306F\u3001\u6CD5\u4EE4\u9075\u5B88\u30FB\u4FC2\u4E89\u4FDD\u5168\u306E\u305F\u3081\u691C\u7D22\u7D50\u679C\u306B\u4E00\u5207\u51FA\u73FE\u3057\u307E\u305B\u3093\u3002\u3053\u308C\u306F\u8A2D\u5B9A\u3067\u306F\u306A\u304F\u4FDD\u8A3C\u3067\u3042\u308A\u3001\u30DD\u30EA\u30B7\u30FC\u306E\u5024\u306B\u4F9D\u3089\u305A\u5E38\u306B\u6210\u7ACB\u3057\u307E\u3059\u3002",c("span",{className:"mt-1 block text-amber-800",children:"\u7D22\u5F15\u305D\u306E\u3082\u306E\u3092\u884C\u3046\u304B\u3069\u3046\u304B\u306F\u5225\u306E\u8A2D\u5B9A\u3067\u3059 (\u4E0B\u306E\u6295\u5F71\u5148\u3092\u53C2\u7167)\u3002\u7D22\u5F15\u3055\u308C\u305F\u6587\u66F8\u3082\u691C\u7D22\u7D50\u679C\u306B\u306F\u73FE\u308C\u307E\u305B\u3093\u3002"})]}),R("div",{className:"space-y-2 rounded-lg border border-indigo-100 border-solid bg-indigo-50/30 p-4","data-testid":"projection-capability-card",children:[c("span",{className:"block font-semibold text-indigo-950 text-xs",children:"\u3053\u306E\u6A5F\u5BC6\u533A\u5206\u306B\u5BFE\u3059\u308B\u6295\u5F71\u306E\u53EF\u5426 (Projection)"}),R("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[R("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[c("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15 (Qdrant)"}),c("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-vector-state","data-state":U.vectorEnabled===null?"unknown":String(U.vectorEnabled),children:U.vectorEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":U.vectorEnabled?"\u6709\u52B9":`\u7121\u52B9 (${S} \u306E\u8A2D\u5B9A)`})]}),R("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[c("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30B0\u30E9\u30D5\u7D22\u5F15 (Neo4j)"}),c("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-graph-state","data-state":U.graphEnabled===null?"unknown":String(U.graphEnabled),children:U.graphEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":U.graphEnabled?"\u6709\u52B9":`\u7121\u52B9 (${S} \u306E\u8A2D\u5B9A)`})]})]}),R("p",{className:"text-[11px] text-slate-600","data-testid":"projection-destination-note",children:["\u6295\u5F71\u5148\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D\u30FB\u30B0\u30E9\u30D5\u30E9\u30D9\u30EB\u30FB\u30C1\u30E3\u30F3\u30AF\u5206\u5272\u65B9\u5F0F\u306F\u3001\u9078\u629E\u3057\u305F\u30C9\u30E1\u30A4\u30F3\u306B\u5BFE\u3059\u308B\u914D\u5099\u306E\u53D6\u308A\u8FBC\u307F\u6226\u7565 (",c("code",{className:"font-mono",children:"tm_enrichment_strategy"}),") \u304C\u6C7A\u3081\u307E\u3059\u3002\u3053\u306E\u753B\u9762\u3067\u306F\u63A8\u5B9A\u3057\u307E\u305B\u3093\u3002"]})]}),R("div",{className:"space-y-3 rounded-lg border border-slate-200 border-solid bg-slate-50/50 p-4",children:[R("div",{className:"flex items-center justify-between",children:[c("span",{className:"font-semibold text-slate-800 text-xs",children:"\u4ED8\u52A0\u60C5\u5831 / \u30E9\u30D9\u30EB\u30BF\u30B0 (Labels & Tags)"}),R("span",{className:"text-slate-500 text-xs",children:[H.length," \u4EF6\u8A2D\u5B9A\u4E2D"]})]}),R("div",{className:"flex flex-wrap items-center gap-1.5",children:[c("span",{className:"text-slate-500 text-xs",children:"\u30AF\u30A4\u30C3\u30AF\u5019\u88DC:"}),Ui.map(u=>R("button",{type:"button",onClick:()=>Mt(u),className:"rounded-full border border-slate-200 border-solid bg-white px-2.5 py-0.5 text-slate-700 text-xs transition-colors hover:border-indigo-300 hover:text-indigo-600","data-testid":`preset-tag-${u}`,children:["+ ",u]},u))]}),R("div",{className:"grid grid-cols-1 items-end gap-2 sm:grid-cols-5",children:[R("div",{className:"space-y-1 sm:col-span-2",children:[c("label",{htmlFor:T,className:"block text-slate-600 text-xs",children:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC"}),c("input",{id:T,type:"text",value:ue,onChange:u=>Pe(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),be())},placeholder:"\u4F8B: \u91CD\u8981\u9867\u5BA2\u5951\u7D04, 2026\u5E74\u5EA6",className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-label-key-input"})]}),R("div",{className:"space-y-1",children:[c("label",{htmlFor:ae,className:"block text-slate-600 text-xs",children:"\u7A2E\u5225"}),R("select",{id:ae,value:Ke,onChange:u=>lt(u.target.value),className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-2 py-1.5 text-slate-800 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-label-category-select",children:[c("option",{value:"user",children:"\u30E6\u30FC\u30B6\u30FC (user)"}),c("option",{value:"domain",children:"\u30C9\u30E1\u30A4\u30F3 (domain)"}),c("option",{value:"system",children:"\u30B7\u30B9\u30C6\u30E0 (system)"})]})]}),R("div",{className:"space-y-1",children:[R("label",{htmlFor:J,className:"block text-slate-600 text-xs",children:["\u78BA\u4FE1\u5EA6 (",Ve.toFixed(2),": 0.00\u301C1.00 AI/\u81EA\u52D5\u5224\u5B9A\u306E\u4FE1\u983C\u5EA6\u30B9\u30B3\u30A2\u30020.80 \u4EE5\u4E0A\u3067\u81EA\u52D5\u9069\u7528\u63A8\u5968)"]}),c("input",{id:J,type:"range",min:"0.0",max:"1.0",step:"0.05",value:Ve,"aria-valuenow":Ve,"aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":`${Math.round(Ve*100)}%`,onChange:u=>Fe(Number.parseFloat(u.target.value)),className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-slate-200","data-testid":"ingest-label-confidence-slider"})]}),c("div",{children:c("button",{type:"button",onClick:be,className:"w-full rounded-sm bg-slate-800 px-3 py-1.5 font-semibold text-white text-xs hover:bg-slate-700","data-testid":"ingest-add-label-button",children:"\u30BF\u30B0\u8FFD\u52A0"})})]}),H.length>0&&c("div",{className:"flex flex-wrap gap-2 pt-2","data-testid":"active-labels-container",children:H.map(u=>R("span",{className:"inline-flex items-center gap-1.5 rounded-md border border-indigo-200 border-solid bg-indigo-50 px-2.5 py-1 font-medium text-indigo-800 text-xs","data-testid":`active-label-${u.labelKey}`,children:[c("span",{className:"font-semibold",children:u.labelKey}),R("span",{className:"text-indigo-400",children:["(",u.category,")"]}),c("button",{type:"button",onClick:()=>Qt(u.labelKey),"aria-label":`\u30E9\u30D9\u30EB ${u.labelKey} \u3092\u524A\u9664`,className:"ml-1 font-bold text-indigo-400 hover:text-indigo-900","data-testid":`remove-label-${u.labelKey}`,children:"\xD7"})]},u.labelKey))})]}),R("div",{className:"space-y-3",children:[c("button",{id:"advanced-settings-toggle",type:"button","aria-expanded":et,"aria-controls":"advanced-settings-panel",onClick:()=>tt(u=>!u),className:"inline-flex items-center gap-1.5 font-semibold text-indigo-600 text-xs hover:text-indigo-800","data-testid":"ingest-toggle-advanced-button",children:R("span",{children:[et?"\u25BC":"\u25B6"," \u30E1\u30BF\u30C7\u30FC\u30BF\u8A73\u7D30\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 (\u9AD8\u5EA6\u306A\u8A2D\u5B9A)"]})}),et&&R("section",{id:"advanced-settings-panel","aria-labelledby":"advanced-settings-toggle",className:"space-y-4 rounded-lg border border-slate-200 border-solid bg-slate-50/40 p-4","data-testid":"advanced-settings-panel",children:[c("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:R("div",{className:"space-y-1",children:[c("label",{htmlFor:Ee,className:"block font-medium text-slate-700 text-xs",children:"\u6587\u66F8\u30BF\u30A4\u30C8\u30EB (\u4E0A\u66F8\u304D\u6307\u5B9A)"}),c("input",{id:Ee,type:"text",value:Me,onChange:u=>p(u.target.value),placeholder:"\u6307\u5B9A\u3057\u306A\u3044\u5834\u5408\u306F\u30D5\u30A1\u30A4\u30EB\u540D\u307E\u305F\u306F AI \u62BD\u51FA\u30BF\u30A4\u30C8\u30EB\u304C\u4F7F\u7528\u3055\u308C\u307E\u3059",className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-3 py-1.5 text-slate-800 text-xs","data-testid":"ingest-title-override-input"})]})}),c("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:R("div",{className:"space-y-1",children:[c("label",{htmlFor:re,className:"block font-medium text-slate-700 text-xs",children:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)"}),c("input",{id:re,type:"number",value:ge,onChange:u=>ie(u.target.value),placeholder:"\u4F8B: 101",className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-3 py-1.5 text-slate-800 text-xs","data-testid":"ingest-department-input"})]})})]})]}),c("div",{className:"flex justify-end pt-2",children:c("button",{type:"submit",disabled:!V.valid||Ae===null||l||d||o,"aria-busy":l,className:"inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-6 py-2.5 font-semibold text-sm text-white shadow-sm transition-colors hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50","data-testid":"ingest-submit-button",children:l?R(Hi,{children:[c("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent border-solid"}),c("span",{children:"\u53D6\u308A\u8FBC\u307F\u6295\u5165\u4E2D..."})]}):c("span",{children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210 & \u53D6\u308A\u8FBC\u307F\u5B9F\u884C"})})})]})]}),R("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[R("div",{className:"flex items-center justify-between",children:[R("div",{children:[c("h3",{className:"font-bold text-base text-slate-900",children:"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u30AD\u30E5\u30FC & \u5B9F\u884C\u72B6\u614B"}),c("p",{className:"text-slate-500 text-xs",children:"\u76F4\u8FD1\u306B\u6295\u5165\u3055\u308C\u305F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u540C\u671F\u9032\u6357\u3068\u7D50\u679C"})]}),y!==void 0&&m===void 0&&c(hn,{onNavigate:y,testId:"recent-items-all-objects",children:"\u5168\u3066\u306E\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u898B\u308B"})]}),m!==void 0?c(Xe,{tone:"warning",testId:"recent-items-refused",children:m}):s.length===0?c("div",{className:"py-8 text-center text-slate-500 text-xs","data-testid":"recent-items-empty",children:"\u53D6\u308A\u8FBC\u307F\u5C65\u6B74\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):c("div",{className:"overflow-x-auto","data-testid":"recent-items-scroll",children:R("table",{className:"min-w-full divide-y divide-solid divide-slate-200 text-left text-xs","aria-label":"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u5C65\u6B74","data-testid":"recent-items-table",children:[c("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:R("tr",{children:[c("th",{scope:"col",className:"px-3 py-2.5",children:"ID"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u30D5\u30A1\u30A4\u30EB\u540D / URI"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u6A5F\u5BC6\u533A\u5206"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u30EA\u30D3\u30B8\u30E7\u30F3"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u6700\u7D42\u5B9F\u884C"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u767B\u9332\u65E5\u6642"}),c("th",{scope:"col",className:"px-3 py-2.5 text-right",children:"\u30A2\u30AF\u30B7\u30E7\u30F3"})]})}),c("tbody",{className:"divide-y divide-solid divide-slate-100 font-mono text-slate-800",children:s.map((u,w)=>{if(u.kind==="restricted")return R("tr",{"data-testid":`recent-item-restricted-${w}`,"data-restricted-mark":"ingest",children:[c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-600","data-testid":`recent-item-restricted-text-${w}`,children:xt}),c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2 font-sans","data-testid":`recent-item-restricted-status-${w}`,children:u.syncStatus===null?c("span",{className:"text-[11px] text-slate-600","data-sync-status":"none",children:cn}):he(u.syncStatus)}),c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`recent-item-restricted-created-at-${w}`,children:c(pe,{iso:u.createdAt,testId:`recent-item-restricted-created-at-value-${w}`})}),c("td",{className:"px-3 py-2"})]},`restricted:${w}`);let N=u.item;return R("tr",{className:"transition-colors hover:bg-slate-50/80","data-testid":`recent-item-row-${N.id}`,children:[c("td",{className:"px-3 py-2 font-bold",children:N.id}),R("td",{className:"max-w-xs truncate px-3 py-2",title:N.fileUri,children:[c("div",{className:"font-sans font-semibold text-slate-900",children:N.fileName}),c("div",{className:"truncate text-[11px] text-slate-600",children:N.fileUri})]}),c("td",{className:"px-3 py-2",children:c("span",{className:"inline-flex rounded-sm bg-slate-100 px-2 py-0.5 font-medium font-sans text-[11px] text-slate-700",children:N.confidentialityLevel})}),R("td",{className:"px-3 py-2 text-slate-600",children:["rev.",N.revision,N.isCurrent===!1&&c("span",{className:"ml-1.5 inline-flex items-center rounded-sm bg-slate-100 px-1.5 py-0.5 font-medium font-sans text-[10px] text-slate-600","data-testid":`ingest-item-superseded-${N.id}`,children:"\u65E7\u7248"})]}),R("td",{className:"px-3 py-2 font-sans",children:[he(N.syncStatus),N.errorMessage!==null&&N.errorMessage!==void 0&&N.errorMessage!==""&&c("div",{className:"mt-1 max-w-xs break-words text-[11px] text-red-700","data-testid":`ingest-item-error-${N.id}`,title:N.errorMessage,children:N.errorMessage}),f(N)]}),R("td",{className:"px-3 py-2 font-sans","data-testid":`ingest-last-run-${N.id}`,children:[N.lastRun===null?c("span",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-none-${N.id}`,children:"\u8A18\u9332\u306A\u3057"}):N.lastRun.kind==="restricted"?R("div",{className:"space-y-1","data-testid":`ingest-last-run-restricted-${N.id}`,"data-restricted-mark":"run",children:[c("div",{className:"text-[11px] text-slate-600",children:Rn}),c("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${pt[N.lastRun.status].className}`,"data-testid":`ingest-last-run-status-${N.id}`,"data-status":N.lastRun.status,children:pt[N.lastRun.status].label}),c("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${N.id}`,children:c(jt,{iso:N.lastRun.finishedAt,testId:`ingest-last-run-finished-at-value-${N.id}`})})]}):R("div",{className:"space-y-1",children:[c("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${pt[Nt(N.lastRun.item)].className}`,"data-testid":`ingest-last-run-status-${N.id}`,"data-status":N.lastRun.item.status,"data-presentation":Nt(N.lastRun.item),children:pt[Nt(N.lastRun.item)].label}),N.lastRun.item.failedStepKey!==null&&c("div",{className:"text-[11px] text-red-700","data-testid":`ingest-last-run-failed-step-${N.id}`,children:$t(N.lastRun.item.failedStepKey)}),N.lastRun.item.failedStepKey==="unlock_document"&&c("div",{className:"max-w-xs text-[11px] text-slate-700","data-testid":`ingest-unlock-hint-${N.id}`,children:"\u3069\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u3082\u958B\u3051\u306A\u304B\u3063\u305F\u3068\u304D\u306F\u3001\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306B\u5F53\u305F\u308B\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8DB3\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u3069\u306E\u90E8\u54C1\u3082\u5916\u305B\u306A\u3044\u5B88\u308A (\u8A3C\u660E\u66F8\u30FB\u6A29\u5229\u306E\u7BA1\u7406\u30FBPKWARE \u306E\u5F37\u3044\u6697\u53F7) \u306F\u3001\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u3063\u305F\u6240\u3067\u5916\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}),c("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${N.id}`,children:c(jt,{iso:N.lastRun.item.finishedAt,testId:`ingest-last-run-finished-at-value-${N.id}`})})]}),L!==void 0&&c("button",{type:"button",onClick:()=>L(N.id),"aria-label":`${N.fileName} \u306E\u5C65\u6B74`,className:"mt-1 min-h-11 rounded-sm border border-slate-300 border-solid bg-white px-2 py-0.5 font-semibold text-[11px] text-slate-700 hover:bg-slate-50","data-testid":`ingest-history-button-${N.id}`,children:"\u5C65\u6B74"})]}),c("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`ingest-created-at-${N.id}`,children:c(pe,{iso:N.createdAt,testId:`ingest-created-at-value-${N.id}`})}),c("td",{className:"px-3 py-2 text-right font-sans",children:Ce(N)})]},`readable:${N.id}`)})})]})})]})]})}import{ENRICHMENT_STAGES as Sa}from"@aiquants/enrichment-core";import{jsx as Re,jsxs as it}from"react/jsx-runtime";var Ki="\u8981\u7D04\u751F\u6210\u30FB\u69CB\u9020\u5316\u62BD\u51FA\u30FB\u30A2\u30BB\u30C3\u30C8\u62BD\u51FA\u306E\u5207\u308A\u66FF\u3048\u306F\u4FDD\u5B58\u3055\u308C\u307E\u3059\u304C\u3001\u4ECA\u306F\u52B9\u304D\u307E\u305B\u3093 (\u30C9\u30E1\u30A4\u30F3\u306F\u30E2\u30C7\u30EB\u304C\u6C7A\u3081\u308B\u306E\u3067\u3001\u6295\u5F71\u306E\u6BB5\u3060\u3051\u304C\u6226\u7565\u3092\u8AAD\u307F\u307E\u3059)\u3002",Yr={open:{label:"\u30D5\u30E9\u30B0\u6709\u52B9",color:"#047857"},closed:{label:"\u30D5\u30E9\u30B0\u7121\u52B9",color:"#b45309"},unmeasured:{label:"\u30D5\u30E9\u30B0\u672A\u6E2C\u5B9A",color:"#64748b"},absent:{label:"\u30C6\u30CA\u30F3\u30C8\u306E\u9580\u306A\u3057",color:"#64748b"}};function Wr(e,t){return e===null?"absent":e in t?t[e]?"open":"closed":"unmeasured"}function hu({strategies:e,featureFlags:t,onToggleStage:n,isUpdating:a=!1}){let s=n===void 0;return it("div",{"data-cui-migration":"pending","data-testid":"enrichment-strategy-board",className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[it("div",{children:[Re("h2",{className:"font-bold text-base text-slate-900",children:"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565"}),it("p",{className:"text-slate-500 text-xs",children:["\u6295\u5F71\u306E\u6BB5 (\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15\u30FB\u30B0\u30E9\u30D5\u6295\u5F71) \u304C\u8D70\u308B\u306E\u306F\u3001\u30C6\u30CA\u30F3\u30C8\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u3068\u3001\u3053\u306E\u30C9\u30E1\u30A4\u30F3\u306E\u6226\u7565\u306E",Re("strong",{children:"\u53CC\u65B9"}),"\u304C\u958B\u3044\u3066\u3044\u308B\u3068\u304D\u3060\u3051\u3067\u3059\u3002\u8868\u306F ",e.length," \u30C9\u30E1\u30A4\u30F3 \xD7 ",Sa.length," \u6BB5\u3002"]}),Re("p",{"data-testid":"strategy-inert-note",className:"mt-1 text-slate-500 text-xs",children:Ki}),s&&Re("p",{"data-testid":"strategy-read-only-note",className:"mt-1 text-slate-500 text-xs",children:"\u3053\u306E\u914D\u5099\u3067\u306F\u66F8\u304D\u8FBC\u307F\u7D4C\u8DEF\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u95B2\u89A7\u306E\u307F\u3067\u3059\u3002"})]}),e.length===0?Re("p",{"data-testid":"strategy-empty-note",className:"text-slate-500 text-sm",children:"\u767B\u9332\u3055\u308C\u305F\u30C9\u30E1\u30A4\u30F3\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):Re("div",{"data-testid":"strategy-grid-scroll",className:"overflow-x-auto",children:it("table",{"data-testid":"strategy-grid","aria-label":"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565",className:"w-full border-collapse text-xs",children:[Re("thead",{children:it("tr",{children:[Re("th",{scope:"col",className:"border-slate-200 border-b border-solid p-2 text-left font-semibold text-slate-600",children:"\u30C9\u30E1\u30A4\u30F3"}),Sa.map(r=>{let l=Wr(r.featureFlagKey,t);return it("th",{scope:"col","data-inert":String(!r.readByPipeline),className:"border-slate-200 border-b border-solid p-2 text-center font-semibold text-slate-600",children:[Re("div",{children:r.label}),Re("div",{"data-testid":`strategy-gate-${r.key}`,"data-gate":l,className:"mt-0.5 font-normal text-[10px]",style:{color:Yr[l].color},children:Yr[l].label}),!r.readByPipeline&&Re("div",{"data-testid":`strategy-inert-${r.key}`,className:"mt-0.5 font-normal text-[10px] text-slate-500",children:"\u4ECA\u306F\u52B9\u304B\u306A\u3044"})]},r.key)})]})}),Re("tbody",{children:e.map(r=>it("tr",{"data-testid":`strategy-row-${r.domainKey}`,"data-provenance":r.provenance,"data-active":String(r.isActive),children:[it("th",{scope:"row",className:"border-slate-100 border-b border-solid p-2 text-left font-normal",children:[Re("div",{className:"font-semibold text-slate-900",children:r.domainLabel}),it("div",{className:"text-[10px] text-slate-500",children:[Re("code",{children:r.domainKey})," / ",r.strategyName]}),Re("div",{"data-testid":`strategy-provenance-${r.domainKey}`,className:"text-[10px] text-slate-500",children:r.provenance==="system"?"\u914D\u5099\u306E\u65E2\u5B9A (SYSTEM) \u3092\u89E3\u6C7A\u4E2D \u2014 \u5909\u66F4\u3059\u308B\u3068\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u5C02\u7528\u306E\u884C\u304C\u4F5C\u3089\u308C\u307E\u3059":"\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u56FA\u6709\u306E\u884C"}),!r.isActive&&Re("div",{"data-testid":`strategy-inactive-${r.domainKey}`,className:"text-[10px] text-amber-700",children:"\u6226\u7565\u304C\u7121\u52B9\u306E\u305F\u3081\u3001\u6BB5\u3092\u958B\u3044\u3066\u3082\u89E3\u6C7A\u3055\u308C\u307E\u305B\u3093"})]}),Sa.map(l=>{let d=r.stages[l.key],o=Wr(l.featureFlagKey,t),b=!l.readByPipeline;return it("td",{className:"border-slate-100 border-b border-solid p-2 text-center",children:[Re("button",{type:"button",role:"switch","aria-checked":d,"aria-label":b?`${r.domainLabel} \u306E ${l.label} (\u4ECA\u306F\u52B9\u304B\u306A\u3044)`:`${r.domainLabel} \u306E ${l.label}`,"data-testid":`strategy-stage-${r.domainKey}-${l.key}`,"data-enabled":String(d),"data-effective":String(!b&&d&&(o==="open"||o==="absent")),"data-inert":String(b),disabled:s||a,onClick:()=>n?.(r,l.key,!d),className:`rounded-full px-2.5 py-1 font-medium text-[11px] ${d?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-600"} ${s||a?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:d?"\u958B":"\u9589"}),!b&&d&&o==="unmeasured"&&Re("div",{"data-testid":`strategy-unmeasured-${r.domainKey}-${l.key}`,className:"mt-0.5 text-[10px] text-slate-500",children:"\u30D5\u30E9\u30B0\u3092\u8AAD\u3081\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u8D70\u308B\u304B\u3069\u3046\u304B\u5224\u308A\u307E\u305B\u3093"}),!b&&d&&o==="closed"&&Re("div",{"data-testid":`strategy-blocked-${r.domainKey}-${l.key}`,className:"mt-0.5 text-[10px] text-amber-700",children:"\u30D5\u30E9\u30B0\u304C\u9589\u3058\u3066\u3044\u308B\u305F\u3081\u8D70\u308A\u307E\u305B\u3093"})]},l.key)})]},`${r.domainKey}:${r.strategyName}`))})]})})]})}var Yt={connected:"\u6B63\u5E38\u63A5\u7D9A",error:"\u63A5\u7D9A\u30A8\u30E9\u30FC"},Wt={connected:{"data-cui-fg":"success-fg","data-cui-surface":"success-tint"},error:{"data-cui-fg":"danger-fg","data-cui-surface":"danger-tint"}};import{Fragment as es,jsx as W,jsxs as fe}from"react/jsx-runtime";var Vi={engine:"\u30A8\u30F3\u30B8\u30F3",edition:"\u30A8\u30C7\u30A3\u30B7\u30E7\u30F3",fullVersion:"\u5B8C\u5168\u30D0\u30FC\u30B8\u30E7\u30F3",title:"\u540D\u79F0",collectionsCount:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3",nodeCount:"\u30CE\u30FC\u30C9\u6570 (\u30C6\u30CA\u30F3\u30C8)",totalKeys:"\u30AD\u30FC\u7DCF\u6570",database:"DB",endpointsCount:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8",port:"\u30DD\u30FC\u30C8",restPort:"REST \u30DD\u30FC\u30C8",boltUri:"Bolt URI",tls:"TLS"},Jr=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],Gi=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]),Fn={atomic:{label:"min-w-0 text-muted-foreground",slot:"shrink-0 whitespace-nowrap text-right"},anywhere:{label:"shrink-0 text-muted-foreground",slot:"wrap-anywhere min-w-0 text-right"}};function Qr(e){return e.kind==="text"?"anywhere":"atomic"}function ts(e,t){return t===null?{kind:"unmeasured"}:Gi.has(e)&&typeof t=="number"?{kind:"count",count:t}:typeof t=="boolean"?{kind:"word",text:t?"\u6709\u52B9":"\u7121\u52B9"}:typeof t=="number"?{kind:"number",value:t}:{kind:"text",text:t}}function ji(e){let t=Jr.filter(a=>a in e),n=Object.keys(e).filter(a=>!Jr.includes(a)).sort();return[...t,...n].map(a=>({key:a,label:Vi[a]??a,value:ts(a,e[a])}))}function Zr(e,t){switch(e.kind){case"count":return W(te,{value:e.count,unit:"\u4EF6",testId:t});case"unmeasured":return W(je,{text:null,testId:t});case"number":if(!Number.isFinite(e.value))throw new RangeError(`${t}: a number the probe read must be finite, got ${e.value} (pass null when the probe could not read it)`);return W(je,{text:String(e.value),testId:t});case"word":return W(je,{text:e.text,testId:t});case"text":return W(sn,{text:e.text,testId:t})}}function Cu({health:e,isRefreshing:t=!1,onRefresh:n,className:a=""}){let{services:s,allHealthy:r,checkedAt:l}=e;I();let d=[{key:"qdrant",data:s.qdrant,title:"Qdrant",subtitle:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u30A8\u30F3\u30B8\u30F3 (Vector DB)"},{key:"neo4j",data:s.neo4j,title:"Neo4j",subtitle:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5 (Graph DB)"},{key:"redis",data:s.redis,title:"Redis",subtitle:"\u30AD\u30E3\u30C3\u30B7\u30E5 & Pub/Sub (Cache)"},{key:"sqlServer",data:s.sqlServer,title:"SQL Server",subtitle:"\u6B63\u6E96\u30C7\u30FC\u30BF\u30B9\u30C8\u30A2 (Single Source of Truth)"},{key:"quantsApi",data:s.quantsApi,title:"AI Quant API",subtitle:"Python \u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u63A8\u8AD6\u30A8\u30F3\u30B8\u30F3"}];return fe("section",{"data-cui-migration":"pending",className:`rounded-lg border border-solid bg-card p-5 text-card-foreground shadow-sm ${a}`,"data-testid":"infrastructure-health-monitor","data-healthy":String(r),children:[fe("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-solid pb-4",children:[fe("div",{className:"flex items-center gap-3",children:[W("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:fe("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[W("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),W("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),W("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),W("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}),fe("div",{children:[W("h2",{className:"font-bold text-base",children:"\u5468\u8FBA\u6A5F\u80FD\u63A5\u7D9A\u72B6\u614B & \u30D0\u30FC\u30B8\u30E7\u30F3"}),fe("p",{className:"text-muted-foreground text-xs",children:["\u6700\u7D42\u78BA\u8A8D:"," ",W("span",{"data-testid":"health-checked-at",children:W(pe,{iso:l,testId:"health-checked-at-value"})})," ","| \u5168 5 \u7CFB\u7D71\u306E\u57FA\u76E4\u30B5\u30FC\u30D3\u30B9\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u6B7B\u6D3B\u76E3\u8996"]})]})]}),fe("div",{className:"flex flex-wrap items-center gap-3",children:[W("span",{className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1 font-medium text-xs",...Wt[r?"connected":"error"],"data-testid":"health-overall-status-badge",children:r?fe(es,{children:[fe("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[W("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),W("polyline",{points:"22 4 12 14.01 9 11.01"})]}),fe("span",{children:["\u5168\u30B5\u30FC\u30D3\u30B9",Yt.connected]})]}):fe(es,{children:[fe("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[W("circle",{cx:"12",cy:"12",r:"10"}),W("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),W("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),fe("span",{children:["\u4E00\u90E8\u30B5\u30FC\u30D3\u30B9",Yt.error]})]})}),n&&fe("button",{type:"button",onClick:n,disabled:t,"data-testid":"health-refresh-button",className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md border border-solid bg-background px-3 py-1.5 font-medium text-xs shadow-sm hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50",children:[fe("svg",{className:`h-3.5 w-3.5 ${t?"animate-spin":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[W("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),W("path",{d:"M3 3v5h5"}),W("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"}),W("path",{d:"M16 21h5v-5"})]}),W("span",{children:"\u518D\u78BA\u8A8D"})]})]})]}),W("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5",children:d.map(({key:o,data:b,title:$,subtitle:P})=>{let i=ts("version",b.version),L=Fn[Qr(i)],A=Zr(i,`service-version-value-${o}`);return fe("div",{"data-testid":`service-card-${o}`,className:"flex flex-col justify-between rounded-md border border-border border-solid bg-card/60 p-3.5 transition-colors hover:bg-muted/40",children:[fe("div",{children:[fe("div",{className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[W("span",{className:"font-semibold text-sm",children:$}),fe("span",{className:"inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm px-1.5 py-0.5 font-medium text-[11px]",...Wt[b.status],"data-testid":`service-status-${o}`,children:[W("span",{className:"h-1.5 w-1.5 rounded-full bg-current","data-testid":`service-status-dot-${o}`}),Yt[b.status]]})]}),W("p",{className:"mt-1 text-[11px] text-muted-foreground",children:P}),fe("div",{className:"mt-3 space-y-1.5 border-t border-solid pt-2 text-xs",children:[fe("div",{className:"flex items-start justify-between gap-2","data-testid":`service-version-row-${o}`,children:[W("span",{className:L.label,children:"\u30D0\u30FC\u30B8\u30E7\u30F3:"}),W("span",{className:`${L.slot} font-medium text-[11px]`,"data-testid":`service-version-${o}`,children:i.kind==="text"?W("code",{className:"font-mono font-semibold",children:A}):A})]}),fe("div",{className:"flex items-start justify-between gap-2","data-testid":`health-latency-row-${o}`,children:[W("span",{className:Fn.atomic.label,children:"\u5FDC\u7B54\u6642\u9593:"}),W("span",{className:`${Fn.atomic.slot} font-mono text-[11px] text-muted-foreground`,"data-testid":`health-latency-${o}`,children:W(te,{value:b.latencyMs,unit:"ms",testId:`health-latency-value-${o}`})})]}),ji(b.details).map(m=>{let y=Fn[Qr(m.value)];return fe("div",{className:"flex items-start justify-between gap-2","data-testid":`health-detail-row-${o}-${m.key}`,children:[fe("span",{className:y.label,children:[m.label,":"]}),W("span",{className:`${y.slot} font-medium text-[11px]`,"data-testid":`health-detail-${o}-${m.key}`,children:Zr(m.value,`health-detail-value-${o}-${m.key}`)})]},m.key)})]})]}),fe("div",{className:"mt-3 border-t border-solid pt-1.5 text-[10px] text-muted-foreground",children:[W("span",{className:"wrap-anywhere font-mono","data-testid":`service-endpoint-${o}`,children:b.endpoint}),b.errorMessage!==void 0&&rn.test(b.errorMessage)&&W("p",{className:"wrap-anywhere mt-1 rounded-sm px-1.5 py-0.5",...Wt.error,"data-testid":`service-error-${o}`,children:b.errorMessage})]})]},o)})})]})}import{FILTERABLE_CONFIDENTIALITY_LEVELS as qi,SEARCH_FUSIONS as zi,SEARCH_MODES as Xi,SEARCH_PARAM_LIMITS as Ie}from"@aiquants/enrichment-core";import{useEffect as Yi,useId as Wi,useRef as va,useState as ve}from"react";import{Fragment as id,jsx as _,jsxs as dt}from"react/jsx-runtime";var Ji=[{id:"balanced-hybrid",title:"\u63A8\u5968\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9",description:"RRF (k=60) \u3067\u8A9E\u5F59\u3068\u610F\u5473\u306E\u9806\u4F4D\u3092\u5408\u308F\u305B\u308B",params:{mode:"HYBRID",limit:20,fusion:"rrf",rrf_k:60}},{id:"high-precision-vector",title:"\u9AD8\u7CBE\u5EA6\u30D9\u30AF\u30C8\u30EB",description:"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6 0.75 \u4EE5\u4E0A\u306E\u5BC6\u30D9\u30AF\u30C8\u30EB\u3060\u3051",params:{mode:"DENSE",limit:10,threshold:.75}},{id:"strict-lexical",title:"\u53B3\u683C\u30AD\u30FC\u30EF\u30FC\u30C9",description:"SQL \u306E\u8A9E\u53E5\u306E\u4E00\u81F4\u3060\u3051",params:{mode:"KEYWORD",limit:20}},{id:"lexical-sparse",title:"\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u3067\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u4E00\u81F4\u3092\u72D9\u3046",params:{mode:"SPARSE",limit:20}},{id:"graph-reasoning",title:"\u30B0\u30E9\u30D5\u6DF1\u6398\u308A",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u306E\u9806\u4F4D\u3092\u4E3B\u306B\u3059\u308B",params:{mode:"GRAPH_TRAVERSE",limit:30}}],Na={PUBLIC:"\u516C\u958B (PUBLIC)",INTERNAL:"\u793E\u5185 (INTERNAL)",DEPARTMENT:"\u90E8\u7F72 (DEPARTMENT)",CONFIDENTIAL:"\u6A5F\u5BC6 (CONFIDENTIAL)"},Ea="ALL",un={request:"\u8981\u6C42",response:"\u5FDC\u7B54",flow:"\u8D70\u308A",graph:"\u30B0\u30E9\u30D5\u306E\u8DE1"},Qi="\u307E\u3060\u691C\u7D22\u3057\u3066\u3044\u307E\u305B\u3093\u3002",Zi=(Ie.threshold.min+Ie.threshold.max)/2,ed=336,td=544;function nd(e){let t=e.trim().length;return t<Ie.queryLength.min?"\u691C\u7D22\u8A9E\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002":t>Ie.queryLength.max?`\u691C\u7D22\u8A9E\u306F ${Ie.queryLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function ad(e){let t=e.trim();if(t!=="")return/^[1-9]\d*$/.test(t)&&Number.isSafeInteger(Number(t))?void 0:"\u90E8\u7F72\u306E ID \u306F 1 \u4EE5\u4E0A\u306E\u6574\u6570\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}function ns(e,t){return t.trim().length>Ie.filterTextLength.max?`${e}\u306F ${Ie.filterTextLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function rd(e){return e.fusion==="rrf"?`RRF (k=${e.rrf_k})`:e.fusion==="linear"?`\u7DDA\u5F62 (\u03B1=${e.alpha}, k=${e.rrf_k})`:"\u878D\u5408\u306A\u3057 (1 \u3064\u306E\u9806\u4F4D\u3060\u3051\u306E\u6226\u7565)"}function sd({params:e,answer:t}){let n=t.search_metadata,a=n.executed_tiers,s=r=>r?"\u2713":"\u2013";return[`\u8981\u6C42\u306E\u6226\u7565: ${n.requested_mode} (${ft[n.requested_mode].label})`,`\u8D70\u3063\u305F\u6226\u7565: ${n.search_mode} (${ft[n.search_mode].label})`,`\u8D70\u3063\u305F\u5C64: \u8A9E\u53E5 ${s(a.lexical)} / \u758E ${s(a.sparse)} / \u5BC6 ${s(a.dense)} / \u30B0\u30E9\u30D5 ${s(a.graph)}`,`\u878D\u5408: ${rd(e)}`,`\u54C1\u8CEA: ${Zt[n.quality_tier]}`,`\u7E2E\u9000\u306E\u7406\u7531: ${n.degradation_reasons.length===0?"\u7121\u3057":n.degradation_reasons.join(", ")}`,`\u906E\u65AD\u5668: \u30D9\u30AF\u30C8\u30EB ${en[n.circuit_breaker_status.vector]} / \u30B0\u30E9\u30D5 ${en[n.circuit_breaker_status.graph]}`,`\u6240\u8981: ${n.execution_time_ms} ms`,`\u4EF6\u6570: ${t.hits.length}`].join(`
2
- `)}function od({answer:e}){if(!e.search_metadata.executed_tiers.graph)return"\u30B0\u30E9\u30D5\u306E\u5C64\u306F\u8D70\u3063\u3066\u3044\u307E\u305B\u3093\u3002";if(e.authz_scopes.row_scope_applied)return"\u884C\u306E\u30B9\u30B3\u30FC\u30D7\u304C\u639B\u304B\u308B\u305F\u3081\u3001\u95A2\u4FC2\u306F\u793A\u3057\u307E\u305B\u3093 (\u95A2\u4FC2\u306E\u5148\u306F\u884C\u306E\u8A8D\u53EF\u3092\u901A\u3063\u3066\u3044\u307E\u305B\u3093)\u3002";let t=e.hits.flatMap((n,a)=>(n.graph_relations??[]).map(s=>`#${a+1} ${n.file_name??Ft}: ${s.relation} \u2192 ${s.target_name}`));return t.length===0?"\u3069\u306E\u6587\u66F8\u306B\u3082\u95A2\u4FC2\u306F\u3042\u308A\u307E\u305B\u3093\u3002":t.join(`
3
- `)}function nt(e,t){return e?Ft:t===null||t===""?"\u7121\u3057":String(t)}function Mu({tenantId:e,onSearch:t,initialParams:n}){let{formatLocale:a}=I(),s=bt(),r=Wi(),[l,d]=ve(n?.q??""),[o,b]=ve(n?.mode??"HYBRID"),[$,P]=ve(n?.limit??Ie.limit.default),[i,L]=ve(n?.threshold??Zi),[A,m]=ve(n?.fusion??"rrf"),[y,v]=ve(n?.rrf_k??Ie.rrfK.default),[D,C]=ve(n?.alpha??Ie.alpha.default),[G,h]=ve(n?.confidentiality_level??Ea),[M,O]=ve(n?.department_id===void 0?"":String(n.department_id)),[re,Ee]=ve(n?.mime_type??""),[T,ae]=ve(n?.tag??""),[J,Le]=ve(!1),[Ze,He]=ve(!1),[$e,De]=ve(!1),[se,S]=ve("request"),[ee,F]=ve(!1),[oe,ge]=ve(!1),[ie,Me]=ve(null),[p,H]=ve(null),[de,ue]=ve(null),[Pe,Ke]=ve(null),lt=va(0),Ve=va(0),Fe=va(null);Yi(()=>()=>Fe.current?.abort(),[]);let et={query:nd(l),department:ad(M),mimeType:ns("MIME \u30BF\u30A4\u30D7",re),tag:ns("\u30BF\u30B0",T)},tt=ee?et:{},Ae=()=>{let f=M.trim(),Ce=re.trim(),he=T.trim();return{q:l.trim(),mode:o,limit:$,...o==="DENSE"?{threshold:i}:{},...o==="HYBRID"?{fusion:A,rrf_k:y,...A==="linear"?{alpha:D}:{}}:{},...G===Ea?{}:{confidentiality_level:G},...f===""?{}:{department_id:Number(f)},...Ce===""?{}:{mime_type:Ce},...he===""?{}:{tag:he}}},x=async f=>{let Ce=new AbortController;Fe.current=Ce,ge(!0);try{let he=await t(f,Ce.signal);if(Ce.signal.aborted)return;Me({params:f,answer:he}),H(he.hits.length===0?null:"1"),ue(null),s(he.hits.length===0?"\u6761\u4EF6\u306B\u5408\u3046\u6587\u66F8\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002":`${he.hits.length} \u4EF6\u306E\u6587\u66F8\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u3002`)}catch(he){if(Ce.signal.aborted)return;lt.current+=1,ue({message:he instanceof Error?he.message:"\u691C\u7D22\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",occurrence:lt.current})}finally{Fe.current===Ce&&(Fe.current=null,ge(!1))}},E=f=>{f.preventDefault(),F(!0),!(oe||Object.values(et).some(Ce=>Ce!==void 0))&&x(Ae())},U=f=>{b(f.params.mode),P(f.params.limit),f.params.threshold!==void 0&&L(f.params.threshold),f.params.fusion!==void 0&&m(f.params.fusion),f.params.rrf_k!==void 0&&v(f.params.rrf_k),s(`\u30D7\u30EA\u30BB\u30C3\u30C8\u300C${f.title}\u300D\u3092\u5F53\u3066\u307E\u3057\u305F\u3002`)},V=f=>{if(ie===null)return Qi;switch(f){case"request":return JSON.stringify(ie.params,null,2);case"response":return JSON.stringify(ie.answer,null,2);case"flow":return sd(ie);case"graph":return od(ie)}},me=async()=>{try{await navigator.clipboard.writeText(V(se)),Ke(null),s(`${un[se]}\u3092\u5199\u3057\u307E\u3057\u305F\u3002`)}catch(f){Ve.current+=1,Ke({message:`\u5199\u305B\u307E\u305B\u3093\u3067\u3057\u305F: ${f instanceof Error?f.message:String(f)}`,occurrence:Ve.current})}},X=ie?.answer??null,be=f=>X?.authz_scopes.hidden_columns.includes(f)===!0,Mt=X===null?[]:X.hits.map((f,Ce)=>({hit:f,rank:Ce+1})),Qt=Mt.find(f=>String(f.rank)===p)??null,Vn=(f,Ce)=>{let he=f.scores;return _(qn,{id:r,title:`#${Ce} ${nt(be("file_name"),f.file_name)}`,region:!0,testId:"search-hit-detail",children:dt(Se,{gap:"space-4",testId:"search-hit-detail-body",children:[_(Kt,{items:[{key:"fused",term:"\u878D\u5408\u306E\u5024",description:_(Xn,{label:"\u878D\u5408\u306E\u5024",value:he.fused,min:0,max:1,valueText:he.fused.toFixed(Ut),testId:"search-hit-detail-fused"})},{key:"vector",term:"\u30D9\u30AF\u30C8\u30EB\u306E\u5024",description:_(K,{fg:"fg",type:"body",children:he.vector===null?"\u30D9\u30AF\u30C8\u30EB\u306E\u5217\u306B\u7121\u3044":Ma(he.vector)})},{key:"lexical",term:"\u8A9E\u53E5\u306E\u9806\u4F4D\u306E\u5024",description:_(K,{fg:"fg",type:"body",children:he.lexical_rank===null?"\u8A9E\u53E5\u306E\u5217\u306B\u7121\u3044":he.lexical_rank.toFixed(Ut)})},{key:"graph",term:"\u30B0\u30E9\u30D5\u306E\u9806\u4F4D\u306E\u5024",description:_(K,{fg:"fg",type:"body",children:he.graph_rank===null?"\u30B0\u30E9\u30D5\u306E\u5217\u306B\u7121\u3044":he.graph_rank.toFixed(Ut)})}],testId:"search-hit-scores"}),_(Kt,{items:[{key:"file_uri",term:"URI",description:_(K,{fg:"fg",type:"body",face:"mono",children:nt(be("file_uri"),f.file_uri)})},{key:"mime_type",term:"MIME \u30BF\u30A4\u30D7",description:_(K,{fg:"fg",type:"body",children:nt(be("mime_type"),f.mime_type)})},{key:"folder_path",term:"\u30D5\u30A9\u30EB\u30C0",description:_(K,{fg:"fg",type:"body",children:nt(be("folder_path"),f.folder_path)})},{key:"confidentiality_level",term:"\u6A5F\u5BC6\u533A\u5206",description:_(K,{fg:"fg",type:"body",children:nt(be("confidentiality_level"),f.confidentiality_level)})},{key:"department_id",term:"\u90E8\u7F72",description:_(K,{fg:"fg",type:"body",children:nt(be("department_id"),f.department_id)})},{key:"created_by",term:"\u767B\u9332\u8005",description:_(K,{fg:"fg",type:"body",children:nt(be("created_by"),f.created_by)})},{key:"mtime",term:"\u66F4\u65B0",description:be("mtime")?_(K,{fg:"fg",type:"body",children:Ft}):_(pe,{iso:f.mtime,testId:"search-hit-mtime-value"})},{key:"tags",term:"\u30BF\u30B0",description:be("tags")||f.tags===null||f.tags.length===0?_(K,{fg:"fg",type:"body",children:nt(be("tags"),null)}):_(We,{gap:"space-2",testId:"search-hit-tags",children:f.tags.map(u=>_(Ue,{tone:"neutral",variant:"tint",testId:`search-hit-tag-${u}`,children:u},u))})},{key:"ai_summary",term:"AI \u306E\u8981\u7D04",description:_(K,{fg:"fg",type:"prose",children:nt(be("ai_summary"),f.ai_summary)})}],testId:"search-hit-fields"}),dt(Se,{gap:"space-2",testId:"search-hit-relations",children:[_(K,{as:"p",fg:"fg-secondary",type:"body",children:"\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2"}),f.graph_relations===null?_(K,{as:"p",fg:"fg",type:"prose",children:"\u884C\u306E\u30B9\u30B3\u30FC\u30D7\u304C\u639B\u304B\u308B\u305F\u3081\u793A\u3057\u307E\u305B\u3093 (\u95A2\u4FC2\u306E\u5148\u306F\u884C\u306E\u8A8D\u53EF\u3092\u901A\u3063\u3066\u3044\u307E\u305B\u3093)\u3002"}):f.graph_relations.length===0?_(K,{as:"p",fg:"fg",type:"prose",children:"\u7121\u3057"}):_("ul",{"data-testid":"search-hit-relation-list",children:f.graph_relations.map(u=>_("li",{children:_(K,{fg:"fg",type:"body",children:`${u.relation} \u2192 ${u.target_name}`})},`${u.relation}-${u.target_name}`))})]}),be("structured_data")||f.structured_data===null?_(K,{as:"p",fg:"fg",type:"prose",testId:"search-hit-structured-absent",children:`\u69CB\u9020\u5316\u30C7\u30FC\u30BF: ${nt(be("structured_data"),null)}`}):_(zn,{label:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF",code:JSON.stringify(f.structured_data,null,2),testId:"search-hit-structured"})]})})};return dt(Se,{gap:"space-6",testId:"metadata-search-workbench",children:[_(at,{title:"\u6587\u66F8\u306E\u691C\u7D22",description:`\u30C6\u30CA\u30F3\u30C8 ${e} \u306E\u6587\u66F8\u3092\u3001\u8A9E\u53E5\u30FB\u30D9\u30AF\u30C8\u30EB\u30FB\u30B0\u30E9\u30D5\u306E\u5C64\u3067\u63A2\u3057\u307E\u3059\u3002`,testId:"search-query-card",dataAttributes:{"data-mode":o,"data-running":oe},children:_("form",{onSubmit:E,noValidate:!0,"data-testid":"search-form",children:dt(Se,{gap:"space-4",testId:"search-form-fields",children:[_(ut,{label:"\u691C\u7D22\u8A9E",type:"search",value:l,onValueChange:d,required:!0,description:`1\u301C${Ie.queryLength.max} \u5B57`,error:tt.query,testId:"search-query"}),_(gt,{label:"\u691C\u7D22\u306E\u6226\u7565",options:Xi.map(f=>({value:f,label:ft[f].label})),value:o,onValueChange:f=>b(f),testId:"search-mode"}),_(K,{as:"p",fg:"fg-secondary",type:"prose",testId:"search-mode-description",children:ft[o].description}),_(kt,{label:"\u4EF6\u6570",value:$,min:Ie.limit.min,max:Ie.limit.max,step:1,valueText:f=>`${f} \u4EF6`,onValueChange:P,testId:"search-limit"}),o==="DENSE"&&_(kt,{label:"\u985E\u4F3C\u5EA6\u306E\u4E0B\u9650",value:i,min:Ie.threshold.min,max:Ie.threshold.max,step:.01,valueText:f=>f.toFixed(2),onValueChange:L,testId:"search-threshold"}),o==="HYBRID"&&dt(Se,{gap:"space-4",testId:"search-fusion-controls",children:[_(gt,{label:"\u878D\u5408",options:zi.map(f=>({value:f,label:Oa[f]})),value:A,onValueChange:f=>m(f),testId:"search-fusion"}),_(kt,{label:"\u9806\u4F4D\u306E\u5024\u306E k",value:y,min:Ie.rrfK.min,max:Ie.rrfK.max,step:1,valueText:String,onValueChange:v,testId:"search-rrf-k"}),A==="linear"&&_(kt,{label:"\u30D9\u30AF\u30C8\u30EB\u306E\u91CD\u307F (\u03B1)",value:D,min:Ie.alpha.min,max:Ie.alpha.max,step:.05,valueText:f=>f.toFixed(2),onValueChange:C,testId:"search-alpha"})]}),_(En,{summary:"\u8A73\u3057\u3044\u6761\u4EF6",open:J,onOpenChange:Le,testId:"search-filters",children:dt(Se,{gap:"space-4",testId:"search-filter-fields",children:[_(Tt,{label:"\u6A5F\u5BC6\u533A\u5206",value:G,options:[{value:Ea,label:"\u5168\u3066\u306E\u533A\u5206"},...qi.map(f=>({value:f,label:Na[f]}))],onValueChange:h,testId:"search-confidentiality"}),_(ut,{label:"\u90E8\u7F72\u306E ID",type:"text",value:M,onValueChange:O,description:"1 \u4EE5\u4E0A\u306E\u6574\u6570",error:tt.department,testId:"search-department"}),_(ut,{label:"MIME \u30BF\u30A4\u30D7 (\u542B\u3080\u4E00\u81F4)",type:"text",value:re,onValueChange:Ee,error:tt.mimeType,testId:"search-mime-type"}),_(ut,{label:"\u30BF\u30B0 (\u5B8C\u5168\u4E00\u81F4)",type:"text",value:T,onValueChange:ae,error:tt.tag,testId:"search-tag"})]})}),_(En,{summary:"\u958B\u767A\u8005\u306E\u30D7\u30EA\u30BB\u30C3\u30C8",open:Ze,onOpenChange:He,testId:"search-presets",children:_(Se,{gap:"space-2",testId:"search-preset-list",children:Ji.map(f=>dt(We,{gap:"space-2",testId:`search-preset-${f.id}`,children:[_(xe,{variant:"secondary",onClick:()=>U(f),testId:`search-preset-${f.id}-apply`,children:f.title}),_(K,{fg:"fg-secondary",type:"body",children:f.description})]},f.id))})}),_(We,{gap:"space-2",testId:"search-actions",children:_(xe,{variant:"primary",type:"submit",busy:oe,busyLabel:"\u691C\u7D22\u3057\u3066\u3044\u307E\u3059",testId:"search-submit",children:"\u691C\u7D22\u3059\u308B"})})]})})}),de!==null&&_(Be,{occurrence:de.occurrence,testId:"search-failure",children:de.message}),X!==null&&_(Ha,{metadata:X.search_metadata,testId:"search-degraded"}),X!==null&&_(at,{title:"\u691C\u7D22\u306E\u7D50\u679C",description:`${X.hits.length} \u4EF6 \xB7 ${On(X.search_metadata.execution_time_ms,"execution_time_ms",a)} ms \xB7 \u54C1\u8CEA: ${Zt[X.search_metadata.quality_tier]}`,testId:"search-results",children:dt(Se,{gap:"space-4",testId:"search-results-body",children:[_(Kt,{items:[{key:"tiers",term:"\u8D70\u3063\u305F\u5C64",description:_(We,{gap:"space-2",testId:"search-tiers",children:[["lexical","\u8A9E\u53E5"],["sparse","\u758E\u30D9\u30AF\u30C8\u30EB"],["dense","\u5BC6\u30D9\u30AF\u30C8\u30EB"],["graph","\u30B0\u30E9\u30D5"]].map(([f,Ce])=>_(Ue,{tone:X.search_metadata.executed_tiers[f]?"success":"neutral",variant:"tint",testId:`search-tier-${f}`,dataAttributes:{"data-ran":X.search_metadata.executed_tiers[f]},children:`${Ce} ${X.search_metadata.executed_tiers[f]?"\u8D70\u3063\u305F":"\u8D70\u3089\u306A\u304B\u3063\u305F"}`},f))})},{key:"breakers",term:"\u906E\u65AD\u5668",description:_(K,{fg:"fg",type:"body",testId:"search-breakers",children:`\u30D9\u30AF\u30C8\u30EB ${en[X.search_metadata.circuit_breaker_status.vector]} \xB7 \u30B0\u30E9\u30D5 ${en[X.search_metadata.circuit_breaker_status.graph]}`})},{key:"rows",term:"\u884C\u306E\u30B9\u30B3\u30FC\u30D7",description:_(K,{fg:"fg",type:"body",testId:"search-row-scope",children:X.authz_scopes.row_scope_applied?"\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u8AAD\u3081\u306A\u3044\u6587\u66F8\u306F\u4E00\u89A7\u306B\u542B\u307F\u307E\u305B\u3093)":"\u639B\u304B\u3063\u3066\u3044\u307E\u305B\u3093"})},{key:"columns",term:"\u5217\u306E\u30B9\u30B3\u30FC\u30D7",description:_(K,{fg:"fg",type:"body",testId:"search-column-scope",children:X.authz_scopes.column_scope_applied?X.authz_scopes.hidden_columns.length===0?"\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u7B54\u3048\u306E\u6B04\u306B\u4F0F\u305B\u305F\u3082\u306E\u306F\u3042\u308A\u307E\u305B\u3093)":`\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u4F0F\u305B\u305F\u6B04: ${X.authz_scopes.hidden_columns.join("\u30FB")})`:"\u639B\u304B\u3063\u3066\u3044\u307E\u305B\u3093"})}],testId:"search-run"}),_(bn,{master:_(vn,{label:"\u898B\u3064\u304B\u3063\u305F\u6587\u66F8",items:Mt,itemKey:f=>String(f.rank),selectedKey:p,onSelect:f=>H(String(f.rank)),detailId:r,renderRow:f=>dt(id,{children:[_(K,{fg:"fg",type:"body",children:`#${f.rank} ${nt(be("file_name"),f.hit.file_name)}`}),_(Xn,{label:`#${f.rank} \u306E\u878D\u5408\u306E\u5024`,value:f.hit.scores.fused,min:0,max:1,valueText:f.hit.scores.fused.toFixed(Ut),testId:`search-hit-${f.rank}-fused`})]}),rowTestId:"search-hit-row",rowData:f=>({"data-rank":f.rank}),empty:"\u6761\u4EF6\u306B\u5408\u3046\u6587\u66F8\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u691C\u7D22\u8A9E\u3092\u77ED\u304F\u3059\u308B\u304B\u3001\u6226\u7565\u3084\u7D5E\u308A\u8FBC\u307F\u3092\u5909\u3048\u3066\u304F\u3060\u3055\u3044\u3002",testId:"search-hits"}),detail:Qt===null?_(qn,{id:r,title:"\u6587\u66F8\u306E\u8A73\u7D30",region:!0,testId:"search-hit-detail",children:_(K,{as:"p",fg:"fg-secondary",type:"prose",children:"\u4E00\u89A7\u306E\u884C\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u6587\u66F8\u306E\u8A73\u7D30\u3092\u793A\u3057\u307E\u3059\u3002"})}):Vn(Qt.hit,Qt.rank),masterMinPx:ed,detailMinPx:td,testId:"search-master-detail"})]})}),_(En,{summary:"\u958B\u767A\u8005\u306E\u70B9\u691C",open:$e,onOpenChange:De,testId:"search-inspector",children:dt(Se,{gap:"space-4",testId:"search-inspector-body",children:[_(gt,{label:"\u70B9\u691C\u306E\u7A93",options:Object.keys(un).map(f=>({value:f,label:un[f]})),value:se,onValueChange:f=>S(f),testId:"search-inspector-view"}),_(zn,{label:`\u70B9\u691C\u306E\u7A93: ${un[se]}`,code:V(se),testId:"search-inspector-code"}),_(We,{gap:"space-2",testId:"search-inspector-actions",children:_(xe,{variant:"secondary",onClick:()=>{me()},testId:"search-inspector-copy",children:`${un[se]}\u3092\u5199\u3059`})}),Pe!==null&&_(Be,{occurrence:Pe.occurrence,testId:"search-inspector-copy-failure",children:Pe.message})]})})]})}import{SEARCH_PARAM_LIMITS as Dt}from"@aiquants/enrichment-core";import{useEffect as dd,useRef as as,useState as _t}from"react";import{jsx as ye,jsxs as Un}from"react/jsx-runtime";var ld=4;function rs(e){return`${e.label} (${e.embeddingModel})`}function cd(e){let t=e.trim().length;return t<Dt.queryLength.min?"\u554F\u3044\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002":t>Dt.queryLength.max?`\u554F\u3044\u306F ${Dt.queryLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function ju({variants:e,onCompare:t}){let{formatLocale:n}=I(),a=bt(),[s,r]=_t(null),[l,d]=_t(null),[o,b]=_t(""),[$,P]=_t(Dt.limit.default),[i,L]=_t(!1),[A,m]=_t(!1),[y,v]=_t(null),[D,C]=_t(null),G=as(0),h=as(null);dd(()=>()=>h.current?.abort(),[]);let M=e.map(S=>S.strategyId),O=s!==null&&M.includes(s)?s:M[0]??null,re=l!==null&&M.includes(l)?l:M[1]??null,Ee=O!==null&&O===re,T={query:cd(o),variant:Ee?"\u540C\u3058\u5909\u7A2E\u3069\u3046\u3057\u306F\u6BD4\u3079\u3089\u308C\u307E\u305B\u3093\u3002\u5225\u306E\u5909\u7A2E\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002":void 0},ae=i?T.query:void 0,J=S=>{let ee=e.find(F=>F.strategyId===S);return ee===void 0?`\u6226\u7565 #${S}`:rs(ee)},Le=S=>{G.current+=1,v(null),C({message:S,occurrence:G.current})},Ze=async S=>{let ee=new AbortController;h.current=ee,m(!0);try{let F=await t(S,ee.signal);if(ee.signal.aborted)return;let oe=F.results.find(ie=>ie.strategy_id===S.strategy_ids[0]),ge=F.results.find(ie=>ie.strategy_id===S.strategy_ids[1]);if(oe===void 0||ge===void 0){Le(`\u7B54\u3048\u306B\u6226\u7565 #${oe===void 0?S.strategy_ids[0]:S.strategy_ids[1]} \u306E\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093\u3002`);return}v({input:S,answer:F,results:[oe,ge]}),C(null),a(`\u5909\u7A2E A \u306F ${oe.hits.length} \u4EF6\u3001\u5909\u7A2E B \u306F ${ge.hits.length} \u4EF6\u3092\u8FD4\u3057\u307E\u3057\u305F\u3002`)}catch(F){if(ee.signal.aborted)return;Le(F instanceof Error?F.message:"\u6BD4\u3079\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002")}finally{h.current===ee&&(h.current=null,m(!1))}},He=S=>{S.preventDefault(),L(!0),!(A||O===null||re===null||T.query!==void 0||T.variant!==void 0)&&Ze({query:o.trim(),strategy_ids:[O,re],limit:$})},$e=e.map(S=>({value:String(S.strategyId),label:rs(S)})),De=(S,ee,F,oe,ge)=>S===void 0?ye(K,{fg:"fg-muted",type:"body",testId:`compare-${ee}-${F}-${oe}`,children:"\u3053\u306E\u9806\u4F4D\u306E\u7D50\u679C\u7121\u3057"}):Un(Se,{gap:"space-1",testId:`compare-${ee}-${F}-${oe}`,children:[ye(K,{fg:"fg-secondary",type:"body",face:"mono",children:`\u6587\u66F8 ${S.metadata_id} \xB7 \u30C1\u30E3\u30F3\u30AF ${S.chunk_index} \xB7 ${S.score.toFixed(ld)}`}),ye(K,{fg:"fg",type:"prose",children:ge||S.text===null?Ft:S.text})]}),se=({answer:S,results:ee})=>{let[F,oe]=ee,ge=Fa(F.hits.map(Gn),oe.hits.map(Gn)),ie=Array.from({length:Math.max(F.hits.length,oe.hits.length)},(p,H)=>H+1),Me=(p,H)=>({key:H,heading:`\u5909\u7A2E ${H.toUpperCase()}: ${J(p.strategy_id)} \xB7 ${On(p.execution_ms,`execution_ms of strategy ${p.strategy_id}`,n)} ms`,cells:Object.fromEntries(ie.map(de=>[`rank-${de}`,ue=>De(p.hits[de-1],H,de,ue,S.text_hidden)]))});return ye(at,{title:"\u6BD4\u3079\u306E\u7D50\u679C",testId:"compare-results",children:Un(Se,{gap:"space-4",testId:"compare-results-body",children:[ye(Kt,{items:[{key:"shared",term:"\u5171\u901A\u306E\u30C1\u30E3\u30F3\u30AF",description:ye(K,{fg:"fg",type:"body",testId:"compare-shared-count",children:`${ge.sharedCount} \u4EF6 (A ${F.hits.length} \u4EF6 / B ${oe.hits.length} \u4EF6)`})},{key:"overlap",term:"\u91CD\u306A\u308A (Jaccard)",description:ye(K,{fg:"fg",type:"body",testId:"compare-overlap-ratio",children:ge.overlapRatio===null?"\u3069\u3061\u3089\u3082\u7D50\u679C\u7121\u3057":`${(ge.overlapRatio*100).toFixed(1)}%`})},{key:"distance",term:"\u9806\u4F4D\u306E\u5DEE\u306E\u5E73\u5747 (\u5171\u901A\u306E\u5206)",description:ye(K,{fg:"fg",type:"body",testId:"compare-rank-difference",children:ge.meanAbsoluteRankDifference===null?"\u5171\u901A\u306E\u7D50\u679C\u7121\u3057":ge.meanAbsoluteRankDifference.toFixed(2)})},{key:"body",term:"\u672C\u6587",description:ye(K,{fg:"fg",type:"body",testId:"compare-text-hidden",children:S.text_hidden?"\u5217\u306E\u30B9\u30B3\u30FC\u30D7\u3067\u4F0F\u305B\u3066\u3044\u307E\u3059":"\u793A\u3057\u3066\u3044\u307E\u3059"})}],testId:"compare-agreement"}),[[F,"A"],[oe,"B"]].map(([p,H])=>p.dense_ran?null:ye(Xe,{tone:"warning",testId:`compare-degraded-${H.toLowerCase()}`,children:ye(K,{as:"p",fg:"fg",type:"prose",children:`\u5909\u7A2E ${H} (${J(p.strategy_id)}) \u306E\u5BC6\u306E\u5C64\u306F\u8D70\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002${p.degradation_reasons.map(gn).join(" ")}`})},H)),ie.length===0?ye(K,{as:"p",fg:"fg",type:"prose",testId:"compare-empty",children:"\u3069\u3061\u3089\u306E\u5909\u7A2E\u306B\u3082\u7D50\u679C\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):ye(xn,{caption:"\u5909\u7A2E\u3054\u3068\u306E\u9806\u4F4D",attributes:ie.map(p=>({key:`rank-${p}`,label:`${p} \u4F4D`})),columns:[Me(F,"a"),Me(oe,"b")],attributePx:64,columnMinPx:272,testId:"compare-grid"})]})})};return Un(Se,{gap:"space-6",testId:"model-comparison-workbench",children:[ye(at,{title:"\u5909\u7A2E\u306E\u6BD4\u3079",description:"\u540C\u3058\u554F\u3044\u3092 2 \u3064\u306E\u6226\u7565\u306E\u5909\u7A2E\u3067\u691C\u7D22\u3057\u3001\u9806\u4F4D\u3092\u4E26\u3079\u307E\u3059\u3002\u5024\u306F\u5909\u7A2E\u3054\u3068\u306B\u5225\u306E\u91CF\u306A\u306E\u3067\u6B63\u898F\u5316\u3057\u307E\u305B\u3093\u3002",testId:"compare-card",dataAttributes:{"data-running":A},children:e.length<2?ye(Xe,{tone:"info",testId:"compare-variants-insufficient",children:ye(K,{as:"p",fg:"fg",type:"prose",children:`\u6BD4\u3079\u308B\u306B\u306F\u5909\u7A2E\u304C 2 \u3064\u4EE5\u4E0A\u8981\u308A\u307E\u3059 (\u4ECA\u306F ${e.length} \u4EF6)\u3002`})}):ye("form",{onSubmit:He,noValidate:!0,"data-testid":"compare-form",children:Un(Se,{gap:"space-4",testId:"compare-form-fields",children:[ye(Tt,{label:"\u5909\u7A2E A",value:String(O),options:$e,onValueChange:S=>r(Number(S)),testId:"compare-variant-a"}),ye(Tt,{label:"\u5909\u7A2E B",value:String(re),options:$e,onValueChange:S=>d(Number(S)),error:T.variant,testId:"compare-variant-b"}),ye(ut,{label:"\u554F\u3044",type:"search",value:o,onValueChange:b,required:!0,description:`1\u301C${Dt.queryLength.max} \u5B57`,error:ae,testId:"compare-query"}),ye(kt,{label:"\u4EF6\u6570",value:$,min:Dt.limit.min,max:Dt.limit.max,step:1,valueText:S=>`${S} \u4EF6`,onValueChange:P,testId:"compare-limit"}),ye(We,{gap:"space-2",testId:"compare-actions",children:ye(xe,{variant:"primary",type:"submit",busy:A,busyLabel:"\u6BD4\u3079\u3066\u3044\u307E\u3059",testId:"compare-submit",children:"\u6BD4\u3079\u308B"})})]})})}),D!==null&&ye(Be,{occurrence:D.occurrence,testId:"compare-failure",children:D.message}),y!==null&&se(y)]})}import{jsx as ne,jsxs as Z}from"react/jsx-runtime";function ss(e){return e===null?mn:`${e.length} \u7A2E`}var mn="\u672A\u8A2D\u5B9A";function pn(e,t=""){return e===null?mn:`${e}${t}`}function Bn(e){return e===null?mn:`${e} \u4EF6`}function ud(e){if(e.currentVersion===null&&e.lifecyclePhase===null)return`${e.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`;let t=e.currentVersion===null?mn:`v${e.currentVersion}`;return`${e.schemaName} ${t} (${e.lifecyclePhase??mn})`}function Xu({tenantId:e,ontologyStatus:t}){let n=t.classes,a=t.predicates;return Z("div",{"data-cui-migration":"pending",className:"space-y-6","data-testid":"ontology-status-card",children:[Z("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[Z("div",{className:"flex flex-col justify-between gap-3 md:flex-row md:items-center",children:[Z("div",{children:[Z("div",{className:"flex items-center gap-2",children:[ne("h2",{className:"font-bold text-base text-slate-900",children:"\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC & \u30B9\u30AD\u30FC\u30DE\u30AC\u30D0\u30CA\u30F3\u30B9\u72B6\u614B"}),ne("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 font-bold text-xs ${t.autonomousEvolutionEnabled?"bg-emerald-100 text-emerald-800":"bg-slate-100 text-slate-700"}`,"data-testid":"ontology-evolution-badge",children:t.autonomousEvolutionEnabled?"\u81EA\u5F8B\u7684\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u9032\u5316: \u6709\u52B9":"\u81EA\u5F8B\u9032\u5316: \u505C\u6B62\u4E2D"}),ne("span",{className:"inline-flex items-center rounded-sm bg-indigo-100 px-2 py-0.5 font-mono font-semibold text-indigo-800 text-xs","data-testid":"ontology-schema-version",children:ud(t)})]}),ne("p",{className:"mt-1 text-slate-500 text-xs",children:"Neo4j \u7269\u7406\u30B0\u30E9\u30D5\u30B9\u30AD\u30FC\u30DE\u5236\u7D04\u3001\u8AD6\u7406\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u30AF\u30E9\u30B9\u4F53\u7CFB\u3001\u304A\u3088\u3073\u4EBA\u9593\u53C2\u52A0\u578B (HITL) \u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u6607\u683C\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3\u306E\u7A3C\u50CD\u72B6\u6CC1"})]}),Z("div",{className:"inline-flex items-center rounded-lg border border-slate-200 border-solid bg-slate-50 px-3 py-1.5 font-medium text-slate-600 text-xs",children:["\u30C6\u30CA\u30F3\u30C8\u540D\u524D\u7A7A\u9593:"," ",ne("span",{className:"ml-1.5 font-bold text-slate-800","data-testid":"ontology-tenant-id",children:e})]})]}),Z("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[Z("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[ne("span",{className:"block text-slate-500 text-xs",children:"\u7269\u7406\u4E00\u610F\u5236\u7D04 (Unique)"}),ne("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-constraints-count",children:Bn(t.totalConstraints)})]}),Z("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[ne("span",{className:"block text-slate-500 text-xs",children:"\u691C\u7D22\u7D22\u5F15 (DDL \u304C\u4F5C\u308B\u5206)"}),ne("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-indexes-count",children:Bn(t.searchIndexes)}),Z("span",{className:"block text-slate-500 text-xs","data-testid":"ontology-indexes-total",children:["\u5168\u7D22\u5F15: ",Bn(t.totalIndexes)]})]}),Z("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[ne("span",{className:"block text-slate-500 text-xs",children:"\u6607\u683C\u5224\u5B9A\u3057\u304D\u3044\u5024 (\u78BA\u4FE1\u5EA6/\u5171\u8D77)"}),Z("span",{className:"mt-1 block font-bold font-mono text-base text-indigo-700","data-testid":"ontology-thresholds-info",children:[pn(t.promotionThresholds.confidence)," / ",pn(t.promotionThresholds.cooccurrence," \u56DE")]})]}),Z("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[ne("span",{className:"block text-slate-500 text-xs",children:"HITL \u6607\u683C\u627F\u8A8D\u5F85\u3061\u5019\u88DC"}),ne("span",{className:"mt-1 block font-bold font-mono text-amber-700 text-base","data-testid":"ontology-unresolved-count",children:Bn(t.unresolvedCandidatesCount)})]})]})]}),Z("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[Z("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[Z("div",{className:"flex items-center justify-between pb-3",children:[Z("div",{children:[ne("h3",{className:"font-bold text-slate-900 text-sm",children:"\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u4E3B\u8981\u30AF\u30E9\u30B9\u4F53\u7CFB (Node Labels)"}),ne("p",{className:"text-slate-500 text-xs",children:"\u30B0\u30E9\u30D5\u5185\u3067\u30E2\u30C7\u30EB\u5316\u3055\u308C\u3066\u3044\u308B\u6B63\u6E96\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u30CE\u30FC\u30C9\u7A2E\u5225"})]}),ne("span",{className:"rounded-sm bg-indigo-50 px-2 py-0.5 font-semibold text-indigo-700 text-xs","data-testid":"ontology-classes-count",children:ss(n)})]}),Z("div",{className:"divide-y divide-solid divide-slate-100",children:[n===null&&ne("p",{className:"py-3 text-slate-500 text-xs","data-testid":"ontology-classes-unsupplied",children:"\u3053\u306E\u914D\u5099\u306E\u30AF\u30E9\u30B9\u8A9E\u5F59\u304C\u4F9B\u7D66\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u5B9F\u88C5\u304C\u8A31\u3059\u8A9E\u5F59\u3092\u8FD4\u3059\u7D4C\u8DEF\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002"}),n?.map(s=>Z("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-class-${s.name}`,children:[Z("div",{children:[ne("span",{className:"inline-block font-bold font-mono text-indigo-700 text-xs",children:s.name}),ne("p",{className:"mt-0.5 text-slate-600 text-xs",children:s.description})]}),typeof s.count=="number"&&ne("span",{className:"rounded-sm bg-slate-100 px-2 py-0.5 font-mono text-slate-600 text-xs",children:s.count.toLocaleString()})]},s.name))]})]}),Z("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[Z("div",{className:"flex items-center justify-between pb-3",children:[Z("div",{children:[ne("h3",{className:"font-bold text-slate-900 text-sm",children:"\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u8FF0\u8A9E\u4F53\u7CFB (Predicates)"}),ne("p",{className:"text-slate-500 text-xs",children:"\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u9593\u306E\u30BB\u30DE\u30F3\u30C6\u30A3\u30C3\u30AF\u95A2\u4FC2\u3068\u6709\u5411\u6027"})]}),ne("span",{className:"rounded-sm bg-amber-50 px-2 py-0.5 font-semibold text-amber-700 text-xs","data-testid":"ontology-predicates-count",children:ss(a)})]}),Z("div",{className:"divide-y divide-solid divide-slate-100",children:[a===null&&ne("p",{className:"py-3 text-slate-500 text-xs","data-testid":"ontology-predicates-unsupplied",children:"\u3053\u306E\u914D\u5099\u306E\u8FF0\u8A9E\u8A9E\u5F59\u304C\u4F9B\u7D66\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u5B9F\u88C5\u304C\u8A31\u3059\u8A9E\u5F59\u3092\u8FD4\u3059\u7D4C\u8DEF\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002"}),a?.map(s=>Z("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-predicate-${s.name}`,children:[Z("div",{children:[ne("span",{className:"inline-block font-bold font-mono text-amber-800 text-xs",children:s.name}),ne("p",{className:"mt-0.5 text-slate-600 text-xs",children:s.description})]}),ne("span",{className:"rounded-sm border border-slate-200 border-solid bg-slate-50 px-2 py-0.5 font-mono text-[11px] text-slate-600",children:s.direction})]},s.name))]})]})]}),Z("div",{className:"rounded-xl border border-indigo-100 border-solid bg-indigo-50/40 p-5 shadow-sm","data-testid":"ontology-evolution-policy-card",children:[ne("h3",{className:"font-bold text-indigo-950 text-sm",children:"\u81EA\u5F8B\u7684\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u9032\u5316 (Autonomous Ontology Evolution) \u30DD\u30EA\u30B7\u30FC"}),Z("div",{className:"mt-2 grid grid-cols-1 gap-3 text-indigo-900 text-xs md:grid-cols-3",children:[Z("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[ne("span",{className:"font-semibold text-slate-700",children:"3 \u6761\u4EF6 AND \u30B2\u30FC\u30C8:"}),Z("p",{className:"mt-1 text-slate-600",children:["\u672A\u89E3\u6C7A\u30E1\u30F3\u30B7\u30E7\u30F3\u51FA\u73FE\u6642\u306B\u985E\u4F3C\u5EA6 \u2267 ",pn(t.promotionThresholds.confidence),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",pn(t.promotionThresholds.cooccurrence),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267"," ",pn(t.promotionThresholds.minDistinctUsers)," \u306E\u5168\u5145\u8DB3\u3092\u8981\u6C42\u3002"]})]}),Z("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[ne("span",{className:"font-semibold text-slate-700",children:"2x \u5171\u8D77\u983B\u5EA6\u518D\u63D0\u6848\u30D0\u30C3\u30AF\u30AA\u30D5:"}),ne("p",{className:"mt-1 text-slate-600",children:"\u904B\u7528\u8005\u306B\u3088\u308A\u6607\u683C\u3092\u5374\u4E0B\u3055\u308C\u305F\u5019\u88DC\u306F\u3001\u524D\u56DE\u306E\u5171\u8D77\u6570\u306E 2 \u500D\u4EE5\u4E0A\u306E\u983B\u5EA6\u3067\u518D\u8A00\u53CA\u3055\u308C\u308B\u307E\u3067\u6607\u683C\u30AD\u30E5\u30FC\u3078\u306E\u518D\u6D6E\u4E0A\u3092\u81EA\u52D5\u6291\u5236\u3002"})]}),Z("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[ne("span",{className:"font-semibold text-slate-700",children:"Cypher AST ABAC \u8A8D\u53EF\u6CE8\u5165:"}),Z("p",{className:"mt-1 text-slate-600",children:["Neo4j \u30AF\u30A8\u30EA\u5B9F\u884C\u6642\u306B ",ne("code",{className:"font-mono text-indigo-800",children:"tenantId = $tenant_id"})," \u3068\u6A5F\u5BC6\u533A\u5206\u8FF0\u8A9E\u3092\u4E0D\u53EF\u5206\u306B\u5408\u6210\u3057\u3001\u30C6\u30CA\u30F3\u30C8\u5B8C\u5168\u9694\u96E2\u3092\u62C5\u4FDD\u3002"]})]})]})]})]})}import{DOCUMENT_KIND_LABELS as Ot,DOCUMENT_KINDS as Hn,flowFor as Sd,flowStepGates as is,MIME_KIND_RULES as vd,PIPELINE_STEPS as _a}from"@aiquants/enrichment-core";import{useEffect as Ed,useId as fn,useRef as Kn,useState as Ia}from"react";import{ceil8 as pd,textWidthEm as md}from"@aiquants/console-ui/core";import{orderedSteps as fd,PIPELINE_STEPS as yd}from"@aiquants/enrichment-core";var Jt={inset:12,labelFontSize:13,captionFontSize:11},At={offset:3,stroke:2},gd={node:{width:pd(Math.max(...Object.values(yd).map(e=>md(e.label)))*Jt.labelFontSize+2*Jt.inset),height:56},gap:{column:48,row:24},padding:24};function Ct(e){return Math.round(e*1e3)/1e3}function bd(e){let t=new Map;for(let n of e){let a=n.dependsOn.reduce((s,r)=>Math.max(s,t.get(r)),-1);t.set(n.step,a+1)}return t}function Ra(e,t){return`${e}->${t}`}function xd(e,t){let n=[],a=new Map;return{slots:[...e.map(r=>{let l=t.get(r.step),d=r.dependsOn.map(o=>{let b=[],$=o;for(let P=t.get(o)+1;P<l;P+=1){let i=`${Ra(o,r.step)}@${P}`;n.push({id:i,rank:P,predecessors:[$]}),b.push(i),$=i}return a.set(Ra(o,r.step),b),$});return{id:r.step,rank:l,predecessors:d}}),...n],chains:a}}function hd(e){let t=new Map,n=Math.max(...e.map(a=>a.rank));for(let a=0;a<=n;a+=1){let r=e.filter(l=>l.rank===a).map((l,d)=>{let o=a===0?d:l.predecessors.reduce((b,$)=>b+t.get($),0)/l.predecessors.length;return{slot:l,barycenter:o}});r.sort((l,d)=>l.barycenter-d.barycenter),r.forEach(({slot:l},d)=>{t.set(l.id,d)})}return t}function os(e,t=gd){let n=fd(e),a=bd(n),{slots:s,chains:r}=xd(n,a),l=hd(s),{node:d,gap:o,padding:b}=t,$=D=>({x:Ct(b+D.rank*(d.width+o.column)),y:Ct(b+l.get(D.id)*(d.height+o.row))}),P=new Map(s.map(D=>[D.id,$(D)])),i=n.map(D=>{let C=P.get(D.step);return{key:D.step,x:C.x,y:C.y,rank:a.get(D.step),order:l.get(D.step),width:d.width,height:d.height}}),L=D=>Ct(D+d.height/2),A=n.flatMap(D=>D.dependsOn.map(C=>{let G=P.get(C),h=P.get(D.step),M=Ct(G.x+d.width),O=L(G.y),re=`M ${M} ${O}`,Ee=(T,ae)=>{let J=Ct((M+T)/2);re+=` C ${J} ${O}, ${J} ${ae}, ${T} ${ae}`};for(let T of r.get(Ra(C,D.step))){let ae=P.get(T),J=L(ae.y);Ee(ae.x,J),M=Ct(ae.x+d.width),O=J,re+=` L ${M} ${O}`}return Ee(h.x,L(h.y)),{from:C,to:D.step,path:re}})),m=[...P.values()],y=Ct(Math.max(...m.map(D=>D.x+d.width))+b),v=Ct(Math.max(...m.map(D=>D.y+d.height))+b);return{width:y,height:v,steps:i,edges:A}}import{Fragment as cs,jsx as k,jsxs as q}from"react/jsx-runtime";var us="\u4F9D\u5B58\u306A\u3057 (\u6D41\u308C\u306E\u6700\u521D\u306B\u8D70\u308B)",ds={EXTRACTING:"\u62BD\u51FA",ENRICHING:"\u8981\u7D04",PROJECTING:"\u6295\u5F71"},Nd={rebuild:"\u672C\u6587\u304B\u3089\u7D44\u307F\u76F4\u3059",existing:"\u524D\u6BB5\u304C\u66F8\u3044\u305F\u884C\u3092\u305D\u306E\u307E\u307E\u4F7F\u3046"},ps={open:{badge:"\u9580: \u958B",stroke:"stroke-emerald-500",dash:void 0},"closed-skip":{badge:"\u9580: \u9589 (\u7701\u7565)",stroke:"stroke-amber-500",dash:void 0},"closed-fail":{badge:"\u9580: \u9589 (\u5931\u6557)",stroke:"stroke-red-500",dash:void 0},unmeasured:{badge:"\u9580: \u672A\u6E2C\u5B9A",stroke:"stroke-slate-400",dash:"6 4"}},ms={none:"\u9580\u306A\u3057",skip:"\u9589\u3058\u305F\u3089\u7701\u7565",fail:"\u9589\u3058\u305F\u3089\u5931\u6557",mixed:"\u9589\u3058\u305F\u9580\u3067\u7570\u306A\u308B"},Rd={open:"\u958B",closed:"\u9589",unmeasured:"\u672A\u6E2C\u5B9A"},yn="rgb(248 250 252)",Id={backgroundColor:yn,backgroundImage:`linear-gradient(to right, ${yn}, ${yn}), linear-gradient(to right, ${yn}, ${yn}), linear-gradient(to right, rgb(15 23 42 / 0.2), transparent), linear-gradient(to left, rgb(15 23 42 / 0.2), transparent)`,backgroundPosition:"left center, right center, left center, right center",backgroundRepeat:"no-repeat",backgroundSize:"24px 100%, 24px 100%, 12px 100%, 12px 100%",backgroundAttachment:"local, local, scroll, scroll"};function fs(e,t){let n=t[e.featureFlagKey];return n===void 0?"unmeasured":n?"open":"closed"}function _d(e,t){let n=e.map(a=>({gate:a,state:fs(a,t)}));return n.some(({gate:a,state:s})=>s==="closed"&&a.whenClosed==="fail")?"closed-fail":n.some(({state:a})=>a==="closed")?"closed-skip":n.some(({state:a})=>a==="unmeasured")?"unmeasured":"open"}function ls(e){return e.length===0?"none":e.every(t=>t.whenClosed==="fail")?"fail":e.every(t=>t.whenClosed==="skip")?"skip":"mixed"}function Cd(e,t){let{badge:n}=ps[e];return t==="none"||e==="closed-skip"||e==="closed-fail"?n:`${n}\u30FB${ms[t]}`}function Td(e){return e.whenClosed==="skip"?"\u9589\u3058\u305F\u3068\u304D\u306F\u6BB5\u3092\u7701\u7565":`\u9589\u3058\u305F\u3068\u304D\u306F ${e.failureStatus} \u3067\u5931\u6557`}function Ca(e){return e.map(t=>_a[t].label).join("\u3001")}function kd(e){return e.dependsOn.length===0?us:`\u4F9D\u5B58: ${Ca(e.dependsOn)}`}function sp({featureFlags:e,metrics:t,metricSampleWindow:n,selectedKind:a,onSelectKind:s,selectedStepKey:r,onSelectStep:l}){if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`metricSampleWindow must be a positive integer, got ${n}.`);let d=fn(),o=fn(),b=fn(),$=fn(),P=fn(),[i,L]=Ia(Hn[0]),[A,m]=Ia(null),[y,v]=Ia(null),D=Kn(new Map),C=Kn(new Map),G=Kn(null),h=Kn(null),{labels:M}=I(),O=a!==void 0?a:i,re=r!==void 0?r:A,Ee=Sd(O),T=os(Ee),ae=new Map(Ee.steps.map(p=>[p.step,p])),J=p=>{m(p),l?.(p)},Le=p=>{L(p),s?.(p),J(null)},Ze=(p,H)=>{let de=Hn.length-1,ue;switch(p.key){case"ArrowRight":ue=H===de?0:H+1;break;case"ArrowLeft":ue=H===0?de:H-1;break;case"Home":ue=0;break;case"End":ue=de;break;default:return}p.preventDefault();let Pe=Hn[ue];Le(Pe),D.current.get(Pe)?.focus()},He=p=>{let H=h.current;if(J(null),H?.isConnected){H.focus();return}C.current.get(p)?.focus()},$e=p=>{J(p===re?null:p)},De=(p,H)=>{p.currentTarget.focus(),$e(H)},se=(p,H)=>{p.key==="Enter"||p.key===" "?(p.preventDefault(),$e(H)):p.key==="Escape"&&J(null)},S=re===null?void 0:ae.get(re),ee=S===void 0?null:S.step;Ed(()=>{if(ee===null){h.current=null;return}let p=document.activeElement;(p instanceof HTMLElement||p instanceof SVGElement)&&p!==document.body&&G.current?.contains(p)===!1&&(h.current=p)},[ee]);let F=S===void 0?void 0:_a[S.step],oe=S===void 0?[]:is(S),ge=S===void 0?[]:Ee.steps.filter(p=>p.dependsOn.includes(S.step)).map(p=>p.step),ie=F===void 0?void 0:t.find(p=>p.documentKind===O&&p.stepKey===F.key),Me=Ot[O];return q("section",{"data-cui-migration":"pending",className:"space-y-6","aria-labelledby":d,"data-testid":"pipeline-flow-viewer","data-kind":O,children:[q("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[k("h2",{id:d,className:"font-bold text-base text-slate-900",children:"\u53D6\u308A\u8FBC\u307F\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3"}),k("p",{className:"mt-2 text-[13px] text-slate-500",children:"\u6587\u66F8\u306E\u7A2E\u985E\u3054\u3068\u306B\u3001\u5B9F\u969B\u306B\u8D70\u308B\u6BB5\u3068\u305D\u306E\u4F9D\u5B58\u3092\u63CF\u304D\u307E\u3059\u3002\u5404\u6BB5\u304C\u5F85\u3064\u6BB5\u306F\u3001\u6BB5\u306E\u8AAC\u660E\u3068\u8A73\u7D30\u306B\u3082\u6587\u5B57\u3067\u793A\u3057\u307E\u3059\u3002\u9580\u306E\u72B6\u614B\u306F\u30C6\u30CA\u30F3\u30C8\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u3092\u91CD\u306D\u305F\u3082\u306E\u3067\u3059\u3002"}),k("div",{role:"tablist","aria-label":"\u6587\u66F8\u306E\u7A2E\u985E",className:"mt-4 flex flex-wrap gap-2","data-testid":"flow-kind-tablist",children:Hn.map((p,H)=>{let de=p===O;return k("button",{ref:ue=>{ue===null?D.current.delete(p):D.current.set(p,ue)},type:"button",role:"tab","aria-selected":de,"aria-controls":o,tabIndex:de?0:-1,onClick:()=>Le(p),onKeyDown:ue=>Ze(ue,H),className:de?"rounded-lg border border-indigo-600 border-solid bg-indigo-600 px-3 py-1.5 font-semibold text-[13px] text-white":"rounded-lg border border-slate-300 border-solid bg-white px-3 py-1.5 font-medium text-[13px] text-slate-700 hover:bg-slate-50","data-testid":`flow-kind-${p}`,children:Ot[p]},p)})}),k("div",{id:o,role:"tabpanel","aria-label":`${Ot[O]} \u306E\u6D41\u308C`,"aria-describedby":b,className:"mt-4 overflow-x-auto rounded-lg border border-slate-200 border-solid p-4",style:Id,"data-testid":"flow-scroll",children:q("svg",{viewBox:`0 0 ${T.width} ${T.height}`,width:T.width,height:T.height,role:"group","aria-label":`${Ot[O]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`,style:{display:"block",maxWidth:"none"},"data-testid":"flow-svg",children:[k("title",{children:`${Ot[O]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`}),k("defs",{children:k("marker",{id:`${o}-arrow`,viewBox:"0 0 8 8",refX:"8",refY:"4",markerWidth:"8",markerHeight:"8",orient:"auto",children:k("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"fill-slate-500","data-testid":"flow-edge-arrowhead"})})}),T.edges.map(p=>k("path",{d:p.path,fill:"none",strokeWidth:1.5,markerEnd:`url(#${o}-arrow)`,className:"stroke-slate-500","data-testid":`flow-edge-${p.from}-${p.to}`},`${p.from}-${p.to}`)),T.steps.map(p=>{let H=_a[p.key],de=ae.get(p.key),ue=is(de),Pe=_d(ue,e),Ke=ls(ue),lt=ps[Pe],Ve=Cd(Pe,Ke),Fe=p.key===re,et=p.key===y,tt=`${o}-depends-${p.key}`;return q("g",{ref:Ae=>{Ae===null?C.current.delete(p.key):C.current.set(p.key,Ae)},transform:`translate(${p.x} ${p.y})`,role:"button",tabIndex:0,"aria-label":`${H.label} (${Ve})`,"aria-describedby":tt,"aria-expanded":Fe,"aria-controls":Fe?P:void 0,onClick:Ae=>De(Ae,p.key),onKeyDown:Ae=>se(Ae,p.key),onFocus:()=>v(p.key),onBlur:()=>v(null),className:"cursor-pointer focus:outline-none","data-testid":`flow-node-${p.key}`,"data-step-key":p.key,"data-gate-state":Pe,"data-gate-policy":Ke,"data-selected":Fe,"data-focused":et,children:[k("desc",{id:tt,"data-testid":`flow-node-dependencies-${p.key}`,children:kd(de)}),et&&k("rect",{x:-At.offset,y:-At.offset,width:p.width+2*At.offset,height:p.height+2*At.offset,rx:8+At.offset,fill:"none",strokeWidth:At.stroke,className:"stroke-indigo-600","data-testid":`flow-node-focus-ring-${p.key}`}),k("rect",{width:p.width,height:p.height,rx:8,strokeWidth:Fe?3:1.5,strokeDasharray:lt.dash,className:`${lt.stroke} ${Fe?"fill-indigo-50":"fill-white"}`,"data-testid":`flow-node-box-${p.key}`}),k("text",{x:Jt.inset,y:20,className:"fill-slate-900 font-semibold text-[13px]","data-testid":`flow-node-label-${p.key}`,children:H.label}),k("text",{x:Jt.inset,y:36,className:"fill-slate-600 text-[11px]","data-testid":`flow-node-phase-${p.key}`,children:ds[H.phase]}),k("text",{x:Jt.inset,y:49,className:"fill-slate-700 text-[11px]","data-testid":`flow-gate-badge-${p.key}`,"data-gate-state":Pe,children:Ve})]},p.key)})]})}),q("p",{id:b,className:"mt-2 text-[11px] text-slate-500","data-testid":"flow-scroll-hint",children:["\u56F3\u306F\u5B9F\u5BF8 (\u5E45 ",T.width," px) \u3067\u63CF\u304D\u307E\u3059\u3002\u8868\u793A\u5E45\u306B\u53CE\u307E\u3089\u306A\u3044\u3068\u304D\u306F\u6A2A\u306B\u30B9\u30AF\u30ED\u30FC\u30EB\u3057\u3066\u304F\u3060\u3055\u3044 (Tab \u3067\u6BB5\u3078\u79FB\u308B\u3068\u3001\u305D\u306E\u6BB5\u304C\u898B\u3048\u308B\u4F4D\u7F6E\u307E\u3067\u52D5\u304D\u307E\u3059)\u3002"]})]}),F!==void 0&&S!==void 0&&q("section",{id:P,ref:G,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","aria-labelledby":$,"data-testid":"flow-step-detail","data-step-key":F.key,children:[q("div",{className:"flex items-start justify-between gap-4",children:[q("div",{children:[k("h3",{id:$,className:"font-bold text-base text-slate-900",children:F.label}),k("p",{className:"mt-1 text-[13px] text-slate-600",children:F.description})]}),k("button",{type:"button",onClick:()=>He(F.key),className:"rounded-lg border border-slate-300 border-solid px-3 py-1.5 text-[13px] text-slate-700 hover:bg-slate-50","data-testid":"flow-step-detail-close",children:"\u9589\u3058\u308B"})]}),q("dl",{className:"mt-4 grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-2",children:[q("div",{children:[k("dt",{className:"font-semibold text-slate-500",children:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8"}),k("dd",{children:k("code",{className:"font-mono","data-testid":"flow-step-endpoint",children:F.endpoint})})]}),q("div",{children:[k("dt",{className:"font-semibold text-slate-500",children:"\u76F8"}),q("dd",{"data-testid":"flow-step-phase",children:[ds[F.phase]," (",F.phase,")"]})]}),q("div",{children:[k("dt",{className:"font-semibold text-slate-500",children:"\u80FD\u529B"}),k("dd",{"data-testid":"flow-step-capability",children:F.capability===null?"\u30E2\u30C7\u30EB\u3078\u9001\u3089\u306A\u3044":F.capability})]}),S.chunkSource!==void 0&&q("div",{children:[k("dt",{className:"font-semibold text-slate-500",children:"\u30C1\u30E3\u30F3\u30AF\u306E\u51FA\u6240"}),q("dd",{"data-testid":"flow-step-chunk-source","data-chunk-source":S.chunkSource,children:[Nd[S.chunkSource]," (",S.chunkSource,")"]})]}),q("div",{className:"sm:col-span-2",children:[k("dt",{className:"font-semibold text-slate-500",children:"\u4F9D\u5B58 (\u5148\u306B\u7D42\u3048\u308B\u6BB5)"}),k("dd",{"data-testid":"flow-step-depends-on",children:S.dependsOn.length===0?us:Ca(S.dependsOn)})]}),q("div",{className:"sm:col-span-2",children:[k("dt",{className:"font-semibold text-slate-500",children:"\u5F8C\u7D9A (\u3053\u306E\u6BB5\u3092\u5F85\u3064\u6BB5)"}),k("dd",{"data-testid":"flow-step-dependents",children:ge.length===0?"\u5F8C\u7D9A\u306A\u3057 (\u6D41\u308C\u306E\u6700\u5F8C\u306B\u8D70\u308B)":Ca(ge)})]}),q("div",{className:"sm:col-span-2",children:[k("dt",{className:"font-semibold text-slate-500",children:"\u9580"}),k("dd",{children:oe.length===0?k("span",{"data-testid":"flow-step-no-gates",children:"\u9580\u306A\u3057 (\u5E38\u306B\u8D70\u308B)"}):q(cs,{children:[k("ul",{className:"space-y-1",children:oe.map(p=>{let H=fs(p,e);return q("li",{"data-testid":`flow-gate-${p.featureFlagKey}`,"data-gate-state":H,"data-when-closed":p.whenClosed,children:[k("code",{className:"font-mono",children:p.featureFlagKey}),": ",Rd[H]," \u2014 ",Td(p)]},p.featureFlagKey)})}),S.gatePolicy!==void 0&&q("p",{className:"mt-1 text-slate-600","data-testid":"flow-gate-policy-override",children:[Me," \u306E\u6D41\u308C\u3067\u306F\u6BB5\u306E\u5BA3\u8A00 (",ms[ls(F.gates)],") \u3092\u4E0A\u66F8\u304D\u3057\u3001\u9580\u304C\u9589\u3058\u308B\u3068\u5B9F\u884C\u3092 ",S.gatePolicy.failureStatus," \u3067\u5931\u6557\u3055\u305B\u307E\u3059\u3002"]})]})})]})]}),q("div",{className:"mt-4 rounded-lg border border-slate-200 border-solid bg-slate-50 p-4","data-testid":"flow-step-metric","data-kind":O,children:[q("span",{className:"block font-semibold text-[13px] text-slate-700",children:["\u76F4\u8FD1\u306E\u96C6\u8A08 (",Me,"\u30FB\u76F4\u8FD1 ",n," \u4EF6)"]}),q("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":"flow-metric-scope",children:[Me," \u306E\u5B9F\u884C\u306B\u5C5E\u3059\u308B\u3001\u3053\u306E\u6BB5\u306E\u65B0\u3057\u3044\u8A18\u9332 ",n," \u4EF6\u307E\u3067\u3092\u96C6\u8A08\u3057\u3066\u3044\u307E\u3059\u3002\u4ED6\u306E\u7A2E\u985E\u306E\u5B9F\u884C\u306F\u6570\u3048\u307E\u305B\u3093\u3002"]}),ie===void 0?q("p",{className:"mt-1 text-[13px] text-slate-500","data-testid":"flow-step-metric-empty","data-unmeasured-note":!0,children:[M.unmeasured," (",Me," \u306E\u5B9F\u884C\u3067\u3053\u306E\u6BB5\u3092\u8A18\u9332\u3057\u305F\u3082\u306E\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093)"]}):q(cs,{children:[q("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-[13px] sm:grid-cols-4",children:[q("div",{children:[k("dt",{className:"text-slate-500",children:"\u6A19\u672C\u6570 (\u7701\u7565\u3092\u9664\u304F)"}),k("dd",{"data-testid":"flow-metric-sample-count",children:k(te,{value:ie.sampleCount,testId:"flow-metric-sample-count-value"})})]}),q("div",{children:[k("dt",{className:"text-slate-500",children:"\u6210\u529F"}),k("dd",{"data-testid":"flow-metric-succeeded",children:k(te,{value:ie.succeeded,testId:"flow-metric-succeeded-value"})})]}),q("div",{children:[k("dt",{className:"text-slate-500",children:"\u5931\u6557"}),k("dd",{"data-testid":"flow-metric-failed",children:k(te,{value:ie.failed,testId:"flow-metric-failed-value"})})]}),q("div",{children:[k("dt",{className:"text-slate-500",children:"\u7701\u7565"}),k("dd",{"data-testid":"flow-metric-skipped",children:k(te,{value:ie.skipped,testId:"flow-metric-skipped-value"})})]}),q("div",{children:[k("dt",{className:"text-slate-500",children:"p50"}),k("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p50",children:k(te,{value:ie.durationP50Ms,unit:"ms",testId:"flow-metric-p50-value"})})]}),q("div",{children:[k("dt",{className:"text-slate-500",children:"p95"}),k("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p95",children:k(te,{value:ie.durationP95Ms,unit:"ms",testId:"flow-metric-p95-value"})})]}),q("div",{className:"col-span-2",children:[k("dt",{className:"text-slate-500",children:"\u6700\u5F8C\u306E\u958B\u59CB"}),k("dd",{"data-testid":"flow-metric-last-started-at",children:k(pe,{iso:ie.lastStartedAt,testId:"flow-metric-last-started-at-value"})})]})]}),q("p",{className:"mt-2 text-[11px] text-slate-500","data-testid":"flow-metric-note","data-unmeasured-note":!0,children:["p50 / p95 \u306F\u6240\u8981\u3092\u6E2C\u3063\u305F\u8A18\u9332\u3060\u3051\u304B\u3089\u6C42\u3081\u307E\u3059\u3002\u7701\u7565\u3057\u305F\u6BB5\u306F\u300C\u7701\u7565\u300D\u306B\u3060\u3051\u6570\u3048\u3001\u6A19\u672C\u6570\u306B\u3082\u6240\u8981\u306B\u3082\u5165\u308A\u307E\u305B\u3093\u3002\u4F55\u3082\u547C\u3070\u305A\u306B\u6B62\u307E\u3063\u305F\u5931\u6557 (\u6240\u8981 ",M.unmeasured,") \u306F\u6A19\u672C\u6570\u3068\u300C\u5931\u6557\u300D\u306B\u306F\u5165\u308A\u307E\u3059\u304C\u3001\u6240\u8981\u306B\u306F\u5165\u308A\u307E\u305B\u3093\u3002"]})]})]})]}),q("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[k("h3",{className:"font-bold text-base text-slate-900",children:"MIME \u578B\u304B\u3089\u7A2E\u985E\u3078\u306E\u5206\u985E\u8868"}),q("p",{className:"mt-1 text-[13px] text-slate-500",children:["\u5206\u985E\u5668\u304C\u8AAD\u3080\u8868\u305D\u306E\u3082\u306E\u3067\u3059\u3002",k("code",{className:"font-mono",children:"*"})," \u3067\u7D42\u308F\u308B\u898F\u5247\u306F\u524D\u65B9\u4E00\u81F4\u3001\u305D\u308C\u4EE5\u5916\u306F\u5B8C\u5168\u4E00\u81F4\u3067\u3001\u6700\u521D\u306B\u4E00\u81F4\u3057\u305F\u898F\u5247\u304C\u52DD\u3061\u307E\u3059\u3002\u3069\u306E\u898F\u5247\u306B\u3082\u4E00\u81F4\u3057\u306A\u3044\u578B\u306F\u300C",Ot.other,"\u300D\u3067\u3059\u3002"]}),k("div",{className:"relative mt-4 overflow-x-auto","data-testid":"flow-mime-scroll",children:q("table",{className:"min-w-full divide-y divide-solid divide-slate-200 text-left text-[13px]","data-testid":"flow-mime-table",children:[k("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:q("tr",{children:[k("th",{scope:"col",className:"px-3 py-2",children:"MIME \u578B\u306E\u30D1\u30BF\u30FC\u30F3"}),k("th",{scope:"col",className:"px-3 py-2",children:"\u7A2E\u985E"})]})}),k("tbody",{className:"divide-y divide-solid divide-slate-100",children:vd.map(([p,H],de)=>q("tr",{className:H===O?"bg-indigo-50":void 0,"data-testid":`flow-mime-rule-${de}`,"data-kind":H,"data-selected":H===O,children:[k("td",{className:"px-3 py-2",children:k("code",{className:"font-mono",children:p})}),k("td",{className:"px-3 py-2",children:Ot[H]})]},p))})]})})]})]})}import{HTTP_FORBIDDEN as Pd,mapOutcome as ys}from"@aiquants/console-ui/core";import{assetTypeName as wd,classifyDocumentKind as Ld,DOCUMENT_KIND_LABELS as $d,PROCESSING_OBJECT_DELETIONS as Dd,PROCESSING_OBJECT_KINDS as Ad,PROCESSING_OBJECT_PAGE_SIZE as Od,PROCESSING_OBJECT_QUERY_MAX_CHARS as gs,PROCESSING_OBJECT_REVISIONS as Md,PROCESSING_OBJECT_STATUSES as Fd,ProcessingObjectQuerySchema as Ud,treePathLabel as bs}from"@aiquants/enrichment-core";import{useEffect as xs,useRef as hs,useState as Ss}from"react";import{Fragment as ka,jsx as ce,jsxs as qe}from"react/jsx-runtime";var Bd={all:"\u5168\u3066",documents:"\u6587\u66F8",nodes:"\u7BC0\u70B9"},Hd={current:"\u73FE\u884C\u306E\u7248",all:"\u53E4\u3044\u7248\u3082"},Kd={excluded:"\u9664\u304F",included:"\u542B\u3081\u308B"},Vd={all:"\u5168\u3066\u306E\u72B6\u614B",in_flight:"\u51E6\u7406\u4E2D",synced:"\u540C\u671F\u5B8C\u4E86",failed:"\u5931\u6557",no_record:cn},vs="\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u95B2\u89A7\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",Gd="\u540D\u524D\u306A\u3057",jd="\u8AAD\u307F\u306E\u8A18\u9332\u306A\u3057",qd=e=>JSON.stringify([e.kind,e.revision,e.deleted,e.status,e.q]),zd=e=>{if(e.total===null)throw new Error("ProcessingObjectBrowser: the first page carries the total of the rows its filters admit");return e.total};function Xd(e){if(e===null)return jd;let t=`${$t(e.stepKey)} ${on[e.status].label}`;return e.skipReason===null?t:`${t} (${Pn(e.skipReason)})`}function Yd(e){return e.kind==="document"?`\u6587\u66F8 (${$d[Ld(e.mimeType)]})`:wd(e.assetType)}function Wd(e){let t=[e.isCurrent?null:"\u65E7\u7248",e.isDeleted?"\u524A\u9664\u6E08\u307F":null].filter(n=>n!==null);return[Na[e.confidentialityLevel],Ge(e.revision),...t].join(" ")}var Ta=(e,t)=>e===null?ce(K,{fg:"fg-secondary",type:"body",testId:t,children:cn}):ce(Ue,{tone:Kr(e),variant:"tint",testId:t,children:mt[e]});function hp({host:e,filter:t,onFilterChange:n,onOpenHistory:a}){let{labels:s}=I(),r=bt(),l=hs(null),d=hs(null),[o,b]=Ss(t.q??""),[$,P]=Ss(void 0);xs(()=>{b(t.q??""),P(void 0)},[t.q]);let i=Ht(qd(t),{first:C=>e.loadPage(t,null,C).then(G=>ys(G,h=>({rows:h.rows,next:h.next,meta:zd(h)}))),next:(C,G)=>e.loadPage(t,C,G).then(h=>(!h.ok&&h.status===Pd&&i.reload(),ys(h,M=>({rows:M.rows,next:M.next}))))},0),L=Ye(()=>l.current),A=i.state.kind==="ready"?i.state.refreshFailure:null,m=vt(A),y=i.state.kind==="ready"?`\u5168 ${i.state.value.meta} \u4EF6\u306E\u3046\u3061 ${i.state.value.rows.length} \u4EF6\u3092\u8868\u793A\u3057\u3066\u3044\u307E\u3059\u3002`:null;xs(()=>{y!==null&&r(y)},[r,y]);let v=C=>{if(C.preventDefault(),o.trim()===""){P(void 0),t.q!==null&&n({...t,q:null});return}let G=Ud.safeParse(o);if(!G.success){P(`${gs} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);return}P(void 0),n({...t,q:G.data})},D=()=>{if(i.state.kind==="failed")return ce(ct,{failure:i.state,onReload:i.reload,forbiddenMessage:vs,failureMessage:h=>`\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F: ${h}`,rescueRef:L,testId:"processing-objects-failed"});if(i.state.kind!=="ready")return ce("p",{"aria-busy":"true","data-testid":"processing-objects-loading",children:"\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:C}=i.state,G=C.rows.map((h,M)=>({entry:h,position:M}));return qe(ka,{children:[A!==null&&ce(Be,{occurrence:m,testId:"processing-objects-refresh-failed",children:s.failureSentence(A,vs,h=>`\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F: ${h}`)}),ce(K,{as:"p",fg:"fg",type:"body",testId:"processing-objects-count",children:y}),ce(yt,{caption:"\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7",captionHidden:!0,columns:[{key:"id",header:"ID",width:{fixedPx:rt("0000000000")},align:"end",cell:({entry:h})=>h.kind==="readable"?String(h.item.id):null},{key:"kind",header:"\u7A2E\u985E",width:{minPx:Ne},align:"start",cell:({entry:h})=>h.kind==="readable"?Yd(h.item):null},{key:"place",header:"\u4F4D\u7F6E",width:{minPx:Ne},align:"start",cell:({entry:h})=>h.kind==="readable"&&h.item.kind==="node"?qe(ka,{children:[ce("span",{children:bs(h.item.treePath)})," ",ce("span",{children:`\u6839 ${h.item.rootMetadataId}`})]}):null},{key:"name",header:"\u540D\u524D / URI",width:{minPx:Ne},align:"start",cell:({entry:h})=>h.kind==="restricted"?ce("span",{"data-restricted-mark":"object",children:xt}):h.item.kind==="document"?qe(ka,{children:[ce("span",{children:h.item.fileName})," ",ce("span",{children:h.item.fileUri})]}):h.item.sourceName??Gd},{key:"classification",header:"\u6A5F\u5BC6\u533A\u5206\u30FB\u7248",width:{minPx:Ne},align:"start",cell:({entry:h})=>h.kind==="readable"?Wd(h.item):null},{key:"status",header:"\u72B6\u614B",width:{minPx:Ne},align:"start",cell:({entry:h,position:M})=>{if(h.kind==="restricted")return Ta(h.syncStatus,`processing-object-status-${M}`);let{item:O}=h;return O.kind==="document"?qe(Se,{gap:"space-1",testId:`processing-object-state-${O.id}`,children:[Ta(O.syncStatus,`processing-object-status-${M}`),O.errorMessage!==null&&ce(K,{fg:"danger-fg",type:"body",testId:`processing-object-error-${O.id}`,children:O.errorMessage})]}):qe(Se,{gap:"space-1",testId:`processing-object-state-${O.id}`,children:[qe(We,{gap:"space-2",testId:`processing-object-root-run-${O.id}`,children:[ce(K,{fg:"fg-secondary",type:"body",children:"\u6839\u306E\u5B9F\u884C"}),Ta(O.rootSyncStatus,`processing-object-status-${M}`)]}),ce(K,{fg:"fg",type:"body",testId:`processing-object-reading-${O.id}`,children:`\u8AAD\u307F: ${Xd(O.reading)}`})]})}},{key:"times",header:"\u767B\u9332\u30FB\u66F4\u65B0",width:{fixedPx:rt(`\u66F4\u65B0 ${Tn}`)},align:"start",cell:({entry:h,position:M})=>{let O=h.kind==="readable"?h.item:h;return qe(Se,{gap:"space-1",testId:`processing-object-times-${M}`,children:[qe("span",{children:["\u767B\u9332 ",ce(pe,{iso:O.createdAt,testId:`processing-object-created-${M}`})]}),qe("span",{children:["\u66F4\u65B0 ",ce(pe,{iso:O.updatedAt,testId:`processing-object-updated-${M}`})]})]})}},...a===void 0?[]:[{key:"history",header:"\u5C65\u6B74",width:{fixedPx:Gt("\u6839\u306E\u5C65\u6B74")},align:"start",cell:({entry:h})=>{if(h.kind==="restricted")return null;let{item:M}=h,O=M.kind==="node";return qe(xe,{variant:"secondary",onClick:()=>a(O?M.rootMetadataId:M.id),testId:`processing-object-history-${M.id}`,children:[O?"\u6839\u306E\u5C65\u6B74":"\u6587\u66F8\u306E\u5C65\u6B74"," ",ce(Sn,{testId:`processing-object-history-name-${M.id}`,children:O?`${bs(M.treePath)} \u306E\u6839 ${M.rootMetadataId}`:M.fileName})]})}}]],rows:G,rowKey:({entry:h,position:M})=>h.kind==="readable"?`object-${h.item.id}`:`restricted-${M}`,rowTestId:"processing-object-row",rowData:({entry:h})=>({"data-row-kind":h.kind==="readable"?h.item.kind:"restricted"}),rowSize:a===void 0?"row":"row-control",empty:"\u7D5E\u308A\u8FBC\u307F\u306B\u5F53\u305F\u308B\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:"processing-objects-table",ref:d}),ce(Bt,{onLoad:i.loadMore,busy:C.loadingMore||i.state.refreshing,done:C.next===null,failure:C.moreFailure,limit:Od,rows:{count:G.length,ref:d},testId:"processing-objects-more"})]})};return ce(at,{title:"\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7",description:"\u30C6\u30CA\u30F3\u30C8\u306E\u53D6\u308A\u8FBC\u3093\u3060\u6587\u66F8\u3068\u3001\u305D\u306E\u6DFB\u4ED8\u30FB\u66F8\u5EAB\u306E\u4E2D\u8EAB\u30FB\u753B\u50CF\u306A\u3069\u306E\u7BC0\u70B9\u3092\u3001\u65B0\u3057\u3044\u9806\u306B\u5168\u3066\u8FBF\u308C\u307E\u3059\u3002",headingRef:l,testId:"processing-objects",children:qe(Se,{gap:"space-4",testId:"processing-objects-body",children:[qe(We,{gap:"space-4",testId:"processing-objects-filters",children:[ce(gt,{label:"\u7A2E\u985E",options:Ad.map(C=>({value:C,label:Bd[C]})),value:t.kind,onValueChange:C=>n({...t,kind:C}),testId:"processing-objects-kind"}),ce(gt,{label:"\u7248",options:Md.map(C=>({value:C,label:Hd[C]})),value:t.revision,onValueChange:C=>n({...t,revision:C}),testId:"processing-objects-revision"}),ce(gt,{label:"\u524A\u9664\u6E08\u307F",options:Dd.map(C=>({value:C,label:Kd[C]})),value:t.deleted,onValueChange:C=>n({...t,deleted:C}),testId:"processing-objects-deleted"}),ce(Tt,{label:"\u540C\u671F\u306E\u72B6\u614B",description:"\u7BC0\u70B9\u306F\u6839\u306E\u72B6\u614B\u3067\u7D5E\u308A\u307E\u3059",value:t.status,options:Fd.map(C=>({value:C,label:Vd[C]})),onValueChange:C=>n({...t,status:C}),testId:"processing-objects-status"})]}),ce("form",{onSubmit:v,noValidate:!0,"data-testid":"processing-objects-query-form",children:qe(We,{gap:"space-2",testId:"processing-objects-query-fields",children:[ce(ut,{label:"\u540D\u524D\u30FBURI \u306E\u4E00\u90E8",type:"search",value:o,onValueChange:b,description:`1\u301C${gs} \u5B57\u3002\u540D\u524D\u3067\u7D5E\u3063\u305F\u4E00\u89A7\u306F\u9694\u96E2\u3055\u308C\u305F\u6587\u66F8\u3092\u8F09\u305B\u307E\u305B\u3093`,error:$,testId:"processing-objects-query"}),ce(xe,{variant:"primary",type:"submit",testId:"processing-objects-query-submit",children:"\u7D5E\u308A\u8FBC\u3080"})]})}),D()]})})}import{cssVar as La}from"@aiquants/console-ui/core";import{useId as Jd}from"react";import{Fragment as il,jsx as j,jsxs as _e}from"react/jsx-runtime";function Qd(e,t){return e==null?null:Rt(e,"segment_count",t)}function Es(e,t,n){return e==null?null:Mn(e,t,n)}function Zd(e){let t=e.probe_failure;if(t===null)return null;if(!rn.test(t))throw new RangeError("overview.probe_failure must name why the collections could not be read (pass null when they were measured)");if(e.collections.length>0)throw new RangeError(`overview carries ${e.collections.length} collections and a probe_failure; pass the collections with probe_failure null, or an empty list with the reason`);return t}function Ns(e,t,n){return e.reduce((a,s)=>a+Rt(s[t],`${t} of collection ${s.collection_name}`,n),0)}var el=La("space-1"),tl={padding:0,height:"1px",color:"#1e293b"},nl={display:"flex",height:"100%"},al={fontWeight:500,marginBlock:"auto",overflowWrap:"normal"},rl={display:"flex",alignItems:"baseline",gap:"12px",marginBottom:"12px"},sl={display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:"10px",rowGap:"4px",flex:"1 1 0%",minWidth:0},Pa={whiteSpace:"nowrap"},Rs=La("space-3"),ol=La("info-tint"),wa={fontSize:"11px",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap"};function Is(e,t){return`vectors_config.${e}.size of collection ${t}`}function kp({overview:e,health:t,resources:n,onRefresh:a,isRefreshing:s=!1,selection:r}){let{formatLocale:l}=I(),d=Jd(),{collections:o}=e,b=Zd(e),$=b===null,P=$?Ns(o,"points_count",l):null,i=$?Ns(o,"vectors_count",l):null,L=Es(n?.ram_bytes,"ram_bytes",l),A=Es(n?.disk_bytes,"disk_bytes",l),m=Qd(n?.segment_count,l);return _e("div",{"data-cui-migration":"pending","data-testid":"qdrant-storage-card",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[_e("div",{"data-testid":"qdrant-card-header",style:rl,children:[_e("div",{"data-testid":"qdrant-card-title-group",style:sl,children:[j("h2",{style:{margin:0,fontSize:"16px",fontWeight:700,color:"#1e293b"},children:"Qdrant \u30D9\u30AF\u30C8\u30EB\u30B9\u30C8\u30EC\u30FC\u30B8\u76E3\u8996"}),t!==void 0&&_e(il,{children:[j("span",{"data-testid":"qdrant-health-badge","data-healthy":String(t.healthy),...Wt[t.healthy?"connected":"error"],style:{...Pa,fontSize:"12px",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:Yt[t.healthy?"connected":"error"]}),_e("span",{"data-testid":"qdrant-latency",style:{...Pa,fontSize:"12px",color:"#64748b"},children:["\u5FDC\u7B54\u6642\u9593: ",j(te,{value:t.latency_ms,unit:"ms",testId:"qdrant-latency-value"})]})]})]}),a&&j("button",{type:"button","data-testid":"qdrant-refresh-button",disabled:s,onClick:a,style:{...Pa,flexShrink:0,padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:s?"not-allowed":"pointer",fontSize:"13px"},children:s?"\u66F4\u65B0\u4E2D\u2026":"\u66F4\u65B0"})]}),_e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px",padding:"10px",backgroundColor:"#f8fafc",borderRadius:"6px"},children:[_e("div",{children:[j("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570"}),j("div",{"data-testid":"qdrant-total-points",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:j(te,{value:P,testId:"qdrant-total-points-value"})})]}),_e("div",{children:[j("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570"}),j("div",{"data-testid":"qdrant-total-vectors",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:j(te,{value:i,testId:"qdrant-total-vectors-value"})})]}),_e("div",{children:[j("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)"}),j("div",{"data-testid":"qdrant-ram-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:j(je,{text:L,testId:"qdrant-ram-usage-value"})})]}),_e("div",{children:[j("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB"}),j("div",{"data-testid":"qdrant-disk-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:j(je,{text:A,testId:"qdrant-disk-usage-value"})})]}),_e("div",{children:[j("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570"}),j("div",{"data-testid":"qdrant-segment-count",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:j(te,{value:m,testId:"qdrant-segment-count-value"})})]})]}),_e("div",{children:[_e("h3",{id:d,style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7 (",j(te,{value:$?o.length:null,unit:"\u4EF6",testId:"qdrant-collections-count"}),")"]}),b!==null?j("p",{"data-testid":"qdrant-probe-failure",style:{margin:0,fontSize:"13px",color:"#92400e",backgroundColor:"#fffbeb",border:"1px solid #f59e0b",borderRadius:"6px",padding:"8px"},children:b}):o.length===0?j("p",{"data-testid":"no-collections-message",style:{margin:0,fontSize:"13px",color:"#64748b"},children:"\u767B\u9332\u3055\u308C\u3066\u3044\u308B\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):j("section",{tabIndex:0,"aria-labelledby":d,"data-testid":"qdrant-collections-scroll",style:{overflowX:"auto",WebkitOverflowScrolling:"touch",padding:el},children:_e("table",{"aria-labelledby":d,"data-testid":"qdrant-collections-list",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[j("thead",{children:_e("tr",{style:{borderBottom:"1px solid #e2e8f0",color:"#64748b"},children:[j("th",{scope:"col","data-testid":"qdrant-collections-name-header",style:{padding:`6px ${Rs}`,textAlign:"start"},children:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"}),j("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30C9\u30E1\u30A4\u30F3"}),j("th",{scope:"col","data-testid":"qdrant-collections-points-header",style:{padding:"6px 8px",textAlign:"end"},children:"\u30DD\u30A4\u30F3\u30C8\u6570"}),j("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"})]})}),j("tbody",{children:o.map(y=>{let v=r!==void 0&&y.collection_name===r.selectedCollectionName,D=j("span",{style:al,children:y.collection_name}),{dense:C,sparse:G,image:h}=y.vectors_config,M=C===void 0?null:Rt(C.size,Is("dense",y.collection_name),l),O=h===void 0?null:Rt(h.size,Is("image",y.collection_name),l);return _e("tr",{"data-testid":`collection-row-${y.collection_name}`,"data-collection-name":y.collection_name,"data-selected":String(v),style:{borderBottom:"1px solid #f1f5f9",backgroundColor:v?ol:"transparent"},children:[r===void 0?j("td",{style:{padding:`8px ${Rs}`,color:"#1e293b"},children:D}):j("td",{style:tl,children:j("div",{style:nl,children:j(Ba,{selected:v,controls:r.detailId,onSelect:()=>r.onSelectCollection(y.collection_name),testId:`collection-select-${y.collection_name}`,children:D})})}),j("td",{style:{padding:"8px",color:"#475569"},children:y.domain_key}),j("td",{"data-testid":`collection-points-${y.collection_name}`,style:{padding:"8px",color:"#0f172a",textAlign:"end"},children:j(te,{value:y.points_count,testId:`collection-points-value-${y.collection_name}`})}),j("td",{style:{padding:"8px"},children:_e("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[M!==null&&_e("span",{"data-testid":`vector-tag-dense-${y.collection_name}`,style:{...wa,backgroundColor:"#e0e7ff",color:"#3730a3"},children:["Dense: ",j(te,{value:M,unit:"\u6B21\u5143",testId:`vector-tag-dense-size-${y.collection_name}`})]}),G!==void 0&&j("span",{"data-testid":`vector-tag-sparse-${y.collection_name}`,style:{...wa,backgroundColor:"#fef3c7",color:"#92400e"},children:G.modifier?`Sparse (${G.modifier.toUpperCase()})`:"Sparse"}),O!==null&&_e("span",{"data-testid":`vector-tag-image-${y.collection_name}`,style:{...wa,backgroundColor:"#f3e8ff",color:"#6b21a8"},children:["Image: ",j(te,{value:O,unit:"\u6B21\u5143",testId:`vector-tag-image-size-${y.collection_name}`})]})]})})]},y.collection_name)})})]})})]})]})}import{jsx as z,jsxs as we}from"react/jsx-runtime";var dl="\u5BFE\u8C61\u306A\u3057";function Ap({counts:e,totalFiles:t,failedItems:n=[],onRetryAll:a,onRetryItem:s,isRetrying:r=!1,onRefresh:l,listRefusal:d,onShowAllFailures:o}){I();let b=e.SYNCED??0,$=e.PENDING??0,P=(e.EXTRACTING??0)+(e.ENRICHING??0)+(e.PROJECTING??0),i=(e.FAILED_EXTRACT??0)+(e.FAILED_ENRICH??0)+(e.FAILED_VECTOR??0)+(e.FAILED_GRAPH??0),L=t>0?`${(b/t*100).toFixed(1)}%`:dl;return we("div",{"data-cui-migration":"pending","data-testid":"sync-status-monitor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[we("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[we("div",{children:[z("h2",{style:{margin:0,fontSize:"16px",fontWeight:700,color:"#1e293b"},children:"\u30A8\u30F3\u30EA\u30C3\u30C1\u30E1\u30F3\u30C8\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),we("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570:"," ",z("span",{"data-testid":"total-files-count",style:{fontWeight:600},children:t})," ","\u4EF6 (\u540C\u671F\u5B8C\u4E86\u7387: ",z("span",{"data-testid":"success-rate-value",children:L}),")"]})]}),we("div",{style:{display:"flex",gap:"8px"},children:[l&&z("button",{type:"button","data-testid":"sync-refresh-button",onClick:l,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u66F4\u65B0"}),a&&z("button",{type:"button","data-testid":"retry-all-button",disabled:r||i===0,onClick:a,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:r||i===0?"#94a3b8":"#dc2626",color:"#ffffff",cursor:r||i===0?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:r?"\u518D\u8A66\u884C\u4E2D...":"\u5931\u6557\u30B8\u30E7\u30D6\u4E00\u62EC\u518D\u8A66\u884C"})]})]}),we("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:"10px",marginBottom:"20px"},children:[we("div",{"data-testid":"status-card-synced","data-count":b,style:{border:"1px solid #10b981",borderRadius:"6px",padding:"10px",backgroundColor:"#ecfdf5"},children:[z("div",{style:{fontSize:"12px",color:"#065f46"},children:"\u5B8C\u5168\u540C\u671F (SYNCED)"}),z("div",{"data-testid":"synced-count",style:{fontSize:"20px",fontWeight:700,color:"#047857"},children:b})]}),we("div",{"data-testid":"status-card-processing","data-count":P,style:{border:"1px solid #3b82f6",borderRadius:"6px",padding:"10px",backgroundColor:"#eff6ff"},children:[z("div",{style:{fontSize:"12px",color:"#1e40af"},children:"\u51E6\u7406\u4E2D (PROCESSING)"}),z("div",{"data-testid":"processing-count",style:{fontSize:"20px",fontWeight:700,color:"#1d4ed8"},children:P})]}),we("div",{"data-testid":"status-card-pending","data-count":$,style:{border:"1px solid #64748b",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[z("div",{style:{fontSize:"12px",color:"#334155"},children:"\u5F85\u6A5F\u4E2D (PENDING)"}),z("div",{"data-testid":"pending-count",style:{fontSize:"20px",fontWeight:700,color:"#475569"},children:$})]}),we("div",{"data-testid":"status-card-failed","data-count":i,style:{border:"1px solid #ef4444",borderRadius:"6px",padding:"10px",backgroundColor:"#fef2f2"},children:[z("div",{style:{fontSize:"12px",color:"#991b1b"},children:"\u5931\u6557 (FAILED)"}),z("div",{"data-testid":"failed-count",style:{fontSize:"20px",fontWeight:700,color:"#b91c1c"},children:i})]})]}),we("div",{"data-testid":"failed-items-section",children:[we("h3",{style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},"data-testid":"failed-items-heading",children:["\u540C\u671F\u5931\u6557\u30A2\u30A4\u30C6\u30E0\u4E00\u89A7",d!==void 0?"":` (${n.length<i?`\u4E0A\u4F4D ${n.length} \u4EF6 / \u5168 ${i} \u4EF6`:`${n.length} \u4EF6`})`]}),o!==void 0&&d===void 0&&z(hn,{onNavigate:o,testId:"failed-items-all-failures",children:"\u5168\u3066\u306E\u5931\u6557\u3092\u898B\u308B"}),d!==void 0?z(Xe,{tone:"warning",testId:"failed-items-refused",children:d}):n.length===0?z("p",{"data-testid":"no-failed-items-message",style:{margin:0,fontSize:"13px",color:"#64748b"},children:"\u73FE\u5728\u3001\u540C\u671F\u5931\u6557\u30A2\u30A4\u30C6\u30E0\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):z("div",{style:{overflowX:"auto"},children:we("table",{"data-testid":"failed-items-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[z("thead",{children:we("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[z("th",{style:{padding:"6px 8px"},children:"\u30D5\u30A1\u30A4\u30EB URI"}),z("th",{style:{padding:"6px 8px"},children:"\u72B6\u614B"}),z("th",{style:{padding:"6px 8px"},children:"\u30A8\u30E9\u30FC\u5185\u5BB9"}),z("th",{style:{padding:"6px 8px"},children:"\u5931\u6557\u65E5\u6642"}),z("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),z("tbody",{children:n.map((A,m)=>{if(A.kind==="restricted")return we("tr",{"data-testid":`failed-item-restricted-${m}`,"data-restricted-mark":"failure",children:[z("td",{"data-testid":`failed-item-restricted-text-${m}`,style:{padding:"8px"},children:xt}),z("td",{style:{padding:"8px"},children:z("span",{"data-testid":`failed-item-restricted-status-${m}`,style:{fontSize:"11px"},children:A.syncStatus})}),z("td",{style:{padding:"8px"}}),z("td",{"data-testid":`failed-item-restricted-time-${m}`,style:{padding:"8px",whiteSpace:"nowrap"},children:A.failedAt===null?"\u8A18\u9332\u306A\u3057":z(pe,{iso:A.failedAt,testId:`failed-item-restricted-time-value-${m}`})}),z("td",{style:{padding:"8px"}})]},`restricted:${m}`);let y=A.item;return we("tr",{"data-testid":`failed-item-row-${y.id}`,"data-file-uri":y.file_uri,style:{borderBottom:"1px solid #f1f5f9"},children:[we("td",{"data-testid":`failed-item-uri-${y.id}`,style:{padding:"8px",wordBreak:"break-all"},children:[z("div",{style:{fontWeight:600,color:"#0f172a"},children:y.file_name}),z("div",{style:{fontSize:"11px",color:"#64748b"},children:y.file_uri})]}),z("td",{style:{padding:"8px"},children:z("span",{"data-testid":`failed-item-status-${y.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fee2e2",color:"#991b1b",fontWeight:500},children:y.sync_status})}),z("td",{"data-testid":`failed-item-error-${y.id}`,style:{padding:"8px",color:"#dc2626",maxWidth:"260px",wordBreak:"break-word"},title:y.error_message??"",children:y.error_message??"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"}),z("td",{"data-testid":`failed-item-time-${y.id}`,style:{padding:"8px",color:"#64748b",whiteSpace:"nowrap"},children:y.failed_at===null?"\u8A18\u9332\u306A\u3057":z(pe,{iso:y.failed_at,testId:`failed-item-time-value-${y.id}`})}),z("td",{style:{padding:"8px",textAlign:"right"},children:s&&z("button",{type:"button","data-testid":`retry-item-button-${y.id}`,"aria-label":`${y.file_name} (${y.file_uri}) \u3092\u518D\u8A66\u884C`,disabled:r,onClick:()=>s(y.id,y.file_uri),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #dc2626",backgroundColor:"#ffffff",color:"#dc2626",cursor:r?"not-allowed":"pointer",fontSize:"12px"},children:"\u518D\u8A66\u884C"})})]},`readable:${y.id}`)})})]})})]})]})}export{en as BREAKER_STATE_LABELS,ja as CHUNKING_ONLY_NOTE,Ka as CHUNK_BODY_FIDELITY_LABELS,Yn as CHUNK_CHANGE_KIND_LABELS,Nd as CHUNK_SOURCE_LABELS,Na as CONFIDENTIALITY_LEVEL_LABELS,Aa as DEGRADATION_REASON_LABELS,Vt as DOCUMENT_STATE_CAUSE_LABELS,Ha as DegradedSearchBanner,Wl as DocumentChangeFeed,Jc as DocumentHistoryInspector,yu as DocumentIngestConsole,hu as EnrichmentStrategyBoard,Pt as FACET_LABELS,Xa as FAILED_RUN_STATE_MARK,Nn as FIELD_LABELS,At as FLOW_FOCUS_RING,gd as FLOW_GEOMETRY,Jt as FLOW_NODE_TEXT,jt as FinishedInstant,ms as GATE_POLICY_LABELS,ps as GATE_STATE_PRESENTATION,Ft as HIDDEN_FIELD_TEXT,ht as HISTORY_REFUSAL,Ki as INERT_STAGE_NOTE,Cu as InfrastructureHealthMonitor,Ya as MODEL_ONLY_CHANGE_MARK,Mu as MetadataSearchWorkbench,ju as ModelComparisonWorkbench,So as NOTHING_TO_READ_LABELS,cn as NO_ENRICHMENT_RECORD_TEXT,jd as NO_NODE_READING_TEXT,za as NO_PREVIOUS_RECORD_TEXT,Xu as OntologyStatusCard,ds as PHASE_LABELS,pt as PIPELINE_RUN_STATUS_PRESENTATION,on as PIPELINE_STEP_STATUS_PRESENTATION,aa as PIPELINE_TRIGGER_LABELS,vs as PROCESSING_OBJECTS_REFUSAL,Kd as PROCESSING_OBJECT_DELETION_LABELS,Bd as PROCESSING_OBJECT_KIND_LABELS,Hd as PROCESSING_OBJECT_REVISION_LABELS,Vd as PROCESSING_OBJECT_STATUS_LABELS,sp as PipelineFlowViewer,hp as ProcessingObjectBrowser,Zt as QUALITY_TIER_LABELS,kp as QdrantStorageCard,xt as RESTRICTED_DOCUMENT_TEXT,Rn as RESTRICTED_RUN_TEXT,qa as RESTRICTED_STATE_TEXT,ho as RUN_TERMINAL_STEP_LABEL,cr as RUN_TERMINAL_STEP_OUTCOME_LABELS,pe as RecordedInstant,Ut as SCORE_DECIMALS,ld as SCORE_DISPLAY_DECIMALS,Oa as SEARCH_FUSION_LABELS,ft as SEARCH_MODE_LABELS,Ji as SEARCH_PRESETS,mt as SYNC_STATUS_LABELS,Ap as SyncStatusMonitor,ur as UNFINISHED_LABEL,Gd as UNNAMED_NODE_TEXT,Wn as UNRECORDED_RUN_MARK,Ga as UNVERIFIED_CHUNK_NOTE,Va as WHITESPACE_NORMALIZED_NOTE,gn as degradationReasonText,lr as documentKindLabel,In as facetCountsText,an as fieldLabel,Cd as gateCaption,fs as gateState,Wr as gateStateOf,St as historyFailedSentence,_n as historyFailureSentence,Mi as ingestRowAction,wt as jsonValueText,os as layoutFlow,$t as ledgerStepLabel,Xd as nodeReadingText,Nt as pipelineRunPresentationKey,Wd as processingObjectClassificationText,Yd as processingObjectKindText,Fa as rankAgreement,Ge as revisionLabel,Jn as revisionTransitionText,Pn as skipReasonLabel,ls as stepGatePolicy,_d as stepGateState,Kr as syncStatusTone,Wa as unrecordedRunsMark,Gn as variantHitKey,Ma as vectorScoreText};
1
+ import{FLEXIBLE_COLUMN_MIN_PX as Nn,fixedColumnPx as fa,HTTP_FORBIDDEN as ad,mapOutcome as ga}from"@aiquants/console-ui/core";import{CHILD_RUN_PAGE_SIZE as sd,treePathLabel as id}from"@aiquants/enrichment-core";import{useRef as ld}from"react";import{reasonAside as Ei}from"@aiquants/console-ui/core";var Qt={classification:"\u5206\u985E",metadata:"\u30E1\u30BF\u30C7\u30FC\u30BF",labels:"\u30E9\u30D9\u30EB",tags:"\u30BF\u30B0",structured_data:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF",text:"\u672C\u6587",summary:"\u8981\u7D04",chunks:"\u30C1\u30E3\u30F3\u30AF",assets:"\u6DFB\u4ED8"},an={RUN:"\u5B9F\u884C\u306E\u5F8C\u306E\u8A18\u9332",PRE_WRITE:"\u4E0A\u66F8\u304D\u306E\u524D\u306E\u8A18\u9332",MANUAL:"\u624B\u52D5\u306E\u8A18\u9332",BACKFILL:"\u8A18\u9332\u306E\u8D77\u70B9"},Rr={ADDED:"\u8FFD\u52A0",REMOVED:"\u524A\u9664",MODIFIED:"\u5909\u66F4",MOVED:"\u79FB\u52D5"},No={EXACT:"\u305D\u306E\u307E\u307E\u518D\u73FE",WHITESPACE_NORMALIZED:"\u7A7A\u767D\u3092\u7E4B\u304E\u76F4\u3057\u3066\u518D\u73FE",UNVERIFIED:"\u518D\u73FE\u3067\u304D\u306A\u3044"},vo="\u30C1\u30E3\u30F3\u30AF\u306E\u672C\u6587\u306F\u3053\u306E\u533A\u9593\u306E\u6587\u3092\u7A7A\u767D\u3067\u7E4B\u304E\u76F4\u3057\u305F\u5F62\u3067\u3059\u3002",$o="\u3053\u306E\u65AD\u7247\u306F\u3053\u306E\u72B6\u614B\u306E\u62BD\u51FA\u672C\u6587\u3068\u5BFE\u5FDC\u3057\u307E\u305B\u3093\u3002",wo="\u672C\u6587\u306F\u540C\u3058\u3067\u3001\u30C1\u30E3\u30F3\u30AF\u306E\u5207\u308A\u65B9\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F\u3002",Bn={confidentialityLevel:"\u6A5F\u5BC6\u533A\u5206",departmentId:"\u90E8\u9580",folderPath:"\u30D5\u30A9\u30EB\u30C0",createdBy:"\u4F5C\u6210\u8005",fileName:"\u767B\u9332\u540D",filePath:"\u30D1\u30B9",fileId:"\u30D5\u30A1\u30A4\u30EB ID",revision:"\u7248",revisionId:"\u7248\u306E ID",fileSize:"\u5927\u304D\u3055",mimeType:"MIME",fileHash:"\u30CF\u30C3\u30B7\u30E5",mtime:"\u66F4\u65B0\u6642\u523B",present:"\u672C\u6587\u306E\u6709\u7121",lineEnding:"\u6539\u884C",finalNewline:"\u6700\u5F8C\u306E\u6539\u884C",mime:"\u672C\u6587\u306E MIME",source:"\u672C\u6587\u306E\u51FA\u6240",isTruncated:"\u5207\u308A\u8A70\u3081",pageOffsets:"\u9801\u306E\u533A\u5207\u308A",assignedBy:"\u4ED8\u3051\u305F\u8005",confidenceScore:"\u78BA\u4FE1\u5EA6",textSha256:"\u672C\u6587\u306E\u30CF\u30C3\u30B7\u30E5"};function hn(e){return Object.hasOwn(Bn,e)?Bn[e]:e}var Tt="\u9694\u96E2 (RESTRICTED) \u306E\u6587\u66F8",Do="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u72B6\u614B",Hn="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u5B9F\u884C",Ao="\u76F4\u524D\u306E\u8A18\u9332\u3068\u306E\u6BD4\u8F03\u306F\u3042\u308A\u307E\u305B\u3093\u3002",Oo="\u5931\u6557\u3057\u305F\u5B9F\u884C\u306E\u5F8C\u306E\u72B6\u614B",Tr="\u8A18\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093",Mo="\u30BD\u30FC\u30B9\u306F\u540C\u3058\u3067\u3001\u30E2\u30C7\u30EB\u306E\u51FA\u529B\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F";function Fo(e){return`\u3053\u306E\u5909\u5316\u306B\u306F\u8A18\u9332\u3055\u308C\u306A\u304B\u3063\u305F\u5B9F\u884C ${e.map(t=>`#${t}`).join("\u3001")} \u306E\u5909\u5316\u3082\u542B\u307E\u308C\u307E\u3059`}function rt(e){return`r${e}`}function En(e,t){return e===t?`${rt(t)} (\u540C\u3058\u7248)`:`${rt(e)} \u2192 ${rt(t)}`}function Kn(e){let t=Qt[e.facet];if(e.facet==="classification"||e.facet==="metadata")return`${t} \u5909\u66F4`;let r=[[e.addedCount,"+"],[e.removedCount,"\u2212"],[e.modifiedCount,"~"],[e.movedCount,"\u79FB\u52D5 "]].flatMap(([o,a])=>o===null||o===0?[]:[`${a}${o}`]);return r.length===0?`${t} \u5909\u66F4`:`${t} ${r.join(" ")}`}function zt(e){return e===null?"(\u306A\u3057)":typeof e=="string"?e:JSON.stringify(e)}var jt="\u6587\u66F8\u306E\u5C65\u6B74\u3092\u95B2\u89A7\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",_r="\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002";function jn(e,t,n){return e.failureSentence(t,jt,We(n))}function We(e){return t=>`${e}\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F${Ei(t)}\u3002`}import{useState as Si}from"react";function lt(e){let[t,n]=Si({failure:null,count:0});return e!==null&&e!==t.failure?(n({failure:e,count:t.count+1}),t.count+1):t.count}import{AlertMessage as Ri,Button as Ti,Card as _i,CardSection as xi,Cluster as Ci,CodeBlock as ki,ComparisonGrid as Pi,DataTable as Li,DescriptionList as Ni,Dialog as Ap,Disclosure as vi,Figure as $i,FigureEdge as wi,FigureNode as Di,FragmentLink as Ai,Heading as Op,InlineChange as Oi,Link as Mi,List as Fi,ListItem as Ui,LoadMore as Bi,MasterDetail as Hi,Measured as Ki,Meter as ji,MetricTile as Gi,Notice as Vi,PanelTabs as Ji,Pill as qi,ResourceFailed as Xi,RowButton as Mp,SegmentedControl as Yi,Select as Qi,SelectableList as zi,Slider as Wi,Stack as Zi,Switch as el,Text as tl,TextInput as nl,TileGrid as rl,Toolbar as Fp,VisuallyHidden as ol,useConsoleUi as al,useAnnounce as sl,useFocusRescue as il,usePagedResource as ll,usePendingPress as dl,useResource as cl}from"@aiquants/console-ui";import{createElement as oe}from"react";var sn="ja-JP";function S(){let e=al();if(e.locale!=="ja"||e.formatLocale!==sn)throw new RangeError(`The ConsoleUiRoot must be locale "${"ja"}" and formatLocale "${sn}", the language and format of this package's text (got locale "${e.locale}" and formatLocale "${e.formatLocale}")`);return e}function $(e){return S(),oe(Ki,e)}function Gn(e){return S(),oe(Hi,e)}function Vn(e){return S(),oe(Pi,e)}function J(e){return S(),oe(qi,e)}function fe(e){return S(),oe(_i,e)}function V(e){return S(),oe(Ti,e)}function Oe(e){return S(),oe(Vi,e)}function Ae(e){return S(),oe(Ri,e)}function ot(e){return S(),oe(Xi,e)}function _t(e){return S(),oe(Bi,e)}function Jn(e){return S(),oe(Mi,e)}function qn(e){return S(),oe(Ai,e)}function Bo(e){return S(),oe(el,e)}function Ho(e){return S(),oe(Ji,e)}function Nt(e){return S(),oe(ol,e)}function Re(e){return S(),oe(Li,e)}function ln(e){return S(),oe(zi,e)}function xr(e,t,n){return S(),cl(e,t,n)}function xt(e,t,n){return S(),ll(e,t,n)}function Me(e){return S(),il(e)}function Ko(){return S(),dl()}function Te(e){return S(),oe(xi,e)}function Sn(e){return S(),oe(ki,e)}function he(e){return S(),oe(Ni,e)}function dt(e){return S(),oe(vi,e)}function $e(e){return S(),oe(Fi,e)}function we(e){return S(),oe(Ui,e)}function Rn(e){return S(),oe(ji,e)}function Ct(e){return S(),oe(Yi,e)}function gt(e){return S(),oe(Qi,e)}function vt(e){return S(),oe(Wi,e)}function x(e){return S(),oe(Zi,e)}function X(e){return S(),oe(Ci,e)}function s(e){return S(),oe(tl,e)}function Ze(e){return S(),oe(nl,e)}function dn(e){return S(),oe(rl,e)}function Ue(e){return S(),oe(Gi,e)}function jo(e){return S(),oe(Oi,e)}function Go(e){return S(),oe($i,e)}function Vo(e){return S(),oe(Di,e)}function Jo(e){return S(),oe(wi,e)}function kt(){return S(),sl()}import{FLEXIBLE_COLUMN_MIN_PX as Ln,fixedColumnPx as vr,HTTP_FORBIDDEN as Ul,mapOutcome as ia}from"@aiquants/console-ui/core";import{assetTypeName as Bl,classifyDocumentKind as Hl,DOCUMENT_KIND_LABELS as Kl,PROCESSING_OBJECT_DELETIONS as jl,PROCESSING_OBJECT_KINDS as Gl,PROCESSING_OBJECT_PAGE_SIZE as Vl,PROCESSING_OBJECT_QUERY_MAX_CHARS as la,PROCESSING_OBJECT_REVISIONS as Jl,PROCESSING_OBJECT_STATUSES as ql,ProcessingObjectQuerySchema as Xl,treePathLabel as da}from"@aiquants/enrichment-core";import{useEffect as ca,useRef as ua,useState as pa}from"react";import{FILTERABLE_CONFIDENTIALITY_LEVELS as El,SEARCH_FUSIONS as Sl,SEARCH_MODES as Rl,SEARCH_PARAM_LIMITS as Fe}from"@aiquants/enrichment-core";import{useEffect as Tl,useId as _l,useRef as Pr,useState as De}from"react";import{formatCount as qo}from"@aiquants/console-ui/core";function yt(e,t,n){try{qo(e,n)}catch(r){throw new RangeError(`${t}: ${r.message}`,{cause:r})}return e}function cn(e,t,n){return qo(yt(e,t,n),n)}var un="\u975E\u8868\u793A (\u5217\u306E\u30B9\u30B3\u30FC\u30D7)",Gt={KEYWORD:{label:"\u30AD\u30FC\u30EF\u30FC\u30C9",description:"SQL Server \u306E\u8A9E\u53E5\u306E\u4E00\u81F4\u3060\u3051\u3067\u63A2\u3057\u307E\u3059\u3002\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u547C\u3070\u306A\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},SPARSE:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u306E\u8A9E\u5F59\u306E\u30D9\u30AF\u30C8\u30EB\u3067\u63A2\u3057\u307E\u3059\u3002\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u4E00\u81F4\u306B\u5F37\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},DENSE:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",description:"\u57CB\u3081\u8FBC\u307F\u306E\u610F\u5473\u306E\u30D9\u30AF\u30C8\u30EB\u3067\u63A2\u3057\u307E\u3059\u3002\u8A00\u3044\u63DB\u3048\u3084\u6587\u610F\u306E\u8FD1\u3055\u3092\u62FE\u3046\u7D4C\u8DEF\u3067\u3059\u3002"},HYBRID:{label:"\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9",description:"\u758E\u30FB\u5BC6\u30FB\u30B0\u30E9\u30D5\u30FB\u8A9E\u53E5\u306E\u4E00\u81F4\u306E\u9806\u4F4D\u3092\u878D\u5408\u3057\u307E\u3059\u3002\u65E2\u5B9A\u306E\u7D4C\u8DEF\u3067\u3059\u3002"},GRAPH_TRAVERSE:{label:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u3092\u305F\u3069\u3063\u3066\u63A2\u3057\u307E\u3059\u3002\u6587\u66F8\u306E\u9593\u306E\u3064\u306A\u304C\u308A\u3092\u4E3B\u306B\u3059\u308B\u7D4C\u8DEF\u3067\u3059\u3002"}},Yo={rrf:"RRF (\u9806\u4F4D\u306E\u9006\u6570\u306E\u548C)",linear:"\u7DDA\u5F62 (\u03B1 \u3067\u91CD\u307F\u4ED8\u3051)"},Tn={FULL:"\u5B8C\u5168",DEGRADED_LEXICAL_ONLY:"\u7E2E\u9000 (\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u8D70\u3089\u305A)",DEGRADED_PARTIAL:"\u7E2E\u9000 (\u4E00\u90E8\u306E\u5C64\u3060\u3051)"},_n={CLOSED:"\u9589 (\u901A\u5E38)",OPEN:"\u958B (\u906E\u65AD\u4E2D)",HALF_OPEN:"\u534A\u958B (\u8A66\u3057\u306E 1 \u56DE)"},Xo={vector_search_disabled:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u306B\u3055\u308C\u3066\u3044\u307E\u3059\u3002",graph_search_disabled:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u306B\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:vector":"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5931\u6557\u304C\u7D9A\u3044\u305F\u305F\u3081\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:graph":"\u30B0\u30E9\u30D5\u691C\u7D22\u306F\u5931\u6557\u304C\u7D9A\u3044\u305F\u305F\u3081\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002",vector_tier_not_configured:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",graph_tier_not_configured:"\u30B0\u30E9\u30D5\u691C\u7D22\u306F\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",no_active_vector_collection:"\u6709\u52B9\u306A\u7D22\u5F15\u306E\u6226\u7565\u304C 1 \u3064\u3082\u7121\u3044\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_collections_missing:"\u30D9\u30AF\u30C8\u30EB\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u304C\u307E\u3060\u7121\u3044\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u6587\u66F8\u306E\u6295\u5F71\u304C\u7D42\u308F\u308B\u3068\u89E3\u6D88\u3057\u307E\u3059\u3002",row_scope_permits_no_rows:"\u8AAD\u3081\u308B\u6587\u66F8\u304C 1 \u3064\u3082\u7121\u3044\u6A29\u9650\u306E\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u306E\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_tier_unavailable:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306E\u57FA\u76E4\u306B\u5C4A\u304B\u306A\u3044\u304B\u3001\u57FA\u76E4\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002",graph_tier_unavailable:"\u30B0\u30E9\u30D5\u691C\u7D22\u306E\u57FA\u76E4\u306B\u5C4A\u304B\u306A\u3044\u304B\u3001\u57FA\u76E4\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002",vector_tier_timed_out:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u671F\u9650\u307E\u3067\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002",graph_tier_timed_out:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u671F\u9650\u307E\u3067\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002",tiers_not_executed:"\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u306E\u691C\u7D22\u304C\u5B9F\u884C\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F (\u7406\u7531\u306F\u5831\u544A\u3055\u308C\u3066\u3044\u307E\u305B\u3093)\u3002"};function Xn(e){return Object.hasOwn(Xo,e)?Xo[e]:e}var pn=3;function Qo(e){return e.kind==="cosine"?`${(e.value*100).toFixed(1)}% (\u30B3\u30B5\u30A4\u30F3)`:`${e.value.toFixed(pn)} (${e.kind==="bm25"?"BM25":"\u5BC6\u3068\u758E\u306E\u6DF7\u3056\u3063\u305F\u5024"})`}function zo(e,t){let n=u=>{let i=new Map;return u.forEach((p,T)=>{i.has(p)||i.set(p,T+1)}),i},r=n(e),o=n(t),a=[...r.keys()].filter(u=>o.has(u)),l=new Set([...r.keys(),...o.keys()]).size;return{sharedCount:a.length,overlapRatio:l===0?null:a.length/l,meanAbsoluteRankDifference:a.length===0?null:a.reduce((u,i)=>u+Math.abs(r.get(i)-o.get(i)),0)/a.length}}function Cr(e){return`${e.metadata_id}:${e.chunk_index}`}import{jsx as xn,jsxs as ul}from"react/jsx-runtime";function Wo({metadata:e,testId:t}){if(S(),!e.is_degraded)return null;let n=e.executed_tiers,r=Gt[e.requested_mode].label,o=Tn[e.quality_tier],l=!(n.lexical||n.dense||n.sparse||n.graph)?`\u7E2E\u9000\u3057\u3066\u7B54\u3048\u3066\u3044\u307E\u3059: ${r} \u3092\u6C42\u3081\u307E\u3057\u305F\u304C\u3001\u8D70\u3063\u305F\u5C64\u306F\u3042\u308A\u307E\u305B\u3093 (\u54C1\u8CEA: ${o})\u3002`:`\u7E2E\u9000\u3057\u3066\u7B54\u3048\u3066\u3044\u307E\u3059: ${r} \u3092\u6C42\u3081\u3001${Gt[e.search_mode].label} \u3067\u7B54\u3048\u307E\u3057\u305F (\u54C1\u8CEA: ${o})\u3002`;return xn(Oe,{tone:"warning",testId:t,children:ul(x,{gap:"space-2",testId:`${t}-body`,children:[xn(s,{as:"p",fg:"fg",type:"prose",testId:`${t}-summary`,children:l}),e.degradation_reasons.length>0&&xn($e,{marker:"bullet",type:"prose",gap:"space-1",testId:`${t}-reasons`,children:e.degradation_reasons.map((u,i)=>xn(we,{testId:`${t}-reason`,dataAttributes:{"data-reason":u},children:xn(s,{fg:"fg",type:"prose",testId:`${t}-reason-${i}`,children:Xn(u)})},`${i}-${u}`))})]})})}import{DOCUMENT_KIND_LABELS as pl,isUnknownTerm as Zo,parseSkipReason as ml,RUN_TERMINAL_STEP_KEY as fl,recordedStepOf as ea}from"@aiquants/enrichment-core";var $t={RUNNING:{label:"\u5B9F\u884C\u4E2D"},RUNNING_RETRY_SCHEDULED:{label:"\u518D\u8A66\u884C\u5F85\u3061"},SUCCEEDED:{label:"\u6210\u529F"},FAILED:{label:"\u5931\u6557"},FAILED_RETRY_SCHEDULED:{label:"\u5931\u6557 (\u518D\u8A66\u884C\u4E88\u5B9A)"},CANCELLED:{label:"\u53D6\u308A\u6D88\u3057"}},wt={RUNNING:"info",RUNNING_RETRY_SCHEDULED:"warning",SUCCEEDED:"success",FAILED:"danger",FAILED_RETRY_SCHEDULED:"warning",CANCELLED:"neutral"},Cn={RUNNING:{label:"\u5B9F\u884C\u4E2D"},SUCCEEDED:{label:"\u6210\u529F"},SKIPPED:{label:"\u7701\u7565"},FAILED:{label:"\u5931\u6557"},CANCELLED:{label:"\u53D6\u308A\u6D88\u3057"}},ta={RUNNING:"info",SUCCEEDED:"success",SKIPPED:"neutral",FAILED:"danger",CANCELLED:"neutral"},kr={ingest:"\u53D6\u308A\u8FBC\u307F",retry:"\u518D\u8A66\u884C",resync:"\u518D\u540C\u671F"},gl="\u7248\u306A\u3057";function mn(e){return e.flowVersion===null?`${e.flowKey} (${gl})`:`${e.flowKey} \u7248 ${e.flowVersion}`}var yl="\u6587\u66F8\u306E\u72B6\u614B\u306E\u8A18\u9332";function Dt(e){return Zo(e)?`\u77E5\u3089\u306A\u3044\u6BB5 (${e.raw})`:e===fl?yl:ea(e).label}function na(e){return Zo(e)?`\u77E5\u3089\u306A\u3044\u7A2E\u985E (${e.raw})`:pl[e]}var ra={RECORDED:"\u72B6\u614B\u3092\u8A18\u9332\u3057\u307E\u3057\u305F",UNCHANGED:"\u524D\u306E\u8A18\u9332\u304B\u3089\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093",ALREADY_RECORDED:"\u3053\u306E\u5B9F\u884C\u306E\u72B6\u614B\u306F\u8A18\u9332\u6E08\u307F\u3067\u3059"},Yn="\u672A\u5B8C\u4E86";function At(e){if(!e.retryScheduled)return e.status;switch(e.status){case"RUNNING":return"RUNNING_RETRY_SCHEDULED";case"FAILED":return"FAILED_RETRY_SCHEDULED";default:return e.status}}var bl={no_pages:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u30DA\u30FC\u30B8\u306A\u3057)",no_pages_rendered:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u63CF\u753B\u3067\u304D\u305F\u30DA\u30FC\u30B8\u306A\u3057)",covered_by_page_recognition:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u89AA\u306E\u7248\u9762\u306E\u8A8D\u8B58\u304C\u8AAD\u3093\u3060\u30DA\u30FC\u30B8\u306E\u753B\u50CF)"};function Qn(e){let t=ml(e);if(t===null)return e;switch(t.kind){case"gate_closed":return`${t.featureFlagKey} \u304C\u7121\u52B9`;case"no_children":return"\u5B50\u30A2\u30BB\u30C3\u30C8\u306A\u3057";case"source_skipped":return`${ea(t.stepKey).label} \u304C\u5B9F\u884C\u3055\u308C\u306A\u304B\u3063\u305F`;case"nothing_to_read":return bl[t.token];case"superseded":return"\u5B9F\u884C\u306E\u7248\u304C\u73FE\u5728\u306E\u7248\u3067\u306A\u304F\u306A\u3063\u305F";case"recording_disabled":return"\u8A18\u9332\u306E\u5207\u66FF\u304C\u7121\u52B9";case"recording_misconfigured":return"\u8A18\u9332\u306E\u5207\u66FF\u306E\u8A2D\u5B9A\u306E\u8AA4\u308A";case"not_protected":return"\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4ED8\u3044\u3066\u3044\u306A\u3044"}}import{formatInstant as Il,instantSampleText as hl}from"@aiquants/console-ui/core";function oa(e,t){return Il(e,sn,t)}function zn(e){return hl(sn,e)}function qe(e){return{kind:"measured",texts:[zn(e)]}}import{jsx as aa}from"react/jsx-runtime";function le({iso:e,testId:t}){let{timeZone:n}=S();return aa($,{text:e===null?null:oa(e,n),keep:"whole",testId:t})}function Vt({iso:e,testId:t}){return S(),e===null?Yn:aa(le,{iso:e,testId:t})}import{Fragment as Al,jsx as L,jsxs as Pt}from"react/jsx-runtime";var xl=[{id:"balanced-hybrid",title:"\u63A8\u5968\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9",description:"RRF (k=60) \u3067\u8A9E\u5F59\u3068\u610F\u5473\u306E\u9806\u4F4D\u3092\u5408\u308F\u305B\u308B",params:{mode:"HYBRID",limit:20,fusion:"rrf",rrf_k:60}},{id:"high-precision-vector",title:"\u9AD8\u7CBE\u5EA6\u30D9\u30AF\u30C8\u30EB",description:"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6 0.75 \u4EE5\u4E0A\u306E\u5BC6\u30D9\u30AF\u30C8\u30EB\u3060\u3051",params:{mode:"DENSE",limit:10,threshold:.75}},{id:"strict-lexical",title:"\u53B3\u683C\u30AD\u30FC\u30EF\u30FC\u30C9",description:"SQL \u306E\u8A9E\u53E5\u306E\u4E00\u81F4\u3060\u3051",params:{mode:"KEYWORD",limit:20}},{id:"lexical-sparse",title:"\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u3067\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u4E00\u81F4\u3092\u72D9\u3046",params:{mode:"SPARSE",limit:20}},{id:"graph-reasoning",title:"\u30B0\u30E9\u30D5\u6DF1\u6398\u308A",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u306E\u9806\u4F4D\u3092\u4E3B\u306B\u3059\u308B",params:{mode:"GRAPH_TRAVERSE",limit:30}}],Nr={PUBLIC:"\u516C\u958B (PUBLIC)",INTERNAL:"\u793E\u5185 (INTERNAL)",DEPARTMENT:"\u90E8\u7F72 (DEPARTMENT)",CONFIDENTIAL:"\u6A5F\u5BC6 (CONFIDENTIAL)"},Lr="ALL",kn={request:"\u8981\u6C42",response:"\u5FDC\u7B54",flow:"\u8D70\u308A",graph:"\u30B0\u30E9\u30D5\u306E\u8DE1"},Cl="\u307E\u3060\u691C\u7D22\u3057\u3066\u3044\u307E\u305B\u3093\u3002",kl=(Fe.threshold.min+Fe.threshold.max)/2,Pl=336,Ll=544;function Nl(e){let t=e.trim().length;return t<Fe.queryLength.min?"\u691C\u7D22\u8A9E\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002":t>Fe.queryLength.max?`\u691C\u7D22\u8A9E\u306F ${Fe.queryLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function vl(e){let t=e.trim();if(t!=="")return/^[1-9]\d*$/.test(t)&&Number.isSafeInteger(Number(t))?void 0:"\u90E8\u7F72\u306E ID \u306F 1 \u4EE5\u4E0A\u306E\u6574\u6570\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}function sa(e,t){return t.trim().length>Fe.filterTextLength.max?`${e}\u306F ${Fe.filterTextLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function $l(e){return e.fusion==="rrf"?`RRF (k=${e.rrf_k})`:e.fusion==="linear"?`\u7DDA\u5F62 (\u03B1=${e.alpha}, k=${e.rrf_k})`:"\u878D\u5408\u306A\u3057 (1 \u3064\u306E\u9806\u4F4D\u3060\u3051\u306E\u6226\u7565)"}function wl({params:e,answer:t}){let n=t.search_metadata,r=n.executed_tiers,o=a=>a?"\u2713":"\u2013";return[`\u8981\u6C42\u306E\u6226\u7565: ${n.requested_mode} (${Gt[n.requested_mode].label})`,`\u8D70\u3063\u305F\u6226\u7565: ${n.search_mode} (${Gt[n.search_mode].label})`,`\u8D70\u3063\u305F\u5C64: \u8A9E\u53E5 ${o(r.lexical)} / \u758E ${o(r.sparse)} / \u5BC6 ${o(r.dense)} / \u30B0\u30E9\u30D5 ${o(r.graph)}`,`\u878D\u5408: ${$l(e)}`,`\u54C1\u8CEA: ${Tn[n.quality_tier]}`,`\u7E2E\u9000\u306E\u7406\u7531: ${n.degradation_reasons.length===0?"\u7121\u3057":n.degradation_reasons.join(", ")}`,`\u906E\u65AD\u5668: \u30D9\u30AF\u30C8\u30EB ${_n[n.circuit_breaker_status.vector]} / \u30B0\u30E9\u30D5 ${_n[n.circuit_breaker_status.graph]}`,`\u6240\u8981: ${n.execution_time_ms} ms`,`\u4EF6\u6570: ${t.hits.length}`].join(`
2
+ `)}function Dl({answer:e}){if(!e.search_metadata.executed_tiers.graph)return"\u30B0\u30E9\u30D5\u306E\u5C64\u306F\u8D70\u3063\u3066\u3044\u307E\u305B\u3093\u3002";if(e.authz_scopes.row_scope_applied)return"\u884C\u306E\u30B9\u30B3\u30FC\u30D7\u304C\u639B\u304B\u308B\u305F\u3081\u3001\u95A2\u4FC2\u306F\u793A\u3057\u307E\u305B\u3093 (\u95A2\u4FC2\u306E\u5148\u306F\u884C\u306E\u8A8D\u53EF\u3092\u901A\u3063\u3066\u3044\u307E\u305B\u3093)\u3002";let t=e.hits.flatMap((n,r)=>(n.graph_relations??[]).map(o=>`#${r+1} ${n.file_name??un}: ${o.relation} \u2192 ${o.target_name}`));return t.length===0?"\u3069\u306E\u6587\u66F8\u306B\u3082\u95A2\u4FC2\u306F\u3042\u308A\u307E\u305B\u3093\u3002":t.join(`
3
+ `)}function bt(e,t){return e?un:t===null||t===""?"\u7121\u3057":String(t)}function pm({tenantId:e,onSearch:t,initialParams:n}){let{formatLocale:r}=S(),o=kt(),a=_l(),[l,u]=De(n?.q??""),[i,p]=De(n?.mode??"HYBRID"),[T,E]=De(n?.limit??Fe.limit.default),[m,c]=De(n?.threshold??kl),[_,f]=De(n?.fusion??"rrf"),[C,I]=De(n?.rrf_k??Fe.rrfK.default),[U,w]=De(n?.alpha??Fe.alpha.default),[ne,N]=De(n?.confidentiality_level??Lr),[B,R]=De(n?.department_id===void 0?"":String(n.department_id)),[M,K]=De(n?.mime_type??""),[ae,Ee]=De(n?.tag??""),[v,q]=De(!1),[H,O]=De(!1),[Y,et]=De(!1),[Ce,F]=De("request"),[Se,ue]=De(!1),[re,Z]=De(!1),[be,ze]=De(null),[G,ee]=De(null),[Ie,g]=De(null),[se,D]=De(null),ie=Pr(0),Ke=Pr(0),tt=Pr(null);Tl(()=>()=>tt.current?.abort(),[]);let mt={query:Nl(l),department:vl(B),mimeType:sa("MIME \u30BF\u30A4\u30D7",M),tag:sa("\u30BF\u30B0",ae)},Pe=Se?mt:{},it=()=>{let y=B.trim(),je=M.trim(),ve=ae.trim();return{q:l.trim(),mode:i,limit:T,...i==="DENSE"?{threshold:m}:{},...i==="HYBRID"?{fusion:_,rrf_k:C,..._==="linear"?{alpha:U}:{}}:{},...ne===Lr?{}:{confidentiality_level:ne},...y===""?{}:{department_id:Number(y)},...je===""?{}:{mime_type:je},...ve===""?{}:{tag:ve}}},Ht=async y=>{let je=new AbortController;tt.current=je,Z(!0);try{let ve=await t(y,je.signal);if(je.signal.aborted)return;ze({params:y,answer:ve}),ee(ve.hits.length===0?null:"1"),g(null),o(ve.hits.length===0?"\u6761\u4EF6\u306B\u5408\u3046\u6587\u66F8\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002":`${ve.hits.length} \u4EF6\u306E\u6587\u66F8\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u3002`)}catch(ve){if(je.signal.aborted)return;ie.current+=1,g({message:ve instanceof Error?ve.message:"\u691C\u7D22\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",occurrence:ie.current})}finally{tt.current=null,Z(!1)}},b=y=>{y.preventDefault(),ue(!0),!(re||Object.values(mt).some(je=>je!==void 0))&&Ht(it())},A=y=>{p(y.params.mode),E(y.params.limit),y.params.threshold!==void 0&&c(y.params.threshold),y.params.fusion!==void 0&&f(y.params.fusion),y.params.rrf_k!==void 0&&I(y.params.rrf_k),o(`\u30D7\u30EA\u30BB\u30C3\u30C8\u300C${y.title}\u300D\u3092\u5F53\u3066\u307E\u3057\u305F\u3002`)},j=y=>{if(be===null)return Cl;switch(y){case"request":return JSON.stringify(be.params,null,2);case"response":return JSON.stringify(be.answer,null,2);case"flow":return wl(be);case"graph":return Dl(be)}},pe=async()=>{try{await navigator.clipboard.writeText(j(Ce)),D(null),o(`${kn[Ce]}\u3092\u5199\u3057\u307E\u3057\u305F\u3002`)}catch(y){Ke.current+=1,D({message:`\u5199\u305B\u307E\u305B\u3093\u3067\u3057\u305F: ${y instanceof Error?y.message:String(y)}`,occurrence:Ke.current})}},te=be?.answer??null,me=y=>te?.authz_scopes.hidden_columns.includes(y)===!0,Rt=te===null?[]:te.hits.map((y,je)=>({hit:y,rank:je+1})),Yt=Rt.find(y=>String(y.rank)===G)??null,Sr=(y,je)=>{let ve=y.scores;return L(Te,{id:a,title:`#${je} ${bt(me("file_name"),y.file_name)}`,region:!0,testId:"search-hit-detail",children:Pt(x,{gap:"space-4",testId:"search-hit-detail-body",children:[L(he,{items:[{key:"fused",term:"\u878D\u5408\u306E\u5024",description:L(Rn,{label:"\u878D\u5408\u306E\u5024",value:ve.fused,min:0,max:1,valueText:ve.fused.toFixed(pn),testId:"search-hit-detail-fused"})},{key:"vector",term:"\u30D9\u30AF\u30C8\u30EB\u306E\u5024",description:L(s,{fg:"fg",type:"body",children:ve.vector===null?"\u30D9\u30AF\u30C8\u30EB\u306E\u5217\u306B\u7121\u3044":Qo(ve.vector)})},{key:"lexical",term:"\u8A9E\u53E5\u306E\u9806\u4F4D\u306E\u5024",description:L(s,{fg:"fg",type:"body",children:ve.lexical_rank===null?"\u8A9E\u53E5\u306E\u5217\u306B\u7121\u3044":ve.lexical_rank.toFixed(pn)})},{key:"graph",term:"\u30B0\u30E9\u30D5\u306E\u9806\u4F4D\u306E\u5024",description:L(s,{fg:"fg",type:"body",children:ve.graph_rank===null?"\u30B0\u30E9\u30D5\u306E\u5217\u306B\u7121\u3044":ve.graph_rank.toFixed(pn)})}],testId:"search-hit-scores"}),L(he,{items:[{key:"file_uri",term:"URI",description:L(s,{fg:"fg",type:"body",face:"mono",children:bt(me("file_uri"),y.file_uri)})},{key:"mime_type",term:"MIME \u30BF\u30A4\u30D7",description:L(s,{fg:"fg",type:"body",children:bt(me("mime_type"),y.mime_type)})},{key:"folder_path",term:"\u30D5\u30A9\u30EB\u30C0",description:L(s,{fg:"fg",type:"body",children:bt(me("folder_path"),y.folder_path)})},{key:"confidentiality_level",term:"\u6A5F\u5BC6\u533A\u5206",description:L(s,{fg:"fg",type:"body",children:bt(me("confidentiality_level"),y.confidentiality_level)})},{key:"department_id",term:"\u90E8\u7F72",description:L(s,{fg:"fg",type:"body",children:bt(me("department_id"),y.department_id)})},{key:"created_by",term:"\u767B\u9332\u8005",description:L(s,{fg:"fg",type:"body",children:bt(me("created_by"),y.created_by)})},{key:"mtime",term:"\u66F4\u65B0",description:me("mtime")?L(s,{fg:"fg",type:"body",children:un}):L(le,{iso:y.mtime,testId:"search-hit-mtime-value"})},{key:"tags",term:"\u30BF\u30B0",description:me("tags")||y.tags===null||y.tags.length===0?L(s,{fg:"fg",type:"body",children:bt(me("tags"),null)}):L(X,{gap:"space-2",testId:"search-hit-tags",children:y.tags.map(ft=>L(J,{tone:"neutral",variant:"tint",testId:`search-hit-tag-${ft}`,children:ft},ft))})},{key:"ai_summary",term:"AI \u306E\u8981\u7D04",description:L(s,{fg:"fg",type:"prose",children:bt(me("ai_summary"),y.ai_summary)})}],testId:"search-hit-fields"}),Pt(x,{gap:"space-2",testId:"search-hit-relations",children:[L(s,{as:"p",fg:"fg-secondary",type:"body",children:"\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2"}),y.graph_relations===null?L(s,{as:"p",fg:"fg",type:"prose",children:"\u884C\u306E\u30B9\u30B3\u30FC\u30D7\u304C\u639B\u304B\u308B\u305F\u3081\u793A\u3057\u307E\u305B\u3093 (\u95A2\u4FC2\u306E\u5148\u306F\u884C\u306E\u8A8D\u53EF\u3092\u901A\u3063\u3066\u3044\u307E\u305B\u3093)\u3002"}):y.graph_relations.length===0?L(s,{as:"p",fg:"fg",type:"prose",children:"\u7121\u3057"}):L($e,{marker:"bullet",type:"body",gap:"space-1",testId:"search-hit-relation-list",children:y.graph_relations.map(ft=>L(we,{testId:"search-hit-relation",dataAttributes:{"data-relation":ft.relation},children:L(s,{fg:"fg",type:"body",children:`${ft.relation} \u2192 ${ft.target_name}`})},`${ft.relation}-${ft.target_name}`))})]}),me("structured_data")||y.structured_data===null?L(s,{as:"p",fg:"fg",type:"prose",testId:"search-hit-structured-absent",children:`\u69CB\u9020\u5316\u30C7\u30FC\u30BF: ${bt(me("structured_data"),null)}`}):L(Sn,{label:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF",code:JSON.stringify(y.structured_data,null,2),testId:"search-hit-structured"})]})})};return Pt(x,{gap:"space-6",testId:"metadata-search-workbench",children:[L(fe,{title:"\u6587\u66F8\u306E\u691C\u7D22",description:`\u30C6\u30CA\u30F3\u30C8 ${e} \u306E\u6587\u66F8\u3092\u3001\u8A9E\u53E5\u30FB\u30D9\u30AF\u30C8\u30EB\u30FB\u30B0\u30E9\u30D5\u306E\u5C64\u3067\u63A2\u3057\u307E\u3059\u3002`,testId:"search-query-card",dataAttributes:{"data-mode":i,"data-running":re},children:L("form",{onSubmit:b,noValidate:!0,"data-testid":"search-form",children:Pt(x,{gap:"space-4",testId:"search-form-fields",children:[L(Ze,{label:"\u691C\u7D22\u8A9E",type:"search",value:l,onValueChange:u,required:!0,description:`1\u301C${Fe.queryLength.max} \u5B57`,error:Pe.query,testId:"search-query"}),L(Ct,{label:"\u691C\u7D22\u306E\u6226\u7565",options:Rl.map(y=>({value:y,label:Gt[y].label})),value:i,onValueChange:y=>p(y),testId:"search-mode"}),L(s,{as:"p",fg:"fg-secondary",type:"prose",testId:"search-mode-description",children:Gt[i].description}),L(vt,{label:"\u4EF6\u6570",value:T,min:Fe.limit.min,max:Fe.limit.max,step:1,valueText:y=>`${y} \u4EF6`,onValueChange:E,testId:"search-limit"}),i==="DENSE"&&L(vt,{label:"\u985E\u4F3C\u5EA6\u306E\u4E0B\u9650",value:m,min:Fe.threshold.min,max:Fe.threshold.max,step:.01,valueText:y=>y.toFixed(2),onValueChange:c,testId:"search-threshold"}),i==="HYBRID"&&Pt(x,{gap:"space-4",testId:"search-fusion-controls",children:[L(Ct,{label:"\u878D\u5408",options:Sl.map(y=>({value:y,label:Yo[y]})),value:_,onValueChange:y=>f(y),testId:"search-fusion"}),L(vt,{label:"\u9806\u4F4D\u306E\u5024\u306E k",value:C,min:Fe.rrfK.min,max:Fe.rrfK.max,step:1,valueText:String,onValueChange:I,testId:"search-rrf-k"}),_==="linear"&&L(vt,{label:"\u30D9\u30AF\u30C8\u30EB\u306E\u91CD\u307F (\u03B1)",value:U,min:Fe.alpha.min,max:Fe.alpha.max,step:.05,valueText:y=>y.toFixed(2),onValueChange:w,testId:"search-alpha"})]}),L(dt,{summary:"\u8A73\u3057\u3044\u6761\u4EF6",open:v,onOpenChange:q,testId:"search-filters",children:Pt(x,{gap:"space-4",testId:"search-filter-fields",children:[L(gt,{label:"\u6A5F\u5BC6\u533A\u5206",value:ne,options:[{value:Lr,label:"\u5168\u3066\u306E\u533A\u5206"},...El.map(y=>({value:y,label:Nr[y]}))],onValueChange:N,testId:"search-confidentiality"}),L(Ze,{label:"\u90E8\u7F72\u306E ID",type:"text",value:B,onValueChange:R,description:"1 \u4EE5\u4E0A\u306E\u6574\u6570",error:Pe.department,testId:"search-department"}),L(Ze,{label:"MIME \u30BF\u30A4\u30D7 (\u542B\u3080\u4E00\u81F4)",type:"text",value:M,onValueChange:K,error:Pe.mimeType,testId:"search-mime-type"}),L(Ze,{label:"\u30BF\u30B0 (\u5B8C\u5168\u4E00\u81F4)",type:"text",value:ae,onValueChange:Ee,error:Pe.tag,testId:"search-tag"})]})}),L(dt,{summary:"\u958B\u767A\u8005\u306E\u30D7\u30EA\u30BB\u30C3\u30C8",open:H,onOpenChange:O,testId:"search-presets",children:L(x,{gap:"space-2",testId:"search-preset-list",children:xl.map(y=>Pt(X,{gap:"space-2",testId:`search-preset-${y.id}`,children:[L(V,{variant:"secondary",onClick:()=>A(y),testId:`search-preset-${y.id}-apply`,children:y.title}),L(s,{fg:"fg-secondary",type:"body",children:y.description})]},y.id))})}),L(X,{gap:"space-2",testId:"search-actions",children:L(V,{variant:"primary",type:"submit",busy:re,busyLabel:"\u691C\u7D22\u3057\u3066\u3044\u307E\u3059",testId:"search-submit",children:"\u691C\u7D22\u3059\u308B"})})]})})}),Ie!==null&&L(Ae,{occurrence:Ie.occurrence,testId:"search-failure",children:Ie.message}),te!==null&&L(Wo,{metadata:te.search_metadata,testId:"search-degraded"}),te!==null&&L(fe,{title:"\u691C\u7D22\u306E\u7D50\u679C",description:`${te.hits.length} \u4EF6 \xB7 ${cn(te.search_metadata.execution_time_ms,"execution_time_ms",r)} ms \xB7 \u54C1\u8CEA: ${Tn[te.search_metadata.quality_tier]}`,testId:"search-results",children:Pt(x,{gap:"space-4",testId:"search-results-body",children:[L(he,{items:[{key:"tiers",term:"\u8D70\u3063\u305F\u5C64",description:L(X,{gap:"space-2",testId:"search-tiers",children:[["lexical","\u8A9E\u53E5"],["sparse","\u758E\u30D9\u30AF\u30C8\u30EB"],["dense","\u5BC6\u30D9\u30AF\u30C8\u30EB"],["graph","\u30B0\u30E9\u30D5"]].map(([y,je])=>L(J,{tone:te.search_metadata.executed_tiers[y]?"success":"neutral",variant:"tint",testId:`search-tier-${y}`,dataAttributes:{"data-ran":te.search_metadata.executed_tiers[y]},children:`${je} ${te.search_metadata.executed_tiers[y]?"\u8D70\u3063\u305F":"\u8D70\u3089\u306A\u304B\u3063\u305F"}`},y))})},{key:"breakers",term:"\u906E\u65AD\u5668",description:L(s,{fg:"fg",type:"body",testId:"search-breakers",children:`\u30D9\u30AF\u30C8\u30EB ${_n[te.search_metadata.circuit_breaker_status.vector]} \xB7 \u30B0\u30E9\u30D5 ${_n[te.search_metadata.circuit_breaker_status.graph]}`})},{key:"rows",term:"\u884C\u306E\u30B9\u30B3\u30FC\u30D7",description:L(s,{fg:"fg",type:"body",testId:"search-row-scope",children:te.authz_scopes.row_scope_applied?"\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u8AAD\u3081\u306A\u3044\u6587\u66F8\u306F\u4E00\u89A7\u306B\u542B\u307F\u307E\u305B\u3093)":"\u639B\u304B\u3063\u3066\u3044\u307E\u305B\u3093"})},{key:"columns",term:"\u5217\u306E\u30B9\u30B3\u30FC\u30D7",description:L(s,{fg:"fg",type:"body",testId:"search-column-scope",children:te.authz_scopes.column_scope_applied?te.authz_scopes.hidden_columns.length===0?"\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u7B54\u3048\u306E\u6B04\u306B\u4F0F\u305B\u305F\u3082\u306E\u306F\u3042\u308A\u307E\u305B\u3093)":`\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u4F0F\u305B\u305F\u6B04: ${te.authz_scopes.hidden_columns.join("\u30FB")})`:"\u639B\u304B\u3063\u3066\u3044\u307E\u305B\u3093"})}],testId:"search-run"}),L(Gn,{master:L(ln,{label:"\u898B\u3064\u304B\u3063\u305F\u6587\u66F8",items:Rt,itemKey:y=>String(y.rank),selectedKey:G,onSelect:y=>ee(String(y.rank)),detailId:a,renderRow:y=>Pt(Al,{children:[L(s,{fg:"fg",type:"body",children:`#${y.rank} ${bt(me("file_name"),y.hit.file_name)}`}),L(Rn,{label:`#${y.rank} \u306E\u878D\u5408\u306E\u5024`,value:y.hit.scores.fused,min:0,max:1,valueText:y.hit.scores.fused.toFixed(pn),testId:`search-hit-${y.rank}-fused`})]}),rowTestId:"search-hit-row",rowData:y=>({"data-rank":y.rank}),empty:"\u6761\u4EF6\u306B\u5408\u3046\u6587\u66F8\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u691C\u7D22\u8A9E\u3092\u77ED\u304F\u3059\u308B\u304B\u3001\u6226\u7565\u3084\u7D5E\u308A\u8FBC\u307F\u3092\u5909\u3048\u3066\u304F\u3060\u3055\u3044\u3002",testId:"search-hits"}),detail:Yt===null?L(Te,{id:a,title:"\u6587\u66F8\u306E\u8A73\u7D30",region:!0,testId:"search-hit-detail",children:L(s,{as:"p",fg:"fg-secondary",type:"prose",children:"\u4E00\u89A7\u306E\u884C\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u6587\u66F8\u306E\u8A73\u7D30\u3092\u793A\u3057\u307E\u3059\u3002"})}):Sr(Yt.hit,Yt.rank),masterMinPx:Pl,detailMinPx:Ll,testId:"search-master-detail"})]})}),L(dt,{summary:"\u958B\u767A\u8005\u306E\u70B9\u691C",open:Y,onOpenChange:et,testId:"search-inspector",children:Pt(x,{gap:"space-4",testId:"search-inspector-body",children:[L(Ct,{label:"\u70B9\u691C\u306E\u7A93",options:Object.keys(kn).map(y=>({value:y,label:kn[y]})),value:Ce,onValueChange:y=>F(y),testId:"search-inspector-view"}),L(Sn,{label:`\u70B9\u691C\u306E\u7A93: ${kn[Ce]}`,code:j(Ce),testId:"search-inspector-code"}),L(X,{gap:"space-2",testId:"search-inspector-actions",children:L(V,{variant:"secondary",onClick:()=>{pe()},testId:"search-inspector-copy",children:`${kn[Ce]}\u3092\u5199\u3059`})}),se!==null&&L(Ae,{occurrence:se.occurrence,testId:"search-inspector-copy-failure",children:se.message})]})})]})}import{PIPELINE_FAILURE_STATUSES as Ol}from"@aiquants/enrichment-core";var Wn={PENDING:"\u5F85\u6A5F\u4E2D",EXTRACTING:"\u672C\u6587\u62BD\u51FA\u4E2D",ENRICHING:"AI \u8981\u7D04\u30FB\u69CB\u9020\u5316\u4E2D",PROJECTING:"\u30D9\u30AF\u30C8\u30EB/\u30B0\u30E9\u30D5\u6295\u5F71\u4E2D",SYNCED:"\u540C\u671F\u5B8C\u4E86",FAILED_EXTRACT:"\u5931\u6557: FAILED_EXTRACT",FAILED_ENRICH:"\u5931\u6557: FAILED_ENRICH",FAILED_VECTOR:"\u5931\u6557: FAILED_VECTOR",FAILED_GRAPH:"\u5931\u6557: FAILED_GRAPH"},Pn="\u53D6\u308A\u8FBC\u307F\u306E\u8A18\u9332\u306A\u3057",Ml=new Set(Ol);function Zn(e){return Ml.has(e)?"danger":e==="SYNCED"?"success":"info"}import{Fragment as Ar,jsx as _e,jsxs as at}from"react/jsx-runtime";var Yl={all:"\u5168\u3066",documents:"\u6587\u66F8",nodes:"\u7BC0\u70B9"},Ql={current:"\u73FE\u884C\u306E\u7248",all:"\u53E4\u3044\u7248\u3082"},zl={excluded:"\u9664\u304F",included:"\u542B\u3081\u308B"},Wl={all:"\u5168\u3066\u306E\u72B6\u614B",in_flight:"\u51E6\u7406\u4E2D",synced:"\u540C\u671F\u5B8C\u4E86",failed:"\u5931\u6557",no_record:Pn},ma="\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u95B2\u89A7\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",Or="\u540D\u524D\u306A\u3057",It={id:"ID",kind:"\u7A2E\u985E",place:"\u4F4D\u7F6E",name:"\u540D\u524D / URI",classification:"\u6A5F\u5BC6\u533A\u5206\u30FB\u7248",status:"\u72B6\u614B",times:"\u767B\u9332\u30FB\u66F4\u65B0",history:"\u5C65\u6B74"},$r={created:"\u767B\u9332",updated:"\u66F4\u65B0"},wr={node:"\u6839\u306E\u5C65\u6B74",document:"\u6587\u66F8\u306E\u5C65\u6B74"},Zl="\u8AAD\u307F\u306E\u8A18\u9332\u306A\u3057",ed=e=>JSON.stringify([e.kind,e.revision,e.deleted,e.status,e.q]),td=e=>{if(e.total===null)throw new Error("ProcessingObjectBrowser: the first page carries the total of the rows its filters admit");return e.total};function nd(e){if(e===null)return Zl;let t=`${Dt(e.stepKey)} ${Cn[e.status].label}`;return e.skipReason===null?t:`${t} (${Qn(e.skipReason)})`}function rd(e,t){return e.kind==="document"?`\u6587\u66F8 (${Kl[Hl(t,e.mimeType)]})`:Bl(e.assetType)}function od(e){let t=[e.isCurrent?null:"\u65E7\u7248",e.isDeleted?"\u524A\u9664\u6E08\u307F":null].filter(n=>n!==null);return[Nr[e.confidentialityLevel],rt(e.revision),...t].join(" ")}var Dr=(e,t)=>e===null?_e(s,{fg:"fg-secondary",type:"body",testId:t,children:Pn}):_e(J,{tone:Zn(e),variant:"tint",testId:t,children:Wn[e]});function Pm({host:e,mimeKindRules:t,filter:n,onFilterChange:r,onOpenHistory:o}){let{labels:a,timeZone:l}=S(),u=kt(),i=ua(null),p=ua(null),[T,E]=pa(n.q??""),[m,c]=pa(void 0);ca(()=>{E(n.q??""),c(void 0)},[n.q]);let _=xt(ed(n),{first:N=>e.loadPage(n,null,N).then(B=>ia(B,R=>({rows:R.rows,next:R.next,meta:td(R)}))),next:(N,B)=>e.loadPage(n,N,B).then(R=>(!R.ok&&R.status===Ul&&_.reload(),ia(R,M=>({rows:M.rows,next:M.next}))))},0),f=Me(()=>i.current),C=_.state.kind==="ready"?_.state.refreshFailure:null,I=lt(C),U=_.state.kind==="ready"?`\u5168 ${_.state.value.meta} \u4EF6\u306E\u3046\u3061 ${_.state.value.rows.length} \u4EF6\u3092\u8868\u793A\u3057\u3066\u3044\u307E\u3059\u3002`:null;ca(()=>{U!==null&&u(U)},[u,U]);let w=N=>{if(N.preventDefault(),T.trim()===""){c(void 0),n.q!==null&&r({...n,q:null});return}let B=Xl.safeParse(T);if(!B.success){c(`${la} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);return}c(void 0),r({...n,q:B.data})},ne=()=>{if(_.state.kind==="failed")return _e(ot,{failure:_.state,onReload:_.reload,forbiddenMessage:ma,failureMessage:R=>`\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F: ${R}`,rescueRef:f,testId:"processing-objects-failed"});if(_.state.kind!=="ready")return _e("p",{"aria-busy":"true","data-testid":"processing-objects-loading",children:"\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:N}=_.state,B=N.rows.map((R,M)=>({entry:R,position:M}));return at(Ar,{children:[C!==null&&_e(Ae,{occurrence:I,testId:"processing-objects-refresh-failed",children:a.failureSentence(C,ma,R=>`\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F: ${R}`)}),_e(s,{as:"p",fg:"fg",type:"body",testId:"processing-objects-count",children:U}),_e(Re,{caption:"\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7",captionHidden:!0,columns:[{key:"id",header:It.id,width:{fixedPx:vr({header:It.id},[{kind:"text",texts:[String(9999999999)],face:"sans",type:"body"}])},align:"end",cell:({entry:R})=>R.kind==="readable"?String(R.item.id):null},{key:"kind",header:It.kind,width:{minPx:Ln},align:"start",cell:({entry:R})=>R.kind==="readable"?rd(R.item,t):null},{key:"place",header:It.place,width:{minPx:Ln},align:"start",cell:({entry:R})=>R.kind==="readable"&&R.item.kind==="node"?at(Ar,{children:[_e("span",{children:da(R.item.treePath)})," ",_e("span",{children:`\u6839 ${R.item.rootMetadataId}`})]}):null},{key:"name",header:It.name,width:{minPx:Ln},align:"start",cell:({entry:R})=>R.kind==="restricted"?_e("span",{"data-restricted-mark":"object",children:Tt}):R.item.kind==="document"?at(Ar,{children:[_e("span",{children:R.item.fileName})," ",_e("span",{children:R.item.fileUri})]}):R.item.sourceName??Or},{key:"classification",header:It.classification,width:{minPx:Ln},align:"start",cell:({entry:R})=>R.kind==="readable"?od(R.item):null},{key:"status",header:It.status,width:{minPx:Ln},align:"start",cell:({entry:R,position:M})=>{if(R.kind==="restricted")return Dr(R.syncStatus,`processing-object-status-${M}`);let{item:K}=R;return K.kind==="document"?at(x,{gap:"space-1",testId:`processing-object-state-${K.id}`,children:[Dr(K.syncStatus,`processing-object-status-${M}`),K.errorMessage!==null&&_e(s,{fg:"danger-fg",type:"body",testId:`processing-object-error-${K.id}`,children:K.errorMessage})]}):at(x,{gap:"space-1",testId:`processing-object-state-${K.id}`,children:[at(X,{gap:"space-2",testId:`processing-object-root-run-${K.id}`,children:[_e(s,{fg:"fg-secondary",type:"body",children:"\u6839\u306E\u5B9F\u884C"}),Dr(K.rootSyncStatus,`processing-object-status-${M}`)]}),_e(s,{fg:"fg",type:"body",testId:`processing-object-reading-${K.id}`,children:`\u8AAD\u307F: ${nd(K.reading)}`})]})}},{key:"times",header:It.times,width:{fixedPx:vr({header:It.times},[{kind:"text",texts:Object.values($r).map(R=>`${R} ${zn(l)}`),face:"sans",type:"body"}])},align:"start",cell:({entry:R,position:M})=>{let K=R.kind==="readable"?R.item:R;return at(x,{gap:"space-1",testId:`processing-object-times-${M}`,children:[at("span",{children:[$r.created," ",_e(le,{iso:K.createdAt,testId:`processing-object-created-${M}`})]}),at("span",{children:[$r.updated," ",_e(le,{iso:K.updatedAt,testId:`processing-object-updated-${M}`})]})]})}},...o===void 0?[]:[{key:"history",header:It.history,width:{fixedPx:vr({header:It.history},[{kind:"button",labels:Object.values(wr)}])},align:"start",cell:({entry:R})=>{if(R.kind==="restricted")return null;let{item:M}=R,K=M.kind==="node";return at(V,{variant:"secondary",onClick:()=>o(K?M.rootMetadataId:M.id),testId:`processing-object-history-${M.id}`,children:[K?wr.node:wr.document," ",_e(Nt,{testId:`processing-object-history-name-${M.id}`,children:K?`${da(M.treePath)} \u306E\u6839 ${M.rootMetadataId}`:M.fileName})]})}}]],rows:B,rowKey:({entry:R,position:M})=>R.kind==="readable"?`object-${R.item.id}`:`restricted-${M}`,rowTestId:"processing-object-row",rowData:({entry:R})=>({"data-row-kind":R.kind==="readable"?R.item.kind:"restricted"}),rowSize:o===void 0?"row":"row-control",empty:"\u7D5E\u308A\u8FBC\u307F\u306B\u5F53\u305F\u308B\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:"processing-objects-table",ref:p}),_e(_t,{onLoad:_.loadMore,busy:N.loadingMore||_.state.refreshing,done:N.next===null,failure:N.moreFailure,limit:Vl,rows:{count:B.length,ref:p},testId:"processing-objects-more"})]})};return _e(fe,{title:"\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7",description:"\u30C6\u30CA\u30F3\u30C8\u306E\u53D6\u308A\u8FBC\u3093\u3060\u6587\u66F8\u3068\u3001\u305D\u306E\u6DFB\u4ED8\u30FB\u66F8\u5EAB\u306E\u4E2D\u8EAB\u30FB\u753B\u50CF\u306A\u3069\u306E\u7BC0\u70B9\u3092\u3001\u65B0\u3057\u3044\u9806\u306B\u5168\u3066\u8FBF\u308C\u307E\u3059\u3002",headingRef:i,testId:"processing-objects",children:at(x,{gap:"space-4",testId:"processing-objects-body",children:[at(X,{gap:"space-4",testId:"processing-objects-filters",children:[_e(Ct,{label:"\u7A2E\u985E",options:Gl.map(N=>({value:N,label:Yl[N]})),value:n.kind,onValueChange:N=>r({...n,kind:N}),testId:"processing-objects-kind"}),_e(Ct,{label:"\u7248",options:Jl.map(N=>({value:N,label:Ql[N]})),value:n.revision,onValueChange:N=>r({...n,revision:N}),testId:"processing-objects-revision"}),_e(Ct,{label:"\u524A\u9664\u6E08\u307F",options:jl.map(N=>({value:N,label:zl[N]})),value:n.deleted,onValueChange:N=>r({...n,deleted:N}),testId:"processing-objects-deleted"}),_e(gt,{label:"\u540C\u671F\u306E\u72B6\u614B",description:"\u7BC0\u70B9\u306F\u6839\u306E\u72B6\u614B\u3067\u7D5E\u308A\u307E\u3059",value:n.status,options:ql.map(N=>({value:N,label:Wl[N]})),onValueChange:N=>r({...n,status:N}),testId:"processing-objects-status"})]}),_e("form",{onSubmit:w,noValidate:!0,"data-testid":"processing-objects-query-form",children:at(X,{gap:"space-2",testId:"processing-objects-query-fields",children:[_e(Ze,{label:"\u540D\u524D\u30FBURI \u306E\u4E00\u90E8",type:"search",value:T,onValueChange:E,description:`1\u301C${la} \u5B57\u3002\u540D\u524D\u3067\u7D5E\u3063\u305F\u4E00\u89A7\u306F\u9694\u96E2\u3055\u308C\u305F\u6587\u66F8\u3092\u8F09\u305B\u307E\u305B\u3093`,error:m,testId:"processing-objects-query"}),_e(V,{variant:"primary",type:"submit",testId:"processing-objects-query-submit",children:"\u7D5E\u308A\u8FBC\u3080"})]})}),ne()]})})}import{Fragment as dd,jsx as Xe,jsxs as Ia}from"react/jsx-runtime";var ya="\u5B50\u306E\u5B9F\u884C\u3092\u95B2\u89A7\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",ba="\u5B50\u306E\u5B9F\u884C",Ot={place:"\u7BC0\u70B9",name:"\u540D\u524D",flow:"\u6D41\u308C",status:"\u72B6\u614B",failedStep:"\u6B62\u307E\u3063\u305F\u6BB5",started:"\u958B\u59CB",finished:"\u7D42\u4E86"};function Hm({rootRunId:e,read:t,caption:n,rescueTarget:r,testId:o}){let{labels:a,timeZone:l}=S(),u=ld(null),i=xt(e,{first:c=>t(e,null,c).then(_=>ga(_,f=>({rows:f.rows,next:f.next,meta:null}))),next:(c,_)=>t(e,c,_).then(f=>(!f.ok&&f.status===ad&&i.reload(),ga(f,C=>({rows:C.rows,next:C.next}))))},0),p=Me(r),T=i.state.kind==="ready"?i.state.refreshFailure:null,E=lt(T);if(i.state.kind==="failed")return Xe(ot,{failure:i.state,onReload:i.reload,forbiddenMessage:ya,failureMessage:We(ba),rescueRef:p,testId:`${o}-failed`});if(i.state.kind!=="ready")return Xe("p",{"aria-busy":"true","data-testid":`${o}-loading`,children:"\u5B50\u306E\u5B9F\u884C\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:m}=i.state;return Ia(dd,{children:[T!==null&&Xe(Ae,{occurrence:E,testId:`${o}-refresh-failed`,children:a.failureSentence(T,ya,We(ba))}),Xe(Re,{caption:n,captionHidden:!0,columns:[{key:"place",header:Ot.place,width:{minPx:Nn},align:"start",cell:({run:c,node:_})=>Ia("span",{"data-testid":`${o}-place-${c.id}`,children:[Xe("span",{children:id(_.treePath)})," ",Xe("span",{children:`#${c.metadataId}`})]})},{key:"name",header:Ot.name,width:{minPx:Nn},align:"start",cell:({run:c,node:_})=>Xe("span",{"data-testid":`${o}-name-${c.id}`,children:_.sourceName??Or})},{key:"flow",header:Ot.flow,width:{minPx:Nn},align:"start",cell:({run:c})=>Xe("span",{"data-testid":`${o}-flow-${c.id}`,children:mn(c)})},{key:"status",header:Ot.status,width:{minPx:Nn},align:"start",cell:({run:c})=>Xe(J,{tone:wt[At(c)],variant:"tint",testId:`${o}-status-${c.id}`,children:$t[At(c)].label})},{key:"failed-step",header:Ot.failedStep,width:{minPx:Nn},align:"start",cell:({run:c})=>Xe("span",{"data-testid":`${o}-failed-step-${c.id}`,children:c.failedStepKey===null?"\u2014":Dt(c.failedStepKey)})},{key:"started",header:Ot.started,width:{fixedPx:fa({header:Ot.started},[qe(l)])},align:"start",cell:({run:c})=>Xe("span",{"data-testid":`${o}-started-${c.id}`,children:Xe(le,{iso:c.startedAt,testId:`${o}-started-${c.id}-value`})})},{key:"finished",header:Ot.finished,width:{fixedPx:fa({header:Ot.finished},[qe(l),{kind:"text",texts:[Yn],face:"sans",type:"body"}])},align:"start",cell:({run:c})=>Xe("span",{"data-testid":`${o}-finished-${c.id}`,children:Xe(Vt,{iso:c.finishedAt,testId:`${o}-finished-${c.id}-value`})})}],rows:m.rows,rowKey:({run:c})=>`child-run:${c.id}`,rowTestId:`${o}-row`,rowData:({run:c})=>({"data-run-id":String(c.id),"data-status":c.status}),rowSize:"row",empty:"\u8AAD\u3081\u308B\u5B50\u306E\u5B9F\u884C\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${o}-table`,ref:u}),Xe(_t,{onLoad:i.loadMore,busy:m.loadingMore||i.state.refreshing,done:m.next===null,failure:m.moreFailure,limit:sd,rows:{count:m.rows.length,ref:u},testId:`${o}-more`})]})}import{FLEXIBLE_COLUMN_MIN_PX as Fr,fixedColumnPx as tr,HTTP_FORBIDDEN as cd,mapOutcome as xa}from"@aiquants/console-ui/core";import{DOCUMENT_CHANGE_FEED_PAGE_SIZE as ud}from"@aiquants/enrichment-core";import{useRef as Ca}from"react";import{RUN_TERMINAL_STEP_KEY as Ea}from"@aiquants/enrichment-core";var ha=(e,t)=>Date.parse(t.time)-Date.parse(e.time);function Sa(e){let t=e.states.flatMap(i=>i.kind==="readable"?[i.item]:[]),n=e.runs.flatMap(i=>i.kind==="readable"?[i.item]:[]),r=new Set(n.map(i=>i.id)),o=[...n.map(i=>({kind:"run",key:`run:${i.id}`,time:i.startedAt,run:i,state:t.find(p=>p.runId===i.id)??null})),...t.filter(i=>i.runId===null||!r.has(i.runId)).map(i=>({kind:"state",key:`state:${i.stateId}`,time:i.settledAt,state:i}))].sort(ha),l=[...new Set([...e.revisions.map(i=>i.revision),...o.map(i=>i.kind==="run"?i.run.revision:i.state.revision)])].sort((i,p)=>p-i).map(i=>({revision:i,isCurrent:e.revisions.some(p=>p.revision===i&&p.isCurrent),items:o.filter(p=>(p.kind==="run"?p.run.revision:p.state.revision)===i)})),u=[...e.states.flatMap((i,p)=>i.kind==="restricted"?[{key:`restricted:state:${p}`,time:i.settledAt,mark:i}]:[]),...e.runs.flatMap((i,p)=>i.kind==="restricted"?[{key:`restricted:run:${p}`,time:i.startedAt,mark:i}]:[])].sort(ha);return{groups:l,marks:u,states:t,runs:n}}function Mr(e){if(e.status==="RUNNING")return!1;let t=e.steps.find(n=>n.stepKey===Ea);return t===void 0||t.status==="FAILED"}function Ra(e,t){let n=t.states.find(a=>a.stateId===e.previousStateId);if(n===void 0)return[];let r=Date.parse(n.settledAt),o=Date.parse(e.settledAt);return t.runs.filter(a=>{let l=Date.parse(a.startedAt);return a.status!=="RUNNING"&&a.id!==e.runId&&l>=r&&l<o&&!t.states.some(u=>u.runId===a.id)&&!a.steps.some(u=>u.stepKey===Ea&&u.status==="SUCCEEDED")}).map(a=>a.id)}function Ta(e,t){switch(e.kind){case"latest_state":{let n=t.states[0];return n===void 0?null:t.runs.some(r=>r.id===n.runId)?`run:${n.runId}`:`state:${n.stateId}`}case"run":return`run:${e.runId}`;case"state":{let n=t.states.find(r=>r.stateId===e.stateId);return n!==void 0&&t.runs.some(r=>r.id===n.runId)?`run:${n.runId}`:`state:${e.stateId}`}}}function _a(e,t){return e.kind==="readable"?`readable:${e.item.stateId}`:`restricted:${t}`}import{Fragment as Pa,jsx as ct,jsxs as Ur}from"react/jsx-runtime";var pd="document-changes",ht={time:"\u6642\u523B",document:"\u6587\u66F8",revision:"\u7248",cause:"\u5951\u6A5F",actor:"\u64CD\u4F5C\u8005",facets:"\u5909\u308F\u3063\u305F\u9762",open:"\u958B\u304F"},ka="\u958B\u304F",md=tr({header:ht.revision},[{kind:"text",texts:[En(99998,99999),En(99999,99999)],face:"sans",type:"body"}]);function tf({host:e,onOpen:t}){let{labels:n,timeZone:r}=S(),o=Ca(null),a=Ca(null),l=xt(pd,{first:E=>e.loadChanges(null,E).then(m=>xa(m,c=>({rows:c.rows,next:c.next,meta:null}))),next:(E,m)=>e.loadChanges(E,m).then(c=>(!c.ok&&c.status===cd&&l.reload(),xa(c,_=>({rows:_.rows,next:_.next}))))},0),u=Me(()=>o.current),i=l.state.kind==="ready"?l.state.refreshFailure:null,p=lt(i);return ct(fe,{title:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",headingRef:o,testId:"change-feed",children:(()=>{if(l.state.kind==="failed")return ct(ot,{failure:l.state,onReload:l.reload,forbiddenMessage:jt,failureMessage:We("\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316"),rescueRef:u,testId:"change-feed-failed"});if(l.state.kind!=="ready")return ct("p",{"aria-busy":"true","data-testid":"change-feed-loading",children:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:E}=l.state,m=E.rows.map((c,_)=>({row:c,position:_}));return Ur(Pa,{children:[i!==null&&ct(Ae,{occurrence:p,testId:"change-feed-refresh-failed",children:jn(n,i,"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316")}),ct(Re,{caption:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",captionHidden:!0,columns:[{key:"time",header:ht.time,width:{fixedPx:tr({header:ht.time},[qe(r)])},align:"start",cell:({row:c,position:_})=>ct(le,{iso:c.kind==="readable"?c.item.settledAt:c.settledAt,testId:`change-feed-time-value-${_}`})},{key:"document",header:ht.document,width:{minPx:Fr},align:"start",cell:({row:c})=>c.kind==="readable"?Ur(Pa,{children:[ct("span",{children:c.item.fileName})," ",ct("span",{children:c.item.fileUri})]}):ct("span",{"data-restricted-mark":"change",children:Tt})},{key:"revision",header:ht.revision,width:{fixedPx:md},align:"start",cell:({row:c})=>c.kind==="readable"?En(c.item.previousRevision,c.item.revision):null},{key:"cause",header:ht.cause,width:{fixedPx:tr({header:ht.cause},[{kind:"text",texts:Object.values(an),face:"sans",type:"body"}])},align:"start",cell:({row:c})=>c.kind==="readable"?an[c.item.cause]:null},{key:"actor",header:ht.actor,width:{minPx:Fr},align:"start",cell:({row:c})=>c.kind==="readable"?c.item.actor:null},{key:"facets",header:ht.facets,width:{minPx:Fr},align:"start",cell:({row:c,position:_})=>c.kind==="readable"?c.item.changes.map(f=>ct(J,{tone:"neutral",variant:"tint",testId:`change-feed-badge-${_}-${f.facet}`,children:Kn(f)},f.facet)):null},...t===void 0?[]:[{key:"open",header:ht.open,width:{fixedPx:tr({header:ht.open},[{kind:"button",labels:[ka]}])},align:"start",cell:({row:c})=>c.kind==="readable"?Ur(V,{variant:"secondary",onClick:()=>t(c.item.metadataId,c.item.stateId),testId:`change-feed-open-${c.item.stateId}`,children:[ka," ",ct(Nt,{testId:`change-feed-open-name-${c.item.stateId}`,children:`${c.item.fileName} ${En(c.item.previousRevision,c.item.revision)} \u306E\u5909\u5316`})]}):null}]],rows:m,rowKey:({row:c,position:_})=>_a(c,_),rowTestId:"change-feed-row",rowData:({row:c})=>({"data-row-kind":c.kind}),rowSize:t===void 0?"row":"row-control",empty:"\u76F4\u8FD1\u306E\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:"change-feed-table",ref:a}),ct(_t,{onLoad:l.loadMore,busy:E.loadingMore||l.state.refreshing,done:E.next===null,failure:E.moreFailure,limit:ud,rows:{count:m.length,ref:a},testId:"change-feed-more"})]})})()})}import{reasonAside as Rc}from"@aiquants/console-ui/core";import{useCallback as Tc,useEffect as cr,useId as Za,useRef as Lt,useState as Wt}from"react";import{comparisonAttributePx as Hd,FLEXIBLE_COLUMN_MIN_PX as lr,fixedColumnPx as Kd}from"@aiquants/console-ui/core";import{DOCUMENT_FACETS as jd}from"@aiquants/enrichment-core";import{useCallback as Gd,useEffect as Vd,useId as Jd,useMemo as qd,useState as Xd}from"react";import{FLEXIBLE_COLUMN_MIN_PX as qr,fixedColumnPx as Xr}from"@aiquants/console-ui/core";import{useState as wd}from"react";import{fixedColumnPx as Vr,mapOutcome as Da,tableFrameMinInlinePx as bd}from"@aiquants/console-ui/core";import{DIFF_LINE_PAGE_MAX as Br}from"@aiquants/enrichment-core";import{Fragment as Id,useCallback as Oa,useEffect as Gr,useId as hd,useMemo as Ed,useRef as Ma,useState as rr}from"react";import{ceil8 as fd,TOKENS as La,textWidthEm as gd}from"@aiquants/console-ui/core";var yd=20,Na=fd(La.type.body.size*gd("\u3042".repeat(yd))+2*La.space["space-3"]),va=448,$a=40;function wa(e){if(!(Number.isSafeInteger(e)&&e>=0))throw new RangeError(`A line number is a non-negative safe integer: ${e}`);return String(e).length}import{jsx as de,jsxs as or}from"react/jsx-runtime";var Jr="\u5E45\u304C\u8DB3\u308A\u306A\u3044\u305F\u3081 1 \u5217\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059",Fa={removed:"\u2212",added:"+"},Ge={oldNumber:"\u65E7",newNumber:"\u65B0",sign:"\u7B26\u53F7",oldText:"\u53E4\u3044\u672C\u6587",newText:"\u65B0\u3057\u3044\u672C\u6587",text:"\u672C\u6587"},Aa="\u5DEE\u5206\u306E\u884C\u306F\u3042\u308A\u307E\u305B\u3093\u3002",Sd=Vr({header:Ge.sign},[{kind:"text",texts:Object.values(Fa),face:"mono",type:"body"}]),Rd=Math.max(...[Ge.oldText,Ge.newText,Ge.text].map(e=>Vr({header:e},[{kind:"text",texts:["0".repeat($a)],face:"mono",type:"body"}])));function Hr(e){let t=e.newLines>0?e.newStart:e.oldStart,n=e.firstPage===null?"":` (p.${e.firstPage})`;return`${t} \u884C\u76EE${n} +${e.linesAdded} \u2212${e.linesRemoved}`}function Td(e){return e.reduce((t,n)=>Math.max(t,n.oldStart+n.oldLines-1,n.newStart+n.newLines-1),0)}function _d(e){return e.reduce((t,{line:n})=>Math.max(t,n.oldNumber??0,n.newNumber??0),0)}function xd(e){let t=[],n=0;for(let r=1;r<=e.length;r++)(r===e.length||e[r].page!==e[n].page)&&(t.push(...Cd(e.slice(n,r).map(({line:o})=>o))),n=r);return t}function Cd(e){let t=[],n=[],r=[],o=()=>{for(let a=0;a<Math.max(n.length,r.length);a++)t.push({left:n[a]??null,right:r[a]??null});n=[],r=[]};for(let a of e)a.kind==="context"?(o(),t.push({left:a,right:a})):a.kind==="removed"?(r.length>0&&o(),n.push(a)):r.push(a);return o(),t}function kd(e){let t={kind:"text",texts:["0".repeat(wa(e))],face:"mono",type:"body"};return Math.max(...[Ge.oldNumber,Ge.newNumber].map(n=>Vr({header:n},[t])))}function nr(e){return e===null?null:de(s,{fg:"fg",type:"body",face:"mono",children:e})}function Kr(e){return e===null||e.kind==="context"?null:de(s,{fg:"fg",type:"body",face:"mono",children:Fa[e.kind]})}function jr(e,t){return e===null?null:de(s,{fg:"fg",type:"body",face:"mono",space:"preserve",children:e.segments.map((n,r)=>{let o=`${r}`;return n.kind==="equal"?de(Id,{children:n.text},o):de(jo,{kind:n.kind,testId:`${t}-${n.kind}`,children:n.text},o)})})}function Pd(e,t){let n={fixedPx:kd(e)},r={fixedPx:Sd},o={minPx:Rd};return{split:[{key:"old-number",header:Ge.oldNumber,width:n,align:"end",cell:({left:a})=>nr(a===null?null:a.oldNumber)},{key:"old-sign",header:Ge.sign,width:r,align:"start",cell:({left:a})=>Kr(a)},{key:"old-text",header:Ge.oldText,width:o,align:"start",cell:({left:a})=>jr(a,t)},{key:"new-number",header:Ge.newNumber,width:n,align:"end",cell:({right:a})=>nr(a===null?null:a.newNumber)},{key:"new-sign",header:Ge.sign,width:r,align:"start",cell:({right:a})=>Kr(a)},{key:"new-text",header:Ge.newText,width:o,align:"start",cell:({right:a})=>jr(a,t)}],unified:[{key:"old-number",header:Ge.oldNumber,width:n,align:"end",cell:({line:a})=>nr(a.oldNumber)},{key:"new-number",header:Ge.newNumber,width:n,align:"end",cell:({line:a})=>nr(a.newNumber)},{key:"sign",header:Ge.sign,width:r,align:"start",cell:({line:a})=>Kr(a)},{key:"text",header:Ge.text,width:o,align:"start",cell:({line:a})=>jr(a,t)}]}}var Ld=e=>`${e.left?.oldNumber??""}:${e.right?.newNumber??""}`,Nd=({line:e})=>`${e.oldNumber??""}:${e.newNumber??""}`;function vd({states:e,target:t,hunk:n,layout:r,columns:o,tableLabel:a,readLines:l,rescueTarget:u,onLines:i,testId:p}){let T={...e,...t,hunk:n},E=JSON.stringify([e.fromStateId,e.toStateId,t,n]),m=xt(E,{first:U=>l({...T,offset:0,limit:Br},U).then(w=>Da(w,ne=>({rows:ne.lines.map(N=>({line:N,page:0})),next:ne.next,meta:null}))),next:(U,w)=>l({...T,offset:U,limit:Br},w).then(ne=>Da(ne,N=>({rows:N.lines.map(B=>({line:B,page:U})),next:N.next})))},0),c=Me(u),_=Ma(null),f=m.state.kind==="ready"?m.state.value.rows:null;if(Gr(()=>{f!==null&&i(_d(f))},[f,i]),m.state.kind==="failed")return de(ot,{failure:m.state,onReload:m.reload,forbiddenMessage:jt,failureMessage:We("\u5DEE\u5206\u306E\u884C"),rescueRef:c,testId:`${p}-failed`});if(m.state.kind!=="ready")return de("div",{"aria-busy":"true","data-testid":`${p}-loading`,children:de(s,{as:"p",fg:"fg",type:"body",children:"\u5DEE\u5206\u306E\u884C\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"})});let{value:C}=m.state,I=r==="split"?xd(C.rows):null;return de("div",{"data-testid":p,"data-layout":r,children:or(x,{gap:"space-2",testId:`${p}-parts`,children:[I===null?de(Re,{caption:a,captionHidden:!0,columns:o.unified,rows:C.rows,rowKey:Nd,rowTestId:`${p}-line`,rowData:({line:U})=>({"data-line-kind":U.kind}),rowSize:"row-compact",empty:Aa,testId:`${p}-lines`,ref:_}):de(Re,{caption:a,captionHidden:!0,columns:o.split,rows:I,rowKey:Ld,rowTestId:`${p}-line`,rowData:U=>({"data-line-kind":U.left===U.right?"context":"changed"}),rowSize:"row-compact",empty:Aa,testId:`${p}-lines`,ref:_}),de(_t,{onLoad:m.loadMore,busy:C.loadingMore||m.state.refreshing,done:C.next===null,failure:C.moreFailure,limit:Br,rows:{count:I===null?C.rows.length:I.length,ref:_},testId:`${p}-more`})]})})}function $d(){let[e,t]=rr(null);return[Oa((r=>{let o=new ResizeObserver(a=>{for(let l of a)t(l.contentRect.width)});return o.observe(r),()=>o.disconnect()}),[]),e]}function ar({states:e,target:t,index:n,readLines:r,label:o,rescueTarget:a,onNarrowChange:l,testId:u}){S();let i=hd(),[p,T]=rr("split"),[E,m]=rr(()=>new Set(n===null?[0]:[])),[c,_]=rr(0),[f,C]=$d(),I=Ma(new Map),U=Oa(v=>_(q=>Math.max(q,v)),[]),w=Math.max(n===null?0:Td(n.hunks),c),ne=Ed(()=>Pd(w,u),[w,u]),N=bd(ne.split),B=C!==null&&C>=N,R=p==="split"&&B?"split":"unified",M=p==="split"&&C!==null&&!B;Gr(()=>{l(i,M)},[i,M,l]),Gr(()=>()=>l(i,!1),[i,l]);let K=(v,q)=>m(H=>{let O=new Set(H);return q?O.add(v):O.delete(v),O}),ae=v=>`${i}-hunk-${v}`,Ee=(v,q)=>de(vd,{states:e,target:t,hunk:v,layout:R,columns:ne,tableLabel:q,readLines:r,rescueTarget:()=>I.current.get(v)??a(),onLines:U,testId:`${u}-hunk-${v}-body`});return de("div",{ref:f,"data-testid":u,"data-layout":R,"data-split-min-px":N,children:or(x,{gap:"space-4",testId:`${u}-parts`,children:[n!==null&&de(he,{items:[{key:"lines-added",term:"\u8FFD\u52A0\u3057\u305F\u884C",description:de($,{value:n.stats.linesAdded,testId:`${u}-lines-added`})},{key:"lines-removed",term:"\u524A\u9664\u3057\u305F\u884C",description:de($,{value:n.stats.linesRemoved,testId:`${u}-lines-removed`})},{key:"lines-unchanged",term:"\u5909\u308F\u3089\u306A\u3044\u884C",description:de($,{value:n.stats.linesUnchanged,testId:`${u}-lines-unchanged`})},{key:"chars-added",term:"\u8FFD\u52A0\u3057\u305F\u5B57",description:de($,{value:n.stats.charsAdded,testId:`${u}-chars-added`})},{key:"chars-removed",term:"\u524A\u9664\u3057\u305F\u5B57",description:de($,{value:n.stats.charsRemoved,testId:`${u}-chars-removed`})},{key:"similarity",term:"\u985E\u4F3C\u5EA6",description:de($,{text:n.stats.similarity===null?null:`${(n.stats.similarity*100).toFixed(1)}%`,keep:"whole",testId:`${u}-similarity`})}],testId:`${u}-stats`}),n!==null&&n.attributes.length>0&&de($e,{marker:"bullet",type:"body",gap:"space-1",testId:`${u}-attributes`,children:n.attributes.map(v=>de(we,{testId:`${u}-attribute`,dataAttributes:{"data-field":v.field},children:or(s,{fg:"fg",type:"body",children:[hn(v.field)," ",zt(v.before)," \u2192 ",zt(v.after)]})},v.field))}),n!==null&&n.hunks.length>0&&de($e,{marker:"none",ordered:!0,gap:"space-1",label:"\u5909\u5316\u306E\u584A",testId:`${u}-hunk-index`,children:n.hunks.map(v=>de(we,{testId:`${u}-hunk-index-item`,children:de(qn,{targetId:ae(v.hunk),onFollow:()=>K(v.hunk,!0),dataAttributes:{"data-hunk":v.hunk},testId:`${u}-hunk-index-${v.hunk}`,children:Hr(v)})},v.hunk))}),de(X,{gap:"space-2",testId:`${u}-layout-choice`,children:de(V,{variant:"secondary",onClick:()=>T(p==="split"?"unified":"split"),dataAttributes:{"data-preferred":p},testId:`${u}-layout-toggle`,children:p==="split"?"1 \u5217\u3067\u8868\u793A":"\u4E26\u3079\u3066\u8868\u793A"})}),M&&de(s,{as:"p",fg:"fg",type:"body",testId:`${u}-narrow`,children:Jr}),n===null?Ee(0,o):n.hunks.map(v=>{let q=E.has(v.hunk);return de("div",{id:ae(v.hunk),"data-testid":`${u}-hunk-${v.hunk}`,"data-open":q,children:or(x,{gap:"space-2",testId:`${u}-hunk-${v.hunk}-parts`,children:[de(X,{gap:"space-2",testId:`${u}-hunk-${v.hunk}-actions`,children:de(V,{variant:"secondary",expanded:q,controls:`${ae(v.hunk)}-body`,onClick:()=>K(v.hunk,!q),ref:H=>{H===null?I.current.delete(v.hunk):I.current.set(v.hunk,H)},testId:`${u}-hunk-${v.hunk}-toggle`,children:Hr(v)})}),de("div",{id:`${ae(v.hunk)}-body`,hidden:!q,children:q&&Ee(v.hunk,`${o} ${Hr(v)}`)})]})},v.hunk)})]})})}import{Fragment as Od,jsx as fn,jsxs as sr}from"react/jsx-runtime";var Mt={kind:"\u7A2E\u985E",position:"\u4F4D\u7F6E",heading:"\u898B\u51FA\u3057",numbers:"\u65E7 # \u2192 \u65B0 #",fidelity:"\u672C\u6587\u306E\u518D\u73FE",diff:"\u5DEE\u5206"},Yr={open:"\u5DEE\u5206\u3092\u958B\u304F",close:"\u5DEE\u5206\u3092\u9589\u3058\u308B"},Dd="#00000 \u2192 #00000";function Ad(e){let t=[e.page===null?null:`p.${e.page}`,e.sheet===null?null:`\u30B7\u30FC\u30C8 ${e.sheet}`,e.slide===null?null:`\u30B9\u30E9\u30A4\u30C9 ${e.slide}`,e.startSec===null?null:`${e.startSec}${e.endSec===null?"":`\u2013${e.endSec}`} \u79D2`].filter(n=>n!==null);return t.length===0?"\u4F4D\u7F6E\u306A\u3057":t.join("\u30FB")}function Ua(e){return e.new??e.old}function Ba(e){return e.kind==="MODIFIED"&&e.old?.fidelity!=="UNVERIFIED"&&e.new?.fidelity!=="UNVERIFIED"}function Ha({states:e,stats:t,entries:n,textUnchangedChunkingChanged:r,readLines:o,rescueTarget:a,onNarrowChange:l,testId:u}){S();let[i,p]=wd(()=>new Set),T=m=>p(c=>{let _=new Set(c);return _.delete(m)||_.add(m),_}),E=m=>{let c=[m.old===null?null:["\u65E7",m.old],m.new===null?null:["\u65B0",m.new]].filter(f=>f!==null),_=new Set(c.flatMap(([,f])=>f.fidelity==="UNVERIFIED"?[$o]:f.fidelity==="WHITESPACE_NORMALIZED"?[vo]:[]));return sr(Od,{children:[c.map(([f,C])=>sr("span",{"data-fidelity":C.fidelity,"data-side":f,children:[f," ",No[C.fidelity]," "]},f)),[..._].map(f=>fn("span",{"data-chunk-note":!0,children:f},f))]})};return sr("div",{"data-testid":u,children:[r&&fn(Oe,{tone:"info",testId:`${u}-chunking-only`,children:wo}),sr("p",{"data-testid":`${u}-stats`,children:["\u8FFD\u52A0 ",t.added,"\u30FB\u524A\u9664 ",t.removed,"\u30FB\u5909\u66F4 ",t.modified,"\u30FB\u79FB\u52D5 ",t.moved,"\u30FB\u5909\u308F\u3089\u306A\u3044 ",t.unchanged]}),fn(Re,{caption:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF",captionHidden:!0,columns:[{key:"kind",header:Mt.kind,width:{fixedPx:Xr({header:Mt.kind},[{kind:"text",texts:Object.values(Rr),face:"sans",type:"body"}])},align:"start",cell:m=>Rr[m.kind]},{key:"position",header:Mt.position,width:{minPx:qr},align:"start",cell:m=>Ad(Ua(m))},{key:"heading",header:Mt.heading,width:{minPx:qr},align:"start",cell:m=>Ua(m).breadcrumbs},{key:"numbers",header:Mt.numbers,width:{fixedPx:Xr({header:Mt.numbers},[{kind:"text",texts:[Dd],face:"sans",type:"body"}])},align:"start",cell:m=>`${m.old===null?"(\u306A\u3057)":`#${m.old.index}`} \u2192 ${m.new===null?"(\u306A\u3057)":`#${m.new.index}`}`},{key:"fidelity",header:Mt.fidelity,width:{minPx:qr},align:"start",cell:E},{key:"diff",header:Mt.diff,width:{fixedPx:Xr({header:Mt.diff},[{kind:"button",labels:Object.values(Yr)}])},align:"start",cell:m=>Ba(m)?fn(V,{variant:"secondary",expanded:i.has(m.entry),controls:`${u}-diff-${m.entry}`,onClick:()=>T(m.entry),testId:`${u}-diff-toggle-${m.entry}`,children:i.has(m.entry)?Yr.close:Yr.open}):null}],rows:n,rowKey:m=>`${m.entry}`,rowTestId:`${u}-row`,rowData:m=>({"data-entry":m.entry,"data-kind":m.kind}),rowSize:"row-control",empty:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${u}-table`}),n.filter(m=>Ba(m)&&i.has(m.entry)).map(m=>{let c=`\u30C1\u30E3\u30F3\u30AF #${m.old?.index} \u2192 #${m.new?.index} \u306E\u5DEE\u5206`;return fn("section",{id:`${u}-diff-${m.entry}`,"aria-label":c,"data-testid":`${u}-diff-${m.entry}`,children:fn(ar,{states:e,target:{facet:"chunks",entry:m.entry},index:null,readLines:o,label:c,rescueTarget:a,onNarrowChange:l,testId:`${u}-diff-${m.entry}-view`})},m.entry)})]})}import{compareTreePaths as Md,treePathLabel as Fd}from"@aiquants/enrichment-core";import{useMemo as Ud}from"react";import{jsx as Ka}from"react/jsx-runtime";function Bd(e){let t=new Set;for(let{path:n}of e){if(t.has(n))throw new RangeError(`A tree path list holds the path ${JSON.stringify(n)} more than once.`);t.add(n)}return e.map(({path:n,item:r})=>({path:n,label:Fd(n),item:r})).sort((n,r)=>Md(n.path,r.path))}function ir({items:e,renderItem:t,gap:n,testId:r}){S();let o=Ud(()=>Bd(e),[e]);return Ka($e,{marker:"none",ordered:!0,gap:n,testId:r,children:o.map(({path:a,label:l,item:u})=>Ka(we,{testId:`${r}-item-${a}`,children:t(u,l,a)},a))})}import{Fragment as Wr,jsx as Ve,jsxs as Ft}from"react/jsx-runtime";var Va={add:"\u8FFD\u52A0",remove:"\u524A\u9664",replace:"\u7F6E\u63DB"},$n={op:"\u64CD\u4F5C",path:"\u9053",before:"\u5909\u66F4\u524D",after:"\u5909\u66F4\u5F8C"},Yd=Hd(Object.values(Bn)),Qd=Kd({header:$n.op},[{kind:"text",texts:Object.values(Va),face:"sans",type:"body"}]);function zd(e,t,n){let r=o=>Object.fromEntries(t.map(a=>[a.field,l=>Ve("span",{"data-testid":`${n}-${a.field}-${o}-${l}`,children:zt(a[o])})]));return Ve(Vn,{caption:`${e}\u306E\u5909\u5316`,attributes:t.map(o=>({key:o.field,label:hn(o.field)})),columns:[{key:"before",heading:"\u5909\u66F4\u524D",cells:r("before")},{key:"after",heading:"\u5909\u66F4\u5F8C",cells:r("after")}],attributePx:Yd,columnMinPx:lr,testId:n})}function vn(e,t,n){return t.length===0?null:Ft(x,{gap:"space-2",testId:n,children:[Ft(s,{as:"p",fg:"fg",type:"body",children:[e," (",t.length,")"]}),Ve($e,{marker:"bullet",type:"body",gap:"space-1",testId:`${n}-items`,children:t.map(([r,o])=>Ve(we,{testId:`${n}-item`,children:Ve(s,{fg:"fg",type:"body",children:o})},r))})]})}function ja(e){return Ve(s,{fg:"fg",type:"body",face:"mono",space:"preserve",children:JSON.stringify(e,null,2)})}function Qr(e,t,n){return t.length===0?null:Ft(x,{gap:"space-2",testId:n,children:[Ft(s,{as:"p",fg:"fg",type:"body",children:[e," (",t.length,")"]}),Ve(ir,{items:t,renderItem:(r,o)=>`${o}: ${r}`,gap:"space-1",testId:`${n}-tree`})]})}var zr=e=>JSON.stringify(e.value),Ja=e=>e.fields.map(t=>`${hn(t.field)} ${zt(t.before)} \u2192 ${zt(t.after)}`).join("\u3001"),Ga=e=>[e.key,`${e.key}: ${zr(e)}`],Wd=e=>[e.key,`${e.key}: ${Ja(e)}`];function Zd({diff:e,testId:t}){let n=qd(()=>({added:e.added.map(r=>({path:r.key,item:zr(r)})),removed:e.removed.map(r=>({path:r.key,item:zr(r)})),modified:e.modified.map(r=>({path:r.key,item:Ja(r)}))}),[e]);return Ft(Wr,{children:[Qr("\u8FFD\u52A0",n.added,`${t}-added`),Qr("\u524A\u9664",n.removed,`${t}-removed`),Qr("\u5909\u66F4",n.modified,`${t}-modified`)]})}function qa({states:e,comparison:t,readLines:n,rescueTarget:r,testId:o}){let{announce:a}=S(),l=Jd(),[u,i]=Xd(()=>new Set),p=Gd((f,C)=>i(I=>{if(I.has(f)===C)return I;let U=new Set(I);return C?U.add(f):U.delete(f),U}),[]),T=u.size>0;Vd(()=>{T&&a(Jr)},[T,a]);let E=t.facets.filter(f=>f.change==="CHANGED"),m=jd.filter(f=>!E.some(C=>C.facet===f)),c=f=>`${l}-${f}`,_=f=>{let C=`${o}-${f.facet}`;switch(f.facet){case"classification":case"metadata":return zd(Qt[f.facet],f.fields,`${C}-grid`);case"labels":return Ft(Wr,{children:[vn("\u8FFD\u52A0",f.added.map(Ga),`${C}-added`),vn("\u524A\u9664",f.removed.map(Ga),`${C}-removed`),vn("\u5909\u66F4",f.modified.map(Wd),`${C}-modified`)]});case"assets":return Ve(Zd,{diff:f,testId:C});case"tags":return Ft(Wr,{children:[vn("\u8FFD\u52A0",f.added.map(I=>[I,I]),`${C}-added`),vn("\u524A\u9664",f.removed.map(I=>[I,I]),`${C}-removed`)]});case"structured_data":return Ve(Re,{caption:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF\u306E\u64CD\u4F5C",captionHidden:!0,columns:[{key:"op",header:$n.op,width:{fixedPx:Qd},align:"start",cell:({operation:I})=>Va[I.op]},{key:"path",header:$n.path,width:{minPx:lr},align:"start",cell:({operation:I})=>I.path===""?"(\u6839)":I.path},{key:"before",header:$n.before,width:{minPx:lr},align:"start",cell:({operation:I})=>I.op==="add"?null:ja(I.previous)},{key:"after",header:$n.after,width:{minPx:lr},align:"start",cell:({operation:I})=>I.op==="remove"?null:ja(I.value)}],rows:f.operations.map((I,U)=>({operation:I,position:U})),rowKey:({position:I})=>`${I}`,rowTestId:`${C}-operation`,rowData:({operation:I})=>({"data-op":I.op}),rowSize:"row",empty:"\u64CD\u4F5C\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${C}-operations`});case"text":case"summary":return Ve(ar,{states:e,target:{facet:f.facet},index:f,readLines:n,label:Qt[f.facet],rescueTarget:r,onNarrowChange:p,testId:`${C}-diff`});case"chunks":return Ve(Ha,{states:e,stats:f.stats,entries:f.entries,textUnchangedChunkingChanged:f.textUnchangedChunkingChanged,readLines:n,rescueTarget:r,onNarrowChange:p,testId:`${C}-table`})}};return Ft(x,{gap:"space-6",testId:o,children:[E.length>0&&Ve("nav",{"aria-label":"\u5909\u308F\u3063\u305F\u9762","data-testid":`${o}-nav`,children:Ve($e,{marker:"none",ordered:!1,gap:"space-1",testId:`${o}-nav-list`,children:E.map(f=>Ve(we,{testId:`${o}-nav-item`,children:Ve(qn,{targetId:c(f.facet),dataAttributes:{"data-facet":f.facet},testId:`${o}-nav-${f.facet}`,children:Qt[f.facet]})},f.facet))})}),E.map(f=>Ve(Te,{level:4,id:c(f.facet),title:Qt[f.facet],testId:`${o}-${f.facet}`,dataAttributes:{"data-facet":f.facet},children:_(f)},f.facet)),m.length>0&&Ft(s,{as:"p",fg:"fg",type:"body",testId:`${o}-unchanged`,children:["\u5909\u5316\u306A\u3057: ",m.map(f=>Qt[f]).join("\u30FB")]})]})}import{isUnknownTerm as ec,RUN_TERMINAL_STEP_KEY as Xa,RunTerminalStepDetailSchema as tc,recordedStepOf as nc,storedTermText as rc}from"@aiquants/enrichment-core";import{useMemo as oc,useState as Ya}from"react";import{Fragment as dr,jsx as W,jsxs as Ye}from"react/jsx-runtime";var ac=8,sc={text_layer:"\u6587\u5B57\u5C64",ocr:"OCR",transcript:"\u8EE2\u5199"},ic={provider:"\u30D7\u30ED\u30D0\u30A4\u30C0",model:"\u30E2\u30C7\u30EB",engine:"\u30A8\u30F3\u30B8\u30F3",prompt_key:"\u30D7\u30ED\u30F3\u30D7\u30C8",prompt_version:"\u7248",duration_ms:"\u51E6\u7406\u6642\u9593",input_chars:"\u5165\u529B\u6587\u5B57\u6570",output_chars:"\u51FA\u529B\u6587\u5B57\u6570",chunk_count:"\u30C1\u30E3\u30F3\u30AF",points_upserted:"\u6295\u5165\u70B9\u6570",collection:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3",embedding_model:"\u57CB\u3081\u8FBC\u307F\u30E2\u30C7\u30EB",graph_nodes:"\u30B0\u30E9\u30D5\u30CE\u30FC\u30C9"},Qa={duration_ms:"ms",input_chars:void 0,output_chars:void 0,chunk_count:void 0,points_upserted:void 0,graph_nodes:void 0},lc=["provider","model","engine","prompt_key","prompt_version","duration_ms","input_chars","output_chars","chunk_count","points_upserted","collection","embedding_model","graph_nodes"],dc=["FAILED","RUNNING","CANCELLED","SUCCEEDED","SKIPPED"],cc="\u6728\u306E\u9053\u3092\u6301\u305F\u306A\u3044\u8A18\u9332 (\u79FB\u884C\u306E\u9014\u4E2D)";function uc(e){return Object.hasOwn(Qa,e)}function wn(e,t){return`run-step-provenance-value-${e}-${t}`}function pc(e,t,n){if(uc(t)){let o=e[t];return o===null?null:W($,{value:o,unit:Qa[t],testId:wn(n,t)})}let r=e[t];return r===null?null:W($,{text:String(r),keep:"wrap",testId:wn(n,t)})}function mc(e,t){let n=lc.map(a=>({key:a,label:ic[a],value:pc(e,a,t)})),r=e.pages_read!==null||e.pages_total!==null,o=Ye(dr,{children:[W($,{value:e.pages_read,testId:wn(t,"pages_read")})," / ",W($,{value:e.pages_total,testId:wn(t,"pages_total")})]});return[...n,{key:"pages",label:"\u8AAD\u3093\u3060\u30DA\u30FC\u30B8",value:r?o:null},{key:"body_source",label:"\u672C\u6587\u306E\u51FA\u6240",value:e.body_source===null?null:W($,{text:sc[e.body_source],keep:"wrap",testId:wn(t,"body_source")})}]}function fc(e,t){let n=new Map,r=[];for(let a of t){if(a.targetTreePath===null){r.push(a);continue}let l=n.get(a.targetTreePath);l===void 0?n.set(a.targetTreePath,[a]):l.push(a)}let o=Array.from(n,([a,l])=>({path:a,item:l}));return{kind:"fan_out",stepKey:e,steps:t,placed:o,pathless:r}}function gc(e){let t=[],n=new Map;for(let r of[...e.steps].sort((o,a)=>o.sequence-a.sequence)){let o=r.stepKey;if(o===Xa||ec(o)||nc(o).fanOut!=="children"||r.targetMetadataId===e.metadataId){t.push({kind:"step",step:r});continue}let a=n.get(o);if(a!==void 0){a.push(r);continue}let l=[r];n.set(o,l),t.push({kind:"fan_out",stepKey:o,steps:l})}return t.map(r=>r.kind==="step"?r:fc(r.stepKey,r.steps))}function yc(e){if(e.skipReason===null)throw new RangeError(`Step record #${e.id} is SKIPPED without a skip reason, which the pipeline record schema refuses.`);return e.skipReason}function za(e){let[t,n]=Ya({defaultOpen:e,open:e});return t.defaultOpen!==e&&n({defaultOpen:e,open:e}),[t.defaultOpen===e?t.open:e,o=>n({defaultOpen:e,open:o})]}function bc({sequence:e,detail:t}){let[n,r]=Ya(!1);return W(dt,{summary:"\u8A73\u7D30",open:n,onOpenChange:r,testId:`run-step-detail-${e}`,children:W(Sn,{label:"\u6BB5\u306E\u5831\u544A\u306E\u8A73\u7D30",code:JSON.stringify(t,null,2),testId:`run-step-detail-code-${e}`})})}function Ic({step:e}){let{labels:t}=S();if(e.status==="SKIPPED")return Ye(s,{as:"p",fg:"fg-secondary",type:"body",testId:`run-step-skip-reason-${e.sequence}`,children:["\u7701\u7565: ",Qn(yc(e))]});if(e.stepKey===Xa&&e.status==="SUCCEEDED"){let{outcome:l}=tc.parse(e.provenance?.detail);return W("div",{"data-testid":`run-step-terminal-outcome-${e.sequence}`,"data-outcome":l,children:W(s,{as:"p",fg:"fg",type:"body",children:ra[l]})})}if(e.provenance===null)return W(s,{as:"p",fg:"fg-muted",type:"body",testId:`run-step-provenance-missing-${e.sequence}`,children:"\u6BB5\u306E\u5831\u544A\u306F\u3042\u308A\u307E\u305B\u3093\u3002"});let n=e.provenance,r=mc(n,e.sequence),o=r.filter(l=>l.value!==null),a=r.filter(l=>l.value===null);return Ye(dr,{children:[o.length>0&&W(he,{items:o.map(l=>({key:l.key,term:l.label,description:l.value})),testId:`run-step-provenance-${e.sequence}`}),a.length>0&&W("div",{"data-testid":`run-step-unmeasured-${e.sequence}`,"data-unmeasured-note":!0,children:Ye(s,{as:"p",fg:"fg-muted",type:"caption",children:[t.unmeasured,": ",a.map(l=>l.label).join("\u3001")]})}),Object.keys(n.detail).length>0&&W(bc,{sequence:e.sequence,detail:n.detail})]})}function Zr({step:e,title:t,name:n,longestDuration:r,defaultOpen:o,frame:a}){let[l,u]=za(o),i=e.sequence,p=Ye(X,{as:"span",gap:"space-2",testId:`run-step-summary-${i}`,children:[t,e.strategyId!==null&&Ye(J,{tone:"info",variant:"tint",testId:`run-step-strategy-${i}`,children:["\u6226\u7565 #",e.strategyId]}),W(J,{tone:ta[e.status],variant:"tint",dataAttributes:{"data-status":e.status},testId:`run-step-status-${i}`,children:Cn[e.status].label}),W(s,{fg:"fg-secondary",type:"caption",testId:`run-step-duration-${i}`,children:W($,{value:e.durationMs,unit:"ms",testId:`run-step-duration-value-${i}`})})]}),T={"data-status":e.status,"data-step-key":rc(e.stepKey)},E=W(dt,{summary:p,open:l,onOpenChange:u,testId:`run-step-card-${i}`,children:Ye(x,{gap:"space-2",testId:`run-step-body-${i}`,children:[e.durationMs!==null&&r>0&&W(Rn,{label:`${n} \u306E\u6240\u8981 (\u6700\u3082\u9577\u3044\u6BB5\u306B\u5BFE\u3059\u308B\u5272\u5408)`,value:e.durationMs,min:0,max:r,valueText:`\u6700\u3082\u9577\u3044\u6BB5\u306E ${Math.round(e.durationMs/r*100)}%`,testId:`run-step-bar-${i}`}),e.errorMessage!==null&&Ye(s,{as:"p",fg:"danger-fg",type:"body",testId:`run-step-error-${i}`,children:[e.errorCode===null?"":`${e.errorCode}: `,e.errorMessage,e.httpStatus===null?"":` (HTTP ${e.httpStatus})`]}),W(Ic,{step:e})]})});return a==="item"?W(we,{testId:`run-step-${i}`,dataAttributes:T,children:E}):W("div",{"data-testid":`run-step-${i}`,...T,children:E})}var hc=`${cc}: \u6728\u306E\u4E2D\u306E\u5834\u6240\u3092\u793A\u305B\u306A\u3044\u305F\u3081\u3001\u6BB5\u306E\u8A18\u9332\u306E ID \u3068\u5BFE\u8C61\u306E ID (#<\u6BB5\u306E\u8A18\u9332> \u2192 #<\u5BFE\u8C61>) \u3067\u540D\u6307\u3057\u307E\u3059\u3002`;function Ec({steps:e,longestDuration:t,opensEverything:n,testId:r}){let o=lt(e);return Ye(dr,{children:[W(Ae,{occurrence:o,testId:r,children:W("span",{"data-testid":`${r}-reason`,children:hc})}),W($e,{marker:"none",ordered:!0,gap:"space-3",testId:`${r}-list`,children:e.map(a=>{let l=`#${a.id} \u2192 #${a.targetMetadataId}`,u=W(s,{fg:"fg",type:"body",testId:`run-step-target-${a.sequence}`,children:l});return W(Zr,{step:a,title:u,name:l,longestDuration:t,defaultOpen:a.status==="FAILED"||n,frame:"item"},a.id)})})]})}function Sc({entry:e,longestDuration:t,opensEverything:n}){let r=e.steps.some(T=>T.status==="FAILED"),[o,a]=za(r||e.pathless.length>0||n),l=e.stepKey,u=dc.map(T=>({status:T,count:e.steps.filter(E=>E.status===T).length})).filter(({count:T})=>T>0),i=`run-step-tree-${e.steps[0].sequence}`,p=Ye(X,{as:"span",gap:"space-2",testId:`run-step-group-summary-${l}`,children:[W(s,{fg:"fg",type:"body",children:Dt(l)}),Ye(J,{tone:"neutral",variant:"tint",testId:`run-step-group-count-${l}`,children:["\u5BFE\u8C61 ",W($,{value:e.steps.length,unit:"\u4EF6",testId:`run-step-group-count-value-${l}`})]}),W(s,{fg:"fg-secondary",type:"caption",testId:`run-step-group-statuses-${l}`,children:u.map(({status:T,count:E},m)=>Ye("span",{children:[m===0?"":" \xB7 ",Cn[T].label," ",W($,{value:E,testId:`run-step-group-statuses-${l}-${T}`})]},T))})]});return W(we,{testId:`run-step-group-${l}`,dataAttributes:{"data-count":e.steps.length},children:W(dt,{summary:p,open:o,onOpenChange:a,testId:`run-step-group-card-${l}`,children:Ye(x,{gap:"space-3",testId:`run-step-group-body-${l}`,children:[e.pathless.length>0&&W(Ec,{steps:e.pathless,longestDuration:t,opensEverything:n,testId:`run-step-group-pathless-${l}`}),e.placed.length>0&&W(ir,{items:e.placed,renderItem:(T,E,m)=>W(x,{gap:"space-3",testId:`${i}-records-${m}`,children:T.map(c=>{let _=`${E} (#${c.targetMetadataId})`,f=W(s,{fg:"fg",type:"body",testId:`run-step-target-${c.sequence}`,children:_});return W(Zr,{step:c,title:f,name:_,longestDuration:t,defaultOpen:c.status==="FAILED"||n,frame:"block"},c.id)})}),gap:"space-3",testId:i})]})})})}function Wa({run:e}){S();let t=e.steps.reduce((o,a)=>a.durationMs===null?o:Math.max(o,a.durationMs),0),n=e.steps.length<=ac,r=oc(()=>gc(e),[e]);return W($e,{marker:"none",ordered:!0,gap:"space-3",testId:"run-steps",children:r.map(o=>{if(o.kind==="fan_out")return W(Sc,{entry:o,longestDuration:t,opensEverything:n},`group-${o.stepKey}`);let a=o.step,l=Dt(a.stepKey),u=a.targetMetadataId!==e.metadataId,i=Ye(dr,{children:[W(s,{fg:"fg",type:"body",children:l}),u&&Ye(J,{tone:"neutral",variant:"tint",testId:`run-step-target-${a.sequence}`,children:["\u5BFE\u8C61 #",a.targetMetadataId]})]});return W(Zr,{step:a,title:i,name:u?`${l} (\u5BFE\u8C61 #${a.targetMetadataId})`:l,longestDuration:t,defaultOpen:a.status==="FAILED"||n,frame:"item"},a.id)})})}import{Fragment as ur,jsx as k,jsxs as Qe}from"react/jsx-runtime";function es({host:e,fromStateId:t,toStateId:n,rescueTarget:r}){let o={fromStateId:t,toStateId:n},a=xr(`${t}:${n}`,u=>e.compare(o,u),0),l=Me(r);return a.state.kind==="failed"?k(ot,{failure:a.state,onReload:a.reload,forbiddenMessage:jt,failureMessage:We("\u6BD4\u8F03"),rescueRef:l,testId:"history-comparison-failed"}):a.state.kind!=="ready"?k("div",{"aria-busy":"true","data-testid":"history-comparison-loading",children:k(s,{as:"p",fg:"fg",type:"body",children:"\u6BD4\u8F03\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"})}):k(qa,{states:o,comparison:a.state.value,readLines:e.readLines,rescueTarget:r,testId:"history-change"})}function eo(e,t,n){let r=Ra(e,t);return[e.runOutcome==="FAILED"?k(s,{fg:"fg",type:"body",testId:`${n}-failed-run`,children:Oo},"failed"):null,r.length>0?k(s,{fg:"fg",type:"body",testId:`${n}-unrecorded-runs`,children:Fo(r)},"unrecorded"):null,e.modelOnlyChange?k(s,{fg:"fg",type:"body",testId:`${n}-model-only`,children:Mo},"model"):null].filter(o=>o!==null)}function _c(e,t){return e.changes===null?[]:e.changes.map(n=>k(J,{tone:"neutral",variant:"tint",testId:`${t}-badge-${n.facet}`,children:Kn(n)},n.facet))}function xc({pinned:e,shown:t,onPin:n,onUnpin:r,fallback:o}){let a=Lt(null),l=Lt(null),u=Me(()=>l.current??a.current??o()),i=Tc(E=>(m=>{E.current=m;let c=u(m);return()=>{E.current=null,c()}}),[u]),[p]=Wt(()=>i(a)),[T]=Wt(()=>i(l));return e!==null?Qe(X,{gap:"space-2",testId:"history-pin",children:[Qe(s,{fg:"fg",type:"body",children:[k(J,{tone:"info",variant:"tint",testId:"history-pin-badge",children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})," ",rt(e.revision)," ",k(le,{iso:e.settledAt,testId:"history-pin-settled-at-value"})]}),k(V,{variant:"secondary",onClick:r,ref:T,testId:"history-unpin",children:"\u5916\u3059"})]}):t===null?null:k(X,{gap:"space-2",testId:"history-pin",children:k(V,{variant:"secondary",onClick:()=>n(t.stateId),ref:p,testId:"history-pin-button",children:"\u6BD4\u8F03\u306E\u8D77\u70B9\u306B\u3059\u308B"})})}function Cc({run:e}){let[t,n]=Wt(!1);return k(dt,{summary:"\u6BB5\u306E\u6642\u7CFB\u5217",open:t,onOpenChange:n,testId:"history-run-steps",children:k(Wa,{run:e})})}function ng({host:e,metadataId:t,target:n,openRequest:r,onClose:o,returnFocusFallback:a,captureState:l,canSendCommands:u}){let{labels:i,announce:p}=S(),T=Za(),E=Za(),m=Lt(null),c=Lt(null),_=Lt(null),f=Lt(null),C=Lt(null),I=Lt(null),U=Lt(a),w=Lt(0),[ne,N]=Wt(null),[B,R]=Wt(null),[M,K]=Wt({metadataId:t,groups:{}});M.metadataId!==t&&K({metadataId:t,groups:{}});let[ae,Ee]=Wt(null),v=xr(t,b=>e.loadHistory(t,b),r),q=Me(()=>c.current),H=Me(()=>c.current),O=v.state.kind==="ready"?v.state.refreshFailure:null,Y=lt(O),et=v.state.kind==="ready"&&v.state.refreshing,Ce=v.state.kind==="ready"?v.state.value:null,F=Ce===null?null:Sa(Ce),Se=F?.runs[0],ue=l!==void 0&&F!==null&&Se!==void 0&&!F.states.some(b=>b.runId===Se.id)?l:null,re=ne!==null&&ne.request===r?ne.key:F===null?null:Ta(n,F),Z=F?.groups.flatMap(b=>b.items).find(b=>b.key===re),be=Z===void 0||et?null:`revision:${Z.kind==="run"?Z.run.revision:Z.state.revision}`,ze=Me(()=>re===null?c.current:_.current);cr(()=>{U.current=a},[a]),cr(()=>{if(C.current!==r){C.current=r,I.current=null;let b=document.activeElement;m.current?.contains(b)!==!0&&(f.current=(b instanceof HTMLElement||b instanceof SVGElement)&&b!==document.body?b:null),c.current?.focus();return}re!==null&&re===I.current&&(I.current=null,_.current?.focus())},[r,re]),cr(()=>{be!==null&&K(b=>b.groups[be]===!0?b:{metadataId:b.metadataId,groups:{...b.groups,[be]:!0}})},[be,r]),cr(()=>()=>{C.current=null,w.current+=1;let b=f.current;if(b?.isConnected){b.focus();return}U.current()?.focus()},[]);let G=b=>{if(b===re){_.current?.focus();return}I.current=b,N({request:r,key:b})},ee=b=>{w.current+=1;let A=w.current,j=ae?.metadataId===t?ae.failure:null;Ee({metadataId:t,busy:!0,failure:j}),b(t).then(pe=>{if(w.current===A){if(pe.ok){Ee({metadataId:t,busy:!1,failure:null}),p(pe.value.outcome==="RECORDED"?"\u8A18\u9332\u3057\u307E\u3057\u305F":"\u524D\u306E\u8A18\u9332\u304B\u3089\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093"),v.refresh();return}Ee({metadataId:t,busy:!1,failure:{status:pe.status,reason:pe.reason,occurrence:(j?.occurrence??0)+1}})}})},Ie=()=>{if(v.state.kind==="failed")return k(ot,{failure:v.state,onReload:v.reload,forbiddenMessage:jt,failureMessage:We("\u6587\u66F8\u306E\u5C65\u6B74"),rescueRef:q,testId:"history-failed"});if(Ce===null||F===null)return k("div",{"aria-busy":"true","data-testid":"history-loading",children:k(s,{as:"p",fg:"fg",type:"body",children:"\u6587\u66F8\u306E\u5C65\u6B74\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"})});let b=F.states,A=ae?.metadataId===t?ae:null,j=b[0];return k("div",{ref:H,"data-testid":"history-content",children:Qe(x,{gap:"space-4",testId:"history-content-parts",children:[k(he,{items:[{key:"uri",term:"URI",description:Ce.document.fileUri},{key:"revision",term:"\u73FE\u5728\u306E\u7248",description:rt(Ce.document.revision)},{key:"confidentiality",term:"\u6A5F\u5BC6\u533A\u5206",description:Ce.document.confidentialityLevel},{key:"revisions",term:"\u7248\u306E\u6570",description:F.groups.length},{key:"last-change",term:"\u6700\u5F8C\u306E\u5909\u5316",description:j===void 0?"\u8A18\u9332\u306A\u3057":k(le,{iso:j.settledAt,testId:"history-document-last-change-value"})}],testId:"history-document"}),O!==null&&k(Ae,{occurrence:Y,testId:"history-refresh-failed",children:jn(i,O,"\u6587\u66F8\u306E\u5C65\u6B74")}),ue!==null&&k(X,{gap:"space-2",testId:"history-capture",children:k(V,{variant:"primary",busy:u&&A?.busy===!0,busyLabel:i.loading,unavailable:u?void 0:{reasonId:T},onClick:()=>ee(ue),ref:ze,testId:"history-capture-button",children:"\u4ECA\u306E\u72B6\u614B\u3092\u8A18\u9332"})}),A!==null&&A.failure!==null&&k(Ae,{occurrence:A.failure.occurrence,testId:"history-capture-failed",children:i.failureSentence(A.failure,_r,pe=>`\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F${Rc(pe)}\u3002`)}),b.length===0&&F.runs.length===0&&F.marks.length===0?k("div",{role:"status","data-testid":"history-empty",children:k(s,{as:"p",fg:"fg",type:"body",children:"\u3053\u306E\u6587\u66F8\u306B\u306F\u307E\u3060\u8A18\u9332\u304C\u3042\u308A\u307E\u305B\u3093\u3002"})}):k(Gn,{master:Ke(F),detail:Ht(F),masterMinPx:Na,detailMinPx:va,testId:"history-master-detail"})]})})},g=M.groups,se=(b,A)=>g[b]??A,D=(b,A)=>K({metadataId:t,groups:{...g,[b]:!se(b,A)}}),ie=B!==null&&B.request===r?B.stateId:null,Ke=b=>Qe(x,{gap:"space-4",testId:"history-timeline",children:[b.marks.length>0&&Qe(x,{gap:"space-2",testId:"history-restricted-group",children:[k(X,{gap:"space-2",testId:"history-restricted-actions",children:Qe(V,{variant:"secondary",expanded:se("restricted",!1),controls:`${E}-restricted`,onClick:()=>D("restricted",!1),testId:"history-restricted-toggle",children:["\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332 (",b.marks.length," \u4EF6)"]})}),k($e,{marker:"bullet",type:"body",gap:"space-1",label:"\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332",id:`${E}-restricted`,hidden:!se("restricted",!1),testId:"history-restricted-list",children:b.marks.map(({key:A,mark:j})=>k(we,{testId:"history-restricted-mark",dataAttributes:{"data-restricted-mark":j.subject},children:j.subject==="state"?Qe(s,{fg:"fg",type:"body",children:[Do," ",k(le,{iso:j.settledAt,testId:`history-${A}-settled-at-value`})]}):Qe(s,{fg:"fg",type:"body",children:[Hn," ",k(J,{tone:wt[j.status],variant:"tint",testId:`history-${A}-status`,children:$t[j.status].label})," ",k(le,{iso:j.startedAt,testId:`history-${A}-started-at-value`})," \u301C ",k(Vt,{iso:j.finishedAt,testId:`history-${A}-finished-at-value`})]})},A))})]}),b.groups.map(A=>{let j=`revision:${A.revision}`,pe=se(j,A.isCurrent),te=`${rt(A.revision)}${A.isCurrent?" (\u73FE\u5728\u306E\u7248)":""}`;return k("div",{"data-testid":"history-revision-group","data-revision":A.revision,"data-current":A.isCurrent,children:Qe(x,{gap:"space-2",testId:`history-revision-parts-${A.revision}`,children:[k(X,{gap:"space-2",testId:`history-revision-actions-${A.revision}`,children:k(V,{variant:"secondary",expanded:pe,controls:`${E}-${j}`,onClick:()=>D(j,A.isCurrent),testId:`history-revision-toggle-${A.revision}`,children:`${te} \u2014 ${A.items.length} \u4EF6`})}),k("div",{id:`${E}-${j}`,hidden:!pe,children:k(ln,{label:te,items:A.items,itemKey:me=>me.key,selectedKey:re,onSelect:me=>G(me.key),detailId:E,renderRow:me=>tt(me,b),rowTestId:"history-item",rowData:me=>({"data-item-key":me.key,"data-pinned":me.state!==null&&me.state.stateId===ie}),empty:"\u3053\u306E\u7248\u306E\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`history-revision-list-${A.revision}`})})]})},j)})]}),tt=(b,A)=>{let j=b.state,pe=`history-row-${b.key}`,te=j===null?[]:eo(j,A,pe);return Qe(ur,{children:[b.kind==="run"?Qe(s,{fg:"fg",type:"body",children:["\u5B9F\u884C #",b.run.id," \xB7 ",kr[b.run.trigger]," \xB7 ",k("span",{"data-testid":`${pe}-flow`,children:mn(b.run)})," ",k(J,{tone:wt[At(b.run)],variant:"tint",testId:`${pe}-status`,children:$t[At(b.run)].label})]}):k(s,{fg:"fg",type:"body",children:an[b.state.cause]}),k(le,{iso:b.time,testId:`${pe}-time-value`}),j!==null&&_c(j,pe),b.kind==="run"&&Mr(b.run)&&k(s,{fg:"fg",type:"body",testId:`${pe}-unrecorded`,children:Tr}),te,j!==null&&j.stateId===ie&&k(J,{tone:"info",variant:"tint",testId:`${pe}-pinned`,children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})]})},mt=(b,A)=>{let j=A.states.find(Rt=>Rt.stateId===ie)??null,pe=k(xc,{pinned:j,shown:b,onPin:Rt=>R({request:r,stateId:Rt}),onUnpin:()=>R(null),fallback:()=>_.current});if(b===null)return pe;let te=()=>_.current,me;if(j!==null&&j.stateId!==b.stateId){let[Rt,Yt]=A.states.indexOf(j)>A.states.indexOf(b)?[j,b]:[b,j];me=k(es,{host:e,fromStateId:Rt.stateId,toStateId:Yt.stateId,rescueTarget:te})}else b.previousStateId===null?me=k(s,{as:"p",fg:"fg",type:"body",testId:"history-no-previous",children:Ao}):me=k(es,{host:e,fromStateId:b.previousStateId,toStateId:b.stateId,rescueTarget:te});return Qe(ur,{children:[pe,me]})},Pe=b=>{if(Z===void 0)return"\u8A18\u9332\u306E\u8A73\u7D30";let A=Z.state,j=b.states.find(pe=>pe.stateId===ie);if(j!==void 0&&A!==null&&j.stateId!==A.stateId){let[pe,te]=b.states.indexOf(j)>b.states.indexOf(A)?[j,A]:[A,j];return`\u6BD4\u8F03: ${rt(pe.revision)} \u2192 ${rt(te.revision)}`}return Z.kind==="run"?`${rt(Z.run.revision)} \u306E\u5B9F\u884C #${Z.run.id}`:`${rt(Z.state.revision)} \u306E\u5909\u5316`},it=b=>{if(re===null)return b.groups.some(te=>te.items.length>0)?k(s,{as:"p",fg:"fg",type:"body",testId:"history-select-prompt",children:"\u6642\u7CFB\u5217\u304B\u3089\u8A18\u9332\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u5909\u5316\u3092\u793A\u3057\u307E\u3059\u3002"}):k("div",{role:"status","data-testid":"history-no-selectable",children:k(s,{as:"p",fg:"fg",type:"body",children:"\u9078\u3079\u308B\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002"})});if(Z===void 0&&et)return k("div",{"aria-busy":"true","data-testid":"history-detail-loading",children:k(s,{as:"p",fg:"fg",type:"body",children:"\u6587\u66F8\u306E\u5C65\u6B74\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"})});if(Z===void 0)return k("div",{role:"status","data-testid":"history-selection-missing",children:Qe(s,{as:"p",fg:"fg",type:"body",children:[re.startsWith("run:")?`\u5B9F\u884C #${re.slice(4)} \u306F`:"\u9078\u3093\u3060\u72B6\u614B\u306F","\u3053\u306E\u6587\u66F8\u306E\u5C65\u6B74\u306B\u3042\u308A\u307E\u305B\u3093\u3002"]})});if(Z.kind==="state"){let{state:te}=Z;return Qe(ur,{children:[k(he,{items:[{key:"cause",term:"\u5951\u6A5F",description:an[te.cause]},{key:"settled-at",term:"\u6642\u523B",description:k(le,{iso:te.settledAt,testId:"history-state-settled-at-value"})},{key:"actor",term:"\u64CD\u4F5C\u8005",description:te.actor},{key:"confidentiality",term:"\u6A5F\u5BC6\u533A\u5206",description:te.classification.confidentialityLevel}],testId:"history-state-summary"}),eo(te,b,"history-detail"),mt(te,b)]})}let{run:A,state:j}=Z,pe=At(A);return Qe(ur,{children:[k(he,{items:[{key:"trigger",term:"\u304D\u3063\u304B\u3051",description:kr[A.trigger]},{key:"attempt",term:"\u8A66\u884C",description:A.attempt},{key:"status",term:"\u72B6\u614B",description:k(J,{tone:wt[pe],variant:"tint",testId:"history-run-status",dataAttributes:{"data-status":A.status,"data-presentation":pe},children:$t[pe].label})},{key:"kind",term:"\u7A2E\u985E",description:na(A.documentKind)},{key:"requested-by",term:"\u8981\u6C42\u8005",description:A.requestedBy},{key:"started-at",term:"\u958B\u59CB",description:k(le,{iso:A.startedAt,testId:"history-run-started-at-value"})},{key:"finished-at",term:"\u7D42\u4E86",description:k(Vt,{iso:A.finishedAt,testId:"history-run-finished-at-value"})},{key:"job-id",term:"\u30B8\u30E7\u30D6",description:A.jobId}],testId:"history-run-summary"}),A.errorMessage!==null&&k(s,{as:"p",fg:"fg",type:"body",testId:"history-run-error",children:A.errorMessage}),Mr(A)&&k(s,{as:"p",fg:"fg",type:"body",testId:"history-run-unrecorded",children:Tr}),j===null?k(s,{as:"p",fg:"fg",type:"body",testId:"history-run-no-state",children:"\u3053\u306E\u5B9F\u884C\u304C\u4F5C\u3063\u305F\u72B6\u614B\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):eo(j,b,"history-detail"),mt(j,b),k(Cc,{run:A},A.id)]})},Ht=b=>k(Te,{id:E,title:Pe(b),headingRef:_,testId:"history-detail",dataAttributes:{"data-selected-key":re??""},children:it(b)});return k(fe,{title:Ce===null?"\u6587\u66F8\u306E\u5C65\u6B74":`\u6587\u66F8\u306E\u5C65\u6B74 \u2014 ${Ce.document.fileName}`,description:!u&&ue!==null?k(s,{fg:"fg-muted",type:"body",id:T,testId:"history-forbidden-note",children:_r}):void 0,actions:k(V,{variant:"secondary",onClick:o,testId:"history-close",children:i.close}),onEscape:o,headingRef:c,ref:m,testId:"history-inspector",dataAttributes:{"data-metadata-id":t},children:Ie()})}import{FLEXIBLE_COLUMN_MIN_PX as to,fixedColumnPx as On}from"@aiquants/console-ui/core";import{COPY_REASON_LABELS as Pc,ConfidentialityLevelSchema as oo,EnrichmentSyncStatusSchema as Lc,identifierMatches as rs,isPromotable as Nc,PIPELINE_FAILURE_STATUSES as vc,PROTECTION_SCHEME_LABELS as $c,pastedIdentifier as wc,QUARANTINED_CONFIDENTIALITY_LEVEL as ao,sourceOfUri as os,UNLOCK_DISPOSITION_LABELS as Dc}from"@aiquants/enrichment-core";import{useEffect as Ac,useId as as,useLayoutEffect as Oc,useMemo as ss,useRef as no,useState as ut}from"react";var ns=1024,kc=[{name:"B",power:0,fractionDigits:0},{name:"KiB",power:1,fractionDigits:1},{name:"MiB",power:2,fractionDigits:1},{name:"GiB",power:3,fractionDigits:2},{name:"TiB",power:4,fractionDigits:2}];function ts(e,t){return Number((e/ns**t.power).toFixed(t.fractionDigits))}function Dn(e,t,n){yt(e,t,n);let[r,...o]=kc,a=r,l=ts(e,a);for(let u of o){if(l<ns)break;a=u,l=ts(e,a)}return`${new Intl.NumberFormat(n,{minimumFractionDigits:a.fractionDigits,maximumFractionDigits:a.fractionDigits,useGrouping:!0}).format(l)} ${a.name}`}import{Fragment as so,jsx as h,jsxs as ce}from"react/jsx-runtime";var Mc=new Set(vc),Fc=e=>Mc.has(e),Uc=new Set(Lc.options),ms=e=>Uc.has(e),fr={superseded:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF",inFlight:"\u51E6\u7406\u4E2D",unknown:"\u4E0D\u660E\u306A\u72B6\u614B"},fs={retry:"\u518D\u8A66\u884C",resync:"\u518D\u540C\u671F"};function Bc(e){return e.isCurrent===!1?{kind:"blocked",reason:fr.superseded}:e.syncStatus==="SYNCED"?{kind:"resync"}:Fc(e.syncStatus)?{kind:"retry"}:ms(e.syncStatus)?{kind:"blocked",reason:fr.inFlight}:{kind:"blocked",reason:fr.unknown}}function is(e,t){return ms(e)?h(J,{tone:Zn(e),variant:"tint",testId:t,children:Wn[e]}):h(J,{tone:"neutral",variant:"tint",testId:t,children:e})}function ls(e,t,n){let r=e?.find(o=>o.confidentialityLevel===t&&o.capability===n);return r?r.isEnabled:null}var Hc={PUBLIC:"\u5168\u516C\u958B",INTERNAL:"\u793E\u5185\u5171\u6709",DEPARTMENT:"\u90E8\u9580\u9650\u5B9A",CONFIDENTIAL:"\u6A5F\u5BC6 - \u65E2\u5B9A",RESTRICTED:"\u691C\u7D22\u5B8C\u5168\u9664\u5916\u30FB\u4FDD\u8B77"},Kc=["\u5951\u7D04\u66F8","\u6C7A\u7B97\u77ED\u4FE1","\u6280\u8853\u4ED5\u69D8\u66F8","\u793E\u5185\u898F\u7A0B","\u8B70\u4E8B\u9332","\u4EBA\u4E8B\u65B9\u91DD"],ro="(\u5FC5\u9808)",jc="\u30E1\u30BF\u30C7\u30FC\u30BF\u8A73\u7D30\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 (\u9AD8\u5EA6\u306A\u8A2D\u5B9A)",ds="\u30EA\u30BD\u30FC\u30B9\u691C\u8A3C\u7D50\u679C",pr={reachable:"\u2713 \u30EA\u30BD\u30FC\u30B9\u78BA\u8A8D\u5B8C\u4E86 (\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD)",unreachable:"\u26A0 \u30EA\u30BD\u30FC\u30B9\u4E0D\u9054 (\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093)"},cs=`\u3010\u9694\u96E2\u6CE8\u610F\u3011 ${ao} \u306B\u8A2D\u5B9A\u3055\u308C\u305F\u6587\u66F8\u306F\u3001\u6CD5\u4EE4\u9075\u5B88\u30FB\u4FC2\u4E89\u4FDD\u5168\u306E\u305F\u3081\u691C\u7D22\u7D50\u679C\u306B\u4E00\u5207\u51FA\u73FE\u3057\u307E\u305B\u3093\u3002\u3053\u308C\u306F\u8A2D\u5B9A\u3067\u306F\u306A\u304F\u4FDD\u8A3C\u3067\u3042\u308A\u3001\u30DD\u30EA\u30B7\u30FC\u306E\u5024\u306B\u4F9D\u3089\u305A\u5E38\u306B\u6210\u7ACB\u3057\u307E\u3059\u3002`,Gc="\u7D22\u5F15\u305D\u306E\u3082\u306E\u3092\u884C\u3046\u304B\u3069\u3046\u304B\u306F\u5225\u306E\u8A2D\u5B9A\u3067\u3059 (\u4E0B\u306E\u6295\u5F71\u5148\u3092\u53C2\u7167)\u3002\u7D22\u5F15\u3055\u308C\u305F\u6587\u66F8\u3082\u691C\u7D22\u7D50\u679C\u306B\u306F\u73FE\u308C\u307E\u305B\u3093\u3002",Vc="\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u5C65\u6B74",st={id:"ID",file:"\u30D5\u30A1\u30A4\u30EB\u540D / URI",level:"\u6A5F\u5BC6\u533A\u5206",revision:"\u30EA\u30D3\u30B8\u30E7\u30F3",status:"\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9",lastRun:"\u6700\u7D42\u5B9F\u884C",createdAt:"\u767B\u9332\u65E5\u6642",action:"\u30A2\u30AF\u30B7\u30E7\u30F3"},gs="\u65E7\u7248";function ys(e){return`rev.${e}`}var Jc=On({header:st.id},[{kind:"text",texts:[String(9999999999)],face:"mono",type:"body"}]),qc=On({header:st.level},[{kind:"pill",labels:oo.options}]),Xc=On({header:st.revision},[{kind:"cluster",gap:"space-1",items:[{kind:"text",texts:[ys(99999)],face:"mono",type:"body"},{kind:"pill",labels:[gs]}]}]),Yc=On({header:st.action},[{kind:"button",labels:Object.values(fs)},{kind:"text",texts:Object.values(fr),face:"sans",type:"body"}]);function mr({subject:e,verb:t,testId:n}){return ce(so,{children:[h(Nt,{testId:n,children:e}),t]})}var io="\u9001\u4FE1\u306E\u7B54\u3048\u3092\u5F85\u3063\u3066\u3044\u307E\u3059\u3002",bs="\u53D6\u308A\u8FBC\u3081\u308B\u6E90\u304C\u914D\u5099\u306B\u3042\u308A\u307E\u305B\u3093\u3002",Qc=`${io}\u7B54\u3048\u304C\u5C4A\u304F\u307E\u3067\u884C\u306E\u64CD\u4F5C\u306F\u62BC\u305B\u307E\u305B\u3093\u3002`,zc="\u6587\u66F8\u3092\u53D6\u308A\u8FBC\u3080\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",us={invalidUri:"URI \u3092\u6B63\u3057\u304F\u5165\u529B\u3059\u308B\u3068\u691C\u8A3C\u3067\u304D\u307E\u3059\u3002",busy:io},An={noSource:bs,invalidUri:"\u30D5\u30A1\u30A4\u30EB URI \u3092\u6B63\u3057\u304F\u5165\u529B\u3059\u308B\u3068\u53D6\u308A\u8FBC\u3081\u307E\u3059\u3002",noDomain:"\u30C9\u30E1\u30A4\u30F3\u304C\u7121\u3044\u305F\u3081\u53D6\u308A\u8FBC\u3081\u307E\u305B\u3093\u3002",inspecting:"URI \u306E\u4E8B\u524D\u691C\u8A3C\u306E\u7B54\u3048\u3092\u5F85\u3063\u3066\u3044\u307E\u3059\u3002",busy:io};function Wc(e){return/[A-Za-z0-9]$/.test(e)?`${e} `:e}function ps(e,t){return e===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":e?"\u6709\u52B9":`\u7121\u52B9 (${t} \u306E\u8A2D\u5B9A)`}function bg({policies:e,tenantId:t,sources:n,domainOptions:r,recentItems:o=[],inspectionResult:a=null,isSubmitting:l=!1,isInspecting:u=!1,isBusy:i=!1,canSendCommands:p,promotingId:T=null,onInspectUri:E,onIngestDocument:m,onRetryItem:c,onShowHistory:_,onPromoteUnlockedCopy:f,listRefusal:C,onShowAllObjects:I}){let{formatLocale:U,timeZone:w}=S(),ne=kt(),N=no(new Map),B=no(null),R=as(),M=as(),K=no(null),[ae,Ee]=ut(null),[v,q]=ut(""),[H,O]=ut(""),[Y,et]=ut("CONFIDENTIAL"),[Ce,F]=ut(null),[Se,ue]=ut(""),[re,Z]=ut(""),[be,ze]=ut([]),[G,ee]=ut(""),[Ie,g]=ut("user"),[se,D]=ut(1),[ie,Ke]=ut(!1),tt=Ce!==null&&r.some(d=>d.key===Ce)?Ce:r.length>0?r[0].key:null,mt=ae===null?void 0:n.find(d=>d.uri_prefix===ae),Pe=mt!==void 0?mt:n.length>0?n[0]:null,it=ss(()=>({vectorEnabled:ls(e,Y,"vector_indexing"),graphEnabled:ls(e,Y,"graph_indexing")}),[e,Y]),Ht=ss(()=>{let d=H.trim();if(!d||n.length===0)return{valid:!1,error:null};let P=os(n,d);if(P===void 0)return{valid:!1,error:`\u8A31\u53EF\u3055\u308C\u305F\u30B9\u30AD\u30FC\u30E0 (${n.map(nt=>nt.uri_prefix).join(", ")}) \u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002`};let z=d.slice(P.uri_prefix.length);return z.trim()?d.includes("..")?{valid:!1,error:"\u76F8\u5BFE\u30D1\u30B9\u8A18\u53F7 (..) \u306B\u3088\u308B\u30D1\u30B9\u30C8\u30E9\u30D0\u30FC\u30B5\u30EB\u306F\u7981\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002"}:rs(P,z)?{valid:!0,error:null}:{valid:!1,error:`${Wc(P.title.ja)}\u306E\u8B58\u5225\u5B50\u306E\u5F62\u3067\u306F\u3042\u308A\u307E\u305B\u3093 (\u4F8B: ${P.input_example})\u3002`}:{valid:!1,error:"URI \u306E\u30D1\u30B9\u90E8\u5206\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}},[H,n]),b=Pe!==null&&a!==null&&a.fileUri===H.trim()?a:null;Ac(()=>{b!==null&&ne(`${ds}: ${b.exists?pr.reachable:pr.unreachable}`)},[b,ne]);let A=Ht.valid?i?us.busy:null:us.invalidUri,j=n.length===0?An.noSource:Ht.valid?tt===null?An.noDomain:u?An.inspecting:i?An.busy:null:An.invalidUri,pe=d=>{Ee(d),v.trim()?O(`${d}${v.trim()}`):O("")},te=(d,P)=>{let z=d.trim();if(!z){q(""),O("");return}let nt=os(n,z);if(nt!==void 0){Ee(nt.uri_prefix),q(z.slice(nt.uri_prefix.length)),O(z);return}if(rs(P,z)){q(d),O(`${P.uri_prefix}${z}`);return}let Kt=wc(n,z);if(Kt!==void 0){Ee(Kt.source.uri_prefix),q(Kt.identifier),O(`${Kt.source.uri_prefix}${Kt.identifier}`);return}if(z.includes("://")){q(d),O(z);return}q(d),O(`${P.uri_prefix}${z}`)},me=()=>{let d=G.trim();d&&(be.some(P=>P.labelKey===d)||(ze(P=>[...P,{labelKey:d,category:Ie,confidenceScore:Number(se.toFixed(2))}]),ee("")))},Rt=d=>{be.some(P=>P.labelKey===d)||ze(P=>[...P,{labelKey:d,category:"domain",confidenceScore:1}])},Yt=d=>{ze(P=>P.filter(z=>z.labelKey!==d))},Sr=d=>{if(d.preventDefault(),!p||!Ht.valid||tt===null)return;let P={fileUri:H.trim(),confidentialityLevel:Y,targetDomainKey:tt,departmentId:Se.trim()?Number(Se):null,titleOverride:re.trim()?re.trim():null,labels:be};m?.(P)};Oc(()=>{let d=B.current;if(d===null)return;let P=o.find(z=>z.kind==="readable"&&z.item.id===d)?.item;P?.unlock?.disposition==="copy_promoted"&&(B.current=null,document.activeElement===document.body&&N.current.get(d)?.focus(),ne(`${P.fileName} \u306E\u6E90\u3092\u89E3\u3044\u305F\u5199\u3057\u3067\u4E0A\u66F8\u304D\u3057\u307E\u3057\u305F\u3002`))},[o,ne]);let y=d=>{let P=d.unlock;if(P===null)return null;let z=P.disposition==="copy_original"&&P.copyReason!==null&&Nc(P.copyReason)&&d.isCurrent!==!1,nt=T===d.id,Kt=p&&nt?"\u6E90\u3092\u5199\u3057\u3067\u4E0A\u66F8\u304D\u4E2D...":"\u6E90\u3092\u5199\u3057\u3067\u4E0A\u66F8\u304D";return h("div",{ref:Lo=>{Lo===null?N.current.delete(d.id):N.current.set(d.id,Lo)},tabIndex:-1,"data-testid":`ingest-unlock-${d.id}`,"data-disposition":P.disposition,"data-protection":P.protectionScheme,children:ce(x,{gap:"space-1",testId:`ingest-unlock-lines-${d.id}`,children:[ce(s,{fg:"fg-secondary",type:"caption",children:["\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5916\u3057\u305F: ",$c[P.protectionScheme]]}),ce(s,{fg:"fg-secondary",type:"caption",testId:`ingest-unlock-disposition-${d.id}`,children:[Dc[P.disposition],P.copyReason!==null&&` (${Pc[P.copyReason]})`]}),z&&f!==void 0&&h(X,{gap:"space-2",testId:`ingest-promote-actions-${d.id}`,children:h(V,{variant:"secondary",busy:p&&i&&nt,busyLabel:h(mr,{subject:`${d.fileName} \u306E`,verb:Kt,testId:`ingest-promote-button-${d.id}-subject`}),unavailable:p?i&&!nt?{reasonId:R}:void 0:{reasonId:M},onClick:()=>{B.current=d.id,f(d.id)},testId:`ingest-promote-button-${d.id}`,children:h(mr,{subject:`${d.fileName} \u306E`,verb:Kt,testId:`ingest-promote-button-${d.id}-subject`})})})]})})},je=d=>{let P=Bc(d);if(P.kind==="blocked")return h("span",{"data-testid":`ingest-action-blocked-${d.id}`,"data-reason":P.reason,children:h(s,{fg:"fg-muted",type:"body",children:P.reason})});let z=h(mr,{subject:`${d.fileName} \u3092`,verb:fs[P.kind],testId:`ingest-${P.kind}-button-${d.id}-subject`});return h(V,{variant:"secondary",unavailable:p?i?{reasonId:R}:void 0:{reasonId:M},onClick:()=>c?.(d.id),testId:`ingest-${P.kind}-button-${d.id}`,children:z})},ve=d=>{let P=d.lastRun;if(P===null)return h(s,{fg:"fg-muted",type:"body",testId:`ingest-last-run-none-${d.id}`,children:"\u8A18\u9332\u306A\u3057"});if(P.kind==="restricted")return h("div",{"data-testid":`ingest-last-run-restricted-${d.id}`,"data-restricted-mark":"run",children:ce(x,{gap:"space-1",testId:`ingest-last-run-restricted-lines-${d.id}`,children:[h(s,{fg:"fg-secondary",type:"caption",children:Hn}),h(s,{fg:"fg",type:"body",children:h(J,{tone:wt[P.status],variant:"tint",dataAttributes:{"data-status":P.status},testId:`ingest-last-run-status-${d.id}`,children:$t[P.status].label})}),h(s,{fg:"fg-muted",type:"caption",testId:`ingest-last-run-finished-at-${d.id}`,children:h(Vt,{iso:P.finishedAt,testId:`ingest-last-run-finished-at-value-${d.id}`})})]})});let z=P.item,nt=At(z);return ce(x,{gap:"space-1",testId:`ingest-last-run-lines-${d.id}`,children:[h(s,{fg:"fg",type:"body",children:h(J,{tone:wt[nt],variant:"tint",dataAttributes:{"data-status":z.status,"data-presentation":nt},testId:`ingest-last-run-status-${d.id}`,children:$t[nt].label})}),z.failedStepKey!==null&&h(s,{fg:"danger-fg",type:"caption",testId:`ingest-last-run-failed-step-${d.id}`,children:Dt(z.failedStepKey)}),z.failedStepKey==="unlock_document"&&h(s,{fg:"fg-secondary",type:"caption",testId:`ingest-unlock-hint-${d.id}`,children:"\u3069\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u3082\u958B\u3051\u306A\u304B\u3063\u305F\u3068\u304D\u306F\u3001\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306B\u5F53\u305F\u308B\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8DB3\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u3069\u306E\u90E8\u54C1\u3082\u5916\u305B\u306A\u3044\u5B88\u308A (\u8A3C\u660E\u66F8\u30FB\u6A29\u5229\u306E\u7BA1\u7406\u30FBPKWARE \u306E\u5F37\u3044\u6697\u53F7) \u306F\u3001\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u3063\u305F\u6240\u3067\u5916\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}),h(s,{fg:"fg-muted",type:"caption",testId:`ingest-last-run-finished-at-${d.id}`,children:h(Vt,{iso:z.finishedAt,testId:`ingest-last-run-finished-at-value-${d.id}`})})]})},ft=o.map((d,P)=>({entry:d,position:P}));return ce(x,{gap:"space-6",testId:"document-ingest-console",children:[h(fe,{title:"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u53D6\u308A\u8FBC\u307F & \u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210",description:ce(x,{gap:"space-2",testId:"ingest-form-card-notes",children:[h(s,{as:"p",fg:"fg-muted",type:"body",children:"\u5BFE\u8C61 URI \u3092\u6307\u5B9A\u3057\u3066\u672C\u6587\u62BD\u51FA\u30FBAI \u8981\u7D04\u30FB\u69CB\u9020\u5316\u30E1\u30BF\u30C7\u30FC\u30BF\u4ED8\u4E0E\u30FBQdrant \u30D9\u30AF\u30C8\u30EB\u304A\u3088\u3073 Neo4j \u30B0\u30E9\u30D5\u3078\u306E\u6295\u5F71\u3092\u5B9F\u884C\u3057\u307E\u3059\u3002"}),ce(X,{gap:"space-1",testId:"ingest-tenant",children:[h(s,{fg:"fg-secondary",type:"body",children:"\u30C6\u30CA\u30F3\u30C8:"}),h(s,{face:"mono",fg:"fg",type:"body",children:t})]}),!p&&h(s,{as:"p",fg:"fg-muted",type:"body",id:M,testId:"ingest-forbidden-note",children:zc})]}),testId:"ingest-form-card",children:h("form",{onSubmit:Sr,children:ce(x,{gap:"space-6",testId:"ingest-form-fields",children:[ce(x,{gap:"space-3",testId:"document-uri-input-group",children:[Pe!==null&&ce(s,{face:"mono",fg:"fg-muted",type:"body",children:["\u9078\u629E\u30B9\u30AD\u30FC\u30E0:"," ",h(s,{face:"mono",fg:"info-fg",type:"body",children:Pe.uri_prefix})]}),Pe===null&&h(Oe,{tone:"warning",testId:"ingest-no-sources",children:bs}),n.length>=2&&Pe!==null&&h(Ct,{label:"\u30B9\u30AD\u30FC\u30E0\u6307\u5B9A",options:n.map(d=>({value:d.scheme,label:`${d.scheme}:// (${d.title.ja})`})),value:Pe.scheme,onValueChange:d=>pe(n.find(P=>P.scheme===d).uri_prefix),testId:"scheme-select"}),n.length===1&&Pe!==null&&ce(s,{as:"p",fg:"fg-secondary",type:"body",testId:"scheme-single",children:["\u30B9\u30AD\u30FC\u30E0: ",`${Pe.scheme}:// (${Pe.title.ja})`]}),Pe!==null&&ce(x,{gap:"space-2",testId:"ingest-uri-field",children:[h(Ze,{label:`\u30D5\u30A1\u30A4\u30EB URI / \u30EA\u30BD\u30FC\u30B9\u8B58\u5225\u5B50 ${ro}`,type:"text",prefix:Pe.uri_prefix,value:v,onValueChange:d=>te(d,Pe),required:!0,description:Pe.guidance.ja,error:Ht.error??void 0,testId:"ingest-file-uri-input"}),h(X,{gap:"space-2",testId:"ingest-inspect-actions",children:h(V,{variant:"secondary",busy:p&&u,busyLabel:"\u691C\u8A3C\u4E2D...",unavailable:p?u||A===null?void 0:{reason:A}:{reasonId:M},onClick:()=>E?.(H.trim()),testId:"ingest-inspect-uri-button",children:"URI \u4E8B\u524D\u691C\u8A3C"})}),H&&ce(X,{gap:"space-1",testId:"ingest-resolved-uri",children:[h(s,{fg:"fg-muted",type:"body",children:"\u89E3\u6C7A URI:"}),h(s,{face:"mono",fg:"fg",type:"body",testId:"resolved-uri-code",children:H})]})]})]}),b!==null&&ce(Te,{region:!0,title:ds,testId:"inspection-result-card",children:[h(s,{fg:b.exists?"success-fg":"danger-fg",type:"body",testId:"inspection-result-status",children:b.exists?pr.reachable:pr.unreachable}),h(s,{face:"mono",fg:"fg-muted",type:"caption",testId:"inspection-result-uri",children:b.fileUri}),b.exists&&h(he,{items:[{key:"name",term:"\u30D5\u30A1\u30A4\u30EB\u540D",description:b.fileName},{key:"size",term:"\u30B5\u30A4\u30BA",description:h($,{text:Dn(b.fileSize,"fileSize",U),keep:"whole",testId:"inspection-file-size-value"})},{key:"mime",term:"MIME",description:b.mimeType},{key:"revision",term:"\u30EA\u30D3\u30B8\u30E7\u30F3",description:b.revisionId?.slice(0,8)??"N/A"}],testId:"inspection-result-attributes"})]}),ce(x,{gap:"space-4",testId:"ingest-classification-fields",children:[h(gt,{label:`\u6A5F\u5BC6\u533A\u5206 (Confidentiality Level) ${ro}`,value:Y,options:oo.options.map(d=>({value:d,label:`${d} (${Hc[d]})`})),onValueChange:d=>{let P=oo.parse(d);et(P),P===ao&&ne(cs)},testId:"ingest-confidentiality-select"}),tt===null?h(Oe,{tone:"warning",testId:"ingest-domain-empty",children:"\u9078\u3079\u308B\u30C9\u30E1\u30A4\u30F3\u304C\u6E21\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u30C9\u30E1\u30A4\u30F3\u304C\u7121\u3044\u3068\u53D6\u308A\u8FBC\u307F\u306F\u6295\u5165\u3067\u304D\u307E\u305B\u3093\u3002"}):h(gt,{label:`\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ${ro}`,value:tt,options:r.map(d=>({value:d.key,label:d.label})),onValueChange:F,testId:"ingest-domain-select"})]}),Y===ao&&ce(Oe,{tone:"warning",testId:"restricted-warning-banner",children:[cs," ",Gc]}),ce(Te,{title:"\u3053\u306E\u6A5F\u5BC6\u533A\u5206\u306B\u5BFE\u3059\u308B\u6295\u5F71\u306E\u53EF\u5426 (Projection)",testId:"projection-capability-card",children:[h(he,{items:[{key:"vector",term:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15 (Qdrant)",description:h("span",{"data-testid":"projection-vector-state","data-state":it.vectorEnabled===null?"unknown":String(it.vectorEnabled),children:ps(it.vectorEnabled,Y)})},{key:"graph",term:"\u30B0\u30E9\u30D5\u7D22\u5F15 (Neo4j)",description:h("span",{"data-testid":"projection-graph-state","data-state":it.graphEnabled===null?"unknown":String(it.graphEnabled),children:ps(it.graphEnabled,Y)})}],testId:"projection-capability-states"}),h(s,{as:"p",fg:"fg-secondary",type:"caption",testId:"projection-destination-note",children:"\u6295\u5F71\u5148\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D\u30FB\u30B0\u30E9\u30D5\u30E9\u30D9\u30EB\u30FB\u30C1\u30E3\u30F3\u30AF\u5206\u5272\u65B9\u5F0F\u306F\u3001\u9078\u629E\u3057\u305F\u30C9\u30E1\u30A4\u30F3\u306B\u5BFE\u3059\u308B\u914D\u5099\u306E\u53D6\u308A\u8FBC\u307F\u6226\u7565 (tm_enrichment_strategy) \u304C\u6C7A\u3081\u307E\u3059\u3002\u3053\u306E\u753B\u9762\u3067\u306F\u63A8\u5B9A\u3057\u307E\u305B\u3093\u3002"})]}),ce(Te,{title:"\u4ED8\u52A0\u60C5\u5831 / \u30E9\u30D9\u30EB\u30BF\u30B0 (Labels & Tags)",subtitle:ce(so,{children:[h($,{value:be.length,unit:"\u4EF6",testId:"ingest-label-count"})," \u8A2D\u5B9A\u4E2D"]}),testId:"ingest-labels-section",children:[ce(X,{gap:"space-2",testId:"ingest-preset-tags",children:[h(s,{fg:"fg-secondary",type:"body",children:"\u30AF\u30A4\u30C3\u30AF\u5019\u88DC:"}),Kc.map(d=>ce(V,{variant:"secondary",onClick:()=>Rt(d),testId:`preset-tag-${d}`,children:["+ ",d]},d))]}),h("div",{onKeyDown:d=>{d.key==="Enter"&&d.target===K.current&&(d.preventDefault(),me())},children:ce(x,{gap:"space-4",testId:"ingest-label-fields",children:[h(Ze,{label:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC",type:"text",value:G,onValueChange:ee,description:"\u4F8B: \u91CD\u8981\u9867\u5BA2\u5951\u7D04\u30012026 \u5E74\u5EA6",ref:K,testId:"ingest-label-key-input"}),h(gt,{label:"\u7A2E\u5225",value:Ie,options:[{value:"user",label:"\u30E6\u30FC\u30B6\u30FC (user)"},{value:"domain",label:"\u30C9\u30E1\u30A4\u30F3 (domain)"},{value:"system",label:"\u30B7\u30B9\u30C6\u30E0 (system)"}],onValueChange:d=>g(d),testId:"ingest-label-category-select"}),h(vt,{label:"\u78BA\u4FE1\u5EA6 (0.00\u301C1.00 AI/\u81EA\u52D5\u5224\u5B9A\u306E\u4FE1\u983C\u5EA6\u30B9\u30B3\u30A2\u30020.80 \u4EE5\u4E0A\u3067\u81EA\u52D5\u9069\u7528\u63A8\u5968)",value:se,min:0,max:1,step:.05,valueText:d=>`${Math.round(d*100)}%`,onValueChange:D,testId:"ingest-label-confidence-slider"}),h(X,{gap:"space-2",testId:"ingest-add-label-actions",children:h(V,{variant:"secondary",onClick:me,testId:"ingest-add-label-button",children:"\u30BF\u30B0\u8FFD\u52A0"})})]})}),be.length>0&&h(X,{gap:"space-2",testId:"active-labels-container",children:be.map(d=>ce(X,{gap:"space-1",testId:`active-label-${d.labelKey}`,children:[ce(J,{tone:"info",variant:"tint",testId:`active-label-${d.labelKey}-pill`,children:[d.labelKey," (",d.category,")"]}),ce(V,{variant:"secondary",onClick:()=>Yt(d.labelKey),testId:`remove-label-${d.labelKey}`,children:[h(Nt,{testId:`remove-label-${d.labelKey}-subject`,children:`\u30E9\u30D9\u30EB ${d.labelKey} \u3092`}),"\u524A\u9664"]})]},d.labelKey))})]}),h(dt,{summary:jc,open:ie,onOpenChange:Ke,testId:"ingest-toggle-advanced",children:ie&&ce(x,{gap:"space-4",testId:"advanced-settings-panel",children:[h(Ze,{label:"\u6587\u66F8\u30BF\u30A4\u30C8\u30EB (\u4E0A\u66F8\u304D\u6307\u5B9A)",type:"text",value:re,onValueChange:Z,description:"\u6307\u5B9A\u3057\u306A\u3044\u5834\u5408\u306F\u30D5\u30A1\u30A4\u30EB\u540D\u307E\u305F\u306F AI \u62BD\u51FA\u30BF\u30A4\u30C8\u30EB\u304C\u4F7F\u7528\u3055\u308C\u307E\u3059",testId:"ingest-title-override-input"}),h(Ze,{label:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)",type:"text",inputMode:"numeric",value:Se,onValueChange:ue,description:"\u4F8B: 101",testId:"ingest-department-input"})]})}),h(X,{gap:"space-2",testId:"ingest-submit-actions",children:h(V,{variant:"primary",type:"submit",busy:p&&l,busyLabel:"\u53D6\u308A\u8FBC\u307F\u6295\u5165\u4E2D...",unavailable:p?l||j===null?void 0:{reason:j}:{reasonId:M},testId:"ingest-submit-button",children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210 & \u53D6\u308A\u8FBC\u307F\u5B9F\u884C"})})]})})}),h(fe,{title:"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u30AD\u30E5\u30FC & \u5B9F\u884C\u72B6\u614B",description:"\u76F4\u8FD1\u306B\u6295\u5165\u3055\u308C\u305F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u540C\u671F\u9032\u6357\u3068\u7D50\u679C",actions:I!==void 0&&C===void 0?h(Jn,{onNavigate:I,testId:"recent-items-all-objects",children:"\u5168\u3066\u306E\u51E6\u7406\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u898B\u308B"}):void 0,testId:"recent-items-card",children:C!==void 0?h(Oe,{tone:"warning",testId:"recent-items-refused",children:C}):ce(so,{children:[i&&p&&h(s,{as:"p",fg:"fg-muted",type:"body",id:R,testId:"recent-items-busy-note",children:Qc}),h(Re,{caption:Vc,captionHidden:!0,columns:[{key:"id",header:st.id,width:{fixedPx:Jc},align:"start",cell:({entry:d})=>d.kind==="restricted"?null:h(s,{face:"mono",fg:"fg",type:"body",children:d.item.id})},{key:"file",header:st.file,width:{minPx:to},align:"start",cell:({entry:d,position:P})=>d.kind==="restricted"?h(s,{fg:"fg-secondary",type:"body",testId:`recent-item-restricted-text-${P}`,children:Tt}):ce(x,{gap:"space-1",testId:`ingest-item-file-${d.item.id}`,children:[h(s,{fg:"fg",type:"body",children:d.item.fileName}),h(s,{face:"mono",fg:"fg-muted",type:"caption",children:d.item.fileUri})]})},{key:"level",header:st.level,width:{fixedPx:qc},align:"start",cell:({entry:d})=>d.kind==="restricted"?null:h(J,{tone:"neutral",variant:"tint",testId:`ingest-item-level-${d.item.id}`,children:d.item.confidentialityLevel})},{key:"revision",header:st.revision,width:{fixedPx:Xc},align:"start",cell:({entry:d})=>d.kind==="restricted"?null:ce(X,{gap:"space-1",testId:`ingest-item-revision-${d.item.id}`,children:[h(s,{face:"mono",fg:"fg-secondary",type:"body",children:ys(d.item.revision)}),d.item.isCurrent===!1&&h(J,{tone:"neutral",variant:"tint",testId:`ingest-item-superseded-${d.item.id}`,children:gs})]})},{key:"status",header:st.status,width:{minPx:to},align:"start",cell:({entry:d,position:P})=>{if(d.kind==="restricted")return h("div",{"data-testid":`recent-item-restricted-status-${P}`,children:d.syncStatus===null?h("span",{"data-sync-status":"none",children:h(s,{fg:"fg-secondary",type:"body",children:Pn})}):is(d.syncStatus,`recent-item-restricted-status-pill-${P}`)});let z=d.item;return h("div",{"data-testid":`ingest-item-status-${z.id}`,"data-sync-status":z.syncStatus,children:ce(x,{gap:"space-1",testId:`ingest-item-status-lines-${z.id}`,children:[h(s,{fg:"fg",type:"body",children:is(z.syncStatus,`ingest-item-status-pill-${z.id}`)}),z.errorMessage!==null&&z.errorMessage!==void 0&&z.errorMessage!==""&&h(s,{fg:"danger-fg",type:"caption",testId:`ingest-item-error-${z.id}`,children:z.errorMessage}),y(z)]})})}},{key:"last-run",header:st.lastRun,width:{minPx:to},align:"start",cell:({entry:d})=>d.kind==="restricted"?null:ce(x,{gap:"space-2",testId:`ingest-last-run-${d.item.id}`,children:[ve(d.item),_!==void 0&&h(X,{gap:"space-2",testId:`ingest-history-actions-${d.item.id}`,children:h(V,{variant:"secondary",onClick:()=>_(d.item.id),testId:`ingest-history-button-${d.item.id}`,children:h(mr,{subject:`${d.item.fileName} \u306E`,verb:"\u5C65\u6B74",testId:`ingest-history-button-${d.item.id}-subject`})})})]})},{key:"created-at",header:st.createdAt,width:{fixedPx:On({header:st.createdAt},[qe(w)])},align:"start",cell:({entry:d,position:P})=>d.kind==="restricted"?h(s,{fg:"fg-muted",type:"body",testId:`recent-item-restricted-created-at-${P}`,children:h(le,{iso:d.createdAt,testId:`recent-item-restricted-created-at-value-${P}`})}):h(s,{fg:"fg-muted",type:"body",testId:`ingest-created-at-${d.item.id}`,children:h(le,{iso:d.item.createdAt,testId:`ingest-created-at-value-${d.item.id}`})})},{key:"action",header:st.action,width:{fixedPx:Yc},align:"end",cell:({entry:d})=>d.kind==="restricted"?null:je(d.item)}],rows:ft,rowKey:({entry:d,position:P})=>d.kind==="readable"?`readable:${d.item.id}`:`restricted:${P}`,rowTestId:"recent-item-row",rowData:({entry:d,position:P})=>d.kind==="readable"?{"data-item-id":String(d.item.id)}:{"data-restricted-mark":"ingest","data-position":P},rowSize:"row-control",empty:"\u53D6\u308A\u8FBC\u307F\u5C65\u6B74\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:"recent-items-table"})]})})]})}import{FLEXIBLE_COLUMN_MIN_PX as Zc,fixedColumnPx as eu}from"@aiquants/console-ui/core";import{ENRICHMENT_STAGES as lo}from"@aiquants/enrichment-core";import{useId as Is}from"react";import{Fragment as hs,jsx as Je,jsxs as gn}from"react/jsx-runtime";var tu="\u8981\u7D04\u751F\u6210\u30FB\u69CB\u9020\u5316\u62BD\u51FA\u30FB\u30A2\u30BB\u30C3\u30C8\u62BD\u51FA\u306E\u5207\u308A\u66FF\u3048\u306F\u4FDD\u5B58\u3055\u308C\u307E\u3059\u304C\u3001\u4ECA\u306F\u52B9\u304D\u307E\u305B\u3093 (\u30C9\u30E1\u30A4\u30F3\u306F\u30E2\u30C7\u30EB\u304C\u6C7A\u3081\u308B\u306E\u3067\u3001\u6295\u5F71\u306E\u6BB5\u3060\u3051\u304C\u6226\u7565\u3092\u8AAD\u307F\u307E\u3059)\u3002",nu="\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565",ru="\u30C9\u30E1\u30A4\u30F3\u5225\u306E\u6BB5\u306E\u958B\u9589",co="\u4ECA\u306F\u52B9\u304B\u306A\u3044",uo={open:{label:"\u30D5\u30E9\u30B0\u6709\u52B9",fg:"success-fg"},closed:{label:"\u30D5\u30E9\u30B0\u7121\u52B9",fg:"warning-fg"},unmeasured:{label:"\u30D5\u30E9\u30B0\u672A\u6E2C\u5B9A",fg:"fg-muted"},absent:{label:"\u30C6\u30CA\u30F3\u30C8\u306E\u9580\u306A\u3057",fg:"fg-muted"}},ou=[...Object.values(uo).map(({label:e})=>e),co],au=Math.max(...lo.map(e=>eu({header:e.label,note:ou},[{kind:"switch",labelHidden:!0}])));function su(e,t){return e===null?"absent":e in t?t[e]?"open":"closed":"unmeasured"}var iu="\u51E6\u7406\u306E\u6226\u7565\u3092\u5207\u308A\u66FF\u3048\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",lu="\u6BB5\u306E\u5909\u66F4\u3092\u9001\u3063\u3066\u3044\u307E\u3059\u3002\u7B54\u3048\u304C\u5C4A\u304F\u307E\u3067\u4ED6\u306E\u6BB5\u306F\u5207\u308A\u66FF\u3048\u3089\u308C\u307E\u305B\u3093\u3002";function _g({strategies:e,featureFlags:t,onToggleStage:n,canSendCommands:r,isUpdating:o=!1}){let a=Is(),l=Is(),u=r?o?{reasonId:l}:void 0:{reasonId:a},i=!r&&e.length>0;return Je(fe,{title:nu,description:gn(x,{gap:"space-1",testId:"strategy-board-notes",children:[gn(s,{as:"p",fg:"fg-muted",type:"body",children:["\u6295\u5F71\u306E\u6BB5 (\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15\u30FB\u30B0\u30E9\u30D5\u6295\u5F71) \u304C\u8D70\u308B\u306E\u306F\u3001\u30C6\u30CA\u30F3\u30C8\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u3068\u3001\u3053\u306E\u30C9\u30E1\u30A4\u30F3\u306E\u6226\u7565\u306E",Je("strong",{children:"\u53CC\u65B9"}),"\u304C\u958B\u3044\u3066\u3044\u308B\u3068\u304D\u3060\u3051\u3067\u3059\u3002\u8868\u306F ",e.length," \u30C9\u30E1\u30A4\u30F3 \xD7 ",lo.length," \u6BB5\u3002"]}),Je(s,{as:"p",fg:"fg-muted",type:"body",testId:"strategy-inert-note",children:tu}),i&&Je(s,{as:"p",fg:"fg-muted",type:"body",id:a,testId:"strategy-forbidden-note",children:iu}),r&&o&&Je(s,{as:"p",fg:"fg-muted",type:"body",id:l,testId:"strategy-updating-note",children:lu})]}),testId:"enrichment-strategy-board",children:Je(Re,{caption:ru,captionHidden:!0,columns:[{key:"domain",header:"\u30C9\u30E1\u30A4\u30F3",width:{minPx:Zc},align:"start",rowHeader:!0,cell:p=>Je(s,{fg:"fg",type:"body",testId:`strategy-domain-${p.domainKey}`,children:p.domainLabel}),rowHeaderNote:p=>gn(x,{gap:"space-1",testId:`strategy-domain-note-${p.domainKey}`,children:[gn(s,{fg:"fg-muted",type:"caption",children:[Je(s,{fg:"fg-muted",type:"caption",face:"mono",children:p.domainKey})," ","/ ",p.strategyName]}),Je(s,{fg:"fg-muted",type:"caption",testId:`strategy-provenance-${p.domainKey}`,children:p.provenance==="system"?"\u914D\u5099\u306E\u65E2\u5B9A (SYSTEM) \u3092\u89E3\u6C7A\u4E2D \u2014 \u5909\u66F4\u3059\u308B\u3068\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u5C02\u7528\u306E\u884C\u304C\u4F5C\u3089\u308C\u307E\u3059":"\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u56FA\u6709\u306E\u884C"}),!p.isActive&&Je(s,{fg:"warning-fg",type:"caption",testId:`strategy-inactive-${p.domainKey}`,children:"\u6226\u7565\u304C\u7121\u52B9\u306E\u305F\u3081\u3001\u6BB5\u3092\u958B\u3044\u3066\u3082\u89E3\u6C7A\u3055\u308C\u307E\u305B\u3093"})]})},...lo.map(p=>{let T=su(p.featureFlagKey,t),E=!p.readByPipeline;return{key:p.key,header:p.label,note:gn(hs,{children:[Je(s,{as:"div",fg:uo[T].fg,type:"caption",children:Je("span",{"data-testid":`strategy-gate-${p.key}`,"data-gate":T,children:uo[T].label})}),E&&Je(s,{as:"div",fg:"fg-muted",type:"caption",testId:`strategy-inert-${p.key}`,children:co})]}),width:{fixedPx:au},align:"start",cell:m=>{let c=m.stages[p.key];return gn(hs,{children:[Je(Bo,{label:E?`${m.domainLabel} \u306E ${p.label} (${co})`:`${m.domainLabel} \u306E ${p.label}`,labelHidden:!0,checked:c,onCheckedChange:_=>n(m,p.key,_),unavailable:u,testId:`strategy-stage-${m.domainKey}-${p.key}`,dataAttributes:{"data-enabled":String(c),"data-effective":String(!E&&c&&(T==="open"||T==="absent")),"data-inert":String(E)}}),!E&&c&&T==="unmeasured"&&Je(s,{as:"div",fg:"fg-muted",type:"caption",testId:`strategy-unmeasured-${m.domainKey}-${p.key}`,children:"\u30D5\u30E9\u30B0\u3092\u8AAD\u3081\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u8D70\u308B\u304B\u3069\u3046\u304B\u5224\u308A\u307E\u305B\u3093"}),!E&&c&&T==="closed"&&Je(s,{as:"div",fg:"warning-fg",type:"caption",testId:`strategy-blocked-${m.domainKey}-${p.key}`,children:"\u30D5\u30E9\u30B0\u304C\u9589\u3058\u3066\u3044\u308B\u305F\u3081\u8D70\u308A\u307E\u305B\u3093"})]})}}})],rows:e,rowKey:p=>`${p.domainKey}:${p.strategyName}`,rowTestId:"strategy-row",rowData:p=>({"data-domain-key":p.domainKey,"data-strategy-name":p.strategyName,"data-provenance":p.provenance,"data-active":String(p.isActive)}),rowSize:"row-control",empty:"\u767B\u9332\u3055\u308C\u305F\u30C9\u30E1\u30A4\u30F3\u304C\u3042\u308A\u307E\u305B\u3093\u3002",testId:"strategy-grid"})})}import{isReadableText as du}from"@aiquants/console-ui/core";var yn={connected:"\u6B63\u5E38\u63A5\u7D9A",error:"\u63A5\u7D9A\u30A8\u30E9\u30FC"},Mn={connected:"success",error:"danger"};import{Fragment as Rs,jsx as Be,jsxs as Ts}from"react/jsx-runtime";var cu="\u5468\u8FBA\u6A5F\u80FD\u63A5\u7D9A\u72B6\u614B & \u30D0\u30FC\u30B8\u30E7\u30F3",uu=[{key:"qdrant",title:"Qdrant",subtitle:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u30A8\u30F3\u30B8\u30F3 (Vector DB)"},{key:"neo4j",title:"Neo4j",subtitle:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5 (Graph DB)"},{key:"redis",title:"Redis",subtitle:"\u30AD\u30E3\u30C3\u30B7\u30E5 & Pub/Sub (Cache)"},{key:"sqlServer",title:"SQL Server",subtitle:"\u6B63\u6E96\u30C7\u30FC\u30BF\u30B9\u30C8\u30A2 (Single Source of Truth)"},{key:"backendApi",title:"Backend API",subtitle:"Python \u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u63A8\u8AD6\u30A8\u30F3\u30B8\u30F3"}],pu={engine:"\u30A8\u30F3\u30B8\u30F3",edition:"\u30A8\u30C7\u30A3\u30B7\u30E7\u30F3",fullVersion:"\u5B8C\u5168\u30D0\u30FC\u30B8\u30E7\u30F3",title:"\u540D\u79F0",collectionsCount:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3",nodeCount:"\u30CE\u30FC\u30C9\u6570 (\u30C6\u30CA\u30F3\u30C8)",totalKeys:"\u30AD\u30FC\u7DCF\u6570",database:"DB",endpointsCount:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8",port:"\u30DD\u30FC\u30C8",restPort:"REST \u30DD\u30FC\u30C8",boltUri:"Bolt URI",tls:"TLS"},Es=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],mu=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]);function _s(e,t){return t===null?{kind:"unmeasured"}:mu.has(e)&&typeof t=="number"?{kind:"count",count:t}:typeof t=="boolean"?{kind:"word",text:t?"\u6709\u52B9":"\u7121\u52B9"}:typeof t=="number"?{kind:"number",value:t}:{kind:"text",text:t}}function fu(e){let t=Es.filter(r=>r in e),n=Object.keys(e).filter(r=>!Es.includes(r)).sort();return[...t,...n].map(r=>({key:r,label:pu[r]??r,value:_s(r,e[r])}))}function Ss(e,t){switch(e.kind){case"count":return Be($,{value:e.count,unit:"\u4EF6",testId:t});case"unmeasured":return Be($,{text:null,keep:"whole",testId:t});case"number":if(!Number.isFinite(e.value))throw new RangeError(`${t}: a number the probe read must be finite, got ${e.value} (pass null when the probe could not read it)`);return Be($,{text:String(e.value),keep:"whole",testId:t});case"word":return Be($,{text:e.text,keep:"whole",testId:t});case"text":return Be($,{text:e.text,keep:"wrap",testId:t})}}function gu({serviceKey:e,title:t,subtitle:n,status:r}){let o=_s("version",r.version),a=Ss(o,`service-version-value-${e}`),l=r.errorMessage!==void 0&&du(r.errorMessage);return Be(Te,{title:t,subtitle:n,testId:`service-card-${e}`,children:Be(he,{items:[{key:"status",term:"\u72B6\u614B",description:Be(J,{tone:Mn[r.status],variant:"tint",testId:`service-status-${e}`,children:yn[r.status]})},{key:"version",term:"\u30D0\u30FC\u30B8\u30E7\u30F3",description:o.kind==="text"?Be(s,{fg:"fg",type:"body",face:"mono",children:a}):a},{key:"latency",term:"\u5FDC\u7B54\u6642\u9593",description:Be($,{value:r.latencyMs,unit:"ms",testId:`health-latency-value-${e}`})},...fu(r.details).map(u=>({key:`detail-${u.key}`,term:u.label,description:Ss(u.value,`health-detail-value-${e}-${u.key}`)})),{key:"endpoint",term:"\u63A5\u7D9A\u5148",description:Be(s,{fg:"fg",type:"body",face:"mono",testId:`service-endpoint-${e}`,children:r.endpoint})},...l?[{key:"error",term:"\u30A8\u30E9\u30FC\u5185\u5BB9",description:Be(s,{fg:"danger-fg",type:"body",testId:`service-error-${e}`,children:r.errorMessage})}]:[]],testId:`service-details-${e}`})})}function $g({health:e,isRefreshing:t=!1,onRefresh:n}){let{services:r,allHealthy:o,checkedAt:a}=e;return S(),Be(fe,{title:cu,description:Ts(Rs,{children:["\u6700\u7D42\u78BA\u8A8D:"," ",Be("span",{"data-testid":"health-checked-at",children:Be(le,{iso:a,testId:"health-checked-at-value"})})," ","| \u5168 5 \u7CFB\u7D71\u306E\u57FA\u76E4\u30B5\u30FC\u30D3\u30B9\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u6B7B\u6D3B\u76E3\u8996"]}),actions:Ts(Rs,{children:[Be(J,{tone:Mn[o?"connected":"error"],variant:"tint",testId:"health-overall-status-badge",children:o?`\u5168\u30B5\u30FC\u30D3\u30B9${yn.connected}`:`\u4E00\u90E8\u30B5\u30FC\u30D3\u30B9${yn.error}`}),n!==void 0&&Be(V,{variant:"secondary",busy:t,busyLabel:"\u518D\u78BA\u8A8D\u4E2D\u2026",onClick:n,testId:"health-refresh-button",children:"\u518D\u78BA\u8A8D"})]}),testId:"infrastructure-health-monitor",dataAttributes:{"data-healthy":String(o)},children:uu.map(({key:u,title:i,subtitle:p})=>Be(gu,{serviceKey:u,title:i,subtitle:p,status:r[u]},u))})}import{FLEXIBLE_COLUMN_MIN_PX as Fn,fixedColumnPx as po,HTTP_FORBIDDEN as yu,mapOutcome as xs}from"@aiquants/console-ui/core";import{INGESTION_JOB_PAGE_SIZE as bu}from"@aiquants/enrichment-core";import{useCallback as Iu,useEffect as gr,useId as vs,useLayoutEffect as hu,useRef as Ut,useState as yr}from"react";import{Fragment as ku,jsx as ye,jsxs as Zt}from"react/jsx-runtime";var Eu="\u52D5\u3044\u3066\u3044\u308B\u4ED5\u4E8B",Cs="\u52D5\u3044\u3066\u3044\u308B\u4ED5\u4E8B\u3092\u95B2\u89A7\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",ks="\u52D5\u3044\u3066\u3044\u308B\u4ED5\u4E8B",Et={target:"\u5BFE\u8C61",kind:"\u7A2E\u985E",status:"\u72B6\u614B",attempt:"\u8A66\u884C",created:"\u5165\u308C\u305F\u6642\u523B",nextAttempt:"\u6B21\u306E\u8A66\u307F",lastError:"\u6700\u5F8C\u306E\u5931\u6557",actions:"\u64CD\u4F5C"},mo="\u53D6\u308A\u6D88\u3059",Ps="\u2014",Su="\u53D6\u308A\u8FBC\u307F\u306E\u4ED5\u4E8B\u3092\u53D6\u308A\u6D88\u3059\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",Ls=Object.freeze({"ingestion.run":"\u53D6\u308A\u8FBC\u307F","ingestion.retract":"\u53D6\u308A\u4E0B\u3052","daily_report.reconcile":"\u65E5\u5831\u306E\u7167\u5408"}),br=e=>Object.hasOwn(Ls,e)?Ls[e]:`\u77E5\u3089\u306A\u3044\u7A2E\u985E (${e})`,go=e=>e.endsWith(")")?`${e} `:e;function Ru(e){if(e.state==="QUEUED")return e.attempt===0?{label:"\u5F85\u3061",tone:"neutral"}:{label:"\u518D\u8A66\u884C\u306E\u5F85\u3061",tone:"warning"};if(e.state==="RUNNING")return e.cancelRequestedAt===null?{label:"\u5B9F\u884C\u4E2D",tone:"info"}:{label:"\u53D6\u308A\u6D88\u3057\u3092\u6C42\u3081\u305F\u5B9F\u884C\u4E2D",tone:"warning"};throw new RangeError(`a moving job waits or runs, not ${e.state}`)}var Tu={QUEUED:{label:"\u5F85\u3061",tone:"neutral"},RUNNING:{label:"\u5B9F\u884C\u4E2D",tone:"info"}};function $s(e){let{document:t}=e;return t===null?br(e.job.jobKind):`\u300C${t.fileName}\u300D(r${t.revision}${t.isCurrent?"":"\u30FB\u65E7\u7248"}\u30FB#${t.metadataId})`}function _u(e){let t=go(br(e.job.jobKind)),n=e.document===null?`${t}\u306E\u4ED5\u4E8B`:`${go($s(e))}\u306E${t}`,r=e.job.state==="RUNNING"?"\u8D70\u3063\u3066\u3044\u308B\u4ED5\u4E8B\u306F\u6B21\u306E\u6BB5\u306E\u524D\u3067\u6B62\u307E\u308A\u3001\u6E08\u3093\u3060\u6BB5\u306E\u7D50\u679C\u306F\u6B8B\u308A\u307E\u3059\u3002":"\u5F85\u3063\u3066\u3044\u308B\u4ED5\u4E8B\u306F\u8D70\u3089\u305A\u306B\u7D42\u308F\u308A\u307E\u3059\u3002";return`${n}\u3092\u53D6\u308A\u6D88\u3057\u307E\u3059\u3002${r}`}function xu(e){let t=go(br(e.jobKind));return e.state==="CANCELLED"?`${t}\u306E\u4ED5\u4E8B\u3092\u53D6\u308A\u6D88\u3057\u307E\u3057\u305F\u3002`:`${t}\u306E\u4ED5\u4E8B\u306B\u53D6\u308A\u6D88\u3057\u3092\u6C42\u3081\u307E\u3057\u305F\u3002\u6B21\u306E\u6BB5\u306E\u524D\u3067\u6B62\u307E\u308A\u307E\u3059\u3002`}var fo=e=>(e.state==="QUEUED"||e.state==="RUNNING")&&e.cancelRequestedAt===null,ws=e=>JSON.stringify(e),Cu=(e,t)=>n=>({meta:n.meta,rows:n.rows.flatMap(r=>r.kind!=="readable"||r.item.job.jobId!==t.jobId?[r]:t.state===e?[{kind:"readable",item:{job:t,document:r.item.document}}]:[])});function Ns({state:e,title:t,testId:n,read:r,revision:o,canSendCommands:a,forbiddenNoteId:l,isBusy:u,cancellingJobId:i,onCancel:p,cancelAnswer:T,onCancelControlsChange:E}){let{labels:m,timeZone:c}=S(),_=vs(),f=Ut(null),C=Ut(null),I=Ut(null),U=Ut(null),[w,ne]=yr(o),N=Ut(o),B=Ut(!1),[R,M]=yr(!1),[K,ae]=yr(null),Ee=Ut(null),v=Ut(null),q=xt(e,{first:G=>r(e,null,G).then(ee=>(ee.ok&&!G.aborted&&(B.current=!1,M(!1)),xs(ee,Ie=>({rows:Ie.rows,next:Ie.next,meta:null})))),next:(G,ee)=>r(e,G,ee).then(Ie=>(!Ie.ok&&Ie.status===yu&&q.reload(),Ie.ok&&!ee.aborted&&(B.current=!0),xs(Ie,g=>({rows:g.rows,next:g.next}))))},w);gr(()=>{if(o!==N.current){if(N.current=o,B.current){M(!0);return}ne(o)}},[o]);let H=q.updateList;gr(()=>{if(T===null)return;let G=ws(T);G!==v.current&&(v.current=G,H(e,Cu(e,T)),ae(ee=>ee===T.jobId?null:ee))},[T,e,H]),gr(()=>{K!==null&&U.current?.focus()},[K]);let O=G=>C.current?.querySelector(`[data-cancel-job="${G}"]`)??null,Y=Me(()=>f.current),et=Me(()=>O(Ee.current)??f.current),Ce=Me(()=>f.current),F=Me(()=>f.current),Se=q.state.kind==="ready"?q.state.refreshFailure:null,ue=lt(Se),re=q.state.kind==="ready"&&q.state.value.rows.some(G=>G.kind==="readable"&&fo(G.item.job));hu(()=>{E(e,re)},[e,re,E]);let Z=()=>{B.current=!1,M(!1),ne(N.current)},be=G=>{Ee.current=G,ae(ee=>ee===G?null:G)};return ye(Te,{title:t,headingRef:f,ref:C,testId:n,children:(()=>{if(q.state.kind==="failed")return ye(ot,{failure:q.state,onReload:q.reload,forbiddenMessage:Cs,failureMessage:We(ks),rescueRef:Ce,testId:`${n}-failed`});if(q.state.kind!=="ready")return Zt("p",{"aria-busy":"true","data-testid":`${n}-loading`,children:[t,"\u306E\u4ED5\u4E8B\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"]});let{value:G}=q.state,ee=G.rows.map((D,ie)=>({entry:D,position:ie})),Ie=K===null||!a?void 0:G.rows.find(D=>D.kind==="readable"&&D.item.job.jobId===K&&fo(D.item.job)),g=Ie!==void 0&&i===Ie.item.job.jobId,se=g?void 0:i!==null?{reason:"\u5225\u306E\u4ED5\u4E8B\u306E\u53D6\u308A\u6D88\u3057\u306E\u7B54\u3048\u3092\u5F85\u3063\u3066\u3044\u307E\u3059"}:u?{reason:"\u4ED6\u306E\u9001\u4FE1\u306E\u7B54\u3048\u3092\u5F85\u3063\u3066\u3044\u307E\u3059"}:void 0;return Zt(ku,{children:[Se!==null&&ye(Ae,{occurrence:ue,testId:`${n}-refresh-failed`,children:m.failureSentence(Se,Cs,We(ks))}),R&&ye("div",{ref:F,"data-testid":`${n}-stale`,children:Zt(x,{gap:"space-2",testId:`${n}-stale-body`,children:[ye(s,{as:"p",fg:"fg",type:"body",testId:`${n}-stale-text`,children:"\u8AAD\u307F\u8FBC\u3093\u3060\u5F8C\u306B\u4ED5\u4E8B\u304C\u52D5\u304D\u307E\u3057\u305F\u3002\u8AAD\u3093\u3060\u7D9A\u304D\u3092\u4FDD\u3063\u305F\u307E\u307E\u793A\u3057\u3066\u3044\u307E\u3059\u3002"}),ye("div",{children:ye(V,{variant:"secondary",onClick:Z,testId:`${n}-read-from-start`,children:"\u6700\u65B0\u306E\u4E00\u89A7\u306B\u8AAD\u307F\u76F4\u3059"})})]})}),Ie!==void 0&&ye("div",{id:_,role:"group","aria-label":`${t}\u306E\u4ED5\u4E8B\u306E\u53D6\u308A\u6D88\u3057\u306E\u78BA\u8A8D`,ref:et,"data-testid":`${n}-confirm`,"data-job-id":Ie.item.job.jobId,children:Zt(x,{gap:"space-2",testId:`${n}-confirm-body`,children:[ye(s,{as:"p",fg:"fg",type:"prose",testId:`${n}-confirm-text`,children:_u(Ie.item)}),Zt(X,{gap:"space-2",testId:`${n}-confirm-actions`,children:[ye(V,{variant:"danger",ref:U,busy:g,busyLabel:"\u53D6\u308A\u6D88\u3057\u3092\u9001\u3063\u3066\u3044\u307E\u3059\u2026",unavailable:se,onClick:()=>p(Ie.item.job),testId:`${n}-cancel-confirm`,children:"\u53D6\u308A\u6D88\u3057\u3092\u78BA\u304B\u3081\u308B"}),ye(V,{variant:"secondary",unavailable:g?{reason:"\u53D6\u308A\u6D88\u3057\u306E\u7B54\u3048\u3092\u5F85\u3063\u3066\u3044\u307E\u3059"}:void 0,onClick:()=>ae(null),testId:`${n}-cancel-dismiss`,children:"\u3084\u3081\u308B"})]})]})},`confirm:${Ie.item.job.jobId}`),ye(Re,{caption:`${t}\u306E\u4ED5\u4E8B`,captionHidden:!0,columns:[{key:"target",header:Et.target,width:{minPx:Fn},align:"start",cell:({entry:D,position:ie})=>D.kind==="restricted"?ye("span",{"data-testid":`${n}-mark-${ie}`,children:Tt}):ye("span",{"data-testid":`${n}-target-${D.item.job.jobId}`,children:$s(D.item)})},{key:"kind",header:Et.kind,width:{minPx:Fn},align:"start",cell:({entry:D})=>D.kind==="readable"?ye("span",{"data-testid":`${n}-kind-${D.item.job.jobId}`,children:br(D.item.job.jobKind)}):null},{key:"status",header:Et.status,width:{minPx:Fn},align:"start",cell:({entry:D,position:ie})=>{let Ke=D.kind==="readable"?Ru(D.item.job):Tu[D.state];return ye(J,{tone:Ke.tone,variant:"tint",testId:D.kind==="readable"?`${n}-status-${D.item.job.jobId}`:`${n}-mark-status-${ie}`,children:Ke.label})}},{key:"attempt",header:Et.attempt,width:{minPx:Fn},align:"end",cell:({entry:D})=>D.kind==="readable"?Zt("span",{"data-testid":`${n}-attempt-${D.item.job.jobId}`,children:[ye($,{value:D.item.job.attempt,testId:`${n}-attempt-value-${D.item.job.jobId}`})," / ",ye($,{value:D.item.job.maxAttempts,testId:`${n}-max-attempts-value-${D.item.job.jobId}`})]}):null},{key:"created",header:Et.created,width:{fixedPx:po({header:Et.created},[qe(c)])},align:"start",cell:({entry:D,position:ie})=>{let Ke=D.kind==="readable"?D.item.job.jobId:`mark-${ie}`;return ye("span",{"data-testid":`${n}-created-${Ke}`,children:ye(le,{iso:D.kind==="readable"?D.item.job.createdAt:D.createdAt,testId:`${n}-created-${Ke}-value`})})}},{key:"next-attempt",header:Et.nextAttempt,width:{fixedPx:po({header:Et.nextAttempt},[qe(c),{kind:"text",texts:[Ps],face:"sans",type:"body"}])},align:"start",cell:({entry:D})=>{if(D.kind!=="readable")return null;let{job:ie}=D.item;return ye("span",{"data-testid":`${n}-next-attempt-${ie.jobId}`,children:ie.state==="QUEUED"?ye(le,{iso:ie.nextAttemptAt,testId:`${n}-next-attempt-${ie.jobId}-value`}):Ps})}},{key:"last-error",header:Et.lastError,width:{minPx:Fn},align:"start",cell:({entry:D})=>D.kind==="readable"?ye("span",{"data-testid":`${n}-last-error-${D.item.job.jobId}`,children:D.item.job.lastErrorMessage??"\u2014"}):null},{key:"actions",header:Et.actions,width:{fixedPx:po({header:Et.actions},[{kind:"button",labels:[mo]}])},align:"start",cell:({entry:D})=>{if(D.kind!=="readable"||!fo(D.item.job))return null;let{jobId:ie}=D.item.job;if(!a)return ye(V,{variant:"secondary",unavailable:{reasonId:l},testId:`${n}-cancel-${ie}`,children:mo});let Ke=K===ie;return ye("span",{ref:Y,"data-testid":`${n}-actions-${ie}`,children:ye(V,{variant:"secondary",expanded:Ke,controls:Ke?_:void 0,dataAttributes:{"data-cancel-job":ie},onClick:()=>be(ie),testId:`${n}-cancel-${ie}`,children:mo})})}}],rows:ee,rowKey:({entry:D,position:ie})=>D.kind==="readable"?`job:${D.item.job.jobId}`:`restricted:${ie}`,rowTestId:`${n}-row`,rowData:({entry:D})=>D.kind==="readable"?{"data-job-id":D.item.job.jobId,"data-state":D.item.job.state}:{"data-restricted-mark":"job","data-state":D.state},rowSize:"row-control",empty:G.next===null?`\u8AAD\u3081\u308B${t}\u306E\u4ED5\u4E8B\u306F\u3042\u308A\u307E\u305B\u3093\u3002`:`\u3053\u3053\u307E\u3067\u306B\u8AAD\u3081\u308B${t}\u306E\u4ED5\u4E8B\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u7D9A\u304D\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u3059\u3002`,testId:`${n}-table`,ref:I}),ye(_t,{onLoad:q.loadMore,busy:G.loadingMore||q.state.refreshing,done:G.next===null,failure:G.moreFailure,limit:bu,rows:{count:G.rows.length,ref:I},testId:`${n}-more`})]})})()})}function jg({read:e,revision:t,canSendCommands:n,isBusy:r,cancellingJobId:o,onCancel:a,cancelAnswer:l}){S();let u=kt(),i=vs(),[p,T]=yr({RUNNING:!1,QUEUED:!1}),E=Iu((f,C)=>{T(I=>I[f]===C?I:{...I,[f]:C})},[]),m=!n&&(p.RUNNING||p.QUEUED),c=Ut(null);gr(()=>{if(l===null)return;let f=ws(l);f!==c.current&&(c.current=f,u(xu(l)))},[l,u]);let _={read:e,revision:t,canSendCommands:n,forbiddenNoteId:i,isBusy:r,cancellingJobId:o,onCancel:a,cancelAnswer:l,onCancelControlsChange:E};return ye(fe,{title:Eu,description:"\u53D6\u308A\u8FBC\u307F\u306E\u5217\u3067\u5F85\u3063\u3066\u3044\u308B\u4ED5\u4E8B\u3068\u8D70\u3063\u3066\u3044\u308B\u4ED5\u4E8B\u306E\u3046\u3061\u3001\u95B2\u89A7\u3067\u304D\u308B\u3082\u306E\u3092\u65B0\u3057\u3044\u9806\u306B\u793A\u3057\u307E\u3059\u3002\u53D6\u308A\u6D88\u3057\u306F\u78BA\u304B\u3081\u3066\u304B\u3089\u9001\u308A\u307E\u3059\u3002",testId:"ingestion-job-board",children:Zt(x,{gap:"space-6",testId:"ingestion-job-board-sections",children:[m&&ye(s,{as:"p",fg:"fg-muted",type:"body",id:i,testId:"ingestion-job-board-forbidden-note",children:Su}),ye(Ns,{state:"RUNNING",title:"\u5B9F\u884C\u4E2D",testId:"ingestion-jobs-running",..._}),ye(Ns,{state:"QUEUED",title:"\u5F85\u3061",testId:"ingestion-jobs-waiting",..._})]})})}import{FLEXIBLE_COLUMN_MIN_PX as Ds,fixedColumnPx as Pu}from"@aiquants/console-ui/core";import{jsx as He,jsxs as hr}from"react/jsx-runtime";var Lu="\u53D6\u308A\u8FBC\u307F\u306E\u5217",Ir={owner:"\u6301\u3061\u4E3B",running:"\u5B9F\u884C\u4E2D",heartbeat:"\u6700\u65B0\u306E\u5FC3\u62CD"},Nu="\u53D6\u308A\u8FBC\u307F\u306E\u5217\u306E\u69D8\u5B50\u3092\u8AAD\u3080\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",vu=e=>`\u53D6\u308A\u8FBC\u307F\u306E\u5217\u306E\u69D8\u5B50\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F${e===null?"":` (HTTP ${e})`}\u3002`;function $u({health:e}){let{timeZone:t}=S();return hr(x,{gap:"space-4",testId:"ingestion-queue-health-measured",children:[He(he,{items:[{key:"ready",term:"\u53D6\u308A\u51FA\u3057\u3092\u5F85\u3064\u4ED5\u4E8B",description:He($,{value:e.ready,unit:"\u4EF6",testId:"ingestion-queue-ready-value"})},{key:"oldest",term:"\u6700\u3082\u53E4\u3044\u5F85\u3061",description:e.oldest_ready_since===null||e.oldest_ready_age_seconds===null?He(s,{fg:"fg",type:"body",children:"\u306A\u3057"}):hr("span",{"data-testid":"ingestion-queue-oldest",children:[He($,{value:e.oldest_ready_age_seconds,unit:"\u79D2",testId:"ingestion-queue-oldest-age-value"})," (",He(le,{iso:e.oldest_ready_since,testId:"ingestion-queue-oldest-since-value"})," \u304B\u3089)"]})},{key:"scheduled",term:"\u518D\u8A66\u884C\u306E\u5F85\u3061",description:He($,{value:e.scheduled,unit:"\u4EF6",testId:"ingestion-queue-scheduled-value"})},{key:"running",term:"\u5B9F\u884C\u4E2D",description:He($,{value:e.running,unit:"\u4EF6",testId:"ingestion-queue-running-value"})},{key:"cancel-requested",term:"\u53D6\u308A\u6D88\u3057\u3092\u6C42\u3081\u305F\u5B9F\u884C\u4E2D",description:He($,{value:e.cancel_requested,unit:"\u4EF6",testId:"ingestion-queue-cancel-requested-value"})},{key:"expired-leases",term:"\u6301\u3061\u5206\u306E\u5207\u308C\u305F\u5B9F\u884C\u4E2D",description:He($,{value:e.expired_leases,unit:"\u4EF6",testId:"ingestion-queue-expired-leases-value"})},{key:"measured-at",term:"\u6E2C\u3063\u305F\u6642\u523B",description:He(le,{iso:e.measured_at,testId:"ingestion-queue-measured-at-value"})}],testId:"ingestion-queue-counts"}),e.expired_leases>0&&hr(Oe,{tone:"warning",testId:"ingestion-queue-expired-leases",children:["\u6301\u3061\u5206\u306E\u5207\u308C\u305F\u5B9F\u884C\u4E2D\u306E\u4ED5\u4E8B\u304C ",He($,{value:e.expired_leases,unit:"\u4EF6",testId:"ingestion-queue-expired-leases-notice-value"}),"\u3042\u308A\u307E\u3059\u3002\u30EF\u30FC\u30AB\u30FC\u304C\u6B62\u307E\u3063\u305F\u304B\u6EDE\u3063\u3066\u3044\u307E\u3059 (\u898B\u56DE\u308A\u304C\u56DE\u53CE\u3057\u307E\u3059)\u3002"]}),He(Re,{caption:"\u4ED5\u4E8B\u3092\u6301\u3064\u30EF\u30FC\u30AB\u30FC",captionHidden:!1,columns:[{key:"owner",header:Ir.owner,width:{minPx:Ds},align:"start",cell:n=>He(s,{fg:"fg",type:"body",face:"mono",children:n.owner})},{key:"running",header:Ir.running,width:{minPx:Ds},align:"end",cell:n=>He($,{value:n.running,unit:"\u4EF6",testId:`ingestion-queue-holder-running-value-${n.owner}`})},{key:"heartbeat",header:Ir.heartbeat,width:{fixedPx:Pu({header:Ir.heartbeat},[qe(t)])},align:"start",cell:n=>He(le,{iso:n.last_heartbeat_at,testId:`ingestion-queue-holder-heartbeat-value-${n.owner}`})}],rows:e.holders,rowKey:n=>n.owner,rowTestId:"ingestion-queue-holder",rowData:n=>({"data-owner":n.owner}),rowSize:"row",empty:"\u4ECA\u3001\u4ED5\u4E8B\u3092\u6301\u3064\u30EF\u30FC\u30AB\u30FC\u306F\u3042\u308A\u307E\u305B\u3093 (\u30EF\u30FC\u30AB\u30FC\u306F\u8D70\u3089\u305B\u308B\u4ED5\u4E8B\u3092\u901A\u3057\u3066\u3060\u3051\u898B\u3048\u307E\u3059)\u3002",testId:"ingestion-queue-holders"})]})}function Qg({reading:e}){return S(),hr(fe,{title:Lu,testId:"ingestion-queue-health",children:[e.kind==="measured"&&He($u,{health:e.health}),e.kind==="forbidden"&&He(Oe,{tone:"warning",testId:"ingestion-queue-health-forbidden",children:Nu}),e.kind==="unavailable"&&He(Ae,{occurrence:1,testId:"ingestion-queue-health-unavailable",children:vu(e.status)})]})}import{SEARCH_PARAM_LIMITS as en}from"@aiquants/enrichment-core";import{useEffect as wu,useRef as As,useState as Jt}from"react";import{jsx as ke,jsxs as Er}from"react/jsx-runtime";var Du=4;function Os(e){return`${e.label} (${e.embeddingModel})`}function Au(e){let t=e.trim().length;return t<en.queryLength.min?"\u554F\u3044\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002":t>en.queryLength.max?`\u554F\u3044\u306F ${en.queryLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function oy({variants:e,onCompare:t}){let{formatLocale:n}=S(),r=kt(),[o,a]=Jt(null),[l,u]=Jt(null),[i,p]=Jt(""),[T,E]=Jt(en.limit.default),[m,c]=Jt(!1),[_,f]=Jt(!1),[C,I]=Jt(null),[U,w]=Jt(null),ne=As(0),N=As(null);wu(()=>()=>N.current?.abort(),[]);let B=e.map(F=>F.strategyId),R=o!==null&&B.includes(o)?o:B[0]??null,M=l!==null&&B.includes(l)?l:B[1]??null,K=R!==null&&R===M,ae={query:Au(i),variant:K?"\u540C\u3058\u5909\u7A2E\u3069\u3046\u3057\u306F\u6BD4\u3079\u3089\u308C\u307E\u305B\u3093\u3002\u5225\u306E\u5909\u7A2E\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002":void 0},Ee=m?ae.query:void 0,v=F=>{let Se=e.find(ue=>ue.strategyId===F);return Se===void 0?`\u6226\u7565 #${F}`:Os(Se)},q=F=>{ne.current+=1,I(null),w({message:F,occurrence:ne.current})},H=async F=>{let Se=new AbortController;N.current=Se,f(!0);try{let ue=await t(F,Se.signal);if(Se.signal.aborted)return;let re=ue.results.find(be=>be.strategy_id===F.strategy_ids[0]),Z=ue.results.find(be=>be.strategy_id===F.strategy_ids[1]);if(re===void 0||Z===void 0){q(`\u7B54\u3048\u306B\u6226\u7565 #${re===void 0?F.strategy_ids[0]:F.strategy_ids[1]} \u306E\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093\u3002`);return}I({input:F,answer:ue,results:[re,Z]}),w(null),r(`\u5909\u7A2E A \u306F ${re.hits.length} \u4EF6\u3001\u5909\u7A2E B \u306F ${Z.hits.length} \u4EF6\u3092\u8FD4\u3057\u307E\u3057\u305F\u3002`)}catch(ue){if(Se.signal.aborted)return;q(ue instanceof Error?ue.message:"\u6BD4\u3079\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002")}finally{N.current=null,f(!1)}},O=F=>{F.preventDefault(),c(!0),!(_||R===null||M===null||ae.query!==void 0||ae.variant!==void 0)&&H({query:i.trim(),strategy_ids:[R,M],limit:T})},Y=e.map(F=>({value:String(F.strategyId),label:Os(F)})),et=(F,Se,ue,re,Z)=>F===void 0?ke(s,{fg:"fg-muted",type:"body",testId:`compare-${Se}-${ue}-${re}`,children:"\u3053\u306E\u9806\u4F4D\u306E\u7D50\u679C\u7121\u3057"}):Er(x,{gap:"space-1",testId:`compare-${Se}-${ue}-${re}`,children:[ke(s,{fg:"fg-secondary",type:"body",face:"mono",children:`\u6587\u66F8 ${F.metadata_id} \xB7 \u30C1\u30E3\u30F3\u30AF ${F.chunk_index} \xB7 ${F.score.toFixed(Du)}`}),ke(s,{fg:"fg",type:"prose",children:Z||F.text===null?un:F.text})]}),Ce=({answer:F,results:Se})=>{let[ue,re]=Se,Z=zo(ue.hits.map(Cr),re.hits.map(Cr)),be=Array.from({length:Math.max(ue.hits.length,re.hits.length)},(G,ee)=>ee+1),ze=(G,ee)=>({key:ee,heading:`\u5909\u7A2E ${ee.toUpperCase()}: ${v(G.strategy_id)} \xB7 ${cn(G.execution_ms,`execution_ms of strategy ${G.strategy_id}`,n)} ms`,cells:Object.fromEntries(be.map(Ie=>[`rank-${Ie}`,g=>et(G.hits[Ie-1],ee,Ie,g,F.text_hidden)]))});return ke(fe,{title:"\u6BD4\u3079\u306E\u7D50\u679C",testId:"compare-results",children:Er(x,{gap:"space-4",testId:"compare-results-body",children:[ke(he,{items:[{key:"shared",term:"\u5171\u901A\u306E\u30C1\u30E3\u30F3\u30AF",description:ke(s,{fg:"fg",type:"body",testId:"compare-shared-count",children:`${Z.sharedCount} \u4EF6 (A ${ue.hits.length} \u4EF6 / B ${re.hits.length} \u4EF6)`})},{key:"overlap",term:"\u91CD\u306A\u308A (Jaccard)",description:ke(s,{fg:"fg",type:"body",testId:"compare-overlap-ratio",children:Z.overlapRatio===null?"\u3069\u3061\u3089\u3082\u7D50\u679C\u7121\u3057":`${(Z.overlapRatio*100).toFixed(1)}%`})},{key:"distance",term:"\u9806\u4F4D\u306E\u5DEE\u306E\u5E73\u5747 (\u5171\u901A\u306E\u5206)",description:ke(s,{fg:"fg",type:"body",testId:"compare-rank-difference",children:Z.meanAbsoluteRankDifference===null?"\u5171\u901A\u306E\u7D50\u679C\u7121\u3057":Z.meanAbsoluteRankDifference.toFixed(2)})},{key:"body",term:"\u672C\u6587",description:ke(s,{fg:"fg",type:"body",testId:"compare-text-hidden",children:F.text_hidden?"\u5217\u306E\u30B9\u30B3\u30FC\u30D7\u3067\u4F0F\u305B\u3066\u3044\u307E\u3059":"\u793A\u3057\u3066\u3044\u307E\u3059"})}],testId:"compare-agreement"}),[[ue,"A"],[re,"B"]].map(([G,ee])=>G.dense_ran?null:ke(Oe,{tone:"warning",testId:`compare-degraded-${ee.toLowerCase()}`,children:ke(s,{as:"p",fg:"fg",type:"prose",children:`\u5909\u7A2E ${ee} (${v(G.strategy_id)}) \u306E\u5BC6\u306E\u5C64\u306F\u8D70\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002${G.degradation_reasons.map(Xn).join(" ")}`})},ee)),be.length===0?ke(s,{as:"p",fg:"fg",type:"prose",testId:"compare-empty",children:"\u3069\u3061\u3089\u306E\u5909\u7A2E\u306B\u3082\u7D50\u679C\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):ke(Vn,{caption:"\u5909\u7A2E\u3054\u3068\u306E\u9806\u4F4D",attributes:be.map(G=>({key:`rank-${G}`,label:`${G} \u4F4D`})),columns:[ze(ue,"a"),ze(re,"b")],attributePx:64,columnMinPx:272,testId:"compare-grid"})]})})};return Er(x,{gap:"space-6",testId:"model-comparison-workbench",children:[ke(fe,{title:"\u5909\u7A2E\u306E\u6BD4\u3079",description:"\u540C\u3058\u554F\u3044\u3092 2 \u3064\u306E\u6226\u7565\u306E\u5909\u7A2E\u3067\u691C\u7D22\u3057\u3001\u9806\u4F4D\u3092\u4E26\u3079\u307E\u3059\u3002\u5024\u306F\u5909\u7A2E\u3054\u3068\u306B\u5225\u306E\u91CF\u306A\u306E\u3067\u6B63\u898F\u5316\u3057\u307E\u305B\u3093\u3002",testId:"compare-card",dataAttributes:{"data-running":_},children:e.length<2?ke(Oe,{tone:"info",testId:"compare-variants-insufficient",children:ke(s,{as:"p",fg:"fg",type:"prose",children:`\u6BD4\u3079\u308B\u306B\u306F\u5909\u7A2E\u304C 2 \u3064\u4EE5\u4E0A\u8981\u308A\u307E\u3059 (\u4ECA\u306F ${e.length} \u4EF6)\u3002`})}):ke("form",{onSubmit:O,noValidate:!0,"data-testid":"compare-form",children:Er(x,{gap:"space-4",testId:"compare-form-fields",children:[ke(gt,{label:"\u5909\u7A2E A",value:String(R),options:Y,onValueChange:F=>a(Number(F)),testId:"compare-variant-a"}),ke(gt,{label:"\u5909\u7A2E B",value:String(M),options:Y,onValueChange:F=>u(Number(F)),error:ae.variant,testId:"compare-variant-b"}),ke(Ze,{label:"\u554F\u3044",type:"search",value:i,onValueChange:p,required:!0,description:`1\u301C${en.queryLength.max} \u5B57`,error:Ee,testId:"compare-query"}),ke(vt,{label:"\u4EF6\u6570",value:T,min:en.limit.min,max:en.limit.max,step:1,valueText:F=>`${F} \u4EF6`,onValueChange:E,testId:"compare-limit"}),ke(X,{gap:"space-2",testId:"compare-actions",children:ke(V,{variant:"primary",type:"submit",busy:_,busyLabel:"\u6BD4\u3079\u3066\u3044\u307E\u3059",testId:"compare-submit",children:"\u6BD4\u3079\u308B"})})]})})}),U!==null&&ke(Ae,{occurrence:U.occurrence,testId:"compare-failure",children:U.message}),C!==null&&Ce(C)]})}import{countSampleText as Ou,tileMinInlinePx as Mu}from"@aiquants/console-ui/core";import{Fragment as tn,jsx as ge,jsxs as St}from"react/jsx-runtime";var bn={constraints:{label:"\u7269\u7406\u4E00\u610F\u5236\u7D04",sublabel:"Unique"},searchIndexes:{label:"\u691C\u7D22\u7D22\u5F15",sublabel:"DDL \u304C\u4F5C\u308B\u5206"},totalIndexes:{label:"\u5168\u7D22\u5F15",sublabel:"\u5236\u7D04\u4ED8\u968F\u30FBLOOKUP \u3092\u542B\u3080"},unresolved:{label:"HITL \u6607\u683C\u627F\u8A8D\u5F85\u3061\u5019\u88DC",sublabel:"\u627F\u8A8D\u30AD\u30E5\u30FC"}},Fu=Object.keys(bn).length,Ms="\u5B9F\u88C5\u304C\u8A31\u3059\u8A9E\u5F59\u3092\u8FD4\u3059\u7D4C\u8DEF\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002";function Uu(e,t){return Mu(Object.values(bn).flatMap(({label:n,sublabel:r})=>[n,r]),[Ou(e,"\u4EF6"),t])}function Bu({status:e}){return e.currentVersion===null&&e.lifecyclePhase===null?ge(tn,{children:`${e.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`}):St(tn,{children:[`${e.schemaName} `,ge($,{text:e.currentVersion===null?null:`v${e.currentVersion}`,keep:"whole",testId:"ontology-schema-version-number"})," (",ge($,{text:e.lifecyclePhase,keep:"whole",testId:"ontology-schema-phase"}),")"]})}function Fs(e){return e===null?null:String(e)}function dy({tenantId:e,ontologyStatus:t}){let{formatLocale:n,labels:r}=S(),{classes:o,predicates:a,promotionThresholds:l,unresolvedCandidatesCount:u}=t;return St(fe,{title:"\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC & \u30B9\u30AD\u30FC\u30DE\u30AC\u30D0\u30CA\u30F3\u30B9\u72B6\u614B",description:"Neo4j \u7269\u7406\u30B0\u30E9\u30D5\u30B9\u30AD\u30FC\u30DE\u5236\u7D04\u3001\u8AD6\u7406\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u30AF\u30E9\u30B9\u4F53\u7CFB\u3001\u304A\u3088\u3073\u4EBA\u9593\u53C2\u52A0\u578B (HITL) \u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u6607\u683C\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3\u306E\u7A3C\u50CD\u72B6\u6CC1",actions:ge(J,{tone:t.autonomousEvolutionEnabled?"success":"neutral",variant:"tint",testId:"ontology-evolution-badge",children:t.autonomousEvolutionEnabled?"\u81EA\u5F8B\u7684\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u9032\u5316: \u6709\u52B9":"\u81EA\u5F8B\u9032\u5316: \u505C\u6B62\u4E2D"}),testId:"ontology-status-card",children:[ge(he,{items:[{key:"schema",term:"\u30B9\u30AD\u30FC\u30DE",description:ge(s,{fg:"fg",type:"body",face:"mono",testId:"ontology-schema-version",children:ge(Bu,{status:t})})},{key:"tenant",term:"\u30C6\u30CA\u30F3\u30C8\u540D\u524D\u7A7A\u9593",description:ge(s,{fg:"fg",type:"body",face:"mono",testId:"ontology-tenant-id",children:e})},{key:"thresholds",term:"\u6607\u683C\u5224\u5B9A\u3057\u304D\u3044\u5024 (\u78BA\u4FE1\u5EA6/\u5171\u8D77)",description:St(s,{fg:"fg",type:"body",testId:"ontology-thresholds-info",children:[ge($,{text:Fs(l.confidence),keep:"whole",testId:"ontology-threshold-confidence-value"})," / ",ge($,{value:l.cooccurrence,unit:"\u56DE",testId:"ontology-threshold-cooccurrence-value"})]})}],testId:"ontology-summary"}),St(dn,{count:Fu,minInlinePx:Uu(n,r.unmeasured),testId:"ontology-metrics",children:[ge(Ue,{...bn.constraints,value:t.totalConstraints,unit:"\u4EF6",tone:"neutral",testId:"ontology-constraints-count"}),ge(Ue,{...bn.searchIndexes,value:t.searchIndexes,unit:"\u4EF6",tone:"neutral",testId:"ontology-indexes-count"}),ge(Ue,{...bn.totalIndexes,value:t.totalIndexes,unit:"\u4EF6",tone:"neutral",testId:"ontology-indexes-total"}),ge(Ue,{...bn.unresolved,value:u,unit:"\u4EF6",tone:u!==null&&u>0?"warning":"neutral",testId:"ontology-unresolved-count"})]}),ge(Te,{title:"\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u4E3B\u8981\u30AF\u30E9\u30B9\u4F53\u7CFB (Node Labels)",subtitle:St(tn,{children:["\u30B0\u30E9\u30D5\u5185\u3067\u30E2\u30C7\u30EB\u5316\u3055\u308C\u3066\u3044\u308B\u6B63\u6E96\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u30CE\u30FC\u30C9\u7A2E\u5225 (",ge($,{value:o===null?null:o.length,unit:"\u7A2E",testId:"ontology-classes-count"}),")"]}),testId:"ontology-classes",children:o===null?ge(s,{as:"p",fg:"fg-muted",type:"body",testId:"ontology-classes-unsupplied",children:`\u3053\u306E\u914D\u5099\u306E\u30AF\u30E9\u30B9\u8A9E\u5F59\u304C\u4F9B\u7D66\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002${Ms}`}):o.length===0?null:ge(he,{items:o.map(i=>({key:i.name,term:i.name,description:St(s,{fg:"fg",type:"body",children:[i.description,i.count===void 0?null:St(tn,{children:[" ",ge(J,{tone:"neutral",variant:"tint",testId:`ontology-class-count-${i.name}`,children:ge($,{value:i.count,testId:`ontology-class-count-value-${i.name}`})})]})]})})),testId:"ontology-class"})}),ge(Te,{title:"\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u8FF0\u8A9E\u4F53\u7CFB (Predicates)",subtitle:St(tn,{children:["\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u9593\u306E\u30BB\u30DE\u30F3\u30C6\u30A3\u30C3\u30AF\u95A2\u4FC2\u3068\u6709\u5411\u6027 (",ge($,{value:a===null?null:a.length,unit:"\u7A2E",testId:"ontology-predicates-count"}),")"]}),testId:"ontology-predicates",children:a===null?ge(s,{as:"p",fg:"fg-muted",type:"body",testId:"ontology-predicates-unsupplied",children:`\u3053\u306E\u914D\u5099\u306E\u8FF0\u8A9E\u8A9E\u5F59\u304C\u4F9B\u7D66\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002${Ms}`}):a.length===0?null:ge(he,{items:a.map(i=>({key:i.name,term:i.name,description:St(x,{gap:"space-1",testId:`ontology-predicate-detail-${i.name}`,children:[ge(s,{fg:"fg",type:"body",children:i.description}),ge(s,{fg:"fg-muted",type:"body",face:"mono",testId:`ontology-predicate-direction-${i.name}`,children:i.direction})]})})),testId:"ontology-predicate"})}),ge(Te,{title:"\u81EA\u5F8B\u7684\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u9032\u5316 (Autonomous Ontology Evolution) \u30DD\u30EA\u30B7\u30FC",testId:"ontology-evolution-policy-card",children:ge(he,{items:[{key:"gate",term:"3 \u6761\u4EF6 AND \u30B2\u30FC\u30C8",description:St(tn,{children:["\u672A\u89E3\u6C7A\u30E1\u30F3\u30B7\u30E7\u30F3\u51FA\u73FE\u6642\u306B\u985E\u4F3C\u5EA6 \u2267 ",ge($,{text:Fs(l.confidence),keep:"whole",testId:"ontology-policy-confidence-value"}),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",ge($,{value:l.cooccurrence,testId:"ontology-policy-cooccurrence-value"}),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267 ",ge($,{value:l.minDistinctUsers,testId:"ontology-policy-min-distinct-users-value"})," \u306E\u5168\u5145\u8DB3\u3092\u8981\u6C42\u3002"]})},{key:"backoff",term:"2x \u5171\u8D77\u983B\u5EA6\u518D\u63D0\u6848\u30D0\u30C3\u30AF\u30AA\u30D5",description:"\u904B\u7528\u8005\u306B\u3088\u308A\u6607\u683C\u3092\u5374\u4E0B\u3055\u308C\u305F\u5019\u88DC\u306F\u3001\u524D\u56DE\u306E\u5171\u8D77\u6570\u306E 2 \u500D\u4EE5\u4E0A\u306E\u983B\u5EA6\u3067\u518D\u8A00\u53CA\u3055\u308C\u308B\u307E\u3067\u6607\u683C\u30AD\u30E5\u30FC\u3078\u306E\u518D\u6D6E\u4E0A\u3092\u81EA\u52D5\u6291\u5236\u3002"},{key:"abac",term:"Cypher AST ABAC \u8A8D\u53EF\u6CE8\u5165",description:St(tn,{children:["Neo4j \u30AF\u30A8\u30EA\u5B9F\u884C\u6642\u306B"," ",ge(s,{fg:"fg",type:"body",face:"mono",children:"tenantId = $tenant_id"})," ","\u3068\u6A5F\u5BC6\u533A\u5206\u8FF0\u8A9E\u3092\u4E0D\u53EF\u5206\u306B\u5408\u6210\u3057\u3001\u30C6\u30CA\u30F3\u30C8\u5B8C\u5168\u9694\u96E2\u3092\u62C5\u4FDD\u3002"]})}],testId:"ontology-evolution-policy"})})]})}import{FLEXIBLE_COLUMN_MIN_PX as qu,fixedColumnPx as Xu,formatCount as Yu}from"@aiquants/console-ui/core";import{DOCUMENT_KIND_LABELS as In,DOCUMENT_KINDS as zs}from"@aiquants/enrichment-core";import{useEffect as Qu,useId as Ks,useMemo as js,useRef as Io,useState as Gs}from"react";import{figureBoxPlan as Hu,TOKENS as yo}from"@aiquants/console-ui/core";var Ku={column:yo.space["space-12"],row:yo.space["space-6"]},ju=yo.space["space-6"];function Us(e){if(e.length===0)throw new RangeError("A flow geometry needs the lines of at least one node");let t=e.map(r=>Hu(r)),n=[...new Set(t.map(r=>r.heightPx))];if(n.length!==1)throw new RangeError(`Every node of a flow must plan the same box height, got ${n.join(", ")} px`);return{node:{width:Math.max(...t.map(r=>r.minWidthPx)),height:n[0]},gap:Ku,padding:ju}}function Bs(e){let t=new Map;return e.map(n=>{if(t.has(n.id))throw new RangeError(`A flow names each node once, and ${n.id} comes twice`);let r=new Set;for(let o of n.depends_on){let a=t.get(o);if(a===void 0)throw new RangeError(`Node ${n.id} waits for ${o}, which is not a node before it`);for(let l of a)r.add(l)}return t.set(n.id,new Set([...n.depends_on,...r])),{id:n.id,dependsOn:n.depends_on.filter(o=>!r.has(o))}})}function qt(e){return Math.round(e*1e3)/1e3}function Gu(e){if(e.length===0)throw new RangeError("A flow to lay out has at least one node");let t=new Map;for(let n of e){if(t.has(n.id))throw new RangeError(`A flow names each node once, and ${n.id} comes twice`);let r=n.dependsOn.reduce((o,a)=>{let l=t.get(a);if(l===void 0)throw new RangeError(`Node ${n.id} depends on ${a}, which is not a node before it`);return Math.max(o,l)},-1);t.set(n.id,r+1)}return t}function bo(e,t){return`${e}->${t}`}function Vu(e,t){let n=[],r=new Map;return{slots:[...e.map(a=>{let l=t.get(a.id),u=a.dependsOn.map(i=>{let p=[],T=i;for(let E=t.get(i)+1;E<l;E+=1){let m=`${bo(i,a.id)}@${E}`;n.push({id:m,rank:E,predecessors:[T]}),p.push(m),T=m}return r.set(bo(i,a.id),p),T});return{id:a.id,rank:l,predecessors:u}}),...n],chains:r}}function Ju(e){let t=new Map,n=Math.max(...e.map(r=>r.rank));for(let r=0;r<=n;r+=1){let a=e.filter(l=>l.rank===r).map((l,u)=>{let i=r===0?u:l.predecessors.reduce((p,T)=>p+t.get(T),0)/l.predecessors.length;return{slot:l,barycenter:i}});a.sort((l,u)=>l.barycenter-u.barycenter),a.forEach(({slot:l},u)=>{t.set(l.id,u)})}return t}function Hs(e,t){let n=Gu(e),{slots:r,chains:o}=Vu(e,n),a=Ju(r),{node:l,gap:u,padding:i}=t,p=I=>({x:qt(i+I.rank*(l.width+u.column)),y:qt(i+a.get(I.id)*(l.height+u.row))}),T=new Map(r.map(I=>[I.id,p(I)])),E=e.map(I=>{let U=T.get(I.id);return{id:I.id,x:U.x,y:U.y,rank:n.get(I.id),order:a.get(I.id),width:l.width,height:l.height}}),m=I=>qt(I+l.height/2),c=e.flatMap(I=>I.dependsOn.map(U=>{let w=T.get(U),ne=T.get(I.id),N=qt(w.x+l.width),B=m(w.y),R=`M ${N} ${B}`,M=(K,ae)=>{let Ee=qt((N+K)/2);R+=` C ${Ee} ${B}, ${Ee} ${ae}, ${K} ${ae}`};for(let K of o.get(bo(U,I.id))){let ae=T.get(K),Ee=m(ae.y);M(ae.x,Ee),N=qt(ae.x+l.width),B=Ee,R+=` L ${N} ${B}`}return M(ne.x,m(ne.y)),{from:U,to:I.id,path:R}})),_=[...T.values()],f=qt(Math.max(..._.map(I=>I.x+l.width))+i),C=qt(Math.max(..._.map(I=>I.y+l.height))+i);return{width:f,height:C,nodes:E,edges:c}}import{Fragment as si,jsx as Q,jsxs as Ne}from"react/jsx-runtime";var Vs="\u53D6\u308A\u8FBC\u307F\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3",Js="\u5B9F\u884C\u5668\u304C\u8D70\u3089\u305B\u308B\u6D41\u308C\u3092\u3001\u6587\u66F8\u306E\u7A2E\u985E\u3054\u3068\u306B\u63CF\u304D\u307E\u3059\u3002",zu="read_children",qs="\u4F9D\u5B58\u306A\u3057 (\u6D41\u308C\u306E\u6700\u521D\u306B\u8D70\u308B)",Ws={EXTRACTING:"\u62BD\u51FA",ENRICHING:"\u8981\u7D04",PROJECTING:"\u6295\u5F71"},ho={open:{badge:"\u9580: \u958B",tone:"success",outline:"solid"},"closed-skip":{badge:"\u9580: \u9589 (\u7701\u7565)",tone:"warning",outline:"solid"},"closed-fail":{badge:"\u9580: \u9589 (\u5931\u6557)",tone:"danger",outline:"solid"},unmeasured:{badge:"\u9580: \u672A\u6E2C\u5B9A",tone:"neutral",outline:"dashed"}},Zs={none:"\u9580\u306A\u3057",skip:"\u9589\u3058\u305F\u3089\u7701\u7565",fail:"\u9589\u3058\u305F\u3089\u5931\u6557",mixed:"\u9589\u3058\u305F\u9580\u3067\u7570\u306A\u308B"},Wu={open:"\u958B",closed:"\u9589",unmeasured:"\u672A\u6E2C\u5B9A"},Zu="fg",ep=2,Xs="MIME \u578B\u304B\u3089\u7A2E\u985E\u3078\u306E\u5206\u985E\u8868",tp="MIME \u578B\u306E\u30D1\u30BF\u30FC\u30F3",ei="\u7A2E\u985E",Ys=zs.map(e=>In[e]),np=Xu({header:ei},[{kind:"text",texts:Ys,face:"sans",type:"body"},{kind:"pill",labels:Ys}]);function ti(e){let t=new Map;for(let n of e.flows)if(n.purpose==="document")for(let r of n.document_kinds)t.set(r,n);return new Map(zs.flatMap(n=>t.has(n)?[[n,t.get(n)]]:[]))}function ni(e,t){let n=t[e.flag];return n===void 0?"unmeasured":n?"open":"closed"}function rp(e,t){let n=e.map(r=>({gate:r,state:ni(r,t)}));return n.some(({gate:r,state:o})=>o==="closed"&&r.when_closed==="fail")?"closed-fail":n.some(({state:r})=>r==="closed")?"closed-skip":n.some(({state:r})=>r==="unmeasured")?"unmeasured":"open"}function op(e){return e.length===0?"none":e.every(t=>t.when_closed==="fail")?"fail":e.every(t=>t.when_closed==="skip")?"skip":"mixed"}function ri(e,t){let{badge:n}=ho[e];return t==="none"||e==="closed-skip"||e==="closed-fail"?n:`${n}\u30FB${Zs[t]}`}function ap(e){return e.when_closed==="skip"?"\u9589\u3058\u305F\u3068\u304D\u306F\u6BB5\u3092\u7701\u7565":`\u9589\u3058\u305F\u3068\u304D\u306F ${e.failure_status} \u3067\u5931\u6557`}function oi(e,t){return[Ws[e],t]}var sp=[...new Set(Object.keys(ho).flatMap(e=>Object.keys(Zs).map(t=>ri(e,t))))];function ip(e){let t=new Map;for(let n of ti(e).values())for(let r of n.nodes)t.set(JSON.stringify([r.title.ja,r.phase]),{name:r.title.ja,phase:r.phase});return Us([...t.values()].flatMap(({name:n,phase:r})=>sp.map(o=>({name:n,notes:oi(r,o)}))))}function Qs(e,t){return e===null?null:`${Yu(e,t)} ms`}function ai(e){return`${e.title.ja} (${mn({flowKey:e.key,flowVersion:e.version})})`}function lp(e){return typeof e=="string"?e:JSON.stringify(e)}function dp(e){return e.parameters.length===0?Q("span",{"data-testid":"flow-step-no-parameters",children:"\u5F15\u6570\u306A\u3057"}):Q($e,{marker:"bullet",type:"body",gap:"space-1",testId:"flow-step-parameters",children:e.parameters.map(t=>{let n=Q(s,{fg:"fg",type:"body",face:"mono",children:lp(t.value)});return Ne(we,{testId:`flow-step-parameter-${t.name}`,children:[t.title.ja,":"," ",t.value_title===null?n:Ne(si,{children:[t.value_title.ja," (",n,")"]})]},t.name)})})}function cp(e){return e.length===0?Q("span",{"data-testid":"flow-step-no-child-flows",children:"\u76EE\u9332\u306B\u5B50\u306E\u6D41\u308C\u304C\u3042\u308A\u307E\u305B\u3093"}):Ne(x,{gap:"space-1",testId:"flow-step-child-flows",children:[Q($e,{marker:"bullet",type:"body",gap:"space-1",testId:"flow-step-child-flow-list",children:e.map(t=>Q(we,{testId:`flow-child-flow-${t.key}`,dataAttributes:{"data-flow-key":t.key},children:`${ai(t)}: ${t.nodes.map(n=>n.title.ja).join("\u3001")}`},t.key))}),Q(s,{as:"p",fg:"fg-muted",type:"body",testId:"flow-step-child-flow-note",children:"\u5B50\u3054\u3068\u306B\u3001\u3053\u306E\u6BB5\u304C\u305D\u306E\u3069\u308C\u304B 1 \u3064\u3092\u8D70\u3089\u305B\u307E\u3059\u3002\u3069\u306E\u5B50\u304C\u3069\u306E\u6D41\u308C\u3092\u53D6\u308B\u304B\u306F\u914D\u5099\u306E\u7D50\u3073\u4ED8\u3051\u304C\u6C7A\u3081\u3001\u6D41\u308C\u306E\u76EE\u9332\u306F\u7B54\u3048\u307E\u305B\u3093\u3002"})]})}function Sy({catalog:e,featureFlags:t,metrics:n,metricSampleWindow:r,selectedKind:o,onSelectKind:a,selectedNodeId:l,onSelectNode:u}){if(!Number.isSafeInteger(r)||r<=0)throw new RangeError(`metricSampleWindow must be a positive integer, got ${r}.`);let i=js(()=>ti(e),[e]);if(o!==void 0&&!i.has(o))throw new RangeError(`selectedKind ${o} names a kind no document flow of the catalogue runs (${[...i.keys()].join(", ")}).`);let p=js(()=>i.size===0?null:ip(e),[e,i]),T=Ks(),E=Ks(),[m,c]=Gs(null),[_,f]=Gs(null),C=Io(null),I=Io(null),U=Io(null),{labels:w,formatLocale:ne}=S(),N=[...i.keys()][0],B=o!==void 0?o:m!==null&&i.has(m)?m:N,R=B===void 0?void 0:i.get(B),M=l!==void 0?l:_,K=g=>{f(g),u?.(g)},ae=g=>{c(g),a?.(g),K(null)},Ee=g=>[...C.current.querySelectorAll('[role="button"][data-node-id]')].find(se=>se.dataset.nodeId===g),v=g=>{let se=U.current;if(K(null),se?.isConnected){se.focus();return}Ee(g)?.focus()},q=g=>{K(g===M?null:g)},H=R===void 0||M===null?void 0:R.nodes.find(g=>g.id===M),O=H===void 0?null:H.id;Qu(()=>{if(O===null){U.current=null;return}let g=document.activeElement;(g instanceof HTMLElement||g instanceof SVGElement)&&g!==document.body&&I.current?.contains(g)===!1&&(U.current=g)},[O]);let Y=Q(Te,{title:Xs,subtitle:Ne(si,{children:["\u6D41\u308C\u306E\u76EE\u9332\u304C\u7B54\u3048\u308B\u8868\u305D\u306E\u3082\u306E\u3067\u3001\u5B9F\u884C\u5668\u306F\u6587\u66F8\u306B\u8A18\u9332\u3055\u308C\u305F MIME \u578B\u304B\u3089\u8D70\u3089\u305B\u308B\u6D41\u308C\u306E\u7A2E\u985E\u3092\u3053\u308C\u3067\u6C7A\u3081\u307E\u3059\u3002",Q(s,{fg:"fg-muted",type:"body",face:"mono",children:"*"})," ","\u3067\u7D42\u308F\u308B\u898F\u5247\u306F\u524D\u65B9\u4E00\u81F4\u3001\u305D\u308C\u4EE5\u5916\u306F\u5B8C\u5168\u4E00\u81F4\u3067 (\u578B\u306E\u5F15\u6570\u3068\u5927\u6587\u5B57\u5C0F\u6587\u5B57\u306F\u7121\u8996\u3057\u307E\u3059)\u3001\u6700\u521D\u306B\u4E00\u81F4\u3057\u305F\u898F\u5247\u304C\u52DD\u3061\u307E\u3059\u3002\u3069\u306E\u898F\u5247\u306B\u3082\u4E00\u81F4\u3057\u306A\u3044\u578B\u306F\u300C",In.other,"\u300D\u3067\u3059\u3002"]}),testId:"flow-mime",children:Q(Re,{caption:Xs,captionHidden:!0,columns:[{key:"pattern",header:tp,width:{minPx:qu},align:"start",cell:({rule:g})=>Q(s,{fg:"fg",type:"body",face:"mono",children:g.pattern})},{key:"kind",header:ei,width:{fixedPx:np},align:"start",cell:({rule:g})=>g.document_kind===B?Q(J,{tone:"info",variant:"tint",testId:"flow-mime-selected-kind",children:In[g.document_kind]}):In[g.document_kind]}],rows:e.mime_kind_rules.map((g,se)=>({rule:g,position:se})),rowKey:({position:g})=>String(g),rowTestId:"flow-mime-rule",rowData:({rule:g})=>({"data-kind":g.document_kind,"data-selected":String(g.document_kind===B)}),rowSize:"row",empty:"\u5206\u985E\u306E\u898F\u5247\u304C\u3042\u308A\u307E\u305B\u3093 (\u5168\u3066\u306E\u578B\u304C\u300C\u305D\u306E\u4ED6\u300D\u3067\u3059)\u3002",testId:"flow-mime-table"})});if(B===void 0||R===void 0||p===null)return Q(fe,{title:Vs,description:Js,ref:C,testId:"pipeline-flow-viewer",children:Ne(x,{gap:"space-6",testId:"flow-sections",children:[Q(s,{as:"p",fg:"fg",type:"body",testId:"flow-no-document-flows",children:"\u6D41\u308C\u306E\u76EE\u9332\u306B\u3001\u6587\u66F8\u306E\u7A2E\u985E\u304C\u8D70\u308B\u6D41\u308C\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}),Y]})});let et=Bs(R.nodes),Ce=new Map(et.map(g=>[g.id,g.dependsOn])),F=Hs(et,p),Se=new Map(R.nodes.map(g=>[g.id,g])),ue=g=>g.map(se=>Se.get(se).title.ja).join("\u3001"),re=g=>{let se=Ce.get(g);return se.length===0?qs:`\u4F9D\u5B58: ${ue(se)}`},Z=In[B],be=[...i.keys()].map(g=>({id:g,label:In[g]})),ze=H===void 0?[]:H.depends_on.filter(g=>!Ce.get(H.id).includes(g)),G=H===void 0?[]:R.nodes.filter(g=>g.depends_on.includes(H.id)).map(g=>g.id),ee=H===void 0?void 0:n.find(g=>g.documentKind===B&&g.stepKey===H.step),Ie=e.flows.filter(g=>g.purpose==="child_reading");return Q(fe,{title:Vs,description:`${Js}\u56F3\u306F\u6BB5\u306E\u9806\u5E8F\u3092\u793A\u3057\u3001\u4ED6\u306E\u6BB5\u3092\u901A\u3057\u3066\u65E2\u306B\u5F85\u3064\u6BB5\u3078\u306E\u8FBA\u306F\u63CF\u304D\u307E\u305B\u3093 (\u8A73\u7D30\u306F\u5168\u3066\u306E\u8FBA\u3092\u4E26\u3079\u307E\u3059)\u3002\u9580\u306E\u72B6\u614B\u306F\u30C6\u30CA\u30F3\u30C8\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u3092\u91CD\u306D\u305F\u3082\u306E\u3067\u3059\u3002`,ref:C,testId:"pipeline-flow-viewer",dataAttributes:{"data-kind":B},children:Ne(x,{gap:"space-6",testId:"flow-sections",children:[Q(Ho,{label:"\u6587\u66F8\u306E\u7A2E\u985E",items:be,value:B,onValueChange:g=>ae(g),panelDescribedBy:T,testId:"flow-kind",children:Ne(x,{gap:"space-2",testId:"flow-figure",children:[Ne(s,{as:"p",fg:"fg-secondary",type:"body",testId:"flow-identity",children:["\u6D41\u308C: ",ai(R)]}),Ne(Go,{kind:"group",label:`${Z} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`,widthPx:F.width,heightPx:F.height,onEscape:()=>K(null),testId:"flow-svg",children:[F.edges.map(g=>Q(Jo,{d:g.path,emphasis:"normal",weight:ep,arrow:!0,testId:`flow-edge-${g.from}-${g.to}`},`${g.from}-${g.to}`)),F.nodes.map(g=>{let se=Se.get(g.id),D=rp(se.gates,t),ie=op(se.gates),{tone:Ke,outline:tt}=ho[D],mt=ri(D,ie),Pe=g.id===M;return Q(Vo,{x:g.x,y:g.y,shape:{kind:"box",widthPx:g.width},tone:Ke,outline:tt,selected:Pe,name:se.title.ja,notes:oi(se.phase,mt).map(it=>({text:it,fg:Zu})),press:{label:`${se.title.ja} (${mt})`,description:re(g.id),expanded:Pe,controls:E,onPress:()=>q(g.id)},testId:`flow-node-${g.id}`,dataAttributes:{"data-node-id":g.id,"data-step-key":se.step,"data-gate-state":D,"data-gate-policy":ie}},g.id)})]}),Ne(s,{as:"p",fg:"fg-muted",type:"caption",id:T,testId:"flow-scroll-hint",children:["\u56F3\u306F\u5B9F\u5BF8 (\u5E45 ",F.width," px) \u3067\u63CF\u304D\u307E\u3059\u3002\u8868\u793A\u5E45\u306B\u53CE\u307E\u3089\u306A\u3044\u3068\u304D\u306F\u6A2A\u306B\u30B9\u30AF\u30ED\u30FC\u30EB\u3057\u3066\u304F\u3060\u3055\u3044 (Tab \u3067\u6BB5\u3078\u79FB\u308B\u3068\u3001\u305D\u306E\u6BB5\u304C\u898B\u3048\u308B\u4F4D\u7F6E\u307E\u3067\u52D5\u304D\u307E\u3059)\u3002"]})]})}),H!==void 0&&Q(Te,{region:!0,id:E,ref:I,title:H.title.ja,subtitle:Q("span",{"data-testid":"flow-step-description",children:H.description.ja}),onEscape:()=>v(H.id),testId:"flow-step-detail",dataAttributes:{"data-node-id":H.id,"data-step-key":H.step},children:Ne(x,{gap:"space-4",testId:"flow-step-detail-body",children:[Q(X,{gap:"space-2",testId:"flow-step-detail-actions",children:Q(V,{variant:"secondary",onClick:()=>v(H.id),testId:"flow-step-detail-close",children:"\u9589\u3058\u308B"})}),Q(he,{items:[{key:"step",term:"\u6BB5 (\u7248)",description:Ne("span",{"data-testid":"flow-step-key",children:[Q(s,{fg:"fg",type:"body",face:"mono",children:H.step})," ","(\u7248 ",H.step_version,")"]})},{key:"phase",term:"\u76F8",description:Ne("span",{"data-testid":"flow-step-phase",children:[Ws[H.phase]," (",H.phase,")"]})},{key:"capability",term:"\u80FD\u529B",description:Q("span",{"data-testid":"flow-step-capability",children:H.capability===null?"\u30E2\u30C7\u30EB\u3078\u9001\u3089\u306A\u3044":H.capability})},{key:"parameters",term:"\u5F15\u6570",description:dp(H)},{key:"depends-on",term:"\u4F9D\u5B58 (\u5148\u306B\u7D42\u3048\u308B\u6BB5)",description:H.depends_on.length===0?Q("span",{"data-testid":"flow-step-depends-on",children:qs}):Ne(x,{gap:"space-1",testId:"flow-step-dependencies",children:[Q("span",{"data-testid":"flow-step-depends-on",children:ue(H.depends_on)}),ze.length>0&&Ne(s,{as:"p",fg:"fg-muted",type:"body",testId:"flow-step-indirect-dependencies",children:["\u56F3\u306F\u3001\u4ED6\u306E\u6BB5\u3092\u901A\u3057\u3066\u65E2\u306B\u5F85\u3064\u6BB5 (",ue(ze),") \u3078\u306E\u8FBA\u3092\u63CF\u304D\u307E\u305B\u3093\u3002"]})]})},{key:"dependents",term:"\u5F8C\u7D9A (\u3053\u306E\u6BB5\u3092\u5F85\u3064\u6BB5)",description:Q("span",{"data-testid":"flow-step-dependents",children:G.length===0?"\u5F8C\u7D9A\u306A\u3057 (\u6D41\u308C\u306E\u6700\u5F8C\u306B\u8D70\u308B)":ue(G)})},{key:"gates",term:"\u9580",description:H.gates.length===0?Q("span",{"data-testid":"flow-step-no-gates",children:"\u9580\u306A\u3057 (\u5E38\u306B\u8D70\u308B)"}):Ne(x,{gap:"space-1",testId:"flow-step-gates",children:[Q($e,{marker:"bullet",type:"body",gap:"space-1",testId:"flow-step-gate-list",children:H.gates.map(g=>{let se=ni(g,t);return Ne(we,{testId:`flow-gate-${g.flag}`,dataAttributes:{"data-gate-state":se,"data-when-closed":g.when_closed},children:[Q(s,{fg:"fg",type:"body",face:"mono",children:g.flag}),": ",Wu[se]," \u2014 ",ap(g)]},g.flag)})}),H.gate_policy!==null&&Ne(s,{as:"p",fg:"fg-muted",type:"body",testId:"flow-gate-policy-override",children:[R.title.ja," \u306E\u6D41\u308C\u306F\u6BB5\u306E\u5BA3\u8A00\u3092\u4E0A\u66F8\u304D\u3057\u3001\u9580\u304C\u9589\u3058\u308B\u3068\u5B9F\u884C\u3092 ",H.gate_policy.failure_status," \u3067\u5931\u6557\u3055\u305B\u307E\u3059\u3002"]})]})},...H.step===zu?[{key:"child-flows",term:"\u5B50\u306E\u6D41\u308C",description:cp(Ie)}]:[]],testId:"flow-step-definition"}),Q(Te,{level:4,title:`\u76F4\u8FD1\u306E\u96C6\u8A08 (${Z}\u30FB\u76F4\u8FD1 ${r} \u4EF6)`,subtitle:Ne("span",{"data-testid":"flow-metric-scope",children:[Z," \u306E\u5B9F\u884C\u306B\u5C5E\u3059\u308B\u3001\u3053\u306E\u6BB5\u306E\u65B0\u3057\u3044\u8A18\u9332 ",r," \u4EF6\u307E\u3067\u3092\u96C6\u8A08\u3057\u3066\u3044\u307E\u3059\u3002\u4ED6\u306E\u7A2E\u985E\u306E\u5B9F\u884C\u306F\u6570\u3048\u307E\u305B\u3093\u3002"]}),testId:"flow-step-metric",dataAttributes:{"data-kind":B},children:ee===void 0?Q("div",{"data-testid":"flow-step-metric-empty","data-unmeasured-note":!0,children:Ne(s,{as:"p",fg:"fg-muted",type:"body",children:[w.unmeasured," (",Z," \u306E\u5B9F\u884C\u3067\u3053\u306E\u6BB5\u3092\u8A18\u9332\u3057\u305F\u3082\u306E\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093)"]})}):Ne(x,{gap:"space-2",testId:"flow-step-metric-figures",children:[Q(he,{items:[{key:"sample-count",term:"\u6A19\u672C\u6570 (\u7701\u7565\u3092\u9664\u304F)",description:Q($,{value:ee.sampleCount,testId:"flow-metric-sample-count-value"})},{key:"succeeded",term:"\u6210\u529F",description:Q($,{value:ee.succeeded,testId:"flow-metric-succeeded-value"})},{key:"failed",term:"\u5931\u6557",description:Q($,{value:ee.failed,testId:"flow-metric-failed-value"})},{key:"skipped",term:"\u7701\u7565",description:Q($,{value:ee.skipped,testId:"flow-metric-skipped-value"})},{key:"p50",term:"p50",description:Q($,{text:Qs(ee.durationP50Ms,ne),keep:"whole",testId:"flow-metric-p50-value"})},{key:"p95",term:"p95",description:Q($,{text:Qs(ee.durationP95Ms,ne),keep:"whole",testId:"flow-metric-p95-value"})},{key:"last-started-at",term:"\u6700\u5F8C\u306E\u958B\u59CB",description:Q(le,{iso:ee.lastStartedAt,testId:"flow-metric-last-started-at-value"})}],testId:"flow-metric"}),Q("div",{"data-testid":"flow-metric-note","data-unmeasured-note":!0,children:Ne(s,{as:"p",fg:"fg-muted",type:"caption",children:["p50 / p95 \u306F\u6240\u8981\u3092\u6E2C\u3063\u305F\u8A18\u9332\u3060\u3051\u304B\u3089\u6C42\u3081\u307E\u3059\u3002\u7701\u7565\u3057\u305F\u6BB5\u306F\u300C\u7701\u7565\u300D\u306B\u3060\u3051\u6570\u3048\u3001\u6A19\u672C\u6570\u306B\u3082\u6240\u8981\u306B\u3082\u5165\u308A\u307E\u305B\u3093\u3002\u4F55\u3082\u547C\u3070\u305A\u306B\u6B62\u307E\u3063\u305F\u5931\u6557 (\u6240\u8981 ",w.unmeasured,") \u306F\u6A19\u672C\u6570\u3068\u300C\u5931\u6557\u300D\u306B\u306F\u5165\u308A\u307E\u3059\u304C\u3001\u6240\u8981\u306B\u306F\u5165\u308A\u307E\u305B\u3093\u3002"]})})]})})]})}),Y]})})}import{countSampleText as up,FLEXIBLE_COLUMN_MIN_PX as Eo,fixedColumnPx as pp,isReadableText as mp,tileMinInlinePx as fp}from"@aiquants/console-ui/core";import{Fragment as Ro,jsx as Le,jsxs as pt}from"react/jsx-runtime";function gp(e,t){return e==null?null:yt(e,"segment_count",t)}function ii(e,t,n){return e==null?null:Dn(e,t,n)}function yp(e){let t=e.probe_failure;if(t===null)return null;if(!mp(t))throw new RangeError("overview.probe_failure must name why the collections could not be read (pass null when they were measured)");if(e.collections.length>0)throw new RangeError(`overview carries ${e.collections.length} collections and a probe_failure; pass the collections with probe_failure null, or an empty list with the reason`);return t}function li(e,t,n){return e.reduce((r,o)=>r+yt(o[t],`${t} of collection ${o.collection_name}`,n),0)}var So="\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7",Un={name:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D",domain:"\u30C9\u30E1\u30A4\u30F3",points:"\u30DD\u30A4\u30F3\u30C8\u6570",vectors:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"},di="\u767B\u9332\u3055\u308C\u3066\u3044\u308B\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306F\u3042\u308A\u307E\u305B\u3093\u3002",bp=Number.MAX_SAFE_INTEGER,nn={points:{label:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570",sublabel:"\u5168\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306E\u5408\u8A08"},vectors:{label:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570",sublabel:"\u5168\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306E\u5408\u8A08"},ram:{label:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)",sublabel:"\u30A8\u30F3\u30B8\u30F3\u5168\u4F53"},disk:{label:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB",sublabel:"\u30A8\u30F3\u30B8\u30F3\u5168\u4F53"},segments:{label:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570",sublabel:"\u5168\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306E\u5408\u8A08"}},Ip=Object.keys(nn).length;function ci(e,t){return`vectors_config.${e}.size of collection ${t}`}function hp(e,t){let{dense:n,image:r}=e.vectors_config;return{collection:e,denseSize:n===void 0?null:yt(n.size,ci("dense",e.collection_name),t),imageSize:r===void 0?null:yt(r.size,ci("image",e.collection_name),t)}}function Ep(e,t){return fp(Object.values(nn).flatMap(({label:n,sublabel:r})=>[n,r]),[up(e),Dn(bp,"the widest byte size",e),t])}function ui({row:e,as:t}){let n=e.collection.collection_name,{sparse:r}=e.collection.vectors_config;return e.denseSize===null&&r===void 0&&e.imageSize===null?null:pt(X,{as:t,gap:"space-2",testId:`vector-tags-${n}`,children:[e.denseSize!==null&&pt(J,{tone:"neutral",variant:"tint",testId:`vector-tag-dense-${n}`,children:["Dense: ",Le($,{value:e.denseSize,unit:"\u6B21\u5143",testId:`vector-tag-dense-size-${n}`})]})," ",r!==void 0&&Le(J,{tone:"neutral",variant:"tint",testId:`vector-tag-sparse-${n}`,children:r.modifier?`Sparse (${r.modifier.toUpperCase()})`:"Sparse"})," ",e.imageSize!==null&&pt(J,{tone:"neutral",variant:"tint",testId:`vector-tag-image-${n}`,children:["Image: ",Le($,{value:e.imageSize,unit:"\u6B21\u5143",testId:`vector-tag-image-size-${n}`})]})]})}function Ly({overview:e,health:t,resources:n,onRefresh:r,isRefreshing:o=!1,selection:a}){let{formatLocale:l,labels:u}=S(),{collections:i}=e,p=yp(e),T=p===null,E=T?li(i,"points_count",l):null,m=T?li(i,"vectors_count",l):null,c=ii(n?.ram_bytes,"ram_bytes",l),_=ii(n?.disk_bytes,"disk_bytes",l),f=gp(n?.segment_count,l),C=i.map(w=>hp(w,l)),I=t===void 0?null:t.healthy?"connected":"error",U=t===void 0&&r===void 0?void 0:pt(Ro,{children:[t!==void 0&&I!==null&&pt(Ro,{children:[Le(J,{tone:Mn[I],variant:"tint",testId:"qdrant-health-badge",dataAttributes:{"data-healthy":String(t.healthy)},children:yn[I]}),pt(s,{fg:"fg-muted",type:"body",testId:"qdrant-latency",children:["\u5FDC\u7B54\u6642\u9593: ",Le($,{value:t.latency_ms,unit:"ms",testId:"qdrant-latency-value"})]})]}),r!==void 0&&Le(V,{variant:"secondary",busy:o,busyLabel:"\u66F4\u65B0\u4E2D\u2026",onClick:r,testId:"qdrant-refresh-button",children:"\u66F4\u65B0"})]});return pt(fe,{title:"Qdrant \u30D9\u30AF\u30C8\u30EB\u30B9\u30C8\u30EC\u30FC\u30B8\u76E3\u8996",actions:U,testId:"qdrant-storage-card",children:[pt(dn,{count:Ip,minInlinePx:Ep(l,u.unmeasured),testId:"qdrant-resource-tiles",children:[Le(Ue,{...nn.points,value:E,tone:"neutral",testId:"qdrant-total-points"}),Le(Ue,{...nn.vectors,value:m,tone:"neutral",testId:"qdrant-total-vectors"}),Le(Ue,{...nn.ram,text:c,tone:"neutral",testId:"qdrant-ram-usage"}),Le(Ue,{...nn.disk,text:_,tone:"neutral",testId:"qdrant-disk-usage"}),Le(Ue,{...nn.segments,value:f,tone:"neutral",testId:"qdrant-segment-count"})]}),Le(Te,{title:So,subtitle:Le($,{value:T?i.length:null,unit:"\u4EF6",testId:"qdrant-collections-count"}),testId:"qdrant-collections",children:p!==null?Le(Oe,{tone:"warning",testId:"qdrant-probe-failure",children:p}):a===void 0?Le(Re,{caption:So,captionHidden:!0,columns:[{key:"name",header:Un.name,width:{fixedPx:pp({header:Un.name},i.length===0?[]:[{kind:"text",texts:i.map(w=>w.collection_name),face:"sans",type:"body"}])},align:"start",cell:({collection:w})=>Le(s,{fg:"fg",type:"body",testId:`collection-name-${w.collection_name}`,children:w.collection_name})},{key:"domain",header:Un.domain,width:{minPx:Eo},align:"start",cell:({collection:w})=>Le(s,{fg:"fg-secondary",type:"body",children:w.domain_key})},{key:"points",header:Un.points,width:{minPx:Eo},align:"end",cell:({collection:w})=>Le($,{value:w.points_count,testId:`collection-points-value-${w.collection_name}`})},{key:"vectors",header:Un.vectors,width:{minPx:Eo},align:"start",cell:w=>Le(ui,{row:w,as:"div"})}],rows:C,rowKey:({collection:w})=>w.collection_name,rowTestId:"collection-row",rowData:({collection:w})=>({"data-collection-name":w.collection_name}),rowSize:"row",empty:di,testId:"qdrant-collections-list"}):Le(ln,{label:So,items:C,itemKey:({collection:w})=>w.collection_name,selectedKey:a.selectedCollectionName,onSelect:({collection:w})=>a.onSelectCollection(w.collection_name),detailId:a.detailId,renderRow:w=>pt(Ro,{children:[Le(s,{fg:"fg",type:"body",testId:`collection-name-${w.collection.collection_name}`,children:w.collection.collection_name})," ",pt(X,{as:"span",gap:"space-2",testId:`collection-facts-${w.collection.collection_name}`,children:[pt(s,{fg:"fg-muted",type:"body",children:["\u30C9\u30E1\u30A4\u30F3: ",w.collection.domain_key]})," ",pt(s,{fg:"fg-muted",type:"body",children:["\u30DD\u30A4\u30F3\u30C8\u6570: ",Le($,{value:w.collection.points_count,testId:`collection-points-value-${w.collection.collection_name}`})]})," ",Le(ui,{row:w,as:"span"})]})]}),rowTestId:"collection-select",rowData:({collection:w})=>({"data-collection-name":w.collection_name}),empty:di,testId:"qdrant-collections-list"})})]})}import{countSampleText as pi,FLEXIBLE_COLUMN_MIN_PX as To,fixedColumnPx as mi,formatCount as Sp,tileMinInlinePx as Rp}from"@aiquants/console-ui/core";import{useId as fi}from"react";import{Fragment as Po,jsx as xe,jsxs as on}from"react/jsx-runtime";var Tp="\u30A8\u30F3\u30EA\u30C3\u30C1\u30E1\u30F3\u30C8\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9",hi="\u5BFE\u8C61\u306A\u3057",_p="100.0%",_o="\u540C\u671F\u5931\u6557\u30A2\u30A4\u30C6\u30E0\u4E00\u89A7",xp="\u518D\u8A66\u884C\u3059\u308B\u5931\u6557\u306F\u3042\u308A\u307E\u305B\u3093\u3002",Cp="\u540C\u671F\u3092\u518D\u8A66\u884C\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",gi="\u518D\u8A66\u884C\u3092\u9001\u4FE1\u4E2D\u3067\u3059\u3002\u7D42\u308F\u308B\u307E\u3067\u307B\u304B\u306E\u518D\u8A66\u884C\u306F\u3067\u304D\u307E\u305B\u3093\u3002",yi="\u518D\u8A66\u884C",bi="\u518D\u8A66\u884C\u4E2D...",rn={file:"\u30D5\u30A1\u30A4\u30EB URI",status:"\u72B6\u614B",error:"\u30A8\u30E9\u30FC\u5185\u5BB9",time:"\u5931\u6557\u65E5\u6642",action:"\u64CD\u4F5C"},xo="\u8A18\u9332\u306A\u3057",Co="retry-all",Xt={total:{label:"\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570",sublabel:"\u540C\u671F\u306E\u5BFE\u8C61"},rate:{label:"\u540C\u671F\u5B8C\u4E86\u7387",sublabel:"\u5B8C\u5168\u540C\u671F \xF7 \u7DCF\u30D5\u30A1\u30A4\u30EB\u6570"},synced:{label:"\u5B8C\u5168\u540C\u671F",sublabel:"SYNCED"},processing:{label:"\u51E6\u7406\u4E2D",sublabel:"PROCESSING"},pending:{label:"\u5F85\u6A5F\u4E2D",sublabel:"PENDING"},failed:{label:"\u5931\u6557",sublabel:"FAILED"}},kp=Object.keys(Xt).length;function Bt(e,t,n){let r=e[t];return r===void 0?0:yt(r,`counts.${t}`,n)}function Pp(e){return Rp(Object.values(Xt).flatMap(({label:t,sublabel:n})=>[t,n]),[pi(e,"\u4EF6"),pi(e),_p,hi])}var ko=e=>`retry:${String(e)}`,Ii=({item:e,verb:t})=>on(Po,{children:[xe(Nt,{testId:`retry-item-button-${e.id}-subject`,children:`${e.file_name} (${e.file_uri}) \u3092`}),t]});function Uy({counts:e,totalFiles:t,failedItems:n=[],onRetryAll:r,onRetryItem:o,canSendCommands:a,isRetrying:l=!1,onRefresh:u,listRefusal:i,onShowAllFailures:p,headingRef:T}){let{formatLocale:E,timeZone:m}=S(),{pendingKey:c,press:_}=Ko(),f=fi(),C=fi(),I=yt(t,"totalFiles",E),U=Bt(e,"SYNCED",E),w=Bt(e,"PENDING",E),ne=Bt(e,"EXTRACTING",E)+Bt(e,"ENRICHING",E)+Bt(e,"PROJECTING",E),N=Bt(e,"FAILED_EXTRACT",E)+Bt(e,"FAILED_ENRICH",E)+Bt(e,"FAILED_VECTOR",E)+Bt(e,"FAILED_GRAPH",E),B=I>0?`${(U/I*100).toFixed(1)}%`:hi,R=a?c===Co?void 0:N===0?{reason:xp}:l?{reason:gi}:void 0:{reasonId:C},M=o!==void 0&&i===void 0&&n.some(O=>O.kind==="readable"),K=a&&l&&M,ae=!a&&(r!==void 0||M),Ee=Sp(n.length,E),v=i!==void 0?_o:`${_o} (${n.length<N?`\u4E0A\u4F4D ${Ee} \u4EF6 / \u5168 ${cn(N,"the failed count",E)} \u4EF6`:`${Ee} \u4EF6`})`,q=n.map((O,Y)=>({entry:O,position:Y}));return on(fe,{title:Tp,headingRef:T,description:ae?xe(s,{fg:"fg-muted",type:"body",id:C,testId:"sync-status-monitor-forbidden-note",children:Cp}):void 0,actions:u===void 0&&r===void 0?void 0:on(Po,{children:[u!==void 0&&xe(V,{variant:"secondary",onClick:u,testId:"sync-refresh-button",children:"\u66F4\u65B0"}),r!==void 0&&xe(V,{variant:"primary",busy:a&&c===Co,busyLabel:"\u518D\u8A66\u884C\u4E2D...",unavailable:R,onClick:()=>_(Co,r),testId:"retry-all-button",children:"\u5931\u6557\u30B8\u30E7\u30D6\u4E00\u62EC\u518D\u8A66\u884C"})]}),testId:"sync-status-monitor",children:[on(dn,{count:kp,minInlinePx:Pp(E),testId:"sync-status-tiles",children:[xe(Ue,{...Xt.total,value:I,unit:"\u4EF6",tone:"neutral",testId:"total-files"}),xe(Ue,{...Xt.rate,text:B,tone:"neutral",testId:"success-rate"}),xe(Ue,{...Xt.synced,value:U,tone:U>0?"success":"neutral",testId:"status-card-synced",dataAttributes:{"data-count":U}}),xe(Ue,{...Xt.processing,value:ne,tone:"neutral",testId:"status-card-processing",dataAttributes:{"data-count":ne}}),xe(Ue,{...Xt.pending,value:w,tone:"neutral",testId:"status-card-pending",dataAttributes:{"data-count":w}}),xe(Ue,{...Xt.failed,value:N,tone:N>0?"danger":"neutral",testId:"status-card-failed",dataAttributes:{"data-count":N}})]}),on(Te,{title:v,testId:"failed-items-section",children:[p!==void 0&&i===void 0&&xe(Jn,{onNavigate:p,testId:"failed-items-all-failures",children:"\u5168\u3066\u306E\u5931\u6557\u3092\u898B\u308B"}),i!==void 0?xe(Oe,{tone:"warning",testId:"failed-items-refused",children:i}):on(Po,{children:[K&&xe(s,{as:"p",fg:"fg-muted",type:"body",id:f,testId:"failed-items-sending-note",children:gi}),xe(Re,{caption:_o,captionHidden:!0,columns:[{key:"file",header:rn.file,width:{minPx:To},align:"start",cell:({entry:O,position:Y})=>O.kind==="restricted"?xe(s,{fg:"fg",type:"body",testId:`failed-item-restricted-text-${Y}`,children:Tt}):on(x,{gap:"space-1",testId:`failed-item-uri-${O.item.id}`,children:[xe(s,{fg:"fg",type:"body",children:O.item.file_name}),xe(s,{fg:"fg-muted",type:"caption",children:O.item.file_uri})]})},{key:"status",header:rn.status,width:{minPx:To},align:"start",cell:({entry:O,position:Y})=>O.kind==="restricted"?xe(J,{tone:"danger",variant:"tint",testId:`failed-item-restricted-status-${Y}`,children:O.syncStatus}):xe(J,{tone:"danger",variant:"tint",testId:`failed-item-status-${O.item.id}`,children:O.item.sync_status})},{key:"error",header:rn.error,width:{minPx:To},align:"start",cell:({entry:O})=>O.kind==="restricted"?null:xe(s,{fg:"danger-fg",type:"body",testId:`failed-item-error-${O.item.id}`,children:O.item.error_message??"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"})},{key:"time",header:rn.time,width:{fixedPx:mi({header:rn.time},[qe(m),{kind:"text",texts:[xo],face:"sans",type:"body"}])},align:"start",cell:({entry:O,position:Y})=>O.kind==="restricted"?xe(s,{fg:"fg-muted",type:"body",testId:`failed-item-restricted-time-${Y}`,children:O.failedAt===null?xo:xe(le,{iso:O.failedAt,testId:`failed-item-restricted-time-value-${Y}`})}):xe(s,{fg:"fg-muted",type:"body",testId:`failed-item-time-${O.item.id}`,children:O.item.failed_at===null?xo:xe(le,{iso:O.item.failed_at,testId:`failed-item-time-value-${O.item.id}`})})},{key:"action",header:rn.action,width:{fixedPx:mi({header:rn.action},[{kind:"button",labels:[yi,bi]}])},align:"end",cell:({entry:O})=>{if(O.kind==="restricted"||o===void 0)return null;let{item:Y}=O;return xe(V,{variant:"secondary",busy:a&&c===ko(Y.id),busyLabel:xe(Ii,{item:Y,verb:bi}),unavailable:a?K&&c!==ko(Y.id)?{reasonId:f}:void 0:{reasonId:C},onClick:()=>_(ko(Y.id),()=>o(Y.id,Y.file_uri)),testId:`retry-item-button-${Y.id}`,children:xe(Ii,{item:Y,verb:yi})})}}],rows:q,rowKey:({entry:O,position:Y})=>O.kind==="readable"?`readable:${O.item.id}`:`restricted:${Y}`,rowTestId:"failed-item-row",rowData:({entry:O,position:Y})=>O.kind==="readable"?{"data-item-id":String(O.item.id),"data-file-uri":O.item.file_uri}:{"data-restricted-mark":"failure","data-position":Y},rowSize:o===void 0?"row":"row-control",empty:"\u73FE\u5728\u3001\u540C\u671F\u5931\u6557\u30A2\u30A4\u30C6\u30E0\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:"failed-items-table"})]})]})]})}export{_n as BREAKER_STATE_LABELS,_r as CAPTURE_FORBIDDEN_SENTENCE,ya as CHILD_RUNS_REFUSAL,wo as CHUNKING_ONLY_NOTE,No as CHUNK_BODY_FIDELITY_LABELS,Rr as CHUNK_CHANGE_KIND_LABELS,Nr as CONFIDENTIALITY_LEVEL_LABELS,Hm as ChildRunList,Xo as DEGRADATION_REASON_LABELS,an as DOCUMENT_STATE_CAUSE_LABELS,Wo as DegradedSearchBanner,tf as DocumentChangeFeed,ng as DocumentHistoryInspector,bg as DocumentIngestConsole,_g as EnrichmentStrategyBoard,Qt as FACET_LABELS,Oo as FAILED_RUN_STATE_MARK,Bn as FIELD_LABELS,Vt as FinishedInstant,Zs as GATE_POLICY_LABELS,ho as GATE_STATE_PRESENTATION,un as HIDDEN_FIELD_TEXT,jt as HISTORY_REFUSAL,tu as INERT_STAGE_NOTE,Cs as INGESTION_JOBS_REFUSAL,Eu as INGESTION_JOB_BOARD_TITLE,Su as INGESTION_JOB_CANCEL_FORBIDDEN_SENTENCE,Ls as INGESTION_JOB_KIND_LABELS,Nu as INGESTION_QUEUE_HEALTH_FORBIDDEN_SENTENCE,Lu as INGESTION_QUEUE_HEALTH_TITLE,zc as INGEST_FORBIDDEN_SENTENCE,us as INSPECT_BLOCKED_REASONS,$g as InfrastructureHealthMonitor,jg as IngestionJobBoard,Qg as IngestionQueueHealthCard,Mo as MODEL_ONLY_CHANGE_MARK,pm as MetadataSearchWorkbench,oy as ModelComparisonWorkbench,bl as NOTHING_TO_READ_LABELS,Pn as NO_ENRICHMENT_RECORD_TEXT,xp as NO_FAILURES_TO_RETRY_TEXT,Zl as NO_NODE_READING_TEXT,Ao as NO_PREVIOUS_RECORD_TEXT,dy as OntologyStatusCard,Ws as PHASE_LABELS,Vs as PIPELINE_FLOW_TITLE,$t as PIPELINE_RUN_STATUS_PRESENTATION,wt as PIPELINE_RUN_STATUS_TONES,Cn as PIPELINE_STEP_STATUS_PRESENTATION,ta as PIPELINE_STEP_STATUS_TONES,kr as PIPELINE_TRIGGER_LABELS,ma as PROCESSING_OBJECTS_REFUSAL,zl as PROCESSING_OBJECT_DELETION_LABELS,Yl as PROCESSING_OBJECT_KIND_LABELS,Ql as PROCESSING_OBJECT_REVISION_LABELS,Wl as PROCESSING_OBJECT_STATUS_LABELS,Sy as PipelineFlowViewer,Pm as ProcessingObjectBrowser,Tn as QUALITY_TIER_LABELS,Ly as QdrantStorageCard,ro as REQUIRED_FIELD_MARK,Tt as RESTRICTED_DOCUMENT_TEXT,Hn as RESTRICTED_RUN_TEXT,Do as RESTRICTED_STATE_TEXT,Cp as RETRY_FORBIDDEN_TEXT,gi as RETRY_SENDING_TEXT,Qc as ROWS_BUSY_TEXT,yl as RUN_TERMINAL_STEP_LABEL,ra as RUN_TERMINAL_STEP_OUTCOME_LABELS,le as RecordedInstant,pn as SCORE_DECIMALS,Du as SCORE_DISPLAY_DECIMALS,Yo as SEARCH_FUSION_LABELS,Gt as SEARCH_MODE_LABELS,xl as SEARCH_PRESETS,iu as STRATEGY_FORBIDDEN_TEXT,lu as STRATEGY_UPDATING_TEXT,An as SUBMIT_BLOCKED_REASONS,Wn as SYNC_STATUS_LABELS,Tp as SYNC_STATUS_MONITOR_TITLE,Uy as SyncStatusMonitor,Yn as UNFINISHED_LABEL,Or as UNNAMED_NODE_TEXT,Tr as UNRECORDED_RUN_MARK,$o as UNVERIFIED_CHUNK_NOTE,gl as UNVERSIONED_FLOW_LABEL,vo as WHITESPACE_NORMALIZED_NOTE,ip as catalogFigureGeometry,Xn as degradationReasonText,ti as documentKindFlows,na as documentKindLabel,Bs as drawnDependencies,Kn as facetCountsText,hn as fieldLabel,Us as flowGeometry,ri as gateCaption,ni as gateState,su as gateStateOf,We as historyFailedSentence,jn as historyFailureSentence,Bc as ingestRowAction,xu as ingestionJobCancelAnnouncement,_u as ingestionJobCancelSentence,br as ingestionJobKindLabel,Ru as ingestionJobStatus,$s as ingestionJobTargetLabel,vu as ingestionQueueHealthUnavailableSentence,zt as jsonValueText,Hs as layoutFlow,Dt as ledgerStepLabel,nd as nodeReadingText,mn as pipelineFlowLabel,At as pipelineRunPresentationKey,od as processingObjectClassificationText,rd as processingObjectKindText,zo as rankAgreement,qe as recordedInstantContent,zn as recordedInstantSampleText,rt as revisionLabel,En as revisionTransitionText,Qn as skipReasonLabel,op as stepGatePolicy,rp as stepGateState,Zn as syncStatusTone,Fo as unrecordedRunsMark,Cr as variantHitKey,Qo as vectorScoreText};