@duckcodeailabs/dql-cli 1.14.1 → 1.14.3-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/args.d.ts +4 -0
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +16 -0
- package/dist/args.js.map +1 -1
- package/dist/assets/dql-notebook/assets/{AgentLogPage-BPz-UWFh.js → AgentLogPage-Jbyb4so-.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildDialog-BEl53WA_.js → AiBuildDialog-Du07X1qO.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildResult-B4yfGTTZ.js → AiBuildResult-xKtGthWv.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiSidePanel-CSZAAvuD.js → AiSidePanel-CE_L04dK.js} +1 -1
- package/dist/assets/dql-notebook/assets/AnalyticsHome-CiUE10uF.js +6 -0
- package/dist/assets/dql-notebook/assets/{AppsView-DQOwU9Cg.js → AppsView-DlNaTuwD.js} +30 -35
- package/dist/assets/dql-notebook/assets/AskObservabilityPage-DracZPI9.js +1 -0
- package/dist/assets/dql-notebook/assets/AskTracePage-CSMoMw9a.js +8 -0
- package/dist/assets/dql-notebook/assets/{BlockStudio-B4ap0GdY.js → BlockStudio-DQS5Hcq9.js} +9 -14
- package/dist/assets/dql-notebook/assets/BusinessArtifactView-CqV4i9l_.js +1 -0
- package/dist/assets/dql-notebook/assets/{DbtFirstModelingPage-D72byb2g.js → DbtFirstModelingPage-JKhB_Y2H.js} +3 -3
- package/dist/assets/dql-notebook/assets/{GitPage-lQb1uXH2.js → GitPage-DjaNp0o3.js} +1 -1
- package/dist/assets/dql-notebook/assets/{GlobalAiRail-CVECf6Xj.js → GlobalAiRail-CsV3zlc8.js} +1 -1
- package/dist/assets/dql-notebook/assets/{GovernedContextPage-trOyMCY6.js → GovernedContextPage-uXUHUOIJ.js} +3 -3
- package/dist/assets/dql-notebook/assets/{HelpDocsPage-D8hLS5lE.js → HelpDocsPage-Hbh9IeYB.js} +1 -1
- package/dist/assets/dql-notebook/assets/{HomePage-eIkfBIep.js → HomePage-CRRl-R_v.js} +1 -1
- package/dist/assets/dql-notebook/assets/LineageDAG-OMUP2sbl.js +1 -0
- package/dist/assets/dql-notebook/assets/LineageDetailView-C964BLuV.js +1 -0
- package/dist/assets/dql-notebook/assets/LineageDrawer-CzY0nfpD.js +1 -0
- package/dist/assets/dql-notebook/assets/{LineagePathBreadcrumb-CviIf8PN.js → LineagePathBreadcrumb-0Gi-Fm1B.js} +1 -1
- package/dist/assets/dql-notebook/assets/MiniLineageGraph-wn0wLc9m.js +1 -0
- package/dist/assets/dql-notebook/assets/{NewBlockModal-DbCQg-pj.js → NewBlockModal-kMAzk91d.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NewNotebookModal-5Vp6XiuK.js → NewNotebookModal-D_cWd_6M.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NotebookEditor-DjqJS44s.js → NotebookEditor-Bax0lxaz.js} +25 -30
- package/dist/assets/dql-notebook/assets/{ReadinessPage-BHGrC5ho.js → ReadinessPage-DEUIXQQY.js} +1 -1
- package/dist/assets/dql-notebook/assets/{SetupOnboarding-BfS9Tdx-.js → SetupOnboarding-CyE-Ex41.js} +1 -1
- package/dist/assets/dql-notebook/assets/{SkillsPage-BFH21wSj.js → SkillsPage-QgvKGPxE.js} +1 -1
- package/dist/assets/dql-notebook/assets/{TrustBadge-zm6g_SxZ.js → TrustBadge-D5CGp0cu.js} +1 -1
- package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-BjsTE6yf.js +89 -0
- package/dist/assets/dql-notebook/assets/{answer-to-notebook-DPhxIEzF.js → answer-to-notebook-tACdCsTV.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-left-DNEb86Xc.js → arrow-left-CF6wxXU5.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-right-DpPWbwaD.js → arrow-right-C7G3M_S8.js} +1 -1
- package/dist/assets/dql-notebook/assets/{book-open-text-D7s5jo4X.js → book-open-text-DDBO8G7L.js} +1 -1
- package/dist/assets/dql-notebook/assets/chevron-left-DxajrX2v.js +6 -0
- package/dist/assets/dql-notebook/assets/{circle-x-Db3dXKg7.js → circle-x-HBvXjnT6.js} +1 -1
- package/dist/assets/dql-notebook/assets/clock-3-CJIdsPLt.js +6 -0
- package/dist/assets/dql-notebook/assets/dagre.esm-B6nvU4OB.js +1 -0
- package/dist/assets/dql-notebook/assets/{external-link-BxwXitO_.js → external-link-WciAU8Bu.js} +1 -1
- package/dist/assets/dql-notebook/assets/{grip-vertical-Dt4lkWRi.js → grip-vertical-DVu7ok6x.js} +1 -1
- package/dist/assets/dql-notebook/assets/index-B_kaoARS.css +1 -0
- package/dist/assets/dql-notebook/assets/{index-DKo-bwNw.js → index-D3wnucQC.js} +133 -128
- package/dist/assets/dql-notebook/assets/{link-2-Dfo2P6wi.js → link-2-C6uQx50X.js} +1 -1
- package/dist/assets/dql-notebook/assets/{list-tree-DiTmIWAL.js → list-tree-DapsIuQB.js} +1 -1
- package/dist/assets/dql-notebook/assets/{minimize-2-CMTAkPzL.js → minimize-2-BlVoipnT.js} +1 -1
- package/dist/assets/dql-notebook/assets/{panel-right-open-DwYr7FW4.js → panel-right-open-DcnKWxfx.js} +1 -1
- package/dist/assets/dql-notebook/assets/{play-BXhHYQ4x.js → play-CNuRuaAs.js} +1 -1
- package/dist/assets/dql-notebook/assets/{rotate-ccw-BNi6F8pl.js → rotate-ccw-B2p953Zh.js} +1 -1
- package/dist/assets/dql-notebook/assets/{semantic-fields-CNOGysAy.js → semantic-fields-2fWgkTJc.js} +1 -1
- package/dist/assets/dql-notebook/assets/{sliders-horizontal-Ec5MUMUW.js → sliders-horizontal-DwRTu1w4.js} +1 -1
- package/dist/assets/dql-notebook/assets/{star-B9leDkp_.js → star-Cbaj4F3i.js} +1 -1
- package/dist/assets/dql-notebook/assets/style-NlN9F6JE.js +23 -0
- package/dist/assets/dql-notebook/assets/{triangle-alert-BefTYCzx.js → triangle-alert-BPHvH1wA.js} +1 -1
- package/dist/assets/dql-notebook/assets/{upload-SPiOM2tQ.js → upload-DIqK0KE1.js} +1 -1
- package/dist/assets/dql-notebook/assets/{usePersistedAgentThreadId-C4foXeiQ.js → usePersistedAgentThreadId-DpQXOEDw.js} +1 -1
- package/dist/assets/dql-notebook/assets/{user-round-comGmyw-.js → user-round-DukNupB_.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wand-sparkles-BffR4dF8.js → wand-sparkles-CAwLX0b9.js} +1 -1
- package/dist/assets/dql-notebook/assets/{workflow-ChmPTEzH.js → workflow-bOT-NqdO.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wrench-DovaG_ze.js → wrench-1m0_kcza.js} +1 -1
- package/dist/assets/dql-notebook/assets/{x-nRx91AgW.js → x-fp82BETM.js} +1 -1
- package/dist/assets/dql-notebook/index.html +2 -2
- package/dist/commands/agent-eval-cassette.d.ts +97 -6
- package/dist/commands/agent-eval-cassette.d.ts.map +1 -1
- package/dist/commands/agent-eval-cassette.js +165 -22
- package/dist/commands/agent-eval-cassette.js.map +1 -1
- package/dist/commands/agent-eval-runtime.d.ts +23 -2
- package/dist/commands/agent-eval-runtime.d.ts.map +1 -1
- package/dist/commands/agent-eval-runtime.js +19 -2
- package/dist/commands/agent-eval-runtime.js.map +1 -1
- package/dist/commands/agent-trace.d.ts +3 -0
- package/dist/commands/agent-trace.d.ts.map +1 -0
- package/dist/commands/agent-trace.js +169 -0
- package/dist/commands/agent-trace.js.map +1 -0
- package/dist/commands/agent.d.ts +37 -5
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +534 -84
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/compile.d.ts +13 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +36 -4
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/notebook.d.ts +2 -0
- package/dist/commands/notebook.d.ts.map +1 -1
- package/dist/commands/notebook.js +4 -0
- package/dist/commands/notebook.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +11 -3
- package/dist/commands/sync.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/llm/providers/dql-agent-provider.d.ts +29 -2
- package/dist/llm/providers/dql-agent-provider.d.ts.map +1 -1
- package/dist/llm/providers/dql-agent-provider.js +1008 -144
- package/dist/llm/providers/dql-agent-provider.js.map +1 -1
- package/dist/llm/types.d.ts +48 -1
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/local-runtime.d.ts +271 -33
- package/dist/local-runtime.d.ts.map +1 -1
- package/dist/local-runtime.js +3658 -546
- package/dist/local-runtime.js.map +1 -1
- package/dist/package.json +10 -10
- package/dist/providers/oauth/claude-oauth.d.ts.map +1 -1
- package/dist/providers/oauth/claude-oauth.js +52 -18
- package/dist/providers/oauth/claude-oauth.js.map +1 -1
- package/dist/providers/oauth/codex-oauth.d.ts.map +1 -1
- package/dist/providers/oauth/codex-oauth.js +72 -44
- package/dist/providers/oauth/codex-oauth.js.map +1 -1
- package/dist/providers/subscription-cli.d.ts +20 -0
- package/dist/providers/subscription-cli.d.ts.map +1 -1
- package/dist/providers/subscription-cli.js +69 -11
- package/dist/providers/subscription-cli.js.map +1 -1
- package/package.json +10 -10
- package/dist/assets/dql-notebook/assets/AnalyticsHome-D5P6Ujwi.js +0 -6
- package/dist/assets/dql-notebook/assets/BusinessArtifactView-BIfNI-0S.js +0 -1
- package/dist/assets/dql-notebook/assets/LineageDAG-CSqcbDrE.js +0 -1
- package/dist/assets/dql-notebook/assets/LineageDetailView-DJZZjZu-.js +0 -1
- package/dist/assets/dql-notebook/assets/LineageDrawer-BcIipIc3.js +0 -1
- package/dist/assets/dql-notebook/assets/MiniLineageGraph-vH_MY_Ju.js +0 -1
- package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel--oxmjlgr.js +0 -88
- package/dist/assets/dql-notebook/assets/dagre.esm-C7pppQ1a.js +0 -23
- package/dist/assets/dql-notebook/assets/index-B3shyZsg.css +0 -1
- /package/dist/assets/dql-notebook/assets/{dagre-BZV40eAE.css → style-BZV40eAE.css} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Ye,t as Ze,h as et,r as d,a as g,j as t,a0 as we,G as ne,d as tt,g as re,P as nt,aG as rt,aH as ze,as as it,l as st,aI as ot,S as lt}from"./index-
|
|
1
|
+
import{c as Ye,t as Ze,h as et,r as d,a as g,j as t,a0 as we,G as ne,d as tt,g as re,P as nt,aG as rt,aH as ze,as as it,l as st,aI as ot,S as lt}from"./index-D3wnucQC.js";import{E as $e}from"./external-link-WciAU8Bu.js";import{X as at}from"./x-fp82BETM.js";import"./react-CRB3T2We.js";/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
package/dist/assets/dql-notebook/assets/{GlobalAiRail-CVECf6Xj.js → GlobalAiRail-CsV3zlc8.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as h,t as g,r as x,j as l,a as b}from"./index-
|
|
1
|
+
import{u as h,t as g,r as x,j as l,a as b}from"./index-D3wnucQC.js";import{U as E}from"./UnifiedAgentRunPanel-BjsTE6yf.js";import{A as P,a as _,b as w}from"./AiSidePanel-CE_L04dK.js";import{u as I}from"./usePersistedAgentThreadId-DpQXOEDw.js";import"./react-CRB3T2We.js";import"./AiBuildResult-xKtGthWv.js";import"./user-round-DukNupB_.js";import"./triangle-alert-BPHvH1wA.js";import"./rotate-ccw-B2p953Zh.js";import"./x-fp82BETM.js";import"./list-tree-DapsIuQB.js";import"./wrench-1m0_kcza.js";import"./minimize-2-BlVoipnT.js";import"./arrow-right-C7G3M_S8.js";import"./TrustBadge-D5CGp0cu.js";function M(){const{state:o,dispatch:i}=h(),r=g[o.themeMode],{audience:d,context:e}=o.globalAi,m=e.selectedObject,s=I("global-rail"),[a,c]=x.useState(!1),u=(t,n,p)=>{i(p?{type:"OPEN_APP_DRAFT",draftId:p,appId:t,dashboardId:n}:{type:"OPEN_APP",appId:t,dashboardId:n,experience:"view",section:"dashboards"}),i({type:"CLOSE_GLOBAL_AI"}),b.listApps().then(A=>i({type:"SET_APPS",apps:A})).catch(()=>{})};return l.jsx(P,{t:r,title:e.title??"AI copilot",subtitle:e.scopeHint??"Ask a follow-up about what you are viewing",expanded:a,onToggleExpanded:()=>c(t=>!t),resizable:!0,minResizeWidth:360,maxResizeWidth:1200,onClose:()=>i({type:"CLOSE_GLOBAL_AI"}),ariaLabel:"App AI",style:{position:"relative",width:a?`min(${_}px, calc(100vw - 96px))`:`min(${w}px, calc(100vw - 64px))`,maxWidth:a?"62vw":"46vw",minWidth:320,flex:"0 0 auto"},children:l.jsx(E,{themeMode:o.themeMode,title:e.title??"AI copilot",scopeHint:e.scopeHint??"Ask a follow-up about what you are viewing",audience:d,selectedObject:m,workspaceContext:e.workspaceContext,examplePrompts:Array.isArray(e.suggestedQuestions)&&e.suggestedQuestions.length>0?e.suggestedQuestions.filter(t=>typeof t=="string").slice(0,4).map(t=>({label:t,prompt:t})):void 0,autoRun:o.globalAi.autoRun?{text:o.globalAi.autoRun.text,mode:o.globalAi.autoRun.mode,nonce:o.globalAi.autoRun.nonce}:void 0,threadId:s.threadId,onThreadIdChange:s.onThreadIdChange,initialMode:"auto",onOpenApp:u})})}export{M as GlobalAiRail};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{c as ke,u as ge,t as he,r as a,a as B,j as e,a4 as q,a0 as fe,L
|
|
1
|
+
import{c as ke,u as ge,t as he,r as a,a as B,j as e,a4 as q,a0 as fe,L,S as Y,P as se,B as we,d as ye,T as re,N as de,l as Ce,aM as me,f as ze}from"./index-D3wnucQC.js";import{T as Be}from"./triangle-alert-BPHvH1wA.js";import{U as ce,G as be}from"./user-round-DukNupB_.js";import{C as je}from"./UnifiedAgentRunPanel-BjsTE6yf.js";import{P as Te}from"./usePersistedAgentThreadId-DpQXOEDw.js";import{X as ve}from"./x-fp82BETM.js";import{S as We}from"./SkillsPage-QgvKGPxE.js";import"./react-CRB3T2We.js";import"./AiBuildResult-xKtGthWv.js";import"./rotate-ccw-B2p953Zh.js";import"./list-tree-DapsIuQB.js";import"./wrench-1m0_kcza.js";import"./minimize-2-BlVoipnT.js";import"./arrow-right-C7G3M_S8.js";import"./TrustBadge-D5CGp0cu.js";/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Ie=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],De=ke("tags",Ie),U="dql-context-bootstrap-session",J="dql-context-bootstrap-selection";function Re(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,64)}function pe(t){return t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}function Ee(){return{id:"",name:"",owner:"",boundedContext:"",sourceSystems:[],description:""}}function $e({embedded:t=!1}={}){const{state:i,dispatch:r}=ge(),n=he[i.themeMode],[o,c]=a.useState([]),[h,s]=a.useState(!0),[y,T]=a.useState(null),[z,b]=a.useState(null),[v,S]=a.useState(null),[p,d]=a.useState(!1),[w,C]=a.useState(null),[g,E]=a.useState(null),[u,W]=a.useState(!1),[I,M]=a.useState(!1),[P,D]=a.useState(null),[x,A]=a.useState([]),$=a.useCallback(()=>{let l=!1;return s(!0),T(null),B.getDomains().then(f=>{if(l)return;const m=Array.isArray(f==null?void 0:f.domains)?f.domains:[];c(m),r({type:"SET_AUTHORED_DOMAINS",domains:m})}).catch(f=>{l||(c([]),T(f instanceof Error&&f.message?f.message:"Could not load domains. Is the local DQL server running?"))}).finally(()=>{l||s(!1)}),()=>{l=!0}},[r]);a.useEffect(()=>$(),[$]),a.useEffect(()=>{const l=window.sessionStorage.getItem(U);let f=!1;const m=j=>{if(j&&!f){E(j);try{const O=JSON.parse(window.sessionStorage.getItem(J)??"[]");A(Array.isArray(O)?O.filter(K=>typeof K=="string"):j.candidates.filter(K=>K.action!=="unchanged").map(K=>K.id))}catch{A(j.candidates.filter(O=>O.action!=="unchanged").map(O=>O.id))}}};return(l?B.getContextBootstrap(l):B.getLatestContextBootstrap()).then(m).catch(async()=>{window.sessionStorage.removeItem(U),window.sessionStorage.removeItem(J),l&&m(await B.getLatestContextBootstrap().catch(()=>null))}),()=>{f=!0}},[]),a.useEffect(()=>{g&&(window.sessionStorage.setItem(U,g.id),window.sessionStorage.setItem(J,JSON.stringify(x)))},[g==null?void 0:g.id,x]);const G=a.useMemo(()=>[...o].sort((l,f)=>l.name.localeCompare(f.name)),[o]),Q=a.useCallback(l=>{c(f=>{const m=f.findIndex(j=>j.id===l.id),k=m===-1?[...f,l]:[...f];return m!==-1&&(k[m]=l),r({type:"SET_AUTHORED_DOMAINS",domains:k}),k}),b(null)},[r]),V=a.useCallback(async()=>{if(v){d(!0),C(null);try{await B.deleteDomain(v.id),c(l=>{const f=l.filter(m=>m.id!==v.id);return r({type:"SET_AUTHORED_DOMAINS",domains:f}),f}),S(null)}catch(l){C(l instanceof Error&&l.message?l.message:"Could not delete this domain.")}finally{d(!1)}}},[r,v]),_=a.useCallback(async()=>{W(!0),D(null);try{const l=await B.startContextBootstrap({ai:!0});E(l);const f=l.candidates.filter(m=>m.action!=="unchanged").map(m=>m.id);A(f),window.sessionStorage.setItem(U,l.id),window.sessionStorage.setItem(J,JSON.stringify(f))}catch(l){D(l instanceof Error?l.message:"Could not draft repository context.")}finally{W(!1)}},[]);a.useEffect(()=>{if(!t)return;const l=()=>{_()};return window.addEventListener("dql:context-build",l),()=>window.removeEventListener("dql:context-build",l)},[t,_]),a.useEffect(()=>{if(!g||["ready","needs_attention"].includes(g.status))return;let l=!1;const f=async()=>{try{const k=await B.getContextBootstrap(g.id);l||E(k)}catch(k){l||D(k instanceof Error?k.message:"Could not update AI draft progress.")}};f();const m=window.setInterval(()=>void f(),750);return()=>{l=!0,window.clearInterval(m)}},[g==null?void 0:g.id,g==null?void 0:g.status]);const X=a.useCallback(async()=>{if(!(!g||x.length===0)){M(!0),D(null);try{await B.saveContextBootstrapSelected(g.id,x),E(null),A([]),window.sessionStorage.removeItem(U),window.sessionStorage.removeItem(J),$()}catch(l){D(l instanceof Error?l.message:"Could not save selected drafts.")}finally{M(!1)}}},[g,x,$]);return e.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:n.appBg},children:[e.jsxs("div",{style:{maxWidth:980,margin:"0 auto",padding:"22px 28px 40px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"space-between",gap:18,marginBottom:18},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(q,{size:20,strokeWidth:1.9,color:n.accent}),e.jsx("div",{style:{fontSize:22,fontWeight:700,color:n.textPrimary},children:"Domains"})]}),e.jsx("div",{style:{fontSize:13,color:n.textMuted,marginTop:6,maxWidth:680,lineHeight:1.5},children:"Domains are the top of your business model — each one owns the terms, skills, and blocks beneath it. Name the business area, who owns it, the bounded context, and the source systems it draws from."})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsxs("button",{type:"button",onClick:()=>$(),title:"Refresh",style:F(n),children:[e.jsx(fe,{size:13,strokeWidth:2})," Refresh"]}),e.jsxs("button",{type:"button",onClick:()=>void _(),disabled:u,style:F(n),children:[u?e.jsx(N,{size:13,strokeWidth:2}):e.jsx(Y,{size:13,strokeWidth:2})," Draft with AI"]}),e.jsxs("button",{type:"button",onClick:()=>b({kind:"create"}),style:te(n),children:[e.jsx(se,{size:14,strokeWidth:2.2})," Add domain"]})]})]}),h?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:n.textMuted,fontSize:13,padding:"40px 0"},children:[e.jsx(N,{size:15,strokeWidth:2})," Loading domains…"]}):y?e.jsx(Oe,{t:n,message:y,onRetry:()=>$()}):G.length===0?e.jsx(Ae,{t:n,onAdd:()=>b({kind:"create"})}):e.jsx("div",{style:{display:"grid",gap:10},children:G.map(l=>e.jsx(Me,{domain:l,t:n,onEdit:()=>b({kind:"edit",domain:l}),onDelete:()=>{C(null),S(l)}},l.id))}),P?e.jsx("div",{style:{marginTop:12},children:e.jsx(ee,{t:n,tone:"error",children:P})}):null,g?e.jsxs("section",{style:{marginTop:18,border:`1px solid ${n.cellBorder}`,borderRadius:10,background:n.cellBg,padding:14},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13,fontWeight:750,color:n.textPrimary},children:"Repository-guided AI draft"}),e.jsx("div",{style:{fontSize:12,color:n.textMuted,marginTop:3},children:"Inventory is deterministic; AI may enrich only grounded prose and guidance. Nothing is written to Git until you save."})]}),e.jsxs("button",{type:"button",disabled:I||x.length===0||!["ready","needs_attention"].includes(g.status),onClick:()=>void X(),style:{...te(n),opacity:I||x.length===0||!["ready","needs_attention"].includes(g.status)?.55:1},children:[I?e.jsx(N,{size:13,strokeWidth:2}):e.jsx(se,{size:13,strokeWidth:2})," Save selected drafts"]})]}),e.jsx(Le,{t:n,session:g}),e.jsx("div",{style:{display:"grid",gap:9,marginTop:12},children:g.candidates.map(l=>{const f=l.action!=="unchanged",m=x.includes(l.id);return e.jsx(Ne,{candidate:l,selected:m,selectable:f,disabled:I,t:n,onToggle:()=>A(k=>m?k.filter(j=>j!==l.id):[...k,l.id])},l.id)})})]}):null]}),z?e.jsx(Pe,{mode:z,existingIds:o.map(l=>l.id),domains:o,t:n,onClose:()=>b(null),onSaved:Q}):null,v?e.jsx(He,{domain:v,t:n,deleting:p,error:w,onCancel:()=>{p||S(null)},onConfirm:V}):null]})}function Me({domain:t,t:i,onEdit:r,onDelete:n}){const o=t.sourceSystems??[],[c,h]=a.useState(!1);return e.jsxs("section",{style:{border:`1px solid ${i.cellBorder}`,borderRadius:10,background:i.cellBg,padding:"13px 15px",display:"flex",alignItems:"flex-start",gap:14},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:750,color:i.textPrimary},children:t.name}),t.parent?e.jsxs("span",{style:le(i),children:["↳ ",t.parent]}):null,t.owner?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:11,color:i.textMuted},children:[e.jsx(ce,{size:11,strokeWidth:2})," ",t.owner]}):null,t.businessOwner?e.jsxs("span",{style:le(i),children:[e.jsx(ce,{size:10,strokeWidth:2.2})," Business owner: ",t.businessOwner]}):null]}),t.description?e.jsx("div",{style:{fontSize:12.5,color:i.textSecondary,marginTop:5,lineHeight:1.5},children:t.description}):e.jsx("div",{style:{fontSize:12,color:i.textMuted,marginTop:5,fontStyle:"italic"},children:"No description yet."}),o.length>0?e.jsx("div",{style:{display:"flex",gap:5,marginTop:9,flexWrap:"wrap"},children:o.map(s=>e.jsx("span",{style:ae(i),children:s},s))}):null,e.jsxs("div",{style:{display:"flex",gap:7,marginTop:9,flexWrap:"wrap"},children:[e.jsx(ie,{t:i,icon:e.jsx(we,{size:11,strokeWidth:2}),label:"blocks",count:t.blockCount??0}),e.jsx(ie,{t:i,icon:e.jsx(be,{size:11,strokeWidth:2}),label:"skills",count:t.skillCount??0}),e.jsx(ie,{t:i,icon:e.jsx(De,{size:11,strokeWidth:2}),label:"terms",count:t.termCount??0})]}),c?e.jsxs("div",{style:{display:"grid",gap:9,marginTop:12,paddingTop:11,borderTop:`1px solid ${i.btnBorder}`},children:[t.boundedContext?e.jsx(ue,{t:i,label:"Business boundary",children:t.boundedContext}):null,t.businessOutcome?e.jsx(ue,{t:i,label:"Decision outcome",children:t.businessOutcome}):null,e.jsx(Z,{t:i,label:"In scope",values:t.inScope,empty:"Not defined yet"}),e.jsx(Z,{t:i,label:"Out of scope",values:t.outOfScope,empty:"Not defined yet"}),e.jsx(Z,{t:i,label:"Primary terms",values:t.primaryTerms,empty:"No terms linked yet"}),e.jsx(Z,{t:i,label:"Tags",values:t.tags,empty:"No tags"})]}):null]}),e.jsxs("div",{style:{display:"flex",gap:6,flexShrink:0},children:[e.jsxs("button",{type:"button",onClick:()=>h(s=>!s),style:{...F(i),padding:"5px 7px",fontSize:11.5},title:c?"Hide domain details":"Show domain details",children:[c?e.jsx(je,{size:13}):e.jsx(ye,{size:13}),c?"Less":"Details"]}),e.jsx("button",{type:"button",onClick:r,style:oe(i),title:"Edit domain",children:e.jsx(Te,{size:13,strokeWidth:2})}),e.jsx("button",{type:"button",onClick:n,style:oe(i),title:"Delete domain",children:e.jsx(re,{size:13,strokeWidth:2})})]})]})}function Pe({mode:t,existingIds:i,domains:r,t:n,onClose:o,onSaved:c}){const h=t.kind==="edit",[s,y]=a.useState(()=>t.kind==="edit"?{...t.domain}:Ee()),[T,z]=a.useState(h),[b,v]=a.useState(!1),[S,p]=a.useState(null),d=a.useCallback((u,W)=>{y(I=>({...I,[u]:W}))},[]),w=u=>{y(W=>({...W,name:u,...!h&&!T?{id:pe(u)}:{}}))},C=!h&&s.id.length>0&&i.includes(s.id),g=s.id.trim().length>0&&s.name.trim().length>0&&!C&&!b,E=a.useCallback(async()=>{var W,I,M,P,D;const u={...s,id:s.id.trim(),name:s.name.trim(),owner:(W=s.owner)!=null&&W.trim()?s.owner.trim():void 0,businessOwner:(I=s.businessOwner)!=null&&I.trim()?s.businessOwner.trim():void 0,parent:(M=s.parent)!=null&&M.trim()?s.parent.trim():void 0,boundedContext:(P=s.boundedContext)!=null&&P.trim()?s.boundedContext.trim():void 0,description:(D=s.description)!=null&&D.trim()?s.description.trim():void 0,sourceSystems:(s.sourceSystems??[]).map(x=>x.trim()).filter(Boolean),primaryTerms:(s.primaryTerms??[]).map(x=>x.trim()).filter(Boolean),tags:(s.tags??[]).map(x=>x.trim()).filter(Boolean),inScope:(s.inScope??[]).map(x=>x.trim()).filter(Boolean),outOfScope:(s.outOfScope??[]).map(x=>x.trim()).filter(Boolean),dbtGroups:(s.dbtGroups??[]).map(x=>x.trim()).filter(Boolean),dbtPaths:(s.dbtPaths??[]).map(x=>x.trim()).filter(Boolean),dbtTags:(s.dbtTags??[]).map(x=>x.trim()).filter(Boolean),semanticDomains:(s.semanticDomains??[]).map(x=>x.trim()).filter(Boolean),semanticTags:(s.semanticTags??[]).map(x=>x.trim()).filter(Boolean)};v(!0),p(null);try{const x=h?await B.updateDomain(u.id,u):await B.createDomain(u);c(x.domain??u)}catch(x){p(x instanceof Error&&x.message?x.message:"Could not save this domain. Try again.")}finally{v(!1)}},[s,h,c]);return e.jsx("div",{style:Ke,onClick:()=>!b&&o(),children:e.jsxs("div",{style:Ue(n),onClick:u=>u.stopPropagation(),children:[e.jsxs("div",{style:Je(n),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(q,{size:16,strokeWidth:2,color:n.accent}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:n.textPrimary},children:h?"Edit domain":"New domain"})]}),e.jsx("button",{type:"button",onClick:()=>!b&&o(),style:oe(n),title:"Close",children:e.jsx(ve,{size:15,strokeWidth:2})})]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",padding:"16px 18px",display:"grid",gap:16},children:[e.jsx(R,{label:"Name",t:n,hint:h?void 0:"A short, human label for this business area.",children:e.jsx("input",{type:"text",value:s.name,onChange:u=>w(u.target.value),placeholder:"Revenue",style:L(n)})}),e.jsxs(R,{label:"ID (slug)",t:n,hint:"Used as the on-disk identifier. Letters, numbers, and dashes.",children:[e.jsx("input",{type:"text",value:s.id,disabled:h,onChange:u=>{z(!0),d("id",Re(u.target.value))},onBlur:()=>d("id",pe(s.id)),placeholder:"revenue",style:{...L(n),fontFamily:n.fontMono,opacity:h?.7:1}}),C?e.jsx(ee,{t:n,tone:"error",children:"A domain with this id already exists."}):null]}),e.jsx(R,{label:"Parent domain",t:n,hint:"Optional. Depth becomes Domain, Subdomain, Microdomain, and beyond.",children:e.jsxs("select",{value:s.parent??"",onChange:u=>d("parent",u.target.value||void 0),style:L(n),children:[e.jsx("option",{value:"",children:"Top-level domain"}),r.filter(u=>u.id!==s.id).map(u=>e.jsx("option",{value:u.id,children:u.name},u.id))]})}),e.jsx(R,{label:"Owner",t:n,hint:"The team or person accountable for this domain.",children:e.jsx("input",{type:"text",value:s.owner??"",onChange:u=>d("owner",u.target.value),placeholder:"finance-analytics",style:L(n)})}),e.jsx(R,{label:"Business owner",t:n,hint:"The stakeholder accountable for business use and definitions.",children:e.jsx("input",{type:"text",value:s.businessOwner??"",onChange:u=>d("businessOwner",u.target.value),placeholder:"Revenue Operations",style:L(n)})}),e.jsx(R,{label:"Bounded context",t:n,hint:"The conceptual boundary this domain owns, e.g. 'recognized revenue and invoicing'.",children:e.jsx("input",{type:"text",value:s.boundedContext??"",onChange:u=>d("boundedContext",u.target.value),placeholder:"Recognized revenue and invoicing",style:L(n)})}),e.jsx(R,{label:"Source systems",t:n,hint:"The upstream systems this domain draws from — type a name and press Enter.",children:e.jsx(ne,{t:n,values:s.sourceSystems??[],onChange:u=>d("sourceSystems",u),placeholder:"Add a source system…"})}),e.jsx(R,{label:"Primary terms",t:n,hint:"Business concepts the agent should use to recognize this domain.",children:e.jsx(ne,{t:n,values:s.primaryTerms??[],onChange:u=>d("primaryTerms",u),placeholder:"Add a term…"})}),e.jsx(R,{label:"Scope tags",t:n,hint:"Short labels used for routing and discovery.",children:e.jsx(ne,{t:n,values:s.tags??[],onChange:u=>d("tags",u),placeholder:"Add a tag…"})}),e.jsx(R,{label:"Description",t:n,hint:"What this domain covers and how it's used.",children:e.jsx("textarea",{value:s.description??"",onChange:u=>d("description",u.target.value),rows:5,placeholder:"All recognized-revenue metrics and the blocks that report them, sourced from the billing warehouse.",style:_e(n)})}),S?e.jsx(ee,{t:n,tone:"error",children:S}):null]}),e.jsxs("div",{style:Ye(n),children:[e.jsx("button",{type:"button",onClick:()=>!b&&o(),style:F(n),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:E,disabled:!g,style:{...te(n),opacity:g?1:.55},children:[b?e.jsx(N,{size:13,strokeWidth:2}):null,b?"Saving…":h?"Save changes":"Create domain"]})]})]})})}function ne({t,values:i,onChange:r,placeholder:n}){const[o,c]=a.useState(""),h=s=>{const y=s.trim();!y||i.includes(y)||(r([...i,y]),c(""))};return e.jsxs("div",{style:{display:"grid",gap:7},children:[i.length>0?e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:5},children:i.map(s=>e.jsxs("span",{style:qe(t),children:[s,e.jsx("button",{type:"button",onClick:()=>r(i.filter(y=>y!==s)),style:Ge(t),title:"Remove",children:e.jsx(ve,{size:11,strokeWidth:2.4})})]},s))}):null,e.jsx("input",{type:"text",value:o,onChange:s=>c(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),h(o))},placeholder:n,style:L(t)})]})}function Ae({t,onAdd:i}){return e.jsxs("div",{style:{border:`1px dashed ${t.cellBorder}`,borderRadius:12,background:t.cellBg,padding:"34px 28px",textAlign:"center",display:"grid",gap:12,justifyItems:"center"},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:`${t.accent}18`,color:t.accent,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(q,{size:22,strokeWidth:1.9})}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:t.textPrimary},children:"Name your business domains"}),e.jsx("div",{style:{fontSize:13,color:t.textMuted,maxWidth:460,lineHeight:1.55},children:`Domains organize everything below them — terms, skills, and blocks. Add your first one, like "Revenue" or "Customer", and you'll be able to pick it when authoring blocks and skills.`}),e.jsxs("button",{type:"button",onClick:i,style:{...te(t),marginTop:4},children:[e.jsx(se,{size:14,strokeWidth:2.2})," Add your first domain"]})]})}function Oe({t,message:i,onRetry:r}){return e.jsxs("div",{style:{border:`1px solid ${t.warning}55`,borderRadius:10,background:`${t.warning}12`,padding:"16px 18px",display:"flex",alignItems:"flex-start",gap:11},children:[e.jsx(Be,{size:16,strokeWidth:2,color:t.warning,style:{marginTop:1,flexShrink:0}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:13,fontWeight:650,color:t.textPrimary},children:"Domains are not available right now"}),e.jsx("div",{style:{fontSize:12.5,color:t.textSecondary,marginTop:4,lineHeight:1.5},children:i}),e.jsxs("button",{type:"button",onClick:r,style:{...F(t),marginTop:10},children:[e.jsx(fe,{size:13,strokeWidth:2})," Retry"]})]})]})}function Le({t,session:i}){var o;const r=!["ready","needs_attention"].includes(i.status),n=i.ai.mode==="evidence_only"?"Evidence-only":i.ai.provider?`${i.ai.provider} grounded`:"Preparing AI";return e.jsxs("div",{style:{marginTop:14,padding:"10px 11px",borderRadius:8,background:t.appBg,border:`1px solid ${t.btnBorder}`},children:[e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"center",flexWrap:"wrap",fontSize:12,color:t.textSecondary},children:[r?e.jsx(N,{size:14,strokeWidth:2,color:t.accent}):e.jsx(Y,{size:14,strokeWidth:2,color:t.accent}),e.jsx("strong",{style:{color:t.textPrimary,textTransform:"capitalize"},children:i.status.replace("_"," ")}),e.jsx("span",{children:n}),e.jsxs("span",{children:[i.progress.domains.ready,"/",i.progress.domains.total," domains"]}),e.jsxs("span",{children:[i.progress.skills.ready,"/",i.progress.skills.total," skills"]})]}),e.jsx("div",{style:{height:5,borderRadius:999,background:t.btnBg,overflow:"hidden",marginTop:9},children:e.jsx("div",{style:{width:`${Math.max(3,Math.min(100,i.progress.percent))}%`,height:"100%",background:t.accent,transition:"width 260ms ease"}})}),e.jsx("div",{style:{marginTop:7,fontSize:11.5,color:t.textMuted,lineHeight:1.45},children:i.progress.message}),(o=i.warnings)!=null&&o.length?e.jsx("div",{style:{marginTop:7,fontSize:11.5,color:t.warning,lineHeight:1.45},children:i.warnings.slice(-2).join(" ")}):null]})}function Ne({candidate:t,selected:i,selectable:r,disabled:n,t:o,onToggle:c}){var v,S,p,d,w,C,g,E,u,W,I,M,P,D,x,A,$,G,Q,V,_,X,l,f,m,k;const[h,s]=a.useState(!1),y=t.kind==="domain",T=((v=t.domain)==null?void 0:v.name)??((S=t.skill)==null?void 0:S.id)??t.id.replace(/^(domain|skill):/,""),z=y?((p=t.domain)==null?void 0:p.description)??((d=t.domain)==null?void 0:d.boundedContext):((w=t.skill)==null?void 0:w.description)??((g=(C=t.skill)==null?void 0:C.body)==null?void 0:g.split(`
|
|
7
|
-
`).find(Boolean)),b=y?[["Business outcome",(E=t.domain)==null?void 0:E.businessOutcome],["In scope",(W=(u=t.domain)==null?void 0:u.inScope)==null?void 0:W.join(" · ")],["Out of scope",(M=(I=t.domain)==null?void 0:I.outOfScope)==null?void 0:M.join(" · ")],["Primary terms",(D=(P=t.domain)==null?void 0:P.primaryTerms)==null?void 0:D.join(" · ")]]:[["Applies when",(A=(x=t.skill)==null?void 0:x.triggers)==null?void 0:A.join(" · ")],["Ask first when",(G=($=t.skill)==null?void 0:$.clarifyWhen)==null?void 0:G.join(" · ")],["Avoid when",(V=(Q=t.skill)==null?void 0:Q.exclusions)==null?void 0:V.join(" · ")],["Preferred metrics",(X=(_=t.skill)==null?void 0:_.preferredMetrics)==null?void 0:X.join(" · ")],["Preferred blocks",(f=(l=t.skill)==null?void 0:l.preferredBlocks)==null?void 0:f.join(" · ")]];return e.jsx("article",{style:{border:`1px solid ${i?`${o.accent}66`:o.btnBorder}`,background:i?`${o.accent}08`:o.appBg,borderRadius:8,padding:"10px 11px",opacity:r?1:.72},children:e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"flex-start"},children:[e.jsx("input",{"aria-label":`Select ${y?"domain":"skill"} ${T}`,type:"checkbox",disabled:!r||n,checked:i,onChange:c,style:{marginTop:3}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",gap:7,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("strong",{style:{color:o.textPrimary,fontSize:12.5},children:[y?"Domain":"Skill"," · ",T]}),e.jsx("span",{style:le(o),children:t.action.replace("_"," ")}),e.jsxs("span",{style:{fontSize:11,color:o.textMuted},children:[Math.round(t.confidence*100),"% evidence confidence"]})]}),z?e.jsx("p",{style:{marginTop:5,color:o.textSecondary,fontSize:12,lineHeight:1.45},children:z}):e.jsx("p",{style:{marginTop:5,color:o.textMuted,fontSize:12,fontStyle:"italic"},children:"Waiting for grounded guidance…"}),e.jsx("div",{style:{display:"flex",gap:5,marginTop:7,flexWrap:"wrap"},children:t.evidence.map(j=>e.jsx("span",{style:ae(o),children:j},j))}),h?e.jsxs("div",{style:{marginTop:9,display:"grid",gap:6,borderTop:`1px solid ${o.btnBorder}`,paddingTop:9},children:[b.filter(([,j])=>!!j).map(([j,O])=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"116px minmax(0, 1fr)",gap:8,fontSize:11.5,lineHeight:1.45},children:[e.jsx("strong",{style:{color:o.textMuted},children:j}),e.jsx("span",{style:{color:o.textSecondary},children:O})]},j)),!y&&((m=t.skill)!=null&&m.body)?e.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",fontFamily:o.font,fontSize:11.5,color:o.textSecondary,background:o.cellBg,padding:9,borderRadius:6,maxHeight:180,overflow:"auto"},children:t.skill.body}):null,(k=t.notes)!=null&&k.length?e.jsx("div",{style:{fontSize:11.5,color:o.accent},children:t.notes.join(" ")}):null]}):null]}),e.jsxs("button",{type:"button",onClick:()=>s(j=>!j),style:{...F(o),padding:"4px 6px",fontSize:11.5},"aria-expanded":h,children:[h?e.jsx(je,{size:13}):e.jsx(ye,{size:13}),h?"Less":"Review"]})]})})}function He({domain:t,t:i,deleting:r,error:n,onCancel:o,onConfirm:c}){return e.jsx("div",{style:Qe,onClick:o,children:e.jsxs("div",{style:Ve(i),onClick:h=>h.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(re,{size:16,strokeWidth:2,color:i.error}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:i.textPrimary},children:"Delete this domain?"})]}),e.jsxs("div",{style:{fontSize:13,color:i.textSecondary,lineHeight:1.55},children:[e.jsx("span",{style:{fontWeight:700,color:i.textPrimary},children:t.name})," will be removed. Blocks, skills, and terms that referenced it will become unassigned. This can't be undone."]}),n?e.jsx(ee,{t:i,tone:"error",children:n}):null,e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:4},children:[e.jsx("button",{type:"button",onClick:o,disabled:r,style:F(i),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:c,disabled:r,style:{...Fe(i),opacity:r?.6:1},children:[r?e.jsx(N,{size:13,strokeWidth:2}):e.jsx(re,{size:13,strokeWidth:2}),r?"Deleting…":"Delete"]})]})]})})}function ie({t,icon:i,label:r,count:n}){return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11,fontWeight:600,color:n>0?t.textSecondary:t.textMuted,background:t.btnBg,border:`1px solid ${t.btnBorder}`,borderRadius:6,padding:"3px 8px"},children:[i,n," ",r]})}function ue({t,label:i,children:r}){return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"118px minmax(0, 1fr)",gap:10,fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{color:t.textMuted},children:i}),e.jsx("span",{style:{color:t.textSecondary},children:r})]})}function Z({t,label:i,values:r,empty:n}){return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"118px minmax(0, 1fr)",gap:10,fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{color:t.textMuted},children:i}),e.jsx("div",{style:{display:"flex",gap:5,flexWrap:"wrap"},children:r!=null&&r.length?r.map(o=>e.jsx("span",{style:ae(t),children:o},o)):e.jsx("span",{style:{color:t.textMuted,fontStyle:"italic"},children:n})})]})}function R({label:t,hint:i,t:r,children:n}){return e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsx("label",{style:{fontSize:12,fontWeight:700,color:r.textPrimary},children:t}),i?e.jsx("div",{style:{fontSize:11.5,color:r.textMuted,lineHeight:1.45,marginTop:-2},children:i}):null,n]})}function ee({t,tone:i,children:r}){const n=i==="error"?t.error:t.textMuted;return e.jsx("div",{style:{fontSize:11.5,color:n,lineHeight:1.45},children:r})}function te(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:`1px solid ${t.accent}`,background:t.accent,color:"#ffffff",fontSize:12.5,fontWeight:700,fontFamily:t.font,cursor:"pointer"}}function F(t){return{display:"inline-flex",alignItems:"center",gap:5,padding:"7px 11px",borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,fontSize:12,fontWeight:600,fontFamily:t.font,cursor:"pointer"}}function Fe(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:`1px solid ${t.error}`,background:t.error,color:"#ffffff",fontSize:12.5,fontWeight:700,fontFamily:t.font,cursor:"pointer"}}function oe(t){return{display:"inline-flex",alignItems:"center",justifyContent:"center",width:30,height:30,borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,cursor:"pointer",flexShrink:0}}function L(t){return{width:"100%",border:`1px solid ${t.btnBorder}`,borderRadius:7,background:t.cellBg,color:t.textPrimary,fontSize:12.5,fontFamily:t.font,padding:"8px 10px",boxSizing:"border-box"}}function _e(t){return{...L(t),resize:"vertical",lineHeight:1.5,padding:"9px 11px"}}function le(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:10.5,fontWeight:700,color:t.accent,background:`${t.accent}14`,border:`1px solid ${t.accent}38`,borderRadius:999,padding:"2px 8px"}}function ae(t){return{fontSize:11,fontWeight:600,color:t.textSecondary,background:t.btnBg,border:`1px solid ${t.btnBorder}`,borderRadius:6,padding:"3px 8px",fontFamily:t.fontMono}}function qe(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:11.5,fontWeight:600,color:t.textPrimary,background:`${t.accent}14`,border:`1px solid ${t.accent}38`,borderRadius:6,padding:"3px 4px 3px 9px",fontFamily:t.fontMono}}function Ge(t){return{display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",color:t.textMuted,cursor:"pointer",padding:2,borderRadius:4}}const Ke={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",justifyContent:"flex-end",zIndex:60};function Ue(t){return{width:"min(560px, 100%)",height:"100%",background:t.appBg,borderLeft:`1px solid ${t.headerBorder}`,display:"flex",flexDirection:"column",boxShadow:"-8px 0 28px rgba(0,0,0,0.18)"}}function Je(t){return{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 18px",borderBottom:`1px solid ${t.headerBorder}`,flexShrink:0}}function Ye(t){return{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"13px 18px",borderTop:`1px solid ${t.headerBorder}`,flexShrink:0}}const Qe={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:70,padding:20};function Ve(t){return{width:"min(420px, 100%)",background:t.cellBg,border:`1px solid ${t.cellBorder}`,borderRadius:12,padding:20,display:"grid",gap:13,boxShadow:"0 18px 48px rgba(0,0,0,0.3)"}}function ht({initialTab:t="overview"}){const{state:i}=ge(),r=he[i.themeMode],[n,o]=a.useState(t),[c,h]=a.useState([]),[s,y]=a.useState([]),[T,z]=a.useState(!0);a.useEffect(()=>o(t),[t]);const b=a.useCallback(()=>{let d=!1;return z(!0),Promise.all([B.getDomains(),B.getSkills()]).then(([w,C])=>{d||(h(Array.isArray(w.domains)?w.domains:[]),y(Array.isArray(C.skills)?C.skills:[]))}).catch(()=>{d||(h([]),y([]))}).finally(()=>{d||z(!1)}),()=>{d=!0}},[]);a.useEffect(()=>b(),[b]);const v=a.useMemo(()=>{const d=c.filter(g=>!!(g.businessOwner||g.owner)).length,w=s.filter(g=>!g.status||g.status==="active").length,C=s.filter(g=>g.status==="draft").length;return{ownedDomains:d,activeSkills:w,draftSkills:C}},[c,s]),S=a.useCallback(()=>{o("domains"),window.setTimeout(()=>window.dispatchEvent(new Event("dql:context-build")),50)},[]),p=[{id:"overview",label:"Overview"},{id:"domains",label:"Domains",count:c.length},{id:"skills",label:"Skills",count:s.length},{id:"knowledge",label:"Knowledge 360"}];return e.jsx("div",{style:{flex:1,minWidth:0,overflow:"auto",background:r.appBg},children:e.jsxs("div",{style:{maxWidth:1040,margin:"0 auto",padding:"22px 28px 40px"},children:[e.jsxs("header",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-end",gap:18,marginBottom:15},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"center"},children:[e.jsx(q,{size:20,color:r.accent}),e.jsx("h1",{style:{fontSize:22,color:r.textPrimary},children:"Governed context"})]}),e.jsx("p",{style:{marginTop:6,fontSize:13,lineHeight:1.5,color:r.textMuted,maxWidth:700},children:"Domains define business boundaries. Skills teach the agent approved vocabulary, reuse rules, and when to ask for clarification."})]}),e.jsxs("button",{type:"button",onClick:S,style:Se(r),children:[e.jsx(Y,{size:14})," Build with AI"]})]}),e.jsx("nav",{"aria-label":"Governed context sections",style:{display:"flex",gap:3,borderBottom:`1px solid ${r.headerBorder}`,marginBottom:18},children:p.map(d=>e.jsxs("button",{type:"button",onClick:()=>o(d.id),style:{border:"none",borderBottom:`2px solid ${n===d.id?r.accent:"transparent"}`,background:"transparent",padding:"9px 12px",color:n===d.id?r.textPrimary:r.textMuted,fontWeight:n===d.id?700:600,cursor:"pointer",fontFamily:r.font,fontSize:12.5},children:[d.label,d.count!==void 0?` · ${d.count}`:""]},d.id))}),n==="overview"?e.jsx(Ze,{t:r,loading:T,domains:c,skills:s,status:v,onBuild:S,onTab:o}):null,n==="domains"?e.jsx($e,{embedded:!0}):null,n==="skills"?e.jsx(We,{embedded:!0}):null,n==="knowledge"?e.jsx(Xe,{t:r,domains:c}):null]})})}function Xe({t,domains:i,initialDomainId:r}){var v,S;const[n,o]=a.useState(r??((v=i[0])==null?void 0:v.id)??""),[c,h]=a.useState(null),[s,y]=a.useState(!1),[T,z]=a.useState(null);a.useEffect(()=>{var p;!n&&((p=i[0])!=null&&p.id)&&o(i[0].id)},[n,i]),a.useEffect(()=>{r&&i.some(p=>p.id===r)&&o(r)},[i,r]),a.useEffect(()=>{if(!n){h(null);return}let p=!1;return y(!0),z(null),B.getDomainKnowledge(n).then(d=>{p||h(d)}).catch(d=>{p||(h(null),z(d instanceof Error?d.message:"Could not load the compiled knowledge capsule."))}).finally(()=>{p||y(!1)}),()=>{p=!0}},[n]);const b=a.useMemo(()=>{const p={};for(const d of(c==null?void 0:c.objects)??[])p[d.kind]=(p[d.kind]??0)+1;return Object.entries(p).sort((d,w)=>w[1]-d[1]||d[0].localeCompare(w[0]))},[c]);return e.jsxs("div",{style:{display:"grid",gap:14},children:[e.jsx("section",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:10,background:t.cellBg,padding:15},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:7,alignItems:"center",color:t.textPrimary,fontWeight:700,fontSize:13},children:[e.jsx(de,{size:16,color:t.accent})," Compiled Domain 360"]}),e.jsx("div",{style:{marginTop:4,color:t.textMuted,fontSize:12},children:"The same qualified graph, route policy, and skill snapshot used by Ask."})]}),e.jsxs("select",{"aria-label":"Domain knowledge capsule",value:n,onChange:p=>o(p.target.value),style:{minWidth:210,border:`1px solid ${t.inputBorder}`,borderRadius:7,background:t.inputBg,color:t.textPrimary,padding:"7px 9px",fontFamily:t.font},children:[e.jsx("option",{value:"",children:"Select a domain"}),[...i].sort((p,d)=>p.name.localeCompare(d.name)).map(p=>e.jsx("option",{value:p.id,children:p.name},p.id))]})]})}),s?e.jsxs("div",{style:{color:t.textMuted,display:"flex",gap:8,alignItems:"center",padding:24},children:[e.jsx(N,{size:15})," Loading compiled knowledge…"]}):null,T?e.jsx("div",{style:{border:`1px solid ${t.error}`,background:t.cellBg,color:t.error,borderRadius:8,padding:12,fontSize:12.5},children:T}):null,c?e.jsxs(e.Fragment,{children:[e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:9},children:[e.jsx(H,{t,label:"Objects",value:c.counts.objects,detail:"qualified knowledge",icon:e.jsx(q,{size:16})}),e.jsx(H,{t,label:"Relations",value:c.counts.edges,detail:"provenance + policy",icon:e.jsx(de,{size:16})}),e.jsx(H,{t,label:"Authorized",value:c.counts.routeStates.authorized??0,detail:"safe cross-domain routes",icon:e.jsx(Ce,{size:16})}),e.jsx(H,{t,label:"Blocked / stale",value:(c.counts.routeStates.blocked??0)+(c.counts.routeStates.stale??0),detail:"never auto-joined",icon:e.jsx(me,{size:16})})]}),e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1.2fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:9,background:t.cellBg,padding:14},children:[e.jsx("strong",{style:{color:t.textPrimary,fontSize:13},children:"Knowledge capsule"}),e.jsx("p",{style:{color:t.textSecondary,fontSize:12.5,lineHeight:1.5,margin:"7px 0 11px"},children:((S=c.capsule)==null?void 0:S.description)||"Compiled domain boundary and governed references."}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:b.map(([p,d])=>e.jsxs("span",{style:{border:`1px solid ${t.cellBorder}`,background:t.pillBg,color:t.textSecondary,borderRadius:999,padding:"3px 7px",fontSize:11},children:[p.replace(/_/g," ")," · ",d]},p))}),e.jsxs("div",{style:{marginTop:11,color:t.textMuted,fontSize:11},children:["Snapshot ",c.snapshotId.slice(0,12)," · graph ",c.sourceFingerprint.slice(0,12),c.truncated?" · bounded response":""]})]}),e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:9,background:t.cellBg,padding:14},children:[e.jsx("strong",{style:{color:t.textPrimary,fontSize:13},children:"Cross-domain routes"}),e.jsx("div",{style:{display:"grid",gap:7,marginTop:9},children:c.routes.length?c.routes.map(p=>e.jsxs("div",{style:{borderTop:`1px solid ${t.headerBorder}`,paddingTop:7},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8,color:t.textSecondary,fontSize:12},children:[e.jsxs("span",{children:[p.providerDomainId," → ",p.consumerDomainId]}),e.jsx("span",{style:{color:p.state==="authorized"?t.success:p.state==="observed"?t.textMuted:t.warning,fontWeight:700},children:p.state})]}),e.jsx("div",{style:{marginTop:3,color:t.textMuted,fontSize:11},children:p.purpose||p.reasonCodes.join(", ")||"governed route"})]},p.id)):e.jsx("div",{style:{color:t.textMuted,fontSize:12,marginTop:8},children:"No cross-domain routes declared."})})]})]})]}):null]})}function Ze({t,loading:i,domains:r,skills:n,status:o,onBuild:c,onTab:h}){if(i)return e.jsxs("div",{style:{padding:"42px 0",color:t.textMuted,display:"flex",gap:8,alignItems:"center",fontSize:13},children:[e.jsx(N,{size:15})," Loading governed context…"]});const s=[];return r.length?o.ownedDomains<r.length&&s.push(`${r.length-o.ownedDomains} domain${r.length-o.ownedDomains===1?"":"s"} still need an owner.`):s.push("Create a business domain before relying on AI guidance."),n.length||s.push("Draft a domain skill so the agent has governed business guidance."),o.draftSkills&&s.push(`${o.draftSkills} skill${o.draftSkills===1?" is":"s are"} still draft-only and will not guide answers.`),e.jsxs("div",{style:{display:"grid",gap:16},children:[e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:10},children:[e.jsx(H,{t,label:"Domains",value:r.length,detail:`${o.ownedDomains} with an owner`,icon:e.jsx(q,{size:17})}),e.jsx(H,{t,label:"Active skills",value:o.activeSkills,detail:"available to the agent",icon:e.jsx(be,{size:17})}),e.jsx(H,{t,label:"Draft skills",value:o.draftSkills,detail:"review before activation",icon:e.jsx(Y,{size:17})})]}),e.jsxs("section",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:10,background:t.cellBg,padding:16,display:"grid",gap:10},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx(ze,{size:16,color:s.length?t.warning:t.success}),e.jsx("strong",{style:{color:t.textPrimary,fontSize:13},children:"Readiness"})]}),s.length?e.jsx("div",{style:{display:"grid",gap:6},children:s.map(y=>e.jsxs("div",{style:{display:"flex",gap:7,color:t.textSecondary,fontSize:12.5},children:[e.jsx(me,{size:14,color:t.warning}),y]},y))}):e.jsx("div",{style:{color:t.success,fontSize:12.5},children:"Your agent has owned domains and active governed skills available for retrieval."}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:2},children:[e.jsxs("button",{type:"button",onClick:c,style:Se(t),children:[e.jsx(Y,{size:13})," Build domains & skills with AI"]}),e.jsx("button",{type:"button",onClick:()=>h("domains"),style:xe(t),children:"Manage domains"}),e.jsx("button",{type:"button",onClick:()=>h("skills"),style:xe(t),children:"Manage skills"})]})]})]})}function H({t,label:i,value:r,detail:n,icon:o}){return e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:9,background:t.cellBg,padding:13},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:t.textMuted,fontSize:12},children:[i,o]}),e.jsx("div",{style:{color:t.textPrimary,fontSize:25,fontWeight:750,marginTop:7},children:r}),e.jsx("div",{style:{color:t.textMuted,fontSize:11.5,marginTop:3},children:n})]})}function Se(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 12px",borderRadius:7,border:`1px solid ${t.accent}`,background:t.accent,color:"#fff",fontWeight:700,fontSize:12.5,fontFamily:t.font,cursor:"pointer"}}function xe(t){return{display:"inline-flex",alignItems:"center",padding:"7px 12px",borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,fontWeight:650,fontSize:12.5,fontFamily:t.font,cursor:"pointer"}}export{ht as GovernedContextPage,Xe as Knowledge360};
|
|
6
|
+
*/const Ie=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],De=ke("tags",Ie),U="dql-context-bootstrap-session",J="dql-context-bootstrap-selection";function Re(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,64)}function pe(t){return t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}function Ee(){return{id:"",name:"",owner:"",boundedContext:"",sourceSystems:[],description:""}}function $e({embedded:t=!1}={}){const{state:i,dispatch:r}=ge(),n=he[i.themeMode],[o,c]=a.useState([]),[h,s]=a.useState(!0),[y,T]=a.useState(null),[z,b]=a.useState(null),[v,S]=a.useState(null),[p,d]=a.useState(!1),[w,C]=a.useState(null),[g,E]=a.useState(null),[u,W]=a.useState(!1),[I,M]=a.useState(!1),[P,D]=a.useState(null),[x,A]=a.useState([]),$=a.useCallback(()=>{let l=!1;return s(!0),T(null),B.getDomains().then(f=>{if(l)return;const m=Array.isArray(f==null?void 0:f.domains)?f.domains:[];c(m),r({type:"SET_AUTHORED_DOMAINS",domains:m})}).catch(f=>{l||(c([]),T(f instanceof Error&&f.message?f.message:"Could not load domains. Is the local DQL server running?"))}).finally(()=>{l||s(!1)}),()=>{l=!0}},[r]);a.useEffect(()=>$(),[$]),a.useEffect(()=>{const l=window.sessionStorage.getItem(U);let f=!1;const m=j=>{if(j&&!f){E(j);try{const O=JSON.parse(window.sessionStorage.getItem(J)??"[]");A(Array.isArray(O)?O.filter(K=>typeof K=="string"):j.candidates.filter(K=>K.action!=="unchanged").map(K=>K.id))}catch{A(j.candidates.filter(O=>O.action!=="unchanged").map(O=>O.id))}}};return(l?B.getContextBootstrap(l):B.getLatestContextBootstrap()).then(m).catch(async()=>{window.sessionStorage.removeItem(U),window.sessionStorage.removeItem(J),l&&m(await B.getLatestContextBootstrap().catch(()=>null))}),()=>{f=!0}},[]),a.useEffect(()=>{g&&(window.sessionStorage.setItem(U,g.id),window.sessionStorage.setItem(J,JSON.stringify(x)))},[g==null?void 0:g.id,x]);const G=a.useMemo(()=>[...o].sort((l,f)=>l.name.localeCompare(f.name)),[o]),Q=a.useCallback(l=>{c(f=>{const m=f.findIndex(j=>j.id===l.id),k=m===-1?[...f,l]:[...f];return m!==-1&&(k[m]=l),r({type:"SET_AUTHORED_DOMAINS",domains:k}),k}),b(null)},[r]),V=a.useCallback(async()=>{if(v){d(!0),C(null);try{await B.deleteDomain(v.id),c(l=>{const f=l.filter(m=>m.id!==v.id);return r({type:"SET_AUTHORED_DOMAINS",domains:f}),f}),S(null)}catch(l){C(l instanceof Error&&l.message?l.message:"Could not delete this domain.")}finally{d(!1)}}},[r,v]),_=a.useCallback(async()=>{W(!0),D(null);try{const l=await B.startContextBootstrap({ai:!0});E(l);const f=l.candidates.filter(m=>m.action!=="unchanged").map(m=>m.id);A(f),window.sessionStorage.setItem(U,l.id),window.sessionStorage.setItem(J,JSON.stringify(f))}catch(l){D(l instanceof Error?l.message:"Could not draft repository context.")}finally{W(!1)}},[]);a.useEffect(()=>{if(!t)return;const l=()=>{_()};return window.addEventListener("dql:context-build",l),()=>window.removeEventListener("dql:context-build",l)},[t,_]),a.useEffect(()=>{if(!g||["ready","needs_attention"].includes(g.status))return;let l=!1;const f=async()=>{try{const k=await B.getContextBootstrap(g.id);l||E(k)}catch(k){l||D(k instanceof Error?k.message:"Could not update AI draft progress.")}};f();const m=window.setInterval(()=>void f(),750);return()=>{l=!0,window.clearInterval(m)}},[g==null?void 0:g.id,g==null?void 0:g.status]);const X=a.useCallback(async()=>{if(!(!g||x.length===0)){M(!0),D(null);try{await B.saveContextBootstrapSelected(g.id,x),E(null),A([]),window.sessionStorage.removeItem(U),window.sessionStorage.removeItem(J),$()}catch(l){D(l instanceof Error?l.message:"Could not save selected drafts.")}finally{M(!1)}}},[g,x,$]);return e.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:n.appBg},children:[e.jsxs("div",{style:{maxWidth:980,margin:"0 auto",padding:"22px 28px 40px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"space-between",gap:18,marginBottom:18},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(q,{size:20,strokeWidth:1.9,color:n.accent}),e.jsx("div",{style:{fontSize:22,fontWeight:700,color:n.textPrimary},children:"Domains"})]}),e.jsx("div",{style:{fontSize:13,color:n.textMuted,marginTop:6,maxWidth:680,lineHeight:1.5},children:"Domains are the top of your business model — each one owns the terms, skills, and blocks beneath it. Name the business area, who owns it, the bounded context, and the source systems it draws from."})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsxs("button",{type:"button",onClick:()=>$(),title:"Refresh",style:F(n),children:[e.jsx(fe,{size:13,strokeWidth:2})," Refresh"]}),e.jsxs("button",{type:"button",onClick:()=>void _(),disabled:u,style:F(n),children:[u?e.jsx(L,{size:13,strokeWidth:2}):e.jsx(Y,{size:13,strokeWidth:2})," Draft with AI"]}),e.jsxs("button",{type:"button",onClick:()=>b({kind:"create"}),style:te(n),children:[e.jsx(se,{size:14,strokeWidth:2.2})," Add domain"]})]})]}),h?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:n.textMuted,fontSize:13,padding:"40px 0"},children:[e.jsx(L,{size:15,strokeWidth:2})," Loading domains…"]}):y?e.jsx(Oe,{t:n,message:y,onRetry:()=>$()}):G.length===0?e.jsx(Ae,{t:n,onAdd:()=>b({kind:"create"})}):e.jsx("div",{style:{display:"grid",gap:10},children:G.map(l=>e.jsx(Me,{domain:l,t:n,onEdit:()=>b({kind:"edit",domain:l}),onDelete:()=>{C(null),S(l)}},l.id))}),P?e.jsx("div",{style:{marginTop:12},children:e.jsx(ee,{t:n,tone:"error",children:P})}):null,g?e.jsxs("section",{style:{marginTop:18,border:`1px solid ${n.cellBorder}`,borderRadius:10,background:n.cellBg,padding:14},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13,fontWeight:750,color:n.textPrimary},children:"Repository-guided AI draft"}),e.jsx("div",{style:{fontSize:12,color:n.textMuted,marginTop:3},children:"Inventory is deterministic; AI may enrich only grounded prose and guidance. Nothing is written to Git until you save."})]}),e.jsxs("button",{type:"button",disabled:I||x.length===0||!["ready","needs_attention"].includes(g.status),onClick:()=>void X(),style:{...te(n),opacity:I||x.length===0||!["ready","needs_attention"].includes(g.status)?.55:1},children:[I?e.jsx(L,{size:13,strokeWidth:2}):e.jsx(se,{size:13,strokeWidth:2})," Save selected drafts"]})]}),e.jsx(Ne,{t:n,session:g}),e.jsx("div",{style:{display:"grid",gap:9,marginTop:12},children:g.candidates.map(l=>{const f=l.action!=="unchanged",m=x.includes(l.id);return e.jsx(Le,{candidate:l,selected:m,selectable:f,disabled:I,t:n,onToggle:()=>A(k=>m?k.filter(j=>j!==l.id):[...k,l.id])},l.id)})})]}):null]}),z?e.jsx(Pe,{mode:z,existingIds:o.map(l=>l.id),domains:o,t:n,onClose:()=>b(null),onSaved:Q}):null,v?e.jsx(He,{domain:v,t:n,deleting:p,error:w,onCancel:()=>{p||S(null)},onConfirm:V}):null]})}function Me({domain:t,t:i,onEdit:r,onDelete:n}){const o=t.sourceSystems??[],[c,h]=a.useState(!1);return e.jsxs("section",{style:{border:`1px solid ${i.cellBorder}`,borderRadius:10,background:i.cellBg,padding:"13px 15px",display:"flex",alignItems:"flex-start",gap:14},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:750,color:i.textPrimary},children:t.name}),t.parent?e.jsxs("span",{style:le(i),children:["↳ ",t.parent]}):null,t.owner?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:11,color:i.textMuted},children:[e.jsx(ce,{size:11,strokeWidth:2})," ",t.owner]}):null,t.businessOwner?e.jsxs("span",{style:le(i),children:[e.jsx(ce,{size:10,strokeWidth:2.2})," Business owner: ",t.businessOwner]}):null]}),t.description?e.jsx("div",{style:{fontSize:12.5,color:i.textSecondary,marginTop:5,lineHeight:1.5},children:t.description}):e.jsx("div",{style:{fontSize:12,color:i.textMuted,marginTop:5,fontStyle:"italic"},children:"No description yet."}),o.length>0?e.jsx("div",{style:{display:"flex",gap:5,marginTop:9,flexWrap:"wrap"},children:o.map(s=>e.jsx("span",{style:ae(i),children:s},s))}):null,e.jsxs("div",{style:{display:"flex",gap:7,marginTop:9,flexWrap:"wrap"},children:[e.jsx(ie,{t:i,icon:e.jsx(we,{size:11,strokeWidth:2}),label:"blocks",count:t.blockCount??0}),e.jsx(ie,{t:i,icon:e.jsx(be,{size:11,strokeWidth:2}),label:"skills",count:t.skillCount??0}),e.jsx(ie,{t:i,icon:e.jsx(De,{size:11,strokeWidth:2}),label:"terms",count:t.termCount??0})]}),c?e.jsxs("div",{style:{display:"grid",gap:9,marginTop:12,paddingTop:11,borderTop:`1px solid ${i.btnBorder}`},children:[t.boundedContext?e.jsx(ue,{t:i,label:"Business boundary",children:t.boundedContext}):null,t.businessOutcome?e.jsx(ue,{t:i,label:"Decision outcome",children:t.businessOutcome}):null,e.jsx(Z,{t:i,label:"In scope",values:t.inScope,empty:"Not defined yet"}),e.jsx(Z,{t:i,label:"Out of scope",values:t.outOfScope,empty:"Not defined yet"}),e.jsx(Z,{t:i,label:"Primary terms",values:t.primaryTerms,empty:"No terms linked yet"}),e.jsx(Z,{t:i,label:"Tags",values:t.tags,empty:"No tags"})]}):null]}),e.jsxs("div",{style:{display:"flex",gap:6,flexShrink:0},children:[e.jsxs("button",{type:"button",onClick:()=>h(s=>!s),style:{...F(i),padding:"5px 7px",fontSize:11.5},title:c?"Hide domain details":"Show domain details",children:[c?e.jsx(je,{size:13}):e.jsx(ye,{size:13}),c?"Less":"Details"]}),e.jsx("button",{type:"button",onClick:r,style:oe(i),title:"Edit domain",children:e.jsx(Te,{size:13,strokeWidth:2})}),e.jsx("button",{type:"button",onClick:n,style:oe(i),title:"Delete domain",children:e.jsx(re,{size:13,strokeWidth:2})})]})]})}function Pe({mode:t,existingIds:i,domains:r,t:n,onClose:o,onSaved:c}){const h=t.kind==="edit",[s,y]=a.useState(()=>t.kind==="edit"?{...t.domain}:Ee()),[T,z]=a.useState(h),[b,v]=a.useState(!1),[S,p]=a.useState(null),d=a.useCallback((u,W)=>{y(I=>({...I,[u]:W}))},[]),w=u=>{y(W=>({...W,name:u,...!h&&!T?{id:pe(u)}:{}}))},C=!h&&s.id.length>0&&i.includes(s.id),g=s.id.trim().length>0&&s.name.trim().length>0&&!C&&!b,E=a.useCallback(async()=>{var W,I,M,P,D;const u={...s,id:s.id.trim(),name:s.name.trim(),owner:(W=s.owner)!=null&&W.trim()?s.owner.trim():void 0,businessOwner:(I=s.businessOwner)!=null&&I.trim()?s.businessOwner.trim():void 0,parent:(M=s.parent)!=null&&M.trim()?s.parent.trim():void 0,boundedContext:(P=s.boundedContext)!=null&&P.trim()?s.boundedContext.trim():void 0,description:(D=s.description)!=null&&D.trim()?s.description.trim():void 0,sourceSystems:(s.sourceSystems??[]).map(x=>x.trim()).filter(Boolean),primaryTerms:(s.primaryTerms??[]).map(x=>x.trim()).filter(Boolean),tags:(s.tags??[]).map(x=>x.trim()).filter(Boolean),inScope:(s.inScope??[]).map(x=>x.trim()).filter(Boolean),outOfScope:(s.outOfScope??[]).map(x=>x.trim()).filter(Boolean),dbtGroups:(s.dbtGroups??[]).map(x=>x.trim()).filter(Boolean),dbtPaths:(s.dbtPaths??[]).map(x=>x.trim()).filter(Boolean),dbtTags:(s.dbtTags??[]).map(x=>x.trim()).filter(Boolean),semanticDomains:(s.semanticDomains??[]).map(x=>x.trim()).filter(Boolean),semanticTags:(s.semanticTags??[]).map(x=>x.trim()).filter(Boolean)};v(!0),p(null);try{const x=h?await B.updateDomain(u.id,u):await B.createDomain(u);c(x.domain??u)}catch(x){p(x instanceof Error&&x.message?x.message:"Could not save this domain. Try again.")}finally{v(!1)}},[s,h,c]);return e.jsx("div",{style:Ke,onClick:()=>!b&&o(),children:e.jsxs("div",{style:Ue(n),onClick:u=>u.stopPropagation(),children:[e.jsxs("div",{style:Je(n),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(q,{size:16,strokeWidth:2,color:n.accent}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:n.textPrimary},children:h?"Edit domain":"New domain"})]}),e.jsx("button",{type:"button",onClick:()=>!b&&o(),style:oe(n),title:"Close",children:e.jsx(ve,{size:15,strokeWidth:2})})]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",padding:"16px 18px",display:"grid",gap:16},children:[e.jsx(R,{label:"Name",t:n,hint:h?void 0:"A short, human label for this business area.",children:e.jsx("input",{type:"text",value:s.name,onChange:u=>w(u.target.value),placeholder:"Revenue",style:N(n)})}),e.jsxs(R,{label:"ID (slug)",t:n,hint:"Used as the on-disk identifier. Letters, numbers, and dashes.",children:[e.jsx("input",{type:"text",value:s.id,disabled:h,onChange:u=>{z(!0),d("id",Re(u.target.value))},onBlur:()=>d("id",pe(s.id)),placeholder:"revenue",style:{...N(n),fontFamily:n.fontMono,opacity:h?.7:1}}),C?e.jsx(ee,{t:n,tone:"error",children:"A domain with this id already exists."}):null]}),e.jsx(R,{label:"Parent domain",t:n,hint:"Optional. Depth becomes Domain, Subdomain, Microdomain, and beyond.",children:e.jsxs("select",{value:s.parent??"",onChange:u=>d("parent",u.target.value||void 0),style:N(n),children:[e.jsx("option",{value:"",children:"Top-level domain"}),r.filter(u=>u.id!==s.id).map(u=>e.jsx("option",{value:u.id,children:u.name},u.id))]})}),e.jsx(R,{label:"Owner",t:n,hint:"The team or person accountable for this domain.",children:e.jsx("input",{type:"text",value:s.owner??"",onChange:u=>d("owner",u.target.value),placeholder:"finance-analytics",style:N(n)})}),e.jsx(R,{label:"Business owner",t:n,hint:"The stakeholder accountable for business use and definitions.",children:e.jsx("input",{type:"text",value:s.businessOwner??"",onChange:u=>d("businessOwner",u.target.value),placeholder:"Revenue Operations",style:N(n)})}),e.jsx(R,{label:"Bounded context",t:n,hint:"The conceptual boundary this domain owns, e.g. 'recognized revenue and invoicing'.",children:e.jsx("input",{type:"text",value:s.boundedContext??"",onChange:u=>d("boundedContext",u.target.value),placeholder:"Recognized revenue and invoicing",style:N(n)})}),e.jsx(R,{label:"Source systems",t:n,hint:"The upstream systems this domain draws from — type a name and press Enter.",children:e.jsx(ne,{t:n,values:s.sourceSystems??[],onChange:u=>d("sourceSystems",u),placeholder:"Add a source system…"})}),e.jsx(R,{label:"Primary terms",t:n,hint:"Business concepts the agent should use to recognize this domain.",children:e.jsx(ne,{t:n,values:s.primaryTerms??[],onChange:u=>d("primaryTerms",u),placeholder:"Add a term…"})}),e.jsx(R,{label:"Scope tags",t:n,hint:"Short labels used for routing and discovery.",children:e.jsx(ne,{t:n,values:s.tags??[],onChange:u=>d("tags",u),placeholder:"Add a tag…"})}),e.jsx(R,{label:"Description",t:n,hint:"What this domain covers and how it's used.",children:e.jsx("textarea",{value:s.description??"",onChange:u=>d("description",u.target.value),rows:5,placeholder:"All recognized-revenue metrics and the blocks that report them, sourced from the billing warehouse.",style:_e(n)})}),S?e.jsx(ee,{t:n,tone:"error",children:S}):null]}),e.jsxs("div",{style:Ye(n),children:[e.jsx("button",{type:"button",onClick:()=>!b&&o(),style:F(n),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:E,disabled:!g,style:{...te(n),opacity:g?1:.55},children:[b?e.jsx(L,{size:13,strokeWidth:2}):null,b?"Saving…":h?"Save changes":"Create domain"]})]})]})})}function ne({t,values:i,onChange:r,placeholder:n}){const[o,c]=a.useState(""),h=s=>{const y=s.trim();!y||i.includes(y)||(r([...i,y]),c(""))};return e.jsxs("div",{style:{display:"grid",gap:7},children:[i.length>0?e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:5},children:i.map(s=>e.jsxs("span",{style:qe(t),children:[s,e.jsx("button",{type:"button",onClick:()=>r(i.filter(y=>y!==s)),style:Ge(t),title:"Remove",children:e.jsx(ve,{size:11,strokeWidth:2.4})})]},s))}):null,e.jsx("input",{type:"text",value:o,onChange:s=>c(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),h(o))},placeholder:n,style:N(t)})]})}function Ae({t,onAdd:i}){return e.jsxs("div",{style:{border:`1px dashed ${t.cellBorder}`,borderRadius:12,background:t.cellBg,padding:"34px 28px",textAlign:"center",display:"grid",gap:12,justifyItems:"center"},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:`${t.accent}18`,color:t.accent,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(q,{size:22,strokeWidth:1.9})}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:t.textPrimary},children:"Name your business domains"}),e.jsx("div",{style:{fontSize:13,color:t.textMuted,maxWidth:460,lineHeight:1.55},children:`Domains organize everything below them — terms, skills, and blocks. Add your first one, like "Revenue" or "Customer", and you'll be able to pick it when authoring blocks and skills.`}),e.jsxs("button",{type:"button",onClick:i,style:{...te(t),marginTop:4},children:[e.jsx(se,{size:14,strokeWidth:2.2})," Add your first domain"]})]})}function Oe({t,message:i,onRetry:r}){return e.jsxs("div",{style:{border:`1px solid ${t.warning}55`,borderRadius:10,background:`${t.warning}12`,padding:"16px 18px",display:"flex",alignItems:"flex-start",gap:11},children:[e.jsx(Be,{size:16,strokeWidth:2,color:t.warning,style:{marginTop:1,flexShrink:0}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:13,fontWeight:650,color:t.textPrimary},children:"Domains are not available right now"}),e.jsx("div",{style:{fontSize:12.5,color:t.textSecondary,marginTop:4,lineHeight:1.5},children:i}),e.jsxs("button",{type:"button",onClick:r,style:{...F(t),marginTop:10},children:[e.jsx(fe,{size:13,strokeWidth:2})," Retry"]})]})]})}function Ne({t,session:i}){var o;const r=!["ready","needs_attention"].includes(i.status),n=i.ai.mode==="evidence_only"?"Evidence-only":i.ai.provider?`${i.ai.provider} grounded`:"Preparing AI";return e.jsxs("div",{style:{marginTop:14,padding:"10px 11px",borderRadius:8,background:t.appBg,border:`1px solid ${t.btnBorder}`},children:[e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"center",flexWrap:"wrap",fontSize:12,color:t.textSecondary},children:[r?e.jsx(L,{size:14,strokeWidth:2,color:t.accent}):e.jsx(Y,{size:14,strokeWidth:2,color:t.accent}),e.jsx("strong",{style:{color:t.textPrimary,textTransform:"capitalize"},children:i.status.replace("_"," ")}),e.jsx("span",{children:n}),e.jsxs("span",{children:[i.progress.domains.ready,"/",i.progress.domains.total," domains"]}),e.jsxs("span",{children:[i.progress.skills.ready,"/",i.progress.skills.total," skills"]})]}),e.jsx("div",{style:{height:5,borderRadius:999,background:t.btnBg,overflow:"hidden",marginTop:9},children:e.jsx("div",{style:{width:`${Math.max(3,Math.min(100,i.progress.percent))}%`,height:"100%",background:t.accent,transition:"width 260ms ease"}})}),e.jsx("div",{style:{marginTop:7,fontSize:11.5,color:t.textMuted,lineHeight:1.45},children:i.progress.message}),(o=i.warnings)!=null&&o.length?e.jsx("div",{style:{marginTop:7,fontSize:11.5,color:t.warning,lineHeight:1.45},children:i.warnings.slice(-2).join(" ")}):null]})}function Le({candidate:t,selected:i,selectable:r,disabled:n,t:o,onToggle:c}){var v,S,p,d,w,C,g,E,u,W,I,M,P,D,x,A,$,G,Q,V,_,X,l,f,m,k;const[h,s]=a.useState(!1),y=t.kind==="domain",T=((v=t.domain)==null?void 0:v.name)??((S=t.skill)==null?void 0:S.id)??t.id.replace(/^(domain|skill):/,""),z=y?((p=t.domain)==null?void 0:p.description)??((d=t.domain)==null?void 0:d.boundedContext):((w=t.skill)==null?void 0:w.description)??((g=(C=t.skill)==null?void 0:C.body)==null?void 0:g.split(`
|
|
7
|
+
`).find(Boolean)),b=y?[["Business outcome",(E=t.domain)==null?void 0:E.businessOutcome],["In scope",(W=(u=t.domain)==null?void 0:u.inScope)==null?void 0:W.join(" · ")],["Out of scope",(M=(I=t.domain)==null?void 0:I.outOfScope)==null?void 0:M.join(" · ")],["Primary terms",(D=(P=t.domain)==null?void 0:P.primaryTerms)==null?void 0:D.join(" · ")]]:[["Applies when",(A=(x=t.skill)==null?void 0:x.triggers)==null?void 0:A.join(" · ")],["Ask first when",(G=($=t.skill)==null?void 0:$.clarifyWhen)==null?void 0:G.join(" · ")],["Avoid when",(V=(Q=t.skill)==null?void 0:Q.exclusions)==null?void 0:V.join(" · ")],["Preferred metrics",(X=(_=t.skill)==null?void 0:_.preferredMetrics)==null?void 0:X.join(" · ")],["Preferred blocks",(f=(l=t.skill)==null?void 0:l.preferredBlocks)==null?void 0:f.join(" · ")]];return e.jsx("article",{style:{border:`1px solid ${i?`${o.accent}66`:o.btnBorder}`,background:i?`${o.accent}08`:o.appBg,borderRadius:8,padding:"10px 11px",opacity:r?1:.72},children:e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"flex-start"},children:[e.jsx("input",{"aria-label":`Select ${y?"domain":"skill"} ${T}`,type:"checkbox",disabled:!r||n,checked:i,onChange:c,style:{marginTop:3}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",gap:7,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("strong",{style:{color:o.textPrimary,fontSize:12.5},children:[y?"Domain":"Skill"," · ",T]}),e.jsx("span",{style:le(o),children:t.action.replace("_"," ")}),e.jsxs("span",{style:{fontSize:11,color:o.textMuted},children:[Math.round(t.confidence*100),"% evidence confidence"]})]}),z?e.jsx("p",{style:{marginTop:5,color:o.textSecondary,fontSize:12,lineHeight:1.45},children:z}):e.jsx("p",{style:{marginTop:5,color:o.textMuted,fontSize:12,fontStyle:"italic"},children:"Waiting for grounded guidance…"}),e.jsx("div",{style:{display:"flex",gap:5,marginTop:7,flexWrap:"wrap"},children:t.evidence.map(j=>e.jsx("span",{style:ae(o),children:j},j))}),h?e.jsxs("div",{style:{marginTop:9,display:"grid",gap:6,borderTop:`1px solid ${o.btnBorder}`,paddingTop:9},children:[b.filter(([,j])=>!!j).map(([j,O])=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"116px minmax(0, 1fr)",gap:8,fontSize:11.5,lineHeight:1.45},children:[e.jsx("strong",{style:{color:o.textMuted},children:j}),e.jsx("span",{style:{color:o.textSecondary},children:O})]},j)),!y&&((m=t.skill)!=null&&m.body)?e.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",fontFamily:o.font,fontSize:11.5,color:o.textSecondary,background:o.cellBg,padding:9,borderRadius:6,maxHeight:180,overflow:"auto"},children:t.skill.body}):null,(k=t.notes)!=null&&k.length?e.jsx("div",{style:{fontSize:11.5,color:o.accent},children:t.notes.join(" ")}):null]}):null]}),e.jsxs("button",{type:"button",onClick:()=>s(j=>!j),style:{...F(o),padding:"4px 6px",fontSize:11.5},"aria-expanded":h,children:[h?e.jsx(je,{size:13}):e.jsx(ye,{size:13}),h?"Less":"Review"]})]})})}function He({domain:t,t:i,deleting:r,error:n,onCancel:o,onConfirm:c}){return e.jsx("div",{style:Qe,onClick:o,children:e.jsxs("div",{style:Ve(i),onClick:h=>h.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(re,{size:16,strokeWidth:2,color:i.error}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:i.textPrimary},children:"Delete this domain?"})]}),e.jsxs("div",{style:{fontSize:13,color:i.textSecondary,lineHeight:1.55},children:[e.jsx("span",{style:{fontWeight:700,color:i.textPrimary},children:t.name})," will be removed. Blocks, skills, and terms that referenced it will become unassigned. This can't be undone."]}),n?e.jsx(ee,{t:i,tone:"error",children:n}):null,e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:4},children:[e.jsx("button",{type:"button",onClick:o,disabled:r,style:F(i),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:c,disabled:r,style:{...Fe(i),opacity:r?.6:1},children:[r?e.jsx(L,{size:13,strokeWidth:2}):e.jsx(re,{size:13,strokeWidth:2}),r?"Deleting…":"Delete"]})]})]})})}function ie({t,icon:i,label:r,count:n}){return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11,fontWeight:600,color:n>0?t.textSecondary:t.textMuted,background:t.btnBg,border:`1px solid ${t.btnBorder}`,borderRadius:6,padding:"3px 8px"},children:[i,n," ",r]})}function ue({t,label:i,children:r}){return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"118px minmax(0, 1fr)",gap:10,fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{color:t.textMuted},children:i}),e.jsx("span",{style:{color:t.textSecondary},children:r})]})}function Z({t,label:i,values:r,empty:n}){return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"118px minmax(0, 1fr)",gap:10,fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{color:t.textMuted},children:i}),e.jsx("div",{style:{display:"flex",gap:5,flexWrap:"wrap"},children:r!=null&&r.length?r.map(o=>e.jsx("span",{style:ae(t),children:o},o)):e.jsx("span",{style:{color:t.textMuted,fontStyle:"italic"},children:n})})]})}function R({label:t,hint:i,t:r,children:n}){return e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsx("label",{style:{fontSize:12,fontWeight:700,color:r.textPrimary},children:t}),i?e.jsx("div",{style:{fontSize:11.5,color:r.textMuted,lineHeight:1.45,marginTop:-2},children:i}):null,n]})}function ee({t,tone:i,children:r}){const n=i==="error"?t.error:t.textMuted;return e.jsx("div",{style:{fontSize:11.5,color:n,lineHeight:1.45},children:r})}function te(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:`1px solid ${t.accent}`,background:t.accent,color:"#ffffff",fontSize:12.5,fontWeight:700,fontFamily:t.font,cursor:"pointer"}}function F(t){return{display:"inline-flex",alignItems:"center",gap:5,padding:"7px 11px",borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,fontSize:12,fontWeight:600,fontFamily:t.font,cursor:"pointer"}}function Fe(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:`1px solid ${t.error}`,background:t.error,color:"#ffffff",fontSize:12.5,fontWeight:700,fontFamily:t.font,cursor:"pointer"}}function oe(t){return{display:"inline-flex",alignItems:"center",justifyContent:"center",width:30,height:30,borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,cursor:"pointer",flexShrink:0}}function N(t){return{width:"100%",border:`1px solid ${t.btnBorder}`,borderRadius:7,background:t.cellBg,color:t.textPrimary,fontSize:12.5,fontFamily:t.font,padding:"8px 10px",boxSizing:"border-box"}}function _e(t){return{...N(t),resize:"vertical",lineHeight:1.5,padding:"9px 11px"}}function le(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:10.5,fontWeight:700,color:t.accent,background:`${t.accent}14`,border:`1px solid ${t.accent}38`,borderRadius:999,padding:"2px 8px"}}function ae(t){return{fontSize:11,fontWeight:600,color:t.textSecondary,background:t.btnBg,border:`1px solid ${t.btnBorder}`,borderRadius:6,padding:"3px 8px",fontFamily:t.fontMono}}function qe(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:11.5,fontWeight:600,color:t.textPrimary,background:`${t.accent}14`,border:`1px solid ${t.accent}38`,borderRadius:6,padding:"3px 4px 3px 9px",fontFamily:t.fontMono}}function Ge(t){return{display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",color:t.textMuted,cursor:"pointer",padding:2,borderRadius:4}}const Ke={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",justifyContent:"flex-end",zIndex:60};function Ue(t){return{width:"min(560px, 100%)",height:"100%",background:t.appBg,borderLeft:`1px solid ${t.headerBorder}`,display:"flex",flexDirection:"column",boxShadow:"-8px 0 28px rgba(0,0,0,0.18)"}}function Je(t){return{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 18px",borderBottom:`1px solid ${t.headerBorder}`,flexShrink:0}}function Ye(t){return{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"13px 18px",borderTop:`1px solid ${t.headerBorder}`,flexShrink:0}}const Qe={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:70,padding:20};function Ve(t){return{width:"min(420px, 100%)",background:t.cellBg,border:`1px solid ${t.cellBorder}`,borderRadius:12,padding:20,display:"grid",gap:13,boxShadow:"0 18px 48px rgba(0,0,0,0.3)"}}function ht({initialTab:t="overview"}){const{state:i}=ge(),r=he[i.themeMode],[n,o]=a.useState(t),[c,h]=a.useState([]),[s,y]=a.useState([]),[T,z]=a.useState(!0);a.useEffect(()=>o(t),[t]);const b=a.useCallback(()=>{let d=!1;return z(!0),Promise.all([B.getDomains(),B.getSkills()]).then(([w,C])=>{d||(h(Array.isArray(w.domains)?w.domains:[]),y(Array.isArray(C.skills)?C.skills:[]))}).catch(()=>{d||(h([]),y([]))}).finally(()=>{d||z(!1)}),()=>{d=!0}},[]);a.useEffect(()=>b(),[b]);const v=a.useMemo(()=>{const d=c.filter(g=>!!(g.businessOwner||g.owner)).length,w=s.filter(g=>!g.status||g.status==="active").length,C=s.filter(g=>g.status==="draft").length;return{ownedDomains:d,activeSkills:w,draftSkills:C}},[c,s]),S=a.useCallback(()=>{o("domains"),window.setTimeout(()=>window.dispatchEvent(new Event("dql:context-build")),50)},[]),p=[{id:"overview",label:"Overview"},{id:"domains",label:"Domains",count:c.length},{id:"skills",label:"Skills",count:s.length},{id:"knowledge",label:"Knowledge 360"}];return e.jsx("div",{style:{flex:1,minWidth:0,overflow:"auto",background:r.appBg},children:e.jsxs("div",{style:{maxWidth:1040,margin:"0 auto",padding:"22px 28px 40px"},children:[e.jsxs("header",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-end",gap:18,marginBottom:15},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"center"},children:[e.jsx(q,{size:20,color:r.accent}),e.jsx("h1",{style:{fontSize:22,color:r.textPrimary},children:"Governed context"})]}),e.jsx("p",{style:{marginTop:6,fontSize:13,lineHeight:1.5,color:r.textMuted,maxWidth:700},children:"Domains define business boundaries. Skills teach the agent approved vocabulary, reuse rules, and when to ask for clarification."})]}),e.jsxs("button",{type:"button",onClick:S,style:Se(r),children:[e.jsx(Y,{size:14})," Build with AI"]})]}),e.jsx("nav",{"aria-label":"Governed context sections",style:{display:"flex",gap:3,borderBottom:`1px solid ${r.headerBorder}`,marginBottom:18},children:p.map(d=>e.jsxs("button",{type:"button",onClick:()=>o(d.id),style:{border:"none",borderBottom:`2px solid ${n===d.id?r.accent:"transparent"}`,background:"transparent",padding:"9px 12px",color:n===d.id?r.textPrimary:r.textMuted,fontWeight:n===d.id?700:600,cursor:"pointer",fontFamily:r.font,fontSize:12.5},children:[d.label,d.count!==void 0?` · ${d.count}`:""]},d.id))}),n==="overview"?e.jsx(Ze,{t:r,loading:T,domains:c,skills:s,status:v,onBuild:S,onTab:o}):null,n==="domains"?e.jsx($e,{embedded:!0}):null,n==="skills"?e.jsx(We,{embedded:!0}):null,n==="knowledge"?e.jsx(Xe,{t:r,domains:c}):null]})})}function Xe({t,domains:i,initialDomainId:r}){var v,S;const[n,o]=a.useState(r??((v=i[0])==null?void 0:v.id)??""),[c,h]=a.useState(null),[s,y]=a.useState(!1),[T,z]=a.useState(null);a.useEffect(()=>{var p;!n&&((p=i[0])!=null&&p.id)&&o(i[0].id)},[n,i]),a.useEffect(()=>{r&&i.some(p=>p.id===r)&&o(r)},[i,r]),a.useEffect(()=>{if(!n){h(null);return}let p=!1;return y(!0),z(null),B.getDomainKnowledge(n).then(d=>{p||h(d)}).catch(d=>{p||(h(null),z(d instanceof Error?d.message:"Could not load the compiled knowledge capsule."))}).finally(()=>{p||y(!1)}),()=>{p=!0}},[n]);const b=a.useMemo(()=>{const p={};for(const d of(c==null?void 0:c.objects)??[])p[d.kind]=(p[d.kind]??0)+1;return Object.entries(p).sort((d,w)=>w[1]-d[1]||d[0].localeCompare(w[0]))},[c]);return e.jsxs("div",{style:{display:"grid",gap:14},children:[e.jsx("section",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:10,background:t.cellBg,padding:15},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:7,alignItems:"center",color:t.textPrimary,fontWeight:700,fontSize:13},children:[e.jsx(de,{size:16,color:t.accent})," Compiled Domain 360"]}),e.jsx("div",{style:{marginTop:4,color:t.textMuted,fontSize:12},children:"The same qualified graph, route policy, and skill snapshot used by Ask."})]}),e.jsxs("select",{"aria-label":"Domain knowledge capsule",value:n,onChange:p=>o(p.target.value),style:{minWidth:210,border:`1px solid ${t.inputBorder}`,borderRadius:7,background:t.inputBg,color:t.textPrimary,padding:"7px 9px",fontFamily:t.font},children:[e.jsx("option",{value:"",children:"Select a domain"}),[...i].sort((p,d)=>p.name.localeCompare(d.name)).map(p=>e.jsx("option",{value:p.id,children:p.name},p.id))]})]})}),s?e.jsxs("div",{style:{color:t.textMuted,display:"flex",gap:8,alignItems:"center",padding:24},children:[e.jsx(L,{size:15})," Loading compiled knowledge…"]}):null,T?e.jsx("div",{style:{border:`1px solid ${t.error}`,background:t.cellBg,color:t.error,borderRadius:8,padding:12,fontSize:12.5},children:T}):null,c?e.jsxs(e.Fragment,{children:[e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:9},children:[e.jsx(H,{t,label:"Objects",value:c.counts.objects,detail:"qualified knowledge",icon:e.jsx(q,{size:16})}),e.jsx(H,{t,label:"Relations",value:c.counts.edges,detail:"provenance + policy",icon:e.jsx(de,{size:16})}),e.jsx(H,{t,label:"Authorized",value:c.counts.routeStates.authorized??0,detail:"safe cross-domain routes",icon:e.jsx(Ce,{size:16})}),e.jsx(H,{t,label:"Blocked / stale",value:(c.counts.routeStates.blocked??0)+(c.counts.routeStates.stale??0),detail:"never auto-joined",icon:e.jsx(me,{size:16})})]}),e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1.2fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:9,background:t.cellBg,padding:14},children:[e.jsx("strong",{style:{color:t.textPrimary,fontSize:13},children:"Knowledge capsule"}),e.jsx("p",{style:{color:t.textSecondary,fontSize:12.5,lineHeight:1.5,margin:"7px 0 11px"},children:((S=c.capsule)==null?void 0:S.description)||"Compiled domain boundary and governed references."}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:b.map(([p,d])=>e.jsxs("span",{style:{border:`1px solid ${t.cellBorder}`,background:t.pillBg,color:t.textSecondary,borderRadius:999,padding:"3px 7px",fontSize:11},children:[p.replace(/_/g," ")," · ",d]},p))}),e.jsxs("div",{style:{marginTop:11,color:t.textMuted,fontSize:11},children:["Snapshot ",c.snapshotId.slice(0,12)," · graph ",c.sourceFingerprint.slice(0,12),c.truncated?" · bounded response":""]})]}),e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:9,background:t.cellBg,padding:14},children:[e.jsx("strong",{style:{color:t.textPrimary,fontSize:13},children:"Cross-domain routes"}),e.jsx("div",{style:{display:"grid",gap:7,marginTop:9},children:c.routes.length?c.routes.map(p=>e.jsxs("div",{style:{borderTop:`1px solid ${t.headerBorder}`,paddingTop:7},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8,color:t.textSecondary,fontSize:12},children:[e.jsxs("span",{children:[p.providerDomainId," → ",p.consumerDomainId]}),e.jsx("span",{style:{color:p.state==="authorized"?t.success:p.state==="observed"?t.textMuted:t.warning,fontWeight:700},children:p.state})]}),e.jsx("div",{style:{marginTop:3,color:t.textMuted,fontSize:11},children:p.purpose||p.reasonCodes.join(", ")||"governed route"})]},p.id)):e.jsx("div",{style:{color:t.textMuted,fontSize:12,marginTop:8},children:"No cross-domain routes declared."})})]})]})]}):null]})}function Ze({t,loading:i,domains:r,skills:n,status:o,onBuild:c,onTab:h}){if(i)return e.jsxs("div",{style:{padding:"42px 0",color:t.textMuted,display:"flex",gap:8,alignItems:"center",fontSize:13},children:[e.jsx(L,{size:15})," Loading governed context…"]});const s=[];return r.length?o.ownedDomains<r.length&&s.push(`${r.length-o.ownedDomains} domain${r.length-o.ownedDomains===1?"":"s"} still need an owner.`):s.push("Create a business domain before relying on AI guidance."),n.length||s.push("Draft a domain skill so the agent has governed business guidance."),o.draftSkills&&s.push(`${o.draftSkills} skill${o.draftSkills===1?" is":"s are"} still draft-only and will not guide answers.`),e.jsxs("div",{style:{display:"grid",gap:16},children:[e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:10},children:[e.jsx(H,{t,label:"Domains",value:r.length,detail:`${o.ownedDomains} with an owner`,icon:e.jsx(q,{size:17})}),e.jsx(H,{t,label:"Active skills",value:o.activeSkills,detail:"available to the agent",icon:e.jsx(be,{size:17})}),e.jsx(H,{t,label:"Draft skills",value:o.draftSkills,detail:"review before activation",icon:e.jsx(Y,{size:17})})]}),e.jsxs("section",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:10,background:t.cellBg,padding:16,display:"grid",gap:10},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx(ze,{size:16,color:s.length?t.warning:t.success}),e.jsx("strong",{style:{color:t.textPrimary,fontSize:13},children:"Readiness"})]}),s.length?e.jsx("div",{style:{display:"grid",gap:6},children:s.map(y=>e.jsxs("div",{style:{display:"flex",gap:7,color:t.textSecondary,fontSize:12.5},children:[e.jsx(me,{size:14,color:t.warning}),y]},y))}):e.jsx("div",{style:{color:t.success,fontSize:12.5},children:"Your agent has owned domains and active governed skills available for retrieval."}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:2},children:[e.jsxs("button",{type:"button",onClick:c,style:Se(t),children:[e.jsx(Y,{size:13})," Build domains & skills with AI"]}),e.jsx("button",{type:"button",onClick:()=>h("domains"),style:xe(t),children:"Manage domains"}),e.jsx("button",{type:"button",onClick:()=>h("skills"),style:xe(t),children:"Manage skills"})]})]})]})}function H({t,label:i,value:r,detail:n,icon:o}){return e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:9,background:t.cellBg,padding:13},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:t.textMuted,fontSize:12},children:[i,o]}),e.jsx("div",{style:{color:t.textPrimary,fontSize:25,fontWeight:750,marginTop:7},children:r}),e.jsx("div",{style:{color:t.textMuted,fontSize:11.5,marginTop:3},children:n})]})}function Se(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 12px",borderRadius:7,border:`1px solid ${t.accent}`,background:t.accent,color:"#fff",fontWeight:700,fontSize:12.5,fontFamily:t.font,cursor:"pointer"}}function xe(t){return{display:"inline-flex",alignItems:"center",padding:"7px 12px",borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,fontWeight:650,fontSize:12.5,fontFamily:t.font,cursor:"pointer"}}export{ht as GovernedContextPage,Xe as Knowledge360};
|
package/dist/assets/dql-notebook/assets/{HelpDocsPage-D8hLS5lE.js → HelpDocsPage-Hbh9IeYB.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as k,u as z,t as R,r as u,j as e,aF as I}from"./index-
|
|
1
|
+
import{c as k,u as z,t as R,r as u,j as e,aF as I}from"./index-D3wnucQC.js";import"./react-CRB3T2We.js";/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ot,r as c,a as q,j as e,u as Be,t as Ye,S as Ie,B as ue,C as rt,b as Je,d as st,e as at,L as lt,f as dt,G as Ne,D as be,N as ct,g as pt}from"./index-
|
|
1
|
+
import{c as ot,r as c,a as q,j as e,u as Be,t as Ye,S as Ie,B as ue,C as rt,b as Je,d as st,e as at,L as lt,f as dt,G as Ne,D as be,N as ct,g as pt}from"./index-D3wnucQC.js";import{T as xt}from"./TrustBadge-D5CGp0cu.js";import{A as he}from"./arrow-right-C7G3M_S8.js";import{T as Ke}from"./triangle-alert-BPHvH1wA.js";import{B as Ee}from"./book-open-text-DDBO8G7L.js";import{W as ut}from"./workflow-bOT-NqdO.js";import"./react-CRB3T2We.js";/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as Se,i as je,k as Ce,t as Ee,r as a,az as O,a as pe,aA as Re,aB as Le,aC as Te,aD as Be,j as e,p as R,ax as H,aE as Ie,l as ge}from"./index-D3wnucQC.js";import{u as ze,a as We,M as Me,i as Fe,B as Ne,C as Pe,b as Oe,P as De,c as P,H as he}from"./style-NlN9F6JE.js";import{T as xe}from"./dagre.esm-B6nvU4OB.js";import"./react-CRB3T2We.js";const G=[{key:"technical",label:"Technical",title:"Physical sources and dbt transformations",types:Re},{key:"domain",label:"Domain",title:"Business terms, governed domains, semantic metrics, and certified blocks",types:Le},{key:"end-to-end",label:"End-to-end",title:"Complete path from physical sources through governed meaning to consumption",types:O}],Y=[{type:"block",label:"Blocks"},{type:"app",label:"Apps"},{type:"notebook",label:"Notebooks"},{type:"dashboard",label:"Dashboards"}];function $e(n,h,o="flow",g="LR"){var v;const p=new xe.graphlib.Graph().setDefaultEdgeLabel(()=>({})),m=g==="LR";p.setGraph({rankdir:g,ranksep:o==="layered"?120:m?80:60,nodesep:m?40:50,marginx:32,marginy:32});for(const d of n){const y={width:190,height:58};if(o==="layered"&&((v=d.data)!=null&&v.layer)){const x=Ie.indexOf(d.data.layer);x>=0&&(y.rank=x)}p.setNode(d.id,y)}for(const d of h)p.setEdge(d.source,d.target);return xe.layout(p),n.map(d=>{const y=p.node(d.id);return{...d,position:{x:y.x-95,y:y.y-29},data:{...d.data,direction:g}}})}function _e({data:n,selected:h}){const o=n.nodeType,g=R[o]??"var(--color-text-tertiary)",p=n.direction??"LR",m=p==="LR"?P.Left:P.Top,v=p==="LR"?P.Right:P.Bottom,d=!!n.dimmed,y=n.status==="certified";return e.jsxs("div",{style:{width:196,display:"flex",alignItems:"center",gap:8,background:"var(--color-bg-card)",border:`1.5px solid ${h?"var(--accent)":"var(--border-default)"}`,borderRadius:9,padding:"9px 11px",boxShadow:h?"0 1px 6px rgba(107,93,211,0.16)":"0 1px 4px rgba(26,26,26,0.05)",opacity:d?.3:1,transition:"opacity 0.15s ease"},children:[e.jsx(he,{type:"target",position:m,style:{width:7,height:7,background:g,border:"none"}}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:g,flexShrink:0}}),e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[e.jsx("span",{title:n.label,style:{fontSize:11.5,fontWeight:650,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.label}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:g},children:H[o]??o})]}),y?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null,e.jsx(he,{type:"source",position:v,style:{width:7,height:7,background:g,border:"none"}})]})}const Ae={dagNode:_e};function Je(){var ae,le,de;const n=Se(je(t=>({lineageFocusNodeId:t.lineageFocusNodeId,themeMode:t.themeMode}))),h=Ce(),o=Ee[n.themeMode],[g,p]=a.useState(!0),[m,v]=a.useState({nodes:[],edges:[]}),[d,y]=a.useState({nodes:[],edges:[]}),[x,w]=a.useState(null),[c,L]=a.useState(null),[W,T]=a.useState(!1),[l,s]=a.useState(null),[f,j]=a.useState(Object.fromEntries(O.map(t=>[t,!0]))),[k,Q]=a.useState("flow"),[C,J]=a.useState("LR"),[B,M]=a.useState(null),[D,F]=a.useState(!1),[V,q]=a.useState("block"),[U,K]=a.useState(""),[X,N]=a.useState(!1),[Z,ee]=a.useState(""),[ye,te,fe]=ze([]),[me,oe,be]=We([]),re=a.useCallback(async()=>{p(!0);try{const t=await pe.fetchLineage();v({nodes:t.nodes??[],edges:t.edges??[]})}finally{p(!1)}},[]);a.useEffect(()=>{re()},[re]);const E=a.useMemo(()=>m.nodes.filter(t=>Y.some(r=>r.type===t.type)).sort((t,r)=>t.name.localeCompare(r.name)),[m.nodes]),I=a.useCallback(async t=>{L(t),F(!1),M(null),s(null),T(!0);try{const r=await pe.queryLineage({focus:t,upstreamDepth:12,downstreamDepth:12});y(r.graph??{nodes:[],edges:[]}),w(r.focalNode??null)}finally{T(!1)}},[]);a.useCallback(()=>{L(null),y({nodes:[],edges:[]}),w(null),s(null),M(null),F(!1),h({type:"SET_LINEAGE_FOCUS",nodeId:null})},[h]),a.useEffect(()=>{n.lineageFocusNodeId&&n.lineageFocusNodeId!==c&&I(n.lineageFocusNodeId)},[n.lineageFocusNodeId]);const b=a.useMemo(()=>{const t=new Set(d.nodes.filter(r=>f[r.type]??!0).map(r=>r.id));return{nodes:d.nodes.filter(r=>t.has(r.id)),edges:d.edges.filter(r=>t.has(r.source)&&t.has(r.target))}},[d,f]),z=a.useMemo(()=>{for(const t of G){const r=new Set(t.types);if(O.every(u=>(f[u]??!0)===r.has(u)))return t.key}return"custom"},[f]),ve=a.useCallback(t=>{const r=new Set(t);j(Object.fromEntries(O.map(i=>[i,r.has(i)])))},[]),S=a.useMemo(()=>{if(!B)return null;const t=new Set([B]),r=new Set([B]);let i=!0;for(;i;){i=!1;for(const u of b.edges)t.has(u.target)&&!t.has(u.source)&&(t.add(u.source),i=!0),r.has(u.source)&&!r.has(u.target)&&(r.add(u.target),i=!0)}return new Set([...t,...r])},[B,b.edges]);a.useEffect(()=>{const t=b.nodes.map(i=>({id:i.id,type:"dagNode",selected:i.id===c,position:{x:0,y:0},data:{label:i.name,nodeType:i.type,domain:i.domain,status:i.status,layer:Te(i),dimmed:S?!S.has(i.id):!1}})),r=b.edges.map((i,u)=>{const A=S?S.has(i.source)&&S.has(i.target):!1,ce=A?"var(--accent)":Be[i.type]??"var(--color-text-tertiary)";return{id:`edge-${u}-${i.source}-${i.target}-${i.type}`,source:i.source,target:i.target,style:{stroke:ce,strokeWidth:A?2:1.5,opacity:S&&!A?.25:1},markerEnd:{type:Me.ArrowClosed,color:ce,width:12,height:12}}});te($e(t,r,k,C)),oe(r)},[b,k,C,S,c,oe,te]);const ke=a.useCallback((t,r)=>{M(r.id);const i=b.nodes.find(u=>u.id===r.id)??null;s(i)},[b.nodes]),$=a.useCallback(()=>{M(null),s(null)},[]),_=a.useMemo(()=>{if(!l)return null;const t=d.edges.filter(i=>i.target===l.id).length,r=d.edges.filter(i=>i.source===l.id).length;return{incoming:t,outgoing:r}},[d.edges,l]),ne=(x==null?void 0:x.name)??((ae=E.find(t=>t.id===c))==null?void 0:ae.name)??c??"",we=(x==null?void 0:x.type)??((le=E.find(t=>t.id===c))==null?void 0:le.type)??"block",ie=Z.trim().toLowerCase(),se=(ie?E.filter(t=>t.name.toLowerCase().includes(ie)):E).slice(0,40);return g?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"Loading lineage graph..."}):m.nodes.length===0?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"No lineage graph available yet."}):c?e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)"},children:[e.jsx("div",{style:{padding:8,borderBottom:`1px solid ${o.headerBorder}`,background:o.sidebarBg},children:e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{onClick:()=>F(t=>!t),title:"Change the traced entity",style:{display:"inline-flex",alignItems:"center",gap:7,height:30,padding:"0 11px",borderRadius:8,border:`1px solid ${D?o.accent:o.headerBorder}`,background:D?"var(--accent-dim)":o.cellBg,color:o.textPrimary,cursor:"pointer",fontFamily:o.font,maxWidth:320},children:[e.jsx("span",{style:{fontSize:10.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted},children:"Tracing"}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:R[we]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{fontSize:12.5,fontWeight:650,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ne}),e.jsx("span",{style:{fontSize:9,color:o.textMuted},children:"▾"})]}),D&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>F(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:340,background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:12},children:e.jsx(ue,{t:o,entities:E,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:240})})]})]}),e.jsxs("div",{style:{position:"relative",flex:"0 1 300px",minWidth:160},children:[e.jsxs("svg",{style:{position:"absolute",left:9,top:"50%",transform:"translateY(-50%)",color:o.textMuted,pointerEvents:"none"},width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"m21 21-4.3-4.3"})]}),e.jsx("input",{value:Z,onChange:t=>{ee(t.target.value),N(!0)},onFocus:()=>N(!0),placeholder:"Search another block, app, or notebook…",style:{width:"100%",boxSizing:"border-box",height:30,padding:"0 10px 0 28px",borderRadius:8,border:`1px solid ${X?o.accent:o.headerBorder}`,background:"var(--color-bg-sunken)",color:o.textPrimary,fontSize:12,fontFamily:o.font,outline:"none"}}),X&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>N(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:"min(340px, 90vw)",maxHeight:300,overflow:"auto",background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:4},children:se.length===0?e.jsx("div",{style:{padding:"12px 11px",fontSize:12,color:o.textMuted,fontFamily:o.font},children:"No matching block, app, or notebook."}):se.map(t=>e.jsxs("button",{onClick:()=>{I(t.id),ee(""),N(!1)},style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"8px 10px",border:"none",borderRadius:7,background:t.id===c?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:o.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:R[t.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:550,color:o.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted,flexShrink:0},children:H[t.type]??t.type})]},t.id))})]})]}),e.jsx("div",{style:{width:1,height:20,background:o.headerBorder,margin:"0 2px"}}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden"},children:[e.jsx("button",{onClick:()=>Q("flow"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:k==="flow"?"var(--color-bg-tertiary)":"transparent",color:k==="flow"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Flow"}),e.jsx("button",{onClick:()=>Q("layered"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:k==="layered"?"var(--color-bg-tertiary)":"transparent",color:k==="layered"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Layered"})]}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden",marginRight:4},children:[e.jsxs("button",{title:"Horizontal layout (left → right)",onClick:()=>J("LR"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:C==="LR"?"var(--color-bg-tertiary)":"transparent",color:C==="LR"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"14",height:"10",viewBox:"0 0 14 10",fill:"none",children:[e.jsx("rect",{x:"0",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"4",y1:"5",x2:"10",y2:"5",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M9 3l2 2-2 2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"10",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor"})]}),"LR"]}),e.jsxs("button",{title:"Vertical layout (top → bottom)",onClick:()=>J("TB"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:C==="TB"?"var(--color-bg-tertiary)":"transparent",color:C==="TB"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",children:[e.jsx("rect",{x:"2",y:"0",width:"6",height:"4",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"5",y1:"4",x2:"5",y2:"10",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M3 9l2 2 2-2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"2",y:"10",width:"6",height:"4",rx:"1",fill:"currentColor"})]}),"TB"]})]}),e.jsx("div",{role:"group","aria-label":"Lineage view",style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${o.headerBorder}`,borderRadius:7,background:o.appBg,marginRight:4},children:G.map(t=>e.jsx("button",{onClick:()=>ve(t.types),title:t.title,"aria-pressed":z===t.key,style:{padding:"4px 11px",fontSize:11.5,fontWeight:600,border:"none",borderRadius:5,cursor:"pointer",fontFamily:o.font,whiteSpace:"nowrap",background:z===t.key?"var(--accent-dim)":"transparent",color:z===t.key?o.accent:o.textMuted},children:t.label},t.key))}),B&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1}}),e.jsx("button",{onClick:$,style:{borderRadius:7,border:`1px solid ${o.accent}`,background:"var(--accent-dim)",color:o.accent,cursor:"pointer",fontSize:11.5,fontWeight:650,padding:"5px 11px",whiteSpace:"nowrap"},children:"Show all"})]})]})}),e.jsx("div",{style:{flex:1,position:"relative"},children:e.jsxs(Fe,{nodes:ye,edges:me,onNodesChange:fe,onEdgesChange:be,onNodeClick:ke,onPaneClick:$,nodeTypes:Ae,fitView:!0,fitViewOptions:{padding:.18},proOptions:{hideAttribution:!0},style:{background:"var(--bg-canvas)"},children:[e.jsx(Ne,{color:"var(--border-strong)",gap:22,size:1}),e.jsx(Pe,{showInteractive:!1}),e.jsx(Oe,{nodeColor:t=>{var r;return R[((r=t.data)==null?void 0:r.nodeType)??"source_table"]??"var(--color-text-tertiary)"},maskColor:"color-mix(in srgb, var(--color-bg-primary) 55%, transparent)",style:{background:"var(--color-bg-sunken)",border:"1px solid var(--color-border-primary)"}}),e.jsx(De,{position:"bottom-left",children:l?e.jsxs("div",{style:{width:264,background:"var(--color-bg-card)",border:"1px solid var(--color-border-primary)",borderRadius:11,boxShadow:"0 8px 26px rgba(26,26,26,0.13)",padding:"12px 14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:R[l.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:700,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.name}),e.jsx("button",{onClick:$,title:"Clear focus",style:{width:20,height:20,borderRadius:5,border:"none",background:"none",color:"var(--color-text-tertiary)",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0,flexShrink:0},children:"×"})]}),e.jsxs("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",marginTop:3},children:[H[l.type]??l.type,_?` · ${_.incoming} upstream · ${_.outgoing} downstream`:""]}),l.domain?e.jsxs("div",{style:{fontSize:11.5,color:"var(--color-text-secondary)",lineHeight:1.5,marginTop:7},children:["Domain: ",l.domain]}):null,e.jsxs("div",{style:{display:"flex",gap:8,marginTop:10},children:[e.jsx("button",{onClick:()=>{l&&l.id!==c&&I(l.id)},disabled:!l||l.id===c,title:(l==null?void 0:l.id)===c?"Already the traced entity":"Re-scope lineage to this node",style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"none",background:"var(--accent)",color:"#fff",fontSize:11,fontWeight:650,cursor:(l==null?void 0:l.id)===c?"default":"pointer",opacity:(l==null?void 0:l.id)===c?.5:1},children:"Trace from here"}),e.jsx("button",{onClick:()=>h({type:"OPEN_GLOBAL_AI",autoRun:{text:`Explain the lineage of ${l.name} — where does it come from and what consumes it?`}}),style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"1px solid var(--color-border-primary)",background:"var(--color-bg-card)",color:"var(--color-text-secondary)",fontSize:11,fontWeight:600,cursor:"pointer"},children:"Ask about this"})]})]}):null})]})}),e.jsxs("div",{style:{height:28,flexShrink:0,borderTop:"1px solid var(--border-subtle)",background:"var(--color-bg-card)",display:"flex",alignItems:"center",gap:14,padding:"0 14px",fontSize:10.5,color:"var(--color-text-tertiary)"},children:[e.jsxs("span",{children:[z==="custom"?"Custom":(de=G.find(t=>t.key===z))==null?void 0:de.label," lineage of ",ne," · ",b.nodes.length," nodes · ",b.edges.length," edges",W?" · loading…":""]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:999,background:"var(--status-success)"}}),"Compiled from the dbt manifest"]}),e.jsx("div",{style:{flex:1}}),e.jsx("span",{children:"Click a node to focus its path · click the canvas to clear"})]})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)",alignItems:"center",justifyContent:"center",padding:24,overflow:"auto"},children:e.jsxs("div",{style:{width:"min(560px, 100%)",border:`1px solid ${o.headerBorder}`,borderRadius:14,background:o.cellBg,padding:"22px 22px 18px",boxShadow:"0 1px 4px rgba(26,26,26,0.05)"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:o.textPrimary,fontFamily:o.font},children:"Trace lineage"}),e.jsx("div",{style:{fontSize:12.5,color:o.textMuted,marginTop:3,lineHeight:1.5,fontFamily:o.font},children:"Pick a block, app, or notebook to see its upstream sources and downstream consumers — no project-wide noise."}),e.jsx("div",{style:{marginTop:16},children:e.jsx(ue,{t:o,entities:E,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:300})})]})})}function ue({t:n,entities:h,activeType:o,onTypeChange:g,query:p,onQueryChange:m,onSelect:v,focalId:d,listHeight:y}){var T,l;const x=Y.filter(s=>h.some(f=>f.type===s.type)),w=x.some(s=>s.type===o)?o:((T=x[0])==null?void 0:T.type)??o,c=p.trim().toLowerCase(),L=h.filter(s=>s.type===w).filter(s=>!c||s.name.toLowerCase().includes(c)),W=((l=Y.find(s=>s.type===w))==null?void 0:l.label)??"items";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9,minWidth:0},children:[e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${n.headerBorder}`,borderRadius:8,background:n.appBg,alignSelf:"flex-start",flexWrap:"wrap"},children:x.map(s=>{const f=s.type===w,j=h.filter(k=>k.type===s.type).length;return e.jsxs("button",{onClick:()=>g(s.type),style:{display:"inline-flex",alignItems:"center",gap:6,border:"none",borderRadius:6,padding:"5px 11px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:n.font,background:f?"var(--accent-dim)":"transparent",color:f?n.accent:n.textMuted},children:[s.label,e.jsx("span",{style:{fontSize:10.5,color:f?n.accent:n.textMuted,opacity:.8},children:j})]},s.type)})}),e.jsx("input",{value:p,onChange:s=>m(s.target.value),placeholder:`Search ${W.toLowerCase()}…`,style:{padding:"8px 10px",borderRadius:8,border:`1px solid ${n.headerBorder}`,background:"var(--color-bg-sunken)",color:n.textPrimary,fontSize:12,fontFamily:n.font,outline:"none"}}),e.jsx("div",{style:{maxHeight:y,overflow:"auto",border:`1px solid ${n.headerBorder}`,borderRadius:8},children:L.length===0?e.jsx("div",{style:{padding:"14px 12px",fontSize:12,color:n.textMuted,fontFamily:n.font},children:h.some(s=>s.type===w)?"No matches.":`No ${W.toLowerCase()} in this project yet.`}):L.map((s,f)=>{const j=s.id===d;return e.jsxs("button",{onClick:()=>v(s.id),style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"9px 11px",border:"none",borderTop:f===0?"none":`1px solid ${n.headerBorder}`,background:j?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:n.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:R[s.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:j?650:500,color:n.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name}),s.status==="certified"?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null]},s.id)})})]})}export{Je as LineageDAG};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as O,t as N,r as u,a as A,j as t,p as C,q as E,ax as W,ay as R}from"./index-D3wnucQC.js";import{M as _}from"./MiniLineageGraph-wn0wLc9m.js";import{LineageDAG as H}from"./LineageDAG-OMUP2sbl.js";import{A as F}from"./arrow-left-CF6wxXU5.js";import{L as G}from"./list-tree-DapsIuQB.js";import"./react-CRB3T2We.js";import"./style-NlN9F6JE.js";import"./dagre.esm-B6nvU4OB.js";function U(i){return i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function q(i){if(i==null)return null;if(typeof i=="string")return i.trim()||null;if(typeof i=="number"||typeof i=="boolean")return String(i);if(Array.isArray(i)){const n=i.map(e=>e==null?null:typeof e=="string"||typeof e=="number"||typeof e=="boolean"?String(e):null).filter(e=>!!e);return n.length>0?n.join(", "):null}return null}function V(i){return i?i.type==="term"?"Business definition used by blocks, views, dashboards, and AI agents.":i.type==="business_view"?"Business composition built from trusted terms, DQL blocks, and other business views.":i.type==="block"?"Reusable DQL block with its technical inputs and business consumption paths.":i.type==="dbt_model"||i.type==="dbt_source"||i.type==="source_table"?"Technical data asset connected to semantic, business, and consumption lineage.":i.type==="dashboard"||i.type==="notebook"||i.type==="app"||i.type==="chart"?"Consumption surface showing which trusted blocks and business concepts feed the experience.":"Focused technical and business lineage for the selected item.":"Focused technical and business lineage for the selected item."}function se(){var z;const{state:i,dispatch:n}=O(),e=N[i.themeMode],r=i.lineageFocusNodeId,[o,l]=u.useState({nodes:[],edges:[],focalNode:null}),[d,h]=u.useState(!1),[c,x]=u.useState("details"),[w,S]=u.useState(!1);u.useEffect(()=>{if(!r)return;let s=!1;return h(!0),A.queryLineage({focus:r,upstreamDepth:3,downstreamDepth:3}).then(v=>{var I,L;s||(l({nodes:((I=v.graph)==null?void 0:I.nodes)??[],edges:((L=v.graph)==null?void 0:L.edges)??[],focalNode:v.focalNode??null}),h(!1))}).catch(()=>{s||h(!1)}),()=>{s=!0}},[r]);const a=o.focalNode,m=u.useMemo(()=>new Map(o.nodes.map(s=>[s.id,s])),[o.nodes]),b=u.useMemo(()=>a?o.edges.filter(s=>s.target===a.id).map(s=>({edge:s,node:m.get(s.source)})).filter(s=>!!s.node):[],[a,o.edges,m]),j=u.useMemo(()=>a?o.edges.filter(s=>s.source===a.id).map(s=>({edge:s,node:m.get(s.target)})).filter(s=>!!s.node):[],[a,o.edges,m]);if(!r||w)return t.jsxs("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[w&&r?t.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",borderBottom:`1px solid ${e.headerBorder}`,background:e.cellBg},children:t.jsx("button",{type:"button",onClick:()=>S(!1),style:{border:`1px solid ${e.headerBorder}`,background:e.cellBg,color:e.textSecondary,borderRadius:7,padding:"5px 11px",fontSize:11.5,fontWeight:600,cursor:"pointer",fontFamily:e.font},children:"← Back to focused view"})}):null,t.jsx(H,{})]});const f=(a==null?void 0:a.type)??r.split(":")[0]??"node",D=C[f]??e.accent,P=E[f]??f.slice(0,4).toUpperCase(),B=(a==null?void 0:a.metadata)??{},k=B.path??B.filePath,$=(a==null?void 0:a.name)??r,g=i.sidebarOpen&&i.sidebarPanel==="lineage",p=((z=i.lineageReturnTarget)==null?void 0:z.view)==="apps"?i.lineageReturnTarget:null,T=p!=null&&p.label?`Back to ${p.label}`:"Back to app";return t.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:"var(--color-bg-primary)"},children:[t.jsx("div",{style:{padding:"22px 28px 18px",borderBottom:`1px solid ${e.headerBorder}`,background:e.appBg},children:t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:16},children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[t.jsx("span",{style:{color:e.appBg,background:D,borderRadius:5,padding:"3px 7px",fontSize:10,fontWeight:800,letterSpacing:0},title:W[f]??f,children:P}),t.jsxs("span",{style:{color:e.textMuted,fontSize:12},children:["Focused lineage · ↑ ",b.length," · ↓ ",j.length]})]}),t.jsx("h1",{style:{margin:0,fontSize:26,lineHeight:1.15,color:e.textPrimary},children:$}),t.jsx("div",{style:{marginTop:7,color:e.textMuted,fontSize:13,maxWidth:760,lineHeight:1.45},children:V(a)})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[t.jsx("button",{type:"button",onClick:()=>S(!0),title:"Open the full lineage graph",style:{display:"inline-flex",alignItems:"center",gap:6,border:`1px solid ${e.headerBorder}`,background:e.cellBg,color:e.textSecondary,borderRadius:7,padding:"6px 11px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:e.font,whiteSpace:"nowrap"},children:"Full graph"}),p?t.jsxs("button",{type:"button",onClick:()=>{n({type:"OPEN_APP",appId:p.appId,dashboardId:p.dashboardId??null,experience:p.experience,section:p.section})},title:T,style:{display:"inline-flex",alignItems:"center",gap:7,border:`1px solid ${e.headerBorder}`,background:e.sidebarBg,color:e.textPrimary,borderRadius:6,padding:"7px 10px",fontSize:12,fontWeight:800,cursor:"pointer",whiteSpace:"nowrap",maxWidth:220,overflow:"hidden",textOverflow:"ellipsis"},children:[t.jsx(F,{size:14}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:T})]}):null,t.jsxs("button",{type:"button",onClick:()=>{n(g?{type:"TOGGLE_SIDEBAR"}:{type:"SET_SIDEBAR_PANEL",panel:"lineage"})},style:{display:"inline-flex",alignItems:"center",gap:7,border:`1px solid ${g?e.accent:e.headerBorder}`,background:g?`${e.accent}1a`:e.sidebarBg,color:g?e.textPrimary:e.textSecondary,borderRadius:6,padding:"7px 10px",fontSize:12,fontWeight:800,cursor:"pointer",whiteSpace:"nowrap"},children:[t.jsx(G,{size:14}),g?"Hide list":"Browse lineage"]})]})]})}),t.jsxs("div",{style:{padding:16,display:"grid",gridTemplateColumns:"minmax(0, 1fr) clamp(190px, 26%, 280px)",gap:14,minHeight:"calc(100vh - 160px)",minWidth:0},children:[t.jsxs("section",{style:{border:`1px solid ${e.headerBorder}`,borderRadius:8,background:e.sidebarBg,overflow:"hidden",display:"flex",flexDirection:"column",minWidth:0,minHeight:560},children:[t.jsxs("div",{style:{padding:"10px 12px",borderBottom:`1px solid ${e.headerBorder}`,flexShrink:0},children:[t.jsx("div",{style:{fontWeight:800,color:e.textPrimary,fontSize:14},children:"Focused lineage"}),t.jsx("div",{style:{color:e.textMuted,fontSize:12,marginTop:3},children:"Technical chain, business concepts, and consumption endpoints for this item."})]}),t.jsx("div",{style:{flex:1,minHeight:490,padding:12},children:d?t.jsx("div",{style:{color:e.textMuted,fontSize:12},children:"Loading lineage..."}):o.nodes.length===0?t.jsx("div",{style:{color:e.textMuted,fontSize:12},children:"No lineage available."}):t.jsx(_,{nodes:o.nodes,edges:o.edges,focalNodeId:r,height:"100%",fitViewPadding:.04,onNodeClick:s=>{n({type:"OPEN_LINEAGE_DETAIL",nodeId:s})},interactive:!0})})]}),t.jsxs("aside",{"aria-label":"Lineage details",style:{border:`1px solid ${e.headerBorder}`,borderRadius:8,background:e.sidebarBg,minWidth:0,maxHeight:"calc(100vh - 160px)",overflow:"hidden",display:"flex",flexDirection:"column"},children:[t.jsxs("div",{style:{padding:8,borderBottom:`1px solid ${e.headerBorder}`,display:"grid",gridTemplateColumns:"1fr 1fr",gap:4},children:[t.jsx(y,{label:"Details",active:c==="details",onClick:()=>x("details"),t:e}),t.jsx(y,{label:`Up ${b.length}`,active:c==="upstream",onClick:()=>x("upstream"),t:e}),t.jsx(y,{label:`Down ${j.length}`,active:c==="downstream",onClick:()=>x("downstream"),t:e}),t.jsx(y,{label:"Source",active:c==="source",onClick:()=>x("source"),t:e})]}),t.jsxs("div",{style:{padding:12,overflow:"auto",flex:1,minHeight:0},children:[c==="details"&&(a?t.jsx(Q,{node:a,t:e}):t.jsx(Y,{t:e,label:"No metadata available."})),c==="upstream"&&t.jsx(M,{title:"Upstream",connections:b,t:e}),c==="downstream"&&t.jsx(M,{title:"Downstream",connections:j,t:e}),c==="source"&&t.jsx(K,{filePath:typeof k=="string"?k:null,t:e})]})]})]})]})}function y({label:i,active:n,onClick:e,t:r}){return t.jsx("button",{onClick:e,style:{border:`1px solid ${n?r.accent:r.headerBorder}`,background:n?`${r.accent}1c`:"transparent",color:n?r.textPrimary:r.textMuted,borderRadius:5,padding:"5px 6px",fontSize:10,fontWeight:800,cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i})}function Y({t:i,label:n}){return t.jsx("div",{style:{color:i.textMuted,fontSize:12,lineHeight:1.45},children:n})}function Q({node:i,t:n}){const e=i.metadata??{},r=new Set,o=[],l=(d,h,c=d)=>{const x=q(h);!x||r.has(c)||(r.add(c),o.push({label:d,value:x}))};l("Type",W[i.type]??i.type,"type"),l("Domain",i.domain,"domain"),l("Owner",i.owner,"owner"),l("Status",i.status,"status"),l("Term Type",e.termType,"termType"),l("Block Type",e.blockType,"blockType"),l("Materialized As",e.materializedAs,"materializedAs"),l("Identifiers",e.identifiers,"identifiers"),l("Synonyms",e.synonyms,"synonyms"),l("Description",e.description,"description"),l("Business Outcome",e.businessOutcome,"businessOutcome"),l("Decision Use",e.decisionUse,"decisionUse"),l("Review Cadence",e.reviewCadence,"reviewCadence");for(const[d,h]of Object.entries(e))d==="path"||d==="filePath"||d==="sql"||d==="compiledSql"||l(U(d),h,d);return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:n.textPrimary,marginBottom:10},children:"Lineage metadata"}),o.length===0?t.jsx("div",{style:{color:n.textMuted,fontSize:12},children:"No metadata available for this node."}):t.jsx("div",{style:{display:"grid",gap:8},children:o.map(d=>t.jsxs("div",{style:{display:"grid",gap:3},children:[t.jsx("div",{style:{color:n.textMuted,fontSize:10,fontWeight:800,textTransform:"uppercase"},children:d.label}),t.jsx("div",{style:{color:n.textSecondary,fontSize:12,lineHeight:1.45},children:d.value})]},d.label))})]})}function M({title:i,connections:n,t:e}){return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:e.textPrimary,marginBottom:10},children:i}),n.length===0?t.jsxs("div",{style:{color:e.textMuted,fontSize:12},children:["No ",i.toLowerCase()," connections in this focused window."]}):t.jsxs("div",{style:{display:"grid",gap:7},children:[n.slice(0,10).map(({edge:r,node:o})=>{const l=C[o.type]??e.textMuted;return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"92px 1fr",gap:8,minWidth:0,fontSize:12},children:[t.jsx("span",{style:{color:e.textMuted},children:R[r.type]??r.type}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:0},children:[t.jsx("span",{style:{color:e.appBg,background:l,borderRadius:3,padding:"1px 4px",fontSize:9,fontWeight:800,flexShrink:0},children:E[o.type]??o.type.slice(0,4).toUpperCase()}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:o.name,children:o.name})]})]},`${r.source}-${r.target}-${r.type}`)}),n.length>10&&t.jsxs("div",{style:{color:e.textMuted,fontSize:12},children:[n.length-10," more connection",n.length-10===1?"":"s"," in the graph"]})]})]})}function K({filePath:i,t:n}){const e=i==null?void 0:i.trim();return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:n.textPrimary,marginBottom:10},children:"Source file"}),e?t.jsx("div",{style:{color:n.textMuted,fontSize:12,lineHeight:1.5,overflowWrap:"anywhere"},children:e}):t.jsx("div",{style:{color:n.textMuted,fontSize:12},children:"No source file path available for this node."})]})}export{se as LineageDetailView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as F,t as J,r as l,a as K,p as R,q as I,j as t,ax as Q,ay as Z}from"./index-D3wnucQC.js";import{M as ee}from"./MiniLineageGraph-wn0wLc9m.js";import{P as te}from"./panel-right-open-DcnKWxfx.js";import{X as B}from"./x-fp82BETM.js";import{M as re}from"./minimize-2-BlVoipnT.js";import{R as ie}from"./rotate-ccw-B2p953Zh.js";import{G as ne}from"./grip-vertical-DVu7ok6x.js";import{E as se}from"./external-link-WciAU8Bu.js";import"./react-CRB3T2We.js";import"./style-NlN9F6JE.js";import"./dagre.esm-B6nvU4OB.js";const O=320,oe=48;function T(){return typeof window>"u"?380:Math.min(420,Math.max(O,Math.round(window.innerWidth*.42)))}function ae(){return typeof window>"u"?760:Math.max(420,Math.min(880,Math.round(window.innerWidth*.72)))}function le(o){return Math.min(ae(),Math.max(O,o))}function ve(){var E,D;const{state:o,dispatch:a}=F(),e=J[o.themeMode],n=o.lineageDrawerNodeId,[s,m]=l.useState({nodes:[],edges:[],focalNode:null}),[N,y]=l.useState(!1),j=l.useRef(null),[A,P]=l.useState(360),[w,S]=l.useState(()=>T()),[k,f]=l.useState(!1),[p,M]=l.useState(!1),b=l.useRef(w);l.useEffect(()=>{const r=j.current;if(!r)return;const d=new ResizeObserver(u=>{for(const c of u){const x=Math.max(160,c.contentRect.height);P(x)}});return d.observe(r),()=>d.disconnect()},[]),l.useEffect(()=>{if(!n)return;let r=!1;return y(!0),K.queryLineage({focus:n,upstreamDepth:2,downstreamDepth:2}).then(d=>{var u,c;r||(m({nodes:((u=d.graph)==null?void 0:u.nodes)??[],edges:((c=d.graph)==null?void 0:c.edges)??[],focalNode:d.focalNode??null}),y(!1))}).catch(()=>{r||y(!1)}),()=>{r=!0}},[n]);const i=s.focalNode,$=i?s.edges.filter(r=>r.target===i.id).length:0,_=i?s.edges.filter(r=>r.source===i.id).length:0,H=i?R[i.type]??e.textSecondary:e.textSecondary,G=i?I[i.type]??i.type.toUpperCase():"",g=l.useMemo(()=>new Map(s.nodes.map(r=>[r.id,r])),[s.nodes]),U=l.useMemo(()=>i?s.edges.filter(r=>r.target===i.id).map(r=>({edge:r,node:g.get(r.source)})).filter(r=>!!r.node):[],[i,s.edges,g]),X=l.useMemo(()=>i?s.edges.filter(r=>r.source===i.id).map(r=>({edge:r,node:g.get(r.target)})).filter(r=>!!r.node):[],[i,s.edges,g]),v=((E=i==null?void 0:i.metadata)==null?void 0:E.path)??((D=i==null?void 0:i.metadata)==null?void 0:D.filePath);if(!n)return null;const q=r=>{r!==n&&a({type:"OPEN_LINEAGE_DRAWER",nodeId:r})},Y=r=>{r.preventDefault(),r.stopPropagation(),k&&f(!1);const d=r.clientX,u=b.current;M(!0);const c=V=>{const L=le(u+(d-V.clientX));b.current=L,S(L)},x=()=>{M(!1),document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",x)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",c),window.addEventListener("mouseup",x)},z=()=>{const r=T();b.current=r,S(r),f(!1)},W=()=>a({type:"CLOSE_LINEAGE_DRAWER"});return k?t.jsxs("aside",{"aria-label":"Collapsed lineage drawer",style:{width:oe,flexShrink:0,borderLeft:`1px solid ${e.headerBorder}`,background:e.appBg,color:e.textPrimary,display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"10px 6px",overflow:"hidden"},children:[t.jsx(h,{title:"Show lineage details",onClick:()=>f(!1),t:e,children:t.jsx(te,{size:15,strokeWidth:1.9})}),t.jsx(h,{title:"Hide lineage drawer",onClick:W,t:e,children:t.jsx(B,{size:15,strokeWidth:2})}),t.jsx("div",{title:(i==null?void 0:i.name)??n,style:{writingMode:"vertical-rl",transform:"rotate(180deg)",color:e.textMuted,fontSize:11,fontWeight:700,lineHeight:1,marginTop:4,maxHeight:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(i==null?void 0:i.name)??"Lineage"})]}):t.jsxs("aside",{"aria-label":"Lineage drawer",style:{width:w,flexShrink:0,borderLeft:`1px solid ${e.headerBorder}`,background:e.appBg,color:e.textPrimary,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative",animation:"dql-drawer-slide-in 180ms cubic-bezier(0.22, 0.61, 0.36, 1)"},children:[t.jsx("div",{onMouseDown:Y,onDoubleClick:z,title:"Drag to resize. Double-click to reset width.",style:{position:"absolute",top:0,left:0,width:8,height:"100%",cursor:"col-resize",zIndex:20,display:"flex",alignItems:"center",justifyContent:"center",background:p?`${e.accent}1f`:"transparent",transition:p?"none":"background 0.15s"},onMouseEnter:r=>{p||(r.currentTarget.style.background=`${e.accent}14`)},onMouseLeave:r=>{p||(r.currentTarget.style.background="transparent")},children:t.jsx("div",{style:{width:3,height:44,borderRadius:999,background:p?e.accent:e.headerBorder,boxShadow:p?`0 0 0 3px ${e.accent}1f`:"none"}})}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 14px 11px",borderBottom:`1px solid ${e.headerBorder}`,background:e.appBg,flexShrink:0},children:[t.jsx("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:38,padding:"2px 6px",background:H,color:e.appBg,fontSize:10,fontWeight:700,letterSpacing:0,borderRadius:4},title:i?Q[i.type]??i.type:"",children:G||"NODE"}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{color:e.textMuted,fontSize:10,fontWeight:800,marginBottom:3},children:"Lineage Inspector"}),t.jsx("div",{style:{fontSize:14,fontWeight:700,color:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:(i==null?void 0:i.name)??n,children:(i==null?void 0:i.name)??n}),t.jsxs("div",{style:{fontSize:11,color:e.textMuted,marginTop:2},children:["Lineage · ↑ ",$," · ↓ ",_]})]}),t.jsx(h,{title:"Collapse drawer",onClick:()=>f(!0),t:e,children:t.jsx(re,{size:14,strokeWidth:1.8})}),t.jsx(h,{title:"Reset width",onClick:z,t:e,children:t.jsx(ie,{size:14,strokeWidth:1.8})}),t.jsx(h,{title:"Hide lineage drawer",onClick:W,t:e,children:t.jsx(B,{size:14,strokeWidth:2})})]}),t.jsxs("div",{style:{height:30,padding:"0 14px",borderBottom:`1px solid ${e.headerBorder}`,display:"flex",alignItems:"center",gap:8,color:e.textMuted,fontSize:11,flexShrink:0,background:e.sidebarBg},children:[t.jsx(ne,{size:13,strokeWidth:1.8}),t.jsx("span",{children:"Drag the left edge to resize"}),t.jsxs("span",{style:{marginLeft:"auto",color:e.textMuted},children:[w,"px"]})]}),i&&t.jsx(de,{node:i,t:e}),t.jsx("div",{ref:j,style:{flex:1,minHeight:220,padding:12,overflow:"hidden",display:"flex",background:e.appBg},children:N?t.jsx("div",{style:{color:e.textMuted,fontSize:12,padding:8},children:"Loading lineage…"}):s.nodes.length===0?t.jsx("div",{style:{color:e.textMuted,fontSize:12,padding:8},children:"No lineage available for this node."}):t.jsx("div",{style:{flex:1,minWidth:0},children:t.jsx(ee,{nodes:s.nodes,edges:s.edges,focalNodeId:n,height:Math.max(0,A-24),onNodeClick:q,interactive:!0})})}),i&&t.jsxs("div",{style:{borderTop:`1px solid ${e.headerBorder}`,padding:"10px 12px",display:"grid",gap:10,maxHeight:280,overflow:"auto",background:e.sidebarBg,flexShrink:0},children:[t.jsx(C,{title:"Upstream",connections:U,t:e}),t.jsx(C,{title:"Downstream",connections:X,t:e})]}),typeof v=="string"&&t.jsxs("div",{style:{padding:"8px 14px",borderTop:`1px solid ${e.headerBorder}`,fontSize:11,color:e.textMuted,display:"flex",alignItems:"center",gap:6},children:[t.jsx(se,{size:11,strokeWidth:1.75}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:v,children:v})]})]})}function de({node:o,t:a}){const e=o.metadata??{},n=[];return o.domain&&n.push({label:"Domain",value:o.domain}),o.owner&&n.push({label:"Owner",value:o.owner}),o.status&&n.push({label:"Status",value:o.status}),o.type==="term"&&typeof e.termType=="string"&&n.push({label:"Term Type",value:e.termType}),o.type==="block"&&typeof e.blockType=="string"&&n.push({label:"Block Type",value:e.blockType}),typeof e.materializedAs=="string"&&n.push({label:"Materialized As",value:e.materializedAs}),Array.isArray(e.identifiers)&&e.identifiers.length>0&&n.push({label:"Identifiers",value:e.identifiers.map(String).join(", ")}),Array.isArray(e.synonyms)&&e.synonyms.length>0&&n.push({label:"Synonyms",value:e.synonyms.map(String).join(", ")}),typeof e.description=="string"&&e.description.trim()&&n.push({label:"Description",value:e.description}),typeof e.businessOutcome=="string"&&e.businessOutcome.trim()&&n.push({label:"Business Outcome",value:e.businessOutcome}),n.length===0?null:t.jsx("div",{style:{padding:"10px 14px",borderBottom:`1px solid ${a.headerBorder}`,display:"grid",gap:6,background:a.sidebarBg},children:n.slice(0,6).map(s=>t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"92px 1fr",gap:8,minWidth:0},children:[t.jsx("span",{style:{color:a.textMuted,fontSize:10,fontWeight:700,textTransform:"uppercase"},children:s.label}),t.jsx("span",{style:{color:a.textSecondary,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:s.value.length>90?"normal":"nowrap"},title:s.value,children:s.value})]},s.label))})}function C({title:o,connections:a,t:e}){return a.length===0?t.jsxs("div",{style:{color:e.textMuted,fontSize:11},children:[o,": none in this focused window"]}):t.jsxs("div",{children:[t.jsx("div",{style:{color:e.textMuted,fontSize:10,fontWeight:700,textTransform:"uppercase",marginBottom:5},children:o}),t.jsxs("div",{style:{display:"grid",gap:4},children:[a.slice(0,5).map(({edge:n,node:s})=>{const m=R[s.type]??e.textMuted;return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"76px 1fr",gap:8,alignItems:"center",fontSize:11,minWidth:0},children:[t.jsx("span",{style:{color:e.textMuted},children:Z[n.type]??n.type}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,minWidth:0},children:[t.jsx("span",{style:{color:e.appBg,background:m,borderRadius:3,padding:"1px 4px",fontSize:8,fontWeight:700,flexShrink:0},children:I[s.type]??s.type.slice(0,4).toUpperCase()}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:s.name,children:s.name})]})]},`${n.source}-${n.target}-${n.type}`)}),a.length>5&&t.jsxs("div",{style:{color:e.textMuted,fontSize:11},children:[a.length-5," more connection",a.length-5===1?"":"s"," in the graph"]})]})]})}function h({title:o,onClick:a,children:e,t:n}){return t.jsx("button",{"aria-label":o,title:o,onClick:a,style:{width:26,height:26,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:`1px solid ${n.headerBorder}`,borderRadius:5,color:n.textSecondary,cursor:"pointer"},onMouseEnter:s=>{s.currentTarget.style.color=n.textPrimary,s.currentTarget.style.background=n.textPrimary+"0f"},onMouseLeave:s=>{s.currentTarget.style.color=n.textSecondary,s.currentTarget.style.background="transparent"},children:e})}export{ve as LineageDrawer};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as v,j as d,t as _e,Z as Be,_ as he,at as Ie,a as Te,au as je,av as ze,aw as Oe,R as ye,p as Ne,q as Ke}from"./index-
|
|
1
|
+
import{r as v,j as d,t as _e,Z as Be,_ as he,at as Ie,a as Te,au as je,av as ze,aw as Oe,R as ye,p as Ne,q as Ke}from"./index-D3wnucQC.js";import{S as V,g as ve,E as S,s as Qe,a as g,b as Se,c as Ze,P as Ge,d as Ue,e as Ve,F as He,f as Ye,h as we,V as Je,D as R,R as Xe,i as et,C as M,j as ke,k as y,r as tt,l as rt,m as nt,u as st,n as at,t as it,o as ot,p as lt,q as ct,v as ut,w as ht,x as dt,y as ft,z as pt,A as mt,B as gt,G as xt,H as bt,I as yt,J as vt,K as St,L as wt,M as kt,N as de,O as Ct,Q as u}from"./codemirror-DXt7RW72.js";const fe=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class _{constructor(e,r,n=0,s=e.length,a,i){this.test=i,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,s),this.bufferStart=n,this.normalize=a?o=>a(fe(o)):fe,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ue(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let r=et(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Ve(e);let s=this.normalize(r);if(s.length)for(let a=0,i=n;;a++){let o=s.charCodeAt(a),l=this.match(o,i,this.bufferPos+this.bufferStart);if(a==s.length-1){if(l)return this.value=l,this;break}i==n&&a<r.length&&r.charCodeAt(a)==o&&i++}}}match(e,r,n){let s=null;for(let a=0;a<this.matches.length;a+=2){let i=this.matches[a],o=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?s={from:this.matches[a+1],to:n}:(this.matches[a]++,o=!0)),o||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:r,to:n}:this.matches.push(1,r)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(_.prototype[Symbol.iterator]=function(){return this});const Ce={from:-1,to:-1,match:/.*/.exec("")},ae="gm"+(/x/.unicode==null?"":"u");class Me{constructor(e,r,n,s=0,a=e.length){if(this.text=e,this.to=a,this.curLine="",this.done=!1,this.value=Ce,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new Le(e,r,n,s,a);this.re=new RegExp(r,ae+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.iter=e.iter();let i=e.lineAt(s);this.curLineStart=i.from,this.matchPos=K(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,s=n+r[0].length;if(this.matchPos=K(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const J=new WeakMap;class W{constructor(e,r){this.from=e,this.text=r}get to(){return this.from+this.text.length}static get(e,r,n){let s=J.get(e);if(!s||s.from>=n||s.to<=r){let o=new W(r,e.sliceString(r,n));return J.set(e,o),o}if(s.from==r&&s.to==n)return s;let{text:a,from:i}=s;return i>r&&(a=e.sliceString(r,i)+a,i=r),s.to<n&&(a+=e.sliceString(s.to,n)),J.set(e,new W(i,a)),new W(r,a.slice(r-i,n-i))}}class Le{constructor(e,r,n,s,a){this.text=e,this.to=a,this.done=!1,this.value=Ce,this.matchPos=K(e,s),this.re=new RegExp(r,ae+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=W.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,s=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this.matchPos=K(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=W.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Me.prototype[Symbol.iterator]=Le.prototype[Symbol.iterator]=function(){return this});function Mt(t){try{return new RegExp(t,ae),!0}catch{return!1}}function K(t,e){if(e>=t.length)return e;let r=t.lineAt(e),n;for(;e<r.to&&(n=r.text.charCodeAt(e-r.from))>=56320&&n<57344;)e++;return e}const Lt=t=>{let{state:e}=t,r=String(e.doc.lineAt(t.state.selection.main.head).number),{close:n,result:s}=Qe(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:e.phrase("go")});return s.then(a=>{let i=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!i){t.dispatch({effects:n});return}let o=e.doc.lineAt(e.selection.main.head),[,l,c,m,w]=i,k=m?+m.slice(1):0,f=c?+c:o.number;if(c&&w){let E=f/100;l&&(E=E*(l=="-"?-1:1)+o.number/e.doc.lines),f=Math.round(e.doc.lines*E)}else c&&l&&(f=f*(l=="-"?-1:1)+o.number);let T=e.doc.line(Math.max(1,Math.min(e.doc.lines,f))),A=S.cursor(T.from+Math.max(0,Math.min(k,T.length)));t.dispatch({effects:[n,g.scrollIntoView(A.from,{y:"center"})],selection:A})}),!0},Et=({state:t,dispatch:e})=>{let{selection:r}=t,n=S.create(r.ranges.map(s=>t.wordAt(s.head)||S.cursor(s.head)),r.mainIndex);return n.eq(r)?!1:(e(t.update({selection:n})),!0)};function Rt(t,e){let{main:r,ranges:n}=t.selection,s=t.wordAt(r.head),a=s&&s.from==r.from&&s.to==r.to;for(let i=!1,o=new _(t.doc,e,n[n.length-1].to);;)if(o.next(),o.done){if(i)return null;o=new _(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),i=!0}else{if(i&&n.some(l=>l.from==o.value.from))continue;if(a){let l=t.wordAt(o.value.from);if(!l||l.from!=o.value.from||l.to!=o.value.to)continue}return o.value}}const qt=({state:t,dispatch:e})=>{let{ranges:r}=t.selection;if(r.some(a=>a.from===a.to))return Et({state:t,dispatch:e});let n=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some(a=>t.sliceDoc(a.from,a.to)!=n))return!1;let s=Rt(t,n);return s?(e(t.update({selection:t.selection.addRange(S.range(s.from,s.to),!1),effects:g.scrollIntoView(s.to)})),!0):!1},q=He.define({combine(t){return Ye(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Kt(e),scrollToMatch:e=>g.scrollIntoView(e)})}});function At(t){return t?[q.of(t),se]:se}class Ee{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Mt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
|
|
2
2
|
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new _t(this):new Wt(this)}getCursor(e,r=0,n){let s=e.doc?e:we.create({doc:e});return n==null&&(n=s.doc.length),this.regexp?F(this,s,r,n):$(this,s,r,n)}}class Re{constructor(e){this.spec=e}}function $t(t,e,r){return(n,s,a,i)=>{if(r&&!r(n,s,a,i))return!1;let o=n>=i&&s<=i+a.length?a.slice(n-i,s-i):e.doc.sliceString(n,s);return t(o,e,n,s)}}function $(t,e,r,n){let s;return t.wholeWord&&(s=Ft(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(s=$t(t.test,e,s)),new _(e.doc,t.unquoted,r,n,t.caseSensitive?void 0:a=>a.toLowerCase(),s)}function Ft(t,e){return(r,n,s,a)=>((a>r||a+s.length<n)&&(a=Math.max(0,r-2),s=t.sliceString(a,Math.min(t.length,n+2))),(e(Q(s,r-a))!=M.Word||e(Z(s,r-a))!=M.Word)&&(e(Z(s,n-a))!=M.Word||e(Q(s,n-a))!=M.Word))}class Wt extends Re{constructor(e){super(e)}nextMatch(e,r,n){let s=$(this.spec,e,n,e.doc.length).nextOverlapping();if(s.done){let a=Math.min(e.doc.length,r+this.spec.unquoted.length);s=$(this.spec,e,0,a).nextOverlapping()}return s.done||s.value.from==r&&s.value.to==n?null:s.value}prevMatchInRange(e,r,n){for(let s=n;;){let a=Math.max(r,s-1e4-this.spec.unquoted.length),i=$(this.spec,e,a,s),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(a==r)return null;s-=1e4}}prevMatch(e,r,n){let s=this.prevMatchInRange(e,0,r);return s||(s=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=r||s.to!=n)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,r){let n=$(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=r)return null;s.push(n.value)}return s}highlight(e,r,n,s){let a=$(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}function Pt(t,e,r){return(n,s,a)=>(!r||r(n,s,a))&&t(a[0],e,n,s)}function F(t,e,r,n){let s;return t.wholeWord&&(s=Dt(e.charCategorizer(e.selection.main.head))),t.test&&(s=Pt(t.test,e,s)),new Me(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:s},r,n)}function Q(t,e){return t.slice(ke(t,e,!1),e)}function Z(t,e){return t.slice(e,ke(t,e))}function Dt(t){return(e,r,n)=>!n[0].length||(t(Q(n.input,n.index))!=M.Word||t(Z(n.input,n.index))!=M.Word)&&(t(Z(n.input,n.index+n[0].length))!=M.Word||t(Q(n.input,n.index+n[0].length))!=M.Word)}class _t extends Re{nextMatch(e,r,n){let s=F(this.spec,e,n,e.doc.length).next();return s.done&&(s=F(this.spec,e,0,r).next()),s.done?null:s.value}prevMatchInRange(e,r,n){for(let s=1;;s++){let a=Math.max(r,n-s*1e4),i=F(this.spec,e,a,n),o=null;for(;!i.next().done;)o=i.value;if(o&&(a==r||o.from>a+10))return o;if(a==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let s=n.length;s>0;s--){let a=+n.slice(0,s);if(a>0&&a<e.match.length)return e.match[a]+n.slice(s)}return r})}matchAll(e,r){let n=F(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=r)return null;s.push(n.value)}return s}highlight(e,r,n,s){let a=F(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}const B=V.define(),ie=V.define(),L=Se.define({create(t){return new X(ne(t).create(),null)},update(t,e){for(let r of e.effects)r.is(B)?t=new X(r.value.create(),t.panel):r.is(ie)&&(t=new X(t.query,r.value?oe:null));return t},provide:t=>Ze.from(t,e=>e.panel)});class X{constructor(e,r){this.query=e,this.panel=r}}const Bt=R.mark({class:"cm-searchMatch"}),It=R.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Tt=Je.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(L))}update(t){let e=t.state.field(L);(e!=t.startState.field(L)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return R.none;let{view:r}=this,n=new Xe;for(let s=0,a=r.visibleRanges,i=a.length;s<i;s++){let{from:o,to:l}=a[s];for(;s<i-1&&l>a[s+1].from-500;)l=a[++s].to;t.highlight(r.state,o,l,(c,m)=>{let w=r.state.selection.ranges.some(k=>k.from==c&&k.to==m);n.add(c,m,w?It:Bt)})}return n.finish()}},{decorations:t=>t.decorations});function I(t){return e=>{let r=e.state.field(L,!1);return r&&r.query.spec.valid?t(e,r):$e(e)}}const G=I((t,{query:e})=>{let{to:r}=t.state.selection.main,n=e.nextMatch(t.state,r,r);if(!n)return!1;let s=S.single(n.from,n.to),a=t.state.facet(q);return t.dispatch({selection:s,effects:[le(t,n),a.scrollToMatch(s.main,t)],userEvent:"select.search"}),Ae(t),!0}),U=I((t,{query:e})=>{let{state:r}=t,{from:n}=r.selection.main,s=e.prevMatch(r,n,n);if(!s)return!1;let a=S.single(s.from,s.to),i=t.state.facet(q);return t.dispatch({selection:a,effects:[le(t,s),i.scrollToMatch(a.main,t)],userEvent:"select.search"}),Ae(t),!0}),jt=I((t,{query:e})=>{let r=e.matchAll(t.state,1e3);return!r||!r.length?!1:(t.dispatch({selection:S.create(r.map(n=>S.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),zt=({state:t,dispatch:e})=>{let r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:s}=r.main,a=[],i=0;for(let o=new _(t.doc,t.sliceDoc(n,s));!o.next().done;){if(a.length>1e3)return!1;o.value.from==n&&(i=a.length),a.push(S.range(o.value.from,o.value.to))}return e(t.update({selection:S.create(a,i),userEvent:"select.search.matches"})),!0},pe=I((t,{query:e})=>{let{state:r}=t,{from:n,to:s}=r.selection.main;if(r.readOnly)return!1;let a=e.nextMatch(r,n,n);if(!a)return!1;let i=a,o=[],l,c,m=[];i.from==n&&i.to==s&&(c=r.toText(e.getReplacement(i)),o.push({from:i.from,to:i.to,insert:c}),i=e.nextMatch(r,i.from,i.to),m.push(g.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+".")));let w=t.state.changes(o);return i&&(l=S.single(i.from,i.to).map(w),m.push(le(t,i)),m.push(r.facet(q).scrollToMatch(l.main,t))),t.dispatch({changes:w,selection:l,effects:m,userEvent:"input.replace"}),!0}),Ot=I((t,{query:e})=>{if(t.state.readOnly)return!1;let r=e.matchAll(t.state,1e9).map(s=>{let{from:a,to:i}=s;return{from:a,to:i,insert:e.getReplacement(s)}});if(!r.length)return!1;let n=t.state.phrase("replaced $ matches",r.length)+".";return t.dispatch({changes:r,effects:g.announce.of(n),userEvent:"input.replace.all"}),!0});function oe(t){return t.state.facet(q).createPanel(t)}function ne(t,e){var r,n,s,a,i;let o=t.selection.main,l=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!l)return e;let c=t.facet(q);return new Ee({search:((r=e==null?void 0:e.literal)!==null&&r!==void 0?r:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e==null?void 0:e.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:c.literal,regexp:(a=e==null?void 0:e.regexp)!==null&&a!==void 0?a:c.regexp,wholeWord:(i=e==null?void 0:e.wholeWord)!==null&&i!==void 0?i:c.wholeWord})}function qe(t){let e=ve(t,oe);return e&&e.dom.querySelector("[main-field]")}function Ae(t){let e=qe(t);e&&e==t.root.activeElement&&e.select()}const $e=t=>{let e=t.state.field(L,!1);if(e&&e.panel){let r=qe(t);if(r&&r!=t.root.activeElement){let n=ne(t.state,e.query.spec);n.valid&&t.dispatch({effects:B.of(n)}),r.focus(),r.select()}}else t.dispatch({effects:[ie.of(!0),e?B.of(ne(t.state,e.query.spec)):V.appendConfig.of(se)]});return!0},Fe=t=>{let e=t.state.field(L,!1);if(!e||!e.panel)return!1;let r=ve(t,oe);return r&&r.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:ie.of(!1)}),!0},Nt=[{key:"Mod-f",run:$e,scope:"editor search-panel"},{key:"F3",run:G,shift:U,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:G,shift:U,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Fe,scope:"editor search-panel"},{key:"Mod-Shift-l",run:zt},{key:"Mod-Alt-g",run:Lt},{key:"Mod-d",run:qt,preventDefault:!0}];class Kt{constructor(e){this.view=e;let r=this.query=e.state.field(L).query.spec;this.commit=this.commit.bind(this),this.searchField=y("input",{value:r.search,placeholder:b(e,"Find"),"aria-label":b(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=y("input",{value:r.replace,placeholder:b(e,"Replace"),"aria-label":b(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=y("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=y("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=y("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(s,a,i){return y("button",{class:"cm-button",name:s,onclick:a,type:"button"},i)}this.dom=y("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>G(e),[b(e,"next")]),n("prev",()=>U(e),[b(e,"previous")]),n("select",()=>jt(e),[b(e,"all")]),y("label",null,[this.caseField,b(e,"match case")]),y("label",null,[this.reField,b(e,"regexp")]),y("label",null,[this.wordField,b(e,"by word")]),...e.state.readOnly?[]:[y("br"),this.replaceField,n("replace",()=>pe(e),[b(e,"replace")]),n("replaceAll",()=>Ot(e),[b(e,"replace all")])],y("button",{name:"close",onclick:()=>Fe(e),"aria-label":b(e,"close"),type:"button"},["×"])])}commit(){let e=new Ee({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:B.of(e)}))}keydown(e){tt(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?U:G)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),pe(this.view))}update(e){for(let r of e.transactions)for(let n of r.effects)n.is(B)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(q).top}}function b(t,e){return t.state.phrase(e)}const z=30,O=/[\s\.,:;?!]/;function le(t,{from:e,to:r}){let n=t.state.doc.lineAt(e),s=t.state.doc.lineAt(r).to,a=Math.max(n.from,e-z),i=Math.min(s,r+z),o=t.state.sliceDoc(a,i);if(a!=n.from){for(let l=0;l<z;l++)if(!O.test(o[l+1])&&O.test(o[l])){o=o.slice(l);break}}if(i!=s){for(let l=o.length-1;l>o.length-z;l--)if(!O.test(o[l-1])&&O.test(o[l])){o=o.slice(0,l);break}}return g.announce.of(`${t.state.phrase("current match")}. ${o} ${t.state.phrase("on line")} ${n.number}.`)}const Qt=g.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),se=[L,Ge.low(Tt),Qt],me=[{name:"domain",detail:"business domain (namespace)"},{name:"owner",detail:"accountable owner — required to certify"},{name:"description",detail:"business-facing description"},{name:"status",detail:"draft | certified"},{name:"pattern",detail:"reusable block pattern"},{name:"grain",detail:'row grain, e.g. "one row per customer"'},{name:"outputs",detail:"declared output column names"},{name:"entities",detail:'business entities, e.g. ["order"]'},{name:"tags",detail:"discoverability tags"},{name:"llmContext",detail:"when an agent should use this block"},{name:"reviewCadence",detail:"how often to re-review"},{name:"sourceSystems",detail:"upstream source systems"},{name:"dimensions",detail:"queryable dimensions"},{name:"allowedFilters",detail:"filters an app may bind"},{name:"filterBindings",detail:"filter → column map (app-ready)",snippet:`filterBindings {
|
|
3
3
|
$0
|
|
4
4
|
}`},{name:"parameterPolicy",detail:"per-parameter reuse policy",snippet:`parameterPolicy {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,r as f,aC as O,aD as x,aE as S,q as C,p as L}from"./index-D3wnucQC.js";import{R as D,u as N,a as T,d as z,M as _,i as F,B as G,H as b,c as m}from"./style-NlN9F6JE.js";import{T as v}from"./dagre.esm-B6nvU4OB.js";function A(e,c,a={}){var s;if(e.length===0)return e;const n=new v.graphlib.Graph().setDefaultEdgeLabel(()=>({}));n.setGraph({rankdir:"LR",ranksep:60,nodesep:30,marginx:20,marginy:20});for(const o of e){const i={width:170,height:52};if(a.mode==="layered"&&((s=o.data)!=null&&s.layer)){const d=S.indexOf(o.data.layer);d>=0&&(i.rank=d)}n.setNode(o.id,i)}for(const o of c)n.setEdge(o.source,o.target);return v.layout(n),e.map(o=>{const i=n.node(o.id);return{...o,position:{x:i.x-85,y:i.y-26}}})}function M({data:e,selected:c}){const a=e.nodeType,n=e.isFocal,s=L[a]??"var(--color-text-tertiary)",o=C[a]??a.toUpperCase();return t.jsxs("div",{style:{minWidth:140,maxWidth:190,background:"var(--color-bg-card)",border:`2px solid ${n||c?"var(--color-accent-blue)":s}`,borderRadius:8,padding:"6px 8px",boxShadow:n?"0 0 0 2px color-mix(in srgb, var(--color-accent-blue) 25%, transparent)":"none"},children:[t.jsx(b,{type:"target",position:m.Left,style:{width:6,height:6,background:s,border:"none"}}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:2},children:[t.jsx("span",{style:{fontSize:8,fontWeight:700,letterSpacing:"0.04em",color:"var(--color-bg-card)",background:s,borderRadius:3,padding:"1px 4px"},children:o}),e.domain&&t.jsx("span",{style:{color:"var(--color-text-tertiary)",fontSize:9},children:e.domain})]}),t.jsx("div",{style:{color:"var(--color-text-primary)",fontSize:10,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.label,children:e.label}),t.jsx(b,{type:"source",position:m.Right,style:{width:6,height:6,background:s,border:"none"}})]})}const W={miniDagNode:M};function B({nodes:e,edges:c,focalNodeId:a,height:n=250,onNodeClick:s,interactive:o=!0,layoutMode:i="flow",fitViewPadding:d=.15}){const[E,h,R]=N([]),[w,y,j]=T([]),{fitView:p}=z(),u=f.useRef(null);return f.useEffect(()=>{const g=e.map(r=>({id:r.id,type:"miniDagNode",position:{x:0,y:0},data:{label:r.name,nodeType:r.type,domain:r.domain,layer:O(r),isFocal:r.id===a}})),l=c.map((r,k)=>({id:`mini-edge-${k}-${r.source}-${r.target}`,source:r.source,target:r.target,style:{stroke:x[r.type]??"#8b949e",strokeWidth:1.4},markerEnd:{type:_.ArrowClosed,color:x[r.type]??"#8b949e",width:10,height:10}}));h(A(g,l,{mode:i})),y(l),requestAnimationFrame(()=>{p({padding:d,duration:200})})},[e,c,a,i,d,h,y,p]),f.useEffect(()=>{if(!u.current)return;const g=u.current,l=new ResizeObserver(()=>{p({padding:d,duration:0})});return l.observe(g),()=>l.disconnect()},[p,d]),e.length===0?t.jsx("div",{style:{height:n,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--color-text-tertiary)",fontSize:11},children:"No lineage nodes to display"}):t.jsx("div",{ref:u,style:{height:n,width:"100%",borderRadius:8,overflow:"hidden",border:"1px solid var(--color-border-subtle)"},children:t.jsx(F,{nodes:E,edges:w,onNodesChange:o?R:void 0,onEdgesChange:o?j:void 0,onNodeClick:s?(g,l)=>s(l.id):void 0,nodeTypes:W,fitView:!0,fitViewOptions:{padding:d},minZoom:.25,proOptions:{hideAttribution:!0},nodesDraggable:o,nodesConnectable:!1,zoomOnScroll:o,panOnDrag:o,style:{background:"var(--color-bg-sunken)"},children:t.jsx(G,{color:"var(--color-border-subtle)",gap:20,size:1})})})}function q(e){return t.jsx(D,{children:t.jsx(B,{...e})})}export{q as M};
|
package/dist/assets/dql-notebook/assets/{NewBlockModal-DbCQg-pj.js → NewBlockModal-kMAzk91d.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as w,t as z,r as l,V as O,j as t,a as D}from"./index-
|
|
1
|
+
import{u as w,t as z,r as l,V as O,j as t,a as D}from"./index-D3wnucQC.js";import"./react-CRB3T2We.js";function F(s,i,a,e){var d;const n=a.trim().replace(/\\/g,"/").replace(/^\/+|\/+$/g,""),p=`${n?`${n}/`:""}${e}.dql`;if(!i)return`blocks/${p}`;const r=s.find(g=>g.id===i),c=(d=r==null?void 0:r.sourcePath)==null?void 0:d.replace(/\/domain\.dql$/,"");return c?`${c}/blocks/${p}`:`blocks/${i}/${p}`}function v(s){return s.toLowerCase().replace(/[^a-z0-9\-_\s]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").slice(0,64)}function _(s){return s.trim()?/^[a-zA-Z0-9\-_ ]+$/.test(s)?null:"Only letters, numbers, hyphens, underscores, and spaces allowed.":"Name is required."}function R({onFileOpened:s}){const{state:i,dispatch:a}=w(),e=z[i.themeMode],[n,p]=l.useState(""),[r,c]=l.useState(i.newBlockModalDefaultType),[d,g]=l.useState(""),[x,E]=l.useState(""),[y,u]=l.useState(null),[m,h]=l.useState(!1),k=l.useRef(null);l.useEffect(()=>{var o;(o=k.current)==null||o.focus()},[]);const S=i.authoredDomains,L=O(S);l.useEffect(()=>{c(i.newBlockModalDefaultType)},[i.newBlockModalDefaultType]),l.useEffect(()=>{const o=b=>{b.key==="Escape"&&a({type:"CLOSE_NEW_BLOCK_MODAL"})};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[a]);const B=async()=>{var j;const o=_(n);if(o){u(o);return}h(!0),u(null);const b=v(n);try{const f=await D.createBlock(n.trim(),{blockType:r,...d?{domain:d}:{},...x.trim()?{folderPath:x.trim()}:{}}),C={name:`${b}.dql`,path:f.path,type:"block",folder:f.path.split("/").slice(0,-1).join("/"),isNew:!0};a({type:"FILE_ADDED",file:C}),a({type:"CLOSE_NEW_BLOCK_MODAL"}),s(C)}catch(f){(j=f.message)!=null&&j.includes("already exists")?u("A block with this name already exists."):u(f.message??"Failed to create block.")}finally{h(!1)}},$=o=>{o.target===o.currentTarget&&a({type:"CLOSE_NEW_BLOCK_MODAL"})};return t.jsx("div",{onClick:$,style:{position:"fixed",inset:0,background:e.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,backdropFilter:"blur(4px)"},children:t.jsxs("div",{style:{background:e.modalBg,border:`1px solid ${e.cellBorder}`,borderRadius:12,width:420,maxWidth:"calc(100vw - 48px)",boxShadow:"0 20px 60px rgba(0,0,0,0.5)",overflow:"hidden"},children:[t.jsxs("div",{style:{padding:"20px 24px 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[t.jsx("h2",{style:{fontSize:16,fontWeight:600,color:e.textPrimary,fontFamily:e.font,margin:0},children:"New Block"}),t.jsx("button",{onClick:()=>a({type:"CLOSE_NEW_BLOCK_MODAL"}),style:{background:"transparent",border:"none",cursor:"pointer",color:e.textMuted,fontSize:18,lineHeight:1,padding:"2px 4px",borderRadius:4},children:"×"})]}),t.jsxs("div",{style:{padding:"20px 24px 24px",display:"flex",flexDirection:"column",gap:16},children:[t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[t.jsxs("button",{type:"button",onClick:()=>c("custom"),style:{background:r==="custom"?`${e.accent}18`:e.btnBg,border:`1px solid ${r==="custom"?e.accent:e.btnBorder}`,borderRadius:8,color:r==="custom"?e.accent:e.textSecondary,cursor:"pointer",fontSize:12,fontWeight:700,fontFamily:e.font,padding:"10px 12px",textAlign:"left"},children:["SQL Block",t.jsx("span",{style:{display:"block",marginTop:3,color:e.textMuted,fontWeight:400,fontSize:11},children:"Build from dbt models, tables, and SELECT queries."})]}),t.jsxs("button",{type:"button",onClick:()=>c("semantic"),style:{background:r==="semantic"?`${e.accent}18`:e.btnBg,border:`1px solid ${r==="semantic"?e.accent:e.btnBorder}`,borderRadius:8,color:r==="semantic"?e.accent:e.textSecondary,cursor:"pointer",fontSize:12,fontWeight:700,fontFamily:e.font,padding:"10px 12px",textAlign:"left"},children:["Semantic Block",t.jsx("span",{style:{display:"block",marginTop:3,color:e.textMuted,fontWeight:400,fontSize:11},children:"Build from dbt/DQL metrics and dimensions."})]})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[t.jsx("label",{style:{fontSize:12,fontWeight:500,color:e.textSecondary,fontFamily:e.font},children:"Block Name"}),t.jsx("input",{ref:k,value:n,onChange:o=>{p(o.target.value),u(null)},onKeyDown:o=>{o.key==="Enter"&&B()},placeholder:"revenue-summary",style:{background:e.inputBg,border:`1px solid ${y?e.error:e.inputBorder}`,borderRadius:6,color:e.textPrimary,fontSize:13,fontFamily:e.font,padding:"8px 12px",outline:"none",transition:"border-color 0.15s"}}),y&&t.jsx("span",{style:{fontSize:11,color:e.error,fontFamily:e.font},children:y}),n&&!y&&t.jsxs("span",{style:{fontSize:11,color:e.textMuted,fontFamily:e.fontMono},children:["Git path: ",F(S,d,x,v(n))]})]}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[t.jsxs("label",{style:{display:"grid",gap:6,fontSize:12,fontWeight:500,color:e.textSecondary,fontFamily:e.font},children:["Domain",t.jsxs("select",{"aria-label":"Block domain",value:d,onChange:o=>g(o.target.value),style:{background:e.inputBg,border:`1px solid ${e.inputBorder}`,borderRadius:6,color:e.textPrimary,fontSize:13,fontFamily:e.font,padding:"8px 10px",outline:"none"},children:[t.jsx("option",{value:"",children:"Global / cross-domain"}),L.map(o=>t.jsx("option",{value:o.value,children:o.label},o.value))]})]}),t.jsxs("label",{style:{display:"grid",gap:6,fontSize:12,fontWeight:500,color:e.textSecondary,fontFamily:e.font},children:["Folder",t.jsx("input",{"aria-label":"Block folder",value:x,onChange:o=>E(o.target.value),placeholder:"reporting/monthly",style:{background:e.inputBg,border:`1px solid ${e.inputBorder}`,borderRadius:6,color:e.textPrimary,fontSize:13,fontFamily:e.fontMono,padding:"8px 10px",outline:"none"}})]})]}),t.jsx("div",{style:{fontSize:12,color:e.textMuted,fontFamily:e.font,lineHeight:1.5,padding:"8px 12px",background:e.pillBg,borderRadius:6},children:r==="semantic"?"Semantic blocks use governed metrics, dimensions, and chart intent. They do not start with raw SQL.":"SQL blocks are reusable SELECT queries stored in the blocks/ folder. Use them for dbt models, tables, and imported SQL."})]}),t.jsxs("div",{style:{padding:"14px 24px",borderTop:`1px solid ${e.cellBorder}`,display:"flex",justifyContent:"flex-end",gap:10},children:[t.jsx("button",{onClick:()=>a({type:"CLOSE_NEW_BLOCK_MODAL"}),style:{background:e.btnBg,border:`1px solid ${e.btnBorder}`,borderRadius:6,color:e.textSecondary,cursor:"pointer",fontSize:13,fontFamily:e.font,fontWeight:500,padding:"7px 16px"},children:"Cancel"}),t.jsx("button",{onClick:B,disabled:m||!n.trim(),style:{background:e.accent,border:`1px solid ${e.accent}`,borderRadius:6,color:"#ffffff",cursor:m||!n.trim()?"not-allowed":"pointer",fontSize:13,fontFamily:e.font,fontWeight:500,padding:"7px 20px",opacity:m||!n.trim()?.6:1,display:"flex",alignItems:"center",gap:6},children:m?"Creating...":"Create Block"})]})]})})}export{R as NewBlockModal};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as v,m as i,u as M,t as D,r as d,V as N,j as t,l as B,a as T}from"./index-
|
|
1
|
+
import{c as v,m as i,u as M,t as D,r as d,V as N,j as t,l as B,a as T}from"./index-D3wnucQC.js";import{B as k}from"./book-open-text-DDBO8G7L.js";import{X as q}from"./x-fp82BETM.js";import"./react-CRB3T2We.js";/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|