@duckcodeailabs/dql-cli 1.14.3-rc.1 → 1.14.4

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 (121) hide show
  1. package/dist/args.d.ts +2 -0
  2. package/dist/args.d.ts.map +1 -1
  3. package/dist/args.js +12 -0
  4. package/dist/args.js.map +1 -1
  5. package/dist/ask-runtime/analytical-planner.d.ts +14 -0
  6. package/dist/ask-runtime/analytical-planner.d.ts.map +1 -0
  7. package/dist/ask-runtime/analytical-planner.js +197 -0
  8. package/dist/ask-runtime/analytical-planner.js.map +1 -0
  9. package/dist/ask-runtime/readiness.d.ts +36 -0
  10. package/dist/ask-runtime/readiness.d.ts.map +1 -0
  11. package/dist/ask-runtime/readiness.js +65 -0
  12. package/dist/ask-runtime/readiness.js.map +1 -0
  13. package/dist/assets/dql-notebook/assets/{AgentLogPage-Jbyb4so-.js → AgentLogPage-XonDlOVv.js} +1 -1
  14. package/dist/assets/dql-notebook/assets/{AiBuildDialog-Du07X1qO.js → AiBuildDialog-DwHVVFIS.js} +1 -1
  15. package/dist/assets/dql-notebook/assets/{AiBuildResult-xKtGthWv.js → AiBuildResult-BImB4Wej.js} +1 -1
  16. package/dist/assets/dql-notebook/assets/{AiSidePanel-CE_L04dK.js → AiSidePanel-D7fFBhgc.js} +1 -1
  17. package/dist/assets/dql-notebook/assets/{AnalyticsHome-CiUE10uF.js → AnalyticsHome-CHvGWG92.js} +1 -1
  18. package/dist/assets/dql-notebook/assets/{AppsView-DlNaTuwD.js → AppsView-DNhs0MyO.js} +4 -4
  19. package/dist/assets/dql-notebook/assets/{AskObservabilityPage-DracZPI9.js → AskObservabilityPage-1WYjAf8-.js} +1 -1
  20. package/dist/assets/dql-notebook/assets/AskTracePage-D6_RunIf.js +8 -0
  21. package/dist/assets/dql-notebook/assets/{BlockStudio-DQS5Hcq9.js → BlockStudio-DWMOCHy5.js} +1 -1
  22. package/dist/assets/dql-notebook/assets/{BusinessArtifactView-CqV4i9l_.js → BusinessArtifactView-guqlfQ0j.js} +1 -1
  23. package/dist/assets/dql-notebook/assets/{DbtFirstModelingPage-JKhB_Y2H.js → DbtFirstModelingPage-DE7ewjMK.js} +1 -1
  24. package/dist/assets/dql-notebook/assets/{GitPage-DjaNp0o3.js → GitPage-CM3cgHtf.js} +1 -1
  25. package/dist/assets/dql-notebook/assets/{GlobalAiRail-CsV3zlc8.js → GlobalAiRail-BWfeK8lb.js} +1 -1
  26. package/dist/assets/dql-notebook/assets/{GovernedContextPage-uXUHUOIJ.js → GovernedContextPage-2Ld4yIgE.js} +1 -1
  27. package/dist/assets/dql-notebook/assets/{HelpDocsPage-Hbh9IeYB.js → HelpDocsPage-BxBzoxBO.js} +1 -1
  28. package/dist/assets/dql-notebook/assets/{HomePage-CRRl-R_v.js → HomePage-D4ZjCFfB.js} +1 -1
  29. package/dist/assets/dql-notebook/assets/{LineageDAG-OMUP2sbl.js → LineageDAG-DLdogZMo.js} +1 -1
  30. package/dist/assets/dql-notebook/assets/{LineageDetailView-C964BLuV.js → LineageDetailView-CqPB_tFP.js} +1 -1
  31. package/dist/assets/dql-notebook/assets/{LineageDrawer-CzY0nfpD.js → LineageDrawer-LZyR3zHf.js} +1 -1
  32. package/dist/assets/dql-notebook/assets/{LineagePathBreadcrumb-0Gi-Fm1B.js → LineagePathBreadcrumb-BZ7EcIxp.js} +1 -1
  33. package/dist/assets/dql-notebook/assets/{MiniLineageGraph-wn0wLc9m.js → MiniLineageGraph-Be_kqIq2.js} +1 -1
  34. package/dist/assets/dql-notebook/assets/{NewBlockModal-kMAzk91d.js → NewBlockModal-C9MKCa6R.js} +1 -1
  35. package/dist/assets/dql-notebook/assets/{NewNotebookModal-D_cWd_6M.js → NewNotebookModal-ZxHbTU9u.js} +1 -1
  36. package/dist/assets/dql-notebook/assets/{NotebookEditor-Bax0lxaz.js → NotebookEditor-Bh39Vsg0.js} +1 -1
  37. package/dist/assets/dql-notebook/assets/{ReadinessPage-DEUIXQQY.js → ReadinessPage-jKOBKkED.js} +1 -1
  38. package/dist/assets/dql-notebook/assets/{SetupOnboarding-CyE-Ex41.js → SetupOnboarding-BRut9nLO.js} +1 -1
  39. package/dist/assets/dql-notebook/assets/{SkillsPage-QgvKGPxE.js → SkillsPage-D9msUOxY.js} +1 -1
  40. package/dist/assets/dql-notebook/assets/{TrustBadge-D5CGp0cu.js → TrustBadge-D1CGSj0Y.js} +1 -1
  41. package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-BexNjqJd.js +88 -0
  42. package/dist/assets/dql-notebook/assets/{answer-to-notebook-tACdCsTV.js → answer-to-notebook-zHFOdR6E.js} +1 -1
  43. package/dist/assets/dql-notebook/assets/{arrow-left-CF6wxXU5.js → arrow-left-C1tZBhgf.js} +1 -1
  44. package/dist/assets/dql-notebook/assets/{arrow-right-C7G3M_S8.js → arrow-right-BP5vPPNo.js} +1 -1
  45. package/dist/assets/dql-notebook/assets/{book-open-text-DDBO8G7L.js → book-open-text-BD3-ATYI.js} +1 -1
  46. package/dist/assets/dql-notebook/assets/{chevron-left-DxajrX2v.js → chevron-left-3opVgscY.js} +1 -1
  47. package/dist/assets/dql-notebook/assets/{circle-x-HBvXjnT6.js → circle-x-Bg9-70KN.js} +1 -1
  48. package/dist/assets/dql-notebook/assets/{clock-3-CJIdsPLt.js → clock-3-DLV5puGW.js} +1 -1
  49. package/dist/assets/dql-notebook/assets/{external-link-WciAU8Bu.js → external-link-BjD8w9QU.js} +1 -1
  50. package/dist/assets/dql-notebook/assets/{grip-vertical-DVu7ok6x.js → grip-vertical-DqIc09oX.js} +1 -1
  51. package/dist/assets/dql-notebook/assets/{index-D3wnucQC.js → index-C9KfoqCR.js} +2 -2
  52. package/dist/assets/dql-notebook/assets/{link-2-C6uQx50X.js → link-2-5s0hUu6w.js} +1 -1
  53. package/dist/assets/dql-notebook/assets/{list-tree-DapsIuQB.js → list-tree-67yz_uCY.js} +1 -1
  54. package/dist/assets/dql-notebook/assets/{minimize-2-BlVoipnT.js → minimize-2-BJw5tlPC.js} +1 -1
  55. package/dist/assets/dql-notebook/assets/{panel-right-open-DcnKWxfx.js → panel-right-open-CyhTG-tw.js} +1 -1
  56. package/dist/assets/dql-notebook/assets/{play-CNuRuaAs.js → play-CsY8D5M2.js} +1 -1
  57. package/dist/assets/dql-notebook/assets/{rotate-ccw-B2p953Zh.js → rotate-ccw-RvwtBcw9.js} +1 -1
  58. package/dist/assets/dql-notebook/assets/{semantic-fields-2fWgkTJc.js → semantic-fields-EorgHwAj.js} +1 -1
  59. package/dist/assets/dql-notebook/assets/{sliders-horizontal-DwRTu1w4.js → sliders-horizontal-jQ_fUiYf.js} +1 -1
  60. package/dist/assets/dql-notebook/assets/{star-Cbaj4F3i.js → star-N_C8YvbB.js} +1 -1
  61. package/dist/assets/dql-notebook/assets/{style-NlN9F6JE.js → style-D6AlWDHX.js} +1 -1
  62. package/dist/assets/dql-notebook/assets/{triangle-alert-BPHvH1wA.js → triangle-alert-D1WefIrN.js} +1 -1
  63. package/dist/assets/dql-notebook/assets/{upload-DIqK0KE1.js → upload-CFJjpPL4.js} +1 -1
  64. package/dist/assets/dql-notebook/assets/{usePersistedAgentThreadId-DpQXOEDw.js → usePersistedAgentThreadId-B5pTglEr.js} +1 -1
  65. package/dist/assets/dql-notebook/assets/{user-round-DukNupB_.js → user-round-DL6DLw0m.js} +1 -1
  66. package/dist/assets/dql-notebook/assets/{wand-sparkles-CAwLX0b9.js → wand-sparkles-CNUjLDqT.js} +1 -1
  67. package/dist/assets/dql-notebook/assets/{workflow-bOT-NqdO.js → workflow-0NUwpoQ4.js} +1 -1
  68. package/dist/assets/dql-notebook/assets/{wrench-1m0_kcza.js → wrench-QNiznShi.js} +1 -1
  69. package/dist/assets/dql-notebook/assets/{x-fp82BETM.js → x-BhTl5gZs.js} +1 -1
  70. package/dist/assets/dql-notebook/index.html +1 -1
  71. package/dist/commands/agent-eval-cassette.d.ts.map +1 -1
  72. package/dist/commands/agent-eval-cassette.js +15 -0
  73. package/dist/commands/agent-eval-cassette.js.map +1 -1
  74. package/dist/commands/agent-shadow-report.d.ts +17 -0
  75. package/dist/commands/agent-shadow-report.d.ts.map +1 -0
  76. package/dist/commands/agent-shadow-report.js +149 -0
  77. package/dist/commands/agent-shadow-report.js.map +1 -0
  78. package/dist/commands/agent.d.ts.map +1 -1
  79. package/dist/commands/agent.js +6 -2
  80. package/dist/commands/agent.js.map +1 -1
  81. package/dist/commands/notebook.d.ts +2 -1
  82. package/dist/commands/notebook.d.ts.map +1 -1
  83. package/dist/commands/notebook.js +8 -1
  84. package/dist/commands/notebook.js.map +1 -1
  85. package/dist/index.js +3 -0
  86. package/dist/index.js.map +1 -1
  87. package/dist/llm/providers/ask-v2-analyst-prompt.d.ts +32 -0
  88. package/dist/llm/providers/ask-v2-analyst-prompt.d.ts.map +1 -0
  89. package/dist/llm/providers/ask-v2-analyst-prompt.js +136 -0
  90. package/dist/llm/providers/ask-v2-analyst-prompt.js.map +1 -0
  91. package/dist/llm/providers/dql-agent-provider.d.ts +77 -1
  92. package/dist/llm/providers/dql-agent-provider.d.ts.map +1 -1
  93. package/dist/llm/providers/dql-agent-provider.js +4848 -354
  94. package/dist/llm/providers/dql-agent-provider.js.map +1 -1
  95. package/dist/llm/types.d.ts +124 -2
  96. package/dist/llm/types.d.ts.map +1 -1
  97. package/dist/local-runtime.d.ts +352 -3
  98. package/dist/local-runtime.d.ts.map +1 -1
  99. package/dist/local-runtime.js +4916 -238
  100. package/dist/local-runtime.js.map +1 -1
  101. package/dist/metricflow.d.ts.map +1 -1
  102. package/dist/metricflow.js +80 -11
  103. package/dist/metricflow.js.map +1 -1
  104. package/dist/package.json +10 -10
  105. package/dist/providers/oauth/claude-oauth.d.ts +14 -0
  106. package/dist/providers/oauth/claude-oauth.d.ts.map +1 -1
  107. package/dist/providers/oauth/claude-oauth.js +32 -5
  108. package/dist/providers/oauth/claude-oauth.js.map +1 -1
  109. package/dist/research-lineage-program.d.ts +29 -0
  110. package/dist/research-lineage-program.d.ts.map +1 -0
  111. package/dist/research-lineage-program.js +389 -0
  112. package/dist/research-lineage-program.js.map +1 -0
  113. package/dist/retrieval-health.d.ts.map +1 -1
  114. package/dist/retrieval-health.js +5 -2
  115. package/dist/retrieval-health.js.map +1 -1
  116. package/dist/semantic-runtime.d.ts.map +1 -1
  117. package/dist/semantic-runtime.js +73 -2
  118. package/dist/semantic-runtime.js.map +1 -1
  119. package/package.json +10 -10
  120. package/dist/assets/dql-notebook/assets/AskTracePage-CSMoMw9a.js +0 -8
  121. package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-BjsTE6yf.js +0 -89
@@ -1,2 +1,2 @@
1
- import{u as x,r as w,a as k,m}from"./index-D3wnucQC.js";const C="dql:focus-notebook-cell";function h(e){window.setTimeout(()=>{window.dispatchEvent(new CustomEvent(C,{detail:{cellId:e}}))},0)}function S(e){var t,a,c;const i=(t=e.question)==null?void 0:t.trim(),n=(a=e.generatedSql)==null?void 0:a.trim(),s=(c=e.generatedDql)==null?void 0:c.trim();if(!(!i||!n&&!s))return{version:1,source:"agent_run",question:i,...n?{generatedSql:n}:{},...s?{generatedDql:s}:{},...e.sourceRunId?{sourceRunId:e.sourceRunId}:{}}}function g(e){return e.replace(/[^a-zA-Z0-9_ -]+/g," ").replace(/\s+/g,"_").replace(/^_+|_+$/g,"").slice(0,48)||"ai_analysis"}function E(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function I(e,i){var c,o,u,f,l,q;const n=(o=(c=e.dqlArtifact)==null?void 0:c.source)==null?void 0:o.trim(),s=(e.sql??n??"").trim();if(!s&&!n)return[];if(e.mixedSourcePlan){const r=e.mixedSourcePlan,A=m("markdown",[`### ${e.title??"Mixed-source analysis"}`,"",`This analysis combines a bounded warehouse extraction with the local dataset \`${r.localDataset}\`.`,"",...(u=r.warehouseRelations)!=null&&u.length?[`- Warehouse sources: ${r.warehouseRelations.map(b=>`\`${b}\``).join(", ")}`]:[],`- Join: \`${r.warehouseKey}\` = \`${r.localKey}\``,"- Trust: local mixed-source analysis · review required"].join(`
1
+ import{u as x,r as w,a as k,m}from"./index-C9KfoqCR.js";const C="dql:focus-notebook-cell";function h(e){window.setTimeout(()=>{window.dispatchEvent(new CustomEvent(C,{detail:{cellId:e}}))},0)}function S(e){var t,a,c;const i=(t=e.question)==null?void 0:t.trim(),n=(a=e.generatedSql)==null?void 0:a.trim(),s=(c=e.generatedDql)==null?void 0:c.trim();if(!(!i||!n&&!s))return{version:1,source:"agent_run",question:i,...n?{generatedSql:n}:{},...s?{generatedDql:s}:{},...e.sourceRunId?{sourceRunId:e.sourceRunId}:{}}}function g(e){return e.replace(/[^a-zA-Z0-9_ -]+/g," ").replace(/\s+/g,"_").replace(/^_+|_+$/g,"").slice(0,48)||"ai_analysis"}function E(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function I(e,i){var c,o,u,f,l,q;const n=(o=(c=e.dqlArtifact)==null?void 0:c.source)==null?void 0:o.trim(),s=(e.sql??n??"").trim();if(!s&&!n)return[];if(e.mixedSourcePlan){const r=e.mixedSourcePlan,A=m("markdown",[`### ${e.title??"Mixed-source analysis"}`,"",`This analysis combines a bounded warehouse extraction with the local dataset \`${r.localDataset}\`.`,"",...(u=r.warehouseRelations)!=null&&u.length?[`- Warehouse sources: ${r.warehouseRelations.map(b=>`\`${b}\``).join(", ")}`]:[],`- Join: \`${r.warehouseKey}\` = \`${r.localKey}\``,"- Trust: local mixed-source analysis · review required"].join(`
2
2
  `));A.name=g("Analysis context");const d=m("sql",s);return d.name=g(e.title??"Warehouse extraction"),d.mixedSourcePlan=r,d.executionTarget=((f=e.executionTarget)==null?void 0:f.target)==="connection"?e.executionTarget:{target:"connection"},d.datasetRefs=[{id:r.datasetId??r.localDataset,alias:r.localDataset,role:"source"}],[A,d]}const t=m(n?"dql":"sql",n||s);t.name=g(e.title??((l=e.dqlArtifact)==null?void 0:l.name)??"AI analysis"),e.result&&(t.result=e.result,t.status="success",t.executionCount=1),e.chartConfig&&(t.chartConfig=e.chartConfig),e.executionTarget&&(t.executionTarget=e.executionTarget),t.correctionProvenance=S({question:e.question,generatedSql:e.sql??((q=e.dqlArtifact)==null?void 0:q.compiledSql),generatedDql:n,sourceRunId:e.sourceRunId}),e.dqlArtifact&&(t.dqlArtifact={source:e.dqlArtifact.source,sql:e.sql,name:e.dqlArtifact.name,sourcePath:e.dqlArtifact.sourcePath,kind:e.dqlArtifact.kind,metrics:e.dqlArtifact.metrics,dimensions:e.dqlArtifact.dimensions,parameters:e.dqlArtifact.parameters,parameterValues:e.dqlArtifact.parameterValues,persistence:e.dqlArtifact.persistence,trustState:e.dqlArtifact.trustState,compiledSql:e.dqlArtifact.compiledSql??e.sql,...e.question?{question:e.question}:{}},t.dqlParameterValues=e.dqlArtifact.parameterValues);const a=i.filter(r=>new RegExp(`\\b${E(r.alias)}\\b`,"i").test(s)).map(r=>({id:r.id,alias:r.alias,role:r.storageMode==="staged"?"staged":"source",fingerprint:r.fileFingerprint}));return a.length>0&&(t.executionTarget={target:"local"},t.datasetRefs=a,t.dqlArtifact&&(t.dqlArtifact.reviewState="review_required")),[t]}function _(e){return(e??"ai analysis").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"ai-analysis"}function v(){const{state:e,dispatch:i}=x();return w.useCallback(async(n,s)=>{var f;const t=I(n,(s==null?void 0:s.datasets)??[]);if(t.length===0)return;if(e.activeFile&&e.activeFile.type!=="block"){let l=s==null?void 0:s.afterId;for(const q of t)i({type:"ADD_CELL",cell:q,...l?{afterId:l}:{}}),l=q.id;h(t[t.length-1].id);return}const a=n.title??((f=n.dqlArtifact)==null?void 0:f.name)??"AI analysis",c=_(a);let o=`notebooks/${c}.dqlnb`;try{o=(await k.createNotebook(c,"blank")).path}catch{}const u={name:o.split("/").pop()??`${c}.dqlnb`,path:o,type:"notebook",folder:"notebooks",isNew:!0};i({type:"FILE_ADDED",file:u}),i({type:"OPEN_FILE",file:u,cells:t,title:a}),h(t[t.length-1].id)},[i,e.activeFile])}export{C as N,S as c,h as f,v as u};
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-D3wnucQC.js";/**
1
+ import{c as o}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-D3wnucQC.js";/**
1
+ import{c as o}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-D3wnucQC.js";/**
1
+ import{c as a}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-D3wnucQC.js";/**
1
+ import{c as e}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-D3wnucQC.js";/**
1
+ import{c}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-D3wnucQC.js";/**
1
+ import{c}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-D3wnucQC.js";/**
1
+ import{c as a}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-D3wnucQC.js";/**
1
+ import{c}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-CRRl-R_v.js","assets/TrustBadge-D5CGp0cu.js","assets/arrow-right-C7G3M_S8.js","assets/triangle-alert-BPHvH1wA.js","assets/book-open-text-DDBO8G7L.js","assets/workflow-bOT-NqdO.js","assets/react-CRB3T2We.js","assets/AnalyticsHome-CiUE10uF.js","assets/answer-to-notebook-tACdCsTV.js","assets/UnifiedAgentRunPanel-BjsTE6yf.js","assets/usePersistedAgentThreadId-DpQXOEDw.js","assets/AiBuildResult-xKtGthWv.js","assets/user-round-DukNupB_.js","assets/rotate-ccw-B2p953Zh.js","assets/wrench-1m0_kcza.js","assets/x-fp82BETM.js","assets/list-tree-DapsIuQB.js","assets/minimize-2-BlVoipnT.js","assets/star-Cbaj4F3i.js","assets/GlobalAiRail-CsV3zlc8.js","assets/AiSidePanel-CE_L04dK.js","assets/NotebookEditor-Bax0lxaz.js","assets/LineagePathBreadcrumb-0Gi-Fm1B.js","assets/codemirror-DXt7RW72.js","assets/semantic-fields-2fWgkTJc.js","assets/MiniLineageGraph-wn0wLc9m.js","assets/style-NlN9F6JE.js","assets/style-BZV40eAE.css","assets/dagre.esm-B6nvU4OB.js","assets/link-2-C6uQx50X.js","assets/upload-DIqK0KE1.js","assets/clock-3-CJIdsPLt.js","assets/NewNotebookModal-D_cWd_6M.js","assets/NewBlockModal-kMAzk91d.js","assets/SetupOnboarding-CyE-Ex41.js","assets/arrow-left-CF6wxXU5.js","assets/BlockStudio-DQS5Hcq9.js","assets/chevron-left-DxajrX2v.js","assets/play-CNuRuaAs.js","assets/panel-right-open-DcnKWxfx.js","assets/BusinessArtifactView-CqV4i9l_.js","assets/LineageDetailView-C964BLuV.js","assets/LineageDAG-OMUP2sbl.js","assets/HelpDocsPage-Hbh9IeYB.js","assets/GitPage-DjaNp0o3.js","assets/external-link-WciAU8Bu.js","assets/ReadinessPage-DEUIXQQY.js","assets/ai-build-bus-1BR770pY.js","assets/wand-sparkles-CAwLX0b9.js","assets/AgentLogPage-Jbyb4so-.js","assets/circle-x-HBvXjnT6.js","assets/AskTracePage-CSMoMw9a.js","assets/AskObservabilityPage-DracZPI9.js","assets/GovernedContextPage-uXUHUOIJ.js","assets/SkillsPage-QgvKGPxE.js","assets/DbtFirstModelingPage-JKhB_Y2H.js","assets/sliders-horizontal-DwRTu1w4.js","assets/AppsView-DlNaTuwD.js","assets/grip-vertical-DVu7ok6x.js","assets/LineageDrawer-CzY0nfpD.js","assets/AiBuildDialog-Du07X1qO.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-D4ZjCFfB.js","assets/TrustBadge-D1CGSj0Y.js","assets/arrow-right-BP5vPPNo.js","assets/triangle-alert-D1WefIrN.js","assets/book-open-text-BD3-ATYI.js","assets/workflow-0NUwpoQ4.js","assets/react-CRB3T2We.js","assets/AnalyticsHome-CHvGWG92.js","assets/answer-to-notebook-zHFOdR6E.js","assets/UnifiedAgentRunPanel-BexNjqJd.js","assets/usePersistedAgentThreadId-B5pTglEr.js","assets/AiBuildResult-BImB4Wej.js","assets/user-round-DL6DLw0m.js","assets/rotate-ccw-RvwtBcw9.js","assets/wrench-QNiznShi.js","assets/x-BhTl5gZs.js","assets/list-tree-67yz_uCY.js","assets/minimize-2-BJw5tlPC.js","assets/star-N_C8YvbB.js","assets/GlobalAiRail-BWfeK8lb.js","assets/AiSidePanel-D7fFBhgc.js","assets/NotebookEditor-Bh39Vsg0.js","assets/LineagePathBreadcrumb-BZ7EcIxp.js","assets/codemirror-DXt7RW72.js","assets/semantic-fields-EorgHwAj.js","assets/MiniLineageGraph-Be_kqIq2.js","assets/style-D6AlWDHX.js","assets/style-BZV40eAE.css","assets/dagre.esm-B6nvU4OB.js","assets/link-2-5s0hUu6w.js","assets/upload-CFJjpPL4.js","assets/clock-3-DLV5puGW.js","assets/NewNotebookModal-ZxHbTU9u.js","assets/NewBlockModal-C9MKCa6R.js","assets/SetupOnboarding-BRut9nLO.js","assets/arrow-left-C1tZBhgf.js","assets/BlockStudio-DWMOCHy5.js","assets/chevron-left-3opVgscY.js","assets/play-CsY8D5M2.js","assets/panel-right-open-CyhTG-tw.js","assets/BusinessArtifactView-guqlfQ0j.js","assets/LineageDetailView-CqPB_tFP.js","assets/LineageDAG-DLdogZMo.js","assets/HelpDocsPage-BxBzoxBO.js","assets/GitPage-CM3cgHtf.js","assets/external-link-BjD8w9QU.js","assets/ReadinessPage-jKOBKkED.js","assets/ai-build-bus-1BR770pY.js","assets/wand-sparkles-CNUjLDqT.js","assets/AgentLogPage-XonDlOVv.js","assets/circle-x-Bg9-70KN.js","assets/AskTracePage-D6_RunIf.js","assets/AskObservabilityPage-1WYjAf8-.js","assets/GovernedContextPage-2Ld4yIgE.js","assets/SkillsPage-D9msUOxY.js","assets/DbtFirstModelingPage-DE7ewjMK.js","assets/sliders-horizontal-jQ_fUiYf.js","assets/AppsView-DNhs0MyO.js","assets/grip-vertical-DqIc09oX.js","assets/LineageDrawer-LZyR3zHf.js","assets/AiBuildDialog-DwHVVFIS.js"])))=>i.map(i=>d[i]);
2
2
  var _f=Object.defineProperty;var tc=e=>{throw TypeError(e)};var Pf=(e,t,n)=>t in e?_f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pe=(e,t,n)=>Pf(e,typeof t!="symbol"?t+"":t,n),Ms=(e,t,n)=>t.has(e)||tc("Cannot "+n);var R=(e,t,n)=>(Ms(e,t,"read from private field"),n?n.call(e):t.get(e)),le=(e,t,n)=>t.has(e)?tc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Z=(e,t,n,r)=>(Ms(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),fe=(e,t,n)=>(Ms(e,t,"access private method"),n);var $o=(e,t,n,r)=>({set _(o){Z(e,t,o,n)},get _(){return R(e,t,r)}});import{r as ed,a as td,g as nd}from"./react-CRB3T2We.js";function If(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var Ls={exports:{}},Fr={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.min.js
@@ -612,7 +612,7 @@ ${t}`;return r.replace(/\n\}\s*$/,`${o}
612
612
  </div>
613
613
  <p class="exported-by">Built with DQL Workbench</p>
614
614
  </body>
615
- </html>`}function xC(e,t){const n=bC(e,t),r=new Blob([n],{type:"text/html;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`${e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}-dashboard.html`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}const vC=new Set(["succeeded","failed","cancelled","interrupted"]);function Ir(e){return vC.has(e.status)}function SC(e,t){if(e.id!==t.id)return t;const n=Ir(e),r=Ir(t);return n&&!r||t.updatedAt<e.updatedAt?e:t.updatedAt>e.updatedAt?t:n!==r?r?t:e:t.progress!==e.progress?t.progress>e.progress?t:e:t}function eo(e,t){const n=e.find(o=>o.id===t.id),r=n?SC(n,t):t;return AC([...e.filter(o=>o.id!==t.id),r])}function wC(e,t){return t.reduce(eo,e)}function kC(e){return e.filter(t=>!Ir(t)).map(t=>t.id)}function CC(e,t){for(const n of kC(t))e.add(n)}async function jC(e,t,n){await Promise.all([...e].map(async r=>{try{const o=await t(r);if(n(o)===!1)return;Ir(o)&&e.delete(r)}catch{}}))}function EC(e,t=new Set){return e.filter(n=>n.type==="block_certification"&&n.status==="succeeded").filter(n=>!t.has(n.id)).filter(n=>{const r=n.result;return!!(r!=null&&r.block&&r.outcome)}).sort((n,r)=>n.updatedAt.localeCompare(r.updatedAt)||n.createdAt.localeCompare(r.createdAt)||n.id.localeCompare(r.id))}function vE(e,t){var o;if(t.operationId){const i=e.find(a=>a.type==="block_certification"&&a.id===t.operationId);if(i)return i}const n=Vr(t.activePath),r=(o=t.sourceFingerprint)==null?void 0:o.trim();return e.filter(i=>i.type==="block_certification").filter(i=>{const a=TC(i),c=[Vr(i.scope.startsWith("block:")?i.scope.slice(6):void 0),Vr(a==null?void 0:a.oldPath),Vr(a==null?void 0:a.draftPath),Vr(a==null?void 0:a.newPath)].filter(h=>!!h),l=!!(n&&c.includes(n)),u=!!(r&&i.resourceRevision&&(i.resourceRevision===r||i.resourceRevision.startsWith(`${r}:`)));return l||u}).sort((i,a)=>a.updatedAt.localeCompare(i.updatedAt)||a.createdAt.localeCompare(i.createdAt))[0]}function TC(e){return e.result&&typeof e.result=="object"&&!Array.isArray(e.result)?e.result:void 0}function Vr(e){if(!(typeof e!="string"||!e.trim()))return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}function AC(e,t=50){let n=0;return[...e].sort((r,o)=>o.updatedAt.localeCompare(r.updatedAt)||o.createdAt.localeCompare(r.createdAt)||o.id.localeCompare(r.id)).filter(r=>Ir(r)?(n+=1,n<=t):!0)}const ir=["local-operations"],hf=p.createContext(null);function RC({children:e}){const t=Yi(),n=p.useRef(new Set),r=p.useRef(new Set),o=Ge(l=>l.dispatch),i=Ri({queryKey:ir,queryFn:async()=>{const l=(await B.listOperations(50)).operations,u=t.getQueryData(ir)??[];return wC(u,l)},staleTime:15e3,refetchOnWindowFocus:!1,refetchInterval:1500}),a=i.data??[];p.useEffect(()=>{let l=!0,u,h;const d=()=>{h=new AbortController,Ap("/api/operations/events",f=>{if(f.event==="operation")try{const m=JSON.parse(f.data);t.setQueryData(ir,(S=[])=>eo(S,m))}catch{}},h.signal).catch(()=>{!l||h!=null&&h.signal.aborted||(u=setTimeout(d,5e3))})};return d(),()=>{l=!1,u&&clearTimeout(u),h==null||h.abort()}},[t]),p.useEffect(()=>{CC(r.current,a)},[a]),p.useEffect(()=>{let l=!0,u=!1;const h=async()=>{if(!(u||r.current.size===0)){u=!0;try{await jC(r.current,f=>B.getOperation(f),f=>{if(!l)return!1;t.setQueryData(ir,(m=[])=>eo(m,f))})}finally{u=!1}}};h();const d=window.setInterval(()=>void h(),1e3);return()=>{l=!1,window.clearInterval(d)}},[t]),p.useEffect(()=>{for(const l of EC(a,n.current)){const u=l.result;n.current.add(l.id),o({type:"RECONCILE_BLOCK_CERTIFICATION",outcome:u.outcome,oldPath:u.oldPath,draftPath:u.draftPath,newPath:u.newPath,payload:u.block}),window.dispatchEvent(new CustomEvent("dql:block-library-invalidated",{detail:{operationId:l.id,outcome:u.outcome}}))}},[o,a]);const c=p.useMemo(()=>({operations:a,activeCount:a.filter(l=>l.status==="queued"||l.status==="running").length,loading:i.isLoading,cancel:async l=>{const u=await B.cancelOperation(l);r.current.delete(l),t.setQueryData(ir,(h=[])=>eo(h,u))},track:l=>{Ir(l)?r.current.delete(l.id):r.current.add(l.id),t.setQueryData(ir,(u=[])=>eo(u,l))}}),[a,i.isLoading,t]);return s.jsx(hf.Provider,{value:c,children:e})}function OC(){const e=p.useContext(hf);if(!e)throw new Error("useOperations must be used inside OperationsProvider.");return e}const _C=new Set(["succeeded","failed","cancelled","interrupted"]);function PC(e,t=8){const n=IC(e).filter(o=>!_C.has(o.status)||o.type!=="project_refresh"),r=n.map(mf);return{operations:n.slice(0,t),activeCount:r.filter(o=>o.active).length,attentionCount:r.filter(o=>o.tone==="attention").length}}function IC(e){const t=e.filter(l=>l.type==="block_certification"),n=t.map((l,u)=>u),r=new Map,o=l=>{let u=l;for(;n[u]!==u;)n[u]=n[n[u]],u=n[u];return u},i=(l,u)=>{const h=o(l),d=o(u);h!==d&&(n[d]=h)};t.forEach((l,u)=>{for(const h of DC(l)){const d=r.get(h);d===void 0?r.set(h,u):i(u,d)}});const a=new Map;t.forEach((l,u)=>{const h=o(u),d=a.get(h);(!d||$C(l,d)<0)&&a.set(h,l)});const c=new Set([...a.values()].map(l=>l.id));return e.filter(l=>l.type!=="block_certification"||c.has(l.id))}function mf(e){var n,r,o,i,a,c;if(e.status==="queued"||e.status==="running")return{active:!0,tone:"active",statusLabel:e.status,message:e.message,guidance:e.type==="block_certification"?"You can change pages while certification continues.":void 0};if(e.type==="block_certification"&&e.status==="succeeded"){const l=e.result;if((l==null?void 0:l.outcome)==="draft_saved_with_blockers"){const u=((r=(n=l.checklist)==null?void 0:n.issues)==null?void 0:r.length)??((o=l.blockers)==null?void 0:o.length)??((i=l.checklist)==null?void 0:i.blockers.length)??0;return{active:!1,tone:"attention",statusLabel:"needs attention",message:u>0?`Draft saved with ${u} certification blocker${u===1?"":"s"}.`:"Draft saved, but certification requirements are not ready.",guidance:"Open Block Studio to review the exact fixes and retry."}}if((l==null?void 0:l.outcome)==="certified")return{active:!1,tone:"success",statusLabel:"certified",message:"The block passed its required gates and was certified."}}return e.status==="failed"||e.status==="interrupted"?{active:!1,tone:"failure",statusLabel:e.status,message:((a=e.error)==null?void 0:a.message)??e.message,guidance:e.type==="block_certification"?"The saved draft is preserved for review or retry.":void 0}:e.status==="cancelled"?{active:!1,tone:"neutral",statusLabel:"cancelled",message:e.message}:{active:!1,tone:e.status==="succeeded"?"success":"neutral",statusLabel:e.status,message:((c=e.error)==null?void 0:c.message)??e.message}}function DC(e){const t=hi(e.result),n=hi(t==null?void 0:t.block),r=hi(n==null?void 0:n.metadata),o=e.scope.startsWith("block:")?e.scope.slice(6):void 0;return Array.from(new Set([ar(n==null?void 0:n.path),ar(r==null?void 0:r.path),ar(t==null?void 0:t.oldPath),ar(t==null?void 0:t.draftPath),ar(t==null?void 0:t.newPath),ar(o)].filter(i=>!!i)))}function hi(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function ar(e){if(!(typeof e!="string"||!e.trim()))return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}function $C(e,t){return t.createdAt.localeCompare(e.createdAt)||t.updatedAt.localeCompare(e.updatedAt)||t.id.localeCompare(e.id)}function MC(){const e=Ge(d=>d.themeMode),t=Qe[e],{operations:n,loading:r,cancel:o}=OC(),[i,a]=p.useState(!1),c=p.useRef(null),{operations:l,activeCount:u,attentionCount:h}=PC(n);return p.useEffect(()=>{if(!i)return;const d=m=>{c.current&&!c.current.contains(m.target)&&a(!1)},f=m=>{m.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",d),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f)}},[i]),!r&&l.length===0?null:s.jsxs("div",{ref:c,style:{position:"relative"},children:[s.jsxs("button",{type:"button","aria-label":"Background tasks","aria-expanded":i,onClick:()=>a(d=>!d),style:{height:28,padding:"0 9px",borderRadius:6,border:`1px solid ${u>0?t.accent:h>0?t.warning:t.btnBorder}`,background:i?t.btnHover:t.btnBg,color:t.textSecondary,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6,fontFamily:t.font,fontSize:11,fontWeight:600},children:[s.jsx("span",{"aria-hidden":"true",style:{width:7,height:7,borderRadius:999,background:u>0?t.accent:h>0?t.warning:t.success,boxShadow:u>0?`0 0 0 3px ${t.accent}20`:"none"}}),u>0?`${u} running`:h>0?`${h} needs attention`:"Tasks"]}),i&&s.jsxs("div",{role:"dialog","aria-label":"Background tasks",style:{position:"absolute",top:34,right:0,zIndex:1200,width:340,maxHeight:420,overflowY:"auto",background:t.modalBg,border:`1px solid ${t.cellBorder}`,borderRadius:9,boxShadow:"0 14px 36px rgba(0,0,0,0.28)",padding:8},children:[s.jsx("div",{style:{padding:"4px 6px 8px",color:t.textPrimary,fontSize:12,fontWeight:700},children:"Background tasks"}),l.map(d=>{const f=mf(d),m=f.active,S=f.tone==="failure"?t.error:f.tone==="attention"?t.warning:f.tone==="success"?t.success:t.textMuted;return s.jsxs("div",{style:{padding:"9px 8px",borderTop:`1px solid ${t.headerBorder}`,display:"flex",flexDirection:"column",gap:6},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("span",{style:{flex:1,color:t.textPrimary,fontSize:11.5,fontWeight:650},children:LC(d.type)}),s.jsx("span",{style:{color:S,fontSize:10},children:f.statusLabel})]}),s.jsx("div",{style:{color:f.tone==="failure"?t.error:f.tone==="attention"?t.warning:t.textSecondary,fontSize:10.5,lineHeight:1.4},children:f.message}),m&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("div",{style:{flex:1,height:3,borderRadius:99,overflow:"hidden",background:t.headerBorder},children:s.jsx("div",{style:{width:`${Math.max(3,d.progress)}%`,height:"100%",background:t.accent,transition:"width 180ms ease"}})}),d.cancellable&&s.jsx("button",{type:"button",onClick:()=>void o(d.id),style:{border:0,background:"transparent",color:t.textMuted,cursor:"pointer",fontSize:10,padding:0},children:"Cancel"})]}),d.type==="block_certification"&&s.jsx("div",{style:{color:t.textMuted,fontSize:9.5},children:f.guidance??(f.tone==="success"?"Certification is complete.":"The saved draft is preserved for review or retry.")}),(d.type==="agent_run"||d.type==="app_ai_build")&&s.jsx("div",{style:{color:t.textMuted,fontSize:9.5},children:m?"This continues while you work on another page.":d.status==="succeeded"?"Completed in the background.":"Open the original surface to review or retry."})]},d.id)})]})]})}function LC(e){return e==="block_certification"?"Block certification":e==="project_refresh"?"Project metadata refresh":e==="agent_run"?"AI request":e==="app_ai_build"?"App proposal":e.replace(/_/g," ")}const rs=new Map;function NC(e,t){let n=rs.get(e);n||(n={running:!1},rs.set(e,n));const r=n,o=new Promise((i,a)=>{r.pending?(r.pending.content=t,r.pending.waiters.push({resolve:i,reject:a})):r.pending={content:t,waiters:[{resolve:i,reject:a}]}});return r.running||(r.running=!0,(async()=>{for(;r.pending;){const i=r.pending;r.pending=void 0;try{await B.saveNotebook(e,i.content);for(const a of i.waiters)a.resolve()}catch(a){for(const c of i.waiters)c.reject(a)}}})().finally(()=>{r.running=!1,r.pending||rs.delete(e)})),o}function BC(e){const t=rs.get(e);return!!(t!=null&&t.running||t!=null&&t.pending)}function FC({t:e}){return s.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:s.jsx("span",{style:{color:"#ffffff",fontSize:10,fontWeight:700,fontFamily:e.fontMono,letterSpacing:"-0.5px"},children:"DQL"})})}function zC(){var ne;const e=Ge(Lr(F=>({activeBlockPath:F.activeBlockPath,activeFile:F.activeFile,appMode:F.appMode,autoSave:F.autoSave,blockStudioDirty:F.blockStudioDirty,blockStudioDraft:F.blockStudioDraft,blockStudioMetadata:F.blockStudioMetadata,cells:F.cells,files:F.files,mainView:F.mainView,notebookDirty:F.notebookDirty,notebookMetadata:F.notebookMetadata,notebookTitle:F.notebookTitle,savingFile:F.savingFile,themeMode:F.themeMode}))),t=jn(),n=Qe[e.themeMode],{executeAll:r}=ff(),[o,i]=p.useState(!1),[a,c]=p.useState(""),[l,u]=p.useState(!1),[h,d]=p.useState(!1),[f,m]=p.useState(!1),[S,v]=p.useState(!1),[b,w]=p.useState(!1),j=p.useRef(null),[C,x]=p.useState(!1),[E,P]=p.useState(!1),A=p.useRef(null),g=p.useRef(null),I=e.mainView==="block_studio"?e.blockStudioDirty:e.notebookDirty,T=e.mainView==="notebook",O=e.mainView==="notebook"||e.mainView==="block_studio",_=O&&!!e.activeFile,M={home:"Home",business_artifact:((ne=e.activeFile)==null?void 0:ne.name.replace(/\.(dqlnb|dql)$/i,""))??"Business Definition",lineage:"Lineage",lineage_detail:"Lineage",connection:"Settings",apps:"Apps",git:"Source control",settings:"Settings",imports:"Import SQL",domains:"Modeling",modeling:"Modeling"},q=O?e.activeFile?e.notebookTitle||"Untitled":e.mainView==="block_studio"?"Blocks":"Notebooks":M[e.mainView]??"DQL Workbench";p.useEffect(()=>{o&&g.current&&(g.current.focus(),g.current.select())},[o]),p.useEffect(()=>{if(!E)return;function F(K){A.current&&!A.current.contains(K.target)&&P(!1)}return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[E]);const G=()=>{c(e.notebookTitle),i(!0)},J=()=>{i(!1),a.trim()&&a!==e.notebookTitle&&(e.mainView==="block_studio"&&e.blockStudioMetadata?(t({type:"SET_BLOCK_STUDIO_METADATA",metadata:{...e.blockStudioMetadata,name:a.trim()}}),t({type:"SET_BLOCK_STUDIO_DRAFT",draft:tC(e.blockStudioDraft,a.trim())})):t({type:"SET_NOTEBOOK_DIRTY",dirty:!0}))},H=p.useCallback(async()=>{var K,oe,ee;const F=In.getState();if(F.activeFile){t({type:"SET_SAVING",saving:!0});try{if(F.mainView==="block_studio"){if(!F.blockStudioMetadata)return;const ce=await B.saveBlockStudio({path:F.activeBlockPath,source:F.blockStudioDraft,metadata:{name:F.blockStudioMetadata.name,domain:F.blockStudioMetadata.domain,folderPath:F.blockStudioMetadata.folderPath,description:F.blockStudioMetadata.description,owner:F.blockStudioMetadata.owner,tags:F.blockStudioMetadata.tags}});t({type:"OPEN_BLOCK_STUDIO",file:{name:`${ce.metadata.name}.dql`,path:ce.path,type:"block",folder:"blocks"},payload:ce}),F.files.some(ke=>ke.path===ce.path)||t({type:"FILE_ADDED",file:{name:`${ce.metadata.name}.dql`,path:ce.path,type:"block",folder:"blocks"}})}else{const ce=F.activeFile,ke=F.cells,xe=F.notebookTitle,De=F.notebookMetadata,We=ce.type==="block"?((K=ke[0])==null?void 0:K.content)??"":q1(xe,ke,De);await NC(ce.path,We);const Be=In.getState();((oe=Be.activeFile)==null?void 0:oe.path)===ce.path&&Be.cells===ke&&Be.notebookTitle===xe&&Be.notebookMetadata===De&&t({type:"SET_NOTEBOOK_DIRTY",dirty:!1})}u(!0),setTimeout(()=>u(!1),2e3)}catch(ce){console.error("Save failed:",ce)}finally{const ce=(ee=In.getState().activeFile)==null?void 0:ee.path;(!ce||!BC(ce))&&t({type:"SET_SAVING",saving:!1})}}},[t]);p.useEffect(()=>{const F=K=>{(K.metaKey||K.ctrlKey)&&K.key==="s"&&(K.preventDefault(),H())};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[H]),p.useEffect(()=>{if(!e.autoSave||!I||!e.activeFile||e.mainView==="block_studio")return;const F=setTimeout(()=>{H()},750);return()=>clearTimeout(F)},[e.autoSave,I,e.activeFile,e.cells,e.blockStudioDraft,H]);const L=[{mode:"obsidian",label:"Obsidian",glyph:"●",swatch:"#0d0e11"},{mode:"paper",label:"Paper",glyph:"☼",swatch:"#f7f4ed"},{mode:"white",label:"White",glyph:"○",swatch:"#ffffff"}],$=e.themeMode==="dark"||e.themeMode==="midnight"?"obsidian":e.themeMode==="light"?"paper":e.themeMode==="arctic"?"white":e.themeMode,X=L.find(F=>F.mode===$)??L[0];p.useEffect(()=>{if(!b)return;const F=oe=>{j.current&&!j.current.contains(oe.target)&&w(!1)},K=oe=>{oe.key==="Escape"&&w(!1)};return document.addEventListener("mousedown",F),document.addEventListener("keydown",K),()=>{document.removeEventListener("mousedown",F),document.removeEventListener("keydown",K)}},[b]);const W={height:28,padding:"0 10px",borderRadius:6,border:`1px solid ${n.btnBorder}`,cursor:"pointer",fontSize:12,fontWeight:500,fontFamily:n.font,display:"flex",alignItems:"center",gap:4,transition:"background 0.15s, color 0.15s",whiteSpace:"nowrap"};return s.jsxs("div",{style:{height:48,flexShrink:0,background:n.headerBg,borderBottom:`1px solid ${n.headerBorder}`,display:"flex",alignItems:"center",padding:"0 12px",gap:8,userSelect:"none"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[s.jsx(FC,{t:n}),s.jsx("div",{style:{width:1,height:20,background:n.headerBorder,flexShrink:0}}),e.activeFile&&O&&s.jsx("span",{style:{fontSize:10,fontWeight:600,color:e.activeFile.type==="block"?"#e3b341":n.accent,background:`${e.activeFile.type==="block"?"#e3b341":n.accent}18`,borderRadius:4,padding:"2px 6px",fontFamily:n.font,textTransform:"uppercase",letterSpacing:"0.05em",flexShrink:0},children:e.activeFile.type}),e.activeFile&&O?o?s.jsx("input",{ref:g,value:a,onChange:F=>c(F.target.value),onBlur:J,onKeyDown:F=>{F.key==="Enter"&&J(),F.key==="Escape"&&i(!1)},style:{background:"transparent",border:`1px solid ${n.cellBorderActive}`,borderRadius:4,color:n.textPrimary,fontSize:13,fontWeight:500,fontFamily:n.font,padding:"2px 6px",outline:"none",minWidth:120,maxWidth:320}}):s.jsxs("span",{onClick:G,title:"Click to rename",style:{color:n.textPrimary,fontSize:13,fontWeight:500,fontFamily:n.font,cursor:"text",maxWidth:320,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"2px 4px",borderRadius:4,border:"1px solid transparent"},children:[q,I&&s.jsx("span",{style:{color:n.textMuted,marginLeft:4},children:"●"})]}):s.jsx("span",{style:{color:n.textSecondary,fontSize:13,fontFamily:n.font,padding:"2px 4px"},children:q||"DQL Workbench"})]}),s.jsx("div",{style:{flex:1}}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsx(MC,{}),e.appMode==="studio"&&_&&e.mainView!=="block_studio"&&s.jsx(s.Fragment,{children:s.jsxs("button",{onClick:T?r:void 0,disabled:!e.activeFile||!T,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...W,height:30,padding:"0 14px",borderRadius:999,background:n.accent,color:"#ffffff",border:`1px solid ${n.accent}`,opacity:!e.activeFile||!T?.4:h?.9:1,boxShadow:"0 1px 2px rgba(107,93,211,0.25)",gap:6},children:[s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",children:s.jsx("path",{d:"M1.5 1.5l7 3.5-7 3.5V1.5Z"})}),"Run all"]})}),s.jsxs("div",{ref:j,style:{position:"relative"},children:[s.jsxs("button",{onClick:()=>w(F=>!F),onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),title:`Theme: ${X.label}`,"aria-haspopup":"true","aria-expanded":b,style:{...W,background:S||b?n.btnHover:n.btnBg,color:n.textSecondary,padding:"0 10px",fontSize:12,display:"flex",alignItems:"center",gap:6},children:[s.jsx("span",{style:{width:12,height:12,borderRadius:3,background:X.swatch,border:`1px solid ${n.headerBorder}`,flexShrink:0}}),s.jsx("span",{style:{fontFamily:n.fontMono,fontSize:10,letterSpacing:"0.04em"},children:X.label}),s.jsx("span",{style:{fontSize:8,color:n.textMuted},children:"▾"})]}),b&&s.jsx("div",{role:"menu",style:{position:"absolute",top:"100%",right:0,marginTop:4,minWidth:160,background:n.headerBg,border:`1px solid ${n.headerBorder}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.32)",padding:4,zIndex:1e3,display:"flex",flexDirection:"column",gap:1},children:L.map(F=>{const K=F.mode===$;return s.jsxs("button",{role:"menuitemradio","aria-checked":K,onClick:()=>{t({type:"SET_THEME",mode:F.mode}),w(!1)},style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",border:"none",background:K?n.btnHover:"transparent",color:n.textPrimary,cursor:"pointer",borderRadius:4,fontSize:12,fontFamily:n.font,textAlign:"left"},onMouseEnter:oe=>{K||(oe.currentTarget.style.background=n.btnHover)},onMouseLeave:oe=>{K||(oe.currentTarget.style.background="transparent")},children:[s.jsx("span",{style:{width:14,height:14,borderRadius:3,background:F.swatch,border:`1px solid ${n.headerBorder}`,flexShrink:0}}),s.jsx("span",{style:{flex:1},children:F.label}),K&&s.jsx("span",{style:{color:n.accent,fontSize:11},children:"✓"})]},F.mode)})})]}),e.appMode==="studio"&&_&&e.mainView!=="block_studio"&&s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:H,disabled:!e.activeFile||e.savingFile,onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),title:"Save (Cmd+S)",style:{...W,background:f&&e.activeFile?n.btnHover:n.btnBg,color:l?n.success:n.textSecondary,opacity:e.activeFile?1:.4},children:e.savingFile?s.jsxs(s.Fragment,{children:[s.jsx(UC,{}),"Saving…"]}):l?s.jsx(s.Fragment,{children:"✓ Saved"}):s.jsx(s.Fragment,{children:"Save"})}),s.jsx("div",{style:{width:1,height:20,background:n.headerBorder}})]}),_&&e.mainView!=="block_studio"&&s.jsxs("div",{ref:A,style:{position:"relative"},children:[s.jsxs("button",{onClick:()=>{e.activeFile&&P(F=>!F)},disabled:!e.activeFile,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),title:"Share / export",style:{...W,height:30,padding:"0 14px",borderRadius:999,background:(C||E)&&e.activeFile?"#2a2a30":"#1a1a1a",color:"#ffffff",border:"1px solid #1a1a1a",opacity:e.activeFile?1:.4,gap:6},children:[s.jsx("svg",{width:"11",height:"11",viewBox:"0 0 16 16",fill:"currentColor",children:s.jsx("path",{d:"M5.5 10.75a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75Zm0-3a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75ZM3 3.75A1.75 1.75 0 0 1 4.75 2h6.586c.464 0 .909.184 1.237.513l1.914 1.914c.329.328.513.773.513 1.237v6.586A1.75 1.75 0 0 1 13.25 14h-8.5A1.75 1.75 0 0 1 3 12.25Z"})}),"Share",s.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"currentColor",style:{marginLeft:1,opacity:.7},children:s.jsx("path",{d:"M1 2.5l3 3 3-3",stroke:"currentColor",fill:"none",strokeWidth:"1.2",strokeLinecap:"round"})})]}),E&&s.jsx("div",{style:{position:"absolute",top:32,right:0,zIndex:200,background:n.modalBg,border:`1px solid ${n.cellBorder}`,borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.3)",padding:4,minWidth:160,display:"flex",flexDirection:"column",gap:2},children:s.jsx(qC,{label:"Export HTML",description:"Standalone dashboard",t:n,onClick:()=>{xC(e.notebookTitle||"dashboard",e.cells),P(!1)}})})]})]})]})}function qC({label:e,description:t,t:n,onClick:r}){const[o,i]=p.useState(!1);return s.jsxs("button",{onClick:r,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{background:o?n.btnHover:"transparent",border:"none",borderRadius:5,cursor:"pointer",padding:"6px 10px",textAlign:"left",display:"flex",flexDirection:"column",gap:1,transition:"background 0.12s"},children:[s.jsx("span",{style:{fontSize:12,fontWeight:500,color:n.textPrimary,fontFamily:n.font},children:e}),s.jsx("span",{style:{fontSize:10,color:n.textMuted,fontFamily:n.font},children:t})]})}function UC(){return s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{animation:"spin 0.8s linear infinite"},children:[s.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"}),s.jsx("circle",{cx:"6",cy:"6",r:"4.5",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"14 7"})]})}function WC(e){return e.toTimeString().slice(0,8)}function KC(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}function VC(){const{state:e,dispatch:t}=et(),n=Qe[e.themeMode],[r,o]=p.useState(!1),i=e.queryLog.filter(c=>c.error),a=c=>t({type:"SET_DEV_PANEL_TAB",tab:c});return s.jsxs("div",{style:{height:e.devPanelOpen?180:0,flexShrink:0,background:n.sidebarBg,borderTop:`1px solid ${n.headerBorder}`,display:"flex",flexDirection:"column",overflow:"hidden",transition:"height 0.2s ease",position:"relative"},children:[e.devPanelOpen&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{height:32,flexShrink:0,display:"flex",alignItems:"center",borderBottom:`1px solid ${n.headerBorder}`,padding:"0 8px",gap:2},children:[["logs","errors"].map(c=>s.jsx(HC,{label:c==="errors"?`Errors${i.length>0?` (${i.length})`:""}`:`Logs (${e.queryLog.length})`,active:e.devPanelTab===c,onClick:()=>a(c),t:n},c)),s.jsx("div",{style:{flex:1}}),s.jsx("button",{onClick:()=>t({type:"SET_CELLS",cells:e.cells}),title:"Clear logs",style:{background:"transparent",borderTop:"none",borderLeft:"none",borderRight:"none",borderBottom:"none",cursor:"pointer",color:n.textMuted,fontSize:11,fontFamily:n.font,padding:"2px 6px",borderRadius:4},children:"Clear"})]}),s.jsxs("div",{style:{flex:1,overflow:"auto",padding:"4px 0"},children:[e.devPanelTab==="logs"&&(e.queryLog.length===0?s.jsx(zl,{t:n,message:"No queries executed yet."}):[...e.queryLog].reverse().map(c=>s.jsx(ql,{entry:c,t:n},c.id))),e.devPanelTab==="errors"&&(i.length===0?s.jsx(zl,{t:n,message:"No errors."}):[...i].reverse().map(c=>s.jsx(ql,{entry:c,t:n},c.id)))]})]}),s.jsxs("button",{onClick:()=>t({type:"TOGGLE_DEV_PANEL"}),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),title:e.devPanelOpen?"Close panel":"Open dev panel",style:{position:"absolute",bottom:e.devPanelOpen?4:-28,right:8,height:22,padding:"0 8px",borderRadius:"4px 4px 0 0",borderTop:`1px solid ${n.headerBorder}`,borderLeft:`1px solid ${n.headerBorder}`,borderRight:`1px solid ${n.headerBorder}`,borderBottom:e.devPanelOpen?`1px solid ${n.sidebarBg}`:`1px solid ${n.headerBorder}`,background:r?n.btnHover:n.sidebarBg,color:n.textMuted,cursor:"pointer",fontSize:11,fontFamily:n.font,display:"flex",alignItems:"center",gap:4,transition:"background 0.15s, bottom 0.2s ease",zIndex:10},children:[s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",children:s.jsx("path",{d:e.devPanelOpen?"M1 7l4-4 4 4":"M1 3l4 4 4-4",strokeWidth:"1.5",stroke:"currentColor",fill:"none"})}),"Dev"]})]})}function HC({label:e,active:t,onClick:n,t:r}){const[o,i]=p.useState(!1);return s.jsx("button",{onClick:n,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{background:"transparent",borderTop:"none",borderLeft:"none",borderRight:"none",borderBottom:t?`2px solid ${r.accent}`:"2px solid transparent",cursor:"pointer",color:t?r.textPrimary:o?r.textSecondary:r.textMuted,fontSize:12,fontFamily:r.font,fontWeight:t?500:400,padding:"4px 8px",height:32,transition:"color 0.15s"},children:e})}function zl({t:e,message:t}){return s.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.textMuted,fontSize:12,fontFamily:e.font,fontStyle:"italic"},children:t})}function ql({entry:e,t}){return s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"3px 12px",fontSize:11,fontFamily:t.fontMono,color:e.error?t.error:t.textSecondary,borderLeft:e.error?`2px solid ${t.error}`:"2px solid transparent"},children:[s.jsx("span",{style:{color:t.textMuted,flexShrink:0},children:WC(e.ts)}),s.jsx("span",{style:{flexShrink:0,color:t.textPrimary,maxWidth:160,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.cellName}),e.error?s.jsx("span",{style:{color:t.error,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.error}):s.jsxs(s.Fragment,{children:[s.jsxs("span",{style:{color:t.textMuted},children:[e.rows.toLocaleString()," rows"]}),s.jsx("span",{style:{color:t.textMuted},children:KC(e.time)})]})]})}function GC(){const{state:e,dispatch:t}=et(),{executeAll:n}=ff();p.useEffect(()=>{const r=o=>{const i=o.metaKey||o.ctrlKey;if(i&&o.key==="b"&&!o.shiftKey){o.preventDefault(),t({type:"TOGGLE_SIDEBAR"});return}if(i&&o.shiftKey&&o.key==="Enter"){o.preventDefault(),e.activeFile&&n();return}if(i&&o.key==="j"&&!o.shiftKey){o.preventDefault(),t({type:"TOGGLE_DEV_PANEL"});return}if(i&&o.key==="d"&&!o.shiftKey){o.preventDefault(),e.activeFile&&t({type:"TOGGLE_DASHBOARD_MODE"});return}if(o.key==="Escape"){if(e.dashboardMode){t({type:"TOGGLE_DASHBOARD_MODE"});return}if(e.newNotebookModalOpen){t({type:"CLOSE_NEW_NOTEBOOK_MODAL"});return}if(e.newBlockModalOpen){t({type:"CLOSE_NEW_BLOCK_MODAL"});return}}};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,n,e.activeFile,e.newNotebookModalOpen,e.newBlockModalOpen,e.dashboardMode])}const QC=600;function JC(e,t){const n=t.filter(r=>r.result||r.error||(r.executionCount??0)>0).map(r=>{var o;return{cellId:r.id,status:r.status,result:r.result,error:r.error,executionCount:r.executionCount,executedAt:((o=r.execution)==null?void 0:o.completedAt)??new Date().toISOString(),execution:r.execution}});return{version:1,notebookPath:e,capturedAt:new Date().toISOString(),cells:n}}function Ul(e){return e.map(t=>{var n,r;return`${t.id}:${((n=t.execution)==null?void 0:n.runId)??""}:${t.executionCount??0}:${((r=t.result)==null?void 0:r.rowCount)??-1}:${t.error??""}`}).join("|")}function YC(){var o;const{state:e}=et(),t=p.useRef(null),n=p.useRef(""),r=p.useRef(null);p.useEffect(()=>{var c;const i=((c=e.activeFile)==null?void 0:c.path)??null;if(!i)return;if(i!==r.current){r.current=i,n.current=Ul(e.cells);return}const a=Ul(e.cells);return a!==n.current&&(n.current=a,t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{const l=JC(i,e.cells);B.saveRunSnapshot(i,l).catch(()=>{})},QC)),()=>{t.current&&(clearTimeout(t.current),t.current=null)}},[e.cells,(o=e.activeFile)==null?void 0:o.path])}const SE="core";function XC(e){var n;const t=e==null?void 0:e.trim();if(t)return((n=t.split("::").at(-1))==null?void 0:n.trim())||void 0}const ZC=[{items:[{id:"diagram",label:"Modeling"},{id:"skills",label:"Skills"},{id:"blocks",label:"Blocks"},{id:"notebooks",label:"Notebooks"},{id:"apps",label:"Apps"}]}],ej=new Set(ZC.flatMap(e=>e.items.map(t=>t.id)));function gf(e){return e!==null&&ej.has(e)}function wE(e,t){const n=new URL(e);return t.domain?n.searchParams.set("domain",t.domain):n.searchParams.delete("domain"),n.searchParams.set("domainSection",t.section),t.modelAreaId?n.searchParams.set("modelArea",t.modelAreaId):n.searchParams.delete("modelArea"),t.selectedId?n.searchParams.set("domainObject",t.selectedId):n.searchParams.delete("domainObject"),`${n.pathname}${n.search}${n.hash}`}function tj(e){const t=new URL(e);for(const n of yf)t.searchParams.delete(n);return`${t.pathname}${t.search}${t.hash}`}const yf=["domain","domainSection","modelArea","domainObject"],kE="dql.domain-studio.location";function CE(e,t){const n=new URL(e).searchParams;if(yf.some(r=>n.has(r))){const r=n.get("domainSection"),o=gf(r)?r:"diagram";return{domain:n.get("domain"),section:o,modelAreaId:n.get("modelArea"),selectedId:r==="diagram"?n.get("domainObject"):null}}return nj(t)}function nj(e){const t={domain:null,section:"diagram",modelAreaId:null,selectedId:null};if(!e)return t;try{const n=JSON.parse(e),r=typeof n.section=="string"&&gf(n.section)?n.section:"diagram",o=i=>typeof i=="string"&&i.trim()?i:null;return{domain:o(n.domain),section:r,modelAreaId:o(n.modelAreaId),selectedId:o(n.selectedId)}}catch{return t}}function jE(e){return`modeling:${e??"all"}`}function EE(e){const t=Object.values(e),n=new Map;for(const a of t){const c=a.parent&&e[a.parent]?a.parent:void 0;n.set(c,[...n.get(c)??[],a])}for(const a of n.values())a.sort((c,l)=>c.id.localeCompare(l.id));const r=[],o=new Set,i=(a,c)=>{for(const l of n.get(a)??[])o.has(l.id)||(o.add(l.id),r.push({id:l.id,parent:l.parent,depth:c,label:c===0?l.id:`${"— ".repeat(c)}${l.id.split(".").at(-1)??l.id}`}),i(l.id,c+1))};i(void 0,0);for(const a of t.sort((c,l)=>c.id.localeCompare(l.id)))o.has(a.id)||r.push({id:a.id,parent:a.parent,depth:0,label:a.id});return r}function TE(e){const t=(e??"").toLowerCase();return t==="dimension"?"var(--status-success)":t==="bridge"?"var(--status-warning)":t==="event"||t==="snapshot"?"var(--accent)":"var(--text-tertiary)"}function bf(e){return Object.entries(e.entities).map(([t,n])=>({recordKey:t,entity:n}))}function AE(e,t){if(e.entities[t])return t;const n=bf(e).filter(({entity:r})=>r.id===t||r.qualifiedId===t);return n.length===1?n[0].recordKey:void 0}function RE(e,t){return bf(e).filter(({entity:n})=>!t||n.domain===t)}function OE(e,t,n){if(e.operation==="upsert_entity"){if(!t)return!1;const r=e.value;return r.dbtModel===t.dbtUniqueId&&(r.grain??void 0)===(t.grain??void 0)&&JSON.stringify(r.keys??[])===JSON.stringify(t.keys??[])&&(r.status??t.status)===t.status&&(r.areaId??void 0)===XC(t.areaId)&&r.domain===t.domain}return e.operation==="upsert_area"?!!n&&e.value.domain===n.domain&&e.value.id===n.localId:!1}const rj=p.lazy(()=>Ae(()=>import("./HomePage-CRRl-R_v.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.HomePage}))),oj=p.lazy(()=>Ae(()=>import("./AnalyticsHome-CiUE10uF.js"),__vite__mapDeps([7,8,9,10,1,11,12,3,13,14,15,16,17,2,18,6])).then(e=>({default:e.AnalyticsHome}))),sj=p.lazy(()=>Ae(()=>import("./GlobalAiRail-CsV3zlc8.js"),__vite__mapDeps([19,9,10,1,11,12,3,13,14,15,16,17,2,20,6])).then(e=>({default:e.GlobalAiRail}))),ij=p.lazy(()=>Ae(()=>import("./NotebookEditor-Bax0lxaz.js"),__vite__mapDeps([21,4,2,5,22,23,24,10,1,11,12,3,13,14,9,15,16,17,8,25,26,6,27,28,29,20,30,31])).then(e=>({default:e.NotebookEditor}))),aj=p.lazy(()=>Ae(()=>import("./NewNotebookModal-D_cWd_6M.js"),__vite__mapDeps([32,4,15,6])).then(e=>({default:e.NewNotebookModal}))),cj=p.lazy(()=>Ae(()=>import("./NewBlockModal-kMAzk91d.js"),__vite__mapDeps([33,6])).then(e=>({default:e.NewBlockModal}))),lj=p.lazy(()=>Ae(()=>import("./SetupOnboarding-CyE-Ex41.js"),__vite__mapDeps([34,35,2,6])).then(e=>({default:e.SetupOnboarding}))),dj=p.lazy(()=>Ae(()=>import("./BlockStudio-DQS5Hcq9.js"),__vite__mapDeps([36,22,23,10,1,11,12,3,13,14,25,26,6,27,28,9,15,16,17,2,20,37,38,39])).then(e=>({default:e.BlockStudio}))),uj=p.lazy(()=>Ae(()=>import("./BusinessArtifactView-CqV4i9l_.js"),__vite__mapDeps([40,25,26,6,27,28])).then(e=>({default:e.BusinessArtifactView}))),pj=p.lazy(()=>Ae(()=>import("./LineageDetailView-C964BLuV.js"),__vite__mapDeps([41,25,26,6,27,28,42,35,16])).then(e=>({default:e.LineageDetailView}))),fj=p.lazy(()=>Ae(()=>import("./LineageDAG-OMUP2sbl.js"),__vite__mapDeps([42,26,6,27,28])).then(e=>({default:e.LineageDAG}))),hj=p.lazy(()=>Ae(()=>import("./HelpDocsPage-Hbh9IeYB.js"),__vite__mapDeps([43,6])).then(e=>({default:e.HelpDocsPage}))),mj=p.lazy(()=>Ae(()=>Promise.resolve().then(()=>u1),void 0).then(e=>({default:e.ConnectionPanel}))),gj=p.lazy(()=>Ae(()=>import("./GitPage-DjaNp0o3.js"),__vite__mapDeps([44,45,15,6])).then(e=>({default:e.GitPage}))),yj=p.lazy(()=>Ae(()=>import("./ReadinessPage-DEUIXQQY.js"),__vite__mapDeps([46,1,47,48,12,3,2,6])).then(e=>({default:e.ReadinessPage}))),bj=p.lazy(()=>Ae(()=>import("./AgentLogPage-Jbyb4so-.js"),__vite__mapDeps([49,35,14,50,6])).then(e=>({default:e.AgentLogPage}))),xj=p.lazy(()=>Ae(()=>import("./AskTracePage-CSMoMw9a.js"),__vite__mapDeps([51,26,6,27,35,3,31,50])).then(e=>({default:e.AskTracePage}))),vj=p.lazy(()=>Ae(()=>import("./AskObservabilityPage-DracZPI9.js"),__vite__mapDeps([52,37,3,50,2,6])).then(e=>({default:e.AskObservabilityPage}))),Sj=p.lazy(()=>Ae(()=>import("./GovernedContextPage-uXUHUOIJ.js"),__vite__mapDeps([53,3,12,9,10,1,11,13,14,15,16,17,2,54,6])).then(e=>({default:e.GovernedContextPage}))),wj=p.lazy(()=>Ae(()=>import("./DbtFirstModelingPage-JKhB_Y2H.js"),__vite__mapDeps([55,54,9,10,1,11,12,3,13,14,15,16,17,2,26,6,27,28,29,30,39,56,50])).then(e=>({default:e.DbtFirstModelingPage}))),kj=p.lazy(()=>Ae(()=>import("./AppsView-DlNaTuwD.js"),__vite__mapDeps([57,20,17,10,1,11,12,3,13,14,15,35,38,30,4,5,24,8,48,58,56,2,18,6])).then(e=>({default:e.AppsView}))),Cj=p.lazy(()=>Ae(()=>import("./LineageDrawer-CzY0nfpD.js"),__vite__mapDeps([59,25,26,6,27,28,39,15,17,13,58,45])).then(e=>({default:e.LineageDrawer}))),jj=p.lazy(()=>Ae(()=>import("./AiBuildDialog-Du07X1qO.js"),__vite__mapDeps([60,47,11,12,3,13,15,6])).then(e=>({default:e.AiBuildDialog})));function Ej(){const e=Ge(Lr(d=>({appMode:d.appMode,dashboardMode:d.dashboardMode,globalAi:d.globalAi,inspectorOpen:d.inspectorOpen,lineageDrawerOpen:d.lineageDrawerOpen,lineageFullscreen:d.lineageFullscreen,mainView:d.mainView,askTraceRunId:d.askTraceRunId,newBlockModalOpen:d.newBlockModalOpen,newNotebookModalOpen:d.newNotebookModalOpen,setupOpen:d.setupOpen,sidebarOpen:d.sidebarOpen,sidebarPanel:d.sidebarPanel,themeMode:d.themeMode}))),t=jn(),n=Qe[e.themeMode],r=p.useRef({}),o=e.mainView==="block_studio"||e.mainView==="imports",[i,a]=p.useState(!1),[c,l]=p.useState(null);p.useEffect(()=>{let d=!0;return B.getSetupLaunch().then(f=>{d&&(l(f),f.shouldOpen&&t({type:"OPEN_SETUP"}))}).catch(()=>{}),()=>{d=!1}},[t]),p.useEffect(()=>{const d=()=>{const f=Ra(window.location.pathname);(f==null?void 0:f.mainView)==="ask_trace"?t({type:"OPEN_ASK_TRACE",runId:f.runId}):(f==null?void 0:f.mainView)==="ask_observability"?t({type:"OPEN_ASK_OBSERVABILITY"}):t({type:"SET_MAIN_VIEW",view:"ask"})};return window.addEventListener("popstate",d),()=>window.removeEventListener("popstate",d)},[t]),p.useEffect(()=>{const d=()=>t({type:"SET_MAIN_VIEW",view:"modeling"});return window.addEventListener("dql:open-context-proposal",d),()=>window.removeEventListener("dql:open-context-proposal",d)},[t]),p.useEffect(()=>{if(e.mainView==="domains"||e.mainView==="modeling"||e.mainView==="skills")return;const d=tj(window.location.href),f=`${window.location.pathname}${window.location.search}${window.location.hash}`;d!==f&&window.history.replaceState(window.history.state,"",d)},[e.mainView]),GC(),YC(),p.useEffect(()=>{const d=f=>{(f.metaKey||f.ctrlKey)&&f.key.toLowerCase()==="k"&&!f.shiftKey&&(f.preventDefault(),a(m=>!m)),(f.metaKey||f.ctrlKey)&&f.shiftKey&&f.key.toLowerCase()==="i"&&(f.preventDefault(),t({type:"TOGGLE_INSPECTOR"}))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t]);const u=p.useCallback(async d=>{try{if(d.type==="term"||d.type==="business_view"){e.sidebarPanel!=="files"&&t({type:"SET_SIDEBAR_PANEL",panel:"files"}),t({type:"OPEN_BUSINESS_ARTIFACT",file:d});return}if(d.type==="block"){const j=await B.openBlockStudio(d.path);t({type:"OPEN_BLOCK_STUDIO",file:d,payload:j});return}const{content:f}=await B.readNotebook(d.path),{title:m,cells:S,metadata:v}=U1(d.path,f),b=d.path.endsWith(".dqlnb")?await B.fetchRunSnapshot(d.path):null;let w=S;if(b!=null&&b.found&&b.snapshot){const j=new Map(b.snapshot.cells.map(C=>[C.cellId,C]));w=S.map(C=>{const x=j.get(C.id);return x?{...C,status:x.status??C.status,result:x.result??C.result,error:x.error??C.error,executionCount:x.executionCount??C.executionCount,execution:x.execution??C.execution,fromSnapshot:x.result!=null}:C})}t({type:"OPEN_FILE",file:d,cells:w,title:m,metadata:v}),e.sidebarPanel!=="files"&&t({type:"SET_SIDEBAR_PANEL",panel:"files"})}catch(f){if(console.error("Failed to open file:",f),d.type==="block")try{const{content:m}=await B.readNotebook(d.path);t({type:"OPEN_BLOCK_STUDIO",file:d,payload:{path:d.path,source:m,companionPath:null,metadata:{name:d.name.replace(/\.dql$/i,""),path:d.path,domain:d.path.split("/").slice(1,-1).join("/")||"uncategorized",description:"",owner:"",tags:[]},validation:{valid:!1,diagnostics:[{severity:"warning",message:"Opened block without studio metadata. Save once to normalize it."}],semanticRefs:{metrics:[],dimensions:[],segments:[]}}}});return}catch(m){console.error("Failed to open block fallback:",m)}else t({type:"OPEN_FILE",file:d,cells:[Oa("sql")],title:d.name})}},[t,e.sidebarPanel]);p.useCallback(d=>{const f=r.current[d];f&&f.scrollIntoView({behavior:"smooth",block:"start"})},[]);const h=p.useCallback((d,f)=>{f?r.current[d]=f:delete r.current[d]},[]);return s.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh",width:"100vw",background:n.appBg,fontFamily:n.font,color:n.textPrimary,overflow:"hidden"},children:[s.jsx(zC,{}),s.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[e.appMode==="studio"&&s.jsx(Qw,{}),e.appMode==="studio"&&e.sidebarOpen&&!o&&s.jsx(M1,{onOpenFile:u}),s.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minWidth:0},children:s.jsx(p.Suspense,{fallback:s.jsx(Tj,{t:n}),children:e.mainView==="home"?s.jsx(rj,{}):e.mainView==="ask"?s.jsx(oj,{}):e.mainView==="business_artifact"?s.jsx(uj,{}):e.mainView==="lineage"?s.jsx("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:s.jsx(fj,{})}):e.mainView==="lineage_detail"?s.jsx(pj,{}):e.mainView==="help"?s.jsx(hj,{}):e.mainView==="connection"||e.mainView==="settings"?s.jsx(Rj,{children:s.jsx(mj,{variant:"page"})}):e.mainView==="git"?s.jsx(gj,{}):e.mainView==="readiness"?s.jsx(yj,{}):e.mainView==="skills"?s.jsx(Sj,{initialTab:"skills"}):e.mainView==="domains"||e.mainView==="modeling"?s.jsx(wj,{}):e.mainView==="apps"?s.jsx(kj,{}):e.mainView==="agent_log"?s.jsx(Oj,{title:"Agent steps",description:"What the agent did to answer this question, and where the time went — route, tools, checks, and per-step timing.",children:s.jsx(bj,{})}):e.mainView==="ask_observability"?s.jsx(vj,{}):e.mainView==="ask_trace"&&e.askTraceRunId?s.jsx(xj,{runId:e.askTraceRunId}):s.jsx(s.Fragment,{children:e.mainView==="imports"||e.mainView==="block_studio"?s.jsx(dj,{},"block-editor"):s.jsxs(s.Fragment,{children:[s.jsx(ij,{onOpenFile:u,registerCellRef:h}),e.appMode==="studio"&&s.jsx(VC,{})]})})})}),e.appMode==="studio"&&e.lineageDrawerOpen&&!e.lineageFullscreen&&!e.dashboardMode&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(Cj,{})}),e.appMode==="studio"&&e.inspectorOpen&&!e.lineageFullscreen&&!e.lineageDrawerOpen&&!e.dashboardMode&&s.jsx(Lw,{}),e.globalAi.open&&e.mainView==="apps"&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(sj,{})})]}),e.newNotebookModalOpen&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(aj,{onFileOpened:u})}),e.newBlockModalOpen&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(cj,{onFileOpened:u})}),s.jsx(ow,{open:i,onClose:()=>a(!1)}),s.jsx(p.Suspense,{fallback:null,children:s.jsx(jj,{})}),e.setupOpen&&s.jsx(p.Suspense,{fallback:s.jsx(Aj,{t:n}),children:s.jsx(lj,{launch:c!=null&&c.shouldOpen?c:void 0,onAcknowledged:()=>l(d=>d&&{...d,shouldOpen:!1,reason:null})})})]})}function Tj({t:e}){return s.jsx("div",{role:"status","aria-live":"polite",style:{flex:1,minWidth:0,display:"grid",placeItems:"center",background:e.appBg,color:e.textSecondary,fontFamily:e.font},children:s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,fontSize:12.5},children:[s.jsx("span",{style:{width:8,height:8,borderRadius:999,background:e.accent}}),"Loading workspace…"]})})}function Aj({t:e}){return s.jsx("div",{role:"status","aria-live":"polite",style:{position:"fixed",inset:0,zIndex:1100,display:"grid",placeItems:"center",background:e.appBg,color:e.textSecondary,fontFamily:e.font},children:s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,fontSize:12.5},children:[s.jsx("span",{style:{width:8,height:8,borderRadius:999,background:e.accent}}),"Checking workspace setup…"]})})}function Rj({children:e}){return s.jsx("div",{style:{flex:1,minWidth:0,overflow:"auto"},children:s.jsx("div",{style:{maxWidth:1120,margin:"0 auto",padding:"18px 28px 32px"},children:e})})}function Oj({title:e,description:t,children:n}){return s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,overflow:"hidden"},children:[s.jsxs("div",{style:{padding:"18px 24px 12px",borderBottom:"1px solid rgba(127, 127, 127, 0.16)"},children:[s.jsx("div",{style:{fontSize:22,fontWeight:700},children:e}),s.jsx("div",{style:{fontSize:13,opacity:.72,marginTop:6,maxWidth:760,lineHeight:1.5},children:t})]}),s.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:n})]})}function _j(){const e=jn(),t=Yi(),n=p.useRef(null);p.useEffect(()=>{let r=!0,o=null,i=null,a=null,c=null;const l=()=>{i&&clearTimeout(i),i=setTimeout(()=>{i=null,B.listNotebooks().then(f=>{r&&(t.setQueryData(["notebooks"],f),e({type:"SET_FILES",files:f}))}).catch(()=>{})},150)},u=()=>{a&&clearTimeout(a),a=setTimeout(()=>{a=null,B.getDomains().then(({domains:f})=>{r&&(t.setQueryData(["authored-domains"],{domains:f}),e({type:"SET_AUTHORED_DOMAINS",domains:f}))}).catch(()=>{})},150)},h=()=>{c&&clearTimeout(c),c=setTimeout(()=>{c=null,e({type:"SET_SEMANTIC_LOADING",loading:!0}),B.getSemanticLayer().then(f=>{r&&(t.setQueryData(["semantic-layer"],f),e({type:"SET_SEMANTIC_LAYER",layer:f}))}).catch(()=>{})},100)},d=()=>{if(!r)return;const f=new AbortController;n.current=f,Ap("/api/watch",m=>{if(m.event==="change")try{const S=JSON.parse(m.data);if(S.type==="file-added"||S.type==="file-deleted"||S.type==="file-changed"){const v=S.path??"";/^(?:notebooks|workbooks|blocks|skills|apps|dashboards)\//.test(v)&&l(),v.startsWith("domains/")&&(l(),u())}S.type==="semantic-reload"&&h()}catch{}},f.signal).catch(()=>{!r||f.signal.aborted||(o&&clearTimeout(o),o=setTimeout(d,5e3))})};return d(),()=>{var f;r=!1,o&&clearTimeout(o),i&&clearTimeout(i),a&&clearTimeout(a),c&&clearTimeout(c),(f=n.current)==null||f.abort(),n.current=null}},[e,t])}const Pj=new lh({defaultOptions:{queries:{staleTime:15e3,gcTime:5*6e4,retry:1,refetchOnWindowFocus:!1}}});function Ij(){const e=Ge(i=>i.themeMode),t=Ge(i=>i.dispatch),n=Qe[e];p.useEffect(()=>{const i="dql-global-styles";let a=document.getElementById(i);a||(a=document.createElement("style"),a.id=i,document.head.appendChild(a)),a.textContent=`
615
+ </html>`}function xC(e,t){const n=bC(e,t),r=new Blob([n],{type:"text/html;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`${e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}-dashboard.html`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}const vC=new Set(["succeeded","failed","cancelled","interrupted"]);function Ir(e){return vC.has(e.status)}function SC(e,t){if(e.id!==t.id)return t;const n=Ir(e),r=Ir(t);return n&&!r||t.updatedAt<e.updatedAt?e:t.updatedAt>e.updatedAt?t:n!==r?r?t:e:t.progress!==e.progress?t.progress>e.progress?t:e:t}function eo(e,t){const n=e.find(o=>o.id===t.id),r=n?SC(n,t):t;return AC([...e.filter(o=>o.id!==t.id),r])}function wC(e,t){return t.reduce(eo,e)}function kC(e){return e.filter(t=>!Ir(t)).map(t=>t.id)}function CC(e,t){for(const n of kC(t))e.add(n)}async function jC(e,t,n){await Promise.all([...e].map(async r=>{try{const o=await t(r);if(n(o)===!1)return;Ir(o)&&e.delete(r)}catch{}}))}function EC(e,t=new Set){return e.filter(n=>n.type==="block_certification"&&n.status==="succeeded").filter(n=>!t.has(n.id)).filter(n=>{const r=n.result;return!!(r!=null&&r.block&&r.outcome)}).sort((n,r)=>n.updatedAt.localeCompare(r.updatedAt)||n.createdAt.localeCompare(r.createdAt)||n.id.localeCompare(r.id))}function vE(e,t){var o;if(t.operationId){const i=e.find(a=>a.type==="block_certification"&&a.id===t.operationId);if(i)return i}const n=Vr(t.activePath),r=(o=t.sourceFingerprint)==null?void 0:o.trim();return e.filter(i=>i.type==="block_certification").filter(i=>{const a=TC(i),c=[Vr(i.scope.startsWith("block:")?i.scope.slice(6):void 0),Vr(a==null?void 0:a.oldPath),Vr(a==null?void 0:a.draftPath),Vr(a==null?void 0:a.newPath)].filter(h=>!!h),l=!!(n&&c.includes(n)),u=!!(r&&i.resourceRevision&&(i.resourceRevision===r||i.resourceRevision.startsWith(`${r}:`)));return l||u}).sort((i,a)=>a.updatedAt.localeCompare(i.updatedAt)||a.createdAt.localeCompare(i.createdAt))[0]}function TC(e){return e.result&&typeof e.result=="object"&&!Array.isArray(e.result)?e.result:void 0}function Vr(e){if(!(typeof e!="string"||!e.trim()))return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}function AC(e,t=50){let n=0;return[...e].sort((r,o)=>o.updatedAt.localeCompare(r.updatedAt)||o.createdAt.localeCompare(r.createdAt)||o.id.localeCompare(r.id)).filter(r=>Ir(r)?(n+=1,n<=t):!0)}const ir=["local-operations"],hf=p.createContext(null);function RC({children:e}){const t=Yi(),n=p.useRef(new Set),r=p.useRef(new Set),o=Ge(l=>l.dispatch),i=Ri({queryKey:ir,queryFn:async()=>{const l=(await B.listOperations(50)).operations,u=t.getQueryData(ir)??[];return wC(u,l)},staleTime:15e3,refetchOnWindowFocus:!1,refetchInterval:1500}),a=i.data??[];p.useEffect(()=>{let l=!0,u,h;const d=()=>{h=new AbortController,Ap("/api/operations/events",f=>{if(f.event==="operation")try{const m=JSON.parse(f.data);t.setQueryData(ir,(S=[])=>eo(S,m))}catch{}},h.signal).catch(()=>{!l||h!=null&&h.signal.aborted||(u=setTimeout(d,5e3))})};return d(),()=>{l=!1,u&&clearTimeout(u),h==null||h.abort()}},[t]),p.useEffect(()=>{CC(r.current,a)},[a]),p.useEffect(()=>{let l=!0,u=!1;const h=async()=>{if(!(u||r.current.size===0)){u=!0;try{await jC(r.current,f=>B.getOperation(f),f=>{if(!l)return!1;t.setQueryData(ir,(m=[])=>eo(m,f))})}finally{u=!1}}};h();const d=window.setInterval(()=>void h(),1e3);return()=>{l=!1,window.clearInterval(d)}},[t]),p.useEffect(()=>{for(const l of EC(a,n.current)){const u=l.result;n.current.add(l.id),o({type:"RECONCILE_BLOCK_CERTIFICATION",outcome:u.outcome,oldPath:u.oldPath,draftPath:u.draftPath,newPath:u.newPath,payload:u.block}),window.dispatchEvent(new CustomEvent("dql:block-library-invalidated",{detail:{operationId:l.id,outcome:u.outcome}}))}},[o,a]);const c=p.useMemo(()=>({operations:a,activeCount:a.filter(l=>l.status==="queued"||l.status==="running").length,loading:i.isLoading,cancel:async l=>{const u=await B.cancelOperation(l);r.current.delete(l),t.setQueryData(ir,(h=[])=>eo(h,u))},track:l=>{Ir(l)?r.current.delete(l.id):r.current.add(l.id),t.setQueryData(ir,(u=[])=>eo(u,l))}}),[a,i.isLoading,t]);return s.jsx(hf.Provider,{value:c,children:e})}function OC(){const e=p.useContext(hf);if(!e)throw new Error("useOperations must be used inside OperationsProvider.");return e}const _C=new Set(["succeeded","failed","cancelled","interrupted"]);function PC(e,t=8){const n=IC(e).filter(o=>!_C.has(o.status)||o.type!=="project_refresh"),r=n.map(mf);return{operations:n.slice(0,t),activeCount:r.filter(o=>o.active).length,attentionCount:r.filter(o=>o.tone==="attention").length}}function IC(e){const t=e.filter(l=>l.type==="block_certification"),n=t.map((l,u)=>u),r=new Map,o=l=>{let u=l;for(;n[u]!==u;)n[u]=n[n[u]],u=n[u];return u},i=(l,u)=>{const h=o(l),d=o(u);h!==d&&(n[d]=h)};t.forEach((l,u)=>{for(const h of DC(l)){const d=r.get(h);d===void 0?r.set(h,u):i(u,d)}});const a=new Map;t.forEach((l,u)=>{const h=o(u),d=a.get(h);(!d||$C(l,d)<0)&&a.set(h,l)});const c=new Set([...a.values()].map(l=>l.id));return e.filter(l=>l.type!=="block_certification"||c.has(l.id))}function mf(e){var n,r,o,i,a,c;if(e.status==="queued"||e.status==="running")return{active:!0,tone:"active",statusLabel:e.status,message:e.message,guidance:e.type==="block_certification"?"You can change pages while certification continues.":void 0};if(e.type==="block_certification"&&e.status==="succeeded"){const l=e.result;if((l==null?void 0:l.outcome)==="draft_saved_with_blockers"){const u=((r=(n=l.checklist)==null?void 0:n.issues)==null?void 0:r.length)??((o=l.blockers)==null?void 0:o.length)??((i=l.checklist)==null?void 0:i.blockers.length)??0;return{active:!1,tone:"attention",statusLabel:"needs attention",message:u>0?`Draft saved with ${u} certification blocker${u===1?"":"s"}.`:"Draft saved, but certification requirements are not ready.",guidance:"Open Block Studio to review the exact fixes and retry."}}if((l==null?void 0:l.outcome)==="certified")return{active:!1,tone:"success",statusLabel:"certified",message:"The block passed its required gates and was certified."}}return e.status==="failed"||e.status==="interrupted"?{active:!1,tone:"failure",statusLabel:e.status,message:((a=e.error)==null?void 0:a.message)??e.message,guidance:e.type==="block_certification"?"The saved draft is preserved for review or retry.":void 0}:e.status==="cancelled"?{active:!1,tone:"neutral",statusLabel:"cancelled",message:e.message}:{active:!1,tone:e.status==="succeeded"?"success":"neutral",statusLabel:e.status,message:((c=e.error)==null?void 0:c.message)??e.message}}function DC(e){const t=hi(e.result),n=hi(t==null?void 0:t.block),r=hi(n==null?void 0:n.metadata),o=e.scope.startsWith("block:")?e.scope.slice(6):void 0;return Array.from(new Set([ar(n==null?void 0:n.path),ar(r==null?void 0:r.path),ar(t==null?void 0:t.oldPath),ar(t==null?void 0:t.draftPath),ar(t==null?void 0:t.newPath),ar(o)].filter(i=>!!i)))}function hi(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function ar(e){if(!(typeof e!="string"||!e.trim()))return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}function $C(e,t){return t.createdAt.localeCompare(e.createdAt)||t.updatedAt.localeCompare(e.updatedAt)||t.id.localeCompare(e.id)}function MC(){const e=Ge(d=>d.themeMode),t=Qe[e],{operations:n,loading:r,cancel:o}=OC(),[i,a]=p.useState(!1),c=p.useRef(null),{operations:l,activeCount:u,attentionCount:h}=PC(n);return p.useEffect(()=>{if(!i)return;const d=m=>{c.current&&!c.current.contains(m.target)&&a(!1)},f=m=>{m.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",d),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f)}},[i]),!r&&l.length===0?null:s.jsxs("div",{ref:c,style:{position:"relative"},children:[s.jsxs("button",{type:"button","aria-label":"Background tasks","aria-expanded":i,onClick:()=>a(d=>!d),style:{height:28,padding:"0 9px",borderRadius:6,border:`1px solid ${u>0?t.accent:h>0?t.warning:t.btnBorder}`,background:i?t.btnHover:t.btnBg,color:t.textSecondary,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6,fontFamily:t.font,fontSize:11,fontWeight:600},children:[s.jsx("span",{"aria-hidden":"true",style:{width:7,height:7,borderRadius:999,background:u>0?t.accent:h>0?t.warning:t.success,boxShadow:u>0?`0 0 0 3px ${t.accent}20`:"none"}}),u>0?`${u} running`:h>0?`${h} needs attention`:"Tasks"]}),i&&s.jsxs("div",{role:"dialog","aria-label":"Background tasks",style:{position:"absolute",top:34,right:0,zIndex:1200,width:340,maxHeight:420,overflowY:"auto",background:t.modalBg,border:`1px solid ${t.cellBorder}`,borderRadius:9,boxShadow:"0 14px 36px rgba(0,0,0,0.28)",padding:8},children:[s.jsx("div",{style:{padding:"4px 6px 8px",color:t.textPrimary,fontSize:12,fontWeight:700},children:"Background tasks"}),l.map(d=>{const f=mf(d),m=f.active,S=f.tone==="failure"?t.error:f.tone==="attention"?t.warning:f.tone==="success"?t.success:t.textMuted;return s.jsxs("div",{style:{padding:"9px 8px",borderTop:`1px solid ${t.headerBorder}`,display:"flex",flexDirection:"column",gap:6},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("span",{style:{flex:1,color:t.textPrimary,fontSize:11.5,fontWeight:650},children:LC(d.type)}),s.jsx("span",{style:{color:S,fontSize:10},children:f.statusLabel})]}),s.jsx("div",{style:{color:f.tone==="failure"?t.error:f.tone==="attention"?t.warning:t.textSecondary,fontSize:10.5,lineHeight:1.4},children:f.message}),m&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("div",{style:{flex:1,height:3,borderRadius:99,overflow:"hidden",background:t.headerBorder},children:s.jsx("div",{style:{width:`${Math.max(3,d.progress)}%`,height:"100%",background:t.accent,transition:"width 180ms ease"}})}),d.cancellable&&s.jsx("button",{type:"button",onClick:()=>void o(d.id),style:{border:0,background:"transparent",color:t.textMuted,cursor:"pointer",fontSize:10,padding:0},children:"Cancel"})]}),d.type==="block_certification"&&s.jsx("div",{style:{color:t.textMuted,fontSize:9.5},children:f.guidance??(f.tone==="success"?"Certification is complete.":"The saved draft is preserved for review or retry.")}),(d.type==="agent_run"||d.type==="app_ai_build")&&s.jsx("div",{style:{color:t.textMuted,fontSize:9.5},children:m?"This continues while you work on another page.":d.status==="succeeded"?"Completed in the background.":"Open the original surface to review or retry."})]},d.id)})]})]})}function LC(e){return e==="block_certification"?"Block certification":e==="project_refresh"?"Project metadata refresh":e==="agent_run"?"AI request":e==="app_ai_build"?"App proposal":e.replace(/_/g," ")}const rs=new Map;function NC(e,t){let n=rs.get(e);n||(n={running:!1},rs.set(e,n));const r=n,o=new Promise((i,a)=>{r.pending?(r.pending.content=t,r.pending.waiters.push({resolve:i,reject:a})):r.pending={content:t,waiters:[{resolve:i,reject:a}]}});return r.running||(r.running=!0,(async()=>{for(;r.pending;){const i=r.pending;r.pending=void 0;try{await B.saveNotebook(e,i.content);for(const a of i.waiters)a.resolve()}catch(a){for(const c of i.waiters)c.reject(a)}}})().finally(()=>{r.running=!1,r.pending||rs.delete(e)})),o}function BC(e){const t=rs.get(e);return!!(t!=null&&t.running||t!=null&&t.pending)}function FC({t:e}){return s.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:s.jsx("span",{style:{color:"#ffffff",fontSize:10,fontWeight:700,fontFamily:e.fontMono,letterSpacing:"-0.5px"},children:"DQL"})})}function zC(){var ne;const e=Ge(Lr(F=>({activeBlockPath:F.activeBlockPath,activeFile:F.activeFile,appMode:F.appMode,autoSave:F.autoSave,blockStudioDirty:F.blockStudioDirty,blockStudioDraft:F.blockStudioDraft,blockStudioMetadata:F.blockStudioMetadata,cells:F.cells,files:F.files,mainView:F.mainView,notebookDirty:F.notebookDirty,notebookMetadata:F.notebookMetadata,notebookTitle:F.notebookTitle,savingFile:F.savingFile,themeMode:F.themeMode}))),t=jn(),n=Qe[e.themeMode],{executeAll:r}=ff(),[o,i]=p.useState(!1),[a,c]=p.useState(""),[l,u]=p.useState(!1),[h,d]=p.useState(!1),[f,m]=p.useState(!1),[S,v]=p.useState(!1),[b,w]=p.useState(!1),j=p.useRef(null),[C,x]=p.useState(!1),[E,P]=p.useState(!1),A=p.useRef(null),g=p.useRef(null),I=e.mainView==="block_studio"?e.blockStudioDirty:e.notebookDirty,T=e.mainView==="notebook",O=e.mainView==="notebook"||e.mainView==="block_studio",_=O&&!!e.activeFile,M={home:"Home",business_artifact:((ne=e.activeFile)==null?void 0:ne.name.replace(/\.(dqlnb|dql)$/i,""))??"Business Definition",lineage:"Lineage",lineage_detail:"Lineage",connection:"Settings",apps:"Apps",git:"Source control",settings:"Settings",imports:"Import SQL",domains:"Modeling",modeling:"Modeling"},q=O?e.activeFile?e.notebookTitle||"Untitled":e.mainView==="block_studio"?"Blocks":"Notebooks":M[e.mainView]??"DQL Workbench";p.useEffect(()=>{o&&g.current&&(g.current.focus(),g.current.select())},[o]),p.useEffect(()=>{if(!E)return;function F(K){A.current&&!A.current.contains(K.target)&&P(!1)}return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[E]);const G=()=>{c(e.notebookTitle),i(!0)},J=()=>{i(!1),a.trim()&&a!==e.notebookTitle&&(e.mainView==="block_studio"&&e.blockStudioMetadata?(t({type:"SET_BLOCK_STUDIO_METADATA",metadata:{...e.blockStudioMetadata,name:a.trim()}}),t({type:"SET_BLOCK_STUDIO_DRAFT",draft:tC(e.blockStudioDraft,a.trim())})):t({type:"SET_NOTEBOOK_DIRTY",dirty:!0}))},H=p.useCallback(async()=>{var K,oe,ee;const F=In.getState();if(F.activeFile){t({type:"SET_SAVING",saving:!0});try{if(F.mainView==="block_studio"){if(!F.blockStudioMetadata)return;const ce=await B.saveBlockStudio({path:F.activeBlockPath,source:F.blockStudioDraft,metadata:{name:F.blockStudioMetadata.name,domain:F.blockStudioMetadata.domain,folderPath:F.blockStudioMetadata.folderPath,description:F.blockStudioMetadata.description,owner:F.blockStudioMetadata.owner,tags:F.blockStudioMetadata.tags}});t({type:"OPEN_BLOCK_STUDIO",file:{name:`${ce.metadata.name}.dql`,path:ce.path,type:"block",folder:"blocks"},payload:ce}),F.files.some(ke=>ke.path===ce.path)||t({type:"FILE_ADDED",file:{name:`${ce.metadata.name}.dql`,path:ce.path,type:"block",folder:"blocks"}})}else{const ce=F.activeFile,ke=F.cells,xe=F.notebookTitle,De=F.notebookMetadata,We=ce.type==="block"?((K=ke[0])==null?void 0:K.content)??"":q1(xe,ke,De);await NC(ce.path,We);const Be=In.getState();((oe=Be.activeFile)==null?void 0:oe.path)===ce.path&&Be.cells===ke&&Be.notebookTitle===xe&&Be.notebookMetadata===De&&t({type:"SET_NOTEBOOK_DIRTY",dirty:!1})}u(!0),setTimeout(()=>u(!1),2e3)}catch(ce){console.error("Save failed:",ce)}finally{const ce=(ee=In.getState().activeFile)==null?void 0:ee.path;(!ce||!BC(ce))&&t({type:"SET_SAVING",saving:!1})}}},[t]);p.useEffect(()=>{const F=K=>{(K.metaKey||K.ctrlKey)&&K.key==="s"&&(K.preventDefault(),H())};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[H]),p.useEffect(()=>{if(!e.autoSave||!I||!e.activeFile||e.mainView==="block_studio")return;const F=setTimeout(()=>{H()},750);return()=>clearTimeout(F)},[e.autoSave,I,e.activeFile,e.cells,e.blockStudioDraft,H]);const L=[{mode:"obsidian",label:"Obsidian",glyph:"●",swatch:"#0d0e11"},{mode:"paper",label:"Paper",glyph:"☼",swatch:"#f7f4ed"},{mode:"white",label:"White",glyph:"○",swatch:"#ffffff"}],$=e.themeMode==="dark"||e.themeMode==="midnight"?"obsidian":e.themeMode==="light"?"paper":e.themeMode==="arctic"?"white":e.themeMode,X=L.find(F=>F.mode===$)??L[0];p.useEffect(()=>{if(!b)return;const F=oe=>{j.current&&!j.current.contains(oe.target)&&w(!1)},K=oe=>{oe.key==="Escape"&&w(!1)};return document.addEventListener("mousedown",F),document.addEventListener("keydown",K),()=>{document.removeEventListener("mousedown",F),document.removeEventListener("keydown",K)}},[b]);const W={height:28,padding:"0 10px",borderRadius:6,border:`1px solid ${n.btnBorder}`,cursor:"pointer",fontSize:12,fontWeight:500,fontFamily:n.font,display:"flex",alignItems:"center",gap:4,transition:"background 0.15s, color 0.15s",whiteSpace:"nowrap"};return s.jsxs("div",{style:{height:48,flexShrink:0,background:n.headerBg,borderBottom:`1px solid ${n.headerBorder}`,display:"flex",alignItems:"center",padding:"0 12px",gap:8,userSelect:"none"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[s.jsx(FC,{t:n}),s.jsx("div",{style:{width:1,height:20,background:n.headerBorder,flexShrink:0}}),e.activeFile&&O&&s.jsx("span",{style:{fontSize:10,fontWeight:600,color:e.activeFile.type==="block"?"#e3b341":n.accent,background:`${e.activeFile.type==="block"?"#e3b341":n.accent}18`,borderRadius:4,padding:"2px 6px",fontFamily:n.font,textTransform:"uppercase",letterSpacing:"0.05em",flexShrink:0},children:e.activeFile.type}),e.activeFile&&O?o?s.jsx("input",{ref:g,value:a,onChange:F=>c(F.target.value),onBlur:J,onKeyDown:F=>{F.key==="Enter"&&J(),F.key==="Escape"&&i(!1)},style:{background:"transparent",border:`1px solid ${n.cellBorderActive}`,borderRadius:4,color:n.textPrimary,fontSize:13,fontWeight:500,fontFamily:n.font,padding:"2px 6px",outline:"none",minWidth:120,maxWidth:320}}):s.jsxs("span",{onClick:G,title:"Click to rename",style:{color:n.textPrimary,fontSize:13,fontWeight:500,fontFamily:n.font,cursor:"text",maxWidth:320,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"2px 4px",borderRadius:4,border:"1px solid transparent"},children:[q,I&&s.jsx("span",{style:{color:n.textMuted,marginLeft:4},children:"●"})]}):s.jsx("span",{style:{color:n.textSecondary,fontSize:13,fontFamily:n.font,padding:"2px 4px"},children:q||"DQL Workbench"})]}),s.jsx("div",{style:{flex:1}}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsx(MC,{}),e.appMode==="studio"&&_&&e.mainView!=="block_studio"&&s.jsx(s.Fragment,{children:s.jsxs("button",{onClick:T?r:void 0,disabled:!e.activeFile||!T,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...W,height:30,padding:"0 14px",borderRadius:999,background:n.accent,color:"#ffffff",border:`1px solid ${n.accent}`,opacity:!e.activeFile||!T?.4:h?.9:1,boxShadow:"0 1px 2px rgba(107,93,211,0.25)",gap:6},children:[s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",children:s.jsx("path",{d:"M1.5 1.5l7 3.5-7 3.5V1.5Z"})}),"Run all"]})}),s.jsxs("div",{ref:j,style:{position:"relative"},children:[s.jsxs("button",{onClick:()=>w(F=>!F),onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),title:`Theme: ${X.label}`,"aria-haspopup":"true","aria-expanded":b,style:{...W,background:S||b?n.btnHover:n.btnBg,color:n.textSecondary,padding:"0 10px",fontSize:12,display:"flex",alignItems:"center",gap:6},children:[s.jsx("span",{style:{width:12,height:12,borderRadius:3,background:X.swatch,border:`1px solid ${n.headerBorder}`,flexShrink:0}}),s.jsx("span",{style:{fontFamily:n.fontMono,fontSize:10,letterSpacing:"0.04em"},children:X.label}),s.jsx("span",{style:{fontSize:8,color:n.textMuted},children:"▾"})]}),b&&s.jsx("div",{role:"menu",style:{position:"absolute",top:"100%",right:0,marginTop:4,minWidth:160,background:n.headerBg,border:`1px solid ${n.headerBorder}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.32)",padding:4,zIndex:1e3,display:"flex",flexDirection:"column",gap:1},children:L.map(F=>{const K=F.mode===$;return s.jsxs("button",{role:"menuitemradio","aria-checked":K,onClick:()=>{t({type:"SET_THEME",mode:F.mode}),w(!1)},style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",border:"none",background:K?n.btnHover:"transparent",color:n.textPrimary,cursor:"pointer",borderRadius:4,fontSize:12,fontFamily:n.font,textAlign:"left"},onMouseEnter:oe=>{K||(oe.currentTarget.style.background=n.btnHover)},onMouseLeave:oe=>{K||(oe.currentTarget.style.background="transparent")},children:[s.jsx("span",{style:{width:14,height:14,borderRadius:3,background:F.swatch,border:`1px solid ${n.headerBorder}`,flexShrink:0}}),s.jsx("span",{style:{flex:1},children:F.label}),K&&s.jsx("span",{style:{color:n.accent,fontSize:11},children:"✓"})]},F.mode)})})]}),e.appMode==="studio"&&_&&e.mainView!=="block_studio"&&s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:H,disabled:!e.activeFile||e.savingFile,onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),title:"Save (Cmd+S)",style:{...W,background:f&&e.activeFile?n.btnHover:n.btnBg,color:l?n.success:n.textSecondary,opacity:e.activeFile?1:.4},children:e.savingFile?s.jsxs(s.Fragment,{children:[s.jsx(UC,{}),"Saving…"]}):l?s.jsx(s.Fragment,{children:"✓ Saved"}):s.jsx(s.Fragment,{children:"Save"})}),s.jsx("div",{style:{width:1,height:20,background:n.headerBorder}})]}),_&&e.mainView!=="block_studio"&&s.jsxs("div",{ref:A,style:{position:"relative"},children:[s.jsxs("button",{onClick:()=>{e.activeFile&&P(F=>!F)},disabled:!e.activeFile,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),title:"Share / export",style:{...W,height:30,padding:"0 14px",borderRadius:999,background:(C||E)&&e.activeFile?"#2a2a30":"#1a1a1a",color:"#ffffff",border:"1px solid #1a1a1a",opacity:e.activeFile?1:.4,gap:6},children:[s.jsx("svg",{width:"11",height:"11",viewBox:"0 0 16 16",fill:"currentColor",children:s.jsx("path",{d:"M5.5 10.75a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75Zm0-3a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75ZM3 3.75A1.75 1.75 0 0 1 4.75 2h6.586c.464 0 .909.184 1.237.513l1.914 1.914c.329.328.513.773.513 1.237v6.586A1.75 1.75 0 0 1 13.25 14h-8.5A1.75 1.75 0 0 1 3 12.25Z"})}),"Share",s.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"currentColor",style:{marginLeft:1,opacity:.7},children:s.jsx("path",{d:"M1 2.5l3 3 3-3",stroke:"currentColor",fill:"none",strokeWidth:"1.2",strokeLinecap:"round"})})]}),E&&s.jsx("div",{style:{position:"absolute",top:32,right:0,zIndex:200,background:n.modalBg,border:`1px solid ${n.cellBorder}`,borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.3)",padding:4,minWidth:160,display:"flex",flexDirection:"column",gap:2},children:s.jsx(qC,{label:"Export HTML",description:"Standalone dashboard",t:n,onClick:()=>{xC(e.notebookTitle||"dashboard",e.cells),P(!1)}})})]})]})]})}function qC({label:e,description:t,t:n,onClick:r}){const[o,i]=p.useState(!1);return s.jsxs("button",{onClick:r,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{background:o?n.btnHover:"transparent",border:"none",borderRadius:5,cursor:"pointer",padding:"6px 10px",textAlign:"left",display:"flex",flexDirection:"column",gap:1,transition:"background 0.12s"},children:[s.jsx("span",{style:{fontSize:12,fontWeight:500,color:n.textPrimary,fontFamily:n.font},children:e}),s.jsx("span",{style:{fontSize:10,color:n.textMuted,fontFamily:n.font},children:t})]})}function UC(){return s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{animation:"spin 0.8s linear infinite"},children:[s.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"}),s.jsx("circle",{cx:"6",cy:"6",r:"4.5",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"14 7"})]})}function WC(e){return e.toTimeString().slice(0,8)}function KC(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}function VC(){const{state:e,dispatch:t}=et(),n=Qe[e.themeMode],[r,o]=p.useState(!1),i=e.queryLog.filter(c=>c.error),a=c=>t({type:"SET_DEV_PANEL_TAB",tab:c});return s.jsxs("div",{style:{height:e.devPanelOpen?180:0,flexShrink:0,background:n.sidebarBg,borderTop:`1px solid ${n.headerBorder}`,display:"flex",flexDirection:"column",overflow:"hidden",transition:"height 0.2s ease",position:"relative"},children:[e.devPanelOpen&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{height:32,flexShrink:0,display:"flex",alignItems:"center",borderBottom:`1px solid ${n.headerBorder}`,padding:"0 8px",gap:2},children:[["logs","errors"].map(c=>s.jsx(HC,{label:c==="errors"?`Errors${i.length>0?` (${i.length})`:""}`:`Logs (${e.queryLog.length})`,active:e.devPanelTab===c,onClick:()=>a(c),t:n},c)),s.jsx("div",{style:{flex:1}}),s.jsx("button",{onClick:()=>t({type:"SET_CELLS",cells:e.cells}),title:"Clear logs",style:{background:"transparent",borderTop:"none",borderLeft:"none",borderRight:"none",borderBottom:"none",cursor:"pointer",color:n.textMuted,fontSize:11,fontFamily:n.font,padding:"2px 6px",borderRadius:4},children:"Clear"})]}),s.jsxs("div",{style:{flex:1,overflow:"auto",padding:"4px 0"},children:[e.devPanelTab==="logs"&&(e.queryLog.length===0?s.jsx(zl,{t:n,message:"No queries executed yet."}):[...e.queryLog].reverse().map(c=>s.jsx(ql,{entry:c,t:n},c.id))),e.devPanelTab==="errors"&&(i.length===0?s.jsx(zl,{t:n,message:"No errors."}):[...i].reverse().map(c=>s.jsx(ql,{entry:c,t:n},c.id)))]})]}),s.jsxs("button",{onClick:()=>t({type:"TOGGLE_DEV_PANEL"}),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),title:e.devPanelOpen?"Close panel":"Open dev panel",style:{position:"absolute",bottom:e.devPanelOpen?4:-28,right:8,height:22,padding:"0 8px",borderRadius:"4px 4px 0 0",borderTop:`1px solid ${n.headerBorder}`,borderLeft:`1px solid ${n.headerBorder}`,borderRight:`1px solid ${n.headerBorder}`,borderBottom:e.devPanelOpen?`1px solid ${n.sidebarBg}`:`1px solid ${n.headerBorder}`,background:r?n.btnHover:n.sidebarBg,color:n.textMuted,cursor:"pointer",fontSize:11,fontFamily:n.font,display:"flex",alignItems:"center",gap:4,transition:"background 0.15s, bottom 0.2s ease",zIndex:10},children:[s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",children:s.jsx("path",{d:e.devPanelOpen?"M1 7l4-4 4 4":"M1 3l4 4 4-4",strokeWidth:"1.5",stroke:"currentColor",fill:"none"})}),"Dev"]})]})}function HC({label:e,active:t,onClick:n,t:r}){const[o,i]=p.useState(!1);return s.jsx("button",{onClick:n,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{background:"transparent",borderTop:"none",borderLeft:"none",borderRight:"none",borderBottom:t?`2px solid ${r.accent}`:"2px solid transparent",cursor:"pointer",color:t?r.textPrimary:o?r.textSecondary:r.textMuted,fontSize:12,fontFamily:r.font,fontWeight:t?500:400,padding:"4px 8px",height:32,transition:"color 0.15s"},children:e})}function zl({t:e,message:t}){return s.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.textMuted,fontSize:12,fontFamily:e.font,fontStyle:"italic"},children:t})}function ql({entry:e,t}){return s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"3px 12px",fontSize:11,fontFamily:t.fontMono,color:e.error?t.error:t.textSecondary,borderLeft:e.error?`2px solid ${t.error}`:"2px solid transparent"},children:[s.jsx("span",{style:{color:t.textMuted,flexShrink:0},children:WC(e.ts)}),s.jsx("span",{style:{flexShrink:0,color:t.textPrimary,maxWidth:160,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.cellName}),e.error?s.jsx("span",{style:{color:t.error,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.error}):s.jsxs(s.Fragment,{children:[s.jsxs("span",{style:{color:t.textMuted},children:[e.rows.toLocaleString()," rows"]}),s.jsx("span",{style:{color:t.textMuted},children:KC(e.time)})]})]})}function GC(){const{state:e,dispatch:t}=et(),{executeAll:n}=ff();p.useEffect(()=>{const r=o=>{const i=o.metaKey||o.ctrlKey;if(i&&o.key==="b"&&!o.shiftKey){o.preventDefault(),t({type:"TOGGLE_SIDEBAR"});return}if(i&&o.shiftKey&&o.key==="Enter"){o.preventDefault(),e.activeFile&&n();return}if(i&&o.key==="j"&&!o.shiftKey){o.preventDefault(),t({type:"TOGGLE_DEV_PANEL"});return}if(i&&o.key==="d"&&!o.shiftKey){o.preventDefault(),e.activeFile&&t({type:"TOGGLE_DASHBOARD_MODE"});return}if(o.key==="Escape"){if(e.dashboardMode){t({type:"TOGGLE_DASHBOARD_MODE"});return}if(e.newNotebookModalOpen){t({type:"CLOSE_NEW_NOTEBOOK_MODAL"});return}if(e.newBlockModalOpen){t({type:"CLOSE_NEW_BLOCK_MODAL"});return}}};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,n,e.activeFile,e.newNotebookModalOpen,e.newBlockModalOpen,e.dashboardMode])}const QC=600;function JC(e,t){const n=t.filter(r=>r.result||r.error||(r.executionCount??0)>0).map(r=>{var o;return{cellId:r.id,status:r.status,result:r.result,error:r.error,executionCount:r.executionCount,executedAt:((o=r.execution)==null?void 0:o.completedAt)??new Date().toISOString(),execution:r.execution}});return{version:1,notebookPath:e,capturedAt:new Date().toISOString(),cells:n}}function Ul(e){return e.map(t=>{var n,r;return`${t.id}:${((n=t.execution)==null?void 0:n.runId)??""}:${t.executionCount??0}:${((r=t.result)==null?void 0:r.rowCount)??-1}:${t.error??""}`}).join("|")}function YC(){var o;const{state:e}=et(),t=p.useRef(null),n=p.useRef(""),r=p.useRef(null);p.useEffect(()=>{var c;const i=((c=e.activeFile)==null?void 0:c.path)??null;if(!i)return;if(i!==r.current){r.current=i,n.current=Ul(e.cells);return}const a=Ul(e.cells);return a!==n.current&&(n.current=a,t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{const l=JC(i,e.cells);B.saveRunSnapshot(i,l).catch(()=>{})},QC)),()=>{t.current&&(clearTimeout(t.current),t.current=null)}},[e.cells,(o=e.activeFile)==null?void 0:o.path])}const SE="core";function XC(e){var n;const t=e==null?void 0:e.trim();if(t)return((n=t.split("::").at(-1))==null?void 0:n.trim())||void 0}const ZC=[{items:[{id:"diagram",label:"Modeling"},{id:"skills",label:"Skills"},{id:"blocks",label:"Blocks"},{id:"notebooks",label:"Notebooks"},{id:"apps",label:"Apps"}]}],ej=new Set(ZC.flatMap(e=>e.items.map(t=>t.id)));function gf(e){return e!==null&&ej.has(e)}function wE(e,t){const n=new URL(e);return t.domain?n.searchParams.set("domain",t.domain):n.searchParams.delete("domain"),n.searchParams.set("domainSection",t.section),t.modelAreaId?n.searchParams.set("modelArea",t.modelAreaId):n.searchParams.delete("modelArea"),t.selectedId?n.searchParams.set("domainObject",t.selectedId):n.searchParams.delete("domainObject"),`${n.pathname}${n.search}${n.hash}`}function tj(e){const t=new URL(e);for(const n of yf)t.searchParams.delete(n);return`${t.pathname}${t.search}${t.hash}`}const yf=["domain","domainSection","modelArea","domainObject"],kE="dql.domain-studio.location";function CE(e,t){const n=new URL(e).searchParams;if(yf.some(r=>n.has(r))){const r=n.get("domainSection"),o=gf(r)?r:"diagram";return{domain:n.get("domain"),section:o,modelAreaId:n.get("modelArea"),selectedId:r==="diagram"?n.get("domainObject"):null}}return nj(t)}function nj(e){const t={domain:null,section:"diagram",modelAreaId:null,selectedId:null};if(!e)return t;try{const n=JSON.parse(e),r=typeof n.section=="string"&&gf(n.section)?n.section:"diagram",o=i=>typeof i=="string"&&i.trim()?i:null;return{domain:o(n.domain),section:r,modelAreaId:o(n.modelAreaId),selectedId:o(n.selectedId)}}catch{return t}}function jE(e){return`modeling:${e??"all"}`}function EE(e){const t=Object.values(e),n=new Map;for(const a of t){const c=a.parent&&e[a.parent]?a.parent:void 0;n.set(c,[...n.get(c)??[],a])}for(const a of n.values())a.sort((c,l)=>c.id.localeCompare(l.id));const r=[],o=new Set,i=(a,c)=>{for(const l of n.get(a)??[])o.has(l.id)||(o.add(l.id),r.push({id:l.id,parent:l.parent,depth:c,label:c===0?l.id:`${"— ".repeat(c)}${l.id.split(".").at(-1)??l.id}`}),i(l.id,c+1))};i(void 0,0);for(const a of t.sort((c,l)=>c.id.localeCompare(l.id)))o.has(a.id)||r.push({id:a.id,parent:a.parent,depth:0,label:a.id});return r}function TE(e){const t=(e??"").toLowerCase();return t==="dimension"?"var(--status-success)":t==="bridge"?"var(--status-warning)":t==="event"||t==="snapshot"?"var(--accent)":"var(--text-tertiary)"}function bf(e){return Object.entries(e.entities).map(([t,n])=>({recordKey:t,entity:n}))}function AE(e,t){if(e.entities[t])return t;const n=bf(e).filter(({entity:r})=>r.id===t||r.qualifiedId===t);return n.length===1?n[0].recordKey:void 0}function RE(e,t){return bf(e).filter(({entity:n})=>!t||n.domain===t)}function OE(e,t,n){if(e.operation==="upsert_entity"){if(!t)return!1;const r=e.value;return r.dbtModel===t.dbtUniqueId&&(r.grain??void 0)===(t.grain??void 0)&&JSON.stringify(r.keys??[])===JSON.stringify(t.keys??[])&&(r.status??t.status)===t.status&&(r.areaId??void 0)===XC(t.areaId)&&r.domain===t.domain}return e.operation==="upsert_area"?!!n&&e.value.domain===n.domain&&e.value.id===n.localId:!1}const rj=p.lazy(()=>Ae(()=>import("./HomePage-D4ZjCFfB.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.HomePage}))),oj=p.lazy(()=>Ae(()=>import("./AnalyticsHome-CHvGWG92.js"),__vite__mapDeps([7,8,9,10,1,11,12,3,13,14,15,16,17,2,18,6])).then(e=>({default:e.AnalyticsHome}))),sj=p.lazy(()=>Ae(()=>import("./GlobalAiRail-BWfeK8lb.js"),__vite__mapDeps([19,9,10,1,11,12,3,13,14,15,16,17,2,20,6])).then(e=>({default:e.GlobalAiRail}))),ij=p.lazy(()=>Ae(()=>import("./NotebookEditor-Bh39Vsg0.js"),__vite__mapDeps([21,4,2,5,22,23,24,10,1,11,12,3,13,14,9,15,16,17,8,25,26,6,27,28,29,20,30,31])).then(e=>({default:e.NotebookEditor}))),aj=p.lazy(()=>Ae(()=>import("./NewNotebookModal-ZxHbTU9u.js"),__vite__mapDeps([32,4,15,6])).then(e=>({default:e.NewNotebookModal}))),cj=p.lazy(()=>Ae(()=>import("./NewBlockModal-C9MKCa6R.js"),__vite__mapDeps([33,6])).then(e=>({default:e.NewBlockModal}))),lj=p.lazy(()=>Ae(()=>import("./SetupOnboarding-BRut9nLO.js"),__vite__mapDeps([34,35,2,6])).then(e=>({default:e.SetupOnboarding}))),dj=p.lazy(()=>Ae(()=>import("./BlockStudio-DWMOCHy5.js"),__vite__mapDeps([36,22,23,10,1,11,12,3,13,14,25,26,6,27,28,9,15,16,17,2,20,37,38,39])).then(e=>({default:e.BlockStudio}))),uj=p.lazy(()=>Ae(()=>import("./BusinessArtifactView-guqlfQ0j.js"),__vite__mapDeps([40,25,26,6,27,28])).then(e=>({default:e.BusinessArtifactView}))),pj=p.lazy(()=>Ae(()=>import("./LineageDetailView-CqPB_tFP.js"),__vite__mapDeps([41,25,26,6,27,28,42,35,16])).then(e=>({default:e.LineageDetailView}))),fj=p.lazy(()=>Ae(()=>import("./LineageDAG-DLdogZMo.js"),__vite__mapDeps([42,26,6,27,28])).then(e=>({default:e.LineageDAG}))),hj=p.lazy(()=>Ae(()=>import("./HelpDocsPage-BxBzoxBO.js"),__vite__mapDeps([43,6])).then(e=>({default:e.HelpDocsPage}))),mj=p.lazy(()=>Ae(()=>Promise.resolve().then(()=>u1),void 0).then(e=>({default:e.ConnectionPanel}))),gj=p.lazy(()=>Ae(()=>import("./GitPage-CM3cgHtf.js"),__vite__mapDeps([44,45,15,6])).then(e=>({default:e.GitPage}))),yj=p.lazy(()=>Ae(()=>import("./ReadinessPage-jKOBKkED.js"),__vite__mapDeps([46,1,47,48,12,3,2,6])).then(e=>({default:e.ReadinessPage}))),bj=p.lazy(()=>Ae(()=>import("./AgentLogPage-XonDlOVv.js"),__vite__mapDeps([49,35,14,50,6])).then(e=>({default:e.AgentLogPage}))),xj=p.lazy(()=>Ae(()=>import("./AskTracePage-D6_RunIf.js"),__vite__mapDeps([51,26,6,27,35,3,31,50])).then(e=>({default:e.AskTracePage}))),vj=p.lazy(()=>Ae(()=>import("./AskObservabilityPage-1WYjAf8-.js"),__vite__mapDeps([52,37,3,50,2,6])).then(e=>({default:e.AskObservabilityPage}))),Sj=p.lazy(()=>Ae(()=>import("./GovernedContextPage-2Ld4yIgE.js"),__vite__mapDeps([53,3,12,9,10,1,11,13,14,15,16,17,2,54,6])).then(e=>({default:e.GovernedContextPage}))),wj=p.lazy(()=>Ae(()=>import("./DbtFirstModelingPage-DE7ewjMK.js"),__vite__mapDeps([55,54,9,10,1,11,12,3,13,14,15,16,17,2,26,6,27,28,29,30,39,56,50])).then(e=>({default:e.DbtFirstModelingPage}))),kj=p.lazy(()=>Ae(()=>import("./AppsView-DNhs0MyO.js"),__vite__mapDeps([57,20,17,10,1,11,12,3,13,14,15,35,38,30,4,5,24,8,48,58,56,2,18,6])).then(e=>({default:e.AppsView}))),Cj=p.lazy(()=>Ae(()=>import("./LineageDrawer-LZyR3zHf.js"),__vite__mapDeps([59,25,26,6,27,28,39,15,17,13,58,45])).then(e=>({default:e.LineageDrawer}))),jj=p.lazy(()=>Ae(()=>import("./AiBuildDialog-DwHVVFIS.js"),__vite__mapDeps([60,47,11,12,3,13,15,6])).then(e=>({default:e.AiBuildDialog})));function Ej(){const e=Ge(Lr(d=>({appMode:d.appMode,dashboardMode:d.dashboardMode,globalAi:d.globalAi,inspectorOpen:d.inspectorOpen,lineageDrawerOpen:d.lineageDrawerOpen,lineageFullscreen:d.lineageFullscreen,mainView:d.mainView,askTraceRunId:d.askTraceRunId,newBlockModalOpen:d.newBlockModalOpen,newNotebookModalOpen:d.newNotebookModalOpen,setupOpen:d.setupOpen,sidebarOpen:d.sidebarOpen,sidebarPanel:d.sidebarPanel,themeMode:d.themeMode}))),t=jn(),n=Qe[e.themeMode],r=p.useRef({}),o=e.mainView==="block_studio"||e.mainView==="imports",[i,a]=p.useState(!1),[c,l]=p.useState(null);p.useEffect(()=>{let d=!0;return B.getSetupLaunch().then(f=>{d&&(l(f),f.shouldOpen&&t({type:"OPEN_SETUP"}))}).catch(()=>{}),()=>{d=!1}},[t]),p.useEffect(()=>{const d=()=>{const f=Ra(window.location.pathname);(f==null?void 0:f.mainView)==="ask_trace"?t({type:"OPEN_ASK_TRACE",runId:f.runId}):(f==null?void 0:f.mainView)==="ask_observability"?t({type:"OPEN_ASK_OBSERVABILITY"}):t({type:"SET_MAIN_VIEW",view:"ask"})};return window.addEventListener("popstate",d),()=>window.removeEventListener("popstate",d)},[t]),p.useEffect(()=>{const d=()=>t({type:"SET_MAIN_VIEW",view:"modeling"});return window.addEventListener("dql:open-context-proposal",d),()=>window.removeEventListener("dql:open-context-proposal",d)},[t]),p.useEffect(()=>{if(e.mainView==="domains"||e.mainView==="modeling"||e.mainView==="skills")return;const d=tj(window.location.href),f=`${window.location.pathname}${window.location.search}${window.location.hash}`;d!==f&&window.history.replaceState(window.history.state,"",d)},[e.mainView]),GC(),YC(),p.useEffect(()=>{const d=f=>{(f.metaKey||f.ctrlKey)&&f.key.toLowerCase()==="k"&&!f.shiftKey&&(f.preventDefault(),a(m=>!m)),(f.metaKey||f.ctrlKey)&&f.shiftKey&&f.key.toLowerCase()==="i"&&(f.preventDefault(),t({type:"TOGGLE_INSPECTOR"}))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t]);const u=p.useCallback(async d=>{try{if(d.type==="term"||d.type==="business_view"){e.sidebarPanel!=="files"&&t({type:"SET_SIDEBAR_PANEL",panel:"files"}),t({type:"OPEN_BUSINESS_ARTIFACT",file:d});return}if(d.type==="block"){const j=await B.openBlockStudio(d.path);t({type:"OPEN_BLOCK_STUDIO",file:d,payload:j});return}const{content:f}=await B.readNotebook(d.path),{title:m,cells:S,metadata:v}=U1(d.path,f),b=d.path.endsWith(".dqlnb")?await B.fetchRunSnapshot(d.path):null;let w=S;if(b!=null&&b.found&&b.snapshot){const j=new Map(b.snapshot.cells.map(C=>[C.cellId,C]));w=S.map(C=>{const x=j.get(C.id);return x?{...C,status:x.status??C.status,result:x.result??C.result,error:x.error??C.error,executionCount:x.executionCount??C.executionCount,execution:x.execution??C.execution,fromSnapshot:x.result!=null}:C})}t({type:"OPEN_FILE",file:d,cells:w,title:m,metadata:v}),e.sidebarPanel!=="files"&&t({type:"SET_SIDEBAR_PANEL",panel:"files"})}catch(f){if(console.error("Failed to open file:",f),d.type==="block")try{const{content:m}=await B.readNotebook(d.path);t({type:"OPEN_BLOCK_STUDIO",file:d,payload:{path:d.path,source:m,companionPath:null,metadata:{name:d.name.replace(/\.dql$/i,""),path:d.path,domain:d.path.split("/").slice(1,-1).join("/")||"uncategorized",description:"",owner:"",tags:[]},validation:{valid:!1,diagnostics:[{severity:"warning",message:"Opened block without studio metadata. Save once to normalize it."}],semanticRefs:{metrics:[],dimensions:[],segments:[]}}}});return}catch(m){console.error("Failed to open block fallback:",m)}else t({type:"OPEN_FILE",file:d,cells:[Oa("sql")],title:d.name})}},[t,e.sidebarPanel]);p.useCallback(d=>{const f=r.current[d];f&&f.scrollIntoView({behavior:"smooth",block:"start"})},[]);const h=p.useCallback((d,f)=>{f?r.current[d]=f:delete r.current[d]},[]);return s.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh",width:"100vw",background:n.appBg,fontFamily:n.font,color:n.textPrimary,overflow:"hidden"},children:[s.jsx(zC,{}),s.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[e.appMode==="studio"&&s.jsx(Qw,{}),e.appMode==="studio"&&e.sidebarOpen&&!o&&s.jsx(M1,{onOpenFile:u}),s.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minWidth:0},children:s.jsx(p.Suspense,{fallback:s.jsx(Tj,{t:n}),children:e.mainView==="home"?s.jsx(rj,{}):e.mainView==="ask"?s.jsx(oj,{}):e.mainView==="business_artifact"?s.jsx(uj,{}):e.mainView==="lineage"?s.jsx("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:s.jsx(fj,{})}):e.mainView==="lineage_detail"?s.jsx(pj,{}):e.mainView==="help"?s.jsx(hj,{}):e.mainView==="connection"||e.mainView==="settings"?s.jsx(Rj,{children:s.jsx(mj,{variant:"page"})}):e.mainView==="git"?s.jsx(gj,{}):e.mainView==="readiness"?s.jsx(yj,{}):e.mainView==="skills"?s.jsx(Sj,{initialTab:"skills"}):e.mainView==="domains"||e.mainView==="modeling"?s.jsx(wj,{}):e.mainView==="apps"?s.jsx(kj,{}):e.mainView==="agent_log"?s.jsx(Oj,{title:"Agent steps",description:"What the agent did to answer this question, and where the time went — route, tools, checks, and per-step timing.",children:s.jsx(bj,{})}):e.mainView==="ask_observability"?s.jsx(vj,{}):e.mainView==="ask_trace"&&e.askTraceRunId?s.jsx(xj,{runId:e.askTraceRunId}):s.jsx(s.Fragment,{children:e.mainView==="imports"||e.mainView==="block_studio"?s.jsx(dj,{},"block-editor"):s.jsxs(s.Fragment,{children:[s.jsx(ij,{onOpenFile:u,registerCellRef:h}),e.appMode==="studio"&&s.jsx(VC,{})]})})})}),e.appMode==="studio"&&e.lineageDrawerOpen&&!e.lineageFullscreen&&!e.dashboardMode&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(Cj,{})}),e.appMode==="studio"&&e.inspectorOpen&&!e.lineageFullscreen&&!e.lineageDrawerOpen&&!e.dashboardMode&&s.jsx(Lw,{}),e.globalAi.open&&e.mainView==="apps"&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(sj,{})})]}),e.newNotebookModalOpen&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(aj,{onFileOpened:u})}),e.newBlockModalOpen&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(cj,{onFileOpened:u})}),s.jsx(ow,{open:i,onClose:()=>a(!1)}),s.jsx(p.Suspense,{fallback:null,children:s.jsx(jj,{})}),e.setupOpen&&s.jsx(p.Suspense,{fallback:s.jsx(Aj,{t:n}),children:s.jsx(lj,{launch:c!=null&&c.shouldOpen?c:void 0,onAcknowledged:()=>l(d=>d&&{...d,shouldOpen:!1,reason:null})})})]})}function Tj({t:e}){return s.jsx("div",{role:"status","aria-live":"polite",style:{flex:1,minWidth:0,display:"grid",placeItems:"center",background:e.appBg,color:e.textSecondary,fontFamily:e.font},children:s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,fontSize:12.5},children:[s.jsx("span",{style:{width:8,height:8,borderRadius:999,background:e.accent}}),"Loading workspace…"]})})}function Aj({t:e}){return s.jsx("div",{role:"status","aria-live":"polite",style:{position:"fixed",inset:0,zIndex:1100,display:"grid",placeItems:"center",background:e.appBg,color:e.textSecondary,fontFamily:e.font},children:s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,fontSize:12.5},children:[s.jsx("span",{style:{width:8,height:8,borderRadius:999,background:e.accent}}),"Checking workspace setup…"]})})}function Rj({children:e}){return s.jsx("div",{style:{flex:1,minWidth:0,overflow:"auto"},children:s.jsx("div",{style:{maxWidth:1120,margin:"0 auto",padding:"18px 28px 32px"},children:e})})}function Oj({title:e,description:t,children:n}){return s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,overflow:"hidden"},children:[s.jsxs("div",{style:{padding:"18px 24px 12px",borderBottom:"1px solid rgba(127, 127, 127, 0.16)"},children:[s.jsx("div",{style:{fontSize:22,fontWeight:700},children:e}),s.jsx("div",{style:{fontSize:13,opacity:.72,marginTop:6,maxWidth:760,lineHeight:1.5},children:t})]}),s.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:n})]})}function _j(){const e=jn(),t=Yi(),n=p.useRef(null);p.useEffect(()=>{let r=!0,o=null,i=null,a=null,c=null;const l=()=>{i&&clearTimeout(i),i=setTimeout(()=>{i=null,B.listNotebooks().then(f=>{r&&(t.setQueryData(["notebooks"],f),e({type:"SET_FILES",files:f}))}).catch(()=>{})},150)},u=()=>{a&&clearTimeout(a),a=setTimeout(()=>{a=null,B.getDomains().then(({domains:f})=>{r&&(t.setQueryData(["authored-domains"],{domains:f}),e({type:"SET_AUTHORED_DOMAINS",domains:f}))}).catch(()=>{})},150)},h=()=>{c&&clearTimeout(c),c=setTimeout(()=>{c=null,e({type:"SET_SEMANTIC_LOADING",loading:!0}),B.getSemanticLayer().then(f=>{r&&(t.setQueryData(["semantic-layer"],f),e({type:"SET_SEMANTIC_LAYER",layer:f}))}).catch(()=>{})},100)},d=()=>{if(!r)return;const f=new AbortController;n.current=f,Ap("/api/watch",m=>{if(m.event==="change")try{const S=JSON.parse(m.data);if(S.type==="file-added"||S.type==="file-deleted"||S.type==="file-changed"){const v=S.path??"";/^(?:notebooks|workbooks|blocks|skills|apps|dashboards)\//.test(v)&&l(),v.startsWith("domains/")&&(l(),u())}S.type==="semantic-reload"&&h()}catch{}},f.signal).catch(()=>{!r||f.signal.aborted||(o&&clearTimeout(o),o=setTimeout(d,5e3))})};return d(),()=>{var f;r=!1,o&&clearTimeout(o),i&&clearTimeout(i),a&&clearTimeout(a),c&&clearTimeout(c),(f=n.current)==null||f.abort(),n.current=null}},[e,t])}const Pj=new lh({defaultOptions:{queries:{staleTime:15e3,gcTime:5*6e4,retry:1,refetchOnWindowFocus:!1}}});function Ij(){const e=Ge(i=>i.themeMode),t=Ge(i=>i.dispatch),n=Qe[e];p.useEffect(()=>{const i="dql-global-styles";let a=document.getElementById(i);a||(a=document.createElement("style"),a.id=i,document.head.appendChild(a)),a.textContent=`
616
616
  * { margin: 0; padding: 0; box-sizing: border-box; }
617
617
  body {
618
618
  font-family: var(--font-ui, ${n.font});
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-D3wnucQC.js";/**
1
+ import{c as e}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-D3wnucQC.js";/**
1
+ import{c as e}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-D3wnucQC.js";/**
1
+ import{c as e}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-D3wnucQC.js";/**
1
+ import{c as e}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-D3wnucQC.js";/**
1
+ import{c as t}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-D3wnucQC.js";/**
1
+ import{c as t}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,3 +1,3 @@
1
- import{r as x,j as l,t as k,R as y}from"./index-D3wnucQC.js";import{c as S,i as j}from"./usePersistedAgentThreadId-DpQXOEDw.js";function w(o,t){const n=o.split(`
1
+ import{r as x,j as l,t as k,R as y}from"./index-C9KfoqCR.js";import{c as S,i as j}from"./usePersistedAgentThreadId-B5pTglEr.js";function w(o,t){const n=o.split(`
2
2
  `),s=[];let e=0;for(;e<n.length;){const a=n[e],d=a.match(/^(#{1,6})\s+(.+)$/);if(d){const i=d[1].length,h=d[2],c=[28,22,18,16,14,13][i-1];s.push(l.jsx("div",{style:{fontSize:c,fontWeight:i<=2?700:600,color:t.textPrimary,fontFamily:t.font,lineHeight:1.3,marginBottom:i===1?12:8,marginTop:e>0?i===1?16:10:0,borderBottom:i===1?`1px solid ${t.cellBorder}`:void 0,paddingBottom:i===1?8:void 0},children:p(h,t)},e)),e++;continue}if(/^[-*_]{3,}$/.test(a.trim())){s.push(l.jsx("hr",{style:{border:"none",borderTop:`1px solid ${t.cellBorder}`,margin:"12px 0"}},e)),e++;continue}if(a.startsWith("> ")){s.push(l.jsx("div",{style:{borderLeft:`3px solid ${t.textMuted}`,paddingLeft:12,marginLeft:4,color:t.textSecondary,fontStyle:"italic",fontFamily:t.fontSerif,fontSize:14},children:p(a.slice(2),t)},e)),e++;continue}if(a.startsWith("```")){const i=[];for(e++;e<n.length&&!n[e].startsWith("```");)i.push(n[e]),e++;s.push(l.jsx("pre",{style:{background:"var(--color-bg-surface)",border:"1px solid var(--color-border-subtle)",borderRadius:6,padding:"10px 12px",fontSize:12,fontFamily:"var(--font-mono)",color:"var(--color-text-primary)",overflow:"auto",margin:"8px 0",lineHeight:1.6},children:i.join(`
3
3
  `)},e)),e++;continue}if(/^[-*+]\s/.test(a)){const i=e,h=[];for(;e<n.length&&/^[-*+]\s/.test(n[e]);)h.push(n[e].replace(/^[-*+]\s/,"")),e++;s.push(l.jsx("ul",{style:{paddingLeft:20,marginBottom:8,color:t.textSecondary},children:h.map((m,c)=>l.jsx("li",{style:{fontSize:14,fontFamily:t.font,lineHeight:1.6,marginBottom:2},children:p(m,t)},c))},`ul-${i}`));continue}if(/^\d+\.\s/.test(a)){const i=e,h=[];for(;e<n.length&&/^\d+\.\s/.test(n[e]);)h.push(n[e].replace(/^\d+\.\s/,"")),e++;s.push(l.jsx("ol",{style:{paddingLeft:20,marginBottom:8,color:t.textSecondary},children:h.map((m,c)=>l.jsx("li",{style:{fontSize:14,fontFamily:t.font,lineHeight:1.6,marginBottom:2},children:p(m,t)},c))},`ol-${i}`));continue}if(!a.trim()){s.push(l.jsx("div",{style:{height:8}},e)),e++;continue}s.push(l.jsx("p",{style:{fontSize:14,lineHeight:1.7,fontFamily:t.fontSerif,color:t.textSecondary,marginBottom:6},children:p(a,t)},e)),e++}return s}function p(o,t){const n=[];let s=o,e=0;for(;s.length>0;){const a=s.match(/\*{3}(.+?)\*{3}/),d=s.match(/\*{2}(.+?)\*{2}/),i=s.match(/\*(.+?)\*/),h=s.match(/`(.+?)`/),m=s.match(/\[(.+?)\]\((.+?)\)/),c=[a?{match:a,type:"boldItalic"}:null,d?{match:d,type:"bold"}:null,i?{match:i,type:"italic"}:null,h?{match:h,type:"code"}:null,m?{match:m,type:"link"}:null].filter(Boolean);if(c.length===0){n.push(l.jsx(y.Fragment,{children:s},e++));break}const r=c.reduce((u,g)=>(u.match.index??0)<(g.match.index??0)?u:g),f=r.match.index??0;switch(f>0&&n.push(l.jsx(y.Fragment,{children:s.slice(0,f)},e++)),r.type){case"boldItalic":n.push(l.jsx("strong",{style:{fontStyle:"italic"},children:r.match[1]},e++));break;case"bold":n.push(l.jsx("strong",{children:r.match[1]},e++));break;case"italic":n.push(l.jsx("em",{children:r.match[1]},e++));break;case"code":n.push(l.jsx("code",{style:{background:"var(--color-bg-surface)",border:"1px solid var(--color-border-subtle)",borderRadius:4,padding:"1px 5px",fontSize:"0.9em",fontFamily:"var(--font-mono)",color:"var(--color-accent-blue)"},children:r.match[1]},e++));break;case"link":n.push(l.jsx("a",{href:r.match[2],target:"_blank",rel:"noopener noreferrer",style:{color:t.accent,textDecoration:"underline"},children:r.match[1]},e++));break}s=s.slice(f+r.match[0].length)}return l.jsx(l.Fragment,{children:n})}function z({value:o,onChange:t,onRun:n,themeMode:s}){const e=k[s],[a,d]=x.useState(!1),i=x.useRef(null);x.useEffect(()=>{if(a&&i.current){i.current.focus();const r=i.current;r.style.height="auto",r.style.height=`${Math.max(r.scrollHeight,80)}px`}},[a]);const h=()=>{d(!1)},m=r=>{if(r.key==="Escape"&&d(!1),r.key==="Enter"&&r.shiftKey&&(r.preventDefault(),d(!1),n==null||n()),r.key==="Tab"){r.preventDefault();const f=r.currentTarget,u=f.selectionStart,g=f.selectionEnd,b=o.slice(0,u)+" "+o.slice(g);t(b),requestAnimationFrame(()=>{f.selectionStart=f.selectionEnd=u+2})}},c=r=>{t(r.target.value);const f=r.target;f.style.height="auto",f.style.height=`${Math.max(f.scrollHeight,80)}px`};return a?l.jsx("textarea",{ref:i,value:o,onChange:c,onBlur:h,onKeyDown:m,placeholder:"Write markdown here...",spellCheck:!1,style:{display:"block",width:"100%",minHeight:80,padding:"12px 16px",background:e.editorBg,color:e.textPrimary,border:"none",outline:"none",resize:"none",fontFamily:e.fontMono,fontSize:13,lineHeight:"20px",borderRadius:0,caretColor:e.accent}}):o.trim()?l.jsx("div",{onDoubleClick:()=>d(!0),title:"Double-click to edit",style:{padding:"12px 16px",cursor:"text",minHeight:48},children:w(o,e)}):l.jsx("div",{onDoubleClick:()=>d(!0),style:{padding:"12px 16px",color:e.textMuted,fontFamily:e.font,fontSize:13,fontStyle:"italic",cursor:"text",minHeight:48,display:"flex",alignItems:"center"},children:"Double-click to add markdown..."})}function F(o){var h,m;if(!o)return{metrics:[],dimensions:[],columns:[],fields:[],hasSemanticBinding:!1};const t=new Set(((h=o.semanticRefs)==null?void 0:h.metrics)??[]),n=new Set(((m=o.semanticRefs)==null?void 0:m.dimensions)??[]),s=t.size>0||n.size>0,e=[],a=[],d=[],i=[];for(const c of o.columns)t.has(c)?(e.push(c),i.push({name:c,kind:"metric"})):n.has(c)&&(a.push(c),i.push({name:c,kind:"dimension"}));for(const c of o.columns)t.has(c)||n.has(c)||(d.push(c),i.push({name:c,kind:"column",chartRole:S(j(c,o.rows))}));return{metrics:e,dimensions:a,columns:d,fields:i,hasSemanticBinding:s}}function H(o){return o==="metric"?"#":o==="dimension"?"∴":"A"}function M(o,t){return o==="metric"?t:o==="dimension"?"#e3b341":"#56d364"}function C(o){return o==="metric"?"metric":o==="dimension"?"dimension":"column"}export{z as M,M as a,C as b,F as c,H as f,w as r};
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-D3wnucQC.js";/**
1
+ import{c as t}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-D3wnucQC.js";/**
1
+ import{c as a}from"./index-C9KfoqCR.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.