@duckcodeailabs/dql-cli 1.12.9 → 1.12.11

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.
Files changed (72) hide show
  1. package/dist/assets/dql-notebook/assets/{AgentAnswerCard-DbI0CAsX.js → AgentAnswerCard-CpL2kDCV.js} +1 -1
  2. package/dist/assets/dql-notebook/assets/{AgentLogPage-BbMhuJps.js → AgentLogPage-hzHqpD3-.js} +1 -1
  3. package/dist/assets/dql-notebook/assets/{AiBuildDialog-DNgkam6H.js → AiBuildDialog-BQRWoxp9.js} +1 -1
  4. package/dist/assets/dql-notebook/assets/AiBuildResult-D9t_4sQl.js +33 -0
  5. package/dist/assets/dql-notebook/assets/{AiSidePanel-D-EhCOEd.js → AiSidePanel-BCQB9rVF.js} +1 -1
  6. package/dist/assets/dql-notebook/assets/{AnalyticsHome-BTjkolBn.js → AnalyticsHome-Ba4Ve_Gd.js} +1 -1
  7. package/dist/assets/dql-notebook/assets/AppsView-CdAT9BOq.js +4466 -0
  8. package/dist/assets/dql-notebook/assets/{BlockStudio-DTFHMR3y.js → BlockStudio-Brg4fwn5.js} +13 -13
  9. package/dist/assets/dql-notebook/assets/{BusinessArtifactView-DGiHB7OS.js → BusinessArtifactView-CnTbFVGT.js} +1 -1
  10. package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-CQe2FUZq.js +22 -0
  11. package/dist/assets/dql-notebook/assets/{GitPage-BWzPKyws.js → GitPage-DHyDBChc.js} +1 -1
  12. package/dist/assets/dql-notebook/assets/{GlobalAiRail-CGvBUci2.js → GlobalAiRail-Cys4n_rq.js} +1 -1
  13. package/dist/assets/dql-notebook/assets/GovernedContextPage-DyKoDSZ2.js +7 -0
  14. package/dist/assets/dql-notebook/assets/{HelpDocsPage-C7IX_7xh.js → HelpDocsPage-CL0vbSER.js} +3 -3
  15. package/dist/assets/dql-notebook/assets/{HomePage-e0CObjOb.js → HomePage-DzAucwBW.js} +9 -4
  16. package/dist/assets/dql-notebook/assets/{LineageDAG-DV6T_0ha.js → LineageDAG-QHqd_AM5.js} +1 -1
  17. package/dist/assets/dql-notebook/assets/{LineageDetailView-ZVJiCqua.js → LineageDetailView-DdVH-nz6.js} +1 -1
  18. package/dist/assets/dql-notebook/assets/{LineageDrawer-DQdzGIoL.js → LineageDrawer-BvrVZNKY.js} +1 -1
  19. package/dist/assets/dql-notebook/assets/LineagePathBreadcrumb-CSut-zvm.js +14 -0
  20. package/dist/assets/dql-notebook/assets/{MiniLineageGraph-BlJYiAY0.js → MiniLineageGraph-zg_1wW3M.js} +1 -1
  21. package/dist/assets/dql-notebook/assets/NewBlockModal-9cDletl-.js +1 -0
  22. package/dist/assets/dql-notebook/assets/NewNotebookModal-V6de8L4d.js +46 -0
  23. package/dist/assets/dql-notebook/assets/NotebookEditor-EZ0pfWVs.js +200 -0
  24. package/dist/assets/dql-notebook/assets/{ReadinessPage-m8jlEKzQ.js → ReadinessPage-BaGvjyfd.js} +1 -1
  25. package/dist/assets/dql-notebook/assets/{SetupOnboarding-ClldPV4C.js → SetupOnboarding-Bg-MjbC9.js} +2 -2
  26. package/dist/assets/dql-notebook/assets/{TrustBadge-C0FyL1ZO.js → TrustBadge-DGuHB8kP.js} +1 -1
  27. package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-BlWAVEwO.js +83 -0
  28. package/dist/assets/dql-notebook/assets/{answer-to-notebook-CgVDBH0o.js → answer-to-notebook-BDzY4MuQ.js} +1 -1
  29. package/dist/assets/dql-notebook/assets/{arrow-left-XTRkwgdW.js → arrow-left-IjlnAihE.js} +1 -1
  30. package/dist/assets/dql-notebook/assets/{arrow-right-BUYb7B8y.js → arrow-right-BI4cXgOY.js} +2 -2
  31. package/dist/assets/dql-notebook/assets/{book-open-text-CQHKAXcN.js → book-open-text-i6xhxu_I.js} +1 -1
  32. package/dist/assets/dql-notebook/assets/{bot-D9ODKCwi.js → bot-C6DE7Q6m.js} +1 -1
  33. package/dist/assets/dql-notebook/assets/{chevron-up-BR57nCns.js → chevron-up-DSEILnDs.js} +2 -2
  34. package/dist/assets/dql-notebook/assets/{circle-x-B3MKf4hs.js → circle-x-BoAorVSm.js} +1 -1
  35. package/dist/assets/dql-notebook/assets/{codemirror-1_I9gm6Z.js → codemirror-DXt7RW72.js} +1 -1
  36. package/dist/assets/dql-notebook/assets/{dagre.esm-BWViOEog.js → dagre.esm-CycymVj6.js} +1 -1
  37. package/dist/assets/dql-notebook/assets/{external-link-D2rxGhQ_.js → external-link-ZwE5iHsX.js} +1 -1
  38. package/dist/assets/dql-notebook/assets/{grip-vertical-Bzs7bIWP.js → grip-vertical-Dnp2st8l.js} +1 -1
  39. package/dist/assets/dql-notebook/assets/index-BTuliKhK.js +634 -0
  40. package/dist/assets/dql-notebook/assets/{link-2-D6nW0_qQ.js → link-2-CTKe6Snr.js} +2 -2
  41. package/dist/assets/dql-notebook/assets/{list-tree-MH5kYamM.js → list-tree-Ced8e_S1.js} +1 -1
  42. package/dist/assets/dql-notebook/assets/{maximize-2-C3bEmsdA.js → maximize-2-Cojc6867.js} +1 -1
  43. package/dist/assets/dql-notebook/assets/{minimize-2-cji4jKmJ.js → minimize-2-CBIAE0XH.js} +1 -1
  44. package/dist/assets/dql-notebook/assets/{panel-right-open-T-_o8FS9.js → panel-right-open-po3bWSeL.js} +2 -2
  45. package/dist/assets/dql-notebook/assets/{pencil-BzJ_vZuL.js → pencil-Cb45c6WU.js} +2 -2
  46. package/dist/assets/dql-notebook/assets/{rotate-ccw-CqSfrg2J.js → rotate-ccw-B9v1LTJ0.js} +2 -2
  47. package/dist/assets/dql-notebook/assets/{semantic-fields-BXNCrm72.js → semantic-fields-B6ii0an0.js} +1 -1
  48. package/dist/assets/dql-notebook/assets/{star-C22MG8pV.js → star-CO4tfaDq.js} +2 -2
  49. package/dist/assets/dql-notebook/assets/{triangle-alert-BtoT0VL-.js → triangle-alert-BSdIu2El.js} +1 -1
  50. package/dist/assets/dql-notebook/assets/{usePersistedAgentThreadId-BL9P0gFB.js → usePersistedAgentThreadId-CkVFrrjk.js} +2 -2
  51. package/dist/assets/dql-notebook/assets/{user-round-CpifcAyh.js → user-round-BfrV8U-W.js} +3 -3
  52. package/dist/assets/dql-notebook/assets/{wand-sparkles-BiOywrQh.js → wand-sparkles-BgTxZNBc.js} +1 -1
  53. package/dist/assets/dql-notebook/assets/{workflow-DDvVMZ2B.js → workflow--2ycp0yy.js} +2 -2
  54. package/dist/assets/dql-notebook/assets/{wrench-CoKg2kyO.js → wrench-LMCrpa9_.js} +1 -1
  55. package/dist/assets/dql-notebook/assets/{x-CCmr0LQ8.js → x-CeNgQwGm.js} +2 -2
  56. package/dist/assets/dql-notebook/index.html +1 -1
  57. package/dist/local-runtime.d.ts +90 -2
  58. package/dist/local-runtime.d.ts.map +1 -1
  59. package/dist/local-runtime.js +1005 -152
  60. package/dist/local-runtime.js.map +1 -1
  61. package/dist/package.json +10 -10
  62. package/package.json +10 -10
  63. package/dist/assets/dql-notebook/assets/AiBuildResult-BuTao779.js +0 -33
  64. package/dist/assets/dql-notebook/assets/AppsView-B3jlWoNm.js +0 -4466
  65. package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-D-fv_dS2.js +0 -22
  66. package/dist/assets/dql-notebook/assets/GovernedContextPage-CxkrtqyP.js +0 -7
  67. package/dist/assets/dql-notebook/assets/LineagePathBreadcrumb-6gFsnWlN.js +0 -14
  68. package/dist/assets/dql-notebook/assets/NewBlockModal-DaxBAFLu.js +0 -1
  69. package/dist/assets/dql-notebook/assets/NewNotebookModal-B7GPLsYc.js +0 -46
  70. package/dist/assets/dql-notebook/assets/NotebookEditor-RuxFQnQC.js +0 -202
  71. package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-Bd1qmRFx.js +0 -83
  72. package/dist/assets/dql-notebook/assets/index-CDpukm0G.js +0 -644
@@ -1,11 +1,16 @@
1
- import{r as c,a as q,j as e,u as Be,t as Ye,S as Ie,B as ue,C as ot,c as Je,b as rt,d as st,L as at,e as lt,G as Ne,D as be,N as dt,F as ct,f as pt}from"./index-CDpukm0G.js";import{T as xt}from"./TrustBadge-C0FyL1ZO.js";import{A as he}from"./arrow-right-BUYb7B8y.js";import{T as Ke}from"./triangle-alert-BtoT0VL-.js";import{B as Ee}from"./book-open-text-CQHKAXcN.js";import{W as ut}from"./workflow-DDvVMZ2B.js";import"./react-CRB3T2We.js";function ht(t){var d,n,a,u,p,S;if(!t)return"connect";const o=(d=t.dbt)==null?void 0:d.artifactState,i=(n=t.modeling)==null?void 0:n.snapshotState;return(((a=t.domains)==null?void 0:a.count)??0)>0?"domain-model":i==="ready"||i==="stale"?"domains":i==="building"||o==="building"?"building":(u=t.modeling)!=null&&u.enabled&&((p=t.dbt)!=null&&p.manifestFound)?"domains":(S=t.dbt)!=null&&S.manifestFound||o==="ready"||o==="stale"?"inspect":"connect"}function ft(t){return t.job?t.job:{id:t.id??"onboarding-job",kind:t.kind,status:t.status??"running",stage:t.stage,progress:t.progress,message:t.message,diagnostics:t.diagnostics,result:t.result,error:t.error}}function mt(t){const o=t;return{code:typeof(o==null?void 0:o.code)=="string"?o.code:void 0,message:t instanceof Error?t.message:String(t??"Onboarding failed."),nextActions:Array.isArray(o==null?void 0:o.nextActions)?o.nextActions:[]}}function gt(t,o,i="target/manifest.json"){const r=mt(t),d=o.trim()||".";switch(r.code){case"DBT_PROJECT_NOT_FOUND":return{code:r.code,title:"dbt project not found",message:"Choose the folder that contains dbt_project.yml. DQL will read that project; it will not copy its schema.",nextActions:r.nextActions.length>0?r.nextActions:["Check the project path and retry."],optional:!1};case"DBT_MANIFEST_MISSING":return{code:r.code,title:"dbt manifest.json is missing",message:`DQL needs ${i||"target/manifest.json"} to inspect dbt-owned models. Build the artifact, then retry without importing or copying dbt semantics.`,command:`cd ${JSON.stringify(d)} && dbt parse`,nextActions:r.nextActions.length>0?r.nextActions:["Run the command locally, or ask DQL to build artifacts when dbt is available.","Retry inspection."],optional:!1};case"DBT_ARTIFACT_INVALID":return{code:r.code,title:"dbt artifact is invalid",message:"The manifest could not be read safely. Rebuild it with the project’s installed dbt version, then inspect again.",command:`cd ${JSON.stringify(d)} && dbt parse`,nextActions:r.nextActions.length>0?r.nextActions:["Rebuild manifest.json and retry."],optional:!1};case"DBT_PARSE_FAILED":return{code:r.code,title:"dbt parse failed",message:r.message,command:`cd ${JSON.stringify(d)} && dbt parse`,nextActions:r.nextActions.length>0?r.nextActions:["Review the redacted dbt output, repair the project, and retry."],optional:!1};case"SOURCE_CHANGED":return{code:r.code,title:"dbt source changed during review",message:"The reviewed artifact fingerprint is no longer current. Inspect the latest source before applying.",nextActions:r.nextActions.length>0?r.nextActions:["Refresh the preview and review the new diff."],optional:!1};case"AI_PROVIDER_UNAVAILABLE":return{code:r.code,title:"AI assistance is unavailable",message:"AI summaries are optional. Continue with deterministic, evidence-based domain discovery and review every draft manually.",nextActions:r.nextActions.length>0?r.nextActions:["Continue without AI."],optional:!0};case"WAREHOUSE_UNAVAILABLE":return{code:r.code,title:"Warehouse validation is unavailable",message:"You can finish metadata setup now. Relationship validation and certification will remain incomplete until a warehouse is connected.",nextActions:r.nextActions.length>0?r.nextActions:["Continue metadata setup.","Connect a warehouse before certification."],optional:!0};default:return{code:r.code,title:"Onboarding needs attention",message:r.message,nextActions:r.nextActions.length>0?r.nextActions:["Retry, or close and resume later."],optional:!1}}}const Xe=[{id:"connect",label:"Connect"},{id:"inspect",label:"Artifacts"},{id:"domains",label:"Domains"},{id:"domain-model",label:"Model"},{id:"knowledge",label:"Knowledge"},{id:"ready",label:"Start"}];function yt(t){return t==="building"?1:Math.max(0,Xe.findIndex(o=>o.id===t))}function bt(t){return typeof t=="number"?`${Math.round(t*(t<=1?100:1))}%`:t}function je(t){return t||"Optional · not available"}function jt(t){var i;return(t.confidence==="high"||typeof t.confidence=="number"&&t.confidence>=.8)&&!t.requiresHumanDecision&&(((i=t.conflicts)==null?void 0:i.length)??0)===0}function vt(t){const o=[],i=t==null?void 0:t.ai,r=t==null?void 0:t.warehouse;return(i===!1||typeof i=="object"&&!i.available)&&o.push(typeof i=="object"&&i.message?i.message:"AI assistance is unavailable; deterministic discovery remains available."),(r===!1||typeof r=="object"&&!r.available)&&o.push(typeof r=="object"&&r.message?r.message:"Warehouse validation can be connected later; certification remains incomplete until then."),o}function kt({t,initialProjectDir:o="",onBack:i,onClose:r,onComplete:d,onOpen:n}){var Re,Te,$e,Me,Pe,We;const[a,u]=c.useState("connect"),[p,S]=c.useState(null),[f,D]=c.useState(o||"."),[b,E]=c.useState("target/manifest.json"),[W,$]=c.useState(""),[B,T]=c.useState("local"),[U,V]=c.useState(""),[L,_]=c.useState(""),[O,G]=c.useState(""),[j,K]=c.useState(null),[v,X]=c.useState(null),[m,Z]=c.useState(null),[C,N]=c.useState(null),[M,ee]=c.useState(new Set),[x,A]=c.useState(!0),[I,F]=c.useState(!1),[te,ge]=c.useState(!0),[re,Q]=c.useState(null),[de,ne]=c.useState(!1),[k,l]=c.useState(!0);c.useEffect(()=>{a!=="connect"&&l(!1)},[a]);const h=c.useRef(!0),R={background:t.inputBg,border:`1px solid ${t.inputBorder}`,borderRadius:7,color:t.textPrimary,fontSize:13,fontFamily:t.font,padding:"9px 11px",outline:"none",width:"100%",boxSizing:"border-box"},et=(m==null?void 0:m.capabilities)??(j==null?void 0:j.capabilities)??(p==null?void 0:p.capabilities),tt=vt(et),P=re?gt(re,f,b):null,qe=yt(a);c.useEffect(()=>(h.current=!0,q.getOnboardingStatus().then(s=>{var g,y,w,z;h.current&&(S(s),(g=s.dbt)!=null&&g.projectDir&&D(s.dbt.projectDir),(y=s.dbt)!=null&&y.manifestPath&&E(s.dbt.manifestPath),(w=s.dbt)!=null&&w.profilesDir&&$(s.dbt.profilesDir),(z=s.dbt)!=null&&z.repoUrl&&(T("repo"),V(s.dbt.repoUrl),_(s.dbt.branch??""),G(s.dbt.subPath??"")),u(ht(s)))}).catch(()=>{}).finally(()=>{h.current&&ge(!1)}),()=>{h.current=!1}),[]);const nt=c.useCallback(async()=>{F(!0),Q(null);try{const s=await q.previewDbtOnboarding(B==="repo"?{repoUrl:U,branch:L||void 0,subPath:O||void 0,manifestPath:b,profilesDir:W||void 0}:{projectDir:f||".",manifestPath:b,profilesDir:W||void 0});if(!h.current)return;K(s),D(s.projectDir||f||"."),E(s.manifestPath||b),$(s.profilesDir||W),s.repoUrl&&(T("repo"),V(s.repoUrl),_(s.branch??""),G(s.subPath??"")),u("inspect")}catch(s){h.current&&Q(s)}finally{h.current&&F(!1)}},[L,b,W,f,U,B,O]),ie=c.useCallback(async(s=x)=>{F(!0),Q(null);try{let g;try{g=await q.discoverOnboardingDomains({snapshotId:p==null?void 0:p.snapshotId,useAi:s})}catch(z){const se=z==null?void 0:z.code;if(s&&se==="AI_PROVIDER_UNAVAILABLE")A(!1),g=await q.discoverOnboardingDomains({snapshotId:p==null?void 0:p.snapshotId,useAi:!1});else throw z}if(!h.current)return;const y=(g.proposals??[]).map(z=>({...z,lifecycle:"draft"})),w={...g,proposals:y};Z(w),ee(new Set(y.filter(jt).map(z=>z.id))),u("domains")}catch(g){h.current&&Q(g)}finally{h.current&&F(!1)}},[p==null?void 0:p.snapshotId,x]),ze=c.useCallback(async s=>{for(;;){const g=await q.getOnboardingJob(s),y=ft(g);if(!h.current)return;if(X(y),y.status==="completed"){await ie(x);return}if(y.status==="failed"||y.status==="cancelled")throw new Error(y.error||y.message||`Onboarding ${y.status}.`);await new Promise(w=>window.setTimeout(w,700))}},[ie,x]),De=c.useCallback(async s=>{F(!0),Q(null),u("building");try{const g=await q.applyDbtOnboarding({...B==="repo"?{repoUrl:U,branch:L||void 0,subPath:O||void 0}:{projectDir:f||"."},manifestPath:b,profilesDir:W||void 0,expectedFingerprint:j==null?void 0:j.fingerprint,buildArtifacts:s}),y=g.jobId??g.id,w=y?null:await q.refreshDbtOnboarding({expectedFingerprint:g.fingerprint??(j==null?void 0:j.fingerprint),buildArtifacts:s}),z=y??(w==null?void 0:w.jobId)??(w==null?void 0:w.id);z?(X({id:z,status:g.status??(w==null?void 0:w.status)??"queued"}),await ze(z)):await ie(x)}catch(g){h.current&&(Q(g),u(j?"inspect":"connect"))}finally{h.current&&F(!1)}},[L,ie,b,ze,j,W,f,U,B,O,x]);c.useEffect(()=>{a==="domains"&&!m&&!I&&!te&&!re&&ie(x)},[ie,m,re,I,a,te,x]);const Le=c.useCallback(async s=>{if(!m)return;const g=m.proposals.filter(y=>M.has(y.id)).map(y=>({...y,lifecycle:"draft"}));if(g.length===0){ne(!0),u("domain-model");return}F(!0),Q(null);try{const y=await q.applyOnboardingDomains({proposals:g,expectedSourceFingerprint:m.sourceFingerprint,mode:s});if(!h.current)return;N(y),(s==="apply"||y.applied)&&u("domain-model")}catch(y){h.current&&Q(y)}finally{h.current&&F(!1)}},[m,M]),it=c.useCallback(async()=>{if(v)try{await q.cancelOnboardingJob(v.id)}finally{X(s=>s&&{...s,status:"cancelled"}),u("inspect"),F(!1)}},[v]),ye=M.size,fe=c.useMemo(()=>{var s;return((s=C==null?void 0:C.domains)==null?void 0:s.map(g=>g.id))??(m==null?void 0:m.proposals.filter(g=>M.has(g.id)).map(g=>g.name))??[]},[m,C,M]),ce=s=>{d(),n(s)};return e.jsxs("div",{style:{background:t.appBg,width:"100vw",height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},role:"dialog","aria-modal":"true","aria-labelledby":"dbt-onboarding-title",children:[e.jsx("style",{children:`
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-BTuliKhK.js";import{T as xt}from"./TrustBadge-DGuHB8kP.js";import{A as he}from"./arrow-right-BI4cXgOY.js";import{T as Ke}from"./triangle-alert-BSdIu2El.js";import{B as Ee}from"./book-open-text-i6xhxu_I.js";import{W as ut}from"./workflow--2ycp0yy.js";import"./react-CRB3T2We.js";/**
2
+ * @license lucide-react v0.563.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ht=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],ft=ot("file-braces",ht);function mt(t){var d,n,a,u,p,S;if(!t)return"connect";const o=(d=t.dbt)==null?void 0:d.artifactState,i=(n=t.modeling)==null?void 0:n.snapshotState;return(((a=t.domains)==null?void 0:a.count)??0)>0?"domain-model":i==="ready"||i==="stale"?"domains":i==="building"||o==="building"?"building":(u=t.modeling)!=null&&u.enabled&&((p=t.dbt)!=null&&p.manifestFound)?"domains":(S=t.dbt)!=null&&S.manifestFound||o==="ready"||o==="stale"?"inspect":"connect"}function gt(t){return t.job?t.job:{id:t.id??"onboarding-job",kind:t.kind,status:t.status??"running",stage:t.stage,progress:t.progress,message:t.message,diagnostics:t.diagnostics,result:t.result,error:t.error}}function yt(t){const o=t;return{code:typeof(o==null?void 0:o.code)=="string"?o.code:void 0,message:t instanceof Error?t.message:String(t??"Onboarding failed."),nextActions:Array.isArray(o==null?void 0:o.nextActions)?o.nextActions:[]}}function bt(t,o,i="target/manifest.json"){const r=yt(t),d=o.trim()||".";switch(r.code){case"DBT_PROJECT_NOT_FOUND":return{code:r.code,title:"dbt project not found",message:"Choose the folder that contains dbt_project.yml. DQL will read that project; it will not copy its schema.",nextActions:r.nextActions.length>0?r.nextActions:["Check the project path and retry."],optional:!1};case"DBT_MANIFEST_MISSING":return{code:r.code,title:"dbt manifest.json is missing",message:`DQL needs ${i||"target/manifest.json"} to inspect dbt-owned models. Build the artifact, then retry without importing or copying dbt semantics.`,command:`cd ${JSON.stringify(d)} && dbt parse`,nextActions:r.nextActions.length>0?r.nextActions:["Run the command locally, or ask DQL to build artifacts when dbt is available.","Retry inspection."],optional:!1};case"DBT_ARTIFACT_INVALID":return{code:r.code,title:"dbt artifact is invalid",message:"The manifest could not be read safely. Rebuild it with the project’s installed dbt version, then inspect again.",command:`cd ${JSON.stringify(d)} && dbt parse`,nextActions:r.nextActions.length>0?r.nextActions:["Rebuild manifest.json and retry."],optional:!1};case"DBT_PARSE_FAILED":return{code:r.code,title:"dbt parse failed",message:r.message,command:`cd ${JSON.stringify(d)} && dbt parse`,nextActions:r.nextActions.length>0?r.nextActions:["Review the redacted dbt output, repair the project, and retry."],optional:!1};case"SOURCE_CHANGED":return{code:r.code,title:"dbt source changed during review",message:"The reviewed artifact fingerprint is no longer current. Inspect the latest source before applying.",nextActions:r.nextActions.length>0?r.nextActions:["Refresh the preview and review the new diff."],optional:!1};case"AI_PROVIDER_UNAVAILABLE":return{code:r.code,title:"AI assistance is unavailable",message:"AI summaries are optional. Continue with deterministic, evidence-based domain discovery and review every draft manually.",nextActions:r.nextActions.length>0?r.nextActions:["Continue without AI."],optional:!0};case"WAREHOUSE_UNAVAILABLE":return{code:r.code,title:"Warehouse validation is unavailable",message:"You can finish metadata setup now. Relationship validation and certification will remain incomplete until a warehouse is connected.",nextActions:r.nextActions.length>0?r.nextActions:["Continue metadata setup.","Connect a warehouse before certification."],optional:!0};default:return{code:r.code,title:"Onboarding needs attention",message:r.message,nextActions:r.nextActions.length>0?r.nextActions:["Retry, or close and resume later."],optional:!1}}}const Xe=[{id:"connect",label:"Connect"},{id:"inspect",label:"Artifacts"},{id:"domains",label:"Domains"},{id:"domain-model",label:"Model"},{id:"knowledge",label:"Knowledge"},{id:"ready",label:"Start"}];function jt(t){return t==="building"?1:Math.max(0,Xe.findIndex(o=>o.id===t))}function vt(t){return typeof t=="number"?`${Math.round(t*(t<=1?100:1))}%`:t}function je(t){return t||"Optional · not available"}function kt(t){var i;return(t.confidence==="high"||typeof t.confidence=="number"&&t.confidence>=.8)&&!t.requiresHumanDecision&&(((i=t.conflicts)==null?void 0:i.length)??0)===0}function wt(t){const o=[],i=t==null?void 0:t.ai,r=t==null?void 0:t.warehouse;return(i===!1||typeof i=="object"&&!i.available)&&o.push(typeof i=="object"&&i.message?i.message:"AI assistance is unavailable; deterministic discovery remains available."),(r===!1||typeof r=="object"&&!r.available)&&o.push(typeof r=="object"&&r.message?r.message:"Warehouse validation can be connected later; certification remains incomplete until then."),o}function St({t,initialProjectDir:o="",onBack:i,onClose:r,onComplete:d,onOpen:n}){var Re,Te,Me,$e,Pe,We;const[a,u]=c.useState("connect"),[p,S]=c.useState(null),[f,D]=c.useState(o||"."),[b,E]=c.useState("target/manifest.json"),[W,M]=c.useState(""),[B,T]=c.useState("local"),[U,V]=c.useState(""),[L,_]=c.useState(""),[O,G]=c.useState(""),[j,K]=c.useState(null),[v,X]=c.useState(null),[m,Z]=c.useState(null),[C,N]=c.useState(null),[$,ee]=c.useState(new Set),[x,A]=c.useState(!0),[I,F]=c.useState(!1),[te,ge]=c.useState(!0),[re,Q]=c.useState(null),[de,ne]=c.useState(!1),[k,l]=c.useState(!0);c.useEffect(()=>{a!=="connect"&&l(!1)},[a]);const h=c.useRef(!0),R={background:t.inputBg,border:`1px solid ${t.inputBorder}`,borderRadius:7,color:t.textPrimary,fontSize:13,fontFamily:t.font,padding:"9px 11px",outline:"none",width:"100%",boxSizing:"border-box"},et=(m==null?void 0:m.capabilities)??(j==null?void 0:j.capabilities)??(p==null?void 0:p.capabilities),tt=wt(et),P=re?bt(re,f,b):null,qe=jt(a);c.useEffect(()=>(h.current=!0,q.getOnboardingStatus().then(s=>{var g,y,w,z;h.current&&(S(s),(g=s.dbt)!=null&&g.projectDir&&D(s.dbt.projectDir),(y=s.dbt)!=null&&y.manifestPath&&E(s.dbt.manifestPath),(w=s.dbt)!=null&&w.profilesDir&&M(s.dbt.profilesDir),(z=s.dbt)!=null&&z.repoUrl&&(T("repo"),V(s.dbt.repoUrl),_(s.dbt.branch??""),G(s.dbt.subPath??"")),u(mt(s)))}).catch(()=>{}).finally(()=>{h.current&&ge(!1)}),()=>{h.current=!1}),[]);const nt=c.useCallback(async()=>{F(!0),Q(null);try{const s=await q.previewDbtOnboarding(B==="repo"?{repoUrl:U,branch:L||void 0,subPath:O||void 0,manifestPath:b,profilesDir:W||void 0}:{projectDir:f||".",manifestPath:b,profilesDir:W||void 0});if(!h.current)return;K(s),D(s.projectDir||f||"."),E(s.manifestPath||b),M(s.profilesDir||W),s.repoUrl&&(T("repo"),V(s.repoUrl),_(s.branch??""),G(s.subPath??"")),u("inspect")}catch(s){h.current&&Q(s)}finally{h.current&&F(!1)}},[L,b,W,f,U,B,O]),ie=c.useCallback(async(s=x)=>{F(!0),Q(null);try{let g;try{g=await q.discoverOnboardingDomains({snapshotId:p==null?void 0:p.snapshotId,useAi:s})}catch(z){const se=z==null?void 0:z.code;if(s&&se==="AI_PROVIDER_UNAVAILABLE")A(!1),g=await q.discoverOnboardingDomains({snapshotId:p==null?void 0:p.snapshotId,useAi:!1});else throw z}if(!h.current)return;const y=(g.proposals??[]).map(z=>({...z,lifecycle:"draft"})),w={...g,proposals:y};Z(w),ee(new Set(y.filter(kt).map(z=>z.id))),u("domains")}catch(g){h.current&&Q(g)}finally{h.current&&F(!1)}},[p==null?void 0:p.snapshotId,x]),ze=c.useCallback(async s=>{for(;;){const g=await q.getOnboardingJob(s),y=gt(g);if(!h.current)return;if(X(y),y.status==="completed"){await ie(x);return}if(y.status==="failed"||y.status==="cancelled")throw new Error(y.error||y.message||`Onboarding ${y.status}.`);await new Promise(w=>window.setTimeout(w,700))}},[ie,x]),De=c.useCallback(async s=>{F(!0),Q(null),u("building");try{const g=await q.applyDbtOnboarding({...B==="repo"?{repoUrl:U,branch:L||void 0,subPath:O||void 0}:{projectDir:f||"."},manifestPath:b,profilesDir:W||void 0,expectedFingerprint:j==null?void 0:j.fingerprint,buildArtifacts:s}),y=g.jobId??g.id,w=y?null:await q.refreshDbtOnboarding({expectedFingerprint:g.fingerprint??(j==null?void 0:j.fingerprint),buildArtifacts:s}),z=y??(w==null?void 0:w.jobId)??(w==null?void 0:w.id);z?(X({id:z,status:g.status??(w==null?void 0:w.status)??"queued"}),await ze(z)):await ie(x)}catch(g){h.current&&(Q(g),u(j?"inspect":"connect"))}finally{h.current&&F(!1)}},[L,ie,b,ze,j,W,f,U,B,O,x]);c.useEffect(()=>{a==="domains"&&!m&&!I&&!te&&!re&&ie(x)},[ie,m,re,I,a,te,x]);const Le=c.useCallback(async s=>{if(!m)return;const g=m.proposals.filter(y=>$.has(y.id)).map(y=>({...y,lifecycle:"draft"}));if(g.length===0){ne(!0),u("domain-model");return}F(!0),Q(null);try{const y=await q.applyOnboardingDomains({proposals:g,expectedSourceFingerprint:m.sourceFingerprint,mode:s});if(!h.current)return;N(y),(s==="apply"||y.applied)&&u("domain-model")}catch(y){h.current&&Q(y)}finally{h.current&&F(!1)}},[m,$]),it=c.useCallback(async()=>{if(v)try{await q.cancelOnboardingJob(v.id)}finally{X(s=>s&&{...s,status:"cancelled"}),u("inspect"),F(!1)}},[v]),ye=$.size,fe=c.useMemo(()=>{var s;return((s=C==null?void 0:C.domains)==null?void 0:s.map(g=>g.id))??(m==null?void 0:m.proposals.filter(g=>$.has(g.id)).map(g=>g.name))??[]},[m,C,$]),ce=s=>{d(),n(s)};return e.jsxs("div",{style:{background:t.appBg,width:"100vw",height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},role:"dialog","aria-modal":"true","aria-labelledby":"dbt-onboarding-title",children:[e.jsx("style",{children:`
2
7
  @keyframes dql-setup-fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
3
8
  @keyframes dql-setup-stage { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
4
9
  @keyframes dql-setup-arrow { 0%, 100% { opacity: 0.35; transform: translateX(0); } 50% { opacity: 1; transform: translateX(3px); } }
5
10
  @keyframes dql-setup-flowrail { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }
6
11
  @keyframes dql-setup-gitdash { 0% { background-position: 0 0; } 100% { background-position: 40px 0; } }
7
12
  @keyframes dql-setup-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
8
- `}),e.jsxs("div",{style:{height:52,flexShrink:0,background:t.cellBg,borderBottom:`1px solid ${t.cellBorder}`,display:"flex",alignItems:"center",padding:"0 18px",gap:10,userSelect:"none"},children:[e.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"linear-gradient(135deg, #5b8cff 0%, #7c5cff 100%)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx("span",{style:{color:"#fff",fontSize:10,fontWeight:700,fontFamily:t.fontMono,letterSpacing:"-0.5px"},children:"DQL"})}),e.jsx("h2",{id:"dbt-onboarding-title",style:{margin:0,fontSize:13.5,fontWeight:650,color:t.textPrimary,fontFamily:t.font,whiteSpace:"nowrap"},children:"Set up your workspace"}),e.jsx("div",{style:{flex:1}}),e.jsxs("div",{"aria-label":"dbt onboarding progress",style:{display:"flex",alignItems:"center",gap:4,overflowX:"auto"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:999,border:`1px solid ${k?t.accent:"var(--status-success-border)"}`,background:k?"var(--accent-dim)":"var(--status-success-bg)",fontFamily:t.font,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{width:16,height:16,borderRadius:999,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:9,fontWeight:700,background:k?t.accent:"var(--status-success)",color:"#fff"},children:k?"0":"✓"}),e.jsx("span",{style:{fontSize:11,fontWeight:650,color:k?t.accent:"var(--status-success)"},children:"Welcome"})]}),Xe.map((s,g)=>{const y=!k&&g<qe,w=!k&&g===qe;return e.jsxs("span",{"aria-current":w?"step":void 0,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:999,border:`1px solid ${w?t.accent:y?"var(--status-success-border)":t.cellBorder}`,background:w?"var(--accent-dim)":y?"var(--status-success-bg)":"transparent",fontFamily:t.font,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{width:16,height:16,borderRadius:999,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:9,fontWeight:700,background:w?t.accent:y?"var(--status-success)":t.cellBorder,color:w||y?"#fff":t.textMuted},children:y?"✓":g+1}),e.jsx("span",{style:{fontSize:11,fontWeight:650,color:w?t.accent:y?"var(--status-success)":t.textMuted},children:s.label})]},s.id)})]}),e.jsx("div",{style:{flex:1}}),e.jsx("button",{"aria-label":"Close setup",onClick:r,style:{height:28,padding:"0 11px",borderRadius:7,border:"none",background:"none",color:t.textMuted,fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:t.font,whiteSpace:"nowrap"},children:"Skip for now"})]}),e.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto"},children:e.jsx("div",{style:{width:"min(860px, 100% - 48px)",margin:"0 auto",padding:"26px 0 60px"},children:k?e.jsx(wt,{t}):e.jsxs(e.Fragment,{children:[null,te&&e.jsx(J,{t,title:"Checking existing setup…",body:"You can resume from the first incomplete step."}),a==="connect"&&!te&&e.jsxs(oe,{title:"1. Connect the dbt project",description:"Point DQL at the existing dbt project and artifact. DQL reads these files in place; it does not create a second semantic copy.",t,children:[e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{type:"button",onClick:()=>T("local"),style:B==="local"?H(t):Y(t),children:"Local path"}),e.jsx("button",{type:"button",onClick:()=>T("repo"),style:B==="repo"?H(t):Y(t),children:"Git repository"})]}),B==="local"?e.jsx(ae,{label:"dbt project directory",hint:"Folder containing dbt_project.yml",t,children:e.jsx("input",{"aria-label":"dbt project directory",value:f,onChange:s=>D(s.target.value),placeholder:".",style:R})}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{label:"Repository URL",hint:"HTTPS, SSH, or file URL for a dbt Git repository",t,children:e.jsx("input",{"aria-label":"dbt repository URL",value:U,onChange:s=>V(s.target.value),placeholder:"https://github.com/org/dbt-project.git",style:R})}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsx(ae,{label:"Branch",hint:"Defaults to main",t,children:e.jsx("input",{"aria-label":"dbt repository branch",value:L,onChange:s=>_(s.target.value),placeholder:"main",style:R})}),e.jsx(ae,{label:"Sub-path",hint:"Optional dbt project folder",t,children:e.jsx("input",{"aria-label":"dbt repository sub-path",value:O,onChange:s=>G(s.target.value),placeholder:"analytics/dbt",style:R})})]})]}),e.jsx(ae,{label:"Manifest path",hint:"Relative to the dbt project directory",t,children:e.jsx("input",{"aria-label":"dbt manifest path",value:b,onChange:s=>E(s.target.value),placeholder:"target/manifest.json",style:R})}),e.jsx(ae,{label:"dbt profiles directory",hint:"Optional; auto-detected from the dbt project, DQL project, DBT_PROFILES_DIR, or ~/.dbt",t,children:e.jsx("input",{"aria-label":"dbt profiles directory",value:W,onChange:s=>$(s.target.value),placeholder:"Auto-detect",style:R})}),e.jsx(St,{t})]}),a==="inspect"&&j&&e.jsxs(oe,{title:"2. Review dbt artifacts",description:"DQL will enable Manifest v3 and dbt-first modeling, then build an immutable snapshot from these sources.",t,children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:10},children:Object.entries(j.counts).map(([s,g])=>e.jsx(Ct,{label:s,value:g,t},s))}),e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:8,overflow:"hidden"},children:[e.jsx(me,{label:"manifest.json",value:je(j.artifacts.manifest),required:!0,t}),e.jsx(me,{label:"catalog.json",value:je(j.artifacts.catalog),t}),e.jsx(me,{label:"semantic_manifest.json",value:je(j.artifacts.semanticManifest),t}),e.jsx(me,{label:"profiles directory",value:j.profilesDir||"Optional · not detected",t})]}),e.jsx(J,{t,title:"What changes",body:"DQL writes project configuration and a rebuildable snapshot. dbt SQL/YAML and MetricFlow formulas remain the source of truth and are never copied into Domain Packages."}),(Re=j.warnings)==null?void 0:Re.map(s=>e.jsx(J,{t,title:"Repository note",body:s},s))]}),a==="building"&&e.jsx(oe,{title:"Building the dbt-first snapshot",description:"Artifact generation, validation, compile, and indexing are handled as one resumable job. The previous active snapshot remains usable until this completes.",t,children:e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:10,padding:16},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:t.textPrimary,font:`600 13px ${t.font}`},children:[e.jsx("span",{children:(v==null?void 0:v.stage)??"Preparing project"}),e.jsx("span",{children:typeof(v==null?void 0:v.progress)=="number"?`${v.progress}%`:(v==null?void 0:v.status)??"running"})]}),e.jsx("div",{style:{height:7,borderRadius:8,background:t.cellBorder,marginTop:12,overflow:"hidden"},children:e.jsx("div",{style:{width:`${Math.max(8,(v==null?void 0:v.progress)??15)}%`,height:"100%",background:t.accent,transition:"width .2s"}})}),(v==null?void 0:v.message)&&e.jsx("div",{style:{marginTop:10,color:t.textSecondary,font:`12px/1.5 ${t.font}`},children:v.message})]})}),a==="domains"&&e.jsxs(oe,{title:"3. Review discovered domains",description:"Proposals use dbt groups, tags, paths, owners, exposures, packages, and MetricFlow evidence. Nothing is certified automatically.",t,children:[e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:9,color:t.textSecondary,font:`12px/1.45 ${t.font}`},children:[e.jsx("input",{type:"checkbox",checked:x,onChange:s=>{A(s.target.checked),Z(null),Q(null)}}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:t.textPrimary},children:"Use AI to summarize repository evidence"}),e.jsx("br",{}),"Optional and review-only. AI cannot invent membership or set certified lifecycle."]})]}),(Te=m==null?void 0:m.warnings)==null?void 0:Te.map(s=>e.jsx(J,{t,title:"Discovery note",body:s},s)),m&&m.proposals.length===0&&e.jsx(J,{t,title:"No confident domains found",body:"Continue to create domains manually in Domain Studio. Ask remains available in limited-context, review-required mode."}),m==null?void 0:m.proposals.map(s=>{var y,w;const g=M.has(s.id);return e.jsx("label",{style:{display:"block",border:`1px solid ${g?t.accent:t.cellBorder}`,background:g?`${t.accent}0d`:t.inputBg,borderRadius:9,padding:13,cursor:"pointer"},children:e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-start"},children:[e.jsx("input",{type:"checkbox",checked:g,onChange:()=>{N(null),ee(z=>{const se=new Set(z);return se.has(s.id)?se.delete(s.id):se.add(s.id),se})},"aria-label":`Select ${s.name}`}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:7,alignItems:"center"},children:[e.jsx("strong",{style:{color:t.textPrimary,font:`600 13px ${t.font}`},children:s.name}),e.jsx(ve,{text:`${bt(s.confidence)} confidence`,t}),e.jsx(ve,{text:"Draft only",t,tone:"warning"}),s.requiresHumanDecision&&e.jsx(ve,{text:"Decision required",t,tone:"warning"})]}),s.description&&e.jsx("p",{style:{margin:"6px 0 0",color:t.textSecondary,font:`12px/1.45 ${t.font}`},children:s.description}),e.jsxs("div",{style:{marginTop:8,color:t.textMuted,font:`11px/1.45 ${t.font}`},children:["Evidence: ",s.evidence.length>0?s.evidence.slice(0,4).map(z=>`${z.kind}: ${z.value}`).join(" · "):"No evidence supplied — manual review required"]}),(((y=s.conflicts)==null?void 0:y.length)??0)>0&&e.jsxs("div",{style:{marginTop:6,color:t.warning,font:`11px/1.45 ${t.font}`},children:["Conflicts: ",(w=s.conflicts)==null?void 0:w.join(" · ")]})]})]})},s.id)}),((($e=C==null?void 0:C.preview)==null?void 0:$e.length)??0)>0&&e.jsxs("div",{style:{border:`1px solid ${t.accent}55`,background:`${t.accent}09`,borderRadius:9,padding:12},children:[e.jsx("div",{style:{color:t.textPrimary,font:`600 12px ${t.font}`},children:"Review Domain Package source changes"}),e.jsx("div",{style:{marginTop:4,color:t.textMuted,font:`11px/1.45 ${t.font}`},children:"Only sparse DQL domain declarations and bindings will be written. Confirm after reviewing these target files."}),e.jsx("div",{style:{display:"grid",gap:6,marginTop:9},children:(Me=C==null?void 0:C.preview)==null?void 0:Me.map(s=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 1fr",gap:8,color:t.textSecondary,font:`11px ${t.font}`},children:[e.jsx("strong",{children:s.operation}),e.jsx("code",{style:{color:t.textPrimary},children:s.path}),s.summary&&e.jsx("span",{style:{gridColumn:"2",color:t.textMuted},children:s.summary})]},`${s.operation}:${s.path}`))})]})]}),a==="domain-model"&&e.jsxs(oe,{title:"4. Build the Domain Model",description:"The unified canvas adds analytical meaning over dbt provenance. Start small: bind high-value entities and prove only the joins agents may use.",t,children:[fe.length>0&&e.jsx(J,{t,title:`${fe.length} draft domain${fe.length===1?"":"s"} created`,body:fe.join(" · ")}),de&&e.jsx(J,{t,title:"Domain setup skipped",body:"You can continue, but Ask is limited-context and all generated output requires review until governed paths exist."}),e.jsx(Oe,{t,items:[["Bind business entities","Reference dbt unique IDs; do not duplicate columns or descriptions."],["Declare analytical grain","Add grain only where dbt metadata is insufficient."],["Prove relationships","Cardinality, fanout, key mapping, evidence, and lifecycle control agent joins."],["Export cross-domain paths","Provider exports and consumer imports are required in addition to relationship proof."]]}),e.jsx("button",{onClick:()=>ce("modeling"),style:Y(t),children:"Open Domain Model now"})]}),a==="knowledge"&&e.jsxs(oe,{title:"5. Add domain knowledge",description:"Skills and terms teach agents vocabulary, policies, examples, exclusions, and when to ask for clarification.",t,children:[e.jsx(Oe,{t,items:[["Terms","Define business vocabulary and map synonyms to domain-qualified concepts."],["Domain skills","Add policies, examples, exclusions, and required clarifications for this domain."],["Evaluations","Test retrieval, metric selection, safe joins, refusal, and clarification behavior."],["Review lifecycle","AI may draft from repository evidence, but a person reviews and certifies."]]}),e.jsx("button",{onClick:()=>ce("skills"),style:Y(t),children:"Open Skills now"})]}),a==="ready"&&e.jsx(oe,{title:"Your dbt-first workspace is ready to continue",description:"Choose the next task. Setup is resumable, and trust improves as relationships, skills, evaluations, and certified assets are completed.",t,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:10},children:[e.jsx(ke,{title:"Ask AI",body:de?"Limited-context and review-required until domains are governed.":"Use the governed cascade; unsafe paths clarify or refuse.",action:"Open Ask",onClick:()=>ce("ask"),t}),e.jsx(ke,{title:"Build a Block",body:"Turn reviewed analysis into a reusable domain asset and evaluate it.",action:"New Block",onClick:()=>ce("block"),t}),e.jsx(ke,{title:"Domain Studio",body:"Continue bindings, relationships, knowledge, readiness, and dbt scope.",action:"Open Studio",onClick:()=>ce("modeling"),t})]})}),tt.map(s=>e.jsx(J,{t,title:"Optional capability",body:s},s)),P&&e.jsxs("div",{role:"alert",style:{border:`1px solid ${P.optional?t.warning:t.error}`,background:P.optional?`${t.warning}0d`:`${t.error}0d`,borderRadius:9,padding:13,marginTop:14},children:[e.jsx("div",{style:{color:P.optional?t.warning:t.error,font:`600 13px ${t.font}`},children:P.title}),e.jsx("div",{style:{color:t.textSecondary,font:`12px/1.5 ${t.font}`,marginTop:5},children:P.message}),P.command&&e.jsx("code",{style:{display:"block",marginTop:9,padding:"8px 10px",borderRadius:6,background:t.inputBg,color:t.textPrimary,fontSize:11,overflowX:"auto"},children:P.command}),e.jsx("ul",{style:{margin:"8px 0 0",paddingLeft:18,color:t.textMuted,font:`11px/1.5 ${t.font}`},children:P.nextActions.map(s=>e.jsx("li",{children:s},s))})]})]})})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:10,padding:"13px 22px",borderTop:`1px solid ${t.cellBorder}`,background:t.cellBg,flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",gap:8},children:[k&&e.jsx("button",{onClick:i,style:Y(t),children:"Back"}),!k&&a==="connect"&&e.jsx("button",{onClick:()=>l(!0),style:Y(t),children:"Back"}),!k&&a!=="building"&&a!=="connect"&&e.jsx("button",{onClick:r,style:Y(t),children:"Save & close"}),!k&&a==="building"&&v&&e.jsx("button",{onClick:()=>void it(),style:Y(t),children:"Cancel job"})]}),e.jsx("span",{style:{flex:1,textAlign:"center",fontSize:11,color:t.textMuted,fontFamily:t.font},children:k?"~2 minute read — or skip straight to setup":"Setup is resumable — you can save and come back any time."}),e.jsxs("div",{style:{display:"flex",gap:8},children:[k&&e.jsx("button",{onClick:()=>l(!1),style:H(t),children:"Next — connect your dbt project"}),!k&&a==="connect"&&(P==null?void 0:P.code)==="DBT_MANIFEST_MISSING"&&e.jsx("button",{disabled:I,onClick:()=>void De(!0),style:Y(t),children:"Build artifacts with DQL"}),!k&&a==="connect"&&e.jsx("button",{disabled:I||(B==="repo"?!U.trim():!f.trim()),onClick:()=>void nt(),style:H(t,I||(B==="repo"?!U.trim():!f.trim())),children:I?"Inspecting…":(P==null?void 0:P.code)==="DBT_MANIFEST_MISSING"?"I ran dbt parse — retry":"Inspect artifacts"}),!k&&a==="inspect"&&e.jsx("button",{disabled:I,onClick:()=>void De(!1),style:H(t,I),children:I?"Building…":"Apply & build snapshot"}),!k&&a==="domains"&&!m&&e.jsx("button",{disabled:I,onClick:()=>{Q(null),ie(x)},style:H(t,I),children:I?"Discovering…":"Retry discovery"}),!k&&a==="domains"&&m&&(((Pe=C==null?void 0:C.preview)==null?void 0:Pe.length)??0)===0&&e.jsx("button",{disabled:I,onClick:()=>void Le("preview"),style:H(t,I),children:I?"Preparing preview…":ye>0?`Review ${ye} draft domain${ye===1?"":"s"}`:"Continue without domains"}),!k&&a==="domains"&&m&&(((We=C==null?void 0:C.preview)==null?void 0:We.length)??0)>0&&e.jsx("button",{disabled:I,onClick:()=>void Le("apply"),style:H(t,I),children:I?"Applying…":"Apply reviewed drafts"}),!k&&a==="domain-model"&&e.jsx("button",{onClick:()=>u("knowledge"),style:H(t),children:"Continue to knowledge"}),!k&&a==="knowledge"&&e.jsx("button",{onClick:()=>u("ready"),style:H(t),children:"Continue"}),!k&&a==="ready"&&e.jsx("button",{onClick:r,style:{...H(t),background:"var(--status-success)",borderColor:"var(--status-success)"},children:"Finish setup"})]})]})]})}function wt({t}){const o=(p,S,f)=>e.jsxs("div",{style:{border:`1.5px solid ${S.border}`,borderRadius:10,background:S.bg,padding:"11px 10px",textAlign:"center",animation:"dql-setup-stage 0.5s ease-out both",animationDelay:`${p}s`,boxShadow:S.glow?"0 4px 18px rgba(107,93,211,0.12)":"none"},children:[e.jsx("div",{style:{width:26,height:26,borderRadius:7,background:S.iconBg,color:S.iconColor,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:f}),e.jsx("div",{style:{fontSize:12,fontWeight:700,color:t.textPrimary,marginTop:6},children:S.title}),e.jsx("div",{style:{fontSize:10,color:t.textMuted,lineHeight:1.45,marginTop:3},children:S.body})]}),i=e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",color:t.accent},children:e.jsxs("svg",{style:{animation:"dql-setup-arrow 1.6s ease-in-out infinite"},width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]})}),r=(p,S,f)=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,border:`1px solid ${(f==null?void 0:f.border)??t.cellBorder}`,background:(f==null?void 0:f.bg)??t.cellBg,borderRadius:999,padding:"4px 12px",fontSize:11.5,fontWeight:650,color:(f==null?void 0:f.color)??t.textSecondary},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:999,background:S}}),p]}),d=e.jsxs("svg",{style:{color:"var(--border-strong)"},width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]}),n=p=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:7,padding:"14px 0 10px"},children:[e.jsx("span",{style:{width:1.5,height:26,background:"linear-gradient(to bottom, transparent, var(--border-strong))"}}),e.jsx("span",{style:{fontSize:11.5,color:t.textMuted,fontStyle:"italic"},children:p}),e.jsx("span",{style:{width:1.5,height:26,background:"linear-gradient(to bottom, var(--border-strong), transparent)"}})]}),a=(p,S,f)=>e.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:11,background:t.cellBg,padding:"12px 14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,fontSize:12.5,fontWeight:700,color:t.textPrimary},children:[f,p]}),e.jsx("div",{style:{fontSize:11,color:t.textMuted,lineHeight:1.5,marginTop:4},children:S})]}),u=p=>e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"flex-start"},children:[e.jsx("svg",{style:{flexShrink:0,marginTop:3},width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"var(--status-success)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})}),e.jsx("span",{style:{fontSize:13,color:t.textSecondary,lineHeight:1.55},children:p})]});return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,animation:"dql-setup-fadein 0.25s ease-out",fontFamily:t.font},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.1fr 0.9fr",gap:28,alignItems:"center"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:7,border:"1px solid var(--status-info-border)",background:"var(--accent-dim)",borderRadius:999,padding:"4px 13px",fontSize:11,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",color:t.accent},children:"Welcome to DQL"}),e.jsxs("h1",{style:{margin:"12px 0 0",fontSize:27,fontWeight:700,letterSpacing:"-0.02em",color:t.textPrimary,lineHeight:1.25},children:["Analytics your AI",e.jsx("br",{}),"can't hallucinate"]}),e.jsxs("div",{style:{marginTop:14,display:"flex",flexDirection:"column",gap:9},children:[u("Sits on your dbt project — models and tests stay yours"),u(e.jsxs(e.Fragment,{children:["Questions route through ",e.jsx("strong",{children:"certified blocks"})," before AI writes SQL"]})),u("Every answer carries a trust label your stakeholders can read")]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,animation:"dql-setup-float 4s ease-in-out infinite"},children:[e.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:12,background:t.cellBg,padding:"12px 14px",boxShadow:"0 8px 28px rgba(26,26,26,0.06)"},children:[e.jsx("div",{style:{background:"var(--bg-0)",borderRadius:"12px 12px 3px 12px",padding:"7px 11px",fontSize:11.5,color:t.textPrimary,width:"fit-content",marginLeft:"auto"},children:"What was revenue last quarter?"}),e.jsxs("div",{style:{marginTop:9,display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontSize:10,fontWeight:700,color:"var(--status-success)",background:"var(--status-success-bg)",border:"1px solid var(--status-success-border)",borderRadius:999,padding:"1.5px 8px"},children:"Certified"}),e.jsx("span",{style:{fontSize:10,color:t.textMuted},children:"from total_revenue · 0.3s"})]}),e.jsxs("div",{style:{marginTop:6,fontSize:13,color:t.textPrimary},children:["Q2 revenue was ",e.jsx("strong",{children:"$4.82M"}),", up 6.4% from Q1."]})]}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:7,justifyContent:"flex-end",fontSize:10.5,color:t.textMuted,paddingRight:4},children:"Traceable from source table to this answer"})]})]}),e.jsxs("div",{style:{marginTop:14,display:"flex",alignItems:"baseline",gap:10},children:[e.jsx("span",{style:{fontSize:13,fontWeight:700,color:t.textMuted,fontFamily:t.fontMono},children:"01"}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:t.textPrimary,letterSpacing:"-0.01em"},children:"How a question becomes a trusted answer"}),e.jsx("div",{style:{fontSize:12,color:t.textMuted,marginTop:2},children:"Five stages, one direction — watch the flow."})]})]}),e.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:14,background:t.cellBg,padding:"22px 20px 16px"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 26px 1fr 26px 1fr 26px 1fr 26px 1fr",alignItems:"stretch"},children:[o(.1,{border:t.cellBorder,bg:t.appBg,iconBg:"rgba(74,116,201,0.12)",iconColor:"#4a74c9",title:"Sources & dbt",body:"Your warehouse and models — dbt keeps ownership"},e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),e.jsx("path",{d:"M3 5v14a9 3 0 0 0 18 0V5"}),e.jsx("path",{d:"M3 12a9 3 0 0 0 18 0"})]})),i,o(.35,{border:"rgba(10,107,94,0.3)",bg:"rgba(10,107,94,0.05)",iconBg:"rgba(10,107,94,0.12)",iconColor:"#0a6b5e",title:"Domains & modeling",body:"Business entities, proven joins, skills"},e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0z"}),e.jsx("path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3z"}),e.jsx("path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5z"})]})),i,o(.6,{border:"rgba(107,93,211,0.35)",bg:"var(--accent-dim)",iconBg:"rgba(107,93,211,0.14)",iconColor:t.accent,title:"Certified blocks",body:"Reusable governed answers — reviewed & certified",glow:!0},e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"13",y:"3",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"3",y:"13",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"13",y:"13",width:"8",height:"8",rx:"1.5"})]})),i,o(.85,{border:t.cellBorder,bg:t.appBg,iconBg:"rgba(178,107,31,0.12)",iconColor:"#b26b1f",title:"Ask & research",body:"Ask AI answers + SQL notebooks for deep dives"},e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z"})})),i,o(1.1,{border:"rgba(46,139,87,0.3)",bg:"rgba(46,139,87,0.05)",iconBg:"var(--status-success-bg)",iconColor:"var(--status-success)",title:"Generative apps",body:"Stakeholder apps built from certified blocks"},e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}),e.jsx("path",{d:"m3.3 7 8.7 5 8.7-5"}),e.jsx("path",{d:"M12 22V12"})]}))]}),e.jsxs("div",{style:{marginTop:14,display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{flex:1,height:5,borderRadius:999,background:"linear-gradient(90deg, rgba(74,116,201,0.35), rgba(10,107,94,0.4), rgba(107,93,211,0.5), rgba(178,107,31,0.4), rgba(46,139,87,0.45), rgba(74,116,201,0.35))",backgroundSize:"200% 100%",animation:"dql-setup-flowrail 5s linear infinite"}}),e.jsx("span",{style:{fontSize:10,color:t.textMuted,whiteSpace:"nowrap"},children:"Lineage — trace any number from source to app, across domains"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{flex:1,height:5,borderRadius:999,background:"repeating-linear-gradient(90deg, var(--border-strong) 0 14px, transparent 14px 20px)",animation:"dql-setup-gitdash 1.6s linear infinite"}}),e.jsx("span",{style:{fontSize:10,color:t.textMuted,whiteSpace:"nowrap"},children:"Everything Git-versioned — branch, review, approve like code"})]})]})]}),n("…and every good answer feeds the loop that makes the next one cheaper."),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10,justifyContent:"flex-end",textAlign:"right"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:t.textPrimary,letterSpacing:"-0.01em"},children:"Certify once, everyone reuses"}),e.jsx("div",{style:{fontSize:12,color:t.textMuted,marginTop:2},children:"The loop that grows trust — and cuts AI cost with every pass."})]}),e.jsx("span",{style:{fontSize:13,fontWeight:700,color:t.textMuted,fontFamily:t.fontMono},children:"02"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,flexWrap:"wrap",animation:"dql-setup-fadein 0.5s ease-out both",animationDelay:"1.3s"},children:[r("Research freely","#b26b1f",{color:"#b26b1f"}),d,r("Review together","var(--accent)",{color:"var(--accent)"}),d,r("Certify once","var(--status-success)",{border:"var(--status-success-border)",bg:"var(--status-success-bg)",color:"var(--status-success)"}),d,r("Everyone reuses — instantly","#4a74c9"),e.jsx("span",{style:{width:"100%",textAlign:"right",fontSize:11,color:t.textMuted,marginTop:2},children:"A certified block answers the same question forever — no regenerated SQL, no second review, no token bill."})]}),n("Which is why the numbers survive the hardest room in the company."),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10},children:[e.jsx("span",{style:{fontSize:13,fontWeight:700,color:t.textMuted,fontFamily:t.fontMono},children:"03"}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:t.textPrimary,letterSpacing:"-0.01em"},children:"Why it holds up in the boardroom"}),e.jsx("div",{style:{fontSize:12,color:t.textMuted,marginTop:2},children:"Four guarantees behind every number."})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(190px, 1fr))",gap:10,animation:"dql-setup-fadein 0.5s ease-out both",animationDelay:"1.5s"},children:[a("High confidence","Certified answers at stakeholder precision — every answer carries its trust label.",e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"var(--status-success)",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1 1 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}),e.jsx("path",{d:"m9 12 2 2 4-4"})]})),a("Lower AI cost","Reusable blocks answer repeat questions instantly — no regenerated SQL, no wasted tokens.",e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"13",y:"13",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"3",y:"13",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"13",y:"3",width:"8",height:"8",rx:"1.5"})]})),a("Git-versioned","Blocks, domains, and apps are files — branch, review, and approve like code.",e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#b26b1f",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"6",x2:"6",y1:"3",y2:"15"}),e.jsx("circle",{cx:"18",cy:"6",r:"3"}),e.jsx("circle",{cx:"6",cy:"18",r:"3"}),e.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]})),a("Full lineage","Trace any number from source table to app — including across domains.",e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#4a74c9",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"5",cy:"12",r:"2"}),e.jsx("circle",{cx:"19",cy:"5",r:"2"}),e.jsx("circle",{cx:"19",cy:"19",r:"2"}),e.jsx("path",{d:"M7 12l10-6M7 12l10 6"})]}))]})]})}function oe({title:t,description:o,t:i,children:r}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[e.jsxs("div",{children:[e.jsx("h3",{style:{margin:0,color:i.textPrimary,font:`600 15px ${i.font}`},children:t}),e.jsx("p",{style:{margin:"5px 0 0",color:i.textSecondary,font:`12px/1.5 ${i.font}`},children:o})]}),r]})}function ae({label:t,hint:o,t:i,children:r}){return e.jsxs("label",{style:{display:"block"},children:[e.jsx("span",{style:{display:"block",marginBottom:5,color:i.textSecondary,font:`600 11px ${i.font}`},children:t}),r,e.jsx("span",{style:{display:"block",marginTop:5,color:i.textMuted,font:`10px ${i.font}`},children:o})]})}function St({t}){return e.jsx(J,{t,title:"Read-only dbt ownership",body:"Models, columns, descriptions, tests, lineage, catalog types, and MetricFlow formulas stay in dbt. DQL stores sparse domains, bindings, relationship safety, contracts, skills, blocks, and evaluations."})}function J({title:t,body:o,t:i}){return e.jsxs("div",{style:{border:`1px solid ${i.cellBorder}`,background:i.inputBg,borderRadius:8,padding:"10px 12px",marginTop:10},children:[e.jsx("div",{style:{color:i.textPrimary,font:`600 11px ${i.font}`},children:t}),e.jsx("div",{style:{marginTop:3,color:i.textMuted,font:`11px/1.5 ${i.font}`},children:o})]})}function Ct({label:t,value:o,t:i}){return e.jsxs("div",{style:{border:`1px solid ${i.cellBorder}`,background:i.inputBg,borderRadius:8,padding:12},children:[e.jsx("div",{style:{color:i.textPrimary,font:`700 20px ${i.font}`},children:o}),e.jsx("div",{style:{color:i.textMuted,font:`11px ${i.font}`,textTransform:"capitalize"},children:t})]})}function me({label:t,value:o,required:i=!1,t:r}){return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"160px 1fr auto",gap:10,padding:"10px 12px",borderBottom:`1px solid ${r.cellBorder}`,color:r.textSecondary,font:`11px ${r.font}`},children:[e.jsx("strong",{style:{color:r.textPrimary},children:t}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:o}),e.jsx("span",{children:i?"Required":"Optional"})]})}function ve({text:t,t:o,tone:i}){const r=i==="warning"?o.warning:o.accent;return e.jsx("span",{style:{border:`1px solid ${r}55`,color:r,background:`${r}0d`,borderRadius:20,padding:"2px 7px",font:`600 9px ${o.font}`},children:t})}function Oe({items:t,t:o}){return e.jsx("div",{style:{display:"grid",gap:8},children:t.map(([i,r],d)=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"24px 1fr",gap:10,border:`1px solid ${o.cellBorder}`,borderRadius:8,padding:11},children:[e.jsx("span",{style:{width:22,height:22,display:"grid",placeItems:"center",borderRadius:"50%",background:`${o.accent}18`,color:o.accent,font:`600 10px ${o.font}`},children:d+1}),e.jsxs("div",{children:[e.jsx("strong",{style:{color:o.textPrimary,font:`600 12px ${o.font}`},children:i}),e.jsx("div",{style:{marginTop:2,color:o.textMuted,font:`11px/1.45 ${o.font}`},children:r})]})]},i))})}function ke({title:t,body:o,action:i,onClick:r,t:d}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",minHeight:145,border:`1px solid ${d.cellBorder}`,borderRadius:9,padding:13},children:[e.jsx("strong",{style:{color:d.textPrimary,font:`600 13px ${d.font}`},children:t}),e.jsx("div",{style:{flex:1,marginTop:6,color:d.textMuted,font:`11px/1.5 ${d.font}`},children:o}),e.jsx("button",{onClick:r,style:{...H(d),width:"100%",marginTop:12},children:i})]})}function H(t,o=!1){return{border:`1px solid ${t.accent}`,background:t.accent,color:"#fff",borderRadius:7,padding:"8px 14px",cursor:o?"not-allowed":"pointer",opacity:o?.55:1,font:`600 12px ${t.font}`}}function Y(t){return{border:`1px solid ${t.cellBorder}`,background:t.btnBg,color:t.textSecondary,borderRadius:7,padding:"8px 13px",cursor:"pointer",font:`500 12px ${t.font}`}}const It=[{id:"dbt",label:"dbt",description:"Connect a dbt project as the read-only source for models, schema, lineage, tests, catalog types, and MetricFlow.",icon:"dbt",color:"#ff694a"},{id:"cubejs",label:"Cube.js",description:"Import cubes, measures, dimensions, joins, and pre-aggregations from Cube.js.",icon:"cube",color:"#7a77ff"},{id:"snowflake",label:"Snowflake",description:"Introspect Snowflake semantic views and import metrics and dimensions.",icon:"snow",color:"#29b5e8"}];function At({detectedProvider:t,onClose:o,onImported:i}){const{state:r,dispatch:d}=Be(),n=Ye[r.themeMode],[a,u]=c.useState("provider"),[p,S]=c.useState(null),[f,D]=c.useState(""),[b,E]=c.useState(""),[W,$]=c.useState(""),[B,T]=c.useState(""),[U,V]=c.useState(""),[L,_]=c.useState("local"),[O,G]=c.useState([]),[j,K]=c.useState(null),[v,X]=c.useState(!1),[m,Z]=c.useState(null),[C,N]=c.useState(null),[M,ee]=c.useState(null),[x,A]=c.useState(null),[I,F]=c.useState(null);c.useEffect(()=>{q.getConnections().then(l=>{l!=null&&l.connections&&G(Object.keys(l.connections))}).catch(()=>{})},[]);const te=()=>p?p==="snowflake"?{provider:p,connection:U||void 0}:L==="repo"?{provider:p,repoUrl:b,branch:W||void 0,subPath:B||void 0}:{provider:p,projectPath:f||void 0}:null,ge=async()=>{const l=te();if(l){X(!0),Z(null),N(null);try{const h=await q.previewSemanticImport(l);K(h),u("preview")}catch(h){let R={};try{R=JSON.parse(h.message)}catch{R={error:h.message}}Z(R.error??h.message??"Preview failed"),N(R.hint??null)}finally{X(!1)}}},re=async()=>{const l=te();if(l){u("importing"),A(null),F(null);try{const h=await q.importSemanticLayer(l);ee(h),u("done")}catch(h){let R={};try{R=JSON.parse(h.message)}catch{R={error:h.message}}A(R.error??h.message??"Import failed"),F(R.hint??null),u("preview")}}},Q=()=>{i(),o()},de=l=>{l.target===l.currentTarget&&o()};c.useEffect(()=>{const l=h=>{h.key==="Escape"&&o()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o]);const ne={background:n.inputBg,border:`1px solid ${n.inputBorder}`,borderRadius:6,color:n.textPrimary,fontSize:13,fontFamily:n.font,padding:"8px 12px",outline:"none",width:"100%",boxSizing:"border-box"},k={fontSize:12,fontWeight:500,color:n.textSecondary,fontFamily:n.font,marginBottom:4,display:"block"};return p==="dbt"&&a!=="provider"?e.jsx("div",{onClick:de,style:{position:"fixed",inset:0,background:n.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,backdropFilter:"blur(4px)"},children:e.jsx(kt,{t:n,initialProjectDir:f,onBack:()=>u("provider"),onClose:o,onComplete:i,onOpen:l=>{if(o(),l==="block"){d({type:"SET_MAIN_VIEW",view:"block_studio"}),d({type:"OPEN_NEW_BLOCK_MODAL"});return}d({type:"SET_MAIN_VIEW",view:l})}})}):e.jsx("div",{onClick:de,style:{position:"fixed",inset:0,background:n.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,backdropFilter:"blur(4px)"},children:e.jsxs("div",{style:{background:n.modalBg,border:`1px solid ${n.cellBorder}`,borderRadius:12,width:560,maxWidth:"calc(100vw - 48px)",maxHeight:"calc(100vh - 80px)",display:"flex",flexDirection:"column",boxShadow:"0 20px 60px rgba(0,0,0,0.5)",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"20px 24px 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("h2",{style:{fontSize:16,fontWeight:600,color:n.textPrimary,fontFamily:n.font,margin:0},children:a==="done"?"Import Complete":"Set Up Semantic Layer"}),e.jsx("button",{onClick:o,style:{background:"transparent",border:"none",cursor:"pointer",color:n.textMuted,fontSize:18,lineHeight:1,padding:"2px 4px",borderRadius:4},children:"×"})]}),a!=="done"&&e.jsx("div",{style:{padding:"12px 24px 0",display:"flex",gap:4},children:["provider","configure","preview","importing"].map((l,h)=>e.jsx("div",{style:{flex:1,height:3,borderRadius:2,background:["provider","configure","preview","importing"].indexOf(a)>=h?n.accent:n.cellBorder,transition:"background 0.2s"}},l))}),e.jsxs("div",{style:{padding:"20px 24px 24px",flex:1,overflowY:"auto"},children:[a==="provider"&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("div",{style:{fontSize:13,color:n.textSecondary,fontFamily:n.font,lineHeight:1.5},children:"Connect dbt for the governed DQL 2.0 path, or import a supported external semantic provider."}),It.map(l=>{const h=t===l.id,R=p===l.id;return e.jsxs("button",{onClick:()=>S(l.id),style:{background:R?`${l.color}11`:n.inputBg,border:`2px solid ${R?l.color:n.cellBorder}`,borderRadius:10,padding:"14px 16px",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column",gap:4,transition:"border-color 0.15s, background 0.15s"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",background:l.color,flexShrink:0}}),e.jsx("span",{style:{fontSize:14,fontWeight:600,color:n.textPrimary,fontFamily:n.font},children:l.label}),h&&e.jsx("span",{style:{fontSize:10,fontWeight:600,color:l.color,fontFamily:n.font,background:`${l.color}18`,padding:"2px 8px",borderRadius:8,marginLeft:4},children:"Detected"})]}),e.jsx("span",{style:{fontSize:12,color:n.textMuted,fontFamily:n.font,lineHeight:1.4},children:l.description})]},l.id)})]}),a==="configure"&&p&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx("div",{style:{fontSize:13,color:n.textSecondary,fontFamily:n.font,lineHeight:1.5},children:p==="snowflake"?"Select the Snowflake connection to introspect semantic views.":`Configure the source for your ${p==="dbt"?"dbt":"Cube.js"} project.`}),p==="snowflake"?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsx("label",{style:k,children:"Connection"}),e.jsxs("select",{value:U,onChange:l=>V(l.target.value),style:ne,children:[e.jsx("option",{value:"",children:"Select a connection..."}),O.map(l=>e.jsx("option",{value:l,children:l},l))]}),O.length===0&&e.jsx("span",{style:{fontSize:11,color:n.warning??"#f0ad4e",fontFamily:n.font},children:"No connections configured. Set up a Snowflake connection first."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>_("local"),style:{background:L==="local"?n.accent:"transparent",color:L==="local"?"#fff":n.textSecondary,border:`1px solid ${L==="local"?n.accent:n.cellBorder}`,borderRadius:6,padding:"5px 14px",cursor:"pointer",fontSize:12,fontFamily:n.font,fontWeight:500},children:"Local Path"}),e.jsx("button",{onClick:()=>_("repo"),style:{background:L==="repo"?n.accent:"transparent",color:L==="repo"?"#fff":n.textSecondary,border:`1px solid ${L==="repo"?n.accent:n.cellBorder}`,borderRadius:6,padding:"5px 14px",cursor:"pointer",fontSize:12,fontFamily:n.font,fontWeight:500},children:"Git Repository"})]}),L==="local"?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsx("label",{style:k,children:"Project Path"}),e.jsx("input",{value:f,onChange:l=>D(l.target.value),placeholder:p==="dbt"?"../my-dbt-project":"../my-cube-project",style:ne}),e.jsx("span",{style:{fontSize:11,color:n.textMuted,fontFamily:n.font},children:p==="dbt"?"Path to the directory containing dbt_project.yml":"Path to the directory containing model/ or schema/"})]}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsx("label",{style:k,children:"Repository URL"}),e.jsx("input",{value:b,onChange:l=>E(l.target.value),placeholder:"https://github.com/org/repo",style:ne})]}),e.jsxs("div",{style:{display:"flex",gap:12},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[e.jsx("label",{style:k,children:"Branch"}),e.jsx("input",{value:W,onChange:l=>$(l.target.value),placeholder:"main",style:ne})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[e.jsx("label",{style:k,children:"Sub-path"}),e.jsx("input",{value:B,onChange:l=>T(l.target.value),placeholder:"optional/sub/dir",style:ne})]})]})]})]}),m&&e.jsxs("div",{style:{background:`${n.error}12`,border:`1px solid ${n.error}40`,borderRadius:8,padding:"10px 14px"},children:[e.jsx("div",{style:{fontSize:12,color:n.error,fontFamily:n.font,fontWeight:600,marginBottom:4},children:"Validation Failed"}),e.jsx("div",{style:{fontSize:12,color:n.textSecondary,fontFamily:n.font,lineHeight:1.4},children:m}),C&&e.jsx("div",{style:{fontSize:11,color:n.textMuted,fontFamily:n.font,marginTop:6,fontStyle:"italic"},children:C})]})]}),a==="preview"&&j&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx("div",{style:{fontSize:13,color:n.textSecondary,fontFamily:n.font,lineHeight:1.5},children:"Review what will be imported into your project."}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:10},children:Object.entries(j.counts).filter(([,l])=>l>0).map(([l,h])=>e.jsxs("div",{style:{background:n.inputBg,borderRadius:8,padding:"12px 14px",border:`1px solid ${n.cellBorder}`,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:22,fontWeight:700,color:n.accent,fontFamily:n.font},children:h}),e.jsxs("div",{style:{fontSize:11,color:n.textMuted,fontFamily:n.font,textTransform:"capitalize"},children:[l.replace("_","-"),"s"]})]},l))}),j.domains.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:n.textSecondary,fontFamily:n.font,marginBottom:6},children:"Domains"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:j.domains.map(l=>e.jsx("span",{style:{fontSize:11,fontFamily:n.font,background:n.pillBg,padding:"3px 10px",borderRadius:8,color:n.textSecondary},children:l},l))})]}),j.warnings.length>0&&e.jsxs("div",{style:{background:`${n.warning??"#f0ad4e"}12`,border:`1px solid ${n.warning??"#f0ad4e"}40`,borderRadius:8,padding:"10px 14px"},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:n.warning??"#f0ad4e",fontFamily:n.font,marginBottom:4},children:"Warnings"}),j.warnings.map((l,h)=>e.jsx("div",{style:{fontSize:12,color:n.textSecondary,fontFamily:n.font,lineHeight:1.4},children:l},h))]}),x&&e.jsxs("div",{style:{background:`${n.error}12`,border:`1px solid ${n.error}40`,borderRadius:8,padding:"10px 14px"},children:[e.jsx("div",{style:{fontSize:12,color:n.error,fontFamily:n.font,fontWeight:600,marginBottom:4},children:"Import Failed"}),e.jsx("div",{style:{fontSize:12,color:n.textSecondary,fontFamily:n.font,lineHeight:1.4},children:x}),I&&e.jsx("div",{style:{fontSize:11,color:n.textMuted,fontFamily:n.font,marginTop:6,fontStyle:"italic"},children:I})]})]}),a==="importing"&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"32px 0"},children:[e.jsx("div",{style:{width:40,height:40,borderRadius:"50%",border:`3px solid ${n.cellBorder}`,borderTopColor:n.accent,animation:"spin 0.8s linear infinite"}}),e.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"}),e.jsxs("div",{style:{fontSize:14,color:n.textSecondary,fontFamily:n.font},children:["Importing ",p," semantic layer..."]}),e.jsx("div",{style:{fontSize:12,color:n.textMuted,fontFamily:n.font},children:"Parsing models, writing YAML files, refreshing state"})]}),a==="done"&&M&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"12px 0"},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:36,height:36,borderRadius:"50%",background:`${n.success??"#28a745"}20`,color:n.success??"#28a745",fontSize:20,fontWeight:700},children:"✓"}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:14,fontWeight:600,color:n.textPrimary,fontFamily:n.font},children:"Semantic layer imported successfully"}),e.jsx("div",{style:{fontSize:12,color:n.textMuted,fontFamily:n.font},children:Object.entries(M.counts).filter(([,l])=>l>0).map(([l,h])=>`${h} ${l.replace("_","-")}${h!==1?"s":""}`).join(", ")})]})]}),M.manifest.warnings.length>0&&e.jsx("div",{style:{background:`${n.warning??"#f0ad4e"}12`,border:`1px solid ${n.warning??"#f0ad4e"}40`,borderRadius:8,padding:"10px 14px"},children:M.manifest.warnings.map((l,h)=>e.jsx("div",{style:{fontSize:12,color:n.textSecondary,fontFamily:n.font},children:l},h))}),e.jsx("div",{style:{background:n.inputBg,borderRadius:8,padding:"12px 14px",border:`1px solid ${n.cellBorder}`,fontSize:12,color:n.textMuted,fontFamily:n.font,lineHeight:1.5},children:"Your semantic definitions are now available in the Semantic Layer browser. Use the Guided Builder or drag metrics into your editor to start creating blocks."})]})]}),e.jsxs("div",{style:{padding:"14px 24px",borderTop:`1px solid ${n.cellBorder}`,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("div",{children:a!=="provider"&&a!=="importing"&&a!=="done"&&e.jsx("button",{onClick:()=>{a==="configure"?u("provider"):a==="preview"&&u("configure")},style:{background:"transparent",border:`1px solid ${n.cellBorder}`,borderRadius:6,color:n.textSecondary,cursor:"pointer",fontSize:13,fontFamily:n.font,fontWeight:500,padding:"7px 16px"},children:"Back"})}),e.jsxs("div",{style:{display:"flex",gap:10},children:[a!=="importing"&&e.jsx("button",{onClick:o,style:{background:n.btnBg,border:`1px solid ${n.btnBorder}`,borderRadius:6,color:n.textSecondary,cursor:"pointer",fontSize:13,fontFamily:n.font,fontWeight:500,padding:"7px 16px"},children:"Cancel"}),a==="provider"&&e.jsx("button",{onClick:()=>p&&u("configure"),disabled:!p,style:{background:n.accent,border:`1px solid ${n.accent}`,borderRadius:6,color:"#fff",cursor:p?"pointer":"not-allowed",fontSize:13,fontFamily:n.font,fontWeight:500,padding:"7px 20px",opacity:p?1:.5},children:p==="dbt"?"Connect dbt":"Next"}),a==="configure"&&e.jsx("button",{onClick:ge,disabled:v,style:{background:n.accent,border:`1px solid ${n.accent}`,borderRadius:6,color:"#fff",cursor:v?"not-allowed":"pointer",fontSize:13,fontFamily:n.font,fontWeight:500,padding:"7px 20px",opacity:v?.6:1,display:"flex",alignItems:"center",gap:6},children:v?"Validating...":"Validate & Preview"}),a==="preview"&&e.jsx("button",{onClick:re,style:{background:n.accent,border:`1px solid ${n.accent}`,borderRadius:6,color:"#fff",cursor:"pointer",fontSize:13,fontFamily:n.font,fontWeight:500,padding:"7px 20px"},children:"Import"}),a==="done"&&e.jsx("button",{onClick:Q,style:{background:n.accent,border:`1px solid ${n.accent}`,borderRadius:6,color:"#fff",cursor:"pointer",fontSize:13,fontFamily:n.font,fontWeight:500,padding:"7px 20px"},children:"Open Semantic Browser"})]})]})]})})}const we=3;function Bt({t,aiReady:o=!0,onSetupAi:i}){const{dispatch:r}=Be(),[d,n]=c.useState(null),[a,u]=c.useState(!0);c.useEffect(()=>{if(!o){u(!1);return}let D=!1;return u(!0),q.getProposeReadiness({limit:we}).then(b=>{D||n(b)}).catch(()=>{D||n(null)}).finally(()=>{D||u(!1)}),()=>{D=!0}},[o]);const p=c.useMemo(()=>d!=null&&d.ready?[...d.plan.domains.flatMap(b=>b.candidates)].sort((b,E)=>(E.score??0)-(b.score??0)).slice(0,we):[],[d]),S=c.useCallback(()=>{r({type:"SET_MAIN_VIEW",view:"readiness"})},[r]),f=c.useCallback(()=>{r({type:"SET_MAIN_VIEW",view:"block_studio"})},[r]);return o?e.jsxs("div",{style:_e(t),children:[e.jsx("style",{children:Ve}),e.jsxs("div",{style:Fe,children:[e.jsx("span",{style:Qe(t),children:e.jsx(Ie,{size:16,strokeWidth:2,"aria-hidden":"true"})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:14,fontWeight:760,color:t.textPrimary},children:"New here? Start with blocks DQL built for you"}),e.jsxs("p",{style:{margin:"3px 0 0",fontSize:12.5,lineHeight:1.5,color:t.textSecondary},children:["A ",e.jsx("strong",{children:"block"})," is a reusable piece of analytics — one trusted metric or query your whole team can reuse across answers and Apps. Here are a few important ones DQL drafted from your dbt models. Open ",e.jsx("em",{children:"See details"})," on each to understand exactly what it measures and the SQL behind it — then build your own."]})]})]}),a?e.jsx("div",{style:Et,children:Array.from({length:we}).map((D,b)=>e.jsx("div",{className:"dql-starter-skel",style:Ot(t)},b))}):p.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:Dt,children:p.map((D,b)=>e.jsx(qt,{candidate:D,index:b,t},D.slug))}),e.jsxs("div",{style:He(t),children:[e.jsx("span",{style:{fontSize:12,color:t.textMuted},children:"Open a suggested block to edit it, or build one from scratch."}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsxs("button",{type:"button",onClick:S,style:Ue(t),children:["Open block suggestions",e.jsx(he,{size:14,strokeWidth:2.2,"aria-hidden":"true"})]}),e.jsxs("button",{type:"button",onClick:f,style:Se(t),children:[e.jsx(ue,{size:14,strokeWidth:2,"aria-hidden":"true"}),"Build my own"]})]})]})]}):e.jsxs("div",{style:_t(t),children:[e.jsx(ot,{size:16,strokeWidth:2,"aria-hidden":"true",style:{flexShrink:0,marginTop:1,color:t.textMuted}}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("span",{style:{fontSize:12.5,color:t.textSecondary,lineHeight:1.5},children:d&&!d.ready&&d.reason?d.reason:"No starter blocks to suggest yet — connect a dbt project so DQL can read your models, or build your first block by hand to see how it works."}),e.jsxs("button",{type:"button",onClick:f,style:Se(t),children:[e.jsx(ue,{size:14,strokeWidth:2,"aria-hidden":"true"}),"Build a block in Block Studio"]})]})]})]}):e.jsxs("div",{style:_e(t),children:[e.jsx("style",{children:Ve}),e.jsxs("div",{style:Fe,children:[e.jsx("span",{style:Qe(t),children:e.jsx(Ie,{size:16,strokeWidth:2,"aria-hidden":"true"})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:14,fontWeight:760,color:t.textPrimary},children:"Turn on AI to generate starter blocks"}),e.jsxs("p",{style:{margin:"3px 0 0",fontSize:12.5,lineHeight:1.5,color:t.textSecondary},children:["Block suggestions are drafted by ",e.jsx("strong",{children:"your AI provider"})," from your dbt models and data — that's where the value is. Connect a provider (OpenAI, Anthropic, Gemini, or a local Ollama) and DQL will propose a few important blocks you can learn from and certify."]})]})]}),e.jsxs("div",{style:He(t),children:[e.jsx("span",{style:{fontSize:12,color:t.textMuted},children:"AI also powers governed answers and research — it's the heart of DQL."}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[i?e.jsxs("button",{type:"button",onClick:i,style:Ue(t),children:["Connect an AI provider",e.jsx(he,{size:14,strokeWidth:2.2,"aria-hidden":"true"})]}):null,e.jsxs("button",{type:"button",onClick:f,style:Se(t),children:[e.jsx(ue,{size:14,strokeWidth:2,"aria-hidden":"true"}),"Build one by hand"]})]})]})]})}function qt({candidate:t,index:o,t:i}){const[r,d]=c.useState(!1),[n,a]=c.useState(null),[u,p]=c.useState(!1),[S,f]=c.useState(null),D=c.useCallback(()=>{d($=>{const B=!$;return B&&!n&&!u&&(p(!0),f(null),q.proposePreview(t.slug).then(T=>a(T.candidate)).catch(T=>f(T instanceof Error?T.message:"Could not load the details.")).finally(()=>p(!1))),B})},[t.slug,n,u]),b=n??t,E=t.evidence.slice(0,2).join(" · "),W=t.description||E||"A governed metric drafted from your dbt model.";return e.jsxs("div",{className:"dql-starter-card",style:{...Lt(i),animationDelay:`${o*70}ms`},children:[e.jsxs("button",{type:"button",onClick:D,"aria-expanded":r,style:Rt,children:[e.jsx("span",{style:Tt(i),children:o+1}),e.jsxs("span",{style:{display:"grid",gap:4,minWidth:0,flex:1,textAlign:"left"},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:7,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:720,color:i.textPrimary},children:t.model}),e.jsx(xt,{state:"ai_generated"}),t.pattern?e.jsx("span",{style:Pt(i),children:t.pattern}):null,t.grain?e.jsxs("span",{style:{fontSize:11,color:i.textMuted},children:["grain ",t.grain]}):null]}),e.jsx("span",{style:{fontSize:12,color:i.textSecondary,lineHeight:1.45},children:W})]}),e.jsxs("span",{style:$t(i),children:[r?e.jsx(rt,{size:13,strokeWidth:2.2}):e.jsx(st,{size:13,strokeWidth:2.2}),r?"Hide":"See details"]})]}),r?e.jsx("div",{style:Mt(i),children:u?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:i.textMuted},children:[e.jsx(at,{size:13,className:"dql-starter-spin"})," Loading the SQL and what it measures…"]}):S?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:i.warning},children:[e.jsx(Ke,{size:14})," ",S]}):e.jsxs(e.Fragment,{children:[b.description?e.jsx(xe,{label:"What it is",t:i,children:e.jsx("span",{style:{fontSize:12.5,color:i.textSecondary,lineHeight:1.5},children:b.description})}):null,(b.outputs??[]).length>0?e.jsx(xe,{label:"What it measures",t:i,children:e.jsx("span",{style:{display:"flex",flexWrap:"wrap",gap:5},children:b.outputs.map($=>e.jsx("span",{style:Wt(i),children:$},$))})}):null,(b.examples??[]).length>0?e.jsx(xe,{label:"Answers questions like",t:i,children:e.jsx("ul",{style:{margin:0,padding:"0 0 0 16px",display:"grid",gap:3},children:b.examples.slice(0,3).map($=>e.jsx("li",{style:{fontSize:12,color:i.textSecondary,lineHeight:1.45},children:$},$))})}):null,e.jsx(xe,{label:"The SQL behind it",t:i,children:b.sqlPreview?e.jsx("pre",{style:Nt(i),children:e.jsx("code",{style:{fontFamily:i.fontMono,fontSize:11.5,whiteSpace:"pre-wrap",wordBreak:"break-word",color:i.textPrimary},children:b.sqlPreview.trim()})}):e.jsx("span",{style:{fontSize:11.5,color:i.textMuted},children:"SQL preview is not available for this model yet."})}),e.jsx(zt,{verdict:b.certifierVerdict,t:i})]})}):null]})}function xe({label:t,children:o,t:i}){return e.jsxs("div",{style:{display:"grid",gap:5},children:[e.jsx("span",{style:{fontSize:9.5,fontWeight:800,letterSpacing:"0.05em",textTransform:"uppercase",color:i.textMuted},children:t}),o]})}function zt({verdict:t,t:o}){const i=!!(t!=null&&t.ready&&t.blocking.length===0);return e.jsx(xe,{label:"Can you trust it",t:o,children:i?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,color:o.success},children:[e.jsx(lt,{size:14})," Grain, outputs, and context are set — ready to certify."]}):e.jsxs("span",{style:{display:"inline-flex",alignItems:"flex-start",gap:6,fontSize:12,color:o.warning,lineHeight:1.45},children:[e.jsx(Ke,{size:14,style:{flexShrink:0,marginTop:1}}),"An AI draft — a person reviews and certifies it before your team relies on it. That review step is what makes a block trustworthy."]})})}const _e=t=>({border:`1px solid ${t.cellBorder}`,borderRadius:12,background:t.cellBg,padding:16,display:"grid",gap:14}),Fe={display:"flex",gap:11,alignItems:"flex-start"},Qe=t=>({flex:"none",width:32,height:32,borderRadius:9,display:"inline-flex",alignItems:"center",justifyContent:"center",background:`${t.accent}18`,color:t.accent}),Dt={display:"grid",gap:8},Lt=t=>({border:`1px solid ${t.cellBorder}`,borderLeft:`3px solid ${t.accent}`,borderRadius:9,background:t.appBg,overflow:"hidden"}),Rt={width:"100%",display:"flex",gap:11,alignItems:"flex-start",padding:11,border:"none",background:"transparent",cursor:"pointer",textAlign:"left"},Tt=t=>({flex:"none",width:20,height:20,borderRadius:6,display:"inline-flex",alignItems:"center",justifyContent:"center",background:`${t.accent}18`,color:t.accent,fontSize:11,fontWeight:800,marginTop:1}),$t=t=>({display:"inline-flex",alignItems:"center",gap:4,flexShrink:0,padding:"5px 9px",borderRadius:6,border:`1px solid ${t.cellBorder}`,background:t.cellBg,color:t.textSecondary,fontSize:11,fontWeight:650,whiteSpace:"nowrap",alignSelf:"flex-start"}),Mt=t=>({borderTop:`1px solid ${t.cellBorder}`,padding:"11px 11px 12px 42px",display:"grid",gap:11}),Pt=t=>({fontSize:10,padding:"2px 7px",borderRadius:4,background:`${t.textMuted}1f`,color:t.textSecondary,fontWeight:600}),Wt=t=>({fontSize:11,fontWeight:600,padding:"3px 8px",borderRadius:6,border:`1px solid ${t.cellBorder}`,background:t.cellBg,color:t.textSecondary,fontFamily:t.fontMono}),Nt=t=>({margin:0,border:`1px solid ${t.cellBorder}`,borderRadius:8,background:t.inputBg,padding:"9px 11px",overflow:"auto",maxHeight:240}),He=t=>({display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap",borderTop:`1px solid ${t.cellBorder}`,paddingTop:12}),Ue=t=>Je(t,{variant:"primary",size:"md"}),Se=t=>Je(t,{variant:"ghost",size:"md"}),Et={display:"grid",gap:8},Ot=t=>({height:56,borderRadius:9,border:`1px solid ${t.cellBorder}`,background:t.appBg}),_t=t=>({display:"flex",gap:10,alignItems:"flex-start",border:`1px dashed ${t.cellBorder}`,borderRadius:9,padding:14,background:t.appBg}),Ve=`
13
+ `}),e.jsxs("div",{style:{height:52,flexShrink:0,background:t.cellBg,borderBottom:`1px solid ${t.cellBorder}`,display:"flex",alignItems:"center",padding:"0 18px",gap:10,userSelect:"none"},children:[e.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"linear-gradient(135deg, #5b8cff 0%, #7c5cff 100%)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx("span",{style:{color:"#fff",fontSize:10,fontWeight:700,fontFamily:t.fontMono,letterSpacing:"-0.5px"},children:"DQL"})}),e.jsx("h2",{id:"dbt-onboarding-title",style:{margin:0,fontSize:13.5,fontWeight:650,color:t.textPrimary,fontFamily:t.font,whiteSpace:"nowrap"},children:"Set up your workspace"}),e.jsx("div",{style:{flex:1}}),e.jsxs("div",{"aria-label":"dbt onboarding progress",style:{display:"flex",alignItems:"center",gap:4,overflowX:"auto"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:999,border:`1px solid ${k?t.accent:"var(--status-success-border)"}`,background:k?"var(--accent-dim)":"var(--status-success-bg)",fontFamily:t.font,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{width:16,height:16,borderRadius:999,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:9,fontWeight:700,background:k?t.accent:"var(--status-success)",color:"#fff"},children:k?"0":"✓"}),e.jsx("span",{style:{fontSize:11,fontWeight:650,color:k?t.accent:"var(--status-success)"},children:"Welcome"})]}),Xe.map((s,g)=>{const y=!k&&g<qe,w=!k&&g===qe;return e.jsxs("span",{"aria-current":w?"step":void 0,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:999,border:`1px solid ${w?t.accent:y?"var(--status-success-border)":t.cellBorder}`,background:w?"var(--accent-dim)":y?"var(--status-success-bg)":"transparent",fontFamily:t.font,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{width:16,height:16,borderRadius:999,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:9,fontWeight:700,background:w?t.accent:y?"var(--status-success)":t.cellBorder,color:w||y?"#fff":t.textMuted},children:y?"✓":g+1}),e.jsx("span",{style:{fontSize:11,fontWeight:650,color:w?t.accent:y?"var(--status-success)":t.textMuted},children:s.label})]},s.id)})]}),e.jsx("div",{style:{flex:1}}),e.jsx("button",{"aria-label":"Close setup",onClick:r,style:{height:28,padding:"0 11px",borderRadius:7,border:"none",background:"none",color:t.textMuted,fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:t.font,whiteSpace:"nowrap"},children:"Skip for now"})]}),e.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto"},children:e.jsx("div",{style:{width:"min(860px, 100% - 48px)",margin:"0 auto",padding:"26px 0 60px"},children:k?e.jsx(Ct,{t}):e.jsxs(e.Fragment,{children:[null,te&&e.jsx(J,{t,title:"Checking existing setup…",body:"You can resume from the first incomplete step."}),a==="connect"&&!te&&e.jsxs(oe,{title:"1. Connect the dbt project",description:"Point DQL at the existing dbt project and artifact. DQL reads these files in place; it does not create a second semantic copy.",t,children:[e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{type:"button",onClick:()=>T("local"),style:B==="local"?H(t):Y(t),children:"Local path"}),e.jsx("button",{type:"button",onClick:()=>T("repo"),style:B==="repo"?H(t):Y(t),children:"Git repository"})]}),B==="local"?e.jsx(ae,{label:"dbt project directory",hint:"Folder containing dbt_project.yml",t,children:e.jsx("input",{"aria-label":"dbt project directory",value:f,onChange:s=>D(s.target.value),placeholder:".",style:R})}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{label:"Repository URL",hint:"HTTPS, SSH, or file URL for a dbt Git repository",t,children:e.jsx("input",{"aria-label":"dbt repository URL",value:U,onChange:s=>V(s.target.value),placeholder:"https://github.com/org/dbt-project.git",style:R})}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsx(ae,{label:"Branch",hint:"Defaults to main",t,children:e.jsx("input",{"aria-label":"dbt repository branch",value:L,onChange:s=>_(s.target.value),placeholder:"main",style:R})}),e.jsx(ae,{label:"Sub-path",hint:"Optional dbt project folder",t,children:e.jsx("input",{"aria-label":"dbt repository sub-path",value:O,onChange:s=>G(s.target.value),placeholder:"analytics/dbt",style:R})})]})]}),e.jsx(ae,{label:"Manifest path",hint:"Relative to the dbt project directory",t,children:e.jsx("input",{"aria-label":"dbt manifest path",value:b,onChange:s=>E(s.target.value),placeholder:"target/manifest.json",style:R})}),e.jsx(ae,{label:"dbt profiles directory",hint:"Optional; auto-detected from the dbt project, DQL project, DBT_PROFILES_DIR, or ~/.dbt",t,children:e.jsx("input",{"aria-label":"dbt profiles directory",value:W,onChange:s=>M(s.target.value),placeholder:"Auto-detect",style:R})}),e.jsx(It,{t})]}),a==="inspect"&&j&&e.jsxs(oe,{title:"2. Review dbt artifacts",description:"DQL will enable Manifest v3 and dbt-first modeling, then build an immutable snapshot from these sources.",t,children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:10},children:Object.entries(j.counts).map(([s,g])=>e.jsx(At,{label:s,value:g,t},s))}),e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:8,overflow:"hidden"},children:[e.jsx(me,{label:"manifest.json",value:je(j.artifacts.manifest),required:!0,t}),e.jsx(me,{label:"catalog.json",value:je(j.artifacts.catalog),t}),e.jsx(me,{label:"semantic_manifest.json",value:je(j.artifacts.semanticManifest),t}),e.jsx(me,{label:"profiles directory",value:j.profilesDir||"Optional · not detected",t})]}),e.jsx(J,{t,title:"What changes",body:"DQL writes project configuration and a rebuildable snapshot. dbt SQL/YAML and MetricFlow formulas remain the source of truth and are never copied into Domain Packages."}),(Re=j.warnings)==null?void 0:Re.map(s=>e.jsx(J,{t,title:"Repository note",body:s},s))]}),a==="building"&&e.jsx(oe,{title:"Building the dbt-first snapshot",description:"Artifact generation, validation, compile, and indexing are handled as one resumable job. The previous active snapshot remains usable until this completes.",t,children:e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:10,padding:16},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:t.textPrimary,font:`600 13px ${t.font}`},children:[e.jsx("span",{children:(v==null?void 0:v.stage)??"Preparing project"}),e.jsx("span",{children:typeof(v==null?void 0:v.progress)=="number"?`${v.progress}%`:(v==null?void 0:v.status)??"running"})]}),e.jsx("div",{style:{height:7,borderRadius:8,background:t.cellBorder,marginTop:12,overflow:"hidden"},children:e.jsx("div",{style:{width:`${Math.max(8,(v==null?void 0:v.progress)??15)}%`,height:"100%",background:t.accent,transition:"width .2s"}})}),(v==null?void 0:v.message)&&e.jsx("div",{style:{marginTop:10,color:t.textSecondary,font:`12px/1.5 ${t.font}`},children:v.message})]})}),a==="domains"&&e.jsxs(oe,{title:"3. Review discovered domains",description:"Proposals use dbt groups, tags, paths, owners, exposures, packages, and MetricFlow evidence. Nothing is certified automatically.",t,children:[e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:9,color:t.textSecondary,font:`12px/1.45 ${t.font}`},children:[e.jsx("input",{type:"checkbox",checked:x,onChange:s=>{A(s.target.checked),Z(null),Q(null)}}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:t.textPrimary},children:"Use AI to summarize repository evidence"}),e.jsx("br",{}),"Optional and review-only. AI cannot invent membership or set certified lifecycle."]})]}),(Te=m==null?void 0:m.warnings)==null?void 0:Te.map(s=>e.jsx(J,{t,title:"Discovery note",body:s},s)),m&&m.proposals.length===0&&e.jsx(J,{t,title:"No confident domains found",body:"Continue to create domains manually in Domain Studio. Ask remains available in limited-context, review-required mode."}),m==null?void 0:m.proposals.map(s=>{var y,w;const g=$.has(s.id);return e.jsx("label",{style:{display:"block",border:`1px solid ${g?t.accent:t.cellBorder}`,background:g?`${t.accent}0d`:t.inputBg,borderRadius:9,padding:13,cursor:"pointer"},children:e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-start"},children:[e.jsx("input",{type:"checkbox",checked:g,onChange:()=>{N(null),ee(z=>{const se=new Set(z);return se.has(s.id)?se.delete(s.id):se.add(s.id),se})},"aria-label":`Select ${s.name}`}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:7,alignItems:"center"},children:[e.jsx("strong",{style:{color:t.textPrimary,font:`600 13px ${t.font}`},children:s.name}),e.jsx(ve,{text:`${vt(s.confidence)} confidence`,t}),e.jsx(ve,{text:"Draft only",t,tone:"warning"}),s.requiresHumanDecision&&e.jsx(ve,{text:"Decision required",t,tone:"warning"})]}),s.description&&e.jsx("p",{style:{margin:"6px 0 0",color:t.textSecondary,font:`12px/1.45 ${t.font}`},children:s.description}),e.jsxs("div",{style:{marginTop:8,color:t.textMuted,font:`11px/1.45 ${t.font}`},children:["Evidence: ",s.evidence.length>0?s.evidence.slice(0,4).map(z=>`${z.kind}: ${z.value}`).join(" · "):"No evidence supplied — manual review required"]}),(((y=s.conflicts)==null?void 0:y.length)??0)>0&&e.jsxs("div",{style:{marginTop:6,color:t.warning,font:`11px/1.45 ${t.font}`},children:["Conflicts: ",(w=s.conflicts)==null?void 0:w.join(" · ")]})]})]})},s.id)}),(((Me=C==null?void 0:C.preview)==null?void 0:Me.length)??0)>0&&e.jsxs("div",{style:{border:`1px solid ${t.accent}55`,background:`${t.accent}09`,borderRadius:9,padding:12},children:[e.jsx("div",{style:{color:t.textPrimary,font:`600 12px ${t.font}`},children:"Review Domain Package source changes"}),e.jsx("div",{style:{marginTop:4,color:t.textMuted,font:`11px/1.45 ${t.font}`},children:"Only sparse DQL domain declarations and bindings will be written. Confirm after reviewing these target files."}),e.jsx("div",{style:{display:"grid",gap:6,marginTop:9},children:($e=C==null?void 0:C.preview)==null?void 0:$e.map(s=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 1fr",gap:8,color:t.textSecondary,font:`11px ${t.font}`},children:[e.jsx("strong",{children:s.operation}),e.jsx("code",{style:{color:t.textPrimary},children:s.path}),s.summary&&e.jsx("span",{style:{gridColumn:"2",color:t.textMuted},children:s.summary})]},`${s.operation}:${s.path}`))})]})]}),a==="domain-model"&&e.jsxs(oe,{title:"4. Build the Domain Model",description:"The unified canvas adds analytical meaning over dbt provenance. Start small: bind high-value entities and prove only the joins agents may use.",t,children:[fe.length>0&&e.jsx(J,{t,title:`${fe.length} draft domain${fe.length===1?"":"s"} created`,body:fe.join(" · ")}),de&&e.jsx(J,{t,title:"Domain setup skipped",body:"You can continue, but Ask is limited-context and all generated output requires review until governed paths exist."}),e.jsx(Oe,{t,items:[["Bind business entities","Reference dbt unique IDs; do not duplicate columns or descriptions."],["Declare analytical grain","Add grain only where dbt metadata is insufficient."],["Prove relationships","Cardinality, fanout, key mapping, evidence, and lifecycle control agent joins."],["Export cross-domain paths","Provider exports and consumer imports are required in addition to relationship proof."]]}),e.jsx("button",{onClick:()=>ce("modeling"),style:Y(t),children:"Open Domain Model now"})]}),a==="knowledge"&&e.jsxs(oe,{title:"5. Add domain knowledge",description:"Skills and terms teach agents vocabulary, policies, examples, exclusions, and when to ask for clarification.",t,children:[e.jsx(Oe,{t,items:[["Terms","Define business vocabulary and map synonyms to domain-qualified concepts."],["Domain skills","Add policies, examples, exclusions, and required clarifications for this domain."],["Evaluations","Test retrieval, metric selection, safe joins, refusal, and clarification behavior."],["Review lifecycle","AI may draft from repository evidence, but a person reviews and certifies."]]}),e.jsx("button",{onClick:()=>ce("skills"),style:Y(t),children:"Open Skills now"})]}),a==="ready"&&e.jsx(oe,{title:"Your dbt-first workspace is ready to continue",description:"Choose the next task. Setup is resumable, and trust improves as relationships, skills, evaluations, and certified assets are completed.",t,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:10},children:[e.jsx(ke,{title:"Ask AI",body:de?"Limited-context and review-required until domains are governed.":"Use the governed cascade; unsafe paths clarify or refuse.",action:"Open Ask",onClick:()=>ce("ask"),t}),e.jsx(ke,{title:"Build a Block",body:"Turn reviewed analysis into a reusable domain asset and evaluate it.",action:"New Block",onClick:()=>ce("block"),t}),e.jsx(ke,{title:"Domain Studio",body:"Continue bindings, relationships, knowledge, readiness, and dbt scope.",action:"Open Studio",onClick:()=>ce("modeling"),t})]})}),tt.map(s=>e.jsx(J,{t,title:"Optional capability",body:s},s)),P&&e.jsxs("div",{role:"alert",style:{border:`1px solid ${P.optional?t.warning:t.error}`,background:P.optional?`${t.warning}0d`:`${t.error}0d`,borderRadius:9,padding:13,marginTop:14},children:[e.jsx("div",{style:{color:P.optional?t.warning:t.error,font:`600 13px ${t.font}`},children:P.title}),e.jsx("div",{style:{color:t.textSecondary,font:`12px/1.5 ${t.font}`,marginTop:5},children:P.message}),P.command&&e.jsx("code",{style:{display:"block",marginTop:9,padding:"8px 10px",borderRadius:6,background:t.inputBg,color:t.textPrimary,fontSize:11,overflowX:"auto"},children:P.command}),e.jsx("ul",{style:{margin:"8px 0 0",paddingLeft:18,color:t.textMuted,font:`11px/1.5 ${t.font}`},children:P.nextActions.map(s=>e.jsx("li",{children:s},s))})]})]})})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:10,padding:"13px 22px",borderTop:`1px solid ${t.cellBorder}`,background:t.cellBg,flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",gap:8},children:[k&&e.jsx("button",{onClick:i,style:Y(t),children:"Back"}),!k&&a==="connect"&&e.jsx("button",{onClick:()=>l(!0),style:Y(t),children:"Back"}),!k&&a!=="building"&&a!=="connect"&&e.jsx("button",{onClick:r,style:Y(t),children:"Save & close"}),!k&&a==="building"&&v&&e.jsx("button",{onClick:()=>void it(),style:Y(t),children:"Cancel job"})]}),e.jsx("span",{style:{flex:1,textAlign:"center",fontSize:11,color:t.textMuted,fontFamily:t.font},children:k?"~2 minute read — or skip straight to setup":"Setup is resumable — you can save and come back any time."}),e.jsxs("div",{style:{display:"flex",gap:8},children:[k&&e.jsx("button",{onClick:()=>l(!1),style:H(t),children:"Next — connect your dbt project"}),!k&&a==="connect"&&(P==null?void 0:P.code)==="DBT_MANIFEST_MISSING"&&e.jsx("button",{disabled:I,onClick:()=>void De(!0),style:Y(t),children:"Build artifacts with DQL"}),!k&&a==="connect"&&e.jsx("button",{disabled:I||(B==="repo"?!U.trim():!f.trim()),onClick:()=>void nt(),style:H(t,I||(B==="repo"?!U.trim():!f.trim())),children:I?"Inspecting…":(P==null?void 0:P.code)==="DBT_MANIFEST_MISSING"?"I ran dbt parse — retry":"Inspect artifacts"}),!k&&a==="inspect"&&e.jsx("button",{disabled:I,onClick:()=>void De(!1),style:H(t,I),children:I?"Building…":"Apply & build snapshot"}),!k&&a==="domains"&&!m&&e.jsx("button",{disabled:I,onClick:()=>{Q(null),ie(x)},style:H(t,I),children:I?"Discovering…":"Retry discovery"}),!k&&a==="domains"&&m&&(((Pe=C==null?void 0:C.preview)==null?void 0:Pe.length)??0)===0&&e.jsx("button",{disabled:I,onClick:()=>void Le("preview"),style:H(t,I),children:I?"Preparing preview…":ye>0?`Review ${ye} draft domain${ye===1?"":"s"}`:"Continue without domains"}),!k&&a==="domains"&&m&&(((We=C==null?void 0:C.preview)==null?void 0:We.length)??0)>0&&e.jsx("button",{disabled:I,onClick:()=>void Le("apply"),style:H(t,I),children:I?"Applying…":"Apply reviewed drafts"}),!k&&a==="domain-model"&&e.jsx("button",{onClick:()=>u("knowledge"),style:H(t),children:"Continue to knowledge"}),!k&&a==="knowledge"&&e.jsx("button",{onClick:()=>u("ready"),style:H(t),children:"Continue"}),!k&&a==="ready"&&e.jsx("button",{onClick:r,style:{...H(t),background:"var(--status-success)",borderColor:"var(--status-success)"},children:"Finish setup"})]})]})]})}function Ct({t}){const o=(p,S,f)=>e.jsxs("div",{style:{border:`1.5px solid ${S.border}`,borderRadius:10,background:S.bg,padding:"11px 10px",textAlign:"center",animation:"dql-setup-stage 0.5s ease-out both",animationDelay:`${p}s`,boxShadow:S.glow?"0 4px 18px rgba(107,93,211,0.12)":"none"},children:[e.jsx("div",{style:{width:26,height:26,borderRadius:7,background:S.iconBg,color:S.iconColor,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:f}),e.jsx("div",{style:{fontSize:12,fontWeight:700,color:t.textPrimary,marginTop:6},children:S.title}),e.jsx("div",{style:{fontSize:10,color:t.textMuted,lineHeight:1.45,marginTop:3},children:S.body})]}),i=e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",color:t.accent},children:e.jsxs("svg",{style:{animation:"dql-setup-arrow 1.6s ease-in-out infinite"},width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]})}),r=(p,S,f)=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,border:`1px solid ${(f==null?void 0:f.border)??t.cellBorder}`,background:(f==null?void 0:f.bg)??t.cellBg,borderRadius:999,padding:"4px 12px",fontSize:11.5,fontWeight:650,color:(f==null?void 0:f.color)??t.textSecondary},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:999,background:S}}),p]}),d=e.jsxs("svg",{style:{color:"var(--border-strong)"},width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]}),n=p=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:7,padding:"14px 0 10px"},children:[e.jsx("span",{style:{width:1.5,height:26,background:"linear-gradient(to bottom, transparent, var(--border-strong))"}}),e.jsx("span",{style:{fontSize:11.5,color:t.textMuted,fontStyle:"italic"},children:p}),e.jsx("span",{style:{width:1.5,height:26,background:"linear-gradient(to bottom, var(--border-strong), transparent)"}})]}),a=(p,S,f)=>e.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:11,background:t.cellBg,padding:"12px 14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,fontSize:12.5,fontWeight:700,color:t.textPrimary},children:[f,p]}),e.jsx("div",{style:{fontSize:11,color:t.textMuted,lineHeight:1.5,marginTop:4},children:S})]}),u=p=>e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"flex-start"},children:[e.jsx("svg",{style:{flexShrink:0,marginTop:3},width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"var(--status-success)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})}),e.jsx("span",{style:{fontSize:13,color:t.textSecondary,lineHeight:1.55},children:p})]});return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,animation:"dql-setup-fadein 0.25s ease-out",fontFamily:t.font},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.1fr 0.9fr",gap:28,alignItems:"center"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:7,border:"1px solid var(--status-info-border)",background:"var(--accent-dim)",borderRadius:999,padding:"4px 13px",fontSize:11,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",color:t.accent},children:"Welcome to DQL"}),e.jsxs("h1",{style:{margin:"12px 0 0",fontSize:27,fontWeight:700,letterSpacing:"-0.02em",color:t.textPrimary,lineHeight:1.25},children:["Analytics your AI",e.jsx("br",{}),"can't hallucinate"]}),e.jsxs("div",{style:{marginTop:14,display:"flex",flexDirection:"column",gap:9},children:[u("Sits on your dbt project — models and tests stay yours"),u(e.jsxs(e.Fragment,{children:["Questions route through ",e.jsx("strong",{children:"certified blocks"})," before AI writes SQL"]})),u("Every answer carries a trust label your stakeholders can read")]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,animation:"dql-setup-float 4s ease-in-out infinite"},children:[e.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:12,background:t.cellBg,padding:"12px 14px",boxShadow:"0 8px 28px rgba(26,26,26,0.06)"},children:[e.jsx("div",{style:{background:"var(--bg-0)",borderRadius:"12px 12px 3px 12px",padding:"7px 11px",fontSize:11.5,color:t.textPrimary,width:"fit-content",marginLeft:"auto"},children:"What was revenue last quarter?"}),e.jsxs("div",{style:{marginTop:9,display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontSize:10,fontWeight:700,color:"var(--status-success)",background:"var(--status-success-bg)",border:"1px solid var(--status-success-border)",borderRadius:999,padding:"1.5px 8px"},children:"Certified"}),e.jsx("span",{style:{fontSize:10,color:t.textMuted},children:"from total_revenue · 0.3s"})]}),e.jsxs("div",{style:{marginTop:6,fontSize:13,color:t.textPrimary},children:["Q2 revenue was ",e.jsx("strong",{children:"$4.82M"}),", up 6.4% from Q1."]})]}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:7,justifyContent:"flex-end",fontSize:10.5,color:t.textMuted,paddingRight:4},children:"Traceable from source table to this answer"})]})]}),e.jsxs("div",{style:{marginTop:14,display:"flex",alignItems:"baseline",gap:10},children:[e.jsx("span",{style:{fontSize:13,fontWeight:700,color:t.textMuted,fontFamily:t.fontMono},children:"01"}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:t.textPrimary,letterSpacing:"-0.01em"},children:"How a question becomes a trusted answer"}),e.jsx("div",{style:{fontSize:12,color:t.textMuted,marginTop:2},children:"Five stages, one direction — watch the flow."})]})]}),e.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:14,background:t.cellBg,padding:"22px 20px 16px"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 26px 1fr 26px 1fr 26px 1fr 26px 1fr",alignItems:"stretch"},children:[o(.1,{border:t.cellBorder,bg:t.appBg,iconBg:"rgba(74,116,201,0.12)",iconColor:"#4a74c9",title:"Sources & dbt",body:"Your warehouse and models — dbt keeps ownership"},e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),e.jsx("path",{d:"M3 5v14a9 3 0 0 0 18 0V5"}),e.jsx("path",{d:"M3 12a9 3 0 0 0 18 0"})]})),i,o(.35,{border:"rgba(10,107,94,0.3)",bg:"rgba(10,107,94,0.05)",iconBg:"rgba(10,107,94,0.12)",iconColor:"#0a6b5e",title:"Domains & modeling",body:"Business entities, proven joins, skills"},e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0z"}),e.jsx("path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3z"}),e.jsx("path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5z"})]})),i,o(.6,{border:"rgba(107,93,211,0.35)",bg:"var(--accent-dim)",iconBg:"rgba(107,93,211,0.14)",iconColor:t.accent,title:"Certified blocks",body:"Reusable governed answers — reviewed & certified",glow:!0},e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"13",y:"3",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"3",y:"13",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"13",y:"13",width:"8",height:"8",rx:"1.5"})]})),i,o(.85,{border:t.cellBorder,bg:t.appBg,iconBg:"rgba(178,107,31,0.12)",iconColor:"#b26b1f",title:"Ask & research",body:"Ask AI answers + SQL notebooks for deep dives"},e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z"})})),i,o(1.1,{border:"rgba(46,139,87,0.3)",bg:"rgba(46,139,87,0.05)",iconBg:"var(--status-success-bg)",iconColor:"var(--status-success)",title:"Generative apps",body:"Stakeholder apps built from certified blocks"},e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}),e.jsx("path",{d:"m3.3 7 8.7 5 8.7-5"}),e.jsx("path",{d:"M12 22V12"})]}))]}),e.jsxs("div",{style:{marginTop:14,display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{flex:1,height:5,borderRadius:999,background:"linear-gradient(90deg, rgba(74,116,201,0.35), rgba(10,107,94,0.4), rgba(107,93,211,0.5), rgba(178,107,31,0.4), rgba(46,139,87,0.45), rgba(74,116,201,0.35))",backgroundSize:"200% 100%",animation:"dql-setup-flowrail 5s linear infinite"}}),e.jsx("span",{style:{fontSize:10,color:t.textMuted,whiteSpace:"nowrap"},children:"Lineage — trace any number from source to app, across domains"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{flex:1,height:5,borderRadius:999,background:"repeating-linear-gradient(90deg, var(--border-strong) 0 14px, transparent 14px 20px)",animation:"dql-setup-gitdash 1.6s linear infinite"}}),e.jsx("span",{style:{fontSize:10,color:t.textMuted,whiteSpace:"nowrap"},children:"Everything Git-versioned — branch, review, approve like code"})]})]})]}),n("…and every good answer feeds the loop that makes the next one cheaper."),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10,justifyContent:"flex-end",textAlign:"right"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:t.textPrimary,letterSpacing:"-0.01em"},children:"Certify once, everyone reuses"}),e.jsx("div",{style:{fontSize:12,color:t.textMuted,marginTop:2},children:"The loop that grows trust — and cuts AI cost with every pass."})]}),e.jsx("span",{style:{fontSize:13,fontWeight:700,color:t.textMuted,fontFamily:t.fontMono},children:"02"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,flexWrap:"wrap",animation:"dql-setup-fadein 0.5s ease-out both",animationDelay:"1.3s"},children:[r("Research freely","#b26b1f",{color:"#b26b1f"}),d,r("Review together","var(--accent)",{color:"var(--accent)"}),d,r("Certify once","var(--status-success)",{border:"var(--status-success-border)",bg:"var(--status-success-bg)",color:"var(--status-success)"}),d,r("Everyone reuses — instantly","#4a74c9"),e.jsx("span",{style:{width:"100%",textAlign:"right",fontSize:11,color:t.textMuted,marginTop:2},children:"A certified block answers the same question forever — no regenerated SQL, no second review, no token bill."})]}),n("Which is why the numbers survive the hardest room in the company."),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10},children:[e.jsx("span",{style:{fontSize:13,fontWeight:700,color:t.textMuted,fontFamily:t.fontMono},children:"03"}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:t.textPrimary,letterSpacing:"-0.01em"},children:"Why it holds up in the boardroom"}),e.jsx("div",{style:{fontSize:12,color:t.textMuted,marginTop:2},children:"Four guarantees behind every number."})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(190px, 1fr))",gap:10,animation:"dql-setup-fadein 0.5s ease-out both",animationDelay:"1.5s"},children:[a("High confidence","Certified answers at stakeholder precision — every answer carries its trust label.",e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"var(--status-success)",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1 1 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}),e.jsx("path",{d:"m9 12 2 2 4-4"})]})),a("Lower AI cost","Reusable blocks answer repeat questions instantly — no regenerated SQL, no wasted tokens.",e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"13",y:"13",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"3",y:"13",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"13",y:"3",width:"8",height:"8",rx:"1.5"})]})),a("Git-versioned","Blocks, domains, and apps are files — branch, review, and approve like code.",e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#b26b1f",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"6",x2:"6",y1:"3",y2:"15"}),e.jsx("circle",{cx:"18",cy:"6",r:"3"}),e.jsx("circle",{cx:"6",cy:"18",r:"3"}),e.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]})),a("Full lineage","Trace any number from source table to app — including across domains.",e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#4a74c9",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"5",cy:"12",r:"2"}),e.jsx("circle",{cx:"19",cy:"5",r:"2"}),e.jsx("circle",{cx:"19",cy:"19",r:"2"}),e.jsx("path",{d:"M7 12l10-6M7 12l10 6"})]}))]})]})}function oe({title:t,description:o,t:i,children:r}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[e.jsxs("div",{children:[e.jsx("h3",{style:{margin:0,color:i.textPrimary,font:`600 15px ${i.font}`},children:t}),e.jsx("p",{style:{margin:"5px 0 0",color:i.textSecondary,font:`12px/1.5 ${i.font}`},children:o})]}),r]})}function ae({label:t,hint:o,t:i,children:r}){return e.jsxs("label",{style:{display:"block"},children:[e.jsx("span",{style:{display:"block",marginBottom:5,color:i.textSecondary,font:`600 11px ${i.font}`},children:t}),r,e.jsx("span",{style:{display:"block",marginTop:5,color:i.textMuted,font:`10px ${i.font}`},children:o})]})}function It({t}){return e.jsx(J,{t,title:"Read-only dbt ownership",body:"Models, columns, descriptions, tests, lineage, catalog types, and MetricFlow formulas stay in dbt. DQL stores sparse domains, bindings, relationship safety, contracts, skills, blocks, and evaluations."})}function J({title:t,body:o,t:i}){return e.jsxs("div",{style:{border:`1px solid ${i.cellBorder}`,background:i.inputBg,borderRadius:8,padding:"10px 12px",marginTop:10},children:[e.jsx("div",{style:{color:i.textPrimary,font:`600 11px ${i.font}`},children:t}),e.jsx("div",{style:{marginTop:3,color:i.textMuted,font:`11px/1.5 ${i.font}`},children:o})]})}function At({label:t,value:o,t:i}){return e.jsxs("div",{style:{border:`1px solid ${i.cellBorder}`,background:i.inputBg,borderRadius:8,padding:12},children:[e.jsx("div",{style:{color:i.textPrimary,font:`700 20px ${i.font}`},children:o}),e.jsx("div",{style:{color:i.textMuted,font:`11px ${i.font}`,textTransform:"capitalize"},children:t})]})}function me({label:t,value:o,required:i=!1,t:r}){return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"160px 1fr auto",gap:10,padding:"10px 12px",borderBottom:`1px solid ${r.cellBorder}`,color:r.textSecondary,font:`11px ${r.font}`},children:[e.jsx("strong",{style:{color:r.textPrimary},children:t}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:o}),e.jsx("span",{children:i?"Required":"Optional"})]})}function ve({text:t,t:o,tone:i}){const r=i==="warning"?o.warning:o.accent;return e.jsx("span",{style:{border:`1px solid ${r}55`,color:r,background:`${r}0d`,borderRadius:20,padding:"2px 7px",font:`600 9px ${o.font}`},children:t})}function Oe({items:t,t:o}){return e.jsx("div",{style:{display:"grid",gap:8},children:t.map(([i,r],d)=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"24px 1fr",gap:10,border:`1px solid ${o.cellBorder}`,borderRadius:8,padding:11},children:[e.jsx("span",{style:{width:22,height:22,display:"grid",placeItems:"center",borderRadius:"50%",background:`${o.accent}18`,color:o.accent,font:`600 10px ${o.font}`},children:d+1}),e.jsxs("div",{children:[e.jsx("strong",{style:{color:o.textPrimary,font:`600 12px ${o.font}`},children:i}),e.jsx("div",{style:{marginTop:2,color:o.textMuted,font:`11px/1.45 ${o.font}`},children:r})]})]},i))})}function ke({title:t,body:o,action:i,onClick:r,t:d}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",minHeight:145,border:`1px solid ${d.cellBorder}`,borderRadius:9,padding:13},children:[e.jsx("strong",{style:{color:d.textPrimary,font:`600 13px ${d.font}`},children:t}),e.jsx("div",{style:{flex:1,marginTop:6,color:d.textMuted,font:`11px/1.5 ${d.font}`},children:o}),e.jsx("button",{onClick:r,style:{...H(d),width:"100%",marginTop:12},children:i})]})}function H(t,o=!1){return{border:`1px solid ${t.accent}`,background:t.accent,color:"#fff",borderRadius:7,padding:"8px 14px",cursor:o?"not-allowed":"pointer",opacity:o?.55:1,font:`600 12px ${t.font}`}}function Y(t){return{border:`1px solid ${t.cellBorder}`,background:t.btnBg,color:t.textSecondary,borderRadius:7,padding:"8px 13px",cursor:"pointer",font:`500 12px ${t.font}`}}const Bt=[{id:"dbt",label:"dbt",description:"Connect a dbt project as the read-only source for models, schema, lineage, tests, catalog types, and MetricFlow.",icon:"dbt",color:"#ff694a"},{id:"cubejs",label:"Cube.js",description:"Import cubes, measures, dimensions, joins, and pre-aggregations from Cube.js.",icon:"cube",color:"#7a77ff"},{id:"snowflake",label:"Snowflake",description:"Introspect Snowflake semantic views and import metrics and dimensions.",icon:"snow",color:"#29b5e8"}];function qt({detectedProvider:t,onClose:o,onImported:i}){const{state:r,dispatch:d}=Be(),n=Ye[r.themeMode],[a,u]=c.useState("provider"),[p,S]=c.useState(null),[f,D]=c.useState(""),[b,E]=c.useState(""),[W,M]=c.useState(""),[B,T]=c.useState(""),[U,V]=c.useState(""),[L,_]=c.useState("local"),[O,G]=c.useState([]),[j,K]=c.useState(null),[v,X]=c.useState(!1),[m,Z]=c.useState(null),[C,N]=c.useState(null),[$,ee]=c.useState(null),[x,A]=c.useState(null),[I,F]=c.useState(null);c.useEffect(()=>{q.getConnections().then(l=>{l!=null&&l.connections&&G(Object.keys(l.connections))}).catch(()=>{})},[]);const te=()=>p?p==="snowflake"?{provider:p,connection:U||void 0}:L==="repo"?{provider:p,repoUrl:b,branch:W||void 0,subPath:B||void 0}:{provider:p,projectPath:f||void 0}:null,ge=async()=>{const l=te();if(l){X(!0),Z(null),N(null);try{const h=await q.previewSemanticImport(l);K(h),u("preview")}catch(h){let R={};try{R=JSON.parse(h.message)}catch{R={error:h.message}}Z(R.error??h.message??"Preview failed"),N(R.hint??null)}finally{X(!1)}}},re=async()=>{const l=te();if(l){u("importing"),A(null),F(null);try{const h=await q.importSemanticLayer(l);ee(h),u("done")}catch(h){let R={};try{R=JSON.parse(h.message)}catch{R={error:h.message}}A(R.error??h.message??"Import failed"),F(R.hint??null),u("preview")}}},Q=()=>{i(),o()},de=l=>{l.target===l.currentTarget&&o()};c.useEffect(()=>{const l=h=>{h.key==="Escape"&&o()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o]);const ne={background:n.inputBg,border:`1px solid ${n.inputBorder}`,borderRadius:6,color:n.textPrimary,fontSize:13,fontFamily:n.font,padding:"8px 12px",outline:"none",width:"100%",boxSizing:"border-box"},k={fontSize:12,fontWeight:500,color:n.textSecondary,fontFamily:n.font,marginBottom:4,display:"block"};return p==="dbt"&&a!=="provider"?e.jsx("div",{onClick:de,style:{position:"fixed",inset:0,background:n.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,backdropFilter:"blur(4px)"},children:e.jsx(St,{t:n,initialProjectDir:f,onBack:()=>u("provider"),onClose:o,onComplete:i,onOpen:l=>{if(o(),l==="block"){d({type:"SET_MAIN_VIEW",view:"block_studio"}),d({type:"OPEN_NEW_BLOCK_MODAL"});return}d({type:"SET_MAIN_VIEW",view:l})}})}):e.jsx("div",{onClick:de,style:{position:"fixed",inset:0,background:n.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,backdropFilter:"blur(4px)"},children:e.jsxs("div",{style:{background:n.modalBg,border:`1px solid ${n.cellBorder}`,borderRadius:12,width:560,maxWidth:"calc(100vw - 48px)",maxHeight:"calc(100vh - 80px)",display:"flex",flexDirection:"column",boxShadow:"0 20px 60px rgba(0,0,0,0.5)",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"20px 24px 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("h2",{style:{fontSize:16,fontWeight:600,color:n.textPrimary,fontFamily:n.font,margin:0},children:a==="done"?"Import Complete":"Set Up Semantic Layer"}),e.jsx("button",{onClick:o,style:{background:"transparent",border:"none",cursor:"pointer",color:n.textMuted,fontSize:18,lineHeight:1,padding:"2px 4px",borderRadius:4},children:"×"})]}),a!=="done"&&e.jsx("div",{style:{padding:"12px 24px 0",display:"flex",gap:4},children:["provider","configure","preview","importing"].map((l,h)=>e.jsx("div",{style:{flex:1,height:3,borderRadius:2,background:["provider","configure","preview","importing"].indexOf(a)>=h?n.accent:n.cellBorder,transition:"background 0.2s"}},l))}),e.jsxs("div",{style:{padding:"20px 24px 24px",flex:1,overflowY:"auto"},children:[a==="provider"&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("div",{style:{fontSize:13,color:n.textSecondary,fontFamily:n.font,lineHeight:1.5},children:"Connect dbt for the governed DQL 2.0 path, or import a supported external semantic provider."}),Bt.map(l=>{const h=t===l.id,R=p===l.id;return e.jsxs("button",{onClick:()=>S(l.id),style:{background:R?`${l.color}11`:n.inputBg,border:`2px solid ${R?l.color:n.cellBorder}`,borderRadius:10,padding:"14px 16px",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column",gap:4,transition:"border-color 0.15s, background 0.15s"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",background:l.color,flexShrink:0}}),e.jsx("span",{style:{fontSize:14,fontWeight:600,color:n.textPrimary,fontFamily:n.font},children:l.label}),h&&e.jsx("span",{style:{fontSize:10,fontWeight:600,color:l.color,fontFamily:n.font,background:`${l.color}18`,padding:"2px 8px",borderRadius:8,marginLeft:4},children:"Detected"})]}),e.jsx("span",{style:{fontSize:12,color:n.textMuted,fontFamily:n.font,lineHeight:1.4},children:l.description})]},l.id)})]}),a==="configure"&&p&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx("div",{style:{fontSize:13,color:n.textSecondary,fontFamily:n.font,lineHeight:1.5},children:p==="snowflake"?"Select the Snowflake connection to introspect semantic views.":`Configure the source for your ${p==="dbt"?"dbt":"Cube.js"} project.`}),p==="snowflake"?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsx("label",{style:k,children:"Connection"}),e.jsxs("select",{value:U,onChange:l=>V(l.target.value),style:ne,children:[e.jsx("option",{value:"",children:"Select a connection..."}),O.map(l=>e.jsx("option",{value:l,children:l},l))]}),O.length===0&&e.jsx("span",{style:{fontSize:11,color:n.warning??"#f0ad4e",fontFamily:n.font},children:"No connections configured. Set up a Snowflake connection first."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>_("local"),style:{background:L==="local"?n.accent:"transparent",color:L==="local"?"#fff":n.textSecondary,border:`1px solid ${L==="local"?n.accent:n.cellBorder}`,borderRadius:6,padding:"5px 14px",cursor:"pointer",fontSize:12,fontFamily:n.font,fontWeight:500},children:"Local Path"}),e.jsx("button",{onClick:()=>_("repo"),style:{background:L==="repo"?n.accent:"transparent",color:L==="repo"?"#fff":n.textSecondary,border:`1px solid ${L==="repo"?n.accent:n.cellBorder}`,borderRadius:6,padding:"5px 14px",cursor:"pointer",fontSize:12,fontFamily:n.font,fontWeight:500},children:"Git Repository"})]}),L==="local"?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsx("label",{style:k,children:"Project Path"}),e.jsx("input",{value:f,onChange:l=>D(l.target.value),placeholder:p==="dbt"?"../my-dbt-project":"../my-cube-project",style:ne}),e.jsx("span",{style:{fontSize:11,color:n.textMuted,fontFamily:n.font},children:p==="dbt"?"Path to the directory containing dbt_project.yml":"Path to the directory containing model/ or schema/"})]}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsx("label",{style:k,children:"Repository URL"}),e.jsx("input",{value:b,onChange:l=>E(l.target.value),placeholder:"https://github.com/org/repo",style:ne})]}),e.jsxs("div",{style:{display:"flex",gap:12},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[e.jsx("label",{style:k,children:"Branch"}),e.jsx("input",{value:W,onChange:l=>M(l.target.value),placeholder:"main",style:ne})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[e.jsx("label",{style:k,children:"Sub-path"}),e.jsx("input",{value:B,onChange:l=>T(l.target.value),placeholder:"optional/sub/dir",style:ne})]})]})]})]}),m&&e.jsxs("div",{style:{background:`${n.error}12`,border:`1px solid ${n.error}40`,borderRadius:8,padding:"10px 14px"},children:[e.jsx("div",{style:{fontSize:12,color:n.error,fontFamily:n.font,fontWeight:600,marginBottom:4},children:"Validation Failed"}),e.jsx("div",{style:{fontSize:12,color:n.textSecondary,fontFamily:n.font,lineHeight:1.4},children:m}),C&&e.jsx("div",{style:{fontSize:11,color:n.textMuted,fontFamily:n.font,marginTop:6,fontStyle:"italic"},children:C})]})]}),a==="preview"&&j&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx("div",{style:{fontSize:13,color:n.textSecondary,fontFamily:n.font,lineHeight:1.5},children:"Review what will be imported into your project."}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:10},children:Object.entries(j.counts).filter(([,l])=>l>0).map(([l,h])=>e.jsxs("div",{style:{background:n.inputBg,borderRadius:8,padding:"12px 14px",border:`1px solid ${n.cellBorder}`,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:22,fontWeight:700,color:n.accent,fontFamily:n.font},children:h}),e.jsxs("div",{style:{fontSize:11,color:n.textMuted,fontFamily:n.font,textTransform:"capitalize"},children:[l.replace("_","-"),"s"]})]},l))}),j.domains.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:n.textSecondary,fontFamily:n.font,marginBottom:6},children:"Domains"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:j.domains.map(l=>e.jsx("span",{style:{fontSize:11,fontFamily:n.font,background:n.pillBg,padding:"3px 10px",borderRadius:8,color:n.textSecondary},children:l},l))})]}),j.warnings.length>0&&e.jsxs("div",{style:{background:`${n.warning??"#f0ad4e"}12`,border:`1px solid ${n.warning??"#f0ad4e"}40`,borderRadius:8,padding:"10px 14px"},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:n.warning??"#f0ad4e",fontFamily:n.font,marginBottom:4},children:"Warnings"}),j.warnings.map((l,h)=>e.jsx("div",{style:{fontSize:12,color:n.textSecondary,fontFamily:n.font,lineHeight:1.4},children:l},h))]}),x&&e.jsxs("div",{style:{background:`${n.error}12`,border:`1px solid ${n.error}40`,borderRadius:8,padding:"10px 14px"},children:[e.jsx("div",{style:{fontSize:12,color:n.error,fontFamily:n.font,fontWeight:600,marginBottom:4},children:"Import Failed"}),e.jsx("div",{style:{fontSize:12,color:n.textSecondary,fontFamily:n.font,lineHeight:1.4},children:x}),I&&e.jsx("div",{style:{fontSize:11,color:n.textMuted,fontFamily:n.font,marginTop:6,fontStyle:"italic"},children:I})]})]}),a==="importing"&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"32px 0"},children:[e.jsx("div",{style:{width:40,height:40,borderRadius:"50%",border:`3px solid ${n.cellBorder}`,borderTopColor:n.accent,animation:"spin 0.8s linear infinite"}}),e.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"}),e.jsxs("div",{style:{fontSize:14,color:n.textSecondary,fontFamily:n.font},children:["Importing ",p," semantic layer..."]}),e.jsx("div",{style:{fontSize:12,color:n.textMuted,fontFamily:n.font},children:"Parsing models, writing YAML files, refreshing state"})]}),a==="done"&&$&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"12px 0"},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:36,height:36,borderRadius:"50%",background:`${n.success??"#28a745"}20`,color:n.success??"#28a745",fontSize:20,fontWeight:700},children:"✓"}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:14,fontWeight:600,color:n.textPrimary,fontFamily:n.font},children:"Semantic layer imported successfully"}),e.jsx("div",{style:{fontSize:12,color:n.textMuted,fontFamily:n.font},children:Object.entries($.counts).filter(([,l])=>l>0).map(([l,h])=>`${h} ${l.replace("_","-")}${h!==1?"s":""}`).join(", ")})]})]}),$.manifest.warnings.length>0&&e.jsx("div",{style:{background:`${n.warning??"#f0ad4e"}12`,border:`1px solid ${n.warning??"#f0ad4e"}40`,borderRadius:8,padding:"10px 14px"},children:$.manifest.warnings.map((l,h)=>e.jsx("div",{style:{fontSize:12,color:n.textSecondary,fontFamily:n.font},children:l},h))}),e.jsx("div",{style:{background:n.inputBg,borderRadius:8,padding:"12px 14px",border:`1px solid ${n.cellBorder}`,fontSize:12,color:n.textMuted,fontFamily:n.font,lineHeight:1.5},children:"Your semantic definitions are now available in the Semantic Layer browser. Use the Guided Builder or drag metrics into your editor to start creating blocks."})]})]}),e.jsxs("div",{style:{padding:"14px 24px",borderTop:`1px solid ${n.cellBorder}`,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("div",{children:a!=="provider"&&a!=="importing"&&a!=="done"&&e.jsx("button",{onClick:()=>{a==="configure"?u("provider"):a==="preview"&&u("configure")},style:{background:"transparent",border:`1px solid ${n.cellBorder}`,borderRadius:6,color:n.textSecondary,cursor:"pointer",fontSize:13,fontFamily:n.font,fontWeight:500,padding:"7px 16px"},children:"Back"})}),e.jsxs("div",{style:{display:"flex",gap:10},children:[a!=="importing"&&e.jsx("button",{onClick:o,style:{background:n.btnBg,border:`1px solid ${n.btnBorder}`,borderRadius:6,color:n.textSecondary,cursor:"pointer",fontSize:13,fontFamily:n.font,fontWeight:500,padding:"7px 16px"},children:"Cancel"}),a==="provider"&&e.jsx("button",{onClick:()=>p&&u("configure"),disabled:!p,style:{background:n.accent,border:`1px solid ${n.accent}`,borderRadius:6,color:"#fff",cursor:p?"pointer":"not-allowed",fontSize:13,fontFamily:n.font,fontWeight:500,padding:"7px 20px",opacity:p?1:.5},children:p==="dbt"?"Connect dbt":"Next"}),a==="configure"&&e.jsx("button",{onClick:ge,disabled:v,style:{background:n.accent,border:`1px solid ${n.accent}`,borderRadius:6,color:"#fff",cursor:v?"not-allowed":"pointer",fontSize:13,fontFamily:n.font,fontWeight:500,padding:"7px 20px",opacity:v?.6:1,display:"flex",alignItems:"center",gap:6},children:v?"Validating...":"Validate & Preview"}),a==="preview"&&e.jsx("button",{onClick:re,style:{background:n.accent,border:`1px solid ${n.accent}`,borderRadius:6,color:"#fff",cursor:"pointer",fontSize:13,fontFamily:n.font,fontWeight:500,padding:"7px 20px"},children:"Import"}),a==="done"&&e.jsx("button",{onClick:Q,style:{background:n.accent,border:`1px solid ${n.accent}`,borderRadius:6,color:"#fff",cursor:"pointer",fontSize:13,fontFamily:n.font,fontWeight:500,padding:"7px 20px"},children:"Open Semantic Browser"})]})]})]})})}const we=3;function zt({t,aiReady:o=!0,onSetupAi:i}){const{dispatch:r}=Be(),[d,n]=c.useState(null),[a,u]=c.useState(!0);c.useEffect(()=>{if(!o){u(!1);return}let D=!1;return u(!0),q.getProposeReadiness({limit:we}).then(b=>{D||n(b)}).catch(()=>{D||n(null)}).finally(()=>{D||u(!1)}),()=>{D=!0}},[o]);const p=c.useMemo(()=>d!=null&&d.ready?[...d.plan.domains.flatMap(b=>b.candidates)].sort((b,E)=>(E.score??0)-(b.score??0)).slice(0,we):[],[d]),S=c.useCallback(()=>{r({type:"SET_MAIN_VIEW",view:"readiness"})},[r]),f=c.useCallback(()=>{r({type:"SET_MAIN_VIEW",view:"block_studio"})},[r]);return o?e.jsxs("div",{style:_e(t),children:[e.jsx("style",{children:Ve}),e.jsxs("div",{style:Fe,children:[e.jsx("span",{style:Qe(t),children:e.jsx(Ie,{size:16,strokeWidth:2,"aria-hidden":"true"})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:14,fontWeight:760,color:t.textPrimary},children:"New here? Start with blocks DQL built for you"}),e.jsxs("p",{style:{margin:"3px 0 0",fontSize:12.5,lineHeight:1.5,color:t.textSecondary},children:["A ",e.jsx("strong",{children:"block"})," is a reusable piece of analytics — one trusted metric or query your whole team can reuse across answers and Apps. Here are a few important ones DQL drafted from your dbt models. Open ",e.jsx("em",{children:"See details"})," on each to understand exactly what it measures and the SQL behind it — then build your own."]})]})]}),a?e.jsx("div",{style:_t,children:Array.from({length:we}).map((D,b)=>e.jsx("div",{className:"dql-starter-skel",style:Ft(t)},b))}):p.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:Rt,children:p.map((D,b)=>e.jsx(Dt,{candidate:D,index:b,t},D.slug))}),e.jsxs("div",{style:He(t),children:[e.jsx("span",{style:{fontSize:12,color:t.textMuted},children:"Open a suggested block to edit it, or build one from scratch."}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsxs("button",{type:"button",onClick:S,style:Ue(t),children:["Open block suggestions",e.jsx(he,{size:14,strokeWidth:2.2,"aria-hidden":"true"})]}),e.jsxs("button",{type:"button",onClick:f,style:Se(t),children:[e.jsx(ue,{size:14,strokeWidth:2,"aria-hidden":"true"}),"Build my own"]})]})]})]}):e.jsxs("div",{style:Qt(t),children:[e.jsx(rt,{size:16,strokeWidth:2,"aria-hidden":"true",style:{flexShrink:0,marginTop:1,color:t.textMuted}}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("span",{style:{fontSize:12.5,color:t.textSecondary,lineHeight:1.5},children:d&&!d.ready&&d.reason?d.reason:"No starter blocks to suggest yet — connect a dbt project so DQL can read your models, or build your first block by hand to see how it works."}),e.jsxs("button",{type:"button",onClick:f,style:Se(t),children:[e.jsx(ue,{size:14,strokeWidth:2,"aria-hidden":"true"}),"Build a block in Block Studio"]})]})]})]}):e.jsxs("div",{style:_e(t),children:[e.jsx("style",{children:Ve}),e.jsxs("div",{style:Fe,children:[e.jsx("span",{style:Qe(t),children:e.jsx(Ie,{size:16,strokeWidth:2,"aria-hidden":"true"})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:14,fontWeight:760,color:t.textPrimary},children:"Turn on AI to generate starter blocks"}),e.jsxs("p",{style:{margin:"3px 0 0",fontSize:12.5,lineHeight:1.5,color:t.textSecondary},children:["Block suggestions are drafted by ",e.jsx("strong",{children:"your AI provider"})," from your dbt models and data — that's where the value is. Connect a provider (OpenAI, Anthropic, Gemini, or a local Ollama) and DQL will propose a few important blocks you can learn from and certify."]})]})]}),e.jsxs("div",{style:He(t),children:[e.jsx("span",{style:{fontSize:12,color:t.textMuted},children:"AI also powers governed answers and research — it's the heart of DQL."}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[i?e.jsxs("button",{type:"button",onClick:i,style:Ue(t),children:["Connect an AI provider",e.jsx(he,{size:14,strokeWidth:2.2,"aria-hidden":"true"})]}):null,e.jsxs("button",{type:"button",onClick:f,style:Se(t),children:[e.jsx(ue,{size:14,strokeWidth:2,"aria-hidden":"true"}),"Build one by hand"]})]})]})]})}function Dt({candidate:t,index:o,t:i}){const[r,d]=c.useState(!1),[n,a]=c.useState(null),[u,p]=c.useState(!1),[S,f]=c.useState(null),D=c.useCallback(()=>{d(M=>{const B=!M;return B&&!n&&!u&&(p(!0),f(null),q.proposePreview(t.slug).then(T=>a(T.candidate)).catch(T=>f(T instanceof Error?T.message:"Could not load the details.")).finally(()=>p(!1))),B})},[t.slug,n,u]),b=n??t,E=t.evidence.slice(0,2).join(" · "),W=t.description||E||"A governed metric drafted from your dbt model.";return e.jsxs("div",{className:"dql-starter-card",style:{...Tt(i),animationDelay:`${o*70}ms`},children:[e.jsxs("button",{type:"button",onClick:D,"aria-expanded":r,style:Mt,children:[e.jsx("span",{style:$t(i),children:o+1}),e.jsxs("span",{style:{display:"grid",gap:4,minWidth:0,flex:1,textAlign:"left"},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:7,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:720,color:i.textPrimary},children:t.model}),e.jsx(xt,{state:"ai_generated"}),t.pattern?e.jsx("span",{style:Nt(i),children:t.pattern}):null,t.grain?e.jsxs("span",{style:{fontSize:11,color:i.textMuted},children:["grain ",t.grain]}):null]}),e.jsx("span",{style:{fontSize:12,color:i.textSecondary,lineHeight:1.45},children:W})]}),e.jsxs("span",{style:Pt(i),children:[r?e.jsx(st,{size:13,strokeWidth:2.2}):e.jsx(at,{size:13,strokeWidth:2.2}),r?"Hide":"See details"]})]}),r?e.jsx("div",{style:Wt(i),children:u?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:i.textMuted},children:[e.jsx(lt,{size:13,className:"dql-starter-spin"})," Loading the SQL and what it measures…"]}):S?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:i.warning},children:[e.jsx(Ke,{size:14})," ",S]}):e.jsxs(e.Fragment,{children:[b.description?e.jsx(xe,{label:"What it is",t:i,children:e.jsx("span",{style:{fontSize:12.5,color:i.textSecondary,lineHeight:1.5},children:b.description})}):null,(b.outputs??[]).length>0?e.jsx(xe,{label:"What it measures",t:i,children:e.jsx("span",{style:{display:"flex",flexWrap:"wrap",gap:5},children:b.outputs.map(M=>e.jsx("span",{style:Et(i),children:M},M))})}):null,(b.examples??[]).length>0?e.jsx(xe,{label:"Answers questions like",t:i,children:e.jsx("ul",{style:{margin:0,padding:"0 0 0 16px",display:"grid",gap:3},children:b.examples.slice(0,3).map(M=>e.jsx("li",{style:{fontSize:12,color:i.textSecondary,lineHeight:1.45},children:M},M))})}):null,e.jsx(xe,{label:"The SQL behind it",t:i,children:b.sqlPreview?e.jsx("pre",{style:Ot(i),children:e.jsx("code",{style:{fontFamily:i.fontMono,fontSize:11.5,whiteSpace:"pre-wrap",wordBreak:"break-word",color:i.textPrimary},children:b.sqlPreview.trim()})}):e.jsx("span",{style:{fontSize:11.5,color:i.textMuted},children:"SQL preview is not available for this model yet."})}),e.jsx(Lt,{verdict:b.certifierVerdict,t:i})]})}):null]})}function xe({label:t,children:o,t:i}){return e.jsxs("div",{style:{display:"grid",gap:5},children:[e.jsx("span",{style:{fontSize:9.5,fontWeight:800,letterSpacing:"0.05em",textTransform:"uppercase",color:i.textMuted},children:t}),o]})}function Lt({verdict:t,t:o}){const i=!!(t!=null&&t.ready&&t.blocking.length===0);return e.jsx(xe,{label:"Can you trust it",t:o,children:i?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,color:o.success},children:[e.jsx(dt,{size:14})," Grain, outputs, and context are set — ready to certify."]}):e.jsxs("span",{style:{display:"inline-flex",alignItems:"flex-start",gap:6,fontSize:12,color:o.warning,lineHeight:1.45},children:[e.jsx(Ke,{size:14,style:{flexShrink:0,marginTop:1}}),"An AI draft — a person reviews and certifies it before your team relies on it. That review step is what makes a block trustworthy."]})})}const _e=t=>({border:`1px solid ${t.cellBorder}`,borderRadius:12,background:t.cellBg,padding:16,display:"grid",gap:14}),Fe={display:"flex",gap:11,alignItems:"flex-start"},Qe=t=>({flex:"none",width:32,height:32,borderRadius:9,display:"inline-flex",alignItems:"center",justifyContent:"center",background:`${t.accent}18`,color:t.accent}),Rt={display:"grid",gap:8},Tt=t=>({border:`1px solid ${t.cellBorder}`,borderLeft:`3px solid ${t.accent}`,borderRadius:9,background:t.appBg,overflow:"hidden"}),Mt={width:"100%",display:"flex",gap:11,alignItems:"flex-start",padding:11,border:"none",background:"transparent",cursor:"pointer",textAlign:"left"},$t=t=>({flex:"none",width:20,height:20,borderRadius:6,display:"inline-flex",alignItems:"center",justifyContent:"center",background:`${t.accent}18`,color:t.accent,fontSize:11,fontWeight:800,marginTop:1}),Pt=t=>({display:"inline-flex",alignItems:"center",gap:4,flexShrink:0,padding:"5px 9px",borderRadius:6,border:`1px solid ${t.cellBorder}`,background:t.cellBg,color:t.textSecondary,fontSize:11,fontWeight:650,whiteSpace:"nowrap",alignSelf:"flex-start"}),Wt=t=>({borderTop:`1px solid ${t.cellBorder}`,padding:"11px 11px 12px 42px",display:"grid",gap:11}),Nt=t=>({fontSize:10,padding:"2px 7px",borderRadius:4,background:`${t.textMuted}1f`,color:t.textSecondary,fontWeight:600}),Et=t=>({fontSize:11,fontWeight:600,padding:"3px 8px",borderRadius:6,border:`1px solid ${t.cellBorder}`,background:t.cellBg,color:t.textSecondary,fontFamily:t.fontMono}),Ot=t=>({margin:0,border:`1px solid ${t.cellBorder}`,borderRadius:8,background:t.inputBg,padding:"9px 11px",overflow:"auto",maxHeight:240}),He=t=>({display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap",borderTop:`1px solid ${t.cellBorder}`,paddingTop:12}),Ue=t=>Je(t,{variant:"primary",size:"md"}),Se=t=>Je(t,{variant:"ghost",size:"md"}),_t={display:"grid",gap:8},Ft=t=>({height:56,borderRadius:9,border:`1px solid ${t.cellBorder}`,background:t.appBg}),Qt=t=>({display:"flex",gap:10,alignItems:"flex-start",border:`1px dashed ${t.cellBorder}`,borderRadius:9,padding:14,background:t.appBg}),Ve=`
9
14
  @keyframes dql-starter-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
10
15
  .dql-starter-card { animation: dql-starter-rise 360ms cubic-bezier(0.2,0.7,0.2,1) both; }
11
16
  .dql-starter-card:hover { border-color: var(--color-accent-blue, #2563eb); }
@@ -16,7 +21,7 @@ import{r as c,a as q,j as e,u as Be,t as Ye,S as Ie,B as ue,C as ot,c as Je,b as
16
21
  @media (prefers-reduced-motion: reduce) {
17
22
  .dql-starter-card, .dql-starter-skel, .dql-starter-spin { animation: none !important; }
18
23
  }
19
- `,Ft=[["dql-manifest.json","Compiled project graph for lineage, trust, Apps, and AI context."],["semantic-layer/","Imported or authored metrics, dimensions, models, and saved queries."],["connections","Warehouse credentials and schema status for executing blocks."],["blocks/","Reusable DQL blocks built from dbt objects, SQL, tables, or semantic metrics."],["notebooks/","Analysis workspaces where users explore, edit, and assemble blocks."],["apps/","Published consumption surfaces for stakeholders."]];function sn(){var ee;const{state:t,dispatch:o}=Be(),i=Ye[t.themeMode],r=Gt(t.files),d=Yt(t.semanticLayer),n=t.blockStudioDbtStatus,a={models:Math.max(d.models,(n==null?void 0:n.counts.semanticModels)??0,(n==null?void 0:n.counts.models)??0),metrics:Math.max(d.metrics,(n==null?void 0:n.counts.metrics)??0),dimensions:d.dimensions,savedQueries:Math.max(d.savedQueries,(n==null?void 0:n.counts.savedQueries)??0)},u=Jt(t.schemaTables),[p,S]=c.useState(null),[f,D]=c.useState(!1),[b,E]=c.useState(!1),[W,$]=c.useState(null);c.useEffect(()=>{let x=!1;return q.getConnections().then(A=>{x||S(A)}),q.getProviderSettings().then(A=>{x||D(A.providers.some(I=>I.enabled&&I.configured))}).catch(()=>{}),q.getBlockStudioDbtStatus().then(A=>{x||o({type:"SET_BLOCK_STUDIO_DBT_STATUS",status:A})}).catch(()=>{x||o({type:"SET_BLOCK_STUDIO_DBT_STATUS",status:null})}),o({type:"SET_SEMANTIC_LOADING",loading:!0}),q.getSemanticLayer().then(A=>{x||o({type:"SET_SEMANTIC_LAYER",layer:A})}).finally(()=>{x||o({type:"SET_SEMANTIC_LOADING",loading:!1})}),o({type:"SET_APPS_LOADING",loading:!0}),q.listApps().then(A=>{x||o({type:"SET_APPS",apps:A})}).catch(()=>{x||o({type:"SET_APPS",apps:[]})}).finally(()=>{x||o({type:"SET_APPS_LOADING",loading:!1})}),()=>{x=!0}},[o]);const B=Object.keys((p==null?void 0:p.connections)??{}).length,T=((ee=p==null?void 0:p.dbtProfiles)==null?void 0:ee.length)??0,V=!!(n!=null&&n.artifacts.manifest.exists||n!=null&&n.artifacts.semanticManifest.exists)||t.semanticLayer.available||d.total>0||r.blocks>0,L=B>0||t.schemaTables.length>0,_=r.blocks>0,O=r.notebooks>0,G=t.apps.length>0,j=V?L?_?"notebook":"build":"connection":"source",K=x=>{o({type:"SET_SIDEBAR_PANEL",panel:x})},v=x=>{o({type:"SET_SETTINGS_TAB",tab:x}),o({type:"SET_MAIN_VIEW",view:"settings"})},X=async()=>{o({type:"SET_SEMANTIC_LOADING",loading:!0});try{const[x,A]=await Promise.all([q.getSemanticLayer(),q.listNotebooks()]);o({type:"SET_SEMANTIC_LAYER",layer:x}),o({type:"SET_FILES",files:A})}finally{o({type:"SET_SEMANTIC_LOADING",loading:!1})}},m=c.useMemo(()=>[{id:"source",number:"1",title:"Connect dbt and compile context",body:"Start with the dbt repo or semantic source. Import models, metrics, dimensions, and compile the local manifest context that DQL uses for lineage and AI.",state:V?"ready":j==="source"?"active":"waiting",Icon:Ne,primaryLabel:V?"Refresh semantic import":"Connect dbt repo",onPrimary:()=>E(!0),secondaryLabel:"Browse lineage",onSecondary:()=>K("lineage"),evidence:[`${a.models} semantic models`,`${a.metrics} metrics`,`${a.dimensions} dimensions`,`${r.blocks+r.businessViews} DQL artifacts`]},{id:"connection",number:"2",title:"Connect database and test access",body:"Use dbt profiles.yml where your runtime already resolves it, or enter warehouse credentials directly. Test the connection and refresh schema before building blocks.",state:L?"ready":j==="connection"?"active":"waiting",Icon:be,primaryLabel:L?"Manage connections":"Add database connection",onPrimary:()=>v("database"),secondaryLabel:"Open connections",onSecondary:()=>v("database"),evidence:[`${B} connection${B===1?"":"s"}`,`${T} dbt profile target${T===1?"":"s"}`,`${u.tables} tables`,`${u.columns} columns`]},{id:"ai",number:"3",title:"Connect an AI provider (optional)",body:"AI powers governed Ask and assisted authoring. Without it, SQL execution, dbt metadata, lineage, deterministic helpers, and other non-AI paths remain available.",state:f?"ready":"optional",Icon:Ie,primaryLabel:f?"Manage AI providers":"Connect AI provider",onPrimary:()=>v("ai"),secondaryLabel:"Open settings",onSecondary:()=>v("ai"),evidence:[f?"Provider configured — test in Settings to verify":"Optional · limited-AI mode"]},{id:"build",number:"4",title:"Build governed blocks",body:"Build reviewed reusable DQL blocks from dbt and semantic context. Use AI suggestions when configured, or work deterministically in Block Studio.",state:_?"ready":j==="build"?"active":"waiting",Icon:ue,primaryLabel:_?"Open block suggestions":"Suggest blocks with AI",onPrimary:()=>o({type:"SET_MAIN_VIEW",view:"readiness"}),secondaryLabel:"Open Block Studio",onSecondary:()=>o({type:"SET_MAIN_VIEW",view:"block_studio"}),evidence:[`${r.blocks} blocks`,`${r.terms} business terms`,`${r.businessViews} business views`]},{id:"notebook",number:"5",title:"Analyze in notebooks and publish to Apps",body:"Search, add, and edit notebooks around reviewed blocks. When the answer is ready, promote it into an App for stakeholder consumption.",state:O||G?"ready":j==="notebook"?"active":"waiting",Icon:Ee,primaryLabel:O?"Open notebooks":"Create notebook",onPrimary:()=>{O?K("files"):o({type:"OPEN_NEW_NOTEBOOK_MODAL"})},secondaryLabel:G?"Open Apps":"Build App",onSecondary:()=>K("apps"),evidence:[`${r.notebooks} notebooks`,`${t.apps.length} apps`,`${t.apps.reduce((x,A)=>x+A.dashboards.length,0)} dashboards`]}],[f,G,B,L,r.blocks,r.businessViews,r.notebooks,r.terms,j,_,T,O,u.columns,u.tables,a.dimensions,a.metrics,V,t.apps]),Z=m.filter(x=>x.state==="ready"||x.state==="optional").length,C=m.find(x=>x.id===j)??m[0],N=m.find(x=>x.id===W)??C,M=m.every(x=>x.state==="ready"||x.state==="optional");return e.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:i.appBg},children:[e.jsx("style",{children:Kt}),e.jsxs("main",{className:"dql-home-page",children:[e.jsxs("section",{className:"dql-home-hero dql-home-fade",style:{animationDelay:"0ms"},children:[e.jsxs("div",{className:"dql-home-hero-copy",children:[e.jsxs("div",{className:"dql-home-brand-row",children:[e.jsx("span",{className:"dql-home-logo",children:"DQL"}),e.jsx("span",{style:{color:i.textMuted},children:"Guided setup"})]}),e.jsx("h1",{style:{color:i.textPrimary},children:M?"Your workspace is ready":"Set up your analytics workspace"}),e.jsx("p",{className:"dql-home-lead",style:{color:i.textSecondary},children:M?"Source, database, blocks, notebooks and Apps are all connected. Jump back into building.":"Connect your data, build reviewed DQL blocks, then deliver with notebooks and Apps."}),e.jsx("div",{className:"dql-home-cta-row",children:e.jsxs("button",{className:"dql-home-primary-btn",onClick:C.onPrimary,children:[e.jsx(C.Icon,{size:15,strokeWidth:2.2,"aria-hidden":"true"}),C.primaryLabel,e.jsx(he,{size:15,strokeWidth:2.2,"aria-hidden":"true"})]})})]}),e.jsxs("div",{className:"dql-home-progress-badge",style:{borderColor:i.cellBorder,background:i.inputBg},children:[e.jsx(Ut,{ready:Z,total:m.length,t:i}),e.jsxs("div",{children:[e.jsxs("strong",{style:{color:i.textPrimary},children:[Z," of ",m.length," satisfied"]}),e.jsx("span",{style:{color:i.textMuted},children:M?"All set up":Vt(j)})]})]})]}),e.jsx("section",{className:"dql-home-stepper dql-home-fade","aria-label":"DQL setup steps",style:{animationDelay:"60ms"},children:m.map((x,A)=>e.jsx(Qt,{step:x,index:A,total:m.length,selected:(N==null?void 0:N.id)===x.id,t:i,onSelect:()=>$(x.id)},x.id))}),N&&e.jsx("section",{className:"dql-home-fade",style:{animationDelay:"120ms"},children:e.jsx(Ht,{step:N,t:i})}),(N==null?void 0:N.id)==="build"&&!_&&e.jsx("section",{className:"dql-home-fade",style:{animationDelay:"150ms"},children:e.jsx(Bt,{t:i,aiReady:f,onSetupAi:()=>v("ai")})}),e.jsxs("section",{className:"dql-home-metrics dql-home-fade",style:{animationDelay:"180ms"},children:[e.jsx(pe,{label:"Blocks",value:r.blocks,Icon:ue,t:i}),e.jsx(pe,{label:"Notebooks",value:r.notebooks,Icon:Ee,t:i}),e.jsx(pe,{label:"Apps",value:t.apps.length,Icon:ut,t:i}),e.jsx(pe,{label:"Tables",value:u.tables,Icon:be,t:i}),e.jsx(pe,{label:"Metrics",value:a.metrics,Icon:dt,t:i})]}),e.jsxs("details",{className:"dql-home-details dql-home-fade",style:{animationDelay:"240ms",borderColor:i.cellBorder,background:i.cellBg},children:[e.jsxs("summary",{style:{color:i.textSecondary},children:[e.jsx("span",{children:"Project details"}),e.jsx("span",{className:"dql-home-details-hint",style:{color:i.textMuted},children:"catalog, schema, and artifacts"})]}),e.jsxs("div",{className:"dql-home-details-body",children:[e.jsxs("div",{className:"dql-home-context-grid",children:[e.jsx(Ce,{title:"Source objects",description:"Trusted inputs from dbt and semantic imports.",Icon:Ne,t:i,rows:[["dbt project",(n==null?void 0:n.projectName)??(n!=null&&n.configured?"Configured":"Not detected")],["manifest.json",Ge(n==null?void 0:n.artifacts.manifest)],["semantic_manifest.json",Ge(n==null?void 0:n.artifacts.semanticManifest)],["Semantic models",String(a.models)],["Metrics",String(a.metrics)],["Dimensions",String(a.dimensions)]],actionLabel:"Connect or refresh",onAction:()=>E(!0)}),e.jsx(Ce,{title:"Database catalog",description:"Connection and schema determine whether blocks run.",Icon:be,t:i,rows:[["Default connection",(p==null?void 0:p.default)??"Unknown"],["Connection profiles",String(B)],["dbt profile targets",String(T)],["Schemas",String(u.schemas)],["Tables",String(u.tables)],["Columns",String(u.columns)]],actionLabel:"Open connections",onAction:()=>K("connection")}),e.jsx(Ce,{title:"Authoring inventory",description:"Versioned files that move into notebooks and Apps.",Icon:ct,t:i,rows:[["Blocks",String(r.blocks)],["Business terms",String(r.terms)],["Business views",String(r.businessViews)],["Notebooks",String(r.notebooks)],["Apps",String(t.apps.length)]],actionLabel:"Open Block Studio",onAction:()=>o({type:"SET_MAIN_VIEW",view:"block_studio"})})]}),e.jsx("div",{className:"dql-home-artifact-list",children:Ft.map(([x,A])=>e.jsxs("div",{className:"dql-home-artifact-row",style:{borderColor:i.cellBorder},children:[e.jsx("code",{style:{color:i.textPrimary},children:x}),e.jsx("span",{style:{color:i.textSecondary},children:A})]},x))})]})]})]}),b&&e.jsx(At,{detectedProvider:t.semanticLayer.provider,onClose:()=>E(!1),onImported:()=>void X()})]})}const le="var(--color-accent-green, #16a34a)";function Ae(t,o){return t==="ready"?le:t==="active"?o.warning:t==="optional"?o.accent:o.textMuted}function Qt({step:t,index:o,total:i,selected:r,t:d,onSelect:n}){const a=t.Icon,u=t.state==="ready"?{background:le,borderColor:le,color:"#fff"}:t.state==="active"?{background:d.cellBg,borderColor:d.warning,color:d.warning}:{background:d.cellBg,borderColor:d.cellBorder,color:d.textMuted};return e.jsxs("button",{type:"button",className:`dql-home-node is-${t.state} ${r?"is-selected":""}`,onClick:n,style:{color:d.textSecondary,background:r?d.cellBg:"transparent"},children:[o<i-1?e.jsx("span",{className:"dql-home-node-track","aria-hidden":"true",style:{background:t.state==="ready"?le:d.cellBorder}}):null,e.jsx("span",{className:"dql-home-node-badge","aria-hidden":"true",style:u,children:t.state==="ready"?e.jsx(pt,{size:18,strokeWidth:3}):e.jsx(a,{size:18,strokeWidth:2})}),e.jsxs("span",{className:"dql-home-node-meta",children:[e.jsx("span",{className:"dql-home-node-title",style:{color:d.textPrimary},children:t.title.split(" ").slice(0,3).join(" ")}),e.jsx("span",{className:"dql-home-node-status",style:{color:Ae(t.state,d)},children:Ze(t.state)})]})]})}function Ht({step:t,t:o}){const i=t.Icon;return e.jsxs("article",{className:`dql-home-focus is-${t.state}`,style:{borderColor:t.state==="active"?o.warning:t.state==="ready"?`${le}`:o.cellBorder,background:o.cellBg},children:[e.jsx("div",{className:"dql-home-focus-icon",style:{background:`${o.accent}16`,color:o.accent},children:e.jsx(i,{size:20,strokeWidth:2,"aria-hidden":"true"})}),e.jsxs("div",{className:"dql-home-focus-body",children:[e.jsxs("div",{className:"dql-home-focus-head",children:[e.jsx("h2",{style:{color:o.textPrimary},children:t.title}),e.jsx("span",{className:"dql-home-status",style:{color:Ae(t.state,o),background:`${Ae(t.state,o)}1f`},children:Ze(t.state)})]}),e.jsx("p",{style:{color:o.textSecondary},children:t.body}),e.jsx("div",{className:"dql-home-evidence",children:t.evidence.map(r=>e.jsx("span",{style:{borderColor:o.cellBorder,color:o.textMuted},children:r},r))}),e.jsxs("div",{className:"dql-home-card-actions",children:[e.jsxs("button",{className:"dql-home-primary-btn dql-home-card-btn",onClick:t.onPrimary,children:[t.primaryLabel,e.jsx(he,{size:15,strokeWidth:2.2,"aria-hidden":"true"})]}),t.secondaryLabel&&t.onSecondary&&e.jsx("button",{className:"dql-home-secondary-btn dql-home-card-btn",onClick:t.onSecondary,children:t.secondaryLabel})]})]})]})}function pe({label:t,value:o,Icon:i,t:r}){return e.jsxs("div",{className:"dql-home-metric",style:{borderColor:r.cellBorder,background:r.cellBg},children:[e.jsx("span",{className:"dql-home-metric-icon",style:{color:r.accent},children:e.jsx(i,{size:15,strokeWidth:2,"aria-hidden":"true"})}),e.jsx("strong",{style:{color:r.textPrimary},children:o.toLocaleString()}),e.jsx("span",{style:{color:r.textMuted},children:t})]})}function Ut({ready:t,total:o,t:i}){const r=o>0?t/o:0,d=16,n=2*Math.PI*d;return e.jsxs("svg",{className:"dql-home-ring",width:44,height:44,viewBox:"0 0 44 44","aria-hidden":"true",children:[e.jsx("circle",{cx:"22",cy:"22",r:d,fill:"none",stroke:i.cellBorder,strokeWidth:"4"}),e.jsx("circle",{cx:"22",cy:"22",r:d,fill:"none",stroke:le,strokeWidth:"4",strokeLinecap:"round",strokeDasharray:n,strokeDashoffset:n*(1-r),transform:"rotate(-90 22 22)",style:{transition:"stroke-dashoffset 700ms ease"}}),e.jsx("text",{x:"22",y:"26",textAnchor:"middle",fontSize:"12",fontWeight:"800",fill:i.textPrimary,children:t})]})}function Vt(t){return t==="source"?"Connect a dbt or semantic source":t==="connection"?"Add and test a database":t==="ai"?"Connect an AI provider":t==="build"?"Build your first DQL block":"Open notebooks and publish an App"}function Ce({title:t,description:o,Icon:i,rows:r,actionLabel:d,onAction:n,t:a}){return e.jsxs("section",{className:"dql-home-context-panel",style:{borderColor:a.cellBorder,background:a.cellBg},children:[e.jsxs("div",{className:"dql-home-context-head",children:[e.jsx("div",{className:"dql-home-context-icon",style:{background:`${a.accent}18`,color:a.accent},children:e.jsx(i,{size:18,strokeWidth:2,"aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("h2",{style:{color:a.textPrimary},children:t}),e.jsx("p",{style:{color:a.textSecondary},children:o})]})]}),e.jsx("div",{className:"dql-home-context-rows",children:r.map(([u,p])=>e.jsxs("div",{className:"dql-home-context-row",style:{borderColor:a.cellBorder},children:[e.jsx("span",{style:{color:a.textMuted},children:u}),e.jsx("strong",{style:{color:a.textPrimary},children:p})]},u))}),e.jsxs("button",{className:"dql-home-link-btn",onClick:n,children:[d,e.jsx(he,{size:15,strokeWidth:2,"aria-hidden":"true"})]})]})}function Ze(t){return t==="ready"?"Ready":t==="active"?"Next":t==="optional"?"Optional":"Waiting"}function Ge(t){return t?t.exists?typeof t.count=="number"?`Ready (${t.count})`:"Ready":"Missing":"Unknown"}function Gt(t){return t.reduce((o,i)=>(i.type==="block"?o.blocks+=1:i.type==="term"?o.terms+=1:i.type==="business_view"?o.businessViews+=1:(i.type==="notebook"||i.type==="workbook")&&(o.notebooks+=1),o),{notebooks:0,blocks:0,terms:0,businessViews:0})}function Yt(t){const o=t.metrics.length,i=t.measures.length,r=t.dimensions.length+t.timeDimensions.length,d=t.semanticModels.length,n=t.savedQueries.length;return{metrics:o,measures:i,dimensions:r,models:d,savedQueries:n,total:o+i+r+d+n+t.entities.length+t.hierarchies.length}}function Jt(t){const o=new Set;let i=0;for(const r of t){const[d,...n]=r.name.split(".");o.add(n.length>0?d:"default"),i+=r.columns.length}return{schemas:o.size,tables:t.length,columns:i}}const Kt=`
24
+ `,Ht=[["dql-manifest.json","Compiled project graph for lineage, trust, Apps, and AI context."],["semantic-layer/","Imported or authored metrics, dimensions, models, and saved queries."],["connections","Warehouse credentials and schema status for executing blocks."],["blocks/","Reusable DQL blocks built from dbt objects, SQL, tables, or semantic metrics."],["notebooks/","Analysis workspaces where users explore, edit, and assemble blocks."],["apps/","Published consumption surfaces for stakeholders."]];function ln(){var ee;const{state:t,dispatch:o}=Be(),i=Ye[t.themeMode],r=Jt(t.files),d=Kt(t.semanticLayer),n=t.blockStudioDbtStatus,a={models:Math.max(d.models,(n==null?void 0:n.counts.semanticModels)??0,(n==null?void 0:n.counts.models)??0),metrics:Math.max(d.metrics,(n==null?void 0:n.counts.metrics)??0),dimensions:d.dimensions,savedQueries:Math.max(d.savedQueries,(n==null?void 0:n.counts.savedQueries)??0)},u=Xt(t.schemaTables),[p,S]=c.useState(null),[f,D]=c.useState(!1),[b,E]=c.useState(!1),[W,M]=c.useState(null);c.useEffect(()=>{let x=!1;return q.getConnections().then(A=>{x||S(A)}),q.getProviderSettings().then(A=>{x||D(A.providers.some(I=>I.enabled&&I.configured))}).catch(()=>{}),q.getBlockStudioDbtStatus().then(A=>{x||o({type:"SET_BLOCK_STUDIO_DBT_STATUS",status:A})}).catch(()=>{x||o({type:"SET_BLOCK_STUDIO_DBT_STATUS",status:null})}),o({type:"SET_SEMANTIC_LOADING",loading:!0}),q.getSemanticLayer().then(A=>{x||o({type:"SET_SEMANTIC_LAYER",layer:A})}).finally(()=>{x||o({type:"SET_SEMANTIC_LOADING",loading:!1})}),o({type:"SET_APPS_LOADING",loading:!0}),q.listApps().then(A=>{x||o({type:"SET_APPS",apps:A})}).catch(()=>{x||o({type:"SET_APPS",apps:[]})}).finally(()=>{x||o({type:"SET_APPS_LOADING",loading:!1})}),()=>{x=!0}},[o]);const B=Object.keys((p==null?void 0:p.connections)??{}).length,T=((ee=p==null?void 0:p.dbtProfiles)==null?void 0:ee.length)??0,V=!!(n!=null&&n.artifacts.manifest.exists||n!=null&&n.artifacts.semanticManifest.exists)||t.semanticLayer.available||d.total>0||r.blocks>0,L=B>0||t.schemaTables.length>0,_=r.blocks>0,O=r.notebooks>0,G=t.apps.length>0,j=V?L?_?"notebook":"build":"connection":"source",K=x=>{o({type:"SET_SIDEBAR_PANEL",panel:x})},v=x=>{o({type:"SET_SETTINGS_TAB",tab:x}),o({type:"SET_MAIN_VIEW",view:"settings"})},X=async()=>{o({type:"SET_SEMANTIC_LOADING",loading:!0});try{const[x,A]=await Promise.all([q.getSemanticLayer(),q.listNotebooks()]);o({type:"SET_SEMANTIC_LAYER",layer:x}),o({type:"SET_FILES",files:A})}finally{o({type:"SET_SEMANTIC_LOADING",loading:!1})}},m=c.useMemo(()=>[{id:"source",number:"1",title:"Connect dbt and compile context",body:"Start with the dbt repo or semantic source. Import models, metrics, dimensions, and compile the local manifest context that DQL uses for lineage and AI.",state:V?"ready":j==="source"?"active":"waiting",Icon:Ne,primaryLabel:V?"Refresh semantic import":"Connect dbt repo",onPrimary:()=>E(!0),secondaryLabel:"Browse lineage",onSecondary:()=>K("lineage"),evidence:[`${a.models} semantic models`,`${a.metrics} metrics`,`${a.dimensions} dimensions`,`${r.blocks+r.businessViews} DQL artifacts`]},{id:"connection",number:"2",title:"Connect database and test access",body:"Use dbt profiles.yml where your runtime already resolves it, or enter warehouse credentials directly. Test the connection and refresh schema before building blocks.",state:L?"ready":j==="connection"?"active":"waiting",Icon:be,primaryLabel:L?"Manage connections":"Add database connection",onPrimary:()=>v("database"),secondaryLabel:"Open connections",onSecondary:()=>v("database"),evidence:[`${B} connection${B===1?"":"s"}`,`${T} dbt profile target${T===1?"":"s"}`,`${u.tables} tables`,`${u.columns} columns`]},{id:"ai",number:"3",title:"Connect an AI provider (optional)",body:"AI powers governed Ask and assisted authoring. Without it, SQL execution, dbt metadata, lineage, deterministic helpers, and other non-AI paths remain available.",state:f?"ready":"optional",Icon:Ie,primaryLabel:f?"Manage AI providers":"Connect AI provider",onPrimary:()=>v("ai"),secondaryLabel:"Open settings",onSecondary:()=>v("ai"),evidence:[f?"Provider configured — test in Settings to verify":"Optional · limited-AI mode"]},{id:"build",number:"4",title:"Build governed blocks",body:"Build reviewed reusable DQL blocks from dbt and semantic context. Use AI suggestions when configured, or work deterministically in Block Studio.",state:_?"ready":j==="build"?"active":"waiting",Icon:ue,primaryLabel:_?"Open block suggestions":"Suggest blocks with AI",onPrimary:()=>o({type:"SET_MAIN_VIEW",view:"readiness"}),secondaryLabel:"Open Block Studio",onSecondary:()=>o({type:"SET_MAIN_VIEW",view:"block_studio"}),evidence:[`${r.blocks} blocks`,`${r.terms} business terms`,`${r.businessViews} business views`]},{id:"notebook",number:"5",title:"Analyze in notebooks and publish to Apps",body:"Search, add, and edit notebooks around reviewed blocks. When the answer is ready, promote it into an App for stakeholder consumption.",state:O||G?"ready":j==="notebook"?"active":"waiting",Icon:Ee,primaryLabel:O?"Open notebooks":"Create notebook",onPrimary:()=>{O?K("files"):o({type:"OPEN_NEW_NOTEBOOK_MODAL"})},secondaryLabel:G?"Open Apps":"Build App",onSecondary:()=>K("apps"),evidence:[`${r.notebooks} notebooks`,`${t.apps.length} apps`,`${t.apps.reduce((x,A)=>x+A.dashboards.length,0)} dashboards`]}],[f,G,B,L,r.blocks,r.businessViews,r.notebooks,r.terms,j,_,T,O,u.columns,u.tables,a.dimensions,a.metrics,V,t.apps]),Z=m.filter(x=>x.state==="ready"||x.state==="optional").length,C=m.find(x=>x.id===j)??m[0],N=m.find(x=>x.id===W)??C,$=m.every(x=>x.state==="ready"||x.state==="optional");return e.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:i.appBg},children:[e.jsx("style",{children:Zt}),e.jsxs("main",{className:"dql-home-page",children:[e.jsxs("section",{className:"dql-home-hero dql-home-fade",style:{animationDelay:"0ms"},children:[e.jsxs("div",{className:"dql-home-hero-copy",children:[e.jsxs("div",{className:"dql-home-brand-row",children:[e.jsx("span",{className:"dql-home-logo",children:"DQL"}),e.jsx("span",{style:{color:i.textMuted},children:"Guided setup"})]}),e.jsx("h1",{style:{color:i.textPrimary},children:$?"Your workspace is ready":"Set up your analytics workspace"}),e.jsx("p",{className:"dql-home-lead",style:{color:i.textSecondary},children:$?"Source, database, blocks, notebooks and Apps are all connected. Jump back into building.":"Connect your data, build reviewed DQL blocks, then deliver with notebooks and Apps."}),e.jsx("div",{className:"dql-home-cta-row",children:e.jsxs("button",{className:"dql-home-primary-btn",onClick:C.onPrimary,children:[e.jsx(C.Icon,{size:15,strokeWidth:2.2,"aria-hidden":"true"}),C.primaryLabel,e.jsx(he,{size:15,strokeWidth:2.2,"aria-hidden":"true"})]})})]}),e.jsxs("div",{className:"dql-home-progress-badge",style:{borderColor:i.cellBorder,background:i.inputBg},children:[e.jsx(Gt,{ready:Z,total:m.length,t:i}),e.jsxs("div",{children:[e.jsxs("strong",{style:{color:i.textPrimary},children:[Z," of ",m.length," satisfied"]}),e.jsx("span",{style:{color:i.textMuted},children:$?"All set up":Yt(j)})]})]})]}),e.jsx("section",{className:"dql-home-stepper dql-home-fade","aria-label":"DQL setup steps",style:{animationDelay:"60ms"},children:m.map((x,A)=>e.jsx(Ut,{step:x,index:A,total:m.length,selected:(N==null?void 0:N.id)===x.id,t:i,onSelect:()=>M(x.id)},x.id))}),N&&e.jsx("section",{className:"dql-home-fade",style:{animationDelay:"120ms"},children:e.jsx(Vt,{step:N,t:i})}),(N==null?void 0:N.id)==="build"&&!_&&e.jsx("section",{className:"dql-home-fade",style:{animationDelay:"150ms"},children:e.jsx(zt,{t:i,aiReady:f,onSetupAi:()=>v("ai")})}),e.jsxs("section",{className:"dql-home-metrics dql-home-fade",style:{animationDelay:"180ms"},children:[e.jsx(pe,{label:"Blocks",value:r.blocks,Icon:ue,t:i}),e.jsx(pe,{label:"Notebooks",value:r.notebooks,Icon:Ee,t:i}),e.jsx(pe,{label:"Apps",value:t.apps.length,Icon:ut,t:i}),e.jsx(pe,{label:"Tables",value:u.tables,Icon:be,t:i}),e.jsx(pe,{label:"Metrics",value:a.metrics,Icon:ct,t:i})]}),e.jsxs("details",{className:"dql-home-details dql-home-fade",style:{animationDelay:"240ms",borderColor:i.cellBorder,background:i.cellBg},children:[e.jsxs("summary",{style:{color:i.textSecondary},children:[e.jsx("span",{children:"Project details"}),e.jsx("span",{className:"dql-home-details-hint",style:{color:i.textMuted},children:"catalog, schema, and artifacts"})]}),e.jsxs("div",{className:"dql-home-details-body",children:[e.jsxs("div",{className:"dql-home-context-grid",children:[e.jsx(Ce,{title:"Source objects",description:"Trusted inputs from dbt and semantic imports.",Icon:Ne,t:i,rows:[["dbt project",(n==null?void 0:n.projectName)??(n!=null&&n.configured?"Configured":"Not detected")],["manifest.json",Ge(n==null?void 0:n.artifacts.manifest)],["semantic_manifest.json",Ge(n==null?void 0:n.artifacts.semanticManifest)],["Semantic models",String(a.models)],["Metrics",String(a.metrics)],["Dimensions",String(a.dimensions)]],actionLabel:"Connect or refresh",onAction:()=>E(!0)}),e.jsx(Ce,{title:"Database catalog",description:"Connection and schema determine whether blocks run.",Icon:be,t:i,rows:[["Default connection",(p==null?void 0:p.default)??"Unknown"],["Connection profiles",String(B)],["dbt profile targets",String(T)],["Schemas",String(u.schemas)],["Tables",String(u.tables)],["Columns",String(u.columns)]],actionLabel:"Open connections",onAction:()=>K("connection")}),e.jsx(Ce,{title:"Authoring inventory",description:"Versioned files that move into notebooks and Apps.",Icon:ft,t:i,rows:[["Blocks",String(r.blocks)],["Business terms",String(r.terms)],["Business views",String(r.businessViews)],["Notebooks",String(r.notebooks)],["Apps",String(t.apps.length)]],actionLabel:"Open Block Studio",onAction:()=>o({type:"SET_MAIN_VIEW",view:"block_studio"})})]}),e.jsx("div",{className:"dql-home-artifact-list",children:Ht.map(([x,A])=>e.jsxs("div",{className:"dql-home-artifact-row",style:{borderColor:i.cellBorder},children:[e.jsx("code",{style:{color:i.textPrimary},children:x}),e.jsx("span",{style:{color:i.textSecondary},children:A})]},x))})]})]})]}),b&&e.jsx(qt,{detectedProvider:t.semanticLayer.provider,onClose:()=>E(!1),onImported:()=>void X()})]})}const le="var(--color-accent-green, #16a34a)";function Ae(t,o){return t==="ready"?le:t==="active"?o.warning:t==="optional"?o.accent:o.textMuted}function Ut({step:t,index:o,total:i,selected:r,t:d,onSelect:n}){const a=t.Icon,u=t.state==="ready"?{background:le,borderColor:le,color:"#fff"}:t.state==="active"?{background:d.cellBg,borderColor:d.warning,color:d.warning}:{background:d.cellBg,borderColor:d.cellBorder,color:d.textMuted};return e.jsxs("button",{type:"button",className:`dql-home-node is-${t.state} ${r?"is-selected":""}`,onClick:n,style:{color:d.textSecondary,background:r?d.cellBg:"transparent"},children:[o<i-1?e.jsx("span",{className:"dql-home-node-track","aria-hidden":"true",style:{background:t.state==="ready"?le:d.cellBorder}}):null,e.jsx("span",{className:"dql-home-node-badge","aria-hidden":"true",style:u,children:t.state==="ready"?e.jsx(pt,{size:18,strokeWidth:3}):e.jsx(a,{size:18,strokeWidth:2})}),e.jsxs("span",{className:"dql-home-node-meta",children:[e.jsx("span",{className:"dql-home-node-title",style:{color:d.textPrimary},children:t.title.split(" ").slice(0,3).join(" ")}),e.jsx("span",{className:"dql-home-node-status",style:{color:Ae(t.state,d)},children:Ze(t.state)})]})]})}function Vt({step:t,t:o}){const i=t.Icon;return e.jsxs("article",{className:`dql-home-focus is-${t.state}`,style:{borderColor:t.state==="active"?o.warning:t.state==="ready"?`${le}`:o.cellBorder,background:o.cellBg},children:[e.jsx("div",{className:"dql-home-focus-icon",style:{background:`${o.accent}16`,color:o.accent},children:e.jsx(i,{size:20,strokeWidth:2,"aria-hidden":"true"})}),e.jsxs("div",{className:"dql-home-focus-body",children:[e.jsxs("div",{className:"dql-home-focus-head",children:[e.jsx("h2",{style:{color:o.textPrimary},children:t.title}),e.jsx("span",{className:"dql-home-status",style:{color:Ae(t.state,o),background:`${Ae(t.state,o)}1f`},children:Ze(t.state)})]}),e.jsx("p",{style:{color:o.textSecondary},children:t.body}),e.jsx("div",{className:"dql-home-evidence",children:t.evidence.map(r=>e.jsx("span",{style:{borderColor:o.cellBorder,color:o.textMuted},children:r},r))}),e.jsxs("div",{className:"dql-home-card-actions",children:[e.jsxs("button",{className:"dql-home-primary-btn dql-home-card-btn",onClick:t.onPrimary,children:[t.primaryLabel,e.jsx(he,{size:15,strokeWidth:2.2,"aria-hidden":"true"})]}),t.secondaryLabel&&t.onSecondary&&e.jsx("button",{className:"dql-home-secondary-btn dql-home-card-btn",onClick:t.onSecondary,children:t.secondaryLabel})]})]})]})}function pe({label:t,value:o,Icon:i,t:r}){return e.jsxs("div",{className:"dql-home-metric",style:{borderColor:r.cellBorder,background:r.cellBg},children:[e.jsx("span",{className:"dql-home-metric-icon",style:{color:r.accent},children:e.jsx(i,{size:15,strokeWidth:2,"aria-hidden":"true"})}),e.jsx("strong",{style:{color:r.textPrimary},children:o.toLocaleString()}),e.jsx("span",{style:{color:r.textMuted},children:t})]})}function Gt({ready:t,total:o,t:i}){const r=o>0?t/o:0,d=16,n=2*Math.PI*d;return e.jsxs("svg",{className:"dql-home-ring",width:44,height:44,viewBox:"0 0 44 44","aria-hidden":"true",children:[e.jsx("circle",{cx:"22",cy:"22",r:d,fill:"none",stroke:i.cellBorder,strokeWidth:"4"}),e.jsx("circle",{cx:"22",cy:"22",r:d,fill:"none",stroke:le,strokeWidth:"4",strokeLinecap:"round",strokeDasharray:n,strokeDashoffset:n*(1-r),transform:"rotate(-90 22 22)",style:{transition:"stroke-dashoffset 700ms ease"}}),e.jsx("text",{x:"22",y:"26",textAnchor:"middle",fontSize:"12",fontWeight:"800",fill:i.textPrimary,children:t})]})}function Yt(t){return t==="source"?"Connect a dbt or semantic source":t==="connection"?"Add and test a database":t==="ai"?"Connect an AI provider":t==="build"?"Build your first DQL block":"Open notebooks and publish an App"}function Ce({title:t,description:o,Icon:i,rows:r,actionLabel:d,onAction:n,t:a}){return e.jsxs("section",{className:"dql-home-context-panel",style:{borderColor:a.cellBorder,background:a.cellBg},children:[e.jsxs("div",{className:"dql-home-context-head",children:[e.jsx("div",{className:"dql-home-context-icon",style:{background:`${a.accent}18`,color:a.accent},children:e.jsx(i,{size:18,strokeWidth:2,"aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("h2",{style:{color:a.textPrimary},children:t}),e.jsx("p",{style:{color:a.textSecondary},children:o})]})]}),e.jsx("div",{className:"dql-home-context-rows",children:r.map(([u,p])=>e.jsxs("div",{className:"dql-home-context-row",style:{borderColor:a.cellBorder},children:[e.jsx("span",{style:{color:a.textMuted},children:u}),e.jsx("strong",{style:{color:a.textPrimary},children:p})]},u))}),e.jsxs("button",{className:"dql-home-link-btn",onClick:n,children:[d,e.jsx(he,{size:15,strokeWidth:2,"aria-hidden":"true"})]})]})}function Ze(t){return t==="ready"?"Ready":t==="active"?"Next":t==="optional"?"Optional":"Waiting"}function Ge(t){return t?t.exists?typeof t.count=="number"?`Ready (${t.count})`:"Ready":"Missing":"Unknown"}function Jt(t){return t.reduce((o,i)=>(i.type==="block"?o.blocks+=1:i.type==="term"?o.terms+=1:i.type==="business_view"?o.businessViews+=1:(i.type==="notebook"||i.type==="workbook")&&(o.notebooks+=1),o),{notebooks:0,blocks:0,terms:0,businessViews:0})}function Kt(t){const o=t.metrics.length,i=t.measures.length,r=t.dimensions.length+t.timeDimensions.length,d=t.semanticModels.length,n=t.savedQueries.length;return{metrics:o,measures:i,dimensions:r,models:d,savedQueries:n,total:o+i+r+d+n+t.entities.length+t.hierarchies.length}}function Xt(t){const o=new Set;let i=0;for(const r of t){const[d,...n]=r.name.split(".");o.add(n.length>0?d:"default"),i+=r.columns.length}return{schemas:o.size,tables:t.length,columns:i}}const Zt=`
20
25
  .dql-home-page {
21
26
  width: min(1080px, calc(100% - 48px));
22
27
  margin: 0 auto;
@@ -114,4 +119,4 @@ import{r as c,a as q,j as e,u as Be,t as Ye,S as Ie,B as ue,C as ot,c as Je,b as
114
119
  .dql-home-node.is-active .dql-home-node-badge { animation: none !important; }
115
120
  .dql-home-node-track, .dql-home-primary-btn { transition: none; }
116
121
  }
117
- `;export{sn as HomePage};
122
+ `;export{ln as HomePage};