@dbt-tools/web 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -25
- package/dist/assets/{index-WFlxSrs-.js → index-DRBtWycK.js} +1 -1
- package/dist/favicon.svg +11 -0
- package/dist/index.html +2 -2
- package/dist-serve/favicon.svg +11 -0
- package/dist-serve/server/cli.js +125 -66
- package/package.json +2 -2
- package/dist/assets/app-logo-ByfNNtT8.svg +0 -30
package/README.md
CHANGED
|
@@ -34,13 +34,16 @@ Or without a global install:
|
|
|
34
34
|
npx @dbt-tools/web --target /path/to/your/dbt/target
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
`npx` invokes the package’s binary (`dbt-tools-web`).
|
|
37
|
+
`npx` invokes the package’s binary (`dbt-tools-web`). Run **`dbt-tools-web --help`** for the full list. Common flags:
|
|
38
38
|
|
|
39
|
-
| Flag
|
|
40
|
-
|
|
|
41
|
-
| `--target <
|
|
42
|
-
| `--
|
|
43
|
-
| `--
|
|
39
|
+
| Flag | Description |
|
|
40
|
+
| --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
41
|
+
| `--dbt-target <target>` | Artifact root: local path, `s3://`, or `gs://` (env: `DBT_TOOLS_DBT_TARGET`) |
|
|
42
|
+
| `--target <dir>` / `-t` | Alias for **local** `--dbt-target` (also sets `DBT_TOOLS_TARGET_DIR`) |
|
|
43
|
+
| `--gcs-impersonate-service-account`, `--gcs-project-id`, `--s3-region`, `--s3-endpoint` | Remote client settings (provider must match target URI) |
|
|
44
|
+
| `--port <n>` / `-p` | Listen port (default **3000**) |
|
|
45
|
+
| `--version` / `-V` | Print package version |
|
|
46
|
+
| `--help` / `-h` | Usage |
|
|
44
47
|
|
|
45
48
|
The server listens on **127.0.0.1** and prints the URL (e.g. `http://127.0.0.1:3000`). Open that URL in your browser manually (`open`, `xdg-open`, or your desktop environment).
|
|
46
49
|
|
|
@@ -94,12 +97,18 @@ Heavy analysis runs in a **web worker** (browser-safe shared library). The same
|
|
|
94
97
|
|
|
95
98
|
## Configuration (`dbt-tools-web` and production server)
|
|
96
99
|
|
|
100
|
+
**CLI flags** (see `dbt-tools-web --help`) mirror **`dbt-tools-mcp`** for artifact root and remote client settings: `--dbt-target`, `--gcs-project-id`, `--gcs-impersonate-service-account`, `--s3-region`, `--s3-endpoint`, plus `--port`, `-V` / `--version`. **`--target`** remains an alias for a **local** directory (sets `DBT_TOOLS_TARGET_DIR`). Flags override matching env vars when both are set.
|
|
101
|
+
|
|
97
102
|
Set these in the environment for the **Node process** that runs `dbt-tools-web` (not in the browser):
|
|
98
103
|
|
|
99
|
-
| Variable
|
|
100
|
-
|
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
104
|
+
| Variable | Description |
|
|
105
|
+
| ----------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
106
|
+
| `DBT_TOOLS_DBT_TARGET` | Artifact root at startup (local path, `s3://`, or `gs://`); same as `--dbt-target` |
|
|
107
|
+
| `DBT_TOOLS_TARGET_DIR` | Local directory alias (legacy; use `--target` or local `--dbt-target`) |
|
|
108
|
+
| `DBT_TOOLS_GCS_PROJECT_ID` | GCS client project (`gs://` targets) |
|
|
109
|
+
| `DBT_TOOLS_GCS_IMPERSONATE_SERVICE_ACCOUNT` | GCS impersonation principal (`gs://` targets) |
|
|
110
|
+
| `DBT_TOOLS_S3_REGION` / `DBT_TOOLS_S3_ENDPOINT` | S3 client settings (`s3://` targets) |
|
|
111
|
+
| `DBT_TOOLS_DEBUG` | Set to `1` for server-side debug logs |
|
|
103
112
|
|
|
104
113
|
**Client:** add **`?debug=1`** to the URL for browser console debug logging.
|
|
105
114
|
|
|
@@ -107,7 +116,7 @@ Set these in the environment for the **Node process** that runs `dbt-tools-web`
|
|
|
107
116
|
|
|
108
117
|
### Remote artifact sources
|
|
109
118
|
|
|
110
|
-
Use the in-app **Load artifacts** panel
|
|
119
|
+
Use **`--dbt-target`** / **`DBT_TOOLS_DBT_TARGET`** at startup to preload local or remote (`s3://`, `gs://`) artifacts, or use the in-app **Load artifacts** panel to switch later. The dev server and **`dbt-tools-web`** list keys under remote prefixes, **poll** for changes, and surface newer artifact versions **without switching your selected location automatically**. Credentials stay in the **Node process** (AWS default chain, GCS ADC / `GOOGLE_APPLICATION_CREDENTIALS`), not in the browser.
|
|
111
120
|
|
|
112
121
|
### Vite dev environment reference (monorepo)
|
|
113
122
|
|
|
@@ -126,7 +135,7 @@ When **`DBT_TOOLS_TARGET_DIR`** is set, Vite serves `/api/...` like the publishe
|
|
|
126
135
|
|
|
127
136
|
### Published server vs static Docker image
|
|
128
137
|
|
|
129
|
-
- **`dbt-tools-web`** (npm): Node HTTP server + static `dist/` + artifact middleware. Honors **`DBT_TOOLS_TARGET_DIR`**,
|
|
138
|
+
- **`dbt-tools-web`** (npm): Node HTTP server + static `dist/` + artifact middleware. Honors **`DBT_TOOLS_DBT_TARGET`** / **`DBT_TOOLS_TARGET_DIR`**, remote client env vars, and **`DBT_TOOLS_DEBUG`**. Does **not** use Vite file-watch env vars.
|
|
130
139
|
- **Dockerfile (nginx):** builds static **`dist/`** and serves it with **nginx**. There is **no** Node artifact middleware in that image unless you change the deployment shape, so the same **`DBT_TOOLS_*`** server env vars **do not apply** to that container as shipped.
|
|
131
140
|
|
|
132
141
|
### Build static image (monorepo)
|
|
@@ -245,34 +254,28 @@ DBT_TOOLS_WATCH=0 DBT_TOOLS_TARGET_DIR=./target pnpm dev
|
|
|
245
254
|
|
|
246
255
|
To smoke-test the published **`dbt-tools-web`** entrypoint and tarball layout **without publishing to the public npm registry**:
|
|
247
256
|
|
|
248
|
-
- **Recommended (matches CI):** from the **repository root** after `pnpm install`, run Verdaccio, publish
|
|
257
|
+
- **Recommended (matches CI):** from the **repository root** after `pnpm install`, run Verdaccio, publish **`@dbt-tools/core` first** (same semver as web), then `@dbt-tools/web`, pack, and smoke via `npm install` with `NPM_CONFIG_REGISTRY` pointing at that registry. `dbt-artifacts-parser` is resolved from npm:
|
|
249
258
|
|
|
250
259
|
```bash
|
|
251
260
|
bash scripts/smoke-npx-with-verdaccio.sh
|
|
252
261
|
```
|
|
253
262
|
|
|
254
|
-
This avoids **`No matching version found for @dbt-tools/core@…`** when
|
|
263
|
+
This avoids **`No matching version found for @dbt-tools/core@…`** and stale **npmjs** `core@0.6.1` without entrypoint exports when your branch adds new `@dbt-tools/core` APIs (packed web lists `"@dbt-tools/core": "0.6.2"`).
|
|
255
264
|
|
|
256
|
-
- **Manual pack only** (only reliable if
|
|
265
|
+
- **Manual pack only** (only reliable if `@dbt-tools/core@<version>` exists on the registry you use, or set `NPM_CONFIG_REGISTRY` accordingly):
|
|
257
266
|
|
|
258
267
|
```bash
|
|
259
268
|
pnpm --filter @dbt-tools/web pack
|
|
269
|
+
export NPM_CONFIG_REGISTRY=http://127.0.0.1:4873 # if using local Verdaccio
|
|
270
|
+
pnpm --filter @dbt-tools/web run smoke:npx-tgz
|
|
260
271
|
```
|
|
261
272
|
|
|
262
273
|
`prepack` runs the full web build and writes **`dbt-tools-web-<version>.tgz` at the repo root** (the file is gitignored).
|
|
263
274
|
|
|
264
|
-
- **Empty directory**
|
|
265
|
-
|
|
266
|
-
```bash
|
|
267
|
-
cd "$(mktemp -d)"
|
|
268
|
-
# After copying the .tgz into this directory (adjust version to match package.json):
|
|
269
|
-
npx -y ./dbt-tools-web-0.4.1.tgz -- --help
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
If you pass a **bare absolute path** to the tarball, some `npx` versions try to execute it as a shell script and fail (`Permission denied`). Prefer either a **relative** `./…tgz` path or an explicit package spec:
|
|
275
|
+
- **Empty directory** (smoke script uses `npm install` + `node_modules/.bin/dbt-tools-web`, not bare `npx` on the tarball path):
|
|
273
276
|
|
|
274
277
|
```bash
|
|
275
|
-
|
|
278
|
+
REPO_ROOT=/path/to/dbt-tools-ts bash packages/web/scripts/smoke-npx-packed-tarball.sh
|
|
276
279
|
```
|
|
277
280
|
|
|
278
281
|
### Project layout (abridged)
|
|
@@ -33,4 +33,4 @@ import{n as e,r as t,t as n}from"./rolldown-runtime-Dw2cE7zH.js";import{i as r,n
|
|
|
33
33
|
`)}):null]}):null}function Cv({freshness:e}){return e==null?null:(0,D.jsxs)(Wr,{title:`Source freshness`,subtitle:`Latest freshness evidence from sources.json when provided.`,children:[(0,D.jsxs)(`div`,{className:`detail-grid`,children:[(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Status`}),(0,D.jsx)(`strong`,{children:e.status})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Age`}),(0,D.jsx)(`strong`,{children:Xn(e.ageSeconds)})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Max loaded at`}),(0,D.jsx)(`strong`,{children:e.maxLoadedAt??`n/a`})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Snapshotted at`}),(0,D.jsx)(`strong`,{children:e.snapshottedAt??`n/a`})]})]}),e.criteria==null?null:(0,D.jsxs)(`div`,{className:`detail-grid`,children:[(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Warn after`}),(0,D.jsx)(`strong`,{children:e.criteria.warnAfter??`n/a`})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Error after`}),(0,D.jsx)(`strong`,{children:e.criteria.errorAfter??`n/a`})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Filter`}),(0,D.jsx)(`strong`,{children:e.criteria.filter??`n/a`})]})]}),e.error?(0,D.jsx)(`p`,{className:`resource-spotlight__description`,children:e.error}):null]})}function wv({resource:e,executionRow:t=null}){let n=Rc(),r=e.adapterMetrics??t?.adapterMetrics,i=hn(r,e.adapterResponseFields??t?.adapterResponseFields);return(0,D.jsxs)(`div`,{className:`asset-summary-stack`,children:[n.missingCatalog||n.missingSources?(0,D.jsx)(Wr,{title:`Optional artifacts`,subtitle:`Capabilities limited for this session because some JSON files were not part of the load.`,children:(0,D.jsxs)(`ul`,{className:`resource-spotlight__description resource-spotlight__description--muted`,children:[n.missingCatalog?(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`code`,{children:`catalog.json`}),` was not loaded — column counts and richer warehouse metadata may be absent.`]}):null,n.missingSources?(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`code`,{children:`sources.json`}),` was not loaded — source freshness evidence is unavailable.`]}):null]})}):null,(0,D.jsxs)(Wr,{title:`Resource`,subtitle:`Path, relation, and description from the project manifest.`,children:[(0,D.jsxs)(`div`,{className:`detail-grid`,children:[(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Project`}),(0,D.jsx)(`strong`,{children:e.packageName?.trim()||`n/a`})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Path`}),(0,D.jsx)(`strong`,{children:rr(e)??`n/a`})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Relation`}),(0,D.jsx)(`strong`,{children:xv(e)})]}),e.catalogStats==null?null:(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Catalog columns`}),(0,D.jsx)(`strong`,{children:e.catalogStats.columnCount})]})]}),e.description?(0,D.jsx)(bv,{markdown:e.description,className:`resource-spotlight__description`}):(0,D.jsx)(`p`,{className:`resource-spotlight__description resource-spotlight__description--muted`,children:`No description was captured for this asset. Catalog-oriented metadata can surface here when present in the manifest.`})]}),(0,D.jsx)(Cv,{freshness:e.sourceFreshness}),(0,D.jsx)(Wr,{title:`This run`,subtitle:`Status, timing, and warehouse feedback from the captured run.`,children:(0,D.jsxs)(`div`,{className:`asset-summary__groups`,children:[(0,D.jsxs)(`div`,{className:`detail-grid`,children:[(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Status`}),(0,D.jsx)(`strong`,{children:e.status??`Not executed`})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Execution time`}),(0,D.jsx)(`strong`,{children:Xn(e.executionTime)})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Thread`}),(0,D.jsx)(`strong`,{children:e.threadId??`n/a`})]})]}),(0,D.jsx)(Sv,{adapterMetrics:r,extraAdapterRawFields:i})]})})]})}function Tv({size:e=24,label:t}){return(0,D.jsxs)(`svg`,{className:`spinner`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":t?void 0:`true`,"aria-label":t,role:t?`img`:void 0,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`var(--panel-border)`,strokeWidth:`2.5`}),(0,D.jsx)(`path`,{d:`M12 2 A10 10 0 0 1 22 12`,stroke:`var(--accent)`,strokeWidth:`2.5`,strokeLinecap:`round`})]})}var Ev=new Set(`SELECT FROM WHERE WITH AS JOIN ON GROUP BY ORDER LIMIT HAVING UNION CASE WHEN THEN ELSE END LEFT RIGHT INNER OUTER CROSS DISTINCT NULL AND OR NOT IN IS BETWEEN LIKE EXISTS INSERT INTO UPDATE SET DELETE CREATE TABLE VIEW REPLACE IF ASC DESC USING AT ZONE INTERVAL QUALIFY WINDOW ROWS RANGE UNBOUNDED PRECEDING FOLLOWING CURRENT ROW PARTITION OVER`.split(` `)),Dv=new Set(`SUM COUNT AVG MAX MIN COALESCE CAST IFF IF ROW_NUMBER RANK DENSE_RANK NTILE LEAD LAG FIRST_VALUE LAST_VALUE NVL NVL2 NULLIF GREATEST LEAST TRIM LTRIM RTRIM UPPER LOWER LENGTH SUBSTR SUBSTRING REPLACE SPLIT CONCAT DATE YEAR MONTH DAY HOUR MINUTE SECOND DATEDIFF DATEADD CURRENT_DATE CURRENT_TIMESTAMP TO_DATE TO_TIMESTAMP TO_NUMBER TO_VARCHAR TRY_CAST CONVERT FLOOR CEIL ROUND ABS MOD SQRT LOG EXP ARRAY_AGG LISTAGG STRING_AGG GROUP_CONCAT FLATTEN UNNEST GENERATE_SERIES`.split(` `));function Ov(e){return/[a-zA-Z_]/.test(e)}function kv(e){return/[a-zA-Z0-9_]/.test(e)}function Av(e){return e>=`0`&&e<=`9`}function jv(e,t){if(!e.startsWith(`/*`,t))return null;let n=e.indexOf(`*/`,t+2);return n===-1?e.slice(t):e.slice(t,n+2)}function Mv(e,t){if(!e.startsWith(`--`,t))return null;let n=e.indexOf(`
|
|
34
34
|
`,t);return n===-1?e.slice(t):e.slice(t,n+1)}function Nv(e,t){if(e.charAt(t)!==`'`)return null;let n=t+1;for(;n<e.length;){if(e.charAt(n)===`'`&&e.charAt(n-1)!==`\\`){n+=1;break}n+=1}return e.slice(t,n)}function Pv(e,t){if(t>0&&kv(e.charAt(t-1)))return null;let n=t;for(;n<e.length&&Av(e.charAt(n));)n+=1;if(n===t)return null;if(e.charAt(n)===`.`){let t=n+1;for(;t<e.length&&Av(e.charAt(t));)t+=1;t>n+1&&(n=t)}return e.slice(t,n)}function Fv(e,t){if(!Ov(e.charAt(t)))return null;let n=t+1;for(;n<e.length&&kv(e.charAt(n));)n+=1;let r=e.slice(t,n),i=r.toUpperCase();return{type:Ev.has(i)?`keyword`:Dv.has(i)?`function`:`identifier`,value:r}}function Iv(e,t){let n=jv(e,t)??Mv(e,t)??Nv(e,t)??Pv(e,t);return n==null?null:n.startsWith(`/*`)||n.startsWith(`--`)?{type:`comment`,value:n}:e.charAt(t)===`'`?{type:`string`,value:n}:{type:`number`,value:n}}function Lv(e){return/[=<>!|+\-*/%^&~]/.test(e)?`operator`:/[(),;.[\]{}]/.test(e)?`punctuation`:null}function Rv(e){let t=[],n=0,r=e.length;for(;n<r;){let r=Iv(e,n);if(r!=null){t.push(r),n+=r.value.length;continue}let i=Fv(e,n);if(i!=null){t.push(i),n+=i.value.length;continue}let a=e.charAt(n),o=Lv(a);if(o!=null){t.push({type:o,value:a}),n+=1;continue}t.push({type:`plain`,value:a}),n+=1}return t}function zv({sql:e}){return(0,D.jsx)(`pre`,{className:`sql-panel`,children:(0,D.jsx)(`code`,{children:Rv(e).map((e,t)=>e.type===`plain`||e.type===`identifier`?e.value:(0,D.jsx)(`span`,{className:`sql-token-${e.type}`,children:e.value},t))})})}function Bv({label:e,values:t}){return t.length===0?null:(0,D.jsxs)(`div`,{className:`definition-list`,children:[(0,D.jsx)(`span`,{children:e}),(0,D.jsx)(`div`,{className:`definition-list__values`,children:t.map(e=>(0,D.jsx)(`span`,{className:`definition-pill`,children:e},e))})]})}function Vv(e){return(0,D.jsxs)(`div`,{className:`definition-panel`,children:[(0,D.jsxs)(`div`,{className:`detail-grid`,children:[(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Label`}),(0,D.jsx)(`strong`,{children:e.label??`Not captured`})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Metric type`}),(0,D.jsx)(`strong`,{children:e.metricType??`Not captured`})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Source`}),(0,D.jsx)(`strong`,{children:e.sourceReference??`Not captured`})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Time granularity`}),(0,D.jsx)(`strong`,{children:e.timeGranularity??`Not captured`})]})]}),e.expression&&(0,D.jsxs)(`div`,{className:`definition-block`,children:[(0,D.jsx)(`span`,{children:`Expression`}),(0,D.jsx)(`pre`,{children:e.expression})]}),e.description&&(0,D.jsxs)(`div`,{className:`definition-block`,children:[(0,D.jsx)(`span`,{children:`Description`}),(0,D.jsx)(`p`,{children:e.description})]}),(0,D.jsx)(Bv,{label:`Measures`,values:e.measures}),(0,D.jsx)(Bv,{label:`Referenced metrics`,values:e.metrics}),(0,D.jsx)(Bv,{label:`Filters`,values:e.filters})]})}function Hv(e){return(0,D.jsxs)(`div`,{className:`definition-panel`,children:[(0,D.jsxs)(`div`,{className:`detail-grid`,children:[(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Label`}),(0,D.jsx)(`strong`,{children:e.label??`Not captured`})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Source model`}),(0,D.jsx)(`strong`,{children:e.sourceReference??`Not captured`})]}),(0,D.jsxs)(`div`,{className:`detail-stat`,children:[(0,D.jsx)(`span`,{children:`Default time dimension`}),(0,D.jsx)(`strong`,{children:e.defaultTimeDimension??`Not captured`})]})]}),(0,D.jsx)(Bv,{label:`Entities`,values:e.entities}),(0,D.jsx)(Bv,{label:`Measures`,values:e.measures}),(0,D.jsx)(Bv,{label:`Dimensions`,values:e.dimensions}),e.description&&(0,D.jsxs)(`div`,{className:`definition-block`,children:[(0,D.jsx)(`span`,{children:`Description`}),(0,D.jsx)(`p`,{children:e.description})]})]})}function Uv({showsDefinition:e,definition:t,sqlText:n,codeLoading:r,codeError:i}){return e&&t?t.kind===`metric`?Vv(t):Hv(t):r?(0,D.jsxs)(`div`,{className:`asset-sql-loading`,"aria-busy":`true`,children:[(0,D.jsx)(Tv,{size:28,label:`Loading SQL`}),(0,D.jsx)(`span`,{className:`asset-sql-loading__label`,children:`Loading SQL…`})]}):i?(0,D.jsx)(Fo,{icon:`⚠`,headline:`Could not load SQL`,subtext:i}):n?(0,D.jsx)(zv,{sql:n}):(0,D.jsx)(Fo,{icon:`⌘`,headline:e?`No definition available`:`No SQL available`,subtext:e?`This resource does not expose enough definition metadata in the current artifacts.`:`This resource does not expose compiled or raw SQL in the current artifacts.`})}function Wv({showsDefinition:e,definition:t,sqlText:n,codeLoading:r,codeError:i,hasCompiledSql:a}){return(0,D.jsx)(Wr,{title:e?`Definition`:`SQL`,subtitle:e?t?.kind===`metric`?`Structured metric definition captured from the manifest.`:`Structured semantic model definition captured from the manifest.`:a?`Compiled SQL for the selected resource.`:`Raw SQL captured from the manifest.`,children:Uv({showsDefinition:e,definition:t,sqlText:n,codeLoading:r,codeError:i})})}function Gv(e,t){return t===`asc`?e:-e}function Kv(e){return e.statusTone===`danger`||e.statusTone===`warning`?0:e.statusTone===`positive`?1:e.statusTone===`skipped`?2:3}function qv(e,t){return(t.executionTime??-1/0)-(e.executionTime??-1/0)}function Jv(e,t){return e===0?0:t===`asc`?-e:e}function Yv(e,t,n){let r=e.name.localeCompare(t.name);return r===0?e.uniqueId.localeCompare(t.uniqueId):Gv(r,n)}function Xv(e,t,n){let r=qv(e,t);return r===0?e.name.localeCompare(t.name):Jv(r,n)}function Zv(e,t,n){let r=Zn(e.resourceType).localeCompare(Zn(t.resourceType));return r===0?e.name.localeCompare(t.name):Gv(r,n)}function Qv(e,t,n){let r=(e.testAttachedTarget??``).trim(),i=(t.testAttachedTarget??``).trim(),a=r.localeCompare(i);return a===0?e.name.localeCompare(t.name):Gv(a,n)}function $v(e,t,n){let r=Kv(e)-Kv(t);if(r!==0)return-Gv(r,n);let i=qv(e,t);if(i!==0)return Jv(i,n);let a=e.name.localeCompare(t.name);return a===0?e.uniqueId.localeCompare(t.uniqueId):Gv(a,n)}function ey(e,t,n,r){switch(n){case`test`:return Yv(e,t,r);case`duration`:return Xv(e,t,r);case`type`:return Zv(e,t,r);case`target`:return Qv(e,t,r);case`status`:return $v(e,t,r);default:return n}}function ty(e,t,n){return[...e].sort((e,r)=>ey(e,r,t,n))}function ny(e){return e.total===0?{label:`No attached tests`,tone:`neutral`,detail:`No quality evidence was linked to this asset in the current artifacts.`}:e.attention>0?{label:`Attention needed`,tone:`warning`,detail:`${e.attention} attention item${e.attention===1?``:`s`} across ${e.total} attached tests.`}:{label:`All attached tests passing`,tone:`positive`,detail:`${e.passing} of ${e.total} attached tests passed in the current artifacts.`}}function ry(e,t,n){return e===t?n===`asc`?{indicator:`↑`,ariaSort:`ascending`}:{indicator:`↓`,ariaSort:`descending`}:{indicator:` `,ariaSort:`none`}}function iy(e,t,n){return e===t?n===`asc`?`desc`:`asc`:t===`status`||t===`duration`?`desc`:`asc`}var ay=[{key:`test`,label:`Test`,alignEnd:!1,testCell:!0},{key:`status`,label:`Status`,alignEnd:!1,testCell:!1},{key:`type`,label:`Type`,alignEnd:!1,testCell:!1},{key:`target`,label:`Target`,alignEnd:!1,testCell:!1},{key:`duration`,label:`Duration`,alignEnd:!0,testCell:!1}];function oy({resource:e,analysis:t,onNavigateTo:n}){let[r,i]=(0,c.useState)(`status`),[a,o]=(0,c.useState)(`desc`),s=(0,c.useMemo)(()=>Er(e.uniqueId,t.resources,t.dependencyIndex),[t.dependencyIndex,t.resources,e.uniqueId]),l=ny(s),u=(0,c.useMemo)(()=>ty(s.tests,r,a),[s.tests,a,r]),d=e=>{o(t=>iy(r,e,t)),i(e)};return(0,D.jsxs)(Wr,{title:`Tests`,subtitle:`Quality evidence and related dependency posture.`,children:[(0,D.jsxs)(`div`,{className:`asset-tests-summary`,children:[(0,D.jsxs)(`div`,{className:`asset-tests-summary__headline`,children:[(0,D.jsx)(`span`,{className:`tone-badge tone-badge--${l.tone}`,children:l.label}),(0,D.jsx)(`p`,{children:l.detail})]}),(0,D.jsxs)(`div`,{className:`asset-tests-summary__metrics`,"aria-label":`Test summary`,children:[(0,D.jsxs)(`span`,{className:`asset-tests-summary__metric`,children:[(0,D.jsx)(`strong`,{children:s.total}),(0,D.jsx)(`span`,{children:`Attached tests`})]}),(0,D.jsxs)(`span`,{className:`asset-tests-summary__metric`,children:[(0,D.jsx)(`strong`,{children:s.passing}),(0,D.jsx)(`span`,{children:`Passing`})]}),(0,D.jsxs)(`span`,{className:`asset-tests-summary__metric`,children:[(0,D.jsx)(`strong`,{children:s.attention}),(0,D.jsx)(`span`,{children:`Attention items`})]})]})]}),s.tests.length===0?(0,D.jsx)(`p`,{className:`resource-spotlight__description resource-spotlight__description--muted`,children:`No attached tests were found for this asset in the current artifacts.`}):(0,D.jsxs)(`div`,{className:`asset-tests-table`,"aria-label":`Attached tests evidence`,children:[(0,D.jsx)(`div`,{className:`asset-tests-table__toolbar`,children:(0,D.jsx)(`p`,{className:`asset-tests-table__caption`,children:`Compare attached test evidence by status, target, duration, and type. Failed and warned tests include run messages when dbt provides them.`})}),(0,D.jsxs)(`div`,{className:`asset-tests-table__header`,role:`row`,children:[ay.map(({key:e,label:t,alignEnd:n,testCell:i})=>{let o=ry(r,e,a);return(0,D.jsx)(`div`,{className:`asset-tests-table__cell${i?` asset-tests-table__cell--test`:``}${n?` asset-tests-table__cell--align-end`:``}`,role:`columnheader`,"aria-sort":o.ariaSort,children:(0,D.jsxs)(`button`,{type:`button`,className:`asset-tests-table__sort-button${n?` asset-tests-table__sort-button--align-end`:``}`,onClick:()=>d(e),children:[t,(0,D.jsx)(`span`,{className:`asset-tests-table__sort-indicator`,"aria-hidden":`true`,children:o.indicator})]})},e)}),(0,D.jsx)(`div`,{className:`asset-tests-table__cell asset-tests-table__cell--align-end`,role:`columnheader`,children:`Action`})]}),(0,D.jsx)(`div`,{className:`asset-tests-table__body`,children:u.map(e=>{let t=e.runResultMessage!=null&&e.runResultMessage!==``&&(e.statusTone===`danger`||e.statusTone===`warning`);return(0,D.jsxs)(`div`,{className:`asset-tests-table__row-group`,children:[(0,D.jsxs)(`button`,{type:`button`,className:`asset-tests-table__row`,"aria-label":e.testAttachedTarget?`Open ${e.name} (${e.testAttachedTarget}) in runs`:`Open ${e.name} in runs`,onClick:()=>n(`runs`,{executionId:e.uniqueId}),children:[(0,D.jsxs)(`div`,{className:`asset-tests-table__cell asset-tests-table__cell--test`,children:[(0,D.jsx)(`strong`,{title:e.name,children:e.name}),(0,D.jsx)(`span`,{className:`asset-tests-table__pkg`,children:e.packageName||`workspace`})]}),(0,D.jsx)(`div`,{className:`asset-tests-table__cell`,"data-label":`Status`,children:(0,D.jsx)(`span`,{className:nr(e.statusTone),children:e.status??`Not executed`})}),(0,D.jsx)(`div`,{className:`asset-tests-table__cell`,"data-label":`Type`,children:(0,D.jsx)(Gr,{resourceType:e.resourceType})}),(0,D.jsx)(`div`,{className:`asset-tests-table__cell asset-tests-table__cell--target`,"data-label":`Target`,title:e.testAttachedTarget??void 0,children:e.testAttachedTarget??`—`}),(0,D.jsx)(`div`,{className:`asset-tests-table__cell asset-tests-table__cell--align-end`,"data-label":`Duration`,children:Xn(e.executionTime)}),(0,D.jsx)(`div`,{className:`asset-tests-table__cell asset-tests-table__cell--align-end asset-tests-table__cell--action`,"data-label":`Action`,children:(0,D.jsx)(`span`,{className:`asset-tests-table__open-runs-icon`,"aria-hidden":`true`,children:(0,D.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.jsx)(`path`,{d:`M4.25 11.75 11.25 4.75`}),(0,D.jsx)(`path`,{d:`M5.5 4.75h5.75v5.75`})]})})})]}),t?(0,D.jsx)(`div`,{className:`asset-tests-table__run-message${e.statusTone===`warning`?` asset-tests-table__run-message--warn`:``}`,role:`note`,"aria-label":`dbt message for ${e.name}`,children:e.runResultMessage}):null]},e.uniqueId)})})]})]})}function sy(e){return e===`runtime`?`summary`:e}function cy({resource:e,analysis:t,onSelectResource:n,assetViewState:r,onAssetViewStateChange:i,lineageViewState:a,onLineageViewStateChange:o,onNavigateTo:s}){let l=(0,c.useMemo)(()=>new Map(t.resources.map(e=>[e.uniqueId,e])),[t.resources]),u=(0,c.useMemo)(()=>e==null?null:t.executions.find(t=>t.uniqueId===e.uniqueId)??null,[t.executions,e]),d=a.upstreamDepth,f=a.downstreamDepth,p=a.allDepsMode,m=a.lensMode,h=a.activeLegendKeys,g=e=>o(t=>({...t,upstreamDepth:typeof e==`function`?e(t.upstreamDepth):e})),_=e=>o(t=>({...t,downstreamDepth:typeof e==`function`?e(t.downstreamDepth):e})),v=e=>o(t=>({...t,allDepsMode:typeof e==`function`?e(t.allDepsMode):e})),y=e=>o(t=>({...t,lensMode:e,activeLegendKeys:new Set})),b=e=>o(t=>({...t,activeLegendKeys:typeof e==`function`?e(t.activeLegendKeys):e})),x=sy(r.activeTab),[S,C]=(0,c.useState)(!1),w=(0,c.useRef)(new Map([[`summary`,null],[`lineage`,null],[`sql`,null],[`tests`,null]]));(0,c.useEffect)(()=>{if(!e)return;let t=w.current.get(x);if(!t)return;let n=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;t.scrollIntoView({block:`start`,behavior:n?`auto`:`smooth`})},[x,e]);let{compiledCode:T,rawCode:E,loading:O,error:k}=Rs(e?.uniqueId??null,t);if(!e)return(0,D.jsx)(`div`,{className:`workspace-card`,children:(0,D.jsx)(Fo,{icon:`🔍`,headline:`No resource selected`,subtext:`Adjust the explorer filters or search to find the resource you're looking for.`})});let A=t.dependencyIndex[e.uniqueId],j=T??E??void 0,M=T!=null&&T!==``,N=e.definition??null,P=N?.kind===`metric`||N?.kind===`semantic_model`,F=(0,D.jsxs)(`div`,{className:`resource-detail__subtitle`,children:[(0,D.jsx)(Gr,{resourceType:e.resourceType}),e.semantics?(0,D.jsx)(Io,{semantics:e.semantics}):null,(0,D.jsx)(`span`,{className:`resource-detail__package`,children:e.packageName||`workspace`})]}),I={resource:e,dependencySummary:A,dependencyIndex:t.dependencyIndex,resourceById:l,upstreamDepth:d,downstreamDepth:f,allDepsMode:p,lensMode:m,activeLegendKeys:h,setUpstreamDepth:g,setDownstreamDepth:_,setAllDepsMode:v,setLensMode:y,setActiveLegendKeys:b,onSelectResource:e=>{n(e),o(t=>({...t,selectedResourceId:e})),i(t=>({...t,selectedResourceId:e,activeTab:`lineage`}))}};return(0,D.jsxs)(`div`,{className:`workspace-view asset-workspace`,children:[(0,D.jsxs)(`section`,{className:`catalog-detail-hero`,children:[(0,D.jsxs)(`div`,{className:`catalog-detail-hero__content`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Selected asset`}),(0,D.jsx)(`h3`,{children:e.name}),F]}),(0,D.jsx)(`div`,{className:`asset-hero__actions`,"aria-label":`Asset actions`,children:(0,D.jsx)(`button`,{type:`button`,className:`workspace-pill`,onClick:()=>s(`timeline`,{resourceId:e.uniqueId,executionId:e.uniqueId}),children:`Open in Timeline`})})]}),(0,D.jsx)(`div`,{className:`asset-workspace__body`,children:(0,D.jsxs)(`div`,{className:`asset-workspace__sections`,children:[(0,D.jsx)(`section`,{id:`asset-section-summary`,ref:e=>{w.current.set(`summary`,e)},className:`asset-workspace__section`,children:(0,D.jsx)(wv,{resource:e,executionRow:u})}),(0,D.jsx)(`section`,{id:`asset-section-lineage`,ref:e=>{w.current.set(`lineage`,e)},className:`asset-workspace__section`,children:(0,D.jsx)(Ic,{...I,displayMode:`summary`,openFullscreen:S,onFullscreenChange:C})}),(0,D.jsx)(`section`,{id:`asset-section-tests`,ref:e=>{w.current.set(`tests`,e)},className:`asset-workspace__section`,children:(0,D.jsx)(oy,{resource:e,analysis:t,onNavigateTo:s})}),(0,D.jsx)(`section`,{id:`asset-section-sql`,ref:e=>{w.current.set(`sql`,e)},className:`asset-workspace__section`,children:(0,D.jsx)(Wv,{showsDefinition:P,definition:N,sqlText:j,codeLoading:O,codeError:k,hasCompiledSql:M})})]})})]})}var ly=200;function uy({analysis:e,resource:t,onSelectResource:n,assetViewState:r,onAssetViewStateChange:i,lineageViewState:a,onLineageViewStateChange:o,onInvestigationSelectionChange:s,onNavigateTo:l}){let[u,d]=(0,c.useState)(``),[f,p]=(0,c.useState)([]),[m,h]=(0,c.useState)(!1),[g,_]=(0,c.useState)(``),v=(0,c.useRef)(0);(0,c.useEffect)(()=>{let e=u.trim(),t=e?ly:0,n=window.setTimeout(()=>{if(!e){v.current+=1,p([]),h(!1);return}v.current+=1;let t=v.current;h(!0),C(e).then(e=>{v.current===t&&p(e)}).catch(()=>{v.current===t&&p([])}).finally(()=>{v.current===t&&h(!1)})},t);return()=>window.clearTimeout(n)},[u]);let y=e=>{e&&(i(t=>({...t,selectedResourceId:e,activeTab:`lineage`})),o(t=>({...t,rootResourceId:e,selectedResourceId:e})),s(t=>({...t,selectedResourceId:e,sourceLens:`inventory`})))};return(0,D.jsx)(Jr,{title:`Inventory`,description:`Browse, filter, and inspect all workspace assets.`,className:`inventory-view`,suppressHeader:t!=null,children:t?(0,D.jsx)(cy,{analysis:e,resource:t,onSelectResource:e=>{n(e),s(t=>({...t,selectedResourceId:e,sourceLens:`inventory`}))},assetViewState:r,onAssetViewStateChange:i,lineageViewState:a,onLineageViewStateChange:o,onNavigateTo:l}):(0,D.jsx)(`div`,{className:`inventory-empty-state`,children:(0,D.jsxs)(`div`,{className:`inventory-empty-state__inner`,children:[(0,D.jsx)(Fo,{icon:`◱`,headline:`Select an asset to inspect`,subtext:`Use the browser panel on the left to find and select a model, source, seed, or other asset.`}),(0,D.jsxs)(`div`,{className:`inventory-empty-state__lineage-pick`,role:`group`,"aria-label":`Jump to lineage for an asset`,children:[(0,D.jsx)(`label`,{className:`inventory-empty-state__lineage-label`,htmlFor:`inventory-lineage-search`,children:`Or search for an asset to open its lineage graph`}),(0,D.jsx)(`input`,{id:`inventory-lineage-search`,type:`search`,className:`inventory-empty-state__lineage-search`,value:u,onChange:e=>{d(e.target.value),_(``)},placeholder:`Name, type, package, or unique id…`,autoComplete:`off`,enterKeyHint:`search`}),m&&(0,D.jsx)(`p`,{className:`inventory-empty-state__lineage-hint`,"aria-live":`polite`,children:`Searching…`}),f.length>0&&(0,D.jsx)(`ul`,{className:`inventory-empty-state__lineage-suggestions`,role:`listbox`,"aria-label":`Matching assets`,children:f.map(e=>(0,D.jsx)(`li`,{role:`none`,children:(0,D.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":g===e.uniqueId,className:g===e.uniqueId?`inventory-lineage-suggestion inventory-lineage-suggestion--active`:`inventory-lineage-suggestion`,onClick:()=>{v.current+=1,_(e.uniqueId),d(`${e.name} (${e.resourceType})`),p([]),h(!1)},children:[(0,D.jsx)(`span`,{className:`inventory-lineage-suggestion__name`,children:e.name}),(0,D.jsxs)(`span`,{className:`inventory-lineage-suggestion__meta`,children:[e.resourceType,e.packageName?` · ${e.packageName}`:``]})]})},e.uniqueId))}),(0,D.jsx)(`button`,{type:`button`,className:`workspace-pill`,disabled:!g,onClick:()=>y(g),children:`Open lineage graph`})]})]})})})}var dy=100;function fy(){return{status:{all:0,positive:0,warning:0,danger:0},facets:{all:0,models:0,tests:0,seeds:0,snapshots:0,operations:0,healthy:0,warnings:0,errors:0,issues:0},resourceTypes:{},threadIds:{}}}function py(e,t,n=!0){let r=(0,c.useRef)(null),i=(0,c.useRef)(0),[a,o]=(0,c.useState)(!1),[s,l]=(0,c.useState)(dy),[u,d]=(0,c.useState)([]),[f,p]=(0,c.useState)(0),[m,h]=(0,c.useState)(fy),[g,_]=(0,c.useState)(!0),[v,y]=(0,c.useState)(!1),[b,x]=(0,c.useState)(null);return(0,c.useEffect)(()=>{l(dy)},[t.kind,t.status,t.query,t.durationBand,t.sortBy,t.sortDirection,t.resourceTypes,t.materializationKinds,t.threadIds,e]),(0,c.useEffect)(()=>{if(!n){o(!1),_(!1),y(!1),d([]),p(0),h(fy()),x(null);return}let t=new Worker(new URL(`/assets/results-query.worker-CM0N9VyM.js`,``+import.meta.url),{type:`module`});return r.current=t,o(!1),_(!0),d([]),p(0),h(fy()),x(null),t.onmessage=e=>{let t=e.data;if(t.type===`ready`){o(!0),_(!1),h(t.summary);return}if(t.type===`query-result`){if(t.requestId!==i.current)return;d(t.rows),p(t.totalMatches),h(t.summary),y(!1);return}x(t.message),_(!1),y(!1)},t.postMessage({type:`init`,rows:e}),()=>{t.terminate(),r.current=null}},[e,n]),(0,c.useEffect)(()=>{if(!n||!a||r.current==null)return;let e=i.current+1;i.current=e,y(!0),x(null),r.current.postMessage({type:`query`,requestId:e,kind:t.kind,status:t.status,query:t.query,resourceTypes:Array.from(t.resourceTypes),materializationKinds:Array.from(t.materializationKinds),threadIds:Array.from(t.threadIds),durationBand:t.durationBand,sortBy:t.sortBy,sortDirection:t.sortDirection,limit:s})},[n,a,s,t]),(0,c.useMemo)(()=>({rows:u,totalMatches:f,totalVisible:u.length,summary:m,hasMore:u.length<f,isIndexing:g,isLoading:v,error:b,loadMore:()=>l(e=>e+dy)}),[u,f,m,g,v,b])}function my(e){return e.kind===`number`?0:1}function hy(e){return`adapter:${e}`}function gy(e){return e.startsWith(`adapter:`)}function _y(e,t){let n=dn([e.adapterMetrics]).find(e=>e.key===t),r=n?ln(e.adapterMetrics,n.key):void 0;if(!(n==null||r===void 0))return{displayValue:un(n,r),sortValue:typeof r==`number`||typeof r==`string`?r:void 0,isScalar:!0}}function vy(e){let t=dn(e.map(e=>e.adapterMetrics)).map(t=>({id:hy(t.key),key:t.key,label:t.shortLabel,kind:t.kind,align:t.kind===`number`?`end`:`start`,isScalar:!0,presenceCount:e.filter(e=>ln(e.adapterMetrics,t.key)!==void 0).length})).sort((e,t)=>{let n=my(e),r=my(t);return n===r?e.presenceCount===t.presenceCount?e.key.localeCompare(t.key):t.presenceCount-e.presenceCount:n-r});return{allColumns:t,visibleColumns:t.slice(0,6),overflowColumns:t.slice(6)}}function yy(e,t){return t.map(t=>{let n=_y(e,t.key);return`${t.label}: ${n?.displayValue??`—`}`}).join(`
|
|
35
35
|
`)}var by=`Raw adapter response fields`,xy=`Adapter metrics`;function Sy({row:e,visibleColumns:t,overflowColumns:n,onNavigateTo:r}){if(!e)return null;let i=e.adapterResponseFields?.length??0,a=hn(e.adapterMetrics,e.adapterResponseFields),o=t.length>0||n.length>0?[...t.length>0?[{label:xy,value:yy(e,t)}]:[],...n.length>0?[{label:`More adapter metrics`,value:yy(e,n)}]:[]]:e.adapterMetrics?[{label:xy,value:`This row has normalized adapter metrics but none are configured as visible columns.`}]:[],s=i===0?[{label:by,value:`This row has no adapter_response fields.`}]:a.length>0?[{label:by,value:a.map(e=>`${e.label}: ${e.displayValue}`).join(`
|
|
36
|
-
`)}]:[],c=[...o,...s];return(0,D.jsx)(Xr,{eyebrow:`Selected run item`,title:e.name,typeLabel:Zn(e.resourceType),stats:[{label:`Status`,value:e.status},{label:`Duration`,value:Xn(e.executionTime)},{label:`Thread`,value:e.threadId??`n/a`},{label:xy,value:String(t.length+n.length)},{label:`Extra raw fields`,value:String(a.length)}],sections:c,actions:[{label:`Open in Timeline`,onClick:()=>r(`timeline`,{resourceId:e.uniqueId,executionId:e.uniqueId})},{label:`Open in Inventory`,onClick:()=>r(`inventory`,{resourceId:e.uniqueId,assetTab:`summary`})},{label:`Open in Lineage`,onClick:()=>r(`inventory`,{resourceId:e.uniqueId,assetTab:`lineage`,rootResourceId:e.uniqueId})}]})}function Cy(e){if(gy(e))return`desc`;switch(e){case`attention`:case`duration`:case`start`:return`desc`;default:return`asc`}}function wy(e,t){return t.sortBy===e?{sortBy:e,sortDirection:t.sortDirection===`asc`?`desc`:`asc`}:{sortBy:e,sortDirection:Cy(e)}}function Ty(e,t,n){return e===t?n===`asc`?{indicator:`↑`,ariaSort:`ascending`}:{indicator:`↓`,ariaSort:`descending`}:{indicator:` `,ariaSort:`none`}}function Ey(e){let t=[`minmax(280px, 2.5fr)`,`minmax(108px, 0.85fr)`,`minmax(92px, 0.7fr)`,`minmax(132px, 0.95fr)`,`minmax(96px, 0.72fr)`],n=e.map(e=>e.align===`end`?`minmax(120px, 0.95fr)`:`minmax(148px, 1.1fr)`);return[...t,...n,`minmax(160px, 1fr)`].join(` `)}function Dy(e,t){return _y(e,t.key)?.displayValue??`—`}var Oy=`results-table__cell--align-end`;function ky({sortKey:e,label:t,alignEnd:n,cellClassName:r,runsViewState:i,onRunsViewStateChange:a}){let o=Ty(i.sortBy,e,i.sortDirection);return(0,D.jsx)(`div`,{className:`results-table__cell${r?` ${r}`:``}${n?` ${Oy}`:``}`,role:`columnheader`,"aria-sort":o.ariaSort,children:(0,D.jsxs)(`button`,{type:`button`,className:`results-table__sort-button${n?` results-table__sort-button--align-end`:``}`,onClick:()=>a(t=>({...t,...wy(e,t)})),children:[t,(0,D.jsx)(`span`,{className:`results-table__sort-indicator`,"aria-hidden":`true`,children:o.indicator})]})})}function Ay({analysis:e,runsResults:t,runsViewState:n,adapterColumns:r,onRunsViewStateChange:i,onInvestigationSelectionChange:a}){let o=(0,c.useRef)(null),l=(0,c.useRef)(null),[u,d]=(0,c.useState)(44);(0,c.useLayoutEffect)(()=>{let e=l.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>{d(Math.max(1,Math.ceil(e.getBoundingClientRect().height)))};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[r.length]);let f=s({count:t.rows.length,getScrollElement:()=>o.current,estimateSize:()=>76,overscan:10,scrollMargin:u});(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let n=()=>{e.scrollHeight-e.scrollTop-e.clientHeight<220&&t.hasMore&&!t.isLoading&&!t.isIndexing&&t.loadMore()};return e.addEventListener(`scroll`,n),n(),()=>e.removeEventListener(`scroll`,n)},[t]);let p={"--results-table-columns":Ey(r)},m=Math.min(560,Math.max(120,t.rows.length*76)),h=f.options.scrollMargin;return(0,D.jsx)(`div`,{className:`results-table`,style:p,children:(0,D.jsxs)(`div`,{ref:o,className:`results-table__scroll`,style:{height:m,overflowY:`auto`,position:`relative`},children:[(0,D.jsxs)(`div`,{ref:l,className:`results-table__header results-table__header--sticky`,role:`row`,children:[(0,D.jsx)(ky,{sortKey:`name`,label:`Item`,cellClassName:`results-table__cell--item`,runsViewState:n,onRunsViewStateChange:i}),(0,D.jsx)(ky,{sortKey:`resourceType`,label:`Type`,runsViewState:n,onRunsViewStateChange:i}),(0,D.jsx)(ky,{sortKey:`materialization`,label:`Materialization`,runsViewState:n,onRunsViewStateChange:i}),(0,D.jsx)(ky,{sortKey:`status`,label:`Status`,runsViewState:n,onRunsViewStateChange:i}),(0,D.jsx)(ky,{sortKey:`duration`,label:`Duration`,alignEnd:!0,runsViewState:n,onRunsViewStateChange:i}),r.map(e=>{let t=e.align===`end`;return e.isScalar?(0,D.jsx)(ky,{sortKey:e.id,label:e.label,alignEnd:t,runsViewState:n,onRunsViewStateChange:i},e.id):(0,D.jsx)(`div`,{className:`results-table__cell${t?` ${Oy}`:``}`,role:`columnheader`,title:e.label,children:e.label},e.id)}),(0,D.jsx)(ky,{sortKey:`thread`,label:`Thread`,runsViewState:n,onRunsViewStateChange:i})]}),(0,D.jsx)(`div`,{className:`results-table__body`,children:(0,D.jsx)(`div`,{style:{height:f.getTotalSize(),position:`relative`},children:f.getVirtualItems().map(o=>{let s=t.rows[o.index];return s?(0,D.jsxs)(`button`,{type:`button`,className:`results-table__row${s.uniqueId===n.selectedExecutionId?` results-table__row--active`:``}`,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${o.start-h}px)`},onClick:()=>{let t=e.resources.find(e=>e.uniqueId===s.uniqueId)??null;i(e=>({...e,selectedExecutionId:s.uniqueId})),a(e=>({...e,selectedExecutionId:s.uniqueId,selectedResourceId:t?.uniqueId??s.uniqueId,sourceLens:`runs`}))},children:[(0,D.jsx)(`div`,{className:`results-table__cell results-table__cell--item`,"data-label":`Item`,title:s.name,children:(0,D.jsx)(`strong`,{children:s.name})}),(0,D.jsx)(`div`,{className:`results-table__cell`,"data-label":`Type`,title:s.resourceType,children:s.resourceType}),(0,D.jsx)(`div`,{className:`results-table__cell`,"data-label":`Materialization`,children:s.semantics?(0,D.jsx)(Io,{semantics:s.semantics,variant:`compact`}):`—`}),(0,D.jsx)(`div`,{className:`results-table__cell`,"data-label":`Status`,children:(0,D.jsx)(`span`,{className:nr(s.statusTone),children:s.status})}),(0,D.jsx)(`div`,{className:`results-table__cell ${Oy}`,"data-label":`Duration`,children:Xn(s.executionTime)}),r.map(e=>{let t=Dy(s,e);return(0,D.jsx)(`div`,{className:`results-table__cell${e.align===`end`?` ${Oy}`:``}`,"data-label":e.label,title:t,children:t},e.id)}),(0,D.jsx)(`div`,{className:`results-table__cell`,"data-label":`Thread`,title:s.threadId??`n/a`,children:s.threadId??`n/a`})]},s.uniqueId):null})})})]})})}var jy=[{label:`All`,countKey:`all`},{kind:`models`,label:`Models`,countKey:`models`},{kind:`tests`,label:`Tests`,countKey:`tests`},{kind:`seeds`,label:`Seeds`,countKey:`seeds`},{kind:`snapshots`,label:`Snapshots`,countKey:`snapshots`},{kind:`operations`,label:`Operations`,countKey:`operations`},{status:`positive`,label:`Healthy`,countKey:`healthy`},{status:`issues`,label:`Issues`,countKey:`issues`},{status:`warning`,label:`Warnings`,countKey:`warnings`},{status:`danger`,label:`Errors`,countKey:`errors`}];function My(e){return e.facets}function Ny({runsViewState:e,runsResults:t,adapterColumnLayout:n,adapterMetricsAvailable:r,availableMaterializationKinds:i,onRunsViewStateChange:a}){let o=n.visibleColumns.filter(e=>e.isScalar),s=e.showAdapterMetrics&&o.length>0;return(0,D.jsxs)(`div`,{className:`runs-toolbar runs-toolbar--stacked`,children:[(0,D.jsxs)(`div`,{className:`runs-toolbar__controls`,children:[(0,D.jsxs)(`label`,{className:`workspace-search workspace-search--compact runs-toolbar__search`,children:[(0,D.jsx)(`span`,{children:`Search`}),(0,D.jsx)(`input`,{value:e.query,onChange:e=>a(t=>({...t,query:e.target.value})),placeholder:`Filter by name, type, status, thread…`})]}),(0,D.jsxs)(`label`,{className:`workspace-search workspace-search--compact runs-toolbar__sort`,children:[(0,D.jsx)(`span`,{children:`Sort`}),(0,D.jsxs)(`select`,{value:e.sortBy,onChange:e=>{let t=e.target.value;a(e=>({...e,sortBy:t,sortDirection:Cy(t)}))},children:[(0,D.jsx)(`option`,{value:`attention`,children:`Attention`}),(0,D.jsx)(`option`,{value:`duration`,children:`Duration`}),(0,D.jsx)(`option`,{value:`name`,children:`Name`}),(0,D.jsx)(`option`,{value:`status`,children:`Status`}),(0,D.jsx)(`option`,{value:`start`,children:`Start`}),(0,D.jsx)(`option`,{value:`materialization`,children:`Materialization`}),s?o.map(e=>(0,D.jsx)(`option`,{value:e.id,children:e.label},e.id)):null]})]}),(0,D.jsxs)(`label`,{className:`runs-toolbar__toggle`,title:r?`Show normalized adapter metrics derived from the current run`:`No normalized adapter metrics are available in this run`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:e.showAdapterMetrics,disabled:!r,onChange:e=>{let t=e.target.checked;a(e=>({...e,showAdapterMetrics:t,sortBy:!t&&gy(e.sortBy)?`attention`:e.sortBy,sortDirection:!t&&gy(e.sortBy)?`desc`:e.sortDirection}))}}),(0,D.jsx)(`span`,{children:`Adapter metrics`})]})]}),i.length>0?(0,D.jsxs)(`div`,{className:`runs-toolbar__mat-filters`,role:`group`,"aria-label":`Materialization filters`,children:[(0,D.jsx)(`span`,{className:`runs-toolbar__mat-filters-label`,children:`Materialization (manifest)`}),(0,D.jsx)(jo,{kinds:i,activeKinds:e.materializationKinds,onToggleKind:e=>a(t=>{let n=new Set(t.materializationKinds);return n.has(e)?n.delete(e):n.add(e),{...t,materializationKinds:n}}),buttonTitle:`Filter run rows by normalized manifest materialization`})]}):null,e.showAdapterMetrics&&n.overflowColumns.length>0?(0,D.jsxs)(`p`,{className:`runs-toolbar__meta`,children:[`Showing `,n.visibleColumns.length,` of`,` `,n.allColumns.length,` adapter metrics. Select a row to inspect the remaining `,n.overflowColumns.length,`.`]}):null,(0,D.jsx)(`div`,{className:`runs-toolbar__facets`,children:jy.map(n=>{let r=My(t.summary);return(0,D.jsxs)(`button`,{type:`button`,className:n.kind!=null&&e.kind===n.kind||n.status!=null&&e.status===n.status||n.kind==null&&n.status==null&&e.kind===`all`&&e.status===`all`?`workspace-pill workspace-pill--active`:`workspace-pill`,onClick:()=>a(e=>({...e,kind:n.kind??`all`,status:n.status??`all`})),children:[n.label,` (`,r[n.countKey],`)`]},n.label)})})]})}function Py({analysis:e,runsViewState:t,onRunsViewStateChange:n,onInvestigationSelectionChange:r,onNavigateTo:i}){let a=(0,c.useMemo)(()=>vy(e.executions),[e.executions]),o=a.allColumns.length>0,s=(0,c.useMemo)(()=>t.showAdapterMetrics&&o?a.visibleColumns:[],[a.visibleColumns,o,t.showAdapterMetrics]),l=(0,c.useMemo)(()=>_a(e.executions.map(e=>e.semantics)),[e.executions]),u=(0,c.useMemo)(()=>t.showAdapterMetrics&&o?a.overflowColumns:[],[a.overflowColumns,o,t.showAdapterMetrics]);(0,c.useEffect)(()=>{let e=t.sortBy;gy(e)&&!s.some(t=>t.id===e&&t.isScalar)&&n(e=>({...e,sortBy:`attention`,sortDirection:`desc`}))},[n,t.sortBy,s]),(0,c.useEffect)(()=>{!o&&t.showAdapterMetrics&&n(e=>({...e,showAdapterMetrics:!1}))},[o,n,t.showAdapterMetrics]);let d=py(e.executions,t,!0),f=e.executions.find(e=>e.uniqueId===t.selectedExecutionId)??null;return(0,D.jsx)(Jr,{title:`Runs`,description:`Execution and quality evidence across models, tests, seeds, snapshots, and operations.`,toolbar:(0,D.jsx)(Ny,{runsViewState:t,runsResults:d,adapterColumnLayout:a,adapterMetricsAvailable:o,availableMaterializationKinds:l,onRunsViewStateChange:n}),inspector:f?(0,D.jsx)(Sy,{row:f,visibleColumns:s,overflowColumns:u,onNavigateTo:i}):null,className:`runs-view`,children:(0,D.jsx)(Ay,{analysis:e,runsResults:d,runsViewState:t,adapterColumns:s,onRunsViewStateChange:n,onInvestigationSelectionChange:r})})}function Fy({analysis:e,activeView:t,analysisSource:n,overviewFilters:r,onOverviewFiltersChange:i,timelineFilters:a,onTimelineFiltersChange:o,assetViewState:s,onAssetViewStateChange:c,runsViewState:l,onRunsViewStateChange:u,lineageViewState:d,onLineageViewStateChange:f,onInvestigationSelectionChange:p,onNavigateTo:m,workspaceSignals:h}){let g=e.projectName??dr(e.executions),{explorerPane:_}=Ko({analysis:e,projectName:g,activeView:t,assetViewState:s,onAssetViewStateChange:c,onInvestigationSelectionChange:p}),v=s.selectedResourceId,y=e.resources.find(e=>e.uniqueId===v)??null;return(0,D.jsxs)(`div`,{className:`workspace-layout${_?``:` workspace-layout--full`}`,children:[_,(0,D.jsxs)(`div`,{className:`workspace-main-panel`,children:[t===`health`&&(0,D.jsx)(Ls,{analysis:e,projectName:g,analysisSource:n,filters:r,setFilters:i,workspaceSignals:h}),t===`inventory`&&(0,D.jsx)(uy,{analysis:e,resource:y,onSelectResource:e=>c(t=>({...t,selectedResourceId:e})),assetViewState:{...s,selectedResourceId:v},onAssetViewStateChange:c,lineageViewState:d,onLineageViewStateChange:f,onInvestigationSelectionChange:p,onNavigateTo:m}),t===`runs`&&(0,D.jsx)(Py,{analysis:e,runsViewState:l,onRunsViewStateChange:u,onInvestigationSelectionChange:p,onNavigateTo:m}),t===`timeline`&&(0,D.jsx)(Do,{analysis:e,filters:a,setFilters:o,onInvestigationSelectionChange:p})]})]})}function Iy(e){return e===`local`?`/path/to/target or relative/path`:e===`s3`?`s3://bucket/prefix or bucket/prefix`:`gs://bucket/prefix or bucket/prefix`}function Ly(e){return e===`local`?`Resolved on the server running this app, not in your browser.`:`Uses server-side SDK credentials; keys never enter the browser.`}function Ry(e){return e.discoverLoading?`Scanning for artifacts…`:e.discoveryError==null?e.scanSucceeded?`Artifacts found. You can load the workspace again if needed.`:e.location.trim()===``?`Enter a location, then scan.`:`Press Enter or Scan to check this location.`:`Scan failed. Fix the location and scan again.`}function zy(e){if(e.loadLoading)return`Loading artifact workspace…`;if(!e.canLoad){if(e.discoverLoading)return`Scanning for artifacts…`;if(e.discoveryError!=null)return`Fix the error below, then scan again.`;if(e.location.trim()===``)return`Enter a path, then press Enter, blur the field, or click Scan location.`;if(!e.scanSucceeded)return`Press Enter, blur Location, or click Scan location, then click Load workspace.`}}function By(e,t){if(e!==`gcs`||t==null)return{};let n=t.impersonatedServiceAccount?.trim();return n==null||n===``?{}:{options:{impersonatedServiceAccount:n}}}function Vy(e,t){if(typeof e!=`object`||!e)return t;let n=e.error;return typeof n==`string`&&n.trim()!==``?n:t}var Hy={manifest:`/api/manifest.json`,runResults:`/api/run_results.json`,catalog:`/api/catalog.json`,sources:`/api/sources.json`},Uy=[{manifest:`/api/artifacts/current/manifest.json`,runResults:`/api/artifacts/current/run_results.json`,catalog:`/api/artifacts/current/catalog.json`,sources:`/api/artifacts/current/sources.json`},Hy];function Wy(){return{checkedAtMs:Date.now(),remoteProvider:null,remoteLocation:null,pollIntervalMs:null,currentRun:null,pendingRun:null,supportsSwitch:!1,discoveryError:null,sourceKind:null,locationDisplay:null,missingOptionalArtifacts:void 0}}function Gy(e,t,n){return{mode:e,currentSource:t,label:n,...Wy()}}async function Ky(e){let t=await fetch(e);if(!t.ok)return null;let n=t.headers?.get?.(`content-type`)?.toLowerCase();return n!=null&&!n.includes(`application/json`)?null:t.arrayBuffer()}async function qy(e){try{return await Ky(e)}catch{return null}}async function Jy(e){try{return await Ky(e)}catch{return null}}async function Yy(e){let[t,n,r,i]=await Promise.all([qy(e.manifest),qy(e.runResults),Jy(e.catalog),Jy(e.sources)]);return t==null||n==null?null:{manifestBytes:t,runResultsBytes:n,...r==null?{}:{catalogBytes:r},...i==null?{}:{sourcesBytes:i}}}async function Xy(e=Uy){for(let t of e){let e=await Yy(t);if(e!=null)return e}return null}async function Zy(){let e=await Xy([Hy]);return e==null?null:x(e,`preload`)}async function Qy(){let e=await Zy();return{status:Gy(e==null?`none`:`preload`,e==null?null:`preload`,e==null?`Waiting for artifacts`:`Live target`),result:e}}async function $y(){let e=await fetch(`/api/artifact-source`);if(!e.ok)throw Error(`Failed to load artifact source status`);return await e.json()}async function eb(e=`preload`){let t=await Xy();return t==null?null:x(t,e)}async function tb(){let e;try{e=await fetch(`/api/artifact-source`)}catch{return Qy()}if(e.status===404||!e.ok)return Qy();let t;try{t=await e.json()}catch{return Qy()}return t.currentSource==null?{status:t,result:null}:{status:t,result:await eb(t.currentSource)}}async function nb(e){let t=await fetch(`/api/artifact-source/switch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?{runId:e}:{})});if(!t.ok)throw Error(`Failed to switch artifact source run`);return await t.json()}async function rb(e,t,n){let r=e===`local`?{type:`local`,location:t}:e===`s3`?{type:`s3`,location:t}:{type:`gcs`,location:t,...By(e,n)},i=await fetch(`/api/artifact-source/discover`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)}),a=await i.json().catch(()=>({}));if(!i.ok)throw Error(Vy(a,`Failed to discover artifact source`));return a}async function ib(e,t,n,r){let i={...e===`local`?{type:`local`,location:t}:e===`s3`?{type:`s3`,location:t}:{type:`gcs`,location:t},...n!=null&&n.trim()!==``?{runId:n}:{},...By(e,r)},a=await fetch(`/api/artifact-source/configure`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),o=await a.json().catch(()=>({}));if(!a.ok)throw Error(Vy(o,`Failed to configure artifact source`));return o}var ab=[{value:`local`,label:`Local directory`},{value:`s3`,label:`Amazon S3`},{value:`gcs`,label:`Google Cloud Storage`}];function ob(e){return e?`workspace-segmented-control__button workspace-segmented-control__button--active`:`workspace-segmented-control__button`}function sb({readinessRegionId:e,readinessLabel:t,sourceKind:n,onSourceKindChange:r,location:i,onLocationChange:a,onLocationBlur:o,onLocationKeyDown:s,impersonatedServiceAccount:c,onImpersonatedServiceAccountChange:l,onImpersonatedServiceAccountBlur:u,discoveryError:d,onScan:f,discoverLoading:p,canLoad:m,loadLoading:h,loadWorkspaceHint:g,onLoadWorkspace:_}){let v=[`artifact-location-helper`,d==null?void 0:`artifact-location-error`,e].filter(Boolean).join(` `);return(0,D.jsxs)(`div`,{className:`upload-panel`,children:[(0,D.jsxs)(`header`,{className:`upload-panel__header`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Artifact source`}),(0,D.jsx)(`h3`,{children:`Artifact location`}),(0,D.jsxs)(`p`,{className:`upload-panel__lede`,children:[`Folder or prefix with `,(0,D.jsx)(`code`,{children:`manifest.json`}),` and `,(0,D.jsx)(`code`,{children:`run_results.json`}),` at the root.`]})]}),(0,D.jsxs)(`div`,{className:`upload-panel__body artifact-load-panel__inputs`,children:[(0,D.jsxs)(`div`,{className:`upload-panel__field`,children:[(0,D.jsx)(`span`,{className:`upload-panel__label`,id:`artifact-source-kind-label`,children:`Connection`}),(0,D.jsx)(`div`,{className:`workspace-segmented-control`,role:`tablist`,"aria-labelledby":`artifact-source-kind-label`,children:ab.map(e=>{let t=n===e.value;return(0,D.jsx)(`button`,{type:`button`,role:`tab`,id:`artifact-source-tab-${e.value}`,"aria-selected":t,className:ob(t),onClick:()=>r(e.value),children:e.label},e.value)})})]}),(0,D.jsxs)(`div`,{className:`upload-panel__field`,children:[(0,D.jsx)(`label`,{className:`upload-panel__label`,htmlFor:`artifact-location-input`,children:`Location`}),(0,D.jsxs)(`div`,{className:`upload-panel__location-row`,children:[(0,D.jsx)(`input`,{id:`artifact-location-input`,type:`text`,autoComplete:`off`,"aria-invalid":d!=null,"aria-describedby":v,placeholder:Iy(n),value:i,onChange:e=>a(e.target.value),onBlur:o,onKeyDown:s}),(0,D.jsx)(`button`,{type:`button`,className:`secondary-action`,disabled:p||i.trim()===``,"aria-busy":p,onClick:f,children:p?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Tv,{size:16}),` Scanning…`]}):`Scan location`})]}),(0,D.jsx)(`p`,{id:`artifact-location-helper`,className:`upload-panel__helper`,children:Ly(n)}),d==null?null:(0,D.jsx)(`p`,{id:`artifact-location-error`,className:`upload-panel__error`,role:`alert`,children:d})]}),n===`gcs`?(0,D.jsxs)(`div`,{className:`upload-panel__field`,children:[(0,D.jsx)(`label`,{className:`upload-panel__label`,htmlFor:`artifact-gcs-impersonated-service-account`,children:`Impersonated service account`}),(0,D.jsx)(`input`,{id:`artifact-gcs-impersonated-service-account`,type:`text`,autoComplete:`off`,placeholder:`target-sa@project.iam.gserviceaccount.com`,value:c,onChange:e=>l(e.target.value),onBlur:()=>{u?.()}}),(0,D.jsx)(`p`,{className:`upload-panel__helper`,children:`Optional. Uses server-side Google credentials to impersonate this service account for GCS access. After editing, leave this field or run Scan location (or press Enter in Location).`})]}):null]}),(0,D.jsxs)(`footer`,{className:`upload-panel__footer`,children:[(0,D.jsx)(`span`,{id:e,className:`upload-panel__footer-status`,role:`status`,children:p?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Tv,{size:16}),` `,t]}):t}),(0,D.jsx)(`button`,{type:`button`,className:`primary-action`,disabled:!m||h,"aria-busy":h,"aria-describedby":e,title:g??void 0,onClick:_,children:h?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Tv,{size:16}),` Loading…`]}):`Load workspace`})]})]})}var cb=[{title:`Health-first overview`,body:`Spot failing nodes, long-running bottlenecks, and critical-path pressure before opening individual assets.`},{title:`Catalog-style context`,body:`Browse lineage-adjacent metadata such as descriptions, packages, execution status, and dependency depth in one flow.`},{title:`Timeline investigation`,body:`Shift from summary to execution sequencing without leaving the workspace, inspired by dbt docs and observability tools.`}];function lb(){return(0,D.jsxs)(`div`,{className:`upload-hero__copy`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Load artifacts`}),(0,D.jsx)(`h2`,{children:`Point the workspace at a directory or cloud prefix that contains dbt JSON artifacts.`}),(0,D.jsxs)(`p`,{children:[`The server discovers `,(0,D.jsx)(`code`,{children:`manifest.json`}),` and `,(0,D.jsx)(`code`,{children:`run_results.json`}),` `,`(required), plus optional `,(0,D.jsx)(`code`,{children:`catalog.json`}),` and `,(0,D.jsx)(`code`,{children:`sources.json`}),`. Cloud access uses server-side credentials only.`]}),(0,D.jsxs)(`div`,{className:`upload-hero__callout`,children:[(0,D.jsx)(`span`,{className:`upload-hero__callout-badge`,children:`Layout`}),(0,D.jsx)(`strong`,{children:`Artifacts must be at the location root (typical dbt target/).`}),(0,D.jsx)(`p`,{children:`Point at the directory or prefix that directly contains manifest.json and run_results.json.`})]}),(0,D.jsx)(`div`,{className:`upload-feature-grid`,children:cb.map(e=>(0,D.jsxs)(`article`,{className:`upload-feature-card`,children:[(0,D.jsx)(`strong`,{children:e.title}),(0,D.jsx)(`p`,{children:e.body})]},e.title))})]})}var ub=(0,c.createContext)({toast:()=>{}}),db=0,fb=4e3;function pb({children:e}){let[t,n]=(0,c.useState)([]),r=(0,c.useCallback)((e,t=`neutral`)=>{let r=++db;n(n=>[...n,{id:r,message:e,tone:t}]),setTimeout(()=>{n(e=>e.filter(e=>e.id!==r))},fb)},[]);function i(e){n(t=>t.filter(t=>t.id!==e))}return(0,D.jsxs)(ub.Provider,{value:{toast:r},children:[e,t.length>0&&(0,D.jsx)(`div`,{className:`toast-portal`,role:`status`,"aria-live":`polite`,children:t.map(e=>(0,D.jsxs)(`div`,{className:`toast toast--${e.tone}`,children:[(0,D.jsx)(`span`,{className:`toast__dot`,"aria-hidden":`true`}),(0,D.jsx)(`span`,{className:`toast__message`,children:e.message}),(0,D.jsx)(`button`,{type:`button`,className:`toast__dismiss`,"aria-label":`Dismiss notification`,onClick:()=>i(e.id),children:`✕`})]},e.id))})]})}function mb(){return(0,c.useContext)(ub)}function hb(e,t,n){return e===`gcs`?`gcs|${t}|${n}`:`${e}|${t}`}function gb(e,t,n,r){if(t===``)return null;let i=hb(e,t,n);return r!==``&&i===r?null:`Run artifact discovery again after changing the location or connection settings.`}function _b(e,t,n,r,i){return i?`Wait for artifact discovery to finish, then try loading again.`:gb(e,t,n,r)}function vb(e,t){if(e===`gcs`)return{impersonatedServiceAccount:t}}function yb({onManagedLoad:e,onError:t}){let{toast:n}=mb(),r=(0,c.useId)(),[i,a]=(0,c.useState)(`local`),[o,s]=(0,c.useState)(``),[l,u]=(0,c.useState)(``),[d,f]=(0,c.useState)(!1),[p,m]=(0,c.useState)(!1),[h,g]=(0,c.useState)(``),[_,v]=(0,c.useState)(null),y=(0,c.useRef)(o),b=(0,c.useRef)(i),x=(0,c.useRef)(l),S=(0,c.useRef)(h);y.current=o,b.current=i,x.current=l,S.current=h;let C=(0,c.useRef)(0),w=(0,c.useRef)(!1),T=hb(i,o.trim(),l.trim()),E=h!==``&&T===h,O=(0,c.useMemo)(()=>({discoverLoading:d,discoveryError:_,scanSucceeded:E,location:o}),[d,_,o,E]),k=(0,c.useMemo)(()=>Ry(O),[O]),A=E&&!p&&!d&&_==null,j=(0,c.useMemo)(()=>zy({...O,loadLoading:p,canLoad:A}),[A,p,O]),M=(0,c.useCallback)(async()=>{let r=b.current,i=_b(r,y.current.trim(),x.current.trim(),S.current,w.current);if(i!=null){t(i);return}m(!0),t(null);try{let r=await ib(b.current,y.current.trim(),void 0,vb(b.current,x.current)),i=r.currentSource;if(i!==`preload`&&i!==`remote`){t(`Artifacts are not ready to load.`);return}let a=r.missingOptionalArtifacts??{missingCatalog:!1,missingSources:!1};if(a.missingCatalog||a.missingSources){let e=[];a.missingCatalog&&e.push(`catalog.json`),a.missingSources&&e.push(`sources.json`),n(`Optional artifacts not loaded: ${e.join(`, `)}. Related inventory panels may be limited.`,`positive`)}let o=await eb(i);if(o==null){t(`Could not read artifact bytes from the server.`);return}e(o,i,a),b.current===`gcs`&&(S.current=``,g(``)),u(``)}catch(e){let r=e instanceof Error?e.message:`Failed to load artifacts.`;t(r),n(r,`danger`)}finally{m(!1)}},[t,e,n]),N=(0,c.useCallback)(async e=>{let n=b.current,r=y.current.trim(),i=hb(n,r,n===`gcs`?x.current.trim():``);if(r===``){t(`Enter a directory or bucket prefix.`);return}if(!e&&i===S.current)return;let a=++C.current;w.current=!0,f(!0),t(null),v(null),S.current=``,g(``);try{let e=await rb(n,r,vb(n,x.current));if(a!==C.current)return;if(e.discoveryError!=null){v(e.discoveryError),t(e.discoveryError);return}S.current=i,g(i),w.current=!1,await M()}catch(e){if(a!==C.current)return;let n=e instanceof Error?e.message:`Discovery failed.`;v(n),t(n)}finally{a===C.current&&(w.current=!1,f(!1))}},[M,t]);return(0,D.jsxs)(`section`,{className:`upload-hero`,children:[(0,D.jsx)(lb,{}),(0,D.jsx)(sb,{readinessRegionId:r,readinessLabel:k,discoveryError:_,onScan:()=>{N(!0)},sourceKind:i,onSourceKindChange:e=>{a(e),v(null),S.current=``,g(``),t(null)},location:o,onLocationChange:s,impersonatedServiceAccount:l,onImpersonatedServiceAccountChange:u,onImpersonatedServiceAccountBlur:()=>{b.current===`gcs`&&y.current.trim()!==``&&N(!1)},onLocationBlur:()=>{y.current.trim()!==``&&N(!1)},onLocationKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),N(!1))},discoverLoading:d,canLoad:A,loadLoading:p,loadWorkspaceHint:j,onLoadWorkspace:()=>{M()}})]})}function bb({className:e,style:t}){return(0,D.jsx)(`div`,{className:[`skeleton`,e].filter(Boolean).join(` `),style:t,"aria-hidden":`true`})}function xb(){return(0,D.jsxs)(`div`,{className:`loading-card`,children:[(0,D.jsx)(bb,{className:`loading-card__skeleton-icon`}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(bb,{className:`loading-card__skeleton-title`}),(0,D.jsx)(bb,{className:`loading-card__skeleton-body`})]})]})}var Sb=`workspace-pill workspace-pill--active`,Cb=`workspace-pill`;function wb(e){return e?Sb:Cb}function Tb({open:e,onClose:t,returnFocusRef:n,onManagedAnalysisLoaded:r,onError:i}){let a=(0,c.useRef)(null),o=(0,c.useRef)(!1);return(0,c.useEffect)(()=>{if(!e){o.current&&n.current?.focus(),o.current=!1;return}o.current=!0,a.current?.focus();let r=e=>{e.key===`Escape`&&(e.preventDefault(),t())};document.addEventListener(`keydown`,r);let i=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.removeEventListener(`keydown`,r),document.body.style.overflow=i}},[e,t,n]),e?(0,D.jsxs)(`div`,{className:`settings-artifact-dialog`,"aria-hidden":!1,children:[(0,D.jsx)(`button`,{type:`button`,className:`settings-artifact-dialog__backdrop`,"aria-label":`Close change location dialog`,onClick:()=>{i(null),t()}}),(0,D.jsxs)(`div`,{ref:a,className:`settings-artifact-dialog__panel`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-artifact-dialog-title`,tabIndex:-1,children:[(0,D.jsxs)(`header`,{className:`settings-artifact-dialog__header`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Artifacts`}),(0,D.jsx)(`h2`,{id:`settings-artifact-dialog-title`,children:`Change artifact location`}),(0,D.jsx)(`p`,{className:`settings-artifact-dialog__lede`,children:`Use the same directory or cloud prefix flow as the main workspace load screen. Credentials stay on the server.`})]}),(0,D.jsx)(`button`,{type:`button`,className:`settings-artifact-dialog__close`,"aria-label":`Close`,onClick:()=>{i(null),t()},children:(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`×`})})]}),(0,D.jsx)(`div`,{className:`settings-artifact-dialog__body`,children:(0,D.jsx)(yb,{onManagedLoad:r,onError:i})})]})]}):null}function Eb({analysisSource:e,executionCount:t}){return(0,D.jsxs)(`section`,{className:`settings-hero`,"aria-label":`Workspace preferences`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Workspace profile`}),(0,D.jsx)(`h3`,{children:`Configure how this console looks and behaves by default.`}),(0,D.jsx)(`p`,{children:`Changes save locally and apply to the current workspace immediately when the relevant view is open.`}),(0,D.jsxs)(`div`,{className:`settings-chip-row`,children:[(0,D.jsx)(`span`,{className:`app-badge`,children:br(e)}),(0,D.jsx)(`span`,{className:`settings-chip`,children:t==null?`No artifacts loaded`:`${t} executions loaded`})]})]})}function Db({themePreference:e,onThemeChange:t}){return(0,D.jsx)(Wr,{title:`Appearance`,subtitle:`Choose how the workspace chrome should render by default.`,children:(0,D.jsxs)(`div`,{className:`settings-field-group`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Theme`}),(0,D.jsx)(`div`,{className:`settings-segmented`,children:[`system`,`light`,`dark`].map(n=>(0,D.jsx)(`button`,{type:`button`,className:wb(e===n),onClick:()=>t(n),children:n===`system`?`System`:n.charAt(0).toUpperCase()+n.slice(1)},n))})]})})}function Ob({analysisSource:e,executionCount:t,artifactLocationSnapshot:n,onOpenChangeLocation:r,changeLocationTriggerRef:i,pendingRemoteRun:a,acceptingRemoteRun:o,onAcceptPendingRemoteRun:s}){let c=yr(n?.sourceKind),l=n?.locationDisplay!=null&&n.locationDisplay.trim()!==``?n.locationDisplay:null;return(0,D.jsx)(Wr,{title:`Session`,subtitle:`Current artifact source and data-loading controls.`,children:(0,D.jsxs)(`div`,{className:`settings-stack`,children:[(0,D.jsxs)(`div`,{className:`settings-readout`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Current source`}),(0,D.jsx)(`strong`,{children:br(e)}),(0,D.jsx)(`p`,{children:t==null?`Load artifacts to unlock analysis views.`:`${t} executions are available in this session.`})]}),(0,D.jsxs)(`div`,{className:`settings-readout`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Configured location`}),l==null?c==null?(0,D.jsx)(`p`,{className:`settings-readout-muted`,children:`Nothing configured yet. Use Change location… to open the load wizard and point this session at a directory or cloud prefix.`}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`strong`,{children:c}),(0,D.jsx)(`p`,{className:`settings-readout-muted`,children:`Path label was not returned for this session.`})]}):(0,D.jsxs)(D.Fragment,{children:[c==null?null:(0,D.jsx)(`strong`,{children:c}),(0,D.jsx)(`p`,{className:`settings-mono-path settings-session__path`,title:l,children:l})]})]}),(0,D.jsx)(`div`,{className:`settings-session__actions`,children:(0,D.jsx)(`button`,{ref:i,type:`button`,className:`primary-action settings-primary-action`,onClick:r,children:`Change location…`})}),a&&(0,D.jsx)(`button`,{type:`button`,className:`workspace-pill`,onClick:()=>void s(),disabled:o,children:o?`Switching…`:`Load ${a.label}`})]})})}function kb({preferences:e,setPreferences:t}){return(0,D.jsx)(Wr,{title:`Shell Defaults`,subtitle:`Control the default shape of the workspace chrome.`,children:(0,D.jsxs)(`div`,{className:`settings-field-group`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Sidebar`}),(0,D.jsxs)(`div`,{className:`settings-segmented`,children:[(0,D.jsx)(`button`,{type:`button`,className:wb(!e.sidebarCollapsedDefault),onClick:()=>t(e=>({...e,sidebarCollapsedDefault:!1})),children:`Expanded`}),(0,D.jsx)(`button`,{type:`button`,className:wb(e.sidebarCollapsedDefault),onClick:()=>t(e=>({...e,sidebarCollapsedDefault:!0})),children:`Collapsed`})]})]})})}function Ab({preferences:e,setPreferences:t}){return(0,D.jsx)(Wr,{title:`Timeline Defaults`,subtitle:`Set the default execution timeline filters and dependency focus.`,children:(0,D.jsxs)(`div`,{className:`settings-stack`,children:[(0,D.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,D.jsxs)(`label`,{className:`settings-toggle`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:e.timelineDefaults.showTests,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,showTests:e.target.checked}}))}),(0,D.jsx)(`span`,{children:`Show tests by default`})]}),(0,D.jsxs)(`label`,{className:`settings-toggle`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:e.timelineDefaults.failuresOnly,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,failuresOnly:e.target.checked}}))}),(0,D.jsx)(`span`,{children:`Start with failures-only emphasis`})]})]}),(0,D.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,D.jsxs)(`label`,{className:`settings-field`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Dependency direction`}),(0,D.jsxs)(`select`,{value:e.timelineDefaults.dependencyDirection,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,dependencyDirection:e.target.value}})),children:[(0,D.jsx)(`option`,{value:`upstream`,children:`Upstream`}),(0,D.jsx)(`option`,{value:`both`,children:`Both`}),(0,D.jsx)(`option`,{value:`downstream`,children:`Downstream`})]})]}),(0,D.jsxs)(`label`,{className:`settings-field`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Dependency depth`}),(0,D.jsx)(`input`,{type:`number`,min:`1`,max:`10`,value:e.timelineDefaults.dependencyDepthHops,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,dependencyDepthHops:Math.max(1,Math.min(10,Number(e.target.value)||1))}}))})]})]})]})})}function jb({preferences:e,setPreferences:t}){return(0,D.jsx)(Wr,{title:`Inventory Defaults`,subtitle:`Choose how asset exploration and lineage open by default.`,children:(0,D.jsxs)(`div`,{className:`settings-stack`,children:[(0,D.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,D.jsxs)(`label`,{className:`settings-field`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Explorer mode`}),(0,D.jsxs)(`select`,{value:e.inventoryDefaults.explorerMode,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,explorerMode:e.target.value}})),children:[(0,D.jsx)(`option`,{value:`project`,children:`Project`}),(0,D.jsx)(`option`,{value:`database`,children:`Database`})]})]}),(0,D.jsxs)(`label`,{className:`settings-field`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Lineage lens`}),(0,D.jsxs)(`select`,{value:e.inventoryDefaults.lineageLensMode,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,lineageLensMode:e.target.value}})),children:[(0,D.jsx)(`option`,{value:`type`,children:`Type`}),(0,D.jsx)(`option`,{value:`status`,children:`Status`}),(0,D.jsx)(`option`,{value:`coverage`,children:`Coverage`})]})]})]}),(0,D.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,D.jsxs)(`label`,{className:`settings-field`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Upstream depth`}),(0,D.jsx)(`input`,{type:`number`,min:`1`,max:`10`,value:e.inventoryDefaults.lineageUpstreamDepth,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,lineageUpstreamDepth:Math.max(1,Math.min(10,Number(e.target.value)||1))}}))})]}),(0,D.jsxs)(`label`,{className:`settings-field`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Downstream depth`}),(0,D.jsx)(`input`,{type:`number`,min:`1`,max:`10`,value:e.inventoryDefaults.lineageDownstreamDepth,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,lineageDownstreamDepth:Math.max(1,Math.min(10,Number(e.target.value)||1))}}))})]})]}),(0,D.jsxs)(`label`,{className:`settings-toggle`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:e.inventoryDefaults.allDepsMode,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,allDepsMode:e.target.checked}}))}),(0,D.jsx)(`span`,{children:`Open lineage with all dependencies expanded`})]})]})})}function Mb({preferences:e,setPreferences:t,themePreference:n,setThemePreference:r,analysisSource:i,artifactLocationSnapshot:a,executionCount:o,onManagedAnalysisLoaded:s,onError:l,pendingRemoteRun:u,acceptingRemoteRun:d,onAcceptPendingRemoteRun:f}){let[p,m]=(0,c.useState)(!1),h=(0,c.useRef)(null),g=(0,c.useCallback)((e,t,n)=>{m(!1),s(e,t,n)},[s]);return(0,D.jsxs)(Jr,{title:`Settings`,description:`Workspace defaults, visual preferences, and session controls.`,className:`settings-view`,children:[(0,D.jsx)(Tb,{open:p,onClose:()=>{l(null),m(!1)},returnFocusRef:h,onManagedAnalysisLoaded:g,onError:l}),(0,D.jsxs)(`div`,{className:`settings-grid`,children:[(0,D.jsx)(Eb,{analysisSource:i,executionCount:o}),(0,D.jsx)(Db,{themePreference:n,onThemeChange:e=>{r(e),t(t=>({...t,theme:e}))}}),(0,D.jsx)(Ob,{analysisSource:i,executionCount:o,artifactLocationSnapshot:a,onOpenChangeLocation:()=>m(!0),changeLocationTriggerRef:h,pendingRemoteRun:u,acceptingRemoteRun:d,onAcceptPendingRemoteRun:f}),(0,D.jsx)(kb,{preferences:e,setPreferences:t}),(0,D.jsx)(Ab,{preferences:e,setPreferences:t}),(0,D.jsx)(jb,{preferences:e,setPreferences:t})]})]})}function Nb({kind:e}){let t={fill:`none`,stroke:`currentColor`,strokeWidth:1.8,strokeLinecap:`round`,strokeLinejoin:`round`};return e===`invocation`?(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{...t,d:`M20 12.5V7a2 2 0 0 0-2-2h-6.2a2 2 0 0 0-1.4.58l-4.82 4.82A2 2 0 0 0 5 11.82V17a2 2 0 0 0 2 2h5.5`}),(0,D.jsx)(`path`,{...t,d:`M9 5v4a2 2 0 0 1-2 2H5`}),(0,D.jsx)(`circle`,{...t,cx:`17.5`,cy:`17.5`,r:`3.5`})]}):e===`time`?(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{...t,cx:`12`,cy:`12`,r:`8`}),(0,D.jsx)(`path`,{...t,d:`M12 7.8v4.6l3 1.8`})]}):e===`project`?(0,D.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{...t,d:`M3.5 8.5a2 2 0 0 1 2-2h3l1.4 1.7h8.6a2 2 0 0 1 2 2v7.5a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z`})}):(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{...t,d:`M11.25 4.75 5.5 7.7v4.55c0 3.65 2.7 6.95 6.5 7.95 3.8-1 6.5-4.3 6.5-7.95V7.7z`}),(0,D.jsx)(`path`,{...t,d:`M9.4 12.15 11.2 14l3.35-3.45`})]})}function Pb(e,t){let n=e?.projectName??null,r=e?.invocationId??null,i=e?.warehouseType??null,a=e?tr(e):null,o=a==null?null:er(a);return{label:n??`Workspace session`,subtitle:n==null&&r==null&&o==null?`Load artifacts to populate session details.`:null,summaryItems:[r?{key:`invocation`,label:`Invocation ID`,value:r,icon:`invocation`}:null,o?{key:`timestamp`,label:`Timestamp`,value:o,icon:`time`}:null,{key:`source`,label:`Source mode`,value:br(t),icon:`source`},i?{key:`warehouse`,label:`Warehouse type`,value:i.charAt(0).toUpperCase()+i.slice(1),icon:`project`}:null].filter(e=>e!=null)}}function Fb({summaryItems:e}){return(0,D.jsx)(`div`,{className:`app-header__summary-grid`,"aria-label":`Session metadata`,children:e.map(e=>(0,D.jsxs)(`div`,{className:`app-header__summary-item`,children:[(0,D.jsx)(`span`,{className:`app-header__summary-icon`,children:(0,D.jsx)(Nb,{kind:e.icon})}),(0,D.jsxs)(`span`,{className:`app-header__summary-copy`,children:[(0,D.jsx)(`span`,{className:`app-header__summary-label`,children:e.label}),(0,D.jsx)(`strong`,{className:`app-header__summary-value`,children:e.value})]})]},e.key))})}function Ib({header:e}){return(0,D.jsxs)(`div`,{className:`app-header__identity`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,title:e.label,children:e.label}),e.subtitle?(0,D.jsx)(`p`,{className:`app-header__subheadline`,children:e.subtitle}):null,(0,D.jsx)(Fb,{summaryItems:e.summaryItems})]})}function Lb({analysis:e,searchState:t,setSearchState:n,omniboxResults:r,handleNavigateTo:i}){let a=t.query.trim().length>0;return(0,D.jsxs)(`div`,{className:`app-header__omnibox`,children:[(0,D.jsx)(`label`,{className:`app-header__search-control`,children:(0,D.jsxs)(`div`,{className:`app-header__search-shell`,children:[(0,D.jsxs)(`svg`,{className:`workspace-search__icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{cx:`11`,cy:`11`,r:`6.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`}),(0,D.jsx)(`path`,{d:`M16 16l4 4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`})]}),(0,D.jsx)(`input`,{value:t.query,onFocus:()=>n(e=>({...e,isOpen:!0})),onChange:e=>n(t=>({...t,query:e.target.value,isOpen:!0})),placeholder:`Search runs, pipelines, assets...`,"aria-label":`Global search`})]})}),t.isOpen&&e&&(0,D.jsx)(`div`,{className:`omnibox-results`,children:r.loading&&a?(0,D.jsx)(`div`,{className:`omnibox-results__empty`,children:`Searching…`}):r.results.length>0?r.results.map(e=>(0,D.jsxs)(`button`,{type:`button`,className:`omnibox-results__item`,onClick:()=>{n(t=>({...t,isOpen:!1,recentResourceIds:[e.uniqueId,...t.recentResourceIds.filter(t=>t!==e.uniqueId)].slice(0,8)})),i(`inventory`,{resourceId:e.uniqueId,assetTab:`summary`})},children:[(0,D.jsx)(`strong`,{children:e.name}),(0,D.jsx)(`span`,{children:e.resourceType})]},e.uniqueId)):(0,D.jsx)(`div`,{className:`omnibox-results__empty`,children:a?`No matching resources`:`Recent items will appear here`})})]})}function Rb({activeView:e,analysis:t,analysisSource:n,artifactLocationSnapshot:r,preloadLoading:i,pendingRemoteRun:a,acceptingRemoteRun:o,preferences:s,setPreferences:c,themePreference:l,setThemePreference:u,onManagedAnalysisLoaded:d,onError:f,onAcceptPendingRemoteRun:p,workspaceSignals:m,overviewFilters:h,setOverviewFilters:g,timelineFilters:_,setTimelineFilters:v,assetViewState:y,setAssetViewState:b,runsViewState:x,setRunsViewState:S,lineageViewState:C,setLineageViewState:w,setInvestigationSelection:T,handleNavigateTo:E}){return e===`settings`?(0,D.jsx)(Mb,{preferences:s,setPreferences:c,themePreference:l,setThemePreference:u,analysisSource:n,artifactLocationSnapshot:r,executionCount:t?.summary.total_nodes??null,onManagedAnalysisLoaded:d,onError:f,pendingRemoteRun:a,acceptingRemoteRun:o,onAcceptPendingRemoteRun:p}):t?(0,D.jsx)(Fy,{analysis:t,activeView:e,analysisSource:n,overviewFilters:h,onOverviewFiltersChange:g,timelineFilters:_,onTimelineFiltersChange:v,assetViewState:y,onAssetViewStateChange:b,runsViewState:x,onRunsViewStateChange:S,lineageViewState:C,onLineageViewStateChange:w,onInvestigationSelectionChange:T,onNavigateTo:E,workspaceSignals:m}):i?(0,D.jsx)(xb,{}):(0,D.jsx)(yb,{onManagedLoad:d,onError:f})}var zb=[{id:`health`,view:`health`,label:`Health`},{id:`timeline`,view:`timeline`,label:`Timeline`},{id:`inventory`,view:`inventory`,label:`Inventory`},{id:`runs`,view:`runs`,label:`Runs`}],Bb=new Set([`health`,`inventory`,`runs`,`timeline`,`settings`,`overview`,`catalog`,`execution`,`quality`,`dependencies`,`search`]);function Vb(e){let t=new URLSearchParams(e).get(`view`);return t===`lineage`||t===`dependencies`}function Hb(e){switch(e){case`overview`:return`health`;case`catalog`:return`inventory`;case`execution`:case`quality`:return`runs`;case`dependencies`:case`lineage`:return`inventory`;case`search`:return`inventory`;case`discover`:return`inventory`;case`runs`:case`timeline`:case`inventory`:case`health`:case`settings`:return e;default:return`health`}}function Ub(e){let t=new URLSearchParams(e),n=t.get(`view`);return n?n===`discover`?`inventory`:n===`runs`&&t.get(`tab`)===`timeline`?`timeline`:n===`lineage`||n===`dependencies`?`inventory`:Bb.has(n)?Hb(n):null:null}function Wb(e){return new URLSearchParams(e).get(`resource`)}function Gb(e){return new URLSearchParams(e).get(`selected`)}function Kb(e){let t=new URLSearchParams(e).get(`assetTab`);return t===`summary`||t===`lineage`||t===`sql`||t===`runtime`||t===`tests`?t:null}function qb(e){return Kb(e)??(Vb(e)?`lineage`:`summary`)}function Jb(e){let t=new URLSearchParams(e).get(`kind`);return t===`all`||t===`models`||t===`tests`||t===`seeds`||t===`snapshots`||t===`operations`?t:null}function Yb(e){let t=new URLSearchParams(e).get(`adapter`);if(t==null||t===``)return!0;let n=t.trim().toLowerCase();return!(n===`0`||n===`false`||n===`no`)}function Xb(e){let t=new URLSearchParams(e).get(`lens`);return t===`status`||t===`type`||t===`coverage`?t:null}function Zb(e){let t=new URLSearchParams(e).get(`up`);if(t==null||t===``)return null;let n=Number(t);return Number.isFinite(n)?n:null}function Qb(e){let t=new URLSearchParams(e).get(`down`);if(t==null||t===``)return null;let n=Number(t);return Number.isFinite(n)?n:null}function $b(e){let t=new URLSearchParams(e).get(`allDeps`);return t===`1`?!0:t===`0`?!1:null}function ex(e){return Math.max(0,Math.min(10,e))}function tx(e){let t=Wb(e),n=new URLSearchParams(e).get(`selected`),r=Kb(e),i=Vb(e)||r===`lineage`,a=Zb(e),o=Qb(e),s=$b(e),c=Xb(e);return{rootResourceId:t,selectedResourceId:i?n??t:t,upstreamDepth:ex(a??2),downstreamDepth:ex(o??2),allDepsMode:s??!1,lensMode:c??`type`,activeLegendKeys:new Set}}var nx=`dbt-tools.sidebarCollapsed`;function rx(e=!0){try{let e=window.localStorage.getItem(nx);if(e!==null)return e===`true`}catch{}return e}function ix(e,t){return Hb(t)===e.view}var ax=`/assets/app-logo-ByfNNtT8.svg`;function ox({className:e,size:t,title:n,testId:r}){return(0,D.jsx)(`img`,{src:ax,alt:n??``,"aria-hidden":n?void 0:!0,className:e,style:t?{width:`${t}px`,height:`${t}px`}:void 0,"data-testid":r})}function sx({id:e}){let t={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,width:20,height:20,"aria-hidden":!0};return e===`health`?(0,D.jsx)(`svg`,{...t,children:(0,D.jsx)(`polyline`,{points:`2,12 6,12 8,5 10,19 13,12 15,12 17,8 19,12 22,12`})}):e===`runs`?(0,D.jsxs)(`svg`,{...t,children:[(0,D.jsx)(`rect`,{x:`3`,y:`4`,width:`3`,height:`16`,rx:`1`}),(0,D.jsx)(`rect`,{x:`9`,y:`8`,width:`3`,height:`12`,rx:`1`}),(0,D.jsx)(`rect`,{x:`15`,y:`6`,width:`3`,height:`14`,rx:`1`}),(0,D.jsx)(`rect`,{x:`21`,y:`10`,width:`0`,height:`0`}),(0,D.jsx)(`line`,{x1:`3`,y1:`20`,x2:`21`,y2:`20`})]}):e===`timeline`?(0,D.jsxs)(`svg`,{...t,children:[(0,D.jsx)(`path`,{d:`M4 18V7`}),(0,D.jsx)(`path`,{d:`M10 18V11`}),(0,D.jsx)(`path`,{d:`M16 18V5`}),(0,D.jsx)(`path`,{d:`M2 18h20`}),(0,D.jsx)(`path`,{d:`M4 9h3M10 13h3M16 7h3`})]}):e===`inventory`?(0,D.jsxs)(`svg`,{...t,children:[(0,D.jsx)(`path`,{d:`M2 7l10-4 10 4-10 4-10-4z`}),(0,D.jsx)(`path`,{d:`M2 12l10 4 10-4`}),(0,D.jsx)(`path`,{d:`M2 17l10 4 10-4`})]}):e===`settings`?(0,D.jsxs)(`svg`,{...t,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,D.jsx)(`path`,{d:`M12 2.75v2.5`}),(0,D.jsx)(`path`,{d:`M12 18.75v2.5`}),(0,D.jsx)(`path`,{d:`M21.25 12h-2.5`}),(0,D.jsx)(`path`,{d:`M5.25 12h-2.5`}),(0,D.jsx)(`path`,{d:`M18.54 5.46l-1.77 1.77`}),(0,D.jsx)(`path`,{d:`M7.23 16.77l-1.77 1.77`}),(0,D.jsx)(`path`,{d:`M18.54 18.54l-1.77-1.77`}),(0,D.jsx)(`path`,{d:`M7.23 7.23L5.46 5.46`})]}):(0,D.jsxs)(`svg`,{...t,children:[(0,D.jsx)(`path`,{d:`M4 7h16`}),(0,D.jsx)(`path`,{d:`M4 12h9`}),(0,D.jsx)(`path`,{d:`M4 17h13`})]})}var cx=`Waiting for artifacts`;function lx({activeView:e,setNavigationTarget:t,sidebarCollapsed:n,setSidebarCollapsed:r,onNavigate:i,analysis:a,analysisSource:o}){let s=br(o);return(0,D.jsxs)(`aside`,{id:`app-sidebar`,className:`app-sidebar${n?` app-sidebar--collapsed`:``}`,children:[(0,D.jsxs)(`button`,{type:`button`,className:`app-sidebar__brand-link`,onClick:()=>{t({view:`health`}),i()},title:`Go to Health`,children:[(0,D.jsx)(ox,{className:`app-logo app-logo--brand`}),!n&&(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`strong`,{children:`dbt-tools`}),(0,D.jsx)(`span`,{children:`Artifact operations console`})]})]}),(0,D.jsx)(`nav`,{className:`app-sidebar__nav`,"aria-label":`Workspace sections`,children:(0,D.jsx)(`div`,{className:`nav-group`,children:zb.map(n=>{let r=!a;return(0,D.jsxs)(`button`,{type:`button`,className:ix(n,e)?`sidebar-link sidebar-link--active`:`sidebar-link`,disabled:r,onClick:()=>{t(n),i()},"aria-label":n.label,title:n.label,children:[(0,D.jsx)(`span`,{className:`sidebar-link__icon`,children:(0,D.jsx)(sx,{id:n.id})}),(0,D.jsx)(`div`,{className:`sidebar-link__body`,children:(0,D.jsx)(`strong`,{children:n.label})})]},n.id)})})}),(0,D.jsx)(`button`,{type:`button`,className:`sidebar-toggle`,onClick:()=>r(e=>!e),"aria-label":n?`Expand sidebar`:`Collapse sidebar`,children:n?`›`:`‹`}),(0,D.jsxs)(`div`,{className:`app-sidebar__footer`,children:[(0,D.jsxs)(`button`,{type:`button`,className:e===`settings`?`sidebar-link sidebar-link--active sidebar-settings-trigger`:`sidebar-link sidebar-settings-trigger`,onClick:()=>{t({view:`settings`}),i()},"aria-current":e===`settings`?`page`:void 0,"aria-label":`Open settings`,title:`Settings`,children:[(0,D.jsx)(`span`,{className:`sidebar-link__icon`,children:(0,D.jsx)(sx,{id:`settings`})}),!n&&(0,D.jsx)(`div`,{className:`sidebar-link__body`,children:(0,D.jsx)(`strong`,{children:`Settings`})})]}),!n&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{className:`sidebar-settings-divider`}),(0,D.jsxs)(`div`,{className:`app-sidebar__session`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Session`}),(0,D.jsx)(`strong`,{children:s}),(0,D.jsx)(`span`,{children:a?`${a.summary.total_nodes} executions analyzed`:cx})]})]})]})]})}function ux({pendingRemoteRun:e,acceptingRemoteRun:t,onAcceptPendingRemoteRun:n}){return e==null?null:(0,D.jsxs)(`section`,{className:`remote-update-banner`,"aria-label":`Remote update available`,children:[(0,D.jsxs)(`div`,{className:`remote-update-banner__copy`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Remote update available`}),(0,D.jsx)(`strong`,{children:e.label}),(0,D.jsx)(`span`,{children:`A newer complete remote artifact pair is ready. Keep the current investigation until you decide to switch.`})]}),(0,D.jsx)(`button`,{type:`button`,className:`primary-action`,onClick:()=>void n(),disabled:t,children:t?`Switching…`:`Load latest remote run`})]})}function dx({workspace:e,analysis:t,analysisSource:n,artifactLocationSnapshot:r,error:i,preloadLoading:a,pendingRemoteRun:o,acceptingRemoteRun:s,onManagedAnalysisLoaded:c,onError:l,onAcceptPendingRemoteRun:u,themePreference:d,setThemePreference:f,preferences:p,setPreferences:m,workspaceSignals:h}){let{activeView:g,sidebarCollapsed:_,setSidebarCollapsed:v,sidebarOpen:y,setSidebarOpen:b,overviewFilters:x,setOverviewFilters:S,timelineFilters:C,setTimelineFilters:w,assetViewState:T,setAssetViewState:k,runsViewState:A,setRunsViewState:j,lineageViewState:M,setLineageViewState:N,searchState:P,setSearchState:F,setInvestigationSelection:I,setNavigationTarget:ee,handleNavigateTo:te,frameClass:L}=e,ne=E(t,P),re=Pb(t,n);return(0,D.jsxs)(`div`,{className:L,children:[y&&(0,D.jsx)(`div`,{className:`sidebar-backdrop`,role:`presentation`,onClick:()=>b(!1)}),(0,D.jsx)(lx,{activeView:g,setNavigationTarget:ee,sidebarCollapsed:_,setSidebarCollapsed:v,onNavigate:()=>b(!1),analysis:t,analysisSource:n}),(0,D.jsxs)(`main`,{className:`app-main`,children:[(0,D.jsxs)(`header`,{className:`app-header app-header--workspace`,children:[(0,D.jsx)(`button`,{type:`button`,className:`hamburger-btn`,"aria-label":`Open navigation`,"aria-expanded":y,"aria-controls":`app-sidebar`,onClick:()=>b(!0),children:(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`☰`})}),(0,D.jsx)(Ib,{header:re}),(0,D.jsx)(Lb,{analysis:t,searchState:P,setSearchState:F,omniboxResults:ne,handleNavigateTo:te})]}),i&&(0,D.jsx)(O,{message:i}),(0,D.jsx)(ux,{pendingRemoteRun:o,acceptingRemoteRun:s,onAcceptPendingRemoteRun:u}),(0,D.jsx)(Rb,{activeView:g,analysis:t,analysisSource:n,artifactLocationSnapshot:r,preloadLoading:a,pendingRemoteRun:o,acceptingRemoteRun:s,preferences:p,setPreferences:m,themePreference:d,setThemePreference:f,onManagedAnalysisLoaded:c,onError:l,onAcceptPendingRemoteRun:u,workspaceSignals:h,overviewFilters:x,setOverviewFilters:S,timelineFilters:C,setTimelineFilters:w,assetViewState:T,setAssetViewState:k,runsViewState:A,setRunsViewState:j,lineageViewState:M,setLineageViewState:N,setInvestigationSelection:I,handleNavigateTo:te})]})]})}function fx(e,t,n){return t===`preload`?{value:`Live target`,detail:`Synced from DBT_TOOLS_TARGET_DIR with ${e.graphSummary.totalEdges} dependency edges ready for investigation.`}:t===`remote`?{value:`Remote source`,detail:`Managed from remote object storage with ${e.graphSummary.totalEdges} dependency edges ready for investigation.`}:{value:`Artifact upload`,detail:`${e.summary.total_nodes} executions loaded from local artifacts${n>0?`, including ${n} tests`:``}.`}}function px(e,t){let n=e.executions.filter(e=>e.statusTone===`danger`).length,r=e.executions.filter(e=>e.statusTone===`warning`).length,i=e.executions.filter(e=>[`test`,`unit_test`].includes(e.resourceType)).length,a=e.resources.filter(e=>!!e.description?.trim()).length,o=e.resources.length>0?Math.round(a/e.resources.length*100):0,s=fx(e,t,i);return[{label:`Run posture`,value:n>0?`${n} failing`:r>0?`${r} warning`:`Healthy`,detail:n>0?`Prioritize failing nodes before reviewing downstream impact.`:r>0?`Warnings detected; review tests and exposures next.`:`No failing nodes surfaced in this run.`,tone:n>0?`danger`:r>0?`warning`:`positive`},{label:`Metadata coverage`,value:`${o}%`,detail:`${a} of ${e.resources.length} resources include descriptions for catalog-style discovery.`,tone:o>=70?`positive`:o>=35?`warning`:`neutral`},{label:`Workspace mode`,value:s.value,detail:s.detail,tone:`neutral`}]}function mx({setPreloadLoading:e,setAnalysis:t,setAnalysisSource:n,setPendingRemoteRun:r,setRemotePollIntervalMs:i,setError:a,pendingMetricsRef:o,setArtifactCapability:s,onArtifactSourceStatus:l}){let u=(0,c.useRef)(!1);(0,c.useEffect)(()=>{u.current||(u.current=!0,d(`Preload: fetching current managed artifacts`),tb().then(({result:c,status:u})=>{e(!1),r(u.pendingRun),i(u.pollIntervalMs),l?.(u),c?(d(`Preload: success, analysis loaded`),o.current=c.metrics,t(c.analysis),n(u.currentSource),a(null),s(u.missingOptionalArtifacts??{missingCatalog:!1,missingSources:!1})):(n(u.currentSource),s({missingCatalog:!1,missingSources:!1}))}).catch(t=>{e(!1),d(`Preload: error`,t),a(t instanceof Error?t.message:`Failed to load artifacts from server`)}))},[o,e,t,n,r,i,a,s,l])}function hx(e,t,n,r){(0,c.useEffect)(()=>{},[e,r,t,n])}function gx(e,t,n,r,i){(0,c.useEffect)(()=>{if(e!==`remote`){t(null),n(null);return}let a=!1,o=async()=>{try{let e=await $y();a||(t(e.pendingRun),n(e.pollIntervalMs),i?.(e))}catch(e){d(`Artifact source poll failed`,e)}};o();let s=window.setInterval(()=>{o()},r??3e4);return()=>{a=!0,window.clearInterval(s)}},[e,r,t,n,i])}function _x(){let[e,t]=(0,c.useState)(null),[n,r]=(0,c.useState)(null),[i,a]=(0,c.useState)(null),[o,s]=(0,c.useState)(!0),[l,u]=(0,c.useState)(null),[m,h]=(0,c.useState)(!1),[g,_]=(0,c.useState)(null),[v,y]=(0,c.useState)({missingCatalog:!1,missingSources:!1}),[b,x]=(0,c.useState)(null),S=(0,c.useRef)(null),C=(0,c.useCallback)(e=>{x(t=>{let n=vr(e);return n==null&&t==null||n!=null&&t!=null&&n.sourceKind===t.sourceKind&&n.locationDisplay===t.locationDisplay?t:n})},[]);return mx({setPreloadLoading:s,setAnalysis:t,setAnalysisSource:a,setPendingRemoteRun:u,setRemotePollIntervalMs:_,setError:r,pendingMetricsRef:S,setArtifactCapability:y,onArtifactSourceStatus:C}),hx(i,t,r,S),gx(i,u,_,g,C),(0,c.useEffect)(()=>{if(e==null||S.current==null)return;let t=S.current;S.current=null,requestAnimationFrame(()=>{let e=`analysis-load:${t.requestId}:interactive`,n=`analysis-load:${t.requestId}:first-interactive-frame`;f(e),p(n,t.dispatchMarkName,e),d(`Analysis load metrics`,{requestId:t.requestId,source:t.source,timings:t.timings})})},[e]),{analysis:e,analysisSource:i,artifactLocationSnapshot:b,artifactCapability:v,error:n,preloadLoading:o,pendingRemoteRun:l,acceptingRemoteRun:m,onLoadDifferent:()=>{t(null),a(null),u(null),_(null),r(null),x(null),y({missingCatalog:!1,missingSources:!1})},onManagedAnalysisLoaded:(e,n,r)=>{S.current=e.metrics,a(n),u(null),t(e.analysis),y(r),$y().then(C).catch(()=>{})},onError:r,onAcceptPendingRemoteRun:async()=>{if(l!=null){h(!0);try{let e=await nb(l.runId),n=await eb(`remote`);n!=null&&(S.current=n.metrics,t(n.analysis),a(e.currentSource),_(e.pollIntervalMs),r(null),y(e.missingOptionalArtifacts??{missingCatalog:!1,missingSources:!1})),u(e.pendingRun),C(e)}catch(e){r(e instanceof Error?e.message:`Failed to switch remote artifact run`)}finally{h(!1)}}}}}var vx=`dbt-tools.workspacePreferences`,yx={theme:`system`,sidebarCollapsedDefault:!0,timelineDefaults:{showTests:!1,failuresOnly:!1,dependencyDirection:`both`,dependencyDepthHops:2},inventoryDefaults:{explorerMode:`project`,lineageLensMode:`type`,lineageUpstreamDepth:2,lineageDownstreamDepth:2,allDepsMode:!1}};function bx(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.max(1,Math.min(10,Math.round(e)))}function xx(e){return e===`upstream`||e===`both`||e===`downstream`}function Sx(e){return e===`project`||e===`database`}function Cx(e){return e===`status`||e===`type`||e===`coverage`}function wx(e){return e===`light`||e===`dark`||e===`system`}function Tx(e){if(!e)return yx;try{let t=JSON.parse(e);return{theme:wx(t.theme)?t.theme:yx.theme,sidebarCollapsedDefault:typeof t.sidebarCollapsedDefault==`boolean`?t.sidebarCollapsedDefault:yx.sidebarCollapsedDefault,timelineDefaults:{showTests:typeof t.timelineDefaults?.showTests==`boolean`?t.timelineDefaults.showTests:yx.timelineDefaults.showTests,failuresOnly:typeof t.timelineDefaults?.failuresOnly==`boolean`?t.timelineDefaults.failuresOnly:yx.timelineDefaults.failuresOnly,dependencyDirection:xx(t.timelineDefaults?.dependencyDirection)?t.timelineDefaults.dependencyDirection:yx.timelineDefaults.dependencyDirection,dependencyDepthHops:bx(t.timelineDefaults?.dependencyDepthHops,yx.timelineDefaults.dependencyDepthHops)},inventoryDefaults:{explorerMode:Sx(t.inventoryDefaults?.explorerMode)?t.inventoryDefaults.explorerMode:yx.inventoryDefaults.explorerMode,lineageLensMode:Cx(t.inventoryDefaults?.lineageLensMode)?t.inventoryDefaults.lineageLensMode:yx.inventoryDefaults.lineageLensMode,lineageUpstreamDepth:bx(t.inventoryDefaults?.lineageUpstreamDepth,yx.inventoryDefaults.lineageUpstreamDepth),lineageDownstreamDepth:bx(t.inventoryDefaults?.lineageDownstreamDepth,yx.inventoryDefaults.lineageDownstreamDepth),allDepsMode:typeof t.inventoryDefaults?.allDepsMode==`boolean`?t.inventoryDefaults.allDepsMode:yx.inventoryDefaults.allDepsMode}}}catch{return yx}}function Ex(){let[e,t]=(0,c.useState)(()=>{try{return Tx(window.localStorage.getItem(vx))}catch{return yx}});return(0,c.useEffect)(()=>{try{window.localStorage.setItem(vx,JSON.stringify(e))}catch{}},[e]),{preferences:e,setPreferences:t}}function Dx(e,t){let n=t!==e.selectedExecutionId;return{...e,selectedExecutionId:t,...n?{neighborhoodRowsShowAll:!1}:{}}}var Ox=(e,t)=>({activeTab:qb(e),expandedNodeIds:new Set,explorerMode:t?.inventoryDefaults.explorerMode??`project`,status:`all`,resourceTypes:new Set,materializationKinds:new Set,resourceQuery:``,selectedResourceId:Wb(e),upstreamDepth:Zb(e)??t?.inventoryDefaults.lineageUpstreamDepth??2,downstreamDepth:Qb(e)??t?.inventoryDefaults.lineageDownstreamDepth??2,allDepsMode:$b(e)??t?.inventoryDefaults.allDepsMode??!1,lensMode:Xb(e)??t?.inventoryDefaults.lineageLensMode??`type`,activeLegendKeys:new Set}),kx=e=>{let t=Ub(e);return{kind:Jb(e)??`all`,status:`all`,query:``,resourceTypes:new Set,materializationKinds:new Set,threadIds:new Set,durationBand:`all`,sortBy:`attention`,sortDirection:`desc`,groupBy:`none`,selectedExecutionId:t===`runs`?Gb(e):null,showAdapterMetrics:t===`runs`?Yb(e):!1}},Ax=(e,t)=>{let n=Ub(e),r=n===`runs`||n===`timeline`?Gb(e):null;return{query:``,activeStatuses:new Set,activeTypes:new Set,selectedExecutionId:r,showTests:t?.timelineDefaults.showTests??!1,failuresOnly:t?.timelineDefaults.failuresOnly??!1,dependencyDirection:t?.timelineDefaults.dependencyDirection??`both`,dependencyDepthHops:t?.timelineDefaults.dependencyDepthHops??2,timeWindow:null,neighborhoodRowsShowAll:!1}};function jx(e){let t=new URLSearchParams(e);if(Ub(e)!==`inventory`)return null;let n=[],r=t.get(`q`)?.trim()??``;r!==``&&n.push(r);for(let e of[`type`,`package`,`tag`,`path`]){let r=t.get(e)?.trim()??``;r!==``&&n.push(`${e}:${r}`)}return n.join(` `).trim()}function Mx(e,t){let n=jx(e);return n===null?t:{...t,resourceQuery:n}}var Nx=e=>{let t=Ub(e)??`health`,n=Wb(e),r=Gb(e);return{selectedResourceId:n,selectedExecutionId:t===`runs`||t===`timeline`?r:null,sourceLens:null}};function Px(e,t){return{activeView:Ub(e)??`health`,assetViewState:Mx(e,Ox(e,t)),runsViewState:kx(e),timelineFilters:Ax(e,t),lineageViewState:{...tx(e),upstreamDepth:Zb(e)??t?.inventoryDefaults.lineageUpstreamDepth??2,downstreamDepth:Qb(e)??t?.inventoryDefaults.lineageDownstreamDepth??2,allDepsMode:$b(e)??t?.inventoryDefaults.allDepsMode??!1,lensMode:Xb(e)??t?.inventoryDefaults.lineageLensMode??`type`},investigationSelection:Nx(e)}}function Fx(e){let t=Ub(e),n=Wb(e),r=Gb(e);return{activeView:t??void 0,assetViewState:t=>Mx(e,{...t,selectedResourceId:n,activeTab:qb(e)}),runsViewState:n=>({...n,kind:Jb(e)??n.kind,selectedExecutionId:t===`runs`?r:null,showAdapterMetrics:t===`runs`?Yb(e):n.showAdapterMetrics}),timelineFilters:e=>Dx(e,t===`timeline`?r:null),lineageViewState:tx(e),investigationSelection:e=>({...e,selectedResourceId:n,selectedExecutionId:t===`runs`||t===`timeline`?r:null,sourceLens:e.sourceLens})}}var Ix=[`resource`,`assetTab`,`selected`,`kind`,`adapter`,`up`,`down`,`allDeps`,`lens`,`q`];function Lx(e,t){for(let n of Ix)t?.has(n)||e.searchParams.delete(n)}function Rx(e,t,n){t.selectedResourceId?e.searchParams.set(`resource`,t.selectedResourceId):e.searchParams.delete(`resource`),e.searchParams.set(`assetTab`,t.activeTab);let r=t.resourceQuery.trim();r===``?e.searchParams.delete(`q`):e.searchParams.set(`q`,r),e.searchParams.delete(`kind`),t.activeTab===`lineage`?(n.selectedResourceId?e.searchParams.set(`selected`,n.selectedResourceId):e.searchParams.delete(`selected`),e.searchParams.set(`up`,String(n.upstreamDepth)),e.searchParams.set(`down`,String(n.downstreamDepth)),e.searchParams.set(`allDeps`,n.allDepsMode?`1`:`0`),e.searchParams.set(`lens`,n.lensMode)):Lx(e,new Set([`resource`,`assetTab`,`q`]))}function zx(e,t){e.searchParams.set(`kind`,t.kind),t.selectedExecutionId?e.searchParams.set(`selected`,t.selectedExecutionId):e.searchParams.delete(`selected`),t.showAdapterMetrics?e.searchParams.delete(`adapter`):e.searchParams.set(`adapter`,`0`),Lx(e,new Set([`kind`,`selected`,`adapter`]))}function Bx(e,t){t?e.searchParams.set(`selected`,t):e.searchParams.delete(`selected`),Lx(e,new Set([`selected`]))}function Vx(e){let{pathname:t,hash:n,activeView:r,assetViewState:i,runsViewState:a,timelineSelectedExecutionId:o,lineageViewState:s}=e,c=new URL(`http://local.invalid${t}${n}`);return c.searchParams.set(`view`,r),r===`inventory`?Rx(c,i,s):r===`runs`?zx(c,a):r===`timeline`?Bx(c,o):Lx(c),`${t}${c.search}${n}`}function Hx(e){let t=(0,c.useRef)(!1),n=Px(window.location.search,e),[r,i]=(0,c.useState)(()=>n.activeView),[a,o]=(0,c.useState)(()=>rx(e.sidebarCollapsedDefault)),[s,l]=(0,c.useState)(!1),[u,d]=(0,c.useState)({status:`all`,resourceTypes:new Set,query:``}),[f,p]=(0,c.useState)(()=>n.timelineFilters),[m,h]=(0,c.useState)(()=>n.assetViewState),[g,_]=(0,c.useState)(()=>n.runsViewState),[v,y]=(0,c.useState)(()=>n.lineageViewState),[b,x]=(0,c.useState)({query:``,recentResourceIds:[],isOpen:!1}),[S,C]=(0,c.useState)(()=>n.investigationSelection),w=(0,c.useCallback)(e=>{o(t=>{let n=e(t);try{window.localStorage.setItem(nx,String(n))}catch{}return n})},[]),T=(0,c.useCallback)(e=>{i(e.view===`search`?`inventory`:e.view)},[]),E=(0,c.useCallback)((e,t)=>{i(e),t?.resourceId?(h(e=>({...e,selectedResourceId:t.resourceId??e.selectedResourceId,activeTab:t.assetTab??e.activeTab})),y(e=>({...e,rootResourceId:t.rootResourceId??t.resourceId??e.rootResourceId,selectedResourceId:t.resourceId??e.selectedResourceId}))):t?.assetTab&&e===`inventory`&&h(e=>({...e,activeTab:t.assetTab??e.activeTab})),t?.executionId&&(_(e=>({...e,selectedExecutionId:t.executionId??e.selectedExecutionId})),p(e=>Dx(e,t.executionId??e.selectedExecutionId))),e===`runs`&&t?.resourceId&&_(e=>({...e,query:t.resourceId??e.query})),C(n=>({selectedResourceId:t?.resourceId??n.selectedResourceId,selectedExecutionId:t?.executionId??n.selectedExecutionId,sourceLens:e}))},[]);return(0,c.useEffect)(()=>{let e=Vx({pathname:window.location.pathname,hash:window.location.hash,activeView:r,assetViewState:m,runsViewState:g,timelineSelectedExecutionId:f.selectedExecutionId,lineageViewState:v});e!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.pushState(null,``,e)},[r,m,g,f.selectedExecutionId,v]),(0,c.useEffect)(()=>{let e=()=>{let e=Fx(window.location.search);e.activeView!==void 0&&i(e.activeView),h(t=>e.assetViewState(t)),_(t=>e.runsViewState(t)),p(t=>e.timelineFilters(t)),y(e.lineageViewState),C(t=>e.investigationSelection(t))};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,c.useEffect)(()=>{if(!t.current){t.current=!0;return}p(t=>({...t,showTests:e.timelineDefaults.showTests,failuresOnly:e.timelineDefaults.failuresOnly,dependencyDirection:e.timelineDefaults.dependencyDirection,dependencyDepthHops:e.timelineDefaults.dependencyDepthHops})),h(t=>({...t,explorerMode:e.inventoryDefaults.explorerMode})),y(t=>({...t,upstreamDepth:e.inventoryDefaults.lineageUpstreamDepth,downstreamDepth:e.inventoryDefaults.lineageDownstreamDepth,allDepsMode:e.inventoryDefaults.allDepsMode,lensMode:e.inventoryDefaults.lineageLensMode})),o(e.sidebarCollapsedDefault);try{window.localStorage.setItem(nx,String(e.sidebarCollapsedDefault))}catch{}},[e]),(0,c.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),x(e=>({...e,isOpen:!0}))),e.key===`Escape`&&(l(!1),x(e=>({...e,isOpen:!1})))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),{activeView:r,sidebarCollapsed:a,setSidebarCollapsed:w,sidebarOpen:s,setSidebarOpen:l,overviewFilters:u,setOverviewFilters:d,timelineFilters:f,setTimelineFilters:p,assetViewState:m,setAssetViewState:h,runsViewState:g,setRunsViewState:_,lineageViewState:v,setLineageViewState:y,searchState:b,setSearchState:x,investigationSelection:S,setInvestigationSelection:C,setNavigationTarget:T,handleNavigateTo:E,frameClass:[`app-frame`,a?`app-frame--sidebar-collapsed`:``,s?`app-frame--nav-open`:``].filter(Boolean).join(` `)}}function Ux(){let{toast:e}=mb(),{preferences:t,setPreferences:n}=Ex(),r=Hx(t),{analysis:i,analysisSource:a,artifactLocationSnapshot:o,error:s,preloadLoading:l,pendingRemoteRun:u,acceptingRemoteRun:d,onManagedAnalysisLoaded:f,artifactCapability:p,onError:m,onAcceptPendingRemoteRun:h}=_x(),{themePreference:g,setThemePreference:_}=Si();(0,c.useEffect)(()=>{t.theme!==g&&_(t.theme)},[t.theme,_,g]);let v=(0,c.useRef)(null);(0,c.useEffect)(()=>{i&&!v.current&&a===`preload`&&e(`Workspace loaded — ${i.summary.total_nodes} executions`,`positive`),i&&!v.current&&a===`remote`&&e(`Remote workspace loaded — ${i.summary.total_nodes} executions`,`positive`),v.current=i},[i,a,e]);let y=(0,c.useRef)(null);(0,c.useEffect)(()=>{if(u==null){y.current=null;return}y.current!==u.runId&&(y.current=u.runId,e(`A newer remote run is available: ${u.label}`,`warning`))},[u,e]);let b=i?px(i,a):[];return(0,D.jsx)(Lc.Provider,{value:p,children:(0,D.jsx)(dx,{workspace:r,analysis:i,analysisSource:a,artifactLocationSnapshot:o,error:s,preloadLoading:l,pendingRemoteRun:u,acceptingRemoteRun:d,onManagedAnalysisLoaded:f,onError:m,onAcceptPendingRemoteRun:h,themePreference:g,setPreferences:n,preferences:t,setThemePreference:_,workspaceSignals:b})})}function Wx(){return(0,D.jsx)(pb,{children:(0,D.jsx)(Ux,{})})}(0,l.createRoot)(document.getElementById(`root`)).render((0,D.jsx)(c.StrictMode,{children:(0,D.jsx)(Wx,{})}));
|
|
36
|
+
`)}]:[],c=[...o,...s];return(0,D.jsx)(Xr,{eyebrow:`Selected run item`,title:e.name,typeLabel:Zn(e.resourceType),stats:[{label:`Status`,value:e.status},{label:`Duration`,value:Xn(e.executionTime)},{label:`Thread`,value:e.threadId??`n/a`},{label:xy,value:String(t.length+n.length)},{label:`Extra raw fields`,value:String(a.length)}],sections:c,actions:[{label:`Open in Timeline`,onClick:()=>r(`timeline`,{resourceId:e.uniqueId,executionId:e.uniqueId})},{label:`Open in Inventory`,onClick:()=>r(`inventory`,{resourceId:e.uniqueId,assetTab:`summary`})},{label:`Open in Lineage`,onClick:()=>r(`inventory`,{resourceId:e.uniqueId,assetTab:`lineage`,rootResourceId:e.uniqueId})}]})}function Cy(e){if(gy(e))return`desc`;switch(e){case`attention`:case`duration`:case`start`:return`desc`;default:return`asc`}}function wy(e,t){return t.sortBy===e?{sortBy:e,sortDirection:t.sortDirection===`asc`?`desc`:`asc`}:{sortBy:e,sortDirection:Cy(e)}}function Ty(e,t,n){return e===t?n===`asc`?{indicator:`↑`,ariaSort:`ascending`}:{indicator:`↓`,ariaSort:`descending`}:{indicator:` `,ariaSort:`none`}}function Ey(e){let t=[`minmax(280px, 2.5fr)`,`minmax(108px, 0.85fr)`,`minmax(92px, 0.7fr)`,`minmax(132px, 0.95fr)`,`minmax(96px, 0.72fr)`],n=e.map(e=>e.align===`end`?`minmax(120px, 0.95fr)`:`minmax(148px, 1.1fr)`);return[...t,...n,`minmax(160px, 1fr)`].join(` `)}function Dy(e,t){return _y(e,t.key)?.displayValue??`—`}var Oy=`results-table__cell--align-end`;function ky({sortKey:e,label:t,alignEnd:n,cellClassName:r,runsViewState:i,onRunsViewStateChange:a}){let o=Ty(i.sortBy,e,i.sortDirection);return(0,D.jsx)(`div`,{className:`results-table__cell${r?` ${r}`:``}${n?` ${Oy}`:``}`,role:`columnheader`,"aria-sort":o.ariaSort,children:(0,D.jsxs)(`button`,{type:`button`,className:`results-table__sort-button${n?` results-table__sort-button--align-end`:``}`,onClick:()=>a(t=>({...t,...wy(e,t)})),children:[t,(0,D.jsx)(`span`,{className:`results-table__sort-indicator`,"aria-hidden":`true`,children:o.indicator})]})})}function Ay({analysis:e,runsResults:t,runsViewState:n,adapterColumns:r,onRunsViewStateChange:i,onInvestigationSelectionChange:a}){let o=(0,c.useRef)(null),l=(0,c.useRef)(null),[u,d]=(0,c.useState)(44);(0,c.useLayoutEffect)(()=>{let e=l.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>{d(Math.max(1,Math.ceil(e.getBoundingClientRect().height)))};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[r.length]);let f=s({count:t.rows.length,getScrollElement:()=>o.current,estimateSize:()=>76,overscan:10,scrollMargin:u});(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let n=()=>{e.scrollHeight-e.scrollTop-e.clientHeight<220&&t.hasMore&&!t.isLoading&&!t.isIndexing&&t.loadMore()};return e.addEventListener(`scroll`,n),n(),()=>e.removeEventListener(`scroll`,n)},[t]);let p={"--results-table-columns":Ey(r)},m=Math.min(560,Math.max(120,t.rows.length*76)),h=f.options.scrollMargin;return(0,D.jsx)(`div`,{className:`results-table`,style:p,children:(0,D.jsxs)(`div`,{ref:o,className:`results-table__scroll`,style:{height:m,overflowY:`auto`,position:`relative`},children:[(0,D.jsxs)(`div`,{ref:l,className:`results-table__header results-table__header--sticky`,role:`row`,children:[(0,D.jsx)(ky,{sortKey:`name`,label:`Item`,cellClassName:`results-table__cell--item`,runsViewState:n,onRunsViewStateChange:i}),(0,D.jsx)(ky,{sortKey:`resourceType`,label:`Type`,runsViewState:n,onRunsViewStateChange:i}),(0,D.jsx)(ky,{sortKey:`materialization`,label:`Materialization`,runsViewState:n,onRunsViewStateChange:i}),(0,D.jsx)(ky,{sortKey:`status`,label:`Status`,runsViewState:n,onRunsViewStateChange:i}),(0,D.jsx)(ky,{sortKey:`duration`,label:`Duration`,alignEnd:!0,runsViewState:n,onRunsViewStateChange:i}),r.map(e=>{let t=e.align===`end`;return e.isScalar?(0,D.jsx)(ky,{sortKey:e.id,label:e.label,alignEnd:t,runsViewState:n,onRunsViewStateChange:i},e.id):(0,D.jsx)(`div`,{className:`results-table__cell${t?` ${Oy}`:``}`,role:`columnheader`,title:e.label,children:e.label},e.id)}),(0,D.jsx)(ky,{sortKey:`thread`,label:`Thread`,runsViewState:n,onRunsViewStateChange:i})]}),(0,D.jsx)(`div`,{className:`results-table__body`,children:(0,D.jsx)(`div`,{style:{height:f.getTotalSize(),position:`relative`},children:f.getVirtualItems().map(o=>{let s=t.rows[o.index];return s?(0,D.jsxs)(`button`,{type:`button`,className:`results-table__row${s.uniqueId===n.selectedExecutionId?` results-table__row--active`:``}`,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${o.start-h}px)`},onClick:()=>{let t=e.resources.find(e=>e.uniqueId===s.uniqueId)??null;i(e=>({...e,selectedExecutionId:s.uniqueId})),a(e=>({...e,selectedExecutionId:s.uniqueId,selectedResourceId:t?.uniqueId??s.uniqueId,sourceLens:`runs`}))},children:[(0,D.jsx)(`div`,{className:`results-table__cell results-table__cell--item`,"data-label":`Item`,title:s.name,children:(0,D.jsx)(`strong`,{children:s.name})}),(0,D.jsx)(`div`,{className:`results-table__cell`,"data-label":`Type`,title:s.resourceType,children:s.resourceType}),(0,D.jsx)(`div`,{className:`results-table__cell`,"data-label":`Materialization`,children:s.semantics?(0,D.jsx)(Io,{semantics:s.semantics,variant:`compact`}):`—`}),(0,D.jsx)(`div`,{className:`results-table__cell`,"data-label":`Status`,children:(0,D.jsx)(`span`,{className:nr(s.statusTone),children:s.status})}),(0,D.jsx)(`div`,{className:`results-table__cell ${Oy}`,"data-label":`Duration`,children:Xn(s.executionTime)}),r.map(e=>{let t=Dy(s,e);return(0,D.jsx)(`div`,{className:`results-table__cell${e.align===`end`?` ${Oy}`:``}`,"data-label":e.label,title:t,children:t},e.id)}),(0,D.jsx)(`div`,{className:`results-table__cell`,"data-label":`Thread`,title:s.threadId??`n/a`,children:s.threadId??`n/a`})]},s.uniqueId):null})})})]})})}var jy=[{label:`All`,countKey:`all`},{kind:`models`,label:`Models`,countKey:`models`},{kind:`tests`,label:`Tests`,countKey:`tests`},{kind:`seeds`,label:`Seeds`,countKey:`seeds`},{kind:`snapshots`,label:`Snapshots`,countKey:`snapshots`},{kind:`operations`,label:`Operations`,countKey:`operations`},{status:`positive`,label:`Healthy`,countKey:`healthy`},{status:`issues`,label:`Issues`,countKey:`issues`},{status:`warning`,label:`Warnings`,countKey:`warnings`},{status:`danger`,label:`Errors`,countKey:`errors`}];function My(e){return e.facets}function Ny({runsViewState:e,runsResults:t,adapterColumnLayout:n,adapterMetricsAvailable:r,availableMaterializationKinds:i,onRunsViewStateChange:a}){let o=n.visibleColumns.filter(e=>e.isScalar),s=e.showAdapterMetrics&&o.length>0;return(0,D.jsxs)(`div`,{className:`runs-toolbar runs-toolbar--stacked`,children:[(0,D.jsxs)(`div`,{className:`runs-toolbar__controls`,children:[(0,D.jsxs)(`label`,{className:`workspace-search workspace-search--compact runs-toolbar__search`,children:[(0,D.jsx)(`span`,{children:`Search`}),(0,D.jsx)(`input`,{value:e.query,onChange:e=>a(t=>({...t,query:e.target.value})),placeholder:`Filter by name, type, status, thread…`})]}),(0,D.jsxs)(`label`,{className:`workspace-search workspace-search--compact runs-toolbar__sort`,children:[(0,D.jsx)(`span`,{children:`Sort`}),(0,D.jsxs)(`select`,{value:e.sortBy,onChange:e=>{let t=e.target.value;a(e=>({...e,sortBy:t,sortDirection:Cy(t)}))},children:[(0,D.jsx)(`option`,{value:`attention`,children:`Attention`}),(0,D.jsx)(`option`,{value:`duration`,children:`Duration`}),(0,D.jsx)(`option`,{value:`name`,children:`Name`}),(0,D.jsx)(`option`,{value:`status`,children:`Status`}),(0,D.jsx)(`option`,{value:`start`,children:`Start`}),(0,D.jsx)(`option`,{value:`materialization`,children:`Materialization`}),s?o.map(e=>(0,D.jsx)(`option`,{value:e.id,children:e.label},e.id)):null]})]}),(0,D.jsxs)(`label`,{className:`runs-toolbar__toggle`,title:r?`Show normalized adapter metrics derived from the current run`:`No normalized adapter metrics are available in this run`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:e.showAdapterMetrics,disabled:!r,onChange:e=>{let t=e.target.checked;a(e=>({...e,showAdapterMetrics:t,sortBy:!t&&gy(e.sortBy)?`attention`:e.sortBy,sortDirection:!t&&gy(e.sortBy)?`desc`:e.sortDirection}))}}),(0,D.jsx)(`span`,{children:`Adapter metrics`})]})]}),i.length>0?(0,D.jsxs)(`div`,{className:`runs-toolbar__mat-filters`,role:`group`,"aria-label":`Materialization filters`,children:[(0,D.jsx)(`span`,{className:`runs-toolbar__mat-filters-label`,children:`Materialization (manifest)`}),(0,D.jsx)(jo,{kinds:i,activeKinds:e.materializationKinds,onToggleKind:e=>a(t=>{let n=new Set(t.materializationKinds);return n.has(e)?n.delete(e):n.add(e),{...t,materializationKinds:n}}),buttonTitle:`Filter run rows by normalized manifest materialization`})]}):null,e.showAdapterMetrics&&n.overflowColumns.length>0?(0,D.jsxs)(`p`,{className:`runs-toolbar__meta`,children:[`Showing `,n.visibleColumns.length,` of`,` `,n.allColumns.length,` adapter metrics. Select a row to inspect the remaining `,n.overflowColumns.length,`.`]}):null,(0,D.jsx)(`div`,{className:`runs-toolbar__facets`,children:jy.map(n=>{let r=My(t.summary);return(0,D.jsxs)(`button`,{type:`button`,className:n.kind!=null&&e.kind===n.kind||n.status!=null&&e.status===n.status||n.kind==null&&n.status==null&&e.kind===`all`&&e.status===`all`?`workspace-pill workspace-pill--active`:`workspace-pill`,onClick:()=>a(e=>({...e,kind:n.kind??`all`,status:n.status??`all`})),children:[n.label,` (`,r[n.countKey],`)`]},n.label)})})]})}function Py({analysis:e,runsViewState:t,onRunsViewStateChange:n,onInvestigationSelectionChange:r,onNavigateTo:i}){let a=(0,c.useMemo)(()=>vy(e.executions),[e.executions]),o=a.allColumns.length>0,s=(0,c.useMemo)(()=>t.showAdapterMetrics&&o?a.visibleColumns:[],[a.visibleColumns,o,t.showAdapterMetrics]),l=(0,c.useMemo)(()=>_a(e.executions.map(e=>e.semantics)),[e.executions]),u=(0,c.useMemo)(()=>t.showAdapterMetrics&&o?a.overflowColumns:[],[a.overflowColumns,o,t.showAdapterMetrics]);(0,c.useEffect)(()=>{let e=t.sortBy;gy(e)&&!s.some(t=>t.id===e&&t.isScalar)&&n(e=>({...e,sortBy:`attention`,sortDirection:`desc`}))},[n,t.sortBy,s]),(0,c.useEffect)(()=>{!o&&t.showAdapterMetrics&&n(e=>({...e,showAdapterMetrics:!1}))},[o,n,t.showAdapterMetrics]);let d=py(e.executions,t,!0),f=e.executions.find(e=>e.uniqueId===t.selectedExecutionId)??null;return(0,D.jsx)(Jr,{title:`Runs`,description:`Execution and quality evidence across models, tests, seeds, snapshots, and operations.`,toolbar:(0,D.jsx)(Ny,{runsViewState:t,runsResults:d,adapterColumnLayout:a,adapterMetricsAvailable:o,availableMaterializationKinds:l,onRunsViewStateChange:n}),inspector:f?(0,D.jsx)(Sy,{row:f,visibleColumns:s,overflowColumns:u,onNavigateTo:i}):null,className:`runs-view`,children:(0,D.jsx)(Ay,{analysis:e,runsResults:d,runsViewState:t,adapterColumns:s,onRunsViewStateChange:n,onInvestigationSelectionChange:r})})}function Fy({analysis:e,activeView:t,analysisSource:n,overviewFilters:r,onOverviewFiltersChange:i,timelineFilters:a,onTimelineFiltersChange:o,assetViewState:s,onAssetViewStateChange:c,runsViewState:l,onRunsViewStateChange:u,lineageViewState:d,onLineageViewStateChange:f,onInvestigationSelectionChange:p,onNavigateTo:m,workspaceSignals:h}){let g=e.projectName??dr(e.executions),{explorerPane:_}=Ko({analysis:e,projectName:g,activeView:t,assetViewState:s,onAssetViewStateChange:c,onInvestigationSelectionChange:p}),v=s.selectedResourceId,y=e.resources.find(e=>e.uniqueId===v)??null;return(0,D.jsxs)(`div`,{className:`workspace-layout${_?``:` workspace-layout--full`}`,children:[_,(0,D.jsxs)(`div`,{className:`workspace-main-panel`,children:[t===`health`&&(0,D.jsx)(Ls,{analysis:e,projectName:g,analysisSource:n,filters:r,setFilters:i,workspaceSignals:h}),t===`inventory`&&(0,D.jsx)(uy,{analysis:e,resource:y,onSelectResource:e=>c(t=>({...t,selectedResourceId:e})),assetViewState:{...s,selectedResourceId:v},onAssetViewStateChange:c,lineageViewState:d,onLineageViewStateChange:f,onInvestigationSelectionChange:p,onNavigateTo:m}),t===`runs`&&(0,D.jsx)(Py,{analysis:e,runsViewState:l,onRunsViewStateChange:u,onInvestigationSelectionChange:p,onNavigateTo:m}),t===`timeline`&&(0,D.jsx)(Do,{analysis:e,filters:a,setFilters:o,onInvestigationSelectionChange:p})]})]})}function Iy(e){return e===`local`?`/path/to/target or relative/path`:e===`s3`?`s3://bucket/prefix or bucket/prefix`:`gs://bucket/prefix or bucket/prefix`}function Ly(e){return e===`local`?`Resolved on the server running this app, not in your browser.`:`Uses server-side SDK credentials; keys never enter the browser.`}function Ry(e){return e.discoverLoading?`Scanning for artifacts…`:e.discoveryError==null?e.scanSucceeded?`Artifacts found. You can load the workspace again if needed.`:e.location.trim()===``?`Enter a location, then scan.`:`Press Enter or Scan to check this location.`:`Scan failed. Fix the location and scan again.`}function zy(e){if(e.loadLoading)return`Loading artifact workspace…`;if(!e.canLoad){if(e.discoverLoading)return`Scanning for artifacts…`;if(e.discoveryError!=null)return`Fix the error below, then scan again.`;if(e.location.trim()===``)return`Enter a path, then press Enter, blur the field, or click Scan location.`;if(!e.scanSucceeded)return`Press Enter, blur Location, or click Scan location, then click Load workspace.`}}function By(e,t){if(e!==`gcs`||t==null)return{};let n=t.impersonatedServiceAccount?.trim();return n==null||n===``?{}:{options:{impersonatedServiceAccount:n}}}function Vy(e,t){if(typeof e!=`object`||!e)return t;let n=e.error;return typeof n==`string`&&n.trim()!==``?n:t}var Hy={manifest:`/api/manifest.json`,runResults:`/api/run_results.json`,catalog:`/api/catalog.json`,sources:`/api/sources.json`},Uy=[{manifest:`/api/artifacts/current/manifest.json`,runResults:`/api/artifacts/current/run_results.json`,catalog:`/api/artifacts/current/catalog.json`,sources:`/api/artifacts/current/sources.json`},Hy];function Wy(){return{checkedAtMs:Date.now(),remoteProvider:null,remoteLocation:null,pollIntervalMs:null,currentRun:null,pendingRun:null,supportsSwitch:!1,discoveryError:null,sourceKind:null,locationDisplay:null,missingOptionalArtifacts:void 0}}function Gy(e,t,n){return{mode:e,currentSource:t,label:n,...Wy()}}async function Ky(e){let t=await fetch(e);if(!t.ok)return null;let n=t.headers?.get?.(`content-type`)?.toLowerCase();return n!=null&&!n.includes(`application/json`)?null:t.arrayBuffer()}async function qy(e){try{return await Ky(e)}catch{return null}}async function Jy(e){try{return await Ky(e)}catch{return null}}async function Yy(e){let[t,n,r,i]=await Promise.all([qy(e.manifest),qy(e.runResults),Jy(e.catalog),Jy(e.sources)]);return t==null||n==null?null:{manifestBytes:t,runResultsBytes:n,...r==null?{}:{catalogBytes:r},...i==null?{}:{sourcesBytes:i}}}async function Xy(e=Uy){for(let t of e){let e=await Yy(t);if(e!=null)return e}return null}async function Zy(){let e=await Xy([Hy]);return e==null?null:x(e,`preload`)}async function Qy(){let e=await Zy();return{status:Gy(e==null?`none`:`preload`,e==null?null:`preload`,e==null?`Waiting for artifacts`:`Live target`),result:e}}async function $y(){let e=await fetch(`/api/artifact-source`);if(!e.ok)throw Error(`Failed to load artifact source status`);return await e.json()}async function eb(e=`preload`){let t=await Xy();return t==null?null:x(t,e)}async function tb(){let e;try{e=await fetch(`/api/artifact-source`)}catch{return Qy()}if(e.status===404||!e.ok)return Qy();let t;try{t=await e.json()}catch{return Qy()}return t.currentSource==null?{status:t,result:null}:{status:t,result:await eb(t.currentSource)}}async function nb(e){let t=await fetch(`/api/artifact-source/switch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?{runId:e}:{})});if(!t.ok)throw Error(`Failed to switch artifact source run`);return await t.json()}async function rb(e,t,n){let r=e===`local`?{type:`local`,location:t}:e===`s3`?{type:`s3`,location:t}:{type:`gcs`,location:t,...By(e,n)},i=await fetch(`/api/artifact-source/discover`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)}),a=await i.json().catch(()=>({}));if(!i.ok)throw Error(Vy(a,`Failed to discover artifact source`));return a}async function ib(e,t,n,r){let i={...e===`local`?{type:`local`,location:t}:e===`s3`?{type:`s3`,location:t}:{type:`gcs`,location:t},...n!=null&&n.trim()!==``?{runId:n}:{},...By(e,r)},a=await fetch(`/api/artifact-source/configure`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),o=await a.json().catch(()=>({}));if(!a.ok)throw Error(Vy(o,`Failed to configure artifact source`));return o}var ab=[{value:`local`,label:`Local directory`},{value:`s3`,label:`Amazon S3`},{value:`gcs`,label:`Google Cloud Storage`}];function ob(e){return e?`workspace-segmented-control__button workspace-segmented-control__button--active`:`workspace-segmented-control__button`}function sb({readinessRegionId:e,readinessLabel:t,sourceKind:n,onSourceKindChange:r,location:i,onLocationChange:a,onLocationBlur:o,onLocationKeyDown:s,impersonatedServiceAccount:c,onImpersonatedServiceAccountChange:l,onImpersonatedServiceAccountBlur:u,discoveryError:d,onScan:f,discoverLoading:p,canLoad:m,loadLoading:h,loadWorkspaceHint:g,onLoadWorkspace:_}){let v=[`artifact-location-helper`,d==null?void 0:`artifact-location-error`,e].filter(Boolean).join(` `);return(0,D.jsxs)(`div`,{className:`upload-panel`,children:[(0,D.jsxs)(`header`,{className:`upload-panel__header`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Artifact source`}),(0,D.jsx)(`h3`,{children:`Artifact location`}),(0,D.jsxs)(`p`,{className:`upload-panel__lede`,children:[`Folder or prefix with `,(0,D.jsx)(`code`,{children:`manifest.json`}),` and `,(0,D.jsx)(`code`,{children:`run_results.json`}),` at the root.`]})]}),(0,D.jsxs)(`div`,{className:`upload-panel__body artifact-load-panel__inputs`,children:[(0,D.jsxs)(`div`,{className:`upload-panel__field`,children:[(0,D.jsx)(`span`,{className:`upload-panel__label`,id:`artifact-source-kind-label`,children:`Connection`}),(0,D.jsx)(`div`,{className:`workspace-segmented-control`,role:`tablist`,"aria-labelledby":`artifact-source-kind-label`,children:ab.map(e=>{let t=n===e.value;return(0,D.jsx)(`button`,{type:`button`,role:`tab`,id:`artifact-source-tab-${e.value}`,"aria-selected":t,className:ob(t),onClick:()=>r(e.value),children:e.label},e.value)})})]}),(0,D.jsxs)(`div`,{className:`upload-panel__field`,children:[(0,D.jsx)(`label`,{className:`upload-panel__label`,htmlFor:`artifact-location-input`,children:`Location`}),(0,D.jsxs)(`div`,{className:`upload-panel__location-row`,children:[(0,D.jsx)(`input`,{id:`artifact-location-input`,type:`text`,autoComplete:`off`,"aria-invalid":d!=null,"aria-describedby":v,placeholder:Iy(n),value:i,onChange:e=>a(e.target.value),onBlur:o,onKeyDown:s}),(0,D.jsx)(`button`,{type:`button`,className:`secondary-action`,disabled:p||i.trim()===``,"aria-busy":p,onClick:f,children:p?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Tv,{size:16}),` Scanning…`]}):`Scan location`})]}),(0,D.jsx)(`p`,{id:`artifact-location-helper`,className:`upload-panel__helper`,children:Ly(n)}),d==null?null:(0,D.jsx)(`p`,{id:`artifact-location-error`,className:`upload-panel__error`,role:`alert`,children:d})]}),n===`gcs`?(0,D.jsxs)(`div`,{className:`upload-panel__field`,children:[(0,D.jsx)(`label`,{className:`upload-panel__label`,htmlFor:`artifact-gcs-impersonated-service-account`,children:`Impersonated service account`}),(0,D.jsx)(`input`,{id:`artifact-gcs-impersonated-service-account`,type:`text`,autoComplete:`off`,placeholder:`target-sa@project.iam.gserviceaccount.com`,value:c,onChange:e=>l(e.target.value),onBlur:()=>{u?.()}}),(0,D.jsx)(`p`,{className:`upload-panel__helper`,children:`Optional. Uses server-side Google credentials to impersonate this service account for GCS access. After editing, leave this field or run Scan location (or press Enter in Location).`})]}):null]}),(0,D.jsxs)(`footer`,{className:`upload-panel__footer`,children:[(0,D.jsx)(`span`,{id:e,className:`upload-panel__footer-status`,role:`status`,children:p?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Tv,{size:16}),` `,t]}):t}),(0,D.jsx)(`button`,{type:`button`,className:`primary-action`,disabled:!m||h,"aria-busy":h,"aria-describedby":e,title:g??void 0,onClick:_,children:h?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Tv,{size:16}),` Loading…`]}):`Load workspace`})]})]})}var cb=[{title:`Health-first overview`,body:`Spot failing nodes, long-running bottlenecks, and critical-path pressure before opening individual assets.`},{title:`Catalog-style context`,body:`Browse lineage-adjacent metadata such as descriptions, packages, execution status, and dependency depth in one flow.`},{title:`Timeline investigation`,body:`Shift from summary to execution sequencing without leaving the workspace, inspired by dbt docs and observability tools.`}];function lb(){return(0,D.jsxs)(`div`,{className:`upload-hero__copy`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Load artifacts`}),(0,D.jsx)(`h2`,{children:`Point the workspace at a directory or cloud prefix that contains dbt JSON artifacts.`}),(0,D.jsxs)(`p`,{children:[`The server discovers `,(0,D.jsx)(`code`,{children:`manifest.json`}),` and `,(0,D.jsx)(`code`,{children:`run_results.json`}),` `,`(required), plus optional `,(0,D.jsx)(`code`,{children:`catalog.json`}),` and `,(0,D.jsx)(`code`,{children:`sources.json`}),`. Cloud access uses server-side credentials only.`]}),(0,D.jsxs)(`div`,{className:`upload-hero__callout`,children:[(0,D.jsx)(`span`,{className:`upload-hero__callout-badge`,children:`Layout`}),(0,D.jsx)(`strong`,{children:`Artifacts must be at the location root (typical dbt target/).`}),(0,D.jsx)(`p`,{children:`Point at the directory or prefix that directly contains manifest.json and run_results.json.`})]}),(0,D.jsx)(`div`,{className:`upload-feature-grid`,children:cb.map(e=>(0,D.jsxs)(`article`,{className:`upload-feature-card`,children:[(0,D.jsx)(`strong`,{children:e.title}),(0,D.jsx)(`p`,{children:e.body})]},e.title))})]})}var ub=(0,c.createContext)({toast:()=>{}}),db=0,fb=4e3;function pb({children:e}){let[t,n]=(0,c.useState)([]),r=(0,c.useCallback)((e,t=`neutral`)=>{let r=++db;n(n=>[...n,{id:r,message:e,tone:t}]),setTimeout(()=>{n(e=>e.filter(e=>e.id!==r))},fb)},[]);function i(e){n(t=>t.filter(t=>t.id!==e))}return(0,D.jsxs)(ub.Provider,{value:{toast:r},children:[e,t.length>0&&(0,D.jsx)(`div`,{className:`toast-portal`,role:`status`,"aria-live":`polite`,children:t.map(e=>(0,D.jsxs)(`div`,{className:`toast toast--${e.tone}`,children:[(0,D.jsx)(`span`,{className:`toast__dot`,"aria-hidden":`true`}),(0,D.jsx)(`span`,{className:`toast__message`,children:e.message}),(0,D.jsx)(`button`,{type:`button`,className:`toast__dismiss`,"aria-label":`Dismiss notification`,onClick:()=>i(e.id),children:`✕`})]},e.id))})]})}function mb(){return(0,c.useContext)(ub)}function hb(e,t,n){return e===`gcs`?`gcs|${t}|${n}`:`${e}|${t}`}function gb(e,t,n,r){if(t===``)return null;let i=hb(e,t,n);return r!==``&&i===r?null:`Run artifact discovery again after changing the location or connection settings.`}function _b(e,t,n,r,i){return i?`Wait for artifact discovery to finish, then try loading again.`:gb(e,t,n,r)}function vb(e,t){if(e===`gcs`)return{impersonatedServiceAccount:t}}function yb({onManagedLoad:e,onError:t}){let{toast:n}=mb(),r=(0,c.useId)(),[i,a]=(0,c.useState)(`local`),[o,s]=(0,c.useState)(``),[l,u]=(0,c.useState)(``),[d,f]=(0,c.useState)(!1),[p,m]=(0,c.useState)(!1),[h,g]=(0,c.useState)(``),[_,v]=(0,c.useState)(null),y=(0,c.useRef)(o),b=(0,c.useRef)(i),x=(0,c.useRef)(l),S=(0,c.useRef)(h);y.current=o,b.current=i,x.current=l,S.current=h;let C=(0,c.useRef)(0),w=(0,c.useRef)(!1),T=hb(i,o.trim(),l.trim()),E=h!==``&&T===h,O=(0,c.useMemo)(()=>({discoverLoading:d,discoveryError:_,scanSucceeded:E,location:o}),[d,_,o,E]),k=(0,c.useMemo)(()=>Ry(O),[O]),A=E&&!p&&!d&&_==null,j=(0,c.useMemo)(()=>zy({...O,loadLoading:p,canLoad:A}),[A,p,O]),M=(0,c.useCallback)(async()=>{let r=b.current,i=_b(r,y.current.trim(),x.current.trim(),S.current,w.current);if(i!=null){t(i);return}m(!0),t(null);try{let r=await ib(b.current,y.current.trim(),void 0,vb(b.current,x.current)),i=r.currentSource;if(i!==`preload`&&i!==`remote`){t(`Artifacts are not ready to load.`);return}let a=r.missingOptionalArtifacts??{missingCatalog:!1,missingSources:!1};if(a.missingCatalog||a.missingSources){let e=[];a.missingCatalog&&e.push(`catalog.json`),a.missingSources&&e.push(`sources.json`),n(`Optional artifacts not loaded: ${e.join(`, `)}. Related inventory panels may be limited.`,`positive`)}let o=await eb(i);if(o==null){t(`Could not read artifact bytes from the server.`);return}e(o,i,a),b.current===`gcs`&&(S.current=``,g(``)),u(``)}catch(e){let r=e instanceof Error?e.message:`Failed to load artifacts.`;t(r),n(r,`danger`)}finally{m(!1)}},[t,e,n]),N=(0,c.useCallback)(async e=>{let n=b.current,r=y.current.trim(),i=hb(n,r,n===`gcs`?x.current.trim():``);if(r===``){t(`Enter a directory or bucket prefix.`);return}if(!e&&i===S.current)return;let a=++C.current;w.current=!0,f(!0),t(null),v(null),S.current=``,g(``);try{let e=await rb(n,r,vb(n,x.current));if(a!==C.current)return;if(e.discoveryError!=null){v(e.discoveryError),t(e.discoveryError);return}S.current=i,g(i),w.current=!1,await M()}catch(e){if(a!==C.current)return;let n=e instanceof Error?e.message:`Discovery failed.`;v(n),t(n)}finally{a===C.current&&(w.current=!1,f(!1))}},[M,t]);return(0,D.jsxs)(`section`,{className:`upload-hero`,children:[(0,D.jsx)(lb,{}),(0,D.jsx)(sb,{readinessRegionId:r,readinessLabel:k,discoveryError:_,onScan:()=>{N(!0)},sourceKind:i,onSourceKindChange:e=>{a(e),v(null),S.current=``,g(``),t(null)},location:o,onLocationChange:s,impersonatedServiceAccount:l,onImpersonatedServiceAccountChange:u,onImpersonatedServiceAccountBlur:()=>{b.current===`gcs`&&y.current.trim()!==``&&N(!1)},onLocationBlur:()=>{y.current.trim()!==``&&N(!1)},onLocationKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),N(!1))},discoverLoading:d,canLoad:A,loadLoading:p,loadWorkspaceHint:j,onLoadWorkspace:()=>{M()}})]})}function bb({className:e,style:t}){return(0,D.jsx)(`div`,{className:[`skeleton`,e].filter(Boolean).join(` `),style:t,"aria-hidden":`true`})}function xb(){return(0,D.jsxs)(`div`,{className:`loading-card`,children:[(0,D.jsx)(bb,{className:`loading-card__skeleton-icon`}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(bb,{className:`loading-card__skeleton-title`}),(0,D.jsx)(bb,{className:`loading-card__skeleton-body`})]})]})}var Sb=`workspace-pill workspace-pill--active`,Cb=`workspace-pill`;function wb(e){return e?Sb:Cb}function Tb({open:e,onClose:t,returnFocusRef:n,onManagedAnalysisLoaded:r,onError:i}){let a=(0,c.useRef)(null),o=(0,c.useRef)(!1);return(0,c.useEffect)(()=>{if(!e){o.current&&n.current?.focus(),o.current=!1;return}o.current=!0,a.current?.focus();let r=e=>{e.key===`Escape`&&(e.preventDefault(),t())};document.addEventListener(`keydown`,r);let i=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.removeEventListener(`keydown`,r),document.body.style.overflow=i}},[e,t,n]),e?(0,D.jsxs)(`div`,{className:`settings-artifact-dialog`,"aria-hidden":!1,children:[(0,D.jsx)(`button`,{type:`button`,className:`settings-artifact-dialog__backdrop`,"aria-label":`Close change location dialog`,onClick:()=>{i(null),t()}}),(0,D.jsxs)(`div`,{ref:a,className:`settings-artifact-dialog__panel`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-artifact-dialog-title`,tabIndex:-1,children:[(0,D.jsxs)(`header`,{className:`settings-artifact-dialog__header`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Artifacts`}),(0,D.jsx)(`h2`,{id:`settings-artifact-dialog-title`,children:`Change artifact location`}),(0,D.jsx)(`p`,{className:`settings-artifact-dialog__lede`,children:`Use the same directory or cloud prefix flow as the main workspace load screen. Credentials stay on the server.`})]}),(0,D.jsx)(`button`,{type:`button`,className:`settings-artifact-dialog__close`,"aria-label":`Close`,onClick:()=>{i(null),t()},children:(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`×`})})]}),(0,D.jsx)(`div`,{className:`settings-artifact-dialog__body`,children:(0,D.jsx)(yb,{onManagedLoad:r,onError:i})})]})]}):null}function Eb({analysisSource:e,executionCount:t}){return(0,D.jsxs)(`section`,{className:`settings-hero`,"aria-label":`Workspace preferences`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Workspace profile`}),(0,D.jsx)(`h3`,{children:`Configure how this console looks and behaves by default.`}),(0,D.jsx)(`p`,{children:`Changes save locally and apply to the current workspace immediately when the relevant view is open.`}),(0,D.jsxs)(`div`,{className:`settings-chip-row`,children:[(0,D.jsx)(`span`,{className:`app-badge`,children:br(e)}),(0,D.jsx)(`span`,{className:`settings-chip`,children:t==null?`No artifacts loaded`:`${t} executions loaded`})]})]})}function Db({themePreference:e,onThemeChange:t}){return(0,D.jsx)(Wr,{title:`Appearance`,subtitle:`Choose how the workspace chrome should render by default.`,children:(0,D.jsxs)(`div`,{className:`settings-field-group`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Theme`}),(0,D.jsx)(`div`,{className:`settings-segmented`,children:[`system`,`light`,`dark`].map(n=>(0,D.jsx)(`button`,{type:`button`,className:wb(e===n),onClick:()=>t(n),children:n===`system`?`System`:n.charAt(0).toUpperCase()+n.slice(1)},n))})]})})}function Ob({analysisSource:e,executionCount:t,artifactLocationSnapshot:n,onOpenChangeLocation:r,changeLocationTriggerRef:i,pendingRemoteRun:a,acceptingRemoteRun:o,onAcceptPendingRemoteRun:s}){let c=yr(n?.sourceKind),l=n?.locationDisplay!=null&&n.locationDisplay.trim()!==``?n.locationDisplay:null;return(0,D.jsx)(Wr,{title:`Session`,subtitle:`Current artifact source and data-loading controls.`,children:(0,D.jsxs)(`div`,{className:`settings-stack`,children:[(0,D.jsxs)(`div`,{className:`settings-readout`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Current source`}),(0,D.jsx)(`strong`,{children:br(e)}),(0,D.jsx)(`p`,{children:t==null?`Load artifacts to unlock analysis views.`:`${t} executions are available in this session.`})]}),(0,D.jsxs)(`div`,{className:`settings-readout`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Configured location`}),l==null?c==null?(0,D.jsx)(`p`,{className:`settings-readout-muted`,children:`Nothing configured yet. Use Change location… to open the load wizard and point this session at a directory or cloud prefix.`}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`strong`,{children:c}),(0,D.jsx)(`p`,{className:`settings-readout-muted`,children:`Path label was not returned for this session.`})]}):(0,D.jsxs)(D.Fragment,{children:[c==null?null:(0,D.jsx)(`strong`,{children:c}),(0,D.jsx)(`p`,{className:`settings-mono-path settings-session__path`,title:l,children:l})]})]}),(0,D.jsx)(`div`,{className:`settings-session__actions`,children:(0,D.jsx)(`button`,{ref:i,type:`button`,className:`primary-action settings-primary-action`,onClick:r,children:`Change location…`})}),a&&(0,D.jsx)(`button`,{type:`button`,className:`workspace-pill`,onClick:()=>void s(),disabled:o,children:o?`Switching…`:`Load ${a.label}`})]})})}function kb({preferences:e,setPreferences:t}){return(0,D.jsx)(Wr,{title:`Shell Defaults`,subtitle:`Control the default shape of the workspace chrome.`,children:(0,D.jsxs)(`div`,{className:`settings-field-group`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Sidebar`}),(0,D.jsxs)(`div`,{className:`settings-segmented`,children:[(0,D.jsx)(`button`,{type:`button`,className:wb(!e.sidebarCollapsedDefault),onClick:()=>t(e=>({...e,sidebarCollapsedDefault:!1})),children:`Expanded`}),(0,D.jsx)(`button`,{type:`button`,className:wb(e.sidebarCollapsedDefault),onClick:()=>t(e=>({...e,sidebarCollapsedDefault:!0})),children:`Collapsed`})]})]})})}function Ab({preferences:e,setPreferences:t}){return(0,D.jsx)(Wr,{title:`Timeline Defaults`,subtitle:`Set the default execution timeline filters and dependency focus.`,children:(0,D.jsxs)(`div`,{className:`settings-stack`,children:[(0,D.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,D.jsxs)(`label`,{className:`settings-toggle`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:e.timelineDefaults.showTests,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,showTests:e.target.checked}}))}),(0,D.jsx)(`span`,{children:`Show tests by default`})]}),(0,D.jsxs)(`label`,{className:`settings-toggle`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:e.timelineDefaults.failuresOnly,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,failuresOnly:e.target.checked}}))}),(0,D.jsx)(`span`,{children:`Start with failures-only emphasis`})]})]}),(0,D.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,D.jsxs)(`label`,{className:`settings-field`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Dependency direction`}),(0,D.jsxs)(`select`,{value:e.timelineDefaults.dependencyDirection,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,dependencyDirection:e.target.value}})),children:[(0,D.jsx)(`option`,{value:`upstream`,children:`Upstream`}),(0,D.jsx)(`option`,{value:`both`,children:`Both`}),(0,D.jsx)(`option`,{value:`downstream`,children:`Downstream`})]})]}),(0,D.jsxs)(`label`,{className:`settings-field`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Dependency depth`}),(0,D.jsx)(`input`,{type:`number`,min:`1`,max:`10`,value:e.timelineDefaults.dependencyDepthHops,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,dependencyDepthHops:Math.max(1,Math.min(10,Number(e.target.value)||1))}}))})]})]})]})})}function jb({preferences:e,setPreferences:t}){return(0,D.jsx)(Wr,{title:`Inventory Defaults`,subtitle:`Choose how asset exploration and lineage open by default.`,children:(0,D.jsxs)(`div`,{className:`settings-stack`,children:[(0,D.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,D.jsxs)(`label`,{className:`settings-field`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Explorer mode`}),(0,D.jsxs)(`select`,{value:e.inventoryDefaults.explorerMode,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,explorerMode:e.target.value}})),children:[(0,D.jsx)(`option`,{value:`project`,children:`Project`}),(0,D.jsx)(`option`,{value:`database`,children:`Database`})]})]}),(0,D.jsxs)(`label`,{className:`settings-field`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Lineage lens`}),(0,D.jsxs)(`select`,{value:e.inventoryDefaults.lineageLensMode,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,lineageLensMode:e.target.value}})),children:[(0,D.jsx)(`option`,{value:`type`,children:`Type`}),(0,D.jsx)(`option`,{value:`status`,children:`Status`}),(0,D.jsx)(`option`,{value:`coverage`,children:`Coverage`})]})]})]}),(0,D.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,D.jsxs)(`label`,{className:`settings-field`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Upstream depth`}),(0,D.jsx)(`input`,{type:`number`,min:`1`,max:`10`,value:e.inventoryDefaults.lineageUpstreamDepth,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,lineageUpstreamDepth:Math.max(1,Math.min(10,Number(e.target.value)||1))}}))})]}),(0,D.jsxs)(`label`,{className:`settings-field`,children:[(0,D.jsx)(`span`,{className:`settings-field-label`,children:`Downstream depth`}),(0,D.jsx)(`input`,{type:`number`,min:`1`,max:`10`,value:e.inventoryDefaults.lineageDownstreamDepth,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,lineageDownstreamDepth:Math.max(1,Math.min(10,Number(e.target.value)||1))}}))})]})]}),(0,D.jsxs)(`label`,{className:`settings-toggle`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:e.inventoryDefaults.allDepsMode,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,allDepsMode:e.target.checked}}))}),(0,D.jsx)(`span`,{children:`Open lineage with all dependencies expanded`})]})]})})}function Mb({preferences:e,setPreferences:t,themePreference:n,setThemePreference:r,analysisSource:i,artifactLocationSnapshot:a,executionCount:o,onManagedAnalysisLoaded:s,onError:l,pendingRemoteRun:u,acceptingRemoteRun:d,onAcceptPendingRemoteRun:f}){let[p,m]=(0,c.useState)(!1),h=(0,c.useRef)(null),g=(0,c.useCallback)((e,t,n)=>{m(!1),s(e,t,n)},[s]);return(0,D.jsxs)(Jr,{title:`Settings`,description:`Workspace defaults, visual preferences, and session controls.`,className:`settings-view`,children:[(0,D.jsx)(Tb,{open:p,onClose:()=>{l(null),m(!1)},returnFocusRef:h,onManagedAnalysisLoaded:g,onError:l}),(0,D.jsxs)(`div`,{className:`settings-grid`,children:[(0,D.jsx)(Eb,{analysisSource:i,executionCount:o}),(0,D.jsx)(Db,{themePreference:n,onThemeChange:e=>{r(e),t(t=>({...t,theme:e}))}}),(0,D.jsx)(Ob,{analysisSource:i,executionCount:o,artifactLocationSnapshot:a,onOpenChangeLocation:()=>m(!0),changeLocationTriggerRef:h,pendingRemoteRun:u,acceptingRemoteRun:d,onAcceptPendingRemoteRun:f}),(0,D.jsx)(kb,{preferences:e,setPreferences:t}),(0,D.jsx)(Ab,{preferences:e,setPreferences:t}),(0,D.jsx)(jb,{preferences:e,setPreferences:t})]})]})}function Nb({kind:e}){let t={fill:`none`,stroke:`currentColor`,strokeWidth:1.8,strokeLinecap:`round`,strokeLinejoin:`round`};return e===`invocation`?(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{...t,d:`M20 12.5V7a2 2 0 0 0-2-2h-6.2a2 2 0 0 0-1.4.58l-4.82 4.82A2 2 0 0 0 5 11.82V17a2 2 0 0 0 2 2h5.5`}),(0,D.jsx)(`path`,{...t,d:`M9 5v4a2 2 0 0 1-2 2H5`}),(0,D.jsx)(`circle`,{...t,cx:`17.5`,cy:`17.5`,r:`3.5`})]}):e===`time`?(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{...t,cx:`12`,cy:`12`,r:`8`}),(0,D.jsx)(`path`,{...t,d:`M12 7.8v4.6l3 1.8`})]}):e===`project`?(0,D.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{...t,d:`M3.5 8.5a2 2 0 0 1 2-2h3l1.4 1.7h8.6a2 2 0 0 1 2 2v7.5a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z`})}):(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{...t,d:`M11.25 4.75 5.5 7.7v4.55c0 3.65 2.7 6.95 6.5 7.95 3.8-1 6.5-4.3 6.5-7.95V7.7z`}),(0,D.jsx)(`path`,{...t,d:`M9.4 12.15 11.2 14l3.35-3.45`})]})}function Pb(e,t){let n=e?.projectName??null,r=e?.invocationId??null,i=e?.warehouseType??null,a=e?tr(e):null,o=a==null?null:er(a);return{label:n??`Workspace session`,subtitle:n==null&&r==null&&o==null?`Load artifacts to populate session details.`:null,summaryItems:[r?{key:`invocation`,label:`Invocation ID`,value:r,icon:`invocation`}:null,o?{key:`timestamp`,label:`Timestamp`,value:o,icon:`time`}:null,{key:`source`,label:`Source mode`,value:br(t),icon:`source`},i?{key:`warehouse`,label:`Warehouse type`,value:i.charAt(0).toUpperCase()+i.slice(1),icon:`project`}:null].filter(e=>e!=null)}}function Fb({summaryItems:e}){return(0,D.jsx)(`div`,{className:`app-header__summary-grid`,"aria-label":`Session metadata`,children:e.map(e=>(0,D.jsxs)(`div`,{className:`app-header__summary-item`,children:[(0,D.jsx)(`span`,{className:`app-header__summary-icon`,children:(0,D.jsx)(Nb,{kind:e.icon})}),(0,D.jsxs)(`span`,{className:`app-header__summary-copy`,children:[(0,D.jsx)(`span`,{className:`app-header__summary-label`,children:e.label}),(0,D.jsx)(`strong`,{className:`app-header__summary-value`,children:e.value})]})]},e.key))})}function Ib({header:e}){return(0,D.jsxs)(`div`,{className:`app-header__identity`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,title:e.label,children:e.label}),e.subtitle?(0,D.jsx)(`p`,{className:`app-header__subheadline`,children:e.subtitle}):null,(0,D.jsx)(Fb,{summaryItems:e.summaryItems})]})}function Lb({analysis:e,searchState:t,setSearchState:n,omniboxResults:r,handleNavigateTo:i}){let a=t.query.trim().length>0;return(0,D.jsxs)(`div`,{className:`app-header__omnibox`,children:[(0,D.jsx)(`label`,{className:`app-header__search-control`,children:(0,D.jsxs)(`div`,{className:`app-header__search-shell`,children:[(0,D.jsxs)(`svg`,{className:`workspace-search__icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{cx:`11`,cy:`11`,r:`6.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`}),(0,D.jsx)(`path`,{d:`M16 16l4 4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`})]}),(0,D.jsx)(`input`,{value:t.query,onFocus:()=>n(e=>({...e,isOpen:!0})),onChange:e=>n(t=>({...t,query:e.target.value,isOpen:!0})),placeholder:`Search runs, pipelines, assets...`,"aria-label":`Global search`})]})}),t.isOpen&&e&&(0,D.jsx)(`div`,{className:`omnibox-results`,children:r.loading&&a?(0,D.jsx)(`div`,{className:`omnibox-results__empty`,children:`Searching…`}):r.results.length>0?r.results.map(e=>(0,D.jsxs)(`button`,{type:`button`,className:`omnibox-results__item`,onClick:()=>{n(t=>({...t,isOpen:!1,recentResourceIds:[e.uniqueId,...t.recentResourceIds.filter(t=>t!==e.uniqueId)].slice(0,8)})),i(`inventory`,{resourceId:e.uniqueId,assetTab:`summary`})},children:[(0,D.jsx)(`strong`,{children:e.name}),(0,D.jsx)(`span`,{children:e.resourceType})]},e.uniqueId)):(0,D.jsx)(`div`,{className:`omnibox-results__empty`,children:a?`No matching resources`:`Recent items will appear here`})})]})}function Rb({activeView:e,analysis:t,analysisSource:n,artifactLocationSnapshot:r,preloadLoading:i,pendingRemoteRun:a,acceptingRemoteRun:o,preferences:s,setPreferences:c,themePreference:l,setThemePreference:u,onManagedAnalysisLoaded:d,onError:f,onAcceptPendingRemoteRun:p,workspaceSignals:m,overviewFilters:h,setOverviewFilters:g,timelineFilters:_,setTimelineFilters:v,assetViewState:y,setAssetViewState:b,runsViewState:x,setRunsViewState:S,lineageViewState:C,setLineageViewState:w,setInvestigationSelection:T,handleNavigateTo:E}){return e===`settings`?(0,D.jsx)(Mb,{preferences:s,setPreferences:c,themePreference:l,setThemePreference:u,analysisSource:n,artifactLocationSnapshot:r,executionCount:t?.summary.total_nodes??null,onManagedAnalysisLoaded:d,onError:f,pendingRemoteRun:a,acceptingRemoteRun:o,onAcceptPendingRemoteRun:p}):t?(0,D.jsx)(Fy,{analysis:t,activeView:e,analysisSource:n,overviewFilters:h,onOverviewFiltersChange:g,timelineFilters:_,onTimelineFiltersChange:v,assetViewState:y,onAssetViewStateChange:b,runsViewState:x,onRunsViewStateChange:S,lineageViewState:C,onLineageViewStateChange:w,onInvestigationSelectionChange:T,onNavigateTo:E,workspaceSignals:m}):i?(0,D.jsx)(xb,{}):(0,D.jsx)(yb,{onManagedLoad:d,onError:f})}var zb=[{id:`health`,view:`health`,label:`Health`},{id:`timeline`,view:`timeline`,label:`Timeline`},{id:`inventory`,view:`inventory`,label:`Inventory`},{id:`runs`,view:`runs`,label:`Runs`}],Bb=new Set([`health`,`inventory`,`runs`,`timeline`,`settings`,`overview`,`catalog`,`execution`,`quality`,`dependencies`,`search`]);function Vb(e){let t=new URLSearchParams(e).get(`view`);return t===`lineage`||t===`dependencies`}function Hb(e){switch(e){case`overview`:return`health`;case`catalog`:return`inventory`;case`execution`:case`quality`:return`runs`;case`dependencies`:case`lineage`:return`inventory`;case`search`:return`inventory`;case`discover`:return`inventory`;case`runs`:case`timeline`:case`inventory`:case`health`:case`settings`:return e;default:return`health`}}function Ub(e){let t=new URLSearchParams(e),n=t.get(`view`);return n?n===`discover`?`inventory`:n===`runs`&&t.get(`tab`)===`timeline`?`timeline`:n===`lineage`||n===`dependencies`?`inventory`:Bb.has(n)?Hb(n):null:null}function Wb(e){return new URLSearchParams(e).get(`resource`)}function Gb(e){return new URLSearchParams(e).get(`selected`)}function Kb(e){let t=new URLSearchParams(e).get(`assetTab`);return t===`summary`||t===`lineage`||t===`sql`||t===`runtime`||t===`tests`?t:null}function qb(e){return Kb(e)??(Vb(e)?`lineage`:`summary`)}function Jb(e){let t=new URLSearchParams(e).get(`kind`);return t===`all`||t===`models`||t===`tests`||t===`seeds`||t===`snapshots`||t===`operations`?t:null}function Yb(e){let t=new URLSearchParams(e).get(`adapter`);if(t==null||t===``)return!0;let n=t.trim().toLowerCase();return!(n===`0`||n===`false`||n===`no`)}function Xb(e){let t=new URLSearchParams(e).get(`lens`);return t===`status`||t===`type`||t===`coverage`?t:null}function Zb(e){let t=new URLSearchParams(e).get(`up`);if(t==null||t===``)return null;let n=Number(t);return Number.isFinite(n)?n:null}function Qb(e){let t=new URLSearchParams(e).get(`down`);if(t==null||t===``)return null;let n=Number(t);return Number.isFinite(n)?n:null}function $b(e){let t=new URLSearchParams(e).get(`allDeps`);return t===`1`?!0:t===`0`?!1:null}function ex(e){return Math.max(0,Math.min(10,e))}function tx(e){let t=Wb(e),n=new URLSearchParams(e).get(`selected`),r=Kb(e),i=Vb(e)||r===`lineage`,a=Zb(e),o=Qb(e),s=$b(e),c=Xb(e);return{rootResourceId:t,selectedResourceId:i?n??t:t,upstreamDepth:ex(a??2),downstreamDepth:ex(o??2),allDepsMode:s??!1,lensMode:c??`type`,activeLegendKeys:new Set}}var nx=`dbt-tools.sidebarCollapsed`;function rx(e=!0){try{let e=window.localStorage.getItem(nx);if(e!==null)return e===`true`}catch{}return e}function ix(e,t){return Hb(t)===e.view}var ax=`data:image/svg+xml,%3c!--%20Canonical:%20keep%20in%20sync%20with%20docs/site/public/logo.svg%20--%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20540'%20role='img'%20aria-label='dbt-tools'%3e%3crect%20x='108'%20y='34'%20width='270'%20height='68'%20rx='34'%20fill='%23635BFF'%20/%3e%3crect%20x='276'%20y='142'%20width='318'%20height='68'%20rx='34'%20fill='%23635BFF'%20/%3e%3crect%20x='24'%20y='246'%20width='430'%20height='72'%20rx='36'%20fill='%23635BFF'%20/%3e%3crect%20x='220'%20y='352'%20width='292'%20height='68'%20rx='34'%20fill='%23635BFF'%20/%3e%3crect%20x='108'%20y='458'%20width='236'%20height='68'%20rx='34'%20fill='%23635BFF'%20/%3e%3c/svg%3e`;function ox({className:e,size:t,title:n,testId:r}){return(0,D.jsx)(`img`,{src:ax,alt:n??``,"aria-hidden":n?void 0:!0,className:e,style:t?{width:`${t}px`,height:`${t}px`}:void 0,"data-testid":r})}function sx({id:e}){let t={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,width:20,height:20,"aria-hidden":!0};return e===`health`?(0,D.jsx)(`svg`,{...t,children:(0,D.jsx)(`polyline`,{points:`2,12 6,12 8,5 10,19 13,12 15,12 17,8 19,12 22,12`})}):e===`runs`?(0,D.jsxs)(`svg`,{...t,children:[(0,D.jsx)(`rect`,{x:`3`,y:`4`,width:`3`,height:`16`,rx:`1`}),(0,D.jsx)(`rect`,{x:`9`,y:`8`,width:`3`,height:`12`,rx:`1`}),(0,D.jsx)(`rect`,{x:`15`,y:`6`,width:`3`,height:`14`,rx:`1`}),(0,D.jsx)(`rect`,{x:`21`,y:`10`,width:`0`,height:`0`}),(0,D.jsx)(`line`,{x1:`3`,y1:`20`,x2:`21`,y2:`20`})]}):e===`timeline`?(0,D.jsxs)(`svg`,{...t,children:[(0,D.jsx)(`path`,{d:`M4 18V7`}),(0,D.jsx)(`path`,{d:`M10 18V11`}),(0,D.jsx)(`path`,{d:`M16 18V5`}),(0,D.jsx)(`path`,{d:`M2 18h20`}),(0,D.jsx)(`path`,{d:`M4 9h3M10 13h3M16 7h3`})]}):e===`inventory`?(0,D.jsxs)(`svg`,{...t,children:[(0,D.jsx)(`path`,{d:`M2 7l10-4 10 4-10 4-10-4z`}),(0,D.jsx)(`path`,{d:`M2 12l10 4 10-4`}),(0,D.jsx)(`path`,{d:`M2 17l10 4 10-4`})]}):e===`settings`?(0,D.jsxs)(`svg`,{...t,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,D.jsx)(`path`,{d:`M12 2.75v2.5`}),(0,D.jsx)(`path`,{d:`M12 18.75v2.5`}),(0,D.jsx)(`path`,{d:`M21.25 12h-2.5`}),(0,D.jsx)(`path`,{d:`M5.25 12h-2.5`}),(0,D.jsx)(`path`,{d:`M18.54 5.46l-1.77 1.77`}),(0,D.jsx)(`path`,{d:`M7.23 16.77l-1.77 1.77`}),(0,D.jsx)(`path`,{d:`M18.54 18.54l-1.77-1.77`}),(0,D.jsx)(`path`,{d:`M7.23 7.23L5.46 5.46`})]}):(0,D.jsxs)(`svg`,{...t,children:[(0,D.jsx)(`path`,{d:`M4 7h16`}),(0,D.jsx)(`path`,{d:`M4 12h9`}),(0,D.jsx)(`path`,{d:`M4 17h13`})]})}var cx=`Waiting for artifacts`;function lx({activeView:e,setNavigationTarget:t,sidebarCollapsed:n,setSidebarCollapsed:r,onNavigate:i,analysis:a,analysisSource:o}){let s=br(o);return(0,D.jsxs)(`aside`,{id:`app-sidebar`,className:`app-sidebar${n?` app-sidebar--collapsed`:``}`,children:[(0,D.jsxs)(`button`,{type:`button`,className:`app-sidebar__brand-link`,onClick:()=>{t({view:`health`}),i()},title:`Go to Health`,children:[(0,D.jsx)(ox,{className:`app-logo app-logo--brand`}),!n&&(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`strong`,{children:`dbt-tools`}),(0,D.jsx)(`span`,{children:`Artifact operations console`})]})]}),(0,D.jsx)(`nav`,{className:`app-sidebar__nav`,"aria-label":`Workspace sections`,children:(0,D.jsx)(`div`,{className:`nav-group`,children:zb.map(n=>{let r=!a;return(0,D.jsxs)(`button`,{type:`button`,className:ix(n,e)?`sidebar-link sidebar-link--active`:`sidebar-link`,disabled:r,onClick:()=>{t(n),i()},"aria-label":n.label,title:n.label,children:[(0,D.jsx)(`span`,{className:`sidebar-link__icon`,children:(0,D.jsx)(sx,{id:n.id})}),(0,D.jsx)(`div`,{className:`sidebar-link__body`,children:(0,D.jsx)(`strong`,{children:n.label})})]},n.id)})})}),(0,D.jsx)(`button`,{type:`button`,className:`sidebar-toggle`,onClick:()=>r(e=>!e),"aria-label":n?`Expand sidebar`:`Collapse sidebar`,children:n?`›`:`‹`}),(0,D.jsxs)(`div`,{className:`app-sidebar__footer`,children:[(0,D.jsxs)(`button`,{type:`button`,className:e===`settings`?`sidebar-link sidebar-link--active sidebar-settings-trigger`:`sidebar-link sidebar-settings-trigger`,onClick:()=>{t({view:`settings`}),i()},"aria-current":e===`settings`?`page`:void 0,"aria-label":`Open settings`,title:`Settings`,children:[(0,D.jsx)(`span`,{className:`sidebar-link__icon`,children:(0,D.jsx)(sx,{id:`settings`})}),!n&&(0,D.jsx)(`div`,{className:`sidebar-link__body`,children:(0,D.jsx)(`strong`,{children:`Settings`})})]}),!n&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{className:`sidebar-settings-divider`}),(0,D.jsxs)(`div`,{className:`app-sidebar__session`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Session`}),(0,D.jsx)(`strong`,{children:s}),(0,D.jsx)(`span`,{children:a?`${a.summary.total_nodes} executions analyzed`:cx})]})]})]})]})}function ux({pendingRemoteRun:e,acceptingRemoteRun:t,onAcceptPendingRemoteRun:n}){return e==null?null:(0,D.jsxs)(`section`,{className:`remote-update-banner`,"aria-label":`Remote update available`,children:[(0,D.jsxs)(`div`,{className:`remote-update-banner__copy`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Remote update available`}),(0,D.jsx)(`strong`,{children:e.label}),(0,D.jsx)(`span`,{children:`A newer complete remote artifact pair is ready. Keep the current investigation until you decide to switch.`})]}),(0,D.jsx)(`button`,{type:`button`,className:`primary-action`,onClick:()=>void n(),disabled:t,children:t?`Switching…`:`Load latest remote run`})]})}function dx({workspace:e,analysis:t,analysisSource:n,artifactLocationSnapshot:r,error:i,preloadLoading:a,pendingRemoteRun:o,acceptingRemoteRun:s,onManagedAnalysisLoaded:c,onError:l,onAcceptPendingRemoteRun:u,themePreference:d,setThemePreference:f,preferences:p,setPreferences:m,workspaceSignals:h}){let{activeView:g,sidebarCollapsed:_,setSidebarCollapsed:v,sidebarOpen:y,setSidebarOpen:b,overviewFilters:x,setOverviewFilters:S,timelineFilters:C,setTimelineFilters:w,assetViewState:T,setAssetViewState:k,runsViewState:A,setRunsViewState:j,lineageViewState:M,setLineageViewState:N,searchState:P,setSearchState:F,setInvestigationSelection:I,setNavigationTarget:ee,handleNavigateTo:te,frameClass:L}=e,ne=E(t,P),re=Pb(t,n);return(0,D.jsxs)(`div`,{className:L,children:[y&&(0,D.jsx)(`div`,{className:`sidebar-backdrop`,role:`presentation`,onClick:()=>b(!1)}),(0,D.jsx)(lx,{activeView:g,setNavigationTarget:ee,sidebarCollapsed:_,setSidebarCollapsed:v,onNavigate:()=>b(!1),analysis:t,analysisSource:n}),(0,D.jsxs)(`main`,{className:`app-main`,children:[(0,D.jsxs)(`header`,{className:`app-header app-header--workspace`,children:[(0,D.jsx)(`button`,{type:`button`,className:`hamburger-btn`,"aria-label":`Open navigation`,"aria-expanded":y,"aria-controls":`app-sidebar`,onClick:()=>b(!0),children:(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`☰`})}),(0,D.jsx)(Ib,{header:re}),(0,D.jsx)(Lb,{analysis:t,searchState:P,setSearchState:F,omniboxResults:ne,handleNavigateTo:te})]}),i&&(0,D.jsx)(O,{message:i}),(0,D.jsx)(ux,{pendingRemoteRun:o,acceptingRemoteRun:s,onAcceptPendingRemoteRun:u}),(0,D.jsx)(Rb,{activeView:g,analysis:t,analysisSource:n,artifactLocationSnapshot:r,preloadLoading:a,pendingRemoteRun:o,acceptingRemoteRun:s,preferences:p,setPreferences:m,themePreference:d,setThemePreference:f,onManagedAnalysisLoaded:c,onError:l,onAcceptPendingRemoteRun:u,workspaceSignals:h,overviewFilters:x,setOverviewFilters:S,timelineFilters:C,setTimelineFilters:w,assetViewState:T,setAssetViewState:k,runsViewState:A,setRunsViewState:j,lineageViewState:M,setLineageViewState:N,setInvestigationSelection:I,handleNavigateTo:te})]})]})}function fx(e,t,n){return t===`preload`?{value:`Live target`,detail:`Synced from DBT_TOOLS_TARGET_DIR with ${e.graphSummary.totalEdges} dependency edges ready for investigation.`}:t===`remote`?{value:`Remote source`,detail:`Managed from remote object storage with ${e.graphSummary.totalEdges} dependency edges ready for investigation.`}:{value:`Artifact upload`,detail:`${e.summary.total_nodes} executions loaded from local artifacts${n>0?`, including ${n} tests`:``}.`}}function px(e,t){let n=e.executions.filter(e=>e.statusTone===`danger`).length,r=e.executions.filter(e=>e.statusTone===`warning`).length,i=e.executions.filter(e=>[`test`,`unit_test`].includes(e.resourceType)).length,a=e.resources.filter(e=>!!e.description?.trim()).length,o=e.resources.length>0?Math.round(a/e.resources.length*100):0,s=fx(e,t,i);return[{label:`Run posture`,value:n>0?`${n} failing`:r>0?`${r} warning`:`Healthy`,detail:n>0?`Prioritize failing nodes before reviewing downstream impact.`:r>0?`Warnings detected; review tests and exposures next.`:`No failing nodes surfaced in this run.`,tone:n>0?`danger`:r>0?`warning`:`positive`},{label:`Metadata coverage`,value:`${o}%`,detail:`${a} of ${e.resources.length} resources include descriptions for catalog-style discovery.`,tone:o>=70?`positive`:o>=35?`warning`:`neutral`},{label:`Workspace mode`,value:s.value,detail:s.detail,tone:`neutral`}]}function mx({setPreloadLoading:e,setAnalysis:t,setAnalysisSource:n,setPendingRemoteRun:r,setRemotePollIntervalMs:i,setError:a,pendingMetricsRef:o,setArtifactCapability:s,onArtifactSourceStatus:l}){let u=(0,c.useRef)(!1);(0,c.useEffect)(()=>{u.current||(u.current=!0,d(`Preload: fetching current managed artifacts`),tb().then(({result:c,status:u})=>{e(!1),r(u.pendingRun),i(u.pollIntervalMs),l?.(u),c?(d(`Preload: success, analysis loaded`),o.current=c.metrics,t(c.analysis),n(u.currentSource),a(null),s(u.missingOptionalArtifacts??{missingCatalog:!1,missingSources:!1})):(n(u.currentSource),s({missingCatalog:!1,missingSources:!1}))}).catch(t=>{e(!1),d(`Preload: error`,t),a(t instanceof Error?t.message:`Failed to load artifacts from server`)}))},[o,e,t,n,r,i,a,s,l])}function hx(e,t,n,r){(0,c.useEffect)(()=>{},[e,r,t,n])}function gx(e,t,n,r,i){(0,c.useEffect)(()=>{if(e!==`remote`){t(null),n(null);return}let a=!1,o=async()=>{try{let e=await $y();a||(t(e.pendingRun),n(e.pollIntervalMs),i?.(e))}catch(e){d(`Artifact source poll failed`,e)}};o();let s=window.setInterval(()=>{o()},r??3e4);return()=>{a=!0,window.clearInterval(s)}},[e,r,t,n,i])}function _x(){let[e,t]=(0,c.useState)(null),[n,r]=(0,c.useState)(null),[i,a]=(0,c.useState)(null),[o,s]=(0,c.useState)(!0),[l,u]=(0,c.useState)(null),[m,h]=(0,c.useState)(!1),[g,_]=(0,c.useState)(null),[v,y]=(0,c.useState)({missingCatalog:!1,missingSources:!1}),[b,x]=(0,c.useState)(null),S=(0,c.useRef)(null),C=(0,c.useCallback)(e=>{x(t=>{let n=vr(e);return n==null&&t==null||n!=null&&t!=null&&n.sourceKind===t.sourceKind&&n.locationDisplay===t.locationDisplay?t:n})},[]);return mx({setPreloadLoading:s,setAnalysis:t,setAnalysisSource:a,setPendingRemoteRun:u,setRemotePollIntervalMs:_,setError:r,pendingMetricsRef:S,setArtifactCapability:y,onArtifactSourceStatus:C}),hx(i,t,r,S),gx(i,u,_,g,C),(0,c.useEffect)(()=>{if(e==null||S.current==null)return;let t=S.current;S.current=null,requestAnimationFrame(()=>{let e=`analysis-load:${t.requestId}:interactive`,n=`analysis-load:${t.requestId}:first-interactive-frame`;f(e),p(n,t.dispatchMarkName,e),d(`Analysis load metrics`,{requestId:t.requestId,source:t.source,timings:t.timings})})},[e]),{analysis:e,analysisSource:i,artifactLocationSnapshot:b,artifactCapability:v,error:n,preloadLoading:o,pendingRemoteRun:l,acceptingRemoteRun:m,onLoadDifferent:()=>{t(null),a(null),u(null),_(null),r(null),x(null),y({missingCatalog:!1,missingSources:!1})},onManagedAnalysisLoaded:(e,n,r)=>{S.current=e.metrics,a(n),u(null),t(e.analysis),y(r),$y().then(C).catch(()=>{})},onError:r,onAcceptPendingRemoteRun:async()=>{if(l!=null){h(!0);try{let e=await nb(l.runId),n=await eb(`remote`);n!=null&&(S.current=n.metrics,t(n.analysis),a(e.currentSource),_(e.pollIntervalMs),r(null),y(e.missingOptionalArtifacts??{missingCatalog:!1,missingSources:!1})),u(e.pendingRun),C(e)}catch(e){r(e instanceof Error?e.message:`Failed to switch remote artifact run`)}finally{h(!1)}}}}}var vx=`dbt-tools.workspacePreferences`,yx={theme:`system`,sidebarCollapsedDefault:!0,timelineDefaults:{showTests:!1,failuresOnly:!1,dependencyDirection:`both`,dependencyDepthHops:2},inventoryDefaults:{explorerMode:`project`,lineageLensMode:`type`,lineageUpstreamDepth:2,lineageDownstreamDepth:2,allDepsMode:!1}};function bx(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.max(1,Math.min(10,Math.round(e)))}function xx(e){return e===`upstream`||e===`both`||e===`downstream`}function Sx(e){return e===`project`||e===`database`}function Cx(e){return e===`status`||e===`type`||e===`coverage`}function wx(e){return e===`light`||e===`dark`||e===`system`}function Tx(e){if(!e)return yx;try{let t=JSON.parse(e);return{theme:wx(t.theme)?t.theme:yx.theme,sidebarCollapsedDefault:typeof t.sidebarCollapsedDefault==`boolean`?t.sidebarCollapsedDefault:yx.sidebarCollapsedDefault,timelineDefaults:{showTests:typeof t.timelineDefaults?.showTests==`boolean`?t.timelineDefaults.showTests:yx.timelineDefaults.showTests,failuresOnly:typeof t.timelineDefaults?.failuresOnly==`boolean`?t.timelineDefaults.failuresOnly:yx.timelineDefaults.failuresOnly,dependencyDirection:xx(t.timelineDefaults?.dependencyDirection)?t.timelineDefaults.dependencyDirection:yx.timelineDefaults.dependencyDirection,dependencyDepthHops:bx(t.timelineDefaults?.dependencyDepthHops,yx.timelineDefaults.dependencyDepthHops)},inventoryDefaults:{explorerMode:Sx(t.inventoryDefaults?.explorerMode)?t.inventoryDefaults.explorerMode:yx.inventoryDefaults.explorerMode,lineageLensMode:Cx(t.inventoryDefaults?.lineageLensMode)?t.inventoryDefaults.lineageLensMode:yx.inventoryDefaults.lineageLensMode,lineageUpstreamDepth:bx(t.inventoryDefaults?.lineageUpstreamDepth,yx.inventoryDefaults.lineageUpstreamDepth),lineageDownstreamDepth:bx(t.inventoryDefaults?.lineageDownstreamDepth,yx.inventoryDefaults.lineageDownstreamDepth),allDepsMode:typeof t.inventoryDefaults?.allDepsMode==`boolean`?t.inventoryDefaults.allDepsMode:yx.inventoryDefaults.allDepsMode}}}catch{return yx}}function Ex(){let[e,t]=(0,c.useState)(()=>{try{return Tx(window.localStorage.getItem(vx))}catch{return yx}});return(0,c.useEffect)(()=>{try{window.localStorage.setItem(vx,JSON.stringify(e))}catch{}},[e]),{preferences:e,setPreferences:t}}function Dx(e,t){let n=t!==e.selectedExecutionId;return{...e,selectedExecutionId:t,...n?{neighborhoodRowsShowAll:!1}:{}}}var Ox=(e,t)=>({activeTab:qb(e),expandedNodeIds:new Set,explorerMode:t?.inventoryDefaults.explorerMode??`project`,status:`all`,resourceTypes:new Set,materializationKinds:new Set,resourceQuery:``,selectedResourceId:Wb(e),upstreamDepth:Zb(e)??t?.inventoryDefaults.lineageUpstreamDepth??2,downstreamDepth:Qb(e)??t?.inventoryDefaults.lineageDownstreamDepth??2,allDepsMode:$b(e)??t?.inventoryDefaults.allDepsMode??!1,lensMode:Xb(e)??t?.inventoryDefaults.lineageLensMode??`type`,activeLegendKeys:new Set}),kx=e=>{let t=Ub(e);return{kind:Jb(e)??`all`,status:`all`,query:``,resourceTypes:new Set,materializationKinds:new Set,threadIds:new Set,durationBand:`all`,sortBy:`attention`,sortDirection:`desc`,groupBy:`none`,selectedExecutionId:t===`runs`?Gb(e):null,showAdapterMetrics:t===`runs`?Yb(e):!1}},Ax=(e,t)=>{let n=Ub(e),r=n===`runs`||n===`timeline`?Gb(e):null;return{query:``,activeStatuses:new Set,activeTypes:new Set,selectedExecutionId:r,showTests:t?.timelineDefaults.showTests??!1,failuresOnly:t?.timelineDefaults.failuresOnly??!1,dependencyDirection:t?.timelineDefaults.dependencyDirection??`both`,dependencyDepthHops:t?.timelineDefaults.dependencyDepthHops??2,timeWindow:null,neighborhoodRowsShowAll:!1}};function jx(e){let t=new URLSearchParams(e);if(Ub(e)!==`inventory`)return null;let n=[],r=t.get(`q`)?.trim()??``;r!==``&&n.push(r);for(let e of[`type`,`package`,`tag`,`path`]){let r=t.get(e)?.trim()??``;r!==``&&n.push(`${e}:${r}`)}return n.join(` `).trim()}function Mx(e,t){let n=jx(e);return n===null?t:{...t,resourceQuery:n}}var Nx=e=>{let t=Ub(e)??`health`,n=Wb(e),r=Gb(e);return{selectedResourceId:n,selectedExecutionId:t===`runs`||t===`timeline`?r:null,sourceLens:null}};function Px(e,t){return{activeView:Ub(e)??`health`,assetViewState:Mx(e,Ox(e,t)),runsViewState:kx(e),timelineFilters:Ax(e,t),lineageViewState:{...tx(e),upstreamDepth:Zb(e)??t?.inventoryDefaults.lineageUpstreamDepth??2,downstreamDepth:Qb(e)??t?.inventoryDefaults.lineageDownstreamDepth??2,allDepsMode:$b(e)??t?.inventoryDefaults.allDepsMode??!1,lensMode:Xb(e)??t?.inventoryDefaults.lineageLensMode??`type`},investigationSelection:Nx(e)}}function Fx(e){let t=Ub(e),n=Wb(e),r=Gb(e);return{activeView:t??void 0,assetViewState:t=>Mx(e,{...t,selectedResourceId:n,activeTab:qb(e)}),runsViewState:n=>({...n,kind:Jb(e)??n.kind,selectedExecutionId:t===`runs`?r:null,showAdapterMetrics:t===`runs`?Yb(e):n.showAdapterMetrics}),timelineFilters:e=>Dx(e,t===`timeline`?r:null),lineageViewState:tx(e),investigationSelection:e=>({...e,selectedResourceId:n,selectedExecutionId:t===`runs`||t===`timeline`?r:null,sourceLens:e.sourceLens})}}var Ix=[`resource`,`assetTab`,`selected`,`kind`,`adapter`,`up`,`down`,`allDeps`,`lens`,`q`];function Lx(e,t){for(let n of Ix)t?.has(n)||e.searchParams.delete(n)}function Rx(e,t,n){t.selectedResourceId?e.searchParams.set(`resource`,t.selectedResourceId):e.searchParams.delete(`resource`),e.searchParams.set(`assetTab`,t.activeTab);let r=t.resourceQuery.trim();r===``?e.searchParams.delete(`q`):e.searchParams.set(`q`,r),e.searchParams.delete(`kind`),t.activeTab===`lineage`?(n.selectedResourceId?e.searchParams.set(`selected`,n.selectedResourceId):e.searchParams.delete(`selected`),e.searchParams.set(`up`,String(n.upstreamDepth)),e.searchParams.set(`down`,String(n.downstreamDepth)),e.searchParams.set(`allDeps`,n.allDepsMode?`1`:`0`),e.searchParams.set(`lens`,n.lensMode)):Lx(e,new Set([`resource`,`assetTab`,`q`]))}function zx(e,t){e.searchParams.set(`kind`,t.kind),t.selectedExecutionId?e.searchParams.set(`selected`,t.selectedExecutionId):e.searchParams.delete(`selected`),t.showAdapterMetrics?e.searchParams.delete(`adapter`):e.searchParams.set(`adapter`,`0`),Lx(e,new Set([`kind`,`selected`,`adapter`]))}function Bx(e,t){t?e.searchParams.set(`selected`,t):e.searchParams.delete(`selected`),Lx(e,new Set([`selected`]))}function Vx(e){let{pathname:t,hash:n,activeView:r,assetViewState:i,runsViewState:a,timelineSelectedExecutionId:o,lineageViewState:s}=e,c=new URL(`http://local.invalid${t}${n}`);return c.searchParams.set(`view`,r),r===`inventory`?Rx(c,i,s):r===`runs`?zx(c,a):r===`timeline`?Bx(c,o):Lx(c),`${t}${c.search}${n}`}function Hx(e){let t=(0,c.useRef)(!1),n=Px(window.location.search,e),[r,i]=(0,c.useState)(()=>n.activeView),[a,o]=(0,c.useState)(()=>rx(e.sidebarCollapsedDefault)),[s,l]=(0,c.useState)(!1),[u,d]=(0,c.useState)({status:`all`,resourceTypes:new Set,query:``}),[f,p]=(0,c.useState)(()=>n.timelineFilters),[m,h]=(0,c.useState)(()=>n.assetViewState),[g,_]=(0,c.useState)(()=>n.runsViewState),[v,y]=(0,c.useState)(()=>n.lineageViewState),[b,x]=(0,c.useState)({query:``,recentResourceIds:[],isOpen:!1}),[S,C]=(0,c.useState)(()=>n.investigationSelection),w=(0,c.useCallback)(e=>{o(t=>{let n=e(t);try{window.localStorage.setItem(nx,String(n))}catch{}return n})},[]),T=(0,c.useCallback)(e=>{i(e.view===`search`?`inventory`:e.view)},[]),E=(0,c.useCallback)((e,t)=>{i(e),t?.resourceId?(h(e=>({...e,selectedResourceId:t.resourceId??e.selectedResourceId,activeTab:t.assetTab??e.activeTab})),y(e=>({...e,rootResourceId:t.rootResourceId??t.resourceId??e.rootResourceId,selectedResourceId:t.resourceId??e.selectedResourceId}))):t?.assetTab&&e===`inventory`&&h(e=>({...e,activeTab:t.assetTab??e.activeTab})),t?.executionId&&(_(e=>({...e,selectedExecutionId:t.executionId??e.selectedExecutionId})),p(e=>Dx(e,t.executionId??e.selectedExecutionId))),e===`runs`&&t?.resourceId&&_(e=>({...e,query:t.resourceId??e.query})),C(n=>({selectedResourceId:t?.resourceId??n.selectedResourceId,selectedExecutionId:t?.executionId??n.selectedExecutionId,sourceLens:e}))},[]);return(0,c.useEffect)(()=>{let e=Vx({pathname:window.location.pathname,hash:window.location.hash,activeView:r,assetViewState:m,runsViewState:g,timelineSelectedExecutionId:f.selectedExecutionId,lineageViewState:v});e!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.pushState(null,``,e)},[r,m,g,f.selectedExecutionId,v]),(0,c.useEffect)(()=>{let e=()=>{let e=Fx(window.location.search);e.activeView!==void 0&&i(e.activeView),h(t=>e.assetViewState(t)),_(t=>e.runsViewState(t)),p(t=>e.timelineFilters(t)),y(e.lineageViewState),C(t=>e.investigationSelection(t))};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,c.useEffect)(()=>{if(!t.current){t.current=!0;return}p(t=>({...t,showTests:e.timelineDefaults.showTests,failuresOnly:e.timelineDefaults.failuresOnly,dependencyDirection:e.timelineDefaults.dependencyDirection,dependencyDepthHops:e.timelineDefaults.dependencyDepthHops})),h(t=>({...t,explorerMode:e.inventoryDefaults.explorerMode})),y(t=>({...t,upstreamDepth:e.inventoryDefaults.lineageUpstreamDepth,downstreamDepth:e.inventoryDefaults.lineageDownstreamDepth,allDepsMode:e.inventoryDefaults.allDepsMode,lensMode:e.inventoryDefaults.lineageLensMode})),o(e.sidebarCollapsedDefault);try{window.localStorage.setItem(nx,String(e.sidebarCollapsedDefault))}catch{}},[e]),(0,c.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),x(e=>({...e,isOpen:!0}))),e.key===`Escape`&&(l(!1),x(e=>({...e,isOpen:!1})))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),{activeView:r,sidebarCollapsed:a,setSidebarCollapsed:w,sidebarOpen:s,setSidebarOpen:l,overviewFilters:u,setOverviewFilters:d,timelineFilters:f,setTimelineFilters:p,assetViewState:m,setAssetViewState:h,runsViewState:g,setRunsViewState:_,lineageViewState:v,setLineageViewState:y,searchState:b,setSearchState:x,investigationSelection:S,setInvestigationSelection:C,setNavigationTarget:T,handleNavigateTo:E,frameClass:[`app-frame`,a?`app-frame--sidebar-collapsed`:``,s?`app-frame--nav-open`:``].filter(Boolean).join(` `)}}function Ux(){let{toast:e}=mb(),{preferences:t,setPreferences:n}=Ex(),r=Hx(t),{analysis:i,analysisSource:a,artifactLocationSnapshot:o,error:s,preloadLoading:l,pendingRemoteRun:u,acceptingRemoteRun:d,onManagedAnalysisLoaded:f,artifactCapability:p,onError:m,onAcceptPendingRemoteRun:h}=_x(),{themePreference:g,setThemePreference:_}=Si();(0,c.useEffect)(()=>{t.theme!==g&&_(t.theme)},[t.theme,_,g]);let v=(0,c.useRef)(null);(0,c.useEffect)(()=>{i&&!v.current&&a===`preload`&&e(`Workspace loaded — ${i.summary.total_nodes} executions`,`positive`),i&&!v.current&&a===`remote`&&e(`Remote workspace loaded — ${i.summary.total_nodes} executions`,`positive`),v.current=i},[i,a,e]);let y=(0,c.useRef)(null);(0,c.useEffect)(()=>{if(u==null){y.current=null;return}y.current!==u.runId&&(y.current=u.runId,e(`A newer remote run is available: ${u.label}`,`warning`))},[u,e]);let b=i?px(i,a):[];return(0,D.jsx)(Lc.Provider,{value:p,children:(0,D.jsx)(dx,{workspace:r,analysis:i,analysisSource:a,artifactLocationSnapshot:o,error:s,preloadLoading:l,pendingRemoteRun:u,acceptingRemoteRun:d,onManagedAnalysisLoaded:f,onError:m,onAcceptPendingRemoteRun:h,themePreference:g,setPreferences:n,preferences:t,setThemePreference:_,workspaceSignals:b})})}function Wx(){return(0,D.jsx)(pb,{children:(0,D.jsx)(Ux,{})})}(0,l.createRoot)(document.getElementById(`root`)).render((0,D.jsx)(c.StrictMode,{children:(0,D.jsx)(Wx,{})}));
|
package/dist/favicon.svg
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!-- Canonical: keep in sync with docs/site/public/favicon.svg -->
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="dbt-tools">
|
|
3
|
+
<rect width="64" height="64" rx="12" fill="#000000" />
|
|
4
|
+
<g transform="translate(4 8.375) scale(0.0875)">
|
|
5
|
+
<rect x="108" y="34" width="270" height="68" rx="34" fill="#635BFF" />
|
|
6
|
+
<rect x="276" y="142" width="318" height="68" rx="34" fill="#635BFF" />
|
|
7
|
+
<rect x="24" y="246" width="430" height="72" rx="36" fill="#635BFF" />
|
|
8
|
+
<rect x="220" y="352" width="292" height="68" rx="34" fill="#635BFF" />
|
|
9
|
+
<rect x="108" y="458" width="236" height="68" rx="34" fill="#635BFF" />
|
|
10
|
+
</g>
|
|
11
|
+
</svg>
|
package/dist/index.html
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>dbt-tools</title>
|
|
7
|
-
<link rel="icon" type="image/svg+xml" href="/
|
|
7
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
8
8
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
9
9
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
10
10
|
<link
|
|
11
11
|
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&family=Space+Grotesk:wght@500;600;700&display=swap"
|
|
12
12
|
rel="stylesheet"
|
|
13
13
|
/>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-DRBtWycK.js"></script>
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Dw2cE7zH.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-DBiqvVPF.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/tanstack-virtual-vendor-BfMyFx37.js">
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!-- Canonical: keep in sync with docs/site/public/favicon.svg -->
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="dbt-tools">
|
|
3
|
+
<rect width="64" height="64" rx="12" fill="#000000" />
|
|
4
|
+
<g transform="translate(4 8.375) scale(0.0875)">
|
|
5
|
+
<rect x="108" y="34" width="270" height="68" rx="34" fill="#635BFF" />
|
|
6
|
+
<rect x="276" y="142" width="318" height="68" rx="34" fill="#635BFF" />
|
|
7
|
+
<rect x="24" y="246" width="430" height="72" rx="36" fill="#635BFF" />
|
|
8
|
+
<rect x="220" y="352" width="292" height="68" rx="34" fill="#635BFF" />
|
|
9
|
+
<rect x="108" y="458" width="236" height="68" rx="34" fill="#635BFF" />
|
|
10
|
+
</g>
|
|
11
|
+
</svg>
|
package/dist-serve/server/cli.js
CHANGED
|
@@ -1,20 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { ARTIFACT_RUN_ID_CURRENT, DBT_CATALOG_JSON, DBT_MANIFEST_JSON, DBT_RUN_RESULTS_JSON, DBT_SOURCES_JSON, applyEntrypointRemoteOptionsToEnv, argvElementAt, createReadStreamValidated, discoverArtifactCandidates, discoverLocalArtifactRunPaths, entrypointRemoteHelpLines, existsValidated, getDbtToolsDbtTargetFromEnv, getDbtToolsRemoteClientEnvFromEnv, getDbtToolsTargetDirFromEnv, getObjectProperty, isDbtToolsDebugEnabled, joinObjectStorageKey, mergeRemoteSourceConfigWithParsedLocation, normalizeArtifactPrefix, normalizeArtifactPrefix as normalizeArtifactPrefix$1, parseArtifactSourceLocation, parseDbtToolsArtifactTarget, parseEntrypointRemoteArgv, readValidatedUtf8, readValidatedUtf8Sync, realpathValidatedSync, remoteKeysToListedArtifacts, resolveEntrypointRemoteOptions, statValidatedSync } from "@dbt-tools/core";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
2
4
|
import http from "node:http";
|
|
3
5
|
import path from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { ARTIFACT_RUN_ID_CURRENT, DBT_CATALOG_JSON, DBT_MANIFEST_JSON, DBT_RUN_RESULTS_JSON, DBT_SOURCES_JSON, createReadStreamValidated, discoverArtifactCandidates, discoverLocalArtifactRunPaths, existsValidated, getDbtToolsRemoteClientEnvFromEnv, getDbtToolsTargetDirFromEnv, getObjectProperty, isDbtToolsDebugEnabled, joinObjectStorageKey, mergeRemoteSourceConfigWithParsedLocation, normalizeArtifactPrefix, normalizeArtifactPrefix as normalizeArtifactPrefix$1, parseArtifactSourceLocation, readValidatedUtf8, realpathValidatedSync, remoteKeysToListedArtifacts, statValidatedSync } from "@dbt-tools/core";
|
|
6
6
|
import { createRemoteObjectStoreClient } from "@dbt-tools/core/artifact-io";
|
|
7
|
+
//#region src/server/package-version.ts
|
|
8
|
+
/**
|
|
9
|
+
* Resolved at runtime from compiled `dist/*.js` (package root is `..`).
|
|
10
|
+
*/
|
|
11
|
+
function readWebPackageVersion() {
|
|
12
|
+
const pkgPath = fileURLToPath(new URL("../../package.json", import.meta.url));
|
|
13
|
+
const parsed = JSON.parse(readValidatedUtf8Sync(pkgPath));
|
|
14
|
+
if (typeof parsed.version !== "string" || parsed.version.trim() === "") throw new Error("Invalid or missing \"version\" in @dbt-tools/web package.json");
|
|
15
|
+
return parsed.version;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
7
18
|
//#region src/server/cli-args.ts
|
|
8
19
|
/** Pure CLI argument parsing for `dbt-tools-web` (testable without starting the server). */
|
|
9
|
-
var USAGE =
|
|
10
|
-
Usage: dbt-tools-web [options]
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
--
|
|
15
|
-
|
|
20
|
+
var USAGE = [
|
|
21
|
+
"Usage: dbt-tools-web [options]",
|
|
22
|
+
"",
|
|
23
|
+
"Options (CLI flags override env when both are set):",
|
|
24
|
+
...entrypointRemoteHelpLines(),
|
|
25
|
+
" --target <dir> Alias for local --dbt-target (sets DBT_TOOLS_TARGET_DIR)",
|
|
26
|
+
" --port <n> Port to listen on (default: 3000)",
|
|
27
|
+
" -V, --version Print package version",
|
|
28
|
+
" -h, --help Show this help"
|
|
29
|
+
].join("\n");
|
|
30
|
+
var ENTRYPOINT_VALUE_FLAGS = new Set([
|
|
31
|
+
"--dbt-target",
|
|
32
|
+
"--gcs-project-id",
|
|
33
|
+
"--gcs-impersonate-service-account",
|
|
34
|
+
"--s3-region",
|
|
35
|
+
"--s3-endpoint"
|
|
36
|
+
]);
|
|
16
37
|
function readRequiredValue(argv, i, flagDesc) {
|
|
17
|
-
const next = argv
|
|
38
|
+
const next = argvElementAt(argv, i + 1);
|
|
18
39
|
if (!next || next.startsWith("-")) return {
|
|
19
40
|
ok: false,
|
|
20
41
|
message: `Missing value for ${flagDesc}`
|
|
@@ -30,84 +51,97 @@ function parsePortString(s) {
|
|
|
30
51
|
if (Number.isNaN(parsed) || parsed < 1 || parsed > 65535) return null;
|
|
31
52
|
return parsed;
|
|
32
53
|
}
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
if (arg === "--
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
39
|
-
if (arg === "--no-open") return {
|
|
40
|
-
status: "advance",
|
|
41
|
-
nextIndex: i + 1
|
|
42
|
-
};
|
|
54
|
+
function parseEarlyWebFlag(arg) {
|
|
55
|
+
if (arg === "--help" || arg === "-h") return { kind: "help" };
|
|
56
|
+
if (arg === "--version" || arg === "-V") return { kind: "version" };
|
|
57
|
+
}
|
|
58
|
+
function advanceWebArgv(argv, i, arg, body) {
|
|
59
|
+
if (arg === "--no-open") return { nextIndex: i + 1 };
|
|
43
60
|
if (arg === "--target" || arg === "-t") {
|
|
44
61
|
const r = readRequiredValue(argv, i, "--target (or -t)");
|
|
45
62
|
if (!r.ok) return {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
kind: "error",
|
|
49
|
-
message: r.message
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
state.targetDir = r.value;
|
|
53
|
-
return {
|
|
54
|
-
status: "advance",
|
|
55
|
-
nextIndex: r.nextIndex + 1
|
|
63
|
+
kind: "error",
|
|
64
|
+
message: r.message
|
|
56
65
|
};
|
|
66
|
+
body.targetAlias = r.value;
|
|
67
|
+
return { nextIndex: r.nextIndex + 1 };
|
|
57
68
|
}
|
|
58
69
|
if (arg === "--port" || arg === "-p") {
|
|
59
70
|
const r = readRequiredValue(argv, i, "--port (or -p)");
|
|
60
71
|
if (!r.ok) return {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
kind: "error",
|
|
64
|
-
message: r.message
|
|
65
|
-
}
|
|
72
|
+
kind: "error",
|
|
73
|
+
message: r.message
|
|
66
74
|
};
|
|
67
75
|
const p = parsePortString(r.value);
|
|
68
76
|
if (p === null) return {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
kind: "error",
|
|
72
|
-
message: `Invalid port: ${r.value}`
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
state.port = p;
|
|
76
|
-
return {
|
|
77
|
-
status: "advance",
|
|
78
|
-
nextIndex: r.nextIndex + 1
|
|
77
|
+
kind: "error",
|
|
78
|
+
message: `Invalid port: ${r.value}`
|
|
79
79
|
};
|
|
80
|
+
body.port = p;
|
|
81
|
+
return { nextIndex: r.nextIndex + 1 };
|
|
80
82
|
}
|
|
81
|
-
if (arg.startsWith("-")) return {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
kind: "error",
|
|
85
|
-
message: `Unknown option: ${arg}`
|
|
86
|
-
}
|
|
83
|
+
if (!arg.startsWith("-")) return {
|
|
84
|
+
kind: "error",
|
|
85
|
+
message: `Unexpected argument: ${arg}`
|
|
87
86
|
};
|
|
88
|
-
return {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
if (!ENTRYPOINT_VALUE_FLAGS.has(arg)) return {
|
|
88
|
+
kind: "error",
|
|
89
|
+
message: `Unknown option: ${arg}`
|
|
90
|
+
};
|
|
91
|
+
const value = argvElementAt(argv, i + 1);
|
|
92
|
+
if (value == null || value.startsWith("-")) return {
|
|
93
|
+
kind: "error",
|
|
94
|
+
message: `${arg} requires a value.`
|
|
94
95
|
};
|
|
96
|
+
body.remoteArgs.push(arg, value);
|
|
97
|
+
return { nextIndex: i + 2 };
|
|
95
98
|
}
|
|
96
|
-
function
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
+
function partitionWebArgv(argv) {
|
|
100
|
+
const body = {
|
|
101
|
+
remoteArgs: [],
|
|
99
102
|
port: 3e3
|
|
100
103
|
};
|
|
101
104
|
let i = 0;
|
|
102
105
|
while (i < argv.length) {
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
106
|
+
const arg = argvElementAt(argv, i);
|
|
107
|
+
if (arg === void 0) break;
|
|
108
|
+
const early = parseEarlyWebFlag(arg);
|
|
109
|
+
if (early !== void 0) return early;
|
|
110
|
+
const step = advanceWebArgv(argv, i, arg, body);
|
|
111
|
+
if ("kind" in step) return step;
|
|
105
112
|
i = step.nextIndex;
|
|
106
113
|
}
|
|
114
|
+
return body;
|
|
115
|
+
}
|
|
116
|
+
function parseCliArgs(argv) {
|
|
117
|
+
const partitioned = partitionWebArgv(argv);
|
|
118
|
+
if ("kind" in partitioned) return partitioned;
|
|
119
|
+
const { remoteArgs, port, targetAlias } = partitioned;
|
|
120
|
+
let explicit;
|
|
121
|
+
try {
|
|
122
|
+
explicit = parseEntrypointRemoteArgv(remoteArgs);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
return {
|
|
125
|
+
kind: "error",
|
|
126
|
+
message: error instanceof Error ? error.message : String(error)
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
let usedTargetAlias = false;
|
|
130
|
+
if (targetAlias != null && explicit.dbtTarget == null) {
|
|
131
|
+
explicit = {
|
|
132
|
+
...explicit,
|
|
133
|
+
dbtTarget: targetAlias
|
|
134
|
+
};
|
|
135
|
+
usedTargetAlias = true;
|
|
136
|
+
} else if (targetAlias != null && explicit.dbtTarget != null) return {
|
|
137
|
+
kind: "error",
|
|
138
|
+
message: "Cannot use both --dbt-target and --target (or -t)."
|
|
139
|
+
};
|
|
107
140
|
return {
|
|
108
141
|
kind: "ok",
|
|
109
|
-
|
|
110
|
-
|
|
142
|
+
port,
|
|
143
|
+
explicit,
|
|
144
|
+
usedTargetAlias
|
|
111
145
|
};
|
|
112
146
|
}
|
|
113
147
|
//#endregion
|
|
@@ -243,6 +277,18 @@ var ArtifactSourceService = class {
|
|
|
243
277
|
}
|
|
244
278
|
}
|
|
245
279
|
async seedFromEnvironment() {
|
|
280
|
+
const rawDbtTarget = getDbtToolsDbtTargetFromEnv();
|
|
281
|
+
if (rawDbtTarget != null) {
|
|
282
|
+
const parsed = parseDbtToolsArtifactTarget(rawDbtTarget, this.cwd);
|
|
283
|
+
if (parsed.kind === "remote") {
|
|
284
|
+
const discovery = await this.discoverArtifactSourceInternal(parsed.provider, rawDbtTarget);
|
|
285
|
+
const selectedRunId = discovery.discoveryResult.ok && discovery.mode === "remote" ? this.pickBootstrapRunId(discovery.runs) : null;
|
|
286
|
+
this.applyDiscoveredArtifactSource(discovery, selectedRunId);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
await this.applyLocalDirectory(parsed.resolvedPath, true);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
246
292
|
const rawTarget = getDbtToolsTargetDirFromEnv();
|
|
247
293
|
if (rawTarget == null) return;
|
|
248
294
|
const resolved = resolveLocalArtifactTargetDirFromEnv(this.cwd, rawTarget);
|
|
@@ -802,12 +848,25 @@ if (parsed.kind === "help") {
|
|
|
802
848
|
process.stdout.write(USAGE);
|
|
803
849
|
process.exit(0);
|
|
804
850
|
}
|
|
851
|
+
if (parsed.kind === "version") {
|
|
852
|
+
process.stdout.write(`${readWebPackageVersion()}\n`);
|
|
853
|
+
process.exit(0);
|
|
854
|
+
}
|
|
805
855
|
if (parsed.kind === "error") {
|
|
806
856
|
process.stderr.write(`${parsed.message}\n`);
|
|
807
857
|
process.exit(1);
|
|
808
858
|
}
|
|
809
|
-
var {
|
|
810
|
-
|
|
859
|
+
var { port, explicit, usedTargetAlias } = parsed;
|
|
860
|
+
try {
|
|
861
|
+
const resolved = resolveEntrypointRemoteOptions(explicit);
|
|
862
|
+
applyEntrypointRemoteOptionsToEnv(explicit);
|
|
863
|
+
if (usedTargetAlias && resolved.dbtTarget != null) {
|
|
864
|
+
if (parseDbtToolsArtifactTarget(resolved.dbtTarget, process.cwd()).kind === "local") process.env.DBT_TOOLS_TARGET_DIR = resolved.dbtTarget;
|
|
865
|
+
}
|
|
866
|
+
} catch (error) {
|
|
867
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
868
|
+
process.exit(1);
|
|
869
|
+
}
|
|
811
870
|
await startServer(port);
|
|
812
871
|
var url = `http://${LISTEN_HOST}:${port}`;
|
|
813
872
|
process.stdout.write(`dbt-tools-web ${url}\n`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbt-tools/web",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Browser UI for deterministic dbt artifact investigation — dependencies, execution timelines, inventory (no LLM required)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dbt",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-dom": "^19.2.4",
|
|
39
39
|
"react-markdown": "^10.1.0",
|
|
40
40
|
"remark-gfm": "^4.0.1",
|
|
41
|
-
"@dbt-tools/core": "0.6.
|
|
41
|
+
"@dbt-tools/core": "0.6.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@playwright/test": "^1.59.1",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
width="640"
|
|
3
|
-
height="540"
|
|
4
|
-
viewBox="0 0 640 540"
|
|
5
|
-
fill="none"
|
|
6
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
-
>
|
|
8
|
-
<defs>
|
|
9
|
-
<linearGradient id="app-logo-gradient" x1="24" y1="270" x2="594" y2="270" gradientUnits="userSpaceOnUse">
|
|
10
|
-
<stop stop-color="#5C49F5" />
|
|
11
|
-
<stop offset="1" stop-color="#5B58FF" />
|
|
12
|
-
</linearGradient>
|
|
13
|
-
<filter id="app-logo-shadow" x="0" y="16" width="618" height="508" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
14
|
-
<feFlood flood-opacity="0" result="BackgroundImageFix" />
|
|
15
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha" />
|
|
16
|
-
<feOffset dy="6" />
|
|
17
|
-
<feGaussianBlur stdDeviation="8" />
|
|
18
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.176471 0 0 0 0 0.168627 0 0 0 0 0.560784 0 0 0 0.14 0" />
|
|
19
|
-
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1_1" />
|
|
20
|
-
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1_1" result="shape" />
|
|
21
|
-
</filter>
|
|
22
|
-
</defs>
|
|
23
|
-
<g filter="url(#app-logo-shadow)">
|
|
24
|
-
<rect x="108" y="34" width="270" height="68" rx="34" fill="url(#app-logo-gradient)" />
|
|
25
|
-
<rect x="276" y="142" width="318" height="68" rx="34" fill="url(#app-logo-gradient)" />
|
|
26
|
-
<rect x="24" y="246" width="430" height="72" rx="36" fill="url(#app-logo-gradient)" />
|
|
27
|
-
<rect x="220" y="352" width="292" height="68" rx="34" fill="url(#app-logo-gradient)" />
|
|
28
|
-
<rect x="108" y="458" width="236" height="68" rx="34" fill="url(#app-logo-gradient)" />
|
|
29
|
-
</g>
|
|
30
|
-
</svg>
|